expecting a contiguous tensor

42 views
Skip to first unread message

Mika S

unread,
Sep 29, 2016, 1:51:35 PM9/29/16
to torch7
I get the error : expecting a contiguous tensor when doing this:

t:view(10000,3,32,32)

The tensor t is sized 10000 x 3072

Mika S

unread,
Sep 29, 2016, 2:39:59 PM9/29/16
to torch7
Also to add, i do a transpose of t before taking the view. THat is the complete sequence is:

t = t:t()
t:view(10000,3,32,32)

Mika S

unread,
Sep 30, 2016, 2:03:15 PM9/30/16
to torch7
This always happens when we take a transpose and hten try to do a view. I guess that since the tensor is stored in something like a row-major format, and view probably wants contiguous memory for the rows it bails out. 

Reshape works perfectly fine.

Kiran Vaidhya

unread,
Oct 3, 2016, 2:18:53 AM10/3/16
to torch7
You can make it contiguous by doing t:contiguous():view(10000,3,32,32)
Reply all
Reply to author
Forward
0 new messages