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

Method _concat_helper

test/python/test_api.py:636–651  ·  view source on GitHub ↗
(self, dev)

Source from the content-addressed store, hash-verified

634 tensor.to_numpy(_cTensor_to_pyTensor(dx0_ct)), dx1)
635
636 def _concat_helper(self, dev):
637 np1 = np.random.random([5, 6, 7, 8]).astype(np.float32)
638 np2 = np.random.random([5, 6, 7, 1]).astype(np.float32)
639 np3 = np.concatenate((np1, np2), axis=3)
640
641 t1 = tensor.Tensor(device=dev, data=np1)
642 t2 = tensor.Tensor(device=dev, data=np2)
643
644 ctensors = singa_api.VecTensor()
645 ctensors.append(t1.data)
646 ctensors.append(t2.data)
647
648 t3_ct = singa_api.ConcatOn(ctensors, 3)
649
650 np.testing.assert_array_almost_equal(
651 tensor.to_numpy(_cTensor_to_pyTensor(t3_ct)), np3)
652
653 def test_concat_cpu(self):
654 self._concat_helper(cpu_dev)

Callers 2

test_concat_cpuMethod · 0.95
test_concat_gpuMethod · 0.95

Calls 3

_cTensor_to_pyTensorFunction · 0.85
TensorMethod · 0.80
appendMethod · 0.80

Tested by

no test coverage detected