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

Method _Acosh_helper

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

Source from the content-addressed store, hash-verified

636 self._Acos_helper(gpu_dev)
637
638 def _Acosh_helper(self, dev):
639 x = np.array([0.1, -1.0, 0.4, 4.0, -0.9,
640 9.0]).reshape(3, 2).astype(np.float32)
641 x = tensor.from_numpy(x)
642 y = autograd.Acosh()(x)[0]
643
644 # frontend
645 model = sonnx.to_onnx([x], [y])
646 # print('The model is:\n{}'.format(model))
647
648 # backend
649 sg_ir = sonnx.prepare(model, device=dev)
650 sg_ir.is_graph = True
651 y_t = sg_ir.run([x])
652
653 np.testing.assert_array_almost_equal(tensor.to_numpy(y),
654 tensor.to_numpy(y_t[0]),
655 decimal=5)
656
657 def test_Acosh_cpu(self):
658 self._Acosh_helper(cpu_dev)

Callers 2

test_Acosh_cpuMethod · 0.95
test_Acosh_gpuMethod · 0.95

Calls 3

prepareMethod · 0.80
reshapeMethod · 0.45
runMethod · 0.45

Tested by

no test coverage detected