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

Method _Asin_helper

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

Source from the content-addressed store, hash-verified

662 self._Acosh_helper(gpu_dev)
663
664 def _Asin_helper(self, dev):
665 x = np.array([0.1, -1.0, 0.4, 4.0, -0.9,
666 9.0]).reshape(3, 2).astype(np.float32)
667 x = tensor.from_numpy(x)
668 y = autograd.Asin()(x)[0]
669
670 # frontend
671 model = sonnx.to_onnx([x], [y])
672 # print('The model is:\n{}'.format(model))
673
674 # backend
675 sg_ir = sonnx.prepare(model, device=dev)
676 sg_ir.is_graph = True
677 y_t = sg_ir.run([x])
678
679 np.testing.assert_array_almost_equal(tensor.to_numpy(y),
680 tensor.to_numpy(y_t[0]),
681 decimal=5)
682
683 def test_Asin_cpu(self):
684 self._Asin_helper(cpu_dev)

Callers 2

test_Asin_cpuMethod · 0.95
test_Asin_gpuMethod · 0.95

Calls 3

prepareMethod · 0.80
reshapeMethod · 0.45
runMethod · 0.45

Tested by

no test coverage detected