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

Method _greater_helper

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

Source from the content-addressed store, hash-verified

93 (_tuple_to_string(actual), _tuple_to_string(expect)))
94
95 def _greater_helper(self, dev):
96 x0 = np.array([-0.9, -0.3, -0.1, 0.1, 0.5,
97 0.9]).reshape(3, 2).astype(np.float32)
98 x1 = np.array([0, -0.3, 0, 0.1, 0, 0.9]).reshape(3,
99 2).astype(np.float32)
100 y = np.greater(x0, x1)
101 x0 = tensor.from_numpy(x0)
102 x1 = tensor.from_numpy(x1)
103 x0.to_device(dev)
104 x1.to_device(dev)
105
106 result = autograd.greater(x0, x1)
107
108 np.testing.assert_array_almost_equal(tensor.to_numpy(result),
109 y,
110 decimal=5)
111
112 def test_Greater_cpu(self):
113 self._greater_helper(cpu_dev)

Callers 2

test_Greater_cpuMethod · 0.95
test_Greater_gpuMethod · 0.95

Calls 2

reshapeMethod · 0.45
to_deviceMethod · 0.45

Tested by

no test coverage detected