-
Notifications
You must be signed in to change notification settings - Fork 2k
[core] Modularize transpose op and kernel. #2971
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
nsthorat
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.
Reviewed 20 of 20 files at r1.
Reviewable status:complete! 1 of 1 approvals obtained (waiting on @dsmilkov, @lina128, @nsthorat, and @tafsiri)
|
Wait for @tafsiri of course. |
tafsiri
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.
Great work. LGTM. It would be good to see if we can resolve the type issues that seemed to have cropped up (assuming it was a typing issue).
Reviewed 16 of 20 files at r1.
Reviewable status:complete! 2 of 1 approvals obtained (waiting on @annxingyuan, @dsmilkov, @lina128, and @tafsiri)
tfjs-core/src/ops/confusion_matrix.ts, line 87 at r1 (raw file):
const oneHotPredictions = oneHot($predictions.asType('int32'), numClasses) as Tensor2D; const oneHotLabelsT: Tensor2D = oneHotLabels.transpose();
I'm curious why you needed to make this change (there are similar changes elsewhere). It it related to type definitions on the new chained augmentor?
tfjs-core/src/public/chained_ops/transpose.ts, line 28 at r1 (raw file):
} Tensor.prototype.transpose = function<T extends Tensor>(perm?: number[]): T {
if you add this: T as the first param here then you do not need to cast the result. https://www.typescriptlang.org/docs/handbook/functions.html#this-parameters
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! 3 of 1 approvals obtained (waiting on @dsmilkov and @tafsiri)
tfjs-core/src/ops/confusion_matrix.ts, line 87 at r1 (raw file):
Previously, tafsiri (Yannick Assogba) wrote…
I'm curious why you needed to make this change (there are similar changes elsewhere). It it related to type definitions on the new chained augmentor?
Yes I think so.
tfjs-core/src/public/chained_ops/transpose.ts, line 28 at r1 (raw file):
Previously, tafsiri (Yannick Assogba) wrote…
if you add
this: Tas the first param here then you do not need to cast the result. https://www.typescriptlang.org/docs/handbook/functions.html#this-parameters
Done
This is a prerequisite for #2955
Something to note is that we can't require the transpose impl functions from
backend_webglorbackend_cpubecause that would entail a circular dependency, so for now, when we remove a kernel from the backend, we have to import the op itself if we still want to use it within the backend.Whenever kernels move out of the backend they can directly use the impl functions from other kernels.
Changes
To see the logs from the Cloud Build CI, please join either our discussion or announcement mailing list.
This change is