license import * as tf from '@tensorflow/tfjs' ; import { load , PoseNet } from './posenet' ; describe ( 'PoseNet' , ( ) => { let net ; beforeAll ( ( done ) => { load ( ) . then ( ( posenetInstance ) => { net = posenetInstance ; } ) . then ( done ) . catch ( done . fail ) ; } ) ; describe ( 'estimateSinglePose' , ( ) => { it ( 'does not leak memory' , done => { const canvas = document . createElement ( 'canvas' ) ; canvas . width = 513 ; canvas . height = 513 ; const beforeTensors = tf . memory ( ) . numTensors ; net . estimateSinglePose ( canvas ) . then ( ( ) => { expect ( tf . memory ( ) . numTensors ) . toEqual ( beforeTensors ) ; } ) . then ( done ) . catch ( done . fail ) ; } ) ; } ) ; describe ( 'estimateMultiplePoses' , ( ) => { it ( 'does not leak memory' , done => { const canvas = document . createElement ( 'canvas' ) ; canvas . width = 513 ; canvas . height = 513 ; const beforeTensors = tf . memory ( ) . numTensors ; net . estimateMultiplePoses ( canvas ) . then ( ( ) => { expect ( tf . memory ( ) . numTensors ) . toEqual ( beforeTensors ) ; } ) . then ( done ) . catch ( done . fail ) ; } ) ; } ) ; } ) ;