summaryrefslogtreecommitdiffstats
path: root/contrib/torch/nn/ErrorMessages.lua
blob: a5cbed053df63a13bf0d3bca9db037fb08eed605 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
local mt = {
  __index = function(table, key)
    error("nn."..key.." is only supported for Float or Double Tensors.")
  end
}

local tensors = {
  torch.ByteTensor,
  torch.CharTensor,
  torch.ShortTensor,
  torch.IntTensor,
  torch.LongTensor,
}

for _, t in ipairs(tensors) do
  t.nn = {}
  setmetatable(t.nn, mt)
end