MCPcopy Create free account
hub / github.com/MAC-VO/MAC-VO / test_circular_random

Function test_circular_random

Scripts/UnitTest/test_circular_buffer.py:16–26  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

14
15@pytest.mark.local
16def test_circular_random():
17 buf = TensorQueue(torch.Size((1, 10)), grow_dim=1, device=torch.device('cpu'), dtype=torch.long)
18 start = 0
19 length_range = 8
20
21 for _ in range(50):
22 x_length = random.randint(0, length_range)
23 x = torch.arange(start, (start := start + x_length), step=1).unsqueeze(0)
24 buf.push(x)
25 content = buf.tensor
26 assert ((content[1:] - content[:-1]) == 1).all(), "Unexpected result."
27
28@pytest.mark.local
29def test_circular_scalar():

Callers

nothing calls this directly

Calls 2

pushMethod · 0.95
TensorQueueClass · 0.90

Tested by

no test coverage detected