Skip to content

Commit b83cad3

Browse files
committed
Add TorchScript test file (#842)
1 parent 0069922 commit b83cad3

File tree

3 files changed

+22
-0
lines changed

3 files changed

+22
-0
lines changed

Diff for: source/python.js

+7
Original file line numberDiff line numberDiff line change
@@ -3022,7 +3022,9 @@ python.Execution = class {
30223022
return;
30233023
}
30243024
else if (target.type === 'tuple') {
3025+
context.target.push(target.value);
30253026
const value = this.expression(expression.expression, context);
3027+
context.target.pop();
30263028
if (target.value.every((item) => item.type === 'id')) {
30273029
if (target.value.length < value.length) {
30283030
throw new python.Error('ValueError: too many values to unpack (expected ' + target.value.length + ', actual ' + value.length + ').');
@@ -3287,6 +3289,11 @@ python.Execution.Context = class {
32873289
}
32883290
return undefined;
32893291
}
3292+
3293+
get target() {
3294+
this._target = this._target || [];
3295+
return this._target;
3296+
}
32903297
};
32913298

32923299
python.Utility = class {

Diff for: source/pytorch.js

+5
Original file line numberDiff line numberDiff line change
@@ -3146,6 +3146,11 @@ pytorch.Container.Zip.Execution = class extends pytorch.Execution {
31463146
case 'torch.unbind':
31473147
count = args[0].__tuple__ || count;
31483148
break;
3149+
case 'torch.split':
3150+
if (context.target.length > 0) {
3151+
count = context.target[context.target.length - 1].length;
3152+
}
3153+
break;
31493154
}
31503155
const tensors = [];
31513156
const outputs = [];

Diff for: test/models.json

+10
Original file line numberDiff line numberDiff line change
@@ -5057,6 +5057,16 @@
50575057
"format": "TorchScript v1.6",
50585058
"link": "https://github.com/lutzroeder/netron/issues/827"
50595059
},
5060+
{
5061+
"type": "pytorch",
5062+
"target": "yolo4_tiny.pt",
5063+
"source": "https://github.com/lutzroeder/netron/files/7995416/yolo4_tiny.pt.zip[yolo4_tiny.pt]",
5064+
"format": "TorchScript v1.5",
5065+
"link": "https://github.com/lutzroeder/netron/issues/842"
5066+
},
5067+
5068+
5069+
50605070
{
50615071
"type": "rknn",
50625072
"target": "autopilot.rknn",

0 commit comments

Comments
 (0)