Uploaded image for project: 'Singa'
  1. Singa
  2. SINGA-380

Fix bugs from Reshape

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Open
    • Major
    • Resolution: Unresolved
    • None
    • None

    Description

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

      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.

      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.

      Attachments

        Activity

          People

            Unassigned Unassigned
            wangwei.cs wangwei
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated: