Tensor or Variable

I have compiled pytorch form source of version 0.4.x, and I am confused about the type:

>>> n = torch.FloatTensor(4, 10)
>>> n.type
<built-in method type of Variable object at 0x7feff98105f0>
>>> n.type()
'torch.FloatTensor'

However, the version of 0.3.1 got:

>>> n = torch.FloatTensor(4, 10)
>>> n.type
<bound method FloatTensor._type of
1.00000e-35 *
 -2.1516  0.0000 -2.1516  0.0000  0.0022  0.0000  0.0022  0.0000  0.0022  0.0000
  0.0022  0.0000  0.0022  0.0000  0.0022  0.0000  0.0022  0.0000  0.0022  0.0000
  0.0000  0.0000  0.0000  0.0000  0.0118  0.0000  0.0118  0.0000 -2.7647  0.0000
 -2.7647  0.0000  0.0000  0.0000  0.0000  0.0000  0.0118  0.0000 -2.7711  0.0000
[torch.FloatTensor of size 4x10]
>>> n.type()
'torch.FloatTensor'

Is there any release note about the difference output type between versions. Thanks.

Tensors and Variables will be merged in the next release. In the current master version this happened already.
You could have a look at the breaking changes for the merge.

Thanks a lot for replying.
I have been confused by it for a while, and install/uninstall two versions again and again to debug. :joy:And I suggest to put the most recent changes log somewhere easy to find.

Well, I think it’s quite hard to maintain a current documentation of code which is changing a lot.
The release notes with a clear description will be available once the version is officially released :wink:

OK.
BTW, I found the code wouldn’t run with version 0.4, the error:
RuntimeError: The size of tensor a (25) must match the size of tensor b (3250) at non-singleton dimension 3

x.data + grid_x

where, x.data is a (2, 5, 13, 25) Variable, and grid_x is a [3250] Variable. In version 0.3.1, they are all FloatTensor and work well. May be I have to convert them to FloatTensor?

You could also try that:

(x.view(-1) + grid_x).view(2, 5, 13, 25)

:+1::+1::+1:
Thanks! I will try to change the code with the new datatype.