MCPcopy Index your code
hub / github.com/numpy/numpy / test_3d_tensor

Method test_3d_tensor

numpy/_core/tests/test_multiarray.py:8349–8373  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

8347 assert_equal(np.inner(b, a), desired)
8348
8349 def test_3d_tensor(self):
8350 for dt in np.typecodes['AllInteger'] + np.typecodes['AllFloat'] + '?':
8351 a = np.arange(24).reshape(2, 3, 4).astype(dt)
8352 b = np.arange(24, 48).reshape(2, 3, 4).astype(dt)
8353 desired = np.array(
8354 [[[[ 158, 182, 206],
8355 [ 230, 254, 278]],
8356
8357 [[ 566, 654, 742],
8358 [ 830, 918, 1006]],
8359
8360 [[ 974, 1126, 1278],
8361 [1430, 1582, 1734]]],
8362
8363 [[[1382, 1598, 1814],
8364 [2030, 2246, 2462]],
8365
8366 [[1790, 2070, 2350],
8367 [2630, 2910, 3190]],
8368
8369 [[2198, 2542, 2886],
8370 [3230, 3574, 3918]]]]
8371 ).astype(dt)
8372 assert_equal(np.inner(a, b), desired)
8373 assert_equal(np.inner(b, a).transpose(2, 3, 0, 1), desired)
8374
8375
8376class TestChoose:

Callers

nothing calls this directly

Calls 4

assert_equalFunction · 0.90
astypeMethod · 0.80
reshapeMethod · 0.80
innerMethod · 0.80

Tested by

no test coverage detected