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

Method _run_pir_impl

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

Source from the content-addressed store, hash-verified

2126 return self._run_inference(program._executor, feed)
2127
2128 def _run_pir_impl(
2129 self,
2130 program,
2131 feed,
2132 fetch_list,
2133 feed_var_name,
2134 fetch_var_name,
2135 scope,
2136 return_numpy,
2137 ):
2138 import paddle
2139
2140 Program = paddle.pir.Program
2141 default_main_program = paddle.pir.core.default_main_program
2142
2143 if self._closed:
2144 raise RuntimeError("Attempted to use a closed Executor")
2145
2146 use_default_main_program = program is None
2147 if use_default_main_program:
2148 program = default_main_program()
2149
2150 fetch_list = self._check_fetch_list(fetch_list)
2151
2152 if (
2153 isinstance(program, Program)
2154 and len(program.global_block().ops) == 0
2155 ):
2156 if use_default_main_program:
2157 error_info = (
2158 "Now you are using default_main_program, "
2159 "but there are no operators in the program to be executed. "
2160 "Please ensure you create model correctly or you can pass "
2161 "the Program or the CompiledProgram manually."
2162 )
2163 warnings.warn(error_info)
2164
2165 if scope is None:
2166 scope = global_scope()
2167
2168 if feed is None:
2169 feed = {}
2170 elif isinstance(feed, (list, tuple)):
2171 assert len(feed) == 1, "Not compiled with data parallel"
2172 feed = feed[0]
2173 if not isinstance(feed, dict):
2174 raise TypeError(
2175 f"feed requires dict as its Parameter. But you passed in {type(feed)}"
2176 )
2177
2178 (
2179 program,
2180 new_exe,
2181 data_op_infos,
2182 ) = self._executor_cache.get_pir_program_and_executor(
2183 program,
2184 feed,
2185 fetch_list,

Callers 1

runMethod · 0.95

Calls 15

_check_fetch_listMethod · 0.95
_pir_feed_dataMethod · 0.95
RuntimeErrorClass · 0.85
global_scopeFunction · 0.85
TypeErrorClass · 0.85
_as_lodtensorFunction · 0.85
listFunction · 0.85
global_blockMethod · 0.80
astypeMethod · 0.80
CPUPlaceMethod · 0.80
default_main_programFunction · 0.70

Tested by

no test coverage detected