torch.acos not supported for sparse layout #46980
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
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
The text was updated successfully, but these errors were encountered: