ASF subversion and git services commented on SINGA-380:

Commit b30d7ea55cd58bb0858aa354833c1ba9a3242470 in incubator-singa's branch 
refs/heads/master from Wang Wei
[ https://git-wip-us.apache.org/repos/asf?p=incubator-singa.git;h=b30d7ea ]

SINGA-380) Fix bugs from Reshape

Update reshape API in C++ and Python.
C++ Tensor method reshape changes original tensor;
All other reshape method returns a new tensor (which shares memory with the 
original tensor if possible).

APIs for transpose are updated in the same way.

> Fix bugs from Reshape 
> ----------------------
>                 Key: SINGA-380
>                 URL: https://issues.apache.org/jira/browse/SINGA-380
>             Project: Singa
>          Issue Type: Improvement
>            Reporter: wangwei
>            Priority: Major
> The current implementation of reshape operation has memory leak caused by the 
> dangling Tensor::block_ pointer.
> This ticket is going to fix the bug and update the Reshape API in C++ and 
> Python.
> For C++,
> {code:java}
> Class Tensor {
>  public:
>   Tensor& Reshape(const Shape & s); // change the internal shape and return a 
> the tensor itself
>  ...  
> };
> Tensor Reshape(const Tensor& t, const Shape& s); // create a new tensor with 
> the given shape; share the memory if possible.{code}
> For Python, the reshape operation from autograd.py always return a new 
> pytensor which shares the memory with the original tensor if possible.
> We change the API for transpose for C++ and Python in the same way.
> C++, Tensor method Transpose changes the internal fields and return the 
> tensor itself; the global method Transpose returns a new tensor which shares 
> the memory with the original tensor.
> Python, the transpose operation always returns a new tensor that shares 
> memory with the original tensor.

This message was sent by Atlassian JIRA

Reply via email to