Skip to content

Commit

Permalink
Add TorchScript test file (#842)
Browse files Browse the repository at this point in the history
  • Loading branch information
lutzroeder committed Nov 27, 2021
1 parent b3a11f0 commit 56b665c
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 7 deletions.
5 changes: 5 additions & 0 deletions source/pytorch.js
Original file line number Diff line number Diff line change
Expand Up @@ -1310,6 +1310,9 @@ pytorch.Execution = class extends python.Execution {
this.registerFunction('ops.prim.dtype', function(tensor) {
return tensor.dtype.scalar_type();
});
this.registerFunction('ops.prim.is_quantized', function(tensor) {
return tensor && tensor.__quantized__ === true;
});
this.registerFunction('ops.prim.unchecked_unwrap_optional', function(value) {
return value;
});
Expand Down Expand Up @@ -3057,8 +3060,10 @@ pytorch.Container.Zip.Execution = class extends pytorch.Execution {
case 'ops.quantized.linear':
case 'ops.quantized.conv2d':
case 'ops.quantized.conv2d_relu':
case 'ops.quantized.add':
case 'ops.quantized.add_relu':
parameter.resize_([ NaN, NaN, NaN, NaN ]);
parameter.__quantized__ = true;
break;
case 'torch.contiguous':
parameter.__source__ = this.expression(args[0], context);
Expand Down
21 changes: 14 additions & 7 deletions test/models.json
Original file line number Diff line number Diff line change
Expand Up @@ -4672,13 +4672,6 @@
"format": "TorchScript v1.3",
"link": "https://github.com/lutzroeder/netron/issues/281"
},
{
"type": "pytorch",
"target": "resnet18-5c106cde.pth",
"source": "https://download.pytorch.org/models/resnet18-5c106cde.pth",
"format": "PyTorch v0.1.1",
"link": "https://github.com/pytorch/vision/blob/master/torchvision/models/resnet.py"
},
{
"type": "pytorch",
"target": "resnet18_fbgemm_16fa66dd.pth",
Expand All @@ -4693,6 +4686,20 @@
"format": "PyTorch v0.1.10",
"link": "https://github.com/facebookresearch/kill-the-bits/tree/master/src/models/compressed"
},
{
"type": "pytorch",
"target": "resnet18_quantized_cifar10.pt.zip",
"source": "https://github.com/lutzroeder/netron/files/7610907/resnet18_quantized_cifar10.pt.zip[resnet18_quantized_cifar10.pt]",
"format": "TorchScript v1.6",
"link": "https://github.com/lutzroeder/netron/issues/842"
},
{
"type": "pytorch",
"target": "resnet18-5c106cde.pth",
"source": "https://download.pytorch.org/models/resnet18-5c106cde.pth",
"format": "PyTorch v0.1.1",
"link": "https://github.com/pytorch/vision/blob/master/torchvision/models/resnet.py"
},
{
"type": "pytorch",
"target": "resnet-18-at-export.pth",
Expand Down

0 comments on commit 56b665c

Please sign in to comment.