MCPcopy Create free account
hub / github.com/SLDGroup/EMCAD / print_model_stats

Function print_model_stats

utils/utils.py:311–320  ·  view source on GitHub ↗
(model, input_size=(3, 224, 224))

Source from the content-addressed store, hash-verified

309
310# Example function to calculate and print GMACs and parameter count for a given model
311def 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')

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected