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

Method _round_even

test/python/test_api.py:908–919  ·  view source on GitHub ↗
(self, dev=gpu_dev)

Source from the content-addressed store, hash-verified

906 self._round_even(gpu_dev)
907
908 def _round_even(self, dev=gpu_dev):
909 q=np.array([0.1, 0.5, 0.9, 1.2, 1.5,
910 1.8, 2.3, 2.5, 2.7, -1.1,
911 -1.5, -1.9, -2.2, -2.5, -2.8]).astype(np.float32)
912 ans = np.array([0., 0., 1., 1., 2.,
913 2., 2., 2., 3., -1.,
914 -2., -2., -2., -2., -3.]).astype(np.float32)
915
916 x = tensor.Tensor(shape=q.shape, device=dev)
917 x.copy_from_numpy(q)
918 y = tensor._call_singa_func(singa_api.RoundE, x.data)
919 np.testing.assert_array_almost_equal(ans, tensor.to_numpy(y))
920
921
922if __name__ == '__main__':

Callers 2

test_round_even_cpuMethod · 0.95
test_round_even_gpuMethod · 0.95

Calls 2

copy_from_numpyMethod · 0.95
TensorMethod · 0.80

Tested by

no test coverage detected