From 840a6917d7f9d1e88533e6a43a855b08735bfe59 Mon Sep 17 00:00:00 2001 From: Na Li Date: Tue, 14 Apr 2020 16:41:31 -0700 Subject: [PATCH 1/6] Add cpu as a dev dependency to tfjs-node. --- scripts/release-util.ts | 2 +- tfjs-node-gpu/package.json | 1 + tfjs-node-gpu/yarn.lock | 4 ++++ tfjs-node/package.json | 1 + tfjs-node/src/image_test.ts | 4 ++-- tfjs-node/src/run_tests.ts | 16 ++++++++++------ tfjs-node/yarn.lock | 4 ++++ 7 files changed, 23 insertions(+), 9 deletions(-) diff --git a/scripts/release-util.ts b/scripts/release-util.ts index e73c18b63e8..b15393ec910 100755 --- a/scripts/release-util.ts +++ b/scripts/release-util.ts @@ -53,7 +53,7 @@ export const UNION_PHASE: Phase = { // the test to tf.layers. export const NODE_PHASE: Phase = { packages: ['tfjs-node', 'tfjs-node-gpu'], - deps: ['tfjs', 'tfjs-core'], + deps: ['tfjs', 'tfjs-core', 'tfjs-backend-cpu'], scripts: {'tfjs-node-gpu': {'before-yarn': ['yarn prep-gpu']}} }; diff --git a/tfjs-node-gpu/package.json b/tfjs-node-gpu/package.json index c5ec8e4f2ec..09a939bfb79 100644 --- a/tfjs-node-gpu/package.json +++ b/tfjs-node-gpu/package.json @@ -49,6 +49,7 @@ "upload-windows-addon": "prep-gpu-windows.bat && ./scripts/build-and-upload-windows-addon-gpu.bat" }, "devDependencies": { + "@tensorflow/tfjs-backend-cpu": "link:../tfjs-backend-cpu", "@types/jasmine": "~2.8.6", "@types/node": "^10.5.1", "@types/progress": "^2.0.1", diff --git a/tfjs-node-gpu/yarn.lock b/tfjs-node-gpu/yarn.lock index 1e32ee3b870..e0aec3d14de 100644 --- a/tfjs-node-gpu/yarn.lock +++ b/tfjs-node-gpu/yarn.lock @@ -90,6 +90,10 @@ lodash "^4.17.13" to-fast-properties "^2.0.0" +"@tensorflow/tfjs-backend-cpu@link:../tfjs-backend-cpu": + version "0.0.0" + uid "" + "@tensorflow/tfjs-converter@link:../tfjs-converter": version "0.0.0" uid "" diff --git a/tfjs-node/package.json b/tfjs-node/package.json index 16dd6f64de8..1149fab8ae7 100644 --- a/tfjs-node/package.json +++ b/tfjs-node/package.json @@ -47,6 +47,7 @@ "upload-windows-addon": "./scripts/build-and-upload-windows-addon.bat" }, "devDependencies": { + "@tensorflow/tfjs-backend-cpu": "link:../tfjs-backend-cpu", "@types/jasmine": "~2.8.6", "@types/node": "^10.5.1", "@types/progress": "^2.0.1", diff --git a/tfjs-node/src/image_test.ts b/tfjs-node/src/image_test.ts index f0131dfb0a7..7b03d210744 100644 --- a/tfjs-node/src/image_test.ts +++ b/tfjs-node/src/image_test.ts @@ -1,6 +1,6 @@ /** * @license - * Copyright 2019 Google Inc. All Rights Reserved. + * Copyright 2020 Google Inc. 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 @@ -14,7 +14,7 @@ * limitations under the License. * ============================================================================= */ - +import '@tensorflow/tfjs-backend-cpu'; import {memory, setBackend, test_util} from '@tensorflow/tfjs'; import * as fs from 'fs'; import {promisify} from 'util'; diff --git a/tfjs-node/src/run_tests.ts b/tfjs-node/src/run_tests.ts index 847441c5431..dd5ff25830b 100644 --- a/tfjs-node/src/run_tests.ts +++ b/tfjs-node/src/run_tests.ts @@ -35,8 +35,12 @@ process.on('unhandledRejection', e => { throw e; }); -jasmine_util.setTestEnvs( - [{name: 'test-tensorflow', backendName: 'tensorflow', flags: {}}]); +jasmine_util.setTestEnvs([{ + name: 'test-tensorflow', + backendName: 'tensorflow', + flags: {}, + isDataSync: true +}]); const IGNORE_LIST: string[] = [ // Always ignore version tests: @@ -90,11 +94,11 @@ if (process.platform === 'win32') { 'maxPool test-tensorflow {} [x=[3,3,1] f=[2,2] s=1 ignores NaNs'); } -const coreTests = 'node_modules/@tensorflow/tfjs-core/dist/**/*_test.js'; -const nodeTests = 'src/**/*_test.ts'; - const runner = new jasmineCtor(); -runner.loadConfig({spec_files: [coreTests, nodeTests], random: false}); +runner.loadConfig({spec_files: ['src/**/*_test.ts'], random: false}); +// Also import tests from core. +// tslint:disable-next-line: no-imports-from-dist +import '@tensorflow/tfjs-core/dist/tests'; if (process.env.JASMINE_SEED) { runner.seed(process.env.JASMINE_SEED); diff --git a/tfjs-node/yarn.lock b/tfjs-node/yarn.lock index 2f2b7d8da14..337f4a4f7c6 100644 --- a/tfjs-node/yarn.lock +++ b/tfjs-node/yarn.lock @@ -90,6 +90,10 @@ lodash "^4.17.13" to-fast-properties "^2.0.0" +"@tensorflow/tfjs-backend-cpu@link:../tfjs-backend-cpu": + version "0.0.0" + uid "" + "@tensorflow/tfjs-converter@link:../tfjs-converter": version "0.0.0" uid "" From e45043dcaa911bc1df2a687bf8c9bcbb525d9923 Mon Sep 17 00:00:00 2001 From: Na Li Date: Tue, 14 Apr 2020 16:56:51 -0700 Subject: [PATCH 2/6] Add build-backend-cpu to build-dep. --- tfjs-node-gpu/package.json | 6 ++++-- tfjs-node/package.json | 6 ++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/tfjs-node-gpu/package.json b/tfjs-node-gpu/package.json index 09a939bfb79..3a4a67375d0 100644 --- a/tfjs-node-gpu/package.json +++ b/tfjs-node-gpu/package.json @@ -16,6 +16,8 @@ "build-ci": "tsc && mkdir -p dist/proto && cp src/proto/api_pb.js dist/proto/api_pb.js", "build-core": "cd ../tfjs-core && yarn && yarn build", "build-core-ci": "cd ../tfjs-core && yarn && yarn build-ci", + "build-backend-cpu": "cd ../tfjs-backend-cpu && yarn && yarn build", + "build-backend-cpu-ci": "cd ../tfjs-backend-cpu && yarn && yarn build-ci", "build-layers": "cd ../tfjs-layers && yarn && yarn build", "build-layers-ci": "cd ../tfjs-layers && yarn && yarn build-ci", "build-converter": "cd ../tfjs-converter && yarn && yarn build", @@ -24,8 +26,8 @@ "build-data-ci": "cd ../tfjs-data && yarn && yarn build-ci", "build-union": "cd ../tfjs && yarn && yarn build", "build-union-ci": "cd ../tfjs && yarn && yarn build-ci", - "build-deps": "yarn build-core && yarn build-layers && yarn build-converter && yarn build-data && yarn build-union", - "build-deps-ci": "yarn build-core-ci && yarn build-layers-ci && yarn build-converter-ci && yarn build-data-ci && yarn build-union-ci", + "build-deps": "yarn build-core && yarn build-backend-cpu && yarn build-layers && yarn build-converter && yarn build-data && yarn build-union", + "build-deps-ci": "yarn build-core-ci && build-backend-cpu-ci && yarn build-layers-ci && yarn build-converter-ci && yarn build-data-ci && yarn build-union-ci", "build-npm": "yarn prep-gpu && ./scripts/build-npm.sh", "build-addon": "./scripts/build-and-upload-addon.sh", "build-addon-from-source": "node-pre-gyp install --build-from-source", diff --git a/tfjs-node/package.json b/tfjs-node/package.json index 1149fab8ae7..b50b4a549f5 100644 --- a/tfjs-node/package.json +++ b/tfjs-node/package.json @@ -16,6 +16,8 @@ "build-ci": "tsc && mkdir -p dist/proto && cp src/proto/api_pb.js dist/proto/api_pb.js", "build-core": "cd ../tfjs-core && yarn && yarn build", "build-core-ci": "cd ../tfjs-core && yarn && yarn build-ci", + "build-backend-cpu": "cd ../tfjs-backend-cpu && yarn && yarn build", + "build-backend-cpu-ci": "cd ../tfjs-backend-cpu && yarn && yarn build-ci", "build-layers": "cd ../tfjs-layers && yarn && yarn build", "build-layers-ci": "cd ../tfjs-layers && yarn && yarn build-ci", "build-converter": "cd ../tfjs-converter && yarn && yarn build", @@ -24,8 +26,8 @@ "build-data-ci": "cd ../tfjs-data && yarn && yarn build-ci", "build-union": "cd ../tfjs && yarn && yarn build", "build-union-ci": "cd ../tfjs && yarn && yarn build-ci", - "build-deps": "yarn build-core && yarn build-layers && yarn build-converter && yarn build-data && yarn build-union", - "build-deps-ci": "yarn build-core-ci && yarn build-layers-ci && yarn build-converter-ci && yarn build-data-ci && yarn build-union-ci", + "build-deps": "yarn build-core && yarn build-backend-cpu && yarn build-layers && yarn build-converter && yarn build-data && yarn build-union", + "build-deps-ci": "yarn build-core-ci && build-backend-cpu-ci && yarn build-layers-ci && yarn build-converter-ci && yarn build-data-ci && yarn build-union-ci", "build-npm": "./scripts/build-npm.sh", "build-addon": "./scripts/build-and-upload-addon.sh", "build-addon-from-source": "node-pre-gyp install --build-from-source", From 96e7c470c030711a602a4dd47663bdde56bdc234 Mon Sep 17 00:00:00 2001 From: Na Li Date: Tue, 14 Apr 2020 17:02:05 -0700 Subject: [PATCH 3/6] Fix typo. --- tfjs-node-gpu/package.json | 2 +- tfjs-node/package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tfjs-node-gpu/package.json b/tfjs-node-gpu/package.json index 3a4a67375d0..d06c021930c 100644 --- a/tfjs-node-gpu/package.json +++ b/tfjs-node-gpu/package.json @@ -27,7 +27,7 @@ "build-union": "cd ../tfjs && yarn && yarn build", "build-union-ci": "cd ../tfjs && yarn && yarn build-ci", "build-deps": "yarn build-core && yarn build-backend-cpu && yarn build-layers && yarn build-converter && yarn build-data && yarn build-union", - "build-deps-ci": "yarn build-core-ci && build-backend-cpu-ci && yarn build-layers-ci && yarn build-converter-ci && yarn build-data-ci && yarn build-union-ci", + "build-deps-ci": "yarn build-core-ci && yarn build-backend-cpu-ci && yarn build-layers-ci && yarn build-converter-ci && yarn build-data-ci && yarn build-union-ci", "build-npm": "yarn prep-gpu && ./scripts/build-npm.sh", "build-addon": "./scripts/build-and-upload-addon.sh", "build-addon-from-source": "node-pre-gyp install --build-from-source", diff --git a/tfjs-node/package.json b/tfjs-node/package.json index b50b4a549f5..4d7abf980d4 100644 --- a/tfjs-node/package.json +++ b/tfjs-node/package.json @@ -27,7 +27,7 @@ "build-union": "cd ../tfjs && yarn && yarn build", "build-union-ci": "cd ../tfjs && yarn && yarn build-ci", "build-deps": "yarn build-core && yarn build-backend-cpu && yarn build-layers && yarn build-converter && yarn build-data && yarn build-union", - "build-deps-ci": "yarn build-core-ci && build-backend-cpu-ci && yarn build-layers-ci && yarn build-converter-ci && yarn build-data-ci && yarn build-union-ci", + "build-deps-ci": "yarn build-core-ci && yarn build-backend-cpu-ci && yarn build-layers-ci && yarn build-converter-ci && yarn build-data-ci && yarn build-union-ci", "build-npm": "./scripts/build-npm.sh", "build-addon": "./scripts/build-and-upload-addon.sh", "build-addon-from-source": "node-pre-gyp install --build-from-source", From 4c13cdf6ca97cd9f292e702570c3b3e48f8d7e3b Mon Sep 17 00:00:00 2001 From: Na Li Date: Wed, 15 Apr 2020 10:27:22 -0700 Subject: [PATCH 4/6] Use sync backend instead of cpu. --- scripts/release-util.ts | 2 +- tfjs-node-gpu/package.json | 7 ++----- tfjs-node-gpu/yarn.lock | 4 ---- tfjs-node/package.json | 1 - tfjs-node/src/image_test.ts | 14 ++++++++++---- tfjs-node/src/nodejs_kernel_backend_test.ts | 11 +++++++++-- tfjs-node/yarn.lock | 4 ---- 7 files changed, 22 insertions(+), 21 deletions(-) diff --git a/scripts/release-util.ts b/scripts/release-util.ts index b15393ec910..e73c18b63e8 100755 --- a/scripts/release-util.ts +++ b/scripts/release-util.ts @@ -53,7 +53,7 @@ export const UNION_PHASE: Phase = { // the test to tf.layers. export const NODE_PHASE: Phase = { packages: ['tfjs-node', 'tfjs-node-gpu'], - deps: ['tfjs', 'tfjs-core', 'tfjs-backend-cpu'], + deps: ['tfjs', 'tfjs-core'], scripts: {'tfjs-node-gpu': {'before-yarn': ['yarn prep-gpu']}} }; diff --git a/tfjs-node-gpu/package.json b/tfjs-node-gpu/package.json index d06c021930c..c5ec8e4f2ec 100644 --- a/tfjs-node-gpu/package.json +++ b/tfjs-node-gpu/package.json @@ -16,8 +16,6 @@ "build-ci": "tsc && mkdir -p dist/proto && cp src/proto/api_pb.js dist/proto/api_pb.js", "build-core": "cd ../tfjs-core && yarn && yarn build", "build-core-ci": "cd ../tfjs-core && yarn && yarn build-ci", - "build-backend-cpu": "cd ../tfjs-backend-cpu && yarn && yarn build", - "build-backend-cpu-ci": "cd ../tfjs-backend-cpu && yarn && yarn build-ci", "build-layers": "cd ../tfjs-layers && yarn && yarn build", "build-layers-ci": "cd ../tfjs-layers && yarn && yarn build-ci", "build-converter": "cd ../tfjs-converter && yarn && yarn build", @@ -26,8 +24,8 @@ "build-data-ci": "cd ../tfjs-data && yarn && yarn build-ci", "build-union": "cd ../tfjs && yarn && yarn build", "build-union-ci": "cd ../tfjs && yarn && yarn build-ci", - "build-deps": "yarn build-core && yarn build-backend-cpu && yarn build-layers && yarn build-converter && yarn build-data && yarn build-union", - "build-deps-ci": "yarn build-core-ci && yarn build-backend-cpu-ci && yarn build-layers-ci && yarn build-converter-ci && yarn build-data-ci && yarn build-union-ci", + "build-deps": "yarn build-core && yarn build-layers && yarn build-converter && yarn build-data && yarn build-union", + "build-deps-ci": "yarn build-core-ci && yarn build-layers-ci && yarn build-converter-ci && yarn build-data-ci && yarn build-union-ci", "build-npm": "yarn prep-gpu && ./scripts/build-npm.sh", "build-addon": "./scripts/build-and-upload-addon.sh", "build-addon-from-source": "node-pre-gyp install --build-from-source", @@ -51,7 +49,6 @@ "upload-windows-addon": "prep-gpu-windows.bat && ./scripts/build-and-upload-windows-addon-gpu.bat" }, "devDependencies": { - "@tensorflow/tfjs-backend-cpu": "link:../tfjs-backend-cpu", "@types/jasmine": "~2.8.6", "@types/node": "^10.5.1", "@types/progress": "^2.0.1", diff --git a/tfjs-node-gpu/yarn.lock b/tfjs-node-gpu/yarn.lock index e0aec3d14de..1e32ee3b870 100644 --- a/tfjs-node-gpu/yarn.lock +++ b/tfjs-node-gpu/yarn.lock @@ -90,10 +90,6 @@ lodash "^4.17.13" to-fast-properties "^2.0.0" -"@tensorflow/tfjs-backend-cpu@link:../tfjs-backend-cpu": - version "0.0.0" - uid "" - "@tensorflow/tfjs-converter@link:../tfjs-converter": version "0.0.0" uid "" diff --git a/tfjs-node/package.json b/tfjs-node/package.json index 4d7abf980d4..4d8a5706ca4 100644 --- a/tfjs-node/package.json +++ b/tfjs-node/package.json @@ -49,7 +49,6 @@ "upload-windows-addon": "./scripts/build-and-upload-windows-addon.bat" }, "devDependencies": { - "@tensorflow/tfjs-backend-cpu": "link:../tfjs-backend-cpu", "@types/jasmine": "~2.8.6", "@types/node": "^10.5.1", "@types/progress": "^2.0.1", diff --git a/tfjs-node/src/image_test.ts b/tfjs-node/src/image_test.ts index 7b03d210744..b87076f5533 100644 --- a/tfjs-node/src/image_test.ts +++ b/tfjs-node/src/image_test.ts @@ -14,10 +14,12 @@ * limitations under the License. * ============================================================================= */ -import '@tensorflow/tfjs-backend-cpu'; -import {memory, setBackend, test_util} from '@tensorflow/tfjs'; +import {memory, registerBackend, setBackend, test_util} from '@tensorflow/tfjs'; +// tslint:disable-next-line: no-imports-from-dist +import {TestKernelBackend} from '@tensorflow/tfjs-core/dist/jasmine_util'; import * as fs from 'fs'; import {promisify} from 'util'; + import {getImageType, ImageType} from './image'; import * as tf from './index'; @@ -221,14 +223,18 @@ describe('decode images', () => { it('throw error if backend is not tensorflow', async done => { try { - setBackend('cpu'); + const testBackend = new TestKernelBackend(); + registerBackend('sync', () => testBackend); + setBackend('sync'); + const uint8array = await getUint8ArrayFromImage( 'test_objects/images/image_png_test.png'); tf.node.decodeImage(uint8array); done.fail(); } catch (err) { expect(err.message) - .toBe('Expect the current backend to be "tensorflow", but got "cpu"'); + .toBe( + 'Expect the current backend to be "tensorflow", but got "sync"'); setBackend('tensorflow'); done(); } diff --git a/tfjs-node/src/nodejs_kernel_backend_test.ts b/tfjs-node/src/nodejs_kernel_backend_test.ts index 44653247b87..63a98f3c1e6 100644 --- a/tfjs-node/src/nodejs_kernel_backend_test.ts +++ b/tfjs-node/src/nodejs_kernel_backend_test.ts @@ -16,6 +16,9 @@ */ import * as tf from '@tensorflow/tfjs'; +// tslint:disable-next-line: no-imports-from-dist +import {TestKernelBackend} from '@tensorflow/tfjs-core/dist/jasmine_util'; + import {createTensorsTypeOpAttr, createTypeOpAttr, ensureTensorflowBackend, getTFDType, nodeBackend, NodeJSKernelBackend} from './nodejs_kernel_backend'; describe('delayed upload', () => { @@ -74,12 +77,16 @@ describe('Exposes Backend for internal Op execution.', () => { it('throw error if backend is not tensorflow', async done => { try { - tf.setBackend('cpu'); + const testBackend = new TestKernelBackend(); + tf.registerBackend('sync', () => testBackend); + tf.setBackend('sync'); + ensureTensorflowBackend(); done.fail(); } catch (err) { expect(err.message) - .toBe('Expect the current backend to be "tensorflow", but got "cpu"'); + .toBe( + 'Expect the current backend to be "tensorflow", but got "sync"'); tf.setBackend('tensorflow'); done(); } diff --git a/tfjs-node/yarn.lock b/tfjs-node/yarn.lock index 337f4a4f7c6..2f2b7d8da14 100644 --- a/tfjs-node/yarn.lock +++ b/tfjs-node/yarn.lock @@ -90,10 +90,6 @@ lodash "^4.17.13" to-fast-properties "^2.0.0" -"@tensorflow/tfjs-backend-cpu@link:../tfjs-backend-cpu": - version "0.0.0" - uid "" - "@tensorflow/tfjs-converter@link:../tfjs-converter": version "0.0.0" uid "" From 3a1af919de281654ea1b765f4fcbaa1d7fce193d Mon Sep 17 00:00:00 2001 From: Na Li Date: Wed, 15 Apr 2020 10:29:49 -0700 Subject: [PATCH 5/6] . --- tfjs-node/package.json | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/tfjs-node/package.json b/tfjs-node/package.json index 4d8a5706ca4..16dd6f64de8 100644 --- a/tfjs-node/package.json +++ b/tfjs-node/package.json @@ -16,8 +16,6 @@ "build-ci": "tsc && mkdir -p dist/proto && cp src/proto/api_pb.js dist/proto/api_pb.js", "build-core": "cd ../tfjs-core && yarn && yarn build", "build-core-ci": "cd ../tfjs-core && yarn && yarn build-ci", - "build-backend-cpu": "cd ../tfjs-backend-cpu && yarn && yarn build", - "build-backend-cpu-ci": "cd ../tfjs-backend-cpu && yarn && yarn build-ci", "build-layers": "cd ../tfjs-layers && yarn && yarn build", "build-layers-ci": "cd ../tfjs-layers && yarn && yarn build-ci", "build-converter": "cd ../tfjs-converter && yarn && yarn build", @@ -26,8 +24,8 @@ "build-data-ci": "cd ../tfjs-data && yarn && yarn build-ci", "build-union": "cd ../tfjs && yarn && yarn build", "build-union-ci": "cd ../tfjs && yarn && yarn build-ci", - "build-deps": "yarn build-core && yarn build-backend-cpu && yarn build-layers && yarn build-converter && yarn build-data && yarn build-union", - "build-deps-ci": "yarn build-core-ci && yarn build-backend-cpu-ci && yarn build-layers-ci && yarn build-converter-ci && yarn build-data-ci && yarn build-union-ci", + "build-deps": "yarn build-core && yarn build-layers && yarn build-converter && yarn build-data && yarn build-union", + "build-deps-ci": "yarn build-core-ci && yarn build-layers-ci && yarn build-converter-ci && yarn build-data-ci && yarn build-union-ci", "build-npm": "./scripts/build-npm.sh", "build-addon": "./scripts/build-and-upload-addon.sh", "build-addon-from-source": "node-pre-gyp install --build-from-source", From 528e97b5c797c7a414412ed62acc0e8a2b317eac Mon Sep 17 00:00:00 2001 From: Na Li Date: Wed, 15 Apr 2020 10:49:54 -0700 Subject: [PATCH 6/6] Rename to fake. --- tfjs-node/src/image_test.ts | 6 +++--- tfjs-node/src/nodejs_kernel_backend_test.ts | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/tfjs-node/src/image_test.ts b/tfjs-node/src/image_test.ts index b87076f5533..b3d2be05690 100644 --- a/tfjs-node/src/image_test.ts +++ b/tfjs-node/src/image_test.ts @@ -224,8 +224,8 @@ describe('decode images', () => { it('throw error if backend is not tensorflow', async done => { try { const testBackend = new TestKernelBackend(); - registerBackend('sync', () => testBackend); - setBackend('sync'); + registerBackend('fake', () => testBackend); + setBackend('fake'); const uint8array = await getUint8ArrayFromImage( 'test_objects/images/image_png_test.png'); @@ -234,7 +234,7 @@ describe('decode images', () => { } catch (err) { expect(err.message) .toBe( - 'Expect the current backend to be "tensorflow", but got "sync"'); + 'Expect the current backend to be "tensorflow", but got "fake"'); setBackend('tensorflow'); done(); } diff --git a/tfjs-node/src/nodejs_kernel_backend_test.ts b/tfjs-node/src/nodejs_kernel_backend_test.ts index 63a98f3c1e6..7a2aad4dde4 100644 --- a/tfjs-node/src/nodejs_kernel_backend_test.ts +++ b/tfjs-node/src/nodejs_kernel_backend_test.ts @@ -78,15 +78,15 @@ describe('Exposes Backend for internal Op execution.', () => { it('throw error if backend is not tensorflow', async done => { try { const testBackend = new TestKernelBackend(); - tf.registerBackend('sync', () => testBackend); - tf.setBackend('sync'); + tf.registerBackend('fake', () => testBackend); + tf.setBackend('fake'); ensureTensorflowBackend(); done.fail(); } catch (err) { expect(err.message) .toBe( - 'Expect the current backend to be "tensorflow", but got "sync"'); + 'Expect the current backend to be "tensorflow", but got "fake"'); tf.setBackend('tensorflow'); done(); }