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 2018/11/17 04:04:12 UTC

[GitHub] ArmageddonKnight opened a new issue #13312: Forward/BackwardResource in OperatorProperty Interface

ArmageddonKnight opened a new issue #13312: Forward/BackwardResource in OperatorProperty Interface
URL: https://github.com/apache/incubator-mxnet/issues/13312
 
 
   Hi,
   
   Sorry but I have a question regarding the `OperatorProperty` interface. Let us take the `RNNProp` as an example:
   
   ```C++
   class RNNProp : public OperatorProperty
   {
     ...
     std::vector<ResourceRequest> ForwardResource(
         const std::vector<TShape> &in_shape) const override {
       return {ResourceRequest::kTempSpace};
     }
   
     std::vector<ResourceRequest> BackwardResource(
         const std::vector<TShape> &in_shape) const override {
       return {ResourceRequest::kTempSpace};
     }
     ...
   ```
   
   I noticed we do not declare ahead of time the shape or the size of temporary workspace that we need. It was not until the actual forward/backward propagation when we say:
   
   ```C++
       Tensor<gpu, 1, DType> temp_space =
         ctx.requested[rnn_enum::kTempSpace].get_space_typed<gpu, 1, DType>(
                                 mshadow::Shape1(temp_size), s);
   ```
   
   I have two questions regarding the temporary workspace management:
   
   - Am I right in saying that **the length of the vector returned by the `ForwardResource` and `BackwardResource` method is equal to the number of temporary workspace tensors I can use in the forward and backward propagation, respectively?**
   - **Why don't the `ForwardResource` and `BackwardResource` return a list of _shapes_ that indicate the shapes of the workspace**? IMHO this information can be helpful in managing the workspace (allocation/deallocation/reuse) ahead of time.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on 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


With regards,
Apache Git Services