(model, input_size=(3, 224, 224))
| 309 | |
| 310 | # Example function to calculate and print GMACs and parameter count for a given model |
| 311 | def print_model_stats(model, input_size=(3, 224, 224)): |
| 312 | # Print model parameter count |
| 313 | total_params = sum(p.numel() for p in model.parameters()) |
| 314 | print(f'Model created, param count: {total_params}') |
| 315 | |
| 316 | # Calculate GMACs using ptflops |
| 317 | macs, params = get_model_complexity_info(model, input_size, as_strings=True, print_per_layer_stat=True) |
| 318 | |
| 319 | # Display GMACs and params |
| 320 | print(f'Model: {macs} GMACs, {params} parameters') |
nothing calls this directly
no outgoing calls
no test coverage detected