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

Method _Acos_helper

test/python/test_onnx.py:612–629  ·  view source on GitHub ↗
(self, dev)

Source from the content-addressed store, hash-verified

610 self._Tanh_helper(gpu_dev)
611
612 def _Acos_helper(self, dev):
613 x = np.array([0.1, -1.0, 0.4, 4.0, -0.9,
614 9.0]).reshape(3, 2).astype(np.float32)
615 x = tensor.from_numpy(x)
616 y = autograd.Acos()(x)[0]
617
618 # frontend
619 model = sonnx.to_onnx([x], [y])
620 # print('The model is:\n{}'.format(model))
621
622 # backend
623 sg_ir = sonnx.prepare(model, device=dev)
624 sg_ir.is_graph = True
625 y_t = sg_ir.run([x])
626
627 np.testing.assert_array_almost_equal(tensor.to_numpy(y),
628 tensor.to_numpy(y_t[0]),
629 decimal=5)
630
631 def test_Acos_cpu(self):
632 self._Acos_helper(cpu_dev)

Callers 2

test_Acos_cpuMethod · 0.95
test_Acos_gpuMethod · 0.95

Calls 3

prepareMethod · 0.80
reshapeMethod · 0.45
runMethod · 0.45

Tested by

no test coverage detected