MCPcopy Create free account
hub / github.com/apache/arrow / test_tensor_equals

Function test_tensor_equals

python/pyarrow/tests/test_tensor.py:153–171  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

151
152
153def test_tensor_equals():
154 def eq(a, b):
155 assert a.equals(b)
156 assert a == b
157 assert not (a != b)
158
159 def ne(a, b):
160 assert not a.equals(b)
161 assert not (a == b)
162 assert a != b
163
164 data = np.random.randn(10, 6, 4)[::, ::2, ::]
165 tensor1 = pa.Tensor.from_numpy(data)
166 tensor2 = pa.Tensor.from_numpy(np.ascontiguousarray(data))
167 eq(tensor1, tensor2)
168 data = data.copy()
169 data[9, 0, 0] = 1.0
170 tensor2 = pa.Tensor.from_numpy(np.ascontiguousarray(data))
171 ne(tensor1, tensor2)
172
173
174def test_tensor_hashing():

Callers

nothing calls this directly

Calls 3

copyMethod · 0.80
eqFunction · 0.70
neFunction · 0.70

Tested by

no test coverage detected