MCPcopy
hub / github.com/pytorch/pytorch / test_basic

Method test_basic

test/torch_np/test_function_base.py:24–33  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

22class TestAppend(TestCase):
23 # tests taken from np.append docstring
24 def test_basic(self):
25 result = np.append([1, 2, 3], [[4, 5, 6], [7, 8, 9]])
26 assert_equal(result, np.arange(1, 10, dtype=int))
27
28 # When `axis` is specified, `values` must have the correct shape.
29 result = np.append([[1, 2, 3], [4, 5, 6]], [[7, 8, 9]], axis=0)
30 assert_equal(result, np.arange(1, 10, dtype=int).reshape((3, 3)))
31
32 with pytest.raises((RuntimeError, ValueError)):
33 np.append([[1, 2, 3], [4, 5, 6]], [7, 8, 9], axis=0)
34
35
36if __name__ == "__main__":

Callers

nothing calls this directly

Calls 4

assert_equalFunction · 0.90
arangeMethod · 0.80
appendMethod · 0.45
reshapeMethod · 0.45

Tested by

no test coverage detected