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

Function test_tensor_ipc_roundtrip

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

Source from the content-addressed store, hash-verified

100
101
102def test_tensor_ipc_roundtrip(tmpdir):
103 data = np.random.randn(10, 4)
104 tensor = pa.Tensor.from_numpy(data)
105
106 path = os.path.join(str(tmpdir), 'pyarrow-tensor-ipc-roundtrip')
107 mmap = pa.create_memory_map(path, 1024)
108
109 pa.ipc.write_tensor(tensor, mmap)
110
111 mmap.seek(0)
112 result = pa.ipc.read_tensor(mmap)
113
114 assert result.equals(tensor)
115
116
117@pytest.mark.gzip

Callers

nothing calls this directly

Calls 3

seekMethod · 0.80
equalsMethod · 0.80
joinMethod · 0.45

Tested by

no test coverage detected