Fixed squeeze() mutating the arguments passed#1454
Conversation
dsmilkov
left a comment
There was a problem hiding this comment.
Thanks for the contributon! Couple of small comments.
Reviewable status: 0 of 1 approvals obtained (waiting on @VisibleMarkov)
src/util.ts, line 279 at r1 (raw file):
const keptDims: number[] = []; if (axis != null) { axis = axis.map((i) => {
we already have a convenient method parseAxisParam in axis_util.ts which you can call here. Also add a unit test that asserts that the user-provided axis was not modified? Thanks!
Previous implementation mutated the argument for axis passed to squeeze() Used map to make squeeze() immutable
|
@dsmilkov, turns out the import of |
|
I see. Move |
parseAxisParams which caused a dependency loop is moved to util.ts All the imports and references of the same have been updated
|
@dsmilkov |
dsmilkov
left a comment
There was a problem hiding this comment.
Thanks!
Reviewed 9 of 9 files at r3.
Reviewable status: 0 of 1 approvals obtained
Commit: 5c0b5a7
If the axis is passed to squeeze() as an array, the array mutates if it's not in an ascending order or if it contains negative indexes.
Code to reproduce:
AFAIK, this shouldn't be the behavior.
This slipped in due to my own ignorance in the above mentioned commit. I apologize for the overlook.
@caisq, would love to know your thoughts on this
Description
For repository owners only:
Please remember to apply all applicable tags to your pull request.
Tags: FEATURE, BREAKING, BUG, PERF, DEV, DOC, SECURITY
For more info see: https://github.com/tensorflow/tfjs/blob/master/DEVELOPMENT.md
This change is