1 | "use strict";
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 |
|
10 |
|
11 |
|
12 |
|
13 |
|
14 |
|
15 |
|
16 |
|
17 |
|
18 | Object.defineProperty(exports, "__esModule", { value: true });
|
19 |
|
20 | require("./index");
|
21 | var tf = require("@tensorflow/tfjs");
|
22 |
|
23 | var jasmine_util = require("@tensorflow/tfjs-core/dist/jasmine_util");
|
24 | var yargs_1 = require("yargs");
|
25 | Error.stackTraceLimit = Infinity;
|
26 |
|
27 | var jasmineCtor = require('jasmine');
|
28 |
|
29 | process.on('unhandledRejection', function (e) {
|
30 | throw e;
|
31 | });
|
32 | jasmine_util.setTestEnvs([{
|
33 | name: 'test-tensorflow',
|
34 | backendName: 'tensorflow',
|
35 | flags: {},
|
36 | isDataSync: true
|
37 | }]);
|
38 | var IGNORE_LIST = [
|
39 |
|
40 | 'version version',
|
41 | 'unreliable is true due to both auto gc and string tensors',
|
42 | 'unreliable is true due to auto gc',
|
43 |
|
44 | 'depthwiseConv2D',
|
45 | 'separableConv2d',
|
46 | 'complex64 memory',
|
47 |
|
48 | 'depthToSpace test-tensorflow {} throws when blocksize < 2',
|
49 |
|
50 | 'depthToSpace test-tensorflow {} throws when CPU backend used with data format NCHW',
|
51 |
|
52 | 'scatterND test-tensorflow {} should work for 2d',
|
53 | 'scatterND test-tensorflow {} should work for simple 1d',
|
54 | 'scatterND test-tensorflow {} should work for multiple 1d',
|
55 | 'scatterND test-tensorflow {} should sum the duplicated indices',
|
56 | 'scatterND test-tensorflow {} should work for tensorLike input',
|
57 |
|
58 | 'maxPool test-tensorflow {} x=[2,2,3] f=[1,1] s=2 p=1 dimRoundingMode=floor',
|
59 | 'avgPool test-tensorflow {} x=[2,2,3] f=[1,1] s=2 p=1 dimRoundingMode=floor',
|
60 |
|
61 | 'avgPool3d test-tensorflow {} x=[1,2,2,2,1] f=[2,2,2] s=1 p=1 roundingMode=floor',
|
62 |
|
63 | 'maxPool3d test-tensorflow {} x=[1,2,2,2,1] f=[2,2,2] s=1 p=1 roundingMode=floor',
|
64 |
|
65 | 'argmax test-tensorflow {} 6D, axis=0', 'diag test-tensorflow {} complex',
|
66 | 'diag test-tensorflow {} bool',
|
67 |
|
68 | 'conv2d test-tensorflow {} x=[2,1,2,2] f=[1,1,1,1] s=1 d=1 p=0 NCHW',
|
69 | 'conv2d test-tensorflow {} x=[1,2,2] f=[2,2,1,1] s=1 d=1 p=same NCHW',
|
70 | 'conv2d test-tensorflow {} x=[2,2,2] f=[2,2,2,1] s=1 d=1 p=same NCHW',
|
71 | 'conv2d test-tensorflow {} x=[2,1,2,2] f=[2,2,1,1] s=1 d=1 p=same NCHW',
|
72 | 'conv2d test-tensorflow {} gradient x=[1,1,3,3] f=[2,2,1,1] s=1 p=0 NCHW',
|
73 | 'conv2d test-tensorflow {} gradient x=[2,1,3,3] f=[2,2,1,1] s=1 p=0 NCHW',
|
74 | 'maxPoolWithArgmax'
|
75 | ];
|
76 | if (process.platform === 'win32') {
|
77 |
|
78 |
|
79 |
|
80 | IGNORE_LIST.push('tensorboard');
|
81 | IGNORE_LIST.push('tensorBoard');
|
82 |
|
83 |
|
84 | IGNORE_LIST.push('clip test-tensorflow {} propagates NaNs');
|
85 | IGNORE_LIST.push('maxPool test-tensorflow {} [x=[3,3,1] f=[2,2] s=1 ignores NaNs');
|
86 | }
|
87 | var runner = new jasmineCtor();
|
88 | runner.loadConfig({ spec_files: ['src/**/*_test.ts'], random: false });
|
89 |
|
90 |
|
91 | require("@tensorflow/tfjs-core/dist/tests");
|
92 | if (process.env.JASMINE_SEED) {
|
93 | runner.seed(process.env.JASMINE_SEED);
|
94 | }
|
95 | var env = jasmine.getEnv();
|
96 | var grepRegex = new RegExp(yargs_1.argv.grep);
|
97 |
|
98 | env.specFilter = function (spec) {
|
99 |
|
100 | if (!grepRegex.test(spec.getFullName())) {
|
101 | return false;
|
102 | }
|
103 |
|
104 | for (var i = 0; i < IGNORE_LIST.length; ++i) {
|
105 | if (spec.getFullName().indexOf(IGNORE_LIST[i]) > -1) {
|
106 | return false;
|
107 | }
|
108 | }
|
109 |
|
110 | return true;
|
111 | };
|
112 |
|
113 | console.log("Running tests against TensorFlow: " + tf.backend().binding.TF_Version);
|
114 | runner.execute();
|