- Installation:
python setup.py install
- A simple example:
Define PyTorch model and its (dummy) input:
import torch from torchvision.models import resnet18 model = resnet18() inputs = torch.randn(1, 3, 224, 224)Measure the number of MACs using
profile_macs
:from ocean import profile_macs macs = profile_macs(model, inputs)
- Examples:
Check out the
egs/
folder.
- Handler registration:
For warnings like
UserWarning: No handlers found: "aten::<a specific operation>". Skipped.
, please register the missing handler toocean/handlers.py
.
- The default version of OCEAN now uses torch.jit.trace as in torchprofile: https://github.com/zhijian-liu/torchprofile.
- The THOP (https://github.com/Lyken17/pytorch-OpCounter.git) based version is saved to the thop branch.
https://join.slack.com/t/ocean-zdz3431/shared_invite/zt-jns0uib8-7nEYX8HNq0eq3LYq2Lj8rw