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

Method run

python/paddle/base/executor.py:828–855  ·  view source on GitHub ↗

Args: feed_names(list): This parameter represents the input names of the model. fetch_list(list): This parameter represents the Tensors that need to be returned after the model runs. The default is None. return_numpy(bool): This parameter

(
        self, feed_names, return_numpy=True, enable_job_schedule_profiler=False
    )

Source from the content-addressed store, hash-verified

826 self._new_exe = self._create_new_executor()
827
828 def run(
829 self, feed_names, return_numpy=True, enable_job_schedule_profiler=False
830 ):
831 """
832 Args:
833 feed_names(list): This parameter represents the input names of the model.
834 fetch_list(list): This parameter represents the Tensors that need to be returned
835 after the model runs. The default is None.
836 return_numpy(bool): This parameter indicates whether convert the fetched Tensors
837 (the Tensor specified in the fetch list) to numpy.ndarray. if it is False,
838 the type of the return value is a list of :code:`DenseTensor`. The default is True.
839 """
840 tensors = self._new_exe.run(
841 feed_names, enable_job_schedule_profiler
842 )._move_to_list()
843 if return_numpy:
844 tensors = as_numpy(tensors, copy=True)
845 if not get_flags("FLAGS_enable_pir_in_executor")[
846 'FLAGS_enable_pir_in_executor'
847 ]:
848 return _merge_tensors(tensors, self._plan.micro_batch_num())
849 return tensors
850 else:
851 if self._plan.micro_batch_num() > 1:
852 raise RuntimeError(
853 "`merge_tensor` does not support when return_numpy is False."
854 )
855 return tensors
856
857 def run_profile(self, feed_names) -> core.ProgramDesc:
858 program_desc = self._new_exe.run_profile(feed_names)

Callers

nothing calls this directly

Calls 5

as_numpyFunction · 0.85
get_flagsFunction · 0.85
_merge_tensorsFunction · 0.85
RuntimeErrorClass · 0.85
runMethod · 0.45

Tested by

no test coverage detected