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

Method _run_impl

python/paddle/base/executor.py:1927–2126  ·  view source on GitHub ↗
(
        self,
        program,
        feed,
        fetch_list,
        feed_var_name,
        fetch_var_name,
        scope,
        return_numpy,
        use_program_cache,
        use_prune,
    )

Source from the content-addressed store, hash-verified

1925 return res
1926
1927 def _run_impl(
1928 self,
1929 program,
1930 feed,
1931 fetch_list,
1932 feed_var_name,
1933 fetch_var_name,
1934 scope,
1935 return_numpy,
1936 use_program_cache,
1937 use_prune,
1938 ):
1939 if self._closed:
1940 raise RuntimeError("Attempted to use a closed Executor")
1941
1942 use_default_main_program = program is None
1943 if program is None:
1944 program = default_main_program()
1945
1946 fetch_list = self._check_fetch_list(fetch_list)
1947
1948 if isinstance(program, Program) and program._heter_pipeline_opt:
1949 # print("program._heter_pipeline_opt: {}".format(
1950 # program._heter_pipeline_opt))
1951 # change default executor
1952 heter_place = program._heter_pipeline_opt["heter_place"]
1953 heter_place = framework._get_paddle_place(heter_place)
1954 p = core.Place()
1955 p.set_place(heter_place)
1956 self._default_executor = core.Executor(p)
1957 # TODO(zhangminxu): support heterps pipeline training using exe.run
1958 if "startup_program" in program._heter_pipeline_opt:
1959 # print("get startup_program from _pipeline_opt")
1960 program = program._heter_pipeline_opt["startup_program"]
1961
1962 if (
1963 isinstance(program, Program)
1964 and len(program.global_block().ops) == 0
1965 ):
1966 if use_default_main_program:
1967 error_info = (
1968 "Now you are using default_main_program, "
1969 "but there are no operators in the program to be executed. "
1970 "Please ensure you create model correctly or you can pass "
1971 "the Program or the CompiledProgram manually."
1972 )
1973 warnings.warn(error_info)
1974
1975 if scope is None:
1976 scope = global_scope()
1977
1978 # use_prune can be overridden by putting optimize_ops in fetch_list
1979 _origin_fetch_list = fetch_list
1980 _origin_program = program
1981 fetch_list, optimize_ops = self._split_optimize_ops_in_fetch_list(
1982 fetch_list
1983 )
1984 if optimize_ops:

Callers 1

runMethod · 0.95

Calls 15

_check_fetch_listMethod · 0.95
_prune_programMethod · 0.95
_update_feedMethod · 0.95
_feed_dataMethod · 0.95
_run_inferenceMethod · 0.95
RuntimeErrorClass · 0.85
global_scopeFunction · 0.85

Tested by

no test coverage detected