You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@singa.apache.org by GitBox <gi...@apache.org> on 2020/06/20 19:30:07 UTC
[GitHub] [singa] joddiy opened a new pull request #748: add exp && round && rounde operators
joddiy opened a new pull request #748:
URL: https://github.com/apache/singa/pull/748
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [singa] lgtm-com[bot] commented on pull request #748: add exp && round && rounde operators
Posted by GitBox <gi...@apache.org>.
lgtm-com[bot] commented on pull request #748:
URL: https://github.com/apache/singa/pull/748#issuecomment-653108537
This pull request **introduces 2 alerts** when merging 01dc87bf53b1e30b647e6e51c971242e9bf676e1 into ddaa2e2aeb4d72268f3c51f13ede9e38a0482242 - [view on LGTM.com](https://lgtm.com/projects/g/apache/singa/rev/pr-0525e3640007a057dbda0ebebe5cdd8af4e2bee8)
**new alerts:**
* 2 for Wrong name for an argument in a class instantiation
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [singa] chrishkchris merged pull request #748: add exp && round && rounde operators
Posted by GitBox <gi...@apache.org>.
chrishkchris merged pull request #748:
URL: https://github.com/apache/singa/pull/748
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [singa] joddiy commented on pull request #748: add exp && round && rounde operators
Posted by GitBox <gi...@apache.org>.
joddiy commented on pull request #748:
URL: https://github.com/apache/singa/pull/748#issuecomment-647036782
@dcslin Hi, shicong, can you help me implement the `round` and `rounde` operators in the c++, as you see, it's too complicated in python.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [singa] chrishkchris commented on pull request #748: add exp && round && rounde operators
Posted by GitBox <gi...@apache.org>.
chrishkchris commented on pull request #748:
URL: https://github.com/apache/singa/pull/748#issuecomment-653537520
I tested your code with your test case.
```
root@71ac539cda77:~/dcsysh/singa/test/python# python3 test_operation.py TestPythonOperation.test_round_cpu
.
----------------------------------------------------------------------
Ran 1 test in 0.001s
OK
root@71ac539cda77:~/dcsysh/singa/test/python# python3 test_operation.py TestPythonOperation.test_round_gpu
.
----------------------------------------------------------------------
Ran 1 test in 0.001s
OK
root@71ac539cda77:~/dcsysh/singa/test/python# python3 test_operation.py TestPythonOperation.test_rounde_cpu
.
----------------------------------------------------------------------
Ran 1 test in 0.001s
OK
root@71ac539cda77:~/dcsysh/singa/test/python# python3 test_operation.py TestPythonOperation.test_rounde_gpu
.
----------------------------------------------------------------------
Ran 1 test in 0.002s
OK
```
The code looks good to me. So I merged the code.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [singa] dcslin commented on pull request #748: add exp && round && rounde operators
Posted by GitBox <gi...@apache.org>.
dcslin commented on pull request #748:
URL: https://github.com/apache/singa/pull/748#issuecomment-647214289
Hi @joddiy , will this work for you? https://github.com/apache/singa/pull/749
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [singa] joddiy commented on pull request #748: add exp && round && rounde operators
Posted by GitBox <gi...@apache.org>.
joddiy commented on pull request #748:
URL: https://github.com/apache/singa/pull/748#issuecomment-652152006
> > Hi @joddiy , will this work for you? #749
>
> seems not to work:
>
> 
Hi, shicong, the `round` and `rounde` works now. However, the result of `rounde` is wrong now.
please use this test:
```
def rounde_helper(self, dev):
X = np.array([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, -2.5, -2.8]).astype(np.float32)
x = tensor.from_numpy(X)
x.to_device(dev)
y_t = np.array([0., 0., 1., 1., 2.,
2., 2., 2., 3., -1.,
-2., -2., -2., -2., -3.]).astype(np.float32)
dy = tensor.from_numpy(y_t)
dy.to_device(dev)
y = autograd.rounde(x)
np.testing.assert_array_almost_equal(tensor.to_numpy(y), y_t)
def test_rounde_cpu(self):
self.rounde_helper(cpu_dev)
@unittest.skipIf(not singa_wrap.USE_CUDA, 'CUDA is not enabled')
def test_rounde_gpu(self):
self.rounde_helper(gpu_dev)
```
Specifically, Rounde(0.9) should be 1 instead of 0.
I guess the formula should be:
```
apply round(x / 2) * 2 if x == xxx.5 else round(x)
```
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [singa] joddiy commented on pull request #748: add exp && round && rounde operators
Posted by GitBox <gi...@apache.org>.
joddiy commented on pull request #748:
URL: https://github.com/apache/singa/pull/748#issuecomment-647442498
> Hi @joddiy , will this work for you? #749
seems not to work:

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [singa] joddiy edited a comment on pull request #748: add exp && round && rounde operators
Posted by GitBox <gi...@apache.org>.
joddiy edited a comment on pull request #748:
URL: https://github.com/apache/singa/pull/748#issuecomment-652152006
> > Hi @joddiy , will this work for you? #749
>
> seems not to work:
>
> 
Hi, shicong, the `round` and `rounde` works now. However, the result of `rounde` is wrong now.
please use this test:
```
def rounde_helper(self, dev):
X = np.array([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, -2.5, -2.8]).astype(np.float32)
x = tensor.from_numpy(X)
x.to_device(dev)
y_t = np.array([0., 0., 1., 1., 2.,
2., 2., 2., 3., -1.,
-2., -2., -2., -2., -3.]).astype(np.float32)
dy = tensor.from_numpy(y_t)
dy.to_device(dev)
y = autograd.rounde(x)
np.testing.assert_array_almost_equal(tensor.to_numpy(y), y_t)
def test_rounde_cpu(self):
self.rounde_helper(cpu_dev)
@unittest.skipIf(not singa_wrap.USE_CUDA, 'CUDA is not enabled')
def test_rounde_gpu(self):
self.rounde_helper(gpu_dev)
```
Specifically, Rounde(0.9) should be 1 instead of 0.
I guess the formula should be:
```
apply round(x / 2) * 2 if x - floor(x) == 0.5 else round(x)
```
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org