-
Notifications
You must be signed in to change notification settings - Fork 943
Make tf.browser.fromPixels / toPixels and route tf.fromPixels / tf.toPixels to it. #1540
Conversation
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.
Thanks, A high level question, what is the mechanism for a different env (node, wechat) to provide its own custom op (i.e. wechat.fromPixels) op and be able to attach to the tf namespace.
Reviewed 7 of 7 files at r1.
Reviewable status: 0 of 1 approvals obtained (waiting on @nsthorat)
src/ops/browser.ts, line 26 at r1 (raw file):
* * ```js * const image = new ImageData(1, 1);
ImageData(2,2) ?
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.
wechat will have it's own package entirely so can provide a separate API (outside browser.fromPixels)
node will have decodeJpeg (not use fromPixels)
Reviewable status: 0 of 1 approvals obtained (waiting on @pyu10055)
src/ops/browser.ts, line 26 at r1 (raw file):
Previously, pyu10055 (Ping Yu) wrote…
ImageData(2,2) ?
This is a 1x1 image (single value, 4 values of rgba)
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.
My question since the PR to create a browser namespace for set of ops, what is way to adding other platform specific ops. Should we allow registering custom ops in engine so the ops can get to routed to the custom backend who implements them?
Reviewable status: 0 of 1 approvals obtained (waiting on @pyu10055)
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: 0 of 1 approvals obtained
src/ops/browser.ts, line 26 at r1 (raw file):
Previously, nsthorat (Nikhil Thorat) wrote…
This is a 1x1 image (single value, 4 values of rgba)
ah, right.
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.
For now we're not going to tackle platform registration since wechat can have its own library (it will add quite a bit of complexity). We can talk about that offline, but this PR should be unrelated.
Reviewable status: 0 of 1 approvals obtained
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 2 of 7 files at r1, 2 of 3 files at r2.
Reviewable status: 0 of 1 approvals obtained (waiting on @dsmilkov and @nsthorat)
src/ops/browser.ts, line 41 at r2 (raw file):
* 3 (ignores alpha channel of input image). */ /** @doc {heading: 'Tensors', subheading: 'Creation', namespace: 'browser'} */
let's have this under the section 'Browser'.
src/ops/browser.ts, line 42 at r2 (raw file):
*/ /** @doc {heading: 'Tensors', subheading: 'Creation', namespace: 'browser'} */ function fromPixels_(
move toPixels
also to browser
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: 0 of 1 approvals obtained
src/ops/browser.ts, line 42 at r2 (raw file):
Previously, dsmilkov (Daniel Smilkov) wrote…
move
toPixels
also to browser
Done.
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 1 of 3 files at r2, 3 of 3 files at r3.
Reviewable status:complete! 1 of 1 approvals obtained
We will delete tf.fromPixels in the 1.0 branch.
Fixes tensorflow/tfjs#669
This change is