Ejemplo n.º 1
0
 def test_tensor_deep_copy(self):
     a = Tensor(np.random.randn(2, 3, 4), inds=[0, 1, 2], tags='blue')
     b = a.copy(deep=True)
     b.add_tag('foo')
     assert 'foo' not in a.tags
     b.data[:] = b.data / 2
     # still reference the same underlying array
     assert_allclose(a.data / 2, b.data)
Ejemplo n.º 2
0
 def test_tensor_copy(self):
     a = Tensor(np.random.randn(2, 3, 4), inds=[0, 1, 2], tags='blue')
     b = a.copy()
     b.tags.add('foo')
     assert 'foo' not in a.tags
     b.data /= 2
     # still reference the same underlying array
     assert_allclose(a.data, b.data)