Set different behaior between train and eval


I need a flag to determine whether my model is training or evaluation. in order to define different behavior for hybridmodule

In Pyotrch, there is a flag, I wonder is there a counterpart in mxnet?

In symbolic programming using the Module API, you can set the is_train argument to True or False in forward propagation. for more information see:

Thans @shababqcd

In fact, I’m using the hybrid_forward. I found another solution.

Because the Dropout layer has different behaviro and training and test, so I found a tutorial about Accessing is_training_status

with autograd.predict_mode():

with autograd.train_mode():

so the autograd.is_training() is my desired flag.


Thanks @Alpha for posting your solution. Here is a link of the latest tutorial on autograd:

1 Like