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

Method _or_helper

test/python/test_operation.py:1977–1993  ·  view source on GitHub ↗
(self, dev)

Source from the content-addressed store, hash-verified

1975 self._and_helper(gpu_dev)
1976
1977 def _or_helper(self, dev):
1978 x0 = np.array([1.0, 1.0, 2.0, -3.0, 0,
1979 -7.0]).reshape(3, 2).astype(np.float32)
1980 x1 = np.array([-1.0, 0, 2.0, 4.0, 0,
1981 -7.0]).reshape(3, 2).astype(np.float32)
1982
1983 y = np.logical_or(x0, x1)
1984 x0 = tensor.from_numpy(x0)
1985 x1 = tensor.from_numpy(x1)
1986 x0.to_device(dev)
1987 x1.to_device(dev)
1988
1989 result = autograd._or(x0, x1)
1990
1991 np.testing.assert_array_almost_equal(tensor.to_numpy(result),
1992 y,
1993 decimal=5)
1994
1995 def test_or_cpu(self):
1996 self._or_helper(cpu_dev)

Callers 2

test_or_cpuMethod · 0.95
test_or_gpuMethod · 0.95

Calls 2

reshapeMethod · 0.45
to_deviceMethod · 0.45

Tested by

no test coverage detected