torch / torch7

http://torch.ch
Other
8.96k stars 2.38k forks source link

Got an nil in nn.Copy('torch.ByteTensor', 'torch.CudaTensor', false, true) #1153

Open Angel-Jia opened 6 years ago

Angel-Jia commented 6 years ago

I got an error in lua script:

lua: /root/torch/install/share/lua/5.1/nn/Copy.lua:12: attempt to index a nil value
stack traceback:
        /root/torch/install/share/lua/5.1/nn/Copy.lua:12: in function '__init'
        /root/torch/install/share/lua/5.1/torch/init.lua:91: in function </root/torch/install/share/lua/5.1/torch/init.lua:87>
        [C]: in function 'Copy'
        /root/train_ocr/model/config.lua:62: in function 'createModel'
        convert_t7.lua:100: in main chunk

The line 62 in config.lua:

model:add(nn.Copy('torch.ByteTensor', 'torch.CudaTensor', false, true))

The line 12 in Copy.lua:

self.output = torch.getmetatable(outtype).new()

I found that torch.getmetatable(outtype) returns nil. The value of outtype is torch.CudaTensor Is there no torch.CudaTensor now in torch7?