(self, dev)
| 1468 | self._and_helper(gpu_dev) |
| 1469 | |
| 1470 | def _or_helper(self, dev): |
| 1471 | x0 = np.array([1.0, 1.0, 2.0, -3.0, 0, |
| 1472 | -7.0]).reshape(3, 2).astype(np.float32) |
| 1473 | x1 = np.array([-1.0, 0, 2.0, 4.0, 0, |
| 1474 | -7.0]).reshape(3, 2).astype(np.float32) |
| 1475 | |
| 1476 | x0 = tensor.from_numpy(x0) |
| 1477 | x1 = tensor.from_numpy(x1) |
| 1478 | x0.to_device(dev) |
| 1479 | x1.to_device(dev) |
| 1480 | |
| 1481 | y = autograd._or(x0, x1) |
| 1482 | # frontend |
| 1483 | model = sonnx.to_onnx([x0, x1], [y]) |
| 1484 | # print('The model is:\n{}'.format(model)) |
| 1485 | |
| 1486 | # backend |
| 1487 | sg_ir = sonnx.prepare(model, device=dev) |
| 1488 | sg_ir.is_graph = True |
| 1489 | y_t = sg_ir.run([x0, x1]) |
| 1490 | |
| 1491 | np.testing.assert_array_almost_equal(tensor.to_numpy(y), |
| 1492 | tensor.to_numpy(y_t[0]), |
| 1493 | decimal=5) |
| 1494 | |
| 1495 | def test_or_cpu(self): |
| 1496 | self._or_helper(cpu_dev) |
no test coverage detected