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

Function impl

test/legacy_test/utils.py:187–203  ·  view source on GitHub ↗
(*args, **kwargs)

Source from the content-addressed store, hash-verified

185def to_pir_pt_test(fn):
186 @wraps(fn)
187 def impl(*args, **kwargs):
188 with DygraphOldIrGuard():
189 pt_flag = ENV_ENABLE_PIR_WITH_PT.name
190 original_flag_value = get_flags(pt_flag)[pt_flag]
191 if os.environ.get('FLAGS_use_stride_kernel', False):
192 return
193 with (
194 static.scope_guard(static.Scope()),
195 static.program_guard(static.Program()),
196 EnvironmentVariableGuard(ENV_ENABLE_PIR_WITH_PT, True),
197 ):
198 try:
199 set_flags({pt_flag: True})
200 ir_outs = fn(*args, **kwargs)
201 finally:
202 set_flags({pt_flag: original_flag_value})
203 return ir_outs
204
205 return impl
206

Callers

nothing calls this directly

Calls 10

DygraphOldIrGuardClass · 0.90
get_flagsFunction · 0.90
set_flagsFunction · 0.90
to_pir_pt_testFunction · 0.85
fnFunction · 0.50
getMethod · 0.45
ScopeMethod · 0.45
ProgramMethod · 0.45
assert_equalMethod · 0.45

Tested by

no test coverage detected