From 52ead0a1195ed89c839ed2a82a4792c84cb49d9e Mon Sep 17 00:00:00 2001 From: Ann Yuan Date: Thu, 3 Sep 2020 10:39:57 -0400 Subject: [PATCH 1/6] add shell --- tfjs-backend-wasm/src/cc/BUILD | 10 +++ .../src/cc/kernels/DepthToSpace.cc | 41 +++++++++ tfjs-backend-wasm/src/index_test.ts | 17 +++- tfjs-backend-wasm/src/kernels/DepthToSpace.ts | 83 +++++++++++++++++++ tfjs-backend-wasm/src/register_all_kernels.ts | 2 + tfjs-backend-wasm/src/setup_test.ts | 1 + 6 files changed, 152 insertions(+), 2 deletions(-) create mode 100644 tfjs-backend-wasm/src/cc/kernels/DepthToSpace.cc create mode 100644 tfjs-backend-wasm/src/kernels/DepthToSpace.ts diff --git a/tfjs-backend-wasm/src/cc/BUILD b/tfjs-backend-wasm/src/cc/BUILD index 48463084eb4..56d4e319d1b 100644 --- a/tfjs-backend-wasm/src/cc/BUILD +++ b/tfjs-backend-wasm/src/cc/BUILD @@ -219,6 +219,7 @@ tfjs_cc_library( ":Conv2DBackpropInput", ":CropAndResize", ":Cumsum", + ":DepthToSpace", ":DepthwiseConv2dNative", ":Div", ":Equal", @@ -422,6 +423,15 @@ tfjs_cc_library( ], ) +tfjs_cc_library( + name = "DepthToSpace", + srcs = ["kernels/DepthToSpace.cc"], + deps = [ + ":backend", + ":util", + ], +) + tfjs_cc_library( name = "DepthwiseConv2dNative", srcs = ["kernels/DepthwiseConv2dNative.cc"], diff --git a/tfjs-backend-wasm/src/cc/kernels/DepthToSpace.cc b/tfjs-backend-wasm/src/cc/kernels/DepthToSpace.cc new file mode 100644 index 00000000000..bde57cb0d0f --- /dev/null +++ b/tfjs-backend-wasm/src/cc/kernels/DepthToSpace.cc @@ -0,0 +1,41 @@ +/* Copyright 2019 Google LLC. All Rights Reserved. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ===========================================================================*/ + +#ifdef __EMSCRIPTEN__ +#include +#endif + +#include "src/cc/backend.h" +#include "src/cc/util.h" + +namespace tfjs { +namespace wasm { +extern "C" { +#ifdef __EMSCRIPTEN__ +EMSCRIPTEN_KEEPALIVE +#endif + +void DepthToSpace(const size_t x_id, const size_t block_size, + const size_t data_format, const int32_t* out_shape_ptr, + const size_t out_shape_size, const size_t out_id) { + auto& x_info = backend::get_tensor_info(x_id); + auto& out_info = backend::get_tensor_info_out(out_id); + const size_t out_size = out_info.size; + + const auto out_shape = + std::vector(out_shape_ptr, out_shape_ptr + out_shape_size); +} +} // extern "C" +} // namespace wasm +} // namespace tfjs diff --git a/tfjs-backend-wasm/src/index_test.ts b/tfjs-backend-wasm/src/index_test.ts index d009ef56025..08cb986fa20 100644 --- a/tfjs-backend-wasm/src/index_test.ts +++ b/tfjs-backend-wasm/src/index_test.ts @@ -73,8 +73,8 @@ describeWithFlags('wasm init', BROWSER_ENVS, () => { }, 100); // Silences backend registration warnings. - spyOn(console, 'warn'); - spyOn(console, 'log'); + // spyOn(console, 'warn'); + // spyOn(console, 'log'); }); afterEach(() => { @@ -219,4 +219,17 @@ describeWithFlags('wasm init', BROWSER_ENVS, () => { expect(() => setWasmPath('too/late')) .toThrowError(/The WASM backend was already initialized. Make sure/); }); + + fit('tensor4d, input shape=[1, 1, 1, 4], blockSize=2, format=NHWC', + async () => { + const t = tf.tensor4d([[[[1, 2, 3, 4]]]]); + const blockSize = 2; + const dataFormat = 'NHWC'; + + const res = tf.depthToSpace(t, blockSize, dataFormat); + expect(res.shape).toEqual([1, 2, 2, 1]); + const data = await res.data(); + console.log(Array.from(data)); + // expectArraysClose(await res.data(), [1, 2, 3, 4]); + }); }); diff --git a/tfjs-backend-wasm/src/kernels/DepthToSpace.ts b/tfjs-backend-wasm/src/kernels/DepthToSpace.ts new file mode 100644 index 00000000000..fe19e6c3109 --- /dev/null +++ b/tfjs-backend-wasm/src/kernels/DepthToSpace.ts @@ -0,0 +1,83 @@ +/** + * @license + * Copyright 2019 Google LLC. All Rights Reserved. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============================================================================= + */ + +import {DepthToSpace, DepthToSpaceAttrs, DepthToSpaceInputs, KernelConfig, KernelFunc, TensorInfo, util} from '@tensorflow/tfjs-core'; + +import {BackendWasm} from '../backend_wasm'; + +let wasmDepthToSpace: ( + xId: number, blockSize: number, dataFormat: number, outputShape: Uint8Array, + outSize: number, outId: number) => void; + +function setup(backend: BackendWasm): void { + wasmDepthToSpace = backend.wasm.cwrap(DepthToSpace, null /*void*/, [ + 'number', // xId + 'number', // blockSize + 'number', // dataFormat + 'array', // outputShape + 'number', // outSize + 'number', // outId + ]); +} + +function depthToSpace(args: { + backend: BackendWasm, + inputs: DepthToSpaceInputs, + attrs: DepthToSpaceAttrs +}): TensorInfo { + const {backend, inputs, attrs} = args; + const {x} = inputs; + const {blockSize, dataFormat} = attrs; + + util.assert( + blockSize > 1, + () => `blockSize should be > 1 for depthToSpace, but was: ${blockSize}`); + + const batchSize = x.shape[0]; + const inputHeight = (dataFormat === 'NHWC') ? x.shape[1] : x.shape[2]; + const inputWidth = (dataFormat === 'NHWC') ? x.shape[2] : x.shape[3]; + const inputDepth = (dataFormat === 'NHWC') ? x.shape[3] : x.shape[1]; + + const outputHeight = inputHeight * blockSize; + const outputWidth = inputWidth * blockSize; + const outputDepth = inputDepth / (blockSize * blockSize); + + const outputShape = (dataFormat === 'NHWC') ? + [batchSize, outputHeight, outputWidth, outputDepth] : + [batchSize, outputDepth, outputHeight, outputWidth]; + + const out = backend.makeOutput(outputShape, 'float32'); + + const xData = backend.dataIdMap.get(x.dataId); + const xId = xData.id; + + const outputShapeBytes = new Uint8Array(new Int32Array(outputShape).buffer); + + const outId = backend.dataIdMap.get(out.dataId).id; + wasmDepthToSpace( + xId, blockSize, dataFormat === 'NHWC' ? 1 : 0, outputShapeBytes, + outputShape.length, outId); + + return out; +} + +export const depthToSpaceConfig: KernelConfig = { + kernelName: DepthToSpace, + backendName: 'wasm', + setupFunc: setup, + kernelFunc: depthToSpace as {} as KernelFunc +}; diff --git a/tfjs-backend-wasm/src/register_all_kernels.ts b/tfjs-backend-wasm/src/register_all_kernels.ts index 6da4734e223..671abc9d53b 100644 --- a/tfjs-backend-wasm/src/register_all_kernels.ts +++ b/tfjs-backend-wasm/src/register_all_kernels.ts @@ -34,6 +34,7 @@ import {conv2DBackpropInputConfig} from './kernels/Conv2DBackpropInput'; import {cosConfig} from './kernels/Cos'; import {cropAndResizeConfig} from './kernels/CropAndResize'; import {cumsumConfig} from './kernels/Cumsum'; +import {depthToSpaceConfig} from './kernels/DepthToSpace'; import {depthwiseConv2dNativeConfig} from './kernels/DepthwiseConv2dNative'; import {divConfig} from './kernels/Div'; import {equalConfig} from './kernels/Equal'; @@ -110,6 +111,7 @@ const kernelConfigs: KernelConfig[] = [ cosConfig, cropAndResizeConfig, cumsumConfig, + depthToSpaceConfig, depthwiseConv2dNativeConfig, divConfig, equalConfig, diff --git a/tfjs-backend-wasm/src/setup_test.ts b/tfjs-backend-wasm/src/setup_test.ts index 17584ed4bc9..247a9a7ec37 100644 --- a/tfjs-backend-wasm/src/setup_test.ts +++ b/tfjs-backend-wasm/src/setup_test.ts @@ -52,6 +52,7 @@ const TEST_FILTERS: TestFilter[] = [ 'complex', // Complex numbers not supported yet ] }, + {include: 'depthToSpace'}, { include: 'avgPool', excludes: [ From 46ee642190f7d52532ec4eb75fb43201baee1389 Mon Sep 17 00:00:00 2001 From: Ann Yuan Date: Thu, 3 Sep 2020 11:11:02 -0400 Subject: [PATCH 2/6] add --- .../src/cc/kernels/DepthToSpace.cc | 41 +++++++++++++++++-- tfjs-backend-wasm/src/index_test.ts | 17 +------- tfjs-backend-wasm/src/kernels/DepthToSpace.ts | 15 +++++-- 3 files changed, 52 insertions(+), 21 deletions(-) diff --git a/tfjs-backend-wasm/src/cc/kernels/DepthToSpace.cc b/tfjs-backend-wasm/src/cc/kernels/DepthToSpace.cc index bde57cb0d0f..e0b80edf5b9 100644 --- a/tfjs-backend-wasm/src/cc/kernels/DepthToSpace.cc +++ b/tfjs-backend-wasm/src/cc/kernels/DepthToSpace.cc @@ -1,4 +1,4 @@ -/* Copyright 2019 Google LLC. All Rights Reserved. +/* Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -27,14 +27,49 @@ EMSCRIPTEN_KEEPALIVE #endif void DepthToSpace(const size_t x_id, const size_t block_size, - const size_t data_format, const int32_t* out_shape_ptr, - const size_t out_shape_size, const size_t out_id) { + const size_t data_format, const int32_t* x_strides_ptr, + const size_t x_strides_size, const int32_t* out_shape_ptr, + const int32_t* out_strides_ptr, const size_t out_shape_size, + const size_t out_id) { auto& x_info = backend::get_tensor_info(x_id); auto& out_info = backend::get_tensor_info_out(out_id); const size_t out_size = out_info.size; + const float* x_ptr = x_info.f32(); + float* out_buf_ptr = out_info.f32_write(); + + const auto x_strides = + std::vector(x_strides_ptr, x_strides_ptr + x_strides_size); const auto out_shape = std::vector(out_shape_ptr, out_shape_ptr + out_shape_size); + const auto out_strides = std::vector( + out_strides_ptr, out_strides_ptr + out_shape_size - 1); + + for (size_t i = 0; i < out_size; ++i) { + auto coords = tfjs::util::offset_to_loc(i, out_strides); + const size_t b = coords[0]; + const size_t h = data_format == 1 ? coords[1] : coords[2]; + const size_t w = data_format == 1 ? coords[2] : coords[3]; + const size_t d = data_format == 1 ? coords[3] : coords[1]; + const size_t out_depth_size = + data_format == 1 ? out_shape[3] : out_shape[1]; + + const size_t in_h = h / block_size; + const size_t offset_h = h % block_size; + const size_t in_w = w / block_size; + const size_t offset_w = w % block_size; + const size_t offset_d = (offset_h * block_size + offset_w) * out_depth_size; + + const size_t in_d = d + offset_d; + + size_t x_index = + data_format == 1 + ? tfjs::util::loc_to_offset({b, in_h, in_w, in_d}, x_strides) + : tfjs::util::loc_to_offset({b, in_d, in_h, in_w}, x_strides); + *out_buf_ptr = x_ptr[x_index]; + + out_buf_ptr++; + } } } // extern "C" } // namespace wasm diff --git a/tfjs-backend-wasm/src/index_test.ts b/tfjs-backend-wasm/src/index_test.ts index 08cb986fa20..d009ef56025 100644 --- a/tfjs-backend-wasm/src/index_test.ts +++ b/tfjs-backend-wasm/src/index_test.ts @@ -73,8 +73,8 @@ describeWithFlags('wasm init', BROWSER_ENVS, () => { }, 100); // Silences backend registration warnings. - // spyOn(console, 'warn'); - // spyOn(console, 'log'); + spyOn(console, 'warn'); + spyOn(console, 'log'); }); afterEach(() => { @@ -219,17 +219,4 @@ describeWithFlags('wasm init', BROWSER_ENVS, () => { expect(() => setWasmPath('too/late')) .toThrowError(/The WASM backend was already initialized. Make sure/); }); - - fit('tensor4d, input shape=[1, 1, 1, 4], blockSize=2, format=NHWC', - async () => { - const t = tf.tensor4d([[[[1, 2, 3, 4]]]]); - const blockSize = 2; - const dataFormat = 'NHWC'; - - const res = tf.depthToSpace(t, blockSize, dataFormat); - expect(res.shape).toEqual([1, 2, 2, 1]); - const data = await res.data(); - console.log(Array.from(data)); - // expectArraysClose(await res.data(), [1, 2, 3, 4]); - }); }); diff --git a/tfjs-backend-wasm/src/kernels/DepthToSpace.ts b/tfjs-backend-wasm/src/kernels/DepthToSpace.ts index fe19e6c3109..0a4394e647b 100644 --- a/tfjs-backend-wasm/src/kernels/DepthToSpace.ts +++ b/tfjs-backend-wasm/src/kernels/DepthToSpace.ts @@ -20,7 +20,8 @@ import {DepthToSpace, DepthToSpaceAttrs, DepthToSpaceInputs, KernelConfig, Kerne import {BackendWasm} from '../backend_wasm'; let wasmDepthToSpace: ( - xId: number, blockSize: number, dataFormat: number, outputShape: Uint8Array, + xId: number, blockSize: number, dataFormat: number, xStrides: Uint8Array, + xStridesLength: number, outputShape: Uint8Array, outputStrides: Uint8Array, outSize: number, outId: number) => void; function setup(backend: BackendWasm): void { @@ -28,7 +29,10 @@ function setup(backend: BackendWasm): void { 'number', // xId 'number', // blockSize 'number', // dataFormat + 'array', // xStrides + 'number', // xStridesLength 'array', // outputShape + 'array', // outputStrides 'number', // outSize 'number', // outId ]); @@ -64,13 +68,18 @@ function depthToSpace(args: { const xData = backend.dataIdMap.get(x.dataId); const xId = xData.id; + const xStridesBytes = + new Uint8Array(new Int32Array(util.computeStrides(x.shape)).buffer); const outputShapeBytes = new Uint8Array(new Int32Array(outputShape).buffer); + const outStridesBytes = + new Uint8Array(new Int32Array(util.computeStrides(outputShape)).buffer); const outId = backend.dataIdMap.get(out.dataId).id; wasmDepthToSpace( - xId, blockSize, dataFormat === 'NHWC' ? 1 : 0, outputShapeBytes, - outputShape.length, outId); + xId, blockSize, dataFormat === 'NHWC' ? 1 : 0, xStridesBytes, + x.shape.length - 1, outputShapeBytes, outStridesBytes, outputShape.length, + outId); return out; } From d0ab5edbfc8752fce24c2f0c32bef3a2c55f2a3d Mon Sep 17 00:00:00 2001 From: Ann Yuan Date: Thu, 3 Sep 2020 11:23:02 -0400 Subject: [PATCH 3/6] update --- tfjs-backend-wasm/src/cc/kernels/DepthToSpace.cc | 13 ++++++------- tfjs-backend-wasm/src/kernels/DepthToSpace.ts | 4 ++-- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/tfjs-backend-wasm/src/cc/kernels/DepthToSpace.cc b/tfjs-backend-wasm/src/cc/kernels/DepthToSpace.cc index e0b80edf5b9..e3408c6f943 100644 --- a/tfjs-backend-wasm/src/cc/kernels/DepthToSpace.cc +++ b/tfjs-backend-wasm/src/cc/kernels/DepthToSpace.cc @@ -27,7 +27,7 @@ EMSCRIPTEN_KEEPALIVE #endif void DepthToSpace(const size_t x_id, const size_t block_size, - const size_t data_format, const int32_t* x_strides_ptr, + const bool nhwc_format, const int32_t* x_strides_ptr, const size_t x_strides_size, const int32_t* out_shape_ptr, const int32_t* out_strides_ptr, const size_t out_shape_size, const size_t out_id) { @@ -48,11 +48,10 @@ void DepthToSpace(const size_t x_id, const size_t block_size, for (size_t i = 0; i < out_size; ++i) { auto coords = tfjs::util::offset_to_loc(i, out_strides); const size_t b = coords[0]; - const size_t h = data_format == 1 ? coords[1] : coords[2]; - const size_t w = data_format == 1 ? coords[2] : coords[3]; - const size_t d = data_format == 1 ? coords[3] : coords[1]; - const size_t out_depth_size = - data_format == 1 ? out_shape[3] : out_shape[1]; + const size_t h = nhwc_format ? coords[1] : coords[2]; + const size_t w = nhwc_format ? coords[2] : coords[3]; + const size_t d = nhwc_format ? coords[3] : coords[1]; + const size_t out_depth_size = nhwc_format ? out_shape[3] : out_shape[1]; const size_t in_h = h / block_size; const size_t offset_h = h % block_size; @@ -63,7 +62,7 @@ void DepthToSpace(const size_t x_id, const size_t block_size, const size_t in_d = d + offset_d; size_t x_index = - data_format == 1 + nhwc_format ? tfjs::util::loc_to_offset({b, in_h, in_w, in_d}, x_strides) : tfjs::util::loc_to_offset({b, in_d, in_h, in_w}, x_strides); *out_buf_ptr = x_ptr[x_index]; diff --git a/tfjs-backend-wasm/src/kernels/DepthToSpace.ts b/tfjs-backend-wasm/src/kernels/DepthToSpace.ts index 0a4394e647b..9d93c5a5cf8 100644 --- a/tfjs-backend-wasm/src/kernels/DepthToSpace.ts +++ b/tfjs-backend-wasm/src/kernels/DepthToSpace.ts @@ -20,7 +20,7 @@ import {DepthToSpace, DepthToSpaceAttrs, DepthToSpaceInputs, KernelConfig, Kerne import {BackendWasm} from '../backend_wasm'; let wasmDepthToSpace: ( - xId: number, blockSize: number, dataFormat: number, xStrides: Uint8Array, + xId: number, blockSize: number, nhwcFormat: number, xStrides: Uint8Array, xStridesLength: number, outputShape: Uint8Array, outputStrides: Uint8Array, outSize: number, outId: number) => void; @@ -28,7 +28,7 @@ function setup(backend: BackendWasm): void { wasmDepthToSpace = backend.wasm.cwrap(DepthToSpace, null /*void*/, [ 'number', // xId 'number', // blockSize - 'number', // dataFormat + 'number', // nhwcFormat 'array', // xStrides 'number', // xStridesLength 'array', // outputShape From b9167857f5fe8cd3b1e34b0baeafe4f02ba2f0ce Mon Sep 17 00:00:00 2001 From: Ann Yuan Date: Thu, 3 Sep 2020 11:26:49 -0400 Subject: [PATCH 4/6] rename --- tfjs-backend-wasm/src/cc/kernels/DepthToSpace.cc | 12 ++++++------ tfjs-backend-wasm/src/kernels/DepthToSpace.ts | 10 +++++----- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/tfjs-backend-wasm/src/cc/kernels/DepthToSpace.cc b/tfjs-backend-wasm/src/cc/kernels/DepthToSpace.cc index e3408c6f943..884092a4ee6 100644 --- a/tfjs-backend-wasm/src/cc/kernels/DepthToSpace.cc +++ b/tfjs-backend-wasm/src/cc/kernels/DepthToSpace.cc @@ -27,7 +27,7 @@ EMSCRIPTEN_KEEPALIVE #endif void DepthToSpace(const size_t x_id, const size_t block_size, - const bool nhwc_format, const int32_t* x_strides_ptr, + const bool channels_last, const int32_t* x_strides_ptr, const size_t x_strides_size, const int32_t* out_shape_ptr, const int32_t* out_strides_ptr, const size_t out_shape_size, const size_t out_id) { @@ -48,10 +48,10 @@ void DepthToSpace(const size_t x_id, const size_t block_size, for (size_t i = 0; i < out_size; ++i) { auto coords = tfjs::util::offset_to_loc(i, out_strides); const size_t b = coords[0]; - const size_t h = nhwc_format ? coords[1] : coords[2]; - const size_t w = nhwc_format ? coords[2] : coords[3]; - const size_t d = nhwc_format ? coords[3] : coords[1]; - const size_t out_depth_size = nhwc_format ? out_shape[3] : out_shape[1]; + const size_t h = channels_last ? coords[1] : coords[2]; + const size_t w = channels_last ? coords[2] : coords[3]; + const size_t d = channels_last ? coords[3] : coords[1]; + const size_t out_depth_size = channels_last ? out_shape[3] : out_shape[1]; const size_t in_h = h / block_size; const size_t offset_h = h % block_size; @@ -62,7 +62,7 @@ void DepthToSpace(const size_t x_id, const size_t block_size, const size_t in_d = d + offset_d; size_t x_index = - nhwc_format + channels_last ? tfjs::util::loc_to_offset({b, in_h, in_w, in_d}, x_strides) : tfjs::util::loc_to_offset({b, in_d, in_h, in_w}, x_strides); *out_buf_ptr = x_ptr[x_index]; diff --git a/tfjs-backend-wasm/src/kernels/DepthToSpace.ts b/tfjs-backend-wasm/src/kernels/DepthToSpace.ts index 9d93c5a5cf8..906ebcad5be 100644 --- a/tfjs-backend-wasm/src/kernels/DepthToSpace.ts +++ b/tfjs-backend-wasm/src/kernels/DepthToSpace.ts @@ -20,7 +20,7 @@ import {DepthToSpace, DepthToSpaceAttrs, DepthToSpaceInputs, KernelConfig, Kerne import {BackendWasm} from '../backend_wasm'; let wasmDepthToSpace: ( - xId: number, blockSize: number, nhwcFormat: number, xStrides: Uint8Array, + xId: number, blockSize: number, channelsLast: number, xStrides: Uint8Array, xStridesLength: number, outputShape: Uint8Array, outputStrides: Uint8Array, outSize: number, outId: number) => void; @@ -28,7 +28,7 @@ function setup(backend: BackendWasm): void { wasmDepthToSpace = backend.wasm.cwrap(DepthToSpace, null /*void*/, [ 'number', // xId 'number', // blockSize - 'number', // nhwcFormat + 'number', // channelsLast 'array', // xStrides 'number', // xStridesLength 'array', // outputShape @@ -76,10 +76,10 @@ function depthToSpace(args: { new Uint8Array(new Int32Array(util.computeStrides(outputShape)).buffer); const outId = backend.dataIdMap.get(out.dataId).id; + const channelsLast = dataFormat === 'NHWC' ? 1 : 0; wasmDepthToSpace( - xId, blockSize, dataFormat === 'NHWC' ? 1 : 0, xStridesBytes, - x.shape.length - 1, outputShapeBytes, outStridesBytes, outputShape.length, - outId); + xId, blockSize, channelsLast, xStridesBytes, x.shape.length - 1, + outputShapeBytes, outStridesBytes, outputShape.length, outId); return out; } From 39e1e5eba1859936890ad16e1da7d56e87ee523e Mon Sep 17 00:00:00 2001 From: Ann Yuan Date: Thu, 3 Sep 2020 13:15:41 -0400 Subject: [PATCH 5/6] comment --- tfjs-backend-wasm/src/kernels/DepthToSpace.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tfjs-backend-wasm/src/kernels/DepthToSpace.ts b/tfjs-backend-wasm/src/kernels/DepthToSpace.ts index 906ebcad5be..bbcd24cd7b8 100644 --- a/tfjs-backend-wasm/src/kernels/DepthToSpace.ts +++ b/tfjs-backend-wasm/src/kernels/DepthToSpace.ts @@ -38,7 +38,7 @@ function setup(backend: BackendWasm): void { ]); } -function depthToSpace(args: { +export function depthToSpace(args: { backend: BackendWasm, inputs: DepthToSpaceInputs, attrs: DepthToSpaceAttrs From 6d7f2430512e3eacc8ded10b4625372f37008826 Mon Sep 17 00:00:00 2001 From: Ann Yuan Date: Fri, 4 Sep 2020 08:00:50 -0400 Subject: [PATCH 6/6] save