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

Function test_tensor_ipc_strided

python/pyarrow/tests/test_tensor.py:133–150  ·  view source on GitHub ↗
(tmpdir)

Source from the content-addressed store, hash-verified

131
132
133def test_tensor_ipc_strided(tmpdir):
134 data1 = np.random.randn(10, 4)
135 tensor1 = pa.Tensor.from_numpy(data1[::2])
136
137 data2 = np.random.randn(10, 6, 4)
138 tensor2 = pa.Tensor.from_numpy(data2[::, ::2, ::])
139
140 path = os.path.join(str(tmpdir), 'pyarrow-tensor-ipc-strided')
141 mmap = pa.create_memory_map(path, 2048)
142
143 for tensor in [tensor1, tensor2]:
144 mmap.seek(0)
145 pa.ipc.write_tensor(tensor, mmap)
146
147 mmap.seek(0)
148 result = pa.ipc.read_tensor(mmap)
149
150 assert result.equals(tensor)
151
152
153def test_tensor_equals():

Callers

nothing calls this directly

Calls 3

seekMethod · 0.80
equalsMethod · 0.80
joinMethod · 0.45

Tested by

no test coverage detected