Skip to content

transpose() should check dimensions #301

@szagoruyko

Description

@szagoruyko

1D tensor

Should improve error handling here

  • pytorch:
----> 1 torch.randn(8).t()
RuntimeError: out of range
  • lua torch
th> torch.randn(8):t()
[string "_RESULT={torch.randn(8):t()}"]:1: calling 't' on bad self (Tensor must have 2 dimensions at /tmp/luarocks_torch-scm-1-6380/torch7/generic/Tensor.c:592)

3D tensor, t()

should throw an error here:

  • pytorch
In [46]: torch.randn(8,1,2).t()
Out[46]:

(0 ,.,.) =
 -0.3007  2.2507
...
  0.1970 -0.6926
[torch.FloatTensor of size 1x8x2]

like lua torch:

th> torch.randn(8,1,2):t()
[string "_RESULT={torch.randn(8,1,2):t()}"]:1: calling 't' on bad self (Tensor must have 2 dimensions at /tmp/luarocks_torch-scm-1-6380/torch7/generic/Tensor.c:592)

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions