Skip to content

Commit

Permalink
Add PaddlePaddle IR test file (#1410)
Browse files Browse the repository at this point in the history
  • Loading branch information
lutzroeder committed Dec 20, 2024
1 parent 805254f commit aa134dd
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
9 changes: 7 additions & 2 deletions source/paddle.js
Original file line number Diff line number Diff line change
Expand Up @@ -1137,7 +1137,12 @@ paddle.IR = class {
}

getParaName(tensor, namePrefix) {
const idx = tensor['%'] || tensor['#'];
let idx = '';
if ('%' in tensor) {
idx = tensor['%'];
} else if ('#' in tensor) {
idx = tensor['#'];
}
if (tensor.TT && !this._names.has(idx)) {
const prefix = namePrefix || idx;
this._names.set(idx, `${prefix}`);
Expand Down Expand Up @@ -1294,7 +1299,7 @@ paddle.IR = class {
const attrName = value.N;
let attrType = this.getType(value.AT['#'].split('.')[1]);
let attrValue = value.AT.D;
if (attrType === this.getType('a_array')) {
if (attrType === this.getType('a_array') && attrValue.length > 0) {
const subType = this.getType(attrValue[0]['#'].split('.')[1]);
attrType = `${subType}[]`;
const valueData = [];
Expand Down
8 changes: 7 additions & 1 deletion test/models.json
Original file line number Diff line number Diff line change
Expand Up @@ -4991,6 +4991,13 @@
"format": "PaddlePaddle Pickle",
"link": "https://github.com/lutzroeder/netron/issues/552"
},
{
"type": "paddle",
"target": "empty_list.json",
"source": "https://github.com/user-attachments/files/18213718/empty_list.json",
"format": "PaddlePaddle IR v1",
"link": "https://github.com/lutzroeder/netron/issues/1407"
},
{
"type": "paddle",
"target": "for_net.json",
Expand Down Expand Up @@ -5076,7 +5083,6 @@
"format": "PaddlePaddle IR v1",
"link": "https://github.com/lutzroeder/netron/issues/1407"
},

{
"type": "paddle",
"target": "without_tensor_type.zip",
Expand Down

0 comments on commit aa134dd

Please sign in to comment.