Skip to content

Commit

Permalink
Update to TorchScript 1.3 prototype (#281)
Browse files Browse the repository at this point in the history
  • Loading branch information
lutzroeder committed Oct 21, 2019
1 parent 3eaf500 commit 042b2fa
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/torchscript.js
Original file line number Diff line number Diff line change
Expand Up @@ -2353,7 +2353,8 @@ torchscript.GraphContext = class {
return this._evaluateExpression(expression.arguments[0]);
}
// annotate(Optional[int], None)
if (this._isCall(expression, 'annotate', [ {}, { type: 'id', value: 'None' } ])) {
// annotate(List[int], [])
if (this._isCall(expression, 'annotate', [ {}, {} ])) {
return expression.arguments[1];
}
// _foo
Expand Down
15 changes: 15 additions & 0 deletions test/models.json
Original file line number Diff line number Diff line change
Expand Up @@ -5032,6 +5032,21 @@
"format": "TorchScript v1",
"link": "https://pytorch.org/docs/stable/torchvision/models.html"
},
{
"type": "torchscript",
"target": "blitz_neural_networks_tutorial_traced.pt",
"source": "https://github.com/lutzroeder/netron/files/3748989/blitz_neural_networks_tutorial.zip[blitz_neural_networks_tutorial_traced.pt]",
"format": "TorchScript v1",
"link": "https://github.com/lutzroeder/netron/issues/281"
},
{
"type": "torchscript",
"target": "blitz_neural_networks_tutorial.pt",
"source": "https://github.com/lutzroeder/netron/files/3748989/blitz_neural_networks_tutorial.zip[blitz_neural_networks_tutorial.pt]",
"error": "Unknown statement '{\"location\":\" at 516:5\",\"type\":\"for\",\"variable\":[{\"type\":\"id\",\"value\":\"_261\",\"keyword\":false}],\"target\":[{\"location\":\" at 516:22\",\"type\":\"call\",\"target\":{\"type\":\"id\",\"value\":\"range\",\"keyword\":false},\"arguments\":[{\"location\":\" at 516:32\",\"type\":\"call\",\"target\":{\"location\":\" at 516:28\",\"type\":\".\",\"target\":{\"type\":\"id\",\"value\":\"torch\",\"keyword\":false},\"member\":{\"type\":\"id\",\"value\":\"len\",\"keyword\":false}},\"arguments\":[{\"type\":\"id\",\"value\":\"size\",\"keyword\":false}]}]}],\"body\":{\"location\":\" at 516:40\",\"type\":\"block\",\"statements\":[{\"location\":\" at 517:8\",\"type\":\"=\",\"target\":{\"type\":\"id\",\"value\":\"s\",\"keyword\":false},\"expression\":{\"location\":\" at 517:15\",\"type\":\"[]\",\"target\":{\"type\":\"id\",\"value\":\"size\",\"keyword\":false},\"arguments\":{\"type\":\"list\",\"value\":[{\"type\":\"id\",\"value\":\"_261\",\"keyword\":false}]}}},{\"location\":\" at 518:19\",\"type\":\"=\",\"target\":{\"type\":\"id\",\"value\":\"num_features\",\"keyword\":false},\"expression\":{\"location\":\" at 518:31\",\"type\":\"call\",\"target\":{\"location\":\" at 518:27\",\"type\":\".\",\"target\":{\"type\":\"id\",\"value\":\"torch\",\"keyword\":false},\"member\":{\"type\":\"id\",\"value\":\"mul\",\"keyword\":false}},\"arguments\":[{\"type\":\"id\",\"value\":\"num_features\",\"keyword\":false},{\"type\":\"id\",\"value\":\"s\",\"keyword\":false}]}}]}}' in 'blitz_neural_networks_tutorial.pt'.",
"format": "TorchScript v1",
"link": "https://github.com/lutzroeder/netron/issues/281"
},
{
"type": "torchscript",
"target": "blitz_cifar10_tutorial.pt",
Expand Down

0 comments on commit 042b2fa

Please sign in to comment.