mirror of
https://github.com/zebrajr/pytorch.git
synced 2025-12-06 12:20:52 +01:00
[traced-graph][sparse] enable to_dense() for compressed (#133371)
Fixes https://github.com/pytorch/pytorch/issues/133174 Pull Request resolved: https://github.com/pytorch/pytorch/pull/133371 Approved by: https://github.com/ezyang
This commit is contained in:
parent
050aa67e41
commit
1a0d00f1f4
|
|
@ -200,9 +200,6 @@ class TestSparseProp(TestCase):
|
||||||
@parametrize("itype", ITYPES)
|
@parametrize("itype", ITYPES)
|
||||||
@all_sparse_layouts("layout")
|
@all_sparse_layouts("layout")
|
||||||
def test_todensenet(self, dtype, itype, layout):
|
def test_todensenet(self, dtype, itype, layout):
|
||||||
if layout is not torch.sparse_coo:
|
|
||||||
self.skipTest("TODO: support non-coo sparsity (#133174)")
|
|
||||||
|
|
||||||
net = ToDenseNet()
|
net = ToDenseNet()
|
||||||
for sparse_input in self.generate_simple_inputs(
|
for sparse_input in self.generate_simple_inputs(
|
||||||
layout,
|
layout,
|
||||||
|
|
|
||||||
|
|
@ -278,6 +278,10 @@ class FunctionalTensor(torch.Tensor):
|
||||||
int = _conversion_method_template(dtype=torch.int32)
|
int = _conversion_method_template(dtype=torch.int32)
|
||||||
long = _conversion_method_template(dtype=torch.int64)
|
long = _conversion_method_template(dtype=torch.int64)
|
||||||
|
|
||||||
|
# TODO(sparse-team): fixes #133174 but can we do without the relay?
|
||||||
|
def to_dense(self):
|
||||||
|
return self.elem.to_dense()
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def layout(self):
|
def layout(self):
|
||||||
return self.elem.layout
|
return self.elem.layout
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user