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

Method _Atanh_helper

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

Source from the content-addressed store, hash-verified

740 self._Atan_helper(gpu_dev)
741
742 def _Atanh_helper(self, dev):
743 x = np.array([0.1, -1.0, 0.4, 4.0, -0.9,
744 9.0]).reshape(3, 2).astype(np.float32)
745 x = tensor.from_numpy(x)
746 y = autograd.Atanh()(x)[0]
747
748 # frontend
749 model = sonnx.to_onnx([x], [y])
750 # print('The model is:\n{}'.format(model))
751
752 # backend
753 sg_ir = sonnx.prepare(model, device=dev)
754 sg_ir.is_graph = True
755 y_t = sg_ir.run([x])
756
757 np.testing.assert_array_almost_equal(tensor.to_numpy(y),
758 tensor.to_numpy(y_t[0]),
759 decimal=5)
760
761 def test_Atanh_cpu(self):
762 self._Atanh_helper(cpu_dev)

Callers 2

test_Atanh_cpuMethod · 0.95
test_Atanh_gpuMethod · 0.95

Calls 3

prepareMethod · 0.80
reshapeMethod · 0.45
runMethod · 0.45

Tested by

no test coverage detected