Skip to content
This repository was archived by the owner on Sep 17, 2022. It is now read-only.
Open
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
min0or changes
  • Loading branch information
WenheLI committed Jul 25, 2019
commit 4791a15feb8a4eb35ca15f21472ae222592aa822
8 changes: 3 additions & 5 deletions src/io/file_system_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@ import {promisify} from 'util';
import * as tfn from '../index';
import {NodeFileSystem, nodeFileSystemRouter} from './file_system';

const {expectArraysClose} = test_util;

describe('File system IOHandler', () => {
const mkdtemp = promisify(fs.mkdtemp);
const readFile = promisify(fs.readFile);
Expand Down Expand Up @@ -225,7 +223,7 @@ describe('File system IOHandler', () => {
dtype: 'float32',
}
]);
expectArraysClose(
test_util.expectArraysClose(
new Float32Array(modelArtifacts.weightData),
new Float32Array([-1.1, -3.3, -3.3, -7.7]));
done();
Expand Down Expand Up @@ -348,7 +346,7 @@ describe('File system IOHandler', () => {
new NodeFileSystem([`${modelPath}`, `${modelManifestJSONPath}`]);
handler.load()
.then(modelArtifacts => {
expectArraysClose(
test_util.expectArraysClose(
new Uint8Array(modelArtifacts.modelTopology as ArrayBuffer),
new Uint8Array(modelData));
expect(modelArtifacts.weightSpecs).toEqual([
Expand All @@ -363,7 +361,7 @@ describe('File system IOHandler', () => {
dtype: 'float32',
}
]);
expectArraysClose(
test_util.expectArraysClose(
new Float32Array(modelArtifacts.weightData),
new Float32Array([-1.1, -3.3, -3.3, -7.7]));
done();
Expand Down
7 changes: 3 additions & 4 deletions src/nodejs_kernel_backend_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,16 @@

import * as tf from '@tensorflow/tfjs-core';
import {Tensor5D} from '@tensorflow/tfjs-core';
// tslint:disable-next-line:max-line-length
import {test_util} from '@tensorflow/tfjs-core';
import {NodeJSKernelBackend} from './nodejs_kernel_backend';
const {expectArraysClose} = test_util;

describe('delayed upload', () => {
it('should handle data before op execution', async () => {
const t = tf.tensor1d([1, 2, 3]);
expectArraysClose(await t.data(), [1, 2, 3]);
test_util.expectArraysClose(await t.data(), [1, 2, 3]);

const r = t.add(tf.tensor1d([4, 5, 6]));
expectArraysClose(await r.data(), [5, 7, 9]);
test_util.expectArraysClose(await r.data(), [5, 7, 9]);
});

it('Should not cache tensors in the tensor map for device support. ', () => {
Expand Down