You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mxnet.apache.org by GitBox <gi...@apache.org> on 2020/08/22 03:08:38 UTC

[GitHub] [incubator-mxnet] kohillyang opened a new issue #18982: Allocate memory according to the maximum memory one Tensor may use.

kohillyang opened a new issue #18982:
URL: https://github.com/apache/incubator-mxnet/issues/18982


   ## Description
   Currently mxnet has several memory allocating strategies, like rounding strategy, Naive and Round. However, when the graph is static but the input shapes are dynamic, mxnet has to allocate memory in each step. I think these allocating strategies could cause much memory fragmentation and memory consuming, and causing allocating failing even though the memory is enough.
   Since in some cases the maximum memory for each tensor can be known if the users can give enough information. I think a memory allocating strategies which allocate the  maximum memory is needed for mxnet.
   
   For example:
   ```python
   class ExampleNet(nn.HybridBlock):
       def _init__(self):
           super(self, ExampleNet).__init(0
           self.conv = nn.Conv(20)
      def hybrid_forward(F, x):
           return self.conv(x);
   
   net.hybridize(max_shape=[(1, 3, 256, 256), ]) # Here the users can tell mxnet the maximum memory, then all tensors can be allocate directly.
   ```
   
   In some cases the HybridBlock may contains Block children, then the memory allocating strategy is not suitable for these cases because we need a full static graph, then a Error can be raised or It should be OK that allocate tensors whose shapes can be infered. 
    
   
   ## References
   - list reference and related literature
   - list known implementations
   


----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [incubator-mxnet] kohillyang closed issue #18982: Allocate memory according to the maximum memory one Tensor may use.

Posted by GitBox <gi...@apache.org>.
kohillyang closed issue #18982:
URL: https://github.com/apache/incubator-mxnet/issues/18982


   


----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [incubator-mxnet] szha commented on issue #18982: Allocate memory according to the maximum memory one Tensor may use.

Posted by GitBox <gi...@apache.org>.
szha commented on issue #18982:
URL: https://github.com/apache/incubator-mxnet/issues/18982#issuecomment-678801843


   By turning on static_alloc=True in hybridize it will do what you just described.


----------------------------------------------------------------
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:
users@infra.apache.org