You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@singa.apache.org by "wangwei (JIRA)" <ji...@apache.org> on 2018/07/11 07:15:00 UTC
[jira] [Created] (SINGA-380) Fix bugs from Reshape
wangwei created SINGA-380:
-----------------------------
Summary: Fix bugs from Reshape
Key: SINGA-380
URL: https://issues.apache.org/jira/browse/SINGA-380
Project: Singa
Issue Type: Improvement
Reporter: wangwei
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
(v7.6.3#76005)