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

Method _Sinh_helper

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

Source from the content-addressed store, hash-verified

532 self._Sin_helper(gpu_dev)
533
534 def _Sinh_helper(self, dev):
535 x = np.array([0.1, -1.0, 0.4, 4.0, -0.9,
536 9.0]).reshape(3, 2).astype(np.float32)
537 x = tensor.from_numpy(x)
538 y = autograd.Sinh()(x)[0]
539
540 # frontend
541 model = sonnx.to_onnx([x], [y])
542 # print('The model is:\n{}'.format(model))
543
544 # backend
545 sg_ir = sonnx.prepare(model, device=dev)
546 sg_ir.is_graph = True
547 y_t = sg_ir.run([x])
548
549 np.testing.assert_array_almost_equal(tensor.to_numpy(y),
550 tensor.to_numpy(y_t[0]),
551 decimal=5)
552
553 def test_Sinh_cpu(self):
554 self._Sinh_helper(cpu_dev)

Callers 2

test_Sinh_cpuMethod · 0.95
test_Sinh_gpuMethod · 0.95

Calls 3

prepareMethod · 0.80
reshapeMethod · 0.45
runMethod · 0.45

Tested by

no test coverage detected