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

Method rounde_helper

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

Source from the content-addressed store, hash-verified

3482 self.where_helper(gpu_dev)
3483
3484 def rounde_helper(self, dev):
3485 X = np.array([
3486 0.1, 0.5, 0.9, 1.2, 1.5, 1.8, 2.3, 2.5, 2.7, -1.1, -1.5, -1.9, -2.2,
3487 -2.5, -2.8
3488 ]).astype(np.float32)
3489 x = tensor.from_numpy(X)
3490 x.to_device(dev)
3491
3492 y_t = np.array(
3493 [0., 0., 1., 1., 2., 2., 2., 2., 3., -1., -2., -2., -2., -2.,
3494 -3.]).astype(np.float32)
3495 dy = tensor.from_numpy(y_t)
3496 dy.to_device(dev)
3497
3498 y = autograd.rounde(x)
3499 np.testing.assert_array_almost_equal(tensor.to_numpy(y), y_t)
3500
3501 def test_rounde_cpu(self):
3502 self.rounde_helper(cpu_dev)

Callers 2

test_rounde_cpuMethod · 0.95
test_rounde_gpuMethod · 0.95

Calls 1

to_deviceMethod · 0.45

Tested by

no test coverage detected