as791/ZOO_Attack_PyTorch

Use eval mode during validation

Opened this issue · 1 comments

Hi, thanks for the useful project written in pytorch. When looking into the code, I found that some places could be optimized:

  1. Use model.eval() during validation. According to the documentation of pytorch, Dropout behaves differently between 'train' and 'eval' mode. And both models used in cifar10 and mnist have Dropout layers.
  2. Wrapping validation part with with torch.no_grad() may save time and memory.
as791 commented

Hi I will check this @wutongshenqiu . Thank you for this info.