KEMBAR78
[primTorch] elementwise CPU strides are incorrect · Issue #77553 · pytorch/pytorch · GitHub
Skip to content

[primTorch] elementwise CPU strides are incorrect #77553

@mruberry

Description

@mruberry
a = torch.testing.make_tensor((2, 2), dtype=torch.long, device='cpu', noncontiguous=True).transpose(0, -1)
a.stride()
: (2, 4)

torch.cos(a).stride()
: (2, 1)

a = torch.testing.make_tensor((2, 2), dtype=torch.long, device='cuda', noncontiguous=True).transpose(0, -1)
a.stride()
: (2, 4)

torch.cos(a).stride()
: (1, 2)

Sometimes the CPU does preserve strides as expected, but for other inputs it doesn't.

cc @VitalyFedyunin @ezyang @mruberry @ngimel

Metadata

Metadata

Assignees

No one assigned

    Labels

    module: TensorIteratormodule: cpuCPU specific problem (e.g., perf, algorithm)module: primTorchtriagedThis issue has been looked at a team member, and triaged and prioritized into an appropriate module

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions