singa-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "wangwei (JIRA)" <j...@apache.org>
Subject [jira] [Created] (SINGA-380) Fix bugs from Reshape
Date Wed, 11 Jul 2018 07:15:00 GMT
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)

Mime
View raw message