Skip to content

Commit

Permalink
Add ONNX test file (#1138)
Browse files Browse the repository at this point in the history
  • Loading branch information
lutzroeder committed Aug 15, 2023
1 parent 238bac4 commit bd710d0
Show file tree
Hide file tree
Showing 2 changed files with 66 additions and 44 deletions.
10 changes: 9 additions & 1 deletion source/onnx.js
Original file line number Diff line number Diff line change
Expand Up @@ -432,6 +432,11 @@ onnx.Attribute = class {
this._description = attribute.doc_string || '';
this._type = null;
this._value = null;
if (attribute.ref_attr_name) {
this._value = attribute.ref_attr_name;
this._type = 'reference';
return;
}
switch (attribute.type) {
case onnx.AttributeType.UNDEFINED:
break;
Expand Down Expand Up @@ -1959,7 +1964,10 @@ onnx.JsonReader = class {
if (value.type && this._attributeTypes.has(value.type)) {
value.type = this._attributeTypes.get(value.type);
}
if (value.type === onnx.AttributeType.FLOATS || Array.isArray(value.floats)) {
if (value.refAttrName) {
value.ref_attr_name = value.refAttrName;
delete value.refAttrName;
} else if (value.type === onnx.AttributeType.FLOATS || Array.isArray(value.floats)) {
value.floats = value.floats.map((value) => parseFloat(value));
} else if (value.type === onnx.AttributeType.INTS || Array.isArray(value.ints)) {
value.ints = value.ints.map((value) => parseInt(value, 10));
Expand Down
100 changes: 57 additions & 43 deletions test/models.json
Original file line number Diff line number Diff line change
Expand Up @@ -3640,13 +3640,70 @@
"format": "ONNX v3",
"link": "https://github.com/lutzroeder/netron/issues/6"
},
{
"type": "onnx",
"target": "issue_119.onnx",
"source": "https://github.com/lutzroeder/netron/files/10349170/issue_119.onnx.zip[issue_119.onnx]",
"format": "ONNX v4",
"link": "https://github.com/lutzroeder/netron/issues/119"
},
{
"type": "onnx",
"target": "issue_168_if.pbtxt",
"source": "https://github.com/lutzroeder/netron/files/10349183/issue_168.zip[issue_168_if.pbtxt]",
"format": "ONNX v3",
"link": "https://github.com/lutzroeder/netron/issues/168"
},
{
"type": "onnx",
"target": "issue_168_loop.pbtxt",
"source": "https://github.com/lutzroeder/netron/files/10349183/issue_168.zip[issue_168_loop.pbtxt]",
"format": "ONNX v3",
"link": "https://github.com/lutzroeder/netron/issues/168"
},
{
"type": "onnx",
"target": "issue_168_scan.pbtxt",
"source": "https://github.com/lutzroeder/netron/files/10349183/issue_168.zip[issue_168_scan.pbtxt]",
"format": "ONNX v3",
"link": "https://github.com/lutzroeder/netron/issues/168"
},
{
"type": "onnx",
"target": "issue_589.onnx.zip",
"source": "https://github.com/lutzroeder/netron/files/10349190/issue_589.onnx.zip",
"format": "ONNX v6",
"action": "skip-render",
"link": "https://github.com/lutzroeder/netron/issues/589"
},
{
"type": "onnx",
"target": "issue_845.onnx",
"source": "https://github.com/lutzroeder/netron/files/10349194/issue_845.onnx.zip[issue_845.onnx]",
"format": "ONNX v4",
"link": "https://github.com/lutzroeder/netron/issues/6"
},
{
"type": "onnx",
"target": "issue_1029.onnx",
"source": "https://github.com/lutzroeder/netron/files/10344328/issue_1029.onnx.zip[issue_1029.onnx]",
"format": "ONNX v8",
"link": "https://github.com/lutzroeder/netron/issues/1029"
},
{
"type": "onnx",
"target": "issue_1138.json",
"source": "https://github.com/lutzroeder/netron/files/12343742/issue_1138.json.zip[issue_1138.json]",
"format": "ONNX JSON v9",
"link": "https://github.com/lutzroeder/netron/issues/1138"
},
{
"type": "onnx",
"target": "issue_1138.onnx",
"source": "https://github.com/lutzroeder/netron/files/12343684/issue_1138.onnx.zip[issue_1138.onnx]",
"format": "ONNX v9",
"link": "https://github.com/lutzroeder/netron/issues/1138"
},
{
"type": "onnx",
"target": "Kmeans.onnx",
Expand Down Expand Up @@ -3720,49 +3777,6 @@
"format": "ONNX JSON v8",
"link": "https://github.com/lutzroeder/netron/issues/6"
},
{
"type": "onnx",
"target": "issue_119.onnx",
"source": "https://github.com/lutzroeder/netron/files/10349170/issue_119.onnx.zip[issue_119.onnx]",
"format": "ONNX v4",
"link": "https://github.com/lutzroeder/netron/issues/119"
},
{
"type": "onnx",
"target": "issue_168_if.pbtxt",
"source": "https://github.com/lutzroeder/netron/files/10349183/issue_168.zip[issue_168_if.pbtxt]",
"format": "ONNX v3",
"link": "https://github.com/lutzroeder/netron/issues/168"
},
{
"type": "onnx",
"target": "issue_168_loop.pbtxt",
"source": "https://github.com/lutzroeder/netron/files/10349183/issue_168.zip[issue_168_loop.pbtxt]",
"format": "ONNX v3",
"link": "https://github.com/lutzroeder/netron/issues/168"
},
{
"type": "onnx",
"target": "issue_168_scan.pbtxt",
"source": "https://github.com/lutzroeder/netron/files/10349183/issue_168.zip[issue_168_scan.pbtxt]",
"format": "ONNX v3",
"link": "https://github.com/lutzroeder/netron/issues/168"
},
{
"type": "onnx",
"target": "issue_589.onnx.zip",
"source": "https://github.com/lutzroeder/netron/files/10349190/issue_589.onnx.zip",
"format": "ONNX v6",
"action": "skip-render",
"link": "https://github.com/lutzroeder/netron/issues/589"
},
{
"type": "onnx",
"target": "issue_845.onnx",
"source": "https://github.com/lutzroeder/netron/files/10349194/issue_845.onnx.zip[issue_845.onnx]",
"format": "ONNX v4",
"link": "https://github.com/lutzroeder/netron/issues/6"
},
{
"type": "onnx",
"target": "optional_1.onnx",
Expand Down

0 comments on commit bd710d0

Please sign in to comment.