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
)
| 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) |
nothing calls this directly
no test coverage detected