-
Notifications
You must be signed in to change notification settings - Fork 2k
[wasm] Add StridedSlice kernel. #3904
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
lina128
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status:
complete! 1 of 1 approvals obtained (waiting on @annxingyuan, @lina128, and @tafsiri)
tfjs-backend-wasm/src/kernels/StridedSlice.ts, line 3 at r1 (raw file):
/** * @license * Copyright 2019 Google LLC. All Rights Reserved.
2020
tfjs-backend-wasm/src/kernels/StridedSlice.ts, line 114 at r1 (raw file):
} const out = backend.makeOutput(outShape, 'float32');
Hi Ann, just curious, why the large chunk of code is in JS but not in c++?
tfjs-core/src/backends/backend_util.ts, line 40 at r1 (raw file):
import * as slice_util from '../ops/slice_util'; export {slice_util};
Why not export * from '../ops/slice_util' Is there naming conflict?
tfjs-core/src/ops/strided_slice.ts, line 67 at r1 (raw file):
f (strides == null) { strides = new Array(begin.length); }
This part of the code should be in forward.
annxingyuan
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status:
complete! 1 of 1 approvals obtained (waiting on @lina128 and @tafsiri)
tfjs-backend-wasm/src/kernels/StridedSlice.ts, line 3 at r1 (raw file):
Previously, lina128 (Na Li) wrote…
2020
Done.
tfjs-backend-wasm/src/kernels/StridedSlice.ts, line 114 at r1 (raw file):
Previously, lina128 (Na Li) wrote…
Hi Ann, just curious, why the large chunk of code is in JS but not in c++?
The chunk of code above normalizing the begin / end axes? It's cheap to run (despite its length), so keeping it in JS will allow it to be shared between cpu/webgl/wasm kernels.
tfjs-core/src/backends/backend_util.ts, line 40 at r1 (raw file):
Previously, lina128 (Na Li) wrote…
Why not
export * from '../ops/slice_util'Is there naming conflict?
Yes, there's a naming conflict with computeOutShape.
tfjs-core/src/ops/strided_slice.ts, line 67 at r1 (raw file):
Previously, lina128 (Na Li) wrote…
f (strides == null) { strides = new Array(begin.length); }This part of the code should be in forward.
Done.
Adds modularized StridedSlice kernel to WASM backend. This makes it possible to create a modularized WASM build for the blazeface model.
There is still a lot of logic duplicated between the new kernel and the forwardFunc in the op. I moved a little of it out into slice_util, but I thought it might be best to hold off on the rest until we modularize StridedSlice for a second backend.
To see the logs from the Cloud Build CI, please join either our discussion or announcement mailing list.
This change is