From 32680efc3c93322e0bd24866debde5327d1b7813 Mon Sep 17 00:00:00 2001 From: Yannick Assogba Date: Thu, 4 Jun 2020 09:51:44 -0400 Subject: [PATCH] align fromPixels op with kernel calling convention --- tfjs-core/src/ops/browser.ts | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/tfjs-core/src/ops/browser.ts b/tfjs-core/src/ops/browser.ts index 8d793465baf..87a8e00d74a 100644 --- a/tfjs-core/src/ops/browser.ts +++ b/tfjs-core/src/ops/browser.ts @@ -16,8 +16,10 @@ */ import {ENGINE} from '../engine'; -import {getKernel} from '../kernel_registry'; +import {FromPixels, FromPixelsAttrs, FromPixelsInputs} from '../kernel_names'; +import {getKernel, NamedAttrMap} from '../kernel_registry'; import {Tensor, Tensor2D, Tensor3D} from '../tensor'; +import {NamedTensorMap} from '../tensor_types'; import {convertToTensor} from '../tensor_util_env'; import {PixelData, TensorLike} from '../types'; @@ -101,10 +103,13 @@ function fromPixels_( } // If the current backend has 'FromPixels' registered, it has a more // efficient way of handling pixel uploads, so we call that. - const kernel = getKernel('FromPixels', ENGINE.backendName); + const kernel = getKernel(FromPixels, ENGINE.backendName); if (kernel != null) { - return ENGINE.runKernel('FromPixels', {pixels} as {}, {numChannels}) as - Tensor3D; + const inputs: FromPixelsInputs = {pixels}; + const attrs: FromPixelsAttrs = {numChannels}; + return ENGINE.runKernel( + FromPixels, inputs as {} as NamedTensorMap, + attrs as {} as NamedAttrMap) as Tensor3D; } const [width, height] = isVideo ?