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

Method _not_helper

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

Source from the content-addressed store, hash-verified

1533 self._xor_helper(gpu_dev)
1534
1535 def _not_helper(self, dev):
1536 x = np.array([1.0, -1.0, 0, -0.1, 0,
1537 -7.0]).reshape(3, 2).astype(np.float32)
1538 x = tensor.from_numpy(x)
1539 x.to_device(dev)
1540
1541 y = autograd._not(x)
1542
1543 # frontend
1544 model = sonnx.to_onnx([x], [y])
1545 # print('The model is:\n{}'.format(model))
1546
1547 # backend
1548 sg_ir = sonnx.prepare(model, device=dev)
1549 sg_ir.is_graph = True
1550 y_t = sg_ir.run([x])
1551
1552 np.testing.assert_array_almost_equal(tensor.to_numpy(y),
1553 tensor.to_numpy(y_t[0]),
1554 decimal=5)
1555
1556 def test_not_cpu(self):
1557 self._not_helper(cpu_dev)

Callers 2

test_not_cpuMethod · 0.95
test_not_gpuMethod · 0.95

Calls 4

prepareMethod · 0.80
reshapeMethod · 0.45
to_deviceMethod · 0.45
runMethod · 0.45

Tested by

no test coverage detected