Toy model to exercise the ANE.
$ pip install coremltools torch numpy calflops
$ python throughput.py
Converting PyTorch Frontend ==> MIL Ops: 99%|███████████████████████████████████████████████████████████████████████████████████████████████████████▊ | 92/93 [00:00<00:00, 7276.15 ops/s]
Running MIL frontend_pytorch pipeline: 100%|██████████████████████████████████████████████████████████████████████████████████████████████████████████| 5/5 [00:00<00:00, 1071.89 passes/s]
Running MIL default pipeline: 100%|███████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 79/79 [00:15<00:00, 5.03 passes/s]
Running MIL backend_mlprogram pipeline: 100%|███████████████████████████████████████████████████████████████████████████████████████████████████████| 12/12 [00:00<00:00, 1207.37 passes/s]
<class 'coremltools.optimize.coreml._quantization_passes.palettize_weights'>
Running compression pass palettize_weights: 100%|████████████████████████████████████████████████████████████████████████████████████████████████████████| 16/16 [00:24<00:00, 1.53s/ ops]
Running MIL frontend_milinternal pipeline: 0 passes [00:00, ? passes/s]
Running MIL default pipeline: 100%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 77/77 [00:00<00:00, 430.91 passes/s]
Running MIL backend_mlprogram pipeline: 100%|████████████████████████████████████████████████████████████████████████████████████████████████████████| 12/12 [00:00<00:00, 803.33 passes/s]
Total GFLOPs: 369.38973184
Mean Prediction: 33.389056 ms
TFLOP/sec: 11.063197828653799
Try increasing the batch size (line 74) if TFLOP/sec is lower than expected.