(*args, **kwargs)
| 185 | def 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 |
nothing calls this directly
no test coverage detected