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

Method _run_pipeline

python/paddle/base/executor.py:2834–2883  ·  view source on GitHub ↗
(
        self,
        program=None,
        dataset=None,
        scope=None,
        thread=0,
        is_infer=False,
        debug=False,
        fetch_list=None,
        fetch_info=None,
        print_period=100,
        fetch_handler=None,
        use_program_cache=False,
    )

Source from the content-addressed store, hash-verified

2832 return tmp_program
2833
2834 def _run_pipeline(
2835 self,
2836 program=None,
2837 dataset=None,
2838 scope=None,
2839 thread=0,
2840 is_infer=False,
2841 debug=False,
2842 fetch_list=None,
2843 fetch_info=None,
2844 print_period=100,
2845 fetch_handler=None,
2846 use_program_cache=False,
2847 ):
2848 scope, real_fetch_list, trainer_instance = self._prepare_pipeline_ctx(
2849 program,
2850 dataset,
2851 scope,
2852 thread,
2853 is_infer,
2854 debug,
2855 fetch_list,
2856 fetch_info,
2857 print_period,
2858 fetch_handler,
2859 use_program_cache,
2860 )
2861
2862 from paddle.optimizer.lr import LRScheduler
2863
2864 if hasattr(program, 'lr_scheduler'):
2865 lr_scheduler = program.lr_scheduler
2866 assert isinstance(lr_scheduler, LRScheduler), "must be LRScheduler"
2867 lr_value = lr_scheduler()
2868 lr_var = program.global_block().vars[lr_scheduler._var_name]
2869 data = np.array([lr_value]).astype(convert_dtype(lr_var.dtype))
2870 tensor = core.get_variable_tensor(scope, lr_scheduler._var_name)
2871 tensor.set(data, self.place)
2872
2873 self._default_executor.run_from_dataset(trainer_instance)
2874
2875 if not use_program_cache:
2876 self._default_executor.release_trainer(trainer_instance)
2877
2878 if real_fetch_list:
2879 arr = scope.find_var('fetch').get_fetch_list()
2880 tensors = arr._move_to_list()
2881 return as_numpy(tensors)
2882
2883 return None
2884
2885 def infer_from_dataset(
2886 self,

Callers

nothing calls this directly

Calls 6

_prepare_pipeline_ctxMethod · 0.95
as_numpyFunction · 0.85
global_blockMethod · 0.80
astypeMethod · 0.80
convert_dtypeFunction · 0.70
setMethod · 0.45

Tested by

no test coverage detected