(reduce_fn, batch_fn, keep_dims, axes, output_type, ddof=None)
| 173 | |
| 174 | |
| 175 | def run_numpy(reduce_fn, batch_fn, keep_dims, axes, output_type, ddof=None): |
| 176 | result = [] |
| 177 | args = {"keepdims": keep_dims, "axis": axes} |
| 178 | if output_type is not None: |
| 179 | args["dtype"] = output_type |
| 180 | |
| 181 | if ddof is not None: |
| 182 | args["ddof"] = ddof |
| 183 | |
| 184 | for _ in range(batch_fn.num_iter()): |
| 185 | batch = batch_fn() |
| 186 | sample_result = [] |
| 187 | for sample in batch: |
| 188 | sample_reduced = reduce_fn(sample, **args) |
| 189 | sample_result.append(sample_reduced) |
| 190 | |
| 191 | result.append(sample_result) |
| 192 | return result |
| 193 | |
| 194 | |
| 195 | def compare(dali_res, np_res): |
no test coverage detected