MCPcopy
hub / github.com/tinygrad/tinygrad / test_bytes

Method test_bytes

test/unit/test_tensor_data.py:8–10  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

6
7class TestTensorBytes(unittest.TestCase):
8 def test_bytes(self):
9 lst = Tensor(bytes(b"\xaa\xbb\xcc\xdd"))
10 assert lst.tolist() == [170, 187, 204, 221]
11
12 def test_float_bytes(self):
13 lst = Tensor(bytes(struct.pack("ff", 0.234, 0.8585)), dtype=dtypes.float32)

Callers

nothing calls this directly

Calls 2

tolistMethod · 0.95
TensorClass · 0.90

Tested by

no test coverage detected