| 84 | "v_scalar", [2, 2.5, torch.tensor(2), torch.tensor(2.5)] |
| 85 | ) |
| 86 | def 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( |