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
{{ message }}
Repository navigation
When does OO syntax pass the Tensor as the resulting Tensor? #55
"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 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).
Activity
soumith commentedon Aug 29, 2016
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).
There is unfortunately no rule.