mirror of
https://github.com/pytorch/pytorch.git
synced 2025-10-20 12:54:11 +08:00
Enable flake8 plugin for https://github.com/pytorch/test-infra/tree/main/tools/torchfix - TorchFix 0.1.1. Disable TorchFix codes that don't make sense for PyTorch itself. Update deprecated TorchVision APIs to make TorchFix pass. Pull Request resolved: https://github.com/pytorch/pytorch/pull/113403 Approved by: https://github.com/Skylion007, https://github.com/malfet
12 lines
367 B
Python
12 lines
367 B
Python
import torch
|
|
import yaml
|
|
from torchvision import models
|
|
|
|
model = models.mobilenet_v2(weights=models.MobileNet_V2_Weights.IMAGENET1K_V1)
|
|
model.eval()
|
|
example = torch.rand(1, 3, 224, 224)
|
|
traced_script_module = torch.jit.trace(model, example)
|
|
ops = torch.jit.export_opnames(traced_script_module)
|
|
with open("mobilenetv2.yaml", "w") as output:
|
|
yaml.dump(ops, output)
|