[Torch] LongStorage to Tensor conversion

35 views
Skip to first unread message

Sumon Dey

unread,
Aug 5, 2017, 11:33:05 PM8/5/17
to torch7
Is there anyway to convert LongStorage to Tensor ? Also, any short function to find maximum dimension size of a Tensor?

Tasty Minerals

unread,
Aug 6, 2017, 7:03:04 AM8/6/17
to torch7
Convert LongStorage to Tensor
long = torch.LongStorage({2, 4})
tensor
= torch.Tensor({long[1], long[2]})

Getting the max dim size
t = torch.IntTensor(tensor:dim()):fill(0) -- collect your dims here
for i=1, tensor:dim() do t[i] = t:size(i) end
torch
.max(t)
Reply all
Reply to author
Forward
0 new messages