You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
"The Torch package adopts the same concept, so that calling a function directly on the Tensor itself using an object-oriented syntax is equivalent to passing the Tensor as the optional resulting Tensor. The following two calls are equivalent.
torch.log(x, x)
x:log()
"
However, this doesn't always seem to be the case. For example, if we call
x:cat(y), x.reshape(2,3), x:t()
then x does NOT change after the call. In particular, I can't see why x:add(y) changes x, while x:cat(y) doesn't.
So is there any rule on when a tensor will be changed by calling on itself in OO syntax? Thanks.
The text was updated successfully, but these errors were encountered:
the three functions you listed, i.e. cat, reshape and t do not have an in-place mode, and return a new tensor (their documentation should cover that detail).
maths.md states:
"The Torch package adopts the same concept, so that calling a function directly on the Tensor itself using an object-oriented syntax is equivalent to passing the Tensor as the optional resulting Tensor. The following two calls are equivalent.
torch.log(x, x)
x:log()
"
However, this doesn't always seem to be the case. For example, if we call
x:cat(y), x.reshape(2,3), x:t()
then x does NOT change after the call. In particular, I can't see why x:add(y) changes x, while x:cat(y) doesn't.
So is there any rule on when a tensor will be changed by calling on itself in OO syntax? Thanks.
The text was updated successfully, but these errors were encountered: