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 2019/08/17 03:11:04 UTC

[GitHub] [incubator-singa] chrishkchris opened a new pull request #523: SINGA-478 Improve __itruediv__ in tensor.py

chrishkchris opened a new pull request #523: SINGA-478 Improve __itruediv__ in tensor.py
URL: https://github.com/apache/incubator-singa/pull/523
 
 
   Improve the __itruediv__ operation by using the /= operator in c tensor directly instead of *= operator.
   
   Has tested two cases (because for end to end purpose):
   Case 1. simple tensor division in ncrf docker container
   ```python
   from singa import tensor
   from singa import device
   import numpy as np
   
   Y = np.ones(shape=[10],dtype=np.float32) * 10.0
   y = tensor.from_numpy(Y)
   y.to_device(device.get_default_device())
   
   y.to_device(device.create_cuda_gpu_on(1))
   
   def divide(y):
      y /= 10
   
   divide(y)
   print(tensor.to_numpy(y))
   
   ```
   Result
   ```
   root@26c9db193eb0:~/incubator-singa# python3 /root/incubator-singa/python/singa/test.py
   [1. 1. 1. 1. 1. 1. 1. 1. 1. 1.]
   ```
   
   Case 2. 8 GPUs mnist distributed training in AWS (i.e. mnist_dist_demo.py)

----------------------------------------------------------------
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


With regards,
Apache Git Services