pytorch
a5272cb6 - Error instead of assertion failure for div by sparse (#30260)

Commit
5 years ago
Error instead of assertion failure for div by sparse (#30260) Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/30260 fixes: https://github.com/pytorch/pytorch/issues/30044 Without this PR, ``` >>> torch.tensor(1.) / torch.tensor(1.).to_sparse() Traceback (most recent call last): File "<stdin>", line 1, in <module> RuntimeError: r.is_sparse() INTERNAL ASSERT FAILED at /Users/distiller/project/conda/conda-bld/pytorch_1570710797334/work/aten/src/ATen/native/sparse/SparseTensorMath.cpp:168, please report a bug to PyTorch. ``` Test Plan: Ran the same code with this change: ``` In [1]: import torch In [2]: torch.tensor(1).to_sparse() / torch.tensor(1).to_sparse() --------------------------------------------------------------------------- RuntimeError Traceback (most recent call last) <ipython-input-2-7177f54f30bb> in <module> ----> 1 torch.tensor(1).to_sparse() / torch.tensor(1).to_sparse() RuntimeError: Unsupported tensor layout ``` Differential Revision: D18657387 Pulled By: nairbv fbshipit-source-id: cd23570d46f5b26fd84049e5e63b61b19835603d
Author
Parents
Loading