Helper function to generate config filled with random inputs and expected outputs. The return type of rand inputs is a List[List[InputValues]]. The inner list of InputValues represents all test sets for single execution plan, while the outer list is for multiple execution plans. Sa
(
n_model_inputs: int,
model_input_sizes: List[List[int]],
n_model_outputs: int,
model_output_sizes: List[List[int]],
dtype: torch.dtype,
n_sets_per_plan_test: int,
n_method_test_suites: int,
)
| 114 | |
| 115 | |
| 116 | def get_random_test_suites( |
| 117 | n_model_inputs: int, |
| 118 | model_input_sizes: List[List[int]], |
| 119 | n_model_outputs: int, |
| 120 | model_output_sizes: List[List[int]], |
| 121 | dtype: torch.dtype, |
| 122 | n_sets_per_plan_test: int, |
| 123 | n_method_test_suites: int, |
| 124 | ) -> Tuple[ |
| 125 | List[str], |
| 126 | List[List[MethodInputType]], |
| 127 | List[List[MethodOutputType]], |
| 128 | List[MethodTestSuite], |
| 129 | ]: |
| 130 | """Helper function to generate config filled with random inputs and expected outputs. |
| 131 | |
| 132 | The return type of rand inputs is a List[List[InputValues]]. The inner list of |
| 133 | InputValues represents all test sets for single execution plan, while the outer list |
| 134 | is for multiple execution plans. |
| 135 | |
| 136 | Same for rand_expected_outputs. |
| 137 | |
| 138 | """ |
| 139 | |
| 140 | rand_method_names = get_rand_method_names(n_method_test_suites) |
| 141 | |
| 142 | rand_inputs_per_program = get_rand_input_values( |
| 143 | n_tensors=n_model_inputs, |
| 144 | sizes=model_input_sizes, |
| 145 | n_int=1, |
| 146 | dtype=dtype, |
| 147 | n_sets_per_plan_test=n_sets_per_plan_test, |
| 148 | n_method_test_suites=n_method_test_suites, |
| 149 | ) |
| 150 | |
| 151 | rand_expected_output_per_program = get_rand_output_values( |
| 152 | n_tensors=n_model_outputs, |
| 153 | sizes=model_output_sizes, |
| 154 | dtype=dtype, |
| 155 | n_sets_per_plan_test=n_sets_per_plan_test, |
| 156 | n_method_test_suites=n_method_test_suites, |
| 157 | ) |
| 158 | |
| 159 | rand_method_test_suites: List[MethodTestSuite] = [] |
| 160 | |
| 161 | for ( |
| 162 | rand_method_name, |
| 163 | rand_inputs_per_method, |
| 164 | rand_expected_output_per_method, |
| 165 | ) in zip( |
| 166 | rand_method_names, rand_inputs_per_program, rand_expected_output_per_program |
| 167 | ): |
| 168 | rand_method_test_cases: List[MethodTestCase] = [] |
| 169 | for rand_inputs, rand_expected_outputs in zip( |
| 170 | rand_inputs_per_method, rand_expected_output_per_method |
| 171 | ): |
| 172 | rand_method_test_cases.append( |
| 173 | MethodTestCase( |
no test coverage detected