-
Notifications
You must be signed in to change notification settings - Fork 2k
[core] Add tf.image.flipLeftRight #3779
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 @pyu10055)
tfjs-backend-cpu/src/kernels/FlipLeftRight.ts, line 40 at r1 (raw file):
for (let row = 0; row < imageHeight; row++) { const rowOffset = row * (imageWidth * numChannels);
Hi Ann, just curious, can we use indexToLoc and locToIndex? I think they can make this block of logic more readable.
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 and @pyu10055)
tfjs-backend-cpu/src/kernels/FlipLeftRight.ts, line 40 at r1 (raw file):
Previously, lina128 (Na Li) wrote…
Hi Ann, just curious, can we use indexToLoc and locToIndex? I think they can make this block of logic more readable.
Discussed offline, what I was imagining was something like in this code: https://github.com/tensorflow/tfjs/blob/master/tfjs-backend-cpu/src/kernels/Dilation2D.ts#L61
Essentially, make nestedArray of output and do computation on that, at the end convert that nestedArray to typedArray and write to backend. This is more readable, but I realize there can be performance impact of the two array conversion. So nvm, compute index directly on flattened array sounds good. Also it will be consistent with wasm code.
TF: https://www.tensorflow.org/api_docs/python/tf/image/flip_left_right
To see the logs from the Cloud Build CI, please join either our discussion or announcement mailing list.
This change is