license import './index' ; import '@tensorflow/tfjs-core/dist/public/chained_ops/register_all_chained_ops' ; import '@tensorflow/tfjs-core/dist/register_all_gradients' ; import * as tf from '@tensorflow/tfjs' ; import * as jasmine_util from '@tensorflow/tfjs-core/dist/jasmine_util' ; import { argv } from 'yargs' ; import { NodeJSKernelBackend } from './nodejs_kernel_backend' ; Error . stackTraceLimit = Infinity ; const jasmineCtor = require ( 'jasmine' ) ; process . on ( 'unhandledRejection' , e => { throw e ; } ) ; jasmine_util . setTestEnvs ( [ { name : 'test-tensorflow' , backendName : 'tensorflow' , flags : { } , isDataSync : true } ] ) ; const IGNORE_LIST = [ 'version version' , 'unreliable is true due to both auto gc and string tensors' , 'unreliable is true due to auto gc' , 'depthwiseConv2D' , 'separableConv2d' , 'complex64 memory' , 'depthToSpace test-tensorflow {} throws when blocksize < 2' , 'depthToSpace test-tensorflow {} throws when CPU backend used with data format NCHW' , 'scatterND test-tensorflow {} should work for 2d' , 'scatterND test-tensorflow {} should work for simple 1d' , 'scatterND test-tensorflow {} should work for multiple 1d' , 'scatterND test-tensorflow {} should sum the duplicated indices' , 'scatterND test-tensorflow {} should work for tensorLike input' , 'maxPool test-tensorflow {} x=[2,2,3] f=[2,2] s=3 p=1 default dimRoundingMode' , 'maxPool test-tensorflow {} x=[2,2,3] f=[1,1] s=2 p=1 dimRoundingMode=floor' , 'maxPool test-tensorflow {} x=[2,2,3] f=[2,2] s=3 p=1 dimRoundingMode=floor' , 'maxPool test-tensorflow {} x=[2,2,3] f=[2,2] s=3 p=1 dimRoundingMode=round' , 'maxPool test-tensorflow {} x=[2,2,3] f=[2,2] s=3 p=1 dimRoundingMode=ceil' , 'avgPool test-tensorflow {} x=[3,3,1] f=[3,3] s=1 p=explicit' , 'avgPool test-tensorflow {} x=[2,2,3] f=[2,2] s=3 p=1 default dimRoundingMode' , 'avgPool test-tensorflow {} x=[2,2,3] f=[1,1] s=2 p=1 dimRoundingMode=floor' , 'avgPool test-tensorflow {} x=[2,2,3] f=[2,2] s=3 p=1 dimRoundingMode=floor' , 'avgPool test-tensorflow {} x=[2,2,3] f=[2,2] s=3 p=1 dimRoundingMode=round' , 'avgPool test-tensorflow {} x=[2,2,3] f=[2,2] s=3 p=1 dimRoundingMode=ceil' , 'avgPool test-tensorflow {} gradient x=[3,3,1] f=[3,3] s=1 p=explicit' , 'avgPool3d test-tensorflow {} x=[1,2,2,2,1] f=[2,2,2] s=1 p=1 roundingMode=floor' , 'maxPool test-tensorflow {} x=[3,3,1] f=[3,3] s=1 p=explicit' , 'maxPoolBackprop test-tensorflow {} gradient x=[3,3,1] f=3 s=1 p=explicit' , 'maxPool3d test-tensorflow {} x=[1,2,2,2,1] f=[2,2,2] s=1 p=1 roundingMode=floor' , 'argmax test-tensorflow {} 6D, axis=0' , 'diag test-tensorflow {} complex' , 'diag test-tensorflow {} bool' , 'conv2d test-tensorflow {} x=[2,1,2,2] f=[1,1,1,1] s=1 d=1 p=0 NCHW' , 'conv2d test-tensorflow {} x=[1,2,2] f=[2,2,1,1] s=1 d=1 p=explicit NCHW' , 'conv2d test-tensorflow {} x=[1,2,2] f=[2,2,1,1] s=1 d=1 p=same NCHW' , 'conv2d test-tensorflow {} x=[2,2,2] f=[2,2,2,1] s=1 d=1 p=same NCHW' , 'conv2d test-tensorflow {} x=[2,1,2,2] f=[2,2,1,1] s=1 d=1 p=same NCHW' , 'conv2d test-tensorflow {} gradient x=[1,1,3,3] f=[2,2,1,1] s=1 p=0 NCHW' , 'conv2d test-tensorflow {} gradient x=[2,1,3,3] f=[2,2,1,1] s=1 p=0 NCHW' , 'conv2dTranspose test-tensorflow {} input=3x3x1,d2=1,f=2,s=2,p=explicit' , 'conv2dTranspose test-tensorflow {} gradient input=[1,3,3,1] f=[2,2,2,1] s=[1,1] p=explicit' , 'maxPoolWithArgmax' , 'rotate' , 'unique test-tensorflow {} 1d tensor with NaN and Infinity' , 'broadcast with unequal batch dims' , 'broadcast batch shape' , 'broadcast with unequal ranks' , 'pool test-tensorflow {} max x=[3,3,1] f=[3,3] s=1 d=1 p=explicit' , 'pool test-tensorflow {} max x=[3,3,1] f=[3,3] s=3 d=1 p=explicit defualt dimRoundingMode' , 'pool test-tensorflow {} max x=[3,3,1] f=[3,3] s=3 d=1 p=explicit dimRoundingMode=floor' , 'pool test-tensorflow {} max x=[3,3,1] f=[3,3] s=3 d=1 p=explicit dimRoundingMode=round' , 'pool test-tensorflow {} max x=[3,3,1] f=[3,3] s=3 d=1 p=explicit dimRoundingMode=ceil' , 'pool test-tensorflow {} avg x=[3,3,1] f=[3,3] s=3 d=1 p=explicit defualt dimRoundingMode' , 'pool test-tensorflow {} avg x=[3,3,1] f=[3,3] s=3 d=1 p=explicit dimRoundingMode=floor' , 'pool test-tensorflow {} avg x=[3,3,1] f=[3,3] s=3 d=1 p=explicit dimRoundingMode=round' , 'pool test-tensorflow {} avg x=[3,3,1] f=[3,3] s=3 d=1 p=explicit dimRoundingMode=ceil' , 'pool test-tensorflow {} max x=[2,2,3] f=[1,1] s=2 p=1 fractional outputs default rounding' , 'pool test-tensorflow {} avg x=[3,3,1] f=[3,3] s=1 d=1 p=explicit' , 'pool test-tensorflow {} avg x=[2,2,3] f=[1,1] s=2 p=1 fractional outputs default rounding' , 'denseBincount' , 'image.transform' , 'sign test-tensorflow {} basic' , 'sign test-tensorflow {} does not propagate NaNs' , 'sign test-tensorflow {} accepts a tensor-like object' , 'einsum' , 'sparseFillEmptyRows' , 'sparseReshape' , 'sparseSegmentMean' , 'sparseSegmentSum' , 'stringNGrams' , 'stringSplit' , 'stringToHashBucketFast' , 'greaterEqual test-tensorflow {} should support string comparison' , 'greater test-tensorflow {} should support string comparison' , 'lessEqual test-tensorflow {} should support string comparison' , 'less test-tensorflow {} should support string comparison' , 'leakyrelu test-tensorflow {} int32' , 'step kernel test-tensorflow {} with int32 tensor' , ] ; if ( process . platform === 'win32' ) { IGNORE_LIST . push ( 'tensorboard' ) ; IGNORE_LIST . push ( 'tensorBoard' ) ; IGNORE_LIST . push ( 'clip test-tensorflow {} propagates NaNs' ) ; IGNORE_LIST . push ( 'maxPool test-tensorflow {} [x=[3,3,1] f=[2,2] s=1 ignores NaNs' ) ; } const runner = new jasmineCtor ( ) ; runner . loadConfig ( { spec_files : [ 'src/**/*_test.ts' ] , random : false } ) ; import '@tensorflow/tfjs-core/dist/tests' ; if ( process . env . JASMINE_SEED ) { runner . seed ( process . env . JASMINE_SEED ) ; } const env = jasmine . getEnv ( ) ; const grepRegex = new RegExp ( argv . grep as string ) ; env . specFilter = spec => { if ( ! grepRegex . test ( spec . getFullName ( ) ) ) { return false ; } for ( let i = 0 ; i < IGNORE_LIST . length ; ++ i ) { if ( spec . getFullName ( ) . indexOf ( IGNORE_LIST [ i ] ) > - 1 ) { return false ; } } return true ; } ; console . log ( `Running tests against TensorFlow: ${ ( tf . backend ( ) as NodeJSKernelBackend ) . binding . TF_Version }` ) ; runner . execute ( ) ;