Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

torch.acos not supported for sparse layout #46980

Open
hlahkar opened this issue Oct 28, 2020 · 2 comments
Open

torch.acos not supported for sparse layout #46980

hlahkar opened this issue Oct 28, 2020 · 2 comments
Labels
function request A request for a new function or the addition of new arguments/modes to an existing function. module: sparse Related to torch.sparse triaged This issue has been looked at a team member, and triaged and prioritized into an appropriate module

Comments

@hlahkar
Copy link
Contributor

hlahkar commented Oct 28, 2020

Steps to reproduce the behavior:

Call torch.acos on a sparse tensor
Below is a code sample:

import torch
i = torch.cuda.LongTensor([[0, 1, 1],
[2, 0, 2],
[2, 0, 2]])

v = torch.cuda.FloatTensor([3, -44, -5])

s = torch.sparse_coo_tensor(i, v, torch.Size([2, 4, 4]), device=torch.device('cuda'))
print(s.acos())

Actual behaviour
Traceback (most recent call last):
File "sparse_acos.py", line 9, in
print(s.acos())
RuntimeError: Could not run 'aten::acos.out' with arguments from the 'SparseCUDA' backend. 'aten::acos.out' is only available for these backends: [CPU, CUDA, BackendSelect, Named, AutogradOther, AutogradCPU, AutogradCUDA, AutogradXLA, AutogradPrivateUse1, AutogradPrivateUse2, AutogradPrivateUse3, Tracer, Autocast, Batched, VmapMode].

Expected behaviour
acos of the sparse tensor should get calculated and output as a sparse tensor

Environment
Versions of relevant libraries:
[pip3] numpy==1.19.1
[pip3] torch==1.8.0a0
[pip3] torchtext==0.8.0a0+7e267d2
[pip3] torchvision==0.8.0a0+be8192e
[conda] blas 1.0 mkl
[conda] cudatoolkit 10.2.89 hfd86e86_1
[conda] magma-cuda102 2.5.2 1 pytorch
[conda] mkl 2020.1 217
[conda] mkl-include 2020.1 217
[conda] mkl-service 2.3.0 py38he904b0f_0
[conda] mkl_fft 1.1.0 py38h23d657b_0
[conda] mkl_random 1.1.1 py38h0573a6f_0
[conda] numpy 1.19.1 py38hbc911f0_0
[conda] numpy-base 1.19.1 py38hfa32c7d_0
[conda] torch 1.8.0a0 dev_0
[conda] torchtext 0.8.0a0+7e267d2 pypi_0 pypi
[conda] torchvision 0.8.0a0+be8192e pypi_0 pypi

PyTorch Version: 1.8.0a0
OS: Linux
How you installed PyTorch (conda, pip, source): source
Build command you used (if compiling from source): python setup.py develop
Python version: 3.8
CUDA/cuDNN version: 10.2

cc @aocsa @nikitaved @pearu @mruberry

@ssnl
Copy link
Collaborator

ssnl commented Oct 28, 2020

the result will be mostly dense so you probably should just to_dense().acos()

@VitalyFedyunin VitalyFedyunin added enhancement Not as big of a feature, but technically not a bug. Should be easy to fix module: sparse Related to torch.sparse triaged This issue has been looked at a team member, and triaged and prioritized into an appropriate module labels Oct 28, 2020
@mruberry mruberry added function request A request for a new function or the addition of new arguments/modes to an existing function. and removed enhancement Not as big of a feature, but technically not a bug. Should be easy to fix labels Oct 28, 2020
@mruberry
Copy link
Collaborator

Hey @hlahkar, see questions on similar issues.

@pearu pearu added this to To do in Sparse tensors Aug 10, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
function request A request for a new function or the addition of new arguments/modes to an existing function. module: sparse Related to torch.sparse triaged This issue has been looked at a team member, and triaged and prioritized into an appropriate module
Projects
Development

No branches or pull requests

4 participants