MCPcopy Create free account
hub / github.com/apache/singa / _kint_kint

Method _kint_kint

test/python/test_tensor.py:562–582  ·  view source on GitHub ↗
(self, dev=gpu_dev)

Source from the content-addressed store, hash-verified

560 self._kint_float(cpu_dev)
561
562 def _kint_kint(self, dev=gpu_dev):
563 a_np = np.array([[[17, 4, 9, 22, 18], [-9, 9, -1, -1, 4],
564 [1, 14, 7, 1, 4], [3, 14, -2, 3, -8]],
565 [[-25, 6, 8, -7, 22], [-14, 0, -1, 15, 14],
566 [1, 3, -8, -19, -3], [1, 12, 12, -3, -3]],
567 [[-10, -14, -17, 19, -5], [-4, -12, 7, -16, -2],
568 [-8, 3, -5, -11, 0], [4, 0, 3, -6, -3]]],
569 dtype=np.int32)
570 b_np = np.array([[[-6, -3, -8, -17, 1], [-4, -16, 4, -9, 0],
571 [7, 1, 11, -12, 4], [-6, -8, -5, -3, 0]],
572 [[-11, 9, 4, -15, 14], [18, 11, -1, -10, 10],
573 [-4, 12, 2, 9, 3], [7, 0, 17, 1, 4]],
574 [[18, -13, -12, 9, -11], [19, -4, -7, 19, 14],
575 [18, 9, -8, 19, -2], [8, 9, -1, 6, 9]]],
576 dtype=np.int32)
577 ta = tensor.from_numpy(a_np)
578 tb = tensor.from_numpy(b_np)
579 ta.to_device(dev)
580 tb.to_device(dev)
581 y = ta - tb
582 np.testing.assert_array_almost_equal(tensor.to_numpy(y), a_np - b_np)
583
584 def test_kint_kint_cpu(self, dev=cpu_dev):
585 self._kint_kint(cpu_dev)

Callers 2

test_kint_kint_cpuMethod · 0.95
test_kint_kint_gpuMethod · 0.95

Calls 1

to_deviceMethod · 0.45

Tested by

no test coverage detected