Skip to content

Conversation

@annxingyuan
Copy link
Contributor

@annxingyuan annxingyuan commented Jun 29, 2020

To see the logs from the Cloud Build CI, please join either our discussion or announcement mailing list.


This change is Reviewable

@annxingyuan annxingyuan requested review from pyu10055 and tafsiri June 29, 2020 14:09
@annxingyuan annxingyuan self-assigned this Jun 29, 2020
Copy link
Contributor

@tafsiri tafsiri left a comment

Choose a reason for hiding this comment

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

LGTM with a small comments.

Reviewed 6 of 6 files at r1.
Reviewable status: :shipit: complete! 1 of 1 approvals obtained (waiting on @annxingyuan, @pyu10055, and @tafsiri)


tfjs-backend-wasm/src/cc/kernels/Reverse.cc, line 55 at r1 (raw file):

        tfjs::util::offset_to_loc(i, out_strides);

    std::vector<size_t> in_loc = out_loc;

just curious. Why not just directly assign in_loc to the value on the line above, out_loc doesn't seem be used for anything else.


tfjs-backend-wasm/src/kernels/Reverse.ts, line 44 at r1 (raw file):

}): TensorInfo {
  const {inputs, backend, attrs} = args;
  const {x} = inputs as {} as ReverseInputs;

optional: a tip i've found recently, if you cast the kernelFunc on line 69 to a ForwardFunc, then you can make this function directly take ReverseInputs and ReverseAttrs and not have to cast here.


tfjs-backend-wasm/src/kernels/Reverse.ts, line 66 at r1 (raw file):

}

registerKernel({

I think we wanted to move to doing registration outside of the files defining the kernel for consistency with other backends (and for potential tree-shakeability of wasm in future as well). Might as well not add new ones in the older style.

Copy link
Contributor Author

@annxingyuan annxingyuan 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 @pyu10055 and @tafsiri)


tfjs-backend-wasm/src/cc/kernels/Reverse.cc, line 55 at r1 (raw file):

Previously, tafsiri (Yannick Assogba) wrote…

just curious. Why not just directly assign in_loc to the value on the line above, out_loc doesn't seem be used for anything else.

Done


tfjs-backend-wasm/src/kernels/Reverse.ts, line 44 at r1 (raw file):

Previously, tafsiri (Yannick Assogba) wrote…

optional: a tip i've found recently, if you cast the kernelFunc on line 69 to a ForwardFunc, then you can make this function directly take ReverseInputs and ReverseAttrs and not have to cast here.

Done


tfjs-backend-wasm/src/kernels/Reverse.ts, line 66 at r1 (raw file):

Previously, tafsiri (Yannick Assogba) wrote…

I think we wanted to move to doing registration outside of the files defining the kernel for consistency with other backends (and for potential tree-shakeability of wasm in future as well). Might as well not add new ones in the older style.

Done

@annxingyuan annxingyuan requested a review from tafsiri June 29, 2020 20:56
Copy link
Contributor Author

@annxingyuan annxingyuan 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 @pyu10055 and @tafsiri)


tfjs-backend-wasm/src/kernels/Reverse.ts, line 44 at r1 (raw file):

Previously, annxingyuan (Ann Yuan) wrote…

Done

Actually I'm not sure I understand - it doesn't seem like the types are compatible? What am I missing?

Copy link
Contributor Author

@annxingyuan annxingyuan 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 @pyu10055 and @tafsiri)


tfjs-backend-wasm/src/kernels/Reverse.ts, line 44 at r1 (raw file):

Previously, annxingyuan (Ann Yuan) wrote…

Actually I'm not sure I understand - it doesn't seem like the types are compatible? What am I missing?

OH i see - casting as KernelFunc works!

@annxingyuan annxingyuan requested a review from lina128 July 6, 2020 14:00
@annxingyuan
Copy link
Contributor Author

@tafsiri Hey Yannick - would you mind taking another look at this one? I've changed the WASM implementation of clone to reflect our last conversation.

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.

LGTM

Reviewable status: :shipit: complete! 2 of 1 approvals obtained (waiting on @lina128, @pyu10055, and @tafsiri)

Copy link
Contributor

@tafsiri tafsiri left a comment

Choose a reason for hiding this comment

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

Reviewed 8 of 9 files at r2.
Reviewable status: :shipit: complete! 2 of 1 approvals obtained (waiting on @annxingyuan, @pyu10055, and @tafsiri)


tfjs-backend-wasm/src/register_all_kernels.ts, line 22 at r2 (raw file):

import {KernelConfig, registerKernel} from '@tensorflow/tfjs-core';

import {reverseConfig} from './kernels/Reverse';

After this PR could you do a followup one converting all the existing kernels to use this style?

Copy link
Contributor Author

@annxingyuan annxingyuan 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! 2 of 1 approvals obtained (waiting on @pyu10055 and @tafsiri)


tfjs-backend-wasm/src/register_all_kernels.ts, line 22 at r2 (raw file):

Previously, tafsiri (Yannick Assogba) wrote…

After this PR could you do a followup one converting all the existing kernels to use this style?

Yes sounds good.

@annxingyuan annxingyuan merged commit 5a88009 into master Jul 6, 2020
@annxingyuan annxingyuan deleted the wasm_reverse branch July 6, 2020 18:38
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.

4 participants