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

Method noneZero_test

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

Source from the content-addressed store, hash-verified

3074 self.tile_test(gpu_dev)
3075
3076 def noneZero_test(self, dev):
3077 X = np.array([[1, 0], [1, 1]]).astype(np.float32)
3078 y = np.array((np.nonzero(X)))
3079
3080 x = tensor.from_numpy(X)
3081 x.to_device(dev)
3082
3083 result = autograd.nonzero(x)
3084 np.testing.assert_array_almost_equal(tensor.to_numpy(result),
3085 y,
3086 decimal=5)
3087
3088 def test_noneZero_cpu(self):
3089 self.noneZero_test(cpu_dev)

Callers 2

test_noneZero_cpuMethod · 0.95
test_noneZero_gpuMethod · 0.95

Calls 1

to_deviceMethod · 0.45

Tested by

no test coverage detected