Skip to content
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

Add doccomment for fromPixels inconsistent result. #5865

Merged
merged 2 commits into from
Nov 22, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion tfjs-core/src/ops/browser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,13 @@ let fromPixels2DContext: CanvasRenderingContext2D;
*
* @returns A Tensor3D with the shape `[height, width, numChannels]`.
*
* Note: fromPixels can be lossy in some cases, same image may result in
* slightly different tensor values, if rendered by different rendering
* engines. This means that results from different browsers, or even same
* browser with CPU and GPU rendering engines can be different. See discussion
* in details:
* https://github.com/tensorflow/tfjs/issues/5482
*
* @doc {heading: 'Browser', namespace: 'browser', ignoreCI: true}
*/
function fromPixels_(
Expand Down Expand Up @@ -154,7 +161,7 @@ function fromPixels_(
fromPixels2DContext.canvas.width = width;
fromPixels2DContext.canvas.height = height;
fromPixels2DContext.drawImage(
pixels as HTMLVideoElement, 0, 0, width, height);
pixels as HTMLVideoElement, 0, 0, width, height);
vals = fromPixels2DContext.getImageData(0, 0, width, height).data;
}
let values: Int32Array;
Expand Down