File size: 389 Bytes
755671e |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
```python
import trace_layer2 as models
import torch
x=torch.randn(1, 3, 224, 224)
state_dict = torch.load('swav_imagenet_layer2.pt', map_location='cpu')
model = models.resnet50w2()
model.load_state_dict(state_dict)
model.eval()
feature = model(x)
traced_model = torch.jit.load('traced_swav_imagenet_layer2.pt', map_location='cpu')
traced_model.eval()
feature = traced_model(x)
```
|