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

Method _Asinh_helper

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

Source from the content-addressed store, hash-verified

688 self._Asin_helper(gpu_dev)
689
690 def _Asinh_helper(self, dev):
691 x = np.array([0.1, -1.0, 0.4, 4.0, -0.9,
692 9.0]).reshape(3, 2).astype(np.float32)
693 x = tensor.from_numpy(x)
694 y = autograd.Asinh()(x)[0]
695
696 # frontend
697 model = sonnx.to_onnx([x], [y])
698 # print('The model is:\n{}'.format(model))
699
700 # backend
701 sg_ir = sonnx.prepare(model, device=dev)
702 sg_ir.is_graph = True
703 y_t = sg_ir.run([x])
704
705 np.testing.assert_array_almost_equal(tensor.to_numpy(y),
706 tensor.to_numpy(y_t[0]),
707 decimal=5)
708
709 def test_Asinh_cpu(self):
710 self._Asinh_helper(cpu_dev)

Callers 2

test_Asinh_cpuMethod · 0.95
test_Asinh_gpuMethod · 0.95

Calls 3

prepareMethod · 0.80
reshapeMethod · 0.45
runMethod · 0.45

Tested by

no test coverage detected