MCPcopy
hub / github.com/dmlc/dgl / test_error_op_scalar

Function test_error_op_scalar

tests/python/pytorch/sparse/test_elementwise_op_sp.py:86–101  ·  view source on GitHub ↗
(op, v_scalar)

Source from the content-addressed store, hash-verified

84 "v_scalar", [2, 2.5, torch.tensor(2), torch.tensor(2.5)]
85)
86def test_error_op_scalar(op, v_scalar):
87 ctx = F.ctx()
88 row = torch.tensor([1, 0, 2]).to(ctx)
89 col = torch.tensor([0, 3, 2]).to(ctx)
90 val = torch.randn(len(row)).to(ctx)
91 A = from_coo(row, col, val, shape=(3, 4))
92
93 with pytest.raises(TypeError):
94 A + v_scalar
95 with pytest.raises(TypeError):
96 v_scalar + A
97
98 with pytest.raises(TypeError):
99 A - v_scalar
100 with pytest.raises(TypeError):
101 v_scalar - A
102
103
104@pytest.mark.parametrize(

Callers

nothing calls this directly

Calls 3

from_cooFunction · 0.90
ctxMethod · 0.45
toMethod · 0.45

Tested by

no test coverage detected