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

Method _kint_kint_bc

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

Source from the content-addressed store, hash-verified

589 self._kint_kint(gpu_dev)
590
591 def _kint_kint_bc(self, dev=gpu_dev):
592 a_np = np.array([[[17, 4, 9, 22, 18], [-9, 9, -1, -1, 4],
593 [1, 14, 7, 1, 4], [3, 14, -2, 3, -8]],
594 [[-25, 6, 8, -7, 22], [-14, 0, -1, 15, 14],
595 [1, 3, -8, -19, -3], [1, 12, 12, -3, -3]],
596 [[-10, -14, -17, 19, -5], [-4, -12, 7, -16, -2],
597 [-8, 3, -5, -11, 0], [4, 0, 3, -6, -3]]],
598 dtype=np.int32)
599 b_np = np.array([[-6, -3, -8, -17, 1], [-4, -16, 4, -9, 0],
600 [7, 1, 11, -12, 4], [-6, -8, -5, -3, 0]],
601 dtype=np.int32)
602 ta = tensor.from_numpy(a_np)
603 tb = tensor.from_numpy(b_np)
604 ta.to_device(dev)
605 tb.to_device(dev)
606 y = ta - tb
607 np.testing.assert_array_almost_equal(tensor.to_numpy(y), a_np - b_np)
608
609 def test_kint_kint_bc_cpu(self, dev=cpu_dev):
610 self._kint_kint_bc(cpu_dev)

Callers 2

test_kint_kint_bc_cpuMethod · 0.95
test_kint_kint_bc_gpuMethod · 0.95

Calls 1

to_deviceMethod · 0.45

Tested by

no test coverage detected