liuzh91 commented on issue #16930: Plug and Play fit_batch() for the estimator 
class
URL: 
https://github.com/apache/incubator-mxnet/issues/16930#issuecomment-559403015
 
 
   > Why don't we just pack the input and unpack it when we feed it into the 
model? The order of input will be determined by the user, i.e, how they 
construct the dataloader. The RNN model specific input `begin_state` will 
always serve as a keyword argument.
   
   The problem is even we can use pack/unpack workaround to bypass the 
input/output issue. The computation of loss function may still be diverse. For 
example, for `standardRNN`, one has:
   ```
         output, h, encoder_hs, dropped_encoder_hs = model(X, h)
         l = joint_loss(output, y, encoder_hs, dropped_encoder_hs)
         Ls.append(l / (len(context) * X.size))
         hiddens[j] = h
   ```
   On the other hand, for `BigRNN`, one has
   ```
         output, hidden, new_target = self._model(X, y, h, s)
         output = output.reshape((-3, -1))
         new_target = new_target.reshape((-1,))
         ls = self._loss(output, new_target) * m.reshape((-1,))
         ls = ls / args.batch_size
   ```
   In this case, we may resort to if/else clause to judge which computation 
routine we shall use. The code will be cumbersome in the future.
   
   

----------------------------------------------------------------
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:
[email protected]


With regards,
Apache Git Services

Reply via email to