Skip to content

Commit f68d889

Browse files
Merge pull request #441 from JingyuanZhang/master
fix converter and update split op
2 parents 83a6edb + cf9e895 commit f68d889

File tree

4 files changed

+8
-5
lines changed

4 files changed

+8
-5
lines changed

packages/paddlejs-backend-webgl/package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/paddlejs-backend-webgl/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@paddlejs/paddlejs-backend-webgl",
3-
"version": "1.2.0",
3+
"version": "1.2.7",
44
"description": "",
55
"main": "lib/index",
66
"scripts": {

packages/paddlejs-backend-webgl/src/ops/shader/split.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,15 @@
44

55
function mainFunc(
66
{},
7-
{ target_length, num, dim }
7+
{ target_length, num, dim, sections }
88
) {
9+
10+
const splitChip = sections && sections.length > 1 ? sections[0] : target_length / num;
11+
912
return `
1013
// start函数
1114
void main(void) {
12-
int length = int(${target_length} / ${num});
15+
int length = int(${splitChip});
1316
ivec4 oPos = getOutputTensorPos();
1417
// 输出坐标转换为输入坐标
1518
oPos[${dim}] = oPos[${dim}] + layer_run_time * length;

packages/paddlejs-converter/fuseOps.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ def opExistSingleNode(opName):
6060
if op['type'] == fuse:
6161
prevOp = ops[index - 1]
6262

63-
if opExistSingleNode(prevOp['outputs']['Out'][0]):
63+
if opExistSingleNode(prevOp['outputs']['Out'][0]) and len(prevOp['outputs']['Out']) == 1 :
6464
prevOp['attrs']['fuse_opt'] = {}
6565
if 'fuse_opt' in op['attrs']:
6666
prevOp['attrs']['fuse_opt'] = op['attrs']['fuse_opt']

0 commit comments

Comments
 (0)