Skip to content

Broadcasting code always creates a new tensor #2054

@colesbury

Description

@colesbury

For example:

self = output
torch.addmm(alpha, self, beta, matrix1, matrix2, out=output)

At the entrance to the call, self and out are the same object. However, the broadcasting code always creates a new self tensor for the call to expand().

(https://github.com/pytorch/pytorch/blob/master/tools/cwrap/plugins/Broadcast.py)

Some code in TH and THC checks for object identity, which this breaks:

https://github.com/pytorch/pytorch/blob/master/torch/lib/TH/generic/THTensorMath.c#L1306

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