Skip to content

Conversation

@annxingyuan
Copy link
Contributor

@annxingyuan annxingyuan commented Aug 12, 2020

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 Reviewable

@annxingyuan annxingyuan self-assigned this Aug 12, 2020
Copy link
Collaborator

@lina128 lina128 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: :shipit: 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.

Copy link
Collaborator

@lina128 lina128 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: :shipit: 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.

@annxingyuan annxingyuan merged commit b022728 into master Aug 13, 2020
@annxingyuan annxingyuan deleted the flipLeftRight branch August 13, 2020 00:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants