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