MCPcopy Create free account
hub / github.com/pytorch/pytorch / eval

Method eval

torch/nn/modules/module.py:2397–2413  ·  view source on GitHub ↗

r"""Set the module in evaluation mode. This has any effect only on certain modules. See documentations of particular modules for details of their behaviors in training/evaluation mode, if they are affected, e.g. :class:`Dropout`, :class:`BatchNorm`, etc. Thi

(self: T)

Source from the content-addressed store, hash-verified

2395 return self
2396
2397 def eval(self: T) -> T:
2398 r"""Set the module in evaluation mode.
2399
2400 This has any effect only on certain modules. See documentations of
2401 particular modules for details of their behaviors in training/evaluation
2402 mode, if they are affected, e.g. :class:`Dropout`, :class:`BatchNorm`,
2403 etc.
2404
2405 This is equivalent with :meth:`self.train(False) <torch.nn.Module.train>`.
2406
2407 See :ref:`locally-disable-grad-doc` for a comparison between
2408 `.eval()` and several similar mechanisms that may be confused with it.
2409
2410 Returns:
2411 Module: self
2412 """
2413 return self.train(False)
2414
2415 def requires_grad_(self: T, requires_grad: bool = True) -> T:
2416 r"""Change if autograd should record operations on parameters in this module.

Callers 15

split_previewMethod · 0.45
_convert_jitFunction · 0.45
quantizeFunction · 0.45
quantize_dynamicFunction · 0.45
from_floatMethod · 0.45
from_floatMethod · 0.45
on_fit_endMethod · 0.45
fetch_modelFunction · 0.45
optimize_for_inferenceFunction · 0.45
verifyFunction · 0.45
find_mismatchFunction · 0.45

Calls 1

trainMethod · 0.95

Tested by 5

test_ddp_inferenceMethod · 0.36
test_train_evalMethod · 0.36
test_linearFunction · 0.36