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

Method _and_helper

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

Source from the content-addressed store, hash-verified

1950 self._SeLU_helper(gpu_dev)
1951
1952 def _and_helper(self, dev):
1953 x0 = np.array([0, -0.3, -0.1, 0.1, 0.5,
1954 0.9]).reshape(3, 2).astype(np.float32)
1955 x1 = np.array([0, -0.3, 0, 0.1, 0.5, 0.9]).reshape(3,
1956 2).astype(np.float32)
1957
1958 y = np.logical_and(x0, x1)
1959 x0 = tensor.from_numpy(x0)
1960 x1 = tensor.from_numpy(x1)
1961 x0.to_device(dev)
1962 x1.to_device(dev)
1963
1964 result = autograd._and(x0, x1)
1965
1966 np.testing.assert_array_almost_equal(tensor.to_numpy(result),
1967 y,
1968 decimal=5)
1969
1970 def test_and_cpu(self):
1971 self._and_helper(cpu_dev)

Callers 2

test_and_cpuMethod · 0.95
test_and_gpuMethod · 0.95

Calls 2

reshapeMethod · 0.45
to_deviceMethod · 0.45

Tested by

no test coverage detected