Hi,
Still new to all of this so I'm not sure if this problem is caused by some underlying problem in my framework.
On line 130 of gradfuns.lua:
return torch.narrow(g, dim, torch.size(x, dim) + 1, torch.size(y, dim))
torch.size(x,dim) errors at some point.
The function is called multiple times.
First x is a tesor of size 3000x10, later 3000x9 and so on... and dim is 2. So far no problem.
Finally x is a vector of 3000 and dim is 2 -> error.
I fixed it for me by adding a few lines of code:
if (torch.nDimension(x)>1) then
size_x_dim = torch.size(x, dim)
else
size_x_dim = 1
end
local size_y_dim
if (torch.nDimension(y)>1) then
size_y_dim = torch.size(y, dim)
else
size_y_dim = 1
end
return torch.narrow(g, dim, size_x_dim + 1, size_y_dim)
Not the nicest way, but working.
I'm not sure why the code is not giving x as a tensor of size 3000x1 instead of a vector of size 3000?
Hi, Still new to all of this so I'm not sure if this problem is caused by some underlying problem in my framework. On line 130 of gradfuns.lua:
return torch.narrow(g, dim, torch.size(x, dim) + 1, torch.size(y, dim))
torch.size(x,dim) errors at some point. The function is called multiple times. First x is a tesor of size 3000x10, later 3000x9 and so on... and dim is 2. So far no problem. Finally x is a vector of 3000 and dim is 2 -> error. I fixed it for me by adding a few lines of code:Not the nicest way, but working. I'm not sure why the code is not giving x as a tensor of size 3000x1 instead of a vector of size 3000?
Thanks, Jonas