MCPcopy Create free account
hub / github.com/PaddlePaddle/Paddle / predict

Method predict

python/paddle/distributed/auto_parallel/api.py:3081–3097  ·  view source on GitHub ↗

Set the mode of DistModel to "predict". In "predict" mode, executing ``__call__`` returns a dict that contains the outputs of the model.

(self)

Source from the content-addressed store, hash-verified

3079 paddle.disable_static()
3080
3081 def predict(self) -> None:
3082 """
3083 Set the mode of DistModel to "predict". In "predict" mode,
3084 executing ``__call__`` returns a dict that contains the
3085 outputs of the model.
3086 """
3087 if not self._engine._has_prepared["predict"]:
3088 self._engine.prepare(
3089 copy.deepcopy(self._engine._inputs_spec),
3090 None,
3091 mode="predict",
3092 init_parameters=False,
3093 )
3094
3095 self._mode = "predict"
3096 self._engine.to_mode("predict")
3097 paddle.disable_static()
3098
3099 def __validate_mode(self, mode):
3100 if mode is None and self._mode is None:

Callers 1

__init__Method · 0.95

Calls 3

to_modeMethod · 0.80
prepareMethod · 0.45
deepcopyMethod · 0.45

Tested by

no test coverage detected