dcslin commented on issue #580: [WIP] An experiment for buffering operations
URL: https://github.com/apache/singa/pull/580#issuecomment-579575835
 
 
   Hi, this is regarding the `SumAll` in this PR. Referring to numpy, when no 
axis is given, `numpy.sum` returns a scalar value. Referring to torch, 
`torch.sum()` always return tensor. This difference is because there is no 
tensor in numpy.
   
   I suppose the ideal way for singa would be deprecating `float Sum()` and 
keeping `Tensor Sum()`.
   
   However this breaks the current code.
   
   The workaround might be extending `Tensor Sum(Tensor in, int axis)` to 
support arbitrary axes like `Tensor Sum(Tensor in, int[] axis)`. Then when we 
want `Tensor SumAll()`, we could call `Tensor Sum(in, in.shape())`, which 
effectively sum all (over all axes) and return a Tensor, while not breaking 
current 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:
[email protected]


With regards,
Apache Git Services

Reply via email to