错误的参数 #2 到?(期望数字或 torch.DoubleTensor 或 torch.DoubleStorage 在 Tensor.c:1125)

bad argument #2 to ?(expecting number or torch.DoubleTensor or torch.DoubleStorage at Tensor.c:1125)

我使用的代码是:

  local word2vec=nn.LookupTable(sent_len,300)

then got the error:bad argument2 # to ?(expecting number or torch.DoubleTensor or torch.DoubleStorage at Tensor.c:1125)

经过多次尝试,终于找到是sent_len类型的原因,应该是数字类型,但我的代码中没有。