(
self,
quant=False,
explicit=False,
skip_baseline=False,
run_pir=False,
*args,
**kwargs,
)
| 807 | return str(dic) |
| 808 | |
| 809 | def run_test( |
| 810 | self, |
| 811 | quant=False, |
| 812 | explicit=False, |
| 813 | skip_baseline=False, |
| 814 | run_pir=False, |
| 815 | *args, |
| 816 | **kwargs, |
| 817 | ): |
| 818 | all_passes = True |
| 819 | |
| 820 | def random_to_skip(): |
| 821 | if self.skip_rng.random() < self.num_percent_cases: |
| 822 | return False |
| 823 | return True |
| 824 | |
| 825 | for prog_config in self.sample_program_configs(*args, **kwargs): |
| 826 | paddle.enable_static() |
| 827 | if random_to_skip(): |
| 828 | continue |
| 829 | # if program is invalid, we should skip that cases. |
| 830 | if not self.is_program_valid(prog_config): |
| 831 | continue |
| 832 | if run_pir and os.name != 'nt' and (not os.getenv('WITH_XPU')): |
| 833 | # get pir program from old program |
| 834 | main_program_desc, util_program = create_fake_model( |
| 835 | prog_config, run_pir=True |
| 836 | ) |
| 837 | # transform program from old ir to new ir |
| 838 | startup_program = pir.translate_to_pir(util_program.desc) |
| 839 | pir_main_program = pir.translate_to_pir(main_program_desc) |
| 840 | with ( |
| 841 | paddle.pir_utils.IrGuard(), |
| 842 | paddle.static.program_guard( |
| 843 | pir_main_program, startup_program |
| 844 | ), |
| 845 | ): |
| 846 | feed_dict = {} |
| 847 | feed_data = prog_config.get_feed_data() |
| 848 | for key, value in feed_data.items(): |
| 849 | feed_dict[key] = value['data'] |
| 850 | |
| 851 | place = ( |
| 852 | paddle.CUDAPlace(0) |
| 853 | if paddle.is_compiled_with_cuda() |
| 854 | else paddle.CPUPlace() |
| 855 | ) |
| 856 | out_put = pir_main_program.get_output_value_by_name( |
| 857 | prog_config.outputs[0] |
| 858 | ) |
| 859 | in_put = out_put.get_defining_op().operand_source(0) |
| 860 | exe = paddle.static.Executor(place) |
| 861 | exe.run(startup_program) |
| 862 | static_out = exe.run( |
| 863 | pir_main_program, |
| 864 | feed=feed_dict, |
| 865 | fetch_list=[in_put], |
| 866 | ) |
nothing calls this directly
no test coverage detected