Skip to content

[sparse] regressions after moving into ATen #9110

@ssnl

Description

@ssnl
  1. create cuda sparse tensor with cpu indices tensor
    master:

    >>> torch.sparse.FloatTensor(torch.zeros(1,4).long().cuda(), torch.randn(4,4,4), [3,4,4])
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
    RuntimeError

    0.4:

    >>> torch.sparse.FloatTensor(torch.zeros(1,4).long().cuda(), torch.randn(4,4,4), [3,4,4])
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
    RuntimeError: Expected object of type torch.LongTensor but found type torch.cuda.LongTensor for argument #1 'indices'
  2. add cuda sparse tensor to cpu dense tensor
    master:

    >>> x = torch.zeros(3,4)
    >>> sparse_y = torch.cuda.sparse.FloatTensor(torch.zeros(1,4).long().cuda(), torch.randn(4,4,4).cuda(), [3,4,4])
    >>> x + sparse_y
    [1]    2065657 segmentation fault (core dumped)  python -i ~/env.py

    0.4:

    >>> x + sparse_y
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
    RuntimeError: The size of tensor a (3) must match the size of tensor b (4) at non-singleton dimension 1
  3. dense + sparse with wrong number of dimdensions
    master:

    >>> x = torch.zeros(3,4)
    >>> sparse_y = torch.cuda.sparse.FloatTensor(torch.zeros(1,4).long().cuda(), torch.randn(4,4,4).cuda(), [3,4,4])
    >>> x.cuda()+sparse_y
    tensor([[ 2.1478, -0.7767, -0.8796, -2.2104],
            [ 0.0000,  0.0000,  0.0000,  0.0000],
            [ 0.0000,  0.0000,  0.0000,  0.0000]], device='cuda:0')

    0.4:

    >>> x = torch.zeros(3,4)
    >>> sparse_y = torch.cuda.sparse.FloatTensor(torch.zeros(1,4).long().cuda(), torch.randn(4,4,4).cuda(), [3,4,4])
    >>> x.cuda() + sparse_y
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
    RuntimeError: The size of tensor a (3) must match the size of tensor b (4) at non-singleton dimension 1

cc @ezyang

Metadata

Metadata

Assignees

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