[torch] some bugs

error1

1.”bad argument #1 to ‘set’ (expecting number or torch.DoubleTensor or torch.DoubleStorage at /tmp/luarocks_torch-scm-1-9965/torch7/generic/Tensor.c:1153)”

mulLSTMmodel = nn.MapTable(nn.convLSTM(opt))
out = mulLSTMmodel:forward(input)

I wrote that nn.convLSTM, then error happens at the 2rd line.
I checked the MapTable.lua, then I found (default) it will copy self.sharedparams = {'weight', 'bias', 'gradWeight', 'gradBias'},
so I

mulLSTMmodel = nn.MapTable(nn.convLSTM(opt), false)

However, it may influence the backward.
Finally, I decided to write my own MapTable.

error2

“inputs[1] should be an nngraph.Node but is of type torch.DoubleTensor”
don’t use any nnfunction in a layer written by yourself if you require ‘nngraph’

require 'nn'

local layer, Parent = torch.class('nn.mul_convLSTM', 'nn.Module')

...

function layer:updateOutput(input)
    ...
    out = nn.Reshape(out2)
end

the code shown above works well, however, once you use require nngraph in the code,
–> “inputs[1] should be an nngraph.Node but is of type torch.DoubleTensor”

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值