def __init__(self, rank: int, dimension: int, name: Text, axis_names: List[Text], backend: base_backend.BaseBackend, dtype: Type[np.number] = np.float64) -> None: # TODO: Make this computation lazy, once Node doesn't require tensor # at instatiation. copy_tensor = self.make_copy_tensor(rank, dimension, dtype) copy_tensor = backend.convert_to_tensor(copy_tensor) super().__init__(copy_tensor, name, axis_names, backend)
def test_base_backend_convert_to_tensor_not_implemented(): backend = BaseBackend() with pytest.raises(NotImplementedError): backend.convert_to_tensor(np.ones((2, 2)))