Skip to content

When does OO syntax pass the Tensor as the resulting Tensor? #55

Description

@xzhangcs

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions