(self, scipy_backend)
| 2879 | assert (tensor != expected).nnz == 0 |
| 2880 | |
| 2881 | def test_get_param_tensor(self, scipy_backend): |
| 2882 | shape = (2, 2) |
| 2883 | size = np.prod(shape) |
| 2884 | scipy_backend.param_to_size = {-1: 1, 3: 4} |
| 2885 | outer = scipy_backend.get_param_tensor(shape, 3) |
| 2886 | assert outer.keys() == {-1}, "Should only be constant variable ID." |
| 2887 | inner = outer[-1] |
| 2888 | assert inner.keys() == {3}, "Should only be the parameter slice of parameter with id 3." |
| 2889 | tensor = inner[3] |
| 2890 | assert sp.issparse(tensor), "Should be scipy sparse" |
| 2891 | assert tensor.shape == (16, 1), "Should be a 4*4x1 tensor" |
| 2892 | assert ( |
| 2893 | tensor.reshape((size, size)) != sp.eye_array(size, format="csr") |
| 2894 | ).nnz == 0, "Should be eye(4) when reshaping" |
| 2895 | |
| 2896 | def test_tensor_view_add_dicts(self, scipy_backend): |
| 2897 | view = scipy_backend.get_empty_view() |
nothing calls this directly
no test coverage detected