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

Method _initialize

python/paddle/hapi/model.py:691–709  ·  view source on GitHub ↗
(self, prog, mode)

Source from the content-addressed store, hash-verified

689 }
690
691 def _initialize(self, prog, mode):
692 assert self.model._place is not None, (
693 "device is not set, please call `model.prepare()` first"
694 )
695
696 place = self.model._place
697
698 if self._executor is None:
699 self._executor = base.Executor(place)
700 self._executor.run(self._startup_prog)
701
702 if (
703 self._amp_level == "O2"
704 and mode == 'train'
705 and core.is_compiled_with_cuda()
706 ):
707 self.model._optimizer.amp_init(place)
708
709 self._compiled_progs[mode] = prog
710
711
712class StaticGraphAdapter:

Callers 1

prepareMethod · 0.95

Calls 3

ExecutorMethod · 0.45
runMethod · 0.45
amp_initMethod · 0.45

Tested by

no test coverage detected