(dataset_results, standalone_results, iterations=-1, num_devices=1)
| 271 | |
| 272 | |
| 273 | def compare(dataset_results, standalone_results, iterations=-1, num_devices=1): |
| 274 | if iterations == -1: |
| 275 | iterations = len(standalone_results) |
| 276 | |
| 277 | # list [iterations] of tuple [devices] of tuple [outputs] of tensors representing batch |
| 278 | assert ( |
| 279 | len(dataset_results) == iterations |
| 280 | ), f"Got {len(dataset_results)} dataset results for {iterations} iterations" |
| 281 | for it in range(iterations): |
| 282 | for device_id in range(num_devices): |
| 283 | for tf_data, dali_data in zip( |
| 284 | dataset_results[it][device_id], standalone_results[it][device_id] |
| 285 | ): |
| 286 | np.testing.assert_array_equal( |
| 287 | tf_data, dali_data, f"Iteration {it}, x = tf_data, y = DALI baseline" |
| 288 | ) |
| 289 | |
| 290 | |
| 291 | def run_tf_dataset_graph( |
no outgoing calls
no test coverage detected