diff --git a/CHANGELOG.md b/CHANGELOG.md index 39963fcb..0c8d1e19 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,7 @@ Repository: **** ### **HEAD -> main** 2021/06/06 mandic00@live.com +- custom build tfjs from sources ### **update wasm to tfjs 3.7.0** 2021/06/06 mandic00@live.com diff --git a/dist/human.esm-nobundle.js.map b/dist/human.esm-nobundle.js.map index 476bc0d6..0db672e0 100644 --- a/dist/human.esm-nobundle.js.map +++ b/dist/human.esm-nobundle.js.map @@ -1,7 +1,7 @@ { "version": 3, "sources": ["../src/helpers.ts", "../src/config.ts", "../src/sysinfo.ts", "../tfjs/tf-browser.ts", "../src/tfjs/backend.ts", "../src/blazeface/box.ts", "../src/blazeface/util.ts", "../src/blazeface/blazeface.ts", "../src/blazeface/coords.ts", "../src/blazeface/facepipeline.ts", "../src/blazeface/facemesh.ts", "../src/emotion/emotion.ts", "../src/faceres/faceres.ts", "../src/face.ts", "../src/posenet/keypoints.ts", "../src/posenet/utils.ts", "../src/posenet/poses.ts", "../src/posenet/posenet.ts", "../src/handpose/box.ts", "../src/handpose/anchors.ts", "../src/handpose/handdetector.ts", "../src/handpose/util.ts", "../src/handpose/handpipeline.ts", "../src/handpose/handpose.ts", "../src/blazepose/annotations.ts", "../src/blazepose/blazepose.ts", "../src/efficientpose/efficientpose.ts", "../src/movenet/movenet.ts", "../src/object/labels.ts", "../src/object/nanodet.ts", "../src/object/centernet.ts", "../src/gesture/gesture.ts", "../src/image/imagefx.js", "../src/image/image.ts", "../src/draw/draw.ts", "../src/persons.ts", "../src/interpolate.ts", "../src/segmentation/segmentation.ts", "../src/sample.ts", "../src/human.ts"], - "sourcesContent": ["/**\n * Simple helper functions used accross codebase\n */\n\n// helper function: join two paths\nexport function join(folder: string, file: string): string {\n const separator = folder.endsWith('/') ? '' : '/';\n const skipJoin = file.startsWith('.') || file.startsWith('/') || file.startsWith('http:') || file.startsWith('https:') || file.startsWith('file:');\n const path = skipJoin ? `${file}` : `${folder}${separator}${file}`;\n if (!path.toLocaleLowerCase().includes('.json')) throw new Error(`Human: ModelPath Error: ${path} Expecting JSON file`);\n return path;\n}\n\n// helper function: wrapper around console output\nexport function log(...msg): void {\n const dt = new Date();\n const ts = `${dt.getHours().toString().padStart(2, '0')}:${dt.getMinutes().toString().padStart(2, '0')}:${dt.getSeconds().toString().padStart(2, '0')}.${dt.getMilliseconds().toString().padStart(3, '0')}`;\n // eslint-disable-next-line no-console\n if (msg) console.log(ts, 'Human:', ...msg);\n}\n\n// helper function: gets elapsed time on both browser and nodejs\nexport const now = () => {\n if (typeof performance !== 'undefined') return performance.now();\n return parseInt((Number(process.hrtime.bigint()) / 1000 / 1000).toString());\n};\n\n// helper function: perform deep merge of multiple objects so it allows full inheriance with overrides\nexport function mergeDeep(...objects) {\n const isObject = (obj) => obj && typeof obj === 'object';\n return objects.reduce((prev, obj) => {\n Object.keys(obj || {}).forEach((key) => {\n const pVal = prev[key];\n const oVal = obj[key];\n if (Array.isArray(pVal) && Array.isArray(oVal)) prev[key] = pVal.concat(...oVal);\n else if (isObject(pVal) && isObject(oVal)) prev[key] = mergeDeep(pVal, oVal);\n else prev[key] = oVal;\n });\n return prev;\n }, {});\n}\n\n// helper function: return min and max from input array\nexport const minmax = (data) => data.reduce((acc, val) => {\n acc[0] = (acc[0] === undefined || val < acc[0]) ? val : acc[0];\n acc[1] = (acc[1] === undefined || val > acc[1]) ? val : acc[1];\n return acc;\n}, []);\n", "/* eslint-disable indent */\n/* eslint-disable no-multi-spaces */\n\n/**\n * Configuration interface definition for **Human** library\n *\n * Contains all configurable parameters\n * @typedef Config\n */\nexport interface Config {\n /** Backend used for TFJS operations */\n backend: null | '' | 'cpu' | 'wasm' | 'webgl' | 'humangl' | 'tensorflow',\n\n /** Path to *.wasm files if backend is set to `wasm` */\n wasmPath: string,\n\n /** Print debug statements to console */\n debug: boolean,\n\n /** Perform model loading and inference concurrently or sequentially */\n async: boolean,\n\n /** What to use for `human.warmup()`\n * - warmup pre-initializes all models for faster inference but can take significant time on startup\n * - only used for `webgl` and `humangl` backends\n */\n warmup: 'none' | 'face' | 'full' | 'body',\n\n /** Base model path (typically starting with file://, http:// or https://) for all models\n * - individual modelPath values are relative to this path\n */\n modelBasePath: string,\n\n /** Cache sensitivity\n * - values 0..1 where 0.01 means reset cache if input changed more than 1%\n * - set to 0 to disable caching\n */\n cacheSensitivity: number;\n\n /** Cache sensitivity\n * - values 0..1 where 0.01 means reset cache if input changed more than 1%\n * - set to 0 to disable caching\n */\n skipFrame: boolean;\n\n /** Run input through image filters before inference\n * - image filters run with near-zero latency as they are executed on the GPU\n */\n filter: {\n enabled: boolean,\n /** Resize input width\n * - if both width and height are set to 0, there is no resizing\n * - if just one is set, second one is scaled automatically\n * - if both are set, values are used as-is\n */\n width: number,\n /** Resize input height\n * - if both width and height are set to 0, there is no resizing\n * - if just one is set, second one is scaled automatically\n * - if both are set, values are used as-is\n */\n height: number,\n /** Return processed canvas imagedata in result */\n return: boolean,\n /** Flip input as mirror image */\n flip: boolean,\n /** Range: -1 (darken) to 1 (lighten) */\n brightness: number,\n /** Range: -1 (reduce contrast) to 1 (increase contrast) */\n contrast: number,\n /** Range: 0 (no sharpening) to 1 (maximum sharpening) */\n sharpness: number,\n /** Range: 0 (no blur) to N (blur radius in pixels) */\n blur: number\n /** Range: -1 (reduce saturation) to 1 (increase saturation) */\n saturation: number,\n /** Range: 0 (no change) to 360 (hue rotation in degrees) */\n hue: number,\n /** Image negative */\n negative: boolean,\n /** Image sepia colors */\n sepia: boolean,\n /** Image vintage colors */\n vintage: boolean,\n /** Image kodachrome colors */\n kodachrome: boolean,\n /** Image technicolor colors */\n technicolor: boolean,\n /** Image polaroid camera effect */\n polaroid: boolean,\n /** Range: 0 (no pixelate) to N (number of pixels to pixelate) */\n pixelate: number,\n },\n // type definition end\n\n /** Controlls gesture detection */\n gesture: {\n enabled: boolean,\n },\n\n /** Controlls and configures all face-specific options:\n * - face detection, face mesh detection, age, gender, emotion detection and face description\n * Parameters:\n * - enabled: true/false\n * - modelPath: path for each of face models\n * - minConfidence: threshold for discarding a prediction\n * - iouThreshold: ammount of overlap between two detected objects before one object is removed\n * - maxDetected: maximum number of faces detected in the input, should be set to the minimum number for performance\n * - rotation: use calculated rotated face image or just box with rotation as-is, false means higher performance, but incorrect mesh mapping on higher face angles\n * - return: return extracted face as tensor for futher user processing\n */\n face: {\n enabled: boolean,\n detector: {\n modelPath: string,\n rotation: boolean,\n maxDetected: number,\n skipFrames: number,\n minConfidence: number,\n iouThreshold: number,\n return: boolean,\n },\n mesh: {\n enabled: boolean,\n modelPath: string,\n },\n iris: {\n enabled: boolean,\n modelPath: string,\n },\n description: {\n enabled: boolean,\n modelPath: string,\n skipFrames: number,\n minConfidence: number,\n },\n emotion: {\n enabled: boolean,\n minConfidence: number,\n skipFrames: number,\n modelPath: string,\n },\n },\n\n /** Controlls and configures all body detection specific options\n * - enabled: true/false\n * - modelPath: body pose model, can be absolute path or relative to modelBasePath\n * - minConfidence: threshold for discarding a prediction\n * - maxDetected: maximum number of people detected in the input, should be set to the minimum number for performance\n */\n body: {\n enabled: boolean,\n modelPath: string,\n maxDetected: number,\n minConfidence: number,\n skipFrames: number,\n },\n\n /** Controlls and configures all hand detection specific options\n * - enabled: true/false\n * - landmarks: detect hand landmarks or just hand boundary box\n * - modelPath: paths for hand detector and hand skeleton models, can be absolute path or relative to modelBasePath\n * - minConfidence: threshold for discarding a prediction\n * - iouThreshold: ammount of overlap between two detected objects before one object is removed\n * - maxDetected: maximum number of hands detected in the input, should be set to the minimum number for performance\n * - rotation: use best-guess rotated hand image or just box with rotation as-is, false means higher performance, but incorrect finger mapping if hand is inverted\n */\n hand: {\n enabled: boolean,\n rotation: boolean,\n skipFrames: number,\n minConfidence: number,\n iouThreshold: number,\n maxDetected: number,\n landmarks: boolean,\n detector: {\n modelPath: string,\n },\n skeleton: {\n modelPath: string,\n },\n },\n\n /** Controlls and configures all object detection specific options\n * - enabled: true/false\n * - modelPath: object detection model, can be absolute path or relative to modelBasePath\n * - minConfidence: minimum score that detection must have to return as valid object\n * - iouThreshold: ammount of overlap between two detected objects before one object is removed\n * - maxDetected: maximum number of detections to return\n */\n object: {\n enabled: boolean,\n modelPath: string,\n minConfidence: number,\n iouThreshold: number,\n maxDetected: number,\n skipFrames: number,\n },\n\n /** Controlls and configures all body segmentation module\n * removes background from input containing person\n * if segmentation is enabled it will run as preprocessing task before any other model\n * alternatively leave it disabled and use it on-demand using human.segmentation method which can\n * remove background or replace it with user-provided background\n *\n * - enabled: true/false\n * - modelPath: object detection model, can be absolute path or relative to modelBasePath\n */\n segmentation: {\n enabled: boolean,\n modelPath: string,\n },\n}\n\nconst config: Config = {\n backend: 'webgl', // select tfjs backend to use, leave empty to use default backend\n // can be 'webgl', 'wasm', 'cpu', or 'humangl' which is a custom version of webgl\n modelBasePath: '../models/', // base path for all models\n wasmPath: '../node_modules/@tensorflow/tfjs-backend-wasm/dist/', // path for wasm binaries, only used for backend: wasm\n debug: true, // print additional status messages to console\n async: true, // execute enabled models in parallel\n warmup: 'full', // what to use for human.warmup(), can be 'none', 'face', 'full'\n // warmup pre-initializes all models for faster inference but can take\n // significant time on startup\n // only used for `webgl` and `humangl` backends\n cacheSensitivity: 0.75, // cache sensitivity\n // values 0..1 where 0.01 means reset cache if input changed more than 1%\n // set to 0 to disable caching\n skipFrame: false, // internal & dynamic\n filter: { // run input through image filters before inference\n // image filters run with near-zero latency as they are executed on the GPU\n enabled: true, // enable image pre-processing filters\n width: 0, // resize input width\n height: 0, // resize input height\n // if both width and height are set to 0, there is no resizing\n // if just one is set, second one is scaled automatically\n // if both are set, values are used as-is\n flip: false, // flip input as mirror image\n return: true, // return processed canvas imagedata in result\n brightness: 0, // range: -1 (darken) to 1 (lighten)\n contrast: 0, // range: -1 (reduce contrast) to 1 (increase contrast)\n sharpness: 0, // range: 0 (no sharpening) to 1 (maximum sharpening)\n blur: 0, // range: 0 (no blur) to N (blur radius in pixels)\n saturation: 0, // range: -1 (reduce saturation) to 1 (increase saturation)\n hue: 0, // range: 0 (no change) to 360 (hue rotation in degrees)\n negative: false, // image negative\n sepia: false, // image sepia colors\n vintage: false, // image vintage colors\n kodachrome: false, // image kodachrome colors\n technicolor: false, // image technicolor colors\n polaroid: false, // image polaroid camera effect\n pixelate: 0, // range: 0 (no pixelate) to N (number of pixels to pixelate)\n },\n\n gesture: {\n enabled: true, // enable gesture recognition based on model results\n },\n\n face: {\n enabled: true, // controls if specified modul is enabled\n // face.enabled is required for all face models:\n // detector, mesh, iris, age, gender, emotion\n // (note: module is not loaded until it is required)\n detector: {\n modelPath: 'blazeface.json', // detector model, can be absolute path or relative to modelBasePath\n rotation: true, // use best-guess rotated face image or just box with rotation as-is\n // false means higher performance, but incorrect mesh mapping if face angle is above 20 degrees\n // this parameter is not valid in nodejs\n maxDetected: 15, // maximum number of faces detected in the input\n // should be set to the minimum number for performance\n skipFrames: 15, // how many max frames to go without re-running the face bounding box detector\n // only used when cacheSensitivity is not zero\n // e.g., if model is running st 25 FPS, we can re-use existing bounding\n // box for updated face analysis as the head probably hasn't moved much\n // in short time (10 * 1/25 = 0.25 sec)\n minConfidence: 0.2, // threshold for discarding a prediction\n iouThreshold: 0.1, // ammount of overlap between two detected objects before one object is removed\n return: false, // return extracted face as tensor\n },\n\n mesh: {\n enabled: true,\n modelPath: 'facemesh.json', // facemesh model, can be absolute path or relative to modelBasePath\n },\n\n iris: {\n enabled: true,\n modelPath: 'iris.json', // face iris model\n // can be either absolute path or relative to modelBasePath\n },\n\n description: {\n enabled: true, // to improve accuracy of face description extraction it is\n // recommended to enable detector.rotation and mesh.enabled\n modelPath: 'faceres.json', // face description model\n // can be either absolute path or relative to modelBasePath\n skipFrames: 11, // how many max frames to go without re-running the detector\n // only used when cacheSensitivity is not zero\n minConfidence: 0.1, // threshold for discarding a prediction\n },\n\n emotion: {\n enabled: true,\n minConfidence: 0.1, // threshold for discarding a prediction\n skipFrames: 17, // how max many frames to go without re-running the detector\n // only used when cacheSensitivity is not zero\n modelPath: 'emotion.json', // face emotion model, can be absolute path or relative to modelBasePath\n },\n },\n\n body: {\n enabled: true,\n modelPath: 'movenet-lightning.json', // body model, can be absolute path or relative to modelBasePath\n // can be 'posenet', 'blazepose', 'efficientpose', 'movenet-lightning', 'movenet-thunder'\n maxDetected: 1, // maximum number of people detected in the input\n // should be set to the minimum number for performance\n // only valid for posenet as other models detects single pose\n minConfidence: 0.2, // threshold for discarding a prediction\n skipFrames: 1, // how many max frames to go without re-running the detector\n // only used when cacheSensitivity is not zero\n},\n\n hand: {\n enabled: true,\n rotation: true, // use best-guess rotated hand image or just box with rotation as-is\n // false means higher performance, but incorrect finger mapping if hand is inverted\n skipFrames: 18, // how many max frames to go without re-running the hand bounding box detector\n // only used when cacheSensitivity is not zero\n // e.g., if model is running st 25 FPS, we can re-use existing bounding\n // box for updated hand skeleton analysis as the hand probably\n // hasn't moved much in short time (10 * 1/25 = 0.25 sec)\n minConfidence: 0.1, // threshold for discarding a prediction\n iouThreshold: 0.1, // ammount of overlap between two detected objects before one object is removed\n maxDetected: 2, // maximum number of hands detected in the input\n // should be set to the minimum number for performance\n landmarks: true, // detect hand landmarks or just hand boundary box\n detector: {\n modelPath: 'handdetect.json', // hand detector model, can be absolute path or relative to modelBasePath\n },\n skeleton: {\n modelPath: 'handskeleton.json', // hand skeleton model, can be absolute path or relative to modelBasePath\n },\n },\n\n object: {\n enabled: false,\n modelPath: 'mb3-centernet.json', // experimental: object detection model, can be absolute path or relative to modelBasePath\n // can be 'mb3-centernet' or 'nanodet'\n minConfidence: 0.2, // threshold for discarding a prediction\n iouThreshold: 0.4, // ammount of overlap between two detected objects before one object is removed\n maxDetected: 10, // maximum number of objects detected in the input\n skipFrames: 19, // how many max frames to go without re-running the detector\n // only used when cacheSensitivity is not zero\n },\n\n segmentation: {\n enabled: false, // controlls and configures all body segmentation module\n // removes background from input containing person\n // if segmentation is enabled it will run as preprocessing task before any other model\n // alternatively leave it disabled and use it on-demand using human.segmentation method which can\n // remove background or replace it with user-provided background\n modelPath: 'selfie.json', // experimental: object detection model, can be absolute path or relative to modelBasePath\n // can be 'selfie' or 'meet'\n },\n};\nexport { config as defaults };\n", "/**\n * Helper function that returns basic system info\n */\nexport function info(): { platform: string, agent: string } {\n let platform;\n let agent;\n if (typeof navigator !== 'undefined') {\n const raw = navigator.userAgent.match(/\\(([^()]+)\\)/g);\n if (raw && raw[0]) {\n const platformMatch = raw[0].match(/\\(([^()]+)\\)/g);\n platform = platformMatch ? platformMatch[0].replace(/\\(|\\)/g, '') : '';\n agent = navigator.userAgent.replace(raw[0], '');\n if (platform[1]) agent = agent.replace(raw[1], '');\n agent = agent.replace(/ /g, ' ');\n }\n } else if (typeof process !== 'undefined') {\n platform = `${process.platform} ${process.arch}`;\n agent = `NodeJS ${process.version}`;\n }\n return { platform, agent };\n}\n", "/**\n * Creates tfjs bundle used by Human browser build target\n * @external\n */\n\n// import from dist\n// modules: 1299, moduleBytes: 4230827, imports: 7, importBytes: 2478, outputBytes: 2357435\n// get versions of all packages\n/*\nimport * as packageBundle from '@tensorflow/tfjs/package.json';\nimport * as packageCore from '@tensorflow/tfjs-core/package.json';\nimport * as packageData from '@tensorflow/tfjs-data/package.json';\nimport * as packageLayers from '@tensorflow/tfjs-layers/package.json';\nimport * as packageConverter from '@tensorflow/tfjs-converter/package.json';\n// for backends, get version from source so it can register backend during import\nimport { version_cpu } from '@tensorflow/tfjs-backend-cpu/dist/index.js';\nimport { version_webgl } from '@tensorflow/tfjs-backend-webgl/dist/index.js';\nimport { version_wasm } from '@tensorflow/tfjs-backend-wasm/dist/index.js';\n\n// export all\nexport * from '@tensorflow/tfjs-core/dist/index.js';\nexport * from '@tensorflow/tfjs-layers/dist/index.js';\nexport * from '@tensorflow/tfjs-converter/dist/index.js';\nexport * as data from '@tensorflow/tfjs-data/dist/index.js';\nexport * from '@tensorflow/tfjs-backend-cpu/dist/index.js';\nexport * from '@tensorflow/tfjs-backend-webgl/dist/index.js';\nexport * from '@tensorflow/tfjs-backend-wasm/dist/index.js';\n*/\n\n// import from src\n// modules: 1681, moduleBytes: 5711239, imports: 7, importBytes: 2701, outputBytes: 2107830\n// get versions of all packages\nimport { version as tfjsVersion } from '@tensorflow/tfjs/package.json';\nimport { version as tfjsCoreVersion } from '@tensorflow/tfjs-core/package.json';\nimport { version as tfjsDataVersion } from '@tensorflow/tfjs-data/package.json';\nimport { version as tfjsLayersVersion } from '@tensorflow/tfjs-layers/package.json';\nimport { version as tfjsConverterVersion } from '@tensorflow/tfjs-converter/package.json';\nimport { version as tfjsBackendCPUVersion } from '@tensorflow/tfjs-backend-cpu/package.json';\nimport { version as tfjsBackendWebGLVersion } from '@tensorflow/tfjs-backend-webgl/package.json';\nimport { version as tfjsBackendWASMVersion } from '@tensorflow/tfjs-backend-wasm/package.json';\n\n// export all\nexport * from '@tensorflow/tfjs-core/src/index';\nexport * from '@tensorflow/tfjs-layers/src/index';\nexport * from '@tensorflow/tfjs-converter/src/index';\nexport * as data from '@tensorflow/tfjs-data/src/index';\nexport * from '@tensorflow/tfjs-backend-cpu/src/index';\nexport * from '@tensorflow/tfjs-backend-webgl/src/index';\nexport * from '@tensorflow/tfjs-backend-wasm/src/index';\n/*\n*/\n\n// export versions\nexport const version = {\n tfjs: tfjsVersion,\n 'tfjs-core': tfjsCoreVersion,\n 'tfjs-data': tfjsDataVersion,\n 'tfjs-layers': tfjsLayersVersion,\n 'tfjs-converter': tfjsConverterVersion,\n 'tfjs-backend-cpu': tfjsBackendCPUVersion,\n 'tfjs-backend-webgl': tfjsBackendWebGLVersion,\n 'tfjs-backend-wasm': tfjsBackendWASMVersion,\n};\n// export const version = {};\n", "/**\n * Custom TFJS backend for Human based on WebGL\n * Not used by default\n */\n\nimport { log } from '../helpers';\nimport * as tf from '../../dist/tfjs.esm.js';\n\nexport const config = {\n name: 'humangl',\n priority: 99,\n canvas: null,\n gl: null,\n width: 1024,\n height: 1024,\n webGLattr: { // https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.2\n alpha: false,\n antialias: false,\n premultipliedAlpha: false,\n preserveDrawingBuffer: false,\n depth: false,\n stencil: false,\n failIfMajorPerformanceCaveat: false,\n desynchronized: true,\n },\n};\n\nexport function register(): void {\n if (!tf.findBackend(config.name)) {\n log('backend registration:', config.name);\n try {\n config.canvas = (typeof OffscreenCanvas !== 'undefined') ? new OffscreenCanvas(config.width, config.height) : document.createElement('canvas');\n } catch (err) {\n log('error: cannot create canvas:', err);\n return;\n }\n try {\n config.gl = config.canvas.getContext('webgl2', config.webGLattr);\n } catch (err) {\n log('error: cannot get WebGL2 context:', err);\n return;\n }\n try {\n tf.setWebGLContext(2, config.gl);\n } catch (err) {\n log('error: cannot set WebGL2 context:', err);\n return;\n }\n try {\n const ctx = new tf.GPGPUContext(config.gl);\n tf.registerBackend(config.name, () => new tf.MathBackendWebGL(ctx), config.priority);\n } catch (err) {\n log('error: cannot register WebGL backend:', err);\n return;\n }\n try {\n const kernels = tf.getKernelsForBackend('webgl');\n kernels.forEach((kernelConfig) => {\n const newKernelConfig = { ...kernelConfig, backendName: config.name };\n tf.registerKernel(newKernelConfig);\n });\n } catch (err) {\n log('error: cannot update WebGL backend registration:', err);\n return;\n }\n try {\n tf.ENV.set('WEBGL_VERSION', 2);\n // tf.ENV.set('WEBGL_MAX_TEXTURE_SIZE', config.gl.getParameter(config.gl.MAX_TEXTURE_SIZE));\n // tf.ENV.set('WEBGL_FORCE_F16_TEXTURES', true);\n // tf.ENV.set('WEBGL_PACK_DEPTHWISECONV', true);\n } catch (err) {\n log('error: cannot set WebGL backend flags:', err);\n return;\n }\n log('backend registered:', config.name);\n }\n}\n", "import * as tf from '../../dist/tfjs.esm.js';\n\nexport function scaleBoxCoordinates(box, factor) {\n const startPoint = [box.startPoint[0] * factor[0], box.startPoint[1] * factor[1]];\n const endPoint = [box.endPoint[0] * factor[0], box.endPoint[1] * factor[1]];\n return { startPoint, endPoint };\n}\n\nexport function getBoxSize(box) {\n return [\n Math.abs(box.endPoint[0] - box.startPoint[0]),\n Math.abs(box.endPoint[1] - box.startPoint[1]),\n ];\n}\n\nexport function getBoxCenter(box) {\n return [\n box.startPoint[0] + (box.endPoint[0] - box.startPoint[0]) / 2,\n box.startPoint[1] + (box.endPoint[1] - box.startPoint[1]) / 2,\n ];\n}\n\nexport function cutBoxFromImageAndResize(box, image, cropSize) {\n const h = image.shape[1];\n const w = image.shape[2];\n const boxes = [[\n box.startPoint[1] / h,\n box.startPoint[0] / w,\n box.endPoint[1] / h,\n box.endPoint[0] / w,\n ]];\n return tf.image.cropAndResize(image, boxes, [0], cropSize);\n}\n\nexport function enlargeBox(box, factor = 1.5) {\n const center = getBoxCenter(box);\n const size = getBoxSize(box);\n const newHalfSize = [factor * size[0] / 2, factor * size[1] / 2];\n const startPoint = [center[0] - newHalfSize[0], center[1] - newHalfSize[1]];\n const endPoint = [center[0] + newHalfSize[0], center[1] + newHalfSize[1]];\n return { startPoint, endPoint, landmarks: box.landmarks };\n}\n\nexport function squarifyBox(box) {\n const centers = getBoxCenter(box);\n const size = getBoxSize(box);\n const maxEdge = Math.max(...size);\n const halfSize = maxEdge / 2;\n const startPoint = [Math.round(centers[0] - halfSize), Math.round(centers[1] - halfSize)];\n const endPoint = [Math.round(centers[0] + halfSize), Math.round(centers[1] + halfSize)];\n return { startPoint, endPoint, landmarks: box.landmarks };\n}\n\nexport function calculateLandmarksBoundingBox(landmarks) {\n const xs = landmarks.map((d) => d[0]);\n const ys = landmarks.map((d) => d[1]);\n const startPoint = [Math.min(...xs), Math.min(...ys)];\n const endPoint = [Math.max(...xs), Math.max(...ys)];\n return { startPoint, endPoint, landmarks };\n}\n\nexport const disposeBox = (t) => {\n t.startPoint.dispose();\n t.endPoint.dispose();\n};\n\nexport const createBox = (startEndTensor) => ({\n startPoint: tf.slice(startEndTensor, [0, 0], [-1, 2]),\n endPoint: tf.slice(startEndTensor, [0, 2], [-1, 2]),\n});\n", "export const IDENTITY_MATRIX = [[1, 0, 0], [0, 1, 0], [0, 0, 1]];\n/**\n * Normalizes the provided angle to the range -pi to pi.\n * @param angle The angle in radians to be normalized.\n */\nexport function normalizeRadians(angle) {\n return angle - 2 * Math.PI * Math.floor((angle + Math.PI) / (2 * Math.PI));\n}\n\n/**\n * Computes the angle of rotation between two anchor points.\n * @param point1 First anchor point\n * @param point2 Second anchor point\n */\nexport function computeRotation(point1, point2) {\n const radians = Math.PI / 2 - Math.atan2(-(point2[1] - point1[1]), point2[0] - point1[0]);\n return normalizeRadians(radians);\n}\n\nexport function radToDegrees(rad) {\n return rad * 180 / Math.PI;\n}\n\nexport function buildTranslationMatrix(x, y) {\n return [[1, 0, x], [0, 1, y], [0, 0, 1]];\n}\n\nexport function dot(v1, v2) {\n let product = 0;\n for (let i = 0; i < v1.length; i++) {\n product += v1[i] * v2[i];\n }\n return product;\n}\n\nexport function getColumnFrom2DArr(arr, columnIndex) {\n const column: Array = [];\n for (let i = 0; i < arr.length; i++) {\n column.push(arr[i][columnIndex]);\n }\n return column;\n}\n\nexport function multiplyTransformMatrices(mat1, mat2) {\n const product: Array = [];\n const size = mat1.length;\n for (let row = 0; row < size; row++) {\n product.push([]);\n for (let col = 0; col < size; col++) {\n product[row].push(dot(mat1[row], getColumnFrom2DArr(mat2, col)));\n }\n }\n return product;\n}\n\nexport function buildRotationMatrix(rotation, center) {\n const cosA = Math.cos(rotation);\n const sinA = Math.sin(rotation);\n const rotationMatrix = [[cosA, -sinA, 0], [sinA, cosA, 0], [0, 0, 1]];\n const translationMatrix = buildTranslationMatrix(center[0], center[1]);\n const translationTimesRotation = multiplyTransformMatrices(translationMatrix, rotationMatrix);\n const negativeTranslationMatrix = buildTranslationMatrix(-center[0], -center[1]);\n return multiplyTransformMatrices(translationTimesRotation, negativeTranslationMatrix);\n}\n\nexport function invertTransformMatrix(matrix) {\n const rotationComponent = [[matrix[0][0], matrix[1][0]], [matrix[0][1], matrix[1][1]]];\n const translationComponent = [matrix[0][2], matrix[1][2]];\n const invertedTranslation = [\n -dot(rotationComponent[0], translationComponent),\n -dot(rotationComponent[1], translationComponent),\n ];\n return [\n rotationComponent[0].concat(invertedTranslation[0]),\n rotationComponent[1].concat(invertedTranslation[1]),\n [0, 0, 1],\n ];\n}\n\nexport function rotatePoint(homogeneousCoordinate, rotationMatrix) {\n return [\n dot(homogeneousCoordinate, rotationMatrix[0]),\n dot(homogeneousCoordinate, rotationMatrix[1]),\n ];\n}\n\nexport function xyDistanceBetweenPoints(a, b) {\n return Math.sqrt(((a[0] - b[0]) ** 2) + ((a[1] - b[1]) ** 2));\n}\n\nexport function generateAnchors(inputSize) {\n const spec = { strides: [inputSize / 16, inputSize / 8], anchors: [2, 6] };\n const anchors: Array<[number, number]> = [];\n for (let i = 0; i < spec.strides.length; i++) {\n const stride = spec.strides[i];\n const gridRows = Math.floor((inputSize + stride - 1) / stride);\n const gridCols = Math.floor((inputSize + stride - 1) / stride);\n const anchorsNum = spec.anchors[i];\n for (let gridY = 0; gridY < gridRows; gridY++) {\n const anchorY = stride * (gridY + 0.5);\n for (let gridX = 0; gridX < gridCols; gridX++) {\n const anchorX = stride * (gridX + 0.5);\n for (let n = 0; n < anchorsNum; n++) {\n anchors.push([anchorX, anchorY]);\n }\n }\n }\n }\n return anchors;\n}\n", "import { log, join } from '../helpers';\nimport * as tf from '../../dist/tfjs.esm.js';\nimport * as box from './box';\nimport * as util from './util';\nimport { Config } from '../config';\nimport { Tensor, GraphModel } from '../tfjs/types';\n\nconst keypointsCount = 6;\n\nfunction decodeBounds(boxOutputs, anchors, inputSize) {\n const boxStarts = tf.slice(boxOutputs, [0, 1], [-1, 2]);\n const centers = tf.add(boxStarts, anchors);\n const boxSizes = tf.slice(boxOutputs, [0, 3], [-1, 2]);\n const boxSizesNormalized = tf.div(boxSizes, inputSize);\n const centersNormalized = tf.div(centers, inputSize);\n const halfBoxSize = tf.div(boxSizesNormalized, 2);\n const starts = tf.sub(centersNormalized, halfBoxSize);\n const ends = tf.add(centersNormalized, halfBoxSize);\n const startNormalized = tf.mul(starts, inputSize);\n const endNormalized = tf.mul(ends, inputSize);\n const concatAxis = 1;\n return tf.concat2d([startNormalized, endNormalized], concatAxis);\n}\n\nexport class BlazeFaceModel {\n model: GraphModel;\n anchorsData: [number, number][];\n anchors: Tensor;\n inputSize: number;\n config: Config;\n\n constructor(model, config: Config) {\n this.model = model;\n this.anchorsData = util.generateAnchors(model.inputs[0].shape[1]);\n this.anchors = tf.tensor2d(this.anchorsData);\n this.inputSize = model.inputs[0].shape[2];\n this.config = config;\n }\n\n async getBoundingBoxes(inputImage: Tensor) {\n // sanity check on input\n // @ts-ignore isDisposed is internal property\n if ((!inputImage) || (inputImage.isDisposedInternal) || (inputImage.shape.length !== 4) || (inputImage.shape[1] < 1) || (inputImage.shape[2] < 1)) return null;\n const [batch, boxes, scores] = tf.tidy(() => {\n const resizedImage = tf.image.resizeBilinear(inputImage, [this.inputSize, this.inputSize]);\n const normalizedImage = resizedImage.div(127.5).sub(0.5);\n const res = this.model.execute(normalizedImage);\n let batchOut;\n if (Array.isArray(res)) { // are we using tfhub or pinto converted model?\n const sorted = res.sort((a, b) => a.size - b.size);\n const concat384 = tf.concat([sorted[0], sorted[2]], 2); // dim: 384, 1 + 16\n const concat512 = tf.concat([sorted[1], sorted[3]], 2); // dim: 512, 1 + 16\n const concat = tf.concat([concat512, concat384], 1);\n batchOut = concat.squeeze(0);\n } else {\n batchOut = tf.squeeze(res); // when using tfhub model\n }\n const boxesOut = decodeBounds(batchOut, this.anchors, [this.inputSize, this.inputSize]);\n const logits = tf.slice(batchOut, [0, 0], [-1, 1]);\n const scoresOut = tf.sigmoid(logits).squeeze().dataSync();\n return [batchOut, boxesOut, scoresOut];\n });\n const nmsTensor = await tf.image.nonMaxSuppressionAsync(boxes, scores, this.config.face.detector.maxDetected, this.config.face.detector.iouThreshold, this.config.face.detector.minConfidence);\n const nms = nmsTensor.arraySync();\n nmsTensor.dispose();\n const annotatedBoxes: Array<{ box: { startPoint: Tensor, endPoint: Tensor }, landmarks: Tensor, anchor: number[], confidence: number }> = [];\n for (let i = 0; i < nms.length; i++) {\n const confidence = scores[nms[i]];\n if (confidence > this.config.face.detector.minConfidence) {\n const boundingBox = tf.slice(boxes, [nms[i], 0], [1, -1]);\n const localBox = box.createBox(boundingBox);\n boundingBox.dispose();\n const anchor = this.anchorsData[nms[i]];\n const landmarks = tf.tidy(() => tf.slice(batch, [nms[i], keypointsCount - 1], [1, -1]).squeeze().reshape([keypointsCount, -1]));\n annotatedBoxes.push({ box: localBox, landmarks, anchor, confidence });\n }\n }\n // boundingBoxes.forEach((t) => t.dispose());\n batch.dispose();\n boxes.dispose();\n // scores.dispose();\n return {\n boxes: annotatedBoxes,\n scaleFactor: [inputImage.shape[2] / this.inputSize, inputImage.shape[1] / this.inputSize],\n };\n }\n}\n\nexport async function load(config: Config) {\n const model = await tf.loadGraphModel(join(config.modelBasePath, config.face.detector.modelPath), { fromTFHub: config.face.detector.modelPath.includes('tfhub.dev') });\n const blazeFace = new BlazeFaceModel(model, config);\n if (!model || !model.modelUrl) log('load model failed:', config.face.detector.modelPath);\n else if (config.debug) log('load model:', model.modelUrl);\n return blazeFace;\n}\n", "export const MESH_ANNOTATIONS = {\n silhouette: [\n 10, 338, 297, 332, 284, 251, 389, 356, 454, 323, 361, 288,\n 397, 365, 379, 378, 400, 377, 152, 148, 176, 149, 150, 136,\n 172, 58, 132, 93, 234, 127, 162, 21, 54, 103, 67, 109,\n ],\n lipsUpperOuter: [61, 185, 40, 39, 37, 0, 267, 269, 270, 409, 291],\n lipsLowerOuter: [146, 91, 181, 84, 17, 314, 405, 321, 375, 291],\n lipsUpperInner: [78, 191, 80, 81, 82, 13, 312, 311, 310, 415, 308],\n lipsLowerInner: [78, 95, 88, 178, 87, 14, 317, 402, 318, 324, 308],\n rightEyeUpper0: [246, 161, 160, 159, 158, 157, 173],\n rightEyeLower0: [33, 7, 163, 144, 145, 153, 154, 155, 133],\n rightEyeUpper1: [247, 30, 29, 27, 28, 56, 190],\n rightEyeLower1: [130, 25, 110, 24, 23, 22, 26, 112, 243],\n rightEyeUpper2: [113, 225, 224, 223, 222, 221, 189],\n rightEyeLower2: [226, 31, 228, 229, 230, 231, 232, 233, 244],\n rightEyeLower3: [143, 111, 117, 118, 119, 120, 121, 128, 245],\n rightEyebrowUpper: [156, 70, 63, 105, 66, 107, 55, 193],\n rightEyebrowLower: [35, 124, 46, 53, 52, 65],\n rightEyeIris: [473, 474, 475, 476, 477],\n leftEyeUpper0: [466, 388, 387, 386, 385, 384, 398],\n leftEyeLower0: [263, 249, 390, 373, 374, 380, 381, 382, 362],\n leftEyeUpper1: [467, 260, 259, 257, 258, 286, 414],\n leftEyeLower1: [359, 255, 339, 254, 253, 252, 256, 341, 463],\n leftEyeUpper2: [342, 445, 444, 443, 442, 441, 413],\n leftEyeLower2: [446, 261, 448, 449, 450, 451, 452, 453, 464],\n leftEyeLower3: [372, 340, 346, 347, 348, 349, 350, 357, 465],\n leftEyebrowUpper: [383, 300, 293, 334, 296, 336, 285, 417],\n leftEyebrowLower: [265, 353, 276, 283, 282, 295],\n leftEyeIris: [468, 469, 470, 471, 472],\n midwayBetweenEyes: [168],\n noseTip: [1],\n noseBottom: [2],\n noseRightCorner: [98],\n noseLeftCorner: [327],\n rightCheek: [205],\n leftCheek: [425],\n};\n\nexport const MESH_TO_IRIS_INDICES_MAP = [ // A mapping from facemesh model keypoints to iris model keypoints.\n { key: 'EyeUpper0', indices: [9, 10, 11, 12, 13, 14, 15] },\n { key: 'EyeUpper1', indices: [25, 26, 27, 28, 29, 30, 31] },\n { key: 'EyeUpper2', indices: [41, 42, 43, 44, 45, 46, 47] },\n { key: 'EyeLower0', indices: [0, 1, 2, 3, 4, 5, 6, 7, 8] },\n { key: 'EyeLower1', indices: [16, 17, 18, 19, 20, 21, 22, 23, 24] },\n { key: 'EyeLower2', indices: [32, 33, 34, 35, 36, 37, 38, 39, 40] },\n { key: 'EyeLower3', indices: [54, 55, 56, 57, 58, 59, 60, 61, 62] },\n // { key: 'EyebrowUpper', indices: [63, 64, 65, 66, 67, 68, 69, 70] },\n // { key: 'EyebrowLower', indices: [48, 49, 50, 51, 52, 53] },\n];\n\nexport const UV468 = [\n [0.499976992607117, 0.652534008026123],\n [0.500025987625122, 0.547487020492554],\n [0.499974012374878, 0.602371990680695],\n [0.482113003730774, 0.471979022026062],\n [0.500150978565216, 0.527155995368958],\n [0.499909996986389, 0.498252987861633],\n [0.499523013830185, 0.40106201171875],\n [0.289712011814117, 0.380764007568359],\n [0.499954998493195, 0.312398016452789],\n [0.499987006187439, 0.269918978214264],\n [0.500023007392883, 0.107050001621246],\n [0.500023007392883, 0.666234016418457],\n [0.5000159740448, 0.679224014282227],\n [0.500023007392883, 0.692348003387451],\n [0.499976992607117, 0.695277988910675],\n [0.499976992607117, 0.70593398809433],\n [0.499976992607117, 0.719385027885437],\n [0.499976992607117, 0.737019002437592],\n [0.499967992305756, 0.781370997428894],\n [0.499816000461578, 0.562981009483337],\n [0.473773002624512, 0.573909997940063],\n [0.104906998574734, 0.254140973091125],\n [0.365929991006851, 0.409575998783112],\n [0.338757991790771, 0.41302502155304],\n [0.311120003461838, 0.409460008144379],\n [0.274657994508743, 0.389131009578705],\n [0.393361985683441, 0.403706014156342],\n [0.345234006643295, 0.344011008739471],\n [0.370094001293182, 0.346076011657715],\n [0.319321990013123, 0.347265005111694],\n [0.297903001308441, 0.353591024875641],\n [0.24779200553894, 0.410809993743896],\n [0.396889001131058, 0.842755019664764],\n [0.280097991228104, 0.375599980354309],\n [0.106310002505779, 0.399955987930298],\n [0.2099249958992, 0.391353011131287],\n [0.355807989835739, 0.534406006336212],\n [0.471751004457474, 0.65040397644043],\n [0.474155008792877, 0.680191993713379],\n [0.439785003662109, 0.657229006290436],\n [0.414617002010345, 0.66654098033905],\n [0.450374007225037, 0.680860996246338],\n [0.428770989179611, 0.682690978050232],\n [0.374971002340317, 0.727805018424988],\n [0.486716985702515, 0.547628998756409],\n [0.485300987958908, 0.527395009994507],\n [0.257764995098114, 0.314490020275116],\n [0.401223003864288, 0.455172002315521],\n [0.429818987846375, 0.548614978790283],\n [0.421351999044418, 0.533740997314453],\n [0.276895999908447, 0.532056987285614],\n [0.483370006084442, 0.499586999416351],\n [0.33721199631691, 0.282882988452911],\n [0.296391993761063, 0.293242990970612],\n [0.169294998049736, 0.193813979625702],\n [0.447580009698868, 0.302609980106354],\n [0.392390012741089, 0.353887975215912],\n [0.354490011930466, 0.696784019470215],\n [0.067304998636246, 0.730105042457581],\n [0.442739009857178, 0.572826027870178],\n [0.457098007202148, 0.584792017936707],\n [0.381974011659622, 0.694710969924927],\n [0.392388999462128, 0.694203019142151],\n [0.277076005935669, 0.271932005882263],\n [0.422551989555359, 0.563233017921448],\n [0.385919004678726, 0.281364023685455],\n [0.383103013038635, 0.255840003490448],\n [0.331431001424789, 0.119714021682739],\n [0.229923993349075, 0.232002973556519],\n [0.364500999450684, 0.189113974571228],\n [0.229622006416321, 0.299540996551514],\n [0.173287004232407, 0.278747975826263],\n [0.472878992557526, 0.666198015213013],\n [0.446828007698059, 0.668527007102966],\n [0.422762006521225, 0.673889994621277],\n [0.445307999849319, 0.580065965652466],\n [0.388103008270264, 0.693961024284363],\n [0.403039008378983, 0.706539988517761],\n [0.403629004955292, 0.693953037261963],\n [0.460041999816895, 0.557139039039612],\n [0.431158006191254, 0.692366003990173],\n [0.452181994915009, 0.692366003990173],\n [0.475387006998062, 0.692366003990173],\n [0.465828001499176, 0.779190003871918],\n [0.472328990697861, 0.736225962638855],\n [0.473087012767792, 0.717857003211975],\n [0.473122000694275, 0.704625964164734],\n [0.473033010959625, 0.695277988910675],\n [0.427942007780075, 0.695277988910675],\n [0.426479011774063, 0.703539967536926],\n [0.423162013292313, 0.711845993995667],\n [0.4183090031147, 0.720062971115112],\n [0.390094995498657, 0.639572978019714],\n [0.013953999616206, 0.560034036636353],\n [0.499913990497589, 0.58014702796936],\n [0.413199990987778, 0.69539999961853],\n [0.409626007080078, 0.701822996139526],\n [0.468080013990402, 0.601534962654114],\n [0.422728985548019, 0.585985004901886],\n [0.463079988956451, 0.593783974647522],\n [0.37211999297142, 0.47341400384903],\n [0.334562003612518, 0.496073007583618],\n [0.411671012639999, 0.546965003013611],\n [0.242175996303558, 0.14767599105835],\n [0.290776997804642, 0.201445996761322],\n [0.327338010072708, 0.256527006626129],\n [0.399509996175766, 0.748921036720276],\n [0.441727995872498, 0.261676013469696],\n [0.429764986038208, 0.187834024429321],\n [0.412198007106781, 0.108901023864746],\n [0.288955003023148, 0.398952007293701],\n [0.218936994671822, 0.435410976409912],\n [0.41278201341629, 0.398970007896423],\n [0.257135003805161, 0.355440020561218],\n [0.427684992551804, 0.437960982322693],\n [0.448339998722076, 0.536936044692993],\n [0.178560003638268, 0.45755398273468],\n [0.247308000922203, 0.457193970680237],\n [0.286267012357712, 0.467674970626831],\n [0.332827985286713, 0.460712015628815],\n [0.368755996227264, 0.447206974029541],\n [0.398963987827301, 0.432654976844788],\n [0.476410001516342, 0.405806005001068],\n [0.189241006970406, 0.523923993110657],\n [0.228962004184723, 0.348950982093811],\n [0.490725994110107, 0.562400996685028],\n [0.404670000076294, 0.485132992267609],\n [0.019469000399113, 0.401564002037048],\n [0.426243007183075, 0.420431017875671],\n [0.396993011236191, 0.548797011375427],\n [0.266469985246658, 0.376977026462555],\n [0.439121007919312, 0.51895797252655],\n [0.032313998788595, 0.644356966018677],\n [0.419054001569748, 0.387154996395111],\n [0.462783008813858, 0.505746960639954],\n [0.238978996872902, 0.779744982719421],\n [0.198220998048782, 0.831938028335571],\n [0.107550002634525, 0.540755033493042],\n [0.183610007166862, 0.740257024765015],\n [0.134409993886948, 0.333683013916016],\n [0.385764002799988, 0.883153975009918],\n [0.490967005491257, 0.579378008842468],\n [0.382384985685349, 0.508572995662689],\n [0.174399003386497, 0.397670984268188],\n [0.318785011768341, 0.39623498916626],\n [0.343364000320435, 0.400596976280212],\n [0.396100014448166, 0.710216999053955],\n [0.187885001301765, 0.588537991046906],\n [0.430987000465393, 0.944064974784851],\n [0.318993002176285, 0.898285031318665],\n [0.266247987747192, 0.869701027870178],\n [0.500023007392883, 0.190576016902924],\n [0.499976992607117, 0.954452991485596],\n [0.366169989109039, 0.398822009563446],\n [0.393207013607025, 0.39553701877594],\n [0.410373002290726, 0.391080021858215],\n [0.194993004202843, 0.342101991176605],\n [0.388664990663528, 0.362284004688263],\n [0.365961998701096, 0.355970978736877],\n [0.343364000320435, 0.355356991291046],\n [0.318785011768341, 0.35834002494812],\n [0.301414996385574, 0.363156020641327],\n [0.058132998645306, 0.319076001644135],\n [0.301414996385574, 0.387449026107788],\n [0.499987989664078, 0.618434011936188],\n [0.415838003158569, 0.624195992946625],\n [0.445681989192963, 0.566076993942261],\n [0.465844005346298, 0.620640993118286],\n [0.49992299079895, 0.351523995399475],\n [0.288718998432159, 0.819945991039276],\n [0.335278987884521, 0.852819979190826],\n [0.440512001514435, 0.902418971061707],\n [0.128294005990028, 0.791940987110138],\n [0.408771991729736, 0.373893976211548],\n [0.455606997013092, 0.451801002025604],\n [0.499877005815506, 0.908990025520325],\n [0.375436991453171, 0.924192011356354],\n [0.11421000212431, 0.615022003650665],\n [0.448662012815475, 0.695277988910675],\n [0.4480200111866, 0.704632043838501],\n [0.447111994028091, 0.715808033943176],\n [0.444831997156143, 0.730794012546539],\n [0.430011987686157, 0.766808986663818],\n [0.406787008047104, 0.685672998428345],\n [0.400738000869751, 0.681069016456604],\n [0.392399996519089, 0.677703022956848],\n [0.367855995893478, 0.663918972015381],\n [0.247923001646996, 0.601333022117615],\n [0.452769994735718, 0.420849978923798],\n [0.43639200925827, 0.359887003898621],\n [0.416164010763168, 0.368713974952698],\n [0.413385987281799, 0.692366003990173],\n [0.228018000721931, 0.683571994304657],\n [0.468268007040024, 0.352671027183533],\n [0.411361992359161, 0.804327011108398],\n [0.499989002943039, 0.469825029373169],\n [0.479153990745544, 0.442654013633728],\n [0.499974012374878, 0.439637005329132],\n [0.432112008333206, 0.493588984012604],\n [0.499886006116867, 0.866917014122009],\n [0.49991300702095, 0.821729004383087],\n [0.456548988819122, 0.819200992584229],\n [0.344549000263214, 0.745438992977142],\n [0.37890899181366, 0.574010014533997],\n [0.374292999505997, 0.780184984207153],\n [0.319687992334366, 0.570737957954407],\n [0.357154995203018, 0.604269981384277],\n [0.295284003019333, 0.621580958366394],\n [0.447750002145767, 0.862477004528046],\n [0.410986006259918, 0.508723020553589],\n [0.31395098567009, 0.775308012962341],\n [0.354128003120422, 0.812552988529205],\n [0.324548006057739, 0.703992962837219],\n [0.189096003770828, 0.646299958229065],\n [0.279776990413666, 0.71465802192688],\n [0.1338230073452, 0.682700991630554],\n [0.336768001317978, 0.644733011722565],\n [0.429883986711502, 0.466521978378296],\n [0.455527991056442, 0.548622965812683],\n [0.437114000320435, 0.558896005153656],\n [0.467287987470627, 0.529924988746643],\n [0.414712011814117, 0.335219979286194],\n [0.37704598903656, 0.322777986526489],\n [0.344107985496521, 0.320150971412659],\n [0.312875986099243, 0.32233202457428],\n [0.283526003360748, 0.333190023899078],\n [0.241245999932289, 0.382785975933075],\n [0.102986000478268, 0.468762993812561],\n [0.267612010240555, 0.424560010433197],\n [0.297879010438919, 0.433175981044769],\n [0.333433985710144, 0.433878004550934],\n [0.366427004337311, 0.426115989685059],\n [0.396012008190155, 0.416696012020111],\n [0.420121014118195, 0.41022801399231],\n [0.007561000064015, 0.480777025222778],\n [0.432949006557465, 0.569517970085144],\n [0.458638995885849, 0.479089021682739],\n [0.473466008901596, 0.545744001865387],\n [0.476087987422943, 0.563830018043518],\n [0.468472003936768, 0.555056989192963],\n [0.433990985155106, 0.582361996173859],\n [0.483518004417419, 0.562983989715576],\n [0.482482999563217, 0.57784903049469],\n [0.42645001411438, 0.389798998832703],\n [0.438998997211456, 0.39649498462677],\n [0.450067013502121, 0.400434017181396],\n [0.289712011814117, 0.368252992630005],\n [0.276670008897781, 0.363372981548309],\n [0.517862021923065, 0.471948027610779],\n [0.710287988185883, 0.380764007568359],\n [0.526226997375488, 0.573909997940063],\n [0.895093023777008, 0.254140973091125],\n [0.634069979190826, 0.409575998783112],\n [0.661242008209229, 0.41302502155304],\n [0.688880026340485, 0.409460008144379],\n [0.725341975688934, 0.389131009578705],\n [0.606630027294159, 0.40370500087738],\n [0.654766023159027, 0.344011008739471],\n [0.629905998706818, 0.346076011657715],\n [0.680678009986877, 0.347265005111694],\n [0.702096998691559, 0.353591024875641],\n [0.75221198797226, 0.410804986953735],\n [0.602918028831482, 0.842862963676453],\n [0.719901978969574, 0.375599980354309],\n [0.893692970275879, 0.399959981441498],\n [0.790081977844238, 0.391354024410248],\n [0.643998026847839, 0.534487962722778],\n [0.528249025344849, 0.65040397644043],\n [0.525849997997284, 0.680191040039062],\n [0.560214996337891, 0.657229006290436],\n [0.585384011268616, 0.66654098033905],\n [0.549625992774963, 0.680860996246338],\n [0.57122802734375, 0.682691991329193],\n [0.624852001667023, 0.72809898853302],\n [0.513050019741058, 0.547281980514526],\n [0.51509702205658, 0.527251958847046],\n [0.742246985435486, 0.314507007598877],\n [0.598631024360657, 0.454979002475739],\n [0.570338010787964, 0.548575043678284],\n [0.578631997108459, 0.533622980117798],\n [0.723087012767792, 0.532054007053375],\n [0.516445994377136, 0.499638974666595],\n [0.662801027297974, 0.282917976379395],\n [0.70362401008606, 0.293271005153656],\n [0.830704987049103, 0.193813979625702],\n [0.552385985851288, 0.302568018436432],\n [0.607609987258911, 0.353887975215912],\n [0.645429015159607, 0.696707010269165],\n [0.932694971561432, 0.730105042457581],\n [0.557260990142822, 0.572826027870178],\n [0.542901992797852, 0.584792017936707],\n [0.6180260181427, 0.694710969924927],\n [0.607590973377228, 0.694203019142151],\n [0.722943007946014, 0.271963000297546],\n [0.577413976192474, 0.563166975975037],\n [0.614082992076874, 0.281386971473694],\n [0.616907000541687, 0.255886018276215],\n [0.668509006500244, 0.119913995265961],\n [0.770092010498047, 0.232020974159241],\n [0.635536015033722, 0.189248979091644],\n [0.77039098739624, 0.299556016921997],\n [0.826722025871277, 0.278755009174347],\n [0.527121007442474, 0.666198015213013],\n [0.553171992301941, 0.668527007102966],\n [0.577238023281097, 0.673889994621277],\n [0.554691970348358, 0.580065965652466],\n [0.611896991729736, 0.693961024284363],\n [0.59696102142334, 0.706539988517761],\n [0.596370995044708, 0.693953037261963],\n [0.539958000183105, 0.557139039039612],\n [0.568841993808746, 0.692366003990173],\n [0.547818005084991, 0.692366003990173],\n [0.52461302280426, 0.692366003990173],\n [0.534089982509613, 0.779141008853912],\n [0.527670979499817, 0.736225962638855],\n [0.526912987232208, 0.717857003211975],\n [0.526877999305725, 0.704625964164734],\n [0.526966989040375, 0.695277988910675],\n [0.572058022022247, 0.695277988910675],\n [0.573521018028259, 0.703539967536926],\n [0.57683801651001, 0.711845993995667],\n [0.581691026687622, 0.720062971115112],\n [0.609944999217987, 0.639909982681274],\n [0.986046016216278, 0.560034036636353],\n [0.5867999792099, 0.69539999961853],\n [0.590372025966644, 0.701822996139526],\n [0.531915009021759, 0.601536989212036],\n [0.577268004417419, 0.585934996604919],\n [0.536915004253387, 0.593786001205444],\n [0.627542972564697, 0.473352015018463],\n [0.665585994720459, 0.495950996875763],\n [0.588353991508484, 0.546862006187439],\n [0.757824003696442, 0.14767599105835],\n [0.709249973297119, 0.201507985591888],\n [0.672684013843536, 0.256581008434296],\n [0.600408971309662, 0.74900496006012],\n [0.55826598405838, 0.261672019958496],\n [0.570303976535797, 0.187870979309082],\n [0.588165998458862, 0.109044015407562],\n [0.711045026779175, 0.398952007293701],\n [0.781069993972778, 0.435405015945435],\n [0.587247014045715, 0.398931980133057],\n [0.742869973182678, 0.355445981025696],\n [0.572156012058258, 0.437651991844177],\n [0.55186802148819, 0.536570012569427],\n [0.821442008018494, 0.457556009292603],\n [0.752701997756958, 0.457181990146637],\n [0.71375697851181, 0.467626988887787],\n [0.66711300611496, 0.460672974586487],\n [0.631101012229919, 0.447153985500336],\n [0.6008620262146, 0.432473003864288],\n [0.523481011390686, 0.405627012252808],\n [0.810747981071472, 0.523926019668579],\n [0.771045982837677, 0.348959028720856],\n [0.509127020835876, 0.562718033790588],\n [0.595292985439301, 0.485023975372314],\n [0.980530977249146, 0.401564002037048],\n [0.573499977588654, 0.420000016689301],\n [0.602994978427887, 0.548687994480133],\n [0.733529984951019, 0.376977026462555],\n [0.560611009597778, 0.519016981124878],\n [0.967685997486115, 0.644356966018677],\n [0.580985009670258, 0.387160003185272],\n [0.537728011608124, 0.505385041236877],\n [0.760966002941132, 0.779752969741821],\n [0.801778972148895, 0.831938028335571],\n [0.892440974712372, 0.54076099395752],\n [0.816350996494293, 0.740260004997253],\n [0.865594983100891, 0.333687007427216],\n [0.614073991775513, 0.883246004581451],\n [0.508952975273132, 0.579437971115112],\n [0.617941975593567, 0.508316040039062],\n [0.825608015060425, 0.397674977779388],\n [0.681214988231659, 0.39623498916626],\n [0.656635999679565, 0.400596976280212],\n [0.603900015354156, 0.710216999053955],\n [0.81208598613739, 0.588539004325867],\n [0.56801301240921, 0.944564998149872],\n [0.681007981300354, 0.898285031318665],\n [0.733752012252808, 0.869701027870178],\n [0.633830010890961, 0.398822009563446],\n [0.606792986392975, 0.39553701877594],\n [0.589659988880157, 0.391062021255493],\n [0.805015981197357, 0.342108011245728],\n [0.611334979534149, 0.362284004688263],\n [0.634037971496582, 0.355970978736877],\n [0.656635999679565, 0.355356991291046],\n [0.681214988231659, 0.35834002494812],\n [0.698584973812103, 0.363156020641327],\n [0.941866993904114, 0.319076001644135],\n [0.698584973812103, 0.387449026107788],\n [0.584177017211914, 0.624107003211975],\n [0.554318010807037, 0.566076993942261],\n [0.534153997898102, 0.62064003944397],\n [0.711217999458313, 0.819975018501282],\n [0.664629995822906, 0.852871000766754],\n [0.559099972248077, 0.902631998062134],\n [0.871706008911133, 0.791940987110138],\n [0.591234028339386, 0.373893976211548],\n [0.544341027736664, 0.451583981513977],\n [0.624562978744507, 0.924192011356354],\n [0.88577002286911, 0.615028977394104],\n [0.551338016986847, 0.695277988910675],\n [0.551980018615723, 0.704632043838501],\n [0.552887976169586, 0.715808033943176],\n [0.555167973041534, 0.730794012546539],\n [0.569944024085999, 0.767035007476807],\n [0.593203008174896, 0.685675978660583],\n [0.599261999130249, 0.681069016456604],\n [0.607599973678589, 0.677703022956848],\n [0.631937980651855, 0.663500010967255],\n [0.752032995223999, 0.601315021514893],\n [0.547226011753082, 0.420395016670227],\n [0.563543975353241, 0.359827995300293],\n [0.583841025829315, 0.368713974952698],\n [0.586614012718201, 0.692366003990173],\n [0.771915018558502, 0.683578014373779],\n [0.531597018241882, 0.352482974529266],\n [0.588370978832245, 0.804440975189209],\n [0.52079701423645, 0.442565023899078],\n [0.567984998226166, 0.493479013442993],\n [0.543282985687256, 0.819254994392395],\n [0.655317008495331, 0.745514988899231],\n [0.621008992195129, 0.574018001556396],\n [0.625559985637665, 0.78031200170517],\n [0.680198013782501, 0.570719003677368],\n [0.64276397228241, 0.604337990283966],\n [0.704662978649139, 0.621529996395111],\n [0.552012026309967, 0.862591981887817],\n [0.589071989059448, 0.508637011051178],\n [0.685944974422455, 0.775357007980347],\n [0.645735025405884, 0.812640011310577],\n [0.675342977046967, 0.703978002071381],\n [0.810858011245728, 0.646304965019226],\n [0.72012197971344, 0.714666962623596],\n [0.866151988506317, 0.682704985141754],\n [0.663187026977539, 0.644596993923187],\n [0.570082008838654, 0.466325998306274],\n [0.544561982154846, 0.548375964164734],\n [0.562758982181549, 0.558784961700439],\n [0.531987011432648, 0.530140042304993],\n [0.585271000862122, 0.335177004337311],\n [0.622952997684479, 0.32277899980545],\n [0.655896008014679, 0.320163011550903],\n [0.687132000923157, 0.322345972061157],\n [0.716481983661652, 0.333200991153717],\n [0.758756995201111, 0.382786989212036],\n [0.897013008594513, 0.468769013881683],\n [0.732392013072968, 0.424547016620636],\n [0.70211398601532, 0.433162987232208],\n [0.66652500629425, 0.433866024017334],\n [0.633504986763, 0.426087975502014],\n [0.603875994682312, 0.416586995124817],\n [0.579657971858978, 0.409945011138916],\n [0.992439985275269, 0.480777025222778],\n [0.567192018032074, 0.569419980049133],\n [0.54136598110199, 0.478899002075195],\n [0.526564002037048, 0.546118021011353],\n [0.523913025856018, 0.563830018043518],\n [0.531529009342194, 0.555056989192963],\n [0.566035985946655, 0.582329034805298],\n [0.51631098985672, 0.563053965568542],\n [0.5174720287323, 0.577877044677734],\n [0.573594987392426, 0.389806985855103],\n [0.560697972774506, 0.395331978797913],\n [0.549755990505219, 0.399751007556915],\n [0.710287988185883, 0.368252992630005],\n [0.723330020904541, 0.363372981548309],\n];\n\nexport const TRI468 = [\n 127, 34, 139, 11, 0, 37, 232, 231, 120, 72, 37, 39, 128, 121, 47, 232, 121, 128, 104, 69, 67, 175, 171, 148, 157, 154, 155, 118, 50, 101, 73, 39, 40, 9,\n 151, 108, 48, 115, 131, 194, 204, 211, 74, 40, 185, 80, 42, 183, 40, 92, 186, 230, 229, 118, 202, 212, 214, 83, 18, 17, 76, 61, 146, 160, 29, 30, 56,\n 157, 173, 106, 204, 194, 135, 214, 192, 203, 165, 98, 21, 71, 68, 51, 45, 4, 144, 24, 23, 77, 146, 91, 205, 50, 187, 201, 200, 18, 91, 106, 182, 90, 91,\n 181, 85, 84, 17, 206, 203, 36, 148, 171, 140, 92, 40, 39, 193, 189, 244, 159, 158, 28, 247, 246, 161, 236, 3, 196, 54, 68, 104, 193, 168, 8, 117,\n 228, 31, 189, 193, 55, 98, 97, 99, 126, 47, 100, 166, 79, 218, 155, 154, 26, 209, 49, 131, 135, 136, 150, 47, 126, 217, 223, 52, 53, 45, 51, 134, 211,\n 170, 140, 67, 69, 108, 43, 106, 91, 230, 119, 120, 226, 130, 247, 63, 53, 52, 238, 20, 242, 46, 70, 156, 78, 62, 96, 46, 53, 63, 143, 34, 227, 173,\n 155, 133, 123, 117, 111, 44, 125, 19, 236, 134, 51, 216, 206, 205, 154, 153, 22, 39, 37, 167, 200, 201, 208, 36, 142, 100, 57, 212, 202, 20, 60, 99, 28,\n 158, 157, 35, 226, 113, 160, 159, 27, 204, 202, 210, 113, 225, 46, 43, 202, 204, 62, 76, 77, 137, 123, 116, 41, 38, 72, 203, 129, 142, 64, 98, 240, 49,\n 102, 64, 41, 73, 74, 212, 216, 207, 42, 74, 184, 169, 170, 211, 170, 149, 176, 105, 66, 69, 122, 6, 168, 123, 147, 187, 96, 77, 90, 65, 55, 107, 89,\n 90, 180, 101, 100, 120, 63, 105, 104, 93, 137, 227, 15, 86, 85, 129, 102, 49, 14, 87, 86, 55, 8, 9, 100, 47, 121, 145, 23, 22, 88, 89, 179, 6, 122,\n 196, 88, 95, 96, 138, 172, 136, 215, 58, 172, 115, 48, 219, 42, 80, 81, 195, 3, 51, 43, 146, 61, 171, 175, 199, 81, 82, 38, 53, 46, 225, 144, 163, 110,\n 246, 33, 7, 52, 65, 66, 229, 228, 117, 34, 127, 234, 107, 108, 69, 109, 108, 151, 48, 64, 235, 62, 78, 191, 129, 209, 126, 111, 35, 143, 163, 161, 246,\n 117, 123, 50, 222, 65, 52, 19, 125, 141, 221, 55, 65, 3, 195, 197, 25, 7, 33, 220, 237, 44, 70, 71, 139, 122, 193, 245, 247, 130, 33, 71, 21, 162,\n 153, 158, 159, 170, 169, 150, 188, 174, 196, 216, 186, 92, 144, 160, 161, 2, 97, 167, 141, 125, 241, 164, 167, 37, 72, 38, 12, 145, 159, 160, 38, 82, 13,\n 63, 68, 71, 226, 35, 111, 158, 153, 154, 101, 50, 205, 206, 92, 165, 209, 198, 217, 165, 167, 97, 220, 115, 218, 133, 112, 243, 239, 238, 241, 214,\n 135, 169, 190, 173, 133, 171, 208, 32, 125, 44, 237, 86, 87, 178, 85, 86, 179, 84, 85, 180, 83, 84, 181, 201, 83, 182, 137, 93, 132, 76, 62, 183, 61,\n 76, 184, 57, 61, 185, 212, 57, 186, 214, 207, 187, 34, 143, 156, 79, 239, 237, 123, 137, 177, 44, 1, 4, 201, 194, 32, 64, 102, 129, 213, 215, 138, 59,\n 166, 219, 242, 99, 97, 2, 94, 141, 75, 59, 235, 24, 110, 228, 25, 130, 226, 23, 24, 229, 22, 23, 230, 26, 22, 231, 112, 26, 232, 189, 190, 243, 221, 56,\n 190, 28, 56, 221, 27, 28, 222, 29, 27, 223, 30, 29, 224, 247, 30, 225, 238, 79, 20, 166, 59, 75, 60, 75, 240, 147, 177, 215, 20, 79, 166, 187, 147, 213,\n 112, 233, 244, 233, 128, 245, 128, 114, 188, 114, 217, 174, 131, 115, 220, 217, 198, 236, 198, 131, 134, 177, 132, 58, 143, 35, 124, 110, 163, 7, 228,\n 110, 25, 356, 389, 368, 11, 302, 267, 452, 350, 349, 302, 303, 269, 357, 343, 277, 452, 453, 357, 333, 332, 297, 175, 152, 377, 384, 398, 382, 347,\n 348, 330, 303, 304, 270, 9, 336, 337, 278, 279, 360, 418, 262, 431, 304, 408, 409, 310, 415, 407, 270, 409, 410, 450, 348, 347, 422, 430, 434, 313,\n 314, 17, 306, 307, 375, 387, 388, 260, 286, 414, 398, 335, 406, 418, 364, 367, 416, 423, 358, 327, 251, 284, 298, 281, 5, 4, 373, 374, 253, 307, 320,\n 321, 425, 427, 411, 421, 313, 18, 321, 405, 406, 320, 404, 405, 315, 16, 17, 426, 425, 266, 377, 400, 369, 322, 391, 269, 417, 465, 464, 386, 257, 258,\n 466, 260, 388, 456, 399, 419, 284, 332, 333, 417, 285, 8, 346, 340, 261, 413, 441, 285, 327, 460, 328, 355, 371, 329, 392, 439, 438, 382, 341, 256,\n 429, 420, 360, 364, 394, 379, 277, 343, 437, 443, 444, 283, 275, 440, 363, 431, 262, 369, 297, 338, 337, 273, 375, 321, 450, 451, 349, 446, 342, 467,\n 293, 334, 282, 458, 461, 462, 276, 353, 383, 308, 324, 325, 276, 300, 293, 372, 345, 447, 382, 398, 362, 352, 345, 340, 274, 1, 19, 456, 248, 281, 436,\n 427, 425, 381, 256, 252, 269, 391, 393, 200, 199, 428, 266, 330, 329, 287, 273, 422, 250, 462, 328, 258, 286, 384, 265, 353, 342, 387, 259, 257, 424,\n 431, 430, 342, 353, 276, 273, 335, 424, 292, 325, 307, 366, 447, 345, 271, 303, 302, 423, 266, 371, 294, 455, 460, 279, 278, 294, 271, 272, 304, 432,\n 434, 427, 272, 407, 408, 394, 430, 431, 395, 369, 400, 334, 333, 299, 351, 417, 168, 352, 280, 411, 325, 319, 320, 295, 296, 336, 319, 403, 404, 330,\n 348, 349, 293, 298, 333, 323, 454, 447, 15, 16, 315, 358, 429, 279, 14, 15, 316, 285, 336, 9, 329, 349, 350, 374, 380, 252, 318, 402, 403, 6, 197, 419,\n 318, 319, 325, 367, 364, 365, 435, 367, 397, 344, 438, 439, 272, 271, 311, 195, 5, 281, 273, 287, 291, 396, 428, 199, 311, 271, 268, 283, 444, 445,\n 373, 254, 339, 263, 466, 249, 282, 334, 296, 449, 347, 346, 264, 447, 454, 336, 296, 299, 338, 10, 151, 278, 439, 455, 292, 407, 415, 358, 371, 355,\n 340, 345, 372, 390, 249, 466, 346, 347, 280, 442, 443, 282, 19, 94, 370, 441, 442, 295, 248, 419, 197, 263, 255, 359, 440, 275, 274, 300, 383, 368,\n 351, 412, 465, 263, 467, 466, 301, 368, 389, 380, 374, 386, 395, 378, 379, 412, 351, 419, 436, 426, 322, 373, 390, 388, 2, 164, 393, 370, 462, 461,\n 164, 0, 267, 302, 11, 12, 374, 373, 387, 268, 12, 13, 293, 300, 301, 446, 261, 340, 385, 384, 381, 330, 266, 425, 426, 423, 391, 429, 355, 437, 391,\n 327, 326, 440, 457, 438, 341, 382, 362, 459, 457, 461, 434, 430, 394, 414, 463, 362, 396, 369, 262, 354, 461, 457, 316, 403, 402, 315, 404, 403, 314,\n 405, 404, 313, 406, 405, 421, 418, 406, 366, 401, 361, 306, 408, 407, 291, 409, 408, 287, 410, 409, 432, 436, 410, 434, 416, 411, 264, 368, 383, 309,\n 438, 457, 352, 376, 401, 274, 275, 4, 421, 428, 262, 294, 327, 358, 433, 416, 367, 289, 455, 439, 462, 370, 326, 2, 326, 370, 305, 460, 455, 254,\n 449, 448, 255, 261, 446, 253, 450, 449, 252, 451, 450, 256, 452, 451, 341, 453, 452, 413, 464, 463, 441, 413, 414, 258, 442, 441, 257, 443, 442, 259,\n 444, 443, 260, 445, 444, 467, 342, 445, 459, 458, 250, 289, 392, 290, 290, 328, 460, 376, 433, 435, 250, 290, 392, 411, 416, 433, 341, 463, 464, 453,\n 464, 465, 357, 465, 412, 343, 412, 399, 360, 363, 440, 437, 399, 456, 420, 456, 363, 401, 435, 288, 372, 383, 353, 339, 255, 249, 448, 261, 255, 133,\n 243, 190, 133, 155, 112, 33, 246, 247, 33, 130, 25, 398, 384, 286, 362, 398, 414, 362, 463, 341, 263, 359, 467, 263, 249, 255, 466, 467, 260, 75, 60,\n 166, 238, 239, 79, 162, 127, 139, 72, 11, 37, 121, 232, 120, 73, 72, 39, 114, 128, 47, 233, 232, 128, 103, 104, 67, 152, 175, 148, 173, 157, 155,\n 119, 118, 101, 74, 73, 40, 107, 9, 108, 49, 48, 131, 32, 194, 211, 184, 74, 185, 191, 80, 183, 185, 40, 186, 119, 230, 118, 210, 202, 214, 84, 83, 17,\n 77, 76, 146, 161, 160, 30, 190, 56, 173, 182, 106, 194, 138, 135, 192, 129, 203, 98, 54, 21, 68, 5, 51, 4, 145, 144, 23, 90, 77, 91, 207, 205, 187, 83,\n 201, 18, 181, 91, 182, 180, 90, 181, 16, 85, 17, 205, 206, 36, 176, 148, 140, 165, 92, 39, 245, 193, 244, 27, 159, 28, 30, 247, 161, 174, 236, 196,\n 103, 54, 104, 55, 193, 8, 111, 117, 31, 221, 189, 55, 240, 98, 99, 142, 126, 100, 219, 166, 218, 112, 155, 26, 198, 209, 131, 169, 135, 150, 114, 47,\n 217, 224, 223, 53, 220, 45, 134, 32, 211, 140, 109, 67, 108, 146, 43, 91, 231, 230, 120, 113, 226, 247, 105, 63, 52, 241, 238, 242, 124, 46, 156, 95,\n 78, 96, 70, 46, 63, 116, 143, 227, 116, 123, 111, 1, 44, 19, 3, 236, 51, 207, 216, 205, 26, 154, 22, 165, 39, 167, 199, 200, 208, 101, 36, 100, 43,\n 57, 202, 242, 20, 99, 56, 28, 157, 124, 35, 113, 29, 160, 27, 211, 204, 210, 124, 113, 46, 106, 43, 204, 96, 62, 77, 227, 137, 116, 73, 41, 72, 36, 203,\n 142, 235, 64, 240, 48, 49, 64, 42, 41, 74, 214, 212, 207, 183, 42, 184, 210, 169, 211, 140, 170, 176, 104, 105, 69, 193, 122, 168, 50, 123, 187, 89, 96,\n 90, 66, 65, 107, 179, 89, 180, 119, 101, 120, 68, 63, 104, 234, 93, 227, 16, 15, 85, 209, 129, 49, 15, 14, 86, 107, 55, 9, 120, 100, 121, 153, 145, 22,\n 178, 88, 179, 197, 6, 196, 89, 88, 96, 135, 138, 136, 138, 215, 172, 218, 115, 219, 41, 42, 81, 5, 195, 51, 57, 43, 61, 208, 171, 199, 41, 81, 38,\n 224, 53, 225, 24, 144, 110, 105, 52, 66, 118, 229, 117, 227, 34, 234, 66, 107, 69, 10, 109, 151, 219, 48, 235, 183, 62, 191, 142, 129, 126, 116, 111,\n 143, 7, 163, 246, 118, 117, 50, 223, 222, 52, 94, 19, 141, 222, 221, 65, 196, 3, 197, 45, 220, 44, 156, 70, 139, 188, 122, 245, 139, 71, 162, 145,\n 153, 159, 149, 170, 150, 122, 188, 196, 206, 216, 92, 163, 144, 161, 164, 2, 167, 242, 141, 241, 0, 164, 37, 11, 72, 12, 144, 145, 160, 12, 38, 13, 70,\n 63, 71, 31, 226, 111, 157, 158, 154, 36, 101, 205, 203, 206, 165, 126, 209, 217, 98, 165, 97, 237, 220, 218, 237, 239, 241, 210, 214, 169, 140, 171, 32,\n 241, 125, 237, 179, 86, 178, 180, 85, 179, 181, 84, 180, 182, 83, 181, 194, 201, 182, 177, 137, 132, 184, 76, 183, 185, 61, 184, 186, 57, 185, 216, 212,\n 186, 192, 214, 187, 139, 34, 156, 218, 79, 237, 147, 123, 177, 45, 44, 4, 208, 201, 32, 98, 64, 129, 192, 213, 138, 235, 59, 219, 141, 242, 97, 97, 2,\n 141, 240, 75, 235, 229, 24, 228, 31, 25, 226, 230, 23, 229, 231, 22, 230, 232, 26, 231, 233, 112, 232, 244, 189, 243, 189, 221, 190, 222, 28, 221,\n 223, 27, 222, 224, 29, 223, 225, 30, 224, 113, 247, 225, 99, 60, 240, 213, 147, 215, 60, 20, 166, 192, 187, 213, 243, 112, 244, 244, 233, 245, 245,\n 128, 188, 188, 114, 174, 134, 131, 220, 174, 217, 236, 236, 198, 134, 215, 177, 58, 156, 143, 124, 25, 110, 7, 31, 228, 25, 264, 356, 368, 0, 11, 267,\n 451, 452, 349, 267, 302, 269, 350, 357, 277, 350, 452, 357, 299, 333, 297, 396, 175, 377, 381, 384, 382, 280, 347, 330, 269, 303, 270, 151, 9, 337,\n 344, 278, 360, 424, 418, 431, 270, 304, 409, 272, 310, 407, 322, 270, 410, 449, 450, 347, 432, 422, 434, 18, 313, 17, 291, 306, 375, 259, 387, 260,\n 424, 335, 418, 434, 364, 416, 391, 423, 327, 301, 251, 298, 275, 281, 4, 254, 373, 253, 375, 307, 321, 280, 425, 411, 200, 421, 18, 335, 321, 406,\n 321, 320, 405, 314, 315, 17, 423, 426, 266, 396, 377, 369, 270, 322, 269, 413, 417, 464, 385, 386, 258, 248, 456, 419, 298, 284, 333, 168, 417, 8,\n 448, 346, 261, 417, 413, 285, 326, 327, 328, 277, 355, 329, 309, 392, 438, 381, 382, 256, 279, 429, 360, 365, 364, 379, 355, 277, 437, 282, 443, 283,\n 281, 275, 363, 395, 431, 369, 299, 297, 337, 335, 273, 321, 348, 450, 349, 359, 446, 467, 283, 293, 282, 250, 458, 462, 300, 276, 383, 292, 308, 325,\n 283, 276, 293, 264, 372, 447, 346, 352, 340, 354, 274, 19, 363, 456, 281, 426, 436, 425, 380, 381, 252, 267, 269, 393, 421, 200, 428, 371, 266, 329,\n 432, 287, 422, 290, 250, 328, 385, 258, 384, 446, 265, 342, 386, 387, 257, 422, 424, 430, 445, 342, 276, 422, 273, 424, 306, 292, 307, 352, 366, 345,\n 268, 271, 302, 358, 423, 371, 327, 294, 460, 331, 279, 294, 303, 271, 304, 436, 432, 427, 304, 272, 408, 395, 394, 431, 378, 395, 400, 296, 334, 299,\n 6, 351, 168, 376, 352, 411, 307, 325, 320, 285, 295, 336, 320, 319, 404, 329, 330, 349, 334, 293, 333, 366, 323, 447, 316, 15, 315, 331, 358, 279,\n 317, 14, 316, 8, 285, 9, 277, 329, 350, 253, 374, 252, 319, 318, 403, 351, 6, 419, 324, 318, 325, 397, 367, 365, 288, 435, 397, 278, 344, 439, 310,\n 272, 311, 248, 195, 281, 375, 273, 291, 175, 396, 199, 312, 311, 268, 276, 283, 445, 390, 373, 339, 295, 282, 296, 448, 449, 346, 356, 264, 454, 337,\n 336, 299, 337, 338, 151, 294, 278, 455, 308, 292, 415, 429, 358, 355, 265, 340, 372, 388, 390, 466, 352, 346, 280, 295, 442, 282, 354, 19, 370, 285,\n 441, 295, 195, 248, 197, 457, 440, 274, 301, 300, 368, 417, 351, 465, 251, 301, 389, 385, 380, 386, 394, 395, 379, 399, 412, 419, 410, 436, 322, 387,\n 373, 388, 326, 2, 393, 354, 370, 461, 393, 164, 267, 268, 302, 12, 386, 374, 387, 312, 268, 13, 298, 293, 301, 265, 446, 340, 380, 385, 381, 280, 330,\n 425, 322, 426, 391, 420, 429, 437, 393, 391, 326, 344, 440, 438, 458, 459, 461, 364, 434, 394, 428, 396, 262, 274, 354, 457, 317, 316, 402, 316, 315,\n 403, 315, 314, 404, 314, 313, 405, 313, 421, 406, 323, 366, 361, 292, 306, 407, 306, 291, 408, 291, 287, 409, 287, 432, 410, 427, 434, 411, 372, 264,\n 383, 459, 309, 457, 366, 352, 401, 1, 274, 4, 418, 421, 262, 331, 294, 358, 435, 433, 367, 392, 289, 439, 328, 462, 326, 94, 2, 370, 289, 305, 455, 339,\n 254, 448, 359, 255, 446, 254, 253, 449, 253, 252, 450, 252, 256, 451, 256, 341, 452, 414, 413, 463, 286, 441, 414, 286, 258, 441, 258, 257, 442, 257,\n 259, 443, 259, 260, 444, 260, 467, 445, 309, 459, 250, 305, 289, 290, 305, 290, 460, 401, 376, 435, 309, 250, 392, 376, 411, 433, 453, 341, 464, 357,\n 453, 465, 343, 357, 412, 437, 343, 399, 344, 360, 440, 420, 437, 456, 360, 420, 363, 361, 401, 288, 265, 372, 353, 390, 339, 249, 339, 448, 255];\n\nexport const TRI68 = [0, 1, 36, 0, 36, 17, 1, 2, 41, 1, 41, 36, 2, 3, 31, 2, 31, 41, 3, 4, 48, 3, 48, 31, 4, 5, 48, 5, 6, 48, 6, 7, 59, 6, 59, 48, 7, 8, 58, 7, 58, 59,\n 8, 9, 56, 8, 56, 57, 8, 57, 58, 9, 10, 55, 9, 55, 56, 10, 11, 54, 10, 54, 55, 11, 12, 54, 12, 13, 54, 13, 14, 35, 13, 35, 54, 14, 15, 46, 14, 46, 35, 15, 16,\n 45, 15, 45, 46, 16, 26, 45, 17, 36, 18, 18, 37, 19, 18, 36, 37, 19, 38, 20, 19, 37, 38, 20, 39, 21, 20, 38, 39, 21, 39, 27, 22, 42, 23, 22, 27, 42, 23, 43, 24,\n 23, 42, 43, 24, 44, 25, 24, 43, 44, 25, 45, 26, 25, 44, 45, 27, 39, 28, 27, 28, 42, 28, 39, 29, 28, 29, 42, 29, 31, 30, 29, 30, 35, 29, 40, 31, 29, 35, 47, 29,\n 39, 40, 29, 47, 42, 30, 31, 32, 30, 32, 33, 30, 33, 34, 30, 34, 35, 31, 50, 32, 31, 40, 41, 31, 48, 49, 31, 49, 50, 32, 51, 33, 32, 50, 51, 33, 51, 34, 34, 52,\n 35, 34, 51, 52, 35, 46, 47, 35, 52, 53, 35, 53, 54, 36, 41, 37, 37, 40, 38, 37, 41, 40, 38, 40, 39, 42, 47, 43, 43, 47, 44, 44, 46, 45, 44, 47, 46, 48, 60, 49,\n 48, 59, 60, 49, 61, 50, 49, 60, 61, 50, 62, 51, 50, 61, 62, 51, 62, 52, 52, 63, 53, 52, 62, 63, 53, 64, 54, 53, 63, 64, 54, 64, 55, 55, 65, 56, 55, 64, 65, 56,\n 66, 57, 56, 65, 66, 57, 66, 58, 58, 67, 59, 58, 66, 67, 59, 67, 60, 60, 67, 61, 61, 66, 62, 61, 67, 66, 62, 66, 63, 63, 65, 64, 63, 66, 65, 21, 27, 22];\n\nexport const TRI33 = [\n /* eyes */ 0, 8, 7, 7, 8, 1, 2, 10, 9, 9, 10, 3,\n /* brows */ 17, 0, 18, 18, 0, 7, 18, 7, 19, 19, 7, 1, 19, 1, 11, 19, 11, 20, 21, 3, 22, 21, 9, 3, 20, 9, 21, 20, 2, 9, 20, 11, 2,\n /* 4head */ 23, 17, 18, 25, 21, 22, 24, 19, 20, 24, 18, 19, 24, 20, 21, 24, 23, 18, 24, 21, 25,\n /* nose */ 11, 12, 4, 11, 4, 13, 1, 12, 11, 11, 13, 2, 12, 14, 4, 4, 14, 13,\n /* up-lip */ 14, 5, 15, 14, 15, 6, 12, 5, 14, 14, 6, 13,\n /* cheeks */ 8, 12, 1, 2, 13, 10, 8, 26, 12, 10, 13, 27, 26, 5, 12, 13, 6, 27, 0, 26, 8, 10, 27, 3,\n /* chin */ 5, 32, 16, 16, 32, 6, 5, 30, 32, 6, 32, 31,\n /* cont */ 26, 30, 5, 27, 6, 31, 0, 28, 26, 3, 27, 29, 17, 28, 0, 3, 29, 22, 23, 28, 17, 22, 29, 25, 28, 30, 26, 27, 31, 29,\n];\n\nexport const TRI7 = [0, 4, 1, 2, 4, 3, 4, 5, 6];\n\nexport const VTX68 = [\n /* cont */ 127, 234, 132, 58, 172, 150, 149, 148, 152, 377, 378, 379, 397, 288, 361, 454, 356,\n /* brows */ 70, 63, 105, 66, 107, 336, 296, 334, 293, 300,\n /* nose */ 168, 6, 195, 4, 98, 97, 2, 326, 327,\n /* eyes */ 33, 160, 158, 133, 153, 144, 362, 385, 387, 263, 373, 380,\n /* lip */ 57, 40, 37, 0, 267, 270, 287, 321, 314, 17, 84, 91,\n /* mouth */ 78, 81, 13, 311, 308, 402, 14, 178,\n];\n\nexport const VTX33 = [33, 133, 362, 263, 1, 62, 308, 159, 145, 386, 374, 6, 102, 331, 2, 13, 14, 70, 105, 107, 336, 334, 300, 54, 10, 284, 50, 280, 234, 454, 58, 288, 152];\n\nexport const VTX7 = [33, 133, 362, 263, 1, 78, 308];\n\nexport const UV68 = VTX68.map((x) => UV468[x]);\n\nexport const UV33 = VTX33.map((x) => UV468[x]);\n\nexport const UV7 = VTX7.map((x) => UV468[x]);\n", "import * as tf from '../../dist/tfjs.esm.js';\nimport * as bounding from './box';\nimport * as util from './util';\nimport * as coords from './coords';\nimport { Tensor, GraphModel } from '../tfjs/types';\nimport { BlazeFaceModel } from './blazeface';\n\nconst leftOutline = coords.MESH_ANNOTATIONS['leftEyeLower0'];\nconst rightOutline = coords.MESH_ANNOTATIONS['rightEyeLower0'];\n\nconst eyeLandmarks = {\n leftBounds: [leftOutline[0], leftOutline[leftOutline.length - 1]],\n rightBounds: [rightOutline[0], rightOutline[rightOutline.length - 1]],\n};\n\nconst meshLandmarks = {\n count: 468,\n mouth: 13,\n symmetryLine: [13, coords.MESH_ANNOTATIONS['midwayBetweenEyes'][0]],\n};\n\nconst blazeFaceLandmarks = {\n leftEye: 0,\n rightEye: 1,\n nose: 2,\n mouth: 3,\n leftEar: 4,\n rightEar: 5,\n symmetryLine: [3, 2],\n};\n\nconst irisLandmarks = {\n upperCenter: 3,\n lowerCenter: 4,\n index: 71,\n numCoordinates: 76,\n};\n\n// Replace the raw coordinates returned by facemesh with refined iris model coordinates\n// Update the z coordinate to be an average of the original and the new.\nfunction replaceRawCoordinates(rawCoords, newCoords, prefix, keys) {\n for (let i = 0; i < coords.MESH_TO_IRIS_INDICES_MAP.length; i++) {\n const { key, indices } = coords.MESH_TO_IRIS_INDICES_MAP[i];\n const originalIndices = coords.MESH_ANNOTATIONS[`${prefix}${key}`];\n if (!keys || keys.includes(key)) {\n for (let j = 0; j < indices.length; j++) {\n const index = indices[j];\n rawCoords[originalIndices[j]] = [\n newCoords[index][0], newCoords[index][1],\n (newCoords[index][2] + rawCoords[originalIndices[j]][2]) / 2,\n ];\n }\n }\n }\n}\n// The Pipeline coordinates between the bounding box and skeleton models.\nexport class Pipeline {\n storedBoxes: Array<{ startPoint: number[], endPoint: number[], landmarks: Array, confidence: number, faceConfidence?: number }>;\n boundingBoxDetector: BlazeFaceModel; // tf.GraphModel\n meshDetector: GraphModel; // tf.GraphModel\n irisModel: GraphModel; // tf.GraphModel\n boxSize: number;\n meshSize: number;\n irisSize: number;\n irisEnlarge: number;\n skipped: number;\n detectedFaces: number;\n\n constructor(boundingBoxDetector, meshDetector, irisModel) {\n // An array of facial bounding boxes.\n this.storedBoxes = [];\n this.boundingBoxDetector = boundingBoxDetector;\n this.meshDetector = meshDetector;\n this.irisModel = irisModel;\n this.boxSize = boundingBoxDetector?.model?.inputs[0].shape[2] || 0;\n this.meshSize = meshDetector?.inputs[0].shape[2] || boundingBoxDetector?.model?.inputs[0].shape[2];\n this.irisSize = irisModel?.inputs[0].shape[1] || 0;\n this.irisEnlarge = 2.3;\n this.skipped = 0;\n this.detectedFaces = 0;\n }\n\n transformRawCoords(rawCoords, box, angle, rotationMatrix) {\n const boxSize = bounding.getBoxSize({ startPoint: box.startPoint, endPoint: box.endPoint });\n const coordsScaled = rawCoords.map((coord) => ([\n boxSize[0] / this.meshSize * (coord[0] - this.meshSize / 2),\n boxSize[1] / this.meshSize * (coord[1] - this.meshSize / 2),\n coord[2],\n ]));\n const coordsRotationMatrix = (angle !== 0) ? util.buildRotationMatrix(angle, [0, 0]) : util.IDENTITY_MATRIX;\n const coordsRotated = (angle !== 0) ? coordsScaled.map((coord) => ([...util.rotatePoint(coord, coordsRotationMatrix), coord[2]])) : coordsScaled;\n const inverseRotationMatrix = (angle !== 0) ? util.invertTransformMatrix(rotationMatrix) : util.IDENTITY_MATRIX;\n const boxCenter = [...bounding.getBoxCenter({ startPoint: box.startPoint, endPoint: box.endPoint }), 1];\n return coordsRotated.map((coord) => ([\n Math.round(coord[0] + util.dot(boxCenter, inverseRotationMatrix[0])),\n Math.round(coord[1] + util.dot(boxCenter, inverseRotationMatrix[1])),\n Math.round(coord[2]),\n ]));\n }\n\n // eslint-disable-next-line class-methods-use-this\n getLeftToRightEyeDepthDifference(rawCoords) {\n const leftEyeZ = rawCoords[eyeLandmarks.leftBounds[0]][2];\n const rightEyeZ = rawCoords[eyeLandmarks.rightBounds[0]][2];\n return leftEyeZ - rightEyeZ;\n }\n\n // Returns a box describing a cropped region around the eye fit for passing to the iris model.\n getEyeBox(rawCoords, face, eyeInnerCornerIndex, eyeOuterCornerIndex, flip = false) {\n const box = bounding.squarifyBox(bounding.enlargeBox(bounding.calculateLandmarksBoundingBox([rawCoords[eyeInnerCornerIndex], rawCoords[eyeOuterCornerIndex]]), this.irisEnlarge));\n const boxSize = bounding.getBoxSize(box);\n let crop = tf.image.cropAndResize(face, [[\n box.startPoint[1] / this.meshSize,\n box.startPoint[0] / this.meshSize, box.endPoint[1] / this.meshSize,\n box.endPoint[0] / this.meshSize,\n ]], [0], [this.irisSize, this.irisSize]);\n if (flip && tf.ENV.flags.IS_BROWSER) {\n crop = tf.image.flipLeftRight(crop); // flipLeftRight is not defined for tfjs-node\n }\n return { box, boxSize, crop };\n }\n\n // Given a cropped image of an eye, returns the coordinates of the contours surrounding the eye and the iris.\n getEyeCoords(eyeData, eyeBox, eyeBoxSize, flip = false) {\n const eyeRawCoords: Array<[number, number, number]> = [];\n for (let i = 0; i < irisLandmarks.numCoordinates; i++) {\n const x = eyeData[i * 3];\n const y = eyeData[i * 3 + 1];\n const z = eyeData[i * 3 + 2];\n eyeRawCoords.push([\n (flip ? (1 - (x / this.irisSize)) : (x / this.irisSize)) * eyeBoxSize[0] + eyeBox.startPoint[0],\n (y / this.irisSize) * eyeBoxSize[1] + eyeBox.startPoint[1], z,\n ]);\n }\n return { rawCoords: eyeRawCoords, iris: eyeRawCoords.slice(irisLandmarks.index) };\n }\n\n // The z-coordinates returned for the iris are unreliable, so we take the z values from the surrounding keypoints.\n // eslint-disable-next-line class-methods-use-this\n getAdjustedIrisCoords(rawCoords, irisCoords, direction) {\n const upperCenterZ = rawCoords[coords.MESH_ANNOTATIONS[`${direction}EyeUpper0`][irisLandmarks.upperCenter]][2];\n const lowerCenterZ = rawCoords[coords.MESH_ANNOTATIONS[`${direction}EyeLower0`][irisLandmarks.lowerCenter]][2];\n const averageZ = (upperCenterZ + lowerCenterZ) / 2;\n // Iris indices: 0: center | 1: right | 2: above | 3: left | 4: below\n return irisCoords.map((coord, i) => {\n let z = averageZ;\n if (i === 2) {\n z = upperCenterZ;\n } else if (i === 4) {\n z = lowerCenterZ;\n }\n return [coord[0], coord[1], z];\n });\n }\n\n async predict(input, config) {\n let useFreshBox = false;\n // run new detector every skipFrames unless we only want box to start with\n let detector;\n if ((this.skipped === 0) || (this.skipped > config.face.detector.skipFrames) || !config.face.mesh.enabled || !config.skipFrame) {\n detector = await this.boundingBoxDetector.getBoundingBoxes(input);\n this.skipped = 0;\n }\n if (config.skipFrame) this.skipped++;\n\n // if detector result count doesn't match current working set, use it to reset current working set\n if (!config.skipFrame || (detector && detector.boxes && (!config.face.mesh.enabled || (detector.boxes.length !== this.detectedFaces) && (this.detectedFaces !== config.face.detector.maxDetected)))) {\n this.storedBoxes = [];\n this.detectedFaces = 0;\n for (const possible of detector.boxes) {\n this.storedBoxes.push({ startPoint: possible.box.startPoint.dataSync(), endPoint: possible.box.endPoint.dataSync(), landmarks: possible.landmarks.arraySync(), confidence: possible.confidence });\n }\n if (this.storedBoxes.length > 0) useFreshBox = true;\n }\n\n if (useFreshBox) {\n if (!detector || !detector.boxes || (detector.boxes.length === 0)) {\n this.storedBoxes = [];\n this.detectedFaces = 0;\n return null;\n }\n for (let i = 0; i < this.storedBoxes.length; i++) {\n const scaledBox = bounding.scaleBoxCoordinates({ startPoint: this.storedBoxes[i].startPoint, endPoint: this.storedBoxes[i].endPoint }, detector.scaleFactor);\n const enlargedBox = bounding.enlargeBox(scaledBox);\n const squarifiedBox = bounding.squarifyBox(enlargedBox);\n const landmarks = this.storedBoxes[i].landmarks;\n const confidence = this.storedBoxes[i].confidence;\n this.storedBoxes[i] = { ...squarifiedBox, confidence, landmarks };\n }\n }\n if (detector && detector.boxes) {\n detector.boxes.forEach((prediction) => {\n prediction.box.startPoint.dispose();\n prediction.box.endPoint.dispose();\n prediction.landmarks.dispose();\n });\n }\n const results = tf.tidy(() => this.storedBoxes.map((box, i) => {\n // The facial bounding box landmarks could come either from blazeface (if we are using a fresh box), or from the mesh model (if we are reusing an old box).\n let face;\n let angle = 0;\n let rotationMatrix;\n\n if (config.face.detector.rotation && config.face.mesh.enabled && tf.ENV.flags.IS_BROWSER) {\n const [indexOfMouth, indexOfForehead] = (box.landmarks.length >= meshLandmarks.count) ? meshLandmarks.symmetryLine : blazeFaceLandmarks.symmetryLine;\n angle = util.computeRotation(box.landmarks[indexOfMouth], box.landmarks[indexOfForehead]);\n const faceCenter = bounding.getBoxCenter({ startPoint: box.startPoint, endPoint: box.endPoint });\n const faceCenterNormalized = [faceCenter[0] / input.shape[2], faceCenter[1] / input.shape[1]];\n const rotatedImage = tf.image.rotateWithOffset(input, angle, 0, faceCenterNormalized); // rotateWithOffset is not defined for tfjs-node\n rotationMatrix = util.buildRotationMatrix(-angle, faceCenter);\n if (config.face.mesh.enabled) face = bounding.cutBoxFromImageAndResize({ startPoint: box.startPoint, endPoint: box.endPoint }, rotatedImage, [this.meshSize, this.meshSize]).div(255);\n else face = bounding.cutBoxFromImageAndResize({ startPoint: box.startPoint, endPoint: box.endPoint }, rotatedImage, [this.boxSize, this.boxSize]).div(255);\n } else {\n rotationMatrix = util.IDENTITY_MATRIX;\n const clonedImage = input.clone();\n if (config.face.mesh.enabled) face = bounding.cutBoxFromImageAndResize({ startPoint: box.startPoint, endPoint: box.endPoint }, clonedImage, [this.meshSize, this.meshSize]).div(255);\n else face = bounding.cutBoxFromImageAndResize({ startPoint: box.startPoint, endPoint: box.endPoint }, clonedImage, [this.boxSize, this.boxSize]).div(255);\n }\n\n // if we're not going to produce mesh, don't spend time with further processing\n if (!config.face.mesh.enabled) {\n const prediction = {\n mesh: [],\n box,\n faceConfidence: null,\n boxConfidence: box.confidence,\n confidence: box.confidence,\n image: face,\n };\n return prediction;\n }\n\n const [, confidence, contourCoords] = this.meshDetector.execute(face) as Array; // The first returned tensor represents facial contours which are already included in the coordinates.\n const faceConfidence = confidence.dataSync()[0] as number;\n if (faceConfidence < config.face.detector.minConfidence) {\n this.storedBoxes[i].confidence = faceConfidence; // reset confidence of cached box\n return null; // if below confidence just exit\n }\n const coordsReshaped = tf.reshape(contourCoords, [-1, 3]);\n let rawCoords = coordsReshaped.arraySync();\n\n if (config.face.iris.enabled) {\n const { box: leftEyeBox, boxSize: leftEyeBoxSize, crop: leftEyeCrop } = this.getEyeBox(rawCoords, face, eyeLandmarks.leftBounds[0], eyeLandmarks.leftBounds[1], true);\n const { box: rightEyeBox, boxSize: rightEyeBoxSize, crop: rightEyeCrop } = this.getEyeBox(rawCoords, face, eyeLandmarks.rightBounds[0], eyeLandmarks.rightBounds[1]);\n const eyePredictions = this.irisModel.predict(tf.concat([leftEyeCrop, rightEyeCrop])) as Tensor;\n const eyePredictionsData = eyePredictions.dataSync();\n const leftEyeData = eyePredictionsData.slice(0, irisLandmarks.numCoordinates * 3);\n const { rawCoords: leftEyeRawCoords, iris: leftIrisRawCoords } = this.getEyeCoords(leftEyeData, leftEyeBox, leftEyeBoxSize, true);\n const rightEyeData = eyePredictionsData.slice(irisLandmarks.numCoordinates * 3);\n const { rawCoords: rightEyeRawCoords, iris: rightIrisRawCoords } = this.getEyeCoords(rightEyeData, rightEyeBox, rightEyeBoxSize);\n const leftToRightEyeDepthDifference = this.getLeftToRightEyeDepthDifference(rawCoords);\n if (Math.abs(leftToRightEyeDepthDifference) < 30) { // User is looking straight ahead.\n replaceRawCoordinates(rawCoords, leftEyeRawCoords, 'left', null);\n replaceRawCoordinates(rawCoords, rightEyeRawCoords, 'right', null);\n // If the user is looking to the left or to the right, the iris coordinates tend to diverge too much from the mesh coordinates for them to be merged\n // So we only update a single contour line above and below the eye.\n } else if (leftToRightEyeDepthDifference < 1) { // User is looking towards the right.\n replaceRawCoordinates(rawCoords, leftEyeRawCoords, 'left', ['EyeUpper0', 'EyeLower0']);\n } else { // User is looking towards the left.\n replaceRawCoordinates(rawCoords, rightEyeRawCoords, 'right', ['EyeUpper0', 'EyeLower0']);\n }\n const adjustedLeftIrisCoords = this.getAdjustedIrisCoords(rawCoords, leftIrisRawCoords, 'left');\n const adjustedRightIrisCoords = this.getAdjustedIrisCoords(rawCoords, rightIrisRawCoords, 'right');\n rawCoords = rawCoords.concat(adjustedLeftIrisCoords).concat(adjustedRightIrisCoords);\n }\n\n // override box from detection with one calculated from mesh\n const mesh = this.transformRawCoords(rawCoords, box, angle, rotationMatrix);\n const storeConfidence = box.confidence;\n // @ts-ignore enlargeBox does not include confidence so we append it manually\n box = bounding.enlargeBox(bounding.calculateLandmarksBoundingBox(mesh), 1.5); // redefine box with mesh calculated one\n box.confidence = storeConfidence;\n\n // do rotation one more time with mesh keypoints if we want to return perfect image\n if (config.face.detector.rotation && config.face.mesh.enabled && config.face.description.enabled && tf.ENV.flags.IS_BROWSER) {\n const [indexOfMouth, indexOfForehead] = (box.landmarks.length >= meshLandmarks.count) ? meshLandmarks.symmetryLine : blazeFaceLandmarks.symmetryLine;\n angle = util.computeRotation(box.landmarks[indexOfMouth], box.landmarks[indexOfForehead]);\n const faceCenter = bounding.getBoxCenter({ startPoint: box.startPoint, endPoint: box.endPoint });\n const faceCenterNormalized = [faceCenter[0] / input.shape[2], faceCenter[1] / input.shape[1]];\n const rotatedImage = tf.image.rotateWithOffset(input.toFloat(), angle, 0, faceCenterNormalized); // rotateWithOffset is not defined for tfjs-node\n rotationMatrix = util.buildRotationMatrix(-angle, faceCenter);\n face = bounding.cutBoxFromImageAndResize({ startPoint: box.startPoint, endPoint: box.endPoint }, rotatedImage, [this.meshSize, this.meshSize]).div(255);\n }\n\n const prediction = {\n mesh,\n box,\n faceConfidence,\n boxConfidence: box.confidence,\n image: face,\n };\n\n // updated stored cache values\n this.storedBoxes[i] = { ...bounding.squarifyBox(box), confidence: box.confidence, faceConfidence };\n\n return prediction;\n }));\n\n // results = results.filter((a) => a !== null);\n // remove cache entries for detected boxes on low confidence\n if (config.face.mesh.enabled) this.storedBoxes = this.storedBoxes.filter((a) => a.confidence > config.face.detector.minConfidence);\n this.detectedFaces = results.length;\n\n return results;\n }\n}\n", "/**\n * FaceMesh & BlazeFace Module entry point\n */\n\nimport { log, join } from '../helpers';\nimport * as tf from '../../dist/tfjs.esm.js';\nimport * as blazeface from './blazeface';\nimport * as facepipeline from './facepipeline';\nimport * as coords from './coords';\nimport { GraphModel, Tensor } from '../tfjs/types';\nimport { Face } from '../result';\nimport { Config } from '../config';\n\nlet faceModels: [blazeface.BlazeFaceModel | null, GraphModel | null, GraphModel | null] = [null, null, null];\nlet facePipeline;\n\nexport async function predict(input: Tensor, config: Config): Promise {\n const predictions = await facePipeline.predict(input, config);\n const results: Array = [];\n let id = 0;\n for (const prediction of (predictions || [])) {\n if (!prediction || prediction.isDisposedInternal) continue; // guard against disposed tensors on long running operations such as pause in middle of processing\n const meshRaw = prediction.mesh.map((pt) => [\n pt[0] / (input.shape[2] || 0),\n pt[1] / (input.shape[1] || 0),\n pt[2] / facePipeline.meshSize,\n ]);\n const annotations = {};\n if (prediction.mesh && prediction.mesh.length > 0) {\n for (const key of Object.keys(coords.MESH_ANNOTATIONS)) annotations[key] = coords.MESH_ANNOTATIONS[key].map((index) => prediction.mesh[index]);\n }\n const clampedBox: [number, number, number, number] = prediction.box ? [\n Math.trunc(Math.max(0, prediction.box.startPoint[0])),\n Math.trunc(Math.max(0, prediction.box.startPoint[1])),\n Math.trunc(Math.min((input.shape[2] || 0), prediction.box.endPoint[0]) - Math.max(0, prediction.box.startPoint[0])),\n Math.trunc(Math.min((input.shape[1] || 0), prediction.box.endPoint[1]) - Math.max(0, prediction.box.startPoint[1])),\n ] : [0, 0, 0, 0];\n const boxRaw: [number, number, number, number] = prediction.box ? [\n prediction.box.startPoint[0] / (input.shape[2] || 0),\n prediction.box.startPoint[1] / (input.shape[1] || 0),\n (prediction.box.endPoint[0] - prediction.box.startPoint[0]) / (input.shape[2] || 0),\n (prediction.box.endPoint[1] - prediction.box.startPoint[1]) / (input.shape[1] || 0),\n ] : [0, 0, 0, 0];\n results.push({\n id: id++,\n score: Math.round(100 * prediction.faceConfidence || 100 * prediction.boxConfidence || 0) / 100,\n boxScore: Math.round(100 * prediction.boxConfidence) / 100,\n faceScore: Math.round(100 * prediction.faceConfidence) / 100,\n box: clampedBox,\n boxRaw,\n mesh: prediction.mesh,\n meshRaw,\n annotations,\n image: prediction.image,\n tensor: prediction.image,\n });\n if (prediction.coords) prediction.coords.dispose();\n }\n return results;\n}\n\nexport async function load(config): Promise<[unknown, unknown, unknown]> {\n if ((!faceModels[0] && config.face.enabled) || (!faceModels[1] && config.face.mesh.enabled) || (!faceModels[2] && config.face.iris.enabled)) {\n // @ts-ignore type mismatch for GraphModel\n faceModels = await Promise.all([\n (!faceModels[0] && config.face.enabled) ? blazeface.load(config) : null,\n (!faceModels[1] && config.face.mesh.enabled) ? tf.loadGraphModel(join(config.modelBasePath, config.face.mesh.modelPath), { fromTFHub: config.face.mesh.modelPath.includes('tfhub.dev') }) : null,\n (!faceModels[2] && config.face.iris.enabled) ? tf.loadGraphModel(join(config.modelBasePath, config.face.iris.modelPath), { fromTFHub: config.face.iris.modelPath.includes('tfhub.dev') }) : null,\n ]);\n if (config.face.mesh.enabled) {\n if (!faceModels[1] || !faceModels[1]['modelUrl']) log('load model failed:', config.face.mesh.modelPath);\n else if (config.debug) log('load model:', faceModels[1]['modelUrl']);\n }\n if (config.face.iris.enabled) {\n if (!faceModels[2] || !faceModels[2]['modelUrl']) log('load model failed:', config.face.iris.modelPath);\n else if (config.debug) log('load model:', faceModels[2]['modelUrl']);\n }\n } else if (config.debug) {\n if (faceModels[0]) log('cached model:', faceModels[0].model['modelUrl']);\n if (faceModels[1]) log('cached model:', faceModels[1]['modelUrl']);\n if (faceModels[2]) log('cached model:', faceModels[2]['modelUrl']);\n }\n facePipeline = new facepipeline.Pipeline(faceModels[0], faceModels[1], faceModels[2]);\n return faceModels;\n}\n\nexport const triangulation = coords.TRI468;\nexport const uvmap = coords.UV468;\n", "/**\n * Emotion Module\n */\n\nimport { log, join } from '../helpers';\nimport { Config } from '../config';\nimport { Tensor, GraphModel } from '../tfjs/types';\nimport * as tf from '../../dist/tfjs.esm.js';\n\nconst annotations = ['angry', 'disgust', 'fear', 'happy', 'sad', 'surprise', 'neutral'];\nlet model;\n// let last: Array<{ score: number, emotion: string }> = [];\nconst last: Array> = [];\nlet lastCount = 0;\nlet skipped = Number.MAX_SAFE_INTEGER;\n\n// tuning values\nconst rgb = [0.2989, 0.5870, 0.1140]; // factors for red/green/blue colors when converting to grayscale\n\nexport async function load(config: Config): Promise {\n if (!model) {\n model = await tf.loadGraphModel(join(config.modelBasePath, config.face.emotion.modelPath));\n if (!model || !model.modelUrl) log('load model failed:', config.face.emotion.modelPath);\n else if (config.debug) log('load model:', model.modelUrl);\n } else if (config.debug) log('cached model:', model.modelUrl);\n return model;\n}\n\nexport async function predict(image: Tensor, config: Config, idx, count) {\n if (!model) return null;\n if ((skipped < config.face.emotion.skipFrames) && config.skipFrame && (lastCount === count) && last[idx] && (last[idx].length > 0)) {\n skipped++;\n return last[idx];\n }\n skipped = 0;\n return new Promise(async (resolve) => {\n const resize = tf.image.resizeBilinear(image, [model.inputs[0].shape[2], model.inputs[0].shape[1]], false);\n const [red, green, blue] = tf.split(resize, 3, 3);\n resize.dispose();\n // weighted rgb to grayscale: https://www.mathworks.com/help/matlab/ref/rgb2gray.html\n const redNorm = tf.mul(red, rgb[0]);\n const greenNorm = tf.mul(green, rgb[1]);\n const blueNorm = tf.mul(blue, rgb[2]);\n red.dispose();\n green.dispose();\n blue.dispose();\n const grayscale = tf.addN([redNorm, greenNorm, blueNorm]);\n redNorm.dispose();\n greenNorm.dispose();\n blueNorm.dispose();\n const normalize = tf.tidy(() => grayscale.sub(0.5).mul(2));\n grayscale.dispose();\n const obj: Array<{ score: number, emotion: string }> = [];\n if (config.face.emotion.enabled) {\n const emotionT = await model.predict(normalize); // result is already in range 0..1, no need for additional activation\n const data = emotionT.dataSync();\n tf.dispose(emotionT);\n for (let i = 0; i < data.length; i++) {\n if (data[i] > config.face.emotion.minConfidence) obj.push({ score: Math.min(0.99, Math.trunc(100 * data[i]) / 100), emotion: annotations[i] });\n }\n obj.sort((a, b) => b.score - a.score);\n }\n normalize.dispose();\n last[idx] = obj;\n lastCount = count;\n resolve(obj);\n });\n}\n", "/**\n * HSE-FaceRes Module\n * Returns Age, Gender, Descriptor\n * Implements Face simmilarity function\n */\n\nimport { log, join } from '../helpers';\nimport * as tf from '../../dist/tfjs.esm.js';\nimport { Tensor, GraphModel } from '../tfjs/types';\nimport { Config } from '../config';\n\nlet model: GraphModel;\nconst last: Array<{\n age: number,\n gender: string,\n genderScore: number,\n descriptor: number[],\n}> = [];\n\nlet lastCount = 0;\nlet skipped = Number.MAX_SAFE_INTEGER;\n\ntype DB = Array<{ name: string, source: string, embedding: number[] }>;\n\nexport async function load(config: Config): Promise {\n const modelUrl = join(config.modelBasePath, config.face.description.modelPath);\n if (!model) {\n // @ts-ignore type mismatch for GraphModel\n model = await tf.loadGraphModel(modelUrl);\n if (!model) log('load model failed:', config.face.description.modelPath);\n else if (config.debug) log('load model:', modelUrl);\n } else if (config.debug) log('cached model:', modelUrl);\n return model;\n}\n\nexport function similarity(embedding1: Array, embedding2: Array, order = 2): number {\n if (!embedding1 || !embedding2) return 0;\n if (embedding1?.length === 0 || embedding2?.length === 0) return 0;\n if (embedding1?.length !== embedding2?.length) return 0;\n // general minkowski distance, euclidean distance is limited case where order is 2\n const distance = 5.0 * embedding1\n .map((_val, i) => (Math.abs(embedding1[i] - embedding2[i]) ** order)) // distance squared\n .reduce((sum, now) => (sum + now), 0) // sum all distances\n ** (1 / order); // get root of\n const res = Math.max(0, 100 - distance) / 100.0;\n return res;\n}\n\nexport function match(embedding: Array, db: DB, threshold = 0) {\n let best = { similarity: 0, name: '', source: '', embedding: [] as number[] };\n if (!embedding || !db || !Array.isArray(embedding) || !Array.isArray(db)) return best;\n for (const f of db) {\n if (f.embedding && f.name) {\n const perc = similarity(embedding, f.embedding);\n if (perc > threshold && perc > best.similarity) best = { ...f, similarity: perc };\n }\n }\n return best;\n}\n\nexport function enhance(input): Tensor {\n const image = tf.tidy(() => {\n // input received from detector is already normalized to 0..1\n // input is also assumed to be straightened\n const tensor = input.image || input.tensor || input;\n if (!(tensor instanceof tf.Tensor)) return null;\n // do a tight crop of image and resize it to fit the model\n const box = [[0.05, 0.15, 0.85, 0.85]]; // empyrical values for top, left, bottom, right\n // const box = [[0.0, 0.0, 1.0, 1.0]]; // basically no crop for test\n if (!model.inputs[0].shape) return null; // model has no shape so no point continuing\n const crop = (tensor.shape.length === 3)\n ? tf.image.cropAndResize(tf.expandDims(tensor, 0), box, [0], [model.inputs[0].shape[2], model.inputs[0].shape[1]]) // add batch dimension if missing\n : tf.image.cropAndResize(tensor, box, [0], [model.inputs[0].shape[2], model.inputs[0].shape[1]]);\n\n /*\n // just resize to fit the embedding model instead of cropping\n const crop = tf.image.resizeBilinear(tensor, [model.inputs[0].shape[2], model.inputs[0].shape[1]], false);\n */\n\n /*\n // convert to black&white to avoid colorization impact\n const rgb = [0.2989, 0.5870, 0.1140]; // factors for red/green/blue colors when converting to grayscale: https://www.mathworks.com/help/matlab/ref/rgb2gray.html\n const [red, green, blue] = tf.split(crop, 3, 3);\n const redNorm = tf.mul(red, rgb[0]);\n const greenNorm = tf.mul(green, rgb[1]);\n const blueNorm = tf.mul(blue, rgb[2]);\n const grayscale = tf.addN([redNorm, greenNorm, blueNorm]);\n const merge = tf.stack([grayscale, grayscale, grayscale], 3).squeeze(4);\n */\n\n /*\n // increase image pseudo-contrast 100%\n // (or do it per-channel so mean is done on each channel)\n // (or calculate histogram and do it based on histogram)\n const mean = merge.mean();\n const factor = 2;\n const contrast = merge.sub(mean).mul(factor).add(mean);\n */\n\n /*\n // normalize brightness from 0..1\n // silly way of creating pseudo-hdr of image\n const darken = crop.sub(crop.min());\n const lighten = darken.div(darken.max());\n */\n\n const norm = crop.mul(255);\n\n return norm;\n });\n return image;\n}\n\nexport async function predict(image: Tensor, config: Config, idx, count) {\n if (!model) return null;\n if ((skipped < config.face.description.skipFrames) && config.skipFrame && (lastCount === count) && last[idx]?.age && (last[idx]?.age > 0)) {\n skipped++;\n return last[idx];\n }\n skipped = 0;\n return new Promise(async (resolve) => {\n const enhanced = enhance(image);\n\n let resT;\n const obj = {\n age: 0,\n gender: 'unknown',\n genderScore: 0,\n descriptor: [],\n };\n\n if (config.face.description.enabled) resT = await model.predict(enhanced);\n tf.dispose(enhanced);\n\n if (resT) {\n tf.tidy(() => {\n const gender = resT.find((t) => t.shape[1] === 1).dataSync();\n const confidence = Math.trunc(200 * Math.abs((gender[0] - 0.5))) / 100;\n if (confidence > config.face.description.minConfidence) {\n obj.gender = gender[0] <= 0.5 ? 'female' : 'male';\n obj.genderScore = Math.min(0.99, confidence);\n }\n const age = resT.find((t) => t.shape[1] === 100).argMax(1).dataSync()[0];\n const all = resT.find((t) => t.shape[1] === 100).dataSync();\n obj.age = Math.round(all[age - 1] > all[age + 1] ? 10 * age - 100 * all[age - 1] : 10 * age + 100 * all[age + 1]) / 10;\n\n const desc = resT.find((t) => t.shape[1] === 1024);\n // const reshape = desc.reshape([128, 8]); // reshape large 1024-element descriptor to 128 x 8\n // const reduce = reshape.logSumExp(1); // reduce 2nd dimension by calculating logSumExp on it which leaves us with 128-element descriptor\n\n obj.descriptor = [...desc.dataSync()];\n });\n resT.forEach((t) => tf.dispose(t));\n }\n\n last[idx] = obj;\n lastCount = count;\n resolve(obj);\n });\n}\n", "/**\n * Module that analyzes person age\n * Obsolete\n */\n\nimport { log, now } from './helpers';\nimport * as tf from '../dist/tfjs.esm.js';\nimport * as facemesh from './blazeface/facemesh';\nimport * as emotion from './emotion/emotion';\nimport * as faceres from './faceres/faceres';\nimport { Face } from './result';\nimport { Tensor } from './tfjs/types';\n\n// eslint-disable-next-line no-unused-vars, @typescript-eslint/no-unused-vars\nconst rad2deg = (theta) => Math.round((theta * 180) / Math.PI);\n\nconst calculateGaze = (face): { bearing: number, strength: number } => {\n const radians = (pt1, pt2) => Math.atan2(pt1[1] - pt2[1], pt1[0] - pt2[0]); // function to calculate angle between any two points\n if (!face.annotations['rightEyeIris'] || !face.annotations['leftEyeIris']) return { bearing: 0, strength: 0 };\n\n const offsetIris = [0, -0.1]; // iris center may not align with average of eye extremes\n const eyeRatio = 1; // factor to normalize changes x vs y\n\n const left = face.mesh[33][2] > face.mesh[263][2]; // pick left or right eye depending which one is closer bazed on outsize point z axis\n const irisCenter = left ? face.mesh[473] : face.mesh[468];\n const eyeCenter = left // eye center is average of extreme points on x axis for both x and y, ignoring y extreme points as eyelids naturally open/close more when gazing up/down so relative point is less precise\n ? [(face.mesh[133][0] + face.mesh[33][0]) / 2, (face.mesh[133][1] + face.mesh[33][1]) / 2]\n : [(face.mesh[263][0] + face.mesh[362][0]) / 2, (face.mesh[263][1] + face.mesh[362][1]) / 2];\n const eyeSize = left // eye size is difference between extreme points for both x and y, used to normalize & squarify eye dimensions\n ? [face.mesh[133][0] - face.mesh[33][0], face.mesh[23][1] - face.mesh[27][1]]\n : [face.mesh[263][0] - face.mesh[362][0], face.mesh[253][1] - face.mesh[257][1]];\n\n const eyeDiff = [ // x distance between extreme point and center point normalized with eye size\n (eyeCenter[0] - irisCenter[0]) / eyeSize[0] - offsetIris[0],\n eyeRatio * (irisCenter[1] - eyeCenter[1]) / eyeSize[1] - offsetIris[1],\n ];\n let strength = Math.sqrt((eyeDiff[0] ** 2) + (eyeDiff[1] ** 2)); // vector length is a diagonal between two differences\n strength = Math.min(strength, face.boxRaw[2] / 2, face.boxRaw[3] / 2); // limit strength to half of box size to avoid clipping due to low precision\n const bearing = (radians([0, 0], eyeDiff) + (Math.PI / 2)) % Math.PI; // using eyeDiff instead eyeCenter/irisCenter combo due to manual adjustments and rotate clockwise 90degrees\n\n return { bearing, strength };\n};\n\nconst calculateFaceAngle = (face, imageSize): {\n angle: { pitch: number, yaw: number, roll: number },\n matrix: [number, number, number, number, number, number, number, number, number],\n gaze: { bearing: number, strength: number },\n} => {\n // const degrees = (theta) => Math.abs(((theta * 180) / Math.PI) % 360);\n const normalize = (v) => { // normalize vector\n const length = Math.sqrt(v[0] * v[0] + v[1] * v[1] + v[2] * v[2]);\n v[0] /= length;\n v[1] /= length;\n v[2] /= length;\n return v;\n };\n const subVectors = (a, b) => { // vector subtraction (a - b)\n const x = a[0] - b[0];\n const y = a[1] - b[1];\n const z = a[2] - b[2];\n return [x, y, z];\n };\n const crossVectors = (a, b) => { // vector cross product (a x b)\n const x = a[1] * b[2] - a[2] * b[1];\n const y = a[2] * b[0] - a[0] * b[2];\n const z = a[0] * b[1] - a[1] * b[0];\n return [x, y, z];\n };\n // 3x3 rotation matrix to Euler angles based on https://www.geometrictools.com/Documentation/EulerAngles.pdf\n const rotationMatrixToEulerAngle = (r) => {\n // eslint-disable-next-line no-unused-vars, @typescript-eslint/no-unused-vars\n const [r00, r01, r02, r10, r11, r12, r20, r21, r22] = r;\n let thetaX; let thetaY; let thetaZ;\n if (r10 < 1) { // YZX calculation\n if (r10 > -1) {\n thetaZ = Math.asin(r10);\n thetaY = Math.atan2(-r20, r00);\n thetaX = Math.atan2(-r12, r11);\n } else {\n thetaZ = -Math.PI / 2;\n thetaY = -Math.atan2(r21, r22);\n thetaX = 0;\n }\n } else {\n thetaZ = Math.PI / 2;\n thetaY = Math.atan2(r21, r22);\n thetaX = 0;\n }\n return { pitch: 2 * -thetaX, yaw: 2 * -thetaY, roll: 2 * -thetaZ };\n };\n // simple Euler angle calculation based existing 3D mesh\n // eslint-disable-next-line no-unused-vars, @typescript-eslint/no-unused-vars\n const meshToEulerAngle = (mesh) => {\n const radians = (a1, a2, b1, b2) => Math.atan2(b2 - a2, b1 - a1);\n // eslint-disable-next-line no-unused-vars, @typescript-eslint/no-unused-vars\n const angle = {\n // values are in radians in range of -pi/2 to pi/2 which is -90 to +90 degrees, value of 0 means center\n // pitch is face move up/down\n pitch: radians(mesh[10][1], mesh[10][2], mesh[152][1], mesh[152][2]), // looking at y,z of top and bottom points of the face\n // yaw is face turn left/right\n yaw: radians(mesh[33][0], mesh[33][2], mesh[263][0], mesh[263][2]), // looking at x,z of outside corners of leftEye and rightEye\n // roll is face lean left/right\n roll: radians(mesh[33][0], mesh[33][1], mesh[263][0], mesh[263][1]), // looking at x,y of outside corners of leftEye and rightEye\n };\n return angle;\n };\n\n // initialize gaze and mesh\n const mesh = face.meshRaw;\n if (!mesh || mesh.length < 300) return { angle: { pitch: 0, yaw: 0, roll: 0 }, matrix: [1, 0, 0, 0, 1, 0, 0, 0, 1], gaze: { bearing: 0, strength: 0 } };\n\n const size = Math.max(face.boxRaw[2] * imageSize[0], face.boxRaw[3] * imageSize[1]) / 1.5;\n // top, bottom, left, right\n const pts = [mesh[10], mesh[152], mesh[234], mesh[454]].map((pt) => [\n // make the xyz coordinates proportional, independent of the image/box size\n pt[0] * imageSize[0] / size,\n pt[1] * imageSize[1] / size,\n pt[2],\n ]);\n\n const y_axis = normalize(subVectors(pts[1], pts[0]));\n let x_axis = normalize(subVectors(pts[3], pts[2]));\n const z_axis = normalize(crossVectors(x_axis, y_axis));\n // adjust x_axis to make sure that all axes are perpendicular to each other\n x_axis = crossVectors(y_axis, z_axis);\n\n // Rotation Matrix from Axis Vectors - http://renderdan.blogspot.com/2006/05/rotation-matrix-from-axis-vectors.html\n // 3x3 rotation matrix is flatten to array in row-major order. Note that the rotation represented by this matrix is inverted.\n const matrix: [number, number, number, number, number, number, number, number, number] = [\n x_axis[0], x_axis[1], x_axis[2],\n y_axis[0], y_axis[1], y_axis[2],\n z_axis[0], z_axis[1], z_axis[2],\n ];\n const angle = rotationMatrixToEulerAngle(matrix);\n // const angle = meshToEulerAngle(mesh);\n\n // we have iris keypoints so we can calculate gaze direction\n const gaze = mesh.length === 478 ? calculateGaze(face) : { bearing: 0, strength: 0 };\n\n return { angle, matrix, gaze };\n};\n\nexport const detectFace = async (parent /* instance of human */, input: Tensor): Promise => {\n // run facemesh, includes blazeface and iris\n // eslint-disable-next-line no-async-promise-executor\n let timeStamp;\n let ageRes;\n let genderRes;\n let emotionRes;\n let embeddingRes;\n let descRes;\n const faceRes: Array = [];\n parent.state = 'run:face';\n timeStamp = now();\n const faces = await facemesh.predict(input, parent.config);\n parent.performance.face = Math.trunc(now() - timeStamp);\n if (!input.shape || input.shape.length !== 4) return [];\n if (!faces) return [];\n // for (const face of faces) {\n for (let i = 0; i < faces.length; i++) {\n parent.analyze('Get Face');\n\n // is something went wrong, skip the face\n // @ts-ignore possibly undefined\n if (!faces[i].image || faces[i].image['isDisposedInternal']) {\n log('Face object is disposed:', faces[i].image);\n continue;\n }\n\n const rotation = calculateFaceAngle(faces[i], [input.shape[2], input.shape[1]]);\n\n // run emotion, inherits face from blazeface\n parent.analyze('Start Emotion:');\n if (parent.config.async) {\n emotionRes = parent.config.face.emotion.enabled ? emotion.predict(faces[i].image || tf.tensor([]), parent.config, i, faces.length) : {};\n } else {\n parent.state = 'run:emotion';\n timeStamp = now();\n emotionRes = parent.config.face.emotion.enabled ? await emotion.predict(faces[i].image || tf.tensor([]), parent.config, i, faces.length) : {};\n parent.performance.emotion = Math.trunc(now() - timeStamp);\n }\n parent.analyze('End Emotion:');\n\n // run emotion, inherits face from blazeface\n parent.analyze('Start Description:');\n if (parent.config.async) {\n descRes = parent.config.face.description.enabled ? faceres.predict(faces[i].image || tf.tensor([]), parent.config, i, faces.length) : [];\n } else {\n parent.state = 'run:description';\n timeStamp = now();\n descRes = parent.config.face.description.enabled ? await faceres.predict(faces[i].image || tf.tensor([]), parent.config, i, faces.length) : [];\n parent.performance.embedding = Math.trunc(now() - timeStamp);\n }\n parent.analyze('End Description:');\n\n // if async wait for results\n if (parent.config.async) {\n [ageRes, genderRes, emotionRes, embeddingRes, descRes] = await Promise.all([ageRes, genderRes, emotionRes, embeddingRes, descRes]);\n }\n\n parent.analyze('Finish Face:');\n\n // calculate iris distance\n // iris: array[ center, left, top, right, bottom]\n if (!parent.config.face.iris.enabled && faces[i]?.annotations?.leftEyeIris && faces[i]?.annotations?.rightEyeIris) {\n delete faces[i].annotations.leftEyeIris;\n delete faces[i].annotations.rightEyeIris;\n }\n const irisSize = (faces[i].annotations?.leftEyeIris && faces[i].annotations?.rightEyeIris)\n /* note: average human iris size is 11.7mm */\n ? Math.max(Math.abs(faces[i].annotations.leftEyeIris[3][0] - faces[i].annotations.leftEyeIris[1][0]), Math.abs(faces[i].annotations.rightEyeIris[4][1] - faces[i].annotations.rightEyeIris[2][1])) / input.shape[2]\n : 0;\n\n // combine results\n faceRes.push({\n ...faces[i],\n id: i,\n age: descRes.age,\n gender: descRes.gender,\n genderScore: descRes.genderScore,\n embedding: descRes.descriptor,\n emotion: emotionRes,\n iris: irisSize !== 0 ? Math.trunc(500 / irisSize / 11.7) / 100 : 0,\n rotation,\n tensor: parent.config.face.detector.return ? tf.squeeze(faces[i].image) : null,\n });\n // dispose original face tensor\n tf.dispose(faces[i].image);\n // delete temp face image\n if (faces[i].image) delete faces[i].image;\n\n parent.analyze('End Face');\n }\n parent.analyze('End FaceMesh:');\n if (parent.config.async) {\n if (parent.performance.face) delete parent.performance.face;\n if (parent.performance.age) delete parent.performance.age;\n if (parent.performance.gender) delete parent.performance.gender;\n if (parent.performance.emotion) delete parent.performance.emotion;\n }\n return faceRes;\n};\n", "export const partNames = [\n 'nose', 'leftEye', 'rightEye', 'leftEar', 'rightEar', 'leftShoulder',\n 'rightShoulder', 'leftElbow', 'rightElbow', 'leftWrist', 'rightWrist',\n 'leftHip', 'rightHip', 'leftKnee', 'rightKnee', 'leftAnkle', 'rightAnkle',\n];\n\nexport const count = partNames.length; // 17 keypoints\n\nexport const partIds = partNames.reduce((result, jointName, i) => {\n result[jointName] = i;\n return result;\n}, {});\n\nconst connectedPartNames = [\n ['leftHip', 'leftShoulder'], ['leftElbow', 'leftShoulder'],\n ['leftElbow', 'leftWrist'], ['leftHip', 'leftKnee'],\n ['leftKnee', 'leftAnkle'], ['rightHip', 'rightShoulder'],\n ['rightElbow', 'rightShoulder'], ['rightElbow', 'rightWrist'],\n ['rightHip', 'rightKnee'], ['rightKnee', 'rightAnkle'],\n ['leftShoulder', 'rightShoulder'], ['leftHip', 'rightHip'],\n];\nexport const connectedPartIndices = connectedPartNames.map(([jointNameA, jointNameB]) => ([partIds[jointNameA], partIds[jointNameB]]));\n\nexport const poseChain = [\n ['nose', 'leftEye'], ['leftEye', 'leftEar'], ['nose', 'rightEye'],\n ['rightEye', 'rightEar'], ['nose', 'leftShoulder'],\n ['leftShoulder', 'leftElbow'], ['leftElbow', 'leftWrist'],\n ['leftShoulder', 'leftHip'], ['leftHip', 'leftKnee'],\n ['leftKnee', 'leftAnkle'], ['nose', 'rightShoulder'],\n ['rightShoulder', 'rightElbow'], ['rightElbow', 'rightWrist'],\n ['rightShoulder', 'rightHip'], ['rightHip', 'rightKnee'],\n ['rightKnee', 'rightAnkle'],\n];\n", "import * as kpt from './keypoints';\nimport { Body } from '../result';\n\nexport function eitherPointDoesntMeetConfidence(a, b, minConfidence) {\n return (a < minConfidence || b < minConfidence);\n}\n\nexport function getAdjacentKeyPoints(keypoints, minConfidence) {\n return kpt.connectedPartIndices.reduce((result, [leftJoint, rightJoint]) => {\n if (eitherPointDoesntMeetConfidence(keypoints[leftJoint].score, keypoints[rightJoint].score, minConfidence)) {\n return result;\n }\n result.push([keypoints[leftJoint], keypoints[rightJoint]]);\n return result;\n }, []);\n}\n\nexport function getBoundingBox(keypoints): [number, number, number, number] {\n const coord = keypoints.reduce(({ maxX, maxY, minX, minY }, { position: { x, y } }) => ({\n maxX: Math.max(maxX, x),\n maxY: Math.max(maxY, y),\n minX: Math.min(minX, x),\n minY: Math.min(minY, y),\n }), {\n maxX: Number.NEGATIVE_INFINITY,\n maxY: Number.NEGATIVE_INFINITY,\n minX: Number.POSITIVE_INFINITY,\n minY: Number.POSITIVE_INFINITY,\n });\n return [coord.minX, coord.minY, coord.maxX - coord.minX, coord.maxY - coord.minY];\n}\n\nexport function scalePoses(poses, [height, width], [inputResolutionHeight, inputResolutionWidth]): Array {\n const scaleY = height / inputResolutionHeight;\n const scaleX = width / inputResolutionWidth;\n const scalePose = (pose, i) => ({\n id: i,\n score: pose.score,\n boxRaw: [pose.box[0] / inputResolutionWidth, pose.box[1] / inputResolutionHeight, pose.box[2] / inputResolutionWidth, pose.box[3] / inputResolutionHeight],\n box: [Math.trunc(pose.box[0] * scaleX), Math.trunc(pose.box[1] * scaleY), Math.trunc(pose.box[2] * scaleX), Math.trunc(pose.box[3] * scaleY)],\n keypoints: pose.keypoints.map(({ score, part, position }) => ({\n score,\n part,\n position: [Math.trunc(position.x * scaleX), Math.trunc(position.y * scaleY)],\n positionRaw: [position.x / inputResolutionHeight, position.y / inputResolutionHeight],\n })),\n });\n const scaledPoses = poses.map((pose, i) => scalePose(pose, i));\n return scaledPoses;\n}\n\n// algorithm based on Coursera Lecture from Algorithms, Part 1: https://www.coursera.org/learn/algorithms-part1/lecture/ZjoSM/heapsort\nexport class MaxHeap {\n priorityQueue: Array; // don't touch\n numberOfElements: number;\n getElementValue: unknown; // function call\n\n constructor(maxSize, getElementValue) {\n this.priorityQueue = new Array(maxSize);\n this.numberOfElements = -1;\n this.getElementValue = getElementValue;\n }\n\n enqueue(x) {\n this.priorityQueue[++this.numberOfElements] = x;\n this.swim(this.numberOfElements);\n }\n\n dequeue() {\n const max = this.priorityQueue[0];\n this.exchange(0, this.numberOfElements--);\n this.sink(0);\n this.priorityQueue[this.numberOfElements + 1] = null;\n return max;\n }\n\n empty() { return this.numberOfElements === -1; }\n\n size() { return this.numberOfElements + 1; }\n\n all() { return this.priorityQueue.slice(0, this.numberOfElements + 1); }\n\n max() { return this.priorityQueue[0]; }\n\n swim(k) {\n while (k > 0 && this.less(Math.floor(k / 2), k)) {\n this.exchange(k, Math.floor(k / 2));\n k = Math.floor(k / 2);\n }\n }\n\n sink(k) {\n while (2 * k <= this.numberOfElements) {\n let j = 2 * k;\n if (j < this.numberOfElements && this.less(j, j + 1)) j++;\n if (!this.less(k, j)) break;\n this.exchange(k, j);\n k = j;\n }\n }\n\n getValueAt(i) {\n // @ts-ignore getter is of unknown type\n return this.getElementValue(this.priorityQueue[i]);\n }\n\n less(i, j) {\n return this.getValueAt(i) < this.getValueAt(j);\n }\n\n exchange(i, j) {\n const t = this.priorityQueue[i];\n this.priorityQueue[i] = this.priorityQueue[j];\n this.priorityQueue[j] = t;\n }\n}\n\nexport function getOffsetPoint(y, x, keypoint, offsets) {\n return {\n y: offsets.get(y, x, keypoint),\n x: offsets.get(y, x, keypoint + kpt.count),\n };\n}\n\nexport function getImageCoords(part, outputStride, offsets) {\n const { heatmapY, heatmapX, id: keypoint } = part;\n const { y, x } = getOffsetPoint(heatmapY, heatmapX, keypoint, offsets);\n return {\n x: part.heatmapX * outputStride + x,\n y: part.heatmapY * outputStride + y,\n };\n}\n\nexport function fillArray(element, size) {\n const result = new Array(size);\n for (let i = 0; i < size; i++) {\n result[i] = element;\n }\n return result;\n}\n\nexport function clamp(a, min, max) {\n if (a < min) return min;\n if (a > max) return max;\n return a;\n}\n\nexport function squaredDistance(y1, x1, y2, x2) {\n const dy = y2 - y1;\n const dx = x2 - x1;\n return dy * dy + dx * dx;\n}\n\nexport function addVectors(a, b) {\n return { x: a.x + b.x, y: a.y + b.y };\n}\n\nexport function clampVector(a, min, max) {\n return { y: clamp(a.y, min, max), x: clamp(a.x, min, max) };\n}\n", "import * as utils from './utils';\nimport * as kpt from './keypoints';\n\nconst localMaximumRadius = 1;\nconst outputStride = 16;\nconst squaredNmsRadius = 50 ** 2;\n\nfunction traverse(edgeId, sourceKeypoint, targetId, scores, offsets, displacements, offsetRefineStep = 2) {\n const getDisplacement = (point) => ({\n y: displacements.get(point.y, point.x, edgeId),\n x: displacements.get(point.y, point.x, (displacements.shape[2] / 2) + edgeId),\n });\n const getStridedIndexNearPoint = (point, height, width) => ({\n y: utils.clamp(Math.round(point.y / outputStride), 0, height - 1),\n x: utils.clamp(Math.round(point.x / outputStride), 0, width - 1),\n });\n\n const [height, width] = scores.shape;\n // Nearest neighbor interpolation for the source->target displacements.\n const sourceKeypointIndices = getStridedIndexNearPoint(sourceKeypoint.position, height, width);\n const displacement = getDisplacement(sourceKeypointIndices);\n const displacedPoint = utils.addVectors(sourceKeypoint.position, displacement);\n let targetKeypoint = displacedPoint;\n for (let i = 0; i < offsetRefineStep; i++) {\n const targetKeypointIndices = getStridedIndexNearPoint(targetKeypoint, height, width);\n const offsetPoint = utils.getOffsetPoint(targetKeypointIndices.y, targetKeypointIndices.x, targetId, offsets);\n targetKeypoint = utils.addVectors(\n { x: targetKeypointIndices.x * outputStride, y: targetKeypointIndices.y * outputStride },\n { x: offsetPoint.x, y: offsetPoint.y },\n );\n }\n const targetKeyPointIndices = getStridedIndexNearPoint(targetKeypoint, height, width);\n const score = scores.get(targetKeyPointIndices.y, targetKeyPointIndices.x, targetId);\n return { position: targetKeypoint, part: kpt.partNames[targetId], score };\n}\n\nexport function decodePose(root, scores, offsets, displacementsFwd, displacementsBwd) {\n const tuples = kpt.poseChain.map(([parentJoinName, childJoinName]) => ([kpt.partIds[parentJoinName], kpt.partIds[childJoinName]]));\n const edgesFwd = tuples.map(([, childJointId]) => childJointId);\n const edgesBwd = tuples.map(([parentJointId]) => parentJointId);\n const numParts = scores.shape[2]; // [21,21,17]\n const numEdges = edgesFwd.length;\n const keypoints = new Array(numParts);\n // Start a new detection instance at the position of the root.\n const rootPoint = utils.getImageCoords(root.part, outputStride, offsets);\n keypoints[root.part.id] = {\n score: root.score,\n part: kpt.partNames[root.part.id],\n position: rootPoint,\n };\n // Decode the part positions upwards in the tree, following the backward displacements.\n for (let edge = numEdges - 1; edge >= 0; --edge) {\n const sourceId = edgesFwd[edge];\n const targetId = edgesBwd[edge];\n if (keypoints[sourceId] && !keypoints[targetId]) {\n keypoints[targetId] = traverse(edge, keypoints[sourceId], targetId, scores, offsets, displacementsBwd);\n }\n }\n // Decode the part positions downwards in the tree, following the forward displacements.\n for (let edge = 0; edge < numEdges; ++edge) {\n const sourceId = edgesBwd[edge];\n const targetId = edgesFwd[edge];\n if (keypoints[sourceId] && !keypoints[targetId]) {\n keypoints[targetId] = traverse(edge, keypoints[sourceId], targetId, scores, offsets, displacementsFwd);\n }\n }\n return keypoints;\n}\n\nfunction scoreIsMaximumInLocalWindow(keypointId, score, heatmapY, heatmapX, scores) {\n const [height, width] = scores.shape;\n let localMaximum = true;\n const yStart = Math.max(heatmapY - localMaximumRadius, 0);\n const yEnd = Math.min(heatmapY + localMaximumRadius + 1, height);\n for (let yCurrent = yStart; yCurrent < yEnd; ++yCurrent) {\n const xStart = Math.max(heatmapX - localMaximumRadius, 0);\n const xEnd = Math.min(heatmapX + localMaximumRadius + 1, width);\n for (let xCurrent = xStart; xCurrent < xEnd; ++xCurrent) {\n if (scores.get(yCurrent, xCurrent, keypointId) > score) {\n localMaximum = false;\n break;\n }\n }\n if (!localMaximum) break;\n }\n return localMaximum;\n}\n\nexport function buildPartWithScoreQueue(minConfidence, scores) {\n const [height, width, numKeypoints] = scores.shape;\n const queue = new utils.MaxHeap(height * width * numKeypoints, ({ score }) => score);\n for (let heatmapY = 0; heatmapY < height; ++heatmapY) {\n for (let heatmapX = 0; heatmapX < width; ++heatmapX) {\n for (let keypointId = 0; keypointId < numKeypoints; ++keypointId) {\n const score = scores.get(heatmapY, heatmapX, keypointId);\n // Only consider parts with score greater or equal to threshold as root candidates.\n if (score < minConfidence) continue;\n // Only consider keypoints whose score is maximum in a local window.\n if (scoreIsMaximumInLocalWindow(keypointId, score, heatmapY, heatmapX, scores)) queue.enqueue({ score, part: { heatmapY, heatmapX, id: keypointId } });\n }\n }\n }\n return queue;\n}\n\nfunction withinRadius(poses, { x, y }, keypointId) {\n return poses.some(({ keypoints }) => {\n const correspondingKeypoint = keypoints[keypointId]?.position;\n if (!correspondingKeypoint) return false;\n return utils.squaredDistance(y, x, correspondingKeypoint.y, correspondingKeypoint.x) <= squaredNmsRadius;\n });\n}\n\nfunction getInstanceScore(existingPoses, keypoints) {\n const notOverlappedKeypointScores = keypoints.reduce((result, { position, score }, keypointId) => {\n if (!withinRadius(existingPoses, position, keypointId)) result += score;\n return result;\n }, 0.0);\n return notOverlappedKeypointScores / keypoints.length;\n}\n\nexport function decode(offsets, scores, displacementsFwd, displacementsBwd, maxDetected, minConfidence) {\n const poses: Array<{ keypoints, box: [number, number, number, number], score: number }> = [];\n const queue = buildPartWithScoreQueue(minConfidence, scores);\n // Generate at most maxDetected object instances per image in decreasing root part score order.\n while (poses.length < maxDetected && !queue.empty()) {\n // The top element in the queue is the next root candidate.\n const root = queue.dequeue();\n // Part-based non-maximum suppression: We reject a root candidate if it is within a disk of `nmsRadius` pixels from the corresponding part of a previously detected instance.\n // @ts-ignore this one is tree walk\n const rootImageCoords = utils.getImageCoords(root.part, outputStride, offsets);\n // @ts-ignore this one is tree walk\n if (withinRadius(poses, rootImageCoords, root.part.id)) continue;\n // Else start a new detection instance at the position of the root.\n let keypoints = decodePose(root, scores, offsets, displacementsFwd, displacementsBwd);\n keypoints = keypoints.filter((a) => a.score > minConfidence);\n const score = getInstanceScore(poses, keypoints);\n const box = utils.getBoundingBox(keypoints);\n if (score > minConfidence) poses.push({ keypoints, box, score: Math.round(100 * score) / 100 });\n }\n return poses;\n}\n", "/**\n * PoseNet module entry point\n */\n\nimport { log, join } from '../helpers';\nimport * as tf from '../../dist/tfjs.esm.js';\nimport * as poses from './poses';\nimport * as util from './utils';\nimport { Body } from '../result';\nimport { Tensor, GraphModel } from '../tfjs/types';\nimport { Config } from '../config';\n\nlet model: GraphModel;\nconst poseNetOutputs = ['MobilenetV1/offset_2/BiasAdd'/* offsets */, 'MobilenetV1/heatmap_2/BiasAdd'/* heatmapScores */, 'MobilenetV1/displacement_fwd_2/BiasAdd'/* displacementFwd */, 'MobilenetV1/displacement_bwd_2/BiasAdd'/* displacementBwd */];\n\nexport async function predict(input: Tensor, config: Config): Promise {\n const res = tf.tidy(() => {\n if (!model.inputs[0].shape) return [];\n const resized = tf.image.resizeBilinear(input, [model.inputs[0].shape[2], model.inputs[0].shape[1]]);\n const normalized = resized.toFloat().div(127.5).sub(1.0);\n const results: Array = model.execute(normalized, poseNetOutputs) as Array;\n const results3d = results.map((y) => tf.squeeze(y, [0]));\n results3d[1] = results3d[1].sigmoid(); // apply sigmoid on scores\n return results3d;\n });\n\n const buffers = await Promise.all(res.map((tensor) => tensor.buffer()));\n for (const t of res) t.dispose();\n\n const decoded = await poses.decode(buffers[0], buffers[1], buffers[2], buffers[3], config.body.maxDetected, config.body.minConfidence);\n if (!model.inputs[0].shape) return [];\n const scaled = util.scalePoses(decoded, [input.shape[1], input.shape[2]], [model.inputs[0].shape[2], model.inputs[0].shape[1]]) as Body[];\n return scaled;\n}\n\nexport async function load(config: Config): Promise {\n if (!model) {\n // @ts-ignore type mismatch for GraphModel\n model = await tf.loadGraphModel(join(config.modelBasePath, config.body.modelPath));\n if (!model || !model['modelUrl']) log('load model failed:', config.body.modelPath);\n else if (config.debug) log('load model:', model['modelUrl']);\n } else if (config.debug) log('cached model:', model['modelUrl']);\n return model;\n}\n", "import * as tf from '../../dist/tfjs.esm.js';\n\nexport function getBoxSize(box) {\n return [\n Math.abs(box.endPoint[0] - box.startPoint[0]),\n Math.abs(box.endPoint[1] - box.startPoint[1]),\n ];\n}\n\nexport function getBoxCenter(box) {\n return [\n box.startPoint[0] + (box.endPoint[0] - box.startPoint[0]) / 2,\n box.startPoint[1] + (box.endPoint[1] - box.startPoint[1]) / 2,\n ];\n}\n\nexport function cutBoxFromImageAndResize(box, image, cropSize) {\n const h = image.shape[1];\n const w = image.shape[2];\n const boxes = [[\n box.startPoint[1] / h,\n box.startPoint[0] / w,\n box.endPoint[1] / h,\n box.endPoint[0] / w,\n ]];\n return tf.image.cropAndResize(image, boxes, [0], cropSize);\n}\n\nexport function scaleBoxCoordinates(box, factor) {\n const startPoint = [box.startPoint[0] * factor[0], box.startPoint[1] * factor[1]];\n const endPoint = [box.endPoint[0] * factor[0], box.endPoint[1] * factor[1]];\n const palmLandmarks = box.palmLandmarks.map((coord) => {\n const scaledCoord = [coord[0] * factor[0], coord[1] * factor[1]];\n return scaledCoord;\n });\n return { startPoint, endPoint, palmLandmarks, confidence: box.confidence };\n}\n\nexport function enlargeBox(box, factor = 1.5) {\n const center = getBoxCenter(box);\n const size = getBoxSize(box);\n const newHalfSize = [factor * size[0] / 2, factor * size[1] / 2];\n const startPoint = [center[0] - newHalfSize[0], center[1] - newHalfSize[1]];\n const endPoint = [center[0] + newHalfSize[0], center[1] + newHalfSize[1]];\n return { startPoint, endPoint, palmLandmarks: box.palmLandmarks };\n}\n\nexport function squarifyBox(box) {\n const centers = getBoxCenter(box);\n const size = getBoxSize(box);\n const maxEdge = Math.max(...size);\n const halfSize = maxEdge / 2;\n const startPoint = [centers[0] - halfSize, centers[1] - halfSize];\n const endPoint = [centers[0] + halfSize, centers[1] + halfSize];\n return { startPoint, endPoint, palmLandmarks: box.palmLandmarks };\n}\n\nexport function shiftBox(box, shiftFactor) {\n const boxSize = [\n box.endPoint[0] - box.startPoint[0],\n box.endPoint[1] - box.startPoint[1],\n ];\n const shiftVector = [boxSize[0] * shiftFactor[0], boxSize[1] * shiftFactor[1]];\n const startPoint = [box.startPoint[0] + shiftVector[0], box.startPoint[1] + shiftVector[1]];\n const endPoint = [box.endPoint[0] + shiftVector[0], box.endPoint[1] + shiftVector[1]];\n return { startPoint, endPoint, palmLandmarks: box.palmLandmarks };\n}\n", "export const anchors = [\n { x: 0.015625, y: 0.015625 },\n { x: 0.015625, y: 0.015625 },\n { x: 0.046875, y: 0.015625 },\n { x: 0.046875, y: 0.015625 },\n { x: 0.078125, y: 0.015625 },\n { x: 0.078125, y: 0.015625 },\n { x: 0.109375, y: 0.015625 },\n { x: 0.109375, y: 0.015625 },\n { x: 0.140625, y: 0.015625 },\n { x: 0.140625, y: 0.015625 },\n { x: 0.171875, y: 0.015625 },\n { x: 0.171875, y: 0.015625 },\n { x: 0.203125, y: 0.015625 },\n { x: 0.203125, y: 0.015625 },\n { x: 0.234375, y: 0.015625 },\n { x: 0.234375, y: 0.015625 },\n { x: 0.265625, y: 0.015625 },\n { x: 0.265625, y: 0.015625 },\n { x: 0.296875, y: 0.015625 },\n { x: 0.296875, y: 0.015625 },\n { x: 0.328125, y: 0.015625 },\n { x: 0.328125, y: 0.015625 },\n { x: 0.359375, y: 0.015625 },\n { x: 0.359375, y: 0.015625 },\n { x: 0.390625, y: 0.015625 },\n { x: 0.390625, y: 0.015625 },\n { x: 0.421875, y: 0.015625 },\n { x: 0.421875, y: 0.015625 },\n { x: 0.453125, y: 0.015625 },\n { x: 0.453125, y: 0.015625 },\n { x: 0.484375, y: 0.015625 },\n { x: 0.484375, y: 0.015625 },\n { x: 0.515625, y: 0.015625 },\n { x: 0.515625, y: 0.015625 },\n { x: 0.546875, y: 0.015625 },\n { x: 0.546875, y: 0.015625 },\n { x: 0.578125, y: 0.015625 },\n { x: 0.578125, y: 0.015625 },\n { x: 0.609375, y: 0.015625 },\n { x: 0.609375, y: 0.015625 },\n { x: 0.640625, y: 0.015625 },\n { x: 0.640625, y: 0.015625 },\n { x: 0.671875, y: 0.015625 },\n { x: 0.671875, y: 0.015625 },\n { x: 0.703125, y: 0.015625 },\n { x: 0.703125, y: 0.015625 },\n { x: 0.734375, y: 0.015625 },\n { x: 0.734375, y: 0.015625 },\n { x: 0.765625, y: 0.015625 },\n { x: 0.765625, y: 0.015625 },\n { x: 0.796875, y: 0.015625 },\n { x: 0.796875, y: 0.015625 },\n { x: 0.828125, y: 0.015625 },\n { x: 0.828125, y: 0.015625 },\n { x: 0.859375, y: 0.015625 },\n { x: 0.859375, y: 0.015625 },\n { x: 0.890625, y: 0.015625 },\n { x: 0.890625, y: 0.015625 },\n { x: 0.921875, y: 0.015625 },\n { x: 0.921875, y: 0.015625 },\n { x: 0.953125, y: 0.015625 },\n { x: 0.953125, y: 0.015625 },\n { x: 0.984375, y: 0.015625 },\n { x: 0.984375, y: 0.015625 },\n { x: 0.015625, y: 0.046875 },\n { x: 0.015625, y: 0.046875 },\n { x: 0.046875, y: 0.046875 },\n { x: 0.046875, y: 0.046875 },\n { x: 0.078125, y: 0.046875 },\n { x: 0.078125, y: 0.046875 },\n { x: 0.109375, y: 0.046875 },\n { x: 0.109375, y: 0.046875 },\n { x: 0.140625, y: 0.046875 },\n { x: 0.140625, y: 0.046875 },\n { x: 0.171875, y: 0.046875 },\n { x: 0.171875, y: 0.046875 },\n { x: 0.203125, y: 0.046875 },\n { x: 0.203125, y: 0.046875 },\n { x: 0.234375, y: 0.046875 },\n { x: 0.234375, y: 0.046875 },\n { x: 0.265625, y: 0.046875 },\n { x: 0.265625, y: 0.046875 },\n { x: 0.296875, y: 0.046875 },\n { x: 0.296875, y: 0.046875 },\n { x: 0.328125, y: 0.046875 },\n { x: 0.328125, y: 0.046875 },\n { x: 0.359375, y: 0.046875 },\n { x: 0.359375, y: 0.046875 },\n { x: 0.390625, y: 0.046875 },\n { x: 0.390625, y: 0.046875 },\n { x: 0.421875, y: 0.046875 },\n { x: 0.421875, y: 0.046875 },\n { x: 0.453125, y: 0.046875 },\n { x: 0.453125, y: 0.046875 },\n { x: 0.484375, y: 0.046875 },\n { x: 0.484375, y: 0.046875 },\n { x: 0.515625, y: 0.046875 },\n { x: 0.515625, y: 0.046875 },\n { x: 0.546875, y: 0.046875 },\n { x: 0.546875, y: 0.046875 },\n { x: 0.578125, y: 0.046875 },\n { x: 0.578125, y: 0.046875 },\n { x: 0.609375, y: 0.046875 },\n { x: 0.609375, y: 0.046875 },\n { x: 0.640625, y: 0.046875 },\n { x: 0.640625, y: 0.046875 },\n { x: 0.671875, y: 0.046875 },\n { x: 0.671875, y: 0.046875 },\n { x: 0.703125, y: 0.046875 },\n { x: 0.703125, y: 0.046875 },\n { x: 0.734375, y: 0.046875 },\n { x: 0.734375, y: 0.046875 },\n { x: 0.765625, y: 0.046875 },\n { x: 0.765625, y: 0.046875 },\n { x: 0.796875, y: 0.046875 },\n { x: 0.796875, y: 0.046875 },\n { x: 0.828125, y: 0.046875 },\n { x: 0.828125, y: 0.046875 },\n { x: 0.859375, y: 0.046875 },\n { x: 0.859375, y: 0.046875 },\n { x: 0.890625, y: 0.046875 },\n { x: 0.890625, y: 0.046875 },\n { x: 0.921875, y: 0.046875 },\n { x: 0.921875, y: 0.046875 },\n { x: 0.953125, y: 0.046875 },\n { x: 0.953125, y: 0.046875 },\n { x: 0.984375, y: 0.046875 },\n { x: 0.984375, y: 0.046875 },\n { x: 0.015625, y: 0.078125 },\n { x: 0.015625, y: 0.078125 },\n { x: 0.046875, y: 0.078125 },\n { x: 0.046875, y: 0.078125 },\n { x: 0.078125, y: 0.078125 },\n { x: 0.078125, y: 0.078125 },\n { x: 0.109375, y: 0.078125 },\n { x: 0.109375, y: 0.078125 },\n { x: 0.140625, y: 0.078125 },\n { x: 0.140625, y: 0.078125 },\n { x: 0.171875, y: 0.078125 },\n { x: 0.171875, y: 0.078125 },\n { x: 0.203125, y: 0.078125 },\n { x: 0.203125, y: 0.078125 },\n { x: 0.234375, y: 0.078125 },\n { x: 0.234375, y: 0.078125 },\n { x: 0.265625, y: 0.078125 },\n { x: 0.265625, y: 0.078125 },\n { x: 0.296875, y: 0.078125 },\n { x: 0.296875, y: 0.078125 },\n { x: 0.328125, y: 0.078125 },\n { x: 0.328125, y: 0.078125 },\n { x: 0.359375, y: 0.078125 },\n { x: 0.359375, y: 0.078125 },\n { x: 0.390625, y: 0.078125 },\n { x: 0.390625, y: 0.078125 },\n { x: 0.421875, y: 0.078125 },\n { x: 0.421875, y: 0.078125 },\n { x: 0.453125, y: 0.078125 },\n { x: 0.453125, y: 0.078125 },\n { x: 0.484375, y: 0.078125 },\n { x: 0.484375, y: 0.078125 },\n { x: 0.515625, y: 0.078125 },\n { x: 0.515625, y: 0.078125 },\n { x: 0.546875, y: 0.078125 },\n { x: 0.546875, y: 0.078125 },\n { x: 0.578125, y: 0.078125 },\n { x: 0.578125, y: 0.078125 },\n { x: 0.609375, y: 0.078125 },\n { x: 0.609375, y: 0.078125 },\n { x: 0.640625, y: 0.078125 },\n { x: 0.640625, y: 0.078125 },\n { x: 0.671875, y: 0.078125 },\n { x: 0.671875, y: 0.078125 },\n { x: 0.703125, y: 0.078125 },\n { x: 0.703125, y: 0.078125 },\n { x: 0.734375, y: 0.078125 },\n { x: 0.734375, y: 0.078125 },\n { x: 0.765625, y: 0.078125 },\n { x: 0.765625, y: 0.078125 },\n { x: 0.796875, y: 0.078125 },\n { x: 0.796875, y: 0.078125 },\n { x: 0.828125, y: 0.078125 },\n { x: 0.828125, y: 0.078125 },\n { x: 0.859375, y: 0.078125 },\n { x: 0.859375, y: 0.078125 },\n { x: 0.890625, y: 0.078125 },\n { x: 0.890625, y: 0.078125 },\n { x: 0.921875, y: 0.078125 },\n { x: 0.921875, y: 0.078125 },\n { x: 0.953125, y: 0.078125 },\n { x: 0.953125, y: 0.078125 },\n { x: 0.984375, y: 0.078125 },\n { x: 0.984375, y: 0.078125 },\n { x: 0.015625, y: 0.109375 },\n { x: 0.015625, y: 0.109375 },\n { x: 0.046875, y: 0.109375 },\n { x: 0.046875, y: 0.109375 },\n { x: 0.078125, y: 0.109375 },\n { x: 0.078125, y: 0.109375 },\n { x: 0.109375, y: 0.109375 },\n { x: 0.109375, y: 0.109375 },\n { x: 0.140625, y: 0.109375 },\n { x: 0.140625, y: 0.109375 },\n { x: 0.171875, y: 0.109375 },\n { x: 0.171875, y: 0.109375 },\n { x: 0.203125, y: 0.109375 },\n { x: 0.203125, y: 0.109375 },\n { x: 0.234375, y: 0.109375 },\n { x: 0.234375, y: 0.109375 },\n { x: 0.265625, y: 0.109375 },\n { x: 0.265625, y: 0.109375 },\n { x: 0.296875, y: 0.109375 },\n { x: 0.296875, y: 0.109375 },\n { x: 0.328125, y: 0.109375 },\n { x: 0.328125, y: 0.109375 },\n { x: 0.359375, y: 0.109375 },\n { x: 0.359375, y: 0.109375 },\n { x: 0.390625, y: 0.109375 },\n { x: 0.390625, y: 0.109375 },\n { x: 0.421875, y: 0.109375 },\n { x: 0.421875, y: 0.109375 },\n { x: 0.453125, y: 0.109375 },\n { x: 0.453125, y: 0.109375 },\n { x: 0.484375, y: 0.109375 },\n { x: 0.484375, y: 0.109375 },\n { x: 0.515625, y: 0.109375 },\n { x: 0.515625, y: 0.109375 },\n { x: 0.546875, y: 0.109375 },\n { x: 0.546875, y: 0.109375 },\n { x: 0.578125, y: 0.109375 },\n { x: 0.578125, y: 0.109375 },\n { x: 0.609375, y: 0.109375 },\n { x: 0.609375, y: 0.109375 },\n { x: 0.640625, y: 0.109375 },\n { x: 0.640625, y: 0.109375 },\n { x: 0.671875, y: 0.109375 },\n { x: 0.671875, y: 0.109375 },\n { x: 0.703125, y: 0.109375 },\n { x: 0.703125, y: 0.109375 },\n { x: 0.734375, y: 0.109375 },\n { x: 0.734375, y: 0.109375 },\n { x: 0.765625, y: 0.109375 },\n { x: 0.765625, y: 0.109375 },\n { x: 0.796875, y: 0.109375 },\n { x: 0.796875, y: 0.109375 },\n { x: 0.828125, y: 0.109375 },\n { x: 0.828125, y: 0.109375 },\n { x: 0.859375, y: 0.109375 },\n { x: 0.859375, y: 0.109375 },\n { x: 0.890625, y: 0.109375 },\n { x: 0.890625, y: 0.109375 },\n { x: 0.921875, y: 0.109375 },\n { x: 0.921875, y: 0.109375 },\n { x: 0.953125, y: 0.109375 },\n { x: 0.953125, y: 0.109375 },\n { x: 0.984375, y: 0.109375 },\n { x: 0.984375, y: 0.109375 },\n { x: 0.015625, y: 0.140625 },\n { x: 0.015625, y: 0.140625 },\n { x: 0.046875, y: 0.140625 },\n { x: 0.046875, y: 0.140625 },\n { x: 0.078125, y: 0.140625 },\n { x: 0.078125, y: 0.140625 },\n { x: 0.109375, y: 0.140625 },\n { x: 0.109375, y: 0.140625 },\n { x: 0.140625, y: 0.140625 },\n { x: 0.140625, y: 0.140625 },\n { x: 0.171875, y: 0.140625 },\n { x: 0.171875, y: 0.140625 },\n { x: 0.203125, y: 0.140625 },\n { x: 0.203125, y: 0.140625 },\n { x: 0.234375, y: 0.140625 },\n { x: 0.234375, y: 0.140625 },\n { x: 0.265625, y: 0.140625 },\n { x: 0.265625, y: 0.140625 },\n { x: 0.296875, y: 0.140625 },\n { x: 0.296875, y: 0.140625 },\n { x: 0.328125, y: 0.140625 },\n { x: 0.328125, y: 0.140625 },\n { x: 0.359375, y: 0.140625 },\n { x: 0.359375, y: 0.140625 },\n { x: 0.390625, y: 0.140625 },\n { x: 0.390625, y: 0.140625 },\n { x: 0.421875, y: 0.140625 },\n { x: 0.421875, y: 0.140625 },\n { x: 0.453125, y: 0.140625 },\n { x: 0.453125, y: 0.140625 },\n { x: 0.484375, y: 0.140625 },\n { x: 0.484375, y: 0.140625 },\n { x: 0.515625, y: 0.140625 },\n { x: 0.515625, y: 0.140625 },\n { x: 0.546875, y: 0.140625 },\n { x: 0.546875, y: 0.140625 },\n { x: 0.578125, y: 0.140625 },\n { x: 0.578125, y: 0.140625 },\n { x: 0.609375, y: 0.140625 },\n { x: 0.609375, y: 0.140625 },\n { x: 0.640625, y: 0.140625 },\n { x: 0.640625, y: 0.140625 },\n { x: 0.671875, y: 0.140625 },\n { x: 0.671875, y: 0.140625 },\n { x: 0.703125, y: 0.140625 },\n { x: 0.703125, y: 0.140625 },\n { x: 0.734375, y: 0.140625 },\n { x: 0.734375, y: 0.140625 },\n { x: 0.765625, y: 0.140625 },\n { x: 0.765625, y: 0.140625 },\n { x: 0.796875, y: 0.140625 },\n { x: 0.796875, y: 0.140625 },\n { x: 0.828125, y: 0.140625 },\n { x: 0.828125, y: 0.140625 },\n { x: 0.859375, y: 0.140625 },\n { x: 0.859375, y: 0.140625 },\n { x: 0.890625, y: 0.140625 },\n { x: 0.890625, y: 0.140625 },\n { x: 0.921875, y: 0.140625 },\n { x: 0.921875, y: 0.140625 },\n { x: 0.953125, y: 0.140625 },\n { x: 0.953125, y: 0.140625 },\n { x: 0.984375, y: 0.140625 },\n { x: 0.984375, y: 0.140625 },\n { x: 0.015625, y: 0.171875 },\n { x: 0.015625, y: 0.171875 },\n { x: 0.046875, y: 0.171875 },\n { x: 0.046875, y: 0.171875 },\n { x: 0.078125, y: 0.171875 },\n { x: 0.078125, y: 0.171875 },\n { x: 0.109375, y: 0.171875 },\n { x: 0.109375, y: 0.171875 },\n { x: 0.140625, y: 0.171875 },\n { x: 0.140625, y: 0.171875 },\n { x: 0.171875, y: 0.171875 },\n { x: 0.171875, y: 0.171875 },\n { x: 0.203125, y: 0.171875 },\n { x: 0.203125, y: 0.171875 },\n { x: 0.234375, y: 0.171875 },\n { x: 0.234375, y: 0.171875 },\n { x: 0.265625, y: 0.171875 },\n { x: 0.265625, y: 0.171875 },\n { x: 0.296875, y: 0.171875 },\n { x: 0.296875, y: 0.171875 },\n { x: 0.328125, y: 0.171875 },\n { x: 0.328125, y: 0.171875 },\n { x: 0.359375, y: 0.171875 },\n { x: 0.359375, y: 0.171875 },\n { x: 0.390625, y: 0.171875 },\n { x: 0.390625, y: 0.171875 },\n { x: 0.421875, y: 0.171875 },\n { x: 0.421875, y: 0.171875 },\n { x: 0.453125, y: 0.171875 },\n { x: 0.453125, y: 0.171875 },\n { x: 0.484375, y: 0.171875 },\n { x: 0.484375, y: 0.171875 },\n { x: 0.515625, y: 0.171875 },\n { x: 0.515625, y: 0.171875 },\n { x: 0.546875, y: 0.171875 },\n { x: 0.546875, y: 0.171875 },\n { x: 0.578125, y: 0.171875 },\n { x: 0.578125, y: 0.171875 },\n { x: 0.609375, y: 0.171875 },\n { x: 0.609375, y: 0.171875 },\n { x: 0.640625, y: 0.171875 },\n { x: 0.640625, y: 0.171875 },\n { x: 0.671875, y: 0.171875 },\n { x: 0.671875, y: 0.171875 },\n { x: 0.703125, y: 0.171875 },\n { x: 0.703125, y: 0.171875 },\n { x: 0.734375, y: 0.171875 },\n { x: 0.734375, y: 0.171875 },\n { x: 0.765625, y: 0.171875 },\n { x: 0.765625, y: 0.171875 },\n { x: 0.796875, y: 0.171875 },\n { x: 0.796875, y: 0.171875 },\n { x: 0.828125, y: 0.171875 },\n { x: 0.828125, y: 0.171875 },\n { x: 0.859375, y: 0.171875 },\n { x: 0.859375, y: 0.171875 },\n { x: 0.890625, y: 0.171875 },\n { x: 0.890625, y: 0.171875 },\n { x: 0.921875, y: 0.171875 },\n { x: 0.921875, y: 0.171875 },\n { x: 0.953125, y: 0.171875 },\n { x: 0.953125, y: 0.171875 },\n { x: 0.984375, y: 0.171875 },\n { x: 0.984375, y: 0.171875 },\n { x: 0.015625, y: 0.203125 },\n { x: 0.015625, y: 0.203125 },\n { x: 0.046875, y: 0.203125 },\n { x: 0.046875, y: 0.203125 },\n { x: 0.078125, y: 0.203125 },\n { x: 0.078125, y: 0.203125 },\n { x: 0.109375, y: 0.203125 },\n { x: 0.109375, y: 0.203125 },\n { x: 0.140625, y: 0.203125 },\n { x: 0.140625, y: 0.203125 },\n { x: 0.171875, y: 0.203125 },\n { x: 0.171875, y: 0.203125 },\n { x: 0.203125, y: 0.203125 },\n { x: 0.203125, y: 0.203125 },\n { x: 0.234375, y: 0.203125 },\n { x: 0.234375, y: 0.203125 },\n { x: 0.265625, y: 0.203125 },\n { x: 0.265625, y: 0.203125 },\n { x: 0.296875, y: 0.203125 },\n { x: 0.296875, y: 0.203125 },\n { x: 0.328125, y: 0.203125 },\n { x: 0.328125, y: 0.203125 },\n { x: 0.359375, y: 0.203125 },\n { x: 0.359375, y: 0.203125 },\n { x: 0.390625, y: 0.203125 },\n { x: 0.390625, y: 0.203125 },\n { x: 0.421875, y: 0.203125 },\n { x: 0.421875, y: 0.203125 },\n { x: 0.453125, y: 0.203125 },\n { x: 0.453125, y: 0.203125 },\n { x: 0.484375, y: 0.203125 },\n { x: 0.484375, y: 0.203125 },\n { x: 0.515625, y: 0.203125 },\n { x: 0.515625, y: 0.203125 },\n { x: 0.546875, y: 0.203125 },\n { x: 0.546875, y: 0.203125 },\n { x: 0.578125, y: 0.203125 },\n { x: 0.578125, y: 0.203125 },\n { x: 0.609375, y: 0.203125 },\n { x: 0.609375, y: 0.203125 },\n { x: 0.640625, y: 0.203125 },\n { x: 0.640625, y: 0.203125 },\n { x: 0.671875, y: 0.203125 },\n { x: 0.671875, y: 0.203125 },\n { x: 0.703125, y: 0.203125 },\n { x: 0.703125, y: 0.203125 },\n { x: 0.734375, y: 0.203125 },\n { x: 0.734375, y: 0.203125 },\n { x: 0.765625, y: 0.203125 },\n { x: 0.765625, y: 0.203125 },\n { x: 0.796875, y: 0.203125 },\n { x: 0.796875, y: 0.203125 },\n { x: 0.828125, y: 0.203125 },\n { x: 0.828125, y: 0.203125 },\n { x: 0.859375, y: 0.203125 },\n { x: 0.859375, y: 0.203125 },\n { x: 0.890625, y: 0.203125 },\n { x: 0.890625, y: 0.203125 },\n { x: 0.921875, y: 0.203125 },\n { x: 0.921875, y: 0.203125 },\n { x: 0.953125, y: 0.203125 },\n { x: 0.953125, y: 0.203125 },\n { x: 0.984375, y: 0.203125 },\n { x: 0.984375, y: 0.203125 },\n { x: 0.015625, y: 0.234375 },\n { x: 0.015625, y: 0.234375 },\n { x: 0.046875, y: 0.234375 },\n { x: 0.046875, y: 0.234375 },\n { x: 0.078125, y: 0.234375 },\n { x: 0.078125, y: 0.234375 },\n { x: 0.109375, y: 0.234375 },\n { x: 0.109375, y: 0.234375 },\n { x: 0.140625, y: 0.234375 },\n { x: 0.140625, y: 0.234375 },\n { x: 0.171875, y: 0.234375 },\n { x: 0.171875, y: 0.234375 },\n { x: 0.203125, y: 0.234375 },\n { x: 0.203125, y: 0.234375 },\n { x: 0.234375, y: 0.234375 },\n { x: 0.234375, y: 0.234375 },\n { x: 0.265625, y: 0.234375 },\n { x: 0.265625, y: 0.234375 },\n { x: 0.296875, y: 0.234375 },\n { x: 0.296875, y: 0.234375 },\n { x: 0.328125, y: 0.234375 },\n { x: 0.328125, y: 0.234375 },\n { x: 0.359375, y: 0.234375 },\n { x: 0.359375, y: 0.234375 },\n { x: 0.390625, y: 0.234375 },\n { x: 0.390625, y: 0.234375 },\n { x: 0.421875, y: 0.234375 },\n { x: 0.421875, y: 0.234375 },\n { x: 0.453125, y: 0.234375 },\n { x: 0.453125, y: 0.234375 },\n { x: 0.484375, y: 0.234375 },\n { x: 0.484375, y: 0.234375 },\n { x: 0.515625, y: 0.234375 },\n { x: 0.515625, y: 0.234375 },\n { x: 0.546875, y: 0.234375 },\n { x: 0.546875, y: 0.234375 },\n { x: 0.578125, y: 0.234375 },\n { x: 0.578125, y: 0.234375 },\n { x: 0.609375, y: 0.234375 },\n { x: 0.609375, y: 0.234375 },\n { x: 0.640625, y: 0.234375 },\n { x: 0.640625, y: 0.234375 },\n { x: 0.671875, y: 0.234375 },\n { x: 0.671875, y: 0.234375 },\n { x: 0.703125, y: 0.234375 },\n { x: 0.703125, y: 0.234375 },\n { x: 0.734375, y: 0.234375 },\n { x: 0.734375, y: 0.234375 },\n { x: 0.765625, y: 0.234375 },\n { x: 0.765625, y: 0.234375 },\n { x: 0.796875, y: 0.234375 },\n { x: 0.796875, y: 0.234375 },\n { x: 0.828125, y: 0.234375 },\n { x: 0.828125, y: 0.234375 },\n { x: 0.859375, y: 0.234375 },\n { x: 0.859375, y: 0.234375 },\n { x: 0.890625, y: 0.234375 },\n { x: 0.890625, y: 0.234375 },\n { x: 0.921875, y: 0.234375 },\n { x: 0.921875, y: 0.234375 },\n { x: 0.953125, y: 0.234375 },\n { x: 0.953125, y: 0.234375 },\n { x: 0.984375, y: 0.234375 },\n { x: 0.984375, y: 0.234375 },\n { x: 0.015625, y: 0.265625 },\n { x: 0.015625, y: 0.265625 },\n { x: 0.046875, y: 0.265625 },\n { x: 0.046875, y: 0.265625 },\n { x: 0.078125, y: 0.265625 },\n { x: 0.078125, y: 0.265625 },\n { x: 0.109375, y: 0.265625 },\n { x: 0.109375, y: 0.265625 },\n { x: 0.140625, y: 0.265625 },\n { x: 0.140625, y: 0.265625 },\n { x: 0.171875, y: 0.265625 },\n { x: 0.171875, y: 0.265625 },\n { x: 0.203125, y: 0.265625 },\n { x: 0.203125, y: 0.265625 },\n { x: 0.234375, y: 0.265625 },\n { x: 0.234375, y: 0.265625 },\n { x: 0.265625, y: 0.265625 },\n { x: 0.265625, y: 0.265625 },\n { x: 0.296875, y: 0.265625 },\n { x: 0.296875, y: 0.265625 },\n { x: 0.328125, y: 0.265625 },\n { x: 0.328125, y: 0.265625 },\n { x: 0.359375, y: 0.265625 },\n { x: 0.359375, y: 0.265625 },\n { x: 0.390625, y: 0.265625 },\n { x: 0.390625, y: 0.265625 },\n { x: 0.421875, y: 0.265625 },\n { x: 0.421875, y: 0.265625 },\n { x: 0.453125, y: 0.265625 },\n { x: 0.453125, y: 0.265625 },\n { x: 0.484375, y: 0.265625 },\n { x: 0.484375, y: 0.265625 },\n { x: 0.515625, y: 0.265625 },\n { x: 0.515625, y: 0.265625 },\n { x: 0.546875, y: 0.265625 },\n { x: 0.546875, y: 0.265625 },\n { x: 0.578125, y: 0.265625 },\n { x: 0.578125, y: 0.265625 },\n { x: 0.609375, y: 0.265625 },\n { x: 0.609375, y: 0.265625 },\n { x: 0.640625, y: 0.265625 },\n { x: 0.640625, y: 0.265625 },\n { x: 0.671875, y: 0.265625 },\n { x: 0.671875, y: 0.265625 },\n { x: 0.703125, y: 0.265625 },\n { x: 0.703125, y: 0.265625 },\n { x: 0.734375, y: 0.265625 },\n { x: 0.734375, y: 0.265625 },\n { x: 0.765625, y: 0.265625 },\n { x: 0.765625, y: 0.265625 },\n { x: 0.796875, y: 0.265625 },\n { x: 0.796875, y: 0.265625 },\n { x: 0.828125, y: 0.265625 },\n { x: 0.828125, y: 0.265625 },\n { x: 0.859375, y: 0.265625 },\n { x: 0.859375, y: 0.265625 },\n { x: 0.890625, y: 0.265625 },\n { x: 0.890625, y: 0.265625 },\n { x: 0.921875, y: 0.265625 },\n { x: 0.921875, y: 0.265625 },\n { x: 0.953125, y: 0.265625 },\n { x: 0.953125, y: 0.265625 },\n { x: 0.984375, y: 0.265625 },\n { x: 0.984375, y: 0.265625 },\n { x: 0.015625, y: 0.296875 },\n { x: 0.015625, y: 0.296875 },\n { x: 0.046875, y: 0.296875 },\n { x: 0.046875, y: 0.296875 },\n { x: 0.078125, y: 0.296875 },\n { x: 0.078125, y: 0.296875 },\n { x: 0.109375, y: 0.296875 },\n { x: 0.109375, y: 0.296875 },\n { x: 0.140625, y: 0.296875 },\n { x: 0.140625, y: 0.296875 },\n { x: 0.171875, y: 0.296875 },\n { x: 0.171875, y: 0.296875 },\n { x: 0.203125, y: 0.296875 },\n { x: 0.203125, y: 0.296875 },\n { x: 0.234375, y: 0.296875 },\n { x: 0.234375, y: 0.296875 },\n { x: 0.265625, y: 0.296875 },\n { x: 0.265625, y: 0.296875 },\n { x: 0.296875, y: 0.296875 },\n { x: 0.296875, y: 0.296875 },\n { x: 0.328125, y: 0.296875 },\n { x: 0.328125, y: 0.296875 },\n { x: 0.359375, y: 0.296875 },\n { x: 0.359375, y: 0.296875 },\n { x: 0.390625, y: 0.296875 },\n { x: 0.390625, y: 0.296875 },\n { x: 0.421875, y: 0.296875 },\n { x: 0.421875, y: 0.296875 },\n { x: 0.453125, y: 0.296875 },\n { x: 0.453125, y: 0.296875 },\n { x: 0.484375, y: 0.296875 },\n { x: 0.484375, y: 0.296875 },\n { x: 0.515625, y: 0.296875 },\n { x: 0.515625, y: 0.296875 },\n { x: 0.546875, y: 0.296875 },\n { x: 0.546875, y: 0.296875 },\n { x: 0.578125, y: 0.296875 },\n { x: 0.578125, y: 0.296875 },\n { x: 0.609375, y: 0.296875 },\n { x: 0.609375, y: 0.296875 },\n { x: 0.640625, y: 0.296875 },\n { x: 0.640625, y: 0.296875 },\n { x: 0.671875, y: 0.296875 },\n { x: 0.671875, y: 0.296875 },\n { x: 0.703125, y: 0.296875 },\n { x: 0.703125, y: 0.296875 },\n { x: 0.734375, y: 0.296875 },\n { x: 0.734375, y: 0.296875 },\n { x: 0.765625, y: 0.296875 },\n { x: 0.765625, y: 0.296875 },\n { x: 0.796875, y: 0.296875 },\n { x: 0.796875, y: 0.296875 },\n { x: 0.828125, y: 0.296875 },\n { x: 0.828125, y: 0.296875 },\n { x: 0.859375, y: 0.296875 },\n { x: 0.859375, y: 0.296875 },\n { x: 0.890625, y: 0.296875 },\n { x: 0.890625, y: 0.296875 },\n { x: 0.921875, y: 0.296875 },\n { x: 0.921875, y: 0.296875 },\n { x: 0.953125, y: 0.296875 },\n { x: 0.953125, y: 0.296875 },\n { x: 0.984375, y: 0.296875 },\n { x: 0.984375, y: 0.296875 },\n { x: 0.015625, y: 0.328125 },\n { x: 0.015625, y: 0.328125 },\n { x: 0.046875, y: 0.328125 },\n { x: 0.046875, y: 0.328125 },\n { x: 0.078125, y: 0.328125 },\n { x: 0.078125, y: 0.328125 },\n { x: 0.109375, y: 0.328125 },\n { x: 0.109375, y: 0.328125 },\n { x: 0.140625, y: 0.328125 },\n { x: 0.140625, y: 0.328125 },\n { x: 0.171875, y: 0.328125 },\n { x: 0.171875, y: 0.328125 },\n { x: 0.203125, y: 0.328125 },\n { x: 0.203125, y: 0.328125 },\n { x: 0.234375, y: 0.328125 },\n { x: 0.234375, y: 0.328125 },\n { x: 0.265625, y: 0.328125 },\n { x: 0.265625, y: 0.328125 },\n { x: 0.296875, y: 0.328125 },\n { x: 0.296875, y: 0.328125 },\n { x: 0.328125, y: 0.328125 },\n { x: 0.328125, y: 0.328125 },\n { x: 0.359375, y: 0.328125 },\n { x: 0.359375, y: 0.328125 },\n { x: 0.390625, y: 0.328125 },\n { x: 0.390625, y: 0.328125 },\n { x: 0.421875, y: 0.328125 },\n { x: 0.421875, y: 0.328125 },\n { x: 0.453125, y: 0.328125 },\n { x: 0.453125, y: 0.328125 },\n { x: 0.484375, y: 0.328125 },\n { x: 0.484375, y: 0.328125 },\n { x: 0.515625, y: 0.328125 },\n { x: 0.515625, y: 0.328125 },\n { x: 0.546875, y: 0.328125 },\n { x: 0.546875, y: 0.328125 },\n { x: 0.578125, y: 0.328125 },\n { x: 0.578125, y: 0.328125 },\n { x: 0.609375, y: 0.328125 },\n { x: 0.609375, y: 0.328125 },\n { x: 0.640625, y: 0.328125 },\n { x: 0.640625, y: 0.328125 },\n { x: 0.671875, y: 0.328125 },\n { x: 0.671875, y: 0.328125 },\n { x: 0.703125, y: 0.328125 },\n { x: 0.703125, y: 0.328125 },\n { x: 0.734375, y: 0.328125 },\n { x: 0.734375, y: 0.328125 },\n { x: 0.765625, y: 0.328125 },\n { x: 0.765625, y: 0.328125 },\n { x: 0.796875, y: 0.328125 },\n { x: 0.796875, y: 0.328125 },\n { x: 0.828125, y: 0.328125 },\n { x: 0.828125, y: 0.328125 },\n { x: 0.859375, y: 0.328125 },\n { x: 0.859375, y: 0.328125 },\n { x: 0.890625, y: 0.328125 },\n { x: 0.890625, y: 0.328125 },\n { x: 0.921875, y: 0.328125 },\n { x: 0.921875, y: 0.328125 },\n { x: 0.953125, y: 0.328125 },\n { x: 0.953125, y: 0.328125 },\n { x: 0.984375, y: 0.328125 },\n { x: 0.984375, y: 0.328125 },\n { x: 0.015625, y: 0.359375 },\n { x: 0.015625, y: 0.359375 },\n { x: 0.046875, y: 0.359375 },\n { x: 0.046875, y: 0.359375 },\n { x: 0.078125, y: 0.359375 },\n { x: 0.078125, y: 0.359375 },\n { x: 0.109375, y: 0.359375 },\n { x: 0.109375, y: 0.359375 },\n { x: 0.140625, y: 0.359375 },\n { x: 0.140625, y: 0.359375 },\n { x: 0.171875, y: 0.359375 },\n { x: 0.171875, y: 0.359375 },\n { x: 0.203125, y: 0.359375 },\n { x: 0.203125, y: 0.359375 },\n { x: 0.234375, y: 0.359375 },\n { x: 0.234375, y: 0.359375 },\n { x: 0.265625, y: 0.359375 },\n { x: 0.265625, y: 0.359375 },\n { x: 0.296875, y: 0.359375 },\n { x: 0.296875, y: 0.359375 },\n { x: 0.328125, y: 0.359375 },\n { x: 0.328125, y: 0.359375 },\n { x: 0.359375, y: 0.359375 },\n { x: 0.359375, y: 0.359375 },\n { x: 0.390625, y: 0.359375 },\n { x: 0.390625, y: 0.359375 },\n { x: 0.421875, y: 0.359375 },\n { x: 0.421875, y: 0.359375 },\n { x: 0.453125, y: 0.359375 },\n { x: 0.453125, y: 0.359375 },\n { x: 0.484375, y: 0.359375 },\n { x: 0.484375, y: 0.359375 },\n { x: 0.515625, y: 0.359375 },\n { x: 0.515625, y: 0.359375 },\n { x: 0.546875, y: 0.359375 },\n { x: 0.546875, y: 0.359375 },\n { x: 0.578125, y: 0.359375 },\n { x: 0.578125, y: 0.359375 },\n { x: 0.609375, y: 0.359375 },\n { x: 0.609375, y: 0.359375 },\n { x: 0.640625, y: 0.359375 },\n { x: 0.640625, y: 0.359375 },\n { x: 0.671875, y: 0.359375 },\n { x: 0.671875, y: 0.359375 },\n { x: 0.703125, y: 0.359375 },\n { x: 0.703125, y: 0.359375 },\n { x: 0.734375, y: 0.359375 },\n { x: 0.734375, y: 0.359375 },\n { x: 0.765625, y: 0.359375 },\n { x: 0.765625, y: 0.359375 },\n { x: 0.796875, y: 0.359375 },\n { x: 0.796875, y: 0.359375 },\n { x: 0.828125, y: 0.359375 },\n { x: 0.828125, y: 0.359375 },\n { x: 0.859375, y: 0.359375 },\n { x: 0.859375, y: 0.359375 },\n { x: 0.890625, y: 0.359375 },\n { x: 0.890625, y: 0.359375 },\n { x: 0.921875, y: 0.359375 },\n { x: 0.921875, y: 0.359375 },\n { x: 0.953125, y: 0.359375 },\n { x: 0.953125, y: 0.359375 },\n { x: 0.984375, y: 0.359375 },\n { x: 0.984375, y: 0.359375 },\n { x: 0.015625, y: 0.390625 },\n { x: 0.015625, y: 0.390625 },\n { x: 0.046875, y: 0.390625 },\n { x: 0.046875, y: 0.390625 },\n { x: 0.078125, y: 0.390625 },\n { x: 0.078125, y: 0.390625 },\n { x: 0.109375, y: 0.390625 },\n { x: 0.109375, y: 0.390625 },\n { x: 0.140625, y: 0.390625 },\n { x: 0.140625, y: 0.390625 },\n { x: 0.171875, y: 0.390625 },\n { x: 0.171875, y: 0.390625 },\n { x: 0.203125, y: 0.390625 },\n { x: 0.203125, y: 0.390625 },\n { x: 0.234375, y: 0.390625 },\n { x: 0.234375, y: 0.390625 },\n { x: 0.265625, y: 0.390625 },\n { x: 0.265625, y: 0.390625 },\n { x: 0.296875, y: 0.390625 },\n { x: 0.296875, y: 0.390625 },\n { x: 0.328125, y: 0.390625 },\n { x: 0.328125, y: 0.390625 },\n { x: 0.359375, y: 0.390625 },\n { x: 0.359375, y: 0.390625 },\n { x: 0.390625, y: 0.390625 },\n { x: 0.390625, y: 0.390625 },\n { x: 0.421875, y: 0.390625 },\n { x: 0.421875, y: 0.390625 },\n { x: 0.453125, y: 0.390625 },\n { x: 0.453125, y: 0.390625 },\n { x: 0.484375, y: 0.390625 },\n { x: 0.484375, y: 0.390625 },\n { x: 0.515625, y: 0.390625 },\n { x: 0.515625, y: 0.390625 },\n { x: 0.546875, y: 0.390625 },\n { x: 0.546875, y: 0.390625 },\n { x: 0.578125, y: 0.390625 },\n { x: 0.578125, y: 0.390625 },\n { x: 0.609375, y: 0.390625 },\n { x: 0.609375, y: 0.390625 },\n { x: 0.640625, y: 0.390625 },\n { x: 0.640625, y: 0.390625 },\n { x: 0.671875, y: 0.390625 },\n { x: 0.671875, y: 0.390625 },\n { x: 0.703125, y: 0.390625 },\n { x: 0.703125, y: 0.390625 },\n { x: 0.734375, y: 0.390625 },\n { x: 0.734375, y: 0.390625 },\n { x: 0.765625, y: 0.390625 },\n { x: 0.765625, y: 0.390625 },\n { x: 0.796875, y: 0.390625 },\n { x: 0.796875, y: 0.390625 },\n { x: 0.828125, y: 0.390625 },\n { x: 0.828125, y: 0.390625 },\n { x: 0.859375, y: 0.390625 },\n { x: 0.859375, y: 0.390625 },\n { x: 0.890625, y: 0.390625 },\n { x: 0.890625, y: 0.390625 },\n { x: 0.921875, y: 0.390625 },\n { x: 0.921875, y: 0.390625 },\n { x: 0.953125, y: 0.390625 },\n { x: 0.953125, y: 0.390625 },\n { x: 0.984375, y: 0.390625 },\n { x: 0.984375, y: 0.390625 },\n { x: 0.015625, y: 0.421875 },\n { x: 0.015625, y: 0.421875 },\n { x: 0.046875, y: 0.421875 },\n { x: 0.046875, y: 0.421875 },\n { x: 0.078125, y: 0.421875 },\n { x: 0.078125, y: 0.421875 },\n { x: 0.109375, y: 0.421875 },\n { x: 0.109375, y: 0.421875 },\n { x: 0.140625, y: 0.421875 },\n { x: 0.140625, y: 0.421875 },\n { x: 0.171875, y: 0.421875 },\n { x: 0.171875, y: 0.421875 },\n { x: 0.203125, y: 0.421875 },\n { x: 0.203125, y: 0.421875 },\n { x: 0.234375, y: 0.421875 },\n { x: 0.234375, y: 0.421875 },\n { x: 0.265625, y: 0.421875 },\n { x: 0.265625, y: 0.421875 },\n { x: 0.296875, y: 0.421875 },\n { x: 0.296875, y: 0.421875 },\n { x: 0.328125, y: 0.421875 },\n { x: 0.328125, y: 0.421875 },\n { x: 0.359375, y: 0.421875 },\n { x: 0.359375, y: 0.421875 },\n { x: 0.390625, y: 0.421875 },\n { x: 0.390625, y: 0.421875 },\n { x: 0.421875, y: 0.421875 },\n { x: 0.421875, y: 0.421875 },\n { x: 0.453125, y: 0.421875 },\n { x: 0.453125, y: 0.421875 },\n { x: 0.484375, y: 0.421875 },\n { x: 0.484375, y: 0.421875 },\n { x: 0.515625, y: 0.421875 },\n { x: 0.515625, y: 0.421875 },\n { x: 0.546875, y: 0.421875 },\n { x: 0.546875, y: 0.421875 },\n { x: 0.578125, y: 0.421875 },\n { x: 0.578125, y: 0.421875 },\n { x: 0.609375, y: 0.421875 },\n { x: 0.609375, y: 0.421875 },\n { x: 0.640625, y: 0.421875 },\n { x: 0.640625, y: 0.421875 },\n { x: 0.671875, y: 0.421875 },\n { x: 0.671875, y: 0.421875 },\n { x: 0.703125, y: 0.421875 },\n { x: 0.703125, y: 0.421875 },\n { x: 0.734375, y: 0.421875 },\n { x: 0.734375, y: 0.421875 },\n { x: 0.765625, y: 0.421875 },\n { x: 0.765625, y: 0.421875 },\n { x: 0.796875, y: 0.421875 },\n { x: 0.796875, y: 0.421875 },\n { x: 0.828125, y: 0.421875 },\n { x: 0.828125, y: 0.421875 },\n { x: 0.859375, y: 0.421875 },\n { x: 0.859375, y: 0.421875 },\n { x: 0.890625, y: 0.421875 },\n { x: 0.890625, y: 0.421875 },\n { x: 0.921875, y: 0.421875 },\n { x: 0.921875, y: 0.421875 },\n { x: 0.953125, y: 0.421875 },\n { x: 0.953125, y: 0.421875 },\n { x: 0.984375, y: 0.421875 },\n { x: 0.984375, y: 0.421875 },\n { x: 0.015625, y: 0.453125 },\n { x: 0.015625, y: 0.453125 },\n { x: 0.046875, y: 0.453125 },\n { x: 0.046875, y: 0.453125 },\n { x: 0.078125, y: 0.453125 },\n { x: 0.078125, y: 0.453125 },\n { x: 0.109375, y: 0.453125 },\n { x: 0.109375, y: 0.453125 },\n { x: 0.140625, y: 0.453125 },\n { x: 0.140625, y: 0.453125 },\n { x: 0.171875, y: 0.453125 },\n { x: 0.171875, y: 0.453125 },\n { x: 0.203125, y: 0.453125 },\n { x: 0.203125, y: 0.453125 },\n { x: 0.234375, y: 0.453125 },\n { x: 0.234375, y: 0.453125 },\n { x: 0.265625, y: 0.453125 },\n { x: 0.265625, y: 0.453125 },\n { x: 0.296875, y: 0.453125 },\n { x: 0.296875, y: 0.453125 },\n { x: 0.328125, y: 0.453125 },\n { x: 0.328125, y: 0.453125 },\n { x: 0.359375, y: 0.453125 },\n { x: 0.359375, y: 0.453125 },\n { x: 0.390625, y: 0.453125 },\n { x: 0.390625, y: 0.453125 },\n { x: 0.421875, y: 0.453125 },\n { x: 0.421875, y: 0.453125 },\n { x: 0.453125, y: 0.453125 },\n { x: 0.453125, y: 0.453125 },\n { x: 0.484375, y: 0.453125 },\n { x: 0.484375, y: 0.453125 },\n { x: 0.515625, y: 0.453125 },\n { x: 0.515625, y: 0.453125 },\n { x: 0.546875, y: 0.453125 },\n { x: 0.546875, y: 0.453125 },\n { x: 0.578125, y: 0.453125 },\n { x: 0.578125, y: 0.453125 },\n { x: 0.609375, y: 0.453125 },\n { x: 0.609375, y: 0.453125 },\n { x: 0.640625, y: 0.453125 },\n { x: 0.640625, y: 0.453125 },\n { x: 0.671875, y: 0.453125 },\n { x: 0.671875, y: 0.453125 },\n { x: 0.703125, y: 0.453125 },\n { x: 0.703125, y: 0.453125 },\n { x: 0.734375, y: 0.453125 },\n { x: 0.734375, y: 0.453125 },\n { x: 0.765625, y: 0.453125 },\n { x: 0.765625, y: 0.453125 },\n { x: 0.796875, y: 0.453125 },\n { x: 0.796875, y: 0.453125 },\n { x: 0.828125, y: 0.453125 },\n { x: 0.828125, y: 0.453125 },\n { x: 0.859375, y: 0.453125 },\n { x: 0.859375, y: 0.453125 },\n { x: 0.890625, y: 0.453125 },\n { x: 0.890625, y: 0.453125 },\n { x: 0.921875, y: 0.453125 },\n { x: 0.921875, y: 0.453125 },\n { x: 0.953125, y: 0.453125 },\n { x: 0.953125, y: 0.453125 },\n { x: 0.984375, y: 0.453125 },\n { x: 0.984375, y: 0.453125 },\n { x: 0.015625, y: 0.484375 },\n { x: 0.015625, y: 0.484375 },\n { x: 0.046875, y: 0.484375 },\n { x: 0.046875, y: 0.484375 },\n { x: 0.078125, y: 0.484375 },\n { x: 0.078125, y: 0.484375 },\n { x: 0.109375, y: 0.484375 },\n { x: 0.109375, y: 0.484375 },\n { x: 0.140625, y: 0.484375 },\n { x: 0.140625, y: 0.484375 },\n { x: 0.171875, y: 0.484375 },\n { x: 0.171875, y: 0.484375 },\n { x: 0.203125, y: 0.484375 },\n { x: 0.203125, y: 0.484375 },\n { x: 0.234375, y: 0.484375 },\n { x: 0.234375, y: 0.484375 },\n { x: 0.265625, y: 0.484375 },\n { x: 0.265625, y: 0.484375 },\n { x: 0.296875, y: 0.484375 },\n { x: 0.296875, y: 0.484375 },\n { x: 0.328125, y: 0.484375 },\n { x: 0.328125, y: 0.484375 },\n { x: 0.359375, y: 0.484375 },\n { x: 0.359375, y: 0.484375 },\n { x: 0.390625, y: 0.484375 },\n { x: 0.390625, y: 0.484375 },\n { x: 0.421875, y: 0.484375 },\n { x: 0.421875, y: 0.484375 },\n { x: 0.453125, y: 0.484375 },\n { x: 0.453125, y: 0.484375 },\n { x: 0.484375, y: 0.484375 },\n { x: 0.484375, y: 0.484375 },\n { x: 0.515625, y: 0.484375 },\n { x: 0.515625, y: 0.484375 },\n { x: 0.546875, y: 0.484375 },\n { x: 0.546875, y: 0.484375 },\n { x: 0.578125, y: 0.484375 },\n { x: 0.578125, y: 0.484375 },\n { x: 0.609375, y: 0.484375 },\n { x: 0.609375, y: 0.484375 },\n { x: 0.640625, y: 0.484375 },\n { x: 0.640625, y: 0.484375 },\n { x: 0.671875, y: 0.484375 },\n { x: 0.671875, y: 0.484375 },\n { x: 0.703125, y: 0.484375 },\n { x: 0.703125, y: 0.484375 },\n { x: 0.734375, y: 0.484375 },\n { x: 0.734375, y: 0.484375 },\n { x: 0.765625, y: 0.484375 },\n { x: 0.765625, y: 0.484375 },\n { x: 0.796875, y: 0.484375 },\n { x: 0.796875, y: 0.484375 },\n { x: 0.828125, y: 0.484375 },\n { x: 0.828125, y: 0.484375 },\n { x: 0.859375, y: 0.484375 },\n { x: 0.859375, y: 0.484375 },\n { x: 0.890625, y: 0.484375 },\n { x: 0.890625, y: 0.484375 },\n { x: 0.921875, y: 0.484375 },\n { x: 0.921875, y: 0.484375 },\n { x: 0.953125, y: 0.484375 },\n { x: 0.953125, y: 0.484375 },\n { x: 0.984375, y: 0.484375 },\n { x: 0.984375, y: 0.484375 },\n { x: 0.015625, y: 0.515625 },\n { x: 0.015625, y: 0.515625 },\n { x: 0.046875, y: 0.515625 },\n { x: 0.046875, y: 0.515625 },\n { x: 0.078125, y: 0.515625 },\n { x: 0.078125, y: 0.515625 },\n { x: 0.109375, y: 0.515625 },\n { x: 0.109375, y: 0.515625 },\n { x: 0.140625, y: 0.515625 },\n { x: 0.140625, y: 0.515625 },\n { x: 0.171875, y: 0.515625 },\n { x: 0.171875, y: 0.515625 },\n { x: 0.203125, y: 0.515625 },\n { x: 0.203125, y: 0.515625 },\n { x: 0.234375, y: 0.515625 },\n { x: 0.234375, y: 0.515625 },\n { x: 0.265625, y: 0.515625 },\n { x: 0.265625, y: 0.515625 },\n { x: 0.296875, y: 0.515625 },\n { x: 0.296875, y: 0.515625 },\n { x: 0.328125, y: 0.515625 },\n { x: 0.328125, y: 0.515625 },\n { x: 0.359375, y: 0.515625 },\n { x: 0.359375, y: 0.515625 },\n { x: 0.390625, y: 0.515625 },\n { x: 0.390625, y: 0.515625 },\n { x: 0.421875, y: 0.515625 },\n { x: 0.421875, y: 0.515625 },\n { x: 0.453125, y: 0.515625 },\n { x: 0.453125, y: 0.515625 },\n { x: 0.484375, y: 0.515625 },\n { x: 0.484375, y: 0.515625 },\n { x: 0.515625, y: 0.515625 },\n { x: 0.515625, y: 0.515625 },\n { x: 0.546875, y: 0.515625 },\n { x: 0.546875, y: 0.515625 },\n { x: 0.578125, y: 0.515625 },\n { x: 0.578125, y: 0.515625 },\n { x: 0.609375, y: 0.515625 },\n { x: 0.609375, y: 0.515625 },\n { x: 0.640625, y: 0.515625 },\n { x: 0.640625, y: 0.515625 },\n { x: 0.671875, y: 0.515625 },\n { x: 0.671875, y: 0.515625 },\n { x: 0.703125, y: 0.515625 },\n { x: 0.703125, y: 0.515625 },\n { x: 0.734375, y: 0.515625 },\n { x: 0.734375, y: 0.515625 },\n { x: 0.765625, y: 0.515625 },\n { x: 0.765625, y: 0.515625 },\n { x: 0.796875, y: 0.515625 },\n { x: 0.796875, y: 0.515625 },\n { x: 0.828125, y: 0.515625 },\n { x: 0.828125, y: 0.515625 },\n { x: 0.859375, y: 0.515625 },\n { x: 0.859375, y: 0.515625 },\n { x: 0.890625, y: 0.515625 },\n { x: 0.890625, y: 0.515625 },\n { x: 0.921875, y: 0.515625 },\n { x: 0.921875, y: 0.515625 },\n { x: 0.953125, y: 0.515625 },\n { x: 0.953125, y: 0.515625 },\n { x: 0.984375, y: 0.515625 },\n { x: 0.984375, y: 0.515625 },\n { x: 0.015625, y: 0.546875 },\n { x: 0.015625, y: 0.546875 },\n { x: 0.046875, y: 0.546875 },\n { x: 0.046875, y: 0.546875 },\n { x: 0.078125, y: 0.546875 },\n { x: 0.078125, y: 0.546875 },\n { x: 0.109375, y: 0.546875 },\n { x: 0.109375, y: 0.546875 },\n { x: 0.140625, y: 0.546875 },\n { x: 0.140625, y: 0.546875 },\n { x: 0.171875, y: 0.546875 },\n { x: 0.171875, y: 0.546875 },\n { x: 0.203125, y: 0.546875 },\n { x: 0.203125, y: 0.546875 },\n { x: 0.234375, y: 0.546875 },\n { x: 0.234375, y: 0.546875 },\n { x: 0.265625, y: 0.546875 },\n { x: 0.265625, y: 0.546875 },\n { x: 0.296875, y: 0.546875 },\n { x: 0.296875, y: 0.546875 },\n { x: 0.328125, y: 0.546875 },\n { x: 0.328125, y: 0.546875 },\n { x: 0.359375, y: 0.546875 },\n { x: 0.359375, y: 0.546875 },\n { x: 0.390625, y: 0.546875 },\n { x: 0.390625, y: 0.546875 },\n { x: 0.421875, y: 0.546875 },\n { x: 0.421875, y: 0.546875 },\n { x: 0.453125, y: 0.546875 },\n { x: 0.453125, y: 0.546875 },\n { x: 0.484375, y: 0.546875 },\n { x: 0.484375, y: 0.546875 },\n { x: 0.515625, y: 0.546875 },\n { x: 0.515625, y: 0.546875 },\n { x: 0.546875, y: 0.546875 },\n { x: 0.546875, y: 0.546875 },\n { x: 0.578125, y: 0.546875 },\n { x: 0.578125, y: 0.546875 },\n { x: 0.609375, y: 0.546875 },\n { x: 0.609375, y: 0.546875 },\n { x: 0.640625, y: 0.546875 },\n { x: 0.640625, y: 0.546875 },\n { x: 0.671875, y: 0.546875 },\n { x: 0.671875, y: 0.546875 },\n { x: 0.703125, y: 0.546875 },\n { x: 0.703125, y: 0.546875 },\n { x: 0.734375, y: 0.546875 },\n { x: 0.734375, y: 0.546875 },\n { x: 0.765625, y: 0.546875 },\n { x: 0.765625, y: 0.546875 },\n { x: 0.796875, y: 0.546875 },\n { x: 0.796875, y: 0.546875 },\n { x: 0.828125, y: 0.546875 },\n { x: 0.828125, y: 0.546875 },\n { x: 0.859375, y: 0.546875 },\n { x: 0.859375, y: 0.546875 },\n { x: 0.890625, y: 0.546875 },\n { x: 0.890625, y: 0.546875 },\n { x: 0.921875, y: 0.546875 },\n { x: 0.921875, y: 0.546875 },\n { x: 0.953125, y: 0.546875 },\n { x: 0.953125, y: 0.546875 },\n { x: 0.984375, y: 0.546875 },\n { x: 0.984375, y: 0.546875 },\n { x: 0.015625, y: 0.578125 },\n { x: 0.015625, y: 0.578125 },\n { x: 0.046875, y: 0.578125 },\n { x: 0.046875, y: 0.578125 },\n { x: 0.078125, y: 0.578125 },\n { x: 0.078125, y: 0.578125 },\n { x: 0.109375, y: 0.578125 },\n { x: 0.109375, y: 0.578125 },\n { x: 0.140625, y: 0.578125 },\n { x: 0.140625, y: 0.578125 },\n { x: 0.171875, y: 0.578125 },\n { x: 0.171875, y: 0.578125 },\n { x: 0.203125, y: 0.578125 },\n { x: 0.203125, y: 0.578125 },\n { x: 0.234375, y: 0.578125 },\n { x: 0.234375, y: 0.578125 },\n { x: 0.265625, y: 0.578125 },\n { x: 0.265625, y: 0.578125 },\n { x: 0.296875, y: 0.578125 },\n { x: 0.296875, y: 0.578125 },\n { x: 0.328125, y: 0.578125 },\n { x: 0.328125, y: 0.578125 },\n { x: 0.359375, y: 0.578125 },\n { x: 0.359375, y: 0.578125 },\n { x: 0.390625, y: 0.578125 },\n { x: 0.390625, y: 0.578125 },\n { x: 0.421875, y: 0.578125 },\n { x: 0.421875, y: 0.578125 },\n { x: 0.453125, y: 0.578125 },\n { x: 0.453125, y: 0.578125 },\n { x: 0.484375, y: 0.578125 },\n { x: 0.484375, y: 0.578125 },\n { x: 0.515625, y: 0.578125 },\n { x: 0.515625, y: 0.578125 },\n { x: 0.546875, y: 0.578125 },\n { x: 0.546875, y: 0.578125 },\n { x: 0.578125, y: 0.578125 },\n { x: 0.578125, y: 0.578125 },\n { x: 0.609375, y: 0.578125 },\n { x: 0.609375, y: 0.578125 },\n { x: 0.640625, y: 0.578125 },\n { x: 0.640625, y: 0.578125 },\n { x: 0.671875, y: 0.578125 },\n { x: 0.671875, y: 0.578125 },\n { x: 0.703125, y: 0.578125 },\n { x: 0.703125, y: 0.578125 },\n { x: 0.734375, y: 0.578125 },\n { x: 0.734375, y: 0.578125 },\n { x: 0.765625, y: 0.578125 },\n { x: 0.765625, y: 0.578125 },\n { x: 0.796875, y: 0.578125 },\n { x: 0.796875, y: 0.578125 },\n { x: 0.828125, y: 0.578125 },\n { x: 0.828125, y: 0.578125 },\n { x: 0.859375, y: 0.578125 },\n { x: 0.859375, y: 0.578125 },\n { x: 0.890625, y: 0.578125 },\n { x: 0.890625, y: 0.578125 },\n { x: 0.921875, y: 0.578125 },\n { x: 0.921875, y: 0.578125 },\n { x: 0.953125, y: 0.578125 },\n { x: 0.953125, y: 0.578125 },\n { x: 0.984375, y: 0.578125 },\n { x: 0.984375, y: 0.578125 },\n { x: 0.015625, y: 0.609375 },\n { x: 0.015625, y: 0.609375 },\n { x: 0.046875, y: 0.609375 },\n { x: 0.046875, y: 0.609375 },\n { x: 0.078125, y: 0.609375 },\n { x: 0.078125, y: 0.609375 },\n { x: 0.109375, y: 0.609375 },\n { x: 0.109375, y: 0.609375 },\n { x: 0.140625, y: 0.609375 },\n { x: 0.140625, y: 0.609375 },\n { x: 0.171875, y: 0.609375 },\n { x: 0.171875, y: 0.609375 },\n { x: 0.203125, y: 0.609375 },\n { x: 0.203125, y: 0.609375 },\n { x: 0.234375, y: 0.609375 },\n { x: 0.234375, y: 0.609375 },\n { x: 0.265625, y: 0.609375 },\n { x: 0.265625, y: 0.609375 },\n { x: 0.296875, y: 0.609375 },\n { x: 0.296875, y: 0.609375 },\n { x: 0.328125, y: 0.609375 },\n { x: 0.328125, y: 0.609375 },\n { x: 0.359375, y: 0.609375 },\n { x: 0.359375, y: 0.609375 },\n { x: 0.390625, y: 0.609375 },\n { x: 0.390625, y: 0.609375 },\n { x: 0.421875, y: 0.609375 },\n { x: 0.421875, y: 0.609375 },\n { x: 0.453125, y: 0.609375 },\n { x: 0.453125, y: 0.609375 },\n { x: 0.484375, y: 0.609375 },\n { x: 0.484375, y: 0.609375 },\n { x: 0.515625, y: 0.609375 },\n { x: 0.515625, y: 0.609375 },\n { x: 0.546875, y: 0.609375 },\n { x: 0.546875, y: 0.609375 },\n { x: 0.578125, y: 0.609375 },\n { x: 0.578125, y: 0.609375 },\n { x: 0.609375, y: 0.609375 },\n { x: 0.609375, y: 0.609375 },\n { x: 0.640625, y: 0.609375 },\n { x: 0.640625, y: 0.609375 },\n { x: 0.671875, y: 0.609375 },\n { x: 0.671875, y: 0.609375 },\n { x: 0.703125, y: 0.609375 },\n { x: 0.703125, y: 0.609375 },\n { x: 0.734375, y: 0.609375 },\n { x: 0.734375, y: 0.609375 },\n { x: 0.765625, y: 0.609375 },\n { x: 0.765625, y: 0.609375 },\n { x: 0.796875, y: 0.609375 },\n { x: 0.796875, y: 0.609375 },\n { x: 0.828125, y: 0.609375 },\n { x: 0.828125, y: 0.609375 },\n { x: 0.859375, y: 0.609375 },\n { x: 0.859375, y: 0.609375 },\n { x: 0.890625, y: 0.609375 },\n { x: 0.890625, y: 0.609375 },\n { x: 0.921875, y: 0.609375 },\n { x: 0.921875, y: 0.609375 },\n { x: 0.953125, y: 0.609375 },\n { x: 0.953125, y: 0.609375 },\n { x: 0.984375, y: 0.609375 },\n { x: 0.984375, y: 0.609375 },\n { x: 0.015625, y: 0.640625 },\n { x: 0.015625, y: 0.640625 },\n { x: 0.046875, y: 0.640625 },\n { x: 0.046875, y: 0.640625 },\n { x: 0.078125, y: 0.640625 },\n { x: 0.078125, y: 0.640625 },\n { x: 0.109375, y: 0.640625 },\n { x: 0.109375, y: 0.640625 },\n { x: 0.140625, y: 0.640625 },\n { x: 0.140625, y: 0.640625 },\n { x: 0.171875, y: 0.640625 },\n { x: 0.171875, y: 0.640625 },\n { x: 0.203125, y: 0.640625 },\n { x: 0.203125, y: 0.640625 },\n { x: 0.234375, y: 0.640625 },\n { x: 0.234375, y: 0.640625 },\n { x: 0.265625, y: 0.640625 },\n { x: 0.265625, y: 0.640625 },\n { x: 0.296875, y: 0.640625 },\n { x: 0.296875, y: 0.640625 },\n { x: 0.328125, y: 0.640625 },\n { x: 0.328125, y: 0.640625 },\n { x: 0.359375, y: 0.640625 },\n { x: 0.359375, y: 0.640625 },\n { x: 0.390625, y: 0.640625 },\n { x: 0.390625, y: 0.640625 },\n { x: 0.421875, y: 0.640625 },\n { x: 0.421875, y: 0.640625 },\n { x: 0.453125, y: 0.640625 },\n { x: 0.453125, y: 0.640625 },\n { x: 0.484375, y: 0.640625 },\n { x: 0.484375, y: 0.640625 },\n { x: 0.515625, y: 0.640625 },\n { x: 0.515625, y: 0.640625 },\n { x: 0.546875, y: 0.640625 },\n { x: 0.546875, y: 0.640625 },\n { x: 0.578125, y: 0.640625 },\n { x: 0.578125, y: 0.640625 },\n { x: 0.609375, y: 0.640625 },\n { x: 0.609375, y: 0.640625 },\n { x: 0.640625, y: 0.640625 },\n { x: 0.640625, y: 0.640625 },\n { x: 0.671875, y: 0.640625 },\n { x: 0.671875, y: 0.640625 },\n { x: 0.703125, y: 0.640625 },\n { x: 0.703125, y: 0.640625 },\n { x: 0.734375, y: 0.640625 },\n { x: 0.734375, y: 0.640625 },\n { x: 0.765625, y: 0.640625 },\n { x: 0.765625, y: 0.640625 },\n { x: 0.796875, y: 0.640625 },\n { x: 0.796875, y: 0.640625 },\n { x: 0.828125, y: 0.640625 },\n { x: 0.828125, y: 0.640625 },\n { x: 0.859375, y: 0.640625 },\n { x: 0.859375, y: 0.640625 },\n { x: 0.890625, y: 0.640625 },\n { x: 0.890625, y: 0.640625 },\n { x: 0.921875, y: 0.640625 },\n { x: 0.921875, y: 0.640625 },\n { x: 0.953125, y: 0.640625 },\n { x: 0.953125, y: 0.640625 },\n { x: 0.984375, y: 0.640625 },\n { x: 0.984375, y: 0.640625 },\n { x: 0.015625, y: 0.671875 },\n { x: 0.015625, y: 0.671875 },\n { x: 0.046875, y: 0.671875 },\n { x: 0.046875, y: 0.671875 },\n { x: 0.078125, y: 0.671875 },\n { x: 0.078125, y: 0.671875 },\n { x: 0.109375, y: 0.671875 },\n { x: 0.109375, y: 0.671875 },\n { x: 0.140625, y: 0.671875 },\n { x: 0.140625, y: 0.671875 },\n { x: 0.171875, y: 0.671875 },\n { x: 0.171875, y: 0.671875 },\n { x: 0.203125, y: 0.671875 },\n { x: 0.203125, y: 0.671875 },\n { x: 0.234375, y: 0.671875 },\n { x: 0.234375, y: 0.671875 },\n { x: 0.265625, y: 0.671875 },\n { x: 0.265625, y: 0.671875 },\n { x: 0.296875, y: 0.671875 },\n { x: 0.296875, y: 0.671875 },\n { x: 0.328125, y: 0.671875 },\n { x: 0.328125, y: 0.671875 },\n { x: 0.359375, y: 0.671875 },\n { x: 0.359375, y: 0.671875 },\n { x: 0.390625, y: 0.671875 },\n { x: 0.390625, y: 0.671875 },\n { x: 0.421875, y: 0.671875 },\n { x: 0.421875, y: 0.671875 },\n { x: 0.453125, y: 0.671875 },\n { x: 0.453125, y: 0.671875 },\n { x: 0.484375, y: 0.671875 },\n { x: 0.484375, y: 0.671875 },\n { x: 0.515625, y: 0.671875 },\n { x: 0.515625, y: 0.671875 },\n { x: 0.546875, y: 0.671875 },\n { x: 0.546875, y: 0.671875 },\n { x: 0.578125, y: 0.671875 },\n { x: 0.578125, y: 0.671875 },\n { x: 0.609375, y: 0.671875 },\n { x: 0.609375, y: 0.671875 },\n { x: 0.640625, y: 0.671875 },\n { x: 0.640625, y: 0.671875 },\n { x: 0.671875, y: 0.671875 },\n { x: 0.671875, y: 0.671875 },\n { x: 0.703125, y: 0.671875 },\n { x: 0.703125, y: 0.671875 },\n { x: 0.734375, y: 0.671875 },\n { x: 0.734375, y: 0.671875 },\n { x: 0.765625, y: 0.671875 },\n { x: 0.765625, y: 0.671875 },\n { x: 0.796875, y: 0.671875 },\n { x: 0.796875, y: 0.671875 },\n { x: 0.828125, y: 0.671875 },\n { x: 0.828125, y: 0.671875 },\n { x: 0.859375, y: 0.671875 },\n { x: 0.859375, y: 0.671875 },\n { x: 0.890625, y: 0.671875 },\n { x: 0.890625, y: 0.671875 },\n { x: 0.921875, y: 0.671875 },\n { x: 0.921875, y: 0.671875 },\n { x: 0.953125, y: 0.671875 },\n { x: 0.953125, y: 0.671875 },\n { x: 0.984375, y: 0.671875 },\n { x: 0.984375, y: 0.671875 },\n { x: 0.015625, y: 0.703125 },\n { x: 0.015625, y: 0.703125 },\n { x: 0.046875, y: 0.703125 },\n { x: 0.046875, y: 0.703125 },\n { x: 0.078125, y: 0.703125 },\n { x: 0.078125, y: 0.703125 },\n { x: 0.109375, y: 0.703125 },\n { x: 0.109375, y: 0.703125 },\n { x: 0.140625, y: 0.703125 },\n { x: 0.140625, y: 0.703125 },\n { x: 0.171875, y: 0.703125 },\n { x: 0.171875, y: 0.703125 },\n { x: 0.203125, y: 0.703125 },\n { x: 0.203125, y: 0.703125 },\n { x: 0.234375, y: 0.703125 },\n { x: 0.234375, y: 0.703125 },\n { x: 0.265625, y: 0.703125 },\n { x: 0.265625, y: 0.703125 },\n { x: 0.296875, y: 0.703125 },\n { x: 0.296875, y: 0.703125 },\n { x: 0.328125, y: 0.703125 },\n { x: 0.328125, y: 0.703125 },\n { x: 0.359375, y: 0.703125 },\n { x: 0.359375, y: 0.703125 },\n { x: 0.390625, y: 0.703125 },\n { x: 0.390625, y: 0.703125 },\n { x: 0.421875, y: 0.703125 },\n { x: 0.421875, y: 0.703125 },\n { x: 0.453125, y: 0.703125 },\n { x: 0.453125, y: 0.703125 },\n { x: 0.484375, y: 0.703125 },\n { x: 0.484375, y: 0.703125 },\n { x: 0.515625, y: 0.703125 },\n { x: 0.515625, y: 0.703125 },\n { x: 0.546875, y: 0.703125 },\n { x: 0.546875, y: 0.703125 },\n { x: 0.578125, y: 0.703125 },\n { x: 0.578125, y: 0.703125 },\n { x: 0.609375, y: 0.703125 },\n { x: 0.609375, y: 0.703125 },\n { x: 0.640625, y: 0.703125 },\n { x: 0.640625, y: 0.703125 },\n { x: 0.671875, y: 0.703125 },\n { x: 0.671875, y: 0.703125 },\n { x: 0.703125, y: 0.703125 },\n { x: 0.703125, y: 0.703125 },\n { x: 0.734375, y: 0.703125 },\n { x: 0.734375, y: 0.703125 },\n { x: 0.765625, y: 0.703125 },\n { x: 0.765625, y: 0.703125 },\n { x: 0.796875, y: 0.703125 },\n { x: 0.796875, y: 0.703125 },\n { x: 0.828125, y: 0.703125 },\n { x: 0.828125, y: 0.703125 },\n { x: 0.859375, y: 0.703125 },\n { x: 0.859375, y: 0.703125 },\n { x: 0.890625, y: 0.703125 },\n { x: 0.890625, y: 0.703125 },\n { x: 0.921875, y: 0.703125 },\n { x: 0.921875, y: 0.703125 },\n { x: 0.953125, y: 0.703125 },\n { x: 0.953125, y: 0.703125 },\n { x: 0.984375, y: 0.703125 },\n { x: 0.984375, y: 0.703125 },\n { x: 0.015625, y: 0.734375 },\n { x: 0.015625, y: 0.734375 },\n { x: 0.046875, y: 0.734375 },\n { x: 0.046875, y: 0.734375 },\n { x: 0.078125, y: 0.734375 },\n { x: 0.078125, y: 0.734375 },\n { x: 0.109375, y: 0.734375 },\n { x: 0.109375, y: 0.734375 },\n { x: 0.140625, y: 0.734375 },\n { x: 0.140625, y: 0.734375 },\n { x: 0.171875, y: 0.734375 },\n { x: 0.171875, y: 0.734375 },\n { x: 0.203125, y: 0.734375 },\n { x: 0.203125, y: 0.734375 },\n { x: 0.234375, y: 0.734375 },\n { x: 0.234375, y: 0.734375 },\n { x: 0.265625, y: 0.734375 },\n { x: 0.265625, y: 0.734375 },\n { x: 0.296875, y: 0.734375 },\n { x: 0.296875, y: 0.734375 },\n { x: 0.328125, y: 0.734375 },\n { x: 0.328125, y: 0.734375 },\n { x: 0.359375, y: 0.734375 },\n { x: 0.359375, y: 0.734375 },\n { x: 0.390625, y: 0.734375 },\n { x: 0.390625, y: 0.734375 },\n { x: 0.421875, y: 0.734375 },\n { x: 0.421875, y: 0.734375 },\n { x: 0.453125, y: 0.734375 },\n { x: 0.453125, y: 0.734375 },\n { x: 0.484375, y: 0.734375 },\n { x: 0.484375, y: 0.734375 },\n { x: 0.515625, y: 0.734375 },\n { x: 0.515625, y: 0.734375 },\n { x: 0.546875, y: 0.734375 },\n { x: 0.546875, y: 0.734375 },\n { x: 0.578125, y: 0.734375 },\n { x: 0.578125, y: 0.734375 },\n { x: 0.609375, y: 0.734375 },\n { x: 0.609375, y: 0.734375 },\n { x: 0.640625, y: 0.734375 },\n { x: 0.640625, y: 0.734375 },\n { x: 0.671875, y: 0.734375 },\n { x: 0.671875, y: 0.734375 },\n { x: 0.703125, y: 0.734375 },\n { x: 0.703125, y: 0.734375 },\n { x: 0.734375, y: 0.734375 },\n { x: 0.734375, y: 0.734375 },\n { x: 0.765625, y: 0.734375 },\n { x: 0.765625, y: 0.734375 },\n { x: 0.796875, y: 0.734375 },\n { x: 0.796875, y: 0.734375 },\n { x: 0.828125, y: 0.734375 },\n { x: 0.828125, y: 0.734375 },\n { x: 0.859375, y: 0.734375 },\n { x: 0.859375, y: 0.734375 },\n { x: 0.890625, y: 0.734375 },\n { x: 0.890625, y: 0.734375 },\n { x: 0.921875, y: 0.734375 },\n { x: 0.921875, y: 0.734375 },\n { x: 0.953125, y: 0.734375 },\n { x: 0.953125, y: 0.734375 },\n { x: 0.984375, y: 0.734375 },\n { x: 0.984375, y: 0.734375 },\n { x: 0.015625, y: 0.765625 },\n { x: 0.015625, y: 0.765625 },\n { x: 0.046875, y: 0.765625 },\n { x: 0.046875, y: 0.765625 },\n { x: 0.078125, y: 0.765625 },\n { x: 0.078125, y: 0.765625 },\n { x: 0.109375, y: 0.765625 },\n { x: 0.109375, y: 0.765625 },\n { x: 0.140625, y: 0.765625 },\n { x: 0.140625, y: 0.765625 },\n { x: 0.171875, y: 0.765625 },\n { x: 0.171875, y: 0.765625 },\n { x: 0.203125, y: 0.765625 },\n { x: 0.203125, y: 0.765625 },\n { x: 0.234375, y: 0.765625 },\n { x: 0.234375, y: 0.765625 },\n { x: 0.265625, y: 0.765625 },\n { x: 0.265625, y: 0.765625 },\n { x: 0.296875, y: 0.765625 },\n { x: 0.296875, y: 0.765625 },\n { x: 0.328125, y: 0.765625 },\n { x: 0.328125, y: 0.765625 },\n { x: 0.359375, y: 0.765625 },\n { x: 0.359375, y: 0.765625 },\n { x: 0.390625, y: 0.765625 },\n { x: 0.390625, y: 0.765625 },\n { x: 0.421875, y: 0.765625 },\n { x: 0.421875, y: 0.765625 },\n { x: 0.453125, y: 0.765625 },\n { x: 0.453125, y: 0.765625 },\n { x: 0.484375, y: 0.765625 },\n { x: 0.484375, y: 0.765625 },\n { x: 0.515625, y: 0.765625 },\n { x: 0.515625, y: 0.765625 },\n { x: 0.546875, y: 0.765625 },\n { x: 0.546875, y: 0.765625 },\n { x: 0.578125, y: 0.765625 },\n { x: 0.578125, y: 0.765625 },\n { x: 0.609375, y: 0.765625 },\n { x: 0.609375, y: 0.765625 },\n { x: 0.640625, y: 0.765625 },\n { x: 0.640625, y: 0.765625 },\n { x: 0.671875, y: 0.765625 },\n { x: 0.671875, y: 0.765625 },\n { x: 0.703125, y: 0.765625 },\n { x: 0.703125, y: 0.765625 },\n { x: 0.734375, y: 0.765625 },\n { x: 0.734375, y: 0.765625 },\n { x: 0.765625, y: 0.765625 },\n { x: 0.765625, y: 0.765625 },\n { x: 0.796875, y: 0.765625 },\n { x: 0.796875, y: 0.765625 },\n { x: 0.828125, y: 0.765625 },\n { x: 0.828125, y: 0.765625 },\n { x: 0.859375, y: 0.765625 },\n { x: 0.859375, y: 0.765625 },\n { x: 0.890625, y: 0.765625 },\n { x: 0.890625, y: 0.765625 },\n { x: 0.921875, y: 0.765625 },\n { x: 0.921875, y: 0.765625 },\n { x: 0.953125, y: 0.765625 },\n { x: 0.953125, y: 0.765625 },\n { x: 0.984375, y: 0.765625 },\n { x: 0.984375, y: 0.765625 },\n { x: 0.015625, y: 0.796875 },\n { x: 0.015625, y: 0.796875 },\n { x: 0.046875, y: 0.796875 },\n { x: 0.046875, y: 0.796875 },\n { x: 0.078125, y: 0.796875 },\n { x: 0.078125, y: 0.796875 },\n { x: 0.109375, y: 0.796875 },\n { x: 0.109375, y: 0.796875 },\n { x: 0.140625, y: 0.796875 },\n { x: 0.140625, y: 0.796875 },\n { x: 0.171875, y: 0.796875 },\n { x: 0.171875, y: 0.796875 },\n { x: 0.203125, y: 0.796875 },\n { x: 0.203125, y: 0.796875 },\n { x: 0.234375, y: 0.796875 },\n { x: 0.234375, y: 0.796875 },\n { x: 0.265625, y: 0.796875 },\n { x: 0.265625, y: 0.796875 },\n { x: 0.296875, y: 0.796875 },\n { x: 0.296875, y: 0.796875 },\n { x: 0.328125, y: 0.796875 },\n { x: 0.328125, y: 0.796875 },\n { x: 0.359375, y: 0.796875 },\n { x: 0.359375, y: 0.796875 },\n { x: 0.390625, y: 0.796875 },\n { x: 0.390625, y: 0.796875 },\n { x: 0.421875, y: 0.796875 },\n { x: 0.421875, y: 0.796875 },\n { x: 0.453125, y: 0.796875 },\n { x: 0.453125, y: 0.796875 },\n { x: 0.484375, y: 0.796875 },\n { x: 0.484375, y: 0.796875 },\n { x: 0.515625, y: 0.796875 },\n { x: 0.515625, y: 0.796875 },\n { x: 0.546875, y: 0.796875 },\n { x: 0.546875, y: 0.796875 },\n { x: 0.578125, y: 0.796875 },\n { x: 0.578125, y: 0.796875 },\n { x: 0.609375, y: 0.796875 },\n { x: 0.609375, y: 0.796875 },\n { x: 0.640625, y: 0.796875 },\n { x: 0.640625, y: 0.796875 },\n { x: 0.671875, y: 0.796875 },\n { x: 0.671875, y: 0.796875 },\n { x: 0.703125, y: 0.796875 },\n { x: 0.703125, y: 0.796875 },\n { x: 0.734375, y: 0.796875 },\n { x: 0.734375, y: 0.796875 },\n { x: 0.765625, y: 0.796875 },\n { x: 0.765625, y: 0.796875 },\n { x: 0.796875, y: 0.796875 },\n { x: 0.796875, y: 0.796875 },\n { x: 0.828125, y: 0.796875 },\n { x: 0.828125, y: 0.796875 },\n { x: 0.859375, y: 0.796875 },\n { x: 0.859375, y: 0.796875 },\n { x: 0.890625, y: 0.796875 },\n { x: 0.890625, y: 0.796875 },\n { x: 0.921875, y: 0.796875 },\n { x: 0.921875, y: 0.796875 },\n { x: 0.953125, y: 0.796875 },\n { x: 0.953125, y: 0.796875 },\n { x: 0.984375, y: 0.796875 },\n { x: 0.984375, y: 0.796875 },\n { x: 0.015625, y: 0.828125 },\n { x: 0.015625, y: 0.828125 },\n { x: 0.046875, y: 0.828125 },\n { x: 0.046875, y: 0.828125 },\n { x: 0.078125, y: 0.828125 },\n { x: 0.078125, y: 0.828125 },\n { x: 0.109375, y: 0.828125 },\n { x: 0.109375, y: 0.828125 },\n { x: 0.140625, y: 0.828125 },\n { x: 0.140625, y: 0.828125 },\n { x: 0.171875, y: 0.828125 },\n { x: 0.171875, y: 0.828125 },\n { x: 0.203125, y: 0.828125 },\n { x: 0.203125, y: 0.828125 },\n { x: 0.234375, y: 0.828125 },\n { x: 0.234375, y: 0.828125 },\n { x: 0.265625, y: 0.828125 },\n { x: 0.265625, y: 0.828125 },\n { x: 0.296875, y: 0.828125 },\n { x: 0.296875, y: 0.828125 },\n { x: 0.328125, y: 0.828125 },\n { x: 0.328125, y: 0.828125 },\n { x: 0.359375, y: 0.828125 },\n { x: 0.359375, y: 0.828125 },\n { x: 0.390625, y: 0.828125 },\n { x: 0.390625, y: 0.828125 },\n { x: 0.421875, y: 0.828125 },\n { x: 0.421875, y: 0.828125 },\n { x: 0.453125, y: 0.828125 },\n { x: 0.453125, y: 0.828125 },\n { x: 0.484375, y: 0.828125 },\n { x: 0.484375, y: 0.828125 },\n { x: 0.515625, y: 0.828125 },\n { x: 0.515625, y: 0.828125 },\n { x: 0.546875, y: 0.828125 },\n { x: 0.546875, y: 0.828125 },\n { x: 0.578125, y: 0.828125 },\n { x: 0.578125, y: 0.828125 },\n { x: 0.609375, y: 0.828125 },\n { x: 0.609375, y: 0.828125 },\n { x: 0.640625, y: 0.828125 },\n { x: 0.640625, y: 0.828125 },\n { x: 0.671875, y: 0.828125 },\n { x: 0.671875, y: 0.828125 },\n { x: 0.703125, y: 0.828125 },\n { x: 0.703125, y: 0.828125 },\n { x: 0.734375, y: 0.828125 },\n { x: 0.734375, y: 0.828125 },\n { x: 0.765625, y: 0.828125 },\n { x: 0.765625, y: 0.828125 },\n { x: 0.796875, y: 0.828125 },\n { x: 0.796875, y: 0.828125 },\n { x: 0.828125, y: 0.828125 },\n { x: 0.828125, y: 0.828125 },\n { x: 0.859375, y: 0.828125 },\n { x: 0.859375, y: 0.828125 },\n { x: 0.890625, y: 0.828125 },\n { x: 0.890625, y: 0.828125 },\n { x: 0.921875, y: 0.828125 },\n { x: 0.921875, y: 0.828125 },\n { x: 0.953125, y: 0.828125 },\n { x: 0.953125, y: 0.828125 },\n { x: 0.984375, y: 0.828125 },\n { x: 0.984375, y: 0.828125 },\n { x: 0.015625, y: 0.859375 },\n { x: 0.015625, y: 0.859375 },\n { x: 0.046875, y: 0.859375 },\n { x: 0.046875, y: 0.859375 },\n { x: 0.078125, y: 0.859375 },\n { x: 0.078125, y: 0.859375 },\n { x: 0.109375, y: 0.859375 },\n { x: 0.109375, y: 0.859375 },\n { x: 0.140625, y: 0.859375 },\n { x: 0.140625, y: 0.859375 },\n { x: 0.171875, y: 0.859375 },\n { x: 0.171875, y: 0.859375 },\n { x: 0.203125, y: 0.859375 },\n { x: 0.203125, y: 0.859375 },\n { x: 0.234375, y: 0.859375 },\n { x: 0.234375, y: 0.859375 },\n { x: 0.265625, y: 0.859375 },\n { x: 0.265625, y: 0.859375 },\n { x: 0.296875, y: 0.859375 },\n { x: 0.296875, y: 0.859375 },\n { x: 0.328125, y: 0.859375 },\n { x: 0.328125, y: 0.859375 },\n { x: 0.359375, y: 0.859375 },\n { x: 0.359375, y: 0.859375 },\n { x: 0.390625, y: 0.859375 },\n { x: 0.390625, y: 0.859375 },\n { x: 0.421875, y: 0.859375 },\n { x: 0.421875, y: 0.859375 },\n { x: 0.453125, y: 0.859375 },\n { x: 0.453125, y: 0.859375 },\n { x: 0.484375, y: 0.859375 },\n { x: 0.484375, y: 0.859375 },\n { x: 0.515625, y: 0.859375 },\n { x: 0.515625, y: 0.859375 },\n { x: 0.546875, y: 0.859375 },\n { x: 0.546875, y: 0.859375 },\n { x: 0.578125, y: 0.859375 },\n { x: 0.578125, y: 0.859375 },\n { x: 0.609375, y: 0.859375 },\n { x: 0.609375, y: 0.859375 },\n { x: 0.640625, y: 0.859375 },\n { x: 0.640625, y: 0.859375 },\n { x: 0.671875, y: 0.859375 },\n { x: 0.671875, y: 0.859375 },\n { x: 0.703125, y: 0.859375 },\n { x: 0.703125, y: 0.859375 },\n { x: 0.734375, y: 0.859375 },\n { x: 0.734375, y: 0.859375 },\n { x: 0.765625, y: 0.859375 },\n { x: 0.765625, y: 0.859375 },\n { x: 0.796875, y: 0.859375 },\n { x: 0.796875, y: 0.859375 },\n { x: 0.828125, y: 0.859375 },\n { x: 0.828125, y: 0.859375 },\n { x: 0.859375, y: 0.859375 },\n { x: 0.859375, y: 0.859375 },\n { x: 0.890625, y: 0.859375 },\n { x: 0.890625, y: 0.859375 },\n { x: 0.921875, y: 0.859375 },\n { x: 0.921875, y: 0.859375 },\n { x: 0.953125, y: 0.859375 },\n { x: 0.953125, y: 0.859375 },\n { x: 0.984375, y: 0.859375 },\n { x: 0.984375, y: 0.859375 },\n { x: 0.015625, y: 0.890625 },\n { x: 0.015625, y: 0.890625 },\n { x: 0.046875, y: 0.890625 },\n { x: 0.046875, y: 0.890625 },\n { x: 0.078125, y: 0.890625 },\n { x: 0.078125, y: 0.890625 },\n { x: 0.109375, y: 0.890625 },\n { x: 0.109375, y: 0.890625 },\n { x: 0.140625, y: 0.890625 },\n { x: 0.140625, y: 0.890625 },\n { x: 0.171875, y: 0.890625 },\n { x: 0.171875, y: 0.890625 },\n { x: 0.203125, y: 0.890625 },\n { x: 0.203125, y: 0.890625 },\n { x: 0.234375, y: 0.890625 },\n { x: 0.234375, y: 0.890625 },\n { x: 0.265625, y: 0.890625 },\n { x: 0.265625, y: 0.890625 },\n { x: 0.296875, y: 0.890625 },\n { x: 0.296875, y: 0.890625 },\n { x: 0.328125, y: 0.890625 },\n { x: 0.328125, y: 0.890625 },\n { x: 0.359375, y: 0.890625 },\n { x: 0.359375, y: 0.890625 },\n { x: 0.390625, y: 0.890625 },\n { x: 0.390625, y: 0.890625 },\n { x: 0.421875, y: 0.890625 },\n { x: 0.421875, y: 0.890625 },\n { x: 0.453125, y: 0.890625 },\n { x: 0.453125, y: 0.890625 },\n { x: 0.484375, y: 0.890625 },\n { x: 0.484375, y: 0.890625 },\n { x: 0.515625, y: 0.890625 },\n { x: 0.515625, y: 0.890625 },\n { x: 0.546875, y: 0.890625 },\n { x: 0.546875, y: 0.890625 },\n { x: 0.578125, y: 0.890625 },\n { x: 0.578125, y: 0.890625 },\n { x: 0.609375, y: 0.890625 },\n { x: 0.609375, y: 0.890625 },\n { x: 0.640625, y: 0.890625 },\n { x: 0.640625, y: 0.890625 },\n { x: 0.671875, y: 0.890625 },\n { x: 0.671875, y: 0.890625 },\n { x: 0.703125, y: 0.890625 },\n { x: 0.703125, y: 0.890625 },\n { x: 0.734375, y: 0.890625 },\n { x: 0.734375, y: 0.890625 },\n { x: 0.765625, y: 0.890625 },\n { x: 0.765625, y: 0.890625 },\n { x: 0.796875, y: 0.890625 },\n { x: 0.796875, y: 0.890625 },\n { x: 0.828125, y: 0.890625 },\n { x: 0.828125, y: 0.890625 },\n { x: 0.859375, y: 0.890625 },\n { x: 0.859375, y: 0.890625 },\n { x: 0.890625, y: 0.890625 },\n { x: 0.890625, y: 0.890625 },\n { x: 0.921875, y: 0.890625 },\n { x: 0.921875, y: 0.890625 },\n { x: 0.953125, y: 0.890625 },\n { x: 0.953125, y: 0.890625 },\n { x: 0.984375, y: 0.890625 },\n { x: 0.984375, y: 0.890625 },\n { x: 0.015625, y: 0.921875 },\n { x: 0.015625, y: 0.921875 },\n { x: 0.046875, y: 0.921875 },\n { x: 0.046875, y: 0.921875 },\n { x: 0.078125, y: 0.921875 },\n { x: 0.078125, y: 0.921875 },\n { x: 0.109375, y: 0.921875 },\n { x: 0.109375, y: 0.921875 },\n { x: 0.140625, y: 0.921875 },\n { x: 0.140625, y: 0.921875 },\n { x: 0.171875, y: 0.921875 },\n { x: 0.171875, y: 0.921875 },\n { x: 0.203125, y: 0.921875 },\n { x: 0.203125, y: 0.921875 },\n { x: 0.234375, y: 0.921875 },\n { x: 0.234375, y: 0.921875 },\n { x: 0.265625, y: 0.921875 },\n { x: 0.265625, y: 0.921875 },\n { x: 0.296875, y: 0.921875 },\n { x: 0.296875, y: 0.921875 },\n { x: 0.328125, y: 0.921875 },\n { x: 0.328125, y: 0.921875 },\n { x: 0.359375, y: 0.921875 },\n { x: 0.359375, y: 0.921875 },\n { x: 0.390625, y: 0.921875 },\n { x: 0.390625, y: 0.921875 },\n { x: 0.421875, y: 0.921875 },\n { x: 0.421875, y: 0.921875 },\n { x: 0.453125, y: 0.921875 },\n { x: 0.453125, y: 0.921875 },\n { x: 0.484375, y: 0.921875 },\n { x: 0.484375, y: 0.921875 },\n { x: 0.515625, y: 0.921875 },\n { x: 0.515625, y: 0.921875 },\n { x: 0.546875, y: 0.921875 },\n { x: 0.546875, y: 0.921875 },\n { x: 0.578125, y: 0.921875 },\n { x: 0.578125, y: 0.921875 },\n { x: 0.609375, y: 0.921875 },\n { x: 0.609375, y: 0.921875 },\n { x: 0.640625, y: 0.921875 },\n { x: 0.640625, y: 0.921875 },\n { x: 0.671875, y: 0.921875 },\n { x: 0.671875, y: 0.921875 },\n { x: 0.703125, y: 0.921875 },\n { x: 0.703125, y: 0.921875 },\n { x: 0.734375, y: 0.921875 },\n { x: 0.734375, y: 0.921875 },\n { x: 0.765625, y: 0.921875 },\n { x: 0.765625, y: 0.921875 },\n { x: 0.796875, y: 0.921875 },\n { x: 0.796875, y: 0.921875 },\n { x: 0.828125, y: 0.921875 },\n { x: 0.828125, y: 0.921875 },\n { x: 0.859375, y: 0.921875 },\n { x: 0.859375, y: 0.921875 },\n { x: 0.890625, y: 0.921875 },\n { x: 0.890625, y: 0.921875 },\n { x: 0.921875, y: 0.921875 },\n { x: 0.921875, y: 0.921875 },\n { x: 0.953125, y: 0.921875 },\n { x: 0.953125, y: 0.921875 },\n { x: 0.984375, y: 0.921875 },\n { x: 0.984375, y: 0.921875 },\n { x: 0.015625, y: 0.953125 },\n { x: 0.015625, y: 0.953125 },\n { x: 0.046875, y: 0.953125 },\n { x: 0.046875, y: 0.953125 },\n { x: 0.078125, y: 0.953125 },\n { x: 0.078125, y: 0.953125 },\n { x: 0.109375, y: 0.953125 },\n { x: 0.109375, y: 0.953125 },\n { x: 0.140625, y: 0.953125 },\n { x: 0.140625, y: 0.953125 },\n { x: 0.171875, y: 0.953125 },\n { x: 0.171875, y: 0.953125 },\n { x: 0.203125, y: 0.953125 },\n { x: 0.203125, y: 0.953125 },\n { x: 0.234375, y: 0.953125 },\n { x: 0.234375, y: 0.953125 },\n { x: 0.265625, y: 0.953125 },\n { x: 0.265625, y: 0.953125 },\n { x: 0.296875, y: 0.953125 },\n { x: 0.296875, y: 0.953125 },\n { x: 0.328125, y: 0.953125 },\n { x: 0.328125, y: 0.953125 },\n { x: 0.359375, y: 0.953125 },\n { x: 0.359375, y: 0.953125 },\n { x: 0.390625, y: 0.953125 },\n { x: 0.390625, y: 0.953125 },\n { x: 0.421875, y: 0.953125 },\n { x: 0.421875, y: 0.953125 },\n { x: 0.453125, y: 0.953125 },\n { x: 0.453125, y: 0.953125 },\n { x: 0.484375, y: 0.953125 },\n { x: 0.484375, y: 0.953125 },\n { x: 0.515625, y: 0.953125 },\n { x: 0.515625, y: 0.953125 },\n { x: 0.546875, y: 0.953125 },\n { x: 0.546875, y: 0.953125 },\n { x: 0.578125, y: 0.953125 },\n { x: 0.578125, y: 0.953125 },\n { x: 0.609375, y: 0.953125 },\n { x: 0.609375, y: 0.953125 },\n { x: 0.640625, y: 0.953125 },\n { x: 0.640625, y: 0.953125 },\n { x: 0.671875, y: 0.953125 },\n { x: 0.671875, y: 0.953125 },\n { x: 0.703125, y: 0.953125 },\n { x: 0.703125, y: 0.953125 },\n { x: 0.734375, y: 0.953125 },\n { x: 0.734375, y: 0.953125 },\n { x: 0.765625, y: 0.953125 },\n { x: 0.765625, y: 0.953125 },\n { x: 0.796875, y: 0.953125 },\n { x: 0.796875, y: 0.953125 },\n { x: 0.828125, y: 0.953125 },\n { x: 0.828125, y: 0.953125 },\n { x: 0.859375, y: 0.953125 },\n { x: 0.859375, y: 0.953125 },\n { x: 0.890625, y: 0.953125 },\n { x: 0.890625, y: 0.953125 },\n { x: 0.921875, y: 0.953125 },\n { x: 0.921875, y: 0.953125 },\n { x: 0.953125, y: 0.953125 },\n { x: 0.953125, y: 0.953125 },\n { x: 0.984375, y: 0.953125 },\n { x: 0.984375, y: 0.953125 },\n { x: 0.015625, y: 0.984375 },\n { x: 0.015625, y: 0.984375 },\n { x: 0.046875, y: 0.984375 },\n { x: 0.046875, y: 0.984375 },\n { x: 0.078125, y: 0.984375 },\n { x: 0.078125, y: 0.984375 },\n { x: 0.109375, y: 0.984375 },\n { x: 0.109375, y: 0.984375 },\n { x: 0.140625, y: 0.984375 },\n { x: 0.140625, y: 0.984375 },\n { x: 0.171875, y: 0.984375 },\n { x: 0.171875, y: 0.984375 },\n { x: 0.203125, y: 0.984375 },\n { x: 0.203125, y: 0.984375 },\n { x: 0.234375, y: 0.984375 },\n { x: 0.234375, y: 0.984375 },\n { x: 0.265625, y: 0.984375 },\n { x: 0.265625, y: 0.984375 },\n { x: 0.296875, y: 0.984375 },\n { x: 0.296875, y: 0.984375 },\n { x: 0.328125, y: 0.984375 },\n { x: 0.328125, y: 0.984375 },\n { x: 0.359375, y: 0.984375 },\n { x: 0.359375, y: 0.984375 },\n { x: 0.390625, y: 0.984375 },\n { x: 0.390625, y: 0.984375 },\n { x: 0.421875, y: 0.984375 },\n { x: 0.421875, y: 0.984375 },\n { x: 0.453125, y: 0.984375 },\n { x: 0.453125, y: 0.984375 },\n { x: 0.484375, y: 0.984375 },\n { x: 0.484375, y: 0.984375 },\n { x: 0.515625, y: 0.984375 },\n { x: 0.515625, y: 0.984375 },\n { x: 0.546875, y: 0.984375 },\n { x: 0.546875, y: 0.984375 },\n { x: 0.578125, y: 0.984375 },\n { x: 0.578125, y: 0.984375 },\n { x: 0.609375, y: 0.984375 },\n { x: 0.609375, y: 0.984375 },\n { x: 0.640625, y: 0.984375 },\n { x: 0.640625, y: 0.984375 },\n { x: 0.671875, y: 0.984375 },\n { x: 0.671875, y: 0.984375 },\n { x: 0.703125, y: 0.984375 },\n { x: 0.703125, y: 0.984375 },\n { x: 0.734375, y: 0.984375 },\n { x: 0.734375, y: 0.984375 },\n { x: 0.765625, y: 0.984375 },\n { x: 0.765625, y: 0.984375 },\n { x: 0.796875, y: 0.984375 },\n { x: 0.796875, y: 0.984375 },\n { x: 0.828125, y: 0.984375 },\n { x: 0.828125, y: 0.984375 },\n { x: 0.859375, y: 0.984375 },\n { x: 0.859375, y: 0.984375 },\n { x: 0.890625, y: 0.984375 },\n { x: 0.890625, y: 0.984375 },\n { x: 0.921875, y: 0.984375 },\n { x: 0.921875, y: 0.984375 },\n { x: 0.953125, y: 0.984375 },\n { x: 0.953125, y: 0.984375 },\n { x: 0.984375, y: 0.984375 },\n { x: 0.984375, y: 0.984375 },\n { x: 0.03125, y: 0.03125 },\n { x: 0.03125, y: 0.03125 },\n { x: 0.09375, y: 0.03125 },\n { x: 0.09375, y: 0.03125 },\n { x: 0.15625, y: 0.03125 },\n { x: 0.15625, y: 0.03125 },\n { x: 0.21875, y: 0.03125 },\n { x: 0.21875, y: 0.03125 },\n { x: 0.28125, y: 0.03125 },\n { x: 0.28125, y: 0.03125 },\n { x: 0.34375, y: 0.03125 },\n { x: 0.34375, y: 0.03125 },\n { x: 0.40625, y: 0.03125 },\n { x: 0.40625, y: 0.03125 },\n { x: 0.46875, y: 0.03125 },\n { x: 0.46875, y: 0.03125 },\n { x: 0.53125, y: 0.03125 },\n { x: 0.53125, y: 0.03125 },\n { x: 0.59375, y: 0.03125 },\n { x: 0.59375, y: 0.03125 },\n { x: 0.65625, y: 0.03125 },\n { x: 0.65625, y: 0.03125 },\n { x: 0.71875, y: 0.03125 },\n { x: 0.71875, y: 0.03125 },\n { x: 0.78125, y: 0.03125 },\n { x: 0.78125, y: 0.03125 },\n { x: 0.84375, y: 0.03125 },\n { x: 0.84375, y: 0.03125 },\n { x: 0.90625, y: 0.03125 },\n { x: 0.90625, y: 0.03125 },\n { x: 0.96875, y: 0.03125 },\n { x: 0.96875, y: 0.03125 },\n { x: 0.03125, y: 0.09375 },\n { x: 0.03125, y: 0.09375 },\n { x: 0.09375, y: 0.09375 },\n { x: 0.09375, y: 0.09375 },\n { x: 0.15625, y: 0.09375 },\n { x: 0.15625, y: 0.09375 },\n { x: 0.21875, y: 0.09375 },\n { x: 0.21875, y: 0.09375 },\n { x: 0.28125, y: 0.09375 },\n { x: 0.28125, y: 0.09375 },\n { x: 0.34375, y: 0.09375 },\n { x: 0.34375, y: 0.09375 },\n { x: 0.40625, y: 0.09375 },\n { x: 0.40625, y: 0.09375 },\n { x: 0.46875, y: 0.09375 },\n { x: 0.46875, y: 0.09375 },\n { x: 0.53125, y: 0.09375 },\n { x: 0.53125, y: 0.09375 },\n { x: 0.59375, y: 0.09375 },\n { x: 0.59375, y: 0.09375 },\n { x: 0.65625, y: 0.09375 },\n { x: 0.65625, y: 0.09375 },\n { x: 0.71875, y: 0.09375 },\n { x: 0.71875, y: 0.09375 },\n { x: 0.78125, y: 0.09375 },\n { x: 0.78125, y: 0.09375 },\n { x: 0.84375, y: 0.09375 },\n { x: 0.84375, y: 0.09375 },\n { x: 0.90625, y: 0.09375 },\n { x: 0.90625, y: 0.09375 },\n { x: 0.96875, y: 0.09375 },\n { x: 0.96875, y: 0.09375 },\n { x: 0.03125, y: 0.15625 },\n { x: 0.03125, y: 0.15625 },\n { x: 0.09375, y: 0.15625 },\n { x: 0.09375, y: 0.15625 },\n { x: 0.15625, y: 0.15625 },\n { x: 0.15625, y: 0.15625 },\n { x: 0.21875, y: 0.15625 },\n { x: 0.21875, y: 0.15625 },\n { x: 0.28125, y: 0.15625 },\n { x: 0.28125, y: 0.15625 },\n { x: 0.34375, y: 0.15625 },\n { x: 0.34375, y: 0.15625 },\n { x: 0.40625, y: 0.15625 },\n { x: 0.40625, y: 0.15625 },\n { x: 0.46875, y: 0.15625 },\n { x: 0.46875, y: 0.15625 },\n { x: 0.53125, y: 0.15625 },\n { x: 0.53125, y: 0.15625 },\n { x: 0.59375, y: 0.15625 },\n { x: 0.59375, y: 0.15625 },\n { x: 0.65625, y: 0.15625 },\n { x: 0.65625, y: 0.15625 },\n { x: 0.71875, y: 0.15625 },\n { x: 0.71875, y: 0.15625 },\n { x: 0.78125, y: 0.15625 },\n { x: 0.78125, y: 0.15625 },\n { x: 0.84375, y: 0.15625 },\n { x: 0.84375, y: 0.15625 },\n { x: 0.90625, y: 0.15625 },\n { x: 0.90625, y: 0.15625 },\n { x: 0.96875, y: 0.15625 },\n { x: 0.96875, y: 0.15625 },\n { x: 0.03125, y: 0.21875 },\n { x: 0.03125, y: 0.21875 },\n { x: 0.09375, y: 0.21875 },\n { x: 0.09375, y: 0.21875 },\n { x: 0.15625, y: 0.21875 },\n { x: 0.15625, y: 0.21875 },\n { x: 0.21875, y: 0.21875 },\n { x: 0.21875, y: 0.21875 },\n { x: 0.28125, y: 0.21875 },\n { x: 0.28125, y: 0.21875 },\n { x: 0.34375, y: 0.21875 },\n { x: 0.34375, y: 0.21875 },\n { x: 0.40625, y: 0.21875 },\n { x: 0.40625, y: 0.21875 },\n { x: 0.46875, y: 0.21875 },\n { x: 0.46875, y: 0.21875 },\n { x: 0.53125, y: 0.21875 },\n { x: 0.53125, y: 0.21875 },\n { x: 0.59375, y: 0.21875 },\n { x: 0.59375, y: 0.21875 },\n { x: 0.65625, y: 0.21875 },\n { x: 0.65625, y: 0.21875 },\n { x: 0.71875, y: 0.21875 },\n { x: 0.71875, y: 0.21875 },\n { x: 0.78125, y: 0.21875 },\n { x: 0.78125, y: 0.21875 },\n { x: 0.84375, y: 0.21875 },\n { x: 0.84375, y: 0.21875 },\n { x: 0.90625, y: 0.21875 },\n { x: 0.90625, y: 0.21875 },\n { x: 0.96875, y: 0.21875 },\n { x: 0.96875, y: 0.21875 },\n { x: 0.03125, y: 0.28125 },\n { x: 0.03125, y: 0.28125 },\n { x: 0.09375, y: 0.28125 },\n { x: 0.09375, y: 0.28125 },\n { x: 0.15625, y: 0.28125 },\n { x: 0.15625, y: 0.28125 },\n { x: 0.21875, y: 0.28125 },\n { x: 0.21875, y: 0.28125 },\n { x: 0.28125, y: 0.28125 },\n { x: 0.28125, y: 0.28125 },\n { x: 0.34375, y: 0.28125 },\n { x: 0.34375, y: 0.28125 },\n { x: 0.40625, y: 0.28125 },\n { x: 0.40625, y: 0.28125 },\n { x: 0.46875, y: 0.28125 },\n { x: 0.46875, y: 0.28125 },\n { x: 0.53125, y: 0.28125 },\n { x: 0.53125, y: 0.28125 },\n { x: 0.59375, y: 0.28125 },\n { x: 0.59375, y: 0.28125 },\n { x: 0.65625, y: 0.28125 },\n { x: 0.65625, y: 0.28125 },\n { x: 0.71875, y: 0.28125 },\n { x: 0.71875, y: 0.28125 },\n { x: 0.78125, y: 0.28125 },\n { x: 0.78125, y: 0.28125 },\n { x: 0.84375, y: 0.28125 },\n { x: 0.84375, y: 0.28125 },\n { x: 0.90625, y: 0.28125 },\n { x: 0.90625, y: 0.28125 },\n { x: 0.96875, y: 0.28125 },\n { x: 0.96875, y: 0.28125 },\n { x: 0.03125, y: 0.34375 },\n { x: 0.03125, y: 0.34375 },\n { x: 0.09375, y: 0.34375 },\n { x: 0.09375, y: 0.34375 },\n { x: 0.15625, y: 0.34375 },\n { x: 0.15625, y: 0.34375 },\n { x: 0.21875, y: 0.34375 },\n { x: 0.21875, y: 0.34375 },\n { x: 0.28125, y: 0.34375 },\n { x: 0.28125, y: 0.34375 },\n { x: 0.34375, y: 0.34375 },\n { x: 0.34375, y: 0.34375 },\n { x: 0.40625, y: 0.34375 },\n { x: 0.40625, y: 0.34375 },\n { x: 0.46875, y: 0.34375 },\n { x: 0.46875, y: 0.34375 },\n { x: 0.53125, y: 0.34375 },\n { x: 0.53125, y: 0.34375 },\n { x: 0.59375, y: 0.34375 },\n { x: 0.59375, y: 0.34375 },\n { x: 0.65625, y: 0.34375 },\n { x: 0.65625, y: 0.34375 },\n { x: 0.71875, y: 0.34375 },\n { x: 0.71875, y: 0.34375 },\n { x: 0.78125, y: 0.34375 },\n { x: 0.78125, y: 0.34375 },\n { x: 0.84375, y: 0.34375 },\n { x: 0.84375, y: 0.34375 },\n { x: 0.90625, y: 0.34375 },\n { x: 0.90625, y: 0.34375 },\n { x: 0.96875, y: 0.34375 },\n { x: 0.96875, y: 0.34375 },\n { x: 0.03125, y: 0.40625 },\n { x: 0.03125, y: 0.40625 },\n { x: 0.09375, y: 0.40625 },\n { x: 0.09375, y: 0.40625 },\n { x: 0.15625, y: 0.40625 },\n { x: 0.15625, y: 0.40625 },\n { x: 0.21875, y: 0.40625 },\n { x: 0.21875, y: 0.40625 },\n { x: 0.28125, y: 0.40625 },\n { x: 0.28125, y: 0.40625 },\n { x: 0.34375, y: 0.40625 },\n { x: 0.34375, y: 0.40625 },\n { x: 0.40625, y: 0.40625 },\n { x: 0.40625, y: 0.40625 },\n { x: 0.46875, y: 0.40625 },\n { x: 0.46875, y: 0.40625 },\n { x: 0.53125, y: 0.40625 },\n { x: 0.53125, y: 0.40625 },\n { x: 0.59375, y: 0.40625 },\n { x: 0.59375, y: 0.40625 },\n { x: 0.65625, y: 0.40625 },\n { x: 0.65625, y: 0.40625 },\n { x: 0.71875, y: 0.40625 },\n { x: 0.71875, y: 0.40625 },\n { x: 0.78125, y: 0.40625 },\n { x: 0.78125, y: 0.40625 },\n { x: 0.84375, y: 0.40625 },\n { x: 0.84375, y: 0.40625 },\n { x: 0.90625, y: 0.40625 },\n { x: 0.90625, y: 0.40625 },\n { x: 0.96875, y: 0.40625 },\n { x: 0.96875, y: 0.40625 },\n { x: 0.03125, y: 0.46875 },\n { x: 0.03125, y: 0.46875 },\n { x: 0.09375, y: 0.46875 },\n { x: 0.09375, y: 0.46875 },\n { x: 0.15625, y: 0.46875 },\n { x: 0.15625, y: 0.46875 },\n { x: 0.21875, y: 0.46875 },\n { x: 0.21875, y: 0.46875 },\n { x: 0.28125, y: 0.46875 },\n { x: 0.28125, y: 0.46875 },\n { x: 0.34375, y: 0.46875 },\n { x: 0.34375, y: 0.46875 },\n { x: 0.40625, y: 0.46875 },\n { x: 0.40625, y: 0.46875 },\n { x: 0.46875, y: 0.46875 },\n { x: 0.46875, y: 0.46875 },\n { x: 0.53125, y: 0.46875 },\n { x: 0.53125, y: 0.46875 },\n { x: 0.59375, y: 0.46875 },\n { x: 0.59375, y: 0.46875 },\n { x: 0.65625, y: 0.46875 },\n { x: 0.65625, y: 0.46875 },\n { x: 0.71875, y: 0.46875 },\n { x: 0.71875, y: 0.46875 },\n { x: 0.78125, y: 0.46875 },\n { x: 0.78125, y: 0.46875 },\n { x: 0.84375, y: 0.46875 },\n { x: 0.84375, y: 0.46875 },\n { x: 0.90625, y: 0.46875 },\n { x: 0.90625, y: 0.46875 },\n { x: 0.96875, y: 0.46875 },\n { x: 0.96875, y: 0.46875 },\n { x: 0.03125, y: 0.53125 },\n { x: 0.03125, y: 0.53125 },\n { x: 0.09375, y: 0.53125 },\n { x: 0.09375, y: 0.53125 },\n { x: 0.15625, y: 0.53125 },\n { x: 0.15625, y: 0.53125 },\n { x: 0.21875, y: 0.53125 },\n { x: 0.21875, y: 0.53125 },\n { x: 0.28125, y: 0.53125 },\n { x: 0.28125, y: 0.53125 },\n { x: 0.34375, y: 0.53125 },\n { x: 0.34375, y: 0.53125 },\n { x: 0.40625, y: 0.53125 },\n { x: 0.40625, y: 0.53125 },\n { x: 0.46875, y: 0.53125 },\n { x: 0.46875, y: 0.53125 },\n { x: 0.53125, y: 0.53125 },\n { x: 0.53125, y: 0.53125 },\n { x: 0.59375, y: 0.53125 },\n { x: 0.59375, y: 0.53125 },\n { x: 0.65625, y: 0.53125 },\n { x: 0.65625, y: 0.53125 },\n { x: 0.71875, y: 0.53125 },\n { x: 0.71875, y: 0.53125 },\n { x: 0.78125, y: 0.53125 },\n { x: 0.78125, y: 0.53125 },\n { x: 0.84375, y: 0.53125 },\n { x: 0.84375, y: 0.53125 },\n { x: 0.90625, y: 0.53125 },\n { x: 0.90625, y: 0.53125 },\n { x: 0.96875, y: 0.53125 },\n { x: 0.96875, y: 0.53125 },\n { x: 0.03125, y: 0.59375 },\n { x: 0.03125, y: 0.59375 },\n { x: 0.09375, y: 0.59375 },\n { x: 0.09375, y: 0.59375 },\n { x: 0.15625, y: 0.59375 },\n { x: 0.15625, y: 0.59375 },\n { x: 0.21875, y: 0.59375 },\n { x: 0.21875, y: 0.59375 },\n { x: 0.28125, y: 0.59375 },\n { x: 0.28125, y: 0.59375 },\n { x: 0.34375, y: 0.59375 },\n { x: 0.34375, y: 0.59375 },\n { x: 0.40625, y: 0.59375 },\n { x: 0.40625, y: 0.59375 },\n { x: 0.46875, y: 0.59375 },\n { x: 0.46875, y: 0.59375 },\n { x: 0.53125, y: 0.59375 },\n { x: 0.53125, y: 0.59375 },\n { x: 0.59375, y: 0.59375 },\n { x: 0.59375, y: 0.59375 },\n { x: 0.65625, y: 0.59375 },\n { x: 0.65625, y: 0.59375 },\n { x: 0.71875, y: 0.59375 },\n { x: 0.71875, y: 0.59375 },\n { x: 0.78125, y: 0.59375 },\n { x: 0.78125, y: 0.59375 },\n { x: 0.84375, y: 0.59375 },\n { x: 0.84375, y: 0.59375 },\n { x: 0.90625, y: 0.59375 },\n { x: 0.90625, y: 0.59375 },\n { x: 0.96875, y: 0.59375 },\n { x: 0.96875, y: 0.59375 },\n { x: 0.03125, y: 0.65625 },\n { x: 0.03125, y: 0.65625 },\n { x: 0.09375, y: 0.65625 },\n { x: 0.09375, y: 0.65625 },\n { x: 0.15625, y: 0.65625 },\n { x: 0.15625, y: 0.65625 },\n { x: 0.21875, y: 0.65625 },\n { x: 0.21875, y: 0.65625 },\n { x: 0.28125, y: 0.65625 },\n { x: 0.28125, y: 0.65625 },\n { x: 0.34375, y: 0.65625 },\n { x: 0.34375, y: 0.65625 },\n { x: 0.40625, y: 0.65625 },\n { x: 0.40625, y: 0.65625 },\n { x: 0.46875, y: 0.65625 },\n { x: 0.46875, y: 0.65625 },\n { x: 0.53125, y: 0.65625 },\n { x: 0.53125, y: 0.65625 },\n { x: 0.59375, y: 0.65625 },\n { x: 0.59375, y: 0.65625 },\n { x: 0.65625, y: 0.65625 },\n { x: 0.65625, y: 0.65625 },\n { x: 0.71875, y: 0.65625 },\n { x: 0.71875, y: 0.65625 },\n { x: 0.78125, y: 0.65625 },\n { x: 0.78125, y: 0.65625 },\n { x: 0.84375, y: 0.65625 },\n { x: 0.84375, y: 0.65625 },\n { x: 0.90625, y: 0.65625 },\n { x: 0.90625, y: 0.65625 },\n { x: 0.96875, y: 0.65625 },\n { x: 0.96875, y: 0.65625 },\n { x: 0.03125, y: 0.71875 },\n { x: 0.03125, y: 0.71875 },\n { x: 0.09375, y: 0.71875 },\n { x: 0.09375, y: 0.71875 },\n { x: 0.15625, y: 0.71875 },\n { x: 0.15625, y: 0.71875 },\n { x: 0.21875, y: 0.71875 },\n { x: 0.21875, y: 0.71875 },\n { x: 0.28125, y: 0.71875 },\n { x: 0.28125, y: 0.71875 },\n { x: 0.34375, y: 0.71875 },\n { x: 0.34375, y: 0.71875 },\n { x: 0.40625, y: 0.71875 },\n { x: 0.40625, y: 0.71875 },\n { x: 0.46875, y: 0.71875 },\n { x: 0.46875, y: 0.71875 },\n { x: 0.53125, y: 0.71875 },\n { x: 0.53125, y: 0.71875 },\n { x: 0.59375, y: 0.71875 },\n { x: 0.59375, y: 0.71875 },\n { x: 0.65625, y: 0.71875 },\n { x: 0.65625, y: 0.71875 },\n { x: 0.71875, y: 0.71875 },\n { x: 0.71875, y: 0.71875 },\n { x: 0.78125, y: 0.71875 },\n { x: 0.78125, y: 0.71875 },\n { x: 0.84375, y: 0.71875 },\n { x: 0.84375, y: 0.71875 },\n { x: 0.90625, y: 0.71875 },\n { x: 0.90625, y: 0.71875 },\n { x: 0.96875, y: 0.71875 },\n { x: 0.96875, y: 0.71875 },\n { x: 0.03125, y: 0.78125 },\n { x: 0.03125, y: 0.78125 },\n { x: 0.09375, y: 0.78125 },\n { x: 0.09375, y: 0.78125 },\n { x: 0.15625, y: 0.78125 },\n { x: 0.15625, y: 0.78125 },\n { x: 0.21875, y: 0.78125 },\n { x: 0.21875, y: 0.78125 },\n { x: 0.28125, y: 0.78125 },\n { x: 0.28125, y: 0.78125 },\n { x: 0.34375, y: 0.78125 },\n { x: 0.34375, y: 0.78125 },\n { x: 0.40625, y: 0.78125 },\n { x: 0.40625, y: 0.78125 },\n { x: 0.46875, y: 0.78125 },\n { x: 0.46875, y: 0.78125 },\n { x: 0.53125, y: 0.78125 },\n { x: 0.53125, y: 0.78125 },\n { x: 0.59375, y: 0.78125 },\n { x: 0.59375, y: 0.78125 },\n { x: 0.65625, y: 0.78125 },\n { x: 0.65625, y: 0.78125 },\n { x: 0.71875, y: 0.78125 },\n { x: 0.71875, y: 0.78125 },\n { x: 0.78125, y: 0.78125 },\n { x: 0.78125, y: 0.78125 },\n { x: 0.84375, y: 0.78125 },\n { x: 0.84375, y: 0.78125 },\n { x: 0.90625, y: 0.78125 },\n { x: 0.90625, y: 0.78125 },\n { x: 0.96875, y: 0.78125 },\n { x: 0.96875, y: 0.78125 },\n { x: 0.03125, y: 0.84375 },\n { x: 0.03125, y: 0.84375 },\n { x: 0.09375, y: 0.84375 },\n { x: 0.09375, y: 0.84375 },\n { x: 0.15625, y: 0.84375 },\n { x: 0.15625, y: 0.84375 },\n { x: 0.21875, y: 0.84375 },\n { x: 0.21875, y: 0.84375 },\n { x: 0.28125, y: 0.84375 },\n { x: 0.28125, y: 0.84375 },\n { x: 0.34375, y: 0.84375 },\n { x: 0.34375, y: 0.84375 },\n { x: 0.40625, y: 0.84375 },\n { x: 0.40625, y: 0.84375 },\n { x: 0.46875, y: 0.84375 },\n { x: 0.46875, y: 0.84375 },\n { x: 0.53125, y: 0.84375 },\n { x: 0.53125, y: 0.84375 },\n { x: 0.59375, y: 0.84375 },\n { x: 0.59375, y: 0.84375 },\n { x: 0.65625, y: 0.84375 },\n { x: 0.65625, y: 0.84375 },\n { x: 0.71875, y: 0.84375 },\n { x: 0.71875, y: 0.84375 },\n { x: 0.78125, y: 0.84375 },\n { x: 0.78125, y: 0.84375 },\n { x: 0.84375, y: 0.84375 },\n { x: 0.84375, y: 0.84375 },\n { x: 0.90625, y: 0.84375 },\n { x: 0.90625, y: 0.84375 },\n { x: 0.96875, y: 0.84375 },\n { x: 0.96875, y: 0.84375 },\n { x: 0.03125, y: 0.90625 },\n { x: 0.03125, y: 0.90625 },\n { x: 0.09375, y: 0.90625 },\n { x: 0.09375, y: 0.90625 },\n { x: 0.15625, y: 0.90625 },\n { x: 0.15625, y: 0.90625 },\n { x: 0.21875, y: 0.90625 },\n { x: 0.21875, y: 0.90625 },\n { x: 0.28125, y: 0.90625 },\n { x: 0.28125, y: 0.90625 },\n { x: 0.34375, y: 0.90625 },\n { x: 0.34375, y: 0.90625 },\n { x: 0.40625, y: 0.90625 },\n { x: 0.40625, y: 0.90625 },\n { x: 0.46875, y: 0.90625 },\n { x: 0.46875, y: 0.90625 },\n { x: 0.53125, y: 0.90625 },\n { x: 0.53125, y: 0.90625 },\n { x: 0.59375, y: 0.90625 },\n { x: 0.59375, y: 0.90625 },\n { x: 0.65625, y: 0.90625 },\n { x: 0.65625, y: 0.90625 },\n { x: 0.71875, y: 0.90625 },\n { x: 0.71875, y: 0.90625 },\n { x: 0.78125, y: 0.90625 },\n { x: 0.78125, y: 0.90625 },\n { x: 0.84375, y: 0.90625 },\n { x: 0.84375, y: 0.90625 },\n { x: 0.90625, y: 0.90625 },\n { x: 0.90625, y: 0.90625 },\n { x: 0.96875, y: 0.90625 },\n { x: 0.96875, y: 0.90625 },\n { x: 0.03125, y: 0.96875 },\n { x: 0.03125, y: 0.96875 },\n { x: 0.09375, y: 0.96875 },\n { x: 0.09375, y: 0.96875 },\n { x: 0.15625, y: 0.96875 },\n { x: 0.15625, y: 0.96875 },\n { x: 0.21875, y: 0.96875 },\n { x: 0.21875, y: 0.96875 },\n { x: 0.28125, y: 0.96875 },\n { x: 0.28125, y: 0.96875 },\n { x: 0.34375, y: 0.96875 },\n { x: 0.34375, y: 0.96875 },\n { x: 0.40625, y: 0.96875 },\n { x: 0.40625, y: 0.96875 },\n { x: 0.46875, y: 0.96875 },\n { x: 0.46875, y: 0.96875 },\n { x: 0.53125, y: 0.96875 },\n { x: 0.53125, y: 0.96875 },\n { x: 0.59375, y: 0.96875 },\n { x: 0.59375, y: 0.96875 },\n { x: 0.65625, y: 0.96875 },\n { x: 0.65625, y: 0.96875 },\n { x: 0.71875, y: 0.96875 },\n { x: 0.71875, y: 0.96875 },\n { x: 0.78125, y: 0.96875 },\n { x: 0.78125, y: 0.96875 },\n { x: 0.84375, y: 0.96875 },\n { x: 0.84375, y: 0.96875 },\n { x: 0.90625, y: 0.96875 },\n { x: 0.90625, y: 0.96875 },\n { x: 0.96875, y: 0.96875 },\n { x: 0.96875, y: 0.96875 },\n { x: 0.0625, y: 0.0625 },\n { x: 0.0625, y: 0.0625 },\n { x: 0.0625, y: 0.0625 },\n { x: 0.0625, y: 0.0625 },\n { x: 0.0625, y: 0.0625 },\n { x: 0.0625, y: 0.0625 },\n { x: 0.1875, y: 0.0625 },\n { x: 0.1875, y: 0.0625 },\n { x: 0.1875, y: 0.0625 },\n { x: 0.1875, y: 0.0625 },\n { x: 0.1875, y: 0.0625 },\n { x: 0.1875, y: 0.0625 },\n { x: 0.3125, y: 0.0625 },\n { x: 0.3125, y: 0.0625 },\n { x: 0.3125, y: 0.0625 },\n { x: 0.3125, y: 0.0625 },\n { x: 0.3125, y: 0.0625 },\n { x: 0.3125, y: 0.0625 },\n { x: 0.4375, y: 0.0625 },\n { x: 0.4375, y: 0.0625 },\n { x: 0.4375, y: 0.0625 },\n { x: 0.4375, y: 0.0625 },\n { x: 0.4375, y: 0.0625 },\n { x: 0.4375, y: 0.0625 },\n { x: 0.5625, y: 0.0625 },\n { x: 0.5625, y: 0.0625 },\n { x: 0.5625, y: 0.0625 },\n { x: 0.5625, y: 0.0625 },\n { x: 0.5625, y: 0.0625 },\n { x: 0.5625, y: 0.0625 },\n { x: 0.6875, y: 0.0625 },\n { x: 0.6875, y: 0.0625 },\n { x: 0.6875, y: 0.0625 },\n { x: 0.6875, y: 0.0625 },\n { x: 0.6875, y: 0.0625 },\n { x: 0.6875, y: 0.0625 },\n { x: 0.8125, y: 0.0625 },\n { x: 0.8125, y: 0.0625 },\n { x: 0.8125, y: 0.0625 },\n { x: 0.8125, y: 0.0625 },\n { x: 0.8125, y: 0.0625 },\n { x: 0.8125, y: 0.0625 },\n { x: 0.9375, y: 0.0625 },\n { x: 0.9375, y: 0.0625 },\n { x: 0.9375, y: 0.0625 },\n { x: 0.9375, y: 0.0625 },\n { x: 0.9375, y: 0.0625 },\n { x: 0.9375, y: 0.0625 },\n { x: 0.0625, y: 0.1875 },\n { x: 0.0625, y: 0.1875 },\n { x: 0.0625, y: 0.1875 },\n { x: 0.0625, y: 0.1875 },\n { x: 0.0625, y: 0.1875 },\n { x: 0.0625, y: 0.1875 },\n { x: 0.1875, y: 0.1875 },\n { x: 0.1875, y: 0.1875 },\n { x: 0.1875, y: 0.1875 },\n { x: 0.1875, y: 0.1875 },\n { x: 0.1875, y: 0.1875 },\n { x: 0.1875, y: 0.1875 },\n { x: 0.3125, y: 0.1875 },\n { x: 0.3125, y: 0.1875 },\n { x: 0.3125, y: 0.1875 },\n { x: 0.3125, y: 0.1875 },\n { x: 0.3125, y: 0.1875 },\n { x: 0.3125, y: 0.1875 },\n { x: 0.4375, y: 0.1875 },\n { x: 0.4375, y: 0.1875 },\n { x: 0.4375, y: 0.1875 },\n { x: 0.4375, y: 0.1875 },\n { x: 0.4375, y: 0.1875 },\n { x: 0.4375, y: 0.1875 },\n { x: 0.5625, y: 0.1875 },\n { x: 0.5625, y: 0.1875 },\n { x: 0.5625, y: 0.1875 },\n { x: 0.5625, y: 0.1875 },\n { x: 0.5625, y: 0.1875 },\n { x: 0.5625, y: 0.1875 },\n { x: 0.6875, y: 0.1875 },\n { x: 0.6875, y: 0.1875 },\n { x: 0.6875, y: 0.1875 },\n { x: 0.6875, y: 0.1875 },\n { x: 0.6875, y: 0.1875 },\n { x: 0.6875, y: 0.1875 },\n { x: 0.8125, y: 0.1875 },\n { x: 0.8125, y: 0.1875 },\n { x: 0.8125, y: 0.1875 },\n { x: 0.8125, y: 0.1875 },\n { x: 0.8125, y: 0.1875 },\n { x: 0.8125, y: 0.1875 },\n { x: 0.9375, y: 0.1875 },\n { x: 0.9375, y: 0.1875 },\n { x: 0.9375, y: 0.1875 },\n { x: 0.9375, y: 0.1875 },\n { x: 0.9375, y: 0.1875 },\n { x: 0.9375, y: 0.1875 },\n { x: 0.0625, y: 0.3125 },\n { x: 0.0625, y: 0.3125 },\n { x: 0.0625, y: 0.3125 },\n { x: 0.0625, y: 0.3125 },\n { x: 0.0625, y: 0.3125 },\n { x: 0.0625, y: 0.3125 },\n { x: 0.1875, y: 0.3125 },\n { x: 0.1875, y: 0.3125 },\n { x: 0.1875, y: 0.3125 },\n { x: 0.1875, y: 0.3125 },\n { x: 0.1875, y: 0.3125 },\n { x: 0.1875, y: 0.3125 },\n { x: 0.3125, y: 0.3125 },\n { x: 0.3125, y: 0.3125 },\n { x: 0.3125, y: 0.3125 },\n { x: 0.3125, y: 0.3125 },\n { x: 0.3125, y: 0.3125 },\n { x: 0.3125, y: 0.3125 },\n { x: 0.4375, y: 0.3125 },\n { x: 0.4375, y: 0.3125 },\n { x: 0.4375, y: 0.3125 },\n { x: 0.4375, y: 0.3125 },\n { x: 0.4375, y: 0.3125 },\n { x: 0.4375, y: 0.3125 },\n { x: 0.5625, y: 0.3125 },\n { x: 0.5625, y: 0.3125 },\n { x: 0.5625, y: 0.3125 },\n { x: 0.5625, y: 0.3125 },\n { x: 0.5625, y: 0.3125 },\n { x: 0.5625, y: 0.3125 },\n { x: 0.6875, y: 0.3125 },\n { x: 0.6875, y: 0.3125 },\n { x: 0.6875, y: 0.3125 },\n { x: 0.6875, y: 0.3125 },\n { x: 0.6875, y: 0.3125 },\n { x: 0.6875, y: 0.3125 },\n { x: 0.8125, y: 0.3125 },\n { x: 0.8125, y: 0.3125 },\n { x: 0.8125, y: 0.3125 },\n { x: 0.8125, y: 0.3125 },\n { x: 0.8125, y: 0.3125 },\n { x: 0.8125, y: 0.3125 },\n { x: 0.9375, y: 0.3125 },\n { x: 0.9375, y: 0.3125 },\n { x: 0.9375, y: 0.3125 },\n { x: 0.9375, y: 0.3125 },\n { x: 0.9375, y: 0.3125 },\n { x: 0.9375, y: 0.3125 },\n { x: 0.0625, y: 0.4375 },\n { x: 0.0625, y: 0.4375 },\n { x: 0.0625, y: 0.4375 },\n { x: 0.0625, y: 0.4375 },\n { x: 0.0625, y: 0.4375 },\n { x: 0.0625, y: 0.4375 },\n { x: 0.1875, y: 0.4375 },\n { x: 0.1875, y: 0.4375 },\n { x: 0.1875, y: 0.4375 },\n { x: 0.1875, y: 0.4375 },\n { x: 0.1875, y: 0.4375 },\n { x: 0.1875, y: 0.4375 },\n { x: 0.3125, y: 0.4375 },\n { x: 0.3125, y: 0.4375 },\n { x: 0.3125, y: 0.4375 },\n { x: 0.3125, y: 0.4375 },\n { x: 0.3125, y: 0.4375 },\n { x: 0.3125, y: 0.4375 },\n { x: 0.4375, y: 0.4375 },\n { x: 0.4375, y: 0.4375 },\n { x: 0.4375, y: 0.4375 },\n { x: 0.4375, y: 0.4375 },\n { x: 0.4375, y: 0.4375 },\n { x: 0.4375, y: 0.4375 },\n { x: 0.5625, y: 0.4375 },\n { x: 0.5625, y: 0.4375 },\n { x: 0.5625, y: 0.4375 },\n { x: 0.5625, y: 0.4375 },\n { x: 0.5625, y: 0.4375 },\n { x: 0.5625, y: 0.4375 },\n { x: 0.6875, y: 0.4375 },\n { x: 0.6875, y: 0.4375 },\n { x: 0.6875, y: 0.4375 },\n { x: 0.6875, y: 0.4375 },\n { x: 0.6875, y: 0.4375 },\n { x: 0.6875, y: 0.4375 },\n { x: 0.8125, y: 0.4375 },\n { x: 0.8125, y: 0.4375 },\n { x: 0.8125, y: 0.4375 },\n { x: 0.8125, y: 0.4375 },\n { x: 0.8125, y: 0.4375 },\n { x: 0.8125, y: 0.4375 },\n { x: 0.9375, y: 0.4375 },\n { x: 0.9375, y: 0.4375 },\n { x: 0.9375, y: 0.4375 },\n { x: 0.9375, y: 0.4375 },\n { x: 0.9375, y: 0.4375 },\n { x: 0.9375, y: 0.4375 },\n { x: 0.0625, y: 0.5625 },\n { x: 0.0625, y: 0.5625 },\n { x: 0.0625, y: 0.5625 },\n { x: 0.0625, y: 0.5625 },\n { x: 0.0625, y: 0.5625 },\n { x: 0.0625, y: 0.5625 },\n { x: 0.1875, y: 0.5625 },\n { x: 0.1875, y: 0.5625 },\n { x: 0.1875, y: 0.5625 },\n { x: 0.1875, y: 0.5625 },\n { x: 0.1875, y: 0.5625 },\n { x: 0.1875, y: 0.5625 },\n { x: 0.3125, y: 0.5625 },\n { x: 0.3125, y: 0.5625 },\n { x: 0.3125, y: 0.5625 },\n { x: 0.3125, y: 0.5625 },\n { x: 0.3125, y: 0.5625 },\n { x: 0.3125, y: 0.5625 },\n { x: 0.4375, y: 0.5625 },\n { x: 0.4375, y: 0.5625 },\n { x: 0.4375, y: 0.5625 },\n { x: 0.4375, y: 0.5625 },\n { x: 0.4375, y: 0.5625 },\n { x: 0.4375, y: 0.5625 },\n { x: 0.5625, y: 0.5625 },\n { x: 0.5625, y: 0.5625 },\n { x: 0.5625, y: 0.5625 },\n { x: 0.5625, y: 0.5625 },\n { x: 0.5625, y: 0.5625 },\n { x: 0.5625, y: 0.5625 },\n { x: 0.6875, y: 0.5625 },\n { x: 0.6875, y: 0.5625 },\n { x: 0.6875, y: 0.5625 },\n { x: 0.6875, y: 0.5625 },\n { x: 0.6875, y: 0.5625 },\n { x: 0.6875, y: 0.5625 },\n { x: 0.8125, y: 0.5625 },\n { x: 0.8125, y: 0.5625 },\n { x: 0.8125, y: 0.5625 },\n { x: 0.8125, y: 0.5625 },\n { x: 0.8125, y: 0.5625 },\n { x: 0.8125, y: 0.5625 },\n { x: 0.9375, y: 0.5625 },\n { x: 0.9375, y: 0.5625 },\n { x: 0.9375, y: 0.5625 },\n { x: 0.9375, y: 0.5625 },\n { x: 0.9375, y: 0.5625 },\n { x: 0.9375, y: 0.5625 },\n { x: 0.0625, y: 0.6875 },\n { x: 0.0625, y: 0.6875 },\n { x: 0.0625, y: 0.6875 },\n { x: 0.0625, y: 0.6875 },\n { x: 0.0625, y: 0.6875 },\n { x: 0.0625, y: 0.6875 },\n { x: 0.1875, y: 0.6875 },\n { x: 0.1875, y: 0.6875 },\n { x: 0.1875, y: 0.6875 },\n { x: 0.1875, y: 0.6875 },\n { x: 0.1875, y: 0.6875 },\n { x: 0.1875, y: 0.6875 },\n { x: 0.3125, y: 0.6875 },\n { x: 0.3125, y: 0.6875 },\n { x: 0.3125, y: 0.6875 },\n { x: 0.3125, y: 0.6875 },\n { x: 0.3125, y: 0.6875 },\n { x: 0.3125, y: 0.6875 },\n { x: 0.4375, y: 0.6875 },\n { x: 0.4375, y: 0.6875 },\n { x: 0.4375, y: 0.6875 },\n { x: 0.4375, y: 0.6875 },\n { x: 0.4375, y: 0.6875 },\n { x: 0.4375, y: 0.6875 },\n { x: 0.5625, y: 0.6875 },\n { x: 0.5625, y: 0.6875 },\n { x: 0.5625, y: 0.6875 },\n { x: 0.5625, y: 0.6875 },\n { x: 0.5625, y: 0.6875 },\n { x: 0.5625, y: 0.6875 },\n { x: 0.6875, y: 0.6875 },\n { x: 0.6875, y: 0.6875 },\n { x: 0.6875, y: 0.6875 },\n { x: 0.6875, y: 0.6875 },\n { x: 0.6875, y: 0.6875 },\n { x: 0.6875, y: 0.6875 },\n { x: 0.8125, y: 0.6875 },\n { x: 0.8125, y: 0.6875 },\n { x: 0.8125, y: 0.6875 },\n { x: 0.8125, y: 0.6875 },\n { x: 0.8125, y: 0.6875 },\n { x: 0.8125, y: 0.6875 },\n { x: 0.9375, y: 0.6875 },\n { x: 0.9375, y: 0.6875 },\n { x: 0.9375, y: 0.6875 },\n { x: 0.9375, y: 0.6875 },\n { x: 0.9375, y: 0.6875 },\n { x: 0.9375, y: 0.6875 },\n { x: 0.0625, y: 0.8125 },\n { x: 0.0625, y: 0.8125 },\n { x: 0.0625, y: 0.8125 },\n { x: 0.0625, y: 0.8125 },\n { x: 0.0625, y: 0.8125 },\n { x: 0.0625, y: 0.8125 },\n { x: 0.1875, y: 0.8125 },\n { x: 0.1875, y: 0.8125 },\n { x: 0.1875, y: 0.8125 },\n { x: 0.1875, y: 0.8125 },\n { x: 0.1875, y: 0.8125 },\n { x: 0.1875, y: 0.8125 },\n { x: 0.3125, y: 0.8125 },\n { x: 0.3125, y: 0.8125 },\n { x: 0.3125, y: 0.8125 },\n { x: 0.3125, y: 0.8125 },\n { x: 0.3125, y: 0.8125 },\n { x: 0.3125, y: 0.8125 },\n { x: 0.4375, y: 0.8125 },\n { x: 0.4375, y: 0.8125 },\n { x: 0.4375, y: 0.8125 },\n { x: 0.4375, y: 0.8125 },\n { x: 0.4375, y: 0.8125 },\n { x: 0.4375, y: 0.8125 },\n { x: 0.5625, y: 0.8125 },\n { x: 0.5625, y: 0.8125 },\n { x: 0.5625, y: 0.8125 },\n { x: 0.5625, y: 0.8125 },\n { x: 0.5625, y: 0.8125 },\n { x: 0.5625, y: 0.8125 },\n { x: 0.6875, y: 0.8125 },\n { x: 0.6875, y: 0.8125 },\n { x: 0.6875, y: 0.8125 },\n { x: 0.6875, y: 0.8125 },\n { x: 0.6875, y: 0.8125 },\n { x: 0.6875, y: 0.8125 },\n { x: 0.8125, y: 0.8125 },\n { x: 0.8125, y: 0.8125 },\n { x: 0.8125, y: 0.8125 },\n { x: 0.8125, y: 0.8125 },\n { x: 0.8125, y: 0.8125 },\n { x: 0.8125, y: 0.8125 },\n { x: 0.9375, y: 0.8125 },\n { x: 0.9375, y: 0.8125 },\n { x: 0.9375, y: 0.8125 },\n { x: 0.9375, y: 0.8125 },\n { x: 0.9375, y: 0.8125 },\n { x: 0.9375, y: 0.8125 },\n { x: 0.0625, y: 0.9375 },\n { x: 0.0625, y: 0.9375 },\n { x: 0.0625, y: 0.9375 },\n { x: 0.0625, y: 0.9375 },\n { x: 0.0625, y: 0.9375 },\n { x: 0.0625, y: 0.9375 },\n { x: 0.1875, y: 0.9375 },\n { x: 0.1875, y: 0.9375 },\n { x: 0.1875, y: 0.9375 },\n { x: 0.1875, y: 0.9375 },\n { x: 0.1875, y: 0.9375 },\n { x: 0.1875, y: 0.9375 },\n { x: 0.3125, y: 0.9375 },\n { x: 0.3125, y: 0.9375 },\n { x: 0.3125, y: 0.9375 },\n { x: 0.3125, y: 0.9375 },\n { x: 0.3125, y: 0.9375 },\n { x: 0.3125, y: 0.9375 },\n { x: 0.4375, y: 0.9375 },\n { x: 0.4375, y: 0.9375 },\n { x: 0.4375, y: 0.9375 },\n { x: 0.4375, y: 0.9375 },\n { x: 0.4375, y: 0.9375 },\n { x: 0.4375, y: 0.9375 },\n { x: 0.5625, y: 0.9375 },\n { x: 0.5625, y: 0.9375 },\n { x: 0.5625, y: 0.9375 },\n { x: 0.5625, y: 0.9375 },\n { x: 0.5625, y: 0.9375 },\n { x: 0.5625, y: 0.9375 },\n { x: 0.6875, y: 0.9375 },\n { x: 0.6875, y: 0.9375 },\n { x: 0.6875, y: 0.9375 },\n { x: 0.6875, y: 0.9375 },\n { x: 0.6875, y: 0.9375 },\n { x: 0.6875, y: 0.9375 },\n { x: 0.8125, y: 0.9375 },\n { x: 0.8125, y: 0.9375 },\n { x: 0.8125, y: 0.9375 },\n { x: 0.8125, y: 0.9375 },\n { x: 0.8125, y: 0.9375 },\n { x: 0.8125, y: 0.9375 },\n { x: 0.9375, y: 0.9375 },\n { x: 0.9375, y: 0.9375 },\n { x: 0.9375, y: 0.9375 },\n { x: 0.9375, y: 0.9375 },\n { x: 0.9375, y: 0.9375 },\n { x: 0.9375, y: 0.9375 },\n];\n", "import * as tf from '../../dist/tfjs.esm.js';\nimport * as box from './box';\nimport * as anchors from './anchors';\nimport { Tensor, GraphModel } from '../tfjs/types';\n\nexport class HandDetector {\n model: GraphModel;\n anchors: number[][];\n anchorsTensor: Tensor;\n inputSize: number;\n inputSizeTensor: Tensor;\n doubleInputSizeTensor: Tensor;\n\n constructor(model) {\n this.model = model;\n this.anchors = anchors.anchors.map((anchor) => [anchor.x, anchor.y]);\n this.anchorsTensor = tf.tensor2d(this.anchors);\n // @ts-ignore model is not undefined here\n this.inputSize = this.model?.inputs[0].shape[2];\n this.inputSizeTensor = tf.tensor1d([this.inputSize, this.inputSize]);\n this.doubleInputSizeTensor = tf.tensor1d([this.inputSize * 2, this.inputSize * 2]);\n }\n\n normalizeBoxes(boxes) {\n return tf.tidy(() => {\n const boxOffsets = tf.slice(boxes, [0, 0], [-1, 2]);\n const boxSizes = tf.slice(boxes, [0, 2], [-1, 2]);\n const boxCenterPoints = tf.add(tf.div(boxOffsets, this.inputSizeTensor), this.anchorsTensor);\n const halfBoxSizes = tf.div(boxSizes, this.doubleInputSizeTensor);\n const startPoints = tf.mul(tf.sub(boxCenterPoints, halfBoxSizes), this.inputSizeTensor);\n const endPoints = tf.mul(tf.add(boxCenterPoints, halfBoxSizes), this.inputSizeTensor);\n return tf.concat2d([startPoints, endPoints], 1);\n });\n }\n\n normalizeLandmarks(rawPalmLandmarks, index) {\n return tf.tidy(() => {\n const landmarks = tf.add(tf.div(rawPalmLandmarks.reshape([-1, 7, 2]), this.inputSizeTensor), this.anchors[index]);\n return tf.mul(landmarks, this.inputSizeTensor);\n });\n }\n\n async getBoxes(input, config) {\n const batched = this.model.predict(input) as Tensor;\n const predictions = tf.squeeze(batched);\n batched.dispose();\n const scoresT = tf.tidy(() => tf.sigmoid(tf.slice(predictions, [0, 0], [-1, 1])).squeeze());\n const scores = scoresT.dataSync();\n const rawBoxes = tf.slice(predictions, [0, 1], [-1, 4]);\n const boxes = this.normalizeBoxes(rawBoxes);\n rawBoxes.dispose();\n const filteredT = await tf.image.nonMaxSuppressionAsync(boxes, scores, config.hand.maxDetected, config.hand.iouThreshold, config.hand.minConfidence);\n const filtered = filteredT.arraySync();\n\n scoresT.dispose();\n filteredT.dispose();\n const hands: Array<{ box: Tensor, palmLandmarks: Tensor, confidence: number }> = [];\n for (const index of filtered) {\n if (scores[index] >= config.hand.minConfidence) {\n const matchingBox = tf.slice(boxes, [index, 0], [1, -1]);\n const rawPalmLandmarks = tf.slice(predictions, [index, 5], [1, 14]);\n const palmLandmarks = tf.tidy(() => this.normalizeLandmarks(rawPalmLandmarks, index).reshape([-1, 2]));\n rawPalmLandmarks.dispose();\n hands.push({ box: matchingBox, palmLandmarks, confidence: scores[index] });\n }\n }\n predictions.dispose();\n boxes.dispose();\n return hands;\n }\n\n async estimateHandBounds(input, config): Promise<{ startPoint: number[]; endPoint: number[]; palmLandmarks: number[]; confidence: number }[]> {\n const inputHeight = input.shape[1];\n const inputWidth = input.shape[2];\n const image = tf.tidy(() => input.resizeBilinear([this.inputSize, this.inputSize]).div(127.5).sub(1));\n const predictions = await this.getBoxes(image, config);\n image.dispose();\n const hands: Array<{ startPoint: number[]; endPoint: number[]; palmLandmarks: number[]; confidence: number }> = [];\n if (!predictions || predictions.length === 0) return hands;\n for (const prediction of predictions) {\n const boxes = prediction.box.dataSync();\n const startPoint = boxes.slice(0, 2);\n const endPoint = boxes.slice(2, 4);\n const palmLandmarks = prediction.palmLandmarks.arraySync();\n prediction.box.dispose();\n prediction.palmLandmarks.dispose();\n hands.push(box.scaleBoxCoordinates({ startPoint, endPoint, palmLandmarks, confidence: prediction.confidence }, [inputWidth / this.inputSize, inputHeight / this.inputSize]));\n }\n return hands;\n }\n}\n", "export function normalizeRadians(angle) {\n return angle - 2 * Math.PI * Math.floor((angle + Math.PI) / (2 * Math.PI));\n}\n\nexport function computeRotation(point1, point2) {\n const radians = Math.PI / 2 - Math.atan2(-(point2[1] - point1[1]), point2[0] - point1[0]);\n return normalizeRadians(radians);\n}\n\nexport const buildTranslationMatrix = (x, y) => [[1, 0, x], [0, 1, y], [0, 0, 1]];\n\nexport function dot(v1, v2) {\n let product = 0;\n for (let i = 0; i < v1.length; i++) {\n product += v1[i] * v2[i];\n }\n return product;\n}\n\nexport function getColumnFrom2DArr(arr, columnIndex) {\n const column: Array = [];\n for (let i = 0; i < arr.length; i++) {\n column.push(arr[i][columnIndex]);\n }\n return column;\n}\n\nexport function multiplyTransformMatrices(mat1, mat2) {\n const product: Array = [];\n const size = mat1.length;\n for (let row = 0; row < size; row++) {\n product.push([]);\n for (let col = 0; col < size; col++) {\n product[row].push(dot(mat1[row], getColumnFrom2DArr(mat2, col)));\n }\n }\n return product;\n}\n\nexport function buildRotationMatrix(rotation, center) {\n const cosA = Math.cos(rotation);\n const sinA = Math.sin(rotation);\n const rotationMatrix = [[cosA, -sinA, 0], [sinA, cosA, 0], [0, 0, 1]];\n const translationMatrix = buildTranslationMatrix(center[0], center[1]);\n const translationTimesRotation = multiplyTransformMatrices(translationMatrix, rotationMatrix);\n const negativeTranslationMatrix = buildTranslationMatrix(-center[0], -center[1]);\n return multiplyTransformMatrices(translationTimesRotation, negativeTranslationMatrix);\n}\n\nexport function invertTransformMatrix(matrix) {\n const rotationComponent = [[matrix[0][0], matrix[1][0]], [matrix[0][1], matrix[1][1]]];\n const translationComponent = [matrix[0][2], matrix[1][2]];\n const invertedTranslation = [\n -dot(rotationComponent[0], translationComponent),\n -dot(rotationComponent[1], translationComponent),\n ];\n return [\n rotationComponent[0].concat(invertedTranslation[0]),\n rotationComponent[1].concat(invertedTranslation[1]),\n [0, 0, 1],\n ];\n}\n\nexport function rotatePoint(homogeneousCoordinate, rotationMatrix) {\n return [\n dot(homogeneousCoordinate, rotationMatrix[0]),\n dot(homogeneousCoordinate, rotationMatrix[1]),\n ];\n}\n", "import * as tf from '../../dist/tfjs.esm.js';\nimport * as box from './box';\nimport * as util from './util';\nimport * as detector from './handdetector';\nimport { Tensor, GraphModel } from '../tfjs/types';\n\nconst palmBoxEnlargeFactor = 5; // default 3\nconst handBoxEnlargeFactor = 1.65; // default 1.65\nconst palmLandmarkIds = [0, 5, 9, 13, 17, 1, 2];\nconst palmLandmarksPalmBase = 0;\nconst palmLandmarksMiddleFingerBase = 2;\n\nexport class HandPipeline {\n handDetector: detector.HandDetector;\n handPoseModel: GraphModel;\n inputSize: number;\n storedBoxes: Array<{ startPoint: number[]; endPoint: number[]; palmLandmarks: number[]; confidence: number } | null>;\n skipped: number;\n detectedHands: number;\n\n constructor(handDetector, handPoseModel) {\n this.handDetector = handDetector;\n this.handPoseModel = handPoseModel;\n // @ts-ignore model is not undefined here\n this.inputSize = this.handPoseModel?.inputs[0].shape[2];\n this.storedBoxes = [];\n this.skipped = 0;\n this.detectedHands = 0;\n }\n\n // eslint-disable-next-line class-methods-use-this\n calculateLandmarksBoundingBox(landmarks) {\n const xs = landmarks.map((d) => d[0]);\n const ys = landmarks.map((d) => d[1]);\n const startPoint = [Math.min(...xs), Math.min(...ys)];\n const endPoint = [Math.max(...xs), Math.max(...ys)];\n return { startPoint, endPoint };\n }\n\n getBoxForPalmLandmarks(palmLandmarks, rotationMatrix) {\n const rotatedPalmLandmarks = palmLandmarks.map((coord) => util.rotatePoint([...coord, 1], rotationMatrix));\n const boxAroundPalm = this.calculateLandmarksBoundingBox(rotatedPalmLandmarks);\n return box.enlargeBox(box.squarifyBox(boxAroundPalm), palmBoxEnlargeFactor);\n }\n\n getBoxForHandLandmarks(landmarks) {\n const boundingBox = this.calculateLandmarksBoundingBox(landmarks);\n const boxAroundHand = box.enlargeBox(box.squarifyBox(boundingBox), handBoxEnlargeFactor);\n boxAroundHand.palmLandmarks = [];\n for (let i = 0; i < palmLandmarkIds.length; i++) {\n boxAroundHand.palmLandmarks.push(landmarks[palmLandmarkIds[i]].slice(0, 2));\n }\n return boxAroundHand;\n }\n\n transformRawCoords(rawCoords, box2, angle, rotationMatrix) {\n const boxSize = box.getBoxSize(box2);\n const scaleFactor = [boxSize[0] / this.inputSize, boxSize[1] / this.inputSize, (boxSize[0] + boxSize[1]) / this.inputSize / 2];\n const coordsScaled = rawCoords.map((coord) => [\n scaleFactor[0] * (coord[0] - this.inputSize / 2),\n scaleFactor[1] * (coord[1] - this.inputSize / 2),\n scaleFactor[2] * coord[2],\n ]);\n const coordsRotationMatrix = util.buildRotationMatrix(angle, [0, 0]);\n const coordsRotated = coordsScaled.map((coord) => {\n const rotated = util.rotatePoint(coord, coordsRotationMatrix);\n return [...rotated, coord[2]];\n });\n const inverseRotationMatrix = util.invertTransformMatrix(rotationMatrix);\n const boxCenter = [...box.getBoxCenter(box2), 1];\n const originalBoxCenter = [\n util.dot(boxCenter, inverseRotationMatrix[0]),\n util.dot(boxCenter, inverseRotationMatrix[1]),\n ];\n return coordsRotated.map((coord) => [\n Math.trunc(coord[0] + originalBoxCenter[0]),\n Math.trunc(coord[1] + originalBoxCenter[1]),\n Math.trunc(coord[2]),\n ]);\n }\n\n async estimateHands(image, config) {\n let useFreshBox = false;\n\n // run new detector every skipFrames unless we only want box to start with\n let boxes;\n\n // console.log(this.skipped, config.hand.skipFrames, !config.hand.landmarks, !config.skipFrame);\n if ((this.skipped === 0) || (this.skipped > config.hand.skipFrames) || !config.hand.landmarks || !config.skipFrame) {\n boxes = await this.handDetector.estimateHandBounds(image, config);\n this.skipped = 0;\n }\n if (config.skipFrame) this.skipped++;\n\n // if detector result count doesn't match current working set, use it to reset current working set\n if (boxes && (boxes.length > 0) && ((boxes.length !== this.detectedHands) && (this.detectedHands !== config.hand.maxDetected) || !config.hand.landmarks)) {\n this.detectedHands = 0;\n this.storedBoxes = [...boxes];\n // for (const possible of boxes) this.storedBoxes.push(possible);\n if (this.storedBoxes.length > 0) useFreshBox = true;\n }\n const hands: Array<{ landmarks?: number[], confidence: number, box: { topLeft: number[], bottomRight: number[] } }> = [];\n\n // go through working set of boxes\n for (let i = 0; i < this.storedBoxes.length; i++) {\n const currentBox = this.storedBoxes[i];\n if (!currentBox) continue;\n if (config.hand.landmarks) {\n const angle = config.hand.rotation ? util.computeRotation(currentBox.palmLandmarks[palmLandmarksPalmBase], currentBox.palmLandmarks[palmLandmarksMiddleFingerBase]) : 0;\n const palmCenter = box.getBoxCenter(currentBox);\n const palmCenterNormalized = [palmCenter[0] / image.shape[2], palmCenter[1] / image.shape[1]];\n const rotatedImage = config.hand.rotation && tf.ENV.flags.IS_BROWSER ? tf.image.rotateWithOffset(image, angle, 0, palmCenterNormalized) : image.clone();\n const rotationMatrix = util.buildRotationMatrix(-angle, palmCenter);\n const newBox = useFreshBox ? this.getBoxForPalmLandmarks(currentBox.palmLandmarks, rotationMatrix) : currentBox;\n const croppedInput = box.cutBoxFromImageAndResize(newBox, rotatedImage, [this.inputSize, this.inputSize]);\n const handImage = croppedInput.div(255);\n croppedInput.dispose();\n rotatedImage.dispose();\n const [confidenceT, keypoints] = await this.handPoseModel.predict(handImage) as Array;\n handImage.dispose();\n const confidence = confidenceT.dataSync()[0];\n confidenceT.dispose();\n if (confidence >= config.hand.minConfidence) {\n const keypointsReshaped = tf.reshape(keypoints, [-1, 3]);\n const rawCoords = keypointsReshaped.arraySync();\n keypoints.dispose();\n keypointsReshaped.dispose();\n const coords = this.transformRawCoords(rawCoords, newBox, angle, rotationMatrix);\n const nextBoundingBox = this.getBoxForHandLandmarks(coords);\n this.storedBoxes[i] = { ...nextBoundingBox, confidence };\n const result = {\n landmarks: coords,\n confidence,\n box: { topLeft: nextBoundingBox.startPoint, bottomRight: nextBoundingBox.endPoint },\n };\n hands.push(result);\n } else {\n this.storedBoxes[i] = null;\n }\n keypoints.dispose();\n } else {\n // const enlarged = box.enlargeBox(box.squarifyBox(box.shiftBox(currentBox, HAND_BOX_SHIFT_VECTOR)), handBoxEnlargeFactor);\n const enlarged = box.enlargeBox(box.squarifyBox(currentBox), handBoxEnlargeFactor);\n const result = {\n confidence: currentBox.confidence,\n box: { topLeft: enlarged.startPoint, bottomRight: enlarged.endPoint },\n };\n hands.push(result);\n }\n }\n this.storedBoxes = this.storedBoxes.filter((a) => a !== null);\n this.detectedHands = hands.length;\n return hands;\n }\n}\n", "/**\n * HandPose module entry point\n */\n\nimport { log, join } from '../helpers';\nimport * as tf from '../../dist/tfjs.esm.js';\nimport * as handdetector from './handdetector';\nimport * as handpipeline from './handpipeline';\nimport { Hand } from '../result';\nimport { Tensor, GraphModel } from '../tfjs/types';\nimport { Config } from '../config';\n\nconst meshAnnotations = {\n thumb: [1, 2, 3, 4],\n indexFinger: [5, 6, 7, 8],\n middleFinger: [9, 10, 11, 12],\n ringFinger: [13, 14, 15, 16],\n pinky: [17, 18, 19, 20],\n palmBase: [0],\n};\n\nlet handDetectorModel: GraphModel | null;\nlet handPoseModel: GraphModel | null;\nlet handPipeline: handpipeline.HandPipeline;\n\nexport async function predict(input: Tensor, config: Config): Promise {\n const predictions = await handPipeline.estimateHands(input, config);\n if (!predictions) return [];\n const hands: Array = [];\n for (let i = 0; i < predictions.length; i++) {\n const annotations = {};\n if (predictions[i].landmarks) {\n for (const key of Object.keys(meshAnnotations)) {\n // @ts-ignore landmarks are not undefined\n annotations[key] = meshAnnotations[key].map((index) => predictions[i].landmarks[index]);\n }\n }\n\n const keypoints = predictions[i].landmarks as unknown as Array<[number, number, number]>;\n\n let box: [number, number, number, number] = [Number.MAX_SAFE_INTEGER, Number.MAX_SAFE_INTEGER, 0, 0]; // maximums so conditionals work\n let boxRaw: [number, number, number, number] = [0, 0, 0, 0];\n if (keypoints && keypoints.length > 0) { // if we have landmarks, calculate box based on landmarks\n for (const pt of keypoints) {\n if (pt[0] < box[0]) box[0] = pt[0];\n if (pt[1] < box[1]) box[1] = pt[1];\n if (pt[0] > box[2]) box[2] = pt[0];\n if (pt[1] > box[3]) box[3] = pt[1];\n }\n box[2] -= box[0];\n box[3] -= box[1];\n boxRaw = [box[0] / (input.shape[2] || 0), box[1] / (input.shape[1] || 0), box[2] / (input.shape[2] || 0), box[3] / (input.shape[1] || 0)];\n } else { // otherwise use box from prediction\n box = predictions[i].box ? [\n Math.trunc(Math.max(0, predictions[i].box.topLeft[0])),\n Math.trunc(Math.max(0, predictions[i].box.topLeft[1])),\n Math.trunc(Math.min((input.shape[2] || 0), predictions[i].box.bottomRight[0]) - Math.max(0, predictions[i].box.topLeft[0])),\n Math.trunc(Math.min((input.shape[1] || 0), predictions[i].box.bottomRight[1]) - Math.max(0, predictions[i].box.topLeft[1])),\n ] : [0, 0, 0, 0];\n boxRaw = [\n (predictions[i].box.topLeft[0]) / (input.shape[2] || 0),\n (predictions[i].box.topLeft[1]) / (input.shape[1] || 0),\n (predictions[i].box.bottomRight[0] - predictions[i].box.topLeft[0]) / (input.shape[2] || 0),\n (predictions[i].box.bottomRight[1] - predictions[i].box.topLeft[1]) / (input.shape[1] || 0),\n ];\n }\n hands.push({ id: i, score: Math.round(100 * predictions[i].confidence) / 100, box, boxRaw, keypoints, annotations });\n }\n return hands;\n}\n\nexport async function load(config: Config): Promise<[unknown, unknown]> {\n if (!handDetectorModel || !handPoseModel) {\n // @ts-ignore type mismatch on GraphModel\n [handDetectorModel, handPoseModel] = await Promise.all([\n config.hand.enabled ? tf.loadGraphModel(join(config.modelBasePath, config.hand.detector.modelPath), { fromTFHub: config.hand.detector.modelPath.includes('tfhub.dev') }) : null,\n config.hand.landmarks ? tf.loadGraphModel(join(config.modelBasePath, config.hand.skeleton.modelPath), { fromTFHub: config.hand.skeleton.modelPath.includes('tfhub.dev') }) : null,\n ]);\n if (config.hand.enabled) {\n if (!handDetectorModel || !handDetectorModel['modelUrl']) log('load model failed:', config.hand.detector.modelPath);\n else if (config.debug) log('load model:', handDetectorModel['modelUrl']);\n if (!handPoseModel || !handPoseModel['modelUrl']) log('load model failed:', config.hand.skeleton.modelPath);\n else if (config.debug) log('load model:', handPoseModel['modelUrl']);\n }\n } else {\n if (config.debug) log('cached model:', handDetectorModel['modelUrl']);\n if (config.debug) log('cached model:', handPoseModel['modelUrl']);\n }\n const handDetector = new handdetector.HandDetector(handDetectorModel);\n handPipeline = new handpipeline.HandPipeline(handDetector, handPoseModel);\n return [handDetectorModel, handPoseModel];\n}\n", "export const full = [\n 'nose',\n 'leftEyeInside',\n 'leftEye',\n 'leftEyeOutside',\n 'rightEyeInside',\n 'rightEye',\n 'rightEyeOutside',\n 'leftEar',\n 'rightEar',\n 'leftMouth',\n 'rightMouth',\n 'leftShoulder',\n 'rightShoulder',\n 'leftElbow',\n 'rightElbow',\n 'leftWrist',\n 'rightWrist',\n 'leftPalm',\n 'rightPalm',\n 'leftIndex',\n 'rightIndex',\n 'leftPinky',\n 'rightPinky',\n 'leftHip',\n 'rightHip',\n 'leftKnee',\n 'rightKnee',\n 'leftAnkle',\n 'rightAnkle',\n 'leftHeel',\n 'rightHeel',\n 'leftFoot',\n 'rightFoot',\n 'midHip',\n 'forehead',\n 'leftThumb',\n 'leftHand',\n 'rightThumb',\n 'rightHand',\n];\n\nexport const upper = [\n 'nose',\n 'leftEyeInside',\n 'leftEye',\n 'leftEyeOutside',\n 'rightEyeInside',\n 'rightEye',\n 'rightEyeOutside',\n 'leftEar',\n 'rightEar',\n 'leftMouth',\n 'rightMouth',\n 'leftShoulder',\n 'rightShoulder',\n 'leftElbow',\n 'rightElbow',\n 'left:15',\n 'right:16',\n 'left:17',\n 'right:18',\n 'left:19',\n 'right:20',\n 'left:21',\n 'right:22',\n 'leftChest',\n 'rightChest',\n 'neck',\n 'forehead',\n 'left:27',\n 'right:28',\n 'left:29',\n 'right:30',\n];\n", "/**\n * BlazePose Module\n */\n\n// paper: https://ai.googleblog.com/2020/08/on-device-real-time-body-pose-tracking.html\n\nimport { log, join } from '../helpers';\nimport * as tf from '../../dist/tfjs.esm.js';\nimport * as annotations from './annotations';\nimport { Tensor, GraphModel } from '../tfjs/types';\nimport { Body } from '../result';\nimport { Config } from '../config';\n\nlet model: GraphModel;\n\nexport async function load(config: Config): Promise {\n if (!model) {\n // @ts-ignore type mismatch for Graphmodel\n model = await tf.loadGraphModel(join(config.modelBasePath, config.body.modelPath));\n model['width'] = parseInt(model['signature'].inputs['input_1:0'].tensorShape.dim[2].size);\n model['height'] = parseInt(model['signature'].inputs['input_1:0'].tensorShape.dim[1].size);\n if (!model || !model['modelUrl']) log('load model failed:', config.body.modelPath);\n else if (config.debug) log('load model:', model['modelUrl']);\n } else if (config.debug) log('cached model:', model['modelUrl']);\n return model;\n}\n\nexport async function predict(image: Tensor, config: Config): Promise {\n if (!model) return [];\n if (!config.body.enabled) return [];\n const imgSize = { width: (image.shape[2] || 0), height: (image.shape[1] || 0) };\n const resize = tf.image.resizeBilinear(image, [model['width'], model['height']], false);\n const normalize = tf.div(resize, [255.0]);\n resize.dispose();\n const resT = await model.predict(normalize) as Array;\n const points = resT.find((t) => (t.size === 195 || t.size === 155))?.dataSync() || []; // order of output tensors may change between models, full has 195 and upper has 155 items\n resT.forEach((t) => t.dispose());\n normalize.dispose();\n const keypoints: Array<{ id, part, position: [number, number, number], positionRaw: [number, number, number], score, presence }> = [];\n const labels = points?.length === 195 ? annotations.full : annotations.upper; // full model has 39 keypoints, upper has 31 keypoints\n const depth = 5; // each points has x,y,z,visibility,presence\n for (let i = 0; i < points.length / depth; i++) {\n keypoints.push({\n id: i,\n part: labels[i],\n position: [\n Math.trunc(imgSize.width * points[depth * i + 0] / 255), // return normalized x value istead of 0..255\n Math.trunc(imgSize.height * points[depth * i + 1] / 255), // return normalized y value istead of 0..255\n Math.trunc(points[depth * i + 2]) + 0, // fix negative zero\n ],\n positionRaw: [\n points[depth * i + 0] / 255, // return x value normalized to 0..1\n points[depth * i + 1] / 255, // return y value normalized to 0..1\n points[depth * i + 2] + 0, // fix negative zero\n ],\n score: (100 - Math.trunc(100 / (1 + Math.exp(points[depth * i + 3])))) / 100, // reverse sigmoid value\n presence: (100 - Math.trunc(100 / (1 + Math.exp(points[depth * i + 4])))) / 100, // reverse sigmoid value\n });\n }\n const x = keypoints.map((a) => a.position[0]);\n const y = keypoints.map((a) => a.position[1]);\n const box: [number, number, number, number] = [\n Math.min(...x),\n Math.min(...y),\n Math.max(...x) - Math.min(...x),\n Math.max(...y) - Math.min(...x),\n ];\n const boxRaw: [number, number, number, number] = [0, 0, 0, 0]; // not yet implemented\n const score = keypoints.reduce((prev, curr) => (curr.score > prev ? curr.score : prev), 0);\n return [{ id: 0, score, box, boxRaw, keypoints }];\n}\n", "/**\n * EfficientPose Module\n */\n\nimport { log, join } from '../helpers';\nimport * as tf from '../../dist/tfjs.esm.js';\nimport { Body } from '../result';\nimport { GraphModel, Tensor } from '../tfjs/types';\nimport { Config } from '../config';\n\nlet model: GraphModel;\n\ntype Keypoints = { score: number, part: string, position: [number, number], positionRaw: [number, number] };\n\nconst keypoints: Array = [];\nlet box: [number, number, number, number] = [0, 0, 0, 0];\nlet boxRaw: [number, number, number, number] = [0, 0, 0, 0];\nlet score = 0;\nlet skipped = Number.MAX_SAFE_INTEGER;\n\nconst bodyParts = ['head', 'neck', 'rightShoulder', 'rightElbow', 'rightWrist', 'chest', 'leftShoulder', 'leftElbow', 'leftWrist', 'pelvis', 'rightHip', 'rightKnee', 'rightAnkle', 'leftHip', 'leftKnee', 'leftAnkle'];\n\nexport async function load(config: Config): Promise {\n if (!model) {\n // @ts-ignore type mismatch on GraphModel\n model = await tf.loadGraphModel(join(config.modelBasePath, config.body.modelPath));\n if (!model || !model['modelUrl']) log('load model failed:', config.body.modelPath);\n else if (config.debug) log('load model:', model['modelUrl']);\n } else if (config.debug) log('cached model:', model['modelUrl']);\n return model;\n}\n\n// performs argmax and max functions on a 2d tensor\nfunction max2d(inputs, minScore) {\n const [width, height] = inputs.shape;\n return tf.tidy(() => {\n // modulus op implemented in tf\n const mod = (a, b) => tf.sub(a, tf.mul(tf.div(a, tf.scalar(b, 'int32')), tf.scalar(b, 'int32')));\n // combine all data\n const reshaped = tf.reshape(inputs, [height * width]);\n // get highest score\n const newScore = tf.max(reshaped, 0).dataSync()[0];\n if (newScore > minScore) {\n // skip coordinate calculation is score is too low\n const coords = tf.argMax(reshaped, 0);\n const x = mod(coords, width).dataSync()[0];\n const y = tf.div(coords, tf.scalar(width, 'int32')).dataSync()[0];\n return [x, y, newScore];\n }\n return [0, 0, newScore];\n });\n}\n\nexport async function predict(image: Tensor, config: Config): Promise {\n if ((skipped < config.body.skipFrames) && config.skipFrame && Object.keys(keypoints).length > 0) {\n skipped++;\n return [{ id: 0, score, box, boxRaw, keypoints }];\n }\n skipped = 0;\n return new Promise(async (resolve) => {\n const tensor = tf.tidy(() => {\n if (!model.inputs[0].shape) return null;\n const resize = tf.image.resizeBilinear(image, [model.inputs[0].shape[2], model.inputs[0].shape[1]], false);\n const enhance = tf.mul(resize, 2);\n const norm = enhance.sub(1);\n return norm;\n });\n\n let resT;\n if (config.body.enabled) resT = await model.predict(tensor);\n tensor.dispose();\n\n if (resT) {\n keypoints.length = 0;\n const squeeze = resT.squeeze();\n tf.dispose(resT);\n // body parts are basically just a stack of 2d tensors\n const stack = squeeze.unstack(2);\n tf.dispose(squeeze);\n // process each unstacked tensor as a separate body part\n for (let id = 0; id < stack.length; id++) {\n // actual processing to get coordinates and score\n const [x, y, partScore] = max2d(stack[id], config.body.minConfidence);\n if (score > config.body.minConfidence) {\n keypoints.push({\n score: Math.round(100 * partScore) / 100,\n part: bodyParts[id],\n positionRaw: [ // normalized to 0..1\n // @ts-ignore model is not undefined here\n x / model.inputs[0].shape[2], y / model.inputs[0].shape[1],\n ],\n position: [ // normalized to input image size\n // @ts-ignore model is not undefined here\n Math.round(image.shape[2] * x / model.inputs[0].shape[2]), Math.round(image.shape[1] * y / model.inputs[0].shape[1]),\n ],\n });\n }\n }\n stack.forEach((s) => tf.dispose(s));\n }\n score = keypoints.reduce((prev, curr) => (curr.score > prev ? curr.score : prev), 0);\n const x = keypoints.map((a) => a.position[0]);\n const y = keypoints.map((a) => a.position[1]);\n box = [\n Math.min(...x),\n Math.min(...y),\n Math.max(...x) - Math.min(...x),\n Math.max(...y) - Math.min(...y),\n ];\n const xRaw = keypoints.map((a) => a.positionRaw[0]);\n const yRaw = keypoints.map((a) => a.positionRaw[1]);\n boxRaw = [\n Math.min(...xRaw),\n Math.min(...yRaw),\n Math.max(...xRaw) - Math.min(...xRaw),\n Math.max(...yRaw) - Math.min(...yRaw),\n ];\n resolve([{ id: 0, score, box, boxRaw, keypoints }]);\n });\n}\n", "/**\n * EfficientPose Module\n */\n\nimport { log, join } from '../helpers';\nimport * as tf from '../../dist/tfjs.esm.js';\nimport { Body } from '../result';\nimport { GraphModel, Tensor } from '../tfjs/types';\nimport { Config } from '../config';\n\nlet model: GraphModel;\n\ntype Keypoints = { score: number, part: string, position: [number, number], positionRaw: [number, number] };\n\nconst keypoints: Array = [];\nlet box: [number, number, number, number] = [0, 0, 0, 0];\nlet boxRaw: [number, number, number, number] = [0, 0, 0, 0];\nlet score = 0;\nlet skipped = Number.MAX_SAFE_INTEGER;\n\nconst bodyParts = ['nose', 'leftEye', 'rightEye', 'leftEar', 'rightEar', 'leftShoulder', 'rightShoulder', 'leftElbow', 'rightElbow', 'leftWrist', 'rightWrist', 'leftHip', 'rightHip', 'leftKnee', 'rightKnee', 'leftAnkle', 'rightAnkle'];\n\nexport async function load(config: Config): Promise {\n if (!model) {\n // @ts-ignore type mismatch on GraphModel\n model = await tf.loadGraphModel(join(config.modelBasePath, config.body.modelPath));\n if (!model || !model['modelUrl']) log('load model failed:', config.body.modelPath);\n else if (config.debug) log('load model:', model['modelUrl']);\n } else if (config.debug) log('cached model:', model['modelUrl']);\n return model;\n}\n\nexport async function predict(image: Tensor, config: Config): Promise {\n if ((skipped < config.body.skipFrames) && config.skipFrame && Object.keys(keypoints).length > 0) {\n skipped++;\n return [{ id: 0, score, box, boxRaw, keypoints }];\n }\n skipped = 0;\n return new Promise(async (resolve) => {\n const tensor = tf.tidy(() => {\n if (!model.inputs[0].shape) return null;\n const resize = tf.image.resizeBilinear(image, [model.inputs[0].shape[2], model.inputs[0].shape[1]], false);\n const cast = tf.cast(resize, 'int32');\n return cast;\n });\n\n let resT;\n if (config.body.enabled) resT = await model.predict(tensor);\n tensor.dispose();\n\n if (resT) {\n keypoints.length = 0;\n const res = resT.arraySync();\n tf.dispose(resT);\n const kpt = res[0][0];\n for (let id = 0; id < kpt.length; id++) {\n score = kpt[id][2];\n if (score > config.body.minConfidence) {\n keypoints.push({\n score: Math.round(100 * score) / 100,\n part: bodyParts[id],\n positionRaw: [ // normalized to 0..1\n kpt[id][1],\n kpt[id][0],\n ],\n position: [ // normalized to input image size\n Math.round((image.shape[2] || 0) * kpt[id][1]),\n Math.round((image.shape[1] || 0) * kpt[id][0]),\n ],\n });\n }\n }\n }\n score = keypoints.reduce((prev, curr) => (curr.score > prev ? curr.score : prev), 0);\n const x = keypoints.map((a) => a.position[0]);\n const y = keypoints.map((a) => a.position[1]);\n box = [\n Math.min(...x),\n Math.min(...y),\n Math.max(...x) - Math.min(...x),\n Math.max(...y) - Math.min(...y),\n ];\n const xRaw = keypoints.map((a) => a.positionRaw[0]);\n const yRaw = keypoints.map((a) => a.positionRaw[1]);\n boxRaw = [\n Math.min(...xRaw),\n Math.min(...yRaw),\n Math.max(...xRaw) - Math.min(...xRaw),\n Math.max(...yRaw) - Math.min(...yRaw),\n ];\n resolve([{ id: 0, score, box, boxRaw, keypoints }]);\n });\n}\n", "/**\n * CoCo Labels used by object detection modules\n */\nexport const labels = [\n { class: 1, label: 'person' },\n { class: 2, label: 'bicycle' },\n { class: 3, label: 'car' },\n { class: 4, label: 'motorcycle' },\n { class: 5, label: 'airplane' },\n { class: 6, label: 'bus' },\n { class: 7, label: 'train' },\n { class: 8, label: 'truck' },\n { class: 9, label: 'boat' },\n { class: 10, label: 'traffic light' },\n { class: 11, label: 'fire hydrant' },\n { class: 12, label: 'stop sign' },\n { class: 13, label: 'parking meter' },\n { class: 14, label: 'bench' },\n { class: 15, label: 'bird' },\n { class: 16, label: 'cat' },\n { class: 17, label: 'dog' },\n { class: 18, label: 'horse' },\n { class: 19, label: 'sheep' },\n { class: 20, label: 'cow' },\n { class: 21, label: 'elephant' },\n { class: 22, label: 'bear' },\n { class: 23, label: 'zebra' },\n { class: 24, label: 'giraffe' },\n { class: 25, label: 'backpack' },\n { class: 26, label: 'umbrella' },\n { class: 27, label: 'handbag' },\n { class: 28, label: 'tie' },\n { class: 29, label: 'suitcase' },\n { class: 30, label: 'frisbee' },\n { class: 31, label: 'skis' },\n { class: 32, label: 'snowboard' },\n { class: 33, label: 'sports ball' },\n { class: 34, label: 'kite' },\n { class: 35, label: 'baseball bat' },\n { class: 36, label: 'baseball glove' },\n { class: 37, label: 'skateboard' },\n { class: 38, label: 'surfboard' },\n { class: 39, label: 'tennis racket' },\n { class: 40, label: 'bottle' },\n { class: 41, label: 'wine glass' },\n { class: 42, label: 'cup' },\n { class: 43, label: 'fork' },\n { class: 44, label: 'knife' },\n { class: 45, label: 'spoon' },\n { class: 46, label: 'bowl' },\n { class: 47, label: 'banana' },\n { class: 48, label: 'apple' },\n { class: 49, label: 'sandwich' },\n { class: 50, label: 'orange' },\n { class: 51, label: 'broccoli' },\n { class: 52, label: 'carrot' },\n { class: 53, label: 'hot dog' },\n { class: 54, label: 'pizza' },\n { class: 55, label: 'donut' },\n { class: 56, label: 'cake' },\n { class: 57, label: 'chair' },\n { class: 58, label: 'couch' },\n { class: 59, label: 'potted plant' },\n { class: 60, label: 'bed' },\n { class: 61, label: 'dining table' },\n { class: 62, label: 'toilet' },\n { class: 63, label: 'tv' },\n { class: 64, label: 'laptop' },\n { class: 65, label: 'mouse' },\n { class: 66, label: 'remote' },\n { class: 67, label: 'keyboard' },\n { class: 68, label: 'cell phone' },\n { class: 69, label: 'microwave' },\n { class: 70, label: 'oven' },\n { class: 71, label: 'toaster' },\n { class: 72, label: 'sink' },\n { class: 73, label: 'refrigerator' },\n { class: 74, label: 'book' },\n { class: 75, label: 'clock' },\n { class: 76, label: 'vase' },\n { class: 77, label: 'scissors' },\n { class: 78, label: 'teddy bear' },\n { class: 79, label: 'hair drier' },\n { class: 80, label: 'toothbrush' },\n];\n", "/**\n * NanoDet object detection module\n */\n\nimport { log, join } from '../helpers';\nimport * as tf from '../../dist/tfjs.esm.js';\nimport { labels } from './labels';\nimport { Item } from '../result';\nimport { GraphModel, Tensor } from '../tfjs/types';\nimport { Config } from '../config';\n\nlet model;\nlet last: Array = [];\nlet skipped = Number.MAX_SAFE_INTEGER;\n\nconst scaleBox = 2.5; // increase box size\n\nexport async function load(config: Config): Promise {\n if (!model) {\n model = await tf.loadGraphModel(join(config.modelBasePath, config.object.modelPath));\n const inputs = Object.values(model.modelSignature['inputs']);\n model.inputSize = Array.isArray(inputs) ? parseInt(inputs[0].tensorShape.dim[2].size) : null;\n if (!model.inputSize) throw new Error(`Human: Cannot determine model inputSize: ${config.object.modelPath}`);\n if (!model || !model.modelUrl) log('load model failed:', config.object.modelPath);\n else if (config.debug) log('load model:', model.modelUrl);\n } else if (config.debug) log('cached model:', model.modelUrl);\n return model;\n}\n\nasync function process(res, inputSize, outputShape, config) {\n let id = 0;\n let results: Array = [];\n for (const strideSize of [1, 2, 4]) { // try each stride size as it detects large/medium/small objects\n // find scores, boxes, classes\n tf.tidy(() => { // wrap in tidy to automatically deallocate temp tensors\n const baseSize = strideSize * 13; // 13x13=169, 26x26=676, 52x52=2704\n // find boxes and scores output depending on stride\n const scoresT = res.find((a) => (a.shape[1] === (baseSize ** 2) && a.shape[2] === labels.length))?.squeeze();\n const featuresT = res.find((a) => (a.shape[1] === (baseSize ** 2) && a.shape[2] < labels.length))?.squeeze();\n const boxesMax = featuresT.reshape([-1, 4, featuresT.shape[1] / 4]); // reshape [output] to [4, output / 4] where number is number of different features inside each stride\n const boxIdx = boxesMax.argMax(2).arraySync(); // what we need is indexes of features with highest scores, not values itself\n const scores = scoresT.arraySync(); // optionally use exponential scores or just as-is\n for (let i = 0; i < scoresT.shape[0]; i++) { // total strides (x * y matrix)\n for (let j = 0; j < scoresT.shape[1]; j++) { // one score for each class\n const score = scores[i][j]; // get score for current position\n if (score > config.object.minConfidence && j !== 61) {\n const cx = (0.5 + Math.trunc(i % baseSize)) / baseSize; // center.x normalized to range 0..1\n const cy = (0.5 + Math.trunc(i / baseSize)) / baseSize; // center.y normalized to range 0..1\n const boxOffset = boxIdx[i].map((a) => a * (baseSize / strideSize / inputSize)); // just grab indexes of features with highest scores\n const [x, y] = [\n cx - (scaleBox / strideSize * boxOffset[0]),\n cy - (scaleBox / strideSize * boxOffset[1]),\n ];\n const [w, h] = [\n cx + (scaleBox / strideSize * boxOffset[2]) - x,\n cy + (scaleBox / strideSize * boxOffset[3]) - y,\n ];\n let boxRaw = [x, y, w, h]; // results normalized to range 0..1\n boxRaw = boxRaw.map((a) => Math.max(0, Math.min(a, 1))); // fix out-of-bounds coords\n const box = [ // results normalized to input image pixels\n boxRaw[0] * outputShape[0],\n boxRaw[1] * outputShape[1],\n boxRaw[2] * outputShape[0],\n boxRaw[3] * outputShape[1],\n ];\n const result = {\n id: id++,\n // strideSize,\n score: Math.round(100 * score) / 100,\n class: j + 1,\n label: labels[j].label,\n // center: [Math.trunc(outputShape[0] * cx), Math.trunc(outputShape[1] * cy)],\n // centerRaw: [cx, cy],\n box: (box.map((a) => Math.trunc(a))) as [number, number, number, number],\n boxRaw: boxRaw as [number, number, number, number],\n };\n results.push(result);\n }\n }\n }\n });\n }\n // deallocate tensors\n res.forEach((t) => tf.dispose(t));\n\n // normally nms is run on raw results, but since boxes need to be calculated this way we skip calulcation of\n // unnecessary boxes and run nms only on good candidates (basically it just does IOU analysis as scores are already filtered)\n const nmsBoxes = results.map((a) => [a.boxRaw[1], a.boxRaw[0], a.boxRaw[3], a.boxRaw[2]]); // switches coordinates from x,y to y,x as expected by tf.nms\n const nmsScores = results.map((a) => a.score);\n let nmsIdx: Array = [];\n if (nmsBoxes && nmsBoxes.length > 0) {\n const nms = await tf.image.nonMaxSuppressionAsync(nmsBoxes, nmsScores, config.object.maxDetected, config.object.iouThreshold, config.object.minConfidence);\n nmsIdx = nms.dataSync();\n tf.dispose(nms);\n }\n\n // filter & sort results\n results = results\n .filter((_val, idx) => nmsIdx.includes(idx))\n .sort((a, b) => (b.score - a.score));\n\n return results;\n}\n\nexport async function predict(image: Tensor, config: Config): Promise {\n if ((skipped < config.object.skipFrames) && config.skipFrame && (last.length > 0)) {\n skipped++;\n return last;\n }\n skipped = 0;\n return new Promise(async (resolve) => {\n const outputSize = [image.shape[2], image.shape[1]];\n const resize = tf.image.resizeBilinear(image, [model.inputSize, model.inputSize], false);\n const norm = resize.div(255);\n const transpose = norm.transpose([0, 3, 1, 2]);\n norm.dispose();\n resize.dispose();\n\n let objectT;\n if (config.object.enabled) objectT = await model.predict(transpose);\n transpose.dispose();\n\n const obj = await process(objectT, model.inputSize, outputSize, config);\n last = obj;\n resolve(obj);\n });\n}\n", "/**\n * CenterNet object detection module\n */\n\nimport { log, join } from '../helpers';\nimport * as tf from '../../dist/tfjs.esm.js';\nimport { labels } from './labels';\nimport { Item } from '../result';\nimport { GraphModel, Tensor } from '../tfjs/types';\nimport { Config } from '../config';\n\nlet model;\nlet last: Item[] = [];\nlet skipped = Number.MAX_SAFE_INTEGER;\n\nexport async function load(config: Config): Promise {\n if (!model) {\n model = await tf.loadGraphModel(join(config.modelBasePath, config.object.modelPath));\n const inputs = Object.values(model.modelSignature['inputs']);\n model.inputSize = Array.isArray(inputs) ? parseInt(inputs[0].tensorShape.dim[2].size) : null;\n if (!model.inputSize) throw new Error(`Human: Cannot determine model inputSize: ${config.object.modelPath}`);\n if (!model || !model.modelUrl) log('load model failed:', config.object.modelPath);\n else if (config.debug) log('load model:', model.modelUrl);\n } else if (config.debug) log('cached model:', model.modelUrl);\n return model;\n}\n\nasync function process(res: Tensor, inputSize, outputShape, config: Config) {\n if (!res) return [];\n const results: Array = [];\n const detections = res.arraySync();\n const squeezeT = tf.squeeze(res);\n res.dispose();\n const arr = tf.split(squeezeT, 6, 1); // x1, y1, x2, y2, score, class\n squeezeT.dispose();\n const stackT = tf.stack([arr[1], arr[0], arr[3], arr[2]], 1); // reorder dims as tf.nms expects y, x\n const boxesT = stackT.squeeze();\n const scoresT = arr[4].squeeze();\n const classesT = arr[5].squeeze();\n arr.forEach((t) => t.dispose());\n const nmsT = await tf.image.nonMaxSuppressionAsync(boxesT, scoresT, config.object.maxDetected, config.object.iouThreshold, config.object.minConfidence);\n boxesT.dispose();\n scoresT.dispose();\n classesT.dispose();\n const nms = nmsT.dataSync();\n nmsT.dispose();\n let i = 0;\n for (const id of nms) {\n const score = Math.trunc(100 * detections[0][id][4]) / 100;\n const classVal = detections[0][id][5];\n const label = labels[classVal].label;\n const boxRaw = [\n detections[0][id][0] / inputSize,\n detections[0][id][1] / inputSize,\n detections[0][id][2] / inputSize,\n detections[0][id][3] / inputSize,\n ] as [number, number, number, number];\n const box = [\n Math.trunc(boxRaw[0] * outputShape[0]),\n Math.trunc(boxRaw[1] * outputShape[1]),\n Math.trunc(boxRaw[2] * outputShape[0]),\n Math.trunc(boxRaw[3] * outputShape[1]),\n ] as [number, number, number, number];\n results.push({ id: i++, score, class: classVal, label, box, boxRaw });\n }\n return results;\n}\n\nexport async function predict(input: Tensor, config: Config): Promise {\n if ((skipped < config.object.skipFrames) && config.skipFrame && (last.length > 0)) {\n skipped++;\n return last;\n }\n skipped = 0;\n return new Promise(async (resolve) => {\n const outputSize = [input.shape[2], input.shape[1]];\n const resize = tf.image.resizeBilinear(input, [model.inputSize, model.inputSize]);\n const objectT = config.object.enabled ? model.execute(resize, ['tower_0/detections']) : null;\n resize.dispose();\n\n const obj = await process(objectT, model.inputSize, outputSize, config);\n last = obj;\n resolve(obj);\n });\n}\n", "/**\n * Gesture detection module\n */\n\nimport { Gesture } from '../result';\n\nexport const body = (res): Gesture[] => {\n if (!res) return [];\n const gestures: Array<{ body: number, gesture: string }> = [];\n for (let i = 0; i < res.length; i++) {\n // raising hands\n const leftWrist = res[i].keypoints.find((a) => (a.part === 'leftWrist'));\n const rightWrist = res[i].keypoints.find((a) => (a.part === 'rightWrist'));\n const nose = res[i].keypoints.find((a) => (a.part === 'nose'));\n if (nose && leftWrist && rightWrist && (leftWrist.position.y < nose.position.y) && (rightWrist.position.y < nose.position.y)) gestures.push({ body: i, gesture: 'i give up' });\n else if (nose && leftWrist && (leftWrist.position.y < nose.position.y)) gestures.push({ body: i, gesture: 'raise left hand' });\n else if (nose && rightWrist && (rightWrist.position.y < nose.position.y)) gestures.push({ body: i, gesture: 'raise right hand' });\n\n // leaning\n const leftShoulder = res[i].keypoints.find((a) => (a.part === 'leftShoulder'));\n const rightShoulder = res[i].keypoints.find((a) => (a.part === 'rightShoulder'));\n if (leftShoulder && rightShoulder) gestures.push({ body: i, gesture: `leaning ${(leftShoulder.position.y > rightShoulder.position.y) ? 'left' : 'right'}` });\n }\n return gestures;\n};\n\nexport const face = (res): Gesture[] => {\n if (!res) return [];\n const gestures: Array<{ face: number, gesture: string }> = [];\n for (let i = 0; i < res.length; i++) {\n if (res[i].mesh && res[i].mesh.length > 0) {\n const eyeFacing = res[i].mesh[33][2] - res[i].mesh[263][2];\n if (Math.abs(eyeFacing) < 10) gestures.push({ face: i, gesture: 'facing center' });\n else gestures.push({ face: i, gesture: `facing ${eyeFacing < 0 ? 'left' : 'right'}` });\n const openLeft = Math.abs(res[i].mesh[374][1] - res[i].mesh[386][1]) / Math.abs(res[i].mesh[443][1] - res[i].mesh[450][1]); // center of eye inner lid y coord div center of wider eye border y coord\n if (openLeft < 0.2) gestures.push({ face: i, gesture: 'blink left eye' });\n const openRight = Math.abs(res[i].mesh[145][1] - res[i].mesh[159][1]) / Math.abs(res[i].mesh[223][1] - res[i].mesh[230][1]); // center of eye inner lid y coord div center of wider eye border y coord\n if (openRight < 0.2) gestures.push({ face: i, gesture: 'blink right eye' });\n const mouthOpen = Math.min(100, 500 * Math.abs(res[i].mesh[13][1] - res[i].mesh[14][1]) / Math.abs(res[i].mesh[10][1] - res[i].mesh[152][1]));\n if (mouthOpen > 10) gestures.push({ face: i, gesture: `mouth ${Math.trunc(mouthOpen)}% open` });\n const chinDepth = res[i].mesh[152][2];\n if (Math.abs(chinDepth) > 10) gestures.push({ face: i, gesture: `head ${chinDepth < 0 ? 'up' : 'down'}` });\n }\n }\n return gestures;\n};\n\nexport const iris = (res): Gesture[] => {\n if (!res) return [];\n const gestures: Array<{ iris: number, gesture: string }> = [];\n for (let i = 0; i < res.length; i++) {\n if (!res[i].annotations || !res[i].annotations.leftEyeIris || !res[i].annotations.rightEyeIris) continue;\n const sizeXLeft = res[i].annotations.leftEyeIris[3][0] - res[i].annotations.leftEyeIris[1][0];\n const sizeYLeft = res[i].annotations.leftEyeIris[4][1] - res[i].annotations.leftEyeIris[2][1];\n const areaLeft = Math.abs(sizeXLeft * sizeYLeft);\n\n const sizeXRight = res[i].annotations.rightEyeIris[3][0] - res[i].annotations.rightEyeIris[1][0];\n const sizeYRight = res[i].annotations.rightEyeIris[4][1] - res[i].annotations.rightEyeIris[2][1];\n const areaRight = Math.abs(sizeXRight * sizeYRight);\n\n let center = false;\n const difference = Math.abs(areaLeft - areaRight) / Math.max(areaLeft, areaRight);\n if (difference < 0.25) {\n center = true;\n gestures.push({ iris: i, gesture: 'facing center' });\n }\n\n const rightIrisCenterX = Math.abs(res[i].mesh[33][0] - res[i].annotations.rightEyeIris[0][0]) / res[i].box[2];\n const leftIrisCenterX = Math.abs(res[i].mesh[263][0] - res[i].annotations.leftEyeIris[0][0]) / res[i].box[2];\n if (leftIrisCenterX > 0.06 || rightIrisCenterX > 0.06) center = false;\n if (leftIrisCenterX > 0.06) gestures.push({ iris: i, gesture: 'looking right' });\n if (rightIrisCenterX > 0.06) gestures.push({ iris: i, gesture: 'looking left' });\n\n const rightIrisCenterY = Math.abs(res[i].mesh[145][1] - res[i].annotations.rightEyeIris[0][1]) / res[i].box[3];\n const leftIrisCenterY = Math.abs(res[i].mesh[374][1] - res[i].annotations.leftEyeIris[0][1]) / res[i].box[3];\n if (leftIrisCenterY < 0.01 || rightIrisCenterY < 0.01 || leftIrisCenterY > 0.022 || rightIrisCenterY > 0.022) center = false;\n if (leftIrisCenterY < 0.01 || rightIrisCenterY < 0.01) gestures.push({ iris: i, gesture: 'looking down' });\n if (leftIrisCenterY > 0.022 || rightIrisCenterY > 0.022) gestures.push({ iris: i, gesture: 'looking up' });\n\n // still center;\n if (center) gestures.push({ iris: i, gesture: 'looking center' });\n }\n return gestures;\n};\n\nexport const hand = (res): Gesture[] => {\n if (!res) return [];\n const gestures: Array<{ hand: number, gesture: string }> = [];\n for (let i = 0; i < res.length; i++) {\n const fingers: Array<{ name: string, position: number }> = [];\n for (const [finger, pos] of Object.entries(res[i]['annotations'])) {\n if (finger !== 'palmBase' && Array.isArray(pos)) fingers.push({ name: finger.toLowerCase(), position: pos[0] }); // get tip of each finger\n }\n if (fingers && fingers.length > 0) {\n const closest = fingers.reduce((best, a) => (best.position[2] < a.position[2] ? best : a));\n const highest = fingers.reduce((best, a) => (best.position[1] < a.position[1] ? best : a));\n gestures.push({ hand: i, gesture: `${closest.name} forward ${highest.name} up` });\n }\n }\n return gestures;\n};\n", "/*\nWebGLImageFilter by Dominic Szablewski: \n*/\n\nfunction GLProgram(gl, vertexSource, fragmentSource) {\n const _collect = function (source, prefix, collection) {\n const r = new RegExp('\\\\b' + prefix + ' \\\\w+ (\\\\w+)', 'ig');\n source.replace(r, (match, name) => {\n collection[name] = 0;\n return match;\n });\n };\n\n const _compile = function (source, type) {\n const shader = gl.createShader(type);\n gl.shaderSource(shader, source);\n gl.compileShader(shader);\n if (!gl.getShaderParameter(shader, gl.COMPILE_STATUS)) throw new Error('Filter: GL compile failed', gl.getShaderInfoLog(shader));\n return shader;\n };\n\n this.uniform = {};\n this.attribute = {};\n const _vsh = _compile(vertexSource, gl.VERTEX_SHADER);\n const _fsh = _compile(fragmentSource, gl.FRAGMENT_SHADER);\n this.id = gl.createProgram();\n gl.attachShader(this.id, _vsh);\n gl.attachShader(this.id, _fsh);\n gl.linkProgram(this.id);\n\n if (!gl.getProgramParameter(this.id, gl.LINK_STATUS)) throw new Error('Filter: GL link failed', gl.getProgramInfoLog(this.id));\n\n gl.useProgram(this.id);\n // Collect attributes\n _collect(vertexSource, 'attribute', this.attribute);\n for (const a in this.attribute) this.attribute[a] = gl.getAttribLocation(this.id, a);\n // Collect uniforms\n _collect(vertexSource, 'uniform', this.uniform);\n _collect(fragmentSource, 'uniform', this.uniform);\n for (const u in this.uniform) this.uniform[u] = gl.getUniformLocation(this.id, u);\n}\n\n// export const GLImageFilter = function (params) {\nexport function GLImageFilter(params) {\n if (!params) params = { };\n let _drawCount = 0;\n let _sourceTexture = null;\n let _lastInChain = false;\n let _currentFramebufferIndex = -1;\n let _tempFramebuffers = [null, null];\n let _filterChain = [];\n let _width = -1;\n let _height = -1;\n let _vertexBuffer = null;\n let _currentProgram = null;\n const _filter = {};\n const _canvas = params.canvas || document.createElement('canvas');\n // key is the shader program source, value is the compiled program\n const _shaderProgramCache = { };\n const DRAW = { INTERMEDIATE: 1 };\n const gl = _canvas.getContext('webgl');\n if (!gl) throw new Error('Filter: getContext() failed');\n\n this.addFilter = function (name) {\n // eslint-disable-next-line prefer-rest-params\n const args = Array.prototype.slice.call(arguments, 1);\n const filter = _filter[name];\n _filterChain.push({ func: filter, args });\n };\n\n this.reset = function () {\n _filterChain = [];\n };\n\n const _resize = function (width, height) {\n // Same width/height? Nothing to do here\n if (width === _width && height === _height) { return; }\n _canvas.width = width;\n _width = width;\n _canvas.height = height;\n _height = height;\n // Create the context if we don't have it yet\n if (!_vertexBuffer) {\n // Create the vertex buffer for the two triangles [x, y, u, v] * 6\n const vertices = new Float32Array([\n -1, -1, 0, 1, 1, -1, 1, 1, -1, 1, 0, 0,\n -1, 1, 0, 0, 1, -1, 1, 1, 1, 1, 1, 0,\n ]);\n // eslint-disable-next-line no-unused-expressions\n (_vertexBuffer = gl.createBuffer(), gl.bindBuffer(gl.ARRAY_BUFFER, _vertexBuffer));\n gl.bufferData(gl.ARRAY_BUFFER, vertices, gl.STATIC_DRAW);\n gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, true);\n }\n gl.viewport(0, 0, _width, _height);\n // Delete old temp framebuffers\n _tempFramebuffers = [null, null];\n };\n\n const _createFramebufferTexture = function (width, height) {\n const fbo = gl.createFramebuffer();\n gl.bindFramebuffer(gl.FRAMEBUFFER, fbo);\n const renderbuffer = gl.createRenderbuffer();\n gl.bindRenderbuffer(gl.RENDERBUFFER, renderbuffer);\n const texture = gl.createTexture();\n gl.bindTexture(gl.TEXTURE_2D, texture);\n gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, width, height, 0, gl.RGBA, gl.UNSIGNED_BYTE, null);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.LINEAR);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.LINEAR);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);\n gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_2D, texture, 0);\n gl.bindTexture(gl.TEXTURE_2D, null);\n gl.bindFramebuffer(gl.FRAMEBUFFER, null);\n return { fbo, texture };\n };\n\n const _getTempFramebuffer = function (index) {\n _tempFramebuffers[index] = _tempFramebuffers[index] || _createFramebufferTexture(_width, _height);\n return _tempFramebuffers[index];\n };\n\n const _draw = function (flags = null) {\n let source = null;\n let target = null;\n let flipY = false;\n // Set up the source\n if (_drawCount === 0) {\n // First draw call - use the source texture\n source = _sourceTexture;\n } else {\n // All following draw calls use the temp buffer last drawn to\n source = _getTempFramebuffer(_currentFramebufferIndex)?.texture;\n }\n _drawCount++;\n // Set up the target\n if (_lastInChain && !(flags & DRAW.INTERMEDIATE)) {\n // Last filter in our chain - draw directly to the WebGL Canvas. We may\n // also have to flip the image vertically now\n target = null;\n flipY = _drawCount % 2 === 0;\n } else {\n // Intermediate draw call - get a temp buffer to draw to\n _currentFramebufferIndex = (_currentFramebufferIndex + 1) % 2;\n target = _getTempFramebuffer(_currentFramebufferIndex)?.fbo;\n }\n // Bind the source and target and draw the two triangles\n gl.bindTexture(gl.TEXTURE_2D, source);\n gl.bindFramebuffer(gl.FRAMEBUFFER, target);\n gl.uniform1f(_currentProgram.uniform.flipY, (flipY ? -1 : 1));\n gl.drawArrays(gl.TRIANGLES, 0, 6);\n };\n\n this.apply = function (image) {\n _resize(image.width, image.height);\n _drawCount = 0;\n // Create the texture for the input image if we haven't yet\n if (!_sourceTexture) _sourceTexture = gl.createTexture();\n gl.bindTexture(gl.TEXTURE_2D, _sourceTexture);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.NEAREST);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.NEAREST);\n gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, image);\n // No filters? Just draw\n if (_filterChain.length === 0) {\n // const program = _compileShader(SHADER.FRAGMENT_IDENTITY);\n _draw();\n return _canvas;\n }\n for (let i = 0; i < _filterChain.length; i++) {\n _lastInChain = (i === _filterChain.length - 1);\n const f = _filterChain[i];\n f.func.apply(this, f.args || []);\n }\n return _canvas;\n };\n\n const _compileShader = function (fragmentSource) {\n if (_shaderProgramCache[fragmentSource]) {\n _currentProgram = _shaderProgramCache[fragmentSource];\n gl.useProgram(_currentProgram.id);\n return _currentProgram;\n }\n // Compile shaders\n const SHADER = {};\n SHADER.VERTEX_IDENTITY = [\n 'precision highp float;',\n 'attribute vec2 pos;',\n 'attribute vec2 uv;',\n 'varying vec2 vUv;',\n 'uniform float flipY;',\n 'void main(void) {',\n 'vUv = uv;',\n 'gl_Position = vec4(pos.x, pos.y*flipY, 0.0, 1.);',\n '}',\n ].join('\\n');\n SHADER.FRAGMENT_IDENTITY = [\n 'precision highp float;',\n 'varying vec2 vUv;',\n 'uniform sampler2D texture;',\n 'void main(void) {',\n 'gl_FragColor = texture2D(texture, vUv);',\n '}',\n ].join('\\n');\n _currentProgram = new GLProgram(gl, SHADER.VERTEX_IDENTITY, fragmentSource);\n const floatSize = Float32Array.BYTES_PER_ELEMENT;\n const vertSize = 4 * floatSize;\n gl.enableVertexAttribArray(_currentProgram.attribute.pos);\n gl.vertexAttribPointer(_currentProgram.attribute.pos, 2, gl.FLOAT, false, vertSize, 0 * floatSize);\n gl.enableVertexAttribArray(_currentProgram.attribute.uv);\n gl.vertexAttribPointer(_currentProgram.attribute.uv, 2, gl.FLOAT, false, vertSize, 2 * floatSize);\n _shaderProgramCache[fragmentSource] = _currentProgram;\n return _currentProgram;\n };\n\n // -------------------------------------------------------------------------\n // Color Matrix Filter\n _filter.colorMatrix = function (matrix) {\n // Create a Float32 Array and normalize the offset component to 0-1\n const m = new Float32Array(matrix);\n m[4] /= 255;\n m[9] /= 255;\n m[14] /= 255;\n m[19] /= 255;\n // Can we ignore the alpha value? Makes things a bit faster.\n const shader = (m[18] === 1 && m[3] === 0 && m[8] === 0 && m[13] === 0 && m[15] === 0 && m[16] === 0 && m[17] === 0 && m[19] === 0)\n ? _filter.colorMatrix.SHADER.WITHOUT_ALPHA\n : _filter.colorMatrix.SHADER.WITH_ALPHA;\n const program = _compileShader(shader);\n gl.uniform1fv(program.uniform.m, m);\n _draw();\n };\n _filter.colorMatrix.SHADER = {};\n _filter.colorMatrix.SHADER.WITH_ALPHA = [\n 'precision highp float;',\n 'varying vec2 vUv;',\n 'uniform sampler2D texture;',\n 'uniform float m[20];',\n 'void main(void) {',\n 'vec4 c = texture2D(texture, vUv);',\n 'gl_FragColor.r = m[0] * c.r + m[1] * c.g + m[2] * c.b + m[3] * c.a + m[4];',\n 'gl_FragColor.g = m[5] * c.r + m[6] * c.g + m[7] * c.b + m[8] * c.a + m[9];',\n 'gl_FragColor.b = m[10] * c.r + m[11] * c.g + m[12] * c.b + m[13] * c.a + m[14];',\n 'gl_FragColor.a = m[15] * c.r + m[16] * c.g + m[17] * c.b + m[18] * c.a + m[19];',\n '}',\n ].join('\\n');\n _filter.colorMatrix.SHADER.WITHOUT_ALPHA = [\n 'precision highp float;',\n 'varying vec2 vUv;',\n 'uniform sampler2D texture;',\n 'uniform float m[20];',\n 'void main(void) {',\n 'vec4 c = texture2D(texture, vUv);',\n 'gl_FragColor.r = m[0] * c.r + m[1] * c.g + m[2] * c.b + m[4];',\n 'gl_FragColor.g = m[5] * c.r + m[6] * c.g + m[7] * c.b + m[9];',\n 'gl_FragColor.b = m[10] * c.r + m[11] * c.g + m[12] * c.b + m[14];',\n 'gl_FragColor.a = c.a;',\n '}',\n ].join('\\n');\n\n _filter.brightness = function (brightness) {\n const b = (brightness || 0) + 1;\n _filter.colorMatrix([\n b, 0, 0, 0, 0,\n 0, b, 0, 0, 0,\n 0, 0, b, 0, 0,\n 0, 0, 0, 1, 0,\n ]);\n };\n\n _filter.saturation = function (amount) {\n const x = (amount || 0) * 2 / 3 + 1;\n const y = ((x - 1) * -0.5);\n _filter.colorMatrix([\n x, y, y, 0, 0,\n y, x, y, 0, 0,\n y, y, x, 0, 0,\n 0, 0, 0, 1, 0,\n ]);\n };\n\n _filter.desaturate = function () {\n _filter.saturation(-1);\n };\n\n _filter.contrast = function (amount) {\n const v = (amount || 0) + 1;\n const o = -128 * (v - 1);\n\n _filter.colorMatrix([\n v, 0, 0, 0, o,\n 0, v, 0, 0, o,\n 0, 0, v, 0, o,\n 0, 0, 0, 1, 0,\n ]);\n };\n\n _filter.negative = function () {\n _filter.contrast(-2);\n };\n\n _filter.hue = function (rotation) {\n rotation = (rotation || 0) / 180 * Math.PI;\n const cos = Math.cos(rotation);\n const sin = Math.sin(rotation);\n const lumR = 0.213;\n const lumG = 0.715;\n const lumB = 0.072;\n\n _filter.colorMatrix([\n lumR + cos * (1 - lumR) + sin * (-lumR), lumG + cos * (-lumG) + sin * (-lumG), lumB + cos * (-lumB) + sin * (1 - lumB), 0, 0,\n lumR + cos * (-lumR) + sin * (0.143), lumG + cos * (1 - lumG) + sin * (0.140), lumB + cos * (-lumB) + sin * (-0.283), 0, 0,\n lumR + cos * (-lumR) + sin * (-(1 - lumR)), lumG + cos * (-lumG) + sin * (lumG), lumB + cos * (1 - lumB) + sin * (lumB), 0, 0,\n 0, 0, 0, 1, 0,\n ]);\n };\n\n _filter.desaturateLuminance = function () {\n _filter.colorMatrix([\n 0.2764723, 0.9297080, 0.0938197, 0, -37.1,\n 0.2764723, 0.9297080, 0.0938197, 0, -37.1,\n 0.2764723, 0.9297080, 0.0938197, 0, -37.1,\n 0, 0, 0, 1, 0,\n ]);\n };\n\n _filter.sepia = function () {\n _filter.colorMatrix([\n 0.393, 0.7689999, 0.18899999, 0, 0,\n 0.349, 0.6859999, 0.16799999, 0, 0,\n 0.272, 0.5339999, 0.13099999, 0, 0,\n 0, 0, 0, 1, 0,\n ]);\n };\n\n _filter.brownie = function () {\n _filter.colorMatrix([\n 0.5997023498159715, 0.34553243048391263, -0.2708298674538042, 0, 47.43192855600873,\n -0.037703249837783157, 0.8609577587992641, 0.15059552388459913, 0, -36.96841498319127,\n 0.24113635128153335, -0.07441037908422492, 0.44972182064877153, 0, -7.562075277591283,\n 0, 0, 0, 1, 0,\n ]);\n };\n\n _filter.vintagePinhole = function () {\n _filter.colorMatrix([\n 0.6279345635605994, 0.3202183420819367, -0.03965408211312453, 0, 9.651285835294123,\n 0.02578397704808868, 0.6441188644374771, 0.03259127616149294, 0, 7.462829176470591,\n 0.0466055556782719, -0.0851232987247891, 0.5241648018700465, 0, 5.159190588235296,\n 0, 0, 0, 1, 0,\n ]);\n };\n\n _filter.kodachrome = function () {\n _filter.colorMatrix([\n 1.1285582396593525, -0.3967382283601348, -0.03992559172921793, 0, 63.72958762196502,\n -0.16404339962244616, 1.0835251566291304, -0.05498805115633132, 0, 24.732407896706203,\n -0.16786010706155763, -0.5603416277695248, 1.6014850761964943, 0, 35.62982807460946,\n 0, 0, 0, 1, 0,\n ]);\n };\n\n _filter.technicolor = function () {\n _filter.colorMatrix([\n 1.9125277891456083, -0.8545344976951645, -0.09155508482755585, 0, 11.793603434377337,\n -0.3087833385928097, 1.7658908555458428, -0.10601743074722245, 0, -70.35205161461398,\n -0.231103377548616, -0.7501899197440212, 1.847597816108189, 0, 30.950940869491138,\n 0, 0, 0, 1, 0,\n ]);\n };\n\n _filter.polaroid = function () {\n _filter.colorMatrix([\n 1.438, -0.062, -0.062, 0, 0,\n -0.122, 1.378, -0.122, 0, 0,\n -0.016, -0.016, 1.483, 0, 0,\n 0, 0, 0, 1, 0,\n ]);\n };\n\n _filter.shiftToBGR = function () {\n _filter.colorMatrix([\n 0, 0, 1, 0, 0,\n 0, 1, 0, 0, 0,\n 1, 0, 0, 0, 0,\n 0, 0, 0, 1, 0,\n ]);\n };\n\n // -------------------------------------------------------------------------\n // Convolution Filter\n _filter.convolution = function (matrix) {\n const m = new Float32Array(matrix);\n const pixelSizeX = 1 / _width;\n const pixelSizeY = 1 / _height;\n const program = _compileShader(_filter.convolution.SHADER);\n gl.uniform1fv(program.uniform.m, m);\n gl.uniform2f(program.uniform.px, pixelSizeX, pixelSizeY);\n _draw();\n };\n\n _filter.convolution.SHADER = [\n 'precision highp float;',\n 'varying vec2 vUv;',\n 'uniform sampler2D texture;',\n 'uniform vec2 px;',\n 'uniform float m[9];',\n 'void main(void) {',\n 'vec4 c11 = texture2D(texture, vUv - px);', // top left\n 'vec4 c12 = texture2D(texture, vec2(vUv.x, vUv.y - px.y));', // top center\n 'vec4 c13 = texture2D(texture, vec2(vUv.x + px.x, vUv.y - px.y));', // top right\n 'vec4 c21 = texture2D(texture, vec2(vUv.x - px.x, vUv.y) );', // mid left\n 'vec4 c22 = texture2D(texture, vUv);', // mid center\n 'vec4 c23 = texture2D(texture, vec2(vUv.x + px.x, vUv.y) );', // mid right\n 'vec4 c31 = texture2D(texture, vec2(vUv.x - px.x, vUv.y + px.y) );', // bottom left\n 'vec4 c32 = texture2D(texture, vec2(vUv.x, vUv.y + px.y) );', // bottom center\n 'vec4 c33 = texture2D(texture, vUv + px );', // bottom right\n 'gl_FragColor = ',\n 'c11 * m[0] + c12 * m[1] + c22 * m[2] +',\n 'c21 * m[3] + c22 * m[4] + c23 * m[5] +',\n 'c31 * m[6] + c32 * m[7] + c33 * m[8];',\n 'gl_FragColor.a = c22.a;',\n '}',\n ].join('\\n');\n\n _filter.detectEdges = function () {\n _filter.convolution.call(this, [\n 0, 1, 0,\n 1, -4, 1,\n 0, 1, 0,\n ]);\n };\n\n _filter.sobelX = function () {\n _filter.convolution.call(this, [\n -1, 0, 1,\n -2, 0, 2,\n -1, 0, 1,\n ]);\n };\n\n _filter.sobelY = function () {\n _filter.convolution.call(this, [\n -1, -2, -1,\n 0, 0, 0,\n 1, 2, 1,\n ]);\n };\n\n _filter.sharpen = function (amount) {\n const a = amount || 1;\n _filter.convolution.call(this, [\n 0, -1 * a, 0,\n -1 * a, 1 + 4 * a, -1 * a,\n 0, -1 * a, 0,\n ]);\n };\n\n _filter.emboss = function (size) {\n const s = size || 1;\n _filter.convolution.call(this, [\n -2 * s, -1 * s, 0,\n -1 * s, 1, 1 * s,\n 0, 1 * s, 2 * s,\n ]);\n };\n\n // -------------------------------------------------------------------------\n // Blur Filter\n _filter.blur = function (size) {\n const blurSizeX = (size / 7) / _width;\n const blurSizeY = (size / 7) / _height;\n const program = _compileShader(_filter.blur.SHADER);\n // Vertical\n gl.uniform2f(program.uniform.px, 0, blurSizeY);\n _draw(DRAW.INTERMEDIATE);\n // Horizontal\n gl.uniform2f(program.uniform.px, blurSizeX, 0);\n _draw();\n };\n\n _filter.blur.SHADER = [\n 'precision highp float;',\n 'varying vec2 vUv;',\n 'uniform sampler2D texture;',\n 'uniform vec2 px;',\n 'void main(void) {',\n 'gl_FragColor = vec4(0.0);',\n 'gl_FragColor += texture2D(texture, vUv + vec2(-7.0*px.x, -7.0*px.y))*0.0044299121055113265;',\n 'gl_FragColor += texture2D(texture, vUv + vec2(-6.0*px.x, -6.0*px.y))*0.00895781211794;',\n 'gl_FragColor += texture2D(texture, vUv + vec2(-5.0*px.x, -5.0*px.y))*0.0215963866053;',\n 'gl_FragColor += texture2D(texture, vUv + vec2(-4.0*px.x, -4.0*px.y))*0.0443683338718;',\n 'gl_FragColor += texture2D(texture, vUv + vec2(-3.0*px.x, -3.0*px.y))*0.0776744219933;',\n 'gl_FragColor += texture2D(texture, vUv + vec2(-2.0*px.x, -2.0*px.y))*0.115876621105;',\n 'gl_FragColor += texture2D(texture, vUv + vec2(-1.0*px.x, -1.0*px.y))*0.147308056121;',\n 'gl_FragColor += texture2D(texture, vUv )*0.159576912161;',\n 'gl_FragColor += texture2D(texture, vUv + vec2( 1.0*px.x, 1.0*px.y))*0.147308056121;',\n 'gl_FragColor += texture2D(texture, vUv + vec2( 2.0*px.x, 2.0*px.y))*0.115876621105;',\n 'gl_FragColor += texture2D(texture, vUv + vec2( 3.0*px.x, 3.0*px.y))*0.0776744219933;',\n 'gl_FragColor += texture2D(texture, vUv + vec2( 4.0*px.x, 4.0*px.y))*0.0443683338718;',\n 'gl_FragColor += texture2D(texture, vUv + vec2( 5.0*px.x, 5.0*px.y))*0.0215963866053;',\n 'gl_FragColor += texture2D(texture, vUv + vec2( 6.0*px.x, 6.0*px.y))*0.00895781211794;',\n 'gl_FragColor += texture2D(texture, vUv + vec2( 7.0*px.x, 7.0*px.y))*0.0044299121055113265;',\n '}',\n ].join('\\n');\n\n // -------------------------------------------------------------------------\n // Pixelate Filter\n _filter.pixelate = function (size) {\n const blurSizeX = (size) / _width;\n const blurSizeY = (size) / _height;\n const program = _compileShader(_filter.pixelate.SHADER);\n // Horizontal\n gl.uniform2f(program.uniform.size, blurSizeX, blurSizeY);\n _draw();\n };\n\n _filter.pixelate.SHADER = [\n 'precision highp float;',\n 'varying vec2 vUv;',\n 'uniform vec2 size;',\n 'uniform sampler2D texture;',\n 'vec2 pixelate(vec2 coord, vec2 size) {',\n 'return floor( coord / size ) * size;',\n '}',\n 'void main(void) {',\n 'gl_FragColor = vec4(0.0);',\n 'vec2 coord = pixelate(vUv, size);',\n 'gl_FragColor += texture2D(texture, coord);',\n '}',\n ].join('\\n');\n}\n", "/**\n * Image Processing module used by Human\n */\n\nimport * as tf from '../../dist/tfjs.esm.js';\nimport * as fxImage from './imagefx';\nimport { Tensor } from '../tfjs/types';\nimport { Config } from '../config';\n\ntype Input = Tensor | typeof Image | ImageData | ImageBitmap | HTMLImageElement | HTMLMediaElement | HTMLVideoElement | HTMLCanvasElement | OffscreenCanvas;\n\nconst maxSize = 2048;\n// internal temp canvases\nlet inCanvas;\nlet outCanvas;\n// instance of fximage\nlet fx;\n\n// process input image and return tensor\n// input can be tensor, imagedata, htmlimageelement, htmlvideoelement\n// input is resized and run through imagefx filter\nexport function process(input: Input, config: Config): { tensor: Tensor | null, canvas: OffscreenCanvas | HTMLCanvasElement } {\n let tensor;\n if (!input) throw new Error('Human: Input is missing');\n // sanity checks since different browsers do not implement all dom elements\n if (\n !(input instanceof tf.Tensor)\n && !(typeof Image !== 'undefined' && input instanceof Image)\n && !(typeof ImageData !== 'undefined' && input instanceof ImageData)\n && !(typeof ImageBitmap !== 'undefined' && input instanceof ImageBitmap)\n && !(typeof HTMLImageElement !== 'undefined' && input instanceof HTMLImageElement)\n && !(typeof HTMLMediaElement !== 'undefined' && input instanceof HTMLMediaElement)\n && !(typeof HTMLVideoElement !== 'undefined' && input instanceof HTMLVideoElement)\n && !(typeof HTMLCanvasElement !== 'undefined' && input instanceof HTMLCanvasElement)\n && !(typeof OffscreenCanvas !== 'undefined' && input instanceof OffscreenCanvas)\n ) {\n throw new Error('Human: Input type is not recognized');\n }\n if (input instanceof tf.Tensor) {\n // if input is tensor, use as-is\n if (input.shape && input.shape.length === 4 && input.shape[0] === 1 && input.shape[3] === 3) tensor = tf.clone(input);\n else throw new Error(`Human: Input tensor shape must be [1, height, width, 3] and instead was ${input.shape}`);\n } else {\n // check if resizing will be needed\n const originalWidth = input['naturalWidth'] || input['videoWidth'] || input['width'] || (input['shape'] && (input['shape'][1] > 0));\n const originalHeight = input['naturalHeight'] || input['videoHeight'] || input['height'] || (input['shape'] && (input['shape'][2] > 0));\n if (!originalWidth || !originalHeight) return { tensor: null, canvas: inCanvas }; // video may become temporarily unavailable due to onresize\n let targetWidth = originalWidth;\n let targetHeight = originalHeight;\n if (targetWidth > maxSize) {\n targetWidth = maxSize;\n targetHeight = targetWidth * originalHeight / originalWidth;\n }\n if (targetHeight > maxSize) {\n targetHeight = maxSize;\n targetWidth = targetHeight * originalWidth / originalHeight;\n }\n\n // create our canvas and resize it if needed\n if (config.filter.width > 0) targetWidth = config.filter.width;\n else if (config.filter.height > 0) targetWidth = originalWidth * (config.filter.height / originalHeight);\n if (config.filter.height > 0) targetHeight = config.filter.height;\n else if (config.filter.width > 0) targetHeight = originalHeight * (config.filter.width / originalWidth);\n if (!targetWidth || !targetHeight) throw new Error('Human: Input cannot determine dimension');\n if (!inCanvas || (inCanvas?.width !== targetWidth) || (inCanvas?.height !== targetHeight)) {\n inCanvas = (typeof OffscreenCanvas !== 'undefined') ? new OffscreenCanvas(targetWidth, targetHeight) : document.createElement('canvas');\n if (inCanvas?.width !== targetWidth) inCanvas.width = targetWidth;\n if (inCanvas?.height !== targetHeight) inCanvas.height = targetHeight;\n }\n\n // draw input to our canvas\n const ctx = inCanvas.getContext('2d');\n if (input instanceof ImageData) {\n ctx.putImageData(input, 0, 0);\n } else {\n if (config.filter.flip && typeof ctx.translate !== 'undefined') {\n ctx.translate(originalWidth, 0);\n ctx.scale(-1, 1);\n ctx.drawImage(input, 0, 0, originalWidth, originalHeight, 0, 0, inCanvas?.width, inCanvas?.height);\n ctx.setTransform(1, 0, 0, 1, 0, 0); // resets transforms to defaults\n } else {\n ctx.drawImage(input, 0, 0, originalWidth, originalHeight, 0, 0, inCanvas?.width, inCanvas?.height);\n }\n }\n\n // imagefx transforms using gl\n if (config.filter.enabled) {\n if (!fx || !outCanvas || (inCanvas.width !== outCanvas.width) || (inCanvas?.height !== outCanvas?.height)) {\n outCanvas = (typeof OffscreenCanvas !== 'undefined') ? new OffscreenCanvas(inCanvas?.width, inCanvas?.height) : document.createElement('canvas');\n if (outCanvas?.width !== inCanvas?.width) outCanvas.width = inCanvas?.width;\n if (outCanvas?.height !== inCanvas?.height) outCanvas.height = inCanvas?.height;\n // log('created FX filter');\n fx = tf.ENV.flags.IS_BROWSER ? new fxImage.GLImageFilter({ canvas: outCanvas }) : null; // && (typeof document !== 'undefined')\n }\n if (!fx) return { tensor: null, canvas: inCanvas };\n fx.reset();\n fx.addFilter('brightness', config.filter.brightness); // must have at least one filter enabled\n if (config.filter.contrast !== 0) fx.addFilter('contrast', config.filter.contrast);\n if (config.filter.sharpness !== 0) fx.addFilter('sharpen', config.filter.sharpness);\n if (config.filter.blur !== 0) fx.addFilter('blur', config.filter.blur);\n if (config.filter.saturation !== 0) fx.addFilter('saturation', config.filter.saturation);\n if (config.filter.hue !== 0) fx.addFilter('hue', config.filter.hue);\n if (config.filter.negative) fx.addFilter('negative');\n if (config.filter.sepia) fx.addFilter('sepia');\n if (config.filter.vintage) fx.addFilter('brownie');\n if (config.filter.sepia) fx.addFilter('sepia');\n if (config.filter.kodachrome) fx.addFilter('kodachrome');\n if (config.filter.technicolor) fx.addFilter('technicolor');\n if (config.filter.polaroid) fx.addFilter('polaroid');\n if (config.filter.pixelate !== 0) fx.addFilter('pixelate', config.filter.pixelate);\n fx.apply(inCanvas);\n // read pixel data\n /*\n const gl = outCanvas.getContext('webgl');\n if (gl) {\n const glBuffer = new Uint8Array(outCanvas.width * outCanvas.height * 4);\n const pixBuffer = new Uint8Array(outCanvas.width * outCanvas.height * 3);\n gl.readPixels(0, 0, outCanvas.width, outCanvas.height, gl.RGBA, gl.UNSIGNED_BYTE, glBuffer);\n // gl returns rbga while we only need rgb, so discarding alpha channel\n // gl returns starting point as lower left, so need to invert vertical\n let i = 0;\n for (let y = outCanvas.height - 1; y >= 0; y--) {\n for (let x = 0; x < outCanvas.width; x++) {\n const index = (x + y * outCanvas.width) * 4;\n pixBuffer[i++] = glBuffer[index + 0];\n pixBuffer[i++] = glBuffer[index + 1];\n pixBuffer[i++] = glBuffer[index + 2];\n }\n }\n outCanvas.data = pixBuffer;\n }\n */\n } else {\n outCanvas = inCanvas;\n if (fx) fx = null;\n }\n\n // create tensor from image\n let pixels;\n if (outCanvas.data) { // if we have data, just convert to tensor\n const shape = [outCanvas.height, outCanvas.width, 3];\n pixels = tf.tensor3d(outCanvas.data, shape, 'int32');\n } else if (outCanvas instanceof ImageData) { // if input is imagedata, just use it\n pixels = tf.browser ? tf.browser.fromPixels(outCanvas) : null;\n } else if (config.backend === 'webgl' || config.backend === 'humangl') { // tf kernel-optimized method to get imagedata\n // we can use canvas as-is as it already has a context, so we do a silly one more canvas\n const tempCanvas = (typeof OffscreenCanvas !== 'undefined') ? new OffscreenCanvas(targetWidth, targetHeight) : document.createElement('canvas');\n tempCanvas.width = targetWidth;\n tempCanvas.height = targetHeight;\n const tempCtx = tempCanvas.getContext('2d');\n tempCtx?.drawImage(outCanvas, 0, 0);\n pixels = tf.browser ? tf.browser.fromPixels(tempCanvas) : null;\n } else { // cpu and wasm kernel does not implement efficient fromPixels method\n // we can use canvas as-is as it already has a context, so we do a silly one more canvas\n const tempCanvas = (typeof OffscreenCanvas !== 'undefined') ? new OffscreenCanvas(targetWidth, targetHeight) : document.createElement('canvas');\n tempCanvas.width = targetWidth;\n tempCanvas.height = targetHeight;\n const tempCtx = tempCanvas.getContext('2d');\n tempCtx?.drawImage(outCanvas, 0, 0);\n const data = tempCtx?.getImageData(0, 0, targetWidth, targetHeight);\n pixels = tf.browser ? tf.browser.fromPixels(data) : null;\n }\n if (pixels) {\n const casted = pixels.toFloat();\n tensor = casted.expandDims(0);\n pixels.dispose();\n casted.dispose();\n }\n }\n const canvas = config.filter.return ? outCanvas : null;\n return { tensor, canvas };\n}\n", "/**\n * Module that implements helper draw functions, exposed as human.draw\n */\n\nimport { TRI468 as triangulation } from '../blazeface/coords';\nimport { mergeDeep, now } from '../helpers';\nimport type { Result, Face, Body, Hand, Item, Gesture, Person } from '../result';\n\n/**\n * Draw Options\n * Accessed via `human.draw.options` or provided per each draw method as the drawOptions optional parameter\n * -color: draw color\n * -labelColor: color for labels\n * -shadowColor: optional shadow color for labels\n * -font: font for labels\n * -lineHeight: line height for labels, used for multi-line labels,\n * -lineWidth: width of any lines,\n * -pointSize: size of any point,\n * -roundRect: for boxes, round corners by this many pixels,\n * -drawPoints: should points be drawn,\n * -drawLabels: should labels be drawn,\n * -drawBoxes: should boxes be drawn,\n * -drawPolygons: should polygons be drawn,\n * -fillPolygons: should drawn polygons be filled,\n * -useDepth: use z-axis coordinate as color shade,\n * -useCurves: draw polygons as cures or as lines,\n * -bufferedOutput: experimental: allows to call draw methods multiple times for each detection and interpolate results between results thus achieving smoother animations\n */\nexport interface DrawOptions {\n color: string,\n labelColor: string,\n shadowColor: string,\n font: string,\n lineHeight: number,\n lineWidth: number,\n pointSize: number,\n roundRect: number,\n drawPoints: boolean,\n drawLabels: boolean,\n drawBoxes: boolean,\n drawPolygons: boolean,\n drawGaze: boolean,\n fillPolygons: boolean,\n useDepth: boolean,\n useCurves: boolean,\n bufferedOutput: boolean,\n}\n\nexport const options: DrawOptions = {\n color: 'rgba(173, 216, 230, 0.6)', // 'lightblue' with light alpha channel\n labelColor: 'rgba(173, 216, 230, 1)', // 'lightblue' with dark alpha channel\n shadowColor: 'black',\n font: 'small-caps 14px \"Segoe UI\"',\n lineHeight: 24,\n lineWidth: 6,\n pointSize: 2,\n roundRect: 28,\n drawPoints: false,\n drawLabels: true,\n drawBoxes: true,\n drawPolygons: true,\n drawGaze: true,\n fillPolygons: false,\n useDepth: true,\n useCurves: false,\n bufferedOutput: true,\n};\n\nconst rad2deg = (theta) => Math.round((theta * 180) / Math.PI);\n\nfunction point(ctx, x, y, z = 0, localOptions) {\n ctx.fillStyle = localOptions.useDepth && z ? `rgba(${127.5 + (2 * z)}, ${127.5 - (2 * z)}, 255, 0.3)` : localOptions.color;\n ctx.beginPath();\n ctx.arc(x, y, localOptions.pointSize, 0, 2 * Math.PI);\n ctx.fill();\n}\n\nfunction rect(ctx, x, y, width, height, localOptions) {\n ctx.beginPath();\n if (localOptions.useCurves) {\n const cx = (x + x + width) / 2;\n const cy = (y + y + height) / 2;\n ctx.ellipse(cx, cy, width / 2, height / 2, 0, 0, 2 * Math.PI);\n } else {\n ctx.lineWidth = localOptions.lineWidth;\n ctx.moveTo(x + localOptions.roundRect, y);\n ctx.lineTo(x + width - localOptions.roundRect, y);\n ctx.quadraticCurveTo(x + width, y, x + width, y + localOptions.roundRect);\n ctx.lineTo(x + width, y + height - localOptions.roundRect);\n ctx.quadraticCurveTo(x + width, y + height, x + width - localOptions.roundRect, y + height);\n ctx.lineTo(x + localOptions.roundRect, y + height);\n ctx.quadraticCurveTo(x, y + height, x, y + height - localOptions.roundRect);\n ctx.lineTo(x, y + localOptions.roundRect);\n ctx.quadraticCurveTo(x, y, x + localOptions.roundRect, y);\n ctx.closePath();\n }\n ctx.stroke();\n}\n\nfunction lines(ctx, points: [number, number, number?][] = [], localOptions) {\n if (points === undefined || points.length === 0) return;\n ctx.beginPath();\n ctx.moveTo(points[0][0], points[0][1]);\n for (const pt of points) {\n const z = pt[2] || 0;\n ctx.strokeStyle = localOptions.useDepth && z ? `rgba(${127.5 + (2 * z)}, ${127.5 - (2 * z)}, 255, 0.3)` : localOptions.color;\n ctx.fillStyle = localOptions.useDepth && z ? `rgba(${127.5 + (2 * z)}, ${127.5 - (2 * z)}, 255, 0.3)` : localOptions.color;\n ctx.lineTo(pt[0], Math.round(pt[1]));\n }\n ctx.stroke();\n if (localOptions.fillPolygons) {\n ctx.closePath();\n ctx.fill();\n }\n}\n\nfunction curves(ctx, points: [number, number, number?][] = [], localOptions) {\n if (points === undefined || points.length === 0) return;\n if (!localOptions.useCurves || points.length <= 2) {\n lines(ctx, points, localOptions);\n return;\n }\n ctx.moveTo(points[0][0], points[0][1]);\n for (let i = 0; i < points.length - 2; i++) {\n const xc = (points[i][0] + points[i + 1][0]) / 2;\n const yc = (points[i][1] + points[i + 1][1]) / 2;\n ctx.quadraticCurveTo(points[i][0], points[i][1], xc, yc);\n }\n ctx.quadraticCurveTo(points[points.length - 2][0], points[points.length - 2][1], points[points.length - 1][0], points[points.length - 1][1]);\n ctx.stroke();\n if (localOptions.fillPolygons) {\n ctx.closePath();\n ctx.fill();\n }\n}\n\nexport async function gesture(inCanvas: HTMLCanvasElement, result: Array, drawOptions?: DrawOptions) {\n const localOptions = mergeDeep(options, drawOptions);\n if (!result || !inCanvas) return;\n if (!(inCanvas instanceof HTMLCanvasElement)) return;\n const ctx = inCanvas.getContext('2d');\n if (!ctx) return;\n ctx.font = localOptions.font;\n ctx.fillStyle = localOptions.color;\n let i = 1;\n for (let j = 0; j < result.length; j++) {\n let where: unknown[] = []; // what&where is a record\n let what: unknown[] = []; // what&where is a record\n [where, what] = Object.entries(result[j]);\n if ((what.length > 1) && ((what[1] as string).length > 0)) {\n const who = where[1] as number > 0 ? `#${where[1]}` : '';\n const label = `${where[0]} ${who}: ${what[1]}`;\n if (localOptions.shadowColor && localOptions.shadowColor !== '') {\n ctx.fillStyle = localOptions.shadowColor;\n ctx.fillText(label, 8, 2 + (i * localOptions.lineHeight));\n }\n ctx.fillStyle = localOptions.labelColor;\n ctx.fillText(label, 6, 0 + (i * localOptions.lineHeight));\n i += 1;\n }\n }\n}\n\nexport async function face(inCanvas: HTMLCanvasElement, result: Array, drawOptions?: DrawOptions) {\n const localOptions = mergeDeep(options, drawOptions);\n if (!result || !inCanvas) return;\n if (!(inCanvas instanceof HTMLCanvasElement)) return;\n const ctx = inCanvas.getContext('2d');\n if (!ctx) return;\n for (const f of result) {\n ctx.font = localOptions.font;\n ctx.strokeStyle = localOptions.color;\n ctx.fillStyle = localOptions.color;\n if (localOptions.drawBoxes) rect(ctx, f.box[0], f.box[1], f.box[2], f.box[3], localOptions);\n // silly hack since fillText does not suport new line\n const labels:string[] = [];\n labels.push(`face: ${Math.trunc(100 * f.score)}%`);\n if (f.genderScore) labels.push(`${f.gender || ''} ${Math.trunc(100 * f.genderScore)}%`);\n if (f.age) labels.push(`age: ${f.age || ''}`);\n if (f.iris) labels.push(`distance: ${f.iris}`);\n if (f.emotion && f.emotion.length > 0) {\n const emotion = f.emotion.map((a) => `${Math.trunc(100 * a.score)}% ${a.emotion}`);\n if (emotion.length > 3) emotion.length = 3;\n labels.push(emotion.join(' '));\n }\n if (f.rotation && f.rotation.angle && f.rotation.gaze) {\n if (f.rotation.angle.roll) labels.push(`roll: ${rad2deg(f.rotation.angle.roll)}\u00B0 yaw:${rad2deg(f.rotation.angle.yaw)}\u00B0 pitch:${rad2deg(f.rotation.angle.pitch)}\u00B0`);\n if (f.rotation.gaze.bearing) labels.push(`gaze: ${rad2deg(f.rotation.gaze.bearing)}\u00B0`);\n }\n if (labels.length === 0) labels.push('face');\n ctx.fillStyle = localOptions.color;\n for (let i = labels.length - 1; i >= 0; i--) {\n const x = Math.max(f.box[0], 0);\n const y = i * localOptions.lineHeight + f.box[1];\n if (localOptions.shadowColor && localOptions.shadowColor !== '') {\n ctx.fillStyle = localOptions.shadowColor;\n ctx.fillText(labels[i], x + 5, y + 16);\n }\n ctx.fillStyle = localOptions.labelColor;\n ctx.fillText(labels[i], x + 4, y + 15);\n }\n ctx.lineWidth = 1;\n if (f.mesh && f.mesh.length > 0) {\n if (localOptions.drawPoints) {\n for (const pt of f.mesh) point(ctx, pt[0], pt[1], pt[2], localOptions);\n // for (const pt of f.meshRaw) point(ctx, pt[0] * inCanvas.offsetWidth, pt[1] * inCanvas.offsetHeight, pt[2]);\n }\n if (localOptions.drawPolygons) {\n ctx.lineWidth = 1;\n for (let i = 0; i < triangulation.length / 3; i++) {\n const points = [\n triangulation[i * 3 + 0],\n triangulation[i * 3 + 1],\n triangulation[i * 3 + 2],\n ].map((index) => f.mesh[index]);\n lines(ctx, points, localOptions);\n }\n // iris: array[center, left, top, right, bottom]\n if (f.annotations && f.annotations['leftEyeIris']) {\n ctx.strokeStyle = localOptions.useDepth ? 'rgba(255, 200, 255, 0.3)' : localOptions.color;\n ctx.beginPath();\n const sizeX = Math.abs(f.annotations['leftEyeIris'][3][0] - f.annotations['leftEyeIris'][1][0]) / 2;\n const sizeY = Math.abs(f.annotations['leftEyeIris'][4][1] - f.annotations['leftEyeIris'][2][1]) / 2;\n ctx.ellipse(f.annotations['leftEyeIris'][0][0], f.annotations['leftEyeIris'][0][1], sizeX, sizeY, 0, 0, 2 * Math.PI);\n ctx.stroke();\n if (localOptions.fillPolygons) {\n ctx.fillStyle = localOptions.useDepth ? 'rgba(255, 255, 200, 0.3)' : localOptions.color;\n ctx.fill();\n }\n }\n if (f.annotations && f.annotations['rightEyeIris']) {\n ctx.strokeStyle = localOptions.useDepth ? 'rgba(255, 200, 255, 0.3)' : localOptions.color;\n ctx.beginPath();\n const sizeX = Math.abs(f.annotations['rightEyeIris'][3][0] - f.annotations['rightEyeIris'][1][0]) / 2;\n const sizeY = Math.abs(f.annotations['rightEyeIris'][4][1] - f.annotations['rightEyeIris'][2][1]) / 2;\n ctx.ellipse(f.annotations['rightEyeIris'][0][0], f.annotations['rightEyeIris'][0][1], sizeX, sizeY, 0, 0, 2 * Math.PI);\n ctx.stroke();\n if (localOptions.fillPolygons) {\n ctx.fillStyle = localOptions.useDepth ? 'rgba(255, 255, 200, 0.3)' : localOptions.color;\n ctx.fill();\n }\n }\n if (localOptions.drawGaze && f.rotation?.gaze?.strength && f.rotation?.gaze?.bearing && f.annotations['leftEyeIris'] && f.annotations['rightEyeIris'] && f.annotations['leftEyeIris'][0] && f.annotations['rightEyeIris'][0]) {\n ctx.strokeStyle = 'pink';\n ctx.beginPath();\n\n const leftGaze = [\n f.annotations['leftEyeIris'][0][0] + (Math.sin(f.rotation.gaze.bearing) * f.rotation.gaze.strength * f.box[3]),\n f.annotations['leftEyeIris'][0][1] + (Math.cos(f.rotation.gaze.bearing) * f.rotation.gaze.strength * f.box[2]),\n ];\n ctx.moveTo(f.annotations['leftEyeIris'][0][0], f.annotations['leftEyeIris'][0][1]);\n ctx.lineTo(leftGaze[0], leftGaze[1]);\n\n const rightGaze = [\n f.annotations['rightEyeIris'][0][0] + (Math.sin(f.rotation.gaze.bearing) * f.rotation.gaze.strength * f.box[3]),\n f.annotations['rightEyeIris'][0][1] + (Math.cos(f.rotation.gaze.bearing) * f.rotation.gaze.strength * f.box[2]),\n ];\n ctx.moveTo(f.annotations['rightEyeIris'][0][0], f.annotations['rightEyeIris'][0][1]);\n ctx.lineTo(rightGaze[0], rightGaze[1]);\n\n ctx.stroke();\n }\n }\n }\n }\n}\n\nexport async function body(inCanvas: HTMLCanvasElement, result: Array, drawOptions?: DrawOptions) {\n const localOptions = mergeDeep(options, drawOptions);\n if (!result || !inCanvas) return;\n if (!(inCanvas instanceof HTMLCanvasElement)) return;\n const ctx = inCanvas.getContext('2d');\n if (!ctx) return;\n ctx.lineJoin = 'round';\n for (let i = 0; i < result.length; i++) {\n ctx.strokeStyle = localOptions.color;\n ctx.fillStyle = localOptions.color;\n ctx.lineWidth = localOptions.lineWidth;\n ctx.font = localOptions.font;\n if (localOptions.drawBoxes && result[i].box && result[i].box?.length === 4) {\n // @ts-ignore box may not exist\n rect(ctx, result[i].box[0], result[i].box[1], result[i].box[2], result[i].box[3], localOptions);\n if (localOptions.drawLabels) {\n if (localOptions.shadowColor && localOptions.shadowColor !== '') {\n ctx.fillStyle = localOptions.shadowColor;\n // @ts-ignore box may not exist\n ctx.fillText(`body ${100 * result[i].score}%`, result[i].box[0] + 3, 1 + result[i].box[1] + localOptions.lineHeight, result[i].box[2]);\n }\n ctx.fillStyle = localOptions.labelColor;\n // @ts-ignore box may not exist\n ctx.fillText(`body ${100 * result[i].score}%`, result[i].box[0] + 2, 0 + result[i].box[1] + localOptions.lineHeight, result[i].box[2]);\n }\n }\n if (localOptions.drawPoints) {\n for (let pt = 0; pt < result[i].keypoints.length; pt++) {\n ctx.fillStyle = localOptions.useDepth && result[i].keypoints[pt].position[2] ? `rgba(${127.5 + (2 * (result[i].keypoints[pt].position[2] || 0))}, ${127.5 - (2 * (result[i].keypoints[pt].position[2] || 0))}, 255, 0.5)` : localOptions.color;\n point(ctx, result[i].keypoints[pt].position[0], result[i].keypoints[pt].position[1], 0, localOptions);\n }\n }\n if (localOptions.drawLabels) {\n ctx.font = localOptions.font;\n if (result[i].keypoints) {\n for (const pt of result[i].keypoints) {\n ctx.fillStyle = localOptions.useDepth && pt.position[2] ? `rgba(${127.5 + (2 * pt.position[2])}, ${127.5 - (2 * pt.position[2])}, 255, 0.5)` : localOptions.color;\n ctx.fillText(`${pt.part} ${Math.trunc(100 * pt.score)}%`, pt.position[0] + 4, pt.position[1] + 4);\n }\n }\n }\n if (localOptions.drawPolygons && result[i].keypoints) {\n let part;\n const points: [number, number, number?][] = [];\n // shoulder line\n points.length = 0;\n part = result[i].keypoints.find((a) => a.part === 'leftShoulder');\n if (part) points.push([part.position[0], part.position[1]]);\n part = result[i].keypoints.find((a) => a.part === 'rightShoulder');\n if (part) points.push([part.position[0], part.position[1]]);\n curves(ctx, points, localOptions);\n // torso main\n points.length = 0;\n part = result[i].keypoints.find((a) => a.part === 'rightShoulder');\n if (part) points.push([part.position[0], part.position[1]]);\n part = result[i].keypoints.find((a) => a.part === 'rightHip');\n if (part) points.push([part.position[0], part.position[1]]);\n part = result[i].keypoints.find((a) => a.part === 'leftHip');\n if (part) points.push([part.position[0], part.position[1]]);\n part = result[i].keypoints.find((a) => a.part === 'leftShoulder');\n if (part) points.push([part.position[0], part.position[1]]);\n if (points.length === 4) lines(ctx, points, localOptions); // only draw if we have complete torso\n // leg left\n points.length = 0;\n part = result[i].keypoints.find((a) => a.part === 'leftHip');\n if (part) points.push([part.position[0], part.position[1]]);\n part = result[i].keypoints.find((a) => a.part === 'leftKnee');\n if (part) points.push([part.position[0], part.position[1]]);\n part = result[i].keypoints.find((a) => a.part === 'leftAnkle');\n if (part) points.push([part.position[0], part.position[1]]);\n part = result[i].keypoints.find((a) => a.part === 'leftHeel');\n if (part) points.push([part.position[0], part.position[1]]);\n part = result[i].keypoints.find((a) => a.part === 'leftFoot');\n if (part) points.push([part.position[0], part.position[1]]);\n curves(ctx, points, localOptions);\n // leg right\n points.length = 0;\n part = result[i].keypoints.find((a) => a.part === 'rightHip');\n if (part) points.push([part.position[0], part.position[1]]);\n part = result[i].keypoints.find((a) => a.part === 'rightKnee');\n if (part) points.push([part.position[0], part.position[1]]);\n part = result[i].keypoints.find((a) => a.part === 'rightAnkle');\n if (part) points.push([part.position[0], part.position[1]]);\n part = result[i].keypoints.find((a) => a.part === 'rightHeel');\n if (part) points.push([part.position[0], part.position[1]]);\n part = result[i].keypoints.find((a) => a.part === 'rightFoot');\n if (part) points.push([part.position[0], part.position[1]]);\n curves(ctx, points, localOptions);\n // arm left\n points.length = 0;\n part = result[i].keypoints.find((a) => a.part === 'leftShoulder');\n if (part) points.push([part.position[0], part.position[1]]);\n part = result[i].keypoints.find((a) => a.part === 'leftElbow');\n if (part) points.push([part.position[0], part.position[1]]);\n part = result[i].keypoints.find((a) => a.part === 'leftWrist');\n if (part) points.push([part.position[0], part.position[1]]);\n part = result[i].keypoints.find((a) => a.part === 'leftPalm');\n if (part) points.push([part.position[0], part.position[1]]);\n curves(ctx, points, localOptions);\n // arm right\n points.length = 0;\n part = result[i].keypoints.find((a) => a.part === 'rightShoulder');\n if (part) points.push([part.position[0], part.position[1]]);\n part = result[i].keypoints.find((a) => a.part === 'rightElbow');\n if (part) points.push([part.position[0], part.position[1]]);\n part = result[i].keypoints.find((a) => a.part === 'rightWrist');\n if (part) points.push([part.position[0], part.position[1]]);\n part = result[i].keypoints.find((a) => a.part === 'rightPalm');\n if (part) points.push([part.position[0], part.position[1]]);\n curves(ctx, points, localOptions);\n // draw all\n }\n }\n}\n\nexport async function hand(inCanvas: HTMLCanvasElement, result: Array, drawOptions?: DrawOptions) {\n const localOptions = mergeDeep(options, drawOptions);\n if (!result || !inCanvas) return;\n if (!(inCanvas instanceof HTMLCanvasElement)) return;\n const ctx = inCanvas.getContext('2d');\n if (!ctx) return;\n ctx.lineJoin = 'round';\n ctx.font = localOptions.font;\n for (const h of result) {\n if (localOptions.drawBoxes) {\n ctx.strokeStyle = localOptions.color;\n ctx.fillStyle = localOptions.color;\n rect(ctx, h.box[0], h.box[1], h.box[2], h.box[3], localOptions);\n if (localOptions.drawLabels) {\n if (localOptions.shadowColor && localOptions.shadowColor !== '') {\n ctx.fillStyle = localOptions.shadowColor;\n ctx.fillText('hand', h.box[0] + 3, 1 + h.box[1] + localOptions.lineHeight, h.box[2]);\n }\n ctx.fillStyle = localOptions.labelColor;\n ctx.fillText('hand', h.box[0] + 2, 0 + h.box[1] + localOptions.lineHeight, h.box[2]);\n }\n ctx.stroke();\n }\n if (localOptions.drawPoints) {\n if (h.keypoints && h.keypoints.length > 0) {\n for (const pt of h.keypoints) {\n ctx.fillStyle = localOptions.useDepth ? `rgba(${127.5 + (2 * pt[2])}, ${127.5 - (2 * pt[2])}, 255, 0.5)` : localOptions.color;\n point(ctx, pt[0], pt[1], 0, localOptions);\n }\n }\n }\n if (localOptions.drawLabels) {\n const addHandLabel = (part, title) => {\n ctx.fillStyle = localOptions.useDepth ? `rgba(${127.5 + (2 * part[part.length - 1][2])}, ${127.5 - (2 * part[part.length - 1][2])}, 255, 0.5)` : localOptions.color;\n ctx.fillText(title, part[part.length - 1][0] + 4, part[part.length - 1][1] + 4);\n };\n ctx.font = localOptions.font;\n addHandLabel(h.annotations['indexFinger'], 'index');\n addHandLabel(h.annotations['middleFinger'], 'middle');\n addHandLabel(h.annotations['ringFinger'], 'ring');\n addHandLabel(h.annotations['pinky'], 'pinky');\n addHandLabel(h.annotations['thumb'], 'thumb');\n addHandLabel(h.annotations['palmBase'], 'palm');\n }\n if (localOptions.drawPolygons) {\n const addHandLine = (part) => {\n if (!part) return;\n for (let i = 0; i < part.length; i++) {\n ctx.beginPath();\n ctx.strokeStyle = localOptions.useDepth ? `rgba(${127.5 + (2 * part[i][2])}, ${127.5 - (2 * part[i][2])}, 255, 0.5)` : localOptions.color;\n ctx.moveTo(part[i > 0 ? i - 1 : 0][0], part[i > 0 ? i - 1 : 0][1]);\n ctx.lineTo(part[i][0], part[i][1]);\n ctx.stroke();\n }\n };\n ctx.lineWidth = localOptions.lineWidth;\n addHandLine(h.annotations['indexFinger']);\n addHandLine(h.annotations['middleFinger']);\n addHandLine(h.annotations['ringFinger']);\n addHandLine(h.annotations['pinky']);\n addHandLine(h.annotations['thumb']);\n // addPart(h.annotations.palmBase);\n }\n }\n}\n\nexport async function object(inCanvas: HTMLCanvasElement, result: Array, drawOptions?: DrawOptions) {\n const localOptions = mergeDeep(options, drawOptions);\n if (!result || !inCanvas) return;\n if (!(inCanvas instanceof HTMLCanvasElement)) return;\n const ctx = inCanvas.getContext('2d');\n if (!ctx) return;\n ctx.lineJoin = 'round';\n ctx.font = localOptions.font;\n for (const h of result) {\n if (localOptions.drawBoxes) {\n ctx.strokeStyle = localOptions.color;\n ctx.fillStyle = localOptions.color;\n rect(ctx, h.box[0], h.box[1], h.box[2], h.box[3], localOptions);\n if (localOptions.drawLabels) {\n const label = `${Math.round(100 * h.score)}% ${h.label}`;\n if (localOptions.shadowColor && localOptions.shadowColor !== '') {\n ctx.fillStyle = localOptions.shadowColor;\n ctx.fillText(label, h.box[0] + 3, 1 + h.box[1] + localOptions.lineHeight, h.box[2]);\n }\n ctx.fillStyle = localOptions.labelColor;\n ctx.fillText(label, h.box[0] + 2, 0 + h.box[1] + localOptions.lineHeight, h.box[2]);\n }\n ctx.stroke();\n }\n }\n}\n\nexport async function person(inCanvas: HTMLCanvasElement, result: Array, drawOptions?: DrawOptions) {\n const localOptions = mergeDeep(options, drawOptions);\n if (!result || !inCanvas) return;\n if (!(inCanvas instanceof HTMLCanvasElement)) return;\n const ctx = inCanvas.getContext('2d');\n if (!ctx) return;\n ctx.lineJoin = 'round';\n ctx.font = localOptions.font;\n\n for (let i = 0; i < result.length; i++) {\n if (localOptions.drawBoxes) {\n ctx.strokeStyle = localOptions.color;\n ctx.fillStyle = localOptions.color;\n rect(ctx, result[i].box[0], result[i].box[1], result[i].box[2], result[i].box[3], localOptions);\n if (localOptions.drawLabels) {\n const label = `person #${i}`;\n if (localOptions.shadowColor && localOptions.shadowColor !== '') {\n ctx.fillStyle = localOptions.shadowColor;\n ctx.fillText(label, result[i].box[0] + 3, 1 + result[i].box[1] + localOptions.lineHeight, result[i].box[2]);\n }\n ctx.fillStyle = localOptions.labelColor;\n ctx.fillText(label, result[i].box[0] + 2, 0 + result[i].box[1] + localOptions.lineHeight, result[i].box[2]);\n }\n ctx.stroke();\n }\n }\n}\n\nexport async function canvas(inCanvas: HTMLCanvasElement, outCanvas: HTMLCanvasElement) {\n if (!inCanvas || !outCanvas) return;\n if (!(inCanvas instanceof HTMLCanvasElement) || !(outCanvas instanceof HTMLCanvasElement)) return;\n const outCtx = inCanvas.getContext('2d');\n outCtx?.drawImage(inCanvas, 0, 0);\n}\n\nexport async function all(inCanvas: HTMLCanvasElement, result: Result, drawOptions?: DrawOptions) {\n const timestamp = now();\n const localOptions = mergeDeep(options, drawOptions);\n if (!result || !inCanvas) return;\n if (!(inCanvas instanceof HTMLCanvasElement)) return;\n\n face(inCanvas, result.face, localOptions);\n body(inCanvas, result.body, localOptions);\n hand(inCanvas, result.hand, localOptions);\n object(inCanvas, result.object, localOptions);\n // person(inCanvas, result.persons, localOptions);\n gesture(inCanvas, result.gesture, localOptions); // gestures do not have buffering\n\n /*\n if (!bufferedResult) bufferedResult = result; // first pass\n else if (localOptions.bufferedOutput) calcBuffered(result); // do results interpolation\n else bufferedResult = result; // or just use results as-is\n const promises: Promise[] = [];\n promises.push(face(inCanvas, bufferedResult.face, localOptions));\n promises.push(body(inCanvas, bufferedResult.body, localOptions));\n promises.push(hand(inCanvas, bufferedResult.hand, localOptions));\n promises.push(object(inCanvas, bufferedResult.object, localOptions));\n // promises.push(person(inCanvas, bufferedResult.persons, localOptions));\n promises.push(gesture(inCanvas, result.gesture, localOptions)); // gestures do not have buffering\n // await Promise.all(promises);\n */\n result.performance.draw = Math.trunc(now() - timestamp);\n}\n", "/**\n * Module that analyzes existing results and recombines them into a unified person object\n */\n\nimport { Face, Body, Hand, Gesture, Person } from './result';\n\nexport function join(faces: Array, bodies: Array, hands: Array, gestures: Array, shape: Array | undefined): Array {\n let id = 0;\n const persons: Array = [];\n for (const face of faces) { // person is defined primarily by face and then we append other objects as found\n const person: Person = { id: id++, face, body: null, hands: { left: null, right: null }, gestures: [], box: [0, 0, 0, 0] };\n for (const body of bodies) {\n if (face.box[0] > body.box[0] // x within body\n && face.box[0] < body.box[0] + body.box[2]\n && face.box[1] + face.box[3] > body.box[1] // y within body\n && face.box[1] + face.box[3] < body.box[1] + body.box[3]) {\n person.body = body;\n }\n }\n if (person.body) { // only try to join hands if body is found\n for (const hand of hands) {\n if (hand.box[0] + hand.box[2] > person.body.box[0] // x within body for left hand\n && hand.box[0] + hand.box[2] < person.body.box[0] + person.body.box[2]\n && hand.box[1] + hand.box[3] > person.body.box[1] // x within body for left hand\n && hand.box[1] + hand.box[3] < person.body.box[1] + person.body.box[3]) {\n if (person.hands) person.hands.left = hand;\n }\n if (hand.box[0] < person.body.box[0] + person.body.box[2] // x within body for right hand\n && hand.box[0] > person.body.box[0]\n && hand.box[1] + hand.box[3] > person.body.box[1] // x within body for right hand\n && hand.box[1] + hand.box[3] < person.body.box[1] + person.body.box[3]) {\n if (person.hands) person.hands.right = hand;\n }\n }\n }\n for (const gesture of gestures) { // append all gestures according to ids\n if (gesture['face'] !== undefined && gesture['face'] === face.id) person.gestures?.push(gesture);\n else if (gesture['iris'] !== undefined && gesture['iris'] === face.id) person.gestures?.push(gesture);\n else if (gesture['body'] !== undefined && gesture['body'] === person.body?.id) person.gestures?.push(gesture);\n else if (gesture['hand'] !== undefined && gesture['hand'] === person.hands?.left?.id) person.gestures?.push(gesture);\n else if (gesture['hand'] !== undefined && gesture['hand'] === person.hands?.right?.id) person.gestures?.push(gesture);\n }\n\n // create new overarching box from all boxes beloning to person\n const x: number[] = [];\n const y: number[] = [];\n const extractXY = (box) => { // extract all [x, y] coordinates from boxes [x, y, width, height]\n if (box && box.length === 4) {\n x.push(box[0], box[0] + box[2]);\n y.push(box[1], box[1] + box[3]);\n }\n };\n extractXY(person.face?.box);\n extractXY(person.body?.box);\n extractXY(person.hands?.left?.box);\n extractXY(person.hands?.right?.box);\n const minX = Math.min(...x);\n const minY = Math.min(...y);\n person.box = [minX, minY, Math.max(...x) - minX, Math.max(...y) - minY]; // create new overarching box\n\n // shape is known so we calculate boxRaw as well\n if (shape && shape.length === 4) person.boxRaw = [person.box[0] / shape[2], person.box[1] / shape[1], person.box[2] / shape[2], person.box[3] / shape[1]];\n\n persons.push(person);\n }\n return persons;\n}\n", "/**\n * Module that interpolates results for smoother animations\n */\n\nimport type { Result, Face, Body, Hand, Item, Gesture, Person } from './result';\n\nconst bufferedResult: Result = { face: [], body: [], hand: [], gesture: [], object: [], persons: [], performance: {}, timestamp: 0 };\n\nexport function calc(newResult: Result): Result {\n // each record is only updated using deep clone when number of detected record changes, otherwise it will converge by itself\n // otherwise bufferedResult is a shallow clone of result plus updated local calculated values\n // thus mixing by-reference and by-value assignments to minimize memory operations\n\n const elapsed = Date.now() - newResult.timestamp;\n // curve fitted: buffer = 8 - ln(delay)\n // interpolation formula: current = ((buffer - 1) * previous + live) / buffer\n // - at 50ms delay buffer = ~4.1 => 28% towards live data\n // - at 250ms delay buffer = ~2.5 => 40% towards live data\n // - at 500ms delay buffer = ~1.8 => 55% towards live data\n // - at 750ms delay buffer = ~1.4 => 71% towards live data\n // - at 1sec delay buffer = 1 which means live data is used\n const bufferedFactor = elapsed < 1000 ? 8 - Math.log(elapsed) : 1;\n\n bufferedResult.canvas = newResult.canvas;\n\n // interpolate body results\n if (!bufferedResult.body || (newResult.body.length !== bufferedResult.body.length)) {\n bufferedResult.body = JSON.parse(JSON.stringify(newResult.body as Body[])); // deep clone once\n } else {\n for (let i = 0; i < newResult.body.length; i++) {\n const box = newResult.body[i].box // update box\n .map((b, j) => ((bufferedFactor - 1) * bufferedResult.body[i].box[j] + b) / bufferedFactor) as [number, number, number, number];\n const boxRaw = newResult.body[i].boxRaw // update boxRaw\n .map((b, j) => ((bufferedFactor - 1) * bufferedResult.body[i].boxRaw[j] + b) / bufferedFactor) as [number, number, number, number];\n const keypoints = (newResult.body[i].keypoints // update keypoints\n .map((keypoint, j) => ({\n score: keypoint.score,\n part: keypoint.part,\n position: [\n bufferedResult.body[i].keypoints[j] ? ((bufferedFactor - 1) * bufferedResult.body[i].keypoints[j].position[0] + keypoint.position[0]) / bufferedFactor : keypoint.position[0],\n bufferedResult.body[i].keypoints[j] ? ((bufferedFactor - 1) * bufferedResult.body[i].keypoints[j].position[1] + keypoint.position[1]) / bufferedFactor : keypoint.position[1],\n ],\n positionRaw: [\n bufferedResult.body[i].keypoints[j] ? ((bufferedFactor - 1) * bufferedResult.body[i].keypoints[j].positionRaw[0] + keypoint.positionRaw[0]) / bufferedFactor : keypoint.position[0],\n bufferedResult.body[i].keypoints[j] ? ((bufferedFactor - 1) * bufferedResult.body[i].keypoints[j].positionRaw[1] + keypoint.positionRaw[1]) / bufferedFactor : keypoint.position[1],\n ],\n }))) as Array<{ score: number, part: string, position: [number, number, number?], positionRaw: [number, number, number?] }>;\n bufferedResult.body[i] = { ...newResult.body[i], box, boxRaw, keypoints }; // shallow clone plus updated values\n }\n }\n\n // interpolate hand results\n if (!bufferedResult.hand || (newResult.hand.length !== bufferedResult.hand.length)) {\n bufferedResult.hand = JSON.parse(JSON.stringify(newResult.hand as Hand[])); // deep clone once\n } else {\n for (let i = 0; i < newResult.hand.length; i++) {\n const box = (newResult.hand[i].box// update box\n .map((b, j) => ((bufferedFactor - 1) * bufferedResult.hand[i].box[j] + b) / bufferedFactor)) as [number, number, number, number];\n const boxRaw = (newResult.hand[i].boxRaw // update boxRaw\n .map((b, j) => ((bufferedFactor - 1) * bufferedResult.hand[i].boxRaw[j] + b) / bufferedFactor)) as [number, number, number, number];\n const keypoints = newResult.hand[i].keypoints // update landmarks\n .map((landmark, j) => landmark\n .map((coord, k) => (((bufferedFactor - 1) * bufferedResult.hand[i].keypoints[j][k] + coord) / bufferedFactor)) as [number, number, number]);\n const keys = Object.keys(newResult.hand[i].annotations); // update annotations\n const annotations = {};\n for (const key of keys) {\n annotations[key] = newResult.hand[i].annotations[key]\n .map((val, j) => val.map((coord, k) => ((bufferedFactor - 1) * bufferedResult.hand[i].annotations[key][j][k] + coord) / bufferedFactor));\n }\n bufferedResult.hand[i] = { ...newResult.hand[i], box, boxRaw, keypoints, annotations }; // shallow clone plus updated values\n }\n }\n\n // interpolate face results\n if (!bufferedResult.face || (newResult.face.length !== bufferedResult.face.length)) {\n bufferedResult.face = JSON.parse(JSON.stringify(newResult.face as Face[])); // deep clone once\n } else {\n for (let i = 0; i < newResult.face.length; i++) {\n const box = (newResult.face[i].box // update box\n .map((b, j) => ((bufferedFactor - 1) * bufferedResult.face[i].box[j] + b) / bufferedFactor)) as [number, number, number, number];\n const boxRaw = (newResult.face[i].boxRaw // update boxRaw\n .map((b, j) => ((bufferedFactor - 1) * bufferedResult.face[i].boxRaw[j] + b) / bufferedFactor)) as [number, number, number, number];\n const rotation: {\n matrix: [number, number, number, number, number, number, number, number, number],\n angle: { roll: number, yaw: number, pitch: number },\n gaze: { bearing: number, strength: number }\n } = { matrix: [0, 0, 0, 0, 0, 0, 0, 0, 0], angle: { roll: 0, yaw: 0, pitch: 0 }, gaze: { bearing: 0, strength: 0 } };\n rotation.matrix = newResult.face[i].rotation?.matrix as [number, number, number, number, number, number, number, number, number];\n rotation.angle = {\n roll: ((bufferedFactor - 1) * (bufferedResult.face[i].rotation?.angle?.roll || 0) + (newResult.face[i].rotation?.angle?.roll || 0)) / bufferedFactor,\n yaw: ((bufferedFactor - 1) * (bufferedResult.face[i].rotation?.angle?.yaw || 0) + (newResult.face[i].rotation?.angle?.yaw || 0)) / bufferedFactor,\n pitch: ((bufferedFactor - 1) * (bufferedResult.face[i].rotation?.angle?.pitch || 0) + (newResult.face[i].rotation?.angle?.pitch || 0)) / bufferedFactor,\n };\n rotation.gaze = {\n // not fully correct due projection on circle, also causes wrap-around draw on jump from negative to positive\n bearing: ((bufferedFactor - 1) * (bufferedResult.face[i].rotation?.gaze?.bearing || 0) + (newResult.face[i].rotation?.gaze?.bearing || 0)) / bufferedFactor,\n strength: ((bufferedFactor - 1) * (bufferedResult.face[i].rotation?.gaze?.strength || 0) + (newResult.face[i].rotation?.gaze?.strength || 0)) / bufferedFactor,\n };\n bufferedResult.face[i] = { ...newResult.face[i], rotation, box, boxRaw }; // shallow clone plus updated values\n }\n }\n\n // interpolate object detection results\n if (!bufferedResult.object || (newResult.object.length !== bufferedResult.object.length)) {\n bufferedResult.object = JSON.parse(JSON.stringify(newResult.object as Item[])); // deep clone once\n } else {\n for (let i = 0; i < newResult.object.length; i++) {\n const box = (newResult.object[i].box // update box\n .map((b, j) => ((bufferedFactor - 1) * bufferedResult.object[i].box[j] + b) / bufferedFactor)) as [number, number, number, number];\n const boxRaw = (newResult.object[i].boxRaw // update boxRaw\n .map((b, j) => ((bufferedFactor - 1) * bufferedResult.object[i].boxRaw[j] + b) / bufferedFactor)) as [number, number, number, number];\n bufferedResult.object[i] = { ...newResult.object[i], box, boxRaw }; // shallow clone plus updated values\n }\n }\n\n // interpolate person results\n const newPersons = newResult.persons; // trigger getter function\n if (!bufferedResult.persons || (newPersons.length !== bufferedResult.persons.length)) {\n bufferedResult.persons = JSON.parse(JSON.stringify(newPersons as Person[]));\n } else {\n for (let i = 0; i < newPersons.length; i++) { // update person box, we don't update the rest as it's updated as reference anyhow\n bufferedResult.persons[i].box = (newPersons[i].box\n .map((box, j) => ((bufferedFactor - 1) * bufferedResult.persons[i].box[j] + box) / bufferedFactor)) as [number, number, number, number];\n }\n }\n\n // just copy latest gestures without interpolation\n bufferedResult.gesture = newResult.gesture as Gesture[];\n bufferedResult.performance = newResult.performance;\n\n return bufferedResult;\n}\n", "/**\n * EfficientPose Module\n */\n\nimport { log, join } from '../helpers';\nimport * as tf from '../../dist/tfjs.esm.js';\nimport * as image from '../image/image';\nimport { GraphModel, Tensor } from '../tfjs/types';\nimport { Config } from '../config';\n\ntype Input = Tensor | typeof Image | ImageData | ImageBitmap | HTMLImageElement | HTMLMediaElement | HTMLVideoElement | HTMLCanvasElement | OffscreenCanvas;\n\nlet model: GraphModel;\nlet busy = false;\n\nexport async function load(config: Config): Promise {\n if (!model) {\n // @ts-ignore type mismatch on GraphModel\n model = await tf.loadGraphModel(join(config.modelBasePath, config.segmentation.modelPath));\n if (!model || !model['modelUrl']) log('load model failed:', config.segmentation.modelPath);\n else if (config.debug) log('load model:', model['modelUrl']);\n } else if (config.debug) log('cached model:', model['modelUrl']);\n return model;\n}\n\nexport async function predict(input: { tensor: Tensor | null, canvas: OffscreenCanvas | HTMLCanvasElement }): Promise {\n const width = input.tensor?.shape[1] || 0;\n const height = input.tensor?.shape[2] || 0;\n if (!input.tensor) return null;\n if (!model || !model.inputs[0].shape) return null;\n const resizeInput = tf.image.resizeBilinear(input.tensor, [model.inputs[0].shape[1], model.inputs[0].shape[2]], false);\n const norm = resizeInput.div(255);\n const res = model.predict(norm) as Tensor;\n // meet output: 1,256,256,1\n // selfie output: 1,144,256,2\n tf.dispose(resizeInput);\n tf.dispose(norm);\n\n const squeeze = tf.squeeze(res, 0);\n let resizeOutput;\n if (squeeze.shape[2] === 2) {\n // model meet has two channels for fg and bg\n const softmax = squeeze.softmax();\n const [bg, fg] = tf.unstack(softmax, 2);\n const expand = fg.expandDims(2);\n const pad = expand.expandDims(0);\n tf.dispose(softmax);\n tf.dispose(bg);\n tf.dispose(fg);\n // running sofmax before unstack creates 2x2 matrix so we only take upper-left quadrant\n const crop = tf.image.cropAndResize(pad, [[0, 0, 0.5, 0.5]], [0], [width, height]);\n // otherwise run softmax after unstack and use standard resize\n // resizeOutput = tf.image.resizeBilinear(expand, [input.tensor?.shape[1], input.tensor?.shape[2]]);\n resizeOutput = crop.squeeze(0);\n tf.dispose(crop);\n tf.dispose(expand);\n tf.dispose(pad);\n } else { // model selfie has a single channel that we can use directly\n resizeOutput = tf.image.resizeBilinear(squeeze, [width, height]);\n }\n\n if (typeof document === 'undefined') return resizeOutput.dataSync(); // we're running in nodejs so return alpha array as-is\n\n const overlay = (typeof OffscreenCanvas !== 'undefined') ? new OffscreenCanvas(width, height) : document.createElement('canvas');\n overlay.width = width;\n overlay.height = height;\n if (tf.browser) await tf.browser.toPixels(resizeOutput, overlay);\n tf.dispose(resizeOutput);\n tf.dispose(squeeze);\n tf.dispose(res);\n\n // get alpha channel data\n const alphaCanvas = (typeof OffscreenCanvas !== 'undefined') ? new OffscreenCanvas(width, height) : document.createElement('canvas'); // need one more copy since input may already have gl context so 2d context fails\n alphaCanvas.width = width;\n alphaCanvas.height = height;\n const ctxAlpha = alphaCanvas.getContext('2d') as CanvasRenderingContext2D;\n ctxAlpha.filter = 'blur(8px';\n await ctxAlpha.drawImage(overlay, 0, 0);\n const alpha = ctxAlpha.getImageData(0, 0, width, height).data;\n\n // get original canvas merged with overlay\n const original = (typeof OffscreenCanvas !== 'undefined') ? new OffscreenCanvas(width, height) : document.createElement('canvas'); // need one more copy since input may already have gl context so 2d context fails\n original.width = width;\n original.height = height;\n const ctx = original.getContext('2d') as CanvasRenderingContext2D;\n if (input.canvas) await ctx.drawImage(input.canvas, 0, 0);\n // https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/globalCompositeOperation // best options are: darken, color-burn, multiply\n ctx.globalCompositeOperation = 'darken';\n ctx.filter = 'blur(8px)'; // use css filter for bluring, can be done with gaussian blur manually instead\n await ctx.drawImage(overlay, 0, 0);\n ctx.globalCompositeOperation = 'source-over'; // reset\n ctx.filter = 'none'; // reset\n\n input.canvas = original;\n\n return alpha;\n}\n\nexport async function process(input: Input, background: Input | undefined, config: Config): Promise {\n if (busy) return null;\n busy = true;\n if (!model) await load(config);\n const img = image.process(input, config);\n const alpha = await predict(img);\n tf.dispose(img.tensor);\n\n if (background && alpha) {\n const tmp = image.process(background, config);\n const bg = tmp.canvas;\n tf.dispose(tmp.tensor);\n const fg = img.canvas;\n const fgData = fg.getContext('2d')?.getImageData(0, 0, fg.width, fg.height).data as Uint8ClampedArray;\n\n const c = (typeof OffscreenCanvas !== 'undefined') ? new OffscreenCanvas(fg.width, fg.height) : document.createElement('canvas');\n c.width = fg.width;\n c.height = fg.height;\n const ctx = c.getContext('2d') as CanvasRenderingContext2D;\n\n ctx.globalCompositeOperation = 'copy'; // reset\n ctx.drawImage(bg, 0, 0, c.width, c.height);\n const cData = ctx.getImageData(0, 0, c.width, c.height) as ImageData;\n for (let i = 0; i < c.width * c.height; i++) { // this should be done with globalCompositeOperation instead of looping through image data\n cData.data[4 * i + 0] = ((255 - alpha[4 * i + 0]) / 255.0 * cData.data[4 * i + 0]) + (alpha[4 * i + 0] / 255.0 * fgData[4 * i + 0]);\n cData.data[4 * i + 1] = ((255 - alpha[4 * i + 1]) / 255.0 * cData.data[4 * i + 1]) + (alpha[4 * i + 1] / 255.0 * fgData[4 * i + 1]);\n cData.data[4 * i + 2] = ((255 - alpha[4 * i + 2]) / 255.0 * cData.data[4 * i + 2]) + (alpha[4 * i + 2] / 255.0 * fgData[4 * i + 2]);\n cData.data[4 * i + 3] = ((255 - alpha[4 * i + 3]) / 255.0 * cData.data[4 * i + 3]) + (alpha[4 * i + 3] / 255.0 * fgData[4 * i + 3]);\n }\n ctx.putImageData(cData, 0, 0);\n img.canvas = c;\n }\n busy = false;\n return img.canvas;\n}\n", "/**\n * Embedded sample images used during warmup in dataURL format\n */\n\n// data:image/jpeg;base64,\nexport const face = `\n/9j/4AAQSkZJRgABAQEAYABgAAD/4QBoRXhpZgAATU0AKgAAAAgABAEaAAUAAAABAAAAPgEbAAUA\nAAABAAAARgEoAAMAAAABAAIAAAExAAIAAAARAAAATgAAAAAAAABgAAAAAQAAAGAAAAABcGFpbnQu\nbmV0IDQuMi4xMwAA/9sAQwAGBAUGBQQGBgUGBwcGCAoQCgoJCQoUDg8MEBcUGBgXFBYWGh0lHxob\nIxwWFiAsICMmJykqKRkfLTAtKDAlKCko/9sAQwEHBwcKCAoTCgoTKBoWGigoKCgoKCgoKCgoKCgo\nKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgo/8AAEQgBAAEAAwEhAAIRAQMRAf/E\nAB8AAAEFAQEBAQEBAAAAAAAAAAABAgMEBQYHCAkKC//EALUQAAIBAwMCBAMFBQQEAAABfQECAwAE\nEQUSITFBBhNRYQcicRQygZGhCCNCscEVUtHwJDNicoIJChYXGBkaJSYnKCkqNDU2Nzg5OkNERUZH\nSElKU1RVVldYWVpjZGVmZ2hpanN0dXZ3eHl6g4SFhoeIiYqSk5SVlpeYmZqio6Slpqeoqaqys7S1\ntre4ubrCw8TFxsfIycrS09TV1tfY2drh4uPk5ebn6Onq8fLz9PX29/j5+v/EAB8BAAMBAQEBAQEB\nAQEAAAAAAAABAgMEBQYHCAkKC//EALURAAIBAgQEAwQHBQQEAAECdwABAgM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AlACEgMZjdjbFW8bWrEx8YWANb6Fp+bfwab+vLDKMFK9qxH5L0bAr8OPRPKz2AY7J2\nSbAjYZAI2E7AIEgIEgIEgMdkSy2NgY7MdlmyNoBXsxmFuyNgVTVjNV3KjlBRNTlXTVHKCrlIqt5T\nlBhEMohlFerLlBjEMohMVTEARDKCITsAk2AEgAAAkAAAAAAAAAAAAAAAAAAAAAAAASAAAAAAAAD/\n2Q==`;\n", "/**\n * Human main module\n */\n\nimport { log, now, mergeDeep } from './helpers';\nimport { Config, defaults } from './config';\nimport { Result, Gesture } from './result';\nimport * as sysinfo from './sysinfo';\nimport * as tf from '../dist/tfjs.esm.js';\nimport * as backend from './tfjs/backend';\nimport * as face from './face';\nimport * as facemesh from './blazeface/facemesh';\nimport * as faceres from './faceres/faceres';\nimport * as emotion from './emotion/emotion';\nimport * as posenet from './posenet/posenet';\nimport * as handpose from './handpose/handpose';\nimport * as blazepose from './blazepose/blazepose';\nimport * as efficientpose from './efficientpose/efficientpose';\nimport * as movenet from './movenet/movenet';\nimport * as nanodet from './object/nanodet';\nimport * as centernet from './object/centernet';\nimport * as gesture from './gesture/gesture';\nimport * as image from './image/image';\nimport * as draw from './draw/draw';\nimport * as persons from './persons';\nimport * as interpolate from './interpolate';\nimport * as segmentation from './segmentation/segmentation';\nimport * as sample from './sample';\nimport * as app from '../package.json';\nimport { Tensor } from './tfjs/types';\n\n// export types\nexport type { Config } from './config';\nexport type { Result, Face, Hand, Body, Item, Gesture, Person } from './result';\nexport type { DrawOptions } from './draw/draw';\n\n/** Defines all possible input types for **Human** detection\n * @typedef Input Type\n */\nexport type Input = Tensor | typeof Image | ImageData | ImageBitmap | HTMLImageElement | HTMLMediaElement | HTMLVideoElement | HTMLCanvasElement | OffscreenCanvas;\n\n/** Error message\n * @typedef Error Type\n */\nexport type Error = { error: string };\n\n/** Instance of TensorFlow/JS\n * @external\n */\nexport type TensorFlow = typeof tf;\n\n/** Generic Model object type\n * holds instance of individual models\n */\ntype Model = unknown;\n\n/**\n * **Human** library main class\n *\n * All methods and properties are available only as members of Human class\n *\n * - Configuration object definition: {@link Config}\n * - Results object definition: {@link Result}\n * - Possible inputs: {@link Input}\n *\n * @param userConfig: {@link Config}\n */\nexport class Human {\n /** Current version of Human library in *semver* format */\n version: string;\n /** Current configuration\n * - Details: {@link Config}\n */\n config: Config;\n /** Last known result of detect run\n * - Can be accessed anytime after initial detection\n */\n result: Result;\n /** Current state of Human library\n * - Can be polled to determine operations that are currently executed\n * - Progresses through: 'config', 'check', 'backend', 'load', 'run:', 'idle'\n */\n state: string;\n /** @internal: Instance of current image being processed */\n image: { tensor: Tensor | null, canvas: OffscreenCanvas | HTMLCanvasElement | null };\n /** @internal: Instance of TensorFlow/JS used by Human\n * - Can be embedded or externally provided\n */\n tf: TensorFlow;\n /** Draw helper classes that can draw detected objects on canvas using specified draw styles\n * - options: global settings for all draw operations, can be overriden for each draw method, for details see {@link DrawOptions}\n * - face: draw detected faces\n * - body: draw detected people and body parts\n * - hand: draw detected hands and hand parts\n * - canvas: draw processed canvas which is a processed copy of the input\n * - all: meta-function that performs: canvas, face, body, hand\n */\n draw: {\n options: draw.DrawOptions,\n gesture: typeof draw.gesture,\n face: typeof draw.face,\n body: typeof draw.body,\n hand: typeof draw.hand,\n canvas: typeof draw.canvas,\n all: typeof draw.all,\n };\n /** @internal: Currently loaded models */\n models: {\n face: [Model, Model, Model] | null,\n posenet: Model | null,\n blazepose: Model | null,\n efficientpose: Model | null,\n movenet: Model | null,\n handpose: [Model, Model] | null,\n age: Model | null,\n gender: Model | null,\n emotion: Model | null,\n embedding: Model | null,\n nanodet: Model | null,\n centernet: Model | null,\n faceres: Model | null,\n segmentation: Model | null,\n };\n /** Reference face triangualtion array of 468 points, used for triangle references between points */\n faceTriangulation: typeof facemesh.triangulation;\n /** Refernce UV map of 468 values, used for 3D mapping of the face mesh */\n faceUVMap: typeof facemesh.uvmap;\n /** Platform and agent information detected by Human */\n sysinfo: { platform: string, agent: string };\n /** Performance object that contains values for all recently performed operations */\n performance: Record; // perf members are dynamically defined as needed\n #numTensors: number;\n #analyzeMemoryLeaks: boolean;\n #checkSanity: boolean;\n #firstRun: boolean;\n #lastInputSum: number;\n #lastCacheDiff: number;\n\n // definition end\n\n /**\n * Creates instance of Human library that is futher used for all operations\n * @param userConfig: {@link Config}\n */\n constructor(userConfig?: Config | Record) {\n this.config = mergeDeep(defaults, userConfig || {});\n this.tf = tf;\n this.draw = draw;\n this.version = app.version;\n this.state = 'idle';\n this.#numTensors = 0;\n this.#analyzeMemoryLeaks = false;\n this.#checkSanity = false;\n this.#firstRun = true;\n this.#lastCacheDiff = 0;\n this.performance = { backend: 0, load: 0, image: 0, frames: 0, cached: 0, changed: 0, total: 0, draw: 0 };\n // object that contains all initialized models\n this.models = {\n face: null,\n posenet: null,\n blazepose: null,\n efficientpose: null,\n movenet: null,\n handpose: null,\n age: null,\n gender: null,\n emotion: null,\n embedding: null,\n nanodet: null,\n centernet: null,\n faceres: null,\n segmentation: null,\n };\n // export access to image processing\n // @ts-ignore eslint-typescript cannot correctly infer type in anonymous function\n this.image = (input: Input) => image.process(input, this.config);\n // export raw access to underlying models\n this.faceTriangulation = facemesh.triangulation;\n this.faceUVMap = facemesh.uvmap;\n // include platform info\n this.sysinfo = sysinfo.info();\n this.#lastInputSum = 1;\n }\n\n // helper function: measure tensor leak\n /** @hidden */\n analyze = (...msg) => {\n if (!this.#analyzeMemoryLeaks) return;\n const currentTensors = this.tf.engine().state.numTensors;\n const previousTensors = this.#numTensors;\n this.#numTensors = currentTensors;\n const leaked = currentTensors - previousTensors;\n if (leaked !== 0) log(...msg, leaked);\n }\n\n // quick sanity check on inputs\n /** @hidden */\n #sanity = (input): null | string => {\n if (!this.#checkSanity) return null;\n if (!input) return 'input is not defined';\n if (this.tf.ENV.flags.IS_NODE && !(input instanceof tf.Tensor)) return 'input must be a tensor';\n try {\n this.tf.getBackend();\n } catch {\n return 'backend not loaded';\n }\n return null;\n }\n\n /** Simmilarity method calculates simmilarity between two provided face descriptors (face embeddings)\n * - Calculation is based on normalized Minkowski distance between\n *\n * @param embedding1: face descriptor as array of numbers\n * @param embedding2: face descriptor as array of numbers\n * @returns similarity: number\n */\n // eslint-disable-next-line class-methods-use-this\n similarity(embedding1: Array, embedding2: Array): number {\n return faceres.similarity(embedding1, embedding2);\n }\n\n /**\n * Segmentation method takes any input and returns processed canvas with body segmentation\n * Optional parameter background is used to fill the background with specific input\n * Segmentation is not triggered as part of detect process\n *\n * @param input: {@link Input}\n * @param background?: {@link Input}\n * @returns Canvas\n */\n segmentation(input: Input, background?: Input) {\n return segmentation.process(input, background, this.config);\n }\n\n /** Enhance method performs additional enhacements to face image previously detected for futher processing\n * @param input: Tensor as provided in human.result.face[n].tensor\n * @returns Tensor\n */\n // eslint-disable-next-line class-methods-use-this\n enhance(input: Tensor): Tensor | null {\n // @ts-ignore type mismach for Tensor\n return faceres.enhance(input);\n }\n\n /** Math method find best match between provided face descriptor and predefined database of known descriptors\n * @param faceEmbedding: face descriptor previsouly calculated on any face\n * @param db: array of mapping of face descriptors to known values\n * @param threshold: minimum score for matching to be considered in the result\n * @returns best match\n */\n // eslint-disable-next-line class-methods-use-this\n match(faceEmbedding: Array, db: Array<{ name: string, source: string, embedding: number[] }>, threshold = 0): { name: string, source: string, similarity: number, embedding: number[] } {\n return faceres.match(faceEmbedding, db, threshold);\n }\n\n /** Load method preloads all configured models on-demand\n * - Not explicitly required as any required model is load implicitly on it's first run\n * @param userConfig?: {@link Config}\n */\n async load(userConfig?: Config | Record) {\n this.state = 'load';\n const timeStamp = now();\n if (userConfig) this.config = mergeDeep(this.config, userConfig) as Config;\n\n if (this.#firstRun) { // print version info on first run and check for correct backend setup\n if (this.config.debug) log(`version: ${this.version}`);\n if (this.config.debug) log(`tfjs version: ${this.tf.version_core}`);\n if (this.config.debug) log('platform:', this.sysinfo.platform);\n if (this.config.debug) log('agent:', this.sysinfo.agent);\n\n await this.#checkBackend(true);\n if (this.tf.ENV.flags.IS_BROWSER) {\n if (this.config.debug) log('configuration:', this.config);\n if (this.config.debug) log('tf flags:', this.tf.ENV.flags);\n }\n }\n if (this.config.async) { // load models concurrently\n [\n // @ts-ignore async model loading is not correctly inferred\n this.models.face,\n this.models.emotion,\n // @ts-ignore async model loading is not correctly inferred\n this.models.handpose,\n this.models.posenet,\n this.models.blazepose,\n this.models.efficientpose,\n this.models.movenet,\n this.models.nanodet,\n this.models.centernet,\n this.models.faceres,\n this.models.segmentation,\n ] = await Promise.all([\n this.models.face || (this.config.face.enabled ? facemesh.load(this.config) : null),\n this.models.emotion || ((this.config.face.enabled && this.config.face.emotion.enabled) ? emotion.load(this.config) : null),\n this.models.handpose || (this.config.hand.enabled ? handpose.load(this.config) : null),\n this.models.posenet || (this.config.body.enabled && this.config.body.modelPath.includes('posenet') ? posenet.load(this.config) : null),\n this.models.blazepose || (this.config.body.enabled && this.config.body.modelPath.includes('blazepose') ? blazepose.load(this.config) : null),\n this.models.efficientpose || (this.config.body.enabled && this.config.body.modelPath.includes('efficientpose') ? efficientpose.load(this.config) : null),\n this.models.movenet || (this.config.body.enabled && this.config.body.modelPath.includes('movenet') ? movenet.load(this.config) : null),\n this.models.nanodet || (this.config.object.enabled && this.config.object.modelPath.includes('nanodet') ? nanodet.load(this.config) : null),\n this.models.centernet || (this.config.object.enabled && this.config.object.modelPath.includes('centernet') ? centernet.load(this.config) : null),\n this.models.faceres || ((this.config.face.enabled && this.config.face.description.enabled) ? faceres.load(this.config) : null),\n this.models.segmentation || (this.config.segmentation.enabled ? segmentation.load(this.config) : null),\n ]);\n } else { // load models sequentially\n if (this.config.face.enabled && !this.models.face) this.models.face = await facemesh.load(this.config);\n if (this.config.face.enabled && this.config.face.emotion.enabled && !this.models.emotion) this.models.emotion = await emotion.load(this.config);\n if (this.config.hand.enabled && !this.models.handpose) this.models.handpose = await handpose.load(this.config);\n if (this.config.body.enabled && !this.models.posenet && this.config.body.modelPath.includes('posenet')) this.models.posenet = await posenet.load(this.config);\n if (this.config.body.enabled && !this.models.blazepose && this.config.body.modelPath.includes('blazepose')) this.models.blazepose = await blazepose.load(this.config);\n if (this.config.body.enabled && !this.models.efficientpose && this.config.body.modelPath.includes('efficientpose')) this.models.efficientpose = await blazepose.load(this.config);\n if (this.config.body.enabled && !this.models.movenet && this.config.body.modelPath.includes('movenet')) this.models.movenet = await movenet.load(this.config);\n if (this.config.object.enabled && !this.models.nanodet && this.config.object.modelPath.includes('nanodet')) this.models.nanodet = await nanodet.load(this.config);\n if (this.config.object.enabled && !this.models.centernet && this.config.object.modelPath.includes('centernet')) this.models.centernet = await centernet.load(this.config);\n if (this.config.face.enabled && this.config.face.description.enabled && !this.models.faceres) this.models.faceres = await faceres.load(this.config);\n if (this.config.segmentation.enabled && !this.models.segmentation) this.models.segmentation = await segmentation.load(this.config);\n }\n\n if (this.#firstRun) { // print memory stats on first run\n if (this.config.debug) log('tf engine state:', this.tf.engine().state.numBytes, 'bytes', this.tf.engine().state.numTensors, 'tensors');\n this.#firstRun = false;\n }\n\n const current = Math.trunc(now() - timeStamp);\n if (current > (this.performance.load as number || 0)) this.performance.load = current;\n }\n\n // check if backend needs initialization if it changed\n /** @hidden */\n #checkBackend = async (force = false) => {\n if (this.config.backend && (this.config.backend.length > 0) && force || (this.tf.getBackend() !== this.config.backend)) {\n const timeStamp = now();\n this.state = 'backend';\n /* force backend reload\n if (this.config.backend in tf.engine().registry) {\n const backendFactory = tf.findBackendFactory(this.config.backend);\n tf.removeBackend(this.config.backend);\n tf.registerBackend(this.config.backend, backendFactory);\n } else {\n log('Backend not registred:', this.config.backend);\n }\n */\n\n if (this.config.backend && this.config.backend.length > 0) {\n // @ts-ignore ignore missing type for WorkerGlobalScope as that is the point\n if (typeof window === 'undefined' && typeof WorkerGlobalScope !== 'undefined' && this.config.debug) log('running inside web worker');\n\n // force browser vs node backend\n if (this.tf.ENV.flags.IS_BROWSER && this.config.backend === 'tensorflow') this.config.backend = 'webgl';\n if (this.tf.ENV.flags.IS_NODE && (this.config.backend === 'webgl' || this.config.backend === 'humangl')) this.config.backend = 'tensorflow';\n\n if (this.config.debug) log('setting backend:', this.config.backend);\n\n if (this.config.backend === 'wasm') {\n if (this.config.debug) log('wasm path:', this.config.wasmPath);\n if (typeof this.tf?.setWasmPaths !== 'undefined') this.tf.setWasmPaths(this.config.wasmPath);\n else throw new Error('Human: WASM backend is not loaded');\n const simd = await this.tf.env().getAsync('WASM_HAS_SIMD_SUPPORT');\n const mt = await this.tf.env().getAsync('WASM_HAS_MULTITHREAD_SUPPORT');\n if (this.config.debug) log(`wasm execution: ${simd ? 'SIMD' : 'no SIMD'} ${mt ? 'multithreaded' : 'singlethreaded'}`);\n if (this.config.debug && !simd) log('warning: wasm simd support is not enabled');\n }\n\n if (this.config.backend === 'humangl') backend.register();\n try {\n await this.tf.setBackend(this.config.backend);\n } catch (err) {\n log('error: cannot set backend:', this.config.backend, err);\n }\n }\n this.tf.enableProdMode();\n // this.tf.enableDebugMode();\n if (this.tf.getBackend() === 'webgl' || this.tf.getBackend() === 'humangl') {\n this.tf.ENV.set('CHECK_COMPUTATION_FOR_ERRORS', false);\n this.tf.ENV.set('WEBGL_CPU_FORWARD', true);\n this.tf.ENV.set('WEBGL_PACK_DEPTHWISECONV', true);\n // if (!this.config.object.enabled) this.tf.ENV.set('WEBGL_FORCE_F16_TEXTURES', true); // safe to use 16bit precision\n if (typeof this.config['deallocate'] !== 'undefined' && this.config['deallocate']) { // hidden param\n log('changing webgl: WEBGL_DELETE_TEXTURE_THRESHOLD:', true);\n this.tf.ENV.set('WEBGL_DELETE_TEXTURE_THRESHOLD', 0);\n }\n const gl = await this.tf.backend().getGPGPUContext().gl;\n if (this.config.debug) log(`gl version:${gl.getParameter(gl.VERSION)} renderer:${gl.getParameter(gl.RENDERER)}`);\n }\n await this.tf.ready();\n this.performance.backend = Math.trunc(now() - timeStamp);\n }\n }\n\n /**\n * Runs interpolation using last known result and returns smoothened result\n * Interpolation is based on time since last known result so can be called independently\n *\n * @param result?: {@link Result} optional use specific result set to run interpolation on\n * @returns result: {@link Result}\n */\n next = (result?: Result) => interpolate.calc(result || this.result) as Result;\n\n // check if input changed sufficiently to trigger new detections\n /** @hidden */\n #skipFrame = async (input) => {\n if (this.config.cacheSensitivity === 0) return false;\n const resizeFact = 32;\n const reduced: Tensor = input.resizeBilinear([Math.trunc(input.shape[1] / resizeFact), Math.trunc(input.shape[2] / resizeFact)]);\n // use tensor sum\n /*\n const sumT = this.tf.sum(reduced);\n const sum = sumT.dataSync()[0] as number;\n sumT.dispose();\n */\n // use js loop sum, faster than uploading tensor to gpu calculating and downloading back\n const reducedData = reduced.dataSync(); // raw image rgb array\n let sum = 0;\n for (let i = 0; i < reducedData.length / 3; i++) sum += reducedData[3 * i + 2]; // look only at green value of each pixel\n\n reduced.dispose();\n const diff = 100 * (Math.max(sum, this.#lastInputSum) / Math.min(sum, this.#lastInputSum) - 1);\n this.#lastInputSum = sum;\n // if previous frame was skipped, skip this frame if changed more than cacheSensitivity\n // if previous frame was not skipped, then look for cacheSensitivity or difference larger than one in previous frame to avoid resetting cache in subsequent frames unnecessarily\n const skipFrame = diff < Math.max(this.config.cacheSensitivity, this.#lastCacheDiff);\n // if difference is above 10x threshold, don't use last value to force reset cache for significant change of scenes or images\n this.#lastCacheDiff = diff > 10 * this.config.cacheSensitivity ? 0 : diff;\n return skipFrame;\n }\n\n /** Main detection method\n * - Analyze configuration: {@link Config}\n * - Pre-process input: {@link Input}\n * - Run inference for all configured models\n * - Process and return result: {@link Result}\n *\n * @param input: Input\n * @param userConfig?: {@link Config}\n * @returns result: {@link Result}\n */\n async detect(input: Input, userConfig?: Config | Record): Promise {\n // detection happens inside a promise\n return new Promise(async (resolve) => {\n this.state = 'config';\n let timeStamp;\n let elapsedTime;\n\n // update configuration\n this.config = mergeDeep(this.config, userConfig) as Config;\n\n // sanity checks\n this.state = 'check';\n const error = this.#sanity(input);\n if (error) {\n log(error, input);\n resolve({ error });\n }\n\n const timeStart = now();\n\n // configure backend\n await this.#checkBackend();\n\n // load models if enabled\n await this.load();\n\n /*\n // function disabled in favor of inputChanged\n // disable video optimization for inputs of type image, but skip if inside worker thread\n let previousVideoOptimized;\n // @ts-ignore ignore missing type for WorkerGlobalScope as that is the point\n if (input && this.config.videoOptimized && (typeof window !== 'undefined') && (typeof WorkerGlobalScope !== 'undefined') && (\n (typeof HTMLImageElement !== 'undefined' && input instanceof HTMLImageElement)\n || (typeof Image !== 'undefined' && input instanceof Image)\n || (typeof ImageData !== 'undefined' && input instanceof ImageData)\n || (typeof ImageBitmap !== 'undefined' && image instanceof ImageBitmap))\n ) {\n log('disabling video optimization');\n previousVideoOptimized = this.config.videoOptimized;\n this.config.videoOptimized = false;\n }\n */\n\n timeStamp = now();\n let process = image.process(input, this.config);\n this.performance.image = Math.trunc(now() - timeStamp);\n this.analyze('Get Image:');\n\n // run segmentation preprocessing\n if (this.config.segmentation.enabled && process && process.tensor) {\n this.analyze('Start Segmentation:');\n this.state = 'run:segmentation';\n timeStamp = now();\n await segmentation.predict(process);\n elapsedTime = Math.trunc(now() - timeStamp);\n if (elapsedTime > 0) this.performance.segmentation = elapsedTime;\n if (process.canvas) {\n // replace input\n process.tensor.dispose();\n process = image.process(process.canvas, this.config);\n }\n this.analyze('End Segmentation:');\n }\n\n if (!process || !process.tensor) {\n log('could not convert input to tensor');\n resolve({ error: 'could not convert input to tensor' });\n return;\n }\n\n timeStamp = now();\n this.config.skipFrame = await this.#skipFrame(process.tensor);\n if (!this.performance.frames) this.performance.frames = 0;\n if (!this.performance.cached) this.performance.cached = 0;\n (this.performance.frames as number)++;\n if (this.config.skipFrame) this.performance.cached++;\n this.performance.changed = Math.trunc(now() - timeStamp);\n this.analyze('Check Changed:');\n\n // prepare where to store model results\n // keep them with weak typing as it can be promise or not\n let faceRes;\n let bodyRes;\n let handRes;\n let objectRes;\n\n // run face detection followed by all models that rely on face bounding box: face mesh, age, gender, emotion\n if (this.config.async) {\n faceRes = this.config.face.enabled ? face.detectFace(this, process.tensor) : [];\n if (this.performance.face) delete this.performance.face;\n } else {\n this.state = 'run:face';\n timeStamp = now();\n faceRes = this.config.face.enabled ? await face.detectFace(this, process.tensor) : [];\n elapsedTime = Math.trunc(now() - timeStamp);\n if (elapsedTime > 0) this.performance.face = elapsedTime;\n }\n\n // run body: can be posenet, blazepose, efficientpose, movenet\n this.analyze('Start Body:');\n if (this.config.async) {\n if (this.config.body.modelPath.includes('posenet')) bodyRes = this.config.body.enabled ? posenet.predict(process.tensor, this.config) : [];\n else if (this.config.body.modelPath.includes('blazepose')) bodyRes = this.config.body.enabled ? blazepose.predict(process.tensor, this.config) : [];\n else if (this.config.body.modelPath.includes('efficientpose')) bodyRes = this.config.body.enabled ? efficientpose.predict(process.tensor, this.config) : [];\n else if (this.config.body.modelPath.includes('movenet')) bodyRes = this.config.body.enabled ? movenet.predict(process.tensor, this.config) : [];\n if (this.performance.body) delete this.performance.body;\n } else {\n this.state = 'run:body';\n timeStamp = now();\n if (this.config.body.modelPath.includes('posenet')) bodyRes = this.config.body.enabled ? await posenet.predict(process.tensor, this.config) : [];\n else if (this.config.body.modelPath.includes('blazepose')) bodyRes = this.config.body.enabled ? await blazepose.predict(process.tensor, this.config) : [];\n else if (this.config.body.modelPath.includes('efficientpose')) bodyRes = this.config.body.enabled ? await efficientpose.predict(process.tensor, this.config) : [];\n else if (this.config.body.modelPath.includes('movenet')) bodyRes = this.config.body.enabled ? await movenet.predict(process.tensor, this.config) : [];\n elapsedTime = Math.trunc(now() - timeStamp);\n if (elapsedTime > 0) this.performance.body = elapsedTime;\n }\n this.analyze('End Body:');\n\n // run handpose\n this.analyze('Start Hand:');\n if (this.config.async) {\n handRes = this.config.hand.enabled ? handpose.predict(process.tensor, this.config) : [];\n if (this.performance.hand) delete this.performance.hand;\n } else {\n this.state = 'run:hand';\n timeStamp = now();\n handRes = this.config.hand.enabled ? await handpose.predict(process.tensor, this.config) : [];\n elapsedTime = Math.trunc(now() - timeStamp);\n if (elapsedTime > 0) this.performance.hand = elapsedTime;\n }\n this.analyze('End Hand:');\n\n // run nanodet\n this.analyze('Start Object:');\n if (this.config.async) {\n if (this.config.object.modelPath.includes('nanodet')) objectRes = this.config.object.enabled ? nanodet.predict(process.tensor, this.config) : [];\n else if (this.config.object.modelPath.includes('centernet')) objectRes = this.config.object.enabled ? centernet.predict(process.tensor, this.config) : [];\n if (this.performance.object) delete this.performance.object;\n } else {\n this.state = 'run:object';\n timeStamp = now();\n if (this.config.object.modelPath.includes('nanodet')) objectRes = this.config.object.enabled ? await nanodet.predict(process.tensor, this.config) : [];\n else if (this.config.object.modelPath.includes('centernet')) objectRes = this.config.object.enabled ? await centernet.predict(process.tensor, this.config) : [];\n elapsedTime = Math.trunc(now() - timeStamp);\n if (elapsedTime > 0) this.performance.object = elapsedTime;\n }\n this.analyze('End Object:');\n\n // if async wait for results\n if (this.config.async) [faceRes, bodyRes, handRes, objectRes] = await Promise.all([faceRes, bodyRes, handRes, objectRes]);\n\n // run gesture analysis last\n let gestureRes: Gesture[] = [];\n if (this.config.gesture.enabled) {\n timeStamp = now();\n gestureRes = [...gesture.face(faceRes), ...gesture.body(bodyRes), ...gesture.hand(handRes), ...gesture.iris(faceRes)];\n if (!this.config.async) this.performance.gesture = Math.trunc(now() - timeStamp);\n else if (this.performance.gesture) delete this.performance.gesture;\n }\n\n this.performance.total = Math.trunc(now() - timeStart);\n this.state = 'idle';\n this.result = {\n face: faceRes,\n body: bodyRes,\n hand: handRes,\n gesture: gestureRes,\n object: objectRes,\n performance: this.performance,\n canvas: process.canvas,\n timestamp: Date.now(),\n get persons() { return persons.join(faceRes, bodyRes, handRes, gestureRes, process?.tensor?.shape); },\n };\n\n // finally dispose input tensor\n tf.dispose(process.tensor);\n\n // log('Result:', result);\n resolve(this.result);\n });\n }\n\n /** @hidden */\n #warmupBitmap = async () => {\n const b64toBlob = (base64, type = 'application/octet-stream') => fetch(`data:${type};base64,${base64}`).then((res) => res.blob());\n let blob;\n let res;\n switch (this.config.warmup) {\n case 'face': blob = await b64toBlob(sample.face); break;\n case 'full': blob = await b64toBlob(sample.body); break;\n default: blob = null;\n }\n if (blob) {\n const bitmap = await createImageBitmap(blob);\n res = await this.detect(bitmap, this.config);\n bitmap.close();\n }\n return res;\n }\n\n /** @hidden */\n #warmupCanvas = async () => new Promise((resolve) => {\n let src;\n let size = 0;\n switch (this.config.warmup) {\n case 'face':\n size = 256;\n src = 'data:image/jpeg;base64,' + sample.face;\n break;\n case 'full':\n case 'body':\n size = 1200;\n src = 'data:image/jpeg;base64,' + sample.body;\n break;\n default:\n src = null;\n }\n // src = encodeURI('../assets/human-sample-upper.jpg');\n const img = new Image();\n img.onload = async () => {\n const canvas = (typeof OffscreenCanvas !== 'undefined') ? new OffscreenCanvas(size, size) : document.createElement('canvas');\n canvas.width = img.naturalWidth;\n canvas.height = img.naturalHeight;\n const ctx = canvas.getContext('2d');\n ctx?.drawImage(img, 0, 0);\n // const data = ctx?.getImageData(0, 0, canvas.height, canvas.width);\n const res = await this.detect(canvas, this.config);\n resolve(res);\n };\n if (src) img.src = src;\n else resolve(null);\n });\n\n /** @hidden */\n #warmupNode = async () => {\n const atob = (str) => Buffer.from(str, 'base64');\n let img;\n if (this.config.warmup === 'face') img = atob(sample.face);\n if (this.config.warmup === 'body' || this.config.warmup === 'full') img = atob(sample.body);\n if (!img) return null;\n let res;\n if (typeof tf['node'] !== 'undefined') {\n const data = tf['node'].decodeJpeg(img);\n const expanded = data.expandDims(0);\n this.tf.dispose(data);\n // log('Input:', expanded);\n res = await this.detect(expanded, this.config);\n this.tf.dispose(expanded);\n } else {\n if (this.config.debug) log('Warmup tfjs-node not loaded');\n /*\n const input = await canvasJS.loadImage(img);\n const canvas = canvasJS.createCanvas(input.width, input.height);\n const ctx = canvas.getContext('2d');\n ctx.drawImage(img, 0, 0, input.width, input.height);\n res = await this.detect(input, this.config);\n */\n }\n return res;\n }\n\n /** Warmup metho pre-initializes all models for faster inference\n * - can take significant time on startup\n * - only used for `webgl` and `humangl` backends\n * @param userConfig?: Config\n */\n async warmup(userConfig?: Config | Record): Promise {\n const t0 = now();\n if (userConfig) this.config = mergeDeep(this.config, userConfig) as Config;\n if (!this.config.warmup || this.config.warmup === 'none') return { error: 'null' };\n let res;\n if (typeof createImageBitmap === 'function') res = await this.#warmupBitmap();\n else if (typeof Image !== 'undefined') res = await this.#warmupCanvas();\n else res = await this.#warmupNode();\n const t1 = now();\n if (this.config.debug) log('Warmup', this.config.warmup, Math.round(t1 - t0), 'ms', res);\n return res;\n }\n}\n\n/**\n * Class Human is also available as default export\n */\nexport { Human as default };\n"], - "mappings": ";;;;;;stBAKO,WAAc,EAAgB,EAAsB,CACzD,GAAM,GAAY,EAAO,SAAS,KAAO,GAAK,IAExC,EAAO,AADI,EAAK,WAAW,MAAQ,EAAK,WAAW,MAAQ,EAAK,WAAW,UAAY,EAAK,WAAW,WAAa,EAAK,WAAW,SAClH,GAAG,IAAS,GAAG,IAAS,IAAY,IAC5D,GAAI,CAAC,EAAK,oBAAoB,SAAS,SAAU,KAAM,IAAI,OAAM,2BAA2B,yBAC5F,MAAO,GAIF,cAAgB,EAAW,CAChC,GAAM,GAAK,GAAI,MACT,EAAK,GAAG,EAAG,WAAW,WAAW,SAAS,EAAG,QAAQ,EAAG,aAAa,WAAW,SAAS,EAAG,QAAQ,EAAG,aAAa,WAAW,SAAS,EAAG,QAAQ,EAAG,kBAAkB,WAAW,SAAS,EAAG,OAErM,AAAI,GAAK,QAAQ,IAAI,EAAI,SAAU,GAAG,GAIjC,GAAM,GAAM,IACb,MAAO,cAAgB,YAAoB,YAAY,MACpD,SAAU,QAAO,QAAQ,OAAO,UAAY,IAAO,KAAM,YAI3D,cAAsB,EAAS,CACpC,GAAM,GAAW,AAAC,GAAQ,GAAO,MAAO,IAAQ,SAChD,MAAO,GAAQ,OAAO,CAAC,EAAM,IAC3B,QAAO,KAAK,GAAO,IAAI,QAAQ,AAAC,GAAQ,CACtC,GAAM,GAAO,EAAK,GACZ,EAAO,EAAI,GACjB,AAAI,M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Aa,CAAC,GAAG,AAAQ,GAAK,GAAU,GAAG,AAAQ,GAAK,GAAU,GAAG,AAAQ,GAAK,GAAU,GAAG,AAAQ,GAAK,IAC5G,AAAK,KAAK,OAAO,MACR,KAAK,YAAY,SAAS,MAAO,MAAK,YAAY,QADnC,KAAK,YAAY,QAAU,KAAK,MAAM,IAAQ,IAIxE,KAAK,YAAY,MAAQ,KAAK,MAAM,IAAQ,GAC5C,KAAK,MAAQ,OACb,KAAK,OAAS,CACZ,KAAM,EACN,KAAM,EACN,KAAM,EACN,QAAS,EACT,OAAQ,EACR,YAAa,KAAK,YAClB,OAAQ,EAAQ,OAChB,UAAW,KAAK,SACZ,UAAU,CA/lBtB,MA+lBwB,MAAO,AAAQ,IAAK,EAAS,EAAS,EAAS,EAAY,oBAAS,SAAT,cAAiB,SAI9F,AAAG,UAAQ,EAAQ,QAGnB,EAAQ,KAAK,eAwFX,QAAO,EAA4E,CACvF,GAAM,GAAK,IAEX,GADI,GAAY,MAAK,OAAS,EAAU,KAAK,OAAQ,IACjD,CAAC,KAAK,OAAO,QAAU,KAAK,OAAO,SAAW,OAAQ,MAAO,CAAE,MAAO,QAC1E,GAAI,GACJ,AAAI,MAAO,oBAAsB,WAAY,EAAM,KAAM,QAAK,IAAL,WACpD,AAAI,MAAO,QAAU,YAAa,EAAM,KAAM,QAAK,IAAL,WAC9C,EAAM,KAAM,QAAK,IAAL,WACjB,GAAM,GAAK,IACX,MAAI,MAAK,OAAO,OAAO,EAAI,SAAU,KAAK,OAAO,OAAQ,KAAK,MAAM,EAAK,GAAK,KAAM,GAC7E,IArkBT,eACA,eACA,eACA,eACA,eACA,eA6DA,eAoIA,eAuEA,eA2NA,eAkBA,eAiCA", + "sourcesContent": ["/**\n * Simple helper functions used accross codebase\n */\n\n// helper function: join two paths\nexport function join(folder: string, file: string): string {\n const separator = folder.endsWith('/') ? '' : '/';\n const skipJoin = file.startsWith('.') || file.startsWith('/') || file.startsWith('http:') || file.startsWith('https:') || file.startsWith('file:');\n const path = skipJoin ? `${file}` : `${folder}${separator}${file}`;\n if (!path.toLocaleLowerCase().includes('.json')) throw new Error(`Human: ModelPath Error: ${path} Expecting JSON file`);\n return path;\n}\n\n// helper function: wrapper around console output\nexport function log(...msg): void {\n const dt = new Date();\n const ts = `${dt.getHours().toString().padStart(2, '0')}:${dt.getMinutes().toString().padStart(2, '0')}:${dt.getSeconds().toString().padStart(2, '0')}.${dt.getMilliseconds().toString().padStart(3, '0')}`;\n // eslint-disable-next-line no-console\n if (msg) console.log(ts, 'Human:', ...msg);\n}\n\n// helper function: gets elapsed time on both browser and nodejs\nexport const now = () => {\n if (typeof performance !== 'undefined') return performance.now();\n return parseInt((Number(process.hrtime.bigint()) / 1000 / 1000).toString());\n};\n\n// helper function: perform deep merge of multiple objects so it allows full inheriance with overrides\nexport function mergeDeep(...objects) {\n const isObject = (obj) => obj && typeof obj === 'object';\n return objects.reduce((prev, obj) => {\n Object.keys(obj || {}).forEach((key) => {\n const pVal = prev[key];\n const oVal = obj[key];\n if (Array.isArray(pVal) && Array.isArray(oVal)) prev[key] = pVal.concat(...oVal);\n else if (isObject(pVal) && isObject(oVal)) prev[key] = mergeDeep(pVal, oVal);\n else prev[key] = oVal;\n });\n return prev;\n }, {});\n}\n\n// helper function: return min and max from input array\nexport const minmax = (data) => data.reduce((acc, val) => {\n acc[0] = (acc[0] === undefined || val < acc[0]) ? val : acc[0];\n acc[1] = (acc[1] === undefined || val > acc[1]) ? val : acc[1];\n return acc;\n}, []);\n", "/* eslint-disable indent */\n/* eslint-disable no-multi-spaces */\n\n/**\n * Configuration interface definition for **Human** library\n *\n * Contains all configurable parameters\n * @typedef Config\n */\nexport interface Config {\n /** Backend used for TFJS operations */\n backend: null | '' | 'cpu' | 'wasm' | 'webgl' | 'humangl' | 'tensorflow',\n\n /** Path to *.wasm files if backend is set to `wasm` */\n wasmPath: string,\n\n /** Print debug statements to console */\n debug: boolean,\n\n /** Perform model loading and inference concurrently or sequentially */\n async: boolean,\n\n /** What to use for `human.warmup()`\n * - warmup pre-initializes all models for faster inference but can take significant time on startup\n * - only used for `webgl` and `humangl` backends\n */\n warmup: 'none' | 'face' | 'full' | 'body',\n\n /** Base model path (typically starting with file://, http:// or https://) for all models\n * - individual modelPath values are relative to this path\n */\n modelBasePath: string,\n\n /** Cache sensitivity\n * - values 0..1 where 0.01 means reset cache if input changed more than 1%\n * - set to 0 to disable caching\n */\n cacheSensitivity: number;\n\n /** Cache sensitivity\n * - values 0..1 where 0.01 means reset cache if input changed more than 1%\n * - set to 0 to disable caching\n */\n skipFrame: boolean;\n\n /** Run input through image filters before inference\n * - image filters run with near-zero latency as they are executed on the GPU\n */\n filter: {\n enabled: boolean,\n /** Resize input width\n * - if both width and height are set to 0, there is no resizing\n * - if just one is set, second one is scaled automatically\n * - if both are set, values are used as-is\n */\n width: number,\n /** Resize input height\n * - if both width and height are set to 0, there is no resizing\n * - if just one is set, second one is scaled automatically\n * - if both are set, values are used as-is\n */\n height: number,\n /** Return processed canvas imagedata in result */\n return: boolean,\n /** Flip input as mirror image */\n flip: boolean,\n /** Range: -1 (darken) to 1 (lighten) */\n brightness: number,\n /** Range: -1 (reduce contrast) to 1 (increase contrast) */\n contrast: number,\n /** Range: 0 (no sharpening) to 1 (maximum sharpening) */\n sharpness: number,\n /** Range: 0 (no blur) to N (blur radius in pixels) */\n blur: number\n /** Range: -1 (reduce saturation) to 1 (increase saturation) */\n saturation: number,\n /** Range: 0 (no change) to 360 (hue rotation in degrees) */\n hue: number,\n /** Image negative */\n negative: boolean,\n /** Image sepia colors */\n sepia: boolean,\n /** Image vintage colors */\n vintage: boolean,\n /** Image kodachrome colors */\n kodachrome: boolean,\n /** Image technicolor colors */\n technicolor: boolean,\n /** Image polaroid camera effect */\n polaroid: boolean,\n /** Range: 0 (no pixelate) to N (number of pixels to pixelate) */\n pixelate: number,\n },\n // type definition end\n\n /** Controlls gesture detection */\n gesture: {\n enabled: boolean,\n },\n\n /** Controlls and configures all face-specific options:\n * - face detection, face mesh detection, age, gender, emotion detection and face description\n * Parameters:\n * - enabled: true/false\n * - modelPath: path for each of face models\n * - minConfidence: threshold for discarding a prediction\n * - iouThreshold: ammount of overlap between two detected objects before one object is removed\n * - maxDetected: maximum number of faces detected in the input, should be set to the minimum number for performance\n * - rotation: use calculated rotated face image or just box with rotation as-is, false means higher performance, but incorrect mesh mapping on higher face angles\n * - return: return extracted face as tensor for futher user processing\n */\n face: {\n enabled: boolean,\n detector: {\n modelPath: string,\n rotation: boolean,\n maxDetected: number,\n skipFrames: number,\n minConfidence: number,\n iouThreshold: number,\n return: boolean,\n },\n mesh: {\n enabled: boolean,\n modelPath: string,\n },\n iris: {\n enabled: boolean,\n modelPath: string,\n },\n description: {\n enabled: boolean,\n modelPath: string,\n skipFrames: number,\n minConfidence: number,\n },\n emotion: {\n enabled: boolean,\n minConfidence: number,\n skipFrames: number,\n modelPath: string,\n },\n },\n\n /** Controlls and configures all body detection specific options\n * - enabled: true/false\n * - modelPath: body pose model, can be absolute path or relative to modelBasePath\n * - minConfidence: threshold for discarding a prediction\n * - maxDetected: maximum number of people detected in the input, should be set to the minimum number for performance\n */\n body: {\n enabled: boolean,\n modelPath: string,\n maxDetected: number,\n minConfidence: number,\n skipFrames: number,\n },\n\n /** Controlls and configures all hand detection specific options\n * - enabled: true/false\n * - landmarks: detect hand landmarks or just hand boundary box\n * - modelPath: paths for hand detector and hand skeleton models, can be absolute path or relative to modelBasePath\n * - minConfidence: threshold for discarding a prediction\n * - iouThreshold: ammount of overlap between two detected objects before one object is removed\n * - maxDetected: maximum number of hands detected in the input, should be set to the minimum number for performance\n * - rotation: use best-guess rotated hand image or just box with rotation as-is, false means higher performance, but incorrect finger mapping if hand is inverted\n */\n hand: {\n enabled: boolean,\n rotation: boolean,\n skipFrames: number,\n minConfidence: number,\n iouThreshold: number,\n maxDetected: number,\n landmarks: boolean,\n detector: {\n modelPath: string,\n },\n skeleton: {\n modelPath: string,\n },\n },\n\n /** Controlls and configures all object detection specific options\n * - enabled: true/false\n * - modelPath: object detection model, can be absolute path or relative to modelBasePath\n * - minConfidence: minimum score that detection must have to return as valid object\n * - iouThreshold: ammount of overlap between two detected objects before one object is removed\n * - maxDetected: maximum number of detections to return\n */\n object: {\n enabled: boolean,\n modelPath: string,\n minConfidence: number,\n iouThreshold: number,\n maxDetected: number,\n skipFrames: number,\n },\n\n /** Controlls and configures all body segmentation module\n * removes background from input containing person\n * if segmentation is enabled it will run as preprocessing task before any other model\n * alternatively leave it disabled and use it on-demand using human.segmentation method which can\n * remove background or replace it with user-provided background\n *\n * - enabled: true/false\n * - modelPath: object detection model, can be absolute path or relative to modelBasePath\n */\n segmentation: {\n enabled: boolean,\n modelPath: string,\n },\n}\n\nconst config: Config = {\n backend: 'webgl', // select tfjs backend to use, leave empty to use default backend\n // can be 'webgl', 'wasm', 'cpu', or 'humangl' which is a custom version of webgl\n modelBasePath: '../models/', // base path for all models\n wasmPath: '../node_modules/@tensorflow/tfjs-backend-wasm/dist/', // path for wasm binaries, only used for backend: wasm\n debug: true, // print additional status messages to console\n async: true, // execute enabled models in parallel\n warmup: 'full', // what to use for human.warmup(), can be 'none', 'face', 'full'\n // warmup pre-initializes all models for faster inference but can take\n // significant time on startup\n // only used for `webgl` and `humangl` backends\n cacheSensitivity: 0.75, // cache sensitivity\n // values 0..1 where 0.01 means reset cache if input changed more than 1%\n // set to 0 to disable caching\n skipFrame: false, // internal & dynamic\n filter: { // run input through image filters before inference\n // image filters run with near-zero latency as they are executed on the GPU\n enabled: true, // enable image pre-processing filters\n width: 0, // resize input width\n height: 0, // resize input height\n // if both width and height are set to 0, there is no resizing\n // if just one is set, second one is scaled automatically\n // if both are set, values are used as-is\n flip: false, // flip input as mirror image\n return: true, // return processed canvas imagedata in result\n brightness: 0, // range: -1 (darken) to 1 (lighten)\n contrast: 0, // range: -1 (reduce contrast) to 1 (increase contrast)\n sharpness: 0, // range: 0 (no sharpening) to 1 (maximum sharpening)\n blur: 0, // range: 0 (no blur) to N (blur radius in pixels)\n saturation: 0, // range: -1 (reduce saturation) to 1 (increase saturation)\n hue: 0, // range: 0 (no change) to 360 (hue rotation in degrees)\n negative: false, // image negative\n sepia: false, // image sepia colors\n vintage: false, // image vintage colors\n kodachrome: false, // image kodachrome colors\n technicolor: false, // image technicolor colors\n polaroid: false, // image polaroid camera effect\n pixelate: 0, // range: 0 (no pixelate) to N (number of pixels to pixelate)\n },\n\n gesture: {\n enabled: true, // enable gesture recognition based on model results\n },\n\n face: {\n enabled: true, // controls if specified modul is enabled\n // face.enabled is required for all face models:\n // detector, mesh, iris, age, gender, emotion\n // (note: module is not loaded until it is required)\n detector: {\n modelPath: 'blazeface.json', // detector model, can be absolute path or relative to modelBasePath\n rotation: true, // use best-guess rotated face image or just box with rotation as-is\n // false means higher performance, but incorrect mesh mapping if face angle is above 20 degrees\n // this parameter is not valid in nodejs\n maxDetected: 15, // maximum number of faces detected in the input\n // should be set to the minimum number for performance\n skipFrames: 15, // how many max frames to go without re-running the face bounding box detector\n // only used when cacheSensitivity is not zero\n // e.g., if model is running st 25 FPS, we can re-use existing bounding\n // box for updated face analysis as the head probably hasn't moved much\n // in short time (10 * 1/25 = 0.25 sec)\n minConfidence: 0.2, // threshold for discarding a prediction\n iouThreshold: 0.1, // ammount of overlap between two detected objects before one object is removed\n return: false, // return extracted face as tensor\n },\n\n mesh: {\n enabled: true,\n modelPath: 'facemesh.json', // facemesh model, can be absolute path or relative to modelBasePath\n },\n\n iris: {\n enabled: true,\n modelPath: 'iris.json', // face iris model\n // can be either absolute path or relative to modelBasePath\n },\n\n description: {\n enabled: true, // to improve accuracy of face description extraction it is\n // recommended to enable detector.rotation and mesh.enabled\n modelPath: 'faceres.json', // face description model\n // can be either absolute path or relative to modelBasePath\n skipFrames: 11, // how many max frames to go without re-running the detector\n // only used when cacheSensitivity is not zero\n minConfidence: 0.1, // threshold for discarding a prediction\n },\n\n emotion: {\n enabled: true,\n minConfidence: 0.1, // threshold for discarding a prediction\n skipFrames: 17, // how max many frames to go without re-running the detector\n // only used when cacheSensitivity is not zero\n modelPath: 'emotion.json', // face emotion model, can be absolute path or relative to modelBasePath\n },\n },\n\n body: {\n enabled: true,\n modelPath: 'movenet-lightning.json', // body model, can be absolute path or relative to modelBasePath\n // can be 'posenet', 'blazepose', 'efficientpose', 'movenet-lightning', 'movenet-thunder'\n maxDetected: 1, // maximum number of people detected in the input\n // should be set to the minimum number for performance\n // only valid for posenet as other models detects single pose\n minConfidence: 0.2, // threshold for discarding a prediction\n skipFrames: 1, // how many max frames to go without re-running the detector\n // only used when cacheSensitivity is not zero\n},\n\n hand: {\n enabled: true,\n rotation: true, // use best-guess rotated hand image or just box with rotation as-is\n // false means higher performance, but incorrect finger mapping if hand is inverted\n skipFrames: 18, // how many max frames to go without re-running the hand bounding box detector\n // only used when cacheSensitivity is not zero\n // e.g., if model is running st 25 FPS, we can re-use existing bounding\n // box for updated hand skeleton analysis as the hand probably\n // hasn't moved much in short time (10 * 1/25 = 0.25 sec)\n minConfidence: 0.1, // threshold for discarding a prediction\n iouThreshold: 0.1, // ammount of overlap between two detected objects before one object is removed\n maxDetected: 2, // maximum number of hands detected in the input\n // should be set to the minimum number for performance\n landmarks: true, // detect hand landmarks or just hand boundary box\n detector: {\n modelPath: 'handdetect.json', // hand detector model, can be absolute path or relative to modelBasePath\n },\n skeleton: {\n modelPath: 'handskeleton.json', // hand skeleton model, can be absolute path or relative to modelBasePath\n },\n },\n\n object: {\n enabled: false,\n modelPath: 'mb3-centernet.json', // experimental: object detection model, can be absolute path or relative to modelBasePath\n // can be 'mb3-centernet' or 'nanodet'\n minConfidence: 0.2, // threshold for discarding a prediction\n iouThreshold: 0.4, // ammount of overlap between two detected objects before one object is removed\n maxDetected: 10, // maximum number of objects detected in the input\n skipFrames: 19, // how many max frames to go without re-running the detector\n // only used when cacheSensitivity is not zero\n },\n\n segmentation: {\n enabled: false, // controlls and configures all body segmentation module\n // removes background from input containing person\n // if segmentation is enabled it will run as preprocessing task before any other model\n // alternatively leave it disabled and use it on-demand using human.segmentation method which can\n // remove background or replace it with user-provided background\n modelPath: 'selfie.json', // experimental: object detection model, can be absolute path or relative to modelBasePath\n // can be 'selfie' or 'meet'\n },\n};\nexport { config as defaults };\n", "/**\n * Helper function that returns basic system info\n */\nexport function info(): { platform: string, agent: string } {\n let platform;\n let agent;\n if (typeof navigator !== 'undefined') {\n const raw = navigator.userAgent.match(/\\(([^()]+)\\)/g);\n if (raw && raw[0]) {\n const platformMatch = raw[0].match(/\\(([^()]+)\\)/g);\n platform = platformMatch ? platformMatch[0].replace(/\\(|\\)/g, '') : '';\n agent = navigator.userAgent.replace(raw[0], '');\n if (platform[1]) agent = agent.replace(raw[1], '');\n agent = agent.replace(/ /g, ' ');\n }\n } else if (typeof process !== 'undefined') {\n platform = `${process.platform} ${process.arch}`;\n agent = `NodeJS ${process.version}`;\n }\n return { platform, agent };\n}\n", "/**\n * Creates tfjs bundle used by Human browser build target\n * @external\n */\n\n// import from dist\n// get versions of all packages\n/*\nimport * as packageBundle from '@tensorflow/tfjs/package.json';\nimport * as packageCore from '@tensorflow/tfjs-core/package.json';\nimport * as packageData from '@tensorflow/tfjs-data/package.json';\nimport * as packageLayers from '@tensorflow/tfjs-layers/package.json';\nimport * as packageConverter from '@tensorflow/tfjs-converter/package.json';\n// for backends, get version from source to avoid incorrect tree shaking\nimport { version_cpu } from '@tensorflow/tfjs-backend-cpu/dist/index.js';\nimport { version_webgl } from '@tensorflow/tfjs-backend-webgl/dist/index.js';\nimport { version_wasm } from '@tensorflow/tfjs-backend-wasm/dist/index.js';\n\n// export all\nexport * from '@tensorflow/tfjs-core/dist/index.js';\nexport * from '@tensorflow/tfjs-layers/dist/index.js';\nexport * from '@tensorflow/tfjs-converter/dist/index.js';\nexport * as data from '@tensorflow/tfjs-data/dist/index.js';\nexport * from '@tensorflow/tfjs-backend-cpu/dist/index.js';\nexport * from '@tensorflow/tfjs-backend-webgl/dist/index.js';\nexport * from '@tensorflow/tfjs-backend-wasm/dist/index.js';\n*/\n\n// import from src\n// get versions of all packages\nimport { version as tfjsVersion } from '@tensorflow/tfjs/package.json';\nimport { version as tfjsCoreVersion } from '@tensorflow/tfjs-core/package.json';\nimport { version as tfjsDataVersion } from '@tensorflow/tfjs-data/package.json';\nimport { version as tfjsLayersVersion } from '@tensorflow/tfjs-layers/package.json';\nimport { version as tfjsConverterVersion } from '@tensorflow/tfjs-converter/package.json';\nimport { version as tfjsBackendCPUVersion } from '@tensorflow/tfjs-backend-cpu/package.json';\nimport { version as tfjsBackendWebGLVersion } from '@tensorflow/tfjs-backend-webgl/package.json';\nimport { version as tfjsBackendWASMVersion } from '@tensorflow/tfjs-backend-wasm/package.json';\n\n// export all\n// requires treeShaking:ignore-annotations due to tfjs misconfiguration\nexport * from '@tensorflow/tfjs-core/src/index';\nexport * from '@tensorflow/tfjs-layers/src/index';\nexport * from '@tensorflow/tfjs-converter/src/index';\nexport * as data from '@tensorflow/tfjs-data/src/index';\nexport * from '@tensorflow/tfjs-backend-cpu/src/index';\nexport * from '@tensorflow/tfjs-backend-webgl/src/index';\nexport * from '@tensorflow/tfjs-backend-wasm/src/index';\n/*\n*/\n\n// export versions\nexport const version = {\n tfjs: tfjsVersion,\n 'tfjs-core': tfjsCoreVersion,\n 'tfjs-data': tfjsDataVersion,\n 'tfjs-layers': tfjsLayersVersion,\n 'tfjs-converter': tfjsConverterVersion,\n 'tfjs-backend-cpu': tfjsBackendCPUVersion,\n 'tfjs-backend-webgl': tfjsBackendWebGLVersion,\n 'tfjs-backend-wasm': tfjsBackendWASMVersion,\n};\n// export const version = {};\n", "/**\n * Custom TFJS backend for Human based on WebGL\n * Not used by default\n */\n\nimport { log } from '../helpers';\nimport * as tf from '../../dist/tfjs.esm.js';\n\nexport const config = {\n name: 'humangl',\n priority: 99,\n canvas: null,\n gl: null,\n width: 1024,\n height: 1024,\n webGLattr: { // https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.2\n alpha: false,\n antialias: false,\n premultipliedAlpha: false,\n preserveDrawingBuffer: false,\n depth: false,\n stencil: false,\n failIfMajorPerformanceCaveat: false,\n desynchronized: true,\n },\n};\n\nexport function register(): void {\n if (!tf.findBackend(config.name)) {\n log('backend registration:', config.name);\n try {\n config.canvas = (typeof OffscreenCanvas !== 'undefined') ? new OffscreenCanvas(config.width, config.height) : document.createElement('canvas');\n } catch (err) {\n log('error: cannot create canvas:', err);\n return;\n }\n try {\n config.gl = config.canvas.getContext('webgl2', config.webGLattr);\n } catch (err) {\n log('error: cannot get WebGL2 context:', err);\n return;\n }\n try {\n tf.setWebGLContext(2, config.gl);\n } catch (err) {\n log('error: cannot set WebGL2 context:', err);\n return;\n }\n try {\n const ctx = new tf.GPGPUContext(config.gl);\n tf.registerBackend(config.name, () => new tf.MathBackendWebGL(ctx), config.priority);\n } catch (err) {\n log('error: cannot register WebGL backend:', err);\n return;\n }\n try {\n const kernels = tf.getKernelsForBackend('webgl');\n kernels.forEach((kernelConfig) => {\n const newKernelConfig = { ...kernelConfig, backendName: config.name };\n tf.registerKernel(newKernelConfig);\n });\n } catch (err) {\n log('error: cannot update WebGL backend registration:', err);\n return;\n }\n try {\n tf.ENV.set('WEBGL_VERSION', 2);\n // tf.ENV.set('WEBGL_MAX_TEXTURE_SIZE', config.gl.getParameter(config.gl.MAX_TEXTURE_SIZE));\n // tf.ENV.set('WEBGL_FORCE_F16_TEXTURES', true);\n // tf.ENV.set('WEBGL_PACK_DEPTHWISECONV', true);\n } catch (err) {\n log('error: cannot set WebGL backend flags:', err);\n return;\n }\n log('backend registered:', config.name);\n }\n}\n", "import * as tf from '../../dist/tfjs.esm.js';\n\nexport function scaleBoxCoordinates(box, factor) {\n const startPoint = [box.startPoint[0] * factor[0], box.startPoint[1] * factor[1]];\n const endPoint = [box.endPoint[0] * factor[0], box.endPoint[1] * factor[1]];\n return { startPoint, endPoint };\n}\n\nexport function getBoxSize(box) {\n return [\n Math.abs(box.endPoint[0] - box.startPoint[0]),\n Math.abs(box.endPoint[1] - box.startPoint[1]),\n ];\n}\n\nexport function getBoxCenter(box) {\n return [\n box.startPoint[0] + (box.endPoint[0] - box.startPoint[0]) / 2,\n box.startPoint[1] + (box.endPoint[1] - box.startPoint[1]) / 2,\n ];\n}\n\nexport function cutBoxFromImageAndResize(box, image, cropSize) {\n const h = image.shape[1];\n const w = image.shape[2];\n const boxes = [[\n box.startPoint[1] / h,\n box.startPoint[0] / w,\n box.endPoint[1] / h,\n box.endPoint[0] / w,\n ]];\n return tf.image.cropAndResize(image, boxes, [0], cropSize);\n}\n\nexport function enlargeBox(box, factor = 1.5) {\n const center = getBoxCenter(box);\n const size = getBoxSize(box);\n const newHalfSize = [factor * size[0] / 2, factor * size[1] / 2];\n const startPoint = [center[0] - newHalfSize[0], center[1] - newHalfSize[1]];\n const endPoint = [center[0] + newHalfSize[0], center[1] + newHalfSize[1]];\n return { startPoint, endPoint, landmarks: box.landmarks };\n}\n\nexport function squarifyBox(box) {\n const centers = getBoxCenter(box);\n const size = getBoxSize(box);\n const maxEdge = Math.max(...size);\n const halfSize = maxEdge / 2;\n const startPoint = [Math.round(centers[0] - halfSize), Math.round(centers[1] - halfSize)];\n const endPoint = [Math.round(centers[0] + halfSize), Math.round(centers[1] + halfSize)];\n return { startPoint, endPoint, landmarks: box.landmarks };\n}\n\nexport function calculateLandmarksBoundingBox(landmarks) {\n const xs = landmarks.map((d) => d[0]);\n const ys = landmarks.map((d) => d[1]);\n const startPoint = [Math.min(...xs), Math.min(...ys)];\n const endPoint = [Math.max(...xs), Math.max(...ys)];\n return { startPoint, endPoint, landmarks };\n}\n\nexport const disposeBox = (t) => {\n t.startPoint.dispose();\n t.endPoint.dispose();\n};\n\nexport const createBox = (startEndTensor) => ({\n startPoint: tf.slice(startEndTensor, [0, 0], [-1, 2]),\n endPoint: tf.slice(startEndTensor, [0, 2], [-1, 2]),\n});\n", "export const IDENTITY_MATRIX = [[1, 0, 0], [0, 1, 0], [0, 0, 1]];\n/**\n * Normalizes the provided angle to the range -pi to pi.\n * @param angle The angle in radians to be normalized.\n */\nexport function normalizeRadians(angle) {\n return angle - 2 * Math.PI * Math.floor((angle + Math.PI) / (2 * Math.PI));\n}\n\n/**\n * Computes the angle of rotation between two anchor points.\n * @param point1 First anchor point\n * @param point2 Second anchor point\n */\nexport function computeRotation(point1, point2) {\n const radians = Math.PI / 2 - Math.atan2(-(point2[1] - point1[1]), point2[0] - point1[0]);\n return normalizeRadians(radians);\n}\n\nexport function radToDegrees(rad) {\n return rad * 180 / Math.PI;\n}\n\nexport function buildTranslationMatrix(x, y) {\n return [[1, 0, x], [0, 1, y], [0, 0, 1]];\n}\n\nexport function dot(v1, v2) {\n let product = 0;\n for (let i = 0; i < v1.length; i++) {\n product += v1[i] * v2[i];\n }\n return product;\n}\n\nexport function getColumnFrom2DArr(arr, columnIndex) {\n const column: Array = [];\n for (let i = 0; i < arr.length; i++) {\n column.push(arr[i][columnIndex]);\n }\n return column;\n}\n\nexport function multiplyTransformMatrices(mat1, mat2) {\n const product: Array = [];\n const size = mat1.length;\n for (let row = 0; row < size; row++) {\n product.push([]);\n for (let col = 0; col < size; col++) {\n product[row].push(dot(mat1[row], getColumnFrom2DArr(mat2, col)));\n }\n }\n return product;\n}\n\nexport function buildRotationMatrix(rotation, center) {\n const cosA = Math.cos(rotation);\n const sinA = Math.sin(rotation);\n const rotationMatrix = [[cosA, -sinA, 0], [sinA, cosA, 0], [0, 0, 1]];\n const translationMatrix = buildTranslationMatrix(center[0], center[1]);\n const translationTimesRotation = multiplyTransformMatrices(translationMatrix, rotationMatrix);\n const negativeTranslationMatrix = buildTranslationMatrix(-center[0], -center[1]);\n return multiplyTransformMatrices(translationTimesRotation, negativeTranslationMatrix);\n}\n\nexport function invertTransformMatrix(matrix) {\n const rotationComponent = [[matrix[0][0], matrix[1][0]], [matrix[0][1], matrix[1][1]]];\n const translationComponent = [matrix[0][2], matrix[1][2]];\n const invertedTranslation = [\n -dot(rotationComponent[0], translationComponent),\n -dot(rotationComponent[1], translationComponent),\n ];\n return [\n rotationComponent[0].concat(invertedTranslation[0]),\n rotationComponent[1].concat(invertedTranslation[1]),\n [0, 0, 1],\n ];\n}\n\nexport function rotatePoint(homogeneousCoordinate, rotationMatrix) {\n return [\n dot(homogeneousCoordinate, rotationMatrix[0]),\n dot(homogeneousCoordinate, rotationMatrix[1]),\n ];\n}\n\nexport function xyDistanceBetweenPoints(a, b) {\n return Math.sqrt(((a[0] - b[0]) ** 2) + ((a[1] - b[1]) ** 2));\n}\n\nexport function generateAnchors(inputSize) {\n const spec = { strides: [inputSize / 16, inputSize / 8], anchors: [2, 6] };\n const anchors: Array<[number, number]> = [];\n for (let i = 0; i < spec.strides.length; i++) {\n const stride = spec.strides[i];\n const gridRows = Math.floor((inputSize + stride - 1) / stride);\n const gridCols = Math.floor((inputSize + stride - 1) / stride);\n const anchorsNum = spec.anchors[i];\n for (let gridY = 0; gridY < gridRows; gridY++) {\n const anchorY = stride * (gridY + 0.5);\n for (let gridX = 0; gridX < gridCols; gridX++) {\n const anchorX = stride * (gridX + 0.5);\n for (let n = 0; n < anchorsNum; n++) {\n anchors.push([anchorX, anchorY]);\n }\n }\n }\n }\n return anchors;\n}\n", "import { log, join } from '../helpers';\nimport * as tf from '../../dist/tfjs.esm.js';\nimport * as box from './box';\nimport * as util from './util';\nimport { Config } from '../config';\nimport { Tensor, GraphModel } from '../tfjs/types';\n\nconst keypointsCount = 6;\n\nfunction decodeBounds(boxOutputs, anchors, inputSize) {\n const boxStarts = tf.slice(boxOutputs, [0, 1], [-1, 2]);\n const centers = tf.add(boxStarts, anchors);\n const boxSizes = tf.slice(boxOutputs, [0, 3], [-1, 2]);\n const boxSizesNormalized = tf.div(boxSizes, inputSize);\n const centersNormalized = tf.div(centers, inputSize);\n const halfBoxSize = tf.div(boxSizesNormalized, 2);\n const starts = tf.sub(centersNormalized, halfBoxSize);\n const ends = tf.add(centersNormalized, halfBoxSize);\n const startNormalized = tf.mul(starts, inputSize);\n const endNormalized = tf.mul(ends, inputSize);\n const concatAxis = 1;\n return tf.concat2d([startNormalized, endNormalized], concatAxis);\n}\n\nexport class BlazeFaceModel {\n model: GraphModel;\n anchorsData: [number, number][];\n anchors: Tensor;\n inputSize: number;\n config: Config;\n\n constructor(model, config: Config) {\n this.model = model;\n this.anchorsData = util.generateAnchors(model.inputs[0].shape[1]);\n this.anchors = tf.tensor2d(this.anchorsData);\n this.inputSize = model.inputs[0].shape[2];\n this.config = config;\n }\n\n async getBoundingBoxes(inputImage: Tensor) {\n // sanity check on input\n // @ts-ignore isDisposed is internal property\n if ((!inputImage) || (inputImage.isDisposedInternal) || (inputImage.shape.length !== 4) || (inputImage.shape[1] < 1) || (inputImage.shape[2] < 1)) return null;\n const [batch, boxes, scores] = tf.tidy(() => {\n const resizedImage = tf.image.resizeBilinear(inputImage, [this.inputSize, this.inputSize]);\n const normalizedImage = resizedImage.div(127.5).sub(0.5);\n const res = this.model.execute(normalizedImage);\n let batchOut;\n if (Array.isArray(res)) { // are we using tfhub or pinto converted model?\n const sorted = res.sort((a, b) => a.size - b.size);\n const concat384 = tf.concat([sorted[0], sorted[2]], 2); // dim: 384, 1 + 16\n const concat512 = tf.concat([sorted[1], sorted[3]], 2); // dim: 512, 1 + 16\n const concat = tf.concat([concat512, concat384], 1);\n batchOut = concat.squeeze(0);\n } else {\n batchOut = tf.squeeze(res); // when using tfhub model\n }\n const boxesOut = decodeBounds(batchOut, this.anchors, [this.inputSize, this.inputSize]);\n const logits = tf.slice(batchOut, [0, 0], [-1, 1]);\n const scoresOut = tf.sigmoid(logits).squeeze().dataSync();\n return [batchOut, boxesOut, scoresOut];\n });\n const nmsTensor = await tf.image.nonMaxSuppressionAsync(boxes, scores, this.config.face.detector.maxDetected, this.config.face.detector.iouThreshold, this.config.face.detector.minConfidence);\n const nms = nmsTensor.arraySync();\n nmsTensor.dispose();\n const annotatedBoxes: Array<{ box: { startPoint: Tensor, endPoint: Tensor }, landmarks: Tensor, anchor: number[], confidence: number }> = [];\n for (let i = 0; i < nms.length; i++) {\n const confidence = scores[nms[i]];\n if (confidence > this.config.face.detector.minConfidence) {\n const boundingBox = tf.slice(boxes, [nms[i], 0], [1, -1]);\n const localBox = box.createBox(boundingBox);\n boundingBox.dispose();\n const anchor = this.anchorsData[nms[i]];\n const landmarks = tf.tidy(() => tf.slice(batch, [nms[i], keypointsCount - 1], [1, -1]).squeeze().reshape([keypointsCount, -1]));\n annotatedBoxes.push({ box: localBox, landmarks, anchor, confidence });\n }\n }\n // boundingBoxes.forEach((t) => t.dispose());\n batch.dispose();\n boxes.dispose();\n // scores.dispose();\n return {\n boxes: annotatedBoxes,\n scaleFactor: [inputImage.shape[2] / this.inputSize, inputImage.shape[1] / this.inputSize],\n };\n }\n}\n\nexport async function load(config: Config) {\n const model = await tf.loadGraphModel(join(config.modelBasePath, config.face.detector.modelPath), { fromTFHub: config.face.detector.modelPath.includes('tfhub.dev') });\n const blazeFace = new BlazeFaceModel(model, config);\n if (!model || !model.modelUrl) log('load model failed:', config.face.detector.modelPath);\n else if (config.debug) log('load model:', model.modelUrl);\n return blazeFace;\n}\n", "export const MESH_ANNOTATIONS = {\n silhouette: [\n 10, 338, 297, 332, 284, 251, 389, 356, 454, 323, 361, 288,\n 397, 365, 379, 378, 400, 377, 152, 148, 176, 149, 150, 136,\n 172, 58, 132, 93, 234, 127, 162, 21, 54, 103, 67, 109,\n ],\n lipsUpperOuter: [61, 185, 40, 39, 37, 0, 267, 269, 270, 409, 291],\n lipsLowerOuter: [146, 91, 181, 84, 17, 314, 405, 321, 375, 291],\n lipsUpperInner: [78, 191, 80, 81, 82, 13, 312, 311, 310, 415, 308],\n lipsLowerInner: [78, 95, 88, 178, 87, 14, 317, 402, 318, 324, 308],\n rightEyeUpper0: [246, 161, 160, 159, 158, 157, 173],\n rightEyeLower0: [33, 7, 163, 144, 145, 153, 154, 155, 133],\n rightEyeUpper1: [247, 30, 29, 27, 28, 56, 190],\n rightEyeLower1: [130, 25, 110, 24, 23, 22, 26, 112, 243],\n rightEyeUpper2: [113, 225, 224, 223, 222, 221, 189],\n rightEyeLower2: [226, 31, 228, 229, 230, 231, 232, 233, 244],\n rightEyeLower3: [143, 111, 117, 118, 119, 120, 121, 128, 245],\n rightEyebrowUpper: [156, 70, 63, 105, 66, 107, 55, 193],\n rightEyebrowLower: [35, 124, 46, 53, 52, 65],\n rightEyeIris: [473, 474, 475, 476, 477],\n leftEyeUpper0: [466, 388, 387, 386, 385, 384, 398],\n leftEyeLower0: [263, 249, 390, 373, 374, 380, 381, 382, 362],\n leftEyeUpper1: [467, 260, 259, 257, 258, 286, 414],\n leftEyeLower1: [359, 255, 339, 254, 253, 252, 256, 341, 463],\n leftEyeUpper2: [342, 445, 444, 443, 442, 441, 413],\n leftEyeLower2: [446, 261, 448, 449, 450, 451, 452, 453, 464],\n leftEyeLower3: [372, 340, 346, 347, 348, 349, 350, 357, 465],\n leftEyebrowUpper: [383, 300, 293, 334, 296, 336, 285, 417],\n leftEyebrowLower: [265, 353, 276, 283, 282, 295],\n leftEyeIris: [468, 469, 470, 471, 472],\n midwayBetweenEyes: [168],\n noseTip: [1],\n noseBottom: [2],\n noseRightCorner: [98],\n noseLeftCorner: [327],\n rightCheek: [205],\n leftCheek: [425],\n};\n\nexport const MESH_TO_IRIS_INDICES_MAP = [ // A mapping from facemesh model keypoints to iris model keypoints.\n { key: 'EyeUpper0', indices: [9, 10, 11, 12, 13, 14, 15] },\n { key: 'EyeUpper1', indices: [25, 26, 27, 28, 29, 30, 31] },\n { key: 'EyeUpper2', indices: [41, 42, 43, 44, 45, 46, 47] },\n { key: 'EyeLower0', indices: [0, 1, 2, 3, 4, 5, 6, 7, 8] },\n { key: 'EyeLower1', indices: [16, 17, 18, 19, 20, 21, 22, 23, 24] },\n { key: 'EyeLower2', indices: [32, 33, 34, 35, 36, 37, 38, 39, 40] },\n { key: 'EyeLower3', indices: [54, 55, 56, 57, 58, 59, 60, 61, 62] },\n // { key: 'EyebrowUpper', indices: [63, 64, 65, 66, 67, 68, 69, 70] },\n // { key: 'EyebrowLower', indices: [48, 49, 50, 51, 52, 53] },\n];\n\nexport const UV468 = [\n [0.499976992607117, 0.652534008026123],\n [0.500025987625122, 0.547487020492554],\n [0.499974012374878, 0.602371990680695],\n [0.482113003730774, 0.471979022026062],\n [0.500150978565216, 0.527155995368958],\n [0.499909996986389, 0.498252987861633],\n [0.499523013830185, 0.40106201171875],\n [0.289712011814117, 0.380764007568359],\n [0.499954998493195, 0.312398016452789],\n [0.499987006187439, 0.269918978214264],\n [0.500023007392883, 0.107050001621246],\n [0.500023007392883, 0.666234016418457],\n [0.5000159740448, 0.679224014282227],\n [0.500023007392883, 0.692348003387451],\n [0.499976992607117, 0.695277988910675],\n [0.499976992607117, 0.70593398809433],\n [0.499976992607117, 0.719385027885437],\n [0.499976992607117, 0.737019002437592],\n [0.499967992305756, 0.781370997428894],\n [0.499816000461578, 0.562981009483337],\n [0.473773002624512, 0.573909997940063],\n [0.104906998574734, 0.254140973091125],\n [0.365929991006851, 0.409575998783112],\n [0.338757991790771, 0.41302502155304],\n [0.311120003461838, 0.409460008144379],\n [0.274657994508743, 0.389131009578705],\n [0.393361985683441, 0.403706014156342],\n [0.345234006643295, 0.344011008739471],\n [0.370094001293182, 0.346076011657715],\n [0.319321990013123, 0.347265005111694],\n [0.297903001308441, 0.353591024875641],\n [0.24779200553894, 0.410809993743896],\n [0.396889001131058, 0.842755019664764],\n [0.280097991228104, 0.375599980354309],\n [0.106310002505779, 0.399955987930298],\n [0.2099249958992, 0.391353011131287],\n [0.355807989835739, 0.534406006336212],\n [0.471751004457474, 0.65040397644043],\n [0.474155008792877, 0.680191993713379],\n [0.439785003662109, 0.657229006290436],\n [0.414617002010345, 0.66654098033905],\n [0.450374007225037, 0.680860996246338],\n [0.428770989179611, 0.682690978050232],\n [0.374971002340317, 0.727805018424988],\n [0.486716985702515, 0.547628998756409],\n [0.485300987958908, 0.527395009994507],\n [0.257764995098114, 0.314490020275116],\n [0.401223003864288, 0.455172002315521],\n [0.429818987846375, 0.548614978790283],\n [0.421351999044418, 0.533740997314453],\n [0.276895999908447, 0.532056987285614],\n [0.483370006084442, 0.499586999416351],\n [0.33721199631691, 0.282882988452911],\n [0.296391993761063, 0.293242990970612],\n [0.169294998049736, 0.193813979625702],\n [0.447580009698868, 0.302609980106354],\n [0.392390012741089, 0.353887975215912],\n [0.354490011930466, 0.696784019470215],\n [0.067304998636246, 0.730105042457581],\n [0.442739009857178, 0.572826027870178],\n [0.457098007202148, 0.584792017936707],\n [0.381974011659622, 0.694710969924927],\n [0.392388999462128, 0.694203019142151],\n [0.277076005935669, 0.271932005882263],\n [0.422551989555359, 0.563233017921448],\n [0.385919004678726, 0.281364023685455],\n [0.383103013038635, 0.255840003490448],\n [0.331431001424789, 0.119714021682739],\n [0.229923993349075, 0.232002973556519],\n [0.364500999450684, 0.189113974571228],\n [0.229622006416321, 0.299540996551514],\n [0.173287004232407, 0.278747975826263],\n [0.472878992557526, 0.666198015213013],\n [0.446828007698059, 0.668527007102966],\n [0.422762006521225, 0.673889994621277],\n [0.445307999849319, 0.580065965652466],\n [0.388103008270264, 0.693961024284363],\n [0.403039008378983, 0.706539988517761],\n [0.403629004955292, 0.693953037261963],\n [0.460041999816895, 0.557139039039612],\n [0.431158006191254, 0.692366003990173],\n [0.452181994915009, 0.692366003990173],\n [0.475387006998062, 0.692366003990173],\n [0.465828001499176, 0.779190003871918],\n [0.472328990697861, 0.736225962638855],\n [0.473087012767792, 0.717857003211975],\n [0.473122000694275, 0.704625964164734],\n [0.473033010959625, 0.695277988910675],\n [0.427942007780075, 0.695277988910675],\n [0.426479011774063, 0.703539967536926],\n [0.423162013292313, 0.711845993995667],\n [0.4183090031147, 0.720062971115112],\n [0.390094995498657, 0.639572978019714],\n [0.013953999616206, 0.560034036636353],\n [0.499913990497589, 0.58014702796936],\n [0.413199990987778, 0.69539999961853],\n [0.409626007080078, 0.701822996139526],\n [0.468080013990402, 0.601534962654114],\n [0.422728985548019, 0.585985004901886],\n [0.463079988956451, 0.593783974647522],\n [0.37211999297142, 0.47341400384903],\n [0.334562003612518, 0.496073007583618],\n [0.411671012639999, 0.546965003013611],\n [0.242175996303558, 0.14767599105835],\n [0.290776997804642, 0.201445996761322],\n [0.327338010072708, 0.256527006626129],\n [0.399509996175766, 0.748921036720276],\n [0.441727995872498, 0.261676013469696],\n [0.429764986038208, 0.187834024429321],\n [0.412198007106781, 0.108901023864746],\n [0.288955003023148, 0.398952007293701],\n [0.218936994671822, 0.435410976409912],\n [0.41278201341629, 0.398970007896423],\n [0.257135003805161, 0.355440020561218],\n [0.427684992551804, 0.437960982322693],\n [0.448339998722076, 0.536936044692993],\n [0.178560003638268, 0.45755398273468],\n [0.247308000922203, 0.457193970680237],\n [0.286267012357712, 0.467674970626831],\n [0.332827985286713, 0.460712015628815],\n [0.368755996227264, 0.447206974029541],\n [0.398963987827301, 0.432654976844788],\n [0.476410001516342, 0.405806005001068],\n [0.189241006970406, 0.523923993110657],\n [0.228962004184723, 0.348950982093811],\n [0.490725994110107, 0.562400996685028],\n [0.404670000076294, 0.485132992267609],\n [0.019469000399113, 0.401564002037048],\n [0.426243007183075, 0.420431017875671],\n [0.396993011236191, 0.548797011375427],\n [0.266469985246658, 0.376977026462555],\n [0.439121007919312, 0.51895797252655],\n [0.032313998788595, 0.644356966018677],\n [0.419054001569748, 0.387154996395111],\n [0.462783008813858, 0.505746960639954],\n [0.238978996872902, 0.779744982719421],\n [0.198220998048782, 0.831938028335571],\n [0.107550002634525, 0.540755033493042],\n [0.183610007166862, 0.740257024765015],\n [0.134409993886948, 0.333683013916016],\n [0.385764002799988, 0.883153975009918],\n [0.490967005491257, 0.579378008842468],\n [0.382384985685349, 0.508572995662689],\n [0.174399003386497, 0.397670984268188],\n [0.318785011768341, 0.39623498916626],\n [0.343364000320435, 0.400596976280212],\n [0.396100014448166, 0.710216999053955],\n [0.187885001301765, 0.588537991046906],\n [0.430987000465393, 0.944064974784851],\n [0.318993002176285, 0.898285031318665],\n [0.266247987747192, 0.869701027870178],\n [0.500023007392883, 0.190576016902924],\n [0.499976992607117, 0.954452991485596],\n [0.366169989109039, 0.398822009563446],\n [0.393207013607025, 0.39553701877594],\n [0.410373002290726, 0.391080021858215],\n [0.194993004202843, 0.342101991176605],\n [0.388664990663528, 0.362284004688263],\n [0.365961998701096, 0.355970978736877],\n [0.343364000320435, 0.355356991291046],\n [0.318785011768341, 0.35834002494812],\n [0.301414996385574, 0.363156020641327],\n [0.058132998645306, 0.319076001644135],\n [0.301414996385574, 0.387449026107788],\n [0.499987989664078, 0.618434011936188],\n [0.415838003158569, 0.624195992946625],\n [0.445681989192963, 0.566076993942261],\n [0.465844005346298, 0.620640993118286],\n [0.49992299079895, 0.351523995399475],\n [0.288718998432159, 0.819945991039276],\n [0.335278987884521, 0.852819979190826],\n [0.440512001514435, 0.902418971061707],\n [0.128294005990028, 0.791940987110138],\n [0.408771991729736, 0.373893976211548],\n [0.455606997013092, 0.451801002025604],\n [0.499877005815506, 0.908990025520325],\n [0.375436991453171, 0.924192011356354],\n [0.11421000212431, 0.615022003650665],\n [0.448662012815475, 0.695277988910675],\n [0.4480200111866, 0.704632043838501],\n [0.447111994028091, 0.715808033943176],\n [0.444831997156143, 0.730794012546539],\n [0.430011987686157, 0.766808986663818],\n [0.406787008047104, 0.685672998428345],\n [0.400738000869751, 0.681069016456604],\n [0.392399996519089, 0.677703022956848],\n [0.367855995893478, 0.663918972015381],\n [0.247923001646996, 0.601333022117615],\n [0.452769994735718, 0.420849978923798],\n [0.43639200925827, 0.359887003898621],\n [0.416164010763168, 0.368713974952698],\n [0.413385987281799, 0.692366003990173],\n [0.228018000721931, 0.683571994304657],\n [0.468268007040024, 0.352671027183533],\n [0.411361992359161, 0.804327011108398],\n [0.499989002943039, 0.469825029373169],\n [0.479153990745544, 0.442654013633728],\n [0.499974012374878, 0.439637005329132],\n [0.432112008333206, 0.493588984012604],\n [0.499886006116867, 0.866917014122009],\n [0.49991300702095, 0.821729004383087],\n [0.456548988819122, 0.819200992584229],\n [0.344549000263214, 0.745438992977142],\n [0.37890899181366, 0.574010014533997],\n [0.374292999505997, 0.780184984207153],\n [0.319687992334366, 0.570737957954407],\n [0.357154995203018, 0.604269981384277],\n [0.295284003019333, 0.621580958366394],\n [0.447750002145767, 0.862477004528046],\n [0.410986006259918, 0.508723020553589],\n [0.31395098567009, 0.775308012962341],\n [0.354128003120422, 0.812552988529205],\n [0.324548006057739, 0.703992962837219],\n [0.189096003770828, 0.646299958229065],\n [0.279776990413666, 0.71465802192688],\n [0.1338230073452, 0.682700991630554],\n [0.336768001317978, 0.644733011722565],\n [0.429883986711502, 0.466521978378296],\n [0.455527991056442, 0.548622965812683],\n [0.437114000320435, 0.558896005153656],\n [0.467287987470627, 0.529924988746643],\n [0.414712011814117, 0.335219979286194],\n [0.37704598903656, 0.322777986526489],\n [0.344107985496521, 0.320150971412659],\n [0.312875986099243, 0.32233202457428],\n [0.283526003360748, 0.333190023899078],\n [0.241245999932289, 0.382785975933075],\n [0.102986000478268, 0.468762993812561],\n [0.267612010240555, 0.424560010433197],\n [0.297879010438919, 0.433175981044769],\n [0.333433985710144, 0.433878004550934],\n [0.366427004337311, 0.426115989685059],\n [0.396012008190155, 0.416696012020111],\n [0.420121014118195, 0.41022801399231],\n [0.007561000064015, 0.480777025222778],\n [0.432949006557465, 0.569517970085144],\n [0.458638995885849, 0.479089021682739],\n [0.473466008901596, 0.545744001865387],\n [0.476087987422943, 0.563830018043518],\n [0.468472003936768, 0.555056989192963],\n [0.433990985155106, 0.582361996173859],\n [0.483518004417419, 0.562983989715576],\n [0.482482999563217, 0.57784903049469],\n [0.42645001411438, 0.389798998832703],\n [0.438998997211456, 0.39649498462677],\n [0.450067013502121, 0.400434017181396],\n [0.289712011814117, 0.368252992630005],\n [0.276670008897781, 0.363372981548309],\n [0.517862021923065, 0.471948027610779],\n [0.710287988185883, 0.380764007568359],\n [0.526226997375488, 0.573909997940063],\n [0.895093023777008, 0.254140973091125],\n [0.634069979190826, 0.409575998783112],\n [0.661242008209229, 0.41302502155304],\n [0.688880026340485, 0.409460008144379],\n [0.725341975688934, 0.389131009578705],\n [0.606630027294159, 0.40370500087738],\n [0.654766023159027, 0.344011008739471],\n [0.629905998706818, 0.346076011657715],\n [0.680678009986877, 0.347265005111694],\n [0.702096998691559, 0.353591024875641],\n [0.75221198797226, 0.410804986953735],\n [0.602918028831482, 0.842862963676453],\n [0.719901978969574, 0.375599980354309],\n [0.893692970275879, 0.399959981441498],\n [0.790081977844238, 0.391354024410248],\n [0.643998026847839, 0.534487962722778],\n [0.528249025344849, 0.65040397644043],\n [0.525849997997284, 0.680191040039062],\n [0.560214996337891, 0.657229006290436],\n [0.585384011268616, 0.66654098033905],\n [0.549625992774963, 0.680860996246338],\n [0.57122802734375, 0.682691991329193],\n [0.624852001667023, 0.72809898853302],\n [0.513050019741058, 0.547281980514526],\n [0.51509702205658, 0.527251958847046],\n [0.742246985435486, 0.314507007598877],\n [0.598631024360657, 0.454979002475739],\n [0.570338010787964, 0.548575043678284],\n [0.578631997108459, 0.533622980117798],\n [0.723087012767792, 0.532054007053375],\n [0.516445994377136, 0.499638974666595],\n [0.662801027297974, 0.282917976379395],\n [0.70362401008606, 0.293271005153656],\n [0.830704987049103, 0.193813979625702],\n [0.552385985851288, 0.302568018436432],\n [0.607609987258911, 0.353887975215912],\n [0.645429015159607, 0.696707010269165],\n [0.932694971561432, 0.730105042457581],\n [0.557260990142822, 0.572826027870178],\n [0.542901992797852, 0.584792017936707],\n [0.6180260181427, 0.694710969924927],\n [0.607590973377228, 0.694203019142151],\n [0.722943007946014, 0.271963000297546],\n [0.577413976192474, 0.563166975975037],\n [0.614082992076874, 0.281386971473694],\n [0.616907000541687, 0.255886018276215],\n [0.668509006500244, 0.119913995265961],\n [0.770092010498047, 0.232020974159241],\n [0.635536015033722, 0.189248979091644],\n [0.77039098739624, 0.299556016921997],\n [0.826722025871277, 0.278755009174347],\n [0.527121007442474, 0.666198015213013],\n [0.553171992301941, 0.668527007102966],\n [0.577238023281097, 0.673889994621277],\n [0.554691970348358, 0.580065965652466],\n [0.611896991729736, 0.693961024284363],\n [0.59696102142334, 0.706539988517761],\n [0.596370995044708, 0.693953037261963],\n [0.539958000183105, 0.557139039039612],\n [0.568841993808746, 0.692366003990173],\n [0.547818005084991, 0.692366003990173],\n [0.52461302280426, 0.692366003990173],\n [0.534089982509613, 0.779141008853912],\n [0.527670979499817, 0.736225962638855],\n [0.526912987232208, 0.717857003211975],\n [0.526877999305725, 0.704625964164734],\n [0.526966989040375, 0.695277988910675],\n [0.572058022022247, 0.695277988910675],\n [0.573521018028259, 0.703539967536926],\n [0.57683801651001, 0.711845993995667],\n [0.581691026687622, 0.720062971115112],\n [0.609944999217987, 0.639909982681274],\n [0.986046016216278, 0.560034036636353],\n [0.5867999792099, 0.69539999961853],\n [0.590372025966644, 0.701822996139526],\n [0.531915009021759, 0.601536989212036],\n [0.577268004417419, 0.585934996604919],\n [0.536915004253387, 0.593786001205444],\n [0.627542972564697, 0.473352015018463],\n [0.665585994720459, 0.495950996875763],\n [0.588353991508484, 0.546862006187439],\n [0.757824003696442, 0.14767599105835],\n [0.709249973297119, 0.201507985591888],\n [0.672684013843536, 0.256581008434296],\n [0.600408971309662, 0.74900496006012],\n [0.55826598405838, 0.261672019958496],\n [0.570303976535797, 0.187870979309082],\n [0.588165998458862, 0.109044015407562],\n [0.711045026779175, 0.398952007293701],\n [0.781069993972778, 0.435405015945435],\n [0.587247014045715, 0.398931980133057],\n [0.742869973182678, 0.355445981025696],\n [0.572156012058258, 0.437651991844177],\n [0.55186802148819, 0.536570012569427],\n [0.821442008018494, 0.457556009292603],\n [0.752701997756958, 0.457181990146637],\n [0.71375697851181, 0.467626988887787],\n [0.66711300611496, 0.460672974586487],\n [0.631101012229919, 0.447153985500336],\n [0.6008620262146, 0.432473003864288],\n [0.523481011390686, 0.405627012252808],\n [0.810747981071472, 0.523926019668579],\n [0.771045982837677, 0.348959028720856],\n [0.509127020835876, 0.562718033790588],\n [0.595292985439301, 0.485023975372314],\n [0.980530977249146, 0.401564002037048],\n [0.573499977588654, 0.420000016689301],\n [0.602994978427887, 0.548687994480133],\n [0.733529984951019, 0.376977026462555],\n [0.560611009597778, 0.519016981124878],\n [0.967685997486115, 0.644356966018677],\n [0.580985009670258, 0.387160003185272],\n [0.537728011608124, 0.505385041236877],\n [0.760966002941132, 0.779752969741821],\n [0.801778972148895, 0.831938028335571],\n [0.892440974712372, 0.54076099395752],\n [0.816350996494293, 0.740260004997253],\n [0.865594983100891, 0.333687007427216],\n [0.614073991775513, 0.883246004581451],\n [0.508952975273132, 0.579437971115112],\n [0.617941975593567, 0.508316040039062],\n [0.825608015060425, 0.397674977779388],\n [0.681214988231659, 0.39623498916626],\n [0.656635999679565, 0.400596976280212],\n [0.603900015354156, 0.710216999053955],\n [0.81208598613739, 0.588539004325867],\n [0.56801301240921, 0.944564998149872],\n [0.681007981300354, 0.898285031318665],\n [0.733752012252808, 0.869701027870178],\n [0.633830010890961, 0.398822009563446],\n [0.606792986392975, 0.39553701877594],\n [0.589659988880157, 0.391062021255493],\n [0.805015981197357, 0.342108011245728],\n [0.611334979534149, 0.362284004688263],\n [0.634037971496582, 0.355970978736877],\n [0.656635999679565, 0.355356991291046],\n [0.681214988231659, 0.35834002494812],\n [0.698584973812103, 0.363156020641327],\n [0.941866993904114, 0.319076001644135],\n [0.698584973812103, 0.387449026107788],\n [0.584177017211914, 0.624107003211975],\n [0.554318010807037, 0.566076993942261],\n [0.534153997898102, 0.62064003944397],\n [0.711217999458313, 0.819975018501282],\n [0.664629995822906, 0.852871000766754],\n [0.559099972248077, 0.902631998062134],\n [0.871706008911133, 0.791940987110138],\n [0.591234028339386, 0.373893976211548],\n [0.544341027736664, 0.451583981513977],\n [0.624562978744507, 0.924192011356354],\n [0.88577002286911, 0.615028977394104],\n [0.551338016986847, 0.695277988910675],\n [0.551980018615723, 0.704632043838501],\n [0.552887976169586, 0.715808033943176],\n [0.555167973041534, 0.730794012546539],\n [0.569944024085999, 0.767035007476807],\n [0.593203008174896, 0.685675978660583],\n [0.599261999130249, 0.681069016456604],\n [0.607599973678589, 0.677703022956848],\n [0.631937980651855, 0.663500010967255],\n [0.752032995223999, 0.601315021514893],\n [0.547226011753082, 0.420395016670227],\n [0.563543975353241, 0.359827995300293],\n [0.583841025829315, 0.368713974952698],\n [0.586614012718201, 0.692366003990173],\n [0.771915018558502, 0.683578014373779],\n [0.531597018241882, 0.352482974529266],\n [0.588370978832245, 0.804440975189209],\n [0.52079701423645, 0.442565023899078],\n [0.567984998226166, 0.493479013442993],\n [0.543282985687256, 0.819254994392395],\n [0.655317008495331, 0.745514988899231],\n [0.621008992195129, 0.574018001556396],\n [0.625559985637665, 0.78031200170517],\n [0.680198013782501, 0.570719003677368],\n [0.64276397228241, 0.604337990283966],\n [0.704662978649139, 0.621529996395111],\n [0.552012026309967, 0.862591981887817],\n [0.589071989059448, 0.508637011051178],\n [0.685944974422455, 0.775357007980347],\n [0.645735025405884, 0.812640011310577],\n [0.675342977046967, 0.703978002071381],\n [0.810858011245728, 0.646304965019226],\n [0.72012197971344, 0.714666962623596],\n [0.866151988506317, 0.682704985141754],\n [0.663187026977539, 0.644596993923187],\n [0.570082008838654, 0.466325998306274],\n [0.544561982154846, 0.548375964164734],\n [0.562758982181549, 0.558784961700439],\n [0.531987011432648, 0.530140042304993],\n [0.585271000862122, 0.335177004337311],\n [0.622952997684479, 0.32277899980545],\n [0.655896008014679, 0.320163011550903],\n [0.687132000923157, 0.322345972061157],\n [0.716481983661652, 0.333200991153717],\n [0.758756995201111, 0.382786989212036],\n [0.897013008594513, 0.468769013881683],\n [0.732392013072968, 0.424547016620636],\n [0.70211398601532, 0.433162987232208],\n [0.66652500629425, 0.433866024017334],\n [0.633504986763, 0.426087975502014],\n [0.603875994682312, 0.416586995124817],\n [0.579657971858978, 0.409945011138916],\n [0.992439985275269, 0.480777025222778],\n [0.567192018032074, 0.569419980049133],\n [0.54136598110199, 0.478899002075195],\n [0.526564002037048, 0.546118021011353],\n [0.523913025856018, 0.563830018043518],\n [0.531529009342194, 0.555056989192963],\n [0.566035985946655, 0.582329034805298],\n [0.51631098985672, 0.563053965568542],\n [0.5174720287323, 0.577877044677734],\n [0.573594987392426, 0.389806985855103],\n [0.560697972774506, 0.395331978797913],\n [0.549755990505219, 0.399751007556915],\n [0.710287988185883, 0.368252992630005],\n [0.723330020904541, 0.363372981548309],\n];\n\nexport const TRI468 = [\n 127, 34, 139, 11, 0, 37, 232, 231, 120, 72, 37, 39, 128, 121, 47, 232, 121, 128, 104, 69, 67, 175, 171, 148, 157, 154, 155, 118, 50, 101, 73, 39, 40, 9,\n 151, 108, 48, 115, 131, 194, 204, 211, 74, 40, 185, 80, 42, 183, 40, 92, 186, 230, 229, 118, 202, 212, 214, 83, 18, 17, 76, 61, 146, 160, 29, 30, 56,\n 157, 173, 106, 204, 194, 135, 214, 192, 203, 165, 98, 21, 71, 68, 51, 45, 4, 144, 24, 23, 77, 146, 91, 205, 50, 187, 201, 200, 18, 91, 106, 182, 90, 91,\n 181, 85, 84, 17, 206, 203, 36, 148, 171, 140, 92, 40, 39, 193, 189, 244, 159, 158, 28, 247, 246, 161, 236, 3, 196, 54, 68, 104, 193, 168, 8, 117,\n 228, 31, 189, 193, 55, 98, 97, 99, 126, 47, 100, 166, 79, 218, 155, 154, 26, 209, 49, 131, 135, 136, 150, 47, 126, 217, 223, 52, 53, 45, 51, 134, 211,\n 170, 140, 67, 69, 108, 43, 106, 91, 230, 119, 120, 226, 130, 247, 63, 53, 52, 238, 20, 242, 46, 70, 156, 78, 62, 96, 46, 53, 63, 143, 34, 227, 173,\n 155, 133, 123, 117, 111, 44, 125, 19, 236, 134, 51, 216, 206, 205, 154, 153, 22, 39, 37, 167, 200, 201, 208, 36, 142, 100, 57, 212, 202, 20, 60, 99, 28,\n 158, 157, 35, 226, 113, 160, 159, 27, 204, 202, 210, 113, 225, 46, 43, 202, 204, 62, 76, 77, 137, 123, 116, 41, 38, 72, 203, 129, 142, 64, 98, 240, 49,\n 102, 64, 41, 73, 74, 212, 216, 207, 42, 74, 184, 169, 170, 211, 170, 149, 176, 105, 66, 69, 122, 6, 168, 123, 147, 187, 96, 77, 90, 65, 55, 107, 89,\n 90, 180, 101, 100, 120, 63, 105, 104, 93, 137, 227, 15, 86, 85, 129, 102, 49, 14, 87, 86, 55, 8, 9, 100, 47, 121, 145, 23, 22, 88, 89, 179, 6, 122,\n 196, 88, 95, 96, 138, 172, 136, 215, 58, 172, 115, 48, 219, 42, 80, 81, 195, 3, 51, 43, 146, 61, 171, 175, 199, 81, 82, 38, 53, 46, 225, 144, 163, 110,\n 246, 33, 7, 52, 65, 66, 229, 228, 117, 34, 127, 234, 107, 108, 69, 109, 108, 151, 48, 64, 235, 62, 78, 191, 129, 209, 126, 111, 35, 143, 163, 161, 246,\n 117, 123, 50, 222, 65, 52, 19, 125, 141, 221, 55, 65, 3, 195, 197, 25, 7, 33, 220, 237, 44, 70, 71, 139, 122, 193, 245, 247, 130, 33, 71, 21, 162,\n 153, 158, 159, 170, 169, 150, 188, 174, 196, 216, 186, 92, 144, 160, 161, 2, 97, 167, 141, 125, 241, 164, 167, 37, 72, 38, 12, 145, 159, 160, 38, 82, 13,\n 63, 68, 71, 226, 35, 111, 158, 153, 154, 101, 50, 205, 206, 92, 165, 209, 198, 217, 165, 167, 97, 220, 115, 218, 133, 112, 243, 239, 238, 241, 214,\n 135, 169, 190, 173, 133, 171, 208, 32, 125, 44, 237, 86, 87, 178, 85, 86, 179, 84, 85, 180, 83, 84, 181, 201, 83, 182, 137, 93, 132, 76, 62, 183, 61,\n 76, 184, 57, 61, 185, 212, 57, 186, 214, 207, 187, 34, 143, 156, 79, 239, 237, 123, 137, 177, 44, 1, 4, 201, 194, 32, 64, 102, 129, 213, 215, 138, 59,\n 166, 219, 242, 99, 97, 2, 94, 141, 75, 59, 235, 24, 110, 228, 25, 130, 226, 23, 24, 229, 22, 23, 230, 26, 22, 231, 112, 26, 232, 189, 190, 243, 221, 56,\n 190, 28, 56, 221, 27, 28, 222, 29, 27, 223, 30, 29, 224, 247, 30, 225, 238, 79, 20, 166, 59, 75, 60, 75, 240, 147, 177, 215, 20, 79, 166, 187, 147, 213,\n 112, 233, 244, 233, 128, 245, 128, 114, 188, 114, 217, 174, 131, 115, 220, 217, 198, 236, 198, 131, 134, 177, 132, 58, 143, 35, 124, 110, 163, 7, 228,\n 110, 25, 356, 389, 368, 11, 302, 267, 452, 350, 349, 302, 303, 269, 357, 343, 277, 452, 453, 357, 333, 332, 297, 175, 152, 377, 384, 398, 382, 347,\n 348, 330, 303, 304, 270, 9, 336, 337, 278, 279, 360, 418, 262, 431, 304, 408, 409, 310, 415, 407, 270, 409, 410, 450, 348, 347, 422, 430, 434, 313,\n 314, 17, 306, 307, 375, 387, 388, 260, 286, 414, 398, 335, 406, 418, 364, 367, 416, 423, 358, 327, 251, 284, 298, 281, 5, 4, 373, 374, 253, 307, 320,\n 321, 425, 427, 411, 421, 313, 18, 321, 405, 406, 320, 404, 405, 315, 16, 17, 426, 425, 266, 377, 400, 369, 322, 391, 269, 417, 465, 464, 386, 257, 258,\n 466, 260, 388, 456, 399, 419, 284, 332, 333, 417, 285, 8, 346, 340, 261, 413, 441, 285, 327, 460, 328, 355, 371, 329, 392, 439, 438, 382, 341, 256,\n 429, 420, 360, 364, 394, 379, 277, 343, 437, 443, 444, 283, 275, 440, 363, 431, 262, 369, 297, 338, 337, 273, 375, 321, 450, 451, 349, 446, 342, 467,\n 293, 334, 282, 458, 461, 462, 276, 353, 383, 308, 324, 325, 276, 300, 293, 372, 345, 447, 382, 398, 362, 352, 345, 340, 274, 1, 19, 456, 248, 281, 436,\n 427, 425, 381, 256, 252, 269, 391, 393, 200, 199, 428, 266, 330, 329, 287, 273, 422, 250, 462, 328, 258, 286, 384, 265, 353, 342, 387, 259, 257, 424,\n 431, 430, 342, 353, 276, 273, 335, 424, 292, 325, 307, 366, 447, 345, 271, 303, 302, 423, 266, 371, 294, 455, 460, 279, 278, 294, 271, 272, 304, 432,\n 434, 427, 272, 407, 408, 394, 430, 431, 395, 369, 400, 334, 333, 299, 351, 417, 168, 352, 280, 411, 325, 319, 320, 295, 296, 336, 319, 403, 404, 330,\n 348, 349, 293, 298, 333, 323, 454, 447, 15, 16, 315, 358, 429, 279, 14, 15, 316, 285, 336, 9, 329, 349, 350, 374, 380, 252, 318, 402, 403, 6, 197, 419,\n 318, 319, 325, 367, 364, 365, 435, 367, 397, 344, 438, 439, 272, 271, 311, 195, 5, 281, 273, 287, 291, 396, 428, 199, 311, 271, 268, 283, 444, 445,\n 373, 254, 339, 263, 466, 249, 282, 334, 296, 449, 347, 346, 264, 447, 454, 336, 296, 299, 338, 10, 151, 278, 439, 455, 292, 407, 415, 358, 371, 355,\n 340, 345, 372, 390, 249, 466, 346, 347, 280, 442, 443, 282, 19, 94, 370, 441, 442, 295, 248, 419, 197, 263, 255, 359, 440, 275, 274, 300, 383, 368,\n 351, 412, 465, 263, 467, 466, 301, 368, 389, 380, 374, 386, 395, 378, 379, 412, 351, 419, 436, 426, 322, 373, 390, 388, 2, 164, 393, 370, 462, 461,\n 164, 0, 267, 302, 11, 12, 374, 373, 387, 268, 12, 13, 293, 300, 301, 446, 261, 340, 385, 384, 381, 330, 266, 425, 426, 423, 391, 429, 355, 437, 391,\n 327, 326, 440, 457, 438, 341, 382, 362, 459, 457, 461, 434, 430, 394, 414, 463, 362, 396, 369, 262, 354, 461, 457, 316, 403, 402, 315, 404, 403, 314,\n 405, 404, 313, 406, 405, 421, 418, 406, 366, 401, 361, 306, 408, 407, 291, 409, 408, 287, 410, 409, 432, 436, 410, 434, 416, 411, 264, 368, 383, 309,\n 438, 457, 352, 376, 401, 274, 275, 4, 421, 428, 262, 294, 327, 358, 433, 416, 367, 289, 455, 439, 462, 370, 326, 2, 326, 370, 305, 460, 455, 254,\n 449, 448, 255, 261, 446, 253, 450, 449, 252, 451, 450, 256, 452, 451, 341, 453, 452, 413, 464, 463, 441, 413, 414, 258, 442, 441, 257, 443, 442, 259,\n 444, 443, 260, 445, 444, 467, 342, 445, 459, 458, 250, 289, 392, 290, 290, 328, 460, 376, 433, 435, 250, 290, 392, 411, 416, 433, 341, 463, 464, 453,\n 464, 465, 357, 465, 412, 343, 412, 399, 360, 363, 440, 437, 399, 456, 420, 456, 363, 401, 435, 288, 372, 383, 353, 339, 255, 249, 448, 261, 255, 133,\n 243, 190, 133, 155, 112, 33, 246, 247, 33, 130, 25, 398, 384, 286, 362, 398, 414, 362, 463, 341, 263, 359, 467, 263, 249, 255, 466, 467, 260, 75, 60,\n 166, 238, 239, 79, 162, 127, 139, 72, 11, 37, 121, 232, 120, 73, 72, 39, 114, 128, 47, 233, 232, 128, 103, 104, 67, 152, 175, 148, 173, 157, 155,\n 119, 118, 101, 74, 73, 40, 107, 9, 108, 49, 48, 131, 32, 194, 211, 184, 74, 185, 191, 80, 183, 185, 40, 186, 119, 230, 118, 210, 202, 214, 84, 83, 17,\n 77, 76, 146, 161, 160, 30, 190, 56, 173, 182, 106, 194, 138, 135, 192, 129, 203, 98, 54, 21, 68, 5, 51, 4, 145, 144, 23, 90, 77, 91, 207, 205, 187, 83,\n 201, 18, 181, 91, 182, 180, 90, 181, 16, 85, 17, 205, 206, 36, 176, 148, 140, 165, 92, 39, 245, 193, 244, 27, 159, 28, 30, 247, 161, 174, 236, 196,\n 103, 54, 104, 55, 193, 8, 111, 117, 31, 221, 189, 55, 240, 98, 99, 142, 126, 100, 219, 166, 218, 112, 155, 26, 198, 209, 131, 169, 135, 150, 114, 47,\n 217, 224, 223, 53, 220, 45, 134, 32, 211, 140, 109, 67, 108, 146, 43, 91, 231, 230, 120, 113, 226, 247, 105, 63, 52, 241, 238, 242, 124, 46, 156, 95,\n 78, 96, 70, 46, 63, 116, 143, 227, 116, 123, 111, 1, 44, 19, 3, 236, 51, 207, 216, 205, 26, 154, 22, 165, 39, 167, 199, 200, 208, 101, 36, 100, 43,\n 57, 202, 242, 20, 99, 56, 28, 157, 124, 35, 113, 29, 160, 27, 211, 204, 210, 124, 113, 46, 106, 43, 204, 96, 62, 77, 227, 137, 116, 73, 41, 72, 36, 203,\n 142, 235, 64, 240, 48, 49, 64, 42, 41, 74, 214, 212, 207, 183, 42, 184, 210, 169, 211, 140, 170, 176, 104, 105, 69, 193, 122, 168, 50, 123, 187, 89, 96,\n 90, 66, 65, 107, 179, 89, 180, 119, 101, 120, 68, 63, 104, 234, 93, 227, 16, 15, 85, 209, 129, 49, 15, 14, 86, 107, 55, 9, 120, 100, 121, 153, 145, 22,\n 178, 88, 179, 197, 6, 196, 89, 88, 96, 135, 138, 136, 138, 215, 172, 218, 115, 219, 41, 42, 81, 5, 195, 51, 57, 43, 61, 208, 171, 199, 41, 81, 38,\n 224, 53, 225, 24, 144, 110, 105, 52, 66, 118, 229, 117, 227, 34, 234, 66, 107, 69, 10, 109, 151, 219, 48, 235, 183, 62, 191, 142, 129, 126, 116, 111,\n 143, 7, 163, 246, 118, 117, 50, 223, 222, 52, 94, 19, 141, 222, 221, 65, 196, 3, 197, 45, 220, 44, 156, 70, 139, 188, 122, 245, 139, 71, 162, 145,\n 153, 159, 149, 170, 150, 122, 188, 196, 206, 216, 92, 163, 144, 161, 164, 2, 167, 242, 141, 241, 0, 164, 37, 11, 72, 12, 144, 145, 160, 12, 38, 13, 70,\n 63, 71, 31, 226, 111, 157, 158, 154, 36, 101, 205, 203, 206, 165, 126, 209, 217, 98, 165, 97, 237, 220, 218, 237, 239, 241, 210, 214, 169, 140, 171, 32,\n 241, 125, 237, 179, 86, 178, 180, 85, 179, 181, 84, 180, 182, 83, 181, 194, 201, 182, 177, 137, 132, 184, 76, 183, 185, 61, 184, 186, 57, 185, 216, 212,\n 186, 192, 214, 187, 139, 34, 156, 218, 79, 237, 147, 123, 177, 45, 44, 4, 208, 201, 32, 98, 64, 129, 192, 213, 138, 235, 59, 219, 141, 242, 97, 97, 2,\n 141, 240, 75, 235, 229, 24, 228, 31, 25, 226, 230, 23, 229, 231, 22, 230, 232, 26, 231, 233, 112, 232, 244, 189, 243, 189, 221, 190, 222, 28, 221,\n 223, 27, 222, 224, 29, 223, 225, 30, 224, 113, 247, 225, 99, 60, 240, 213, 147, 215, 60, 20, 166, 192, 187, 213, 243, 112, 244, 244, 233, 245, 245,\n 128, 188, 188, 114, 174, 134, 131, 220, 174, 217, 236, 236, 198, 134, 215, 177, 58, 156, 143, 124, 25, 110, 7, 31, 228, 25, 264, 356, 368, 0, 11, 267,\n 451, 452, 349, 267, 302, 269, 350, 357, 277, 350, 452, 357, 299, 333, 297, 396, 175, 377, 381, 384, 382, 280, 347, 330, 269, 303, 270, 151, 9, 337,\n 344, 278, 360, 424, 418, 431, 270, 304, 409, 272, 310, 407, 322, 270, 410, 449, 450, 347, 432, 422, 434, 18, 313, 17, 291, 306, 375, 259, 387, 260,\n 424, 335, 418, 434, 364, 416, 391, 423, 327, 301, 251, 298, 275, 281, 4, 254, 373, 253, 375, 307, 321, 280, 425, 411, 200, 421, 18, 335, 321, 406,\n 321, 320, 405, 314, 315, 17, 423, 426, 266, 396, 377, 369, 270, 322, 269, 413, 417, 464, 385, 386, 258, 248, 456, 419, 298, 284, 333, 168, 417, 8,\n 448, 346, 261, 417, 413, 285, 326, 327, 328, 277, 355, 329, 309, 392, 438, 381, 382, 256, 279, 429, 360, 365, 364, 379, 355, 277, 437, 282, 443, 283,\n 281, 275, 363, 395, 431, 369, 299, 297, 337, 335, 273, 321, 348, 450, 349, 359, 446, 467, 283, 293, 282, 250, 458, 462, 300, 276, 383, 292, 308, 325,\n 283, 276, 293, 264, 372, 447, 346, 352, 340, 354, 274, 19, 363, 456, 281, 426, 436, 425, 380, 381, 252, 267, 269, 393, 421, 200, 428, 371, 266, 329,\n 432, 287, 422, 290, 250, 328, 385, 258, 384, 446, 265, 342, 386, 387, 257, 422, 424, 430, 445, 342, 276, 422, 273, 424, 306, 292, 307, 352, 366, 345,\n 268, 271, 302, 358, 423, 371, 327, 294, 460, 331, 279, 294, 303, 271, 304, 436, 432, 427, 304, 272, 408, 395, 394, 431, 378, 395, 400, 296, 334, 299,\n 6, 351, 168, 376, 352, 411, 307, 325, 320, 285, 295, 336, 320, 319, 404, 329, 330, 349, 334, 293, 333, 366, 323, 447, 316, 15, 315, 331, 358, 279,\n 317, 14, 316, 8, 285, 9, 277, 329, 350, 253, 374, 252, 319, 318, 403, 351, 6, 419, 324, 318, 325, 397, 367, 365, 288, 435, 397, 278, 344, 439, 310,\n 272, 311, 248, 195, 281, 375, 273, 291, 175, 396, 199, 312, 311, 268, 276, 283, 445, 390, 373, 339, 295, 282, 296, 448, 449, 346, 356, 264, 454, 337,\n 336, 299, 337, 338, 151, 294, 278, 455, 308, 292, 415, 429, 358, 355, 265, 340, 372, 388, 390, 466, 352, 346, 280, 295, 442, 282, 354, 19, 370, 285,\n 441, 295, 195, 248, 197, 457, 440, 274, 301, 300, 368, 417, 351, 465, 251, 301, 389, 385, 380, 386, 394, 395, 379, 399, 412, 419, 410, 436, 322, 387,\n 373, 388, 326, 2, 393, 354, 370, 461, 393, 164, 267, 268, 302, 12, 386, 374, 387, 312, 268, 13, 298, 293, 301, 265, 446, 340, 380, 385, 381, 280, 330,\n 425, 322, 426, 391, 420, 429, 437, 393, 391, 326, 344, 440, 438, 458, 459, 461, 364, 434, 394, 428, 396, 262, 274, 354, 457, 317, 316, 402, 316, 315,\n 403, 315, 314, 404, 314, 313, 405, 313, 421, 406, 323, 366, 361, 292, 306, 407, 306, 291, 408, 291, 287, 409, 287, 432, 410, 427, 434, 411, 372, 264,\n 383, 459, 309, 457, 366, 352, 401, 1, 274, 4, 418, 421, 262, 331, 294, 358, 435, 433, 367, 392, 289, 439, 328, 462, 326, 94, 2, 370, 289, 305, 455, 339,\n 254, 448, 359, 255, 446, 254, 253, 449, 253, 252, 450, 252, 256, 451, 256, 341, 452, 414, 413, 463, 286, 441, 414, 286, 258, 441, 258, 257, 442, 257,\n 259, 443, 259, 260, 444, 260, 467, 445, 309, 459, 250, 305, 289, 290, 305, 290, 460, 401, 376, 435, 309, 250, 392, 376, 411, 433, 453, 341, 464, 357,\n 453, 465, 343, 357, 412, 437, 343, 399, 344, 360, 440, 420, 437, 456, 360, 420, 363, 361, 401, 288, 265, 372, 353, 390, 339, 249, 339, 448, 255];\n\nexport const TRI68 = [0, 1, 36, 0, 36, 17, 1, 2, 41, 1, 41, 36, 2, 3, 31, 2, 31, 41, 3, 4, 48, 3, 48, 31, 4, 5, 48, 5, 6, 48, 6, 7, 59, 6, 59, 48, 7, 8, 58, 7, 58, 59,\n 8, 9, 56, 8, 56, 57, 8, 57, 58, 9, 10, 55, 9, 55, 56, 10, 11, 54, 10, 54, 55, 11, 12, 54, 12, 13, 54, 13, 14, 35, 13, 35, 54, 14, 15, 46, 14, 46, 35, 15, 16,\n 45, 15, 45, 46, 16, 26, 45, 17, 36, 18, 18, 37, 19, 18, 36, 37, 19, 38, 20, 19, 37, 38, 20, 39, 21, 20, 38, 39, 21, 39, 27, 22, 42, 23, 22, 27, 42, 23, 43, 24,\n 23, 42, 43, 24, 44, 25, 24, 43, 44, 25, 45, 26, 25, 44, 45, 27, 39, 28, 27, 28, 42, 28, 39, 29, 28, 29, 42, 29, 31, 30, 29, 30, 35, 29, 40, 31, 29, 35, 47, 29,\n 39, 40, 29, 47, 42, 30, 31, 32, 30, 32, 33, 30, 33, 34, 30, 34, 35, 31, 50, 32, 31, 40, 41, 31, 48, 49, 31, 49, 50, 32, 51, 33, 32, 50, 51, 33, 51, 34, 34, 52,\n 35, 34, 51, 52, 35, 46, 47, 35, 52, 53, 35, 53, 54, 36, 41, 37, 37, 40, 38, 37, 41, 40, 38, 40, 39, 42, 47, 43, 43, 47, 44, 44, 46, 45, 44, 47, 46, 48, 60, 49,\n 48, 59, 60, 49, 61, 50, 49, 60, 61, 50, 62, 51, 50, 61, 62, 51, 62, 52, 52, 63, 53, 52, 62, 63, 53, 64, 54, 53, 63, 64, 54, 64, 55, 55, 65, 56, 55, 64, 65, 56,\n 66, 57, 56, 65, 66, 57, 66, 58, 58, 67, 59, 58, 66, 67, 59, 67, 60, 60, 67, 61, 61, 66, 62, 61, 67, 66, 62, 66, 63, 63, 65, 64, 63, 66, 65, 21, 27, 22];\n\nexport const TRI33 = [\n /* eyes */ 0, 8, 7, 7, 8, 1, 2, 10, 9, 9, 10, 3,\n /* brows */ 17, 0, 18, 18, 0, 7, 18, 7, 19, 19, 7, 1, 19, 1, 11, 19, 11, 20, 21, 3, 22, 21, 9, 3, 20, 9, 21, 20, 2, 9, 20, 11, 2,\n /* 4head */ 23, 17, 18, 25, 21, 22, 24, 19, 20, 24, 18, 19, 24, 20, 21, 24, 23, 18, 24, 21, 25,\n /* nose */ 11, 12, 4, 11, 4, 13, 1, 12, 11, 11, 13, 2, 12, 14, 4, 4, 14, 13,\n /* up-lip */ 14, 5, 15, 14, 15, 6, 12, 5, 14, 14, 6, 13,\n /* cheeks */ 8, 12, 1, 2, 13, 10, 8, 26, 12, 10, 13, 27, 26, 5, 12, 13, 6, 27, 0, 26, 8, 10, 27, 3,\n /* chin */ 5, 32, 16, 16, 32, 6, 5, 30, 32, 6, 32, 31,\n /* cont */ 26, 30, 5, 27, 6, 31, 0, 28, 26, 3, 27, 29, 17, 28, 0, 3, 29, 22, 23, 28, 17, 22, 29, 25, 28, 30, 26, 27, 31, 29,\n];\n\nexport const TRI7 = [0, 4, 1, 2, 4, 3, 4, 5, 6];\n\nexport const VTX68 = [\n /* cont */ 127, 234, 132, 58, 172, 150, 149, 148, 152, 377, 378, 379, 397, 288, 361, 454, 356,\n /* brows */ 70, 63, 105, 66, 107, 336, 296, 334, 293, 300,\n /* nose */ 168, 6, 195, 4, 98, 97, 2, 326, 327,\n /* eyes */ 33, 160, 158, 133, 153, 144, 362, 385, 387, 263, 373, 380,\n /* lip */ 57, 40, 37, 0, 267, 270, 287, 321, 314, 17, 84, 91,\n /* mouth */ 78, 81, 13, 311, 308, 402, 14, 178,\n];\n\nexport const VTX33 = [33, 133, 362, 263, 1, 62, 308, 159, 145, 386, 374, 6, 102, 331, 2, 13, 14, 70, 105, 107, 336, 334, 300, 54, 10, 284, 50, 280, 234, 454, 58, 288, 152];\n\nexport const VTX7 = [33, 133, 362, 263, 1, 78, 308];\n\nexport const UV68 = VTX68.map((x) => UV468[x]);\n\nexport const UV33 = VTX33.map((x) => UV468[x]);\n\nexport const UV7 = VTX7.map((x) => UV468[x]);\n", "import * as tf from '../../dist/tfjs.esm.js';\nimport * as bounding from './box';\nimport * as util from './util';\nimport * as coords from './coords';\nimport { Tensor, GraphModel } from '../tfjs/types';\nimport { BlazeFaceModel } from './blazeface';\n\nconst leftOutline = coords.MESH_ANNOTATIONS['leftEyeLower0'];\nconst rightOutline = coords.MESH_ANNOTATIONS['rightEyeLower0'];\n\nconst eyeLandmarks = {\n leftBounds: [leftOutline[0], leftOutline[leftOutline.length - 1]],\n rightBounds: [rightOutline[0], rightOutline[rightOutline.length - 1]],\n};\n\nconst meshLandmarks = {\n count: 468,\n mouth: 13,\n symmetryLine: [13, coords.MESH_ANNOTATIONS['midwayBetweenEyes'][0]],\n};\n\nconst blazeFaceLandmarks = {\n leftEye: 0,\n rightEye: 1,\n nose: 2,\n mouth: 3,\n leftEar: 4,\n rightEar: 5,\n symmetryLine: [3, 2],\n};\n\nconst irisLandmarks = {\n upperCenter: 3,\n lowerCenter: 4,\n index: 71,\n numCoordinates: 76,\n};\n\n// Replace the raw coordinates returned by facemesh with refined iris model coordinates\n// Update the z coordinate to be an average of the original and the new.\nfunction replaceRawCoordinates(rawCoords, newCoords, prefix, keys) {\n for (let i = 0; i < coords.MESH_TO_IRIS_INDICES_MAP.length; i++) {\n const { key, indices } = coords.MESH_TO_IRIS_INDICES_MAP[i];\n const originalIndices = coords.MESH_ANNOTATIONS[`${prefix}${key}`];\n if (!keys || keys.includes(key)) {\n for (let j = 0; j < indices.length; j++) {\n const index = indices[j];\n rawCoords[originalIndices[j]] = [\n newCoords[index][0], newCoords[index][1],\n (newCoords[index][2] + rawCoords[originalIndices[j]][2]) / 2,\n ];\n }\n }\n }\n}\n// The Pipeline coordinates between the bounding box and skeleton models.\nexport class Pipeline {\n storedBoxes: Array<{ startPoint: number[], endPoint: number[], landmarks: Array, confidence: number, faceConfidence?: number }>;\n boundingBoxDetector: BlazeFaceModel; // tf.GraphModel\n meshDetector: GraphModel; // tf.GraphModel\n irisModel: GraphModel; // tf.GraphModel\n boxSize: number;\n meshSize: number;\n irisSize: number;\n irisEnlarge: number;\n skipped: number;\n detectedFaces: number;\n\n constructor(boundingBoxDetector, meshDetector, irisModel) {\n // An array of facial bounding boxes.\n this.storedBoxes = [];\n this.boundingBoxDetector = boundingBoxDetector;\n this.meshDetector = meshDetector;\n this.irisModel = irisModel;\n this.boxSize = boundingBoxDetector?.model?.inputs[0].shape[2] || 0;\n this.meshSize = meshDetector?.inputs[0].shape[2] || boundingBoxDetector?.model?.inputs[0].shape[2];\n this.irisSize = irisModel?.inputs[0].shape[1] || 0;\n this.irisEnlarge = 2.3;\n this.skipped = 0;\n this.detectedFaces = 0;\n }\n\n transformRawCoords(rawCoords, box, angle, rotationMatrix) {\n const boxSize = bounding.getBoxSize({ startPoint: box.startPoint, endPoint: box.endPoint });\n const coordsScaled = rawCoords.map((coord) => ([\n boxSize[0] / this.meshSize * (coord[0] - this.meshSize / 2),\n boxSize[1] / this.meshSize * (coord[1] - this.meshSize / 2),\n coord[2],\n ]));\n const coordsRotationMatrix = (angle !== 0) ? util.buildRotationMatrix(angle, [0, 0]) : util.IDENTITY_MATRIX;\n const coordsRotated = (angle !== 0) ? coordsScaled.map((coord) => ([...util.rotatePoint(coord, coordsRotationMatrix), coord[2]])) : coordsScaled;\n const inverseRotationMatrix = (angle !== 0) ? util.invertTransformMatrix(rotationMatrix) : util.IDENTITY_MATRIX;\n const boxCenter = [...bounding.getBoxCenter({ startPoint: box.startPoint, endPoint: box.endPoint }), 1];\n return coordsRotated.map((coord) => ([\n Math.round(coord[0] + util.dot(boxCenter, inverseRotationMatrix[0])),\n Math.round(coord[1] + util.dot(boxCenter, inverseRotationMatrix[1])),\n Math.round(coord[2]),\n ]));\n }\n\n // eslint-disable-next-line class-methods-use-this\n getLeftToRightEyeDepthDifference(rawCoords) {\n const leftEyeZ = rawCoords[eyeLandmarks.leftBounds[0]][2];\n const rightEyeZ = rawCoords[eyeLandmarks.rightBounds[0]][2];\n return leftEyeZ - rightEyeZ;\n }\n\n // Returns a box describing a cropped region around the eye fit for passing to the iris model.\n getEyeBox(rawCoords, face, eyeInnerCornerIndex, eyeOuterCornerIndex, flip = false) {\n const box = bounding.squarifyBox(bounding.enlargeBox(bounding.calculateLandmarksBoundingBox([rawCoords[eyeInnerCornerIndex], rawCoords[eyeOuterCornerIndex]]), this.irisEnlarge));\n const boxSize = bounding.getBoxSize(box);\n let crop = tf.image.cropAndResize(face, [[\n box.startPoint[1] / this.meshSize,\n box.startPoint[0] / this.meshSize, box.endPoint[1] / this.meshSize,\n box.endPoint[0] / this.meshSize,\n ]], [0], [this.irisSize, this.irisSize]);\n if (flip && tf.ENV.flags.IS_BROWSER) {\n crop = tf.image.flipLeftRight(crop); // flipLeftRight is not defined for tfjs-node\n }\n return { box, boxSize, crop };\n }\n\n // Given a cropped image of an eye, returns the coordinates of the contours surrounding the eye and the iris.\n getEyeCoords(eyeData, eyeBox, eyeBoxSize, flip = false) {\n const eyeRawCoords: Array<[number, number, number]> = [];\n for (let i = 0; i < irisLandmarks.numCoordinates; i++) {\n const x = eyeData[i * 3];\n const y = eyeData[i * 3 + 1];\n const z = eyeData[i * 3 + 2];\n eyeRawCoords.push([\n (flip ? (1 - (x / this.irisSize)) : (x / this.irisSize)) * eyeBoxSize[0] + eyeBox.startPoint[0],\n (y / this.irisSize) * eyeBoxSize[1] + eyeBox.startPoint[1], z,\n ]);\n }\n return { rawCoords: eyeRawCoords, iris: eyeRawCoords.slice(irisLandmarks.index) };\n }\n\n // The z-coordinates returned for the iris are unreliable, so we take the z values from the surrounding keypoints.\n // eslint-disable-next-line class-methods-use-this\n getAdjustedIrisCoords(rawCoords, irisCoords, direction) {\n const upperCenterZ = rawCoords[coords.MESH_ANNOTATIONS[`${direction}EyeUpper0`][irisLandmarks.upperCenter]][2];\n const lowerCenterZ = rawCoords[coords.MESH_ANNOTATIONS[`${direction}EyeLower0`][irisLandmarks.lowerCenter]][2];\n const averageZ = (upperCenterZ + lowerCenterZ) / 2;\n // Iris indices: 0: center | 1: right | 2: above | 3: left | 4: below\n return irisCoords.map((coord, i) => {\n let z = averageZ;\n if (i === 2) {\n z = upperCenterZ;\n } else if (i === 4) {\n z = lowerCenterZ;\n }\n return [coord[0], coord[1], z];\n });\n }\n\n async predict(input, config) {\n let useFreshBox = false;\n // run new detector every skipFrames unless we only want box to start with\n let detector;\n if ((this.skipped === 0) || (this.skipped > config.face.detector.skipFrames) || !config.face.mesh.enabled || !config.skipFrame) {\n detector = await this.boundingBoxDetector.getBoundingBoxes(input);\n this.skipped = 0;\n }\n if (config.skipFrame) this.skipped++;\n\n // if detector result count doesn't match current working set, use it to reset current working set\n if (!config.skipFrame || (detector && detector.boxes && (!config.face.mesh.enabled || (detector.boxes.length !== this.detectedFaces) && (this.detectedFaces !== config.face.detector.maxDetected)))) {\n this.storedBoxes = [];\n this.detectedFaces = 0;\n for (const possible of detector.boxes) {\n this.storedBoxes.push({ startPoint: possible.box.startPoint.dataSync(), endPoint: possible.box.endPoint.dataSync(), landmarks: possible.landmarks.arraySync(), confidence: possible.confidence });\n }\n if (this.storedBoxes.length > 0) useFreshBox = true;\n }\n\n if (useFreshBox) {\n if (!detector || !detector.boxes || (detector.boxes.length === 0)) {\n this.storedBoxes = [];\n this.detectedFaces = 0;\n return null;\n }\n for (let i = 0; i < this.storedBoxes.length; i++) {\n const scaledBox = bounding.scaleBoxCoordinates({ startPoint: this.storedBoxes[i].startPoint, endPoint: this.storedBoxes[i].endPoint }, detector.scaleFactor);\n const enlargedBox = bounding.enlargeBox(scaledBox);\n const squarifiedBox = bounding.squarifyBox(enlargedBox);\n const landmarks = this.storedBoxes[i].landmarks;\n const confidence = this.storedBoxes[i].confidence;\n this.storedBoxes[i] = { ...squarifiedBox, confidence, landmarks };\n }\n }\n if (detector && detector.boxes) {\n detector.boxes.forEach((prediction) => {\n prediction.box.startPoint.dispose();\n prediction.box.endPoint.dispose();\n prediction.landmarks.dispose();\n });\n }\n const results = tf.tidy(() => this.storedBoxes.map((box, i) => {\n // The facial bounding box landmarks could come either from blazeface (if we are using a fresh box), or from the mesh model (if we are reusing an old box).\n let face;\n let angle = 0;\n let rotationMatrix;\n\n if (config.face.detector.rotation && config.face.mesh.enabled && tf.ENV.flags.IS_BROWSER) {\n const [indexOfMouth, indexOfForehead] = (box.landmarks.length >= meshLandmarks.count) ? meshLandmarks.symmetryLine : blazeFaceLandmarks.symmetryLine;\n angle = util.computeRotation(box.landmarks[indexOfMouth], box.landmarks[indexOfForehead]);\n const faceCenter = bounding.getBoxCenter({ startPoint: box.startPoint, endPoint: box.endPoint });\n const faceCenterNormalized = [faceCenter[0] / input.shape[2], faceCenter[1] / input.shape[1]];\n const rotatedImage = tf.image.rotateWithOffset(input, angle, 0, faceCenterNormalized); // rotateWithOffset is not defined for tfjs-node\n rotationMatrix = util.buildRotationMatrix(-angle, faceCenter);\n if (config.face.mesh.enabled) face = bounding.cutBoxFromImageAndResize({ startPoint: box.startPoint, endPoint: box.endPoint }, rotatedImage, [this.meshSize, this.meshSize]).div(255);\n else face = bounding.cutBoxFromImageAndResize({ startPoint: box.startPoint, endPoint: box.endPoint }, rotatedImage, [this.boxSize, this.boxSize]).div(255);\n } else {\n rotationMatrix = util.IDENTITY_MATRIX;\n const clonedImage = input.clone();\n if (config.face.mesh.enabled) face = bounding.cutBoxFromImageAndResize({ startPoint: box.startPoint, endPoint: box.endPoint }, clonedImage, [this.meshSize, this.meshSize]).div(255);\n else face = bounding.cutBoxFromImageAndResize({ startPoint: box.startPoint, endPoint: box.endPoint }, clonedImage, [this.boxSize, this.boxSize]).div(255);\n }\n\n // if we're not going to produce mesh, don't spend time with further processing\n if (!config.face.mesh.enabled) {\n const prediction = {\n mesh: [],\n box,\n faceConfidence: null,\n boxConfidence: box.confidence,\n confidence: box.confidence,\n image: face,\n };\n return prediction;\n }\n\n const [, confidence, contourCoords] = this.meshDetector.execute(face) as Array; // The first returned tensor represents facial contours which are already included in the coordinates.\n const faceConfidence = confidence.dataSync()[0] as number;\n if (faceConfidence < config.face.detector.minConfidence) {\n this.storedBoxes[i].confidence = faceConfidence; // reset confidence of cached box\n return null; // if below confidence just exit\n }\n const coordsReshaped = tf.reshape(contourCoords, [-1, 3]);\n let rawCoords = coordsReshaped.arraySync();\n\n if (config.face.iris.enabled) {\n const { box: leftEyeBox, boxSize: leftEyeBoxSize, crop: leftEyeCrop } = this.getEyeBox(rawCoords, face, eyeLandmarks.leftBounds[0], eyeLandmarks.leftBounds[1], true);\n const { box: rightEyeBox, boxSize: rightEyeBoxSize, crop: rightEyeCrop } = this.getEyeBox(rawCoords, face, eyeLandmarks.rightBounds[0], eyeLandmarks.rightBounds[1]);\n const eyePredictions = this.irisModel.predict(tf.concat([leftEyeCrop, rightEyeCrop])) as Tensor;\n const eyePredictionsData = eyePredictions.dataSync();\n const leftEyeData = eyePredictionsData.slice(0, irisLandmarks.numCoordinates * 3);\n const { rawCoords: leftEyeRawCoords, iris: leftIrisRawCoords } = this.getEyeCoords(leftEyeData, leftEyeBox, leftEyeBoxSize, true);\n const rightEyeData = eyePredictionsData.slice(irisLandmarks.numCoordinates * 3);\n const { rawCoords: rightEyeRawCoords, iris: rightIrisRawCoords } = this.getEyeCoords(rightEyeData, rightEyeBox, rightEyeBoxSize);\n const leftToRightEyeDepthDifference = this.getLeftToRightEyeDepthDifference(rawCoords);\n if (Math.abs(leftToRightEyeDepthDifference) < 30) { // User is looking straight ahead.\n replaceRawCoordinates(rawCoords, leftEyeRawCoords, 'left', null);\n replaceRawCoordinates(rawCoords, rightEyeRawCoords, 'right', null);\n // If the user is looking to the left or to the right, the iris coordinates tend to diverge too much from the mesh coordinates for them to be merged\n // So we only update a single contour line above and below the eye.\n } else if (leftToRightEyeDepthDifference < 1) { // User is looking towards the right.\n replaceRawCoordinates(rawCoords, leftEyeRawCoords, 'left', ['EyeUpper0', 'EyeLower0']);\n } else { // User is looking towards the left.\n replaceRawCoordinates(rawCoords, rightEyeRawCoords, 'right', ['EyeUpper0', 'EyeLower0']);\n }\n const adjustedLeftIrisCoords = this.getAdjustedIrisCoords(rawCoords, leftIrisRawCoords, 'left');\n const adjustedRightIrisCoords = this.getAdjustedIrisCoords(rawCoords, rightIrisRawCoords, 'right');\n rawCoords = rawCoords.concat(adjustedLeftIrisCoords).concat(adjustedRightIrisCoords);\n }\n\n // override box from detection with one calculated from mesh\n const mesh = this.transformRawCoords(rawCoords, box, angle, rotationMatrix);\n const storeConfidence = box.confidence;\n // @ts-ignore enlargeBox does not include confidence so we append it manually\n box = bounding.enlargeBox(bounding.calculateLandmarksBoundingBox(mesh), 1.5); // redefine box with mesh calculated one\n box.confidence = storeConfidence;\n\n // do rotation one more time with mesh keypoints if we want to return perfect image\n if (config.face.detector.rotation && config.face.mesh.enabled && config.face.description.enabled && tf.ENV.flags.IS_BROWSER) {\n const [indexOfMouth, indexOfForehead] = (box.landmarks.length >= meshLandmarks.count) ? meshLandmarks.symmetryLine : blazeFaceLandmarks.symmetryLine;\n angle = util.computeRotation(box.landmarks[indexOfMouth], box.landmarks[indexOfForehead]);\n const faceCenter = bounding.getBoxCenter({ startPoint: box.startPoint, endPoint: box.endPoint });\n const faceCenterNormalized = [faceCenter[0] / input.shape[2], faceCenter[1] / input.shape[1]];\n const rotatedImage = tf.image.rotateWithOffset(input.toFloat(), angle, 0, faceCenterNormalized); // rotateWithOffset is not defined for tfjs-node\n rotationMatrix = util.buildRotationMatrix(-angle, faceCenter);\n face = bounding.cutBoxFromImageAndResize({ startPoint: box.startPoint, endPoint: box.endPoint }, rotatedImage, [this.meshSize, this.meshSize]).div(255);\n }\n\n const prediction = {\n mesh,\n box,\n faceConfidence,\n boxConfidence: box.confidence,\n image: face,\n };\n\n // updated stored cache values\n this.storedBoxes[i] = { ...bounding.squarifyBox(box), confidence: box.confidence, faceConfidence };\n\n return prediction;\n }));\n\n // results = results.filter((a) => a !== null);\n // remove cache entries for detected boxes on low confidence\n if (config.face.mesh.enabled) this.storedBoxes = this.storedBoxes.filter((a) => a.confidence > config.face.detector.minConfidence);\n this.detectedFaces = results.length;\n\n return results;\n }\n}\n", "/**\n * FaceMesh & BlazeFace Module entry point\n */\n\nimport { log, join } from '../helpers';\nimport * as tf from '../../dist/tfjs.esm.js';\nimport * as blazeface from './blazeface';\nimport * as facepipeline from './facepipeline';\nimport * as coords from './coords';\nimport { GraphModel, Tensor } from '../tfjs/types';\nimport { Face } from '../result';\nimport { Config } from '../config';\n\nlet faceModels: [blazeface.BlazeFaceModel | null, GraphModel | null, GraphModel | null] = [null, null, null];\nlet facePipeline;\n\nexport async function predict(input: Tensor, config: Config): Promise {\n const predictions = await facePipeline.predict(input, config);\n const results: Array = [];\n let id = 0;\n for (const prediction of (predictions || [])) {\n if (!prediction || prediction.isDisposedInternal) continue; // guard against disposed tensors on long running operations such as pause in middle of processing\n const meshRaw = prediction.mesh.map((pt) => [\n pt[0] / (input.shape[2] || 0),\n pt[1] / (input.shape[1] || 0),\n pt[2] / facePipeline.meshSize,\n ]);\n const annotations = {};\n if (prediction.mesh && prediction.mesh.length > 0) {\n for (const key of Object.keys(coords.MESH_ANNOTATIONS)) annotations[key] = coords.MESH_ANNOTATIONS[key].map((index) => prediction.mesh[index]);\n }\n const clampedBox: [number, number, number, number] = prediction.box ? [\n Math.trunc(Math.max(0, prediction.box.startPoint[0])),\n Math.trunc(Math.max(0, prediction.box.startPoint[1])),\n Math.trunc(Math.min((input.shape[2] || 0), prediction.box.endPoint[0]) - Math.max(0, prediction.box.startPoint[0])),\n Math.trunc(Math.min((input.shape[1] || 0), prediction.box.endPoint[1]) - Math.max(0, prediction.box.startPoint[1])),\n ] : [0, 0, 0, 0];\n const boxRaw: [number, number, number, number] = prediction.box ? [\n prediction.box.startPoint[0] / (input.shape[2] || 0),\n prediction.box.startPoint[1] / (input.shape[1] || 0),\n (prediction.box.endPoint[0] - prediction.box.startPoint[0]) / (input.shape[2] || 0),\n (prediction.box.endPoint[1] - prediction.box.startPoint[1]) / (input.shape[1] || 0),\n ] : [0, 0, 0, 0];\n results.push({\n id: id++,\n score: Math.round(100 * prediction.faceConfidence || 100 * prediction.boxConfidence || 0) / 100,\n boxScore: Math.round(100 * prediction.boxConfidence) / 100,\n faceScore: Math.round(100 * prediction.faceConfidence) / 100,\n box: clampedBox,\n boxRaw,\n mesh: prediction.mesh,\n meshRaw,\n annotations,\n image: prediction.image,\n tensor: prediction.image,\n });\n if (prediction.coords) prediction.coords.dispose();\n }\n return results;\n}\n\nexport async function load(config): Promise<[unknown, unknown, unknown]> {\n if ((!faceModels[0] && config.face.enabled) || (!faceModels[1] && config.face.mesh.enabled) || (!faceModels[2] && config.face.iris.enabled)) {\n // @ts-ignore type mismatch for GraphModel\n faceModels = await Promise.all([\n (!faceModels[0] && config.face.enabled) ? blazeface.load(config) : null,\n (!faceModels[1] && config.face.mesh.enabled) ? tf.loadGraphModel(join(config.modelBasePath, config.face.mesh.modelPath), { fromTFHub: config.face.mesh.modelPath.includes('tfhub.dev') }) : null,\n (!faceModels[2] && config.face.iris.enabled) ? tf.loadGraphModel(join(config.modelBasePath, config.face.iris.modelPath), { fromTFHub: config.face.iris.modelPath.includes('tfhub.dev') }) : null,\n ]);\n if (config.face.mesh.enabled) {\n if (!faceModels[1] || !faceModels[1]['modelUrl']) log('load model failed:', config.face.mesh.modelPath);\n else if (config.debug) log('load model:', faceModels[1]['modelUrl']);\n }\n if (config.face.iris.enabled) {\n if (!faceModels[2] || !faceModels[2]['modelUrl']) log('load model failed:', config.face.iris.modelPath);\n else if (config.debug) log('load model:', faceModels[2]['modelUrl']);\n }\n } else if (config.debug) {\n if (faceModels[0]) log('cached model:', faceModels[0].model['modelUrl']);\n if (faceModels[1]) log('cached model:', faceModels[1]['modelUrl']);\n if (faceModels[2]) log('cached model:', faceModels[2]['modelUrl']);\n }\n facePipeline = new facepipeline.Pipeline(faceModels[0], faceModels[1], faceModels[2]);\n return faceModels;\n}\n\nexport const triangulation = coords.TRI468;\nexport const uvmap = coords.UV468;\n", "/**\n * Emotion Module\n */\n\nimport { log, join } from '../helpers';\nimport { Config } from '../config';\nimport { Tensor, GraphModel } from '../tfjs/types';\nimport * as tf from '../../dist/tfjs.esm.js';\n\nconst annotations = ['angry', 'disgust', 'fear', 'happy', 'sad', 'surprise', 'neutral'];\nlet model;\n// let last: Array<{ score: number, emotion: string }> = [];\nconst last: Array> = [];\nlet lastCount = 0;\nlet skipped = Number.MAX_SAFE_INTEGER;\n\n// tuning values\nconst rgb = [0.2989, 0.5870, 0.1140]; // factors for red/green/blue colors when converting to grayscale\n\nexport async function load(config: Config): Promise {\n if (!model) {\n model = await tf.loadGraphModel(join(config.modelBasePath, config.face.emotion.modelPath));\n if (!model || !model.modelUrl) log('load model failed:', config.face.emotion.modelPath);\n else if (config.debug) log('load model:', model.modelUrl);\n } else if (config.debug) log('cached model:', model.modelUrl);\n return model;\n}\n\nexport async function predict(image: Tensor, config: Config, idx, count) {\n if (!model) return null;\n if ((skipped < config.face.emotion.skipFrames) && config.skipFrame && (lastCount === count) && last[idx] && (last[idx].length > 0)) {\n skipped++;\n return last[idx];\n }\n skipped = 0;\n return new Promise(async (resolve) => {\n const resize = tf.image.resizeBilinear(image, [model.inputs[0].shape[2], model.inputs[0].shape[1]], false);\n const [red, green, blue] = tf.split(resize, 3, 3);\n resize.dispose();\n // weighted rgb to grayscale: https://www.mathworks.com/help/matlab/ref/rgb2gray.html\n const redNorm = tf.mul(red, rgb[0]);\n const greenNorm = tf.mul(green, rgb[1]);\n const blueNorm = tf.mul(blue, rgb[2]);\n red.dispose();\n green.dispose();\n blue.dispose();\n const grayscale = tf.addN([redNorm, greenNorm, blueNorm]);\n redNorm.dispose();\n greenNorm.dispose();\n blueNorm.dispose();\n const normalize = tf.tidy(() => grayscale.sub(0.5).mul(2));\n grayscale.dispose();\n const obj: Array<{ score: number, emotion: string }> = [];\n if (config.face.emotion.enabled) {\n const emotionT = await model.predict(normalize); // result is already in range 0..1, no need for additional activation\n const data = emotionT.dataSync();\n tf.dispose(emotionT);\n for (let i = 0; i < data.length; i++) {\n if (data[i] > config.face.emotion.minConfidence) obj.push({ score: Math.min(0.99, Math.trunc(100 * data[i]) / 100), emotion: annotations[i] });\n }\n obj.sort((a, b) => b.score - a.score);\n }\n normalize.dispose();\n last[idx] = obj;\n lastCount = count;\n resolve(obj);\n });\n}\n", "/**\n * HSE-FaceRes Module\n * Returns Age, Gender, Descriptor\n * Implements Face simmilarity function\n */\n\nimport { log, join } from '../helpers';\nimport * as tf from '../../dist/tfjs.esm.js';\nimport { Tensor, GraphModel } from '../tfjs/types';\nimport { Config } from '../config';\n\nlet model: GraphModel;\nconst last: Array<{\n age: number,\n gender: string,\n genderScore: number,\n descriptor: number[],\n}> = [];\n\nlet lastCount = 0;\nlet skipped = Number.MAX_SAFE_INTEGER;\n\ntype DB = Array<{ name: string, source: string, embedding: number[] }>;\n\nexport async function load(config: Config): Promise {\n const modelUrl = join(config.modelBasePath, config.face.description.modelPath);\n if (!model) {\n // @ts-ignore type mismatch for GraphModel\n model = await tf.loadGraphModel(modelUrl);\n if (!model) log('load model failed:', config.face.description.modelPath);\n else if (config.debug) log('load model:', modelUrl);\n } else if (config.debug) log('cached model:', modelUrl);\n return model;\n}\n\nexport function similarity(embedding1: Array, embedding2: Array, order = 2): number {\n if (!embedding1 || !embedding2) return 0;\n if (embedding1?.length === 0 || embedding2?.length === 0) return 0;\n if (embedding1?.length !== embedding2?.length) return 0;\n // general minkowski distance, euclidean distance is limited case where order is 2\n const distance = 5.0 * embedding1\n .map((_val, i) => (Math.abs(embedding1[i] - embedding2[i]) ** order)) // distance squared\n .reduce((sum, now) => (sum + now), 0) // sum all distances\n ** (1 / order); // get root of\n const res = Math.max(0, 100 - distance) / 100.0;\n return res;\n}\n\nexport function match(embedding: Array, db: DB, threshold = 0) {\n let best = { similarity: 0, name: '', source: '', embedding: [] as number[] };\n if (!embedding || !db || !Array.isArray(embedding) || !Array.isArray(db)) return best;\n for (const f of db) {\n if (f.embedding && f.name) {\n const perc = similarity(embedding, f.embedding);\n if (perc > threshold && perc > best.similarity) best = { ...f, similarity: perc };\n }\n }\n return best;\n}\n\nexport function enhance(input): Tensor {\n const image = tf.tidy(() => {\n // input received from detector is already normalized to 0..1\n // input is also assumed to be straightened\n const tensor = input.image || input.tensor || input;\n if (!(tensor instanceof tf.Tensor)) return null;\n // do a tight crop of image and resize it to fit the model\n const box = [[0.05, 0.15, 0.85, 0.85]]; // empyrical values for top, left, bottom, right\n // const box = [[0.0, 0.0, 1.0, 1.0]]; // basically no crop for test\n if (!model.inputs[0].shape) return null; // model has no shape so no point continuing\n const crop = (tensor.shape.length === 3)\n ? tf.image.cropAndResize(tf.expandDims(tensor, 0), box, [0], [model.inputs[0].shape[2], model.inputs[0].shape[1]]) // add batch dimension if missing\n : tf.image.cropAndResize(tensor, box, [0], [model.inputs[0].shape[2], model.inputs[0].shape[1]]);\n\n /*\n // just resize to fit the embedding model instead of cropping\n const crop = tf.image.resizeBilinear(tensor, [model.inputs[0].shape[2], model.inputs[0].shape[1]], false);\n */\n\n /*\n // convert to black&white to avoid colorization impact\n const rgb = [0.2989, 0.5870, 0.1140]; // factors for red/green/blue colors when converting to grayscale: https://www.mathworks.com/help/matlab/ref/rgb2gray.html\n const [red, green, blue] = tf.split(crop, 3, 3);\n const redNorm = tf.mul(red, rgb[0]);\n const greenNorm = tf.mul(green, rgb[1]);\n const blueNorm = tf.mul(blue, rgb[2]);\n const grayscale = tf.addN([redNorm, greenNorm, blueNorm]);\n const merge = tf.stack([grayscale, grayscale, grayscale], 3).squeeze(4);\n */\n\n /*\n // increase image pseudo-contrast 100%\n // (or do it per-channel so mean is done on each channel)\n // (or calculate histogram and do it based on histogram)\n const mean = merge.mean();\n const factor = 2;\n const contrast = merge.sub(mean).mul(factor).add(mean);\n */\n\n /*\n // normalize brightness from 0..1\n // silly way of creating pseudo-hdr of image\n const darken = crop.sub(crop.min());\n const lighten = darken.div(darken.max());\n */\n\n const norm = crop.mul(255);\n\n return norm;\n });\n return image;\n}\n\nexport async function predict(image: Tensor, config: Config, idx, count) {\n if (!model) return null;\n if ((skipped < config.face.description.skipFrames) && config.skipFrame && (lastCount === count) && last[idx]?.age && (last[idx]?.age > 0)) {\n skipped++;\n return last[idx];\n }\n skipped = 0;\n return new Promise(async (resolve) => {\n const enhanced = enhance(image);\n\n let resT;\n const obj = {\n age: 0,\n gender: 'unknown',\n genderScore: 0,\n descriptor: [],\n };\n\n if (config.face.description.enabled) resT = await model.predict(enhanced);\n tf.dispose(enhanced);\n\n if (resT) {\n tf.tidy(() => {\n const gender = resT.find((t) => t.shape[1] === 1).dataSync();\n const confidence = Math.trunc(200 * Math.abs((gender[0] - 0.5))) / 100;\n if (confidence > config.face.description.minConfidence) {\n obj.gender = gender[0] <= 0.5 ? 'female' : 'male';\n obj.genderScore = Math.min(0.99, confidence);\n }\n const age = resT.find((t) => t.shape[1] === 100).argMax(1).dataSync()[0];\n const all = resT.find((t) => t.shape[1] === 100).dataSync();\n obj.age = Math.round(all[age - 1] > all[age + 1] ? 10 * age - 100 * all[age - 1] : 10 * age + 100 * all[age + 1]) / 10;\n\n const desc = resT.find((t) => t.shape[1] === 1024);\n // const reshape = desc.reshape([128, 8]); // reshape large 1024-element descriptor to 128 x 8\n // const reduce = reshape.logSumExp(1); // reduce 2nd dimension by calculating logSumExp on it which leaves us with 128-element descriptor\n\n obj.descriptor = [...desc.dataSync()];\n });\n resT.forEach((t) => tf.dispose(t));\n }\n\n last[idx] = obj;\n lastCount = count;\n resolve(obj);\n });\n}\n", "/**\n * Module that analyzes person age\n * Obsolete\n */\n\nimport { log, now } from './helpers';\nimport * as tf from '../dist/tfjs.esm.js';\nimport * as facemesh from './blazeface/facemesh';\nimport * as emotion from './emotion/emotion';\nimport * as faceres from './faceres/faceres';\nimport { Face } from './result';\nimport { Tensor } from './tfjs/types';\n\n// eslint-disable-next-line no-unused-vars, @typescript-eslint/no-unused-vars\nconst rad2deg = (theta) => Math.round((theta * 180) / Math.PI);\n\nconst calculateGaze = (face): { bearing: number, strength: number } => {\n const radians = (pt1, pt2) => Math.atan2(pt1[1] - pt2[1], pt1[0] - pt2[0]); // function to calculate angle between any two points\n if (!face.annotations['rightEyeIris'] || !face.annotations['leftEyeIris']) return { bearing: 0, strength: 0 };\n\n const offsetIris = [0, -0.1]; // iris center may not align with average of eye extremes\n const eyeRatio = 1; // factor to normalize changes x vs y\n\n const left = face.mesh[33][2] > face.mesh[263][2]; // pick left or right eye depending which one is closer bazed on outsize point z axis\n const irisCenter = left ? face.mesh[473] : face.mesh[468];\n const eyeCenter = left // eye center is average of extreme points on x axis for both x and y, ignoring y extreme points as eyelids naturally open/close more when gazing up/down so relative point is less precise\n ? [(face.mesh[133][0] + face.mesh[33][0]) / 2, (face.mesh[133][1] + face.mesh[33][1]) / 2]\n : [(face.mesh[263][0] + face.mesh[362][0]) / 2, (face.mesh[263][1] + face.mesh[362][1]) / 2];\n const eyeSize = left // eye size is difference between extreme points for both x and y, used to normalize & squarify eye dimensions\n ? [face.mesh[133][0] - face.mesh[33][0], face.mesh[23][1] - face.mesh[27][1]]\n : [face.mesh[263][0] - face.mesh[362][0], face.mesh[253][1] - face.mesh[257][1]];\n\n const eyeDiff = [ // x distance between extreme point and center point normalized with eye size\n (eyeCenter[0] - irisCenter[0]) / eyeSize[0] - offsetIris[0],\n eyeRatio * (irisCenter[1] - eyeCenter[1]) / eyeSize[1] - offsetIris[1],\n ];\n let strength = Math.sqrt((eyeDiff[0] ** 2) + (eyeDiff[1] ** 2)); // vector length is a diagonal between two differences\n strength = Math.min(strength, face.boxRaw[2] / 2, face.boxRaw[3] / 2); // limit strength to half of box size to avoid clipping due to low precision\n const bearing = (radians([0, 0], eyeDiff) + (Math.PI / 2)) % Math.PI; // using eyeDiff instead eyeCenter/irisCenter combo due to manual adjustments and rotate clockwise 90degrees\n\n return { bearing, strength };\n};\n\nconst calculateFaceAngle = (face, imageSize): {\n angle: { pitch: number, yaw: number, roll: number },\n matrix: [number, number, number, number, number, number, number, number, number],\n gaze: { bearing: number, strength: number },\n} => {\n // const degrees = (theta) => Math.abs(((theta * 180) / Math.PI) % 360);\n const normalize = (v) => { // normalize vector\n const length = Math.sqrt(v[0] * v[0] + v[1] * v[1] + v[2] * v[2]);\n v[0] /= length;\n v[1] /= length;\n v[2] /= length;\n return v;\n };\n const subVectors = (a, b) => { // vector subtraction (a - b)\n const x = a[0] - b[0];\n const y = a[1] - b[1];\n const z = a[2] - b[2];\n return [x, y, z];\n };\n const crossVectors = (a, b) => { // vector cross product (a x b)\n const x = a[1] * b[2] - a[2] * b[1];\n const y = a[2] * b[0] - a[0] * b[2];\n const z = a[0] * b[1] - a[1] * b[0];\n return [x, y, z];\n };\n // 3x3 rotation matrix to Euler angles based on https://www.geometrictools.com/Documentation/EulerAngles.pdf\n const rotationMatrixToEulerAngle = (r) => {\n // eslint-disable-next-line no-unused-vars, @typescript-eslint/no-unused-vars\n const [r00, r01, r02, r10, r11, r12, r20, r21, r22] = r;\n let thetaX; let thetaY; let thetaZ;\n if (r10 < 1) { // YZX calculation\n if (r10 > -1) {\n thetaZ = Math.asin(r10);\n thetaY = Math.atan2(-r20, r00);\n thetaX = Math.atan2(-r12, r11);\n } else {\n thetaZ = -Math.PI / 2;\n thetaY = -Math.atan2(r21, r22);\n thetaX = 0;\n }\n } else {\n thetaZ = Math.PI / 2;\n thetaY = Math.atan2(r21, r22);\n thetaX = 0;\n }\n return { pitch: 2 * -thetaX, yaw: 2 * -thetaY, roll: 2 * -thetaZ };\n };\n // simple Euler angle calculation based existing 3D mesh\n // eslint-disable-next-line no-unused-vars, @typescript-eslint/no-unused-vars\n const meshToEulerAngle = (mesh) => {\n const radians = (a1, a2, b1, b2) => Math.atan2(b2 - a2, b1 - a1);\n // eslint-disable-next-line no-unused-vars, @typescript-eslint/no-unused-vars\n const angle = {\n // values are in radians in range of -pi/2 to pi/2 which is -90 to +90 degrees, value of 0 means center\n // pitch is face move up/down\n pitch: radians(mesh[10][1], mesh[10][2], mesh[152][1], mesh[152][2]), // looking at y,z of top and bottom points of the face\n // yaw is face turn left/right\n yaw: radians(mesh[33][0], mesh[33][2], mesh[263][0], mesh[263][2]), // looking at x,z of outside corners of leftEye and rightEye\n // roll is face lean left/right\n roll: radians(mesh[33][0], mesh[33][1], mesh[263][0], mesh[263][1]), // looking at x,y of outside corners of leftEye and rightEye\n };\n return angle;\n };\n\n // initialize gaze and mesh\n const mesh = face.meshRaw;\n if (!mesh || mesh.length < 300) return { angle: { pitch: 0, yaw: 0, roll: 0 }, matrix: [1, 0, 0, 0, 1, 0, 0, 0, 1], gaze: { bearing: 0, strength: 0 } };\n\n const size = Math.max(face.boxRaw[2] * imageSize[0], face.boxRaw[3] * imageSize[1]) / 1.5;\n // top, bottom, left, right\n const pts = [mesh[10], mesh[152], mesh[234], mesh[454]].map((pt) => [\n // make the xyz coordinates proportional, independent of the image/box size\n pt[0] * imageSize[0] / size,\n pt[1] * imageSize[1] / size,\n pt[2],\n ]);\n\n const y_axis = normalize(subVectors(pts[1], pts[0]));\n let x_axis = normalize(subVectors(pts[3], pts[2]));\n const z_axis = normalize(crossVectors(x_axis, y_axis));\n // adjust x_axis to make sure that all axes are perpendicular to each other\n x_axis = crossVectors(y_axis, z_axis);\n\n // Rotation Matrix from Axis Vectors - http://renderdan.blogspot.com/2006/05/rotation-matrix-from-axis-vectors.html\n // 3x3 rotation matrix is flatten to array in row-major order. Note that the rotation represented by this matrix is inverted.\n const matrix: [number, number, number, number, number, number, number, number, number] = [\n x_axis[0], x_axis[1], x_axis[2],\n y_axis[0], y_axis[1], y_axis[2],\n z_axis[0], z_axis[1], z_axis[2],\n ];\n const angle = rotationMatrixToEulerAngle(matrix);\n // const angle = meshToEulerAngle(mesh);\n\n // we have iris keypoints so we can calculate gaze direction\n const gaze = mesh.length === 478 ? calculateGaze(face) : { bearing: 0, strength: 0 };\n\n return { angle, matrix, gaze };\n};\n\nexport const detectFace = async (parent /* instance of human */, input: Tensor): Promise => {\n // run facemesh, includes blazeface and iris\n // eslint-disable-next-line no-async-promise-executor\n let timeStamp;\n let ageRes;\n let genderRes;\n let emotionRes;\n let embeddingRes;\n let descRes;\n const faceRes: Array = [];\n parent.state = 'run:face';\n timeStamp = now();\n const faces = await facemesh.predict(input, parent.config);\n parent.performance.face = Math.trunc(now() - timeStamp);\n if (!input.shape || input.shape.length !== 4) return [];\n if (!faces) return [];\n // for (const face of faces) {\n for (let i = 0; i < faces.length; i++) {\n parent.analyze('Get Face');\n\n // is something went wrong, skip the face\n // @ts-ignore possibly undefined\n if (!faces[i].image || faces[i].image['isDisposedInternal']) {\n log('Face object is disposed:', faces[i].image);\n continue;\n }\n\n const rotation = calculateFaceAngle(faces[i], [input.shape[2], input.shape[1]]);\n\n // run emotion, inherits face from blazeface\n parent.analyze('Start Emotion:');\n if (parent.config.async) {\n emotionRes = parent.config.face.emotion.enabled ? emotion.predict(faces[i].image || tf.tensor([]), parent.config, i, faces.length) : {};\n } else {\n parent.state = 'run:emotion';\n timeStamp = now();\n emotionRes = parent.config.face.emotion.enabled ? await emotion.predict(faces[i].image || tf.tensor([]), parent.config, i, faces.length) : {};\n parent.performance.emotion = Math.trunc(now() - timeStamp);\n }\n parent.analyze('End Emotion:');\n\n // run emotion, inherits face from blazeface\n parent.analyze('Start Description:');\n if (parent.config.async) {\n descRes = parent.config.face.description.enabled ? faceres.predict(faces[i].image || tf.tensor([]), parent.config, i, faces.length) : [];\n } else {\n parent.state = 'run:description';\n timeStamp = now();\n descRes = parent.config.face.description.enabled ? await faceres.predict(faces[i].image || tf.tensor([]), parent.config, i, faces.length) : [];\n parent.performance.embedding = Math.trunc(now() - timeStamp);\n }\n parent.analyze('End Description:');\n\n // if async wait for results\n if (parent.config.async) {\n [ageRes, genderRes, emotionRes, embeddingRes, descRes] = await Promise.all([ageRes, genderRes, emotionRes, embeddingRes, descRes]);\n }\n\n parent.analyze('Finish Face:');\n\n // calculate iris distance\n // iris: array[ center, left, top, right, bottom]\n if (!parent.config.face.iris.enabled && faces[i]?.annotations?.leftEyeIris && faces[i]?.annotations?.rightEyeIris) {\n delete faces[i].annotations.leftEyeIris;\n delete faces[i].annotations.rightEyeIris;\n }\n const irisSize = (faces[i].annotations?.leftEyeIris && faces[i].annotations?.rightEyeIris)\n /* note: average human iris size is 11.7mm */\n ? Math.max(Math.abs(faces[i].annotations.leftEyeIris[3][0] - faces[i].annotations.leftEyeIris[1][0]), Math.abs(faces[i].annotations.rightEyeIris[4][1] - faces[i].annotations.rightEyeIris[2][1])) / input.shape[2]\n : 0;\n\n // combine results\n faceRes.push({\n ...faces[i],\n id: i,\n age: descRes.age,\n gender: descRes.gender,\n genderScore: descRes.genderScore,\n embedding: descRes.descriptor,\n emotion: emotionRes,\n iris: irisSize !== 0 ? Math.trunc(500 / irisSize / 11.7) / 100 : 0,\n rotation,\n tensor: parent.config.face.detector.return ? tf.squeeze(faces[i].image) : null,\n });\n // dispose original face tensor\n tf.dispose(faces[i].image);\n // delete temp face image\n if (faces[i].image) delete faces[i].image;\n\n parent.analyze('End Face');\n }\n parent.analyze('End FaceMesh:');\n if (parent.config.async) {\n if (parent.performance.face) delete parent.performance.face;\n if (parent.performance.age) delete parent.performance.age;\n if (parent.performance.gender) delete parent.performance.gender;\n if (parent.performance.emotion) delete parent.performance.emotion;\n }\n return faceRes;\n};\n", "export const partNames = [\n 'nose', 'leftEye', 'rightEye', 'leftEar', 'rightEar', 'leftShoulder',\n 'rightShoulder', 'leftElbow', 'rightElbow', 'leftWrist', 'rightWrist',\n 'leftHip', 'rightHip', 'leftKnee', 'rightKnee', 'leftAnkle', 'rightAnkle',\n];\n\nexport const count = partNames.length; // 17 keypoints\n\nexport const partIds = partNames.reduce((result, jointName, i) => {\n result[jointName] = i;\n return result;\n}, {});\n\nconst connectedPartNames = [\n ['leftHip', 'leftShoulder'], ['leftElbow', 'leftShoulder'],\n ['leftElbow', 'leftWrist'], ['leftHip', 'leftKnee'],\n ['leftKnee', 'leftAnkle'], ['rightHip', 'rightShoulder'],\n ['rightElbow', 'rightShoulder'], ['rightElbow', 'rightWrist'],\n ['rightHip', 'rightKnee'], ['rightKnee', 'rightAnkle'],\n ['leftShoulder', 'rightShoulder'], ['leftHip', 'rightHip'],\n];\nexport const connectedPartIndices = connectedPartNames.map(([jointNameA, jointNameB]) => ([partIds[jointNameA], partIds[jointNameB]]));\n\nexport const poseChain = [\n ['nose', 'leftEye'], ['leftEye', 'leftEar'], ['nose', 'rightEye'],\n ['rightEye', 'rightEar'], ['nose', 'leftShoulder'],\n ['leftShoulder', 'leftElbow'], ['leftElbow', 'leftWrist'],\n ['leftShoulder', 'leftHip'], ['leftHip', 'leftKnee'],\n ['leftKnee', 'leftAnkle'], ['nose', 'rightShoulder'],\n ['rightShoulder', 'rightElbow'], ['rightElbow', 'rightWrist'],\n ['rightShoulder', 'rightHip'], ['rightHip', 'rightKnee'],\n ['rightKnee', 'rightAnkle'],\n];\n", "import * as kpt from './keypoints';\nimport { Body } from '../result';\n\nexport function eitherPointDoesntMeetConfidence(a, b, minConfidence) {\n return (a < minConfidence || b < minConfidence);\n}\n\nexport function getAdjacentKeyPoints(keypoints, minConfidence) {\n return kpt.connectedPartIndices.reduce((result, [leftJoint, rightJoint]) => {\n if (eitherPointDoesntMeetConfidence(keypoints[leftJoint].score, keypoints[rightJoint].score, minConfidence)) {\n return result;\n }\n result.push([keypoints[leftJoint], keypoints[rightJoint]]);\n return result;\n }, []);\n}\n\nexport function getBoundingBox(keypoints): [number, number, number, number] {\n const coord = keypoints.reduce(({ maxX, maxY, minX, minY }, { position: { x, y } }) => ({\n maxX: Math.max(maxX, x),\n maxY: Math.max(maxY, y),\n minX: Math.min(minX, x),\n minY: Math.min(minY, y),\n }), {\n maxX: Number.NEGATIVE_INFINITY,\n maxY: Number.NEGATIVE_INFINITY,\n minX: Number.POSITIVE_INFINITY,\n minY: Number.POSITIVE_INFINITY,\n });\n return [coord.minX, coord.minY, coord.maxX - coord.minX, coord.maxY - coord.minY];\n}\n\nexport function scalePoses(poses, [height, width], [inputResolutionHeight, inputResolutionWidth]): Array {\n const scaleY = height / inputResolutionHeight;\n const scaleX = width / inputResolutionWidth;\n const scalePose = (pose, i) => ({\n id: i,\n score: pose.score,\n boxRaw: [pose.box[0] / inputResolutionWidth, pose.box[1] / inputResolutionHeight, pose.box[2] / inputResolutionWidth, pose.box[3] / inputResolutionHeight],\n box: [Math.trunc(pose.box[0] * scaleX), Math.trunc(pose.box[1] * scaleY), Math.trunc(pose.box[2] * scaleX), Math.trunc(pose.box[3] * scaleY)],\n keypoints: pose.keypoints.map(({ score, part, position }) => ({\n score,\n part,\n position: [Math.trunc(position.x * scaleX), Math.trunc(position.y * scaleY)],\n positionRaw: [position.x / inputResolutionHeight, position.y / inputResolutionHeight],\n })),\n });\n const scaledPoses = poses.map((pose, i) => scalePose(pose, i));\n return scaledPoses;\n}\n\n// algorithm based on Coursera Lecture from Algorithms, Part 1: https://www.coursera.org/learn/algorithms-part1/lecture/ZjoSM/heapsort\nexport class MaxHeap {\n priorityQueue: Array; // don't touch\n numberOfElements: number;\n getElementValue: unknown; // function call\n\n constructor(maxSize, getElementValue) {\n this.priorityQueue = new Array(maxSize);\n this.numberOfElements = -1;\n this.getElementValue = getElementValue;\n }\n\n enqueue(x) {\n this.priorityQueue[++this.numberOfElements] = x;\n this.swim(this.numberOfElements);\n }\n\n dequeue() {\n const max = this.priorityQueue[0];\n this.exchange(0, this.numberOfElements--);\n this.sink(0);\n this.priorityQueue[this.numberOfElements + 1] = null;\n return max;\n }\n\n empty() { return this.numberOfElements === -1; }\n\n size() { return this.numberOfElements + 1; }\n\n all() { return this.priorityQueue.slice(0, this.numberOfElements + 1); }\n\n max() { return this.priorityQueue[0]; }\n\n swim(k) {\n while (k > 0 && this.less(Math.floor(k / 2), k)) {\n this.exchange(k, Math.floor(k / 2));\n k = Math.floor(k / 2);\n }\n }\n\n sink(k) {\n while (2 * k <= this.numberOfElements) {\n let j = 2 * k;\n if (j < this.numberOfElements && this.less(j, j + 1)) j++;\n if (!this.less(k, j)) break;\n this.exchange(k, j);\n k = j;\n }\n }\n\n getValueAt(i) {\n // @ts-ignore getter is of unknown type\n return this.getElementValue(this.priorityQueue[i]);\n }\n\n less(i, j) {\n return this.getValueAt(i) < this.getValueAt(j);\n }\n\n exchange(i, j) {\n const t = this.priorityQueue[i];\n this.priorityQueue[i] = this.priorityQueue[j];\n this.priorityQueue[j] = t;\n }\n}\n\nexport function getOffsetPoint(y, x, keypoint, offsets) {\n return {\n y: offsets.get(y, x, keypoint),\n x: offsets.get(y, x, keypoint + kpt.count),\n };\n}\n\nexport function getImageCoords(part, outputStride, offsets) {\n const { heatmapY, heatmapX, id: keypoint } = part;\n const { y, x } = getOffsetPoint(heatmapY, heatmapX, keypoint, offsets);\n return {\n x: part.heatmapX * outputStride + x,\n y: part.heatmapY * outputStride + y,\n };\n}\n\nexport function fillArray(element, size) {\n const result = new Array(size);\n for (let i = 0; i < size; i++) {\n result[i] = element;\n }\n return result;\n}\n\nexport function clamp(a, min, max) {\n if (a < min) return min;\n if (a > max) return max;\n return a;\n}\n\nexport function squaredDistance(y1, x1, y2, x2) {\n const dy = y2 - y1;\n const dx = x2 - x1;\n return dy * dy + dx * dx;\n}\n\nexport function addVectors(a, b) {\n return { x: a.x + b.x, y: a.y + b.y };\n}\n\nexport function clampVector(a, min, max) {\n return { y: clamp(a.y, min, max), x: clamp(a.x, min, max) };\n}\n", "import * as utils from './utils';\nimport * as kpt from './keypoints';\n\nconst localMaximumRadius = 1;\nconst outputStride = 16;\nconst squaredNmsRadius = 50 ** 2;\n\nfunction traverse(edgeId, sourceKeypoint, targetId, scores, offsets, displacements, offsetRefineStep = 2) {\n const getDisplacement = (point) => ({\n y: displacements.get(point.y, point.x, edgeId),\n x: displacements.get(point.y, point.x, (displacements.shape[2] / 2) + edgeId),\n });\n const getStridedIndexNearPoint = (point, height, width) => ({\n y: utils.clamp(Math.round(point.y / outputStride), 0, height - 1),\n x: utils.clamp(Math.round(point.x / outputStride), 0, width - 1),\n });\n\n const [height, width] = scores.shape;\n // Nearest neighbor interpolation for the source->target displacements.\n const sourceKeypointIndices = getStridedIndexNearPoint(sourceKeypoint.position, height, width);\n const displacement = getDisplacement(sourceKeypointIndices);\n const displacedPoint = utils.addVectors(sourceKeypoint.position, displacement);\n let targetKeypoint = displacedPoint;\n for (let i = 0; i < offsetRefineStep; i++) {\n const targetKeypointIndices = getStridedIndexNearPoint(targetKeypoint, height, width);\n const offsetPoint = utils.getOffsetPoint(targetKeypointIndices.y, targetKeypointIndices.x, targetId, offsets);\n targetKeypoint = utils.addVectors(\n { x: targetKeypointIndices.x * outputStride, y: targetKeypointIndices.y * outputStride },\n { x: offsetPoint.x, y: offsetPoint.y },\n );\n }\n const targetKeyPointIndices = getStridedIndexNearPoint(targetKeypoint, height, width);\n const score = scores.get(targetKeyPointIndices.y, targetKeyPointIndices.x, targetId);\n return { position: targetKeypoint, part: kpt.partNames[targetId], score };\n}\n\nexport function decodePose(root, scores, offsets, displacementsFwd, displacementsBwd) {\n const tuples = kpt.poseChain.map(([parentJoinName, childJoinName]) => ([kpt.partIds[parentJoinName], kpt.partIds[childJoinName]]));\n const edgesFwd = tuples.map(([, childJointId]) => childJointId);\n const edgesBwd = tuples.map(([parentJointId]) => parentJointId);\n const numParts = scores.shape[2]; // [21,21,17]\n const numEdges = edgesFwd.length;\n const keypoints = new Array(numParts);\n // Start a new detection instance at the position of the root.\n const rootPoint = utils.getImageCoords(root.part, outputStride, offsets);\n keypoints[root.part.id] = {\n score: root.score,\n part: kpt.partNames[root.part.id],\n position: rootPoint,\n };\n // Decode the part positions upwards in the tree, following the backward displacements.\n for (let edge = numEdges - 1; edge >= 0; --edge) {\n const sourceId = edgesFwd[edge];\n const targetId = edgesBwd[edge];\n if (keypoints[sourceId] && !keypoints[targetId]) {\n keypoints[targetId] = traverse(edge, keypoints[sourceId], targetId, scores, offsets, displacementsBwd);\n }\n }\n // Decode the part positions downwards in the tree, following the forward displacements.\n for (let edge = 0; edge < numEdges; ++edge) {\n const sourceId = edgesBwd[edge];\n const targetId = edgesFwd[edge];\n if (keypoints[sourceId] && !keypoints[targetId]) {\n keypoints[targetId] = traverse(edge, keypoints[sourceId], targetId, scores, offsets, displacementsFwd);\n }\n }\n return keypoints;\n}\n\nfunction scoreIsMaximumInLocalWindow(keypointId, score, heatmapY, heatmapX, scores) {\n const [height, width] = scores.shape;\n let localMaximum = true;\n const yStart = Math.max(heatmapY - localMaximumRadius, 0);\n const yEnd = Math.min(heatmapY + localMaximumRadius + 1, height);\n for (let yCurrent = yStart; yCurrent < yEnd; ++yCurrent) {\n const xStart = Math.max(heatmapX - localMaximumRadius, 0);\n const xEnd = Math.min(heatmapX + localMaximumRadius + 1, width);\n for (let xCurrent = xStart; xCurrent < xEnd; ++xCurrent) {\n if (scores.get(yCurrent, xCurrent, keypointId) > score) {\n localMaximum = false;\n break;\n }\n }\n if (!localMaximum) break;\n }\n return localMaximum;\n}\n\nexport function buildPartWithScoreQueue(minConfidence, scores) {\n const [height, width, numKeypoints] = scores.shape;\n const queue = new utils.MaxHeap(height * width * numKeypoints, ({ score }) => score);\n for (let heatmapY = 0; heatmapY < height; ++heatmapY) {\n for (let heatmapX = 0; heatmapX < width; ++heatmapX) {\n for (let keypointId = 0; keypointId < numKeypoints; ++keypointId) {\n const score = scores.get(heatmapY, heatmapX, keypointId);\n // Only consider parts with score greater or equal to threshold as root candidates.\n if (score < minConfidence) continue;\n // Only consider keypoints whose score is maximum in a local window.\n if (scoreIsMaximumInLocalWindow(keypointId, score, heatmapY, heatmapX, scores)) queue.enqueue({ score, part: { heatmapY, heatmapX, id: keypointId } });\n }\n }\n }\n return queue;\n}\n\nfunction withinRadius(poses, { x, y }, keypointId) {\n return poses.some(({ keypoints }) => {\n const correspondingKeypoint = keypoints[keypointId]?.position;\n if (!correspondingKeypoint) return false;\n return utils.squaredDistance(y, x, correspondingKeypoint.y, correspondingKeypoint.x) <= squaredNmsRadius;\n });\n}\n\nfunction getInstanceScore(existingPoses, keypoints) {\n const notOverlappedKeypointScores = keypoints.reduce((result, { position, score }, keypointId) => {\n if (!withinRadius(existingPoses, position, keypointId)) result += score;\n return result;\n }, 0.0);\n return notOverlappedKeypointScores / keypoints.length;\n}\n\nexport function decode(offsets, scores, displacementsFwd, displacementsBwd, maxDetected, minConfidence) {\n const poses: Array<{ keypoints, box: [number, number, number, number], score: number }> = [];\n const queue = buildPartWithScoreQueue(minConfidence, scores);\n // Generate at most maxDetected object instances per image in decreasing root part score order.\n while (poses.length < maxDetected && !queue.empty()) {\n // The top element in the queue is the next root candidate.\n const root = queue.dequeue();\n // Part-based non-maximum suppression: We reject a root candidate if it is within a disk of `nmsRadius` pixels from the corresponding part of a previously detected instance.\n // @ts-ignore this one is tree walk\n const rootImageCoords = utils.getImageCoords(root.part, outputStride, offsets);\n // @ts-ignore this one is tree walk\n if (withinRadius(poses, rootImageCoords, root.part.id)) continue;\n // Else start a new detection instance at the position of the root.\n let keypoints = decodePose(root, scores, offsets, displacementsFwd, displacementsBwd);\n keypoints = keypoints.filter((a) => a.score > minConfidence);\n const score = getInstanceScore(poses, keypoints);\n const box = utils.getBoundingBox(keypoints);\n if (score > minConfidence) poses.push({ keypoints, box, score: Math.round(100 * score) / 100 });\n }\n return poses;\n}\n", "/**\n * PoseNet module entry point\n */\n\nimport { log, join } from '../helpers';\nimport * as tf from '../../dist/tfjs.esm.js';\nimport * as poses from './poses';\nimport * as util from './utils';\nimport { Body } from '../result';\nimport { Tensor, GraphModel } from '../tfjs/types';\nimport { Config } from '../config';\n\nlet model: GraphModel;\nconst poseNetOutputs = ['MobilenetV1/offset_2/BiasAdd'/* offsets */, 'MobilenetV1/heatmap_2/BiasAdd'/* heatmapScores */, 'MobilenetV1/displacement_fwd_2/BiasAdd'/* displacementFwd */, 'MobilenetV1/displacement_bwd_2/BiasAdd'/* displacementBwd */];\n\nexport async function predict(input: Tensor, config: Config): Promise {\n const res = tf.tidy(() => {\n if (!model.inputs[0].shape) return [];\n const resized = tf.image.resizeBilinear(input, [model.inputs[0].shape[2], model.inputs[0].shape[1]]);\n const normalized = resized.toFloat().div(127.5).sub(1.0);\n const results: Array = model.execute(normalized, poseNetOutputs) as Array;\n const results3d = results.map((y) => tf.squeeze(y, [0]));\n results3d[1] = results3d[1].sigmoid(); // apply sigmoid on scores\n return results3d;\n });\n\n const buffers = await Promise.all(res.map((tensor) => tensor.buffer()));\n for (const t of res) t.dispose();\n\n const decoded = await poses.decode(buffers[0], buffers[1], buffers[2], buffers[3], config.body.maxDetected, config.body.minConfidence);\n if (!model.inputs[0].shape) return [];\n const scaled = util.scalePoses(decoded, [input.shape[1], input.shape[2]], [model.inputs[0].shape[2], model.inputs[0].shape[1]]) as Body[];\n return scaled;\n}\n\nexport async function load(config: Config): Promise {\n if (!model) {\n // @ts-ignore type mismatch for GraphModel\n model = await tf.loadGraphModel(join(config.modelBasePath, config.body.modelPath));\n if (!model || !model['modelUrl']) log('load model failed:', config.body.modelPath);\n else if (config.debug) log('load model:', model['modelUrl']);\n } else if (config.debug) log('cached model:', model['modelUrl']);\n return model;\n}\n", "import * as tf from '../../dist/tfjs.esm.js';\n\nexport function getBoxSize(box) {\n return [\n Math.abs(box.endPoint[0] - box.startPoint[0]),\n Math.abs(box.endPoint[1] - box.startPoint[1]),\n ];\n}\n\nexport function getBoxCenter(box) {\n return [\n box.startPoint[0] + (box.endPoint[0] - box.startPoint[0]) / 2,\n box.startPoint[1] + (box.endPoint[1] - box.startPoint[1]) / 2,\n ];\n}\n\nexport function cutBoxFromImageAndResize(box, image, cropSize) {\n const h = image.shape[1];\n const w = image.shape[2];\n const boxes = [[\n box.startPoint[1] / h,\n box.startPoint[0] / w,\n box.endPoint[1] / h,\n box.endPoint[0] / w,\n ]];\n return tf.image.cropAndResize(image, boxes, [0], cropSize);\n}\n\nexport function scaleBoxCoordinates(box, factor) {\n const startPoint = [box.startPoint[0] * factor[0], box.startPoint[1] * factor[1]];\n const endPoint = [box.endPoint[0] * factor[0], box.endPoint[1] * factor[1]];\n const palmLandmarks = box.palmLandmarks.map((coord) => {\n const scaledCoord = [coord[0] * factor[0], coord[1] * factor[1]];\n return scaledCoord;\n });\n return { startPoint, endPoint, palmLandmarks, confidence: box.confidence };\n}\n\nexport function enlargeBox(box, factor = 1.5) {\n const center = getBoxCenter(box);\n const size = getBoxSize(box);\n const newHalfSize = [factor * size[0] / 2, factor * size[1] / 2];\n const startPoint = [center[0] - newHalfSize[0], center[1] - newHalfSize[1]];\n const endPoint = [center[0] + newHalfSize[0], center[1] + newHalfSize[1]];\n return { startPoint, endPoint, palmLandmarks: box.palmLandmarks };\n}\n\nexport function squarifyBox(box) {\n const centers = getBoxCenter(box);\n const size = getBoxSize(box);\n const maxEdge = Math.max(...size);\n const halfSize = maxEdge / 2;\n const startPoint = [centers[0] - halfSize, centers[1] - halfSize];\n const endPoint = [centers[0] + halfSize, centers[1] + halfSize];\n return { startPoint, endPoint, palmLandmarks: box.palmLandmarks };\n}\n\nexport function shiftBox(box, shiftFactor) {\n const boxSize = [\n box.endPoint[0] - box.startPoint[0],\n box.endPoint[1] - box.startPoint[1],\n ];\n const shiftVector = [boxSize[0] * shiftFactor[0], boxSize[1] * shiftFactor[1]];\n const startPoint = [box.startPoint[0] + shiftVector[0], box.startPoint[1] + shiftVector[1]];\n const endPoint = [box.endPoint[0] + shiftVector[0], box.endPoint[1] + shiftVector[1]];\n return { startPoint, endPoint, palmLandmarks: box.palmLandmarks };\n}\n", "export const anchors = [\n { x: 0.015625, y: 0.015625 },\n { x: 0.015625, y: 0.015625 },\n { x: 0.046875, y: 0.015625 },\n { x: 0.046875, y: 0.015625 },\n { x: 0.078125, y: 0.015625 },\n { x: 0.078125, y: 0.015625 },\n { x: 0.109375, y: 0.015625 },\n { x: 0.109375, y: 0.015625 },\n { x: 0.140625, y: 0.015625 },\n { x: 0.140625, y: 0.015625 },\n { x: 0.171875, y: 0.015625 },\n { x: 0.171875, y: 0.015625 },\n { x: 0.203125, y: 0.015625 },\n { x: 0.203125, y: 0.015625 },\n { x: 0.234375, y: 0.015625 },\n { x: 0.234375, y: 0.015625 },\n { x: 0.265625, y: 0.015625 },\n { x: 0.265625, y: 0.015625 },\n { x: 0.296875, y: 0.015625 },\n { x: 0.296875, y: 0.015625 },\n { x: 0.328125, y: 0.015625 },\n { x: 0.328125, y: 0.015625 },\n { x: 0.359375, y: 0.015625 },\n { x: 0.359375, y: 0.015625 },\n { x: 0.390625, y: 0.015625 },\n { x: 0.390625, y: 0.015625 },\n { x: 0.421875, y: 0.015625 },\n { x: 0.421875, y: 0.015625 },\n { x: 0.453125, y: 0.015625 },\n { x: 0.453125, y: 0.015625 },\n { x: 0.484375, y: 0.015625 },\n { x: 0.484375, y: 0.015625 },\n { x: 0.515625, y: 0.015625 },\n { x: 0.515625, y: 0.015625 },\n { x: 0.546875, y: 0.015625 },\n { x: 0.546875, y: 0.015625 },\n { x: 0.578125, y: 0.015625 },\n { x: 0.578125, y: 0.015625 },\n { x: 0.609375, y: 0.015625 },\n { x: 0.609375, y: 0.015625 },\n { x: 0.640625, y: 0.015625 },\n { x: 0.640625, y: 0.015625 },\n { x: 0.671875, y: 0.015625 },\n { x: 0.671875, y: 0.015625 },\n { x: 0.703125, y: 0.015625 },\n { x: 0.703125, y: 0.015625 },\n { x: 0.734375, y: 0.015625 },\n { x: 0.734375, y: 0.015625 },\n { x: 0.765625, y: 0.015625 },\n { x: 0.765625, y: 0.015625 },\n { x: 0.796875, y: 0.015625 },\n { x: 0.796875, y: 0.015625 },\n { x: 0.828125, y: 0.015625 },\n { x: 0.828125, y: 0.015625 },\n { x: 0.859375, y: 0.015625 },\n { x: 0.859375, y: 0.015625 },\n { x: 0.890625, y: 0.015625 },\n { x: 0.890625, y: 0.015625 },\n { x: 0.921875, y: 0.015625 },\n { x: 0.921875, y: 0.015625 },\n { x: 0.953125, y: 0.015625 },\n { x: 0.953125, y: 0.015625 },\n { x: 0.984375, y: 0.015625 },\n { x: 0.984375, y: 0.015625 },\n { x: 0.015625, y: 0.046875 },\n { x: 0.015625, y: 0.046875 },\n { x: 0.046875, y: 0.046875 },\n { x: 0.046875, y: 0.046875 },\n { x: 0.078125, y: 0.046875 },\n { x: 0.078125, y: 0.046875 },\n { x: 0.109375, y: 0.046875 },\n { x: 0.109375, y: 0.046875 },\n { x: 0.140625, y: 0.046875 },\n { x: 0.140625, y: 0.046875 },\n { x: 0.171875, y: 0.046875 },\n { x: 0.171875, y: 0.046875 },\n { x: 0.203125, y: 0.046875 },\n { x: 0.203125, y: 0.046875 },\n { x: 0.234375, y: 0.046875 },\n { x: 0.234375, y: 0.046875 },\n { x: 0.265625, y: 0.046875 },\n { x: 0.265625, y: 0.046875 },\n { x: 0.296875, y: 0.046875 },\n { x: 0.296875, y: 0.046875 },\n { x: 0.328125, y: 0.046875 },\n { x: 0.328125, y: 0.046875 },\n { x: 0.359375, y: 0.046875 },\n { x: 0.359375, y: 0.046875 },\n { x: 0.390625, y: 0.046875 },\n { x: 0.390625, y: 0.046875 },\n { x: 0.421875, y: 0.046875 },\n { x: 0.421875, y: 0.046875 },\n { x: 0.453125, y: 0.046875 },\n { x: 0.453125, y: 0.046875 },\n { x: 0.484375, y: 0.046875 },\n { x: 0.484375, y: 0.046875 },\n { x: 0.515625, y: 0.046875 },\n { x: 0.515625, y: 0.046875 },\n { x: 0.546875, y: 0.046875 },\n { x: 0.546875, y: 0.046875 },\n { x: 0.578125, y: 0.046875 },\n { x: 0.578125, y: 0.046875 },\n { x: 0.609375, y: 0.046875 },\n { x: 0.609375, y: 0.046875 },\n { x: 0.640625, y: 0.046875 },\n { x: 0.640625, y: 0.046875 },\n { x: 0.671875, y: 0.046875 },\n { x: 0.671875, y: 0.046875 },\n { x: 0.703125, y: 0.046875 },\n { x: 0.703125, y: 0.046875 },\n { x: 0.734375, y: 0.046875 },\n { x: 0.734375, y: 0.046875 },\n { x: 0.765625, y: 0.046875 },\n { x: 0.765625, y: 0.046875 },\n { x: 0.796875, y: 0.046875 },\n { x: 0.796875, y: 0.046875 },\n { x: 0.828125, y: 0.046875 },\n { x: 0.828125, y: 0.046875 },\n { x: 0.859375, y: 0.046875 },\n { x: 0.859375, y: 0.046875 },\n { x: 0.890625, y: 0.046875 },\n { x: 0.890625, y: 0.046875 },\n { x: 0.921875, y: 0.046875 },\n { x: 0.921875, y: 0.046875 },\n { x: 0.953125, y: 0.046875 },\n { x: 0.953125, y: 0.046875 },\n { x: 0.984375, y: 0.046875 },\n { x: 0.984375, y: 0.046875 },\n { x: 0.015625, y: 0.078125 },\n { x: 0.015625, y: 0.078125 },\n { x: 0.046875, y: 0.078125 },\n { x: 0.046875, y: 0.078125 },\n { x: 0.078125, y: 0.078125 },\n { x: 0.078125, y: 0.078125 },\n { x: 0.109375, y: 0.078125 },\n { x: 0.109375, y: 0.078125 },\n { x: 0.140625, y: 0.078125 },\n { x: 0.140625, y: 0.078125 },\n { x: 0.171875, y: 0.078125 },\n { x: 0.171875, y: 0.078125 },\n { x: 0.203125, y: 0.078125 },\n { x: 0.203125, y: 0.078125 },\n { x: 0.234375, y: 0.078125 },\n { x: 0.234375, y: 0.078125 },\n { x: 0.265625, y: 0.078125 },\n { x: 0.265625, y: 0.078125 },\n { x: 0.296875, y: 0.078125 },\n { x: 0.296875, y: 0.078125 },\n { x: 0.328125, y: 0.078125 },\n { x: 0.328125, y: 0.078125 },\n { x: 0.359375, y: 0.078125 },\n { x: 0.359375, y: 0.078125 },\n { x: 0.390625, y: 0.078125 },\n { x: 0.390625, y: 0.078125 },\n { x: 0.421875, y: 0.078125 },\n { x: 0.421875, y: 0.078125 },\n { x: 0.453125, y: 0.078125 },\n { x: 0.453125, y: 0.078125 },\n { x: 0.484375, y: 0.078125 },\n { x: 0.484375, y: 0.078125 },\n { x: 0.515625, y: 0.078125 },\n { x: 0.515625, y: 0.078125 },\n { x: 0.546875, y: 0.078125 },\n { x: 0.546875, y: 0.078125 },\n { x: 0.578125, y: 0.078125 },\n { x: 0.578125, y: 0.078125 },\n { x: 0.609375, y: 0.078125 },\n { x: 0.609375, y: 0.078125 },\n { x: 0.640625, y: 0.078125 },\n { x: 0.640625, y: 0.078125 },\n { x: 0.671875, y: 0.078125 },\n { x: 0.671875, y: 0.078125 },\n { x: 0.703125, y: 0.078125 },\n { x: 0.703125, y: 0.078125 },\n { x: 0.734375, y: 0.078125 },\n { x: 0.734375, y: 0.078125 },\n { x: 0.765625, y: 0.078125 },\n { x: 0.765625, y: 0.078125 },\n { x: 0.796875, y: 0.078125 },\n { x: 0.796875, y: 0.078125 },\n { x: 0.828125, y: 0.078125 },\n { x: 0.828125, y: 0.078125 },\n { x: 0.859375, y: 0.078125 },\n { x: 0.859375, y: 0.078125 },\n { x: 0.890625, y: 0.078125 },\n { x: 0.890625, y: 0.078125 },\n { x: 0.921875, y: 0.078125 },\n { x: 0.921875, y: 0.078125 },\n { x: 0.953125, y: 0.078125 },\n { x: 0.953125, y: 0.078125 },\n { x: 0.984375, y: 0.078125 },\n { x: 0.984375, y: 0.078125 },\n { x: 0.015625, y: 0.109375 },\n { x: 0.015625, y: 0.109375 },\n { x: 0.046875, y: 0.109375 },\n { x: 0.046875, y: 0.109375 },\n { x: 0.078125, y: 0.109375 },\n { x: 0.078125, y: 0.109375 },\n { x: 0.109375, y: 0.109375 },\n { x: 0.109375, y: 0.109375 },\n { x: 0.140625, y: 0.109375 },\n { x: 0.140625, y: 0.109375 },\n { x: 0.171875, y: 0.109375 },\n { x: 0.171875, y: 0.109375 },\n { x: 0.203125, y: 0.109375 },\n { x: 0.203125, y: 0.109375 },\n { x: 0.234375, y: 0.109375 },\n { x: 0.234375, y: 0.109375 },\n { x: 0.265625, y: 0.109375 },\n { x: 0.265625, y: 0.109375 },\n { x: 0.296875, y: 0.109375 },\n { x: 0.296875, y: 0.109375 },\n { x: 0.328125, y: 0.109375 },\n { x: 0.328125, y: 0.109375 },\n { x: 0.359375, y: 0.109375 },\n { x: 0.359375, y: 0.109375 },\n { x: 0.390625, y: 0.109375 },\n { x: 0.390625, y: 0.109375 },\n { x: 0.421875, y: 0.109375 },\n { x: 0.421875, y: 0.109375 },\n { x: 0.453125, y: 0.109375 },\n { x: 0.453125, y: 0.109375 },\n { x: 0.484375, y: 0.109375 },\n { x: 0.484375, y: 0.109375 },\n { x: 0.515625, y: 0.109375 },\n { x: 0.515625, y: 0.109375 },\n { x: 0.546875, y: 0.109375 },\n { x: 0.546875, y: 0.109375 },\n { x: 0.578125, y: 0.109375 },\n { x: 0.578125, y: 0.109375 },\n { x: 0.609375, y: 0.109375 },\n { x: 0.609375, y: 0.109375 },\n { x: 0.640625, y: 0.109375 },\n { x: 0.640625, y: 0.109375 },\n { x: 0.671875, y: 0.109375 },\n { x: 0.671875, y: 0.109375 },\n { x: 0.703125, y: 0.109375 },\n { x: 0.703125, y: 0.109375 },\n { x: 0.734375, y: 0.109375 },\n { x: 0.734375, y: 0.109375 },\n { x: 0.765625, y: 0.109375 },\n { x: 0.765625, y: 0.109375 },\n { x: 0.796875, y: 0.109375 },\n { x: 0.796875, y: 0.109375 },\n { x: 0.828125, y: 0.109375 },\n { x: 0.828125, y: 0.109375 },\n { x: 0.859375, y: 0.109375 },\n { x: 0.859375, y: 0.109375 },\n { x: 0.890625, y: 0.109375 },\n { x: 0.890625, y: 0.109375 },\n { x: 0.921875, y: 0.109375 },\n { x: 0.921875, y: 0.109375 },\n { x: 0.953125, y: 0.109375 },\n { x: 0.953125, y: 0.109375 },\n { x: 0.984375, y: 0.109375 },\n { x: 0.984375, y: 0.109375 },\n { x: 0.015625, y: 0.140625 },\n { x: 0.015625, y: 0.140625 },\n { x: 0.046875, y: 0.140625 },\n { x: 0.046875, y: 0.140625 },\n { x: 0.078125, y: 0.140625 },\n { x: 0.078125, y: 0.140625 },\n { x: 0.109375, y: 0.140625 },\n { x: 0.109375, y: 0.140625 },\n { x: 0.140625, y: 0.140625 },\n { x: 0.140625, y: 0.140625 },\n { x: 0.171875, y: 0.140625 },\n { x: 0.171875, y: 0.140625 },\n { x: 0.203125, y: 0.140625 },\n { x: 0.203125, y: 0.140625 },\n { x: 0.234375, y: 0.140625 },\n { x: 0.234375, y: 0.140625 },\n { x: 0.265625, y: 0.140625 },\n { x: 0.265625, y: 0.140625 },\n { x: 0.296875, y: 0.140625 },\n { x: 0.296875, y: 0.140625 },\n { x: 0.328125, y: 0.140625 },\n { x: 0.328125, y: 0.140625 },\n { x: 0.359375, y: 0.140625 },\n { x: 0.359375, y: 0.140625 },\n { x: 0.390625, y: 0.140625 },\n { x: 0.390625, y: 0.140625 },\n { x: 0.421875, y: 0.140625 },\n { x: 0.421875, y: 0.140625 },\n { x: 0.453125, y: 0.140625 },\n { x: 0.453125, y: 0.140625 },\n { x: 0.484375, y: 0.140625 },\n { x: 0.484375, y: 0.140625 },\n { x: 0.515625, y: 0.140625 },\n { x: 0.515625, y: 0.140625 },\n { x: 0.546875, y: 0.140625 },\n { x: 0.546875, y: 0.140625 },\n { x: 0.578125, y: 0.140625 },\n { x: 0.578125, y: 0.140625 },\n { x: 0.609375, y: 0.140625 },\n { x: 0.609375, y: 0.140625 },\n { x: 0.640625, y: 0.140625 },\n { x: 0.640625, y: 0.140625 },\n { x: 0.671875, y: 0.140625 },\n { x: 0.671875, y: 0.140625 },\n { x: 0.703125, y: 0.140625 },\n { x: 0.703125, y: 0.140625 },\n { x: 0.734375, y: 0.140625 },\n { x: 0.734375, y: 0.140625 },\n { x: 0.765625, y: 0.140625 },\n { x: 0.765625, y: 0.140625 },\n { x: 0.796875, y: 0.140625 },\n { x: 0.796875, y: 0.140625 },\n { x: 0.828125, y: 0.140625 },\n { x: 0.828125, y: 0.140625 },\n { x: 0.859375, y: 0.140625 },\n { x: 0.859375, y: 0.140625 },\n { x: 0.890625, y: 0.140625 },\n { x: 0.890625, y: 0.140625 },\n { x: 0.921875, y: 0.140625 },\n { x: 0.921875, y: 0.140625 },\n { x: 0.953125, y: 0.140625 },\n { x: 0.953125, y: 0.140625 },\n { x: 0.984375, y: 0.140625 },\n { x: 0.984375, y: 0.140625 },\n { x: 0.015625, y: 0.171875 },\n { x: 0.015625, y: 0.171875 },\n { x: 0.046875, y: 0.171875 },\n { x: 0.046875, y: 0.171875 },\n { x: 0.078125, y: 0.171875 },\n { x: 0.078125, y: 0.171875 },\n { x: 0.109375, y: 0.171875 },\n { x: 0.109375, y: 0.171875 },\n { x: 0.140625, y: 0.171875 },\n { x: 0.140625, y: 0.171875 },\n { x: 0.171875, y: 0.171875 },\n { x: 0.171875, y: 0.171875 },\n { x: 0.203125, y: 0.171875 },\n { x: 0.203125, y: 0.171875 },\n { x: 0.234375, y: 0.171875 },\n { x: 0.234375, y: 0.171875 },\n { x: 0.265625, y: 0.171875 },\n { x: 0.265625, y: 0.171875 },\n { x: 0.296875, y: 0.171875 },\n { x: 0.296875, y: 0.171875 },\n { x: 0.328125, y: 0.171875 },\n { x: 0.328125, y: 0.171875 },\n { x: 0.359375, y: 0.171875 },\n { x: 0.359375, y: 0.171875 },\n { x: 0.390625, y: 0.171875 },\n { x: 0.390625, y: 0.171875 },\n { x: 0.421875, y: 0.171875 },\n { x: 0.421875, y: 0.171875 },\n { x: 0.453125, y: 0.171875 },\n { x: 0.453125, y: 0.171875 },\n { x: 0.484375, y: 0.171875 },\n { x: 0.484375, y: 0.171875 },\n { x: 0.515625, y: 0.171875 },\n { x: 0.515625, y: 0.171875 },\n { x: 0.546875, y: 0.171875 },\n { x: 0.546875, y: 0.171875 },\n { x: 0.578125, y: 0.171875 },\n { x: 0.578125, y: 0.171875 },\n { x: 0.609375, y: 0.171875 },\n { x: 0.609375, y: 0.171875 },\n { x: 0.640625, y: 0.171875 },\n { x: 0.640625, y: 0.171875 },\n { x: 0.671875, y: 0.171875 },\n { x: 0.671875, y: 0.171875 },\n { x: 0.703125, y: 0.171875 },\n { x: 0.703125, y: 0.171875 },\n { x: 0.734375, y: 0.171875 },\n { x: 0.734375, y: 0.171875 },\n { x: 0.765625, y: 0.171875 },\n { x: 0.765625, y: 0.171875 },\n { x: 0.796875, y: 0.171875 },\n { x: 0.796875, y: 0.171875 },\n { x: 0.828125, y: 0.171875 },\n { x: 0.828125, y: 0.171875 },\n { x: 0.859375, y: 0.171875 },\n { x: 0.859375, y: 0.171875 },\n { x: 0.890625, y: 0.171875 },\n { x: 0.890625, y: 0.171875 },\n { x: 0.921875, y: 0.171875 },\n { x: 0.921875, y: 0.171875 },\n { x: 0.953125, y: 0.171875 },\n { x: 0.953125, y: 0.171875 },\n { x: 0.984375, y: 0.171875 },\n { x: 0.984375, y: 0.171875 },\n { x: 0.015625, y: 0.203125 },\n { x: 0.015625, y: 0.203125 },\n { x: 0.046875, y: 0.203125 },\n { x: 0.046875, y: 0.203125 },\n { x: 0.078125, y: 0.203125 },\n { x: 0.078125, y: 0.203125 },\n { x: 0.109375, y: 0.203125 },\n { x: 0.109375, y: 0.203125 },\n { x: 0.140625, y: 0.203125 },\n { x: 0.140625, y: 0.203125 },\n { x: 0.171875, y: 0.203125 },\n { x: 0.171875, y: 0.203125 },\n { x: 0.203125, y: 0.203125 },\n { x: 0.203125, y: 0.203125 },\n { x: 0.234375, y: 0.203125 },\n { x: 0.234375, y: 0.203125 },\n { x: 0.265625, y: 0.203125 },\n { x: 0.265625, y: 0.203125 },\n { x: 0.296875, y: 0.203125 },\n { x: 0.296875, y: 0.203125 },\n { x: 0.328125, y: 0.203125 },\n { x: 0.328125, y: 0.203125 },\n { x: 0.359375, y: 0.203125 },\n { x: 0.359375, y: 0.203125 },\n { x: 0.390625, y: 0.203125 },\n { x: 0.390625, y: 0.203125 },\n { x: 0.421875, y: 0.203125 },\n { x: 0.421875, y: 0.203125 },\n { x: 0.453125, y: 0.203125 },\n { x: 0.453125, y: 0.203125 },\n { x: 0.484375, y: 0.203125 },\n { x: 0.484375, y: 0.203125 },\n { x: 0.515625, y: 0.203125 },\n { x: 0.515625, y: 0.203125 },\n { x: 0.546875, y: 0.203125 },\n { x: 0.546875, y: 0.203125 },\n { x: 0.578125, y: 0.203125 },\n { x: 0.578125, y: 0.203125 },\n { x: 0.609375, y: 0.203125 },\n { x: 0.609375, y: 0.203125 },\n { x: 0.640625, y: 0.203125 },\n { x: 0.640625, y: 0.203125 },\n { x: 0.671875, y: 0.203125 },\n { x: 0.671875, y: 0.203125 },\n { x: 0.703125, y: 0.203125 },\n { x: 0.703125, y: 0.203125 },\n { x: 0.734375, y: 0.203125 },\n { x: 0.734375, y: 0.203125 },\n { x: 0.765625, y: 0.203125 },\n { x: 0.765625, y: 0.203125 },\n { x: 0.796875, y: 0.203125 },\n { x: 0.796875, y: 0.203125 },\n { x: 0.828125, y: 0.203125 },\n { x: 0.828125, y: 0.203125 },\n { x: 0.859375, y: 0.203125 },\n { x: 0.859375, y: 0.203125 },\n { x: 0.890625, y: 0.203125 },\n { x: 0.890625, y: 0.203125 },\n { x: 0.921875, y: 0.203125 },\n { x: 0.921875, y: 0.203125 },\n { x: 0.953125, y: 0.203125 },\n { x: 0.953125, y: 0.203125 },\n { x: 0.984375, y: 0.203125 },\n { x: 0.984375, y: 0.203125 },\n { x: 0.015625, y: 0.234375 },\n { x: 0.015625, y: 0.234375 },\n { x: 0.046875, y: 0.234375 },\n { x: 0.046875, y: 0.234375 },\n { x: 0.078125, y: 0.234375 },\n { x: 0.078125, y: 0.234375 },\n { x: 0.109375, y: 0.234375 },\n { x: 0.109375, y: 0.234375 },\n { x: 0.140625, y: 0.234375 },\n { x: 0.140625, y: 0.234375 },\n { x: 0.171875, y: 0.234375 },\n { x: 0.171875, y: 0.234375 },\n { x: 0.203125, y: 0.234375 },\n { x: 0.203125, y: 0.234375 },\n { x: 0.234375, y: 0.234375 },\n { x: 0.234375, y: 0.234375 },\n { x: 0.265625, y: 0.234375 },\n { x: 0.265625, y: 0.234375 },\n { x: 0.296875, y: 0.234375 },\n { x: 0.296875, y: 0.234375 },\n { x: 0.328125, y: 0.234375 },\n { x: 0.328125, y: 0.234375 },\n { x: 0.359375, y: 0.234375 },\n { x: 0.359375, y: 0.234375 },\n { x: 0.390625, y: 0.234375 },\n { x: 0.390625, y: 0.234375 },\n { x: 0.421875, y: 0.234375 },\n { x: 0.421875, y: 0.234375 },\n { x: 0.453125, y: 0.234375 },\n { x: 0.453125, y: 0.234375 },\n { x: 0.484375, y: 0.234375 },\n { x: 0.484375, y: 0.234375 },\n { x: 0.515625, y: 0.234375 },\n { x: 0.515625, y: 0.234375 },\n { x: 0.546875, y: 0.234375 },\n { x: 0.546875, y: 0.234375 },\n { x: 0.578125, y: 0.234375 },\n { x: 0.578125, y: 0.234375 },\n { x: 0.609375, y: 0.234375 },\n { x: 0.609375, y: 0.234375 },\n { x: 0.640625, y: 0.234375 },\n { x: 0.640625, y: 0.234375 },\n { x: 0.671875, y: 0.234375 },\n { x: 0.671875, y: 0.234375 },\n { x: 0.703125, y: 0.234375 },\n { x: 0.703125, y: 0.234375 },\n { x: 0.734375, y: 0.234375 },\n { x: 0.734375, y: 0.234375 },\n { x: 0.765625, y: 0.234375 },\n { x: 0.765625, y: 0.234375 },\n { x: 0.796875, y: 0.234375 },\n { x: 0.796875, y: 0.234375 },\n { x: 0.828125, y: 0.234375 },\n { x: 0.828125, y: 0.234375 },\n { x: 0.859375, y: 0.234375 },\n { x: 0.859375, y: 0.234375 },\n { x: 0.890625, y: 0.234375 },\n { x: 0.890625, y: 0.234375 },\n { x: 0.921875, y: 0.234375 },\n { x: 0.921875, y: 0.234375 },\n { x: 0.953125, y: 0.234375 },\n { x: 0.953125, y: 0.234375 },\n { x: 0.984375, y: 0.234375 },\n { x: 0.984375, y: 0.234375 },\n { x: 0.015625, y: 0.265625 },\n { x: 0.015625, y: 0.265625 },\n { x: 0.046875, y: 0.265625 },\n { x: 0.046875, y: 0.265625 },\n { x: 0.078125, y: 0.265625 },\n { x: 0.078125, y: 0.265625 },\n { x: 0.109375, y: 0.265625 },\n { x: 0.109375, y: 0.265625 },\n { x: 0.140625, y: 0.265625 },\n { x: 0.140625, y: 0.265625 },\n { x: 0.171875, y: 0.265625 },\n { x: 0.171875, y: 0.265625 },\n { x: 0.203125, y: 0.265625 },\n { x: 0.203125, y: 0.265625 },\n { x: 0.234375, y: 0.265625 },\n { x: 0.234375, y: 0.265625 },\n { x: 0.265625, y: 0.265625 },\n { x: 0.265625, y: 0.265625 },\n { x: 0.296875, y: 0.265625 },\n { x: 0.296875, y: 0.265625 },\n { x: 0.328125, y: 0.265625 },\n { x: 0.328125, y: 0.265625 },\n { x: 0.359375, y: 0.265625 },\n { x: 0.359375, y: 0.265625 },\n { x: 0.390625, y: 0.265625 },\n { x: 0.390625, y: 0.265625 },\n { x: 0.421875, y: 0.265625 },\n { x: 0.421875, y: 0.265625 },\n { x: 0.453125, y: 0.265625 },\n { x: 0.453125, y: 0.265625 },\n { x: 0.484375, y: 0.265625 },\n { x: 0.484375, y: 0.265625 },\n { x: 0.515625, y: 0.265625 },\n { x: 0.515625, y: 0.265625 },\n { x: 0.546875, y: 0.265625 },\n { x: 0.546875, y: 0.265625 },\n { x: 0.578125, y: 0.265625 },\n { x: 0.578125, y: 0.265625 },\n { x: 0.609375, y: 0.265625 },\n { x: 0.609375, y: 0.265625 },\n { x: 0.640625, y: 0.265625 },\n { x: 0.640625, y: 0.265625 },\n { x: 0.671875, y: 0.265625 },\n { x: 0.671875, y: 0.265625 },\n { x: 0.703125, y: 0.265625 },\n { x: 0.703125, y: 0.265625 },\n { x: 0.734375, y: 0.265625 },\n { x: 0.734375, y: 0.265625 },\n { x: 0.765625, y: 0.265625 },\n { x: 0.765625, y: 0.265625 },\n { x: 0.796875, y: 0.265625 },\n { x: 0.796875, y: 0.265625 },\n { x: 0.828125, y: 0.265625 },\n { x: 0.828125, y: 0.265625 },\n { x: 0.859375, y: 0.265625 },\n { x: 0.859375, y: 0.265625 },\n { x: 0.890625, y: 0.265625 },\n { x: 0.890625, y: 0.265625 },\n { x: 0.921875, y: 0.265625 },\n { x: 0.921875, y: 0.265625 },\n { x: 0.953125, y: 0.265625 },\n { x: 0.953125, y: 0.265625 },\n { x: 0.984375, y: 0.265625 },\n { x: 0.984375, y: 0.265625 },\n { x: 0.015625, y: 0.296875 },\n { x: 0.015625, y: 0.296875 },\n { x: 0.046875, y: 0.296875 },\n { x: 0.046875, y: 0.296875 },\n { x: 0.078125, y: 0.296875 },\n { x: 0.078125, y: 0.296875 },\n { x: 0.109375, y: 0.296875 },\n { x: 0.109375, y: 0.296875 },\n { x: 0.140625, y: 0.296875 },\n { x: 0.140625, y: 0.296875 },\n { x: 0.171875, y: 0.296875 },\n { x: 0.171875, y: 0.296875 },\n { x: 0.203125, y: 0.296875 },\n { x: 0.203125, y: 0.296875 },\n { x: 0.234375, y: 0.296875 },\n { x: 0.234375, y: 0.296875 },\n { x: 0.265625, y: 0.296875 },\n { x: 0.265625, y: 0.296875 },\n { x: 0.296875, y: 0.296875 },\n { x: 0.296875, y: 0.296875 },\n { x: 0.328125, y: 0.296875 },\n { x: 0.328125, y: 0.296875 },\n { x: 0.359375, y: 0.296875 },\n { x: 0.359375, y: 0.296875 },\n { x: 0.390625, y: 0.296875 },\n { x: 0.390625, y: 0.296875 },\n { x: 0.421875, y: 0.296875 },\n { x: 0.421875, y: 0.296875 },\n { x: 0.453125, y: 0.296875 },\n { x: 0.453125, y: 0.296875 },\n { x: 0.484375, y: 0.296875 },\n { x: 0.484375, y: 0.296875 },\n { x: 0.515625, y: 0.296875 },\n { x: 0.515625, y: 0.296875 },\n { x: 0.546875, y: 0.296875 },\n { x: 0.546875, y: 0.296875 },\n { x: 0.578125, y: 0.296875 },\n { x: 0.578125, y: 0.296875 },\n { x: 0.609375, y: 0.296875 },\n { x: 0.609375, y: 0.296875 },\n { x: 0.640625, y: 0.296875 },\n { x: 0.640625, y: 0.296875 },\n { x: 0.671875, y: 0.296875 },\n { x: 0.671875, y: 0.296875 },\n { x: 0.703125, y: 0.296875 },\n { x: 0.703125, y: 0.296875 },\n { x: 0.734375, y: 0.296875 },\n { x: 0.734375, y: 0.296875 },\n { x: 0.765625, y: 0.296875 },\n { x: 0.765625, y: 0.296875 },\n { x: 0.796875, y: 0.296875 },\n { x: 0.796875, y: 0.296875 },\n { x: 0.828125, y: 0.296875 },\n { x: 0.828125, y: 0.296875 },\n { x: 0.859375, y: 0.296875 },\n { x: 0.859375, y: 0.296875 },\n { x: 0.890625, y: 0.296875 },\n { x: 0.890625, y: 0.296875 },\n { x: 0.921875, y: 0.296875 },\n { x: 0.921875, y: 0.296875 },\n { x: 0.953125, y: 0.296875 },\n { x: 0.953125, y: 0.296875 },\n { x: 0.984375, y: 0.296875 },\n { x: 0.984375, y: 0.296875 },\n { x: 0.015625, y: 0.328125 },\n { x: 0.015625, y: 0.328125 },\n { x: 0.046875, y: 0.328125 },\n { x: 0.046875, y: 0.328125 },\n { x: 0.078125, y: 0.328125 },\n { x: 0.078125, y: 0.328125 },\n { x: 0.109375, y: 0.328125 },\n { x: 0.109375, y: 0.328125 },\n { x: 0.140625, y: 0.328125 },\n { x: 0.140625, y: 0.328125 },\n { x: 0.171875, y: 0.328125 },\n { x: 0.171875, y: 0.328125 },\n { x: 0.203125, y: 0.328125 },\n { x: 0.203125, y: 0.328125 },\n { x: 0.234375, y: 0.328125 },\n { x: 0.234375, y: 0.328125 },\n { x: 0.265625, y: 0.328125 },\n { x: 0.265625, y: 0.328125 },\n { x: 0.296875, y: 0.328125 },\n { x: 0.296875, y: 0.328125 },\n { x: 0.328125, y: 0.328125 },\n { x: 0.328125, y: 0.328125 },\n { x: 0.359375, y: 0.328125 },\n { x: 0.359375, y: 0.328125 },\n { x: 0.390625, y: 0.328125 },\n { x: 0.390625, y: 0.328125 },\n { x: 0.421875, y: 0.328125 },\n { x: 0.421875, y: 0.328125 },\n { x: 0.453125, y: 0.328125 },\n { x: 0.453125, y: 0.328125 },\n { x: 0.484375, y: 0.328125 },\n { x: 0.484375, y: 0.328125 },\n { x: 0.515625, y: 0.328125 },\n { x: 0.515625, y: 0.328125 },\n { x: 0.546875, y: 0.328125 },\n { x: 0.546875, y: 0.328125 },\n { x: 0.578125, y: 0.328125 },\n { x: 0.578125, y: 0.328125 },\n { x: 0.609375, y: 0.328125 },\n { x: 0.609375, y: 0.328125 },\n { x: 0.640625, y: 0.328125 },\n { x: 0.640625, y: 0.328125 },\n { x: 0.671875, y: 0.328125 },\n { x: 0.671875, y: 0.328125 },\n { x: 0.703125, y: 0.328125 },\n { x: 0.703125, y: 0.328125 },\n { x: 0.734375, y: 0.328125 },\n { x: 0.734375, y: 0.328125 },\n { x: 0.765625, y: 0.328125 },\n { x: 0.765625, y: 0.328125 },\n { x: 0.796875, y: 0.328125 },\n { x: 0.796875, y: 0.328125 },\n { x: 0.828125, y: 0.328125 },\n { x: 0.828125, y: 0.328125 },\n { x: 0.859375, y: 0.328125 },\n { x: 0.859375, y: 0.328125 },\n { x: 0.890625, y: 0.328125 },\n { x: 0.890625, y: 0.328125 },\n { x: 0.921875, y: 0.328125 },\n { x: 0.921875, y: 0.328125 },\n { x: 0.953125, y: 0.328125 },\n { x: 0.953125, y: 0.328125 },\n { x: 0.984375, y: 0.328125 },\n { x: 0.984375, y: 0.328125 },\n { x: 0.015625, y: 0.359375 },\n { x: 0.015625, y: 0.359375 },\n { x: 0.046875, y: 0.359375 },\n { x: 0.046875, y: 0.359375 },\n { x: 0.078125, y: 0.359375 },\n { x: 0.078125, y: 0.359375 },\n { x: 0.109375, y: 0.359375 },\n { x: 0.109375, y: 0.359375 },\n { x: 0.140625, y: 0.359375 },\n { x: 0.140625, y: 0.359375 },\n { x: 0.171875, y: 0.359375 },\n { x: 0.171875, y: 0.359375 },\n { x: 0.203125, y: 0.359375 },\n { x: 0.203125, y: 0.359375 },\n { x: 0.234375, y: 0.359375 },\n { x: 0.234375, y: 0.359375 },\n { x: 0.265625, y: 0.359375 },\n { x: 0.265625, y: 0.359375 },\n { x: 0.296875, y: 0.359375 },\n { x: 0.296875, y: 0.359375 },\n { x: 0.328125, y: 0.359375 },\n { x: 0.328125, y: 0.359375 },\n { x: 0.359375, y: 0.359375 },\n { x: 0.359375, y: 0.359375 },\n { x: 0.390625, y: 0.359375 },\n { x: 0.390625, y: 0.359375 },\n { x: 0.421875, y: 0.359375 },\n { x: 0.421875, y: 0.359375 },\n { x: 0.453125, y: 0.359375 },\n { x: 0.453125, y: 0.359375 },\n { x: 0.484375, y: 0.359375 },\n { x: 0.484375, y: 0.359375 },\n { x: 0.515625, y: 0.359375 },\n { x: 0.515625, y: 0.359375 },\n { x: 0.546875, y: 0.359375 },\n { x: 0.546875, y: 0.359375 },\n { x: 0.578125, y: 0.359375 },\n { x: 0.578125, y: 0.359375 },\n { x: 0.609375, y: 0.359375 },\n { x: 0.609375, y: 0.359375 },\n { x: 0.640625, y: 0.359375 },\n { x: 0.640625, y: 0.359375 },\n { x: 0.671875, y: 0.359375 },\n { x: 0.671875, y: 0.359375 },\n { x: 0.703125, y: 0.359375 },\n { x: 0.703125, y: 0.359375 },\n { x: 0.734375, y: 0.359375 },\n { x: 0.734375, y: 0.359375 },\n { x: 0.765625, y: 0.359375 },\n { x: 0.765625, y: 0.359375 },\n { x: 0.796875, y: 0.359375 },\n { x: 0.796875, y: 0.359375 },\n { x: 0.828125, y: 0.359375 },\n { x: 0.828125, y: 0.359375 },\n { x: 0.859375, y: 0.359375 },\n { x: 0.859375, y: 0.359375 },\n { x: 0.890625, y: 0.359375 },\n { x: 0.890625, y: 0.359375 },\n { x: 0.921875, y: 0.359375 },\n { x: 0.921875, y: 0.359375 },\n { x: 0.953125, y: 0.359375 },\n { x: 0.953125, y: 0.359375 },\n { x: 0.984375, y: 0.359375 },\n { x: 0.984375, y: 0.359375 },\n { x: 0.015625, y: 0.390625 },\n { x: 0.015625, y: 0.390625 },\n { x: 0.046875, y: 0.390625 },\n { x: 0.046875, y: 0.390625 },\n { x: 0.078125, y: 0.390625 },\n { x: 0.078125, y: 0.390625 },\n { x: 0.109375, y: 0.390625 },\n { x: 0.109375, y: 0.390625 },\n { x: 0.140625, y: 0.390625 },\n { x: 0.140625, y: 0.390625 },\n { x: 0.171875, y: 0.390625 },\n { x: 0.171875, y: 0.390625 },\n { x: 0.203125, y: 0.390625 },\n { x: 0.203125, y: 0.390625 },\n { x: 0.234375, y: 0.390625 },\n { x: 0.234375, y: 0.390625 },\n { x: 0.265625, y: 0.390625 },\n { x: 0.265625, y: 0.390625 },\n { x: 0.296875, y: 0.390625 },\n { x: 0.296875, y: 0.390625 },\n { x: 0.328125, y: 0.390625 },\n { x: 0.328125, y: 0.390625 },\n { x: 0.359375, y: 0.390625 },\n { x: 0.359375, y: 0.390625 },\n { x: 0.390625, y: 0.390625 },\n { x: 0.390625, y: 0.390625 },\n { x: 0.421875, y: 0.390625 },\n { x: 0.421875, y: 0.390625 },\n { x: 0.453125, y: 0.390625 },\n { x: 0.453125, y: 0.390625 },\n { x: 0.484375, y: 0.390625 },\n { x: 0.484375, y: 0.390625 },\n { x: 0.515625, y: 0.390625 },\n { x: 0.515625, y: 0.390625 },\n { x: 0.546875, y: 0.390625 },\n { x: 0.546875, y: 0.390625 },\n { x: 0.578125, y: 0.390625 },\n { x: 0.578125, y: 0.390625 },\n { x: 0.609375, y: 0.390625 },\n { x: 0.609375, y: 0.390625 },\n { x: 0.640625, y: 0.390625 },\n { x: 0.640625, y: 0.390625 },\n { x: 0.671875, y: 0.390625 },\n { x: 0.671875, y: 0.390625 },\n { x: 0.703125, y: 0.390625 },\n { x: 0.703125, y: 0.390625 },\n { x: 0.734375, y: 0.390625 },\n { x: 0.734375, y: 0.390625 },\n { x: 0.765625, y: 0.390625 },\n { x: 0.765625, y: 0.390625 },\n { x: 0.796875, y: 0.390625 },\n { x: 0.796875, y: 0.390625 },\n { x: 0.828125, y: 0.390625 },\n { x: 0.828125, y: 0.390625 },\n { x: 0.859375, y: 0.390625 },\n { x: 0.859375, y: 0.390625 },\n { x: 0.890625, y: 0.390625 },\n { x: 0.890625, y: 0.390625 },\n { x: 0.921875, y: 0.390625 },\n { x: 0.921875, y: 0.390625 },\n { x: 0.953125, y: 0.390625 },\n { x: 0.953125, y: 0.390625 },\n { x: 0.984375, y: 0.390625 },\n { x: 0.984375, y: 0.390625 },\n { x: 0.015625, y: 0.421875 },\n { x: 0.015625, y: 0.421875 },\n { x: 0.046875, y: 0.421875 },\n { x: 0.046875, y: 0.421875 },\n { x: 0.078125, y: 0.421875 },\n { x: 0.078125, y: 0.421875 },\n { x: 0.109375, y: 0.421875 },\n { x: 0.109375, y: 0.421875 },\n { x: 0.140625, y: 0.421875 },\n { x: 0.140625, y: 0.421875 },\n { x: 0.171875, y: 0.421875 },\n { x: 0.171875, y: 0.421875 },\n { x: 0.203125, y: 0.421875 },\n { x: 0.203125, y: 0.421875 },\n { x: 0.234375, y: 0.421875 },\n { x: 0.234375, y: 0.421875 },\n { x: 0.265625, y: 0.421875 },\n { x: 0.265625, y: 0.421875 },\n { x: 0.296875, y: 0.421875 },\n { x: 0.296875, y: 0.421875 },\n { x: 0.328125, y: 0.421875 },\n { x: 0.328125, y: 0.421875 },\n { x: 0.359375, y: 0.421875 },\n { x: 0.359375, y: 0.421875 },\n { x: 0.390625, y: 0.421875 },\n { x: 0.390625, y: 0.421875 },\n { x: 0.421875, y: 0.421875 },\n { x: 0.421875, y: 0.421875 },\n { x: 0.453125, y: 0.421875 },\n { x: 0.453125, y: 0.421875 },\n { x: 0.484375, y: 0.421875 },\n { x: 0.484375, y: 0.421875 },\n { x: 0.515625, y: 0.421875 },\n { x: 0.515625, y: 0.421875 },\n { x: 0.546875, y: 0.421875 },\n { x: 0.546875, y: 0.421875 },\n { x: 0.578125, y: 0.421875 },\n { x: 0.578125, y: 0.421875 },\n { x: 0.609375, y: 0.421875 },\n { x: 0.609375, y: 0.421875 },\n { x: 0.640625, y: 0.421875 },\n { x: 0.640625, y: 0.421875 },\n { x: 0.671875, y: 0.421875 },\n { x: 0.671875, y: 0.421875 },\n { x: 0.703125, y: 0.421875 },\n { x: 0.703125, y: 0.421875 },\n { x: 0.734375, y: 0.421875 },\n { x: 0.734375, y: 0.421875 },\n { x: 0.765625, y: 0.421875 },\n { x: 0.765625, y: 0.421875 },\n { x: 0.796875, y: 0.421875 },\n { x: 0.796875, y: 0.421875 },\n { x: 0.828125, y: 0.421875 },\n { x: 0.828125, y: 0.421875 },\n { x: 0.859375, y: 0.421875 },\n { x: 0.859375, y: 0.421875 },\n { x: 0.890625, y: 0.421875 },\n { x: 0.890625, y: 0.421875 },\n { x: 0.921875, y: 0.421875 },\n { x: 0.921875, y: 0.421875 },\n { x: 0.953125, y: 0.421875 },\n { x: 0.953125, y: 0.421875 },\n { x: 0.984375, y: 0.421875 },\n { x: 0.984375, y: 0.421875 },\n { x: 0.015625, y: 0.453125 },\n { x: 0.015625, y: 0.453125 },\n { x: 0.046875, y: 0.453125 },\n { x: 0.046875, y: 0.453125 },\n { x: 0.078125, y: 0.453125 },\n { x: 0.078125, y: 0.453125 },\n { x: 0.109375, y: 0.453125 },\n { x: 0.109375, y: 0.453125 },\n { x: 0.140625, y: 0.453125 },\n { x: 0.140625, y: 0.453125 },\n { x: 0.171875, y: 0.453125 },\n { x: 0.171875, y: 0.453125 },\n { x: 0.203125, y: 0.453125 },\n { x: 0.203125, y: 0.453125 },\n { x: 0.234375, y: 0.453125 },\n { x: 0.234375, y: 0.453125 },\n { x: 0.265625, y: 0.453125 },\n { x: 0.265625, y: 0.453125 },\n { x: 0.296875, y: 0.453125 },\n { x: 0.296875, y: 0.453125 },\n { x: 0.328125, y: 0.453125 },\n { x: 0.328125, y: 0.453125 },\n { x: 0.359375, y: 0.453125 },\n { x: 0.359375, y: 0.453125 },\n { x: 0.390625, y: 0.453125 },\n { x: 0.390625, y: 0.453125 },\n { x: 0.421875, y: 0.453125 },\n { x: 0.421875, y: 0.453125 },\n { x: 0.453125, y: 0.453125 },\n { x: 0.453125, y: 0.453125 },\n { x: 0.484375, y: 0.453125 },\n { x: 0.484375, y: 0.453125 },\n { x: 0.515625, y: 0.453125 },\n { x: 0.515625, y: 0.453125 },\n { x: 0.546875, y: 0.453125 },\n { x: 0.546875, y: 0.453125 },\n { x: 0.578125, y: 0.453125 },\n { x: 0.578125, y: 0.453125 },\n { x: 0.609375, y: 0.453125 },\n { x: 0.609375, y: 0.453125 },\n { x: 0.640625, y: 0.453125 },\n { x: 0.640625, y: 0.453125 },\n { x: 0.671875, y: 0.453125 },\n { x: 0.671875, y: 0.453125 },\n { x: 0.703125, y: 0.453125 },\n { x: 0.703125, y: 0.453125 },\n { x: 0.734375, y: 0.453125 },\n { x: 0.734375, y: 0.453125 },\n { x: 0.765625, y: 0.453125 },\n { x: 0.765625, y: 0.453125 },\n { x: 0.796875, y: 0.453125 },\n { x: 0.796875, y: 0.453125 },\n { x: 0.828125, y: 0.453125 },\n { x: 0.828125, y: 0.453125 },\n { x: 0.859375, y: 0.453125 },\n { x: 0.859375, y: 0.453125 },\n { x: 0.890625, y: 0.453125 },\n { x: 0.890625, y: 0.453125 },\n { x: 0.921875, y: 0.453125 },\n { x: 0.921875, y: 0.453125 },\n { x: 0.953125, y: 0.453125 },\n { x: 0.953125, y: 0.453125 },\n { x: 0.984375, y: 0.453125 },\n { x: 0.984375, y: 0.453125 },\n { x: 0.015625, y: 0.484375 },\n { x: 0.015625, y: 0.484375 },\n { x: 0.046875, y: 0.484375 },\n { x: 0.046875, y: 0.484375 },\n { x: 0.078125, y: 0.484375 },\n { x: 0.078125, y: 0.484375 },\n { x: 0.109375, y: 0.484375 },\n { x: 0.109375, y: 0.484375 },\n { x: 0.140625, y: 0.484375 },\n { x: 0.140625, y: 0.484375 },\n { x: 0.171875, y: 0.484375 },\n { x: 0.171875, y: 0.484375 },\n { x: 0.203125, y: 0.484375 },\n { x: 0.203125, y: 0.484375 },\n { x: 0.234375, y: 0.484375 },\n { x: 0.234375, y: 0.484375 },\n { x: 0.265625, y: 0.484375 },\n { x: 0.265625, y: 0.484375 },\n { x: 0.296875, y: 0.484375 },\n { x: 0.296875, y: 0.484375 },\n { x: 0.328125, y: 0.484375 },\n { x: 0.328125, y: 0.484375 },\n { x: 0.359375, y: 0.484375 },\n { x: 0.359375, y: 0.484375 },\n { x: 0.390625, y: 0.484375 },\n { x: 0.390625, y: 0.484375 },\n { x: 0.421875, y: 0.484375 },\n { x: 0.421875, y: 0.484375 },\n { x: 0.453125, y: 0.484375 },\n { x: 0.453125, y: 0.484375 },\n { x: 0.484375, y: 0.484375 },\n { x: 0.484375, y: 0.484375 },\n { x: 0.515625, y: 0.484375 },\n { x: 0.515625, y: 0.484375 },\n { x: 0.546875, y: 0.484375 },\n { x: 0.546875, y: 0.484375 },\n { x: 0.578125, y: 0.484375 },\n { x: 0.578125, y: 0.484375 },\n { x: 0.609375, y: 0.484375 },\n { x: 0.609375, y: 0.484375 },\n { x: 0.640625, y: 0.484375 },\n { x: 0.640625, y: 0.484375 },\n { x: 0.671875, y: 0.484375 },\n { x: 0.671875, y: 0.484375 },\n { x: 0.703125, y: 0.484375 },\n { x: 0.703125, y: 0.484375 },\n { x: 0.734375, y: 0.484375 },\n { x: 0.734375, y: 0.484375 },\n { x: 0.765625, y: 0.484375 },\n { x: 0.765625, y: 0.484375 },\n { x: 0.796875, y: 0.484375 },\n { x: 0.796875, y: 0.484375 },\n { x: 0.828125, y: 0.484375 },\n { x: 0.828125, y: 0.484375 },\n { x: 0.859375, y: 0.484375 },\n { x: 0.859375, y: 0.484375 },\n { x: 0.890625, y: 0.484375 },\n { x: 0.890625, y: 0.484375 },\n { x: 0.921875, y: 0.484375 },\n { x: 0.921875, y: 0.484375 },\n { x: 0.953125, y: 0.484375 },\n { x: 0.953125, y: 0.484375 },\n { x: 0.984375, y: 0.484375 },\n { x: 0.984375, y: 0.484375 },\n { x: 0.015625, y: 0.515625 },\n { x: 0.015625, y: 0.515625 },\n { x: 0.046875, y: 0.515625 },\n { x: 0.046875, y: 0.515625 },\n { x: 0.078125, y: 0.515625 },\n { x: 0.078125, y: 0.515625 },\n { x: 0.109375, y: 0.515625 },\n { x: 0.109375, y: 0.515625 },\n { x: 0.140625, y: 0.515625 },\n { x: 0.140625, y: 0.515625 },\n { x: 0.171875, y: 0.515625 },\n { x: 0.171875, y: 0.515625 },\n { x: 0.203125, y: 0.515625 },\n { x: 0.203125, y: 0.515625 },\n { x: 0.234375, y: 0.515625 },\n { x: 0.234375, y: 0.515625 },\n { x: 0.265625, y: 0.515625 },\n { x: 0.265625, y: 0.515625 },\n { x: 0.296875, y: 0.515625 },\n { x: 0.296875, y: 0.515625 },\n { x: 0.328125, y: 0.515625 },\n { x: 0.328125, y: 0.515625 },\n { x: 0.359375, y: 0.515625 },\n { x: 0.359375, y: 0.515625 },\n { x: 0.390625, y: 0.515625 },\n { x: 0.390625, y: 0.515625 },\n { x: 0.421875, y: 0.515625 },\n { x: 0.421875, y: 0.515625 },\n { x: 0.453125, y: 0.515625 },\n { x: 0.453125, y: 0.515625 },\n { x: 0.484375, y: 0.515625 },\n { x: 0.484375, y: 0.515625 },\n { x: 0.515625, y: 0.515625 },\n { x: 0.515625, y: 0.515625 },\n { x: 0.546875, y: 0.515625 },\n { x: 0.546875, y: 0.515625 },\n { x: 0.578125, y: 0.515625 },\n { x: 0.578125, y: 0.515625 },\n { x: 0.609375, y: 0.515625 },\n { x: 0.609375, y: 0.515625 },\n { x: 0.640625, y: 0.515625 },\n { x: 0.640625, y: 0.515625 },\n { x: 0.671875, y: 0.515625 },\n { x: 0.671875, y: 0.515625 },\n { x: 0.703125, y: 0.515625 },\n { x: 0.703125, y: 0.515625 },\n { x: 0.734375, y: 0.515625 },\n { x: 0.734375, y: 0.515625 },\n { x: 0.765625, y: 0.515625 },\n { x: 0.765625, y: 0.515625 },\n { x: 0.796875, y: 0.515625 },\n { x: 0.796875, y: 0.515625 },\n { x: 0.828125, y: 0.515625 },\n { x: 0.828125, y: 0.515625 },\n { x: 0.859375, y: 0.515625 },\n { x: 0.859375, y: 0.515625 },\n { x: 0.890625, y: 0.515625 },\n { x: 0.890625, y: 0.515625 },\n { x: 0.921875, y: 0.515625 },\n { x: 0.921875, y: 0.515625 },\n { x: 0.953125, y: 0.515625 },\n { x: 0.953125, y: 0.515625 },\n { x: 0.984375, y: 0.515625 },\n { x: 0.984375, y: 0.515625 },\n { x: 0.015625, y: 0.546875 },\n { x: 0.015625, y: 0.546875 },\n { x: 0.046875, y: 0.546875 },\n { x: 0.046875, y: 0.546875 },\n { x: 0.078125, y: 0.546875 },\n { x: 0.078125, y: 0.546875 },\n { x: 0.109375, y: 0.546875 },\n { x: 0.109375, y: 0.546875 },\n { x: 0.140625, y: 0.546875 },\n { x: 0.140625, y: 0.546875 },\n { x: 0.171875, y: 0.546875 },\n { x: 0.171875, y: 0.546875 },\n { x: 0.203125, y: 0.546875 },\n { x: 0.203125, y: 0.546875 },\n { x: 0.234375, y: 0.546875 },\n { x: 0.234375, y: 0.546875 },\n { x: 0.265625, y: 0.546875 },\n { x: 0.265625, y: 0.546875 },\n { x: 0.296875, y: 0.546875 },\n { x: 0.296875, y: 0.546875 },\n { x: 0.328125, y: 0.546875 },\n { x: 0.328125, y: 0.546875 },\n { x: 0.359375, y: 0.546875 },\n { x: 0.359375, y: 0.546875 },\n { x: 0.390625, y: 0.546875 },\n { x: 0.390625, y: 0.546875 },\n { x: 0.421875, y: 0.546875 },\n { x: 0.421875, y: 0.546875 },\n { x: 0.453125, y: 0.546875 },\n { x: 0.453125, y: 0.546875 },\n { x: 0.484375, y: 0.546875 },\n { x: 0.484375, y: 0.546875 },\n { x: 0.515625, y: 0.546875 },\n { x: 0.515625, y: 0.546875 },\n { x: 0.546875, y: 0.546875 },\n { x: 0.546875, y: 0.546875 },\n { x: 0.578125, y: 0.546875 },\n { x: 0.578125, y: 0.546875 },\n { x: 0.609375, y: 0.546875 },\n { x: 0.609375, y: 0.546875 },\n { x: 0.640625, y: 0.546875 },\n { x: 0.640625, y: 0.546875 },\n { x: 0.671875, y: 0.546875 },\n { x: 0.671875, y: 0.546875 },\n { x: 0.703125, y: 0.546875 },\n { x: 0.703125, y: 0.546875 },\n { x: 0.734375, y: 0.546875 },\n { x: 0.734375, y: 0.546875 },\n { x: 0.765625, y: 0.546875 },\n { x: 0.765625, y: 0.546875 },\n { x: 0.796875, y: 0.546875 },\n { x: 0.796875, y: 0.546875 },\n { x: 0.828125, y: 0.546875 },\n { x: 0.828125, y: 0.546875 },\n { x: 0.859375, y: 0.546875 },\n { x: 0.859375, y: 0.546875 },\n { x: 0.890625, y: 0.546875 },\n { x: 0.890625, y: 0.546875 },\n { x: 0.921875, y: 0.546875 },\n { x: 0.921875, y: 0.546875 },\n { x: 0.953125, y: 0.546875 },\n { x: 0.953125, y: 0.546875 },\n { x: 0.984375, y: 0.546875 },\n { x: 0.984375, y: 0.546875 },\n { x: 0.015625, y: 0.578125 },\n { x: 0.015625, y: 0.578125 },\n { x: 0.046875, y: 0.578125 },\n { x: 0.046875, y: 0.578125 },\n { x: 0.078125, y: 0.578125 },\n { x: 0.078125, y: 0.578125 },\n { x: 0.109375, y: 0.578125 },\n { x: 0.109375, y: 0.578125 },\n { x: 0.140625, y: 0.578125 },\n { x: 0.140625, y: 0.578125 },\n { x: 0.171875, y: 0.578125 },\n { x: 0.171875, y: 0.578125 },\n { x: 0.203125, y: 0.578125 },\n { x: 0.203125, y: 0.578125 },\n { x: 0.234375, y: 0.578125 },\n { x: 0.234375, y: 0.578125 },\n { x: 0.265625, y: 0.578125 },\n { x: 0.265625, y: 0.578125 },\n { x: 0.296875, y: 0.578125 },\n { x: 0.296875, y: 0.578125 },\n { x: 0.328125, y: 0.578125 },\n { x: 0.328125, y: 0.578125 },\n { x: 0.359375, y: 0.578125 },\n { x: 0.359375, y: 0.578125 },\n { x: 0.390625, y: 0.578125 },\n { x: 0.390625, y: 0.578125 },\n { x: 0.421875, y: 0.578125 },\n { x: 0.421875, y: 0.578125 },\n { x: 0.453125, y: 0.578125 },\n { x: 0.453125, y: 0.578125 },\n { x: 0.484375, y: 0.578125 },\n { x: 0.484375, y: 0.578125 },\n { x: 0.515625, y: 0.578125 },\n { x: 0.515625, y: 0.578125 },\n { x: 0.546875, y: 0.578125 },\n { x: 0.546875, y: 0.578125 },\n { x: 0.578125, y: 0.578125 },\n { x: 0.578125, y: 0.578125 },\n { x: 0.609375, y: 0.578125 },\n { x: 0.609375, y: 0.578125 },\n { x: 0.640625, y: 0.578125 },\n { x: 0.640625, y: 0.578125 },\n { x: 0.671875, y: 0.578125 },\n { x: 0.671875, y: 0.578125 },\n { x: 0.703125, y: 0.578125 },\n { x: 0.703125, y: 0.578125 },\n { x: 0.734375, y: 0.578125 },\n { x: 0.734375, y: 0.578125 },\n { x: 0.765625, y: 0.578125 },\n { x: 0.765625, y: 0.578125 },\n { x: 0.796875, y: 0.578125 },\n { x: 0.796875, y: 0.578125 },\n { x: 0.828125, y: 0.578125 },\n { x: 0.828125, y: 0.578125 },\n { x: 0.859375, y: 0.578125 },\n { x: 0.859375, y: 0.578125 },\n { x: 0.890625, y: 0.578125 },\n { x: 0.890625, y: 0.578125 },\n { x: 0.921875, y: 0.578125 },\n { x: 0.921875, y: 0.578125 },\n { x: 0.953125, y: 0.578125 },\n { x: 0.953125, y: 0.578125 },\n { x: 0.984375, y: 0.578125 },\n { x: 0.984375, y: 0.578125 },\n { x: 0.015625, y: 0.609375 },\n { x: 0.015625, y: 0.609375 },\n { x: 0.046875, y: 0.609375 },\n { x: 0.046875, y: 0.609375 },\n { x: 0.078125, y: 0.609375 },\n { x: 0.078125, y: 0.609375 },\n { x: 0.109375, y: 0.609375 },\n { x: 0.109375, y: 0.609375 },\n { x: 0.140625, y: 0.609375 },\n { x: 0.140625, y: 0.609375 },\n { x: 0.171875, y: 0.609375 },\n { x: 0.171875, y: 0.609375 },\n { x: 0.203125, y: 0.609375 },\n { x: 0.203125, y: 0.609375 },\n { x: 0.234375, y: 0.609375 },\n { x: 0.234375, y: 0.609375 },\n { x: 0.265625, y: 0.609375 },\n { x: 0.265625, y: 0.609375 },\n { x: 0.296875, y: 0.609375 },\n { x: 0.296875, y: 0.609375 },\n { x: 0.328125, y: 0.609375 },\n { x: 0.328125, y: 0.609375 },\n { x: 0.359375, y: 0.609375 },\n { x: 0.359375, y: 0.609375 },\n { x: 0.390625, y: 0.609375 },\n { x: 0.390625, y: 0.609375 },\n { x: 0.421875, y: 0.609375 },\n { x: 0.421875, y: 0.609375 },\n { x: 0.453125, y: 0.609375 },\n { x: 0.453125, y: 0.609375 },\n { x: 0.484375, y: 0.609375 },\n { x: 0.484375, y: 0.609375 },\n { x: 0.515625, y: 0.609375 },\n { x: 0.515625, y: 0.609375 },\n { x: 0.546875, y: 0.609375 },\n { x: 0.546875, y: 0.609375 },\n { x: 0.578125, y: 0.609375 },\n { x: 0.578125, y: 0.609375 },\n { x: 0.609375, y: 0.609375 },\n { x: 0.609375, y: 0.609375 },\n { x: 0.640625, y: 0.609375 },\n { x: 0.640625, y: 0.609375 },\n { x: 0.671875, y: 0.609375 },\n { x: 0.671875, y: 0.609375 },\n { x: 0.703125, y: 0.609375 },\n { x: 0.703125, y: 0.609375 },\n { x: 0.734375, y: 0.609375 },\n { x: 0.734375, y: 0.609375 },\n { x: 0.765625, y: 0.609375 },\n { x: 0.765625, y: 0.609375 },\n { x: 0.796875, y: 0.609375 },\n { x: 0.796875, y: 0.609375 },\n { x: 0.828125, y: 0.609375 },\n { x: 0.828125, y: 0.609375 },\n { x: 0.859375, y: 0.609375 },\n { x: 0.859375, y: 0.609375 },\n { x: 0.890625, y: 0.609375 },\n { x: 0.890625, y: 0.609375 },\n { x: 0.921875, y: 0.609375 },\n { x: 0.921875, y: 0.609375 },\n { x: 0.953125, y: 0.609375 },\n { x: 0.953125, y: 0.609375 },\n { x: 0.984375, y: 0.609375 },\n { x: 0.984375, y: 0.609375 },\n { x: 0.015625, y: 0.640625 },\n { x: 0.015625, y: 0.640625 },\n { x: 0.046875, y: 0.640625 },\n { x: 0.046875, y: 0.640625 },\n { x: 0.078125, y: 0.640625 },\n { x: 0.078125, y: 0.640625 },\n { x: 0.109375, y: 0.640625 },\n { x: 0.109375, y: 0.640625 },\n { x: 0.140625, y: 0.640625 },\n { x: 0.140625, y: 0.640625 },\n { x: 0.171875, y: 0.640625 },\n { x: 0.171875, y: 0.640625 },\n { x: 0.203125, y: 0.640625 },\n { x: 0.203125, y: 0.640625 },\n { x: 0.234375, y: 0.640625 },\n { x: 0.234375, y: 0.640625 },\n { x: 0.265625, y: 0.640625 },\n { x: 0.265625, y: 0.640625 },\n { x: 0.296875, y: 0.640625 },\n { x: 0.296875, y: 0.640625 },\n { x: 0.328125, y: 0.640625 },\n { x: 0.328125, y: 0.640625 },\n { x: 0.359375, y: 0.640625 },\n { x: 0.359375, y: 0.640625 },\n { x: 0.390625, y: 0.640625 },\n { x: 0.390625, y: 0.640625 },\n { x: 0.421875, y: 0.640625 },\n { x: 0.421875, y: 0.640625 },\n { x: 0.453125, y: 0.640625 },\n { x: 0.453125, y: 0.640625 },\n { x: 0.484375, y: 0.640625 },\n { x: 0.484375, y: 0.640625 },\n { x: 0.515625, y: 0.640625 },\n { x: 0.515625, y: 0.640625 },\n { x: 0.546875, y: 0.640625 },\n { x: 0.546875, y: 0.640625 },\n { x: 0.578125, y: 0.640625 },\n { x: 0.578125, y: 0.640625 },\n { x: 0.609375, y: 0.640625 },\n { x: 0.609375, y: 0.640625 },\n { x: 0.640625, y: 0.640625 },\n { x: 0.640625, y: 0.640625 },\n { x: 0.671875, y: 0.640625 },\n { x: 0.671875, y: 0.640625 },\n { x: 0.703125, y: 0.640625 },\n { x: 0.703125, y: 0.640625 },\n { x: 0.734375, y: 0.640625 },\n { x: 0.734375, y: 0.640625 },\n { x: 0.765625, y: 0.640625 },\n { x: 0.765625, y: 0.640625 },\n { x: 0.796875, y: 0.640625 },\n { x: 0.796875, y: 0.640625 },\n { x: 0.828125, y: 0.640625 },\n { x: 0.828125, y: 0.640625 },\n { x: 0.859375, y: 0.640625 },\n { x: 0.859375, y: 0.640625 },\n { x: 0.890625, y: 0.640625 },\n { x: 0.890625, y: 0.640625 },\n { x: 0.921875, y: 0.640625 },\n { x: 0.921875, y: 0.640625 },\n { x: 0.953125, y: 0.640625 },\n { x: 0.953125, y: 0.640625 },\n { x: 0.984375, y: 0.640625 },\n { x: 0.984375, y: 0.640625 },\n { x: 0.015625, y: 0.671875 },\n { x: 0.015625, y: 0.671875 },\n { x: 0.046875, y: 0.671875 },\n { x: 0.046875, y: 0.671875 },\n { x: 0.078125, y: 0.671875 },\n { x: 0.078125, y: 0.671875 },\n { x: 0.109375, y: 0.671875 },\n { x: 0.109375, y: 0.671875 },\n { x: 0.140625, y: 0.671875 },\n { x: 0.140625, y: 0.671875 },\n { x: 0.171875, y: 0.671875 },\n { x: 0.171875, y: 0.671875 },\n { x: 0.203125, y: 0.671875 },\n { x: 0.203125, y: 0.671875 },\n { x: 0.234375, y: 0.671875 },\n { x: 0.234375, y: 0.671875 },\n { x: 0.265625, y: 0.671875 },\n { x: 0.265625, y: 0.671875 },\n { x: 0.296875, y: 0.671875 },\n { x: 0.296875, y: 0.671875 },\n { x: 0.328125, y: 0.671875 },\n { x: 0.328125, y: 0.671875 },\n { x: 0.359375, y: 0.671875 },\n { x: 0.359375, y: 0.671875 },\n { x: 0.390625, y: 0.671875 },\n { x: 0.390625, y: 0.671875 },\n { x: 0.421875, y: 0.671875 },\n { x: 0.421875, y: 0.671875 },\n { x: 0.453125, y: 0.671875 },\n { x: 0.453125, y: 0.671875 },\n { x: 0.484375, y: 0.671875 },\n { x: 0.484375, y: 0.671875 },\n { x: 0.515625, y: 0.671875 },\n { x: 0.515625, y: 0.671875 },\n { x: 0.546875, y: 0.671875 },\n { x: 0.546875, y: 0.671875 },\n { x: 0.578125, y: 0.671875 },\n { x: 0.578125, y: 0.671875 },\n { x: 0.609375, y: 0.671875 },\n { x: 0.609375, y: 0.671875 },\n { x: 0.640625, y: 0.671875 },\n { x: 0.640625, y: 0.671875 },\n { x: 0.671875, y: 0.671875 },\n { x: 0.671875, y: 0.671875 },\n { x: 0.703125, y: 0.671875 },\n { x: 0.703125, y: 0.671875 },\n { x: 0.734375, y: 0.671875 },\n { x: 0.734375, y: 0.671875 },\n { x: 0.765625, y: 0.671875 },\n { x: 0.765625, y: 0.671875 },\n { x: 0.796875, y: 0.671875 },\n { x: 0.796875, y: 0.671875 },\n { x: 0.828125, y: 0.671875 },\n { x: 0.828125, y: 0.671875 },\n { x: 0.859375, y: 0.671875 },\n { x: 0.859375, y: 0.671875 },\n { x: 0.890625, y: 0.671875 },\n { x: 0.890625, y: 0.671875 },\n { x: 0.921875, y: 0.671875 },\n { x: 0.921875, y: 0.671875 },\n { x: 0.953125, y: 0.671875 },\n { x: 0.953125, y: 0.671875 },\n { x: 0.984375, y: 0.671875 },\n { x: 0.984375, y: 0.671875 },\n { x: 0.015625, y: 0.703125 },\n { x: 0.015625, y: 0.703125 },\n { x: 0.046875, y: 0.703125 },\n { x: 0.046875, y: 0.703125 },\n { x: 0.078125, y: 0.703125 },\n { x: 0.078125, y: 0.703125 },\n { x: 0.109375, y: 0.703125 },\n { x: 0.109375, y: 0.703125 },\n { x: 0.140625, y: 0.703125 },\n { x: 0.140625, y: 0.703125 },\n { x: 0.171875, y: 0.703125 },\n { x: 0.171875, y: 0.703125 },\n { x: 0.203125, y: 0.703125 },\n { x: 0.203125, y: 0.703125 },\n { x: 0.234375, y: 0.703125 },\n { x: 0.234375, y: 0.703125 },\n { x: 0.265625, y: 0.703125 },\n { x: 0.265625, y: 0.703125 },\n { x: 0.296875, y: 0.703125 },\n { x: 0.296875, y: 0.703125 },\n { x: 0.328125, y: 0.703125 },\n { x: 0.328125, y: 0.703125 },\n { x: 0.359375, y: 0.703125 },\n { x: 0.359375, y: 0.703125 },\n { x: 0.390625, y: 0.703125 },\n { x: 0.390625, y: 0.703125 },\n { x: 0.421875, y: 0.703125 },\n { x: 0.421875, y: 0.703125 },\n { x: 0.453125, y: 0.703125 },\n { x: 0.453125, y: 0.703125 },\n { x: 0.484375, y: 0.703125 },\n { x: 0.484375, y: 0.703125 },\n { x: 0.515625, y: 0.703125 },\n { x: 0.515625, y: 0.703125 },\n { x: 0.546875, y: 0.703125 },\n { x: 0.546875, y: 0.703125 },\n { x: 0.578125, y: 0.703125 },\n { x: 0.578125, y: 0.703125 },\n { x: 0.609375, y: 0.703125 },\n { x: 0.609375, y: 0.703125 },\n { x: 0.640625, y: 0.703125 },\n { x: 0.640625, y: 0.703125 },\n { x: 0.671875, y: 0.703125 },\n { x: 0.671875, y: 0.703125 },\n { x: 0.703125, y: 0.703125 },\n { x: 0.703125, y: 0.703125 },\n { x: 0.734375, y: 0.703125 },\n { x: 0.734375, y: 0.703125 },\n { x: 0.765625, y: 0.703125 },\n { x: 0.765625, y: 0.703125 },\n { x: 0.796875, y: 0.703125 },\n { x: 0.796875, y: 0.703125 },\n { x: 0.828125, y: 0.703125 },\n { x: 0.828125, y: 0.703125 },\n { x: 0.859375, y: 0.703125 },\n { x: 0.859375, y: 0.703125 },\n { x: 0.890625, y: 0.703125 },\n { x: 0.890625, y: 0.703125 },\n { x: 0.921875, y: 0.703125 },\n { x: 0.921875, y: 0.703125 },\n { x: 0.953125, y: 0.703125 },\n { x: 0.953125, y: 0.703125 },\n { x: 0.984375, y: 0.703125 },\n { x: 0.984375, y: 0.703125 },\n { x: 0.015625, y: 0.734375 },\n { x: 0.015625, y: 0.734375 },\n { x: 0.046875, y: 0.734375 },\n { x: 0.046875, y: 0.734375 },\n { x: 0.078125, y: 0.734375 },\n { x: 0.078125, y: 0.734375 },\n { x: 0.109375, y: 0.734375 },\n { x: 0.109375, y: 0.734375 },\n { x: 0.140625, y: 0.734375 },\n { x: 0.140625, y: 0.734375 },\n { x: 0.171875, y: 0.734375 },\n { x: 0.171875, y: 0.734375 },\n { x: 0.203125, y: 0.734375 },\n { x: 0.203125, y: 0.734375 },\n { x: 0.234375, y: 0.734375 },\n { x: 0.234375, y: 0.734375 },\n { x: 0.265625, y: 0.734375 },\n { x: 0.265625, y: 0.734375 },\n { x: 0.296875, y: 0.734375 },\n { x: 0.296875, y: 0.734375 },\n { x: 0.328125, y: 0.734375 },\n { x: 0.328125, y: 0.734375 },\n { x: 0.359375, y: 0.734375 },\n { x: 0.359375, y: 0.734375 },\n { x: 0.390625, y: 0.734375 },\n { x: 0.390625, y: 0.734375 },\n { x: 0.421875, y: 0.734375 },\n { x: 0.421875, y: 0.734375 },\n { x: 0.453125, y: 0.734375 },\n { x: 0.453125, y: 0.734375 },\n { x: 0.484375, y: 0.734375 },\n { x: 0.484375, y: 0.734375 },\n { x: 0.515625, y: 0.734375 },\n { x: 0.515625, y: 0.734375 },\n { x: 0.546875, y: 0.734375 },\n { x: 0.546875, y: 0.734375 },\n { x: 0.578125, y: 0.734375 },\n { x: 0.578125, y: 0.734375 },\n { x: 0.609375, y: 0.734375 },\n { x: 0.609375, y: 0.734375 },\n { x: 0.640625, y: 0.734375 },\n { x: 0.640625, y: 0.734375 },\n { x: 0.671875, y: 0.734375 },\n { x: 0.671875, y: 0.734375 },\n { x: 0.703125, y: 0.734375 },\n { x: 0.703125, y: 0.734375 },\n { x: 0.734375, y: 0.734375 },\n { x: 0.734375, y: 0.734375 },\n { x: 0.765625, y: 0.734375 },\n { x: 0.765625, y: 0.734375 },\n { x: 0.796875, y: 0.734375 },\n { x: 0.796875, y: 0.734375 },\n { x: 0.828125, y: 0.734375 },\n { x: 0.828125, y: 0.734375 },\n { x: 0.859375, y: 0.734375 },\n { x: 0.859375, y: 0.734375 },\n { x: 0.890625, y: 0.734375 },\n { x: 0.890625, y: 0.734375 },\n { x: 0.921875, y: 0.734375 },\n { x: 0.921875, y: 0.734375 },\n { x: 0.953125, y: 0.734375 },\n { x: 0.953125, y: 0.734375 },\n { x: 0.984375, y: 0.734375 },\n { x: 0.984375, y: 0.734375 },\n { x: 0.015625, y: 0.765625 },\n { x: 0.015625, y: 0.765625 },\n { x: 0.046875, y: 0.765625 },\n { x: 0.046875, y: 0.765625 },\n { x: 0.078125, y: 0.765625 },\n { x: 0.078125, y: 0.765625 },\n { x: 0.109375, y: 0.765625 },\n { x: 0.109375, y: 0.765625 },\n { x: 0.140625, y: 0.765625 },\n { x: 0.140625, y: 0.765625 },\n { x: 0.171875, y: 0.765625 },\n { x: 0.171875, y: 0.765625 },\n { x: 0.203125, y: 0.765625 },\n { x: 0.203125, y: 0.765625 },\n { x: 0.234375, y: 0.765625 },\n { x: 0.234375, y: 0.765625 },\n { x: 0.265625, y: 0.765625 },\n { x: 0.265625, y: 0.765625 },\n { x: 0.296875, y: 0.765625 },\n { x: 0.296875, y: 0.765625 },\n { x: 0.328125, y: 0.765625 },\n { x: 0.328125, y: 0.765625 },\n { x: 0.359375, y: 0.765625 },\n { x: 0.359375, y: 0.765625 },\n { x: 0.390625, y: 0.765625 },\n { x: 0.390625, y: 0.765625 },\n { x: 0.421875, y: 0.765625 },\n { x: 0.421875, y: 0.765625 },\n { x: 0.453125, y: 0.765625 },\n { x: 0.453125, y: 0.765625 },\n { x: 0.484375, y: 0.765625 },\n { x: 0.484375, y: 0.765625 },\n { x: 0.515625, y: 0.765625 },\n { x: 0.515625, y: 0.765625 },\n { x: 0.546875, y: 0.765625 },\n { x: 0.546875, y: 0.765625 },\n { x: 0.578125, y: 0.765625 },\n { x: 0.578125, y: 0.765625 },\n { x: 0.609375, y: 0.765625 },\n { x: 0.609375, y: 0.765625 },\n { x: 0.640625, y: 0.765625 },\n { x: 0.640625, y: 0.765625 },\n { x: 0.671875, y: 0.765625 },\n { x: 0.671875, y: 0.765625 },\n { x: 0.703125, y: 0.765625 },\n { x: 0.703125, y: 0.765625 },\n { x: 0.734375, y: 0.765625 },\n { x: 0.734375, y: 0.765625 },\n { x: 0.765625, y: 0.765625 },\n { x: 0.765625, y: 0.765625 },\n { x: 0.796875, y: 0.765625 },\n { x: 0.796875, y: 0.765625 },\n { x: 0.828125, y: 0.765625 },\n { x: 0.828125, y: 0.765625 },\n { x: 0.859375, y: 0.765625 },\n { x: 0.859375, y: 0.765625 },\n { x: 0.890625, y: 0.765625 },\n { x: 0.890625, y: 0.765625 },\n { x: 0.921875, y: 0.765625 },\n { x: 0.921875, y: 0.765625 },\n { x: 0.953125, y: 0.765625 },\n { x: 0.953125, y: 0.765625 },\n { x: 0.984375, y: 0.765625 },\n { x: 0.984375, y: 0.765625 },\n { x: 0.015625, y: 0.796875 },\n { x: 0.015625, y: 0.796875 },\n { x: 0.046875, y: 0.796875 },\n { x: 0.046875, y: 0.796875 },\n { x: 0.078125, y: 0.796875 },\n { x: 0.078125, y: 0.796875 },\n { x: 0.109375, y: 0.796875 },\n { x: 0.109375, y: 0.796875 },\n { x: 0.140625, y: 0.796875 },\n { x: 0.140625, y: 0.796875 },\n { x: 0.171875, y: 0.796875 },\n { x: 0.171875, y: 0.796875 },\n { x: 0.203125, y: 0.796875 },\n { x: 0.203125, y: 0.796875 },\n { x: 0.234375, y: 0.796875 },\n { x: 0.234375, y: 0.796875 },\n { x: 0.265625, y: 0.796875 },\n { x: 0.265625, y: 0.796875 },\n { x: 0.296875, y: 0.796875 },\n { x: 0.296875, y: 0.796875 },\n { x: 0.328125, y: 0.796875 },\n { x: 0.328125, y: 0.796875 },\n { x: 0.359375, y: 0.796875 },\n { x: 0.359375, y: 0.796875 },\n { x: 0.390625, y: 0.796875 },\n { x: 0.390625, y: 0.796875 },\n { x: 0.421875, y: 0.796875 },\n { x: 0.421875, y: 0.796875 },\n { x: 0.453125, y: 0.796875 },\n { x: 0.453125, y: 0.796875 },\n { x: 0.484375, y: 0.796875 },\n { x: 0.484375, y: 0.796875 },\n { x: 0.515625, y: 0.796875 },\n { x: 0.515625, y: 0.796875 },\n { x: 0.546875, y: 0.796875 },\n { x: 0.546875, y: 0.796875 },\n { x: 0.578125, y: 0.796875 },\n { x: 0.578125, y: 0.796875 },\n { x: 0.609375, y: 0.796875 },\n { x: 0.609375, y: 0.796875 },\n { x: 0.640625, y: 0.796875 },\n { x: 0.640625, y: 0.796875 },\n { x: 0.671875, y: 0.796875 },\n { x: 0.671875, y: 0.796875 },\n { x: 0.703125, y: 0.796875 },\n { x: 0.703125, y: 0.796875 },\n { x: 0.734375, y: 0.796875 },\n { x: 0.734375, y: 0.796875 },\n { x: 0.765625, y: 0.796875 },\n { x: 0.765625, y: 0.796875 },\n { x: 0.796875, y: 0.796875 },\n { x: 0.796875, y: 0.796875 },\n { x: 0.828125, y: 0.796875 },\n { x: 0.828125, y: 0.796875 },\n { x: 0.859375, y: 0.796875 },\n { x: 0.859375, y: 0.796875 },\n { x: 0.890625, y: 0.796875 },\n { x: 0.890625, y: 0.796875 },\n { x: 0.921875, y: 0.796875 },\n { x: 0.921875, y: 0.796875 },\n { x: 0.953125, y: 0.796875 },\n { x: 0.953125, y: 0.796875 },\n { x: 0.984375, y: 0.796875 },\n { x: 0.984375, y: 0.796875 },\n { x: 0.015625, y: 0.828125 },\n { x: 0.015625, y: 0.828125 },\n { x: 0.046875, y: 0.828125 },\n { x: 0.046875, y: 0.828125 },\n { x: 0.078125, y: 0.828125 },\n { x: 0.078125, y: 0.828125 },\n { x: 0.109375, y: 0.828125 },\n { x: 0.109375, y: 0.828125 },\n { x: 0.140625, y: 0.828125 },\n { x: 0.140625, y: 0.828125 },\n { x: 0.171875, y: 0.828125 },\n { x: 0.171875, y: 0.828125 },\n { x: 0.203125, y: 0.828125 },\n { x: 0.203125, y: 0.828125 },\n { x: 0.234375, y: 0.828125 },\n { x: 0.234375, y: 0.828125 },\n { x: 0.265625, y: 0.828125 },\n { x: 0.265625, y: 0.828125 },\n { x: 0.296875, y: 0.828125 },\n { x: 0.296875, y: 0.828125 },\n { x: 0.328125, y: 0.828125 },\n { x: 0.328125, y: 0.828125 },\n { x: 0.359375, y: 0.828125 },\n { x: 0.359375, y: 0.828125 },\n { x: 0.390625, y: 0.828125 },\n { x: 0.390625, y: 0.828125 },\n { x: 0.421875, y: 0.828125 },\n { x: 0.421875, y: 0.828125 },\n { x: 0.453125, y: 0.828125 },\n { x: 0.453125, y: 0.828125 },\n { x: 0.484375, y: 0.828125 },\n { x: 0.484375, y: 0.828125 },\n { x: 0.515625, y: 0.828125 },\n { x: 0.515625, y: 0.828125 },\n { x: 0.546875, y: 0.828125 },\n { x: 0.546875, y: 0.828125 },\n { x: 0.578125, y: 0.828125 },\n { x: 0.578125, y: 0.828125 },\n { x: 0.609375, y: 0.828125 },\n { x: 0.609375, y: 0.828125 },\n { x: 0.640625, y: 0.828125 },\n { x: 0.640625, y: 0.828125 },\n { x: 0.671875, y: 0.828125 },\n { x: 0.671875, y: 0.828125 },\n { x: 0.703125, y: 0.828125 },\n { x: 0.703125, y: 0.828125 },\n { x: 0.734375, y: 0.828125 },\n { x: 0.734375, y: 0.828125 },\n { x: 0.765625, y: 0.828125 },\n { x: 0.765625, y: 0.828125 },\n { x: 0.796875, y: 0.828125 },\n { x: 0.796875, y: 0.828125 },\n { x: 0.828125, y: 0.828125 },\n { x: 0.828125, y: 0.828125 },\n { x: 0.859375, y: 0.828125 },\n { x: 0.859375, y: 0.828125 },\n { x: 0.890625, y: 0.828125 },\n { x: 0.890625, y: 0.828125 },\n { x: 0.921875, y: 0.828125 },\n { x: 0.921875, y: 0.828125 },\n { x: 0.953125, y: 0.828125 },\n { x: 0.953125, y: 0.828125 },\n { x: 0.984375, y: 0.828125 },\n { x: 0.984375, y: 0.828125 },\n { x: 0.015625, y: 0.859375 },\n { x: 0.015625, y: 0.859375 },\n { x: 0.046875, y: 0.859375 },\n { x: 0.046875, y: 0.859375 },\n { x: 0.078125, y: 0.859375 },\n { x: 0.078125, y: 0.859375 },\n { x: 0.109375, y: 0.859375 },\n { x: 0.109375, y: 0.859375 },\n { x: 0.140625, y: 0.859375 },\n { x: 0.140625, y: 0.859375 },\n { x: 0.171875, y: 0.859375 },\n { x: 0.171875, y: 0.859375 },\n { x: 0.203125, y: 0.859375 },\n { x: 0.203125, y: 0.859375 },\n { x: 0.234375, y: 0.859375 },\n { x: 0.234375, y: 0.859375 },\n { x: 0.265625, y: 0.859375 },\n { x: 0.265625, y: 0.859375 },\n { x: 0.296875, y: 0.859375 },\n { x: 0.296875, y: 0.859375 },\n { x: 0.328125, y: 0.859375 },\n { x: 0.328125, y: 0.859375 },\n { x: 0.359375, y: 0.859375 },\n { x: 0.359375, y: 0.859375 },\n { x: 0.390625, y: 0.859375 },\n { x: 0.390625, y: 0.859375 },\n { x: 0.421875, y: 0.859375 },\n { x: 0.421875, y: 0.859375 },\n { x: 0.453125, y: 0.859375 },\n { x: 0.453125, y: 0.859375 },\n { x: 0.484375, y: 0.859375 },\n { x: 0.484375, y: 0.859375 },\n { x: 0.515625, y: 0.859375 },\n { x: 0.515625, y: 0.859375 },\n { x: 0.546875, y: 0.859375 },\n { x: 0.546875, y: 0.859375 },\n { x: 0.578125, y: 0.859375 },\n { x: 0.578125, y: 0.859375 },\n { x: 0.609375, y: 0.859375 },\n { x: 0.609375, y: 0.859375 },\n { x: 0.640625, y: 0.859375 },\n { x: 0.640625, y: 0.859375 },\n { x: 0.671875, y: 0.859375 },\n { x: 0.671875, y: 0.859375 },\n { x: 0.703125, y: 0.859375 },\n { x: 0.703125, y: 0.859375 },\n { x: 0.734375, y: 0.859375 },\n { x: 0.734375, y: 0.859375 },\n { x: 0.765625, y: 0.859375 },\n { x: 0.765625, y: 0.859375 },\n { x: 0.796875, y: 0.859375 },\n { x: 0.796875, y: 0.859375 },\n { x: 0.828125, y: 0.859375 },\n { x: 0.828125, y: 0.859375 },\n { x: 0.859375, y: 0.859375 },\n { x: 0.859375, y: 0.859375 },\n { x: 0.890625, y: 0.859375 },\n { x: 0.890625, y: 0.859375 },\n { x: 0.921875, y: 0.859375 },\n { x: 0.921875, y: 0.859375 },\n { x: 0.953125, y: 0.859375 },\n { x: 0.953125, y: 0.859375 },\n { x: 0.984375, y: 0.859375 },\n { x: 0.984375, y: 0.859375 },\n { x: 0.015625, y: 0.890625 },\n { x: 0.015625, y: 0.890625 },\n { x: 0.046875, y: 0.890625 },\n { x: 0.046875, y: 0.890625 },\n { x: 0.078125, y: 0.890625 },\n { x: 0.078125, y: 0.890625 },\n { x: 0.109375, y: 0.890625 },\n { x: 0.109375, y: 0.890625 },\n { x: 0.140625, y: 0.890625 },\n { x: 0.140625, y: 0.890625 },\n { x: 0.171875, y: 0.890625 },\n { x: 0.171875, y: 0.890625 },\n { x: 0.203125, y: 0.890625 },\n { x: 0.203125, y: 0.890625 },\n { x: 0.234375, y: 0.890625 },\n { x: 0.234375, y: 0.890625 },\n { x: 0.265625, y: 0.890625 },\n { x: 0.265625, y: 0.890625 },\n { x: 0.296875, y: 0.890625 },\n { x: 0.296875, y: 0.890625 },\n { x: 0.328125, y: 0.890625 },\n { x: 0.328125, y: 0.890625 },\n { x: 0.359375, y: 0.890625 },\n { x: 0.359375, y: 0.890625 },\n { x: 0.390625, y: 0.890625 },\n { x: 0.390625, y: 0.890625 },\n { x: 0.421875, y: 0.890625 },\n { x: 0.421875, y: 0.890625 },\n { x: 0.453125, y: 0.890625 },\n { x: 0.453125, y: 0.890625 },\n { x: 0.484375, y: 0.890625 },\n { x: 0.484375, y: 0.890625 },\n { x: 0.515625, y: 0.890625 },\n { x: 0.515625, y: 0.890625 },\n { x: 0.546875, y: 0.890625 },\n { x: 0.546875, y: 0.890625 },\n { x: 0.578125, y: 0.890625 },\n { x: 0.578125, y: 0.890625 },\n { x: 0.609375, y: 0.890625 },\n { x: 0.609375, y: 0.890625 },\n { x: 0.640625, y: 0.890625 },\n { x: 0.640625, y: 0.890625 },\n { x: 0.671875, y: 0.890625 },\n { x: 0.671875, y: 0.890625 },\n { x: 0.703125, y: 0.890625 },\n { x: 0.703125, y: 0.890625 },\n { x: 0.734375, y: 0.890625 },\n { x: 0.734375, y: 0.890625 },\n { x: 0.765625, y: 0.890625 },\n { x: 0.765625, y: 0.890625 },\n { x: 0.796875, y: 0.890625 },\n { x: 0.796875, y: 0.890625 },\n { x: 0.828125, y: 0.890625 },\n { x: 0.828125, y: 0.890625 },\n { x: 0.859375, y: 0.890625 },\n { x: 0.859375, y: 0.890625 },\n { x: 0.890625, y: 0.890625 },\n { x: 0.890625, y: 0.890625 },\n { x: 0.921875, y: 0.890625 },\n { x: 0.921875, y: 0.890625 },\n { x: 0.953125, y: 0.890625 },\n { x: 0.953125, y: 0.890625 },\n { x: 0.984375, y: 0.890625 },\n { x: 0.984375, y: 0.890625 },\n { x: 0.015625, y: 0.921875 },\n { x: 0.015625, y: 0.921875 },\n { x: 0.046875, y: 0.921875 },\n { x: 0.046875, y: 0.921875 },\n { x: 0.078125, y: 0.921875 },\n { x: 0.078125, y: 0.921875 },\n { x: 0.109375, y: 0.921875 },\n { x: 0.109375, y: 0.921875 },\n { x: 0.140625, y: 0.921875 },\n { x: 0.140625, y: 0.921875 },\n { x: 0.171875, y: 0.921875 },\n { x: 0.171875, y: 0.921875 },\n { x: 0.203125, y: 0.921875 },\n { x: 0.203125, y: 0.921875 },\n { x: 0.234375, y: 0.921875 },\n { x: 0.234375, y: 0.921875 },\n { x: 0.265625, y: 0.921875 },\n { x: 0.265625, y: 0.921875 },\n { x: 0.296875, y: 0.921875 },\n { x: 0.296875, y: 0.921875 },\n { x: 0.328125, y: 0.921875 },\n { x: 0.328125, y: 0.921875 },\n { x: 0.359375, y: 0.921875 },\n { x: 0.359375, y: 0.921875 },\n { x: 0.390625, y: 0.921875 },\n { x: 0.390625, y: 0.921875 },\n { x: 0.421875, y: 0.921875 },\n { x: 0.421875, y: 0.921875 },\n { x: 0.453125, y: 0.921875 },\n { x: 0.453125, y: 0.921875 },\n { x: 0.484375, y: 0.921875 },\n { x: 0.484375, y: 0.921875 },\n { x: 0.515625, y: 0.921875 },\n { x: 0.515625, y: 0.921875 },\n { x: 0.546875, y: 0.921875 },\n { x: 0.546875, y: 0.921875 },\n { x: 0.578125, y: 0.921875 },\n { x: 0.578125, y: 0.921875 },\n { x: 0.609375, y: 0.921875 },\n { x: 0.609375, y: 0.921875 },\n { x: 0.640625, y: 0.921875 },\n { x: 0.640625, y: 0.921875 },\n { x: 0.671875, y: 0.921875 },\n { x: 0.671875, y: 0.921875 },\n { x: 0.703125, y: 0.921875 },\n { x: 0.703125, y: 0.921875 },\n { x: 0.734375, y: 0.921875 },\n { x: 0.734375, y: 0.921875 },\n { x: 0.765625, y: 0.921875 },\n { x: 0.765625, y: 0.921875 },\n { x: 0.796875, y: 0.921875 },\n { x: 0.796875, y: 0.921875 },\n { x: 0.828125, y: 0.921875 },\n { x: 0.828125, y: 0.921875 },\n { x: 0.859375, y: 0.921875 },\n { x: 0.859375, y: 0.921875 },\n { x: 0.890625, y: 0.921875 },\n { x: 0.890625, y: 0.921875 },\n { x: 0.921875, y: 0.921875 },\n { x: 0.921875, y: 0.921875 },\n { x: 0.953125, y: 0.921875 },\n { x: 0.953125, y: 0.921875 },\n { x: 0.984375, y: 0.921875 },\n { x: 0.984375, y: 0.921875 },\n { x: 0.015625, y: 0.953125 },\n { x: 0.015625, y: 0.953125 },\n { x: 0.046875, y: 0.953125 },\n { x: 0.046875, y: 0.953125 },\n { x: 0.078125, y: 0.953125 },\n { x: 0.078125, y: 0.953125 },\n { x: 0.109375, y: 0.953125 },\n { x: 0.109375, y: 0.953125 },\n { x: 0.140625, y: 0.953125 },\n { x: 0.140625, y: 0.953125 },\n { x: 0.171875, y: 0.953125 },\n { x: 0.171875, y: 0.953125 },\n { x: 0.203125, y: 0.953125 },\n { x: 0.203125, y: 0.953125 },\n { x: 0.234375, y: 0.953125 },\n { x: 0.234375, y: 0.953125 },\n { x: 0.265625, y: 0.953125 },\n { x: 0.265625, y: 0.953125 },\n { x: 0.296875, y: 0.953125 },\n { x: 0.296875, y: 0.953125 },\n { x: 0.328125, y: 0.953125 },\n { x: 0.328125, y: 0.953125 },\n { x: 0.359375, y: 0.953125 },\n { x: 0.359375, y: 0.953125 },\n { x: 0.390625, y: 0.953125 },\n { x: 0.390625, y: 0.953125 },\n { x: 0.421875, y: 0.953125 },\n { x: 0.421875, y: 0.953125 },\n { x: 0.453125, y: 0.953125 },\n { x: 0.453125, y: 0.953125 },\n { x: 0.484375, y: 0.953125 },\n { x: 0.484375, y: 0.953125 },\n { x: 0.515625, y: 0.953125 },\n { x: 0.515625, y: 0.953125 },\n { x: 0.546875, y: 0.953125 },\n { x: 0.546875, y: 0.953125 },\n { x: 0.578125, y: 0.953125 },\n { x: 0.578125, y: 0.953125 },\n { x: 0.609375, y: 0.953125 },\n { x: 0.609375, y: 0.953125 },\n { x: 0.640625, y: 0.953125 },\n { x: 0.640625, y: 0.953125 },\n { x: 0.671875, y: 0.953125 },\n { x: 0.671875, y: 0.953125 },\n { x: 0.703125, y: 0.953125 },\n { x: 0.703125, y: 0.953125 },\n { x: 0.734375, y: 0.953125 },\n { x: 0.734375, y: 0.953125 },\n { x: 0.765625, y: 0.953125 },\n { x: 0.765625, y: 0.953125 },\n { x: 0.796875, y: 0.953125 },\n { x: 0.796875, y: 0.953125 },\n { x: 0.828125, y: 0.953125 },\n { x: 0.828125, y: 0.953125 },\n { x: 0.859375, y: 0.953125 },\n { x: 0.859375, y: 0.953125 },\n { x: 0.890625, y: 0.953125 },\n { x: 0.890625, y: 0.953125 },\n { x: 0.921875, y: 0.953125 },\n { x: 0.921875, y: 0.953125 },\n { x: 0.953125, y: 0.953125 },\n { x: 0.953125, y: 0.953125 },\n { x: 0.984375, y: 0.953125 },\n { x: 0.984375, y: 0.953125 },\n { x: 0.015625, y: 0.984375 },\n { x: 0.015625, y: 0.984375 },\n { x: 0.046875, y: 0.984375 },\n { x: 0.046875, y: 0.984375 },\n { x: 0.078125, y: 0.984375 },\n { x: 0.078125, y: 0.984375 },\n { x: 0.109375, y: 0.984375 },\n { x: 0.109375, y: 0.984375 },\n { x: 0.140625, y: 0.984375 },\n { x: 0.140625, y: 0.984375 },\n { x: 0.171875, y: 0.984375 },\n { x: 0.171875, y: 0.984375 },\n { x: 0.203125, y: 0.984375 },\n { x: 0.203125, y: 0.984375 },\n { x: 0.234375, y: 0.984375 },\n { x: 0.234375, y: 0.984375 },\n { x: 0.265625, y: 0.984375 },\n { x: 0.265625, y: 0.984375 },\n { x: 0.296875, y: 0.984375 },\n { x: 0.296875, y: 0.984375 },\n { x: 0.328125, y: 0.984375 },\n { x: 0.328125, y: 0.984375 },\n { x: 0.359375, y: 0.984375 },\n { x: 0.359375, y: 0.984375 },\n { x: 0.390625, y: 0.984375 },\n { x: 0.390625, y: 0.984375 },\n { x: 0.421875, y: 0.984375 },\n { x: 0.421875, y: 0.984375 },\n { x: 0.453125, y: 0.984375 },\n { x: 0.453125, y: 0.984375 },\n { x: 0.484375, y: 0.984375 },\n { x: 0.484375, y: 0.984375 },\n { x: 0.515625, y: 0.984375 },\n { x: 0.515625, y: 0.984375 },\n { x: 0.546875, y: 0.984375 },\n { x: 0.546875, y: 0.984375 },\n { x: 0.578125, y: 0.984375 },\n { x: 0.578125, y: 0.984375 },\n { x: 0.609375, y: 0.984375 },\n { x: 0.609375, y: 0.984375 },\n { x: 0.640625, y: 0.984375 },\n { x: 0.640625, y: 0.984375 },\n { x: 0.671875, y: 0.984375 },\n { x: 0.671875, y: 0.984375 },\n { x: 0.703125, y: 0.984375 },\n { x: 0.703125, y: 0.984375 },\n { x: 0.734375, y: 0.984375 },\n { x: 0.734375, y: 0.984375 },\n { x: 0.765625, y: 0.984375 },\n { x: 0.765625, y: 0.984375 },\n { x: 0.796875, y: 0.984375 },\n { x: 0.796875, y: 0.984375 },\n { x: 0.828125, y: 0.984375 },\n { x: 0.828125, y: 0.984375 },\n { x: 0.859375, y: 0.984375 },\n { x: 0.859375, y: 0.984375 },\n { x: 0.890625, y: 0.984375 },\n { x: 0.890625, y: 0.984375 },\n { x: 0.921875, y: 0.984375 },\n { x: 0.921875, y: 0.984375 },\n { x: 0.953125, y: 0.984375 },\n { x: 0.953125, y: 0.984375 },\n { x: 0.984375, y: 0.984375 },\n { x: 0.984375, y: 0.984375 },\n { x: 0.03125, y: 0.03125 },\n { x: 0.03125, y: 0.03125 },\n { x: 0.09375, y: 0.03125 },\n { x: 0.09375, y: 0.03125 },\n { x: 0.15625, y: 0.03125 },\n { x: 0.15625, y: 0.03125 },\n { x: 0.21875, y: 0.03125 },\n { x: 0.21875, y: 0.03125 },\n { x: 0.28125, y: 0.03125 },\n { x: 0.28125, y: 0.03125 },\n { x: 0.34375, y: 0.03125 },\n { x: 0.34375, y: 0.03125 },\n { x: 0.40625, y: 0.03125 },\n { x: 0.40625, y: 0.03125 },\n { x: 0.46875, y: 0.03125 },\n { x: 0.46875, y: 0.03125 },\n { x: 0.53125, y: 0.03125 },\n { x: 0.53125, y: 0.03125 },\n { x: 0.59375, y: 0.03125 },\n { x: 0.59375, y: 0.03125 },\n { x: 0.65625, y: 0.03125 },\n { x: 0.65625, y: 0.03125 },\n { x: 0.71875, y: 0.03125 },\n { x: 0.71875, y: 0.03125 },\n { x: 0.78125, y: 0.03125 },\n { x: 0.78125, y: 0.03125 },\n { x: 0.84375, y: 0.03125 },\n { x: 0.84375, y: 0.03125 },\n { x: 0.90625, y: 0.03125 },\n { x: 0.90625, y: 0.03125 },\n { x: 0.96875, y: 0.03125 },\n { x: 0.96875, y: 0.03125 },\n { x: 0.03125, y: 0.09375 },\n { x: 0.03125, y: 0.09375 },\n { x: 0.09375, y: 0.09375 },\n { x: 0.09375, y: 0.09375 },\n { x: 0.15625, y: 0.09375 },\n { x: 0.15625, y: 0.09375 },\n { x: 0.21875, y: 0.09375 },\n { x: 0.21875, y: 0.09375 },\n { x: 0.28125, y: 0.09375 },\n { x: 0.28125, y: 0.09375 },\n { x: 0.34375, y: 0.09375 },\n { x: 0.34375, y: 0.09375 },\n { x: 0.40625, y: 0.09375 },\n { x: 0.40625, y: 0.09375 },\n { x: 0.46875, y: 0.09375 },\n { x: 0.46875, y: 0.09375 },\n { x: 0.53125, y: 0.09375 },\n { x: 0.53125, y: 0.09375 },\n { x: 0.59375, y: 0.09375 },\n { x: 0.59375, y: 0.09375 },\n { x: 0.65625, y: 0.09375 },\n { x: 0.65625, y: 0.09375 },\n { x: 0.71875, y: 0.09375 },\n { x: 0.71875, y: 0.09375 },\n { x: 0.78125, y: 0.09375 },\n { x: 0.78125, y: 0.09375 },\n { x: 0.84375, y: 0.09375 },\n { x: 0.84375, y: 0.09375 },\n { x: 0.90625, y: 0.09375 },\n { x: 0.90625, y: 0.09375 },\n { x: 0.96875, y: 0.09375 },\n { x: 0.96875, y: 0.09375 },\n { x: 0.03125, y: 0.15625 },\n { x: 0.03125, y: 0.15625 },\n { x: 0.09375, y: 0.15625 },\n { x: 0.09375, y: 0.15625 },\n { x: 0.15625, y: 0.15625 },\n { x: 0.15625, y: 0.15625 },\n { x: 0.21875, y: 0.15625 },\n { x: 0.21875, y: 0.15625 },\n { x: 0.28125, y: 0.15625 },\n { x: 0.28125, y: 0.15625 },\n { x: 0.34375, y: 0.15625 },\n { x: 0.34375, y: 0.15625 },\n { x: 0.40625, y: 0.15625 },\n { x: 0.40625, y: 0.15625 },\n { x: 0.46875, y: 0.15625 },\n { x: 0.46875, y: 0.15625 },\n { x: 0.53125, y: 0.15625 },\n { x: 0.53125, y: 0.15625 },\n { x: 0.59375, y: 0.15625 },\n { x: 0.59375, y: 0.15625 },\n { x: 0.65625, y: 0.15625 },\n { x: 0.65625, y: 0.15625 },\n { x: 0.71875, y: 0.15625 },\n { x: 0.71875, y: 0.15625 },\n { x: 0.78125, y: 0.15625 },\n { x: 0.78125, y: 0.15625 },\n { x: 0.84375, y: 0.15625 },\n { x: 0.84375, y: 0.15625 },\n { x: 0.90625, y: 0.15625 },\n { x: 0.90625, y: 0.15625 },\n { x: 0.96875, y: 0.15625 },\n { x: 0.96875, y: 0.15625 },\n { x: 0.03125, y: 0.21875 },\n { x: 0.03125, y: 0.21875 },\n { x: 0.09375, y: 0.21875 },\n { x: 0.09375, y: 0.21875 },\n { x: 0.15625, y: 0.21875 },\n { x: 0.15625, y: 0.21875 },\n { x: 0.21875, y: 0.21875 },\n { x: 0.21875, y: 0.21875 },\n { x: 0.28125, y: 0.21875 },\n { x: 0.28125, y: 0.21875 },\n { x: 0.34375, y: 0.21875 },\n { x: 0.34375, y: 0.21875 },\n { x: 0.40625, y: 0.21875 },\n { x: 0.40625, y: 0.21875 },\n { x: 0.46875, y: 0.21875 },\n { x: 0.46875, y: 0.21875 },\n { x: 0.53125, y: 0.21875 },\n { x: 0.53125, y: 0.21875 },\n { x: 0.59375, y: 0.21875 },\n { x: 0.59375, y: 0.21875 },\n { x: 0.65625, y: 0.21875 },\n { x: 0.65625, y: 0.21875 },\n { x: 0.71875, y: 0.21875 },\n { x: 0.71875, y: 0.21875 },\n { x: 0.78125, y: 0.21875 },\n { x: 0.78125, y: 0.21875 },\n { x: 0.84375, y: 0.21875 },\n { x: 0.84375, y: 0.21875 },\n { x: 0.90625, y: 0.21875 },\n { x: 0.90625, y: 0.21875 },\n { x: 0.96875, y: 0.21875 },\n { x: 0.96875, y: 0.21875 },\n { x: 0.03125, y: 0.28125 },\n { x: 0.03125, y: 0.28125 },\n { x: 0.09375, y: 0.28125 },\n { x: 0.09375, y: 0.28125 },\n { x: 0.15625, y: 0.28125 },\n { x: 0.15625, y: 0.28125 },\n { x: 0.21875, y: 0.28125 },\n { x: 0.21875, y: 0.28125 },\n { x: 0.28125, y: 0.28125 },\n { x: 0.28125, y: 0.28125 },\n { x: 0.34375, y: 0.28125 },\n { x: 0.34375, y: 0.28125 },\n { x: 0.40625, y: 0.28125 },\n { x: 0.40625, y: 0.28125 },\n { x: 0.46875, y: 0.28125 },\n { x: 0.46875, y: 0.28125 },\n { x: 0.53125, y: 0.28125 },\n { x: 0.53125, y: 0.28125 },\n { x: 0.59375, y: 0.28125 },\n { x: 0.59375, y: 0.28125 },\n { x: 0.65625, y: 0.28125 },\n { x: 0.65625, y: 0.28125 },\n { x: 0.71875, y: 0.28125 },\n { x: 0.71875, y: 0.28125 },\n { x: 0.78125, y: 0.28125 },\n { x: 0.78125, y: 0.28125 },\n { x: 0.84375, y: 0.28125 },\n { x: 0.84375, y: 0.28125 },\n { x: 0.90625, y: 0.28125 },\n { x: 0.90625, y: 0.28125 },\n { x: 0.96875, y: 0.28125 },\n { x: 0.96875, y: 0.28125 },\n { x: 0.03125, y: 0.34375 },\n { x: 0.03125, y: 0.34375 },\n { x: 0.09375, y: 0.34375 },\n { x: 0.09375, y: 0.34375 },\n { x: 0.15625, y: 0.34375 },\n { x: 0.15625, y: 0.34375 },\n { x: 0.21875, y: 0.34375 },\n { x: 0.21875, y: 0.34375 },\n { x: 0.28125, y: 0.34375 },\n { x: 0.28125, y: 0.34375 },\n { x: 0.34375, y: 0.34375 },\n { x: 0.34375, y: 0.34375 },\n { x: 0.40625, y: 0.34375 },\n { x: 0.40625, y: 0.34375 },\n { x: 0.46875, y: 0.34375 },\n { x: 0.46875, y: 0.34375 },\n { x: 0.53125, y: 0.34375 },\n { x: 0.53125, y: 0.34375 },\n { x: 0.59375, y: 0.34375 },\n { x: 0.59375, y: 0.34375 },\n { x: 0.65625, y: 0.34375 },\n { x: 0.65625, y: 0.34375 },\n { x: 0.71875, y: 0.34375 },\n { x: 0.71875, y: 0.34375 },\n { x: 0.78125, y: 0.34375 },\n { x: 0.78125, y: 0.34375 },\n { x: 0.84375, y: 0.34375 },\n { x: 0.84375, y: 0.34375 },\n { x: 0.90625, y: 0.34375 },\n { x: 0.90625, y: 0.34375 },\n { x: 0.96875, y: 0.34375 },\n { x: 0.96875, y: 0.34375 },\n { x: 0.03125, y: 0.40625 },\n { x: 0.03125, y: 0.40625 },\n { x: 0.09375, y: 0.40625 },\n { x: 0.09375, y: 0.40625 },\n { x: 0.15625, y: 0.40625 },\n { x: 0.15625, y: 0.40625 },\n { x: 0.21875, y: 0.40625 },\n { x: 0.21875, y: 0.40625 },\n { x: 0.28125, y: 0.40625 },\n { x: 0.28125, y: 0.40625 },\n { x: 0.34375, y: 0.40625 },\n { x: 0.34375, y: 0.40625 },\n { x: 0.40625, y: 0.40625 },\n { x: 0.40625, y: 0.40625 },\n { x: 0.46875, y: 0.40625 },\n { x: 0.46875, y: 0.40625 },\n { x: 0.53125, y: 0.40625 },\n { x: 0.53125, y: 0.40625 },\n { x: 0.59375, y: 0.40625 },\n { x: 0.59375, y: 0.40625 },\n { x: 0.65625, y: 0.40625 },\n { x: 0.65625, y: 0.40625 },\n { x: 0.71875, y: 0.40625 },\n { x: 0.71875, y: 0.40625 },\n { x: 0.78125, y: 0.40625 },\n { x: 0.78125, y: 0.40625 },\n { x: 0.84375, y: 0.40625 },\n { x: 0.84375, y: 0.40625 },\n { x: 0.90625, y: 0.40625 },\n { x: 0.90625, y: 0.40625 },\n { x: 0.96875, y: 0.40625 },\n { x: 0.96875, y: 0.40625 },\n { x: 0.03125, y: 0.46875 },\n { x: 0.03125, y: 0.46875 },\n { x: 0.09375, y: 0.46875 },\n { x: 0.09375, y: 0.46875 },\n { x: 0.15625, y: 0.46875 },\n { x: 0.15625, y: 0.46875 },\n { x: 0.21875, y: 0.46875 },\n { x: 0.21875, y: 0.46875 },\n { x: 0.28125, y: 0.46875 },\n { x: 0.28125, y: 0.46875 },\n { x: 0.34375, y: 0.46875 },\n { x: 0.34375, y: 0.46875 },\n { x: 0.40625, y: 0.46875 },\n { x: 0.40625, y: 0.46875 },\n { x: 0.46875, y: 0.46875 },\n { x: 0.46875, y: 0.46875 },\n { x: 0.53125, y: 0.46875 },\n { x: 0.53125, y: 0.46875 },\n { x: 0.59375, y: 0.46875 },\n { x: 0.59375, y: 0.46875 },\n { x: 0.65625, y: 0.46875 },\n { x: 0.65625, y: 0.46875 },\n { x: 0.71875, y: 0.46875 },\n { x: 0.71875, y: 0.46875 },\n { x: 0.78125, y: 0.46875 },\n { x: 0.78125, y: 0.46875 },\n { x: 0.84375, y: 0.46875 },\n { x: 0.84375, y: 0.46875 },\n { x: 0.90625, y: 0.46875 },\n { x: 0.90625, y: 0.46875 },\n { x: 0.96875, y: 0.46875 },\n { x: 0.96875, y: 0.46875 },\n { x: 0.03125, y: 0.53125 },\n { x: 0.03125, y: 0.53125 },\n { x: 0.09375, y: 0.53125 },\n { x: 0.09375, y: 0.53125 },\n { x: 0.15625, y: 0.53125 },\n { x: 0.15625, y: 0.53125 },\n { x: 0.21875, y: 0.53125 },\n { x: 0.21875, y: 0.53125 },\n { x: 0.28125, y: 0.53125 },\n { x: 0.28125, y: 0.53125 },\n { x: 0.34375, y: 0.53125 },\n { x: 0.34375, y: 0.53125 },\n { x: 0.40625, y: 0.53125 },\n { x: 0.40625, y: 0.53125 },\n { x: 0.46875, y: 0.53125 },\n { x: 0.46875, y: 0.53125 },\n { x: 0.53125, y: 0.53125 },\n { x: 0.53125, y: 0.53125 },\n { x: 0.59375, y: 0.53125 },\n { x: 0.59375, y: 0.53125 },\n { x: 0.65625, y: 0.53125 },\n { x: 0.65625, y: 0.53125 },\n { x: 0.71875, y: 0.53125 },\n { x: 0.71875, y: 0.53125 },\n { x: 0.78125, y: 0.53125 },\n { x: 0.78125, y: 0.53125 },\n { x: 0.84375, y: 0.53125 },\n { x: 0.84375, y: 0.53125 },\n { x: 0.90625, y: 0.53125 },\n { x: 0.90625, y: 0.53125 },\n { x: 0.96875, y: 0.53125 },\n { x: 0.96875, y: 0.53125 },\n { x: 0.03125, y: 0.59375 },\n { x: 0.03125, y: 0.59375 },\n { x: 0.09375, y: 0.59375 },\n { x: 0.09375, y: 0.59375 },\n { x: 0.15625, y: 0.59375 },\n { x: 0.15625, y: 0.59375 },\n { x: 0.21875, y: 0.59375 },\n { x: 0.21875, y: 0.59375 },\n { x: 0.28125, y: 0.59375 },\n { x: 0.28125, y: 0.59375 },\n { x: 0.34375, y: 0.59375 },\n { x: 0.34375, y: 0.59375 },\n { x: 0.40625, y: 0.59375 },\n { x: 0.40625, y: 0.59375 },\n { x: 0.46875, y: 0.59375 },\n { x: 0.46875, y: 0.59375 },\n { x: 0.53125, y: 0.59375 },\n { x: 0.53125, y: 0.59375 },\n { x: 0.59375, y: 0.59375 },\n { x: 0.59375, y: 0.59375 },\n { x: 0.65625, y: 0.59375 },\n { x: 0.65625, y: 0.59375 },\n { x: 0.71875, y: 0.59375 },\n { x: 0.71875, y: 0.59375 },\n { x: 0.78125, y: 0.59375 },\n { x: 0.78125, y: 0.59375 },\n { x: 0.84375, y: 0.59375 },\n { x: 0.84375, y: 0.59375 },\n { x: 0.90625, y: 0.59375 },\n { x: 0.90625, y: 0.59375 },\n { x: 0.96875, y: 0.59375 },\n { x: 0.96875, y: 0.59375 },\n { x: 0.03125, y: 0.65625 },\n { x: 0.03125, y: 0.65625 },\n { x: 0.09375, y: 0.65625 },\n { x: 0.09375, y: 0.65625 },\n { x: 0.15625, y: 0.65625 },\n { x: 0.15625, y: 0.65625 },\n { x: 0.21875, y: 0.65625 },\n { x: 0.21875, y: 0.65625 },\n { x: 0.28125, y: 0.65625 },\n { x: 0.28125, y: 0.65625 },\n { x: 0.34375, y: 0.65625 },\n { x: 0.34375, y: 0.65625 },\n { x: 0.40625, y: 0.65625 },\n { x: 0.40625, y: 0.65625 },\n { x: 0.46875, y: 0.65625 },\n { x: 0.46875, y: 0.65625 },\n { x: 0.53125, y: 0.65625 },\n { x: 0.53125, y: 0.65625 },\n { x: 0.59375, y: 0.65625 },\n { x: 0.59375, y: 0.65625 },\n { x: 0.65625, y: 0.65625 },\n { x: 0.65625, y: 0.65625 },\n { x: 0.71875, y: 0.65625 },\n { x: 0.71875, y: 0.65625 },\n { x: 0.78125, y: 0.65625 },\n { x: 0.78125, y: 0.65625 },\n { x: 0.84375, y: 0.65625 },\n { x: 0.84375, y: 0.65625 },\n { x: 0.90625, y: 0.65625 },\n { x: 0.90625, y: 0.65625 },\n { x: 0.96875, y: 0.65625 },\n { x: 0.96875, y: 0.65625 },\n { x: 0.03125, y: 0.71875 },\n { x: 0.03125, y: 0.71875 },\n { x: 0.09375, y: 0.71875 },\n { x: 0.09375, y: 0.71875 },\n { x: 0.15625, y: 0.71875 },\n { x: 0.15625, y: 0.71875 },\n { x: 0.21875, y: 0.71875 },\n { x: 0.21875, y: 0.71875 },\n { x: 0.28125, y: 0.71875 },\n { x: 0.28125, y: 0.71875 },\n { x: 0.34375, y: 0.71875 },\n { x: 0.34375, y: 0.71875 },\n { x: 0.40625, y: 0.71875 },\n { x: 0.40625, y: 0.71875 },\n { x: 0.46875, y: 0.71875 },\n { x: 0.46875, y: 0.71875 },\n { x: 0.53125, y: 0.71875 },\n { x: 0.53125, y: 0.71875 },\n { x: 0.59375, y: 0.71875 },\n { x: 0.59375, y: 0.71875 },\n { x: 0.65625, y: 0.71875 },\n { x: 0.65625, y: 0.71875 },\n { x: 0.71875, y: 0.71875 },\n { x: 0.71875, y: 0.71875 },\n { x: 0.78125, y: 0.71875 },\n { x: 0.78125, y: 0.71875 },\n { x: 0.84375, y: 0.71875 },\n { x: 0.84375, y: 0.71875 },\n { x: 0.90625, y: 0.71875 },\n { x: 0.90625, y: 0.71875 },\n { x: 0.96875, y: 0.71875 },\n { x: 0.96875, y: 0.71875 },\n { x: 0.03125, y: 0.78125 },\n { x: 0.03125, y: 0.78125 },\n { x: 0.09375, y: 0.78125 },\n { x: 0.09375, y: 0.78125 },\n { x: 0.15625, y: 0.78125 },\n { x: 0.15625, y: 0.78125 },\n { x: 0.21875, y: 0.78125 },\n { x: 0.21875, y: 0.78125 },\n { x: 0.28125, y: 0.78125 },\n { x: 0.28125, y: 0.78125 },\n { x: 0.34375, y: 0.78125 },\n { x: 0.34375, y: 0.78125 },\n { x: 0.40625, y: 0.78125 },\n { x: 0.40625, y: 0.78125 },\n { x: 0.46875, y: 0.78125 },\n { x: 0.46875, y: 0.78125 },\n { x: 0.53125, y: 0.78125 },\n { x: 0.53125, y: 0.78125 },\n { x: 0.59375, y: 0.78125 },\n { x: 0.59375, y: 0.78125 },\n { x: 0.65625, y: 0.78125 },\n { x: 0.65625, y: 0.78125 },\n { x: 0.71875, y: 0.78125 },\n { x: 0.71875, y: 0.78125 },\n { x: 0.78125, y: 0.78125 },\n { x: 0.78125, y: 0.78125 },\n { x: 0.84375, y: 0.78125 },\n { x: 0.84375, y: 0.78125 },\n { x: 0.90625, y: 0.78125 },\n { x: 0.90625, y: 0.78125 },\n { x: 0.96875, y: 0.78125 },\n { x: 0.96875, y: 0.78125 },\n { x: 0.03125, y: 0.84375 },\n { x: 0.03125, y: 0.84375 },\n { x: 0.09375, y: 0.84375 },\n { x: 0.09375, y: 0.84375 },\n { x: 0.15625, y: 0.84375 },\n { x: 0.15625, y: 0.84375 },\n { x: 0.21875, y: 0.84375 },\n { x: 0.21875, y: 0.84375 },\n { x: 0.28125, y: 0.84375 },\n { x: 0.28125, y: 0.84375 },\n { x: 0.34375, y: 0.84375 },\n { x: 0.34375, y: 0.84375 },\n { x: 0.40625, y: 0.84375 },\n { x: 0.40625, y: 0.84375 },\n { x: 0.46875, y: 0.84375 },\n { x: 0.46875, y: 0.84375 },\n { x: 0.53125, y: 0.84375 },\n { x: 0.53125, y: 0.84375 },\n { x: 0.59375, y: 0.84375 },\n { x: 0.59375, y: 0.84375 },\n { x: 0.65625, y: 0.84375 },\n { x: 0.65625, y: 0.84375 },\n { x: 0.71875, y: 0.84375 },\n { x: 0.71875, y: 0.84375 },\n { x: 0.78125, y: 0.84375 },\n { x: 0.78125, y: 0.84375 },\n { x: 0.84375, y: 0.84375 },\n { x: 0.84375, y: 0.84375 },\n { x: 0.90625, y: 0.84375 },\n { x: 0.90625, y: 0.84375 },\n { x: 0.96875, y: 0.84375 },\n { x: 0.96875, y: 0.84375 },\n { x: 0.03125, y: 0.90625 },\n { x: 0.03125, y: 0.90625 },\n { x: 0.09375, y: 0.90625 },\n { x: 0.09375, y: 0.90625 },\n { x: 0.15625, y: 0.90625 },\n { x: 0.15625, y: 0.90625 },\n { x: 0.21875, y: 0.90625 },\n { x: 0.21875, y: 0.90625 },\n { x: 0.28125, y: 0.90625 },\n { x: 0.28125, y: 0.90625 },\n { x: 0.34375, y: 0.90625 },\n { x: 0.34375, y: 0.90625 },\n { x: 0.40625, y: 0.90625 },\n { x: 0.40625, y: 0.90625 },\n { x: 0.46875, y: 0.90625 },\n { x: 0.46875, y: 0.90625 },\n { x: 0.53125, y: 0.90625 },\n { x: 0.53125, y: 0.90625 },\n { x: 0.59375, y: 0.90625 },\n { x: 0.59375, y: 0.90625 },\n { x: 0.65625, y: 0.90625 },\n { x: 0.65625, y: 0.90625 },\n { x: 0.71875, y: 0.90625 },\n { x: 0.71875, y: 0.90625 },\n { x: 0.78125, y: 0.90625 },\n { x: 0.78125, y: 0.90625 },\n { x: 0.84375, y: 0.90625 },\n { x: 0.84375, y: 0.90625 },\n { x: 0.90625, y: 0.90625 },\n { x: 0.90625, y: 0.90625 },\n { x: 0.96875, y: 0.90625 },\n { x: 0.96875, y: 0.90625 },\n { x: 0.03125, y: 0.96875 },\n { x: 0.03125, y: 0.96875 },\n { x: 0.09375, y: 0.96875 },\n { x: 0.09375, y: 0.96875 },\n { x: 0.15625, y: 0.96875 },\n { x: 0.15625, y: 0.96875 },\n { x: 0.21875, y: 0.96875 },\n { x: 0.21875, y: 0.96875 },\n { x: 0.28125, y: 0.96875 },\n { x: 0.28125, y: 0.96875 },\n { x: 0.34375, y: 0.96875 },\n { x: 0.34375, y: 0.96875 },\n { x: 0.40625, y: 0.96875 },\n { x: 0.40625, y: 0.96875 },\n { x: 0.46875, y: 0.96875 },\n { x: 0.46875, y: 0.96875 },\n { x: 0.53125, y: 0.96875 },\n { x: 0.53125, y: 0.96875 },\n { x: 0.59375, y: 0.96875 },\n { x: 0.59375, y: 0.96875 },\n { x: 0.65625, y: 0.96875 },\n { x: 0.65625, y: 0.96875 },\n { x: 0.71875, y: 0.96875 },\n { x: 0.71875, y: 0.96875 },\n { x: 0.78125, y: 0.96875 },\n { x: 0.78125, y: 0.96875 },\n { x: 0.84375, y: 0.96875 },\n { x: 0.84375, y: 0.96875 },\n { x: 0.90625, y: 0.96875 },\n { x: 0.90625, y: 0.96875 },\n { x: 0.96875, y: 0.96875 },\n { x: 0.96875, y: 0.96875 },\n { x: 0.0625, y: 0.0625 },\n { x: 0.0625, y: 0.0625 },\n { x: 0.0625, y: 0.0625 },\n { x: 0.0625, y: 0.0625 },\n { x: 0.0625, y: 0.0625 },\n { x: 0.0625, y: 0.0625 },\n { x: 0.1875, y: 0.0625 },\n { x: 0.1875, y: 0.0625 },\n { x: 0.1875, y: 0.0625 },\n { x: 0.1875, y: 0.0625 },\n { x: 0.1875, y: 0.0625 },\n { x: 0.1875, y: 0.0625 },\n { x: 0.3125, y: 0.0625 },\n { x: 0.3125, y: 0.0625 },\n { x: 0.3125, y: 0.0625 },\n { x: 0.3125, y: 0.0625 },\n { x: 0.3125, y: 0.0625 },\n { x: 0.3125, y: 0.0625 },\n { x: 0.4375, y: 0.0625 },\n { x: 0.4375, y: 0.0625 },\n { x: 0.4375, y: 0.0625 },\n { x: 0.4375, y: 0.0625 },\n { x: 0.4375, y: 0.0625 },\n { x: 0.4375, y: 0.0625 },\n { x: 0.5625, y: 0.0625 },\n { x: 0.5625, y: 0.0625 },\n { x: 0.5625, y: 0.0625 },\n { x: 0.5625, y: 0.0625 },\n { x: 0.5625, y: 0.0625 },\n { x: 0.5625, y: 0.0625 },\n { x: 0.6875, y: 0.0625 },\n { x: 0.6875, y: 0.0625 },\n { x: 0.6875, y: 0.0625 },\n { x: 0.6875, y: 0.0625 },\n { x: 0.6875, y: 0.0625 },\n { x: 0.6875, y: 0.0625 },\n { x: 0.8125, y: 0.0625 },\n { x: 0.8125, y: 0.0625 },\n { x: 0.8125, y: 0.0625 },\n { x: 0.8125, y: 0.0625 },\n { x: 0.8125, y: 0.0625 },\n { x: 0.8125, y: 0.0625 },\n { x: 0.9375, y: 0.0625 },\n { x: 0.9375, y: 0.0625 },\n { x: 0.9375, y: 0.0625 },\n { x: 0.9375, y: 0.0625 },\n { x: 0.9375, y: 0.0625 },\n { x: 0.9375, y: 0.0625 },\n { x: 0.0625, y: 0.1875 },\n { x: 0.0625, y: 0.1875 },\n { x: 0.0625, y: 0.1875 },\n { x: 0.0625, y: 0.1875 },\n { x: 0.0625, y: 0.1875 },\n { x: 0.0625, y: 0.1875 },\n { x: 0.1875, y: 0.1875 },\n { x: 0.1875, y: 0.1875 },\n { x: 0.1875, y: 0.1875 },\n { x: 0.1875, y: 0.1875 },\n { x: 0.1875, y: 0.1875 },\n { x: 0.1875, y: 0.1875 },\n { x: 0.3125, y: 0.1875 },\n { x: 0.3125, y: 0.1875 },\n { x: 0.3125, y: 0.1875 },\n { x: 0.3125, y: 0.1875 },\n { x: 0.3125, y: 0.1875 },\n { x: 0.3125, y: 0.1875 },\n { x: 0.4375, y: 0.1875 },\n { x: 0.4375, y: 0.1875 },\n { x: 0.4375, y: 0.1875 },\n { x: 0.4375, y: 0.1875 },\n { x: 0.4375, y: 0.1875 },\n { x: 0.4375, y: 0.1875 },\n { x: 0.5625, y: 0.1875 },\n { x: 0.5625, y: 0.1875 },\n { x: 0.5625, y: 0.1875 },\n { x: 0.5625, y: 0.1875 },\n { x: 0.5625, y: 0.1875 },\n { x: 0.5625, y: 0.1875 },\n { x: 0.6875, y: 0.1875 },\n { x: 0.6875, y: 0.1875 },\n { x: 0.6875, y: 0.1875 },\n { x: 0.6875, y: 0.1875 },\n { x: 0.6875, y: 0.1875 },\n { x: 0.6875, y: 0.1875 },\n { x: 0.8125, y: 0.1875 },\n { x: 0.8125, y: 0.1875 },\n { x: 0.8125, y: 0.1875 },\n { x: 0.8125, y: 0.1875 },\n { x: 0.8125, y: 0.1875 },\n { x: 0.8125, y: 0.1875 },\n { x: 0.9375, y: 0.1875 },\n { x: 0.9375, y: 0.1875 },\n { x: 0.9375, y: 0.1875 },\n { x: 0.9375, y: 0.1875 },\n { x: 0.9375, y: 0.1875 },\n { x: 0.9375, y: 0.1875 },\n { x: 0.0625, y: 0.3125 },\n { x: 0.0625, y: 0.3125 },\n { x: 0.0625, y: 0.3125 },\n { x: 0.0625, y: 0.3125 },\n { x: 0.0625, y: 0.3125 },\n { x: 0.0625, y: 0.3125 },\n { x: 0.1875, y: 0.3125 },\n { x: 0.1875, y: 0.3125 },\n { x: 0.1875, y: 0.3125 },\n { x: 0.1875, y: 0.3125 },\n { x: 0.1875, y: 0.3125 },\n { x: 0.1875, y: 0.3125 },\n { x: 0.3125, y: 0.3125 },\n { x: 0.3125, y: 0.3125 },\n { x: 0.3125, y: 0.3125 },\n { x: 0.3125, y: 0.3125 },\n { x: 0.3125, y: 0.3125 },\n { x: 0.3125, y: 0.3125 },\n { x: 0.4375, y: 0.3125 },\n { x: 0.4375, y: 0.3125 },\n { x: 0.4375, y: 0.3125 },\n { x: 0.4375, y: 0.3125 },\n { x: 0.4375, y: 0.3125 },\n { x: 0.4375, y: 0.3125 },\n { x: 0.5625, y: 0.3125 },\n { x: 0.5625, y: 0.3125 },\n { x: 0.5625, y: 0.3125 },\n { x: 0.5625, y: 0.3125 },\n { x: 0.5625, y: 0.3125 },\n { x: 0.5625, y: 0.3125 },\n { x: 0.6875, y: 0.3125 },\n { x: 0.6875, y: 0.3125 },\n { x: 0.6875, y: 0.3125 },\n { x: 0.6875, y: 0.3125 },\n { x: 0.6875, y: 0.3125 },\n { x: 0.6875, y: 0.3125 },\n { x: 0.8125, y: 0.3125 },\n { x: 0.8125, y: 0.3125 },\n { x: 0.8125, y: 0.3125 },\n { x: 0.8125, y: 0.3125 },\n { x: 0.8125, y: 0.3125 },\n { x: 0.8125, y: 0.3125 },\n { x: 0.9375, y: 0.3125 },\n { x: 0.9375, y: 0.3125 },\n { x: 0.9375, y: 0.3125 },\n { x: 0.9375, y: 0.3125 },\n { x: 0.9375, y: 0.3125 },\n { x: 0.9375, y: 0.3125 },\n { x: 0.0625, y: 0.4375 },\n { x: 0.0625, y: 0.4375 },\n { x: 0.0625, y: 0.4375 },\n { x: 0.0625, y: 0.4375 },\n { x: 0.0625, y: 0.4375 },\n { x: 0.0625, y: 0.4375 },\n { x: 0.1875, y: 0.4375 },\n { x: 0.1875, y: 0.4375 },\n { x: 0.1875, y: 0.4375 },\n { x: 0.1875, y: 0.4375 },\n { x: 0.1875, y: 0.4375 },\n { x: 0.1875, y: 0.4375 },\n { x: 0.3125, y: 0.4375 },\n { x: 0.3125, y: 0.4375 },\n { x: 0.3125, y: 0.4375 },\n { x: 0.3125, y: 0.4375 },\n { x: 0.3125, y: 0.4375 },\n { x: 0.3125, y: 0.4375 },\n { x: 0.4375, y: 0.4375 },\n { x: 0.4375, y: 0.4375 },\n { x: 0.4375, y: 0.4375 },\n { x: 0.4375, y: 0.4375 },\n { x: 0.4375, y: 0.4375 },\n { x: 0.4375, y: 0.4375 },\n { x: 0.5625, y: 0.4375 },\n { x: 0.5625, y: 0.4375 },\n { x: 0.5625, y: 0.4375 },\n { x: 0.5625, y: 0.4375 },\n { x: 0.5625, y: 0.4375 },\n { x: 0.5625, y: 0.4375 },\n { x: 0.6875, y: 0.4375 },\n { x: 0.6875, y: 0.4375 },\n { x: 0.6875, y: 0.4375 },\n { x: 0.6875, y: 0.4375 },\n { x: 0.6875, y: 0.4375 },\n { x: 0.6875, y: 0.4375 },\n { x: 0.8125, y: 0.4375 },\n { x: 0.8125, y: 0.4375 },\n { x: 0.8125, y: 0.4375 },\n { x: 0.8125, y: 0.4375 },\n { x: 0.8125, y: 0.4375 },\n { x: 0.8125, y: 0.4375 },\n { x: 0.9375, y: 0.4375 },\n { x: 0.9375, y: 0.4375 },\n { x: 0.9375, y: 0.4375 },\n { x: 0.9375, y: 0.4375 },\n { x: 0.9375, y: 0.4375 },\n { x: 0.9375, y: 0.4375 },\n { x: 0.0625, y: 0.5625 },\n { x: 0.0625, y: 0.5625 },\n { x: 0.0625, y: 0.5625 },\n { x: 0.0625, y: 0.5625 },\n { x: 0.0625, y: 0.5625 },\n { x: 0.0625, y: 0.5625 },\n { x: 0.1875, y: 0.5625 },\n { x: 0.1875, y: 0.5625 },\n { x: 0.1875, y: 0.5625 },\n { x: 0.1875, y: 0.5625 },\n { x: 0.1875, y: 0.5625 },\n { x: 0.1875, y: 0.5625 },\n { x: 0.3125, y: 0.5625 },\n { x: 0.3125, y: 0.5625 },\n { x: 0.3125, y: 0.5625 },\n { x: 0.3125, y: 0.5625 },\n { x: 0.3125, y: 0.5625 },\n { x: 0.3125, y: 0.5625 },\n { x: 0.4375, y: 0.5625 },\n { x: 0.4375, y: 0.5625 },\n { x: 0.4375, y: 0.5625 },\n { x: 0.4375, y: 0.5625 },\n { x: 0.4375, y: 0.5625 },\n { x: 0.4375, y: 0.5625 },\n { x: 0.5625, y: 0.5625 },\n { x: 0.5625, y: 0.5625 },\n { x: 0.5625, y: 0.5625 },\n { x: 0.5625, y: 0.5625 },\n { x: 0.5625, y: 0.5625 },\n { x: 0.5625, y: 0.5625 },\n { x: 0.6875, y: 0.5625 },\n { x: 0.6875, y: 0.5625 },\n { x: 0.6875, y: 0.5625 },\n { x: 0.6875, y: 0.5625 },\n { x: 0.6875, y: 0.5625 },\n { x: 0.6875, y: 0.5625 },\n { x: 0.8125, y: 0.5625 },\n { x: 0.8125, y: 0.5625 },\n { x: 0.8125, y: 0.5625 },\n { x: 0.8125, y: 0.5625 },\n { x: 0.8125, y: 0.5625 },\n { x: 0.8125, y: 0.5625 },\n { x: 0.9375, y: 0.5625 },\n { x: 0.9375, y: 0.5625 },\n { x: 0.9375, y: 0.5625 },\n { x: 0.9375, y: 0.5625 },\n { x: 0.9375, y: 0.5625 },\n { x: 0.9375, y: 0.5625 },\n { x: 0.0625, y: 0.6875 },\n { x: 0.0625, y: 0.6875 },\n { x: 0.0625, y: 0.6875 },\n { x: 0.0625, y: 0.6875 },\n { x: 0.0625, y: 0.6875 },\n { x: 0.0625, y: 0.6875 },\n { x: 0.1875, y: 0.6875 },\n { x: 0.1875, y: 0.6875 },\n { x: 0.1875, y: 0.6875 },\n { x: 0.1875, y: 0.6875 },\n { x: 0.1875, y: 0.6875 },\n { x: 0.1875, y: 0.6875 },\n { x: 0.3125, y: 0.6875 },\n { x: 0.3125, y: 0.6875 },\n { x: 0.3125, y: 0.6875 },\n { x: 0.3125, y: 0.6875 },\n { x: 0.3125, y: 0.6875 },\n { x: 0.3125, y: 0.6875 },\n { x: 0.4375, y: 0.6875 },\n { x: 0.4375, y: 0.6875 },\n { x: 0.4375, y: 0.6875 },\n { x: 0.4375, y: 0.6875 },\n { x: 0.4375, y: 0.6875 },\n { x: 0.4375, y: 0.6875 },\n { x: 0.5625, y: 0.6875 },\n { x: 0.5625, y: 0.6875 },\n { x: 0.5625, y: 0.6875 },\n { x: 0.5625, y: 0.6875 },\n { x: 0.5625, y: 0.6875 },\n { x: 0.5625, y: 0.6875 },\n { x: 0.6875, y: 0.6875 },\n { x: 0.6875, y: 0.6875 },\n { x: 0.6875, y: 0.6875 },\n { x: 0.6875, y: 0.6875 },\n { x: 0.6875, y: 0.6875 },\n { x: 0.6875, y: 0.6875 },\n { x: 0.8125, y: 0.6875 },\n { x: 0.8125, y: 0.6875 },\n { x: 0.8125, y: 0.6875 },\n { x: 0.8125, y: 0.6875 },\n { x: 0.8125, y: 0.6875 },\n { x: 0.8125, y: 0.6875 },\n { x: 0.9375, y: 0.6875 },\n { x: 0.9375, y: 0.6875 },\n { x: 0.9375, y: 0.6875 },\n { x: 0.9375, y: 0.6875 },\n { x: 0.9375, y: 0.6875 },\n { x: 0.9375, y: 0.6875 },\n { x: 0.0625, y: 0.8125 },\n { x: 0.0625, y: 0.8125 },\n { x: 0.0625, y: 0.8125 },\n { x: 0.0625, y: 0.8125 },\n { x: 0.0625, y: 0.8125 },\n { x: 0.0625, y: 0.8125 },\n { x: 0.1875, y: 0.8125 },\n { x: 0.1875, y: 0.8125 },\n { x: 0.1875, y: 0.8125 },\n { x: 0.1875, y: 0.8125 },\n { x: 0.1875, y: 0.8125 },\n { x: 0.1875, y: 0.8125 },\n { x: 0.3125, y: 0.8125 },\n { x: 0.3125, y: 0.8125 },\n { x: 0.3125, y: 0.8125 },\n { x: 0.3125, y: 0.8125 },\n { x: 0.3125, y: 0.8125 },\n { x: 0.3125, y: 0.8125 },\n { x: 0.4375, y: 0.8125 },\n { x: 0.4375, y: 0.8125 },\n { x: 0.4375, y: 0.8125 },\n { x: 0.4375, y: 0.8125 },\n { x: 0.4375, y: 0.8125 },\n { x: 0.4375, y: 0.8125 },\n { x: 0.5625, y: 0.8125 },\n { x: 0.5625, y: 0.8125 },\n { x: 0.5625, y: 0.8125 },\n { x: 0.5625, y: 0.8125 },\n { x: 0.5625, y: 0.8125 },\n { x: 0.5625, y: 0.8125 },\n { x: 0.6875, y: 0.8125 },\n { x: 0.6875, y: 0.8125 },\n { x: 0.6875, y: 0.8125 },\n { x: 0.6875, y: 0.8125 },\n { x: 0.6875, y: 0.8125 },\n { x: 0.6875, y: 0.8125 },\n { x: 0.8125, y: 0.8125 },\n { x: 0.8125, y: 0.8125 },\n { x: 0.8125, y: 0.8125 },\n { x: 0.8125, y: 0.8125 },\n { x: 0.8125, y: 0.8125 },\n { x: 0.8125, y: 0.8125 },\n { x: 0.9375, y: 0.8125 },\n { x: 0.9375, y: 0.8125 },\n { x: 0.9375, y: 0.8125 },\n { x: 0.9375, y: 0.8125 },\n { x: 0.9375, y: 0.8125 },\n { x: 0.9375, y: 0.8125 },\n { x: 0.0625, y: 0.9375 },\n { x: 0.0625, y: 0.9375 },\n { x: 0.0625, y: 0.9375 },\n { x: 0.0625, y: 0.9375 },\n { x: 0.0625, y: 0.9375 },\n { x: 0.0625, y: 0.9375 },\n { x: 0.1875, y: 0.9375 },\n { x: 0.1875, y: 0.9375 },\n { x: 0.1875, y: 0.9375 },\n { x: 0.1875, y: 0.9375 },\n { x: 0.1875, y: 0.9375 },\n { x: 0.1875, y: 0.9375 },\n { x: 0.3125, y: 0.9375 },\n { x: 0.3125, y: 0.9375 },\n { x: 0.3125, y: 0.9375 },\n { x: 0.3125, y: 0.9375 },\n { x: 0.3125, y: 0.9375 },\n { x: 0.3125, y: 0.9375 },\n { x: 0.4375, y: 0.9375 },\n { x: 0.4375, y: 0.9375 },\n { x: 0.4375, y: 0.9375 },\n { x: 0.4375, y: 0.9375 },\n { x: 0.4375, y: 0.9375 },\n { x: 0.4375, y: 0.9375 },\n { x: 0.5625, y: 0.9375 },\n { x: 0.5625, y: 0.9375 },\n { x: 0.5625, y: 0.9375 },\n { x: 0.5625, y: 0.9375 },\n { x: 0.5625, y: 0.9375 },\n { x: 0.5625, y: 0.9375 },\n { x: 0.6875, y: 0.9375 },\n { x: 0.6875, y: 0.9375 },\n { x: 0.6875, y: 0.9375 },\n { x: 0.6875, y: 0.9375 },\n { x: 0.6875, y: 0.9375 },\n { x: 0.6875, y: 0.9375 },\n { x: 0.8125, y: 0.9375 },\n { x: 0.8125, y: 0.9375 },\n { x: 0.8125, y: 0.9375 },\n { x: 0.8125, y: 0.9375 },\n { x: 0.8125, y: 0.9375 },\n { x: 0.8125, y: 0.9375 },\n { x: 0.9375, y: 0.9375 },\n { x: 0.9375, y: 0.9375 },\n { x: 0.9375, y: 0.9375 },\n { x: 0.9375, y: 0.9375 },\n { x: 0.9375, y: 0.9375 },\n { x: 0.9375, y: 0.9375 },\n];\n", "import * as tf from '../../dist/tfjs.esm.js';\nimport * as box from './box';\nimport * as anchors from './anchors';\nimport { Tensor, GraphModel } from '../tfjs/types';\n\nexport class HandDetector {\n model: GraphModel;\n anchors: number[][];\n anchorsTensor: Tensor;\n inputSize: number;\n inputSizeTensor: Tensor;\n doubleInputSizeTensor: Tensor;\n\n constructor(model) {\n this.model = model;\n this.anchors = anchors.anchors.map((anchor) => [anchor.x, anchor.y]);\n this.anchorsTensor = tf.tensor2d(this.anchors);\n // @ts-ignore model is not undefined here\n this.inputSize = this.model?.inputs[0].shape[2];\n this.inputSizeTensor = tf.tensor1d([this.inputSize, this.inputSize]);\n this.doubleInputSizeTensor = tf.tensor1d([this.inputSize * 2, this.inputSize * 2]);\n }\n\n normalizeBoxes(boxes) {\n return tf.tidy(() => {\n const boxOffsets = tf.slice(boxes, [0, 0], [-1, 2]);\n const boxSizes = tf.slice(boxes, [0, 2], [-1, 2]);\n const boxCenterPoints = tf.add(tf.div(boxOffsets, this.inputSizeTensor), this.anchorsTensor);\n const halfBoxSizes = tf.div(boxSizes, this.doubleInputSizeTensor);\n const startPoints = tf.mul(tf.sub(boxCenterPoints, halfBoxSizes), this.inputSizeTensor);\n const endPoints = tf.mul(tf.add(boxCenterPoints, halfBoxSizes), this.inputSizeTensor);\n return tf.concat2d([startPoints, endPoints], 1);\n });\n }\n\n normalizeLandmarks(rawPalmLandmarks, index) {\n return tf.tidy(() => {\n const landmarks = tf.add(tf.div(rawPalmLandmarks.reshape([-1, 7, 2]), this.inputSizeTensor), this.anchors[index]);\n return tf.mul(landmarks, this.inputSizeTensor);\n });\n }\n\n async getBoxes(input, config) {\n const batched = this.model.predict(input) as Tensor;\n const predictions = tf.squeeze(batched);\n batched.dispose();\n const scoresT = tf.tidy(() => tf.sigmoid(tf.slice(predictions, [0, 0], [-1, 1])).squeeze());\n const scores = scoresT.dataSync();\n const rawBoxes = tf.slice(predictions, [0, 1], [-1, 4]);\n const boxes = this.normalizeBoxes(rawBoxes);\n rawBoxes.dispose();\n const filteredT = await tf.image.nonMaxSuppressionAsync(boxes, scores, config.hand.maxDetected, config.hand.iouThreshold, config.hand.minConfidence);\n const filtered = filteredT.arraySync();\n\n scoresT.dispose();\n filteredT.dispose();\n const hands: Array<{ box: Tensor, palmLandmarks: Tensor, confidence: number }> = [];\n for (const index of filtered) {\n if (scores[index] >= config.hand.minConfidence) {\n const matchingBox = tf.slice(boxes, [index, 0], [1, -1]);\n const rawPalmLandmarks = tf.slice(predictions, [index, 5], [1, 14]);\n const palmLandmarks = tf.tidy(() => this.normalizeLandmarks(rawPalmLandmarks, index).reshape([-1, 2]));\n rawPalmLandmarks.dispose();\n hands.push({ box: matchingBox, palmLandmarks, confidence: scores[index] });\n }\n }\n predictions.dispose();\n boxes.dispose();\n return hands;\n }\n\n async estimateHandBounds(input, config): Promise<{ startPoint: number[]; endPoint: number[]; palmLandmarks: number[]; confidence: number }[]> {\n const inputHeight = input.shape[1];\n const inputWidth = input.shape[2];\n const image = tf.tidy(() => input.resizeBilinear([this.inputSize, this.inputSize]).div(127.5).sub(1));\n const predictions = await this.getBoxes(image, config);\n image.dispose();\n const hands: Array<{ startPoint: number[]; endPoint: number[]; palmLandmarks: number[]; confidence: number }> = [];\n if (!predictions || predictions.length === 0) return hands;\n for (const prediction of predictions) {\n const boxes = prediction.box.dataSync();\n const startPoint = boxes.slice(0, 2);\n const endPoint = boxes.slice(2, 4);\n const palmLandmarks = prediction.palmLandmarks.arraySync();\n prediction.box.dispose();\n prediction.palmLandmarks.dispose();\n hands.push(box.scaleBoxCoordinates({ startPoint, endPoint, palmLandmarks, confidence: prediction.confidence }, [inputWidth / this.inputSize, inputHeight / this.inputSize]));\n }\n return hands;\n }\n}\n", "export function normalizeRadians(angle) {\n return angle - 2 * Math.PI * Math.floor((angle + Math.PI) / (2 * Math.PI));\n}\n\nexport function computeRotation(point1, point2) {\n const radians = Math.PI / 2 - Math.atan2(-(point2[1] - point1[1]), point2[0] - point1[0]);\n return normalizeRadians(radians);\n}\n\nexport const buildTranslationMatrix = (x, y) => [[1, 0, x], [0, 1, y], [0, 0, 1]];\n\nexport function dot(v1, v2) {\n let product = 0;\n for (let i = 0; i < v1.length; i++) {\n product += v1[i] * v2[i];\n }\n return product;\n}\n\nexport function getColumnFrom2DArr(arr, columnIndex) {\n const column: Array = [];\n for (let i = 0; i < arr.length; i++) {\n column.push(arr[i][columnIndex]);\n }\n return column;\n}\n\nexport function multiplyTransformMatrices(mat1, mat2) {\n const product: Array = [];\n const size = mat1.length;\n for (let row = 0; row < size; row++) {\n product.push([]);\n for (let col = 0; col < size; col++) {\n product[row].push(dot(mat1[row], getColumnFrom2DArr(mat2, col)));\n }\n }\n return product;\n}\n\nexport function buildRotationMatrix(rotation, center) {\n const cosA = Math.cos(rotation);\n const sinA = Math.sin(rotation);\n const rotationMatrix = [[cosA, -sinA, 0], [sinA, cosA, 0], [0, 0, 1]];\n const translationMatrix = buildTranslationMatrix(center[0], center[1]);\n const translationTimesRotation = multiplyTransformMatrices(translationMatrix, rotationMatrix);\n const negativeTranslationMatrix = buildTranslationMatrix(-center[0], -center[1]);\n return multiplyTransformMatrices(translationTimesRotation, negativeTranslationMatrix);\n}\n\nexport function invertTransformMatrix(matrix) {\n const rotationComponent = [[matrix[0][0], matrix[1][0]], [matrix[0][1], matrix[1][1]]];\n const translationComponent = [matrix[0][2], matrix[1][2]];\n const invertedTranslation = [\n -dot(rotationComponent[0], translationComponent),\n -dot(rotationComponent[1], translationComponent),\n ];\n return [\n rotationComponent[0].concat(invertedTranslation[0]),\n rotationComponent[1].concat(invertedTranslation[1]),\n [0, 0, 1],\n ];\n}\n\nexport function rotatePoint(homogeneousCoordinate, rotationMatrix) {\n return [\n dot(homogeneousCoordinate, rotationMatrix[0]),\n dot(homogeneousCoordinate, rotationMatrix[1]),\n ];\n}\n", "import * as tf from '../../dist/tfjs.esm.js';\nimport * as box from './box';\nimport * as util from './util';\nimport * as detector from './handdetector';\nimport { Tensor, GraphModel } from '../tfjs/types';\n\nconst palmBoxEnlargeFactor = 5; // default 3\nconst handBoxEnlargeFactor = 1.65; // default 1.65\nconst palmLandmarkIds = [0, 5, 9, 13, 17, 1, 2];\nconst palmLandmarksPalmBase = 0;\nconst palmLandmarksMiddleFingerBase = 2;\n\nexport class HandPipeline {\n handDetector: detector.HandDetector;\n handPoseModel: GraphModel;\n inputSize: number;\n storedBoxes: Array<{ startPoint: number[]; endPoint: number[]; palmLandmarks: number[]; confidence: number } | null>;\n skipped: number;\n detectedHands: number;\n\n constructor(handDetector, handPoseModel) {\n this.handDetector = handDetector;\n this.handPoseModel = handPoseModel;\n // @ts-ignore model is not undefined here\n this.inputSize = this.handPoseModel?.inputs[0].shape[2];\n this.storedBoxes = [];\n this.skipped = 0;\n this.detectedHands = 0;\n }\n\n // eslint-disable-next-line class-methods-use-this\n calculateLandmarksBoundingBox(landmarks) {\n const xs = landmarks.map((d) => d[0]);\n const ys = landmarks.map((d) => d[1]);\n const startPoint = [Math.min(...xs), Math.min(...ys)];\n const endPoint = [Math.max(...xs), Math.max(...ys)];\n return { startPoint, endPoint };\n }\n\n getBoxForPalmLandmarks(palmLandmarks, rotationMatrix) {\n const rotatedPalmLandmarks = palmLandmarks.map((coord) => util.rotatePoint([...coord, 1], rotationMatrix));\n const boxAroundPalm = this.calculateLandmarksBoundingBox(rotatedPalmLandmarks);\n return box.enlargeBox(box.squarifyBox(boxAroundPalm), palmBoxEnlargeFactor);\n }\n\n getBoxForHandLandmarks(landmarks) {\n const boundingBox = this.calculateLandmarksBoundingBox(landmarks);\n const boxAroundHand = box.enlargeBox(box.squarifyBox(boundingBox), handBoxEnlargeFactor);\n boxAroundHand.palmLandmarks = [];\n for (let i = 0; i < palmLandmarkIds.length; i++) {\n boxAroundHand.palmLandmarks.push(landmarks[palmLandmarkIds[i]].slice(0, 2));\n }\n return boxAroundHand;\n }\n\n transformRawCoords(rawCoords, box2, angle, rotationMatrix) {\n const boxSize = box.getBoxSize(box2);\n const scaleFactor = [boxSize[0] / this.inputSize, boxSize[1] / this.inputSize, (boxSize[0] + boxSize[1]) / this.inputSize / 2];\n const coordsScaled = rawCoords.map((coord) => [\n scaleFactor[0] * (coord[0] - this.inputSize / 2),\n scaleFactor[1] * (coord[1] - this.inputSize / 2),\n scaleFactor[2] * coord[2],\n ]);\n const coordsRotationMatrix = util.buildRotationMatrix(angle, [0, 0]);\n const coordsRotated = coordsScaled.map((coord) => {\n const rotated = util.rotatePoint(coord, coordsRotationMatrix);\n return [...rotated, coord[2]];\n });\n const inverseRotationMatrix = util.invertTransformMatrix(rotationMatrix);\n const boxCenter = [...box.getBoxCenter(box2), 1];\n const originalBoxCenter = [\n util.dot(boxCenter, inverseRotationMatrix[0]),\n util.dot(boxCenter, inverseRotationMatrix[1]),\n ];\n return coordsRotated.map((coord) => [\n Math.trunc(coord[0] + originalBoxCenter[0]),\n Math.trunc(coord[1] + originalBoxCenter[1]),\n Math.trunc(coord[2]),\n ]);\n }\n\n async estimateHands(image, config) {\n let useFreshBox = false;\n\n // run new detector every skipFrames unless we only want box to start with\n let boxes;\n\n // console.log(this.skipped, config.hand.skipFrames, !config.hand.landmarks, !config.skipFrame);\n if ((this.skipped === 0) || (this.skipped > config.hand.skipFrames) || !config.hand.landmarks || !config.skipFrame) {\n boxes = await this.handDetector.estimateHandBounds(image, config);\n this.skipped = 0;\n }\n if (config.skipFrame) this.skipped++;\n\n // if detector result count doesn't match current working set, use it to reset current working set\n if (boxes && (boxes.length > 0) && ((boxes.length !== this.detectedHands) && (this.detectedHands !== config.hand.maxDetected) || !config.hand.landmarks)) {\n this.detectedHands = 0;\n this.storedBoxes = [...boxes];\n // for (const possible of boxes) this.storedBoxes.push(possible);\n if (this.storedBoxes.length > 0) useFreshBox = true;\n }\n const hands: Array<{ landmarks?: number[], confidence: number, box: { topLeft: number[], bottomRight: number[] } }> = [];\n\n // go through working set of boxes\n for (let i = 0; i < this.storedBoxes.length; i++) {\n const currentBox = this.storedBoxes[i];\n if (!currentBox) continue;\n if (config.hand.landmarks) {\n const angle = config.hand.rotation ? util.computeRotation(currentBox.palmLandmarks[palmLandmarksPalmBase], currentBox.palmLandmarks[palmLandmarksMiddleFingerBase]) : 0;\n const palmCenter = box.getBoxCenter(currentBox);\n const palmCenterNormalized = [palmCenter[0] / image.shape[2], palmCenter[1] / image.shape[1]];\n const rotatedImage = config.hand.rotation && tf.ENV.flags.IS_BROWSER ? tf.image.rotateWithOffset(image, angle, 0, palmCenterNormalized) : image.clone();\n const rotationMatrix = util.buildRotationMatrix(-angle, palmCenter);\n const newBox = useFreshBox ? this.getBoxForPalmLandmarks(currentBox.palmLandmarks, rotationMatrix) : currentBox;\n const croppedInput = box.cutBoxFromImageAndResize(newBox, rotatedImage, [this.inputSize, this.inputSize]);\n const handImage = croppedInput.div(255);\n croppedInput.dispose();\n rotatedImage.dispose();\n const [confidenceT, keypoints] = await this.handPoseModel.predict(handImage) as Array;\n handImage.dispose();\n const confidence = confidenceT.dataSync()[0];\n confidenceT.dispose();\n if (confidence >= config.hand.minConfidence) {\n const keypointsReshaped = tf.reshape(keypoints, [-1, 3]);\n const rawCoords = keypointsReshaped.arraySync();\n keypoints.dispose();\n keypointsReshaped.dispose();\n const coords = this.transformRawCoords(rawCoords, newBox, angle, rotationMatrix);\n const nextBoundingBox = this.getBoxForHandLandmarks(coords);\n this.storedBoxes[i] = { ...nextBoundingBox, confidence };\n const result = {\n landmarks: coords,\n confidence,\n box: { topLeft: nextBoundingBox.startPoint, bottomRight: nextBoundingBox.endPoint },\n };\n hands.push(result);\n } else {\n this.storedBoxes[i] = null;\n }\n keypoints.dispose();\n } else {\n // const enlarged = box.enlargeBox(box.squarifyBox(box.shiftBox(currentBox, HAND_BOX_SHIFT_VECTOR)), handBoxEnlargeFactor);\n const enlarged = box.enlargeBox(box.squarifyBox(currentBox), handBoxEnlargeFactor);\n const result = {\n confidence: currentBox.confidence,\n box: { topLeft: enlarged.startPoint, bottomRight: enlarged.endPoint },\n };\n hands.push(result);\n }\n }\n this.storedBoxes = this.storedBoxes.filter((a) => a !== null);\n this.detectedHands = hands.length;\n return hands;\n }\n}\n", "/**\n * HandPose module entry point\n */\n\nimport { log, join } from '../helpers';\nimport * as tf from '../../dist/tfjs.esm.js';\nimport * as handdetector from './handdetector';\nimport * as handpipeline from './handpipeline';\nimport { Hand } from '../result';\nimport { Tensor, GraphModel } from '../tfjs/types';\nimport { Config } from '../config';\n\nconst meshAnnotations = {\n thumb: [1, 2, 3, 4],\n indexFinger: [5, 6, 7, 8],\n middleFinger: [9, 10, 11, 12],\n ringFinger: [13, 14, 15, 16],\n pinky: [17, 18, 19, 20],\n palmBase: [0],\n};\n\nlet handDetectorModel: GraphModel | null;\nlet handPoseModel: GraphModel | null;\nlet handPipeline: handpipeline.HandPipeline;\n\nexport async function predict(input: Tensor, config: Config): Promise {\n const predictions = await handPipeline.estimateHands(input, config);\n if (!predictions) return [];\n const hands: Array = [];\n for (let i = 0; i < predictions.length; i++) {\n const annotations = {};\n if (predictions[i].landmarks) {\n for (const key of Object.keys(meshAnnotations)) {\n // @ts-ignore landmarks are not undefined\n annotations[key] = meshAnnotations[key].map((index) => predictions[i].landmarks[index]);\n }\n }\n\n const keypoints = predictions[i].landmarks as unknown as Array<[number, number, number]>;\n\n let box: [number, number, number, number] = [Number.MAX_SAFE_INTEGER, Number.MAX_SAFE_INTEGER, 0, 0]; // maximums so conditionals work\n let boxRaw: [number, number, number, number] = [0, 0, 0, 0];\n if (keypoints && keypoints.length > 0) { // if we have landmarks, calculate box based on landmarks\n for (const pt of keypoints) {\n if (pt[0] < box[0]) box[0] = pt[0];\n if (pt[1] < box[1]) box[1] = pt[1];\n if (pt[0] > box[2]) box[2] = pt[0];\n if (pt[1] > box[3]) box[3] = pt[1];\n }\n box[2] -= box[0];\n box[3] -= box[1];\n boxRaw = [box[0] / (input.shape[2] || 0), box[1] / (input.shape[1] || 0), box[2] / (input.shape[2] || 0), box[3] / (input.shape[1] || 0)];\n } else { // otherwise use box from prediction\n box = predictions[i].box ? [\n Math.trunc(Math.max(0, predictions[i].box.topLeft[0])),\n Math.trunc(Math.max(0, predictions[i].box.topLeft[1])),\n Math.trunc(Math.min((input.shape[2] || 0), predictions[i].box.bottomRight[0]) - Math.max(0, predictions[i].box.topLeft[0])),\n Math.trunc(Math.min((input.shape[1] || 0), predictions[i].box.bottomRight[1]) - Math.max(0, predictions[i].box.topLeft[1])),\n ] : [0, 0, 0, 0];\n boxRaw = [\n (predictions[i].box.topLeft[0]) / (input.shape[2] || 0),\n (predictions[i].box.topLeft[1]) / (input.shape[1] || 0),\n (predictions[i].box.bottomRight[0] - predictions[i].box.topLeft[0]) / (input.shape[2] || 0),\n (predictions[i].box.bottomRight[1] - predictions[i].box.topLeft[1]) / (input.shape[1] || 0),\n ];\n }\n hands.push({ id: i, score: Math.round(100 * predictions[i].confidence) / 100, box, boxRaw, keypoints, annotations });\n }\n return hands;\n}\n\nexport async function load(config: Config): Promise<[unknown, unknown]> {\n if (!handDetectorModel || !handPoseModel) {\n // @ts-ignore type mismatch on GraphModel\n [handDetectorModel, handPoseModel] = await Promise.all([\n config.hand.enabled ? tf.loadGraphModel(join(config.modelBasePath, config.hand.detector.modelPath), { fromTFHub: config.hand.detector.modelPath.includes('tfhub.dev') }) : null,\n config.hand.landmarks ? tf.loadGraphModel(join(config.modelBasePath, config.hand.skeleton.modelPath), { fromTFHub: config.hand.skeleton.modelPath.includes('tfhub.dev') }) : null,\n ]);\n if (config.hand.enabled) {\n if (!handDetectorModel || !handDetectorModel['modelUrl']) log('load model failed:', config.hand.detector.modelPath);\n else if (config.debug) log('load model:', handDetectorModel['modelUrl']);\n if (!handPoseModel || !handPoseModel['modelUrl']) log('load model failed:', config.hand.skeleton.modelPath);\n else if (config.debug) log('load model:', handPoseModel['modelUrl']);\n }\n } else {\n if (config.debug) log('cached model:', handDetectorModel['modelUrl']);\n if (config.debug) log('cached model:', handPoseModel['modelUrl']);\n }\n const handDetector = new handdetector.HandDetector(handDetectorModel);\n handPipeline = new handpipeline.HandPipeline(handDetector, handPoseModel);\n return [handDetectorModel, handPoseModel];\n}\n", "export const full = [\n 'nose',\n 'leftEyeInside',\n 'leftEye',\n 'leftEyeOutside',\n 'rightEyeInside',\n 'rightEye',\n 'rightEyeOutside',\n 'leftEar',\n 'rightEar',\n 'leftMouth',\n 'rightMouth',\n 'leftShoulder',\n 'rightShoulder',\n 'leftElbow',\n 'rightElbow',\n 'leftWrist',\n 'rightWrist',\n 'leftPalm',\n 'rightPalm',\n 'leftIndex',\n 'rightIndex',\n 'leftPinky',\n 'rightPinky',\n 'leftHip',\n 'rightHip',\n 'leftKnee',\n 'rightKnee',\n 'leftAnkle',\n 'rightAnkle',\n 'leftHeel',\n 'rightHeel',\n 'leftFoot',\n 'rightFoot',\n 'midHip',\n 'forehead',\n 'leftThumb',\n 'leftHand',\n 'rightThumb',\n 'rightHand',\n];\n\nexport const upper = [\n 'nose',\n 'leftEyeInside',\n 'leftEye',\n 'leftEyeOutside',\n 'rightEyeInside',\n 'rightEye',\n 'rightEyeOutside',\n 'leftEar',\n 'rightEar',\n 'leftMouth',\n 'rightMouth',\n 'leftShoulder',\n 'rightShoulder',\n 'leftElbow',\n 'rightElbow',\n 'left:15',\n 'right:16',\n 'left:17',\n 'right:18',\n 'left:19',\n 'right:20',\n 'left:21',\n 'right:22',\n 'leftChest',\n 'rightChest',\n 'neck',\n 'forehead',\n 'left:27',\n 'right:28',\n 'left:29',\n 'right:30',\n];\n", "/**\n * BlazePose Module\n */\n\n// paper: https://ai.googleblog.com/2020/08/on-device-real-time-body-pose-tracking.html\n\nimport { log, join } from '../helpers';\nimport * as tf from '../../dist/tfjs.esm.js';\nimport * as annotations from './annotations';\nimport { Tensor, GraphModel } from '../tfjs/types';\nimport { Body } from '../result';\nimport { Config } from '../config';\n\nlet model: GraphModel;\n\nexport async function load(config: Config): Promise {\n if (!model) {\n // @ts-ignore type mismatch for Graphmodel\n model = await tf.loadGraphModel(join(config.modelBasePath, config.body.modelPath));\n model['width'] = parseInt(model['signature'].inputs['input_1:0'].tensorShape.dim[2].size);\n model['height'] = parseInt(model['signature'].inputs['input_1:0'].tensorShape.dim[1].size);\n if (!model || !model['modelUrl']) log('load model failed:', config.body.modelPath);\n else if (config.debug) log('load model:', model['modelUrl']);\n } else if (config.debug) log('cached model:', model['modelUrl']);\n return model;\n}\n\nexport async function predict(image: Tensor, config: Config): Promise {\n if (!model) return [];\n if (!config.body.enabled) return [];\n const imgSize = { width: (image.shape[2] || 0), height: (image.shape[1] || 0) };\n const resize = tf.image.resizeBilinear(image, [model['width'], model['height']], false);\n const normalize = tf.div(resize, [255.0]);\n resize.dispose();\n const resT = await model.predict(normalize) as Array;\n const points = resT.find((t) => (t.size === 195 || t.size === 155))?.dataSync() || []; // order of output tensors may change between models, full has 195 and upper has 155 items\n resT.forEach((t) => t.dispose());\n normalize.dispose();\n const keypoints: Array<{ id, part, position: [number, number, number], positionRaw: [number, number, number], score, presence }> = [];\n const labels = points?.length === 195 ? annotations.full : annotations.upper; // full model has 39 keypoints, upper has 31 keypoints\n const depth = 5; // each points has x,y,z,visibility,presence\n for (let i = 0; i < points.length / depth; i++) {\n keypoints.push({\n id: i,\n part: labels[i],\n position: [\n Math.trunc(imgSize.width * points[depth * i + 0] / 255), // return normalized x value istead of 0..255\n Math.trunc(imgSize.height * points[depth * i + 1] / 255), // return normalized y value istead of 0..255\n Math.trunc(points[depth * i + 2]) + 0, // fix negative zero\n ],\n positionRaw: [\n points[depth * i + 0] / 255, // return x value normalized to 0..1\n points[depth * i + 1] / 255, // return y value normalized to 0..1\n points[depth * i + 2] + 0, // fix negative zero\n ],\n score: (100 - Math.trunc(100 / (1 + Math.exp(points[depth * i + 3])))) / 100, // reverse sigmoid value\n presence: (100 - Math.trunc(100 / (1 + Math.exp(points[depth * i + 4])))) / 100, // reverse sigmoid value\n });\n }\n const x = keypoints.map((a) => a.position[0]);\n const y = keypoints.map((a) => a.position[1]);\n const box: [number, number, number, number] = [\n Math.min(...x),\n Math.min(...y),\n Math.max(...x) - Math.min(...x),\n Math.max(...y) - Math.min(...x),\n ];\n const boxRaw: [number, number, number, number] = [0, 0, 0, 0]; // not yet implemented\n const score = keypoints.reduce((prev, curr) => (curr.score > prev ? curr.score : prev), 0);\n return [{ id: 0, score, box, boxRaw, keypoints }];\n}\n", "/**\n * EfficientPose Module\n */\n\nimport { log, join } from '../helpers';\nimport * as tf from '../../dist/tfjs.esm.js';\nimport { Body } from '../result';\nimport { GraphModel, Tensor } from '../tfjs/types';\nimport { Config } from '../config';\n\nlet model: GraphModel;\n\ntype Keypoints = { score: number, part: string, position: [number, number], positionRaw: [number, number] };\n\nconst keypoints: Array = [];\nlet box: [number, number, number, number] = [0, 0, 0, 0];\nlet boxRaw: [number, number, number, number] = [0, 0, 0, 0];\nlet score = 0;\nlet skipped = Number.MAX_SAFE_INTEGER;\n\nconst bodyParts = ['head', 'neck', 'rightShoulder', 'rightElbow', 'rightWrist', 'chest', 'leftShoulder', 'leftElbow', 'leftWrist', 'pelvis', 'rightHip', 'rightKnee', 'rightAnkle', 'leftHip', 'leftKnee', 'leftAnkle'];\n\nexport async function load(config: Config): Promise {\n if (!model) {\n // @ts-ignore type mismatch on GraphModel\n model = await tf.loadGraphModel(join(config.modelBasePath, config.body.modelPath));\n if (!model || !model['modelUrl']) log('load model failed:', config.body.modelPath);\n else if (config.debug) log('load model:', model['modelUrl']);\n } else if (config.debug) log('cached model:', model['modelUrl']);\n return model;\n}\n\n// performs argmax and max functions on a 2d tensor\nfunction max2d(inputs, minScore) {\n const [width, height] = inputs.shape;\n return tf.tidy(() => {\n // modulus op implemented in tf\n const mod = (a, b) => tf.sub(a, tf.mul(tf.div(a, tf.scalar(b, 'int32')), tf.scalar(b, 'int32')));\n // combine all data\n const reshaped = tf.reshape(inputs, [height * width]);\n // get highest score\n const newScore = tf.max(reshaped, 0).dataSync()[0];\n if (newScore > minScore) {\n // skip coordinate calculation is score is too low\n const coords = tf.argMax(reshaped, 0);\n const x = mod(coords, width).dataSync()[0];\n const y = tf.div(coords, tf.scalar(width, 'int32')).dataSync()[0];\n return [x, y, newScore];\n }\n return [0, 0, newScore];\n });\n}\n\nexport async function predict(image: Tensor, config: Config): Promise {\n if ((skipped < config.body.skipFrames) && config.skipFrame && Object.keys(keypoints).length > 0) {\n skipped++;\n return [{ id: 0, score, box, boxRaw, keypoints }];\n }\n skipped = 0;\n return new Promise(async (resolve) => {\n const tensor = tf.tidy(() => {\n if (!model.inputs[0].shape) return null;\n const resize = tf.image.resizeBilinear(image, [model.inputs[0].shape[2], model.inputs[0].shape[1]], false);\n const enhance = tf.mul(resize, 2);\n const norm = enhance.sub(1);\n return norm;\n });\n\n let resT;\n if (config.body.enabled) resT = await model.predict(tensor);\n tensor.dispose();\n\n if (resT) {\n keypoints.length = 0;\n const squeeze = resT.squeeze();\n tf.dispose(resT);\n // body parts are basically just a stack of 2d tensors\n const stack = squeeze.unstack(2);\n tf.dispose(squeeze);\n // process each unstacked tensor as a separate body part\n for (let id = 0; id < stack.length; id++) {\n // actual processing to get coordinates and score\n const [x, y, partScore] = max2d(stack[id], config.body.minConfidence);\n if (score > config.body.minConfidence) {\n keypoints.push({\n score: Math.round(100 * partScore) / 100,\n part: bodyParts[id],\n positionRaw: [ // normalized to 0..1\n // @ts-ignore model is not undefined here\n x / model.inputs[0].shape[2], y / model.inputs[0].shape[1],\n ],\n position: [ // normalized to input image size\n // @ts-ignore model is not undefined here\n Math.round(image.shape[2] * x / model.inputs[0].shape[2]), Math.round(image.shape[1] * y / model.inputs[0].shape[1]),\n ],\n });\n }\n }\n stack.forEach((s) => tf.dispose(s));\n }\n score = keypoints.reduce((prev, curr) => (curr.score > prev ? curr.score : prev), 0);\n const x = keypoints.map((a) => a.position[0]);\n const y = keypoints.map((a) => a.position[1]);\n box = [\n Math.min(...x),\n Math.min(...y),\n Math.max(...x) - Math.min(...x),\n Math.max(...y) - Math.min(...y),\n ];\n const xRaw = keypoints.map((a) => a.positionRaw[0]);\n const yRaw = keypoints.map((a) => a.positionRaw[1]);\n boxRaw = [\n Math.min(...xRaw),\n Math.min(...yRaw),\n Math.max(...xRaw) - Math.min(...xRaw),\n Math.max(...yRaw) - Math.min(...yRaw),\n ];\n resolve([{ id: 0, score, box, boxRaw, keypoints }]);\n });\n}\n", "/**\n * EfficientPose Module\n */\n\nimport { log, join } from '../helpers';\nimport * as tf from '../../dist/tfjs.esm.js';\nimport { Body } from '../result';\nimport { GraphModel, Tensor } from '../tfjs/types';\nimport { Config } from '../config';\n\nlet model: GraphModel;\n\ntype Keypoints = { score: number, part: string, position: [number, number], positionRaw: [number, number] };\n\nconst keypoints: Array = [];\nlet box: [number, number, number, number] = [0, 0, 0, 0];\nlet boxRaw: [number, number, number, number] = [0, 0, 0, 0];\nlet score = 0;\nlet skipped = Number.MAX_SAFE_INTEGER;\n\nconst bodyParts = ['nose', 'leftEye', 'rightEye', 'leftEar', 'rightEar', 'leftShoulder', 'rightShoulder', 'leftElbow', 'rightElbow', 'leftWrist', 'rightWrist', 'leftHip', 'rightHip', 'leftKnee', 'rightKnee', 'leftAnkle', 'rightAnkle'];\n\nexport async function load(config: Config): Promise {\n if (!model) {\n // @ts-ignore type mismatch on GraphModel\n model = await tf.loadGraphModel(join(config.modelBasePath, config.body.modelPath));\n if (!model || !model['modelUrl']) log('load model failed:', config.body.modelPath);\n else if (config.debug) log('load model:', model['modelUrl']);\n } else if (config.debug) log('cached model:', model['modelUrl']);\n return model;\n}\n\nexport async function predict(image: Tensor, config: Config): Promise {\n if ((skipped < config.body.skipFrames) && config.skipFrame && Object.keys(keypoints).length > 0) {\n skipped++;\n return [{ id: 0, score, box, boxRaw, keypoints }];\n }\n skipped = 0;\n return new Promise(async (resolve) => {\n const tensor = tf.tidy(() => {\n if (!model.inputs[0].shape) return null;\n const resize = tf.image.resizeBilinear(image, [model.inputs[0].shape[2], model.inputs[0].shape[1]], false);\n const cast = tf.cast(resize, 'int32');\n return cast;\n });\n\n let resT;\n if (config.body.enabled) resT = await model.predict(tensor);\n tensor.dispose();\n\n if (resT) {\n keypoints.length = 0;\n const res = resT.arraySync();\n tf.dispose(resT);\n const kpt = res[0][0];\n for (let id = 0; id < kpt.length; id++) {\n score = kpt[id][2];\n if (score > config.body.minConfidence) {\n keypoints.push({\n score: Math.round(100 * score) / 100,\n part: bodyParts[id],\n positionRaw: [ // normalized to 0..1\n kpt[id][1],\n kpt[id][0],\n ],\n position: [ // normalized to input image size\n Math.round((image.shape[2] || 0) * kpt[id][1]),\n Math.round((image.shape[1] || 0) * kpt[id][0]),\n ],\n });\n }\n }\n }\n score = keypoints.reduce((prev, curr) => (curr.score > prev ? curr.score : prev), 0);\n const x = keypoints.map((a) => a.position[0]);\n const y = keypoints.map((a) => a.position[1]);\n box = [\n Math.min(...x),\n Math.min(...y),\n Math.max(...x) - Math.min(...x),\n Math.max(...y) - Math.min(...y),\n ];\n const xRaw = keypoints.map((a) => a.positionRaw[0]);\n const yRaw = keypoints.map((a) => a.positionRaw[1]);\n boxRaw = [\n Math.min(...xRaw),\n Math.min(...yRaw),\n Math.max(...xRaw) - Math.min(...xRaw),\n Math.max(...yRaw) - Math.min(...yRaw),\n ];\n resolve([{ id: 0, score, box, boxRaw, keypoints }]);\n });\n}\n", "/**\n * CoCo Labels used by object detection modules\n */\nexport const labels = [\n { class: 1, label: 'person' },\n { class: 2, label: 'bicycle' },\n { class: 3, label: 'car' },\n { class: 4, label: 'motorcycle' },\n { class: 5, label: 'airplane' },\n { class: 6, label: 'bus' },\n { class: 7, label: 'train' },\n { class: 8, label: 'truck' },\n { class: 9, label: 'boat' },\n { class: 10, label: 'traffic light' },\n { class: 11, label: 'fire hydrant' },\n { class: 12, label: 'stop sign' },\n { class: 13, label: 'parking meter' },\n { class: 14, label: 'bench' },\n { class: 15, label: 'bird' },\n { class: 16, label: 'cat' },\n { class: 17, label: 'dog' },\n { class: 18, label: 'horse' },\n { class: 19, label: 'sheep' },\n { class: 20, label: 'cow' },\n { class: 21, label: 'elephant' },\n { class: 22, label: 'bear' },\n { class: 23, label: 'zebra' },\n { class: 24, label: 'giraffe' },\n { class: 25, label: 'backpack' },\n { class: 26, label: 'umbrella' },\n { class: 27, label: 'handbag' },\n { class: 28, label: 'tie' },\n { class: 29, label: 'suitcase' },\n { class: 30, label: 'frisbee' },\n { class: 31, label: 'skis' },\n { class: 32, label: 'snowboard' },\n { class: 33, label: 'sports ball' },\n { class: 34, label: 'kite' },\n { class: 35, label: 'baseball bat' },\n { class: 36, label: 'baseball glove' },\n { class: 37, label: 'skateboard' },\n { class: 38, label: 'surfboard' },\n { class: 39, label: 'tennis racket' },\n { class: 40, label: 'bottle' },\n { class: 41, label: 'wine glass' },\n { class: 42, label: 'cup' },\n { class: 43, label: 'fork' },\n { class: 44, label: 'knife' },\n { class: 45, label: 'spoon' },\n { class: 46, label: 'bowl' },\n { class: 47, label: 'banana' },\n { class: 48, label: 'apple' },\n { class: 49, label: 'sandwich' },\n { class: 50, label: 'orange' },\n { class: 51, label: 'broccoli' },\n { class: 52, label: 'carrot' },\n { class: 53, label: 'hot dog' },\n { class: 54, label: 'pizza' },\n { class: 55, label: 'donut' },\n { class: 56, label: 'cake' },\n { class: 57, label: 'chair' },\n { class: 58, label: 'couch' },\n { class: 59, label: 'potted plant' },\n { class: 60, label: 'bed' },\n { class: 61, label: 'dining table' },\n { class: 62, label: 'toilet' },\n { class: 63, label: 'tv' },\n { class: 64, label: 'laptop' },\n { class: 65, label: 'mouse' },\n { class: 66, label: 'remote' },\n { class: 67, label: 'keyboard' },\n { class: 68, label: 'cell phone' },\n { class: 69, label: 'microwave' },\n { class: 70, label: 'oven' },\n { class: 71, label: 'toaster' },\n { class: 72, label: 'sink' },\n { class: 73, label: 'refrigerator' },\n { class: 74, label: 'book' },\n { class: 75, label: 'clock' },\n { class: 76, label: 'vase' },\n { class: 77, label: 'scissors' },\n { class: 78, label: 'teddy bear' },\n { class: 79, label: 'hair drier' },\n { class: 80, label: 'toothbrush' },\n];\n", "/**\n * NanoDet object detection module\n */\n\nimport { log, join } from '../helpers';\nimport * as tf from '../../dist/tfjs.esm.js';\nimport { labels } from './labels';\nimport { Item } from '../result';\nimport { GraphModel, Tensor } from '../tfjs/types';\nimport { Config } from '../config';\n\nlet model;\nlet last: Array = [];\nlet skipped = Number.MAX_SAFE_INTEGER;\n\nconst scaleBox = 2.5; // increase box size\n\nexport async function load(config: Config): Promise {\n if (!model) {\n model = await tf.loadGraphModel(join(config.modelBasePath, config.object.modelPath));\n const inputs = Object.values(model.modelSignature['inputs']);\n model.inputSize = Array.isArray(inputs) ? parseInt(inputs[0].tensorShape.dim[2].size) : null;\n if (!model.inputSize) throw new Error(`Human: Cannot determine model inputSize: ${config.object.modelPath}`);\n if (!model || !model.modelUrl) log('load model failed:', config.object.modelPath);\n else if (config.debug) log('load model:', model.modelUrl);\n } else if (config.debug) log('cached model:', model.modelUrl);\n return model;\n}\n\nasync function process(res, inputSize, outputShape, config) {\n let id = 0;\n let results: Array = [];\n for (const strideSize of [1, 2, 4]) { // try each stride size as it detects large/medium/small objects\n // find scores, boxes, classes\n tf.tidy(() => { // wrap in tidy to automatically deallocate temp tensors\n const baseSize = strideSize * 13; // 13x13=169, 26x26=676, 52x52=2704\n // find boxes and scores output depending on stride\n const scoresT = res.find((a) => (a.shape[1] === (baseSize ** 2) && a.shape[2] === labels.length))?.squeeze();\n const featuresT = res.find((a) => (a.shape[1] === (baseSize ** 2) && a.shape[2] < labels.length))?.squeeze();\n const boxesMax = featuresT.reshape([-1, 4, featuresT.shape[1] / 4]); // reshape [output] to [4, output / 4] where number is number of different features inside each stride\n const boxIdx = boxesMax.argMax(2).arraySync(); // what we need is indexes of features with highest scores, not values itself\n const scores = scoresT.arraySync(); // optionally use exponential scores or just as-is\n for (let i = 0; i < scoresT.shape[0]; i++) { // total strides (x * y matrix)\n for (let j = 0; j < scoresT.shape[1]; j++) { // one score for each class\n const score = scores[i][j]; // get score for current position\n if (score > config.object.minConfidence && j !== 61) {\n const cx = (0.5 + Math.trunc(i % baseSize)) / baseSize; // center.x normalized to range 0..1\n const cy = (0.5 + Math.trunc(i / baseSize)) / baseSize; // center.y normalized to range 0..1\n const boxOffset = boxIdx[i].map((a) => a * (baseSize / strideSize / inputSize)); // just grab indexes of features with highest scores\n const [x, y] = [\n cx - (scaleBox / strideSize * boxOffset[0]),\n cy - (scaleBox / strideSize * boxOffset[1]),\n ];\n const [w, h] = [\n cx + (scaleBox / strideSize * boxOffset[2]) - x,\n cy + (scaleBox / strideSize * boxOffset[3]) - y,\n ];\n let boxRaw = [x, y, w, h]; // results normalized to range 0..1\n boxRaw = boxRaw.map((a) => Math.max(0, Math.min(a, 1))); // fix out-of-bounds coords\n const box = [ // results normalized to input image pixels\n boxRaw[0] * outputShape[0],\n boxRaw[1] * outputShape[1],\n boxRaw[2] * outputShape[0],\n boxRaw[3] * outputShape[1],\n ];\n const result = {\n id: id++,\n // strideSize,\n score: Math.round(100 * score) / 100,\n class: j + 1,\n label: labels[j].label,\n // center: [Math.trunc(outputShape[0] * cx), Math.trunc(outputShape[1] * cy)],\n // centerRaw: [cx, cy],\n box: (box.map((a) => Math.trunc(a))) as [number, number, number, number],\n boxRaw: boxRaw as [number, number, number, number],\n };\n results.push(result);\n }\n }\n }\n });\n }\n // deallocate tensors\n res.forEach((t) => tf.dispose(t));\n\n // normally nms is run on raw results, but since boxes need to be calculated this way we skip calulcation of\n // unnecessary boxes and run nms only on good candidates (basically it just does IOU analysis as scores are already filtered)\n const nmsBoxes = results.map((a) => [a.boxRaw[1], a.boxRaw[0], a.boxRaw[3], a.boxRaw[2]]); // switches coordinates from x,y to y,x as expected by tf.nms\n const nmsScores = results.map((a) => a.score);\n let nmsIdx: Array = [];\n if (nmsBoxes && nmsBoxes.length > 0) {\n const nms = await tf.image.nonMaxSuppressionAsync(nmsBoxes, nmsScores, config.object.maxDetected, config.object.iouThreshold, config.object.minConfidence);\n nmsIdx = nms.dataSync();\n tf.dispose(nms);\n }\n\n // filter & sort results\n results = results\n .filter((_val, idx) => nmsIdx.includes(idx))\n .sort((a, b) => (b.score - a.score));\n\n return results;\n}\n\nexport async function predict(image: Tensor, config: Config): Promise {\n if ((skipped < config.object.skipFrames) && config.skipFrame && (last.length > 0)) {\n skipped++;\n return last;\n }\n skipped = 0;\n return new Promise(async (resolve) => {\n const outputSize = [image.shape[2], image.shape[1]];\n const resize = tf.image.resizeBilinear(image, [model.inputSize, model.inputSize], false);\n const norm = resize.div(255);\n const transpose = norm.transpose([0, 3, 1, 2]);\n norm.dispose();\n resize.dispose();\n\n let objectT;\n if (config.object.enabled) objectT = await model.predict(transpose);\n transpose.dispose();\n\n const obj = await process(objectT, model.inputSize, outputSize, config);\n last = obj;\n resolve(obj);\n });\n}\n", "/**\n * CenterNet object detection module\n */\n\nimport { log, join } from '../helpers';\nimport * as tf from '../../dist/tfjs.esm.js';\nimport { labels } from './labels';\nimport { Item } from '../result';\nimport { GraphModel, Tensor } from '../tfjs/types';\nimport { Config } from '../config';\n\nlet model;\nlet last: Item[] = [];\nlet skipped = Number.MAX_SAFE_INTEGER;\n\nexport async function load(config: Config): Promise {\n if (!model) {\n model = await tf.loadGraphModel(join(config.modelBasePath, config.object.modelPath));\n const inputs = Object.values(model.modelSignature['inputs']);\n model.inputSize = Array.isArray(inputs) ? parseInt(inputs[0].tensorShape.dim[2].size) : null;\n if (!model.inputSize) throw new Error(`Human: Cannot determine model inputSize: ${config.object.modelPath}`);\n if (!model || !model.modelUrl) log('load model failed:', config.object.modelPath);\n else if (config.debug) log('load model:', model.modelUrl);\n } else if (config.debug) log('cached model:', model.modelUrl);\n return model;\n}\n\nasync function process(res: Tensor, inputSize, outputShape, config: Config) {\n if (!res) return [];\n const results: Array = [];\n const detections = res.arraySync();\n const squeezeT = tf.squeeze(res);\n res.dispose();\n const arr = tf.split(squeezeT, 6, 1); // x1, y1, x2, y2, score, class\n squeezeT.dispose();\n const stackT = tf.stack([arr[1], arr[0], arr[3], arr[2]], 1); // reorder dims as tf.nms expects y, x\n const boxesT = stackT.squeeze();\n const scoresT = arr[4].squeeze();\n const classesT = arr[5].squeeze();\n arr.forEach((t) => t.dispose());\n const nmsT = await tf.image.nonMaxSuppressionAsync(boxesT, scoresT, config.object.maxDetected, config.object.iouThreshold, config.object.minConfidence);\n boxesT.dispose();\n scoresT.dispose();\n classesT.dispose();\n const nms = nmsT.dataSync();\n nmsT.dispose();\n let i = 0;\n for (const id of nms) {\n const score = Math.trunc(100 * detections[0][id][4]) / 100;\n const classVal = detections[0][id][5];\n const label = labels[classVal].label;\n const boxRaw = [\n detections[0][id][0] / inputSize,\n detections[0][id][1] / inputSize,\n detections[0][id][2] / inputSize,\n detections[0][id][3] / inputSize,\n ] as [number, number, number, number];\n const box = [\n Math.trunc(boxRaw[0] * outputShape[0]),\n Math.trunc(boxRaw[1] * outputShape[1]),\n Math.trunc(boxRaw[2] * outputShape[0]),\n Math.trunc(boxRaw[3] * outputShape[1]),\n ] as [number, number, number, number];\n results.push({ id: i++, score, class: classVal, label, box, boxRaw });\n }\n return results;\n}\n\nexport async function predict(input: Tensor, config: Config): Promise {\n if ((skipped < config.object.skipFrames) && config.skipFrame && (last.length > 0)) {\n skipped++;\n return last;\n }\n skipped = 0;\n return new Promise(async (resolve) => {\n const outputSize = [input.shape[2], input.shape[1]];\n const resize = tf.image.resizeBilinear(input, [model.inputSize, model.inputSize]);\n const objectT = config.object.enabled ? model.execute(resize, ['tower_0/detections']) : null;\n resize.dispose();\n\n const obj = await process(objectT, model.inputSize, outputSize, config);\n last = obj;\n resolve(obj);\n });\n}\n", "/**\n * Gesture detection module\n */\n\nimport { Gesture } from '../result';\n\nexport const body = (res): Gesture[] => {\n if (!res) return [];\n const gestures: Array<{ body: number, gesture: string }> = [];\n for (let i = 0; i < res.length; i++) {\n // raising hands\n const leftWrist = res[i].keypoints.find((a) => (a.part === 'leftWrist'));\n const rightWrist = res[i].keypoints.find((a) => (a.part === 'rightWrist'));\n const nose = res[i].keypoints.find((a) => (a.part === 'nose'));\n if (nose && leftWrist && rightWrist && (leftWrist.position.y < nose.position.y) && (rightWrist.position.y < nose.position.y)) gestures.push({ body: i, gesture: 'i give up' });\n else if (nose && leftWrist && (leftWrist.position.y < nose.position.y)) gestures.push({ body: i, gesture: 'raise left hand' });\n else if (nose && rightWrist && (rightWrist.position.y < nose.position.y)) gestures.push({ body: i, gesture: 'raise right hand' });\n\n // leaning\n const leftShoulder = res[i].keypoints.find((a) => (a.part === 'leftShoulder'));\n const rightShoulder = res[i].keypoints.find((a) => (a.part === 'rightShoulder'));\n if (leftShoulder && rightShoulder) gestures.push({ body: i, gesture: `leaning ${(leftShoulder.position.y > rightShoulder.position.y) ? 'left' : 'right'}` });\n }\n return gestures;\n};\n\nexport const face = (res): Gesture[] => {\n if (!res) return [];\n const gestures: Array<{ face: number, gesture: string }> = [];\n for (let i = 0; i < res.length; i++) {\n if (res[i].mesh && res[i].mesh.length > 0) {\n const eyeFacing = res[i].mesh[33][2] - res[i].mesh[263][2];\n if (Math.abs(eyeFacing) < 10) gestures.push({ face: i, gesture: 'facing center' });\n else gestures.push({ face: i, gesture: `facing ${eyeFacing < 0 ? 'left' : 'right'}` });\n const openLeft = Math.abs(res[i].mesh[374][1] - res[i].mesh[386][1]) / Math.abs(res[i].mesh[443][1] - res[i].mesh[450][1]); // center of eye inner lid y coord div center of wider eye border y coord\n if (openLeft < 0.2) gestures.push({ face: i, gesture: 'blink left eye' });\n const openRight = Math.abs(res[i].mesh[145][1] - res[i].mesh[159][1]) / Math.abs(res[i].mesh[223][1] - res[i].mesh[230][1]); // center of eye inner lid y coord div center of wider eye border y coord\n if (openRight < 0.2) gestures.push({ face: i, gesture: 'blink right eye' });\n const mouthOpen = Math.min(100, 500 * Math.abs(res[i].mesh[13][1] - res[i].mesh[14][1]) / Math.abs(res[i].mesh[10][1] - res[i].mesh[152][1]));\n if (mouthOpen > 10) gestures.push({ face: i, gesture: `mouth ${Math.trunc(mouthOpen)}% open` });\n const chinDepth = res[i].mesh[152][2];\n if (Math.abs(chinDepth) > 10) gestures.push({ face: i, gesture: `head ${chinDepth < 0 ? 'up' : 'down'}` });\n }\n }\n return gestures;\n};\n\nexport const iris = (res): Gesture[] => {\n if (!res) return [];\n const gestures: Array<{ iris: number, gesture: string }> = [];\n for (let i = 0; i < res.length; i++) {\n if (!res[i].annotations || !res[i].annotations.leftEyeIris || !res[i].annotations.rightEyeIris) continue;\n const sizeXLeft = res[i].annotations.leftEyeIris[3][0] - res[i].annotations.leftEyeIris[1][0];\n const sizeYLeft = res[i].annotations.leftEyeIris[4][1] - res[i].annotations.leftEyeIris[2][1];\n const areaLeft = Math.abs(sizeXLeft * sizeYLeft);\n\n const sizeXRight = res[i].annotations.rightEyeIris[3][0] - res[i].annotations.rightEyeIris[1][0];\n const sizeYRight = res[i].annotations.rightEyeIris[4][1] - res[i].annotations.rightEyeIris[2][1];\n const areaRight = Math.abs(sizeXRight * sizeYRight);\n\n let center = false;\n const difference = Math.abs(areaLeft - areaRight) / Math.max(areaLeft, areaRight);\n if (difference < 0.25) {\n center = true;\n gestures.push({ iris: i, gesture: 'facing center' });\n }\n\n const rightIrisCenterX = Math.abs(res[i].mesh[33][0] - res[i].annotations.rightEyeIris[0][0]) / res[i].box[2];\n const leftIrisCenterX = Math.abs(res[i].mesh[263][0] - res[i].annotations.leftEyeIris[0][0]) / res[i].box[2];\n if (leftIrisCenterX > 0.06 || rightIrisCenterX > 0.06) center = false;\n if (leftIrisCenterX > 0.06) gestures.push({ iris: i, gesture: 'looking right' });\n if (rightIrisCenterX > 0.06) gestures.push({ iris: i, gesture: 'looking left' });\n\n const rightIrisCenterY = Math.abs(res[i].mesh[145][1] - res[i].annotations.rightEyeIris[0][1]) / res[i].box[3];\n const leftIrisCenterY = Math.abs(res[i].mesh[374][1] - res[i].annotations.leftEyeIris[0][1]) / res[i].box[3];\n if (leftIrisCenterY < 0.01 || rightIrisCenterY < 0.01 || leftIrisCenterY > 0.022 || rightIrisCenterY > 0.022) center = false;\n if (leftIrisCenterY < 0.01 || rightIrisCenterY < 0.01) gestures.push({ iris: i, gesture: 'looking down' });\n if (leftIrisCenterY > 0.022 || rightIrisCenterY > 0.022) gestures.push({ iris: i, gesture: 'looking up' });\n\n // still center;\n if (center) gestures.push({ iris: i, gesture: 'looking center' });\n }\n return gestures;\n};\n\nexport const hand = (res): Gesture[] => {\n if (!res) return [];\n const gestures: Array<{ hand: number, gesture: string }> = [];\n for (let i = 0; i < res.length; i++) {\n const fingers: Array<{ name: string, position: number }> = [];\n for (const [finger, pos] of Object.entries(res[i]['annotations'])) {\n if (finger !== 'palmBase' && Array.isArray(pos)) fingers.push({ name: finger.toLowerCase(), position: pos[0] }); // get tip of each finger\n }\n if (fingers && fingers.length > 0) {\n const closest = fingers.reduce((best, a) => (best.position[2] < a.position[2] ? best : a));\n const highest = fingers.reduce((best, a) => (best.position[1] < a.position[1] ? best : a));\n gestures.push({ hand: i, gesture: `${closest.name} forward ${highest.name} up` });\n }\n }\n return gestures;\n};\n", "/*\nWebGLImageFilter by Dominic Szablewski: \n*/\n\nfunction GLProgram(gl, vertexSource, fragmentSource) {\n const _collect = function (source, prefix, collection) {\n const r = new RegExp('\\\\b' + prefix + ' \\\\w+ (\\\\w+)', 'ig');\n source.replace(r, (match, name) => {\n collection[name] = 0;\n return match;\n });\n };\n\n const _compile = function (source, type) {\n const shader = gl.createShader(type);\n gl.shaderSource(shader, source);\n gl.compileShader(shader);\n if (!gl.getShaderParameter(shader, gl.COMPILE_STATUS)) throw new Error('Filter: GL compile failed', gl.getShaderInfoLog(shader));\n return shader;\n };\n\n this.uniform = {};\n this.attribute = {};\n const _vsh = _compile(vertexSource, gl.VERTEX_SHADER);\n const _fsh = _compile(fragmentSource, gl.FRAGMENT_SHADER);\n this.id = gl.createProgram();\n gl.attachShader(this.id, _vsh);\n gl.attachShader(this.id, _fsh);\n gl.linkProgram(this.id);\n\n if (!gl.getProgramParameter(this.id, gl.LINK_STATUS)) throw new Error('Filter: GL link failed', gl.getProgramInfoLog(this.id));\n\n gl.useProgram(this.id);\n // Collect attributes\n _collect(vertexSource, 'attribute', this.attribute);\n for (const a in this.attribute) this.attribute[a] = gl.getAttribLocation(this.id, a);\n // Collect uniforms\n _collect(vertexSource, 'uniform', this.uniform);\n _collect(fragmentSource, 'uniform', this.uniform);\n for (const u in this.uniform) this.uniform[u] = gl.getUniformLocation(this.id, u);\n}\n\n// export const GLImageFilter = function (params) {\nexport function GLImageFilter(params) {\n if (!params) params = { };\n let _drawCount = 0;\n let _sourceTexture = null;\n let _lastInChain = false;\n let _currentFramebufferIndex = -1;\n let _tempFramebuffers = [null, null];\n let _filterChain = [];\n let _width = -1;\n let _height = -1;\n let _vertexBuffer = null;\n let _currentProgram = null;\n const _filter = {};\n const _canvas = params.canvas || document.createElement('canvas');\n // key is the shader program source, value is the compiled program\n const _shaderProgramCache = { };\n const DRAW = { INTERMEDIATE: 1 };\n const gl = _canvas.getContext('webgl');\n if (!gl) throw new Error('Filter: getContext() failed');\n\n this.addFilter = function (name) {\n // eslint-disable-next-line prefer-rest-params\n const args = Array.prototype.slice.call(arguments, 1);\n const filter = _filter[name];\n _filterChain.push({ func: filter, args });\n };\n\n this.reset = function () {\n _filterChain = [];\n };\n\n const _resize = function (width, height) {\n // Same width/height? Nothing to do here\n if (width === _width && height === _height) { return; }\n _canvas.width = width;\n _width = width;\n _canvas.height = height;\n _height = height;\n // Create the context if we don't have it yet\n if (!_vertexBuffer) {\n // Create the vertex buffer for the two triangles [x, y, u, v] * 6\n const vertices = new Float32Array([\n -1, -1, 0, 1, 1, -1, 1, 1, -1, 1, 0, 0,\n -1, 1, 0, 0, 1, -1, 1, 1, 1, 1, 1, 0,\n ]);\n // eslint-disable-next-line no-unused-expressions\n (_vertexBuffer = gl.createBuffer(), gl.bindBuffer(gl.ARRAY_BUFFER, _vertexBuffer));\n gl.bufferData(gl.ARRAY_BUFFER, vertices, gl.STATIC_DRAW);\n gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, true);\n }\n gl.viewport(0, 0, _width, _height);\n // Delete old temp framebuffers\n _tempFramebuffers = [null, null];\n };\n\n const _createFramebufferTexture = function (width, height) {\n const fbo = gl.createFramebuffer();\n gl.bindFramebuffer(gl.FRAMEBUFFER, fbo);\n const renderbuffer = gl.createRenderbuffer();\n gl.bindRenderbuffer(gl.RENDERBUFFER, renderbuffer);\n const texture = gl.createTexture();\n gl.bindTexture(gl.TEXTURE_2D, texture);\n gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, width, height, 0, gl.RGBA, gl.UNSIGNED_BYTE, null);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.LINEAR);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.LINEAR);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);\n gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_2D, texture, 0);\n gl.bindTexture(gl.TEXTURE_2D, null);\n gl.bindFramebuffer(gl.FRAMEBUFFER, null);\n return { fbo, texture };\n };\n\n const _getTempFramebuffer = function (index) {\n _tempFramebuffers[index] = _tempFramebuffers[index] || _createFramebufferTexture(_width, _height);\n return _tempFramebuffers[index];\n };\n\n const _draw = function (flags = null) {\n let source = null;\n let target = null;\n let flipY = false;\n // Set up the source\n if (_drawCount === 0) {\n // First draw call - use the source texture\n source = _sourceTexture;\n } else {\n // All following draw calls use the temp buffer last drawn to\n source = _getTempFramebuffer(_currentFramebufferIndex)?.texture;\n }\n _drawCount++;\n // Set up the target\n if (_lastInChain && !(flags & DRAW.INTERMEDIATE)) {\n // Last filter in our chain - draw directly to the WebGL Canvas. We may\n // also have to flip the image vertically now\n target = null;\n flipY = _drawCount % 2 === 0;\n } else {\n // Intermediate draw call - get a temp buffer to draw to\n _currentFramebufferIndex = (_currentFramebufferIndex + 1) % 2;\n target = _getTempFramebuffer(_currentFramebufferIndex)?.fbo;\n }\n // Bind the source and target and draw the two triangles\n gl.bindTexture(gl.TEXTURE_2D, source);\n gl.bindFramebuffer(gl.FRAMEBUFFER, target);\n gl.uniform1f(_currentProgram.uniform.flipY, (flipY ? -1 : 1));\n gl.drawArrays(gl.TRIANGLES, 0, 6);\n };\n\n this.apply = function (image) {\n _resize(image.width, image.height);\n _drawCount = 0;\n // Create the texture for the input image if we haven't yet\n if (!_sourceTexture) _sourceTexture = gl.createTexture();\n gl.bindTexture(gl.TEXTURE_2D, _sourceTexture);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.NEAREST);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.NEAREST);\n gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, image);\n // No filters? Just draw\n if (_filterChain.length === 0) {\n // const program = _compileShader(SHADER.FRAGMENT_IDENTITY);\n _draw();\n return _canvas;\n }\n for (let i = 0; i < _filterChain.length; i++) {\n _lastInChain = (i === _filterChain.length - 1);\n const f = _filterChain[i];\n f.func.apply(this, f.args || []);\n }\n return _canvas;\n };\n\n const _compileShader = function (fragmentSource) {\n if (_shaderProgramCache[fragmentSource]) {\n _currentProgram = _shaderProgramCache[fragmentSource];\n gl.useProgram(_currentProgram.id);\n return _currentProgram;\n }\n // Compile shaders\n const SHADER = {};\n SHADER.VERTEX_IDENTITY = [\n 'precision highp float;',\n 'attribute vec2 pos;',\n 'attribute vec2 uv;',\n 'varying vec2 vUv;',\n 'uniform float flipY;',\n 'void main(void) {',\n 'vUv = uv;',\n 'gl_Position = vec4(pos.x, pos.y*flipY, 0.0, 1.);',\n '}',\n ].join('\\n');\n SHADER.FRAGMENT_IDENTITY = [\n 'precision highp float;',\n 'varying vec2 vUv;',\n 'uniform sampler2D texture;',\n 'void main(void) {',\n 'gl_FragColor = texture2D(texture, vUv);',\n '}',\n ].join('\\n');\n _currentProgram = new GLProgram(gl, SHADER.VERTEX_IDENTITY, fragmentSource);\n const floatSize = Float32Array.BYTES_PER_ELEMENT;\n const vertSize = 4 * floatSize;\n gl.enableVertexAttribArray(_currentProgram.attribute.pos);\n gl.vertexAttribPointer(_currentProgram.attribute.pos, 2, gl.FLOAT, false, vertSize, 0 * floatSize);\n gl.enableVertexAttribArray(_currentProgram.attribute.uv);\n gl.vertexAttribPointer(_currentProgram.attribute.uv, 2, gl.FLOAT, false, vertSize, 2 * floatSize);\n _shaderProgramCache[fragmentSource] = _currentProgram;\n return _currentProgram;\n };\n\n // -------------------------------------------------------------------------\n // Color Matrix Filter\n _filter.colorMatrix = function (matrix) {\n // Create a Float32 Array and normalize the offset component to 0-1\n const m = new Float32Array(matrix);\n m[4] /= 255;\n m[9] /= 255;\n m[14] /= 255;\n m[19] /= 255;\n // Can we ignore the alpha value? Makes things a bit faster.\n const shader = (m[18] === 1 && m[3] === 0 && m[8] === 0 && m[13] === 0 && m[15] === 0 && m[16] === 0 && m[17] === 0 && m[19] === 0)\n ? _filter.colorMatrix.SHADER.WITHOUT_ALPHA\n : _filter.colorMatrix.SHADER.WITH_ALPHA;\n const program = _compileShader(shader);\n gl.uniform1fv(program.uniform.m, m);\n _draw();\n };\n _filter.colorMatrix.SHADER = {};\n _filter.colorMatrix.SHADER.WITH_ALPHA = [\n 'precision highp float;',\n 'varying vec2 vUv;',\n 'uniform sampler2D texture;',\n 'uniform float m[20];',\n 'void main(void) {',\n 'vec4 c = texture2D(texture, vUv);',\n 'gl_FragColor.r = m[0] * c.r + m[1] * c.g + m[2] * c.b + m[3] * c.a + m[4];',\n 'gl_FragColor.g = m[5] * c.r + m[6] * c.g + m[7] * c.b + m[8] * c.a + m[9];',\n 'gl_FragColor.b = m[10] * c.r + m[11] * c.g + m[12] * c.b + m[13] * c.a + m[14];',\n 'gl_FragColor.a = m[15] * c.r + m[16] * c.g + m[17] * c.b + m[18] * c.a + m[19];',\n '}',\n ].join('\\n');\n _filter.colorMatrix.SHADER.WITHOUT_ALPHA = [\n 'precision highp float;',\n 'varying vec2 vUv;',\n 'uniform sampler2D texture;',\n 'uniform float m[20];',\n 'void main(void) {',\n 'vec4 c = texture2D(texture, vUv);',\n 'gl_FragColor.r = m[0] * c.r + m[1] * c.g + m[2] * c.b + m[4];',\n 'gl_FragColor.g = m[5] * c.r + m[6] * c.g + m[7] * c.b + m[9];',\n 'gl_FragColor.b = m[10] * c.r + m[11] * c.g + m[12] * c.b + m[14];',\n 'gl_FragColor.a = c.a;',\n '}',\n ].join('\\n');\n\n _filter.brightness = function (brightness) {\n const b = (brightness || 0) + 1;\n _filter.colorMatrix([\n b, 0, 0, 0, 0,\n 0, b, 0, 0, 0,\n 0, 0, b, 0, 0,\n 0, 0, 0, 1, 0,\n ]);\n };\n\n _filter.saturation = function (amount) {\n const x = (amount || 0) * 2 / 3 + 1;\n const y = ((x - 1) * -0.5);\n _filter.colorMatrix([\n x, y, y, 0, 0,\n y, x, y, 0, 0,\n y, y, x, 0, 0,\n 0, 0, 0, 1, 0,\n ]);\n };\n\n _filter.desaturate = function () {\n _filter.saturation(-1);\n };\n\n _filter.contrast = function (amount) {\n const v = (amount || 0) + 1;\n const o = -128 * (v - 1);\n\n _filter.colorMatrix([\n v, 0, 0, 0, o,\n 0, v, 0, 0, o,\n 0, 0, v, 0, o,\n 0, 0, 0, 1, 0,\n ]);\n };\n\n _filter.negative = function () {\n _filter.contrast(-2);\n };\n\n _filter.hue = function (rotation) {\n rotation = (rotation || 0) / 180 * Math.PI;\n const cos = Math.cos(rotation);\n const sin = Math.sin(rotation);\n const lumR = 0.213;\n const lumG = 0.715;\n const lumB = 0.072;\n\n _filter.colorMatrix([\n lumR + cos * (1 - lumR) + sin * (-lumR), lumG + cos * (-lumG) + sin * (-lumG), lumB + cos * (-lumB) + sin * (1 - lumB), 0, 0,\n lumR + cos * (-lumR) + sin * (0.143), lumG + cos * (1 - lumG) + sin * (0.140), lumB + cos * (-lumB) + sin * (-0.283), 0, 0,\n lumR + cos * (-lumR) + sin * (-(1 - lumR)), lumG + cos * (-lumG) + sin * (lumG), lumB + cos * (1 - lumB) + sin * (lumB), 0, 0,\n 0, 0, 0, 1, 0,\n ]);\n };\n\n _filter.desaturateLuminance = function () {\n _filter.colorMatrix([\n 0.2764723, 0.9297080, 0.0938197, 0, -37.1,\n 0.2764723, 0.9297080, 0.0938197, 0, -37.1,\n 0.2764723, 0.9297080, 0.0938197, 0, -37.1,\n 0, 0, 0, 1, 0,\n ]);\n };\n\n _filter.sepia = function () {\n _filter.colorMatrix([\n 0.393, 0.7689999, 0.18899999, 0, 0,\n 0.349, 0.6859999, 0.16799999, 0, 0,\n 0.272, 0.5339999, 0.13099999, 0, 0,\n 0, 0, 0, 1, 0,\n ]);\n };\n\n _filter.brownie = function () {\n _filter.colorMatrix([\n 0.5997023498159715, 0.34553243048391263, -0.2708298674538042, 0, 47.43192855600873,\n -0.037703249837783157, 0.8609577587992641, 0.15059552388459913, 0, -36.96841498319127,\n 0.24113635128153335, -0.07441037908422492, 0.44972182064877153, 0, -7.562075277591283,\n 0, 0, 0, 1, 0,\n ]);\n };\n\n _filter.vintagePinhole = function () {\n _filter.colorMatrix([\n 0.6279345635605994, 0.3202183420819367, -0.03965408211312453, 0, 9.651285835294123,\n 0.02578397704808868, 0.6441188644374771, 0.03259127616149294, 0, 7.462829176470591,\n 0.0466055556782719, -0.0851232987247891, 0.5241648018700465, 0, 5.159190588235296,\n 0, 0, 0, 1, 0,\n ]);\n };\n\n _filter.kodachrome = function () {\n _filter.colorMatrix([\n 1.1285582396593525, -0.3967382283601348, -0.03992559172921793, 0, 63.72958762196502,\n -0.16404339962244616, 1.0835251566291304, -0.05498805115633132, 0, 24.732407896706203,\n -0.16786010706155763, -0.5603416277695248, 1.6014850761964943, 0, 35.62982807460946,\n 0, 0, 0, 1, 0,\n ]);\n };\n\n _filter.technicolor = function () {\n _filter.colorMatrix([\n 1.9125277891456083, -0.8545344976951645, -0.09155508482755585, 0, 11.793603434377337,\n -0.3087833385928097, 1.7658908555458428, -0.10601743074722245, 0, -70.35205161461398,\n -0.231103377548616, -0.7501899197440212, 1.847597816108189, 0, 30.950940869491138,\n 0, 0, 0, 1, 0,\n ]);\n };\n\n _filter.polaroid = function () {\n _filter.colorMatrix([\n 1.438, -0.062, -0.062, 0, 0,\n -0.122, 1.378, -0.122, 0, 0,\n -0.016, -0.016, 1.483, 0, 0,\n 0, 0, 0, 1, 0,\n ]);\n };\n\n _filter.shiftToBGR = function () {\n _filter.colorMatrix([\n 0, 0, 1, 0, 0,\n 0, 1, 0, 0, 0,\n 1, 0, 0, 0, 0,\n 0, 0, 0, 1, 0,\n ]);\n };\n\n // -------------------------------------------------------------------------\n // Convolution Filter\n _filter.convolution = function (matrix) {\n const m = new Float32Array(matrix);\n const pixelSizeX = 1 / _width;\n const pixelSizeY = 1 / _height;\n const program = _compileShader(_filter.convolution.SHADER);\n gl.uniform1fv(program.uniform.m, m);\n gl.uniform2f(program.uniform.px, pixelSizeX, pixelSizeY);\n _draw();\n };\n\n _filter.convolution.SHADER = [\n 'precision highp float;',\n 'varying vec2 vUv;',\n 'uniform sampler2D texture;',\n 'uniform vec2 px;',\n 'uniform float m[9];',\n 'void main(void) {',\n 'vec4 c11 = texture2D(texture, vUv - px);', // top left\n 'vec4 c12 = texture2D(texture, vec2(vUv.x, vUv.y - px.y));', // top center\n 'vec4 c13 = texture2D(texture, vec2(vUv.x + px.x, vUv.y - px.y));', // top right\n 'vec4 c21 = texture2D(texture, vec2(vUv.x - px.x, vUv.y) );', // mid left\n 'vec4 c22 = texture2D(texture, vUv);', // mid center\n 'vec4 c23 = texture2D(texture, vec2(vUv.x + px.x, vUv.y) );', // mid right\n 'vec4 c31 = texture2D(texture, vec2(vUv.x - px.x, vUv.y + px.y) );', // bottom left\n 'vec4 c32 = texture2D(texture, vec2(vUv.x, vUv.y + px.y) );', // bottom center\n 'vec4 c33 = texture2D(texture, vUv + px );', // bottom right\n 'gl_FragColor = ',\n 'c11 * m[0] + c12 * m[1] + c22 * m[2] +',\n 'c21 * m[3] + c22 * m[4] + c23 * m[5] +',\n 'c31 * m[6] + c32 * m[7] + c33 * m[8];',\n 'gl_FragColor.a = c22.a;',\n '}',\n ].join('\\n');\n\n _filter.detectEdges = function () {\n _filter.convolution.call(this, [\n 0, 1, 0,\n 1, -4, 1,\n 0, 1, 0,\n ]);\n };\n\n _filter.sobelX = function () {\n _filter.convolution.call(this, [\n -1, 0, 1,\n -2, 0, 2,\n -1, 0, 1,\n ]);\n };\n\n _filter.sobelY = function () {\n _filter.convolution.call(this, [\n -1, -2, -1,\n 0, 0, 0,\n 1, 2, 1,\n ]);\n };\n\n _filter.sharpen = function (amount) {\n const a = amount || 1;\n _filter.convolution.call(this, [\n 0, -1 * a, 0,\n -1 * a, 1 + 4 * a, -1 * a,\n 0, -1 * a, 0,\n ]);\n };\n\n _filter.emboss = function (size) {\n const s = size || 1;\n _filter.convolution.call(this, [\n -2 * s, -1 * s, 0,\n -1 * s, 1, 1 * s,\n 0, 1 * s, 2 * s,\n ]);\n };\n\n // -------------------------------------------------------------------------\n // Blur Filter\n _filter.blur = function (size) {\n const blurSizeX = (size / 7) / _width;\n const blurSizeY = (size / 7) / _height;\n const program = _compileShader(_filter.blur.SHADER);\n // Vertical\n gl.uniform2f(program.uniform.px, 0, blurSizeY);\n _draw(DRAW.INTERMEDIATE);\n // Horizontal\n gl.uniform2f(program.uniform.px, blurSizeX, 0);\n _draw();\n };\n\n _filter.blur.SHADER = [\n 'precision highp float;',\n 'varying vec2 vUv;',\n 'uniform sampler2D texture;',\n 'uniform vec2 px;',\n 'void main(void) {',\n 'gl_FragColor = vec4(0.0);',\n 'gl_FragColor += texture2D(texture, vUv + vec2(-7.0*px.x, -7.0*px.y))*0.0044299121055113265;',\n 'gl_FragColor += texture2D(texture, vUv + vec2(-6.0*px.x, -6.0*px.y))*0.00895781211794;',\n 'gl_FragColor += texture2D(texture, vUv + vec2(-5.0*px.x, -5.0*px.y))*0.0215963866053;',\n 'gl_FragColor += texture2D(texture, vUv + vec2(-4.0*px.x, -4.0*px.y))*0.0443683338718;',\n 'gl_FragColor += texture2D(texture, vUv + vec2(-3.0*px.x, -3.0*px.y))*0.0776744219933;',\n 'gl_FragColor += texture2D(texture, vUv + vec2(-2.0*px.x, -2.0*px.y))*0.115876621105;',\n 'gl_FragColor += texture2D(texture, vUv + vec2(-1.0*px.x, -1.0*px.y))*0.147308056121;',\n 'gl_FragColor += texture2D(texture, vUv )*0.159576912161;',\n 'gl_FragColor += texture2D(texture, vUv + vec2( 1.0*px.x, 1.0*px.y))*0.147308056121;',\n 'gl_FragColor += texture2D(texture, vUv + vec2( 2.0*px.x, 2.0*px.y))*0.115876621105;',\n 'gl_FragColor += texture2D(texture, vUv + vec2( 3.0*px.x, 3.0*px.y))*0.0776744219933;',\n 'gl_FragColor += texture2D(texture, vUv + vec2( 4.0*px.x, 4.0*px.y))*0.0443683338718;',\n 'gl_FragColor += texture2D(texture, vUv + vec2( 5.0*px.x, 5.0*px.y))*0.0215963866053;',\n 'gl_FragColor += texture2D(texture, vUv + vec2( 6.0*px.x, 6.0*px.y))*0.00895781211794;',\n 'gl_FragColor += texture2D(texture, vUv + vec2( 7.0*px.x, 7.0*px.y))*0.0044299121055113265;',\n '}',\n ].join('\\n');\n\n // -------------------------------------------------------------------------\n // Pixelate Filter\n _filter.pixelate = function (size) {\n const blurSizeX = (size) / _width;\n const blurSizeY = (size) / _height;\n const program = _compileShader(_filter.pixelate.SHADER);\n // Horizontal\n gl.uniform2f(program.uniform.size, blurSizeX, blurSizeY);\n _draw();\n };\n\n _filter.pixelate.SHADER = [\n 'precision highp float;',\n 'varying vec2 vUv;',\n 'uniform vec2 size;',\n 'uniform sampler2D texture;',\n 'vec2 pixelate(vec2 coord, vec2 size) {',\n 'return floor( coord / size ) * size;',\n '}',\n 'void main(void) {',\n 'gl_FragColor = vec4(0.0);',\n 'vec2 coord = pixelate(vUv, size);',\n 'gl_FragColor += texture2D(texture, coord);',\n '}',\n ].join('\\n');\n}\n", "/**\n * Image Processing module used by Human\n */\n\nimport * as tf from '../../dist/tfjs.esm.js';\nimport * as fxImage from './imagefx';\nimport { Tensor } from '../tfjs/types';\nimport { Config } from '../config';\n\ntype Input = Tensor | typeof Image | ImageData | ImageBitmap | HTMLImageElement | HTMLMediaElement | HTMLVideoElement | HTMLCanvasElement | OffscreenCanvas;\n\nconst maxSize = 2048;\n// internal temp canvases\nlet inCanvas;\nlet outCanvas;\n// instance of fximage\nlet fx;\n\n// process input image and return tensor\n// input can be tensor, imagedata, htmlimageelement, htmlvideoelement\n// input is resized and run through imagefx filter\nexport function process(input: Input, config: Config): { tensor: Tensor | null, canvas: OffscreenCanvas | HTMLCanvasElement } {\n let tensor;\n if (!input) throw new Error('Human: Input is missing');\n // sanity checks since different browsers do not implement all dom elements\n if (\n !(input instanceof tf.Tensor)\n && !(typeof Image !== 'undefined' && input instanceof Image)\n && !(typeof ImageData !== 'undefined' && input instanceof ImageData)\n && !(typeof ImageBitmap !== 'undefined' && input instanceof ImageBitmap)\n && !(typeof HTMLImageElement !== 'undefined' && input instanceof HTMLImageElement)\n && !(typeof HTMLMediaElement !== 'undefined' && input instanceof HTMLMediaElement)\n && !(typeof HTMLVideoElement !== 'undefined' && input instanceof HTMLVideoElement)\n && !(typeof HTMLCanvasElement !== 'undefined' && input instanceof HTMLCanvasElement)\n && !(typeof OffscreenCanvas !== 'undefined' && input instanceof OffscreenCanvas)\n ) {\n throw new Error('Human: Input type is not recognized');\n }\n if (input instanceof tf.Tensor) {\n // if input is tensor, use as-is\n if (input.shape && input.shape.length === 4 && input.shape[0] === 1 && input.shape[3] === 3) tensor = tf.clone(input);\n else throw new Error(`Human: Input tensor shape must be [1, height, width, 3] and instead was ${input.shape}`);\n } else {\n // check if resizing will be needed\n const originalWidth = input['naturalWidth'] || input['videoWidth'] || input['width'] || (input['shape'] && (input['shape'][1] > 0));\n const originalHeight = input['naturalHeight'] || input['videoHeight'] || input['height'] || (input['shape'] && (input['shape'][2] > 0));\n if (!originalWidth || !originalHeight) return { tensor: null, canvas: inCanvas }; // video may become temporarily unavailable due to onresize\n let targetWidth = originalWidth;\n let targetHeight = originalHeight;\n if (targetWidth > maxSize) {\n targetWidth = maxSize;\n targetHeight = targetWidth * originalHeight / originalWidth;\n }\n if (targetHeight > maxSize) {\n targetHeight = maxSize;\n targetWidth = targetHeight * originalWidth / originalHeight;\n }\n\n // create our canvas and resize it if needed\n if (config.filter.width > 0) targetWidth = config.filter.width;\n else if (config.filter.height > 0) targetWidth = originalWidth * (config.filter.height / originalHeight);\n if (config.filter.height > 0) targetHeight = config.filter.height;\n else if (config.filter.width > 0) targetHeight = originalHeight * (config.filter.width / originalWidth);\n if (!targetWidth || !targetHeight) throw new Error('Human: Input cannot determine dimension');\n if (!inCanvas || (inCanvas?.width !== targetWidth) || (inCanvas?.height !== targetHeight)) {\n inCanvas = (typeof OffscreenCanvas !== 'undefined') ? new OffscreenCanvas(targetWidth, targetHeight) : document.createElement('canvas');\n if (inCanvas?.width !== targetWidth) inCanvas.width = targetWidth;\n if (inCanvas?.height !== targetHeight) inCanvas.height = targetHeight;\n }\n\n // draw input to our canvas\n const ctx = inCanvas.getContext('2d');\n if (input instanceof ImageData) {\n ctx.putImageData(input, 0, 0);\n } else {\n if (config.filter.flip && typeof ctx.translate !== 'undefined') {\n ctx.translate(originalWidth, 0);\n ctx.scale(-1, 1);\n ctx.drawImage(input, 0, 0, originalWidth, originalHeight, 0, 0, inCanvas?.width, inCanvas?.height);\n ctx.setTransform(1, 0, 0, 1, 0, 0); // resets transforms to defaults\n } else {\n ctx.drawImage(input, 0, 0, originalWidth, originalHeight, 0, 0, inCanvas?.width, inCanvas?.height);\n }\n }\n\n // imagefx transforms using gl\n if (config.filter.enabled) {\n if (!fx || !outCanvas || (inCanvas.width !== outCanvas.width) || (inCanvas?.height !== outCanvas?.height)) {\n outCanvas = (typeof OffscreenCanvas !== 'undefined') ? new OffscreenCanvas(inCanvas?.width, inCanvas?.height) : document.createElement('canvas');\n if (outCanvas?.width !== inCanvas?.width) outCanvas.width = inCanvas?.width;\n if (outCanvas?.height !== inCanvas?.height) outCanvas.height = inCanvas?.height;\n // log('created FX filter');\n fx = tf.ENV.flags.IS_BROWSER ? new fxImage.GLImageFilter({ canvas: outCanvas }) : null; // && (typeof document !== 'undefined')\n }\n if (!fx) return { tensor: null, canvas: inCanvas };\n fx.reset();\n fx.addFilter('brightness', config.filter.brightness); // must have at least one filter enabled\n if (config.filter.contrast !== 0) fx.addFilter('contrast', config.filter.contrast);\n if (config.filter.sharpness !== 0) fx.addFilter('sharpen', config.filter.sharpness);\n if (config.filter.blur !== 0) fx.addFilter('blur', config.filter.blur);\n if (config.filter.saturation !== 0) fx.addFilter('saturation', config.filter.saturation);\n if (config.filter.hue !== 0) fx.addFilter('hue', config.filter.hue);\n if (config.filter.negative) fx.addFilter('negative');\n if (config.filter.sepia) fx.addFilter('sepia');\n if (config.filter.vintage) fx.addFilter('brownie');\n if (config.filter.sepia) fx.addFilter('sepia');\n if (config.filter.kodachrome) fx.addFilter('kodachrome');\n if (config.filter.technicolor) fx.addFilter('technicolor');\n if (config.filter.polaroid) fx.addFilter('polaroid');\n if (config.filter.pixelate !== 0) fx.addFilter('pixelate', config.filter.pixelate);\n fx.apply(inCanvas);\n // read pixel data\n /*\n const gl = outCanvas.getContext('webgl');\n if (gl) {\n const glBuffer = new Uint8Array(outCanvas.width * outCanvas.height * 4);\n const pixBuffer = new Uint8Array(outCanvas.width * outCanvas.height * 3);\n gl.readPixels(0, 0, outCanvas.width, outCanvas.height, gl.RGBA, gl.UNSIGNED_BYTE, glBuffer);\n // gl returns rbga while we only need rgb, so discarding alpha channel\n // gl returns starting point as lower left, so need to invert vertical\n let i = 0;\n for (let y = outCanvas.height - 1; y >= 0; y--) {\n for (let x = 0; x < outCanvas.width; x++) {\n const index = (x + y * outCanvas.width) * 4;\n pixBuffer[i++] = glBuffer[index + 0];\n pixBuffer[i++] = glBuffer[index + 1];\n pixBuffer[i++] = glBuffer[index + 2];\n }\n }\n outCanvas.data = pixBuffer;\n }\n */\n } else {\n outCanvas = inCanvas;\n if (fx) fx = null;\n }\n\n // create tensor from image\n let pixels;\n if (outCanvas.data) { // if we have data, just convert to tensor\n const shape = [outCanvas.height, outCanvas.width, 3];\n pixels = tf.tensor3d(outCanvas.data, shape, 'int32');\n } else if (outCanvas instanceof ImageData) { // if input is imagedata, just use it\n pixels = tf.browser ? tf.browser.fromPixels(outCanvas) : null;\n } else if (config.backend === 'webgl' || config.backend === 'humangl') { // tf kernel-optimized method to get imagedata\n // we can use canvas as-is as it already has a context, so we do a silly one more canvas\n const tempCanvas = (typeof OffscreenCanvas !== 'undefined') ? new OffscreenCanvas(targetWidth, targetHeight) : document.createElement('canvas');\n tempCanvas.width = targetWidth;\n tempCanvas.height = targetHeight;\n const tempCtx = tempCanvas.getContext('2d');\n tempCtx?.drawImage(outCanvas, 0, 0);\n pixels = tf.browser ? tf.browser.fromPixels(tempCanvas) : null;\n } else { // cpu and wasm kernel does not implement efficient fromPixels method\n // we can use canvas as-is as it already has a context, so we do a silly one more canvas\n const tempCanvas = (typeof OffscreenCanvas !== 'undefined') ? new OffscreenCanvas(targetWidth, targetHeight) : document.createElement('canvas');\n tempCanvas.width = targetWidth;\n tempCanvas.height = targetHeight;\n const tempCtx = tempCanvas.getContext('2d');\n tempCtx?.drawImage(outCanvas, 0, 0);\n const data = tempCtx?.getImageData(0, 0, targetWidth, targetHeight);\n pixels = tf.browser ? tf.browser.fromPixels(data) : null;\n }\n if (pixels) {\n const casted = pixels.toFloat();\n tensor = casted.expandDims(0);\n pixels.dispose();\n casted.dispose();\n }\n }\n const canvas = config.filter.return ? outCanvas : null;\n return { tensor, canvas };\n}\n", "/**\n * Module that implements helper draw functions, exposed as human.draw\n */\n\nimport { TRI468 as triangulation } from '../blazeface/coords';\nimport { mergeDeep, now } from '../helpers';\nimport type { Result, Face, Body, Hand, Item, Gesture, Person } from '../result';\n\n/**\n * Draw Options\n * Accessed via `human.draw.options` or provided per each draw method as the drawOptions optional parameter\n * -color: draw color\n * -labelColor: color for labels\n * -shadowColor: optional shadow color for labels\n * -font: font for labels\n * -lineHeight: line height for labels, used for multi-line labels,\n * -lineWidth: width of any lines,\n * -pointSize: size of any point,\n * -roundRect: for boxes, round corners by this many pixels,\n * -drawPoints: should points be drawn,\n * -drawLabels: should labels be drawn,\n * -drawBoxes: should boxes be drawn,\n * -drawPolygons: should polygons be drawn,\n * -fillPolygons: should drawn polygons be filled,\n * -useDepth: use z-axis coordinate as color shade,\n * -useCurves: draw polygons as cures or as lines,\n * -bufferedOutput: experimental: allows to call draw methods multiple times for each detection and interpolate results between results thus achieving smoother animations\n */\nexport interface DrawOptions {\n color: string,\n labelColor: string,\n shadowColor: string,\n font: string,\n lineHeight: number,\n lineWidth: number,\n pointSize: number,\n roundRect: number,\n drawPoints: boolean,\n drawLabels: boolean,\n drawBoxes: boolean,\n drawPolygons: boolean,\n drawGaze: boolean,\n fillPolygons: boolean,\n useDepth: boolean,\n useCurves: boolean,\n bufferedOutput: boolean,\n}\n\nexport const options: DrawOptions = {\n color: 'rgba(173, 216, 230, 0.6)', // 'lightblue' with light alpha channel\n labelColor: 'rgba(173, 216, 230, 1)', // 'lightblue' with dark alpha channel\n shadowColor: 'black',\n font: 'small-caps 14px \"Segoe UI\"',\n lineHeight: 24,\n lineWidth: 6,\n pointSize: 2,\n roundRect: 28,\n drawPoints: false,\n drawLabels: true,\n drawBoxes: true,\n drawPolygons: true,\n drawGaze: true,\n fillPolygons: false,\n useDepth: true,\n useCurves: false,\n bufferedOutput: true,\n};\n\nconst rad2deg = (theta) => Math.round((theta * 180) / Math.PI);\n\nfunction point(ctx, x, y, z = 0, localOptions) {\n ctx.fillStyle = localOptions.useDepth && z ? `rgba(${127.5 + (2 * z)}, ${127.5 - (2 * z)}, 255, 0.3)` : localOptions.color;\n ctx.beginPath();\n ctx.arc(x, y, localOptions.pointSize, 0, 2 * Math.PI);\n ctx.fill();\n}\n\nfunction rect(ctx, x, y, width, height, localOptions) {\n ctx.beginPath();\n if (localOptions.useCurves) {\n const cx = (x + x + width) / 2;\n const cy = (y + y + height) / 2;\n ctx.ellipse(cx, cy, width / 2, height / 2, 0, 0, 2 * Math.PI);\n } else {\n ctx.lineWidth = localOptions.lineWidth;\n ctx.moveTo(x + localOptions.roundRect, y);\n ctx.lineTo(x + width - localOptions.roundRect, y);\n ctx.quadraticCurveTo(x + width, y, x + width, y + localOptions.roundRect);\n ctx.lineTo(x + width, y + height - localOptions.roundRect);\n ctx.quadraticCurveTo(x + width, y + height, x + width - localOptions.roundRect, y + height);\n ctx.lineTo(x + localOptions.roundRect, y + height);\n ctx.quadraticCurveTo(x, y + height, x, y + height - localOptions.roundRect);\n ctx.lineTo(x, y + localOptions.roundRect);\n ctx.quadraticCurveTo(x, y, x + localOptions.roundRect, y);\n ctx.closePath();\n }\n ctx.stroke();\n}\n\nfunction lines(ctx, points: [number, number, number?][] = [], localOptions) {\n if (points === undefined || points.length === 0) return;\n ctx.beginPath();\n ctx.moveTo(points[0][0], points[0][1]);\n for (const pt of points) {\n const z = pt[2] || 0;\n ctx.strokeStyle = localOptions.useDepth && z ? `rgba(${127.5 + (2 * z)}, ${127.5 - (2 * z)}, 255, 0.3)` : localOptions.color;\n ctx.fillStyle = localOptions.useDepth && z ? `rgba(${127.5 + (2 * z)}, ${127.5 - (2 * z)}, 255, 0.3)` : localOptions.color;\n ctx.lineTo(pt[0], Math.round(pt[1]));\n }\n ctx.stroke();\n if (localOptions.fillPolygons) {\n ctx.closePath();\n ctx.fill();\n }\n}\n\nfunction curves(ctx, points: [number, number, number?][] = [], localOptions) {\n if (points === undefined || points.length === 0) return;\n if (!localOptions.useCurves || points.length <= 2) {\n lines(ctx, points, localOptions);\n return;\n }\n ctx.moveTo(points[0][0], points[0][1]);\n for (let i = 0; i < points.length - 2; i++) {\n const xc = (points[i][0] + points[i + 1][0]) / 2;\n const yc = (points[i][1] + points[i + 1][1]) / 2;\n ctx.quadraticCurveTo(points[i][0], points[i][1], xc, yc);\n }\n ctx.quadraticCurveTo(points[points.length - 2][0], points[points.length - 2][1], points[points.length - 1][0], points[points.length - 1][1]);\n ctx.stroke();\n if (localOptions.fillPolygons) {\n ctx.closePath();\n ctx.fill();\n }\n}\n\nexport async function gesture(inCanvas: HTMLCanvasElement, result: Array, drawOptions?: DrawOptions) {\n const localOptions = mergeDeep(options, drawOptions);\n if (!result || !inCanvas) return;\n if (!(inCanvas instanceof HTMLCanvasElement)) return;\n const ctx = inCanvas.getContext('2d');\n if (!ctx) return;\n ctx.font = localOptions.font;\n ctx.fillStyle = localOptions.color;\n let i = 1;\n for (let j = 0; j < result.length; j++) {\n let where: unknown[] = []; // what&where is a record\n let what: unknown[] = []; // what&where is a record\n [where, what] = Object.entries(result[j]);\n if ((what.length > 1) && ((what[1] as string).length > 0)) {\n const who = where[1] as number > 0 ? `#${where[1]}` : '';\n const label = `${where[0]} ${who}: ${what[1]}`;\n if (localOptions.shadowColor && localOptions.shadowColor !== '') {\n ctx.fillStyle = localOptions.shadowColor;\n ctx.fillText(label, 8, 2 + (i * localOptions.lineHeight));\n }\n ctx.fillStyle = localOptions.labelColor;\n ctx.fillText(label, 6, 0 + (i * localOptions.lineHeight));\n i += 1;\n }\n }\n}\n\nexport async function face(inCanvas: HTMLCanvasElement, result: Array, drawOptions?: DrawOptions) {\n const localOptions = mergeDeep(options, drawOptions);\n if (!result || !inCanvas) return;\n if (!(inCanvas instanceof HTMLCanvasElement)) return;\n const ctx = inCanvas.getContext('2d');\n if (!ctx) return;\n for (const f of result) {\n ctx.font = localOptions.font;\n ctx.strokeStyle = localOptions.color;\n ctx.fillStyle = localOptions.color;\n if (localOptions.drawBoxes) rect(ctx, f.box[0], f.box[1], f.box[2], f.box[3], localOptions);\n // silly hack since fillText does not suport new line\n const labels:string[] = [];\n labels.push(`face: ${Math.trunc(100 * f.score)}%`);\n if (f.genderScore) labels.push(`${f.gender || ''} ${Math.trunc(100 * f.genderScore)}%`);\n if (f.age) labels.push(`age: ${f.age || ''}`);\n if (f.iris) labels.push(`distance: ${f.iris}`);\n if (f.emotion && f.emotion.length > 0) {\n const emotion = f.emotion.map((a) => `${Math.trunc(100 * a.score)}% ${a.emotion}`);\n if (emotion.length > 3) emotion.length = 3;\n labels.push(emotion.join(' '));\n }\n if (f.rotation && f.rotation.angle && f.rotation.gaze) {\n if (f.rotation.angle.roll) labels.push(`roll: ${rad2deg(f.rotation.angle.roll)}\u00B0 yaw:${rad2deg(f.rotation.angle.yaw)}\u00B0 pitch:${rad2deg(f.rotation.angle.pitch)}\u00B0`);\n if (f.rotation.gaze.bearing) labels.push(`gaze: ${rad2deg(f.rotation.gaze.bearing)}\u00B0`);\n }\n if (labels.length === 0) labels.push('face');\n ctx.fillStyle = localOptions.color;\n for (let i = labels.length - 1; i >= 0; i--) {\n const x = Math.max(f.box[0], 0);\n const y = i * localOptions.lineHeight + f.box[1];\n if (localOptions.shadowColor && localOptions.shadowColor !== '') {\n ctx.fillStyle = localOptions.shadowColor;\n ctx.fillText(labels[i], x + 5, y + 16);\n }\n ctx.fillStyle = localOptions.labelColor;\n ctx.fillText(labels[i], x + 4, y + 15);\n }\n ctx.lineWidth = 1;\n if (f.mesh && f.mesh.length > 0) {\n if (localOptions.drawPoints) {\n for (const pt of f.mesh) point(ctx, pt[0], pt[1], pt[2], localOptions);\n // for (const pt of f.meshRaw) point(ctx, pt[0] * inCanvas.offsetWidth, pt[1] * inCanvas.offsetHeight, pt[2]);\n }\n if (localOptions.drawPolygons) {\n ctx.lineWidth = 1;\n for (let i = 0; i < triangulation.length / 3; i++) {\n const points = [\n triangulation[i * 3 + 0],\n triangulation[i * 3 + 1],\n triangulation[i * 3 + 2],\n ].map((index) => f.mesh[index]);\n lines(ctx, points, localOptions);\n }\n // iris: array[center, left, top, right, bottom]\n if (f.annotations && f.annotations['leftEyeIris']) {\n ctx.strokeStyle = localOptions.useDepth ? 'rgba(255, 200, 255, 0.3)' : localOptions.color;\n ctx.beginPath();\n const sizeX = Math.abs(f.annotations['leftEyeIris'][3][0] - f.annotations['leftEyeIris'][1][0]) / 2;\n const sizeY = Math.abs(f.annotations['leftEyeIris'][4][1] - f.annotations['leftEyeIris'][2][1]) / 2;\n ctx.ellipse(f.annotations['leftEyeIris'][0][0], f.annotations['leftEyeIris'][0][1], sizeX, sizeY, 0, 0, 2 * Math.PI);\n ctx.stroke();\n if (localOptions.fillPolygons) {\n ctx.fillStyle = localOptions.useDepth ? 'rgba(255, 255, 200, 0.3)' : localOptions.color;\n ctx.fill();\n }\n }\n if (f.annotations && f.annotations['rightEyeIris']) {\n ctx.strokeStyle = localOptions.useDepth ? 'rgba(255, 200, 255, 0.3)' : localOptions.color;\n ctx.beginPath();\n const sizeX = Math.abs(f.annotations['rightEyeIris'][3][0] - f.annotations['rightEyeIris'][1][0]) / 2;\n const sizeY = Math.abs(f.annotations['rightEyeIris'][4][1] - f.annotations['rightEyeIris'][2][1]) / 2;\n ctx.ellipse(f.annotations['rightEyeIris'][0][0], f.annotations['rightEyeIris'][0][1], sizeX, sizeY, 0, 0, 2 * Math.PI);\n ctx.stroke();\n if (localOptions.fillPolygons) {\n ctx.fillStyle = localOptions.useDepth ? 'rgba(255, 255, 200, 0.3)' : localOptions.color;\n ctx.fill();\n }\n }\n if (localOptions.drawGaze && f.rotation?.gaze?.strength && f.rotation?.gaze?.bearing && f.annotations['leftEyeIris'] && f.annotations['rightEyeIris'] && f.annotations['leftEyeIris'][0] && f.annotations['rightEyeIris'][0]) {\n ctx.strokeStyle = 'pink';\n ctx.beginPath();\n\n const leftGaze = [\n f.annotations['leftEyeIris'][0][0] + (Math.sin(f.rotation.gaze.bearing) * f.rotation.gaze.strength * f.box[3]),\n f.annotations['leftEyeIris'][0][1] + (Math.cos(f.rotation.gaze.bearing) * f.rotation.gaze.strength * f.box[2]),\n ];\n ctx.moveTo(f.annotations['leftEyeIris'][0][0], f.annotations['leftEyeIris'][0][1]);\n ctx.lineTo(leftGaze[0], leftGaze[1]);\n\n const rightGaze = [\n f.annotations['rightEyeIris'][0][0] + (Math.sin(f.rotation.gaze.bearing) * f.rotation.gaze.strength * f.box[3]),\n f.annotations['rightEyeIris'][0][1] + (Math.cos(f.rotation.gaze.bearing) * f.rotation.gaze.strength * f.box[2]),\n ];\n ctx.moveTo(f.annotations['rightEyeIris'][0][0], f.annotations['rightEyeIris'][0][1]);\n ctx.lineTo(rightGaze[0], rightGaze[1]);\n\n ctx.stroke();\n }\n }\n }\n }\n}\n\nexport async function body(inCanvas: HTMLCanvasElement, result: Array, drawOptions?: DrawOptions) {\n const localOptions = mergeDeep(options, drawOptions);\n if (!result || !inCanvas) return;\n if (!(inCanvas instanceof HTMLCanvasElement)) return;\n const ctx = inCanvas.getContext('2d');\n if (!ctx) return;\n ctx.lineJoin = 'round';\n for (let i = 0; i < result.length; i++) {\n ctx.strokeStyle = localOptions.color;\n ctx.fillStyle = localOptions.color;\n ctx.lineWidth = localOptions.lineWidth;\n ctx.font = localOptions.font;\n if (localOptions.drawBoxes && result[i].box && result[i].box?.length === 4) {\n // @ts-ignore box may not exist\n rect(ctx, result[i].box[0], result[i].box[1], result[i].box[2], result[i].box[3], localOptions);\n if (localOptions.drawLabels) {\n if (localOptions.shadowColor && localOptions.shadowColor !== '') {\n ctx.fillStyle = localOptions.shadowColor;\n // @ts-ignore box may not exist\n ctx.fillText(`body ${100 * result[i].score}%`, result[i].box[0] + 3, 1 + result[i].box[1] + localOptions.lineHeight, result[i].box[2]);\n }\n ctx.fillStyle = localOptions.labelColor;\n // @ts-ignore box may not exist\n ctx.fillText(`body ${100 * result[i].score}%`, result[i].box[0] + 2, 0 + result[i].box[1] + localOptions.lineHeight, result[i].box[2]);\n }\n }\n if (localOptions.drawPoints) {\n for (let pt = 0; pt < result[i].keypoints.length; pt++) {\n ctx.fillStyle = localOptions.useDepth && result[i].keypoints[pt].position[2] ? `rgba(${127.5 + (2 * (result[i].keypoints[pt].position[2] || 0))}, ${127.5 - (2 * (result[i].keypoints[pt].position[2] || 0))}, 255, 0.5)` : localOptions.color;\n point(ctx, result[i].keypoints[pt].position[0], result[i].keypoints[pt].position[1], 0, localOptions);\n }\n }\n if (localOptions.drawLabels) {\n ctx.font = localOptions.font;\n if (result[i].keypoints) {\n for (const pt of result[i].keypoints) {\n ctx.fillStyle = localOptions.useDepth && pt.position[2] ? `rgba(${127.5 + (2 * pt.position[2])}, ${127.5 - (2 * pt.position[2])}, 255, 0.5)` : localOptions.color;\n ctx.fillText(`${pt.part} ${Math.trunc(100 * pt.score)}%`, pt.position[0] + 4, pt.position[1] + 4);\n }\n }\n }\n if (localOptions.drawPolygons && result[i].keypoints) {\n let part;\n const points: [number, number, number?][] = [];\n // shoulder line\n points.length = 0;\n part = result[i].keypoints.find((a) => a.part === 'leftShoulder');\n if (part) points.push([part.position[0], part.position[1]]);\n part = result[i].keypoints.find((a) => a.part === 'rightShoulder');\n if (part) points.push([part.position[0], part.position[1]]);\n curves(ctx, points, localOptions);\n // torso main\n points.length = 0;\n part = result[i].keypoints.find((a) => a.part === 'rightShoulder');\n if (part) points.push([part.position[0], part.position[1]]);\n part = result[i].keypoints.find((a) => a.part === 'rightHip');\n if (part) points.push([part.position[0], part.position[1]]);\n part = result[i].keypoints.find((a) => a.part === 'leftHip');\n if (part) points.push([part.position[0], part.position[1]]);\n part = result[i].keypoints.find((a) => a.part === 'leftShoulder');\n if (part) points.push([part.position[0], part.position[1]]);\n if (points.length === 4) lines(ctx, points, localOptions); // only draw if we have complete torso\n // leg left\n points.length = 0;\n part = result[i].keypoints.find((a) => a.part === 'leftHip');\n if (part) points.push([part.position[0], part.position[1]]);\n part = result[i].keypoints.find((a) => a.part === 'leftKnee');\n if (part) points.push([part.position[0], part.position[1]]);\n part = result[i].keypoints.find((a) => a.part === 'leftAnkle');\n if (part) points.push([part.position[0], part.position[1]]);\n part = result[i].keypoints.find((a) => a.part === 'leftHeel');\n if (part) points.push([part.position[0], part.position[1]]);\n part = result[i].keypoints.find((a) => a.part === 'leftFoot');\n if (part) points.push([part.position[0], part.position[1]]);\n curves(ctx, points, localOptions);\n // leg right\n points.length = 0;\n part = result[i].keypoints.find((a) => a.part === 'rightHip');\n if (part) points.push([part.position[0], part.position[1]]);\n part = result[i].keypoints.find((a) => a.part === 'rightKnee');\n if (part) points.push([part.position[0], part.position[1]]);\n part = result[i].keypoints.find((a) => a.part === 'rightAnkle');\n if (part) points.push([part.position[0], part.position[1]]);\n part = result[i].keypoints.find((a) => a.part === 'rightHeel');\n if (part) points.push([part.position[0], part.position[1]]);\n part = result[i].keypoints.find((a) => a.part === 'rightFoot');\n if (part) points.push([part.position[0], part.position[1]]);\n curves(ctx, points, localOptions);\n // arm left\n points.length = 0;\n part = result[i].keypoints.find((a) => a.part === 'leftShoulder');\n if (part) points.push([part.position[0], part.position[1]]);\n part = result[i].keypoints.find((a) => a.part === 'leftElbow');\n if (part) points.push([part.position[0], part.position[1]]);\n part = result[i].keypoints.find((a) => a.part === 'leftWrist');\n if (part) points.push([part.position[0], part.position[1]]);\n part = result[i].keypoints.find((a) => a.part === 'leftPalm');\n if (part) points.push([part.position[0], part.position[1]]);\n curves(ctx, points, localOptions);\n // arm right\n points.length = 0;\n part = result[i].keypoints.find((a) => a.part === 'rightShoulder');\n if (part) points.push([part.position[0], part.position[1]]);\n part = result[i].keypoints.find((a) => a.part === 'rightElbow');\n if (part) points.push([part.position[0], part.position[1]]);\n part = result[i].keypoints.find((a) => a.part === 'rightWrist');\n if (part) points.push([part.position[0], part.position[1]]);\n part = result[i].keypoints.find((a) => a.part === 'rightPalm');\n if (part) points.push([part.position[0], part.position[1]]);\n curves(ctx, points, localOptions);\n // draw all\n }\n }\n}\n\nexport async function hand(inCanvas: HTMLCanvasElement, result: Array, drawOptions?: DrawOptions) {\n const localOptions = mergeDeep(options, drawOptions);\n if (!result || !inCanvas) return;\n if (!(inCanvas instanceof HTMLCanvasElement)) return;\n const ctx = inCanvas.getContext('2d');\n if (!ctx) return;\n ctx.lineJoin = 'round';\n ctx.font = localOptions.font;\n for (const h of result) {\n if (localOptions.drawBoxes) {\n ctx.strokeStyle = localOptions.color;\n ctx.fillStyle = localOptions.color;\n rect(ctx, h.box[0], h.box[1], h.box[2], h.box[3], localOptions);\n if (localOptions.drawLabels) {\n if (localOptions.shadowColor && localOptions.shadowColor !== '') {\n ctx.fillStyle = localOptions.shadowColor;\n ctx.fillText('hand', h.box[0] + 3, 1 + h.box[1] + localOptions.lineHeight, h.box[2]);\n }\n ctx.fillStyle = localOptions.labelColor;\n ctx.fillText('hand', h.box[0] + 2, 0 + h.box[1] + localOptions.lineHeight, h.box[2]);\n }\n ctx.stroke();\n }\n if (localOptions.drawPoints) {\n if (h.keypoints && h.keypoints.length > 0) {\n for (const pt of h.keypoints) {\n ctx.fillStyle = localOptions.useDepth ? `rgba(${127.5 + (2 * pt[2])}, ${127.5 - (2 * pt[2])}, 255, 0.5)` : localOptions.color;\n point(ctx, pt[0], pt[1], 0, localOptions);\n }\n }\n }\n if (localOptions.drawLabels) {\n const addHandLabel = (part, title) => {\n ctx.fillStyle = localOptions.useDepth ? `rgba(${127.5 + (2 * part[part.length - 1][2])}, ${127.5 - (2 * part[part.length - 1][2])}, 255, 0.5)` : localOptions.color;\n ctx.fillText(title, part[part.length - 1][0] + 4, part[part.length - 1][1] + 4);\n };\n ctx.font = localOptions.font;\n addHandLabel(h.annotations['indexFinger'], 'index');\n addHandLabel(h.annotations['middleFinger'], 'middle');\n addHandLabel(h.annotations['ringFinger'], 'ring');\n addHandLabel(h.annotations['pinky'], 'pinky');\n addHandLabel(h.annotations['thumb'], 'thumb');\n addHandLabel(h.annotations['palmBase'], 'palm');\n }\n if (localOptions.drawPolygons) {\n const addHandLine = (part) => {\n if (!part) return;\n for (let i = 0; i < part.length; i++) {\n ctx.beginPath();\n ctx.strokeStyle = localOptions.useDepth ? `rgba(${127.5 + (2 * part[i][2])}, ${127.5 - (2 * part[i][2])}, 255, 0.5)` : localOptions.color;\n ctx.moveTo(part[i > 0 ? i - 1 : 0][0], part[i > 0 ? i - 1 : 0][1]);\n ctx.lineTo(part[i][0], part[i][1]);\n ctx.stroke();\n }\n };\n ctx.lineWidth = localOptions.lineWidth;\n addHandLine(h.annotations['indexFinger']);\n addHandLine(h.annotations['middleFinger']);\n addHandLine(h.annotations['ringFinger']);\n addHandLine(h.annotations['pinky']);\n addHandLine(h.annotations['thumb']);\n // addPart(h.annotations.palmBase);\n }\n }\n}\n\nexport async function object(inCanvas: HTMLCanvasElement, result: Array, drawOptions?: DrawOptions) {\n const localOptions = mergeDeep(options, drawOptions);\n if (!result || !inCanvas) return;\n if (!(inCanvas instanceof HTMLCanvasElement)) return;\n const ctx = inCanvas.getContext('2d');\n if (!ctx) return;\n ctx.lineJoin = 'round';\n ctx.font = localOptions.font;\n for (const h of result) {\n if (localOptions.drawBoxes) {\n ctx.strokeStyle = localOptions.color;\n ctx.fillStyle = localOptions.color;\n rect(ctx, h.box[0], h.box[1], h.box[2], h.box[3], localOptions);\n if (localOptions.drawLabels) {\n const label = `${Math.round(100 * h.score)}% ${h.label}`;\n if (localOptions.shadowColor && localOptions.shadowColor !== '') {\n ctx.fillStyle = localOptions.shadowColor;\n ctx.fillText(label, h.box[0] + 3, 1 + h.box[1] + localOptions.lineHeight, h.box[2]);\n }\n ctx.fillStyle = localOptions.labelColor;\n ctx.fillText(label, h.box[0] + 2, 0 + h.box[1] + localOptions.lineHeight, h.box[2]);\n }\n ctx.stroke();\n }\n }\n}\n\nexport async function person(inCanvas: HTMLCanvasElement, result: Array, drawOptions?: DrawOptions) {\n const localOptions = mergeDeep(options, drawOptions);\n if (!result || !inCanvas) return;\n if (!(inCanvas instanceof HTMLCanvasElement)) return;\n const ctx = inCanvas.getContext('2d');\n if (!ctx) return;\n ctx.lineJoin = 'round';\n ctx.font = localOptions.font;\n\n for (let i = 0; i < result.length; i++) {\n if (localOptions.drawBoxes) {\n ctx.strokeStyle = localOptions.color;\n ctx.fillStyle = localOptions.color;\n rect(ctx, result[i].box[0], result[i].box[1], result[i].box[2], result[i].box[3], localOptions);\n if (localOptions.drawLabels) {\n const label = `person #${i}`;\n if (localOptions.shadowColor && localOptions.shadowColor !== '') {\n ctx.fillStyle = localOptions.shadowColor;\n ctx.fillText(label, result[i].box[0] + 3, 1 + result[i].box[1] + localOptions.lineHeight, result[i].box[2]);\n }\n ctx.fillStyle = localOptions.labelColor;\n ctx.fillText(label, result[i].box[0] + 2, 0 + result[i].box[1] + localOptions.lineHeight, result[i].box[2]);\n }\n ctx.stroke();\n }\n }\n}\n\nexport async function canvas(inCanvas: HTMLCanvasElement, outCanvas: HTMLCanvasElement) {\n if (!inCanvas || !outCanvas) return;\n if (!(inCanvas instanceof HTMLCanvasElement) || !(outCanvas instanceof HTMLCanvasElement)) return;\n const outCtx = inCanvas.getContext('2d');\n outCtx?.drawImage(inCanvas, 0, 0);\n}\n\nexport async function all(inCanvas: HTMLCanvasElement, result: Result, drawOptions?: DrawOptions) {\n const timestamp = now();\n const localOptions = mergeDeep(options, drawOptions);\n if (!result || !inCanvas) return;\n if (!(inCanvas instanceof HTMLCanvasElement)) return;\n\n face(inCanvas, result.face, localOptions);\n body(inCanvas, result.body, localOptions);\n hand(inCanvas, result.hand, localOptions);\n object(inCanvas, result.object, localOptions);\n // person(inCanvas, result.persons, localOptions);\n gesture(inCanvas, result.gesture, localOptions); // gestures do not have buffering\n\n /*\n if (!bufferedResult) bufferedResult = result; // first pass\n else if (localOptions.bufferedOutput) calcBuffered(result); // do results interpolation\n else bufferedResult = result; // or just use results as-is\n const promises: Promise[] = [];\n promises.push(face(inCanvas, bufferedResult.face, localOptions));\n promises.push(body(inCanvas, bufferedResult.body, localOptions));\n promises.push(hand(inCanvas, bufferedResult.hand, localOptions));\n promises.push(object(inCanvas, bufferedResult.object, localOptions));\n // promises.push(person(inCanvas, bufferedResult.persons, localOptions));\n promises.push(gesture(inCanvas, result.gesture, localOptions)); // gestures do not have buffering\n // await Promise.all(promises);\n */\n result.performance.draw = Math.trunc(now() - timestamp);\n}\n", "/**\n * Module that analyzes existing results and recombines them into a unified person object\n */\n\nimport { Face, Body, Hand, Gesture, Person } from './result';\n\nexport function join(faces: Array, bodies: Array, hands: Array, gestures: Array, shape: Array | undefined): Array {\n let id = 0;\n const persons: Array = [];\n for (const face of faces) { // person is defined primarily by face and then we append other objects as found\n const person: Person = { id: id++, face, body: null, hands: { left: null, right: null }, gestures: [], box: [0, 0, 0, 0] };\n for (const body of bodies) {\n if (face.box[0] > body.box[0] // x within body\n && face.box[0] < body.box[0] + body.box[2]\n && face.box[1] + face.box[3] > body.box[1] // y within body\n && face.box[1] + face.box[3] < body.box[1] + body.box[3]) {\n person.body = body;\n }\n }\n if (person.body) { // only try to join hands if body is found\n for (const hand of hands) {\n if (hand.box[0] + hand.box[2] > person.body.box[0] // x within body for left hand\n && hand.box[0] + hand.box[2] < person.body.box[0] + person.body.box[2]\n && hand.box[1] + hand.box[3] > person.body.box[1] // x within body for left hand\n && hand.box[1] + hand.box[3] < person.body.box[1] + person.body.box[3]) {\n if (person.hands) person.hands.left = hand;\n }\n if (hand.box[0] < person.body.box[0] + person.body.box[2] // x within body for right hand\n && hand.box[0] > person.body.box[0]\n && hand.box[1] + hand.box[3] > person.body.box[1] // x within body for right hand\n && hand.box[1] + hand.box[3] < person.body.box[1] + person.body.box[3]) {\n if (person.hands) person.hands.right = hand;\n }\n }\n }\n for (const gesture of gestures) { // append all gestures according to ids\n if (gesture['face'] !== undefined && gesture['face'] === face.id) person.gestures?.push(gesture);\n else if (gesture['iris'] !== undefined && gesture['iris'] === face.id) person.gestures?.push(gesture);\n else if (gesture['body'] !== undefined && gesture['body'] === person.body?.id) person.gestures?.push(gesture);\n else if (gesture['hand'] !== undefined && gesture['hand'] === person.hands?.left?.id) person.gestures?.push(gesture);\n else if (gesture['hand'] !== undefined && gesture['hand'] === person.hands?.right?.id) person.gestures?.push(gesture);\n }\n\n // create new overarching box from all boxes beloning to person\n const x: number[] = [];\n const y: number[] = [];\n const extractXY = (box) => { // extract all [x, y] coordinates from boxes [x, y, width, height]\n if (box && box.length === 4) {\n x.push(box[0], box[0] + box[2]);\n y.push(box[1], box[1] + box[3]);\n }\n };\n extractXY(person.face?.box);\n extractXY(person.body?.box);\n extractXY(person.hands?.left?.box);\n extractXY(person.hands?.right?.box);\n const minX = Math.min(...x);\n const minY = Math.min(...y);\n person.box = [minX, minY, Math.max(...x) - minX, Math.max(...y) - minY]; // create new overarching box\n\n // shape is known so we calculate boxRaw as well\n if (shape && shape.length === 4) person.boxRaw = [person.box[0] / shape[2], person.box[1] / shape[1], person.box[2] / shape[2], person.box[3] / shape[1]];\n\n persons.push(person);\n }\n return persons;\n}\n", "/**\n * Module that interpolates results for smoother animations\n */\n\nimport type { Result, Face, Body, Hand, Item, Gesture, Person } from './result';\n\nconst bufferedResult: Result = { face: [], body: [], hand: [], gesture: [], object: [], persons: [], performance: {}, timestamp: 0 };\n\nexport function calc(newResult: Result): Result {\n // each record is only updated using deep clone when number of detected record changes, otherwise it will converge by itself\n // otherwise bufferedResult is a shallow clone of result plus updated local calculated values\n // thus mixing by-reference and by-value assignments to minimize memory operations\n\n const elapsed = Date.now() - newResult.timestamp;\n // curve fitted: buffer = 8 - ln(delay)\n // interpolation formula: current = ((buffer - 1) * previous + live) / buffer\n // - at 50ms delay buffer = ~4.1 => 28% towards live data\n // - at 250ms delay buffer = ~2.5 => 40% towards live data\n // - at 500ms delay buffer = ~1.8 => 55% towards live data\n // - at 750ms delay buffer = ~1.4 => 71% towards live data\n // - at 1sec delay buffer = 1 which means live data is used\n const bufferedFactor = elapsed < 1000 ? 8 - Math.log(elapsed) : 1;\n\n bufferedResult.canvas = newResult.canvas;\n\n // interpolate body results\n if (!bufferedResult.body || (newResult.body.length !== bufferedResult.body.length)) {\n bufferedResult.body = JSON.parse(JSON.stringify(newResult.body as Body[])); // deep clone once\n } else {\n for (let i = 0; i < newResult.body.length; i++) {\n const box = newResult.body[i].box // update box\n .map((b, j) => ((bufferedFactor - 1) * bufferedResult.body[i].box[j] + b) / bufferedFactor) as [number, number, number, number];\n const boxRaw = newResult.body[i].boxRaw // update boxRaw\n .map((b, j) => ((bufferedFactor - 1) * bufferedResult.body[i].boxRaw[j] + b) / bufferedFactor) as [number, number, number, number];\n const keypoints = (newResult.body[i].keypoints // update keypoints\n .map((keypoint, j) => ({\n score: keypoint.score,\n part: keypoint.part,\n position: [\n bufferedResult.body[i].keypoints[j] ? ((bufferedFactor - 1) * bufferedResult.body[i].keypoints[j].position[0] + keypoint.position[0]) / bufferedFactor : keypoint.position[0],\n bufferedResult.body[i].keypoints[j] ? ((bufferedFactor - 1) * bufferedResult.body[i].keypoints[j].position[1] + keypoint.position[1]) / bufferedFactor : keypoint.position[1],\n ],\n positionRaw: [\n bufferedResult.body[i].keypoints[j] ? ((bufferedFactor - 1) * bufferedResult.body[i].keypoints[j].positionRaw[0] + keypoint.positionRaw[0]) / bufferedFactor : keypoint.position[0],\n bufferedResult.body[i].keypoints[j] ? ((bufferedFactor - 1) * bufferedResult.body[i].keypoints[j].positionRaw[1] + keypoint.positionRaw[1]) / bufferedFactor : keypoint.position[1],\n ],\n }))) as Array<{ score: number, part: string, position: [number, number, number?], positionRaw: [number, number, number?] }>;\n bufferedResult.body[i] = { ...newResult.body[i], box, boxRaw, keypoints }; // shallow clone plus updated values\n }\n }\n\n // interpolate hand results\n if (!bufferedResult.hand || (newResult.hand.length !== bufferedResult.hand.length)) {\n bufferedResult.hand = JSON.parse(JSON.stringify(newResult.hand as Hand[])); // deep clone once\n } else {\n for (let i = 0; i < newResult.hand.length; i++) {\n const box = (newResult.hand[i].box// update box\n .map((b, j) => ((bufferedFactor - 1) * bufferedResult.hand[i].box[j] + b) / bufferedFactor)) as [number, number, number, number];\n const boxRaw = (newResult.hand[i].boxRaw // update boxRaw\n .map((b, j) => ((bufferedFactor - 1) * bufferedResult.hand[i].boxRaw[j] + b) / bufferedFactor)) as [number, number, number, number];\n const keypoints = newResult.hand[i].keypoints // update landmarks\n .map((landmark, j) => landmark\n .map((coord, k) => (((bufferedFactor - 1) * bufferedResult.hand[i].keypoints[j][k] + coord) / bufferedFactor)) as [number, number, number]);\n const keys = Object.keys(newResult.hand[i].annotations); // update annotations\n const annotations = {};\n for (const key of keys) {\n annotations[key] = newResult.hand[i].annotations[key]\n .map((val, j) => val.map((coord, k) => ((bufferedFactor - 1) * bufferedResult.hand[i].annotations[key][j][k] + coord) / bufferedFactor));\n }\n bufferedResult.hand[i] = { ...newResult.hand[i], box, boxRaw, keypoints, annotations }; // shallow clone plus updated values\n }\n }\n\n // interpolate face results\n if (!bufferedResult.face || (newResult.face.length !== bufferedResult.face.length)) {\n bufferedResult.face = JSON.parse(JSON.stringify(newResult.face as Face[])); // deep clone once\n } else {\n for (let i = 0; i < newResult.face.length; i++) {\n const box = (newResult.face[i].box // update box\n .map((b, j) => ((bufferedFactor - 1) * bufferedResult.face[i].box[j] + b) / bufferedFactor)) as [number, number, number, number];\n const boxRaw = (newResult.face[i].boxRaw // update boxRaw\n .map((b, j) => ((bufferedFactor - 1) * bufferedResult.face[i].boxRaw[j] + b) / bufferedFactor)) as [number, number, number, number];\n const rotation: {\n matrix: [number, number, number, number, number, number, number, number, number],\n angle: { roll: number, yaw: number, pitch: number },\n gaze: { bearing: number, strength: number }\n } = { matrix: [0, 0, 0, 0, 0, 0, 0, 0, 0], angle: { roll: 0, yaw: 0, pitch: 0 }, gaze: { bearing: 0, strength: 0 } };\n rotation.matrix = newResult.face[i].rotation?.matrix as [number, number, number, number, number, number, number, number, number];\n rotation.angle = {\n roll: ((bufferedFactor - 1) * (bufferedResult.face[i].rotation?.angle?.roll || 0) + (newResult.face[i].rotation?.angle?.roll || 0)) / bufferedFactor,\n yaw: ((bufferedFactor - 1) * (bufferedResult.face[i].rotation?.angle?.yaw || 0) + (newResult.face[i].rotation?.angle?.yaw || 0)) / bufferedFactor,\n pitch: ((bufferedFactor - 1) * (bufferedResult.face[i].rotation?.angle?.pitch || 0) + (newResult.face[i].rotation?.angle?.pitch || 0)) / bufferedFactor,\n };\n rotation.gaze = {\n // not fully correct due projection on circle, also causes wrap-around draw on jump from negative to positive\n bearing: ((bufferedFactor - 1) * (bufferedResult.face[i].rotation?.gaze?.bearing || 0) + (newResult.face[i].rotation?.gaze?.bearing || 0)) / bufferedFactor,\n strength: ((bufferedFactor - 1) * (bufferedResult.face[i].rotation?.gaze?.strength || 0) + (newResult.face[i].rotation?.gaze?.strength || 0)) / bufferedFactor,\n };\n bufferedResult.face[i] = { ...newResult.face[i], rotation, box, boxRaw }; // shallow clone plus updated values\n }\n }\n\n // interpolate object detection results\n if (!bufferedResult.object || (newResult.object.length !== bufferedResult.object.length)) {\n bufferedResult.object = JSON.parse(JSON.stringify(newResult.object as Item[])); // deep clone once\n } else {\n for (let i = 0; i < newResult.object.length; i++) {\n const box = (newResult.object[i].box // update box\n .map((b, j) => ((bufferedFactor - 1) * bufferedResult.object[i].box[j] + b) / bufferedFactor)) as [number, number, number, number];\n const boxRaw = (newResult.object[i].boxRaw // update boxRaw\n .map((b, j) => ((bufferedFactor - 1) * bufferedResult.object[i].boxRaw[j] + b) / bufferedFactor)) as [number, number, number, number];\n bufferedResult.object[i] = { ...newResult.object[i], box, boxRaw }; // shallow clone plus updated values\n }\n }\n\n // interpolate person results\n const newPersons = newResult.persons; // trigger getter function\n if (!bufferedResult.persons || (newPersons.length !== bufferedResult.persons.length)) {\n bufferedResult.persons = JSON.parse(JSON.stringify(newPersons as Person[]));\n } else {\n for (let i = 0; i < newPersons.length; i++) { // update person box, we don't update the rest as it's updated as reference anyhow\n bufferedResult.persons[i].box = (newPersons[i].box\n .map((box, j) => ((bufferedFactor - 1) * bufferedResult.persons[i].box[j] + box) / bufferedFactor)) as [number, number, number, number];\n }\n }\n\n // just copy latest gestures without interpolation\n bufferedResult.gesture = newResult.gesture as Gesture[];\n bufferedResult.performance = newResult.performance;\n\n return bufferedResult;\n}\n", "/**\n * EfficientPose Module\n */\n\nimport { log, join } from '../helpers';\nimport * as tf from '../../dist/tfjs.esm.js';\nimport * as image from '../image/image';\nimport { GraphModel, Tensor } from '../tfjs/types';\nimport { Config } from '../config';\n\ntype Input = Tensor | typeof Image | ImageData | ImageBitmap | HTMLImageElement | HTMLMediaElement | HTMLVideoElement | HTMLCanvasElement | OffscreenCanvas;\n\nlet model: GraphModel;\nlet busy = false;\n\nexport async function load(config: Config): Promise {\n if (!model) {\n // @ts-ignore type mismatch on GraphModel\n model = await tf.loadGraphModel(join(config.modelBasePath, config.segmentation.modelPath));\n if (!model || !model['modelUrl']) log('load model failed:', config.segmentation.modelPath);\n else if (config.debug) log('load model:', model['modelUrl']);\n } else if (config.debug) log('cached model:', model['modelUrl']);\n return model;\n}\n\nexport async function predict(input: { tensor: Tensor | null, canvas: OffscreenCanvas | HTMLCanvasElement }): Promise {\n const width = input.tensor?.shape[1] || 0;\n const height = input.tensor?.shape[2] || 0;\n if (!input.tensor) return null;\n if (!model || !model.inputs[0].shape) return null;\n const resizeInput = tf.image.resizeBilinear(input.tensor, [model.inputs[0].shape[1], model.inputs[0].shape[2]], false);\n const norm = resizeInput.div(255);\n const res = model.predict(norm) as Tensor;\n // meet output: 1,256,256,1\n // selfie output: 1,144,256,2\n tf.dispose(resizeInput);\n tf.dispose(norm);\n\n const squeeze = tf.squeeze(res, 0);\n let resizeOutput;\n if (squeeze.shape[2] === 2) {\n // model meet has two channels for fg and bg\n const softmax = squeeze.softmax();\n const [bg, fg] = tf.unstack(softmax, 2);\n const expand = fg.expandDims(2);\n const pad = expand.expandDims(0);\n tf.dispose(softmax);\n tf.dispose(bg);\n tf.dispose(fg);\n // running sofmax before unstack creates 2x2 matrix so we only take upper-left quadrant\n const crop = tf.image.cropAndResize(pad, [[0, 0, 0.5, 0.5]], [0], [width, height]);\n // otherwise run softmax after unstack and use standard resize\n // resizeOutput = tf.image.resizeBilinear(expand, [input.tensor?.shape[1], input.tensor?.shape[2]]);\n resizeOutput = crop.squeeze(0);\n tf.dispose(crop);\n tf.dispose(expand);\n tf.dispose(pad);\n } else { // model selfie has a single channel that we can use directly\n resizeOutput = tf.image.resizeBilinear(squeeze, [width, height]);\n }\n\n if (typeof document === 'undefined') return resizeOutput.dataSync(); // we're running in nodejs so return alpha array as-is\n\n const overlay = (typeof OffscreenCanvas !== 'undefined') ? new OffscreenCanvas(width, height) : document.createElement('canvas');\n overlay.width = width;\n overlay.height = height;\n if (tf.browser) await tf.browser.toPixels(resizeOutput, overlay);\n tf.dispose(resizeOutput);\n tf.dispose(squeeze);\n tf.dispose(res);\n\n // get alpha channel data\n const alphaCanvas = (typeof OffscreenCanvas !== 'undefined') ? new OffscreenCanvas(width, height) : document.createElement('canvas'); // need one more copy since input may already have gl context so 2d context fails\n alphaCanvas.width = width;\n alphaCanvas.height = height;\n const ctxAlpha = alphaCanvas.getContext('2d') as CanvasRenderingContext2D;\n ctxAlpha.filter = 'blur(8px';\n await ctxAlpha.drawImage(overlay, 0, 0);\n const alpha = ctxAlpha.getImageData(0, 0, width, height).data;\n\n // get original canvas merged with overlay\n const original = (typeof OffscreenCanvas !== 'undefined') ? new OffscreenCanvas(width, height) : document.createElement('canvas'); // need one more copy since input may already have gl context so 2d context fails\n original.width = width;\n original.height = height;\n const ctx = original.getContext('2d') as CanvasRenderingContext2D;\n if (input.canvas) await ctx.drawImage(input.canvas, 0, 0);\n // https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/globalCompositeOperation // best options are: darken, color-burn, multiply\n ctx.globalCompositeOperation = 'darken';\n ctx.filter = 'blur(8px)'; // use css filter for bluring, can be done with gaussian blur manually instead\n await ctx.drawImage(overlay, 0, 0);\n ctx.globalCompositeOperation = 'source-over'; // reset\n ctx.filter = 'none'; // reset\n\n input.canvas = original;\n\n return alpha;\n}\n\nexport async function process(input: Input, background: Input | undefined, config: Config): Promise {\n if (busy) return null;\n busy = true;\n if (!model) await load(config);\n const img = image.process(input, config);\n const alpha = await predict(img);\n tf.dispose(img.tensor);\n\n if (background && alpha) {\n const tmp = image.process(background, config);\n const bg = tmp.canvas;\n tf.dispose(tmp.tensor);\n const fg = img.canvas;\n const fgData = fg.getContext('2d')?.getImageData(0, 0, fg.width, fg.height).data as Uint8ClampedArray;\n\n const c = (typeof OffscreenCanvas !== 'undefined') ? new OffscreenCanvas(fg.width, fg.height) : document.createElement('canvas');\n c.width = fg.width;\n c.height = fg.height;\n const ctx = c.getContext('2d') as CanvasRenderingContext2D;\n\n ctx.globalCompositeOperation = 'copy'; // reset\n ctx.drawImage(bg, 0, 0, c.width, c.height);\n const cData = ctx.getImageData(0, 0, c.width, c.height) as ImageData;\n for (let i = 0; i < c.width * c.height; i++) { // this should be done with globalCompositeOperation instead of looping through image data\n cData.data[4 * i + 0] = ((255 - alpha[4 * i + 0]) / 255.0 * cData.data[4 * i + 0]) + (alpha[4 * i + 0] / 255.0 * fgData[4 * i + 0]);\n cData.data[4 * i + 1] = ((255 - alpha[4 * i + 1]) / 255.0 * cData.data[4 * i + 1]) + (alpha[4 * i + 1] / 255.0 * fgData[4 * i + 1]);\n cData.data[4 * i + 2] = ((255 - alpha[4 * i + 2]) / 255.0 * cData.data[4 * i + 2]) + (alpha[4 * i + 2] / 255.0 * fgData[4 * i + 2]);\n cData.data[4 * i + 3] = ((255 - alpha[4 * i + 3]) / 255.0 * cData.data[4 * i + 3]) + (alpha[4 * i + 3] / 255.0 * fgData[4 * i + 3]);\n }\n ctx.putImageData(cData, 0, 0);\n img.canvas = c;\n }\n busy = false;\n return img.canvas;\n}\n", "/**\n * Embedded sample images used during warmup in dataURL format\n */\n\n// data:image/jpeg;base64,\nexport const face = `\n/9j/4AAQSkZJRgABAQEAYABgAAD/4QBoRXhpZgAATU0AKgAAAAgABAEaAAUAAAABAAAAPgEbAAUA\nAAABAAAARgEoAAMAAAABAAIAAAExAAIAAAARAAAATgAAAAAAAABgAAAAAQAAAGAAAAABcGFpbnQu\nbmV0IDQuMi4xMwAA/9sAQwAGBAUGBQQGBgUGBwcGCAoQCgoJCQoUDg8MEBcUGBgXFBYWGh0lHxob\nIxwWFiAsICMmJykqKRkfLTAtKDAlKCko/9sAQwEHBwcKCAoTCgoTKBoWGigoKCgoKCgoKCgoKCgo\nKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgo/8AAEQgBAAEAAwEhAAIRAQMRAf/E\nAB8AAAEFAQEBAQEBAAAAAAAAAAABAgMEBQYHCAkKC//EALUQAAIBAwMCBAMFBQQEAAABfQECAwAE\nEQUSITFBBhNRYQcicRQygZGhCCNCscEVUtHwJDNicoIJChYXGBkaJSYnKCkqNDU2Nzg5OkNERUZH\nSElKU1RVVldYWVpjZGVmZ2hpanN0dXZ3eHl6g4SFhoeIiYqSk5SVlpeYmZqio6Slpqeoqaqys7S1\ntre4ubrCw8TFxsfIycrS09TV1tfY2drh4uPk5ebn6Onq8fLz9PX29/j5+v/EAB8BAAMBAQEBAQEB\nAQEAAAAAAAABAgMEBQYHCAkKC//EALURAAIBAgQEAwQHBQQEAAECdwABAgMRBAUhMQYSQVEHYXET\nIjKBCBRCkaGxwQkjM1Lw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MFK9qxH5L0bAr8OPRPKz2AY7J2\nSbAjYZAI2E7AIEgIEgIEgMdkSy2NgY7MdlmyNoBXsxmFuyNgVTVjNV3KjlBRNTlXTVHKCrlIqt5T\nlBhEMohlFerLlBjEMohMVTEARDKCITsAk2AEgAAAkAAAAAAAAAAAAAAAAAAAAAAAASAAAAAAAAD/\n2Q==`;\n", "/**\n * Human main module\n */\n\nimport { log, now, mergeDeep } from './helpers';\nimport { Config, defaults } from './config';\nimport { Result, Gesture } from './result';\nimport * as sysinfo from './sysinfo';\nimport * as tf from '../dist/tfjs.esm.js';\nimport * as backend from './tfjs/backend';\nimport * as face from './face';\nimport * as facemesh from './blazeface/facemesh';\nimport * as faceres from './faceres/faceres';\nimport * as emotion from './emotion/emotion';\nimport * as posenet from './posenet/posenet';\nimport * as handpose from './handpose/handpose';\nimport * as blazepose from './blazepose/blazepose';\nimport * as efficientpose from './efficientpose/efficientpose';\nimport * as movenet from './movenet/movenet';\nimport * as nanodet from './object/nanodet';\nimport * as centernet from './object/centernet';\nimport * as gesture from './gesture/gesture';\nimport * as image from './image/image';\nimport * as draw from './draw/draw';\nimport * as persons from './persons';\nimport * as interpolate from './interpolate';\nimport * as segmentation from './segmentation/segmentation';\nimport * as sample from './sample';\nimport * as app from '../package.json';\nimport { Tensor } from './tfjs/types';\n\n// export types\nexport type { Config } from './config';\nexport type { Result, Face, Hand, Body, Item, Gesture, Person } from './result';\nexport type { DrawOptions } from './draw/draw';\n\n/** Defines all possible input types for **Human** detection\n * @typedef Input Type\n */\nexport type Input = Tensor | typeof Image | ImageData | ImageBitmap | HTMLImageElement | HTMLMediaElement | HTMLVideoElement | HTMLCanvasElement | OffscreenCanvas;\n\n/** Error message\n * @typedef Error Type\n */\nexport type Error = { error: string };\n\n/** Instance of TensorFlow/JS\n * @external\n */\nexport type TensorFlow = typeof tf;\n\n/** Generic Model object type\n * holds instance of individual models\n */\ntype Model = unknown;\n\n/**\n * **Human** library main class\n *\n * All methods and properties are available only as members of Human class\n *\n * - Configuration object definition: {@link Config}\n * - Results object definition: {@link Result}\n * - Possible inputs: {@link Input}\n *\n * @param userConfig: {@link Config}\n */\nexport class Human {\n /** Current version of Human library in *semver* format */\n version: string;\n /** Current configuration\n * - Details: {@link Config}\n */\n config: Config;\n /** Last known result of detect run\n * - Can be accessed anytime after initial detection\n */\n result: Result;\n /** Current state of Human library\n * - Can be polled to determine operations that are currently executed\n * - Progresses through: 'config', 'check', 'backend', 'load', 'run:', 'idle'\n */\n state: string;\n /** @internal: Instance of current image being processed */\n image: { tensor: Tensor | null, canvas: OffscreenCanvas | HTMLCanvasElement | null };\n /** @internal: Instance of TensorFlow/JS used by Human\n * - Can be embedded or externally provided\n */\n tf: TensorFlow;\n /** Draw helper classes that can draw detected objects on canvas using specified draw styles\n * - options: global settings for all draw operations, can be overriden for each draw method, for details see {@link DrawOptions}\n * - face: draw detected faces\n * - body: draw detected people and body parts\n * - hand: draw detected hands and hand parts\n * - canvas: draw processed canvas which is a processed copy of the input\n * - all: meta-function that performs: canvas, face, body, hand\n */\n draw: {\n options: draw.DrawOptions,\n gesture: typeof draw.gesture,\n face: typeof draw.face,\n body: typeof draw.body,\n hand: typeof draw.hand,\n canvas: typeof draw.canvas,\n all: typeof draw.all,\n };\n /** @internal: Currently loaded models */\n models: {\n face: [Model, Model, Model] | null,\n posenet: Model | null,\n blazepose: Model | null,\n efficientpose: Model | null,\n movenet: Model | null,\n handpose: [Model, Model] | null,\n age: Model | null,\n gender: Model | null,\n emotion: Model | null,\n embedding: Model | null,\n nanodet: Model | null,\n centernet: Model | null,\n faceres: Model | null,\n segmentation: Model | null,\n };\n /** Reference face triangualtion array of 468 points, used for triangle references between points */\n faceTriangulation: typeof facemesh.triangulation;\n /** Refernce UV map of 468 values, used for 3D mapping of the face mesh */\n faceUVMap: typeof facemesh.uvmap;\n /** Platform and agent information detected by Human */\n sysinfo: { platform: string, agent: string };\n /** Performance object that contains values for all recently performed operations */\n performance: Record; // perf members are dynamically defined as needed\n #numTensors: number;\n #analyzeMemoryLeaks: boolean;\n #checkSanity: boolean;\n #firstRun: boolean;\n #lastInputSum: number;\n #lastCacheDiff: number;\n\n // definition end\n\n /**\n * Creates instance of Human library that is futher used for all operations\n * @param userConfig: {@link Config}\n */\n constructor(userConfig?: Config | Record) {\n this.config = mergeDeep(defaults, userConfig || {});\n this.tf = tf;\n this.draw = draw;\n this.version = app.version;\n this.state = 'idle';\n this.#numTensors = 0;\n this.#analyzeMemoryLeaks = false;\n this.#checkSanity = false;\n this.#firstRun = true;\n this.#lastCacheDiff = 0;\n this.performance = { backend: 0, load: 0, image: 0, frames: 0, cached: 0, changed: 0, total: 0, draw: 0 };\n // object that contains all initialized models\n this.models = {\n face: null,\n posenet: null,\n blazepose: null,\n efficientpose: null,\n movenet: null,\n handpose: null,\n age: null,\n gender: null,\n emotion: null,\n embedding: null,\n nanodet: null,\n centernet: null,\n faceres: null,\n segmentation: null,\n };\n // export access to image processing\n // @ts-ignore eslint-typescript cannot correctly infer type in anonymous function\n this.image = (input: Input) => image.process(input, this.config);\n // export raw access to underlying models\n this.faceTriangulation = facemesh.triangulation;\n this.faceUVMap = facemesh.uvmap;\n // include platform info\n this.sysinfo = sysinfo.info();\n this.#lastInputSum = 1;\n }\n\n // helper function: measure tensor leak\n /** @hidden */\n analyze = (...msg) => {\n if (!this.#analyzeMemoryLeaks) return;\n const currentTensors = this.tf.engine().state.numTensors;\n const previousTensors = this.#numTensors;\n this.#numTensors = currentTensors;\n const leaked = currentTensors - previousTensors;\n if (leaked !== 0) log(...msg, leaked);\n }\n\n // quick sanity check on inputs\n /** @hidden */\n #sanity = (input): null | string => {\n if (!this.#checkSanity) return null;\n if (!input) return 'input is not defined';\n if (this.tf.ENV.flags.IS_NODE && !(input instanceof tf.Tensor)) return 'input must be a tensor';\n try {\n this.tf.getBackend();\n } catch {\n return 'backend not loaded';\n }\n return null;\n }\n\n /** Simmilarity method calculates simmilarity between two provided face descriptors (face embeddings)\n * - Calculation is based on normalized Minkowski distance between\n *\n * @param embedding1: face descriptor as array of numbers\n * @param embedding2: face descriptor as array of numbers\n * @returns similarity: number\n */\n // eslint-disable-next-line class-methods-use-this\n similarity(embedding1: Array, embedding2: Array): number {\n return faceres.similarity(embedding1, embedding2);\n }\n\n /**\n * Segmentation method takes any input and returns processed canvas with body segmentation\n * Optional parameter background is used to fill the background with specific input\n * Segmentation is not triggered as part of detect process\n *\n * @param input: {@link Input}\n * @param background?: {@link Input}\n * @returns Canvas\n */\n segmentation(input: Input, background?: Input) {\n return segmentation.process(input, background, this.config);\n }\n\n /** Enhance method performs additional enhacements to face image previously detected for futher processing\n * @param input: Tensor as provided in human.result.face[n].tensor\n * @returns Tensor\n */\n // eslint-disable-next-line class-methods-use-this\n enhance(input: Tensor): Tensor | null {\n // @ts-ignore type mismach for Tensor\n return faceres.enhance(input);\n }\n\n /** Math method find best match between provided face descriptor and predefined database of known descriptors\n * @param faceEmbedding: face descriptor previsouly calculated on any face\n * @param db: array of mapping of face descriptors to known values\n * @param threshold: minimum score for matching to be considered in the result\n * @returns best match\n */\n // eslint-disable-next-line class-methods-use-this\n match(faceEmbedding: Array, db: Array<{ name: string, source: string, embedding: number[] }>, threshold = 0): { name: string, source: string, similarity: number, embedding: number[] } {\n return faceres.match(faceEmbedding, db, threshold);\n }\n\n /** Load method preloads all configured models on-demand\n * - Not explicitly required as any required model is load implicitly on it's first run\n * @param userConfig?: {@link Config}\n */\n async load(userConfig?: Config | Record) {\n this.state = 'load';\n const timeStamp = now();\n if (userConfig) this.config = mergeDeep(this.config, userConfig) as Config;\n\n if (this.#firstRun) { // print version info on first run and check for correct backend setup\n if (this.config.debug) log(`version: ${this.version}`);\n if (this.config.debug) log(`tfjs version: ${this.tf.version_core}`);\n if (this.config.debug) log('platform:', this.sysinfo.platform);\n if (this.config.debug) log('agent:', this.sysinfo.agent);\n\n await this.#checkBackend(true);\n if (this.tf.ENV.flags.IS_BROWSER) {\n if (this.config.debug) log('configuration:', this.config);\n if (this.config.debug) log('tf flags:', this.tf.ENV.flags);\n }\n }\n if (this.config.async) { // load models concurrently\n [\n // @ts-ignore async model loading is not correctly inferred\n this.models.face,\n this.models.emotion,\n // @ts-ignore async model loading is not correctly inferred\n this.models.handpose,\n this.models.posenet,\n this.models.blazepose,\n this.models.efficientpose,\n this.models.movenet,\n this.models.nanodet,\n this.models.centernet,\n this.models.faceres,\n this.models.segmentation,\n ] = await Promise.all([\n this.models.face || (this.config.face.enabled ? facemesh.load(this.config) : null),\n this.models.emotion || ((this.config.face.enabled && this.config.face.emotion.enabled) ? emotion.load(this.config) : null),\n this.models.handpose || (this.config.hand.enabled ? handpose.load(this.config) : null),\n this.models.posenet || (this.config.body.enabled && this.config.body.modelPath.includes('posenet') ? posenet.load(this.config) : null),\n this.models.blazepose || (this.config.body.enabled && this.config.body.modelPath.includes('blazepose') ? blazepose.load(this.config) : null),\n this.models.efficientpose || (this.config.body.enabled && this.config.body.modelPath.includes('efficientpose') ? efficientpose.load(this.config) : null),\n this.models.movenet || (this.config.body.enabled && this.config.body.modelPath.includes('movenet') ? movenet.load(this.config) : null),\n this.models.nanodet || (this.config.object.enabled && this.config.object.modelPath.includes('nanodet') ? nanodet.load(this.config) : null),\n this.models.centernet || (this.config.object.enabled && this.config.object.modelPath.includes('centernet') ? centernet.load(this.config) : null),\n this.models.faceres || ((this.config.face.enabled && this.config.face.description.enabled) ? faceres.load(this.config) : null),\n this.models.segmentation || (this.config.segmentation.enabled ? segmentation.load(this.config) : null),\n ]);\n } else { // load models sequentially\n if (this.config.face.enabled && !this.models.face) this.models.face = await facemesh.load(this.config);\n if (this.config.face.enabled && this.config.face.emotion.enabled && !this.models.emotion) this.models.emotion = await emotion.load(this.config);\n if (this.config.hand.enabled && !this.models.handpose) this.models.handpose = await handpose.load(this.config);\n if (this.config.body.enabled && !this.models.posenet && this.config.body.modelPath.includes('posenet')) this.models.posenet = await posenet.load(this.config);\n if (this.config.body.enabled && !this.models.blazepose && this.config.body.modelPath.includes('blazepose')) this.models.blazepose = await blazepose.load(this.config);\n if (this.config.body.enabled && !this.models.efficientpose && this.config.body.modelPath.includes('efficientpose')) this.models.efficientpose = await blazepose.load(this.config);\n if (this.config.body.enabled && !this.models.movenet && this.config.body.modelPath.includes('movenet')) this.models.movenet = await movenet.load(this.config);\n if (this.config.object.enabled && !this.models.nanodet && this.config.object.modelPath.includes('nanodet')) this.models.nanodet = await nanodet.load(this.config);\n if (this.config.object.enabled && !this.models.centernet && this.config.object.modelPath.includes('centernet')) this.models.centernet = await centernet.load(this.config);\n if (this.config.face.enabled && this.config.face.description.enabled && !this.models.faceres) this.models.faceres = await faceres.load(this.config);\n if (this.config.segmentation.enabled && !this.models.segmentation) this.models.segmentation = await segmentation.load(this.config);\n }\n\n if (this.#firstRun) { // print memory stats on first run\n if (this.config.debug) log('tf engine state:', this.tf.engine().state.numBytes, 'bytes', this.tf.engine().state.numTensors, 'tensors');\n this.#firstRun = false;\n }\n\n const current = Math.trunc(now() - timeStamp);\n if (current > (this.performance.load as number || 0)) this.performance.load = current;\n }\n\n // check if backend needs initialization if it changed\n /** @hidden */\n #checkBackend = async (force = false) => {\n if (this.config.backend && (this.config.backend.length > 0) && force || (this.tf.getBackend() !== this.config.backend)) {\n const timeStamp = now();\n this.state = 'backend';\n /* force backend reload\n if (this.config.backend in tf.engine().registry) {\n const backendFactory = tf.findBackendFactory(this.config.backend);\n tf.removeBackend(this.config.backend);\n tf.registerBackend(this.config.backend, backendFactory);\n } else {\n log('Backend not registred:', this.config.backend);\n }\n */\n\n if (this.config.backend && this.config.backend.length > 0) {\n // @ts-ignore ignore missing type for WorkerGlobalScope as that is the point\n if (typeof window === 'undefined' && typeof WorkerGlobalScope !== 'undefined' && this.config.debug) log('running inside web worker');\n\n // force browser vs node backend\n if (this.tf.ENV.flags.IS_BROWSER && this.config.backend === 'tensorflow') this.config.backend = 'webgl';\n if (this.tf.ENV.flags.IS_NODE && (this.config.backend === 'webgl' || this.config.backend === 'humangl')) this.config.backend = 'tensorflow';\n\n if (this.config.debug) log('setting backend:', this.config.backend);\n\n if (this.config.backend === 'wasm') {\n if (this.config.debug) log('wasm path:', this.config.wasmPath);\n if (typeof this.tf?.setWasmPaths !== 'undefined') this.tf.setWasmPaths(this.config.wasmPath);\n else throw new Error('Human: WASM backend is not loaded');\n const simd = await this.tf.env().getAsync('WASM_HAS_SIMD_SUPPORT');\n const mt = await this.tf.env().getAsync('WASM_HAS_MULTITHREAD_SUPPORT');\n if (this.config.debug) log(`wasm execution: ${simd ? 'SIMD' : 'no SIMD'} ${mt ? 'multithreaded' : 'singlethreaded'}`);\n if (this.config.debug && !simd) log('warning: wasm simd support is not enabled');\n }\n\n if (this.config.backend === 'humangl') backend.register();\n try {\n await this.tf.setBackend(this.config.backend);\n } catch (err) {\n log('error: cannot set backend:', this.config.backend, err);\n }\n }\n this.tf.enableProdMode();\n // this.tf.enableDebugMode();\n if (this.tf.getBackend() === 'webgl' || this.tf.getBackend() === 'humangl') {\n this.tf.ENV.set('CHECK_COMPUTATION_FOR_ERRORS', false);\n this.tf.ENV.set('WEBGL_CPU_FORWARD', true);\n this.tf.ENV.set('WEBGL_PACK_DEPTHWISECONV', true);\n // if (!this.config.object.enabled) this.tf.ENV.set('WEBGL_FORCE_F16_TEXTURES', true); // safe to use 16bit precision\n if (typeof this.config['deallocate'] !== 'undefined' && this.config['deallocate']) { // hidden param\n log('changing webgl: WEBGL_DELETE_TEXTURE_THRESHOLD:', true);\n this.tf.ENV.set('WEBGL_DELETE_TEXTURE_THRESHOLD', 0);\n }\n const gl = await this.tf.backend().getGPGPUContext().gl;\n if (this.config.debug) log(`gl version:${gl.getParameter(gl.VERSION)} renderer:${gl.getParameter(gl.RENDERER)}`);\n }\n await this.tf.ready();\n this.performance.backend = Math.trunc(now() - timeStamp);\n }\n }\n\n /**\n * Runs interpolation using last known result and returns smoothened result\n * Interpolation is based on time since last known result so can be called independently\n *\n * @param result?: {@link Result} optional use specific result set to run interpolation on\n * @returns result: {@link Result}\n */\n next = (result?: Result) => interpolate.calc(result || this.result) as Result;\n\n // check if input changed sufficiently to trigger new detections\n /** @hidden */\n #skipFrame = async (input) => {\n if (this.config.cacheSensitivity === 0) return false;\n const resizeFact = 32;\n const reduced: Tensor = input.resizeBilinear([Math.trunc(input.shape[1] / resizeFact), Math.trunc(input.shape[2] / resizeFact)]);\n // use tensor sum\n /*\n const sumT = this.tf.sum(reduced);\n const sum = sumT.dataSync()[0] as number;\n sumT.dispose();\n */\n // use js loop sum, faster than uploading tensor to gpu calculating and downloading back\n const reducedData = reduced.dataSync(); // raw image rgb array\n let sum = 0;\n for (let i = 0; i < reducedData.length / 3; i++) sum += reducedData[3 * i + 2]; // look only at green value of each pixel\n\n reduced.dispose();\n const diff = 100 * (Math.max(sum, this.#lastInputSum) / Math.min(sum, this.#lastInputSum) - 1);\n this.#lastInputSum = sum;\n // if previous frame was skipped, skip this frame if changed more than cacheSensitivity\n // if previous frame was not skipped, then look for cacheSensitivity or difference larger than one in previous frame to avoid resetting cache in subsequent frames unnecessarily\n const skipFrame = diff < Math.max(this.config.cacheSensitivity, this.#lastCacheDiff);\n // if difference is above 10x threshold, don't use last value to force reset cache for significant change of scenes or images\n this.#lastCacheDiff = diff > 10 * this.config.cacheSensitivity ? 0 : diff;\n return skipFrame;\n }\n\n /** Main detection method\n * - Analyze configuration: {@link Config}\n * - Pre-process input: {@link Input}\n * - Run inference for all configured models\n * - Process and return result: {@link Result}\n *\n * @param input: Input\n * @param userConfig?: {@link Config}\n * @returns result: {@link Result}\n */\n async detect(input: Input, userConfig?: Config | Record): Promise {\n // detection happens inside a promise\n return new Promise(async (resolve) => {\n this.state = 'config';\n let timeStamp;\n let elapsedTime;\n\n // update configuration\n this.config = mergeDeep(this.config, userConfig) as Config;\n\n // sanity checks\n this.state = 'check';\n const error = this.#sanity(input);\n if (error) {\n log(error, input);\n resolve({ error });\n }\n\n const timeStart = now();\n\n // configure backend\n await this.#checkBackend();\n\n // load models if enabled\n await this.load();\n\n /*\n // function disabled in favor of inputChanged\n // disable video optimization for inputs of type image, but skip if inside worker thread\n let previousVideoOptimized;\n // @ts-ignore ignore missing type for WorkerGlobalScope as that is the point\n if (input && this.config.videoOptimized && (typeof window !== 'undefined') && (typeof WorkerGlobalScope !== 'undefined') && (\n (typeof HTMLImageElement !== 'undefined' && input instanceof HTMLImageElement)\n || (typeof Image !== 'undefined' && input instanceof Image)\n || (typeof ImageData !== 'undefined' && input instanceof ImageData)\n || (typeof ImageBitmap !== 'undefined' && image instanceof ImageBitmap))\n ) {\n log('disabling video optimization');\n previousVideoOptimized = this.config.videoOptimized;\n this.config.videoOptimized = false;\n }\n */\n\n timeStamp = now();\n let process = image.process(input, this.config);\n this.performance.image = Math.trunc(now() - timeStamp);\n this.analyze('Get Image:');\n\n // run segmentation preprocessing\n if (this.config.segmentation.enabled && process && process.tensor) {\n this.analyze('Start Segmentation:');\n this.state = 'run:segmentation';\n timeStamp = now();\n await segmentation.predict(process);\n elapsedTime = Math.trunc(now() - timeStamp);\n if (elapsedTime > 0) this.performance.segmentation = elapsedTime;\n if (process.canvas) {\n // replace input\n process.tensor.dispose();\n process = image.process(process.canvas, this.config);\n }\n this.analyze('End Segmentation:');\n }\n\n if (!process || !process.tensor) {\n log('could not convert input to tensor');\n resolve({ error: 'could not convert input to tensor' });\n return;\n }\n\n timeStamp = now();\n this.config.skipFrame = await this.#skipFrame(process.tensor);\n if (!this.performance.frames) this.performance.frames = 0;\n if (!this.performance.cached) this.performance.cached = 0;\n (this.performance.frames as number)++;\n if (this.config.skipFrame) this.performance.cached++;\n this.performance.changed = Math.trunc(now() - timeStamp);\n this.analyze('Check Changed:');\n\n // prepare where to store model results\n // keep them with weak typing as it can be promise or not\n let faceRes;\n let bodyRes;\n let handRes;\n let objectRes;\n\n // run face detection followed by all models that rely on face bounding box: face mesh, age, gender, emotion\n if (this.config.async) {\n faceRes = this.config.face.enabled ? face.detectFace(this, process.tensor) : [];\n if (this.performance.face) delete this.performance.face;\n } else {\n this.state = 'run:face';\n timeStamp = now();\n faceRes = this.config.face.enabled ? await face.detectFace(this, process.tensor) : [];\n elapsedTime = Math.trunc(now() - timeStamp);\n if (elapsedTime > 0) this.performance.face = elapsedTime;\n }\n\n // run body: can be posenet, blazepose, efficientpose, movenet\n this.analyze('Start Body:');\n if (this.config.async) {\n if (this.config.body.modelPath.includes('posenet')) bodyRes = this.config.body.enabled ? posenet.predict(process.tensor, this.config) : [];\n else if (this.config.body.modelPath.includes('blazepose')) bodyRes = this.config.body.enabled ? blazepose.predict(process.tensor, this.config) : [];\n else if (this.config.body.modelPath.includes('efficientpose')) bodyRes = this.config.body.enabled ? efficientpose.predict(process.tensor, this.config) : [];\n else if (this.config.body.modelPath.includes('movenet')) bodyRes = this.config.body.enabled ? movenet.predict(process.tensor, this.config) : [];\n if (this.performance.body) delete this.performance.body;\n } else {\n this.state = 'run:body';\n timeStamp = now();\n if (this.config.body.modelPath.includes('posenet')) bodyRes = this.config.body.enabled ? await posenet.predict(process.tensor, this.config) : [];\n else if (this.config.body.modelPath.includes('blazepose')) bodyRes = this.config.body.enabled ? await blazepose.predict(process.tensor, this.config) : [];\n else if (this.config.body.modelPath.includes('efficientpose')) bodyRes = this.config.body.enabled ? await efficientpose.predict(process.tensor, this.config) : [];\n else if (this.config.body.modelPath.includes('movenet')) bodyRes = this.config.body.enabled ? await movenet.predict(process.tensor, this.config) : [];\n elapsedTime = Math.trunc(now() - timeStamp);\n if (elapsedTime > 0) this.performance.body = elapsedTime;\n }\n this.analyze('End Body:');\n\n // run handpose\n this.analyze('Start Hand:');\n if (this.config.async) {\n handRes = this.config.hand.enabled ? handpose.predict(process.tensor, this.config) : [];\n if (this.performance.hand) delete this.performance.hand;\n } else {\n this.state = 'run:hand';\n timeStamp = now();\n handRes = this.config.hand.enabled ? await handpose.predict(process.tensor, this.config) : [];\n elapsedTime = Math.trunc(now() - timeStamp);\n if (elapsedTime > 0) this.performance.hand = elapsedTime;\n }\n this.analyze('End Hand:');\n\n // run nanodet\n this.analyze('Start Object:');\n if (this.config.async) {\n if (this.config.object.modelPath.includes('nanodet')) objectRes = this.config.object.enabled ? nanodet.predict(process.tensor, this.config) : [];\n else if (this.config.object.modelPath.includes('centernet')) objectRes = this.config.object.enabled ? centernet.predict(process.tensor, this.config) : [];\n if (this.performance.object) delete this.performance.object;\n } else {\n this.state = 'run:object';\n timeStamp = now();\n if (this.config.object.modelPath.includes('nanodet')) objectRes = this.config.object.enabled ? await nanodet.predict(process.tensor, this.config) : [];\n else if (this.config.object.modelPath.includes('centernet')) objectRes = this.config.object.enabled ? await centernet.predict(process.tensor, this.config) : [];\n elapsedTime = Math.trunc(now() - timeStamp);\n if (elapsedTime > 0) this.performance.object = elapsedTime;\n }\n this.analyze('End Object:');\n\n // if async wait for results\n if (this.config.async) [faceRes, bodyRes, handRes, objectRes] = await Promise.all([faceRes, bodyRes, handRes, objectRes]);\n\n // run gesture analysis last\n let gestureRes: Gesture[] = [];\n if (this.config.gesture.enabled) {\n timeStamp = now();\n gestureRes = [...gesture.face(faceRes), ...gesture.body(bodyRes), ...gesture.hand(handRes), ...gesture.iris(faceRes)];\n if (!this.config.async) this.performance.gesture = Math.trunc(now() - timeStamp);\n else if (this.performance.gesture) delete this.performance.gesture;\n }\n\n this.performance.total = Math.trunc(now() - timeStart);\n this.state = 'idle';\n this.result = {\n face: faceRes,\n body: bodyRes,\n hand: handRes,\n gesture: gestureRes,\n object: objectRes,\n performance: this.performance,\n canvas: process.canvas,\n timestamp: Date.now(),\n get persons() { return persons.join(faceRes, bodyRes, handRes, gestureRes, process?.tensor?.shape); },\n };\n\n // finally dispose input tensor\n tf.dispose(process.tensor);\n\n // log('Result:', result);\n resolve(this.result);\n });\n }\n\n /** @hidden */\n #warmupBitmap = async () => {\n const b64toBlob = (base64, type = 'application/octet-stream') => fetch(`data:${type};base64,${base64}`).then((res) => res.blob());\n let blob;\n let res;\n switch (this.config.warmup) {\n case 'face': blob = await b64toBlob(sample.face); break;\n case 'full': blob = await b64toBlob(sample.body); break;\n default: blob = null;\n }\n if (blob) {\n const bitmap = await createImageBitmap(blob);\n res = await this.detect(bitmap, this.config);\n bitmap.close();\n }\n return res;\n }\n\n /** @hidden */\n #warmupCanvas = async () => new Promise((resolve) => {\n let src;\n let size = 0;\n switch (this.config.warmup) {\n case 'face':\n size = 256;\n src = 'data:image/jpeg;base64,' + sample.face;\n break;\n case 'full':\n case 'body':\n size = 1200;\n src = 'data:image/jpeg;base64,' + sample.body;\n break;\n default:\n src = null;\n }\n // src = encodeURI('../assets/human-sample-upper.jpg');\n const img = new Image();\n img.onload = async () => {\n const canvas = (typeof OffscreenCanvas !== 'undefined') ? new OffscreenCanvas(size, size) : document.createElement('canvas');\n canvas.width = img.naturalWidth;\n canvas.height = img.naturalHeight;\n const ctx = canvas.getContext('2d');\n ctx?.drawImage(img, 0, 0);\n // const data = ctx?.getImageData(0, 0, canvas.height, canvas.width);\n const res = await this.detect(canvas, this.config);\n resolve(res);\n };\n if (src) img.src = src;\n else resolve(null);\n });\n\n /** @hidden */\n #warmupNode = async () => {\n const atob = (str) => Buffer.from(str, 'base64');\n let img;\n if (this.config.warmup === 'face') img = atob(sample.face);\n if (this.config.warmup === 'body' || this.config.warmup === 'full') img = atob(sample.body);\n if (!img) return null;\n let res;\n if (typeof tf['node'] !== 'undefined') {\n const data = tf['node'].decodeJpeg(img);\n const expanded = data.expandDims(0);\n this.tf.dispose(data);\n // log('Input:', expanded);\n res = await this.detect(expanded, this.config);\n this.tf.dispose(expanded);\n } else {\n if (this.config.debug) log('Warmup tfjs-node not loaded');\n /*\n const input = await canvasJS.loadImage(img);\n const canvas = canvasJS.createCanvas(input.width, input.height);\n const ctx = canvas.getContext('2d');\n ctx.drawImage(img, 0, 0, input.width, input.height);\n res = await this.detect(input, this.config);\n */\n }\n return res;\n }\n\n /** Warmup metho pre-initializes all models for faster inference\n * - can take significant time on startup\n * - only used for `webgl` and `humangl` backends\n * @param userConfig?: Config\n */\n async warmup(userConfig?: Config | Record): Promise {\n const t0 = now();\n if (userConfig) this.config = mergeDeep(this.config, userConfig) as Config;\n if (!this.config.warmup || this.config.warmup === 'none') return { error: 'null' };\n let res;\n if (typeof createImageBitmap === 'function') res = await this.#warmupBitmap();\n else if (typeof Image !== 'undefined') res = await this.#warmupCanvas();\n else res = await this.#warmupNode();\n const t1 = now();\n if (this.config.debug) log('Warmup', this.config.warmup, Math.round(t1 - t0), 'ms', res);\n return res;\n }\n}\n\n/**\n * Class Human is also available as default export\n */\nexport { Human as default };\n"], + "mappings": ";;;;;;stBAKO,WAAc,EAAgB,EAAsB,CACzD,GAAM,GAAY,EAAO,SAAS,KAAO,GAAK,IAExC,EAAO,AADI,EAAK,WAAW,MAAQ,EAAK,WAAW,MAAQ,EAAK,WAAW,UAAY,EAAK,WAAW,WAAa,EAAK,WAAW,SAClH,GAAG,IAAS,GAAG,IAAS,IAAY,IAC5D,GAAI,CAAC,EAAK,oBAAoB,SAAS,SAAU,KAAM,IAAI,OAAM,2BAA2B,yBAC5F,MAAO,GAIF,cAAgB,EAAW,CAChC,GAAM,GAAK,GAAI,MACT,EAAK,GAAG,EAAG,WAAW,WAAW,SAAS,EAAG,QAAQ,EAAG,aAAa,WAAW,SAAS,EAAG,QAAQ,EAAG,aAAa,WAAW,SAAS,EAAG,QAAQ,EAAG,kBAAkB,WAAW,SAAS,EAAG,OAErM,AAAI,GAAK,QAAQ,IAAI,EAAI,SAAU,GAAG,GAIjC,GAAM,GAAM,IACb,MAAO,cAAgB,YAAoB,YAAY,MACpD,SAAU,QAAO,QAAQ,OAAO,UAAY,IAAO,KAAM,YAI3D,cAAsB,EAAS,CACpC,GAAM,GAAW,AAAC,GAAQ,GAAO,MAAO,IAAQ,SAChD,MAAO,GAAQ,OAAO,CAAC,EAAM,IAC3B,QAAO,KAAK,GAAO,IAAI,QAAQ,AAAC,GAAQ,CACtC,GAAM,GAAO,EAAK,GACZ,EAAO,EAAI,GACjB,AAAI,MAAM,QAAQ,IAAS,MAAM,QAAQ,GAAO,EAAK,GA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,GAAK,GAAU,GAAG,AAAQ,GAAK,GAAU,GAAG,AAAQ,GAAK,IAC5G,AAAK,KAAK,OAAO,MACR,KAAK,YAAY,SAAS,MAAO,MAAK,YAAY,QADnC,KAAK,YAAY,QAAU,KAAK,MAAM,IAAQ,IAIxE,KAAK,YAAY,MAAQ,KAAK,MAAM,IAAQ,GAC5C,KAAK,MAAQ,OACb,KAAK,OAAS,CACZ,KAAM,EACN,KAAM,EACN,KAAM,EACN,QAAS,EACT,OAAQ,EACR,YAAa,KAAK,YAClB,OAAQ,EAAQ,OAChB,UAAW,KAAK,SACZ,UAAU,CA/lBtB,MA+lBwB,MAAO,AAAQ,IAAK,EAAS,EAAS,EAAS,EAAY,oBAAS,SAAT,cAAiB,SAI9F,AAAG,UAAQ,EAAQ,QAGnB,EAAQ,KAAK,eAwFX,QAAO,EAA4E,CACvF,GAAM,GAAK,IAEX,GADI,GAAY,MAAK,OAAS,EAAU,KAAK,OAAQ,IACjD,CAAC,KAAK,OAAO,QAAU,KAAK,OAAO,SAAW,OAAQ,MAAO,CAAE,MAAO,QAC1E,GAAI,GACJ,AAAI,MAAO,oBAAsB,WAAY,EAAM,KAAM,QAAK,IAAL,WACpD,AAAI,MAAO,QAAU,YAAa,EAAM,KAAM,QAAK,IAAL,WAC9C,EAAM,KAAM,QAAK,IAAL,WACjB,GAAM,GAAK,IACX,MAAI,MAAK,OAAO,OAAO,EAAI,SAAU,KAAK,OAAO,OAAQ,KAAK,MAAM,EAAK,GAAK,KAAM,GAC7E,IArkBT,eACA,eACA,eACA,eACA,eACA,eA6DA,eAoIA,eAuEA,eA2NA,eAkBA,eAiCA", "names": [] } diff --git a/dist/human.esm.js b/dist/human.esm.js index 7b4391b4..ec0c8494 100644 --- a/dist/human.esm.js +++ b/dist/human.esm.js @@ -4,79 +4,79 @@ homepage: author: ' */ -var Q$=Object.defineProperty;var Jg=e=>{if(typeof require!="undefined")return require(e);throw new Error('Dynamic require of "'+e+'" is not supported')};var $3=(e,t)=>{for(var n in t)Q$(e,n,{get:t[n],enumerable:!0})};var R3=(e,t,n)=>{if(!t.has(e))throw TypeError("Cannot "+n)};var Fn=(e,t,n)=>(R3(e,t,"read from private field"),n?n.call(e):t.get(e)),wa=(e,t,n)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,n)},Ja=(e,t,n,a)=>(R3(e,t,"write to private field"),a?a.call(e,n):t.set(e,n),n);function Mt(e,t){let n=e.endsWith("/")?"":"/",r=t.startsWith(".")||t.startsWith("/")||t.startsWith("http:")||t.startsWith("https:")||t.startsWith("file:")?`${t}`:`${e}${n}${t}`;if(!r.toLocaleLowerCase().includes(".json"))throw new Error(`Human: ModelPath Error: ${r} Expecting JSON file`);return r}function ge(...e){let t=new Date,n=`${t.getHours().toString().padStart(2,"0")}:${t.getMinutes().toString().padStart(2,"0")}:${t.getSeconds().toString().padStart(2,"0")}.${t.getMilliseconds().toString().padStart(3,"0")}`;e&&console.log(n,"Human:",...e)}var st=()=>typeof performance!="undefined"?performance.now():parseInt((Number(process.hrtime.bigint())/1e3/1e3).toString());function ia(...e){let t=n=>n&&typeof n=="object";return e.reduce((n,a)=>(Object.keys(a||{}).forEach(r=>{let s=n[r],i=a[r];Array.isArray(s)&&Array.isArray(i)?n[r]=s.concat(...i):t(s)&&t(i)?n[r]=ia(s,i):n[r]=i}),n),{})}var F3={backend:"webgl",modelBasePath:"../models/",wasmPath:"../node_modules/@tensorflow/tfjs-backend-wasm/dist/",debug:!0,async:!0,warmup:"full",cacheSensitivity:.75,skipFrame:!1,filter:{enabled:!0,width:0,height:0,flip:!1,return:!0,brightness:0,contrast:0,sharpness:0,blur:0,saturation:0,hue:0,negative:!1,sepia:!1,vintage:!1,kodachrome:!1,technicolor:!1,polaroid:!1,pixelate:0},gesture:{enabled:!0},face:{enabled:!0,detector:{modelPath:"blazeface.json",rotation:!0,maxDetected:15,skipFrames:15,minConfidence:.2,iouThreshold:.1,return:!1},mesh:{enabled:!0,modelPath:"facemesh.json"},iris:{enabled:!0,modelPath:"iris.json"},description:{enabled:!0,modelPath:"faceres.json",skipFrames:11,minConfidence:.1},emotion:{enabled:!0,minConfidence:.1,skipFrames:17,modelPath:"emotion.json"}},body:{enabled:!0,modelPath:"movenet-lightning.json",maxDetected:1,minConfidence:.2,skipFrames:1},hand:{enabled:!0,rotation:!0,skipFrames:18,minConfidence:.1,iouThreshold:.1,maxDetected:2,landmarks:!0,detector:{modelPath:"handdetect.json"},skeleton:{modelPath:"handskeleton.json"}},object:{enabled:!1,modelPath:"mb3-centernet.json",minConfidence:.2,iouThreshold:.4,maxDetected:10,skipFrames:19},segmentation:{enabled:!1,modelPath:"selfie.json"}};function O3(){let e,t;if(typeof navigator!="undefined"){let n=navigator.userAgent.match(/\(([^()]+)\)/g);if(n&&n[0]){let a=n[0].match(/\(([^()]+)\)/g);e=a?a[0].replace(/\(|\)/g,""):"",t=navigator.userAgent.replace(n[0],""),e[1]&&(t=t.replace(n[1],"")),t=t.replace(/ /g," ")}}else typeof process!="undefined"&&(e=`${process.platform} ${process.arch}`,t=`NodeJS ${process.version}`);return{platform:e,agent:t}}var bp={};$3(bp,{Abs:()=>Q3,Acos:()=>ev,Acosh:()=>tv,AdadeltaOptimizer:()=>Oc,AdagradOptimizer:()=>Dc,AdamOptimizer:()=>_c,AdamaxOptimizer:()=>zc,Add:()=>iy,AddN:()=>nv,All:()=>av,Any:()=>rv,ArgMax:()=>sv,ArgMin:()=>iv,Asin:()=>ov,Asinh:()=>lv,Atan:()=>uv,Atan2:()=>hv,Atanh:()=>dv,AvgPool:()=>pv,AvgPool3D:()=>cv,AvgPool3DGrad:()=>rF,AvgPoolGrad:()=>aF,BackendWasm:()=>uM,BatchMatMul:()=>fv,BatchToSpaceND:()=>mv,Bincount:()=>gv,BroadcastTo:()=>sF,Callback:()=>PS,CallbackList:()=>NI,Cast:()=>oy,Ceil:()=>yv,ClipByValue:()=>Av,Complex:()=>xv,ComplexAbs:()=>bv,Concat:()=>vv,Conv2D:()=>wv,Conv2DBackpropFilter:()=>kv,Conv2DBackpropInput:()=>Iv,Conv3D:()=>Sv,Conv3DBackpropFilterV2:()=>iF,Conv3DBackpropInputV2:()=>Nv,Cos:()=>Tv,Cosh:()=>Ev,CropAndResize:()=>Mv,Cumsum:()=>Cv,CustomCallback:()=>EI,DataStorage:()=>_R,DenseBincount:()=>$v,DepthToSpace:()=>Rv,DepthwiseConv2dNative:()=>Fv,DepthwiseConv2dNativeBackpropFilter:()=>Ov,DepthwiseConv2dNativeBackpropInput:()=>Dv,Diag:()=>_v,Dilation2D:()=>zv,Dilation2DBackpropFilter:()=>lF,Dilation2DBackpropInput:()=>oF,ENV:()=>ka,EarlyStopping:()=>WS,Einsum:()=>Lv,Elu:()=>Wv,EluGrad:()=>uF,Environment:()=>Y3,Equal:()=>Vv,Erf:()=>Bv,Exp:()=>Uv,ExpandDims:()=>jv,Expm1:()=>Hv,FFT:()=>Gv,Fill:()=>qv,FlipLeftRight:()=>Kv,Floor:()=>Xv,FloorDiv:()=>Zv,FromPixels:()=>dy,FusedBatchNorm:()=>Yv,FusedConv2D:()=>py,FusedDepthwiseConv2D:()=>cy,GPGPUContext:()=>W0,GatherNd:()=>Qv,GatherV2:()=>Jv,GraphModel:()=>A9,Greater:()=>ew,GreaterEqual:()=>tw,History:()=>TI,IFFT:()=>nw,Identity:()=>ly,Imag:()=>aw,InputSpec:()=>tn,IsFinite:()=>rw,IsInf:()=>sw,IsNan:()=>iw,KernelBackend:()=>L3,LRN:()=>gw,LRNGrad:()=>hF,LayerVariable:()=>vI,LayersModel:()=>ps,LeakyRelu:()=>ow,Less:()=>lw,LessEqual:()=>uw,LinSpace:()=>dw,Log:()=>hw,Log1p:()=>pw,LogSoftmax:()=>dF,LogicalAnd:()=>cw,LogicalNot:()=>fw,LogicalOr:()=>mw,MathBackendCPU:()=>C5,MathBackendWebGL:()=>hp,Max:()=>yw,MaxPool:()=>xw,MaxPool3D:()=>bw,MaxPool3DGrad:()=>cF,MaxPoolGrad:()=>pF,MaxPoolWithArgmax:()=>vw,Maximum:()=>Aw,Mean:()=>ww,Min:()=>kw,Minimum:()=>Iw,MirrorPad:()=>Sw,Mod:()=>Nw,MomentumOptimizer:()=>Pc,Multinomial:()=>Tw,Multiply:()=>Ew,Neg:()=>Cw,NonMaxSuppressionV3:()=>$w,NonMaxSuppressionV4:()=>Rw,NonMaxSuppressionV5:()=>Fw,NotEqual:()=>Mw,OP_SCOPE_SUFFIX:()=>Z7,OneHot:()=>Dw,OnesLike:()=>Ow,Optimizer:()=>Rs,Pack:()=>_w,PadV2:()=>zw,Pool:()=>fF,Pow:()=>Pw,Prelu:()=>Lw,Prod:()=>Ww,RMSPropOptimizer:()=>Lc,RNN:()=>cs,Range:()=>Bw,Rank:()=>Ay,Real:()=>Vw,RealDiv:()=>Pv,Reciprocal:()=>Uw,Reduction:()=>_n,Relu:()=>jw,Relu6:()=>Kw,Reshape:()=>Hw,ResizeBilinear:()=>qw,ResizeBilinearGrad:()=>gF,ResizeNearestNeighbor:()=>Gw,ResizeNearestNeighborGrad:()=>mF,Reverse:()=>Xw,RotateWithOffset:()=>F7,Round:()=>Zw,Rsqrt:()=>Yw,SGDOptimizer:()=>md,ScatterNd:()=>Jw,Select:()=>Qw,Selu:()=>e7,Sequential:()=>c0,Sigmoid:()=>s7,Sign:()=>r7,Sin:()=>n7,Sinh:()=>a7,Slice:()=>t7,Softmax:()=>h7,Softplus:()=>i7,SpaceToBatchND:()=>u7,SparseFillEmptyRows:()=>p7,SparseReshape:()=>c7,SparseSegmentMean:()=>f7,SparseSegmentSum:()=>m7,SparseToDense:()=>g7,SplitV:()=>d7,Sqrt:()=>o7,Square:()=>yF,SquaredDifference:()=>y7,Step:()=>R7,StridedSlice:()=>A7,StringNGrams:()=>x7,StringSplit:()=>b7,StringToHashBucketFast:()=>v7,Sub:()=>w7,Sum:()=>l7,SymbolicTensor:()=>pr,Tan:()=>k7,Tanh:()=>I7,Tensor:()=>St,TensorBuffer:()=>uc,Tile:()=>uy,TopK:()=>S7,Transform:()=>N7,Transpose:()=>T7,Unique:()=>E7,Unpack:()=>C7,UnsortedSegmentSum:()=>M7,Variable:()=>ad,ZerosLike:()=>$7,_FusedMatMul:()=>hy,abs:()=>Sa,acos:()=>zD,acosh:()=>LD,add:()=>De,addN:()=>Ky,all:()=>VD,any:()=>jD,argMax:()=>Xy,argMin:()=>qD,asin:()=>XD,asinh:()=>YD,atan:()=>QD,atan2:()=>t_,atanh:()=>a_,avgPool:()=>Wk,avgPool3d:()=>c_,backend:()=>CD,backend_util:()=>C6,basicLSTMCell:()=>x_,batchNorm:()=>Ac,batchNorm2d:()=>I_,batchNorm3d:()=>N_,batchNorm4d:()=>E_,batchToSpaceND:()=>Bk,bincount:()=>Vk,booleanMaskAsync:()=>zW,broadcastTo:()=>xc,browser:()=>Ua,buffer:()=>Zr,callbacks:()=>$ae,cast:()=>zt,ceil:()=>R_,clipByValue:()=>O_,clone:()=>Yr,complex:()=>mi,concat:()=>sn,concat1d:()=>__,concat2d:()=>ld,concat3d:()=>L_,concat4d:()=>B_,constraints:()=>eI,conv1d:()=>j_,conv2d:()=>bc,conv2dTranspose:()=>q_,conv3d:()=>X_,conv3dTranspose:()=>Q_,copyRegisteredKernels:()=>vF,cos:()=>tz,cosh:()=>az,cosineWindow:()=>u1,cumsum:()=>sz,customGrad:()=>Nr,data:()=>x9,denseBincount:()=>oz,deprecationWarn:()=>Ok,depthToSpace:()=>uz,depthwiseConv2d:()=>Qy,deregisterOp:()=>Fae,device_util:()=>G7,diag:()=>pz,dilation2d:()=>fz,disableDeprecationWarnings:()=>AD,dispose:()=>Ve,disposeVariables:()=>xD,div:()=>Qe,divNoNan:()=>bz,dot:()=>wz,dropout:()=>ZW,einsum:()=>Iz,elu:()=>Gk,enableDebugMode:()=>yD,enableProdMode:()=>gD,enclosingPowerOfTwo:()=>b6,engine:()=>bD,env:()=>ht,equal:()=>Hk,erf:()=>Tz,exp:()=>vi,expandDims:()=>Qr,expm1:()=>$z,eye:()=>qk,fft:()=>i1,fill:()=>wc,findBackend:()=>Gy,findBackendFactory:()=>ED,floor:()=>Kk,floorDiv:()=>_k,forceHalfFloat:()=>bE,fused:()=>v6,gather:()=>Xk,gatherND:()=>qW,gather_util:()=>mk,getBackend:()=>ND,getGradient:()=>fy,getKernel:()=>ac,getKernelsForBackend:()=>Lo,gpgpu_util:()=>vT,grad:()=>eP,grads:()=>tP,greater:()=>kc,greaterEqual:()=>Zk,ifft:()=>Cc,imag:()=>e1,image:()=>Ye,inTopKAsync:()=>JW,initializers:()=>oI,input:()=>YI,io:()=>ok,irfft:()=>f6,isFinite:()=>Wz,isInf:()=>Vz,isNaN:()=>jz,keep:()=>Dk,kernel_impls:()=>F6,layers:()=>AI,leakyRelu:()=>Yk,less:()=>qz,lessEqual:()=>t1,linalg:()=>zV,linspace:()=>Xz,loadGraphModel:()=>Et,loadLayersModel:()=>Vte,localResponseNormalization:()=>Yz,log:()=>ud,log1p:()=>Jk,logSigmoid:()=>oP,logSoftmax:()=>pP,logSumExp:()=>n6,logicalAnd:()=>Sc,logicalNot:()=>a6,logicalOr:()=>r6,logicalXor:()=>kP,losses:()=>PV,matMul:()=>yt,math:()=>ck,max:()=>$s,maxPool:()=>s6,maxPool3d:()=>NP,maxPoolWithArgmax:()=>EP,maximum:()=>i6,mean:()=>Nc,memory:()=>vD,meshgrid:()=>$P,metrics:()=>DS,min:()=>a1,minimum:()=>o6,mirrorPad:()=>DP,mod:()=>zP,model:()=>Wte,models:()=>_S,moments:()=>WP,movingAverage:()=>WW,mul:()=>fe,multiRNNCell:()=>VP,multinomial:()=>jP,neg:()=>Ms,nextFrame:()=>UV,norm:()=>l1,notEqual:()=>l6,oneHot:()=>Ly,ones:()=>wi,onesLike:()=>qP,op:()=>U,outerProduct:()=>XP,pad:()=>hd,pad1d:()=>JP,pad2d:()=>eL,pad3d:()=>nL,pad4d:()=>rL,pool:()=>uL,pow:()=>pd,prelu:()=>d6,print:()=>ik,prod:()=>cL,profile:()=>wD,rand:()=>mL,randomGamma:()=>xL,randomNormal:()=>vL,randomUniform:()=>h6,range:()=>cd,ready:()=>SD,real:()=>Tc,reciprocal:()=>SL,registerBackend:()=>qy,registerCallbackConstructor:()=>Ute,registerGradient:()=>AF,registerKernel:()=>rc,registerOp:()=>Rae,regularizers:()=>zS,relu:()=>Ec,relu6:()=>p6,removeBackend:()=>TD,reshape:()=>le,reverse:()=>ki,reverse1d:()=>ML,reverse2d:()=>RL,reverse3d:()=>OL,reverse4d:()=>_L,rfft:()=>o1,round:()=>c6,rsqrt:()=>LL,scalar:()=>dt,scatterND:()=>VW,scatter_util:()=>yk,selu:()=>BL,separableConv2d:()=>UL,sequential:()=>Bte,serialization:()=>Ck,setBackend:()=>ID,setPlatform:()=>MD,setWasmPath:()=>Tve,setWasmPaths:()=>Eve,setWebGLContext:()=>F0,setdiff1dAsync:()=>HL,shared:()=>U9,sigmoid:()=>Sr,sign:()=>qL,signal:()=>_V,sin:()=>XL,sinh:()=>YL,slice:()=>Ze,slice1d:()=>QL,slice2d:()=>tW,slice3d:()=>aW,slice4d:()=>sW,slice_util:()=>Vy,softmax:()=>oW,softplus:()=>e6,spaceToBatchND:()=>u6,sparse:()=>LV,sparseToDense:()=>HW,spectral:()=>DV,split:()=>es,sqrt:()=>ts,square:()=>tr,squaredDifference:()=>m6,squeeze:()=>Yn,stack:()=>Ii,step:()=>g6,stridedSlice:()=>xW,string:()=>WV,sub:()=>je,sum:()=>$t,sumOutType:()=>UF,tan:()=>vW,tanh:()=>Jy,tensor:()=>er,tensor1d:()=>oa,tensor2d:()=>ns,tensor3d:()=>mc,tensor4d:()=>wW,tensor5d:()=>kW,tensor6d:()=>IW,tensor_util:()=>B7,test_util:()=>$k,tidy:()=>Ue,tile:()=>vc,time:()=>kD,topk:()=>NW,train:()=>BV,transpose:()=>fc,truncatedNormal:()=>EW,unique:()=>MW,unregisterGradient:()=>bF,unregisterKernel:()=>xF,unsortedSegmentSum:()=>RW,unstack:()=>fd,upcastType:()=>dc,util:()=>O7,valueAndGrad:()=>nP,valueAndGrads:()=>aP,variable:()=>OW,variableGrads:()=>Qk,version:()=>$ve,version_converter:()=>_re,version_core:()=>mD,version_cpu:()=>yie,version_layers:()=>Q2,version_wasm:()=>Cve,version_webgl:()=>cfe,webgl:()=>ffe,webgl_util:()=>XN,where:()=>Ho,whereAsync:()=>A6,zeros:()=>Go,zerosLike:()=>Na});var eR=Object.create,Qp=Object.defineProperty,tR=Object.getOwnPropertyDescriptor,nR=Object.getOwnPropertyNames,aR=Object.getPrototypeOf,rR=Object.prototype.hasOwnProperty,sR=e=>Qp(e,"__esModule",{value:!0}),di=e=>{if(typeof Jg!="undefined")return Jg(e);throw new Error('Dynamic require of "'+e+'" is not supported')},_t=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),$e=(e,t)=>{for(var n in t)Qp(e,n,{get:t[n],enumerable:!0})},iR=(e,t,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of nR(t))!rR.call(e,a)&&a!=="default"&&Qp(e,a,{get:()=>t[a],enumerable:!(n=tR(t,a))||n.enumerable});return e},qr=e=>iR(sR(Qp(e!=null?eR(aR(e)):{},"default",e&&e.__esModule&&"default"in e?{get:()=>e.default,enumerable:!0}:{value:e,enumerable:!0})),e),D3=_t((e,t)=>{t.exports=a;var n=null;try{n=new WebAssembly.Instance(new WebAssembly.Module(new Uint8Array([0,97,115,109,1,0,0,0,1,13,2,96,0,1,127,96,4,127,127,127,127,1,127,3,7,6,0,1,1,1,1,1,6,6,1,127,1,65,0,11,7,50,6,3,109,117,108,0,1,5,100,105,118,95,115,0,2,5,100,105,118,95,117,0,3,5,114,101,109,95,115,0,4,5,114,101,109,95,117,0,5,8,103,101,116,95,104,105,103,104,0,0,10,191,1,6,4,0,35,0,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,126,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,127,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,128,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,129,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,130,34,4,66,32,135,167,36,0,32,4,167,11])),{}).exports}catch(S){}function a(S,D,_){this.low=S|0,this.high=D|0,this.unsigned=!!_}a.prototype.__isLong__,Object.defineProperty(a.prototype,"__isLong__",{value:!0});function r(S){return(S&&S.__isLong__)===!0}a.isLong=r;var s={},i={};function o(S,D){var _,W,X;return D?(S>>>=0,(X=0<=S&&S<256)&&(W=i[S],W)?W:(_=u(S,(S|0)<0?-1:0,!0),X&&(i[S]=_),_)):(S|=0,(X=-128<=S&&S<128)&&(W=s[S],W)?W:(_=u(S,S<0?-1:0,!1),X&&(s[S]=_),_))}a.fromInt=o;function l(S,D){if(isNaN(S))return D?v:x;if(D){if(S<0)return v;if(S>=g)return C}else{if(S<=-y)return z;if(S+1>=y)return T}return S<0?l(-S,D).neg():u(S%f|0,S/f|0,D)}a.fromNumber=l;function u(S,D,_){return new a(S,D,_)}a.fromBits=u;var d=Math.pow;function h(S,D,_){if(S.length===0)throw Error("empty string");if(S==="NaN"||S==="Infinity"||S==="+Infinity"||S==="-Infinity")return x;if(typeof D=="number"?(_=D,D=!1):D=!!D,_=_||10,_<2||36<_)throw RangeError("radix");var W;if((W=S.indexOf("-"))>0)throw Error("interior hyphen");if(W===0)return h(S.substring(1),D,_).neg();for(var X=l(d(_,8)),q=x,Q=0;Q>>0:this.low},$.toNumber=function(){return this.unsigned?(this.high>>>0)*f+(this.low>>>0):this.high*f+(this.low>>>0)},$.toString=function(S){if(S=S||10,S<2||36>>0,ae=ie.toString(S);if(q=ee,q.isZero())return ae+Q;for(;ae.length<6;)ae="0"+ae;Q=""+ae+Q}},$.getHighBits=function(){return this.high},$.getHighBitsUnsigned=function(){return this.high>>>0},$.getLowBits=function(){return this.low},$.getLowBitsUnsigned=function(){return this.low>>>0},$.getNumBitsAbs=function(){if(this.isNegative())return this.eq(z)?64:this.neg().getNumBitsAbs();for(var S=this.high!=0?this.high:this.low,D=31;D>0&&(S&1<=0},$.isOdd=function(){return(this.low&1)==1},$.isEven=function(){return(this.low&1)==0},$.equals=function(S){return r(S)||(S=p(S)),this.unsigned!==S.unsigned&&this.high>>>31==1&&S.high>>>31==1?!1:this.high===S.high&&this.low===S.low},$.eq=$.equals,$.notEquals=function(S){return!this.eq(S)},$.neq=$.notEquals,$.ne=$.notEquals,$.lessThan=function(S){return this.comp(S)<0},$.lt=$.lessThan,$.lessThanOrEqual=function(S){return this.comp(S)<=0},$.lte=$.lessThanOrEqual,$.le=$.lessThanOrEqual,$.greaterThan=function(S){return this.comp(S)>0},$.gt=$.greaterThan,$.greaterThanOrEqual=function(S){return this.comp(S)>=0},$.gte=$.greaterThanOrEqual,$.ge=$.greaterThanOrEqual,$.compare=function(S){if(r(S)||(S=p(S)),this.eq(S))return 0;var D=this.isNegative(),_=S.isNegative();return D&&!_?-1:!D&&_?1:this.unsigned?S.high>>>0>this.high>>>0||S.high===this.high&&S.low>>>0>this.low>>>0?-1:1:this.sub(S).isNegative()?-1:1},$.comp=$.compare,$.negate=function(){return!this.unsigned&&this.eq(z)?z:this.not().add(b)},$.neg=$.negate,$.add=function(S){r(S)||(S=p(S));var D=this.high>>>16,_=this.high&65535,W=this.low>>>16,X=this.low&65535,q=S.high>>>16,Q=S.high&65535,ee=S.low>>>16,ie=S.low&65535,ae=0,de=0,te=0,ce=0;return ce+=X+ie,te+=ce>>>16,ce&=65535,te+=W+ee,de+=te>>>16,te&=65535,de+=_+Q,ae+=de>>>16,de&=65535,ae+=D+q,ae&=65535,u(te<<16|ce,ae<<16|de,this.unsigned)},$.subtract=function(S){return r(S)||(S=p(S)),this.add(S.neg())},$.sub=$.subtract,$.multiply=function(S){if(this.isZero())return x;if(r(S)||(S=p(S)),n){var D=n.mul(this.low,this.high,S.low,S.high);return u(D,n.get_high(),this.unsigned)}if(S.isZero())return x;if(this.eq(z))return S.isOdd()?z:x;if(S.eq(z))return this.isOdd()?z:x;if(this.isNegative())return S.isNegative()?this.neg().mul(S.neg()):this.neg().mul(S).neg();if(S.isNegative())return this.mul(S.neg()).neg();if(this.lt(A)&&S.lt(A))return l(this.toNumber()*S.toNumber(),this.unsigned);var _=this.high>>>16,W=this.high&65535,X=this.low>>>16,q=this.low&65535,Q=S.high>>>16,ee=S.high&65535,ie=S.low>>>16,ae=S.low&65535,de=0,te=0,ce=0,he=0;return he+=q*ae,ce+=he>>>16,he&=65535,ce+=X*ae,te+=ce>>>16,ce&=65535,ce+=q*ie,te+=ce>>>16,ce&=65535,te+=W*ae,de+=te>>>16,te&=65535,te+=X*ie,de+=te>>>16,te&=65535,te+=q*ee,de+=te>>>16,te&=65535,de+=_*ae+W*ie+X*ee+q*Q,de&=65535,u(ce<<16|he,de<<16|te,this.unsigned)},$.mul=$.multiply,$.divide=function(S){if(r(S)||(S=p(S)),S.isZero())throw Error("division by zero");if(n){if(!this.unsigned&&this.high===-2147483648&&S.low===-1&&S.high===-1)return this;var D=(this.unsigned?n.div_u:n.div_s)(this.low,this.high,S.low,S.high);return u(D,n.get_high(),this.unsigned)}if(this.isZero())return this.unsigned?v:x;var _,W,X;if(this.unsigned){if(S.unsigned||(S=S.toUnsigned()),S.gt(this))return v;if(S.gt(this.shru(1)))return w;X=v}else{if(this.eq(z)){if(S.eq(b)||S.eq(I))return z;if(S.eq(z))return b;var q=this.shr(1);return _=q.div(S).shl(1),_.eq(x)?S.isNegative()?b:I:(W=this.sub(S.mul(_)),X=_.add(W.div(S)),X)}else if(S.eq(z))return this.unsigned?v:x;if(this.isNegative())return S.isNegative()?this.neg().div(S.neg()):this.neg().div(S).neg();if(S.isNegative())return this.div(S.neg()).neg();X=x}for(W=this;W.gte(S);){_=Math.max(1,Math.floor(W.toNumber()/S.toNumber()));for(var Q=Math.ceil(Math.log(_)/Math.LN2),ee=Q<=48?1:d(2,Q-48),ie=l(_),ae=ie.mul(S);ae.isNegative()||ae.gt(W);)_-=ee,ie=l(_,this.unsigned),ae=ie.mul(S);ie.isZero()&&(ie=b),X=X.add(ie),W=W.sub(ae)}return X},$.div=$.divide,$.modulo=function(S){if(r(S)||(S=p(S)),n){var D=(this.unsigned?n.rem_u:n.rem_s)(this.low,this.high,S.low,S.high);return u(D,n.get_high(),this.unsigned)}return this.sub(this.div(S).mul(S))},$.mod=$.modulo,$.rem=$.modulo,$.not=function(){return u(~this.low,~this.high,this.unsigned)},$.and=function(S){return r(S)||(S=p(S)),u(this.low&S.low,this.high&S.high,this.unsigned)},$.or=function(S){return r(S)||(S=p(S)),u(this.low|S.low,this.high|S.high,this.unsigned)},$.xor=function(S){return r(S)||(S=p(S)),u(this.low^S.low,this.high^S.high,this.unsigned)},$.shiftLeft=function(S){return r(S)&&(S=S.toInt()),(S&=63)===0?this:S<32?u(this.low<>>32-S,this.unsigned):u(0,this.low<>>S|this.high<<32-S,this.high>>S,this.unsigned):u(this.high>>S-32,this.high>=0?0:-1,this.unsigned)},$.shr=$.shiftRight,$.shiftRightUnsigned=function(S){if(r(S)&&(S=S.toInt()),S&=63,S===0)return this;var D=this.high;if(S<32){var _=this.low;return u(_>>>S|D<<32-S,D>>>S,this.unsigned)}else return S===32?u(D,0,this.unsigned):u(D>>>S-32,0,this.unsigned)},$.shru=$.shiftRightUnsigned,$.shr_u=$.shiftRightUnsigned,$.toSigned=function(){return this.unsigned?u(this.low,this.high,!1):this},$.toUnsigned=function(){return this.unsigned?this:u(this.low,this.high,!0)},$.toBytes=function(S){return S?this.toBytesLE():this.toBytesBE()},$.toBytesLE=function(){var S=this.high,D=this.low;return[D&255,D>>>8&255,D>>>16&255,D>>>24,S&255,S>>>8&255,S>>>16&255,S>>>24]},$.toBytesBE=function(){var S=this.high,D=this.low;return[S>>>24,S>>>16&255,S>>>8&255,S&255,D>>>24,D>>>16&255,D>>>8&255,D&255]},a.fromBytes=function(S,D,_){return _?a.fromBytesLE(S,D):a.fromBytesBE(S,D)},a.fromBytesLE=function(S,D){return new a(S[0]|S[1]<<8|S[2]<<16|S[3]<<24,S[4]|S[5]<<8|S[6]<<16|S[7]<<24,D)},a.fromBytesBE=function(S,D){return new a(S[4]<<24|S[5]<<16|S[6]<<8|S[7],S[0]<<24|S[1]<<16|S[2]<<8|S[3],D)}}),_3=_t(()=>{}),oR=_t((e,t)=>{(function(n,a,r){function s(u){var d=this,h=l();d.next=function(){var p=2091639*d.s0+d.c*23283064365386963e-26;return d.s0=d.s1,d.s1=d.s2,d.s2=p-(d.c=p|0)},d.c=1,d.s0=h(" "),d.s1=h(" "),d.s2=h(" "),d.s0-=h(u),d.s0<0&&(d.s0+=1),d.s1-=h(u),d.s1<0&&(d.s1+=1),d.s2-=h(u),d.s2<0&&(d.s2+=1),h=null}function i(u,d){return d.c=u.c,d.s0=u.s0,d.s1=u.s1,d.s2=u.s2,d}function o(u,d){var h=new s(u),p=d&&d.state,c=h.next;return c.int32=function(){return h.next()*4294967296|0},c.double=function(){return c()+(c()*2097152|0)*11102230246251565e-32},c.quick=c,p&&(typeof p=="object"&&i(p,h),c.state=function(){return i(h,{})}),c}function l(){var u=4022871197,d=function(h){h=h.toString();for(var p=0;p>>0,c-=u,c*=u,u=c>>>0,c-=u,u+=c*4294967296}return(u>>>0)*23283064365386963e-26};return d}a&&a.exports?a.exports=o:r&&r.amd?r(function(){return o}):this.alea=o})(e,typeof t=="object"&&t,typeof define=="function"&&define)}),lR=_t((e,t)=>{(function(n,a,r){function s(l){var u=this,d="";u.x=0,u.y=0,u.z=0,u.w=0,u.next=function(){var p=u.x^u.x<<11;return u.x=u.y,u.y=u.z,u.z=u.w,u.w^=u.w>>>19^p^p>>>8},l===(l|0)?u.x=l:d+=l;for(var h=0;h>>0)/4294967296};return p.double=function(){do var c=d.next()>>>11,m=(d.next()>>>0)/4294967296,f=(c+m)/(1<<21);while(f===0);return f},p.int32=d.next,p.quick=p,h&&(typeof h=="object"&&i(h,d),p.state=function(){return i(d,{})}),p}a&&a.exports?a.exports=o:r&&r.amd?r(function(){return o}):this.xor128=o})(e,typeof t=="object"&&t,typeof define=="function"&&define)}),uR=_t((e,t)=>{(function(n,a,r){function s(l){var u=this,d="";u.next=function(){var p=u.x^u.x>>>2;return u.x=u.y,u.y=u.z,u.z=u.w,u.w=u.v,(u.d=u.d+362437|0)+(u.v=u.v^u.v<<4^(p^p<<1))|0},u.x=0,u.y=0,u.z=0,u.w=0,u.v=0,l===(l|0)?u.x=l:d+=l;for(var h=0;h>>4),u.next()}function i(l,u){return u.x=l.x,u.y=l.y,u.z=l.z,u.w=l.w,u.v=l.v,u.d=l.d,u}function o(l,u){var d=new s(l),h=u&&u.state,p=function(){return(d.next()>>>0)/4294967296};return p.double=function(){do var c=d.next()>>>11,m=(d.next()>>>0)/4294967296,f=(c+m)/(1<<21);while(f===0);return f},p.int32=d.next,p.quick=p,h&&(typeof h=="object"&&i(h,d),p.state=function(){return i(d,{})}),p}a&&a.exports?a.exports=o:r&&r.amd?r(function(){return o}):this.xorwow=o})(e,typeof t=="object"&&t,typeof define=="function"&&define)}),dR=_t((e,t)=>{(function(n,a,r){function s(l){var u=this;u.next=function(){var h=u.x,p=u.i,c,m,f;return c=h[p],c^=c>>>7,m=c^c<<24,c=h[p+1&7],m^=c^c>>>10,c=h[p+3&7],m^=c^c>>>3,c=h[p+4&7],m^=c^c<<7,c=h[p+7&7],c=c^c<<13,m^=c^c<<9,h[p]=m,u.i=p+1&7,m};function d(h,p){var c,m,f=[];if(p===(p|0))m=f[0]=p;else for(p=""+p,c=0;c0;--c)h.next()}d(u,l)}function i(l,u){return u.x=l.x.slice(),u.i=l.i,u}function o(l,u){l==null&&(l=+new Date);var d=new s(l),h=u&&u.state,p=function(){return(d.next()>>>0)/4294967296};return p.double=function(){do var c=d.next()>>>11,m=(d.next()>>>0)/4294967296,f=(c+m)/(1<<21);while(f===0);return f},p.int32=d.next,p.quick=p,h&&(h.x&&i(h,d),p.state=function(){return i(d,{})}),p}a&&a.exports?a.exports=o:r&&r.amd?r(function(){return o}):this.xorshift7=o})(e,typeof t=="object"&&t,typeof define=="function"&&define)}),hR=_t((e,t)=>{(function(n,a,r){function s(l){var u=this;u.next=function(){var h=u.w,p=u.X,c=u.i,m,f;return u.w=h=h+1640531527|0,f=p[c+34&127],m=p[c=c+1&127],f^=f<<13,m^=m<<17,f^=f>>>15,m^=m>>>12,f=p[c]=f^m,u.i=c,f+(h^h>>>16)|0};function d(h,p){var c,m,f,g,y,A=[],x=128;for(p===(p|0)?(m=p,p=null):(p=p+"\0",m=0,x=Math.max(x,p.length)),f=0,g=-32;g>>15,m^=m<<4,m^=m>>>13,g>=0&&(y=y+1640531527|0,c=A[g&127]^=m+y,f=c==0?f+1:0);for(f>=128&&(A[(p&&p.length||0)&127]=-1),f=127,g=4*128;g>0;--g)m=A[f+34&127],c=A[f=f+1&127],m^=m<<13,c^=c<<17,m^=m>>>15,c^=c>>>12,A[f]=m^c;h.w=y,h.X=A,h.i=f}d(u,l)}function i(l,u){return u.i=l.i,u.w=l.w,u.X=l.X.slice(),u}function o(l,u){l==null&&(l=+new Date);var d=new s(l),h=u&&u.state,p=function(){return(d.next()>>>0)/4294967296};return p.double=function(){do var c=d.next()>>>11,m=(d.next()>>>0)/4294967296,f=(c+m)/(1<<21);while(f===0);return f},p.int32=d.next,p.quick=p,h&&(h.X&&i(h,d),p.state=function(){return i(d,{})}),p}a&&a.exports?a.exports=o:r&&r.amd?r(function(){return o}):this.xor4096=o})(e,typeof t=="object"&&t,typeof define=="function"&&define)}),pR=_t((e,t)=>{(function(n,a,r){function s(l){var u=this,d="";u.next=function(){var p=u.b,c=u.c,m=u.d,f=u.a;return p=p<<25^p>>>7^c,c=c-m|0,m=m<<24^m>>>8^f,f=f-p|0,u.b=p=p<<20^p>>>12^c,u.c=c=c-m|0,u.d=m<<16^c>>>16^f,u.a=f-p|0},u.a=0,u.b=0,u.c=2654435769|0,u.d=1367130551,l===Math.floor(l)?(u.a=l/4294967296|0,u.b=l|0):d+=l;for(var h=0;h>>0)/4294967296};return p.double=function(){do var c=d.next()>>>11,m=(d.next()>>>0)/4294967296,f=(c+m)/(1<<21);while(f===0);return f},p.int32=d.next,p.quick=p,h&&(typeof h=="object"&&i(h,d),p.state=function(){return i(d,{})}),p}a&&a.exports?a.exports=o:r&&r.amd?r(function(){return o}):this.tychei=o})(e,typeof t=="object"&&t,typeof define=="function"&&define)}),z3=_t(()=>{}),cR=_t((e,t)=>{(function(n,a){var r=this,s=256,i=6,o=52,l="random",u=a.pow(s,i),d=a.pow(2,o),h=d*2,p=s-1,c;function m(b,w,I){var T=[];w=w==!0?{entropy:!0}:w||{};var C=A(y(w.entropy?[b,v(n)]:b==null?x():b,3),T),z=new f(T),$=function(){for(var S=z.g(i),D=u,_=0;S=h;)S/=2,D/=2,_>>>=1;return(S+_)/D};return $.int32=function(){return z.g(4)|0},$.quick=function(){return z.g(4)/4294967296},$.double=$,A(v(z.S),n),(w.pass||I||function(S,D,_,W){return W&&(W.S&&g(W,z),S.state=function(){return g(z,{})}),_?(a[l]=S,D):S})($,C,"global"in w?w.global:this==a,w.state)}a["seed"+l]=m;function f(b){var w,I=b.length,T=this,C=0,z=T.i=T.j=0,$=T.S=[];for(I||(b=[I++]);C{var n=oR(),a=lR(),r=uR(),s=dR(),i=hR(),o=pR(),l=cR();l.alea=n,l.xor128=a,l.xorwow=r,l.xorshift7=s,l.xor4096=i,l.tychei=o,t.exports=l}),fR=_t((e,t)=>{(function(n,a,r){function s(u){var d=this,h=l();d.next=function(){var p=2091639*d.s0+d.c*23283064365386963e-26;return d.s0=d.s1,d.s1=d.s2,d.s2=p-(d.c=p|0)},d.c=1,d.s0=h(" "),d.s1=h(" "),d.s2=h(" "),d.s0-=h(u),d.s0<0&&(d.s0+=1),d.s1-=h(u),d.s1<0&&(d.s1+=1),d.s2-=h(u),d.s2<0&&(d.s2+=1),h=null}function i(u,d){return d.c=u.c,d.s0=u.s0,d.s1=u.s1,d.s2=u.s2,d}function o(u,d){var h=new s(u),p=d&&d.state,c=h.next;return c.int32=function(){return h.next()*4294967296|0},c.double=function(){return c()+(c()*2097152|0)*11102230246251565e-32},c.quick=c,p&&(typeof p=="object"&&i(p,h),c.state=function(){return i(h,{})}),c}function l(){var u=4022871197,d=function(h){h=String(h);for(var p=0;p>>0,c-=u,c*=u,u=c>>>0,c-=u,u+=c*4294967296}return(u>>>0)*23283064365386963e-26};return d}a&&a.exports?a.exports=o:r&&r.amd?r(function(){return o}):this.alea=o})(e,typeof t=="object"&&t,typeof define=="function"&&define)}),mR=_t((e,t)=>{(function(n,a,r){function s(l){var u=this,d="";u.x=0,u.y=0,u.z=0,u.w=0,u.next=function(){var p=u.x^u.x<<11;return u.x=u.y,u.y=u.z,u.z=u.w,u.w^=u.w>>>19^p^p>>>8},l===(l|0)?u.x=l:d+=l;for(var h=0;h>>0)/4294967296};return p.double=function(){do var c=d.next()>>>11,m=(d.next()>>>0)/4294967296,f=(c+m)/(1<<21);while(f===0);return f},p.int32=d.next,p.quick=p,h&&(typeof h=="object"&&i(h,d),p.state=function(){return i(d,{})}),p}a&&a.exports?a.exports=o:r&&r.amd?r(function(){return o}):this.xor128=o})(e,typeof t=="object"&&t,typeof define=="function"&&define)}),gR=_t((e,t)=>{(function(n,a,r){function s(l){var u=this,d="";u.next=function(){var p=u.x^u.x>>>2;return u.x=u.y,u.y=u.z,u.z=u.w,u.w=u.v,(u.d=u.d+362437|0)+(u.v=u.v^u.v<<4^(p^p<<1))|0},u.x=0,u.y=0,u.z=0,u.w=0,u.v=0,l===(l|0)?u.x=l:d+=l;for(var h=0;h>>4),u.next()}function i(l,u){return u.x=l.x,u.y=l.y,u.z=l.z,u.w=l.w,u.v=l.v,u.d=l.d,u}function o(l,u){var d=new s(l),h=u&&u.state,p=function(){return(d.next()>>>0)/4294967296};return p.double=function(){do var c=d.next()>>>11,m=(d.next()>>>0)/4294967296,f=(c+m)/(1<<21);while(f===0);return f},p.int32=d.next,p.quick=p,h&&(typeof h=="object"&&i(h,d),p.state=function(){return i(d,{})}),p}a&&a.exports?a.exports=o:r&&r.amd?r(function(){return o}):this.xorwow=o})(e,typeof t=="object"&&t,typeof define=="function"&&define)}),yR=_t((e,t)=>{(function(n,a,r){function s(l){var u=this;u.next=function(){var h=u.x,p=u.i,c,m,f;return c=h[p],c^=c>>>7,m=c^c<<24,c=h[p+1&7],m^=c^c>>>10,c=h[p+3&7],m^=c^c>>>3,c=h[p+4&7],m^=c^c<<7,c=h[p+7&7],c=c^c<<13,m^=c^c<<9,h[p]=m,u.i=p+1&7,m};function d(h,p){var c,m,f=[];if(p===(p|0))m=f[0]=p;else for(p=""+p,c=0;c0;--c)h.next()}d(u,l)}function i(l,u){return u.x=l.x.slice(),u.i=l.i,u}function o(l,u){l==null&&(l=+new Date);var d=new s(l),h=u&&u.state,p=function(){return(d.next()>>>0)/4294967296};return p.double=function(){do var c=d.next()>>>11,m=(d.next()>>>0)/4294967296,f=(c+m)/(1<<21);while(f===0);return f},p.int32=d.next,p.quick=p,h&&(h.x&&i(h,d),p.state=function(){return i(d,{})}),p}a&&a.exports?a.exports=o:r&&r.amd?r(function(){return o}):this.xorshift7=o})(e,typeof t=="object"&&t,typeof define=="function"&&define)}),AR=_t((e,t)=>{(function(n,a,r){function s(l){var u=this;u.next=function(){var h=u.w,p=u.X,c=u.i,m,f;return u.w=h=h+1640531527|0,f=p[c+34&127],m=p[c=c+1&127],f^=f<<13,m^=m<<17,f^=f>>>15,m^=m>>>12,f=p[c]=f^m,u.i=c,f+(h^h>>>16)|0};function d(h,p){var c,m,f,g,y,A=[],x=128;for(p===(p|0)?(m=p,p=null):(p=p+"\0",m=0,x=Math.max(x,p.length)),f=0,g=-32;g>>15,m^=m<<4,m^=m>>>13,g>=0&&(y=y+1640531527|0,c=A[g&127]^=m+y,f=c==0?f+1:0);for(f>=128&&(A[(p&&p.length||0)&127]=-1),f=127,g=4*128;g>0;--g)m=A[f+34&127],c=A[f=f+1&127],m^=m<<13,c^=c<<17,m^=m>>>15,c^=c>>>12,A[f]=m^c;h.w=y,h.X=A,h.i=f}d(u,l)}function i(l,u){return u.i=l.i,u.w=l.w,u.X=l.X.slice(),u}function o(l,u){l==null&&(l=+new Date);var d=new s(l),h=u&&u.state,p=function(){return(d.next()>>>0)/4294967296};return p.double=function(){do var c=d.next()>>>11,m=(d.next()>>>0)/4294967296,f=(c+m)/(1<<21);while(f===0);return f},p.int32=d.next,p.quick=p,h&&(h.X&&i(h,d),p.state=function(){return i(d,{})}),p}a&&a.exports?a.exports=o:r&&r.amd?r(function(){return o}):this.xor4096=o})(e,typeof t=="object"&&t,typeof define=="function"&&define)}),xR=_t((e,t)=>{(function(n,a,r){function s(l){var u=this,d="";u.next=function(){var p=u.b,c=u.c,m=u.d,f=u.a;return p=p<<25^p>>>7^c,c=c-m|0,m=m<<24^m>>>8^f,f=f-p|0,u.b=p=p<<20^p>>>12^c,u.c=c=c-m|0,u.d=m<<16^c>>>16^f,u.a=f-p|0},u.a=0,u.b=0,u.c=2654435769|0,u.d=1367130551,l===Math.floor(l)?(u.a=l/4294967296|0,u.b=l|0):d+=l;for(var h=0;h>>0)/4294967296};return p.double=function(){do var c=d.next()>>>11,m=(d.next()>>>0)/4294967296,f=(c+m)/(1<<21);while(f===0);return f},p.int32=d.next,p.quick=p,h&&(typeof h=="object"&&i(h,d),p.state=function(){return i(d,{})}),p}a&&a.exports?a.exports=o:r&&r.amd?r(function(){return o}):this.tychei=o})(e,typeof t=="object"&&t,typeof define=="function"&&define)}),bR=_t((e,t)=>{(function(n,a,r){var s=256,i=6,o=52,l="random",u=r.pow(s,i),d=r.pow(2,o),h=d*2,p=s-1,c;function m(b,w,I){var T=[];w=w==!0?{entropy:!0}:w||{};var C=A(y(w.entropy?[b,v(a)]:b==null?x():b,3),T),z=new f(T),$=function(){for(var S=z.g(i),D=u,_=0;S=h;)S/=2,D/=2,_>>>=1;return(S+_)/D};return $.int32=function(){return z.g(4)|0},$.quick=function(){return z.g(4)/4294967296},$.double=$,A(v(z.S),a),(w.pass||I||function(S,D,_,W){return W&&(W.S&&g(W,z),S.state=function(){return g(z,{})}),_?(r[l]=S,D):S})($,C,"global"in w?w.global:this==r,w.state)}function f(b){var w,I=b.length,T=this,C=0,z=T.i=T.j=0,$=T.S=[];for(I||(b=[I++]);C{var n=fR(),a=mR(),r=gR(),s=yR(),i=AR(),o=xR(),l=bR();l.alea=n,l.xor128=a,l.xorwow=r,l.xorshift7=s,l.xor4096=i,l.tychei=o,t.exports=l}),vR=_t(()=>{}),Gu=_t(()=>{}),wR=_t(()=>{}),kR=_t(()=>{}),IR=_t((e,t)=>{var n=function(){var a=typeof document!="undefined"&&document.currentScript?document.currentScript.src:void 0;return typeof __filename!="undefined"&&(a=a||__filename),function(r){r=r||{};function s(){return te.buffer!=Je&&wn(te.buffer),Hn}function i(){return te.buffer!=Je&&wn(te.buffer),Bt}function o(){return te.buffer!=Je&&wn(te.buffer),Gn}function l(){return te.buffer!=Je&&wn(te.buffer),ba}function u(){return te.buffer!=Je&&wn(te.buffer),Rn}var d=typeof r!="undefined"?r:{},h,p;d.ready=new Promise(function(E,R){h=E,p=R});var c={},m;for(m in d)d.hasOwnProperty(m)&&(c[m]=d[m]);var f=[],g="./this.program",y=function(E,R){throw R},A=!1,x=!1,v=!1,b=!1;A=typeof window=="object",x=typeof importScripts=="function",v=typeof process=="object"&&typeof process.versions=="object"&&typeof process.versions.node=="string",b=!A&&!v&&!x;var w=d.ENVIRONMENT_IS_PTHREAD||!1;w&&(Je=d.buffer);var I="";function T(E){return d.locateFile?d.locateFile(E,I):I+E}var C,z,$,S,D,_;if(v){x?I=Gu().dirname(I)+"/":I=__dirname+"/",C=function(E,R){return D||(D=di("fs")),_||(_=Gu()),E=_.normalize(E),D.readFileSync(E,R?null:"utf8")},$=function(E){var R=C(E,!0);return R.buffer||(R=new Uint8Array(R)),xe(R.buffer),R},process.argv.length>1&&(g=process.argv[1].replace(/\\/g,"/")),f=process.argv.slice(2),process.on("uncaughtException",function(E){if(!(E instanceof Hu))throw E}),process.on("unhandledRejection",jr),y=function(E){process.exit(E)},d.inspect=function(){return"[Emscripten Module object]"};var W;try{W=wR()}catch(E){throw console.error('The "worker_threads" module is not supported in this node.js build - perhaps a newer version is needed?'),E}global.Worker=W.Worker}else b?(typeof read!="undefined"&&(C=function(E){return read(E)}),$=function(E){var R;return typeof readbuffer=="function"?new Uint8Array(readbuffer(E)):(R=read(E,"binary"),xe(typeof R=="object"),R)},typeof scriptArgs!="undefined"?f=scriptArgs:typeof arguments!="undefined"&&(f=arguments),typeof quit=="function"&&(y=function(E){quit(E)}),typeof print!="undefined"&&(typeof console=="undefined"&&(console={}),console.log=print,console.warn=console.error=typeof printErr!="undefined"?printErr:print)):(A||x)&&(x?I=self.location.href:typeof document!="undefined"&&document.currentScript&&(I=document.currentScript.src),typeof a!="undefined"&&a&&(I=a),I.indexOf("blob:")!==0?I=I.substr(0,I.lastIndexOf("/")+1):I="",v?(C=function(E,R){return D||(D=di("fs")),_||(_=Gu()),E=_.normalize(E),D.readFileSync(E,R?null:"utf8")},$=function(E){var R=C(E,!0);return R.buffer||(R=new Uint8Array(R)),xe(R.buffer),R}):(C=function(E){var R=new XMLHttpRequest;return R.open("GET",E,!1),R.send(null),R.responseText},x&&($=function(E){var R=new XMLHttpRequest;return R.open("GET",E,!1),R.responseType="arraybuffer",R.send(null),new Uint8Array(R.response)}),z=function(E,R,H){var J=new XMLHttpRequest;J.open("GET",E,!0),J.responseType="arraybuffer",J.onload=function(){if(J.status==200||J.status==0&&J.response){R(J.response);return}H()},J.onerror=H,J.send(null)}),S=function(E){document.title=E});v&&typeof performance=="undefined"&&(global.performance=kR().performance);var X=d.print||console.log.bind(console),q=d.printErr||console.warn.bind(console);for(m in c)c.hasOwnProperty(m)&&(d[m]=c[m]);c=null,d.arguments&&(f=d.arguments),d.thisProgram&&(g=d.thisProgram),d.quit&&(y=d.quit);var Q=Atomics.load,ee=Atomics.store,ie=Atomics.compareExchange,ae;d.wasmBinary&&(ae=d.wasmBinary);var de=d.noExitRuntime||!0;typeof WebAssembly!="object"&&jr("no native wasm support detected");var te,ce,he=!1,ve;function xe(E,R){E||jr("Assertion failed: "+R)}function Ee(E){var R=d["_"+E];return xe(R,"Cannot call unknown function "+E+", make sure it is exported"),R}function Fe(E,R,H,J,Ae){var me={string:function(Xn){var Do=0;if(Xn!=null&&Xn!==0){var M3=(Xn.length<<2)+1;Do=Ro(M3),mt(Xn,Do,M3)}return Do},array:function(Xn){var Do=Ro(Xn.length);return lt(Xn,Do),Do}};function ye(Xn){return R==="string"?Be(Xn):R==="boolean"?Boolean(Xn):Xn}var Ie=Ee(E),gt=[],cn=0;if(J)for(var rn=0;rn=J);){var me=E[R++];if(!me)return Ae;if(!(me&128)){Ae+=String.fromCharCode(me);continue}var ye=E[R++]&63;if((me&224)==192){Ae+=String.fromCharCode((me&31)<<6|ye);continue}var Ie=E[R++]&63;if((me&240)==224?me=(me&15)<<12|ye<<6|Ie:me=(me&7)<<18|ye<<12|Ie<<6|E[R++]&63,me<65536)Ae+=String.fromCharCode(me);else{var gt=me-65536;Ae+=String.fromCharCode(55296|gt>>10,56320|gt&1023)}}return Ae}function Be(E,R){return E?qe(i(),E,R):""}function ft(E,R,H,J){if(!(J>0))return 0;for(var Ae=H,me=H+J-1,ye=0;ye=55296&&Ie<=57343){var gt=E.charCodeAt(++ye);Ie=65536+((Ie&1023)<<10)|gt&1023}if(Ie<=127){if(H>=me)break;R[H++]=Ie}else if(Ie<=2047){if(H+1>=me)break;R[H++]=192|Ie>>6,R[H++]=128|Ie&63}else if(Ie<=65535){if(H+2>=me)break;R[H++]=224|Ie>>12,R[H++]=128|Ie>>6&63,R[H++]=128|Ie&63}else{if(H+3>=me)break;R[H++]=240|Ie>>18,R[H++]=128|Ie>>12&63,R[H++]=128|Ie>>6&63,R[H++]=128|Ie&63}}return R[H]=0,H-Ae}function mt(E,R,H){return ft(E,i(),R,H)}function bt(E){for(var R=0,H=0;H=55296&&J<=57343&&(J=65536+((J&1023)<<10)|E.charCodeAt(++H)&1023),J<=127?++R:J<=2047?R+=2:J<=65535?R+=3:R+=4}return R}function lt(E,R){s().set(E,R)}function Ct(E,R){return E%R>0&&(E+=R-E%R),E}var Je,Hn,Bt,xa,vn,Gn,ba,sa,Rn;function wn(E){Je=E,d.HEAP8=Hn=new Int8Array(E),d.HEAP16=xa=new Int16Array(E),d.HEAP32=Gn=new Int32Array(E),d.HEAPU8=Bt=new Uint8Array(E),d.HEAPU16=vn=new Uint16Array(E),d.HEAPU32=ba=new Uint32Array(E),d.HEAPF32=sa=new Float32Array(E),d.HEAPF64=Rn=new Float64Array(E)}var vr=d.INITIAL_MEMORY||16777216;if(w)te=d.wasmMemory,Je=d.buffer;else if(d.wasmMemory)te=d.wasmMemory;else if(te=new WebAssembly.Memory({initial:vr/65536,maximum:2147483648/65536,shared:!0}),!(te.buffer instanceof SharedArrayBuffer))throw q("requested a shared WebAssembly.Memory but the returned buffer is not a SharedArrayBuffer, indicating that while the browser has SharedArrayBuffer it does not have WebAssembly threads support - you may need to set a flag"),v&&console.log("(on node you may need: --experimental-wasm-threads --experimental-wasm-bulk-memory and also use a recent version)"),Error("bad memory");te&&(Je=te.buffer),vr=Je.byteLength,wn(Je);var Wa,Ba=[],ys=[],Vr=[],As=[],So=[],wr=!1,$p=!1;w||ys.push({func:function(){Gp()}});function Em(){if(!w){if(d.preRun)for(typeof d.preRun=="function"&&(d.preRun=[d.preRun]);d.preRun.length;)Fp(d.preRun.shift());To(Ba)}}function Du(){wr=!0,!w&&To(ys)}function Cm(){w||To(Vr)}function Rp(){w||($p=!0)}function qn(){if(!w){if(d.postRun)for(typeof d.postRun=="function"&&(d.postRun=[d.postRun]);d.postRun.length;)Mm(d.postRun.shift());To(So)}}function Fp(E){Ba.unshift(E)}function Mm(E){So.unshift(E)}var Ur=0,xs=null,oi=null;function $m(E){xe(!w,"addRunDependency cannot be used in a pthread worker"),Ur++,d.monitorRunDependencies&&d.monitorRunDependencies(Ur)}function Rm(E){if(Ur--,d.monitorRunDependencies&&d.monitorRunDependencies(Ur),Ur==0&&(xs!==null&&(clearInterval(xs),xs=null),oi)){var R=oi;oi=null,R()}}d.preloadedImages={},d.preloadedAudios={};function jr(E){d.onAbort&&d.onAbort(E),w&&console.error("Pthread aborting at "+new Error().stack),E+="",q(E),he=!0,ve=1,E="abort("+E+"). Build with -s ASSERTIONS=1 for more info.";var R=new WebAssembly.RuntimeError(E);throw p(R),R}function Op(E,R){return String.prototype.startsWith?E.startsWith(R):E.indexOf(R)===0}var No="data:application/octet-stream;base64,";function Dp(E){return Op(E,No)}var Fm="file://";function _p(E){return Op(E,Fm)}var Kn="tfjs-backend-wasm-threaded-simd.wasm";Dp(Kn)||(Kn=T(Kn));function zp(E){try{if(E==Kn&&ae)return new Uint8Array(ae);if($)return $(E);throw"both async and sync fetching of the wasm failed"}catch(R){jr(R)}}function Om(){if(!ae&&(A||x)){if(typeof fetch=="function"&&!_p(Kn))return fetch(Kn,{credentials:"same-origin"}).then(function(E){if(!E.ok)throw"failed to load wasm binary file at '"+Kn+"'";return E.arrayBuffer()}).catch(function(){return zp(Kn)});if(z)return new Promise(function(E,R){z(Kn,function(H){E(new Uint8Array(H))},R)})}return Promise.resolve().then(function(){return zp(Kn)})}function Dm(){var E={a:Sg};function R(ye,Ie){var gt=ye.exports;if(d.asm=gt,Wa=d.asm.F,ce=Ie,!w){var cn=Te.unusedWorkers.length;Te.unusedWorkers.forEach(function(rn){Te.loadWasmModuleToWorker(rn,function(){--cn||Rm("wasm-instantiate")})})}}w||$m("wasm-instantiate");function H(ye){R(ye.instance,ye.module)}function J(ye){return Om().then(function(Ie){return WebAssembly.instantiate(Ie,E)}).then(ye,function(Ie){q("failed to asynchronously prepare wasm: "+Ie),jr(Ie)})}function Ae(){return!ae&&typeof WebAssembly.instantiateStreaming=="function"&&!Dp(Kn)&&!_p(Kn)&&typeof fetch=="function"?fetch(Kn,{credentials:"same-origin"}).then(function(ye){var Ie=WebAssembly.instantiateStreaming(ye,E);return Ie.then(H,function(gt){return q("wasm streaming compile failed: "+gt),q("falling back to ArrayBuffer instantiation"),J(H)})}):J(H)}if(d.instantiateWasm)try{var me=d.instantiateWasm(E,R);return me}catch(ye){return q("Module.instantiateWasm callback failed with error: "+ye),!1}return Ae().catch(p),{}}var _m={9816:function(){throw"Canceled!"},9834:function(E,R){setTimeout(function(){I3(E,R)},0)}};function Pp(){Te.initRuntime()}function To(E){for(;E.length>0;){var R=E.shift();if(typeof R=="function"){R(d);continue}var H=R.func;typeof H=="number"?R.arg===void 0?Wa.get(H)():Wa.get(H)(R.arg):H(R.arg===void 0?null:R.arg)}}function _u(E,R){if(E<=0||E>s().length||E&!0||R<0)return-28;if(R==0)return 0;R>=2147483647&&(R=Infinity);var H=Atomics.load(o(),Fo>>2),J=0;if(H==E){var Ae=Atomics.compareExchange(o(),Fo>>2,H,0);if(Ae==H&&(--R,J=1,R<=0))return 1}var me=Atomics.notify(o(),E>>2,R);if(me>=0)return me+J;throw"Atomics.notify returned an unexpected value "+me}d._emscripten_futex_wake=_u;function zm(E){if(w)throw"Internal Error! killThread() can only ever be called from main application thread!";if(!E)throw"Internal Error! Null pthread_ptr in killThread!";o()[E+12>>2]=0;var R=Te.pthreads[E];R.worker.terminate(),Te.freeThreadData(R),Te.runningWorkers.splice(Te.runningWorkers.indexOf(R.worker),1),R.worker.pthread=void 0}function Pm(E){if(w)throw"Internal Error! cancelThread() can only ever be called from main application thread!";if(!E)throw"Internal Error! Null pthread_ptr in cancelThread!";var R=Te.pthreads[E];R.worker.postMessage({cmd:"cancel"})}function Lm(E){if(w)throw"Internal Error! cleanupThread() can only ever be called from main application thread!";if(!E)throw"Internal Error! Null pthread_ptr in cleanupThread!";var R=Te.pthreads[E];if(R){o()[E+12>>2]=0;var H=R.worker;Te.returnWorkerToPool(H)}}var Te={unusedWorkers:[],runningWorkers:[],initMainThreadBlock:function(){for(var E=Math.min(4,Math.max(1,(navigator.hardwareConcurrency||1)/2)),R=0;R>2]=E;var H=E+152;o()[H>>2]=H;for(var J=ui(512),R=0;R<128;++R)l()[J/4+R]=0;Atomics.store(l(),E+100>>2,J),Atomics.store(l(),E+40>>2,E),Zg(E,!x,1),k3(E)},initWorker:function(){},pthreads:{},threadExitHandlers:[],setThreadStatus:function(){},runExitHandlers:function(){for(;Te.threadExitHandlers.length>0;)Te.threadExitHandlers.pop()();w&&Mo()&&w3()},runExitHandlersAndDeinitThread:function(E,R){Atomics.store(l(),E+56>>2,1),Atomics.store(l(),E+60>>2,0),Te.runExitHandlers(),Atomics.store(l(),E+4>>2,R),Atomics.store(l(),E+0>>2,1),_u(E+0,2147483647),Zg(0,0,0)},threadExit:function(E){var R=Mo();R&&(Te.runExitHandlersAndDeinitThread(R,E),w&&postMessage({cmd:"exit"}))},threadCancel:function(){Te.runExitHandlersAndDeinitThread(Mo(),-1),postMessage({cmd:"cancelDone"})},terminateAllThreads:function(){for(var E in Te.pthreads){var R=Te.pthreads[E];R&&R.worker&&Te.returnWorkerToPool(R.worker)}Te.pthreads={};for(var H=0;H>2];o()[E.threadInfoStruct+100>>2]=0,Uu(R),Uu(E.threadInfoStruct)}E.threadInfoStruct=0,E.allocatedOwnStack&&E.stackBase&&Uu(E.stackBase),E.stackBase=0,E.worker&&(E.worker.pthread=null)}},returnWorkerToPool:function(E){Te.runWithoutMainThreadQueuedCalls(function(){delete Te.pthreads[E.pthread.threadInfoStruct],Te.unusedWorkers.push(E),Te.runningWorkers.splice(Te.runningWorkers.indexOf(E),1),Te.freeThreadData(E.pthread),E.pthread=void 0})},runWithoutMainThreadQueuedCalls:function(E){o()[C3>>2]=0;try{E()}finally{o()[C3>>2]=1}},receiveObjectTransfer:function(E){},loadWasmModuleToWorker:function(E,R){E.onmessage=function(H){var J=H.data,Ae=J.cmd;if(E.pthread&&(Te.currentProxiedOperationCallerThread=E.pthread.threadInfoStruct),J.targetThread&&J.targetThread!=Mo()){var me=Te.pthreads[J.targetThread];me?me.worker.postMessage(H.data,J.transferList):console.error('Internal error! Worker sent a message "'+Ae+'" to target pthread '+J.targetThread+", but that thread no longer exists!"),Te.currentProxiedOperationCallerThread=void 0;return}if(Ae==="processQueuedMainThreadWork")Kg();else if(Ae==="spawnThread")jp(H.data);else if(Ae==="cleanupThread")Lm(J.thread);else if(Ae==="killThread")zm(J.thread);else if(Ae==="cancelThread")Pm(J.thread);else if(Ae==="loaded")E.loaded=!0,R&&R(E),E.runPthread&&(E.runPthread(),delete E.runPthread);else if(Ae==="print")X("Thread "+J.threadId+": "+J.text);else if(Ae==="printErr")q("Thread "+J.threadId+": "+J.text);else if(Ae==="alert")alert("Thread "+J.threadId+": "+J.text);else if(Ae==="exit"){var ye=E.pthread&&Atomics.load(l(),E.pthread.threadInfoStruct+64>>2);ye&&Te.returnWorkerToPool(E)}else if(Ae==="exitProcess")try{J$(J.returnCode)}catch(Ie){if(Ie instanceof Hu)return;throw Ie}else Ae==="cancelDone"?Te.returnWorkerToPool(E):Ae==="objectTransfer"?Te.receiveObjectTransfer(H.data):H.data.target==="setimmediate"?E.postMessage(H.data):q("worker sent an unknown command "+Ae);Te.currentProxiedOperationCallerThread=void 0},E.onerror=function(H){q("pthread sent an error! "+H.filename+":"+H.lineno+": "+H.message)},v&&(E.on("message",function(H){E.onmessage({data:H})}),E.on("error",function(H){E.onerror(H)}),E.on("exit",function(H){})),E.postMessage({cmd:"load",urlOrBlob:d.mainScriptUrlOrBlob||a,wasmMemory:te,wasmModule:ce})},allocateUnusedWorker:function(){var E=T("tfjs-backend-wasm-threaded-simd.worker.js");Te.unusedWorkers.push(new Worker(E))},getNewWorker:function(){return Te.unusedWorkers.length==0&&(Te.allocateUnusedWorker(),Te.loadWasmModuleToWorker(Te.unusedWorkers[0])),Te.unusedWorkers.length>0?Te.unusedWorkers.pop():null},busySpinWait:function(E){for(var R=performance.now()+E;performance.now()>2]=E,E}function Gm(E,R){if(w)return bs(1,1,E,R)}function qm(E,R){if(E==R)postMessage({cmd:"processQueuedMainThreadWork"});else if(w)postMessage({targetThread:E,cmd:"processThreadQueue"});else{var H=Te.pthreads[E],J=H&&H.worker;if(!J)return;J.postMessage({cmd:"processThreadQueue"})}return 1}function Km(){jr()}function Xm(E,R,H){var J=eg(R,H);return _m[E].apply(null,J)}function Zm(E,R){}function Ym(E,R,H){if(E<=0||E>s().length||E&!0)return-28;if(A){if(Atomics.load(o(),E>>2)!=R)return-6;for(var J=performance.now(),Ae=J+H,me=Atomics.exchange(o(),Fo>>2,E);;){if(J=performance.now(),J>Ae)return me=Atomics.exchange(o(),Fo>>2,0),-73;if(me=Atomics.exchange(o(),Fo>>2,0),me==0)break;if(Kg(),Atomics.load(o(),E>>2)!=R)return-6;me=Atomics.exchange(o(),Fo>>2,E)}return 0}else{var ye=Atomics.wait(o(),E>>2,R,H);if(ye==="timed-out")return-73;if(ye==="not-equal")return-6;if(ye==="ok")return 0;throw"Atomics.wait returned an unexpected value "+ye}}function Jm(E,R,H){i().copyWithin(E,R,R+H)}function Qm(){return v?di("os").cpus().length:navigator.hardwareConcurrency}function bs(E,R){for(var H=arguments.length-2,J=ju(),Ae=H,me=Ro(Ae*8),ye=me>>3,Ie=0;Ie>=2;H=i()[E++];){var J=H<105;J&&R&1&&R++,Pu.push(J?u()[R++>>1]:o()[R]),++R}return Pu}function tg(E,R,H){zu.length=R;for(var J=H>>3,Ae=0;Ae>>16),wn(te.buffer),1}catch(R){}}function rg(E){var R=ng();if(E<=R)return!1;var H=2147483648;if(E>H)return!1;for(var J=1;J<=4;J*=2){var Ae=R*(1+.2/J);Ae=Math.min(Ae,E+100663296);var me=Math.min(H,Ct(Math.max(E,Ae),65536)),ye=ag(me);if(ye)return!0}return!1}var Xe={inEventHandler:0,removeAllEventListeners:function(){for(var E=Xe.eventHandlers.length-1;E>=0;--E)Xe._removeHandler(E);Xe.eventHandlers=[],Xe.deferredCalls=[]},registerRemoveEventListeners:function(){Xe.removeEventListenersRegistered||(As.push(Xe.removeAllEventListeners),Xe.removeEventListenersRegistered=!0)},deferredCalls:[],deferCall:function(E,R,H){function J(ye,Ie){if(ye.length!=Ie.length)return!1;for(var gt in ye)if(ye[gt]!=Ie[gt])return!1;return!0}for(var Ae in Xe.deferredCalls){var me=Xe.deferredCalls[Ae];if(me.targetFunction==E&&J(me.argsList,H))return}Xe.deferredCalls.push({targetFunction:E,precedence:R,argsList:H}),Xe.deferredCalls.sort(function(ye,Ie){return ye.precedence>2]=H,o()[ye+4>>2]=J,o()[ye+8>>2]=Ae,Xg(0,E,637534208,R,J,ye),$o(me)},getTargetThreadForEventCallback:function(E){switch(E){case 1:return 0;case 2:return Te.currentProxiedOperationCallerThread;default:return E}},getNodeNameForTarget:function(E){return E?E==window?"#window":E==screen?"#screen":E&&E.nodeName?E.nodeName:"":""},fullscreenEnabled:function(){return document.fullscreenEnabled||document.webkitFullscreenEnabled}};function sg(E){var R=bt(E)+1,H=ui(R);return mt(E,H,R),H}function ig(E,R,H,J){var Ae=ju(),me=Ro(12),ye=0;R&&(ye=sg(R)),o()[me>>2]=ye,o()[me+4>>2]=H,o()[me+8>>2]=J,Xg(0,E,657457152,0,ye,me),$o(Ae)}function og(E,R,H,J){R=R?Be(R):"",ig(E,R,H,J)}function lg(E){return E>2?Be(E):E}var ug=[0,typeof document!="undefined"?document:0,typeof window!="undefined"?window:0];function dg(E){E=lg(E);var R=ug[E]||(typeof document!="undefined"?document.querySelector(E):void 0);return R}function Lu(E){return dg(E)}function Lp(E,R,H){var J=Lu(E);if(!J)return-4;if(J.canvasSharedPtr&&(o()[J.canvasSharedPtr>>2]=R,o()[J.canvasSharedPtr+4>>2]=H),J.offscreenCanvas||!J.controlTransferredOffscreen){J.offscreenCanvas&&(J=J.offscreenCanvas);var Ae=!1;if(J.GLctxObject&&J.GLctxObject.GLctx){var me=J.GLctxObject.GLctx.getParameter(2978);Ae=me[0]===0&&me[1]===0&&me[2]===J.width&&me[3]===J.height}J.width=R,J.height=H,Ae&&J.GLctxObject.GLctx.viewport(0,0,R,H)}else if(J.canvasSharedPtr){var ye=o()[J.canvasSharedPtr+8>>2];return og(ye,E,R,H),1}else return-4;return 0}function Wp(E,R,H){return w?bs(2,1,E,R,H):Lp(E,R,H)}function hg(E,R,H){var J=Lu(E);return J?Lp(E,R,H):Wp(E,R,H)}function pg(E){}function cg(E,R){}function fg(E){var R=E.getExtension("ANGLE_instanced_arrays");if(R)return E.vertexAttribDivisor=function(H,J){R.vertexAttribDivisorANGLE(H,J)},E.drawArraysInstanced=function(H,J,Ae,me){R.drawArraysInstancedANGLE(H,J,Ae,me)},E.drawElementsInstanced=function(H,J,Ae,me,ye){R.drawElementsInstancedANGLE(H,J,Ae,me,ye)},1}function mg(E){var R=E.getExtension("OES_vertex_array_object");if(R)return E.createVertexArray=function(){return R.createVertexArrayOES()},E.deleteVertexArray=function(H){R.deleteVertexArrayOES(H)},E.bindVertexArray=function(H){R.bindVertexArrayOES(H)},E.isVertexArray=function(H){return R.isVertexArrayOES(H)},1}function gg(E){var R=E.getExtension("WEBGL_draw_buffers");if(R)return E.drawBuffers=function(H,J){R.drawBuffersWEBGL(H,J)},1}function yg(E){return!!(E.multiDrawWebgl=E.getExtension("WEBGL_multi_draw"))}var pt={counter:1,buffers:[],programs:[],framebuffers:[],renderbuffers:[],textures:[],uniforms:[],shaders:[],vaos:[],contexts:{},offscreenCanvases:{},timerQueriesEXT:[],programInfos:{},stringCache:{},unpackAlignment:4,recordError:function(E){pt.lastError||(pt.lastError=E)},getNewId:function(E){for(var R=pt.counter++,H=E.length;H>2]:-1;Ae+=Be(o()[H+me*4>>2],ye<0?void 0:ye)}return Ae},createContext:function(E,R){var H=E.getContext("webgl",R);if(!H)return 0;var J=pt.registerContext(H,R);return J},registerContext:function(E,R){var H=ui(8);o()[H+4>>2]=Mo();var J={handle:H,attributes:R,version:R.majorVersion,GLctx:E};return E.canvas&&(E.canvas.GLctxObject=J),pt.contexts[H]=J,(typeof R.enableExtensionsByDefault=="undefined"||R.enableExtensionsByDefault)&&pt.initExtensions(J),H},makeContextCurrent:function(E){return pt.currentContext=pt.contexts[E],d.ctx=vs=pt.currentContext&&pt.currentContext.GLctx,!(E&&!vs)},getContext:function(E){return pt.contexts[E]},deleteContext:function(E){pt.currentContext===pt.contexts[E]&&(pt.currentContext=null),typeof Xe=="object"&&Xe.removeAllHandlersOnTarget(pt.contexts[E].GLctx.canvas),pt.contexts[E]&&pt.contexts[E].GLctx.canvas&&(pt.contexts[E].GLctx.canvas.GLctxObject=void 0),Uu(pt.contexts[E].handle),pt.contexts[E]=null},initExtensions:function(E){if(E||(E=pt.currentContext),!E.initExtensionsDone){E.initExtensionsDone=!0;var R=E.GLctx;fg(R),mg(R),gg(R),R.disjointTimerQueryExt=R.getExtension("EXT_disjoint_timer_query"),yg(R);var H=R.getSupportedExtensions()||[];H.forEach(function(J){J.indexOf("lose_context")<0&&J.indexOf("debug")<0&&R.getExtension(J)})}},populateUniformTable:function(E){for(var R=pt.programs[E],H=pt.programInfos[E]={uniforms:{},maxUniformLength:0,maxAttributeLength:-1,maxUniformBlockNameLength:-1},J=H.uniforms,Ae=vs.getProgramParameter(R,35718),me=0;me>2,J=o()[H+(24>>2)],Ae={alpha:!!o()[H+(0>>2)],depth:!!o()[H+(4>>2)],stencil:!!o()[H+(8>>2)],antialias:!!o()[H+(12>>2)],premultipliedAlpha:!!o()[H+(16>>2)],preserveDrawingBuffer:!!o()[H+(20>>2)],powerPreference:Ag[J],failIfMajorPerformanceCaveat:!!o()[H+(28>>2)],majorVersion:o()[H+(32>>2)],minorVersion:o()[H+(36>>2)],enableExtensionsByDefault:o()[H+(40>>2)],explicitSwapControl:o()[H+(44>>2)],proxyContextToMainThread:o()[H+(48>>2)],renderViaOffscreenBackBuffer:o()[H+(52>>2)]},me=Lu(E);if(!me||Ae.explicitSwapControl)return 0;var ye=pt.createContext(me,Ae);return ye}function bg(E,R){return xg(E,R)}var Eo={mappings:{},buffers:[null,[],[]],printChar:function(E,R){var H=Eo.buffers[E];R===0||R===10?((E===1?X:q)(qe(H,0)),H.length=0):H.push(R)},varargs:void 0,get:function(){Eo.varargs+=4;var E=o()[Eo.varargs-4>>2];return E},getStr:function(E){var R=Be(E);return R},get64:function(E,R){return E}};function Bp(E){return w?bs(3,1,E):0}function Vp(E,R,H,J,Ae){if(w)return bs(4,1,E,R,H,J,Ae)}function Up(E,R,H,J){if(w)return bs(5,1,E,R,H,J);for(var Ae=0,me=0;me>2],Ie=o()[R+(me*8+4)>>2],gt=0;gt>2]=Ae,0}function vg(E){var R=Te.threadExitHandlers.pop();E&&R()}function wg(E,R){Te.threadExitHandlers.push(function(){Wa.get(E)(R)})}function jp(E){if(w)throw"Internal Error! spawnThread() can only ever be called from main application thread!";var R=Te.getNewWorker();if(R.pthread!==void 0)throw"Internal error!";if(!E.pthread_ptr)throw"Internal error, no pthread ptr!";Te.runningWorkers.push(R);for(var H=ui(128*4),J=0;J<128;++J)o()[H+J*4>>2]=0;var Ae=E.stackBase+E.stackSize,me=Te.pthreads[E.pthread_ptr]={worker:R,stackBase:E.stackBase,stackSize:E.stackSize,allocatedOwnStack:E.allocatedOwnStack,threadInfoStruct:E.pthread_ptr},ye=me.threadInfoStruct>>2;Atomics.store(l(),ye+(64>>2),E.detached),Atomics.store(l(),ye+(100>>2),H),Atomics.store(l(),ye+(40>>2),me.threadInfoStruct),Atomics.store(l(),ye+(80>>2),E.stackSize),Atomics.store(l(),ye+(76>>2),Ae),Atomics.store(l(),ye+(104>>2),E.stackSize),Atomics.store(l(),ye+(104+8>>2),Ae),Atomics.store(l(),ye+(104+12>>2),E.detached);var Ie=v3(),gt=Ie+40;Atomics.store(l(),ye+(172>>2),gt),R.pthread=me;var cn={cmd:"run",start_routine:E.startRoutine,arg:E.arg,threadInfoStruct:E.pthread_ptr,stackBase:E.stackBase,stackSize:E.stackSize};R.runPthread=function(){cn.time=performance.now(),R.postMessage(cn,E.transferList)},R.loaded&&(R.runPthread(),delete R.runPthread)}function kg(E,R,H,J){if(typeof SharedArrayBuffer=="undefined")return q("Current environment does not support SharedArrayBuffer, pthreads are not available!"),6;if(!E)return q("pthread_create called with a null thread pointer!"),28;var Ae=[],me=0;if(w&&(Ae.length===0||me))return S3(687865856,E,R,H,J);if(me)return me;var ye=0,Ie=0,gt=0;R&&R!=-1?(ye=o()[R>>2],ye+=81920,Ie=o()[R+8>>2],gt=o()[R+12>>2]!==0):ye=2097152;var cn=Ie==0;cn?Ie=E3(16,ye):(Ie-=ye,xe(Ie>0));for(var rn=ui(228),ks=0;ks<228>>2;++ks)l()[(rn>>2)+ks]=0;o()[E>>2]=rn,o()[rn+12>>2]=rn;var Oo=rn+152;o()[Oo>>2]=Oo;var Xn={stackBase:Ie,stackSize:ye,allocatedOwnStack:cn,detached:gt,startRoutine:H,pthread_ptr:rn,arg:J,transferList:Ae};return w?(Xn.cmd="spawnThread",postMessage(Xn,Ae)):jp(Xn),0}function Hp(E){if(w)return bs(6,1,E);switch(E){case 30:return 16384;case 85:var R=2147483648;return R/16384;case 132:case 133:case 12:case 137:case 138:case 15:case 235:case 16:case 17:case 18:case 19:case 20:case 149:case 13:case 10:case 236:case 153:case 9:case 21:case 22:case 159:case 154:case 14:case 77:case 78:case 139:case 82:case 68:case 67:case 164:case 11:case 29:case 47:case 48:case 95:case 52:case 51:case 46:return 200809;case 27:case 246:case 127:case 128:case 23:case 24:case 160:case 161:case 181:case 182:case 242:case 183:case 184:case 243:case 244:case 245:case 165:case 178:case 179:case 49:case 50:case 168:case 169:case 175:case 170:case 171:case 172:case 97:case 76:case 32:case 173:case 35:case 80:case 81:case 79:return-1;case 176:case 177:case 7:case 155:case 8:case 157:case 125:case 126:case 92:case 93:case 129:case 130:case 131:case 94:case 91:return 1;case 74:case 60:case 69:case 70:case 4:return 1024;case 31:case 42:case 72:return 32;case 87:case 26:case 33:return 2147483647;case 34:case 1:return 47839;case 38:case 36:return 99;case 43:case 37:return 2048;case 0:return 2097152;case 3:return 65536;case 28:return 32768;case 44:return 32767;case 75:return 16384;case 39:return 1e3;case 89:return 700;case 71:return 256;case 40:return 255;case 2:return 100;case 180:return 64;case 25:return 20;case 5:return 16;case 6:return 6;case 73:return 4;case 84:return typeof navigator=="object"&&navigator.hardwareConcurrency||1}return Hm(28),-1}w||Te.initMainThreadBlock();var vs,Ig=[null,Gm,Wp,Bp,Vp,Up,Hp],Sg={e:Um,r:jm,x:qm,b:Km,y:Xm,j:Zm,c:Ym,d:_u,f:li,p:Jm,z:Qm,u:tg,q:rg,v:hg,i:pg,t:cg,w:bg,m:Bp,n:Vp,g:Up,o:Pp,a:te||d.wasmMemory,k:vg,l:wg,h:kg,s:Hp},x3=Dm(),Gp=d.___wasm_call_ctors=function(){return(Gp=d.___wasm_call_ctors=d.asm.A).apply(null,arguments)},Ng=d._init=function(){return(Ng=d._init=d.asm.B).apply(null,arguments)},Tg=d._register_tensor=function(){return(Tg=d._register_tensor=d.asm.C).apply(null,arguments)},Eg=d._dispose_data=function(){return(Eg=d._dispose_data=d.asm.D).apply(null,arguments)},Cg=d._dispose=function(){return(Cg=d._dispose=d.asm.E).apply(null,arguments)},Mg=d._Abs=function(){return(Mg=d._Abs=d.asm.G).apply(null,arguments)},$g=d._Add=function(){return($g=d._Add=d.asm.H).apply(null,arguments)},Rg=d._AddN=function(){return(Rg=d._AddN=d.asm.I).apply(null,arguments)},Fg=d._All=function(){return(Fg=d._All=d.asm.J).apply(null,arguments)},Og=d._Any=function(){return(Og=d._Any=d.asm.K).apply(null,arguments)},Dg=d._ArgMax=function(){return(Dg=d._ArgMax=d.asm.L).apply(null,arguments)},_g=d._AvgPool=function(){return(_g=d._AvgPool=d.asm.M).apply(null,arguments)},zg=d._BatchMatMul=function(){return(zg=d._BatchMatMul=d.asm.N).apply(null,arguments)},Pg=d._Ceil=function(){return(Pg=d._Ceil=d.asm.O).apply(null,arguments)},Lg=d._ClipByValue=function(){return(Lg=d._ClipByValue=d.asm.P).apply(null,arguments)},Wg=d._Conv2D=function(){return(Wg=d._Conv2D=d.asm.Q).apply(null,arguments)},Bg=d._Conv2DBackpropInput=function(){return(Bg=d._Conv2DBackpropInput=d.asm.R).apply(null,arguments)},Vg=d._Cos=function(){return(Vg=d._Cos=d.asm.S).apply(null,arguments)},Ug=d._CropAndResize=function(){return(Ug=d._CropAndResize=d.asm.T).apply(null,arguments)},jg=d._Cumsum=function(){return(jg=d._Cumsum=d.asm.U).apply(null,arguments)},Hg=d._DepthToSpace=function(){return(Hg=d._DepthToSpace=d.asm.V).apply(null,arguments)},Gg=d._DepthwiseConv2dNative=function(){return(Gg=d._DepthwiseConv2dNative=d.asm.W).apply(null,arguments)},qp=d._Equal=function(){return(qp=d._Equal=d.asm.X).apply(null,arguments)},Kp=d._Exp=function(){return(Kp=d._Exp=d.asm.Y).apply(null,arguments)},Xp=d._FlipLeftRight=function(){return(Xp=d._FlipLeftRight=d.asm.Z).apply(null,arguments)},Wu=d._Floor=function(){return(Wu=d._Floor=d.asm._).apply(null,arguments)},Co=d._FloorDiv=function(){return(Co=d._FloorDiv=d.asm.$).apply(null,arguments)},qg=d._FusedBatchNorm=function(){return(qg=d._FusedBatchNorm=d.asm.aa).apply(null,arguments)},Bu=d._FusedConv2D=function(){return(Bu=d._FusedConv2D=d.asm.ba).apply(null,arguments)},ne=d._FusedDepthwiseConv2D=function(){return(ne=d._FusedDepthwiseConv2D=d.asm.ca).apply(null,arguments)},oe=d._Gather=function(){return(oe=d._Gather=d.asm.da).apply(null,arguments)},Oe=d._GatherNd=function(){return(Oe=d._GatherNd=d.asm.ea).apply(null,arguments)},ut=d._Greater=function(){return(ut=d._Greater=d.asm.fa).apply(null,arguments)},Ht=d._GreaterEqual=function(){return(Ht=d._GreaterEqual=d.asm.ga).apply(null,arguments)},Dt=d._LeakyRelu=function(){return(Dt=d._LeakyRelu=d.asm.ha).apply(null,arguments)},et=d._Less=function(){return(et=d._Less=d.asm.ia).apply(null,arguments)},tt=d._LessEqual=function(){return(tt=d._LessEqual=d.asm.ja).apply(null,arguments)},kn=d._Log=function(){return(kn=d._Log=d.asm.ka).apply(null,arguments)},Hr=d._LogicalAnd=function(){return(Hr=d._LogicalAnd=d.asm.la).apply(null,arguments)},Gr=d._Max=function(){return(Gr=d._Max=d.asm.ma).apply(null,arguments)},Zp=d._MaxPool=function(){return(Zp=d._MaxPool=d.asm.na).apply(null,arguments)},Vu=d._Maximum=function(){return(Vu=d._Maximum=d.asm.oa).apply(null,arguments)},va=d._Mean=function(){return(va=d._Mean=d.asm.pa).apply(null,arguments)},ws=d._Min=function(){return(ws=d._Min=d.asm.qa).apply(null,arguments)},Yp=d._Minimum=function(){return(Yp=d._Minimum=d.asm.ra).apply(null,arguments)},h$=d._MirrorPad=function(){return(h$=d._MirrorPad=d.asm.sa).apply(null,arguments)},p$=d._Multiply=function(){return(p$=d._Multiply=d.asm.ta).apply(null,arguments)},c$=d._Neg=function(){return(c$=d._Neg=d.asm.ua).apply(null,arguments)},f$=d._NonMaxSuppressionV3=function(){return(f$=d._NonMaxSuppressionV3=d.asm.va).apply(null,arguments)},m$=d._NonMaxSuppressionV4=function(){return(m$=d._NonMaxSuppressionV4=d.asm.wa).apply(null,arguments)},g$=d._NonMaxSuppressionV5=function(){return(g$=d._NonMaxSuppressionV5=d.asm.xa).apply(null,arguments)},y$=d._NotEqual=function(){return(y$=d._NotEqual=d.asm.ya).apply(null,arguments)},A$=d._OneHot=function(){return(A$=d._OneHot=d.asm.za).apply(null,arguments)},x$=d._PadV2=function(){return(x$=d._PadV2=d.asm.Aa).apply(null,arguments)},b$=d._Pow=function(){return(b$=d._Pow=d.asm.Ba).apply(null,arguments)},v$=d._Prelu=function(){return(v$=d._Prelu=d.asm.Ca).apply(null,arguments)},w$=d._Prod=function(){return(w$=d._Prod=d.asm.Da).apply(null,arguments)},k$=d._RealDiv=function(){return(k$=d._RealDiv=d.asm.Ea).apply(null,arguments)},I$=d._Relu=function(){return(I$=d._Relu=d.asm.Fa).apply(null,arguments)},S$=d._Relu6=function(){return(S$=d._Relu6=d.asm.Ga).apply(null,arguments)},N$=d._ResizeBilinear=function(){return(N$=d._ResizeBilinear=d.asm.Ha).apply(null,arguments)},T$=d._Reverse=function(){return(T$=d._Reverse=d.asm.Ia).apply(null,arguments)},E$=d._RotateWithOffset=function(){return(E$=d._RotateWithOffset=d.asm.Ja).apply(null,arguments)},C$=d._Round=function(){return(C$=d._Round=d.asm.Ka).apply(null,arguments)},M$=d._Rsqrt=function(){return(M$=d._Rsqrt=d.asm.La).apply(null,arguments)},$$=d._ScatterNd=function(){return($$=d._ScatterNd=d.asm.Ma).apply(null,arguments)},R$=d._SelectV2=function(){return(R$=d._SelectV2=d.asm.Na).apply(null,arguments)},F$=d._Sigmoid=function(){return(F$=d._Sigmoid=d.asm.Oa).apply(null,arguments)},O$=d._Sin=function(){return(O$=d._Sin=d.asm.Pa).apply(null,arguments)},D$=d._Softmax=function(){return(D$=d._Softmax=d.asm.Qa).apply(null,arguments)},_$=d._Sqrt=function(){return(_$=d._Sqrt=d.asm.Ra).apply(null,arguments)},z$=d._Square=function(){return(z$=d._Square=d.asm.Sa).apply(null,arguments)},P$=d._SquaredDifference=function(){return(P$=d._SquaredDifference=d.asm.Ta).apply(null,arguments)},L$=d._Step=function(){return(L$=d._Step=d.asm.Ua).apply(null,arguments)},W$=d._StridedSlice=function(){return(W$=d._StridedSlice=d.asm.Va).apply(null,arguments)},B$=d._Sub=function(){return(B$=d._Sub=d.asm.Wa).apply(null,arguments)},V$=d._Sum=function(){return(V$=d._Sum=d.asm.Xa).apply(null,arguments)},U$=d._Tan=function(){return(U$=d._Tan=d.asm.Ya).apply(null,arguments)},j$=d._Tanh=function(){return(j$=d._Tanh=d.asm.Za).apply(null,arguments)},H$=d._Tile=function(){return(H$=d._Tile=d.asm._a).apply(null,arguments)},G$=d._TopK=function(){return(G$=d._TopK=d.asm.$a).apply(null,arguments)},q$=d._Transform=function(){return(q$=d._Transform=d.asm.ab).apply(null,arguments)},K$=d._Transpose=function(){return(K$=d._Transpose=d.asm.bb).apply(null,arguments)},X$=d.__FusedMatMul=function(){return(X$=d.__FusedMatMul=d.asm.cb).apply(null,arguments)},ui=d._malloc=function(){return(ui=d._malloc=d.asm.db).apply(null,arguments)},Uu=d._free=function(){return(Uu=d._free=d.asm.eb).apply(null,arguments)},b3=d.___errno_location=function(){return(b3=d.___errno_location=d.asm.fb).apply(null,arguments)},v3=d._emscripten_get_global_libc=function(){return(v3=d._emscripten_get_global_libc=d.asm.gb).apply(null,arguments)},Mo=d._pthread_self=function(){return(Mo=d._pthread_self=d.asm.hb).apply(null,arguments)},w3=d.___pthread_tsd_run_dtors=function(){return(w3=d.___pthread_tsd_run_dtors=d.asm.ib).apply(null,arguments)},Kg=d._emscripten_main_thread_process_queued_calls=function(){return(Kg=d._emscripten_main_thread_process_queued_calls=d.asm.jb).apply(null,arguments)},Z$=d._emscripten_current_thread_process_queued_calls=function(){return(Z$=d._emscripten_current_thread_process_queued_calls=d.asm.kb).apply(null,arguments)},k3=d._emscripten_register_main_browser_thread_id=function(){return(k3=d._emscripten_register_main_browser_thread_id=d.asm.lb).apply(null,arguments)},I3=d.__emscripten_do_dispatch_to_thread=function(){return(I3=d.__emscripten_do_dispatch_to_thread=d.asm.mb).apply(null,arguments)},S3=d._emscripten_sync_run_in_main_thread_4=function(){return(S3=d._emscripten_sync_run_in_main_thread_4=d.asm.nb).apply(null,arguments)},N3=d._emscripten_run_in_main_runtime_thread_js=function(){return(N3=d._emscripten_run_in_main_runtime_thread_js=d.asm.ob).apply(null,arguments)},Xg=d.__emscripten_call_on_thread=function(){return(Xg=d.__emscripten_call_on_thread=d.asm.pb).apply(null,arguments)},Y$=d._emscripten_tls_init=function(){return(Y$=d._emscripten_tls_init=d.asm.qb).apply(null,arguments)},Zg=d.__emscripten_thread_init=function(){return(Zg=d.__emscripten_thread_init=d.asm.rb).apply(null,arguments)},ju=d.stackSave=function(){return(ju=d.stackSave=d.asm.sb).apply(null,arguments)},$o=d.stackRestore=function(){return($o=d.stackRestore=d.asm.tb).apply(null,arguments)},Ro=d.stackAlloc=function(){return(Ro=d.stackAlloc=d.asm.ub).apply(null,arguments)},T3=d._emscripten_stack_set_limits=function(){return(T3=d._emscripten_stack_set_limits=d.asm.vb).apply(null,arguments)},E3=d._memalign=function(){return(E3=d._memalign=d.asm.wb).apply(null,arguments)},C3=d.__emscripten_allow_main_runtime_queued_calls=9808,Fo=d.__emscripten_main_thread_futex=11432;d.cwrap=We,d.PThread=Te,d.PThread=Te,d.wasmMemory=te,d.ExitStatus=Hu;var Jp;function Hu(E){this.name="ExitStatus",this.message="Program terminated with exit("+E+")",this.status=E}oi=function E(){Jp||Yg(),Jp||(oi=E)};function Yg(E){if(E=E||f,Ur>0)return;if(w){h(d),Du(),postMessage({cmd:"loaded"});return}if(Em(),Ur>0)return;function R(){Jp||(Jp=!0,d.calledRun=!0,!he&&(Du(),Cm(),h(d),d.onRuntimeInitialized&&d.onRuntimeInitialized(),qn()))}d.setStatus?(d.setStatus("Running..."),setTimeout(function(){setTimeout(function(){d.setStatus("")},1),R()},1)):R()}d.run=Yg;function J$(E,R){if(!(R&&de&&E===0)){if(!R&&w)throw postMessage({cmd:"exitProcess",returnCode:E}),new Hu(E);de||(Te.terminateAllThreads(),ve=E,Rp(),d.onExit&&d.onExit(E),he=!0),y(E,new Hu(E))}}if(d.preInit)for(typeof d.preInit=="function"&&(d.preInit=[d.preInit]);d.preInit.length>0;)d.preInit.pop()();return w&&(de=!1,Te.initWorker()),Yg(),r.ready}}();typeof e=="object"&&typeof t=="object"?t.exports=n:typeof define=="function"&&define.amd?define([],function(){return n}):typeof e=="object"&&(e.WasmBackendModuleThreadedSimd=n)}),SR=_t((e,t)=>{var n=function(){var a=typeof document!="undefined"&&document.currentScript?document.currentScript.src:void 0;return typeof __filename!="undefined"&&(a=a||__filename),function(r){r=r||{};var s=typeof r!="undefined"?r:{},i,o;s.ready=new Promise(function(ne,oe){i=ne,o=oe});var l={},u;for(u in s)s.hasOwnProperty(u)&&(l[u]=s[u]);var d=[],h="./this.program",p=function(ne,oe){throw oe},c=!1,m=!1,f=!1,g=!1;c=typeof window=="object",m=typeof importScripts=="function",f=typeof process=="object"&&typeof process.versions=="object"&&typeof process.versions.node=="string",g=!c&&!f&&!m;var y="";function A(ne){return s.locateFile?s.locateFile(ne,y):y+ne}var x,v,b,w,I,T;f?(m?y=Gu().dirname(y)+"/":y=__dirname+"/",x=function(ne,oe){return I||(I=di("fs")),T||(T=Gu()),ne=T.normalize(ne),I.readFileSync(ne,oe?null:"utf8")},b=function(ne){var oe=x(ne,!0);return oe.buffer||(oe=new Uint8Array(oe)),X(oe.buffer),oe},process.argv.length>1&&(h=process.argv[1].replace(/\\/g,"/")),d=process.argv.slice(2),process.on("uncaughtException",function(ne){if(!(ne instanceof qg))throw ne}),process.on("unhandledRejection",wr),p=function(ne){process.exit(ne)},s.inspect=function(){return"[Emscripten Module object]"}):g?(typeof read!="undefined"&&(x=function(ne){return read(ne)}),b=function(ne){var oe;return typeof readbuffer=="function"?new Uint8Array(readbuffer(ne)):(oe=read(ne,"binary"),X(typeof oe=="object"),oe)},typeof scriptArgs!="undefined"?d=scriptArgs:typeof arguments!="undefined"&&(d=arguments),typeof quit=="function"&&(p=function(ne){quit(ne)}),typeof print!="undefined"&&(typeof console=="undefined"&&(console={}),console.log=print,console.warn=console.error=typeof printErr!="undefined"?printErr:print)):(c||m)&&(m?y=self.location.href:typeof document!="undefined"&&document.currentScript&&(y=document.currentScript.src),a&&(y=a),y.indexOf("blob:")!==0?y=y.substr(0,y.lastIndexOf("/")+1):y="",x=function(ne){var oe=new XMLHttpRequest;return oe.open("GET",ne,!1),oe.send(null),oe.responseText},m&&(b=function(ne){var oe=new XMLHttpRequest;return oe.open("GET",ne,!1),oe.responseType="arraybuffer",oe.send(null),new Uint8Array(oe.response)}),v=function(ne,oe,Oe){var ut=new XMLHttpRequest;ut.open("GET",ne,!0),ut.responseType="arraybuffer",ut.onload=function(){if(ut.status==200||ut.status==0&&ut.response){oe(ut.response);return}Oe()},ut.onerror=Oe,ut.send(null)},w=function(ne){document.title=ne});var C=s.print||console.log.bind(console),z=s.printErr||console.warn.bind(console);for(u in l)l.hasOwnProperty(u)&&(s[u]=l[u]);l=null,s.arguments&&(d=s.arguments),s.thisProgram&&(h=s.thisProgram),s.quit&&(p=s.quit);var $;s.wasmBinary&&($=s.wasmBinary);var S=s.noExitRuntime||!0;typeof WebAssembly!="object"&&wr("no native wasm support detected");var D,_=!1,W;function X(ne,oe){ne||wr("Assertion failed: "+oe)}function q(ne){var oe=s["_"+ne];return X(oe,"Cannot call unknown function "+ne+", make sure it is exported"),oe}function Q(ne,oe,Oe,ut,Ht){var Dt={string:function(va){var ws=0;if(va!=null&&va!==0){var Yp=(va.length<<2)+1;ws=Wu(Yp),ce(va,ws,Yp)}return ws},array:function(va){var ws=Wu(va.length);return he(va,ws),ws}};function et(va){return oe==="string"?de(va):oe==="boolean"?Boolean(va):va}var tt=q(ne),kn=[],Hr=0;if(ut)for(var Gr=0;Gr=ut);)++Ht;if(Ht-oe>16&&ne.subarray&&ie)return ie.decode(ne.subarray(oe,Ht));for(var Dt="";oe>10,56320|Hr&1023)}}return Dt}function de(ne,oe){return ne?ae(Fe,ne,oe):""}function te(ne,oe,Oe,ut){if(!(ut>0))return 0;for(var Ht=Oe,Dt=Oe+ut-1,et=0;et=55296&&tt<=57343){var kn=ne.charCodeAt(++et);tt=65536+((tt&1023)<<10)|kn&1023}if(tt<=127){if(Oe>=Dt)break;oe[Oe++]=tt}else if(tt<=2047){if(Oe+1>=Dt)break;oe[Oe++]=192|tt>>6,oe[Oe++]=128|tt&63}else if(tt<=65535){if(Oe+2>=Dt)break;oe[Oe++]=224|tt>>12,oe[Oe++]=128|tt>>6&63,oe[Oe++]=128|tt&63}else{if(Oe+3>=Dt)break;oe[Oe++]=240|tt>>18,oe[Oe++]=128|tt>>12&63,oe[Oe++]=128|tt>>6&63,oe[Oe++]=128|tt&63}}return oe[Oe]=0,Oe-Ht}function ce(ne,oe,Oe){return te(ne,Fe,oe,Oe)}function he(ne,oe){Ee.set(ne,oe)}function ve(ne,oe){return ne%oe>0&&(ne+=oe-ne%oe),ne}var xe,Ee,Fe,We,qe,Be,ft,mt,bt;function lt(ne){xe=ne,s.HEAP8=Ee=new Int8Array(ne),s.HEAP16=We=new Int16Array(ne),s.HEAP32=Be=new Int32Array(ne),s.HEAPU8=Fe=new Uint8Array(ne),s.HEAPU16=qe=new Uint16Array(ne),s.HEAPU32=ft=new Uint32Array(ne),s.HEAPF32=mt=new Float32Array(ne),s.HEAPF64=bt=new Float64Array(ne)}var Ct=s.INITIAL_MEMORY||16777216,Je,Hn=[],Bt=[],xa=[],vn=[],Gn=!1;Bt.push({func:function(){Pp()}});function ba(){if(s.preRun)for(typeof s.preRun=="function"&&(s.preRun=[s.preRun]);s.preRun.length;)vr(s.preRun.shift());xs(Hn)}function sa(){Gn=!0,xs(Bt)}function Rn(){xs(xa)}function wn(){if(s.postRun)for(typeof s.postRun=="function"&&(s.postRun=[s.postRun]);s.postRun.length;)Wa(s.postRun.shift());xs(vn)}function vr(ne){Hn.unshift(ne)}function Wa(ne){vn.unshift(ne)}var Ba=0,ys=null,Vr=null;function As(ne){Ba++,s.monitorRunDependencies&&s.monitorRunDependencies(Ba)}function So(ne){if(Ba--,s.monitorRunDependencies&&s.monitorRunDependencies(Ba),Ba==0&&(ys!==null&&(clearInterval(ys),ys=null),Vr)){var oe=Vr;Vr=null,oe()}}s.preloadedImages={},s.preloadedAudios={};function wr(ne){s.onAbort&&s.onAbort(ne),ne+="",z(ne),_=!0,W=1,ne="abort("+ne+"). Build with -s ASSERTIONS=1 for more info.";var oe=new WebAssembly.RuntimeError(ne);throw o(oe),oe}function $p(ne,oe){return String.prototype.startsWith?ne.startsWith(oe):ne.indexOf(oe)===0}var Em="data:application/octet-stream;base64,";function Du(ne){return $p(ne,Em)}var Cm="file://";function Rp(ne){return $p(ne,Cm)}var qn="tfjs-backend-wasm.wasm";Du(qn)||(qn=A(qn));function Fp(ne){try{if(ne==qn&&$)return new Uint8Array($);if(b)return b(ne);throw"both async and sync fetching of the wasm failed"}catch(oe){wr(oe)}}function Mm(){if(!$&&(c||m)){if(typeof fetch=="function"&&!Rp(qn))return fetch(qn,{credentials:"same-origin"}).then(function(ne){if(!ne.ok)throw"failed to load wasm binary file at '"+qn+"'";return ne.arrayBuffer()}).catch(function(){return Fp(qn)});if(v)return new Promise(function(ne,oe){v(qn,function(Oe){ne(new Uint8Array(Oe))},oe)})}return Promise.resolve().then(function(){return Fp(qn)})}function Ur(){var ne={a:Dm};function oe(et,tt){var kn=et.exports;s.asm=kn,D=s.asm.i,lt(D.buffer),Je=s.asm.o,So("wasm-instantiate")}As("wasm-instantiate");function Oe(et){oe(et.instance)}function ut(et){return Mm().then(function(tt){return WebAssembly.instantiate(tt,ne)}).then(et,function(tt){z("failed to asynchronously prepare wasm: "+tt),wr(tt)})}function Ht(){return!$&&typeof WebAssembly.instantiateStreaming=="function"&&!Du(qn)&&!Rp(qn)&&typeof fetch=="function"?fetch(qn,{credentials:"same-origin"}).then(function(et){var tt=WebAssembly.instantiateStreaming(et,ne);return tt.then(Oe,function(kn){return z("wasm streaming compile failed: "+kn),z("falling back to ArrayBuffer instantiation"),ut(Oe)})}):ut(Oe)}if(s.instantiateWasm)try{var Dt=s.instantiateWasm(ne,oe);return Dt}catch(et){return z("Module.instantiateWasm callback failed with error: "+et),!1}return Ht().catch(o),{}}function xs(ne){for(;ne.length>0;){var oe=ne.shift();if(typeof oe=="function"){oe(s);continue}var Oe=oe.func;typeof Oe=="number"?oe.arg===void 0?Je.get(Oe)():Je.get(Oe)(oe.arg):Oe(oe.arg===void 0?null:oe.arg)}}function oi(){wr()}function $m(ne,oe,Oe){Fe.copyWithin(ne,oe,oe+Oe)}function Rm(){return Fe.length}function jr(ne){try{return D.grow(ne-xe.byteLength+65535>>>16),lt(D.buffer),1}catch(oe){}}function Op(ne){var oe=Rm(),Oe=2147483648;if(ne>Oe)return!1;for(var ut=1;ut<=4;ut*=2){var Ht=oe*(1+.2/ut);Ht=Math.min(Ht,ne+100663296);var Dt=Math.min(Oe,ve(Math.max(ne,Ht),65536)),et=jr(Dt);if(et)return!0}return!1}var No={mappings:{},buffers:[null,[],[]],printChar:function(ne,oe){var Oe=No.buffers[ne];oe===0||oe===10?((ne===1?C:z)(ae(Oe,0)),Oe.length=0):Oe.push(oe)},varargs:void 0,get:function(){No.varargs+=4;var ne=Be[No.varargs-4>>2];return ne},getStr:function(ne){var oe=de(ne);return oe},get64:function(ne,oe){return ne}};function Dp(ne){return 0}function Fm(ne,oe,Oe,ut,Ht){}function _p(ne,oe,Oe,ut){for(var Ht=0,Dt=0;Dt>2],tt=Be[oe+(Dt*8+4)>>2],kn=0;kn>2]=Ht,0}function Kn(){return 6}function zp(ne){return Be[qp()>>2]=ne,ne}function Om(ne){switch(ne){case 30:return 16384;case 85:var oe=2147483648;return oe/16384;case 132:case 133:case 12:case 137:case 138:case 15:case 235:case 16:case 17:case 18:case 19:case 20:case 149:case 13:case 10:case 236:case 153:case 9:case 21:case 22:case 159:case 154:case 14:case 77:case 78:case 139:case 82:case 68:case 67:case 164:case 11:case 29:case 47:case 48:case 95:case 52:case 51:case 46:return 200809;case 27:case 246:case 127:case 128:case 23:case 24:case 160:case 161:case 181:case 182:case 242:case 183:case 184:case 243:case 244:case 245:case 165:case 178:case 179:case 49:case 50:case 168:case 169:case 175:case 170:case 171:case 172:case 97:case 76:case 32:case 173:case 35:case 80:case 81:case 79:return-1;case 176:case 177:case 7:case 155:case 8:case 157:case 125:case 126:case 92:case 93:case 129:case 130:case 131:case 94:case 91:return 1;case 74:case 60:case 69:case 70:case 4:return 1024;case 31:case 42:case 72:return 32;case 87:case 26:case 33:return 2147483647;case 34:case 1:return 47839;case 38:case 36:return 99;case 43:case 37:return 2048;case 0:return 2097152;case 3:return 65536;case 28:return 32768;case 44:return 32767;case 75:return 16384;case 39:return 1e3;case 89:return 700;case 71:return 256;case 40:return 255;case 2:return 100;case 180:return 64;case 25:return 20;case 5:return 16;case 6:return 6;case 73:return 4;case 84:return typeof navigator=="object"&&navigator.hardwareConcurrency||1}return zp(28),-1}var Dm={a:oi,d:$m,e:Op,f:Dp,c:Fm,b:_p,g:Kn,h:Om},_m=Ur(),Pp=s.___wasm_call_ctors=function(){return(Pp=s.___wasm_call_ctors=s.asm.j).apply(null,arguments)},To=s._init=function(){return(To=s._init=s.asm.k).apply(null,arguments)},_u=s._register_tensor=function(){return(_u=s._register_tensor=s.asm.l).apply(null,arguments)},zm=s._dispose_data=function(){return(zm=s._dispose_data=s.asm.m).apply(null,arguments)},Pm=s._dispose=function(){return(Pm=s._dispose=s.asm.n).apply(null,arguments)},Lm=s._Abs=function(){return(Lm=s._Abs=s.asm.p).apply(null,arguments)},Te=s._Add=function(){return(Te=s._Add=s.asm.q).apply(null,arguments)},Wm=s._AddN=function(){return(Wm=s._AddN=s.asm.r).apply(null,arguments)},Bm=s._All=function(){return(Bm=s._All=s.asm.s).apply(null,arguments)},Vm=s._Any=function(){return(Vm=s._Any=s.asm.t).apply(null,arguments)},Um=s._ArgMax=function(){return(Um=s._ArgMax=s.asm.u).apply(null,arguments)},jm=s._AvgPool=function(){return(jm=s._AvgPool=s.asm.v).apply(null,arguments)},li=s._BatchMatMul=function(){return(li=s._BatchMatMul=s.asm.w).apply(null,arguments)},Hm=s._Ceil=function(){return(Hm=s._Ceil=s.asm.x).apply(null,arguments)},Gm=s._ClipByValue=function(){return(Gm=s._ClipByValue=s.asm.y).apply(null,arguments)},qm=s._Conv2D=function(){return(qm=s._Conv2D=s.asm.z).apply(null,arguments)},Km=s._Conv2DBackpropInput=function(){return(Km=s._Conv2DBackpropInput=s.asm.A).apply(null,arguments)},Xm=s._Cos=function(){return(Xm=s._Cos=s.asm.B).apply(null,arguments)},Zm=s._CropAndResize=function(){return(Zm=s._CropAndResize=s.asm.C).apply(null,arguments)},Ym=s._Cumsum=function(){return(Ym=s._Cumsum=s.asm.D).apply(null,arguments)},Jm=s._DepthToSpace=function(){return(Jm=s._DepthToSpace=s.asm.E).apply(null,arguments)},Qm=s._DepthwiseConv2dNative=function(){return(Qm=s._DepthwiseConv2dNative=s.asm.F).apply(null,arguments)},bs=s._Equal=function(){return(bs=s._Equal=s.asm.G).apply(null,arguments)},zu=s._Exp=function(){return(zu=s._Exp=s.asm.H).apply(null,arguments)},Pu=s._FlipLeftRight=function(){return(Pu=s._FlipLeftRight=s.asm.I).apply(null,arguments)},eg=s._Floor=function(){return(eg=s._Floor=s.asm.J).apply(null,arguments)},tg=s._FloorDiv=function(){return(tg=s._FloorDiv=s.asm.K).apply(null,arguments)},ng=s._FusedBatchNorm=function(){return(ng=s._FusedBatchNorm=s.asm.L).apply(null,arguments)},ag=s._FusedConv2D=function(){return(ag=s._FusedConv2D=s.asm.M).apply(null,arguments)},rg=s._FusedDepthwiseConv2D=function(){return(rg=s._FusedDepthwiseConv2D=s.asm.N).apply(null,arguments)},Xe=s._Gather=function(){return(Xe=s._Gather=s.asm.O).apply(null,arguments)},sg=s._GatherNd=function(){return(sg=s._GatherNd=s.asm.P).apply(null,arguments)},ig=s._Greater=function(){return(ig=s._Greater=s.asm.Q).apply(null,arguments)},og=s._GreaterEqual=function(){return(og=s._GreaterEqual=s.asm.R).apply(null,arguments)},lg=s._LeakyRelu=function(){return(lg=s._LeakyRelu=s.asm.S).apply(null,arguments)},ug=s._Less=function(){return(ug=s._Less=s.asm.T).apply(null,arguments)},dg=s._LessEqual=function(){return(dg=s._LessEqual=s.asm.U).apply(null,arguments)},Lu=s._Log=function(){return(Lu=s._Log=s.asm.V).apply(null,arguments)},Lp=s._LogicalAnd=function(){return(Lp=s._LogicalAnd=s.asm.W).apply(null,arguments)},Wp=s._Max=function(){return(Wp=s._Max=s.asm.X).apply(null,arguments)},hg=s._MaxPool=function(){return(hg=s._MaxPool=s.asm.Y).apply(null,arguments)},pg=s._Maximum=function(){return(pg=s._Maximum=s.asm.Z).apply(null,arguments)},cg=s._Mean=function(){return(cg=s._Mean=s.asm._).apply(null,arguments)},fg=s._Min=function(){return(fg=s._Min=s.asm.$).apply(null,arguments)},mg=s._Minimum=function(){return(mg=s._Minimum=s.asm.aa).apply(null,arguments)},gg=s._MirrorPad=function(){return(gg=s._MirrorPad=s.asm.ba).apply(null,arguments)},yg=s._Multiply=function(){return(yg=s._Multiply=s.asm.ca).apply(null,arguments)},pt=s._Neg=function(){return(pt=s._Neg=s.asm.da).apply(null,arguments)},Ag=s._NonMaxSuppressionV3=function(){return(Ag=s._NonMaxSuppressionV3=s.asm.ea).apply(null,arguments)},xg=s._NonMaxSuppressionV4=function(){return(xg=s._NonMaxSuppressionV4=s.asm.fa).apply(null,arguments)},bg=s._NonMaxSuppressionV5=function(){return(bg=s._NonMaxSuppressionV5=s.asm.ga).apply(null,arguments)},Eo=s._NotEqual=function(){return(Eo=s._NotEqual=s.asm.ha).apply(null,arguments)},Bp=s._OneHot=function(){return(Bp=s._OneHot=s.asm.ia).apply(null,arguments)},Vp=s._PadV2=function(){return(Vp=s._PadV2=s.asm.ja).apply(null,arguments)},Up=s._Pow=function(){return(Up=s._Pow=s.asm.ka).apply(null,arguments)},vg=s._Prelu=function(){return(vg=s._Prelu=s.asm.la).apply(null,arguments)},wg=s._Prod=function(){return(wg=s._Prod=s.asm.ma).apply(null,arguments)},jp=s._RealDiv=function(){return(jp=s._RealDiv=s.asm.na).apply(null,arguments)},kg=s._Relu=function(){return(kg=s._Relu=s.asm.oa).apply(null,arguments)},Hp=s._Relu6=function(){return(Hp=s._Relu6=s.asm.pa).apply(null,arguments)},vs=s._ResizeBilinear=function(){return(vs=s._ResizeBilinear=s.asm.qa).apply(null,arguments)},Ig=s._Reverse=function(){return(Ig=s._Reverse=s.asm.ra).apply(null,arguments)},Sg=s._RotateWithOffset=function(){return(Sg=s._RotateWithOffset=s.asm.sa).apply(null,arguments)},x3=s._Round=function(){return(x3=s._Round=s.asm.ta).apply(null,arguments)},Gp=s._Rsqrt=function(){return(Gp=s._Rsqrt=s.asm.ua).apply(null,arguments)},Ng=s._ScatterNd=function(){return(Ng=s._ScatterNd=s.asm.va).apply(null,arguments)},Tg=s._SelectV2=function(){return(Tg=s._SelectV2=s.asm.wa).apply(null,arguments)},Eg=s._Sigmoid=function(){return(Eg=s._Sigmoid=s.asm.xa).apply(null,arguments)},Cg=s._Sin=function(){return(Cg=s._Sin=s.asm.ya).apply(null,arguments)},Mg=s._Softmax=function(){return(Mg=s._Softmax=s.asm.za).apply(null,arguments)},$g=s._Sqrt=function(){return($g=s._Sqrt=s.asm.Aa).apply(null,arguments)},Rg=s._Square=function(){return(Rg=s._Square=s.asm.Ba).apply(null,arguments)},Fg=s._SquaredDifference=function(){return(Fg=s._SquaredDifference=s.asm.Ca).apply(null,arguments)},Og=s._Step=function(){return(Og=s._Step=s.asm.Da).apply(null,arguments)},Dg=s._StridedSlice=function(){return(Dg=s._StridedSlice=s.asm.Ea).apply(null,arguments)},_g=s._Sub=function(){return(_g=s._Sub=s.asm.Fa).apply(null,arguments)},zg=s._Sum=function(){return(zg=s._Sum=s.asm.Ga).apply(null,arguments)},Pg=s._Tan=function(){return(Pg=s._Tan=s.asm.Ha).apply(null,arguments)},Lg=s._Tanh=function(){return(Lg=s._Tanh=s.asm.Ia).apply(null,arguments)},Wg=s._Tile=function(){return(Wg=s._Tile=s.asm.Ja).apply(null,arguments)},Bg=s._TopK=function(){return(Bg=s._TopK=s.asm.Ka).apply(null,arguments)},Vg=s._Transform=function(){return(Vg=s._Transform=s.asm.La).apply(null,arguments)},Ug=s._Transpose=function(){return(Ug=s._Transpose=s.asm.Ma).apply(null,arguments)},jg=s.__FusedMatMul=function(){return(jg=s.__FusedMatMul=s.asm.Na).apply(null,arguments)},Hg=s._malloc=function(){return(Hg=s._malloc=s.asm.Oa).apply(null,arguments)},Gg=s._free=function(){return(Gg=s._free=s.asm.Pa).apply(null,arguments)},qp=s.___errno_location=function(){return(qp=s.___errno_location=s.asm.Qa).apply(null,arguments)},Kp=s.stackSave=function(){return(Kp=s.stackSave=s.asm.Ra).apply(null,arguments)},Xp=s.stackRestore=function(){return(Xp=s.stackRestore=s.asm.Sa).apply(null,arguments)},Wu=s.stackAlloc=function(){return(Wu=s.stackAlloc=s.asm.Ta).apply(null,arguments)};s.cwrap=ee;var Co;function qg(ne){this.name="ExitStatus",this.message="Program terminated with exit("+ne+")",this.status=ne}Vr=function ne(){Co||Bu(),Co||(Vr=ne)};function Bu(ne){if(ne=ne||d,Ba>0||(ba(),Ba>0))return;function oe(){Co||(Co=!0,s.calledRun=!0,!_&&(sa(),Rn(),i(s),s.onRuntimeInitialized&&s.onRuntimeInitialized(),wn()))}s.setStatus?(s.setStatus("Running..."),setTimeout(function(){setTimeout(function(){s.setStatus("")},1),oe()},1)):oe()}if(s.run=Bu,s.preInit)for(typeof s.preInit=="function"&&(s.preInit=[s.preInit]);s.preInit.length>0;)s.preInit.pop()();return Bu(),r.ready}}();typeof e=="object"&&typeof t=="object"?t.exports=n:typeof define=="function"&&define.amd?define([],function(){return n}):typeof e=="object"&&(e.WasmBackendModule=n)}),NR="3.7.0",TR="3.7.0",ER="3.7.0",CR="3.7.0",MR="3.7.0",$R="3.7.0",RR="3.7.0",FR="3.7.0",OR=1e-7,DR=1e-4,_R=class{constructor(e,t){this.backend=e,this.dataMover=t,this.data=new WeakMap,this.dataIdsCount=0}get(e){return this.data.has(e)||this.dataMover.moveData(this.backend,e),this.data.get(e)}set(e,t){this.dataIdsCount++,this.data.set(e,t)}has(e){return this.data.has(e)}delete(e){return this.dataIdsCount--,this.data.delete(e)}numDataIds(){return this.dataIdsCount}},L3=class{refCount(e){return Va("refCount")}incRef(e){return Va("incRef")}timerAvailable(){return!0}time(e){return Va("time")}read(e){return Va("read")}readSync(e){return Va("readSync")}numDataIds(){return Va("numDataIds")}disposeData(e,t){return Va("disposeData")}write(e,t,n){return Va("write")}move(e,t,n,a,r){return Va("move")}memory(){return Va("memory")}floatPrecision(){return Va("floatPrecision")}epsilon(){return this.floatPrecision()===32?OR:DR}dispose(){return Va("dispose")}};function Va(e){throw new Error(`'${e}' not yet implemented or not found in the registry. This kernel may not be supported by the tfjs backend you have chosen`)}function W3(e){let t=e.length,n=0,a=0;for(;t>0;)a=Math.random()*t|0,t--,n=e[t],e[t]=e[a],e[a]=n}function zR(e,t){if(e.length!==t.length)throw new Error(`Array sizes must match to be shuffled together First array length was ${e.length}Second array length was ${t.length}`);let n=e.length,a,r,s=0;for(;n>0;)s=Math.random()*n|0,n--,a=e[n],r=t[n],e[n]=e[s],t[n]=t[s],e[s]=a,t[s]=r}function qu(e,t,n){return Math.max(e,Math.min(t,n))}function PR(e){return e%2==0?e:e+1}function LR(e){let t=0;for(let n=0;nn+` Shapes ${e} and ${t} must match`)}function hi(e){L(e!=null,()=>"The input to the tensor constructor must be a non-null value.")}function pi(e,t=[],n=!1){if(t==null&&(t=[]),Array.isArray(e)||En(e)&&!n)for(let a=0;a0,n){return new Promise((a,r)=>{let s=0,i=()=>{if(e()){a();return}s++;let o=t(s);if(n!=null&&s>=n){r();return}setTimeout(i,o)};i()})}function qR(e,t){let n=1,a=-1;for(let s=0;s=0)n*=e[s];else if(e[s]===-1){if(a!==-1)throw Error(`Shapes can only have 1 implicit size. Found -1 at dim ${a} and dim ${s}`);a=s}else if(e[s]<0)throw Error(`Shapes can not be < 0. Found ${e[s]} at dim ${s}`);if(a===-1){if(t>0&&t!==n)throw Error(`Size(${t}) must match the product of shape ${e}`);return e}if(n===0)throw Error(`Cannot infer the missing size in [${e}] when there are 0 elements`);if(t%n!=0)throw Error(`The implicit shape can't be a fractional number. Got ${t} / ${n}`);let r=e.slice();return r[a]=t/n,r}function Xu(e,t){let n=t.length;return e=e==null?t.map((a,r)=>r):[].concat(e),L(e.every(a=>a>=-n&&a`All values in axis param must be in range [-${n}, ${n}) but got axis ${e}`),L(e.every(a=>Zn(a)),()=>`All values in axis param must be integers but got axis ${e}`),e.map(a=>a<0?n+a:a)}function B3(e,t){let n=[],a=[],r=t!=null&&Array.isArray(t)&&t.length===0,s=t==null||r?null:Xu(t,e).sort(),i=0;for(let o=0;oo)&&e[o]===1&&(n.push(e[o]),a.push(o)),s[i]<=o&&i++}e[o]!==1&&(n.push(e[o]),a.push(o))}return{newShape:n,keptDims:a}}function V3(e,t){let n=null;if(e==null||e==="float32")n=new Float32Array(t);else if(e==="int32")n=new Int32Array(t);else if(e==="bool")n=new Uint8Array(t);else throw new Error(`Unknown data type ${e}`);return n}function U3(e,t){let n=null;if(e==null||e==="float32")n=new Float32Array(t);else if(e==="int32")n=new Int32Array(t);else if(e==="bool")n=new Uint8Array(t);else if(e==="string")n=new Array(t);else throw new Error(`Unknown data type ${e}`);return n}function j3(e,t){for(let n=0;nt+=n.length),t}function Is(e){return typeof e=="string"||e instanceof String}function q3(e){return typeof e=="boolean"}function K3(e){return typeof e=="number"}function ec(e){return Array.isArray(e)?ec(e[0]):e instanceof Float32Array?"float32":e instanceof Int32Array||e instanceof Uint8Array?"int32":K3(e)?"float32":Is(e)?"string":q3(e)?"bool":"float32"}function Ss(e){return!!(e&&e.constructor&&e.call&&e.apply)}function tc(e,t){for(let n=t;n=0;--a)n[a]=n[a+1]*e[a+1];return n}function X3(e,t,n,a=!1){let r=new Array;if(t.length===1){let s=t[0]*(a?2:1);for(let i=0;il*u)*(a?2:1);for(let l=0;lr*s)*(n?2:1);if(a===0)return[];if(a!==t.length)throw new Error(`[${e}] does not match the input size ${t.length}${n?" for a complex tensor":""}.`);return X3(0,e,t,n)}function ty(e,t){let n=nc(e,t);for(let a=0;aa*r,1);if(t==null||t==="float32")return zo(e,new Float32Array(n));if(t==="int32")return zo(e,new Int32Array(n));if(t==="bool")return zo(e,new Uint8Array(n));throw new Error(`Unknown data type ${t}`)}function ny(e){e.forEach(t=>{L(Number.isInteger(t)&&t>=0,()=>`Tensor must have a shape comprised of positive integers but got shape [${e}].`)})}function ZR(e,t,n){if(t===0)return 0;if(t===1)return e[0];let a=e[e.length-1];for(let r=0;r{let[n,a]=t.split(":");this.urlFlags[n]=eF(n,a)})}};function JR(e){let t={};return e.replace(/[?&]([^=?&]+)(?:=([^&]*))?/g,(n,...a)=>(QR(t,a[0],a[1]),a.join("="))),t}function QR(e,t,n){e[decodeURIComponent(t)]=decodeURIComponent(n||"")}function eF(e,t){if(t=t.toLowerCase(),t==="true"||t==="false")return t==="true";if(`${+t}`===t)return+t;throw new Error(`Could not parse value flag value ${t} for flag ${e}.`)}function ht(){return ka}var ka=null;function tF(e){ka=e}var ry;function J3(){if(ry==null){let e;if(typeof window!="undefined")e=window;else if(typeof global!="undefined")e=global;else if(typeof process!="undefined")e=process;else if(typeof self!="undefined")e=self;else throw new Error("Could not find a global object");ry=e}return ry}function nF(){let e=J3();return e._tfGlobals==null&&(e._tfGlobals=new Map),e._tfGlobals}function sy(e,t){let n=nF();if(n.has(e))return n.get(e);{let a=t();return n.set(e,a),n.get(e)}}var Q3="Abs",ev="Acos",tv="Acosh",iy="Add",nv="AddN",av="All",rv="Any",sv="ArgMax",iv="ArgMin",ov="Asin",lv="Asinh",uv="Atan",dv="Atanh",hv="Atan2",pv="AvgPool",aF="AvgPoolGrad",cv="AvgPool3D",rF="AvgPool3DGrad",fv="BatchMatMul",mv="BatchToSpaceND",gv="Bincount",sF="BroadcastTo",oy="Cast",yv="Ceil",Av="ClipByValue",xv="Complex",bv="ComplexAbs",vv="Concat",wv="Conv2D",kv="Conv2DBackpropFilter",Iv="Conv2DBackpropInput",Sv="Conv3D",iF="Conv3DBackpropFilterV2",Nv="Conv3DBackpropInputV2",Tv="Cos",Ev="Cosh",Cv="Cumsum",Mv="CropAndResize",$v="DenseBincount",Rv="DepthToSpace",Fv="DepthwiseConv2dNative",Ov="DepthwiseConv2dNativeBackpropFilter",Dv="DepthwiseConv2dNativeBackpropInput",_v="Diag",zv="Dilation2D",oF="Dilation2DBackpropInput",lF="Dilation2DBackpropFilter",Pv="RealDiv",Lv="Einsum",Wv="Elu",uF="EluGrad",Bv="Erf",Vv="Equal",Uv="Exp",jv="ExpandDims",Hv="Expm1",Gv="FFT",qv="Fill",Kv="FlipLeftRight",Xv="Floor",Zv="FloorDiv",Yv="FusedBatchNorm",Jv="GatherV2",Qv="GatherNd",ew="Greater",tw="GreaterEqual",ly="Identity",nw="IFFT",aw="Imag",rw="IsFinite",sw="IsInf",iw="IsNan",ow="LeakyRelu",lw="Less",uw="LessEqual",dw="LinSpace",hw="Log",pw="Log1p",cw="LogicalAnd",fw="LogicalNot",mw="LogicalOr",dF="LogSoftmax",gw="LRN",hF="LRNGrad",yw="Max",Aw="Maximum",xw="MaxPool",pF="MaxPoolGrad",bw="MaxPool3D",cF="MaxPool3DGrad",vw="MaxPoolWithArgmax",ww="Mean",kw="Min",Iw="Minimum",Sw="MirrorPad",Nw="Mod",Tw="Multinomial",Ew="Multiply",Cw="Neg",Mw="NotEqual",$w="NonMaxSuppressionV3",Rw="NonMaxSuppressionV4",Fw="NonMaxSuppressionV5",Ow="OnesLike",Dw="OneHot",_w="Pack",zw="PadV2",fF="Pool",Pw="Pow",Lw="Prelu",Ww="Prod",Bw="Range",Vw="Real",Uw="Reciprocal",jw="Relu",Hw="Reshape",Gw="ResizeNearestNeighbor",mF="ResizeNearestNeighborGrad",qw="ResizeBilinear",gF="ResizeBilinearGrad",Kw="Relu6",Xw="Reverse",Zw="Round",Yw="Rsqrt",Jw="ScatterNd",Qw="Select",e7="Selu",t7="Slice",n7="Sin",a7="Sinh",r7="Sign",s7="Sigmoid",i7="Softplus",o7="Sqrt",l7="Sum",u7="SpaceToBatchND",d7="SplitV",h7="Softmax",p7="SparseFillEmptyRows",c7="SparseReshape",f7="SparseSegmentMean",m7="SparseSegmentSum",g7="SparseToDense",y7="SquaredDifference",yF="Square",A7="StridedSlice",x7="StringNGrams",b7="StringSplit",v7="StringToHashBucketFast",w7="Sub",k7="Tan",I7="Tanh",uy="Tile",S7="TopK",N7="Transform",T7="Transpose",E7="Unique",C7="Unpack",M7="UnsortedSegmentSum",$7="ZerosLike",R7="Step",dy="FromPixels",F7="RotateWithOffset",hy="_FusedMatMul",py="FusedConv2D",cy="FusedDepthwiseConv2D",Po=sy("kernelRegistry",()=>new Map),Zu=sy("gradRegistry",()=>new Map);function ac(e,t){let n=my(e,t);return Po.get(n)}function fy(e){return Zu.get(e)}function Lo(e){let t=Po.entries(),n=[];for(;;){let{done:a,value:r}=t.next();if(a)break;let[s,i]=r,[o]=s.split("_");o===e&&n.push(i)}return n}function rc(e){let{kernelName:t,backendName:n}=e,a=my(t,n);Po.has(a)&&console.warn(`The kernel '${t}' for backend '${n}' is already registered`),Po.set(a,e)}function AF(e){let{kernelName:t}=e;Zu.has(t)&&ht().getBool("DEBUG")&&console.warn(`Overriding the gradient for '${t}'`),Zu.set(t,e)}function xF(e,t){let n=my(e,t);if(!Po.has(n))throw new Error(`The kernel '${e}' for backend '${t}' is not registered`);Po.delete(n)}function bF(e){if(!Zu.has(e))throw new Error(`The gradient '${e}' for backend is not registered`);Zu.delete(e)}function vF(e,t){Lo(e).forEach(n=>{let a=Object.assign({},n,{backendName:t});rc(a)})}function my(e,t){return`${t}_${e}`}var O7={};$e(O7,{arraysEqual:()=>Kr,assert:()=>L,assertNonNegativeIntegerDimensions:()=>ny,assertNonNull:()=>hi,assertShapesMatch:()=>On,bytesFromStringArray:()=>G3,bytesPerElement:()=>ey,checkConversionForErrors:()=>j3,clamp:()=>qu,computeStrides:()=>_o,createScalarValue:()=>TF,createShuffledIndices:()=>HR,decodeString:()=>oc,distSquared:()=>BR,encodeString:()=>Qu,fetch:()=>CF,fingerPrint64:()=>NF,flatten:()=>pi,getArrayFromDType:()=>U3,getTypedArrayFromDType:()=>V3,hasEncodingLoss:()=>KR,hexToLong:()=>Yu,indexToLoc:()=>YR,inferDtype:()=>ec,inferFromImplicitShape:()=>qR,isBoolean:()=>q3,isFunction:()=>Ss,isInt:()=>Zn,isNumber:()=>K3,isPromise:()=>ay,isScalarShape:()=>VR,isString:()=>Is,isTypedArray:()=>En,isValidDtype:()=>H3,locToIndex:()=>ZR,makeOnesTypedArray:()=>ty,makeZerosNestedTypedArray:()=>XR,makeZerosTypedArray:()=>nc,nearestDivisor:()=>tc,nearestLargerEven:()=>PR,now:()=>Ju,parseAxisParam:()=>Xu,randUniform:()=>WR,repeatedTry:()=>GR,rightPad:()=>Ku,shuffle:()=>W3,shuffleCombo:()=>zR,sizeFromShape:()=>Jt,sizeToSquarishShape:()=>jR,squeezeShape:()=>B3,sum:()=>LR,tanh:()=>UR,toNestedArray:()=>zo,toTypedArray:()=>ic});var D7=qr(D3()),ci=D7.default||D7;function Yu(e){return ci.fromString(e,!0,16)}var _7=Yu("c3a5c85c97cb3127"),fi=Yu("b492b66fbe98f273"),Dn=Yu("9ae16a3b2f90404f");function gy(e){return e.xor(e.shru(47))}function z7(e,t,n){let a=e.slice(t,t+n);return ci.fromBytes(Array.from(a),!0,!0)}function It(e,t){return z7(e,t,8)}function P7(e,t){return z7(e,t,4)}function fn(e,t){return t===0?e:e.shru(t).or(e.shl(64-t))}function Ns(e,t,n=Yu("9ddfea08eb382d69")){let a=e.xor(t).mul(n);a=a.xor(a.shru(47));let r=t.xor(a).mul(n);return r=r.xor(r.shru(47)),r=r.mul(n),r}function wF(e,t,n,a,r,s){r=r.add(e),s=fn(s.add(r).add(a),21);let i=r;return r=r.add(t),r=r.add(n),s=s.add(fn(r,44)),[r.add(a),s.add(i)]}function sc(e,t,n,a){return wF(It(e,t),It(e,t+8),It(e,t+16),It(e,t+24),n,a)}function kF(e,t=e.length){if(t>=8){let n=Dn.add(t*2),a=It(e,0).add(Dn),r=It(e,t-8),s=fn(r,37).mul(n).add(a),i=fn(a,25).add(r).mul(n);return Ns(s,i,n)}if(t>=4){let n=Dn.add(t*2),a=P7(e,0);return Ns(a.shl(3).add(t),P7(e,t-4),n)}if(t>0){let n=e[0],a=e[t>>1],r=e[t-1],s=n+(a<<8),i=t+(r<<2);return gy(Dn.mul(s).xor(_7.mul(i))).mul(Dn)}return Dn}function IF(e,t=e.length){let n=Dn.add(t*2),a=It(e,0).mul(fi),r=It(e,8),s=It(e,t-8).mul(n),i=It(e,t-16).mul(Dn);return Ns(fn(a.add(r),43).add(fn(s,30)).add(i),a.add(fn(r.add(Dn),18)).add(s),n)}function SF(e,t=e.length){let n=Dn.add(t*2),a=It(e,0).mul(Dn),r=It(e,8),s=It(e,t-8).mul(n),i=It(e,t-16).mul(Dn),o=fn(a.add(r),43).add(fn(s,30)).add(i),l=Ns(o,a.add(fn(r.add(Dn),18)).add(s),n),u=It(e,16).mul(n),d=It(e,24),h=o.add(It(e,t-32)).mul(n),p=l.add(It(e,t-24)).mul(n);return Ns(fn(u.add(d),43).add(fn(h,30)).add(p),u.add(fn(d.add(a),18)).add(h),n)}function NF(e,t=e.length){let n=ci.fromNumber(81,!0);if(t<=32)return t<=16?kF(e,t):IF(e,t);if(t<=64)return SF(e,t);let a=n,r=n.mul(fi).add(113),s=gy(r.mul(Dn).add(113)).mul(Dn),i=[ci.UZERO,ci.UZERO],o=[ci.UZERO,ci.UZERO];a=a.mul(Dn).add(It(e,0));let l=0,u=(t-1>>6)*64,d=u+(t-1&63)-63;do a=fn(a.add(r).add(i[0]).add(It(e,l+8)),37).mul(fi),r=fn(r.add(i[1]).add(It(e,l+48)),42).mul(fi),a=a.xor(o[1]),r=r.add(i[0]).add(It(e,l+40)),s=fn(s.add(o[0]),33).mul(fi),i=sc(e,l,i[1].mul(fi),a.add(o[0])),o=sc(e,l+32,s.add(o[1]),r.add(It(e,l+16))),[s,a]=[a,s],l+=64;while(l!==u);let h=fi.add(s.and(255).shl(1));return l=d,o[0]=o[0].add(t-1&63),i[0]=i[0].add(o[0]),o[0]=o[0].add(i[0]),a=fn(a.add(r).add(i[0]).add(It(e,l+8)),37).mul(h),r=fn(r.add(i[1]).add(It(e,l+48)),42).mul(h),a=a.xor(o[1].mul(9)),r=r.add(i[0].mul(9).add(It(e,l+40))),s=fn(s.add(o[0]),33).mul(h),i=sc(e,l,i[1].mul(h),a.add(o[0])),o=sc(e,l+32,s.add(o[1]),r.add(It(e,l+16))),[s,a]=[a,s],Ns(Ns(i[0],o[0],h).add(gy(r).mul(_7)).add(s),Ns(i[1],o[1],h).add(a),h)}function TF(e,t){return t==="string"?Qu(e):ic([e],t)}function EF(e,t){return e instanceof Float32Array&&t==="float32"||e instanceof Int32Array&&t==="int32"||e instanceof Uint8Array&&t==="bool"}function ic(e,t){if(t==="string")throw new Error("Cannot convert a string[] to a TypedArray");if(Array.isArray(e)&&(e=pi(e)),ht().getBool("DEBUG")&&j3(e,t),EF(e,t))return e;if(t==null||t==="float32"||t==="complex64")return new Float32Array(e);if(t==="int32")return new Int32Array(e);if(t==="bool"){let n=new Uint8Array(e.length);for(let a=0;a{a=n()},s,i=Ju();if(this.backendTimer.timerAvailable())s=this.backendTimer.time(r);else{r();for(let o of a)o.dataSync();s=Promise.resolve({kernelMs:Ju()-i})}if(ht().getBool("CHECK_COMPUTATION_FOR_ERRORS"))for(let o=0;o{$F(u,l.dtype,e)})}return{kernelName:e,outputs:a,inputs:t,timeMs:s.then(o=>o.kernelMs),extraInfo:s.then(o=>o.getExtraProfileInfo!=null?o.getExtraProfileInfo():"")}}logKernelProfile(e){let{kernelName:t,outputs:n,timeMs:a,inputs:r,extraInfo:s}=e;n.forEach(i=>{Promise.all([i.data(),a,s]).then(o=>{this.logger.logKernelProfile(t,i,o[0],o[1],r,o[2])})})}};function $F(e,t,n){if(t!=="float32")return!1;for(let a=0;a0?m:""} `}}console.log(`%c${o} %c${i} %c${l}D ${d} %c${u} %c${h} %c${s}`,"font-weight:bold","color:red","color:blue","color: orange","color: green","color: steelblue")}};function FF(e,t,n){let a={},r={};for(let l=0;la[f.id]=!0),c=!0,r[u.id]=!0;break}if(c)break}}let s={};s[n.id]=!0;let i={};for(let l=e.length-1;l>=0;l--){let u=e[l],d=u.inputs;for(let h=0;h=0;r--){let s=t[r],i=[];if(s.outputs.forEach(l=>{let u=e[l.id];u!=null?i.push(u):i.push(null)}),s.gradient==null)throw new Error(`Cannot compute gradient: gradient function not found for ${s.kernelName}.`);let o=s.gradient(i);for(let l in s.inputs){if(!(l in o))throw new Error(`Cannot backprop through input ${l}. Available gradients found: ${Object.keys(o)}.`);let u=n(()=>o[l]());if(u.dtype!=="float32")throw new Error(`Error in gradient for op ${s.kernelName}. The gradient of input ${l} must have 'float32' dtype, but has '${u.dtype}'`);let d=s.inputs[l];if(!Kr(u.shape,d.shape))throw new Error(`Error in gradient for op ${s.kernelName}. The gradient of input '${l}' has shape '${u.shape}', which does not match the shape of the input '${d.shape}'`);if(e[d.id]==null)e[d.id]=u;else{let h=e[d.id];e[d.id]=a(h,u),h.dispose()}}}}var L7=20,ed=3,yy=7;function DF(e,t,n,a){let r=_o(t),s=_F(e,t,n,r),i=t.length,o=lc(e,t,n,r,s),l=["Tensor"];return a&&(l.push(` dtype: ${n}`),l.push(` rank: ${i}`),l.push(` shape: [${t}]`),l.push(" values:")),l.push(o.map(u=>" "+u).join(` +var Q_=Object.defineProperty;var Qg=e=>{if(typeof require!="undefined")return require(e);throw new Error('Dynamic require of "'+e+'" is not supported')};var _3=(e,t)=>{for(var n in t)Q_(e,n,{get:t[n],enumerable:!0})};var R3=(e,t,n)=>{if(!t.has(e))throw TypeError("Cannot "+n)};var Fn=(e,t,n)=>(R3(e,t,"read from private field"),n?n.call(e):t.get(e)),Ir=(e,t,n)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,n)},Qr=(e,t,n,r)=>(R3(e,t,"write to private field"),r?r.call(e,n):t.set(e,n),n);function $t(e,t){let n=e.endsWith("/")?"":"/",s=t.startsWith(".")||t.startsWith("/")||t.startsWith("http:")||t.startsWith("https:")||t.startsWith("file:")?`${t}`:`${e}${n}${t}`;if(!s.toLocaleLowerCase().includes(".json"))throw new Error(`Human: ModelPath Error: ${s} Expecting JSON file`);return s}function me(...e){let t=new Date,n=`${t.getHours().toString().padStart(2,"0")}:${t.getMinutes().toString().padStart(2,"0")}:${t.getSeconds().toString().padStart(2,"0")}.${t.getMilliseconds().toString().padStart(3,"0")}`;e&&console.log(n,"Human:",...e)}var at=()=>typeof performance!="undefined"?performance.now():parseInt((Number(process.hrtime.bigint())/1e3/1e3).toString());function ir(...e){let t=n=>n&&typeof n=="object";return e.reduce((n,r)=>(Object.keys(r||{}).forEach(s=>{let a=n[s],o=r[s];Array.isArray(a)&&Array.isArray(o)?n[s]=a.concat(...o):t(a)&&t(o)?n[s]=ir(a,o):n[s]=o}),n),{})}var D3={backend:"webgl",modelBasePath:"../models/",wasmPath:"../node_modules/@tensorflow/tfjs-backend-wasm/dist/",debug:!0,async:!0,warmup:"full",cacheSensitivity:.75,skipFrame:!1,filter:{enabled:!0,width:0,height:0,flip:!1,return:!0,brightness:0,contrast:0,sharpness:0,blur:0,saturation:0,hue:0,negative:!1,sepia:!1,vintage:!1,kodachrome:!1,technicolor:!1,polaroid:!1,pixelate:0},gesture:{enabled:!0},face:{enabled:!0,detector:{modelPath:"blazeface.json",rotation:!0,maxDetected:15,skipFrames:15,minConfidence:.2,iouThreshold:.1,return:!1},mesh:{enabled:!0,modelPath:"facemesh.json"},iris:{enabled:!0,modelPath:"iris.json"},description:{enabled:!0,modelPath:"faceres.json",skipFrames:11,minConfidence:.1},emotion:{enabled:!0,minConfidence:.1,skipFrames:17,modelPath:"emotion.json"}},body:{enabled:!0,modelPath:"movenet-lightning.json",maxDetected:1,minConfidence:.2,skipFrames:1},hand:{enabled:!0,rotation:!0,skipFrames:18,minConfidence:.1,iouThreshold:.1,maxDetected:2,landmarks:!0,detector:{modelPath:"handdetect.json"},skeleton:{modelPath:"handskeleton.json"}},object:{enabled:!1,modelPath:"mb3-centernet.json",minConfidence:.2,iouThreshold:.4,maxDetected:10,skipFrames:19},segmentation:{enabled:!1,modelPath:"selfie.json"}};function F3(){let e,t;if(typeof navigator!="undefined"){let n=navigator.userAgent.match(/\(([^()]+)\)/g);if(n&&n[0]){let r=n[0].match(/\(([^()]+)\)/g);e=r?r[0].replace(/\(|\)/g,""):"",t=navigator.userAgent.replace(n[0],""),e[1]&&(t=t.replace(n[1],"")),t=t.replace(/ /g," ")}}else typeof process!="undefined"&&(e=`${process.platform} ${process.arch}`,t=`NodeJS ${process.version}`);return{platform:e,agent:t}}var bh={};_3(bh,{Abs:()=>Q3,Acos:()=>ev,Acosh:()=>tv,AdadeltaOptimizer:()=>Fp,AdagradOptimizer:()=>Mp,AdamOptimizer:()=>Op,AdamaxOptimizer:()=>Pp,Add:()=>i2,AddN:()=>nv,All:()=>rv,Any:()=>sv,ArgMax:()=>av,ArgMin:()=>ov,Asin:()=>iv,Asinh:()=>lv,Atan:()=>uv,Atan2:()=>dv,Atanh:()=>cv,AvgPool:()=>hv,AvgPool3D:()=>pv,AvgPool3DGrad:()=>sD,AvgPoolGrad:()=>rD,BackendWasm:()=>u$,BatchMatMul:()=>fv,BatchToSpaceND:()=>mv,Bincount:()=>gv,BroadcastTo:()=>aD,Callback:()=>z8,CallbackList:()=>TS,Cast:()=>l2,Ceil:()=>yv,ClipByValue:()=>Av,Complex:()=>xv,ComplexAbs:()=>bv,Concat:()=>vv,Conv2D:()=>wv,Conv2DBackpropFilter:()=>kv,Conv2DBackpropInput:()=>Iv,Conv3D:()=>Sv,Conv3DBackpropFilterV2:()=>oD,Conv3DBackpropInputV2:()=>Tv,Cos:()=>Nv,Cosh:()=>Cv,CropAndResize:()=>$v,Cumsum:()=>Ev,CustomCallback:()=>CS,DataStorage:()=>OR,DenseBincount:()=>_v,DepthToSpace:()=>Rv,DepthwiseConv2dNative:()=>Dv,DepthwiseConv2dNativeBackpropFilter:()=>Fv,DepthwiseConv2dNativeBackpropInput:()=>Mv,Diag:()=>Ov,Dilation2D:()=>Pv,Dilation2DBackpropFilter:()=>lD,Dilation2DBackpropInput:()=>iD,ENV:()=>Sr,EarlyStopping:()=>B8,Einsum:()=>Lv,Elu:()=>Bv,EluGrad:()=>uD,Environment:()=>Y3,Equal:()=>Vv,Erf:()=>Wv,Exp:()=>Uv,ExpandDims:()=>Hv,Expm1:()=>Gv,FFT:()=>jv,Fill:()=>qv,FlipLeftRight:()=>Kv,Floor:()=>Xv,FloorDiv:()=>Zv,FromPixels:()=>d2,FusedBatchNorm:()=>Yv,FusedConv2D:()=>p2,FusedDepthwiseConv2D:()=>f2,GPGPUContext:()=>Bm,GatherNd:()=>Qv,GatherV2:()=>Jv,GraphModel:()=>AT,Greater:()=>ew,GreaterEqual:()=>tw,History:()=>NS,IFFT:()=>nw,Identity:()=>u2,Imag:()=>rw,InputSpec:()=>tn,IsFinite:()=>sw,IsInf:()=>aw,IsNan:()=>ow,KernelBackend:()=>L3,LRN:()=>gw,LRNGrad:()=>dD,LayerVariable:()=>vS,LayersModel:()=>pa,LeakyRelu:()=>iw,Less:()=>lw,LessEqual:()=>uw,LinSpace:()=>cw,Log:()=>dw,Log1p:()=>hw,LogSoftmax:()=>cD,LogicalAnd:()=>pw,LogicalNot:()=>fw,LogicalOr:()=>mw,MathBackendCPU:()=>$5,MathBackendWebGL:()=>dh,Max:()=>yw,MaxPool:()=>xw,MaxPool3D:()=>bw,MaxPool3DGrad:()=>pD,MaxPoolGrad:()=>hD,MaxPoolWithArgmax:()=>vw,Maximum:()=>Aw,Mean:()=>ww,Min:()=>kw,Minimum:()=>Iw,MirrorPad:()=>Sw,Mod:()=>Tw,MomentumOptimizer:()=>zp,Multinomial:()=>Nw,Multiply:()=>Cw,Neg:()=>Ew,NonMaxSuppressionV3:()=>_w,NonMaxSuppressionV4:()=>Rw,NonMaxSuppressionV5:()=>Dw,NotEqual:()=>$w,OP_SCOPE_SUFFIX:()=>Z7,OneHot:()=>Mw,OnesLike:()=>Fw,Optimizer:()=>Ra,Pack:()=>Ow,PadV2:()=>Pw,Pool:()=>fD,Pow:()=>zw,Prelu:()=>Lw,Prod:()=>Bw,RMSPropOptimizer:()=>Lp,RNN:()=>fa,Range:()=>Ww,Rank:()=>x2,Real:()=>Vw,RealDiv:()=>zv,Reciprocal:()=>Uw,Reduction:()=>Pn,Relu:()=>Hw,Relu6:()=>Kw,Reshape:()=>Gw,ResizeBilinear:()=>qw,ResizeBilinearGrad:()=>gD,ResizeNearestNeighbor:()=>jw,ResizeNearestNeighborGrad:()=>mD,Reverse:()=>Xw,RotateWithOffset:()=>D7,Round:()=>Zw,Rsqrt:()=>Yw,SGDOptimizer:()=>mc,ScatterNd:()=>Jw,Select:()=>Qw,Selu:()=>e7,Sequential:()=>pm,Sigmoid:()=>a7,Sign:()=>s7,Sin:()=>n7,Sinh:()=>r7,Slice:()=>t7,Softmax:()=>d7,Softplus:()=>o7,SpaceToBatchND:()=>u7,SparseFillEmptyRows:()=>h7,SparseReshape:()=>p7,SparseSegmentMean:()=>f7,SparseSegmentSum:()=>m7,SparseToDense:()=>g7,SplitV:()=>c7,Sqrt:()=>i7,Square:()=>yD,SquaredDifference:()=>y7,Step:()=>R7,StridedSlice:()=>A7,StringNGrams:()=>x7,StringSplit:()=>b7,StringToHashBucketFast:()=>v7,Sub:()=>w7,Sum:()=>l7,SymbolicTensor:()=>ps,Tan:()=>k7,Tanh:()=>I7,Tensor:()=>Tt,TensorBuffer:()=>up,Tile:()=>c2,TopK:()=>S7,Transform:()=>T7,Transpose:()=>N7,Unique:()=>C7,Unpack:()=>E7,UnsortedSegmentSum:()=>$7,Variable:()=>rc,ZerosLike:()=>_7,_FusedMatMul:()=>h2,abs:()=>Nr,acos:()=>PM,acosh:()=>LM,add:()=>Me,addN:()=>X2,all:()=>VM,any:()=>HM,argMax:()=>Z2,argMin:()=>qM,asin:()=>XM,asinh:()=>YM,atan:()=>QM,atan2:()=>tO,atanh:()=>rO,avgPool:()=>Bk,avgPool3d:()=>pO,backend:()=>EM,backend_util:()=>E4,basicLSTMCell:()=>xO,batchNorm:()=>Ap,batchNorm2d:()=>IO,batchNorm3d:()=>TO,batchNorm4d:()=>CO,batchToSpaceND:()=>Wk,bincount:()=>Vk,booleanMaskAsync:()=>PB,broadcastTo:()=>xp,browser:()=>Hr,buffer:()=>Ys,callbacks:()=>_re,cast:()=>Pt,ceil:()=>RO,clipByValue:()=>FO,clone:()=>Js,complex:()=>go,concat:()=>an,concat1d:()=>OO,concat2d:()=>lc,concat3d:()=>LO,concat4d:()=>WO,constraints:()=>eS,conv1d:()=>HO,conv2d:()=>bp,conv2dTranspose:()=>qO,conv3d:()=>XO,conv3dTranspose:()=>QO,copyRegisteredKernels:()=>vD,cos:()=>tP,cosh:()=>rP,cosineWindow:()=>cy,cumsum:()=>aP,customGrad:()=>Ns,data:()=>xT,denseBincount:()=>iP,deprecationWarn:()=>Fk,depthToSpace:()=>uP,depthwiseConv2d:()=>ey,deregisterOp:()=>Dre,device_util:()=>j7,diag:()=>hP,dilation2d:()=>fP,disableDeprecationWarnings:()=>AM,dispose:()=>Ve,disposeVariables:()=>xM,div:()=>Qe,divNoNan:()=>bP,dot:()=>wP,dropout:()=>ZB,einsum:()=>IP,elu:()=>jk,enableDebugMode:()=>yM,enableProdMode:()=>gM,enclosingPowerOfTwo:()=>b4,engine:()=>bM,env:()=>ct,equal:()=>Gk,erf:()=>NP,exp:()=>wo,expandDims:()=>ea,expm1:()=>_P,eye:()=>qk,fft:()=>iy,fill:()=>wp,findBackend:()=>q2,findBackendFactory:()=>CM,floor:()=>Kk,floorDiv:()=>Ok,forceHalfFloat:()=>bE,fused:()=>v4,gather:()=>Xk,gatherND:()=>qB,gather_util:()=>mk,getBackend:()=>TM,getGradient:()=>m2,getKernel:()=>rp,getKernelsForBackend:()=>Li,gpgpu_util:()=>vC,grad:()=>ez,grads:()=>tz,greater:()=>kp,greaterEqual:()=>Zk,ifft:()=>Ep,imag:()=>ty,image:()=>Ye,inTopKAsync:()=>JB,initializers:()=>iS,input:()=>YS,io:()=>ik,irfft:()=>f4,isFinite:()=>BP,isInf:()=>VP,isNaN:()=>HP,keep:()=>Mk,kernel_impls:()=>D4,layers:()=>AS,leakyRelu:()=>Yk,less:()=>qP,lessEqual:()=>ny,linalg:()=>PV,linspace:()=>XP,loadGraphModel:()=>Et,loadLayersModel:()=>Vte,localResponseNormalization:()=>YP,log:()=>uc,log1p:()=>Jk,logSigmoid:()=>iz,logSoftmax:()=>hz,logSumExp:()=>n4,logicalAnd:()=>Sp,logicalNot:()=>r4,logicalOr:()=>s4,logicalXor:()=>kz,losses:()=>zV,matMul:()=>yt,math:()=>pk,max:()=>_a,maxPool:()=>a4,maxPool3d:()=>Tz,maxPoolWithArgmax:()=>Cz,maximum:()=>o4,mean:()=>Tp,memory:()=>vM,meshgrid:()=>_z,metrics:()=>M8,min:()=>sy,minimum:()=>i4,mirrorPad:()=>Mz,mod:()=>Pz,model:()=>Bte,models:()=>O8,moments:()=>Bz,movingAverage:()=>BB,mul:()=>fe,multiRNNCell:()=>Vz,multinomial:()=>Hz,neg:()=>$a,nextFrame:()=>UV,norm:()=>uy,notEqual:()=>l4,oneHot:()=>B2,ones:()=>ko,onesLike:()=>qz,op:()=>H,outerProduct:()=>Xz,pad:()=>dc,pad1d:()=>Jz,pad2d:()=>eL,pad3d:()=>nL,pad4d:()=>sL,pool:()=>uL,pow:()=>hc,prelu:()=>c4,print:()=>ok,prod:()=>pL,profile:()=>wM,rand:()=>mL,randomGamma:()=>xL,randomNormal:()=>vL,randomUniform:()=>d4,range:()=>pc,ready:()=>SM,real:()=>Np,reciprocal:()=>SL,registerBackend:()=>K2,registerCallbackConstructor:()=>Ute,registerGradient:()=>AD,registerKernel:()=>sp,registerOp:()=>Rre,regularizers:()=>P8,relu:()=>Cp,relu6:()=>h4,removeBackend:()=>NM,reshape:()=>ue,reverse:()=>Io,reverse1d:()=>$L,reverse2d:()=>RL,reverse3d:()=>FL,reverse4d:()=>OL,rfft:()=>ly,round:()=>p4,rsqrt:()=>LL,scalar:()=>ut,scatterND:()=>VB,scatter_util:()=>yk,selu:()=>WL,separableConv2d:()=>UL,sequential:()=>Wte,serialization:()=>Ek,setBackend:()=>IM,setPlatform:()=>$M,setWasmPath:()=>Nve,setWasmPaths:()=>Cve,setWebGLContext:()=>Dm,setdiff1dAsync:()=>GL,shared:()=>UT,sigmoid:()=>Ts,sign:()=>qL,signal:()=>OV,sin:()=>XL,sinh:()=>YL,slice:()=>Ze,slice1d:()=>QL,slice2d:()=>tB,slice3d:()=>rB,slice4d:()=>aB,slice_util:()=>U2,softmax:()=>iB,softplus:()=>e4,spaceToBatchND:()=>u4,sparse:()=>LV,sparseToDense:()=>GB,spectral:()=>MV,split:()=>ta,sqrt:()=>na,square:()=>ns,squaredDifference:()=>m4,squeeze:()=>Zn,stack:()=>So,step:()=>g4,stridedSlice:()=>xB,string:()=>BV,sub:()=>He,sum:()=>_t,sumOutType:()=>UD,tan:()=>vB,tanh:()=>Q2,tensor:()=>ts,tensor1d:()=>lr,tensor2d:()=>ra,tensor3d:()=>mp,tensor4d:()=>wB,tensor5d:()=>kB,tensor6d:()=>IB,tensor_util:()=>W7,test_util:()=>_k,tidy:()=>Ue,tile:()=>vp,time:()=>kM,topk:()=>TB,train:()=>WV,transpose:()=>fp,truncatedNormal:()=>CB,unique:()=>$B,unregisterGradient:()=>bD,unregisterKernel:()=>xD,unsortedSegmentSum:()=>RB,unstack:()=>fc,upcastType:()=>cp,util:()=>F7,valueAndGrad:()=>nz,valueAndGrads:()=>rz,variable:()=>FB,variableGrads:()=>Qk,version:()=>_ve,version_converter:()=>Ose,version_core:()=>mM,version_cpu:()=>yoe,version_layers:()=>ex,version_wasm:()=>Eve,version_webgl:()=>pfe,webgl:()=>ffe,webgl_util:()=>XN,where:()=>Gi,whereAsync:()=>A4,zeros:()=>ji,zerosLike:()=>Cr});var eR=Object.create,Qh=Object.defineProperty,tR=Object.getOwnPropertyDescriptor,nR=Object.getOwnPropertyNames,rR=Object.getPrototypeOf,sR=Object.prototype.hasOwnProperty,aR=e=>Qh(e,"__esModule",{value:!0}),co=e=>{if(typeof Qg!="undefined")return Qg(e);throw new Error('Dynamic require of "'+e+'" is not supported')},Ot=(e,t)=>function(){return t||(0,e[Object.keys(e)[0]])((t={exports:{}}).exports,t),t.exports},De=(e,t)=>{for(var n in t)Qh(e,n,{get:t[n],enumerable:!0})},oR=(e,t,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of nR(t))!sR.call(e,r)&&r!=="default"&&Qh(e,r,{get:()=>t[r],enumerable:!(n=tR(t,r))||n.enumerable});return e},Ks=e=>oR(aR(Qh(e!=null?eR(rR(e)):{},"default",e&&e.__esModule&&"default"in e?{get:()=>e.default,enumerable:!0}:{value:e,enumerable:!0})),e),M3=Ot({"node_modules/.pnpm/long@4.0.0/node_modules/long/src/long.js"(e,t){t.exports=r;var n=null;try{n=new WebAssembly.Instance(new WebAssembly.Module(new Uint8Array([0,97,115,109,1,0,0,0,1,13,2,96,0,1,127,96,4,127,127,127,127,1,127,3,7,6,0,1,1,1,1,1,6,6,1,127,1,65,0,11,7,50,6,3,109,117,108,0,1,5,100,105,118,95,115,0,2,5,100,105,118,95,117,0,3,5,114,101,109,95,115,0,4,5,114,101,109,95,117,0,5,8,103,101,116,95,104,105,103,104,0,0,10,191,1,6,4,0,35,0,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,126,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,127,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,128,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,129,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,130,34,4,66,32,135,167,36,0,32,4,167,11])),{}).exports}catch(R){}function r(R,N,F){this.low=R|0,this.high=N|0,this.unsigned=!!F}r.prototype.__isLong__,Object.defineProperty(r.prototype,"__isLong__",{value:!0});function s(R){return(R&&R.__isLong__)===!0}r.isLong=s;var a={},o={};function i(R,N){var F,B,j;return N?(R>>>=0,(j=0<=R&&R<256)&&(B=o[R],B)?B:(F=u(R,(R|0)<0?-1:0,!0),j&&(o[R]=F),F)):(R|=0,(j=-128<=R&&R<128)&&(B=a[R],B)?B:(F=u(R,R<0?-1:0,!1),j&&(a[R]=F),F))}r.fromInt=i;function l(R,N){if(isNaN(R))return N?b:x;if(N){if(R<0)return b;if(R>=g)return C}else{if(R<=-y)return M;if(R+1>=y)return T}return R<0?l(-R,N).neg():u(R%m|0,R/m|0,N)}r.fromNumber=l;function u(R,N,F){return new r(R,N,F)}r.fromBits=u;var c=Math.pow;function d(R,N,F){if(R.length===0)throw Error("empty string");if(R==="NaN"||R==="Infinity"||R==="+Infinity"||R==="-Infinity")return x;if(typeof N=="number"?(F=N,N=!1):N=!!N,F=F||10,F<2||360)throw Error("interior hyphen");if(B===0)return d(R.substring(1),N,F).neg();for(var j=l(c(F,8)),X=x,Y=0;Y>>0:this.low},$.toNumber=function(){return this.unsigned?(this.high>>>0)*m+(this.low>>>0):this.high*m+(this.low>>>0)},$.toString=function(N){if(N=N||10,N<2||36>>0,ie=se.toString(N);if(Y=oe,Y.isZero())return ie+ee;for(;ie.length<6;)ie="0"+ie;ee=""+ie+ee}},$.getHighBits=function(){return this.high},$.getHighBitsUnsigned=function(){return this.high>>>0},$.getLowBits=function(){return this.low},$.getLowBitsUnsigned=function(){return this.low>>>0},$.getNumBitsAbs=function(){if(this.isNegative())return this.eq(M)?64:this.neg().getNumBitsAbs();for(var N=this.high!=0?this.high:this.low,F=31;F>0&&(N&1<=0},$.isOdd=function(){return(this.low&1)==1},$.isEven=function(){return(this.low&1)==0},$.equals=function(N){return s(N)||(N=h(N)),this.unsigned!==N.unsigned&&this.high>>>31==1&&N.high>>>31==1?!1:this.high===N.high&&this.low===N.low},$.eq=$.equals,$.notEquals=function(N){return!this.eq(N)},$.neq=$.notEquals,$.ne=$.notEquals,$.lessThan=function(N){return this.comp(N)<0},$.lt=$.lessThan,$.lessThanOrEqual=function(N){return this.comp(N)<=0},$.lte=$.lessThanOrEqual,$.le=$.lessThanOrEqual,$.greaterThan=function(N){return this.comp(N)>0},$.gt=$.greaterThan,$.greaterThanOrEqual=function(N){return this.comp(N)>=0},$.gte=$.greaterThanOrEqual,$.ge=$.greaterThanOrEqual,$.compare=function(N){if(s(N)||(N=h(N)),this.eq(N))return 0;var F=this.isNegative(),B=N.isNegative();return F&&!B?-1:!F&&B?1:this.unsigned?N.high>>>0>this.high>>>0||N.high===this.high&&N.low>>>0>this.low>>>0?-1:1:this.sub(N).isNegative()?-1:1},$.comp=$.compare,$.negate=function(){return!this.unsigned&&this.eq(M)?M:this.not().add(v)},$.neg=$.negate,$.add=function(N){s(N)||(N=h(N));var F=this.high>>>16,B=this.high&65535,j=this.low>>>16,X=this.low&65535,Y=N.high>>>16,ee=N.high&65535,oe=N.low>>>16,se=N.low&65535,ie=0,ne=0,de=0,he=0;return he+=X+se,de+=he>>>16,he&=65535,de+=j+oe,ne+=de>>>16,de&=65535,ne+=B+ee,ie+=ne>>>16,ne&=65535,ie+=F+Y,ie&=65535,u(de<<16|he,ie<<16|ne,this.unsigned)},$.subtract=function(N){return s(N)||(N=h(N)),this.add(N.neg())},$.sub=$.subtract,$.multiply=function(N){if(this.isZero())return x;if(s(N)||(N=h(N)),n){var F=n.mul(this.low,this.high,N.low,N.high);return u(F,n.get_high(),this.unsigned)}if(N.isZero())return x;if(this.eq(M))return N.isOdd()?M:x;if(N.eq(M))return this.isOdd()?M:x;if(this.isNegative())return N.isNegative()?this.neg().mul(N.neg()):this.neg().mul(N).neg();if(N.isNegative())return this.mul(N.neg()).neg();if(this.lt(A)&&N.lt(A))return l(this.toNumber()*N.toNumber(),this.unsigned);var B=this.high>>>16,j=this.high&65535,X=this.low>>>16,Y=this.low&65535,ee=N.high>>>16,oe=N.high&65535,se=N.low>>>16,ie=N.low&65535,ne=0,de=0,he=0,ge=0;return ge+=Y*ie,he+=ge>>>16,ge&=65535,he+=X*ie,de+=he>>>16,he&=65535,he+=Y*se,de+=he>>>16,he&=65535,de+=j*ie,ne+=de>>>16,de&=65535,de+=X*se,ne+=de>>>16,de&=65535,de+=Y*oe,ne+=de>>>16,de&=65535,ne+=B*ie+j*se+X*oe+Y*ee,ne&=65535,u(he<<16|ge,ne<<16|de,this.unsigned)},$.mul=$.multiply,$.divide=function(N){if(s(N)||(N=h(N)),N.isZero())throw Error("division by zero");if(n){if(!this.unsigned&&this.high===-2147483648&&N.low===-1&&N.high===-1)return this;var F=(this.unsigned?n.div_u:n.div_s)(this.low,this.high,N.low,N.high);return u(F,n.get_high(),this.unsigned)}if(this.isZero())return this.unsigned?b:x;var B,j,X;if(this.unsigned){if(N.unsigned||(N=N.toUnsigned()),N.gt(this))return b;if(N.gt(this.shru(1)))return w;X=b}else{if(this.eq(M)){if(N.eq(v)||N.eq(I))return M;if(N.eq(M))return v;var Y=this.shr(1);return B=Y.div(N).shl(1),B.eq(x)?N.isNegative()?v:I:(j=this.sub(N.mul(B)),X=B.add(j.div(N)),X)}else if(N.eq(M))return this.unsigned?b:x;if(this.isNegative())return N.isNegative()?this.neg().div(N.neg()):this.neg().div(N).neg();if(N.isNegative())return this.div(N.neg()).neg();X=x}for(j=this;j.gte(N);){B=Math.max(1,Math.floor(j.toNumber()/N.toNumber()));for(var ee=Math.ceil(Math.log(B)/Math.LN2),oe=ee<=48?1:c(2,ee-48),se=l(B),ie=se.mul(N);ie.isNegative()||ie.gt(j);)B-=oe,se=l(B,this.unsigned),ie=se.mul(N);se.isZero()&&(se=v),X=X.add(se),j=j.sub(ie)}return X},$.div=$.divide,$.modulo=function(N){if(s(N)||(N=h(N)),n){var F=(this.unsigned?n.rem_u:n.rem_s)(this.low,this.high,N.low,N.high);return u(F,n.get_high(),this.unsigned)}return this.sub(this.div(N).mul(N))},$.mod=$.modulo,$.rem=$.modulo,$.not=function(){return u(~this.low,~this.high,this.unsigned)},$.and=function(N){return s(N)||(N=h(N)),u(this.low&N.low,this.high&N.high,this.unsigned)},$.or=function(N){return s(N)||(N=h(N)),u(this.low|N.low,this.high|N.high,this.unsigned)},$.xor=function(N){return s(N)||(N=h(N)),u(this.low^N.low,this.high^N.high,this.unsigned)},$.shiftLeft=function(N){return s(N)&&(N=N.toInt()),(N&=63)===0?this:N<32?u(this.low<>>32-N,this.unsigned):u(0,this.low<>>N|this.high<<32-N,this.high>>N,this.unsigned):u(this.high>>N-32,this.high>=0?0:-1,this.unsigned)},$.shr=$.shiftRight,$.shiftRightUnsigned=function(N){if(s(N)&&(N=N.toInt()),N&=63,N===0)return this;var F=this.high;if(N<32){var B=this.low;return u(B>>>N|F<<32-N,F>>>N,this.unsigned)}else return N===32?u(F,0,this.unsigned):u(F>>>N-32,0,this.unsigned)},$.shru=$.shiftRightUnsigned,$.shr_u=$.shiftRightUnsigned,$.toSigned=function(){return this.unsigned?u(this.low,this.high,!1):this},$.toUnsigned=function(){return this.unsigned?this:u(this.low,this.high,!0)},$.toBytes=function(N){return N?this.toBytesLE():this.toBytesBE()},$.toBytesLE=function(){var N=this.high,F=this.low;return[F&255,F>>>8&255,F>>>16&255,F>>>24,N&255,N>>>8&255,N>>>16&255,N>>>24]},$.toBytesBE=function(){var N=this.high,F=this.low;return[N>>>24,N>>>16&255,N>>>8&255,N&255,F>>>24,F>>>16&255,F>>>8&255,F&255]},r.fromBytes=function(N,F,B){return B?r.fromBytesLE(N,F):r.fromBytesBE(N,F)},r.fromBytesLE=function(N,F){return new r(N[0]|N[1]<<8|N[2]<<16|N[3]<<24,N[4]|N[5]<<8|N[6]<<16|N[7]<<24,F)},r.fromBytesBE=function(N,F){return new r(N[4]<<24|N[5]<<16|N[6]<<8|N[7],N[0]<<24|N[1]<<16|N[2]<<8|N[3],F)}}}),O3=Ot({"(disabled):node_modules/.pnpm/node-fetch@2.6.1/node_modules/node-fetch/browser.js"(){}}),iR=Ot({"node_modules/.pnpm/seedrandom@2.4.3/node_modules/seedrandom/lib/alea.js"(e,t){(function(n,r,s){function a(u){var c=this,d=l();c.next=function(){var h=2091639*c.s0+c.c*23283064365386963e-26;return c.s0=c.s1,c.s1=c.s2,c.s2=h-(c.c=h|0)},c.c=1,c.s0=d(" "),c.s1=d(" "),c.s2=d(" "),c.s0-=d(u),c.s0<0&&(c.s0+=1),c.s1-=d(u),c.s1<0&&(c.s1+=1),c.s2-=d(u),c.s2<0&&(c.s2+=1),d=null}function o(u,c){return c.c=u.c,c.s0=u.s0,c.s1=u.s1,c.s2=u.s2,c}function i(u,c){var d=new a(u),h=c&&c.state,p=d.next;return p.int32=function(){return d.next()*4294967296|0},p.double=function(){return p()+(p()*2097152|0)*11102230246251565e-32},p.quick=p,h&&(typeof h=="object"&&o(h,d),p.state=function(){return o(d,{})}),p}function l(){var u=4022871197,c=function(d){d=d.toString();for(var h=0;h>>0,p-=u,p*=u,u=p>>>0,p-=u,u+=p*4294967296}return(u>>>0)*23283064365386963e-26};return c}r&&r.exports?r.exports=i:s&&s.amd?s(function(){return i}):this.alea=i})(e,typeof t=="object"&&t,typeof define=="function"&&define)}}),lR=Ot({"node_modules/.pnpm/seedrandom@2.4.3/node_modules/seedrandom/lib/xor128.js"(e,t){(function(n,r,s){function a(l){var u=this,c="";u.x=0,u.y=0,u.z=0,u.w=0,u.next=function(){var h=u.x^u.x<<11;return u.x=u.y,u.y=u.z,u.z=u.w,u.w^=u.w>>>19^h^h>>>8},l===(l|0)?u.x=l:c+=l;for(var d=0;d>>0)/4294967296};return h.double=function(){do var p=c.next()>>>11,f=(c.next()>>>0)/4294967296,m=(p+f)/(1<<21);while(m===0);return m},h.int32=c.next,h.quick=h,d&&(typeof d=="object"&&o(d,c),h.state=function(){return o(c,{})}),h}r&&r.exports?r.exports=i:s&&s.amd?s(function(){return i}):this.xor128=i})(e,typeof t=="object"&&t,typeof define=="function"&&define)}}),uR=Ot({"node_modules/.pnpm/seedrandom@2.4.3/node_modules/seedrandom/lib/xorwow.js"(e,t){(function(n,r,s){function a(l){var u=this,c="";u.next=function(){var h=u.x^u.x>>>2;return u.x=u.y,u.y=u.z,u.z=u.w,u.w=u.v,(u.d=u.d+362437|0)+(u.v=u.v^u.v<<4^(h^h<<1))|0},u.x=0,u.y=0,u.z=0,u.w=0,u.v=0,l===(l|0)?u.x=l:c+=l;for(var d=0;d>>4),u.next()}function o(l,u){return u.x=l.x,u.y=l.y,u.z=l.z,u.w=l.w,u.v=l.v,u.d=l.d,u}function i(l,u){var c=new a(l),d=u&&u.state,h=function(){return(c.next()>>>0)/4294967296};return h.double=function(){do var p=c.next()>>>11,f=(c.next()>>>0)/4294967296,m=(p+f)/(1<<21);while(m===0);return m},h.int32=c.next,h.quick=h,d&&(typeof d=="object"&&o(d,c),h.state=function(){return o(c,{})}),h}r&&r.exports?r.exports=i:s&&s.amd?s(function(){return i}):this.xorwow=i})(e,typeof t=="object"&&t,typeof define=="function"&&define)}}),cR=Ot({"node_modules/.pnpm/seedrandom@2.4.3/node_modules/seedrandom/lib/xorshift7.js"(e,t){(function(n,r,s){function a(l){var u=this;u.next=function(){var d=u.x,h=u.i,p,f,m;return p=d[h],p^=p>>>7,f=p^p<<24,p=d[h+1&7],f^=p^p>>>10,p=d[h+3&7],f^=p^p>>>3,p=d[h+4&7],f^=p^p<<7,p=d[h+7&7],p=p^p<<13,f^=p^p<<9,d[h]=f,u.i=h+1&7,f};function c(d,h){var p,f,m=[];if(h===(h|0))f=m[0]=h;else for(h=""+h,p=0;p0;--p)d.next()}c(u,l)}function o(l,u){return u.x=l.x.slice(),u.i=l.i,u}function i(l,u){l==null&&(l=+new Date);var c=new a(l),d=u&&u.state,h=function(){return(c.next()>>>0)/4294967296};return h.double=function(){do var p=c.next()>>>11,f=(c.next()>>>0)/4294967296,m=(p+f)/(1<<21);while(m===0);return m},h.int32=c.next,h.quick=h,d&&(d.x&&o(d,c),h.state=function(){return o(c,{})}),h}r&&r.exports?r.exports=i:s&&s.amd?s(function(){return i}):this.xorshift7=i})(e,typeof t=="object"&&t,typeof define=="function"&&define)}}),dR=Ot({"node_modules/.pnpm/seedrandom@2.4.3/node_modules/seedrandom/lib/xor4096.js"(e,t){(function(n,r,s){function a(l){var u=this;u.next=function(){var d=u.w,h=u.X,p=u.i,f,m;return u.w=d=d+1640531527|0,m=h[p+34&127],f=h[p=p+1&127],m^=m<<13,f^=f<<17,m^=m>>>15,f^=f>>>12,m=h[p]=m^f,u.i=p,m+(d^d>>>16)|0};function c(d,h){var p,f,m,g,y,A=[],x=128;for(h===(h|0)?(f=h,h=null):(h=h+"\0",f=0,x=Math.max(x,h.length)),m=0,g=-32;g>>15,f^=f<<4,f^=f>>>13,g>=0&&(y=y+1640531527|0,p=A[g&127]^=f+y,m=p==0?m+1:0);for(m>=128&&(A[(h&&h.length||0)&127]=-1),m=127,g=4*128;g>0;--g)f=A[m+34&127],p=A[m=m+1&127],f^=f<<13,p^=p<<17,f^=f>>>15,p^=p>>>12,A[m]=f^p;d.w=y,d.X=A,d.i=m}c(u,l)}function o(l,u){return u.i=l.i,u.w=l.w,u.X=l.X.slice(),u}function i(l,u){l==null&&(l=+new Date);var c=new a(l),d=u&&u.state,h=function(){return(c.next()>>>0)/4294967296};return h.double=function(){do var p=c.next()>>>11,f=(c.next()>>>0)/4294967296,m=(p+f)/(1<<21);while(m===0);return m},h.int32=c.next,h.quick=h,d&&(d.X&&o(d,c),h.state=function(){return o(c,{})}),h}r&&r.exports?r.exports=i:s&&s.amd?s(function(){return i}):this.xor4096=i})(e,typeof t=="object"&&t,typeof define=="function"&&define)}}),hR=Ot({"node_modules/.pnpm/seedrandom@2.4.3/node_modules/seedrandom/lib/tychei.js"(e,t){(function(n,r,s){function a(l){var u=this,c="";u.next=function(){var h=u.b,p=u.c,f=u.d,m=u.a;return h=h<<25^h>>>7^p,p=p-f|0,f=f<<24^f>>>8^m,m=m-h|0,u.b=h=h<<20^h>>>12^p,u.c=p=p-f|0,u.d=f<<16^p>>>16^m,u.a=m-h|0},u.a=0,u.b=0,u.c=2654435769|0,u.d=1367130551,l===Math.floor(l)?(u.a=l/4294967296|0,u.b=l|0):c+=l;for(var d=0;d>>0)/4294967296};return h.double=function(){do var p=c.next()>>>11,f=(c.next()>>>0)/4294967296,m=(p+f)/(1<<21);while(m===0);return m},h.int32=c.next,h.quick=h,d&&(typeof d=="object"&&o(d,c),h.state=function(){return o(c,{})}),h}r&&r.exports?r.exports=i:s&&s.amd?s(function(){return i}):this.tychei=i})(e,typeof t=="object"&&t,typeof define=="function"&&define)}}),P3=Ot({"(disabled):crypto"(){}}),pR=Ot({"node_modules/.pnpm/seedrandom@2.4.3/node_modules/seedrandom/seedrandom.js"(e,t){(function(n,r){var s=this,a=256,o=6,i=52,l="random",u=r.pow(a,o),c=r.pow(2,i),d=c*2,h=a-1,p;function f(v,w,I){var T=[];w=w==!0?{entropy:!0}:w||{};var C=A(y(w.entropy?[v,b(n)]:v==null?x():v,3),T),M=new m(T),$=function(){for(var R=M.g(o),N=u,F=0;R=d;)R/=2,N/=2,F>>>=1;return(R+F)/N};return $.int32=function(){return M.g(4)|0},$.quick=function(){return M.g(4)/4294967296},$.double=$,A(b(M.S),n),(w.pass||I||function(R,N,F,B){return B&&(B.S&&g(B,M),R.state=function(){return g(M,{})}),F?(r[l]=R,N):R})($,C,"global"in w?w.global:this==r,w.state)}r["seed"+l]=f;function m(v){var w,I=v.length,T=this,C=0,M=T.i=T.j=0,$=T.S=[];for(I||(v=[I++]);C>>0,p-=u,p*=u,u=p>>>0,p-=u,u+=p*4294967296}return(u>>>0)*23283064365386963e-26};return c}r&&r.exports?r.exports=i:s&&s.amd?s(function(){return i}):this.alea=i})(e,typeof t=="object"&&t,typeof define=="function"&&define)}}),mR=Ot({"node_modules/.pnpm/seedrandom@3.0.5/node_modules/seedrandom/lib/xor128.js"(e,t){(function(n,r,s){function a(l){var u=this,c="";u.x=0,u.y=0,u.z=0,u.w=0,u.next=function(){var h=u.x^u.x<<11;return u.x=u.y,u.y=u.z,u.z=u.w,u.w^=u.w>>>19^h^h>>>8},l===(l|0)?u.x=l:c+=l;for(var d=0;d>>0)/4294967296};return h.double=function(){do var p=c.next()>>>11,f=(c.next()>>>0)/4294967296,m=(p+f)/(1<<21);while(m===0);return m},h.int32=c.next,h.quick=h,d&&(typeof d=="object"&&o(d,c),h.state=function(){return o(c,{})}),h}r&&r.exports?r.exports=i:s&&s.amd?s(function(){return i}):this.xor128=i})(e,typeof t=="object"&&t,typeof define=="function"&&define)}}),gR=Ot({"node_modules/.pnpm/seedrandom@3.0.5/node_modules/seedrandom/lib/xorwow.js"(e,t){(function(n,r,s){function a(l){var u=this,c="";u.next=function(){var h=u.x^u.x>>>2;return u.x=u.y,u.y=u.z,u.z=u.w,u.w=u.v,(u.d=u.d+362437|0)+(u.v=u.v^u.v<<4^(h^h<<1))|0},u.x=0,u.y=0,u.z=0,u.w=0,u.v=0,l===(l|0)?u.x=l:c+=l;for(var d=0;d>>4),u.next()}function o(l,u){return u.x=l.x,u.y=l.y,u.z=l.z,u.w=l.w,u.v=l.v,u.d=l.d,u}function i(l,u){var c=new a(l),d=u&&u.state,h=function(){return(c.next()>>>0)/4294967296};return h.double=function(){do var p=c.next()>>>11,f=(c.next()>>>0)/4294967296,m=(p+f)/(1<<21);while(m===0);return m},h.int32=c.next,h.quick=h,d&&(typeof d=="object"&&o(d,c),h.state=function(){return o(c,{})}),h}r&&r.exports?r.exports=i:s&&s.amd?s(function(){return i}):this.xorwow=i})(e,typeof t=="object"&&t,typeof define=="function"&&define)}}),yR=Ot({"node_modules/.pnpm/seedrandom@3.0.5/node_modules/seedrandom/lib/xorshift7.js"(e,t){(function(n,r,s){function a(l){var u=this;u.next=function(){var d=u.x,h=u.i,p,f,m;return p=d[h],p^=p>>>7,f=p^p<<24,p=d[h+1&7],f^=p^p>>>10,p=d[h+3&7],f^=p^p>>>3,p=d[h+4&7],f^=p^p<<7,p=d[h+7&7],p=p^p<<13,f^=p^p<<9,d[h]=f,u.i=h+1&7,f};function c(d,h){var p,f,m=[];if(h===(h|0))f=m[0]=h;else for(h=""+h,p=0;p0;--p)d.next()}c(u,l)}function o(l,u){return u.x=l.x.slice(),u.i=l.i,u}function i(l,u){l==null&&(l=+new Date);var c=new a(l),d=u&&u.state,h=function(){return(c.next()>>>0)/4294967296};return h.double=function(){do var p=c.next()>>>11,f=(c.next()>>>0)/4294967296,m=(p+f)/(1<<21);while(m===0);return m},h.int32=c.next,h.quick=h,d&&(d.x&&o(d,c),h.state=function(){return o(c,{})}),h}r&&r.exports?r.exports=i:s&&s.amd?s(function(){return i}):this.xorshift7=i})(e,typeof t=="object"&&t,typeof define=="function"&&define)}}),AR=Ot({"node_modules/.pnpm/seedrandom@3.0.5/node_modules/seedrandom/lib/xor4096.js"(e,t){(function(n,r,s){function a(l){var u=this;u.next=function(){var d=u.w,h=u.X,p=u.i,f,m;return u.w=d=d+1640531527|0,m=h[p+34&127],f=h[p=p+1&127],m^=m<<13,f^=f<<17,m^=m>>>15,f^=f>>>12,m=h[p]=m^f,u.i=p,m+(d^d>>>16)|0};function c(d,h){var p,f,m,g,y,A=[],x=128;for(h===(h|0)?(f=h,h=null):(h=h+"\0",f=0,x=Math.max(x,h.length)),m=0,g=-32;g>>15,f^=f<<4,f^=f>>>13,g>=0&&(y=y+1640531527|0,p=A[g&127]^=f+y,m=p==0?m+1:0);for(m>=128&&(A[(h&&h.length||0)&127]=-1),m=127,g=4*128;g>0;--g)f=A[m+34&127],p=A[m=m+1&127],f^=f<<13,p^=p<<17,f^=f>>>15,p^=p>>>12,A[m]=f^p;d.w=y,d.X=A,d.i=m}c(u,l)}function o(l,u){return u.i=l.i,u.w=l.w,u.X=l.X.slice(),u}function i(l,u){l==null&&(l=+new Date);var c=new a(l),d=u&&u.state,h=function(){return(c.next()>>>0)/4294967296};return h.double=function(){do var p=c.next()>>>11,f=(c.next()>>>0)/4294967296,m=(p+f)/(1<<21);while(m===0);return m},h.int32=c.next,h.quick=h,d&&(d.X&&o(d,c),h.state=function(){return o(c,{})}),h}r&&r.exports?r.exports=i:s&&s.amd?s(function(){return i}):this.xor4096=i})(e,typeof t=="object"&&t,typeof define=="function"&&define)}}),xR=Ot({"node_modules/.pnpm/seedrandom@3.0.5/node_modules/seedrandom/lib/tychei.js"(e,t){(function(n,r,s){function a(l){var u=this,c="";u.next=function(){var h=u.b,p=u.c,f=u.d,m=u.a;return h=h<<25^h>>>7^p,p=p-f|0,f=f<<24^f>>>8^m,m=m-h|0,u.b=h=h<<20^h>>>12^p,u.c=p=p-f|0,u.d=f<<16^p>>>16^m,u.a=m-h|0},u.a=0,u.b=0,u.c=2654435769|0,u.d=1367130551,l===Math.floor(l)?(u.a=l/4294967296|0,u.b=l|0):c+=l;for(var d=0;d>>0)/4294967296};return h.double=function(){do var p=c.next()>>>11,f=(c.next()>>>0)/4294967296,m=(p+f)/(1<<21);while(m===0);return m},h.int32=c.next,h.quick=h,d&&(typeof d=="object"&&o(d,c),h.state=function(){return o(c,{})}),h}r&&r.exports?r.exports=i:s&&s.amd?s(function(){return i}):this.tychei=i})(e,typeof t=="object"&&t,typeof define=="function"&&define)}}),bR=Ot({"node_modules/.pnpm/seedrandom@3.0.5/node_modules/seedrandom/seedrandom.js"(e,t){(function(n,r,s){var a=256,o=6,i=52,l="random",u=s.pow(a,o),c=s.pow(2,i),d=c*2,h=a-1,p;function f(v,w,I){var T=[];w=w==!0?{entropy:!0}:w||{};var C=A(y(w.entropy?[v,b(r)]:v==null?x():v,3),T),M=new m(T),$=function(){for(var R=M.g(o),N=u,F=0;R=d;)R/=2,N/=2,F>>>=1;return(R+F)/N};return $.int32=function(){return M.g(4)|0},$.quick=function(){return M.g(4)/4294967296},$.double=$,A(b(M.S),r),(w.pass||I||function(R,N,F,B){return B&&(B.S&&g(B,M),R.state=function(){return g(M,{})}),F?(s[l]=R,N):R})($,C,"global"in w?w.global:this==s,w.state)}function m(v){var w,I=v.length,T=this,C=0,M=T.i=T.j=0,$=T.S=[];for(I||(v=[I++]);C1&&(g=process.argv[1].replace(/\\/g,"/")),m=process.argv.slice(2),process.on("uncaughtException",function(E){if(!(E instanceof Gu))throw E}),process.on("unhandledRejection",Gs),y=function(E){process.exit(E)},c.inspect=function(){return"[Emscripten Module object]"};var B;try{B=wR()}catch(E){throw console.error('The "worker_threads" module is not supported in this node.js build - perhaps a newer version is needed?'),E}global.Worker=B.Worker}else v?(typeof read!="undefined"&&(C=function(D){return read(D)}),$=function(D){var W;return typeof readbuffer=="function"?new Uint8Array(readbuffer(D)):(W=read(D,"binary"),be(typeof W=="object"),W)},typeof scriptArgs!="undefined"?m=scriptArgs:typeof arguments!="undefined"&&(m=arguments),typeof quit=="function"&&(y=function(E){quit(E)}),typeof print!="undefined"&&(typeof console=="undefined"&&(console={}),console.log=print,console.warn=console.error=typeof printErr!="undefined"?printErr:print)):(A||x)&&(x?I=self.location.href:typeof document!="undefined"&&document.currentScript&&(I=document.currentScript.src),typeof r!="undefined"&&r&&(I=r),I.indexOf("blob:")!==0?I=I.substr(0,I.lastIndexOf("/")+1):I="",b?(C=function(D,W){return N||(N=co("fs")),F||(F=ju()),D=F.normalize(D),N.readFileSync(D,W?null:"utf8")},$=function(D){var W=C(D,!0);return W.buffer||(W=new Uint8Array(W)),be(W.buffer),W}):(C=function(E){var D=new XMLHttpRequest;return D.open("GET",E,!1),D.send(null),D.responseText},x&&($=function(E){var D=new XMLHttpRequest;return D.open("GET",E,!1),D.responseType="arraybuffer",D.send(null),new Uint8Array(D.response)}),M=function(E,D,W){var Q=new XMLHttpRequest;Q.open("GET",E,!0),Q.responseType="arraybuffer",Q.onload=function(){if(Q.status==200||Q.status==0&&Q.response){D(Q.response);return}W()},Q.onerror=W,Q.send(null)}),R=function(E){document.title=E});b&&typeof performance=="undefined"&&(global.performance=kR().performance);var j=c.print||console.log.bind(console),X=c.printErr||console.warn.bind(console);for(f in p)p.hasOwnProperty(f)&&(c[f]=p[f]);p=null,c.arguments&&(m=c.arguments),c.thisProgram&&(g=c.thisProgram),c.quit&&(y=c.quit);var Y=Atomics.load,ee=Atomics.store,oe=Atomics.compareExchange,se;c.wasmBinary&&(se=c.wasmBinary);var ie=c.noExitRuntime||!0;typeof WebAssembly!="object"&&Gs("no native wasm support detected");var ne,de,he=!1,ge;function be(E,D){E||Gs("Assertion failed: "+D)}function Ee(E){var D=c["_"+E];return be(D,"Cannot call unknown function "+E+", make sure it is exported"),D}function $e(E,D,W,Q,xe){var ye={string:function(Dn){var Mi=0;if(Dn!=null&&Dn!==0){var $3=(Dn.length<<2)+1;Mi=Ri($3),ft(Dn,Mi,$3)}return Mi},array:function(Dn){var Mi=Ri(Dn.length);return dt(Dn,Mi),Mi}};function Ae(Dn){return D==="string"?We(Dn):D==="boolean"?Boolean(Dn):Dn}var Se=Ee(E),gt=[],pn=0;if(Q)for(var sn=0;sn=Q);){var ye=E[D++];if(!ye)return xe;if(!(ye&128)){xe+=String.fromCharCode(ye);continue}var Ae=E[D++]&63;if((ye&224)==192){xe+=String.fromCharCode((ye&31)<<6|Ae);continue}var Se=E[D++]&63;if((ye&240)==224?ye=(ye&15)<<12|Ae<<6|Se:ye=(ye&7)<<18|Ae<<12|Se<<6|E[D++]&63,ye<65536)xe+=String.fromCharCode(ye);else{var gt=ye-65536;xe+=String.fromCharCode(55296|gt>>10,56320|gt&1023)}}return xe}function We(E,D){return E?qe(o(),E,D):""}function vt(E,D,W,Q){if(!(Q>0))return 0;for(var xe=W,ye=W+Q-1,Ae=0;Ae=55296&&Se<=57343){var gt=E.charCodeAt(++Ae);Se=65536+((Se&1023)<<10)|gt&1023}if(Se<=127){if(W>=ye)break;D[W++]=Se}else if(Se<=2047){if(W+1>=ye)break;D[W++]=192|Se>>6,D[W++]=128|Se&63}else if(Se<=65535){if(W+2>=ye)break;D[W++]=224|Se>>12,D[W++]=128|Se>>6&63,D[W++]=128|Se&63}else{if(W+3>=ye)break;D[W++]=240|Se>>18,D[W++]=128|Se>>12&63,D[W++]=128|Se>>6&63,D[W++]=128|Se&63}}return D[W]=0,W-xe}function ft(E,D,W){return vt(E,o(),D,W)}function mt(E){for(var D=0,W=0;W=55296&&Q<=57343&&(Q=65536+((Q&1023)<<10)|E.charCodeAt(++W)&1023),Q<=127?++D:Q<=2047?D+=2:Q<=65535?D+=3:D+=4}return D}function dt(E,D){a().set(E,D)}function bt(E,D){return E%D>0&&(E+=D-E%D),E}var Je,jn,Wt,sr,vn,Vr,Rn,br,vr;function wn(E){Je=E,c.HEAP8=jn=new Int8Array(E),c.HEAP16=sr=new Int16Array(E),c.HEAP32=Vr=new Int32Array(E),c.HEAPU8=Wt=new Uint8Array(E),c.HEAPU16=vn=new Uint16Array(E),c.HEAPU32=Rn=new Uint32Array(E),c.HEAPF32=br=new Float32Array(E),c.HEAPF64=vr=new Float64Array(E)}var wr=c.INITIAL_MEMORY||16777216;if(w)ne=c.wasmMemory,Je=c.buffer;else if(c.wasmMemory)ne=c.wasmMemory;else if(ne=new WebAssembly.Memory({initial:wr/65536,maximum:2147483648/65536,shared:!0}),!(ne.buffer instanceof SharedArrayBuffer))throw X("requested a shared WebAssembly.Memory but the returned buffer is not a SharedArrayBuffer, indicating that while the browser has SharedArrayBuffer it does not have WebAssembly threads support - you may need to set a flag"),b&&console.log("(on node you may need: --experimental-wasm-threads --experimental-wasm-bulk-memory and also use a recent version)"),Error("bad memory");ne&&(Je=ne.buffer),wr=Je.byteLength,wn(Je);var kr,ar=[],ws=[],Us=[],Aa=[],Si=[],ks=!1,_h=!1;w||ws.push({func:function(){jh()}});function E0(){if(!w){if(c.preRun)for(typeof c.preRun=="function"&&(c.preRun=[c.preRun]);c.preRun.length;)Dh(c.preRun.shift());Ni(ar)}}function Mu(){ks=!0,!w&&Ni(ws)}function $0(){w||Ni(Us)}function Rh(){w||(_h=!0)}function qn(){if(!w){if(c.postRun)for(typeof c.postRun=="function"&&(c.postRun=[c.postRun]);c.postRun.length;)_0(c.postRun.shift());Ni(Si)}}function Dh(E){ar.unshift(E)}function _0(E){Si.unshift(E)}var Hs=0,xa=null,io=null;function R0(E){be(!w,"addRunDependency cannot be used in a pthread worker"),Hs++,c.monitorRunDependencies&&c.monitorRunDependencies(Hs)}function D0(E){if(Hs--,c.monitorRunDependencies&&c.monitorRunDependencies(Hs),Hs==0&&(xa!==null&&(clearInterval(xa),xa=null),io)){var D=io;io=null,D()}}c.preloadedImages={},c.preloadedAudios={};function Gs(E){c.onAbort&&c.onAbort(E),w&&console.error("Pthread aborting at "+new Error().stack),E+="",X(E),he=!0,ge=1,E="abort("+E+"). Build with -s ASSERTIONS=1 for more info.";var D=new WebAssembly.RuntimeError(E);throw h(D),D}function Fh(E,D){return String.prototype.startsWith?E.startsWith(D):E.indexOf(D)===0}var Ti="data:application/octet-stream;base64,";function Mh(E){return Fh(E,Ti)}var F0="file://";function Oh(E){return Fh(E,F0)}var Kn="tfjs-backend-wasm-threaded-simd.wasm";Mh(Kn)||(Kn=T(Kn));function Ph(E){try{if(E==Kn&&se)return new Uint8Array(se);if($)return $(E);throw"both async and sync fetching of the wasm failed"}catch(D){Gs(D)}}function M0(){if(!se&&(A||x)){if(typeof fetch=="function"&&!Oh(Kn))return fetch(Kn,{credentials:"same-origin"}).then(function(E){if(!E.ok)throw"failed to load wasm binary file at '"+Kn+"'";return E.arrayBuffer()}).catch(function(){return Ph(Kn)});if(M)return new Promise(function(E,D){M(Kn,function(W){E(new Uint8Array(W))},D)})}return Promise.resolve().then(function(){return Ph(Kn)})}function O0(){var E={a:Tg};function D(Ae,Se){var gt=Ae.exports;if(c.asm=gt,kr=c.asm.F,de=Se,!w){var pn=Ce.unusedWorkers.length;Ce.unusedWorkers.forEach(function(sn){Ce.loadWasmModuleToWorker(sn,function(){--pn||D0("wasm-instantiate")})})}}w||R0("wasm-instantiate");function W(Ae){D(Ae.instance,Ae.module)}function Q(Ae){return M0().then(function(Se){return WebAssembly.instantiate(Se,E)}).then(Ae,function(Se){X("failed to asynchronously prepare wasm: "+Se),Gs(Se)})}function xe(){return!se&&typeof WebAssembly.instantiateStreaming=="function"&&!Mh(Kn)&&!Oh(Kn)&&typeof fetch=="function"?fetch(Kn,{credentials:"same-origin"}).then(function(Ae){var Se=WebAssembly.instantiateStreaming(Ae,E);return Se.then(W,function(gt){return X("wasm streaming compile failed: "+gt),X("falling back to ArrayBuffer instantiation"),Q(W)})}):Q(W)}if(c.instantiateWasm)try{var ye=c.instantiateWasm(E,D);return ye}catch(Ae){return X("Module.instantiateWasm callback failed with error: "+Ae),!1}return xe().catch(h),{}}var P0={9816:function(){throw"Canceled!"},9834:function(E,D){setTimeout(function(){I3(E,D)},0)}};function zh(){Ce.initRuntime()}function Ni(E){for(;E.length>0;){var D=E.shift();if(typeof D=="function"){D(c);continue}var W=D.func;typeof W=="number"?D.arg===void 0?kr.get(W)():kr.get(W)(D.arg):W(D.arg===void 0?null:D.arg)}}function Ou(E,D){if(E<=0||E>a().length||E&!0||D<0)return-28;if(D==0)return 0;D>=2147483647&&(D=Infinity);var W=Atomics.load(i(),Di>>2),Q=0;if(W==E){var xe=Atomics.compareExchange(i(),Di>>2,W,0);if(xe==W&&(--D,Q=1,D<=0))return 1}var ye=Atomics.notify(i(),E>>2,D);if(ye>=0)return ye+Q;throw"Atomics.notify returned an unexpected value "+ye}c._emscripten_futex_wake=Ou;function z0(E){if(w)throw"Internal Error! killThread() can only ever be called from main application thread!";if(!E)throw"Internal Error! Null pthread_ptr in killThread!";i()[E+12>>2]=0;var D=Ce.pthreads[E];D.worker.terminate(),Ce.freeThreadData(D),Ce.runningWorkers.splice(Ce.runningWorkers.indexOf(D.worker),1),D.worker.pthread=void 0}function L0(E){if(w)throw"Internal Error! cancelThread() can only ever be called from main application thread!";if(!E)throw"Internal Error! Null pthread_ptr in cancelThread!";var D=Ce.pthreads[E];D.worker.postMessage({cmd:"cancel"})}function B0(E){if(w)throw"Internal Error! cleanupThread() can only ever be called from main application thread!";if(!E)throw"Internal Error! Null pthread_ptr in cleanupThread!";var D=Ce.pthreads[E];if(D){i()[E+12>>2]=0;var W=D.worker;Ce.returnWorkerToPool(W)}}var Ce={unusedWorkers:[],runningWorkers:[],initMainThreadBlock:function(){for(var E=Math.min(4,Math.max(1,(navigator.hardwareConcurrency||1)/2)),D=0;D>2]=E;var W=E+152;i()[W>>2]=W;for(var Q=uo(512),D=0;D<128;++D)l()[Q/4+D]=0;Atomics.store(l(),E+100>>2,Q),Atomics.store(l(),E+40>>2,E),Yg(E,!x,1),k3(E)},initWorker:function(){},pthreads:{},threadExitHandlers:[],setThreadStatus:function(){},runExitHandlers:function(){for(;Ce.threadExitHandlers.length>0;)Ce.threadExitHandlers.pop()();w&&$i()&&w3()},runExitHandlersAndDeinitThread:function(E,D){Atomics.store(l(),E+56>>2,1),Atomics.store(l(),E+60>>2,0),Ce.runExitHandlers(),Atomics.store(l(),E+4>>2,D),Atomics.store(l(),E+0>>2,1),Ou(E+0,2147483647),Yg(0,0,0)},threadExit:function(E){var D=$i();D&&(Ce.runExitHandlersAndDeinitThread(D,E),w&&postMessage({cmd:"exit"}))},threadCancel:function(){Ce.runExitHandlersAndDeinitThread($i(),-1),postMessage({cmd:"cancelDone"})},terminateAllThreads:function(){for(var E in Ce.pthreads){var D=Ce.pthreads[E];D&&D.worker&&Ce.returnWorkerToPool(D.worker)}Ce.pthreads={};for(var W=0;W>2];i()[E.threadInfoStruct+100>>2]=0,Uu(D),Uu(E.threadInfoStruct)}E.threadInfoStruct=0,E.allocatedOwnStack&&E.stackBase&&Uu(E.stackBase),E.stackBase=0,E.worker&&(E.worker.pthread=null)}},returnWorkerToPool:function(E){Ce.runWithoutMainThreadQueuedCalls(function(){delete Ce.pthreads[E.pthread.threadInfoStruct],Ce.unusedWorkers.push(E),Ce.runningWorkers.splice(Ce.runningWorkers.indexOf(E),1),Ce.freeThreadData(E.pthread),E.pthread=void 0})},runWithoutMainThreadQueuedCalls:function(E){i()[E3>>2]=0;try{E()}finally{i()[E3>>2]=1}},receiveObjectTransfer:function(E){},loadWasmModuleToWorker:function(E,D){E.onmessage=function(W){var Q=W.data,xe=Q.cmd;if(E.pthread&&(Ce.currentProxiedOperationCallerThread=E.pthread.threadInfoStruct),Q.targetThread&&Q.targetThread!=$i()){var ye=Ce.pthreads[Q.targetThread];ye?ye.worker.postMessage(W.data,Q.transferList):console.error('Internal error! Worker sent a message "'+xe+'" to target pthread '+Q.targetThread+", but that thread no longer exists!"),Ce.currentProxiedOperationCallerThread=void 0;return}if(xe==="processQueuedMainThreadWork")Xg();else if(xe==="spawnThread")Hh(W.data);else if(xe==="cleanupThread")B0(Q.thread);else if(xe==="killThread")z0(Q.thread);else if(xe==="cancelThread")L0(Q.thread);else if(xe==="loaded")E.loaded=!0,D&&D(E),E.runPthread&&(E.runPthread(),delete E.runPthread);else if(xe==="print")j("Thread "+Q.threadId+": "+Q.text);else if(xe==="printErr")X("Thread "+Q.threadId+": "+Q.text);else if(xe==="alert")alert("Thread "+Q.threadId+": "+Q.text);else if(xe==="exit"){var Ae=E.pthread&&Atomics.load(l(),E.pthread.threadInfoStruct+64>>2);Ae&&Ce.returnWorkerToPool(E)}else if(xe==="exitProcess")try{J_(Q.returnCode)}catch(Se){if(Se instanceof Gu)return;throw Se}else xe==="cancelDone"?Ce.returnWorkerToPool(E):xe==="objectTransfer"?Ce.receiveObjectTransfer(W.data):W.data.target==="setimmediate"?E.postMessage(W.data):X("worker sent an unknown command "+xe);Ce.currentProxiedOperationCallerThread=void 0},E.onerror=function(W){X("pthread sent an error! "+W.filename+":"+W.lineno+": "+W.message)},b&&(E.on("message",function(W){E.onmessage({data:W})}),E.on("error",function(W){E.onerror(W)}),E.on("exit",function(W){})),E.postMessage({cmd:"load",urlOrBlob:c.mainScriptUrlOrBlob||r,wasmMemory:ne,wasmModule:de})},allocateUnusedWorker:function(){var E=T("tfjs-backend-wasm-threaded-simd.worker.js");Ce.unusedWorkers.push(new Worker(E))},getNewWorker:function(){return Ce.unusedWorkers.length==0&&(Ce.allocateUnusedWorker(),Ce.loadWasmModuleToWorker(Ce.unusedWorkers[0])),Ce.unusedWorkers.length>0?Ce.unusedWorkers.pop():null},busySpinWait:function(E){for(var D=performance.now()+E;performance.now()>2]=E,E}function q0(E,D){if(w)return ba(1,1,E,D)}function K0(E,D){if(E==D)postMessage({cmd:"processQueuedMainThreadWork"});else if(w)postMessage({targetThread:E,cmd:"processThreadQueue"});else{var W=Ce.pthreads[E],Q=W&&W.worker;if(!Q)return;Q.postMessage({cmd:"processThreadQueue"})}return 1}function X0(){Gs()}function Z0(E,D,W){var Q=tg(D,W);return P0[E].apply(null,Q)}function Y0(E,D){}function J0(E,D,W){if(E<=0||E>a().length||E&!0)return-28;if(A){if(Atomics.load(i(),E>>2)!=D)return-6;for(var xe=performance.now(),ye=xe+W,Ae=Atomics.exchange(i(),Di>>2,E);;){if(xe=performance.now(),xe>ye)return Ae=Atomics.exchange(i(),Di>>2,0),-73;if(Ae=Atomics.exchange(i(),Di>>2,0),Ae==0)break;if(Xg(),Atomics.load(i(),E>>2)!=D)return-6;Ae=Atomics.exchange(i(),Di>>2,E)}return 0}else{var Q=Atomics.wait(i(),E>>2,D,W);if(Q==="timed-out")return-73;if(Q==="not-equal")return-6;if(Q==="ok")return 0;throw"Atomics.wait returned an unexpected value "+Q}}function Q0(E,D,W){o().copyWithin(E,D,D+W)}function eg(){return b?co("os").cpus().length:navigator.hardwareConcurrency}function ba(E,D){for(var W=arguments.length-2,Q=Hu(),xe=W,ye=Ri(xe*8),Ae=ye>>3,Se=0;Se>=2;W=o()[E++];){var Q=W<105;Q&&D&1&&D++,zu.push(Q?u()[D++>>1]:i()[D]),++D}return zu}function ng(E,D,W){Pu.length=D;for(var Q=W>>3,xe=0;xe>>16),wn(ne.buffer),1}catch(D){}}function ag(E){var D=rg();if(E<=D)return!1;var W=2147483648;if(E>W)return!1;for(var Q=1;Q<=4;Q*=2){var xe=D*(1+.2/Q);xe=Math.min(xe,E+100663296);var ye=Math.min(W,bt(Math.max(E,xe),65536)),Ae=sg(ye);if(Ae)return!0}return!1}var Xe={inEventHandler:0,removeAllEventListeners:function(){for(var E=Xe.eventHandlers.length-1;E>=0;--E)Xe._removeHandler(E);Xe.eventHandlers=[],Xe.deferredCalls=[]},registerRemoveEventListeners:function(){Xe.removeEventListenersRegistered||(Aa.push(Xe.removeAllEventListeners),Xe.removeEventListenersRegistered=!0)},deferredCalls:[],deferCall:function(E,D,W){function Q(Ae,Se){if(Ae.length!=Se.length)return!1;for(var gt in Ae)if(Ae[gt]!=Se[gt])return!1;return!0}for(var xe in Xe.deferredCalls){var ye=Xe.deferredCalls[xe];if(ye.targetFunction==E&&Q(ye.argsList,W))return}Xe.deferredCalls.push({targetFunction:E,precedence:D,argsList:W}),Xe.deferredCalls.sort(function(Ae,Se){return Ae.precedence>2]=W,i()[Ae+4>>2]=Q,i()[Ae+8>>2]=xe,Zg(0,E,637534208,D,Q,Ae),_i(ye)},getTargetThreadForEventCallback:function(E){switch(E){case 1:return 0;case 2:return Ce.currentProxiedOperationCallerThread;default:return E}},getNodeNameForTarget:function(E){return E?E==window?"#window":E==screen?"#screen":E&&E.nodeName?E.nodeName:"":""},fullscreenEnabled:function(){return document.fullscreenEnabled||document.webkitFullscreenEnabled}};function og(E){var D=mt(E)+1,W=uo(D);return ft(E,W,D),W}function ig(E,D,W,Q){var xe=Hu(),ye=Ri(12),Ae=0;D&&(Ae=og(D)),i()[ye>>2]=Ae,i()[ye+4>>2]=W,i()[ye+8>>2]=Q,Zg(0,E,657457152,0,Ae,ye),_i(xe)}function lg(E,D,W,Q){D=D?We(D):"",ig(E,D,W,Q)}function ug(E){return E>2?We(E):E}var cg=[0,typeof document!="undefined"?document:0,typeof window!="undefined"?window:0];function dg(E){E=ug(E);var D=cg[E]||(typeof document!="undefined"?document.querySelector(E):void 0);return D}function Lu(E){return dg(E)}function Lh(E,D,W){var Q=Lu(E);if(!Q)return-4;if(Q.canvasSharedPtr&&(i()[Q.canvasSharedPtr>>2]=D,i()[Q.canvasSharedPtr+4>>2]=W),Q.offscreenCanvas||!Q.controlTransferredOffscreen){Q.offscreenCanvas&&(Q=Q.offscreenCanvas);var xe=!1;if(Q.GLctxObject&&Q.GLctxObject.GLctx){var ye=Q.GLctxObject.GLctx.getParameter(2978);xe=ye[0]===0&&ye[1]===0&&ye[2]===Q.width&&ye[3]===Q.height}Q.width=D,Q.height=W,xe&&Q.GLctxObject.GLctx.viewport(0,0,D,W)}else if(Q.canvasSharedPtr){var Ae=i()[Q.canvasSharedPtr+8>>2];return lg(Ae,E,D,W),1}else return-4;return 0}function Bh(E,D,W){return w?ba(2,1,E,D,W):Lh(E,D,W)}function hg(E,D,W){var Q=Lu(E);return Q?Lh(E,D,W):Bh(E,D,W)}function pg(E){}function fg(E,D){}function mg(E){var D=E.getExtension("ANGLE_instanced_arrays");if(D)return E.vertexAttribDivisor=function(W,Q){D.vertexAttribDivisorANGLE(W,Q)},E.drawArraysInstanced=function(W,Q,xe,ye){D.drawArraysInstancedANGLE(W,Q,xe,ye)},E.drawElementsInstanced=function(W,Q,xe,ye,Ae){D.drawElementsInstancedANGLE(W,Q,xe,ye,Ae)},1}function gg(E){var D=E.getExtension("OES_vertex_array_object");if(D)return E.createVertexArray=function(){return D.createVertexArrayOES()},E.deleteVertexArray=function(W){D.deleteVertexArrayOES(W)},E.bindVertexArray=function(W){D.bindVertexArrayOES(W)},E.isVertexArray=function(W){return D.isVertexArrayOES(W)},1}function yg(E){var D=E.getExtension("WEBGL_draw_buffers");if(D)return E.drawBuffers=function(W,Q){D.drawBuffersWEBGL(W,Q)},1}function Ag(E){return!!(E.multiDrawWebgl=E.getExtension("WEBGL_multi_draw"))}var ht={counter:1,buffers:[],programs:[],framebuffers:[],renderbuffers:[],textures:[],uniforms:[],shaders:[],vaos:[],contexts:{},offscreenCanvases:{},timerQueriesEXT:[],programInfos:{},stringCache:{},unpackAlignment:4,recordError:function(D){ht.lastError||(ht.lastError=D)},getNewId:function(E){for(var D=ht.counter++,W=E.length;W>2]:-1;xe+=We(i()[W+ye*4>>2],Ae<0?void 0:Ae)}return xe},createContext:function(E,D){var W=E.getContext("webgl",D);if(!W)return 0;var Q=ht.registerContext(W,D);return Q},registerContext:function(E,D){var W=uo(8);i()[W+4>>2]=$i();var Q={handle:W,attributes:D,version:D.majorVersion,GLctx:E};return E.canvas&&(E.canvas.GLctxObject=Q),ht.contexts[W]=Q,(typeof D.enableExtensionsByDefault=="undefined"||D.enableExtensionsByDefault)&&ht.initExtensions(Q),W},makeContextCurrent:function(E){return ht.currentContext=ht.contexts[E],c.ctx=va=ht.currentContext&&ht.currentContext.GLctx,!(E&&!va)},getContext:function(E){return ht.contexts[E]},deleteContext:function(E){ht.currentContext===ht.contexts[E]&&(ht.currentContext=null),typeof Xe=="object"&&Xe.removeAllHandlersOnTarget(ht.contexts[E].GLctx.canvas),ht.contexts[E]&&ht.contexts[E].GLctx.canvas&&(ht.contexts[E].GLctx.canvas.GLctxObject=void 0),Uu(ht.contexts[E].handle),ht.contexts[E]=null},initExtensions:function(E){if(E||(E=ht.currentContext),!E.initExtensionsDone){E.initExtensionsDone=!0;var D=E.GLctx;mg(D),gg(D),yg(D),D.disjointTimerQueryExt=D.getExtension("EXT_disjoint_timer_query"),Ag(D);var W=D.getSupportedExtensions()||[];W.forEach(function(Q){Q.indexOf("lose_context")<0&&Q.indexOf("debug")<0&&D.getExtension(Q)})}},populateUniformTable:function(E){for(var D=ht.programs[E],W=ht.programInfos[E]={uniforms:{},maxUniformLength:0,maxAttributeLength:-1,maxUniformBlockNameLength:-1},Q=W.uniforms,xe=va.getProgramParameter(D,35718),ye=0;ye>2,Q=i()[W+(24>>2)],xe={alpha:!!i()[W+(0>>2)],depth:!!i()[W+(4>>2)],stencil:!!i()[W+(8>>2)],antialias:!!i()[W+(12>>2)],premultipliedAlpha:!!i()[W+(16>>2)],preserveDrawingBuffer:!!i()[W+(20>>2)],powerPreference:xg[Q],failIfMajorPerformanceCaveat:!!i()[W+(28>>2)],majorVersion:i()[W+(32>>2)],minorVersion:i()[W+(36>>2)],enableExtensionsByDefault:i()[W+(40>>2)],explicitSwapControl:i()[W+(44>>2)],proxyContextToMainThread:i()[W+(48>>2)],renderViaOffscreenBackBuffer:i()[W+(52>>2)]},ye=Lu(E);if(!ye||xe.explicitSwapControl)return 0;var Ae=ht.createContext(ye,xe);return Ae}function vg(E,D){return bg(E,D)}var Ci={mappings:{},buffers:[null,[],[]],printChar:function(E,D){var W=Ci.buffers[E];D===0||D===10?((E===1?j:X)(qe(W,0)),W.length=0):W.push(D)},varargs:void 0,get:function(){Ci.varargs+=4;var E=i()[Ci.varargs-4>>2];return E},getStr:function(E){var D=We(E);return D},get64:function(E,D){return E}};function Wh(E){return w?ba(3,1,E):0}function Vh(E,D,W,Q,xe){if(w)return ba(4,1,E,D,W,Q,xe)}function Uh(E,D,W,Q){if(w)return ba(5,1,E,D,W,Q);for(var xe=0,ye=0;ye>2],Se=i()[D+(ye*8+4)>>2],gt=0;gt>2]=xe,0}function wg(E){var D=Ce.threadExitHandlers.pop();E&&D()}function kg(E,D){Ce.threadExitHandlers.push(function(){kr.get(E)(D)})}function Hh(E){if(w)throw"Internal Error! spawnThread() can only ever be called from main application thread!";var D=Ce.getNewWorker();if(D.pthread!==void 0)throw"Internal error!";if(!E.pthread_ptr)throw"Internal error, no pthread ptr!";Ce.runningWorkers.push(D);for(var W=uo(128*4),Q=0;Q<128;++Q)i()[W+Q*4>>2]=0;var xe=E.stackBase+E.stackSize,ye=Ce.pthreads[E.pthread_ptr]={worker:D,stackBase:E.stackBase,stackSize:E.stackSize,allocatedOwnStack:E.allocatedOwnStack,threadInfoStruct:E.pthread_ptr},Ae=ye.threadInfoStruct>>2;Atomics.store(l(),Ae+(64>>2),E.detached),Atomics.store(l(),Ae+(100>>2),W),Atomics.store(l(),Ae+(40>>2),ye.threadInfoStruct),Atomics.store(l(),Ae+(80>>2),E.stackSize),Atomics.store(l(),Ae+(76>>2),xe),Atomics.store(l(),Ae+(104>>2),E.stackSize),Atomics.store(l(),Ae+(104+8>>2),xe),Atomics.store(l(),Ae+(104+12>>2),E.detached);var Se=v3(),gt=Se+40;Atomics.store(l(),Ae+(172>>2),gt),D.pthread=ye;var pn={cmd:"run",start_routine:E.startRoutine,arg:E.arg,threadInfoStruct:E.pthread_ptr,stackBase:E.stackBase,stackSize:E.stackSize};D.runPthread=function(){pn.time=performance.now(),D.postMessage(pn,E.transferList)},D.loaded&&(D.runPthread(),delete D.runPthread)}function Ig(E,D,W,Q){if(typeof SharedArrayBuffer=="undefined")return X("Current environment does not support SharedArrayBuffer, pthreads are not available!"),6;if(!E)return X("pthread_create called with a null thread pointer!"),28;var xe=[],ye=0;if(w&&(xe.length===0||ye))return S3(687865856,E,D,W,Q);if(ye)return ye;var Ae=0,Se=0,gt=0;D&&D!=-1?(Ae=i()[D>>2],Ae+=81920,Se=i()[D+8>>2],gt=i()[D+12>>2]!==0):Ae=2097152;var pn=Se==0;pn?Se=C3(16,Ae):(Se-=Ae,be(Se>0));for(var sn=uo(228),ka=0;ka<228>>2;++ka)l()[(sn>>2)+ka]=0;i()[E>>2]=sn,i()[sn+12>>2]=sn;var Fi=sn+152;i()[Fi>>2]=Fi;var Dn={stackBase:Se,stackSize:Ae,allocatedOwnStack:pn,detached:gt,startRoutine:W,pthread_ptr:sn,arg:Q,transferList:xe};return w?(Dn.cmd="spawnThread",postMessage(Dn,xe)):Hh(Dn),0}function Gh(E){if(w)return ba(6,1,E);switch(E){case 30:return 16384;case 85:var D=2147483648;return D/16384;case 132:case 133:case 12:case 137:case 138:case 15:case 235:case 16:case 17:case 18:case 19:case 20:case 149:case 13:case 10:case 236:case 153:case 9:case 21:case 22:case 159:case 154:case 14:case 77:case 78:case 139:case 82:case 68:case 67:case 164:case 11:case 29:case 47:case 48:case 95:case 52:case 51:case 46:return 200809;case 27:case 246:case 127:case 128:case 23:case 24:case 160:case 161:case 181:case 182:case 242:case 183:case 184:case 243:case 244:case 245:case 165:case 178:case 179:case 49:case 50:case 168:case 169:case 175:case 170:case 171:case 172:case 97:case 76:case 32:case 173:case 35:case 80:case 81:case 79:return-1;case 176:case 177:case 7:case 155:case 8:case 157:case 125:case 126:case 92:case 93:case 129:case 130:case 131:case 94:case 91:return 1;case 74:case 60:case 69:case 70:case 4:return 1024;case 31:case 42:case 72:return 32;case 87:case 26:case 33:return 2147483647;case 34:case 1:return 47839;case 38:case 36:return 99;case 43:case 37:return 2048;case 0:return 2097152;case 3:return 65536;case 28:return 32768;case 44:return 32767;case 75:return 16384;case 39:return 1e3;case 89:return 700;case 71:return 256;case 40:return 255;case 2:return 100;case 180:return 64;case 25:return 20;case 5:return 16;case 6:return 6;case 73:return 4;case 84:return typeof navigator=="object"&&navigator.hardwareConcurrency||1}return j0(28),-1}w||Ce.initMainThreadBlock();var va,Sg=[null,q0,Bh,Wh,Vh,Uh,Gh],Tg={e:H0,r:G0,x:K0,b:X0,y:Z0,j:Y0,c:J0,d:Ou,f:lo,p:Q0,z:eg,u:ng,q:ag,v:hg,i:pg,t:fg,w:vg,m:Wh,n:Vh,g:Uh,o:zh,a:ne||c.wasmMemory,k:wg,l:kg,h:Ig,s:Gh},x3=O0(),jh=c.___wasm_call_ctors=function(){return(jh=c.___wasm_call_ctors=c.asm.A).apply(null,arguments)},Ng=c._init=function(){return(Ng=c._init=c.asm.B).apply(null,arguments)},Cg=c._register_tensor=function(){return(Cg=c._register_tensor=c.asm.C).apply(null,arguments)},Eg=c._dispose_data=function(){return(Eg=c._dispose_data=c.asm.D).apply(null,arguments)},$g=c._dispose=function(){return($g=c._dispose=c.asm.E).apply(null,arguments)},_g=c._Abs=function(){return(_g=c._Abs=c.asm.G).apply(null,arguments)},Rg=c._Add=function(){return(Rg=c._Add=c.asm.H).apply(null,arguments)},Dg=c._AddN=function(){return(Dg=c._AddN=c.asm.I).apply(null,arguments)},Fg=c._All=function(){return(Fg=c._All=c.asm.J).apply(null,arguments)},Mg=c._Any=function(){return(Mg=c._Any=c.asm.K).apply(null,arguments)},Og=c._ArgMax=function(){return(Og=c._ArgMax=c.asm.L).apply(null,arguments)},Pg=c._AvgPool=function(){return(Pg=c._AvgPool=c.asm.M).apply(null,arguments)},zg=c._BatchMatMul=function(){return(zg=c._BatchMatMul=c.asm.N).apply(null,arguments)},Lg=c._Ceil=function(){return(Lg=c._Ceil=c.asm.O).apply(null,arguments)},Bg=c._ClipByValue=function(){return(Bg=c._ClipByValue=c.asm.P).apply(null,arguments)},Wg=c._Conv2D=function(){return(Wg=c._Conv2D=c.asm.Q).apply(null,arguments)},Vg=c._Conv2DBackpropInput=function(){return(Vg=c._Conv2DBackpropInput=c.asm.R).apply(null,arguments)},Ug=c._Cos=function(){return(Ug=c._Cos=c.asm.S).apply(null,arguments)},Hg=c._CropAndResize=function(){return(Hg=c._CropAndResize=c.asm.T).apply(null,arguments)},Gg=c._Cumsum=function(){return(Gg=c._Cumsum=c.asm.U).apply(null,arguments)},jg=c._DepthToSpace=function(){return(jg=c._DepthToSpace=c.asm.V).apply(null,arguments)},qg=c._DepthwiseConv2dNative=function(){return(qg=c._DepthwiseConv2dNative=c.asm.W).apply(null,arguments)},qh=c._Equal=function(){return(qh=c._Equal=c.asm.X).apply(null,arguments)},Kh=c._Exp=function(){return(Kh=c._Exp=c.asm.Y).apply(null,arguments)},Xh=c._FlipLeftRight=function(){return(Xh=c._FlipLeftRight=c.asm.Z).apply(null,arguments)},Bu=c._Floor=function(){return(Bu=c._Floor=c.asm._).apply(null,arguments)},Ei=c._FloorDiv=function(){return(Ei=c._FloorDiv=c.asm.$).apply(null,arguments)},Kg=c._FusedBatchNorm=function(){return(Kg=c._FusedBatchNorm=c.asm.aa).apply(null,arguments)},Wu=c._FusedConv2D=function(){return(Wu=c._FusedConv2D=c.asm.ba).apply(null,arguments)},te=c._FusedDepthwiseConv2D=function(){return(te=c._FusedDepthwiseConv2D=c.asm.ca).apply(null,arguments)},le=c._Gather=function(){return(le=c._Gather=c.asm.da).apply(null,arguments)},we=c._GatherNd=function(){return(we=c._GatherNd=c.asm.ea).apply(null,arguments)},lt=c._Greater=function(){return(lt=c._Greater=c.asm.fa).apply(null,arguments)},Gt=c._GreaterEqual=function(){return(Gt=c._GreaterEqual=c.asm.ga).apply(null,arguments)},Mt=c._LeakyRelu=function(){return(Mt=c._LeakyRelu=c.asm.ha).apply(null,arguments)},et=c._Less=function(){return(et=c._Less=c.asm.ia).apply(null,arguments)},tt=c._LessEqual=function(){return(tt=c._LessEqual=c.asm.ja).apply(null,arguments)},kn=c._Log=function(){return(kn=c._Log=c.asm.ka).apply(null,arguments)},js=c._LogicalAnd=function(){return(js=c._LogicalAnd=c.asm.la).apply(null,arguments)},qs=c._Max=function(){return(qs=c._Max=c.asm.ma).apply(null,arguments)},Zh=c._MaxPool=function(){return(Zh=c._MaxPool=c.asm.na).apply(null,arguments)},Vu=c._Maximum=function(){return(Vu=c._Maximum=c.asm.oa).apply(null,arguments)},or=c._Mean=function(){return(or=c._Mean=c.asm.pa).apply(null,arguments)},wa=c._Min=function(){return(wa=c._Min=c.asm.qa).apply(null,arguments)},Yh=c._Minimum=function(){return(Yh=c._Minimum=c.asm.ra).apply(null,arguments)},d_=c._MirrorPad=function(){return(d_=c._MirrorPad=c.asm.sa).apply(null,arguments)},h_=c._Multiply=function(){return(h_=c._Multiply=c.asm.ta).apply(null,arguments)},p_=c._Neg=function(){return(p_=c._Neg=c.asm.ua).apply(null,arguments)},f_=c._NonMaxSuppressionV3=function(){return(f_=c._NonMaxSuppressionV3=c.asm.va).apply(null,arguments)},m_=c._NonMaxSuppressionV4=function(){return(m_=c._NonMaxSuppressionV4=c.asm.wa).apply(null,arguments)},g_=c._NonMaxSuppressionV5=function(){return(g_=c._NonMaxSuppressionV5=c.asm.xa).apply(null,arguments)},y_=c._NotEqual=function(){return(y_=c._NotEqual=c.asm.ya).apply(null,arguments)},A_=c._OneHot=function(){return(A_=c._OneHot=c.asm.za).apply(null,arguments)},x_=c._PadV2=function(){return(x_=c._PadV2=c.asm.Aa).apply(null,arguments)},b_=c._Pow=function(){return(b_=c._Pow=c.asm.Ba).apply(null,arguments)},v_=c._Prelu=function(){return(v_=c._Prelu=c.asm.Ca).apply(null,arguments)},w_=c._Prod=function(){return(w_=c._Prod=c.asm.Da).apply(null,arguments)},k_=c._RealDiv=function(){return(k_=c._RealDiv=c.asm.Ea).apply(null,arguments)},I_=c._Relu=function(){return(I_=c._Relu=c.asm.Fa).apply(null,arguments)},S_=c._Relu6=function(){return(S_=c._Relu6=c.asm.Ga).apply(null,arguments)},T_=c._ResizeBilinear=function(){return(T_=c._ResizeBilinear=c.asm.Ha).apply(null,arguments)},N_=c._Reverse=function(){return(N_=c._Reverse=c.asm.Ia).apply(null,arguments)},C_=c._RotateWithOffset=function(){return(C_=c._RotateWithOffset=c.asm.Ja).apply(null,arguments)},E_=c._Round=function(){return(E_=c._Round=c.asm.Ka).apply(null,arguments)},$_=c._Rsqrt=function(){return($_=c._Rsqrt=c.asm.La).apply(null,arguments)},__=c._ScatterNd=function(){return(__=c._ScatterNd=c.asm.Ma).apply(null,arguments)},R_=c._SelectV2=function(){return(R_=c._SelectV2=c.asm.Na).apply(null,arguments)},D_=c._Sigmoid=function(){return(D_=c._Sigmoid=c.asm.Oa).apply(null,arguments)},F_=c._Sin=function(){return(F_=c._Sin=c.asm.Pa).apply(null,arguments)},M_=c._Softmax=function(){return(M_=c._Softmax=c.asm.Qa).apply(null,arguments)},O_=c._Sqrt=function(){return(O_=c._Sqrt=c.asm.Ra).apply(null,arguments)},P_=c._Square=function(){return(P_=c._Square=c.asm.Sa).apply(null,arguments)},z_=c._SquaredDifference=function(){return(z_=c._SquaredDifference=c.asm.Ta).apply(null,arguments)},L_=c._Step=function(){return(L_=c._Step=c.asm.Ua).apply(null,arguments)},B_=c._StridedSlice=function(){return(B_=c._StridedSlice=c.asm.Va).apply(null,arguments)},W_=c._Sub=function(){return(W_=c._Sub=c.asm.Wa).apply(null,arguments)},V_=c._Sum=function(){return(V_=c._Sum=c.asm.Xa).apply(null,arguments)},U_=c._Tan=function(){return(U_=c._Tan=c.asm.Ya).apply(null,arguments)},H_=c._Tanh=function(){return(H_=c._Tanh=c.asm.Za).apply(null,arguments)},G_=c._Tile=function(){return(G_=c._Tile=c.asm._a).apply(null,arguments)},j_=c._TopK=function(){return(j_=c._TopK=c.asm.$a).apply(null,arguments)},q_=c._Transform=function(){return(q_=c._Transform=c.asm.ab).apply(null,arguments)},K_=c._Transpose=function(){return(K_=c._Transpose=c.asm.bb).apply(null,arguments)},X_=c.__FusedMatMul=function(){return(X_=c.__FusedMatMul=c.asm.cb).apply(null,arguments)},uo=c._malloc=function(){return(uo=c._malloc=c.asm.db).apply(null,arguments)},Uu=c._free=function(){return(Uu=c._free=c.asm.eb).apply(null,arguments)},b3=c.___errno_location=function(){return(b3=c.___errno_location=c.asm.fb).apply(null,arguments)},v3=c._emscripten_get_global_libc=function(){return(v3=c._emscripten_get_global_libc=c.asm.gb).apply(null,arguments)},$i=c._pthread_self=function(){return($i=c._pthread_self=c.asm.hb).apply(null,arguments)},w3=c.___pthread_tsd_run_dtors=function(){return(w3=c.___pthread_tsd_run_dtors=c.asm.ib).apply(null,arguments)},Xg=c._emscripten_main_thread_process_queued_calls=function(){return(Xg=c._emscripten_main_thread_process_queued_calls=c.asm.jb).apply(null,arguments)},Z_=c._emscripten_current_thread_process_queued_calls=function(){return(Z_=c._emscripten_current_thread_process_queued_calls=c.asm.kb).apply(null,arguments)},k3=c._emscripten_register_main_browser_thread_id=function(){return(k3=c._emscripten_register_main_browser_thread_id=c.asm.lb).apply(null,arguments)},I3=c.__emscripten_do_dispatch_to_thread=function(){return(I3=c.__emscripten_do_dispatch_to_thread=c.asm.mb).apply(null,arguments)},S3=c._emscripten_sync_run_in_main_thread_4=function(){return(S3=c._emscripten_sync_run_in_main_thread_4=c.asm.nb).apply(null,arguments)},T3=c._emscripten_run_in_main_runtime_thread_js=function(){return(T3=c._emscripten_run_in_main_runtime_thread_js=c.asm.ob).apply(null,arguments)},Zg=c.__emscripten_call_on_thread=function(){return(Zg=c.__emscripten_call_on_thread=c.asm.pb).apply(null,arguments)},Y_=c._emscripten_tls_init=function(){return(Y_=c._emscripten_tls_init=c.asm.qb).apply(null,arguments)},Yg=c.__emscripten_thread_init=function(){return(Yg=c.__emscripten_thread_init=c.asm.rb).apply(null,arguments)},Hu=c.stackSave=function(){return(Hu=c.stackSave=c.asm.sb).apply(null,arguments)},_i=c.stackRestore=function(){return(_i=c.stackRestore=c.asm.tb).apply(null,arguments)},Ri=c.stackAlloc=function(){return(Ri=c.stackAlloc=c.asm.ub).apply(null,arguments)},N3=c._emscripten_stack_set_limits=function(){return(N3=c._emscripten_stack_set_limits=c.asm.vb).apply(null,arguments)},C3=c._memalign=function(){return(C3=c._memalign=c.asm.wb).apply(null,arguments)},E3=c.__emscripten_allow_main_runtime_queued_calls=9808,Di=c.__emscripten_main_thread_futex=11432;c.cwrap=ze,c.PThread=Ce,c.PThread=Ce,c.wasmMemory=ne,c.ExitStatus=Gu;var Jh;function Gu(E){this.name="ExitStatus",this.message="Program terminated with exit("+E+")",this.status=E}io=function E(){Jh||Jg(),Jh||(io=E)};function Jg(E){if(E=E||m,Hs>0)return;if(w){d(c),Mu(),postMessage({cmd:"loaded"});return}if(E0(),Hs>0)return;function D(){Jh||(Jh=!0,c.calledRun=!0,!he&&(Mu(),$0(),d(c),c.onRuntimeInitialized&&c.onRuntimeInitialized(),qn()))}c.setStatus?(c.setStatus("Running..."),setTimeout(function(){setTimeout(function(){c.setStatus("")},1),D()},1)):D()}c.run=Jg;function J_(E,D){if(!(D&&ie&&E===0)){if(!D&&w)throw postMessage({cmd:"exitProcess",returnCode:E}),new Gu(E);ie||(Ce.terminateAllThreads(),ge=E,Rh(),c.onExit&&c.onExit(E),he=!0),y(E,new Gu(E))}}if(c.preInit)for(typeof c.preInit=="function"&&(c.preInit=[c.preInit]);c.preInit.length>0;)c.preInit.pop()();return w&&(ie=!1,Ce.initWorker()),Jg(),s.ready}}();typeof e=="object"&&typeof t=="object"?t.exports=n:typeof define=="function"&&define.amd?define([],function(){return n}):typeof e=="object"&&(e.WasmBackendModuleThreadedSimd=n)}}),SR=Ot({"node_modules/.pnpm/@tensorflow+tfjs-backend-wasm@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-wasm/wasm-out/tfjs-backend-wasm.js"(e,t){var n=function(){var r=typeof document!="undefined"&&document.currentScript?document.currentScript.src:void 0;return typeof __filename!="undefined"&&(r=r||__filename),function(s){s=s||{};var a=typeof s!="undefined"?s:{},o,i;a.ready=new Promise(function(te,le){o=te,i=le});var l={},u;for(u in a)a.hasOwnProperty(u)&&(l[u]=a[u]);var c=[],d="./this.program",h=function(te,le){throw le},p=!1,f=!1,m=!1,g=!1;p=typeof window=="object",f=typeof importScripts=="function",m=typeof process=="object"&&typeof process.versions=="object"&&typeof process.versions.node=="string",g=!p&&!m&&!f;var y="";function A(te){return a.locateFile?a.locateFile(te,y):y+te}var x,b,v,w,I,T;m?(f?y=ju().dirname(y)+"/":y=__dirname+"/",x=function(le,we){return I||(I=co("fs")),T||(T=ju()),le=T.normalize(le),I.readFileSync(le,we?null:"utf8")},v=function(le){var we=x(le,!0);return we.buffer||(we=new Uint8Array(we)),j(we.buffer),we},process.argv.length>1&&(d=process.argv[1].replace(/\\/g,"/")),c=process.argv.slice(2),process.on("uncaughtException",function(te){if(!(te instanceof Kg))throw te}),process.on("unhandledRejection",ks),h=function(te){process.exit(te)},a.inspect=function(){return"[Emscripten Module object]"}):g?(typeof read!="undefined"&&(x=function(le){return read(le)}),v=function(le){var we;return typeof readbuffer=="function"?new Uint8Array(readbuffer(le)):(we=read(le,"binary"),j(typeof we=="object"),we)},typeof scriptArgs!="undefined"?c=scriptArgs:typeof arguments!="undefined"&&(c=arguments),typeof quit=="function"&&(h=function(te){quit(te)}),typeof print!="undefined"&&(typeof console=="undefined"&&(console={}),console.log=print,console.warn=console.error=typeof printErr!="undefined"?printErr:print)):(p||f)&&(f?y=self.location.href:typeof document!="undefined"&&document.currentScript&&(y=document.currentScript.src),r&&(y=r),y.indexOf("blob:")!==0?y=y.substr(0,y.lastIndexOf("/")+1):y="",x=function(te){var le=new XMLHttpRequest;return le.open("GET",te,!1),le.send(null),le.responseText},f&&(v=function(te){var le=new XMLHttpRequest;return le.open("GET",te,!1),le.responseType="arraybuffer",le.send(null),new Uint8Array(le.response)}),b=function(te,le,we){var lt=new XMLHttpRequest;lt.open("GET",te,!0),lt.responseType="arraybuffer",lt.onload=function(){if(lt.status==200||lt.status==0&<.response){le(lt.response);return}we()},lt.onerror=we,lt.send(null)},w=function(te){document.title=te});var C=a.print||console.log.bind(console),M=a.printErr||console.warn.bind(console);for(u in l)l.hasOwnProperty(u)&&(a[u]=l[u]);l=null,a.arguments&&(c=a.arguments),a.thisProgram&&(d=a.thisProgram),a.quit&&(h=a.quit);var $;a.wasmBinary&&($=a.wasmBinary);var R=a.noExitRuntime||!0;typeof WebAssembly!="object"&&ks("no native wasm support detected");var N,F=!1,B;function j(te,le){te||ks("Assertion failed: "+le)}function X(te){var le=a["_"+te];return j(le,"Cannot call unknown function "+te+", make sure it is exported"),le}function Y(te,le,we,lt,Gt){var Mt={string:function(or){var wa=0;if(or!=null&&or!==0){var Yh=(or.length<<2)+1;wa=Bu(Yh),de(or,wa,Yh)}return wa},array:function(or){var wa=Bu(or.length);return he(or,wa),wa}};function et(or){return le==="string"?ie(or):le==="boolean"?Boolean(or):or}var tt=X(te),kn=[],js=0;if(lt)for(var qs=0;qs=lt);)++Gt;if(Gt-le>16&&te.subarray&&oe)return oe.decode(te.subarray(le,Gt));for(var Mt="";le>10,56320|js&1023)}}return Mt}function ie(te,le){return te?se($e,te,le):""}function ne(te,le,we,lt){if(!(lt>0))return 0;for(var Gt=we,Mt=we+lt-1,et=0;et=55296&&tt<=57343){var kn=te.charCodeAt(++et);tt=65536+((tt&1023)<<10)|kn&1023}if(tt<=127){if(we>=Mt)break;le[we++]=tt}else if(tt<=2047){if(we+1>=Mt)break;le[we++]=192|tt>>6,le[we++]=128|tt&63}else if(tt<=65535){if(we+2>=Mt)break;le[we++]=224|tt>>12,le[we++]=128|tt>>6&63,le[we++]=128|tt&63}else{if(we+3>=Mt)break;le[we++]=240|tt>>18,le[we++]=128|tt>>12&63,le[we++]=128|tt>>6&63,le[we++]=128|tt&63}}return le[we]=0,we-Gt}function de(te,le,we){return ne(te,$e,le,we)}function he(te,le){Ee.set(te,le)}function ge(te,le){return te%le>0&&(te+=le-te%le),te}var be,Ee,$e,ze,qe,We,vt,ft,mt;function dt(te){be=te,a.HEAP8=Ee=new Int8Array(te),a.HEAP16=ze=new Int16Array(te),a.HEAP32=We=new Int32Array(te),a.HEAPU8=$e=new Uint8Array(te),a.HEAPU16=qe=new Uint16Array(te),a.HEAPU32=vt=new Uint32Array(te),a.HEAPF32=ft=new Float32Array(te),a.HEAPF64=mt=new Float64Array(te)}var bt=a.INITIAL_MEMORY||16777216,Je,jn=[],Wt=[],sr=[],vn=[],Vr=!1;Wt.push({func:function(){zh()}});function Rn(){if(a.preRun)for(typeof a.preRun=="function"&&(a.preRun=[a.preRun]);a.preRun.length;)wr(a.preRun.shift());xa(jn)}function br(){Vr=!0,xa(Wt)}function vr(){xa(sr)}function wn(){if(a.postRun)for(typeof a.postRun=="function"&&(a.postRun=[a.postRun]);a.postRun.length;)kr(a.postRun.shift());xa(vn)}function wr(te){jn.unshift(te)}function kr(te){vn.unshift(te)}var ar=0,ws=null,Us=null;function Aa(te){ar++,a.monitorRunDependencies&&a.monitorRunDependencies(ar)}function Si(te){if(ar--,a.monitorRunDependencies&&a.monitorRunDependencies(ar),ar==0&&(ws!==null&&(clearInterval(ws),ws=null),Us)){var le=Us;Us=null,le()}}a.preloadedImages={},a.preloadedAudios={};function ks(te){a.onAbort&&a.onAbort(te),te+="",M(te),F=!0,B=1,te="abort("+te+"). Build with -s ASSERTIONS=1 for more info.";var le=new WebAssembly.RuntimeError(te);throw i(le),le}function _h(te,le){return String.prototype.startsWith?te.startsWith(le):te.indexOf(le)===0}var E0="data:application/octet-stream;base64,";function Mu(te){return _h(te,E0)}var $0="file://";function Rh(te){return _h(te,$0)}var qn="tfjs-backend-wasm.wasm";Mu(qn)||(qn=A(qn));function Dh(te){try{if(te==qn&&$)return new Uint8Array($);if(v)return v(te);throw"both async and sync fetching of the wasm failed"}catch(le){ks(le)}}function _0(){if(!$&&(p||f)){if(typeof fetch=="function"&&!Rh(qn))return fetch(qn,{credentials:"same-origin"}).then(function(te){if(!te.ok)throw"failed to load wasm binary file at '"+qn+"'";return te.arrayBuffer()}).catch(function(){return Dh(qn)});if(b)return new Promise(function(te,le){b(qn,function(we){te(new Uint8Array(we))},le)})}return Promise.resolve().then(function(){return Dh(qn)})}function Hs(){var te={a:O0};function le(et,tt){var kn=et.exports;a.asm=kn,N=a.asm.i,dt(N.buffer),Je=a.asm.o,Si("wasm-instantiate")}Aa("wasm-instantiate");function we(et){le(et.instance)}function lt(et){return _0().then(function(tt){return WebAssembly.instantiate(tt,te)}).then(et,function(tt){M("failed to asynchronously prepare wasm: "+tt),ks(tt)})}function Gt(){return!$&&typeof WebAssembly.instantiateStreaming=="function"&&!Mu(qn)&&!Rh(qn)&&typeof fetch=="function"?fetch(qn,{credentials:"same-origin"}).then(function(et){var tt=WebAssembly.instantiateStreaming(et,te);return tt.then(we,function(kn){return M("wasm streaming compile failed: "+kn),M("falling back to ArrayBuffer instantiation"),lt(we)})}):lt(we)}if(a.instantiateWasm)try{var Mt=a.instantiateWasm(te,le);return Mt}catch(et){return M("Module.instantiateWasm callback failed with error: "+et),!1}return Gt().catch(i),{}}function xa(te){for(;te.length>0;){var le=te.shift();if(typeof le=="function"){le(a);continue}var we=le.func;typeof we=="number"?le.arg===void 0?Je.get(we)():Je.get(we)(le.arg):we(le.arg===void 0?null:le.arg)}}function io(){ks()}function R0(te,le,we){$e.copyWithin(te,le,le+we)}function D0(){return $e.length}function Gs(te){try{return N.grow(te-be.byteLength+65535>>>16),dt(N.buffer),1}catch(le){}}function Fh(te){var le=D0(),we=2147483648;if(te>we)return!1;for(var lt=1;lt<=4;lt*=2){var Gt=le*(1+.2/lt);Gt=Math.min(Gt,te+100663296);var Mt=Math.min(we,ge(Math.max(te,Gt),65536)),et=Gs(Mt);if(et)return!0}return!1}var Ti={mappings:{},buffers:[null,[],[]],printChar:function(te,le){var we=Ti.buffers[te];le===0||le===10?((te===1?C:M)(se(we,0)),we.length=0):we.push(le)},varargs:void 0,get:function(){Ti.varargs+=4;var te=We[Ti.varargs-4>>2];return te},getStr:function(te){var le=ie(te);return le},get64:function(te,le){return te}};function Mh(te){return 0}function F0(te,le,we,lt,Gt){}function Oh(te,le,we,lt){for(var Gt=0,Mt=0;Mt>2],tt=We[le+(Mt*8+4)>>2],kn=0;kn>2]=Gt,0}function Kn(){return 6}function Ph(te){return We[qh()>>2]=te,te}function M0(te){switch(te){case 30:return 16384;case 85:var le=2147483648;return le/16384;case 132:case 133:case 12:case 137:case 138:case 15:case 235:case 16:case 17:case 18:case 19:case 20:case 149:case 13:case 10:case 236:case 153:case 9:case 21:case 22:case 159:case 154:case 14:case 77:case 78:case 139:case 82:case 68:case 67:case 164:case 11:case 29:case 47:case 48:case 95:case 52:case 51:case 46:return 200809;case 27:case 246:case 127:case 128:case 23:case 24:case 160:case 161:case 181:case 182:case 242:case 183:case 184:case 243:case 244:case 245:case 165:case 178:case 179:case 49:case 50:case 168:case 169:case 175:case 170:case 171:case 172:case 97:case 76:case 32:case 173:case 35:case 80:case 81:case 79:return-1;case 176:case 177:case 7:case 155:case 8:case 157:case 125:case 126:case 92:case 93:case 129:case 130:case 131:case 94:case 91:return 1;case 74:case 60:case 69:case 70:case 4:return 1024;case 31:case 42:case 72:return 32;case 87:case 26:case 33:return 2147483647;case 34:case 1:return 47839;case 38:case 36:return 99;case 43:case 37:return 2048;case 0:return 2097152;case 3:return 65536;case 28:return 32768;case 44:return 32767;case 75:return 16384;case 39:return 1e3;case 89:return 700;case 71:return 256;case 40:return 255;case 2:return 100;case 180:return 64;case 25:return 20;case 5:return 16;case 6:return 6;case 73:return 4;case 84:return typeof navigator=="object"&&navigator.hardwareConcurrency||1}return Ph(28),-1}var O0={a:io,d:R0,e:Fh,f:Mh,c:F0,b:Oh,g:Kn,h:M0},P0=Hs(),zh=a.___wasm_call_ctors=function(){return(zh=a.___wasm_call_ctors=a.asm.j).apply(null,arguments)},Ni=a._init=function(){return(Ni=a._init=a.asm.k).apply(null,arguments)},Ou=a._register_tensor=function(){return(Ou=a._register_tensor=a.asm.l).apply(null,arguments)},z0=a._dispose_data=function(){return(z0=a._dispose_data=a.asm.m).apply(null,arguments)},L0=a._dispose=function(){return(L0=a._dispose=a.asm.n).apply(null,arguments)},B0=a._Abs=function(){return(B0=a._Abs=a.asm.p).apply(null,arguments)},Ce=a._Add=function(){return(Ce=a._Add=a.asm.q).apply(null,arguments)},W0=a._AddN=function(){return(W0=a._AddN=a.asm.r).apply(null,arguments)},V0=a._All=function(){return(V0=a._All=a.asm.s).apply(null,arguments)},U0=a._Any=function(){return(U0=a._Any=a.asm.t).apply(null,arguments)},H0=a._ArgMax=function(){return(H0=a._ArgMax=a.asm.u).apply(null,arguments)},G0=a._AvgPool=function(){return(G0=a._AvgPool=a.asm.v).apply(null,arguments)},lo=a._BatchMatMul=function(){return(lo=a._BatchMatMul=a.asm.w).apply(null,arguments)},j0=a._Ceil=function(){return(j0=a._Ceil=a.asm.x).apply(null,arguments)},q0=a._ClipByValue=function(){return(q0=a._ClipByValue=a.asm.y).apply(null,arguments)},K0=a._Conv2D=function(){return(K0=a._Conv2D=a.asm.z).apply(null,arguments)},X0=a._Conv2DBackpropInput=function(){return(X0=a._Conv2DBackpropInput=a.asm.A).apply(null,arguments)},Z0=a._Cos=function(){return(Z0=a._Cos=a.asm.B).apply(null,arguments)},Y0=a._CropAndResize=function(){return(Y0=a._CropAndResize=a.asm.C).apply(null,arguments)},J0=a._Cumsum=function(){return(J0=a._Cumsum=a.asm.D).apply(null,arguments)},Q0=a._DepthToSpace=function(){return(Q0=a._DepthToSpace=a.asm.E).apply(null,arguments)},eg=a._DepthwiseConv2dNative=function(){return(eg=a._DepthwiseConv2dNative=a.asm.F).apply(null,arguments)},ba=a._Equal=function(){return(ba=a._Equal=a.asm.G).apply(null,arguments)},Pu=a._Exp=function(){return(Pu=a._Exp=a.asm.H).apply(null,arguments)},zu=a._FlipLeftRight=function(){return(zu=a._FlipLeftRight=a.asm.I).apply(null,arguments)},tg=a._Floor=function(){return(tg=a._Floor=a.asm.J).apply(null,arguments)},ng=a._FloorDiv=function(){return(ng=a._FloorDiv=a.asm.K).apply(null,arguments)},rg=a._FusedBatchNorm=function(){return(rg=a._FusedBatchNorm=a.asm.L).apply(null,arguments)},sg=a._FusedConv2D=function(){return(sg=a._FusedConv2D=a.asm.M).apply(null,arguments)},ag=a._FusedDepthwiseConv2D=function(){return(ag=a._FusedDepthwiseConv2D=a.asm.N).apply(null,arguments)},Xe=a._Gather=function(){return(Xe=a._Gather=a.asm.O).apply(null,arguments)},og=a._GatherNd=function(){return(og=a._GatherNd=a.asm.P).apply(null,arguments)},ig=a._Greater=function(){return(ig=a._Greater=a.asm.Q).apply(null,arguments)},lg=a._GreaterEqual=function(){return(lg=a._GreaterEqual=a.asm.R).apply(null,arguments)},ug=a._LeakyRelu=function(){return(ug=a._LeakyRelu=a.asm.S).apply(null,arguments)},cg=a._Less=function(){return(cg=a._Less=a.asm.T).apply(null,arguments)},dg=a._LessEqual=function(){return(dg=a._LessEqual=a.asm.U).apply(null,arguments)},Lu=a._Log=function(){return(Lu=a._Log=a.asm.V).apply(null,arguments)},Lh=a._LogicalAnd=function(){return(Lh=a._LogicalAnd=a.asm.W).apply(null,arguments)},Bh=a._Max=function(){return(Bh=a._Max=a.asm.X).apply(null,arguments)},hg=a._MaxPool=function(){return(hg=a._MaxPool=a.asm.Y).apply(null,arguments)},pg=a._Maximum=function(){return(pg=a._Maximum=a.asm.Z).apply(null,arguments)},fg=a._Mean=function(){return(fg=a._Mean=a.asm._).apply(null,arguments)},mg=a._Min=function(){return(mg=a._Min=a.asm.$).apply(null,arguments)},gg=a._Minimum=function(){return(gg=a._Minimum=a.asm.aa).apply(null,arguments)},yg=a._MirrorPad=function(){return(yg=a._MirrorPad=a.asm.ba).apply(null,arguments)},Ag=a._Multiply=function(){return(Ag=a._Multiply=a.asm.ca).apply(null,arguments)},ht=a._Neg=function(){return(ht=a._Neg=a.asm.da).apply(null,arguments)},xg=a._NonMaxSuppressionV3=function(){return(xg=a._NonMaxSuppressionV3=a.asm.ea).apply(null,arguments)},bg=a._NonMaxSuppressionV4=function(){return(bg=a._NonMaxSuppressionV4=a.asm.fa).apply(null,arguments)},vg=a._NonMaxSuppressionV5=function(){return(vg=a._NonMaxSuppressionV5=a.asm.ga).apply(null,arguments)},Ci=a._NotEqual=function(){return(Ci=a._NotEqual=a.asm.ha).apply(null,arguments)},Wh=a._OneHot=function(){return(Wh=a._OneHot=a.asm.ia).apply(null,arguments)},Vh=a._PadV2=function(){return(Vh=a._PadV2=a.asm.ja).apply(null,arguments)},Uh=a._Pow=function(){return(Uh=a._Pow=a.asm.ka).apply(null,arguments)},wg=a._Prelu=function(){return(wg=a._Prelu=a.asm.la).apply(null,arguments)},kg=a._Prod=function(){return(kg=a._Prod=a.asm.ma).apply(null,arguments)},Hh=a._RealDiv=function(){return(Hh=a._RealDiv=a.asm.na).apply(null,arguments)},Ig=a._Relu=function(){return(Ig=a._Relu=a.asm.oa).apply(null,arguments)},Gh=a._Relu6=function(){return(Gh=a._Relu6=a.asm.pa).apply(null,arguments)},va=a._ResizeBilinear=function(){return(va=a._ResizeBilinear=a.asm.qa).apply(null,arguments)},Sg=a._Reverse=function(){return(Sg=a._Reverse=a.asm.ra).apply(null,arguments)},Tg=a._RotateWithOffset=function(){return(Tg=a._RotateWithOffset=a.asm.sa).apply(null,arguments)},x3=a._Round=function(){return(x3=a._Round=a.asm.ta).apply(null,arguments)},jh=a._Rsqrt=function(){return(jh=a._Rsqrt=a.asm.ua).apply(null,arguments)},Ng=a._ScatterNd=function(){return(Ng=a._ScatterNd=a.asm.va).apply(null,arguments)},Cg=a._SelectV2=function(){return(Cg=a._SelectV2=a.asm.wa).apply(null,arguments)},Eg=a._Sigmoid=function(){return(Eg=a._Sigmoid=a.asm.xa).apply(null,arguments)},$g=a._Sin=function(){return($g=a._Sin=a.asm.ya).apply(null,arguments)},_g=a._Softmax=function(){return(_g=a._Softmax=a.asm.za).apply(null,arguments)},Rg=a._Sqrt=function(){return(Rg=a._Sqrt=a.asm.Aa).apply(null,arguments)},Dg=a._Square=function(){return(Dg=a._Square=a.asm.Ba).apply(null,arguments)},Fg=a._SquaredDifference=function(){return(Fg=a._SquaredDifference=a.asm.Ca).apply(null,arguments)},Mg=a._Step=function(){return(Mg=a._Step=a.asm.Da).apply(null,arguments)},Og=a._StridedSlice=function(){return(Og=a._StridedSlice=a.asm.Ea).apply(null,arguments)},Pg=a._Sub=function(){return(Pg=a._Sub=a.asm.Fa).apply(null,arguments)},zg=a._Sum=function(){return(zg=a._Sum=a.asm.Ga).apply(null,arguments)},Lg=a._Tan=function(){return(Lg=a._Tan=a.asm.Ha).apply(null,arguments)},Bg=a._Tanh=function(){return(Bg=a._Tanh=a.asm.Ia).apply(null,arguments)},Wg=a._Tile=function(){return(Wg=a._Tile=a.asm.Ja).apply(null,arguments)},Vg=a._TopK=function(){return(Vg=a._TopK=a.asm.Ka).apply(null,arguments)},Ug=a._Transform=function(){return(Ug=a._Transform=a.asm.La).apply(null,arguments)},Hg=a._Transpose=function(){return(Hg=a._Transpose=a.asm.Ma).apply(null,arguments)},Gg=a.__FusedMatMul=function(){return(Gg=a.__FusedMatMul=a.asm.Na).apply(null,arguments)},jg=a._malloc=function(){return(jg=a._malloc=a.asm.Oa).apply(null,arguments)},qg=a._free=function(){return(qg=a._free=a.asm.Pa).apply(null,arguments)},qh=a.___errno_location=function(){return(qh=a.___errno_location=a.asm.Qa).apply(null,arguments)},Kh=a.stackSave=function(){return(Kh=a.stackSave=a.asm.Ra).apply(null,arguments)},Xh=a.stackRestore=function(){return(Xh=a.stackRestore=a.asm.Sa).apply(null,arguments)},Bu=a.stackAlloc=function(){return(Bu=a.stackAlloc=a.asm.Ta).apply(null,arguments)};a.cwrap=ee;var Ei;function Kg(te){this.name="ExitStatus",this.message="Program terminated with exit("+te+")",this.status=te}Us=function te(){Ei||Wu(),Ei||(Us=te)};function Wu(te){if(te=te||c,ar>0||(Rn(),ar>0))return;function le(){Ei||(Ei=!0,a.calledRun=!0,!F&&(br(),vr(),o(a),a.onRuntimeInitialized&&a.onRuntimeInitialized(),wn()))}a.setStatus?(a.setStatus("Running..."),setTimeout(function(){setTimeout(function(){a.setStatus("")},1),le()},1)):le()}if(a.run=Wu,a.preInit)for(typeof a.preInit=="function"&&(a.preInit=[a.preInit]);a.preInit.length>0;)a.preInit.pop()();return Wu(),s.ready}}();typeof e=="object"&&typeof t=="object"?t.exports=n:typeof define=="function"&&define.amd?define([],function(){return n}):typeof e=="object"&&(e.WasmBackendModule=n)}}),TR="3.7.0",NR="3.7.0",CR="3.7.0",ER="3.7.0",$R="3.7.0",_R="3.7.0",RR="3.7.0",DR="3.7.0",FR=1e-7,MR=1e-4,OR=class{constructor(e,t){this.backend=e,this.dataMover=t,this.data=new WeakMap,this.dataIdsCount=0}get(e){return this.data.has(e)||this.dataMover.moveData(this.backend,e),this.data.get(e)}set(e,t){this.dataIdsCount++,this.data.set(e,t)}has(e){return this.data.has(e)}delete(e){return this.dataIdsCount--,this.data.delete(e)}numDataIds(){return this.dataIdsCount}},L3=class{refCount(e){return Ur("refCount")}incRef(e){return Ur("incRef")}timerAvailable(){return!0}time(e){return Ur("time")}read(e){return Ur("read")}readSync(e){return Ur("readSync")}numDataIds(){return Ur("numDataIds")}disposeData(e,t){return Ur("disposeData")}write(e,t,n){return Ur("write")}move(e,t,n,r,s){return Ur("move")}memory(){return Ur("memory")}floatPrecision(){return Ur("floatPrecision")}epsilon(){return this.floatPrecision()===32?FR:MR}dispose(){return Ur("dispose")}};function Ur(e){throw new Error(`'${e}' not yet implemented or not found in the registry. This kernel may not be supported by the tfjs backend you have chosen`)}function B3(e){let t=e.length,n=0,r=0;for(;t>0;)r=Math.random()*t|0,t--,n=e[t],e[t]=e[r],e[r]=n}function PR(e,t){if(e.length!==t.length)throw new Error(`Array sizes must match to be shuffled together First array length was ${e.length}Second array length was ${t.length}`);let n=e.length,r,s,a=0;for(;n>0;)a=Math.random()*n|0,n--,r=e[n],s=t[n],e[n]=e[a],t[n]=t[a],e[a]=r,t[a]=s}function qu(e,t,n){return Math.max(e,Math.min(t,n))}function zR(e){return e%2==0?e:e+1}function LR(e){let t=0;for(let n=0;nn+` Shapes ${e} and ${t} must match`)}function ho(e){L(e!=null,()=>"The input to the tensor constructor must be a non-null value.")}function po(e,t=[],n=!1){if(t==null&&(t=[]),Array.isArray(e)||Cn(e)&&!n)for(let r=0;r0,n){return new Promise((r,s)=>{let a=0,o=()=>{if(e()){r();return}a++;let i=t(a);if(n!=null&&a>=n){s();return}setTimeout(o,i)};o()})}function qR(e,t){let n=1,r=-1;for(let a=0;a=0)n*=e[a];else if(e[a]===-1){if(r!==-1)throw Error(`Shapes can only have 1 implicit size. Found -1 at dim ${r} and dim ${a}`);r=a}else if(e[a]<0)throw Error(`Shapes can not be < 0. Found ${e[a]} at dim ${a}`);if(r===-1){if(t>0&&t!==n)throw Error(`Size(${t}) must match the product of shape ${e}`);return e}if(n===0)throw Error(`Cannot infer the missing size in [${e}] when there are 0 elements`);if(t%n!=0)throw Error(`The implicit shape can't be a fractional number. Got ${t} / ${n}`);let s=e.slice();return s[r]=t/n,s}function Xu(e,t){let n=t.length;return e=e==null?t.map((r,s)=>s):[].concat(e),L(e.every(r=>r>=-n&&r`All values in axis param must be in range [-${n}, ${n}) but got axis ${e}`),L(e.every(r=>Xn(r)),()=>`All values in axis param must be integers but got axis ${e}`),e.map(r=>r<0?n+r:r)}function W3(e,t){let n=[],r=[],s=t!=null&&Array.isArray(t)&&t.length===0,a=t==null||s?null:Xu(t,e).sort(),o=0;for(let i=0;ii)&&e[i]===1&&(n.push(e[i]),r.push(i)),a[o]<=i&&o++}e[i]!==1&&(n.push(e[i]),r.push(i))}return{newShape:n,keptDims:r}}function V3(e,t){let n=null;if(e==null||e==="float32")n=new Float32Array(t);else if(e==="int32")n=new Int32Array(t);else if(e==="bool")n=new Uint8Array(t);else throw new Error(`Unknown data type ${e}`);return n}function U3(e,t){let n=null;if(e==null||e==="float32")n=new Float32Array(t);else if(e==="int32")n=new Int32Array(t);else if(e==="bool")n=new Uint8Array(t);else if(e==="string")n=new Array(t);else throw new Error(`Unknown data type ${e}`);return n}function H3(e,t){for(let n=0;nt+=n.length),t}function Ia(e){return typeof e=="string"||e instanceof String}function q3(e){return typeof e=="boolean"}function K3(e){return typeof e=="number"}function ep(e){return Array.isArray(e)?ep(e[0]):e instanceof Float32Array?"float32":e instanceof Int32Array||e instanceof Uint8Array?"int32":K3(e)?"float32":Ia(e)?"string":q3(e)?"bool":"float32"}function Sa(e){return!!(e&&e.constructor&&e.call&&e.apply)}function tp(e,t){for(let n=t;n=0;--r)n[r]=n[r+1]*e[r+1];return n}function X3(e,t,n,r=!1){let s=new Array;if(t.length===1){let a=t[0]*(r?2:1);for(let o=0;ol*u)*(r?2:1);for(let l=0;ls*a)*(n?2:1);if(r===0)return[];if(r!==t.length)throw new Error(`[${e}] does not match the input size ${t.length}${n?" for a complex tensor":""}.`);return X3(0,e,t,n)}function n2(e,t){let n=np(e,t);for(let r=0;rr*s,1);if(t==null||t==="float32")return Pi(e,new Float32Array(n));if(t==="int32")return Pi(e,new Int32Array(n));if(t==="bool")return Pi(e,new Uint8Array(n));throw new Error(`Unknown data type ${t}`)}function r2(e){e.forEach(t=>{L(Number.isInteger(t)&&t>=0,()=>`Tensor must have a shape comprised of positive integers but got shape [${e}].`)})}function ZR(e,t,n){if(t===0)return 0;if(t===1)return e[0];let r=e[e.length-1];for(let s=0;s{let[r,s]=n.split(":");this.urlFlags[r]=eD(r,s)})}};function JR(e){let t={};return e.replace(/[?&]([^=?&]+)(?:=([^&]*))?/g,(n,...r)=>(QR(t,r[0],r[1]),r.join("="))),t}function QR(e,t,n){e[decodeURIComponent(t)]=decodeURIComponent(n||"")}function eD(e,t){if(t=t.toLowerCase(),t==="true"||t==="false")return t==="true";if(`${+t}`===t)return+t;throw new Error(`Could not parse value flag value ${t} for flag ${e}.`)}function ct(){return Sr}var Sr=null;function tD(e){Sr=e}var a2;function J3(){if(a2==null){let e;if(typeof window!="undefined")e=window;else if(typeof global!="undefined")e=global;else if(typeof process!="undefined")e=process;else if(typeof self!="undefined")e=self;else throw new Error("Could not find a global object");a2=e}return a2}function nD(){let e=J3();return e._tfGlobals==null&&(e._tfGlobals=new Map),e._tfGlobals}function o2(e,t){let n=nD();if(n.has(e))return n.get(e);{let r=t();return n.set(e,r),n.get(e)}}var Q3="Abs",ev="Acos",tv="Acosh",i2="Add",nv="AddN",rv="All",sv="Any",av="ArgMax",ov="ArgMin",iv="Asin",lv="Asinh",uv="Atan",cv="Atanh",dv="Atan2",hv="AvgPool",rD="AvgPoolGrad",pv="AvgPool3D",sD="AvgPool3DGrad",fv="BatchMatMul",mv="BatchToSpaceND",gv="Bincount",aD="BroadcastTo",l2="Cast",yv="Ceil",Av="ClipByValue",xv="Complex",bv="ComplexAbs",vv="Concat",wv="Conv2D",kv="Conv2DBackpropFilter",Iv="Conv2DBackpropInput",Sv="Conv3D",oD="Conv3DBackpropFilterV2",Tv="Conv3DBackpropInputV2",Nv="Cos",Cv="Cosh",Ev="Cumsum",$v="CropAndResize",_v="DenseBincount",Rv="DepthToSpace",Dv="DepthwiseConv2dNative",Fv="DepthwiseConv2dNativeBackpropFilter",Mv="DepthwiseConv2dNativeBackpropInput",Ov="Diag",Pv="Dilation2D",iD="Dilation2DBackpropInput",lD="Dilation2DBackpropFilter",zv="RealDiv",Lv="Einsum",Bv="Elu",uD="EluGrad",Wv="Erf",Vv="Equal",Uv="Exp",Hv="ExpandDims",Gv="Expm1",jv="FFT",qv="Fill",Kv="FlipLeftRight",Xv="Floor",Zv="FloorDiv",Yv="FusedBatchNorm",Jv="GatherV2",Qv="GatherNd",ew="Greater",tw="GreaterEqual",u2="Identity",nw="IFFT",rw="Imag",sw="IsFinite",aw="IsInf",ow="IsNan",iw="LeakyRelu",lw="Less",uw="LessEqual",cw="LinSpace",dw="Log",hw="Log1p",pw="LogicalAnd",fw="LogicalNot",mw="LogicalOr",cD="LogSoftmax",gw="LRN",dD="LRNGrad",yw="Max",Aw="Maximum",xw="MaxPool",hD="MaxPoolGrad",bw="MaxPool3D",pD="MaxPool3DGrad",vw="MaxPoolWithArgmax",ww="Mean",kw="Min",Iw="Minimum",Sw="MirrorPad",Tw="Mod",Nw="Multinomial",Cw="Multiply",Ew="Neg",$w="NotEqual",_w="NonMaxSuppressionV3",Rw="NonMaxSuppressionV4",Dw="NonMaxSuppressionV5",Fw="OnesLike",Mw="OneHot",Ow="Pack",Pw="PadV2",fD="Pool",zw="Pow",Lw="Prelu",Bw="Prod",Ww="Range",Vw="Real",Uw="Reciprocal",Hw="Relu",Gw="Reshape",jw="ResizeNearestNeighbor",mD="ResizeNearestNeighborGrad",qw="ResizeBilinear",gD="ResizeBilinearGrad",Kw="Relu6",Xw="Reverse",Zw="Round",Yw="Rsqrt",Jw="ScatterNd",Qw="Select",e7="Selu",t7="Slice",n7="Sin",r7="Sinh",s7="Sign",a7="Sigmoid",o7="Softplus",i7="Sqrt",l7="Sum",u7="SpaceToBatchND",c7="SplitV",d7="Softmax",h7="SparseFillEmptyRows",p7="SparseReshape",f7="SparseSegmentMean",m7="SparseSegmentSum",g7="SparseToDense",y7="SquaredDifference",yD="Square",A7="StridedSlice",x7="StringNGrams",b7="StringSplit",v7="StringToHashBucketFast",w7="Sub",k7="Tan",I7="Tanh",c2="Tile",S7="TopK",T7="Transform",N7="Transpose",C7="Unique",E7="Unpack",$7="UnsortedSegmentSum",_7="ZerosLike",R7="Step",d2="FromPixels",D7="RotateWithOffset",h2="_FusedMatMul",p2="FusedConv2D",f2="FusedDepthwiseConv2D",zi=o2("kernelRegistry",()=>new Map),Zu=o2("gradRegistry",()=>new Map);function rp(e,t){let n=g2(e,t);return zi.get(n)}function m2(e){return Zu.get(e)}function Li(e){let t=zi.entries(),n=[];for(;;){let{done:r,value:s}=t.next();if(r)break;let[a,o]=s,[i]=a.split("_");i===e&&n.push(o)}return n}function sp(e){let{kernelName:t,backendName:n}=e,r=g2(t,n);zi.has(r)&&console.warn(`The kernel '${t}' for backend '${n}' is already registered`),zi.set(r,e)}function AD(e){let{kernelName:t}=e;Zu.has(t)&&ct().getBool("DEBUG")&&console.warn(`Overriding the gradient for '${t}'`),Zu.set(t,e)}function xD(e,t){let n=g2(e,t);if(!zi.has(n))throw new Error(`The kernel '${e}' for backend '${t}' is not registered`);zi.delete(n)}function bD(e){if(!Zu.has(e))throw new Error(`The gradient '${e}' for backend is not registered`);Zu.delete(e)}function vD(e,t){Li(e).forEach(r=>{let s=Object.assign({},r,{backendName:t});sp(s)})}function g2(e,t){return`${t}_${e}`}var F7={};De(F7,{arraysEqual:()=>Xs,assert:()=>L,assertNonNegativeIntegerDimensions:()=>r2,assertNonNull:()=>ho,assertShapesMatch:()=>Mn,bytesFromStringArray:()=>j3,bytesPerElement:()=>t2,checkConversionForErrors:()=>H3,clamp:()=>qu,computeStrides:()=>Oi,createScalarValue:()=>ND,createShuffledIndices:()=>GR,decodeString:()=>ip,distSquared:()=>WR,encodeString:()=>Qu,fetch:()=>ED,fingerPrint64:()=>TD,flatten:()=>po,getArrayFromDType:()=>U3,getTypedArrayFromDType:()=>V3,hasEncodingLoss:()=>KR,hexToLong:()=>Yu,indexToLoc:()=>YR,inferDtype:()=>ep,inferFromImplicitShape:()=>qR,isBoolean:()=>q3,isFunction:()=>Sa,isInt:()=>Xn,isNumber:()=>K3,isPromise:()=>s2,isScalarShape:()=>VR,isString:()=>Ia,isTypedArray:()=>Cn,isValidDtype:()=>G3,locToIndex:()=>ZR,makeOnesTypedArray:()=>n2,makeZerosNestedTypedArray:()=>XR,makeZerosTypedArray:()=>np,nearestDivisor:()=>tp,nearestLargerEven:()=>zR,now:()=>Ju,parseAxisParam:()=>Xu,randUniform:()=>BR,repeatedTry:()=>jR,rightPad:()=>Ku,shuffle:()=>B3,shuffleCombo:()=>PR,sizeFromShape:()=>Jt,sizeToSquarishShape:()=>HR,squeezeShape:()=>W3,sum:()=>LR,tanh:()=>UR,toNestedArray:()=>Pi,toTypedArray:()=>op});var M7=Ks(M3()),fo=M7.default||M7;function Yu(e){return fo.fromString(e,!0,16)}var O7=Yu("c3a5c85c97cb3127"),mo=Yu("b492b66fbe98f273"),On=Yu("9ae16a3b2f90404f");function y2(e){return e.xor(e.shru(47))}function P7(e,t,n){let r=e.slice(t,t+n);return fo.fromBytes(Array.from(r),!0,!0)}function St(e,t){return P7(e,t,8)}function z7(e,t){return P7(e,t,4)}function fn(e,t){return t===0?e:e.shru(t).or(e.shl(64-t))}function Ta(e,t,n=Yu("9ddfea08eb382d69")){let r=e.xor(t).mul(n);r=r.xor(r.shru(47));let s=t.xor(r).mul(n);return s=s.xor(s.shru(47)),s=s.mul(n),s}function wD(e,t,n,r,s,a){s=s.add(e),a=fn(a.add(s).add(r),21);let o=s;return s=s.add(t),s=s.add(n),a=a.add(fn(s,44)),[s.add(r),a.add(o)]}function ap(e,t,n,r){return wD(St(e,t),St(e,t+8),St(e,t+16),St(e,t+24),n,r)}function kD(e,t=e.length){if(t>=8){let n=On.add(t*2),r=St(e,0).add(On),s=St(e,t-8),a=fn(s,37).mul(n).add(r),o=fn(r,25).add(s).mul(n);return Ta(a,o,n)}if(t>=4){let n=On.add(t*2),r=z7(e,0);return Ta(r.shl(3).add(t),z7(e,t-4),n)}if(t>0){let n=e[0],r=e[t>>1],s=e[t-1],a=n+(r<<8),o=t+(s<<2);return y2(On.mul(a).xor(O7.mul(o))).mul(On)}return On}function ID(e,t=e.length){let n=On.add(t*2),r=St(e,0).mul(mo),s=St(e,8),a=St(e,t-8).mul(n),o=St(e,t-16).mul(On);return Ta(fn(r.add(s),43).add(fn(a,30)).add(o),r.add(fn(s.add(On),18)).add(a),n)}function SD(e,t=e.length){let n=On.add(t*2),r=St(e,0).mul(On),s=St(e,8),a=St(e,t-8).mul(n),o=St(e,t-16).mul(On),i=fn(r.add(s),43).add(fn(a,30)).add(o),l=Ta(i,r.add(fn(s.add(On),18)).add(a),n),u=St(e,16).mul(n),c=St(e,24),d=i.add(St(e,t-32)).mul(n),h=l.add(St(e,t-24)).mul(n);return Ta(fn(u.add(c),43).add(fn(d,30)).add(h),u.add(fn(c.add(r),18)).add(d),n)}function TD(e,t=e.length){let n=fo.fromNumber(81,!0);if(t<=32)return t<=16?kD(e,t):ID(e,t);if(t<=64)return SD(e,t);let r=n,s=n.mul(mo).add(113),a=y2(s.mul(On).add(113)).mul(On),o=[fo.UZERO,fo.UZERO],i=[fo.UZERO,fo.UZERO];r=r.mul(On).add(St(e,0));let l=0,u=(t-1>>6)*64,c=u+(t-1&63)-63;do r=fn(r.add(s).add(o[0]).add(St(e,l+8)),37).mul(mo),s=fn(s.add(o[1]).add(St(e,l+48)),42).mul(mo),r=r.xor(i[1]),s=s.add(o[0]).add(St(e,l+40)),a=fn(a.add(i[0]),33).mul(mo),o=ap(e,l,o[1].mul(mo),r.add(i[0])),i=ap(e,l+32,a.add(i[1]),s.add(St(e,l+16))),[a,r]=[r,a],l+=64;while(l!==u);let d=mo.add(a.and(255).shl(1));return l=c,i[0]=i[0].add(t-1&63),o[0]=o[0].add(i[0]),i[0]=i[0].add(o[0]),r=fn(r.add(s).add(o[0]).add(St(e,l+8)),37).mul(d),s=fn(s.add(o[1]).add(St(e,l+48)),42).mul(d),r=r.xor(i[1].mul(9)),s=s.add(o[0].mul(9).add(St(e,l+40))),a=fn(a.add(i[0]),33).mul(d),o=ap(e,l,o[1].mul(d),r.add(i[0])),i=ap(e,l+32,a.add(i[1]),s.add(St(e,l+16))),[a,r]=[r,a],Ta(Ta(o[0],i[0],d).add(y2(s).mul(O7)).add(a),Ta(o[1],i[1],d).add(r),d)}function ND(e,t){return t==="string"?Qu(e):op([e],t)}function CD(e,t){return e instanceof Float32Array&&t==="float32"||e instanceof Int32Array&&t==="int32"||e instanceof Uint8Array&&t==="bool"}function op(e,t){if(t==="string")throw new Error("Cannot convert a string[] to a TypedArray");if(Array.isArray(e)&&(e=po(e)),ct().getBool("DEBUG")&&H3(e,t),CD(e,t))return e;if(t==null||t==="float32"||t==="complex64")return new Float32Array(e);if(t==="int32")return new Int32Array(e);if(t==="bool"){let n=new Uint8Array(e.length);for(let r=0;r{r=n()},a,o=Ju();if(this.backendTimer.timerAvailable())a=this.backendTimer.time(s);else{s();for(let l of r)l.dataSync();a=Promise.resolve({kernelMs:Ju()-o})}if(ct().getBool("CHECK_COMPUTATION_FOR_ERRORS"))for(let l=0;l{_D(c,u.dtype,e)})}return{kernelName:e,outputs:r,inputs:t,timeMs:a.then(l=>l.kernelMs),extraInfo:a.then(l=>l.getExtraProfileInfo!=null?l.getExtraProfileInfo():"")}}logKernelProfile(e){let{kernelName:t,outputs:n,timeMs:r,inputs:s,extraInfo:a}=e;n.forEach(o=>{Promise.all([o.data(),r,a]).then(i=>{this.logger.logKernelProfile(t,o,i[0],i[1],s,i[2])})})}};function _D(e,t,n){if(t!=="float32")return!1;for(let r=0;r0?f:""} `}}console.log(`%c${i} %c${o} %c${l}D ${c} %c${u} %c${d} %c${a}`,"font-weight:bold","color:red","color:blue","color: orange","color: green","color: steelblue")}};function DD(e,t,n){let r={},s={};for(let l=0;lr[m.id]=!0),p=!0,s[u.id]=!0;break}if(p)break}}let a={};a[n.id]=!0;let o={};for(let l=e.length-1;l>=0;l--){let u=e[l],c=u.inputs;for(let d=0;d=0;s--){let a=t[s],o=[];if(a.outputs.forEach(l=>{let u=e[l.id];u!=null?o.push(u):o.push(null)}),a.gradient==null)throw new Error(`Cannot compute gradient: gradient function not found for ${a.kernelName}.`);let i=a.gradient(o);for(let l in a.inputs){if(!(l in i))throw new Error(`Cannot backprop through input ${l}. Available gradients found: ${Object.keys(i)}.`);let u=n(()=>i[l]());if(u.dtype!=="float32")throw new Error(`Error in gradient for op ${a.kernelName}. The gradient of input ${l} must have 'float32' dtype, but has '${u.dtype}'`);let c=a.inputs[l];if(!Xs(u.shape,c.shape))throw new Error(`Error in gradient for op ${a.kernelName}. The gradient of input '${l}' has shape '${u.shape}', which does not match the shape of the input '${c.shape}'`);if(e[c.id]==null)e[c.id]=u;else{let d=e[c.id];e[c.id]=r(d,u),d.dispose()}}}}var L7=20,ec=3,A2=7;function MD(e,t,n,r){let s=Oi(t),a=OD(e,t,n,s),o=t.length,i=lp(e,t,n,s,a),l=["Tensor"];return r&&(l.push(` dtype: ${n}`),l.push(` rank: ${o}`),l.push(` shape: [${t}]`),l.push(" values:")),l.push(i.map(u=>" "+u).join(` `)),l.join(` -`)}function _F(e,t,n,a){let r=Jt(t),s=a[a.length-1],i=new Array(s).fill(0),o=t.length,l=n==="complex64"?nd(e):e;if(o>1)for(let u=0;uL7){let g=ed*i,y=Array.from(e.slice(0,g)),A=Array.from(e.slice((o-ed)*i,o*i));return n==="complex64"&&(y=nd(y),A=nd(A)),["["+y.map((x,v)=>td(x,r[v],n)).join(", ")+", ..., "+A.map((x,v)=>td(x,r[o-ed+v],n)).join(", ")+"]"]}let f=n==="complex64"?nd(e):Array.from(e);return["["+f.map((g,y)=>td(g,r[y],n)).join(", ")+"]"]}let u=t.slice(1),d=a.slice(1),h=a[0]*i,p=[];if(o>L7){for(let f=0;f`Length of values '${a}' does not match the size inferred by the shape '${this.size}'.`)}if(t==="complex64")throw new Error("complex64 dtype TensorBuffers are not supported. Please create a TensorBuffer for the real and imaginary parts separately and call tf.complex(real, imag).");this.values=n||U3(t,this.size),this.strides=_o(e)}set(e,...t){t.length===0&&(t=[0]),L(t.length===this.rank,()=>`The number of provided coordinates (${t.length}) must match the rank (${this.rank})`);let n=this.locToIndex(t);this.values[n]=e}get(...e){e.length===0&&(e=[0]);let t=0;for(let a of e){if(a<0||a>=this.shape[t]){let r=`Requested out of range element at ${e}. Buffer shape=${this.shape}`;throw new Error(r)}t++}let n=e[e.length-1];for(let a=0;aoc(n))}catch(n){throw new Error("Failed to decode the string bytes into utf-8. To get the original bytes, call tensor.bytes().")}}return e}dataSync(){this.throwIfDisposed();let e=kr().readSync(this.dataId);if(this.dtype==="string")try{return e.map(t=>oc(t))}catch(t){throw new Error("Failed to decode the string bytes into utf-8. To get the original bytes, call tensor.bytes().")}return e}async bytes(){this.throwIfDisposed();let e=await kr().read(this.dataId);return this.dtype==="string"?e:new Uint8Array(e.buffer)}dispose(){this.isDisposed||(kr().disposeTensor(this),this.isDisposedInternal=!0)}get isDisposed(){return this.isDisposedInternal}throwIfDisposed(){if(this.isDisposed)throw new Error("Tensor is disposed.")}print(e=!1){return Wo.print(this,e)}clone(){return this.throwIfDisposed(),Wo.clone(this)}toString(e=!1){let t=this.dataSync();return DF(t,this.shape,this.dtype,e)}cast(e){return this.throwIfDisposed(),Wo.cast(this,e)}variable(e=!0,t,n){return this.throwIfDisposed(),kr().makeVariable(this,e,t,n)}};Object.defineProperty(St,Symbol.hasInstance,{value:e=>!!e&&e.data!=null&&e.dataSync!=null&&e.throwIfDisposed!=null});function BF(){return sy("Tensor",()=>St)}BF();var ad=class extends St{constructor(e,t,n,a){super(e.shape,e.dtype,e.dataId,a);this.trainable=t,this.name=n}assign(e){if(e.dtype!==this.dtype)throw new Error(`dtype of the new value (${e.dtype}) and previous value (${this.dtype}) must match`);if(!Kr(e.shape,this.shape))throw new Error(`shape of the new value (${e.shape}) and previous value (${this.shape}) must match`);kr().disposeTensor(this),this.dataId=e.dataId,kr().incRef(this,null)}dispose(){kr().disposeVariable(this),this.isDisposedInternal=!0}};Object.defineProperty(ad,Symbol.hasInstance,{value:e=>e instanceof St&&e.assign!=null&&e.assign instanceof Function});var B7={};$e(B7,{assertTypesMatch:()=>V7,getTensorsInContainer:()=>ky,isTensorInList:()=>jF,makeTypesMatch:()=>Vt});var Ay;(function(e){e.R0="R0",e.R1="R1",e.R2="R2",e.R3="R3",e.R4="R4",e.R5="R5",e.R6="R6"})(Ay||(Ay={}));var xy;(function(e){e.float32="float32",e.int32="int32",e.bool="int32",e.complex64="complex64"})(xy||(xy={}));var by;(function(e){e.float32="float32",e.int32="int32",e.bool="bool",e.complex64="complex64"})(by||(by={}));var vy;(function(e){e.float32="float32",e.int32="float32",e.bool="float32",e.complex64="complex64"})(vy||(vy={}));var wy;(function(e){e.float32="complex64",e.int32="complex64",e.bool="complex64",e.complex64="complex64"})(wy||(wy={}));var VF={float32:vy,int32:xy,bool:by,complex64:wy};function dc(e,t){if(e==="string"||t==="string"){if(e==="string"&&t==="string")return"string";throw new Error(`Can not upcast ${e} with ${t}`)}return VF[e][t]}function UF(e){return dc(e,"int32")}function Vt(e,t){if(e.dtype===t.dtype)return[e,t];let n=dc(e.dtype,t.dtype);return[e.cast(n),t.cast(n)]}function V7(e,t){L(e.dtype===t.dtype,()=>`The dtypes of the first(${e.dtype}) and second(${t.dtype}) input must match`)}function jF(e,t){return t.some(n=>n.id===e.id)}function ky(e){let t=[],n=new Set;return U7(e,t,n),t}function U7(e,t,n){if(e==null)return;if(e instanceof St){t.push(e);return}if(!HF(e))return;let a=e;for(let r in a){let s=a[r];n.has(s)||(n.add(s),U7(s,t,n))}}function HF(e){return Array.isArray(e)||typeof e=="object"}function Iy(e){return e.kernelName!=null}var j7=class{constructor(){this.registeredVariables={},this.nextTapeNodeId=0,this.numBytes=0,this.numTensors=0,this.numStringTensors=0,this.numDataBuffers=0,this.gradientDepth=0,this.kernelDepth=0,this.scopeStack=[],this.numDataMovesStack=[],this.nextScopeId=0,this.tensorInfo=new WeakMap,this.profiling=!1,this.activeProfile={newBytes:0,newTensors:0,peakBytes:0,kernels:[],result:null,get kernelNames(){return Array.from(new Set(this.kernels.map(e=>e.name)))}}}dispose(){for(let e in this.registeredVariables)this.registeredVariables[e].dispose()}},Sy=class{constructor(e){this.ENV=e,this.registry={},this.registryFactory={},this.pendingBackendInitId=0,this.state=new j7}async ready(){if(this.pendingBackendInit!=null)return this.pendingBackendInit.then(()=>{});if(this.backendInstance!=null)return;let e=this.getSortedBackends();for(let t=0;t{e.setupFunc!=null&&e.setupFunc(this.backendInstance)})}disposeRegisteredKernels(e){Lo(e).forEach(t=>{t.disposeFunc!=null&&t.disposeFunc(this.registry[e])})}initializeBackend(e){let t=this.registryFactory[e];if(t==null)throw new Error(`Cannot initialize backend ${e}, no registration found.`);try{let n=t.factory();if(n&&!(n instanceof L3)&&typeof n.then=="function"){let a=++this.pendingBackendInitId,r=n.then(s=>a(athis.registryFactory[t].priority-this.registryFactory[e].priority)}initializeBackendsAndReturnBest(){let e=this.getSortedBackends();for(let t=0;tthis.startScope(n),()=>this.endScope(a),()=>(a=t(),a instanceof Promise&&console.error("Cannot return a Promise inside of tidy."),a))}scopedRun(e,t,n){e();try{let a=n();return t(),a}catch(a){throw t(),a}}nextTensorId(){return Sy.nextTensorId++}nextVariableId(){return Sy.nextVariableId++}clone(e){let t=V.runKernel(ly,{x:e}),n={x:e},a=s=>({x:()=>{let i="float32",o={x:s},l={dtype:i};return V.runKernel(oy,o,l)}}),r=[];return this.addTapeNode(this.state.activeScope.name,n,[t],a,r,{}),t}runKernel(e,t,n){if(ac(e,this.backendName)==null)throw new Error(`Kernel '${e}' not registered for backend '${this.backendName}'`);return this.runKernelFunc({kernelName:e,inputs:t,attrs:n})}shouldCheckForMemLeaks(){return this.ENV.getBool("IS_TEST")}checkKernelForMemLeak(e,t,n){let a=this.backend.numDataIds(),r=0;n.forEach(o=>{r+=o.dtype==="complex64"?3:1});let s=this.state.numDataMovesStack[this.state.numDataMovesStack.length-1],i=a-t-r-s;if(i>0)throw new Error(`Backend '${this.backendName}' has an internal memory leak (${i} data ids) after running '${e}'`)}runKernelFunc(e){let t,n=[],a=this.isTapeOn(),r=this.state.numBytes,s=this.state.numTensors;this.shouldCheckForMemLeaks()&&this.state.numDataMovesStack.push(0);let i;this.backendName==null&&this.backend;let o,l=Iy(e)?e.kernelName:this.state.activeScope!=null?this.state.activeScope.name:"";if(Iy(e)){let{kernelName:c,inputs:m,attrs:f}=e;this.backendName==null&&this.backend;let g=ac(c,this.backendName);L(g!=null,()=>`Cannot find registered kernel '${c}' for backend '${this.backendName}'`),i=()=>{let y=this.backend.numDataIds();o=g.kernelFunc({inputs:m,attrs:f,backend:this.backend});let A=Array.isArray(o)?o:[o];this.shouldCheckForMemLeaks()&&this.checkKernelForMemLeak(c,y,A);let x=A.map(v=>{if(v.rank!=null)return v;let{dataId:b,shape:w,dtype:I}=v;return this.makeTensorFromDataId(b,w,I)});if(a){let v=this.getTensorsForGradient(c,m,x);n=this.saveTensorsForBackwardMode(v)}return x}}else{let{forwardFunc:c}=e,m=f=>{!a||(n=f.map(g=>this.keep(this.clone(g))))};i=()=>{let f=this.backend.numDataIds();o=this.tidy(()=>c(this.backend,m));let g=Array.isArray(o)?o:[o];return this.shouldCheckForMemLeaks()&&this.checkKernelForMemLeak(l,f,g),g}}let{inputs:u,attrs:d}=e,h=Iy(e)?null:e.backwardsFunc,p;return this.scopedRun(()=>this.state.kernelDepth++,()=>this.state.kernelDepth--,()=>{!this.ENV.getBool("DEBUG")&&!this.state.profiling?t=i():(p=this.profiler.profileKernel(l,u,()=>i()),this.ENV.getBool("DEBUG")&&this.profiler.logKernelProfile(p),t=p.outputs)}),a&&this.addTapeNode(l,u,t,h,n,d),this.state.profiling&&this.state.activeProfile.kernels.push({name:l,bytesAdded:this.state.numBytes-r,totalBytesSnapshot:this.state.numBytes,tensorsAdded:this.state.numTensors-s,totalTensorsSnapshot:this.state.numTensors,inputShapes:Object.keys(u).map(c=>u[c]!=null?u[c].shape:null),outputShapes:t.map(c=>c.shape),kernelTimeMs:p.timeMs,extraInfo:p.extraInfo}),Array.isArray(o)?t:t[0]}saveTensorsForBackwardMode(e){return e.map(t=>this.keep(this.clone(t)))}getTensorsForGradient(e,t,n){let a=fy(e);if(a!=null){let r=a.inputsToSave||[],s=a.outputsToSave||[],i;a.saveAllInputs?(L(Array.isArray(t),()=>"saveAllInputs is true, expected inputs to be an array."),i=Object.keys(t).map(l=>t[l])):i=r.map(l=>t[l]);let o=n.filter((l,u)=>s[u]);return i.concat(o)}return[]}makeTensor(e,t,n,a){if(e==null)throw new Error("Values passed to engine.makeTensor() are null");n=n||"float32",a=a||this.backend;let r=e;n==="string"&&Is(e[0])&&(r=e.map(o=>Qu(o)));let s=a.write(r,t,n),i=new St(t,n,s,this.nextTensorId());if(this.trackTensor(i,a),n==="string"){let o=this.state.tensorInfo.get(s),l=G3(r);this.state.numBytes+=l-o.bytes,o.bytes=l}return i}makeTensorFromDataId(e,t,n,a){n=n||"float32";let r=new St(t,n,e,this.nextTensorId());return this.trackTensor(r,a),r}makeVariable(e,t=!0,n,a){n=n||this.nextVariableId().toString(),a!=null&&a!==e.dtype&&(e=e.cast(a));let r=new ad(e,t,n,this.nextTensorId());if(this.state.registeredVariables[r.name]!=null)throw new Error(`Variable with name ${r.name} was already registered`);return this.state.registeredVariables[r.name]=r,this.incRef(r,this.backend),r}trackTensor(e,t){this.state.numTensors++,e.dtype==="string"&&this.state.numStringTensors++;let n=0;e.dtype!=="complex64"&&e.dtype!=="string"&&(n=e.size*ey(e.dtype)),this.state.numBytes+=n,this.state.tensorInfo.has(e.dataId)||(this.state.numDataBuffers++,this.state.tensorInfo.set(e.dataId,{backend:t||this.backend,dtype:e.dtype,shape:e.shape,bytes:n})),e instanceof ad||this.track(e)}incRef(e,t){this.trackTensor(e,t),this.backend.incRef(e.dataId)}removeDataId(e,t){this.state.tensorInfo.has(e)&&this.state.tensorInfo.get(e).backend===t&&(this.state.tensorInfo.delete(e),this.state.numDataBuffers--)}disposeTensor(e){if(!this.state.tensorInfo.has(e.dataId))return;let t=this.state.tensorInfo.get(e.dataId);if(this.state.numTensors--,e.dtype==="string"&&(this.state.numStringTensors--,this.state.numBytes-=t.bytes),e.dtype!=="complex64"&&e.dtype!=="string"){let n=e.size*ey(e.dtype);this.state.numBytes-=n}t.backend.disposeData(e.dataId)&&this.removeDataId(e.dataId,t.backend)}disposeVariables(){for(let e in this.state.registeredVariables){let t=this.state.registeredVariables[e];this.disposeVariable(t)}}disposeVariable(e){this.disposeTensor(e),this.state.registeredVariables[e.name]!=null&&delete this.state.registeredVariables[e.name]}memory(){let e=this.backend.memory();return e.numTensors=this.state.numTensors,e.numDataBuffers=this.state.numDataBuffers,e.numBytes=this.state.numBytes,this.state.numStringTensors>0&&(e.unreliable=!0,e.reasons==null&&(e.reasons=[]),e.reasons.push("Memory usage by string tensors is approximate (2 bytes per character)")),e}async profile(e){this.state.profiling=!0;let t=this.state.numBytes,n=this.state.numTensors;this.state.activeProfile.kernels=[],this.state.activeProfile.result=await e(),this.state.profiling=!1,this.state.activeProfile.peakBytes=Math.max(...this.state.activeProfile.kernels.map(a=>a.totalBytesSnapshot)),this.state.activeProfile.newBytes=this.state.numBytes-t,this.state.activeProfile.newTensors=this.state.numTensors-n;for(let a of this.state.activeProfile.kernels)a.kernelTimeMs=await a.kernelTimeMs,a.extraInfo=await a.extraInfo;return this.state.activeProfile}isTapeOn(){return this.state.gradientDepth>0&&this.state.kernelDepth===0}addTapeNode(e,t,n,a,r,s){let i={id:this.state.nextTapeNodeId++,kernelName:e,inputs:t,outputs:n,saved:r},o=fy(e);o!=null&&(a=o.gradFunc),a!=null&&(i.gradient=l=>(l=l.map((u,d)=>{if(u==null){let h=n[d],p=nc(h.size,h.dtype);return this.makeTensor(p,h.shape,h.dtype)}return u}),a(l.length>1?l:l[0],r,s))),this.state.activeTape.push(i)}keep(e){return e.kept=!0,e}startTape(){this.state.gradientDepth===0&&(this.state.activeTape=[]),this.state.gradientDepth++}endTape(){this.state.gradientDepth--}startScope(e){let t={track:[],name:"unnamed scope",id:this.state.nextScopeId++};e&&(t.name=e),this.state.scopeStack.push(t),this.state.activeScope=t}endScope(e){let t=ky(e),n=new Set(t.map(r=>r.id));for(let r=0;r{!r.kept&&r.scopeId===a.id&&this.track(r)})}gradients(e,t,n,a=!1){if(L(t.length>0,()=>"gradients() received an empty list of xs."),n!=null&&n.dtype!=="float32")throw new Error(`dy must have 'float32' dtype, but has '${n.dtype}'`);let r=this.scopedRun(()=>this.startTape(),()=>this.endTape(),()=>this.tidy("forward",e));L(r instanceof St,()=>"The result y returned by f() must be a tensor.");let s=FF(this.state.activeTape,t,r);if(!a&&s.length===0&&t.length>0)throw new Error("Cannot compute gradient of y=f(x) with respect to x. Make sure that the f you passed encloses all operations that lead from x to y.");return this.tidy("backward",()=>{let i={};i[r.id]=n==null?GF(r.shape):n,OF(i,s,l=>this.tidy(l),qF);let o=t.map(l=>i[l.id]);return this.state.gradientDepth===0&&(this.state.activeTape.forEach(l=>{for(let u of l.saved)u.dispose()}),this.state.activeTape=null),{value:r,grads:o}})}customGrad(e){return L(Ss(e),()=>"The f passed in customGrad(f) must be a function."),(...t)=>{L(t.every(i=>i instanceof St),()=>"The args passed in customGrad(f)(x1, x2,...) must all be tensors");let n,a={};t.forEach((i,o)=>{a[o]=i});let r=(i,o)=>(n=e(...t,o),L(n.value instanceof St,()=>"The function f passed in customGrad(f) must return an object where `obj.value` is a tensor"),L(Ss(n.gradFunc),()=>"The function f passed in customGrad(f) must return an object where `obj.gradFunc` is a function."),n.value),s=(i,o)=>{let l=n.gradFunc(i,o),u=Array.isArray(l)?l:[l];L(u.length===t.length,()=>"The function f passed in customGrad(f) must return an object where `obj.gradFunc` is a function that returns the same number of tensors as inputs passed to f(...)."),L(u.every(h=>h instanceof St),()=>"The function f passed in customGrad(f) must return an object where `obj.gradFunc` is a function that returns a list of only tensors.");let d={};return u.forEach((h,p)=>{d[p]=()=>h}),d};return this.runKernelFunc({forwardFunc:r,backwardsFunc:s,inputs:a})}}readSync(e){return this.state.tensorInfo.get(e).backend.readSync(e)}read(e){return this.state.tensorInfo.get(e).backend.read(e)}async time(e){let t=Ju(),n=await this.backend.time(e);return n.wallMs=Ju()-t,n}track(e){return this.state.activeScope!=null&&(e.scopeId=this.state.activeScope.id,this.state.activeScope.track.push(e)),e}get registeredVariables(){return this.state.registeredVariables}reset(){this.pendingBackendInitId++,this.state.dispose(),this.ENV.reset(),this.state=new j7;for(let e in this.registry)this.disposeRegisteredKernels(e),this.registry[e].dispose(),delete this.registry[e];this.backendName=null,this.backendInstance=null,this.pendingBackendInit=null}},Ny=Sy;Ny.nextTensorId=0,Ny.nextVariableId=0;function GF(e){let t=ty(Jt(e),"float32");return V.makeTensor(t,e,"float32")}function H7(){let e=J3();if(e._tfengine==null){let t=new Y3(e);e._tfengine=new Ny(t)}return tF(e._tfengine.ENV),PF(()=>e._tfengine),e._tfengine}var V=H7();function qF(e,t){let n={a:e,b:t};return V.runKernel(iy,n)}var G7={};$e(G7,{isBrowser:()=>q7,isMobile:()=>XF});function KF(){return typeof navigator!="undefined"&&navigator!=null}function XF(e){if(e||KF()){if(e||(e=navigator),e.product==="ReactNative")return!0;let t=e.userAgent||e.vendor||window.opera;return/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(t)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(t.substr(0,4))}return!1}function q7(){return typeof window!="undefined"&&window.document!=null||typeof WorkerGlobalScope!="undefined"}var Qa=ht();Qa.registerFlag("DEBUG",()=>!1,e=>{e&&console.warn("Debugging mode is ON. The output of every math call will be downloaded to CPU and checked for NaNs. This significantly impacts performance.")});Qa.registerFlag("IS_BROWSER",()=>q7());Qa.registerFlag("IS_NODE",()=>typeof process!="undefined"&&typeof process.versions!="undefined"&&typeof process.versions.node!="undefined");Qa.registerFlag("IS_CHROME",()=>typeof navigator!="undefined"&&navigator!=null&&navigator.userAgent!=null&&/Chrome/.test(navigator.userAgent)&&/Google Inc/.test(navigator.vendor));Qa.registerFlag("PROD",()=>!1);Qa.registerFlag("TENSORLIKE_CHECK_SHAPE_CONSISTENCY",()=>Qa.getBool("DEBUG"));Qa.registerFlag("DEPRECATION_WARNINGS_ENABLED",()=>!0);Qa.registerFlag("IS_TEST",()=>!1);Qa.registerFlag("CHECK_COMPUTATION_FOR_ERRORS",()=>!0);Qa.registerFlag("WRAP_TO_IMAGEBITMAP",()=>!1);function Ir(e,t){let n=e;if(En(e))return t==="string"?[]:[e.length];if(!Array.isArray(e))return[];let a=[];for(;Array.isArray(n)||En(n)&&t!=="string";)a.push(n.length),n=n[0];return Array.isArray(e)&&ht().getBool("TENSORLIKE_CHECK_SHAPE_CONSISTENCY")&&K7(e,a,[]),a}function K7(e,t,n){if(n=n||[],!Array.isArray(e)&&!En(e)){L(t.length===0,()=>`Element arr[${n.join("][")}] is a primitive, but should be an array/TypedArray of ${t[0]} elements`);return}L(t.length>0,()=>`Element arr[${n.join("][")}] should be a primitive, but is an array of ${e.length} elements`),L(e.length===t[0],()=>`Element arr[${n.join("][")}] should have ${t[0]} elements, but has ${e.length} elements`);let a=t.slice(1);for(let r=0;r=0&&(r=a),X7(a,r,t,n),e==null||!En(e)&&!Array.isArray(e)&&typeof e!="number"&&typeof e!="boolean"&&typeof e!="string"){let o=e==null?"null":e.constructor.name;throw new Error(`Argument '${t}' passed to '${n}' must be a Tensor or TensorLike, but got '${o}'`)}let s=Ir(e,r);!En(e)&&!Array.isArray(e)&&(e=[e]);let i=r!=="string"?ic(e,r):pi(e,[],!0);return V.makeTensor(i,s,r)}function rd(e,t,n,a="numeric"){if(!Array.isArray(e))throw new Error(`Argument ${t} passed to ${n} must be a \`Tensor[]\` or \`TensorLike[]\``);return e.map((r,s)=>O(r,`${t}[${s}]`,n,a))}var Z7="__op";function U(e){let t=Object.keys(e);if(t.length!==1)throw new Error(`Please provide an object with a single key (operation name) mapping to a function. Got an object with ${t.length} keys.`);let n=t[0],a=e[n];n.endsWith("_")&&(n=n.substring(0,n.length-1)),n=n+Z7;let r=(...s)=>{V.startScope(n);try{let i=a(...s);return ay(i)&&console.error("Cannot return a Promise inside of tidy."),V.endScope(i),i}catch(i){throw V.endScope(null),i}};return Object.defineProperty(r,"name",{value:n,configurable:!0}),r}function ZF(e,t){let n=O(e,"real","complex"),a=O(t,"imag","complex");On(n.shape,a.shape,`real and imag shapes, ${n.shape} and ${a.shape}, must match in call to tf.complex().`);let r={real:n,imag:a};return V.runKernel(xv,r)}var mi=U({complex_:ZF});function Ts(e,t,n,a){if(a==null&&(a=ec(e)),a==="complex64")throw new Error("Cannot construct a complex64 tensor directly. Please use tf.complex(real, imag).");if(!En(e)&&!Array.isArray(e)&&typeof e!="number"&&typeof e!="boolean"&&typeof e!="string")throw new Error("values passed to tensor(values) must be a number/boolean/string or an array of numbers/booleans/strings, or a TypedArray");if(t!=null){ny(t);let r=Jt(t),s=Jt(n);L(r===s,()=>`Based on the provided shape, [${t}], the tensor should have ${r} values but has ${s}`);for(let i=0;i`Error creating a new Tensor. Inferred shape (${n}) does not match the provided shape (${t}). `)}}return!En(e)&&!Array.isArray(e)&&(e=[e]),t=t||n,e=a!=="string"?ic(e,a):pi(e,[],!0),V.makeTensor(e,t,a)}function er(e,t,n){let a=Ir(e,n);return Ts(e,t,a,n)}var Ty={float32:4,float16:2,int32:4,uint16:2,uint8:1,bool:1,complex64:8},hc=4;async function YF(e,t){let n=[],a=[],r=Array.isArray(e)?e.map(i=>i.name):Object.keys(e);for(let i=0;i{let p=await l.bytes(),c=p.reduce((g,y)=>g+y.length,0)+hc*p.length,m=new Uint8Array(c),f=0;for(let g=0;g{if(t+=s.byteLength,n.push(s.byteLength===s.buffer.byteLength?s:new s.constructor(s)),!(s instanceof Float32Array||s instanceof Int32Array||s instanceof Uint8Array))throw new Error(`Unsupported TypedArray subtype: ${s.constructor.name}`)});let a=new Uint8Array(t),r=0;return n.forEach(s=>{a.set(new Uint8Array(s.buffer),r),r+=s.byteLength}),a.buffer}var Ey=typeof Buffer!="undefined"&&(typeof Blob=="undefined"||typeof atob=="undefined"||typeof btoa=="undefined");function J7(e){return Ey?Buffer.byteLength(e):new Blob([e]).size}function QF(e){if(Ey)return Buffer.from(e).toString("base64");let t=new Uint8Array(e),n="";for(let a=0,r=t.length;a{t+=r.byteLength});let n=new Uint8Array(t),a=0;return e.forEach(r=>{n.set(new Uint8Array(r),a),a+=r.byteLength}),n.buffer}function Q7(e){let t="/";for(e=e.trim();e.endsWith(t);)e=e.slice(0,e.length-1);let n=e.split(t);return n[n.length-1]}function sd(e){if(e.modelTopology instanceof ArrayBuffer)throw new Error("Expected JSON model topology, received ArrayBuffer.");return{dateSaved:new Date,modelTopologyType:"JSON",modelTopologyBytes:e.modelTopology==null?0:J7(JSON.stringify(e.modelTopology)),weightSpecsBytes:e.weightSpecs==null?0:J7(JSON.stringify(e.weightSpecs)),weightDataBytes:e.weightData==null?0:e.weightData.byteLength}}function tO(){let e=n=>{let a=n<<13,r=0;for(;(a&8388608)==0;)r-=8388608,a<<=1;return a&=~8388608,r+=947912704,a|r},t=new Uint32Array(2048);t[0]=0;for(let n=1;n<1024;n++)t[n]=e(n);for(let n=1024;n<2048;n++)t[n]=939524096+(n-1024<<13);return t}function nO(){let e=new Uint32Array(64);e[0]=0,e[31]=1199570944,e[32]=2147483648,e[63]=3347054592;for(let t=1;t<31;t++)e[t]=t<<23;for(let t=33;t<63;t++)e[t]=2147483648+(t-32<<23);return e}function aO(){let e=new Uint32Array(64);for(let t=0;t<64;t++)e[t]=1024;return e[0]=e[32]=0,e}function rO(){let e=tO(),t=nO(),n=aO();return a=>{let r=new ArrayBuffer(4*a.length),s=new Uint32Array(r);for(let i=0;i>10]+(o&1023)]+t[o>>10];s[i]=l}return new Float32Array(r)}}var Gt=class{constructor(){this.saveRouters=[],this.loadRouters=[]}static getInstance(){return Gt.instance==null&&(Gt.instance=new Gt),Gt.instance}static registerSaveRouter(e){Gt.getInstance().saveRouters.push(e)}static registerLoadRouter(e){Gt.getInstance().loadRouters.push(e)}static getSaveHandlers(e){return Gt.getHandlers(e,"save")}static getLoadHandlers(e,t){return Gt.getHandlers(e,"load",t)}static getHandlers(e,t,n){let a=[];return(t==="load"?Gt.getInstance().loadRouters:Gt.getInstance().saveRouters).forEach(r=>{let s=r(e,n);s!==null&&a.push(s)}),a}},sO=e=>Gt.registerSaveRouter(e),iO=e=>Gt.registerLoadRouter(e),oO=e=>Gt.getSaveHandlers(e),lO=(e,t)=>Gt.getLoadHandlers(e,t),My="tensorflowjs",$y=1,gi="models_store",Es="model_info_store";function ek(){if(!ht().getBool("IS_BROWSER"))throw new Error("Failed to obtain IndexedDB factory because the current environmentis not a web browser.");let e=typeof window=="undefined"?self:window,t=e.indexedDB||e.mozIndexedDB||e.webkitIndexedDB||e.msIndexedDB||e.shimIndexedDB;if(t==null)throw new Error("The current browser does not appear to support IndexedDB.");return t}function Ry(e){let t=e.result;t.createObjectStore(gi,{keyPath:"modelPath"}),t.createObjectStore(Es,{keyPath:"modelPath"})}var yi=class{constructor(e){if(this.indexedDB=ek(),e==null||!e)throw new Error("For IndexedDB, modelPath must not be null, undefined or empty.");this.modelPath=e}async save(e){if(e.modelTopology instanceof ArrayBuffer)throw new Error("BrowserLocalStorage.save() does not support saving model topology in binary formats yet.");return this.databaseAction(this.modelPath,e)}async load(){return this.databaseAction(this.modelPath)}databaseAction(e,t){return new Promise((n,a)=>{let r=this.indexedDB.open(My,$y);r.onupgradeneeded=()=>Ry(r),r.onsuccess=()=>{let s=r.result;if(t==null){let i=s.transaction(gi,"readonly"),o=i.objectStore(gi).get(this.modelPath);o.onsuccess=()=>{if(o.result==null)return s.close(),a(new Error(`Cannot find model with path '${this.modelPath}' in IndexedDB.`));n(o.result.modelArtifacts)},o.onerror=l=>(s.close(),a(o.error)),i.oncomplete=()=>s.close()}else{let i=sd(t),o=s.transaction(Es,"readwrite"),l=o.objectStore(Es),u=l.put({modelPath:this.modelPath,modelArtifactsInfo:i}),d;u.onsuccess=()=>{d=s.transaction(gi,"readwrite");let h=d.objectStore(gi).put({modelPath:this.modelPath,modelArtifacts:t,modelArtifactsInfo:i});h.onsuccess=()=>n({modelArtifactsInfo:i}),h.onerror=p=>{l=o.objectStore(Es);let c=l.delete(this.modelPath);c.onsuccess=()=>(s.close(),a(h.error)),c.onerror=m=>(s.close(),a(h.error))}},u.onerror=h=>(s.close(),a(u.error)),o.oncomplete=()=>{d==null?s.close():d.oncomplete=()=>s.close()}}},r.onerror=s=>a(r.error)})}};yi.URL_SCHEME="indexeddb://";var tk=e=>ht().getBool("IS_BROWSER")&&!Array.isArray(e)&&e.startsWith(yi.URL_SCHEME)?uO(e.slice(yi.URL_SCHEME.length)):null;Gt.registerSaveRouter(tk);Gt.registerLoadRouter(tk);function uO(e){return new yi(e)}function dO(e){return e.startsWith(yi.URL_SCHEME)?e.slice(yi.URL_SCHEME.length):e}var hO=class{constructor(){this.indexedDB=ek()}async listModels(){return new Promise((e,t)=>{let n=this.indexedDB.open(My,$y);n.onupgradeneeded=()=>Ry(n),n.onsuccess=()=>{let a=n.result,r=a.transaction(Es,"readonly"),s=r.objectStore(Es).getAll();s.onsuccess=()=>{let i={};for(let o of s.result)i[o.modelPath]=o.modelArtifactsInfo;e(i)},s.onerror=i=>(a.close(),t(s.error)),r.oncomplete=()=>a.close()},n.onerror=a=>t(n.error)})}async removeModel(e){return e=dO(e),new Promise((t,n)=>{let a=this.indexedDB.open(My,$y);a.onupgradeneeded=()=>Ry(a),a.onsuccess=()=>{let r=a.result,s=r.transaction(Es,"readwrite"),i=s.objectStore(Es),o=i.get(e),l;o.onsuccess=()=>{if(o.result==null)return r.close(),n(new Error(`Cannot find model with path '${e}' in IndexedDB.`));{let u=i.delete(e),d=()=>{l=r.transaction(gi,"readwrite");let h=l.objectStore(gi).delete(e);h.onsuccess=()=>t(o.result.modelArtifactsInfo),h.onerror=p=>n(o.error)};u.onsuccess=d,u.onerror=h=>(d(),r.close(),n(o.error))}},o.onerror=u=>(r.close(),n(o.error)),s.oncomplete=()=>{l==null?r.close():l.oncomplete=()=>r.close()}},a.onerror=r=>n(a.error)})}},Xr="/",Bo="tensorflowjs_models",nk="info",pO="model_topology",cO="weight_specs",fO="weight_data",mO="model_metadata";function ak(e){return{info:[Bo,e,nk].join(Xr),topology:[Bo,e,pO].join(Xr),weightSpecs:[Bo,e,cO].join(Xr),weightData:[Bo,e,fO].join(Xr),modelMetadata:[Bo,e,mO].join(Xr)}}function gO(e){let t=e.split(Xr);if(t.length<3)throw new Error(`Invalid key format: ${e}`);return t.slice(1,t.length-1).join(Xr)}function yO(e){return e.startsWith(Ai.URL_SCHEME)?e.slice(Ai.URL_SCHEME.length):e}var Ai=class{constructor(e){if(!ht().getBool("IS_BROWSER")||typeof window=="undefined"||typeof window.localStorage=="undefined")throw new Error("The current environment does not support local storage.");if(this.LS=window.localStorage,e==null||!e)throw new Error("For local storage, modelPath must not be null, undefined or empty.");this.modelPath=e,this.keys=ak(this.modelPath)}async save(e){if(e.modelTopology instanceof ArrayBuffer)throw new Error("BrowserLocalStorage.save() does not support saving model topology in binary formats yet.");{let t=JSON.stringify(e.modelTopology),n=JSON.stringify(e.weightSpecs),a=sd(e);try{this.LS.setItem(this.keys.info,JSON.stringify(a)),this.LS.setItem(this.keys.topology,t),this.LS.setItem(this.keys.weightSpecs,n),this.LS.setItem(this.keys.weightData,QF(e.weightData));let r={format:e.format,generatedBy:e.generatedBy,convertedBy:e.convertedBy};return e.signature!=null&&(r.signature=e.signature),e.userDefinedMetadata!=null&&(r.userDefinedMetadata=e.userDefinedMetadata),e.modelInitializer!=null&&(r.modelInitializer=e.modelInitializer),this.LS.setItem(this.keys.modelMetadata,JSON.stringify(r)),{modelArtifactsInfo:a}}catch(r){throw this.LS.removeItem(this.keys.info),this.LS.removeItem(this.keys.topology),this.LS.removeItem(this.keys.weightSpecs),this.LS.removeItem(this.keys.weightData),this.LS.removeItem(this.keys.modelMetadata),new Error(`Failed to save model '${this.modelPath}' to local storage: size quota being exceeded is a possible cause of this failure: modelTopologyBytes=${a.modelTopologyBytes}, weightSpecsBytes=${a.weightSpecsBytes}, weightDataBytes=${a.weightDataBytes}.`)}}}async load(){let e=JSON.parse(this.LS.getItem(this.keys.info));if(e==null)throw new Error(`In local storage, there is no model with name '${this.modelPath}'`);if(e.modelTopologyType!=="JSON")throw new Error("BrowserLocalStorage does not support loading non-JSON model topology yet.");let t={},n=JSON.parse(this.LS.getItem(this.keys.topology));if(n==null)throw new Error(`In local storage, the topology of model '${this.modelPath}' is missing.`);t.modelTopology=n;let a=JSON.parse(this.LS.getItem(this.keys.weightSpecs));if(a==null)throw new Error(`In local storage, the weight specs of model '${this.modelPath}' are missing.`);t.weightSpecs=a;let r=this.LS.getItem(this.keys.modelMetadata);if(r!=null){let i=JSON.parse(r);t.format=i.format,t.generatedBy=i.generatedBy,t.convertedBy=i.convertedBy,i.signature!=null&&(t.signature=i.signature),i.userDefinedMetadata!=null&&(t.userDefinedMetadata=i.userDefinedMetadata),i.modelInitializer!=null&&(t.modelInitializer=i.modelInitializer)}let s=this.LS.getItem(this.keys.weightData);if(s==null)throw new Error(`In local storage, the binary weight values of model '${this.modelPath}' are missing.`);return t.weightData=eO(s),t}};Ai.URL_SCHEME="localstorage://";var rk=e=>ht().getBool("IS_BROWSER")&&!Array.isArray(e)&&e.startsWith(Ai.URL_SCHEME)?AO(e.slice(Ai.URL_SCHEME.length)):null;Gt.registerSaveRouter(rk);Gt.registerLoadRouter(rk);function AO(e){return new Ai(e)}var xO=class{constructor(){L(ht().getBool("IS_BROWSER"),()=>"Current environment is not a web browser"),L(typeof window=="undefined"||typeof window.localStorage!="undefined",()=>"Current browser does not appear to support localStorage"),this.LS=window.localStorage}async listModels(){let e={},t=Bo+Xr,n=Xr+nk;for(let a=0;a"scheme must not be undefined or null."),e.endsWith(Vo)&&(e=e.slice(0,e.indexOf(Vo))),L(e.length>0,()=>"scheme must not be an empty string.");let n=Ia.getInstance();L(n.managers[e]==null,()=>`A model store manager is already registered for scheme '${e}'.`),n.managers[e]=t}static getManager(e){let t=this.getInstance().managers[e];if(t==null)throw new Error(`Cannot find model manager for scheme '${e}'`);return t}static getSchemes(){return Object.keys(this.getInstance().managers)}};function pc(e){if(e.indexOf(Vo)===-1)throw new Error(`The url string provided does not contain a scheme. Supported schemes are: ${Ia.getSchemes().join(",")}`);return{scheme:e.split(Vo)[0],path:e.split(Vo)[1]}}async function sk(e,t,n=!1){L(e!==t,()=>`Old path and new path are the same: '${e}'`);let a=Gt.getLoadHandlers(e);L(a.length>0,()=>`Copying failed because no load handler is found for source URL ${e}.`),L(a.length<2,()=>`Copying failed because more than one (${a.length}) load handlers for source URL ${e}.`);let r=a[0],s=Gt.getSaveHandlers(t);L(s.length>0,()=>`Copying failed because no save handler is found for destination URL ${t}.`),L(s.length<2,()=>`Copying failed because more than one (${a.length}) save handlers for destination URL ${t}.`);let i=s[0],o=pc(e).scheme,l=pc(e).path,u=o===pc(e).scheme,d=await r.load();n&&u&&await Ia.getManager(o).removeModel(l);let h=await i.save(d);return n&&!u&&await Ia.getManager(o).removeModel(l),h.modelArtifactsInfo}async function bO(){let e=Ia.getSchemes(),t={};for(let n of e){let a=await Ia.getManager(n).listModels();for(let r in a){let s=n+Vo+r;t[s]=a[r]}}return t}async function vO(e){let t=pc(e);return Ia.getManager(t.scheme).removeModel(t.path)}async function wO(e,t){return sk(e,t,!1)}async function kO(e,t){return sk(e,t,!0)}var IO=class{fetch(e,t){return fetch(e,t)}now(){return performance.now()}encode(e,t){if(t!=="utf-8"&&t!=="utf8")throw new Error(`Browser's encoder only supports utf-8, but got ${t}`);return this.textEncoder==null&&(this.textEncoder=new TextEncoder),this.textEncoder.encode(e)}decode(e,t){return new TextDecoder(t).decode(e)}};if(ht().get("IS_BROWSER")){ht().setPlatform("browser",new IO);try{Ia.registerManager(Ai.URL_SCHEME,new xO)}catch(e){}try{Ia.registerManager(yi.URL_SCHEME,new hO)}catch(e){}}var SO={importFetch:()=>_3()},Fy,NO=class{constructor(){this.util=di("util"),this.textEncoder=new this.util.TextEncoder}fetch(e,t){return ht().global.fetch!=null?ht().global.fetch(e,t):(Fy==null&&(Fy=SO.importFetch()),Fy(e,t))}now(){let e=process.hrtime();return e[0]*1e3+e[1]/1e6}encode(e,t){if(t!=="utf-8"&&t!=="utf8")throw new Error(`Node built-in encoder only supports utf-8, but got ${t}`);return this.textEncoder.encode(e)}decode(e,t){return e.length===0?"":new this.util.TextDecoder(t).decode(e)}};ht().get("IS_NODE")&&ht().setPlatform("node",new NO);function Zr(e,t="float32",n){return t=t||"float32",ny(e),new uc(e,t,n)}function TO(e,t){let n=O(e,"x","cast");if(!H3(t))throw new Error(`Failed to cast to unknown dtype ${t}`);if(t==="string"&&n.dtype!=="string"||t!=="string"&&n.dtype==="string")throw new Error("Only strings can be casted to strings");let a={x:n},r={dtype:t};return V.runKernel(oy,a,r)}var zt=U({cast_:TO});function EO(e){let t={x:O(e,"x","clone","string_or_numeric")};return V.runKernel(ly,t)}var Yr=U({clone_:EO});function ik(e,t=!1){console.log(e.toString(t))}H7();var CO={buffer:Zr,cast:zt,clone:Yr,print:ik};LF(CO);var ok={};$e(ok,{browserFiles:()=>_O,browserHTTPRequest:()=>BO,concatenateArrayBuffers:()=>Cy,copyModel:()=>wO,decodeWeights:()=>Y7,encodeWeights:()=>YF,fromMemory:()=>UO,getLoadHandlers:()=>lO,getModelArtifactsInfoForJSON:()=>sd,getSaveHandlers:()=>oO,http:()=>zy,isHTTPScheme:()=>_y,listModels:()=>bO,loadWeights:()=>zO,moveModel:()=>kO,registerLoadRouter:()=>iO,registerSaveRouter:()=>sO,removeModel:()=>vO,weightsLoaderFactory:()=>hk,withSaveHandler:()=>jO});var MO="model",$O=".json",RO=".weights.bin";function lk(e){return new Promise(t=>setTimeout(t)).then(e)}var Oy=class{constructor(e){if(!ht().getBool("IS_BROWSER"))throw new Error("browserDownloads() cannot proceed because the current environment is not a browser.");e.startsWith(Oy.URL_SCHEME)&&(e=e.slice(Oy.URL_SCHEME.length)),(e==null||e.length===0)&&(e=MO),this.modelTopologyFileName=e+$O,this.weightDataFileName=e+RO}async save(e){if(typeof document=="undefined")throw new Error("Browser downloads are not supported in this environment since `document` is not present");let t=window.URL.createObjectURL(new Blob([e.weightData],{type:"application/octet-stream"}));if(e.modelTopology instanceof ArrayBuffer)throw new Error("BrowserDownloads.save() does not support saving model topology in binary formats yet.");{let n=[{paths:["./"+this.weightDataFileName],weights:e.weightSpecs}],a={modelTopology:e.modelTopology,format:e.format,generatedBy:e.generatedBy,convertedBy:e.convertedBy,weightsManifest:n};e.signature!=null&&(a.signature=e.signature),e.userDefinedMetadata!=null&&(a.userDefinedMetadata=e.userDefinedMetadata),e.modelInitializer!=null&&(a.modelInitializer=e.modelInitializer);let r=window.URL.createObjectURL(new Blob([JSON.stringify(a)],{type:"application/json"})),s=this.jsonAnchor==null?document.createElement("a"):this.jsonAnchor;if(s.download=this.modelTopologyFileName,s.href=r,await lk(()=>s.dispatchEvent(new MouseEvent("click"))),e.weightData!=null){let i=this.weightDataAnchor==null?document.createElement("a"):this.weightDataAnchor;i.download=this.weightDataFileName,i.href=t,await lk(()=>i.dispatchEvent(new MouseEvent("click")))}return{modelArtifactsInfo:sd(e)}}}},cc=Oy;cc.URL_SCHEME="downloads://";var FO=class{constructor(e){if(e==null||e.length<1)throw new Error(`When calling browserFiles, at least 1 file is required, but received ${e}`);this.files=e}async load(){let e=this.files[0],t=this.files.slice(1);return new Promise((n,a)=>{let r=new FileReader;r.onload=s=>{let i=JSON.parse(s.target.result),o=i.modelTopology;if(o==null){a(new Error(`modelTopology field is missing from file ${e.name}`));return}t.length===0&&n({modelTopology:o});let l=i.weightsManifest;if(l==null){a(new Error(`weightManifest field is missing from file ${e.name}`));return}let u;try{u=this.checkManifestAndWeightFiles(l,t)}catch(c){a(c);return}let d=[],h=[],p=[];l.forEach(c=>{c.paths.forEach(m=>{h.push(m),p.push(null)}),d.push(...c.weights)}),l.forEach(c=>{c.paths.forEach(m=>{let f=new FileReader;f.onload=g=>{let y=g.target.result,A=h.indexOf(m);if(p[A]=y,p.indexOf(null)===-1){let x={modelTopology:o,weightSpecs:d,weightData:Cy(p),format:i.format,generatedBy:i.generatedBy,convertedBy:i.convertedBy};i.signature!=null&&(x.signature=i.signature),i.userDefinedMetadata!=null&&(x.userDefinedMetadata=i.userDefinedMetadata),i.modelInitializer!=null&&(x.modelInitializer=i.modelInitializer),n(x)}},f.onerror=g=>a(`Failed to weights data from file of path '${m}'.`),f.readAsArrayBuffer(u[m])})})},r.onerror=s=>a(`Failed to read model topology and weights manifest JSON from file '${e.name}'. BrowserFiles supports loading Keras-style tf.Model artifacts only.`),r.readAsText(e)})}checkManifestAndWeightFiles(e,t){let n=[],a=t.map(s=>Q7(s.name)),r={};for(let s of e)s.paths.forEach(i=>{let o=Q7(i);if(n.indexOf(o)!==-1)throw new Error(`Duplicate file basename found in weights manifest: '${o}'`);if(n.push(o),a.indexOf(o)===-1)throw new Error(`Weight file with basename '${o}' is not provided.`);r[i]=t[a.indexOf(o)]});if(n.length!==t.length)throw new Error(`Mismatch in the number of files in weights manifest (${n.length}) and the number of weight files provided (${t.length}).`);return r}},OO=e=>ht().getBool("IS_BROWSER")&&!Array.isArray(e)&&e.startsWith(cc.URL_SCHEME)?DO(e.slice(cc.URL_SCHEME.length)):null;Gt.registerSaveRouter(OO);function DO(e="model"){return new cc(e)}function _O(e){return new FO(e)}function uk(e,t,n,a){i(e),n=n==null?0:n,a=a==null?1:a,o(n,a);let r=0,s=l=>(l.then(u=>{let d=n+ ++r/e.length*(a-n);return t(d),u}),l);function i(l){L(l!=null&&Array.isArray(l)&&l.length>0,()=>"promises must be a none empty array")}function o(l,u){L(l>=0&&l<=1,()=>`Progress fraction must be in range [0, 1], but got startFraction ${l}`),L(u>=0&&u<=1,()=>`Progress fraction must be in range [0, 1], but got endFraction ${u}`),L(u>=l,()=>`startFraction must be no more than endFraction, but got startFraction ${l} and endFraction ${u}`)}return Promise.all(e.map(s))}async function dk(e,t){t==null&&(t={});let n=t.fetchFunc==null?ht().platform.fetch:t.fetchFunc,a=e.map(u=>n(u,t.requestInit,{isBinary:!0})),r=0,s=.5,i=(t.onProgress==null?await Promise.all(a):await uk(a,t.onProgress,r,s)).map(u=>u.arrayBuffer()),o=.5,l=1;return t.onProgress==null?await Promise.all(i):await uk(i,t.onProgress,o,l)}async function zO(e,t="",n,a){return hk(r=>dk(r,{requestInit:a}))(e,t,n)}function hk(e){return async(t,n="",a)=>{let r=t.map(()=>!1),s={},i=a!=null?a.map(()=>!1):[],o=[];if(t.forEach((c,m)=>{let f=0;c.weights.forEach(g=>{let y="quantization"in g?g.quantization.dtype:g.dtype,A=Ty[y]*Jt(g.shape),x=()=>{r[m]=!0,s[m]==null&&(s[m]=[]),s[m].push({manifestEntry:g,groupOffset:f,sizeBytes:A})};a!=null?a.forEach((v,b)=>{v===g.name&&(x(),i[b]=!0)}):x(),o.push(g.name),f+=A})}),!i.every(c=>c)){let c=a.filter((m,f)=>!i[f]);throw new Error(`Could not find weights in manifest with names: ${c.join(", ")}. -Manifest JSON has weights with names: ${o.join(", ")}.`)}let l=r.reduce((c,m,f)=>(m&&c.push(f),c),[]),u=[];l.forEach(c=>{t[c].paths.forEach(m=>{let f=n+(n.endsWith("/")?"":"/")+m;u.push(f)})});let d=await e(u),h={},p=0;return l.forEach(c=>{let m=t[c].paths.length,f=0;for(let x=0;x{let v=g.slice(x.groupOffset,x.groupOffset+x.sizeBytes),b=Y7(v,[x.manifestEntry]);for(let w in b)h[w]=b[w]}),p+=m}),h}}var PO="application/octet-stream",LO="application/json",Dy=class{constructor(e,t){if(this.DEFAULT_METHOD="POST",t==null&&(t={}),this.weightPathPrefix=t.weightPathPrefix,this.onProgress=t.onProgress,this.weightUrlConverter=t.weightUrlConverter,t.fetchFunc!=null?(L(typeof t.fetchFunc=="function",()=>"Must pass a function that matches the signature of `fetch` (see https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API)"),this.fetch=t.fetchFunc):this.fetch=ht().platform.fetch,L(e!=null&&e.length>0,()=>"URL path for http must not be null, undefined or empty."),Array.isArray(e)&&L(e.length===2,()=>`URL paths for http must have a length of 2, (actual length is ${e.length}).`),this.path=e,t.requestInit!=null&&t.requestInit.body!=null)throw new Error("requestInit is expected to have no pre-existing body, but has one.");this.requestInit=t.requestInit||{}}async save(e){if(e.modelTopology instanceof ArrayBuffer)throw new Error("BrowserHTTPRequest.save() does not support saving model topology in binary formats yet.");let t=Object.assign({method:this.DEFAULT_METHOD},this.requestInit);t.body=new FormData;let n=[{paths:["./model.weights.bin"],weights:e.weightSpecs}],a={modelTopology:e.modelTopology,format:e.format,generatedBy:e.generatedBy,convertedBy:e.convertedBy,weightsManifest:n};e.signature!=null&&(a.signature=e.signature),e.userDefinedMetadata!=null&&(a.userDefinedMetadata=e.userDefinedMetadata),e.modelInitializer!=null&&(a.modelInitializer=e.modelInitializer),t.body.append("model.json",new Blob([JSON.stringify(a)],{type:LO}),"model.json"),e.weightData!=null&&t.body.append("model.weights.bin",new Blob([e.weightData],{type:PO}),"model.weights.bin");let r=await this.fetch(this.path,t);if(r.ok)return{modelArtifactsInfo:sd(e),responses:[r]};throw new Error(`BrowserHTTPRequest.save() failed due to HTTP response status ${r.status}.`)}async load(){let e=await this.fetch(this.path,this.requestInit);if(!e.ok)throw new Error(`Request to ${this.path} failed with status code ${e.status}. Please verify this URL points to the model JSON of the model to load.`);let t;try{t=await e.json()}catch(c){let m=`Failed to parse model JSON of response from ${this.path}.`;throw this.path.endsWith(".pb")?m+=" Your path contains a .pb file extension. Support for .pb models have been removed in TensorFlow.js 1.0 in favor of .json models. You can re-convert your Python TensorFlow model using the TensorFlow.js 1.0 conversion scripts or you can convert your.pb models with the 'pb2json'NPM script in the tensorflow/tfjs-converter repository.":m+=" Please make sure the server is serving valid JSON for this request.",new Error(m)}let n=t.modelTopology,a=t.weightsManifest,r=t.generatedBy,s=t.convertedBy,i=t.format,o=t.signature,l=t.userDefinedMetadata;if(n==null&&a==null)throw new Error(`The JSON from HTTP path ${this.path} contains neither model topology or manifest for weights.`);let u,d;a!=null&&([u,d]=await this.loadWeights(a));let h={modelTopology:n,weightSpecs:u,weightData:d,generatedBy:r,convertedBy:s,format:i};o!=null&&(h.signature=o),l!=null&&(h.userDefinedMetadata=l);let p=t.modelInitializer;return p&&(h.modelInitializer=p),h}async loadWeights(e){let t=Array.isArray(this.path)?this.path[1]:this.path,[n,a]=WO(t),r=this.weightPathPrefix||n,s=[];for(let u of e)s.push(...u.weights);let i=[],o=[];for(let u of e)for(let d of u.paths)this.weightUrlConverter!=null?o.push(this.weightUrlConverter(d)):i.push(r+d+a);this.weightUrlConverter&&i.push(...await Promise.all(o));let l=await dk(i,{requestInit:this.requestInit,fetchFunc:this.fetch,onProgress:this.onProgress});return[s,Cy(l)]}};Dy.URL_SCHEME_REGEX=/^https?:\/\//;function WO(e){let t=e.lastIndexOf("/"),n=e.lastIndexOf("?"),a=e.substring(0,t),r=n>t?e.substring(n):"";return[a+"/",r]}function _y(e){return e.match(Dy.URL_SCHEME_REGEX)!=null}var pk=(e,t)=>{if(typeof fetch=="undefined"&&(t==null||t.fetchFunc==null))return null;{let n=!0;if(Array.isArray(e)?n=e.every(a=>_y(a)):n=_y(e),n)return zy(e,t)}return null};Gt.registerSaveRouter(pk);Gt.registerLoadRouter(pk);function zy(e,t){return new Dy(e,t)}function BO(e,t){return zy(e,t)}var Py=class{constructor(e){this.modelArtifacts=e}async load(){return this.modelArtifacts}},VO=class{constructor(e){this.saveHandler=e}async save(e){return this.saveHandler(e)}};function UO(e,t,n,a){return arguments.length===1?e.modelTopology!=null||e.weightSpecs!=null?new Py(e):(console.warn("Please call tf.io.fromMemory() with only one argument. The argument should be of type ModelArtifacts. The multi-argument signature of tf.io.fromMemory() has been deprecated and will be removed in a future release."),new Py({modelTopology:e})):(console.warn("Please call tf.io.fromMemory() with only one argument. The argument should be of type ModelArtifacts. The multi-argument signature of tf.io.fromMemory() has been deprecated and will be removed in a future release."),new Py({modelTopology:e,weightSpecs:t,weightData:n,trainingConfig:a}))}function jO(e){return new VO(e)}var ck={};$e(ck,{confusionMatrix:()=>XO});function HO(e,t,n=!1,a=!1){let r=O(e,"a","matMul"),s=O(t,"b","matMul");[r,s]=Vt(r,s);let i={a:r,b:s},o={transposeA:n,transposeB:a};return V.runKernel(fv,i,o)}var yt=U({matMul_:HO});function GO(e,t,n=1,a=0){if(t<2)throw new Error(`Error in oneHot: depth must be >=2, but it is ${t}`);let r={indices:O(e,"indices","oneHot","int32")},s={depth:t,onValue:n,offValue:a};return V.runKernel(Dw,r,s)}var Ly=U({oneHot_:GO});function qO(e,t){let n=O(e,"x","transpose");if(t==null&&(t=n.shape.map((s,i)=>i).reverse()),L(n.rank===t.length,()=>`Error in transpose: rank of input ${n.rank} must match length of perm ${t}.`),t.forEach(s=>{L(s>=0&&s`All entries in 'perm' must be between 0 and ${n.rank-1} but got ${t}`)}),n.rank<=1)return n.clone();let a={x:n},r={perm:t};return V.runKernel(T7,a,r)}var fc=U({transpose_:qO});function KO(e,t,n){let a=O(e,"labels","confusionMatrix"),r=O(t,"predictions","confusionMatrix");L(n==null||n>0&&Number.isInteger(n),()=>`If provided, numClasses must be a positive integer, but got ${n}`),L(a.rank===1,()=>`Expected the rank of labels to be 1, but got ${a.rank}`),L(r.rank===1,()=>`Expected the rank of predictions to be 1, but got ${r.rank}`),L(a.shape[0]===r.shape[0],()=>`Mismatch in the number of examples: ${a.shape[0]} vs. ${r.shape[0]}. Labels and predictions should have the same number of elements.`),L(n>0&&Number.isInteger(n),()=>`numClasses is required to be a positive integer, but got ${n}`);let s=Ly(zt(a,"int32"),n),i=Ly(zt(r,"int32"),n),o=fc(s),l=yt(o,i);return zt(l,"int32")}var XO=U({confusionMatrix_:KO}),Ua={};$e(Ua,{fromPixels:()=>nD,fromPixelsAsync:()=>eD,toPixels:()=>tD});function mc(e,t,n){if(hi(e),t!=null&&t.length!==3)throw new Error("tensor3d() requires shape to have three numbers");let a=Ir(e,n);if(a.length!==3&&a.length!==1)throw new Error("tensor3d() requires values to be number[][][] or flat/TypedArray");if(a.length===1&&t==null)throw new Error("tensor3d() requires shape to be provided when `values` are a flat array");return Ts(e,t,a,n)}var Uo;function fk(e,t=3){if(t>4)throw new Error("Cannot construct Tensor with more than 4 channels from pixels.");if(e==null)throw new Error("pixels passed to tf.browser.fromPixels() can not be null");let n=!1,a=!1,r=!1,s=!1,i=!1,o=!1;if(e.data instanceof Uint8Array)n=!0;else if(typeof ImageData!="undefined"&&e instanceof ImageData)a=!0;else if(typeof HTMLVideoElement!="undefined"&&e instanceof HTMLVideoElement)r=!0;else if(typeof HTMLImageElement!="undefined"&&e instanceof HTMLImageElement)s=!0;else if(e.getContext!=null)i=!0;else if(typeof ImageBitmap!="undefined"&&e instanceof ImageBitmap)o=!0;else throw new Error(`pixels passed to tf.browser.fromPixels() must be either an HTMLVideoElement, HTMLImageElement, HTMLCanvasElement, ImageData in browser, or OffscreenCanvas, ImageData in webworker or {data: Uint32Array, width: number, height: number}, but was ${e.constructor.name}`);if(r){let p=2;if(r&&e.readyState element.")}if(ac(dy,V.backendName)!=null){let p={pixels:e},c={numChannels:t};return V.runKernel(dy,p,c)}let[l,u]=r?[e.videoWidth,e.videoHeight]:[e.width,e.height],d;i?d=e.getContext("2d").getImageData(0,0,l,u).data:a||n?d=e.data:(s||r||o)&&(Uo==null&&(Uo=document.createElement("canvas").getContext("2d")),Uo.canvas.width=l,Uo.canvas.height=u,Uo.drawImage(e,0,0,l,u),d=Uo.getImageData(0,0,l,u).data);let h;if(t===4)h=new Int32Array(d);else{let p=l*u;h=new Int32Array(p*t);for(let c=0;c4||s===2)throw new Error(`toPixels only supports depth of size 1, 3 or 4 but got ${s}`);if(n.dtype!=="float32"&&n.dtype!=="int32")throw new Error(`Unsupported type for toPixels: ${n.dtype}. Please use float32 or int32 tensors.`);let i=await n.data(),o=n.dtype==="float32"?255:1,l=new Uint8ClampedArray(r*a*4);for(let u=0;u1)throw new Error(`Tensor values for a float32 Tensor must be in the range [0 - 1] but encountered ${c}.`)}else if(n.dtype==="int32"&&(c<0||c>255))throw new Error(`Tensor values for a int32 Tensor must be in the range [0 - 255] but encountered ${c}.`);s===1?(d[0]=c*o,d[1]=c*o,d[2]=c*o):d[p]=c*o}let h=u*4;l[h+0]=Math.round(d[0]),l[h+1]=Math.round(d[1]),l[h+2]=Math.round(d[2]),l[h+3]=Math.round(d[3])}if(t!=null){t.width=r,t.height=a;let u=t.getContext("2d"),d=new ImageData(l,r,a);u.putImageData(d,0,0)}return n!==e&&n.dispose(),l}var nD=U({fromPixels_:fk}),mk={};$e(mk,{prepareAndValidate:()=>gk});function gk(e,t){let n=e.shape.length,a=t.shape.length;if(n<1)throw new Error(`tf.gatherND() expects the input to be rank 1 or higher, but the rank was ${n}.`);if(a<1)throw new Error(`tf.gatherND() expects the indices to be rank 1 or higher, but the rank was ${a}.`);if(t.dtype!=="int32")throw new Error(`tf.gatherND() expects the indices to be int32 type, but the dtype was ${t.dtype}.`);if(t.shape[a-1]>n)throw new Error(`index innermost dimension length must be <= tensor rank; saw: ${t.shape[a-1]} vs. ${n}`);if(Jt(e.shape)===0)throw new Error(`Requested more than 0 entries, but input is empty. Input shape: ${e.shape}.`);let r=t.shape,s=r[r.length-1],i=1;for(let h=0;hh/u),1].slice(0,s);return[l,i,u,d]}var yk={};$e(yk,{calculateShapes:()=>Ak,validateInput:()=>By,validateUpdateShape:()=>Wy});function Wy(e,t,n){let a=t.rank>1?t.shape[t.rank-1]:1,r=t.rank>1?t.rank-1:1,s=`Must have updates.shape = indices.shape[:batchDim] + shape[sliceDim:], got updates.shape: ${n.shape}, indices.shape: ${t.shape}, shape: ${e}, sliceDim: ${a}, and batchDim: ${r}.`;if(n.rank1?t.shape[a-1]:1,s=n.length,i=1;for(let h=r;haD,computeFlatOffset:()=>sD,computeOutShape:()=>xk,getNormalizedAxes:()=>kk,isSliceContinous:()=>rD,maskToAxes:()=>gc,parseSliceParams:()=>iD,sliceInfo:()=>oD,startForAxis:()=>Tk,startIndicesWithElidedDims:()=>Ik,stopForAxis:()=>Ek,stopIndicesWithElidedDims:()=>Sk,stridesForAxis:()=>Nk,stridesWithElidedDims:()=>bk});function aD(e,t,n){let a=e.shape.length;L(a===t.length,()=>`Error in slice${a}D: Length of begin ${t} must match the rank of the array (${a}).`),L(a===n.length,()=>`Error in slice${a}D: Length of size ${n} must match the rank of the array (${a}).`);for(let r=0;r`Error in slice${a}D: begin[${r}] + size[${r}] (${t[r]+n[r]}) would overflow input.shape[${r}] (${e.shape[r]})`)}function gc(e){let t=[],n=0;for(;e>0;)e&1&&t.push(n),e/=2,n++;return t}function xk(e,t,n){let a=[];for(let r=0;r0){let c=t[0],m=n+1;d=Ik(i,c,m,a,e),h=Sk(o,c,m,r,e),p=bk(s,c,m,e)}else for(let c=0;c-1)s[o]=0;else{let l=vk(t,n,o),u=a[l];e&1<-1)s[o]=Number.MAX_SAFE_INTEGER;else{let l=vk(t,n,o),u=a[l];e&1<0?i=Number.MIN_SAFE_INTEGER:i=Number.MAX_SAFE_INTEGER);let l=a[r];return i<0&&(i+=l),i=qu(0,i,l-1),i}function Ek(e,t,n,a,r,s){let i=t[r],o=n[r]||1;(e&1<0?i=Number.MAX_SAFE_INTEGER:i=Number.MIN_SAFE_INTEGER);let l=a[r];return i<0&&(i+=l),o>0?i=qu(0,i,l):i=qu(-1,i,l-1),i}function rD(e,t,n){let a=n.length;for(let r=0;r1){a=r;break}for(let r=a+1;r0||n[r]!==e[r])return!1;return!0}function sD(e,t){let n=e.length>0?e[e.length-1]:1;for(let a=0;a{L(i!==-1,()=>"slice() does not support negative begin indexing.")});let s;return n==null?s=new Array(r).fill(-1):typeof n=="number"?s=[n,...new Array(r-1).fill(-1)]:n.lengthi>=0?i:(L(i===-1,()=>`Negative size values should be exactly -1 but got ${i} for the slice() size at index ${o}.`),e.shape[o]-a[o])),[a,s]}function oD(e,t,n,a,r,s,i,o,l){let u=t.slice(),d=n.slice(),h=a;a==null&&(h=new Array(u.length));let p=gc(i);if(p.length>1)throw new Error("Multiple ellipses in slice is not allowed.");if(i!==0&&o!==0)throw new Error("Using both ellipsisMask and newAxisMask is not yet supported.");if(i!==0&&l!==0)throw new Error("Using both ellipsisMask and shrinkAxisMask is not yet supported.");let c=e.length-u.length,m=gc(o),f=e.slice();m.forEach(w=>{u[w]=0,d[w]=1,f.splice(w,0,1)});let{begin:g,end:y,strides:A}=kk(f,p,c,u,d,h,r,s,i);u=g,d=y,h=A;let x=gc(l);x.forEach(w=>{d[w]=u[w]+1,h[w]=1});let v=xk(u,d,h),b=v.filter((w,I)=>x.indexOf(I)===-1);return{nonStrided:h.every(w=>w===1),$begin:u,$end:d,$strides:h,size:v,newShape:f,outShape:b}}var Ck={};$e(Ck,{Serializable:()=>Mk,SerializationMap:()=>xi,registerClass:()=>Cs});var Mk=class{getClassName(){return this.constructor.className}static fromConfig(e,t){return new e(t)}},xi=class{constructor(){this.classNameMap={}}static getMap(){return xi.instance==null&&(xi.instance=new xi),xi.instance}static register(e){xi.getMap().classNameMap[e.className]=[e,e.fromConfig]}};function Cs(e){L(e.className!=null,()=>"Class being registered does not have the static className property defined."),L(typeof e.className=="string",()=>"className is required to be a string, but got type "+typeof e.className),L(e.className.length>0,()=>"Class being registered has an empty-string as its className, which is disallowed."),xi.register(e)}var $k={};$e($k,{TEST_EPSILON_FLOAT16:()=>Rk,encodeStrings:()=>Fk,expectArrayBuffersEqual:()=>fD,expectArraysClose:()=>uD,expectArraysEqual:()=>hD,expectNumbersClose:()=>pD,expectPromiseToFail:()=>dD,expectValuesInRange:()=>cD,testEpsilon:()=>Uy});var lD=.001,Rk=.1;function uD(e,t,n){return n==null&&(n=Uy()),jy(e,t,(a,r)=>Hy(a,r,n))}function Uy(){return V.backend.floatPrecision()===32?lD:Rk}function jy(e,t,n){let a=!0;if((En(e)||En(t))&&(a=!1),En(e)&&En(t)&&(a=!0),a){let i=e.constructor.name,o=t.constructor.name;if(i!==o)throw new Error(`Arrays are of different type. Actual: ${i}. Expected: ${o}`)}if(Array.isArray(e)&&Array.isArray(t)){let i=Ir(e),o=Ir(t);if(!Kr(i,o))throw new Error(`Arrays have different shapes. Actual: [${i}]. Expected: [${o}]`)}let r=En(e)?e:pi(e),s=En(t)?t:pi(t);if(r.length!==s.length)throw new Error(`Arrays have different lengths actual: ${r.length} vs expected: ${s.length}. -Actual: ${r}. -Expected: ${s}.`);for(let i=0;it.fail(),()=>t())}function hD(e,t){let n=typeof t=="string"||typeof t=="number"||typeof t=="boolean"?[t]:t;return Is(e)||Is(e[0])||Is(t)||Is(t[0])?jy(e,n,(a,r)=>a==r):jy(e,t,(a,r)=>Hy(a,r,0))}function pD(e,t,n){if(n==null&&(n=Uy()),!Hy(e,t,n))throw new Error(`Numbers differ: actual === ${e}, expected === ${t}`)}function Hy(e,t,n){return!isFinite(e)&&!isFinite(t)?!0:!(isNaN(e)||isNaN(t)||Math.abs(e-t)>n)}function cD(e,t,n){for(let a=0;an)throw new Error(`Value out of range:${e[a]} low: ${t}, high: ${n}`)}function fD(e,t){expect(new Float32Array(e)).toEqual(new Float32Array(t))}function Fk(e){for(let t=0;tt.dispose())}function Dk(e){return V.keep(e)}function kD(e){return V.time(e)}function ID(e){return V.setBackend(e)}function SD(){return V.ready()}function ND(){return V.backendName}function TD(e){V.removeBackend(e)}function Gy(e){return V.findBackend(e)}function ED(e){return V.findBackendFactory(e)}function qy(e,t,n=1){return V.registerBackend(e,t,n)}function CD(){return V.backend}function MD(e,t){ht().setPlatform(e,t)}function $D(e,t){let n=O(e,"a","add"),a=O(t,"b","add");[n,a]=Vt(n,a);let r={a:n,b:a};return V.runKernel(iy,r)}var De=U({add_:$D});function RD(e,t){let n=O(e,"a","floorDiv"),a=O(t,"b","floorDiv");[n,a]=Vt(n,a);let r={a:n,b:a};return V.runKernel(Zv,r)}var _k=U({floorDiv_:RD});function FD(e,t){let n=O(e,"a","div"),a=O(t,"b","div");if([n,a]=Vt(n,a),n.dtype==="int32"&&a.dtype==="int32")return _k(n,a);let r={a:n,b:a},s={};return V.runKernel(Pv,r,s)}var Qe=U({div_:FD});function OD(e,t){let n=O(e,"a","mul"),a=O(t,"b","mul");[n,a]=Vt(n,a);let r={a:n,b:a};return V.runKernel(Ew,r)}var fe=U({mul_:OD});function DD(e){let t=O(e,"x","abs");if(t.dtype==="complex64"){let n={x:t};return V.runKernel(bv,n)}else{let n={x:t};return V.runKernel(Q3,n)}}var Sa=U({abs_:DD});function _D(e){let t={x:O(e,"x","acos")};return V.runKernel(ev,t)}var zD=U({acos_:_D});function PD(e){let t={x:O(e,"x","acosh")};return V.runKernel(tv,t)}var LD=U({acosh_:PD});function WD(e){L(Array.isArray(e),()=>"The argument passed to tf.addN() must be a list of tensors"),L(e.length>=1,()=>`Must pass at least one tensor to tf.addN(), but got ${e.length}`);let t=e.map((r,s)=>O(r,`tensors${s}`,"addN")),n=t[0];t.forEach(r=>{if(r.dtype!==n.dtype)throw new Error("All tensors passed to tf.addN() must have the same dtype")}),t.forEach(r=>{if(!Kr(r.shape,n.shape))throw new Error("All tensors passed to tf.addN() must have the same shape")});let a=t;return V.runKernel(nv,a)}var Ky=U({addN_:WD});function BD(e,t=null,n=!1){let a={x:O(e,"x","all","bool")},r={axis:t,keepDims:n};return V.runKernel(av,a,r)}var VD=U({all_:BD});function UD(e,t=null,n=!1){let a={x:O(e,"x","any","bool")},r={axis:t,keepDims:n};return V.runKernel(rv,a,r)}var jD=U({any_:UD});function HD(e,t=0){let n={x:O(e,"x","argMax")},a={axis:t};return V.runKernel(sv,n,a)}var Xy=U({argMax_:HD});function GD(e,t=0){let n={x:O(e,"x","argMin")},a={axis:t};return V.runKernel(iv,n,a)}var qD=U({argMin_:GD});function KD(e){let t={x:O(e,"x","asin")};return V.runKernel(ov,t)}var XD=U({asin_:KD});function ZD(e){let t={x:O(e,"x","asinh")};return V.runKernel(lv,t)}var YD=U({asinh_:ZD});function JD(e){let t={x:O(e,"x","atan")};return V.runKernel(uv,t)}var QD=U({atan_:JD});function e_(e,t){let n=O(e,"a","atan2"),a=O(t,"b","atan2");[n,a]=Vt(n,a);let r={a:n,b:a};return V.runKernel(hv,r)}var t_=U({atan2_:e_});function n_(e){let t={x:O(e,"x","atanh")};return V.runKernel(dv,t)}var a_=U({atanh_:n_});function r_(e,t,n,a,r="NHWC",s){let i=e[3],o=[...t,i],l=Lk(r);return id(e,o,n,s,a,null,null,l)}function zk(e,t,n,a,r,s,i="channelsLast"){let[o,l]=yc(t),u;if(i==="channelsLast")u=[o,l,e[3],e[3]];else if(i==="channelsFirst")u=[o,l,e[1],e[1]];else throw new Error(`Unknown dataFormat ${i}`);return id(e,u,n,a,r,s,!1,i)}function s_(e,t,n,a,r,s,i="NDHWC"){let[o,l,u]=Yy(t),d,h;if(i==="NDHWC")h="channelsLast",d=[o,l,u,e[4],e[4]];else if(i==="NCDHW")h="channelsFirst",d=[o,l,u,e[1],e[1]];else throw new Error(`Unknown dataFormat ${i}`);return Pk(e,d,n,a,r,!1,h,s)}function id(e,t,n,a,r,s,i=!1,o="channelsLast"){let[l,u,d,h]=[-1,-1,-1,-1];if(o==="channelsLast")[l,u,d,h]=e;else if(o==="channelsFirst")[l,h,u,d]=e;else throw new Error(`Unknown dataFormat ${o}`);let[p,c,,m]=t,[f,g]=yc(n),[y,A]=yc(a),x=jo(p,y),v=jo(c,A),{padInfo:b,outHeight:w,outWidth:I}=l_(r,u,d,f,g,x,v,s,o),T=i?m*h:m,C;return o==="channelsFirst"?C=[l,T,w,I]:o==="channelsLast"&&(C=[l,w,I,T]),{batchSize:l,dataFormat:o,inHeight:u,inWidth:d,inChannels:h,outHeight:w,outWidth:I,outChannels:T,padInfo:b,strideHeight:f,strideWidth:g,filterHeight:p,filterWidth:c,effectiveFilterHeight:x,effectiveFilterWidth:v,dilationHeight:y,dilationWidth:A,inShape:e,outShape:C,filterShape:t}}function Pk(e,t,n,a,r,s=!1,i="channelsLast",o){let[l,u,d,h,p]=[-1,-1,-1,-1,-1];if(i==="channelsLast")[l,u,d,h,p]=e;else if(i==="channelsFirst")[l,p,u,d,h]=e;else throw new Error(`Unknown dataFormat ${i}`);let[c,m,f,,g]=t,[y,A,x]=Yy(n),[v,b,w]=Yy(a),I=jo(c,v),T=jo(m,b),C=jo(f,w),{padInfo:z,outDepth:$,outHeight:S,outWidth:D}=u_(r,u,d,h,y,A,x,I,T,C,o),_=s?g*p:g,W;return i==="channelsFirst"?W=[l,_,$,S,D]:i==="channelsLast"&&(W=[l,$,S,D,_]),{batchSize:l,dataFormat:i,inDepth:u,inHeight:d,inWidth:h,inChannels:p,outDepth:$,outHeight:S,outWidth:D,outChannels:_,padInfo:z,strideDepth:y,strideHeight:A,strideWidth:x,filterDepth:c,filterHeight:m,filterWidth:f,effectiveFilterDepth:I,effectiveFilterHeight:T,effectiveFilterWidth:C,dilationDepth:v,dilationHeight:b,dilationWidth:w,inShape:e,outShape:W,filterShape:t}}function i_(e,t,n,a,r){a==null&&(a=Zy(e,t,n));let s=e[0],i=e[1],o=bi((s-t+2*a)/n+1,r),l=bi((i-t+2*a)/n+1,r);return[o,l]}function o_(e,t,n,a,r,s){r==null&&(r=Zy(e,t,a));let i=e[0],o=e[1],l=e[2],u=bi((i-t+2*r)/a+1,s),d=bi((o-t+2*r)/a+1,s),h=bi((l-t+2*r)/a+1,s);return[u,d,h,n]}function Zy(e,t,n,a=1){let r=jo(t,a);return Math.floor((e[0]*(n-1)-n+r)/2)}function yc(e){return typeof e=="number"?[e,e,e]:e.length===2?[e[0],e[1],1]:e}function Yy(e){return typeof e=="number"?[e,e,e]:e}function jo(e,t){return t<=1?e:e+(e-1)*(t-1)}function l_(e,t,n,a,r,s,i,o,l){let u,d,h;if(typeof e=="number"){u={top:e,bottom:e,left:e,right:e,type:e===0?"VALID":"NUMBER"};let p=i_([t,n],s,a,e,o);d=p[0],h=p[1]}else if(e==="same"){d=Math.ceil(t/a),h=Math.ceil(n/r);let p=Math.max(0,(d-1)*a+s-t),c=Math.max(0,(h-1)*r+i-n),m=Math.floor(p/2),f=p-m,g=Math.floor(c/2),y=c-g;u={top:m,bottom:f,left:g,right:y,type:"SAME"}}else if(e==="valid")u={top:0,bottom:0,left:0,right:0,type:"VALID"},d=Math.ceil((t-s+1)/a),h=Math.ceil((n-i+1)/r);else if(typeof e=="object"){let p=l==="channelsLast"?e[1][0]:e[2][0],c=l==="channelsLast"?e[1][1]:e[2][1],m=l==="channelsLast"?e[2][0]:e[3][0],f=l==="channelsLast"?e[2][1]:e[3][1];u={top:p,bottom:c,left:m,right:f,type:p===0&&c===0&&m===0&&f===0?"VALID":"EXPLICIT"},d=bi((t-s+p+c)/a+1,o),h=bi((n-i+m+f)/r+1,o)}else throw Error(`Unknown padding parameter: ${e}`);return{padInfo:u,outHeight:d,outWidth:h}}function u_(e,t,n,a,r,s,i,o,l,u,d){let h,p,c,m;if(typeof e=="number"){h={top:e,bottom:e,left:e,right:e,front:e,back:e,type:e===0?"VALID":"NUMBER"};let f=o_([t,n,a,1],o,1,r,e,d);p=f[0],c=f[1],m=f[2]}else if(e==="same"){p=Math.ceil(t/r),c=Math.ceil(n/s),m=Math.ceil(a/i);let f=(p-1)*r+o-t,g=(c-1)*s+l-n,y=(m-1)*i+u-a,A=Math.floor(f/2),x=f-A,v=Math.floor(g/2),b=g-v,w=Math.floor(y/2),I=y-w;h={top:v,bottom:b,left:w,right:I,front:A,back:x,type:"SAME"}}else if(e==="valid")h={top:0,bottom:0,left:0,right:0,front:0,back:0,type:"VALID"},p=Math.ceil((t-o+1)/r),c=Math.ceil((n-l+1)/s),m=Math.ceil((a-u+1)/i);else throw Error(`Unknown padding parameter: ${e}`);return{padInfo:h,outDepth:p,outHeight:c,outWidth:m}}function bi(e,t){if(!t)return Math.trunc(e);switch(t){case"round":return Math.round(e);case"ceil":return Math.ceil(e);case"floor":return Math.floor(e);default:throw new Error(`Unknown roundingMode ${t}`)}}function od(e){let[t,n,a]=yc(e);return t===1&&n===1&&a===1}function Jr(e,t){return od(e)||od(t)}function Lk(e){if(e==="NHWC")return"channelsLast";if(e==="NCHW")return"channelsFirst";throw new Error(`Unknown dataFormat ${e}`)}function d_(e,t){let n={x:O(e,"x","reshape","string_or_numeric")},a={shape:t};return V.runKernel(Hw,n,a)}var le=U({reshape_:d_});function h_(e,t,n,a,r){let s=O(e,"x","avgPool","float32"),i=1;L(Jr(n,i),()=>`Error in avgPool: Either strides or dilations must be 1. Got strides ${n} and dilations '${i}'`);let o=s,l=!1;s.rank===3&&(l=!0,o=le(s,[1,s.shape[0],s.shape[1],s.shape[2]])),L(o.rank===4,()=>`Error in avgPool: x must be rank 4 but got rank ${o.rank}.`),r!=null&&L(Zn(a),()=>`Error in avgPool: pad must be an integer when using, dimRoundingMode ${r} but got pad ${a}.`);let u={x:o},d={filterSize:t,strides:n,pad:a,dimRoundingMode:r},h=V.runKernel(pv,u,d);return h=zt(h,s.dtype),l?le(h,[h.shape[1],h.shape[2],h.shape[3]]):h}var Wk=U({avgPool_:h_});function p_(e,t,n,a,r,s="NDHWC"){let i=O(e,"x","avgPool3d","float32"),o=i,l=!1;i.rank===4&&(l=!0,o=le(i,[1,i.shape[0],i.shape[1],i.shape[2],i.shape[3]])),L(o.rank===5,()=>`Error in avgPool3d: x must be rank 5 but got rank ${o.rank}.`),L(s==="NDHWC",()=>`Error in avgPool3d: Only NDHWC is currently supported, but got dataFormat of ${s}`),r!=null&&L(Zn(a),()=>`Error in avgPool3d: pad must be an integer when using, dimRoundingMode ${r} but got pad ${a}.`);let u={x:o},d={filterSize:t,strides:n,pad:a,dimRoundingMode:r,dataFormat:s},h=V.runKernel(cv,u,d);return h=zt(h,o.dtype),l?le(h,[h.shape[1],h.shape[2],h.shape[3],h.shape[4]]):h}var c_=U({avgPool3d_:p_});function f_(e,t=0){L(e.length>=1,()=>"Pass at least one tensor to concat");let n=rd(e,"tensors","concat","string_or_numeric");if(n[0].dtype==="complex64"&&n.forEach(s=>{if(s.dtype!=="complex64")throw new Error(`Cannot concatenate complex64 tensors with a tensor - with dtype ${s.dtype}. `)}),n.length===1)return Yr(n[0]);let a=n,r={axis:t};return V.runKernel(vv,a,r)}var sn=U({concat_:f_});function m_(e){let t={x:O(e,"x","sigmoid")};return V.runKernel(s7,t)}var Sr=U({sigmoid_:m_});function g_(e,t,n){let a=O(e,"x","slice","string_or_numeric");if(a.rank===0)throw new Error("Slicing scalar is not possible");let r={x:a},s={begin:t,size:n};return V.runKernel(t7,r,s)}var Ze=U({slice_:g_});function y_(e){let t={x:O(e,"x","tanh")};return V.runKernel(I7,t)}var Jy=U({tanh_:y_});function A_(e,t,n,a,r,s){let i=O(e,"forgetBias","basicLSTMCell"),o=O(t,"lstmKernel","basicLSTMCell"),l=O(n,"lstmBias","basicLSTMCell"),u=O(a,"data","basicLSTMCell"),d=O(r,"c","basicLSTMCell"),h=O(s,"h","basicLSTMCell"),p=sn([u,h],1),c=yt(p,o),m=De(c,l),f=m.shape[0],g=m.shape[1]/4,y=[f,g],A=Ze(m,[0,0],y),x=Ze(m,[0,g],y),v=Ze(m,[0,g*2],y),b=Ze(m,[0,g*3],y),w=De(fe(Sr(A),Jy(x)),fe(d,Sr(De(i,v)))),I=fe(Jy(w),Sr(b));return[w,I]}var x_=U({basicLSTMCell_:A_});function b_(e,t,n){let a=O(e,"x","batchToSpaceND"),r=t.reduce((o,l)=>o*l);L(a.rank>=1+t.length,()=>`input rank is ${a.rank} but should be > than blockShape.length ${t.length}`),L(n.length===t.length,()=>`crops.length is ${n.length} but should be equal to blockShape.length ${t.length}`),L(a.shape[0]%r==0,()=>`input tensor batch is ${a.shape[0]} but is not divisible by the product of the elements of blockShape ${t.join(" * ")} === ${r}`);let s={x:a},i={blockShape:t,crops:n};return V.runKernel(mv,s,i)}var Bk=U({batchToSpaceND_:b_});function v_(e){let t;return e.rank===0||e.rank===1?t=le(e,[1,1,1,e.size]):e.rank===2?t=le(e,[1,1,e.shape[0],e.shape[1]]):e.rank===3?t=le(e,[1,e.shape[0],e.shape[1],e.shape[2]]):t=e,t}function w_(e,t,n,a,r,s){s==null&&(s=.001);let i=O(e,"x","batchNorm"),o=O(t,"mean","batchNorm"),l=O(n,"variance","batchNorm"),u;r!=null&&(u=O(r,"scale","batchNorm"));let d;a!=null&&(d=O(a,"offset","batchNorm")),L(o.rank===l.rank,()=>"Batch normalization gradient requires mean and variance to have equal ranks."),L(d==null||o.rank===d.rank,()=>"Batch normalization gradient requires mean and offset to have equal ranks."),L(u==null||o.rank===u.rank,()=>"Batch normalization gradient requires mean and scale to have equal ranks.");let h={x:v_(i),scale:u,offset:d,mean:o,variance:l},p={varianceEpsilon:s},c=V.runKernel(Yv,h,p);return le(c,i.shape)}var Ac=U({batchNorm_:w_});function k_(e,t,n,a,r,s){let i=O(e,"x","batchNorm"),o=O(t,"mean","batchNorm"),l=O(n,"variance","batchNorm"),u;r!=null&&(u=O(r,"scale","batchNorm"));let d;return a!=null&&(d=O(a,"offset","batchNorm")),L(i.rank===2,()=>`Error in batchNorm2D: x must be rank 2 but got rank ${i.rank}.`),L(o.rank===2||o.rank===1,()=>`Error in batchNorm2D: mean must be rank 2 or rank 1 but got rank ${o.rank}.`),L(l.rank===2||l.rank===1,()=>`Error in batchNorm2D: variance must be rank 2 or rank 1 but got rank ${l.rank}.`),u!=null&&L(u.rank===2||u.rank===1,()=>`Error in batchNorm2D: scale must be rank 2 or rank 1 but got rank ${u.rank}.`),d!=null&&L(d.rank===2||d.rank===1,()=>`Error in batchNorm2D: offset must be rank 2 or rank 1 but got rank ${d.rank}.`),Ac(i,o,l,d,u,s)}var I_=U({batchNorm2d_:k_});function S_(e,t,n,a,r,s){let i=O(e,"x","batchNorm"),o=O(t,"mean","batchNorm"),l=O(n,"variance","batchNorm"),u;r!=null&&(u=O(r,"scale","batchNorm"));let d;return a!=null&&(d=O(a,"offset","batchNorm")),L(i.rank===3,()=>`Error in batchNorm3D: x must be rank 3 but got rank ${i.rank}.`),L(o.rank===3||o.rank===1,()=>`Error in batchNorm3D: mean must be rank 3 or rank 1 but got rank ${o.rank}.`),L(l.rank===3||l.rank===1,()=>`Error in batchNorm3D: variance must be rank 3 or rank 1 but got rank ${l.rank}.`),u!=null&&L(u.rank===3||u.rank===1,()=>`Error in batchNorm3D: scale must be rank 3 or rank 1 but got rank ${u.rank}.`),d!=null&&L(d.rank===3||d.rank===1,()=>`Error in batchNorm3D: offset must be rank 3 or rank 1 but got rank ${d.rank}.`),Ac(i,o,l,d,u,s)}var N_=U({batchNorm3d_:S_});function T_(e,t,n,a,r,s){let i=O(e,"x","batchNorm"),o=O(t,"mean","batchNorm"),l=O(n,"variance","batchNorm"),u;r!=null&&(u=O(r,"scale","batchNorm"));let d;return a!=null&&(d=O(a,"offset","batchNorm")),L(i.rank===4,()=>`Error in batchNorm4D: x must be rank 4 but got rank ${i.rank}.`),L(o.rank===4||o.rank===1,()=>`Error in batchNorm4D: mean must be rank 4 or rank 1 but got rank ${o.rank}.`),L(l.rank===4||l.rank===1,()=>`Error in batchNorm4D: variance must be rank 4 or rank 1 but got rank ${l.rank}.`),u!=null&&L(u.rank===4||u.rank===1,()=>`Error in batchNorm4D: scale must be rank 4 or rank 1 but got rank ${u.rank}.`),d!=null&&L(d.rank===4||d.rank===1,()=>`Error in batchNorm4D: offset must be rank 4 or rank 1 but got rank ${d.rank}.`),Ac(i,o,l,d,u,s)}var E_=U({batchNorm4d_:T_});function C_(e,t,n){let a=O(e,"x","bincount"),r=O(t,"weights","bincount");L(a.dtype==="int32",()=>`Error in bincount: input dtype must be int32, but got ${a.dtype}`),L(n>=0,()=>`size must be non-negative, but got ${n}.`),L(r.size===a.size||r.size===0,()=>`Error in bincount: weights must have the same size as input or0-length, but got input shape: ${a.shape}, weights shape: ${r.shape}.`);let s={x:a,weights:r},i={size:n};return V.runKernel(gv,s,i)}var Vk=U({bincount_:C_});function M_(e,t){let n=O(e,"broadcastTo","x"),a=n.shape;if(t.some(l=>!(l>0)||l%1!=0))throw new Error(`broadcastTo(): Invalid broadcast shape [${t}].`);if(t.lengthn.rank){let l=n.shape.slice();for(;l.length=0;l--)if(r[l]===t[l])s[l]=1;else if(n.shape[l]!==1)throw new Error(`broadcastTo(): [${a}] cannot be broadcast to [${t}].`);if(s.map((l,u)=>l>1?u:-1).filter(l=>l>=0).length===0)return Yr(n);let i={x:n},o={reps:s};return V.runKernel(uy,i,o)}var xc=U({broadcastTo_:M_});function $_(e){let t={x:O(e,"x","ceil")};return V.runKernel(yv,t)}var R_=U({ceil_:$_});function F_(e,t,n){let a=O(e,"x","clipByValue");L(t<=n,()=>`Error in clip: min (${t}) must be less than or equal to max (${n}).`);let r={x:a},s={clipValueMin:t,clipValueMax:n};return V.runKernel(Av,r,s)}var O_=U({clipByValue_:F_});function D_(e){return sn(e,0)}var __=U({concat1d_:D_});function z_(e,t){return sn(e,t)}var ld=U({concat2d_:z_});function P_(e,t){return sn(e,t)}var L_=U({concat3d_:P_});function W_(e,t){return sn(e,t)}var B_=U({concat4d_:W_});function V_(e,t,n,a,r="NHWC",s=[1,1],i){let o=O(e,"x","conv2d"),l=O(t,"filter","conv2d"),u=o,d=!1;o.rank===3&&(d=!0,u=le(o,[1,o.shape[0],o.shape[1],o.shape[2]])),L(u.rank===4,()=>`Error in conv2d: input must be rank 4, but got rank ${u.rank}.`),L(l.rank===4,()=>`Error in conv2d: filter must be rank 4, but got rank ${l.rank}.`),i!=null&&L(Zn(a),()=>`Error in conv2d: pad must be an integer when using, dimRoundingMode ${i} but got pad ${a}.`);let h=r==="NHWC"?u.shape[3]:u.shape[1];L(h===l.shape[2],()=>`Error in conv2d: depth of input (${h}) must match input depth for filter ${l.shape[2]}.`),L(Jr(n,s),()=>`Error in conv2D: Either strides or dilations must be 1. Got strides ${n} and dilations '${s}'`);let p={x:u,filter:l},c={strides:n,pad:a,dataFormat:r,dilations:s,dimRoundingMode:i},m=V.runKernel(wv,p,c);return d?le(m,[m.shape[1],m.shape[2],m.shape[3]]):m}var bc=U({conv2d_:V_});function U_(e,t,n,a,r="NWC",s=1,i){let o=O(e,"x","conv1d"),l=O(t,"filter","conv1d"),u=o,d=!1;o.rank===2&&(d=!0,u=le(o,[1,o.shape[0],o.shape[1]])),L(u.rank===3,()=>`Error in conv1d: input must be rank 3, but got rank ${u.rank}.`),L(l.rank===3,()=>`Error in conv1d: filter must be rank 3, but got rank ${l.rank}.`),i!=null&&L(Zn(a),()=>`Error in conv1d: pad must be an integer when using, dimRoundingMode ${i} but got pad ${a}.`),L(u.shape[2]===l.shape[1],()=>`Error in conv1d: depth of input (${u.shape[2]}) must match input depth for filter ${l.shape[1]}.`),L(Jr(n,s),()=>`Error in conv1D: Either stride or dilation must be 1. Got stride ${n} and dilation '${s}'`),L(r==="NWC",()=>`Error in conv1d: got dataFormat of ${r} but only NWC is currently supported.`);let h=le(l,[1,l.shape[0],l.shape[1],l.shape[2]]),p=le(u,[u.shape[0],1,u.shape[1],u.shape[2]]),c=bc(p,h,[1,n],a,"NHWC",[1,s],i);return d?le(c,[c.shape[2],c.shape[3]]):le(c,[c.shape[0],c.shape[2],c.shape[3]])}var j_=U({conv1d_:U_});function H_(e,t,n,a,r,s="NHWC",i){L(e.length===t.rank,()=>`Length of inShape (${e.length}) and rank of dy (${t.rank}) must match`);let o=e,l=t,u=!1;t.rank===3&&(u=!0,l=le(t,[1,t.shape[0],t.shape[1],t.shape[2]]),o=[1,e[0],e[1],e[2]]),L(o.length===4,()=>`Error in conv2dDerInput: inShape must be length 4, but got length ${o.length}.`),L(l.rank===4,()=>`Error in conv2dDerInput: dy must be rank 4, but got rank ${l.rank}`),L(n.rank===4,()=>`Error in conv2dDerInput: filter must be rank 4, but got rank ${n.rank}`);let d=s==="NHWC"?o[3]:o[1],h=s==="NHWC"?l.shape[3]:l.shape[1];L(d===n.shape[2],()=>`Error in conv2dDerInput: depth of input (${d}) must match input depth for filter ${n.shape[2]}.`),L(h===n.shape[3],()=>`Error in conv2dDerInput: depth of output (${h}) must match output depth for filter ${n.shape[3]}.`),i!=null&&L(Zn(r),()=>`Error in conv2dDerInput: pad must be an integer when using, dimRoundingMode ${i} but got pad ${r}.`);let p={dy:l,filter:n},c={strides:a,pad:r,dataFormat:s,dimRoundingMode:i,inputShape:o},m=V.runKernel(Iv,p,c);return u?le(m,[m.shape[1],m.shape[2],m.shape[3]]):m}var Uk=U({conv2DBackpropInput_:H_});function G_(e,t,n,a,r,s){let i=O(e,"x","conv2dTranspose"),o=O(t,"filter","conv2dTranspose");return Uk(n,i,o,a,r,"NHWC",s)}var q_=U({conv2dTranspose_:G_});function K_(e,t,n,a,r="NDHWC",s=[1,1,1]){let i=O(e,"x","conv3d"),o=O(t,"filter","conv3d"),l=i,u=!1;i.rank===4&&(u=!0,l=le(i,[1,i.shape[0],i.shape[1],i.shape[2],i.shape[3]])),L(l.rank===5,()=>`Error in conv3d: input must be rank 5, but got rank ${l.rank}.`),L(o.rank===5,()=>`Error in conv3d: filter must be rank 5, but got rank ${o.rank}.`),L(l.shape[4]===o.shape[3],()=>`Error in conv3d: depth of input (${l.shape[4]}) must match input depth for filter ${o.shape[3]}.`),L(Jr(n,s),()=>`Error in conv3D: Either strides or dilations must be 1. Got strides ${n} and dilations '${s}'`),L(r==="NDHWC",()=>`Error in conv3d: got dataFormat of ${r} but only NDHWC is currently supported.`);let d={x:l,filter:o},h={strides:n,pad:a,dataFormat:r,dilations:s},p=V.runKernel(Sv,d,h);return u?le(p,[p.shape[1],p.shape[2],p.shape[3],p.shape[4]]):p}var X_=U({conv3d_:K_});function Z_(e,t,n,a,r){L(e.length===t.rank,()=>`Length of inShape (${e.length}) and rank of dy (${t.rank}) must match`);let s=e,i=t,o=!1;t.rank===4&&(o=!0,i=le(t,[1,t.shape[0],t.shape[1],t.shape[2],t.shape[3]]),s=[1,e[0],e[1],e[2],e[3]]);let l=s[4],u=i.shape[4];L(s.length===5,()=>`Error in conv3dDerInput: inShape must be length 5, but got length ${s.length}.`),L(i.rank===5,()=>`Error in conv3dDerInput: dy must be rank 5, but got rank ${i.rank}`),L(n.rank===5,()=>`Error in conv3dDerInput: filter must be rank 5, but got rank ${n.rank}`),L(l===n.shape[3],()=>`Error in conv3dDerInput: depth of input (${l}) must match input depth for filter ${n.shape[3]}.`),L(u===n.shape[4],()=>`Error in conv3dDerInput: depth of output (${u}) must match output depth for filter ${n.shape[4]}.`);let d={dy:i,filter:n},h={pad:r,strides:a,inputShape:s},p=V.runKernel(Nv,d,h);return o?le(p,[p.shape[1],p.shape[2],p.shape[3],p.shape[4]]):p}var Y_=U({conv3DBackpropInput_:Z_});function J_(e,t,n,a,r){let s=O(e,"x","conv3dTranspose"),i=O(t,"filter","conv3dTranspose");return Y_(n,s,i,a,r)}var Q_=U({conv3dTranspose_:J_});function ez(e){let t={x:O(e,"x","cos")};return V.runKernel(Tv,t)}var tz=U({cos_:ez});function nz(e){let t={x:O(e,"x","cosh")};return V.runKernel(Ev,t)}var az=U({cosh_:nz});function rz(e,t=0,n=!1,a=!1){let r={x:O(e,"x","cumsum")},s={axis:t,exclusive:n,reverse:a};return V.runKernel(Cv,r,s)}var sz=U({cumsum_:rz});function iz(e,t,n,a=!1){let r=O(e,"x","denseBincount"),s=O(t,"weights","denseBincount");L(r.dtype==="int32",()=>`Error in denseBincount: input dtype must be int32, but got ${r.dtype}`),L(r.rank<=2,()=>`Error in denseBincount: input must be at most rank 2, but got rank ${r.rank}.`),L(n>=0,()=>`size must be non-negative, but got ${n}.`),L(s.size===r.size||s.size===0,()=>`Error in denseBincount: weights must have the same shape as x or 0-length, but got x shape: ${r.shape}, weights shape: ${s.shape}.`);let i={x:r,weights:s},o={size:n,binaryOutput:a};return V.runKernel($v,i,o)}var oz=U({denseBincount_:iz});function lz(e,t,n="NHWC"){let a=O(e,"x","depthToSpace"),r=n==="NHWC"?a.shape[1]:a.shape[2],s=n==="NHWC"?a.shape[2]:a.shape[3],i=n==="NHWC"?a.shape[3]:a.shape[1];L(r*t>=0,()=>`Negative dimension size caused by overflow when multiplying - ${r} and ${t} for depthToSpace with input shape - ${a.shape}`),L(s*t>=0,()=>`Negative dimension size caused by overflow when multiplying - ${s} and ${t} for depthToSpace with input shape - ${a.shape}`),L(i%(t*t)==0,()=>`Dimension size must be evenly divisible by ${t*t} but is ${i} for depthToSpace with input shape ${a.shape}`);let o={x:a},l={blockSize:t,dataFormat:n};return V.runKernel(Rv,o,l)}var uz=U({depthToSpace_:lz});function dz(e,t,n,a,r="NHWC",s=[1,1],i){let o=O(e,"x","depthwiseConv2d"),l=O(t,"filter","depthwiseConv2d"),u=o,d=!1;o.rank===3&&(d=!0,u=le(o,[1,o.shape[0],o.shape[1],o.shape[2]])),L(u.rank===4,()=>`Error in depthwiseConv2d: input must be rank 4, but got rank ${u.rank}.`),L(l.rank===4,()=>`Error in depthwiseConv2d: filter must be rank 4, but got rank ${l.rank}.`),L(u.shape[3]===l.shape[2],()=>`Error in depthwiseConv2d: number of input channels (${u.shape[3]}) must match the inChannels dimension in filter ${l.shape[2]}.`),i!=null&&L(Zn(a),()=>`Error in depthwiseConv2d: pad must be an integer when using, dimRoundingMode ${i} but got pad ${a}.`);let h={x:u,filter:l},p={strides:n,pad:a,dataFormat:r,dilations:s,dimRoundingMode:i},c=V.runKernel(Fv,h,p);return d?le(c,[c.shape[1],c.shape[2],c.shape[3]]):c}var Qy=U({depthwiseConv2d_:dz});function hz(e){let t={x:O(e,"x","diag")};return V.runKernel(_v,t)}var pz=U({diag_:hz});function cz(e,t,n,a,r=[1,1],s="NHWC"){let i=O(e,"x","dilation2d"),o=O(t,"filter","dilation2d");L(i.rank===3||i.rank===4,()=>`Error in dilation2d: input must be rank 3 or 4, but got rank ${i.rank}.`),L(o.rank===3,()=>`Error in dilation2d: filter must be rank 3, but got rank ${o.rank}.`),L(s==="NHWC",()=>`Error in dilation2d: Only NHWC is currently supported, but got dataFormat of ${s}`);let l=i,u=!1;i.rank===3&&(l=le(i,[1,i.shape[0],i.shape[1],i.shape[2]]),u=!0);let d={x:l,filter:o},h={strides:n,pad:a,dilations:r},p=V.runKernel(zv,d,h);return u?le(p,[p.shape[1],p.shape[2],p.shape[3]]):p}var fz=U({dilation2d_:cz});function mz(e,t){let n=e.length,a=[];for(let r=0;r1&&i===1&&a.unshift(s)}return a}function jk(e,t){let n=[];for(let a=0;a1)&&n.unshift(s)}return n}function In(e,t){let n=[],a=Math.max(e.length,t.length);for(let r=0;r`Error in dot: inputs must all be rank 1 or 2, but got ranks ${n.rank} and ${a.rank}.`);let r=n.rank===1?n.size:n.shape[1],s=a.rank===1?a.size:a.shape[0];if(L(r===s,()=>`Error in dot: inner dimensions of inputs must match, but got ${r} and ${s}.`),n.rank===1&&a.rank===1){let i=le(n,[1,-1]),o=le(a,[-1,1]),l=yt(i,o);return le(l,[])}else if(n.rank===1&&a.rank===2){let i=le(n,[1,-1]),o=le(a,[a.shape[0],a.shape[1]]),l=yt(i,o);return le(l,[l.size])}else if(n.rank===2&&a.rank===1){let i=le(a,[-1,1]),o=yt(n,i);return le(o,[o.size])}else{let i=le(a,[a.shape[0],a.shape[1]]);return yt(n,i)}}var wz=U({dot_:vz});function kz(e,...t){let n=t.map((r,s)=>O(r,`tensors${s}`,"einsum")),a={equation:e};return V.runKernel(Lv,n,a)}var Iz=U({einsum_:kz});function Sz(e){let t={x:O(e,"x","elu")};return V.runKernel(Wv,t)}var Gk=U({elu_:Sz});function Nz(e){let t=O(e,"x","erf");L(t.dtype==="int32"||t.dtype==="float32",()=>"Input dtype must be `int32` or `float32`."),t.dtype==="int32"&&(t=zt(t,"float32"));let n={x:t};return V.runKernel(Bv,n)}var Tz=U({erf_:Nz});function Ez(e){let t={x:O(e,"x","exp")};return V.runKernel(Uv,t)}var vi=U({exp_:Ez});function Cz(e,t=0){let n=O(e,"x","expandDims","string_or_numeric");L(t<=n.rank,()=>"Axis must be <= rank of the tensor");let a={input:n},r={dim:t};return V.runKernel(jv,a,r)}var Qr=U({expandDims_:Cz});function Mz(e){let t={x:O(e,"x","expm1")};return V.runKernel(Hv,t)}var $z=U({expm1_:Mz});function Rz(e,t){let n=O(e,"x","tile","string_or_numeric");L(n.rank===t.length,()=>`Error in transpose: rank of input ${n.rank} must match length of reps ${t}.`);let a={x:n},r={reps:t};return V.runKernel(uy,a,r)}var vc=U({tile_:Rz});function Fz(e,t,n,a="float32"){t==null&&(t=e);let r=Zr([e,t],a),s=e<=t?e:t;for(let o=0;o`Error in localResponseNormalization: x must be rank 3 or 4 but got - rank ${s.rank}.`),L(Zn(t),()=>`Error in localResponseNormalization: depthRadius must be an integer but got depthRadius ${t}.`);let i=s,o=!1;s.rank===3&&(o=!0,i=le(s,[1,s.shape[0],s.shape[1],s.shape[2]]));let l={x:i},u={depthRadius:t,bias:n,alpha:a,beta:r},d=V.runKernel(gw,l,u);return o?le(d,[d.shape[1],d.shape[2],d.shape[3]]):d}var Yz=U({localResponseNormalization_:Zz});function Jz(e){let t={x:O(e,"x","log")};return V.runKernel(hw,t)}var ud=U({log_:Jz});function Qz(e){let t={x:O(e,"x","log1p")};return V.runKernel(pw,t)}var Jk=U({log1p_:Qz});function eP(e){return L(Ss(e),()=>"The f passed in grad(f) must be a function"),(t,n)=>{let a=O(t,"x","tf.grad","string_or_numeric"),r=n!=null?O(n,"dy","tf.grad"):null;return V.tidy(()=>{let{value:s,grads:i}=V.gradients(()=>e(a),[a],r);return r!=null&&On(s.shape,r.shape,"The shape of dy passed in grad(f)(x, dy) must match the shape returned by f(x)"),Ic(i),i[0]})}}function tP(e){return L(Ss(e),()=>"The f passed in grads(f) must be a function"),(t,n)=>{L(Array.isArray(t),()=>"The args passed in grads(f)(args) must be an array of `Tensor`s or `TensorLike`s");let a=rd(t,"args","tf.grads","string_or_numeric"),r=n!=null?O(n,"dy","tf.grads"):null;return V.tidy(()=>{let{value:s,grads:i}=V.gradients(()=>e(...a),a,r);return r!=null&&On(s.shape,r.shape,"The shape of dy passed in grads(f)([x1,...], dy) must match the shape returned by f([x1,...])"),Ic(i),i})}}function nP(e){return L(Ss(e),()=>"The f passed in valueAndGrad(f) must be a function"),(t,n)=>{L(t instanceof St,()=>"The x passed in valueAndGrad(f)(x) must be a tensor"),L(n==null||n instanceof St,()=>"The dy passed in valueAndGrad(f)(x, dy) must be a tensor");let{grads:a,value:r}=V.gradients(()=>e(t),[t],n);return Ic(a),{grad:a[0],value:r}}}function aP(e){return L(Ss(e),()=>"The f passed in valueAndGrads(f) must be a function"),(t,n)=>{L(Array.isArray(t)&&t.every(r=>r instanceof St),()=>"The args passed in valueAndGrads(f)(args) must be array of tensors"),L(n==null||n instanceof St,()=>"The dy passed in valueAndGrads(f)(args, dy) must be a tensor");let a=V.gradients(()=>e(...t),t,n);return n!=null&&On(a.value.shape,n.shape,"The shape of dy passed in valueAndGrads(f)([x1,...], dy) must match the shape returned by f([x1,...])"),Ic(a.grads),a}}function Qk(e,t){L(Ss(e),()=>"The f passed in variableGrads(f) must be a function"),L(t==null||Array.isArray(t)&&t.every(u=>u instanceof ad),()=>"The varList passed in variableGrads(f, varList) must be an array of variables");let n=t!=null;if(!n){t=[];for(let u in V.registeredVariables)t.push(V.registeredVariables[u])}let a=n?t.filter(u=>!u.trainable):null,r=t.length;t=t.filter(u=>u.trainable),L(t.length>0,()=>`variableGrads() expects at least one of the input variables to be trainable, but none of the ${r} variables is trainable.`);let s=!0,{value:i,grads:o}=V.gradients(e,t,null,s);L(o.some(u=>u!=null),()=>"Cannot find a connection between any variable and the result of the loss function y=f(x). Please make sure the operations that use variables are inside the function f passed to minimize()."),L(i.rank===0,()=>`The f passed in variableGrads(f) must return a scalar, but it returned a rank-${i.rank} tensor`);let l={};return t.forEach((u,d)=>{o[d]!=null&&(l[u.name]=o[d])}),a!=null&&a.forEach(u=>l[u.name]=null),{value:i,grads:l}}function Nr(e){return V.customGrad(e)}function Ic(e){if(e.filter(t=>t==null).length>0)throw new Error(`Cannot compute gradient of y=f(x) with respect to x. Make sure that - the f you passed encloses all operations that lead from x to y.`)}function rP(e){let t={x:O(e,"x","neg")};return V.runKernel(Cw,t)}var Ms=U({neg_:rP});function sP(e){let t={x:O(e,"x","softplus")};return V.runKernel(i7,t)}var e6=U({softplus_:sP});function iP(e){let t=O(e,"x","logSigmoid");return Nr(n=>({value:Ms(e6(Ms(n))),gradFunc:a=>fe(a,Sr(Ms(n)))}))(t)}var oP=U({logSigmoid_:iP});function lP(e,t=null,n=!1){let a={x:O(e,"x","max")},r={reductionIndices:t,keepDims:n};return V.runKernel(yw,a,r)}var $s=U({max_:lP});function uP(e,t){let n=O(e,"a","sub"),a=O(t,"b","sub");[n,a]=Vt(n,a);let r={a:n,b:a};return V.runKernel(w7,r)}var je=U({sub_:uP});function dP(e,t=null,n=!1){let a=O(e,"x","sum");a.dtype==="bool"&&(a=zt(a,"int32"));let r={x:a},s={axis:t,keepDims:n};return V.runKernel(l7,r,s)}var $t=U({sum_:dP});function hP(e,t=-1){let n=O(e,"logits","logSoftmax");if(t===-1&&(t=n.rank-1),t!==n.rank-1)throw Error(`Log Softmax along a non-last dimension is not yet supported. Logits was rank ${n.rank} and axis was ${t}`);return Nr((a,r)=>{let s=!0,i=$s(a,t,!0),o=je(a,i),l=je(zt(o,"float32"),ud($t(vi(o),t,s)));return r([l]),{value:l,gradFunc:(u,d)=>{let[h]=d,p=!0,c=vi(h);return je(u,fe($t(u,t,p),c))}}})(n)}var pP=U({logSoftmax_:hP});function n1(e,t){for(let n=0;ne[s]);return[n,r]}function dd(e,t){let n=t.map(a=>1);return t6(e,n,t)}function fP(e,t,n){L(n1(t,n),()=>`${e} supports only inner-most axes for now. Got axes ${t} and rank-${n} input.`)}function mP(e,t){if(n1(e,t))return null;let n=[];for(let a=0;an.push(a)),n}function gP(e){return e.map((t,n)=>[n,t]).sort((t,n)=>t[1]-n[1]).map(t=>t[0])}function yP(e,t){let n=[];for(let a=t-e;a`Error in maxPool: input must be rank 4 but got rank ${o.rank}.`),L(Jr(n,i),()=>`Error in maxPool: Either strides or dilations must be 1. Got strides ${n} and dilations '${i}'`),r!=null&&L(Zn(a),()=>`Error in maxPool: pad must be an integer when using, dimRoundingMode ${r} but got pad ${a}.`);let u={x:o},d={filterSize:t,strides:n,pad:a,dimRoundingMode:r},h=V.runKernel(xw,u,d);return l?le(h,[h.shape[1],h.shape[2],h.shape[3]]):h}var s6=U({maxPool_:IP});function SP(e,t=[1,1,1],n,a,r,s="NDHWC"){let i=O(e,"x","maxPool3d"),o=i,l=!1;i.rank===4&&(l=!0,o=le(i,[1,i.shape[0],i.shape[1],i.shape[2],i.shape[3]])),L(o.rank===5,()=>`Error in maxPool3d: x must be rank 5 but got rank ${o.rank}.`),L(s==="NDHWC",()=>`Error in maxPool3d: Only NDHWC is currently supported, but got dataFormat of ${s}`),r!=null&&L(Zn(a),()=>`Error in maxPool3d: pad must be an integer when using, dimRoundingMode ${r} but got pad ${a}.`);let u={x:o},d={filterSize:t,strides:n,pad:a,dimRoundingMode:r,dataFormat:s},h=V.runKernel(bw,u,d);return l?le(h,[h.shape[1],h.shape[2],h.shape[3],h.shape[4]]):h}var NP=U({maxPool3d_:SP});function TP(e,t,n,a,r=!1){let s={x:O(e,"x","maxPoolWithArgmax")},i={filterSize:t,strides:n,pad:a,includeBatchInIndex:r},o=V.runKernel(vw,s,i);return{result:o[0],indexes:o[1]}}var EP=U({maxPoolWithArgmax_:TP});function CP(e,t){let n=O(e,"a","maximum"),a=O(t,"b","maximum");[n,a]=Vt(n,a),n.dtype==="bool"&&(n=zt(n,"int32"),a=zt(a,"int32")),In(n.shape,a.shape);let r={a:n,b:a};return V.runKernel(Aw,r)}var i6=U({maximum_:CP});function MP(e,t=null,n=!1){let a={x:O(e,"x","mean")},r={axis:t,keepDims:n};return V.runKernel(ww,a,r)}var Nc=U({mean_:MP});function Go(e,t="float32"){if(t==="complex64"){let a=Go(e,"float32"),r=Go(e,"float32");return mi(a,r)}let n=nc(Jt(e),t);return V.makeTensor(n,e,t)}function wi(e,t="float32"){if(t==="complex64"){let a=wi(e,"float32"),r=Go(e,"float32");return mi(a,r)}let n=ty(Jt(e),t);return V.makeTensor(n,e,t)}function $P(e,t,{indexing:n="xy"}={}){if(n!=="xy"&&n!=="ij")throw new TypeError(`${n} is not a valid third argument to meshgrid`);if(e===void 0)return[];let a=O(e,"x","meshgrid",e instanceof St?e.dtype:"float32");if(t===void 0)return[a];let r=O(t,"y","meshgrid",t instanceof St?t.dtype:"float32"),s=Jt(a.shape),i=Jt(r.shape);return n==="xy"?(a=le(a,[1,-1]),r=le(r,[-1,1]),[yt(wi([i,1],a.dtype),a),yt(r,wi([1,s],r.dtype))]):(a=le(a,[-1,1]),r=le(r,[1,-1]),[yt(a,wi([1,i],a.dtype)),yt(wi([s,1],r.dtype),r)])}function RP(e,t=null,n=!1){let a={x:O(e,"x","min")},r={axis:t,keepDims:n};return V.runKernel(kw,a,r)}var a1=U({min_:RP});function FP(e,t){let n=O(e,"a","minimum"),a=O(t,"b","minimum");[n,a]=Vt(n,a),n.dtype==="bool"&&(n=zt(n,"int32"),a=zt(a,"int32")),In(n.shape,a.shape);let r={a:n,b:a};return V.runKernel(Iw,r)}var o6=U({minimum_:FP});function OP(e,t,n){L(n==="reflect"||n==="symmetric",()=>`Invalid mode. Mode must be either reflect or symmetric. Got ${n}.`);let a=O(e,"x","mirrorPad");if(a.rank===0)throw new Error("mirrorPad(scalar) is not defined. Pass non-scalar to mirrorPad");L(t.length===a.rank,()=>`Padding doesn't match input. Must be ${a.rank}. Got ${t.length}.`);let r=n==="reflect"?1:0;for(let o=0;o"Invalid number of paddings. Must be length of 2 each."),L(t[o][0]>=0&&t[o][0]<=a.shape[o]-r&&t[o][1]>=0&&t[o][1]<=a.shape[o]-r,()=>`Padding in dimension ${o} cannot be greater than or equal to ${a.shape[o]-r} or less than 0 for input of shape ${a.shape}`);let s={paddings:t,mode:n},i={x:a};return V.runKernel(Sw,i,s)}var DP=U({mirrorPad_:OP});function _P(e,t){let n=O(e,"a","mod"),a=O(t,"b","mod");[n,a]=Vt(n,a);let r={a:n,b:a};return V.runKernel(Nw,r)}var zP=U({mod_:_P});function PP(e){let t=O(e,"x","square"),n={};return V.runKernel("Square",{x:t},n)}var tr=U({square_:PP});function LP(e,t=null,n=!1){e=O(e,"x","moments");let a=Xu(t,e.shape),r=Nc(e,a,n),s=r.shape;n||(s=dd(r.shape,a));let i=tr(je(zt(e,"float32"),le(r,s))),o=Nc(i,a,n);return{mean:r,variance:o}}var WP=U({moments_:LP});function BP(e,t,n,a){let r=O(t,"data","multiRNNCell"),s=rd(n,"c","multiRNNCell"),i=rd(a,"h","multiRNNCell"),o=r,l=[];for(let h=0;h2)throw new Error(`Rank of probabilities must be 1 or 2, but is ${i}`);n=n||Math.random();let o={logits:i===1?le(r,[1,-1]):r},l={numSamples:t,seed:n,normalized:a},u=V.runKernel(Tw,o,l);return i===1?le(u,[u.size]):u}var jP=U({multinomial_:UP});function HP(e,t){let n=O(e,"a","notEqual","string_or_numeric"),a=O(t,"b","notEqual","string_or_numeric");[n,a]=Vt(n,a),In(n.shape,a.shape);let r={a:n,b:a};return V.runKernel(Mw,r)}var l6=U({notEqual_:HP});function GP(e){let t={x:O(e,"x","onesLike")};return V.runKernel(Ow,t)}var qP=U({onesLike_:GP});function KP(e,t){let n=O(e,"v1","outerProduct"),a=O(t,"v2","outerProduct");L(n.rank===1&&a.rank===1,()=>`Error in outerProduct: inputs must be rank 1, but got ranks ${n.rank} and ${a.rank}.`);let r=le(n,[-1,1]),s=le(a,[1,-1]);return yt(r,s)}var XP=U({outerProduct_:KP});function ZP(e,t,n=0){let a=O(e,"x","pad");if(a.rank===0)throw new Error("pad(scalar) is not defined. Pass non-scalar to pad");let r={paddings:t,constantValue:n},s={x:a};return V.runKernel(zw,s,r)}var hd=U({pad_:ZP});function YP(e,t,n=0){return L(t.length===2,()=>"Invalid number of paddings. Must be length of 2."),hd(e,[t],n)}var JP=U({pad1d_:YP});function QP(e,t,n=0){return L(t.length===2&&t[0].length===2&&t[1].length===2,()=>"Invalid number of paddings. Must be length of 2 each."),hd(e,t,n)}var eL=U({pad2d_:QP});function tL(e,t,n=0){return L(t.length===3&&t[0].length===2&&t[1].length===2&&t[2].length===2,()=>"Invalid number of paddings. Must be length of 2 each."),hd(e,t,n)}var nL=U({pad3d_:tL});function aL(e,t,n=0){return L(t.length===4&&t[0].length===2&&t[1].length===2&&t[2].length===2&&t[3].length===2,()=>"Invalid number of paddings. Must be length of 2 each."),hd(e,t,n)}var rL=U({pad4d_:aL});function sL(e,t,n){let a=O(e,"x","spaceToBatchND");L(a.rank>=1+t.length,()=>`input rank ${a.rank} should be > than [blockShape] ${t.length}`),L(n.length===t.length,()=>`paddings.shape[0] ${n.length} must be equal to [blockShape] ${t.length}`),L(a.shape.reduce((i,o,l)=>l>0&&l<=t.length?i&&(o+n[l-1][0]+n[l-1][1])%t[l-1]==0:i,!0),()=>`input spatial dimensions ${a.shape.slice(1)} with paddings ${n.toString()} must be divisible by blockShapes ${t.toString()}`);let r={x:a},s={blockShape:t,paddings:n};return V.runKernel(u7,r,s)}var u6=U({spaceToBatchND_:sL});function iL(e,t,n,a,r,s){r==null&&(r=[1,1]),s==null&&(s=1),a===0&&(a="valid");let i=O(e,"x","maxPool"),o=i,l=!1;i.rank===3&&(l=!0,o=le(i,[1,i.shape[0],i.shape[1],i.shape[2]])),L(Jr(s,r),()=>`Error in pool: Either strides or dilations must be 1. Got strides ${s} and dilations '${r}'`);let u=zk(o.shape,t,s,r,a),d=[u.dilationHeight,u.dilationWidth],h;a==="same"?h=lL([u.filterHeight,u.filterWidth],d):h=[[0,0],[0,0]];let p=d[0]===1&&d[1]===1,[c,m]=oL([u.inHeight,u.inWidth],d,h),f=p?a:"valid",g=p?o:u6(o,d,c),y=(n==="avg"?()=>Wk(g,t,s,f):()=>s6(g,t,s,f))(),A=p?y:Bk(y,d,m);return l?le(A,[A.shape[1],A.shape[2],A.shape[3]]):A}function oL(e,t,n){let a=n.map(d=>d[0]),r=n.map(d=>d[1]),s=e.concat(a,r),i=t.map((d,h)=>(d-s[h]%d)%d),o=r.map((d,h)=>d+i[h]),l=t.map((d,h)=>[a[h],o[h]]),u=t.map((d,h)=>[0,i[h]]);return[l,u]}function lL(e,t){let n=e.map((s,i)=>s+(s-1)*(t[i]-1)).map(s=>s-1),a=n.map(s=>Math.floor(s/2)),r=n.map((s,i)=>s-a[i]);return n.map((s,i)=>[a[i],r[i]])}var uL=U({pool_:iL});function dL(e,t){let n=O(e,"base","pow"),a=O(t,"exp","pow");[n,a]=Vt(n,a);let r={a:n,b:a};return V.runKernel(Pw,r)}var pd=U({pow_:dL});function hL(e,t){let n=O(e,"x","prelu"),a=O(t,"alpha","prelu"),r={x:n,alpha:a};return V.runKernel(Lw,r)}var d6=U({prelu_:hL});function pL(e,t=null,n=!1){let a=O(e,"x","prod");a.dtype==="bool"&&(a=zt(a,"int32"));let r={x:a},s={axis:t,keepDims:n};return V.runKernel(Ww,r,s)}var cL=U({prod_:pL});function fL(e,t,n){let a=Jt(e),r=null;if(n==null||n==="float32")r=new Float32Array(a);else if(n==="int32")r=new Int32Array(a);else if(n==="bool")r=new Uint8Array(a);else throw new Error(`Unknown data type ${n}`);for(let s=0;s=1||s===0);let i=Math.sqrt(-2*Math.log(s)/s);e=this.mean+this.stdDev*a*i,t=this.mean+this.stdDev*r*i,(!this.truncated||this.isValidTruncated(e))&&(n=!0)}return(!this.truncated||this.isValidTruncated(t))&&(this.nextVal=this.convertValue(t)),this.convertValue(e)}convertValue(e){return this.dtype==null||this.dtype==="float32"?e:Math.round(e)}isValidTruncated(e){return e<=this.upper&&e>=this.lower}},gL=class{constructor(e,t,n,a){this.alpha=e,this.beta=1/t,this.dtype=n;let r=a||Math.random();this.randu=r1.alea(r.toString()),this.randn=new s1(0,1,n,!1,this.randu()),e<1?this.d=e+2/3:this.d=e-1/3,this.c=1/Math.sqrt(9*this.d)}nextValue(){let e,t,n,a,r,s;for(;;){do a=this.randn.nextValue(),s=1+this.c*a;while(s<=0);if(s*=s*s,e=a*a,t=1-.331*e*e,n=.5*e+this.d*(1-s+Math.log(s)),r=this.randu(),rthis.dtype==null||this.dtype==="float32",this.min=e,this.range=t-e,this.dtype=n,a==null&&(a=Math.random()),typeof a=="number"&&(a=a.toString()),!this.canReturnFloat()&&this.range<=1)throw new Error(`The difference between ${e} - ${t} <= 1 and dtype is not float`);this.random=r1.alea(a)}convertValue(e){return this.canReturnFloat()?e:Math.round(e)}nextValue(){return this.convertValue(this.min+this.range*this.random())}};function AL(e,t,n=1,a="float32",r){if(n==null&&(n=1),a==null&&(a="float32"),a!=="float32"&&a!=="int32")throw new Error(`Unsupported data type ${a}`);let s=new gL(t,n,a,r),i=Zr(e,a);for(let o=0;o`Error in reverse1D: x must be rank 1 but got rank ${t.rank}.`),ki(t,0)}var ML=U({reverse1d_:CL});function $L(e,t){let n=O(e,"x","reverse");return L(n.rank===2,()=>`Error in reverse2D: x must be rank 2 but got rank ${n.rank}.`),ki(n,t)}var RL=U({reverse2d_:$L});function FL(e,t){let n=O(e,"x","reverse");return L(n.rank===3,()=>`Error in reverse3D: x must be rank 3 but got rank ${n.rank}.`),ki(n,t)}var OL=U({reverse3d_:FL});function DL(e,t){let n=O(e,"x","reverse");return L(n.rank===4,()=>`Error in reverse4D: x must be rank 4 but got rank ${n.rank}.`),ki(n,t)}var _L=U({reverse4d_:DL});function zL(e){let t={x:O(e,"x","round")};return V.runKernel(Zw,t)}var c6=U({round_:zL});function PL(e){let t={x:O(e,"x","rsqrt")};return V.runKernel(Yw,t)}var LL=U({rsqrt_:PL});function dt(e,t){if((En(e)&&t!=="string"||Array.isArray(e))&&t!=="complex64")throw new Error("Error creating a new Scalar: value must be a primitive (number|boolean|string)");if(t==="string"&&En(e)&&!(e instanceof Uint8Array))throw new Error("When making a scalar from encoded string, the value must be `Uint8Array`.");return Ts(e,[],[],t)}function WL(e){let t={x:O(e,"x","selu")};return V.runKernel(e7,t)}var BL=U({selu_:WL});function VL(e,t,n,a,r,s=[1,1],i="NHWC"){let o=O(e,"x","separableConv2d"),l=O(t,"depthwiseFilter","separableConv2d"),u=O(n,"pointwiseFilter","separableConv2d"),d=o,h=!1;if(o.rank===3&&(h=!0,d=le(o,[1,o.shape[0],o.shape[1],o.shape[2]])),i==="NCHW")throw new Error("separableConv2d currently does not support dataFormat NCHW; only NHWC is supported");L(d.rank===4,()=>`Error in separableConv2d: input must be rank 4, but got rank ${d.rank}.`),L(l.rank===4,()=>`Error in separableConv2d: depthwise filter must be rank 4, but got rank ${l.rank}.`),L(u.rank===4,()=>`Error in separableConv2d: pointwise filter must be rank 4, but got rank ${l.rank}.`),L(u.shape[0]===1,()=>`Error in separableConv2d: the first dimension of pointwise filter must be 1, but got ${u.shape[0]}.`),L(u.shape[1]===1,()=>`Error in separableConv2d: the second dimension of pointwise filter must be 1, but got ${u.shape[1]}.`);let p=l.shape[2],c=l.shape[3];L(u.shape[2]===p*c,()=>`Error in separableConv2d: the third dimension of pointwise filter must be ${p*c}, but got ${u.shape[2]}.`);let m=Qy(d,l,a,r,i,s),f=bc(m,u,1,"valid",i);return h?le(f,[f.shape[1],f.shape[2],f.shape[3]]):f}var UL=U({separableConv2d_:VL});async function jL(e,t){let n=O(e,"x","setdiff1d"),a=O(t,"y","setdiff1d");L(n.dtype===a.dtype,()=>`x and y should have the same dtype, but got x (${n.dtype}) and y (${a.dtype}).`),L(n.rank===1,()=>`x should be 1D tensor, but got x (${n.shape}).`),L(a.rank===1,()=>`y should be 1D tensor, but got y (${a.shape}).`);let r=await n.data(),s=await a.data(),i=new Set(s),o=0;for(let d=0;d`slice1d expects a rank-1 tensor, but got a rank-${a.rank} tensor`),Ze(a,[t],[n])}var QL=U({slice1d_:JL});function eW(e,t,n){let a=O(e,"x","slice2d");return L(a.rank===2,()=>`slice2d expects a rank-2 tensor, but got a rank-${a.rank} tensor`),Ze(a,t,n)}var tW=U({slice2d_:eW});function nW(e,t,n){let a=O(e,"x","slice3d");return L(a.rank===3,()=>`slice3d expects a rank-3 tensor, but got a rank-${a.rank} tensor`),Ze(a,t,n)}var aW=U({slice3d_:nW});function rW(e,t,n){let a=O(e,"x","slice4d");return L(a.rank===4,()=>`slice4d expects a rank-4 tensor, but got a rank-${a.rank} tensor`),Ze(a,t,n)}var sW=U({slice4d_:rW});function iW(e,t=-1){let n=O(e,"logits","softmax","float32");if(t===-1&&(t=n.rank-1),t!==n.rank-1)throw Error(`Softmax along a non-last dimension is not yet supported. Logits was rank ${n.rank} and dim was ${t}`);let a={logits:n},r={dim:t};return V.runKernel(h7,a,r)}var oW=U({softmax_:iW});function lW(e){L(e.dtype==="complex64",()=>`The dtype for tf.spectral.fft() must be complex64 but got ${e.dtype}.`);let t={input:e};return V.runKernel(Gv,t)}var i1=U({fft_:lW});function uW(e){L(e.dtype==="complex64",()=>`The dtype for tf.spectral.ifft() must be complex64 but got ${e.dtype}.`);let t={input:e};return V.runKernel(nw,t)}var Cc=U({ifft_:uW});function dW(e){let t=e.shape[e.shape.length-1],n=e.size/t,a;if(t<=2){let r=le(e,[n,t]);a=Cc(r)}else{let r=[n,2*(t-1)],s=le(Tc(e),[n,t]),i=le(e1(e),[n,t]),o=ki(Ze(s,[0,1],[n,t-2]),1),l=fe(ki(Ze(i,[0,1],[n,t-2]),1),dt(-1)),u=sn([s,o],1),d=sn([i,l],1),h=le(mi(u,d),[r[0],r[1]]);a=Cc(h)}if(a=Tc(a),e.rank===3&&e.shape[0]!==0){let r=a,s=e.shape[0];a=le(a,[s,a.shape[0]/s,a.shape[1]]),r.dispose()}return a}var f6=U({irfft_:dW});function hW(e,t,n=0){let a={x:O(e,"x","split")},r={numOrSizeSplits:t,axis:n};return V.runKernel(d7,a,r)}var es=U({split_:hW});function pW(e,t){L(e.dtype==="float32",()=>`The dtype for rfft() must be real value but got ${e.dtype}`);let n=e.shape[e.shape.length-1],a=e.size/n,r;if(t!=null&&t0),f=e.shape.map(g=>g);f[e.shape.length-1]=t,r=Ze(e,m,f),n=t}else if(t!=null&&t>n){let m=e.shape.map(f=>f);m[e.shape.length-1]=t-n,r=sn([e,Go(m)],e.shape.length-1),n=t}else r=e;let s=Na(r),i=le(mi(r,s),[a,n]),o=i1(i),l=Math.floor(n/2)+1,u=Tc(o),d=e1(o),h=es(u,[l,n-l],u.shape.length-1),p=es(d,[l,n-l],d.shape.length-1),c=r.shape.slice();return c[r.shape.length-1]=l,le(mi(h[0],p[0]),c)}var o1=U({rfft_:pW});function cW(e){let t={x:O(e,"x","sqrt")};return V.runKernel(o7,t)}var ts=U({sqrt_:cW});function fW(e,t){let n=O(e,"a","squaredDifference"),a=O(t,"b","squaredDifference");[n,a]=Vt(n,a),In(n.shape,a.shape);let r={a:n,b:a},s={};return V.runKernel(y7,r,s)}var m6=U({squaredDifference_:fW});function mW(e,t){let n=O(e,"x","squeeze");return le(n,B3(n.shape,t).newShape)}var Yn=U({squeeze_:mW});function gW(e,t=0){let n=rd(e,"tensors","stack","string_or_numeric");L(n.length>=1,()=>"Pass at least one tensor to tf.stack"),n.length>0&&L(t<=n[0].rank,()=>"Axis must be <= rank of the tensor");let a=n,r={axis:t};return V.runKernel(_w,a,r)}var Ii=U({stack_:gW});function yW(e,t=0){let n={x:O(e,"x","step")},a={alpha:t};return V.runKernel(R7,n,a)}var g6=U({step_:yW});function AW(e,t,n,a,r=0,s=0,i=0,o=0,l=0){let u={x:O(e,"x","stridedSlice","string_or_numeric")},d={begin:t,end:n,strides:a,beginMask:r,endMask:s,ellipsisMask:i,newAxisMask:o,shrinkAxisMask:l};return V.runKernel(A7,u,d)}var xW=U({stridedSlice_:AW});function bW(e){let t={x:O(e,"x","tan")};return V.runKernel(k7,t)}var vW=U({tan_:bW});function oa(e,t){hi(e);let n=Ir(e,t);if(n.length!==1)throw new Error("tensor1d() requires values to be a flat/TypedArray");return Ts(e,null,n,t)}function ns(e,t,n){if(hi(e),t!=null&&t.length!==2)throw new Error("tensor2d() requires shape to have two numbers");let a=Ir(e,n);if(a.length!==2&&a.length!==1)throw new Error("tensor2d() requires values to be number[][] or flat/TypedArray");if(a.length===1&&t==null)throw new Error("tensor2d() requires shape to be provided when `values` are a flat/TypedArray");return Ts(e,t,a,n)}function wW(e,t,n){if(hi(e),t!=null&&t.length!==4)throw new Error("tensor4d() requires shape to have four numbers");let a=Ir(e,n);if(a.length!==4&&a.length!==1)throw new Error("tensor4d() requires values to be number[][][][] or flat/TypedArray");if(a.length===1&&t==null)throw new Error("tensor4d() requires shape to be provided when `values` are a flat array");return Ts(e,t,a,n)}function kW(e,t,n){if(hi(e),t!=null&&t.length!==5)throw new Error("tensor5d() requires shape to have five numbers");let a=Ir(e,n);if(a.length!==5&&a.length!==1)throw new Error("tensor5d() requires values to be number[][][][][] or flat/TypedArray");if(a.length===1&&t==null)throw new Error("tensor5d() requires shape to be provided when `values` are a flat array");return Ts(e,t,a,n)}function IW(e,t,n){if(hi(e),t!=null&&t.length!==6)throw new Error("tensor6d() requires shape to have six numbers");let a=Ir(e,n);if(a.length!==6&&a.length!==1)throw new Error("tensor6d() requires values to be number[][][][][][] or flat/TypedArray");if(a.length===1&&t==null)throw new Error("tensor6d() requires shape to be provided when `values` are a flat array");return t=t||a,Ts(e,t,a,n)}function SW(e,t=1,n=!0){let a=O(e,"x","topk");if(a.rank===0)throw new Error("topk() expects the input to be of rank 1 or higher");let r=a.shape[a.shape.length-1];if(t>r)throw new Error(`'k' passed to topk() must be <= the last dimension (${r}) but got ${t}`);let s={x:a},i={k:t,sorted:n},[o,l]=V.runKernel(S7,s,i);return{values:o,indices:l}}var NW=U({topk_:SW});function TW(e,t=0,n=1,a,r){if(a!=null&&a==="bool")throw new Error("Unsupported data type $ { dtype }");let s=new s1(t,n,a,!0,r),i=Zr(e,a);for(let o=0;o0,()=>"The input tensor must be at least 1D");let a={x:n},r={axis:t},[s,i]=V.runKernel(E7,a,r);return{values:s,indices:i}}var MW=U({unique_:CW});function $W(e,t,n){let a=O(e,"x","unsortedSegmentSum"),r=O(t,"segmentIds","unsortedSegmentSum","int32");L(Zn(n),()=>"numSegments must be of dtype int");let s={x:a,segmentIds:r},i={numSegments:n};return V.runKernel(M7,s,i)}var RW=U({unsortedSegmentSum_:$W});function FW(e,t=0){let n=O(e,"x","unstack","string_or_numeric");L(t>=-n.shape.length&&t`Axis = ${t} is not in [-${n.shape.length}, ${n.shape.length})`);let a={value:n},r={axis:t};return V.runKernel(C7,a,r)}var fd=U({unstack_:FW});function OW(e,t=!0,n,a){return V.makeVariable(e,t,n,a)}function y6(e,t){let n=[];for(let s=0;s0,()=>"mask cannot be scalar"),On(o.slice(s,s+i),r.shape,"mask's shape must match the first K dimensions of tensor's shape,");let l=1;for(let f=s;f"Shape mismatch in v and x");let l=dt(1),u=je(l,o),d=fe(je(i,s),u);if(r){L(a!=null,()=>"When using zeroDebias: true, step is required.");let h=O(a,"step","movingAverage");d=Qe(d,je(l,pd(o,h)))}return De(s,d)}var WW=U({movingAverage_:LW});function BW(e,t,n){let a=O(e,"indices","scatterND","int32"),r=O(t,"updates","scatterND");By(r,a,n);let s={indices:a,updates:r},i={shape:n};return V.runKernel(Jw,s,i)}var VW=U({scatterND_:BW});function UW(e,t,n,a){if(e.dtype!=="int32")throw new Error(`tf.sparseToDense() expects the indices to be int32 type, but the dtype was ${e.dtype}.`);if(e.rank>2)throw new Error(`sparseIndices should be a scalar, vector, or matrix, but got shape ${e.shape}.`);let r=e.rank>0?e.shape[0]:1,s=e.rank>1?e.shape[1]:1;if(n.length!==s)throw new Error(`outputShape has incorrect number of elements:, ${n.length}, should be: ${s}.`);let i=t.size;if(!(t.rank===0||t.rank===1&&i===r))throw new Error(`sparseValues has incorrect shape ${t.shape}, should be [] or [${r}]`);if(t.dtype!==a.dtype)throw new Error("sparseValues.dtype must match defaultValues.dtype")}function jW(e,t,n,a=0){let r=O(e,"sparseIndices","sparseToDense","int32"),s=O(t,"sparseValues","sparseToDense"),i=O(a,"defaultValue","sparseToDense",s.dtype);UW(r,s,n,i);let o={sparseIndices:r,sparseValues:s,defaultValue:i},l={outputShape:n};return V.runKernel(g7,o,l)}var HW=U({sparseToDense_:jW});function GW(e,t){let n=O(t,"indices","gatherND","int32"),a={params:O(e,"x","gatherND","string_or_numeric"),indices:n};return V.runKernel(Qv,a)}var qW=U({gatherND_:GW});function KW(e,t){if(t==null)return e.shape.slice();if(Kr(e.shape,t))return t;if(e.shape.length===t.length){let n=[];for(let a=0;a`x has to be a floating point tensor since it's going to be scaled, but got a ${r.dtype} tensor instead.`),L(t>=0&&t<1,()=>`rate must be a float in the range [0, 1), but got ${t}.`),t===0)return e instanceof St?r.clone():r;let s=KW(r,n),i=1-t,o=Qe(Kk(De(h6(s,0,1,"float32",a),i)),i);return fe(r,o)}var ZW=U({dropout_:XW});function b6(e){return Math.floor(Math.pow(2,Math.ceil(Math.log(e)/Math.log(2))))}function u1(e,t,n){let a=1-e%2,r=new Float32Array(e);for(let s=0;s1,()=>`inTopK() expects the predictions to be of rank 2 or higher, but got ${a.rank}`),L(a.rank-1===r.rank,()=>`predictions rank should be 1 larger than targets rank, but got predictions rank ${a.rank} and targets rank ${r.rank}`),On(a.shape.slice(0,a.shape.length-1),r.shape,"predictions's shape should be align with the targets' shape, except the last dimension.");let s=a.shape[a.shape.length-1];L(n>0&&n<=s,()=>`'k' passed to inTopK() must be > 0 && <= the predictions last dimension (${s}), but got ${n}`);let i=await a.data(),o=await r.data(),[l,u]=[i.length/s,s],d=V3("bool",l);for(let h=0;hg.value-f.value),d[h]=0;for(let f=0;fnB,depthwiseConv2d:()=>lB,matMul:()=>dB});function QW(e,t,n,a,r,s="NHWC",i){let o=e;e.rank===3&&(o=le(e,[1,e.shape[0],e.shape[1],e.shape[2]]));let l=t;l.rank===3&&(l=le(t,[1,t.shape[0],t.shape[1],t.shape[2]])),L(o.rank===4,()=>`Error in conv2dDerFilter: input must be rank 4, but got shape ${o.shape}.`),L(l.rank===4,()=>`Error in conv2dDerFilter: dy must be rank 4, but got shape ${l.shape}.`),L(n.length===4,()=>`Error in conv2dDerFilter: filterShape must be length 4, but got ${n}.`);let u=s==="NHWC"?o.shape[3]:o.shape[1],d=s==="NHWC"?l.shape[3]:l.shape[1];L(u===n[2],()=>`Error in conv2dDerFilter: depth of input ${u}) must match input depth in filter (${n[2]}.`),L(d===n[3],()=>`Error in conv2dDerFilter: depth of dy (${d}) must match output depth for filter (${n[3]}).`),i!=null&&L(Zn(r),()=>`Error in conv2dDerFilter: pad must be an integer when using, dimRoundingMode ${i} but got pad ${r}.`);let h={x:o,dy:l},p={strides:a,pad:r,dataFormat:s,dimRoundingMode:i,filterShape:n};return V.runKernel(kv,h,p)}var eB=U({conv2DBackpropFilter_:QW});function Mc(e,t,n){if(n==null||n==="linear")return e;if(n==="relu")return fe(e,g6(t));throw new Error(`Cannot compute gradient for fused activation ${n}.`)}function $c(e,t){let n=t,a=jk(e.shape,t.shape);return a.length>0&&(n=$t(n,a)),le(n,e.shape)}function Rc(e,t,n,a){if(t==="linear")return e;if(t==="relu")return Ec(e);if(t==="elu")return Gk(e);if(t==="relu6")return p6(e);if(t==="prelu")return d6(e,n);if(t==="leakyrelu")return Yk(e,a);if(t==="sigmoid")return Sr(e);throw new Error(`Unknown fused activation ${t}.`)}var Fc=(e,t)=>!(e>0)||t==="linear";function tB({x:e,filter:t,strides:n,pad:a,dataFormat:r="NHWC",dilations:s=[1,1],dimRoundingMode:i,bias:o,activation:l="linear",preluActivationWeights:u,leakyreluAlpha:d}){if(l=l||"linear",Fc(V.state.gradientDepth,l)===!1){let b=bc(e,t,n,a,r,s,i);return o!=null&&(b=De(b,o)),Rc(b,l,u,d)}let h=O(e,"x","conv2d"),p=O(t,"filter","conv2d"),c=h,m=!1;h.rank===3&&(m=!0,c=le(h,[1,h.shape[0],h.shape[1],h.shape[2]])),L(c.rank===4,()=>`Error in fused conv2d: input must be rank 4, but got rank ${c.rank}.`),L(p.rank===4,()=>`Error in fused conv2d: filter must be rank 4, but got rank ${p.rank}.`),i!=null&&L(Zn(a),()=>`Error in fused conv2d: pad must be an integer when using, dimRoundingMode ${i} but got pad ${a}.`),L(c.shape[3]===p.shape[2],()=>`Error in conv2d: depth of input (${c.shape[3]}) must match input depth for filter ${p.shape[2]}.`),L(Jr(n,s),()=>`Error in conv2D: Either strides or dilations must be 1. Got strides ${n} and dilations '${s}'`),L(r==="NHWC",()=>`Error in conv2d: got dataFormat of ${r} but only NHWC is currently supported.`);let f=id(c.shape,p.shape,n,s,a,i),g;o!=null&&(g=O(o,"bias","fused conv2d"),[g]=Vt(g,h),In(f.outShape,g.shape));let y;u!=null&&(y=O(u,"prelu weights","fused conv2d"));let A=(b,w)=>{let[I,T,C,z]=w,$=Mc(b,C,l);L(od(s),()=>`Error in gradient of fused conv2D: dilation rates greater than 1 are not yet supported in gradients. Got dilations '${s}'`);let S=Uk(T.shape,$,I,n,a),D=eB(T,$,I.shape,n,a),_=[S,D];if(z!=null){let W=$c(z,$);_.push(W)}return _},x={x:c,filter:p,bias:g,preluActivationWeights:y},v={strides:n,pad:a,dataFormat:r,dilations:s,dimRoundingMode:i,activation:l,leakyreluAlpha:d};return o==null?Nr((b,w,I)=>{let T=V.runKernel(py,x,v);return I([w,b,T]),m&&(T=le(T,[T.shape[1],T.shape[2],T.shape[3]])),{value:T,gradFunc:A}})(c,p):Nr((b,w,I,T)=>{let C=V.runKernel(py,x,v);return T([w,b,C,I]),m&&(C=le(C,[C.shape[1],C.shape[2],C.shape[3]])),{value:C,gradFunc:A}})(c,p,g)}var nB=U({fusedConv2d_:tB});function aB(e,t,n,a,r,s=[1,1],i){let o=e;e.rank===3&&(o=le(e,[1,e.shape[0],e.shape[1],e.shape[2]]));let l=t;l.rank===3&&(l=le(t,[1,t.shape[0],t.shape[1],t.shape[2]]));let u={x:o,dy:l},d={strides:a,pad:r,dimRoundingMode:i,dilations:s,filterShape:n};return V.runKernel(Ov,u,d)}var rB=U({depthwiseConv2dNativeBackpropFilter_:aB});function sB(e,t,n,a,r,s=[1,1],i){let o=t,l=!1;t.rank===3&&(l=!0,o=le(t,[1,t.shape[0],t.shape[1],t.shape[2]]));let u={dy:o,filter:n},d={strides:a,pad:r,dimRoundingMode:i,dilations:s,inputShape:e},h=V.runKernel(Dv,u,d);return l?le(h,[h.shape[1],h.shape[2],h.shape[3]]):h}var iB=U({depthwiseConv2dNativeBackpropInput_:sB});function oB({x:e,filter:t,strides:n,pad:a,dataFormat:r="NHWC",dilations:s=[1,1],dimRoundingMode:i,bias:o,activation:l="linear",preluActivationWeights:u,leakyreluAlpha:d}){if(Fc(V.state.gradientDepth,l)===!1){let b=Qy(e,t,n,a,r,s,i);return o!=null&&(b=De(b,o)),Rc(b,l,u,d)}let h=O(e,"x","depthwiseConv2d"),p=O(t,"filter","depthwiseConv2d"),c=h,m=!1;h.rank===3&&(m=!0,c=le(h,[1,h.shape[0],h.shape[1],h.shape[2]])),L(c.rank===4,()=>`Error in fused depthwiseConv2d: input must be rank 4, but got rank ${c.rank}.`),L(p.rank===4,()=>`Error in fused depthwiseConv2d: filter must be rank 4, but got rank ${p.rank}.`),L(c.shape[3]===p.shape[2],()=>`Error in fused depthwiseConv2d: number of input channels (${c.shape[3]}) must match the inChannels dimension in filter ${p.shape[2]}.`),s==null&&(s=[1,1]),L(Jr(n,s),()=>`Error in fused depthwiseConv2d: Either strides or dilations must be 1. Got strides ${n} and dilations '${s}'`),i!=null&&L(Zn(a),()=>`Error in fused depthwiseConv2d: pad must be an integer when using dimRoundingMode ${i} but got pad ${a}.`);let f=id(c.shape,p.shape,n,s,a,i,!0),g;o!=null&&(g=O(o,"bias","fused conv2d"),[g]=Vt(g,h),In(f.outShape,g.shape));let y;u!=null&&(y=O(u,"prelu weights","fused depthwiseConv2d"));let A=(b,w)=>{L(od(s),()=>`Error in gradient of fused depthwiseConv2d: dilation rates greater than 1 are not yet supported. Got dilations '${s}'`);let[I,T,C,z]=w,$=Mc(b,C,l),S=iB(T.shape,$,I,n,a,s,i),D=rB(T,$,I.shape,n,a,s,i);if(z!=null){let _=$c(g,$);return[S,D,_]}return[S,D]},x={x:c,filter:p,bias:g,preluActivationWeights:y},v={strides:n,pad:a,dataFormat:r,dilations:s,dimRoundingMode:i,activation:l,leakyreluAlpha:d};return o==null?Nr((b,w,I)=>{let T=V.runKernel(cy,x,v);return I([w,b,T]),m&&(T=le(T,[T.shape[1],T.shape[2],T.shape[3]])),{value:T,gradFunc:A}})(c,p):Nr((b,w,I,T)=>{let C=V.runKernel(cy,x,v);return T([w,b,C,I]),m&&(C=le(C,[C.shape[1],C.shape[2],C.shape[3]])),{value:C,gradFunc:A}})(c,p,g)}var lB=U({fusedDepthwiseConv2d_:oB});function uB({a:e,b:t,transposeA:n=!1,transposeB:a=!1,bias:r,activation:s="linear",preluActivationWeights:i,leakyreluAlpha:o}){if(Fc(V.state.gradientDepth,s)===!1){let z=yt(e,t,n,a);return r!=null&&(z=De(z,r)),Rc(z,s,i,o)}let l=O(e,"a","fused matMul"),u=O(t,"b","fused matMul");[l,u]=Vt(l,u);let d=n?l.shape[l.rank-2]:l.shape[l.rank-1],h=a?u.shape[u.rank-1]:u.shape[u.rank-2],p=n?l.shape[l.rank-1]:l.shape[l.rank-2],c=a?u.shape[u.rank-2]:u.shape[u.rank-1],m=l.shape.slice(0,-2),f=u.shape.slice(0,-2),g=Jt(m),y=Jt(f);L(l.rank>=2&&u.rank>=2&&l.rank===u.rank,()=>`Error in fused matMul: inputs must have the same rank of at least 2, got ranks ${l.rank} and ${u.rank}.`),L(Kr(m,f),()=>`Error in fused matMul: outer dimensions (${m}) and (${f}) of Tensors with shapes ${l.shape} and ${u.shape} must match.`),L(d===h,()=>`Error in fused matMul: inner shapes (${d}) and (${h}) of Tensors with shapes ${l.shape} and ${u.shape} and transposeA=${n} and transposeB=${a} must match.`);let A=l.shape.slice(0,-2).concat([p,c]),x=n?le(l,[g,d,p]):le(l,[g,p,d]),v=a?le(u,[y,c,h]):le(u,[y,h,c]),b;r!=null&&(b=O(r,"bias","fused matMul"),[b]=Vt(b,l),In(A,b.shape));let w;i!=null&&(w=O(i,"prelu weights","fused matMul"));let I=(z,$)=>{let[S,D,_,W]=$,X=Mc(le(z,_.shape),_,s),q,Q;if(!n&&!a?(q=yt(X,D,!1,!0),Q=yt(S,X,!0,!1)):!n&&a?(q=yt(X,D,!1,!1),Q=yt(X,S,!0,!1)):n&&!a?(q=yt(D,X,!1,!0),Q=yt(S,X,!1,!1)):(q=yt(D,X,!0,!0),Q=yt(X,S,!0,!0)),r!=null){let ee=$c(W,X);return[q,Q,ee]}else return[q,Q]},T={a:x,b:v,bias:b,preluActivationWeights:w},C={transposeA:n,transposeB:a,activation:s,leakyreluAlpha:o};return r==null?Nr((z,$,S)=>{let D=V.runKernel(hy,T,C);return S([z,$,D]),{value:le(D,A),gradFunc:I}})(x,v):Nr((z,$,S,D)=>{let _=V.runKernel(hy,T,C);return D([z,$,_,S]),{value:le(_,A),gradFunc:I}})(x,v,b)}var dB=U({fusedMatMul_:uB});function hB(e){return u1(e,.54,.46)}var pB=U({hammingWindow_:hB});function cB(e){return u1(e,.5,.5)}var w6=U({hannWindow_:cB});function fB(e,t,n,a=!1,r=0){let s=0,i=[];for(;s+t<=e.size;)i.push(Ze(e,s,t)),s+=n;if(a)for(;s`Error in cropAndResize: image must be rank 4,but got rank ${i.rank}.`),L(o.rank===2&&o.shape[1]===4,()=>`Error in cropAndResize: boxes must be have size [${u},4] but had shape ${o.shape}.`),L(l.rank===1&&l.shape[0]===u,()=>`Error in cropAndResize: boxInd must be have size [${u}] but had shape ${o.shape}.`),L(a.length===2,()=>`Error in cropAndResize: cropSize must be of length 2, but got length ${a.length}.`),L(a[0]>=1&&a[1]>=1,()=>`cropSize must be atleast [1,1], but was ${a}`),L(r==="bilinear"||r==="nearest",()=>`method must be bilinear or nearest, but was ${r}`);let d={image:i,boxes:o,boxInd:l},h={method:r,extrapolationValue:s,cropSize:a};return V.runKernel(Mv,d,h)}var AB=U({cropAndResize_:yB});function xB(e){let t=O(e,"image","flipLeftRight","float32");L(t.rank===4,()=>`Error in flipLeftRight: image must be rank 4,but got rank ${t.rank}.`);let n={image:t};return V.runKernel(Kv,n,{})}var bB=U({flipLeftRight_:xB});function vB(e,t,n=0,a=.5){let r=O(e,"image","rotateWithOffset","float32");L(r.rank===4,()=>`Error in rotateWithOffset: image must be rank 4,but got rank ${r.rank}.`);let s={image:r},i={radians:t,fillValue:n,center:a};return V.runKernel(F7,s,i)}var wB=U({rotateWithOffset_:vB});function qo(e,t,n,a,r,s){a==null&&(a=.5),r==null&&(r=Number.NEGATIVE_INFINITY),s==null&&(s=0);let i=e.shape[0];return n=Math.min(n,i),L(0<=a&&a<=1,()=>`iouThreshold must be in [0, 1], but was '${a}'`),L(e.rank===2,()=>`boxes must be a 2D tensor, but was of rank '${e.rank}'`),L(e.shape[1]===4,()=>`boxes must have 4 columns, but 2nd dimension was ${e.shape[1]}`),L(t.rank===1,()=>"scores must be a 1D tensor"),L(t.shape[0]===i,()=>`scores has incompatible shape with boxes. Expected ${i}, but was ${t.shape[0]}`),L(0<=s&&s<=1,()=>`softNmsSigma must be in [0, 1], but was '${s}'`),{maxOutputSize:n,iouThreshold:a,scoreThreshold:r,softNmsSigma:s}}function kB(e,t,n,a=.5,r=Number.NEGATIVE_INFINITY){let s=O(e,"boxes","nonMaxSuppression"),i=O(t,"scores","nonMaxSuppression"),o=qo(s,i,n,a,r);n=o.maxOutputSize,a=o.iouThreshold,r=o.scoreThreshold;let l={maxOutputSize:n,iouThreshold:a,scoreThreshold:r};return V.runKernel($w,{boxes:s,scores:i},l)}var IB=U({nonMaxSuppression_:kB});function SB(e,t,n){let a=NB(e,t,n),r=a<0?-(a+1):a;e.splice(r,0,t)}function NB(e,t,n){return EB(e,t,n||TB)}function TB(e,t){return e>t?1:e>>1);let o=n(t,e[s]);o>0?a=s+1:(r=s,i=!o)}return i?a:-a-1}function I6(e,t,n,a,r){return d1(e,t,n,a,r,0)}function S6(e,t,n,a,r,s){return d1(e,t,n,a,r,0,!1,s,!0)}function N6(e,t,n,a,r,s){return d1(e,t,n,a,r,s,!0)}function d1(e,t,n,a,r,s,i=!1,o=!1,l=!1){let u=[];for(let g=0;gr&&u.push({score:t[g],boxIndex:g,suppressBeginIndex:0});u.sort(T6);let d=s>0?-.5/s:0,h=[],p=[];for(;h.length0;){let g=u.pop(),{score:y,boxIndex:A,suppressBeginIndex:x}=g;if(y=x;--b){let w=CB(e,A,h[b]);if(w>=a){v=!0;break}if(g.score=g.score*MB(a,d,w),g.score<=r)break}g.suppressBeginIndex=h.length,v||(g.score===y?(h.push(A),p.push(g.score)):g.score>r&&SB(u,g,T6))}let c=h.length,m=n-c;o&&m>0&&(h.push(...new Array(m).fill(0)),p.push(...new Array(m).fill(0)));let f={selectedIndices:h};return i&&(f.selectedScores=p),l&&(f.validOutputs=c),f}function CB(e,t,n){let a=e.subarray(t*4,t*4+4),r=e.subarray(n*4,n*4+4),s=Math.min(a[0],a[2]),i=Math.min(a[1],a[3]),o=Math.max(a[0],a[2]),l=Math.max(a[1],a[3]),u=Math.min(r[0],r[2]),d=Math.min(r[1],r[3]),h=Math.max(r[0],r[2]),p=Math.max(r[1],r[3]),c=(o-s)*(l-i),m=(h-u)*(p-d);if(c<=0||m<=0)return 0;let f=Math.max(s,u),g=Math.max(i,d),y=Math.min(o,h),A=Math.min(l,p),x=Math.max(y-f,0)*Math.max(A-g,0);return x/(c+m-x)}function MB(e,t,n){let a=Math.exp(t*n*n);return n<=e?a:0}function T6(e,t){return e.score-t.score||e.score===t.score&&t.boxIndex-e.boxIndex}async function $B(e,t,n,a=.5,r=Number.NEGATIVE_INFINITY){let s=O(e,"boxes","nonMaxSuppressionAsync"),i=O(t,"scores","nonMaxSuppressionAsync"),o=qo(s,i,n,a,r);n=o.maxOutputSize,a=o.iouThreshold,r=o.scoreThreshold;let l=await Promise.all([s.data(),i.data()]),u=l[0],d=l[1],{selectedIndices:h}=I6(u,d,n,a,r);return s!==e&&s.dispose(),i!==t&&i.dispose(),oa(h,"int32")}var RB=$B;function FB(e,t,n,a=.5,r=Number.NEGATIVE_INFINITY,s=0){let i=O(e,"boxes","nonMaxSuppression"),o=O(t,"scores","nonMaxSuppression"),l=qo(i,o,n,a,r,s);n=l.maxOutputSize,a=l.iouThreshold,r=l.scoreThreshold,s=l.softNmsSigma;let u={boxes:i,scores:o},d={maxOutputSize:n,iouThreshold:a,scoreThreshold:r,softNmsSigma:s},h=V.runKernel(Fw,u,d);return{selectedIndices:h[0],selectedScores:h[1]}}var OB=U({nonMaxSuppressionWithScore_:FB});async function DB(e,t,n,a=.5,r=Number.NEGATIVE_INFINITY,s=0){let i=O(e,"boxes","nonMaxSuppressionAsync"),o=O(t,"scores","nonMaxSuppressionAsync"),l=qo(i,o,n,a,r,s);n=l.maxOutputSize,a=l.iouThreshold,r=l.scoreThreshold,s=l.softNmsSigma;let u=await Promise.all([i.data(),o.data()]),d=u[0],h=u[1],{selectedIndices:p,selectedScores:c}=N6(d,h,n,a,r,s);return i!==e&&i.dispose(),o!==t&&o.dispose(),{selectedIndices:oa(p,"int32"),selectedScores:oa(c)}}var _B=DB;function zB(e,t,n,a=.5,r=Number.NEGATIVE_INFINITY,s=!1){let i=O(e,"boxes","nonMaxSuppression"),o=O(t,"scores","nonMaxSuppression"),l=qo(i,o,n,a,r,null),u=l.maxOutputSize,d=l.iouThreshold,h=l.scoreThreshold,p={boxes:i,scores:o},c={maxOutputSize:u,iouThreshold:d,scoreThreshold:h,padToMaxOutputSize:s},m=V.runKernel(Rw,p,c);return{selectedIndices:m[0],validOutputs:m[1]}}var PB=U({nonMaxSuppressionPadded_:zB});async function LB(e,t,n,a=.5,r=Number.NEGATIVE_INFINITY,s=!1){let i=O(e,"boxes","nonMaxSuppressionAsync"),o=O(t,"scores","nonMaxSuppressionAsync"),l=qo(i,o,n,a,r,null),u=l.maxOutputSize,d=l.iouThreshold,h=l.scoreThreshold,[p,c]=await Promise.all([i.data(),o.data()]),{selectedIndices:m,validOutputs:f}=S6(p,c,u,d,h,s);return i!==e&&i.dispose(),o!==t&&o.dispose(),{selectedIndices:oa(m,"int32"),validOutputs:dt(f,"int32")}}var WB=LB;function BB(e,t,n=!1,a=!1){let r=O(e,"images","resizeBilinear");L(r.rank===3||r.rank===4,()=>`Error in resizeBilinear: x must be rank 3 or 4, but got rank ${r.rank}.`),L(t.length===2,()=>`Error in resizeBilinear: new shape must 2D, but got shape ${t}.`),L(a===!1||n===!1,()=>"Error in resizeBilinear: If halfPixelCenters is true, alignCorners must be false.");let s=r,i=!1;r.rank===3&&(i=!0,s=le(r,[1,r.shape[0],r.shape[1],r.shape[2]]));let[]=t,o={images:s},l={alignCorners:n,halfPixelCenters:a,size:t},u=V.runKernel(qw,o,l);return i?le(u,[u.shape[1],u.shape[2],u.shape[3]]):u}var VB=U({resizeBilinear_:BB});function UB(e,t,n=!1,a=!1){let r=O(e,"images","resizeNearestNeighbor");L(r.rank===3||r.rank===4,()=>`Error in resizeNearestNeighbor: x must be rank 3 or 4, but got rank ${r.rank}.`),L(t.length===2,()=>`Error in resizeNearestNeighbor: new shape must 2D, but got shape ${t}.`),L(r.dtype==="float32"||r.dtype==="int32",()=>"`images` must have `int32` or `float32` as dtype"),L(a===!1||n===!1,()=>"Error in resizeNearestNeighbor: If halfPixelCenters is true, alignCorners must be false.");let s=r,i=!1;r.rank===3&&(i=!0,s=le(r,[1,r.shape[0],r.shape[1],r.shape[2]]));let[]=t,o={images:s},l={alignCorners:n,halfPixelCenters:a,size:t},u=V.runKernel(Gw,o,l);return i?le(u,[u.shape[1],u.shape[2],u.shape[3]]):u}var jB=U({resizeNearestNeighbor_:UB});function HB(e,t="binary",n=!1,a=.5){let r=O(e,"image","threshold"),s=.2989,i=.587,o=.114,l=r.shape[0]*r.shape[1],u=fe(oa([a]),255),d,h,p,c;if(L(r.rank===3,()=>`Error in threshold: image must be rank 3,but got rank ${r.rank}.`),L(r.shape[2]===3||r.shape[2]===1,()=>`Error in threshold: image color channel must be equal to 3 or 1but got ${r.shape[2]}.`),L(r.dtype==="int32"||r.dtype==="float32",()=>`Error in dtype: image dtype must be int32 or float32,but got dtype ${r.dtype}.`),L(t==="otsu"||t==="binary",()=>`Method must be binary or otsu, but was ${t}`),r.shape[2]===3){[d,h,p]=es(r,[1,1,1],-1);let f=fe(d,s),g=fe(h,i),y=fe(p,o);c=De(De(f,g),y)}else c=e;if(t==="otsu"){let f=Vk(zt(c6(c),"int32"),er([]),256);u=GB(f,l)}let m=n?t1(c,u):kc(c,u);return zt(fe(m,255),"int32")}function GB(e,t){let n=oa([-1]),a=oa([0]),r=oa([0]),s,i,o,l,u,d;for(let h=0;h`Error in transform: image must be rank 4,but got rank ${i.rank}.`),L(o.rank===2&&(o.shape[0]===i.shape[0]||o.shape[0]===1)&&o.shape[1]===8,()=>"Error in transform: Input transform should be batch x 8 or 1 x 8"),L(s==null||s.length===2,()=>`Error in transform: outputShape must be [height, width] or null, but got ${s}.`);let l={image:i,transforms:o},u={interpolation:n,fillMode:a,fillValue:r,outputShape:s};return V.runKernel(N7,l,u)}var XB=U({transform_:KB});function ZB(e,t,n){L(t%1==0,()=>`bandPart(): numLower must be an integer, got ${t}.`),L(n%1==0,()=>`bandPart(): numUpper must be an integer, got ${n}.`);let a=O(e,"a","bandPart");L(a.rank>=2,()=>`bandPart(): Rank must be at least 2, got ${a.rank}.`);let r=a.shape,[s,i]=a.shape.slice(-2);if(!(t<=s))throw new Error(`bandPart(): numLower (${t}) must not be greater than the number of rows (${s}).`);if(!(n<=i))throw new Error(`bandPart(): numUpper (${n}) must not be greater than the number of columns (${i}).`);t<0&&(t=s),n<0&&(n=i);let o=le(cd(0,s,1,"int32"),[-1,1]),l=cd(0,i,1,"int32"),u=je(o,l),d=Sc(t1(u,dt(+t,"int32")),Zk(u,dt(-n,"int32"))),h=Go([s,i],a.dtype);return le(Ii(fd(le(a,[-1,s,i])).map(p=>Ho(d,p,h))),r)}var YB=U({bandPart_:ZB});function JB(e){let t;if(Array.isArray(e)){t=!1,L(e!=null&&e.length>0,()=>"Gram-Schmidt process: input must not be null, undefined, or empty");let r=e[0].shape[0];for(let s=1;s`Gram-Schmidt: Non-unique lengths found in the input vectors: (${e[s].shape[0]} vs. ${r})`)}else t=!0,e=es(e,e.shape[0],0).map(r=>Yn(r,[0]));L(e.length<=e[0].shape[0],()=>`Gram-Schmidt: Number of vectors (${e.length}) exceeds number of dimensions (${e[0].shape[0]}).`);let n=[],a=e;for(let r=0;r{let s=a[r];if(r>0)for(let i=0;i=2,()=>`qr() requires input tensor to have a rank >= 2, but got rank ${e.rank}`),e.rank===2)return E6(e,t);{let n=e.shape.slice(0,e.shape.length-2).reduce((l,u)=>l*u),a=fd(le(e,[n,e.shape[e.shape.length-2],e.shape[e.shape.length-1]]),0),r=[],s=[];a.forEach(l=>{let[u,d]=E6(l,t);r.push(u),s.push(d)});let i=le(Ii(r,0),e.shape),o=le(Ii(s,0),e.shape);return[i,o]}}function E6(e,t=!1){return V.tidy(()=>{L(e.shape.length===2,()=>`qr2d() requires a 2D Tensor, but got a ${e.shape.length}D Tensor.`);let n=e.shape[0],a=e.shape[1],r=qk(n),s=Yr(e),i=ns([[1]],[1,1]),o=Yr(i),l=n>=a?a:n;for(let u=0;u{let c=Ze(s,[u,u],[n-u,1]),m=l1(c),f=Ze(s,[u,u],[1,1]),g=Ho(kc(f,0),ns([[-1]]),ns([[1]])),y=je(f,fe(g,m)),A=Qe(c,y);A.shape[0]===1?o=Yr(i):o=sn([i,Ze(A,[1,0],[A.shape[0]-1,A.shape[1]])],0);let x=Ms(Qe(yt(g,y),m)),v=Ze(s,[u,0],[n-u,a]),b=fe(x,o),w=fc(o);if(u===0)s=je(v,yt(b,yt(w,v)));else{let C=je(v,yt(b,yt(w,v)));s=sn([Ze(s,[0,0],[u,a]),C],0)}let I=fc(b),T=Ze(r,[0,u],[n,r.shape[1]-u]);if(u===0)r=je(T,yt(yt(T,o),I));else{let C=je(T,yt(yt(T,o),I));r=sn([Ze(r,[0,0],[n,u]),C],1)}return[o,s,r]}),Ve([d,h,p])}return!t&&n>a&&(r=Ze(r,[0,0],[n,a]),s=Ze(s,[0,0],[a,a])),[r,s]})}var tV=U({qr_:eV}),_n;(function(e){e[e.NONE=0]="NONE",e[e.MEAN=1]="MEAN",e[e.SUM=2]="SUM",e[e.SUM_BY_NONZERO_WEIGHTS=3]="SUM_BY_NONZERO_WEIGHTS"})(_n||(_n={}));function nV(e,t,n=_n.SUM_BY_NONZERO_WEIGHTS){let a=O(e,"losses","computeWeightedLoss"),r=null;t!=null&&(r=O(t,"weights","computeWeightedLoss"));let s=r==null?a:fe(a,r);if(n===_n.NONE)return s;if(n===_n.SUM)return $t(s);if(n===_n.MEAN){if(r==null)return Nc(s);{let i=a.size/r.size,o=Qe($t(s),$t(r));return i>1?Qe(o,dt(i)):o}}if(n===_n.SUM_BY_NONZERO_WEIGHTS){if(r==null)return Qe($t(s),dt(a.size));{let i=fe(r,wi(a.shape)),o=zt($t(l6(i,dt(0))),"float32");return Qe($t(s),o)}}throw Error(`Unknown reduction: ${n}`)}var as=U({computeWeightedLoss_:nV});function aV(e,t,n,a=_n.SUM_BY_NONZERO_WEIGHTS){let r=O(e,"labels","absoluteDifference"),s=O(t,"predictions","absoluteDifference"),i=null;n!=null&&(i=O(n,"weights","absoluteDifference")),On(r.shape,s.shape,"Error in absoluteDifference: ");let o=Sa(je(r,s));return as(o,i,a)}var rV=U({absoluteDifference_:aV});function sV(e,t,n,a,r=_n.SUM_BY_NONZERO_WEIGHTS){let s=O(e,"labels","cosineDistance"),i=O(t,"predictions","cosineDistance"),o=null;a!=null&&(o=O(a,"weights","cosineDistance")),On(s.shape,i.shape,"Error in cosineDistance: ");let l=dt(1),u=je(l,$t(fe(s,i),n,!0));return as(u,o,r)}var iV=U({cosineDistance_:sV});function oV(e,t,n,a=_n.SUM_BY_NONZERO_WEIGHTS){let r=O(e,"labels","hingeLoss"),s=O(t,"predictions","hingeLoss"),i=null;n!=null&&(i=O(n,"weights","hingeLoss")),On(r.shape,s.shape,"Error in hingeLoss: ");let o=dt(1);r=je(fe(dt(2),r),o);let l=Ec(je(o,fe(r,s)));return as(l,i,a)}var lV=U({hingeLoss_:oV});function uV(e,t,n,a=1,r=_n.SUM_BY_NONZERO_WEIGHTS){let s=O(e,"labels","huberLoss"),i=O(t,"predictions","huberLoss"),o=null;n!=null&&(o=O(n,"weights","huberLoss")),On(s.shape,i.shape,"Error in huberLoss: ");let l=dt(a),u=Sa(je(i,s)),d=o6(u,l),h=je(u,d),p=De(fe(dt(.5),tr(d)),fe(l,h));return as(p,o,r)}var dV=U({huberLoss_:uV});function hV(e,t,n,a=1e-7,r=_n.SUM_BY_NONZERO_WEIGHTS){let s=O(e,"labels","logLoss"),i=O(t,"predictions","logLoss"),o=null;n!=null&&(o=O(n,"weights","logLoss")),On(s.shape,i.shape,"Error in logLoss: ");let l=dt(1),u=dt(a),d=Ms(fe(s,ud(De(i,u)))),h=fe(je(l,s),ud(De(je(l,i),u))),p=je(d,h);return as(p,o,r)}var pV=U({logLoss_:hV});function cV(e,t,n,a=_n.SUM_BY_NONZERO_WEIGHTS){let r=O(e,"labels","meanSquaredError"),s=O(t,"predictions","meanSquaredError"),i=null;n!=null&&(i=O(n,"weights","meanSquaredError")),On(r.shape,s.shape,"Error in meanSquaredError: ");let o=m6(r,s);return as(o,i,a)}var fV=U({meanSquaredError_:cV});function mV(e,t){let n=O(e,"labels","sigmoidCrossEntropyWithLogits"),a=O(t,"logits","sigmoidCrossEntropyWithLogits");On(n.shape,a.shape,"Error in sigmoidCrossEntropyWithLogits: ");let r=Ec(a),s=fe(a,n),i=Jk(vi(Ms(Sa(a))));return De(je(r,s),i)}function gV(e,t,n,a=0,r=_n.SUM_BY_NONZERO_WEIGHTS){let s=O(e,"multiClassLabels","sigmoidCrossEntropy"),i=O(t,"logits","sigmoidCrossEntropy"),o=null;if(n!=null&&(o=O(n,"weights","sigmoidCrossEntropy")),On(s.shape,i.shape,"Error in sigmoidCrossEntropy: "),a>0){let u=dt(a),d=dt(1),h=dt(.5);s=De(fe(s,je(d,u)),fe(h,u))}let l=mV(s,i);return as(l,o,r)}var yV=U({sigmoidCrossEntropy_:gV});function AV(e,t,n=-1){if(n===-1&&(n=t.rank-1),n!==t.rank-1)throw Error(`Softmax cross entropy along a non-last dimension is not yet supported. Labels / logits was rank ${t.rank} and dim was ${n}`);return Nr((a,r,s)=>{let i=n6(r,[n],!0),o=je(zt(r,"float32"),i);s([a,o]);let l=Ms(fe(o,a));return{value:$t(l,[n]),gradFunc:(u,d)=>{let[h,p]=d,c=dd(u.shape,[n]);return[fe(le(u,c),je(zt(h,"float32"),vi(p))),fe(le(u,c),je(vi(p),zt(h,"float32")))]}}})(e,t)}function xV(e,t,n,a=0,r=_n.SUM_BY_NONZERO_WEIGHTS){let s=O(e,"onehotLabels","softmaxCrossEntropy"),i=O(t,"logits","softmaxCrossEntropy"),o=null;if(n!=null&&(o=O(n,"weights","softmaxCrossEntropy")),On(s.shape,i.shape,"Error in softmaxCrossEntropy: "),a>0){let u=dt(a),d=dt(1),h=dt(s.shape[1]);s=De(fe(s,je(d,u)),Qe(u,h))}let l=AV(s,i);return as(l,o,r)}var bV=U({softmaxCrossEntropy_:xV});function vV(e,t,n,a){let r=O(e,"indices","sparseFillEmptyRows"),s=O(t,"values","sparseFillEmptyRows"),i=O(n,"denseShape","sparseFillEmptyRows"),o=O(a,"defaultValue","sparseFillEmptyRows",s.dtype);if(r.rank!==2)throw new Error(`Indices should be Tensor2D but received shape - ${r.shape}`);if(s.rank!==1)throw new Error(`Values should be Tensor1D but received shape ${s.shape}`);if(i.rank!==1)throw new Error(`Dense shape should be Tensor1D but received shape ${i.shape}`);if(o.rank!==0)throw new Error(`Default value should be a scalar but received shape ${o.shape}`);let l={indices:r,values:s,denseShape:i,defaultValue:o},u=V.runKernel(p7,l);return{outputIndices:u[0],outputValues:u[1],emptyRowIndicator:u[2],reverseIndexMap:u[3]}}var wV=U({sparseFillEmptyRows_:vV});function kV(e,t,n){let a=O(e,"inputIndices","sparseReshape"),r=O(t,"inputShape","sparseReshape"),s=O(n,"newShape","sparseReshape");if(a.rank!==2)throw new Error(`Input indices should be Tensor2D but received shape - ${a.shape}`);if(r.rank!==1)throw new Error(`Input shape should be Tensor1D but received shape ${r.shape}`);if(s.rank!==1)throw new Error(`New shape should be Tensor1D but received shape ${s.shape}`);let i={inputIndices:a,inputShape:r,newShape:s},o=V.runKernel(c7,i);return{outputIndices:o[0],outputShape:o[1]}}var IV=U({sparseReshape_:kV});function SV(e,t,n){let a=O(e,"data","sparseSegmentMean"),r=O(t,"indices","sparseSegmentMean"),s=O(n,"segmentIds","sparseSegmentMean");if(a.rank<1)throw new Error("Data should be at least 1 dimensional but received scalar");if(r.rank!==1)throw new Error(`Indices should be Tensor1D but received shape - ${r.shape}`);if(s.rank!==1)throw new Error(`Segment ids should be Tensor1D but received shape - ${s.shape}`);let i={data:a,indices:r,segmentIds:s};return V.runKernel(f7,i)}var NV=U({sparseSegmentMean_:SV});function TV(e,t,n){let a=O(e,"data","sparseSegmentSum"),r=O(t,"indices","sparseSegmentSum"),s=O(n,"segmentIds","sparseSegmentSum");if(a.rank<1)throw new Error("Data should be at least 1 dimensional but received scalar");if(r.rank!==1)throw new Error(`Indices should be Tensor1D but received shape - ${r.shape}`);if(s.rank!==1)throw new Error(`Segment ids should be Tensor1D but received shape - ${s.shape}`);let i={data:a,indices:r,segmentIds:s};return V.runKernel(m7,i)}var EV=U({sparseSegmentSum_:TV});function CV(e,t,n,a,r,s,i,o){let l=O(e,"data","stringNGrams","string");if(l.dtype!=="string")throw new Error("Data must be of datatype string");if(l.shape.length!==1)throw new Error(`Data must be a vector, saw: ${l.shape}`);let u=O(t,"dataSplits","stringNGrams");if(u.dtype!=="int32")throw new Error("Data splits must be of datatype int32");let d={separator:n,nGramWidths:a,leftPad:r,rightPad:s,padWidth:i,preserveShortSequences:o},h={data:l,dataSplits:u},p=V.runKernel(x7,h,d);return{nGrams:p[0],nGramsSplits:p[1]}}var MV=U({stringNGrams_:CV});function $V(e,t,n=!0){let a=O(e,"input","stringSplit","string"),r=O(t,"delimiter","stringSplit","string");if(a.rank!==1)throw new Error(`Input should be Tensor1D but received shape ${a.shape}`);if(r.rank!==0)throw new Error(`Delimiter should be a scalar but received shape ${r.shape}`);let s={skipEmpty:n},i={input:a,delimiter:r},o=V.runKernel(b7,i,s);return{indices:o[0],values:o[1],shape:o[2]}}var RV=U({stringSplit_:$V});function FV(e,t){let n=O(e,"input","stringToHashBucketFast","string"),a={numBuckets:t};if(t<=0)throw new Error("Number of buckets must be at least 1");let r={input:n};return V.runKernel(v7,r,a)}var OV=U({stringToHashBucketFast_:FV}),DV={fft:i1,ifft:Cc,rfft:o1,irfft:f6},_V={hammingWindow:pB,hannWindow:w6,frame:k6,stft:gB},Ye={flipLeftRight:bB,resizeNearestNeighbor:jB,resizeBilinear:VB,rotateWithOffset:wB,cropAndResize:AB,nonMaxSuppression:IB,nonMaxSuppressionAsync:RB,nonMaxSuppressionWithScore:OB,nonMaxSuppressionWithScoreAsync:_B,nonMaxSuppressionPadded:PB,nonMaxSuppressionPaddedAsync:WB,threshold:qB,transform:XB},zV={bandPart:YB,gramSchmidt:QB,qr:tV},PV={absoluteDifference:rV,computeWeightedLoss:as,cosineDistance:iV,hingeLoss:lV,huberLoss:dV,logLoss:pV,meanSquaredError:fV,sigmoidCrossEntropy:yV,softmaxCrossEntropy:bV},LV={sparseFillEmptyRows:wV,sparseReshape:IV,sparseSegmentMean:NV,sparseSegmentSum:EV},WV={stringNGrams:MV,stringSplit:RV,stringToHashBucketFast:OV},Rs=class extends Mk{minimize(e,t=!1,n){let{value:a,grads:r}=this.computeGradients(e,n);if(n!=null){let s=n.map(i=>({name:i.name,tensor:r[i.name]}));this.applyGradients(s)}else this.applyGradients(r);return Ve(r),t?a:(a.dispose(),null)}get iterations(){return this.iterations_==null&&(this.iterations_=0),this.iterations_}incrementIterations(){this.iterations_=this.iterations+1}computeGradients(e,t){return Qk(e,t)}dispose(){this.iterations_!=null&&Ve(this.iterations_)}async saveIterations(){return this.iterations_==null&&(this.iterations_=0),{name:"iter",tensor:dt(this.iterations_,"int32")}}async getWeights(){throw new Error("getWeights() is not implemented for this optimizer yet.")}async setWeights(e){throw new Error(`setWeights() is not implemented for this optimizer class ${this.getClassName()}`)}async extractIterations(e){return this.iterations_=(await e[0].tensor.data())[0],e.slice(1)}};Object.defineProperty(Rs,Symbol.hasInstance,{value:e=>e.minimize!=null&&e.computeGradients!=null&&e.applyGradients!=null});var Oc=class extends Rs{constructor(e,t,n=null){super();this.learningRate=e,this.rho=t,this.epsilon=n,this.accumulatedGrads=[],this.accumulatedUpdates=[],n==null&&(this.epsilon=V.backend.epsilon())}applyGradients(e){(Array.isArray(e)?e.map(t=>t.name):Object.keys(e)).forEach((t,n)=>{let a=V.registeredVariables[t],r=!1;this.accumulatedGrads[n]==null&&(this.accumulatedGrads[n]={originalName:`${t}/accum_grad`,variable:Ue(()=>Na(a).variable(r))}),this.accumulatedUpdates[n]==null&&(this.accumulatedUpdates[n]={originalName:`${t}/accum_var`,variable:Ue(()=>Na(a).variable(r))});let s=Array.isArray(e)?e[n].tensor:e[t];if(s==null)return;let i=this.accumulatedGrads[n].variable,o=this.accumulatedUpdates[n].variable;Ue(()=>{let l=De(fe(i,this.rho),fe(tr(s),1-this.rho)),u=fe(Qe(ts(De(o,this.epsilon)),ts(De(i,this.epsilon))),s),d=De(fe(o,this.rho),fe(tr(u),1-this.rho));i.assign(l),o.assign(d);let h=De(fe(u,-this.learningRate),a);a.assign(h)})}),this.incrementIterations()}dispose(){this.accumulatedUpdates!=null&&(Ve(this.accumulatedGrads.map(e=>e.variable)),Ve(this.accumulatedUpdates.map(e=>e.variable)))}async getWeights(){let e=[...this.accumulatedGrads,...this.accumulatedUpdates];return[await this.saveIterations()].concat(e.map(t=>({name:t.originalName,tensor:t.variable})))}async setWeights(e){e=await this.extractIterations(e);let t=e.length/2,n=!1;this.accumulatedGrads=e.slice(0,t).map(a=>({originalName:a.name,variable:a.tensor.variable(n)})),this.accumulatedUpdates=e.slice(t,t*2).map(a=>({originalName:a.name,variable:a.tensor.variable(n)}))}getConfig(){return{learningRate:this.learningRate,rho:this.rho,epsilon:this.epsilon}}static fromConfig(e,t){return new e(t.learningRate,t.rho,t.epsilon)}};Oc.className="Adadelta";Cs(Oc);var Dc=class extends Rs{constructor(e,t=.1){super();this.learningRate=e,this.initialAccumulatorValue=t,this.accumulatedGrads=[]}applyGradients(e){(Array.isArray(e)?e.map(t=>t.name):Object.keys(e)).forEach((t,n)=>{let a=V.registeredVariables[t];if(this.accumulatedGrads[n]==null){let i=!1;this.accumulatedGrads[n]={originalName:`${t}/accumulator`,variable:Ue(()=>wc(a.shape,this.initialAccumulatorValue).variable(i))}}let r=Array.isArray(e)?e[n].tensor:e[t];if(r==null)return;let s=this.accumulatedGrads[n].variable;Ue(()=>{let i=De(s,tr(r));s.assign(i);let o=De(fe(Qe(r,ts(De(i,V.backend.epsilon()))),-this.learningRate),a);a.assign(o)})}),this.incrementIterations()}dispose(){this.accumulatedGrads!=null&&Ve(this.accumulatedGrads.map(e=>e.variable))}async getWeights(){return[await this.saveIterations()].concat(this.accumulatedGrads.map(e=>({name:e.originalName,tensor:e.variable})))}async setWeights(e){e=await this.extractIterations(e);let t=!1;this.accumulatedGrads=e.map(n=>({originalName:n.name,variable:n.tensor.variable(t)}))}getConfig(){return{learningRate:this.learningRate,initialAccumulatorValue:this.initialAccumulatorValue}}static fromConfig(e,t){return new e(t.learningRate,t.initialAccumulatorValue)}};Dc.className="Adagrad";Cs(Dc);var _c=class extends Rs{constructor(e,t,n,a=null){super();this.learningRate=e,this.beta1=t,this.beta2=n,this.epsilon=a,this.accumulatedFirstMoment=[],this.accumulatedSecondMoment=[],Ue(()=>{this.accBeta1=dt(t).variable(),this.accBeta2=dt(n).variable()}),a==null&&(this.epsilon=V.backend.epsilon())}applyGradients(e){let t=Array.isArray(e)?e.map(n=>n.name):Object.keys(e);Ue(()=>{let n=je(1,this.accBeta1),a=je(1,this.accBeta2);t.forEach((r,s)=>{let i=V.registeredVariables[r],o=!1;this.accumulatedFirstMoment[s]==null&&(this.accumulatedFirstMoment[s]={originalName:`${r}/m`,variable:Ue(()=>Na(i).variable(o))}),this.accumulatedSecondMoment[s]==null&&(this.accumulatedSecondMoment[s]={originalName:`${r}/v`,variable:Ue(()=>Na(i).variable(o))});let l=Array.isArray(e)?e[s].tensor:e[r];if(l==null)return;let u=this.accumulatedFirstMoment[s].variable,d=this.accumulatedSecondMoment[s].variable,h=De(fe(u,this.beta1),fe(l,1-this.beta1)),p=De(fe(d,this.beta2),fe(tr(l),1-this.beta2)),c=Qe(h,n),m=Qe(p,a);u.assign(h),d.assign(p);let f=De(fe(Qe(c,De(ts(m),this.epsilon)),-this.learningRate),i);i.assign(f)}),this.accBeta1.assign(fe(this.accBeta1,this.beta1)),this.accBeta2.assign(fe(this.accBeta2,this.beta2))}),this.incrementIterations()}dispose(){this.accBeta1.dispose(),this.accBeta2.dispose(),this.accumulatedFirstMoment!=null&&Ve(this.accumulatedFirstMoment.map(e=>e.variable)),this.accumulatedSecondMoment!=null&&Ve(this.accumulatedSecondMoment.map(e=>e.variable))}async getWeights(){let e=[...this.accumulatedFirstMoment,...this.accumulatedSecondMoment];return[await this.saveIterations()].concat(e.map(t=>({name:t.originalName,tensor:t.variable})))}async setWeights(e){e=await this.extractIterations(e),Ue(()=>{this.accBeta1.assign(pd(this.beta1,this.iterations_+1)),this.accBeta2.assign(pd(this.beta2,this.iterations_+1))});let t=e.length/2,n=!1;this.accumulatedFirstMoment=e.slice(0,t).map(a=>({originalName:a.name,variable:a.tensor.variable(n)})),this.accumulatedSecondMoment=e.slice(t,t*2).map(a=>({originalName:a.name,variable:a.tensor.variable(n)}))}getConfig(){return{learningRate:this.learningRate,beta1:this.beta1,beta2:this.beta2,epsilon:this.epsilon}}static fromConfig(e,t){return new e(t.learningRate,t.beta1,t.beta2,t.epsilon)}};_c.className="Adam";Cs(_c);var zc=class extends Rs{constructor(e,t,n,a=null,r=0){super();this.learningRate=e,this.beta1=t,this.beta2=n,this.epsilon=a,this.decay=r,this.accumulatedFirstMoment=[],this.accumulatedWeightedInfNorm=[],Ue(()=>{this.iteration=dt(0).variable(),this.accBeta1=dt(t).variable()}),a==null&&(this.epsilon=V.backend.epsilon())}applyGradients(e){let t=Array.isArray(e)?e.map(n=>n.name):Object.keys(e);Ue(()=>{let n=je(1,this.accBeta1),a=Qe(-this.learningRate,De(fe(this.iteration,this.decay),1));t.forEach((r,s)=>{let i=V.registeredVariables[r],o=!1;this.accumulatedFirstMoment[s]==null&&(this.accumulatedFirstMoment[s]={originalName:`${r}/m`,variable:Na(i).variable(o)}),this.accumulatedWeightedInfNorm[s]==null&&(this.accumulatedWeightedInfNorm[s]={originalName:`${r}/v`,variable:Na(i).variable(o)});let l=Array.isArray(e)?e[s].tensor:e[r];if(l==null)return;let u=this.accumulatedFirstMoment[s].variable,d=this.accumulatedWeightedInfNorm[s].variable,h=De(fe(u,this.beta1),fe(l,1-this.beta1)),p=fe(d,this.beta2),c=Sa(l),m=i6(p,c);u.assign(h),d.assign(m);let f=De(fe(Qe(a,n),Qe(h,De(m,this.epsilon))),i);i.assign(f)}),this.iteration.assign(De(this.iteration,1)),this.accBeta1.assign(fe(this.accBeta1,this.beta1))}),this.incrementIterations()}dispose(){this.accBeta1.dispose(),this.iteration.dispose(),this.accumulatedFirstMoment!=null&&Ve(this.accumulatedFirstMoment.map(e=>e.variable)),this.accumulatedWeightedInfNorm!=null&&Ve(this.accumulatedWeightedInfNorm.map(e=>e.variable))}async getWeights(){throw new Error("getWeights() is not implemented for Adamax yet.")}async setWeights(e){throw new Error("setWeights() is not implemented for Adamax yet.")}getConfig(){return{learningRate:this.learningRate,beta1:this.beta1,beta2:this.beta2,epsilon:this.epsilon,decay:this.decay}}static fromConfig(e,t){return new e(t.learningRate,t.beta1,t.beta2,t.epsilon,t.decay)}};zc.className="Adamax";Cs(zc);var md=class extends Rs{constructor(e){super();this.learningRate=e,this.setLearningRate(e)}applyGradients(e){(Array.isArray(e)?e.map(t=>t.name):Object.keys(e)).forEach((t,n)=>{let a=Array.isArray(e)?e[n].tensor:e[t];if(a==null)return;let r=V.registeredVariables[t];Ue(()=>{let s=De(fe(this.c,a),r);r.assign(s)})}),this.incrementIterations()}setLearningRate(e){this.learningRate=e,this.c!=null&&this.c.dispose(),this.c=Dk(dt(-e))}dispose(){this.c.dispose()}async getWeights(){return[await this.saveIterations()]}async setWeights(e){if(e=await this.extractIterations(e),e.length!==0)throw new Error("SGD optimizer does not have settable weights.")}getConfig(){return{learningRate:this.learningRate}}static fromConfig(e,t){return new e(t.learningRate)}};md.className="SGD";Cs(md);var Pc=class extends md{constructor(e,t,n=!1){super(e);this.learningRate=e,this.momentum=t,this.useNesterov=n,this.accumulations=[],this.m=dt(this.momentum)}applyGradients(e){(Array.isArray(e)?e.map(t=>t.name):Object.keys(e)).forEach((t,n)=>{let a=V.registeredVariables[t];if(this.accumulations[n]==null){let i=!1;this.accumulations[n]={originalName:`${t}/momentum`,variable:Ue(()=>Na(a).variable(i))}}let r=this.accumulations[n].variable,s=Array.isArray(e)?e[n].tensor:e[t];s!=null&&Ue(()=>{let i,o=De(fe(this.m,r),s);this.useNesterov?i=De(fe(this.c,De(s,fe(o,this.m))),a):i=De(fe(this.c,o),a),r.assign(o),a.assign(i)})}),this.incrementIterations()}dispose(){this.m.dispose(),this.accumulations!=null&&Ve(this.accumulations.map(e=>e.variable))}setMomentum(e){this.momentum=e}async getWeights(){return[await this.saveIterations()].concat(this.accumulations.map(e=>({name:e.originalName,tensor:e.variable})))}async setWeights(e){e=await this.extractIterations(e);let t=!1;this.accumulations=e.map(n=>({originalName:n.name,variable:n.tensor.variable(t)}))}getConfig(){return{learningRate:this.learningRate,momentum:this.momentum,useNesterov:this.useNesterov}}static fromConfig(e,t){return new e(t.learningRate,t.momentum,t.useNesterov)}};Pc.className="Momentum";Cs(Pc);var Lc=class extends Rs{constructor(e,t=.9,n=0,a=null,r=!1){super();if(this.learningRate=e,this.decay=t,this.momentum=n,this.epsilon=a,this.accumulatedMeanSquares=[],this.accumulatedMoments=[],this.accumulatedMeanGrads=[],this.centered=r,a==null&&(this.epsilon=V.backend.epsilon()),e==null)throw new Error("learningRate for RMSPropOptimizer must be defined.")}applyGradients(e){(Array.isArray(e)?e.map(t=>t.name):Object.keys(e)).forEach((t,n)=>{let a=V.registeredVariables[t],r=!1;this.accumulatedMeanSquares[n]==null&&(this.accumulatedMeanSquares[n]={originalName:`${t}/rms`,variable:Ue(()=>Na(a).variable(r))}),this.accumulatedMoments[n]==null&&(this.accumulatedMoments[n]={originalName:`${t}/momentum`,variable:Ue(()=>Na(a).variable(r))}),this.accumulatedMeanGrads[n]==null&&this.centered&&(this.accumulatedMeanGrads[n]={originalName:`${t}/mg`,variable:Ue(()=>Na(a).variable(r))});let s=Array.isArray(e)?e[n].tensor:e[t];if(s==null)return;let i=this.accumulatedMeanSquares[n].variable,o=this.accumulatedMoments[n].variable;Ue(()=>{let l=De(fe(i,this.decay),fe(tr(s),1-this.decay));if(this.centered){let u=this.accumulatedMeanGrads[n].variable,d=De(fe(u,this.decay),fe(s,1-this.decay)),h=Qe(fe(s,this.learningRate),ts(je(l,De(tr(d),this.epsilon)))),p=De(fe(o,this.momentum),h);i.assign(l),u.assign(d),o.assign(p);let c=je(a,p);a.assign(c)}else{let u=De(fe(i,this.decay),fe(tr(s),1-this.decay)),d=De(fe(o,this.momentum),Qe(fe(s,this.learningRate),ts(De(u,this.epsilon))));i.assign(u),o.assign(d);let h=je(a,d);a.assign(h)}})}),this.incrementIterations()}dispose(){this.accumulatedMeanSquares!=null&&Ve(this.accumulatedMeanSquares.map(e=>e.variable)),this.accumulatedMeanGrads!=null&&this.centered&&Ve(this.accumulatedMeanGrads.map(e=>e.variable)),this.accumulatedMoments!=null&&Ve(this.accumulatedMoments.map(e=>e.variable))}async getWeights(){let e=[...this.accumulatedMeanSquares,...this.accumulatedMoments];return this.centered&&e.push(...this.accumulatedMeanGrads),[await this.saveIterations()].concat(e.map(t=>({name:t.originalName,tensor:t.variable})))}async setWeights(e){e=await this.extractIterations(e);let t=this.centered?e.length/3:e.length/2,n=!1;this.accumulatedMeanSquares=e.slice(0,t).map(a=>({originalName:a.name,variable:a.tensor.variable(n)})),this.accumulatedMoments=e.slice(t,t*2).map(a=>({originalName:a.name,variable:a.tensor.variable(n)})),this.centered&&(this.accumulatedMeanGrads=e.slice(t*2,t*3).map(a=>({originalName:a.name,variable:a.tensor.variable(n)})))}getConfig(){return{learningRate:this.learningRate,decay:this.decay,momentum:this.momentum,epsilon:this.epsilon,centered:this.centered}}static fromConfig(e,t){return new e(t.learningRate,t.decay,t.momentum,t.epsilon,t.centered)}};Lc.className="RMSProp";Cs(Lc);var Si=class{static sgd(e){return new md(e)}static momentum(e,t,n=!1){return new Pc(e,t,n)}static rmsprop(e,t=.9,n=0,a=null,r=!1){return new Lc(e,t,n,a,r)}static adam(e=.001,t=.9,n=.999,a=null){return new _c(e,t,n,a)}static adadelta(e=.001,t=.95,n=null){return new Oc(e,t,n)}static adamax(e=.002,t=.9,n=.999,a=null,r=0){return new zc(e,t,n,a,r)}static adagrad(e,t=.1){return new Dc(e,t)}},BV={sgd:Si.sgd,momentum:Si.momentum,adadelta:Si.adadelta,adagrad:Si.adagrad,rmsprop:Si.rmsprop,adamax:Si.adamax,adam:Si.adam},VV=(()=>typeof requestAnimationFrame!="undefined"?requestAnimationFrame:typeof setImmediate!="undefined"?setImmediate:e=>e())();function UV(){return new Promise(e=>VV(()=>e()))}var C6={};$e(C6,{ERF_A1:()=>nU,ERF_A2:()=>aU,ERF_A3:()=>rU,ERF_A4:()=>sU,ERF_A5:()=>iU,ERF_P:()=>tU,PARALLELIZE_THRESHOLD:()=>h1,SELU_SCALE:()=>eU,SELU_SCALEALPHA:()=>QV,applyActivation:()=>Rc,assertAndGetBroadcastShape:()=>In,assertAxesAreInnerMostDims:()=>fP,assertParamsConsistent:()=>jV,assignToTypedArray:()=>fU,axesAreInnerMostDims:()=>n1,calculateShapes:()=>Ak,checkEinsumDimSizes:()=>bU,combineLocations:()=>t6,complexWithEvenIndex:()=>hU,complexWithOddIndex:()=>pU,computeConv2DInfo:()=>id,computeConv3DInfo:()=>Pk,computeDefaultPad:()=>Zy,computeDilation2DInfo:()=>r_,computeOptimalWindowSize:()=>GV,computeOutAndReduceShapes:()=>cP,computeOutShape:()=>HV,computePool2DInfo:()=>zk,computePool3DInfo:()=>s_,convertConv2DDataFormat:()=>Lk,decodeEinsumEquation:()=>AU,eitherStridesOrDilationsAreOne:()=>Jr,expandShapeToKeepDim:()=>dd,exponent:()=>gU,exponents:()=>mU,fromStringArrayToUint8:()=>CU,fromUint8ToStringArray:()=>EU,getAxesPermutation:()=>mP,getBroadcastDims:()=>mz,getComplexWithIndex:()=>cU,getEinsumComputePath:()=>vU,getEinsumPermutation:()=>xU,getFusedBiasGradient:()=>$c,getFusedDyActivation:()=>Mc,getImageCenter:()=>qV,getInnerMostAxes:()=>yP,getPermuted:()=>XV,getReductionAxes:()=>jk,getReshaped:()=>KV,getReshapedPermuted:()=>ZV,getSliceBeginCoords:()=>YV,getSliceSize:()=>JV,getUndoAxesPermutation:()=>gP,isIdentityPermutation:()=>wU,log:()=>lU,mergeRealAndImagArrays:()=>uU,prepareAndValidate:()=>gk,prepareSplitSize:()=>IU,segment_util:()=>R6,shouldFuse:()=>Fc,slice_util:()=>Vy,splitRealAndImagArrays:()=>dU,tupleValuesAreOne:()=>od,upcastType:()=>dc,validateInput:()=>By,validateUpdateShape:()=>Wy,warn:()=>oU});function jV(e,t){let n=e[0].length;e.forEach((r,s)=>{L(r.length===n,()=>`Error in concat${n}D: rank of tensors[${s}] must be the same as the rank of the rest (${n})`)}),L(t>=0&&t`Error in concat${n}D: axis must be between 0 and ${n-1}.`);let a=e[0];e.forEach((r,s)=>{for(let i=0;i`Error in concat${n}D: Shape of tensors[${s}] (${r}) does not match the shape of the rest (${a}) along the non-concatenated axis ${s}.`)})}function HV(e,t){let n=e[0].slice();for(let a=1;a=t*2+1||i%2==1?s.push(i):r.push(i);a.push(...r),a.push(0),a.push(...s)}return a}function ZV(e,t,n,a=!0){let r=[];a?r.push(e[0]/n):r.push(e[0]*n);for(let s=1;s/g,M6=",",$6="...";function AU(e,t){e=e.replace(/\s/g,"");let n=(e.length-e.replace(yU,"").length)/p1.length;if(n<1)throw new Error("Equations without an arrow are not supported.");if(n>1)throw new Error(`Equation must contain exactly one arrow ("${p1}").`);let[a,r]=e.split(p1);L(a.indexOf($6)===-1,()=>`The ellipsis notation ("${$6}") is not supported yet.`);let s=a.split(M6),i=s.length;if(t!==i)throw new Error(`Expected ${i} input tensors, received ${t}`);if(i>2)throw new Error("Support for more than 2 input tensors is not implemented yet.");let o=[];for(let p=0;pm.indexOf(c)!==-1))throw new Error(`Output subscripts contain the label ${c} not present in the input subscripts.`);o.indexOf(c)===-1&&o.push(c)}for(let p=0;pr!==-1),{permutationIndices:n,expandDims:a}}function bU(e,t,n){let a=new Array(e);for(let r=0;r`Expected dimension ${a[t[r][i]]} at axis ${i} of input shaped ${JSON.stringify(s)}, but got dimension ${s[i]}`)}}function vU(e,t){let n=e,a=[],r=0;e.length===0&&n.push(-1),r=e.length+1;for(let i=0;it===n)}function kU(e,t){let n=[];for(let a=0;a"Number of splits must evenly divide the axis."),a=new Array(t).fill(e.shape[n]/t);else{let r=t.reduce((i,o)=>(o===-1&&(i+=1),i),0);L(r<=1,()=>"There should be only one negative value in split array.");let s=t.indexOf(-1);if(s!==-1){let i=t.reduce((o,l)=>l>0?o+l:o);t[s]=e.shape[n]-i}L(e.shape[n]===t.reduce((i,o)=>i+o),()=>"The sum of sizes must match the size of the axis dimension."),a=t}return a}var R6={};$e(R6,{collectGatherOpShapeInfo:()=>TU,computeOutShape:()=>NU,segOpComputeOptimalWindowSize:()=>SU});function SU(e,t){let n=!1,a;for(e<=h1?(a=e,n=!0):a=tc(e,Math.floor(Math.sqrt(e)));!n;)a>t||a===e?n=!0:a=tc(e,a+1);return a}function NU(e,t,n){let a=[],r=e.length;for(let s=0;sr))throw new Error(`Expect batchDims in the range of [-${r}, ${r}], but got ${a}`);if(a<0&&(a+=r),a>s)throw new Error(`batchDims (${a}) must be less than rank(x) ( - ${s}).`);if(noc(t))}catch(t){throw new Error(`Failed to decode encoded string bytes into utf-8, error: ${t}`)}}function CU(e){return e.map(t=>Qu(t))}var F6={};$e(F6,{nonMaxSuppressionV3Impl:()=>I6,nonMaxSuppressionV4Impl:()=>S6,nonMaxSuppressionV5Impl:()=>N6,whereImpl:()=>y6});var MU=1e-7,$U=1e-4,c1=class{constructor(e,t){this.backend=e,this.dataMover=t,this.data=new WeakMap,this.dataIdsCount=0}get(e){return this.data.has(e)||this.dataMover.moveData(this.backend,e),this.data.get(e)}set(e,t){this.dataIdsCount++,this.data.set(e,t)}has(e){return this.data.has(e)}delete(e){return this.dataIdsCount--,this.data.delete(e)}numDataIds(){return this.dataIdsCount}},Wc=class{refCount(e){return ja("refCount")}incRef(e){return ja("incRef")}timerAvailable(){return!0}time(e){return ja("time")}read(e){return ja("read")}readSync(e){return ja("readSync")}numDataIds(){return ja("numDataIds")}disposeData(e,t){return ja("disposeData")}write(e,t,n){return ja("write")}move(e,t,n,a,r){return ja("move")}memory(){return ja("memory")}floatPrecision(){return ja("floatPrecision")}epsilon(){return this.floatPrecision()===32?MU:$U}dispose(){return ja("dispose")}};function ja(e){throw new Error(`'${e}' not yet implemented or not found in the registry. This kernel may not be supported by the tfjs backend you have chosen`)}function O6(e){let t=e.length,n=0,a=0;for(;t>0;)a=Math.random()*t|0,t--,n=e[t],e[t]=e[a],e[a]=n}function RU(e,t){if(e.length!==t.length)throw new Error(`Array sizes must match to be shuffled together First array length was ${e.length}Second array length was ${t.length}`);let n=e.length,a,r,s=0;for(;n>0;)s=Math.random()*n|0,n--,a=e[n],r=t[n],e[n]=e[s],t[n]=t[s],e[s]=a,t[s]=r}function gd(e,t,n){return Math.max(e,Math.min(t,n))}function FU(e){return e%2==0?e:e+1}function OU(e){let t=0;for(let n=0;nn+` Shapes ${e} and ${t} must match`)}function Bc(e){P(e!=null,()=>"The input to the tensor constructor must be a non-null value.")}function yd(e,t=[],n=!1){if(t==null&&(t=[]),Array.isArray(e)||ar(e)&&!n)for(let a=0;a0,n){return new Promise((a,r)=>{let s=0,i=()=>{if(e()){a();return}s++;let o=t(s);if(n!=null&&s>=n){r();return}setTimeout(i,o)};i()})}function VU(e,t){let n=1,a=-1;for(let s=0;s=0)n*=e[s];else if(e[s]===-1){if(a!==-1)throw Error(`Shapes can only have 1 implicit size. Found -1 at dim ${a} and dim ${s}`);a=s}else if(e[s]<0)throw Error(`Shapes can not be < 0. Found ${e[s]} at dim ${s}`);if(a===-1){if(t>0&&t!==n)throw Error(`Size(${t}) must match the product of shape ${e}`);return e}if(n===0)throw Error(`Cannot infer the missing size in [${e}] when there are 0 elements`);if(t%n!=0)throw Error(`The implicit shape can't be a fractional number. Got ${t} / ${n}`);let r=e.slice();return r[a]=t/n,r}function Ha(e,t){let n=t.length;return e=e==null?t.map((a,r)=>r):[].concat(e),P(e.every(a=>a>=-n&&a`All values in axis param must be in range [-${n}, ${n}) but got axis ${e}`),P(e.every(a=>mn(a)),()=>`All values in axis param must be integers but got axis ${e}`),e.map(a=>a<0?n+a:a)}function D6(e,t){let n=[],a=[],r=t!=null&&Array.isArray(t)&&t.length===0,s=t==null||r?null:Ha(t,e).sort(),i=0;for(let o=0;oo)&&e[o]===1&&(n.push(e[o]),a.push(o)),s[i]<=o&&i++}e[o]!==1&&(n.push(e[o]),a.push(o))}return{newShape:n,keptDims:a}}function UU(e,t){let n=null;if(e==null||e==="float32")n=new Float32Array(t);else if(e==="int32")n=new Int32Array(t);else if(e==="bool")n=new Uint8Array(t);else throw new Error(`Unknown data type ${e}`);return n}function _6(e,t){let n=null;if(e==null||e==="float32")n=new Float32Array(t);else if(e==="int32")n=new Int32Array(t);else if(e==="bool")n=new Uint8Array(t);else if(e==="string")n=new Array(t);else throw new Error(`Unknown data type ${e}`);return n}function z6(e,t){for(let n=0;nt+=n.length),t}function Vc(e){return typeof e=="string"||e instanceof String}function W6(e){return typeof e=="boolean"}function B6(e){return typeof e=="number"}function Uc(e){return Array.isArray(e)?Uc(e[0]):e instanceof Float32Array?"float32":e instanceof Int32Array||e instanceof Uint8Array?"int32":B6(e)?"float32":Vc(e)?"string":W6(e)?"bool":"float32"}function jc(e){return!!(e&&e.constructor&&e.call&&e.apply)}function Hc(e,t){for(let n=t;n=0;--a)n[a]=n[a+1]*e[a+1];return n}function V6(e,t,n,a=!1){let r=new Array;if(t.length===1){let s=t[0]*(a?2:1);for(let i=0;il*u)*(a?2:1);for(let l=0;lr*s)*(n?2:1);if(a===0)return[];if(a!==t.length)throw new Error(`[${e}] does not match the input size ${t.length}${n?" for a complex tensor":""}.`);return V6(0,e,t,n)}function m1(e,t){let n=Gc(e,t);for(let a=0;aa*r,1);if(t==null||t==="float32")return Xo(e,new Float32Array(n));if(t==="int32")return Xo(e,new Int32Array(n));if(t==="bool")return Xo(e,new Uint8Array(n));throw new Error(`Unknown data type ${t}`)}function g1(e){e.forEach(t=>{P(Number.isInteger(t)&&t>=0,()=>`Tensor must have a shape comprised of positive integers but got shape [${e}].`)})}function GU(e,t,n){if(t===0)return 0;if(t===1)return e[0];let a=e[e.length-1];for(let r=0;r{let[n,a]=t.split(":");this.urlFlags[n]=YU(n,a)})}};function XU(e){let t={};return e.replace(/[?&]([^=?&]+)(?:=([^&]*))?/g,(n,...a)=>(ZU(t,a[0],a[1]),a.join("="))),t}function ZU(e,t,n){e[decodeURIComponent(t)]=decodeURIComponent(n||"")}function YU(e,t){if(t=t.toLowerCase(),t==="true"||t==="false")return t==="true";if(`${+t}`===t)return+t;throw new Error(`Could not parse value flag value ${t} for flag ${e}.`)}function se(){return j6}var j6=null;function JU(e){j6=e}var A1;function H6(){if(A1==null){let e;if(typeof window!="undefined")e=window;else if(typeof global!="undefined")e=global;else if(typeof process!="undefined")e=process;else if(typeof self!="undefined")e=self;else throw new Error("Could not find a global object");A1=e}return A1}function QU(){let e=H6();return e._tfGlobals==null&&(e._tfGlobals=new Map),e._tfGlobals}function x1(e,t){let n=QU();if(n.has(e))return n.get(e);{let a=t();return n.set(e,a),n.get(e)}}var xd="Abs",bd="Acos",vd="Acosh",Os="Add",Zo="AddN",wd="All",kd="Any",Yo="ArgMax",qc="ArgMin",Id="Asin",Sd="Asinh",Nd="Atan",Td="Atanh",Ed="Atan2",Jo="AvgPool",b1="AvgPoolGrad",Kc="AvgPool3D",v1="AvgPool3DGrad",Qo="BatchMatMul",Xc="BatchToSpaceND",w1="Bincount",ej="BroadcastTo",el="Cast",Ni="Ceil",Ti="ClipByValue",k1="Complex",Zc="ComplexAbs",Cd="Concat",tl="Conv2D",I1="Conv2DBackpropFilter",nl="Conv2DBackpropInput",Yc="Conv3D",S1="Conv3DBackpropFilterV2",N1="Conv3DBackpropInputV2",al="Cos",Md="Cosh",rl="Cumsum",$d="CropAndResize",T1="DenseBincount",Rd="DepthToSpace",sl="DepthwiseConv2dNative",E1="DepthwiseConv2dNativeBackpropFilter",C1="DepthwiseConv2dNativeBackpropInput",M1="Diag",Jc="Dilation2D",$1="Dilation2DBackpropInput",R1="Dilation2DBackpropFilter",il="RealDiv",F1="Einsum",Fd="Elu",O1="EluGrad",Od="Erf",ol="Equal",Ei="Exp",Dd="ExpandDims",ll="Expm1",D1="FFT",Qc="Fill",_d="FlipLeftRight",Ci="Floor",ul="FloorDiv",dl="FusedBatchNorm",zd="GatherV2",Pd="GatherNd",hl="Greater",Mi="GreaterEqual",pl="Identity",_1="IFFT",z1="Imag",Ld="IsFinite",Wd="IsInf",Bd="IsNan",cl="LeakyRelu",fl="Less",ml="LessEqual",P1="LinSpace",$i="Log",Vd="Log1p",Ud="LogicalAnd",ef="LogicalNot",tf="LogicalOr",tj="LogSoftmax",nf="LRN",L1="LRNGrad",gl="Max",Ri="Maximum",yl="MaxPool",W1="MaxPoolGrad",af="MaxPool3D",B1="MaxPool3DGrad",V1="MaxPoolWithArgmax",Al="Mean",xl="Min",Fi="Minimum",bl="MirrorPad",jd="Mod",U1="Multinomial",Oi="Multiply",Hd="Neg",vl="NotEqual",Gd="NonMaxSuppressionV3",qd="NonMaxSuppressionV4",Kd="NonMaxSuppressionV5",Xd="OnesLike",wl="OneHot",Zd="Pack",kl="PadV2",Il="Pow",Sl="Prelu",Yd="Prod",rf="Range",j1="Real",Jd="Reciprocal",Nl="Relu",Qd="Reshape",sf="ResizeNearestNeighbor",H1="ResizeNearestNeighborGrad",Tl="ResizeBilinear",G1="ResizeBilinearGrad",El="Relu6",Cl="Reverse",Ml="Round",Di="Rsqrt",eh="ScatterNd",th="Select",nh="Selu",ah="Slice",$l="Sin",rh="Sinh",sh="Sign",Rl="Sigmoid",ih="Softplus",Fl="Sqrt",Ol="Sum",of="SpaceToBatchND",oh="SplitV",Dl="Softmax",q1="SparseFillEmptyRows",K1="SparseReshape",X1="SparseSegmentMean",Z1="SparseSegmentSum",Y1="SparseToDense",_i="SquaredDifference",lf="Square",lh="StridedSlice",J1="StringNGrams",Q1="StringSplit",eA="StringToHashBucketFast",zi="Sub",_l="Tan",zl="Tanh",Pi="Tile",uh="TopK",dh="Transform",Pl="Transpose",tA="Unique",hh="Unpack",uf="UnsortedSegmentSum",ph="ZerosLike",Li="Step",nA="FromPixels",ch="RotateWithOffset",Ll="_FusedMatMul",Wl="FusedConv2D",Bl="FusedDepthwiseConv2D",df=x1("kernelRegistry",()=>new Map),aA=x1("gradRegistry",()=>new Map);function rA(e,t){let n=K6(e,t);return df.get(n)}function G6(e){return aA.get(e)}function q6(e){let t=df.entries(),n=[];for(;;){let{done:a,value:r}=t.next();if(a)break;let[s,i]=r,[o]=s.split("_");o===e&&n.push(i)}return n}function sA(e){let{kernelName:t,backendName:n}=e,a=K6(t,n);df.has(a)&&console.warn(`The kernel '${t}' for backend '${n}' is already registered`),df.set(a,e)}function nj(e){let{kernelName:t}=e;aA.has(t)&&se().getBool("DEBUG")&&console.warn(`Overriding the gradient for '${t}'`),aA.set(t,e)}function K6(e,t){return`${t}_${e}`}var k={};$e(k,{arraysEqual:()=>Fs,assert:()=>P,assertNonNegativeIntegerDimensions:()=>g1,assertNonNull:()=>Bc,assertShapesMatch:()=>nr,bytesFromStringArray:()=>L6,bytesPerElement:()=>f1,checkConversionForErrors:()=>z6,clamp:()=>gd,computeStrides:()=>Ko,createScalarValue:()=>lj,createShuffledIndices:()=>WU,decodeString:()=>ff,distSquared:()=>_U,encodeString:()=>cf,fetch:()=>dj,fingerPrint64:()=>oj,flatten:()=>yd,getArrayFromDType:()=>_6,getTypedArrayFromDType:()=>UU,hasEncodingLoss:()=>jU,hexToLong:()=>fh,indexToLoc:()=>qU,inferDtype:()=>Uc,inferFromImplicitShape:()=>VU,isBoolean:()=>W6,isFunction:()=>jc,isInt:()=>mn,isNumber:()=>B6,isPromise:()=>y1,isScalarShape:()=>zU,isString:()=>Vc,isTypedArray:()=>ar,isValidDtype:()=>P6,locToIndex:()=>GU,makeOnesTypedArray:()=>m1,makeZerosNestedTypedArray:()=>HU,makeZerosTypedArray:()=>Gc,nearestDivisor:()=>Hc,nearestLargerEven:()=>FU,now:()=>mh,parseAxisParam:()=>Ha,randUniform:()=>DU,repeatedTry:()=>BU,rightPad:()=>Ad,shuffle:()=>O6,shuffleCombo:()=>RU,sizeFromShape:()=>on,sizeToSquarishShape:()=>LU,squeezeShape:()=>D6,sum:()=>OU,tanh:()=>PU,toNestedArray:()=>Xo,toTypedArray:()=>pf});var X6=qr(D3()),Wi=X6.default||X6;function fh(e){return Wi.fromString(e,!0,16)}var Z6=fh("c3a5c85c97cb3127"),Bi=fh("b492b66fbe98f273"),zn=fh("9ae16a3b2f90404f");function iA(e){return e.xor(e.shru(47))}function Y6(e,t,n){let a=e.slice(t,t+n);return Wi.fromBytes(Array.from(a),!0,!0)}function Nt(e,t){return Y6(e,t,8)}function J6(e,t){return Y6(e,t,4)}function gn(e,t){return t===0?e:e.shru(t).or(e.shl(64-t))}function Ds(e,t,n=fh("9ddfea08eb382d69")){let a=e.xor(t).mul(n);a=a.xor(a.shru(47));let r=t.xor(a).mul(n);return r=r.xor(r.shru(47)),r=r.mul(n),r}function aj(e,t,n,a,r,s){r=r.add(e),s=gn(s.add(r).add(a),21);let i=r;return r=r.add(t),r=r.add(n),s=s.add(gn(r,44)),[r.add(a),s.add(i)]}function hf(e,t,n,a){return aj(Nt(e,t),Nt(e,t+8),Nt(e,t+16),Nt(e,t+24),n,a)}function rj(e,t=e.length){if(t>=8){let n=zn.add(t*2),a=Nt(e,0).add(zn),r=Nt(e,t-8),s=gn(r,37).mul(n).add(a),i=gn(a,25).add(r).mul(n);return Ds(s,i,n)}if(t>=4){let n=zn.add(t*2),a=J6(e,0);return Ds(a.shl(3).add(t),J6(e,t-4),n)}if(t>0){let n=e[0],a=e[t>>1],r=e[t-1],s=n+(a<<8),i=t+(r<<2);return iA(zn.mul(s).xor(Z6.mul(i))).mul(zn)}return zn}function sj(e,t=e.length){let n=zn.add(t*2),a=Nt(e,0).mul(Bi),r=Nt(e,8),s=Nt(e,t-8).mul(n),i=Nt(e,t-16).mul(zn);return Ds(gn(a.add(r),43).add(gn(s,30)).add(i),a.add(gn(r.add(zn),18)).add(s),n)}function ij(e,t=e.length){let n=zn.add(t*2),a=Nt(e,0).mul(zn),r=Nt(e,8),s=Nt(e,t-8).mul(n),i=Nt(e,t-16).mul(zn),o=gn(a.add(r),43).add(gn(s,30)).add(i),l=Ds(o,a.add(gn(r.add(zn),18)).add(s),n),u=Nt(e,16).mul(n),d=Nt(e,24),h=o.add(Nt(e,t-32)).mul(n),p=l.add(Nt(e,t-24)).mul(n);return Ds(gn(u.add(d),43).add(gn(h,30)).add(p),u.add(gn(d.add(a),18)).add(h),n)}function oj(e,t=e.length){let n=Wi.fromNumber(81,!0);if(t<=32)return t<=16?rj(e,t):sj(e,t);if(t<=64)return ij(e,t);let a=n,r=n.mul(Bi).add(113),s=iA(r.mul(zn).add(113)).mul(zn),i=[Wi.UZERO,Wi.UZERO],o=[Wi.UZERO,Wi.UZERO];a=a.mul(zn).add(Nt(e,0));let l=0,u=(t-1>>6)*64,d=u+(t-1&63)-63;do a=gn(a.add(r).add(i[0]).add(Nt(e,l+8)),37).mul(Bi),r=gn(r.add(i[1]).add(Nt(e,l+48)),42).mul(Bi),a=a.xor(o[1]),r=r.add(i[0]).add(Nt(e,l+40)),s=gn(s.add(o[0]),33).mul(Bi),i=hf(e,l,i[1].mul(Bi),a.add(o[0])),o=hf(e,l+32,s.add(o[1]),r.add(Nt(e,l+16))),[s,a]=[a,s],l+=64;while(l!==u);let h=Bi.add(s.and(255).shl(1));return l=d,o[0]=o[0].add(t-1&63),i[0]=i[0].add(o[0]),o[0]=o[0].add(i[0]),a=gn(a.add(r).add(i[0]).add(Nt(e,l+8)),37).mul(h),r=gn(r.add(i[1]).add(Nt(e,l+48)),42).mul(h),a=a.xor(o[1].mul(9)),r=r.add(i[0].mul(9).add(Nt(e,l+40))),s=gn(s.add(o[0]),33).mul(h),i=hf(e,l,i[1].mul(h),a.add(o[0])),o=hf(e,l+32,s.add(o[1]),r.add(Nt(e,l+16))),[s,a]=[a,s],Ds(Ds(i[0],o[0],h).add(iA(r).mul(Z6)).add(s),Ds(i[1],o[1],h).add(a),h)}function lj(e,t){return t==="string"?cf(e):pf([e],t)}function uj(e,t){return e instanceof Float32Array&&t==="float32"||e instanceof Int32Array&&t==="int32"||e instanceof Uint8Array&&t==="bool"}function pf(e,t){if(t==="string")throw new Error("Cannot convert a string[] to a TypedArray");if(Array.isArray(e)&&(e=yd(e)),se().getBool("DEBUG")&&z6(e,t),uj(e,t))return e;if(t==null||t==="float32"||t==="complex64")return new Float32Array(e);if(t==="int32")return new Int32Array(e);if(t==="bool"){let n=new Uint8Array(e.length);for(let a=0;a{a=n()},s,i=mh();if(this.backendTimer.timerAvailable())s=this.backendTimer.time(r);else{r();for(let o of a)o.dataSync();s=Promise.resolve({kernelMs:mh()-i})}if(se().getBool("CHECK_COMPUTATION_FOR_ERRORS"))for(let o=0;o{pj(u,l.dtype,e)})}return{kernelName:e,outputs:a,inputs:t,timeMs:s.then(o=>o.kernelMs),extraInfo:s.then(o=>o.getExtraProfileInfo!=null?o.getExtraProfileInfo():"")}}logKernelProfile(e){let{kernelName:t,outputs:n,timeMs:a,inputs:r,extraInfo:s}=e;n.forEach(i=>{Promise.all([i.data(),a,s]).then(o=>{this.logger.logKernelProfile(t,i,o[0],o[1],r,o[2])})})}};function pj(e,t,n){if(t!=="float32")return!1;for(let a=0;a0?m:""} `}}console.log(`%c${o} %c${i} %c${l}D ${d} %c${u} %c${h} %c${s}`,"font-weight:bold","color:red","color:blue","color: orange","color: green","color: steelblue")}};function fj(e,t,n){let a={},r={};for(let l=0;la[f.id]=!0),c=!0,r[u.id]=!0;break}if(c)break}}let s={};s[n.id]=!0;let i={};for(let l=e.length-1;l>=0;l--){let u=e[l],d=u.inputs;for(let h=0;h=0;r--){let s=t[r],i=[];if(s.outputs.forEach(l=>{let u=e[l.id];u!=null?i.push(u):i.push(null)}),s.gradient==null)throw new Error(`Cannot compute gradient: gradient function not found for ${s.kernelName}.`);let o=s.gradient(i);for(let l in s.inputs){if(!(l in o))throw new Error(`Cannot backprop through input ${l}. Available gradients found: ${Object.keys(o)}.`);let u=n(()=>o[l]());if(u.dtype!=="float32")throw new Error(`Error in gradient for op ${s.kernelName}. The gradient of input ${l} must have 'float32' dtype, but has '${u.dtype}'`);let d=s.inputs[l];if(!Fs(u.shape,d.shape))throw new Error(`Error in gradient for op ${s.kernelName}. The gradient of input '${l}' has shape '${u.shape}', which does not match the shape of the input '${d.shape}'`);if(e[d.id]==null)e[d.id]=u;else{let h=e[d.id];e[d.id]=a(h,u),h.dispose()}}}}var Q6=20,gh=3,oA=7;function gj(e,t,n,a){let r=Ko(t),s=yj(e,t,n,r),i=t.length,o=mf(e,t,n,r,s),l=["Tensor"];return a&&(l.push(` dtype: ${n}`),l.push(` rank: ${i}`),l.push(` shape: [${t}]`),l.push(" values:")),l.push(o.map(u=>" "+u).join(` +`)}function OD(e,t,n,r){let s=Jt(t),a=r[r.length-1],o=new Array(a).fill(0),i=t.length,l=n==="complex64"?nc(e):e;if(i>1)for(let u=0;uL7){let g=ec*o,y=Array.from(e.slice(0,g)),A=Array.from(e.slice((i-ec)*o,i*o));return n==="complex64"&&(y=nc(y),A=nc(A)),["["+y.map((x,b)=>tc(x,s[b],n)).join(", ")+", ..., "+A.map((x,b)=>tc(x,s[i-ec+b],n)).join(", ")+"]"]}let m=n==="complex64"?nc(e):Array.from(e);return["["+m.map((g,y)=>tc(g,s[y],n)).join(", ")+"]"]}let u=t.slice(1),c=r.slice(1),d=r[0]*o,h=[];if(i>L7){for(let m=0;m`Length of values '${r}' does not match the size inferred by the shape '${this.size}'.`)}if(t==="complex64")throw new Error("complex64 dtype TensorBuffers are not supported. Please create a TensorBuffer for the real and imaginary parts separately and call tf.complex(real, imag).");this.values=n||U3(t,this.size),this.strides=Oi(e)}set(e,...t){t.length===0&&(t=[0]),L(t.length===this.rank,()=>`The number of provided coordinates (${t.length}) must match the rank (${this.rank})`);let n=this.locToIndex(t);this.values[n]=e}get(...e){e.length===0&&(e=[0]);let t=0;for(let r of e){if(r<0||r>=this.shape[t]){let s=`Requested out of range element at ${e}. Buffer shape=${this.shape}`;throw new Error(s)}t++}let n=e[e.length-1];for(let r=0;rip(n))}catch(n){throw new Error("Failed to decode the string bytes into utf-8. To get the original bytes, call tensor.bytes().")}}return e}dataSync(){this.throwIfDisposed();let e=Is().readSync(this.dataId);if(this.dtype==="string")try{return e.map(t=>ip(t))}catch(t){throw new Error("Failed to decode the string bytes into utf-8. To get the original bytes, call tensor.bytes().")}return e}async bytes(){this.throwIfDisposed();let e=await Is().read(this.dataId);return this.dtype==="string"?e:new Uint8Array(e.buffer)}dispose(){this.isDisposed||(Is().disposeTensor(this),this.isDisposedInternal=!0)}get isDisposed(){return this.isDisposedInternal}throwIfDisposed(){if(this.isDisposed)throw new Error("Tensor is disposed.")}print(e=!1){return Bi.print(this,e)}clone(){return this.throwIfDisposed(),Bi.clone(this)}toString(e=!1){let t=this.dataSync();return MD(t,this.shape,this.dtype,e)}cast(e){return this.throwIfDisposed(),Bi.cast(this,e)}variable(e=!0,t,n){return this.throwIfDisposed(),Is().makeVariable(this,e,t,n)}};Object.defineProperty(Tt,Symbol.hasInstance,{value:e=>!!e&&e.data!=null&&e.dataSync!=null&&e.throwIfDisposed!=null});function WD(){return o2("Tensor",()=>Tt)}WD();var rc=class extends Tt{constructor(e,t,n,r){super(e.shape,e.dtype,e.dataId,r);this.trainable=t,this.name=n}assign(e){if(e.dtype!==this.dtype)throw new Error(`dtype of the new value (${e.dtype}) and previous value (${this.dtype}) must match`);if(!Xs(e.shape,this.shape))throw new Error(`shape of the new value (${e.shape}) and previous value (${this.shape}) must match`);Is().disposeTensor(this),this.dataId=e.dataId,Is().incRef(this,null)}dispose(){Is().disposeVariable(this),this.isDisposedInternal=!0}};Object.defineProperty(rc,Symbol.hasInstance,{value:e=>e instanceof Tt&&e.assign!=null&&e.assign instanceof Function});var W7={};De(W7,{assertTypesMatch:()=>V7,getTensorsInContainer:()=>I2,isTensorInList:()=>HD,makeTypesMatch:()=>Vt});var x2;(function(e){e.R0="R0",e.R1="R1",e.R2="R2",e.R3="R3",e.R4="R4",e.R5="R5",e.R6="R6"})(x2||(x2={}));var b2;(function(e){e.float32="float32",e.int32="int32",e.bool="int32",e.complex64="complex64"})(b2||(b2={}));var v2;(function(e){e.float32="float32",e.int32="int32",e.bool="bool",e.complex64="complex64"})(v2||(v2={}));var w2;(function(e){e.float32="float32",e.int32="float32",e.bool="float32",e.complex64="complex64"})(w2||(w2={}));var k2;(function(e){e.float32="complex64",e.int32="complex64",e.bool="complex64",e.complex64="complex64"})(k2||(k2={}));var VD={float32:w2,int32:b2,bool:v2,complex64:k2};function cp(e,t){if(e==="string"||t==="string"){if(e==="string"&&t==="string")return"string";throw new Error(`Can not upcast ${e} with ${t}`)}return VD[e][t]}function UD(e){return cp(e,"int32")}function Vt(e,t){if(e.dtype===t.dtype)return[e,t];let n=cp(e.dtype,t.dtype);return[e.cast(n),t.cast(n)]}function V7(e,t){L(e.dtype===t.dtype,()=>`The dtypes of the first(${e.dtype}) and second(${t.dtype}) input must match`)}function HD(e,t){return t.some(n=>n.id===e.id)}function I2(e){let t=[],n=new Set;return U7(e,t,n),t}function U7(e,t,n){if(e==null)return;if(e instanceof Tt){t.push(e);return}if(!GD(e))return;let r=e;for(let s in r){let a=r[s];n.has(a)||(n.add(a),U7(a,t,n))}}function GD(e){return Array.isArray(e)||typeof e=="object"}function S2(e){return e.kernelName!=null}var H7=class{constructor(){this.registeredVariables={},this.nextTapeNodeId=0,this.numBytes=0,this.numTensors=0,this.numStringTensors=0,this.numDataBuffers=0,this.gradientDepth=0,this.kernelDepth=0,this.scopeStack=[],this.numDataMovesStack=[],this.nextScopeId=0,this.tensorInfo=new WeakMap,this.profiling=!1,this.activeProfile={newBytes:0,newTensors:0,peakBytes:0,kernels:[],result:null,get kernelNames(){return Array.from(new Set(this.kernels.map(e=>e.name)))}}}dispose(){for(let e in this.registeredVariables)this.registeredVariables[e].dispose()}},T2=class{constructor(e){this.ENV=e,this.registry={},this.registryFactory={},this.pendingBackendInitId=0,this.state=new H7}async ready(){if(this.pendingBackendInit!=null)return this.pendingBackendInit.then(()=>{});if(this.backendInstance!=null)return;let e=this.getSortedBackends();for(let t=0;t{t.setupFunc!=null&&t.setupFunc(this.backendInstance)})}disposeRegisteredKernels(e){Li(e).forEach(n=>{n.disposeFunc!=null&&n.disposeFunc(this.registry[e])})}initializeBackend(e){let t=this.registryFactory[e];if(t==null)throw new Error(`Cannot initialize backend ${e}, no registration found.`);try{let n=t.factory();if(n&&!(n instanceof L3)&&typeof n.then=="function"){let r=++this.pendingBackendInitId,s=n.then(a=>r(rthis.registryFactory[t].priority-this.registryFactory[e].priority)}initializeBackendsAndReturnBest(){let e=this.getSortedBackends();for(let t=0;tthis.startScope(n),()=>this.endScope(r),()=>(r=t(),r instanceof Promise&&console.error("Cannot return a Promise inside of tidy."),r))}scopedRun(e,t,n){e();try{let r=n();return t(),r}catch(r){throw t(),r}}nextTensorId(){return T2.nextTensorId++}nextVariableId(){return T2.nextVariableId++}clone(e){let t=U.runKernel(u2,{x:e}),n={x:e},r=a=>({x:()=>{let o="float32",i={x:a},l={dtype:o};return U.runKernel(l2,i,l)}}),s=[];return this.addTapeNode(this.state.activeScope.name,n,[t],r,s,{}),t}runKernel(e,t,n){if(!(rp(e,this.backendName)!=null))throw new Error(`Kernel '${e}' not registered for backend '${this.backendName}'`);return this.runKernelFunc({kernelName:e,inputs:t,attrs:n})}shouldCheckForMemLeaks(){return this.ENV.getBool("IS_TEST")}checkKernelForMemLeak(e,t,n){let r=this.backend.numDataIds(),s=0;n.forEach(i=>{s+=i.dtype==="complex64"?3:1});let a=this.state.numDataMovesStack[this.state.numDataMovesStack.length-1],o=r-t-s-a;if(o>0)throw new Error(`Backend '${this.backendName}' has an internal memory leak (${o} data ids) after running '${e}'`)}runKernelFunc(e){let t,n=[],r=this.isTapeOn(),s=this.state.numBytes,a=this.state.numTensors;this.shouldCheckForMemLeaks()&&this.state.numDataMovesStack.push(0);let o;this.backendName==null&&this.backend;let i,l=S2(e)?e.kernelName:this.state.activeScope!=null?this.state.activeScope.name:"";if(S2(e)){let{kernelName:p,inputs:f,attrs:m}=e;this.backendName==null&&this.backend;let g=rp(p,this.backendName);L(g!=null,()=>`Cannot find registered kernel '${p}' for backend '${this.backendName}'`),o=()=>{let y=this.backend.numDataIds();i=g.kernelFunc({inputs:f,attrs:m,backend:this.backend});let A=Array.isArray(i)?i:[i];this.shouldCheckForMemLeaks()&&this.checkKernelForMemLeak(p,y,A);let x=A.map(b=>{if(b.rank!=null)return b;let{dataId:v,shape:w,dtype:I}=b;return this.makeTensorFromDataId(v,w,I)});if(r){let b=this.getTensorsForGradient(p,f,x);n=this.saveTensorsForBackwardMode(b)}return x}}else{let{forwardFunc:p}=e,f=m=>{!r||(n=m.map(g=>this.keep(this.clone(g))))};o=()=>{let m=this.backend.numDataIds();i=this.tidy(()=>p(this.backend,f));let g=Array.isArray(i)?i:[i];return this.shouldCheckForMemLeaks()&&this.checkKernelForMemLeak(l,m,g),g}}let{inputs:u,attrs:c}=e,d=S2(e)?null:e.backwardsFunc,h;return this.scopedRun(()=>this.state.kernelDepth++,()=>this.state.kernelDepth--,()=>{!this.ENV.getBool("DEBUG")&&!this.state.profiling?t=o():(h=this.profiler.profileKernel(l,u,()=>o()),this.ENV.getBool("DEBUG")&&this.profiler.logKernelProfile(h),t=h.outputs)}),r&&this.addTapeNode(l,u,t,d,n,c),this.state.profiling&&this.state.activeProfile.kernels.push({name:l,bytesAdded:this.state.numBytes-s,totalBytesSnapshot:this.state.numBytes,tensorsAdded:this.state.numTensors-a,totalTensorsSnapshot:this.state.numTensors,inputShapes:Object.keys(u).map(p=>u[p]!=null?u[p].shape:null),outputShapes:t.map(p=>p.shape),kernelTimeMs:h.timeMs,extraInfo:h.extraInfo}),Array.isArray(i)?t:t[0]}saveTensorsForBackwardMode(e){return e.map(n=>this.keep(this.clone(n)))}getTensorsForGradient(e,t,n){let r=m2(e);if(r!=null){let s=r.inputsToSave||[],a=r.outputsToSave||[],o;r.saveAllInputs?(L(Array.isArray(t),()=>"saveAllInputs is true, expected inputs to be an array."),o=Object.keys(t).map(l=>t[l])):o=s.map(l=>t[l]);let i=n.filter((l,u)=>a[u]);return o.concat(i)}return[]}makeTensor(e,t,n,r){if(e==null)throw new Error("Values passed to engine.makeTensor() are null");n=n||"float32",r=r||this.backend;let s=e;n==="string"&&Ia(e[0])&&(s=e.map(i=>Qu(i)));let a=r.write(s,t,n),o=new Tt(t,n,a,this.nextTensorId());if(this.trackTensor(o,r),n==="string"){let i=this.state.tensorInfo.get(a),l=j3(s);this.state.numBytes+=l-i.bytes,i.bytes=l}return o}makeTensorFromDataId(e,t,n,r){n=n||"float32";let s=new Tt(t,n,e,this.nextTensorId());return this.trackTensor(s,r),s}makeVariable(e,t=!0,n,r){n=n||this.nextVariableId().toString(),r!=null&&r!==e.dtype&&(e=e.cast(r));let s=new rc(e,t,n,this.nextTensorId());if(this.state.registeredVariables[s.name]!=null)throw new Error(`Variable with name ${s.name} was already registered`);return this.state.registeredVariables[s.name]=s,this.incRef(s,this.backend),s}trackTensor(e,t){this.state.numTensors++,e.dtype==="string"&&this.state.numStringTensors++;let n=0;e.dtype!=="complex64"&&e.dtype!=="string"&&(n=e.size*t2(e.dtype)),this.state.numBytes+=n,this.state.tensorInfo.has(e.dataId)||(this.state.numDataBuffers++,this.state.tensorInfo.set(e.dataId,{backend:t||this.backend,dtype:e.dtype,shape:e.shape,bytes:n})),e instanceof rc||this.track(e)}incRef(e,t){this.trackTensor(e,t),this.backend.incRef(e.dataId)}removeDataId(e,t){this.state.tensorInfo.has(e)&&this.state.tensorInfo.get(e).backend===t&&(this.state.tensorInfo.delete(e),this.state.numDataBuffers--)}disposeTensor(e){if(!this.state.tensorInfo.has(e.dataId))return;let t=this.state.tensorInfo.get(e.dataId);if(this.state.numTensors--,e.dtype==="string"&&(this.state.numStringTensors--,this.state.numBytes-=t.bytes),e.dtype!=="complex64"&&e.dtype!=="string"){let n=e.size*t2(e.dtype);this.state.numBytes-=n}t.backend.disposeData(e.dataId)&&this.removeDataId(e.dataId,t.backend)}disposeVariables(){for(let e in this.state.registeredVariables){let t=this.state.registeredVariables[e];this.disposeVariable(t)}}disposeVariable(e){this.disposeTensor(e),this.state.registeredVariables[e.name]!=null&&delete this.state.registeredVariables[e.name]}memory(){let e=this.backend.memory();return e.numTensors=this.state.numTensors,e.numDataBuffers=this.state.numDataBuffers,e.numBytes=this.state.numBytes,this.state.numStringTensors>0&&(e.unreliable=!0,e.reasons==null&&(e.reasons=[]),e.reasons.push("Memory usage by string tensors is approximate (2 bytes per character)")),e}async profile(e){this.state.profiling=!0;let t=this.state.numBytes,n=this.state.numTensors;this.state.activeProfile.kernels=[],this.state.activeProfile.result=await e(),this.state.profiling=!1,this.state.activeProfile.peakBytes=Math.max(...this.state.activeProfile.kernels.map(r=>r.totalBytesSnapshot)),this.state.activeProfile.newBytes=this.state.numBytes-t,this.state.activeProfile.newTensors=this.state.numTensors-n;for(let r of this.state.activeProfile.kernels)r.kernelTimeMs=await r.kernelTimeMs,r.extraInfo=await r.extraInfo;return this.state.activeProfile}isTapeOn(){return this.state.gradientDepth>0&&this.state.kernelDepth===0}addTapeNode(e,t,n,r,s,a){let o={id:this.state.nextTapeNodeId++,kernelName:e,inputs:t,outputs:n,saved:s},i=m2(e);i!=null&&(r=i.gradFunc),r!=null&&(o.gradient=l=>(l=l.map((u,c)=>{if(u==null){let d=n[c],h=np(d.size,d.dtype);return this.makeTensor(h,d.shape,d.dtype)}return u}),r(l.length>1?l:l[0],s,a))),this.state.activeTape.push(o)}keep(e){return e.kept=!0,e}startTape(){this.state.gradientDepth===0&&(this.state.activeTape=[]),this.state.gradientDepth++}endTape(){this.state.gradientDepth--}startScope(e){let t={track:[],name:"unnamed scope",id:this.state.nextScopeId++};e&&(t.name=e),this.state.scopeStack.push(t),this.state.activeScope=t}endScope(e){let t=I2(e),n=new Set(t.map(s=>s.id));for(let s=0;s{!s.kept&&s.scopeId===r.id&&this.track(s)})}gradients(e,t,n,r=!1){if(L(t.length>0,()=>"gradients() received an empty list of xs."),n!=null&&n.dtype!=="float32")throw new Error(`dy must have 'float32' dtype, but has '${n.dtype}'`);let s=this.scopedRun(()=>this.startTape(),()=>this.endTape(),()=>this.tidy("forward",e));L(s instanceof Tt,()=>"The result y returned by f() must be a tensor.");let a=DD(this.state.activeTape,t,s);if(!r&&a.length===0&&t.length>0)throw new Error("Cannot compute gradient of y=f(x) with respect to x. Make sure that the f you passed encloses all operations that lead from x to y.");return this.tidy("backward",()=>{let o={};o[s.id]=n==null?jD(s.shape):n,FD(o,a,l=>this.tidy(l),qD);let i=t.map(l=>o[l.id]);return this.state.gradientDepth===0&&(this.state.activeTape.forEach(l=>{for(let u of l.saved)u.dispose()}),this.state.activeTape=null),{value:s,grads:i}})}customGrad(e){return L(Sa(e),()=>"The f passed in customGrad(f) must be a function."),(...t)=>{L(t.every(o=>o instanceof Tt),()=>"The args passed in customGrad(f)(x1, x2,...) must all be tensors");let n,r={};t.forEach((o,i)=>{r[i]=o});let s=(o,i)=>(n=e(...t,i),L(n.value instanceof Tt,()=>"The function f passed in customGrad(f) must return an object where `obj.value` is a tensor"),L(Sa(n.gradFunc),()=>"The function f passed in customGrad(f) must return an object where `obj.gradFunc` is a function."),n.value),a=(o,i)=>{let l=n.gradFunc(o,i),u=Array.isArray(l)?l:[l];L(u.length===t.length,()=>"The function f passed in customGrad(f) must return an object where `obj.gradFunc` is a function that returns the same number of tensors as inputs passed to f(...)."),L(u.every(d=>d instanceof Tt),()=>"The function f passed in customGrad(f) must return an object where `obj.gradFunc` is a function that returns a list of only tensors.");let c={};return u.forEach((d,h)=>{c[h]=()=>d}),c};return this.runKernelFunc({forwardFunc:s,backwardsFunc:a,inputs:r})}}readSync(e){return this.state.tensorInfo.get(e).backend.readSync(e)}read(e){return this.state.tensorInfo.get(e).backend.read(e)}async time(e){let t=Ju(),n=await this.backend.time(e);return n.wallMs=Ju()-t,n}track(e){return this.state.activeScope!=null&&(e.scopeId=this.state.activeScope.id,this.state.activeScope.track.push(e)),e}get registeredVariables(){return this.state.registeredVariables}reset(){this.pendingBackendInitId++,this.state.dispose(),this.ENV.reset(),this.state=new H7;for(let e in this.registry)this.disposeRegisteredKernels(e),this.registry[e].dispose(),delete this.registry[e];this.backendName=null,this.backendInstance=null,this.pendingBackendInit=null}},N2=T2;N2.nextTensorId=0;N2.nextVariableId=0;function jD(e){let t=n2(Jt(e),"float32");return U.makeTensor(t,e,"float32")}function G7(){let e=J3();if(e._tfengine==null){let t=new Y3(e);e._tfengine=new N2(t)}return tD(e._tfengine.ENV),zD(()=>e._tfengine),e._tfengine}var U=G7();function qD(e,t){let n={a:e,b:t};return U.runKernel(i2,n)}var j7={};De(j7,{isBrowser:()=>q7,isMobile:()=>XD});function KD(){return typeof navigator!="undefined"&&navigator!=null}function XD(e){if(e||KD()){if(e||(e=navigator),e.product==="ReactNative")return!0;let t=e.userAgent||e.vendor||window.opera;return/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(t)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(t.substr(0,4))}return!1}function q7(){return typeof window!="undefined"&&window.document!=null||typeof WorkerGlobalScope!="undefined"}var es=ct();es.registerFlag("DEBUG",()=>!1,e=>{e&&console.warn("Debugging mode is ON. The output of every math call will be downloaded to CPU and checked for NaNs. This significantly impacts performance.")});es.registerFlag("IS_BROWSER",()=>q7());es.registerFlag("IS_NODE",()=>typeof process!="undefined"&&typeof process.versions!="undefined"&&typeof process.versions.node!="undefined");es.registerFlag("IS_CHROME",()=>typeof navigator!="undefined"&&navigator!=null&&navigator.userAgent!=null&&/Chrome/.test(navigator.userAgent)&&/Google Inc/.test(navigator.vendor));es.registerFlag("PROD",()=>!1);es.registerFlag("TENSORLIKE_CHECK_SHAPE_CONSISTENCY",()=>es.getBool("DEBUG"));es.registerFlag("DEPRECATION_WARNINGS_ENABLED",()=>!0);es.registerFlag("IS_TEST",()=>!1);es.registerFlag("CHECK_COMPUTATION_FOR_ERRORS",()=>!0);es.registerFlag("WRAP_TO_IMAGEBITMAP",()=>!1);function Ss(e,t){let n=e;if(Cn(e))return t==="string"?[]:[e.length];if(!Array.isArray(e))return[];let r=[];for(;Array.isArray(n)||Cn(n)&&t!=="string";)r.push(n.length),n=n[0];return Array.isArray(e)&&ct().getBool("TENSORLIKE_CHECK_SHAPE_CONSISTENCY")&&K7(e,r,[]),r}function K7(e,t,n){if(n=n||[],!Array.isArray(e)&&!Cn(e)){L(t.length===0,()=>`Element arr[${n.join("][")}] is a primitive, but should be an array/TypedArray of ${t[0]} elements`);return}L(t.length>0,()=>`Element arr[${n.join("][")}] should be a primitive, but is an array of ${e.length} elements`),L(e.length===t[0],()=>`Element arr[${n.join("][")}] should have ${t[0]} elements, but has ${e.length} elements`);let r=t.slice(1);for(let s=0;s=0&&(s=r),X7(r,s,t,n),e==null||!Cn(e)&&!Array.isArray(e)&&typeof e!="number"&&typeof e!="boolean"&&typeof e!="string"){let l=e==null?"null":e.constructor.name;throw new Error(`Argument '${t}' passed to '${n}' must be a Tensor or TensorLike, but got '${l}'`)}let a=Ss(e,s);!Cn(e)&&!Array.isArray(e)&&(e=[e]);let i=s!=="string"?op(e,s):po(e,[],!0);return U.makeTensor(i,a,s)}function sc(e,t,n,r="numeric"){if(!Array.isArray(e))throw new Error(`Argument ${t} passed to ${n} must be a \`Tensor[]\` or \`TensorLike[]\``);return e.map((a,o)=>P(a,`${t}[${o}]`,n,r))}var Z7="__op";function H(e){let t=Object.keys(e);if(t.length!==1)throw new Error(`Please provide an object with a single key (operation name) mapping to a function. Got an object with ${t.length} keys.`);let n=t[0],r=e[n];n.endsWith("_")&&(n=n.substring(0,n.length-1)),n=n+Z7;let s=(...a)=>{U.startScope(n);try{let o=r(...a);return s2(o)&&console.error("Cannot return a Promise inside of tidy."),U.endScope(o),o}catch(o){throw U.endScope(null),o}};return Object.defineProperty(s,"name",{value:n,configurable:!0}),s}function ZD(e,t){let n=P(e,"real","complex"),r=P(t,"imag","complex");Mn(n.shape,r.shape,`real and imag shapes, ${n.shape} and ${r.shape}, must match in call to tf.complex().`);let s={real:n,imag:r};return U.runKernel(xv,s)}var go=H({complex_:ZD});function Na(e,t,n,r){if(r==null&&(r=ep(e)),r==="complex64")throw new Error("Cannot construct a complex64 tensor directly. Please use tf.complex(real, imag).");if(!Cn(e)&&!Array.isArray(e)&&typeof e!="number"&&typeof e!="boolean"&&typeof e!="string")throw new Error("values passed to tensor(values) must be a number/boolean/string or an array of numbers/booleans/strings, or a TypedArray");if(t!=null){r2(t);let s=Jt(t),a=Jt(n);L(s===a,()=>`Based on the provided shape, [${t}], the tensor should have ${s} values but has ${a}`);for(let o=0;o`Error creating a new Tensor. Inferred shape (${n}) does not match the provided shape (${t}). `)}}return!Cn(e)&&!Array.isArray(e)&&(e=[e]),t=t||n,e=r!=="string"?op(e,r):po(e,[],!0),U.makeTensor(e,t,r)}function ts(e,t,n){let r=Ss(e,n);return Na(e,t,r,n)}var C2={float32:4,float16:2,int32:4,uint16:2,uint8:1,bool:1,complex64:8},dp=4;async function YD(e,t){let n=[],r=[],s=Array.isArray(e)?e.map(o=>o.name):Object.keys(e);for(let o=0;o{let h=await l.bytes(),p=h.reduce((g,y)=>g+y.length,0)+dp*h.length,f=new Uint8Array(p),m=0;for(let g=0;g{if(t+=a.byteLength,n.push(a.byteLength===a.buffer.byteLength?a:new a.constructor(a)),!(a instanceof Float32Array||a instanceof Int32Array||a instanceof Uint8Array))throw new Error(`Unsupported TypedArray subtype: ${a.constructor.name}`)});let r=new Uint8Array(t),s=0;return n.forEach(a=>{r.set(new Uint8Array(a.buffer),s),s+=a.byteLength}),r.buffer}var E2=typeof Buffer!="undefined"&&(typeof Blob=="undefined"||typeof atob=="undefined"||typeof btoa=="undefined");function J7(e){return E2?Buffer.byteLength(e):new Blob([e]).size}function QD(e){if(E2)return Buffer.from(e).toString("base64");let t=new Uint8Array(e),n="";for(let r=0,s=t.length;r{t+=s.byteLength});let n=new Uint8Array(t),r=0;return e.forEach(s=>{n.set(new Uint8Array(s),r),r+=s.byteLength}),n.buffer}function Q7(e){let t="/";for(e=e.trim();e.endsWith(t);)e=e.slice(0,e.length-1);let n=e.split(t);return n[n.length-1]}function ac(e){if(e.modelTopology instanceof ArrayBuffer)throw new Error("Expected JSON model topology, received ArrayBuffer.");return{dateSaved:new Date,modelTopologyType:"JSON",modelTopologyBytes:e.modelTopology==null?0:J7(JSON.stringify(e.modelTopology)),weightSpecsBytes:e.weightSpecs==null?0:J7(JSON.stringify(e.weightSpecs)),weightDataBytes:e.weightData==null?0:e.weightData.byteLength}}function tF(){let e=n=>{let r=n<<13,s=0;for(;(r&8388608)==0;)s-=8388608,r<<=1;return r&=~8388608,s+=947912704,r|s},t=new Uint32Array(2048);t[0]=0;for(let n=1;n<1024;n++)t[n]=e(n);for(let n=1024;n<2048;n++)t[n]=939524096+(n-1024<<13);return t}function nF(){let e=new Uint32Array(64);e[0]=0,e[31]=1199570944,e[32]=2147483648,e[63]=3347054592;for(let t=1;t<31;t++)e[t]=t<<23;for(let t=33;t<63;t++)e[t]=2147483648+(t-32<<23);return e}function rF(){let e=new Uint32Array(64);for(let t=0;t<64;t++)e[t]=1024;return e[0]=e[32]=0,e}function sF(){let e=tF(),t=nF(),n=rF();return r=>{let s=new ArrayBuffer(4*r.length),a=new Uint32Array(s);for(let o=0;o>10]+(i&1023)]+t[i>>10];a[o]=l}return new Float32Array(s)}}var jt=class{constructor(){this.saveRouters=[],this.loadRouters=[]}static getInstance(){return jt.instance==null&&(jt.instance=new jt),jt.instance}static registerSaveRouter(e){jt.getInstance().saveRouters.push(e)}static registerLoadRouter(e){jt.getInstance().loadRouters.push(e)}static getSaveHandlers(e){return jt.getHandlers(e,"save")}static getLoadHandlers(e,t){return jt.getHandlers(e,"load",t)}static getHandlers(e,t,n){let r=[];return(t==="load"?jt.getInstance().loadRouters:jt.getInstance().saveRouters).forEach(a=>{let o=a(e,n);o!==null&&r.push(o)}),r}},aF=e=>jt.registerSaveRouter(e),oF=e=>jt.registerLoadRouter(e),iF=e=>jt.getSaveHandlers(e),lF=(e,t)=>jt.getLoadHandlers(e,t),_2="tensorflowjs",R2=1,yo="models_store",Ca="model_info_store";function ek(){if(!ct().getBool("IS_BROWSER"))throw new Error("Failed to obtain IndexedDB factory because the current environmentis not a web browser.");let e=typeof window=="undefined"?self:window,t=e.indexedDB||e.mozIndexedDB||e.webkitIndexedDB||e.msIndexedDB||e.shimIndexedDB;if(t==null)throw new Error("The current browser does not appear to support IndexedDB.");return t}function D2(e){let t=e.result;t.createObjectStore(yo,{keyPath:"modelPath"}),t.createObjectStore(Ca,{keyPath:"modelPath"})}var Ao=class{constructor(e){if(this.indexedDB=ek(),e==null||!e)throw new Error("For IndexedDB, modelPath must not be null, undefined or empty.");this.modelPath=e}async save(e){if(e.modelTopology instanceof ArrayBuffer)throw new Error("BrowserLocalStorage.save() does not support saving model topology in binary formats yet.");return this.databaseAction(this.modelPath,e)}async load(){return this.databaseAction(this.modelPath)}databaseAction(e,t){return new Promise((n,r)=>{let s=this.indexedDB.open(_2,R2);s.onupgradeneeded=()=>D2(s),s.onsuccess=()=>{let a=s.result;if(t==null){let o=a.transaction(yo,"readonly"),l=o.objectStore(yo).get(this.modelPath);l.onsuccess=()=>{if(l.result==null)return a.close(),r(new Error(`Cannot find model with path '${this.modelPath}' in IndexedDB.`));n(l.result.modelArtifacts)},l.onerror=u=>(a.close(),r(l.error)),o.oncomplete=()=>a.close()}else{let o=ac(t),i=a.transaction(Ca,"readwrite"),l=i.objectStore(Ca),u=l.put({modelPath:this.modelPath,modelArtifactsInfo:o}),c;u.onsuccess=()=>{c=a.transaction(yo,"readwrite");let h=c.objectStore(yo).put({modelPath:this.modelPath,modelArtifacts:t,modelArtifactsInfo:o});h.onsuccess=()=>n({modelArtifactsInfo:o}),h.onerror=p=>{l=i.objectStore(Ca);let f=l.delete(this.modelPath);f.onsuccess=()=>(a.close(),r(h.error)),f.onerror=m=>(a.close(),r(h.error))}},u.onerror=d=>(a.close(),r(u.error)),i.oncomplete=()=>{c==null?a.close():c.oncomplete=()=>a.close()}}},s.onerror=a=>r(s.error)})}};Ao.URL_SCHEME="indexeddb://";var tk=e=>ct().getBool("IS_BROWSER")&&!Array.isArray(e)&&e.startsWith(Ao.URL_SCHEME)?uF(e.slice(Ao.URL_SCHEME.length)):null;jt.registerSaveRouter(tk);jt.registerLoadRouter(tk);function uF(e){return new Ao(e)}function cF(e){return e.startsWith(Ao.URL_SCHEME)?e.slice(Ao.URL_SCHEME.length):e}var dF=class{constructor(){this.indexedDB=ek()}async listModels(){return new Promise((e,t)=>{let n=this.indexedDB.open(_2,R2);n.onupgradeneeded=()=>D2(n),n.onsuccess=()=>{let r=n.result,s=r.transaction(Ca,"readonly"),o=s.objectStore(Ca).getAll();o.onsuccess=()=>{let i={};for(let l of o.result)i[l.modelPath]=l.modelArtifactsInfo;e(i)},o.onerror=i=>(r.close(),t(o.error)),s.oncomplete=()=>r.close()},n.onerror=r=>t(n.error)})}async removeModel(e){return e=cF(e),new Promise((t,n)=>{let r=this.indexedDB.open(_2,R2);r.onupgradeneeded=()=>D2(r),r.onsuccess=()=>{let s=r.result,a=s.transaction(Ca,"readwrite"),o=a.objectStore(Ca),i=o.get(e),l;i.onsuccess=()=>{if(i.result==null)return s.close(),n(new Error(`Cannot find model with path '${e}' in IndexedDB.`));{let u=o.delete(e),c=()=>{l=s.transaction(yo,"readwrite");let h=l.objectStore(yo).delete(e);h.onsuccess=()=>t(i.result.modelArtifactsInfo),h.onerror=p=>n(i.error)};u.onsuccess=c,u.onerror=d=>(c(),s.close(),n(i.error))}},i.onerror=u=>(s.close(),n(i.error)),a.oncomplete=()=>{l==null?s.close():l.oncomplete=()=>s.close()}},r.onerror=s=>n(r.error)})}},Zs="/",Wi="tensorflowjs_models",nk="info",hF="model_topology",pF="weight_specs",fF="weight_data",mF="model_metadata";function rk(e){return{info:[Wi,e,nk].join(Zs),topology:[Wi,e,hF].join(Zs),weightSpecs:[Wi,e,pF].join(Zs),weightData:[Wi,e,fF].join(Zs),modelMetadata:[Wi,e,mF].join(Zs)}}function gF(e){let t=e.split(Zs);if(t.length<3)throw new Error(`Invalid key format: ${e}`);return t.slice(1,t.length-1).join(Zs)}function yF(e){return e.startsWith(xo.URL_SCHEME)?e.slice(xo.URL_SCHEME.length):e}var xo=class{constructor(e){if(!ct().getBool("IS_BROWSER")||typeof window=="undefined"||typeof window.localStorage=="undefined")throw new Error("The current environment does not support local storage.");if(this.LS=window.localStorage,e==null||!e)throw new Error("For local storage, modelPath must not be null, undefined or empty.");this.modelPath=e,this.keys=rk(this.modelPath)}async save(e){if(e.modelTopology instanceof ArrayBuffer)throw new Error("BrowserLocalStorage.save() does not support saving model topology in binary formats yet.");{let t=JSON.stringify(e.modelTopology),n=JSON.stringify(e.weightSpecs),r=ac(e);try{this.LS.setItem(this.keys.info,JSON.stringify(r)),this.LS.setItem(this.keys.topology,t),this.LS.setItem(this.keys.weightSpecs,n),this.LS.setItem(this.keys.weightData,QD(e.weightData));let s={format:e.format,generatedBy:e.generatedBy,convertedBy:e.convertedBy};return e.signature!=null&&(s.signature=e.signature),e.userDefinedMetadata!=null&&(s.userDefinedMetadata=e.userDefinedMetadata),e.modelInitializer!=null&&(s.modelInitializer=e.modelInitializer),this.LS.setItem(this.keys.modelMetadata,JSON.stringify(s)),{modelArtifactsInfo:r}}catch(s){throw this.LS.removeItem(this.keys.info),this.LS.removeItem(this.keys.topology),this.LS.removeItem(this.keys.weightSpecs),this.LS.removeItem(this.keys.weightData),this.LS.removeItem(this.keys.modelMetadata),new Error(`Failed to save model '${this.modelPath}' to local storage: size quota being exceeded is a possible cause of this failure: modelTopologyBytes=${r.modelTopologyBytes}, weightSpecsBytes=${r.weightSpecsBytes}, weightDataBytes=${r.weightDataBytes}.`)}}}async load(){let e=JSON.parse(this.LS.getItem(this.keys.info));if(e==null)throw new Error(`In local storage, there is no model with name '${this.modelPath}'`);if(e.modelTopologyType!=="JSON")throw new Error("BrowserLocalStorage does not support loading non-JSON model topology yet.");let t={},n=JSON.parse(this.LS.getItem(this.keys.topology));if(n==null)throw new Error(`In local storage, the topology of model '${this.modelPath}' is missing.`);t.modelTopology=n;let r=JSON.parse(this.LS.getItem(this.keys.weightSpecs));if(r==null)throw new Error(`In local storage, the weight specs of model '${this.modelPath}' are missing.`);t.weightSpecs=r;let s=this.LS.getItem(this.keys.modelMetadata);if(s!=null){let o=JSON.parse(s);t.format=o.format,t.generatedBy=o.generatedBy,t.convertedBy=o.convertedBy,o.signature!=null&&(t.signature=o.signature),o.userDefinedMetadata!=null&&(t.userDefinedMetadata=o.userDefinedMetadata),o.modelInitializer!=null&&(t.modelInitializer=o.modelInitializer)}let a=this.LS.getItem(this.keys.weightData);if(a==null)throw new Error(`In local storage, the binary weight values of model '${this.modelPath}' are missing.`);return t.weightData=eF(a),t}};xo.URL_SCHEME="localstorage://";var sk=e=>ct().getBool("IS_BROWSER")&&!Array.isArray(e)&&e.startsWith(xo.URL_SCHEME)?AF(e.slice(xo.URL_SCHEME.length)):null;jt.registerSaveRouter(sk);jt.registerLoadRouter(sk);function AF(e){return new xo(e)}var xF=class{constructor(){L(ct().getBool("IS_BROWSER"),()=>"Current environment is not a web browser"),L(typeof window=="undefined"||typeof window.localStorage!="undefined",()=>"Current browser does not appear to support localStorage"),this.LS=window.localStorage}async listModels(){let e={},t=Wi+Zs,n=Zs+nk;for(let r=0;r"scheme must not be undefined or null."),e.endsWith(Vi)&&(e=e.slice(0,e.indexOf(Vi))),L(e.length>0,()=>"scheme must not be an empty string.");let n=Tr.getInstance();L(n.managers[e]==null,()=>`A model store manager is already registered for scheme '${e}'.`),n.managers[e]=t}static getManager(e){let t=this.getInstance().managers[e];if(t==null)throw new Error(`Cannot find model manager for scheme '${e}'`);return t}static getSchemes(){return Object.keys(this.getInstance().managers)}};function hp(e){if(e.indexOf(Vi)===-1)throw new Error(`The url string provided does not contain a scheme. Supported schemes are: ${Tr.getSchemes().join(",")}`);return{scheme:e.split(Vi)[0],path:e.split(Vi)[1]}}async function ak(e,t,n=!1){L(e!==t,()=>`Old path and new path are the same: '${e}'`);let r=jt.getLoadHandlers(e);L(r.length>0,()=>`Copying failed because no load handler is found for source URL ${e}.`),L(r.length<2,()=>`Copying failed because more than one (${r.length}) load handlers for source URL ${e}.`);let s=r[0],a=jt.getSaveHandlers(t);L(a.length>0,()=>`Copying failed because no save handler is found for destination URL ${t}.`),L(a.length<2,()=>`Copying failed because more than one (${r.length}) save handlers for destination URL ${t}.`);let o=a[0],i=hp(e).scheme,l=hp(e).path,u=i===hp(e).scheme,c=await s.load();n&&u&&await Tr.getManager(i).removeModel(l);let d=await o.save(c);return n&&!u&&await Tr.getManager(i).removeModel(l),d.modelArtifactsInfo}async function bF(){let e=Tr.getSchemes(),t={};for(let n of e){let r=await Tr.getManager(n).listModels();for(let s in r){let a=n+Vi+s;t[a]=r[s]}}return t}async function vF(e){let t=hp(e);return Tr.getManager(t.scheme).removeModel(t.path)}async function wF(e,t){return ak(e,t,!1)}async function kF(e,t){return ak(e,t,!0)}var IF=class{fetch(e,t){return fetch(e,t)}now(){return performance.now()}encode(e,t){if(t!=="utf-8"&&t!=="utf8")throw new Error(`Browser's encoder only supports utf-8, but got ${t}`);return this.textEncoder==null&&(this.textEncoder=new TextEncoder),this.textEncoder.encode(e)}decode(e,t){return new TextDecoder(t).decode(e)}};if(ct().get("IS_BROWSER")){ct().setPlatform("browser",new IF);try{Tr.registerManager(xo.URL_SCHEME,new xF)}catch(e){}try{Tr.registerManager(Ao.URL_SCHEME,new dF)}catch(e){}}var SF={importFetch:()=>O3()},F2,TF=class{constructor(){this.util=co("util"),this.textEncoder=new this.util.TextEncoder}fetch(e,t){return ct().global.fetch!=null?ct().global.fetch(e,t):(F2==null&&(F2=SF.importFetch()),F2(e,t))}now(){let e=process.hrtime();return e[0]*1e3+e[1]/1e6}encode(e,t){if(t!=="utf-8"&&t!=="utf8")throw new Error(`Node built-in encoder only supports utf-8, but got ${t}`);return this.textEncoder.encode(e)}decode(e,t){return e.length===0?"":new this.util.TextDecoder(t).decode(e)}};ct().get("IS_NODE")&&ct().setPlatform("node",new TF);function Ys(e,t="float32",n){return t=t||"float32",r2(e),new up(e,t,n)}function NF(e,t){let n=P(e,"x","cast");if(!G3(t))throw new Error(`Failed to cast to unknown dtype ${t}`);if(t==="string"&&n.dtype!=="string"||t!=="string"&&n.dtype==="string")throw new Error("Only strings can be casted to strings");let r={x:n},s={dtype:t};return U.runKernel(l2,r,s)}var Pt=H({cast_:NF});function CF(e){let n={x:P(e,"x","clone","string_or_numeric")};return U.runKernel(u2,n)}var Js=H({clone_:CF});function ok(e,t=!1){console.log(e.toString(t))}G7();var EF={buffer:Ys,cast:Pt,clone:Js,print:ok};LD(EF);var ik={};De(ik,{browserFiles:()=>OF,browserHTTPRequest:()=>WF,concatenateArrayBuffers:()=>$2,copyModel:()=>wF,decodeWeights:()=>Y7,encodeWeights:()=>YD,fromMemory:()=>UF,getLoadHandlers:()=>lF,getModelArtifactsInfoForJSON:()=>ac,getSaveHandlers:()=>iF,http:()=>z2,isHTTPScheme:()=>P2,listModels:()=>bF,loadWeights:()=>PF,moveModel:()=>kF,registerLoadRouter:()=>oF,registerSaveRouter:()=>aF,removeModel:()=>vF,weightsLoaderFactory:()=>dk,withSaveHandler:()=>HF});var $F="model",_F=".json",RF=".weights.bin";function lk(e){return new Promise(t=>setTimeout(t)).then(e)}var M2=class{constructor(e){if(!ct().getBool("IS_BROWSER"))throw new Error("browserDownloads() cannot proceed because the current environment is not a browser.");e.startsWith(M2.URL_SCHEME)&&(e=e.slice(M2.URL_SCHEME.length)),(e==null||e.length===0)&&(e=$F),this.modelTopologyFileName=e+_F,this.weightDataFileName=e+RF}async save(e){if(typeof document=="undefined")throw new Error("Browser downloads are not supported in this environment since `document` is not present");let t=window.URL.createObjectURL(new Blob([e.weightData],{type:"application/octet-stream"}));if(e.modelTopology instanceof ArrayBuffer)throw new Error("BrowserDownloads.save() does not support saving model topology in binary formats yet.");{let n=[{paths:["./"+this.weightDataFileName],weights:e.weightSpecs}],r={modelTopology:e.modelTopology,format:e.format,generatedBy:e.generatedBy,convertedBy:e.convertedBy,weightsManifest:n};e.signature!=null&&(r.signature=e.signature),e.userDefinedMetadata!=null&&(r.userDefinedMetadata=e.userDefinedMetadata),e.modelInitializer!=null&&(r.modelInitializer=e.modelInitializer);let s=window.URL.createObjectURL(new Blob([JSON.stringify(r)],{type:"application/json"})),a=this.jsonAnchor==null?document.createElement("a"):this.jsonAnchor;if(a.download=this.modelTopologyFileName,a.href=s,await lk(()=>a.dispatchEvent(new MouseEvent("click"))),e.weightData!=null){let o=this.weightDataAnchor==null?document.createElement("a"):this.weightDataAnchor;o.download=this.weightDataFileName,o.href=t,await lk(()=>o.dispatchEvent(new MouseEvent("click")))}return{modelArtifactsInfo:ac(e)}}}},pp=M2;pp.URL_SCHEME="downloads://";var DF=class{constructor(e){if(e==null||e.length<1)throw new Error(`When calling browserFiles, at least 1 file is required, but received ${e}`);this.files=e}async load(){let e=this.files[0],t=this.files.slice(1);return new Promise((n,r)=>{let s=new FileReader;s.onload=a=>{let o=JSON.parse(a.target.result),i=o.modelTopology;if(i==null){r(new Error(`modelTopology field is missing from file ${e.name}`));return}t.length===0&&n({modelTopology:i});let l=o.weightsManifest;if(l==null){r(new Error(`weightManifest field is missing from file ${e.name}`));return}let u;try{u=this.checkManifestAndWeightFiles(l,t)}catch(p){r(p);return}let c=[],d=[],h=[];l.forEach(p=>{p.paths.forEach(f=>{d.push(f),h.push(null)}),c.push(...p.weights)}),l.forEach(p=>{p.paths.forEach(f=>{let m=new FileReader;m.onload=g=>{let y=g.target.result,A=d.indexOf(f);if(h[A]=y,h.indexOf(null)===-1){let x={modelTopology:i,weightSpecs:c,weightData:$2(h),format:o.format,generatedBy:o.generatedBy,convertedBy:o.convertedBy};o.signature!=null&&(x.signature=o.signature),o.userDefinedMetadata!=null&&(x.userDefinedMetadata=o.userDefinedMetadata),o.modelInitializer!=null&&(x.modelInitializer=o.modelInitializer),n(x)}},m.onerror=g=>r(`Failed to weights data from file of path '${f}'.`),m.readAsArrayBuffer(u[f])})})},s.onerror=a=>r(`Failed to read model topology and weights manifest JSON from file '${e.name}'. BrowserFiles supports loading Keras-style tf.Model artifacts only.`),s.readAsText(e)})}checkManifestAndWeightFiles(e,t){let n=[],r=t.map(a=>Q7(a.name)),s={};for(let a of e)a.paths.forEach(o=>{let i=Q7(o);if(n.indexOf(i)!==-1)throw new Error(`Duplicate file basename found in weights manifest: '${i}'`);if(n.push(i),r.indexOf(i)===-1)throw new Error(`Weight file with basename '${i}' is not provided.`);s[o]=t[r.indexOf(i)]});if(n.length!==t.length)throw new Error(`Mismatch in the number of files in weights manifest (${n.length}) and the number of weight files provided (${t.length}).`);return s}},FF=e=>ct().getBool("IS_BROWSER")&&!Array.isArray(e)&&e.startsWith(pp.URL_SCHEME)?MF(e.slice(pp.URL_SCHEME.length)):null;jt.registerSaveRouter(FF);function MF(e="model"){return new pp(e)}function OF(e){return new DF(e)}function uk(e,t,n,r){o(e),n=n==null?0:n,r=r==null?1:r,i(n,r);let s=0,a=l=>(l.then(u=>{let c=n+ ++s/e.length*(r-n);return t(c),u}),l);function o(l){L(l!=null&&Array.isArray(l)&&l.length>0,()=>"promises must be a none empty array")}function i(l,u){L(l>=0&&l<=1,()=>`Progress fraction must be in range [0, 1], but got startFraction ${l}`),L(u>=0&&u<=1,()=>`Progress fraction must be in range [0, 1], but got endFraction ${u}`),L(u>=l,()=>`startFraction must be no more than endFraction, but got startFraction ${l} and endFraction ${u}`)}return Promise.all(e.map(a))}async function ck(e,t){t==null&&(t={});let n=t.fetchFunc==null?ct().platform.fetch:t.fetchFunc,r=e.map(d=>n(d,t.requestInit,{isBinary:!0})),s=0,a=.5,i=(t.onProgress==null?await Promise.all(r):await uk(r,t.onProgress,s,a)).map(d=>d.arrayBuffer()),l=.5,u=1;return t.onProgress==null?await Promise.all(i):await uk(i,t.onProgress,l,u)}async function PF(e,t="",n,r){return dk(o=>ck(o,{requestInit:r}))(e,t,n)}function dk(e){return async(t,n="",r)=>{let s=t.map(()=>!1),a={},o=r!=null?r.map(()=>!1):[],i=[];if(t.forEach((p,f)=>{let m=0;p.weights.forEach(g=>{let y="quantization"in g?g.quantization.dtype:g.dtype,A=C2[y]*Jt(g.shape),x=()=>{s[f]=!0,a[f]==null&&(a[f]=[]),a[f].push({manifestEntry:g,groupOffset:m,sizeBytes:A})};r!=null?r.forEach((b,v)=>{b===g.name&&(x(),o[v]=!0)}):x(),i.push(g.name),m+=A})}),!o.every(p=>p)){let p=r.filter((f,m)=>!o[m]);throw new Error(`Could not find weights in manifest with names: ${p.join(", ")}. +Manifest JSON has weights with names: ${i.join(", ")}.`)}let l=s.reduce((p,f,m)=>(f&&p.push(m),p),[]),u=[];l.forEach(p=>{t[p].paths.forEach(f=>{let m=n+(n.endsWith("/")?"":"/")+f;u.push(m)})});let c=await e(u),d={},h=0;return l.forEach(p=>{let f=t[p].paths.length,m=0;for(let b=0;b{let v=g.slice(b.groupOffset,b.groupOffset+b.sizeBytes),w=Y7(v,[b.manifestEntry]);for(let I in w)d[I]=w[I]}),h+=f}),d}}var zF="application/octet-stream",LF="application/json",O2=class{constructor(e,t){if(this.DEFAULT_METHOD="POST",t==null&&(t={}),this.weightPathPrefix=t.weightPathPrefix,this.onProgress=t.onProgress,this.weightUrlConverter=t.weightUrlConverter,t.fetchFunc!=null?(L(typeof t.fetchFunc=="function",()=>"Must pass a function that matches the signature of `fetch` (see https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API)"),this.fetch=t.fetchFunc):this.fetch=ct().platform.fetch,L(e!=null&&e.length>0,()=>"URL path for http must not be null, undefined or empty."),Array.isArray(e)&&L(e.length===2,()=>`URL paths for http must have a length of 2, (actual length is ${e.length}).`),this.path=e,t.requestInit!=null&&t.requestInit.body!=null)throw new Error("requestInit is expected to have no pre-existing body, but has one.");this.requestInit=t.requestInit||{}}async save(e){if(e.modelTopology instanceof ArrayBuffer)throw new Error("BrowserHTTPRequest.save() does not support saving model topology in binary formats yet.");let t=Object.assign({method:this.DEFAULT_METHOD},this.requestInit);t.body=new FormData;let n=[{paths:["./model.weights.bin"],weights:e.weightSpecs}],r={modelTopology:e.modelTopology,format:e.format,generatedBy:e.generatedBy,convertedBy:e.convertedBy,weightsManifest:n};e.signature!=null&&(r.signature=e.signature),e.userDefinedMetadata!=null&&(r.userDefinedMetadata=e.userDefinedMetadata),e.modelInitializer!=null&&(r.modelInitializer=e.modelInitializer),t.body.append("model.json",new Blob([JSON.stringify(r)],{type:LF}),"model.json"),e.weightData!=null&&t.body.append("model.weights.bin",new Blob([e.weightData],{type:zF}),"model.weights.bin");let s=await this.fetch(this.path,t);if(s.ok)return{modelArtifactsInfo:ac(e),responses:[s]};throw new Error(`BrowserHTTPRequest.save() failed due to HTTP response status ${s.status}.`)}async load(){let e=await this.fetch(this.path,this.requestInit);if(!e.ok)throw new Error(`Request to ${this.path} failed with status code ${e.status}. Please verify this URL points to the model JSON of the model to load.`);let t;try{t=await e.json()}catch(p){let f=`Failed to parse model JSON of response from ${this.path}.`;throw this.path.endsWith(".pb")?f+=" Your path contains a .pb file extension. Support for .pb models have been removed in TensorFlow.js 1.0 in favor of .json models. You can re-convert your Python TensorFlow model using the TensorFlow.js 1.0 conversion scripts or you can convert your.pb models with the 'pb2json'NPM script in the tensorflow/tfjs-converter repository.":f+=" Please make sure the server is serving valid JSON for this request.",new Error(f)}let n=t.modelTopology,r=t.weightsManifest,s=t.generatedBy,a=t.convertedBy,o=t.format,i=t.signature,l=t.userDefinedMetadata;if(n==null&&r==null)throw new Error(`The JSON from HTTP path ${this.path} contains neither model topology or manifest for weights.`);let u,c;r!=null&&([u,c]=await this.loadWeights(r));let d={modelTopology:n,weightSpecs:u,weightData:c,generatedBy:s,convertedBy:a,format:o};i!=null&&(d.signature=i),l!=null&&(d.userDefinedMetadata=l);let h=t.modelInitializer;return h&&(d.modelInitializer=h),d}async loadWeights(e){let t=Array.isArray(this.path)?this.path[1]:this.path,[n,r]=BF(t),s=this.weightPathPrefix||n,a=[];for(let u of e)a.push(...u.weights);let o=[],i=[];for(let u of e)for(let c of u.paths)this.weightUrlConverter!=null?i.push(this.weightUrlConverter(c)):o.push(s+c+r);this.weightUrlConverter&&o.push(...await Promise.all(i));let l=await ck(o,{requestInit:this.requestInit,fetchFunc:this.fetch,onProgress:this.onProgress});return[a,$2(l)]}};O2.URL_SCHEME_REGEX=/^https?:\/\//;function BF(e){let t=e.lastIndexOf("/"),n=e.lastIndexOf("?"),r=e.substring(0,t),s=n>t?e.substring(n):"";return[r+"/",s]}function P2(e){return e.match(O2.URL_SCHEME_REGEX)!=null}var hk=(e,t)=>{if(typeof fetch=="undefined"&&(t==null||t.fetchFunc==null))return null;{let n=!0;if(Array.isArray(e)?n=e.every(r=>P2(r)):n=P2(e),n)return z2(e,t)}return null};jt.registerSaveRouter(hk);jt.registerLoadRouter(hk);function z2(e,t){return new O2(e,t)}function WF(e,t){return z2(e,t)}var L2=class{constructor(e){this.modelArtifacts=e}async load(){return this.modelArtifacts}},VF=class{constructor(e){this.saveHandler=e}async save(e){return this.saveHandler(e)}};function UF(e,t,n,r){return arguments.length===1?e.modelTopology!=null||e.weightSpecs!=null?new L2(e):(console.warn("Please call tf.io.fromMemory() with only one argument. The argument should be of type ModelArtifacts. The multi-argument signature of tf.io.fromMemory() has been deprecated and will be removed in a future release."),new L2({modelTopology:e})):(console.warn("Please call tf.io.fromMemory() with only one argument. The argument should be of type ModelArtifacts. The multi-argument signature of tf.io.fromMemory() has been deprecated and will be removed in a future release."),new L2({modelTopology:e,weightSpecs:t,weightData:n,trainingConfig:r}))}function HF(e){return new VF(e)}var pk={};De(pk,{confusionMatrix:()=>XF});function GF(e,t,n=!1,r=!1){let s=P(e,"a","matMul"),a=P(t,"b","matMul");[s,a]=Vt(s,a);let o={a:s,b:a},i={transposeA:n,transposeB:r};return U.runKernel(fv,o,i)}var yt=H({matMul_:GF});function jF(e,t,n=1,r=0){if(t<2)throw new Error(`Error in oneHot: depth must be >=2, but it is ${t}`);let a={indices:P(e,"indices","oneHot","int32")},o={depth:t,onValue:n,offValue:r};return U.runKernel(Mw,a,o)}var B2=H({oneHot_:jF});function qF(e,t){let n=P(e,"x","transpose");if(t==null&&(t=n.shape.map((a,o)=>o).reverse()),L(n.rank===t.length,()=>`Error in transpose: rank of input ${n.rank} must match length of perm ${t}.`),t.forEach(a=>{L(a>=0&&a`All entries in 'perm' must be between 0 and ${n.rank-1} but got ${t}`)}),n.rank<=1)return n.clone();let r={x:n},s={perm:t};return U.runKernel(N7,r,s)}var fp=H({transpose_:qF});function KF(e,t,n){let r=P(e,"labels","confusionMatrix"),s=P(t,"predictions","confusionMatrix");L(n==null||n>0&&Number.isInteger(n),()=>`If provided, numClasses must be a positive integer, but got ${n}`),L(r.rank===1,()=>`Expected the rank of labels to be 1, but got ${r.rank}`),L(s.rank===1,()=>`Expected the rank of predictions to be 1, but got ${s.rank}`),L(r.shape[0]===s.shape[0],()=>`Mismatch in the number of examples: ${r.shape[0]} vs. ${s.shape[0]}. Labels and predictions should have the same number of elements.`),L(n>0&&Number.isInteger(n),()=>`numClasses is required to be a positive integer, but got ${n}`);let a=B2(Pt(r,"int32"),n),o=B2(Pt(s,"int32"),n),i=fp(a),l=yt(i,o);return Pt(l,"int32")}var XF=H({confusionMatrix_:KF}),Hr={};De(Hr,{fromPixels:()=>nM,fromPixelsAsync:()=>eM,toPixels:()=>tM});function mp(e,t,n){if(ho(e),t!=null&&t.length!==3)throw new Error("tensor3d() requires shape to have three numbers");let r=Ss(e,n);if(r.length!==3&&r.length!==1)throw new Error("tensor3d() requires values to be number[][][] or flat/TypedArray");if(r.length===1&&t==null)throw new Error("tensor3d() requires shape to be provided when `values` are a flat array");return Na(e,t,r,n)}var Ui;function fk(e,t=3){if(t>4)throw new Error("Cannot construct Tensor with more than 4 channels from pixels.");if(e==null)throw new Error("pixels passed to tf.browser.fromPixels() can not be null");let n=!1,r=!1,s=!1,a=!1,o=!1,i=!1;if(e.data instanceof Uint8Array)n=!0;else if(typeof ImageData!="undefined"&&e instanceof ImageData)r=!0;else if(typeof HTMLVideoElement!="undefined"&&e instanceof HTMLVideoElement)s=!0;else if(typeof HTMLImageElement!="undefined"&&e instanceof HTMLImageElement)a=!0;else if(e.getContext!=null)o=!0;else if(typeof ImageBitmap!="undefined"&&e instanceof ImageBitmap)i=!0;else throw new Error(`pixels passed to tf.browser.fromPixels() must be either an HTMLVideoElement, HTMLImageElement, HTMLCanvasElement, ImageData in browser, or OffscreenCanvas, ImageData in webworker or {data: Uint32Array, width: number, height: number}, but was ${e.constructor.name}`);if(s){let f=2;if(s&&e.readyState element.")}if(rp(d2,U.backendName)!=null){let f={pixels:e},m={numChannels:t};return U.runKernel(d2,f,m)}let[u,c]=s?[e.videoWidth,e.videoHeight]:[e.width,e.height],d;o?d=e.getContext("2d").getImageData(0,0,u,c).data:r||n?d=e.data:(a||s||i)&&(Ui==null&&(Ui=document.createElement("canvas").getContext("2d")),Ui.canvas.width=u,Ui.canvas.height=c,Ui.drawImage(e,0,0,u,c),d=Ui.getImageData(0,0,u,c).data);let h;if(t===4)h=new Int32Array(d);else{let f=u*c;h=new Int32Array(f*t);for(let m=0;m4||a===2)throw new Error(`toPixels only supports depth of size 1, 3 or 4 but got ${a}`);if(n.dtype!=="float32"&&n.dtype!=="int32")throw new Error(`Unsupported type for toPixels: ${n.dtype}. Please use float32 or int32 tensors.`);let o=await n.data(),i=n.dtype==="float32"?255:1,l=new Uint8ClampedArray(s*r*4);for(let u=0;u1)throw new Error(`Tensor values for a float32 Tensor must be in the range [0 - 1] but encountered ${p}.`)}else if(n.dtype==="int32"&&(p<0||p>255))throw new Error(`Tensor values for a int32 Tensor must be in the range [0 - 255] but encountered ${p}.`);a===1?(c[0]=p*i,c[1]=p*i,c[2]=p*i):c[h]=p*i}let d=u*4;l[d+0]=Math.round(c[0]),l[d+1]=Math.round(c[1]),l[d+2]=Math.round(c[2]),l[d+3]=Math.round(c[3])}if(t!=null){t.width=s,t.height=r;let u=t.getContext("2d"),c=new ImageData(l,s,r);u.putImageData(c,0,0)}return n!==e&&n.dispose(),l}var nM=H({fromPixels_:fk}),mk={};De(mk,{prepareAndValidate:()=>gk});function gk(e,t){let n=e.shape.length,r=t.shape.length;if(n<1)throw new Error(`tf.gatherND() expects the input to be rank 1 or higher, but the rank was ${n}.`);if(r<1)throw new Error(`tf.gatherND() expects the indices to be rank 1 or higher, but the rank was ${r}.`);if(t.dtype!=="int32")throw new Error(`tf.gatherND() expects the indices to be int32 type, but the dtype was ${t.dtype}.`);if(t.shape[r-1]>n)throw new Error(`index innermost dimension length must be <= tensor rank; saw: ${t.shape[r-1]} vs. ${n}`);if(Jt(e.shape)===0)throw new Error(`Requested more than 0 entries, but input is empty. Input shape: ${e.shape}.`);let s=t.shape,a=s[s.length-1],o=1;for(let d=0;dd/u),1].slice(0,a);return[l,o,u,c]}var yk={};De(yk,{calculateShapes:()=>Ak,validateInput:()=>V2,validateUpdateShape:()=>W2});function W2(e,t,n){let r=t.rank>1?t.shape[t.rank-1]:1,s=t.rank>1?t.rank-1:1,a=`Must have updates.shape = indices.shape[:batchDim] + shape[sliceDim:], got updates.shape: ${n.shape}, indices.shape: ${t.shape}, shape: ${e}, sliceDim: ${r}, and batchDim: ${s}.`;if(n.rank1?t.shape[r-1]:1,a=n.length,o=1;for(let d=s;drM,computeFlatOffset:()=>aM,computeOutShape:()=>xk,getNormalizedAxes:()=>kk,isSliceContinous:()=>sM,maskToAxes:()=>gp,parseSliceParams:()=>oM,sliceInfo:()=>iM,startForAxis:()=>Nk,startIndicesWithElidedDims:()=>Ik,stopForAxis:()=>Ck,stopIndicesWithElidedDims:()=>Sk,stridesForAxis:()=>Tk,stridesWithElidedDims:()=>bk});function rM(e,t,n){let r=e.shape.length;L(r===t.length,()=>`Error in slice${r}D: Length of begin ${t} must match the rank of the array (${r}).`),L(r===n.length,()=>`Error in slice${r}D: Length of size ${n} must match the rank of the array (${r}).`);for(let s=0;s`Error in slice${r}D: begin[${s}] + size[${s}] (${t[s]+n[s]}) would overflow input.shape[${s}] (${e.shape[s]})`)}function gp(e){let t=[],n=0;for(;e>0;)e&1&&t.push(n),e/=2,n++;return t}function xk(e,t,n){let r=[];for(let s=0;s0){let p=t[0],f=n+1;c=Ik(o,p,f,r,e),d=Sk(i,p,f,s,e),h=bk(a,p,f,e)}else for(let p=0;p-1)a[i]=0;else{let l=vk(t,n,i),u=r[l];e&1<-1)a[i]=Number.MAX_SAFE_INTEGER;else{let l=vk(t,n,i),u=r[l];e&1<0?o=Number.MIN_SAFE_INTEGER:o=Number.MAX_SAFE_INTEGER);let l=r[s];return o<0&&(o+=l),o=qu(0,o,l-1),o}function Ck(e,t,n,r,s,a){let o=t[s],i=n[s]||1;(e&1<0?o=Number.MAX_SAFE_INTEGER:o=Number.MIN_SAFE_INTEGER);let l=r[s];return o<0&&(o+=l),i>0?o=qu(0,o,l):o=qu(-1,o,l-1),o}function sM(e,t,n){let r=n.length;for(let s=0;s1){r=s;break}for(let s=r+1;s0||n[s]!==e[s])return!1;return!0}function aM(e,t){let n=e.length>0?e[e.length-1]:1;for(let r=0;r{L(o!==-1,()=>"slice() does not support negative begin indexing.")});let a;return n==null?a=new Array(s).fill(-1):typeof n=="number"?a=[n,...new Array(s-1).fill(-1)]:n.lengtho>=0?o:(L(o===-1,()=>`Negative size values should be exactly -1 but got ${o} for the slice() size at index ${i}.`),e.shape[i]-r[i])),[r,a]}function iM(e,t,n,r,s,a,o,i,l){let u=t.slice(),c=n.slice(),d=r;r==null&&(d=new Array(u.length));let h=gp(o);if(h.length>1)throw new Error("Multiple ellipses in slice is not allowed.");if(o!==0&&i!==0)throw new Error("Using both ellipsisMask and newAxisMask is not yet supported.");if(o!==0&&l!==0)throw new Error("Using both ellipsisMask and shrinkAxisMask is not yet supported.");let p=e.length-u.length,f=gp(i),m=e.slice();f.forEach(I=>{u[I]=0,c[I]=1,m.splice(I,0,1)});let{begin:g,end:y,strides:A}=kk(m,h,p,u,c,d,s,a,o);u=g,c=y,d=A;let x=gp(l);x.forEach(I=>{c[I]=u[I]+1,d[I]=1});let b=xk(u,c,d),v=b.filter((I,T)=>x.indexOf(T)===-1);return{nonStrided:d.every(I=>I===1),$begin:u,$end:c,$strides:d,size:b,newShape:m,outShape:v}}var Ek={};De(Ek,{Serializable:()=>$k,SerializationMap:()=>bo,registerClass:()=>Ea});var $k=class{getClassName(){return this.constructor.className}static fromConfig(e,t){return new e(t)}},bo=class{constructor(){this.classNameMap={}}static getMap(){return bo.instance==null&&(bo.instance=new bo),bo.instance}static register(e){bo.getMap().classNameMap[e.className]=[e,e.fromConfig]}};function Ea(e){L(e.className!=null,()=>"Class being registered does not have the static className property defined."),L(typeof e.className=="string",()=>"className is required to be a string, but got type "+typeof e.className),L(e.className.length>0,()=>"Class being registered has an empty-string as its className, which is disallowed."),bo.register(e)}var _k={};De(_k,{TEST_EPSILON_FLOAT16:()=>Rk,encodeStrings:()=>Dk,expectArrayBuffersEqual:()=>fM,expectArraysClose:()=>uM,expectArraysEqual:()=>dM,expectNumbersClose:()=>hM,expectPromiseToFail:()=>cM,expectValuesInRange:()=>pM,testEpsilon:()=>H2});var lM=.001,Rk=.1;function uM(e,t,n){return n==null&&(n=H2()),G2(e,t,(r,s)=>j2(r,s,n))}function H2(){return U.backend.floatPrecision()===32?lM:Rk}function G2(e,t,n){let r=!0;if((Cn(e)||Cn(t))&&(r=!1),Cn(e)&&Cn(t)&&(r=!0),r){let o=e.constructor.name,i=t.constructor.name;if(o!==i)throw new Error(`Arrays are of different type. Actual: ${o}. Expected: ${i}`)}if(Array.isArray(e)&&Array.isArray(t)){let o=Ss(e),i=Ss(t);if(!Xs(o,i))throw new Error(`Arrays have different shapes. Actual: [${o}]. Expected: [${i}]`)}let s=Cn(e)?e:po(e),a=Cn(t)?t:po(t);if(s.length!==a.length)throw new Error(`Arrays have different lengths actual: ${s.length} vs expected: ${a.length}. +Actual: ${s}. +Expected: ${a}.`);for(let o=0;ot.fail(),()=>t())}function dM(e,t){let n=typeof t=="string"||typeof t=="number"||typeof t=="boolean"?[t]:t;return Ia(e)||Ia(e[0])||Ia(t)||Ia(t[0])?G2(e,n,(r,s)=>r==s):G2(e,t,(r,s)=>j2(r,s,0))}function hM(e,t,n){if(n==null&&(n=H2()),!j2(e,t,n))throw new Error(`Numbers differ: actual === ${e}, expected === ${t}`)}function j2(e,t,n){return!isFinite(e)&&!isFinite(t)?!0:!(isNaN(e)||isNaN(t)||Math.abs(e-t)>n)}function pM(e,t,n){for(let r=0;rn)throw new Error(`Value out of range:${e[r]} low: ${t}, high: ${n}`)}function fM(e,t){expect(new Float32Array(e)).toEqual(new Float32Array(t))}function Dk(e){for(let t=0;tn.dispose())}function Mk(e){return U.keep(e)}function kM(e){return U.time(e)}function IM(e){return U.setBackend(e)}function SM(){return U.ready()}function TM(){return U.backendName}function NM(e){U.removeBackend(e)}function q2(e){return U.findBackend(e)}function CM(e){return U.findBackendFactory(e)}function K2(e,t,n=1){return U.registerBackend(e,t,n)}function EM(){return U.backend}function $M(e,t){ct().setPlatform(e,t)}function _M(e,t){let n=P(e,"a","add"),r=P(t,"b","add");[n,r]=Vt(n,r);let s={a:n,b:r};return U.runKernel(i2,s)}var Me=H({add_:_M});function RM(e,t){let n=P(e,"a","floorDiv"),r=P(t,"b","floorDiv");[n,r]=Vt(n,r);let s={a:n,b:r};return U.runKernel(Zv,s)}var Ok=H({floorDiv_:RM});function DM(e,t){let n=P(e,"a","div"),r=P(t,"b","div");if([n,r]=Vt(n,r),n.dtype==="int32"&&r.dtype==="int32")return Ok(n,r);let s={a:n,b:r},a={};return U.runKernel(zv,s,a)}var Qe=H({div_:DM});function FM(e,t){let n=P(e,"a","mul"),r=P(t,"b","mul");[n,r]=Vt(n,r);let s={a:n,b:r};return U.runKernel(Cw,s)}var fe=H({mul_:FM});function MM(e){let t=P(e,"x","abs");if(t.dtype==="complex64"){let n={x:t};return U.runKernel(bv,n)}else{let n={x:t};return U.runKernel(Q3,n)}}var Nr=H({abs_:MM});function OM(e){let n={x:P(e,"x","acos")};return U.runKernel(ev,n)}var PM=H({acos_:OM});function zM(e){let n={x:P(e,"x","acosh")};return U.runKernel(tv,n)}var LM=H({acosh_:zM});function BM(e){L(Array.isArray(e),()=>"The argument passed to tf.addN() must be a list of tensors"),L(e.length>=1,()=>`Must pass at least one tensor to tf.addN(), but got ${e.length}`);let t=e.map((s,a)=>P(s,`tensors${a}`,"addN")),n=t[0];t.forEach(s=>{if(s.dtype!==n.dtype)throw new Error("All tensors passed to tf.addN() must have the same dtype")}),t.forEach(s=>{if(!Xs(s.shape,n.shape))throw new Error("All tensors passed to tf.addN() must have the same shape")});let r=t;return U.runKernel(nv,r)}var X2=H({addN_:BM});function WM(e,t=null,n=!1){let s={x:P(e,"x","all","bool")},a={axis:t,keepDims:n};return U.runKernel(rv,s,a)}var VM=H({all_:WM});function UM(e,t=null,n=!1){let s={x:P(e,"x","any","bool")},a={axis:t,keepDims:n};return U.runKernel(sv,s,a)}var HM=H({any_:UM});function GM(e,t=0){let r={x:P(e,"x","argMax")},s={axis:t};return U.runKernel(av,r,s)}var Z2=H({argMax_:GM});function jM(e,t=0){let r={x:P(e,"x","argMin")},s={axis:t};return U.runKernel(ov,r,s)}var qM=H({argMin_:jM});function KM(e){let n={x:P(e,"x","asin")};return U.runKernel(iv,n)}var XM=H({asin_:KM});function ZM(e){let n={x:P(e,"x","asinh")};return U.runKernel(lv,n)}var YM=H({asinh_:ZM});function JM(e){let n={x:P(e,"x","atan")};return U.runKernel(uv,n)}var QM=H({atan_:JM});function eO(e,t){let n=P(e,"a","atan2"),r=P(t,"b","atan2");[n,r]=Vt(n,r);let s={a:n,b:r};return U.runKernel(dv,s)}var tO=H({atan2_:eO});function nO(e){let n={x:P(e,"x","atanh")};return U.runKernel(cv,n)}var rO=H({atanh_:nO});function sO(e,t,n,r,s="NHWC",a){let o=e[3],i=[...t,o],l=Lk(s);return oc(e,i,n,a,r,null,null,l)}function Pk(e,t,n,r,s,a,o="channelsLast"){let[i,l]=yp(t),u;if(o==="channelsLast")u=[i,l,e[3],e[3]];else if(o==="channelsFirst")u=[i,l,e[1],e[1]];else throw new Error(`Unknown dataFormat ${o}`);return oc(e,u,n,r,s,a,!1,o)}function aO(e,t,n,r,s,a,o="NDHWC"){let[i,l,u]=J2(t),c,d;if(o==="NDHWC")d="channelsLast",c=[i,l,u,e[4],e[4]];else if(o==="NCDHW")d="channelsFirst",c=[i,l,u,e[1],e[1]];else throw new Error(`Unknown dataFormat ${o}`);return zk(e,c,n,r,s,!1,d,a)}function oc(e,t,n,r,s,a,o=!1,i="channelsLast"){let[l,u,c,d]=[-1,-1,-1,-1];if(i==="channelsLast")[l,u,c,d]=e;else if(i==="channelsFirst")[l,d,u,c]=e;else throw new Error(`Unknown dataFormat ${i}`);let[h,p,,f]=t,[m,g]=yp(n),[y,A]=yp(r),x=Hi(h,y),b=Hi(p,A),{padInfo:v,outHeight:w,outWidth:I}=lO(s,u,c,m,g,x,b,a,i),T=o?f*d:f,C;return i==="channelsFirst"?C=[l,T,w,I]:i==="channelsLast"&&(C=[l,w,I,T]),{batchSize:l,dataFormat:i,inHeight:u,inWidth:c,inChannels:d,outHeight:w,outWidth:I,outChannels:T,padInfo:v,strideHeight:m,strideWidth:g,filterHeight:h,filterWidth:p,effectiveFilterHeight:x,effectiveFilterWidth:b,dilationHeight:y,dilationWidth:A,inShape:e,outShape:C,filterShape:t}}function zk(e,t,n,r,s,a=!1,o="channelsLast",i){let[l,u,c,d,h]=[-1,-1,-1,-1,-1];if(o==="channelsLast")[l,u,c,d,h]=e;else if(o==="channelsFirst")[l,h,u,c,d]=e;else throw new Error(`Unknown dataFormat ${o}`);let[p,f,m,,g]=t,[y,A,x]=J2(n),[b,v,w]=J2(r),I=Hi(p,b),T=Hi(f,v),C=Hi(m,w),{padInfo:M,outDepth:$,outHeight:R,outWidth:N}=uO(s,u,c,d,y,A,x,I,T,C,i),F=a?g*h:g,B;return o==="channelsFirst"?B=[l,F,$,R,N]:o==="channelsLast"&&(B=[l,$,R,N,F]),{batchSize:l,dataFormat:o,inDepth:u,inHeight:c,inWidth:d,inChannels:h,outDepth:$,outHeight:R,outWidth:N,outChannels:F,padInfo:M,strideDepth:y,strideHeight:A,strideWidth:x,filterDepth:p,filterHeight:f,filterWidth:m,effectiveFilterDepth:I,effectiveFilterHeight:T,effectiveFilterWidth:C,dilationDepth:b,dilationHeight:v,dilationWidth:w,inShape:e,outShape:B,filterShape:t}}function oO(e,t,n,r,s){r==null&&(r=Y2(e,t,n));let a=e[0],o=e[1],i=vo((a-t+2*r)/n+1,s),l=vo((o-t+2*r)/n+1,s);return[i,l]}function iO(e,t,n,r,s,a){s==null&&(s=Y2(e,t,r));let o=e[0],i=e[1],l=e[2],u=vo((o-t+2*s)/r+1,a),c=vo((i-t+2*s)/r+1,a),d=vo((l-t+2*s)/r+1,a);return[u,c,d,n]}function Y2(e,t,n,r=1){let s=Hi(t,r);return Math.floor((e[0]*(n-1)-n+s)/2)}function yp(e){return typeof e=="number"?[e,e,e]:e.length===2?[e[0],e[1],1]:e}function J2(e){return typeof e=="number"?[e,e,e]:e}function Hi(e,t){return t<=1?e:e+(e-1)*(t-1)}function lO(e,t,n,r,s,a,o,i,l){let u,c,d;if(typeof e=="number"){u={top:e,bottom:e,left:e,right:e,type:e===0?"VALID":"NUMBER"};let p=oO([t,n],a,r,e,i);c=p[0],d=p[1]}else if(e==="same"){c=Math.ceil(t/r),d=Math.ceil(n/s);let h=Math.max(0,(c-1)*r+a-t),p=Math.max(0,(d-1)*s+o-n),f=Math.floor(h/2),m=h-f,g=Math.floor(p/2),y=p-g;u={top:f,bottom:m,left:g,right:y,type:"SAME"}}else if(e==="valid")u={top:0,bottom:0,left:0,right:0,type:"VALID"},c=Math.ceil((t-a+1)/r),d=Math.ceil((n-o+1)/s);else if(typeof e=="object"){let h=l==="channelsLast"?e[1][0]:e[2][0],p=l==="channelsLast"?e[1][1]:e[2][1],f=l==="channelsLast"?e[2][0]:e[3][0],m=l==="channelsLast"?e[2][1]:e[3][1];u={top:h,bottom:p,left:f,right:m,type:h===0&&p===0&&f===0&&m===0?"VALID":"EXPLICIT"},c=vo((t-a+h+p)/r+1,i),d=vo((n-o+f+m)/s+1,i)}else throw Error(`Unknown padding parameter: ${e}`);return{padInfo:u,outHeight:c,outWidth:d}}function uO(e,t,n,r,s,a,o,i,l,u,c){let d,h,p,f;if(typeof e=="number"){d={top:e,bottom:e,left:e,right:e,front:e,back:e,type:e===0?"VALID":"NUMBER"};let g=iO([t,n,r,1],i,1,s,e,c);h=g[0],p=g[1],f=g[2]}else if(e==="same"){h=Math.ceil(t/s),p=Math.ceil(n/a),f=Math.ceil(r/o);let m=(h-1)*s+i-t,g=(p-1)*a+l-n,y=(f-1)*o+u-r,A=Math.floor(m/2),x=m-A,b=Math.floor(g/2),v=g-b,w=Math.floor(y/2),I=y-w;d={top:b,bottom:v,left:w,right:I,front:A,back:x,type:"SAME"}}else if(e==="valid")d={top:0,bottom:0,left:0,right:0,front:0,back:0,type:"VALID"},h=Math.ceil((t-i+1)/s),p=Math.ceil((n-l+1)/a),f=Math.ceil((r-u+1)/o);else throw Error(`Unknown padding parameter: ${e}`);return{padInfo:d,outDepth:h,outHeight:p,outWidth:f}}function vo(e,t){if(!t)return Math.trunc(e);switch(t){case"round":return Math.round(e);case"ceil":return Math.ceil(e);case"floor":return Math.floor(e);default:throw new Error(`Unknown roundingMode ${t}`)}}function ic(e){let[t,n,r]=yp(e);return t===1&&n===1&&r===1}function Qs(e,t){return ic(e)||ic(t)}function Lk(e){if(e==="NHWC")return"channelsLast";if(e==="NCHW")return"channelsFirst";throw new Error(`Unknown dataFormat ${e}`)}function cO(e,t){let r={x:P(e,"x","reshape","string_or_numeric")},s={shape:t};return U.runKernel(Gw,r,s)}var ue=H({reshape_:cO});function dO(e,t,n,r,s){let a=P(e,"x","avgPool","float32"),o=1;L(Qs(n,o),()=>`Error in avgPool: Either strides or dilations must be 1. Got strides ${n} and dilations '${o}'`);let i=a,l=!1;a.rank===3&&(l=!0,i=ue(a,[1,a.shape[0],a.shape[1],a.shape[2]])),L(i.rank===4,()=>`Error in avgPool: x must be rank 4 but got rank ${i.rank}.`),s!=null&&L(Xn(r),()=>`Error in avgPool: pad must be an integer when using, dimRoundingMode ${s} but got pad ${r}.`);let u={x:i},c={filterSize:t,strides:n,pad:r,dimRoundingMode:s},d=U.runKernel(hv,u,c);return d=Pt(d,a.dtype),l?ue(d,[d.shape[1],d.shape[2],d.shape[3]]):d}var Bk=H({avgPool_:dO});function hO(e,t,n,r,s,a="NDHWC"){let o=P(e,"x","avgPool3d","float32"),i=o,l=!1;o.rank===4&&(l=!0,i=ue(o,[1,o.shape[0],o.shape[1],o.shape[2],o.shape[3]])),L(i.rank===5,()=>`Error in avgPool3d: x must be rank 5 but got rank ${i.rank}.`),L(a==="NDHWC",()=>`Error in avgPool3d: Only NDHWC is currently supported, but got dataFormat of ${a}`),s!=null&&L(Xn(r),()=>`Error in avgPool3d: pad must be an integer when using, dimRoundingMode ${s} but got pad ${r}.`);let u={x:i},c={filterSize:t,strides:n,pad:r,dimRoundingMode:s,dataFormat:a},d=U.runKernel(pv,u,c);return d=Pt(d,i.dtype),l?ue(d,[d.shape[1],d.shape[2],d.shape[3],d.shape[4]]):d}var pO=H({avgPool3d_:hO});function fO(e,t=0){L(e.length>=1,()=>"Pass at least one tensor to concat");let n=sc(e,"tensors","concat","string_or_numeric");if(n[0].dtype==="complex64"&&n.forEach(a=>{if(a.dtype!=="complex64")throw new Error(`Cannot concatenate complex64 tensors with a tensor + with dtype ${a.dtype}. `)}),n.length===1)return Js(n[0]);let r=n,s={axis:t};return U.runKernel(vv,r,s)}var an=H({concat_:fO});function mO(e){let n={x:P(e,"x","sigmoid")};return U.runKernel(a7,n)}var Ts=H({sigmoid_:mO});function gO(e,t,n){let r=P(e,"x","slice","string_or_numeric");if(r.rank===0)throw new Error("Slicing scalar is not possible");let s={x:r},a={begin:t,size:n};return U.runKernel(t7,s,a)}var Ze=H({slice_:gO});function yO(e){let n={x:P(e,"x","tanh")};return U.runKernel(I7,n)}var Q2=H({tanh_:yO});function AO(e,t,n,r,s,a){let o=P(e,"forgetBias","basicLSTMCell"),i=P(t,"lstmKernel","basicLSTMCell"),l=P(n,"lstmBias","basicLSTMCell"),u=P(r,"data","basicLSTMCell"),c=P(s,"c","basicLSTMCell"),d=P(a,"h","basicLSTMCell"),h=an([u,d],1),p=yt(h,i),f=Me(p,l),m=f.shape[0],g=f.shape[1]/4,y=[m,g],A=Ze(f,[0,0],y),x=Ze(f,[0,g],y),b=Ze(f,[0,g*2],y),v=Ze(f,[0,g*3],y),w=Me(fe(Ts(A),Q2(x)),fe(c,Ts(Me(o,b)))),I=fe(Q2(w),Ts(v));return[w,I]}var xO=H({basicLSTMCell_:AO});function bO(e,t,n){let r=P(e,"x","batchToSpaceND"),s=t.reduce((i,l)=>i*l);L(r.rank>=1+t.length,()=>`input rank is ${r.rank} but should be > than blockShape.length ${t.length}`),L(n.length===t.length,()=>`crops.length is ${n.length} but should be equal to blockShape.length ${t.length}`),L(r.shape[0]%s==0,()=>`input tensor batch is ${r.shape[0]} but is not divisible by the product of the elements of blockShape ${t.join(" * ")} === ${s}`);let a={x:r},o={blockShape:t,crops:n};return U.runKernel(mv,a,o)}var Wk=H({batchToSpaceND_:bO});function vO(e){let t;return e.rank===0||e.rank===1?t=ue(e,[1,1,1,e.size]):e.rank===2?t=ue(e,[1,1,e.shape[0],e.shape[1]]):e.rank===3?t=ue(e,[1,e.shape[0],e.shape[1],e.shape[2]]):t=e,t}function wO(e,t,n,r,s,a){a==null&&(a=.001);let o=P(e,"x","batchNorm"),i=P(t,"mean","batchNorm"),l=P(n,"variance","batchNorm"),u;s!=null&&(u=P(s,"scale","batchNorm"));let c;r!=null&&(c=P(r,"offset","batchNorm")),L(i.rank===l.rank,()=>"Batch normalization gradient requires mean and variance to have equal ranks."),L(c==null||i.rank===c.rank,()=>"Batch normalization gradient requires mean and offset to have equal ranks."),L(u==null||i.rank===u.rank,()=>"Batch normalization gradient requires mean and scale to have equal ranks.");let h={x:vO(o),scale:u,offset:c,mean:i,variance:l},p={varianceEpsilon:a},f=U.runKernel(Yv,h,p);return ue(f,o.shape)}var Ap=H({batchNorm_:wO});function kO(e,t,n,r,s,a){let o=P(e,"x","batchNorm"),i=P(t,"mean","batchNorm"),l=P(n,"variance","batchNorm"),u;s!=null&&(u=P(s,"scale","batchNorm"));let c;return r!=null&&(c=P(r,"offset","batchNorm")),L(o.rank===2,()=>`Error in batchNorm2D: x must be rank 2 but got rank ${o.rank}.`),L(i.rank===2||i.rank===1,()=>`Error in batchNorm2D: mean must be rank 2 or rank 1 but got rank ${i.rank}.`),L(l.rank===2||l.rank===1,()=>`Error in batchNorm2D: variance must be rank 2 or rank 1 but got rank ${l.rank}.`),u!=null&&L(u.rank===2||u.rank===1,()=>`Error in batchNorm2D: scale must be rank 2 or rank 1 but got rank ${u.rank}.`),c!=null&&L(c.rank===2||c.rank===1,()=>`Error in batchNorm2D: offset must be rank 2 or rank 1 but got rank ${c.rank}.`),Ap(o,i,l,c,u,a)}var IO=H({batchNorm2d_:kO});function SO(e,t,n,r,s,a){let o=P(e,"x","batchNorm"),i=P(t,"mean","batchNorm"),l=P(n,"variance","batchNorm"),u;s!=null&&(u=P(s,"scale","batchNorm"));let c;return r!=null&&(c=P(r,"offset","batchNorm")),L(o.rank===3,()=>`Error in batchNorm3D: x must be rank 3 but got rank ${o.rank}.`),L(i.rank===3||i.rank===1,()=>`Error in batchNorm3D: mean must be rank 3 or rank 1 but got rank ${i.rank}.`),L(l.rank===3||l.rank===1,()=>`Error in batchNorm3D: variance must be rank 3 or rank 1 but got rank ${l.rank}.`),u!=null&&L(u.rank===3||u.rank===1,()=>`Error in batchNorm3D: scale must be rank 3 or rank 1 but got rank ${u.rank}.`),c!=null&&L(c.rank===3||c.rank===1,()=>`Error in batchNorm3D: offset must be rank 3 or rank 1 but got rank ${c.rank}.`),Ap(o,i,l,c,u,a)}var TO=H({batchNorm3d_:SO});function NO(e,t,n,r,s,a){let o=P(e,"x","batchNorm"),i=P(t,"mean","batchNorm"),l=P(n,"variance","batchNorm"),u;s!=null&&(u=P(s,"scale","batchNorm"));let c;return r!=null&&(c=P(r,"offset","batchNorm")),L(o.rank===4,()=>`Error in batchNorm4D: x must be rank 4 but got rank ${o.rank}.`),L(i.rank===4||i.rank===1,()=>`Error in batchNorm4D: mean must be rank 4 or rank 1 but got rank ${i.rank}.`),L(l.rank===4||l.rank===1,()=>`Error in batchNorm4D: variance must be rank 4 or rank 1 but got rank ${l.rank}.`),u!=null&&L(u.rank===4||u.rank===1,()=>`Error in batchNorm4D: scale must be rank 4 or rank 1 but got rank ${u.rank}.`),c!=null&&L(c.rank===4||c.rank===1,()=>`Error in batchNorm4D: offset must be rank 4 or rank 1 but got rank ${c.rank}.`),Ap(o,i,l,c,u,a)}var CO=H({batchNorm4d_:NO});function EO(e,t,n){let r=P(e,"x","bincount"),s=P(t,"weights","bincount");L(r.dtype==="int32",()=>`Error in bincount: input dtype must be int32, but got ${r.dtype}`),L(n>=0,()=>`size must be non-negative, but got ${n}.`),L(s.size===r.size||s.size===0,()=>`Error in bincount: weights must have the same size as input or0-length, but got input shape: ${r.shape}, weights shape: ${s.shape}.`);let a={x:r,weights:s},o={size:n};return U.runKernel(gv,a,o)}var Vk=H({bincount_:EO});function $O(e,t){let n=P(e,"broadcastTo","x"),r=n.shape;if(t.some(u=>!(u>0)||u%1!=0))throw new Error(`broadcastTo(): Invalid broadcast shape [${t}].`);if(t.lengthn.rank){let u=n.shape.slice();for(;u.length=0;u--)if(s[u]===t[u])a[u]=1;else if(n.shape[u]!==1)throw new Error(`broadcastTo(): [${r}] cannot be broadcast to [${t}].`);if(a.map((u,c)=>u>1?c:-1).filter(u=>u>=0).length===0)return Js(n);let i={x:n},l={reps:a};return U.runKernel(c2,i,l)}var xp=H({broadcastTo_:$O});function _O(e){let n={x:P(e,"x","ceil")};return U.runKernel(yv,n)}var RO=H({ceil_:_O});function DO(e,t,n){let r=P(e,"x","clipByValue");L(t<=n,()=>`Error in clip: min (${t}) must be less than or equal to max (${n}).`);let s={x:r},a={clipValueMin:t,clipValueMax:n};return U.runKernel(Av,s,a)}var FO=H({clipByValue_:DO});function MO(e){return an(e,0)}var OO=H({concat1d_:MO});function PO(e,t){return an(e,t)}var lc=H({concat2d_:PO});function zO(e,t){return an(e,t)}var LO=H({concat3d_:zO});function BO(e,t){return an(e,t)}var WO=H({concat4d_:BO});function VO(e,t,n,r,s="NHWC",a=[1,1],o){let i=P(e,"x","conv2d"),l=P(t,"filter","conv2d"),u=i,c=!1;i.rank===3&&(c=!0,u=ue(i,[1,i.shape[0],i.shape[1],i.shape[2]])),L(u.rank===4,()=>`Error in conv2d: input must be rank 4, but got rank ${u.rank}.`),L(l.rank===4,()=>`Error in conv2d: filter must be rank 4, but got rank ${l.rank}.`),o!=null&&L(Xn(r),()=>`Error in conv2d: pad must be an integer when using, dimRoundingMode ${o} but got pad ${r}.`);let d=s==="NHWC"?u.shape[3]:u.shape[1];L(d===l.shape[2],()=>`Error in conv2d: depth of input (${d}) must match input depth for filter ${l.shape[2]}.`),L(Qs(n,a),()=>`Error in conv2D: Either strides or dilations must be 1. Got strides ${n} and dilations '${a}'`);let h={x:u,filter:l},p={strides:n,pad:r,dataFormat:s,dilations:a,dimRoundingMode:o},f=U.runKernel(wv,h,p);return c?ue(f,[f.shape[1],f.shape[2],f.shape[3]]):f}var bp=H({conv2d_:VO});function UO(e,t,n,r,s="NWC",a=1,o){let i=P(e,"x","conv1d"),l=P(t,"filter","conv1d"),u=i,c=!1;i.rank===2&&(c=!0,u=ue(i,[1,i.shape[0],i.shape[1]])),L(u.rank===3,()=>`Error in conv1d: input must be rank 3, but got rank ${u.rank}.`),L(l.rank===3,()=>`Error in conv1d: filter must be rank 3, but got rank ${l.rank}.`),o!=null&&L(Xn(r),()=>`Error in conv1d: pad must be an integer when using, dimRoundingMode ${o} but got pad ${r}.`),L(u.shape[2]===l.shape[1],()=>`Error in conv1d: depth of input (${u.shape[2]}) must match input depth for filter ${l.shape[1]}.`),L(Qs(n,a),()=>`Error in conv1D: Either stride or dilation must be 1. Got stride ${n} and dilation '${a}'`),L(s==="NWC",()=>`Error in conv1d: got dataFormat of ${s} but only NWC is currently supported.`);let d=ue(l,[1,l.shape[0],l.shape[1],l.shape[2]]),h=ue(u,[u.shape[0],1,u.shape[1],u.shape[2]]),g=bp(h,d,[1,n],r,"NHWC",[1,a],o);return c?ue(g,[g.shape[2],g.shape[3]]):ue(g,[g.shape[0],g.shape[2],g.shape[3]])}var HO=H({conv1d_:UO});function GO(e,t,n,r,s,a="NHWC",o){L(e.length===t.rank,()=>`Length of inShape (${e.length}) and rank of dy (${t.rank}) must match`);let i=e,l=t,u=!1;t.rank===3&&(u=!0,l=ue(t,[1,t.shape[0],t.shape[1],t.shape[2]]),i=[1,e[0],e[1],e[2]]),L(i.length===4,()=>`Error in conv2dDerInput: inShape must be length 4, but got length ${i.length}.`),L(l.rank===4,()=>`Error in conv2dDerInput: dy must be rank 4, but got rank ${l.rank}`),L(n.rank===4,()=>`Error in conv2dDerInput: filter must be rank 4, but got rank ${n.rank}`);let c=a==="NHWC"?i[3]:i[1],d=a==="NHWC"?l.shape[3]:l.shape[1];L(c===n.shape[2],()=>`Error in conv2dDerInput: depth of input (${c}) must match input depth for filter ${n.shape[2]}.`),L(d===n.shape[3],()=>`Error in conv2dDerInput: depth of output (${d}) must match output depth for filter ${n.shape[3]}.`),o!=null&&L(Xn(s),()=>`Error in conv2dDerInput: pad must be an integer when using, dimRoundingMode ${o} but got pad ${s}.`);let h={dy:l,filter:n},p={strides:r,pad:s,dataFormat:a,dimRoundingMode:o,inputShape:i},f=U.runKernel(Iv,h,p);return u?ue(f,[f.shape[1],f.shape[2],f.shape[3]]):f}var Uk=H({conv2DBackpropInput_:GO});function jO(e,t,n,r,s,a){let o=P(e,"x","conv2dTranspose"),i=P(t,"filter","conv2dTranspose");return Uk(n,o,i,r,s,"NHWC",a)}var qO=H({conv2dTranspose_:jO});function KO(e,t,n,r,s="NDHWC",a=[1,1,1]){let o=P(e,"x","conv3d"),i=P(t,"filter","conv3d"),l=o,u=!1;o.rank===4&&(u=!0,l=ue(o,[1,o.shape[0],o.shape[1],o.shape[2],o.shape[3]])),L(l.rank===5,()=>`Error in conv3d: input must be rank 5, but got rank ${l.rank}.`),L(i.rank===5,()=>`Error in conv3d: filter must be rank 5, but got rank ${i.rank}.`),L(l.shape[4]===i.shape[3],()=>`Error in conv3d: depth of input (${l.shape[4]}) must match input depth for filter ${i.shape[3]}.`),L(Qs(n,a),()=>`Error in conv3D: Either strides or dilations must be 1. Got strides ${n} and dilations '${a}'`),L(s==="NDHWC",()=>`Error in conv3d: got dataFormat of ${s} but only NDHWC is currently supported.`);let c={x:l,filter:i},d={strides:n,pad:r,dataFormat:s,dilations:a},h=U.runKernel(Sv,c,d);return u?ue(h,[h.shape[1],h.shape[2],h.shape[3],h.shape[4]]):h}var XO=H({conv3d_:KO});function ZO(e,t,n,r,s){L(e.length===t.rank,()=>`Length of inShape (${e.length}) and rank of dy (${t.rank}) must match`);let a=e,o=t,i=!1;t.rank===4&&(i=!0,o=ue(t,[1,t.shape[0],t.shape[1],t.shape[2],t.shape[3]]),a=[1,e[0],e[1],e[2],e[3]]);let l=a[4],u=o.shape[4];L(a.length===5,()=>`Error in conv3dDerInput: inShape must be length 5, but got length ${a.length}.`),L(o.rank===5,()=>`Error in conv3dDerInput: dy must be rank 5, but got rank ${o.rank}`),L(n.rank===5,()=>`Error in conv3dDerInput: filter must be rank 5, but got rank ${n.rank}`),L(l===n.shape[3],()=>`Error in conv3dDerInput: depth of input (${l}) must match input depth for filter ${n.shape[3]}.`),L(u===n.shape[4],()=>`Error in conv3dDerInput: depth of output (${u}) must match output depth for filter ${n.shape[4]}.`);let c={dy:o,filter:n},d={pad:s,strides:r,inputShape:a},h=U.runKernel(Tv,c,d);return i?ue(h,[h.shape[1],h.shape[2],h.shape[3],h.shape[4]]):h}var YO=H({conv3DBackpropInput_:ZO});function JO(e,t,n,r,s){let a=P(e,"x","conv3dTranspose"),o=P(t,"filter","conv3dTranspose");return YO(n,a,o,r,s)}var QO=H({conv3dTranspose_:JO});function eP(e){let n={x:P(e,"x","cos")};return U.runKernel(Nv,n)}var tP=H({cos_:eP});function nP(e){let n={x:P(e,"x","cosh")};return U.runKernel(Cv,n)}var rP=H({cosh_:nP});function sP(e,t=0,n=!1,r=!1){let a={x:P(e,"x","cumsum")},o={axis:t,exclusive:n,reverse:r};return U.runKernel(Ev,a,o)}var aP=H({cumsum_:sP});function oP(e,t,n,r=!1){let s=P(e,"x","denseBincount"),a=P(t,"weights","denseBincount");L(s.dtype==="int32",()=>`Error in denseBincount: input dtype must be int32, but got ${s.dtype}`),L(s.rank<=2,()=>`Error in denseBincount: input must be at most rank 2, but got rank ${s.rank}.`),L(n>=0,()=>`size must be non-negative, but got ${n}.`),L(a.size===s.size||a.size===0,()=>`Error in denseBincount: weights must have the same shape as x or 0-length, but got x shape: ${s.shape}, weights shape: ${a.shape}.`);let o={x:s,weights:a},i={size:n,binaryOutput:r};return U.runKernel(_v,o,i)}var iP=H({denseBincount_:oP});function lP(e,t,n="NHWC"){let r=P(e,"x","depthToSpace"),s=n==="NHWC"?r.shape[1]:r.shape[2],a=n==="NHWC"?r.shape[2]:r.shape[3],o=n==="NHWC"?r.shape[3]:r.shape[1];L(s*t>=0,()=>`Negative dimension size caused by overflow when multiplying + ${s} and ${t} for depthToSpace with input shape + ${r.shape}`),L(a*t>=0,()=>`Negative dimension size caused by overflow when multiplying + ${a} and ${t} for depthToSpace with input shape + ${r.shape}`),L(o%(t*t)==0,()=>`Dimension size must be evenly divisible by ${t*t} but is ${o} for depthToSpace with input shape ${r.shape}`);let i={x:r},l={blockSize:t,dataFormat:n};return U.runKernel(Rv,i,l)}var uP=H({depthToSpace_:lP});function cP(e,t,n,r,s="NHWC",a=[1,1],o){let i=P(e,"x","depthwiseConv2d"),l=P(t,"filter","depthwiseConv2d"),u=i,c=!1;i.rank===3&&(c=!0,u=ue(i,[1,i.shape[0],i.shape[1],i.shape[2]])),L(u.rank===4,()=>`Error in depthwiseConv2d: input must be rank 4, but got rank ${u.rank}.`),L(l.rank===4,()=>`Error in depthwiseConv2d: filter must be rank 4, but got rank ${l.rank}.`),L(u.shape[3]===l.shape[2],()=>`Error in depthwiseConv2d: number of input channels (${u.shape[3]}) must match the inChannels dimension in filter ${l.shape[2]}.`),o!=null&&L(Xn(r),()=>`Error in depthwiseConv2d: pad must be an integer when using, dimRoundingMode ${o} but got pad ${r}.`);let d={x:u,filter:l},h={strides:n,pad:r,dataFormat:s,dilations:a,dimRoundingMode:o},p=U.runKernel(Dv,d,h);return c?ue(p,[p.shape[1],p.shape[2],p.shape[3]]):p}var ey=H({depthwiseConv2d_:cP});function dP(e){let n={x:P(e,"x","diag")};return U.runKernel(Ov,n)}var hP=H({diag_:dP});function pP(e,t,n,r,s=[1,1],a="NHWC"){let o=P(e,"x","dilation2d"),i=P(t,"filter","dilation2d");L(o.rank===3||o.rank===4,()=>`Error in dilation2d: input must be rank 3 or 4, but got rank ${o.rank}.`),L(i.rank===3,()=>`Error in dilation2d: filter must be rank 3, but got rank ${i.rank}.`),L(a==="NHWC",()=>`Error in dilation2d: Only NHWC is currently supported, but got dataFormat of ${a}`);let l=o,u=!1;o.rank===3&&(l=ue(o,[1,o.shape[0],o.shape[1],o.shape[2]]),u=!0);let c={x:l,filter:i},d={strides:n,pad:r,dilations:s},h=U.runKernel(Pv,c,d);return u?ue(h,[h.shape[1],h.shape[2],h.shape[3]]):h}var fP=H({dilation2d_:pP});function mP(e,t){let n=e.length,r=[];for(let s=0;s1&&o===1&&r.unshift(a)}return r}function Hk(e,t){let n=[];for(let r=0;r1)&&n.unshift(a)}return n}function In(e,t){let n=[],r=Math.max(e.length,t.length);for(let s=0;s`Error in dot: inputs must all be rank 1 or 2, but got ranks ${n.rank} and ${r.rank}.`);let s=n.rank===1?n.size:n.shape[1],a=r.rank===1?r.size:r.shape[0];if(L(s===a,()=>`Error in dot: inner dimensions of inputs must match, but got ${s} and ${a}.`),n.rank===1&&r.rank===1){let o=ue(n,[1,-1]),i=ue(r,[-1,1]),l=yt(o,i);return ue(l,[])}else if(n.rank===1&&r.rank===2){let o=ue(n,[1,-1]),i=ue(r,[r.shape[0],r.shape[1]]),l=yt(o,i);return ue(l,[l.size])}else if(n.rank===2&&r.rank===1){let o=ue(r,[-1,1]),i=yt(n,o);return ue(i,[i.size])}else{let o=ue(r,[r.shape[0],r.shape[1]]);return yt(n,o)}}var wP=H({dot_:vP});function kP(e,...t){let n=t.map((s,a)=>P(s,`tensors${a}`,"einsum")),r={equation:e};return U.runKernel(Lv,n,r)}var IP=H({einsum_:kP});function SP(e){let n={x:P(e,"x","elu")};return U.runKernel(Bv,n)}var jk=H({elu_:SP});function TP(e){let t=P(e,"x","erf");L(t.dtype==="int32"||t.dtype==="float32",()=>"Input dtype must be `int32` or `float32`."),t.dtype==="int32"&&(t=Pt(t,"float32"));let n={x:t};return U.runKernel(Wv,n)}var NP=H({erf_:TP});function CP(e){let n={x:P(e,"x","exp")};return U.runKernel(Uv,n)}var wo=H({exp_:CP});function EP(e,t=0){let n=P(e,"x","expandDims","string_or_numeric");L(t<=n.rank,()=>"Axis must be <= rank of the tensor");let r={input:n},s={dim:t};return U.runKernel(Hv,r,s)}var ea=H({expandDims_:EP});function $P(e){let n={x:P(e,"x","expm1")};return U.runKernel(Gv,n)}var _P=H({expm1_:$P});function RP(e,t){let n=P(e,"x","tile","string_or_numeric");L(n.rank===t.length,()=>`Error in transpose: rank of input ${n.rank} must match length of reps ${t}.`);let r={x:n},s={reps:t};return U.runKernel(c2,r,s)}var vp=H({tile_:RP});function DP(e,t,n,r="float32"){t==null&&(t=e);let s=Ys([e,t],r),a=e<=t?e:t;for(let i=0;i`Error in localResponseNormalization: x must be rank 3 or 4 but got + rank ${a.rank}.`),L(Xn(t),()=>`Error in localResponseNormalization: depthRadius must be an integer but got depthRadius ${t}.`);let o=a,i=!1;a.rank===3&&(i=!0,o=ue(a,[1,a.shape[0],a.shape[1],a.shape[2]]));let l={x:o},u={depthRadius:t,bias:n,alpha:r,beta:s},c=U.runKernel(gw,l,u);return i?ue(c,[c.shape[1],c.shape[2],c.shape[3]]):c}var YP=H({localResponseNormalization_:ZP});function JP(e){let n={x:P(e,"x","log")};return U.runKernel(dw,n)}var uc=H({log_:JP});function QP(e){let n={x:P(e,"x","log1p")};return U.runKernel(hw,n)}var Jk=H({log1p_:QP});function ez(e){return L(Sa(e),()=>"The f passed in grad(f) must be a function"),(t,n)=>{let r=P(t,"x","tf.grad","string_or_numeric"),s=n!=null?P(n,"dy","tf.grad"):null;return U.tidy(()=>{let{value:a,grads:o}=U.gradients(()=>e(r),[r],s);return s!=null&&Mn(a.shape,s.shape,"The shape of dy passed in grad(f)(x, dy) must match the shape returned by f(x)"),Ip(o),o[0]})}}function tz(e){return L(Sa(e),()=>"The f passed in grads(f) must be a function"),(t,n)=>{L(Array.isArray(t),()=>"The args passed in grads(f)(args) must be an array of `Tensor`s or `TensorLike`s");let r=sc(t,"args","tf.grads","string_or_numeric"),s=n!=null?P(n,"dy","tf.grads"):null;return U.tidy(()=>{let{value:a,grads:o}=U.gradients(()=>e(...r),r,s);return s!=null&&Mn(a.shape,s.shape,"The shape of dy passed in grads(f)([x1,...], dy) must match the shape returned by f([x1,...])"),Ip(o),o})}}function nz(e){return L(Sa(e),()=>"The f passed in valueAndGrad(f) must be a function"),(t,n)=>{L(t instanceof Tt,()=>"The x passed in valueAndGrad(f)(x) must be a tensor"),L(n==null||n instanceof Tt,()=>"The dy passed in valueAndGrad(f)(x, dy) must be a tensor");let{grads:r,value:s}=U.gradients(()=>e(t),[t],n);return Ip(r),{grad:r[0],value:s}}}function rz(e){return L(Sa(e),()=>"The f passed in valueAndGrads(f) must be a function"),(t,n)=>{L(Array.isArray(t)&&t.every(s=>s instanceof Tt),()=>"The args passed in valueAndGrads(f)(args) must be array of tensors"),L(n==null||n instanceof Tt,()=>"The dy passed in valueAndGrads(f)(args, dy) must be a tensor");let r=U.gradients(()=>e(...t),t,n);return n!=null&&Mn(r.value.shape,n.shape,"The shape of dy passed in valueAndGrads(f)([x1,...], dy) must match the shape returned by f([x1,...])"),Ip(r.grads),r}}function Qk(e,t){L(Sa(e),()=>"The f passed in variableGrads(f) must be a function"),L(t==null||Array.isArray(t)&&t.every(u=>u instanceof rc),()=>"The varList passed in variableGrads(f, varList) must be an array of variables");let n=t!=null;if(!n){t=[];for(let u in U.registeredVariables)t.push(U.registeredVariables[u])}let r=n?t.filter(u=>!u.trainable):null,s=t.length;t=t.filter(u=>u.trainable),L(t.length>0,()=>`variableGrads() expects at least one of the input variables to be trainable, but none of the ${s} variables is trainable.`);let a=!0,{value:o,grads:i}=U.gradients(e,t,null,a);L(i.some(u=>u!=null),()=>"Cannot find a connection between any variable and the result of the loss function y=f(x). Please make sure the operations that use variables are inside the function f passed to minimize()."),L(o.rank===0,()=>`The f passed in variableGrads(f) must return a scalar, but it returned a rank-${o.rank} tensor`);let l={};return t.forEach((u,c)=>{i[c]!=null&&(l[u.name]=i[c])}),r!=null&&r.forEach(u=>l[u.name]=null),{value:o,grads:l}}function Ns(e){return U.customGrad(e)}function Ip(e){if(e.filter(n=>n==null).length>0)throw new Error(`Cannot compute gradient of y=f(x) with respect to x. Make sure that + the f you passed encloses all operations that lead from x to y.`)}function sz(e){let n={x:P(e,"x","neg")};return U.runKernel(Ew,n)}var $a=H({neg_:sz});function az(e){let n={x:P(e,"x","softplus")};return U.runKernel(o7,n)}var e4=H({softplus_:az});function oz(e){let t=P(e,"x","logSigmoid");return Ns(r=>({value:$a(e4($a(r))),gradFunc:o=>fe(o,Ts($a(r)))}))(t)}var iz=H({logSigmoid_:oz});function lz(e,t=null,n=!1){let s={x:P(e,"x","max")},a={reductionIndices:t,keepDims:n};return U.runKernel(yw,s,a)}var _a=H({max_:lz});function uz(e,t){let n=P(e,"a","sub"),r=P(t,"b","sub");[n,r]=Vt(n,r);let s={a:n,b:r};return U.runKernel(w7,s)}var He=H({sub_:uz});function cz(e,t=null,n=!1){let r=P(e,"x","sum");r.dtype==="bool"&&(r=Pt(r,"int32"));let s={x:r},a={axis:t,keepDims:n};return U.runKernel(l7,s,a)}var _t=H({sum_:cz});function dz(e,t=-1){let n=P(e,"logits","logSoftmax");if(t===-1&&(t=n.rank-1),t!==n.rank-1)throw Error(`Log Softmax along a non-last dimension is not yet supported. Logits was rank ${n.rank} and axis was ${t}`);return Ns((s,a)=>{let o=!0,i=_a(s,t,!0),l=He(s,i),u=He(Pt(l,"float32"),uc(_t(wo(l),t,o)));return a([u]),{value:u,gradFunc:(d,h)=>{let[p]=h,f=!0,m=wo(p);return He(d,fe(_t(d,t,f),m))}}})(n)}var hz=H({logSoftmax_:dz});function ry(e,t){for(let n=0;ne[a]);return[n,s]}function cc(e,t){let n=t.map(r=>1);return t4(e,n,t)}function fz(e,t,n){L(ry(t,n),()=>`${e} supports only inner-most axes for now. Got axes ${t} and rank-${n} input.`)}function mz(e,t){if(ry(e,t))return null;let n=[];for(let r=0;rn.push(r)),n}function gz(e){return e.map((t,n)=>[n,t]).sort((t,n)=>t[1]-n[1]).map(t=>t[0])}function yz(e,t){let n=[];for(let r=t-e;r`Error in maxPool: input must be rank 4 but got rank ${i.rank}.`),L(Qs(n,o),()=>`Error in maxPool: Either strides or dilations must be 1. Got strides ${n} and dilations '${o}'`),s!=null&&L(Xn(r),()=>`Error in maxPool: pad must be an integer when using, dimRoundingMode ${s} but got pad ${r}.`);let u={x:i},c={filterSize:t,strides:n,pad:r,dimRoundingMode:s},d=U.runKernel(xw,u,c);return l?ue(d,[d.shape[1],d.shape[2],d.shape[3]]):d}var a4=H({maxPool_:Iz});function Sz(e,t=[1,1,1],n,r,s,a="NDHWC"){let o=P(e,"x","maxPool3d"),i=o,l=!1;o.rank===4&&(l=!0,i=ue(o,[1,o.shape[0],o.shape[1],o.shape[2],o.shape[3]])),L(i.rank===5,()=>`Error in maxPool3d: x must be rank 5 but got rank ${i.rank}.`),L(a==="NDHWC",()=>`Error in maxPool3d: Only NDHWC is currently supported, but got dataFormat of ${a}`),s!=null&&L(Xn(r),()=>`Error in maxPool3d: pad must be an integer when using, dimRoundingMode ${s} but got pad ${r}.`);let u={x:i},c={filterSize:t,strides:n,pad:r,dimRoundingMode:s,dataFormat:a},d=U.runKernel(bw,u,c);return l?ue(d,[d.shape[1],d.shape[2],d.shape[3],d.shape[4]]):d}var Tz=H({maxPool3d_:Sz});function Nz(e,t,n,r,s=!1){let o={x:P(e,"x","maxPoolWithArgmax")},i={filterSize:t,strides:n,pad:r,includeBatchInIndex:s},l=U.runKernel(vw,o,i);return{result:l[0],indexes:l[1]}}var Cz=H({maxPoolWithArgmax_:Nz});function Ez(e,t){let n=P(e,"a","maximum"),r=P(t,"b","maximum");[n,r]=Vt(n,r),n.dtype==="bool"&&(n=Pt(n,"int32"),r=Pt(r,"int32")),In(n.shape,r.shape);let s={a:n,b:r};return U.runKernel(Aw,s)}var o4=H({maximum_:Ez});function $z(e,t=null,n=!1){let s={x:P(e,"x","mean")},a={axis:t,keepDims:n};return U.runKernel(ww,s,a)}var Tp=H({mean_:$z});function ji(e,t="float32"){if(t==="complex64"){let r=ji(e,"float32"),s=ji(e,"float32");return go(r,s)}let n=np(Jt(e),t);return U.makeTensor(n,e,t)}function ko(e,t="float32"){if(t==="complex64"){let r=ko(e,"float32"),s=ji(e,"float32");return go(r,s)}let n=n2(Jt(e),t);return U.makeTensor(n,e,t)}function _z(e,t,{indexing:n="xy"}={}){if(n!=="xy"&&n!=="ij")throw new TypeError(`${n} is not a valid third argument to meshgrid`);if(e===void 0)return[];let r=P(e,"x","meshgrid",e instanceof Tt?e.dtype:"float32");if(t===void 0)return[r];let s=P(t,"y","meshgrid",t instanceof Tt?t.dtype:"float32"),a=Jt(r.shape),o=Jt(s.shape);return n==="xy"?(r=ue(r,[1,-1]),s=ue(s,[-1,1]),[yt(ko([o,1],r.dtype),r),yt(s,ko([1,a],s.dtype))]):(r=ue(r,[-1,1]),s=ue(s,[1,-1]),[yt(r,ko([1,o],r.dtype)),yt(ko([a,1],s.dtype),s)])}function Rz(e,t=null,n=!1){let s={x:P(e,"x","min")},a={axis:t,keepDims:n};return U.runKernel(kw,s,a)}var sy=H({min_:Rz});function Dz(e,t){let n=P(e,"a","minimum"),r=P(t,"b","minimum");[n,r]=Vt(n,r),n.dtype==="bool"&&(n=Pt(n,"int32"),r=Pt(r,"int32")),In(n.shape,r.shape);let s={a:n,b:r};return U.runKernel(Iw,s)}var i4=H({minimum_:Dz});function Fz(e,t,n){L(n==="reflect"||n==="symmetric",()=>`Invalid mode. Mode must be either reflect or symmetric. Got ${n}.`);let r=P(e,"x","mirrorPad");if(r.rank===0)throw new Error("mirrorPad(scalar) is not defined. Pass non-scalar to mirrorPad");L(t.length===r.rank,()=>`Padding doesn't match input. Must be ${r.rank}. Got ${t.length}.`);let s=n==="reflect"?1:0;for(let i=0;i"Invalid number of paddings. Must be length of 2 each."),L(t[i][0]>=0&&t[i][0]<=r.shape[i]-s&&t[i][1]>=0&&t[i][1]<=r.shape[i]-s,()=>`Padding in dimension ${i} cannot be greater than or equal to ${r.shape[i]-s} or less than 0 for input of shape ${r.shape}`);let a={paddings:t,mode:n},o={x:r};return U.runKernel(Sw,o,a)}var Mz=H({mirrorPad_:Fz});function Oz(e,t){let n=P(e,"a","mod"),r=P(t,"b","mod");[n,r]=Vt(n,r);let s={a:n,b:r};return U.runKernel(Tw,s)}var Pz=H({mod_:Oz});function zz(e){let t=P(e,"x","square"),n={};return U.runKernel("Square",{x:t},n)}var ns=H({square_:zz});function Lz(e,t=null,n=!1){e=P(e,"x","moments");let r=Xu(t,e.shape),s=Tp(e,r,n),a=s.shape;n||(a=cc(s.shape,r));let o=ns(He(Pt(e,"float32"),ue(s,a))),i=Tp(o,r,n);return{mean:s,variance:i}}var Bz=H({moments_:Lz});function Wz(e,t,n,r){let s=P(t,"data","multiRNNCell"),a=sc(n,"c","multiRNNCell"),o=sc(r,"h","multiRNNCell"),i=s,l=[];for(let d=0;d2)throw new Error(`Rank of probabilities must be 1 or 2, but is ${o}`);n=n||Math.random();let l={logits:o===1?ue(s,[1,-1]):s},u={numSamples:t,seed:n,normalized:r},c=U.runKernel(Nw,l,u);return o===1?ue(c,[c.size]):c}var Hz=H({multinomial_:Uz});function Gz(e,t){let n=P(e,"a","notEqual","string_or_numeric"),r=P(t,"b","notEqual","string_or_numeric");[n,r]=Vt(n,r),In(n.shape,r.shape);let s={a:n,b:r};return U.runKernel($w,s)}var l4=H({notEqual_:Gz});function jz(e){let n={x:P(e,"x","onesLike")};return U.runKernel(Fw,n)}var qz=H({onesLike_:jz});function Kz(e,t){let n=P(e,"v1","outerProduct"),r=P(t,"v2","outerProduct");L(n.rank===1&&r.rank===1,()=>`Error in outerProduct: inputs must be rank 1, but got ranks ${n.rank} and ${r.rank}.`);let s=ue(n,[-1,1]),a=ue(r,[1,-1]);return yt(s,a)}var Xz=H({outerProduct_:Kz});function Zz(e,t,n=0){let r=P(e,"x","pad");if(r.rank===0)throw new Error("pad(scalar) is not defined. Pass non-scalar to pad");let s={paddings:t,constantValue:n},a={x:r};return U.runKernel(Pw,a,s)}var dc=H({pad_:Zz});function Yz(e,t,n=0){return L(t.length===2,()=>"Invalid number of paddings. Must be length of 2."),dc(e,[t],n)}var Jz=H({pad1d_:Yz});function Qz(e,t,n=0){return L(t.length===2&&t[0].length===2&&t[1].length===2,()=>"Invalid number of paddings. Must be length of 2 each."),dc(e,t,n)}var eL=H({pad2d_:Qz});function tL(e,t,n=0){return L(t.length===3&&t[0].length===2&&t[1].length===2&&t[2].length===2,()=>"Invalid number of paddings. Must be length of 2 each."),dc(e,t,n)}var nL=H({pad3d_:tL});function rL(e,t,n=0){return L(t.length===4&&t[0].length===2&&t[1].length===2&&t[2].length===2&&t[3].length===2,()=>"Invalid number of paddings. Must be length of 2 each."),dc(e,t,n)}var sL=H({pad4d_:rL});function aL(e,t,n){let r=P(e,"x","spaceToBatchND");L(r.rank>=1+t.length,()=>`input rank ${r.rank} should be > than [blockShape] ${t.length}`),L(n.length===t.length,()=>`paddings.shape[0] ${n.length} must be equal to [blockShape] ${t.length}`),L(r.shape.reduce((o,i,l)=>l>0&&l<=t.length?o&&(i+n[l-1][0]+n[l-1][1])%t[l-1]==0:o,!0),()=>`input spatial dimensions ${r.shape.slice(1)} with paddings ${n.toString()} must be divisible by blockShapes ${t.toString()}`);let s={x:r},a={blockShape:t,paddings:n};return U.runKernel(u7,s,a)}var u4=H({spaceToBatchND_:aL});function oL(e,t,n,r,s,a){s==null&&(s=[1,1]),a==null&&(a=1),r===0&&(r="valid");let o=P(e,"x","maxPool"),i=o,l=!1;o.rank===3&&(l=!0,i=ue(o,[1,o.shape[0],o.shape[1],o.shape[2]])),L(Qs(a,s),()=>`Error in pool: Either strides or dilations must be 1. Got strides ${a} and dilations '${s}'`);let u=Pk(i.shape,t,a,s,r),c=[u.dilationHeight,u.dilationWidth],d;r==="same"?d=lL([u.filterHeight,u.filterWidth],c):d=[[0,0],[0,0]];let h=c[0]===1&&c[1]===1,[p,f]=iL([u.inHeight,u.inWidth],c,d),m=h?r:"valid",g=h?i:u4(i,c,p),A=(n==="avg"?()=>Bk(g,t,a,m):()=>a4(g,t,a,m))(),x=h?A:Wk(A,c,f);return l?ue(x,[x.shape[1],x.shape[2],x.shape[3]]):x}function iL(e,t,n){let r=n.map(c=>c[0]),s=n.map(c=>c[1]),a=e.concat(r,s),o=t.map((c,d)=>(c-a[d]%c)%c),i=s.map((c,d)=>c+o[d]),l=t.map((c,d)=>[r[d],i[d]]),u=t.map((c,d)=>[0,o[d]]);return[l,u]}function lL(e,t){let r=e.map((o,i)=>o+(o-1)*(t[i]-1)).map(o=>o-1),s=r.map(o=>Math.floor(o/2)),a=r.map((o,i)=>o-s[i]);return r.map((o,i)=>[s[i],a[i]])}var uL=H({pool_:oL});function cL(e,t){let n=P(e,"base","pow"),r=P(t,"exp","pow");[n,r]=Vt(n,r);let s={a:n,b:r};return U.runKernel(zw,s)}var hc=H({pow_:cL});function dL(e,t){let n=P(e,"x","prelu"),r=P(t,"alpha","prelu"),s={x:n,alpha:r};return U.runKernel(Lw,s)}var c4=H({prelu_:dL});function hL(e,t=null,n=!1){let r=P(e,"x","prod");r.dtype==="bool"&&(r=Pt(r,"int32"));let s={x:r},a={axis:t,keepDims:n};return U.runKernel(Bw,s,a)}var pL=H({prod_:hL});function fL(e,t,n){let r=Jt(e),s=null;if(n==null||n==="float32")s=new Float32Array(r);else if(n==="int32")s=new Int32Array(r);else if(n==="bool")s=new Uint8Array(r);else throw new Error(`Unknown data type ${n}`);for(let a=0;a=1||a===0);let o=Math.sqrt(-2*Math.log(a)/a);e=this.mean+this.stdDev*r*o,t=this.mean+this.stdDev*s*o,(!this.truncated||this.isValidTruncated(e))&&(n=!0)}return(!this.truncated||this.isValidTruncated(t))&&(this.nextVal=this.convertValue(t)),this.convertValue(e)}convertValue(e){return this.dtype==null||this.dtype==="float32"?e:Math.round(e)}isValidTruncated(e){return e<=this.upper&&e>=this.lower}},gL=class{constructor(e,t,n,r){this.alpha=e,this.beta=1/t,this.dtype=n;let s=r||Math.random();this.randu=ay.alea(s.toString()),this.randn=new oy(0,1,n,!1,this.randu()),e<1?this.d=e+2/3:this.d=e-1/3,this.c=1/Math.sqrt(9*this.d)}nextValue(){let e,t,n,r,s,a;for(;;){do r=this.randn.nextValue(),a=1+this.c*r;while(a<=0);if(a*=a*a,e=r*r,t=1-.331*e*e,n=.5*e+this.d*(1-a+Math.log(a)),s=this.randu(),sthis.dtype==null||this.dtype==="float32",this.min=e,this.range=t-e,this.dtype=n,r==null&&(r=Math.random()),typeof r=="number"&&(r=r.toString()),!this.canReturnFloat()&&this.range<=1)throw new Error(`The difference between ${e} - ${t} <= 1 and dtype is not float`);this.random=ay.alea(r)}convertValue(e){return this.canReturnFloat()?e:Math.round(e)}nextValue(){return this.convertValue(this.min+this.range*this.random())}};function AL(e,t,n=1,r="float32",s){if(n==null&&(n=1),r==null&&(r="float32"),r!=="float32"&&r!=="int32")throw new Error(`Unsupported data type ${r}`);let a=new gL(t,n,r,s),o=Ys(e,r);for(let i=0;i`Error in reverse1D: x must be rank 1 but got rank ${t.rank}.`),Io(t,0)}var $L=H({reverse1d_:EL});function _L(e,t){let n=P(e,"x","reverse");return L(n.rank===2,()=>`Error in reverse2D: x must be rank 2 but got rank ${n.rank}.`),Io(n,t)}var RL=H({reverse2d_:_L});function DL(e,t){let n=P(e,"x","reverse");return L(n.rank===3,()=>`Error in reverse3D: x must be rank 3 but got rank ${n.rank}.`),Io(n,t)}var FL=H({reverse3d_:DL});function ML(e,t){let n=P(e,"x","reverse");return L(n.rank===4,()=>`Error in reverse4D: x must be rank 4 but got rank ${n.rank}.`),Io(n,t)}var OL=H({reverse4d_:ML});function PL(e){let n={x:P(e,"x","round")};return U.runKernel(Zw,n)}var p4=H({round_:PL});function zL(e){let n={x:P(e,"x","rsqrt")};return U.runKernel(Yw,n)}var LL=H({rsqrt_:zL});function ut(e,t){if((Cn(e)&&t!=="string"||Array.isArray(e))&&t!=="complex64")throw new Error("Error creating a new Scalar: value must be a primitive (number|boolean|string)");if(t==="string"&&Cn(e)&&!(e instanceof Uint8Array))throw new Error("When making a scalar from encoded string, the value must be `Uint8Array`.");return Na(e,[],[],t)}function BL(e){let n={x:P(e,"x","selu")};return U.runKernel(e7,n)}var WL=H({selu_:BL});function VL(e,t,n,r,s,a=[1,1],o="NHWC"){let i=P(e,"x","separableConv2d"),l=P(t,"depthwiseFilter","separableConv2d"),u=P(n,"pointwiseFilter","separableConv2d"),c=i,d=!1;if(i.rank===3&&(d=!0,c=ue(i,[1,i.shape[0],i.shape[1],i.shape[2]])),o==="NCHW")throw new Error("separableConv2d currently does not support dataFormat NCHW; only NHWC is supported");L(c.rank===4,()=>`Error in separableConv2d: input must be rank 4, but got rank ${c.rank}.`),L(l.rank===4,()=>`Error in separableConv2d: depthwise filter must be rank 4, but got rank ${l.rank}.`),L(u.rank===4,()=>`Error in separableConv2d: pointwise filter must be rank 4, but got rank ${l.rank}.`),L(u.shape[0]===1,()=>`Error in separableConv2d: the first dimension of pointwise filter must be 1, but got ${u.shape[0]}.`),L(u.shape[1]===1,()=>`Error in separableConv2d: the second dimension of pointwise filter must be 1, but got ${u.shape[1]}.`);let h=l.shape[2],p=l.shape[3];L(u.shape[2]===h*p,()=>`Error in separableConv2d: the third dimension of pointwise filter must be ${h*p}, but got ${u.shape[2]}.`);let f=ey(c,l,r,s,o,a),g=bp(f,u,1,"valid",o);return d?ue(g,[g.shape[1],g.shape[2],g.shape[3]]):g}var UL=H({separableConv2d_:VL});async function HL(e,t){let n=P(e,"x","setdiff1d"),r=P(t,"y","setdiff1d");L(n.dtype===r.dtype,()=>`x and y should have the same dtype, but got x (${n.dtype}) and y (${r.dtype}).`),L(n.rank===1,()=>`x should be 1D tensor, but got x (${n.shape}).`),L(r.rank===1,()=>`y should be 1D tensor, but got y (${r.shape}).`);let s=await n.data(),a=await r.data(),o=new Set(a),i=0;for(let c=0;c`slice1d expects a rank-1 tensor, but got a rank-${r.rank} tensor`),Ze(r,[t],[n])}var QL=H({slice1d_:JL});function eB(e,t,n){let r=P(e,"x","slice2d");return L(r.rank===2,()=>`slice2d expects a rank-2 tensor, but got a rank-${r.rank} tensor`),Ze(r,t,n)}var tB=H({slice2d_:eB});function nB(e,t,n){let r=P(e,"x","slice3d");return L(r.rank===3,()=>`slice3d expects a rank-3 tensor, but got a rank-${r.rank} tensor`),Ze(r,t,n)}var rB=H({slice3d_:nB});function sB(e,t,n){let r=P(e,"x","slice4d");return L(r.rank===4,()=>`slice4d expects a rank-4 tensor, but got a rank-${r.rank} tensor`),Ze(r,t,n)}var aB=H({slice4d_:sB});function oB(e,t=-1){let n=P(e,"logits","softmax","float32");if(t===-1&&(t=n.rank-1),t!==n.rank-1)throw Error(`Softmax along a non-last dimension is not yet supported. Logits was rank ${n.rank} and dim was ${t}`);let r={logits:n},s={dim:t};return U.runKernel(d7,r,s)}var iB=H({softmax_:oB});function lB(e){L(e.dtype==="complex64",()=>`The dtype for tf.spectral.fft() must be complex64 but got ${e.dtype}.`);let t={input:e};return U.runKernel(jv,t)}var iy=H({fft_:lB});function uB(e){L(e.dtype==="complex64",()=>`The dtype for tf.spectral.ifft() must be complex64 but got ${e.dtype}.`);let t={input:e};return U.runKernel(nw,t)}var Ep=H({ifft_:uB});function cB(e){let t=e.shape[e.shape.length-1],n=e.size/t,r;if(t<=2){let s=ue(e,[n,t]);r=Ep(s)}else{let s=[n,2*(t-1)],a=ue(Np(e),[n,t]),o=ue(ty(e),[n,t]),i=Io(Ze(a,[0,1],[n,t-2]),1),l=fe(Io(Ze(o,[0,1],[n,t-2]),1),ut(-1)),u=an([a,i],1),c=an([o,l],1),d=ue(go(u,c),[s[0],s[1]]);r=Ep(d)}if(r=Np(r),e.rank===3&&e.shape[0]!==0){let s=r,a=e.shape[0];r=ue(r,[a,r.shape[0]/a,r.shape[1]]),s.dispose()}return r}var f4=H({irfft_:cB});function dB(e,t,n=0){let s={x:P(e,"x","split")},a={numOrSizeSplits:t,axis:n};return U.runKernel(c7,s,a)}var ta=H({split_:dB});function hB(e,t){L(e.dtype==="float32",()=>`The dtype for rfft() must be real value but got ${e.dtype}`);let n=e.shape[e.shape.length-1],r=e.size/n,s;if(t!=null&&t0),m=e.shape.map(g=>g);m[e.shape.length-1]=t,s=Ze(e,f,m),n=t}else if(t!=null&&t>n){let f=e.shape.map(m=>m);f[e.shape.length-1]=t-n,s=an([e,ji(f)],e.shape.length-1),n=t}else s=e;let a=Cr(s),o=ue(go(s,a),[r,n]),i=iy(o),l=Math.floor(n/2)+1,u=Np(i),c=ty(i),d=ta(u,[l,n-l],u.shape.length-1),h=ta(c,[l,n-l],c.shape.length-1),p=s.shape.slice();return p[s.shape.length-1]=l,ue(go(d[0],h[0]),p)}var ly=H({rfft_:hB});function pB(e){let n={x:P(e,"x","sqrt")};return U.runKernel(i7,n)}var na=H({sqrt_:pB});function fB(e,t){let n=P(e,"a","squaredDifference"),r=P(t,"b","squaredDifference");[n,r]=Vt(n,r),In(n.shape,r.shape);let s={a:n,b:r},a={};return U.runKernel(y7,s,a)}var m4=H({squaredDifference_:fB});function mB(e,t){let n=P(e,"x","squeeze");return ue(n,W3(n.shape,t).newShape)}var Zn=H({squeeze_:mB});function gB(e,t=0){let n=sc(e,"tensors","stack","string_or_numeric");L(n.length>=1,()=>"Pass at least one tensor to tf.stack"),n.length>0&&L(t<=n[0].rank,()=>"Axis must be <= rank of the tensor");let r=n,s={axis:t};return U.runKernel(Ow,r,s)}var So=H({stack_:gB});function yB(e,t=0){let r={x:P(e,"x","step")},s={alpha:t};return U.runKernel(R7,r,s)}var g4=H({step_:yB});function AB(e,t,n,r,s=0,a=0,o=0,i=0,l=0){let c={x:P(e,"x","stridedSlice","string_or_numeric")},d={begin:t,end:n,strides:r,beginMask:s,endMask:a,ellipsisMask:o,newAxisMask:i,shrinkAxisMask:l};return U.runKernel(A7,c,d)}var xB=H({stridedSlice_:AB});function bB(e){let n={x:P(e,"x","tan")};return U.runKernel(k7,n)}var vB=H({tan_:bB});function lr(e,t){ho(e);let n=Ss(e,t);if(n.length!==1)throw new Error("tensor1d() requires values to be a flat/TypedArray");return Na(e,null,n,t)}function ra(e,t,n){if(ho(e),t!=null&&t.length!==2)throw new Error("tensor2d() requires shape to have two numbers");let r=Ss(e,n);if(r.length!==2&&r.length!==1)throw new Error("tensor2d() requires values to be number[][] or flat/TypedArray");if(r.length===1&&t==null)throw new Error("tensor2d() requires shape to be provided when `values` are a flat/TypedArray");return Na(e,t,r,n)}function wB(e,t,n){if(ho(e),t!=null&&t.length!==4)throw new Error("tensor4d() requires shape to have four numbers");let r=Ss(e,n);if(r.length!==4&&r.length!==1)throw new Error("tensor4d() requires values to be number[][][][] or flat/TypedArray");if(r.length===1&&t==null)throw new Error("tensor4d() requires shape to be provided when `values` are a flat array");return Na(e,t,r,n)}function kB(e,t,n){if(ho(e),t!=null&&t.length!==5)throw new Error("tensor5d() requires shape to have five numbers");let r=Ss(e,n);if(r.length!==5&&r.length!==1)throw new Error("tensor5d() requires values to be number[][][][][] or flat/TypedArray");if(r.length===1&&t==null)throw new Error("tensor5d() requires shape to be provided when `values` are a flat array");return Na(e,t,r,n)}function IB(e,t,n){if(ho(e),t!=null&&t.length!==6)throw new Error("tensor6d() requires shape to have six numbers");let r=Ss(e,n);if(r.length!==6&&r.length!==1)throw new Error("tensor6d() requires values to be number[][][][][][] or flat/TypedArray");if(r.length===1&&t==null)throw new Error("tensor6d() requires shape to be provided when `values` are a flat array");return t=t||r,Na(e,t,r,n)}function SB(e,t=1,n=!0){let r=P(e,"x","topk");if(r.rank===0)throw new Error("topk() expects the input to be of rank 1 or higher");let s=r.shape[r.shape.length-1];if(t>s)throw new Error(`'k' passed to topk() must be <= the last dimension (${s}) but got ${t}`);let a={x:r},o={k:t,sorted:n},[i,l]=U.runKernel(S7,a,o);return{values:i,indices:l}}var TB=H({topk_:SB});function NB(e,t=0,n=1,r,s){if(r!=null&&r==="bool")throw new Error("Unsupported data type $ { dtype }");let a=new oy(t,n,r,!0,s),o=Ys(e,r);for(let i=0;i0,()=>"The input tensor must be at least 1D");let r={x:n},s={axis:t},[a,o]=U.runKernel(C7,r,s);return{values:a,indices:o}}var $B=H({unique_:EB});function _B(e,t,n){let r=P(e,"x","unsortedSegmentSum"),s=P(t,"segmentIds","unsortedSegmentSum","int32");L(Xn(n),()=>"numSegments must be of dtype int");let a={x:r,segmentIds:s},o={numSegments:n};return U.runKernel($7,a,o)}var RB=H({unsortedSegmentSum_:_B});function DB(e,t=0){let n=P(e,"x","unstack","string_or_numeric");L(t>=-n.shape.length&&t`Axis = ${t} is not in [-${n.shape.length}, ${n.shape.length})`);let r={value:n},s={axis:t};return U.runKernel(E7,r,s)}var fc=H({unstack_:DB});function FB(e,t=!0,n,r){return U.makeVariable(e,t,n,r)}function y4(e,t){let n=[];for(let a=0;a0,()=>"mask cannot be scalar"),Mn(i.slice(a,a+o),s.shape,"mask's shape must match the first K dimensions of tensor's shape,");let l=1;for(let m=a;m"Shape mismatch in v and x");let l=ut(1),u=He(l,i),c=fe(He(o,a),u);if(s){L(r!=null,()=>"When using zeroDebias: true, step is required.");let d=P(r,"step","movingAverage");c=Qe(c,He(l,hc(i,d)))}return Me(a,c)}var BB=H({movingAverage_:LB});function WB(e,t,n){let r=P(e,"indices","scatterND","int32"),s=P(t,"updates","scatterND");V2(s,r,n);let a={indices:r,updates:s},o={shape:n};return U.runKernel(Jw,a,o)}var VB=H({scatterND_:WB});function UB(e,t,n,r){if(e.dtype!=="int32")throw new Error(`tf.sparseToDense() expects the indices to be int32 type, but the dtype was ${e.dtype}.`);if(e.rank>2)throw new Error(`sparseIndices should be a scalar, vector, or matrix, but got shape ${e.shape}.`);let s=e.rank>0?e.shape[0]:1,a=e.rank>1?e.shape[1]:1;if(n.length!==a)throw new Error(`outputShape has incorrect number of elements:, ${n.length}, should be: ${a}.`);let o=t.size;if(!(t.rank===0||t.rank===1&&o===s))throw new Error(`sparseValues has incorrect shape ${t.shape}, should be [] or [${s}]`);if(t.dtype!==r.dtype)throw new Error("sparseValues.dtype must match defaultValues.dtype")}function HB(e,t,n,r=0){let s=P(e,"sparseIndices","sparseToDense","int32"),a=P(t,"sparseValues","sparseToDense"),o=P(r,"defaultValue","sparseToDense",a.dtype);UB(s,a,n,o);let i={sparseIndices:s,sparseValues:a,defaultValue:o},l={outputShape:n};return U.runKernel(g7,i,l)}var GB=H({sparseToDense_:HB});function jB(e,t){let n=P(t,"indices","gatherND","int32"),s={params:P(e,"x","gatherND","string_or_numeric"),indices:n};return U.runKernel(Qv,s)}var qB=H({gatherND_:jB});function KB(e,t){if(t==null)return e.shape.slice();if(Xs(e.shape,t))return t;if(e.shape.length===t.length){let n=[];for(let r=0;r`x has to be a floating point tensor since it's going to be scaled, but got a ${s.dtype} tensor instead.`),L(t>=0&&t<1,()=>`rate must be a float in the range [0, 1), but got ${t}.`),t===0)return e instanceof Tt?s.clone():s;let a=KB(s,n),o=1-t,i=Qe(Kk(Me(d4(a,0,1,"float32",r),o)),o);return fe(s,i)}var ZB=H({dropout_:XB});function b4(e){return Math.floor(Math.pow(2,Math.ceil(Math.log(e)/Math.log(2))))}function cy(e,t,n){let r=1-e%2,s=new Float32Array(e);for(let a=0;a1,()=>`inTopK() expects the predictions to be of rank 2 or higher, but got ${r.rank}`),L(r.rank-1===s.rank,()=>`predictions rank should be 1 larger than targets rank, but got predictions rank ${r.rank} and targets rank ${s.rank}`),Mn(r.shape.slice(0,r.shape.length-1),s.shape,"predictions's shape should be align with the targets' shape, except the last dimension.");let a=r.shape[r.shape.length-1];L(n>0&&n<=a,()=>`'k' passed to inTopK() must be > 0 && <= the predictions last dimension (${a}), but got ${n}`);let o=await r.data(),i=await s.data(),[l,u]=[o.length/a,a],c=V3("bool",l);for(let d=0;dg.value-m.value),c[d]=0;for(let m=0;mnW,depthwiseConv2d:()=>lW,matMul:()=>cW});function QB(e,t,n,r,s,a="NHWC",o){let i=e;e.rank===3&&(i=ue(e,[1,e.shape[0],e.shape[1],e.shape[2]]));let l=t;l.rank===3&&(l=ue(t,[1,t.shape[0],t.shape[1],t.shape[2]])),L(i.rank===4,()=>`Error in conv2dDerFilter: input must be rank 4, but got shape ${i.shape}.`),L(l.rank===4,()=>`Error in conv2dDerFilter: dy must be rank 4, but got shape ${l.shape}.`),L(n.length===4,()=>`Error in conv2dDerFilter: filterShape must be length 4, but got ${n}.`);let u=a==="NHWC"?i.shape[3]:i.shape[1],c=a==="NHWC"?l.shape[3]:l.shape[1];L(u===n[2],()=>`Error in conv2dDerFilter: depth of input ${u}) must match input depth in filter (${n[2]}.`),L(c===n[3],()=>`Error in conv2dDerFilter: depth of dy (${c}) must match output depth for filter (${n[3]}).`),o!=null&&L(Xn(s),()=>`Error in conv2dDerFilter: pad must be an integer when using, dimRoundingMode ${o} but got pad ${s}.`);let d={x:i,dy:l},h={strides:r,pad:s,dataFormat:a,dimRoundingMode:o,filterShape:n};return U.runKernel(kv,d,h)}var eW=H({conv2DBackpropFilter_:QB});function $p(e,t,n){if(n==null||n==="linear")return e;if(n==="relu")return fe(e,g4(t));throw new Error(`Cannot compute gradient for fused activation ${n}.`)}function _p(e,t){let n=t,r=Hk(e.shape,t.shape);return r.length>0&&(n=_t(n,r)),ue(n,e.shape)}function Rp(e,t,n,r){if(t==="linear")return e;if(t==="relu")return Cp(e);if(t==="elu")return jk(e);if(t==="relu6")return h4(e);if(t==="prelu")return c4(e,n);if(t==="leakyrelu")return Yk(e,r);if(t==="sigmoid")return Ts(e);throw new Error(`Unknown fused activation ${t}.`)}var Dp=(e,t)=>!(e>0)||t==="linear";function tW({x:e,filter:t,strides:n,pad:r,dataFormat:s="NHWC",dilations:a=[1,1],dimRoundingMode:o,bias:i,activation:l="linear",preluActivationWeights:u,leakyreluAlpha:c}){if(l=l||"linear",Dp(U.state.gradientDepth,l)===!1){let v=bp(e,t,n,r,s,a,o);return i!=null&&(v=Me(v,i)),Rp(v,l,u,c)}let d=P(e,"x","conv2d"),h=P(t,"filter","conv2d"),p=d,f=!1;d.rank===3&&(f=!0,p=ue(d,[1,d.shape[0],d.shape[1],d.shape[2]])),L(p.rank===4,()=>`Error in fused conv2d: input must be rank 4, but got rank ${p.rank}.`),L(h.rank===4,()=>`Error in fused conv2d: filter must be rank 4, but got rank ${h.rank}.`),o!=null&&L(Xn(r),()=>`Error in fused conv2d: pad must be an integer when using, dimRoundingMode ${o} but got pad ${r}.`),L(p.shape[3]===h.shape[2],()=>`Error in conv2d: depth of input (${p.shape[3]}) must match input depth for filter ${h.shape[2]}.`),L(Qs(n,a),()=>`Error in conv2D: Either strides or dilations must be 1. Got strides ${n} and dilations '${a}'`),L(s==="NHWC",()=>`Error in conv2d: got dataFormat of ${s} but only NHWC is currently supported.`);let m=oc(p.shape,h.shape,n,a,r,o),g;i!=null&&(g=P(i,"bias","fused conv2d"),[g]=Vt(g,d),In(m.outShape,g.shape));let y;u!=null&&(y=P(u,"prelu weights","fused conv2d"));let A=(v,w)=>{let[I,T,C,M]=w,$=$p(v,C,l);L(ic(a),()=>`Error in gradient of fused conv2D: dilation rates greater than 1 are not yet supported in gradients. Got dilations '${a}'`);let R=Uk(T.shape,$,I,n,r),N=eW(T,$,I.shape,n,r),F=[R,N];if(M!=null){let B=_p(M,$);F.push(B)}return F},x={x:p,filter:h,bias:g,preluActivationWeights:y},b={strides:n,pad:r,dataFormat:s,dilations:a,dimRoundingMode:o,activation:l,leakyreluAlpha:c};return i==null?Ns((w,I,T)=>{let C=U.runKernel(p2,x,b);return T([I,w,C]),f&&(C=ue(C,[C.shape[1],C.shape[2],C.shape[3]])),{value:C,gradFunc:A}})(p,h):Ns((w,I,T,C)=>{let M=U.runKernel(p2,x,b);return C([I,w,M,T]),f&&(M=ue(M,[M.shape[1],M.shape[2],M.shape[3]])),{value:M,gradFunc:A}})(p,h,g)}var nW=H({fusedConv2d_:tW});function rW(e,t,n,r,s,a=[1,1],o){let i=e;e.rank===3&&(i=ue(e,[1,e.shape[0],e.shape[1],e.shape[2]]));let l=t;l.rank===3&&(l=ue(t,[1,t.shape[0],t.shape[1],t.shape[2]]));let u={x:i,dy:l},c={strides:r,pad:s,dimRoundingMode:o,dilations:a,filterShape:n};return U.runKernel(Fv,u,c)}var sW=H({depthwiseConv2dNativeBackpropFilter_:rW});function aW(e,t,n,r,s,a=[1,1],o){let i=t,l=!1;t.rank===3&&(l=!0,i=ue(t,[1,t.shape[0],t.shape[1],t.shape[2]]));let u={dy:i,filter:n},c={strides:r,pad:s,dimRoundingMode:o,dilations:a,inputShape:e},d=U.runKernel(Mv,u,c);return l?ue(d,[d.shape[1],d.shape[2],d.shape[3]]):d}var oW=H({depthwiseConv2dNativeBackpropInput_:aW});function iW({x:e,filter:t,strides:n,pad:r,dataFormat:s="NHWC",dilations:a=[1,1],dimRoundingMode:o,bias:i,activation:l="linear",preluActivationWeights:u,leakyreluAlpha:c}){if(Dp(U.state.gradientDepth,l)===!1){let v=ey(e,t,n,r,s,a,o);return i!=null&&(v=Me(v,i)),Rp(v,l,u,c)}let d=P(e,"x","depthwiseConv2d"),h=P(t,"filter","depthwiseConv2d"),p=d,f=!1;d.rank===3&&(f=!0,p=ue(d,[1,d.shape[0],d.shape[1],d.shape[2]])),L(p.rank===4,()=>`Error in fused depthwiseConv2d: input must be rank 4, but got rank ${p.rank}.`),L(h.rank===4,()=>`Error in fused depthwiseConv2d: filter must be rank 4, but got rank ${h.rank}.`),L(p.shape[3]===h.shape[2],()=>`Error in fused depthwiseConv2d: number of input channels (${p.shape[3]}) must match the inChannels dimension in filter ${h.shape[2]}.`),a==null&&(a=[1,1]),L(Qs(n,a),()=>`Error in fused depthwiseConv2d: Either strides or dilations must be 1. Got strides ${n} and dilations '${a}'`),o!=null&&L(Xn(r),()=>`Error in fused depthwiseConv2d: pad must be an integer when using dimRoundingMode ${o} but got pad ${r}.`);let m=oc(p.shape,h.shape,n,a,r,o,!0),g;i!=null&&(g=P(i,"bias","fused conv2d"),[g]=Vt(g,d),In(m.outShape,g.shape));let y;u!=null&&(y=P(u,"prelu weights","fused depthwiseConv2d"));let A=(v,w)=>{L(ic(a),()=>`Error in gradient of fused depthwiseConv2d: dilation rates greater than 1 are not yet supported. Got dilations '${a}'`);let[I,T,C,M]=w,$=$p(v,C,l),R=oW(T.shape,$,I,n,r,a,o),N=sW(T,$,I.shape,n,r,a,o);if(M!=null){let F=_p(g,$);return[R,N,F]}return[R,N]},x={x:p,filter:h,bias:g,preluActivationWeights:y},b={strides:n,pad:r,dataFormat:s,dilations:a,dimRoundingMode:o,activation:l,leakyreluAlpha:c};return i==null?Ns((w,I,T)=>{let C=U.runKernel(f2,x,b);return T([I,w,C]),f&&(C=ue(C,[C.shape[1],C.shape[2],C.shape[3]])),{value:C,gradFunc:A}})(p,h):Ns((w,I,T,C)=>{let M=U.runKernel(f2,x,b);return C([I,w,M,T]),f&&(M=ue(M,[M.shape[1],M.shape[2],M.shape[3]])),{value:M,gradFunc:A}})(p,h,g)}var lW=H({fusedDepthwiseConv2d_:iW});function uW({a:e,b:t,transposeA:n=!1,transposeB:r=!1,bias:s,activation:a="linear",preluActivationWeights:o,leakyreluAlpha:i}){if(Dp(U.state.gradientDepth,a)===!1){let M=yt(e,t,n,r);return s!=null&&(M=Me(M,s)),Rp(M,a,o,i)}let l=P(e,"a","fused matMul"),u=P(t,"b","fused matMul");[l,u]=Vt(l,u);let c=n?l.shape[l.rank-2]:l.shape[l.rank-1],d=r?u.shape[u.rank-1]:u.shape[u.rank-2],h=n?l.shape[l.rank-1]:l.shape[l.rank-2],p=r?u.shape[u.rank-2]:u.shape[u.rank-1],f=l.shape.slice(0,-2),m=u.shape.slice(0,-2),g=Jt(f),y=Jt(m);L(l.rank>=2&&u.rank>=2&&l.rank===u.rank,()=>`Error in fused matMul: inputs must have the same rank of at least 2, got ranks ${l.rank} and ${u.rank}.`),L(Xs(f,m),()=>`Error in fused matMul: outer dimensions (${f}) and (${m}) of Tensors with shapes ${l.shape} and ${u.shape} must match.`),L(c===d,()=>`Error in fused matMul: inner shapes (${c}) and (${d}) of Tensors with shapes ${l.shape} and ${u.shape} and transposeA=${n} and transposeB=${r} must match.`);let A=l.shape.slice(0,-2).concat([h,p]),x=n?ue(l,[g,c,h]):ue(l,[g,h,c]),b=r?ue(u,[y,p,d]):ue(u,[y,d,p]),v;s!=null&&(v=P(s,"bias","fused matMul"),[v]=Vt(v,l),In(A,v.shape));let w;o!=null&&(w=P(o,"prelu weights","fused matMul"));let I=(M,$)=>{let[R,N,F,B]=$,j=$p(ue(M,F.shape),F,a),X,Y;if(!n&&!r?(X=yt(j,N,!1,!0),Y=yt(R,j,!0,!1)):!n&&r?(X=yt(j,N,!1,!1),Y=yt(j,R,!0,!1)):n&&!r?(X=yt(N,j,!1,!0),Y=yt(R,j,!1,!1)):(X=yt(N,j,!0,!0),Y=yt(j,R,!0,!0)),s!=null){let ee=_p(B,j);return[X,Y,ee]}else return[X,Y]},T={a:x,b,bias:v,preluActivationWeights:w},C={transposeA:n,transposeB:r,activation:a,leakyreluAlpha:i};return s==null?Ns(($,R,N)=>{let F=U.runKernel(h2,T,C);return N([$,R,F]),{value:ue(F,A),gradFunc:I}})(x,b):Ns(($,R,N,F)=>{let B=U.runKernel(h2,T,C);return F([$,R,B,N]),{value:ue(B,A),gradFunc:I}})(x,b,v)}var cW=H({fusedMatMul_:uW});function dW(e){return cy(e,.54,.46)}var hW=H({hammingWindow_:dW});function pW(e){return cy(e,.5,.5)}var w4=H({hannWindow_:pW});function fW(e,t,n,r=!1,s=0){let a=0,o=[];for(;a+t<=e.size;)o.push(Ze(e,a,t)),a+=n;if(r)for(;a`Error in cropAndResize: image must be rank 4,but got rank ${o.rank}.`),L(i.rank===2&&i.shape[1]===4,()=>`Error in cropAndResize: boxes must be have size [${u},4] but had shape ${i.shape}.`),L(l.rank===1&&l.shape[0]===u,()=>`Error in cropAndResize: boxInd must be have size [${u}] but had shape ${i.shape}.`),L(r.length===2,()=>`Error in cropAndResize: cropSize must be of length 2, but got length ${r.length}.`),L(r[0]>=1&&r[1]>=1,()=>`cropSize must be atleast [1,1], but was ${r}`),L(s==="bilinear"||s==="nearest",()=>`method must be bilinear or nearest, but was ${s}`);let c={image:o,boxes:i,boxInd:l},d={method:s,extrapolationValue:a,cropSize:r};return U.runKernel($v,c,d)}var AW=H({cropAndResize_:yW});function xW(e){let t=P(e,"image","flipLeftRight","float32");L(t.rank===4,()=>`Error in flipLeftRight: image must be rank 4,but got rank ${t.rank}.`);let n={image:t};return U.runKernel(Kv,n,{})}var bW=H({flipLeftRight_:xW});function vW(e,t,n=0,r=.5){let s=P(e,"image","rotateWithOffset","float32");L(s.rank===4,()=>`Error in rotateWithOffset: image must be rank 4,but got rank ${s.rank}.`);let a={image:s},o={radians:t,fillValue:n,center:r};return U.runKernel(D7,a,o)}var wW=H({rotateWithOffset_:vW});function qi(e,t,n,r,s,a){r==null&&(r=.5),s==null&&(s=Number.NEGATIVE_INFINITY),a==null&&(a=0);let o=e.shape[0];return n=Math.min(n,o),L(0<=r&&r<=1,()=>`iouThreshold must be in [0, 1], but was '${r}'`),L(e.rank===2,()=>`boxes must be a 2D tensor, but was of rank '${e.rank}'`),L(e.shape[1]===4,()=>`boxes must have 4 columns, but 2nd dimension was ${e.shape[1]}`),L(t.rank===1,()=>"scores must be a 1D tensor"),L(t.shape[0]===o,()=>`scores has incompatible shape with boxes. Expected ${o}, but was ${t.shape[0]}`),L(0<=a&&a<=1,()=>`softNmsSigma must be in [0, 1], but was '${a}'`),{maxOutputSize:n,iouThreshold:r,scoreThreshold:s,softNmsSigma:a}}function kW(e,t,n,r=.5,s=Number.NEGATIVE_INFINITY){let a=P(e,"boxes","nonMaxSuppression"),o=P(t,"scores","nonMaxSuppression"),i=qi(a,o,n,r,s);n=i.maxOutputSize,r=i.iouThreshold,s=i.scoreThreshold;let l={maxOutputSize:n,iouThreshold:r,scoreThreshold:s};return U.runKernel(_w,{boxes:a,scores:o},l)}var IW=H({nonMaxSuppression_:kW});function SW(e,t,n){let r=TW(e,t,n),s=r<0?-(r+1):r;e.splice(s,0,t)}function TW(e,t,n){return CW(e,t,n||NW)}function NW(e,t){return e>t?1:e>>1);let i=n(t,e[a]);i>0?r=a+1:(s=a,o=!i)}return o?r:-r-1}function I4(e,t,n,r,s){return dy(e,t,n,r,s,0)}function S4(e,t,n,r,s,a){return dy(e,t,n,r,s,0,!1,a,!0)}function T4(e,t,n,r,s,a){return dy(e,t,n,r,s,a,!0)}function dy(e,t,n,r,s,a,o=!1,i=!1,l=!1){let u=[];for(let g=0;gs&&u.push({score:t[g],boxIndex:g,suppressBeginIndex:0});u.sort(N4);let c=a>0?-.5/a:0,d=[],h=[];for(;d.length0;){let g=u.pop(),{score:y,boxIndex:A,suppressBeginIndex:x}=g;if(y=x;--v){let w=EW(e,A,d[v]);if(w>=r){b=!0;break}if(g.score=g.score*$W(r,c,w),g.score<=s)break}g.suppressBeginIndex=d.length,b||(g.score===y?(d.push(A),h.push(g.score)):g.score>s&&SW(u,g,N4))}let p=d.length,f=n-p;i&&f>0&&(d.push(...new Array(f).fill(0)),h.push(...new Array(f).fill(0)));let m={selectedIndices:d};return o&&(m.selectedScores=h),l&&(m.validOutputs=p),m}function EW(e,t,n){let r=e.subarray(t*4,t*4+4),s=e.subarray(n*4,n*4+4),a=Math.min(r[0],r[2]),o=Math.min(r[1],r[3]),i=Math.max(r[0],r[2]),l=Math.max(r[1],r[3]),u=Math.min(s[0],s[2]),c=Math.min(s[1],s[3]),d=Math.max(s[0],s[2]),h=Math.max(s[1],s[3]),p=(i-a)*(l-o),f=(d-u)*(h-c);if(p<=0||f<=0)return 0;let m=Math.max(a,u),g=Math.max(o,c),y=Math.min(i,d),A=Math.min(l,h),x=Math.max(y-m,0)*Math.max(A-g,0);return x/(p+f-x)}function $W(e,t,n){let r=Math.exp(t*n*n);return n<=e?r:0}function N4(e,t){return e.score-t.score||e.score===t.score&&t.boxIndex-e.boxIndex}async function _W(e,t,n,r=.5,s=Number.NEGATIVE_INFINITY){let a=P(e,"boxes","nonMaxSuppressionAsync"),o=P(t,"scores","nonMaxSuppressionAsync"),i=qi(a,o,n,r,s);n=i.maxOutputSize,r=i.iouThreshold,s=i.scoreThreshold;let l=await Promise.all([a.data(),o.data()]),u=l[0],c=l[1],{selectedIndices:d}=I4(u,c,n,r,s);return a!==e&&a.dispose(),o!==t&&o.dispose(),lr(d,"int32")}var RW=_W;function DW(e,t,n,r=.5,s=Number.NEGATIVE_INFINITY,a=0){let o=P(e,"boxes","nonMaxSuppression"),i=P(t,"scores","nonMaxSuppression"),l=qi(o,i,n,r,s,a);n=l.maxOutputSize,r=l.iouThreshold,s=l.scoreThreshold,a=l.softNmsSigma;let u={boxes:o,scores:i},c={maxOutputSize:n,iouThreshold:r,scoreThreshold:s,softNmsSigma:a},d=U.runKernel(Dw,u,c);return{selectedIndices:d[0],selectedScores:d[1]}}var FW=H({nonMaxSuppressionWithScore_:DW});async function MW(e,t,n,r=.5,s=Number.NEGATIVE_INFINITY,a=0){let o=P(e,"boxes","nonMaxSuppressionAsync"),i=P(t,"scores","nonMaxSuppressionAsync"),l=qi(o,i,n,r,s,a);n=l.maxOutputSize,r=l.iouThreshold,s=l.scoreThreshold,a=l.softNmsSigma;let u=await Promise.all([o.data(),i.data()]),c=u[0],d=u[1],{selectedIndices:h,selectedScores:p}=T4(c,d,n,r,s,a);return o!==e&&o.dispose(),i!==t&&i.dispose(),{selectedIndices:lr(h,"int32"),selectedScores:lr(p)}}var OW=MW;function PW(e,t,n,r=.5,s=Number.NEGATIVE_INFINITY,a=!1){let o=P(e,"boxes","nonMaxSuppression"),i=P(t,"scores","nonMaxSuppression"),l=qi(o,i,n,r,s,null),u=l.maxOutputSize,c=l.iouThreshold,d=l.scoreThreshold,h={boxes:o,scores:i},p={maxOutputSize:u,iouThreshold:c,scoreThreshold:d,padToMaxOutputSize:a},f=U.runKernel(Rw,h,p);return{selectedIndices:f[0],validOutputs:f[1]}}var zW=H({nonMaxSuppressionPadded_:PW});async function LW(e,t,n,r=.5,s=Number.NEGATIVE_INFINITY,a=!1){let o=P(e,"boxes","nonMaxSuppressionAsync"),i=P(t,"scores","nonMaxSuppressionAsync"),l=qi(o,i,n,r,s,null),u=l.maxOutputSize,c=l.iouThreshold,d=l.scoreThreshold,[h,p]=await Promise.all([o.data(),i.data()]),{selectedIndices:f,validOutputs:m}=S4(h,p,u,c,d,a);return o!==e&&o.dispose(),i!==t&&i.dispose(),{selectedIndices:lr(f,"int32"),validOutputs:ut(m,"int32")}}var BW=LW;function WW(e,t,n=!1,r=!1){let s=P(e,"images","resizeBilinear");L(s.rank===3||s.rank===4,()=>`Error in resizeBilinear: x must be rank 3 or 4, but got rank ${s.rank}.`),L(t.length===2,()=>`Error in resizeBilinear: new shape must 2D, but got shape ${t}.`),L(r===!1||n===!1,()=>"Error in resizeBilinear: If halfPixelCenters is true, alignCorners must be false.");let a=s,o=!1;s.rank===3&&(o=!0,a=ue(s,[1,s.shape[0],s.shape[1],s.shape[2]]));let[]=t,i={images:a},l={alignCorners:n,halfPixelCenters:r,size:t},u=U.runKernel(qw,i,l);return o?ue(u,[u.shape[1],u.shape[2],u.shape[3]]):u}var VW=H({resizeBilinear_:WW});function UW(e,t,n=!1,r=!1){let s=P(e,"images","resizeNearestNeighbor");L(s.rank===3||s.rank===4,()=>`Error in resizeNearestNeighbor: x must be rank 3 or 4, but got rank ${s.rank}.`),L(t.length===2,()=>`Error in resizeNearestNeighbor: new shape must 2D, but got shape ${t}.`),L(s.dtype==="float32"||s.dtype==="int32",()=>"`images` must have `int32` or `float32` as dtype"),L(r===!1||n===!1,()=>"Error in resizeNearestNeighbor: If halfPixelCenters is true, alignCorners must be false.");let a=s,o=!1;s.rank===3&&(o=!0,a=ue(s,[1,s.shape[0],s.shape[1],s.shape[2]]));let[]=t,i={images:a},l={alignCorners:n,halfPixelCenters:r,size:t},u=U.runKernel(jw,i,l);return o?ue(u,[u.shape[1],u.shape[2],u.shape[3]]):u}var HW=H({resizeNearestNeighbor_:UW});function GW(e,t="binary",n=!1,r=.5){let s=P(e,"image","threshold"),a=.2989,o=.587,i=.114,l=s.shape[0]*s.shape[1],u=fe(lr([r]),255),c,d,h,p;if(L(s.rank===3,()=>`Error in threshold: image must be rank 3,but got rank ${s.rank}.`),L(s.shape[2]===3||s.shape[2]===1,()=>`Error in threshold: image color channel must be equal to 3 or 1but got ${s.shape[2]}.`),L(s.dtype==="int32"||s.dtype==="float32",()=>`Error in dtype: image dtype must be int32 or float32,but got dtype ${s.dtype}.`),L(t==="otsu"||t==="binary",()=>`Method must be binary or otsu, but was ${t}`),s.shape[2]===3){[c,d,h]=ta(s,[1,1,1],-1);let g=fe(c,a),y=fe(d,o),A=fe(h,i);p=Me(Me(g,y),A)}else p=e;if(t==="otsu"){let g=Vk(Pt(p4(p),"int32"),ts([]),256);u=jW(g,l)}let f=n?ny(p,u):kp(p,u);return Pt(fe(f,255),"int32")}function jW(e,t){let n=lr([-1]),r=lr([0]),s=lr([0]),a,o,i,l,u,c;for(let d=0;d`Error in transform: image must be rank 4,but got rank ${o.rank}.`),L(i.rank===2&&(i.shape[0]===o.shape[0]||i.shape[0]===1)&&i.shape[1]===8,()=>"Error in transform: Input transform should be batch x 8 or 1 x 8"),L(a==null||a.length===2,()=>`Error in transform: outputShape must be [height, width] or null, but got ${a}.`);let l={image:o,transforms:i},u={interpolation:n,fillMode:r,fillValue:s,outputShape:a};return U.runKernel(T7,l,u)}var XW=H({transform_:KW});function ZW(e,t,n){L(t%1==0,()=>`bandPart(): numLower must be an integer, got ${t}.`),L(n%1==0,()=>`bandPart(): numUpper must be an integer, got ${n}.`);let r=P(e,"a","bandPart");L(r.rank>=2,()=>`bandPart(): Rank must be at least 2, got ${r.rank}.`);let s=r.shape,[a,o]=r.shape.slice(-2);if(!(t<=a))throw new Error(`bandPart(): numLower (${t}) must not be greater than the number of rows (${a}).`);if(!(n<=o))throw new Error(`bandPart(): numUpper (${n}) must not be greater than the number of columns (${o}).`);t<0&&(t=a),n<0&&(n=o);let i=ue(pc(0,a,1,"int32"),[-1,1]),l=pc(0,o,1,"int32"),u=He(i,l),c=Sp(ny(u,ut(+t,"int32")),Zk(u,ut(-n,"int32"))),d=ji([a,o],r.dtype);return ue(So(fc(ue(r,[-1,a,o])).map(h=>Gi(c,h,d))),s)}var YW=H({bandPart_:ZW});function JW(e){let t;if(Array.isArray(e)){t=!1,L(e!=null&&e.length>0,()=>"Gram-Schmidt process: input must not be null, undefined, or empty");let s=e[0].shape[0];for(let a=1;a`Gram-Schmidt: Non-unique lengths found in the input vectors: (${e[a].shape[0]} vs. ${s})`)}else t=!0,e=ta(e,e.shape[0],0).map(s=>Zn(s,[0]));L(e.length<=e[0].shape[0],()=>`Gram-Schmidt: Number of vectors (${e.length}) exceeds number of dimensions (${e[0].shape[0]}).`);let n=[],r=e;for(let s=0;s{let a=r[s];if(s>0)for(let o=0;o=2,()=>`qr() requires input tensor to have a rank >= 2, but got rank ${e.rank}`),e.rank===2)return C4(e,t);{let n=e.shape.slice(0,e.shape.length-2).reduce((l,u)=>l*u),r=fc(ue(e,[n,e.shape[e.shape.length-2],e.shape[e.shape.length-1]]),0),s=[],a=[];r.forEach(l=>{let[u,c]=C4(l,t);s.push(u),a.push(c)});let o=ue(So(s,0),e.shape),i=ue(So(a,0),e.shape);return[o,i]}}function C4(e,t=!1){return U.tidy(()=>{L(e.shape.length===2,()=>`qr2d() requires a 2D Tensor, but got a ${e.shape.length}D Tensor.`);let n=e.shape[0],r=e.shape[1],s=qk(n),a=Js(e),o=ra([[1]],[1,1]),i=Js(o),l=n>=r?r:n;for(let u=0;u{let p=Ze(a,[u,u],[n-u,1]),f=uy(p),m=Ze(a,[u,u],[1,1]),g=Gi(kp(m,0),ra([[-1]]),ra([[1]])),y=He(m,fe(g,f)),A=Qe(p,y);A.shape[0]===1?i=Js(o):i=an([o,Ze(A,[1,0],[A.shape[0]-1,A.shape[1]])],0);let x=$a(Qe(yt(g,y),f)),b=Ze(a,[u,0],[n-u,r]),v=fe(x,i),w=fp(i);if(u===0)a=He(b,yt(v,yt(w,b)));else{let C=He(b,yt(v,yt(w,b)));a=an([Ze(a,[0,0],[u,r]),C],0)}let I=fp(v),T=Ze(s,[0,u],[n,s.shape[1]-u]);if(u===0)s=He(T,yt(yt(T,i),I));else{let C=He(T,yt(yt(T,i),I));s=an([Ze(s,[0,0],[n,u]),C],1)}return[i,a,s]}),Ve([c,d,h])}return!t&&n>r&&(s=Ze(s,[0,0],[n,r]),a=Ze(a,[0,0],[r,r])),[s,a]})}var tV=H({qr_:eV}),Pn;(function(e){e[e.NONE=0]="NONE",e[e.MEAN=1]="MEAN",e[e.SUM=2]="SUM",e[e.SUM_BY_NONZERO_WEIGHTS=3]="SUM_BY_NONZERO_WEIGHTS"})(Pn||(Pn={}));function nV(e,t,n=Pn.SUM_BY_NONZERO_WEIGHTS){let r=P(e,"losses","computeWeightedLoss"),s=null;t!=null&&(s=P(t,"weights","computeWeightedLoss"));let a=s==null?r:fe(r,s);if(n===Pn.NONE)return a;if(n===Pn.SUM)return _t(a);if(n===Pn.MEAN){if(s==null)return Tp(a);{let o=r.size/s.size,i=Qe(_t(a),_t(s));return o>1?Qe(i,ut(o)):i}}if(n===Pn.SUM_BY_NONZERO_WEIGHTS){if(s==null)return Qe(_t(a),ut(r.size));{let o=fe(s,ko(r.shape)),i=Pt(_t(l4(o,ut(0))),"float32");return Qe(_t(a),i)}}throw Error(`Unknown reduction: ${n}`)}var sa=H({computeWeightedLoss_:nV});function rV(e,t,n,r=Pn.SUM_BY_NONZERO_WEIGHTS){let s=P(e,"labels","absoluteDifference"),a=P(t,"predictions","absoluteDifference"),o=null;n!=null&&(o=P(n,"weights","absoluteDifference")),Mn(s.shape,a.shape,"Error in absoluteDifference: ");let i=Nr(He(s,a));return sa(i,o,r)}var sV=H({absoluteDifference_:rV});function aV(e,t,n,r,s=Pn.SUM_BY_NONZERO_WEIGHTS){let a=P(e,"labels","cosineDistance"),o=P(t,"predictions","cosineDistance"),i=null;r!=null&&(i=P(r,"weights","cosineDistance")),Mn(a.shape,o.shape,"Error in cosineDistance: ");let l=ut(1),u=He(l,_t(fe(a,o),n,!0));return sa(u,i,s)}var oV=H({cosineDistance_:aV});function iV(e,t,n,r=Pn.SUM_BY_NONZERO_WEIGHTS){let s=P(e,"labels","hingeLoss"),a=P(t,"predictions","hingeLoss"),o=null;n!=null&&(o=P(n,"weights","hingeLoss")),Mn(s.shape,a.shape,"Error in hingeLoss: ");let i=ut(1);s=He(fe(ut(2),s),i);let l=Cp(He(i,fe(s,a)));return sa(l,o,r)}var lV=H({hingeLoss_:iV});function uV(e,t,n,r=1,s=Pn.SUM_BY_NONZERO_WEIGHTS){let a=P(e,"labels","huberLoss"),o=P(t,"predictions","huberLoss"),i=null;n!=null&&(i=P(n,"weights","huberLoss")),Mn(a.shape,o.shape,"Error in huberLoss: ");let l=ut(r),u=Nr(He(o,a)),c=i4(u,l),d=He(u,c),h=Me(fe(ut(.5),ns(c)),fe(l,d));return sa(h,i,s)}var cV=H({huberLoss_:uV});function dV(e,t,n,r=1e-7,s=Pn.SUM_BY_NONZERO_WEIGHTS){let a=P(e,"labels","logLoss"),o=P(t,"predictions","logLoss"),i=null;n!=null&&(i=P(n,"weights","logLoss")),Mn(a.shape,o.shape,"Error in logLoss: ");let l=ut(1),u=ut(r),c=$a(fe(a,uc(Me(o,u)))),d=fe(He(l,a),uc(Me(He(l,o),u))),h=He(c,d);return sa(h,i,s)}var hV=H({logLoss_:dV});function pV(e,t,n,r=Pn.SUM_BY_NONZERO_WEIGHTS){let s=P(e,"labels","meanSquaredError"),a=P(t,"predictions","meanSquaredError"),o=null;n!=null&&(o=P(n,"weights","meanSquaredError")),Mn(s.shape,a.shape,"Error in meanSquaredError: ");let i=m4(s,a);return sa(i,o,r)}var fV=H({meanSquaredError_:pV});function mV(e,t){let n=P(e,"labels","sigmoidCrossEntropyWithLogits"),r=P(t,"logits","sigmoidCrossEntropyWithLogits");Mn(n.shape,r.shape,"Error in sigmoidCrossEntropyWithLogits: ");let s=Cp(r),a=fe(r,n),o=Jk(wo($a(Nr(r))));return Me(He(s,a),o)}function gV(e,t,n,r=0,s=Pn.SUM_BY_NONZERO_WEIGHTS){let a=P(e,"multiClassLabels","sigmoidCrossEntropy"),o=P(t,"logits","sigmoidCrossEntropy"),i=null;if(n!=null&&(i=P(n,"weights","sigmoidCrossEntropy")),Mn(a.shape,o.shape,"Error in sigmoidCrossEntropy: "),r>0){let u=ut(r),c=ut(1),d=ut(.5);a=Me(fe(a,He(c,u)),fe(d,u))}let l=mV(a,o);return sa(l,i,s)}var yV=H({sigmoidCrossEntropy_:gV});function AV(e,t,n=-1){if(n===-1&&(n=t.rank-1),n!==t.rank-1)throw Error(`Softmax cross entropy along a non-last dimension is not yet supported. Labels / logits was rank ${t.rank} and dim was ${n}`);return Ns((s,a,o)=>{let l=n4(a,[n],!0),u=He(Pt(a,"float32"),l);o([s,u]);let c=$a(fe(u,s));return{value:_t(c,[n]),gradFunc:(p,f)=>{let[m,g]=f,y=cc(p.shape,[n]);return[fe(ue(p,y),He(Pt(m,"float32"),wo(g))),fe(ue(p,y),He(wo(g),Pt(m,"float32")))]}}})(e,t)}function xV(e,t,n,r=0,s=Pn.SUM_BY_NONZERO_WEIGHTS){let a=P(e,"onehotLabels","softmaxCrossEntropy"),o=P(t,"logits","softmaxCrossEntropy"),i=null;if(n!=null&&(i=P(n,"weights","softmaxCrossEntropy")),Mn(a.shape,o.shape,"Error in softmaxCrossEntropy: "),r>0){let u=ut(r),c=ut(1),d=ut(a.shape[1]);a=Me(fe(a,He(c,u)),Qe(u,d))}let l=AV(a,o);return sa(l,i,s)}var bV=H({softmaxCrossEntropy_:xV});function vV(e,t,n,r){let s=P(e,"indices","sparseFillEmptyRows"),a=P(t,"values","sparseFillEmptyRows"),o=P(n,"denseShape","sparseFillEmptyRows"),i=P(r,"defaultValue","sparseFillEmptyRows",a.dtype);if(s.rank!==2)throw new Error(`Indices should be Tensor2D but received shape + ${s.shape}`);if(a.rank!==1)throw new Error(`Values should be Tensor1D but received shape ${a.shape}`);if(o.rank!==1)throw new Error(`Dense shape should be Tensor1D but received shape ${o.shape}`);if(i.rank!==0)throw new Error(`Default value should be a scalar but received shape ${i.shape}`);let l={indices:s,values:a,denseShape:o,defaultValue:i},u=U.runKernel(h7,l);return{outputIndices:u[0],outputValues:u[1],emptyRowIndicator:u[2],reverseIndexMap:u[3]}}var wV=H({sparseFillEmptyRows_:vV});function kV(e,t,n){let r=P(e,"inputIndices","sparseReshape"),s=P(t,"inputShape","sparseReshape"),a=P(n,"newShape","sparseReshape");if(r.rank!==2)throw new Error(`Input indices should be Tensor2D but received shape + ${r.shape}`);if(s.rank!==1)throw new Error(`Input shape should be Tensor1D but received shape ${s.shape}`);if(a.rank!==1)throw new Error(`New shape should be Tensor1D but received shape ${a.shape}`);let o={inputIndices:r,inputShape:s,newShape:a},i=U.runKernel(p7,o);return{outputIndices:i[0],outputShape:i[1]}}var IV=H({sparseReshape_:kV});function SV(e,t,n){let r=P(e,"data","sparseSegmentMean"),s=P(t,"indices","sparseSegmentMean"),a=P(n,"segmentIds","sparseSegmentMean");if(r.rank<1)throw new Error("Data should be at least 1 dimensional but received scalar");if(s.rank!==1)throw new Error(`Indices should be Tensor1D but received shape + ${s.shape}`);if(a.rank!==1)throw new Error(`Segment ids should be Tensor1D but received shape + ${a.shape}`);let o={data:r,indices:s,segmentIds:a};return U.runKernel(f7,o)}var TV=H({sparseSegmentMean_:SV});function NV(e,t,n){let r=P(e,"data","sparseSegmentSum"),s=P(t,"indices","sparseSegmentSum"),a=P(n,"segmentIds","sparseSegmentSum");if(r.rank<1)throw new Error("Data should be at least 1 dimensional but received scalar");if(s.rank!==1)throw new Error(`Indices should be Tensor1D but received shape + ${s.shape}`);if(a.rank!==1)throw new Error(`Segment ids should be Tensor1D but received shape + ${a.shape}`);let o={data:r,indices:s,segmentIds:a};return U.runKernel(m7,o)}var CV=H({sparseSegmentSum_:NV});function EV(e,t,n,r,s,a,o,i){let l=P(e,"data","stringNGrams","string");if(l.dtype!=="string")throw new Error("Data must be of datatype string");if(l.shape.length!==1)throw new Error(`Data must be a vector, saw: ${l.shape}`);let u=P(t,"dataSplits","stringNGrams");if(u.dtype!=="int32")throw new Error("Data splits must be of datatype int32");let c={separator:n,nGramWidths:r,leftPad:s,rightPad:a,padWidth:o,preserveShortSequences:i},d={data:l,dataSplits:u},h=U.runKernel(x7,d,c);return{nGrams:h[0],nGramsSplits:h[1]}}var $V=H({stringNGrams_:EV});function _V(e,t,n=!0){let r=P(e,"input","stringSplit","string"),s=P(t,"delimiter","stringSplit","string");if(r.rank!==1)throw new Error(`Input should be Tensor1D but received shape ${r.shape}`);if(s.rank!==0)throw new Error(`Delimiter should be a scalar but received shape ${s.shape}`);let a={skipEmpty:n},o={input:r,delimiter:s},i=U.runKernel(b7,o,a);return{indices:i[0],values:i[1],shape:i[2]}}var RV=H({stringSplit_:_V});function DV(e,t){let n=P(e,"input","stringToHashBucketFast","string"),r={numBuckets:t};if(t<=0)throw new Error("Number of buckets must be at least 1");let s={input:n};return U.runKernel(v7,s,r)}var FV=H({stringToHashBucketFast_:DV}),MV={fft:iy,ifft:Ep,rfft:ly,irfft:f4},OV={hammingWindow:hW,hannWindow:w4,frame:k4,stft:gW},Ye={flipLeftRight:bW,resizeNearestNeighbor:HW,resizeBilinear:VW,rotateWithOffset:wW,cropAndResize:AW,nonMaxSuppression:IW,nonMaxSuppressionAsync:RW,nonMaxSuppressionWithScore:FW,nonMaxSuppressionWithScoreAsync:OW,nonMaxSuppressionPadded:zW,nonMaxSuppressionPaddedAsync:BW,threshold:qW,transform:XW},PV={bandPart:YW,gramSchmidt:QW,qr:tV},zV={absoluteDifference:sV,computeWeightedLoss:sa,cosineDistance:oV,hingeLoss:lV,huberLoss:cV,logLoss:hV,meanSquaredError:fV,sigmoidCrossEntropy:yV,softmaxCrossEntropy:bV},LV={sparseFillEmptyRows:wV,sparseReshape:IV,sparseSegmentMean:TV,sparseSegmentSum:CV},BV={stringNGrams:$V,stringSplit:RV,stringToHashBucketFast:FV},Ra=class extends $k{minimize(e,t=!1,n){let{value:r,grads:s}=this.computeGradients(e,n);if(n!=null){let a=n.map(o=>({name:o.name,tensor:s[o.name]}));this.applyGradients(a)}else this.applyGradients(s);return Ve(s),t?r:(r.dispose(),null)}get iterations(){return this.iterations_==null&&(this.iterations_=0),this.iterations_}incrementIterations(){this.iterations_=this.iterations+1}computeGradients(e,t){return Qk(e,t)}dispose(){this.iterations_!=null&&Ve(this.iterations_)}async saveIterations(){return this.iterations_==null&&(this.iterations_=0),{name:"iter",tensor:ut(this.iterations_,"int32")}}async getWeights(){throw new Error("getWeights() is not implemented for this optimizer yet.")}async setWeights(e){throw new Error(`setWeights() is not implemented for this optimizer class ${this.getClassName()}`)}async extractIterations(e){return this.iterations_=(await e[0].tensor.data())[0],e.slice(1)}};Object.defineProperty(Ra,Symbol.hasInstance,{value:e=>e.minimize!=null&&e.computeGradients!=null&&e.applyGradients!=null});var Fp=class extends Ra{constructor(e,t,n=null){super();this.learningRate=e,this.rho=t,this.epsilon=n,this.accumulatedGrads=[],this.accumulatedUpdates=[],n==null&&(this.epsilon=U.backend.epsilon())}applyGradients(e){(Array.isArray(e)?e.map(n=>n.name):Object.keys(e)).forEach((n,r)=>{let s=U.registeredVariables[n],a=!1;this.accumulatedGrads[r]==null&&(this.accumulatedGrads[r]={originalName:`${n}/accum_grad`,variable:Ue(()=>Cr(s).variable(a))}),this.accumulatedUpdates[r]==null&&(this.accumulatedUpdates[r]={originalName:`${n}/accum_var`,variable:Ue(()=>Cr(s).variable(a))});let o=Array.isArray(e)?e[r].tensor:e[n];if(o==null)return;let i=this.accumulatedGrads[r].variable,l=this.accumulatedUpdates[r].variable;Ue(()=>{let u=Me(fe(i,this.rho),fe(ns(o),1-this.rho)),c=fe(Qe(na(Me(l,this.epsilon)),na(Me(i,this.epsilon))),o),d=Me(fe(l,this.rho),fe(ns(c),1-this.rho));i.assign(u),l.assign(d);let h=Me(fe(c,-this.learningRate),s);s.assign(h)})}),this.incrementIterations()}dispose(){this.accumulatedUpdates!=null&&(Ve(this.accumulatedGrads.map(e=>e.variable)),Ve(this.accumulatedUpdates.map(e=>e.variable)))}async getWeights(){let e=[...this.accumulatedGrads,...this.accumulatedUpdates];return[await this.saveIterations()].concat(e.map(t=>({name:t.originalName,tensor:t.variable})))}async setWeights(e){e=await this.extractIterations(e);let t=e.length/2,n=!1;this.accumulatedGrads=e.slice(0,t).map(r=>({originalName:r.name,variable:r.tensor.variable(n)})),this.accumulatedUpdates=e.slice(t,t*2).map(r=>({originalName:r.name,variable:r.tensor.variable(n)}))}getConfig(){return{learningRate:this.learningRate,rho:this.rho,epsilon:this.epsilon}}static fromConfig(e,t){return new e(t.learningRate,t.rho,t.epsilon)}};Fp.className="Adadelta";Ea(Fp);var Mp=class extends Ra{constructor(e,t=.1){super();this.learningRate=e,this.initialAccumulatorValue=t,this.accumulatedGrads=[]}applyGradients(e){(Array.isArray(e)?e.map(n=>n.name):Object.keys(e)).forEach((n,r)=>{let s=U.registeredVariables[n];if(this.accumulatedGrads[r]==null){let i=!1;this.accumulatedGrads[r]={originalName:`${n}/accumulator`,variable:Ue(()=>wp(s.shape,this.initialAccumulatorValue).variable(i))}}let a=Array.isArray(e)?e[r].tensor:e[n];if(a==null)return;let o=this.accumulatedGrads[r].variable;Ue(()=>{let i=Me(o,ns(a));o.assign(i);let l=Me(fe(Qe(a,na(Me(i,U.backend.epsilon()))),-this.learningRate),s);s.assign(l)})}),this.incrementIterations()}dispose(){this.accumulatedGrads!=null&&Ve(this.accumulatedGrads.map(e=>e.variable))}async getWeights(){return[await this.saveIterations()].concat(this.accumulatedGrads.map(e=>({name:e.originalName,tensor:e.variable})))}async setWeights(e){e=await this.extractIterations(e);let t=!1;this.accumulatedGrads=e.map(n=>({originalName:n.name,variable:n.tensor.variable(t)}))}getConfig(){return{learningRate:this.learningRate,initialAccumulatorValue:this.initialAccumulatorValue}}static fromConfig(e,t){return new e(t.learningRate,t.initialAccumulatorValue)}};Mp.className="Adagrad";Ea(Mp);var Op=class extends Ra{constructor(e,t,n,r=null){super();this.learningRate=e,this.beta1=t,this.beta2=n,this.epsilon=r,this.accumulatedFirstMoment=[],this.accumulatedSecondMoment=[],Ue(()=>{this.accBeta1=ut(t).variable(),this.accBeta2=ut(n).variable()}),r==null&&(this.epsilon=U.backend.epsilon())}applyGradients(e){let t=Array.isArray(e)?e.map(n=>n.name):Object.keys(e);Ue(()=>{let n=He(1,this.accBeta1),r=He(1,this.accBeta2);t.forEach((s,a)=>{let o=U.registeredVariables[s],i=!1;this.accumulatedFirstMoment[a]==null&&(this.accumulatedFirstMoment[a]={originalName:`${s}/m`,variable:Ue(()=>Cr(o).variable(i))}),this.accumulatedSecondMoment[a]==null&&(this.accumulatedSecondMoment[a]={originalName:`${s}/v`,variable:Ue(()=>Cr(o).variable(i))});let l=Array.isArray(e)?e[a].tensor:e[s];if(l==null)return;let u=this.accumulatedFirstMoment[a].variable,c=this.accumulatedSecondMoment[a].variable,d=Me(fe(u,this.beta1),fe(l,1-this.beta1)),h=Me(fe(c,this.beta2),fe(ns(l),1-this.beta2)),p=Qe(d,n),f=Qe(h,r);u.assign(d),c.assign(h);let m=Me(fe(Qe(p,Me(na(f),this.epsilon)),-this.learningRate),o);o.assign(m)}),this.accBeta1.assign(fe(this.accBeta1,this.beta1)),this.accBeta2.assign(fe(this.accBeta2,this.beta2))}),this.incrementIterations()}dispose(){this.accBeta1.dispose(),this.accBeta2.dispose(),this.accumulatedFirstMoment!=null&&Ve(this.accumulatedFirstMoment.map(e=>e.variable)),this.accumulatedSecondMoment!=null&&Ve(this.accumulatedSecondMoment.map(e=>e.variable))}async getWeights(){let e=[...this.accumulatedFirstMoment,...this.accumulatedSecondMoment];return[await this.saveIterations()].concat(e.map(t=>({name:t.originalName,tensor:t.variable})))}async setWeights(e){e=await this.extractIterations(e),Ue(()=>{this.accBeta1.assign(hc(this.beta1,this.iterations_+1)),this.accBeta2.assign(hc(this.beta2,this.iterations_+1))});let t=e.length/2,n=!1;this.accumulatedFirstMoment=e.slice(0,t).map(r=>({originalName:r.name,variable:r.tensor.variable(n)})),this.accumulatedSecondMoment=e.slice(t,t*2).map(r=>({originalName:r.name,variable:r.tensor.variable(n)}))}getConfig(){return{learningRate:this.learningRate,beta1:this.beta1,beta2:this.beta2,epsilon:this.epsilon}}static fromConfig(e,t){return new e(t.learningRate,t.beta1,t.beta2,t.epsilon)}};Op.className="Adam";Ea(Op);var Pp=class extends Ra{constructor(e,t,n,r=null,s=0){super();this.learningRate=e,this.beta1=t,this.beta2=n,this.epsilon=r,this.decay=s,this.accumulatedFirstMoment=[],this.accumulatedWeightedInfNorm=[],Ue(()=>{this.iteration=ut(0).variable(),this.accBeta1=ut(t).variable()}),r==null&&(this.epsilon=U.backend.epsilon())}applyGradients(e){let t=Array.isArray(e)?e.map(n=>n.name):Object.keys(e);Ue(()=>{let n=He(1,this.accBeta1),r=Qe(-this.learningRate,Me(fe(this.iteration,this.decay),1));t.forEach((s,a)=>{let o=U.registeredVariables[s],i=!1;this.accumulatedFirstMoment[a]==null&&(this.accumulatedFirstMoment[a]={originalName:`${s}/m`,variable:Cr(o).variable(i)}),this.accumulatedWeightedInfNorm[a]==null&&(this.accumulatedWeightedInfNorm[a]={originalName:`${s}/v`,variable:Cr(o).variable(i)});let l=Array.isArray(e)?e[a].tensor:e[s];if(l==null)return;let u=this.accumulatedFirstMoment[a].variable,c=this.accumulatedWeightedInfNorm[a].variable,d=Me(fe(u,this.beta1),fe(l,1-this.beta1)),h=fe(c,this.beta2),p=Nr(l),f=o4(h,p);u.assign(d),c.assign(f);let m=Me(fe(Qe(r,n),Qe(d,Me(f,this.epsilon))),o);o.assign(m)}),this.iteration.assign(Me(this.iteration,1)),this.accBeta1.assign(fe(this.accBeta1,this.beta1))}),this.incrementIterations()}dispose(){this.accBeta1.dispose(),this.iteration.dispose(),this.accumulatedFirstMoment!=null&&Ve(this.accumulatedFirstMoment.map(e=>e.variable)),this.accumulatedWeightedInfNorm!=null&&Ve(this.accumulatedWeightedInfNorm.map(e=>e.variable))}async getWeights(){throw new Error("getWeights() is not implemented for Adamax yet.")}async setWeights(e){throw new Error("setWeights() is not implemented for Adamax yet.")}getConfig(){return{learningRate:this.learningRate,beta1:this.beta1,beta2:this.beta2,epsilon:this.epsilon,decay:this.decay}}static fromConfig(e,t){return new e(t.learningRate,t.beta1,t.beta2,t.epsilon,t.decay)}};Pp.className="Adamax";Ea(Pp);var mc=class extends Ra{constructor(e){super();this.learningRate=e,this.setLearningRate(e)}applyGradients(e){(Array.isArray(e)?e.map(n=>n.name):Object.keys(e)).forEach((n,r)=>{let s=Array.isArray(e)?e[r].tensor:e[n];if(s==null)return;let a=U.registeredVariables[n];Ue(()=>{let o=Me(fe(this.c,s),a);a.assign(o)})}),this.incrementIterations()}setLearningRate(e){this.learningRate=e,this.c!=null&&this.c.dispose(),this.c=Mk(ut(-e))}dispose(){this.c.dispose()}async getWeights(){return[await this.saveIterations()]}async setWeights(e){if(e=await this.extractIterations(e),e.length!==0)throw new Error("SGD optimizer does not have settable weights.")}getConfig(){return{learningRate:this.learningRate}}static fromConfig(e,t){return new e(t.learningRate)}};mc.className="SGD";Ea(mc);var zp=class extends mc{constructor(e,t,n=!1){super(e);this.learningRate=e,this.momentum=t,this.useNesterov=n,this.accumulations=[],this.m=ut(this.momentum)}applyGradients(e){(Array.isArray(e)?e.map(n=>n.name):Object.keys(e)).forEach((n,r)=>{let s=U.registeredVariables[n];if(this.accumulations[r]==null){let i=!1;this.accumulations[r]={originalName:`${n}/momentum`,variable:Ue(()=>Cr(s).variable(i))}}let a=this.accumulations[r].variable,o=Array.isArray(e)?e[r].tensor:e[n];o!=null&&Ue(()=>{let i,l=Me(fe(this.m,a),o);this.useNesterov?i=Me(fe(this.c,Me(o,fe(l,this.m))),s):i=Me(fe(this.c,l),s),a.assign(l),s.assign(i)})}),this.incrementIterations()}dispose(){this.m.dispose(),this.accumulations!=null&&Ve(this.accumulations.map(e=>e.variable))}setMomentum(e){this.momentum=e}async getWeights(){return[await this.saveIterations()].concat(this.accumulations.map(e=>({name:e.originalName,tensor:e.variable})))}async setWeights(e){e=await this.extractIterations(e);let t=!1;this.accumulations=e.map(n=>({originalName:n.name,variable:n.tensor.variable(t)}))}getConfig(){return{learningRate:this.learningRate,momentum:this.momentum,useNesterov:this.useNesterov}}static fromConfig(e,t){return new e(t.learningRate,t.momentum,t.useNesterov)}};zp.className="Momentum";Ea(zp);var Lp=class extends Ra{constructor(e,t=.9,n=0,r=null,s=!1){super();if(this.learningRate=e,this.decay=t,this.momentum=n,this.epsilon=r,this.accumulatedMeanSquares=[],this.accumulatedMoments=[],this.accumulatedMeanGrads=[],this.centered=s,r==null&&(this.epsilon=U.backend.epsilon()),e==null)throw new Error("learningRate for RMSPropOptimizer must be defined.")}applyGradients(e){(Array.isArray(e)?e.map(n=>n.name):Object.keys(e)).forEach((n,r)=>{let s=U.registeredVariables[n],a=!1;this.accumulatedMeanSquares[r]==null&&(this.accumulatedMeanSquares[r]={originalName:`${n}/rms`,variable:Ue(()=>Cr(s).variable(a))}),this.accumulatedMoments[r]==null&&(this.accumulatedMoments[r]={originalName:`${n}/momentum`,variable:Ue(()=>Cr(s).variable(a))}),this.accumulatedMeanGrads[r]==null&&this.centered&&(this.accumulatedMeanGrads[r]={originalName:`${n}/mg`,variable:Ue(()=>Cr(s).variable(a))});let o=Array.isArray(e)?e[r].tensor:e[n];if(o==null)return;let i=this.accumulatedMeanSquares[r].variable,l=this.accumulatedMoments[r].variable;Ue(()=>{let u=Me(fe(i,this.decay),fe(ns(o),1-this.decay));if(this.centered){let c=this.accumulatedMeanGrads[r].variable,d=Me(fe(c,this.decay),fe(o,1-this.decay)),h=Qe(fe(o,this.learningRate),na(He(u,Me(ns(d),this.epsilon)))),p=Me(fe(l,this.momentum),h);i.assign(u),c.assign(d),l.assign(p);let f=He(s,p);s.assign(f)}else{let c=Me(fe(i,this.decay),fe(ns(o),1-this.decay)),d=Me(fe(l,this.momentum),Qe(fe(o,this.learningRate),na(Me(c,this.epsilon))));i.assign(c),l.assign(d);let h=He(s,d);s.assign(h)}})}),this.incrementIterations()}dispose(){this.accumulatedMeanSquares!=null&&Ve(this.accumulatedMeanSquares.map(e=>e.variable)),this.accumulatedMeanGrads!=null&&this.centered&&Ve(this.accumulatedMeanGrads.map(e=>e.variable)),this.accumulatedMoments!=null&&Ve(this.accumulatedMoments.map(e=>e.variable))}async getWeights(){let e=[...this.accumulatedMeanSquares,...this.accumulatedMoments];return this.centered&&e.push(...this.accumulatedMeanGrads),[await this.saveIterations()].concat(e.map(t=>({name:t.originalName,tensor:t.variable})))}async setWeights(e){e=await this.extractIterations(e);let t=this.centered?e.length/3:e.length/2,n=!1;this.accumulatedMeanSquares=e.slice(0,t).map(r=>({originalName:r.name,variable:r.tensor.variable(n)})),this.accumulatedMoments=e.slice(t,t*2).map(r=>({originalName:r.name,variable:r.tensor.variable(n)})),this.centered&&(this.accumulatedMeanGrads=e.slice(t*2,t*3).map(r=>({originalName:r.name,variable:r.tensor.variable(n)})))}getConfig(){return{learningRate:this.learningRate,decay:this.decay,momentum:this.momentum,epsilon:this.epsilon,centered:this.centered}}static fromConfig(e,t){return new e(t.learningRate,t.decay,t.momentum,t.epsilon,t.centered)}};Lp.className="RMSProp";Ea(Lp);var To=class{static sgd(e){return new mc(e)}static momentum(e,t,n=!1){return new zp(e,t,n)}static rmsprop(e,t=.9,n=0,r=null,s=!1){return new Lp(e,t,n,r,s)}static adam(e=.001,t=.9,n=.999,r=null){return new Op(e,t,n,r)}static adadelta(e=.001,t=.95,n=null){return new Fp(e,t,n)}static adamax(e=.002,t=.9,n=.999,r=null,s=0){return new Pp(e,t,n,r,s)}static adagrad(e,t=.1){return new Mp(e,t)}},WV={sgd:To.sgd,momentum:To.momentum,adadelta:To.adadelta,adagrad:To.adagrad,rmsprop:To.rmsprop,adamax:To.adamax,adam:To.adam},VV=(()=>typeof requestAnimationFrame!="undefined"?requestAnimationFrame:typeof setImmediate!="undefined"?setImmediate:e=>e())();function UV(){return new Promise(e=>VV(()=>e()))}var E4={};De(E4,{ERF_A1:()=>nU,ERF_A2:()=>rU,ERF_A3:()=>sU,ERF_A4:()=>aU,ERF_A5:()=>oU,ERF_P:()=>tU,PARALLELIZE_THRESHOLD:()=>hy,SELU_SCALE:()=>eU,SELU_SCALEALPHA:()=>QV,applyActivation:()=>Rp,assertAndGetBroadcastShape:()=>In,assertAxesAreInnerMostDims:()=>fz,assertParamsConsistent:()=>HV,assignToTypedArray:()=>fU,axesAreInnerMostDims:()=>ry,calculateShapes:()=>Ak,checkEinsumDimSizes:()=>bU,combineLocations:()=>t4,complexWithEvenIndex:()=>dU,complexWithOddIndex:()=>hU,computeConv2DInfo:()=>oc,computeConv3DInfo:()=>zk,computeDefaultPad:()=>Y2,computeDilation2DInfo:()=>sO,computeOptimalWindowSize:()=>jV,computeOutAndReduceShapes:()=>pz,computeOutShape:()=>GV,computePool2DInfo:()=>Pk,computePool3DInfo:()=>aO,convertConv2DDataFormat:()=>Lk,decodeEinsumEquation:()=>AU,eitherStridesOrDilationsAreOne:()=>Qs,expandShapeToKeepDim:()=>cc,exponent:()=>gU,exponents:()=>mU,fromStringArrayToUint8:()=>EU,fromUint8ToStringArray:()=>CU,getAxesPermutation:()=>mz,getBroadcastDims:()=>mP,getComplexWithIndex:()=>pU,getEinsumComputePath:()=>vU,getEinsumPermutation:()=>xU,getFusedBiasGradient:()=>_p,getFusedDyActivation:()=>$p,getImageCenter:()=>qV,getInnerMostAxes:()=>yz,getPermuted:()=>XV,getReductionAxes:()=>Hk,getReshaped:()=>KV,getReshapedPermuted:()=>ZV,getSliceBeginCoords:()=>YV,getSliceSize:()=>JV,getUndoAxesPermutation:()=>gz,isIdentityPermutation:()=>wU,log:()=>lU,mergeRealAndImagArrays:()=>uU,prepareAndValidate:()=>gk,prepareSplitSize:()=>IU,segment_util:()=>R4,shouldFuse:()=>Dp,slice_util:()=>U2,splitRealAndImagArrays:()=>cU,tupleValuesAreOne:()=>ic,upcastType:()=>cp,validateInput:()=>V2,validateUpdateShape:()=>W2,warn:()=>iU});function HV(e,t){let n=e[0].length;e.forEach((s,a)=>{L(s.length===n,()=>`Error in concat${n}D: rank of tensors[${a}] must be the same as the rank of the rest (${n})`)}),L(t>=0&&t`Error in concat${n}D: axis must be between 0 and ${n-1}.`);let r=e[0];e.forEach((s,a)=>{for(let o=0;o`Error in concat${n}D: Shape of tensors[${a}] (${s}) does not match the shape of the rest (${r}) along the non-concatenated axis ${a}.`)})}function GV(e,t){let n=e[0].slice();for(let r=1;r=t*2+1||o%2==1?a.push(o):s.push(o);r.push(...s),r.push(0),r.push(...a)}return r}function ZV(e,t,n,r=!0){let s=[];r?s.push(e[0]/n):s.push(e[0]*n);for(let a=1;a/g,$4=",",_4="...";function AU(e,t){e=e.replace(/\s/g,"");let n=(e.length-e.replace(yU,"").length)/py.length;if(n<1)throw new Error("Equations without an arrow are not supported.");if(n>1)throw new Error(`Equation must contain exactly one arrow ("${py}").`);let[r,s]=e.split(py);L(r.indexOf(_4)===-1,()=>`The ellipsis notation ("${_4}") is not supported yet.`);let a=r.split($4),o=a.length;if(t!==o)throw new Error(`Expected ${o} input tensors, received ${t}`);if(o>2)throw new Error("Support for more than 2 input tensors is not implemented yet.");let i=[];for(let h=0;hf.indexOf(p)!==-1))throw new Error(`Output subscripts contain the label ${p} not present in the input subscripts.`);i.indexOf(p)===-1&&i.push(p)}for(let h=0;hs!==-1),{permutationIndices:n,expandDims:r}}function bU(e,t,n){let r=new Array(e);for(let s=0;s`Expected dimension ${r[t[s][o]]} at axis ${o} of input shaped ${JSON.stringify(a)}, but got dimension ${a[o]}`)}}function vU(e,t){let n=e,r=[],s=0;e.length===0&&n.push(-1),s=e.length+1;for(let o=0;ot===n)}function kU(e,t){let n=[];for(let r=0;r"Number of splits must evenly divide the axis."),r=new Array(t).fill(e.shape[n]/t);else{let s=t.reduce((o,i)=>(i===-1&&(o+=1),o),0);L(s<=1,()=>"There should be only one negative value in split array.");let a=t.indexOf(-1);if(a!==-1){let o=t.reduce((i,l)=>l>0?i+l:i);t[a]=e.shape[n]-o}L(e.shape[n]===t.reduce((o,i)=>o+i),()=>"The sum of sizes must match the size of the axis dimension."),r=t}return r}var R4={};De(R4,{collectGatherOpShapeInfo:()=>NU,computeOutShape:()=>TU,segOpComputeOptimalWindowSize:()=>SU});function SU(e,t){let n=!1,r;for(e<=hy?(r=e,n=!0):r=tp(e,Math.floor(Math.sqrt(e)));!n;)r>t||r===e?n=!0:r=tp(e,r+1);return r}function TU(e,t,n){let r=[],s=e.length;for(let a=0;as))throw new Error(`Expect batchDims in the range of [-${s}, ${s}], but got ${r}`);if(r<0&&(r+=s),r>a)throw new Error(`batchDims (${r}) must be less than rank(x) ( + ${a}).`);if(nip(t))}catch(t){throw new Error(`Failed to decode encoded string bytes into utf-8, error: ${t}`)}}function EU(e){return e.map(t=>Qu(t))}var D4={};De(D4,{nonMaxSuppressionV3Impl:()=>I4,nonMaxSuppressionV4Impl:()=>S4,nonMaxSuppressionV5Impl:()=>T4,whereImpl:()=>y4});var $U=1e-7,_U=1e-4,fy=class{constructor(e,t){this.backend=e,this.dataMover=t,this.data=new WeakMap,this.dataIdsCount=0}get(e){return this.data.has(e)||this.dataMover.moveData(this.backend,e),this.data.get(e)}set(e,t){this.dataIdsCount++,this.data.set(e,t)}has(e){return this.data.has(e)}delete(e){return this.dataIdsCount--,this.data.delete(e)}numDataIds(){return this.dataIdsCount}},Bp=class{refCount(e){return Gr("refCount")}incRef(e){return Gr("incRef")}timerAvailable(){return!0}time(e){return Gr("time")}read(e){return Gr("read")}readSync(e){return Gr("readSync")}numDataIds(){return Gr("numDataIds")}disposeData(e,t){return Gr("disposeData")}write(e,t,n){return Gr("write")}move(e,t,n,r,s){return Gr("move")}memory(){return Gr("memory")}floatPrecision(){return Gr("floatPrecision")}epsilon(){return this.floatPrecision()===32?$U:_U}dispose(){return Gr("dispose")}};function Gr(e){throw new Error(`'${e}' not yet implemented or not found in the registry. This kernel may not be supported by the tfjs backend you have chosen`)}function F4(e){let t=e.length,n=0,r=0;for(;t>0;)r=Math.random()*t|0,t--,n=e[t],e[t]=e[r],e[r]=n}function RU(e,t){if(e.length!==t.length)throw new Error(`Array sizes must match to be shuffled together First array length was ${e.length}Second array length was ${t.length}`);let n=e.length,r,s,a=0;for(;n>0;)a=Math.random()*n|0,n--,r=e[n],s=t[n],e[n]=e[a],t[n]=t[a],e[a]=r,t[a]=s}function gc(e,t,n){return Math.max(e,Math.min(t,n))}function DU(e){return e%2==0?e:e+1}function FU(e){let t=0;for(let n=0;nn+` Shapes ${e} and ${t} must match`)}function Wp(e){z(e!=null,()=>"The input to the tensor constructor must be a non-null value.")}function yc(e,t=[],n=!1){if(t==null&&(t=[]),Array.isArray(e)||ss(e)&&!n)for(let r=0;r0,n){return new Promise((r,s)=>{let a=0,o=()=>{if(e()){r();return}a++;let i=t(a);if(n!=null&&a>=n){s();return}setTimeout(o,i)};o()})}function VU(e,t){let n=1,r=-1;for(let a=0;a=0)n*=e[a];else if(e[a]===-1){if(r!==-1)throw Error(`Shapes can only have 1 implicit size. Found -1 at dim ${r} and dim ${a}`);r=a}else if(e[a]<0)throw Error(`Shapes can not be < 0. Found ${e[a]} at dim ${a}`);if(r===-1){if(t>0&&t!==n)throw Error(`Size(${t}) must match the product of shape ${e}`);return e}if(n===0)throw Error(`Cannot infer the missing size in [${e}] when there are 0 elements`);if(t%n!=0)throw Error(`The implicit shape can't be a fractional number. Got ${t} / ${n}`);let s=e.slice();return s[r]=t/n,s}function jr(e,t){let n=t.length;return e=e==null?t.map((r,s)=>s):[].concat(e),z(e.every(r=>r>=-n&&r`All values in axis param must be in range [-${n}, ${n}) but got axis ${e}`),z(e.every(r=>mn(r)),()=>`All values in axis param must be integers but got axis ${e}`),e.map(r=>r<0?n+r:r)}function M4(e,t){let n=[],r=[],s=t!=null&&Array.isArray(t)&&t.length===0,a=t==null||s?null:jr(t,e).sort(),o=0;for(let i=0;ii)&&e[i]===1&&(n.push(e[i]),r.push(i)),a[o]<=i&&o++}e[i]!==1&&(n.push(e[i]),r.push(i))}return{newShape:n,keptDims:r}}function UU(e,t){let n=null;if(e==null||e==="float32")n=new Float32Array(t);else if(e==="int32")n=new Int32Array(t);else if(e==="bool")n=new Uint8Array(t);else throw new Error(`Unknown data type ${e}`);return n}function O4(e,t){let n=null;if(e==null||e==="float32")n=new Float32Array(t);else if(e==="int32")n=new Int32Array(t);else if(e==="bool")n=new Uint8Array(t);else if(e==="string")n=new Array(t);else throw new Error(`Unknown data type ${e}`);return n}function P4(e,t){for(let n=0;nt+=n.length),t}function Vp(e){return typeof e=="string"||e instanceof String}function B4(e){return typeof e=="boolean"}function W4(e){return typeof e=="number"}function Up(e){return Array.isArray(e)?Up(e[0]):e instanceof Float32Array?"float32":e instanceof Int32Array||e instanceof Uint8Array?"int32":W4(e)?"float32":Vp(e)?"string":B4(e)?"bool":"float32"}function Hp(e){return!!(e&&e.constructor&&e.call&&e.apply)}function Gp(e,t){for(let n=t;n=0;--r)n[r]=n[r+1]*e[r+1];return n}function V4(e,t,n,r=!1){let s=new Array;if(t.length===1){let a=t[0]*(r?2:1);for(let o=0;ol*u)*(r?2:1);for(let l=0;ls*a)*(n?2:1);if(r===0)return[];if(r!==t.length)throw new Error(`[${e}] does not match the input size ${t.length}${n?" for a complex tensor":""}.`);return V4(0,e,t,n)}function gy(e,t){let n=jp(e,t);for(let r=0;rr*s,1);if(t==null||t==="float32")return Xi(e,new Float32Array(n));if(t==="int32")return Xi(e,new Int32Array(n));if(t==="bool")return Xi(e,new Uint8Array(n));throw new Error(`Unknown data type ${t}`)}function yy(e){e.forEach(t=>{z(Number.isInteger(t)&&t>=0,()=>`Tensor must have a shape comprised of positive integers but got shape [${e}].`)})}function jU(e,t,n){if(t===0)return 0;if(t===1)return e[0];let r=e[e.length-1];for(let s=0;s{let[r,s]=n.split(":");this.urlFlags[r]=YU(r,s)})}};function XU(e){let t={};return e.replace(/[?&]([^=?&]+)(?:=([^&]*))?/g,(n,...r)=>(ZU(t,r[0],r[1]),r.join("="))),t}function ZU(e,t,n){e[decodeURIComponent(t)]=decodeURIComponent(n||"")}function YU(e,t){if(t=t.toLowerCase(),t==="true"||t==="false")return t==="true";if(`${+t}`===t)return+t;throw new Error(`Could not parse value flag value ${t} for flag ${e}.`)}function ae(){return H4}var H4=null;function JU(e){H4=e}var xy;function G4(){if(xy==null){let e;if(typeof window!="undefined")e=window;else if(typeof global!="undefined")e=global;else if(typeof process!="undefined")e=process;else if(typeof self!="undefined")e=self;else throw new Error("Could not find a global object");xy=e}return xy}function QU(){let e=G4();return e._tfGlobals==null&&(e._tfGlobals=new Map),e._tfGlobals}function by(e,t){let n=QU();if(n.has(e))return n.get(e);{let r=t();return n.set(e,r),n.get(e)}}var xc="Abs",bc="Acos",vc="Acosh",Fa="Add",Zi="AddN",wc="All",kc="Any",Yi="ArgMax",qp="ArgMin",Ic="Asin",Sc="Asinh",Tc="Atan",Nc="Atanh",Cc="Atan2",Ji="AvgPool",vy="AvgPoolGrad",Kp="AvgPool3D",wy="AvgPool3DGrad",Qi="BatchMatMul",Xp="BatchToSpaceND",ky="Bincount",eH="BroadcastTo",el="Cast",No="Ceil",Co="ClipByValue",Iy="Complex",Zp="ComplexAbs",Ec="Concat",tl="Conv2D",Sy="Conv2DBackpropFilter",nl="Conv2DBackpropInput",Yp="Conv3D",Ty="Conv3DBackpropFilterV2",Ny="Conv3DBackpropInputV2",rl="Cos",$c="Cosh",sl="Cumsum",_c="CropAndResize",Cy="DenseBincount",Rc="DepthToSpace",al="DepthwiseConv2dNative",Ey="DepthwiseConv2dNativeBackpropFilter",$y="DepthwiseConv2dNativeBackpropInput",_y="Diag",Jp="Dilation2D",Ry="Dilation2DBackpropInput",Dy="Dilation2DBackpropFilter",ol="RealDiv",Fy="Einsum",Dc="Elu",My="EluGrad",Fc="Erf",il="Equal",Eo="Exp",Mc="ExpandDims",ll="Expm1",Oy="FFT",Qp="Fill",Oc="FlipLeftRight",$o="Floor",ul="FloorDiv",cl="FusedBatchNorm",Pc="GatherV2",zc="GatherNd",dl="Greater",_o="GreaterEqual",hl="Identity",Py="IFFT",zy="Imag",Lc="IsFinite",Bc="IsInf",Wc="IsNan",pl="LeakyRelu",fl="Less",ml="LessEqual",Ly="LinSpace",Ro="Log",Vc="Log1p",Uc="LogicalAnd",ef="LogicalNot",tf="LogicalOr",tH="LogSoftmax",nf="LRN",By="LRNGrad",gl="Max",Do="Maximum",yl="MaxPool",Wy="MaxPoolGrad",rf="MaxPool3D",Vy="MaxPool3DGrad",Uy="MaxPoolWithArgmax",Al="Mean",xl="Min",Fo="Minimum",bl="MirrorPad",Hc="Mod",Hy="Multinomial",Mo="Multiply",Gc="Neg",vl="NotEqual",jc="NonMaxSuppressionV3",qc="NonMaxSuppressionV4",Kc="NonMaxSuppressionV5",Xc="OnesLike",wl="OneHot",Zc="Pack",kl="PadV2",Il="Pow",Sl="Prelu",Yc="Prod",sf="Range",Gy="Real",Jc="Reciprocal",Tl="Relu",Qc="Reshape",af="ResizeNearestNeighbor",jy="ResizeNearestNeighborGrad",Nl="ResizeBilinear",qy="ResizeBilinearGrad",Cl="Relu6",El="Reverse",$l="Round",Oo="Rsqrt",ed="ScatterNd",td="Select",nd="Selu",rd="Slice",_l="Sin",sd="Sinh",ad="Sign",Rl="Sigmoid",od="Softplus",Dl="Sqrt",Fl="Sum",of="SpaceToBatchND",id="SplitV",Ml="Softmax",Ky="SparseFillEmptyRows",Xy="SparseReshape",Zy="SparseSegmentMean",Yy="SparseSegmentSum",Jy="SparseToDense",Po="SquaredDifference",lf="Square",ld="StridedSlice",Qy="StringNGrams",eA="StringSplit",tA="StringToHashBucketFast",zo="Sub",Ol="Tan",Pl="Tanh",Lo="Tile",ud="TopK",cd="Transform",zl="Transpose",nA="Unique",dd="Unpack",uf="UnsortedSegmentSum",hd="ZerosLike",Bo="Step",rA="FromPixels",pd="RotateWithOffset",Ll="_FusedMatMul",Bl="FusedConv2D",Wl="FusedDepthwiseConv2D",cf=by("kernelRegistry",()=>new Map),sA=by("gradRegistry",()=>new Map);function aA(e,t){let n=K4(e,t);return cf.get(n)}function j4(e){return sA.get(e)}function q4(e){let t=cf.entries(),n=[];for(;;){let{done:r,value:s}=t.next();if(r)break;let[a,o]=s,[i]=a.split("_");i===e&&n.push(o)}return n}function oA(e){let{kernelName:t,backendName:n}=e,r=K4(t,n);cf.has(r)&&console.warn(`The kernel '${t}' for backend '${n}' is already registered`),cf.set(r,e)}function nH(e){let{kernelName:t}=e;sA.has(t)&&ae().getBool("DEBUG")&&console.warn(`Overriding the gradient for '${t}'`),sA.set(t,e)}function K4(e,t){return`${t}_${e}`}var k={};De(k,{arraysEqual:()=>Da,assert:()=>z,assertNonNegativeIntegerDimensions:()=>yy,assertNonNull:()=>Wp,assertShapesMatch:()=>rs,bytesFromStringArray:()=>L4,bytesPerElement:()=>my,checkConversionForErrors:()=>P4,clamp:()=>gc,computeStrides:()=>Ki,createScalarValue:()=>lH,createShuffledIndices:()=>BU,decodeString:()=>ff,distSquared:()=>OU,encodeString:()=>pf,fetch:()=>cH,fingerPrint64:()=>iH,flatten:()=>yc,getArrayFromDType:()=>O4,getTypedArrayFromDType:()=>UU,hasEncodingLoss:()=>HU,hexToLong:()=>fd,indexToLoc:()=>qU,inferDtype:()=>Up,inferFromImplicitShape:()=>VU,isBoolean:()=>B4,isFunction:()=>Hp,isInt:()=>mn,isNumber:()=>W4,isPromise:()=>Ay,isScalarShape:()=>PU,isString:()=>Vp,isTypedArray:()=>ss,isValidDtype:()=>z4,locToIndex:()=>jU,makeOnesTypedArray:()=>gy,makeZerosNestedTypedArray:()=>GU,makeZerosTypedArray:()=>jp,nearestDivisor:()=>Gp,nearestLargerEven:()=>DU,now:()=>md,parseAxisParam:()=>jr,randUniform:()=>MU,repeatedTry:()=>WU,rightPad:()=>Ac,shuffle:()=>F4,shuffleCombo:()=>RU,sizeFromShape:()=>on,sizeToSquarishShape:()=>LU,squeezeShape:()=>M4,sum:()=>FU,tanh:()=>zU,toNestedArray:()=>Xi,toTypedArray:()=>hf});var X4=Ks(M3()),Wo=X4.default||X4;function fd(e){return Wo.fromString(e,!0,16)}var Z4=fd("c3a5c85c97cb3127"),Vo=fd("b492b66fbe98f273"),zn=fd("9ae16a3b2f90404f");function iA(e){return e.xor(e.shru(47))}function Y4(e,t,n){let r=e.slice(t,t+n);return Wo.fromBytes(Array.from(r),!0,!0)}function Nt(e,t){return Y4(e,t,8)}function J4(e,t){return Y4(e,t,4)}function gn(e,t){return t===0?e:e.shru(t).or(e.shl(64-t))}function Ma(e,t,n=fd("9ddfea08eb382d69")){let r=e.xor(t).mul(n);r=r.xor(r.shru(47));let s=t.xor(r).mul(n);return s=s.xor(s.shru(47)),s=s.mul(n),s}function rH(e,t,n,r,s,a){s=s.add(e),a=gn(a.add(s).add(r),21);let o=s;return s=s.add(t),s=s.add(n),a=a.add(gn(s,44)),[s.add(r),a.add(o)]}function df(e,t,n,r){return rH(Nt(e,t),Nt(e,t+8),Nt(e,t+16),Nt(e,t+24),n,r)}function sH(e,t=e.length){if(t>=8){let n=zn.add(t*2),r=Nt(e,0).add(zn),s=Nt(e,t-8),a=gn(s,37).mul(n).add(r),o=gn(r,25).add(s).mul(n);return Ma(a,o,n)}if(t>=4){let n=zn.add(t*2),r=J4(e,0);return Ma(r.shl(3).add(t),J4(e,t-4),n)}if(t>0){let n=e[0],r=e[t>>1],s=e[t-1],a=n+(r<<8),o=t+(s<<2);return iA(zn.mul(a).xor(Z4.mul(o))).mul(zn)}return zn}function aH(e,t=e.length){let n=zn.add(t*2),r=Nt(e,0).mul(Vo),s=Nt(e,8),a=Nt(e,t-8).mul(n),o=Nt(e,t-16).mul(zn);return Ma(gn(r.add(s),43).add(gn(a,30)).add(o),r.add(gn(s.add(zn),18)).add(a),n)}function oH(e,t=e.length){let n=zn.add(t*2),r=Nt(e,0).mul(zn),s=Nt(e,8),a=Nt(e,t-8).mul(n),o=Nt(e,t-16).mul(zn),i=gn(r.add(s),43).add(gn(a,30)).add(o),l=Ma(i,r.add(gn(s.add(zn),18)).add(a),n),u=Nt(e,16).mul(n),c=Nt(e,24),d=i.add(Nt(e,t-32)).mul(n),h=l.add(Nt(e,t-24)).mul(n);return Ma(gn(u.add(c),43).add(gn(d,30)).add(h),u.add(gn(c.add(r),18)).add(d),n)}function iH(e,t=e.length){let n=Wo.fromNumber(81,!0);if(t<=32)return t<=16?sH(e,t):aH(e,t);if(t<=64)return oH(e,t);let r=n,s=n.mul(Vo).add(113),a=iA(s.mul(zn).add(113)).mul(zn),o=[Wo.UZERO,Wo.UZERO],i=[Wo.UZERO,Wo.UZERO];r=r.mul(zn).add(Nt(e,0));let l=0,u=(t-1>>6)*64,c=u+(t-1&63)-63;do r=gn(r.add(s).add(o[0]).add(Nt(e,l+8)),37).mul(Vo),s=gn(s.add(o[1]).add(Nt(e,l+48)),42).mul(Vo),r=r.xor(i[1]),s=s.add(o[0]).add(Nt(e,l+40)),a=gn(a.add(i[0]),33).mul(Vo),o=df(e,l,o[1].mul(Vo),r.add(i[0])),i=df(e,l+32,a.add(i[1]),s.add(Nt(e,l+16))),[a,r]=[r,a],l+=64;while(l!==u);let d=Vo.add(a.and(255).shl(1));return l=c,i[0]=i[0].add(t-1&63),o[0]=o[0].add(i[0]),i[0]=i[0].add(o[0]),r=gn(r.add(s).add(o[0]).add(Nt(e,l+8)),37).mul(d),s=gn(s.add(o[1]).add(Nt(e,l+48)),42).mul(d),r=r.xor(i[1].mul(9)),s=s.add(o[0].mul(9).add(Nt(e,l+40))),a=gn(a.add(i[0]),33).mul(d),o=df(e,l,o[1].mul(d),r.add(i[0])),i=df(e,l+32,a.add(i[1]),s.add(Nt(e,l+16))),[a,r]=[r,a],Ma(Ma(o[0],i[0],d).add(iA(s).mul(Z4)).add(a),Ma(o[1],i[1],d).add(r),d)}function lH(e,t){return t==="string"?pf(e):hf([e],t)}function uH(e,t){return e instanceof Float32Array&&t==="float32"||e instanceof Int32Array&&t==="int32"||e instanceof Uint8Array&&t==="bool"}function hf(e,t){if(t==="string")throw new Error("Cannot convert a string[] to a TypedArray");if(Array.isArray(e)&&(e=yc(e)),ae().getBool("DEBUG")&&P4(e,t),uH(e,t))return e;if(t==null||t==="float32"||t==="complex64")return new Float32Array(e);if(t==="int32")return new Int32Array(e);if(t==="bool"){let n=new Uint8Array(e.length);for(let r=0;r{r=n()},a,o=md();if(this.backendTimer.timerAvailable())a=this.backendTimer.time(s);else{s();for(let l of r)l.dataSync();a=Promise.resolve({kernelMs:md()-o})}if(ae().getBool("CHECK_COMPUTATION_FOR_ERRORS"))for(let l=0;l{hH(c,u.dtype,e)})}return{kernelName:e,outputs:r,inputs:t,timeMs:a.then(l=>l.kernelMs),extraInfo:a.then(l=>l.getExtraProfileInfo!=null?l.getExtraProfileInfo():"")}}logKernelProfile(e){let{kernelName:t,outputs:n,timeMs:r,inputs:s,extraInfo:a}=e;n.forEach(o=>{Promise.all([o.data(),r,a]).then(i=>{this.logger.logKernelProfile(t,o,i[0],i[1],s,i[2])})})}};function hH(e,t,n){if(t!=="float32")return!1;for(let r=0;r0?f:""} `}}console.log(`%c${i} %c${o} %c${l}D ${c} %c${u} %c${d} %c${a}`,"font-weight:bold","color:red","color:blue","color: orange","color: green","color: steelblue")}};function fH(e,t,n){let r={},s={};for(let l=0;lr[m.id]=!0),p=!0,s[u.id]=!0;break}if(p)break}}let a={};a[n.id]=!0;let o={};for(let l=e.length-1;l>=0;l--){let u=e[l],c=u.inputs;for(let d=0;d=0;s--){let a=t[s],o=[];if(a.outputs.forEach(l=>{let u=e[l.id];u!=null?o.push(u):o.push(null)}),a.gradient==null)throw new Error(`Cannot compute gradient: gradient function not found for ${a.kernelName}.`);let i=a.gradient(o);for(let l in a.inputs){if(!(l in i))throw new Error(`Cannot backprop through input ${l}. Available gradients found: ${Object.keys(i)}.`);let u=n(()=>i[l]());if(u.dtype!=="float32")throw new Error(`Error in gradient for op ${a.kernelName}. The gradient of input ${l} must have 'float32' dtype, but has '${u.dtype}'`);let c=a.inputs[l];if(!Da(u.shape,c.shape))throw new Error(`Error in gradient for op ${a.kernelName}. The gradient of input '${l}' has shape '${u.shape}', which does not match the shape of the input '${c.shape}'`);if(e[c.id]==null)e[c.id]=u;else{let d=e[c.id];e[c.id]=r(d,u),d.dispose()}}}}var Q4=20,gd=3,lA=7;function gH(e,t,n,r){let s=Ki(t),a=yH(e,t,n,s),o=t.length,i=mf(e,t,n,s,a),l=["Tensor"];return r&&(l.push(` dtype: ${n}`),l.push(` rank: ${o}`),l.push(` shape: [${t}]`),l.push(" values:")),l.push(i.map(u=>" "+u).join(` `)),l.join(` -`)}function yj(e,t,n,a){let r=on(t),s=a[a.length-1],i=new Array(s).fill(0),o=t.length,l=n==="complex64"?Ah(e):e;if(o>1)for(let u=0;uQ6){let g=gh*i,y=Array.from(e.slice(0,g)),A=Array.from(e.slice((o-gh)*i,o*i));return n==="complex64"&&(y=Ah(y),A=Ah(A)),["["+y.map((x,v)=>yh(x,r[v],n)).join(", ")+", ..., "+A.map((x,v)=>yh(x,r[o-gh+v],n)).join(", ")+"]"]}let f=n==="complex64"?Ah(e):Array.from(e);return["["+f.map((g,y)=>yh(g,r[y],n)).join(", ")+"]"]}let u=t.slice(1),d=a.slice(1),h=a[0]*i,p=[];if(o>Q6){for(let f=0;f`Length of values '${a}' does not match the size inferred by the shape '${this.size}'.`)}if(t==="complex64")throw new Error("complex64 dtype TensorBuffers are not supported. Please create a TensorBuffer for the real and imaginary parts separately and call tf.complex(real, imag).");this.values=n||_6(t,this.size),this.strides=Ko(e)}set(e,...t){t.length===0&&(t=[0]),P(t.length===this.rank,()=>`The number of provided coordinates (${t.length}) must match the rank (${this.rank})`);let n=this.locToIndex(t);this.values[n]=e}get(...e){e.length===0&&(e=[0]);let t=0;for(let a of e){if(a<0||a>=this.shape[t]){let r=`Requested out of range element at ${e}. Buffer shape=${this.shape}`;throw new Error(r)}t++}let n=e[e.length-1];for(let a=0;aff(n))}catch(n){throw new Error("Failed to decode the string bytes into utf-8. To get the original bytes, call tensor.bytes().")}}return e}dataSync(){this.throwIfDisposed();let e=Tr().readSync(this.dataId);if(this.dtype==="string")try{return e.map(t=>ff(t))}catch(t){throw new Error("Failed to decode the string bytes into utf-8. To get the original bytes, call tensor.bytes().")}return e}async bytes(){this.throwIfDisposed();let e=await Tr().read(this.dataId);return this.dtype==="string"?e:new Uint8Array(e.buffer)}dispose(){this.isDisposed||(Tr().disposeTensor(this),this.isDisposedInternal=!0)}get isDisposed(){return this.isDisposedInternal}throwIfDisposed(){if(this.isDisposed)throw new Error("Tensor is disposed.")}print(e=!1){return Vl.print(this,e)}clone(){return this.throwIfDisposed(),Vl.clone(this)}toString(e=!1){let t=this.dataSync();return gj(t,this.shape,this.dtype,e)}cast(e){return this.throwIfDisposed(),Vl.cast(this,e)}variable(e=!0,t,n){return this.throwIfDisposed(),Tr().makeVariable(this,e,t,n)}};Object.defineProperty(Tt,Symbol.hasInstance,{value:e=>!!e&&e.data!=null&&e.dataSync!=null&&e.throwIfDisposed!=null});function re(){return x1("Tensor",()=>Tt)}re();var gf=class extends Tt{constructor(e,t,n,a){super(e.shape,e.dtype,e.dataId,a);this.trainable=t,this.name=n}assign(e){if(e.dtype!==this.dtype)throw new Error(`dtype of the new value (${e.dtype}) and previous value (${this.dtype}) must match`);if(!Fs(e.shape,this.shape))throw new Error(`shape of the new value (${e.shape}) and previous value (${this.shape}) must match`);Tr().disposeTensor(this),this.dataId=e.dataId,Tr().incRef(this,null)}dispose(){Tr().disposeVariable(this),this.isDisposedInternal=!0}};Object.defineProperty(gf,Symbol.hasInstance,{value:e=>e instanceof Tt&&e.assign!=null&&e.assign instanceof Function});var Er={};$e(Er,{assertTypesMatch:()=>n4,getTensorsInContainer:()=>cA,isTensorInList:()=>kj,makeTypesMatch:()=>Ut});var t4;(function(e){e.R0="R0",e.R1="R1",e.R2="R2",e.R3="R3",e.R4="R4",e.R5="R5",e.R6="R6"})(t4||(t4={}));var lA;(function(e){e.float32="float32",e.int32="int32",e.bool="int32",e.complex64="complex64"})(lA||(lA={}));var uA;(function(e){e.float32="float32",e.int32="int32",e.bool="bool",e.complex64="complex64"})(uA||(uA={}));var dA;(function(e){e.float32="float32",e.int32="float32",e.bool="float32",e.complex64="complex64"})(dA||(dA={}));var hA;(function(e){e.float32="complex64",e.int32="complex64",e.bool="complex64",e.complex64="complex64"})(hA||(hA={}));var wj={float32:dA,int32:lA,bool:uA,complex64:hA};function Ga(e,t){if(e==="string"||t==="string"){if(e==="string"&&t==="string")return"string";throw new Error(`Can not upcast ${e} with ${t}`)}return wj[e][t]}function pA(e){return Ga(e,"int32")}function Ut(e,t){if(e.dtype===t.dtype)return[e,t];let n=Ga(e.dtype,t.dtype);return[e.cast(n),t.cast(n)]}function n4(e,t){P(e.dtype===t.dtype,()=>`The dtypes of the first(${e.dtype}) and second(${t.dtype}) input must match`)}function kj(e,t){return t.some(n=>n.id===e.id)}function cA(e){let t=[],n=new Set;return a4(e,t,n),t}function a4(e,t,n){if(e==null)return;if(e instanceof Tt){t.push(e);return}if(!Ij(e))return;let a=e;for(let r in a){let s=a[r];n.has(s)||(n.add(s),a4(s,t,n))}}function Ij(e){return Array.isArray(e)||typeof e=="object"}function fA(e){return e.kernelName!=null}var r4=class{constructor(){this.registeredVariables={},this.nextTapeNodeId=0,this.numBytes=0,this.numTensors=0,this.numStringTensors=0,this.numDataBuffers=0,this.gradientDepth=0,this.kernelDepth=0,this.scopeStack=[],this.numDataMovesStack=[],this.nextScopeId=0,this.tensorInfo=new WeakMap,this.profiling=!1,this.activeProfile={newBytes:0,newTensors:0,peakBytes:0,kernels:[],result:null,get kernelNames(){return Array.from(new Set(this.kernels.map(e=>e.name)))}}}dispose(){for(let e in this.registeredVariables)this.registeredVariables[e].dispose()}},xh=class{constructor(e){this.ENV=e,this.registry={},this.registryFactory={},this.pendingBackendInitId=0,this.state=new r4}async ready(){if(this.pendingBackendInit!=null)return this.pendingBackendInit.then(()=>{});if(this.backendInstance!=null)return;let e=this.getSortedBackends();for(let t=0;t{e.setupFunc!=null&&e.setupFunc(this.backendInstance)})}disposeRegisteredKernels(e){q6(e).forEach(t=>{t.disposeFunc!=null&&t.disposeFunc(this.registry[e])})}initializeBackend(e){let t=this.registryFactory[e];if(t==null)throw new Error(`Cannot initialize backend ${e}, no registration found.`);try{let n=t.factory();if(n&&!(n instanceof Wc)&&typeof n.then=="function"){let a=++this.pendingBackendInitId,r=n.then(s=>a(athis.registryFactory[t].priority-this.registryFactory[e].priority)}initializeBackendsAndReturnBest(){let e=this.getSortedBackends();for(let t=0;tthis.startScope(n),()=>this.endScope(a),()=>(a=t(),a instanceof Promise&&console.error("Cannot return a Promise inside of tidy."),a))}scopedRun(e,t,n){e();try{let a=n();return t(),a}catch(a){throw t(),a}}nextTensorId(){return xh.nextTensorId++}nextVariableId(){return xh.nextVariableId++}clone(e){let t=j.runKernel(pl,{x:e}),n={x:e},a=s=>({x:()=>{let i="float32",o={x:s},l={dtype:i};return j.runKernel(el,o,l)}}),r=[];return this.addTapeNode(this.state.activeScope.name,n,[t],a,r,{}),t}runKernel(e,t,n){if(rA(e,this.backendName)==null)throw new Error(`Kernel '${e}' not registered for backend '${this.backendName}'`);return this.runKernelFunc({kernelName:e,inputs:t,attrs:n})}shouldCheckForMemLeaks(){return this.ENV.getBool("IS_TEST")}checkKernelForMemLeak(e,t,n){let a=this.backend.numDataIds(),r=0;n.forEach(o=>{r+=o.dtype==="complex64"?3:1});let s=this.state.numDataMovesStack[this.state.numDataMovesStack.length-1],i=a-t-r-s;if(i>0)throw new Error(`Backend '${this.backendName}' has an internal memory leak (${i} data ids) after running '${e}'`)}runKernelFunc(e){let t,n=[],a=this.isTapeOn(),r=this.state.numBytes,s=this.state.numTensors;this.shouldCheckForMemLeaks()&&this.state.numDataMovesStack.push(0);let i;this.backendName==null&&this.backend;let o,l=fA(e)?e.kernelName:this.state.activeScope!=null?this.state.activeScope.name:"";if(fA(e)){let{kernelName:c,inputs:m,attrs:f}=e;this.backendName==null&&this.backend;let g=rA(c,this.backendName);P(g!=null,()=>`Cannot find registered kernel '${c}' for backend '${this.backendName}'`),i=()=>{let y=this.backend.numDataIds();o=g.kernelFunc({inputs:m,attrs:f,backend:this.backend});let A=Array.isArray(o)?o:[o];this.shouldCheckForMemLeaks()&&this.checkKernelForMemLeak(c,y,A);let x=A.map(v=>{if(v.rank!=null)return v;let{dataId:b,shape:w,dtype:I}=v;return this.makeTensorFromDataId(b,w,I)});if(a){let v=this.getTensorsForGradient(c,m,x);n=this.saveTensorsForBackwardMode(v)}return x}}else{let{forwardFunc:c}=e,m=f=>{!a||(n=f.map(g=>this.keep(this.clone(g))))};i=()=>{let f=this.backend.numDataIds();o=this.tidy(()=>c(this.backend,m));let g=Array.isArray(o)?o:[o];return this.shouldCheckForMemLeaks()&&this.checkKernelForMemLeak(l,f,g),g}}let{inputs:u,attrs:d}=e,h=fA(e)?null:e.backwardsFunc,p;return this.scopedRun(()=>this.state.kernelDepth++,()=>this.state.kernelDepth--,()=>{!this.ENV.getBool("DEBUG")&&!this.state.profiling?t=i():(p=this.profiler.profileKernel(l,u,()=>i()),this.ENV.getBool("DEBUG")&&this.profiler.logKernelProfile(p),t=p.outputs)}),a&&this.addTapeNode(l,u,t,h,n,d),this.state.profiling&&this.state.activeProfile.kernels.push({name:l,bytesAdded:this.state.numBytes-r,totalBytesSnapshot:this.state.numBytes,tensorsAdded:this.state.numTensors-s,totalTensorsSnapshot:this.state.numTensors,inputShapes:Object.keys(u).map(c=>u[c]!=null?u[c].shape:null),outputShapes:t.map(c=>c.shape),kernelTimeMs:p.timeMs,extraInfo:p.extraInfo}),Array.isArray(o)?t:t[0]}saveTensorsForBackwardMode(e){return e.map(t=>this.keep(this.clone(t)))}getTensorsForGradient(e,t,n){let a=G6(e);if(a!=null){let r=a.inputsToSave||[],s=a.outputsToSave||[],i;a.saveAllInputs?(P(Array.isArray(t),()=>"saveAllInputs is true, expected inputs to be an array."),i=Object.keys(t).map(l=>t[l])):i=r.map(l=>t[l]);let o=n.filter((l,u)=>s[u]);return i.concat(o)}return[]}makeTensor(e,t,n,a){if(e==null)throw new Error("Values passed to engine.makeTensor() are null");n=n||"float32",a=a||this.backend;let r=e;n==="string"&&Vc(e[0])&&(r=e.map(o=>cf(o)));let s=a.write(r,t,n),i=new Tt(t,n,s,this.nextTensorId());if(this.trackTensor(i,a),n==="string"){let o=this.state.tensorInfo.get(s),l=L6(r);this.state.numBytes+=l-o.bytes,o.bytes=l}return i}makeTensorFromDataId(e,t,n,a){n=n||"float32";let r=new Tt(t,n,e,this.nextTensorId());return this.trackTensor(r,a),r}makeVariable(e,t=!0,n,a){n=n||this.nextVariableId().toString(),a!=null&&a!==e.dtype&&(e=e.cast(a));let r=new gf(e,t,n,this.nextTensorId());if(this.state.registeredVariables[r.name]!=null)throw new Error(`Variable with name ${r.name} was already registered`);return this.state.registeredVariables[r.name]=r,this.incRef(r,this.backend),r}trackTensor(e,t){this.state.numTensors++,e.dtype==="string"&&this.state.numStringTensors++;let n=0;e.dtype!=="complex64"&&e.dtype!=="string"&&(n=e.size*f1(e.dtype)),this.state.numBytes+=n,this.state.tensorInfo.has(e.dataId)||(this.state.numDataBuffers++,this.state.tensorInfo.set(e.dataId,{backend:t||this.backend,dtype:e.dtype,shape:e.shape,bytes:n})),e instanceof gf||this.track(e)}incRef(e,t){this.trackTensor(e,t),this.backend.incRef(e.dataId)}removeDataId(e,t){this.state.tensorInfo.has(e)&&this.state.tensorInfo.get(e).backend===t&&(this.state.tensorInfo.delete(e),this.state.numDataBuffers--)}disposeTensor(e){if(!this.state.tensorInfo.has(e.dataId))return;let t=this.state.tensorInfo.get(e.dataId);if(this.state.numTensors--,e.dtype==="string"&&(this.state.numStringTensors--,this.state.numBytes-=t.bytes),e.dtype!=="complex64"&&e.dtype!=="string"){let n=e.size*f1(e.dtype);this.state.numBytes-=n}t.backend.disposeData(e.dataId)&&this.removeDataId(e.dataId,t.backend)}disposeVariables(){for(let e in this.state.registeredVariables){let t=this.state.registeredVariables[e];this.disposeVariable(t)}}disposeVariable(e){this.disposeTensor(e),this.state.registeredVariables[e.name]!=null&&delete this.state.registeredVariables[e.name]}memory(){let e=this.backend.memory();return e.numTensors=this.state.numTensors,e.numDataBuffers=this.state.numDataBuffers,e.numBytes=this.state.numBytes,this.state.numStringTensors>0&&(e.unreliable=!0,e.reasons==null&&(e.reasons=[]),e.reasons.push("Memory usage by string tensors is approximate (2 bytes per character)")),e}async profile(e){this.state.profiling=!0;let t=this.state.numBytes,n=this.state.numTensors;this.state.activeProfile.kernels=[],this.state.activeProfile.result=await e(),this.state.profiling=!1,this.state.activeProfile.peakBytes=Math.max(...this.state.activeProfile.kernels.map(a=>a.totalBytesSnapshot)),this.state.activeProfile.newBytes=this.state.numBytes-t,this.state.activeProfile.newTensors=this.state.numTensors-n;for(let a of this.state.activeProfile.kernels)a.kernelTimeMs=await a.kernelTimeMs,a.extraInfo=await a.extraInfo;return this.state.activeProfile}isTapeOn(){return this.state.gradientDepth>0&&this.state.kernelDepth===0}addTapeNode(e,t,n,a,r,s){let i={id:this.state.nextTapeNodeId++,kernelName:e,inputs:t,outputs:n,saved:r},o=G6(e);o!=null&&(a=o.gradFunc),a!=null&&(i.gradient=l=>(l=l.map((u,d)=>{if(u==null){let h=n[d],p=Gc(h.size,h.dtype);return this.makeTensor(p,h.shape,h.dtype)}return u}),a(l.length>1?l:l[0],r,s))),this.state.activeTape.push(i)}keep(e){return e.kept=!0,e}startTape(){this.state.gradientDepth===0&&(this.state.activeTape=[]),this.state.gradientDepth++}endTape(){this.state.gradientDepth--}startScope(e){let t={track:[],name:"unnamed scope",id:this.state.nextScopeId++};e&&(t.name=e),this.state.scopeStack.push(t),this.state.activeScope=t}endScope(e){let t=cA(e),n=new Set(t.map(r=>r.id));for(let r=0;r{!r.kept&&r.scopeId===a.id&&this.track(r)})}gradients(e,t,n,a=!1){if(P(t.length>0,()=>"gradients() received an empty list of xs."),n!=null&&n.dtype!=="float32")throw new Error(`dy must have 'float32' dtype, but has '${n.dtype}'`);let r=this.scopedRun(()=>this.startTape(),()=>this.endTape(),()=>this.tidy("forward",e));P(r instanceof Tt,()=>"The result y returned by f() must be a tensor.");let s=fj(this.state.activeTape,t,r);if(!a&&s.length===0&&t.length>0)throw new Error("Cannot compute gradient of y=f(x) with respect to x. Make sure that the f you passed encloses all operations that lead from x to y.");return this.tidy("backward",()=>{let i={};i[r.id]=n==null?Sj(r.shape):n,mj(i,s,l=>this.tidy(l),Nj);let o=t.map(l=>i[l.id]);return this.state.gradientDepth===0&&(this.state.activeTape.forEach(l=>{for(let u of l.saved)u.dispose()}),this.state.activeTape=null),{value:r,grads:o}})}customGrad(e){return P(jc(e),()=>"The f passed in customGrad(f) must be a function."),(...t)=>{P(t.every(i=>i instanceof Tt),()=>"The args passed in customGrad(f)(x1, x2,...) must all be tensors");let n,a={};t.forEach((i,o)=>{a[o]=i});let r=(i,o)=>(n=e(...t,o),P(n.value instanceof Tt,()=>"The function f passed in customGrad(f) must return an object where `obj.value` is a tensor"),P(jc(n.gradFunc),()=>"The function f passed in customGrad(f) must return an object where `obj.gradFunc` is a function."),n.value),s=(i,o)=>{let l=n.gradFunc(i,o),u=Array.isArray(l)?l:[l];P(u.length===t.length,()=>"The function f passed in customGrad(f) must return an object where `obj.gradFunc` is a function that returns the same number of tensors as inputs passed to f(...)."),P(u.every(h=>h instanceof Tt),()=>"The function f passed in customGrad(f) must return an object where `obj.gradFunc` is a function that returns a list of only tensors.");let d={};return u.forEach((h,p)=>{d[p]=()=>h}),d};return this.runKernelFunc({forwardFunc:r,backwardsFunc:s,inputs:a})}}readSync(e){return this.state.tensorInfo.get(e).backend.readSync(e)}read(e){return this.state.tensorInfo.get(e).backend.read(e)}async time(e){let t=mh(),n=await this.backend.time(e);return n.wallMs=mh()-t,n}track(e){return this.state.activeScope!=null&&(e.scopeId=this.state.activeScope.id,this.state.activeScope.track.push(e)),e}get registeredVariables(){return this.state.registeredVariables}reset(){this.pendingBackendInitId++,this.state.dispose(),this.ENV.reset(),this.state=new r4;for(let e in this.registry)this.disposeRegisteredKernels(e),this.registry[e].dispose(),delete this.registry[e];this.backendName=null,this.backendInstance=null,this.pendingBackendInit=null}};xh.nextTensorId=0;xh.nextVariableId=0;function Sj(e){let t=m1(on(e),"float32");return j.makeTensor(t,e,"float32")}function s4(){let e=H6();if(e._tfengine==null){let t=new KU(e);e._tfengine=new xh(t)}return JU(e._tfengine.ENV),xj(()=>e._tfengine),e._tfengine}var j=s4();function Nj(e,t){let n={a:e,b:t};return j.runKernel(Os,n)}var yf={};$e(yf,{isBrowser:()=>i4,isMobile:()=>Ej});function Tj(){return typeof navigator!="undefined"&&navigator!=null}function Ej(e){if(e||Tj()){if(e||(e=navigator),e.product==="ReactNative")return!0;let t=e.userAgent||e.vendor||window.opera;return/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(t)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(t.substr(0,4))}return!1}function i4(){return typeof window!="undefined"&&window.document!=null||typeof WorkerGlobalScope!="undefined"}var rr=se();rr.registerFlag("DEBUG",()=>!1,e=>{e&&console.warn("Debugging mode is ON. The output of every math call will be downloaded to CPU and checked for NaNs. This significantly impacts performance.")});rr.registerFlag("IS_BROWSER",()=>i4());rr.registerFlag("IS_NODE",()=>typeof process!="undefined"&&typeof process.versions!="undefined"&&typeof process.versions.node!="undefined");rr.registerFlag("IS_CHROME",()=>typeof navigator!="undefined"&&navigator!=null&&navigator.userAgent!=null&&/Chrome/.test(navigator.userAgent)&&/Google Inc/.test(navigator.vendor));rr.registerFlag("PROD",()=>!1);rr.registerFlag("TENSORLIKE_CHECK_SHAPE_CONSISTENCY",()=>rr.getBool("DEBUG"));rr.registerFlag("DEPRECATION_WARNINGS_ENABLED",()=>!0);rr.registerFlag("IS_TEST",()=>!1);rr.registerFlag("CHECK_COMPUTATION_FOR_ERRORS",()=>!0);rr.registerFlag("WRAP_TO_IMAGEBITMAP",()=>!1);function bh(e,t){let n=e;if(ar(e))return t==="string"?[]:[e.length];if(!Array.isArray(e))return[];let a=[];for(;Array.isArray(n)||ar(n)&&t!=="string";)a.push(n.length),n=n[0];return Array.isArray(e)&&se().getBool("TENSORLIKE_CHECK_SHAPE_CONSISTENCY")&&o4(e,a,[]),a}function o4(e,t,n){if(n=n||[],!Array.isArray(e)&&!ar(e)){P(t.length===0,()=>`Element arr[${n.join("][")}] is a primitive, but should be an array/TypedArray of ${t[0]} elements`);return}P(t.length>0,()=>`Element arr[${n.join("][")}] should be a primitive, but is an array of ${e.length} elements`),P(e.length===t[0],()=>`Element arr[${n.join("][")}] should have ${t[0]} elements, but has ${e.length} elements`);let a=t.slice(1);for(let r=0;r=0&&(r=a),l4(a,r,t,n),e==null||!ar(e)&&!Array.isArray(e)&&typeof e!="number"&&typeof e!="boolean"&&typeof e!="string"){let o=e==null?"null":e.constructor.name;throw new Error(`Argument '${t}' passed to '${n}' must be a Tensor or TensorLike, but got '${o}'`)}let s=bh(e,r);!ar(e)&&!Array.isArray(e)&&(e=[e]);let i=r!=="string"?pf(e,r):yd(e,[],!0);return j.makeTensor(i,s,r)}function Af(e,t,n,a="numeric"){if(!Array.isArray(e))throw new Error(`Argument ${t} passed to ${n} must be a \`Tensor[]\` or \`TensorLike[]\``);return e.map((r,s)=>F(r,`${t}[${s}]`,n,a))}var Cj="__op";function B(e){let t=Object.keys(e);if(t.length!==1)throw new Error(`Please provide an object with a single key (operation name) mapping to a function. Got an object with ${t.length} keys.`);let n=t[0],a=e[n];n.endsWith("_")&&(n=n.substring(0,n.length-1)),n=n+Cj;let r=(...s)=>{j.startScope(n);try{let i=a(...s);return y1(i)&&console.error("Cannot return a Promise inside of tidy."),j.endScope(i),i}catch(i){throw j.endScope(null),i}};return Object.defineProperty(r,"name",{value:n,configurable:!0}),r}function Mj(e,t){let n=F(e,"real","complex"),a=F(t,"imag","complex");nr(n.shape,a.shape,`real and imag shapes, ${n.shape} and ${a.shape}, must match in call to tf.complex().`);let r={real:n,imag:a};return j.runKernel(k1,r)}var Vi=B({complex_:Mj});function vh(e,t,n,a){if(a==null&&(a=Uc(e)),a==="complex64")throw new Error("Cannot construct a complex64 tensor directly. Please use tf.complex(real, imag).");if(!ar(e)&&!Array.isArray(e)&&typeof e!="number"&&typeof e!="boolean"&&typeof e!="string")throw new Error("values passed to tensor(values) must be a number/boolean/string or an array of numbers/booleans/strings, or a TypedArray");if(t!=null){g1(t);let r=on(t),s=on(n);P(r===s,()=>`Based on the provided shape, [${t}], the tensor should have ${r} values but has ${s}`);for(let i=0;i`Error creating a new Tensor. Inferred shape (${n}) does not match the provided shape (${t}). `)}}return!ar(e)&&!Array.isArray(e)&&(e=[e]),t=t||n,e=a!=="string"?pf(e,a):yd(e,[],!0),j.makeTensor(e,t,a)}function Cr(e,t,n){let a=bh(e,n);return vh(e,t,a,n)}var mA={float32:4,float16:2,int32:4,uint16:2,uint8:1,bool:1,complex64:8},xf=4;async function $j(e,t){let n=[],a=[],r=Array.isArray(e)?e.map(i=>i.name):Object.keys(e);for(let i=0;i{let p=await l.bytes(),c=p.reduce((g,y)=>g+y.length,0)+xf*p.length,m=new Uint8Array(c),f=0;for(let g=0;g{if(t+=s.byteLength,n.push(s.byteLength===s.buffer.byteLength?s:new s.constructor(s)),!(s instanceof Float32Array||s instanceof Int32Array||s instanceof Uint8Array))throw new Error(`Unsupported TypedArray subtype: ${s.constructor.name}`)});let a=new Uint8Array(t),r=0;return n.forEach(s=>{a.set(new Uint8Array(s.buffer),r),r+=s.byteLength}),a.buffer}var gA=typeof Buffer!="undefined"&&(typeof Blob=="undefined"||typeof atob=="undefined"||typeof btoa=="undefined");function d4(e){return gA?Buffer.byteLength(e):new Blob([e]).size}function Fj(e){if(gA)return Buffer.from(e).toString("base64");let t=new Uint8Array(e),n="";for(let a=0,r=t.length;a{t+=r.byteLength});let n=new Uint8Array(t),a=0;return e.forEach(r=>{n.set(new Uint8Array(r),a),a+=r.byteLength}),n.buffer}function h4(e){let t="/";for(e=e.trim();e.endsWith(t);)e=e.slice(0,e.length-1);let n=e.split(t);return n[n.length-1]}function wh(e){if(e.modelTopology instanceof ArrayBuffer)throw new Error("Expected JSON model topology, received ArrayBuffer.");return{dateSaved:new Date,modelTopologyType:"JSON",modelTopologyBytes:e.modelTopology==null?0:d4(JSON.stringify(e.modelTopology)),weightSpecsBytes:e.weightSpecs==null?0:d4(JSON.stringify(e.weightSpecs)),weightDataBytes:e.weightData==null?0:e.weightData.byteLength}}function Dj(){let e=n=>{let a=n<<13,r=0;for(;(a&8388608)==0;)r-=8388608,a<<=1;return a&=~8388608,r+=947912704,a|r},t=new Uint32Array(2048);t[0]=0;for(let n=1;n<1024;n++)t[n]=e(n);for(let n=1024;n<2048;n++)t[n]=939524096+(n-1024<<13);return t}function _j(){let e=new Uint32Array(64);e[0]=0,e[31]=1199570944,e[32]=2147483648,e[63]=3347054592;for(let t=1;t<31;t++)e[t]=t<<23;for(let t=33;t<63;t++)e[t]=2147483648+(t-32<<23);return e}function zj(){let e=new Uint32Array(64);for(let t=0;t<64;t++)e[t]=1024;return e[0]=e[32]=0,e}function Pj(){let e=Dj(),t=_j(),n=zj();return a=>{let r=new ArrayBuffer(4*a.length),s=new Uint32Array(r);for(let i=0;i>10]+(o&1023)]+t[o>>10];s[i]=l}return new Float32Array(r)}}var qt=class{constructor(){this.saveRouters=[],this.loadRouters=[]}static getInstance(){return qt.instance==null&&(qt.instance=new qt),qt.instance}static registerSaveRouter(e){qt.getInstance().saveRouters.push(e)}static registerLoadRouter(e){qt.getInstance().loadRouters.push(e)}static getSaveHandlers(e){return qt.getHandlers(e,"save")}static getLoadHandlers(e,t){return qt.getHandlers(e,"load",t)}static getHandlers(e,t,n){let a=[];return(t==="load"?qt.getInstance().loadRouters:qt.getInstance().saveRouters).forEach(r=>{let s=r(e,n);s!==null&&a.push(s)}),a}},Lj=e=>qt.registerSaveRouter(e),Wj=e=>qt.registerLoadRouter(e),Bj=e=>qt.getSaveHandlers(e),Vj=(e,t)=>qt.getLoadHandlers(e,t),AA="tensorflowjs",xA=1,Ui="models_store",_s="model_info_store";function p4(){if(!se().getBool("IS_BROWSER"))throw new Error("Failed to obtain IndexedDB factory because the current environmentis not a web browser.");let e=typeof window=="undefined"?self:window,t=e.indexedDB||e.mozIndexedDB||e.webkitIndexedDB||e.msIndexedDB||e.shimIndexedDB;if(t==null)throw new Error("The current browser does not appear to support IndexedDB.");return t}function bA(e){let t=e.result;t.createObjectStore(Ui,{keyPath:"modelPath"}),t.createObjectStore(_s,{keyPath:"modelPath"})}var ji=class{constructor(e){if(this.indexedDB=p4(),e==null||!e)throw new Error("For IndexedDB, modelPath must not be null, undefined or empty.");this.modelPath=e}async save(e){if(e.modelTopology instanceof ArrayBuffer)throw new Error("BrowserLocalStorage.save() does not support saving model topology in binary formats yet.");return this.databaseAction(this.modelPath,e)}async load(){return this.databaseAction(this.modelPath)}databaseAction(e,t){return new Promise((n,a)=>{let r=this.indexedDB.open(AA,xA);r.onupgradeneeded=()=>bA(r),r.onsuccess=()=>{let s=r.result;if(t==null){let i=s.transaction(Ui,"readonly"),o=i.objectStore(Ui).get(this.modelPath);o.onsuccess=()=>{if(o.result==null)return s.close(),a(new Error(`Cannot find model with path '${this.modelPath}' in IndexedDB.`));n(o.result.modelArtifacts)},o.onerror=l=>(s.close(),a(o.error)),i.oncomplete=()=>s.close()}else{let i=wh(t),o=s.transaction(_s,"readwrite"),l=o.objectStore(_s),u=l.put({modelPath:this.modelPath,modelArtifactsInfo:i}),d;u.onsuccess=()=>{d=s.transaction(Ui,"readwrite");let h=d.objectStore(Ui).put({modelPath:this.modelPath,modelArtifacts:t,modelArtifactsInfo:i});h.onsuccess=()=>n({modelArtifactsInfo:i}),h.onerror=p=>{l=o.objectStore(_s);let c=l.delete(this.modelPath);c.onsuccess=()=>(s.close(),a(h.error)),c.onerror=m=>(s.close(),a(h.error))}},u.onerror=h=>(s.close(),a(u.error)),o.oncomplete=()=>{d==null?s.close():d.oncomplete=()=>s.close()}}},r.onerror=s=>a(r.error)})}};ji.URL_SCHEME="indexeddb://";var c4=e=>se().getBool("IS_BROWSER")&&!Array.isArray(e)&&e.startsWith(ji.URL_SCHEME)?Uj(e.slice(ji.URL_SCHEME.length)):null;qt.registerSaveRouter(c4);qt.registerLoadRouter(c4);function Uj(e){return new ji(e)}function jj(e){return e.startsWith(ji.URL_SCHEME)?e.slice(ji.URL_SCHEME.length):e}var Hj=class{constructor(){this.indexedDB=p4()}async listModels(){return new Promise((e,t)=>{let n=this.indexedDB.open(AA,xA);n.onupgradeneeded=()=>bA(n),n.onsuccess=()=>{let a=n.result,r=a.transaction(_s,"readonly"),s=r.objectStore(_s).getAll();s.onsuccess=()=>{let i={};for(let o of s.result)i[o.modelPath]=o.modelArtifactsInfo;e(i)},s.onerror=i=>(a.close(),t(s.error)),r.oncomplete=()=>a.close()},n.onerror=a=>t(n.error)})}async removeModel(e){return e=jj(e),new Promise((t,n)=>{let a=this.indexedDB.open(AA,xA);a.onupgradeneeded=()=>bA(a),a.onsuccess=()=>{let r=a.result,s=r.transaction(_s,"readwrite"),i=s.objectStore(_s),o=i.get(e),l;o.onsuccess=()=>{if(o.result==null)return r.close(),n(new Error(`Cannot find model with path '${e}' in IndexedDB.`));{let u=i.delete(e),d=()=>{l=r.transaction(Ui,"readwrite");let h=l.objectStore(Ui).delete(e);h.onsuccess=()=>t(o.result.modelArtifactsInfo),h.onerror=p=>n(o.error)};u.onsuccess=d,u.onerror=h=>(d(),r.close(),n(o.error))}},o.onerror=u=>(r.close(),n(o.error)),s.oncomplete=()=>{l==null?r.close():l.oncomplete=()=>r.close()}},a.onerror=r=>n(a.error)})}},rs="/",Ul="tensorflowjs_models",f4="info",Gj="model_topology",qj="weight_specs",Kj="weight_data",Xj="model_metadata";function m4(e){return{info:[Ul,e,f4].join(rs),topology:[Ul,e,Gj].join(rs),weightSpecs:[Ul,e,qj].join(rs),weightData:[Ul,e,Kj].join(rs),modelMetadata:[Ul,e,Xj].join(rs)}}function Zj(e){let t=e.split(rs);if(t.length<3)throw new Error(`Invalid key format: ${e}`);return t.slice(1,t.length-1).join(rs)}function Yj(e){return e.startsWith(Hi.URL_SCHEME)?e.slice(Hi.URL_SCHEME.length):e}var Hi=class{constructor(e){if(!se().getBool("IS_BROWSER")||typeof window=="undefined"||typeof window.localStorage=="undefined")throw new Error("The current environment does not support local storage.");if(this.LS=window.localStorage,e==null||!e)throw new Error("For local storage, modelPath must not be null, undefined or empty.");this.modelPath=e,this.keys=m4(this.modelPath)}async save(e){if(e.modelTopology instanceof ArrayBuffer)throw new Error("BrowserLocalStorage.save() does not support saving model topology in binary formats yet.");{let t=JSON.stringify(e.modelTopology),n=JSON.stringify(e.weightSpecs),a=wh(e);try{this.LS.setItem(this.keys.info,JSON.stringify(a)),this.LS.setItem(this.keys.topology,t),this.LS.setItem(this.keys.weightSpecs,n),this.LS.setItem(this.keys.weightData,Fj(e.weightData));let r={format:e.format,generatedBy:e.generatedBy,convertedBy:e.convertedBy};return e.signature!=null&&(r.signature=e.signature),e.userDefinedMetadata!=null&&(r.userDefinedMetadata=e.userDefinedMetadata),e.modelInitializer!=null&&(r.modelInitializer=e.modelInitializer),this.LS.setItem(this.keys.modelMetadata,JSON.stringify(r)),{modelArtifactsInfo:a}}catch(r){throw this.LS.removeItem(this.keys.info),this.LS.removeItem(this.keys.topology),this.LS.removeItem(this.keys.weightSpecs),this.LS.removeItem(this.keys.weightData),this.LS.removeItem(this.keys.modelMetadata),new Error(`Failed to save model '${this.modelPath}' to local storage: size quota being exceeded is a possible cause of this failure: modelTopologyBytes=${a.modelTopologyBytes}, weightSpecsBytes=${a.weightSpecsBytes}, weightDataBytes=${a.weightDataBytes}.`)}}}async load(){let e=JSON.parse(this.LS.getItem(this.keys.info));if(e==null)throw new Error(`In local storage, there is no model with name '${this.modelPath}'`);if(e.modelTopologyType!=="JSON")throw new Error("BrowserLocalStorage does not support loading non-JSON model topology yet.");let t={},n=JSON.parse(this.LS.getItem(this.keys.topology));if(n==null)throw new Error(`In local storage, the topology of model '${this.modelPath}' is missing.`);t.modelTopology=n;let a=JSON.parse(this.LS.getItem(this.keys.weightSpecs));if(a==null)throw new Error(`In local storage, the weight specs of model '${this.modelPath}' are missing.`);t.weightSpecs=a;let r=this.LS.getItem(this.keys.modelMetadata);if(r!=null){let i=JSON.parse(r);t.format=i.format,t.generatedBy=i.generatedBy,t.convertedBy=i.convertedBy,i.signature!=null&&(t.signature=i.signature),i.userDefinedMetadata!=null&&(t.userDefinedMetadata=i.userDefinedMetadata),i.modelInitializer!=null&&(t.modelInitializer=i.modelInitializer)}let s=this.LS.getItem(this.keys.weightData);if(s==null)throw new Error(`In local storage, the binary weight values of model '${this.modelPath}' are missing.`);return t.weightData=Oj(s),t}};Hi.URL_SCHEME="localstorage://";var g4=e=>se().getBool("IS_BROWSER")&&!Array.isArray(e)&&e.startsWith(Hi.URL_SCHEME)?Jj(e.slice(Hi.URL_SCHEME.length)):null;qt.registerSaveRouter(g4);qt.registerLoadRouter(g4);function Jj(e){return new Hi(e)}var Qj=class{constructor(){P(se().getBool("IS_BROWSER"),()=>"Current environment is not a web browser"),P(typeof window=="undefined"||typeof window.localStorage!="undefined",()=>"Current browser does not appear to support localStorage"),this.LS=window.localStorage}async listModels(){let e={},t=Ul+rs,n=rs+f4;for(let a=0;a"scheme must not be undefined or null."),e.endsWith(jl)&&(e=e.slice(0,e.indexOf(jl))),P(e.length>0,()=>"scheme must not be an empty string.");let n=Ta.getInstance();P(n.managers[e]==null,()=>`A model store manager is already registered for scheme '${e}'.`),n.managers[e]=t}static getManager(e){let t=this.getInstance().managers[e];if(t==null)throw new Error(`Cannot find model manager for scheme '${e}'`);return t}static getSchemes(){return Object.keys(this.getInstance().managers)}};function bf(e){if(e.indexOf(jl)===-1)throw new Error(`The url string provided does not contain a scheme. Supported schemes are: ${Ta.getSchemes().join(",")}`);return{scheme:e.split(jl)[0],path:e.split(jl)[1]}}async function y4(e,t,n=!1){P(e!==t,()=>`Old path and new path are the same: '${e}'`);let a=qt.getLoadHandlers(e);P(a.length>0,()=>`Copying failed because no load handler is found for source URL ${e}.`),P(a.length<2,()=>`Copying failed because more than one (${a.length}) load handlers for source URL ${e}.`);let r=a[0],s=qt.getSaveHandlers(t);P(s.length>0,()=>`Copying failed because no save handler is found for destination URL ${t}.`),P(s.length<2,()=>`Copying failed because more than one (${a.length}) save handlers for destination URL ${t}.`);let i=s[0],o=bf(e).scheme,l=bf(e).path,u=o===bf(e).scheme,d=await r.load();n&&u&&await Ta.getManager(o).removeModel(l);let h=await i.save(d);return n&&!u&&await Ta.getManager(o).removeModel(l),h.modelArtifactsInfo}async function eH(){let e=Ta.getSchemes(),t={};for(let n of e){let a=await Ta.getManager(n).listModels();for(let r in a){let s=n+jl+r;t[s]=a[r]}}return t}async function tH(e){let t=bf(e);return Ta.getManager(t.scheme).removeModel(t.path)}async function nH(e,t){return y4(e,t,!1)}async function aH(e,t){return y4(e,t,!0)}var rH=class{fetch(e,t){return fetch(e,t)}now(){return performance.now()}encode(e,t){if(t!=="utf-8"&&t!=="utf8")throw new Error(`Browser's encoder only supports utf-8, but got ${t}`);return this.textEncoder==null&&(this.textEncoder=new TextEncoder),this.textEncoder.encode(e)}decode(e,t){return new TextDecoder(t).decode(e)}};if(se().get("IS_BROWSER")){se().setPlatform("browser",new rH);try{Ta.registerManager(Hi.URL_SCHEME,new Qj)}catch(e){}try{Ta.registerManager(ji.URL_SCHEME,new Hj)}catch(e){}}var sH={importFetch:()=>_3()},vA,iH=class{constructor(){this.util=di("util"),this.textEncoder=new this.util.TextEncoder}fetch(e,t){return se().global.fetch!=null?se().global.fetch(e,t):(vA==null&&(vA=sH.importFetch()),vA(e,t))}now(){let e=process.hrtime();return e[0]*1e3+e[1]/1e6}encode(e,t){if(t!=="utf-8"&&t!=="utf8")throw new Error(`Node built-in encoder only supports utf-8, but got ${t}`);return this.textEncoder.encode(e)}decode(e,t){return e.length===0?"":new this.util.TextDecoder(t).decode(e)}};se().get("IS_NODE")&&se().setPlatform("node",new iH);function Pe(e,t="float32",n){return t=t||"float32",g1(e),new Qt(e,t,n)}function oH(e,t){let n=F(e,"x","cast");if(!P6(t))throw new Error(`Failed to cast to unknown dtype ${t}`);if(t==="string"&&n.dtype!=="string"||t!=="string"&&n.dtype==="string")throw new Error("Only strings can be casted to strings");let a={x:n},r={dtype:t};return j.runKernel(el,a,r)}var we=B({cast_:oH});function lH(e){let t={x:F(e,"x","clone","string_or_numeric")};return j.runKernel(pl,t)}var Gi=B({clone_:lH});function uH(e,t=!1){console.log(e.toString(t))}s4();var dH={buffer:Pe,cast:we,clone:Gi,print:uH};bj(dH);var la={};$e(la,{browserFiles:()=>yH,browserHTTPRequest:()=>wH,concatenateArrayBuffers:()=>yA,copyModel:()=>nH,decodeWeights:()=>u4,encodeWeights:()=>$j,fromMemory:()=>IH,getLoadHandlers:()=>Vj,getModelArtifactsInfoForJSON:()=>wh,getSaveHandlers:()=>Bj,http:()=>IA,isHTTPScheme:()=>kA,listModels:()=>eH,loadWeights:()=>AH,moveModel:()=>aH,registerLoadRouter:()=>Wj,registerSaveRouter:()=>Lj,removeModel:()=>tH,weightsLoaderFactory:()=>v4,withSaveHandler:()=>SH});var hH="model",pH=".json",cH=".weights.bin";function A4(e){return new Promise(t=>setTimeout(t)).then(e)}var Hl=class{constructor(e){if(!se().getBool("IS_BROWSER"))throw new Error("browserDownloads() cannot proceed because the current environment is not a browser.");e.startsWith(Hl.URL_SCHEME)&&(e=e.slice(Hl.URL_SCHEME.length)),(e==null||e.length===0)&&(e=hH),this.modelTopologyFileName=e+pH,this.weightDataFileName=e+cH}async save(e){if(typeof document=="undefined")throw new Error("Browser downloads are not supported in this environment since `document` is not present");let t=window.URL.createObjectURL(new Blob([e.weightData],{type:"application/octet-stream"}));if(e.modelTopology instanceof ArrayBuffer)throw new Error("BrowserDownloads.save() does not support saving model topology in binary formats yet.");{let n=[{paths:["./"+this.weightDataFileName],weights:e.weightSpecs}],a={modelTopology:e.modelTopology,format:e.format,generatedBy:e.generatedBy,convertedBy:e.convertedBy,weightsManifest:n};e.signature!=null&&(a.signature=e.signature),e.userDefinedMetadata!=null&&(a.userDefinedMetadata=e.userDefinedMetadata),e.modelInitializer!=null&&(a.modelInitializer=e.modelInitializer);let r=window.URL.createObjectURL(new Blob([JSON.stringify(a)],{type:"application/json"})),s=this.jsonAnchor==null?document.createElement("a"):this.jsonAnchor;if(s.download=this.modelTopologyFileName,s.href=r,await A4(()=>s.dispatchEvent(new MouseEvent("click"))),e.weightData!=null){let i=this.weightDataAnchor==null?document.createElement("a"):this.weightDataAnchor;i.download=this.weightDataFileName,i.href=t,await A4(()=>i.dispatchEvent(new MouseEvent("click")))}return{modelArtifactsInfo:wh(e)}}}};Hl.URL_SCHEME="downloads://";var fH=class{constructor(e){if(e==null||e.length<1)throw new Error(`When calling browserFiles, at least 1 file is required, but received ${e}`);this.files=e}async load(){let e=this.files[0],t=this.files.slice(1);return new Promise((n,a)=>{let r=new FileReader;r.onload=s=>{let i=JSON.parse(s.target.result),o=i.modelTopology;if(o==null){a(new Error(`modelTopology field is missing from file ${e.name}`));return}t.length===0&&n({modelTopology:o});let l=i.weightsManifest;if(l==null){a(new Error(`weightManifest field is missing from file ${e.name}`));return}let u;try{u=this.checkManifestAndWeightFiles(l,t)}catch(c){a(c);return}let d=[],h=[],p=[];l.forEach(c=>{c.paths.forEach(m=>{h.push(m),p.push(null)}),d.push(...c.weights)}),l.forEach(c=>{c.paths.forEach(m=>{let f=new FileReader;f.onload=g=>{let y=g.target.result,A=h.indexOf(m);if(p[A]=y,p.indexOf(null)===-1){let x={modelTopology:o,weightSpecs:d,weightData:yA(p),format:i.format,generatedBy:i.generatedBy,convertedBy:i.convertedBy};i.signature!=null&&(x.signature=i.signature),i.userDefinedMetadata!=null&&(x.userDefinedMetadata=i.userDefinedMetadata),i.modelInitializer!=null&&(x.modelInitializer=i.modelInitializer),n(x)}},f.onerror=g=>a(`Failed to weights data from file of path '${m}'.`),f.readAsArrayBuffer(u[m])})})},r.onerror=s=>a(`Failed to read model topology and weights manifest JSON from file '${e.name}'. BrowserFiles supports loading Keras-style tf.Model artifacts only.`),r.readAsText(e)})}checkManifestAndWeightFiles(e,t){let n=[],a=t.map(s=>h4(s.name)),r={};for(let s of e)s.paths.forEach(i=>{let o=h4(i);if(n.indexOf(o)!==-1)throw new Error(`Duplicate file basename found in weights manifest: '${o}'`);if(n.push(o),a.indexOf(o)===-1)throw new Error(`Weight file with basename '${o}' is not provided.`);r[i]=t[a.indexOf(o)]});if(n.length!==t.length)throw new Error(`Mismatch in the number of files in weights manifest (${n.length}) and the number of weight files provided (${t.length}).`);return r}},mH=e=>se().getBool("IS_BROWSER")&&!Array.isArray(e)&&e.startsWith(Hl.URL_SCHEME)?gH(e.slice(Hl.URL_SCHEME.length)):null;qt.registerSaveRouter(mH);function gH(e="model"){return new Hl(e)}function yH(e){return new fH(e)}function x4(e,t,n,a){i(e),n=n==null?0:n,a=a==null?1:a,o(n,a);let r=0,s=l=>(l.then(u=>{let d=n+ ++r/e.length*(a-n);return t(d),u}),l);function i(l){P(l!=null&&Array.isArray(l)&&l.length>0,()=>"promises must be a none empty array")}function o(l,u){P(l>=0&&l<=1,()=>`Progress fraction must be in range [0, 1], but got startFraction ${l}`),P(u>=0&&u<=1,()=>`Progress fraction must be in range [0, 1], but got endFraction ${u}`),P(u>=l,()=>`startFraction must be no more than endFraction, but got startFraction ${l} and endFraction ${u}`)}return Promise.all(e.map(s))}async function b4(e,t){t==null&&(t={});let n=t.fetchFunc==null?se().platform.fetch:t.fetchFunc,a=e.map(u=>n(u,t.requestInit,{isBinary:!0})),r=0,s=.5,i=(t.onProgress==null?await Promise.all(a):await x4(a,t.onProgress,r,s)).map(u=>u.arrayBuffer()),o=.5,l=1;return t.onProgress==null?await Promise.all(i):await x4(i,t.onProgress,o,l)}async function AH(e,t="",n,a){return v4(r=>b4(r,{requestInit:a}))(e,t,n)}function v4(e){return async(t,n="",a)=>{let r=t.map(()=>!1),s={},i=a!=null?a.map(()=>!1):[],o=[];if(t.forEach((c,m)=>{let f=0;c.weights.forEach(g=>{let y="quantization"in g?g.quantization.dtype:g.dtype,A=mA[y]*on(g.shape),x=()=>{r[m]=!0,s[m]==null&&(s[m]=[]),s[m].push({manifestEntry:g,groupOffset:f,sizeBytes:A})};a!=null?a.forEach((v,b)=>{v===g.name&&(x(),i[b]=!0)}):x(),o.push(g.name),f+=A})}),!i.every(c=>c)){let c=a.filter((m,f)=>!i[f]);throw new Error(`Could not find weights in manifest with names: ${c.join(", ")}. -Manifest JSON has weights with names: ${o.join(", ")}.`)}let l=r.reduce((c,m,f)=>(m&&c.push(f),c),[]),u=[];l.forEach(c=>{t[c].paths.forEach(m=>{let f=n+(n.endsWith("/")?"":"/")+m;u.push(f)})});let d=await e(u),h={},p=0;return l.forEach(c=>{let m=t[c].paths.length,f=0;for(let x=0;x{let v=g.slice(x.groupOffset,x.groupOffset+x.sizeBytes),b=u4(v,[x.manifestEntry]);for(let w in b)h[w]=b[w]}),p+=m}),h}}var xH="application/octet-stream",bH="application/json",wA=class{constructor(e,t){if(this.DEFAULT_METHOD="POST",t==null&&(t={}),this.weightPathPrefix=t.weightPathPrefix,this.onProgress=t.onProgress,this.weightUrlConverter=t.weightUrlConverter,t.fetchFunc!=null?(P(typeof t.fetchFunc=="function",()=>"Must pass a function that matches the signature of `fetch` (see https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API)"),this.fetch=t.fetchFunc):this.fetch=se().platform.fetch,P(e!=null&&e.length>0,()=>"URL path for http must not be null, undefined or empty."),Array.isArray(e)&&P(e.length===2,()=>`URL paths for http must have a length of 2, (actual length is ${e.length}).`),this.path=e,t.requestInit!=null&&t.requestInit.body!=null)throw new Error("requestInit is expected to have no pre-existing body, but has one.");this.requestInit=t.requestInit||{}}async save(e){if(e.modelTopology instanceof ArrayBuffer)throw new Error("BrowserHTTPRequest.save() does not support saving model topology in binary formats yet.");let t=Object.assign({method:this.DEFAULT_METHOD},this.requestInit);t.body=new FormData;let n=[{paths:["./model.weights.bin"],weights:e.weightSpecs}],a={modelTopology:e.modelTopology,format:e.format,generatedBy:e.generatedBy,convertedBy:e.convertedBy,weightsManifest:n};e.signature!=null&&(a.signature=e.signature),e.userDefinedMetadata!=null&&(a.userDefinedMetadata=e.userDefinedMetadata),e.modelInitializer!=null&&(a.modelInitializer=e.modelInitializer),t.body.append("model.json",new Blob([JSON.stringify(a)],{type:bH}),"model.json"),e.weightData!=null&&t.body.append("model.weights.bin",new Blob([e.weightData],{type:xH}),"model.weights.bin");let r=await this.fetch(this.path,t);if(r.ok)return{modelArtifactsInfo:wh(e),responses:[r]};throw new Error(`BrowserHTTPRequest.save() failed due to HTTP response status ${r.status}.`)}async load(){let e=await this.fetch(this.path,this.requestInit);if(!e.ok)throw new Error(`Request to ${this.path} failed with status code ${e.status}. Please verify this URL points to the model JSON of the model to load.`);let t;try{t=await e.json()}catch(c){let m=`Failed to parse model JSON of response from ${this.path}.`;throw this.path.endsWith(".pb")?m+=" Your path contains a .pb file extension. Support for .pb models have been removed in TensorFlow.js 1.0 in favor of .json models. You can re-convert your Python TensorFlow model using the TensorFlow.js 1.0 conversion scripts or you can convert your.pb models with the 'pb2json'NPM script in the tensorflow/tfjs-converter repository.":m+=" Please make sure the server is serving valid JSON for this request.",new Error(m)}let n=t.modelTopology,a=t.weightsManifest,r=t.generatedBy,s=t.convertedBy,i=t.format,o=t.signature,l=t.userDefinedMetadata;if(n==null&&a==null)throw new Error(`The JSON from HTTP path ${this.path} contains neither model topology or manifest for weights.`);let u,d;a!=null&&([u,d]=await this.loadWeights(a));let h={modelTopology:n,weightSpecs:u,weightData:d,generatedBy:r,convertedBy:s,format:i};o!=null&&(h.signature=o),l!=null&&(h.userDefinedMetadata=l);let p=t.modelInitializer;return p&&(h.modelInitializer=p),h}async loadWeights(e){let t=Array.isArray(this.path)?this.path[1]:this.path,[n,a]=vH(t),r=this.weightPathPrefix||n,s=[];for(let u of e)s.push(...u.weights);let i=[],o=[];for(let u of e)for(let d of u.paths)this.weightUrlConverter!=null?o.push(this.weightUrlConverter(d)):i.push(r+d+a);this.weightUrlConverter&&i.push(...await Promise.all(o));let l=await b4(i,{requestInit:this.requestInit,fetchFunc:this.fetch,onProgress:this.onProgress});return[s,yA(l)]}};wA.URL_SCHEME_REGEX=/^https?:\/\//;function vH(e){let t=e.lastIndexOf("/"),n=e.lastIndexOf("?"),a=e.substring(0,t),r=n>t?e.substring(n):"";return[a+"/",r]}function kA(e){return e.match(wA.URL_SCHEME_REGEX)!=null}var w4=(e,t)=>{if(typeof fetch=="undefined"&&(t==null||t.fetchFunc==null))return null;{let n=!0;if(Array.isArray(e)?n=e.every(a=>kA(a)):n=kA(e),n)return IA(e,t)}return null};qt.registerSaveRouter(w4);qt.registerLoadRouter(w4);function IA(e,t){return new wA(e,t)}function wH(e,t){return IA(e,t)}var SA=class{constructor(e){this.modelArtifacts=e}async load(){return this.modelArtifacts}},kH=class{constructor(e){this.saveHandler=e}async save(e){return this.saveHandler(e)}};function IH(e,t,n,a){return arguments.length===1?e.modelTopology!=null||e.weightSpecs!=null?new SA(e):(console.warn("Please call tf.io.fromMemory() with only one argument. The argument should be of type ModelArtifacts. The multi-argument signature of tf.io.fromMemory() has been deprecated and will be removed in a future release."),new SA({modelTopology:e})):(console.warn("Please call tf.io.fromMemory() with only one argument. The argument should be of type ModelArtifacts. The multi-argument signature of tf.io.fromMemory() has been deprecated and will be removed in a future release."),new SA({modelTopology:e,weightSpecs:t,weightData:n,trainingConfig:a}))}function SH(e){return new kH(e)}function NH(e,t,n=!1,a=!1){let r=F(e,"a","matMul"),s=F(t,"b","matMul");[r,s]=Ut(r,s);let i={a:r,b:s},o={transposeA:n,transposeB:a};return j.runKernel(Qo,i,o)}var it=B({matMul_:NH});function TH(e,t,n=1,a=0){if(t<2)throw new Error(`Error in oneHot: depth must be >=2, but it is ${t}`);let r={indices:F(e,"indices","oneHot","int32")},s={depth:t,onValue:n,offValue:a};return j.runKernel(wl,r,s)}var kh=B({oneHot_:TH});function EH(e,t){let n=F(e,"x","transpose");if(t==null&&(t=n.shape.map((s,i)=>i).reverse()),P(n.rank===t.length,()=>`Error in transpose: rank of input ${n.rank} must match length of perm ${t}.`),t.forEach(s=>{P(s>=0&&s`All entries in 'perm' must be between 0 and ${n.rank-1} but got ${t}`)}),n.rank<=1)return n.clone();let a={x:n},r={perm:t};return j.runKernel(Pl,a,r)}var ct=B({transpose_:EH});function CH(e,t,n){let a=F(e,"labels","confusionMatrix"),r=F(t,"predictions","confusionMatrix");P(n==null||n>0&&Number.isInteger(n),()=>`If provided, numClasses must be a positive integer, but got ${n}`),P(a.rank===1,()=>`Expected the rank of labels to be 1, but got ${a.rank}`),P(r.rank===1,()=>`Expected the rank of predictions to be 1, but got ${r.rank}`),P(a.shape[0]===r.shape[0],()=>`Mismatch in the number of examples: ${a.shape[0]} vs. ${r.shape[0]}. Labels and predictions should have the same number of elements.`),P(n>0&&Number.isInteger(n),()=>`numClasses is required to be a positive integer, but got ${n}`);let s=kh(we(a,"int32"),n),i=kh(we(r,"int32"),n),o=ct(s),l=it(o,i);return we(l,"int32")}var mwe=B({confusionMatrix_:CH}),k4={};$e(k4,{fromPixels:()=>zH,fromPixelsAsync:()=>DH,toPixels:()=>_H});function MH(e,t,n){if(Bc(e),t!=null&&t.length!==3)throw new Error("tensor3d() requires shape to have three numbers");let a=bh(e,n);if(a.length!==3&&a.length!==1)throw new Error("tensor3d() requires values to be number[][][] or flat/TypedArray");if(a.length===1&&t==null)throw new Error("tensor3d() requires shape to be provided when `values` are a flat array");return vh(e,t,a,n)}var Gl;function I4(e,t=3){if(t>4)throw new Error("Cannot construct Tensor with more than 4 channels from pixels.");if(e==null)throw new Error("pixels passed to tf.browser.fromPixels() can not be null");let n=!1,a=!1,r=!1,s=!1,i=!1,o=!1;if(e.data instanceof Uint8Array)n=!0;else if(typeof ImageData!="undefined"&&e instanceof ImageData)a=!0;else if(typeof HTMLVideoElement!="undefined"&&e instanceof HTMLVideoElement)r=!0;else if(typeof HTMLImageElement!="undefined"&&e instanceof HTMLImageElement)s=!0;else if(e.getContext!=null)i=!0;else if(typeof ImageBitmap!="undefined"&&e instanceof ImageBitmap)o=!0;else throw new Error(`pixels passed to tf.browser.fromPixels() must be either an HTMLVideoElement, HTMLImageElement, HTMLCanvasElement, ImageData in browser, or OffscreenCanvas, ImageData in webworker or {data: Uint32Array, width: number, height: number}, but was ${e.constructor.name}`);if(r){let p=2;if(r&&e.readyState element.")}if(rA(nA,j.backendName)!=null){let p={pixels:e},c={numChannels:t};return j.runKernel(nA,p,c)}let[l,u]=r?[e.videoWidth,e.videoHeight]:[e.width,e.height],d;i?d=e.getContext("2d").getImageData(0,0,l,u).data:a||n?d=e.data:(s||r||o)&&(Gl==null&&(Gl=document.createElement("canvas").getContext("2d")),Gl.canvas.width=l,Gl.canvas.height=u,Gl.drawImage(e,0,0,l,u),d=Gl.getImageData(0,0,l,u).data);let h;if(t===4)h=new Int32Array(d);else{let p=l*u;h=new Int32Array(p*t);for(let c=0;c4||s===2)throw new Error(`toPixels only supports depth of size 1, 3 or 4 but got ${s}`);if(n.dtype!=="float32"&&n.dtype!=="int32")throw new Error(`Unsupported type for toPixels: ${n.dtype}. Please use float32 or int32 tensors.`);let i=await n.data(),o=n.dtype==="float32"?255:1,l=new Uint8ClampedArray(r*a*4);for(let u=0;u1)throw new Error(`Tensor values for a float32 Tensor must be in the range [0 - 1] but encountered ${c}.`)}else if(n.dtype==="int32"&&(c<0||c>255))throw new Error(`Tensor values for a int32 Tensor must be in the range [0 - 255] but encountered ${c}.`);s===1?(d[0]=c*o,d[1]=c*o,d[2]=c*o):d[p]=c*o}let h=u*4;l[h+0]=Math.round(d[0]),l[h+1]=Math.round(d[1]),l[h+2]=Math.round(d[2]),l[h+3]=Math.round(d[3])}if(t!=null){t.width=r,t.height=a;let u=t.getContext("2d"),d=new ImageData(l,r,a);u.putImageData(d,0,0)}return n!==e&&n.dispose(),l}var zH=B({fromPixels_:I4}),S4={};$e(S4,{prepareAndValidate:()=>N4});function N4(e,t){let n=e.shape.length,a=t.shape.length;if(n<1)throw new Error(`tf.gatherND() expects the input to be rank 1 or higher, but the rank was ${n}.`);if(a<1)throw new Error(`tf.gatherND() expects the indices to be rank 1 or higher, but the rank was ${a}.`);if(t.dtype!=="int32")throw new Error(`tf.gatherND() expects the indices to be int32 type, but the dtype was ${t.dtype}.`);if(t.shape[a-1]>n)throw new Error(`index innermost dimension length must be <= tensor rank; saw: ${t.shape[a-1]} vs. ${n}`);if(on(e.shape)===0)throw new Error(`Requested more than 0 entries, but input is empty. Input shape: ${e.shape}.`);let r=t.shape,s=r[r.length-1],i=1;for(let h=0;hh/u),1].slice(0,s);return[l,i,u,d]}var T4={};$e(T4,{calculateShapes:()=>E4,validateInput:()=>TA,validateUpdateShape:()=>NA});function NA(e,t,n){let a=t.rank>1?t.shape[t.rank-1]:1,r=t.rank>1?t.rank-1:1,s=`Must have updates.shape = indices.shape[:batchDim] + shape[sliceDim:], got updates.shape: ${n.shape}, indices.shape: ${t.shape}, shape: ${e}, sliceDim: ${a}, and batchDim: ${r}.`;if(n.rank1?t.shape[a-1]:1,s=n.length,i=1;for(let h=r;hPH,computeFlatOffset:()=>WH,computeOutShape:()=>C4,getNormalizedAxes:()=>F4,isSliceContinous:()=>LH,maskToAxes:()=>vf,parseSliceParams:()=>L4,sliceInfo:()=>BH,startForAxis:()=>z4,startIndicesWithElidedDims:()=>O4,stopForAxis:()=>P4,stopIndicesWithElidedDims:()=>D4,stridesForAxis:()=>_4,stridesWithElidedDims:()=>M4});function PH(e,t,n){let a=e.shape.length;P(a===t.length,()=>`Error in slice${a}D: Length of begin ${t} must match the rank of the array (${a}).`),P(a===n.length,()=>`Error in slice${a}D: Length of size ${n} must match the rank of the array (${a}).`);for(let r=0;r`Error in slice${a}D: begin[${r}] + size[${r}] (${t[r]+n[r]}) would overflow input.shape[${r}] (${e.shape[r]})`)}function vf(e){let t=[],n=0;for(;e>0;)e&1&&t.push(n),e/=2,n++;return t}function C4(e,t,n){let a=[];for(let r=0;r0){let c=t[0],m=n+1;d=O4(i,c,m,a,e),h=D4(o,c,m,r,e),p=M4(s,c,m,e)}else for(let c=0;c-1)s[o]=0;else{let l=$4(t,n,o),u=a[l];e&1<-1)s[o]=Number.MAX_SAFE_INTEGER;else{let l=$4(t,n,o),u=a[l];e&1<0?i=Number.MIN_SAFE_INTEGER:i=Number.MAX_SAFE_INTEGER);let l=a[r];return i<0&&(i+=l),i=gd(0,i,l-1),i}function P4(e,t,n,a,r,s){let i=t[r],o=n[r]||1;(e&1<0?i=Number.MAX_SAFE_INTEGER:i=Number.MIN_SAFE_INTEGER);let l=a[r];return i<0&&(i+=l),o>0?i=gd(0,i,l):i=gd(-1,i,l-1),i}function LH(e,t,n){let a=n.length;for(let r=0;r1){a=r;break}for(let r=a+1;r0||n[r]!==e[r])return!1;return!0}function WH(e,t){let n=e.length>0?e[e.length-1]:1;for(let a=0;a{P(i!==-1,()=>"slice() does not support negative begin indexing.")});let s;return n==null?s=new Array(r).fill(-1):typeof n=="number"?s=[n,...new Array(r-1).fill(-1)]:n.lengthi>=0?i:(P(i===-1,()=>`Negative size values should be exactly -1 but got ${i} for the slice() size at index ${o}.`),e.shape[o]-a[o])),[a,s]}function BH(e,t,n,a,r,s,i,o,l){let u=t.slice(),d=n.slice(),h=a;a==null&&(h=new Array(u.length));let p=vf(i);if(p.length>1)throw new Error("Multiple ellipses in slice is not allowed.");if(i!==0&&o!==0)throw new Error("Using both ellipsisMask and newAxisMask is not yet supported.");if(i!==0&&l!==0)throw new Error("Using both ellipsisMask and shrinkAxisMask is not yet supported.");let c=e.length-u.length,m=vf(o),f=e.slice();m.forEach(w=>{u[w]=0,d[w]=1,f.splice(w,0,1)});let{begin:g,end:y,strides:A}=F4(f,p,c,u,d,h,r,s,i);u=g,d=y,h=A;let x=vf(l);x.forEach(w=>{d[w]=u[w]+1,h[w]=1});let v=C4(u,d,h),b=v.filter((w,I)=>x.indexOf(I)===-1);return{nonStrided:h.every(w=>w===1),$begin:u,$end:d,$strides:h,size:v,newShape:f,outShape:b}}var ue={};$e(ue,{Serializable:()=>W4,SerializationMap:()=>qi,registerClass:()=>zs});var W4=class{getClassName(){return this.constructor.className}static fromConfig(e,t){return new e(t)}},qi=class{constructor(){this.classNameMap={}}static getMap(){return qi.instance==null&&(qi.instance=new qi),qi.instance}static register(e){qi.getMap().classNameMap[e.className]=[e,e.fromConfig]}};function zs(e){P(e.className!=null,()=>"Class being registered does not have the static className property defined."),P(typeof e.className=="string",()=>"className is required to be a string, but got type "+typeof e.className),P(e.className.length>0,()=>"Class being registered has an empty-string as its className, which is disallowed."),qi.register(e)}function B4(e){se().getBool("DEPRECATION_WARNINGS_ENABLED")&&console.warn(e+" You can disable deprecation warnings with tf.disableDeprecationWarnings().")}vj(B4);function Ps(){return j}function EA(){return j.memory()}function Z(e,t){return j.tidy(e,t)}function Ge(e){cA(e).forEach(t=>t.dispose())}function Sn(e){return j.keep(e)}function CA(e,t,n=1){return j.registerBackend(e,t,n)}function VH(){return j.backend}function UH(e,t){let n=F(e,"a","add"),a=F(t,"b","add");[n,a]=Ut(n,a);let r={a:n,b:a};return j.runKernel(Os,r)}var pe=B({add_:UH});function jH(e,t){let n=F(e,"a","floorDiv"),a=F(t,"b","floorDiv");[n,a]=Ut(n,a);let r={a:n,b:a};return j.runKernel(ul,r)}var MA=B({floorDiv_:jH});function HH(e,t){let n=F(e,"a","div"),a=F(t,"b","div");if([n,a]=Ut(n,a),n.dtype==="int32"&&a.dtype==="int32")return MA(n,a);let r={a:n,b:a},s={};return j.runKernel(il,r,s)}var Me=B({div_:HH});function GH(e,t){let n=F(e,"a","mul"),a=F(t,"b","mul");[n,a]=Ut(n,a);let r={a:n,b:a};return j.runKernel(Oi,r)}var K=B({mul_:GH});function qH(e){let t=F(e,"x","abs");if(t.dtype==="complex64"){let n={x:t};return j.runKernel(Zc,n)}else{let n={x:t};return j.runKernel(xd,n)}}var yn=B({abs_:qH});function KH(e){let t={x:F(e,"x","acos")};return j.runKernel(bd,t)}var V4=B({acos_:KH});function XH(e){let t={x:F(e,"x","acosh")};return j.runKernel(vd,t)}var U4=B({acosh_:XH});function ZH(e){P(Array.isArray(e),()=>"The argument passed to tf.addN() must be a list of tensors"),P(e.length>=1,()=>`Must pass at least one tensor to tf.addN(), but got ${e.length}`);let t=e.map((r,s)=>F(r,`tensors${s}`,"addN")),n=t[0];t.forEach(r=>{if(r.dtype!==n.dtype)throw new Error("All tensors passed to tf.addN() must have the same dtype")}),t.forEach(r=>{if(!Fs(r.shape,n.shape))throw new Error("All tensors passed to tf.addN() must have the same shape")});let a=t;return j.runKernel(Zo,a)}var YH=B({addN_:ZH});function JH(e,t=null,n=!1){let a={x:F(e,"x","all","bool")},r={axis:t,keepDims:n};return j.runKernel(wd,a,r)}var $A=B({all_:JH});function QH(e,t=null,n=!1){let a={x:F(e,"x","any","bool")},r={axis:t,keepDims:n};return j.runKernel(kd,a,r)}var wf=B({any_:QH});function eG(e,t=0){let n={x:F(e,"x","argMax")},a={axis:t};return j.runKernel(Yo,n,a)}var kf=B({argMax_:eG});function tG(e,t=0){let n={x:F(e,"x","argMin")},a={axis:t};return j.runKernel(qc,n,a)}var j4=B({argMin_:tG});function nG(e){let t={x:F(e,"x","asin")};return j.runKernel(Id,t)}var H4=B({asin_:nG});function aG(e){let t={x:F(e,"x","asinh")};return j.runKernel(Sd,t)}var G4=B({asinh_:aG});function rG(e){let t={x:F(e,"x","atan")};return j.runKernel(Nd,t)}var q4=B({atan_:rG});function sG(e,t){let n=F(e,"a","atan2"),a=F(t,"b","atan2");[n,a]=Ut(n,a);let r={a:n,b:a};return j.runKernel(Ed,r)}var K4=B({atan2_:sG});function iG(e){let t={x:F(e,"x","atanh")};return j.runKernel(Td,t)}var X4=B({atanh_:iG});function oG(e,t,n,a,r="NHWC",s){let i=e[3],o=[...t,i],l=J4(r);return Ih(e,o,n,s,a,null,null,l)}function Z4(e,t,n,a,r,s,i="channelsLast"){let[o,l]=If(t),u;if(i==="channelsLast")u=[o,l,e[3],e[3]];else if(i==="channelsFirst")u=[o,l,e[1],e[1]];else throw new Error(`Unknown dataFormat ${i}`);return Ih(e,u,n,a,r,s,!1,i)}function lG(e,t,n,a,r,s,i="NDHWC"){let[o,l,u]=FA(t),d,h;if(i==="NDHWC")h="channelsLast",d=[o,l,u,e[4],e[4]];else if(i==="NCDHW")h="channelsFirst",d=[o,l,u,e[1],e[1]];else throw new Error(`Unknown dataFormat ${i}`);return Y4(e,d,n,a,r,!1,h,s)}function Ih(e,t,n,a,r,s,i=!1,o="channelsLast"){let[l,u,d,h]=[-1,-1,-1,-1];if(o==="channelsLast")[l,u,d,h]=e;else if(o==="channelsFirst")[l,h,u,d]=e;else throw new Error(`Unknown dataFormat ${o}`);let[p,c,,m]=t,[f,g]=If(n),[y,A]=If(a),x=ql(p,y),v=ql(c,A),{padInfo:b,outHeight:w,outWidth:I}=hG(r,u,d,f,g,x,v,s,o),T=i?m*h:m,C;return o==="channelsFirst"?C=[l,T,w,I]:o==="channelsLast"&&(C=[l,w,I,T]),{batchSize:l,dataFormat:o,inHeight:u,inWidth:d,inChannels:h,outHeight:w,outWidth:I,outChannels:T,padInfo:b,strideHeight:f,strideWidth:g,filterHeight:p,filterWidth:c,effectiveFilterHeight:x,effectiveFilterWidth:v,dilationHeight:y,dilationWidth:A,inShape:e,outShape:C,filterShape:t}}function Y4(e,t,n,a,r,s=!1,i="channelsLast",o){let[l,u,d,h,p]=[-1,-1,-1,-1,-1];if(i==="channelsLast")[l,u,d,h,p]=e;else if(i==="channelsFirst")[l,p,u,d,h]=e;else throw new Error(`Unknown dataFormat ${i}`);let[c,m,f,,g]=t,[y,A,x]=FA(n),[v,b,w]=FA(a),I=ql(c,v),T=ql(m,b),C=ql(f,w),{padInfo:z,outDepth:$,outHeight:S,outWidth:D}=pG(r,u,d,h,y,A,x,I,T,C,o),_=s?g*p:g,W;return i==="channelsFirst"?W=[l,_,$,S,D]:i==="channelsLast"&&(W=[l,$,S,D,_]),{batchSize:l,dataFormat:i,inDepth:u,inHeight:d,inWidth:h,inChannels:p,outDepth:$,outHeight:S,outWidth:D,outChannels:_,padInfo:z,strideDepth:y,strideHeight:A,strideWidth:x,filterDepth:c,filterHeight:m,filterWidth:f,effectiveFilterDepth:I,effectiveFilterHeight:T,effectiveFilterWidth:C,dilationDepth:v,dilationHeight:b,dilationWidth:w,inShape:e,outShape:W,filterShape:t}}function uG(e,t,n,a,r){a==null&&(a=RA(e,t,n));let s=e[0],i=e[1],o=Ki((s-t+2*a)/n+1,r),l=Ki((i-t+2*a)/n+1,r);return[o,l]}function dG(e,t,n,a,r,s){r==null&&(r=RA(e,t,a));let i=e[0],o=e[1],l=e[2],u=Ki((i-t+2*r)/a+1,s),d=Ki((o-t+2*r)/a+1,s),h=Ki((l-t+2*r)/a+1,s);return[u,d,h,n]}function RA(e,t,n,a=1){let r=ql(t,a);return Math.floor((e[0]*(n-1)-n+r)/2)}function If(e){return typeof e=="number"?[e,e,e]:e.length===2?[e[0],e[1],1]:e}function FA(e){return typeof e=="number"?[e,e,e]:e}function ql(e,t){return t<=1?e:e+(e-1)*(t-1)}function hG(e,t,n,a,r,s,i,o,l){let u,d,h;if(typeof e=="number"){u={top:e,bottom:e,left:e,right:e,type:e===0?"VALID":"NUMBER"};let p=uG([t,n],s,a,e,o);d=p[0],h=p[1]}else if(e==="same"){d=Math.ceil(t/a),h=Math.ceil(n/r);let p=Math.max(0,(d-1)*a+s-t),c=Math.max(0,(h-1)*r+i-n),m=Math.floor(p/2),f=p-m,g=Math.floor(c/2),y=c-g;u={top:m,bottom:f,left:g,right:y,type:"SAME"}}else if(e==="valid")u={top:0,bottom:0,left:0,right:0,type:"VALID"},d=Math.ceil((t-s+1)/a),h=Math.ceil((n-i+1)/r);else if(typeof e=="object"){let p=l==="channelsLast"?e[1][0]:e[2][0],c=l==="channelsLast"?e[1][1]:e[2][1],m=l==="channelsLast"?e[2][0]:e[3][0],f=l==="channelsLast"?e[2][1]:e[3][1];u={top:p,bottom:c,left:m,right:f,type:p===0&&c===0&&m===0&&f===0?"VALID":"EXPLICIT"},d=Ki((t-s+p+c)/a+1,o),h=Ki((n-i+m+f)/r+1,o)}else throw Error(`Unknown padding parameter: ${e}`);return{padInfo:u,outHeight:d,outWidth:h}}function pG(e,t,n,a,r,s,i,o,l,u,d){let h,p,c,m;if(typeof e=="number"){h={top:e,bottom:e,left:e,right:e,front:e,back:e,type:e===0?"VALID":"NUMBER"};let f=dG([t,n,a,1],o,1,r,e,d);p=f[0],c=f[1],m=f[2]}else if(e==="same"){p=Math.ceil(t/r),c=Math.ceil(n/s),m=Math.ceil(a/i);let f=(p-1)*r+o-t,g=(c-1)*s+l-n,y=(m-1)*i+u-a,A=Math.floor(f/2),x=f-A,v=Math.floor(g/2),b=g-v,w=Math.floor(y/2),I=y-w;h={top:v,bottom:b,left:w,right:I,front:A,back:x,type:"SAME"}}else if(e==="valid")h={top:0,bottom:0,left:0,right:0,front:0,back:0,type:"VALID"},p=Math.ceil((t-o+1)/r),c=Math.ceil((n-l+1)/s),m=Math.ceil((a-u+1)/i);else throw Error(`Unknown padding parameter: ${e}`);return{padInfo:h,outDepth:p,outHeight:c,outWidth:m}}function Ki(e,t){if(!t)return Math.trunc(e);switch(t){case"round":return Math.round(e);case"ceil":return Math.ceil(e);case"floor":return Math.floor(e);default:throw new Error(`Unknown roundingMode ${t}`)}}function Ls(e){let[t,n,a]=If(e);return t===1&&n===1&&a===1}function Mr(e,t){return Ls(e)||Ls(t)}function J4(e){if(e==="NHWC")return"channelsLast";if(e==="NCHW")return"channelsFirst";throw new Error(`Unknown dataFormat ${e}`)}function cG(e,t){let n={x:F(e,"x","reshape","string_or_numeric")},a={shape:t};return j.runKernel(Qd,n,a)}var Y=B({reshape_:cG});function fG(e,t,n,a,r){let s=F(e,"x","avgPool","float32"),i=1;P(Mr(n,i),()=>`Error in avgPool: Either strides or dilations must be 1. Got strides ${n} and dilations '${i}'`);let o=s,l=!1;s.rank===3&&(l=!0,o=Y(s,[1,s.shape[0],s.shape[1],s.shape[2]])),P(o.rank===4,()=>`Error in avgPool: x must be rank 4 but got rank ${o.rank}.`),r!=null&&P(mn(a),()=>`Error in avgPool: pad must be an integer when using, dimRoundingMode ${r} but got pad ${a}.`);let u={x:o},d={filterSize:t,strides:n,pad:a,dimRoundingMode:r},h=j.runKernel(Jo,u,d);return h=we(h,s.dtype),l?Y(h,[h.shape[1],h.shape[2],h.shape[3]]):h}var Sf=B({avgPool_:fG});function mG(e,t,n,a,r,s="NDHWC"){let i=F(e,"x","avgPool3d","float32"),o=i,l=!1;i.rank===4&&(l=!0,o=Y(i,[1,i.shape[0],i.shape[1],i.shape[2],i.shape[3]])),P(o.rank===5,()=>`Error in avgPool3d: x must be rank 5 but got rank ${o.rank}.`),P(s==="NDHWC",()=>`Error in avgPool3d: Only NDHWC is currently supported, but got dataFormat of ${s}`),r!=null&&P(mn(a),()=>`Error in avgPool3d: pad must be an integer when using, dimRoundingMode ${r} but got pad ${a}.`);let u={x:o},d={filterSize:t,strides:n,pad:a,dimRoundingMode:r,dataFormat:s},h=j.runKernel(Kc,u,d);return h=we(h,o.dtype),l?Y(h,[h.shape[1],h.shape[2],h.shape[3],h.shape[4]]):h}var Q4=B({avgPool3d_:mG});function gG(e,t=0){P(e.length>=1,()=>"Pass at least one tensor to concat");let n=Af(e,"tensors","concat","string_or_numeric");if(n[0].dtype==="complex64"&&n.forEach(s=>{if(s.dtype!=="complex64")throw new Error(`Cannot concatenate complex64 tensors with a tensor - with dtype ${s.dtype}. `)}),n.length===1)return Gi(n[0]);let a=n,r={axis:t};return j.runKernel(Cd,a,r)}var en=B({concat_:gG});function yG(e){let t={x:F(e,"x","sigmoid")};return j.runKernel(Rl,t)}var $r=B({sigmoid_:yG});function AG(e,t,n){let a=F(e,"x","slice","string_or_numeric");if(a.rank===0)throw new Error("Slicing scalar is not possible");let r={x:a},s={begin:t,size:n};return j.runKernel(ah,r,s)}var nt=B({slice_:AG});function xG(e){let t={x:F(e,"x","tanh")};return j.runKernel(zl,t)}var Kl=B({tanh_:xG});function bG(e,t,n,a,r,s){let i=F(e,"forgetBias","basicLSTMCell"),o=F(t,"lstmKernel","basicLSTMCell"),l=F(n,"lstmBias","basicLSTMCell"),u=F(a,"data","basicLSTMCell"),d=F(r,"c","basicLSTMCell"),h=F(s,"h","basicLSTMCell"),p=en([u,h],1),c=it(p,o),m=pe(c,l),f=m.shape[0],g=m.shape[1]/4,y=[f,g],A=nt(m,[0,0],y),x=nt(m,[0,g],y),v=nt(m,[0,g*2],y),b=nt(m,[0,g*3],y),w=pe(K($r(A),Kl(x)),K(d,$r(pe(i,v)))),I=K(Kl(w),$r(b));return[w,I]}var gwe=B({basicLSTMCell_:bG});function vG(e,t,n){let a=F(e,"x","batchToSpaceND"),r=t.reduce((o,l)=>o*l);P(a.rank>=1+t.length,()=>`input rank is ${a.rank} but should be > than blockShape.length ${t.length}`),P(n.length===t.length,()=>`crops.length is ${n.length} but should be equal to blockShape.length ${t.length}`),P(a.shape[0]%r==0,()=>`input tensor batch is ${a.shape[0]} but is not divisible by the product of the elements of blockShape ${t.join(" * ")} === ${r}`);let s={x:a},i={blockShape:t,crops:n};return j.runKernel(Xc,s,i)}var Nf=B({batchToSpaceND_:vG});function wG(e){let t;return e.rank===0||e.rank===1?t=Y(e,[1,1,1,e.size]):e.rank===2?t=Y(e,[1,1,e.shape[0],e.shape[1]]):e.rank===3?t=Y(e,[1,e.shape[0],e.shape[1],e.shape[2]]):t=e,t}function kG(e,t,n,a,r,s){s==null&&(s=.001);let i=F(e,"x","batchNorm"),o=F(t,"mean","batchNorm"),l=F(n,"variance","batchNorm"),u;r!=null&&(u=F(r,"scale","batchNorm"));let d;a!=null&&(d=F(a,"offset","batchNorm")),P(o.rank===l.rank,()=>"Batch normalization gradient requires mean and variance to have equal ranks."),P(d==null||o.rank===d.rank,()=>"Batch normalization gradient requires mean and offset to have equal ranks."),P(u==null||o.rank===u.rank,()=>"Batch normalization gradient requires mean and scale to have equal ranks.");let h={x:wG(i),scale:u,offset:d,mean:o,variance:l},p={varianceEpsilon:s},c=j.runKernel(dl,h,p);return Y(c,i.shape)}var Xl=B({batchNorm_:kG});function IG(e,t,n,a,r,s){let i=F(e,"x","batchNorm"),o=F(t,"mean","batchNorm"),l=F(n,"variance","batchNorm"),u;r!=null&&(u=F(r,"scale","batchNorm"));let d;return a!=null&&(d=F(a,"offset","batchNorm")),P(i.rank===2,()=>`Error in batchNorm2D: x must be rank 2 but got rank ${i.rank}.`),P(o.rank===2||o.rank===1,()=>`Error in batchNorm2D: mean must be rank 2 or rank 1 but got rank ${o.rank}.`),P(l.rank===2||l.rank===1,()=>`Error in batchNorm2D: variance must be rank 2 or rank 1 but got rank ${l.rank}.`),u!=null&&P(u.rank===2||u.rank===1,()=>`Error in batchNorm2D: scale must be rank 2 or rank 1 but got rank ${u.rank}.`),d!=null&&P(d.rank===2||d.rank===1,()=>`Error in batchNorm2D: offset must be rank 2 or rank 1 but got rank ${d.rank}.`),Xl(i,o,l,d,u,s)}var SG=B({batchNorm2d_:IG});function NG(e,t,n,a,r,s){let i=F(e,"x","batchNorm"),o=F(t,"mean","batchNorm"),l=F(n,"variance","batchNorm"),u;r!=null&&(u=F(r,"scale","batchNorm"));let d;return a!=null&&(d=F(a,"offset","batchNorm")),P(i.rank===3,()=>`Error in batchNorm3D: x must be rank 3 but got rank ${i.rank}.`),P(o.rank===3||o.rank===1,()=>`Error in batchNorm3D: mean must be rank 3 or rank 1 but got rank ${o.rank}.`),P(l.rank===3||l.rank===1,()=>`Error in batchNorm3D: variance must be rank 3 or rank 1 but got rank ${l.rank}.`),u!=null&&P(u.rank===3||u.rank===1,()=>`Error in batchNorm3D: scale must be rank 3 or rank 1 but got rank ${u.rank}.`),d!=null&&P(d.rank===3||d.rank===1,()=>`Error in batchNorm3D: offset must be rank 3 or rank 1 but got rank ${d.rank}.`),Xl(i,o,l,d,u,s)}var TG=B({batchNorm3d_:NG});function EG(e,t,n,a,r,s){let i=F(e,"x","batchNorm"),o=F(t,"mean","batchNorm"),l=F(n,"variance","batchNorm"),u;r!=null&&(u=F(r,"scale","batchNorm"));let d;return a!=null&&(d=F(a,"offset","batchNorm")),P(i.rank===4,()=>`Error in batchNorm4D: x must be rank 4 but got rank ${i.rank}.`),P(o.rank===4||o.rank===1,()=>`Error in batchNorm4D: mean must be rank 4 or rank 1 but got rank ${o.rank}.`),P(l.rank===4||l.rank===1,()=>`Error in batchNorm4D: variance must be rank 4 or rank 1 but got rank ${l.rank}.`),u!=null&&P(u.rank===4||u.rank===1,()=>`Error in batchNorm4D: scale must be rank 4 or rank 1 but got rank ${u.rank}.`),d!=null&&P(d.rank===4||d.rank===1,()=>`Error in batchNorm4D: offset must be rank 4 or rank 1 but got rank ${d.rank}.`),Xl(i,o,l,d,u,s)}var CG=B({batchNorm4d_:EG});function MG(e,t,n){let a=F(e,"x","bincount"),r=F(t,"weights","bincount");P(a.dtype==="int32",()=>`Error in bincount: input dtype must be int32, but got ${a.dtype}`),P(n>=0,()=>`size must be non-negative, but got ${n}.`),P(r.size===a.size||r.size===0,()=>`Error in bincount: weights must have the same size as input or0-length, but got input shape: ${a.shape}, weights shape: ${r.shape}.`);let s={x:a,weights:r},i={size:n};return j.runKernel(w1,s,i)}var e8=B({bincount_:MG});function $G(e,t){let n=F(e,"broadcastTo","x"),a=n.shape;if(t.some(l=>!(l>0)||l%1!=0))throw new Error(`broadcastTo(): Invalid broadcast shape [${t}].`);if(t.lengthn.rank){let l=n.shape.slice();for(;l.length=0;l--)if(r[l]===t[l])s[l]=1;else if(n.shape[l]!==1)throw new Error(`broadcastTo(): [${a}] cannot be broadcast to [${t}].`);if(s.map((l,u)=>l>1?u:-1).filter(l=>l>=0).length===0)return Gi(n);let i={x:n},o={reps:s};return j.runKernel(Pi,i,o)}var Sh=B({broadcastTo_:$G});function RG(e){let t={x:F(e,"x","ceil")};return j.runKernel(Ni,t)}var t8=B({ceil_:RG});function FG(e,t,n){let a=F(e,"x","clipByValue");P(t<=n,()=>`Error in clip: min (${t}) must be less than or equal to max (${n}).`);let r={x:a},s={clipValueMin:t,clipValueMax:n};return j.runKernel(Ti,r,s)}var ua=B({clipByValue_:FG});function OG(e){return en(e,0)}var DG=B({concat1d_:OG});function _G(e,t){return en(e,t)}var zG=B({concat2d_:_G});function PG(e,t){return en(e,t)}var LG=B({concat3d_:PG});function WG(e,t){return en(e,t)}var BG=B({concat4d_:WG});function VG(e,t,n,a,r="NHWC",s=[1,1],i){let o=F(e,"x","conv2d"),l=F(t,"filter","conv2d"),u=o,d=!1;o.rank===3&&(d=!0,u=Y(o,[1,o.shape[0],o.shape[1],o.shape[2]])),P(u.rank===4,()=>`Error in conv2d: input must be rank 4, but got rank ${u.rank}.`),P(l.rank===4,()=>`Error in conv2d: filter must be rank 4, but got rank ${l.rank}.`),i!=null&&P(mn(a),()=>`Error in conv2d: pad must be an integer when using, dimRoundingMode ${i} but got pad ${a}.`);let h=r==="NHWC"?u.shape[3]:u.shape[1];P(h===l.shape[2],()=>`Error in conv2d: depth of input (${h}) must match input depth for filter ${l.shape[2]}.`),P(Mr(n,s),()=>`Error in conv2D: Either strides or dilations must be 1. Got strides ${n} and dilations '${s}'`);let p={x:u,filter:l},c={strides:n,pad:a,dataFormat:r,dilations:s,dimRoundingMode:i},m=j.runKernel(tl,p,c);return d?Y(m,[m.shape[1],m.shape[2],m.shape[3]]):m}var Ws=B({conv2d_:VG});function UG(e,t,n,a,r="NWC",s=1,i){let o=F(e,"x","conv1d"),l=F(t,"filter","conv1d"),u=o,d=!1;o.rank===2&&(d=!0,u=Y(o,[1,o.shape[0],o.shape[1]])),P(u.rank===3,()=>`Error in conv1d: input must be rank 3, but got rank ${u.rank}.`),P(l.rank===3,()=>`Error in conv1d: filter must be rank 3, but got rank ${l.rank}.`),i!=null&&P(mn(a),()=>`Error in conv1d: pad must be an integer when using, dimRoundingMode ${i} but got pad ${a}.`),P(u.shape[2]===l.shape[1],()=>`Error in conv1d: depth of input (${u.shape[2]}) must match input depth for filter ${l.shape[1]}.`),P(Mr(n,s),()=>`Error in conv1D: Either stride or dilation must be 1. Got stride ${n} and dilation '${s}'`),P(r==="NWC",()=>`Error in conv1d: got dataFormat of ${r} but only NWC is currently supported.`);let h=Y(l,[1,l.shape[0],l.shape[1],l.shape[2]]),p=Y(u,[u.shape[0],1,u.shape[1],u.shape[2]]),c=Ws(p,h,[1,n],a,"NHWC",[1,s],i);return d?Y(c,[c.shape[2],c.shape[3]]):Y(c,[c.shape[0],c.shape[2],c.shape[3]])}var OA=B({conv1d_:UG});function jG(e,t,n,a,r,s="NHWC",i){P(e.length===t.rank,()=>`Length of inShape (${e.length}) and rank of dy (${t.rank}) must match`);let o=e,l=t,u=!1;t.rank===3&&(u=!0,l=Y(t,[1,t.shape[0],t.shape[1],t.shape[2]]),o=[1,e[0],e[1],e[2]]),P(o.length===4,()=>`Error in conv2dDerInput: inShape must be length 4, but got length ${o.length}.`),P(l.rank===4,()=>`Error in conv2dDerInput: dy must be rank 4, but got rank ${l.rank}`),P(n.rank===4,()=>`Error in conv2dDerInput: filter must be rank 4, but got rank ${n.rank}`);let d=s==="NHWC"?o[3]:o[1],h=s==="NHWC"?l.shape[3]:l.shape[1];P(d===n.shape[2],()=>`Error in conv2dDerInput: depth of input (${d}) must match input depth for filter ${n.shape[2]}.`),P(h===n.shape[3],()=>`Error in conv2dDerInput: depth of output (${h}) must match output depth for filter ${n.shape[3]}.`),i!=null&&P(mn(r),()=>`Error in conv2dDerInput: pad must be an integer when using, dimRoundingMode ${i} but got pad ${r}.`);let p={dy:l,filter:n},c={strides:a,pad:r,dataFormat:s,dimRoundingMode:i,inputShape:o},m=j.runKernel(nl,p,c);return u?Y(m,[m.shape[1],m.shape[2],m.shape[3]]):m}var DA=B({conv2DBackpropInput_:jG});function HG(e,t,n,a,r,s){let i=F(e,"x","conv2dTranspose"),o=F(t,"filter","conv2dTranspose");return DA(n,i,o,a,r,"NHWC",s)}var _A=B({conv2dTranspose_:HG});function GG(e,t,n,a,r="NDHWC",s=[1,1,1]){let i=F(e,"x","conv3d"),o=F(t,"filter","conv3d"),l=i,u=!1;i.rank===4&&(u=!0,l=Y(i,[1,i.shape[0],i.shape[1],i.shape[2],i.shape[3]])),P(l.rank===5,()=>`Error in conv3d: input must be rank 5, but got rank ${l.rank}.`),P(o.rank===5,()=>`Error in conv3d: filter must be rank 5, but got rank ${o.rank}.`),P(l.shape[4]===o.shape[3],()=>`Error in conv3d: depth of input (${l.shape[4]}) must match input depth for filter ${o.shape[3]}.`),P(Mr(n,s),()=>`Error in conv3D: Either strides or dilations must be 1. Got strides ${n} and dilations '${s}'`),P(r==="NDHWC",()=>`Error in conv3d: got dataFormat of ${r} but only NDHWC is currently supported.`);let d={x:l,filter:o},h={strides:n,pad:a,dataFormat:r,dilations:s},p=j.runKernel(Yc,d,h);return u?Y(p,[p.shape[1],p.shape[2],p.shape[3],p.shape[4]]):p}var n8=B({conv3d_:GG});function qG(e,t,n,a,r){P(e.length===t.rank,()=>`Length of inShape (${e.length}) and rank of dy (${t.rank}) must match`);let s=e,i=t,o=!1;t.rank===4&&(o=!0,i=Y(t,[1,t.shape[0],t.shape[1],t.shape[2],t.shape[3]]),s=[1,e[0],e[1],e[2],e[3]]);let l=s[4],u=i.shape[4];P(s.length===5,()=>`Error in conv3dDerInput: inShape must be length 5, but got length ${s.length}.`),P(i.rank===5,()=>`Error in conv3dDerInput: dy must be rank 5, but got rank ${i.rank}`),P(n.rank===5,()=>`Error in conv3dDerInput: filter must be rank 5, but got rank ${n.rank}`),P(l===n.shape[3],()=>`Error in conv3dDerInput: depth of input (${l}) must match input depth for filter ${n.shape[3]}.`),P(u===n.shape[4],()=>`Error in conv3dDerInput: depth of output (${u}) must match output depth for filter ${n.shape[4]}.`);let d={dy:i,filter:n},h={pad:r,strides:a,inputShape:s},p=j.runKernel(N1,d,h);return o?Y(p,[p.shape[1],p.shape[2],p.shape[3],p.shape[4]]):p}var a8=B({conv3DBackpropInput_:qG});function KG(e,t,n,a,r){let s=F(e,"x","conv3dTranspose"),i=F(t,"filter","conv3dTranspose");return a8(n,s,i,a,r)}var XG=B({conv3dTranspose_:KG});function ZG(e){let t={x:F(e,"x","cos")};return j.runKernel(al,t)}var Tf=B({cos_:ZG});function YG(e){let t={x:F(e,"x","cosh")};return j.runKernel(Md,t)}var zA=B({cosh_:YG});function JG(e,t=0,n=!1,a=!1){let r={x:F(e,"x","cumsum")},s={axis:t,exclusive:n,reverse:a};return j.runKernel(rl,r,s)}var PA=B({cumsum_:JG});function QG(e,t,n,a=!1){let r=F(e,"x","denseBincount"),s=F(t,"weights","denseBincount");P(r.dtype==="int32",()=>`Error in denseBincount: input dtype must be int32, but got ${r.dtype}`),P(r.rank<=2,()=>`Error in denseBincount: input must be at most rank 2, but got rank ${r.rank}.`),P(n>=0,()=>`size must be non-negative, but got ${n}.`),P(s.size===r.size||s.size===0,()=>`Error in denseBincount: weights must have the same shape as x or 0-length, but got x shape: ${r.shape}, weights shape: ${s.shape}.`);let i={x:r,weights:s},o={size:n,binaryOutput:a};return j.runKernel(T1,i,o)}var eq=B({denseBincount_:QG});function tq(e,t,n="NHWC"){let a=F(e,"x","depthToSpace"),r=n==="NHWC"?a.shape[1]:a.shape[2],s=n==="NHWC"?a.shape[2]:a.shape[3],i=n==="NHWC"?a.shape[3]:a.shape[1];P(r*t>=0,()=>`Negative dimension size caused by overflow when multiplying - ${r} and ${t} for depthToSpace with input shape - ${a.shape}`),P(s*t>=0,()=>`Negative dimension size caused by overflow when multiplying - ${s} and ${t} for depthToSpace with input shape - ${a.shape}`),P(i%(t*t)==0,()=>`Dimension size must be evenly divisible by ${t*t} but is ${i} for depthToSpace with input shape ${a.shape}`);let o={x:a},l={blockSize:t,dataFormat:n};return j.runKernel(Rd,o,l)}var r8=B({depthToSpace_:tq});function nq(e,t,n,a,r="NHWC",s=[1,1],i){let o=F(e,"x","depthwiseConv2d"),l=F(t,"filter","depthwiseConv2d"),u=o,d=!1;o.rank===3&&(d=!0,u=Y(o,[1,o.shape[0],o.shape[1],o.shape[2]])),P(u.rank===4,()=>`Error in depthwiseConv2d: input must be rank 4, but got rank ${u.rank}.`),P(l.rank===4,()=>`Error in depthwiseConv2d: filter must be rank 4, but got rank ${l.rank}.`),P(u.shape[3]===l.shape[2],()=>`Error in depthwiseConv2d: number of input channels (${u.shape[3]}) must match the inChannels dimension in filter ${l.shape[2]}.`),i!=null&&P(mn(a),()=>`Error in depthwiseConv2d: pad must be an integer when using, dimRoundingMode ${i} but got pad ${a}.`);let h={x:u,filter:l},p={strides:n,pad:a,dataFormat:r,dilations:s,dimRoundingMode:i},c=j.runKernel(sl,h,p);return d?Y(c,[c.shape[1],c.shape[2],c.shape[3]]):c}var Nh=B({depthwiseConv2d_:nq});function aq(e){let t={x:F(e,"x","diag")};return j.runKernel(M1,t)}var ywe=B({diag_:aq});function rq(e,t,n,a,r=[1,1],s="NHWC"){let i=F(e,"x","dilation2d"),o=F(t,"filter","dilation2d");P(i.rank===3||i.rank===4,()=>`Error in dilation2d: input must be rank 3 or 4, but got rank ${i.rank}.`),P(o.rank===3,()=>`Error in dilation2d: filter must be rank 3, but got rank ${o.rank}.`),P(s==="NHWC",()=>`Error in dilation2d: Only NHWC is currently supported, but got dataFormat of ${s}`);let l=i,u=!1;i.rank===3&&(l=Y(i,[1,i.shape[0],i.shape[1],i.shape[2]]),u=!0);let d={x:l,filter:o},h={strides:n,pad:a,dilations:r},p=j.runKernel(Jc,d,h);return u?Y(p,[p.shape[1],p.shape[2],p.shape[3]]):p}var s8=B({dilation2d_:rq});function sq(e,t){let n=e.length,a=[];for(let r=0;r1&&i===1&&a.unshift(s)}return a}function ln(e,t){let n=[];for(let a=0;a1)&&n.unshift(s)}return n}function Rt(e,t){let n=[],a=Math.max(e.length,t.length);for(let r=0;r`Error in dot: inputs must all be rank 1 or 2, but got ranks ${n.rank} and ${a.rank}.`);let r=n.rank===1?n.size:n.shape[1],s=a.rank===1?a.size:a.shape[0];if(P(r===s,()=>`Error in dot: inner dimensions of inputs must match, but got ${r} and ${s}.`),n.rank===1&&a.rank===1){let i=Y(n,[1,-1]),o=Y(a,[-1,1]),l=it(i,o);return Y(l,[])}else if(n.rank===1&&a.rank===2){let i=Y(n,[1,-1]),o=Y(a,[a.shape[0],a.shape[1]]),l=it(i,o);return Y(l,[l.size])}else if(n.rank===2&&a.rank===1){let i=Y(a,[-1,1]),o=it(n,i);return Y(o,[o.size])}else{let i=Y(a,[a.shape[0],a.shape[1]]);return it(n,i)}}var hq=B({dot_:dq});function pq(e,...t){let n=t.map((r,s)=>F(r,`tensors${s}`,"einsum")),a={equation:e};return j.runKernel(F1,n,a)}var cq=B({einsum_:pq});function fq(e){let t={x:F(e,"x","elu")};return j.runKernel(Fd,t)}var Th=B({elu_:fq});function mq(e){let t=F(e,"x","erf");P(t.dtype==="int32"||t.dtype==="float32",()=>"Input dtype must be `int32` or `float32`."),t.dtype==="int32"&&(t=we(t,"float32"));let n={x:t};return j.runKernel(Od,n)}var o8=B({erf_:mq});function gq(e){let t={x:F(e,"x","exp")};return j.runKernel(Ei,t)}var qa=B({exp_:gq});function yq(e,t=0){let n=F(e,"x","expandDims","string_or_numeric");P(t<=n.rank,()=>"Axis must be <= rank of the tensor");let a={input:n},r={dim:t};return j.runKernel(Dd,a,r)}var Ea=B({expandDims_:yq});function Aq(e){let t={x:F(e,"x","expm1")};return j.runKernel(ll,t)}var l8=B({expm1_:Aq});function xq(e,t){let n=F(e,"x","tile","string_or_numeric");P(n.rank===t.length,()=>`Error in transpose: rank of input ${n.rank} must match length of reps ${t}.`);let a={x:n},r={reps:t};return j.runKernel(Pi,a,r)}var Zi=B({tile_:xq});function bq(e,t,n,a="float32"){t==null&&(t=e);let r=Pe([e,t],a),s=e<=t?e:t;for(let o=0;o`Error in localResponseNormalization: x must be rank 3 or 4 but got - rank ${s.rank}.`),P(mn(t),()=>`Error in localResponseNormalization: depthRadius must be an integer but got depthRadius ${t}.`);let i=s,o=!1;s.rank===3&&(o=!0,i=Y(s,[1,s.shape[0],s.shape[1],s.shape[2]]));let l={x:i},u={depthRadius:t,bias:n,alpha:a,beta:r},d=j.runKernel(nf,l,u);return o?Y(d,[d.shape[1],d.shape[2],d.shape[3]]):d}var h8=B({localResponseNormalization_:Dq});function _q(e){let t={x:F(e,"x","log")};return j.runKernel($i,t)}var Ma=B({log_:_q});function zq(e){let t={x:F(e,"x","log1p")};return j.runKernel(Vd,t)}var BA=B({log1p_:zq});function Pq(e,t){P(jc(e),()=>"The f passed in variableGrads(f) must be a function"),P(t==null||Array.isArray(t)&&t.every(u=>u instanceof gf),()=>"The varList passed in variableGrads(f, varList) must be an array of variables");let n=t!=null;if(!n){t=[];for(let u in j.registeredVariables)t.push(j.registeredVariables[u])}let a=n?t.filter(u=>!u.trainable):null,r=t.length;t=t.filter(u=>u.trainable),P(t.length>0,()=>`variableGrads() expects at least one of the input variables to be trainable, but none of the ${r} variables is trainable.`);let s=!0,{value:i,grads:o}=j.gradients(e,t,null,s);P(o.some(u=>u!=null),()=>"Cannot find a connection between any variable and the result of the loss function y=f(x). Please make sure the operations that use variables are inside the function f passed to minimize()."),P(i.rank===0,()=>`The f passed in variableGrads(f) must return a scalar, but it returned a rank-${i.rank} tensor`);let l={};return t.forEach((u,d)=>{o[d]!=null&&(l[u.name]=o[d])}),a!=null&&a.forEach(u=>l[u.name]=null),{value:i,grads:l}}function ss(e){return j.customGrad(e)}function Lq(e){let t={x:F(e,"x","neg")};return j.runKernel(Hd,t)}var Kt=B({neg_:Lq});function Wq(e){let t={x:F(e,"x","softplus")};return j.runKernel(ih,t)}var Zl=B({softplus_:Wq});function Bq(e){let t=F(e,"x","logSigmoid");return ss(n=>({value:Kt(Zl(Kt(n))),gradFunc:a=>K(a,$r(Kt(n)))}))(t)}var Vq=B({logSigmoid_:Bq});function Uq(e,t=null,n=!1){let a={x:F(e,"x","max")},r={reductionIndices:t,keepDims:n};return j.runKernel(gl,a,r)}var sr=B({max_:Uq});function jq(e,t){let n=F(e,"a","sub"),a=F(t,"b","sub");[n,a]=Ut(n,a);let r={a:n,b:a};return j.runKernel(zi,r)}var Ne=B({sub_:jq});function Hq(e,t=null,n=!1){let a=F(e,"x","sum");a.dtype==="bool"&&(a=we(a,"int32"));let r={x:a},s={axis:t,keepDims:n};return j.runKernel(Ol,r,s)}var Ce=B({sum_:Hq});function Gq(e,t=-1){let n=F(e,"logits","logSoftmax");if(t===-1&&(t=n.rank-1),t!==n.rank-1)throw Error(`Log Softmax along a non-last dimension is not yet supported. Logits was rank ${n.rank} and axis was ${t}`);return ss((a,r)=>{let s=!0,i=sr(a,t,!0),o=Ne(a,i),l=Ne(we(o,"float32"),Ma(Ce(qa(o),t,s)));return r([l]),{value:l,gradFunc:(u,d)=>{let[h]=d,p=!0,c=qa(h);return Ne(u,K(Ce(u,t,p),c))}}})(n)}var VA=B({logSoftmax_:Gq});function UA(e,t){for(let n=0;ne[s]);return[n,r]}function Qi(e,t){let n=t.map(a=>1);return p8(e,n,t)}function qq(e,t,n){P(UA(t,n),()=>`${e} supports only inner-most axes for now. Got axes ${t} and rank-${n} input.`)}function f8(e,t){if(UA(e,t))return null;let n=[];for(let a=0;an.push(a)),n}function jA(e){return e.map((t,n)=>[n,t]).sort((t,n)=>t[1]-n[1]).map(t=>t[0])}function Kq(e,t){let n=[];for(let a=t-e;a`Error in maxPool: input must be rank 4 but got rank ${o.rank}.`),P(Mr(n,i),()=>`Error in maxPool: Either strides or dilations must be 1. Got strides ${n} and dilations '${i}'`),r!=null&&P(mn(a),()=>`Error in maxPool: pad must be an integer when using, dimRoundingMode ${r} but got pad ${a}.`);let u={x:o},d={filterSize:t,strides:n,pad:a,dimRoundingMode:r},h=j.runKernel(yl,u,d);return l?Y(h,[h.shape[1],h.shape[2],h.shape[3]]):h}var Mf=B({maxPool_:tK});function nK(e,t=[1,1,1],n,a,r,s="NDHWC"){let i=F(e,"x","maxPool3d"),o=i,l=!1;i.rank===4&&(l=!0,o=Y(i,[1,i.shape[0],i.shape[1],i.shape[2],i.shape[3]])),P(o.rank===5,()=>`Error in maxPool3d: x must be rank 5 but got rank ${o.rank}.`),P(s==="NDHWC",()=>`Error in maxPool3d: Only NDHWC is currently supported, but got dataFormat of ${s}`),r!=null&&P(mn(a),()=>`Error in maxPool3d: pad must be an integer when using, dimRoundingMode ${r} but got pad ${a}.`);let u={x:o},d={filterSize:t,strides:n,pad:a,dimRoundingMode:r,dataFormat:s},h=j.runKernel(af,u,d);return l?Y(h,[h.shape[1],h.shape[2],h.shape[3],h.shape[4]]):h}var g8=B({maxPool3d_:nK});function aK(e,t,n,a,r=!1){let s={x:F(e,"x","maxPoolWithArgmax")},i={filterSize:t,strides:n,pad:a,includeBatchInIndex:r},o=j.runKernel(V1,s,i);return{result:o[0],indexes:o[1]}}var rK=B({maxPoolWithArgmax_:aK});function sK(e,t){let n=F(e,"a","maximum"),a=F(t,"b","maximum");[n,a]=Ut(n,a),n.dtype==="bool"&&(n=we(n,"int32"),a=we(a,"int32")),Rt(n.shape,a.shape);let r={a:n,b:a};return j.runKernel(Ri,r)}var is=B({maximum_:sK});function iK(e,t=null,n=!1){let a={x:F(e,"x","mean")},r={axis:t,keepDims:n};return j.runKernel(Al,a,r)}var Xt=B({mean_:iK});function un(e,t="float32"){if(t==="complex64"){let a=un(e,"float32"),r=un(e,"float32");return Vi(a,r)}let n=Gc(on(e),t);return j.makeTensor(n,e,t)}function os(e,t="float32"){if(t==="complex64"){let a=os(e,"float32"),r=un(e,"float32");return Vi(a,r)}let n=m1(on(e),t);return j.makeTensor(n,e,t)}function oK(e,t=null,n=!1){let a={x:F(e,"x","min")},r={axis:t,keepDims:n};return j.runKernel(xl,a,r)}var $f=B({min_:oK});function lK(e,t){let n=F(e,"a","minimum"),a=F(t,"b","minimum");[n,a]=Ut(n,a),n.dtype==="bool"&&(n=we(n,"int32"),a=we(a,"int32")),Rt(n.shape,a.shape);let r={a:n,b:a};return j.runKernel(Fi,r)}var $h=B({minimum_:lK});function uK(e,t,n){P(n==="reflect"||n==="symmetric",()=>`Invalid mode. Mode must be either reflect or symmetric. Got ${n}.`);let a=F(e,"x","mirrorPad");if(a.rank===0)throw new Error("mirrorPad(scalar) is not defined. Pass non-scalar to mirrorPad");P(t.length===a.rank,()=>`Padding doesn't match input. Must be ${a.rank}. Got ${t.length}.`);let r=n==="reflect"?1:0;for(let o=0;o"Invalid number of paddings. Must be length of 2 each."),P(t[o][0]>=0&&t[o][0]<=a.shape[o]-r&&t[o][1]>=0&&t[o][1]<=a.shape[o]-r,()=>`Padding in dimension ${o} cannot be greater than or equal to ${a.shape[o]-r} or less than 0 for input of shape ${a.shape}`);let s={paddings:t,mode:n},i={x:a};return j.runKernel(bl,i,s)}var y8=B({mirrorPad_:uK});function dK(e,t){let n=F(e,"a","mod"),a=F(t,"b","mod");[n,a]=Ut(n,a);let r={a:n,b:a};return j.runKernel(jd,r)}var A8=B({mod_:dK});function hK(e){let t=F(e,"x","square"),n={};return j.runKernel("Square",{x:t},n)}var vt=B({square_:hK});function pK(e,t=null,n=!1){e=F(e,"x","moments");let a=Ha(t,e.shape),r=Xt(e,a,n),s=r.shape;n||(s=Qi(r.shape,a));let i=vt(Ne(we(e,"float32"),Y(r,s))),o=Xt(i,a,n);return{mean:r,variance:o}}var GA=B({moments_:pK});function cK(e,t,n,a){let r=F(t,"data","multiRNNCell"),s=Af(n,"c","multiRNNCell"),i=Af(a,"h","multiRNNCell"),o=r,l=[];for(let h=0;h2)throw new Error(`Rank of probabilities must be 1 or 2, but is ${i}`);n=n||Math.random();let o={logits:i===1?Y(r,[1,-1]):r},l={numSamples:t,seed:n,normalized:a},u=j.runKernel(U1,o,l);return i===1?Y(u,[u.size]):u}var mK=B({multinomial_:fK});function gK(e,t){let n=F(e,"a","notEqual","string_or_numeric"),a=F(t,"b","notEqual","string_or_numeric");[n,a]=Ut(n,a),Rt(n.shape,a.shape);let r={a:n,b:a};return j.runKernel(vl,r)}var Yl=B({notEqual_:gK});function yK(e){let t={x:F(e,"x","onesLike")};return j.runKernel(Xd,t)}var $a=B({onesLike_:yK});function AK(e,t){let n=F(e,"v1","outerProduct"),a=F(t,"v2","outerProduct");P(n.rank===1&&a.rank===1,()=>`Error in outerProduct: inputs must be rank 1, but got ranks ${n.rank} and ${a.rank}.`);let r=Y(n,[-1,1]),s=Y(a,[1,-1]);return it(r,s)}var xwe=B({outerProduct_:AK});function xK(e,t,n=0){let a=F(e,"x","pad");if(a.rank===0)throw new Error("pad(scalar) is not defined. Pass non-scalar to pad");let r={paddings:t,constantValue:n},s={x:a};return j.runKernel(kl,s,r)}var Bs=B({pad_:xK});function bK(e,t,n=0){return P(t.length===2,()=>"Invalid number of paddings. Must be length of 2."),Bs(e,[t],n)}var bwe=B({pad1d_:bK});function vK(e,t,n=0){return P(t.length===2&&t[0].length===2&&t[1].length===2,()=>"Invalid number of paddings. Must be length of 2 each."),Bs(e,t,n)}var vwe=B({pad2d_:vK});function wK(e,t,n=0){return P(t.length===3&&t[0].length===2&&t[1].length===2&&t[2].length===2,()=>"Invalid number of paddings. Must be length of 2 each."),Bs(e,t,n)}var wwe=B({pad3d_:wK});function kK(e,t,n=0){return P(t.length===4&&t[0].length===2&&t[1].length===2&&t[2].length===2&&t[3].length===2,()=>"Invalid number of paddings. Must be length of 2 each."),Bs(e,t,n)}var kwe=B({pad4d_:kK});function IK(e,t,n){let a=F(e,"x","spaceToBatchND");P(a.rank>=1+t.length,()=>`input rank ${a.rank} should be > than [blockShape] ${t.length}`),P(n.length===t.length,()=>`paddings.shape[0] ${n.length} must be equal to [blockShape] ${t.length}`),P(a.shape.reduce((i,o,l)=>l>0&&l<=t.length?i&&(o+n[l-1][0]+n[l-1][1])%t[l-1]==0:i,!0),()=>`input spatial dimensions ${a.shape.slice(1)} with paddings ${n.toString()} must be divisible by blockShapes ${t.toString()}`);let r={x:a},s={blockShape:t,paddings:n};return j.runKernel(of,r,s)}var Rf=B({spaceToBatchND_:IK});function SK(e,t,n,a,r,s){r==null&&(r=[1,1]),s==null&&(s=1),a===0&&(a="valid");let i=F(e,"x","maxPool"),o=i,l=!1;i.rank===3&&(l=!0,o=Y(i,[1,i.shape[0],i.shape[1],i.shape[2]])),P(Mr(s,r),()=>`Error in pool: Either strides or dilations must be 1. Got strides ${s} and dilations '${r}'`);let u=Z4(o.shape,t,s,r,a),d=[u.dilationHeight,u.dilationWidth],h;a==="same"?h=TK([u.filterHeight,u.filterWidth],d):h=[[0,0],[0,0]];let p=d[0]===1&&d[1]===1,[c,m]=NK([u.inHeight,u.inWidth],d,h),f=p?a:"valid",g=p?o:Rf(o,d,c),y=(n==="avg"?()=>Sf(g,t,s,f):()=>Mf(g,t,s,f))(),A=p?y:Nf(y,d,m);return l?Y(A,[A.shape[1],A.shape[2],A.shape[3]]):A}function NK(e,t,n){let a=n.map(d=>d[0]),r=n.map(d=>d[1]),s=e.concat(a,r),i=t.map((d,h)=>(d-s[h]%d)%d),o=r.map((d,h)=>d+i[h]),l=t.map((d,h)=>[a[h],o[h]]),u=t.map((d,h)=>[0,i[h]]);return[l,u]}function TK(e,t){let n=e.map((s,i)=>s+(s-1)*(t[i]-1)).map(s=>s-1),a=n.map(s=>Math.floor(s/2)),r=n.map((s,i)=>s-a[i]);return n.map((s,i)=>[a[i],r[i]])}var EK=B({pool_:SK});function CK(e,t){let n=F(e,"base","pow"),a=F(t,"exp","pow");[n,a]=Ut(n,a);let r={a:n,b:a};return j.runKernel(Il,r)}var Vs=B({pow_:CK});function MK(e,t){let n=F(e,"x","prelu"),a=F(t,"alpha","prelu"),r={x:n,alpha:a};return j.runKernel(Sl,r)}var Ff=B({prelu_:MK});function $K(e,t=null,n=!1){let a=F(e,"x","prod");a.dtype==="bool"&&(a=we(a,"int32"));let r={x:a},s={axis:t,keepDims:n};return j.runKernel(Yd,r,s)}var qA=B({prod_:$K});function RK(e,t,n){let a=on(e),r=null;if(n==null||n==="float32")r=new Float32Array(a);else if(n==="int32")r=new Int32Array(a);else if(n==="bool")r=new Uint8Array(a);else throw new Error(`Unknown data type ${n}`);for(let s=0;s=1||s===0);let i=Math.sqrt(-2*Math.log(s)/s);e=this.mean+this.stdDev*a*i,t=this.mean+this.stdDev*r*i,(!this.truncated||this.isValidTruncated(e))&&(n=!0)}return(!this.truncated||this.isValidTruncated(t))&&(this.nextVal=this.convertValue(t)),this.convertValue(e)}convertValue(e){return this.dtype==null||this.dtype==="float32"?e:Math.round(e)}isValidTruncated(e){return e<=this.upper&&e>=this.lower}},FK=class{constructor(e,t,n,a){this.alpha=e,this.beta=1/t,this.dtype=n;let r=a||Math.random();this.randu=KA.alea(r.toString()),this.randn=new XA(0,1,n,!1,this.randu()),e<1?this.d=e+2/3:this.d=e-1/3,this.c=1/Math.sqrt(9*this.d)}nextValue(){let e,t,n,a,r,s;for(;;){do a=this.randn.nextValue(),s=1+this.c*a;while(s<=0);if(s*=s*s,e=a*a,t=1-.331*e*e,n=.5*e+this.d*(1-s+Math.log(s)),r=this.randu(),rthis.dtype==null||this.dtype==="float32",this.min=e,this.range=t-e,this.dtype=n,a==null&&(a=Math.random()),typeof a=="number"&&(a=a.toString()),!this.canReturnFloat()&&this.range<=1)throw new Error(`The difference between ${e} - ${t} <= 1 and dtype is not float`);this.random=KA.alea(a)}convertValue(e){return this.canReturnFloat()?e:Math.round(e)}nextValue(){return this.convertValue(this.min+this.range*this.random())}};function DK(e,t,n=1,a="float32",r){if(n==null&&(n=1),a==null&&(a="float32"),a!=="float32"&&a!=="int32")throw new Error(`Unsupported data type ${a}`);let s=new FK(t,n,a,r),i=Pe(e,a);for(let o=0;o`Error in reverse1D: x must be rank 1 but got rank ${t.rank}.`),Ra(t,0)}var Nwe=B({reverse1d_:jK});function HK(e,t){let n=F(e,"x","reverse");return P(n.rank===2,()=>`Error in reverse2D: x must be rank 2 but got rank ${n.rank}.`),Ra(n,t)}var Twe=B({reverse2d_:HK});function GK(e,t){let n=F(e,"x","reverse");return P(n.rank===3,()=>`Error in reverse3D: x must be rank 3 but got rank ${n.rank}.`),Ra(n,t)}var Ewe=B({reverse3d_:GK});function qK(e,t){let n=F(e,"x","reverse");return P(n.rank===4,()=>`Error in reverse4D: x must be rank 4 but got rank ${n.rank}.`),Ra(n,t)}var Cwe=B({reverse4d_:qK});function KK(e){let t={x:F(e,"x","round")};return j.runKernel(Ml,t)}var YA=B({round_:KK});function XK(e){let t={x:F(e,"x","rsqrt")};return j.runKernel(Di,t)}var JA=B({rsqrt_:XK});function Re(e,t){if((ar(e)&&t!=="string"||Array.isArray(e))&&t!=="complex64")throw new Error("Error creating a new Scalar: value must be a primitive (number|boolean|string)");if(t==="string"&&ar(e)&&!(e instanceof Uint8Array))throw new Error("When making a scalar from encoded string, the value must be `Uint8Array`.");return vh(e,[],[],t)}function ZK(e){let t={x:F(e,"x","selu")};return j.runKernel(nh,t)}var QA=B({selu_:ZK});function YK(e,t,n,a,r,s=[1,1],i="NHWC"){let o=F(e,"x","separableConv2d"),l=F(t,"depthwiseFilter","separableConv2d"),u=F(n,"pointwiseFilter","separableConv2d"),d=o,h=!1;if(o.rank===3&&(h=!0,d=Y(o,[1,o.shape[0],o.shape[1],o.shape[2]])),i==="NCHW")throw new Error("separableConv2d currently does not support dataFormat NCHW; only NHWC is supported");P(d.rank===4,()=>`Error in separableConv2d: input must be rank 4, but got rank ${d.rank}.`),P(l.rank===4,()=>`Error in separableConv2d: depthwise filter must be rank 4, but got rank ${l.rank}.`),P(u.rank===4,()=>`Error in separableConv2d: pointwise filter must be rank 4, but got rank ${l.rank}.`),P(u.shape[0]===1,()=>`Error in separableConv2d: the first dimension of pointwise filter must be 1, but got ${u.shape[0]}.`),P(u.shape[1]===1,()=>`Error in separableConv2d: the second dimension of pointwise filter must be 1, but got ${u.shape[1]}.`);let p=l.shape[2],c=l.shape[3];P(u.shape[2]===p*c,()=>`Error in separableConv2d: the third dimension of pointwise filter must be ${p*c}, but got ${u.shape[2]}.`);let m=Nh(d,l,a,r,i,s),f=Ws(m,u,1,"valid",i);return h?Y(f,[f.shape[1],f.shape[2],f.shape[3]]):f}var b8=B({separableConv2d_:YK});async function JK(e,t){let n=F(e,"x","setdiff1d"),a=F(t,"y","setdiff1d");P(n.dtype===a.dtype,()=>`x and y should have the same dtype, but got x (${n.dtype}) and y (${a.dtype}).`),P(n.rank===1,()=>`x should be 1D tensor, but got x (${n.shape}).`),P(a.rank===1,()=>`y should be 1D tensor, but got y (${a.shape}).`);let r=await n.data(),s=await a.data(),i=new Set(s),o=0;for(let d=0;d`slice1d expects a rank-1 tensor, but got a rank-${a.rank} tensor`),nt(a,[t],[n])}var n2=B({slice1d_:aX});function rX(e,t,n){let a=F(e,"x","slice2d");return P(a.rank===2,()=>`slice2d expects a rank-2 tensor, but got a rank-${a.rank} tensor`),nt(a,t,n)}var w8=B({slice2d_:rX});function sX(e,t,n){let a=F(e,"x","slice3d");return P(a.rank===3,()=>`slice3d expects a rank-3 tensor, but got a rank-${a.rank} tensor`),nt(a,t,n)}var a2=B({slice3d_:sX});function iX(e,t,n){let a=F(e,"x","slice4d");return P(a.rank===4,()=>`slice4d expects a rank-4 tensor, but got a rank-${a.rank} tensor`),nt(a,t,n)}var Df=B({slice4d_:iX});function oX(e,t=-1){let n=F(e,"logits","softmax","float32");if(t===-1&&(t=n.rank-1),t!==n.rank-1)throw Error(`Softmax along a non-last dimension is not yet supported. Logits was rank ${n.rank} and dim was ${t}`);let a={logits:n},r={dim:t};return j.runKernel(Dl,a,r)}var _f=B({softmax_:oX});function lX(e){P(e.dtype==="complex64",()=>`The dtype for tf.spectral.fft() must be complex64 but got ${e.dtype}.`);let t={input:e};return j.runKernel(D1,t)}var r2=B({fft_:lX});function uX(e){P(e.dtype==="complex64",()=>`The dtype for tf.spectral.ifft() must be complex64 but got ${e.dtype}.`);let t={input:e};return j.runKernel(_1,t)}var zf=B({ifft_:uX});function dX(e){let t=e.shape[e.shape.length-1],n=e.size/t,a;if(t<=2){let r=Y(e,[n,t]);a=zf(r)}else{let r=[n,2*(t-1)],s=Y(Of(e),[n,t]),i=Y(LA(e),[n,t]),o=Ra(nt(s,[0,1],[n,t-2]),1),l=K(Ra(nt(i,[0,1],[n,t-2]),1),Re(-1)),u=en([s,o],1),d=en([i,l],1),h=Y(Vi(u,d),[r[0],r[1]]);a=zf(h)}if(a=Of(a),e.rank===3&&e.shape[0]!==0){let r=a,s=e.shape[0];a=Y(a,[s,a.shape[0]/s,a.shape[1]]),r.dispose()}return a}var k8=B({irfft_:dX});function hX(e,t,n=0){let a={x:F(e,"x","split")},r={numOrSizeSplits:t,axis:n};return j.runKernel(oh,a,r)}var da=B({split_:hX});function pX(e,t){P(e.dtype==="float32",()=>`The dtype for rfft() must be real value but got ${e.dtype}`);let n=e.shape[e.shape.length-1],a=e.size/n,r;if(t!=null&&t0),f=e.shape.map(g=>g);f[e.shape.length-1]=t,r=nt(e,m,f),n=t}else if(t!=null&&t>n){let m=e.shape.map(f=>f);m[e.shape.length-1]=t-n,r=en([e,un(m)],e.shape.length-1),n=t}else r=e;let s=at(r),i=Y(Vi(r,s),[a,n]),o=r2(i),l=Math.floor(n/2)+1,u=Of(o),d=LA(o),h=da(u,[l,n-l],u.shape.length-1),p=da(d,[l,n-l],d.shape.length-1),c=r.shape.slice();return c[r.shape.length-1]=l,Y(Vi(h[0],p[0]),c)}var s2=B({rfft_:pX});function cX(e){let t={x:F(e,"x","sqrt")};return j.runKernel(Fl,t)}var Mn=B({sqrt_:cX});function fX(e,t){let n=F(e,"a","squaredDifference"),a=F(t,"b","squaredDifference");[n,a]=Ut(n,a),Rt(n.shape,a.shape);let r={a:n,b:a},s={};return j.runKernel(_i,r,s)}var i2=B({squaredDifference_:fX});function mX(e,t){let n=F(e,"x","squeeze");return Y(n,D6(n.shape,t).newShape)}var Jl=B({squeeze_:mX});function gX(e,t=0){let n=Af(e,"tensors","stack","string_or_numeric");P(n.length>=1,()=>"Pass at least one tensor to tf.stack"),n.length>0&&P(t<=n[0].rank,()=>"Axis must be <= rank of the tensor");let a=n,r={axis:t};return j.runKernel(Zd,a,r)}var Fa=B({stack_:gX});function yX(e,t=0){let n={x:F(e,"x","step")},a={alpha:t};return j.runKernel(Li,n,a)}var Oh=B({step_:yX});function AX(e,t,n,a,r=0,s=0,i=0,o=0,l=0){let u={x:F(e,"x","stridedSlice","string_or_numeric")},d={begin:t,end:n,strides:a,beginMask:r,endMask:s,ellipsisMask:i,newAxisMask:o,shrinkAxisMask:l};return j.runKernel(lh,u,d)}var I8=B({stridedSlice_:AX});function xX(e){let t={x:F(e,"x","tan")};return j.runKernel(_l,t)}var S8=B({tan_:xX});function $n(e,t){Bc(e);let n=bh(e,t);if(n.length!==1)throw new Error("tensor1d() requires values to be a flat/TypedArray");return vh(e,null,n,t)}function Ql(e,t,n){if(Bc(e),t!=null&&t.length!==2)throw new Error("tensor2d() requires shape to have two numbers");let a=bh(e,n);if(a.length!==2&&a.length!==1)throw new Error("tensor2d() requires values to be number[][] or flat/TypedArray");if(a.length===1&&t==null)throw new Error("tensor2d() requires shape to be provided when `values` are a flat/TypedArray");return vh(e,t,a,n)}function bX(e,t=1,n=!0){let a=F(e,"x","topk");if(a.rank===0)throw new Error("topk() expects the input to be of rank 1 or higher");let r=a.shape[a.shape.length-1];if(t>r)throw new Error(`'k' passed to topk() must be <= the last dimension (${r}) but got ${t}`);let s={x:a},i={k:t,sorted:n},[o,l]=j.runKernel(uh,s,i);return{values:o,indices:l}}var N8=B({topk_:bX});function vX(e,t=0,n=1,a,r){if(a!=null&&a==="bool")throw new Error("Unsupported data type $ { dtype }");let s=new XA(t,n,a,!0,r),i=Pe(e,a);for(let o=0;o0,()=>"The input tensor must be at least 1D");let a={x:n},r={axis:t},[s,i]=j.runKernel(tA,a,r);return{values:s,indices:i}}var l2=B({unique_:wX});function kX(e,t,n){let a=F(e,"x","unsortedSegmentSum"),r=F(t,"segmentIds","unsortedSegmentSum","int32");P(mn(n),()=>"numSegments must be of dtype int");let s={x:a,segmentIds:r},i={numSegments:n};return j.runKernel(uf,s,i)}var T8=B({unsortedSegmentSum_:kX});function IX(e,t=0){let n=F(e,"x","unstack","string_or_numeric");P(t>=-n.shape.length&&t`Axis = ${t} is not in [-${n.shape.length}, ${n.shape.length})`);let a={value:n},r={axis:t};return j.runKernel(hh,a,r)}var or=B({unstack_:IX});function SX(e,t=!0,n,a){return j.makeVariable(e,t,n,a)}function E8(e,t){let n=[];for(let s=0;s"Shape mismatch in v and x");let l=Re(1),u=Ne(l,o),d=K(Ne(i,s),u);if(r){P(a!=null,()=>"When using zeroDebias: true, step is required.");let h=F(a,"step","movingAverage");d=Me(d,Ne(l,Vs(o,h)))}return pe(s,d)}var Mwe=B({movingAverage_:CX});function MX(e,t,n){let a=F(e,"indices","scatterND","int32"),r=F(t,"updates","scatterND");TA(r,a,n);let s={indices:a,updates:r},i={shape:n};return j.runKernel(eh,s,i)}var $X=B({scatterND_:MX});function RX(e,t,n,a){if(e.dtype!=="int32")throw new Error(`tf.sparseToDense() expects the indices to be int32 type, but the dtype was ${e.dtype}.`);if(e.rank>2)throw new Error(`sparseIndices should be a scalar, vector, or matrix, but got shape ${e.shape}.`);let r=e.rank>0?e.shape[0]:1,s=e.rank>1?e.shape[1]:1;if(n.length!==s)throw new Error(`outputShape has incorrect number of elements:, ${n.length}, should be: ${s}.`);let i=t.size;if(!(t.rank===0||t.rank===1&&i===r))throw new Error(`sparseValues has incorrect shape ${t.shape}, should be [] or [${r}]`);if(t.dtype!==a.dtype)throw new Error("sparseValues.dtype must match defaultValues.dtype")}function FX(e,t,n,a=0){let r=F(e,"sparseIndices","sparseToDense","int32"),s=F(t,"sparseValues","sparseToDense"),i=F(a,"defaultValue","sparseToDense",s.dtype);RX(r,s,n,i);let o={sparseIndices:r,sparseValues:s,defaultValue:i},l={outputShape:n};return j.runKernel(Y1,o,l)}var M8=B({sparseToDense_:FX});function OX(e,t){let n=F(t,"indices","gatherND","int32"),a={params:F(e,"x","gatherND","string_or_numeric"),indices:n};return j.runKernel(Pd,a)}var DX=B({gatherND_:OX});function _X(e,t){if(t==null)return e.shape.slice();if(Fs(e.shape,t))return t;if(e.shape.length===t.length){let n=[];for(let a=0;a`x has to be a floating point tensor since it's going to be scaled, but got a ${r.dtype} tensor instead.`),P(t>=0&&t<1,()=>`rate must be a float in the range [0, 1), but got ${t}.`),t===0)return e instanceof Tt?r.clone():r;let s=_X(r,n),i=1-t,o=Me(Ch(pe(Rh(s,0,1,"float32",a),i)),i);return K(r,o)}var PX=B({dropout_:zX});function LX(e){return Math.floor(Math.pow(2,Math.ceil(Math.log(e)/Math.log(2))))}function $8(e,t,n){let a=1-e%2,r=new Float32Array(e);for(let s=0;sVX,depthwiseConv2d:()=>GX,matMul:()=>KX});function WX(e,t,n,a,r,s="NHWC",i){let o=e;e.rank===3&&(o=Y(e,[1,e.shape[0],e.shape[1],e.shape[2]]));let l=t;l.rank===3&&(l=Y(t,[1,t.shape[0],t.shape[1],t.shape[2]])),P(o.rank===4,()=>`Error in conv2dDerFilter: input must be rank 4, but got shape ${o.shape}.`),P(l.rank===4,()=>`Error in conv2dDerFilter: dy must be rank 4, but got shape ${l.shape}.`),P(n.length===4,()=>`Error in conv2dDerFilter: filterShape must be length 4, but got ${n}.`);let u=s==="NHWC"?o.shape[3]:o.shape[1],d=s==="NHWC"?l.shape[3]:l.shape[1];P(u===n[2],()=>`Error in conv2dDerFilter: depth of input ${u}) must match input depth in filter (${n[2]}.`),P(d===n[3],()=>`Error in conv2dDerFilter: depth of dy (${d}) must match output depth for filter (${n[3]}).`),i!=null&&P(mn(r),()=>`Error in conv2dDerFilter: pad must be an integer when using, dimRoundingMode ${i} but got pad ${r}.`);let h={x:o,dy:l},p={strides:a,pad:r,dataFormat:s,dimRoundingMode:i,filterShape:n};return j.runKernel(I1,h,p)}var d2=B({conv2DBackpropFilter_:WX});function Pf(e,t,n){if(n==null||n==="linear")return e;if(n==="relu")return K(e,Oh(t));throw new Error(`Cannot compute gradient for fused activation ${n}.`)}function Lf(e,t){let n=t,a=ln(e.shape,t.shape);return a.length>0&&(n=Ce(n,a)),Y(n,e.shape)}function Wf(e,t,n,a){if(t==="linear")return e;if(t==="relu")return ls(e);if(t==="elu")return Th(e);if(t==="relu6")return ZA(e);if(t==="prelu")return Ff(e,n);if(t==="leakyrelu")return Ef(e,a);if(t==="sigmoid")return $r(e);throw new Error(`Unknown fused activation ${t}.`)}var Bf=(e,t)=>!(e>0)||t==="linear";function BX({x:e,filter:t,strides:n,pad:a,dataFormat:r="NHWC",dilations:s=[1,1],dimRoundingMode:i,bias:o,activation:l="linear",preluActivationWeights:u,leakyreluAlpha:d}){if(l=l||"linear",Bf(j.state.gradientDepth,l)===!1){let b=Ws(e,t,n,a,r,s,i);return o!=null&&(b=pe(b,o)),Wf(b,l,u,d)}let h=F(e,"x","conv2d"),p=F(t,"filter","conv2d"),c=h,m=!1;h.rank===3&&(m=!0,c=Y(h,[1,h.shape[0],h.shape[1],h.shape[2]])),P(c.rank===4,()=>`Error in fused conv2d: input must be rank 4, but got rank ${c.rank}.`),P(p.rank===4,()=>`Error in fused conv2d: filter must be rank 4, but got rank ${p.rank}.`),i!=null&&P(mn(a),()=>`Error in fused conv2d: pad must be an integer when using, dimRoundingMode ${i} but got pad ${a}.`),P(c.shape[3]===p.shape[2],()=>`Error in conv2d: depth of input (${c.shape[3]}) must match input depth for filter ${p.shape[2]}.`),P(Mr(n,s),()=>`Error in conv2D: Either strides or dilations must be 1. Got strides ${n} and dilations '${s}'`),P(r==="NHWC",()=>`Error in conv2d: got dataFormat of ${r} but only NHWC is currently supported.`);let f=Ih(c.shape,p.shape,n,s,a,i),g;o!=null&&(g=F(o,"bias","fused conv2d"),[g]=Ut(g,h),Rt(f.outShape,g.shape));let y;u!=null&&(y=F(u,"prelu weights","fused conv2d"));let A=(b,w)=>{let[I,T,C,z]=w,$=Pf(b,C,l);P(Ls(s),()=>`Error in gradient of fused conv2D: dilation rates greater than 1 are not yet supported in gradients. Got dilations '${s}'`);let S=DA(T.shape,$,I,n,a),D=d2(T,$,I.shape,n,a),_=[S,D];if(z!=null){let W=Lf(z,$);_.push(W)}return _},x={x:c,filter:p,bias:g,preluActivationWeights:y},v={strides:n,pad:a,dataFormat:r,dilations:s,dimRoundingMode:i,activation:l,leakyreluAlpha:d};return o==null?ss((b,w,I)=>{let T=j.runKernel(Wl,x,v);return I([w,b,T]),m&&(T=Y(T,[T.shape[1],T.shape[2],T.shape[3]])),{value:T,gradFunc:A}})(c,p):ss((b,w,I,T)=>{let C=j.runKernel(Wl,x,v);return T([w,b,C,I]),m&&(C=Y(C,[C.shape[1],C.shape[2],C.shape[3]])),{value:C,gradFunc:A}})(c,p,g)}var VX=B({fusedConv2d_:BX});function UX(e,t,n,a,r,s=[1,1],i){let o=e;e.rank===3&&(o=Y(e,[1,e.shape[0],e.shape[1],e.shape[2]]));let l=t;l.rank===3&&(l=Y(t,[1,t.shape[0],t.shape[1],t.shape[2]]));let u={x:o,dy:l},d={strides:a,pad:r,dimRoundingMode:i,dilations:s,filterShape:n};return j.runKernel(E1,u,d)}var R8=B({depthwiseConv2dNativeBackpropFilter_:UX});function jX(e,t,n,a,r,s=[1,1],i){let o=t,l=!1;t.rank===3&&(l=!0,o=Y(t,[1,t.shape[0],t.shape[1],t.shape[2]]));let u={dy:o,filter:n},d={strides:a,pad:r,dimRoundingMode:i,dilations:s,inputShape:e},h=j.runKernel(C1,u,d);return l?Y(h,[h.shape[1],h.shape[2],h.shape[3]]):h}var F8=B({depthwiseConv2dNativeBackpropInput_:jX});function HX({x:e,filter:t,strides:n,pad:a,dataFormat:r="NHWC",dilations:s=[1,1],dimRoundingMode:i,bias:o,activation:l="linear",preluActivationWeights:u,leakyreluAlpha:d}){if(Bf(j.state.gradientDepth,l)===!1){let b=Nh(e,t,n,a,r,s,i);return o!=null&&(b=pe(b,o)),Wf(b,l,u,d)}let h=F(e,"x","depthwiseConv2d"),p=F(t,"filter","depthwiseConv2d"),c=h,m=!1;h.rank===3&&(m=!0,c=Y(h,[1,h.shape[0],h.shape[1],h.shape[2]])),P(c.rank===4,()=>`Error in fused depthwiseConv2d: input must be rank 4, but got rank ${c.rank}.`),P(p.rank===4,()=>`Error in fused depthwiseConv2d: filter must be rank 4, but got rank ${p.rank}.`),P(c.shape[3]===p.shape[2],()=>`Error in fused depthwiseConv2d: number of input channels (${c.shape[3]}) must match the inChannels dimension in filter ${p.shape[2]}.`),s==null&&(s=[1,1]),P(Mr(n,s),()=>`Error in fused depthwiseConv2d: Either strides or dilations must be 1. Got strides ${n} and dilations '${s}'`),i!=null&&P(mn(a),()=>`Error in fused depthwiseConv2d: pad must be an integer when using dimRoundingMode ${i} but got pad ${a}.`);let f=Ih(c.shape,p.shape,n,s,a,i,!0),g;o!=null&&(g=F(o,"bias","fused conv2d"),[g]=Ut(g,h),Rt(f.outShape,g.shape));let y;u!=null&&(y=F(u,"prelu weights","fused depthwiseConv2d"));let A=(b,w)=>{P(Ls(s),()=>`Error in gradient of fused depthwiseConv2d: dilation rates greater than 1 are not yet supported. Got dilations '${s}'`);let[I,T,C,z]=w,$=Pf(b,C,l),S=F8(T.shape,$,I,n,a,s,i),D=R8(T,$,I.shape,n,a,s,i);if(z!=null){let _=Lf(g,$);return[S,D,_]}return[S,D]},x={x:c,filter:p,bias:g,preluActivationWeights:y},v={strides:n,pad:a,dataFormat:r,dilations:s,dimRoundingMode:i,activation:l,leakyreluAlpha:d};return o==null?ss((b,w,I)=>{let T=j.runKernel(Bl,x,v);return I([w,b,T]),m&&(T=Y(T,[T.shape[1],T.shape[2],T.shape[3]])),{value:T,gradFunc:A}})(c,p):ss((b,w,I,T)=>{let C=j.runKernel(Bl,x,v);return T([w,b,C,I]),m&&(C=Y(C,[C.shape[1],C.shape[2],C.shape[3]])),{value:C,gradFunc:A}})(c,p,g)}var GX=B({fusedDepthwiseConv2d_:HX});function qX({a:e,b:t,transposeA:n=!1,transposeB:a=!1,bias:r,activation:s="linear",preluActivationWeights:i,leakyreluAlpha:o}){if(Bf(j.state.gradientDepth,s)===!1){let z=it(e,t,n,a);return r!=null&&(z=pe(z,r)),Wf(z,s,i,o)}let l=F(e,"a","fused matMul"),u=F(t,"b","fused matMul");[l,u]=Ut(l,u);let d=n?l.shape[l.rank-2]:l.shape[l.rank-1],h=a?u.shape[u.rank-1]:u.shape[u.rank-2],p=n?l.shape[l.rank-1]:l.shape[l.rank-2],c=a?u.shape[u.rank-2]:u.shape[u.rank-1],m=l.shape.slice(0,-2),f=u.shape.slice(0,-2),g=on(m),y=on(f);P(l.rank>=2&&u.rank>=2&&l.rank===u.rank,()=>`Error in fused matMul: inputs must have the same rank of at least 2, got ranks ${l.rank} and ${u.rank}.`),P(Fs(m,f),()=>`Error in fused matMul: outer dimensions (${m}) and (${f}) of Tensors with shapes ${l.shape} and ${u.shape} must match.`),P(d===h,()=>`Error in fused matMul: inner shapes (${d}) and (${h}) of Tensors with shapes ${l.shape} and ${u.shape} and transposeA=${n} and transposeB=${a} must match.`);let A=l.shape.slice(0,-2).concat([p,c]),x=n?Y(l,[g,d,p]):Y(l,[g,p,d]),v=a?Y(u,[y,c,h]):Y(u,[y,h,c]),b;r!=null&&(b=F(r,"bias","fused matMul"),[b]=Ut(b,l),Rt(A,b.shape));let w;i!=null&&(w=F(i,"prelu weights","fused matMul"));let I=(z,$)=>{let[S,D,_,W]=$,X=Pf(Y(z,_.shape),_,s),q,Q;if(!n&&!a?(q=it(X,D,!1,!0),Q=it(S,X,!0,!1)):!n&&a?(q=it(X,D,!1,!1),Q=it(X,S,!0,!1)):n&&!a?(q=it(D,X,!1,!0),Q=it(S,X,!1,!1)):(q=it(D,X,!0,!0),Q=it(X,S,!0,!0)),r!=null){let ee=Lf(W,X);return[q,Q,ee]}else return[q,Q]},T={a:x,b:v,bias:b,preluActivationWeights:w},C={transposeA:n,transposeB:a,activation:s,leakyreluAlpha:o};return r==null?ss((z,$,S)=>{let D=j.runKernel(Ll,T,C);return S([z,$,D]),{value:Y(D,A),gradFunc:I}})(x,v):ss((z,$,S,D)=>{let _=j.runKernel(Ll,T,C);return D([z,$,_,S]),{value:Y(_,A),gradFunc:I}})(x,v,b)}var KX=B({fusedMatMul_:qX});function XX(e){return $8(e,.54,.46)}var $we=B({hammingWindow_:XX});function ZX(e){return $8(e,.5,.5)}var YX=B({hannWindow_:ZX});function JX(e,t,n,a=!1,r=0){let s=0,i=[];for(;s+t<=e.size;)i.push(nt(e,s,t)),s+=n;if(a)for(;s`Error in cropAndResize: image must be rank 4,but got rank ${i.rank}.`),P(o.rank===2&&o.shape[1]===4,()=>`Error in cropAndResize: boxes must be have size [${u},4] but had shape ${o.shape}.`),P(l.rank===1&&l.shape[0]===u,()=>`Error in cropAndResize: boxInd must be have size [${u}] but had shape ${o.shape}.`),P(a.length===2,()=>`Error in cropAndResize: cropSize must be of length 2, but got length ${a.length}.`),P(a[0]>=1&&a[1]>=1,()=>`cropSize must be atleast [1,1], but was ${a}`),P(r==="bilinear"||r==="nearest",()=>`method must be bilinear or nearest, but was ${r}`);let d={image:i,boxes:o,boxInd:l},h={method:r,extrapolationValue:s,cropSize:a};return j.runKernel($d,d,h)}var nZ=B({cropAndResize_:tZ});function aZ(e){let t=F(e,"image","flipLeftRight","float32");P(t.rank===4,()=>`Error in flipLeftRight: image must be rank 4,but got rank ${t.rank}.`);let n={image:t};return j.runKernel(_d,n,{})}var rZ=B({flipLeftRight_:aZ});function sZ(e,t,n=0,a=.5){let r=F(e,"image","rotateWithOffset","float32");P(r.rank===4,()=>`Error in rotateWithOffset: image must be rank 4,but got rank ${r.rank}.`);let s={image:r},i={radians:t,fillValue:n,center:a};return j.runKernel(ch,s,i)}var iZ=B({rotateWithOffset_:sZ});function eu(e,t,n,a,r,s){a==null&&(a=.5),r==null&&(r=Number.NEGATIVE_INFINITY),s==null&&(s=0);let i=e.shape[0];return n=Math.min(n,i),P(0<=a&&a<=1,()=>`iouThreshold must be in [0, 1], but was '${a}'`),P(e.rank===2,()=>`boxes must be a 2D tensor, but was of rank '${e.rank}'`),P(e.shape[1]===4,()=>`boxes must have 4 columns, but 2nd dimension was ${e.shape[1]}`),P(t.rank===1,()=>"scores must be a 1D tensor"),P(t.shape[0]===i,()=>`scores has incompatible shape with boxes. Expected ${i}, but was ${t.shape[0]}`),P(0<=s&&s<=1,()=>`softNmsSigma must be in [0, 1], but was '${s}'`),{maxOutputSize:n,iouThreshold:a,scoreThreshold:r,softNmsSigma:s}}function oZ(e,t,n,a=.5,r=Number.NEGATIVE_INFINITY){let s=F(e,"boxes","nonMaxSuppression"),i=F(t,"scores","nonMaxSuppression"),o=eu(s,i,n,a,r);n=o.maxOutputSize,a=o.iouThreshold,r=o.scoreThreshold;let l={maxOutputSize:n,iouThreshold:a,scoreThreshold:r};return j.runKernel(Gd,{boxes:s,scores:i},l)}var lZ=B({nonMaxSuppression_:oZ});function uZ(e,t,n){let a=dZ(e,t,n),r=a<0?-(a+1):a;e.splice(r,0,t)}function dZ(e,t,n){return pZ(e,t,n||hZ)}function hZ(e,t){return e>t?1:e>>1);let o=n(t,e[s]);o>0?a=s+1:(r=s,i=!o)}return i?a:-a-1}function O8(e,t,n,a,r){return h2(e,t,n,a,r,0)}function D8(e,t,n,a,r,s){return h2(e,t,n,a,r,0,!1,s,!0)}function _8(e,t,n,a,r,s){return h2(e,t,n,a,r,s,!0)}function h2(e,t,n,a,r,s,i=!1,o=!1,l=!1){let u=[];for(let g=0;gr&&u.push({score:t[g],boxIndex:g,suppressBeginIndex:0});u.sort(z8);let d=s>0?-.5/s:0,h=[],p=[];for(;h.length0;){let g=u.pop(),{score:y,boxIndex:A,suppressBeginIndex:x}=g;if(y=x;--b){let w=cZ(e,A,h[b]);if(w>=a){v=!0;break}if(g.score=g.score*fZ(a,d,w),g.score<=r)break}g.suppressBeginIndex=h.length,v||(g.score===y?(h.push(A),p.push(g.score)):g.score>r&&uZ(u,g,z8))}let c=h.length,m=n-c;o&&m>0&&(h.push(...new Array(m).fill(0)),p.push(...new Array(m).fill(0)));let f={selectedIndices:h};return i&&(f.selectedScores=p),l&&(f.validOutputs=c),f}function cZ(e,t,n){let a=e.subarray(t*4,t*4+4),r=e.subarray(n*4,n*4+4),s=Math.min(a[0],a[2]),i=Math.min(a[1],a[3]),o=Math.max(a[0],a[2]),l=Math.max(a[1],a[3]),u=Math.min(r[0],r[2]),d=Math.min(r[1],r[3]),h=Math.max(r[0],r[2]),p=Math.max(r[1],r[3]),c=(o-s)*(l-i),m=(h-u)*(p-d);if(c<=0||m<=0)return 0;let f=Math.max(s,u),g=Math.max(i,d),y=Math.min(o,h),A=Math.min(l,p),x=Math.max(y-f,0)*Math.max(A-g,0);return x/(c+m-x)}function fZ(e,t,n){let a=Math.exp(t*n*n);return n<=e?a:0}function z8(e,t){return e.score-t.score||e.score===t.score&&t.boxIndex-e.boxIndex}async function mZ(e,t,n,a=.5,r=Number.NEGATIVE_INFINITY){let s=F(e,"boxes","nonMaxSuppressionAsync"),i=F(t,"scores","nonMaxSuppressionAsync"),o=eu(s,i,n,a,r);n=o.maxOutputSize,a=o.iouThreshold,r=o.scoreThreshold;let l=await Promise.all([s.data(),i.data()]),u=l[0],d=l[1],{selectedIndices:h}=O8(u,d,n,a,r);return s!==e&&s.dispose(),i!==t&&i.dispose(),$n(h,"int32")}var gZ=mZ;function yZ(e,t,n,a=.5,r=Number.NEGATIVE_INFINITY,s=0){let i=F(e,"boxes","nonMaxSuppression"),o=F(t,"scores","nonMaxSuppression"),l=eu(i,o,n,a,r,s);n=l.maxOutputSize,a=l.iouThreshold,r=l.scoreThreshold,s=l.softNmsSigma;let u={boxes:i,scores:o},d={maxOutputSize:n,iouThreshold:a,scoreThreshold:r,softNmsSigma:s},h=j.runKernel(Kd,u,d);return{selectedIndices:h[0],selectedScores:h[1]}}var AZ=B({nonMaxSuppressionWithScore_:yZ});async function xZ(e,t,n,a=.5,r=Number.NEGATIVE_INFINITY,s=0){let i=F(e,"boxes","nonMaxSuppressionAsync"),o=F(t,"scores","nonMaxSuppressionAsync"),l=eu(i,o,n,a,r,s);n=l.maxOutputSize,a=l.iouThreshold,r=l.scoreThreshold,s=l.softNmsSigma;let u=await Promise.all([i.data(),o.data()]),d=u[0],h=u[1],{selectedIndices:p,selectedScores:c}=_8(d,h,n,a,r,s);return i!==e&&i.dispose(),o!==t&&o.dispose(),{selectedIndices:$n(p,"int32"),selectedScores:$n(c)}}var bZ=xZ;function vZ(e,t,n,a=.5,r=Number.NEGATIVE_INFINITY,s=!1){let i=F(e,"boxes","nonMaxSuppression"),o=F(t,"scores","nonMaxSuppression"),l=eu(i,o,n,a,r,null),u=l.maxOutputSize,d=l.iouThreshold,h=l.scoreThreshold,p={boxes:i,scores:o},c={maxOutputSize:u,iouThreshold:d,scoreThreshold:h,padToMaxOutputSize:s},m=j.runKernel(qd,p,c);return{selectedIndices:m[0],validOutputs:m[1]}}var wZ=B({nonMaxSuppressionPadded_:vZ});async function kZ(e,t,n,a=.5,r=Number.NEGATIVE_INFINITY,s=!1){let i=F(e,"boxes","nonMaxSuppressionAsync"),o=F(t,"scores","nonMaxSuppressionAsync"),l=eu(i,o,n,a,r,null),u=l.maxOutputSize,d=l.iouThreshold,h=l.scoreThreshold,[p,c]=await Promise.all([i.data(),o.data()]),{selectedIndices:m,validOutputs:f}=D8(p,c,u,d,h,s);return i!==e&&i.dispose(),o!==t&&o.dispose(),{selectedIndices:$n(m,"int32"),validOutputs:Re(f,"int32")}}var IZ=kZ;function SZ(e,t,n=!1,a=!1){let r=F(e,"images","resizeBilinear");P(r.rank===3||r.rank===4,()=>`Error in resizeBilinear: x must be rank 3 or 4, but got rank ${r.rank}.`),P(t.length===2,()=>`Error in resizeBilinear: new shape must 2D, but got shape ${t}.`),P(a===!1||n===!1,()=>"Error in resizeBilinear: If halfPixelCenters is true, alignCorners must be false.");let s=r,i=!1;r.rank===3&&(i=!0,s=Y(r,[1,r.shape[0],r.shape[1],r.shape[2]]));let[]=t,o={images:s},l={alignCorners:n,halfPixelCenters:a,size:t},u=j.runKernel(Tl,o,l);return i?Y(u,[u.shape[1],u.shape[2],u.shape[3]]):u}var P8=B({resizeBilinear_:SZ});function NZ(e,t,n=!1,a=!1){let r=F(e,"images","resizeNearestNeighbor");P(r.rank===3||r.rank===4,()=>`Error in resizeNearestNeighbor: x must be rank 3 or 4, but got rank ${r.rank}.`),P(t.length===2,()=>`Error in resizeNearestNeighbor: new shape must 2D, but got shape ${t}.`),P(r.dtype==="float32"||r.dtype==="int32",()=>"`images` must have `int32` or `float32` as dtype"),P(a===!1||n===!1,()=>"Error in resizeNearestNeighbor: If halfPixelCenters is true, alignCorners must be false.");let s=r,i=!1;r.rank===3&&(i=!0,s=Y(r,[1,r.shape[0],r.shape[1],r.shape[2]]));let[]=t,o={images:s},l={alignCorners:n,halfPixelCenters:a,size:t},u=j.runKernel(sf,o,l);return i?Y(u,[u.shape[1],u.shape[2],u.shape[3]]):u}var L8=B({resizeNearestNeighbor_:NZ});function TZ(e,t="binary",n=!1,a=.5){let r=F(e,"image","threshold"),s=.2989,i=.587,o=.114,l=r.shape[0]*r.shape[1],u=K($n([a]),255),d,h,p,c;if(P(r.rank===3,()=>`Error in threshold: image must be rank 3,but got rank ${r.rank}.`),P(r.shape[2]===3||r.shape[2]===1,()=>`Error in threshold: image color channel must be equal to 3 or 1but got ${r.shape[2]}.`),P(r.dtype==="int32"||r.dtype==="float32",()=>`Error in dtype: image dtype must be int32 or float32,but got dtype ${r.dtype}.`),P(t==="otsu"||t==="binary",()=>`Method must be binary or otsu, but was ${t}`),r.shape[2]===3){[d,h,p]=da(r,[1,1,1],-1);let f=K(d,s),g=K(h,i),y=K(p,o);c=pe(pe(f,g),y)}else c=e;if(t==="otsu"){let f=e8(we(YA(c),"int32"),Cr([]),256);u=EZ(f,l)}let m=n?Ji(c,u):Ca(c,u);return we(K(m,255),"int32")}function EZ(e,t){let n=$n([-1]),a=$n([0]),r=$n([0]),s,i,o,l,u,d;for(let h=0;h`Error in transform: image must be rank 4,but got rank ${i.rank}.`),P(o.rank===2&&(o.shape[0]===i.shape[0]||o.shape[0]===1)&&o.shape[1]===8,()=>"Error in transform: Input transform should be batch x 8 or 1 x 8"),P(s==null||s.length===2,()=>`Error in transform: outputShape must be [height, width] or null, but got ${s}.`);let l={image:i,transforms:o},u={interpolation:n,fillMode:a,fillValue:r,outputShape:s};return j.runKernel(dh,l,u)}var $Z=B({transform_:MZ});function RZ(e,t,n){P(t%1==0,()=>`bandPart(): numLower must be an integer, got ${t}.`),P(n%1==0,()=>`bandPart(): numUpper must be an integer, got ${n}.`);let a=F(e,"a","bandPart");P(a.rank>=2,()=>`bandPart(): Rank must be at least 2, got ${a.rank}.`);let r=a.shape,[s,i]=a.shape.slice(-2);if(!(t<=s))throw new Error(`bandPart(): numLower (${t}) must not be greater than the number of rows (${s}).`);if(!(n<=i))throw new Error(`bandPart(): numUpper (${n}) must not be greater than the number of columns (${i}).`);t<0&&(t=s),n<0&&(n=i);let o=Y(Fh(0,s,1,"int32"),[-1,1]),l=Fh(0,i,1,"int32"),u=Ne(o,l),d=ir(Ji(u,Re(+t,"int32")),Yi(u,Re(-n,"int32"))),h=un([s,i],a.dtype);return Y(Fa(or(Y(a,[-1,s,i])).map(p=>Pn(d,p,h))),r)}var FZ=B({bandPart_:RZ});function OZ(e){let t;if(Array.isArray(e)){t=!1,P(e!=null&&e.length>0,()=>"Gram-Schmidt process: input must not be null, undefined, or empty");let r=e[0].shape[0];for(let s=1;s`Gram-Schmidt: Non-unique lengths found in the input vectors: (${e[s].shape[0]} vs. ${r})`)}else t=!0,e=da(e,e.shape[0],0).map(r=>Jl(r,[0]));P(e.length<=e[0].shape[0],()=>`Gram-Schmidt: Number of vectors (${e.length}) exceeds number of dimensions (${e[0].shape[0]}).`);let n=[],a=e;for(let r=0;r{let s=a[r];if(r>0)for(let i=0;i=2,()=>`qr() requires input tensor to have a rank >= 2, but got rank ${e.rank}`),e.rank===2)return W8(e,t);{let n=e.shape.slice(0,e.shape.length-2).reduce((l,u)=>l*u),a=or(Y(e,[n,e.shape[e.shape.length-2],e.shape[e.shape.length-1]]),0),r=[],s=[];a.forEach(l=>{let[u,d]=W8(l,t);r.push(u),s.push(d)});let i=Y(Fa(r,0),e.shape),o=Y(Fa(s,0),e.shape);return[i,o]}}function W8(e,t=!1){return j.tidy(()=>{P(e.shape.length===2,()=>`qr2d() requires a 2D Tensor, but got a ${e.shape.length}D Tensor.`);let n=e.shape[0],a=e.shape[1],r=u8(n),s=Gi(e),i=Ql([[1]],[1,1]),o=Gi(i),l=n>=a?a:n;for(let u=0;u{let c=nt(s,[u,u],[n-u,1]),m=u2(c),f=nt(s,[u,u],[1,1]),g=Pn(Ca(f,0),Ql([[-1]]),Ql([[1]])),y=Ne(f,K(g,m)),A=Me(c,y);A.shape[0]===1?o=Gi(i):o=en([i,nt(A,[1,0],[A.shape[0]-1,A.shape[1]])],0);let x=Kt(Me(it(g,y),m)),v=nt(s,[u,0],[n-u,a]),b=K(x,o),w=ct(o);if(u===0)s=Ne(v,it(b,it(w,v)));else{let C=Ne(v,it(b,it(w,v)));s=en([nt(s,[0,0],[u,a]),C],0)}let I=ct(b),T=nt(r,[0,u],[n,r.shape[1]-u]);if(u===0)r=Ne(T,it(it(T,o),I));else{let C=Ne(T,it(it(T,o),I));r=en([nt(r,[0,0],[n,u]),C],1)}return[o,s,r]}),Ge([d,h,p])}return!t&&n>a&&(r=nt(r,[0,0],[n,a]),s=nt(s,[0,0],[a,a])),[r,s]})}var zZ=B({qr_:_Z}),Jn;(function(e){e[e.NONE=0]="NONE",e[e.MEAN=1]="MEAN",e[e.SUM=2]="SUM",e[e.SUM_BY_NONZERO_WEIGHTS=3]="SUM_BY_NONZERO_WEIGHTS"})(Jn||(Jn={}));function PZ(e,t,n=Jn.SUM_BY_NONZERO_WEIGHTS){let a=F(e,"losses","computeWeightedLoss"),r=null;t!=null&&(r=F(t,"weights","computeWeightedLoss"));let s=r==null?a:K(a,r);if(n===Jn.NONE)return s;if(n===Jn.SUM)return Ce(s);if(n===Jn.MEAN){if(r==null)return Xt(s);{let i=a.size/r.size,o=Me(Ce(s),Ce(r));return i>1?Me(o,Re(i)):o}}if(n===Jn.SUM_BY_NONZERO_WEIGHTS){if(r==null)return Me(Ce(s),Re(a.size));{let i=K(r,os(a.shape)),o=we(Ce(Yl(i,Re(0))),"float32");return Me(Ce(s),o)}}throw Error(`Unknown reduction: ${n}`)}var Us=B({computeWeightedLoss_:PZ});function LZ(e,t,n,a=Jn.SUM_BY_NONZERO_WEIGHTS){let r=F(e,"labels","absoluteDifference"),s=F(t,"predictions","absoluteDifference"),i=null;n!=null&&(i=F(n,"weights","absoluteDifference")),nr(r.shape,s.shape,"Error in absoluteDifference: ");let o=yn(Ne(r,s));return Us(o,i,a)}var Fwe=B({absoluteDifference_:LZ});function WZ(e,t,n,a,r=Jn.SUM_BY_NONZERO_WEIGHTS){let s=F(e,"labels","cosineDistance"),i=F(t,"predictions","cosineDistance"),o=null;a!=null&&(o=F(a,"weights","cosineDistance")),nr(s.shape,i.shape,"Error in cosineDistance: ");let l=Re(1),u=Ne(l,Ce(K(s,i),n,!0));return Us(u,o,r)}var Owe=B({cosineDistance_:WZ});function BZ(e,t,n,a=Jn.SUM_BY_NONZERO_WEIGHTS){let r=F(e,"labels","hingeLoss"),s=F(t,"predictions","hingeLoss"),i=null;n!=null&&(i=F(n,"weights","hingeLoss")),nr(r.shape,s.shape,"Error in hingeLoss: ");let o=Re(1);r=Ne(K(Re(2),r),o);let l=ls(Ne(o,K(r,s)));return Us(l,i,a)}var Dwe=B({hingeLoss_:BZ});function VZ(e,t,n,a=1,r=Jn.SUM_BY_NONZERO_WEIGHTS){let s=F(e,"labels","huberLoss"),i=F(t,"predictions","huberLoss"),o=null;n!=null&&(o=F(n,"weights","huberLoss")),nr(s.shape,i.shape,"Error in huberLoss: ");let l=Re(a),u=yn(Ne(i,s)),d=$h(u,l),h=Ne(u,d),p=pe(K(Re(.5),vt(d)),K(l,h));return Us(p,o,r)}var _we=B({huberLoss_:VZ});function UZ(e,t,n,a=1e-7,r=Jn.SUM_BY_NONZERO_WEIGHTS){let s=F(e,"labels","logLoss"),i=F(t,"predictions","logLoss"),o=null;n!=null&&(o=F(n,"weights","logLoss")),nr(s.shape,i.shape,"Error in logLoss: ");let l=Re(1),u=Re(a),d=Kt(K(s,Ma(pe(i,u)))),h=K(Ne(l,s),Ma(pe(Ne(l,i),u))),p=Ne(d,h);return Us(p,o,r)}var zwe=B({logLoss_:UZ});function jZ(e,t,n,a=Jn.SUM_BY_NONZERO_WEIGHTS){let r=F(e,"labels","meanSquaredError"),s=F(t,"predictions","meanSquaredError"),i=null;n!=null&&(i=F(n,"weights","meanSquaredError")),nr(r.shape,s.shape,"Error in meanSquaredError: ");let o=i2(r,s);return Us(o,i,a)}var Pwe=B({meanSquaredError_:jZ});function HZ(e,t){let n=F(e,"labels","sigmoidCrossEntropyWithLogits"),a=F(t,"logits","sigmoidCrossEntropyWithLogits");nr(n.shape,a.shape,"Error in sigmoidCrossEntropyWithLogits: ");let r=ls(a),s=K(a,n),i=BA(qa(Kt(yn(a))));return pe(Ne(r,s),i)}function GZ(e,t,n,a=0,r=Jn.SUM_BY_NONZERO_WEIGHTS){let s=F(e,"multiClassLabels","sigmoidCrossEntropy"),i=F(t,"logits","sigmoidCrossEntropy"),o=null;if(n!=null&&(o=F(n,"weights","sigmoidCrossEntropy")),nr(s.shape,i.shape,"Error in sigmoidCrossEntropy: "),a>0){let u=Re(a),d=Re(1),h=Re(.5);s=pe(K(s,Ne(d,u)),K(h,u))}let l=HZ(s,i);return Us(l,o,r)}var Lwe=B({sigmoidCrossEntropy_:GZ});function qZ(e,t,n=-1){if(n===-1&&(n=t.rank-1),n!==t.rank-1)throw Error(`Softmax cross entropy along a non-last dimension is not yet supported. Labels / logits was rank ${t.rank} and dim was ${n}`);return ss((a,r,s)=>{let i=m8(r,[n],!0),o=Ne(we(r,"float32"),i);s([a,o]);let l=Kt(K(o,a));return{value:Ce(l,[n]),gradFunc:(u,d)=>{let[h,p]=d,c=Qi(u.shape,[n]);return[K(Y(u,c),Ne(we(h,"float32"),qa(p))),K(Y(u,c),Ne(qa(p),we(h,"float32")))]}}})(e,t)}function KZ(e,t,n,a=0,r=Jn.SUM_BY_NONZERO_WEIGHTS){let s=F(e,"onehotLabels","softmaxCrossEntropy"),i=F(t,"logits","softmaxCrossEntropy"),o=null;if(n!=null&&(o=F(n,"weights","softmaxCrossEntropy")),nr(s.shape,i.shape,"Error in softmaxCrossEntropy: "),a>0){let u=Re(a),d=Re(1),h=Re(s.shape[1]);s=pe(K(s,Ne(d,u)),Me(u,h))}let l=qZ(s,i);return Us(l,o,r)}var Wwe=B({softmaxCrossEntropy_:KZ});function XZ(e,t,n,a){let r=F(e,"indices","sparseFillEmptyRows"),s=F(t,"values","sparseFillEmptyRows"),i=F(n,"denseShape","sparseFillEmptyRows"),o=F(a,"defaultValue","sparseFillEmptyRows",s.dtype);if(r.rank!==2)throw new Error(`Indices should be Tensor2D but received shape - ${r.shape}`);if(s.rank!==1)throw new Error(`Values should be Tensor1D but received shape ${s.shape}`);if(i.rank!==1)throw new Error(`Dense shape should be Tensor1D but received shape ${i.shape}`);if(o.rank!==0)throw new Error(`Default value should be a scalar but received shape ${o.shape}`);let l={indices:r,values:s,denseShape:i,defaultValue:o},u=j.runKernel(q1,l);return{outputIndices:u[0],outputValues:u[1],emptyRowIndicator:u[2],reverseIndexMap:u[3]}}var ZZ=B({sparseFillEmptyRows_:XZ});function YZ(e,t,n){let a=F(e,"inputIndices","sparseReshape"),r=F(t,"inputShape","sparseReshape"),s=F(n,"newShape","sparseReshape");if(a.rank!==2)throw new Error(`Input indices should be Tensor2D but received shape - ${a.shape}`);if(r.rank!==1)throw new Error(`Input shape should be Tensor1D but received shape ${r.shape}`);if(s.rank!==1)throw new Error(`New shape should be Tensor1D but received shape ${s.shape}`);let i={inputIndices:a,inputShape:r,newShape:s},o=j.runKernel(K1,i);return{outputIndices:o[0],outputShape:o[1]}}var JZ=B({sparseReshape_:YZ});function QZ(e,t,n){let a=F(e,"data","sparseSegmentMean"),r=F(t,"indices","sparseSegmentMean"),s=F(n,"segmentIds","sparseSegmentMean");if(a.rank<1)throw new Error("Data should be at least 1 dimensional but received scalar");if(r.rank!==1)throw new Error(`Indices should be Tensor1D but received shape - ${r.shape}`);if(s.rank!==1)throw new Error(`Segment ids should be Tensor1D but received shape - ${s.shape}`);let i={data:a,indices:r,segmentIds:s};return j.runKernel(X1,i)}var eY=B({sparseSegmentMean_:QZ});function tY(e,t,n){let a=F(e,"data","sparseSegmentSum"),r=F(t,"indices","sparseSegmentSum"),s=F(n,"segmentIds","sparseSegmentSum");if(a.rank<1)throw new Error("Data should be at least 1 dimensional but received scalar");if(r.rank!==1)throw new Error(`Indices should be Tensor1D but received shape - ${r.shape}`);if(s.rank!==1)throw new Error(`Segment ids should be Tensor1D but received shape - ${s.shape}`);let i={data:a,indices:r,segmentIds:s};return j.runKernel(Z1,i)}var nY=B({sparseSegmentSum_:tY});function aY(e,t,n,a,r,s,i,o){let l=F(e,"data","stringNGrams","string");if(l.dtype!=="string")throw new Error("Data must be of datatype string");if(l.shape.length!==1)throw new Error(`Data must be a vector, saw: ${l.shape}`);let u=F(t,"dataSplits","stringNGrams");if(u.dtype!=="int32")throw new Error("Data splits must be of datatype int32");let d={separator:n,nGramWidths:a,leftPad:r,rightPad:s,padWidth:i,preserveShortSequences:o},h={data:l,dataSplits:u},p=j.runKernel(J1,h,d);return{nGrams:p[0],nGramsSplits:p[1]}}var rY=B({stringNGrams_:aY});function sY(e,t,n=!0){let a=F(e,"input","stringSplit","string"),r=F(t,"delimiter","stringSplit","string");if(a.rank!==1)throw new Error(`Input should be Tensor1D but received shape ${a.shape}`);if(r.rank!==0)throw new Error(`Delimiter should be a scalar but received shape ${r.shape}`);let s={skipEmpty:n},i={input:a,delimiter:r},o=j.runKernel(Q1,i,s);return{indices:o[0],values:o[1],shape:o[2]}}var iY=B({stringSplit_:sY});function oY(e,t){let n=F(e,"input","stringToHashBucketFast","string"),a={numBuckets:t};if(t<=0)throw new Error("Number of buckets must be at least 1");let r={input:n};return j.runKernel(eA,r,a)}var lY=B({stringToHashBucketFast_:oY}),to={flipLeftRight:rZ,resizeNearestNeighbor:L8,resizeBilinear:P8,rotateWithOffset:iZ,cropAndResize:nZ,nonMaxSuppression:lZ,nonMaxSuppressionAsync:gZ,nonMaxSuppressionWithScore:AZ,nonMaxSuppressionWithScoreAsync:bZ,nonMaxSuppressionPadded:wZ,nonMaxSuppressionPaddedAsync:IZ,threshold:CZ,transform:$Z},uY={bandPart:FZ,gramSchmidt:DZ,qr:zZ},Vf={sparseFillEmptyRows:ZZ,sparseReshape:JZ,sparseSegmentMean:eY,sparseSegmentSum:nY},p2={stringNGrams:rY,stringSplit:iY,stringToHashBucketFast:lY},js=class extends W4{minimize(e,t=!1,n){let{value:a,grads:r}=this.computeGradients(e,n);if(n!=null){let s=n.map(i=>({name:i.name,tensor:r[i.name]}));this.applyGradients(s)}else this.applyGradients(r);return Ge(r),t?a:(a.dispose(),null)}get iterations(){return this.iterations_==null&&(this.iterations_=0),this.iterations_}incrementIterations(){this.iterations_=this.iterations+1}computeGradients(e,t){return Pq(e,t)}dispose(){this.iterations_!=null&&Ge(this.iterations_)}async saveIterations(){return this.iterations_==null&&(this.iterations_=0),{name:"iter",tensor:Re(this.iterations_,"int32")}}async getWeights(){throw new Error("getWeights() is not implemented for this optimizer yet.")}async setWeights(e){throw new Error(`setWeights() is not implemented for this optimizer class ${this.getClassName()}`)}async extractIterations(e){return this.iterations_=(await e[0].tensor.data())[0],e.slice(1)}};Object.defineProperty(js,Symbol.hasInstance,{value:e=>e.minimize!=null&&e.computeGradients!=null&&e.applyGradients!=null});var c2=class extends js{constructor(e,t,n=null){super();this.learningRate=e,this.rho=t,this.epsilon=n,this.accumulatedGrads=[],this.accumulatedUpdates=[],n==null&&(this.epsilon=j.backend.epsilon())}applyGradients(e){(Array.isArray(e)?e.map(t=>t.name):Object.keys(e)).forEach((t,n)=>{let a=j.registeredVariables[t],r=!1;this.accumulatedGrads[n]==null&&(this.accumulatedGrads[n]={originalName:`${t}/accum_grad`,variable:Z(()=>at(a).variable(r))}),this.accumulatedUpdates[n]==null&&(this.accumulatedUpdates[n]={originalName:`${t}/accum_var`,variable:Z(()=>at(a).variable(r))});let s=Array.isArray(e)?e[n].tensor:e[t];if(s==null)return;let i=this.accumulatedGrads[n].variable,o=this.accumulatedUpdates[n].variable;Z(()=>{let l=pe(K(i,this.rho),K(vt(s),1-this.rho)),u=K(Me(Mn(pe(o,this.epsilon)),Mn(pe(i,this.epsilon))),s),d=pe(K(o,this.rho),K(vt(u),1-this.rho));i.assign(l),o.assign(d);let h=pe(K(u,-this.learningRate),a);a.assign(h)})}),this.incrementIterations()}dispose(){this.accumulatedUpdates!=null&&(Ge(this.accumulatedGrads.map(e=>e.variable)),Ge(this.accumulatedUpdates.map(e=>e.variable)))}async getWeights(){let e=[...this.accumulatedGrads,...this.accumulatedUpdates];return[await this.saveIterations()].concat(e.map(t=>({name:t.originalName,tensor:t.variable})))}async setWeights(e){e=await this.extractIterations(e);let t=e.length/2,n=!1;this.accumulatedGrads=e.slice(0,t).map(a=>({originalName:a.name,variable:a.tensor.variable(n)})),this.accumulatedUpdates=e.slice(t,t*2).map(a=>({originalName:a.name,variable:a.tensor.variable(n)}))}getConfig(){return{learningRate:this.learningRate,rho:this.rho,epsilon:this.epsilon}}static fromConfig(e,t){return new e(t.learningRate,t.rho,t.epsilon)}};c2.className="Adadelta";zs(c2);var f2=class extends js{constructor(e,t=.1){super();this.learningRate=e,this.initialAccumulatorValue=t,this.accumulatedGrads=[]}applyGradients(e){(Array.isArray(e)?e.map(t=>t.name):Object.keys(e)).forEach((t,n)=>{let a=j.registeredVariables[t];if(this.accumulatedGrads[n]==null){let i=!1;this.accumulatedGrads[n]={originalName:`${t}/accumulator`,variable:Z(()=>Eh(a.shape,this.initialAccumulatorValue).variable(i))}}let r=Array.isArray(e)?e[n].tensor:e[t];if(r==null)return;let s=this.accumulatedGrads[n].variable;Z(()=>{let i=pe(s,vt(r));s.assign(i);let o=pe(K(Me(r,Mn(pe(i,j.backend.epsilon()))),-this.learningRate),a);a.assign(o)})}),this.incrementIterations()}dispose(){this.accumulatedGrads!=null&&Ge(this.accumulatedGrads.map(e=>e.variable))}async getWeights(){return[await this.saveIterations()].concat(this.accumulatedGrads.map(e=>({name:e.originalName,tensor:e.variable})))}async setWeights(e){e=await this.extractIterations(e);let t=!1;this.accumulatedGrads=e.map(n=>({originalName:n.name,variable:n.tensor.variable(t)}))}getConfig(){return{learningRate:this.learningRate,initialAccumulatorValue:this.initialAccumulatorValue}}static fromConfig(e,t){return new e(t.learningRate,t.initialAccumulatorValue)}};f2.className="Adagrad";zs(f2);var m2=class extends js{constructor(e,t,n,a=null){super();this.learningRate=e,this.beta1=t,this.beta2=n,this.epsilon=a,this.accumulatedFirstMoment=[],this.accumulatedSecondMoment=[],Z(()=>{this.accBeta1=Re(t).variable(),this.accBeta2=Re(n).variable()}),a==null&&(this.epsilon=j.backend.epsilon())}applyGradients(e){let t=Array.isArray(e)?e.map(n=>n.name):Object.keys(e);Z(()=>{let n=Ne(1,this.accBeta1),a=Ne(1,this.accBeta2);t.forEach((r,s)=>{let i=j.registeredVariables[r],o=!1;this.accumulatedFirstMoment[s]==null&&(this.accumulatedFirstMoment[s]={originalName:`${r}/m`,variable:Z(()=>at(i).variable(o))}),this.accumulatedSecondMoment[s]==null&&(this.accumulatedSecondMoment[s]={originalName:`${r}/v`,variable:Z(()=>at(i).variable(o))});let l=Array.isArray(e)?e[s].tensor:e[r];if(l==null)return;let u=this.accumulatedFirstMoment[s].variable,d=this.accumulatedSecondMoment[s].variable,h=pe(K(u,this.beta1),K(l,1-this.beta1)),p=pe(K(d,this.beta2),K(vt(l),1-this.beta2)),c=Me(h,n),m=Me(p,a);u.assign(h),d.assign(p);let f=pe(K(Me(c,pe(Mn(m),this.epsilon)),-this.learningRate),i);i.assign(f)}),this.accBeta1.assign(K(this.accBeta1,this.beta1)),this.accBeta2.assign(K(this.accBeta2,this.beta2))}),this.incrementIterations()}dispose(){this.accBeta1.dispose(),this.accBeta2.dispose(),this.accumulatedFirstMoment!=null&&Ge(this.accumulatedFirstMoment.map(e=>e.variable)),this.accumulatedSecondMoment!=null&&Ge(this.accumulatedSecondMoment.map(e=>e.variable))}async getWeights(){let e=[...this.accumulatedFirstMoment,...this.accumulatedSecondMoment];return[await this.saveIterations()].concat(e.map(t=>({name:t.originalName,tensor:t.variable})))}async setWeights(e){e=await this.extractIterations(e),Z(()=>{this.accBeta1.assign(Vs(this.beta1,this.iterations_+1)),this.accBeta2.assign(Vs(this.beta2,this.iterations_+1))});let t=e.length/2,n=!1;this.accumulatedFirstMoment=e.slice(0,t).map(a=>({originalName:a.name,variable:a.tensor.variable(n)})),this.accumulatedSecondMoment=e.slice(t,t*2).map(a=>({originalName:a.name,variable:a.tensor.variable(n)}))}getConfig(){return{learningRate:this.learningRate,beta1:this.beta1,beta2:this.beta2,epsilon:this.epsilon}}static fromConfig(e,t){return new e(t.learningRate,t.beta1,t.beta2,t.epsilon)}};m2.className="Adam";zs(m2);var g2=class extends js{constructor(e,t,n,a=null,r=0){super();this.learningRate=e,this.beta1=t,this.beta2=n,this.epsilon=a,this.decay=r,this.accumulatedFirstMoment=[],this.accumulatedWeightedInfNorm=[],Z(()=>{this.iteration=Re(0).variable(),this.accBeta1=Re(t).variable()}),a==null&&(this.epsilon=j.backend.epsilon())}applyGradients(e){let t=Array.isArray(e)?e.map(n=>n.name):Object.keys(e);Z(()=>{let n=Ne(1,this.accBeta1),a=Me(-this.learningRate,pe(K(this.iteration,this.decay),1));t.forEach((r,s)=>{let i=j.registeredVariables[r],o=!1;this.accumulatedFirstMoment[s]==null&&(this.accumulatedFirstMoment[s]={originalName:`${r}/m`,variable:at(i).variable(o)}),this.accumulatedWeightedInfNorm[s]==null&&(this.accumulatedWeightedInfNorm[s]={originalName:`${r}/v`,variable:at(i).variable(o)});let l=Array.isArray(e)?e[s].tensor:e[r];if(l==null)return;let u=this.accumulatedFirstMoment[s].variable,d=this.accumulatedWeightedInfNorm[s].variable,h=pe(K(u,this.beta1),K(l,1-this.beta1)),p=K(d,this.beta2),c=yn(l),m=is(p,c);u.assign(h),d.assign(m);let f=pe(K(Me(a,n),Me(h,pe(m,this.epsilon))),i);i.assign(f)}),this.iteration.assign(pe(this.iteration,1)),this.accBeta1.assign(K(this.accBeta1,this.beta1))}),this.incrementIterations()}dispose(){this.accBeta1.dispose(),this.iteration.dispose(),this.accumulatedFirstMoment!=null&&Ge(this.accumulatedFirstMoment.map(e=>e.variable)),this.accumulatedWeightedInfNorm!=null&&Ge(this.accumulatedWeightedInfNorm.map(e=>e.variable))}async getWeights(){throw new Error("getWeights() is not implemented for Adamax yet.")}async setWeights(e){throw new Error("setWeights() is not implemented for Adamax yet.")}getConfig(){return{learningRate:this.learningRate,beta1:this.beta1,beta2:this.beta2,epsilon:this.epsilon,decay:this.decay}}static fromConfig(e,t){return new e(t.learningRate,t.beta1,t.beta2,t.epsilon,t.decay)}};g2.className="Adamax";zs(g2);var Uf=class extends js{constructor(e){super();this.learningRate=e,this.setLearningRate(e)}applyGradients(e){(Array.isArray(e)?e.map(t=>t.name):Object.keys(e)).forEach((t,n)=>{let a=Array.isArray(e)?e[n].tensor:e[t];if(a==null)return;let r=j.registeredVariables[t];Z(()=>{let s=pe(K(this.c,a),r);r.assign(s)})}),this.incrementIterations()}setLearningRate(e){this.learningRate=e,this.c!=null&&this.c.dispose(),this.c=Sn(Re(-e))}dispose(){this.c.dispose()}async getWeights(){return[await this.saveIterations()]}async setWeights(e){if(e=await this.extractIterations(e),e.length!==0)throw new Error("SGD optimizer does not have settable weights.")}getConfig(){return{learningRate:this.learningRate}}static fromConfig(e,t){return new e(t.learningRate)}};Uf.className="SGD";zs(Uf);var y2=class extends Uf{constructor(e,t,n=!1){super(e);this.learningRate=e,this.momentum=t,this.useNesterov=n,this.accumulations=[],this.m=Re(this.momentum)}applyGradients(e){(Array.isArray(e)?e.map(t=>t.name):Object.keys(e)).forEach((t,n)=>{let a=j.registeredVariables[t];if(this.accumulations[n]==null){let i=!1;this.accumulations[n]={originalName:`${t}/momentum`,variable:Z(()=>at(a).variable(i))}}let r=this.accumulations[n].variable,s=Array.isArray(e)?e[n].tensor:e[t];s!=null&&Z(()=>{let i,o=pe(K(this.m,r),s);this.useNesterov?i=pe(K(this.c,pe(s,K(o,this.m))),a):i=pe(K(this.c,o),a),r.assign(o),a.assign(i)})}),this.incrementIterations()}dispose(){this.m.dispose(),this.accumulations!=null&&Ge(this.accumulations.map(e=>e.variable))}setMomentum(e){this.momentum=e}async getWeights(){return[await this.saveIterations()].concat(this.accumulations.map(e=>({name:e.originalName,tensor:e.variable})))}async setWeights(e){e=await this.extractIterations(e);let t=!1;this.accumulations=e.map(n=>({originalName:n.name,variable:n.tensor.variable(t)}))}getConfig(){return{learningRate:this.learningRate,momentum:this.momentum,useNesterov:this.useNesterov}}static fromConfig(e,t){return new e(t.learningRate,t.momentum,t.useNesterov)}};y2.className="Momentum";zs(y2);var A2=class extends js{constructor(e,t=.9,n=0,a=null,r=!1){super();if(this.learningRate=e,this.decay=t,this.momentum=n,this.epsilon=a,this.accumulatedMeanSquares=[],this.accumulatedMoments=[],this.accumulatedMeanGrads=[],this.centered=r,a==null&&(this.epsilon=j.backend.epsilon()),e==null)throw new Error("learningRate for RMSPropOptimizer must be defined.")}applyGradients(e){(Array.isArray(e)?e.map(t=>t.name):Object.keys(e)).forEach((t,n)=>{let a=j.registeredVariables[t],r=!1;this.accumulatedMeanSquares[n]==null&&(this.accumulatedMeanSquares[n]={originalName:`${t}/rms`,variable:Z(()=>at(a).variable(r))}),this.accumulatedMoments[n]==null&&(this.accumulatedMoments[n]={originalName:`${t}/momentum`,variable:Z(()=>at(a).variable(r))}),this.accumulatedMeanGrads[n]==null&&this.centered&&(this.accumulatedMeanGrads[n]={originalName:`${t}/mg`,variable:Z(()=>at(a).variable(r))});let s=Array.isArray(e)?e[n].tensor:e[t];if(s==null)return;let i=this.accumulatedMeanSquares[n].variable,o=this.accumulatedMoments[n].variable;Z(()=>{let l=pe(K(i,this.decay),K(vt(s),1-this.decay));if(this.centered){let u=this.accumulatedMeanGrads[n].variable,d=pe(K(u,this.decay),K(s,1-this.decay)),h=Me(K(s,this.learningRate),Mn(Ne(l,pe(vt(d),this.epsilon)))),p=pe(K(o,this.momentum),h);i.assign(l),u.assign(d),o.assign(p);let c=Ne(a,p);a.assign(c)}else{let u=pe(K(i,this.decay),K(vt(s),1-this.decay)),d=pe(K(o,this.momentum),Me(K(s,this.learningRate),Mn(pe(u,this.epsilon))));i.assign(u),o.assign(d);let h=Ne(a,d);a.assign(h)}})}),this.incrementIterations()}dispose(){this.accumulatedMeanSquares!=null&&Ge(this.accumulatedMeanSquares.map(e=>e.variable)),this.accumulatedMeanGrads!=null&&this.centered&&Ge(this.accumulatedMeanGrads.map(e=>e.variable)),this.accumulatedMoments!=null&&Ge(this.accumulatedMoments.map(e=>e.variable))}async getWeights(){let e=[...this.accumulatedMeanSquares,...this.accumulatedMoments];return this.centered&&e.push(...this.accumulatedMeanGrads),[await this.saveIterations()].concat(e.map(t=>({name:t.originalName,tensor:t.variable})))}async setWeights(e){e=await this.extractIterations(e);let t=this.centered?e.length/3:e.length/2,n=!1;this.accumulatedMeanSquares=e.slice(0,t).map(a=>({originalName:a.name,variable:a.tensor.variable(n)})),this.accumulatedMoments=e.slice(t,t*2).map(a=>({originalName:a.name,variable:a.tensor.variable(n)})),this.centered&&(this.accumulatedMeanGrads=e.slice(t*2,t*3).map(a=>({originalName:a.name,variable:a.tensor.variable(n)})))}getConfig(){return{learningRate:this.learningRate,decay:this.decay,momentum:this.momentum,epsilon:this.epsilon,centered:this.centered}}static fromConfig(e,t){return new e(t.learningRate,t.decay,t.momentum,t.epsilon,t.centered)}};A2.className="RMSProp";zs(A2);var no=class{static sgd(e){return new Uf(e)}static momentum(e,t,n=!1){return new y2(e,t,n)}static rmsprop(e,t=.9,n=0,a=null,r=!1){return new A2(e,t,n,a,r)}static adam(e=.001,t=.9,n=.999,a=null){return new m2(e,t,n,a)}static adadelta(e=.001,t=.95,n=null){return new c2(e,t,n)}static adamax(e=.002,t=.9,n=.999,a=null,r=0){return new g2(e,t,n,a,r)}static adagrad(e,t=.1){return new f2(e,t)}},tu={sgd:no.sgd,momentum:no.momentum,adadelta:no.adadelta,adagrad:no.adagrad,rmsprop:no.rmsprop,adamax:no.adamax,adam:no.adam},dY=(()=>typeof requestAnimationFrame!="undefined"?requestAnimationFrame:typeof setImmediate!="undefined"?setImmediate:e=>e())();function x2(){return new Promise(e=>dY(()=>e()))}var M={};$e(M,{ERF_A1:()=>vY,ERF_A2:()=>wY,ERF_A3:()=>kY,ERF_A4:()=>IY,ERF_A5:()=>SY,ERF_P:()=>bY,PARALLELIZE_THRESHOLD:()=>b2,SELU_SCALE:()=>V8,SELU_SCALEALPHA:()=>B8,applyActivation:()=>Wf,assertAndGetBroadcastShape:()=>Rt,assertAxesAreInnerMostDims:()=>qq,assertParamsConsistent:()=>hY,assignToTypedArray:()=>FY,axesAreInnerMostDims:()=>UA,calculateShapes:()=>E4,checkEinsumDimSizes:()=>LY,combineLocations:()=>p8,complexWithEvenIndex:()=>MY,complexWithOddIndex:()=>$Y,computeConv2DInfo:()=>Ih,computeConv3DInfo:()=>Y4,computeDefaultPad:()=>RA,computeDilation2DInfo:()=>oG,computeOptimalWindowSize:()=>cY,computeOutAndReduceShapes:()=>c8,computeOutShape:()=>pY,computePool2DInfo:()=>Z4,computePool3DInfo:()=>lG,convertConv2DDataFormat:()=>J4,decodeEinsumEquation:()=>zY,eitherStridesOrDilationsAreOne:()=>Mr,expandShapeToKeepDim:()=>Qi,exponent:()=>DY,exponents:()=>OY,fromStringArrayToUint8:()=>KY,fromUint8ToStringArray:()=>qY,getAxesPermutation:()=>f8,getBroadcastDims:()=>sq,getComplexWithIndex:()=>RY,getEinsumComputePath:()=>WY,getEinsumPermutation:()=>PY,getFusedBiasGradient:()=>Lf,getFusedDyActivation:()=>Pf,getImageCenter:()=>fY,getInnerMostAxes:()=>Kq,getPermuted:()=>gY,getReductionAxes:()=>ln,getReshaped:()=>mY,getReshapedPermuted:()=>yY,getSliceBeginCoords:()=>AY,getSliceSize:()=>xY,getUndoAxesPermutation:()=>jA,isIdentityPermutation:()=>BY,log:()=>TY,mergeRealAndImagArrays:()=>EY,prepareAndValidate:()=>N4,prepareSplitSize:()=>UY,segment_util:()=>H8,shouldFuse:()=>Bf,slice_util:()=>Cn,splitRealAndImagArrays:()=>CY,tupleValuesAreOne:()=>Ls,upcastType:()=>Ga,validateInput:()=>TA,validateUpdateShape:()=>NA,warn:()=>NY});function hY(e,t){let n=e[0].length;e.forEach((r,s)=>{P(r.length===n,()=>`Error in concat${n}D: rank of tensors[${s}] must be the same as the rank of the rest (${n})`)}),P(t>=0&&t`Error in concat${n}D: axis must be between 0 and ${n-1}.`);let a=e[0];e.forEach((r,s)=>{for(let i=0;i`Error in concat${n}D: Shape of tensors[${s}] (${r}) does not match the shape of the rest (${a}) along the non-concatenated axis ${s}.`)})}function pY(e,t){let n=e[0].slice();for(let a=1;a=t*2+1||i%2==1?s.push(i):r.push(i);a.push(...r),a.push(0),a.push(...s)}return a}function yY(e,t,n,a=!0){let r=[];a?r.push(e[0]/n):r.push(e[0]*n);for(let s=1;s/g,U8=",",j8="...";function zY(e,t){e=e.replace(/\s/g,"");let n=(e.length-e.replace(_Y,"").length)/v2.length;if(n<1)throw new Error("Equations without an arrow are not supported.");if(n>1)throw new Error(`Equation must contain exactly one arrow ("${v2}").`);let[a,r]=e.split(v2);P(a.indexOf(j8)===-1,()=>`The ellipsis notation ("${j8}") is not supported yet.`);let s=a.split(U8),i=s.length;if(t!==i)throw new Error(`Expected ${i} input tensors, received ${t}`);if(i>2)throw new Error("Support for more than 2 input tensors is not implemented yet.");let o=[];for(let p=0;pm.indexOf(c)!==-1))throw new Error(`Output subscripts contain the label ${c} not present in the input subscripts.`);o.indexOf(c)===-1&&o.push(c)}for(let p=0;pr!==-1),{permutationIndices:n,expandDims:a}}function LY(e,t,n){let a=new Array(e);for(let r=0;r`Expected dimension ${a[t[r][i]]} at axis ${i} of input shaped ${JSON.stringify(s)}, but got dimension ${s[i]}`)}}function WY(e,t){let n=e,a=[],r=0;e.length===0&&n.push(-1),r=e.length+1;for(let i=0;it===n)}function VY(e,t){let n=[];for(let a=0;a"Number of splits must evenly divide the axis."),a=new Array(t).fill(e.shape[n]/t);else{let r=t.reduce((i,o)=>(o===-1&&(i+=1),i),0);P(r<=1,()=>"There should be only one negative value in split array.");let s=t.indexOf(-1);if(s!==-1){let i=t.reduce((o,l)=>l>0?o+l:o);t[s]=e.shape[n]-i}P(e.shape[n]===t.reduce((i,o)=>i+o),()=>"The sum of sizes must match the size of the axis dimension."),a=t}return a}var H8={};$e(H8,{collectGatherOpShapeInfo:()=>GY,computeOutShape:()=>HY,segOpComputeOptimalWindowSize:()=>jY});function jY(e,t){let n=!1,a;for(e<=b2?(a=e,n=!0):a=Hc(e,Math.floor(Math.sqrt(e)));!n;)a>t||a===e?n=!0:a=Hc(e,a+1);return a}function HY(e,t,n){let a=[],r=e.length;for(let s=0;sr))throw new Error(`Expect batchDims in the range of [-${r}, ${r}], but got ${a}`);if(a<0&&(a+=r),a>s)throw new Error(`batchDims (${a}) must be less than rank(x) ( - ${s}).`);if(nff(t))}catch(t){throw new Error(`Failed to decode encoded string bytes into utf-8, error: ${t}`)}}function KY(e){return e.map(t=>cf(t))}var us={};$e(us,{nonMaxSuppressionV3Impl:()=>O8,nonMaxSuppressionV4Impl:()=>D8,nonMaxSuppressionV5Impl:()=>_8,whereImpl:()=>E8});re().prototype.abs=function(){return this.throwIfDisposed(),yn(this)};re().prototype.acos=function(){return this.throwIfDisposed(),V4(this)};re().prototype.acosh=function(){return this.throwIfDisposed(),U4(this)};re().prototype.add=function(e){return this.throwIfDisposed(),pe(this,e)};re().prototype.all=function(e,t){return this.throwIfDisposed(),$A(this,e,t)};re().prototype.any=function(e,t){return this.throwIfDisposed(),wf(this,e,t)};re().prototype.argMax=function(e){return this.throwIfDisposed(),kf(this,e)};re().prototype.argMin=function(e){return this.throwIfDisposed(),j4(this,e)};re().prototype.asScalar=function(){return this.throwIfDisposed(),P(this.size===1,()=>"The array must have only 1 element."),Y(this,[])};re().prototype.asType=function(e){return this.throwIfDisposed(),we(this,e)};re().prototype.as1D=function(){return this.throwIfDisposed(),Y(this,[this.size])};re().prototype.as2D=function(e,t){return this.throwIfDisposed(),Y(this,[e,t])};re().prototype.as3D=function(e,t,n){return this.throwIfDisposed(),Y(this,[e,t,n])};re().prototype.as4D=function(e,t,n,a){return this.throwIfDisposed(),Y(this,[e,t,n,a])};re().prototype.as5D=function(e,t,n,a,r){return this.throwIfDisposed(),Y(this,[e,t,n,a,r])};re().prototype.asin=function(){return this.throwIfDisposed(),H4(this)};re().prototype.asinh=function(){return this.throwIfDisposed(),G4(this)};re().prototype.atan=function(){return this.throwIfDisposed(),q4(this)};re().prototype.atan2=function(e){return this.throwIfDisposed(),K4(this,e)};re().prototype.atanh=function(){return this.throwIfDisposed(),X4(this)};re().prototype.avgPool=function(e,t,n,a){return this.throwIfDisposed(),Sf(this,e,t,n,a)};re().prototype.batchToSpaceND=function(e,t){return this.throwIfDisposed(),Nf(this,e,t)};re().prototype.batchNorm=function(e,t,n,a,r){return this.throwIfDisposed(),Xl(this,e,t,n,a,r)};re().prototype.broadcastTo=function(e){return this.throwIfDisposed(),Sh(this,e)};re().prototype.cast=function(e){return this.throwIfDisposed(),we(this,e)};re().prototype.ceil=function(){return this.throwIfDisposed(),t8(this)};re().prototype.clipByValue=function(e,t){return this.throwIfDisposed(),ua(this,e,t)};re().prototype.concat=function(e,t){return this.throwIfDisposed(),e instanceof Tt&&(e=[e]),en([this,...e],t)};re().prototype.conv1d=function(e,t,n,a,r,s){return this.throwIfDisposed(),OA(this,e,t,n,a,r,s)};re().prototype.conv2dTranspose=function(e,t,n,a,r){return this.throwIfDisposed(),_A(this,e,t,n,a,r)};re().prototype.conv2d=function(e,t,n,a,r,s){return this.throwIfDisposed(),Ws(this,e,t,n,a,r,s)};re().prototype.cos=function(){return this.throwIfDisposed(),Tf(this)};re().prototype.cosh=function(){return this.throwIfDisposed(),zA(this)};re().prototype.cumsum=function(e,t,n){return this.throwIfDisposed(),PA(this,e,t,n)};re().prototype.depthToSpace=function(e,t){return this.throwIfDisposed(),r8(this,e,t)};re().prototype.depthwiseConv2d=function(e,t,n,a,r,s){return this.throwIfDisposed(),Nh(this,e,t,n,a,r,s)};re().prototype.dilation2d=function(e,t,n,a,r){return this.throwIfDisposed(),s8(this,e,t,n,a,r)};re().prototype.divNoNan=function(e){return this.throwIfDisposed(),i8(this,e)};re().prototype.div=function(e){return this.throwIfDisposed(),Me(this,e)};re().prototype.dot=function(e){return this.throwIfDisposed(),hq(this,e)};re().prototype.elu=function(){return this.throwIfDisposed(),Th(this)};re().prototype.equal=function(e){return this.throwIfDisposed(),Xi(this,e)};re().prototype.erf=function(){return this.throwIfDisposed(),o8(this)};re().prototype.exp=function(){return this.throwIfDisposed(),qa(this)};re().prototype.expandDims=function(e){return this.throwIfDisposed(),Ea(this,e)};re().prototype.expm1=function(){return this.throwIfDisposed(),l8(this)};re().prototype.fft=function(){return this.throwIfDisposed(),r2(this)};re().prototype.flatten=function(){return this.throwIfDisposed(),Y(this,[this.size])};re().prototype.floor=function(){return this.throwIfDisposed(),Ch(this)};re().prototype.floorDiv=function(e){return this.throwIfDisposed(),MA(this,e)};re().prototype.gather=function(e,t){return this.throwIfDisposed(),Mh(this,e,t)};re().prototype.greaterEqual=function(e){return this.throwIfDisposed(),Yi(this,e)};re().prototype.greater=function(e){return this.throwIfDisposed(),Ca(this,e)};re().prototype.ifft=function(){return this.throwIfDisposed(),zf(this)};re().prototype.irfft=function(){return this.throwIfDisposed(),k8(this)};re().prototype.isFinite=function(){return this.throwIfDisposed(),Tq(this)};re().prototype.isInf=function(){return this.throwIfDisposed(),Cq(this)};re().prototype.isNaN=function(){return this.throwIfDisposed(),d8(this)};re().prototype.leakyRelu=function(e){return this.throwIfDisposed(),Ef(this,e)};re().prototype.lessEqual=function(e){return this.throwIfDisposed(),Ji(this,e)};re().prototype.less=function(e){return this.throwIfDisposed(),WA(this,e)};re().prototype.localResponseNormalization=function(e,t,n,a){return this.throwIfDisposed(),h8(this,e,t,n,a)};re().prototype.logSigmoid=function(){return this.throwIfDisposed(),Vq(this)};re().prototype.logSoftmax=function(e){return this.throwIfDisposed(),VA(this,e)};re().prototype.logSumExp=function(e,t){return this.throwIfDisposed(),m8(this,e,t)};re().prototype.log=function(){return this.throwIfDisposed(),Ma(this)};re().prototype.log1p=function(){return this.throwIfDisposed(),BA(this)};re().prototype.logicalAnd=function(e){return this.throwIfDisposed(),ir(this,e)};re().prototype.logicalNot=function(){return this.throwIfDisposed(),Cf(this)};re().prototype.logicalOr=function(e){return this.throwIfDisposed(),HA(this,e)};re().prototype.logicalXor=function(e){return this.throwIfDisposed(),eK(this,e)};re().prototype.matMul=function(e,t,n){return this.throwIfDisposed(),it(this,e,t,n)};re().prototype.maxPool=function(e,t,n,a){return this.throwIfDisposed(),Mf(this,e,t,n,a)};re().prototype.max=function(e,t){return this.throwIfDisposed(),sr(this,e,t)};re().prototype.maximum=function(e){return this.throwIfDisposed(),is(this,e)};re().prototype.mean=function(e,t){return this.throwIfDisposed(),Xt(this,e,t)};re().prototype.min=function(e,t){return this.throwIfDisposed(),$f(this,e,t)};re().prototype.minimum=function(e){return this.throwIfDisposed(),$h(this,e)};re().prototype.mirrorPad=function(e,t){return this.throwIfDisposed(),y8(this,e,t)};re().prototype.mod=function(e){return this.throwIfDisposed(),A8(this,e)};re().prototype.mul=function(e){return this.throwIfDisposed(),K(this,e)};re().prototype.neg=function(){return this.throwIfDisposed(),Kt(this)};re().prototype.norm=function(e,t,n){return this.throwIfDisposed(),u2(this,e,t,n)};re().prototype.notEqual=function(e){return this.throwIfDisposed(),Yl(this,e)};re().prototype.oneHot=function(e,t=1,n=0){return this.throwIfDisposed(),kh(this,e,t,n)};re().prototype.onesLike=function(){return this.throwIfDisposed(),$a(this)};re().prototype.pad=function(e,t){return this.throwIfDisposed(),Bs(this,e,t)};re().prototype.pool=function(e,t,n,a,r){return this.throwIfDisposed(),EK(this,e,t,n,a,r)};re().prototype.pow=function(e){return this.throwIfDisposed(),Vs(this,e)};re().prototype.prelu=function(e){return this.throwIfDisposed(),Ff(this,e)};re().prototype.prod=function(e,t){return this.throwIfDisposed(),qA(this,e,t)};re().prototype.reciprocal=function(){return this.throwIfDisposed(),x8(this)};re().prototype.relu=function(){return this.throwIfDisposed(),ls(this)};re().prototype.relu6=function(){return this.throwIfDisposed(),ZA(this)};re().prototype.reshapeAs=function(e){return this.throwIfDisposed(),Y(this,e.shape)};re().prototype.reshape=function(e){return this.throwIfDisposed(),Y(this,e)};re().prototype.resizeBilinear=function(e,t,n){return this.throwIfDisposed(),P8(this,e,t,n)};re().prototype.resizeNearestNeighbor=function(e,t,n){return this.throwIfDisposed(),L8(this,e,t,n)};re().prototype.reverse=function(e){return this.throwIfDisposed(),Ra(this,e)};re().prototype.rfft=function(){return this.throwIfDisposed(),s2(this)};re().prototype.round=function(){return this.throwIfDisposed(),YA(this)};re().prototype.rsqrt=function(){return this.throwIfDisposed(),JA(this)};re().prototype.selu=function(){return this.throwIfDisposed(),QA(this)};re().prototype.separableConv2d=function(e,t,n,a,r,s){return this.throwIfDisposed(),b8(this,e,t,n,a,r,s)};re().prototype.sigmoid=function(){return this.throwIfDisposed(),$r(this)};re().prototype.sign=function(){return this.throwIfDisposed(),v8(this)};re().prototype.sin=function(){return this.throwIfDisposed(),e2(this)};re().prototype.sinh=function(){return this.throwIfDisposed(),t2(this)};re().prototype.slice=function(e,t){return this.throwIfDisposed(),nt(this,e,t)};re().prototype.softmax=function(e){return this.throwIfDisposed(),_f(this,e)};re().prototype.softplus=function(){return this.throwIfDisposed(),Zl(this)};re().prototype.spaceToBatchND=function(e,t){return this.throwIfDisposed(),Rf(this,e,t)};re().prototype.split=function(e,t){return this.throwIfDisposed(),da(this,e,t)};re().prototype.sqrt=function(){return this.throwIfDisposed(),Mn(this)};re().prototype.square=function(){return this.throwIfDisposed(),vt(this)};re().prototype.squaredDifference=function(e){return this.throwIfDisposed(),i2(this,e)};re().prototype.squeeze=function(e){return this.throwIfDisposed(),Jl(this,e)};re().prototype.stack=function(e,t){this.throwIfDisposed();let n=e instanceof Tt?[this,e]:[this,...e];return Fa(n,t)};re().prototype.step=function(e){return this.throwIfDisposed(),Oh(this,e)};re().prototype.stridedSlice=function(e,t,n,a,r,s,i,o){return this.throwIfDisposed(),I8(this,e,t,n,a,r,s,i,o)};re().prototype.sub=function(e){return this.throwIfDisposed(),Ne(this,e)};re().prototype.sum=function(e,t){return this.throwIfDisposed(),Ce(this,e,t)};re().prototype.tan=function(){return this.throwIfDisposed(),S8(this)};re().prototype.tanh=function(){return this.throwIfDisposed(),Kl(this)};re().prototype.tile=function(e){return this.throwIfDisposed(),Zi(this,e)};re().prototype.toBool=function(){return this.throwIfDisposed(),we(this,"bool")};re().prototype.toFloat=function(){return this.throwIfDisposed(),we(this,"float32")};re().prototype.toInt=function(){return this.throwIfDisposed(),we(this,"int32")};re().prototype.topk=function(e,t){return this.throwIfDisposed(),N8(this,e,t)};re().prototype.transpose=function(e){return this.throwIfDisposed(),ct(this,e)};re().prototype.unique=function(e){return this.throwIfDisposed(),l2(this,e)};re().prototype.unsortedSegmentSum=function(e,t){return this.throwIfDisposed(),T8(this,e,t)};re().prototype.unstack=function(e){return this.throwIfDisposed(),or(this,e)};re().prototype.where=function(e,t){return this.throwIfDisposed(),Pn(e,this,t)};re().prototype.zerosLike=function(){return this.throwIfDisposed(),at(this)};var G8={kernelName:xd,inputsToSave:["x"],gradFunc:(e,t)=>{let[n]=t;return{x:()=>K(e,Oh(we(n,"float32"),-1))}}},XY={kernelName:bd,inputsToSave:["x"],gradFunc:(e,t)=>{let[n]=t;return{x:()=>{let a=vt(we(n,"float32")),r=Mn(Ne(Re(1),a));return Kt(Me(e,r))}}}},ZY={kernelName:vd,inputsToSave:["x"],gradFunc:(e,t)=>{let[n]=t;return{x:()=>{let a=Mn(Ne(vt(we(n,"float32")),1));return Me(e,a)}}}},YY={kernelName:Os,inputsToSave:["a","b"],gradFunc:(e,t)=>{let[n,a]=t,r=Rt(n.shape,a.shape);return{a:()=>{let s=e,i=ln(n.shape,r);return i.length>0&&(s=Ce(s,i)),Y(s,n.shape)},b:()=>{let s=e,i=ln(a.shape,r);return i.length>0&&(s=Ce(s,i)),Y(s,a.shape)}}}},JY={kernelName:Zo,saveAllInputs:!0,gradFunc:(e,t)=>{let n={};return t.forEach((a,r)=>{n[r]=()=>e.clone()}),n}},QY={kernelName:Yo,inputsToSave:["x"],gradFunc:(e,t)=>{let[n]=t;return{x:()=>at(n)}}},eJ={kernelName:qc,inputsToSave:["x"],gradFunc:(e,t)=>{let[n]=t;return{x:()=>at(n)}}},tJ={kernelName:Id,inputsToSave:["x"],gradFunc:(e,t)=>{let[n]=t;return{x:()=>Me(e,Mn(Ne(Re(1),vt(we(n,"float32")))))}}},nJ={kernelName:Sd,inputsToSave:["x"],gradFunc:(e,t)=>{let[n]=t;return{x:()=>{let a=Mn(pe(Re(1),vt(we(n,"float32"))));return Me(e,a)}}}},aJ={kernelName:Ed,inputsToSave:["a","b"],gradFunc:(e,t)=>{let[n,a]=t,r=Rt(n.shape,a.shape);return{a:()=>{let s=pe(vt(n),vt(a)),i=K(e,Me(a,s)),o=ln(n.shape,r);return o.length>0&&(i=Ce(i,o)),Y(i,n.shape)},b:()=>{let s=pe(vt(n),vt(a)),i=Kt(K(e,Me(n,s))),o=ln(a.shape,r);return o.length>0&&(i=Ce(i,o)),Y(i,a.shape)}}}},rJ={kernelName:Nd,inputsToSave:["x"],gradFunc:(e,t)=>{let[n]=t;return{x:()=>Me(e,pe(vt(we(n,"float32")),1))}}},sJ={kernelName:Td,inputsToSave:["x"],gradFunc:(e,t)=>{let[n]=t;return{x:()=>Me(e,Ne(Re(1),vt(we(n,"float32"))))}}};function iJ(e,t,n,a,r,s){let i=F(e,"dy","avgPool3dGrad"),o=F(t,"input","avgPool3dGrad"),l=i,u=o,d=!1;o.rank===4&&(d=!0,l=Y(i,[1,i.shape[0],i.shape[1],i.shape[2],i.shape[3]]),u=Y(o,[1,o.shape[0],o.shape[1],o.shape[2],o.shape[3]])),P(l.rank===5,()=>`Error in avgPool3dGrad: dy must be rank 5 but got rank ${l.rank}.`),P(u.rank===5,()=>`Error in avgPool3dGrad: input must be rank 5 but got rank ${u.rank}.`),s!=null&&P(mn(r),()=>`Error in avgPool3dGrad: pad must be an integer when using, dimRoundingMode ${s} but got pad ${r}.`);let h={dy:l,input:u},p={filterSize:n,strides:a,pad:r,dimRoundingMode:s},c=j.runKernel(v1,h,p);return d?Y(c,[c.shape[1],c.shape[2],c.shape[3],c.shape[4]]):c}var oJ=B({avgPool3dGrad_:iJ}),lJ={kernelName:Kc,inputsToSave:["x"],gradFunc:(e,t,n)=>{let[a]=t,{filterSize:r,strides:s,pad:i,dimRoundingMode:o}=n;return{x:()=>oJ(e,a,r,s,i,o)}}};function uJ(e,t,n,a,r){let s=F(e,"dy","avgPoolGrad"),i=F(t,"input","avgPoolGrad");P(i.rank===s.rank,()=>`Rank of input (${i.rank}) does not match rank of dy (${s.rank})`);let o=i,l=s,u=!1;i.rank===3&&(u=!0,o=Y(i,[1,i.shape[0],i.shape[1],i.shape[2]]),l=Y(s,[1,s.shape[0],s.shape[1],s.shape[2]])),P(l.rank===4,()=>`Error in avgPoolGrad: dy must be rank 4 but got rank ${l.rank}.`),P(o.rank===4,()=>`Error in avgPoolGrad: input must be rank 4 but got rank ${o.rank}.`);let d={dy:l,input:o},h={filterSize:n,strides:a,pad:r},p=j.runKernel(b1,d,h);return u?Y(p,[p.shape[1],p.shape[2],p.shape[3]]):p}var dJ=B({avgPoolGrad_:uJ}),hJ={kernelName:Jo,inputsToSave:["x"],gradFunc:(e,t,n)=>{let[a]=t,{filterSize:r,strides:s,pad:i}=n;return{x:()=>dJ(e,a,r,s,i)}}},pJ={kernelName:Qo,inputsToSave:["a","b"],gradFunc:(e,t,n)=>{let[a,r]=t,{transposeA:s,transposeB:i}=n;return!s&&!i?{a:()=>it(e,r,!1,!0),b:()=>it(a,e,!0,!1)}:!s&&i?{a:()=>it(e,r,!1,!1),b:()=>it(e,a,!0,!1)}:s&&!i?{a:()=>it(r,e,!1,!0),b:()=>it(a,e,!1,!1)}:{a:()=>it(r,e,!0,!0),b:()=>it(e,a,!0,!0)}}},cJ={kernelName:Xc,gradFunc:(e,t,n)=>{let{blockShape:a,crops:r}=n;return{x:()=>Rf(e,a,r)}}},fJ={kernelName:ej,gradFunc:(e,t,n)=>{let a=n,r=a.inputShape,s=a.shape,i=Array.from(s);for(let l=r.length-1;l>=0;l--)if(r[l]===s[l])i[l]=1;else if(r[l]!==1)throw new Error(`broadcastTo(): [${r}] cannot be broadcast to [${s}].`);let o=[];for(let l=0;l1&&o.push(l);return{x:()=>Ce(e,o,!0)}}},mJ={kernelName:el,gradFunc:e=>({x:()=>e.clone()})},gJ={kernelName:Ni,gradFunc:e=>({x:()=>at(e)})},yJ={kernelName:Ti,inputsToSave:["x"],gradFunc:(e,t,n)=>{let[a]=t,{clipValueMin:r,clipValueMax:s}=n;return{x:()=>Pn(ir(Yi(a,r),Ji(a,s)),e,at(e))}}},AJ={kernelName:Zc,inputsToSave:["x"],gradFunc:G8.gradFunc},xJ={kernelName:Cd,saveAllInputs:!0,gradFunc:(e,t,n)=>{let a=t.map(o=>o.shape),{axis:r}=n,s=Ha(r,t[0].shape)[0],i=a.map(o=>o[s]);return da(e,i,s).map(o=>()=>o)}},bJ={kernelName:tl,inputsToSave:["x","filter"],gradFunc:(e,t,n)=>{let[a,r]=t,{dilations:s,strides:i,pad:o,dataFormat:l}=n;return P(Ls(s),()=>`Error in gradient of conv2D: dilation rates greater than 1 are not yet supported in gradients. Got dilations '${s}'`),{x:()=>DA(a.shape,e,r,i,o,l),filter:()=>d2(a,e,r.shape,i,o,l)}}},vJ={kernelName:nl,inputsToSave:["dy","filter"],gradFunc:(e,t,n)=>{let[a,r]=t,{strides:s,pad:i,dataFormat:o,dimRoundingMode:l}=n;return{dy:()=>Ws(e,r,s,i,o,1,l),filter:()=>d2(e,a,r.shape,s,i,o,l)}}};function wJ(e,t,n,a,r){let s=e;e.rank===4&&(s=Y(e,[1,e.shape[0],e.shape[1],e.shape[2],e.shape[3]]));let i=t;i.rank===4&&(i=Y(t,[1,t.shape[0],t.shape[1],t.shape[2],t.shape[3]])),P(s.rank===5,()=>`Error in conv3dDerFilter: input must be rank 5, but got shape ${s.shape}.`),P(i.rank===5,()=>`Error in conv3dDerFilter: dy must be rank 5, but got shape ${i.shape}.`),P(n.length===5,()=>`Error in conv3dDerFilter: filterShape must be length 5, but got ${n}.`),P(s.shape[4]===n[3],()=>`Error in conv3dDerFilter: depth of input ${s.shape[4]}) must match input depth in filter (${n[3]}.`),P(i.shape[4]===n[4],()=>`Error in conv3dDerFilter: depth of dy (${i.shape[4]}) must match output depth for filter (${n[4]}).`);let o={x:s,dy:i},l={strides:a,pad:r,filterShape:n};return j.runKernel(S1,o,l)}var kJ=B({conv3DBackpropFilter_:wJ}),IJ={kernelName:Yc,inputsToSave:["x","filter"],gradFunc:(e,t,n)=>{let{dilations:a,strides:r,pad:s}=n;P(Ls(a),()=>`Error in gradient of conv3D: dilation rates greater than 1 are not yet supported in gradients. Got dilations '${a}'`);let[i,o]=t;return{x:()=>a8(i.shape,e,o,r,s),filter:()=>kJ(i,e,o.shape,r,s)}}},SJ={kernelName:al,inputsToSave:["x"],gradFunc:(e,t)=>{let[n]=t;return{x:()=>K(Kt(e2(we(n,"float32"))),e)}}},NJ={kernelName:Md,inputsToSave:["x"],gradFunc:(e,t)=>{let[n]=t;return{x:()=>K(t2(we(n,"float32")),e)}}},TJ={kernelName:rl,inputsToSave:["x"],gradFunc:(e,t,n)=>{let[a]=t,{axis:r,exclusive:s,reverse:i}=n;return{x:()=>{let o=f8([r],a.rank),l=PA(e,r,s,!i);return o!=null&&(l=ct(l,o)),l}}}},EJ={kernelName:sl,inputsToSave:["x","filter"],gradFunc:(e,t,n)=>{let{dilations:a,strides:r,pad:s,dimRoundingMode:i}=n,o=a==null?[1,1]:a;P(Ls(o),()=>`Error in gradient of depthwiseConv2dNative: dilation rates greater than 1 are not yet supported. Got dilations '${o}'`);let[l,u]=t;return P(l.rank===4,()=>`Error in gradient of depthwiseConv2dNative: input must be rank 4, but got rank ${l.rank}.`),P(u.rank===4,()=>`Error in gradient of depthwiseConv2dNative: filter must be rank 4, but got rank ${u.rank}.`),P(l.shape[3]===u.shape[2],()=>`Error in gradient of depthwiseConv2d: number of input channels (${l.shape[3]}) must match the inChannels dimension in filter ${u.shape[2]}.`),P(Mr(r,o),()=>`Error in gradient of depthwiseConv2d: Either strides or dilations must be 1. Got strides ${r} and dilations '${o}'.`),i!=null&&P(mn(s),()=>`Error in depthwiseConv2d: pad must be an integer when using, dimRoundingMode ${i} but got pad ${s}.`),{x:()=>F8(l.shape,e,u,r,s,a,i),filter:()=>R8(l,e,u.shape,r,s,a,i)}}},CJ={kernelName:Jc,inputsToSave:["x","filter"],gradFunc:(e,t,n)=>{let[a,r]=t,s={x:a,filter:r,dy:e},i={x:a,filter:r,dy:e};return{x:()=>j.runKernel($1,s,n),filter:()=>j.runKernel(R1,i,n)}}},MJ={kernelName:Fd,outputsToSave:[!0],gradFunc:(e,t)=>{let[n]=t,a={dy:e,y:n};return{x:()=>j.runKernel(O1,a)}}},$J={kernelName:Od,inputsToSave:["x"],gradFunc:(e,t)=>{let[n]=t,a=K(qa(Kt(vt(n))),2/Math.sqrt(Math.PI));return{x:()=>K(e,a)}}},RJ={kernelName:Ei,outputsToSave:[!0],gradFunc:(e,t)=>{let[n]=t;return{x:()=>K(e,n)}}},FJ={kernelName:Dd,inputsToSave:["input"],gradFunc:(e,t)=>{let[n]=t;return{input:()=>Y(e,n.shape)}}},OJ={kernelName:ll,inputsToSave:["x"],gradFunc:(e,t)=>{let[n]=t;return{x:()=>K(e,qa(n))}}},DJ={kernelName:Ci,gradFunc:e=>({x:()=>at(e)})},_J={kernelName:ul,inputsToSave:["a","b"],gradFunc:(e,t)=>{let[n,a]=t,r=Rt(n.shape,a.shape);return{a:()=>{let s=Me(e,we(a,"float32")),i=ln(n.shape,r);return i.length>0?Y(Ce(s,i),n.shape):s},b:()=>{let s=K(e,we(n,"float32")),i=ln(a.shape,r);i.length>0&&(s=Y(Ce(s,i),a.shape));let o=vt(a);return Kt(Me(s,we(o,"float32")))}}}},zJ={kernelName:dl,inputsToSave:["x","mean","variance","scale"],gradFunc:(e,t,n)=>{let{varianceEpsilon:a}=n,[r,s,i,o]=t,l=o==null?Re(1):o,u=ln(s.shape,r.shape),d=[];if(s.rank===1){for(let f=0;fs.rank===1?Y(K(K(e,Zi(Y(c,[1,1,1,s.shape[0]]),d)),l),r.shape):Y(K(K(e,c),l),r.shape),mean:()=>{let f=K(K(c,Re(-1)),p);return s.rank===1&&(f=Ce(f,u)),Y(f,s.shape)},variance:()=>{let f=K(K(m,h),p);return s.rank===1&&(f=Ce(f,u)),Y(f,s.shape)},scale:()=>{let f=K(h,c),g=K(e,f);return s.rank===1&&(g=Ce(g,u)),Y(g,s.shape)},offset:()=>{let f=e;return s.rank===1&&(f=Ce(f,u)),Y(f,s.shape)}}}},PJ={kernelName:zd,inputsToSave:["x","indices"],gradFunc:(e,t,n)=>{let[a,r]=t,{axis:s}=n,i=Ha(s,a.shape)[0];return{x:()=>{let o=a.shape,l=r.size,u=o.slice(0,i),d=u.length,h=o.slice(s,o.length).slice(1),p=h.length,c=q8(0,d),m=q8(d+1,d+1+p),f=K8([u,[l],h]),g=Y(e,f),y=Y(r,[l]),A=K8([[d],c,m]),x=ct(g,A),v=T8(x,y,a.shape[i]),b=jA(A);return v=ct(v,b),v},indices:()=>r}}};function q8(e,t){let n=[];for(let a=e;a{let[n,a]=t;return{a:()=>at(n),b:()=>at(a)}}},WJ={kernelName:pl,gradFunc:e=>({x:()=>we(e,"float32")})},BJ={kernelName:Ld,gradFunc:e=>({x:()=>at(e)})},VJ={kernelName:Wd,gradFunc:e=>({x:()=>at(e)})},UJ={kernelName:Bd,gradFunc:e=>({x:()=>at(e)})},jJ={kernelName:cl,inputsToSave:["x"],gradFunc:(e,t,n)=>{let[a]=t,{alpha:r}=n,s=Ca(a,0);return{x:()=>Pn(s,e,K(e,r))}}},HJ={kernelName:Vd,inputsToSave:["x"],gradFunc:(e,t)=>{let[n]=t;return{x:()=>Me(e,pe(n,1))}}},GJ={kernelName:$i,inputsToSave:["x"],gradFunc:(e,t)=>{let[n]=t;return{x:()=>Me(e,we(n,"float32"))}}},qJ={kernelName:tj,inputsToSave:[],outputsToSave:[!0],gradFunc:(e,t,n)=>{let[a]=t,{axis:r}=n;return{logits:()=>{let s=!0,i=qa(a);return Ne(e,K(Ce(e,r,s),i))}}}};function KJ(e,t,n,a=5,r=1,s=1,i=.5){let o={x:e,y:t,dy:n},l={depthRadius:a,bias:r,alpha:s,beta:i};return j.runKernel(L1,o,l)}var XJ=B({localResponseNormalizationBackprop_:KJ}),ZJ={kernelName:nf,inputsToSave:["x"],outputsToSave:[!0],gradFunc:(e,t,n)=>{let[a,r]=t,{depthRadius:s,bias:i,alpha:o,beta:l}=n;return{x:()=>XJ(a,r,e,s,i,o,l)}}};function X8(e,t,n,a){return t.rankK(e,we(Xi(n,t),e.dtype))}}var Z8={kernelName:gl,inputsToSave:["x"],outputsToSave:[!0],gradFunc:(e,t,n)=>{let a=n,{reductionIndices:r}=a,s=t[0],i=t[1],o=Ha(r,s.shape),l=X8(e,i,s,o);return{x:()=>l.x()}}},YJ={kernelName:Ri,inputsToSave:["a","b"],gradFunc:(e,t)=>{let[n,a]=t;return{a:()=>K(e,we(Yi(n,a),"float32")),b:()=>K(e,we(WA(n,a),"float32"))}}};function JJ(e,t,n,a,r,s,i){let o=F(e,"dy","maxPool3dGrad"),l=F(t,"input","maxPool3dGrad"),u=F(n,"output","maxPool3dGrad"),d=o,h=l,p=u,c=!1;l.rank===4&&(c=!0,d=Y(o,[1,o.shape[0],o.shape[1],o.shape[2],o.shape[3]]),h=Y(l,[1,l.shape[0],l.shape[1],l.shape[2],l.shape[3]]),p=Y(u,[1,u.shape[0],u.shape[1],u.shape[2],u.shape[3]])),P(d.rank===5,()=>`Error in maxPool3dGrad: dy must be rank 5 but got rank ${d.rank}.`),P(h.rank===5,()=>`Error in maxPool3dGrad: input must be rank 5 but got rank ${h.rank}.`),P(p.rank===5,()=>`Error in maxPool3dGrad: output must be rank 5 but got rank ${p.rank}.`),i!=null&&P(mn(s),()=>`Error in maxPool3dGrad: pad must be an integer when using, dimRoundingMode ${i} but got pad ${s}.`);let m={dy:d,input:h,output:p},f={filterSize:a,strides:r,pad:s,dimRoundingMode:i},g=j.runKernel(B1,m,f);return c?Y(g,[g.shape[1],g.shape[2],g.shape[3],g.shape[4]]):g}var QJ=B({maxPool3dGrad_:JJ}),eQ={kernelName:af,inputsToSave:["x"],outputsToSave:[!0],gradFunc:(e,t,n)=>{let[a,r]=t,{filterSize:s,strides:i,pad:o,dimRoundingMode:l}=n;return{x:()=>QJ(e,a,r,s,i,o,l)}}};function tQ(e,t,n,a,r,s,i){let o=F(e,"dy","maxPoolGrad"),l=F(t,"input","maxPoolGrad"),u=F(n,"output","maxPoolGrad");P(l.rank===o.rank,()=>`Rank of input (${l.rank}) does not match rank of dy (${o.rank})`),P(o.rank===4,()=>`Error in maxPoolGrad: dy must be rank 4 but got rank ${o.rank}.`),P(l.rank===4,()=>`Error in maxPoolGrad: input must be rank 4 but got rank ${l.rank}.`),i!=null&&P(mn(s),()=>`Error in maxPoolGrad: pad must be an integer when using, dimRoundingMode ${i} but got pad ${s}.`);let d={dy:o,input:l,output:u},h={filterSize:a,strides:r,pad:s,dimRoundingMode:i};return j.runKernel(W1,d,h)}var nQ=B({maxPoolGrad_:tQ}),aQ={kernelName:yl,inputsToSave:["x"],outputsToSave:[!0],gradFunc:(e,t,n)=>{let[a,r]=t,{filterSize:s,strides:i,pad:o}=n;return{x:()=>nQ(e,a,r,s,i,o)}}},rQ={kernelName:Al,inputsToSave:["x"],gradFunc:(e,t,n)=>{let[a]=t,{axis:r}=n,s=Ha(r,a.shape),i=c8(a.shape,s)[1],o=on(i);return{x:()=>{let l=a.shape.slice();s.forEach(d=>{l[d]=1});let u=Y(e,l);return Me(K(u,os(a.shape,"float32")),o)}}}},sQ={kernelName:xl,inputsToSave:["x"],outputsToSave:[!0],gradFunc:(e,t,n)=>{let a=n,{axis:r}=a,[s,i]=t,o=Ha(r,s.shape),l=X8(e,i,s,o);return{x:()=>l.x()}}},iQ={kernelName:Fi,inputsToSave:["a","b"],gradFunc:(e,t)=>{let[n,a]=t;return{a:()=>K(e,we(Ji(n,a),"float32")),b:()=>K(e,we(Ca(n,a),"float32"))}}},oQ={kernelName:bl,inputsToSave:["x"],gradFunc:(e,t,n)=>{let a=t[0],{paddings:r}=n,s=r.map(i=>i[0]);return{x:()=>nt(e,s,a.shape)}}},lQ={kernelName:jd,inputsToSave:["a","b"],gradFunc:(e,t)=>{let[n,a]=t,r=Rt(n.shape,a.shape);return{a:()=>{let s=ln(n.shape,r);return s.length>0?Y(Ce(e,s),n.shape):e},b:()=>{let s=K(e,Kt(Ch(Me(n,a)))),i=ln(a.shape,r);return i.length>0?Y(Ce(s,i),a.shape):s}}}},uQ={kernelName:Oi,inputsToSave:["a","b"],gradFunc:(e,t)=>{let[n,a]=t,r=Rt(n.shape,a.shape);return{a:()=>{let s=K(e,we(a,"float32")),i=ln(n.shape,r);return i.length>0?Y(Ce(s,i),n.shape):s},b:()=>{let s=K(e,we(n,"float32")),i=ln(a.shape,r);return i.length>0?Y(Ce(s,i),a.shape):s}}}},dQ={kernelName:Hd,gradFunc:e=>({x:()=>Kt(e)})},hQ={kernelName:wl,inputsToSave:["indices"],gradFunc:(e,t)=>{let n=t[0];return{indices:()=>un(n.shape,"float32")}}},pQ={kernelName:Xd,gradFunc:e=>({x:()=>at(e)})},cQ={kernelName:Zd,saveAllInputs:!0,gradFunc:(e,t,n)=>{let{axis:a}=n;return or(e,a).map(r=>()=>r)}},Y8={kernelName:kl,inputsToSave:["x"],gradFunc:(e,t,n)=>{let a=t[0],{paddings:r}=n,s=r.map(i=>i[0]);return{x:()=>nt(e,s,a.shape)}}},fQ={kernelName:Il,inputsToSave:["a","b"],outputsToSave:[!0],gradFunc:(e,t)=>{let[n,a,r]=t,s=n,i=a,o=Rt(s.shape,i.shape);return{a:()=>{let l=we(i,"float32"),u=K(e,K(l,Vs(s,Ne(l,Re(1))))),d=ln(s.shape,o);return d.length>0&&(u=Ce(u,d)),Y(u,s.shape)},b:()=>{let l=Ca(s,0),u=Pn(l,Ma(s),at(s)),d=K(e,K(r,u)),h=ln(i.shape,o);return h.length>0&&(d=Ce(d,h)),Y(d,i.shape)}}}},mQ={kernelName:Sl,inputsToSave:["x","alpha"],gradFunc:(e,t)=>{let[n,a]=t,r=Ca(n,0);return{x:()=>Pn(r,e,K(e,a)),alpha:()=>{let s=Pn(r,at(e),K(e,n)),i=ln(a.shape,e.shape);return i.length>0&&(s=Ce(s,i)),Y(s,a.shape)}}}},gQ={kernelName:il,inputsToSave:["a","b"],gradFunc:(e,t)=>{let[n,a]=t,r=Rt(n.shape,a.shape);return{a:()=>{let s=Me(e,we(a,"float32")),i=ln(n.shape,r);return i.length>0?Y(Ce(s,i),n.shape):s},b:()=>{let s=K(e,we(n,"float32")),i=ln(a.shape,r);i.length>0&&(s=Y(Ce(s,i),a.shape));let o=vt(a);return Kt(Me(s,we(o,"float32")))}}}},yQ={kernelName:Jd,inputsToSave:["x"],gradFunc:(e,t)=>{let[n]=t;return{x:()=>Me(e,Kt(vt(n)))}}},AQ={kernelName:El,inputsToSave:["x"],gradFunc:(e,t)=>{let[n]=t,a=K(Ji(n,6),Oh(n));return{x:()=>K(e,we(a,"float32"))}}},xQ={kernelName:Nl,inputsToSave:["x"],gradFunc:(e,t)=>{let[n]=t;return{x:()=>K(e,we(Oh(n),"float32"))}}},bQ={kernelName:Qd,inputsToSave:["x"],gradFunc:(e,t)=>{let[n]=t;return{x:()=>Y(e,n.shape)}}},vQ={kernelName:Tl,inputsToSave:["images"],gradFunc:(e,t,n)=>{let[a]=t,r={dy:e,images:a};return{images:()=>j.runKernel(G1,r,n)}}},wQ={kernelName:sf,inputsToSave:["images"],gradFunc:(e,t,n)=>{let[a]=t,r={dy:e,images:a};return{images:()=>j.runKernel(H1,r,n)}}},kQ={kernelName:Cl,gradFunc:(e,t,n)=>{let{dims:a}=n,r=Ha(a,e.shape);return{x:()=>Ra(e,r)}}},IQ={kernelName:Ml,gradFunc:e=>({x:()=>at(e)})},SQ={kernelName:Di,inputsToSave:["x"],gradFunc:(e,t)=>{let[n]=t;return{x:()=>Kt(Me(e,K(Vs(n,1.5),2)))}}},NQ={kernelName:th,inputsToSave:["condition"],gradFunc:(e,t)=>{let[n]=t;return{condition:()=>we(at(n),"float32"),t:()=>K(e,we(n,e.dtype)),e:()=>K(e,we(Cf(n),e.dtype))}}},TQ={kernelName:nh,inputsToSave:["x"],gradFunc:(e,t)=>{let[n]=t;return{x:()=>{let a=Ca(n,Re(0)),r=Re(B8),s=Re(V8),i=K(e,s),o=K(K(e,r),qa(we(n,"float32")));return Pn(a,i,o)}}}},EQ={kernelName:Rl,outputsToSave:[!0],gradFunc:(e,t)=>{let[n]=t;return{x:()=>K(e,K(n,Ne(Re(1),n)))}}},CQ={kernelName:sh,gradFunc:e=>({x:()=>at(e)})},MQ={kernelName:$l,inputsToSave:["x"],gradFunc:(e,t)=>{let[n]=t;return{x:()=>K(Tf(we(n,"float32")),e)}}},$Q={kernelName:rh,inputsToSave:["x"],gradFunc:(e,t)=>{let[n]=t;return{x:()=>K(zA(we(n,"float32")),e)}}},RQ={kernelName:ah,inputsToSave:["x"],gradFunc:(e,t,n)=>{let[a]=t,{begin:r,size:s}=n,i=a.shape,[o,l]=L4(a,r,s),u=[];for(let d=0;dBs(e,u)}}},FQ={kernelName:Dl,outputsToSave:[!0],gradFunc:(e,t,n)=>{let[a]=t,{dim:r}=n,s=!0,i=K(e,a);return{logits:()=>Ne(i,K(Ce(i,[r],s),a))}}},OQ={kernelName:ih,inputsToSave:["x"],gradFunc:(e,t)=>{let[n]=t;return{x:()=>K(e,$r(n))}}},J8={kernelName:of,gradFunc:(e,t,n)=>{let{blockShape:a,paddings:r}=n;return{x:()=>Nf(e,a,r)}}},Q8={kernelName:oh,gradFunc:(e,t,n)=>{let{axis:a}=n;return{x:()=>en(e,a)}}},DQ={kernelName:Fl,inputsToSave:["x"],gradFunc:(e,t)=>{let[n]=t;return{x:()=>Me(e,K(Mn(we(n,"float32")),2))}}},_Q={kernelName:lf,inputsToSave:["x"],gradFunc:(e,t)=>{let[n]=t;return{x:()=>K(e,K(we(n,"float32"),2))}}},zQ={kernelName:_i,inputsToSave:["a","b"],gradFunc:(e,t)=>{let[n,a]=t,r=Re(2);return{a:()=>K(e,K(r,Ne(n,a))),b:()=>K(e,K(r,Ne(a,n)))}}},PQ={kernelName:Li,gradFunc:e=>({x:()=>at(e)})},LQ={kernelName:zi,inputsToSave:["a","b"],gradFunc:(e,t)=>{let[n,a]=t,r=Rt(n.shape,a.shape);return{a:()=>{let s=e,i=ln(n.shape,r);return i.length>0&&(s=Ce(s,i)),Y(s,n.shape)},b:()=>{let s=e,i=ln(a.shape,r);return i.length>0&&(s=Ce(s,i)),Y(Kt(s),a.shape)}}}},WQ={kernelName:Ol,inputsToSave:["x"],gradFunc:(e,t,n)=>{let[a]=t,r=a.shape.slice(),{axis:s}=n;Ha(s,a.shape).forEach(l=>{r[l]=1});let i=Y(e,r),o=K(i,os(a.shape,"float32"));return{x:()=>o}}},BQ={kernelName:_l,inputsToSave:["x"],gradFunc:(e,t)=>{let[n]=t;return{x:()=>Me(e,vt(Tf(n)))}}},VQ={kernelName:zl,outputsToSave:[!0],gradFunc:(e,t)=>{let[n]=t;return{x:()=>K(Ne(Re(1),vt(n)),e)}}},UQ={kernelName:Pi,inputsToSave:["x"],gradFunc:(e,t,n)=>{let[a]=t,{reps:r}=n;return{x:()=>{let s=at(a);if(a.rank===1)for(let i=0;i{let a=n,{perm:r}=a,s=jA(r);return{x:()=>ct(e,s)}}},HQ={kernelName:hh,gradFunc:(e,t,n)=>{let a=n,{axis:r}=a;return{value:()=>Fa(e,r)}}},GQ={kernelName:uf,inputsToSave:["segmentIds"],gradFunc:(e,t)=>{let[n]=t;return{x:()=>qQ(e,n)}}};function qQ(e,t){let n=is(t,at(t)),a=Mh(e,n),r=Yi(t,Re(0,"int32")),s=a.rank-r.rank;for(let o=0;o({x:()=>at(e)})},XQ=[G8,XY,ZY,YY,JY,QY,eJ,tJ,nJ,aJ,rJ,sJ,lJ,hJ,pJ,cJ,fJ,mJ,gJ,yJ,AJ,xJ,vJ,bJ,IJ,SJ,NJ,TJ,EJ,CJ,gQ,MJ,$J,RJ,FJ,OJ,_J,DJ,zJ,PJ,LJ,WJ,BJ,VJ,UJ,jJ,HJ,GJ,qJ,ZJ,Z8,Z8,YJ,eQ,aQ,rQ,sQ,iQ,oQ,lQ,uQ,dQ,hQ,pQ,cQ,Y8,Y8,fQ,mQ,yQ,AQ,xQ,bQ,vQ,wQ,kQ,IQ,SQ,NQ,TQ,EQ,CQ,MQ,$Q,RQ,FQ,OQ,J8,J8,Q8,Q8,DQ,zQ,_Q,PQ,LQ,WQ,BQ,VQ,UQ,jQ,HQ,GQ,KQ];for(let e of XQ)nj(e);var eI={};$e(eI,{maxNorm:()=>QQ,minMaxNorm:()=>nee,nonNeg:()=>tee,unitNorm:()=>eee});var w2;function dn(){return w2==null&&(w2=VH().epsilon()),w2}function lr(){return"channelsLast"}var ds=class extends Error{constructor(e){super(e);Object.setPrototypeOf(this,ds.prototype)}},ur=class extends Error{constructor(e){super(e);Object.setPrototypeOf(this,ur.prototype)}},G=class extends Error{constructor(e){super(e);Object.setPrototypeOf(this,G.prototype)}},He=class extends Error{constructor(e){super(e);Object.setPrototypeOf(this,He.prototype)}},tI=class extends Error{constructor(e){super(e);Object.setPrototypeOf(this,tI.prototype)}};function ao(e,t){if(Array.isArray(e)){let n=[];for(let a=0;an.toUpperCase())}var Ka={};function k2(e){if(e==null)return null;let t={};return t.className=e.getClassName(),t.config=e.getConfig(),t}function I2(e){if(!(e==null||typeof e!="object"))if(Array.isArray(e))e.forEach(t=>I2(t));else{let t=Object.keys(e);for(let n of t){let a=e[n];a!=null&&typeof a=="object"&&(!Array.isArray(a)&&a.type==="ndarray"&&typeof a.value=="number"?e[n]=a.value:I2(a))}}}function Dh(e,t={},n={},a="object",r=!1){if(typeof e=="string"){let s=e,i;if(s in n)i=n[s];else if(s in Ka)i=Ka[s];else if(i=t[s],i==null)throw new G(`Unknown ${a}: ${e}. This may be due to one of the following reasons: -1. The ${a} is defined in Python, in which case it needs to be ported to TensorFlow.js or your JavaScript code. -2. The custom ${a} is defined in JavaScript, but is not registered properly with tf.serialization.registerClass().`);return i}else{let s=e;if(s.className==null||s.config==null)throw new G(`${a}: Improper config format: ${JSON.stringify(s)}. -'className' and 'config' must set.`);let i=s.className,o,l;if(i in n?[o,l]=n[i]:i in Ka?[o,l]=Ka.className:i in t&&([o,l]=t[i]),o==null)throw new G(`Unknown ${a}: ${i}. This may be due to one of the following reasons: -1. The ${a} is defined in Python, in which case it needs to be ported to TensorFlow.js or your JavaScript code. -2. The custom ${a} is defined in JavaScript, but is not registered properly with tf.serialization.registerClass().`);if(l!=null){let u={};for(let c of Object.keys(Ka))u[c]=Ka[c];for(let c of Object.keys(n))u[c]=n[c];let d=s.config;d.customObjects=u;let h={...Ka};for(let c of Object.keys(n))Ka[c]=n[c];I2(s.config);let p=l(o,s.config,n,r);return Ka={...h},p}else{let u={...Ka};for(let h of Object.keys(n))Ka[h]=n[h];let d=new o(s.config);return Ka={...u},d}}}function ZQ(e,t){return et?1:0}function jf(e,t){return-1*ZQ(e,t)}function Hs(e){if(e==null)return e;let t=[];for(let n of e)t.indexOf(n)===-1&&t.push(n);return t}function YQ(e){if(e==null)throw new G(`Invalid value in obj: ${JSON.stringify(e)}`);for(let t in e)if(e.hasOwnProperty(t))return!1;return!0}function so(e,t,n){if(n!=null&&e.indexOf(n)<0)throw new G(`${n} is not a valid ${t}. Valid values are ${e} or null/undefined.`)}function S2(e,t,n=0,a=Infinity){return Rr(n>=0),Rr(a>=n),Array.isArray(e)&&e.length>=n&&e.length<=a&&e.every(r=>typeof r===t)}function An(e,t){Array.isArray(e)?(k.assert(e.length>0,()=>`${t} is unexpectedly an empty array.`),e.forEach((n,a)=>An(n,`element ${a+1} of ${t}`))):k.assert(Number.isInteger(e)&&e>0,()=>`Expected ${t} to be a positive integer, but got ${aI(e)}.`)}function aI(e){return e===null?"null":Array.isArray(e)?"["+e.map(t=>aI(t)).join(",")+"]":typeof e=="string"?`"${e}"`:`${e}`}function JQ(e,t){let n=k.now(),a;return(...r)=>{let s=k.now();return s-nMn(Ce(K(e,e),t,!0)))}var _h=class extends ue.Serializable{getConfig(){return{}}},T2=class extends _h{constructor(e){super();this.defaultMaxValue=2,this.defaultAxis=0,this.maxValue=e.maxValue!=null?e.maxValue:this.defaultMaxValue,this.axis=e.axis!=null?e.axis:this.defaultAxis}apply(e){return Z(()=>{let t=N2(e,this.axis),n=ua(t,0,this.maxValue);return K(e,Me(n,pe(dn(),t)))})}getConfig(){return{maxValue:this.maxValue,axis:this.axis}}};T2.className="MaxNorm";ue.registerClass(T2);var E2=class extends _h{constructor(e){super();this.defaultAxis=0,this.axis=e.axis!=null?e.axis:this.defaultAxis}apply(e){return Z(()=>Me(e,pe(dn(),N2(e,this.axis))))}getConfig(){return{axis:this.axis}}};E2.className="UnitNorm";ue.registerClass(E2);var C2=class extends _h{apply(e){return ls(e)}};C2.className="NonNeg";ue.registerClass(C2);var M2=class extends _h{constructor(e){super();this.defaultMinValue=0,this.defaultMaxValue=1,this.defaultRate=1,this.defaultAxis=0,this.minValue=e.minValue!=null?e.minValue:this.defaultMinValue,this.maxValue=e.maxValue!=null?e.maxValue:this.defaultMaxValue,this.rate=e.rate!=null?e.rate:this.defaultRate,this.axis=e.axis!=null?e.axis:this.defaultAxis}apply(e){return Z(()=>{let t=N2(e,this.axis),n=pe(K(this.rate,ua(t,this.minValue,this.maxValue)),K(1-this.rate,t));return K(e,Me(n,pe(dn(),t)))})}getConfig(){return{minValue:this.minValue,maxValue:this.maxValue,rate:this.rate,axis:this.axis}}};M2.className="MinMaxNorm";ue.registerClass(M2);var sI={maxNorm:"MaxNorm",minMaxNorm:"MinMaxNorm",nonNeg:"NonNeg",unitNorm:"UnitNorm"};function hn(e){return k2(e)}function iI(e,t={}){return Dh(e,ue.SerializationMap.getMap().classNameMap,t,"constraint")}function pn(e){if(e==null)return null;if(typeof e=="string"){let t={className:e in sI?sI[e]:e,config:{}};return iI(t)}else return e instanceof _h?e:iI(e)}function QQ(e){return new T2(e)}function eee(e){return new E2(e)}function tee(){return new C2}function nee(e){return new M2(e)}var oI={};$e(oI,{constant:()=>See,glorotNormal:()=>Ree,glorotUniform:()=>$ee,heNormal:()=>Fee,heUniform:()=>Oee,identity:()=>Cee,leCunNormal:()=>Dee,leCunUniform:()=>_ee,ones:()=>Iee,orthogonal:()=>zee,randomNormal:()=>Tee,randomUniform:()=>Nee,truncatedNormal:()=>Eee,varianceScaling:()=>Mee,zeros:()=>kee});var aee=["channelsFirst","channelsLast"],ree=["nearest","bilinear"],see=["valid","same","causal"],iee=["max","avg"],oee=["sum","mul","concat","ave"],nu=new Map;function Yt(e){so(aee,"DataFormat",e)}function lee(e){so(ree,"InterpolationFormat",e)}function Oa(e){so(see,"PaddingMode",e)}function lI(e){so(iee,"PoolMode",e)}var zh=[],uI="/";function io(e,t){zh.push(e);try{let n=t();return zh.pop(),n}catch(n){throw zh.pop(),n}}function uee(){return zh.length===0?"":zh.join(uI)+uI}function dI(e){if(!pI(e))throw new Error("Not a valid tensor name: '"+e+"'");return uee()+e}function hI(e){if(!pI(e))throw new Error("Not a valid tensor name: '"+e+"'");nu.has(e)||nu.set(e,0);let t=nu.get(e);if(nu.set(e,nu.get(e)+1),t>0){let n=`${e}_${t}`;return nu.set(n,1),n}else return e}var dee=new RegExp(/^[A-Za-z0-9][-A-Za-z0-9\._\/]*$/);function pI(e){return!!e.match(dee)}function hee(e){return e===parseInt(e.toString(),10)}function Gs(e,t,n){t==null&&(t=0),n==null&&(n=e.length);let a=1;for(let r=t;rt&&(t=a)}return t}function dr(e,t){if(t{if(e.shape.length!==2)throw new G(`repeat() expects a rank-2 tensor, but received a rank-${e.shape.length} tensor.`);let n=Lh(e,1);return F2(n,[1,t,1])})}function cee(e){let t=[Gs(e.shape)];return e.reshape(t)}function fee(e){if(e.rank<=1)throw new G(`batchFlatten requires a minimum rank of 2. Got rank: ${e.rank}.`);let t=[e.shape[0],Gs(e.shape,1)];return e.reshape(t)}function oo(e,t,n){return Z(()=>{switch(e.rank){case 1:return n2(e,t,n);case 2:return w8(e,[t,0],[n,e.shape[1]]);case 3:return a2(e,[t,0,0],[n,e.shape[1],e.shape[2]]);case 4:return Df(e,[t,0,0,0],[n,e.shape[1],e.shape[2],e.shape[3]]);case 5:return nt(e,[t,0,0,0,0],[n,e.shape[1],e.shape[2],e.shape[3],e.shape[4]]);case 6:return nt(e,[t,0,0,0,0,0],[n,e.shape[1],e.shape[2],e.shape[3],e.shape[4],e.shape[5]]);default:throw new G(`sliceAlongFirstAxis() received an unsupported tensor rank: ${e.rank}`)}})}function $2(e,t,n){return Z(()=>{switch(e.rank){case 1:return n2(e,t,n);case 2:return w8(e,[0,t],[e.shape[0],n]);case 3:return a2(e,[0,0,t],[e.shape[0],e.shape[1],n]);case 4:return Df(e,[0,0,0,t],[e.shape[0],e.shape[1],e.shape[2],n]);default:throw new G(`sliceAlongLastAxis() received an unsupported tensor rank: ${e.rank}`)}})}function Hf(e,t,n,a){return Z(()=>{switch(e.rank){case 1:return n2(e,t,n);case 2:switch(a){case 1:return oo(e,t,n);case 2:return $2(e,t,n);default:throw new G(`The axis is not within the rank of the tensor ${a}`)}case 3:switch(a){case 1:return oo(e,t,n);case 2:return a2(e,[0,t,0],[e.shape[0],n,e.shape[2]]);case 3:return $2(e,t,n);default:throw new G(`The axis is not within the rank of the tensor ${a}`)}case 4:switch(a){case 1:return oo(e,t,n);case 2:return Df(e,[0,t,0,0],[e.shape[0],n,e.shape[2],e.shape[3]]);case 3:return Df(e,[0,0,t,0],[e.shape[0],e.shape[1],n,e.shape[3]]);case 4:return $2(e,t,n);default:throw new G(`The axis is not within the rank of the tensor ${a}`)}default:throw new G(`sliceAlongLastAxis() received an unsupported tensor rank: ${e.rank}`)}})}function R2(e,t=-1){let n;return t<0&&(n=e[0].rank,n!==0?t=n:t=0),t===e[0].rank&&(t=-1),en(e,t)}function cI(e,t){switch(e.rank){case 1:return DG([e,t]);case 2:return zG([e,t],0);case 3:return LG([e,t],0);case 4:return BG([e,t],0);default:throw new G(`concatAlongFirstAxis() received an unsupported tensor rank: ${e.rank}`)}}function F2(e,t){if(Array.isArray(t)||(t=[t]),e.rank!==t.length)throw new G(`The length of input n (${t.length}) does not match the number of dimensions in input x (${e.rank})`);return Zi(e,t)}function Gf(e,t=0,n=1,a,r){return zK(e,t,n,a,r)}function Fr(e,t,n,a){if(e.rank<2||t.rank<2)throw new He(`dot requires both inputs to be rank >= 2 but got x shape = ${e.shape} and y shape = ${t.shape}`);if(t.rank>=3){let r=e.shape.slice(-1)[0],s=t.shape.slice(-2)[0];if(r!==s)throw new He(`If rank y >= 3, then the second last dim of y must equal the last dim of x but got x shape = ${e.shape} and y shape = ${t.shape}`)}if(e.rank===2&&t.rank===2){let r=!1,s=!1;return eo.matMul({a:e,b:t,transposeA:r,transposeB:s,bias:a?O2(e.rank,a,lr()):null,activation:n})}else{let r=e.shape.slice(),s=r.pop();e=e.reshape([-1,s]);let i=t.shape.slice(),o=i.pop(),l=i.pop(),u=[...i,o],d=Array.from({length:t.rank},(m,f)=>f===0?t.rank-2:f<=t.rank-2?f-1:f);t=t.transpose(d).reshape([l,-1]);let h=[...r,...u],p=!1,c=!1;return eo.matMul({a:e,b:t,transposeA:p,transposeB:c,bias:a?O2(e.rank,a,lr()):null,activation:n}).reshape(h)}}function fI(e,t,n){return Z(()=>(Array.isArray(t)?t=$n(t,"int32"):t=t.toInt(),Mh(e,t,n)))}function Wh(e){return K(e,e)}function O2(e,t,n){let a=t.shape;if(t.rank!==1&&t.rank!==e)throw new G(`Unexpected bias dimensions: ${t.rank}; expected it to be 1 or ${e}`);if(e===5){if(n==="channelsFirst")return a.length===1?t.reshape([1,a[0],1,1,1]):t.reshape([1,a[3],a[0],a[1],a[2]]);if(n==="channelsLast")return a.length===1?t.reshape([1,1,1,1,a[0]]):t.reshape([1].concat(a))}else if(e===4){if(n==="channelsFirst")return a.length===1?t.reshape([1,a[0],1,1]):t.reshape([1,a[2],a[0],a[1]]);if(n==="channelsLast")return a.length===1?t.reshape([1,1,1,a[0]]):t.reshape([1].concat(a))}else if(e===3){if(n==="channelsFirst")return a.length===1?t.reshape([1,a[0],1]):t.reshape([1,a[1],a[0]]);if(n==="channelsLast")return a.length===1?t.reshape([1,1,a[0]]):t.reshape([1].concat(a))}else if(e<3)return t;throw new G(`Unsupported input rank by biasAdd: ${t.rank}`)}function hr(e,t,n){return Z(()=>(n==null&&(n=lr()),Yt(n),e.add(O2(e.rank,t,n))))}function mee(e,t=1){if(t!==1)throw new He(`Support for alpha values other than 1 (${t}) is not implemented yet.`);return Th(e)}function gee(e){return Z(()=>Me(e,yn(e).add(1)))}function mI(e,t,n,a){return Z(()=>PX(e,t,n,a))}function yee(e){return Z(()=>{let t=pe(.5,K(.2,e));return ua(t,0,1)})}function Bh(e,t,n=!1){return n?e():t()}var Aee=["fanIn","fanOut","fanAvg"],xee=["normal","uniform","truncatedNormal"];function bee(e){so(Aee,"FanMode",e)}function vee(e){so(xee,"Distribution",e)}var Xa=class extends ue.Serializable{fromConfigUsesCustomObjects(){return!1}getConfig(){return{}}},D2=class extends Xa{apply(e,t){return un(e,t)}};D2.className="Zeros";ue.registerClass(D2);var qf=class extends Xa{apply(e,t){return os(e,t)}};qf.className="Ones";ue.registerClass(qf);var _2=class extends Xa{constructor(e){super();if(typeof e!="object")throw new G(`Expected argument of type ConstantConfig but got ${e}`);if(e.value===void 0)throw new G(`config must have value set but got ${e}`);this.value=e.value}apply(e,t){return Z(()=>K(Re(this.value),os(e,t)))}getConfig(){return{value:this.value}}};_2.className="Constant";ue.registerClass(_2);var z2=class extends Xa{constructor(e){super();this.DEFAULT_MINVAL=-.05,this.DEFAULT_MAXVAL=.05,this.minval=e.minval||this.DEFAULT_MINVAL,this.maxval=e.maxval||this.DEFAULT_MAXVAL,this.seed=e.seed}apply(e,t){return Rh(e,this.minval,this.maxval,t)}getConfig(){return{minval:this.minval,maxval:this.maxval,seed:this.seed}}};z2.className="RandomUniform";ue.registerClass(z2);var P2=class extends Xa{constructor(e){super();this.DEFAULT_MEAN=0,this.DEFAULT_STDDEV=.05,this.mean=e.mean||this.DEFAULT_MEAN,this.stddev=e.stddev||this.DEFAULT_STDDEV,this.seed=e.seed}apply(e,t){if(t=t||"float32",t!=="float32"&&t!=="int32")throw new He(`randomNormal does not support dType ${t}.`);return Gf(e,this.mean,this.stddev,t,this.seed)}getConfig(){return{mean:this.mean,stddev:this.stddev,seed:this.seed}}};P2.className="RandomNormal";ue.registerClass(P2);var L2=class extends Xa{constructor(e){super();this.DEFAULT_MEAN=0,this.DEFAULT_STDDEV=.05,this.mean=e.mean||this.DEFAULT_MEAN,this.stddev=e.stddev||this.DEFAULT_STDDEV,this.seed=e.seed}apply(e,t){if(t=t||"float32",t!=="float32"&&t!=="int32")throw new He(`truncatedNormal does not support dType ${t}.`);return o2(e,this.mean,this.stddev,t,this.seed)}getConfig(){return{mean:this.mean,stddev:this.stddev,seed:this.seed}}};L2.className="TruncatedNormal";ue.registerClass(L2);var W2=class extends Xa{constructor(e){super();this.gain=e.gain!=null?e.gain:1}apply(e,t){return Z(()=>{if(e.length!==2||e[0]!==e[1])throw new G("Identity matrix initializer can only be used for 2D square matrices.");return K(this.gain,u8(e[0]))})}getConfig(){return{gain:this.gain}}};W2.className="Identity";ue.registerClass(W2);function wee(e,t="channelsLast"){let n,a;if(Yt(t),e.length===2)n=e[0],a=e[1];else if([3,4,5].indexOf(e.length)!==-1){if(t==="channelsFirst"){let r=Gs(e,2);n=e[1]*r,a=e[0]*r}else if(t==="channelsLast"){let r=Gs(e,0,e.length-2);n=e[e.length-2]*r,a=e[e.length-1]*r}}else{let r=Gs(e);n=Math.sqrt(r),a=Math.sqrt(r)}return[n,a]}var ea=class extends Xa{constructor(e){super();if(e.scale<0)throw new G(`scale must be a positive float. Got: ${e.scale}`);this.scale=e.scale==null?1:e.scale,this.mode=e.mode==null?"fanIn":e.mode,bee(this.mode),this.distribution=e.distribution==null?"normal":e.distribution,vee(this.distribution),this.seed=e.seed}apply(e,t){let n=wee(e),a=n[0],r=n[1],s=this.scale;if(this.mode==="fanIn"?s/=Math.max(1,a):this.mode==="fanOut"?s/=Math.max(1,r):s/=Math.max(1,(a+r)/2),this.distribution==="normal"){let i=Math.sqrt(s);if(t=t||"float32",t!=="float32"&&t!=="int32")throw new He(`${this.getClassName()} does not support dType ${t}.`);return o2(e,0,i,t,this.seed)}else{let i=Math.sqrt(3*s);return Rh(e,-i,i,t)}}getConfig(){return{scale:this.scale,mode:this.mode,distribution:this.distribution,seed:this.seed}}};ea.className="VarianceScaling";ue.registerClass(ea);var Kf=class extends ea{constructor(e){super({scale:1,mode:"fanAvg",distribution:"uniform",seed:e==null?null:e.seed})}getClassName(){return ea.className}};Kf.className="GlorotUniform";ue.registerClass(Kf);var Xf=class extends ea{constructor(e){super({scale:1,mode:"fanAvg",distribution:"normal",seed:e==null?null:e.seed})}getClassName(){return ea.className}};Xf.className="GlorotNormal";ue.registerClass(Xf);var Zf=class extends ea{constructor(e){super({scale:2,mode:"fanIn",distribution:"normal",seed:e==null?null:e.seed})}getClassName(){return ea.className}};Zf.className="HeNormal";ue.registerClass(Zf);var Yf=class extends ea{constructor(e){super({scale:2,mode:"fanIn",distribution:"uniform",seed:e==null?null:e.seed})}getClassName(){return ea.className}};Yf.className="HeUniform";ue.registerClass(Yf);var Jf=class extends ea{constructor(e){super({scale:1,mode:"fanIn",distribution:"normal",seed:e==null?null:e.seed})}getClassName(){return ea.className}};Jf.className="LeCunNormal";ue.registerClass(Jf);var Qf=class extends ea{constructor(e){super({scale:1,mode:"fanIn",distribution:"uniform",seed:e==null?null:e.seed})}getClassName(){return ea.className}};Qf.className="LeCunNormal";ue.registerClass(Qf);var B2=class extends Xa{constructor(e){super();if(this.DEFAULT_GAIN=1,this.gain=e.gain==null?this.DEFAULT_GAIN:e.gain,this.seed=e.seed,this.seed!=null)throw new He("Random seed is not implemented for Orthogonal Initializer yet.")}apply(e,t){return Z(()=>{if(e.length<2)throw new He("Shape must be at least 2D.");e[0]*e[1]>2e3&&console.warn(`Orthogonal initializer is being called on a matrix with more than 2000 (${e[0]*e[1]}) elements: Slowness may result.`);let n=e[0]>e[1]?[e[1],e[0]]:e,a=Gf(n,0,1,"float32"),r=uY.gramSchmidt(a);return e[0]>e[1]&&(r=r.transpose()),K(this.gain,r)})}getConfig(){return{gain:this.gain,seed:this.seed}}};B2.className="Orthogonal";ue.registerClass(B2);var gI={constant:"Constant",glorotNormal:"GlorotNormal",glorotUniform:"GlorotUniform",heNormal:"HeNormal",heUniform:"HeUniform",identity:"Identity",leCunNormal:"LeCunNormal",leCunUniform:"LeCunUniform",ones:"Ones",orthogonal:"Orthogonal",randomNormal:"RandomNormal",randomUniform:"RandomUniform",truncatedNormal:"TruncatedNormal",varianceScaling:"VarianceScaling",zeros:"Zeros"};function yI(e,t={}){return Dh(e,ue.SerializationMap.getMap().classNameMap,t,"initializer")}function jt(e){return k2(e)}function Pt(e){if(typeof e=="string"){let t=e in gI?gI[e]:e;if(t==="GlorotNormal")return new Xf;if(t==="GlorotUniform")return new Kf;if(t==="HeNormal")return new Zf;if(t==="HeUniform")return new Yf;if(t==="LeCunNormal")return new Jf;if(t==="LeCunUniform")return new Qf;{let n={};return n.className=t,n.config={},yI(n)}}else return e instanceof Xa?e:yI(e)}function kee(){return new D2}function Iee(){return new qf}function See(e){return new _2(e)}function Nee(e){return new z2(e)}function Tee(e){return new P2(e)}function Eee(e){return new L2(e)}function Cee(e){return new W2(e)}function Mee(e){return new ea(e)}function $ee(e){return new Kf(e)}function Ree(e){return new Xf(e)}function Fee(e){return new Zf(e)}function Oee(e){return new Yf(e)}function Dee(e){return new Jf(e)}function _ee(e){return new Qf(e)}function zee(e){return new B2(e)}var AI={};$e(AI,{Layer:()=>rt,RNN:()=>cs,RNNCell:()=>Kh,activation:()=>Ane,add:()=>Tne,alphaDropout:()=>dae,average:()=>Ene,averagePooling1d:()=>l5,averagePooling2d:()=>u5,averagePooling3d:()=>d5,avgPool1d:()=>zne,avgPool2d:()=>Lne,avgPool3d:()=>Bne,avgPooling1d:()=>Pne,avgPooling2d:()=>Wne,avgPooling3d:()=>Vne,batchNormalization:()=>One,bidirectional:()=>nae,concatenate:()=>Cne,conv1d:()=>une,conv2d:()=>dne,conv2dTranspose:()=>hne,conv3d:()=>pne,conv3dTranspose:()=>cne,convLstm2d:()=>Jne,convLstm2dCell:()=>Qne,cropping2D:()=>mne,dense:()=>xne,depthwiseConv2d:()=>yne,dot:()=>Fne,dropout:()=>bne,elu:()=>ane,embedding:()=>Nne,flatten:()=>wne,gaussianDropout:()=>uae,gaussianNoise:()=>lae,globalAveragePooling1d:()=>Une,globalAveragePooling2d:()=>jne,globalMaxPool1d:()=>rae,globalMaxPool2d:()=>sae,globalMaxPooling1d:()=>$S,globalMaxPooling2d:()=>RS,gru:()=>Gne,gruCell:()=>qne,input:()=>YI,inputLayer:()=>nne,layerNormalization:()=>Dne,leakyReLU:()=>sne,lstm:()=>Kne,lstmCell:()=>Xne,masking:()=>hae,maxPool1d:()=>iae,maxPool2d:()=>oae,maxPooling1d:()=>FS,maxPooling2d:()=>OS,maxPooling3d:()=>Hne,maximum:()=>Mne,minimum:()=>$ne,multiply:()=>Rne,permute:()=>Sne,prelu:()=>ine,reLU:()=>rne,repeatVector:()=>kne,reshape:()=>Ine,rnn:()=>eae,separableConv2d:()=>fne,simpleRNN:()=>Zne,simpleRNNCell:()=>Yne,softmax:()=>one,spatialDropout1d:()=>vne,stackedRNNCells:()=>tae,thresholdedReLU:()=>lne,timeDistributed:()=>aae,upSampling2d:()=>gne,zeroPadding2d:()=>_ne});var Pee=0;function xI(){return Pee++}var e0={};function t0(e=""){return e in e0||(e0[e]=0),e0[e]+=1,e+e0[e].toString()}function V2(e){return Array.isArray(e)&&Array.isArray(e[0])}function n0(e){return e.length===0?[]:Array.isArray(e[0])?e:[e]}function Ke(e){let t;if(Array.isArray(e)){if(e.length!==1)throw new G(`Expected Tensor length to be 1; got ${e.length}`);t=e[0]}else t=e;return t}function At(e){if(Array.isArray(e)&&Array.isArray(e[0])){if(e.length===1)return e=e,e[0];throw new G(`Expected exactly 1 Shape; got ${e.length}`)}else return e}function a0(e){let t=0;for(let n of e)n.shape.length===0?t+=1:t+=n.shape.reduce((a,r)=>a*r);return t}var bI="Variable",vI=class{constructor(e,t="float32",n=bI,a=!0,r=null){this.dtype=t==null?"float32":t,this.shape=e.shape,this.id=xI(),n=n==null?bI:n,this.originalName=dI(n),this.name=hI(this.originalName),this.trainable_=a,this.constraint=r,this.val=SX(e,this.trainable_,this.name,this.dtype)}read(){return this.assertNotDisposed(),this.val}write(e){return this.assertNotDisposed(),Lee(this.val,e),this.val.id!==e.id&&(this.val.assign(e),this.constraint!=null&&this.val.assign(this.constraint.apply(this.val))),this}dispose(){this.assertNotDisposed(),this.val.dispose()}assertNotDisposed(){if(this.val.isDisposed)throw new Error(`LayersVariable ${this.name} is already disposed.`)}get trainable(){return this.trainable_}set trainable(e){this.trainable_=e,this.val.trainable=e}};function Lee(e,t){if(e.shape.toString()!==t.shape.toString())throw new Error("Shape mismatch: "+JSON.stringify(e.shape)+" vs. "+JSON.stringify(t.shape))}function U2(e){return e.map(t=>t.read())}function j2(e){e.forEach(t=>{t[0].write(t[1])})}var tn=class{constructor(e){this.dtype=e.dtype,this.shape=e.shape,e.shape!=null?this.ndim=e.shape.length:this.ndim=e.ndim,this.maxNDim=e.maxNDim,this.minNDim=e.minNDim,this.axes=e.axes||{}}},pr=class{constructor(e,t,n,a,r,s,i){this.dtype=e,this.shape=t,this.sourceLayer=n,this.inputs=a,this.callArgs=r,this.outputTensorIndex=i,this.id=xI(),s!=null&&(this.originalName=dI(s),this.name=hI(this.originalName)),this.rank=t.length}},Wee=0,r0=class{constructor(e,t){this.callArgs=t,this.id=Wee++,this.outboundLayer=e.outboundLayer,this.inboundLayers=e.inboundLayers,this.nodeIndices=e.nodeIndices,this.tensorIndices=e.tensorIndices,this.inputTensors=e.inputTensors,this.outputTensors=e.outputTensors,this.inputMasks=e.inputMasks,this.outputMasks=e.outputMasks,this.inputShapes=e.inputShapes,this.outputShapes=e.outputShapes;for(let n of e.inboundLayers)n!=null&&n.outboundNodes.push(this);e.outboundLayer.inboundNodes.push(this)}getConfig(){let e=[];for(let t of this.inboundLayers)t!=null?e.push(t.name):e.push(null);return{outboundLayer:this.outboundLayer?this.outboundLayer.name:null,inboundLayers:e,nodeIndices:this.nodeIndices,tensorIndices:this.tensorIndices}}},Bee=0,rt=class extends ue.Serializable{constructor(e={}){super();this._callHook=null,this._addedWeightNames=[],this._stateful=!1,this.id=Bee++,this.activityRegularizer=null,this.inputSpec=null,this.supportsMasking=!1,this._trainableWeights=[],this._nonTrainableWeights=[],this._losses=[],this._updates=[],this._built=!1,this.inboundNodes=[],this.outboundNodes=[];let t=e.name;if(!t){let n=this.getClassName();t=hs(n)+"_"+t0(n)}if(this.name=t,this.trainable_=e.trainable==null?!0:e.trainable,e.inputShape!=null||e.batchInputShape!=null){let n;if(e.batchInputShape!=null)n=e.batchInputShape;else if(e.inputShape!=null){let r=null;e.batchSize!=null&&(r=e.batchSize),n=[r].concat(e.inputShape)}this.batchInputShape=n;let a=e.dtype;a==null&&(a=e.inputDType),a==null&&(a="float32"),this.dtype=a}e.weights!=null?this.initialWeights=e.weights:this.initialWeights=null,this._refCount=null,this.fastWeightInitDuringBuild=!1}static nodeKey(e,t){return e.name+"_ib-"+t.toString()}getNodeAtIndex(e,t){if(this.inboundNodes.length===0)throw new ur(`The layer has never been called and thus has no defined ${t}.`);if(this.inboundNodes.length<=e)throw new G(`Asked to get ${t} at node ${e}, but the layer has only ${this.inboundNodes.length} inbound nodes.`);return this.inboundNodes[e]}getInputAt(e){return Qn(this.getNodeAtIndex(e,"input").inputTensors)}getOutputAt(e){return Qn(this.getNodeAtIndex(e,"output").outputTensors)}get input(){if(this.inboundNodes.length>1)throw new ds(`Layer ${this.name} has multiple inbound nodes, hence the notion of "layer input" is ill-defined. Use \`getInputAt(nodeIndex)\` instead.`);if(this.inboundNodes.length===0)throw new ds(`Layer ${this.name} is not connected, no input to return.`);return Qn(this.getNodeAtIndex(0,"input").inputTensors)}get output(){if(this.inboundNodes.length===0)throw new ds(`Layer ${this.name} has no inbound nodes.`);if(this.inboundNodes.length>1)throw new ds(`Layer ${this.name} has multiple inbound nodes, hence the notion of "layer output" is ill-defined. Use \`getOutputAt(nodeIndex)\` instead.`);return Qn(this.getNodeAtIndex(0,"output").outputTensors)}get losses(){return this._losses}calculateLosses(){return this.losses.map(e=>e())}get updates(){return this._updates}get built(){return this._built}set built(e){this._built=e}get trainable(){return this.trainable_}set trainable(e){this._trainableWeights.forEach(t=>t.trainable=e),this.trainable_=e}get trainableWeights(){return this.trainable_?this._trainableWeights.filter(e=>e.trainable):[]}set trainableWeights(e){this._trainableWeights=e}get nonTrainableWeights(){return this.trainable?this._trainableWeights.filter(e=>!e.trainable).concat(this._nonTrainableWeights):this._trainableWeights.concat(this._nonTrainableWeights)}set nonTrainableWeights(e){this._nonTrainableWeights=e}get weights(){return this.trainableWeights.concat(this.nonTrainableWeights)}get stateful(){return this._stateful}resetStates(){if(!this.stateful)throw new Error("Cannot call the resetStates() method of a non-stateful Layer object.")}assertInputCompatibility(e){if(e=Ft(e),this.inputSpec==null||this.inputSpec.length===0)return;let t=Ft(this.inputSpec);if(e.length!==t.length)throw new G(`Layer ${this.name} expects ${t.length} inputs, but it received ${e.length} input tensors. Input received: ${e}`);for(let n=0;nr.maxNDim)throw new G(`Input ${n} is incompatible with layer ${this.name}: expected max_ndim=${r.maxNDim}, found ndim=${s}`);if(r.minNDim!=null&&s=0?i[l]:i[i.length+l];if(u!=null&&[u,null].indexOf(d)===-1)throw new G(`Input ${n} is incompatible with layer ${this.name}: expected axis ${l} of input shape to have value ${u} but got shape ${i}.`)}}if(r.shape!=null)for(let i=0;i{if(!this.built){this.assertInputCompatibility(e);let s=[];for(let i of Ft(e))s.push(i.shape);this.build(Qn(s)),this.built=!0,this.initialWeights&&this.setWeights(this.initialWeights),this._refCount===null&&r&&(this._refCount=1)}if(this.assertInputCompatibility(e),r){let s=this.call(e,t),i=Ft(s),o=[];for(let l of i)n.indexOf(l)!==-1&&(l=l.clone()),o.push(l);if(s=Qn(o),this.activityRegularizer!=null)throw new He("Layer invocation in the presence of activity regularizer(s) is not supported yet.");return s}else{let s=Vee(e),i=this.computeOutputShape(s),o,l=Uee(e);if(this.warnOnIncompatibleInputShape(Array.isArray(e)?s[0]:s),i!=null&&i.length>0&&Array.isArray(i[0])?o=i.map((u,d)=>new pr(l,u,this,Ft(e),t,this.name,d)):o=new pr(l,i,this,Ft(e),t,this.name),this.addInboundNode(e,o,null,null,s,i,t),this._refCount++,this.activityRegularizer!=null)throw new He("Layer invocation in the presence of activity regularizer(s) is not supported yet.");return o}})}warnOnIncompatibleInputShape(e){if(this.batchInputShape!=null)if(e.length!==this.batchInputShape.length)console.warn(`The rank of the input tensor provided (shape: ${JSON.stringify(e)}) does not match that of the batchInputShape (${JSON.stringify(this.batchInputShape)}) of the layer ${this.name}`);else{let t=!1;this.batchInputShape.forEach((n,a)=>{n!=null&&e[a]!=null&&e[a]!==n&&(t=!0)}),t&&console.warn(`The shape of the input tensor (${JSON.stringify(e)}) does not match the expectation of layer ${this.name}: ${JSON.stringify(this.batchInputShape)}`)}}get outputShape(){if(this.inboundNodes==null||this.inboundNodes.length===0)throw new ds(`The layer ${this.name} has never been called and thus has no defined output shape.`);let e=[];for(let t of this.inboundNodes){let n=JSON.stringify(t.outputShapes);e.indexOf(n)===-1&&e.push(n)}if(e.length===1){let t=this.inboundNodes[0].outputShapes;return Array.isArray(t)&&Array.isArray(t[0])&&t.length===1?t[0]:t}else throw new ds(`The layer ${this.name} has multiple inbound nodes with different output shapes. Hence the notion of "output shape" is ill-defined for the layer.`)}countParams(){if(!this.built)throw new ur(`You tried to call countParams() on ${this.name}, but the layer is not built yet. Build it first by calling build(batchInputShape).`);return a0(this.weights)}build(e){this.built=!0}getWeights(e=!1){return U2(e?this.trainableWeights:this.weights)}setWeights(e){Z(()=>{let t=this.weights;if(t.length!==e.length)throw new G(`You called setWeights(weights) on layer "${this.name}" with a weight list of length ${e.length}, but the layer was expecting ${t.length} weights. Provided weights: ${e}...`);if(t.length===0)return;let n=[],a=U2(t);for(let r=0;rr.apply(l.read())),s==null&&(s=!0),s?this._trainableWeights.push(l):this._nonTrainableWeights.push(l),l}setFastWeightInitDuringBuild(e){this.fastWeightInitDuringBuild=e}addLoss(e){e==null||Array.isArray(e)&&e.length===0||(e=Ft(e),this._losses!==void 0&&this._losses!==null&&this.losses.push(...e))}computeOutputShape(e){return e}computeMask(e,t){if(!this.supportsMasking){if(t!=null)if(Array.isArray(t))t.forEach(n=>{if(n!=null)throw new TypeError(`Layer ${this.name} does not support masking, but was passed an inputMask.`)});else throw new TypeError(`Layer ${this.name} does not support masking, but was passed an inputMask.`);return null}return t}addInboundNode(e,t,n,a,r,s,i=null){let o=Ft(e);t=Ft(t),n=Ft(n),a=Ft(a),r=n0(r),s=n0(s);let l=[],u=[],d=[];for(let h of o)l.push(h.sourceLayer),u.push(h.nodeIndex),d.push(h.tensorIndex);new r0({outboundLayer:this,inboundLayers:l,nodeIndices:u,tensorIndices:d,inputTensors:o,outputTensors:t,inputMasks:n,outputMasks:a,inputShapes:r,outputShapes:s},i);for(let h=0;he.dispose()),this.weights.length}assertNotDisposed(){if(this._refCount===0)throw new Error(`Layer '${this.name}' is already disposed.`)}dispose(){if(!this.built)throw new Error(`Cannot dispose Layer ${this.name} because it has not been built yet.`);if(this._refCount===null)throw new Error(`Cannot dispose Layer ${this.name} because it has not been used yet.`);this.assertNotDisposed();let e=0;return--this._refCount==0&&(e=this.disposeWeights()),{refCountAfterDispose:this._refCount,numDisposedVariables:e}}};function Vee(e){e=Ft(e);let t=[];for(let n of e)t.push(n.shape);return Qn(t)}function Uee(e){return"float32"}function wI(e,t,n){if((t==null||n!=null&&n>0)&&(t=e.sourceLayer,n=e.nodeIndex),t.inboundNodes.length===0)return[e];{let a=t.inboundNodes[n];if(a.inboundLayers.length===0)return a.inputTensors;{let r=[];for(let s=0;s0){let r=await Promise.all(t);for(let s=0;spe(this.totals[a],K(r,n)));this.totals[a]=i,s!=null&&s.dispose()}}}async onEpochEnd(e,t){if(t!=null)for(let n of this.params.metrics)this.totals[n]!=null&&(typeof this.totals[n]=="number"?t[n]=this.totals[n]/this.seen:Z(()=>{let a=K(Me(1,this.seen),this.totals[n]);t[n]=a,this.totals[n].dispose(),Sn(t[n])}))}},TI=class extends su{async onTrainBegin(e){this.epoch=[],this.history={}}async onEpochEnd(e,t){t==null&&(t={}),this.epoch.push(e);for(let n in t)this.history[n]==null&&(this.history[n]=[]),this.history[n].push(t[n])}async syncData(){let e=[],t=[],n=[];for(let r in this.history){let s=this.history[r];for(let i=0;inew EI(n,t))}var Or=class{constructor(){}static registerCallbackConstructor(e,t){k.assert(e>=0&&Number.isInteger(e),()=>`Verbosity level is expected to be an integer >= 0, but got ${e}`),Or.checkForDuplicate(t),Or.constructors[e]==null&&(Or.constructors[e]=[]),Or.constructors[e].push(t)}static checkForDuplicate(e){for(let t in Or.constructors)Or.constructors[+t].forEach(n=>{if(n===e)throw new G("Duplicate callback constructor.")})}static clear(){Or.constructors={}}static createCallbacks(e){let t=[];for(let n in Or.constructors){let a=+n;e>=a&&t.push(...Or.constructors[a])}return t.map(n=>new n)}},H2=Or;H2.constructors={};function MI(e,t,n,a,r,s,i,o,l){let u=new TI,d=[new Hee,...H2.createCallbacks(t)];e!=null&&d.push(...e),d.push(u);let h=new NI(d);return h.setParams({epochs:n,initialEpoch:a,samples:r,steps:s,batchSize:i,verbose:t,doValidation:o,metrics:l}),{callbackList:h,history:u}}function cr(e,t={},n=!1){return Dh(e,ue.SerializationMap.getMap().classNameMap,t,"layer",n)}function s0(e,t){return Z(()=>{e.dtype!=="float32"&&(e=e.asType("float32"));let n=Ce(Wh(e),t,!0),a=Eh(n.shape,dn()),r=Mn(is(n,a));return Me(e,r)})}function lo(e,t){return Z(()=>Xt(Wh(Ne(t,e)),-1))}function i0(e,t){return Z(()=>Xt(yn(Ne(t,e)),-1))}function iu(e,t){return Z(()=>{let n=Ne(e,t),a=ua(yn(e),dn(),Number.MAX_VALUE),r=yn(Me(n,a));return K(100,Xt(r,-1))})}function Gee(e,t){return Z(()=>{let n=ua(t,dn(),Number.MAX_VALUE),a=Ma(pe(1,n)),r=ua(e,dn(),Number.MAX_VALUE),s=Ma(pe(1,r));return Xt(Wh(Ne(a,s)),-1)})}function qee(e,t){return Z(()=>{let n=is(0,Ne(1,K(e,t)));return Xt(Wh(n),-1)})}function Kee(e,t){return Z(()=>{let n=is(0,Ne(1,K(e,t)));return Xt(n,-1)})}function Xee(e,t){return Z(()=>{let n=Ce(K(e,t),-1),a=sr(K(Ne(1,e),t),-1);return is(0,pe(1,Ne(a,n)))})}function Zee(e,t){return Z(()=>{let n=Math.log(2),a=Ne(t,e),r=Ne(pe(a,Zl(K(-2,a))),n);return Xt(r,-1)})}function Vh(e,t,n=!1){return Z(()=>{if(n)t=_f(t);else{let a=Ce(t,t.shape.length-1,!0);t=Me(t,a)}return t=ua(t,dn(),1-dn()),Kt(Ce(K(e.toFloat(),Ma(t)),t.shape.length-1))})}function o0(e,t,n=!1){return Z(()=>{let a=Ch(cee(e)).toInt();t=ua(t,dn(),1-dn());let r=t.shape,s=kh(a,r[r.length-1]).reshape(r);return Vh(s,t,n)})}function Yee(e,t){if(!k.arraysEqual(e.shape,t.shape))throw new G(`logits and labels must have the same shape, but got shapes ${JSON.stringify(e.shape)} and ${JSON.stringify(t.shape)}`);return Z(()=>{let n=t.relu(),a=t.abs().neg();return n.sub(t.mul(e)).add(a.exp().log1p())})}function l0(e,t){return Z(()=>{let n;return n=ua(t,dn(),1-dn()),n=Ma(Me(n,Ne(1,n))),Xt(Yee(e,n),-1)})}function Jee(e,t){return Z(()=>{let n=ua(e,dn(),1),a=ua(t,dn(),1);return Ce(K(e,Ma(Me(n,a))),-1)})}function Qee(e,t){return Z(()=>{let n=Ma(pe(dn(),t));return Xt(Ne(t,K(e,n)),-1)})}function G2(e,t){return Z(()=>{let n=s0(e,-1),a=s0(t,-1),r=K(n,a);return Kt(Ce(r,-1))})}var u0={meanSquaredError:lo,meanAbsoluteError:i0,meanAbsolutePercentageError:iu,meanSquaredLogarithmicError:Gee,squaredHinge:qee,hinge:Kee,categoricalHinge:Xee,logcosh:Zee,categoricalCrossentropy:Vh,sparseCategoricalCrossentropy:o0,binaryCrossentropy:l0,kullbackLeiblerDivergence:Jee,poisson:Qee,cosineProximity:G2};function q2(e){if(typeof e=="string"){if(e in u0)return u0[e];let t=`Unknown loss ${e}`;throw e.toLowerCase().includes("softmaxcrossentropy")&&(t=`Unknown loss ${e}. Use "categoricalCrossentropy" as the string name for tf.losses.softmaxCrossEntropy`),new G(t)}else return e}function K2(e,t){return Z(()=>{let n=K(.5,$a(t)),a=Ph(Ca(t,n),e.dtype);return Xt(Xi(e,a),-1)})}function X2(e,t){return Z(()=>Ph(Xi(kf(e,-1),kf(t,-1)),"float32"))}function $I(e,t){return Z(()=>ir(e.equal(1),t.equal(1)).sum().cast("float32"))}function ete(e,t){return Z(()=>ir(e.equal(1),t.equal(0)).sum().cast("float32"))}function tte(e,t){return Z(()=>ir(e.equal(0),t.equal(1)).sum().cast("float32"))}function RI(e,t){return Z(()=>{let n=$I(e,t),a=tte(e,t),r=n.add(a);return Pn(Ca(r,0),n.div(r),0).cast("float32")})}function nte(e,t){return Z(()=>{let n=$I(e,t),a=ete(e,t),r=n.add(a);return Pn(Ca(r,0),n.div(r),0).cast("float32")})}function FI(e,t){return l0(e,t)}function OI(e,t){return e.rank===t.rank&&(e=e.squeeze([e.rank-1])),t=t.argMax(-1),t.dtype!==e.dtype&&(t=t.asType(e.dtype)),Xi(e,t).asType("float32")}var ate=lo,rte=lo,ste=i0,ite=i0,ote=iu,lte=iu,Z2=Vh,ute=G2,DI=o0,d0={binaryAccuracy:K2,categoricalAccuracy:X2,precision:RI,categoricalCrossentropy:Z2,sparseCategoricalCrossentropy:DI,mse:ate,MSE:rte,mae:ste,MAE:ite,mape:ote,MAPE:lte,cosine:ute};function dte(e){if(typeof e=="string"&&e in d0)return d0[e];if(typeof e!="string"&&e!=null)return e;throw new G(`Unknown metric ${e}`)}function h0(e){if(Rr(e!==null,`Unknown LossOrMetricFn ${e}`),typeof e=="string")return e;{let t;for(let n of Object.keys(u0))if(u0[n]===e){t=n;break}if(t!==void 0)return t;for(let n of Object.keys(d0))if(d0[n]===e){t=n;break}return t!==void 0?t:e.name}}function hte(e){let t={Adagrad:()=>tu.adagrad(.01),Adadelta:()=>tu.adadelta(1,.95,dn()),Adam:()=>tu.adam(.001,.9,.999,dn()),Adamax:()=>tu.adamax(.002,.9,.999,dn(),0),RMSProp:()=>tu.rmsprop(.001,.9,0,dn()),SGD:()=>tu.sgd(.01)};if(t.adagrad=t.Adagrad,t.adadelta=t.Adadelta,t.adam=t.Adam,t.adamax=t.Adamax,t.rmsprop=t.RMSProp,t.sgd=t.SGD,e in t)return t[e]();throw new G(`Unknown Optimizer ${e}`)}var _I=1*1024*1024;function zI(e,t,n=!1){if(e==null||typeof e!="object"||Object.getPrototypeOf(e)!==Object.prototype||!Y2(e))throw new Error("User-defined metadata is expected to be a JSON object, but is not.");if(n){let a=JSON.stringify(e);a.length>_I&&console.warn(`User-defined metadata of model "${t}" is too large in size (length=${a.length} when serialized). It is not recommended to store such large objects in user-defined metadata. Please make sure its serialized length is <= ${_I}.`)}}function Y2(e){if(e===null)return!0;if(typeof e=="object")if(Object.getPrototypeOf(e)===Object.prototype){let t=Object.keys(e);for(let n of t)if(typeof n!="string"||!Y2(e[n]))return!1;return!0}else if(Array.isArray(e)){for(let t of e)if(!Y2(t))return!1;return!0}else return!1;else{let t=typeof e;return t==="string"||t==="number"||t==="boolean"}}function pte(e,t,n,a=console.log){let r=fte(e),s=["Layer (type)","Output shape","Param #"];r?(t=t||65,n=n||[.45,.85,1]):(t=t||98,n=n||[.33,.55,.67,1]),n[n.length-1]<=1&&(n=n.map(d=>Math.floor(t*d)));let i;if(!r){s.push("Receives inputs"),i=[];for(let d in e.nodesByDepth)i.push(...e.nodesByDepth[d])}a("_".repeat(t)),p0(s,n,a),a("=".repeat(t));let o=e.layers;for(let d=0;d1||r.length===1&&r[0].inboundLayers.length>1){t=!1;break}a.push(...r)}if(t)for(let r of e.layers){let s=!1;for(let i of r.inboundNodes)if(a.indexOf(i)!==-1)if(s){t=!1;break}else s=!0;if(!t)break}return t}function p0(e,t,n=console.log){let a="";for(let r=0;r0&&(a=a.slice(0,a.length-1)+" "),a+=e[r],a=a.slice(0,t[r]),a+=" ".repeat(t[r]-a.length);n(a)}function mte(e,t,n){let a;try{a=JSON.stringify(e.outputShape)}catch(o){a="multiple"}let r=e.name,s=e.getClassName(),i=[`${r} (${s})`,a,e.countParams().toString()];p0(i,t,n)}function gte(e,t,n,a){let r;try{r=JSON.stringify(e.outputShape)}catch(d){r="multiple"}let s=[];for(let d of e.inboundNodes)if(!(n!=null&&n.length>0&&n.indexOf(d)===-1))for(let h=0;hm.name),l=[],u=t.names();for(let m of o)u.indexOf(m)!==-1?l.push(t.getValue(m)):l.push(null);a!=null&&(a.maxNumTensors=-Infinity,a.minNumTensors=Infinity);let d=o.join(",")+"|"+t.names().join(","),h,p;if(ex[d]==null){let m=Ate(i,t);h=m.sorted,p=m.recipientCounts,ex[d]=h,LI[d]=p}h=ex[d],p={},r||Object.assign(p,LI[d]);let c=new uo(t);for(let m=0;ma.maxNumTensors&&(a.maxNumTensors=C),C0,()=>"Expected at least one fetch, got none");let n=[],a={};if(e.length===1){let r=WI(e[0],t);n=r.sorted,a=r.recipientMap}else{let r=new Set;for(let s of e){let{sorted:i,recipientMap:o}=WI(s,t);for(let l of i)r.has(l.name)||(n.push(l),r.add(l.name));for(let l in o)a[l]==null&&(a[l]=new Set),o[l].forEach(u=>a[l].add(u))}}return{sorted:n,recipientCounts:xte(a)}}function xte(e){let t={};for(let n in e)t[n]=e[n].size;return t}function WI(e,t){let n=new Set,a=[],r={};for(let o of t.names())n.add(o);let s=[],i=[];for(s.push(e);s.length>0;){let o=s[s.length-1];if(n.has(o.name)){s.pop();continue}let l=i[i.length-1]===s.length-1;if(o.inputs.length===0||l)s.pop(),a.push(o),n.add(o.name),l&&i.pop();else{i.push(s.length-1);for(let u of o.inputs)r[u.name]==null&&(r[u.name]=new Set),r[u.name].add(o.name),!n.has(u.name)&&s.push(u)}}return{sorted:a,recipientMap:r}}function bte(e){let t;if(e.sourceLayer.inboundNodes.length===1)t=e.sourceLayer.output;else{let n=null;for(let a=0;ay.name)}`);Hs(this.outputs).length!==this.outputs.length&&console.warn(`The list of outputs passed to the model is redundant. All outputs should only appear once. Found: ${this.outputs.map(y=>y.name)}`),this.inputLayers=[],this.inputLayersNodeIndices=[],this.inputLayersTensorIndices=[],this.outputLayers=[],this.outputLayersNodeIndices=[],this.outputLayersTensorIndices=[],this.layers=[],this.internalContainerRefs=[];for(let y of this.outputs){let A=y.sourceLayer,x=y.nodeIndex,v=y.tensorIndex;this.outputLayers.push(A),this.outputLayersNodeIndices.push(x),this.outputLayersTensorIndices.push(v)}for(let y of this.inputs){let A=y.sourceLayer,x=y.nodeIndex,v=y.tensorIndex;Rr(x===0,"input layer has >1 nodes"),Rr(v===0,"input layer has >1 tensors"),this.inputLayers.push(A),this.inputLayersNodeIndices.push(x),this.inputLayersTensorIndices.push(v)}this.inputNames=[],this.outputNames=[],this.feedInputShapes=[],this.feedInputNames=[],this.feedOutputNames=[];for(let y=0;yy.shape),this.internalOutputShapes=this.outputs.map(y=>y.shape);let t={},n={},a={},r={},s={},i=[],o=(y,A,x,v,b,w)=>{(v==null||b==null||w==null)&&(v=y.sourceLayer,b=y.nodeIndex,w=y.tensorIndex);let I=v.inboundNodes[b];if(x.indexOf(I)!==-1)throw new ur(`The tensor ${y.name} at layer "${v.name}" is part of a cycle.`);if(A.indexOf(I)!==-1)return;this.containerNodes.add(Dr.nodeKey(v,b)),v.id in s||(s[v.id]=Object.keys(s).length),x.indexOf(I)===-1&&x.push(I);let T=I.inboundLayers.length;for(let C=0;C=0;)x.splice(x.indexOf(I),1);i.push(I)},l=[],u=[];for(let y of this.outputs)o(y,l,u);let d=i.slice().reverse();for(let y of d){n[y.id]=y,y.id in t||(t[y.id]=0);let A=t[y.id],x=a[y.outboundLayer.id]==null?0:a[y.outboundLayer.id];A=Math.max(A,x),a[y.outboundLayer.id]=A,r[y.outboundLayer.id]=y.outboundLayer,t[y.id]=A;for(let v=0;vparseInt(y,10)).sort(jf);this.layers=[];for(let y of c){let A=p[y];A.sort((x,v)=>{let b=s[x.id],w=s[v.id];return bw?1:0});for(let x of A)x instanceof Dr&&this.internalContainerRefs.push(x),this.layers.push(x)}this.layersByDepth=p,c=Object.keys(h).map(y=>parseInt(y,10)).sort(jf);let m=this.inputs.slice(),f=[];for(let y of c)for(let A of h[y]){let x=A.outboundLayer;if(x!=null){for(let v of A.inputTensors)if(m.indexOf(v)===-1)throw new ur(`Graph disconnected: cannot obtain value for tensor ${v} at layer "${x.name}". The following previous layers were accessed without issue: ${f}`);for(let v of A.outputTensors)m.push(v);f.push(x.name)}}this.nodesByDepth=h;let g=this.layers.map(y=>y.name);for(let y of g){let A=g.filter(x=>x===y).length;if(A!==1)throw new ur(`The name "${y}" is used ${A} times in the model. All layer names should be unique. Layer names: `+JSON.stringify(g))}this.outboundNodes=[],this.inboundNodes=[],new r0({outboundLayer:this,inboundLayers:[],nodeIndices:[],tensorIndices:[],inputTensors:this.inputs,outputTensors:this.outputs,inputMasks:this.inputs.map(y=>null),outputMasks:this.outputs.map(y=>null),inputShapes:this.inputs.map(y=>y.shape),outputShapes:this.outputs.map(y=>y.shape)}),this.built=!0,this._refCount=1}assertNotDisposed(){if(this._refCount===0)throw new Error(`Container '${this.name}' is already disposed.`)}dispose(){this.assertNotDisposed();let e={refCountAfterDispose:null,numDisposedVariables:0};if(--this._refCount==0){for(let t of this.layers)e.numDisposedVariables+=t.dispose().numDisposedVariables;for(let t of this.internalContainerRefs)e.numDisposedVariables+=t.dispose().numDisposedVariables}return e.refCountAfterDispose=this._refCount,e}get trainable(){return this.trainable_}set trainable(e){this.layers.forEach(t=>{t._trainableWeights.forEach(n=>n.trainable=e)}),this.trainable_=e}get trainableWeights(){if(this._trainableWeights.length>0)throw new G("Container instance unexpectedly contains _trainableWeights.The trainable weights of a Container are a union of the trainable weights of its consituent Layers. Its own _trainableWeights must remain an empty Array.");if(!this.trainable)return[];let e=[];for(let t of this.layers)e=e.concat(t.trainableWeights);return e}get nonTrainableWeights(){let e=[];for(let t of this.layers)e.push(...t.nonTrainableWeights);if(!this.trainable){let t=[];for(let n of this.layers)t.push(...n.trainableWeights);return t.concat(e)}return e}get weights(){return this.trainableWeights.concat(this.nonTrainableWeights)}loadWeights(e,t=!0){let n={},a=0;for(let s of this.layers)for(let i of s.weights){if(n[i.originalName]!=null)throw new G(`Duplicate weight name: ${i.originalName}`);n[i.originalName]=i,a++}let r=[];for(let s in e){let i=s;if(n[s]==null){let o=s.split("/");i=o.slice(0,-2).concat([o[o.length-1]]).join("/")}if(n[i]!=null)r.push([n[i],e[s]]);else if(t)throw new G(`Provided weight data has no target variable: ${s}`);delete n[i]}if(t){let s=[];for(let i in n)s.push(i);if(s.length>0)throw new G(`${s.length} of ${a} weights are not set: ${s}`)}j2(r)}updatedConfig(){let e=this.getConfig(),t={};return t.className=this.getClassName(),t.config=e,t.kerasVersion=`tfjs-layers ${Q2}`,t.backend="TensorFlow.js",t}toJSON(e,t=!0){let n=J2(this.updatedConfig());return t?JSON.stringify(n):n}call(e,t){return Z(()=>{e=Ft(e);let n=new uo;for(let a=0;a{e=Ft(e);let n;return t==null?n=ao(null,e.length):n=Ft(t),this.runInternalGraph(e,n)[1]})}computeOutputShape(e){let t=n0(e);if(t.length!==this.inputLayers.length)throw new G(`Invalid inputShape argument ${e}: model has ${this.inputLayers.length} tensor inputs.`);let n={};for(let i=0;iparseInt(i,10)).sort(jf);if(a.length>1)for(let i of a){let o=this.nodesByDepth[i];for(let l of o){let u=l.outboundLayer;if(this.inputLayers.map(m=>m.id).indexOf(u.id)!==-1)continue;let d=[];for(let m=0;mparseInt(o,10)).sort(jf);for(let o of a){let l=this.nodesByDepth[o];for(let u of l){let d=u.outboundLayer,h=u.inputTensors,p=u.outputTensors,c=new Array;for(let m of h)m.id in n&&c.push(n[m.id]);if(c.length===h.length){let m={},f,g,y,A;if(u.callArgs!=null&&(m=u.callArgs),c.length===1){let[x,v]=c[0];m.mask==null&&(m.mask=v),y=Ft(d.call(x,m)),A=Ft(d.computeMask(x,v)),f=[x],g=[v]}else f=c.map(x=>x[0]),g=c.map(x=>x[1]),m.mask==null&&(m.mask=g),y=Ft(d.call(f,m)),A=Ft(d.computeMask(f,g));if(d.activityRegularizer)throw new He("LayersModel invocation with concrete Tensor value(s) in the presence of activity regularizer(s) is not supported yet.");for(let x=0;x{let e=[];for(let t of this.layers)for(let n=0;n0){let m=[];for(let f=0;f0&&f.apply(Qn(y),A)}function l(f){let g=f.name,y=cr(f,t.customObjects!=null?t.customObjects:{});y.setFastWeightInitDuringBuild(a),r[g]=y,f.inboundNodes.forEach(A=>{if(!(A instanceof Array))throw new G(`Corrupted configuration, expected array for nodeData: ${A}`);i(y,A)})}let u=t.name,d=t.layers;for(let f of d)l(f);for(;!YQ(s);)for(let f of d){let g=r[f.name];if(g.name in s){let y=s[g.name];delete s[g.name];for(let A of y)o(g,A)}}let h=[],p=[],c=t.inputLayers;for(let f of c){let g=f[0],y=f[1],A=f[2];Rr(g in r);let x=r[g].inboundNodes[y].outputTensors;h.push(x[A])}let m=t.outputLayers;for(let f of m){let g=f[0],y=f[1],A=f[2];Rr(g in r);let x=r[g].inboundNodes[y].outputTensors;p.push(x[A])}return new e({inputs:h,outputs:p,name:u})}get stateful(){if(this._stateful)throw new G("Container instance unexpectedly has _stateful = true. The statefulness of a Container is determined by the Layers it contains. Its _stateful property must remain the default false.");for(let e of this.layers)if(e.stateful)return!0;return!1}resetStates(){Z(()=>{this.layers.forEach(e=>{e.stateful&&e.resetStates()})})}};function vte(e,t,n){let a=t.length;if(e==null||Array.isArray(e)&&e.length===0)return t.map(r=>null);if(a===1)return Array.isArray(e)&&e.length===1?e:typeof e=="object"&&t[0]in e?[e[t[0]]]:[e];if(Array.isArray(e)){if(e.length!==a)throw new Error(`Provided ${n} is an array of ${e.length} element(s), but the model has ${a} outputs. Make sure a set of weights is provided for each model output.`);return e}else if(typeof e=="object"&&Object.keys(e).length>0&&typeof e[Object.keys(e)[0]]=="object"){let r=[];return t.forEach(s=>{s in e?r.push(e[s]):r.push(null)}),r}else throw new Error(`The model has multiple (${a}) outputs, so ${n} must be either an array with ${a} elements or an object with ${t} keys. Provided ${n} not understood: ${JSON.stringify(e)}`)}function BI(e,t){return vte(e,t,"classWeight")}async function VI(e,t,n,a){if(t!=null||a!=null)throw new Error("Support sampleWeight is not implemented yet");if(n!=null){let r=Z(()=>{if(e.shape.length===1)return e.clone();if(e.shape.length===2)if(e.shape[1]>1){let o=1;return e.argMax(o)}else{if(e.shape[1]===1)return e.reshape([e.shape[0]]);throw new Error(`Encountered unexpected last-dimension size (${e.shape[1]}) during handling of class weights. The size is expected to be >= 1.`)}else throw new Error(`Unexpected rank of target (y) tensor (${e.rank}) during handling of class weights. The rank is expected to be 1 or 2.`)}),s=Array.from(await r.data());Ge(r);let i=[];return s.forEach(o=>{if(n[o]==null)throw new Error(`classWeight must contain all classes in the training data. The class ${o} exists in the data but not in classWeight`);i.push(n[o])}),$n(i,"float32")}else return null}function wte(e,t){return K(e,t)}var kte=32;function UI(e,t){let n,a,r=t;n=r.xs,a=r.ys,k.assert(n!=null&&a!=null,()=>`A Dataset iterator for fitDataset() is expected to generate objects of the form \`{xs: xVal, ys: yVal}\`, where the two values may be \`tf.Tensor\`, an array of Tensors, or a map of string to Tensor. The provided Dataset instead generates ${t}`);let s=jI("input",e.inputNames,n),i=jI("output",e.outputNames,a),o=s[0].shape[0];k.assert(s.length===e.inputs.length,()=>`LayersModel has ${e.inputs.length} inputs, but the dataset provides ${s.length} inputs. (Expected input keys: ${JSON.stringify(e.inputNames)})`),k.assert(i.length===e.outputs.length,()=>`LayersModel has ${e.outputs.length} outputs, but the dataset provides ${i.length} outputs. (Expected output keys: ${JSON.stringify(e.outputNames)})`);for(let l=0;l`Batch size mismatch: input ${e.inputNames[l]} has ${s[l].shape[0]}; expected ${o} based on input ${e.inputNames[0]}.`);for(let l=0;l`Batch size mismatch: output ${e.outputNames[l]} has ${i[l].shape[0]}; expected ${o} based on input ${e.inputNames[0]}.`);return{xs:s,ys:i}}function jI(e,t,n){if(n instanceof Tt)return[n];if(Array.isArray(n))return k.assert(n.length===t.length,()=>`Received an array of ${n.length} Tensors, but expected ${t.length} to match the ${e} keys ${t}.`),n;{let a=[];for(let r of t){if(n[r]==null)throw new G(`The feature data generated by the dataset lacks the required ${e} key '${r}'.`);a.push(n[r])}return a}}function Ite(e){if(e.length===3)throw new He("Validation with sample weights is not implemented yet.");return{xs:e[0],ys:e[1]}}async function Ste(e,t,n){let a=n.batchesPerEpoch!=null;if(k.assert(e.optimizer!=null,()=>"You must compile a model before training/testing. Use LayersModel.compile(modelCompileConfig)."),k.assert(n!=null,()=>"For fitDataset(), the 2nd argument (config) is required, but it is not provided in this call."),k.assert(n.epochs!=null&&n.epochs>0&&Number.isInteger(n.epochs),()=>`For fitDataset(), config.epochs is expected to be a positive integer, but got ${n.epochs}`),k.assert(!a||n.batchesPerEpoch>0&&Number.isInteger(n.batchesPerEpoch),()=>`For fitDataset(), config.batchesPerEpoch is expected to be a positive integer if specified, but got ${n.batchesPerEpoch}`),k.assert(n.validationSplit==null,()=>"`validationSplit` is not supported by `fitDataset()`. Use validationData instead."),e.isTraining)throw new Error("Cannot start training because another fit() call is ongoing.");e.isTraining=!0;try{let r=n.validationData!=null,s,i;if(r)if(HI(n.validationData))k.assert(n.validationBatches==null||n.validationBatches>0&&Number.isInteger(n.validationBatches),()=>`For fitDataset() with dataset-based validation, config.validationBatches is expected not to be provided, or to be a positive integer, but got ${n.validationBatches}`);else{let g=Ite(n.validationData);s=g.xs,i=g.ys}let o=e.makeTrainFunction(),l=e.getDedupedMetricsNames(),u;r?u=l.slice().concat(l.map(g=>"val_"+g)):u=l.slice();let d=CI(n.callbacks,n.yieldEvery),h=n.verbose==null?1:n.verbose,{callbackList:p,history:c}=MI(d,h,n.epochs,null,null,Nte(t,n),null,r,u);p.setModel(e),e.history=c,await p.onTrainBegin(),e.stopTraining_=!1;let m=n.initialEpoch==null?0:n.initialEpoch,f=await t.iterator();for(;m=n.batchesPerEpoch:x.done){if(r){let v;HI(n.validationData)?v=Ft(await e.evaluateDataset(n.validationData,{batches:n.validationBatches})):v=Ft(e.evaluate(s,i,{batchSize:n.validationBatchSize==null?kte:n.validationBatchSize,verbose:0}));for(let b=0;b0)throw new He("Verbose mode is not implemented yet.");k.assert(!a||n.batches>0&&Number.isInteger(n.batches),()=>`Test loop expects \`batches\` to be a positive integer, but received ${JSON.stringify(n.batches)}`);let i=Tte(t)?t:await t.iterator(),o=0,l=0;for(;a?l{if(u.value){let{xs:d,ys:h}=UI(e,u.value),p=d.concat(h),c=Z(()=>r(p));if(Ge(p),l===0)for(let f=0;fpe(s[f],K(m,g))),l>0&&Ge(y)}Ge(c),o+=m,++l}return s}),u.done){a&&console.warn(`Your dataset iterator ran out of data during evaluateDataset(). Interrupting evalution. Make sure that your dataset can generate at least \`batches\` batches (in this case, ${n.batches} batches). You may need to use the repeat() function when building your dataset.`);break}}for(let u=0;u0&&Number.isInteger(e),()=>`batchSize is required to be a positive integer, but got ${e}`)}function Hh(e,t,n){return e==null?[null]:Array.isArray(e)?e.map(a=>oo(a,t,n-t)):oo(e,t,n-t)}function nx(e,t){return Z(()=>e==null?null:Array.isArray(e)?e.map(n=>nx(n,t)):fI(e,t.dtype==="int32"?t:t.toInt()))}function ax(e,t){let n=[],a=0,r=null;for(;a=e&&(r=e),n.push([a,r]),a=r;return n}async function Cte(e,t,n,a,r,s,i,o,l,u,d,h,p,c,m){r==null&&(r=32),s==null&&(s=1),d==null&&(d=!0),p==null&&(p=0);let f=!1;if(l!=null&&u!=null&&(f=!0),m!=null&&(f=!0,c==null))throw new G("Can only use `validationSteps` when doing step-wise training, i.e., `stepsPerEpoch` must be set.");let g=e.checkNumSamples(n,r,c,"steps_per_epoch"),y;g!=null&&(y=dr(0,g)),i==null&&(i=1);let{callbackList:A,history:x}=MI(o,i,s,p,g,c,r,f,h);A.setModel(e),e.history=x,await A.onTrainBegin(),e.stopTraining_=!1;for(let v=p;v{let z=I[T][0],$=I[T][1],S=oo(w,z,$-z);C.batch=T,C.size=$-z;let D=nx(n,S),_=t(D);for(let W=0;W0){if(m=!0,a.validationData.length===2)i=a.validationData[0],o=a.validationData[1];else throw a.validationData.length===3?new He("validationData including sample weights is not supported yet."):new G(`When passing validation data, it must contain 2 (valX, valY) or 3 (valX, valY, valSampleWeight) items; ${a.validationData} is invalid.`);let w=!0,I=await e.standardizeUserData(i,o,null,null,w,h);l=I[0],u=I[1],f=l.concat(u)}else if(a.validationSplit!=null&&a.validationSplit>0&&a.validationSplit<1){m=!0;let w=Math.floor(r[0].shape[0]*(1-a.validationSplit)),I=r[0].shape[0];l=Hh(r,w,I),r=Hh(r,0,w),u=Hh(s,w,I),s=Hh(s,0,w),f=l.concat(u)}else a.validationSteps!=null&&(m=!0);let g=r.concat(s).concat(d);e.checkTrainableWeightsConsistency();let y=e.makeTrainFunction(),A=e.getDedupedMetricsNames(),x,v;m?(e.makeTestFunction(),x=e.testFunction,v=A.slice().concat(A.map(w=>"val_"+w))):(x=null,f=[],v=A.slice());let b=CI(a.callbacks,a.yieldEvery);return await Cte(e,y,g,A,h,a.epochs,a.verbose,b,x,f,a.shuffle,v,a.initialEpoch,null,null)}finally{e.isTraining=!1,ho(r,t),ho(s,n),ho(l,i),ho(u,o),d!=null&&Ge(d)}}function GI(e){let t=[];e instanceof Tt&&(e=[e]);for(let n=0;nn.push(r.id));else if(t!=null)for(let r in t){let s=t[r];n.push(s.id)}let a=[];if(e instanceof Tt)n.indexOf(e.id)===-1&&a.push(e);else if(Array.isArray(e))e.forEach(r=>{n.indexOf(r.id)===-1&&a.push(r)});else if(e!=null)for(let r in e){let s=e[r];n.indexOf(s.id)===-1&&a.push(s)}a.forEach(r=>{r.isDisposed||r.dispose()})}function $te(e){return e instanceof Tt}function rx(e){return Array.isArray(e)}function qI(e){return!$te(e)&&!rx(e)}function KI(e,t,n,a=!0,r=""){if(t==null||t.length===0){if(e!=null){let i=!1;if(rx(e)&&e.length>0)i=!0;else if(qI(e)){for(let o in e)if(e.hasOwnProperty(o)){i=!0;break}}else i=!0;if(i)throw new G(`Error when checking model ${r} expected no data, but got ${e}`)}return[]}if(e==null)return t.map(i=>null);let s;if(qI(e)){e=e,s=[];for(let i of t){if(e[i]==null)throw new G(`No data provided for "${i}". Need data for each key in: ${t}`);s.push(e[i])}}else if(rx(e)){if(e=e,e.length!==t.length)throw new G(`Error when checking model ${r}: the Array of Tensors that you are passing to your model is not the size the model expected. Expected to see ${t.length} Tensor(s), but instead got the following list of Tensor(s): ${e}`);s=e}else{if(e=e,t.length>1)throw new G(`The model ${r} expects ${t.length} Tensor(s), but only received one Tensor. Found: Tensor with shape ${e.shape}`);s=[e]}if(s=GI(s),n!=null)for(let i=0;i=0&&u!==d)throw new G(`Error when checking ${r}: expected ${t[i]} to have shape [${n[i]}], but got array with shape [${o.shape}].`)}}return s}function Rte(e,t,n){let a=Hs(e.map(s=>s.shape[0]));a.sort();let r=Hs(t.map(s=>s.shape[0]));if(r.sort(),a.length>1)throw new G(`All input Tensors (x) should have the same number of samples. Got array shapes: ${JSON.stringify(e.map(s=>s.shape))}`);if(r.length>1)throw new G(`All target Tensors (y) should have the same number of samples. Got array shapes: ${JSON.stringify(t.map(s=>s.shape))}`);if(a.length>0&&r.length>0&&!k.arraysEqual(a,r))throw new G(`Input Tensors should have the same number of samples as target Tensors. Found ${a[0]} input sample(s) and ${r[0]} target sample(s).`)}function Fte(e,t,n){let a=[lo,l0,Vh];for(let r=0;r1)throw new G(`The model expects ${t.length} ${r} Tensors, but only received one Tensor. Found: array with shape ${JSON.stringify(e.shape)}.`);s=[e]}if(n!=null)for(let i=0;i[]);let n;if(typeof e=="string"||typeof e=="function")n=[e];else if(Array.isArray(e)||typeof e=="object")n=e;else throw new TypeError(`Type of metrics argument not understood. Expected an string,function, Array, or Object, found: ${e}`);if(Array.isArray(n))return t.map(a=>n);{let a=[];for(let r of t){let s=n.hasOwnProperty(r)?n[r]:[];Array.isArray(s)||(s=[s]),a.push(s)}return a}}var Dte="layers-model",ps=class extends Dr{constructor(e){super(e);this.isTraining=!1}summary(e,t,n=console.log){if(!this.built)throw new G("This model has never been called, thus its weights have not been created yet. So no summary can be displayed. Build the model first (e.g., by calling it on some test data).");pte(this,e,t,n)}compile(e){if(e.loss==null&&(e.loss=[]),this.loss=e.loss,typeof e.optimizer=="string")this.optimizer_=hte(e.optimizer),this.isOptimizerOwned=!0;else{if(!(e.optimizer instanceof js))throw new G("User-defined optimizer must be an instance of tf.Optimizer.");this.optimizer_=e.optimizer,this.isOptimizerOwned=!1}let t=[];if(!Array.isArray(e.loss)&&typeof e.loss!="string"&&typeof e.loss!="function"){e.loss=e.loss;for(let s in e.loss)if(this.outputNames.indexOf(s)===-1)throw new G(`Unknown entry in loss dictionary: "${s}". Only expected the following keys: ${this.outputNames}`);for(let s of this.outputNames)e.loss[s]==null&&console.warn(`Output "${s}" is missing from loss dictionary. We assume this was done on purpose, and we will not be expecting data to be passed to ${s} during training`),t.push(q2(e.loss[s]))}else if(Array.isArray(e.loss)){if(e.loss.length!==this.outputs.length)throw new G(`When passing an Array as loss, it should have one entry per model output. The model has ${this.outputs.length} output(s), but you passed loss=${e.loss}.`);t=e.loss.map(s=>q2(s))}else{let s=q2(e.loss);this.outputs.forEach(i=>{t.push(s)})}this.lossFunctions=t,this.feedOutputNames=[],this.feedOutputShapes=[],this.feedLossFns=[];for(let s=0;s{for(let s=0;s1&&(this.metricsTensors.push([i,s]),this.metricsNames.push(this.outputNames[s]+"_loss"))}});let a=Ote(e.metrics,this.outputNames),r=(s,i,o)=>{this.outputNames.length>1&&(i=this.outputNames[s]+"_"+i),this.metricsNames.push(i),this.metricsTensors.push([o,s])};io("metric",()=>{for(let s=0;s{let l="",u,d,h;for(let p of o){if(typeof p=="string"&&["accuracy","acc","crossentropy","ce"].indexOf(p)!==-1){let m=this.internalOutputShapes[s];m[m.length-1]===1||this.lossFunctions[s]===l0?["accuracy","acc"].indexOf(p)!==-1?d=K2:["crossentropy","ce"].indexOf(p)!==-1&&(d=FI):this.lossFunctions[s]===o0?["accuracy","acc"].indexOf(p)!==-1?d=OI:["crossentropy","ce"].indexOf(p)!==-1&&(d=DI):["accuracy","acc"].indexOf(p)!==-1?d=X2:["crossentropy","ce"].indexOf(p)!==-1&&(d=Z2);let f;["accuracy","acc"].indexOf(p)!==-1?f="acc":["crossentropy","ce"].indexOf(p)!==-1&&(f="ce"),h=d,u=l+f}else h=dte(p),u=l+h0(p);let c;io(u,()=>{c=h}),r(s,u,c)}})(i)}}),this.collectedTrainableWeights=this.trainableWeights}checkTrainableWeightsConsistency(){this.collectedTrainableWeights!=null&&this.trainableWeights.length!==this.collectedTrainableWeights.length&&console.warn("Discrepancy between trainableweights and collected trainable weights. Did you set `model.trainable` without calling `model.compile()` afterwards?")}evaluate(e,t,n={}){let a=n.batchSize==null?32:n.batchSize;tx(a);let r=!0,s=this.standardizeUserDataXY(e,t,r,a);try{let i=s[0].concat(s[1]);this.makeTestFunction();let o=this.testFunction,l=this.testLoop(o,i,a,n.verbose,n.steps);return Qn(l)}finally{ho(s[0],e),ho(s[1],t)}}async evaluateDataset(e,t){return this.makeTestFunction(),Ete(this,e,t)}checkNumSamples(e,t,n,a="steps"){let r;if(n!=null){if(r=null,t!=null)throw new G(`If ${a} is set, batchSize must be null or undefined.Got batchSize = ${t}`)}else if(e!=null)Array.isArray(e)?r=e[0].shape[0]:r=e.shape[0];else throw new G(`Either the input data should have a defined shape, or ${a} shoud be specified.`);return r}execute(e,t){if(Array.isArray(t)&&t.length===0)throw new G("`outputs` is an empty Array, which is not allowed.");let n=Array.isArray(t),a=n?t:[t],r=this.retrieveSymbolicTensors(a),s=new uo;if(e instanceof Tt&&(e=[e]),Array.isArray(e)){if(e.length!==this.inputs.length)throw new G(`The number of inputs provided (${e.length}) does not match the number of inputs of this model (${this.inputs.length}).`);for(let o=0;oi.name);for(let i=0;i0){let a=[];throw t.forEach((r,s)=>{r==null&&a.push(e[s])}),new G(`Cannot find SymbolicTensors for output name(s): ${JSON.stringify(a)}`)}return t}predictLoop(e,t=32,n=!1){return Z(()=>{let a=this.checkNumSamples(e);if(n)throw new He("Verbose predictLoop() is not implemented yet.");let r=ax(a,t),s=this.outputs.map(i=>[]);for(let i=0;i{let o=r[i][0],l=r[i][1],u=Hh(e,o,l),d=[];if(Array.isArray(u))for(let p=0;ps[l].push(o));return Qn(s.map(i=>en(i,0)))})}predict(e,t={}){let n=GI(e);XI(n,this.inputNames,this.feedInputShapes,!1);try{let a=t.batchSize==null?32:t.batchSize;return tx(a),this.predictLoop(n,a)}finally{ho(n,e)}}predictOnBatch(e){XI(e,this.inputNames,this.feedInputShapes,!0);let t=(Array.isArray(e)?e[0]:e).shape[0];return this.predictLoop(e,t)}standardizeUserDataXY(e,t,n=!0,a){if(this.optimizer_==null)throw new ur("You must compile a model before training/testing. Use LayersModel.compile(modelCompileArgs).");let r=[];for(let s=0;s0&&e[0].shape[0]%a!=0)throw new G(`In a stateful network, you should only pass inputs with a number of samples that is divisible by the batch size ${a}. Found: ${e[0].shape[0]} sample(s).`);return[e,t]}async standardizeUserData(e,t,n,a,r=!0,s){let[i,o]=this.standardizeUserDataXY(e,t,r,s);if(n!=null)throw new Error("sample weight is not supported yet.");let l=null;if(a!=null){let u=BI(a,this.outputNames);l=[];for(let d=0;d{let s=this.checkNumSamples(t,n,r,"steps"),i=[];if(a>0)throw new He("Verbose mode is not implemented yet.");if(r!=null)throw new He("steps mode in testLoop() is not implemented yet");{let o=ax(s,n),l=$n(dr(0,s));for(let u=0;u1&&(r+=`_${nI(e.slice(0,n),a)}`),t.push(r)}return t}makeTrainFunction(){return e=>{let t=[],n=e.slice(0,this.inputs.length),a=e.slice(this.inputs.length,this.inputs.length+this.outputs.length),r=e.slice(this.inputs.length+this.outputs.length,this.inputs.length+this.outputs.length*2),s=[],i=()=>{let u=[];for(let c=0;c1&&c{p=pe(p,c)}),p},o=this.collectedTrainableWeights.map(u=>u.read()),l=!0;return[this.optimizer_.minimize(i,l,o)].concat(s)}}makeTestFunction(){this.testFunction=e=>Z(()=>{let t=[],n,a=e.slice(0,this.inputs.length),r=e.slice(this.inputs.length,this.inputs.length+this.outputs.length),s=[];for(let l=0;lhs(t))}else{let t=Object.keys(this.loss);e={};let n=this.loss;for(let a of t)if(typeof n[a]=="string")e[a]=hs(n[a]);else throw new Error("Serialization of non-string loss is not supported.")}return e}getMetricIdentifiers(){if(typeof this.metrics=="string"||typeof this.metrics=="function")return[hs(h0(this.metrics))];if(Array.isArray(this.metrics))return this.metrics.map(e=>hs(h0(e)));{let e={};for(let t in this.metrics)e[t]=hs(h0(this.metrics[t]));return e}}getTrainingConfig(){return{loss:this.getLossIdentifiers(),metrics:this.getMetricIdentifiers(),optimizer_config:{class_name:this.optimizer.getClassName(),config:this.optimizer.getConfig()}}}loadTrainingConfig(e){if(e.weighted_metrics!=null)throw new Error("Loading weight_metrics is not supported yet.");if(e.loss_weights!=null)throw new Error("Loading loss_weights is not supported yet.");if(e.sample_weight_mode!=null)throw new Error("Loading sample_weight_mode is not supported yet.");let t=Uh(e.optimizer_config),n=cr(t),a;if(typeof e.loss=="string")a=ro(e.loss);else if(Array.isArray(e.loss))a=e.loss.map(s=>ro(s));else if(e.loss!=null){a={};for(let s in e.loss)a[s]=ro(e.loss[s])}let r;if(Array.isArray(e.metrics))r=e.metrics.map(s=>ro(s));else if(e.metrics!=null){r={};for(let s in e.metrics)r[s]=ro(e.metrics[s])}this.compile({loss:a,metrics:r,optimizer:n})}async save(e,t){if(typeof e=="string"){let i=la.getSaveHandlers(e);if(i.length===0)throw new G(`Cannot find any save handlers for URL '${e}'`);if(i.length>1)throw new G(`Found more than one (${i.length}) save handlers for URL '${e}'`);e=i[0]}if(e.save==null)throw new G("LayersModel.save() cannot proceed because the IOHandler provided does not have the `save` attribute defined.");let n=await la.encodeWeights(this.getNamedWeights(t)),a=!1,r=null,s={modelTopology:this.toJSON(r,a),format:Dte,generatedBy:`TensorFlow.js tfjs-layers v${Q2}`,convertedBy:null};if((t==null?!1:t.includeOptimizer)&&this.optimizer!=null){s.trainingConfig=this.getTrainingConfig();let i="optimizer",{data:o,specs:l}=await la.encodeWeights(await this.optimizer.getWeights(),i);n.specs.push(...l),n.data=la.concatenateArrayBuffers([n.data,o])}if(this.userDefinedMetadata!=null){let i=!0;zI(this.userDefinedMetadata,this.name,i),s.userDefinedMetadata=this.userDefinedMetadata}return s.weightData=n.data,s.weightSpecs=n.specs,e.save(s)}setUserDefinedMetadata(e){zI(e,this.name),this.userDefinedMetadata=e}getUserDefinedMetadata(){return this.userDefinedMetadata}};ps.className="Model";ue.registerClass(ps);var ZI=class extends ps{};ZI.className="Functional";ue.registerClass(ZI);async function _te(e,t){"modelTopology"in e||(e={modelTopology:e}),e=e;let n=e.modelTopology;n.model_config!=null&&(n=n.model_config);let a=Uh(n),r=cr(a,t);if(e.weightsManifest!=null){let s=await la.loadWeights(e.weightsManifest,e.pathPrefix,r.weights.map(o=>o.originalName)),i={};for(let o of r.weights)i[o.originalName]=s[o.originalName];r.loadWeights(i),Ge(s)}return r}async function zte(e,t){if(t==null&&(t={}),typeof e=="string"){let n=la.getLoadHandlers(e,t);if(n.length===0)n.push(la.browserHTTPRequest(e,t));else if(n.length>1)throw new G(`Found more than one (${n.length}) load handlers for URL '${e}'`);e=n[0]}return Pte(e,void 0,t)}async function Pte(e,t,n){if(n==null&&(n={}),e.load==null)throw new G("Cannot proceed with model loading because the IOHandler provided does not have the `load` method implemented.");let a=await e.load(),r=a.modelTopology;r.model_config!=null&&(r=r.model_config);let s=n.strict==null?!0:n.strict,i=a.weightData!=null&&a.weightSpecs!=null&&s,o=cr(Uh(r),t,i),l=a.trainingConfig;if(l!=null&&o.loadTrainingConfig(l),a.userDefinedMetadata!=null&&o.setUserDefinedMetadata(a.userDefinedMetadata),a.weightData!=null){if(a.weightSpecs==null)throw new G("LayersModel artifacts contains weight data, but not weight specs. Therefore loading of weights cannot proceed.");let{modelWeights:u,optimizerWeights:d}=Lte(a.weightData,a.weightSpecs);o.loadWeights(u,s),o.optimizer!=null&&d.length>0&&await o.optimizer.setWeights(d),Ge(u),Ge(d.map(h=>h.tensor))}return o}function Lte(e,t){let n=la.decodeWeights(e,t),a={},r=[];return t.forEach(s=>{s.group==="optimizer"?r.push({name:s.name,tensor:n[s.name]}):a[s.name]=n[s.name]}),{modelWeights:a,optimizerWeights:r}}var sx=class extends ps{constructor(e){super({inputs:[],outputs:[]});if(e=e||{},this.trainable=!0,this.built=!1,this.name=e.name!=null?e.name:t0("sequential_"),e.layers!=null)for(let t of e.layers)this.add(t)}checkShape(e){if(e.inboundNodes[0].outputTensors[0].shape.some(t=>t<0))throw new G(`Negative dimension size caused by adding layer ${e.name} with input shape [${e.inboundNodes[0].inputTensors[0].shape}]`)}add(e){let t=e instanceof sx||e instanceof ps,n;if(t){if(n=e,n.outputs.length!==1)throw new G("All layers in a Sequential model should have a single output tensor. For multi-output layers, use the functional API.");if(n.inputs.length!==1)throw new G("All layers in a Sequential model should have a single input tensor. For multi-input layers, use the functional API.")}if(this.outputs.length===0){if(e.inboundNodes.length===0){if(e.batchInputShape==null)throw new G("The first layer in a Sequential model must get an `inputShape` or `batchInputShape` argument.");let a=kI({batchShape:e.batchInputShape,dtype:e.dtype,name:e.name+"_input"});e.apply(a)}if(t)this.outputs=n.outputs,this.inputs=n.inputs;else{if(e.inboundNodes.length!==1)throw new G(`A layer added to a Sequential model must not already be connected somewhere else. LayersModel received layer ${e.name} which has ${e.inboundNodes.length} pre-existing inbound connections.`);if(e.inboundNodes[0].outputTensors.length!==1)throw new G("All layers in a Sequential model should have a single output tensor. For multi-output layers, use the functional API.");this.checkShape(e),this.outputs=[e.inboundNodes[0].outputTensors[0]],this.inputs=wI(this.outputs[0])}this.inboundNodes=[],new r0({outboundLayer:this,inboundLayers:[],nodeIndices:[],tensorIndices:[],inputTensors:this.inputs,outputTensors:this.outputs,inputMasks:ao(null,this.inputs.length),outputMasks:[null],inputShapes:this.inputs.map(a=>a.shape),outputShapes:this.outputs[0].shape})}else{let a=e.apply(this.outputs[0]);if(Array.isArray(a))throw new TypeError("All layers in a Sequential model should have a single output tensor. For multi-output layers, use the functional API.");this.checkShape(e),this.outputs=[a],this.inboundNodes[0].outputTensors=this.outputs,this.inboundNodes[0].outputShapes=[this.outputs[0].shape]}this.layers.push(e),this.built=!1}pop(){if(this.layers.length===0)throw new TypeError("There are no layers in the model.");if(this.layers.pop(),this.layers.length===0)this.outputs=[],this.inboundNodes=[],this.outboundNodes=[];else{let e=this.layers.length-1;this.layers[e].outboundNodes=[],this.outputs=[this.layers[e].output],this.inboundNodes[0].outputTensors=this.outputs,this.inboundNodes[0].outputShapes=[this.outputs[0].shape]}}call(e,t){return this.model==null&&this.build(),this.model.call(e,t)}build(e){if(At(e),this.inputs.length===0||this.outputs.length===0)throw new TypeError("Sequential model cannot be built: model is empty. Add some layers first.");this.model=new ps({inputs:this.inputs,outputs:this.outputs[0],name:this.name+"_model"}),this.model.trainable=this.trainable,this.supportsMasking=this.model.supportsMasking,this.inputLayers=this.model.inputLayers,this.inputLayersNodeIndices=this.model.inputLayersNodeIndices,this.inputLayersTensorIndices=this.model.inputLayersTensorIndices,this.outputLayers=this.model.outputLayers,this.outputLayersNodeIndices=this.model.outputLayersNodeIndices,this.outputLayersTensorIndices=this.model.outputLayersTensorIndices,this.nodesByDepth=this.model.nodesByDepth,this.containerNodes=this.model.containerNodes,this.outputNames=this.model.outputNames,this.inputNames=this.model.inputNames,this.built=!0}countParams(){return this.built||this.build(),super.countParams()}summary(e,t,n=console.log){this.built||this.build(),super.summary(e,t,n)}setWeights(e){this.model==null&&this.build(),this.model.setWeights(e)}evaluate(e,t,n={}){if(!this.built)throw new ur("The model needs to be compiled before being used.");return this.model.evaluate(e,t,n)}async evaluateDataset(e,t){if(!this.built)throw new ur("The model needs to be compiled before being used.");return this.model.evaluateDataset(e,t)}predict(e,t={}){return this.model==null&&this.build(),this.model.predict(e,t)}predictOnBatch(e){return this.model==null&&this.build(),this.model.predictOnBatch(e)}compile(e){this.build(),this.model.compile(e),this.optimizer_=this.model.optimizer,this.isOptimizerOwned=this.model.isOptimizerOwned,this.loss=this.model.loss,this.metrics=this.model.metrics,this.metricsTensors=this.model.metricsTensors,this.metricsNames=this.model.metricsNames}get optimizer(){return this.model==null?void 0:this.model.optimizer}set optimizer(e){this.model.optimizer=e}async fit(e,t,n={}){if(!this.built)throw new ur("The model needs to be compiled before being used.");return this.model.fit(e,t,n)}async fitDataset(e,t){if(!this.built)throw new ur("The model needs to be compiled before being used.");return this.model.fitDataset(e,t)}async trainOnBatch(e,t){return this.model.trainOnBatch(e,t)}static fromConfig(e,t,n={},a=!1){let r,s={};if(t instanceof Array){if(t[0].className==null||t[0].className==="Merge")throw new G("Legacy serialization format not supported yet.");r=t}else k.assert(t.layers!=null,()=>"When the config data for a Sequential model is not an Array, it must be an Object that contains the 'layers' field."),r=t.layers,delete t.layers,s=t;let i=new e(s);if(!(i instanceof sx))throw new He(`Sequential.fromConfig called on non-Sequential input: ${i}`);for(let o of r){let l=cr(o,void 0,a);a&&l.setFastWeightInitDuringBuild(!0),i.add(l)}return i}set stopTraining(e){if(this.model==null)throw new G("Cannot set the stopTraining property of a sequential model before it is compiled.");this.model.stopTraining=e}get stopTraining(){if(this.model==null)throw new G("Cannot get the stopTraining property of a sequential model before it is compiled.");return this.model.stopTraining}getConfig(){let e=[];for(let t of this.layers){let n={};n.className=t.getClassName(),n.config=t.getConfig(),e.push(n)}return{name:this.name,layers:e}}},c0=sx;c0.className="Sequential";ue.registerClass(c0);function Wte(e){return new ps(e)}function Bte(e){return new c0(e)}function Vte(e,t){return t==null&&(t={}),zte(e,t)}function YI(e){return kI(e)}function Ute(e,t){H2.registerCallbackConstructor(e,t)}var ta=class extends ue.Serializable{getConfig(){return{}}},JI=class extends ta{apply(e,t=1){return mee(e,t)}};JI.className="elu";ue.registerClass(JI);var QI=class extends ta{apply(e){return QA(e)}};QI.className="selu";ue.registerClass(QI);var eS=class extends ta{apply(e){return ls(e)}};eS.className="relu";ue.registerClass(eS);var tS=class extends ta{apply(e){return Z(()=>$h(6,ls(e)))}};tS.className="relu6";ue.registerClass(tS);var nS=class extends ta{apply(e){return e}};nS.className="linear";ue.registerClass(nS);var aS=class extends ta{apply(e){return $r(e)}};aS.className="sigmoid";ue.registerClass(aS);var rS=class extends ta{apply(e){return yee(e)}};rS.className="hardSigmoid";ue.registerClass(rS);var sS=class extends ta{apply(e){return Zl(e)}};sS.className="softplus";ue.registerClass(sS);var iS=class extends ta{apply(e){return gee(e)}};iS.className="softsign";ue.registerClass(iS);var oS=class extends ta{apply(e){return Kl(e)}};oS.className="tanh";ue.registerClass(oS);var ix=class extends ta{apply(e,t=-1){return _f(e,t)}};ix.className="softmax";ue.registerClass(ix);var lS=class extends ta{apply(e,t=-1){return VA(e,t)}};lS.className="logSoftmax";ue.registerClass(lS);var uS=class extends ta{apply(e,t=1){return Z(()=>$r(e.mul(t)).mul(e))}};uS.className="swish";ue.registerClass(uS);var dS=class extends ta{apply(e){return Z(()=>K(e,Kl(Zl(e))))}};dS.className="mish";ue.registerClass(dS);function Xs(e){return e.getClassName()}function ox(e,t={}){return Dh(e,ue.SerializationMap.getMap().classNameMap,t,"activation")}function Zs(e){if(e==null){let t={};return t.className="linear",t.config={},ox(t)}if(typeof e=="string"){let t={};return t.className=e,t.config={},ox(t)}else return e instanceof ta?e:ox(e)}function lx(e){if(e!=null&&typeof e!="object")throw new Error(`Argument to L1L2 regularizer's constructor is expected to be an object, but received: ${e}`)}var hS=class extends ue.Serializable{},Gh=class extends hS{constructor(e){super();lx(e),this.l1=e==null||e.l1==null?.01:e.l1,this.l2=e==null||e.l2==null?.01:e.l2,this.hasL1=this.l1!==0,this.hasL2=this.l2!==0}apply(e){return Z(()=>{let t=un([1]);return this.hasL1&&(t=pe(t,Ce(K(this.l1,yn(e))))),this.hasL2&&(t=pe(t,Ce(K(this.l2,Wh(e))))),t.asScalar()})}getConfig(){return{l1:this.l1,l2:this.l2}}static fromConfig(e,t){return new e({l1:t.l1,l2:t.l2})}};Gh.className="L1L2";ue.registerClass(Gh);function jte(e){return lx(e),new Gh({l1:e!=null?e.l1:null,l2:0})}function Hte(e){return lx(e),new Gh({l2:e!=null?e.l2:null,l1:0})}var pS={l1l2:"L1L2"};function wt(e){return k2(e)}function cS(e,t={}){return Dh(e,ue.SerializationMap.getMap().classNameMap,t,"regularizer")}function Lt(e){if(e==null)return null;if(typeof e=="string"){let t={className:e in pS?pS[e]:e,config:{}};return cS(t)}else return e instanceof hS?e:cS(e)}var ux=class extends rt{constructor(e){super(e==null?{}:e);this.supportsMasking=!0,e!=null&&(this.maxValue=e.maxValue)}call(e,t){e=Ke(e);let n=ls(e);return this.maxValue!=null&&(n=ua(n,0,this.maxValue)),n}computeOutputShape(e){return e}getConfig(){let e={maxValue:this.maxValue},t=super.getConfig();return Object.assign(e,t),e}};ux.className="ReLU";ue.registerClass(ux);var dx=class extends rt{constructor(e){super(e==null?{}:e);this.DEFAULT_ALPHA=.3,e==null&&(e={}),this.alpha=e.alpha==null?this.DEFAULT_ALPHA:e.alpha}call(e,t){let n=Ke(e);return Ef(n,this.alpha)}computeOutputShape(e){return e}getConfig(){let e={alpha:this.alpha},t=super.getConfig();return Object.assign(e,t),e}};dx.className="LeakyReLU";ue.registerClass(dx);var hx=class extends rt{constructor(e){super(e==null?{}:e);if(this.DEFAULT_ALPHA_INITIALIZER="zeros",e==null&&(e={}),this.supportsMasking=!0,this.alphaInitializer=Pt(e.alphaInitializer||this.DEFAULT_ALPHA_INITIALIZER),this.alphaRegularizer=Lt(e.alphaRegularizer),this.alphaConstraint=pn(e.alphaConstraint),e.sharedAxes==null)this.sharedAxes=null;else if(Array.isArray(e.sharedAxes))this.sharedAxes=e.sharedAxes;else if(typeof e.sharedAxes=="number")this.sharedAxes=[e.sharedAxes];else throw new G(`Expected sharedAxes to be a number or an array of numbers, but got ${e.sharedAxes}`)}build(e){e=At(e);let t=e.slice(1);if(this.sharedAxes!=null)for(let a of this.sharedAxes)t[a-1]=1;this.alpha=this.addWeight("alpha",t,"float32",this.alphaInitializer,this.alphaRegularizer,!0,this.alphaConstraint);let n={};if(this.sharedAxes!=null)for(let a=1;a(Yt(t),t==="channelsFirst"?ct(e,[0,2,3,1]):e))}function fS(e,t){return Z(()=>(Yt(t),t==="channelsFirst"?ct(e,[0,2,3,4,1]):e))}function Gte(e,t,n,a=1,r="valid",s,i=1){return Z(()=>{if(s==null&&(s=lr()),Yt(s),e.shape.length!==3)throw new G(`The input of a conv1dWithBias operation should be 3, but is ${e.shape.length} instead.`);if(t.shape.length!==3)throw new G(`The kernel for a conv1dWithBias operation should be 3, but is ${t.shape.length} instead`);if(n!=null&&n.shape.length!==1)throw new G(`The bias for a conv1dWithBias operation should be 1, but is ${t.shape.length} instead`);if(s==="channelsFirst"&&(e=ct(e,[0,2,1])),r==="causal")throw new He("The support for CAUSAL padding mode in conv1dWithBias is not implemented yet.");let o=OA(e,t,a,r==="same"?"same":"valid","NWC",i);return n!=null&&(o=hr(o,n)),o})}function mS(e,t,n,a=[1,1],r="valid",s,i,o=null){return Z(()=>{if(s==null&&(s=lr()),Yt(s),e.rank!==3&&e.rank!==4)throw new G(`conv2dWithBiasActivation expects input to be of rank 3 or 4, but received ${e.rank}.`);if(t.rank!==3&&t.rank!==4)throw new G(`conv2dWithBiasActivation expects kernel to be of rank 3 or 4, but received ${e.rank}.`);let l=mx(e,s);if(r==="causal")throw new He("The support for CAUSAL padding mode in conv1dWithBias is not implemented yet.");return l=eo.conv2d({x:l,filter:t,strides:a,pad:r==="same"?"same":"valid",dilations:i,dataFormat:"NHWC",bias:n,activation:o}),s==="channelsFirst"&&(l=ct(l,[0,3,1,2])),l})}function qte(e,t,n,a=[1,1,1],r="valid",s,i){return Z(()=>{if(s==null&&(s=lr()),Yt(s),e.rank!==4&&e.rank!==5)throw new G(`conv3dWithBias expects input to be of rank 4 or 5, but received ${e.rank}.`);if(t.rank!==4&&t.rank!==5)throw new G(`conv3dWithBias expects kernel to be of rank 4 or 5, but received ${e.rank}.`);let o=fS(e,s);if(r==="causal")throw new He("The support for CAUSAL padding mode in conv3dWithBias is not implemented yet.");return o=n8(o,t,a,r==="same"?"same":"valid","NDHWC",i),n!=null&&(o=hr(o,n)),s==="channelsFirst"&&(o=ct(o,[0,4,1,2,3])),o})}var gx=class extends rt{constructor(e,t){super(t);if(this.bias=null,this.DEFAULT_KERNEL_INITIALIZER="glorotNormal",this.DEFAULT_BIAS_INITIALIZER="zeros",gx.verifyArgs(t),this.rank=e,An(this.rank,"rank"),this.rank!==1&&this.rank!==2&&this.rank!==3)throw new He(`Convolution layer for rank other than 1, 2, or 3 (${this.rank}) is not implemented yet.`);if(this.kernelSize=ou(t.kernelSize,e,"kernelSize"),this.strides=ou(t.strides==null?1:t.strides,e,"strides"),this.padding=t.padding==null?"valid":t.padding,Oa(this.padding),this.dataFormat=t.dataFormat==null?"channelsLast":t.dataFormat,Yt(this.dataFormat),this.activation=Zs(t.activation),this.useBias=t.useBias==null?!0:t.useBias,this.biasInitializer=Pt(t.biasInitializer||this.DEFAULT_BIAS_INITIALIZER),this.biasConstraint=pn(t.biasConstraint),this.biasRegularizer=Lt(t.biasRegularizer),this.activityRegularizer=Lt(t.activityRegularizer),this.dilationRate=ou(t.dilationRate==null?1:t.dilationRate,e,"dilationRate"),this.rank===1&&Array.isArray(this.dilationRate)&&this.dilationRate.length!==1)throw new G(`dilationRate must be a number or an array of a single number for 1D convolution, but received ${JSON.stringify(this.dilationRate)}`);if(this.rank===2){if(typeof this.dilationRate=="number")this.dilationRate=[this.dilationRate,this.dilationRate];else if(this.dilationRate.length!==2)throw new G(`dilationRate must be a number or array of two numbers for 2D convolution, but received ${JSON.stringify(this.dilationRate)}`)}else if(this.rank===3){if(typeof this.dilationRate=="number")this.dilationRate=[this.dilationRate,this.dilationRate,this.dilationRate];else if(this.dilationRate.length!==3)throw new G(`dilationRate must be a number or array of three numbers for 3D convolution, but received ${JSON.stringify(this.dilationRate)}`)}}static verifyArgs(e){if(Rr("kernelSize"in e,"required key 'kernelSize' not in config"),typeof e.kernelSize!="number"&&!S2(e.kernelSize,"number",1,3))throw new G(`BaseConv expects config.kernelSize to be number or number[] with length 1, 2, or 3, but received ${JSON.stringify(e.kernelSize)}.`)}getConfig(){let e={kernelSize:this.kernelSize,strides:this.strides,padding:this.padding,dataFormat:this.dataFormat,dilationRate:this.dilationRate,activation:Xs(this.activation),useBias:this.useBias,biasInitializer:jt(this.biasInitializer),biasRegularizer:wt(this.biasRegularizer),activityRegularizer:wt(this.activityRegularizer),biasConstraint:hn(this.biasConstraint)},t=super.getConfig();return Object.assign(e,t),e}},qh=class extends gx{constructor(e,t){super(e,t);this.kernel=null,qh.verifyArgs(t),this.filters=t.filters,An(this.filters,"filters"),this.kernelInitializer=Pt(t.kernelInitializer||this.DEFAULT_KERNEL_INITIALIZER),this.kernelConstraint=pn(t.kernelConstraint),this.kernelRegularizer=Lt(t.kernelRegularizer)}build(e){e=At(e);let t=this.dataFormat==="channelsFirst"?1:e.length-1;if(e[t]==null)throw new G(`The channel dimension of the input should be defined. Found ${e[t]}`);let n=e[t],a=this.kernelSize.concat([n,this.filters]);this.kernel=this.addWeight("kernel",a,null,this.kernelInitializer,this.kernelRegularizer,!0,this.kernelConstraint),this.useBias&&(this.bias=this.addWeight("bias",[this.filters],null,this.biasInitializer,this.biasRegularizer,!0,this.biasConstraint)),this.inputSpec=[{ndim:this.rank+2,axes:{[t]:n}}],this.built=!0}call(e,t){return Z(()=>{e=Ke(e);let n,a=this.bias==null?null:this.bias.read(),r=rI(this.activation.getClassName());if(r!=null&&this.rank===2)n=mS(e,this.kernel.read(),a,this.strides,this.padding,this.dataFormat,this.dilationRate,r);else{if(this.rank===1)n=Gte(e,this.kernel.read(),a,this.strides[0],this.padding,this.dataFormat,this.dilationRate[0]);else if(this.rank===2)n=mS(e,this.kernel.read(),a,this.strides,this.padding,this.dataFormat,this.dilationRate);else if(this.rank===3)n=qte(e,this.kernel.read(),a,this.strides,this.padding,this.dataFormat,this.dilationRate);else throw new He("convolutions greater than 3D are not implemented yet.");this.activation!=null&&(n=this.activation.apply(n))}return n})}computeOutputShape(e){e=At(e);let t=[],n=this.dataFormat==="channelsLast"?e.slice(1,e.length-1):e.slice(2);for(let r=0;r 0 but got ${JSON.stringify(e.filters)}`)}},gS=class extends qh{constructor(e){super(2,e);gS.verifyArgs(e)}getConfig(){let e=super.getConfig();return delete e.rank,e}static verifyArgs(e){if(typeof e.kernelSize!="number"&&!S2(e.kernelSize,"number",1,2))throw new G(`Conv2D expects config.kernelSize to be number or number[] with length 1 or 2, but received ${JSON.stringify(e.kernelSize)}.`)}},f0=gS;f0.className="Conv2D";ue.registerClass(f0);var yS=class extends qh{constructor(e){super(3,e);yS.verifyArgs(e)}getConfig(){let e=super.getConfig();return delete e.rank,e}static verifyArgs(e){if(typeof e.kernelSize!="number"&&!(Array.isArray(e.kernelSize)&&(e.kernelSize.length===1||e.kernelSize.length===3)))throw new G(`Conv3D expects config.kernelSize to be number or [number, number, number], but received ${JSON.stringify(e.kernelSize)}.`)}},m0=yS;m0.className="Conv3D";ue.registerClass(m0);var yx=class extends f0{constructor(e){super(e);if(this.inputSpec=[new tn({ndim:4})],this.padding!=="same"&&this.padding!=="valid")throw new G(`Conv2DTranspose currently supports only padding modes 'same' and 'valid', but received padding mode ${this.padding}`)}build(e){if(e=At(e),e.length!==4)throw new G("Input should have rank 4; Received input shape: "+JSON.stringify(e));let t=this.dataFormat==="channelsFirst"?1:e.length-1;if(e[t]==null)throw new G("The channel dimension of the inputs should be defined. Found `None`.");let n=e[t],a=this.kernelSize.concat([this.filters,n]);this.kernel=this.addWeight("kernel",a,"float32",this.kernelInitializer,this.kernelRegularizer,!0,this.kernelConstraint),this.useBias&&(this.bias=this.addWeight("bias",[this.filters],"float32",this.biasInitializer,this.biasRegularizer,!0,this.biasConstraint)),this.inputSpec=[new tn({ndim:4,axes:{[t]:n}})],this.built=!0}call(e,t){return Z(()=>{let n=Ke(e);if(n.shape.length!==4)throw new G(`Conv2DTranspose.call() expects input tensor to be rank-4, but received a tensor of rank-${n.shape.length}`);let a=n.shape,r=a[0],s,i;this.dataFormat==="channelsFirst"?(s=2,i=3):(s=1,i=2);let o=a[s],l=a[i],u=this.kernelSize[0],d=this.kernelSize[1],h=this.strides[0],p=this.strides[1],c=_r(o,h,u,this.padding),m=_r(l,p,d,this.padding),f=[r,c,m,this.filters];this.dataFormat!=="channelsLast"&&(n=ct(n,[0,2,3,1]));let g=_A(n,this.kernel.read(),f,this.strides,this.padding);return this.dataFormat!=="channelsLast"&&(g=ct(g,[0,3,1,2])),this.bias!=null&&(g=hr(g,this.bias.read(),this.dataFormat)),this.activation!=null&&(g=this.activation.apply(g)),g})}computeOutputShape(e){e=At(e);let t=e.slice(),n,a,r;this.dataFormat==="channelsFirst"?(n=1,a=2,r=3):(n=3,a=1,r=2);let s=this.kernelSize[0],i=this.kernelSize[1],o=this.strides[0],l=this.strides[1];return t[n]=this.filters,t[a]=_r(t[a],o,s,this.padding),t[r]=_r(t[r],l,i,this.padding),t}getConfig(){let e=super.getConfig();return delete e.dilationRate,e}};yx.className="Conv2DTranspose";ue.registerClass(yx);var Ax=class extends m0{constructor(e){super(e);if(this.inputSpec=[new tn({ndim:5})],this.padding!=="same"&&this.padding!=="valid")throw new G(`Conv3DTranspose currently supports only padding modes 'same' and 'valid', but received padding mode ${this.padding}`)}build(e){if(e=At(e),e.length!==5)throw new G("Input should have rank 5; Received input shape: "+JSON.stringify(e));let t=this.dataFormat==="channelsFirst"?1:e.length-1;if(e[t]==null)throw new G("The channel dimension of the inputs should be defined. Found `None`.");let n=e[t],a=this.kernelSize.concat([this.filters,n]);this.kernel=this.addWeight("kernel",a,"float32",this.kernelInitializer,this.kernelRegularizer,!0,this.kernelConstraint),this.useBias&&(this.bias=this.addWeight("bias",[this.filters],"float32",this.biasInitializer,this.biasRegularizer,!0,this.biasConstraint)),this.inputSpec=[new tn({ndim:5,axes:{[t]:n}})],this.built=!0}call(e,t){return Z(()=>{let n=Ke(e);if(n.shape.length!==5)throw new G(`Conv3DTranspose.call() expects input tensor to be rank-4, but received a tensor of rank-${n.shape.length}`);let a=n.shape,r=a[0],s,i,o;this.dataFormat==="channelsFirst"?(o=2,s=3,i=4):(o=1,s=2,i=3);let l=a[o],u=a[s],d=a[i],h=this.kernelSize[0],p=this.kernelSize[1],c=this.kernelSize[2],m=this.strides[0],f=this.strides[1],g=this.strides[2],y=_r(l,m,h,this.padding),A=_r(u,f,p,this.padding),x=_r(d,g,c,this.padding),v=[r,y,A,x,this.filters];this.dataFormat!=="channelsLast"&&(n=ct(n,[0,2,3,4,1]));let b=XG(n,this.kernel.read(),v,this.strides,this.padding);return this.dataFormat!=="channelsLast"&&(b=ct(b,[0,4,1,2,3])),this.bias!==null&&(b=hr(b,this.bias.read(),this.dataFormat)),this.activation!==null&&(b=this.activation.apply(b)),b})}computeOutputShape(e){e=At(e);let t=e.slice(),n,a,r,s;this.dataFormat==="channelsFirst"?(n=1,a=2,r=3,s=4):(n=4,a=1,r=2,s=3);let i=this.kernelSize[0],o=this.kernelSize[1],l=this.kernelSize[2],u=this.strides[0],d=this.strides[1],h=this.strides[2];return t[n]=this.filters,t[a]=_r(t[a],u,i,this.padding),t[r]=_r(t[r],d,o,this.padding),t[s]=_r(t[s],h,l,this.padding),t}getConfig(){let e=super.getConfig();return delete e.dilationRate,e}};Ax.className="Conv3DTranspose";ue.registerClass(Ax);var AS=class extends qh{constructor(e,t){super(e,t);if(this.DEFAULT_DEPTHWISE_INITIALIZER="glorotUniform",this.DEFAULT_POINTWISE_INITIALIZER="glorotUniform",this.depthwiseKernel=null,this.pointwiseKernel=null,t.filters==null)throw new G("The `filters` configuration field is required by SeparableConv, but is unspecified.");if(t.kernelInitializer!=null||t.kernelRegularizer!=null||t.kernelConstraint!=null)throw new G("Fields kernelInitializer, kernelRegularizer and kernelConstraint are invalid for SeparableConv2D. Use depthwiseInitializer, depthwiseRegularizer, depthwiseConstraint, pointwiseInitializer, pointwiseRegularizer and pointwiseConstraint instead.");if(t.padding!=null&&t.padding!=="same"&&t.padding!=="valid")throw new G(`SeparableConv${this.rank}D supports only padding modes: 'same' and 'valid', but received ${JSON.stringify(t.padding)}`);this.depthMultiplier=t.depthMultiplier==null?1:t.depthMultiplier,this.depthwiseInitializer=Pt(t.depthwiseInitializer||this.DEFAULT_DEPTHWISE_INITIALIZER),this.depthwiseRegularizer=Lt(t.depthwiseRegularizer),this.depthwiseConstraint=pn(t.depthwiseConstraint),this.pointwiseInitializer=Pt(t.depthwiseInitializer||this.DEFAULT_POINTWISE_INITIALIZER),this.pointwiseRegularizer=Lt(t.pointwiseRegularizer),this.pointwiseConstraint=pn(t.pointwiseConstraint)}build(e){if(e=At(e),e.length{e=Ke(e);let n;if(this.rank===1)throw new He("1D separable convolution is not implemented yet.");return this.rank===2&&(this.dataFormat==="channelsFirst"&&(e=ct(e,[0,2,3,1])),n=b8(e,this.depthwiseKernel.read(),this.pointwiseKernel.read(),this.strides,this.padding,this.dilationRate,"NHWC")),this.useBias&&(n=hr(n,this.bias.read(),this.dataFormat)),this.activation!=null&&(n=this.activation.apply(n)),this.dataFormat==="channelsFirst"&&(n=ct(n,[0,3,1,2])),n})}getConfig(){let e=super.getConfig();return delete e.rank,delete e.kernelInitializer,delete e.kernelRegularizer,delete e.kernelConstraint,e.depthwiseInitializer=jt(this.depthwiseInitializer),e.pointwiseInitializer=jt(this.pointwiseInitializer),e.depthwiseRegularizer=wt(this.depthwiseRegularizer),e.pointwiseRegularizer=wt(this.pointwiseRegularizer),e.depthwiseConstraint=hn(this.depthwiseConstraint),e.pointwiseConstraint=hn(this.pointwiseConstraint),e}};AS.className="SeparableConv";var xx=class extends AS{constructor(e){super(2,e)}};xx.className="SeparableConv2D";ue.registerClass(xx);var xS=class extends qh{constructor(e){super(1,e);xS.verifyArgs(e),this.inputSpec=[{ndim:3}]}getConfig(){let e=super.getConfig();return delete e.rank,delete e.dataFormat,e}static verifyArgs(e){if(typeof e.kernelSize!="number"&&!S2(e.kernelSize,"number",1,1))throw new G(`Conv1D expects config.kernelSize to be number or number[] with length 1, but received ${JSON.stringify(e.kernelSize)}.`)}},bx=xS;bx.className="Conv1D";ue.registerClass(bx);var vx=class extends rt{constructor(e){super(e);typeof e.cropping=="number"?this.cropping=[[e.cropping,e.cropping],[e.cropping,e.cropping]]:typeof e.cropping[0]=="number"?this.cropping=[[e.cropping[0],e.cropping[0]],[e.cropping[1],e.cropping[1]]]:this.cropping=e.cropping,this.dataFormat=e.dataFormat===void 0?"channelsLast":e.dataFormat,this.inputSpec=[{ndim:4}]}computeOutputShape(e){return this.dataFormat==="channelsFirst"?[e[0],e[1],e[2]-this.cropping[0][0]-this.cropping[0][1],e[3]-this.cropping[1][0]-this.cropping[1][1]]:[e[0],e[1]-this.cropping[0][0]-this.cropping[0][1],e[2]-this.cropping[1][0]-this.cropping[1][1],e[3]]}call(e,t){return Z(()=>{if(e=Ke(e),this.dataFormat==="channelsLast"){let n=Hf(e,this.cropping[0][0],e.shape[1]-this.cropping[0][0]-this.cropping[0][1],2);return Hf(n,this.cropping[1][0],e.shape[2]-this.cropping[1][1]-this.cropping[1][0],3)}else{let n=Hf(e,this.cropping[0][0],e.shape[2]-this.cropping[0][0]-this.cropping[0][1],3);return Hf(n,this.cropping[1][0],e.shape[3]-this.cropping[1][1]-this.cropping[1][0],4)}})}getConfig(){let e={cropping:this.cropping,dataFormat:this.dataFormat},t=super.getConfig();return Object.assign(e,t),e}};vx.className="Cropping2D";ue.registerClass(vx);var wx=class extends rt{constructor(e){super(e);this.DEFAULT_SIZE=[2,2],this.inputSpec=[{ndim:4}],this.size=e.size==null?this.DEFAULT_SIZE:e.size,this.dataFormat=e.dataFormat==null?"channelsLast":e.dataFormat,Yt(this.dataFormat),this.interpolation=e.interpolation==null?"nearest":e.interpolation,lee(this.interpolation)}computeOutputShape(e){if(this.dataFormat==="channelsFirst"){let t=e[2]==null?null:this.size[0]*e[2],n=e[3]==null?null:this.size[1]*e[3];return[e[0],e[1],t,n]}else{let t=e[1]==null?null:this.size[0]*e[1],n=e[2]==null?null:this.size[1]*e[2];return[e[0],t,n,e[3]]}}call(e,t){return Z(()=>{let n=Ke(e),a=n.shape;if(this.dataFormat==="channelsFirst"){n=ct(n,[0,2,3,1]);let r=this.size[0]*a[2],s=this.size[1]*a[3],i=this.interpolation==="nearest"?n.resizeNearestNeighbor([r,s]):n.resizeBilinear([r,s]);return ct(i,[0,3,1,2])}else{let r=this.size[0]*a[1],s=this.size[1]*a[2];return this.interpolation==="nearest"?n.resizeNearestNeighbor([r,s]):n.resizeBilinear([r,s])}})}getConfig(){let e={size:this.size,dataFormat:this.dataFormat},t=super.getConfig();return Object.assign(e,t),e}};wx.className="UpSampling2D";ue.registerClass(wx);function Kte(e,t,n=[1,1],a="valid",r,s){return Z(()=>{r==null&&(r=lr()),Yt(r);let i=mx(e,r);if(e.rank!==4)throw new G(`Input for depthwiseConv2d is required to be 4-D, but is instead ${e.rank}-D`);if(t.rank!==4)throw new G(`depthwiseKernel is required to be 4-D, but is instead ${t.rank}-D`);return i=Nh(i,t,n,a==="same"?"same":"valid","NHWC",s),r==="channelsFirst"&&(i=ct(i,[0,3,1,2])),i})}var kx=class extends gx{constructor(e){super(2,e);this.depthwiseKernel=null,this.depthMultiplier=e.depthMultiplier==null?1:e.depthMultiplier,this.depthwiseInitializer=Pt(e.depthwiseInitializer||this.DEFAULT_KERNEL_INITIALIZER),this.depthwiseConstraint=pn(e.depthwiseConstraint),this.depthwiseRegularizer=Lt(e.depthwiseRegularizer)}build(e){if(e=At(e),e.length<4)throw new G(`Inputs to DepthwiseConv2D should have rank 4. Received input shape: ${JSON.stringify(e)}.`);let t=this.dataFormat==="channelsFirst"?1:3;if(e[t]==null||e[t]<0)throw new G(`The channel dimension of the inputs to DepthwiseConv2D should be defined, but is not (${e[t]}).`);let n=e[t],a=[this.kernelSize[0],this.kernelSize[1],n,this.depthMultiplier];this.depthwiseKernel=this.addWeight("depthwise_kernel",a,null,this.depthwiseInitializer,this.depthwiseRegularizer,!0,this.depthwiseConstraint),this.useBias?this.bias=this.addWeight("bias",[n*this.depthMultiplier],null,this.biasInitializer,this.biasRegularizer,!0,this.biasConstraint):this.bias=null,this.built=!0}call(e,t){return Z(()=>{e=Ke(e);let n=Kte(e,this.depthwiseKernel.read(),this.strides,this.padding,this.dataFormat,null);return this.useBias&&(n=hr(n,this.bias.read(),this.dataFormat)),this.activation!=null&&(n=this.activation.apply(n)),n})}computeOutputShape(e){e=At(e);let t=this.dataFormat==="channelsFirst"?e[2]:e[1],n=this.dataFormat==="channelsFirst"?e[3]:e[2],a=this.dataFormat==="channelsFirst"?e[1]*this.depthMultiplier:e[3]*this.depthMultiplier,r=fr(t,this.kernelSize[0],this.padding,this.strides[0]),s=fr(n,this.kernelSize[1],this.padding,this.strides[1]);return this.dataFormat==="channelsFirst"?[e[0],a,r,s]:[e[0],r,s,a]}getConfig(){let e=super.getConfig();return e.depthMultiplier=this.depthMultiplier,e.depthwiseInitializer=jt(this.depthwiseInitializer),e.depthwiseRegularizer=wt(this.depthwiseRegularizer),e.depthwiseConstraint=hn(this.depthwiseRegularizer),e}};kx.className="DepthwiseConv2D";ue.registerClass(kx);function bS(e,t,n,a){if(Array.isArray(e)){if(t!=null||n!=null)throw new G("When inputs is an array, neither initialState or constants should be provided");a!=null&&(n=e.slice(e.length-a,e.length),e=e.slice(0,e.length-a)),e.length>1&&(t=e.slice(1,e.length)),e=e[0]}function r(s){return s==null||Array.isArray(s)?s:[s]}return t=r(t),n=r(n),{inputs:e,initialState:t,constants:n}}function vS(e,t,n,a=!1,r,s,i=!1,o=!1){return Z(()=>{let l=t.shape.length;if(l<3)throw new G(`Input should be at least 3D, but is ${l}D.`);let u=[1,0].concat(dr(2,l));if(t=ct(t,u),s!=null)throw new He("The rnn() functoin of the deeplearn.js backend does not support constants yet.");i&&console.warn("Backend rnn(): the unroll = true option is not applicable to the imperative deeplearn.js backend."),r!=null&&(r=r.asType("bool").asType("float32"),r.rank===l-1&&(r=Ea(r,-1)),r=ct(r,u)),a&&(t=Ra(t,0),r!=null&&(r=Ra(r,0)));let d=[],h,p=n,c=t.shape[0],m=or(t),f;r!=null&&(f=or(r));for(let y=0;ye(A,p));if(r==null)h=x[0],p=x[1];else{let v=Z(()=>{let b=f[y],w=$a(b).sub(b),I=x[0].mul(b).add(p[0].mul(w)),T=p.map((C,z)=>x[1][z].mul(b).add(C.mul(w)));return{output:I,newStates:T}});h=v.output,p=v.newStates}o&&d.push(h)}let g;return o&&(g=Fa(d,1)),[h,g,p]})}var wS=class extends rt{constructor(e){super(e);let t;if(e.cell==null)throw new G("cell property is missing for the constructor of RNN.");if(Array.isArray(e.cell)?t=new A0({cells:e.cell}):t=e.cell,t.stateSize==null)throw new G("The RNN cell should have an attribute `stateSize` (tuple of integers, one integer per RNN state).");this.cell=t,this.returnSequences=e.returnSequences==null?!1:e.returnSequences,this.returnState=e.returnState==null?!1:e.returnState,this.goBackwards=e.goBackwards==null?!1:e.goBackwards,this._stateful=e.stateful==null?!1:e.stateful,this.unroll=e.unroll==null?!1:e.unroll,this.supportsMasking=!0,this.inputSpec=[new tn({ndim:3})],this.stateSpec=null,this.states_=null,this.numConstants=null,this.keptStates=[]}getStates(){if(this.states_==null){let e=Array.isArray(this.cell.stateSize)?this.cell.stateSize.length:1;return dr(0,e).map(t=>null)}else return this.states_}setStates(e){this.states_=e}computeOutputShape(e){V2(e)&&(e=e[0]),e=e;let t=this.cell.stateSize;Array.isArray(t)||(t=[t]);let n=t[0],a;if(this.returnSequences?a=[e[0],e[1],n]:a=[e[0],n],this.returnState){let r=[];for(let s of t)r.push([e[0],s]);return[a].concat(r)}else return a}computeMask(e,t){return Z(()=>{Array.isArray(t)&&(t=t[0]);let n=this.returnSequences?t:null;if(this.returnState){let a=this.states.map(r=>null);return[n].concat(a)}else return n})}get states(){if(this.states_==null){let e=Array.isArray(this.cell.stateSize)?this.cell.stateSize.length:1,t=[];for(let n=0;ni.shape[i.shape.length-1]),s))throw new G(`An initialState was passed that is not compatible with cell.stateSize. Received stateSpec=${this.stateSpec}; However cell.stateSize is ${this.cell.stateSize}`)}else this.stateSpec=s.map(i=>new tn({shape:[null,i]}));this.stateful&&this.resetStates()}resetStates(e,t=!1){Z(()=>{if(!this.stateful)throw new ds("Cannot call resetStates() on an RNN Layer that is not stateful.");let n=this.inputSpec[0].shape[0];if(n==null)throw new G("If an RNN is stateful, it needs to know its batch size. Specify the batch size of your input tensors: \n- If using a Sequential model, specify the batch size by passing a `batchInputShape` option to your first layer.\n- If using the functional API, specify the batch size by passing a `batchShape` option to your Input layer.");if(this.states_==null)Array.isArray(this.cell.stateSize)?this.states_=this.cell.stateSize.map(a=>un([n,a])):this.states_=[un([n,this.cell.stateSize])];else if(e==null)Ge(this.states_),this.keptStates!=null&&(Ge(this.keptStates),this.keptStates=[]),Array.isArray(this.cell.stateSize)?this.states_=this.cell.stateSize.map(a=>un([n,a])):this.states_[0]=un([n,this.cell.stateSize]);else{if(Array.isArray(e)||(e=[e]),e.length!==this.states_.length)throw new G(`Layer ${this.name} expects ${this.states_.length} state(s), but it received ${e.length} state value(s). Input received: ${e}`);t===!0?this.keptStates.push(this.states_.slice()):Ge(this.states_);for(let a=0;aSn(a.clone()))})}apply(e,t){let n=t==null?null:t.initialState,a=t==null?null:t.constants;t==null&&(t={});let r=bS(e,n,a,this.numConstants);e=r.inputs,n=r.initialState,a=r.constants;let s=[],i=[];if(n!=null){t.initialState=n,s=s.concat(n),this.stateSpec=[];for(let o of n)this.stateSpec.push(new tn({shape:o.shape}));i=i.concat(this.stateSpec)}if(a!=null&&(t.constants=a,s=s.concat(a),this.numConstants=a.length),s[0]instanceof pr){let o=[e].concat(s),l=this.inputSpec.concat(i),u=this.inputSpec;this.inputSpec=l;let d=super.apply(o,t);return this.inputSpec=u,d}else return super.apply(e,t)}call(e,t){return Z(()=>{let n=t==null?null:t.mask,a=t==null?null:t.training,r=t==null?null:t.initialState;e=Ke(e),r==null&&(this.stateful?r=this.states_:r=this.getInitialState(e));let s=Array.isArray(this.cell.stateSize)?this.cell.stateSize.length:1;if(r.length!==s)throw new G(`RNN Layer has ${s} state(s) but was passed ${r.length} initial state(s).`);this.unroll&&console.warn("Ignoring unroll = true for RNN layer, due to imperative backend.");let i={training:a},o=vS((p,c)=>{let m=this.cell.call([p].concat(c),i);return[m[0],m.slice(1)]},e,r,this.goBackwards,n,null,this.unroll,this.returnSequences),l=o[0],u=o[1],d=o[2];this.stateful&&this.resetStates(d,a);let h=this.returnSequences?u:l;return this.returnState?[h].concat(d):h})}getInitialState(e){return Z(()=>{let t=un(e.shape);return t=Ce(t,[1,2]),t=Lh(t),Array.isArray(this.cell.stateSize)?this.cell.stateSize.map(n=>n>1?F2(t,[1,n]):t):this.cell.stateSize>1?[F2(t,[1,this.cell.stateSize])]:[t]})}get trainableWeights(){return this.trainable?this.cell.trainableWeights:[]}get nonTrainableWeights(){return this.trainable?this.cell.nonTrainableWeights:this.cell.weights}setFastWeightInitDuringBuild(e){super.setFastWeightInitDuringBuild(e),this.cell!=null&&this.cell.setFastWeightInitDuringBuild(e)}getConfig(){let e=super.getConfig(),t={returnSequences:this.returnSequences,returnState:this.returnState,goBackwards:this.goBackwards,stateful:this.stateful,unroll:this.unroll};this.numConstants!=null&&(t.numConstants=this.numConstants);let n=this.cell.getConfig();return this.getClassName()===wS.className&&(t.cell={className:this.cell.getClassName(),config:n}),{...n,...e,...t}}static fromConfig(e,t,n={}){let a=t.cell,r=cr(a,n);return new e(Object.assign(t,{cell:r}))}},cs=wS;cs.className="RNN";ue.registerClass(cs);var Kh=class extends rt{},g0=class extends Kh{constructor(e){super(e);this.DEFAULT_ACTIVATION="tanh",this.DEFAULT_KERNEL_INITIALIZER="glorotNormal",this.DEFAULT_RECURRENT_INITIALIZER="orthogonal",this.DEFAULT_BIAS_INITIALIZER="zeros",this.units=e.units,An(this.units,"units"),this.activation=Zs(e.activation==null?this.DEFAULT_ACTIVATION:e.activation),this.useBias=e.useBias==null?!0:e.useBias,this.kernelInitializer=Pt(e.kernelInitializer||this.DEFAULT_KERNEL_INITIALIZER),this.recurrentInitializer=Pt(e.recurrentInitializer||this.DEFAULT_RECURRENT_INITIALIZER),this.biasInitializer=Pt(e.biasInitializer||this.DEFAULT_BIAS_INITIALIZER),this.kernelRegularizer=Lt(e.kernelRegularizer),this.recurrentRegularizer=Lt(e.recurrentRegularizer),this.biasRegularizer=Lt(e.biasRegularizer),this.kernelConstraint=pn(e.kernelConstraint),this.recurrentConstraint=pn(e.recurrentConstraint),this.biasConstraint=pn(e.biasConstraint),this.dropout=au([1,qs([0,e.dropout==null?0:e.dropout])]),this.recurrentDropout=au([1,qs([0,e.recurrentDropout==null?0:e.recurrentDropout])]),this.stateSize=this.units,this.dropoutMask=null,this.recurrentDropoutMask=null}build(e){e=At(e),this.kernel=this.addWeight("kernel",[e[e.length-1],this.units],null,this.kernelInitializer,this.kernelRegularizer,!0,this.kernelConstraint),this.recurrentKernel=this.addWeight("recurrent_kernel",[this.units,this.units],null,this.recurrentInitializer,this.recurrentRegularizer,!0,this.recurrentConstraint),this.useBias?this.bias=this.addWeight("bias",[this.units],null,this.biasInitializer,this.biasRegularizer,!0,this.biasConstraint):this.bias=null,this.built=!0}call(e,t){return Z(()=>{if(e=e,e.length!==2)throw new G(`SimpleRNNCell expects 2 input Tensors, got ${e.length}.`);let n=e[1];e=e[0];let a=t.training==null?!1:t.training;0$a(e),rate:this.dropout,training:a})),0$a(n),rate:this.recurrentDropout,training:a}));let r,s=this.dropoutMask,i=this.recurrentDropoutMask;s!=null?r=Fr(K(e,s),this.kernel.read()):r=Fr(e,this.kernel.read()),this.bias!=null&&(r=hr(r,this.bias.read())),i!=null&&(n=K(n,i));let o=pe(r,Fr(n,this.recurrentKernel.read()));return this.activation!=null&&(o=this.activation.apply(o)),[o,o]})}getConfig(){let e=super.getConfig(),t={units:this.units,activation:Xs(this.activation),useBias:this.useBias,kernelInitializer:jt(this.kernelInitializer),recurrentInitializer:jt(this.recurrentInitializer),biasInitializer:jt(this.biasInitializer),kernelRegularizer:wt(this.kernelRegularizer),recurrentRegularizer:wt(this.recurrentRegularizer),biasRegularizer:wt(this.biasRegularizer),activityRegularizer:wt(this.activityRegularizer),kernelConstraint:hn(this.kernelConstraint),recurrentConstraint:hn(this.recurrentConstraint),biasConstraint:hn(this.biasConstraint),dropout:this.dropout,recurrentDropout:this.recurrentDropout};return{...e,...t}}};g0.className="SimpleRNNCell";ue.registerClass(g0);var Ix=class extends cs{constructor(e){e.cell=new g0(e),super(e)}call(e,t){return Z(()=>{this.cell.dropoutMask!=null&&(Ge(this.cell.dropoutMask),this.cell.dropoutMask=null),this.cell.recurrentDropoutMask!=null&&(Ge(this.cell.recurrentDropoutMask),this.cell.recurrentDropoutMask=null);let n=t==null?null:t.mask,a=t==null?null:t.training,r=t==null?null:t.initialState;return super.call(e,{mask:n,training:a,initialState:r})})}static fromConfig(e,t){return new e(t)}};Ix.className="SimpleRNN";ue.registerClass(Ix);var y0=class extends Kh{constructor(e){super(e);if(this.DEFAULT_ACTIVATION="tanh",this.DEFAULT_RECURRENT_ACTIVATION="hardSigmoid",this.DEFAULT_KERNEL_INITIALIZER="glorotNormal",this.DEFAULT_RECURRENT_INITIALIZER="orthogonal",this.DEFAULT_BIAS_INITIALIZER="zeros",e.resetAfter)throw new G("GRUCell does not support reset_after parameter set to true.");this.units=e.units,An(this.units,"units"),this.activation=Zs(e.activation===void 0?this.DEFAULT_ACTIVATION:e.activation),this.recurrentActivation=Zs(e.recurrentActivation===void 0?this.DEFAULT_RECURRENT_ACTIVATION:e.recurrentActivation),this.useBias=e.useBias==null?!0:e.useBias,this.kernelInitializer=Pt(e.kernelInitializer||this.DEFAULT_KERNEL_INITIALIZER),this.recurrentInitializer=Pt(e.recurrentInitializer||this.DEFAULT_RECURRENT_INITIALIZER),this.biasInitializer=Pt(e.biasInitializer||this.DEFAULT_BIAS_INITIALIZER),this.kernelRegularizer=Lt(e.kernelRegularizer),this.recurrentRegularizer=Lt(e.recurrentRegularizer),this.biasRegularizer=Lt(e.biasRegularizer),this.kernelConstraint=pn(e.kernelConstraint),this.recurrentConstraint=pn(e.recurrentConstraint),this.biasConstraint=pn(e.biasConstraint),this.dropout=au([1,qs([0,e.dropout==null?0:e.dropout])]),this.recurrentDropout=au([1,qs([0,e.recurrentDropout==null?0:e.recurrentDropout])]),this.implementation=e.implementation,this.stateSize=this.units,this.dropoutMask=null,this.recurrentDropoutMask=null}build(e){e=At(e);let t=e[e.length-1];this.kernel=this.addWeight("kernel",[t,this.units*3],null,this.kernelInitializer,this.kernelRegularizer,!0,this.kernelConstraint),this.recurrentKernel=this.addWeight("recurrent_kernel",[this.units,this.units*3],null,this.recurrentInitializer,this.recurrentRegularizer,!0,this.recurrentConstraint),this.useBias?this.bias=this.addWeight("bias",[this.units*3],null,this.biasInitializer,this.biasRegularizer,!0,this.biasConstraint):this.bias=null,this.built=!0}call(e,t){return Z(()=>{if(e=e,e.length!==2)throw new G(`GRUCell expects 2 input Tensors (inputs, h, c), got ${e.length}.`);let n=t.training==null?!1:t.training,a=e[1];e=e[0],0$a(e),rate:this.dropout,training:n,count:3})),0$a(a),rate:this.recurrentDropout,training:n,count:3}));let r=this.dropoutMask,s=this.recurrentDropoutMask,i,o,l;0{this.cell.dropoutMask!=null&&(Ge(this.cell.dropoutMask),this.cell.dropoutMask=null),this.cell.recurrentDropoutMask!=null&&(Ge(this.cell.recurrentDropoutMask),this.cell.recurrentDropoutMask=null);let n=t==null?null:t.mask,a=t==null?null:t.training,r=t==null?null:t.initialState;return super.call(e,{mask:n,training:a,initialState:r})})}static fromConfig(e,t){return t.implmentation===0&&(t.implementation=1),new e(t)}};Sx.className="GRU";ue.registerClass(Sx);var Xh=class extends Kh{constructor(e){super(e);this.DEFAULT_ACTIVATION="tanh",this.DEFAULT_RECURRENT_ACTIVATION="hardSigmoid",this.DEFAULT_KERNEL_INITIALIZER="glorotNormal",this.DEFAULT_RECURRENT_INITIALIZER="orthogonal",this.DEFAULT_BIAS_INITIALIZER="zeros",this.units=e.units,An(this.units,"units"),this.activation=Zs(e.activation===void 0?this.DEFAULT_ACTIVATION:e.activation),this.recurrentActivation=Zs(e.recurrentActivation===void 0?this.DEFAULT_RECURRENT_ACTIVATION:e.recurrentActivation),this.useBias=e.useBias==null?!0:e.useBias,this.kernelInitializer=Pt(e.kernelInitializer||this.DEFAULT_KERNEL_INITIALIZER),this.recurrentInitializer=Pt(e.recurrentInitializer||this.DEFAULT_RECURRENT_INITIALIZER),this.biasInitializer=Pt(e.biasInitializer||this.DEFAULT_BIAS_INITIALIZER),this.unitForgetBias=e.unitForgetBias,this.kernelRegularizer=Lt(e.kernelRegularizer),this.recurrentRegularizer=Lt(e.recurrentRegularizer),this.biasRegularizer=Lt(e.biasRegularizer),this.kernelConstraint=pn(e.kernelConstraint),this.recurrentConstraint=pn(e.recurrentConstraint),this.biasConstraint=pn(e.biasConstraint),this.dropout=au([1,qs([0,e.dropout==null?0:e.dropout])]),this.recurrentDropout=au([1,qs([0,e.recurrentDropout==null?0:e.recurrentDropout])]),this.implementation=e.implementation,this.stateSize=[this.units,this.units],this.dropoutMask=null,this.recurrentDropoutMask=null}build(e){var t;e=At(e);let n=e[e.length-1];this.kernel=this.addWeight("kernel",[n,this.units*4],null,this.kernelInitializer,this.kernelRegularizer,!0,this.kernelConstraint),this.recurrentKernel=this.addWeight("recurrent_kernel",[this.units,this.units*4],null,this.recurrentInitializer,this.recurrentRegularizer,!0,this.recurrentConstraint);let a;if(this.useBias){if(this.unitForgetBias){let r=this.biasInitializer,s=this.units;a=new(t=class extends Xa{apply(i,o){let l=r.apply([s]),u=new qf().apply([s]),d=r.apply([s*2]);return cI(cI(l,u),d)}},t.className="CustomInit",t)}else a=this.biasInitializer;this.bias=this.addWeight("bias",[this.units*4],null,a,this.biasRegularizer,!0,this.biasConstraint)}else this.bias=null;this.built=!0}call(e,t){return Z(()=>{let n=t.training==null?!1:t.training;if(e=e,e.length!==3)throw new G(`LSTMCell expects 3 input Tensors (inputs, h, c), got ${e.length}.`);let a=e[1],r=e[2];e=e[0],0$a(e),rate:this.dropout,training:n,count:4})),0$a(a),rate:this.recurrentDropout,training:n,count:4}));let s=this.dropoutMask,i=this.recurrentDropoutMask,o,l,u,d;0{this.cell.dropoutMask!=null&&(Ge(this.cell.dropoutMask),this.cell.dropoutMask=null),this.cell.recurrentDropoutMask!=null&&(Ge(this.cell.recurrentDropoutMask),this.cell.recurrentDropoutMask=null);let n=t==null?null:t.mask,a=t==null?null:t.training,r=t==null?null:t.initialState;return super.call(e,{mask:n,training:a,initialState:r})})}static fromConfig(e,t){return t.implmentation===0&&(t.implementation=1),new e(t)}};Nx.className="LSTM";ue.registerClass(Nx);var A0=class extends Kh{constructor(e){super(e);this.cells=e.cells}get stateSize(){let e=[];for(let t of this.cells.slice().reverse())Array.isArray(t.stateSize)?e.push(...t.stateSize):e.push(t.stateSize);return e}call(e,t){return Z(()=>{e=e;let n=e.slice(1),a=[];for(let i of this.cells.slice().reverse())Array.isArray(i.stateSize)?a.push(n.splice(0,i.stateSize.length)):a.push(n.splice(0,1));a.reverse();let r=[],s;for(let i=0;i{io(`RNNCell_${a}`,()=>{n.build(e),Array.isArray(n.stateSize)?t=n.stateSize[0]:t=n.stateSize,e=[e[0],t]})}),this.built=!0}getConfig(){let e=super.getConfig(),t=a=>({className:a.getClassName(),config:a.getConfig()}),n={cells:this.cells.map(t)};return{...e,...n}}static fromConfig(e,t,n={}){let a=[];for(let r of t.cells)a.push(cr(r,n));return new e({cells:a})}get trainableWeights(){if(!this.trainable)return[];let e=[];for(let t of this.cells)e.push(...t.trainableWeights);return e}get nonTrainableWeights(){let e=[];for(let t of this.cells)e.push(...t.nonTrainableWeights);if(!this.trainable){let t=[];for(let n of this.cells)t.push(...n.trainableWeights);return t.concat(e)}return e}getWeights(){let e=[];for(let t of this.cells)e.push(...t.weights);return U2(e)}setWeights(e){let t=[];for(let n of this.cells){let a=n.weights.length,r=e.splice(a);for(let s=0;smI(t(),n),i=()=>Bh(s,t,a);return!r||r<=1?Sn(i().clone()):Array(r).fill(void 0).map(i).map(o=>Sn(o.clone()))}var kS=class extends cs{constructor(e){if(e.unroll)throw new He("Unrolling is not possible with convolutional RNNs.");if(Array.isArray(e.cell))throw new He("It is not possible at the moment to stack convolutional cells.");super(e);this.inputSpec=[new tn({ndim:5})]}call(e,t){return Z(()=>{if(this.cell.dropoutMask!=null&&(Ge(this.cell.dropoutMask),this.cell.dropoutMask=null),this.cell.recurrentDropoutMask!=null&&(Ge(this.cell.recurrentDropoutMask),this.cell.recurrentDropoutMask=null),t&&t.constants)throw new G("ConvRNN2D cell does not support constants");let n=t==null?null:t.mask,a=t==null?null:t.training,r=t==null?null:t.initialState;return super.call(e,{mask:n,training:a,initialState:r})})}computeOutputShape(e){let t=this.computeSingleOutputShape(e);return this.returnSequences||(t=[t[0],...t.slice(2)]),this.returnState&&(t=[t,...Array(2).fill([e[0],...t.slice(-3)])]),t}getInitialState(e){return Z(()=>{let{stateSize:t}=this.cell,n=e.shape,a=this.computeSingleOutputShape(n),r=[a[0],...a.slice(2)],s=un(r);return Array.isArray(t)?Array(t.length).fill(s):[s]})}resetStates(e,t=!1){Z(()=>{if(!this.stateful)throw new ds("Cannot call resetStates() on an RNN Layer that is not stateful.");let n=this.inputSpec[0].shape,a=this.computeSingleOutputShape(n),r=[a[0],...a.slice(2)];if(n[0]==null)throw new G("If an RNN is stateful, it needs to know its batch size. Specify the batch size of your input tensors: \n- If using a Sequential model, specify the batch size by passing a `batchInputShape` option to your first layer.\n- If using the functional API, specify the batch size by passing a `batchShape` option to your Input layer.");if(this.getStates()==null)Array.isArray(this.cell.stateSize)?this.states_=this.cell.stateSize.map(()=>un(r)):this.states_=[un(r)];else if(e==null)Ge(this.states_),this.keptStates!=null&&(Ge(this.keptStates),this.keptStates=[]),Array.isArray(this.cell.stateSize)?this.states_=this.cell.stateSize.map(()=>un(r)):this.states_[0]=un(r);else{if(Array.isArray(e)||(e=[e]),e.length!==this.states_.length)throw new G(`Layer ${this.name} expects ${this.states_.length} state(s), but it received ${e.length} state value(s). Input received: ${e}`);t?this.keptStates.push(this.states_.slice()):Ge(this.states_);for(let s=0;sSn(s.clone()))})}computeSingleOutputShape(e){let{dataFormat:t,filters:n,kernelSize:a,padding:r,strides:s,dilationRate:i}=this.cell,o=t==="channelsFirst",l=e[o?3:2],u=e[o?4:3],d=fr(l,a[0],r,s[0],i[0]),h=fr(u,a[1],r,s[1],i[1]);return[...e.slice(0,2),...o?[n,d,h]:[d,h,n]]}};kS.className="ConvRNN2D";var x0=class extends Xh{constructor(e){let{filters:t,kernelSize:n,strides:a,padding:r,dataFormat:s,dilationRate:i}=e;super({...e,units:t});this.filters=t,An(this.filters,"filters"),this.kernelSize=ou(n,2,"kernelSize"),this.kernelSize.forEach(o=>An(o,"kernelSize")),this.strides=ou(a||1,2,"strides"),this.strides.forEach(o=>An(o,"strides")),this.padding=r||"valid",Oa(this.padding),this.dataFormat=s||"channelsLast",Yt(this.dataFormat),this.dilationRate=ou(i||1,2,"dilationRate"),this.dilationRate.forEach(o=>An(o,"dilationRate"))}build(e){var t;e=At(e);let n=this.dataFormat==="channelsFirst"?1:e.length-1;if(e[n]==null)throw new G(`The channel dimension of the input should be defined. Found ${e[n]}`);let a=e[n],r=4,s=this.kernelSize.concat([a,this.filters*r]);this.kernel=this.addWeight("kernel",s,null,this.kernelInitializer,this.kernelRegularizer,!0,this.kernelConstraint);let i=this.kernelSize.concat([this.filters,this.filters*r]);if(this.recurrentKernel=this.addWeight("recurrent_kernel",i,null,this.recurrentInitializer,this.recurrentRegularizer,!0,this.recurrentConstraint),this.useBias){let o;if(this.unitForgetBias){let l=this.biasInitializer,u=this.filters;o=new(t=class extends Xa{apply(d,h){let p=l.apply([u]),c=os([u]),m=l.apply([u*2]);return R2([p,c,m])}},t.className="CustomInit",t)}else o=this.biasInitializer;this.bias=this.addWeight("bias",[this.filters*r],null,o,this.biasRegularizer,!0,this.biasConstraint)}this.built=!0}call(e,t){return Z(()=>{if(e.length!==3)throw new G(`ConvLSTM2DCell expects 3 input Tensors (inputs, h, c), got ${e.length}.`);let n=t.training||!1,a=e[0],r=e[1],s=e[2],i=4;0$a(a),rate:this.dropout,training:n,count:i}));let o=this.dropoutMask,l=(ee,ie,ae)=>!ie||!ie[ae]?ee:K(ie[ae],ee),u=l(a,o,0),d=l(a,o,1),h=l(a,o,2),p=l(a,o,3);0$a(r),rate:this.recurrentDropout,training:n,count:i}));let c=this.recurrentDropoutMask,m=l(r,c,0),f=l(r,c,1),g=l(r,c,2),y=l(r,c,3),A=3,[x,v,b,w]=da(this.kernel.read(),i,A),[I,T,C,z]=this.useBias?da(this.bias.read(),i):[null,null,null,null];u=this.inputConv(u,x,I,this.padding),d=this.inputConv(d,v,T,this.padding),h=this.inputConv(h,b,C,this.padding),p=this.inputConv(p,w,z,this.padding);let[$,S,D,_]=da(this.recurrentKernel.read(),i,A);m=this.recurrentConv(m,$),f=this.recurrentConv(f,S),g=this.recurrentConv(g,D),y=this.recurrentConv(y,_);let W=this.recurrentActivation.apply(pe(u,m)),X=this.recurrentActivation.apply(pe(d,f)),q=pe(K(X,s),K(W,this.activation.apply(pe(h,g)))),Q=K(this.recurrentActivation.apply(pe(p,y)),this.activation.apply(q));return[Q,Q,q]})}getConfig(){let{units:e,...t}=super.getConfig(),n={filters:this.filters,kernelSize:this.kernelSize,padding:this.padding,dataFormat:this.dataFormat,dilationRate:this.dilationRate,strides:this.strides};return{...t,...n}}inputConv(e,t,n,a){let r=Ws(e,t,this.strides,a||"valid",this.dataFormat==="channelsFirst"?"NCHW":"NHWC",this.dilationRate);return n?hr(r,n,this.dataFormat):r}recurrentConv(e,t){return Ws(e,t,1,"same",this.dataFormat==="channelsFirst"?"NCHW":"NHWC")}};x0.className="ConvLSTM2DCell";ue.registerClass(x0);var Tx=class extends kS{constructor(e){let t=new x0(e);super({...e,cell:t})}static fromConfig(e,t){return new e(t)}};Tx.className="ConvLSTM2D";ue.registerClass(Tx);var b0=class extends rt{constructor(e){super(e);this.rate=Math.max(Math.min(e.rate,1),0),this.noiseShape=e.noiseShape,this.seed=e.seed,this.supportsMasking=!0}getNoiseShape(e){if(this.noiseShape==null)return this.noiseShape;let t=e.shape,n=[];for(let a=0;a{this.invokeCallHook(e,t);let n=Ke(e);if(0mI(n,this.rate,r,this.seed),()=>n,a)}return e})}getConfig(){let e={rate:this.rate,noiseShape:this.noiseShape,seed:this.seed},t=super.getConfig();return Object.assign(e,t),e}dispose(){return super.dispose()}};b0.className="Dropout";ue.registerClass(b0);var Ex=class extends b0{constructor(e){super(e);this.inputSpec=[{ndim:3}]}getNoiseShape(e){let t=e.shape;return[t[0],1,t[2]]}};Ex.className="SpatialDropout1D";ue.registerClass(Ex);var Cx=class extends rt{constructor(e){super(e);if(this.activation=null,this.useBias=!0,this.kernel=null,this.bias=null,this.DEFAULT_KERNEL_INITIALIZER="glorotNormal",this.DEFAULT_BIAS_INITIALIZER="zeros",e.batchInputShape==null&&e.inputShape==null&&e.inputDim!=null){let t=null;e.batchSize!=null&&(t=e.batchSize),this.batchInputShape=[t,e.inputDim]}this.units=e.units,An(this.units,"units"),this.activation=Zs(e.activation),e.useBias!=null&&(this.useBias=e.useBias),this.kernelInitializer=Pt(e.kernelInitializer||this.DEFAULT_KERNEL_INITIALIZER),this.biasInitializer=Pt(e.biasInitializer||this.DEFAULT_BIAS_INITIALIZER),this.kernelConstraint=pn(e.kernelConstraint),this.biasConstraint=pn(e.biasConstraint),this.kernelRegularizer=Lt(e.kernelRegularizer),this.biasRegularizer=Lt(e.biasRegularizer),this.activityRegularizer=Lt(e.activityRegularizer),this.supportsMasking=!0,this.inputSpec=[{minNDim:2}]}build(e){e=At(e);let t=e[e.length-1];this.kernel==null&&(this.kernel=this.addWeight("kernel",[t,this.units],null,this.kernelInitializer,this.kernelRegularizer,!0,this.kernelConstraint),this.useBias&&(this.bias=this.addWeight("bias",[this.units],null,this.biasInitializer,this.biasRegularizer,!0,this.biasConstraint))),this.inputSpec=[{minNDim:2,axes:{[-1]:t}}],this.built=!0}computeOutputShape(e){e=At(e);let t=e.slice();return t[t.length-1]=this.units,t}call(e,t){return Z(()=>{this.invokeCallHook(e,t);let n=Ke(e),a=rI(this.activation.getClassName()),r;return a!=null?r=Fr(n,this.kernel.read(),a,this.bias?this.bias.read():null):(r=Fr(n,this.kernel.read()),this.bias!=null&&(r=hr(r,this.bias.read())),this.activation!=null&&(r=this.activation.apply(r))),r})}getConfig(){let e={units:this.units,activation:Xs(this.activation),useBias:this.useBias,kernelInitializer:jt(this.kernelInitializer),biasInitializer:jt(this.biasInitializer),kernelRegularizer:wt(this.kernelRegularizer),biasRegularizer:wt(this.biasRegularizer),activityRegularizer:wt(this.activityRegularizer),kernelConstraint:hn(this.kernelConstraint),biasConstraint:hn(this.biasConstraint)},t=super.getConfig();return Object.assign(e,t),e}};Cx.className="Dense";ue.registerClass(Cx);var Mx=class extends rt{constructor(e){e=e||{},super(e),this.inputSpec=[{minNDim:3}],this.dataFormat=e.dataFormat}computeOutputShape(e){e=At(e);for(let t of e.slice(1))if(t==null)throw new G(`The shape of the input to "Flatten" is not fully defined (got ${e.slice(1)}). Make sure to pass a complete "input_shape" or "batch_input_shape" argument to the first layer in your model.`);return[e[0],Gs(e,1)]}call(e,t){return Z(()=>{this.invokeCallHook(e,t);let n=Ke(e);if(this.dataFormat==="channelsFirst"&&n.rank>1){let a=[0];for(let r=2;r{this.invokeCallHook(e,t);let n=Ke(e);return this.activation.apply(n)})}getConfig(){let e={activation:Xs(this.activation)},t=super.getConfig();return Object.assign(e,t),e}};$x.className="Activation";ue.registerClass($x);var Rx=class extends rt{constructor(e){super(e);this.n=e.n,this.inputSpec=[{ndim:2}]}computeOutputShape(e){return[e[0],this.n,e[1]]}call(e,t){return Z(()=>(e=Ke(e),pee(e,this.n)))}getConfig(){let e={n:this.n},t=super.getConfig();return Object.assign(e,t),e}};Rx.className="RepeatVector";ue.registerClass(Rx);var Fx=class extends rt{constructor(e){super(e);this.targetShape=e.targetShape;for(let t=0;t{this.invokeCallHook(e,t);let n=Ke(e),a=n.shape,r=a.slice(0,1).concat(this.fixUnknownDimension(a.slice(1),this.targetShape));return n.reshape(r)})}getConfig(){let e={targetShape:this.targetShape},t=super.getConfig();return Object.assign(e,t),e}};Fx.className="Reshape";ue.registerClass(Fx);var Ox=class extends rt{constructor(e){super(e);if(e.dims==null)throw new Error("Required configuration field `dims` is missing during Permute constructor call.");if(!Array.isArray(e.dims))throw new Error(`Permute constructor requires \`dims\` to be an Array, but received ${e.dims} instead.`);let t=dr(1,e.dims.length+1);if(!k.arraysEqual(e.dims.slice().sort(),t))throw new Error("Invalid permutation `dims`: "+JSON.stringify(e.dims)+" `dims` must contain consecutive integers starting from 1.");this.dims=e.dims,this.dimsIncludingBatch=[0].concat(this.dims),this.inputSpec=[new tn({ndim:this.dims.length+1})]}computeOutputShape(e){e=At(e);let t=e.slice();return this.dims.forEach((n,a)=>{t[a+1]=e[n]}),t}call(e,t){return ct(Ke(e),this.dimsIncludingBatch)}getConfig(){let e={dims:this.dims},t=super.getConfig();return Object.assign(e,t),e}};Ox.className="Permute";ue.registerClass(Ox);var Dx=class extends rt{constructor(e){super(e==null?{}:e);this.supportsMasking=!0,e!=null?this.maskValue=e.maskValue==null?0:e.maskValue:this.maskValue=0}computeOutputShape(e){return e}getConfig(){let e=super.getConfig(),t={maskValue:this.maskValue};return Object.assign(t,e),t}computeMask(e,t){let n=Ke(e),a=-1;return wf(Yl(n,this.maskValue),a)}call(e,t){return Z(()=>{this.invokeCallHook(e,t);let n=Ke(e),a=-1,r=!0,s=wf(Yl(n,this.maskValue),a,r);return n.mul(s.asType(n.dtype))})}};Dx.className="Masking";ue.registerClass(Dx);var _x=class extends rt{constructor(e){super(e);if(this.embeddings=null,this.DEFAULT_EMBEDDINGS_INITIALIZER="randomUniform",e.batchInputShape==null&&e.inputShape==null){let t=null;e.batchSize!=null&&(t=e.batchSize),e.inputLength==null?this.batchInputShape=[t,null]:this.batchInputShape=[t].concat(Ft(e.inputLength))}this.inputDim=e.inputDim,An(this.inputDim,"inputDim"),this.outputDim=e.outputDim,An(this.outputDim,"outputDim"),this.embeddingsInitializer=Pt(e.embeddingsInitializer||this.DEFAULT_EMBEDDINGS_INITIALIZER),this.embeddingsRegularizer=Lt(e.embeddingsRegularizer),this.activityRegularizer=Lt(e.activityRegularizer),this.embeddingsConstraint=pn(e.embeddingsConstraint),this.maskZero=e.maskZero,this.supportsMasking=e.maskZero,this.inputLength=e.inputLength}build(e){this.embeddings=this.addWeight("embeddings",[this.inputDim,this.outputDim],this.dtype,this.embeddingsInitializer,this.embeddingsRegularizer,!0,this.embeddingsConstraint),this.built=!0}warnOnIncompatibleInputShape(e){}computeMask(e,t){return Z(()=>this.maskZero?(e=Ke(e),Yl(e,at(e))):null)}computeOutputShape(e){if(e=At(e),this.inputLength==null)return[...e,this.outputDim];let t=Ft(this.inputLength);if(t.length!==e.length-1)throw new G(`"inputLength" is ${this.inputLength}, but received input shape has shape ${e}`);{let n=0;for(let a=0;a{this.invokeCallHook(e,t);let n=Ke(e);return n.dtype!=="int32"&&(n=Ph(n,"int32")),fI(this.embeddings.read(),n.as1D()).reshape(At(this.computeOutputShape(n.shape)))})}getConfig(){let e={inputDim:this.inputDim,outputDim:this.outputDim,embeddingsInitializer:jt(this.embeddingsInitializer),embeddingsRegularizer:wt(this.embeddingsRegularizer),activityRegularizer:wt(this.activityRegularizer),embeddingsConstraint:hn(this.embeddingsConstraint),maskZero:this.maskZero,inputLength:this.inputLength},t=super.getConfig();return Object.assign(e,t),e}};_x.className="Embedding";ue.registerClass(_x);var po=class extends rt{constructor(e){super(e||{});this.supportsMasking=!0}mergeFunction(e){throw new He}computeElementwiseOpOutputShape(e,t){if(e==null||t==null)return null;if(e.length1)throw new G(`Can not merge tensors with different batch sizes. Got tensors with shapes: ${JSON.stringify(e)}.`);let n=e[0]==null?null:e[0].slice(1);for(let r=1;rr.length);e.indexOf(null)===-1&&Hs(a).length===1?this.reshapeRequired=!1:this.reshapeRequired=!0}call(e,t){return Z(()=>{if(e=e,this.reshapeRequired){let n=[],a=e.map(r=>r.rank);if(a.indexOf(null)===-1){let r=qs(a);for(let s of e){let i=s.rank;for(let o=0;o1){let u=dr(1,l).concat([0]);n.push(ct(o,u)),r=!0}else n.push(o)}let s=this.mergeFunction(n),i=s.rank;if(r){if(i==null){let o=s.shape,l=o.length,u=o[l-1],d=[u].concat(o.slice(0,o.length-1));s=ct(s.reshape([-1,u]),[1,0]).reshape(d)}else if(i>1){let o=[i-1].concat(dr(0,i-1));s=ct(s,o)}}return s}}else return this.mergeFunction(e)})}computeOutputShape(e){e=e;let t;e[0]==null?t=null:t=e[0].slice(1);for(let a=1;a{if(t==null)return null;if(!Array.isArray(t))throw new G("`mask` should be an Array");if(!Array.isArray(e))throw new G("`inputs` should be an Array");if(t.length!==e.length)throw new G(`The Array 'inputs' and 'mask' are expected to have the same length, but have different lengths (${e.length} vs ${t.length})`);if(t.every(a=>a==null))return null;t=t.map(a=>a==null?a:Ea(a,0));let n=t[0];for(let a=1;a{let t=e[0].clone();for(let n=1;n{let t=e[0].clone();for(let n=1;n{let t=e[0].clone();for(let n=1;n{let t=e[0];for(let n=1;n{let t=e[0];for(let n=1;n1)throw new G("A `Concatenate` layer requires inputs with matching shapes except for the concat axis. Got input shapes: "+JSON.stringify(e))}mergeFunction(e){return Z(()=>R2(e,this.axis))}computeOutputShape(e){if(!(Array.isArray(e)&&Array.isArray(e[0])))throw new G("A `Concatenate` layer should be called on a list of inputs.");let t=e,n=t[0].slice(),a=this.axis<0?n.length+this.axis:this.axis;for(let r of t.slice(1)){if(n[a]==null||r[a]==null){n[a]=null;break}n[a]+=r[a]}return n}computeMask(e,t){if(t==null)return null;if(!Array.isArray(t))throw new G("`mask` should be an array for Concatenate");if(!Array.isArray(e))throw new G("`inputs` should be an array for Concatenate");if(t.length!==e.length)throw new G(`Mismatch in the length of mask (${t.length}) and the legnth of inputs (${e.length})`);return Z(()=>{let n=!0;if(t.forEach(s=>{if(s!=null){n=!1;return}}),n)return null;let a=[];for(let s=0;s3||t.shape.length>3)throw new He("batchDot is not implemented for tensors of 4D or higher rank yet");if(k.assert(e.shape.length>=2,()=>`batchDot requires the rank of x to be >= 2, but got ${e.shape.length}`),k.assert(e.shape.length>=2,()=>`batchDot requires the rank of y to be >= 2, but got ${t.shape.length}`),typeof n=="number"&&(n=[n,n]),e.dtype==="complex64"||t.dtype==="complex64")throw new He("batchDot is not implemented for complex64-type Tensors yet.");let a=e.shape.length,r=t.shape.length;n==null&&(n=[a-1,r-2]);let s=n;return Z(()=>{let i;if(a>r){i=a-r;let l=[];for(let u=0;ua){i=r-a;let l=[];for(let u=0;u0){let l;a>r?l=a+r-3:l=a-1;let u=[];for(let d=l;d"A `Dot` layer should be called on a list of exactly 2 inputs.");let t=e[0],n=e[1];if(t.length>3||n.length>3)throw new He("Dot layer does not support tensors of 4D or higher rank yet.");let a=this.interpretAxes(t,n);if(t[a[0]]!==n[a[1]])throw new G(`Dimension incompatibility: ${t[a[0]]} !== ${n[a[1]]}`)}mergeFunction(e){if(e.length!==2)throw new G(`A \`Dot\` layer must be called on exactly 2 inputs, but received ${e.length} input(s).`);let t=e[0],n=e[1],a;return Array.isArray(this.axes)?a=this.axes.map((r,s)=>Zh(r,e[s].shape.length)):a=[Zh(this.axes,t.shape.length),Zh(this.axes,n.shape.length)],this.normalize&&(t=s0(t,a[0]),n=s0(n,a[1])),Xte(t,n,a)}interpretAxes(e,t){let n;return Array.isArray(this.axes)?n=this.axes:n=[Zh(this.axes,e.length),Zh(this.axes,t.length)],n}computeOutputShape(e){k.assert(Array.isArray(e)&&e.length===2&&Array.isArray(e[0])&&Array.isArray(e[1]),()=>"A `Dot` layer should be called on a list of exactly 2 inputs.");let t=e[0].slice(),n=e[1].slice();if(t.length>3||n.length>3)throw new He("Dot layer does not support tensors of 4D or higher rank yet.");let a=this.interpretAxes(t,n);t.splice(a[0],1),n.splice(a[1],1),n.splice(0,1);let r=t.concat(n);return r.length===1&&r.push(1),r}computeMask(e,t){return null}getConfig(){let e={axes:this.axes,normalize:this.normalize},t=super.getConfig();return Object.assign(e,t),e}};Ux.className="Dot";ue.registerClass(Ux);var jx=class extends rt{constructor(e){super(e);this.supportsMasking=!0,this.stddev=e.stddev}computeOutputShape(e){return e}getConfig(){let e=super.getConfig(),t={stddev:this.stddev};return Object.assign(t,e),t}call(e,t){return Z(()=>{this.invokeCallHook(e,t);let n=Ke(e);return Bh(()=>Gf(n.shape,0,this.stddev).add(n),()=>n,t.training||!1)})}};jx.className="GaussianNoise";ue.registerClass(jx);var Hx=class extends rt{constructor(e){super(e);this.supportsMasking=!0,this.rate=e.rate}computeOutputShape(e){return e}getConfig(){let e=super.getConfig(),t={rate:this.rate};return Object.assign(t,e),t}call(e,t){return Z(()=>{this.invokeCallHook(e,t);let n=Ke(e);return this.rate>0&&this.rate<1?Bh(()=>{let a=Math.sqrt(this.rate/(1-this.rate));return n.mul(Gf(n.shape,1,a))},()=>n,t.training||!1):n})}};Hx.className="GaussianDropout";ue.registerClass(Hx);var Gx=class extends rt{constructor(e){super(e);this.supportsMasking=!0,this.rate=e.rate,this.noiseShape=e.noiseShape}_getNoiseShape(e){return this.noiseShape||Ke(e).shape}computeOutputShape(e){return e}getConfig(){let e=super.getConfig(),t={rate:this.rate};return Object.assign(t,e),t}call(e,t){return Z(()=>{if(this.rate<1&&this.rate>0){let n=this._getNoiseShape(e);return Bh(()=>{let a=Ke(e),r=1.6732632423543772,s=1.0507009873554805,i=-r*s,o=Yi(Rh(n),this.rate);o=Ph(o,"float32");let l=((1-this.rate)*(1+this.rate*i**2))**-.5,u=-l*i*this.rate;return a.mul(o).add(o.add(-1).mul(i)).mul(l).add(u)},()=>Ke(e),t.training||!1)}return e})}};Gx.className="AlphaDropout";ue.registerClass(Gx);function Yh(e,t,n,a,r,s=.001){let i;if(e.rank===2)i=SG(e,t,n,a,r,s);else if(e.rank===3)i=TG(e,t,n,a,r,s);else if(e.rank===4)i=CG(e,t,n,a,r,s);else throw new He(`batchNormalization is not implemented for array of rank ${e.rank} yet`);return i}function Zte(e,t,n,a,r=.001){return Z(()=>{let s=GA(e,a),i=s.mean,o=s.variance;return[Yh(e,i,o,n,t,r),i,o]})}function Yte(e,t,n,a,r=.001){return Z(()=>{let s=GA(e,a),i=s.mean,o=s.variance,l=[];for(let c of dr(0,e.rank))a.indexOf(c)!==-1?l.push(1):l.push(e.shape[c]);let u=i.reshape(l),d=o.reshape(l),h=t==null?null:t.reshape(l),p=n==null?null:n.reshape(l);return[Yh(e,u,d,p,h,r),i,o]})}function Jte(e,t,n,a,r=.001){return k.arraysEqual(a.slice().sort(),dr(0,e.rank-1))?Zte(e,t,n,a,r):Yte(e,t,n,a,r)}var qx=class extends rt{constructor(e){e==null&&(e={}),super(e),this.supportsMasking=!0,this.axis=e.axis==null?-1:e.axis,this.momentum=e.momentum==null?.99:e.momentum,this.epsilon=e.epsilon==null?.001:e.epsilon,this.center=e.center==null?!0:e.center,this.scale=e.scale==null?!0:e.scale,this.betaInitializer=Pt(e.betaInitializer||"zeros"),this.gammaInitializer=Pt(e.gammaInitializer||"ones"),this.movingMeanInitializer=Pt(e.movingMeanInitializer||"zeros"),this.movingVarianceInitializer=Pt(e.movingVarianceInitializer||"ones"),this.betaConstraint=pn(e.betaConstraint),this.gammaConstraint=pn(e.gammaConstraint),this.betaRegularizer=Lt(e.betaRegularizer),this.gammaRegularizer=Lt(e.gammaRegularizer)}build(e){e=At(e);let t=this.axis>=0?this.axis:this.axis+e.length,n=e[t];if(n==null)throw new G(`Axis ${t} of input tensor should have a defined dimension but the layer received an input with shape ${JSON.stringify(e)}.`);this.inputSpec=[new tn({ndim:e.length,axes:{[t]:n}})];let a=[n];this.scale&&(this.gamma=this.addWeight("gamma",a,null,this.gammaInitializer,this.gammaRegularizer,!0,this.gammaConstraint)),this.center&&(this.beta=this.addWeight("beta",a,null,this.betaInitializer,this.betaRegularizer,!0,this.betaConstraint)),this.movingMean=this.addWeight("moving_mean",a,null,this.movingMeanInitializer,null,!1),this.movingVariance=this.addWeight("moving_variance",a,null,this.movingVarianceInitializer,null,!1),this.built=!0}call(e,t){return Z(()=>{let n=t.training==null?!1:t.training,a=Ke(e),r=a.shape,s=r.length,i=dr(0,s),o=this.axis>=0?this.axis:this.axis+s;i.splice(o,1);let l=ao(1,s);l[o]=r[o];let u=i.slice();u.sort();let d=!k.arraysEqual(u,dr(0,s).slice(0,s-1)),h=()=>{if(d){let g=this.movingMean.read().reshape(l),y=this.movingVariance.read().reshape(l),A=this.center?this.beta.read().reshape(l):null,x=this.scale?this.gamma.read().reshape(l):null;return Yh(a,g,y,A,x,this.epsilon)}else return Yh(a,this.movingMean.read(),this.movingVariance.read(),this.beta==null?null:this.beta.read(),this.gamma==null?null:this.gamma.read(),this.epsilon)};if(!n)return h();let[p,c,m]=Jte(a,this.gamma.read(),this.beta.read(),i,this.epsilon),f=(g,y,A)=>{Z(()=>{let x=1-A,v=g.read(),b=v.sub(y).mul(x);g.write(v.sub(b))})};return(()=>{f(this.movingMean,c,this.momentum),f(this.movingVariance,m,this.momentum)})(),p})}getConfig(){let e={axis:this.axis,momentum:this.momentum,epsilon:this.epsilon,center:this.center,scale:this.scale,betaInitializer:jt(this.betaInitializer),gammaInitializer:jt(this.gammaInitializer),movingMeanInitializer:jt(this.movingMeanInitializer),movingVarianceInitializer:jt(this.movingVarianceInitializer),betaRegularizer:wt(this.betaRegularizer),gammaRegularizer:wt(this.gammaRegularizer),betaConstraint:hn(this.betaConstraint),gammaConstraint:hn(this.gammaConstraint)},t=super.getConfig();return Object.assign(e,t),e}};qx.className="BatchNormalization";ue.registerClass(qx);var Kx=class extends rt{constructor(e){if(e==null&&(e={}),super(e),this.axis=e.axis==null?-1:e.axis,typeof this.axis=="number"){if(!Number.isInteger(this.axis))throw new Error(`Expected axis to be an integer, but received ${this.axis}`)}else if(Array.isArray(this.axis)){for(let t of this.axis)if(!Number.isInteger(t))throw new Error(`Expected axis to be an array of integers, but received ${JSON.stringify(this.axis)}`)}else throw new Error(`Expected axis to be an integer or an array of integers, but received ${JSON.stringify(this.axis)}`);this.epsilon=e.epsilon==null?.001:e.epsilon,this.center=e.center==null?!0:e.center,this.scale=e.scale==null?!0:e.scale,this.betaInitializer=Pt(e.betaInitializer||"zeros"),this.gammaInitializer=Pt(e.gammaInitializer||"ones"),this.betaRegularizer=Lt(e.betaRegularizer),this.gammaRegularizer=Lt(e.gammaRegularizer),this.supportsMasking=!0}build(e){e=At(e);let t=e.length;typeof this.axis=="number"&&(this.axis=[this.axis]);for(let r=0;r=t)throw new Error(`Invalid axis: ${r}`);if(this.axis.length!==Hs(this.axis).length)throw new Error(`Found duplicate axes in: ${this.axis}`);let n=this.axis.map(r=>e[r]),a=!0;this.scale?this.gamma=this.addWeight("gamma",n,"float32",this.gammaInitializer,this.gammaRegularizer,a):this.gamma=null,this.center?this.beta=this.addWeight("beta",n,"float32",this.betaInitializer,this.betaRegularizer,a):this.beta=null,this.built=!0}call(e,t){let n=Ke(e),a=n.shape,r=a.length;return Z(()=>{let s=!0,{mean:i,variance:o}=GA(n,this.axis,s),l=ao(1,r);for(let m of this.axis)l[m]=a[m];let u=m=>m!=null&&m.shape.length!==r&&this.axis!==[r-1]?m.reshape(l):m,d=u(this.gamma.read()),h=u(this.beta.read()),p=[],c=[];for(let m=0;m{if(e.rank!==4)throw new G(`temporalPadding expects input tensor to be 4-D, but received a ${e.rank}-D tensor.`);if(t==null&&(t=[[1,1],[1,1]]),t.length!==2||t[0].length!==2||t[1].length!==2)throw new G("spatial2dPadding expects `padding` to be an Array of two Arrays, each of which is an Array of two integers.");if(n==null&&(n=lr()),n!=="channelsLast"&&n!=="channelsFirst")throw new G(`Unknown data format: ${n}. Supported data formats are 'channelsLast' and 'channelsFirst.`);let a;return n==="channelsFirst"?a=[[0,0],[0,0],t[0],t[1]]:a=[[0,0],t[0],t[1],[0,0]],Bs(e,a)})}var Xx=class extends rt{constructor(e){if(e==null&&(e={}),super(e),this.dataFormat=e.dataFormat==null?lr():e.dataFormat,e.padding==null)this.padding=[[1,1],[1,1]];else if(typeof e.padding=="number")this.padding=[[e.padding,e.padding],[e.padding,e.padding]];else{if(e.padding=e.padding,e.padding.length!==2)throw new G(`ZeroPadding2D expects padding to be a length-2 array, but received a length-${e.padding.length} array.`);let t,n;if(typeof e.padding[0]=="number")t=[e.padding[0],e.padding[0]],n=[e.padding[1],e.padding[1]];else{if(e.padding=e.padding,e.padding[0].length!==2)throw new G(`ZeroPadding2D expects height padding to be a length-2 array, but received a length-${e.padding[0].length} array.`);if(t=e.padding[0],e.padding[1].length!==2)throw new G(`ZeroPadding2D expects width padding to be a length-2 array, but received a length-${e.padding[1].length} array.`);n=e.padding[1]}this.padding=[t,n]}this.inputSpec=[new tn({ndim:4})]}computeOutputShape(e){e=At(e);let t,n;return this.dataFormat==="channelsFirst"?(e[2]!=null&&e[2]>=0?t=e[2]+this.padding[0][0]+this.padding[0][1]:t=null,e[3]!=null&&e[3]>=0?n=e[3]+this.padding[1][0]+this.padding[1][1]:n=null,[e[0],e[1],t,n]):(e[1]!=null&&e[1]>=0?t=e[1]+this.padding[0][0]+this.padding[0][1]:t=null,e[2]!=null&&e[2]>=0?n=e[2]+this.padding[1][0]+this.padding[1][1]:n=null,[e[0],t,n,e[3]])}call(e,t){return Z(()=>Qte(Ke(e),this.padding,this.dataFormat))}getConfig(){let e={padding:this.padding,dataFormat:this.dataFormat},t=super.getConfig();return Object.assign(e,t),e}};Xx.className="ZeroPadding2D";ue.registerClass(Xx);function v0(e,t,n,a,r,s){return Z(()=>{Yt(r),lI(s),Oa(a),n==null&&(n=[1,1]),a==null&&(a="valid"),r==null&&(r=lr()),s==null&&(s="max"),e=mx(e,r);let i,o=a==="same"?"same":"valid";return s==="max"?i=Mf(e,t,n,o):i=Sf(e,t,n,o),r==="channelsFirst"&&(i=ct(i,[0,3,1,2])),i})}function IS(e,t,n,a,r,s){return Z(()=>{Yt(r),lI(s),Oa(a),n==null&&(n=[1,1,1]),a==null&&(a="valid"),r==null&&(r=lr()),s==null&&(s="max"),e=fS(e,r);let i,o=a==="same"?"same":"valid";return s==="max"?i=g8(e,t,n,o):i=Q4(e,t,n,o),r==="channelsFirst"&&(i=ct(i,[0,4,1,2,3])),i})}var SS=class extends rt{constructor(e){if(e.poolSize==null&&(e.poolSize=2),super(e),typeof e.poolSize=="number")this.poolSize=[e.poolSize];else if(Array.isArray(e.poolSize)&&e.poolSize.length===1&&typeof e.poolSize[0]=="number")this.poolSize=e.poolSize;else throw new G(`poolSize for 1D convolutional layer must be a number or an Array of a single number, but received ${JSON.stringify(e.poolSize)}`);if(An(this.poolSize,"poolSize"),e.strides==null)this.strides=this.poolSize;else if(typeof e.strides=="number")this.strides=[e.strides];else if(Array.isArray(e.strides)&&e.strides.length===1&&typeof e.strides[0]=="number")this.strides=e.strides;else throw new G(`strides for 1D convolutional layer must be a number or an Array of a single number, but received ${JSON.stringify(e.strides)}`);An(this.strides,"strides"),this.padding=e.padding==null?"valid":e.padding,Oa(this.padding),this.inputSpec=[new tn({ndim:3})]}computeOutputShape(e){e=At(e);let t=fr(e[1],this.poolSize[0],this.padding,this.strides[0]);return[e[0],t,e[2]]}call(e,t){return Z(()=>{this.invokeCallHook(e,t),e=Lh(Ke(e),2);let n=this.poolingFunction(Ke(e),[this.poolSize[0],1],[this.strides[0],1],this.padding,"channelsLast");return Jl(n,[2])})}getConfig(){let e={poolSize:this.poolSize,padding:this.padding,strides:this.strides},t=super.getConfig();return Object.assign(e,t),e}},Zx=class extends SS{constructor(e){super(e)}poolingFunction(e,t,n,a,r){return Yt(r),Oa(a),v0(e,t,n,a,r,"max")}};Zx.className="MaxPooling1D";ue.registerClass(Zx);var Yx=class extends SS{constructor(e){super(e)}poolingFunction(e,t,n,a,r){return Yt(r),Oa(a),v0(e,t,n,a,r,"avg")}};Yx.className="AveragePooling1D";ue.registerClass(Yx);var NS=class extends rt{constructor(e){if(e.poolSize==null&&(e.poolSize=[2,2]),super(e),this.poolSize=Array.isArray(e.poolSize)?e.poolSize:[e.poolSize,e.poolSize],e.strides==null)this.strides=this.poolSize;else if(Array.isArray(e.strides)){if(e.strides.length!==2)throw new G(`If the strides property of a 2D pooling layer is an Array, it is expected to have a length of 2, but received length ${e.strides.length}.`);this.strides=e.strides}else this.strides=[e.strides,e.strides];An(this.poolSize,"poolSize"),An(this.strides,"strides"),this.padding=e.padding==null?"valid":e.padding,this.dataFormat=e.dataFormat==null?"channelsLast":e.dataFormat,Yt(this.dataFormat),Oa(this.padding),this.inputSpec=[new tn({ndim:4})]}computeOutputShape(e){e=At(e);let t=this.dataFormat==="channelsFirst"?e[2]:e[1],n=this.dataFormat==="channelsFirst"?e[3]:e[2];return t=fr(t,this.poolSize[0],this.padding,this.strides[0]),n=fr(n,this.poolSize[1],this.padding,this.strides[1]),this.dataFormat==="channelsFirst"?[e[0],e[1],t,n]:[e[0],t,n,e[3]]}call(e,t){return Z(()=>(this.invokeCallHook(e,t),this.poolingFunction(Ke(e),this.poolSize,this.strides,this.padding,this.dataFormat)))}getConfig(){let e={poolSize:this.poolSize,padding:this.padding,strides:this.strides,dataFormat:this.dataFormat},t=super.getConfig();return Object.assign(e,t),e}},Jx=class extends NS{constructor(e){super(e)}poolingFunction(e,t,n,a,r){return Yt(r),Oa(a),v0(e,t,n,a,r,"max")}};Jx.className="MaxPooling2D";ue.registerClass(Jx);var Qx=class extends NS{constructor(e){super(e)}poolingFunction(e,t,n,a,r){return Yt(r),Oa(a),v0(e,t,n,a,r,"avg")}};Qx.className="AveragePooling2D";ue.registerClass(Qx);var TS=class extends rt{constructor(e){if(e.poolSize==null&&(e.poolSize=[2,2,2]),super(e),this.poolSize=Array.isArray(e.poolSize)?e.poolSize:[e.poolSize,e.poolSize,e.poolSize],e.strides==null)this.strides=this.poolSize;else if(Array.isArray(e.strides)){if(e.strides.length!==3)throw new G(`If the strides property of a 3D pooling layer is an Array, it is expected to have a length of 3, but received length ${e.strides.length}.`);this.strides=e.strides}else this.strides=[e.strides,e.strides,e.strides];An(this.poolSize,"poolSize"),An(this.strides,"strides"),this.padding=e.padding==null?"valid":e.padding,this.dataFormat=e.dataFormat==null?"channelsLast":e.dataFormat,Yt(this.dataFormat),Oa(this.padding),this.inputSpec=[new tn({ndim:5})]}computeOutputShape(e){e=At(e);let t=this.dataFormat==="channelsFirst"?e[2]:e[1],n=this.dataFormat==="channelsFirst"?e[3]:e[2],a=this.dataFormat==="channelsFirst"?e[4]:e[3];return t=fr(t,this.poolSize[0],this.padding,this.strides[0]),n=fr(n,this.poolSize[1],this.padding,this.strides[1]),a=fr(a,this.poolSize[2],this.padding,this.strides[2]),this.dataFormat==="channelsFirst"?[e[0],e[1],t,n,a]:[e[0],t,n,a,e[4]]}call(e,t){return Z(()=>(this.invokeCallHook(e,t),this.poolingFunction(Ke(e),this.poolSize,this.strides,this.padding,this.dataFormat)))}getConfig(){let e={poolSize:this.poolSize,padding:this.padding,strides:this.strides,dataFormat:this.dataFormat},t=super.getConfig();return Object.assign(e,t),e}},e5=class extends TS{constructor(e){super(e)}poolingFunction(e,t,n,a,r){return Yt(r),Oa(a),IS(e,t,n,a,r,"max")}};e5.className="MaxPooling3D";ue.registerClass(e5);var t5=class extends TS{constructor(e){super(e)}poolingFunction(e,t,n,a,r){return Yt(r),Oa(a),IS(e,t,n,a,r,"avg")}};t5.className="AveragePooling3D";ue.registerClass(t5);var ES=class extends rt{constructor(e){super(e);this.inputSpec=[new tn({ndim:3})]}computeOutputShape(e){return[e[0],e[2]]}call(e,t){throw new He}},n5=class extends ES{constructor(e){super(e||{})}call(e,t){return Z(()=>{let n=Ke(e);return Xt(n,1)})}};n5.className="GlobalAveragePooling1D";ue.registerClass(n5);var a5=class extends ES{constructor(e){super(e||{})}call(e,t){return Z(()=>{let n=Ke(e);return sr(n,1)})}};a5.className="GlobalMaxPooling1D";ue.registerClass(a5);var CS=class extends rt{constructor(e){super(e);this.dataFormat=e.dataFormat==null?"channelsLast":e.dataFormat,Yt(this.dataFormat),this.inputSpec=[new tn({ndim:4})]}computeOutputShape(e){return e=e,this.dataFormat==="channelsLast"?[e[0],e[3]]:[e[0],e[1]]}call(e,t){throw new He}getConfig(){let e={dataFormat:this.dataFormat},t=super.getConfig();return Object.assign(e,t),e}},r5=class extends CS{call(e,t){return Z(()=>{let n=Ke(e);return this.dataFormat==="channelsLast"?Xt(n,[1,2]):Xt(n,[2,3])})}};r5.className="GlobalAveragePooling2D";ue.registerClass(r5);var s5=class extends CS{call(e,t){return Z(()=>{let n=Ke(e);return this.dataFormat==="channelsLast"?sr(n,[1,2]):sr(n,[2,3])})}};s5.className="GlobalMaxPooling2D";ue.registerClass(s5);var MS=class extends rt{constructor(e){super(e);this.layer=e.layer}build(e){this.built=!0}get trainable(){return this.layer!=null?this.layer.trainable:!1}set trainable(e){this.layer!=null&&(this.layer.trainable=e)}get trainableWeights(){return this.layer.trainableWeights}get nonTrainableWeights(){return this.layer.nonTrainableWeights}get updates(){return this.layer._updates}get losses(){return this.layer.losses}getWeights(){return this.layer.getWeights()}setWeights(e){this.layer.setWeights(e)}getConfig(){let e={layer:{className:this.layer.getClassName(),config:this.layer.getConfig()}},t=super.getConfig();return Object.assign(e,t),e}setFastWeightInitDuringBuild(e){super.setFastWeightInitDuringBuild(e),this.layer!=null&&this.layer.setFastWeightInitDuringBuild(e)}static fromConfig(e,t,n={}){let a=t.layer,r=cr(a,n);delete t.layer;let s={layer:r};return Object.assign(s,t),new e(s)}},i5=class extends MS{constructor(e){super(e);this.supportsMasking=!0}build(e){if(e=At(e),e.length<3)throw new G(`TimeDistributed layer expects an input shape >= 3D, but received input shape ${JSON.stringify(e)}`);this.inputSpec=[{shape:e}];let t=[e[0]].concat(e.slice(2));this.layer.built||(this.layer.build(t),this.layer.built=!0),super.build(e)}computeOutputShape(e){e=At(e);let t=[e[0]].concat(e.slice(2)),n=this.layer.computeOutputShape(t),a=e[1];return[n[0],a].concat(n.slice(1))}call(e,t){return Z(()=>(e=Ke(e),vS((n,a)=>[Ke(this.layer.call(n,t)),[]],e,[],!1,null,null,!1,!0)[1]))}};i5.className="TimeDistributed";ue.registerClass(i5);function ene(e){so(oee,"BidirectionalMergeMode",e)}var tne="concat",o5=class extends MS{constructor(e){super(e);let t=e.layer.getConfig(),n={};n.className=e.layer.getClassName(),n.config=t,this.forwardLayer=cr(n),t.goBackwards=t.goBackwards!==!0;let a={};if(a.className=e.layer.getClassName(),a.config=t,this.backwardLayer=cr(a),this.forwardLayer.name="forward_"+this.forwardLayer.name,this.backwardLayer.name="backward_"+this.backwardLayer.name,this.mergeMode=e.mergeMode===void 0?tne:e.mergeMode,ene(this.mergeMode),e.weights)throw new He("weights support is not implemented for Bidirectional layer yet.");this._stateful=e.layer.stateful,this.returnSequences=e.layer.returnSequences,this.returnState=e.layer.returnState,this.supportsMasking=!0,this._trainable=!0,this.inputSpec=e.layer.inputSpec,this.numConstants=null}get trainable(){return this._trainable}set trainable(e){this._trainable=e,this.forwardLayer!=null&&(this.forwardLayer.trainable=e),this.backwardLayer!=null&&(this.backwardLayer.trainable=e)}getWeights(){return this.forwardLayer.getWeights().concat(this.backwardLayer.getWeights())}setWeights(e){let t=e.length,n=Math.floor(t/2);this.forwardLayer.setWeights(e.slice(0,n)),this.backwardLayer.setWeights(e.slice(n))}computeOutputShape(e){let t=this.forwardLayer.computeOutputShape(e);Array.isArray(t)&&Array.isArray(t[0])||(t=[t]),t=t;let n,a,r;return this.returnState&&(r=t.slice(1)),n=t[0],n=n,this.mergeMode==="concat"?(n[n.length-1]*=2,a=[n]):this.mergeMode==null?a=[n,n.slice()]:a=[n],this.returnState?this.mergeMode==null?a.concat(r).concat(r.slice()):[n].concat(r).concat(r.slice()):Qn(a)}apply(e,t){let n=t==null?null:t.initialState,a=t==null?null:t.constants;t==null&&(t={});let r=bS(e,n,a,this.numConstants);if(e=r.inputs,n=r.initialState,a=r.constants,Array.isArray(e)&&(n=e.slice(1),e=e[0]),(n==null||n.length===0)&&a==null)return super.apply(e,t);let s=[],i=[];if(n!=null){let l=n.length;if(l%2>0)throw new G("When passing `initialState` to a Bidrectional RNN, the state should be an Array containing the states of the underlying RNNs.");t.initialState=n,s.push(...n);let u=n.map(d=>new tn({shape:d.shape}));this.forwardLayer.stateSpec=u.slice(0,l/2),this.backwardLayer.stateSpec=u.slice(l/2),i.push(...u)}if(a!=null)throw new He("Support for constants in Bidirectional layers is not implemented yet.");let o=s[0]instanceof pr;for(let l of s)if(l instanceof pr!==o)throw new G("The initial state of a Bidirectional layer cannot be specified as a mix of symbolic and non-symbolic tensors");if(o){let l=[e].concat(s),u=this.inputSpec.concat(i),d=this.inputSpec;this.inputSpec=u;let h=super.apply(l,t);return this.inputSpec=d,h}else return super.apply(e,t)}call(e,t){return Z(()=>{let n=t.initialState,a,r;if(n==null)a=this.forwardLayer.call(e,t),r=this.backwardLayer.call(e,t);else{let o=n.slice(0,n.length/2),l=n.slice(n.length/2);a=this.forwardLayer.call(e,Object.assign(t,{initialState:o})),r=this.backwardLayer.call(e,Object.assign(t,{initialState:l}))}let s;this.returnState&&(Array.isArray(a)&&(s=a.slice(1).concat(r.slice(1))),a=a[0],r=r[0]),this.returnSequences&&(r=Ra(r,1));let i;return this.mergeMode==="concat"?i=R2([a,r]):this.mergeMode==="sum"?i=pe(a,r):this.mergeMode==="ave"?i=K(.5,pe(a,r)):this.mergeMode==="mul"?i=K(a,r):this.mergeMode==null&&(i=[a,r]),this.returnState?this.mergeMode==null?i.concat(s):[i].concat(s):i})}resetStates(e){this.forwardLayer.resetStates(),this.backwardLayer.resetStates()}build(e){io(this.forwardLayer.name,()=>{this.forwardLayer.build(e)}),io(this.backwardLayer.name,()=>{this.backwardLayer.build(e)}),this.built=!0}computeMask(e,t){Array.isArray(t)&&(t=t[0]);let n;if(this.returnSequences?this.mergeMode==null?n=[t,t]:n=t:this.mergeMode==null?n=[null,null]:n=null,this.returnState){let a=this.forwardLayer.states.map(r=>null);return Array.isArray(n)?n.concat(a).concat(a):[n].concat(a).concat(a)}else return n}get trainableWeights(){return this.forwardLayer.trainableWeights.concat(this.backwardLayer.trainableWeights)}get nonTrainableWeights(){return this.forwardLayer.nonTrainableWeights.concat(this.backwardLayer.nonTrainableWeights)}setFastWeightInitDuringBuild(e){super.setFastWeightInitDuringBuild(e),this.forwardLayer!=null&&this.forwardLayer.setFastWeightInitDuringBuild(e),this.backwardLayer!=null&&this.backwardLayer.setFastWeightInitDuringBuild(e)}getConfig(){let e={mergeMode:this.mergeMode},t=super.getConfig();return Object.assign(e,t),e}static fromConfig(e,t){let n=cr(t.layer);if(delete t.layer,t.numConstants!=null)throw new He("Deserialization of a Bidirectional layer with numConstants present is not supported yet.");let a=t;return a.layer=n,new e(a)}};o5.className="Bidirectional";ue.registerClass(o5);function nne(e){return new ru(e)}function ane(e){return new px(e)}function rne(e){return new ux(e)}function sne(e){return new dx(e)}function ine(e){return new hx(e)}function one(e){return new fx(e)}function lne(e){return new cx(e)}function une(e){return new bx(e)}function dne(e){return new f0(e)}function hne(e){return new yx(e)}function pne(e){return new m0(e)}function cne(e){return new Ax(e)}function fne(e){return new xx(e)}function mne(e){return new vx(e)}function gne(e){return new wx(e)}function yne(e){return new kx(e)}function Ane(e){return new $x(e)}function xne(e){return new Cx(e)}function bne(e){return new b0(e)}function vne(e){return new Ex(e)}function wne(e){return new Mx(e)}function kne(e){return new Rx(e)}function Ine(e){return new Fx(e)}function Sne(e){return new Ox(e)}function Nne(e){return new _x(e)}function Tne(e){return new zx(e)}function Ene(e){return new Lx(e)}function Cne(e){return new Vx(e)}function Mne(e){return new Wx(e)}function $ne(e){return new Bx(e)}function Rne(e){return new Px(e)}function Fne(e){return new Ux(e)}function One(e){return new qx(e)}function Dne(e){return new Kx(e)}function _ne(e){return new Xx(e)}function l5(e){return new Yx(e)}function zne(e){return l5(e)}function Pne(e){return l5(e)}function u5(e){return new Qx(e)}function Lne(e){return u5(e)}function Wne(e){return u5(e)}function d5(e){return new t5(e)}function Bne(e){return d5(e)}function Vne(e){return d5(e)}function Une(e){return new n5(e)}function jne(e){return new r5(e)}function $S(e){return new a5(e)}function RS(e){return new s5(e)}function FS(e){return new Zx(e)}function OS(e){return new Jx(e)}function Hne(e){return new e5(e)}function Gne(e){return new Sx(e)}function qne(e){return new y0(e)}function Kne(e){return new Nx(e)}function Xne(e){return new Xh(e)}function Zne(e){return new Ix(e)}function Yne(e){return new g0(e)}function Jne(e){return new Tx(e)}function Qne(e){return new x0(e)}function eae(e){return new cs(e)}function tae(e){return new A0(e)}function nae(e){return new o5(e)}function aae(e){return new i5(e)}var rae=$S,sae=RS,iae=FS,oae=OS;function lae(e){return new jx(e)}function uae(e){return new Hx(e)}function dae(e){return new Gx(e)}function hae(e){return new Dx(e)}var DS={};$e(DS,{MAPE:()=>wae,MSE:()=>Sae,binaryAccuracy:()=>pae,binaryCrossentropy:()=>cae,categoricalAccuracy:()=>mae,categoricalCrossentropy:()=>gae,cosineProximity:()=>xae,mape:()=>kae,meanAbsoluteError:()=>bae,meanAbsolutePercentageError:()=>vae,meanSquaredError:()=>Iae,mse:()=>Nae,precision:()=>yae,recall:()=>Aae,sparseCategoricalAccuracy:()=>fae});function pae(e,t){return K2(e,t)}function cae(e,t){return FI(e,t)}function fae(e,t){return OI(e,t)}function mae(e,t){return X2(e,t)}function gae(e,t){return Z2(e,t)}function yae(e,t){return RI(e,t)}function Aae(e,t){return nte(e,t)}function xae(e,t){return G2(e,t)}function bae(e,t){return i0(e,t)}function vae(e,t){return iu(e,t)}function wae(e,t){return iu(e,t)}function kae(e,t){return iu(e,t)}function Iae(e,t){return lo(e,t)}function Sae(e,t){return lo(e,t)}function Nae(e,t){return lo(e,t)}var _S={};$e(_S,{modelFromJSON:()=>_te});var zS={};$e(zS,{l1:()=>Eae,l1l2:()=>Tae,l2:()=>Cae});function Tae(e){return new Gh(e)}function Eae(e){return jte(e)}function Cae(e){return Hte(e)}var PS=class extends su{constructor(){super(...arguments);this.model=null}setModel(e){if(!(e instanceof ps))throw new Error("model must be a LayersModel, not some other Container");this.model=e}};function w0(e,t){return et}var WS=class extends PS{constructor(e){super();if(e==null&&(e={}),e.restoreBestWeights)throw new He("restoreBestWeights = True is not implemented in EarlyStopping yet.");this.monitor=e.monitor||"val_loss",this.minDelta=Math.abs(e.minDelta||0),this.patience=e.patience||0,this.verbose=e.verbose||0,this.mode=e.mode||"auto",this.baseline=e.baseline,["auto","min","max"].indexOf(this.mode)===-1&&(console.warn(`EarlyStopping mode '${this.mode}' is invalid. Falling back to mode 'auto'.`),this.mode="auto"),this.mode==="min"?this.monitorFunc=w0:this.mode==="max"?this.monitorFunc=LS:this.monitor.indexOf("acc")!==-1?this.monitorFunc=LS:this.monitorFunc=w0,this.monitorFunc===w0&&(this.minDelta*=-1)}async onTrainBegin(e){this.wait=0,this.stoppedEpoch=0,this.baseline!=null?this.best=this.baseline:this.best=this.monitorFunc===w0?Infinity:-Infinity}async onEpochEnd(e,t){await Ks(t);let n=this.getMonitorValue(t);n!=null&&(this.monitorFunc(n-this.minDelta,this.best)?(this.best=n,this.wait=0):(this.wait++,this.wait>=this.patience&&(this.stoppedEpoch=e,this.model.stopTraining=!0)))}async onTrainEnd(e){this.stoppedEpoch>0&&this.verbose&&console.log(`Epoch ${this.stoppedEpoch}: early stopping.`)}getMonitorValue(e){e==null&&(e={});let t=e[this.monitor];return t==null&&console.warn(`Metric for EarlyStopping ${this.monitor} is not available. Available metrics are: ${Object.keys(e)}`),t}};function Mae(e){return new WS(e)}var $ae={earlyStopping:Mae},mr;(function(e){e[e.DT_INVALID=0]="DT_INVALID",e[e.DT_FLOAT=1]="DT_FLOAT",e[e.DT_DOUBLE=2]="DT_DOUBLE",e[e.DT_INT32=3]="DT_INT32",e[e.DT_UINT8=4]="DT_UINT8",e[e.DT_INT16=5]="DT_INT16",e[e.DT_INT8=6]="DT_INT8",e[e.DT_STRING=7]="DT_STRING",e[e.DT_COMPLEX64=8]="DT_COMPLEX64",e[e.DT_INT64=9]="DT_INT64",e[e.DT_BOOL=10]="DT_BOOL",e[e.DT_QINT8=11]="DT_QINT8",e[e.DT_QUINT8=12]="DT_QUINT8",e[e.DT_QINT32=13]="DT_QINT32",e[e.DT_BFLOAT16=14]="DT_BFLOAT16",e[e.DT_FLOAT_REF=101]="DT_FLOAT_REF",e[e.DT_DOUBLE_REF=102]="DT_DOUBLE_REF",e[e.DT_INT32_REF=103]="DT_INT32_REF",e[e.DT_UINT8_REF=104]="DT_UINT8_REF",e[e.DT_INT16_REF=105]="DT_INT16_REF",e[e.DT_INT8_REF=106]="DT_INT8_REF",e[e.DT_STRING_REF=107]="DT_STRING_REF",e[e.DT_COMPLEX64_REF=108]="DT_COMPLEX64_REF",e[e.DT_INT64_REF=109]="DT_INT64_REF",e[e.DT_BOOL_REF=110]="DT_BOOL_REF",e[e.DT_QINT8_REF=111]="DT_QINT8_REF",e[e.DT_QUINT8_REF=112]="DT_QUINT8_REF",e[e.DT_QINT32_REF=113]="DT_QINT32_REF",e[e.DT_BFLOAT16_REF=114]="DT_BFLOAT16_REF"})(mr||(mr={}));var BS;(function(e){let t;(function(n){n[n.LEGACY=0]="LEGACY",n[n.V1=1]="V1",n[n.V2=2]="V2"})(t=e.CheckpointFormatVersion||(e.CheckpointFormatVersion={}))})(BS||(BS={}));var h5={};function Rae(e,t){let n={tfOpName:e,category:"custom",inputs:[],attrs:[],customExecutor:t};h5[e]=n}function VS(e){return h5[e]}function Fae(e){delete h5[e]}function N(e,t,n,a,r){let s=t.inputParams[e];if(s&&s.inputIndexStart!==void 0){let o=s.inputIndexStart,l=s.inputIndexEnd===0?void 0:s.inputIndexEnd===void 0?o+1:s.inputIndexEnd;if(s.type==="tensor")return Ln(t.inputNames[s.inputIndexStart],n,a,r);if(s.type==="tensors")return t.inputNames.slice(o,l).map(h=>Ln(h,n,a,r));let u=Ln(t.inputNames.slice(o)[0],n,a,r),d=u.dataSync();return s.type==="number"?d[0]:k.toNestedArray(u.shape,d)}let i=t.attrParams[e];return i&&i.value}function Ln(e,t,n,a){let[r,s]=ha(e);if(a!=null){let o=a.getHashTableHandleByName(r);if(o!=null)return o}let i=n.currentContextIds.find(o=>!!t[k0(r,o)]);return i!==void 0?t[k0(r,i)][s]:void 0}function Oae(e,t,n){return t[k0(e,n.currentContextId)]}function fs(e,t){let[n,a,r]=ha(e);return[k0(n,t&&t.currentContextId),a,r]}function k0(e,t){return t?`${e}-${t}`:e}function ha(e){let t=e.split(":");if(t.length===1)return[e,0,void 0];let n=t[0],a=t.length===3?t[1]:void 0,r=Number(t[t.length-1]);return[n,r,a]}function I0(e,t,n){let a=N("pad",e,t,n);if(a==="explicit"){a=N("explicitPaddings",e,t,n);let r=[[0,0],[0,0],[0,0],[0,0]];for(let s=0;s<4;s++)r[s][0]=a[s*2],r[s][1]=a[s*2+1];return r}return a}function ms(e){return e.kept?e:Gi(e)}var US={};$e(US,{json:()=>Dae});var Dae=[{tfOpName:"Add",category:"arithmetic",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"AddV2",category:"arithmetic",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"AddN",category:"arithmetic",inputs:[{start:0,end:0,name:"tensors",type:"tensors"}]},{tfOpName:"BiasAdd",category:"arithmetic",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0},{tfName:"data_format",name:"dataFormat",type:"string",notSupported:!0}]},{tfOpName:"Sub",category:"arithmetic",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"RealDiv",category:"arithmetic",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Div",category:"arithmetic",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"DivNoNan",category:"arithmetic",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"FloorDiv",category:"arithmetic",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Mul",category:"arithmetic",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Maximum",category:"arithmetic",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Minimum",category:"arithmetic",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Pow",category:"arithmetic",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"SquaredDifference",category:"arithmetic",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Mod",category:"arithmetic",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"FloorMod",category:"arithmetic",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]}],jS={};$e(jS,{json:()=>_ae});var _ae=[{tfOpName:"Abs",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Acos",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Asin",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Atan",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Atan2",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"y",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Ceil",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"ClipByValue",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"clipValueMin",type:"number"},{start:2,name:"clipValueMax",type:"number"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Complex",category:"basic_math",inputs:[{start:0,name:"real",type:"tensor"},{start:1,name:"imag",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"ComplexAbs",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Cos",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Cosh",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Elu",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Exp",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Floor",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Log",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Imag",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0},{tfName:"Tout",name:"outputType",type:"dtype",notSupported:!0}]},{tfOpName:"Neg",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Real",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0},{tfName:"Tout",name:"outputType",type:"dtype",notSupported:!0}]},{tfOpName:"Prelu",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"alpha",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Relu",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Relu6",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Selu",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Sigmoid",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Sin",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Sinh",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Sqrt",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Rsqrt",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Square",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Tan",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Tanh",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Sign",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Round",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Expm1",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Log1p",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Reciprocal",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Softplus",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Asinh",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Acosh",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Atanh",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Erf",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Prod",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"axes",type:"number[]"}],attrs:[{tfName:"keep_dims",name:"keepDims",type:"bool",notSupported:!0},{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"LeakyRelu",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"alpha",name:"alpha",type:"number",defaultValue:.2},{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"IsNan",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]}],HS={};$e(HS,{json:()=>zae});var zae=[{tfOpName:"EmptyTensorList",category:"control",inputs:[{start:0,name:"elementShape",type:"shape"},{start:1,name:"maxNumElements",type:"number"}],attrs:[{tfName:"element_dtype",name:"elementDType",type:"dtype"}]},{tfOpName:"LoopCond",category:"control",inputs:[{start:0,name:"pred",type:"tensor"}]},{tfOpName:"Switch",category:"control",inputs:[{start:0,name:"data",type:"tensor"},{start:1,name:"pred",type:"tensor"}]},{tfOpName:"Merge",category:"control",inputs:[{start:0,end:0,name:"tensors",type:"tensors"}]},{tfOpName:"Enter",category:"control",inputs:[{start:0,name:"tensor",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0},{tfName:"frame_name",name:"frameName",type:"string"},{tfName:"is_constant",name:"isConstant",type:"bool"}]},{tfOpName:"Exit",category:"control",inputs:[{start:0,name:"tensor",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"NextIteration",category:"control",inputs:[{start:0,name:"tensor",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"TensorArrayV3",category:"control",inputs:[{start:0,name:"size",type:"number"}],attrs:[{tfName:"dtype",name:"dtype",type:"dtype"},{tfName:"element_shape",name:"elementShape",type:"shape"},{tfName:"dynamic_size",name:"dynamicSize",type:"bool"},{tfName:"clear_after_read",name:"clearAfterRead",type:"bool"},{tfName:"identical_element_shapes",name:"identicalElementShapes",type:"bool"},{tfName:"tensor_array_name",name:"name",type:"string"}]},{tfOpName:"TensorArrayWriteV3",category:"control",inputs:[{start:0,name:"tensorArrayId",type:"tensor"},{start:1,name:"index",type:"number"},{start:2,name:"tensor",type:"tensor"},{start:3,name:"flowIn",type:"number"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"TensorArrayReadV3",category:"control",inputs:[{start:0,name:"tensorArrayId",type:"tensor"},{start:1,name:"index",type:"number"},{start:2,name:"flowIn",type:"number"}],attrs:[{tfName:"dtype",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"TensorArrayGatherV3",category:"control",inputs:[{start:0,name:"tensorArrayId",type:"tensor"},{start:1,name:"indices",type:"number[]"},{start:2,name:"flowIn",type:"number"}],attrs:[{tfName:"dtype",name:"dtype",type:"dtype"},{tfName:"element_shape",name:"elementShape",type:"shape"}]},{tfOpName:"TensorArrayScatterV3",category:"control",inputs:[{start:0,name:"tensorArrayId",type:"tensor"},{start:1,name:"indices",type:"number[]"},{start:2,name:"tensor",type:"tensor"},{start:3,name:"flowIn",type:"number"}],attrs:[{tfName:"T",name:"dtype",type:"dtype"}]},{tfOpName:"TensorArrayConcatV3",category:"control",inputs:[{start:0,name:"tensorArrayId",type:"tensor"},{start:1,name:"flowIn",type:"number"}],attrs:[{tfName:"dtype",name:"dtype",type:"dtype"},{tfName:"element_shape_except0",name:"elementShapeExcept0",type:"shape",notSupported:!0}]},{tfOpName:"TensorArraySplitV3",category:"control",inputs:[{start:0,name:"tensorArrayId",type:"tensor"},{start:1,name:"tensor",type:"tensor"},{start:2,name:"lengths",type:"number[]"},{start:3,name:"flowIn",type:"number"}],attrs:[{tfName:"T",name:"dtype",type:"dtype"}]},{tfOpName:"TensorArraySizeV3",category:"control",inputs:[{start:0,name:"tensorArrayId",type:"tensor"},{start:1,name:"flowIn",type:"number"}]},{tfOpName:"TensorArrayCloseV3",category:"control",inputs:[{start:0,name:"tensorArrayId",type:"tensor"}]},{tfOpName:"StatelessIf",category:"control",inputs:[{start:0,name:"cond",type:"tensor"},{start:1,end:0,name:"args",type:"tensors"}],attrs:[{tfName:"then_branch",name:"thenBranch",type:"func"},{tfName:"else_branch",name:"elseBranch",type:"func"}]},{tfOpName:"If",category:"control",inputs:[{start:0,name:"cond",type:"tensor"},{start:1,end:0,name:"args",type:"tensors"}],attrs:[{tfName:"then_branch",name:"thenBranch",type:"func"},{tfName:"else_branch",name:"elseBranch",type:"func"}]},{tfOpName:"StatelessWhile",category:"control",inputs:[{start:0,end:0,name:"args",type:"tensors"}],attrs:[{tfName:"cond",name:"cond",type:"func"},{tfName:"body",name:"body",type:"func"}]},{tfOpName:"While",category:"control",inputs:[{start:0,end:0,name:"args",type:"tensors"}],attrs:[{tfName:"cond",name:"cond",type:"func"},{tfName:"body",name:"body",type:"func"}]},{tfOpName:"TensorListScatter",category:"control",inputs:[{start:0,name:"tensor",type:"tensor"},{start:1,name:"indices",type:"number[]"},{start:2,name:"elementShape",type:"shape"}],attrs:[{tfName:"element_dtype",name:"elementDType",type:"dtype"}]},{tfOpName:"TensorListScatterV2",category:"control",inputs:[{start:0,name:"tensor",type:"tensor"},{start:1,name:"indices",type:"number[]"},{start:2,name:"elementShape",type:"shape"},{start:3,name:"numElements",type:"number"}],attrs:[{tfName:"element_dtype",name:"elementDType",type:"dtype"}]},{tfOpName:"TensorListGather",category:"control",inputs:[{start:0,name:"tensorListId",type:"tensor"},{start:1,name:"indices",type:"number[]"},{start:2,name:"elementShape",type:"shape"}],attrs:[{tfName:"element_dtype",name:"elementDType",type:"dtype"}]},{tfOpName:"TensorListGetItem",category:"control",inputs:[{start:0,name:"tensorListId",type:"tensor"},{start:1,name:"index",type:"number"},{start:2,name:"elementShape",type:"shape"}],attrs:[{tfName:"element_dtype",name:"elementDType",type:"dtype"}]},{tfOpName:"TensorListSetItem",category:"control",inputs:[{start:0,name:"tensorListId",type:"tensor"},{start:1,name:"index",type:"number"},{start:2,name:"tensor",type:"tensor"}],attrs:[{tfName:"element_dtype",name:"elementDType",type:"dtype"}]},{tfOpName:"TensorListReserve",category:"control",inputs:[{start:0,name:"elementShape",type:"shape"},{start:1,name:"numElements",type:"number"}],attrs:[{tfName:"element_dtype",name:"elementDType",type:"dtype"}]},{tfOpName:"TensorListFromTensor",category:"control",inputs:[{start:0,name:"tensor",type:"tensor"},{start:1,name:"elementShape",type:"shape"}],attrs:[{tfName:"element_dtype",name:"elementDType",type:"dtype"}]},{tfOpName:"TensorListStack",category:"control",inputs:[{start:0,name:"tensorListId",type:"tensor"},{start:1,name:"elementShape",type:"shape"}],attrs:[{tfName:"element_dtype",name:"elementDType",type:"dtype"},{tfName:"num_elements",name:"numElements",type:"dtype"}]},{tfOpName:"TensorListSplit",category:"control",inputs:[{start:0,name:"tensor",type:"tensor"},{start:1,name:"elementShape",type:"shape"},{start:2,name:"lengths",type:"number[]"}],attrs:[{tfName:"element_dtype",name:"elementDType",type:"dtype"}]},{tfOpName:"TensorListConcat",category:"control",inputs:[{start:0,name:"tensorListId",type:"tensor"}],attrs:[{tfName:"element_shape",name:"elementShape",type:"shape"},{tfName:"element_dtype",name:"elementDType",type:"dtype"}]},{tfOpName:"TensorListPopBack",category:"control",inputs:[{start:0,name:"tensorListId",type:"tensor"},{start:1,name:"elementShape",type:"shape"}],attrs:[{tfName:"element_dtype",name:"elementDType",type:"dtype"}]},{tfOpName:"TensorListPushBack",category:"control",inputs:[{start:0,name:"tensorListId",type:"tensor"},{start:1,name:"tensor",type:"tensor"}],attrs:[{tfName:"element_dtype",name:"elementDType",type:"dtype"}]}],GS={};$e(GS,{json:()=>Pae});var Pae=[{tfOpName:"AvgPool",category:"convolution",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"strides",name:"strides",type:"number[]"},{tfName:"padding",name:"pad",type:"string"},{tfName:"data_format",name:"dataFormat",type:"string",notSupported:!0},{tfName:"ksize",name:"kernelSize",type:"number[]"},{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"MaxPool",category:"convolution",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"strides",name:"strides",type:"number[]"},{tfName:"padding",name:"pad",type:"string"},{tfName:"data_format",name:"dataFormat",type:"string",notSupported:!0},{tfName:"ksize",name:"kernelSize",type:"number[]"},{tfName:"explicit_paddings",name:"explicitPaddings",type:"number[]",defaultValue:[],notSupported:!0},{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"MaxPoolWithArgmax",category:"convolution",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"strides",name:"strides",type:"number[]"},{tfName:"padding",name:"pad",type:"string"},{tfName:"ksize",name:"kernelSize",type:"number[]"},{tfName:"include_batch_in_index",name:"includeBatchInIndex",type:"bool"},{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"AvgPool3D",category:"convolution",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"strides",name:"strides",type:"number[]"},{tfName:"padding",name:"pad",type:"string"},{tfName:"data_format",name:"dataFormat",type:"string",notSupported:!0},{tfName:"ksize",name:"kernelSize",type:"number[]"},{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"MaxPool3D",category:"convolution",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"strides",name:"strides",type:"number[]"},{tfName:"padding",name:"pad",type:"string"},{tfName:"data_format",name:"dataFormat",type:"string",notSupported:!0},{tfName:"ksize",name:"kernelSize",type:"number[]"},{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Conv1D",category:"convolution",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"filter",type:"tensor"}],attrs:[{tfName:"stride",name:"stride",type:"number"},{tfName:"padding",name:"pad",type:"string"},{tfName:"data_format",name:"dataFormat",type:"string",defaultValue:"NWC"},{tfName:"T",name:"dtype",type:"dtype",notSupported:!0},{tfName:"dilation",name:"dilation",type:"number",defaultValue:1}]},{tfOpName:"Conv2D",category:"convolution",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"filter",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0},{tfName:"strides",name:"strides",type:"number[]"},{tfName:"padding",name:"pad",type:"string"},{tfName:"useCudnnOnGpu",name:"useCudnnOnGpu",type:"bool"},{tfName:"data_format",name:"dataFormat",type:"string",defaultValue:"NHWC"},{tfName:"explicit_paddings",name:"explicitPaddings",type:"number[]",defaultValue:[]},{tfName:"dilations",name:"dilations",type:"number[]"}]},{tfOpName:"_FusedConv2D",category:"convolution",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"filter",type:"tensor"},{start:2,end:0,name:"args",type:"tensors"}],attrs:[{tfName:"num_args",name:"numArgs",type:"number"},{tfName:"T",name:"dtype",type:"dtype",notSupported:!0},{tfName:"strides",name:"strides",type:"number[]"},{tfName:"padding",name:"pad",type:"string"},{tfName:"explicit_paddings",name:"explicitPaddings",type:"number[]",defaultValue:[]},{tfName:"use_cudnn_on_gpu",name:"useCudnnOnGpu",type:"bool",defaultValue:!0},{tfName:"data_format",name:"dataFormat",type:"string",defaultValue:"NHWC"},{tfName:"dilations",name:"dilations",type:"number[]",defaultValue:[1,1,1,1]},{tfName:"fused_ops",name:"fusedOps",type:"string[]",defaultValue:[]},{tfName:"epsilon",name:"epsilon",type:"number",defaultValue:1e-4},{tfName:"leakyrelu_alpha",name:"leakyreluAlpha",type:"number"}]},{tfOpName:"Conv2DBackpropInput",category:"convolution",inputs:[{start:2,name:"x",type:"tensor"},{start:1,name:"filter",type:"tensor"},{start:0,name:"outputShape",type:"number[]"}],attrs:[{tfName:"strides",name:"strides",type:"number[]"},{tfName:"padding",name:"pad",type:"string"},{tfName:"data_format",name:"dataFormat",type:"string",notSupported:!0},{tfName:"explicit_paddings",name:"explicitPaddings",type:"number[]",defaultValue:[]},{tfName:"dilations",name:"dilations",type:"number[]",notSupported:!0}]},{tfOpName:"DepthwiseConv2d",category:"convolution",inputs:[{start:0,name:"input",type:"tensor"},{start:1,name:"filter",type:"tensor"}],attrs:[{tfName:"strides",name:"strides",type:"number[]"},{tfName:"padding",name:"pad",type:"string"},{tfName:"data_format",name:"dataFormat",type:"string",defaultValue:"NHWC"},{tfName:"explicit_paddings",name:"explicitPaddings",type:"number[]",defaultValue:[]},{tfName:"dilations",name:"dilations",type:"number[]"}]},{tfOpName:"DepthwiseConv2dNative",category:"convolution",inputs:[{start:0,name:"input",type:"tensor"},{start:1,name:"filter",type:"tensor"}],attrs:[{tfName:"strides",name:"strides",type:"number[]"},{tfName:"padding",name:"pad",type:"string"},{tfName:"data_format",name:"dataFormat",type:"string",defaultValue:"NHWC"},{tfName:"explicit_paddings",name:"explicitPaddings",type:"number[]",defaultValue:[]},{tfName:"dilations",name:"dilations",type:"number[]"}]},{tfOpName:"FusedDepthwiseConv2dNative",category:"convolution",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"filter",type:"tensor"},{start:2,end:0,name:"args",type:"tensors"}],attrs:[{tfName:"num_args",name:"numArgs",type:"number"},{tfName:"T",name:"dtype",type:"dtype",notSupported:!0},{tfName:"strides",name:"strides",type:"number[]"},{tfName:"padding",name:"pad",type:"string"},{tfName:"data_format",name:"dataFormat",type:"string",defaultValue:"NHWC"},{tfName:"dilations",name:"dilations",type:"number[]",defaultValue:[1,1,1,1]},{tfName:"fused_ops",name:"fusedOps",type:"string[]",defaultValue:[]},{tfName:"explicit_paddings",name:"explicitPaddings",type:"number[]",defaultValue:[]}]},{tfOpName:"Conv3D",category:"convolution",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"filter",type:"tensor"}],attrs:[{tfName:"strides",name:"strides",type:"number[]"},{tfName:"padding",name:"pad",type:"string"},{tfName:"data_format",name:"dataFormat",type:"string",defaultValue:"NHWC"},{tfName:"dilations",name:"dilations",type:"number[]"}]},{tfOpName:"Dilation2D",category:"convolution",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"filter",type:"tensor"}],attrs:[{tfName:"strides",name:"strides",type:"number[]"},{tfName:"rates",name:"dilations",type:"number[]"},{tfName:"padding",name:"pad",type:"string"}]}],qS={};$e(qS,{json:()=>Lae});var Lae=[{tfOpName:"Fill",category:"creation",inputs:[{start:0,name:"shape",type:"number[]"},{start:1,name:"value",type:"number"}],attrs:[{tfName:"T",name:"dtype",type:"dtype"}]},{tfOpName:"LinSpace",category:"creation",inputs:[{start:0,name:"start",type:"number"},{start:1,name:"stop",type:"number"},{start:2,name:"num",type:"number"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"OneHot",category:"creation",inputs:[{start:0,name:"indices",type:"tensor"},{start:1,name:"depth",type:"number"},{start:2,name:"onValue",type:"number",defaultValue:1},{start:3,name:"offValue",type:"number",defaultValue:0}],attrs:[{tfName:"axis",name:"axis",type:"number",notSupported:!0},{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Ones",category:"creation",inputs:[{start:0,name:"shape",type:"number[]"}],attrs:[{tfName:"T",name:"dtype",type:"dtype"}]},{tfOpName:"OnesLike",category:"creation",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"dtype",name:"dtype",type:"dtype"}]},{tfOpName:"RandomUniform",category:"creation",inputs:[{start:0,name:"shape",type:"number[]"}],attrs:[{tfName:"minval",name:"minval",type:"number",defaultValue:0},{tfName:"maxval",name:"maxval",type:"number",defaultValue:1},{tfName:"dtype",name:"dtype",type:"dtype"},{tfName:"seed",name:"seed",type:"number",defaultValue:0},{tfName:"seed2",name:"seed2",type:"number",defaultValue:0,notSupported:!0},{tfName:"T",name:"T",type:"number",notSupported:!0}]},{tfOpName:"Range",category:"creation",inputs:[{start:0,name:"start",type:"number"},{start:1,name:"stop",type:"number"},{start:2,name:"step",type:"number",defaultValue:0}],attrs:[{tfName:"Tidx",name:"dtype",type:"dtype"}]},{tfOpName:"TruncatedNormal",category:"creation",inputs:[{start:0,name:"shape",type:"number[]"}],attrs:[{tfName:"means",name:"mean",type:"number",defaultValue:0},{tfName:"stddev",name:"stdDev",type:"number",defaultValue:1},{tfName:"seed",name:"seed",type:"number"},{tfName:"seed2",name:"seed2",type:"number",defaultValue:0,notSupported:!0},{tfName:"dtype",name:"dtype",type:"dtype"},{tfName:"T",name:"T",type:"number",notSupported:!0}]},{tfOpName:"Zeros",category:"creation",inputs:[{start:0,name:"shape",type:"number[]"}],attrs:[{tfName:"T",name:"dtype",type:"dtype"}]},{tfOpName:"ZerosLike",category:"creation",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype"}]},{tfOpName:"Multinomial",category:"creation",inputs:[{start:0,name:"logits",type:"tensor"},{start:1,name:"numSamples",type:"number"}],attrs:[{tfName:"seed",name:"seed",type:"number"},{tfName:"seed2",name:"seed2",type:"number"},{tfName:"T",name:"dtype",type:"dtype"},{tfName:"output_dtype",name:"output_dtype",type:"dtype"}]}],KS={};$e(KS,{json:()=>Wae});var Wae=[{tfOpName:"NonMaxSuppressionV2",category:"dynamic",inputs:[{start:0,name:"boxes",type:"tensor"},{start:1,name:"scores",type:"tensor"},{start:2,name:"maxOutputSize",type:"number"},{start:3,name:"iouThreshold",type:"number"}]},{tfOpName:"NonMaxSuppressionV3",category:"dynamic",inputs:[{start:0,name:"boxes",type:"tensor"},{start:1,name:"scores",type:"tensor"},{start:2,name:"maxOutputSize",type:"number"},{start:3,name:"iouThreshold",type:"number"},{start:4,name:"scoreThreshold",type:"number"}]},{tfOpName:"NonMaxSuppressionV4",category:"dynamic",inputs:[{start:0,name:"boxes",type:"tensor"},{start:1,name:"scores",type:"tensor"},{start:2,name:"maxOutputSize",type:"number"},{start:3,name:"iouThreshold",type:"number"},{start:4,name:"scoreThreshold",type:"number"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0},{tfName:"T_threshold",name:"threshold",type:"dtype",notSupported:!0},{tfName:"pad_to_max_output_size",name:"padToMaxOutputSize",type:"bool"}]},{tfOpName:"NonMaxSuppressionV5",category:"dynamic",inputs:[{start:0,name:"boxes",type:"tensor"},{start:1,name:"scores",type:"tensor"},{start:2,name:"maxOutputSize",type:"number"},{start:3,name:"iouThreshold",type:"number"},{start:4,name:"scoreThreshold",type:"number"},{start:5,name:"softNmsSigma",type:"number"}]},{tfOpName:"Where",category:"dynamic",inputs:[{start:0,name:"condition",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"ListDiff",category:"dynamic",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"y",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]}],XS={};$e(XS,{json:()=>Bae});var Bae=[{tfOpName:"TopKV2",category:"evaluation",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"k",type:"number"}],attrs:[{tfName:"sorted",name:"sorted",type:"bool"}]},{tfOpName:"Unique",category:"evaluation",inputs:[{start:0,name:"x",type:"tensor"}]},{tfOpName:"UniqueV2",category:"evaluation",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"axis",type:"number"}]}],ZS={};$e(ZS,{json:()=>Vae});var Vae=[{tfOpName:"PlaceholderWithDefault",category:"graph",inputs:[{start:0,name:"default",type:"tensor"}],attrs:[{tfName:"shape",name:"shape",type:"shape"},{tfName:"dtype",name:"dtype",type:"dtype"}]},{tfOpName:"Placeholder",category:"graph",attrs:[{tfName:"shape",name:"shape",type:"shape"},{tfName:"dtype",name:"dtype",type:"dtype"}]},{tfOpName:"Const",category:"graph"},{tfOpName:"Identity",category:"graph",inputs:[{start:0,name:"x",type:"tensor"}]},{tfOpName:"IdentityN",category:"graph",inputs:[{start:0,end:0,name:"x",type:"tensors"}]},{tfOpName:"Snapshot",category:"graph",inputs:[{start:0,name:"x",type:"tensor"}]},{tfOpName:"Rank",category:"graph",inputs:[{start:0,name:"x",type:"tensor"}]},{tfOpName:"Size",category:"graph",inputs:[{start:0,name:"x",type:"tensor"}]},{tfOpName:"Shape",category:"graph",inputs:[{start:0,name:"x",type:"tensor"}]},{tfOpName:"ShapeN",category:"graph",inputs:[{start:0,end:0,name:"x",type:"tensors"}]},{tfOpName:"Print",category:"graph",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"data",type:"tensors"}],attrs:[{tfName:"message",name:"message",type:"string"},{tfName:"first_n",name:"firstN",type:"number",notSupported:!0},{tfName:"summarize",name:"summarize",type:"number",defaultValue:3}]},{tfOpName:"NoOp",category:"graph",inputs:[]},{tfOpName:"StopGradient",category:"graph",inputs:[{start:0,name:"x",type:"tensor"}]},{tfOpName:"FakeQuantWithMinMaxVars",category:"graph",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"min",name:"min",type:"number"},{tfName:"max",name:"max",type:"number"}]}],YS={};$e(YS,{json:()=>Uae});var Uae=[{tfOpName:"HashTable",category:"hash_table",inputs:[],attrs:[{tfName:"shared_name",name:"sharedName",type:"string"},{tfName:"use_node_name_sharing",name:"useNodeNameSharing",type:"bool"},{tfName:"key_dtype",name:"keyDType",type:"dtype"},{tfName:"value_dtype",name:"valueDType",type:"dtype"}]},{tfOpName:"HashTableV2",category:"hash_table",inputs:[],attrs:[{tfName:"shared_name",name:"sharedName",type:"string"},{tfName:"use_node_name_sharing",name:"useNodeNameSharing",type:"bool"},{tfName:"key_dtype",name:"keyDType",type:"dtype"},{tfName:"value_dtype",name:"valueDType",type:"dtype"}]},{tfOpName:"LookupTableImport",category:"hash_table",inputs:[{start:0,name:"tableHandle",type:"tensor"},{start:1,name:"keys",type:"tensor"},{start:2,name:"values",type:"tensor"}],attrs:[{tfName:"Tin",name:"tIn",type:"dtype",notSupported:!0},{tfName:"Tout",name:"tOut",type:"dtype",notSupported:!0}]},{tfOpName:"LookupTableImportV2",category:"hash_table",inputs:[{start:0,name:"tableHandle",type:"tensor"},{start:1,name:"keys",type:"tensor"},{start:2,name:"values",type:"tensor"}],attrs:[{tfName:"Tin",name:"tIn",type:"dtype",notSupported:!0},{tfName:"Tout",name:"tOut",type:"dtype",notSupported:!0}]},{tfOpName:"LookupTableFind",category:"hash_table",inputs:[{start:0,name:"tableHandle",type:"tensor"},{start:1,name:"keys",type:"tensor"},{start:2,name:"defaultValue",type:"tensor"}],attrs:[{tfName:"Tin",name:"tIn",type:"dtype",notSupported:!0},{tfName:"Tout",name:"tOut",type:"dtype",notSupported:!0}]},{tfOpName:"LookupTableFindV2",category:"hash_table",inputs:[{start:0,name:"tableHandle",type:"tensor"},{start:1,name:"keys",type:"tensor"},{start:2,name:"defaultValue",type:"tensor"}],attrs:[{tfName:"Tin",name:"tIn",type:"dtype",notSupported:!0},{tfName:"Tout",name:"tOut",type:"dtype",notSupported:!0}]},{tfOpName:"LookupTableSize",category:"hash_table",inputs:[{start:0,name:"tableHandle",type:"tensor"}]},{tfOpName:"LookupTableSizeV2",category:"hash_table",inputs:[{start:0,name:"tableHandle",type:"tensor"}]}],JS={};$e(JS,{json:()=>jae});var jae=[{tfOpName:"ResizeBilinear",category:"image",inputs:[{start:0,name:"images",type:"tensor"},{start:1,name:"size",type:"number[]"}],attrs:[{tfName:"align_corners",name:"alignCorners",type:"bool"},{tfName:"half_pixel_centers",name:"halfPixelCenters",type:"bool"},{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"ResizeNearestNeighbor",category:"image",inputs:[{start:0,name:"images",type:"tensor"},{start:1,name:"size",type:"number[]"}],attrs:[{tfName:"align_corners",name:"alignCorners",type:"bool"},{tfName:"half_pixel_centers",name:"halfPixelCenters",type:"bool"},{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"CropAndResize",category:"image",inputs:[{start:0,name:"image",type:"tensor"},{start:1,name:"boxes",type:"tensor"},{start:2,name:"boxInd",type:"tensor"},{start:3,name:"cropSize",type:"number[]"}],attrs:[{tfName:"method",name:"method",type:"string"},{tfName:"extrapolation_value",name:"extrapolationValue",type:"number"}]}],QS={};$e(QS,{json:()=>Hae});var Hae=[{tfOpName:"Equal",category:"logical",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"NotEqual",category:"logical",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Greater",category:"logical",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"GreaterEqual",category:"logical",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Less",category:"logical",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"LessEqual",category:"logical",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"LogicalAnd",category:"logical",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"LogicalNot",category:"logical",inputs:[{start:0,name:"a",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"LogicalOr",category:"logical",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Select",category:"logical",inputs:[{start:0,name:"condition",type:"tensor"},{start:1,name:"a",type:"tensor"},{start:2,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"SelectV2",category:"logical",inputs:[{start:0,name:"condition",type:"tensor"},{start:1,name:"a",type:"tensor"},{start:2,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]}],e9={};$e(e9,{json:()=>Gae});var Gae=[{tfOpName:"_FusedMatMul",category:"matrices",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"},{start:2,end:0,name:"args",type:"tensors"}],attrs:[{tfName:"num_args",name:"numArgs",type:"number"},{tfName:"fused_ops",name:"fusedOps",type:"string[]",defaultValue:[]},{tfName:"epsilon",name:"epsilon",type:"number",defaultValue:1e-4},{tfName:"transpose_a",name:"transposeA",type:"bool",defaultValue:!1},{tfName:"transpose_b",name:"transposeB",type:"bool",defaultValue:!1},{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"MatMul",category:"matrices",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"transpose_a",name:"transposeA",type:"bool",defaultValue:!1},{tfName:"transpose_b",name:"transposeB",type:"bool",defaultValue:!1},{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"BatchMatMul",category:"matrices",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"adj_x",name:"transposeA",type:"bool",defaultValue:!1},{tfName:"adj_y",name:"transposeB",type:"bool",defaultValue:!1},{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"BatchMatMulV2",category:"matrices",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"adj_x",name:"transposeA",type:"bool",defaultValue:!1},{tfName:"adj_y",name:"transposeB",type:"bool",defaultValue:!1},{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Transpose",category:"matrices",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"perm",type:"number[]"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Einsum",category:"matrices",inputs:[{start:0,end:0,name:"tensors",type:"tensors"}],attrs:[{tfName:"equation",name:"equation",type:"string"},{tfName:"N",name:"n",type:"number",defaultValue:2},{tfName:"T",name:"dtype",type:"dtype"}]}],t9={};$e(t9,{json:()=>qae});var qae=[{tfOpName:"FusedBatchNorm",category:"normalization",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"scale",type:"tensor"},{start:2,name:"offset",type:"tensor"},{start:3,name:"mean",type:"tensor"},{start:4,name:"variance",type:"tensor"}],attrs:[{tfName:"epsilon",name:"epsilon",type:"number",defaultValue:.001},{tfName:"data_format",name:"dataFormat",type:"string",notSupported:!0}]},{tfOpName:"FusedBatchNormV2",category:"normalization",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"scale",type:"tensor"},{start:2,name:"offset",type:"tensor"},{start:3,name:"mean",type:"tensor"},{start:4,name:"variance",type:"tensor"}],attrs:[{tfName:"epsilon",name:"epsilon",type:"number",defaultValue:.001},{tfName:"data_format",name:"dataFormat",type:"string",notSupported:!0}]},{tfOpName:"FusedBatchNormV3",category:"normalization",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"scale",type:"tensor"},{start:2,name:"offset",type:"tensor"},{start:3,name:"mean",type:"tensor"},{start:4,name:"variance",type:"tensor"}],attrs:[{tfName:"epsilon",name:"epsilon",type:"number",defaultValue:.001},{tfName:"data_format",name:"dataFormat",type:"string",notSupported:!0}]},{tfOpName:"LRN",category:"normalization",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"depth_radius",name:"radius",type:"number",defaultValue:5},{tfName:"bias",name:"bias",type:"number",defaultValue:1},{tfName:"alpha",name:"alpha",type:"number",defaultValue:1},{tfName:"beta",name:"beta",type:"number",defaultValue:.5}]},{tfOpName:"Softmax",category:"normalization",inputs:[{start:0,name:"x",type:"tensor"}]},{tfOpName:"LogSoftmax",category:"normalization",inputs:[{start:0,name:"x",type:"tensor"}]},{tfOpName:"SparseToDense",category:"normalization",inputs:[{start:0,name:"sparseIndices",type:"tensor"},{start:1,name:"outputShape",type:"number[]"},{start:2,name:"sparseValues",type:"tensor"},{start:3,name:"defaultValue",type:"tensor"}],attrs:[{tfName:"validate_indices",name:"validateIndices",type:"bool",defaultValue:!0,notSupported:!0}]}],n9={};$e(n9,{json:()=>Kae});var Kae=[{tfOpName:"Bincount",category:"reduction",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"size",type:"number"},{start:2,name:"weights",type:"tensor"}]},{tfOpName:"DenseBincount",category:"reduction",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"size",type:"number"},{start:2,name:"weights",type:"tensor"}],attrs:[{tfName:"binary_output",name:"binaryOutput",type:"bool"}]},{tfOpName:"Max",category:"reduction",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"axis",type:"number[]"}],attrs:[{tfName:"keep_dims",name:"keepDims",type:"bool"}]},{tfOpName:"Mean",category:"reduction",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"axis",type:"number[]"}],attrs:[{tfName:"keep_dims",name:"keepDims",type:"bool"}]},{tfOpName:"Min",category:"reduction",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"axis",type:"number[]"}],attrs:[{tfName:"keep_dims",name:"keepDims",type:"bool"}]},{tfOpName:"Sum",category:"reduction",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"axis",type:"number[]"}],attrs:[{tfName:"keep_dims",name:"keepDims",type:"bool"}]},{tfOpName:"All",category:"reduction",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"axis",type:"number[]"}],attrs:[{tfName:"keep_dims",name:"keepDims",type:"bool"}]},{tfOpName:"Any",category:"reduction",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"axis",type:"number[]"}],attrs:[{tfName:"keep_dims",name:"keepDims",type:"bool"}]},{tfOpName:"ArgMax",category:"reduction",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"axis",type:"number"}]},{tfOpName:"ArgMin",category:"reduction",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"axis",type:"number"}]},{tfOpName:"Prod",category:"reduction",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"axis",type:"number[]"}],attrs:[{tfName:"keep_dims",name:"keepDims",type:"bool"}]},{tfOpName:"Cumsum",category:"reduction",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"axis",type:"number"}],attrs:[{tfName:"exclusive",name:"exclusive",type:"bool"},{tfName:"reverse",name:"reverse",type:"bool"}]}],a9={};$e(a9,{json:()=>Xae});var Xae=[{tfOpName:"ConcatV2",category:"slice_join",inputs:[{start:0,end:-1,name:"tensors",type:"tensors"},{start:-1,name:"axis",type:"number"}],attrs:[{tfName:"N",name:"n",type:"number",defaultValue:2}]},{tfOpName:"Concat",category:"slice_join",inputs:[{start:1,end:0,name:"tensors",type:"tensors"},{start:0,name:"axis",type:"number"}],attrs:[{tfName:"N",name:"n",type:"number",defaultValue:2}]},{tfOpName:"GatherV2",category:"slice_join",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"indices",type:"tensor"},{start:2,name:"axis",type:"number",defaultValue:0}],attrs:[{tfName:"batch_dims",name:"batchDims",type:"number",defaultValue:0}]},{tfOpName:"Gather",category:"slice_join",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"indices",type:"tensor"}],attrs:[{tfName:"validate_indices",name:"validateIndices",type:"bool",notSupported:!0}]},{tfOpName:"Reverse",category:"slice_join",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"dims",type:"bool[]"}]},{tfOpName:"ReverseV2",category:"slice_join",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"axis",type:"number[]"}]},{tfOpName:"Slice",category:"slice_join",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"begin",type:"number[]"},{start:2,name:"size",type:"number[]"}]},{tfOpName:"StridedSlice",category:"slice_join",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"begin",type:"number[]"},{start:2,name:"end",type:"number[]"},{start:3,name:"strides",type:"number[]"}],attrs:[{tfName:"begin_mask",name:"beginMask",type:"number",defaultValue:0},{tfName:"end_mask",name:"endMask",type:"number",defaultValue:0},{tfName:"new_axis_mask",name:"newAxisMask",type:"number",defaultValue:0},{tfName:"ellipsis_mask",name:"ellipsisMask",type:"number",defaultValue:0},{tfName:"shrink_axis_mask",name:"shrinkAxisMask",type:"number",defaultValue:0}]},{tfOpName:"Pack",category:"slice_join",inputs:[{start:0,end:0,name:"tensors",type:"tensors"}],attrs:[{tfName:"axis",name:"axis",type:"number",defaultValue:0}]},{tfOpName:"Unpack",category:"slice_join",inputs:[{start:0,name:"tensor",type:"tensor"}],attrs:[{tfName:"axis",name:"axis",type:"number",defaultValue:0},{tfName:"num",name:"num",type:"number",defaultValue:0,notSupported:!0}]},{tfOpName:"Tile",category:"slice_join",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"reps",type:"number[]"}]},{tfOpName:"Split",category:"slice_join",inputs:[{start:0,name:"axis",type:"number",defaultValue:0},{start:1,name:"x",type:"tensor"}],attrs:[{tfName:"num_split",name:"numOrSizeSplits",type:"number",defaultValue:1}]},{tfOpName:"SplitV",category:"slice_join",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"numOrSizeSplits",type:"number[]"},{start:2,name:"axis",type:"number",defaultValue:0}]},{tfOpName:"ScatterNd",category:"slice_join",inputs:[{start:0,name:"indices",type:"tensor"},{start:1,name:"values",type:"tensor"},{start:2,name:"shape",type:"number[]"}]},{tfOpName:"GatherNd",category:"slice_join",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"indices",type:"tensor"}]},{tfOpName:"SparseToDense",category:"slice_join",inputs:[{start:0,name:"sparseIndices",type:"tensor"},{start:1,name:"outputShape",type:"number[]"},{start:2,name:"sparseValues",type:"tensor"},{start:3,name:"defaultValue",type:"tensor"}],attrs:[{tfName:"validate_indices",name:"validateIndices",type:"bool",defaultValue:!1,notSupported:!0}]}],r9={};$e(r9,{json:()=>Zae});var Zae=[{tfOpName:"SparseFillEmptyRows",category:"sparse",inputs:[{start:0,name:"indices",type:"tensor"},{start:1,name:"values",type:"tensor"},{start:2,name:"denseShape",type:"tensor"},{start:3,name:"defaultValue",type:"tensor"}]},{tfOpName:"SparseReshape",category:"sparse",inputs:[{start:0,name:"inputIndices",type:"tensor"},{start:1,name:"inputShape",type:"tensor"},{start:2,name:"newShape",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"SparseSegmentMean",category:"sparse",inputs:[{start:0,name:"data",type:"tensor"},{start:1,name:"indices",type:"tensor"},{start:2,name:"segmentIds",type:"tensor"}]},{tfOpName:"SparseSegmentSum",category:"sparse",inputs:[{start:0,name:"data",type:"tensor"},{start:1,name:"indices",type:"tensor"},{start:2,name:"segmentIds",type:"tensor"}]}],s9={};$e(s9,{json:()=>Yae});var Yae=[{tfOpName:"FFT",category:"spectral",inputs:[{start:0,name:"x",type:"tensor"}]},{tfOpName:"IFFT",category:"spectral",inputs:[{start:0,name:"x",type:"tensor"}]},{tfOpName:"RFFT",category:"spectral",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"fft_length",type:"number",notSupported:!0}]},{tfOpName:"IRFFT",category:"spectral",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"fft_length",type:"number",notSupported:!0}]}],i9={};$e(i9,{json:()=>Jae});var Jae=[{tfOpName:"StringNGrams",category:"string",inputs:[{start:0,name:"data",type:"tensor"},{start:1,name:"dataSplits",type:"tensor"}],attrs:[{tfName:"separator",name:"separator",type:"string"},{tfName:"ngram_widths",name:"nGramWidths",type:"number[]"},{tfName:"left_pad",name:"leftPad",type:"string"},{tfName:"right_pad",name:"rightPad",type:"string"},{tfName:"pad_width",name:"padWidth",type:"number"},{tfName:"preserve_short_sequences",name:"preserveShortSequences",type:"bool"}],outputs:["ngrams","ngrams_splits"]},{tfOpName:"StringSplit",category:"string",inputs:[{start:0,name:"input",type:"tensor"},{start:1,name:"delimiter",type:"tensor"}],attrs:[{tfName:"skip_empty",name:"skipEmpty",type:"bool"}],outputs:["indices","values","shape"]},{tfOpName:"StringToHashBucketFast",category:"string",inputs:[{start:0,name:"input",type:"tensor"}],attrs:[{tfName:"num_buckets",name:"numBuckets",type:"number"}]}],o9={};$e(o9,{json:()=>Qae});var Qae=[{tfOpName:"Cast",category:"transformation",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"SrcT",name:"sdtype",type:"dtype",notSupported:!0},{tfName:"DstT",name:"dtype",type:"dtype"}]},{tfOpName:"ExpandDims",category:"transformation",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"axis",type:"number"}]},{tfOpName:"MirrorPad",category:"transformation",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"padding",type:"number[]"}],attrs:[{tfName:"mode",name:"mode",type:"string"}]},{tfOpName:"Pad",category:"transformation",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"padding",type:"number[]"}],attrs:[{tfName:"constant_value",name:"constantValue",type:"number",defaultValue:0}]},{tfOpName:"PadV2",category:"transformation",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"padding",type:"number[]"},{start:2,name:"constantValue",type:"number",defaultValue:0}]},{tfOpName:"Reshape",category:"transformation",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"shape",type:"number[]"}]},{tfOpName:"Squeeze",category:"transformation",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"axis",tfDeprecatedName:"squeeze_dims",name:"axis",type:"number[]"}]},{tfOpName:"SpaceToBatchND",category:"transformation",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"blockShape",type:"number[]"},{start:2,name:"paddings",type:"number[]"}]},{tfOpName:"BatchToSpaceND",category:"transformation",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"blockShape",type:"number[]"},{start:2,name:"crops",type:"number[]"}]},{tfOpName:"DepthToSpace",category:"transformation",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"block_size",name:"blockSize",type:"number"},{tfName:"data_format",name:"dataFormat",type:"string"}]},{tfOpName:"BroadcastTo",category:"transformation",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"shape",type:"number[]"}],attrs:[]}],l9=class{static get Instance(){return this._instance||(this._instance=new this)}constructor(){let e=[US,jS,HS,GS,qS,KS,XS,ZS,YS,JS,QS,e9,t9,n9,a9,r9,s9,i9,o9],t=[].concat(...e.map(n=>n.json));this.opMappers=t.reduce((n,a)=>(n[a.tfOpName]=a,n),{})}transformGraph(e,t={}){let n=e.node,a=[],r=[],s=[],i=n.reduce((m,f)=>(m[f.name]=this.mapNode(f),f.op.startsWith("Placeholder")?a.push(m[f.name]):f.op==="Const"?r.push(m[f.name]):(f.input==null||f.input.length===0)&&s.push(m[f.name]),m),{}),o=[],l=[],u={},d={};t!=null&&(u=this.mapSignatureEntries(t.inputs),d=this.mapSignatureEntries(t.outputs));let h=Object.keys(i);h.forEach(m=>{let f=i[m];f.inputNames.forEach((g,y)=>{let[A,,x]=fs(g),v=i[A];if(v.outputs!=null){let b=v.outputs.indexOf(x);if(b!==-1){let w=`${A}:${b}`;f.inputNames[y]=w}}f.inputs.push(v),v.children.push(f)})}),Object.keys(d).length===0?h.forEach(m=>{let f=i[m];f.children.length===0&&l.push(f)}):Object.keys(d).forEach(m=>{let[f]=fs(m),g=i[f];g!=null&&(g.signatureKey=d[m],l.push(g))}),Object.keys(u).length>0?Object.keys(u).forEach(m=>{let[f]=fs(m),g=i[f];g&&(g.signatureKey=u[m],o.push(g))}):o=a;let p={};e.library!=null&&e.library.function!=null&&(p=e.library.function.reduce((m,f)=>(m[f.signature.name]=this.mapFunction(f),m),{}));let c={nodes:i,inputs:o,outputs:l,weights:r,placeholders:a,signature:t,functions:p};return s.length>0&&(c.initNodes=s),c}mapSignatureEntries(e){return Object.keys(e||{}).reduce((t,n)=>(t[e[n].name]=n,t),{})}mapNode(e){let t=VS(e.op)||this.opMappers[e.op]||{};e.attr==null&&(e.attr={});let n={name:e.name,op:e.op,category:t.category,inputNames:(e.input||[]).map(a=>a.startsWith("^")?a.substr(1):a),inputs:[],children:[],inputParams:{},attrParams:{},rawAttrs:e.attr,outputs:t.outputs};return t.inputs!=null&&(n.inputParams=t.inputs.reduce((a,r)=>(a[r.name]={type:r.type,inputIndexStart:r.start,inputIndexEnd:r.end},a),{})),t.attrs!=null&&(n.attrParams=t.attrs.reduce((a,r)=>{let s=r.type,i;switch(r.type){case"string":i=p5(e.attr,r.tfName,r.defaultValue),i===void 0&&!!r.tfDeprecatedName&&(i=p5(e.attr,r.tfDeprecatedName,r.defaultValue));break;case"string[]":i=b5(e.attr,r.tfName,r.defaultValue),i===void 0&&!!r.tfDeprecatedName&&(i=b5(e.attr,r.tfDeprecatedName,r.defaultValue));break;case"number":i=f5(e.attr,r.tfName,r.defaultValue||0),i===void 0&&!!r.tfDeprecatedName&&(i=f5(e.attr,r.tfDeprecatedName,r.defaultValue));break;case"number[]":i=x5(e.attr,r.tfName,r.defaultValue),i===void 0&&!!r.tfDeprecatedName&&(i=x5(e.attr,r.tfDeprecatedName,r.defaultValue));break;case"bool":i=c5(e.attr,r.tfName,r.defaultValue),i===void 0&&!!r.tfDeprecatedName&&(i=c5(e.attr,r.tfDeprecatedName,r.defaultValue));break;case"bool[]":i=w5(e.attr,r.tfName,r.defaultValue),i===void 0&&!!r.tfDeprecatedName&&(i=w5(e.attr,r.tfDeprecatedName,r.defaultValue));break;case"shape":i=A5(e.attr,r.tfName,r.defaultValue),i===void 0&&!!r.tfDeprecatedName&&(i=A5(e.attr,r.tfDeprecatedName,r.defaultValue));break;case"shape[]":i=v5(e.attr,r.tfName,r.defaultValue),i===void 0&&!!r.tfDeprecatedName&&(i=v5(e.attr,r.tfDeprecatedName,r.defaultValue));break;case"dtype":i=g5(e.attr,r.tfName,r.defaultValue),i===void 0&&!!r.tfDeprecatedName&&(i=g5(e.attr,r.tfDeprecatedName,r.defaultValue));break;case"dtype[]":i=y5(e.attr,r.tfName,r.defaultValue),i===void 0&&!!r.tfDeprecatedName&&(i=y5(e.attr,r.tfDeprecatedName,r.defaultValue));break;case"func":i=d9(e.attr,r.tfName,r.defaultValue),i===void 0&&!!r.tfDeprecatedName&&(i=d9(e.attr,r.tfDeprecatedName,r.defaultValue));break;case"tensor":case"tensors":break;default:throw new Error(`Unsupported param type: ${r.type} for op: ${e.op}`)}return a[r.name]={value:i,type:s},a},{})),n}mapFunction(e){let t=e.nodeDef,n=[],a=[],r={};t!=null&&(r=t.reduce((u,d)=>(u[d.name]=this.mapNode(d),d.op==="Const"&&a.push(u[d.name]),u),{}));let s=[],i=[];e.signature.inputArg.forEach(u=>{let[d]=fs(u.name),h={name:d,op:"Placeholder",inputs:[],inputNames:[],category:"graph",inputParams:{},attrParams:{dtype:{value:m5(u.type),type:"dtype"}},children:[]};h.signatureKey=u.name,s.push(h),r[d]=h}),Object.keys(r).forEach(u=>{let d=r[u];d.inputNames.forEach((h,p)=>{let[c,,m]=fs(h),f=r[c];if(f.outputs!=null){let g=f.outputs.indexOf(m);if(g!==-1){let y=`${c}:${g}`;d.inputNames[p]=y}}d.inputs.push(f),f.children.push(d)})});let o=e.ret;e.signature.outputArg.forEach(u=>{let[d,h]=fs(o[u.name]),p=r[d];p!=null&&(p.defaultOutput=h,i.push(p))});let l=this.mapArgsToSignature(e);return{nodes:r,inputs:s,outputs:i,weights:a,placeholders:n,signature:l}}mapArgsToSignature(e){return{methodName:e.signature.name,inputs:e.signature.inputArg.reduce((t,n)=>(t[n.name]=this.mapArgToTensorInfo(n),t),{}),outputs:e.signature.outputArg.reduce((t,n)=>(t[n.name]=this.mapArgToTensorInfo(n,e.ret),t),{})}}mapArgToTensorInfo(e,t){let n=e.name;return t!=null&&(n=t[n]),{name:n,dtype:e.type}}};function ere(e){let t=se().global;if(typeof t.atob!="undefined")return t.atob(e);if(typeof Buffer!="undefined")return new Buffer(e,"base64").toString();throw new Error("Unable to decode base64 in this environment. Missing built-in atob() or Buffer()")}function u9(e,t){let n=Array.isArray(e)?String.fromCharCode.apply(null,e):ere(e);return t?n:n.toLowerCase()}function p5(e,t,n,a=!1){let r=e[t];return r!=null?u9(r.s,a):n}function c5(e,t,n){let a=e[t];return a?a.b:n}function f5(e,t,n){let a=e[t]||{},r=a.i!=null?a.i:a.f!=null?a.f:n;return typeof r=="number"?r:parseInt(r,10)}function m5(e){switch(typeof e=="string"&&(e=mr[e]),e){case mr.DT_FLOAT:return"float32";case mr.DT_INT32:case mr.DT_INT64:case mr.DT_INT8:case mr.DT_UINT8:return"int32";case mr.DT_BOOL:return"bool";case mr.DT_DOUBLE:return"float32";case mr.DT_STRING:return"string";default:return null}}function d9(e,t,n){let a=e[t];return a&&a.func?a.func.name:n}function g5(e,t,n){let a=e[t];return a&&a.type?m5(a.type):n}function y5(e,t,n){let a=e[t];return a&&a.list&&a.list.type?a.list.type.map(r=>m5(r)):n}function h9(e){if(!e.unknownRank)return e.dim!=null?e.dim.map(t=>typeof t.size=="number"?t.size:parseInt(t.size,10)):[]}function A5(e,t,n){let a=e[t];return a&&a.shape?h9(a.shape):n}function x5(e,t,n){let a=e[t];return a?((a.list.f&&a.list.f.length?a.list.f:a.list.i)||[]).map(r=>typeof r=="number"?r:parseInt(r,10)):n}function b5(e,t,n,a=!1){let r=e[t];return r&&r.list&&r.list.s?r.list.s.map(s=>u9(s,a)):n}function v5(e,t,n){let a=e[t];return a&&a.list&&a.list.shape?a.list.shape.map(r=>h9(r)):n}function w5(e,t,n){let a=e[t];return a&&a.list&&a.list.b?a.list.b:n}var tre=class{constructor(e,t,n){this.node=e,this.tensorMap=t,this.context=n,this.inputs=[],this.attrs={},this.inputs=e.inputNames.map(a=>this.getInput(a)),e.rawAttrs!=null&&(this.attrs=Object.keys(e.rawAttrs).reduce((a,r)=>(a[r]=this.getAttr(r),a),{}))}getInput(e){return Ln(e,this.tensorMap,this.context)}getAttr(e,t){let n=this.node.rawAttrs[e];if(n.tensor!=null)return Ln(e,this.tensorMap,this.context);if(n.i!=null||n.f!=null)return f5(this.node.rawAttrs,e,t);if(n.s!=null)return p5(this.node.rawAttrs,e,t);if(n.b!=null)return c5(this.node.rawAttrs,e,t);if(n.shape!=null)return A5(this.node.rawAttrs,e,t);if(n.type!=null)return g5(this.node.rawAttrs,e,t);if(n.list!=null){if(n.list.i!=null||n.list.f!=null)return x5(this.node.rawAttrs,e,t);if(n.list.s!=null)return b5(this.node.rawAttrs,e,t);if(n.list.shape!=null)return v5(this.node.rawAttrs,e,t);if(n.list.b!=null)return w5(this.node.rawAttrs,e,t);if(n.list.type!=null)return y5(this.node.rawAttrs,e,t)}return t}},nre=(e,t,n)=>{switch(e.op){case"BiasAdd":case"AddV2":case"Add":return[pe(N("a",e,t,n),N("b",e,t,n))];case"AddN":return[YH(N("tensors",e,t,n))];case"FloorMod":case"Mod":return[A8(N("a",e,t,n),N("b",e,t,n))];case"Mul":return[K(N("a",e,t,n),N("b",e,t,n))];case"RealDiv":case"Div":return[Me(N("a",e,t,n),N("b",e,t,n))];case"DivNoNan":return[i8(N("a",e,t,n),N("b",e,t,n))];case"FloorDiv":return[MA(N("a",e,t,n),N("b",e,t,n))];case"Sub":return[Ne(N("a",e,t,n),N("b",e,t,n))];case"Minimum":return[$h(N("a",e,t,n),N("b",e,t,n))];case"Maximum":return[is(N("a",e,t,n),N("b",e,t,n))];case"Pow":return[Vs(N("a",e,t,n),N("b",e,t,n))];case"SquaredDifference":return[i2(N("a",e,t,n),N("b",e,t,n))];default:throw TypeError(`Node type ${e.op} is not implemented`)}},are=(e,t,n)=>{switch(e.op){case"Abs":case"ComplexAbs":return[yn(N("x",e,t,n))];case"Acos":return[V4(N("x",e,t,n))];case"Acosh":return[U4(N("x",e,t,n))];case"Asin":return[H4(N("x",e,t,n))];case"Asinh":return[G4(N("x",e,t,n))];case"Atan":return[q4(N("x",e,t,n))];case"Atan2":return[K4(N("x",e,t,n),N("y",e,t,n))];case"Atanh":return[X4(N("x",e,t,n))];case"Ceil":return[t8(N("x",e,t,n))];case"Complex":return[Vi(N("real",e,t,n),N("imag",e,t,n))];case"Cos":return[Tf(N("x",e,t,n))];case"Cosh":return[zA(N("x",e,t,n))];case"Elu":return[Th(N("x",e,t,n))];case"Erf":return[o8(N("x",e,t,n))];case"Exp":return[qa(N("x",e,t,n))];case"Expm1":return[l8(N("x",e,t,n))];case"Floor":return[Ch(N("x",e,t,n))];case"Log":return[Ma(N("x",e,t,n))];case"Log1p":return[BA(N("x",e,t,n))];case"Imag":return[LA(N("x",e,t,n))];case"Neg":return[Kt(N("x",e,t,n))];case"Reciprocal":return[x8(N("x",e,t,n))];case"Real":return[Of(N("x",e,t,n))];case"Relu":return[ls(N("x",e,t,n))];case"Round":return[YA(N("x",e,t,n))];case"Selu":return[QA(N("x",e,t,n))];case"Sigmoid":return[$r(N("x",e,t,n))];case"Sin":return[e2(N("x",e,t,n))];case"Sign":return[v8(N("x",e,t,n))];case"Sinh":return[t2(N("x",e,t,n))];case"Softplus":return[Zl(N("x",e,t,n))];case"Sqrt":return[Mn(N("x",e,t,n))];case"Square":return[vt(N("x",e,t,n))];case"Tanh":return[Kl(N("x",e,t,n))];case"Tan":return[S8(N("x",e,t,n))];case"ClipByValue":return[ua(N("x",e,t,n),N("clipValueMin",e,t,n),N("clipValueMax",e,t,n))];case"Relu6":return[ZA(N("x",e,t,n))];case"Rsqrt":return[JA(Ln(e.inputNames[0],t,n))];case"Prod":return[qA(N("x",e,t,n),N("axes",e,t,n))];case"LeakyRelu":return[Ef(N("x",e,t,n),N("alpha",e,t,n))];case"Prelu":return[Ff(N("x",e,t,n),N("alpha",e,t,n))];case"IsNan":return[d8(Ln(e.inputNames[0],t,n))];default:throw TypeError(`Node type ${e.op} is not implemented`)}};function Za(e,t,n=""){if(!(typeof e=="number"||typeof t=="number")){k.assert(e.length===t.length,()=>n+` Shapes ${e} and ${t} must match`);for(let a=0;an+` Shapes ${e} and ${t} must match`)}}}function p9(e){return!(typeof e=="number"||e.some(t=>t<0))}function Jh(e,t,n){let a=k5(e,n),r=!p9(a);if(r&&t.length===0)throw new Error(`Tried to calculate elements of an empty list with non-fully-defined elementShape: ${a}`);if(r&&t.forEach(s=>{a=k5(s.shape,a)}),!p9(a))throw new Error(`Non-fully-defined elementShape: ${a}`);return a}function k5(e,t){if(typeof e=="number")return t;if(typeof t=="number")return e;if(e.length!==t.length)throw new Error(`Incompatible ranks during merge: ${e} vs. ${t}`);let n=[];for(let a=0;a=0&&s>=0&&r!==s)throw new Error(`Incompatible shape during merge: ${e} vs. ${t}`);n[a]=r>=0?r:s}return n}var rre=class{constructor(e,t,n,a,r,s,i){this.name=e,this.dtype=t,this.maxSize=n,this.elementShape=a,this.identicalElementShapes=r,this.dynamicSize=s,this.clearAfterRead=i,this.tensors=[],this.closed_=!1,this.idTensor=Re(0),Sn(this.idTensor)}get id(){return this.idTensor.id}get closed(){return this.closed_}clearAndClose(e){this.tensors.forEach(t=>{(e==null||!e.has(t.tensor.id))&&t.tensor.dispose()}),this.tensors=[],this.closed_=!0,this.idTensor.dispose()}size(){return this.tensors.length}read(e){if(this.closed_)throw new Error(`TensorArray ${this.name} has already been closed.`);if(e<0||e>=this.size())throw new Error(`Tried to read from index ${e}, but array size is: ${this.size()}`);let t=this.tensors[e];if(t.cleared)throw new Error(`TensorArray ${this.name}: Could not read index ${e} twice because it was cleared after a previous read (perhaps try setting clear_after_read = false?).`);return this.clearAfterRead&&(t.cleared=!0),t.read=!0,t.tensor}readMany(e){return e.map(t=>this.read(t))}write(e,t){if(this.closed_)throw new Error(`TensorArray ${this.name} has already been closed.`);if(e<0||!this.dynamicSize&&e>=this.maxSize)throw new Error(`Tried to write to index ${e}, but array is not resizeable and size is: ${this.maxSize}`);let n=this.tensors[e]||{};if(t.dtype!==this.dtype)throw new Error(`TensorArray ${this.name}: Could not write to TensorArray index ${e}, - because the value dtype is ${t.dtype}, but TensorArray dtype is ${this.dtype}.`);if(this.size()===0&&(this.elementShape==null||this.elementShape.length===0)&&(this.elementShape=t.shape),Za(this.elementShape,t.shape,`TensorArray ${this.name}: Could not write to TensorArray index ${e}.`),n.read)throw new Error(`TensorArray ${this.name}: Could not write to TensorArray index ${e}, because it has already been read.`);if(n.written)throw new Error(`TensorArray ${this.name}: Could not write to TensorArray index ${e}, because it has already been written.`);n.tensor=t,Sn(t),n.written=!0,this.tensors[e]=n}writeMany(e,t){if(e.length!==t.length)throw new Error(`TensorArray ${this.name}: could not write multiple tensors,because the index size: ${e.length} is not the same as tensors size: ${t.length}.`);e.forEach((n,a)=>this.write(n,t[a]))}gather(e,t){if(!!t&&t!==this.dtype)throw new Error(`TensorArray dtype is ${this.dtype} but gather requested dtype ${t}`);if(e)e=e.slice(0,this.size());else{e=[];for(let a=0;a=this.maxSize)throw new Error(`Max index must be < array size (${n} vs. ${this.maxSize})`);this.writeMany(e,or(t,0))}split(e,t){if(t.dtype!==this.dtype)throw new Error(`TensorArray dtype is ${this.dtype} but tensor has dtype ${t.dtype}`);let n=0,a=e.map(o=>(n+=o,n));if(n!==t.shape[0])throw new Error(`Expected sum of lengths to be equal to +`)}function yH(e,t,n,r){let s=on(t),a=r[r.length-1],o=new Array(a).fill(0),i=t.length,l=n==="complex64"?Ad(e):e;if(i>1)for(let u=0;uQ4){let g=gd*o,y=Array.from(e.slice(0,g)),A=Array.from(e.slice((i-gd)*o,i*o));return n==="complex64"&&(y=Ad(y),A=Ad(A)),["["+y.map((x,b)=>yd(x,s[b],n)).join(", ")+", ..., "+A.map((x,b)=>yd(x,s[i-gd+b],n)).join(", ")+"]"]}let m=n==="complex64"?Ad(e):Array.from(e);return["["+m.map((g,y)=>yd(g,s[y],n)).join(", ")+"]"]}let u=t.slice(1),c=r.slice(1),d=r[0]*o,h=[];if(i>Q4){for(let m=0;m`Length of values '${r}' does not match the size inferred by the shape '${this.size}'.`)}if(t==="complex64")throw new Error("complex64 dtype TensorBuffers are not supported. Please create a TensorBuffer for the real and imaginary parts separately and call tf.complex(real, imag).");this.values=n||O4(t,this.size),this.strides=Ki(e)}set(e,...t){t.length===0&&(t=[0]),z(t.length===this.rank,()=>`The number of provided coordinates (${t.length}) must match the rank (${this.rank})`);let n=this.locToIndex(t);this.values[n]=e}get(...e){e.length===0&&(e=[0]);let t=0;for(let r of e){if(r<0||r>=this.shape[t]){let s=`Requested out of range element at ${e}. Buffer shape=${this.shape}`;throw new Error(s)}t++}let n=e[e.length-1];for(let r=0;rff(n))}catch(n){throw new Error("Failed to decode the string bytes into utf-8. To get the original bytes, call tensor.bytes().")}}return e}dataSync(){this.throwIfDisposed();let e=Cs().readSync(this.dataId);if(this.dtype==="string")try{return e.map(t=>ff(t))}catch(t){throw new Error("Failed to decode the string bytes into utf-8. To get the original bytes, call tensor.bytes().")}return e}async bytes(){this.throwIfDisposed();let e=await Cs().read(this.dataId);return this.dtype==="string"?e:new Uint8Array(e.buffer)}dispose(){this.isDisposed||(Cs().disposeTensor(this),this.isDisposedInternal=!0)}get isDisposed(){return this.isDisposedInternal}throwIfDisposed(){if(this.isDisposed)throw new Error("Tensor is disposed.")}print(e=!1){return Vl.print(this,e)}clone(){return this.throwIfDisposed(),Vl.clone(this)}toString(e=!1){let t=this.dataSync();return gH(t,this.shape,this.dtype,e)}cast(e){return this.throwIfDisposed(),Vl.cast(this,e)}variable(e=!0,t,n){return this.throwIfDisposed(),Cs().makeVariable(this,e,t,n)}};Object.defineProperty(Ct,Symbol.hasInstance,{value:e=>!!e&&e.data!=null&&e.dataSync!=null&&e.throwIfDisposed!=null});function re(){return by("Tensor",()=>Ct)}re();var gf=class extends Ct{constructor(e,t,n,r){super(e.shape,e.dtype,e.dataId,r);this.trainable=t,this.name=n}assign(e){if(e.dtype!==this.dtype)throw new Error(`dtype of the new value (${e.dtype}) and previous value (${this.dtype}) must match`);if(!Da(e.shape,this.shape))throw new Error(`shape of the new value (${e.shape}) and previous value (${this.shape}) must match`);Cs().disposeTensor(this),this.dataId=e.dataId,Cs().incRef(this,null)}dispose(){Cs().disposeVariable(this),this.isDisposedInternal=!0}};Object.defineProperty(gf,Symbol.hasInstance,{value:e=>e instanceof Ct&&e.assign!=null&&e.assign instanceof Function});var Es={};De(Es,{assertTypesMatch:()=>n6,getTensorsInContainer:()=>fA,isTensorInList:()=>kH,makeTypesMatch:()=>Ut});var t6;(function(e){e.R0="R0",e.R1="R1",e.R2="R2",e.R3="R3",e.R4="R4",e.R5="R5",e.R6="R6"})(t6||(t6={}));var uA;(function(e){e.float32="float32",e.int32="int32",e.bool="int32",e.complex64="complex64"})(uA||(uA={}));var cA;(function(e){e.float32="float32",e.int32="int32",e.bool="bool",e.complex64="complex64"})(cA||(cA={}));var dA;(function(e){e.float32="float32",e.int32="float32",e.bool="float32",e.complex64="complex64"})(dA||(dA={}));var hA;(function(e){e.float32="complex64",e.int32="complex64",e.bool="complex64",e.complex64="complex64"})(hA||(hA={}));var wH={float32:dA,int32:uA,bool:cA,complex64:hA};function qr(e,t){if(e==="string"||t==="string"){if(e==="string"&&t==="string")return"string";throw new Error(`Can not upcast ${e} with ${t}`)}return wH[e][t]}function pA(e){return qr(e,"int32")}function Ut(e,t){if(e.dtype===t.dtype)return[e,t];let n=qr(e.dtype,t.dtype);return[e.cast(n),t.cast(n)]}function n6(e,t){z(e.dtype===t.dtype,()=>`The dtypes of the first(${e.dtype}) and second(${t.dtype}) input must match`)}function kH(e,t){return t.some(n=>n.id===e.id)}function fA(e){let t=[],n=new Set;return r6(e,t,n),t}function r6(e,t,n){if(e==null)return;if(e instanceof Ct){t.push(e);return}if(!IH(e))return;let r=e;for(let s in r){let a=r[s];n.has(a)||(n.add(a),r6(a,t,n))}}function IH(e){return Array.isArray(e)||typeof e=="object"}function mA(e){return e.kernelName!=null}var s6=class{constructor(){this.registeredVariables={},this.nextTapeNodeId=0,this.numBytes=0,this.numTensors=0,this.numStringTensors=0,this.numDataBuffers=0,this.gradientDepth=0,this.kernelDepth=0,this.scopeStack=[],this.numDataMovesStack=[],this.nextScopeId=0,this.tensorInfo=new WeakMap,this.profiling=!1,this.activeProfile={newBytes:0,newTensors:0,peakBytes:0,kernels:[],result:null,get kernelNames(){return Array.from(new Set(this.kernels.map(e=>e.name)))}}}dispose(){for(let e in this.registeredVariables)this.registeredVariables[e].dispose()}},xd=class{constructor(e){this.ENV=e,this.registry={},this.registryFactory={},this.pendingBackendInitId=0,this.state=new s6}async ready(){if(this.pendingBackendInit!=null)return this.pendingBackendInit.then(()=>{});if(this.backendInstance!=null)return;let e=this.getSortedBackends();for(let t=0;t{t.setupFunc!=null&&t.setupFunc(this.backendInstance)})}disposeRegisteredKernels(e){q4(e).forEach(n=>{n.disposeFunc!=null&&n.disposeFunc(this.registry[e])})}initializeBackend(e){let t=this.registryFactory[e];if(t==null)throw new Error(`Cannot initialize backend ${e}, no registration found.`);try{let n=t.factory();if(n&&!(n instanceof Bp)&&typeof n.then=="function"){let r=++this.pendingBackendInitId,s=n.then(a=>r(rthis.registryFactory[t].priority-this.registryFactory[e].priority)}initializeBackendsAndReturnBest(){let e=this.getSortedBackends();for(let t=0;tthis.startScope(n),()=>this.endScope(r),()=>(r=t(),r instanceof Promise&&console.error("Cannot return a Promise inside of tidy."),r))}scopedRun(e,t,n){e();try{let r=n();return t(),r}catch(r){throw t(),r}}nextTensorId(){return xd.nextTensorId++}nextVariableId(){return xd.nextVariableId++}clone(e){let t=G.runKernel(hl,{x:e}),n={x:e},r=a=>({x:()=>{let o="float32",i={x:a},l={dtype:o};return G.runKernel(el,i,l)}}),s=[];return this.addTapeNode(this.state.activeScope.name,n,[t],r,s,{}),t}runKernel(e,t,n){if(!(aA(e,this.backendName)!=null))throw new Error(`Kernel '${e}' not registered for backend '${this.backendName}'`);return this.runKernelFunc({kernelName:e,inputs:t,attrs:n})}shouldCheckForMemLeaks(){return this.ENV.getBool("IS_TEST")}checkKernelForMemLeak(e,t,n){let r=this.backend.numDataIds(),s=0;n.forEach(i=>{s+=i.dtype==="complex64"?3:1});let a=this.state.numDataMovesStack[this.state.numDataMovesStack.length-1],o=r-t-s-a;if(o>0)throw new Error(`Backend '${this.backendName}' has an internal memory leak (${o} data ids) after running '${e}'`)}runKernelFunc(e){let t,n=[],r=this.isTapeOn(),s=this.state.numBytes,a=this.state.numTensors;this.shouldCheckForMemLeaks()&&this.state.numDataMovesStack.push(0);let o;this.backendName==null&&this.backend;let i,l=mA(e)?e.kernelName:this.state.activeScope!=null?this.state.activeScope.name:"";if(mA(e)){let{kernelName:p,inputs:f,attrs:m}=e;this.backendName==null&&this.backend;let g=aA(p,this.backendName);z(g!=null,()=>`Cannot find registered kernel '${p}' for backend '${this.backendName}'`),o=()=>{let y=this.backend.numDataIds();i=g.kernelFunc({inputs:f,attrs:m,backend:this.backend});let A=Array.isArray(i)?i:[i];this.shouldCheckForMemLeaks()&&this.checkKernelForMemLeak(p,y,A);let x=A.map(b=>{if(b.rank!=null)return b;let{dataId:v,shape:w,dtype:I}=b;return this.makeTensorFromDataId(v,w,I)});if(r){let b=this.getTensorsForGradient(p,f,x);n=this.saveTensorsForBackwardMode(b)}return x}}else{let{forwardFunc:p}=e,f=m=>{!r||(n=m.map(g=>this.keep(this.clone(g))))};o=()=>{let m=this.backend.numDataIds();i=this.tidy(()=>p(this.backend,f));let g=Array.isArray(i)?i:[i];return this.shouldCheckForMemLeaks()&&this.checkKernelForMemLeak(l,m,g),g}}let{inputs:u,attrs:c}=e,d=mA(e)?null:e.backwardsFunc,h;return this.scopedRun(()=>this.state.kernelDepth++,()=>this.state.kernelDepth--,()=>{!this.ENV.getBool("DEBUG")&&!this.state.profiling?t=o():(h=this.profiler.profileKernel(l,u,()=>o()),this.ENV.getBool("DEBUG")&&this.profiler.logKernelProfile(h),t=h.outputs)}),r&&this.addTapeNode(l,u,t,d,n,c),this.state.profiling&&this.state.activeProfile.kernels.push({name:l,bytesAdded:this.state.numBytes-s,totalBytesSnapshot:this.state.numBytes,tensorsAdded:this.state.numTensors-a,totalTensorsSnapshot:this.state.numTensors,inputShapes:Object.keys(u).map(p=>u[p]!=null?u[p].shape:null),outputShapes:t.map(p=>p.shape),kernelTimeMs:h.timeMs,extraInfo:h.extraInfo}),Array.isArray(i)?t:t[0]}saveTensorsForBackwardMode(e){return e.map(n=>this.keep(this.clone(n)))}getTensorsForGradient(e,t,n){let r=j4(e);if(r!=null){let s=r.inputsToSave||[],a=r.outputsToSave||[],o;r.saveAllInputs?(z(Array.isArray(t),()=>"saveAllInputs is true, expected inputs to be an array."),o=Object.keys(t).map(l=>t[l])):o=s.map(l=>t[l]);let i=n.filter((l,u)=>a[u]);return o.concat(i)}return[]}makeTensor(e,t,n,r){if(e==null)throw new Error("Values passed to engine.makeTensor() are null");n=n||"float32",r=r||this.backend;let s=e;n==="string"&&Vp(e[0])&&(s=e.map(i=>pf(i)));let a=r.write(s,t,n),o=new Ct(t,n,a,this.nextTensorId());if(this.trackTensor(o,r),n==="string"){let i=this.state.tensorInfo.get(a),l=L4(s);this.state.numBytes+=l-i.bytes,i.bytes=l}return o}makeTensorFromDataId(e,t,n,r){n=n||"float32";let s=new Ct(t,n,e,this.nextTensorId());return this.trackTensor(s,r),s}makeVariable(e,t=!0,n,r){n=n||this.nextVariableId().toString(),r!=null&&r!==e.dtype&&(e=e.cast(r));let s=new gf(e,t,n,this.nextTensorId());if(this.state.registeredVariables[s.name]!=null)throw new Error(`Variable with name ${s.name} was already registered`);return this.state.registeredVariables[s.name]=s,this.incRef(s,this.backend),s}trackTensor(e,t){this.state.numTensors++,e.dtype==="string"&&this.state.numStringTensors++;let n=0;e.dtype!=="complex64"&&e.dtype!=="string"&&(n=e.size*my(e.dtype)),this.state.numBytes+=n,this.state.tensorInfo.has(e.dataId)||(this.state.numDataBuffers++,this.state.tensorInfo.set(e.dataId,{backend:t||this.backend,dtype:e.dtype,shape:e.shape,bytes:n})),e instanceof gf||this.track(e)}incRef(e,t){this.trackTensor(e,t),this.backend.incRef(e.dataId)}removeDataId(e,t){this.state.tensorInfo.has(e)&&this.state.tensorInfo.get(e).backend===t&&(this.state.tensorInfo.delete(e),this.state.numDataBuffers--)}disposeTensor(e){if(!this.state.tensorInfo.has(e.dataId))return;let t=this.state.tensorInfo.get(e.dataId);if(this.state.numTensors--,e.dtype==="string"&&(this.state.numStringTensors--,this.state.numBytes-=t.bytes),e.dtype!=="complex64"&&e.dtype!=="string"){let n=e.size*my(e.dtype);this.state.numBytes-=n}t.backend.disposeData(e.dataId)&&this.removeDataId(e.dataId,t.backend)}disposeVariables(){for(let e in this.state.registeredVariables){let t=this.state.registeredVariables[e];this.disposeVariable(t)}}disposeVariable(e){this.disposeTensor(e),this.state.registeredVariables[e.name]!=null&&delete this.state.registeredVariables[e.name]}memory(){let e=this.backend.memory();return e.numTensors=this.state.numTensors,e.numDataBuffers=this.state.numDataBuffers,e.numBytes=this.state.numBytes,this.state.numStringTensors>0&&(e.unreliable=!0,e.reasons==null&&(e.reasons=[]),e.reasons.push("Memory usage by string tensors is approximate (2 bytes per character)")),e}async profile(e){this.state.profiling=!0;let t=this.state.numBytes,n=this.state.numTensors;this.state.activeProfile.kernels=[],this.state.activeProfile.result=await e(),this.state.profiling=!1,this.state.activeProfile.peakBytes=Math.max(...this.state.activeProfile.kernels.map(r=>r.totalBytesSnapshot)),this.state.activeProfile.newBytes=this.state.numBytes-t,this.state.activeProfile.newTensors=this.state.numTensors-n;for(let r of this.state.activeProfile.kernels)r.kernelTimeMs=await r.kernelTimeMs,r.extraInfo=await r.extraInfo;return this.state.activeProfile}isTapeOn(){return this.state.gradientDepth>0&&this.state.kernelDepth===0}addTapeNode(e,t,n,r,s,a){let o={id:this.state.nextTapeNodeId++,kernelName:e,inputs:t,outputs:n,saved:s},i=j4(e);i!=null&&(r=i.gradFunc),r!=null&&(o.gradient=l=>(l=l.map((u,c)=>{if(u==null){let d=n[c],h=jp(d.size,d.dtype);return this.makeTensor(h,d.shape,d.dtype)}return u}),r(l.length>1?l:l[0],s,a))),this.state.activeTape.push(o)}keep(e){return e.kept=!0,e}startTape(){this.state.gradientDepth===0&&(this.state.activeTape=[]),this.state.gradientDepth++}endTape(){this.state.gradientDepth--}startScope(e){let t={track:[],name:"unnamed scope",id:this.state.nextScopeId++};e&&(t.name=e),this.state.scopeStack.push(t),this.state.activeScope=t}endScope(e){let t=fA(e),n=new Set(t.map(s=>s.id));for(let s=0;s{!s.kept&&s.scopeId===r.id&&this.track(s)})}gradients(e,t,n,r=!1){if(z(t.length>0,()=>"gradients() received an empty list of xs."),n!=null&&n.dtype!=="float32")throw new Error(`dy must have 'float32' dtype, but has '${n.dtype}'`);let s=this.scopedRun(()=>this.startTape(),()=>this.endTape(),()=>this.tidy("forward",e));z(s instanceof Ct,()=>"The result y returned by f() must be a tensor.");let a=fH(this.state.activeTape,t,s);if(!r&&a.length===0&&t.length>0)throw new Error("Cannot compute gradient of y=f(x) with respect to x. Make sure that the f you passed encloses all operations that lead from x to y.");return this.tidy("backward",()=>{let o={};o[s.id]=n==null?SH(s.shape):n,mH(o,a,l=>this.tidy(l),TH);let i=t.map(l=>o[l.id]);return this.state.gradientDepth===0&&(this.state.activeTape.forEach(l=>{for(let u of l.saved)u.dispose()}),this.state.activeTape=null),{value:s,grads:i}})}customGrad(e){return z(Hp(e),()=>"The f passed in customGrad(f) must be a function."),(...t)=>{z(t.every(o=>o instanceof Ct),()=>"The args passed in customGrad(f)(x1, x2,...) must all be tensors");let n,r={};t.forEach((o,i)=>{r[i]=o});let s=(o,i)=>(n=e(...t,i),z(n.value instanceof Ct,()=>"The function f passed in customGrad(f) must return an object where `obj.value` is a tensor"),z(Hp(n.gradFunc),()=>"The function f passed in customGrad(f) must return an object where `obj.gradFunc` is a function."),n.value),a=(o,i)=>{let l=n.gradFunc(o,i),u=Array.isArray(l)?l:[l];z(u.length===t.length,()=>"The function f passed in customGrad(f) must return an object where `obj.gradFunc` is a function that returns the same number of tensors as inputs passed to f(...)."),z(u.every(d=>d instanceof Ct),()=>"The function f passed in customGrad(f) must return an object where `obj.gradFunc` is a function that returns a list of only tensors.");let c={};return u.forEach((d,h)=>{c[h]=()=>d}),c};return this.runKernelFunc({forwardFunc:s,backwardsFunc:a,inputs:r})}}readSync(e){return this.state.tensorInfo.get(e).backend.readSync(e)}read(e){return this.state.tensorInfo.get(e).backend.read(e)}async time(e){let t=md(),n=await this.backend.time(e);return n.wallMs=md()-t,n}track(e){return this.state.activeScope!=null&&(e.scopeId=this.state.activeScope.id,this.state.activeScope.track.push(e)),e}get registeredVariables(){return this.state.registeredVariables}reset(){this.pendingBackendInitId++,this.state.dispose(),this.ENV.reset(),this.state=new s6;for(let e in this.registry)this.disposeRegisteredKernels(e),this.registry[e].dispose(),delete this.registry[e];this.backendName=null,this.backendInstance=null,this.pendingBackendInit=null}};xd.nextTensorId=0;xd.nextVariableId=0;function SH(e){let t=gy(on(e),"float32");return G.makeTensor(t,e,"float32")}function a6(){let e=G4();if(e._tfengine==null){let t=new KU(e);e._tfengine=new xd(t)}return JU(e._tfengine.ENV),xH(()=>e._tfengine),e._tfengine}var G=a6();function TH(e,t){let n={a:e,b:t};return G.runKernel(Fa,n)}var yf={};De(yf,{isBrowser:()=>o6,isMobile:()=>CH});function NH(){return typeof navigator!="undefined"&&navigator!=null}function CH(e){if(e||NH()){if(e||(e=navigator),e.product==="ReactNative")return!0;let t=e.userAgent||e.vendor||window.opera;return/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(t)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(t.substr(0,4))}return!1}function o6(){return typeof window!="undefined"&&window.document!=null||typeof WorkerGlobalScope!="undefined"}var as=ae();as.registerFlag("DEBUG",()=>!1,e=>{e&&console.warn("Debugging mode is ON. The output of every math call will be downloaded to CPU and checked for NaNs. This significantly impacts performance.")});as.registerFlag("IS_BROWSER",()=>o6());as.registerFlag("IS_NODE",()=>typeof process!="undefined"&&typeof process.versions!="undefined"&&typeof process.versions.node!="undefined");as.registerFlag("IS_CHROME",()=>typeof navigator!="undefined"&&navigator!=null&&navigator.userAgent!=null&&/Chrome/.test(navigator.userAgent)&&/Google Inc/.test(navigator.vendor));as.registerFlag("PROD",()=>!1);as.registerFlag("TENSORLIKE_CHECK_SHAPE_CONSISTENCY",()=>as.getBool("DEBUG"));as.registerFlag("DEPRECATION_WARNINGS_ENABLED",()=>!0);as.registerFlag("IS_TEST",()=>!1);as.registerFlag("CHECK_COMPUTATION_FOR_ERRORS",()=>!0);as.registerFlag("WRAP_TO_IMAGEBITMAP",()=>!1);function bd(e,t){let n=e;if(ss(e))return t==="string"?[]:[e.length];if(!Array.isArray(e))return[];let r=[];for(;Array.isArray(n)||ss(n)&&t!=="string";)r.push(n.length),n=n[0];return Array.isArray(e)&&ae().getBool("TENSORLIKE_CHECK_SHAPE_CONSISTENCY")&&i6(e,r,[]),r}function i6(e,t,n){if(n=n||[],!Array.isArray(e)&&!ss(e)){z(t.length===0,()=>`Element arr[${n.join("][")}] is a primitive, but should be an array/TypedArray of ${t[0]} elements`);return}z(t.length>0,()=>`Element arr[${n.join("][")}] should be a primitive, but is an array of ${e.length} elements`),z(e.length===t[0],()=>`Element arr[${n.join("][")}] should have ${t[0]} elements, but has ${e.length} elements`);let r=t.slice(1);for(let s=0;s=0&&(s=r),l6(r,s,t,n),e==null||!ss(e)&&!Array.isArray(e)&&typeof e!="number"&&typeof e!="boolean"&&typeof e!="string"){let l=e==null?"null":e.constructor.name;throw new Error(`Argument '${t}' passed to '${n}' must be a Tensor or TensorLike, but got '${l}'`)}let a=bd(e,s);!ss(e)&&!Array.isArray(e)&&(e=[e]);let i=s!=="string"?hf(e,s):yc(e,[],!0);return G.makeTensor(i,a,s)}function Af(e,t,n,r="numeric"){if(!Array.isArray(e))throw new Error(`Argument ${t} passed to ${n} must be a \`Tensor[]\` or \`TensorLike[]\``);return e.map((a,o)=>O(a,`${t}[${o}]`,n,r))}var EH="__op";function V(e){let t=Object.keys(e);if(t.length!==1)throw new Error(`Please provide an object with a single key (operation name) mapping to a function. Got an object with ${t.length} keys.`);let n=t[0],r=e[n];n.endsWith("_")&&(n=n.substring(0,n.length-1)),n=n+EH;let s=(...a)=>{G.startScope(n);try{let o=r(...a);return Ay(o)&&console.error("Cannot return a Promise inside of tidy."),G.endScope(o),o}catch(o){throw G.endScope(null),o}};return Object.defineProperty(s,"name",{value:n,configurable:!0}),s}function $H(e,t){let n=O(e,"real","complex"),r=O(t,"imag","complex");rs(n.shape,r.shape,`real and imag shapes, ${n.shape} and ${r.shape}, must match in call to tf.complex().`);let s={real:n,imag:r};return G.runKernel(Iy,s)}var Uo=V({complex_:$H});function vd(e,t,n,r){if(r==null&&(r=Up(e)),r==="complex64")throw new Error("Cannot construct a complex64 tensor directly. Please use tf.complex(real, imag).");if(!ss(e)&&!Array.isArray(e)&&typeof e!="number"&&typeof e!="boolean"&&typeof e!="string")throw new Error("values passed to tensor(values) must be a number/boolean/string or an array of numbers/booleans/strings, or a TypedArray");if(t!=null){yy(t);let s=on(t),a=on(n);z(s===a,()=>`Based on the provided shape, [${t}], the tensor should have ${s} values but has ${a}`);for(let o=0;o`Error creating a new Tensor. Inferred shape (${n}) does not match the provided shape (${t}). `)}}return!ss(e)&&!Array.isArray(e)&&(e=[e]),t=t||n,e=r!=="string"?hf(e,r):yc(e,[],!0),G.makeTensor(e,t,r)}function $s(e,t,n){let r=bd(e,n);return vd(e,t,r,n)}var gA={float32:4,float16:2,int32:4,uint16:2,uint8:1,bool:1,complex64:8},xf=4;async function _H(e,t){let n=[],r=[],s=Array.isArray(e)?e.map(o=>o.name):Object.keys(e);for(let o=0;o{let h=await l.bytes(),p=h.reduce((g,y)=>g+y.length,0)+xf*h.length,f=new Uint8Array(p),m=0;for(let g=0;g{if(t+=a.byteLength,n.push(a.byteLength===a.buffer.byteLength?a:new a.constructor(a)),!(a instanceof Float32Array||a instanceof Int32Array||a instanceof Uint8Array))throw new Error(`Unsupported TypedArray subtype: ${a.constructor.name}`)});let r=new Uint8Array(t),s=0;return n.forEach(a=>{r.set(new Uint8Array(a.buffer),s),s+=a.byteLength}),r.buffer}var yA=typeof Buffer!="undefined"&&(typeof Blob=="undefined"||typeof atob=="undefined"||typeof btoa=="undefined");function c6(e){return yA?Buffer.byteLength(e):new Blob([e]).size}function DH(e){if(yA)return Buffer.from(e).toString("base64");let t=new Uint8Array(e),n="";for(let r=0,s=t.length;r{t+=s.byteLength});let n=new Uint8Array(t),r=0;return e.forEach(s=>{n.set(new Uint8Array(s),r),r+=s.byteLength}),n.buffer}function d6(e){let t="/";for(e=e.trim();e.endsWith(t);)e=e.slice(0,e.length-1);let n=e.split(t);return n[n.length-1]}function wd(e){if(e.modelTopology instanceof ArrayBuffer)throw new Error("Expected JSON model topology, received ArrayBuffer.");return{dateSaved:new Date,modelTopologyType:"JSON",modelTopologyBytes:e.modelTopology==null?0:c6(JSON.stringify(e.modelTopology)),weightSpecsBytes:e.weightSpecs==null?0:c6(JSON.stringify(e.weightSpecs)),weightDataBytes:e.weightData==null?0:e.weightData.byteLength}}function MH(){let e=n=>{let r=n<<13,s=0;for(;(r&8388608)==0;)s-=8388608,r<<=1;return r&=~8388608,s+=947912704,r|s},t=new Uint32Array(2048);t[0]=0;for(let n=1;n<1024;n++)t[n]=e(n);for(let n=1024;n<2048;n++)t[n]=939524096+(n-1024<<13);return t}function OH(){let e=new Uint32Array(64);e[0]=0,e[31]=1199570944,e[32]=2147483648,e[63]=3347054592;for(let t=1;t<31;t++)e[t]=t<<23;for(let t=33;t<63;t++)e[t]=2147483648+(t-32<<23);return e}function PH(){let e=new Uint32Array(64);for(let t=0;t<64;t++)e[t]=1024;return e[0]=e[32]=0,e}function zH(){let e=MH(),t=OH(),n=PH();return r=>{let s=new ArrayBuffer(4*r.length),a=new Uint32Array(s);for(let o=0;o>10]+(i&1023)]+t[i>>10];a[o]=l}return new Float32Array(s)}}var qt=class{constructor(){this.saveRouters=[],this.loadRouters=[]}static getInstance(){return qt.instance==null&&(qt.instance=new qt),qt.instance}static registerSaveRouter(e){qt.getInstance().saveRouters.push(e)}static registerLoadRouter(e){qt.getInstance().loadRouters.push(e)}static getSaveHandlers(e){return qt.getHandlers(e,"save")}static getLoadHandlers(e,t){return qt.getHandlers(e,"load",t)}static getHandlers(e,t,n){let r=[];return(t==="load"?qt.getInstance().loadRouters:qt.getInstance().saveRouters).forEach(a=>{let o=a(e,n);o!==null&&r.push(o)}),r}},LH=e=>qt.registerSaveRouter(e),BH=e=>qt.registerLoadRouter(e),WH=e=>qt.getSaveHandlers(e),VH=(e,t)=>qt.getLoadHandlers(e,t),xA="tensorflowjs",bA=1,Ho="models_store",Oa="model_info_store";function h6(){if(!ae().getBool("IS_BROWSER"))throw new Error("Failed to obtain IndexedDB factory because the current environmentis not a web browser.");let e=typeof window=="undefined"?self:window,t=e.indexedDB||e.mozIndexedDB||e.webkitIndexedDB||e.msIndexedDB||e.shimIndexedDB;if(t==null)throw new Error("The current browser does not appear to support IndexedDB.");return t}function vA(e){let t=e.result;t.createObjectStore(Ho,{keyPath:"modelPath"}),t.createObjectStore(Oa,{keyPath:"modelPath"})}var Go=class{constructor(e){if(this.indexedDB=h6(),e==null||!e)throw new Error("For IndexedDB, modelPath must not be null, undefined or empty.");this.modelPath=e}async save(e){if(e.modelTopology instanceof ArrayBuffer)throw new Error("BrowserLocalStorage.save() does not support saving model topology in binary formats yet.");return this.databaseAction(this.modelPath,e)}async load(){return this.databaseAction(this.modelPath)}databaseAction(e,t){return new Promise((n,r)=>{let s=this.indexedDB.open(xA,bA);s.onupgradeneeded=()=>vA(s),s.onsuccess=()=>{let a=s.result;if(t==null){let o=a.transaction(Ho,"readonly"),l=o.objectStore(Ho).get(this.modelPath);l.onsuccess=()=>{if(l.result==null)return a.close(),r(new Error(`Cannot find model with path '${this.modelPath}' in IndexedDB.`));n(l.result.modelArtifacts)},l.onerror=u=>(a.close(),r(l.error)),o.oncomplete=()=>a.close()}else{let o=wd(t),i=a.transaction(Oa,"readwrite"),l=i.objectStore(Oa),u=l.put({modelPath:this.modelPath,modelArtifactsInfo:o}),c;u.onsuccess=()=>{c=a.transaction(Ho,"readwrite");let h=c.objectStore(Ho).put({modelPath:this.modelPath,modelArtifacts:t,modelArtifactsInfo:o});h.onsuccess=()=>n({modelArtifactsInfo:o}),h.onerror=p=>{l=i.objectStore(Oa);let f=l.delete(this.modelPath);f.onsuccess=()=>(a.close(),r(h.error)),f.onerror=m=>(a.close(),r(h.error))}},u.onerror=d=>(a.close(),r(u.error)),i.oncomplete=()=>{c==null?a.close():c.oncomplete=()=>a.close()}}},s.onerror=a=>r(s.error)})}};Go.URL_SCHEME="indexeddb://";var p6=e=>ae().getBool("IS_BROWSER")&&!Array.isArray(e)&&e.startsWith(Go.URL_SCHEME)?UH(e.slice(Go.URL_SCHEME.length)):null;qt.registerSaveRouter(p6);qt.registerLoadRouter(p6);function UH(e){return new Go(e)}function HH(e){return e.startsWith(Go.URL_SCHEME)?e.slice(Go.URL_SCHEME.length):e}var GH=class{constructor(){this.indexedDB=h6()}async listModels(){return new Promise((e,t)=>{let n=this.indexedDB.open(xA,bA);n.onupgradeneeded=()=>vA(n),n.onsuccess=()=>{let r=n.result,s=r.transaction(Oa,"readonly"),o=s.objectStore(Oa).getAll();o.onsuccess=()=>{let i={};for(let l of o.result)i[l.modelPath]=l.modelArtifactsInfo;e(i)},o.onerror=i=>(r.close(),t(o.error)),s.oncomplete=()=>r.close()},n.onerror=r=>t(n.error)})}async removeModel(e){return e=HH(e),new Promise((t,n)=>{let r=this.indexedDB.open(xA,bA);r.onupgradeneeded=()=>vA(r),r.onsuccess=()=>{let s=r.result,a=s.transaction(Oa,"readwrite"),o=a.objectStore(Oa),i=o.get(e),l;i.onsuccess=()=>{if(i.result==null)return s.close(),n(new Error(`Cannot find model with path '${e}' in IndexedDB.`));{let u=o.delete(e),c=()=>{l=s.transaction(Ho,"readwrite");let h=l.objectStore(Ho).delete(e);h.onsuccess=()=>t(i.result.modelArtifactsInfo),h.onerror=p=>n(i.error)};u.onsuccess=c,u.onerror=d=>(c(),s.close(),n(i.error))}},i.onerror=u=>(s.close(),n(i.error)),a.oncomplete=()=>{l==null?s.close():l.oncomplete=()=>s.close()}},r.onerror=s=>n(r.error)})}},aa="/",Ul="tensorflowjs_models",f6="info",jH="model_topology",qH="weight_specs",KH="weight_data",XH="model_metadata";function m6(e){return{info:[Ul,e,f6].join(aa),topology:[Ul,e,jH].join(aa),weightSpecs:[Ul,e,qH].join(aa),weightData:[Ul,e,KH].join(aa),modelMetadata:[Ul,e,XH].join(aa)}}function ZH(e){let t=e.split(aa);if(t.length<3)throw new Error(`Invalid key format: ${e}`);return t.slice(1,t.length-1).join(aa)}function YH(e){return e.startsWith(jo.URL_SCHEME)?e.slice(jo.URL_SCHEME.length):e}var jo=class{constructor(e){if(!ae().getBool("IS_BROWSER")||typeof window=="undefined"||typeof window.localStorage=="undefined")throw new Error("The current environment does not support local storage.");if(this.LS=window.localStorage,e==null||!e)throw new Error("For local storage, modelPath must not be null, undefined or empty.");this.modelPath=e,this.keys=m6(this.modelPath)}async save(e){if(e.modelTopology instanceof ArrayBuffer)throw new Error("BrowserLocalStorage.save() does not support saving model topology in binary formats yet.");{let t=JSON.stringify(e.modelTopology),n=JSON.stringify(e.weightSpecs),r=wd(e);try{this.LS.setItem(this.keys.info,JSON.stringify(r)),this.LS.setItem(this.keys.topology,t),this.LS.setItem(this.keys.weightSpecs,n),this.LS.setItem(this.keys.weightData,DH(e.weightData));let s={format:e.format,generatedBy:e.generatedBy,convertedBy:e.convertedBy};return e.signature!=null&&(s.signature=e.signature),e.userDefinedMetadata!=null&&(s.userDefinedMetadata=e.userDefinedMetadata),e.modelInitializer!=null&&(s.modelInitializer=e.modelInitializer),this.LS.setItem(this.keys.modelMetadata,JSON.stringify(s)),{modelArtifactsInfo:r}}catch(s){throw this.LS.removeItem(this.keys.info),this.LS.removeItem(this.keys.topology),this.LS.removeItem(this.keys.weightSpecs),this.LS.removeItem(this.keys.weightData),this.LS.removeItem(this.keys.modelMetadata),new Error(`Failed to save model '${this.modelPath}' to local storage: size quota being exceeded is a possible cause of this failure: modelTopologyBytes=${r.modelTopologyBytes}, weightSpecsBytes=${r.weightSpecsBytes}, weightDataBytes=${r.weightDataBytes}.`)}}}async load(){let e=JSON.parse(this.LS.getItem(this.keys.info));if(e==null)throw new Error(`In local storage, there is no model with name '${this.modelPath}'`);if(e.modelTopologyType!=="JSON")throw new Error("BrowserLocalStorage does not support loading non-JSON model topology yet.");let t={},n=JSON.parse(this.LS.getItem(this.keys.topology));if(n==null)throw new Error(`In local storage, the topology of model '${this.modelPath}' is missing.`);t.modelTopology=n;let r=JSON.parse(this.LS.getItem(this.keys.weightSpecs));if(r==null)throw new Error(`In local storage, the weight specs of model '${this.modelPath}' are missing.`);t.weightSpecs=r;let s=this.LS.getItem(this.keys.modelMetadata);if(s!=null){let o=JSON.parse(s);t.format=o.format,t.generatedBy=o.generatedBy,t.convertedBy=o.convertedBy,o.signature!=null&&(t.signature=o.signature),o.userDefinedMetadata!=null&&(t.userDefinedMetadata=o.userDefinedMetadata),o.modelInitializer!=null&&(t.modelInitializer=o.modelInitializer)}let a=this.LS.getItem(this.keys.weightData);if(a==null)throw new Error(`In local storage, the binary weight values of model '${this.modelPath}' are missing.`);return t.weightData=FH(a),t}};jo.URL_SCHEME="localstorage://";var g6=e=>ae().getBool("IS_BROWSER")&&!Array.isArray(e)&&e.startsWith(jo.URL_SCHEME)?JH(e.slice(jo.URL_SCHEME.length)):null;qt.registerSaveRouter(g6);qt.registerLoadRouter(g6);function JH(e){return new jo(e)}var QH=class{constructor(){z(ae().getBool("IS_BROWSER"),()=>"Current environment is not a web browser"),z(typeof window=="undefined"||typeof window.localStorage!="undefined",()=>"Current browser does not appear to support localStorage"),this.LS=window.localStorage}async listModels(){let e={},t=Ul+aa,n=aa+f6;for(let r=0;r"scheme must not be undefined or null."),e.endsWith(Hl)&&(e=e.slice(0,e.indexOf(Hl))),z(e.length>0,()=>"scheme must not be an empty string.");let n=Er.getInstance();z(n.managers[e]==null,()=>`A model store manager is already registered for scheme '${e}'.`),n.managers[e]=t}static getManager(e){let t=this.getInstance().managers[e];if(t==null)throw new Error(`Cannot find model manager for scheme '${e}'`);return t}static getSchemes(){return Object.keys(this.getInstance().managers)}};function bf(e){if(e.indexOf(Hl)===-1)throw new Error(`The url string provided does not contain a scheme. Supported schemes are: ${Er.getSchemes().join(",")}`);return{scheme:e.split(Hl)[0],path:e.split(Hl)[1]}}async function y6(e,t,n=!1){z(e!==t,()=>`Old path and new path are the same: '${e}'`);let r=qt.getLoadHandlers(e);z(r.length>0,()=>`Copying failed because no load handler is found for source URL ${e}.`),z(r.length<2,()=>`Copying failed because more than one (${r.length}) load handlers for source URL ${e}.`);let s=r[0],a=qt.getSaveHandlers(t);z(a.length>0,()=>`Copying failed because no save handler is found for destination URL ${t}.`),z(a.length<2,()=>`Copying failed because more than one (${r.length}) save handlers for destination URL ${t}.`);let o=a[0],i=bf(e).scheme,l=bf(e).path,u=i===bf(e).scheme,c=await s.load();n&&u&&await Er.getManager(i).removeModel(l);let d=await o.save(c);return n&&!u&&await Er.getManager(i).removeModel(l),d.modelArtifactsInfo}async function eG(){let e=Er.getSchemes(),t={};for(let n of e){let r=await Er.getManager(n).listModels();for(let s in r){let a=n+Hl+s;t[a]=r[s]}}return t}async function tG(e){let t=bf(e);return Er.getManager(t.scheme).removeModel(t.path)}async function nG(e,t){return y6(e,t,!1)}async function rG(e,t){return y6(e,t,!0)}var sG=class{fetch(e,t){return fetch(e,t)}now(){return performance.now()}encode(e,t){if(t!=="utf-8"&&t!=="utf8")throw new Error(`Browser's encoder only supports utf-8, but got ${t}`);return this.textEncoder==null&&(this.textEncoder=new TextEncoder),this.textEncoder.encode(e)}decode(e,t){return new TextDecoder(t).decode(e)}};if(ae().get("IS_BROWSER")){ae().setPlatform("browser",new sG);try{Er.registerManager(jo.URL_SCHEME,new QH)}catch(e){}try{Er.registerManager(Go.URL_SCHEME,new GH)}catch(e){}}var aG={importFetch:()=>O3()},wA,oG=class{constructor(){this.util=co("util"),this.textEncoder=new this.util.TextEncoder}fetch(e,t){return ae().global.fetch!=null?ae().global.fetch(e,t):(wA==null&&(wA=aG.importFetch()),wA(e,t))}now(){let e=process.hrtime();return e[0]*1e3+e[1]/1e6}encode(e,t){if(t!=="utf-8"&&t!=="utf8")throw new Error(`Node built-in encoder only supports utf-8, but got ${t}`);return this.textEncoder.encode(e)}decode(e,t){return e.length===0?"":new this.util.TextDecoder(t).decode(e)}};ae().get("IS_NODE")&&ae().setPlatform("node",new oG);function Le(e,t="float32",n){return t=t||"float32",yy(e),new Qt(e,t,n)}function iG(e,t){let n=O(e,"x","cast");if(!z4(t))throw new Error(`Failed to cast to unknown dtype ${t}`);if(t==="string"&&n.dtype!=="string"||t!=="string"&&n.dtype==="string")throw new Error("Only strings can be casted to strings");let r={x:n},s={dtype:t};return G.runKernel(el,r,s)}var ke=V({cast_:iG});function lG(e){let n={x:O(e,"x","clone","string_or_numeric")};return G.runKernel(hl,n)}var qo=V({clone_:lG});function uG(e,t=!1){console.log(e.toString(t))}a6();var cG={buffer:Le,cast:ke,clone:qo,print:uG};bH(cG);var ur={};De(ur,{browserFiles:()=>yG,browserHTTPRequest:()=>wG,concatenateArrayBuffers:()=>AA,copyModel:()=>nG,decodeWeights:()=>u6,encodeWeights:()=>_H,fromMemory:()=>IG,getLoadHandlers:()=>VH,getModelArtifactsInfoForJSON:()=>wd,getSaveHandlers:()=>WH,http:()=>SA,isHTTPScheme:()=>IA,listModels:()=>eG,loadWeights:()=>AG,moveModel:()=>rG,registerLoadRouter:()=>BH,registerSaveRouter:()=>LH,removeModel:()=>tG,weightsLoaderFactory:()=>v6,withSaveHandler:()=>SG});var dG="model",hG=".json",pG=".weights.bin";function A6(e){return new Promise(t=>setTimeout(t)).then(e)}var Gl=class{constructor(e){if(!ae().getBool("IS_BROWSER"))throw new Error("browserDownloads() cannot proceed because the current environment is not a browser.");e.startsWith(Gl.URL_SCHEME)&&(e=e.slice(Gl.URL_SCHEME.length)),(e==null||e.length===0)&&(e=dG),this.modelTopologyFileName=e+hG,this.weightDataFileName=e+pG}async save(e){if(typeof document=="undefined")throw new Error("Browser downloads are not supported in this environment since `document` is not present");let t=window.URL.createObjectURL(new Blob([e.weightData],{type:"application/octet-stream"}));if(e.modelTopology instanceof ArrayBuffer)throw new Error("BrowserDownloads.save() does not support saving model topology in binary formats yet.");{let n=[{paths:["./"+this.weightDataFileName],weights:e.weightSpecs}],r={modelTopology:e.modelTopology,format:e.format,generatedBy:e.generatedBy,convertedBy:e.convertedBy,weightsManifest:n};e.signature!=null&&(r.signature=e.signature),e.userDefinedMetadata!=null&&(r.userDefinedMetadata=e.userDefinedMetadata),e.modelInitializer!=null&&(r.modelInitializer=e.modelInitializer);let s=window.URL.createObjectURL(new Blob([JSON.stringify(r)],{type:"application/json"})),a=this.jsonAnchor==null?document.createElement("a"):this.jsonAnchor;if(a.download=this.modelTopologyFileName,a.href=s,await A6(()=>a.dispatchEvent(new MouseEvent("click"))),e.weightData!=null){let o=this.weightDataAnchor==null?document.createElement("a"):this.weightDataAnchor;o.download=this.weightDataFileName,o.href=t,await A6(()=>o.dispatchEvent(new MouseEvent("click")))}return{modelArtifactsInfo:wd(e)}}}};Gl.URL_SCHEME="downloads://";var fG=class{constructor(e){if(e==null||e.length<1)throw new Error(`When calling browserFiles, at least 1 file is required, but received ${e}`);this.files=e}async load(){let e=this.files[0],t=this.files.slice(1);return new Promise((n,r)=>{let s=new FileReader;s.onload=a=>{let o=JSON.parse(a.target.result),i=o.modelTopology;if(i==null){r(new Error(`modelTopology field is missing from file ${e.name}`));return}t.length===0&&n({modelTopology:i});let l=o.weightsManifest;if(l==null){r(new Error(`weightManifest field is missing from file ${e.name}`));return}let u;try{u=this.checkManifestAndWeightFiles(l,t)}catch(p){r(p);return}let c=[],d=[],h=[];l.forEach(p=>{p.paths.forEach(f=>{d.push(f),h.push(null)}),c.push(...p.weights)}),l.forEach(p=>{p.paths.forEach(f=>{let m=new FileReader;m.onload=g=>{let y=g.target.result,A=d.indexOf(f);if(h[A]=y,h.indexOf(null)===-1){let x={modelTopology:i,weightSpecs:c,weightData:AA(h),format:o.format,generatedBy:o.generatedBy,convertedBy:o.convertedBy};o.signature!=null&&(x.signature=o.signature),o.userDefinedMetadata!=null&&(x.userDefinedMetadata=o.userDefinedMetadata),o.modelInitializer!=null&&(x.modelInitializer=o.modelInitializer),n(x)}},m.onerror=g=>r(`Failed to weights data from file of path '${f}'.`),m.readAsArrayBuffer(u[f])})})},s.onerror=a=>r(`Failed to read model topology and weights manifest JSON from file '${e.name}'. BrowserFiles supports loading Keras-style tf.Model artifacts only.`),s.readAsText(e)})}checkManifestAndWeightFiles(e,t){let n=[],r=t.map(a=>d6(a.name)),s={};for(let a of e)a.paths.forEach(o=>{let i=d6(o);if(n.indexOf(i)!==-1)throw new Error(`Duplicate file basename found in weights manifest: '${i}'`);if(n.push(i),r.indexOf(i)===-1)throw new Error(`Weight file with basename '${i}' is not provided.`);s[o]=t[r.indexOf(i)]});if(n.length!==t.length)throw new Error(`Mismatch in the number of files in weights manifest (${n.length}) and the number of weight files provided (${t.length}).`);return s}},mG=e=>ae().getBool("IS_BROWSER")&&!Array.isArray(e)&&e.startsWith(Gl.URL_SCHEME)?gG(e.slice(Gl.URL_SCHEME.length)):null;qt.registerSaveRouter(mG);function gG(e="model"){return new Gl(e)}function yG(e){return new fG(e)}function x6(e,t,n,r){o(e),n=n==null?0:n,r=r==null?1:r,i(n,r);let s=0,a=l=>(l.then(u=>{let c=n+ ++s/e.length*(r-n);return t(c),u}),l);function o(l){z(l!=null&&Array.isArray(l)&&l.length>0,()=>"promises must be a none empty array")}function i(l,u){z(l>=0&&l<=1,()=>`Progress fraction must be in range [0, 1], but got startFraction ${l}`),z(u>=0&&u<=1,()=>`Progress fraction must be in range [0, 1], but got endFraction ${u}`),z(u>=l,()=>`startFraction must be no more than endFraction, but got startFraction ${l} and endFraction ${u}`)}return Promise.all(e.map(a))}async function b6(e,t){t==null&&(t={});let n=t.fetchFunc==null?ae().platform.fetch:t.fetchFunc,r=e.map(d=>n(d,t.requestInit,{isBinary:!0})),s=0,a=.5,i=(t.onProgress==null?await Promise.all(r):await x6(r,t.onProgress,s,a)).map(d=>d.arrayBuffer()),l=.5,u=1;return t.onProgress==null?await Promise.all(i):await x6(i,t.onProgress,l,u)}async function AG(e,t="",n,r){return v6(o=>b6(o,{requestInit:r}))(e,t,n)}function v6(e){return async(t,n="",r)=>{let s=t.map(()=>!1),a={},o=r!=null?r.map(()=>!1):[],i=[];if(t.forEach((p,f)=>{let m=0;p.weights.forEach(g=>{let y="quantization"in g?g.quantization.dtype:g.dtype,A=gA[y]*on(g.shape),x=()=>{s[f]=!0,a[f]==null&&(a[f]=[]),a[f].push({manifestEntry:g,groupOffset:m,sizeBytes:A})};r!=null?r.forEach((b,v)=>{b===g.name&&(x(),o[v]=!0)}):x(),i.push(g.name),m+=A})}),!o.every(p=>p)){let p=r.filter((f,m)=>!o[m]);throw new Error(`Could not find weights in manifest with names: ${p.join(", ")}. +Manifest JSON has weights with names: ${i.join(", ")}.`)}let l=s.reduce((p,f,m)=>(f&&p.push(m),p),[]),u=[];l.forEach(p=>{t[p].paths.forEach(f=>{let m=n+(n.endsWith("/")?"":"/")+f;u.push(m)})});let c=await e(u),d={},h=0;return l.forEach(p=>{let f=t[p].paths.length,m=0;for(let b=0;b{let v=g.slice(b.groupOffset,b.groupOffset+b.sizeBytes),w=u6(v,[b.manifestEntry]);for(let I in w)d[I]=w[I]}),h+=f}),d}}var xG="application/octet-stream",bG="application/json",kA=class{constructor(e,t){if(this.DEFAULT_METHOD="POST",t==null&&(t={}),this.weightPathPrefix=t.weightPathPrefix,this.onProgress=t.onProgress,this.weightUrlConverter=t.weightUrlConverter,t.fetchFunc!=null?(z(typeof t.fetchFunc=="function",()=>"Must pass a function that matches the signature of `fetch` (see https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API)"),this.fetch=t.fetchFunc):this.fetch=ae().platform.fetch,z(e!=null&&e.length>0,()=>"URL path for http must not be null, undefined or empty."),Array.isArray(e)&&z(e.length===2,()=>`URL paths for http must have a length of 2, (actual length is ${e.length}).`),this.path=e,t.requestInit!=null&&t.requestInit.body!=null)throw new Error("requestInit is expected to have no pre-existing body, but has one.");this.requestInit=t.requestInit||{}}async save(e){if(e.modelTopology instanceof ArrayBuffer)throw new Error("BrowserHTTPRequest.save() does not support saving model topology in binary formats yet.");let t=Object.assign({method:this.DEFAULT_METHOD},this.requestInit);t.body=new FormData;let n=[{paths:["./model.weights.bin"],weights:e.weightSpecs}],r={modelTopology:e.modelTopology,format:e.format,generatedBy:e.generatedBy,convertedBy:e.convertedBy,weightsManifest:n};e.signature!=null&&(r.signature=e.signature),e.userDefinedMetadata!=null&&(r.userDefinedMetadata=e.userDefinedMetadata),e.modelInitializer!=null&&(r.modelInitializer=e.modelInitializer),t.body.append("model.json",new Blob([JSON.stringify(r)],{type:bG}),"model.json"),e.weightData!=null&&t.body.append("model.weights.bin",new Blob([e.weightData],{type:xG}),"model.weights.bin");let s=await this.fetch(this.path,t);if(s.ok)return{modelArtifactsInfo:wd(e),responses:[s]};throw new Error(`BrowserHTTPRequest.save() failed due to HTTP response status ${s.status}.`)}async load(){let e=await this.fetch(this.path,this.requestInit);if(!e.ok)throw new Error(`Request to ${this.path} failed with status code ${e.status}. Please verify this URL points to the model JSON of the model to load.`);let t;try{t=await e.json()}catch(p){let f=`Failed to parse model JSON of response from ${this.path}.`;throw this.path.endsWith(".pb")?f+=" Your path contains a .pb file extension. Support for .pb models have been removed in TensorFlow.js 1.0 in favor of .json models. You can re-convert your Python TensorFlow model using the TensorFlow.js 1.0 conversion scripts or you can convert your.pb models with the 'pb2json'NPM script in the tensorflow/tfjs-converter repository.":f+=" Please make sure the server is serving valid JSON for this request.",new Error(f)}let n=t.modelTopology,r=t.weightsManifest,s=t.generatedBy,a=t.convertedBy,o=t.format,i=t.signature,l=t.userDefinedMetadata;if(n==null&&r==null)throw new Error(`The JSON from HTTP path ${this.path} contains neither model topology or manifest for weights.`);let u,c;r!=null&&([u,c]=await this.loadWeights(r));let d={modelTopology:n,weightSpecs:u,weightData:c,generatedBy:s,convertedBy:a,format:o};i!=null&&(d.signature=i),l!=null&&(d.userDefinedMetadata=l);let h=t.modelInitializer;return h&&(d.modelInitializer=h),d}async loadWeights(e){let t=Array.isArray(this.path)?this.path[1]:this.path,[n,r]=vG(t),s=this.weightPathPrefix||n,a=[];for(let u of e)a.push(...u.weights);let o=[],i=[];for(let u of e)for(let c of u.paths)this.weightUrlConverter!=null?i.push(this.weightUrlConverter(c)):o.push(s+c+r);this.weightUrlConverter&&o.push(...await Promise.all(i));let l=await b6(o,{requestInit:this.requestInit,fetchFunc:this.fetch,onProgress:this.onProgress});return[a,AA(l)]}};kA.URL_SCHEME_REGEX=/^https?:\/\//;function vG(e){let t=e.lastIndexOf("/"),n=e.lastIndexOf("?"),r=e.substring(0,t),s=n>t?e.substring(n):"";return[r+"/",s]}function IA(e){return e.match(kA.URL_SCHEME_REGEX)!=null}var w6=(e,t)=>{if(typeof fetch=="undefined"&&(t==null||t.fetchFunc==null))return null;{let n=!0;if(Array.isArray(e)?n=e.every(r=>IA(r)):n=IA(e),n)return SA(e,t)}return null};qt.registerSaveRouter(w6);qt.registerLoadRouter(w6);function SA(e,t){return new kA(e,t)}function wG(e,t){return SA(e,t)}var TA=class{constructor(e){this.modelArtifacts=e}async load(){return this.modelArtifacts}},kG=class{constructor(e){this.saveHandler=e}async save(e){return this.saveHandler(e)}};function IG(e,t,n,r){return arguments.length===1?e.modelTopology!=null||e.weightSpecs!=null?new TA(e):(console.warn("Please call tf.io.fromMemory() with only one argument. The argument should be of type ModelArtifacts. The multi-argument signature of tf.io.fromMemory() has been deprecated and will be removed in a future release."),new TA({modelTopology:e})):(console.warn("Please call tf.io.fromMemory() with only one argument. The argument should be of type ModelArtifacts. The multi-argument signature of tf.io.fromMemory() has been deprecated and will be removed in a future release."),new TA({modelTopology:e,weightSpecs:t,weightData:n,trainingConfig:r}))}function SG(e){return new kG(e)}function TG(e,t,n=!1,r=!1){let s=O(e,"a","matMul"),a=O(t,"b","matMul");[s,a]=Ut(s,a);let o={a:s,b:a},i={transposeA:n,transposeB:r};return G.runKernel(Qi,o,i)}var ot=V({matMul_:TG});function NG(e,t,n=1,r=0){if(t<2)throw new Error(`Error in oneHot: depth must be >=2, but it is ${t}`);let a={indices:O(e,"indices","oneHot","int32")},o={depth:t,onValue:n,offValue:r};return G.runKernel(wl,a,o)}var kd=V({oneHot_:NG});function CG(e,t){let n=O(e,"x","transpose");if(t==null&&(t=n.shape.map((a,o)=>o).reverse()),z(n.rank===t.length,()=>`Error in transpose: rank of input ${n.rank} must match length of perm ${t}.`),t.forEach(a=>{z(a>=0&&a`All entries in 'perm' must be between 0 and ${n.rank-1} but got ${t}`)}),n.rank<=1)return n.clone();let r={x:n},s={perm:t};return G.runKernel(zl,r,s)}var pt=V({transpose_:CG});function EG(e,t,n){let r=O(e,"labels","confusionMatrix"),s=O(t,"predictions","confusionMatrix");z(n==null||n>0&&Number.isInteger(n),()=>`If provided, numClasses must be a positive integer, but got ${n}`),z(r.rank===1,()=>`Expected the rank of labels to be 1, but got ${r.rank}`),z(s.rank===1,()=>`Expected the rank of predictions to be 1, but got ${s.rank}`),z(r.shape[0]===s.shape[0],()=>`Mismatch in the number of examples: ${r.shape[0]} vs. ${s.shape[0]}. Labels and predictions should have the same number of elements.`),z(n>0&&Number.isInteger(n),()=>`numClasses is required to be a positive integer, but got ${n}`);let a=kd(ke(r,"int32"),n),o=kd(ke(s,"int32"),n),i=pt(a),l=ot(i,o);return ke(l,"int32")}var mwe=V({confusionMatrix_:EG}),k6={};De(k6,{fromPixels:()=>PG,fromPixelsAsync:()=>MG,toPixels:()=>OG});function $G(e,t,n){if(Wp(e),t!=null&&t.length!==3)throw new Error("tensor3d() requires shape to have three numbers");let r=bd(e,n);if(r.length!==3&&r.length!==1)throw new Error("tensor3d() requires values to be number[][][] or flat/TypedArray");if(r.length===1&&t==null)throw new Error("tensor3d() requires shape to be provided when `values` are a flat array");return vd(e,t,r,n)}var jl;function I6(e,t=3){if(t>4)throw new Error("Cannot construct Tensor with more than 4 channels from pixels.");if(e==null)throw new Error("pixels passed to tf.browser.fromPixels() can not be null");let n=!1,r=!1,s=!1,a=!1,o=!1,i=!1;if(e.data instanceof Uint8Array)n=!0;else if(typeof ImageData!="undefined"&&e instanceof ImageData)r=!0;else if(typeof HTMLVideoElement!="undefined"&&e instanceof HTMLVideoElement)s=!0;else if(typeof HTMLImageElement!="undefined"&&e instanceof HTMLImageElement)a=!0;else if(e.getContext!=null)o=!0;else if(typeof ImageBitmap!="undefined"&&e instanceof ImageBitmap)i=!0;else throw new Error(`pixels passed to tf.browser.fromPixels() must be either an HTMLVideoElement, HTMLImageElement, HTMLCanvasElement, ImageData in browser, or OffscreenCanvas, ImageData in webworker or {data: Uint32Array, width: number, height: number}, but was ${e.constructor.name}`);if(s){let f=2;if(s&&e.readyState element.")}if(aA(rA,G.backendName)!=null){let f={pixels:e},m={numChannels:t};return G.runKernel(rA,f,m)}let[u,c]=s?[e.videoWidth,e.videoHeight]:[e.width,e.height],d;o?d=e.getContext("2d").getImageData(0,0,u,c).data:r||n?d=e.data:(a||s||i)&&(jl==null&&(jl=document.createElement("canvas").getContext("2d")),jl.canvas.width=u,jl.canvas.height=c,jl.drawImage(e,0,0,u,c),d=jl.getImageData(0,0,u,c).data);let h;if(t===4)h=new Int32Array(d);else{let f=u*c;h=new Int32Array(f*t);for(let m=0;m4||a===2)throw new Error(`toPixels only supports depth of size 1, 3 or 4 but got ${a}`);if(n.dtype!=="float32"&&n.dtype!=="int32")throw new Error(`Unsupported type for toPixels: ${n.dtype}. Please use float32 or int32 tensors.`);let o=await n.data(),i=n.dtype==="float32"?255:1,l=new Uint8ClampedArray(s*r*4);for(let u=0;u1)throw new Error(`Tensor values for a float32 Tensor must be in the range [0 - 1] but encountered ${p}.`)}else if(n.dtype==="int32"&&(p<0||p>255))throw new Error(`Tensor values for a int32 Tensor must be in the range [0 - 255] but encountered ${p}.`);a===1?(c[0]=p*i,c[1]=p*i,c[2]=p*i):c[h]=p*i}let d=u*4;l[d+0]=Math.round(c[0]),l[d+1]=Math.round(c[1]),l[d+2]=Math.round(c[2]),l[d+3]=Math.round(c[3])}if(t!=null){t.width=s,t.height=r;let u=t.getContext("2d"),c=new ImageData(l,s,r);u.putImageData(c,0,0)}return n!==e&&n.dispose(),l}var PG=V({fromPixels_:I6}),S6={};De(S6,{prepareAndValidate:()=>T6});function T6(e,t){let n=e.shape.length,r=t.shape.length;if(n<1)throw new Error(`tf.gatherND() expects the input to be rank 1 or higher, but the rank was ${n}.`);if(r<1)throw new Error(`tf.gatherND() expects the indices to be rank 1 or higher, but the rank was ${r}.`);if(t.dtype!=="int32")throw new Error(`tf.gatherND() expects the indices to be int32 type, but the dtype was ${t.dtype}.`);if(t.shape[r-1]>n)throw new Error(`index innermost dimension length must be <= tensor rank; saw: ${t.shape[r-1]} vs. ${n}`);if(on(e.shape)===0)throw new Error(`Requested more than 0 entries, but input is empty. Input shape: ${e.shape}.`);let s=t.shape,a=s[s.length-1],o=1;for(let d=0;dd/u),1].slice(0,a);return[l,o,u,c]}var N6={};De(N6,{calculateShapes:()=>C6,validateInput:()=>CA,validateUpdateShape:()=>NA});function NA(e,t,n){let r=t.rank>1?t.shape[t.rank-1]:1,s=t.rank>1?t.rank-1:1,a=`Must have updates.shape = indices.shape[:batchDim] + shape[sliceDim:], got updates.shape: ${n.shape}, indices.shape: ${t.shape}, shape: ${e}, sliceDim: ${r}, and batchDim: ${s}.`;if(n.rank1?t.shape[r-1]:1,a=n.length,o=1;for(let d=s;dzG,computeFlatOffset:()=>BG,computeOutShape:()=>E6,getNormalizedAxes:()=>D6,isSliceContinous:()=>LG,maskToAxes:()=>vf,parseSliceParams:()=>L6,sliceInfo:()=>WG,startForAxis:()=>P6,startIndicesWithElidedDims:()=>F6,stopForAxis:()=>z6,stopIndicesWithElidedDims:()=>M6,stridesForAxis:()=>O6,stridesWithElidedDims:()=>$6});function zG(e,t,n){let r=e.shape.length;z(r===t.length,()=>`Error in slice${r}D: Length of begin ${t} must match the rank of the array (${r}).`),z(r===n.length,()=>`Error in slice${r}D: Length of size ${n} must match the rank of the array (${r}).`);for(let s=0;s`Error in slice${r}D: begin[${s}] + size[${s}] (${t[s]+n[s]}) would overflow input.shape[${s}] (${e.shape[s]})`)}function vf(e){let t=[],n=0;for(;e>0;)e&1&&t.push(n),e/=2,n++;return t}function E6(e,t,n){let r=[];for(let s=0;s0){let p=t[0],f=n+1;c=F6(o,p,f,r,e),d=M6(i,p,f,s,e),h=$6(a,p,f,e)}else for(let p=0;p-1)a[i]=0;else{let l=_6(t,n,i),u=r[l];e&1<-1)a[i]=Number.MAX_SAFE_INTEGER;else{let l=_6(t,n,i),u=r[l];e&1<0?o=Number.MIN_SAFE_INTEGER:o=Number.MAX_SAFE_INTEGER);let l=r[s];return o<0&&(o+=l),o=gc(0,o,l-1),o}function z6(e,t,n,r,s,a){let o=t[s],i=n[s]||1;(e&1<0?o=Number.MAX_SAFE_INTEGER:o=Number.MIN_SAFE_INTEGER);let l=r[s];return o<0&&(o+=l),i>0?o=gc(0,o,l):o=gc(-1,o,l-1),o}function LG(e,t,n){let r=n.length;for(let s=0;s1){r=s;break}for(let s=r+1;s0||n[s]!==e[s])return!1;return!0}function BG(e,t){let n=e.length>0?e[e.length-1]:1;for(let r=0;r{z(o!==-1,()=>"slice() does not support negative begin indexing.")});let a;return n==null?a=new Array(s).fill(-1):typeof n=="number"?a=[n,...new Array(s-1).fill(-1)]:n.lengtho>=0?o:(z(o===-1,()=>`Negative size values should be exactly -1 but got ${o} for the slice() size at index ${i}.`),e.shape[i]-r[i])),[r,a]}function WG(e,t,n,r,s,a,o,i,l){let u=t.slice(),c=n.slice(),d=r;r==null&&(d=new Array(u.length));let h=vf(o);if(h.length>1)throw new Error("Multiple ellipses in slice is not allowed.");if(o!==0&&i!==0)throw new Error("Using both ellipsisMask and newAxisMask is not yet supported.");if(o!==0&&l!==0)throw new Error("Using both ellipsisMask and shrinkAxisMask is not yet supported.");let p=e.length-u.length,f=vf(i),m=e.slice();f.forEach(I=>{u[I]=0,c[I]=1,m.splice(I,0,1)});let{begin:g,end:y,strides:A}=D6(m,h,p,u,c,d,s,a,o);u=g,c=y,d=A;let x=vf(l);x.forEach(I=>{c[I]=u[I]+1,d[I]=1});let b=E6(u,c,d),v=b.filter((I,T)=>x.indexOf(T)===-1);return{nonStrided:d.every(I=>I===1),$begin:u,$end:c,$strides:d,size:b,newShape:m,outShape:v}}var ce={};De(ce,{Serializable:()=>B6,SerializationMap:()=>Ko,registerClass:()=>Pa});var B6=class{getClassName(){return this.constructor.className}static fromConfig(e,t){return new e(t)}},Ko=class{constructor(){this.classNameMap={}}static getMap(){return Ko.instance==null&&(Ko.instance=new Ko),Ko.instance}static register(e){Ko.getMap().classNameMap[e.className]=[e,e.fromConfig]}};function Pa(e){z(e.className!=null,()=>"Class being registered does not have the static className property defined."),z(typeof e.className=="string",()=>"className is required to be a string, but got type "+typeof e.className),z(e.className.length>0,()=>"Class being registered has an empty-string as its className, which is disallowed."),Ko.register(e)}function W6(e){ae().getBool("DEPRECATION_WARNINGS_ENABLED")&&console.warn(e+" You can disable deprecation warnings with tf.disableDeprecationWarnings().")}vH(W6);function za(){return G}function EA(){return G.memory()}function Z(e,t){return G.tidy(e,t)}function je(e){fA(e).forEach(n=>n.dispose())}function Sn(e){return G.keep(e)}function $A(e,t,n=1){return G.registerBackend(e,t,n)}function VG(){return G.backend}function UG(e,t){let n=O(e,"a","add"),r=O(t,"b","add");[n,r]=Ut(n,r);let s={a:n,b:r};return G.runKernel(Fa,s)}var pe=V({add_:UG});function HG(e,t){let n=O(e,"a","floorDiv"),r=O(t,"b","floorDiv");[n,r]=Ut(n,r);let s={a:n,b:r};return G.runKernel(ul,s)}var _A=V({floorDiv_:HG});function GG(e,t){let n=O(e,"a","div"),r=O(t,"b","div");if([n,r]=Ut(n,r),n.dtype==="int32"&&r.dtype==="int32")return _A(n,r);let s={a:n,b:r},a={};return G.runKernel(ol,s,a)}var Re=V({div_:GG});function jG(e,t){let n=O(e,"a","mul"),r=O(t,"b","mul");[n,r]=Ut(n,r);let s={a:n,b:r};return G.runKernel(Mo,s)}var K=V({mul_:jG});function qG(e){let t=O(e,"x","abs");if(t.dtype==="complex64"){let n={x:t};return G.runKernel(Zp,n)}else{let n={x:t};return G.runKernel(xc,n)}}var yn=V({abs_:qG});function KG(e){let n={x:O(e,"x","acos")};return G.runKernel(bc,n)}var V6=V({acos_:KG});function XG(e){let n={x:O(e,"x","acosh")};return G.runKernel(vc,n)}var U6=V({acosh_:XG});function ZG(e){z(Array.isArray(e),()=>"The argument passed to tf.addN() must be a list of tensors"),z(e.length>=1,()=>`Must pass at least one tensor to tf.addN(), but got ${e.length}`);let t=e.map((s,a)=>O(s,`tensors${a}`,"addN")),n=t[0];t.forEach(s=>{if(s.dtype!==n.dtype)throw new Error("All tensors passed to tf.addN() must have the same dtype")}),t.forEach(s=>{if(!Da(s.shape,n.shape))throw new Error("All tensors passed to tf.addN() must have the same shape")});let r=t;return G.runKernel(Zi,r)}var YG=V({addN_:ZG});function JG(e,t=null,n=!1){let s={x:O(e,"x","all","bool")},a={axis:t,keepDims:n};return G.runKernel(wc,s,a)}var RA=V({all_:JG});function QG(e,t=null,n=!1){let s={x:O(e,"x","any","bool")},a={axis:t,keepDims:n};return G.runKernel(kc,s,a)}var wf=V({any_:QG});function ej(e,t=0){let r={x:O(e,"x","argMax")},s={axis:t};return G.runKernel(Yi,r,s)}var kf=V({argMax_:ej});function tj(e,t=0){let r={x:O(e,"x","argMin")},s={axis:t};return G.runKernel(qp,r,s)}var H6=V({argMin_:tj});function nj(e){let n={x:O(e,"x","asin")};return G.runKernel(Ic,n)}var G6=V({asin_:nj});function rj(e){let n={x:O(e,"x","asinh")};return G.runKernel(Sc,n)}var j6=V({asinh_:rj});function sj(e){let n={x:O(e,"x","atan")};return G.runKernel(Tc,n)}var q6=V({atan_:sj});function aj(e,t){let n=O(e,"a","atan2"),r=O(t,"b","atan2");[n,r]=Ut(n,r);let s={a:n,b:r};return G.runKernel(Cc,s)}var K6=V({atan2_:aj});function oj(e){let n={x:O(e,"x","atanh")};return G.runKernel(Nc,n)}var X6=V({atanh_:oj});function ij(e,t,n,r,s="NHWC",a){let o=e[3],i=[...t,o],l=J6(s);return Id(e,i,n,a,r,null,null,l)}function Z6(e,t,n,r,s,a,o="channelsLast"){let[i,l]=If(t),u;if(o==="channelsLast")u=[i,l,e[3],e[3]];else if(o==="channelsFirst")u=[i,l,e[1],e[1]];else throw new Error(`Unknown dataFormat ${o}`);return Id(e,u,n,r,s,a,!1,o)}function lj(e,t,n,r,s,a,o="NDHWC"){let[i,l,u]=FA(t),c,d;if(o==="NDHWC")d="channelsLast",c=[i,l,u,e[4],e[4]];else if(o==="NCDHW")d="channelsFirst",c=[i,l,u,e[1],e[1]];else throw new Error(`Unknown dataFormat ${o}`);return Y6(e,c,n,r,s,!1,d,a)}function Id(e,t,n,r,s,a,o=!1,i="channelsLast"){let[l,u,c,d]=[-1,-1,-1,-1];if(i==="channelsLast")[l,u,c,d]=e;else if(i==="channelsFirst")[l,d,u,c]=e;else throw new Error(`Unknown dataFormat ${i}`);let[h,p,,f]=t,[m,g]=If(n),[y,A]=If(r),x=ql(h,y),b=ql(p,A),{padInfo:v,outHeight:w,outWidth:I}=dj(s,u,c,m,g,x,b,a,i),T=o?f*d:f,C;return i==="channelsFirst"?C=[l,T,w,I]:i==="channelsLast"&&(C=[l,w,I,T]),{batchSize:l,dataFormat:i,inHeight:u,inWidth:c,inChannels:d,outHeight:w,outWidth:I,outChannels:T,padInfo:v,strideHeight:m,strideWidth:g,filterHeight:h,filterWidth:p,effectiveFilterHeight:x,effectiveFilterWidth:b,dilationHeight:y,dilationWidth:A,inShape:e,outShape:C,filterShape:t}}function Y6(e,t,n,r,s,a=!1,o="channelsLast",i){let[l,u,c,d,h]=[-1,-1,-1,-1,-1];if(o==="channelsLast")[l,u,c,d,h]=e;else if(o==="channelsFirst")[l,h,u,c,d]=e;else throw new Error(`Unknown dataFormat ${o}`);let[p,f,m,,g]=t,[y,A,x]=FA(n),[b,v,w]=FA(r),I=ql(p,b),T=ql(f,v),C=ql(m,w),{padInfo:M,outDepth:$,outHeight:R,outWidth:N}=hj(s,u,c,d,y,A,x,I,T,C,i),F=a?g*h:g,B;return o==="channelsFirst"?B=[l,F,$,R,N]:o==="channelsLast"&&(B=[l,$,R,N,F]),{batchSize:l,dataFormat:o,inDepth:u,inHeight:c,inWidth:d,inChannels:h,outDepth:$,outHeight:R,outWidth:N,outChannels:F,padInfo:M,strideDepth:y,strideHeight:A,strideWidth:x,filterDepth:p,filterHeight:f,filterWidth:m,effectiveFilterDepth:I,effectiveFilterHeight:T,effectiveFilterWidth:C,dilationDepth:b,dilationHeight:v,dilationWidth:w,inShape:e,outShape:B,filterShape:t}}function uj(e,t,n,r,s){r==null&&(r=DA(e,t,n));let a=e[0],o=e[1],i=Xo((a-t+2*r)/n+1,s),l=Xo((o-t+2*r)/n+1,s);return[i,l]}function cj(e,t,n,r,s,a){s==null&&(s=DA(e,t,r));let o=e[0],i=e[1],l=e[2],u=Xo((o-t+2*s)/r+1,a),c=Xo((i-t+2*s)/r+1,a),d=Xo((l-t+2*s)/r+1,a);return[u,c,d,n]}function DA(e,t,n,r=1){let s=ql(t,r);return Math.floor((e[0]*(n-1)-n+s)/2)}function If(e){return typeof e=="number"?[e,e,e]:e.length===2?[e[0],e[1],1]:e}function FA(e){return typeof e=="number"?[e,e,e]:e}function ql(e,t){return t<=1?e:e+(e-1)*(t-1)}function dj(e,t,n,r,s,a,o,i,l){let u,c,d;if(typeof e=="number"){u={top:e,bottom:e,left:e,right:e,type:e===0?"VALID":"NUMBER"};let p=uj([t,n],a,r,e,i);c=p[0],d=p[1]}else if(e==="same"){c=Math.ceil(t/r),d=Math.ceil(n/s);let h=Math.max(0,(c-1)*r+a-t),p=Math.max(0,(d-1)*s+o-n),f=Math.floor(h/2),m=h-f,g=Math.floor(p/2),y=p-g;u={top:f,bottom:m,left:g,right:y,type:"SAME"}}else if(e==="valid")u={top:0,bottom:0,left:0,right:0,type:"VALID"},c=Math.ceil((t-a+1)/r),d=Math.ceil((n-o+1)/s);else if(typeof e=="object"){let h=l==="channelsLast"?e[1][0]:e[2][0],p=l==="channelsLast"?e[1][1]:e[2][1],f=l==="channelsLast"?e[2][0]:e[3][0],m=l==="channelsLast"?e[2][1]:e[3][1];u={top:h,bottom:p,left:f,right:m,type:h===0&&p===0&&f===0&&m===0?"VALID":"EXPLICIT"},c=Xo((t-a+h+p)/r+1,i),d=Xo((n-o+f+m)/s+1,i)}else throw Error(`Unknown padding parameter: ${e}`);return{padInfo:u,outHeight:c,outWidth:d}}function hj(e,t,n,r,s,a,o,i,l,u,c){let d,h,p,f;if(typeof e=="number"){d={top:e,bottom:e,left:e,right:e,front:e,back:e,type:e===0?"VALID":"NUMBER"};let g=cj([t,n,r,1],i,1,s,e,c);h=g[0],p=g[1],f=g[2]}else if(e==="same"){h=Math.ceil(t/s),p=Math.ceil(n/a),f=Math.ceil(r/o);let m=(h-1)*s+i-t,g=(p-1)*a+l-n,y=(f-1)*o+u-r,A=Math.floor(m/2),x=m-A,b=Math.floor(g/2),v=g-b,w=Math.floor(y/2),I=y-w;d={top:b,bottom:v,left:w,right:I,front:A,back:x,type:"SAME"}}else if(e==="valid")d={top:0,bottom:0,left:0,right:0,front:0,back:0,type:"VALID"},h=Math.ceil((t-i+1)/s),p=Math.ceil((n-l+1)/a),f=Math.ceil((r-u+1)/o);else throw Error(`Unknown padding parameter: ${e}`);return{padInfo:d,outDepth:h,outHeight:p,outWidth:f}}function Xo(e,t){if(!t)return Math.trunc(e);switch(t){case"round":return Math.round(e);case"ceil":return Math.ceil(e);case"floor":return Math.floor(e);default:throw new Error(`Unknown roundingMode ${t}`)}}function La(e){let[t,n,r]=If(e);return t===1&&n===1&&r===1}function _s(e,t){return La(e)||La(t)}function J6(e){if(e==="NHWC")return"channelsLast";if(e==="NCHW")return"channelsFirst";throw new Error(`Unknown dataFormat ${e}`)}function pj(e,t){let r={x:O(e,"x","reshape","string_or_numeric")},s={shape:t};return G.runKernel(Qc,r,s)}var J=V({reshape_:pj});function fj(e,t,n,r,s){let a=O(e,"x","avgPool","float32"),o=1;z(_s(n,o),()=>`Error in avgPool: Either strides or dilations must be 1. Got strides ${n} and dilations '${o}'`);let i=a,l=!1;a.rank===3&&(l=!0,i=J(a,[1,a.shape[0],a.shape[1],a.shape[2]])),z(i.rank===4,()=>`Error in avgPool: x must be rank 4 but got rank ${i.rank}.`),s!=null&&z(mn(r),()=>`Error in avgPool: pad must be an integer when using, dimRoundingMode ${s} but got pad ${r}.`);let u={x:i},c={filterSize:t,strides:n,pad:r,dimRoundingMode:s},d=G.runKernel(Ji,u,c);return d=ke(d,a.dtype),l?J(d,[d.shape[1],d.shape[2],d.shape[3]]):d}var Sf=V({avgPool_:fj});function mj(e,t,n,r,s,a="NDHWC"){let o=O(e,"x","avgPool3d","float32"),i=o,l=!1;o.rank===4&&(l=!0,i=J(o,[1,o.shape[0],o.shape[1],o.shape[2],o.shape[3]])),z(i.rank===5,()=>`Error in avgPool3d: x must be rank 5 but got rank ${i.rank}.`),z(a==="NDHWC",()=>`Error in avgPool3d: Only NDHWC is currently supported, but got dataFormat of ${a}`),s!=null&&z(mn(r),()=>`Error in avgPool3d: pad must be an integer when using, dimRoundingMode ${s} but got pad ${r}.`);let u={x:i},c={filterSize:t,strides:n,pad:r,dimRoundingMode:s,dataFormat:a},d=G.runKernel(Kp,u,c);return d=ke(d,i.dtype),l?J(d,[d.shape[1],d.shape[2],d.shape[3],d.shape[4]]):d}var Q6=V({avgPool3d_:mj});function gj(e,t=0){z(e.length>=1,()=>"Pass at least one tensor to concat");let n=Af(e,"tensors","concat","string_or_numeric");if(n[0].dtype==="complex64"&&n.forEach(a=>{if(a.dtype!=="complex64")throw new Error(`Cannot concatenate complex64 tensors with a tensor + with dtype ${a.dtype}. `)}),n.length===1)return qo(n[0]);let r=n,s={axis:t};return G.runKernel(Ec,r,s)}var en=V({concat_:gj});function yj(e){let n={x:O(e,"x","sigmoid")};return G.runKernel(Rl,n)}var Rs=V({sigmoid_:yj});function Aj(e,t,n){let r=O(e,"x","slice","string_or_numeric");if(r.rank===0)throw new Error("Slicing scalar is not possible");let s={x:r},a={begin:t,size:n};return G.runKernel(rd,s,a)}var nt=V({slice_:Aj});function xj(e){let n={x:O(e,"x","tanh")};return G.runKernel(Pl,n)}var Kl=V({tanh_:xj});function bj(e,t,n,r,s,a){let o=O(e,"forgetBias","basicLSTMCell"),i=O(t,"lstmKernel","basicLSTMCell"),l=O(n,"lstmBias","basicLSTMCell"),u=O(r,"data","basicLSTMCell"),c=O(s,"c","basicLSTMCell"),d=O(a,"h","basicLSTMCell"),h=en([u,d],1),p=ot(h,i),f=pe(p,l),m=f.shape[0],g=f.shape[1]/4,y=[m,g],A=nt(f,[0,0],y),x=nt(f,[0,g],y),b=nt(f,[0,g*2],y),v=nt(f,[0,g*3],y),w=pe(K(Rs(A),Kl(x)),K(c,Rs(pe(o,b)))),I=K(Kl(w),Rs(v));return[w,I]}var gwe=V({basicLSTMCell_:bj});function vj(e,t,n){let r=O(e,"x","batchToSpaceND"),s=t.reduce((i,l)=>i*l);z(r.rank>=1+t.length,()=>`input rank is ${r.rank} but should be > than blockShape.length ${t.length}`),z(n.length===t.length,()=>`crops.length is ${n.length} but should be equal to blockShape.length ${t.length}`),z(r.shape[0]%s==0,()=>`input tensor batch is ${r.shape[0]} but is not divisible by the product of the elements of blockShape ${t.join(" * ")} === ${s}`);let a={x:r},o={blockShape:t,crops:n};return G.runKernel(Xp,a,o)}var Tf=V({batchToSpaceND_:vj});function wj(e){let t;return e.rank===0||e.rank===1?t=J(e,[1,1,1,e.size]):e.rank===2?t=J(e,[1,1,e.shape[0],e.shape[1]]):e.rank===3?t=J(e,[1,e.shape[0],e.shape[1],e.shape[2]]):t=e,t}function kj(e,t,n,r,s,a){a==null&&(a=.001);let o=O(e,"x","batchNorm"),i=O(t,"mean","batchNorm"),l=O(n,"variance","batchNorm"),u;s!=null&&(u=O(s,"scale","batchNorm"));let c;r!=null&&(c=O(r,"offset","batchNorm")),z(i.rank===l.rank,()=>"Batch normalization gradient requires mean and variance to have equal ranks."),z(c==null||i.rank===c.rank,()=>"Batch normalization gradient requires mean and offset to have equal ranks."),z(u==null||i.rank===u.rank,()=>"Batch normalization gradient requires mean and scale to have equal ranks.");let h={x:wj(o),scale:u,offset:c,mean:i,variance:l},p={varianceEpsilon:a},f=G.runKernel(cl,h,p);return J(f,o.shape)}var Xl=V({batchNorm_:kj});function Ij(e,t,n,r,s,a){let o=O(e,"x","batchNorm"),i=O(t,"mean","batchNorm"),l=O(n,"variance","batchNorm"),u;s!=null&&(u=O(s,"scale","batchNorm"));let c;return r!=null&&(c=O(r,"offset","batchNorm")),z(o.rank===2,()=>`Error in batchNorm2D: x must be rank 2 but got rank ${o.rank}.`),z(i.rank===2||i.rank===1,()=>`Error in batchNorm2D: mean must be rank 2 or rank 1 but got rank ${i.rank}.`),z(l.rank===2||l.rank===1,()=>`Error in batchNorm2D: variance must be rank 2 or rank 1 but got rank ${l.rank}.`),u!=null&&z(u.rank===2||u.rank===1,()=>`Error in batchNorm2D: scale must be rank 2 or rank 1 but got rank ${u.rank}.`),c!=null&&z(c.rank===2||c.rank===1,()=>`Error in batchNorm2D: offset must be rank 2 or rank 1 but got rank ${c.rank}.`),Xl(o,i,l,c,u,a)}var Sj=V({batchNorm2d_:Ij});function Tj(e,t,n,r,s,a){let o=O(e,"x","batchNorm"),i=O(t,"mean","batchNorm"),l=O(n,"variance","batchNorm"),u;s!=null&&(u=O(s,"scale","batchNorm"));let c;return r!=null&&(c=O(r,"offset","batchNorm")),z(o.rank===3,()=>`Error in batchNorm3D: x must be rank 3 but got rank ${o.rank}.`),z(i.rank===3||i.rank===1,()=>`Error in batchNorm3D: mean must be rank 3 or rank 1 but got rank ${i.rank}.`),z(l.rank===3||l.rank===1,()=>`Error in batchNorm3D: variance must be rank 3 or rank 1 but got rank ${l.rank}.`),u!=null&&z(u.rank===3||u.rank===1,()=>`Error in batchNorm3D: scale must be rank 3 or rank 1 but got rank ${u.rank}.`),c!=null&&z(c.rank===3||c.rank===1,()=>`Error in batchNorm3D: offset must be rank 3 or rank 1 but got rank ${c.rank}.`),Xl(o,i,l,c,u,a)}var Nj=V({batchNorm3d_:Tj});function Cj(e,t,n,r,s,a){let o=O(e,"x","batchNorm"),i=O(t,"mean","batchNorm"),l=O(n,"variance","batchNorm"),u;s!=null&&(u=O(s,"scale","batchNorm"));let c;return r!=null&&(c=O(r,"offset","batchNorm")),z(o.rank===4,()=>`Error in batchNorm4D: x must be rank 4 but got rank ${o.rank}.`),z(i.rank===4||i.rank===1,()=>`Error in batchNorm4D: mean must be rank 4 or rank 1 but got rank ${i.rank}.`),z(l.rank===4||l.rank===1,()=>`Error in batchNorm4D: variance must be rank 4 or rank 1 but got rank ${l.rank}.`),u!=null&&z(u.rank===4||u.rank===1,()=>`Error in batchNorm4D: scale must be rank 4 or rank 1 but got rank ${u.rank}.`),c!=null&&z(c.rank===4||c.rank===1,()=>`Error in batchNorm4D: offset must be rank 4 or rank 1 but got rank ${c.rank}.`),Xl(o,i,l,c,u,a)}var Ej=V({batchNorm4d_:Cj});function $j(e,t,n){let r=O(e,"x","bincount"),s=O(t,"weights","bincount");z(r.dtype==="int32",()=>`Error in bincount: input dtype must be int32, but got ${r.dtype}`),z(n>=0,()=>`size must be non-negative, but got ${n}.`),z(s.size===r.size||s.size===0,()=>`Error in bincount: weights must have the same size as input or0-length, but got input shape: ${r.shape}, weights shape: ${s.shape}.`);let a={x:r,weights:s},o={size:n};return G.runKernel(ky,a,o)}var eI=V({bincount_:$j});function _j(e,t){let n=O(e,"broadcastTo","x"),r=n.shape;if(t.some(u=>!(u>0)||u%1!=0))throw new Error(`broadcastTo(): Invalid broadcast shape [${t}].`);if(t.lengthn.rank){let u=n.shape.slice();for(;u.length=0;u--)if(s[u]===t[u])a[u]=1;else if(n.shape[u]!==1)throw new Error(`broadcastTo(): [${r}] cannot be broadcast to [${t}].`);if(a.map((u,c)=>u>1?c:-1).filter(u=>u>=0).length===0)return qo(n);let i={x:n},l={reps:a};return G.runKernel(Lo,i,l)}var Sd=V({broadcastTo_:_j});function Rj(e){let n={x:O(e,"x","ceil")};return G.runKernel(No,n)}var tI=V({ceil_:Rj});function Dj(e,t,n){let r=O(e,"x","clipByValue");z(t<=n,()=>`Error in clip: min (${t}) must be less than or equal to max (${n}).`);let s={x:r},a={clipValueMin:t,clipValueMax:n};return G.runKernel(Co,s,a)}var cr=V({clipByValue_:Dj});function Fj(e){return en(e,0)}var Mj=V({concat1d_:Fj});function Oj(e,t){return en(e,t)}var Pj=V({concat2d_:Oj});function zj(e,t){return en(e,t)}var Lj=V({concat3d_:zj});function Bj(e,t){return en(e,t)}var Wj=V({concat4d_:Bj});function Vj(e,t,n,r,s="NHWC",a=[1,1],o){let i=O(e,"x","conv2d"),l=O(t,"filter","conv2d"),u=i,c=!1;i.rank===3&&(c=!0,u=J(i,[1,i.shape[0],i.shape[1],i.shape[2]])),z(u.rank===4,()=>`Error in conv2d: input must be rank 4, but got rank ${u.rank}.`),z(l.rank===4,()=>`Error in conv2d: filter must be rank 4, but got rank ${l.rank}.`),o!=null&&z(mn(r),()=>`Error in conv2d: pad must be an integer when using, dimRoundingMode ${o} but got pad ${r}.`);let d=s==="NHWC"?u.shape[3]:u.shape[1];z(d===l.shape[2],()=>`Error in conv2d: depth of input (${d}) must match input depth for filter ${l.shape[2]}.`),z(_s(n,a),()=>`Error in conv2D: Either strides or dilations must be 1. Got strides ${n} and dilations '${a}'`);let h={x:u,filter:l},p={strides:n,pad:r,dataFormat:s,dilations:a,dimRoundingMode:o},f=G.runKernel(tl,h,p);return c?J(f,[f.shape[1],f.shape[2],f.shape[3]]):f}var Ba=V({conv2d_:Vj});function Uj(e,t,n,r,s="NWC",a=1,o){let i=O(e,"x","conv1d"),l=O(t,"filter","conv1d"),u=i,c=!1;i.rank===2&&(c=!0,u=J(i,[1,i.shape[0],i.shape[1]])),z(u.rank===3,()=>`Error in conv1d: input must be rank 3, but got rank ${u.rank}.`),z(l.rank===3,()=>`Error in conv1d: filter must be rank 3, but got rank ${l.rank}.`),o!=null&&z(mn(r),()=>`Error in conv1d: pad must be an integer when using, dimRoundingMode ${o} but got pad ${r}.`),z(u.shape[2]===l.shape[1],()=>`Error in conv1d: depth of input (${u.shape[2]}) must match input depth for filter ${l.shape[1]}.`),z(_s(n,a),()=>`Error in conv1D: Either stride or dilation must be 1. Got stride ${n} and dilation '${a}'`),z(s==="NWC",()=>`Error in conv1d: got dataFormat of ${s} but only NWC is currently supported.`);let d=J(l,[1,l.shape[0],l.shape[1],l.shape[2]]),h=J(u,[u.shape[0],1,u.shape[1],u.shape[2]]),g=Ba(h,d,[1,n],r,"NHWC",[1,a],o);return c?J(g,[g.shape[2],g.shape[3]]):J(g,[g.shape[0],g.shape[2],g.shape[3]])}var MA=V({conv1d_:Uj});function Hj(e,t,n,r,s,a="NHWC",o){z(e.length===t.rank,()=>`Length of inShape (${e.length}) and rank of dy (${t.rank}) must match`);let i=e,l=t,u=!1;t.rank===3&&(u=!0,l=J(t,[1,t.shape[0],t.shape[1],t.shape[2]]),i=[1,e[0],e[1],e[2]]),z(i.length===4,()=>`Error in conv2dDerInput: inShape must be length 4, but got length ${i.length}.`),z(l.rank===4,()=>`Error in conv2dDerInput: dy must be rank 4, but got rank ${l.rank}`),z(n.rank===4,()=>`Error in conv2dDerInput: filter must be rank 4, but got rank ${n.rank}`);let c=a==="NHWC"?i[3]:i[1],d=a==="NHWC"?l.shape[3]:l.shape[1];z(c===n.shape[2],()=>`Error in conv2dDerInput: depth of input (${c}) must match input depth for filter ${n.shape[2]}.`),z(d===n.shape[3],()=>`Error in conv2dDerInput: depth of output (${d}) must match output depth for filter ${n.shape[3]}.`),o!=null&&z(mn(s),()=>`Error in conv2dDerInput: pad must be an integer when using, dimRoundingMode ${o} but got pad ${s}.`);let h={dy:l,filter:n},p={strides:r,pad:s,dataFormat:a,dimRoundingMode:o,inputShape:i},f=G.runKernel(nl,h,p);return u?J(f,[f.shape[1],f.shape[2],f.shape[3]]):f}var OA=V({conv2DBackpropInput_:Hj});function Gj(e,t,n,r,s,a){let o=O(e,"x","conv2dTranspose"),i=O(t,"filter","conv2dTranspose");return OA(n,o,i,r,s,"NHWC",a)}var PA=V({conv2dTranspose_:Gj});function jj(e,t,n,r,s="NDHWC",a=[1,1,1]){let o=O(e,"x","conv3d"),i=O(t,"filter","conv3d"),l=o,u=!1;o.rank===4&&(u=!0,l=J(o,[1,o.shape[0],o.shape[1],o.shape[2],o.shape[3]])),z(l.rank===5,()=>`Error in conv3d: input must be rank 5, but got rank ${l.rank}.`),z(i.rank===5,()=>`Error in conv3d: filter must be rank 5, but got rank ${i.rank}.`),z(l.shape[4]===i.shape[3],()=>`Error in conv3d: depth of input (${l.shape[4]}) must match input depth for filter ${i.shape[3]}.`),z(_s(n,a),()=>`Error in conv3D: Either strides or dilations must be 1. Got strides ${n} and dilations '${a}'`),z(s==="NDHWC",()=>`Error in conv3d: got dataFormat of ${s} but only NDHWC is currently supported.`);let c={x:l,filter:i},d={strides:n,pad:r,dataFormat:s,dilations:a},h=G.runKernel(Yp,c,d);return u?J(h,[h.shape[1],h.shape[2],h.shape[3],h.shape[4]]):h}var nI=V({conv3d_:jj});function qj(e,t,n,r,s){z(e.length===t.rank,()=>`Length of inShape (${e.length}) and rank of dy (${t.rank}) must match`);let a=e,o=t,i=!1;t.rank===4&&(i=!0,o=J(t,[1,t.shape[0],t.shape[1],t.shape[2],t.shape[3]]),a=[1,e[0],e[1],e[2],e[3]]);let l=a[4],u=o.shape[4];z(a.length===5,()=>`Error in conv3dDerInput: inShape must be length 5, but got length ${a.length}.`),z(o.rank===5,()=>`Error in conv3dDerInput: dy must be rank 5, but got rank ${o.rank}`),z(n.rank===5,()=>`Error in conv3dDerInput: filter must be rank 5, but got rank ${n.rank}`),z(l===n.shape[3],()=>`Error in conv3dDerInput: depth of input (${l}) must match input depth for filter ${n.shape[3]}.`),z(u===n.shape[4],()=>`Error in conv3dDerInput: depth of output (${u}) must match output depth for filter ${n.shape[4]}.`);let c={dy:o,filter:n},d={pad:s,strides:r,inputShape:a},h=G.runKernel(Ny,c,d);return i?J(h,[h.shape[1],h.shape[2],h.shape[3],h.shape[4]]):h}var rI=V({conv3DBackpropInput_:qj});function Kj(e,t,n,r,s){let a=O(e,"x","conv3dTranspose"),o=O(t,"filter","conv3dTranspose");return rI(n,a,o,r,s)}var Xj=V({conv3dTranspose_:Kj});function Zj(e){let n={x:O(e,"x","cos")};return G.runKernel(rl,n)}var Nf=V({cos_:Zj});function Yj(e){let n={x:O(e,"x","cosh")};return G.runKernel($c,n)}var zA=V({cosh_:Yj});function Jj(e,t=0,n=!1,r=!1){let a={x:O(e,"x","cumsum")},o={axis:t,exclusive:n,reverse:r};return G.runKernel(sl,a,o)}var LA=V({cumsum_:Jj});function Qj(e,t,n,r=!1){let s=O(e,"x","denseBincount"),a=O(t,"weights","denseBincount");z(s.dtype==="int32",()=>`Error in denseBincount: input dtype must be int32, but got ${s.dtype}`),z(s.rank<=2,()=>`Error in denseBincount: input must be at most rank 2, but got rank ${s.rank}.`),z(n>=0,()=>`size must be non-negative, but got ${n}.`),z(a.size===s.size||a.size===0,()=>`Error in denseBincount: weights must have the same shape as x or 0-length, but got x shape: ${s.shape}, weights shape: ${a.shape}.`);let o={x:s,weights:a},i={size:n,binaryOutput:r};return G.runKernel(Cy,o,i)}var eq=V({denseBincount_:Qj});function tq(e,t,n="NHWC"){let r=O(e,"x","depthToSpace"),s=n==="NHWC"?r.shape[1]:r.shape[2],a=n==="NHWC"?r.shape[2]:r.shape[3],o=n==="NHWC"?r.shape[3]:r.shape[1];z(s*t>=0,()=>`Negative dimension size caused by overflow when multiplying + ${s} and ${t} for depthToSpace with input shape + ${r.shape}`),z(a*t>=0,()=>`Negative dimension size caused by overflow when multiplying + ${a} and ${t} for depthToSpace with input shape + ${r.shape}`),z(o%(t*t)==0,()=>`Dimension size must be evenly divisible by ${t*t} but is ${o} for depthToSpace with input shape ${r.shape}`);let i={x:r},l={blockSize:t,dataFormat:n};return G.runKernel(Rc,i,l)}var sI=V({depthToSpace_:tq});function nq(e,t,n,r,s="NHWC",a=[1,1],o){let i=O(e,"x","depthwiseConv2d"),l=O(t,"filter","depthwiseConv2d"),u=i,c=!1;i.rank===3&&(c=!0,u=J(i,[1,i.shape[0],i.shape[1],i.shape[2]])),z(u.rank===4,()=>`Error in depthwiseConv2d: input must be rank 4, but got rank ${u.rank}.`),z(l.rank===4,()=>`Error in depthwiseConv2d: filter must be rank 4, but got rank ${l.rank}.`),z(u.shape[3]===l.shape[2],()=>`Error in depthwiseConv2d: number of input channels (${u.shape[3]}) must match the inChannels dimension in filter ${l.shape[2]}.`),o!=null&&z(mn(r),()=>`Error in depthwiseConv2d: pad must be an integer when using, dimRoundingMode ${o} but got pad ${r}.`);let d={x:u,filter:l},h={strides:n,pad:r,dataFormat:s,dilations:a,dimRoundingMode:o},p=G.runKernel(al,d,h);return c?J(p,[p.shape[1],p.shape[2],p.shape[3]]):p}var Td=V({depthwiseConv2d_:nq});function rq(e){let n={x:O(e,"x","diag")};return G.runKernel(_y,n)}var ywe=V({diag_:rq});function sq(e,t,n,r,s=[1,1],a="NHWC"){let o=O(e,"x","dilation2d"),i=O(t,"filter","dilation2d");z(o.rank===3||o.rank===4,()=>`Error in dilation2d: input must be rank 3 or 4, but got rank ${o.rank}.`),z(i.rank===3,()=>`Error in dilation2d: filter must be rank 3, but got rank ${i.rank}.`),z(a==="NHWC",()=>`Error in dilation2d: Only NHWC is currently supported, but got dataFormat of ${a}`);let l=o,u=!1;o.rank===3&&(l=J(o,[1,o.shape[0],o.shape[1],o.shape[2]]),u=!0);let c={x:l,filter:i},d={strides:n,pad:r,dilations:s},h=G.runKernel(Jp,c,d);return u?J(h,[h.shape[1],h.shape[2],h.shape[3]]):h}var aI=V({dilation2d_:sq});function aq(e,t){let n=e.length,r=[];for(let s=0;s1&&o===1&&r.unshift(a)}return r}function ln(e,t){let n=[];for(let r=0;r1)&&n.unshift(a)}return n}function Rt(e,t){let n=[],r=Math.max(e.length,t.length);for(let s=0;s`Error in dot: inputs must all be rank 1 or 2, but got ranks ${n.rank} and ${r.rank}.`);let s=n.rank===1?n.size:n.shape[1],a=r.rank===1?r.size:r.shape[0];if(z(s===a,()=>`Error in dot: inner dimensions of inputs must match, but got ${s} and ${a}.`),n.rank===1&&r.rank===1){let o=J(n,[1,-1]),i=J(r,[-1,1]),l=ot(o,i);return J(l,[])}else if(n.rank===1&&r.rank===2){let o=J(n,[1,-1]),i=J(r,[r.shape[0],r.shape[1]]),l=ot(o,i);return J(l,[l.size])}else if(n.rank===2&&r.rank===1){let o=J(r,[-1,1]),i=ot(n,o);return J(i,[i.size])}else{let o=J(r,[r.shape[0],r.shape[1]]);return ot(n,o)}}var dq=V({dot_:cq});function hq(e,...t){let n=t.map((s,a)=>O(s,`tensors${a}`,"einsum")),r={equation:e};return G.runKernel(Fy,n,r)}var pq=V({einsum_:hq});function fq(e){let n={x:O(e,"x","elu")};return G.runKernel(Dc,n)}var Nd=V({elu_:fq});function mq(e){let t=O(e,"x","erf");z(t.dtype==="int32"||t.dtype==="float32",()=>"Input dtype must be `int32` or `float32`."),t.dtype==="int32"&&(t=ke(t,"float32"));let n={x:t};return G.runKernel(Fc,n)}var iI=V({erf_:mq});function gq(e){let n={x:O(e,"x","exp")};return G.runKernel(Eo,n)}var Kr=V({exp_:gq});function yq(e,t=0){let n=O(e,"x","expandDims","string_or_numeric");z(t<=n.rank,()=>"Axis must be <= rank of the tensor");let r={input:n},s={dim:t};return G.runKernel(Mc,r,s)}var $r=V({expandDims_:yq});function Aq(e){let n={x:O(e,"x","expm1")};return G.runKernel(ll,n)}var lI=V({expm1_:Aq});function xq(e,t){let n=O(e,"x","tile","string_or_numeric");z(n.rank===t.length,()=>`Error in transpose: rank of input ${n.rank} must match length of reps ${t}.`);let r={x:n},s={reps:t};return G.runKernel(Lo,r,s)}var Yo=V({tile_:xq});function bq(e,t,n,r="float32"){t==null&&(t=e);let s=Le([e,t],r),a=e<=t?e:t;for(let i=0;i`Error in localResponseNormalization: x must be rank 3 or 4 but got + rank ${a.rank}.`),z(mn(t),()=>`Error in localResponseNormalization: depthRadius must be an integer but got depthRadius ${t}.`);let o=a,i=!1;a.rank===3&&(i=!0,o=J(a,[1,a.shape[0],a.shape[1],a.shape[2]]));let l={x:o},u={depthRadius:t,bias:n,alpha:r,beta:s},c=G.runKernel(nf,l,u);return i?J(c,[c.shape[1],c.shape[2],c.shape[3]]):c}var dI=V({localResponseNormalization_:Mq});function Oq(e){let n={x:O(e,"x","log")};return G.runKernel(Ro,n)}var Rr=V({log_:Oq});function Pq(e){let n={x:O(e,"x","log1p")};return G.runKernel(Vc,n)}var VA=V({log1p_:Pq});function zq(e,t){z(Hp(e),()=>"The f passed in variableGrads(f) must be a function"),z(t==null||Array.isArray(t)&&t.every(u=>u instanceof gf),()=>"The varList passed in variableGrads(f, varList) must be an array of variables");let n=t!=null;if(!n){t=[];for(let u in G.registeredVariables)t.push(G.registeredVariables[u])}let r=n?t.filter(u=>!u.trainable):null,s=t.length;t=t.filter(u=>u.trainable),z(t.length>0,()=>`variableGrads() expects at least one of the input variables to be trainable, but none of the ${s} variables is trainable.`);let a=!0,{value:o,grads:i}=G.gradients(e,t,null,a);z(i.some(u=>u!=null),()=>"Cannot find a connection between any variable and the result of the loss function y=f(x). Please make sure the operations that use variables are inside the function f passed to minimize()."),z(o.rank===0,()=>`The f passed in variableGrads(f) must return a scalar, but it returned a rank-${o.rank} tensor`);let l={};return t.forEach((u,c)=>{i[c]!=null&&(l[u.name]=i[c])}),r!=null&&r.forEach(u=>l[u.name]=null),{value:o,grads:l}}function oa(e){return G.customGrad(e)}function Lq(e){let n={x:O(e,"x","neg")};return G.runKernel(Gc,n)}var Kt=V({neg_:Lq});function Bq(e){let n={x:O(e,"x","softplus")};return G.runKernel(od,n)}var Zl=V({softplus_:Bq});function Wq(e){let t=O(e,"x","logSigmoid");return oa(r=>({value:Kt(Zl(Kt(r))),gradFunc:o=>K(o,Rs(Kt(r)))}))(t)}var Vq=V({logSigmoid_:Wq});function Uq(e,t=null,n=!1){let s={x:O(e,"x","max")},a={reductionIndices:t,keepDims:n};return G.runKernel(gl,s,a)}var os=V({max_:Uq});function Hq(e,t){let n=O(e,"a","sub"),r=O(t,"b","sub");[n,r]=Ut(n,r);let s={a:n,b:r};return G.runKernel(zo,s)}var Ne=V({sub_:Hq});function Gq(e,t=null,n=!1){let r=O(e,"x","sum");r.dtype==="bool"&&(r=ke(r,"int32"));let s={x:r},a={axis:t,keepDims:n};return G.runKernel(Fl,s,a)}var _e=V({sum_:Gq});function jq(e,t=-1){let n=O(e,"logits","logSoftmax");if(t===-1&&(t=n.rank-1),t!==n.rank-1)throw Error(`Log Softmax along a non-last dimension is not yet supported. Logits was rank ${n.rank} and axis was ${t}`);return oa((s,a)=>{let o=!0,i=os(s,t,!0),l=Ne(s,i),u=Ne(ke(l,"float32"),Rr(_e(Kr(l),t,o)));return a([u]),{value:u,gradFunc:(d,h)=>{let[p]=h,f=!0,m=Kr(p);return Ne(d,K(_e(d,t,f),m))}}})(n)}var UA=V({logSoftmax_:jq});function HA(e,t){for(let n=0;ne[a]);return[n,s]}function ei(e,t){let n=t.map(r=>1);return hI(e,n,t)}function qq(e,t,n){z(HA(t,n),()=>`${e} supports only inner-most axes for now. Got axes ${t} and rank-${n} input.`)}function fI(e,t){if(HA(e,t))return null;let n=[];for(let r=0;rn.push(r)),n}function GA(e){return e.map((t,n)=>[n,t]).sort((t,n)=>t[1]-n[1]).map(t=>t[0])}function Kq(e,t){let n=[];for(let r=t-e;r`Error in maxPool: input must be rank 4 but got rank ${i.rank}.`),z(_s(n,o),()=>`Error in maxPool: Either strides or dilations must be 1. Got strides ${n} and dilations '${o}'`),s!=null&&z(mn(r),()=>`Error in maxPool: pad must be an integer when using, dimRoundingMode ${s} but got pad ${r}.`);let u={x:i},c={filterSize:t,strides:n,pad:r,dimRoundingMode:s},d=G.runKernel(yl,u,c);return l?J(d,[d.shape[1],d.shape[2],d.shape[3]]):d}var $f=V({maxPool_:tK});function nK(e,t=[1,1,1],n,r,s,a="NDHWC"){let o=O(e,"x","maxPool3d"),i=o,l=!1;o.rank===4&&(l=!0,i=J(o,[1,o.shape[0],o.shape[1],o.shape[2],o.shape[3]])),z(i.rank===5,()=>`Error in maxPool3d: x must be rank 5 but got rank ${i.rank}.`),z(a==="NDHWC",()=>`Error in maxPool3d: Only NDHWC is currently supported, but got dataFormat of ${a}`),s!=null&&z(mn(r),()=>`Error in maxPool3d: pad must be an integer when using, dimRoundingMode ${s} but got pad ${r}.`);let u={x:i},c={filterSize:t,strides:n,pad:r,dimRoundingMode:s,dataFormat:a},d=G.runKernel(rf,u,c);return l?J(d,[d.shape[1],d.shape[2],d.shape[3],d.shape[4]]):d}var gI=V({maxPool3d_:nK});function rK(e,t,n,r,s=!1){let o={x:O(e,"x","maxPoolWithArgmax")},i={filterSize:t,strides:n,pad:r,includeBatchInIndex:s},l=G.runKernel(Uy,o,i);return{result:l[0],indexes:l[1]}}var sK=V({maxPoolWithArgmax_:rK});function aK(e,t){let n=O(e,"a","maximum"),r=O(t,"b","maximum");[n,r]=Ut(n,r),n.dtype==="bool"&&(n=ke(n,"int32"),r=ke(r,"int32")),Rt(n.shape,r.shape);let s={a:n,b:r};return G.runKernel(Do,s)}var ia=V({maximum_:aK});function oK(e,t=null,n=!1){let s={x:O(e,"x","mean")},a={axis:t,keepDims:n};return G.runKernel(Al,s,a)}var Xt=V({mean_:oK});function un(e,t="float32"){if(t==="complex64"){let r=un(e,"float32"),s=un(e,"float32");return Uo(r,s)}let n=jp(on(e),t);return G.makeTensor(n,e,t)}function la(e,t="float32"){if(t==="complex64"){let r=la(e,"float32"),s=un(e,"float32");return Uo(r,s)}let n=gy(on(e),t);return G.makeTensor(n,e,t)}function iK(e,t=null,n=!1){let s={x:O(e,"x","min")},a={axis:t,keepDims:n};return G.runKernel(xl,s,a)}var _f=V({min_:iK});function lK(e,t){let n=O(e,"a","minimum"),r=O(t,"b","minimum");[n,r]=Ut(n,r),n.dtype==="bool"&&(n=ke(n,"int32"),r=ke(r,"int32")),Rt(n.shape,r.shape);let s={a:n,b:r};return G.runKernel(Fo,s)}var _d=V({minimum_:lK});function uK(e,t,n){z(n==="reflect"||n==="symmetric",()=>`Invalid mode. Mode must be either reflect or symmetric. Got ${n}.`);let r=O(e,"x","mirrorPad");if(r.rank===0)throw new Error("mirrorPad(scalar) is not defined. Pass non-scalar to mirrorPad");z(t.length===r.rank,()=>`Padding doesn't match input. Must be ${r.rank}. Got ${t.length}.`);let s=n==="reflect"?1:0;for(let i=0;i"Invalid number of paddings. Must be length of 2 each."),z(t[i][0]>=0&&t[i][0]<=r.shape[i]-s&&t[i][1]>=0&&t[i][1]<=r.shape[i]-s,()=>`Padding in dimension ${i} cannot be greater than or equal to ${r.shape[i]-s} or less than 0 for input of shape ${r.shape}`);let a={paddings:t,mode:n},o={x:r};return G.runKernel(bl,o,a)}var yI=V({mirrorPad_:uK});function cK(e,t){let n=O(e,"a","mod"),r=O(t,"b","mod");[n,r]=Ut(n,r);let s={a:n,b:r};return G.runKernel(Hc,s)}var AI=V({mod_:cK});function dK(e){let t=O(e,"x","square"),n={};return G.runKernel("Square",{x:t},n)}var wt=V({square_:dK});function hK(e,t=null,n=!1){e=O(e,"x","moments");let r=jr(t,e.shape),s=Xt(e,r,n),a=s.shape;n||(a=ei(s.shape,r));let o=wt(Ne(ke(e,"float32"),J(s,a))),i=Xt(o,r,n);return{mean:s,variance:i}}var qA=V({moments_:hK});function pK(e,t,n,r){let s=O(t,"data","multiRNNCell"),a=Af(n,"c","multiRNNCell"),o=Af(r,"h","multiRNNCell"),i=s,l=[];for(let d=0;d2)throw new Error(`Rank of probabilities must be 1 or 2, but is ${o}`);n=n||Math.random();let l={logits:o===1?J(s,[1,-1]):s},u={numSamples:t,seed:n,normalized:r},c=G.runKernel(Hy,l,u);return o===1?J(c,[c.size]):c}var mK=V({multinomial_:fK});function gK(e,t){let n=O(e,"a","notEqual","string_or_numeric"),r=O(t,"b","notEqual","string_or_numeric");[n,r]=Ut(n,r),Rt(n.shape,r.shape);let s={a:n,b:r};return G.runKernel(vl,s)}var Yl=V({notEqual_:gK});function yK(e){let n={x:O(e,"x","onesLike")};return G.runKernel(Xc,n)}var Dr=V({onesLike_:yK});function AK(e,t){let n=O(e,"v1","outerProduct"),r=O(t,"v2","outerProduct");z(n.rank===1&&r.rank===1,()=>`Error in outerProduct: inputs must be rank 1, but got ranks ${n.rank} and ${r.rank}.`);let s=J(n,[-1,1]),a=J(r,[1,-1]);return ot(s,a)}var xwe=V({outerProduct_:AK});function xK(e,t,n=0){let r=O(e,"x","pad");if(r.rank===0)throw new Error("pad(scalar) is not defined. Pass non-scalar to pad");let s={paddings:t,constantValue:n},a={x:r};return G.runKernel(kl,a,s)}var Wa=V({pad_:xK});function bK(e,t,n=0){return z(t.length===2,()=>"Invalid number of paddings. Must be length of 2."),Wa(e,[t],n)}var bwe=V({pad1d_:bK});function vK(e,t,n=0){return z(t.length===2&&t[0].length===2&&t[1].length===2,()=>"Invalid number of paddings. Must be length of 2 each."),Wa(e,t,n)}var vwe=V({pad2d_:vK});function wK(e,t,n=0){return z(t.length===3&&t[0].length===2&&t[1].length===2&&t[2].length===2,()=>"Invalid number of paddings. Must be length of 2 each."),Wa(e,t,n)}var wwe=V({pad3d_:wK});function kK(e,t,n=0){return z(t.length===4&&t[0].length===2&&t[1].length===2&&t[2].length===2&&t[3].length===2,()=>"Invalid number of paddings. Must be length of 2 each."),Wa(e,t,n)}var kwe=V({pad4d_:kK});function IK(e,t,n){let r=O(e,"x","spaceToBatchND");z(r.rank>=1+t.length,()=>`input rank ${r.rank} should be > than [blockShape] ${t.length}`),z(n.length===t.length,()=>`paddings.shape[0] ${n.length} must be equal to [blockShape] ${t.length}`),z(r.shape.reduce((o,i,l)=>l>0&&l<=t.length?o&&(i+n[l-1][0]+n[l-1][1])%t[l-1]==0:o,!0),()=>`input spatial dimensions ${r.shape.slice(1)} with paddings ${n.toString()} must be divisible by blockShapes ${t.toString()}`);let s={x:r},a={blockShape:t,paddings:n};return G.runKernel(of,s,a)}var Rf=V({spaceToBatchND_:IK});function SK(e,t,n,r,s,a){s==null&&(s=[1,1]),a==null&&(a=1),r===0&&(r="valid");let o=O(e,"x","maxPool"),i=o,l=!1;o.rank===3&&(l=!0,i=J(o,[1,o.shape[0],o.shape[1],o.shape[2]])),z(_s(a,s),()=>`Error in pool: Either strides or dilations must be 1. Got strides ${a} and dilations '${s}'`);let u=Z6(i.shape,t,a,s,r),c=[u.dilationHeight,u.dilationWidth],d;r==="same"?d=NK([u.filterHeight,u.filterWidth],c):d=[[0,0],[0,0]];let h=c[0]===1&&c[1]===1,[p,f]=TK([u.inHeight,u.inWidth],c,d),m=h?r:"valid",g=h?i:Rf(i,c,p),A=(n==="avg"?()=>Sf(g,t,a,m):()=>$f(g,t,a,m))(),x=h?A:Tf(A,c,f);return l?J(x,[x.shape[1],x.shape[2],x.shape[3]]):x}function TK(e,t,n){let r=n.map(c=>c[0]),s=n.map(c=>c[1]),a=e.concat(r,s),o=t.map((c,d)=>(c-a[d]%c)%c),i=s.map((c,d)=>c+o[d]),l=t.map((c,d)=>[r[d],i[d]]),u=t.map((c,d)=>[0,o[d]]);return[l,u]}function NK(e,t){let r=e.map((o,i)=>o+(o-1)*(t[i]-1)).map(o=>o-1),s=r.map(o=>Math.floor(o/2)),a=r.map((o,i)=>o-s[i]);return r.map((o,i)=>[s[i],a[i]])}var CK=V({pool_:SK});function EK(e,t){let n=O(e,"base","pow"),r=O(t,"exp","pow");[n,r]=Ut(n,r);let s={a:n,b:r};return G.runKernel(Il,s)}var Va=V({pow_:EK});function $K(e,t){let n=O(e,"x","prelu"),r=O(t,"alpha","prelu"),s={x:n,alpha:r};return G.runKernel(Sl,s)}var Df=V({prelu_:$K});function _K(e,t=null,n=!1){let r=O(e,"x","prod");r.dtype==="bool"&&(r=ke(r,"int32"));let s={x:r},a={axis:t,keepDims:n};return G.runKernel(Yc,s,a)}var KA=V({prod_:_K});function RK(e,t,n){let r=on(e),s=null;if(n==null||n==="float32")s=new Float32Array(r);else if(n==="int32")s=new Int32Array(r);else if(n==="bool")s=new Uint8Array(r);else throw new Error(`Unknown data type ${n}`);for(let a=0;a=1||a===0);let o=Math.sqrt(-2*Math.log(a)/a);e=this.mean+this.stdDev*r*o,t=this.mean+this.stdDev*s*o,(!this.truncated||this.isValidTruncated(e))&&(n=!0)}return(!this.truncated||this.isValidTruncated(t))&&(this.nextVal=this.convertValue(t)),this.convertValue(e)}convertValue(e){return this.dtype==null||this.dtype==="float32"?e:Math.round(e)}isValidTruncated(e){return e<=this.upper&&e>=this.lower}},DK=class{constructor(e,t,n,r){this.alpha=e,this.beta=1/t,this.dtype=n;let s=r||Math.random();this.randu=XA.alea(s.toString()),this.randn=new ZA(0,1,n,!1,this.randu()),e<1?this.d=e+2/3:this.d=e-1/3,this.c=1/Math.sqrt(9*this.d)}nextValue(){let e,t,n,r,s,a;for(;;){do r=this.randn.nextValue(),a=1+this.c*r;while(a<=0);if(a*=a*a,e=r*r,t=1-.331*e*e,n=.5*e+this.d*(1-a+Math.log(a)),s=this.randu(),sthis.dtype==null||this.dtype==="float32",this.min=e,this.range=t-e,this.dtype=n,r==null&&(r=Math.random()),typeof r=="number"&&(r=r.toString()),!this.canReturnFloat()&&this.range<=1)throw new Error(`The difference between ${e} - ${t} <= 1 and dtype is not float`);this.random=XA.alea(r)}convertValue(e){return this.canReturnFloat()?e:Math.round(e)}nextValue(){return this.convertValue(this.min+this.range*this.random())}};function MK(e,t,n=1,r="float32",s){if(n==null&&(n=1),r==null&&(r="float32"),r!=="float32"&&r!=="int32")throw new Error(`Unsupported data type ${r}`);let a=new DK(t,n,r,s),o=Le(e,r);for(let i=0;i`Error in reverse1D: x must be rank 1 but got rank ${t.rank}.`),Fr(t,0)}var Twe=V({reverse1d_:HK});function GK(e,t){let n=O(e,"x","reverse");return z(n.rank===2,()=>`Error in reverse2D: x must be rank 2 but got rank ${n.rank}.`),Fr(n,t)}var Nwe=V({reverse2d_:GK});function jK(e,t){let n=O(e,"x","reverse");return z(n.rank===3,()=>`Error in reverse3D: x must be rank 3 but got rank ${n.rank}.`),Fr(n,t)}var Cwe=V({reverse3d_:jK});function qK(e,t){let n=O(e,"x","reverse");return z(n.rank===4,()=>`Error in reverse4D: x must be rank 4 but got rank ${n.rank}.`),Fr(n,t)}var Ewe=V({reverse4d_:qK});function KK(e){let n={x:O(e,"x","round")};return G.runKernel($l,n)}var JA=V({round_:KK});function XK(e){let n={x:O(e,"x","rsqrt")};return G.runKernel(Oo,n)}var QA=V({rsqrt_:XK});function Fe(e,t){if((ss(e)&&t!=="string"||Array.isArray(e))&&t!=="complex64")throw new Error("Error creating a new Scalar: value must be a primitive (number|boolean|string)");if(t==="string"&&ss(e)&&!(e instanceof Uint8Array))throw new Error("When making a scalar from encoded string, the value must be `Uint8Array`.");return vd(e,[],[],t)}function ZK(e){let n={x:O(e,"x","selu")};return G.runKernel(nd,n)}var e1=V({selu_:ZK});function YK(e,t,n,r,s,a=[1,1],o="NHWC"){let i=O(e,"x","separableConv2d"),l=O(t,"depthwiseFilter","separableConv2d"),u=O(n,"pointwiseFilter","separableConv2d"),c=i,d=!1;if(i.rank===3&&(d=!0,c=J(i,[1,i.shape[0],i.shape[1],i.shape[2]])),o==="NCHW")throw new Error("separableConv2d currently does not support dataFormat NCHW; only NHWC is supported");z(c.rank===4,()=>`Error in separableConv2d: input must be rank 4, but got rank ${c.rank}.`),z(l.rank===4,()=>`Error in separableConv2d: depthwise filter must be rank 4, but got rank ${l.rank}.`),z(u.rank===4,()=>`Error in separableConv2d: pointwise filter must be rank 4, but got rank ${l.rank}.`),z(u.shape[0]===1,()=>`Error in separableConv2d: the first dimension of pointwise filter must be 1, but got ${u.shape[0]}.`),z(u.shape[1]===1,()=>`Error in separableConv2d: the second dimension of pointwise filter must be 1, but got ${u.shape[1]}.`);let h=l.shape[2],p=l.shape[3];z(u.shape[2]===h*p,()=>`Error in separableConv2d: the third dimension of pointwise filter must be ${h*p}, but got ${u.shape[2]}.`);let f=Td(c,l,r,s,o,a),g=Ba(f,u,1,"valid",o);return d?J(g,[g.shape[1],g.shape[2],g.shape[3]]):g}var bI=V({separableConv2d_:YK});async function JK(e,t){let n=O(e,"x","setdiff1d"),r=O(t,"y","setdiff1d");z(n.dtype===r.dtype,()=>`x and y should have the same dtype, but got x (${n.dtype}) and y (${r.dtype}).`),z(n.rank===1,()=>`x should be 1D tensor, but got x (${n.shape}).`),z(r.rank===1,()=>`y should be 1D tensor, but got y (${r.shape}).`);let s=await n.data(),a=await r.data(),o=new Set(a),i=0;for(let c=0;c`slice1d expects a rank-1 tensor, but got a rank-${r.rank} tensor`),nt(r,[t],[n])}var r1=V({slice1d_:rX});function sX(e,t,n){let r=O(e,"x","slice2d");return z(r.rank===2,()=>`slice2d expects a rank-2 tensor, but got a rank-${r.rank} tensor`),nt(r,t,n)}var wI=V({slice2d_:sX});function aX(e,t,n){let r=O(e,"x","slice3d");return z(r.rank===3,()=>`slice3d expects a rank-3 tensor, but got a rank-${r.rank} tensor`),nt(r,t,n)}var s1=V({slice3d_:aX});function oX(e,t,n){let r=O(e,"x","slice4d");return z(r.rank===4,()=>`slice4d expects a rank-4 tensor, but got a rank-${r.rank} tensor`),nt(r,t,n)}var Mf=V({slice4d_:oX});function iX(e,t=-1){let n=O(e,"logits","softmax","float32");if(t===-1&&(t=n.rank-1),t!==n.rank-1)throw Error(`Softmax along a non-last dimension is not yet supported. Logits was rank ${n.rank} and dim was ${t}`);let r={logits:n},s={dim:t};return G.runKernel(Ml,r,s)}var Of=V({softmax_:iX});function lX(e){z(e.dtype==="complex64",()=>`The dtype for tf.spectral.fft() must be complex64 but got ${e.dtype}.`);let t={input:e};return G.runKernel(Oy,t)}var a1=V({fft_:lX});function uX(e){z(e.dtype==="complex64",()=>`The dtype for tf.spectral.ifft() must be complex64 but got ${e.dtype}.`);let t={input:e};return G.runKernel(Py,t)}var Pf=V({ifft_:uX});function cX(e){let t=e.shape[e.shape.length-1],n=e.size/t,r;if(t<=2){let s=J(e,[n,t]);r=Pf(s)}else{let s=[n,2*(t-1)],a=J(Ff(e),[n,t]),o=J(BA(e),[n,t]),i=Fr(nt(a,[0,1],[n,t-2]),1),l=K(Fr(nt(o,[0,1],[n,t-2]),1),Fe(-1)),u=en([a,i],1),c=en([o,l],1),d=J(Uo(u,c),[s[0],s[1]]);r=Pf(d)}if(r=Ff(r),e.rank===3&&e.shape[0]!==0){let s=r,a=e.shape[0];r=J(r,[a,r.shape[0]/a,r.shape[1]]),s.dispose()}return r}var kI=V({irfft_:cX});function dX(e,t,n=0){let s={x:O(e,"x","split")},a={numOrSizeSplits:t,axis:n};return G.runKernel(id,s,a)}var dr=V({split_:dX});function hX(e,t){z(e.dtype==="float32",()=>`The dtype for rfft() must be real value but got ${e.dtype}`);let n=e.shape[e.shape.length-1],r=e.size/n,s;if(t!=null&&t0),m=e.shape.map(g=>g);m[e.shape.length-1]=t,s=nt(e,f,m),n=t}else if(t!=null&&t>n){let f=e.shape.map(m=>m);f[e.shape.length-1]=t-n,s=en([e,un(f)],e.shape.length-1),n=t}else s=e;let a=rt(s),o=J(Uo(s,a),[r,n]),i=a1(o),l=Math.floor(n/2)+1,u=Ff(i),c=BA(i),d=dr(u,[l,n-l],u.shape.length-1),h=dr(c,[l,n-l],c.shape.length-1),p=s.shape.slice();return p[s.shape.length-1]=l,J(Uo(d[0],h[0]),p)}var o1=V({rfft_:hX});function pX(e){let n={x:O(e,"x","sqrt")};return G.runKernel(Dl,n)}var $n=V({sqrt_:pX});function fX(e,t){let n=O(e,"a","squaredDifference"),r=O(t,"b","squaredDifference");[n,r]=Ut(n,r),Rt(n.shape,r.shape);let s={a:n,b:r},a={};return G.runKernel(Po,s,a)}var i1=V({squaredDifference_:fX});function mX(e,t){let n=O(e,"x","squeeze");return J(n,M4(n.shape,t).newShape)}var Jl=V({squeeze_:mX});function gX(e,t=0){let n=Af(e,"tensors","stack","string_or_numeric");z(n.length>=1,()=>"Pass at least one tensor to tf.stack"),n.length>0&&z(t<=n[0].rank,()=>"Axis must be <= rank of the tensor");let r=n,s={axis:t};return G.runKernel(Zc,r,s)}var Mr=V({stack_:gX});function yX(e,t=0){let r={x:O(e,"x","step")},s={alpha:t};return G.runKernel(Bo,r,s)}var Fd=V({step_:yX});function AX(e,t,n,r,s=0,a=0,o=0,i=0,l=0){let c={x:O(e,"x","stridedSlice","string_or_numeric")},d={begin:t,end:n,strides:r,beginMask:s,endMask:a,ellipsisMask:o,newAxisMask:i,shrinkAxisMask:l};return G.runKernel(ld,c,d)}var II=V({stridedSlice_:AX});function xX(e){let n={x:O(e,"x","tan")};return G.runKernel(Ol,n)}var SI=V({tan_:xX});function _n(e,t){Wp(e);let n=bd(e,t);if(n.length!==1)throw new Error("tensor1d() requires values to be a flat/TypedArray");return vd(e,null,n,t)}function Ql(e,t,n){if(Wp(e),t!=null&&t.length!==2)throw new Error("tensor2d() requires shape to have two numbers");let r=bd(e,n);if(r.length!==2&&r.length!==1)throw new Error("tensor2d() requires values to be number[][] or flat/TypedArray");if(r.length===1&&t==null)throw new Error("tensor2d() requires shape to be provided when `values` are a flat/TypedArray");return vd(e,t,r,n)}function bX(e,t=1,n=!0){let r=O(e,"x","topk");if(r.rank===0)throw new Error("topk() expects the input to be of rank 1 or higher");let s=r.shape[r.shape.length-1];if(t>s)throw new Error(`'k' passed to topk() must be <= the last dimension (${s}) but got ${t}`);let a={x:r},o={k:t,sorted:n},[i,l]=G.runKernel(ud,a,o);return{values:i,indices:l}}var TI=V({topk_:bX});function vX(e,t=0,n=1,r,s){if(r!=null&&r==="bool")throw new Error("Unsupported data type $ { dtype }");let a=new ZA(t,n,r,!0,s),o=Le(e,r);for(let i=0;i0,()=>"The input tensor must be at least 1D");let r={x:n},s={axis:t},[a,o]=G.runKernel(nA,r,s);return{values:a,indices:o}}var u1=V({unique_:wX});function kX(e,t,n){let r=O(e,"x","unsortedSegmentSum"),s=O(t,"segmentIds","unsortedSegmentSum","int32");z(mn(n),()=>"numSegments must be of dtype int");let a={x:r,segmentIds:s},o={numSegments:n};return G.runKernel(uf,a,o)}var NI=V({unsortedSegmentSum_:kX});function IX(e,t=0){let n=O(e,"x","unstack","string_or_numeric");z(t>=-n.shape.length&&t`Axis = ${t} is not in [-${n.shape.length}, ${n.shape.length})`);let r={value:n},s={axis:t};return G.runKernel(dd,r,s)}var ls=V({unstack_:IX});function SX(e,t=!0,n,r){return G.makeVariable(e,t,n,r)}function CI(e,t){let n=[];for(let a=0;a"Shape mismatch in v and x");let l=Fe(1),u=Ne(l,i),c=K(Ne(o,a),u);if(s){z(r!=null,()=>"When using zeroDebias: true, step is required.");let d=O(r,"step","movingAverage");c=Re(c,Ne(l,Va(i,d)))}return pe(a,c)}var $we=V({movingAverage_:EX});function $X(e,t,n){let r=O(e,"indices","scatterND","int32"),s=O(t,"updates","scatterND");CA(s,r,n);let a={indices:r,updates:s},o={shape:n};return G.runKernel(ed,a,o)}var _X=V({scatterND_:$X});function RX(e,t,n,r){if(e.dtype!=="int32")throw new Error(`tf.sparseToDense() expects the indices to be int32 type, but the dtype was ${e.dtype}.`);if(e.rank>2)throw new Error(`sparseIndices should be a scalar, vector, or matrix, but got shape ${e.shape}.`);let s=e.rank>0?e.shape[0]:1,a=e.rank>1?e.shape[1]:1;if(n.length!==a)throw new Error(`outputShape has incorrect number of elements:, ${n.length}, should be: ${a}.`);let o=t.size;if(!(t.rank===0||t.rank===1&&o===s))throw new Error(`sparseValues has incorrect shape ${t.shape}, should be [] or [${s}]`);if(t.dtype!==r.dtype)throw new Error("sparseValues.dtype must match defaultValues.dtype")}function DX(e,t,n,r=0){let s=O(e,"sparseIndices","sparseToDense","int32"),a=O(t,"sparseValues","sparseToDense"),o=O(r,"defaultValue","sparseToDense",a.dtype);RX(s,a,n,o);let i={sparseIndices:s,sparseValues:a,defaultValue:o},l={outputShape:n};return G.runKernel(Jy,i,l)}var $I=V({sparseToDense_:DX});function FX(e,t){let n=O(t,"indices","gatherND","int32"),s={params:O(e,"x","gatherND","string_or_numeric"),indices:n};return G.runKernel(zc,s)}var MX=V({gatherND_:FX});function OX(e,t){if(t==null)return e.shape.slice();if(Da(e.shape,t))return t;if(e.shape.length===t.length){let n=[];for(let r=0;r`x has to be a floating point tensor since it's going to be scaled, but got a ${s.dtype} tensor instead.`),z(t>=0&&t<1,()=>`rate must be a float in the range [0, 1), but got ${t}.`),t===0)return e instanceof Ct?s.clone():s;let a=OX(s,n),o=1-t,i=Re(Ed(pe(Rd(a,0,1,"float32",r),o)),o);return K(s,i)}var zX=V({dropout_:PX});function LX(e){return Math.floor(Math.pow(2,Math.ceil(Math.log(e)/Math.log(2))))}function _I(e,t,n){let r=1-e%2,s=new Float32Array(e);for(let a=0;aVX,depthwiseConv2d:()=>jX,matMul:()=>KX});function BX(e,t,n,r,s,a="NHWC",o){let i=e;e.rank===3&&(i=J(e,[1,e.shape[0],e.shape[1],e.shape[2]]));let l=t;l.rank===3&&(l=J(t,[1,t.shape[0],t.shape[1],t.shape[2]])),z(i.rank===4,()=>`Error in conv2dDerFilter: input must be rank 4, but got shape ${i.shape}.`),z(l.rank===4,()=>`Error in conv2dDerFilter: dy must be rank 4, but got shape ${l.shape}.`),z(n.length===4,()=>`Error in conv2dDerFilter: filterShape must be length 4, but got ${n}.`);let u=a==="NHWC"?i.shape[3]:i.shape[1],c=a==="NHWC"?l.shape[3]:l.shape[1];z(u===n[2],()=>`Error in conv2dDerFilter: depth of input ${u}) must match input depth in filter (${n[2]}.`),z(c===n[3],()=>`Error in conv2dDerFilter: depth of dy (${c}) must match output depth for filter (${n[3]}).`),o!=null&&z(mn(s),()=>`Error in conv2dDerFilter: pad must be an integer when using, dimRoundingMode ${o} but got pad ${s}.`);let d={x:i,dy:l},h={strides:r,pad:s,dataFormat:a,dimRoundingMode:o,filterShape:n};return G.runKernel(Sy,d,h)}var d1=V({conv2DBackpropFilter_:BX});function zf(e,t,n){if(n==null||n==="linear")return e;if(n==="relu")return K(e,Fd(t));throw new Error(`Cannot compute gradient for fused activation ${n}.`)}function Lf(e,t){let n=t,r=ln(e.shape,t.shape);return r.length>0&&(n=_e(n,r)),J(n,e.shape)}function Bf(e,t,n,r){if(t==="linear")return e;if(t==="relu")return ua(e);if(t==="elu")return Nd(e);if(t==="relu6")return YA(e);if(t==="prelu")return Df(e,n);if(t==="leakyrelu")return Cf(e,r);if(t==="sigmoid")return Rs(e);throw new Error(`Unknown fused activation ${t}.`)}var Wf=(e,t)=>!(e>0)||t==="linear";function WX({x:e,filter:t,strides:n,pad:r,dataFormat:s="NHWC",dilations:a=[1,1],dimRoundingMode:o,bias:i,activation:l="linear",preluActivationWeights:u,leakyreluAlpha:c}){if(l=l||"linear",Wf(G.state.gradientDepth,l)===!1){let v=Ba(e,t,n,r,s,a,o);return i!=null&&(v=pe(v,i)),Bf(v,l,u,c)}let d=O(e,"x","conv2d"),h=O(t,"filter","conv2d"),p=d,f=!1;d.rank===3&&(f=!0,p=J(d,[1,d.shape[0],d.shape[1],d.shape[2]])),z(p.rank===4,()=>`Error in fused conv2d: input must be rank 4, but got rank ${p.rank}.`),z(h.rank===4,()=>`Error in fused conv2d: filter must be rank 4, but got rank ${h.rank}.`),o!=null&&z(mn(r),()=>`Error in fused conv2d: pad must be an integer when using, dimRoundingMode ${o} but got pad ${r}.`),z(p.shape[3]===h.shape[2],()=>`Error in conv2d: depth of input (${p.shape[3]}) must match input depth for filter ${h.shape[2]}.`),z(_s(n,a),()=>`Error in conv2D: Either strides or dilations must be 1. Got strides ${n} and dilations '${a}'`),z(s==="NHWC",()=>`Error in conv2d: got dataFormat of ${s} but only NHWC is currently supported.`);let m=Id(p.shape,h.shape,n,a,r,o),g;i!=null&&(g=O(i,"bias","fused conv2d"),[g]=Ut(g,d),Rt(m.outShape,g.shape));let y;u!=null&&(y=O(u,"prelu weights","fused conv2d"));let A=(v,w)=>{let[I,T,C,M]=w,$=zf(v,C,l);z(La(a),()=>`Error in gradient of fused conv2D: dilation rates greater than 1 are not yet supported in gradients. Got dilations '${a}'`);let R=OA(T.shape,$,I,n,r),N=d1(T,$,I.shape,n,r),F=[R,N];if(M!=null){let B=Lf(M,$);F.push(B)}return F},x={x:p,filter:h,bias:g,preluActivationWeights:y},b={strides:n,pad:r,dataFormat:s,dilations:a,dimRoundingMode:o,activation:l,leakyreluAlpha:c};return i==null?oa((w,I,T)=>{let C=G.runKernel(Bl,x,b);return T([I,w,C]),f&&(C=J(C,[C.shape[1],C.shape[2],C.shape[3]])),{value:C,gradFunc:A}})(p,h):oa((w,I,T,C)=>{let M=G.runKernel(Bl,x,b);return C([I,w,M,T]),f&&(M=J(M,[M.shape[1],M.shape[2],M.shape[3]])),{value:M,gradFunc:A}})(p,h,g)}var VX=V({fusedConv2d_:WX});function UX(e,t,n,r,s,a=[1,1],o){let i=e;e.rank===3&&(i=J(e,[1,e.shape[0],e.shape[1],e.shape[2]]));let l=t;l.rank===3&&(l=J(t,[1,t.shape[0],t.shape[1],t.shape[2]]));let u={x:i,dy:l},c={strides:r,pad:s,dimRoundingMode:o,dilations:a,filterShape:n};return G.runKernel(Ey,u,c)}var RI=V({depthwiseConv2dNativeBackpropFilter_:UX});function HX(e,t,n,r,s,a=[1,1],o){let i=t,l=!1;t.rank===3&&(l=!0,i=J(t,[1,t.shape[0],t.shape[1],t.shape[2]]));let u={dy:i,filter:n},c={strides:r,pad:s,dimRoundingMode:o,dilations:a,inputShape:e},d=G.runKernel($y,u,c);return l?J(d,[d.shape[1],d.shape[2],d.shape[3]]):d}var DI=V({depthwiseConv2dNativeBackpropInput_:HX});function GX({x:e,filter:t,strides:n,pad:r,dataFormat:s="NHWC",dilations:a=[1,1],dimRoundingMode:o,bias:i,activation:l="linear",preluActivationWeights:u,leakyreluAlpha:c}){if(Wf(G.state.gradientDepth,l)===!1){let v=Td(e,t,n,r,s,a,o);return i!=null&&(v=pe(v,i)),Bf(v,l,u,c)}let d=O(e,"x","depthwiseConv2d"),h=O(t,"filter","depthwiseConv2d"),p=d,f=!1;d.rank===3&&(f=!0,p=J(d,[1,d.shape[0],d.shape[1],d.shape[2]])),z(p.rank===4,()=>`Error in fused depthwiseConv2d: input must be rank 4, but got rank ${p.rank}.`),z(h.rank===4,()=>`Error in fused depthwiseConv2d: filter must be rank 4, but got rank ${h.rank}.`),z(p.shape[3]===h.shape[2],()=>`Error in fused depthwiseConv2d: number of input channels (${p.shape[3]}) must match the inChannels dimension in filter ${h.shape[2]}.`),a==null&&(a=[1,1]),z(_s(n,a),()=>`Error in fused depthwiseConv2d: Either strides or dilations must be 1. Got strides ${n} and dilations '${a}'`),o!=null&&z(mn(r),()=>`Error in fused depthwiseConv2d: pad must be an integer when using dimRoundingMode ${o} but got pad ${r}.`);let m=Id(p.shape,h.shape,n,a,r,o,!0),g;i!=null&&(g=O(i,"bias","fused conv2d"),[g]=Ut(g,d),Rt(m.outShape,g.shape));let y;u!=null&&(y=O(u,"prelu weights","fused depthwiseConv2d"));let A=(v,w)=>{z(La(a),()=>`Error in gradient of fused depthwiseConv2d: dilation rates greater than 1 are not yet supported. Got dilations '${a}'`);let[I,T,C,M]=w,$=zf(v,C,l),R=DI(T.shape,$,I,n,r,a,o),N=RI(T,$,I.shape,n,r,a,o);if(M!=null){let F=Lf(g,$);return[R,N,F]}return[R,N]},x={x:p,filter:h,bias:g,preluActivationWeights:y},b={strides:n,pad:r,dataFormat:s,dilations:a,dimRoundingMode:o,activation:l,leakyreluAlpha:c};return i==null?oa((w,I,T)=>{let C=G.runKernel(Wl,x,b);return T([I,w,C]),f&&(C=J(C,[C.shape[1],C.shape[2],C.shape[3]])),{value:C,gradFunc:A}})(p,h):oa((w,I,T,C)=>{let M=G.runKernel(Wl,x,b);return C([I,w,M,T]),f&&(M=J(M,[M.shape[1],M.shape[2],M.shape[3]])),{value:M,gradFunc:A}})(p,h,g)}var jX=V({fusedDepthwiseConv2d_:GX});function qX({a:e,b:t,transposeA:n=!1,transposeB:r=!1,bias:s,activation:a="linear",preluActivationWeights:o,leakyreluAlpha:i}){if(Wf(G.state.gradientDepth,a)===!1){let M=ot(e,t,n,r);return s!=null&&(M=pe(M,s)),Bf(M,a,o,i)}let l=O(e,"a","fused matMul"),u=O(t,"b","fused matMul");[l,u]=Ut(l,u);let c=n?l.shape[l.rank-2]:l.shape[l.rank-1],d=r?u.shape[u.rank-1]:u.shape[u.rank-2],h=n?l.shape[l.rank-1]:l.shape[l.rank-2],p=r?u.shape[u.rank-2]:u.shape[u.rank-1],f=l.shape.slice(0,-2),m=u.shape.slice(0,-2),g=on(f),y=on(m);z(l.rank>=2&&u.rank>=2&&l.rank===u.rank,()=>`Error in fused matMul: inputs must have the same rank of at least 2, got ranks ${l.rank} and ${u.rank}.`),z(Da(f,m),()=>`Error in fused matMul: outer dimensions (${f}) and (${m}) of Tensors with shapes ${l.shape} and ${u.shape} must match.`),z(c===d,()=>`Error in fused matMul: inner shapes (${c}) and (${d}) of Tensors with shapes ${l.shape} and ${u.shape} and transposeA=${n} and transposeB=${r} must match.`);let A=l.shape.slice(0,-2).concat([h,p]),x=n?J(l,[g,c,h]):J(l,[g,h,c]),b=r?J(u,[y,p,d]):J(u,[y,d,p]),v;s!=null&&(v=O(s,"bias","fused matMul"),[v]=Ut(v,l),Rt(A,v.shape));let w;o!=null&&(w=O(o,"prelu weights","fused matMul"));let I=(M,$)=>{let[R,N,F,B]=$,j=zf(J(M,F.shape),F,a),X,Y;if(!n&&!r?(X=ot(j,N,!1,!0),Y=ot(R,j,!0,!1)):!n&&r?(X=ot(j,N,!1,!1),Y=ot(j,R,!0,!1)):n&&!r?(X=ot(N,j,!1,!0),Y=ot(R,j,!1,!1)):(X=ot(N,j,!0,!0),Y=ot(j,R,!0,!0)),s!=null){let ee=Lf(B,j);return[X,Y,ee]}else return[X,Y]},T={a:x,b,bias:v,preluActivationWeights:w},C={transposeA:n,transposeB:r,activation:a,leakyreluAlpha:i};return s==null?oa(($,R,N)=>{let F=G.runKernel(Ll,T,C);return N([$,R,F]),{value:J(F,A),gradFunc:I}})(x,b):oa(($,R,N,F)=>{let B=G.runKernel(Ll,T,C);return F([$,R,B,N]),{value:J(B,A),gradFunc:I}})(x,b,v)}var KX=V({fusedMatMul_:qX});function XX(e){return _I(e,.54,.46)}var _we=V({hammingWindow_:XX});function ZX(e){return _I(e,.5,.5)}var YX=V({hannWindow_:ZX});function JX(e,t,n,r=!1,s=0){let a=0,o=[];for(;a+t<=e.size;)o.push(nt(e,a,t)),a+=n;if(r)for(;a`Error in cropAndResize: image must be rank 4,but got rank ${o.rank}.`),z(i.rank===2&&i.shape[1]===4,()=>`Error in cropAndResize: boxes must be have size [${u},4] but had shape ${i.shape}.`),z(l.rank===1&&l.shape[0]===u,()=>`Error in cropAndResize: boxInd must be have size [${u}] but had shape ${i.shape}.`),z(r.length===2,()=>`Error in cropAndResize: cropSize must be of length 2, but got length ${r.length}.`),z(r[0]>=1&&r[1]>=1,()=>`cropSize must be atleast [1,1], but was ${r}`),z(s==="bilinear"||s==="nearest",()=>`method must be bilinear or nearest, but was ${s}`);let c={image:o,boxes:i,boxInd:l},d={method:s,extrapolationValue:a,cropSize:r};return G.runKernel(_c,c,d)}var nZ=V({cropAndResize_:tZ});function rZ(e){let t=O(e,"image","flipLeftRight","float32");z(t.rank===4,()=>`Error in flipLeftRight: image must be rank 4,but got rank ${t.rank}.`);let n={image:t};return G.runKernel(Oc,n,{})}var sZ=V({flipLeftRight_:rZ});function aZ(e,t,n=0,r=.5){let s=O(e,"image","rotateWithOffset","float32");z(s.rank===4,()=>`Error in rotateWithOffset: image must be rank 4,but got rank ${s.rank}.`);let a={image:s},o={radians:t,fillValue:n,center:r};return G.runKernel(pd,a,o)}var oZ=V({rotateWithOffset_:aZ});function eu(e,t,n,r,s,a){r==null&&(r=.5),s==null&&(s=Number.NEGATIVE_INFINITY),a==null&&(a=0);let o=e.shape[0];return n=Math.min(n,o),z(0<=r&&r<=1,()=>`iouThreshold must be in [0, 1], but was '${r}'`),z(e.rank===2,()=>`boxes must be a 2D tensor, but was of rank '${e.rank}'`),z(e.shape[1]===4,()=>`boxes must have 4 columns, but 2nd dimension was ${e.shape[1]}`),z(t.rank===1,()=>"scores must be a 1D tensor"),z(t.shape[0]===o,()=>`scores has incompatible shape with boxes. Expected ${o}, but was ${t.shape[0]}`),z(0<=a&&a<=1,()=>`softNmsSigma must be in [0, 1], but was '${a}'`),{maxOutputSize:n,iouThreshold:r,scoreThreshold:s,softNmsSigma:a}}function iZ(e,t,n,r=.5,s=Number.NEGATIVE_INFINITY){let a=O(e,"boxes","nonMaxSuppression"),o=O(t,"scores","nonMaxSuppression"),i=eu(a,o,n,r,s);n=i.maxOutputSize,r=i.iouThreshold,s=i.scoreThreshold;let l={maxOutputSize:n,iouThreshold:r,scoreThreshold:s};return G.runKernel(jc,{boxes:a,scores:o},l)}var lZ=V({nonMaxSuppression_:iZ});function uZ(e,t,n){let r=cZ(e,t,n),s=r<0?-(r+1):r;e.splice(s,0,t)}function cZ(e,t,n){return hZ(e,t,n||dZ)}function dZ(e,t){return e>t?1:e>>1);let i=n(t,e[a]);i>0?r=a+1:(s=a,o=!i)}return o?r:-r-1}function FI(e,t,n,r,s){return h1(e,t,n,r,s,0)}function MI(e,t,n,r,s,a){return h1(e,t,n,r,s,0,!1,a,!0)}function OI(e,t,n,r,s,a){return h1(e,t,n,r,s,a,!0)}function h1(e,t,n,r,s,a,o=!1,i=!1,l=!1){let u=[];for(let g=0;gs&&u.push({score:t[g],boxIndex:g,suppressBeginIndex:0});u.sort(PI);let c=a>0?-.5/a:0,d=[],h=[];for(;d.length0;){let g=u.pop(),{score:y,boxIndex:A,suppressBeginIndex:x}=g;if(y=x;--v){let w=pZ(e,A,d[v]);if(w>=r){b=!0;break}if(g.score=g.score*fZ(r,c,w),g.score<=s)break}g.suppressBeginIndex=d.length,b||(g.score===y?(d.push(A),h.push(g.score)):g.score>s&&uZ(u,g,PI))}let p=d.length,f=n-p;i&&f>0&&(d.push(...new Array(f).fill(0)),h.push(...new Array(f).fill(0)));let m={selectedIndices:d};return o&&(m.selectedScores=h),l&&(m.validOutputs=p),m}function pZ(e,t,n){let r=e.subarray(t*4,t*4+4),s=e.subarray(n*4,n*4+4),a=Math.min(r[0],r[2]),o=Math.min(r[1],r[3]),i=Math.max(r[0],r[2]),l=Math.max(r[1],r[3]),u=Math.min(s[0],s[2]),c=Math.min(s[1],s[3]),d=Math.max(s[0],s[2]),h=Math.max(s[1],s[3]),p=(i-a)*(l-o),f=(d-u)*(h-c);if(p<=0||f<=0)return 0;let m=Math.max(a,u),g=Math.max(o,c),y=Math.min(i,d),A=Math.min(l,h),x=Math.max(y-m,0)*Math.max(A-g,0);return x/(p+f-x)}function fZ(e,t,n){let r=Math.exp(t*n*n);return n<=e?r:0}function PI(e,t){return e.score-t.score||e.score===t.score&&t.boxIndex-e.boxIndex}async function mZ(e,t,n,r=.5,s=Number.NEGATIVE_INFINITY){let a=O(e,"boxes","nonMaxSuppressionAsync"),o=O(t,"scores","nonMaxSuppressionAsync"),i=eu(a,o,n,r,s);n=i.maxOutputSize,r=i.iouThreshold,s=i.scoreThreshold;let l=await Promise.all([a.data(),o.data()]),u=l[0],c=l[1],{selectedIndices:d}=FI(u,c,n,r,s);return a!==e&&a.dispose(),o!==t&&o.dispose(),_n(d,"int32")}var gZ=mZ;function yZ(e,t,n,r=.5,s=Number.NEGATIVE_INFINITY,a=0){let o=O(e,"boxes","nonMaxSuppression"),i=O(t,"scores","nonMaxSuppression"),l=eu(o,i,n,r,s,a);n=l.maxOutputSize,r=l.iouThreshold,s=l.scoreThreshold,a=l.softNmsSigma;let u={boxes:o,scores:i},c={maxOutputSize:n,iouThreshold:r,scoreThreshold:s,softNmsSigma:a},d=G.runKernel(Kc,u,c);return{selectedIndices:d[0],selectedScores:d[1]}}var AZ=V({nonMaxSuppressionWithScore_:yZ});async function xZ(e,t,n,r=.5,s=Number.NEGATIVE_INFINITY,a=0){let o=O(e,"boxes","nonMaxSuppressionAsync"),i=O(t,"scores","nonMaxSuppressionAsync"),l=eu(o,i,n,r,s,a);n=l.maxOutputSize,r=l.iouThreshold,s=l.scoreThreshold,a=l.softNmsSigma;let u=await Promise.all([o.data(),i.data()]),c=u[0],d=u[1],{selectedIndices:h,selectedScores:p}=OI(c,d,n,r,s,a);return o!==e&&o.dispose(),i!==t&&i.dispose(),{selectedIndices:_n(h,"int32"),selectedScores:_n(p)}}var bZ=xZ;function vZ(e,t,n,r=.5,s=Number.NEGATIVE_INFINITY,a=!1){let o=O(e,"boxes","nonMaxSuppression"),i=O(t,"scores","nonMaxSuppression"),l=eu(o,i,n,r,s,null),u=l.maxOutputSize,c=l.iouThreshold,d=l.scoreThreshold,h={boxes:o,scores:i},p={maxOutputSize:u,iouThreshold:c,scoreThreshold:d,padToMaxOutputSize:a},f=G.runKernel(qc,h,p);return{selectedIndices:f[0],validOutputs:f[1]}}var wZ=V({nonMaxSuppressionPadded_:vZ});async function kZ(e,t,n,r=.5,s=Number.NEGATIVE_INFINITY,a=!1){let o=O(e,"boxes","nonMaxSuppressionAsync"),i=O(t,"scores","nonMaxSuppressionAsync"),l=eu(o,i,n,r,s,null),u=l.maxOutputSize,c=l.iouThreshold,d=l.scoreThreshold,[h,p]=await Promise.all([o.data(),i.data()]),{selectedIndices:f,validOutputs:m}=MI(h,p,u,c,d,a);return o!==e&&o.dispose(),i!==t&&i.dispose(),{selectedIndices:_n(f,"int32"),validOutputs:Fe(m,"int32")}}var IZ=kZ;function SZ(e,t,n=!1,r=!1){let s=O(e,"images","resizeBilinear");z(s.rank===3||s.rank===4,()=>`Error in resizeBilinear: x must be rank 3 or 4, but got rank ${s.rank}.`),z(t.length===2,()=>`Error in resizeBilinear: new shape must 2D, but got shape ${t}.`),z(r===!1||n===!1,()=>"Error in resizeBilinear: If halfPixelCenters is true, alignCorners must be false.");let a=s,o=!1;s.rank===3&&(o=!0,a=J(s,[1,s.shape[0],s.shape[1],s.shape[2]]));let[]=t,i={images:a},l={alignCorners:n,halfPixelCenters:r,size:t},u=G.runKernel(Nl,i,l);return o?J(u,[u.shape[1],u.shape[2],u.shape[3]]):u}var zI=V({resizeBilinear_:SZ});function TZ(e,t,n=!1,r=!1){let s=O(e,"images","resizeNearestNeighbor");z(s.rank===3||s.rank===4,()=>`Error in resizeNearestNeighbor: x must be rank 3 or 4, but got rank ${s.rank}.`),z(t.length===2,()=>`Error in resizeNearestNeighbor: new shape must 2D, but got shape ${t}.`),z(s.dtype==="float32"||s.dtype==="int32",()=>"`images` must have `int32` or `float32` as dtype"),z(r===!1||n===!1,()=>"Error in resizeNearestNeighbor: If halfPixelCenters is true, alignCorners must be false.");let a=s,o=!1;s.rank===3&&(o=!0,a=J(s,[1,s.shape[0],s.shape[1],s.shape[2]]));let[]=t,i={images:a},l={alignCorners:n,halfPixelCenters:r,size:t},u=G.runKernel(af,i,l);return o?J(u,[u.shape[1],u.shape[2],u.shape[3]]):u}var LI=V({resizeNearestNeighbor_:TZ});function NZ(e,t="binary",n=!1,r=.5){let s=O(e,"image","threshold"),a=.2989,o=.587,i=.114,l=s.shape[0]*s.shape[1],u=K(_n([r]),255),c,d,h,p;if(z(s.rank===3,()=>`Error in threshold: image must be rank 3,but got rank ${s.rank}.`),z(s.shape[2]===3||s.shape[2]===1,()=>`Error in threshold: image color channel must be equal to 3 or 1but got ${s.shape[2]}.`),z(s.dtype==="int32"||s.dtype==="float32",()=>`Error in dtype: image dtype must be int32 or float32,but got dtype ${s.dtype}.`),z(t==="otsu"||t==="binary",()=>`Method must be binary or otsu, but was ${t}`),s.shape[2]===3){[c,d,h]=dr(s,[1,1,1],-1);let g=K(c,a),y=K(d,o),A=K(h,i);p=pe(pe(g,y),A)}else p=e;if(t==="otsu"){let g=eI(ke(JA(p),"int32"),$s([]),256);u=CZ(g,l)}let f=n?Qo(p,u):_r(p,u);return ke(K(f,255),"int32")}function CZ(e,t){let n=_n([-1]),r=_n([0]),s=_n([0]),a,o,i,l,u,c;for(let d=0;d`Error in transform: image must be rank 4,but got rank ${o.rank}.`),z(i.rank===2&&(i.shape[0]===o.shape[0]||i.shape[0]===1)&&i.shape[1]===8,()=>"Error in transform: Input transform should be batch x 8 or 1 x 8"),z(a==null||a.length===2,()=>`Error in transform: outputShape must be [height, width] or null, but got ${a}.`);let l={image:o,transforms:i},u={interpolation:n,fillMode:r,fillValue:s,outputShape:a};return G.runKernel(cd,l,u)}var _Z=V({transform_:$Z});function RZ(e,t,n){z(t%1==0,()=>`bandPart(): numLower must be an integer, got ${t}.`),z(n%1==0,()=>`bandPart(): numUpper must be an integer, got ${n}.`);let r=O(e,"a","bandPart");z(r.rank>=2,()=>`bandPart(): Rank must be at least 2, got ${r.rank}.`);let s=r.shape,[a,o]=r.shape.slice(-2);if(!(t<=a))throw new Error(`bandPart(): numLower (${t}) must not be greater than the number of rows (${a}).`);if(!(n<=o))throw new Error(`bandPart(): numUpper (${n}) must not be greater than the number of columns (${o}).`);t<0&&(t=a),n<0&&(n=o);let i=J(Dd(0,a,1,"int32"),[-1,1]),l=Dd(0,o,1,"int32"),u=Ne(i,l),c=is(Qo(u,Fe(+t,"int32")),Jo(u,Fe(-n,"int32"))),d=un([a,o],r.dtype);return J(Mr(ls(J(r,[-1,a,o])).map(h=>Ln(c,h,d))),s)}var DZ=V({bandPart_:RZ});function FZ(e){let t;if(Array.isArray(e)){t=!1,z(e!=null&&e.length>0,()=>"Gram-Schmidt process: input must not be null, undefined, or empty");let s=e[0].shape[0];for(let a=1;a`Gram-Schmidt: Non-unique lengths found in the input vectors: (${e[a].shape[0]} vs. ${s})`)}else t=!0,e=dr(e,e.shape[0],0).map(s=>Jl(s,[0]));z(e.length<=e[0].shape[0],()=>`Gram-Schmidt: Number of vectors (${e.length}) exceeds number of dimensions (${e[0].shape[0]}).`);let n=[],r=e;for(let s=0;s{let a=r[s];if(s>0)for(let o=0;o=2,()=>`qr() requires input tensor to have a rank >= 2, but got rank ${e.rank}`),e.rank===2)return BI(e,t);{let n=e.shape.slice(0,e.shape.length-2).reduce((l,u)=>l*u),r=ls(J(e,[n,e.shape[e.shape.length-2],e.shape[e.shape.length-1]]),0),s=[],a=[];r.forEach(l=>{let[u,c]=BI(l,t);s.push(u),a.push(c)});let o=J(Mr(s,0),e.shape),i=J(Mr(a,0),e.shape);return[o,i]}}function BI(e,t=!1){return G.tidy(()=>{z(e.shape.length===2,()=>`qr2d() requires a 2D Tensor, but got a ${e.shape.length}D Tensor.`);let n=e.shape[0],r=e.shape[1],s=uI(n),a=qo(e),o=Ql([[1]],[1,1]),i=qo(o),l=n>=r?r:n;for(let u=0;u{let p=nt(a,[u,u],[n-u,1]),f=c1(p),m=nt(a,[u,u],[1,1]),g=Ln(_r(m,0),Ql([[-1]]),Ql([[1]])),y=Ne(m,K(g,f)),A=Re(p,y);A.shape[0]===1?i=qo(o):i=en([o,nt(A,[1,0],[A.shape[0]-1,A.shape[1]])],0);let x=Kt(Re(ot(g,y),f)),b=nt(a,[u,0],[n-u,r]),v=K(x,i),w=pt(i);if(u===0)a=Ne(b,ot(v,ot(w,b)));else{let C=Ne(b,ot(v,ot(w,b)));a=en([nt(a,[0,0],[u,r]),C],0)}let I=pt(v),T=nt(s,[0,u],[n,s.shape[1]-u]);if(u===0)s=Ne(T,ot(ot(T,i),I));else{let C=Ne(T,ot(ot(T,i),I));s=en([nt(s,[0,0],[n,u]),C],1)}return[i,a,s]}),je([c,d,h])}return!t&&n>r&&(s=nt(s,[0,0],[n,r]),a=nt(a,[0,0],[r,r])),[s,a]})}var PZ=V({qr_:OZ}),Yn;(function(e){e[e.NONE=0]="NONE",e[e.MEAN=1]="MEAN",e[e.SUM=2]="SUM",e[e.SUM_BY_NONZERO_WEIGHTS=3]="SUM_BY_NONZERO_WEIGHTS"})(Yn||(Yn={}));function zZ(e,t,n=Yn.SUM_BY_NONZERO_WEIGHTS){let r=O(e,"losses","computeWeightedLoss"),s=null;t!=null&&(s=O(t,"weights","computeWeightedLoss"));let a=s==null?r:K(r,s);if(n===Yn.NONE)return a;if(n===Yn.SUM)return _e(a);if(n===Yn.MEAN){if(s==null)return Xt(a);{let o=r.size/s.size,i=Re(_e(a),_e(s));return o>1?Re(i,Fe(o)):i}}if(n===Yn.SUM_BY_NONZERO_WEIGHTS){if(s==null)return Re(_e(a),Fe(r.size));{let o=K(s,la(r.shape)),i=ke(_e(Yl(o,Fe(0))),"float32");return Re(_e(a),i)}}throw Error(`Unknown reduction: ${n}`)}var Ua=V({computeWeightedLoss_:zZ});function LZ(e,t,n,r=Yn.SUM_BY_NONZERO_WEIGHTS){let s=O(e,"labels","absoluteDifference"),a=O(t,"predictions","absoluteDifference"),o=null;n!=null&&(o=O(n,"weights","absoluteDifference")),rs(s.shape,a.shape,"Error in absoluteDifference: ");let i=yn(Ne(s,a));return Ua(i,o,r)}var Dwe=V({absoluteDifference_:LZ});function BZ(e,t,n,r,s=Yn.SUM_BY_NONZERO_WEIGHTS){let a=O(e,"labels","cosineDistance"),o=O(t,"predictions","cosineDistance"),i=null;r!=null&&(i=O(r,"weights","cosineDistance")),rs(a.shape,o.shape,"Error in cosineDistance: ");let l=Fe(1),u=Ne(l,_e(K(a,o),n,!0));return Ua(u,i,s)}var Fwe=V({cosineDistance_:BZ});function WZ(e,t,n,r=Yn.SUM_BY_NONZERO_WEIGHTS){let s=O(e,"labels","hingeLoss"),a=O(t,"predictions","hingeLoss"),o=null;n!=null&&(o=O(n,"weights","hingeLoss")),rs(s.shape,a.shape,"Error in hingeLoss: ");let i=Fe(1);s=Ne(K(Fe(2),s),i);let l=ua(Ne(i,K(s,a)));return Ua(l,o,r)}var Mwe=V({hingeLoss_:WZ});function VZ(e,t,n,r=1,s=Yn.SUM_BY_NONZERO_WEIGHTS){let a=O(e,"labels","huberLoss"),o=O(t,"predictions","huberLoss"),i=null;n!=null&&(i=O(n,"weights","huberLoss")),rs(a.shape,o.shape,"Error in huberLoss: ");let l=Fe(r),u=yn(Ne(o,a)),c=_d(u,l),d=Ne(u,c),h=pe(K(Fe(.5),wt(c)),K(l,d));return Ua(h,i,s)}var Owe=V({huberLoss_:VZ});function UZ(e,t,n,r=1e-7,s=Yn.SUM_BY_NONZERO_WEIGHTS){let a=O(e,"labels","logLoss"),o=O(t,"predictions","logLoss"),i=null;n!=null&&(i=O(n,"weights","logLoss")),rs(a.shape,o.shape,"Error in logLoss: ");let l=Fe(1),u=Fe(r),c=Kt(K(a,Rr(pe(o,u)))),d=K(Ne(l,a),Rr(pe(Ne(l,o),u))),h=Ne(c,d);return Ua(h,i,s)}var Pwe=V({logLoss_:UZ});function HZ(e,t,n,r=Yn.SUM_BY_NONZERO_WEIGHTS){let s=O(e,"labels","meanSquaredError"),a=O(t,"predictions","meanSquaredError"),o=null;n!=null&&(o=O(n,"weights","meanSquaredError")),rs(s.shape,a.shape,"Error in meanSquaredError: ");let i=i1(s,a);return Ua(i,o,r)}var zwe=V({meanSquaredError_:HZ});function GZ(e,t){let n=O(e,"labels","sigmoidCrossEntropyWithLogits"),r=O(t,"logits","sigmoidCrossEntropyWithLogits");rs(n.shape,r.shape,"Error in sigmoidCrossEntropyWithLogits: ");let s=ua(r),a=K(r,n),o=VA(Kr(Kt(yn(r))));return pe(Ne(s,a),o)}function jZ(e,t,n,r=0,s=Yn.SUM_BY_NONZERO_WEIGHTS){let a=O(e,"multiClassLabels","sigmoidCrossEntropy"),o=O(t,"logits","sigmoidCrossEntropy"),i=null;if(n!=null&&(i=O(n,"weights","sigmoidCrossEntropy")),rs(a.shape,o.shape,"Error in sigmoidCrossEntropy: "),r>0){let u=Fe(r),c=Fe(1),d=Fe(.5);a=pe(K(a,Ne(c,u)),K(d,u))}let l=GZ(a,o);return Ua(l,i,s)}var Lwe=V({sigmoidCrossEntropy_:jZ});function qZ(e,t,n=-1){if(n===-1&&(n=t.rank-1),n!==t.rank-1)throw Error(`Softmax cross entropy along a non-last dimension is not yet supported. Labels / logits was rank ${t.rank} and dim was ${n}`);return oa((s,a,o)=>{let l=mI(a,[n],!0),u=Ne(ke(a,"float32"),l);o([s,u]);let c=Kt(K(u,s));return{value:_e(c,[n]),gradFunc:(p,f)=>{let[m,g]=f,y=ei(p.shape,[n]);return[K(J(p,y),Ne(ke(m,"float32"),Kr(g))),K(J(p,y),Ne(Kr(g),ke(m,"float32")))]}}})(e,t)}function KZ(e,t,n,r=0,s=Yn.SUM_BY_NONZERO_WEIGHTS){let a=O(e,"onehotLabels","softmaxCrossEntropy"),o=O(t,"logits","softmaxCrossEntropy"),i=null;if(n!=null&&(i=O(n,"weights","softmaxCrossEntropy")),rs(a.shape,o.shape,"Error in softmaxCrossEntropy: "),r>0){let u=Fe(r),c=Fe(1),d=Fe(a.shape[1]);a=pe(K(a,Ne(c,u)),Re(u,d))}let l=qZ(a,o);return Ua(l,i,s)}var Bwe=V({softmaxCrossEntropy_:KZ});function XZ(e,t,n,r){let s=O(e,"indices","sparseFillEmptyRows"),a=O(t,"values","sparseFillEmptyRows"),o=O(n,"denseShape","sparseFillEmptyRows"),i=O(r,"defaultValue","sparseFillEmptyRows",a.dtype);if(s.rank!==2)throw new Error(`Indices should be Tensor2D but received shape + ${s.shape}`);if(a.rank!==1)throw new Error(`Values should be Tensor1D but received shape ${a.shape}`);if(o.rank!==1)throw new Error(`Dense shape should be Tensor1D but received shape ${o.shape}`);if(i.rank!==0)throw new Error(`Default value should be a scalar but received shape ${i.shape}`);let l={indices:s,values:a,denseShape:o,defaultValue:i},u=G.runKernel(Ky,l);return{outputIndices:u[0],outputValues:u[1],emptyRowIndicator:u[2],reverseIndexMap:u[3]}}var ZZ=V({sparseFillEmptyRows_:XZ});function YZ(e,t,n){let r=O(e,"inputIndices","sparseReshape"),s=O(t,"inputShape","sparseReshape"),a=O(n,"newShape","sparseReshape");if(r.rank!==2)throw new Error(`Input indices should be Tensor2D but received shape + ${r.shape}`);if(s.rank!==1)throw new Error(`Input shape should be Tensor1D but received shape ${s.shape}`);if(a.rank!==1)throw new Error(`New shape should be Tensor1D but received shape ${a.shape}`);let o={inputIndices:r,inputShape:s,newShape:a},i=G.runKernel(Xy,o);return{outputIndices:i[0],outputShape:i[1]}}var JZ=V({sparseReshape_:YZ});function QZ(e,t,n){let r=O(e,"data","sparseSegmentMean"),s=O(t,"indices","sparseSegmentMean"),a=O(n,"segmentIds","sparseSegmentMean");if(r.rank<1)throw new Error("Data should be at least 1 dimensional but received scalar");if(s.rank!==1)throw new Error(`Indices should be Tensor1D but received shape + ${s.shape}`);if(a.rank!==1)throw new Error(`Segment ids should be Tensor1D but received shape + ${a.shape}`);let o={data:r,indices:s,segmentIds:a};return G.runKernel(Zy,o)}var eY=V({sparseSegmentMean_:QZ});function tY(e,t,n){let r=O(e,"data","sparseSegmentSum"),s=O(t,"indices","sparseSegmentSum"),a=O(n,"segmentIds","sparseSegmentSum");if(r.rank<1)throw new Error("Data should be at least 1 dimensional but received scalar");if(s.rank!==1)throw new Error(`Indices should be Tensor1D but received shape + ${s.shape}`);if(a.rank!==1)throw new Error(`Segment ids should be Tensor1D but received shape + ${a.shape}`);let o={data:r,indices:s,segmentIds:a};return G.runKernel(Yy,o)}var nY=V({sparseSegmentSum_:tY});function rY(e,t,n,r,s,a,o,i){let l=O(e,"data","stringNGrams","string");if(l.dtype!=="string")throw new Error("Data must be of datatype string");if(l.shape.length!==1)throw new Error(`Data must be a vector, saw: ${l.shape}`);let u=O(t,"dataSplits","stringNGrams");if(u.dtype!=="int32")throw new Error("Data splits must be of datatype int32");let c={separator:n,nGramWidths:r,leftPad:s,rightPad:a,padWidth:o,preserveShortSequences:i},d={data:l,dataSplits:u},h=G.runKernel(Qy,d,c);return{nGrams:h[0],nGramsSplits:h[1]}}var sY=V({stringNGrams_:rY});function aY(e,t,n=!0){let r=O(e,"input","stringSplit","string"),s=O(t,"delimiter","stringSplit","string");if(r.rank!==1)throw new Error(`Input should be Tensor1D but received shape ${r.shape}`);if(s.rank!==0)throw new Error(`Delimiter should be a scalar but received shape ${s.shape}`);let a={skipEmpty:n},o={input:r,delimiter:s},i=G.runKernel(eA,o,a);return{indices:i[0],values:i[1],shape:i[2]}}var oY=V({stringSplit_:aY});function iY(e,t){let n=O(e,"input","stringToHashBucketFast","string"),r={numBuckets:t};if(t<=0)throw new Error("Number of buckets must be at least 1");let s={input:n};return G.runKernel(tA,s,r)}var lY=V({stringToHashBucketFast_:iY}),ni={flipLeftRight:sZ,resizeNearestNeighbor:LI,resizeBilinear:zI,rotateWithOffset:oZ,cropAndResize:nZ,nonMaxSuppression:lZ,nonMaxSuppressionAsync:gZ,nonMaxSuppressionWithScore:AZ,nonMaxSuppressionWithScoreAsync:bZ,nonMaxSuppressionPadded:wZ,nonMaxSuppressionPaddedAsync:IZ,threshold:EZ,transform:_Z},uY={bandPart:DZ,gramSchmidt:MZ,qr:PZ},Vf={sparseFillEmptyRows:ZZ,sparseReshape:JZ,sparseSegmentMean:eY,sparseSegmentSum:nY},p1={stringNGrams:sY,stringSplit:oY,stringToHashBucketFast:lY},Ha=class extends B6{minimize(e,t=!1,n){let{value:r,grads:s}=this.computeGradients(e,n);if(n!=null){let a=n.map(o=>({name:o.name,tensor:s[o.name]}));this.applyGradients(a)}else this.applyGradients(s);return je(s),t?r:(r.dispose(),null)}get iterations(){return this.iterations_==null&&(this.iterations_=0),this.iterations_}incrementIterations(){this.iterations_=this.iterations+1}computeGradients(e,t){return zq(e,t)}dispose(){this.iterations_!=null&&je(this.iterations_)}async saveIterations(){return this.iterations_==null&&(this.iterations_=0),{name:"iter",tensor:Fe(this.iterations_,"int32")}}async getWeights(){throw new Error("getWeights() is not implemented for this optimizer yet.")}async setWeights(e){throw new Error(`setWeights() is not implemented for this optimizer class ${this.getClassName()}`)}async extractIterations(e){return this.iterations_=(await e[0].tensor.data())[0],e.slice(1)}};Object.defineProperty(Ha,Symbol.hasInstance,{value:e=>e.minimize!=null&&e.computeGradients!=null&&e.applyGradients!=null});var f1=class extends Ha{constructor(e,t,n=null){super();this.learningRate=e,this.rho=t,this.epsilon=n,this.accumulatedGrads=[],this.accumulatedUpdates=[],n==null&&(this.epsilon=G.backend.epsilon())}applyGradients(e){(Array.isArray(e)?e.map(n=>n.name):Object.keys(e)).forEach((n,r)=>{let s=G.registeredVariables[n],a=!1;this.accumulatedGrads[r]==null&&(this.accumulatedGrads[r]={originalName:`${n}/accum_grad`,variable:Z(()=>rt(s).variable(a))}),this.accumulatedUpdates[r]==null&&(this.accumulatedUpdates[r]={originalName:`${n}/accum_var`,variable:Z(()=>rt(s).variable(a))});let o=Array.isArray(e)?e[r].tensor:e[n];if(o==null)return;let i=this.accumulatedGrads[r].variable,l=this.accumulatedUpdates[r].variable;Z(()=>{let u=pe(K(i,this.rho),K(wt(o),1-this.rho)),c=K(Re($n(pe(l,this.epsilon)),$n(pe(i,this.epsilon))),o),d=pe(K(l,this.rho),K(wt(c),1-this.rho));i.assign(u),l.assign(d);let h=pe(K(c,-this.learningRate),s);s.assign(h)})}),this.incrementIterations()}dispose(){this.accumulatedUpdates!=null&&(je(this.accumulatedGrads.map(e=>e.variable)),je(this.accumulatedUpdates.map(e=>e.variable)))}async getWeights(){let e=[...this.accumulatedGrads,...this.accumulatedUpdates];return[await this.saveIterations()].concat(e.map(t=>({name:t.originalName,tensor:t.variable})))}async setWeights(e){e=await this.extractIterations(e);let t=e.length/2,n=!1;this.accumulatedGrads=e.slice(0,t).map(r=>({originalName:r.name,variable:r.tensor.variable(n)})),this.accumulatedUpdates=e.slice(t,t*2).map(r=>({originalName:r.name,variable:r.tensor.variable(n)}))}getConfig(){return{learningRate:this.learningRate,rho:this.rho,epsilon:this.epsilon}}static fromConfig(e,t){return new e(t.learningRate,t.rho,t.epsilon)}};f1.className="Adadelta";Pa(f1);var m1=class extends Ha{constructor(e,t=.1){super();this.learningRate=e,this.initialAccumulatorValue=t,this.accumulatedGrads=[]}applyGradients(e){(Array.isArray(e)?e.map(n=>n.name):Object.keys(e)).forEach((n,r)=>{let s=G.registeredVariables[n];if(this.accumulatedGrads[r]==null){let i=!1;this.accumulatedGrads[r]={originalName:`${n}/accumulator`,variable:Z(()=>Cd(s.shape,this.initialAccumulatorValue).variable(i))}}let a=Array.isArray(e)?e[r].tensor:e[n];if(a==null)return;let o=this.accumulatedGrads[r].variable;Z(()=>{let i=pe(o,wt(a));o.assign(i);let l=pe(K(Re(a,$n(pe(i,G.backend.epsilon()))),-this.learningRate),s);s.assign(l)})}),this.incrementIterations()}dispose(){this.accumulatedGrads!=null&&je(this.accumulatedGrads.map(e=>e.variable))}async getWeights(){return[await this.saveIterations()].concat(this.accumulatedGrads.map(e=>({name:e.originalName,tensor:e.variable})))}async setWeights(e){e=await this.extractIterations(e);let t=!1;this.accumulatedGrads=e.map(n=>({originalName:n.name,variable:n.tensor.variable(t)}))}getConfig(){return{learningRate:this.learningRate,initialAccumulatorValue:this.initialAccumulatorValue}}static fromConfig(e,t){return new e(t.learningRate,t.initialAccumulatorValue)}};m1.className="Adagrad";Pa(m1);var g1=class extends Ha{constructor(e,t,n,r=null){super();this.learningRate=e,this.beta1=t,this.beta2=n,this.epsilon=r,this.accumulatedFirstMoment=[],this.accumulatedSecondMoment=[],Z(()=>{this.accBeta1=Fe(t).variable(),this.accBeta2=Fe(n).variable()}),r==null&&(this.epsilon=G.backend.epsilon())}applyGradients(e){let t=Array.isArray(e)?e.map(n=>n.name):Object.keys(e);Z(()=>{let n=Ne(1,this.accBeta1),r=Ne(1,this.accBeta2);t.forEach((s,a)=>{let o=G.registeredVariables[s],i=!1;this.accumulatedFirstMoment[a]==null&&(this.accumulatedFirstMoment[a]={originalName:`${s}/m`,variable:Z(()=>rt(o).variable(i))}),this.accumulatedSecondMoment[a]==null&&(this.accumulatedSecondMoment[a]={originalName:`${s}/v`,variable:Z(()=>rt(o).variable(i))});let l=Array.isArray(e)?e[a].tensor:e[s];if(l==null)return;let u=this.accumulatedFirstMoment[a].variable,c=this.accumulatedSecondMoment[a].variable,d=pe(K(u,this.beta1),K(l,1-this.beta1)),h=pe(K(c,this.beta2),K(wt(l),1-this.beta2)),p=Re(d,n),f=Re(h,r);u.assign(d),c.assign(h);let m=pe(K(Re(p,pe($n(f),this.epsilon)),-this.learningRate),o);o.assign(m)}),this.accBeta1.assign(K(this.accBeta1,this.beta1)),this.accBeta2.assign(K(this.accBeta2,this.beta2))}),this.incrementIterations()}dispose(){this.accBeta1.dispose(),this.accBeta2.dispose(),this.accumulatedFirstMoment!=null&&je(this.accumulatedFirstMoment.map(e=>e.variable)),this.accumulatedSecondMoment!=null&&je(this.accumulatedSecondMoment.map(e=>e.variable))}async getWeights(){let e=[...this.accumulatedFirstMoment,...this.accumulatedSecondMoment];return[await this.saveIterations()].concat(e.map(t=>({name:t.originalName,tensor:t.variable})))}async setWeights(e){e=await this.extractIterations(e),Z(()=>{this.accBeta1.assign(Va(this.beta1,this.iterations_+1)),this.accBeta2.assign(Va(this.beta2,this.iterations_+1))});let t=e.length/2,n=!1;this.accumulatedFirstMoment=e.slice(0,t).map(r=>({originalName:r.name,variable:r.tensor.variable(n)})),this.accumulatedSecondMoment=e.slice(t,t*2).map(r=>({originalName:r.name,variable:r.tensor.variable(n)}))}getConfig(){return{learningRate:this.learningRate,beta1:this.beta1,beta2:this.beta2,epsilon:this.epsilon}}static fromConfig(e,t){return new e(t.learningRate,t.beta1,t.beta2,t.epsilon)}};g1.className="Adam";Pa(g1);var y1=class extends Ha{constructor(e,t,n,r=null,s=0){super();this.learningRate=e,this.beta1=t,this.beta2=n,this.epsilon=r,this.decay=s,this.accumulatedFirstMoment=[],this.accumulatedWeightedInfNorm=[],Z(()=>{this.iteration=Fe(0).variable(),this.accBeta1=Fe(t).variable()}),r==null&&(this.epsilon=G.backend.epsilon())}applyGradients(e){let t=Array.isArray(e)?e.map(n=>n.name):Object.keys(e);Z(()=>{let n=Ne(1,this.accBeta1),r=Re(-this.learningRate,pe(K(this.iteration,this.decay),1));t.forEach((s,a)=>{let o=G.registeredVariables[s],i=!1;this.accumulatedFirstMoment[a]==null&&(this.accumulatedFirstMoment[a]={originalName:`${s}/m`,variable:rt(o).variable(i)}),this.accumulatedWeightedInfNorm[a]==null&&(this.accumulatedWeightedInfNorm[a]={originalName:`${s}/v`,variable:rt(o).variable(i)});let l=Array.isArray(e)?e[a].tensor:e[s];if(l==null)return;let u=this.accumulatedFirstMoment[a].variable,c=this.accumulatedWeightedInfNorm[a].variable,d=pe(K(u,this.beta1),K(l,1-this.beta1)),h=K(c,this.beta2),p=yn(l),f=ia(h,p);u.assign(d),c.assign(f);let m=pe(K(Re(r,n),Re(d,pe(f,this.epsilon))),o);o.assign(m)}),this.iteration.assign(pe(this.iteration,1)),this.accBeta1.assign(K(this.accBeta1,this.beta1))}),this.incrementIterations()}dispose(){this.accBeta1.dispose(),this.iteration.dispose(),this.accumulatedFirstMoment!=null&&je(this.accumulatedFirstMoment.map(e=>e.variable)),this.accumulatedWeightedInfNorm!=null&&je(this.accumulatedWeightedInfNorm.map(e=>e.variable))}async getWeights(){throw new Error("getWeights() is not implemented for Adamax yet.")}async setWeights(e){throw new Error("setWeights() is not implemented for Adamax yet.")}getConfig(){return{learningRate:this.learningRate,beta1:this.beta1,beta2:this.beta2,epsilon:this.epsilon,decay:this.decay}}static fromConfig(e,t){return new e(t.learningRate,t.beta1,t.beta2,t.epsilon,t.decay)}};y1.className="Adamax";Pa(y1);var Uf=class extends Ha{constructor(e){super();this.learningRate=e,this.setLearningRate(e)}applyGradients(e){(Array.isArray(e)?e.map(n=>n.name):Object.keys(e)).forEach((n,r)=>{let s=Array.isArray(e)?e[r].tensor:e[n];if(s==null)return;let a=G.registeredVariables[n];Z(()=>{let o=pe(K(this.c,s),a);a.assign(o)})}),this.incrementIterations()}setLearningRate(e){this.learningRate=e,this.c!=null&&this.c.dispose(),this.c=Sn(Fe(-e))}dispose(){this.c.dispose()}async getWeights(){return[await this.saveIterations()]}async setWeights(e){if(e=await this.extractIterations(e),e.length!==0)throw new Error("SGD optimizer does not have settable weights.")}getConfig(){return{learningRate:this.learningRate}}static fromConfig(e,t){return new e(t.learningRate)}};Uf.className="SGD";Pa(Uf);var A1=class extends Uf{constructor(e,t,n=!1){super(e);this.learningRate=e,this.momentum=t,this.useNesterov=n,this.accumulations=[],this.m=Fe(this.momentum)}applyGradients(e){(Array.isArray(e)?e.map(n=>n.name):Object.keys(e)).forEach((n,r)=>{let s=G.registeredVariables[n];if(this.accumulations[r]==null){let i=!1;this.accumulations[r]={originalName:`${n}/momentum`,variable:Z(()=>rt(s).variable(i))}}let a=this.accumulations[r].variable,o=Array.isArray(e)?e[r].tensor:e[n];o!=null&&Z(()=>{let i,l=pe(K(this.m,a),o);this.useNesterov?i=pe(K(this.c,pe(o,K(l,this.m))),s):i=pe(K(this.c,l),s),a.assign(l),s.assign(i)})}),this.incrementIterations()}dispose(){this.m.dispose(),this.accumulations!=null&&je(this.accumulations.map(e=>e.variable))}setMomentum(e){this.momentum=e}async getWeights(){return[await this.saveIterations()].concat(this.accumulations.map(e=>({name:e.originalName,tensor:e.variable})))}async setWeights(e){e=await this.extractIterations(e);let t=!1;this.accumulations=e.map(n=>({originalName:n.name,variable:n.tensor.variable(t)}))}getConfig(){return{learningRate:this.learningRate,momentum:this.momentum,useNesterov:this.useNesterov}}static fromConfig(e,t){return new e(t.learningRate,t.momentum,t.useNesterov)}};A1.className="Momentum";Pa(A1);var x1=class extends Ha{constructor(e,t=.9,n=0,r=null,s=!1){super();if(this.learningRate=e,this.decay=t,this.momentum=n,this.epsilon=r,this.accumulatedMeanSquares=[],this.accumulatedMoments=[],this.accumulatedMeanGrads=[],this.centered=s,r==null&&(this.epsilon=G.backend.epsilon()),e==null)throw new Error("learningRate for RMSPropOptimizer must be defined.")}applyGradients(e){(Array.isArray(e)?e.map(n=>n.name):Object.keys(e)).forEach((n,r)=>{let s=G.registeredVariables[n],a=!1;this.accumulatedMeanSquares[r]==null&&(this.accumulatedMeanSquares[r]={originalName:`${n}/rms`,variable:Z(()=>rt(s).variable(a))}),this.accumulatedMoments[r]==null&&(this.accumulatedMoments[r]={originalName:`${n}/momentum`,variable:Z(()=>rt(s).variable(a))}),this.accumulatedMeanGrads[r]==null&&this.centered&&(this.accumulatedMeanGrads[r]={originalName:`${n}/mg`,variable:Z(()=>rt(s).variable(a))});let o=Array.isArray(e)?e[r].tensor:e[n];if(o==null)return;let i=this.accumulatedMeanSquares[r].variable,l=this.accumulatedMoments[r].variable;Z(()=>{let u=pe(K(i,this.decay),K(wt(o),1-this.decay));if(this.centered){let c=this.accumulatedMeanGrads[r].variable,d=pe(K(c,this.decay),K(o,1-this.decay)),h=Re(K(o,this.learningRate),$n(Ne(u,pe(wt(d),this.epsilon)))),p=pe(K(l,this.momentum),h);i.assign(u),c.assign(d),l.assign(p);let f=Ne(s,p);s.assign(f)}else{let c=pe(K(i,this.decay),K(wt(o),1-this.decay)),d=pe(K(l,this.momentum),Re(K(o,this.learningRate),$n(pe(c,this.epsilon))));i.assign(c),l.assign(d);let h=Ne(s,d);s.assign(h)}})}),this.incrementIterations()}dispose(){this.accumulatedMeanSquares!=null&&je(this.accumulatedMeanSquares.map(e=>e.variable)),this.accumulatedMeanGrads!=null&&this.centered&&je(this.accumulatedMeanGrads.map(e=>e.variable)),this.accumulatedMoments!=null&&je(this.accumulatedMoments.map(e=>e.variable))}async getWeights(){let e=[...this.accumulatedMeanSquares,...this.accumulatedMoments];return this.centered&&e.push(...this.accumulatedMeanGrads),[await this.saveIterations()].concat(e.map(t=>({name:t.originalName,tensor:t.variable})))}async setWeights(e){e=await this.extractIterations(e);let t=this.centered?e.length/3:e.length/2,n=!1;this.accumulatedMeanSquares=e.slice(0,t).map(r=>({originalName:r.name,variable:r.tensor.variable(n)})),this.accumulatedMoments=e.slice(t,t*2).map(r=>({originalName:r.name,variable:r.tensor.variable(n)})),this.centered&&(this.accumulatedMeanGrads=e.slice(t*2,t*3).map(r=>({originalName:r.name,variable:r.tensor.variable(n)})))}getConfig(){return{learningRate:this.learningRate,decay:this.decay,momentum:this.momentum,epsilon:this.epsilon,centered:this.centered}}static fromConfig(e,t){return new e(t.learningRate,t.decay,t.momentum,t.epsilon,t.centered)}};x1.className="RMSProp";Pa(x1);var ri=class{static sgd(e){return new Uf(e)}static momentum(e,t,n=!1){return new A1(e,t,n)}static rmsprop(e,t=.9,n=0,r=null,s=!1){return new x1(e,t,n,r,s)}static adam(e=.001,t=.9,n=.999,r=null){return new g1(e,t,n,r)}static adadelta(e=.001,t=.95,n=null){return new f1(e,t,n)}static adamax(e=.002,t=.9,n=.999,r=null,s=0){return new y1(e,t,n,r,s)}static adagrad(e,t=.1){return new m1(e,t)}},tu={sgd:ri.sgd,momentum:ri.momentum,adadelta:ri.adadelta,adagrad:ri.adagrad,rmsprop:ri.rmsprop,adamax:ri.adamax,adam:ri.adam},cY=(()=>typeof requestAnimationFrame!="undefined"?requestAnimationFrame:typeof setImmediate!="undefined"?setImmediate:e=>e())();function b1(){return new Promise(e=>cY(()=>e()))}var _={};De(_,{ERF_A1:()=>vY,ERF_A2:()=>wY,ERF_A3:()=>kY,ERF_A4:()=>IY,ERF_A5:()=>SY,ERF_P:()=>bY,PARALLELIZE_THRESHOLD:()=>v1,SELU_SCALE:()=>VI,SELU_SCALEALPHA:()=>WI,applyActivation:()=>Bf,assertAndGetBroadcastShape:()=>Rt,assertAxesAreInnerMostDims:()=>qq,assertParamsConsistent:()=>dY,assignToTypedArray:()=>DY,axesAreInnerMostDims:()=>HA,calculateShapes:()=>C6,checkEinsumDimSizes:()=>LY,combineLocations:()=>hI,complexWithEvenIndex:()=>$Y,complexWithOddIndex:()=>_Y,computeConv2DInfo:()=>Id,computeConv3DInfo:()=>Y6,computeDefaultPad:()=>DA,computeDilation2DInfo:()=>ij,computeOptimalWindowSize:()=>pY,computeOutAndReduceShapes:()=>pI,computeOutShape:()=>hY,computePool2DInfo:()=>Z6,computePool3DInfo:()=>lj,convertConv2DDataFormat:()=>J6,decodeEinsumEquation:()=>PY,eitherStridesOrDilationsAreOne:()=>_s,expandShapeToKeepDim:()=>ei,exponent:()=>MY,exponents:()=>FY,fromStringArrayToUint8:()=>KY,fromUint8ToStringArray:()=>qY,getAxesPermutation:()=>fI,getBroadcastDims:()=>aq,getComplexWithIndex:()=>RY,getEinsumComputePath:()=>BY,getEinsumPermutation:()=>zY,getFusedBiasGradient:()=>Lf,getFusedDyActivation:()=>zf,getImageCenter:()=>fY,getInnerMostAxes:()=>Kq,getPermuted:()=>gY,getReductionAxes:()=>ln,getReshaped:()=>mY,getReshapedPermuted:()=>yY,getSliceBeginCoords:()=>AY,getSliceSize:()=>xY,getUndoAxesPermutation:()=>GA,isIdentityPermutation:()=>WY,log:()=>NY,mergeRealAndImagArrays:()=>CY,prepareAndValidate:()=>T6,prepareSplitSize:()=>UY,segment_util:()=>GI,shouldFuse:()=>Wf,slice_util:()=>En,splitRealAndImagArrays:()=>EY,tupleValuesAreOne:()=>La,upcastType:()=>qr,validateInput:()=>CA,validateUpdateShape:()=>NA,warn:()=>TY});function dY(e,t){let n=e[0].length;e.forEach((s,a)=>{z(s.length===n,()=>`Error in concat${n}D: rank of tensors[${a}] must be the same as the rank of the rest (${n})`)}),z(t>=0&&t`Error in concat${n}D: axis must be between 0 and ${n-1}.`);let r=e[0];e.forEach((s,a)=>{for(let o=0;o`Error in concat${n}D: Shape of tensors[${a}] (${s}) does not match the shape of the rest (${r}) along the non-concatenated axis ${a}.`)})}function hY(e,t){let n=e[0].slice();for(let r=1;r=t*2+1||o%2==1?a.push(o):s.push(o);r.push(...s),r.push(0),r.push(...a)}return r}function yY(e,t,n,r=!0){let s=[];r?s.push(e[0]/n):s.push(e[0]*n);for(let a=1;a/g,UI=",",HI="...";function PY(e,t){e=e.replace(/\s/g,"");let n=(e.length-e.replace(OY,"").length)/w1.length;if(n<1)throw new Error("Equations without an arrow are not supported.");if(n>1)throw new Error(`Equation must contain exactly one arrow ("${w1}").`);let[r,s]=e.split(w1);z(r.indexOf(HI)===-1,()=>`The ellipsis notation ("${HI}") is not supported yet.`);let a=r.split(UI),o=a.length;if(t!==o)throw new Error(`Expected ${o} input tensors, received ${t}`);if(o>2)throw new Error("Support for more than 2 input tensors is not implemented yet.");let i=[];for(let h=0;hf.indexOf(p)!==-1))throw new Error(`Output subscripts contain the label ${p} not present in the input subscripts.`);i.indexOf(p)===-1&&i.push(p)}for(let h=0;hs!==-1),{permutationIndices:n,expandDims:r}}function LY(e,t,n){let r=new Array(e);for(let s=0;s`Expected dimension ${r[t[s][o]]} at axis ${o} of input shaped ${JSON.stringify(a)}, but got dimension ${a[o]}`)}}function BY(e,t){let n=e,r=[],s=0;e.length===0&&n.push(-1),s=e.length+1;for(let o=0;ot===n)}function VY(e,t){let n=[];for(let r=0;r"Number of splits must evenly divide the axis."),r=new Array(t).fill(e.shape[n]/t);else{let s=t.reduce((o,i)=>(i===-1&&(o+=1),o),0);z(s<=1,()=>"There should be only one negative value in split array.");let a=t.indexOf(-1);if(a!==-1){let o=t.reduce((i,l)=>l>0?i+l:i);t[a]=e.shape[n]-o}z(e.shape[n]===t.reduce((o,i)=>o+i),()=>"The sum of sizes must match the size of the axis dimension."),r=t}return r}var GI={};De(GI,{collectGatherOpShapeInfo:()=>jY,computeOutShape:()=>GY,segOpComputeOptimalWindowSize:()=>HY});function HY(e,t){let n=!1,r;for(e<=v1?(r=e,n=!0):r=Gp(e,Math.floor(Math.sqrt(e)));!n;)r>t||r===e?n=!0:r=Gp(e,r+1);return r}function GY(e,t,n){let r=[],s=e.length;for(let a=0;as))throw new Error(`Expect batchDims in the range of [-${s}, ${s}], but got ${r}`);if(r<0&&(r+=s),r>a)throw new Error(`batchDims (${r}) must be less than rank(x) ( + ${a}).`);if(nff(t))}catch(t){throw new Error(`Failed to decode encoded string bytes into utf-8, error: ${t}`)}}function KY(e){return e.map(t=>pf(t))}var ca={};De(ca,{nonMaxSuppressionV3Impl:()=>FI,nonMaxSuppressionV4Impl:()=>MI,nonMaxSuppressionV5Impl:()=>OI,whereImpl:()=>CI});re().prototype.abs=function(){return this.throwIfDisposed(),yn(this)};re().prototype.acos=function(){return this.throwIfDisposed(),V6(this)};re().prototype.acosh=function(){return this.throwIfDisposed(),U6(this)};re().prototype.add=function(e){return this.throwIfDisposed(),pe(this,e)};re().prototype.all=function(e,t){return this.throwIfDisposed(),RA(this,e,t)};re().prototype.any=function(e,t){return this.throwIfDisposed(),wf(this,e,t)};re().prototype.argMax=function(e){return this.throwIfDisposed(),kf(this,e)};re().prototype.argMin=function(e){return this.throwIfDisposed(),H6(this,e)};re().prototype.asScalar=function(){return this.throwIfDisposed(),z(this.size===1,()=>"The array must have only 1 element."),J(this,[])};re().prototype.asType=function(e){return this.throwIfDisposed(),ke(this,e)};re().prototype.as1D=function(){return this.throwIfDisposed(),J(this,[this.size])};re().prototype.as2D=function(e,t){return this.throwIfDisposed(),J(this,[e,t])};re().prototype.as3D=function(e,t,n){return this.throwIfDisposed(),J(this,[e,t,n])};re().prototype.as4D=function(e,t,n,r){return this.throwIfDisposed(),J(this,[e,t,n,r])};re().prototype.as5D=function(e,t,n,r,s){return this.throwIfDisposed(),J(this,[e,t,n,r,s])};re().prototype.asin=function(){return this.throwIfDisposed(),G6(this)};re().prototype.asinh=function(){return this.throwIfDisposed(),j6(this)};re().prototype.atan=function(){return this.throwIfDisposed(),q6(this)};re().prototype.atan2=function(e){return this.throwIfDisposed(),K6(this,e)};re().prototype.atanh=function(){return this.throwIfDisposed(),X6(this)};re().prototype.avgPool=function(e,t,n,r){return this.throwIfDisposed(),Sf(this,e,t,n,r)};re().prototype.batchToSpaceND=function(e,t){return this.throwIfDisposed(),Tf(this,e,t)};re().prototype.batchNorm=function(e,t,n,r,s){return this.throwIfDisposed(),Xl(this,e,t,n,r,s)};re().prototype.broadcastTo=function(e){return this.throwIfDisposed(),Sd(this,e)};re().prototype.cast=function(e){return this.throwIfDisposed(),ke(this,e)};re().prototype.ceil=function(){return this.throwIfDisposed(),tI(this)};re().prototype.clipByValue=function(e,t){return this.throwIfDisposed(),cr(this,e,t)};re().prototype.concat=function(e,t){return this.throwIfDisposed(),e instanceof Ct&&(e=[e]),en([this,...e],t)};re().prototype.conv1d=function(e,t,n,r,s,a){return this.throwIfDisposed(),MA(this,e,t,n,r,s,a)};re().prototype.conv2dTranspose=function(e,t,n,r,s){return this.throwIfDisposed(),PA(this,e,t,n,r,s)};re().prototype.conv2d=function(e,t,n,r,s,a){return this.throwIfDisposed(),Ba(this,e,t,n,r,s,a)};re().prototype.cos=function(){return this.throwIfDisposed(),Nf(this)};re().prototype.cosh=function(){return this.throwIfDisposed(),zA(this)};re().prototype.cumsum=function(e,t,n){return this.throwIfDisposed(),LA(this,e,t,n)};re().prototype.depthToSpace=function(e,t){return this.throwIfDisposed(),sI(this,e,t)};re().prototype.depthwiseConv2d=function(e,t,n,r,s,a){return this.throwIfDisposed(),Td(this,e,t,n,r,s,a)};re().prototype.dilation2d=function(e,t,n,r,s){return this.throwIfDisposed(),aI(this,e,t,n,r,s)};re().prototype.divNoNan=function(e){return this.throwIfDisposed(),oI(this,e)};re().prototype.div=function(e){return this.throwIfDisposed(),Re(this,e)};re().prototype.dot=function(e){return this.throwIfDisposed(),dq(this,e)};re().prototype.elu=function(){return this.throwIfDisposed(),Nd(this)};re().prototype.equal=function(e){return this.throwIfDisposed(),Zo(this,e)};re().prototype.erf=function(){return this.throwIfDisposed(),iI(this)};re().prototype.exp=function(){return this.throwIfDisposed(),Kr(this)};re().prototype.expandDims=function(e){return this.throwIfDisposed(),$r(this,e)};re().prototype.expm1=function(){return this.throwIfDisposed(),lI(this)};re().prototype.fft=function(){return this.throwIfDisposed(),a1(this)};re().prototype.flatten=function(){return this.throwIfDisposed(),J(this,[this.size])};re().prototype.floor=function(){return this.throwIfDisposed(),Ed(this)};re().prototype.floorDiv=function(e){return this.throwIfDisposed(),_A(this,e)};re().prototype.gather=function(e,t){return this.throwIfDisposed(),$d(this,e,t)};re().prototype.greaterEqual=function(e){return this.throwIfDisposed(),Jo(this,e)};re().prototype.greater=function(e){return this.throwIfDisposed(),_r(this,e)};re().prototype.ifft=function(){return this.throwIfDisposed(),Pf(this)};re().prototype.irfft=function(){return this.throwIfDisposed(),kI(this)};re().prototype.isFinite=function(){return this.throwIfDisposed(),Nq(this)};re().prototype.isInf=function(){return this.throwIfDisposed(),Eq(this)};re().prototype.isNaN=function(){return this.throwIfDisposed(),cI(this)};re().prototype.leakyRelu=function(e){return this.throwIfDisposed(),Cf(this,e)};re().prototype.lessEqual=function(e){return this.throwIfDisposed(),Qo(this,e)};re().prototype.less=function(e){return this.throwIfDisposed(),WA(this,e)};re().prototype.localResponseNormalization=function(e,t,n,r){return this.throwIfDisposed(),dI(this,e,t,n,r)};re().prototype.logSigmoid=function(){return this.throwIfDisposed(),Vq(this)};re().prototype.logSoftmax=function(e){return this.throwIfDisposed(),UA(this,e)};re().prototype.logSumExp=function(e,t){return this.throwIfDisposed(),mI(this,e,t)};re().prototype.log=function(){return this.throwIfDisposed(),Rr(this)};re().prototype.log1p=function(){return this.throwIfDisposed(),VA(this)};re().prototype.logicalAnd=function(e){return this.throwIfDisposed(),is(this,e)};re().prototype.logicalNot=function(){return this.throwIfDisposed(),Ef(this)};re().prototype.logicalOr=function(e){return this.throwIfDisposed(),jA(this,e)};re().prototype.logicalXor=function(e){return this.throwIfDisposed(),eK(this,e)};re().prototype.matMul=function(e,t,n){return this.throwIfDisposed(),ot(this,e,t,n)};re().prototype.maxPool=function(e,t,n,r){return this.throwIfDisposed(),$f(this,e,t,n,r)};re().prototype.max=function(e,t){return this.throwIfDisposed(),os(this,e,t)};re().prototype.maximum=function(e){return this.throwIfDisposed(),ia(this,e)};re().prototype.mean=function(e,t){return this.throwIfDisposed(),Xt(this,e,t)};re().prototype.min=function(e,t){return this.throwIfDisposed(),_f(this,e,t)};re().prototype.minimum=function(e){return this.throwIfDisposed(),_d(this,e)};re().prototype.mirrorPad=function(e,t){return this.throwIfDisposed(),yI(this,e,t)};re().prototype.mod=function(e){return this.throwIfDisposed(),AI(this,e)};re().prototype.mul=function(e){return this.throwIfDisposed(),K(this,e)};re().prototype.neg=function(){return this.throwIfDisposed(),Kt(this)};re().prototype.norm=function(e,t,n){return this.throwIfDisposed(),c1(this,e,t,n)};re().prototype.notEqual=function(e){return this.throwIfDisposed(),Yl(this,e)};re().prototype.oneHot=function(e,t=1,n=0){return this.throwIfDisposed(),kd(this,e,t,n)};re().prototype.onesLike=function(){return this.throwIfDisposed(),Dr(this)};re().prototype.pad=function(e,t){return this.throwIfDisposed(),Wa(this,e,t)};re().prototype.pool=function(e,t,n,r,s){return this.throwIfDisposed(),CK(this,e,t,n,r,s)};re().prototype.pow=function(e){return this.throwIfDisposed(),Va(this,e)};re().prototype.prelu=function(e){return this.throwIfDisposed(),Df(this,e)};re().prototype.prod=function(e,t){return this.throwIfDisposed(),KA(this,e,t)};re().prototype.reciprocal=function(){return this.throwIfDisposed(),xI(this)};re().prototype.relu=function(){return this.throwIfDisposed(),ua(this)};re().prototype.relu6=function(){return this.throwIfDisposed(),YA(this)};re().prototype.reshapeAs=function(e){return this.throwIfDisposed(),J(this,e.shape)};re().prototype.reshape=function(e){return this.throwIfDisposed(),J(this,e)};re().prototype.resizeBilinear=function(e,t,n){return this.throwIfDisposed(),zI(this,e,t,n)};re().prototype.resizeNearestNeighbor=function(e,t,n){return this.throwIfDisposed(),LI(this,e,t,n)};re().prototype.reverse=function(e){return this.throwIfDisposed(),Fr(this,e)};re().prototype.rfft=function(){return this.throwIfDisposed(),o1(this)};re().prototype.round=function(){return this.throwIfDisposed(),JA(this)};re().prototype.rsqrt=function(){return this.throwIfDisposed(),QA(this)};re().prototype.selu=function(){return this.throwIfDisposed(),e1(this)};re().prototype.separableConv2d=function(e,t,n,r,s,a){return this.throwIfDisposed(),bI(this,e,t,n,r,s,a)};re().prototype.sigmoid=function(){return this.throwIfDisposed(),Rs(this)};re().prototype.sign=function(){return this.throwIfDisposed(),vI(this)};re().prototype.sin=function(){return this.throwIfDisposed(),t1(this)};re().prototype.sinh=function(){return this.throwIfDisposed(),n1(this)};re().prototype.slice=function(e,t){return this.throwIfDisposed(),nt(this,e,t)};re().prototype.softmax=function(e){return this.throwIfDisposed(),Of(this,e)};re().prototype.softplus=function(){return this.throwIfDisposed(),Zl(this)};re().prototype.spaceToBatchND=function(e,t){return this.throwIfDisposed(),Rf(this,e,t)};re().prototype.split=function(e,t){return this.throwIfDisposed(),dr(this,e,t)};re().prototype.sqrt=function(){return this.throwIfDisposed(),$n(this)};re().prototype.square=function(){return this.throwIfDisposed(),wt(this)};re().prototype.squaredDifference=function(e){return this.throwIfDisposed(),i1(this,e)};re().prototype.squeeze=function(e){return this.throwIfDisposed(),Jl(this,e)};re().prototype.stack=function(e,t){this.throwIfDisposed();let n=e instanceof Ct?[this,e]:[this,...e];return Mr(n,t)};re().prototype.step=function(e){return this.throwIfDisposed(),Fd(this,e)};re().prototype.stridedSlice=function(e,t,n,r,s,a,o,i){return this.throwIfDisposed(),II(this,e,t,n,r,s,a,o,i)};re().prototype.sub=function(e){return this.throwIfDisposed(),Ne(this,e)};re().prototype.sum=function(e,t){return this.throwIfDisposed(),_e(this,e,t)};re().prototype.tan=function(){return this.throwIfDisposed(),SI(this)};re().prototype.tanh=function(){return this.throwIfDisposed(),Kl(this)};re().prototype.tile=function(e){return this.throwIfDisposed(),Yo(this,e)};re().prototype.toBool=function(){return this.throwIfDisposed(),ke(this,"bool")};re().prototype.toFloat=function(){return this.throwIfDisposed(),ke(this,"float32")};re().prototype.toInt=function(){return this.throwIfDisposed(),ke(this,"int32")};re().prototype.topk=function(e,t){return this.throwIfDisposed(),TI(this,e,t)};re().prototype.transpose=function(e){return this.throwIfDisposed(),pt(this,e)};re().prototype.unique=function(e){return this.throwIfDisposed(),u1(this,e)};re().prototype.unsortedSegmentSum=function(e,t){return this.throwIfDisposed(),NI(this,e,t)};re().prototype.unstack=function(e){return this.throwIfDisposed(),ls(this,e)};re().prototype.where=function(e,t){return this.throwIfDisposed(),Ln(e,this,t)};re().prototype.zerosLike=function(){return this.throwIfDisposed(),rt(this)};var jI={kernelName:xc,inputsToSave:["x"],gradFunc:(e,t)=>{let[n]=t;return{x:()=>K(e,Fd(ke(n,"float32"),-1))}}},XY={kernelName:bc,inputsToSave:["x"],gradFunc:(e,t)=>{let[n]=t;return{x:()=>{let r=wt(ke(n,"float32")),s=$n(Ne(Fe(1),r));return Kt(Re(e,s))}}}},ZY={kernelName:vc,inputsToSave:["x"],gradFunc:(e,t)=>{let[n]=t;return{x:()=>{let r=$n(Ne(wt(ke(n,"float32")),1));return Re(e,r)}}}},YY={kernelName:Fa,inputsToSave:["a","b"],gradFunc:(e,t)=>{let[n,r]=t,s=Rt(n.shape,r.shape);return{a:()=>{let i=e,l=ln(n.shape,s);return l.length>0&&(i=_e(i,l)),J(i,n.shape)},b:()=>{let i=e,l=ln(r.shape,s);return l.length>0&&(i=_e(i,l)),J(i,r.shape)}}}},JY={kernelName:Zi,saveAllInputs:!0,gradFunc:(e,t)=>{let n={};return t.forEach((r,s)=>{n[s]=()=>e.clone()}),n}},QY={kernelName:Yi,inputsToSave:["x"],gradFunc:(e,t)=>{let[n]=t;return{x:()=>rt(n)}}},eJ={kernelName:qp,inputsToSave:["x"],gradFunc:(e,t)=>{let[n]=t;return{x:()=>rt(n)}}},tJ={kernelName:Ic,inputsToSave:["x"],gradFunc:(e,t)=>{let[n]=t;return{x:()=>Re(e,$n(Ne(Fe(1),wt(ke(n,"float32")))))}}},nJ={kernelName:Sc,inputsToSave:["x"],gradFunc:(e,t)=>{let[n]=t;return{x:()=>{let r=$n(pe(Fe(1),wt(ke(n,"float32"))));return Re(e,r)}}}},rJ={kernelName:Cc,inputsToSave:["a","b"],gradFunc:(e,t)=>{let[n,r]=t,s=Rt(n.shape,r.shape);return{a:()=>{let i=pe(wt(n),wt(r)),l=K(e,Re(r,i)),u=ln(n.shape,s);return u.length>0&&(l=_e(l,u)),J(l,n.shape)},b:()=>{let i=pe(wt(n),wt(r)),l=Kt(K(e,Re(n,i))),u=ln(r.shape,s);return u.length>0&&(l=_e(l,u)),J(l,r.shape)}}}},sJ={kernelName:Tc,inputsToSave:["x"],gradFunc:(e,t)=>{let[n]=t;return{x:()=>Re(e,pe(wt(ke(n,"float32")),1))}}},aJ={kernelName:Nc,inputsToSave:["x"],gradFunc:(e,t)=>{let[n]=t;return{x:()=>Re(e,Ne(Fe(1),wt(ke(n,"float32"))))}}};function oJ(e,t,n,r,s,a){let o=O(e,"dy","avgPool3dGrad"),i=O(t,"input","avgPool3dGrad"),l=o,u=i,c=!1;i.rank===4&&(c=!0,l=J(o,[1,o.shape[0],o.shape[1],o.shape[2],o.shape[3]]),u=J(i,[1,i.shape[0],i.shape[1],i.shape[2],i.shape[3]])),z(l.rank===5,()=>`Error in avgPool3dGrad: dy must be rank 5 but got rank ${l.rank}.`),z(u.rank===5,()=>`Error in avgPool3dGrad: input must be rank 5 but got rank ${u.rank}.`),a!=null&&z(mn(s),()=>`Error in avgPool3dGrad: pad must be an integer when using, dimRoundingMode ${a} but got pad ${s}.`);let d={dy:l,input:u},h={filterSize:n,strides:r,pad:s,dimRoundingMode:a},p=G.runKernel(wy,d,h);return c?J(p,[p.shape[1],p.shape[2],p.shape[3],p.shape[4]]):p}var iJ=V({avgPool3dGrad_:oJ}),lJ={kernelName:Kp,inputsToSave:["x"],gradFunc:(e,t,n)=>{let[r]=t,{filterSize:s,strides:a,pad:o,dimRoundingMode:i}=n;return{x:()=>iJ(e,r,s,a,o,i)}}};function uJ(e,t,n,r,s){let a=O(e,"dy","avgPoolGrad"),o=O(t,"input","avgPoolGrad");z(o.rank===a.rank,()=>`Rank of input (${o.rank}) does not match rank of dy (${a.rank})`);let i=o,l=a,u=!1;o.rank===3&&(u=!0,i=J(o,[1,o.shape[0],o.shape[1],o.shape[2]]),l=J(a,[1,a.shape[0],a.shape[1],a.shape[2]])),z(l.rank===4,()=>`Error in avgPoolGrad: dy must be rank 4 but got rank ${l.rank}.`),z(i.rank===4,()=>`Error in avgPoolGrad: input must be rank 4 but got rank ${i.rank}.`);let c={dy:l,input:i},d={filterSize:n,strides:r,pad:s},h=G.runKernel(vy,c,d);return u?J(h,[h.shape[1],h.shape[2],h.shape[3]]):h}var cJ=V({avgPoolGrad_:uJ}),dJ={kernelName:Ji,inputsToSave:["x"],gradFunc:(e,t,n)=>{let[r]=t,{filterSize:s,strides:a,pad:o}=n;return{x:()=>cJ(e,r,s,a,o)}}},hJ={kernelName:Qi,inputsToSave:["a","b"],gradFunc:(e,t,n)=>{let[r,s]=t,{transposeA:a,transposeB:o}=n;return!a&&!o?{a:()=>ot(e,s,!1,!0),b:()=>ot(r,e,!0,!1)}:!a&&o?{a:()=>ot(e,s,!1,!1),b:()=>ot(e,r,!0,!1)}:a&&!o?{a:()=>ot(s,e,!1,!0),b:()=>ot(r,e,!1,!1)}:{a:()=>ot(s,e,!0,!0),b:()=>ot(e,r,!0,!0)}}},pJ={kernelName:Xp,gradFunc:(e,t,n)=>{let{blockShape:r,crops:s}=n;return{x:()=>Rf(e,r,s)}}},fJ={kernelName:eH,gradFunc:(e,t,n)=>{let r=n,s=r.inputShape,a=r.shape,o=Array.from(a);for(let l=s.length-1;l>=0;l--)if(s[l]===a[l])o[l]=1;else if(s[l]!==1)throw new Error(`broadcastTo(): [${s}] cannot be broadcast to [${a}].`);let i=[];for(let l=0;l1&&i.push(l);return{x:()=>_e(e,i,!0)}}},mJ={kernelName:el,gradFunc:e=>({x:()=>e.clone()})},gJ={kernelName:No,gradFunc:e=>({x:()=>rt(e)})},yJ={kernelName:Co,inputsToSave:["x"],gradFunc:(e,t,n)=>{let[r]=t,{clipValueMin:s,clipValueMax:a}=n;return{x:()=>Ln(is(Jo(r,s),Qo(r,a)),e,rt(e))}}},AJ={kernelName:Zp,inputsToSave:["x"],gradFunc:jI.gradFunc},xJ={kernelName:Ec,saveAllInputs:!0,gradFunc:(e,t,n)=>{let r=t.map(l=>l.shape),{axis:s}=n,a=jr(s,t[0].shape)[0],o=r.map(l=>l[a]);return dr(e,o,a).map(l=>()=>l)}},bJ={kernelName:tl,inputsToSave:["x","filter"],gradFunc:(e,t,n)=>{let[r,s]=t,{dilations:a,strides:o,pad:i,dataFormat:l}=n;return z(La(a),()=>`Error in gradient of conv2D: dilation rates greater than 1 are not yet supported in gradients. Got dilations '${a}'`),{x:()=>OA(r.shape,e,s,o,i,l),filter:()=>d1(r,e,s.shape,o,i,l)}}},vJ={kernelName:nl,inputsToSave:["dy","filter"],gradFunc:(e,t,n)=>{let[r,s]=t,{strides:a,pad:o,dataFormat:i,dimRoundingMode:l}=n;return{dy:()=>Ba(e,s,a,o,i,1,l),filter:()=>d1(e,r,s.shape,a,o,i,l)}}};function wJ(e,t,n,r,s){let a=e;e.rank===4&&(a=J(e,[1,e.shape[0],e.shape[1],e.shape[2],e.shape[3]]));let o=t;o.rank===4&&(o=J(t,[1,t.shape[0],t.shape[1],t.shape[2],t.shape[3]])),z(a.rank===5,()=>`Error in conv3dDerFilter: input must be rank 5, but got shape ${a.shape}.`),z(o.rank===5,()=>`Error in conv3dDerFilter: dy must be rank 5, but got shape ${o.shape}.`),z(n.length===5,()=>`Error in conv3dDerFilter: filterShape must be length 5, but got ${n}.`),z(a.shape[4]===n[3],()=>`Error in conv3dDerFilter: depth of input ${a.shape[4]}) must match input depth in filter (${n[3]}.`),z(o.shape[4]===n[4],()=>`Error in conv3dDerFilter: depth of dy (${o.shape[4]}) must match output depth for filter (${n[4]}).`);let i={x:a,dy:o},l={strides:r,pad:s,filterShape:n};return G.runKernel(Ty,i,l)}var kJ=V({conv3DBackpropFilter_:wJ}),IJ={kernelName:Yp,inputsToSave:["x","filter"],gradFunc:(e,t,n)=>{let{dilations:r,strides:s,pad:a}=n;z(La(r),()=>`Error in gradient of conv3D: dilation rates greater than 1 are not yet supported in gradients. Got dilations '${r}'`);let[o,i]=t;return{x:()=>rI(o.shape,e,i,s,a),filter:()=>kJ(o,e,i.shape,s,a)}}},SJ={kernelName:rl,inputsToSave:["x"],gradFunc:(e,t)=>{let[n]=t;return{x:()=>K(Kt(t1(ke(n,"float32"))),e)}}},TJ={kernelName:$c,inputsToSave:["x"],gradFunc:(e,t)=>{let[n]=t;return{x:()=>K(n1(ke(n,"float32")),e)}}},NJ={kernelName:sl,inputsToSave:["x"],gradFunc:(e,t,n)=>{let[r]=t,{axis:s,exclusive:a,reverse:o}=n;return{x:()=>{let i=fI([s],r.rank),l=LA(e,s,a,!o);return i!=null&&(l=pt(l,i)),l}}}},CJ={kernelName:al,inputsToSave:["x","filter"],gradFunc:(e,t,n)=>{let{dilations:r,strides:s,pad:a,dimRoundingMode:o}=n,i=r==null?[1,1]:r;z(La(i),()=>`Error in gradient of depthwiseConv2dNative: dilation rates greater than 1 are not yet supported. Got dilations '${i}'`);let[l,u]=t;return z(l.rank===4,()=>`Error in gradient of depthwiseConv2dNative: input must be rank 4, but got rank ${l.rank}.`),z(u.rank===4,()=>`Error in gradient of depthwiseConv2dNative: filter must be rank 4, but got rank ${u.rank}.`),z(l.shape[3]===u.shape[2],()=>`Error in gradient of depthwiseConv2d: number of input channels (${l.shape[3]}) must match the inChannels dimension in filter ${u.shape[2]}.`),z(_s(s,i),()=>`Error in gradient of depthwiseConv2d: Either strides or dilations must be 1. Got strides ${s} and dilations '${i}'.`),o!=null&&z(mn(a),()=>`Error in depthwiseConv2d: pad must be an integer when using, dimRoundingMode ${o} but got pad ${a}.`),{x:()=>DI(l.shape,e,u,s,a,r,o),filter:()=>RI(l,e,u.shape,s,a,r,o)}}},EJ={kernelName:Jp,inputsToSave:["x","filter"],gradFunc:(e,t,n)=>{let[r,s]=t,a={x:r,filter:s,dy:e},o={x:r,filter:s,dy:e};return{x:()=>G.runKernel(Ry,a,n),filter:()=>G.runKernel(Dy,o,n)}}},$J={kernelName:Dc,outputsToSave:[!0],gradFunc:(e,t)=>{let[n]=t,r={dy:e,y:n};return{x:()=>G.runKernel(My,r)}}},_J={kernelName:Fc,inputsToSave:["x"],gradFunc:(e,t)=>{let[n]=t,r=K(Kr(Kt(wt(n))),2/Math.sqrt(Math.PI));return{x:()=>K(e,r)}}},RJ={kernelName:Eo,outputsToSave:[!0],gradFunc:(e,t)=>{let[n]=t;return{x:()=>K(e,n)}}},DJ={kernelName:Mc,inputsToSave:["input"],gradFunc:(e,t)=>{let[n]=t;return{input:()=>J(e,n.shape)}}},FJ={kernelName:ll,inputsToSave:["x"],gradFunc:(e,t)=>{let[n]=t;return{x:()=>K(e,Kr(n))}}},MJ={kernelName:$o,gradFunc:e=>({x:()=>rt(e)})},OJ={kernelName:ul,inputsToSave:["a","b"],gradFunc:(e,t)=>{let[n,r]=t,s=Rt(n.shape,r.shape);return{a:()=>{let i=Re(e,ke(r,"float32")),l=ln(n.shape,s);return l.length>0?J(_e(i,l),n.shape):i},b:()=>{let i=K(e,ke(n,"float32")),l=ln(r.shape,s);l.length>0&&(i=J(_e(i,l),r.shape));let u=wt(r);return Kt(Re(i,ke(u,"float32")))}}}},PJ={kernelName:cl,inputsToSave:["x","mean","variance","scale"],gradFunc:(e,t,n)=>{let{varianceEpsilon:r}=n,[s,a,o,i]=t,l=i==null?Fe(1):i,u=ln(a.shape,s.shape),c=[];if(a.rank===1){for(let b=0;ba.rank===1?J(K(K(e,Yo(J(p,[1,1,1,a.shape[0]]),c)),l),s.shape):J(K(K(e,p),l),s.shape),mean:()=>{let b=K(K(p,Fe(-1)),h);return a.rank===1&&(b=_e(b,u)),J(b,a.shape)},variance:()=>{let b=K(K(f,d),h);return a.rank===1&&(b=_e(b,u)),J(b,a.shape)},scale:()=>{let b=K(d,p),v=K(e,b);return a.rank===1&&(v=_e(v,u)),J(v,a.shape)},offset:()=>{let b=e;return a.rank===1&&(b=_e(b,u)),J(b,a.shape)}}}},zJ={kernelName:Pc,inputsToSave:["x","indices"],gradFunc:(e,t,n)=>{let[r,s]=t,{axis:a}=n,o=jr(a,r.shape)[0];return{x:()=>{let l=r.shape,u=s.size,c=l.slice(0,o),d=c.length,h=l.slice(a,l.length).slice(1),p=h.length,f=qI(0,d),m=qI(d+1,d+1+p),g=KI([c,[u],h]),y=J(e,g),A=J(s,[u]),x=KI([[d],f,m]),b=pt(y,x),v=NI(b,A,r.shape[o]),w=GA(x);return v=pt(v,w),v},indices:()=>s}}};function qI(e,t){let n=[];for(let r=e;r{let[n,r]=t;return{a:()=>rt(n),b:()=>rt(r)}}},BJ={kernelName:hl,gradFunc:e=>({x:()=>ke(e,"float32")})},WJ={kernelName:Lc,gradFunc:e=>({x:()=>rt(e)})},VJ={kernelName:Bc,gradFunc:e=>({x:()=>rt(e)})},UJ={kernelName:Wc,gradFunc:e=>({x:()=>rt(e)})},HJ={kernelName:pl,inputsToSave:["x"],gradFunc:(e,t,n)=>{let[r]=t,{alpha:s}=n,a=_r(r,0);return{x:()=>Ln(a,e,K(e,s))}}},GJ={kernelName:Vc,inputsToSave:["x"],gradFunc:(e,t)=>{let[n]=t;return{x:()=>Re(e,pe(n,1))}}},jJ={kernelName:Ro,inputsToSave:["x"],gradFunc:(e,t)=>{let[n]=t;return{x:()=>Re(e,ke(n,"float32"))}}},qJ={kernelName:tH,inputsToSave:[],outputsToSave:[!0],gradFunc:(e,t,n)=>{let[r]=t,{axis:s}=n;return{logits:()=>{let a=!0,o=Kr(r);return Ne(e,K(_e(e,s,a),o))}}}};function KJ(e,t,n,r=5,s=1,a=1,o=.5){let i={x:e,y:t,dy:n},l={depthRadius:r,bias:s,alpha:a,beta:o};return G.runKernel(By,i,l)}var XJ=V({localResponseNormalizationBackprop_:KJ}),ZJ={kernelName:nf,inputsToSave:["x"],outputsToSave:[!0],gradFunc:(e,t,n)=>{let[r,s]=t,{depthRadius:a,bias:o,alpha:i,beta:l}=n;return{x:()=>XJ(r,s,e,a,o,i,l)}}};function XI(e,t,n,r){return t.rankK(e,ke(Zo(n,t),e.dtype))}}var ZI={kernelName:gl,inputsToSave:["x"],outputsToSave:[!0],gradFunc:(e,t,n)=>{let r=n,{reductionIndices:s}=r,a=t[0],o=t[1],i=jr(s,a.shape),l=XI(e,o,a,i);return{x:()=>l.x()}}},YJ={kernelName:Do,inputsToSave:["a","b"],gradFunc:(e,t)=>{let[n,r]=t;return{a:()=>K(e,ke(Jo(n,r),"float32")),b:()=>K(e,ke(WA(n,r),"float32"))}}};function JJ(e,t,n,r,s,a,o){let i=O(e,"dy","maxPool3dGrad"),l=O(t,"input","maxPool3dGrad"),u=O(n,"output","maxPool3dGrad"),c=i,d=l,h=u,p=!1;l.rank===4&&(p=!0,c=J(i,[1,i.shape[0],i.shape[1],i.shape[2],i.shape[3]]),d=J(l,[1,l.shape[0],l.shape[1],l.shape[2],l.shape[3]]),h=J(u,[1,u.shape[0],u.shape[1],u.shape[2],u.shape[3]])),z(c.rank===5,()=>`Error in maxPool3dGrad: dy must be rank 5 but got rank ${c.rank}.`),z(d.rank===5,()=>`Error in maxPool3dGrad: input must be rank 5 but got rank ${d.rank}.`),z(h.rank===5,()=>`Error in maxPool3dGrad: output must be rank 5 but got rank ${h.rank}.`),o!=null&&z(mn(a),()=>`Error in maxPool3dGrad: pad must be an integer when using, dimRoundingMode ${o} but got pad ${a}.`);let f={dy:c,input:d,output:h},m={filterSize:r,strides:s,pad:a,dimRoundingMode:o},g=G.runKernel(Vy,f,m);return p?J(g,[g.shape[1],g.shape[2],g.shape[3],g.shape[4]]):g}var QJ=V({maxPool3dGrad_:JJ}),eQ={kernelName:rf,inputsToSave:["x"],outputsToSave:[!0],gradFunc:(e,t,n)=>{let[r,s]=t,{filterSize:a,strides:o,pad:i,dimRoundingMode:l}=n;return{x:()=>QJ(e,r,s,a,o,i,l)}}};function tQ(e,t,n,r,s,a,o){let i=O(e,"dy","maxPoolGrad"),l=O(t,"input","maxPoolGrad"),u=O(n,"output","maxPoolGrad");z(l.rank===i.rank,()=>`Rank of input (${l.rank}) does not match rank of dy (${i.rank})`),z(i.rank===4,()=>`Error in maxPoolGrad: dy must be rank 4 but got rank ${i.rank}.`),z(l.rank===4,()=>`Error in maxPoolGrad: input must be rank 4 but got rank ${l.rank}.`),o!=null&&z(mn(a),()=>`Error in maxPoolGrad: pad must be an integer when using, dimRoundingMode ${o} but got pad ${a}.`);let c={dy:i,input:l,output:u},d={filterSize:r,strides:s,pad:a,dimRoundingMode:o};return G.runKernel(Wy,c,d)}var nQ=V({maxPoolGrad_:tQ}),rQ={kernelName:yl,inputsToSave:["x"],outputsToSave:[!0],gradFunc:(e,t,n)=>{let[r,s]=t,{filterSize:a,strides:o,pad:i}=n;return{x:()=>nQ(e,r,s,a,o,i)}}},sQ={kernelName:Al,inputsToSave:["x"],gradFunc:(e,t,n)=>{let[r]=t,{axis:s}=n,a=jr(s,r.shape),i=pI(r.shape,a)[1],l=on(i);return{x:()=>{let c=r.shape.slice();a.forEach(p=>{c[p]=1});let d=J(e,c);return Re(K(d,la(r.shape,"float32")),l)}}}},aQ={kernelName:xl,inputsToSave:["x"],outputsToSave:[!0],gradFunc:(e,t,n)=>{let r=n,{axis:s}=r,[a,o]=t,i=jr(s,a.shape),l=XI(e,o,a,i);return{x:()=>l.x()}}},oQ={kernelName:Fo,inputsToSave:["a","b"],gradFunc:(e,t)=>{let[n,r]=t;return{a:()=>K(e,ke(Qo(n,r),"float32")),b:()=>K(e,ke(_r(n,r),"float32"))}}},iQ={kernelName:bl,inputsToSave:["x"],gradFunc:(e,t,n)=>{let r=t[0],{paddings:s}=n,a=s.map(o=>o[0]);return{x:()=>nt(e,a,r.shape)}}},lQ={kernelName:Hc,inputsToSave:["a","b"],gradFunc:(e,t)=>{let[n,r]=t,s=Rt(n.shape,r.shape);return{a:()=>{let i=ln(n.shape,s);return i.length>0?J(_e(e,i),n.shape):e},b:()=>{let i=K(e,Kt(Ed(Re(n,r)))),l=ln(r.shape,s);return l.length>0?J(_e(i,l),r.shape):i}}}},uQ={kernelName:Mo,inputsToSave:["a","b"],gradFunc:(e,t)=>{let[n,r]=t,s=Rt(n.shape,r.shape);return{a:()=>{let i=K(e,ke(r,"float32")),l=ln(n.shape,s);return l.length>0?J(_e(i,l),n.shape):i},b:()=>{let i=K(e,ke(n,"float32")),l=ln(r.shape,s);return l.length>0?J(_e(i,l),r.shape):i}}}},cQ={kernelName:Gc,gradFunc:e=>({x:()=>Kt(e)})},dQ={kernelName:wl,inputsToSave:["indices"],gradFunc:(e,t)=>{let n=t[0];return{indices:()=>un(n.shape,"float32")}}},hQ={kernelName:Xc,gradFunc:e=>({x:()=>rt(e)})},pQ={kernelName:Zc,saveAllInputs:!0,gradFunc:(e,t,n)=>{let{axis:r}=n;return ls(e,r).map(a=>()=>a)}},YI={kernelName:kl,inputsToSave:["x"],gradFunc:(e,t,n)=>{let r=t[0],{paddings:s}=n,a=s.map(o=>o[0]);return{x:()=>nt(e,a,r.shape)}}},fQ={kernelName:Il,inputsToSave:["a","b"],outputsToSave:[!0],gradFunc:(e,t)=>{let[n,r,s]=t,a=n,o=r,i=Rt(a.shape,o.shape);return{a:()=>{let c=ke(o,"float32"),d=K(e,K(c,Va(a,Ne(c,Fe(1))))),h=ln(a.shape,i);return h.length>0&&(d=_e(d,h)),J(d,a.shape)},b:()=>{let c=_r(a,0),d=Ln(c,Rr(a),rt(a)),h=K(e,K(s,d)),p=ln(o.shape,i);return p.length>0&&(h=_e(h,p)),J(h,o.shape)}}}},mQ={kernelName:Sl,inputsToSave:["x","alpha"],gradFunc:(e,t)=>{let[n,r]=t,s=_r(n,0);return{x:()=>Ln(s,e,K(e,r)),alpha:()=>{let a=Ln(s,rt(e),K(e,n)),o=ln(r.shape,e.shape);return o.length>0&&(a=_e(a,o)),J(a,r.shape)}}}},gQ={kernelName:ol,inputsToSave:["a","b"],gradFunc:(e,t)=>{let[n,r]=t,s=Rt(n.shape,r.shape);return{a:()=>{let i=Re(e,ke(r,"float32")),l=ln(n.shape,s);return l.length>0?J(_e(i,l),n.shape):i},b:()=>{let i=K(e,ke(n,"float32")),l=ln(r.shape,s);l.length>0&&(i=J(_e(i,l),r.shape));let u=wt(r);return Kt(Re(i,ke(u,"float32")))}}}},yQ={kernelName:Jc,inputsToSave:["x"],gradFunc:(e,t)=>{let[n]=t;return{x:()=>Re(e,Kt(wt(n)))}}},AQ={kernelName:Cl,inputsToSave:["x"],gradFunc:(e,t)=>{let[n]=t,r=K(Qo(n,6),Fd(n));return{x:()=>K(e,ke(r,"float32"))}}},xQ={kernelName:Tl,inputsToSave:["x"],gradFunc:(e,t)=>{let[n]=t;return{x:()=>K(e,ke(Fd(n),"float32"))}}},bQ={kernelName:Qc,inputsToSave:["x"],gradFunc:(e,t)=>{let[n]=t;return{x:()=>J(e,n.shape)}}},vQ={kernelName:Nl,inputsToSave:["images"],gradFunc:(e,t,n)=>{let[r]=t,s={dy:e,images:r};return{images:()=>G.runKernel(qy,s,n)}}},wQ={kernelName:af,inputsToSave:["images"],gradFunc:(e,t,n)=>{let[r]=t,s={dy:e,images:r};return{images:()=>G.runKernel(jy,s,n)}}},kQ={kernelName:El,gradFunc:(e,t,n)=>{let{dims:r}=n,s=jr(r,e.shape);return{x:()=>Fr(e,s)}}},IQ={kernelName:$l,gradFunc:e=>({x:()=>rt(e)})},SQ={kernelName:Oo,inputsToSave:["x"],gradFunc:(e,t)=>{let[n]=t;return{x:()=>Kt(Re(e,K(Va(n,1.5),2)))}}},TQ={kernelName:td,inputsToSave:["condition"],gradFunc:(e,t)=>{let[n]=t;return{condition:()=>ke(rt(n),"float32"),t:()=>K(e,ke(n,e.dtype)),e:()=>K(e,ke(Ef(n),e.dtype))}}},NQ={kernelName:nd,inputsToSave:["x"],gradFunc:(e,t)=>{let[n]=t;return{x:()=>{let r=_r(n,Fe(0)),s=Fe(WI),a=Fe(VI),o=K(e,a),i=K(K(e,s),Kr(ke(n,"float32")));return Ln(r,o,i)}}}},CQ={kernelName:Rl,outputsToSave:[!0],gradFunc:(e,t)=>{let[n]=t;return{x:()=>K(e,K(n,Ne(Fe(1),n)))}}},EQ={kernelName:ad,gradFunc:e=>({x:()=>rt(e)})},$Q={kernelName:_l,inputsToSave:["x"],gradFunc:(e,t)=>{let[n]=t;return{x:()=>K(Nf(ke(n,"float32")),e)}}},_Q={kernelName:sd,inputsToSave:["x"],gradFunc:(e,t)=>{let[n]=t;return{x:()=>K(zA(ke(n,"float32")),e)}}},RQ={kernelName:rd,inputsToSave:["x"],gradFunc:(e,t,n)=>{let[r]=t,{begin:s,size:a}=n,o=r.shape,[i,l]=L6(r,s,a),u=[];for(let c=0;cWa(e,u)}}},DQ={kernelName:Ml,outputsToSave:[!0],gradFunc:(e,t,n)=>{let[r]=t,{dim:s}=n,a=!0,o=K(e,r);return{logits:()=>Ne(o,K(_e(o,[s],a),r))}}},FQ={kernelName:od,inputsToSave:["x"],gradFunc:(e,t)=>{let[n]=t;return{x:()=>K(e,Rs(n))}}},JI={kernelName:of,gradFunc:(e,t,n)=>{let{blockShape:r,paddings:s}=n;return{x:()=>Tf(e,r,s)}}},QI={kernelName:id,gradFunc:(e,t,n)=>{let{axis:r}=n;return{x:()=>en(e,r)}}},MQ={kernelName:Dl,inputsToSave:["x"],gradFunc:(e,t)=>{let[n]=t;return{x:()=>Re(e,K($n(ke(n,"float32")),2))}}},OQ={kernelName:lf,inputsToSave:["x"],gradFunc:(e,t)=>{let[n]=t;return{x:()=>K(e,K(ke(n,"float32"),2))}}},PQ={kernelName:Po,inputsToSave:["a","b"],gradFunc:(e,t)=>{let[n,r]=t,s=Fe(2);return{a:()=>K(e,K(s,Ne(n,r))),b:()=>K(e,K(s,Ne(r,n)))}}},zQ={kernelName:Bo,gradFunc:e=>({x:()=>rt(e)})},LQ={kernelName:zo,inputsToSave:["a","b"],gradFunc:(e,t)=>{let[n,r]=t,s=Rt(n.shape,r.shape);return{a:()=>{let i=e,l=ln(n.shape,s);return l.length>0&&(i=_e(i,l)),J(i,n.shape)},b:()=>{let i=e,l=ln(r.shape,s);return l.length>0&&(i=_e(i,l)),J(Kt(i),r.shape)}}}},BQ={kernelName:Fl,inputsToSave:["x"],gradFunc:(e,t,n)=>{let[r]=t,s=r.shape.slice(),{axis:a}=n;jr(a,r.shape).forEach(u=>{s[u]=1});let i=J(e,s),l=K(i,la(r.shape,"float32"));return{x:()=>l}}},WQ={kernelName:Ol,inputsToSave:["x"],gradFunc:(e,t)=>{let[n]=t;return{x:()=>Re(e,wt(Nf(n)))}}},VQ={kernelName:Pl,outputsToSave:[!0],gradFunc:(e,t)=>{let[n]=t;return{x:()=>K(Ne(Fe(1),wt(n)),e)}}},UQ={kernelName:Lo,inputsToSave:["x"],gradFunc:(e,t,n)=>{let[r]=t,{reps:s}=n;return{x:()=>{let o=rt(r);if(r.rank===1)for(let i=0;i{let r=n,{perm:s}=r,a=GA(s);return{x:()=>pt(e,a)}}},GQ={kernelName:dd,gradFunc:(e,t,n)=>{let r=n,{axis:s}=r;return{value:()=>Mr(e,s)}}},jQ={kernelName:uf,inputsToSave:["segmentIds"],gradFunc:(e,t)=>{let[n]=t;return{x:()=>qQ(e,n)}}};function qQ(e,t){let n=ia(t,rt(t)),r=$d(e,n),s=Jo(t,Fe(0,"int32")),a=r.rank-s.rank;for(let i=0;i({x:()=>rt(e)})},XQ=[jI,XY,ZY,YY,JY,QY,eJ,tJ,nJ,rJ,sJ,aJ,lJ,dJ,hJ,pJ,fJ,mJ,gJ,yJ,AJ,xJ,vJ,bJ,IJ,SJ,TJ,NJ,CJ,EJ,gQ,$J,_J,RJ,DJ,FJ,OJ,MJ,PJ,zJ,LJ,BJ,WJ,VJ,UJ,HJ,GJ,jJ,qJ,ZJ,ZI,ZI,YJ,eQ,rQ,sQ,aQ,oQ,iQ,lQ,uQ,cQ,dQ,hQ,pQ,YI,YI,fQ,mQ,yQ,AQ,xQ,bQ,vQ,wQ,kQ,IQ,SQ,TQ,NQ,CQ,EQ,$Q,_Q,RQ,DQ,FQ,JI,JI,QI,QI,MQ,PQ,OQ,zQ,LQ,BQ,WQ,VQ,UQ,HQ,GQ,jQ,KQ];for(let e of XQ)nH(e);var eS={};De(eS,{maxNorm:()=>QQ,minMaxNorm:()=>nee,nonNeg:()=>tee,unitNorm:()=>eee});var k1;function cn(){return k1==null&&(k1=VG().epsilon()),k1}function us(){return"channelsLast"}var da=class extends Error{constructor(e){super(e);Object.setPrototypeOf(this,da.prototype)}},cs=class extends Error{constructor(e){super(e);Object.setPrototypeOf(this,cs.prototype)}},q=class extends Error{constructor(e){super(e);Object.setPrototypeOf(this,q.prototype)}},Ge=class extends Error{constructor(e){super(e);Object.setPrototypeOf(this,Ge.prototype)}},tS=class extends Error{constructor(e){super(e);Object.setPrototypeOf(this,tS.prototype)}};function si(e,t){if(Array.isArray(e)){let n=[];for(let r=0;rn.toUpperCase())}var Xr={};function I1(e){if(e==null)return null;let t={};return t.className=e.getClassName(),t.config=e.getConfig(),t}function S1(e){if(!(e==null||typeof e!="object"))if(Array.isArray(e))e.forEach(t=>S1(t));else{let t=Object.keys(e);for(let n of t){let r=e[n];r!=null&&typeof r=="object"&&(!Array.isArray(r)&&r.type==="ndarray"&&typeof r.value=="number"?e[n]=r.value:S1(r))}}}function Md(e,t={},n={},r="object",s=!1){if(typeof e=="string"){let a=e,o;if(a in n)o=n[a];else if(a in Xr)o=Xr[a];else if(o=t[a],o==null)throw new q(`Unknown ${r}: ${e}. This may be due to one of the following reasons: +1. The ${r} is defined in Python, in which case it needs to be ported to TensorFlow.js or your JavaScript code. +2. The custom ${r} is defined in JavaScript, but is not registered properly with tf.serialization.registerClass().`);return o}else{let a=e;if(a.className==null||a.config==null)throw new q(`${r}: Improper config format: ${JSON.stringify(a)}. +'className' and 'config' must set.`);let o=a.className,i,l;if(o in n?[i,l]=n[o]:o in Xr?[i,l]=Xr.className:o in t&&([i,l]=t[o]),i==null)throw new q(`Unknown ${r}: ${o}. This may be due to one of the following reasons: +1. The ${r} is defined in Python, in which case it needs to be ported to TensorFlow.js or your JavaScript code. +2. The custom ${r} is defined in JavaScript, but is not registered properly with tf.serialization.registerClass().`);if(l!=null){let u={};for(let p of Object.keys(Xr))u[p]=Xr[p];for(let p of Object.keys(n))u[p]=n[p];let c=a.config;c.customObjects=u;let d={...Xr};for(let p of Object.keys(n))Xr[p]=n[p];S1(a.config);let h=l(i,a.config,n,s);return Xr={...d},h}else{let u={...Xr};for(let d of Object.keys(n))Xr[d]=n[d];let c=new i(a.config);return Xr={...u},c}}}function ZQ(e,t){return et?1:0}function Hf(e,t){return-1*ZQ(e,t)}function Ga(e){if(e==null)return e;let t=[];for(let n of e)t.indexOf(n)===-1&&t.push(n);return t}function YQ(e){if(e==null)throw new q(`Invalid value in obj: ${JSON.stringify(e)}`);for(let t in e)if(e.hasOwnProperty(t))return!1;return!0}function oi(e,t,n){if(n!=null&&e.indexOf(n)<0)throw new q(`${n} is not a valid ${t}. Valid values are ${e} or null/undefined.`)}function T1(e,t,n=0,r=Infinity){return Ds(n>=0),Ds(r>=n),Array.isArray(e)&&e.length>=n&&e.length<=r&&e.every(s=>typeof s===t)}function An(e,t){Array.isArray(e)?(k.assert(e.length>0,()=>`${t} is unexpectedly an empty array.`),e.forEach((n,r)=>An(n,`element ${r+1} of ${t}`))):k.assert(Number.isInteger(e)&&e>0,()=>`Expected ${t} to be a positive integer, but got ${rS(e)}.`)}function rS(e){return e===null?"null":Array.isArray(e)?"["+e.map(t=>rS(t)).join(",")+"]":typeof e=="string"?`"${e}"`:`${e}`}function JQ(e,t){let n=k.now(),r;return(...a)=>{let o=k.now();return o-n$n(_e(K(e,e),t,!0)))}var Od=class extends ce.Serializable{getConfig(){return{}}},C1=class extends Od{constructor(e){super();this.defaultMaxValue=2,this.defaultAxis=0,this.maxValue=e.maxValue!=null?e.maxValue:this.defaultMaxValue,this.axis=e.axis!=null?e.axis:this.defaultAxis}apply(e){return Z(()=>{let t=N1(e,this.axis),n=cr(t,0,this.maxValue);return K(e,Re(n,pe(cn(),t)))})}getConfig(){return{maxValue:this.maxValue,axis:this.axis}}};C1.className="MaxNorm";ce.registerClass(C1);var E1=class extends Od{constructor(e){super();this.defaultAxis=0,this.axis=e.axis!=null?e.axis:this.defaultAxis}apply(e){return Z(()=>Re(e,pe(cn(),N1(e,this.axis))))}getConfig(){return{axis:this.axis}}};E1.className="UnitNorm";ce.registerClass(E1);var $1=class extends Od{apply(e){return ua(e)}};$1.className="NonNeg";ce.registerClass($1);var _1=class extends Od{constructor(e){super();this.defaultMinValue=0,this.defaultMaxValue=1,this.defaultRate=1,this.defaultAxis=0,this.minValue=e.minValue!=null?e.minValue:this.defaultMinValue,this.maxValue=e.maxValue!=null?e.maxValue:this.defaultMaxValue,this.rate=e.rate!=null?e.rate:this.defaultRate,this.axis=e.axis!=null?e.axis:this.defaultAxis}apply(e){return Z(()=>{let t=N1(e,this.axis),n=pe(K(this.rate,cr(t,this.minValue,this.maxValue)),K(1-this.rate,t));return K(e,Re(n,pe(cn(),t)))})}getConfig(){return{minValue:this.minValue,maxValue:this.maxValue,rate:this.rate,axis:this.axis}}};_1.className="MinMaxNorm";ce.registerClass(_1);var aS={maxNorm:"MaxNorm",minMaxNorm:"MinMaxNorm",nonNeg:"NonNeg",unitNorm:"UnitNorm"};function dn(e){return I1(e)}function oS(e,t={}){return Md(e,ce.SerializationMap.getMap().classNameMap,t,"constraint")}function hn(e){if(e==null)return null;if(typeof e=="string"){let n={className:e in aS?aS[e]:e,config:{}};return oS(n)}else return e instanceof Od?e:oS(e)}function QQ(e){return new C1(e)}function eee(e){return new E1(e)}function tee(){return new $1}function nee(e){return new _1(e)}var iS={};De(iS,{constant:()=>See,glorotNormal:()=>Ree,glorotUniform:()=>_ee,heNormal:()=>Dee,heUniform:()=>Fee,identity:()=>Eee,leCunNormal:()=>Mee,leCunUniform:()=>Oee,ones:()=>Iee,orthogonal:()=>Pee,randomNormal:()=>Nee,randomUniform:()=>Tee,truncatedNormal:()=>Cee,varianceScaling:()=>$ee,zeros:()=>kee});var ree=["channelsFirst","channelsLast"],see=["nearest","bilinear"],aee=["valid","same","causal"],oee=["max","avg"],iee=["sum","mul","concat","ave"],nu=new Map;function Yt(e){oi(ree,"DataFormat",e)}function lee(e){oi(see,"InterpolationFormat",e)}function Or(e){oi(aee,"PaddingMode",e)}function lS(e){oi(oee,"PoolMode",e)}var Pd=[],uS="/";function ii(e,t){Pd.push(e);try{let n=t();return Pd.pop(),n}catch(n){throw Pd.pop(),n}}function uee(){return Pd.length===0?"":Pd.join(uS)+uS}function cS(e){if(!hS(e))throw new Error("Not a valid tensor name: '"+e+"'");return uee()+e}function dS(e){if(!hS(e))throw new Error("Not a valid tensor name: '"+e+"'");nu.has(e)||nu.set(e,0);let t=nu.get(e);if(nu.set(e,nu.get(e)+1),t>0){let n=`${e}_${t}`;return nu.set(n,1),n}else return e}var cee=new RegExp(/^[A-Za-z0-9][-A-Za-z0-9\._\/]*$/);function hS(e){return!!e.match(cee)}function dee(e){return e===parseInt(e.toString(),10)}function ja(e,t,n){t==null&&(t=0),n==null&&(n=e.length);let r=1;for(let s=t;st&&(t=r)}return t}function ds(e,t){if(t{if(e.shape.length!==2)throw new q(`repeat() expects a rank-2 tensor, but received a rank-${e.shape.length} tensor.`);let n=Ld(e,1);return F1(n,[1,t,1])})}function pee(e){let t=[ja(e.shape)];return e.reshape(t)}function fee(e){if(e.rank<=1)throw new q(`batchFlatten requires a minimum rank of 2. Got rank: ${e.rank}.`);let t=[e.shape[0],ja(e.shape,1)];return e.reshape(t)}function li(e,t,n){return Z(()=>{switch(e.rank){case 1:return r1(e,t,n);case 2:return wI(e,[t,0],[n,e.shape[1]]);case 3:return s1(e,[t,0,0],[n,e.shape[1],e.shape[2]]);case 4:return Mf(e,[t,0,0,0],[n,e.shape[1],e.shape[2],e.shape[3]]);case 5:return nt(e,[t,0,0,0,0],[n,e.shape[1],e.shape[2],e.shape[3],e.shape[4]]);case 6:return nt(e,[t,0,0,0,0,0],[n,e.shape[1],e.shape[2],e.shape[3],e.shape[4],e.shape[5]]);default:throw new q(`sliceAlongFirstAxis() received an unsupported tensor rank: ${e.rank}`)}})}function R1(e,t,n){return Z(()=>{switch(e.rank){case 1:return r1(e,t,n);case 2:return wI(e,[0,t],[e.shape[0],n]);case 3:return s1(e,[0,0,t],[e.shape[0],e.shape[1],n]);case 4:return Mf(e,[0,0,0,t],[e.shape[0],e.shape[1],e.shape[2],n]);default:throw new q(`sliceAlongLastAxis() received an unsupported tensor rank: ${e.rank}`)}})}function Gf(e,t,n,r){return Z(()=>{switch(e.rank){case 1:return r1(e,t,n);case 2:switch(r){case 1:return li(e,t,n);case 2:return R1(e,t,n);default:throw new q(`The axis is not within the rank of the tensor ${r}`)}case 3:switch(r){case 1:return li(e,t,n);case 2:return s1(e,[0,t,0],[e.shape[0],n,e.shape[2]]);case 3:return R1(e,t,n);default:throw new q(`The axis is not within the rank of the tensor ${r}`)}case 4:switch(r){case 1:return li(e,t,n);case 2:return Mf(e,[0,t,0,0],[e.shape[0],n,e.shape[2],e.shape[3]]);case 3:return Mf(e,[0,0,t,0],[e.shape[0],e.shape[1],n,e.shape[3]]);case 4:return R1(e,t,n);default:throw new q(`The axis is not within the rank of the tensor ${r}`)}default:throw new q(`sliceAlongLastAxis() received an unsupported tensor rank: ${e.rank}`)}})}function D1(e,t=-1){let n;return t<0&&(n=e[0].rank,n!==0?t=n:t=0),t===e[0].rank&&(t=-1),en(e,t)}function pS(e,t){switch(e.rank){case 1:return Mj([e,t]);case 2:return Pj([e,t],0);case 3:return Lj([e,t],0);case 4:return Wj([e,t],0);default:throw new q(`concatAlongFirstAxis() received an unsupported tensor rank: ${e.rank}`)}}function F1(e,t){if(Array.isArray(t)||(t=[t]),e.rank!==t.length)throw new q(`The length of input n (${t.length}) does not match the number of dimensions in input x (${e.rank})`);return Yo(e,t)}function jf(e,t=0,n=1,r,s){return PK(e,t,n,r,s)}function Fs(e,t,n,r){if(e.rank<2||t.rank<2)throw new Ge(`dot requires both inputs to be rank >= 2 but got x shape = ${e.shape} and y shape = ${t.shape}`);if(t.rank>=3){let s=e.shape.slice(-1)[0],a=t.shape.slice(-2)[0];if(s!==a)throw new Ge(`If rank y >= 3, then the second last dim of y must equal the last dim of x but got x shape = ${e.shape} and y shape = ${t.shape}`)}if(e.rank===2&&t.rank===2){let s=!1,a=!1;return ti.matMul({a:e,b:t,transposeA:s,transposeB:a,bias:r?M1(e.rank,r,us()):null,activation:n})}else{let s=e.shape.slice(),a=s.pop();e=e.reshape([-1,a]);let o=t.shape.slice(),i=o.pop(),l=o.pop(),u=[...o,i],c=Array.from({length:t.rank},(f,m)=>m===0?t.rank-2:m<=t.rank-2?m-1:m);t=t.transpose(c).reshape([l,-1]);let d=[...s,...u],h=!1,p=!1;return ti.matMul({a:e,b:t,transposeA:h,transposeB:p,bias:r?M1(e.rank,r,us()):null,activation:n}).reshape(d)}}function fS(e,t,n){return Z(()=>(Array.isArray(t)?t=_n(t,"int32"):t=t.toInt(),$d(e,t,n)))}function Bd(e){return K(e,e)}function M1(e,t,n){let r=t.shape;if(t.rank!==1&&t.rank!==e)throw new q(`Unexpected bias dimensions: ${t.rank}; expected it to be 1 or ${e}`);if(e===5){if(n==="channelsFirst")return r.length===1?t.reshape([1,r[0],1,1,1]):t.reshape([1,r[3],r[0],r[1],r[2]]);if(n==="channelsLast")return r.length===1?t.reshape([1,1,1,1,r[0]]):t.reshape([1].concat(r))}else if(e===4){if(n==="channelsFirst")return r.length===1?t.reshape([1,r[0],1,1]):t.reshape([1,r[2],r[0],r[1]]);if(n==="channelsLast")return r.length===1?t.reshape([1,1,1,r[0]]):t.reshape([1].concat(r))}else if(e===3){if(n==="channelsFirst")return r.length===1?t.reshape([1,r[0],1]):t.reshape([1,r[1],r[0]]);if(n==="channelsLast")return r.length===1?t.reshape([1,1,r[0]]):t.reshape([1].concat(r))}else if(e<3)return t;throw new q(`Unsupported input rank by biasAdd: ${t.rank}`)}function hs(e,t,n){return Z(()=>(n==null&&(n=us()),Yt(n),e.add(M1(e.rank,t,n))))}function mee(e,t=1){if(t!==1)throw new Ge(`Support for alpha values other than 1 (${t}) is not implemented yet.`);return Nd(e)}function gee(e){return Z(()=>Re(e,yn(e).add(1)))}function mS(e,t,n,r){return Z(()=>zX(e,t,n,r))}function yee(e){return Z(()=>{let t=pe(.5,K(.2,e));return cr(t,0,1)})}function Wd(e,t,n=!1){return n?e():t()}var Aee=["fanIn","fanOut","fanAvg"],xee=["normal","uniform","truncatedNormal"];function bee(e){oi(Aee,"FanMode",e)}function vee(e){oi(xee,"Distribution",e)}var Zr=class extends ce.Serializable{fromConfigUsesCustomObjects(){return!1}getConfig(){return{}}},O1=class extends Zr{apply(e,t){return un(e,t)}};O1.className="Zeros";ce.registerClass(O1);var qf=class extends Zr{apply(e,t){return la(e,t)}};qf.className="Ones";ce.registerClass(qf);var P1=class extends Zr{constructor(e){super();if(typeof e!="object")throw new q(`Expected argument of type ConstantConfig but got ${e}`);if(e.value===void 0)throw new q(`config must have value set but got ${e}`);this.value=e.value}apply(e,t){return Z(()=>K(Fe(this.value),la(e,t)))}getConfig(){return{value:this.value}}};P1.className="Constant";ce.registerClass(P1);var z1=class extends Zr{constructor(e){super();this.DEFAULT_MINVAL=-.05,this.DEFAULT_MAXVAL=.05,this.minval=e.minval||this.DEFAULT_MINVAL,this.maxval=e.maxval||this.DEFAULT_MAXVAL,this.seed=e.seed}apply(e,t){return Rd(e,this.minval,this.maxval,t)}getConfig(){return{minval:this.minval,maxval:this.maxval,seed:this.seed}}};z1.className="RandomUniform";ce.registerClass(z1);var L1=class extends Zr{constructor(e){super();this.DEFAULT_MEAN=0,this.DEFAULT_STDDEV=.05,this.mean=e.mean||this.DEFAULT_MEAN,this.stddev=e.stddev||this.DEFAULT_STDDEV,this.seed=e.seed}apply(e,t){if(t=t||"float32",t!=="float32"&&t!=="int32")throw new Ge(`randomNormal does not support dType ${t}.`);return jf(e,this.mean,this.stddev,t,this.seed)}getConfig(){return{mean:this.mean,stddev:this.stddev,seed:this.seed}}};L1.className="RandomNormal";ce.registerClass(L1);var B1=class extends Zr{constructor(e){super();this.DEFAULT_MEAN=0,this.DEFAULT_STDDEV=.05,this.mean=e.mean||this.DEFAULT_MEAN,this.stddev=e.stddev||this.DEFAULT_STDDEV,this.seed=e.seed}apply(e,t){if(t=t||"float32",t!=="float32"&&t!=="int32")throw new Ge(`truncatedNormal does not support dType ${t}.`);return l1(e,this.mean,this.stddev,t,this.seed)}getConfig(){return{mean:this.mean,stddev:this.stddev,seed:this.seed}}};B1.className="TruncatedNormal";ce.registerClass(B1);var W1=class extends Zr{constructor(e){super();this.gain=e.gain!=null?e.gain:1}apply(e,t){return Z(()=>{if(e.length!==2||e[0]!==e[1])throw new q("Identity matrix initializer can only be used for 2D square matrices.");return K(this.gain,uI(e[0]))})}getConfig(){return{gain:this.gain}}};W1.className="Identity";ce.registerClass(W1);function wee(e,t="channelsLast"){let n,r;if(Yt(t),e.length===2)n=e[0],r=e[1];else if([3,4,5].indexOf(e.length)!==-1){if(t==="channelsFirst"){let s=ja(e,2);n=e[1]*s,r=e[0]*s}else if(t==="channelsLast"){let s=ja(e,0,e.length-2);n=e[e.length-2]*s,r=e[e.length-1]*s}}else{let s=ja(e);n=Math.sqrt(s),r=Math.sqrt(s)}return[n,r]}var Qn=class extends Zr{constructor(e){super();if(e.scale<0)throw new q(`scale must be a positive float. Got: ${e.scale}`);this.scale=e.scale==null?1:e.scale,this.mode=e.mode==null?"fanIn":e.mode,bee(this.mode),this.distribution=e.distribution==null?"normal":e.distribution,vee(this.distribution),this.seed=e.seed}apply(e,t){let n=wee(e),r=n[0],s=n[1],a=this.scale;if(this.mode==="fanIn"?a/=Math.max(1,r):this.mode==="fanOut"?a/=Math.max(1,s):a/=Math.max(1,(r+s)/2),this.distribution==="normal"){let o=Math.sqrt(a);if(t=t||"float32",t!=="float32"&&t!=="int32")throw new Ge(`${this.getClassName()} does not support dType ${t}.`);return l1(e,0,o,t,this.seed)}else{let o=Math.sqrt(3*a);return Rd(e,-o,o,t)}}getConfig(){return{scale:this.scale,mode:this.mode,distribution:this.distribution,seed:this.seed}}};Qn.className="VarianceScaling";ce.registerClass(Qn);var Kf=class extends Qn{constructor(e){super({scale:1,mode:"fanAvg",distribution:"uniform",seed:e==null?null:e.seed})}getClassName(){return Qn.className}};Kf.className="GlorotUniform";ce.registerClass(Kf);var Xf=class extends Qn{constructor(e){super({scale:1,mode:"fanAvg",distribution:"normal",seed:e==null?null:e.seed})}getClassName(){return Qn.className}};Xf.className="GlorotNormal";ce.registerClass(Xf);var Zf=class extends Qn{constructor(e){super({scale:2,mode:"fanIn",distribution:"normal",seed:e==null?null:e.seed})}getClassName(){return Qn.className}};Zf.className="HeNormal";ce.registerClass(Zf);var Yf=class extends Qn{constructor(e){super({scale:2,mode:"fanIn",distribution:"uniform",seed:e==null?null:e.seed})}getClassName(){return Qn.className}};Yf.className="HeUniform";ce.registerClass(Yf);var Jf=class extends Qn{constructor(e){super({scale:1,mode:"fanIn",distribution:"normal",seed:e==null?null:e.seed})}getClassName(){return Qn.className}};Jf.className="LeCunNormal";ce.registerClass(Jf);var Qf=class extends Qn{constructor(e){super({scale:1,mode:"fanIn",distribution:"uniform",seed:e==null?null:e.seed})}getClassName(){return Qn.className}};Qf.className="LeCunNormal";ce.registerClass(Qf);var V1=class extends Zr{constructor(e){super();if(this.DEFAULT_GAIN=1,this.gain=e.gain==null?this.DEFAULT_GAIN:e.gain,this.seed=e.seed,this.seed!=null)throw new Ge("Random seed is not implemented for Orthogonal Initializer yet.")}apply(e,t){return Z(()=>{if(e.length<2)throw new Ge("Shape must be at least 2D.");e[0]*e[1]>2e3&&console.warn(`Orthogonal initializer is being called on a matrix with more than 2000 (${e[0]*e[1]}) elements: Slowness may result.`);let n=e[0]>e[1]?[e[1],e[0]]:e,r=jf(n,0,1,"float32"),s=uY.gramSchmidt(r);return e[0]>e[1]&&(s=s.transpose()),K(this.gain,s)})}getConfig(){return{gain:this.gain,seed:this.seed}}};V1.className="Orthogonal";ce.registerClass(V1);var gS={constant:"Constant",glorotNormal:"GlorotNormal",glorotUniform:"GlorotUniform",heNormal:"HeNormal",heUniform:"HeUniform",identity:"Identity",leCunNormal:"LeCunNormal",leCunUniform:"LeCunUniform",ones:"Ones",orthogonal:"Orthogonal",randomNormal:"RandomNormal",randomUniform:"RandomUniform",truncatedNormal:"TruncatedNormal",varianceScaling:"VarianceScaling",zeros:"Zeros"};function yS(e,t={}){return Md(e,ce.SerializationMap.getMap().classNameMap,t,"initializer")}function Ht(e){return I1(e)}function zt(e){if(typeof e=="string"){let t=e in gS?gS[e]:e;if(t==="GlorotNormal")return new Xf;if(t==="GlorotUniform")return new Kf;if(t==="HeNormal")return new Zf;if(t==="HeUniform")return new Yf;if(t==="LeCunNormal")return new Jf;if(t==="LeCunUniform")return new Qf;{let n={};return n.className=t,n.config={},yS(n)}}else return e instanceof Zr?e:yS(e)}function kee(){return new O1}function Iee(){return new qf}function See(e){return new P1(e)}function Tee(e){return new z1(e)}function Nee(e){return new L1(e)}function Cee(e){return new B1(e)}function Eee(e){return new W1(e)}function $ee(e){return new Qn(e)}function _ee(e){return new Kf(e)}function Ree(e){return new Xf(e)}function Dee(e){return new Zf(e)}function Fee(e){return new Yf(e)}function Mee(e){return new Jf(e)}function Oee(e){return new Qf(e)}function Pee(e){return new V1(e)}var AS={};De(AS,{Layer:()=>st,RNN:()=>fa,RNNCell:()=>Kd,activation:()=>Ane,add:()=>Nne,alphaDropout:()=>cre,average:()=>Cne,averagePooling1d:()=>u5,averagePooling2d:()=>c5,averagePooling3d:()=>d5,avgPool1d:()=>Pne,avgPool2d:()=>Lne,avgPool3d:()=>Wne,avgPooling1d:()=>zne,avgPooling2d:()=>Bne,avgPooling3d:()=>Vne,batchNormalization:()=>Fne,bidirectional:()=>nre,concatenate:()=>Ene,conv1d:()=>une,conv2d:()=>cne,conv2dTranspose:()=>dne,conv3d:()=>hne,conv3dTranspose:()=>pne,convLstm2d:()=>Jne,convLstm2dCell:()=>Qne,cropping2D:()=>mne,dense:()=>xne,depthwiseConv2d:()=>yne,dot:()=>Dne,dropout:()=>bne,elu:()=>rne,embedding:()=>Tne,flatten:()=>wne,gaussianDropout:()=>ure,gaussianNoise:()=>lre,globalAveragePooling1d:()=>Une,globalAveragePooling2d:()=>Hne,globalMaxPool1d:()=>sre,globalMaxPool2d:()=>are,globalMaxPooling1d:()=>_8,globalMaxPooling2d:()=>R8,gru:()=>jne,gruCell:()=>qne,input:()=>YS,inputLayer:()=>nne,layerNormalization:()=>Mne,leakyReLU:()=>ane,lstm:()=>Kne,lstmCell:()=>Xne,masking:()=>dre,maxPool1d:()=>ore,maxPool2d:()=>ire,maxPooling1d:()=>D8,maxPooling2d:()=>F8,maxPooling3d:()=>Gne,maximum:()=>$ne,minimum:()=>_ne,multiply:()=>Rne,permute:()=>Sne,prelu:()=>one,reLU:()=>sne,repeatVector:()=>kne,reshape:()=>Ine,rnn:()=>ere,separableConv2d:()=>fne,simpleRNN:()=>Zne,simpleRNNCell:()=>Yne,softmax:()=>ine,spatialDropout1d:()=>vne,stackedRNNCells:()=>tre,thresholdedReLU:()=>lne,timeDistributed:()=>rre,upSampling2d:()=>gne,zeroPadding2d:()=>One});var zee=0;function xS(){return zee++}var em={};function tm(e=""){return e in em||(em[e]=0),em[e]+=1,e+em[e].toString()}function U1(e){return Array.isArray(e)&&Array.isArray(e[0])}function nm(e){return e.length===0?[]:Array.isArray(e[0])?e:[e]}function Ke(e){let t;if(Array.isArray(e)){if(e.length!==1)throw new q(`Expected Tensor length to be 1; got ${e.length}`);t=e[0]}else t=e;return t}function At(e){if(Array.isArray(e)&&Array.isArray(e[0])){if(e.length===1)return e=e,e[0];throw new q(`Expected exactly 1 Shape; got ${e.length}`)}else return e}function rm(e){let t=0;for(let n of e)n.shape.length===0?t+=1:t+=n.shape.reduce((r,s)=>r*s);return t}var bS="Variable",vS=class{constructor(e,t="float32",n=bS,r=!0,s=null){this.dtype=t==null?"float32":t,this.shape=e.shape,this.id=xS(),n=n==null?bS:n,this.originalName=cS(n),this.name=dS(this.originalName),this.trainable_=r,this.constraint=s,this.val=SX(e,this.trainable_,this.name,this.dtype)}read(){return this.assertNotDisposed(),this.val}write(e){return this.assertNotDisposed(),Lee(this.val,e),this.val.id!==e.id&&(this.val.assign(e),this.constraint!=null&&this.val.assign(this.constraint.apply(this.val))),this}dispose(){this.assertNotDisposed(),this.val.dispose()}assertNotDisposed(){if(this.val.isDisposed)throw new Error(`LayersVariable ${this.name} is already disposed.`)}get trainable(){return this.trainable_}set trainable(e){this.trainable_=e,this.val.trainable=e}};function Lee(e,t){if(e.shape.toString()!==t.shape.toString())throw new Error("Shape mismatch: "+JSON.stringify(e.shape)+" vs. "+JSON.stringify(t.shape))}function H1(e){return e.map(t=>t.read())}function G1(e){e.forEach(t=>{t[0].write(t[1])})}var tn=class{constructor(e){this.dtype=e.dtype,this.shape=e.shape,e.shape!=null?this.ndim=e.shape.length:this.ndim=e.ndim,this.maxNDim=e.maxNDim,this.minNDim=e.minNDim,this.axes=e.axes||{}}},ps=class{constructor(e,t,n,r,s,a,o){this.dtype=e,this.shape=t,this.sourceLayer=n,this.inputs=r,this.callArgs=s,this.outputTensorIndex=o,this.id=xS(),a!=null&&(this.originalName=cS(a),this.name=dS(this.originalName)),this.rank=t.length}},Bee=0,sm=class{constructor(e,t){this.callArgs=t,this.id=Bee++,this.outboundLayer=e.outboundLayer,this.inboundLayers=e.inboundLayers,this.nodeIndices=e.nodeIndices,this.tensorIndices=e.tensorIndices,this.inputTensors=e.inputTensors,this.outputTensors=e.outputTensors,this.inputMasks=e.inputMasks,this.outputMasks=e.outputMasks,this.inputShapes=e.inputShapes,this.outputShapes=e.outputShapes;for(let n of e.inboundLayers)n!=null&&n.outboundNodes.push(this);e.outboundLayer.inboundNodes.push(this)}getConfig(){let e=[];for(let t of this.inboundLayers)t!=null?e.push(t.name):e.push(null);return{outboundLayer:this.outboundLayer?this.outboundLayer.name:null,inboundLayers:e,nodeIndices:this.nodeIndices,tensorIndices:this.tensorIndices}}},Wee=0,st=class extends ce.Serializable{constructor(e={}){super();this._callHook=null,this._addedWeightNames=[],this._stateful=!1,this.id=Wee++,this.activityRegularizer=null,this.inputSpec=null,this.supportsMasking=!1,this._trainableWeights=[],this._nonTrainableWeights=[],this._losses=[],this._updates=[],this._built=!1,this.inboundNodes=[],this.outboundNodes=[];let t=e.name;if(!t){let n=this.getClassName();t=ha(n)+"_"+tm(n)}if(this.name=t,this.trainable_=e.trainable==null?!0:e.trainable,e.inputShape!=null||e.batchInputShape!=null){let n;if(e.batchInputShape!=null)n=e.batchInputShape;else if(e.inputShape!=null){let s=null;e.batchSize!=null&&(s=e.batchSize),n=[s].concat(e.inputShape)}this.batchInputShape=n;let r=e.dtype;r==null&&(r=e.inputDType),r==null&&(r="float32"),this.dtype=r}e.weights!=null?this.initialWeights=e.weights:this.initialWeights=null,this._refCount=null,this.fastWeightInitDuringBuild=!1}static nodeKey(e,t){return e.name+"_ib-"+t.toString()}getNodeAtIndex(e,t){if(this.inboundNodes.length===0)throw new cs(`The layer has never been called and thus has no defined ${t}.`);if(this.inboundNodes.length<=e)throw new q(`Asked to get ${t} at node ${e}, but the layer has only ${this.inboundNodes.length} inbound nodes.`);return this.inboundNodes[e]}getInputAt(e){return Jn(this.getNodeAtIndex(e,"input").inputTensors)}getOutputAt(e){return Jn(this.getNodeAtIndex(e,"output").outputTensors)}get input(){if(this.inboundNodes.length>1)throw new da(`Layer ${this.name} has multiple inbound nodes, hence the notion of "layer input" is ill-defined. Use \`getInputAt(nodeIndex)\` instead.`);if(this.inboundNodes.length===0)throw new da(`Layer ${this.name} is not connected, no input to return.`);return Jn(this.getNodeAtIndex(0,"input").inputTensors)}get output(){if(this.inboundNodes.length===0)throw new da(`Layer ${this.name} has no inbound nodes.`);if(this.inboundNodes.length>1)throw new da(`Layer ${this.name} has multiple inbound nodes, hence the notion of "layer output" is ill-defined. Use \`getOutputAt(nodeIndex)\` instead.`);return Jn(this.getNodeAtIndex(0,"output").outputTensors)}get losses(){return this._losses}calculateLosses(){return this.losses.map(e=>e())}get updates(){return this._updates}get built(){return this._built}set built(e){this._built=e}get trainable(){return this.trainable_}set trainable(e){this._trainableWeights.forEach(t=>t.trainable=e),this.trainable_=e}get trainableWeights(){return this.trainable_?this._trainableWeights.filter(e=>e.trainable):[]}set trainableWeights(e){this._trainableWeights=e}get nonTrainableWeights(){return this.trainable?this._trainableWeights.filter(e=>!e.trainable).concat(this._nonTrainableWeights):this._trainableWeights.concat(this._nonTrainableWeights)}set nonTrainableWeights(e){this._nonTrainableWeights=e}get weights(){return this.trainableWeights.concat(this.nonTrainableWeights)}get stateful(){return this._stateful}resetStates(){if(!this.stateful)throw new Error("Cannot call the resetStates() method of a non-stateful Layer object.")}assertInputCompatibility(e){if(e=Dt(e),this.inputSpec==null||this.inputSpec.length===0)return;let t=Dt(this.inputSpec);if(e.length!==t.length)throw new q(`Layer ${this.name} expects ${t.length} inputs, but it received ${e.length} input tensors. Input received: ${e}`);for(let n=0;ns.maxNDim)throw new q(`Input ${n} is incompatible with layer ${this.name}: expected max_ndim=${s.maxNDim}, found ndim=${a}`);if(s.minNDim!=null&&a=0?o[l]:o[o.length+l];if(u!=null&&[u,null].indexOf(c)===-1)throw new q(`Input ${n} is incompatible with layer ${this.name}: expected axis ${l} of input shape to have value ${u} but got shape ${o}.`)}}if(s.shape!=null)for(let o=0;o{if(!this.built){this.assertInputCompatibility(e);let a=[];for(let o of Dt(e))a.push(o.shape);this.build(Jn(a)),this.built=!0,this.initialWeights&&this.setWeights(this.initialWeights),this._refCount===null&&s&&(this._refCount=1)}if(this.assertInputCompatibility(e),s){let a=this.call(e,t),o=Dt(a),i=[];for(let l of o)n.indexOf(l)!==-1&&(l=l.clone()),i.push(l);if(a=Jn(i),this.activityRegularizer!=null)throw new Ge("Layer invocation in the presence of activity regularizer(s) is not supported yet.");return a}else{let a=Vee(e),o=this.computeOutputShape(a),i,l=Uee(e);if(this.warnOnIncompatibleInputShape(Array.isArray(e)?a[0]:a),o!=null&&o.length>0&&Array.isArray(o[0])?i=o.map((u,c)=>new ps(l,u,this,Dt(e),t,this.name,c)):i=new ps(l,o,this,Dt(e),t,this.name),this.addInboundNode(e,i,null,null,a,o,t),this._refCount++,this.activityRegularizer!=null)throw new Ge("Layer invocation in the presence of activity regularizer(s) is not supported yet.");return i}})}warnOnIncompatibleInputShape(e){if(this.batchInputShape!=null)if(e.length!==this.batchInputShape.length)console.warn(`The rank of the input tensor provided (shape: ${JSON.stringify(e)}) does not match that of the batchInputShape (${JSON.stringify(this.batchInputShape)}) of the layer ${this.name}`);else{let t=!1;this.batchInputShape.forEach((n,r)=>{n!=null&&e[r]!=null&&e[r]!==n&&(t=!0)}),t&&console.warn(`The shape of the input tensor (${JSON.stringify(e)}) does not match the expectation of layer ${this.name}: ${JSON.stringify(this.batchInputShape)}`)}}get outputShape(){if(this.inboundNodes==null||this.inboundNodes.length===0)throw new da(`The layer ${this.name} has never been called and thus has no defined output shape.`);let e=[];for(let t of this.inboundNodes){let n=JSON.stringify(t.outputShapes);e.indexOf(n)===-1&&e.push(n)}if(e.length===1){let t=this.inboundNodes[0].outputShapes;return Array.isArray(t)&&Array.isArray(t[0])&&t.length===1?t[0]:t}else throw new da(`The layer ${this.name} has multiple inbound nodes with different output shapes. Hence the notion of "output shape" is ill-defined for the layer.`)}countParams(){if(!this.built)throw new cs(`You tried to call countParams() on ${this.name}, but the layer is not built yet. Build it first by calling build(batchInputShape).`);return rm(this.weights)}build(e){this.built=!0}getWeights(e=!1){return H1(e?this.trainableWeights:this.weights)}setWeights(e){Z(()=>{let t=this.weights;if(t.length!==e.length)throw new q(`You called setWeights(weights) on layer "${this.name}" with a weight list of length ${e.length}, but the layer was expecting ${t.length} weights. Provided weights: ${e}...`);if(t.length===0)return;let n=[],r=H1(t);for(let s=0;ss.apply(l.read())),a==null&&(a=!0),a?this._trainableWeights.push(l):this._nonTrainableWeights.push(l),l}setFastWeightInitDuringBuild(e){this.fastWeightInitDuringBuild=e}addLoss(e){e==null||Array.isArray(e)&&e.length===0||(e=Dt(e),this._losses!==void 0&&this._losses!==null&&this.losses.push(...e))}computeOutputShape(e){return e}computeMask(e,t){if(!this.supportsMasking){if(t!=null)if(Array.isArray(t))t.forEach(n=>{if(n!=null)throw new TypeError(`Layer ${this.name} does not support masking, but was passed an inputMask.`)});else throw new TypeError(`Layer ${this.name} does not support masking, but was passed an inputMask.`);return null}return t}addInboundNode(e,t,n,r,s,a,o=null){let i=Dt(e);t=Dt(t),n=Dt(n),r=Dt(r),s=nm(s),a=nm(a);let l=[],u=[],c=[];for(let d of i)l.push(d.sourceLayer),u.push(d.nodeIndex),c.push(d.tensorIndex);new sm({outboundLayer:this,inboundLayers:l,nodeIndices:u,tensorIndices:c,inputTensors:i,outputTensors:t,inputMasks:n,outputMasks:r,inputShapes:s,outputShapes:a},o);for(let d=0;de.dispose()),this.weights.length}assertNotDisposed(){if(this._refCount===0)throw new Error(`Layer '${this.name}' is already disposed.`)}dispose(){if(!this.built)throw new Error(`Cannot dispose Layer ${this.name} because it has not been built yet.`);if(this._refCount===null)throw new Error(`Cannot dispose Layer ${this.name} because it has not been used yet.`);this.assertNotDisposed();let e=0;return--this._refCount==0&&(e=this.disposeWeights()),{refCountAfterDispose:this._refCount,numDisposedVariables:e}}};function Vee(e){e=Dt(e);let t=[];for(let n of e)t.push(n.shape);return Jn(t)}function Uee(e){return"float32"}function wS(e,t,n){if((t==null||n!=null&&n>0)&&(t=e.sourceLayer,n=e.nodeIndex),t.inboundNodes.length===0)return[e];{let r=t.inboundNodes[n];if(r.inboundLayers.length===0)return r.inputTensors;{let s=[];for(let a=0;a0){let s=await Promise.all(t);for(let a=0;ape(this.totals[r],K(s,n)));this.totals[r]=o,a!=null&&a.dispose()}}}async onEpochEnd(e,t){if(t!=null)for(let n of this.params.metrics)this.totals[n]!=null&&(typeof this.totals[n]=="number"?t[n]=this.totals[n]/this.seen:Z(()=>{let r=K(Re(1,this.seen),this.totals[n]);t[n]=r,this.totals[n].dispose(),Sn(t[n])}))}},NS=class extends au{async onTrainBegin(e){this.epoch=[],this.history={}}async onEpochEnd(e,t){t==null&&(t={}),this.epoch.push(e);for(let n in t)this.history[n]==null&&(this.history[n]=[]),this.history[n].push(t[n])}async syncData(){let e=[],t=[],n=[];for(let s in this.history){let a=this.history[s];for(let o=0;onew CS(r,t))}var Ms=class{constructor(){}static registerCallbackConstructor(e,t){k.assert(e>=0&&Number.isInteger(e),()=>`Verbosity level is expected to be an integer >= 0, but got ${e}`),Ms.checkForDuplicate(t),Ms.constructors[e]==null&&(Ms.constructors[e]=[]),Ms.constructors[e].push(t)}static checkForDuplicate(e){for(let t in Ms.constructors)Ms.constructors[+t].forEach(r=>{if(r===e)throw new q("Duplicate callback constructor.")})}static clear(){Ms.constructors={}}static createCallbacks(e){let t=[];for(let n in Ms.constructors){let r=+n;e>=r&&t.push(...Ms.constructors[r])}return t.map(n=>new n)}},j1=Ms;j1.constructors={};function $S(e,t,n,r,s,a,o,i,l){let u=new NS,c=[new Gee,...j1.createCallbacks(t)];e!=null&&c.push(...e),c.push(u);let d=new TS(c);return d.setParams({epochs:n,initialEpoch:r,samples:s,steps:a,batchSize:o,verbose:t,doValidation:i,metrics:l}),{callbackList:d,history:u}}function fs(e,t={},n=!1){return Md(e,ce.SerializationMap.getMap().classNameMap,t,"layer",n)}function am(e,t){return Z(()=>{e.dtype!=="float32"&&(e=e.asType("float32"));let n=_e(Bd(e),t,!0),r=Cd(n.shape,cn()),s=$n(ia(n,r));return Re(e,s)})}function ui(e,t){return Z(()=>Xt(Bd(Ne(t,e)),-1))}function om(e,t){return Z(()=>Xt(yn(Ne(t,e)),-1))}function ou(e,t){return Z(()=>{let n=Ne(e,t),r=cr(yn(e),cn(),Number.MAX_VALUE),s=yn(Re(n,r));return K(100,Xt(s,-1))})}function jee(e,t){return Z(()=>{let n=cr(t,cn(),Number.MAX_VALUE),r=Rr(pe(1,n)),s=cr(e,cn(),Number.MAX_VALUE),a=Rr(pe(1,s));return Xt(Bd(Ne(r,a)),-1)})}function qee(e,t){return Z(()=>{let n=ia(0,Ne(1,K(e,t)));return Xt(Bd(n),-1)})}function Kee(e,t){return Z(()=>{let n=ia(0,Ne(1,K(e,t)));return Xt(n,-1)})}function Xee(e,t){return Z(()=>{let n=_e(K(e,t),-1),r=os(K(Ne(1,e),t),-1);return ia(0,pe(1,Ne(r,n)))})}function Zee(e,t){return Z(()=>{let n=Math.log(2),r=Ne(t,e),s=Ne(pe(r,Zl(K(-2,r))),n);return Xt(s,-1)})}function Vd(e,t,n=!1){return Z(()=>{if(n)t=Of(t);else{let r=_e(t,t.shape.length-1,!0);t=Re(t,r)}return t=cr(t,cn(),1-cn()),Kt(_e(K(e.toFloat(),Rr(t)),t.shape.length-1))})}function im(e,t,n=!1){return Z(()=>{let r=Ed(pee(e)).toInt();t=cr(t,cn(),1-cn());let s=t.shape,a=kd(r,s[s.length-1]).reshape(s);return Vd(a,t,n)})}function Yee(e,t){if(!k.arraysEqual(e.shape,t.shape))throw new q(`logits and labels must have the same shape, but got shapes ${JSON.stringify(e.shape)} and ${JSON.stringify(t.shape)}`);return Z(()=>{let n=t.relu(),r=t.abs().neg();return n.sub(t.mul(e)).add(r.exp().log1p())})}function lm(e,t){return Z(()=>{let n;return n=cr(t,cn(),1-cn()),n=Rr(Re(n,Ne(1,n))),Xt(Yee(e,n),-1)})}function Jee(e,t){return Z(()=>{let n=cr(e,cn(),1),r=cr(t,cn(),1);return _e(K(e,Rr(Re(n,r))),-1)})}function Qee(e,t){return Z(()=>{let n=Rr(pe(cn(),t));return Xt(Ne(t,K(e,n)),-1)})}function q1(e,t){return Z(()=>{let n=am(e,-1),r=am(t,-1),s=K(n,r);return Kt(_e(s,-1))})}var um={meanSquaredError:ui,meanAbsoluteError:om,meanAbsolutePercentageError:ou,meanSquaredLogarithmicError:jee,squaredHinge:qee,hinge:Kee,categoricalHinge:Xee,logcosh:Zee,categoricalCrossentropy:Vd,sparseCategoricalCrossentropy:im,binaryCrossentropy:lm,kullbackLeiblerDivergence:Jee,poisson:Qee,cosineProximity:q1};function K1(e){if(typeof e=="string"){if(e in um)return um[e];let t=`Unknown loss ${e}`;throw e.toLowerCase().includes("softmaxcrossentropy")&&(t=`Unknown loss ${e}. Use "categoricalCrossentropy" as the string name for tf.losses.softmaxCrossEntropy`),new q(t)}else return e}function X1(e,t){return Z(()=>{let n=K(.5,Dr(t)),r=zd(_r(t,n),e.dtype);return Xt(Zo(e,r),-1)})}function Z1(e,t){return Z(()=>zd(Zo(kf(e,-1),kf(t,-1)),"float32"))}function _S(e,t){return Z(()=>is(e.equal(1),t.equal(1)).sum().cast("float32"))}function ete(e,t){return Z(()=>is(e.equal(1),t.equal(0)).sum().cast("float32"))}function tte(e,t){return Z(()=>is(e.equal(0),t.equal(1)).sum().cast("float32"))}function RS(e,t){return Z(()=>{let n=_S(e,t),r=tte(e,t),s=n.add(r);return Ln(_r(s,0),n.div(s),0).cast("float32")})}function nte(e,t){return Z(()=>{let n=_S(e,t),r=ete(e,t),s=n.add(r);return Ln(_r(s,0),n.div(s),0).cast("float32")})}function DS(e,t){return lm(e,t)}function FS(e,t){return e.rank===t.rank&&(e=e.squeeze([e.rank-1])),t=t.argMax(-1),t.dtype!==e.dtype&&(t=t.asType(e.dtype)),Zo(e,t).asType("float32")}var rte=ui,ste=ui,ate=om,ote=om,ite=ou,lte=ou,Y1=Vd,ute=q1,MS=im,cm={binaryAccuracy:X1,categoricalAccuracy:Z1,precision:RS,categoricalCrossentropy:Y1,sparseCategoricalCrossentropy:MS,mse:rte,MSE:ste,mae:ate,MAE:ote,mape:ite,MAPE:lte,cosine:ute};function cte(e){if(typeof e=="string"&&e in cm)return cm[e];if(typeof e!="string"&&e!=null)return e;throw new q(`Unknown metric ${e}`)}function dm(e){if(Ds(e!==null,`Unknown LossOrMetricFn ${e}`),typeof e=="string")return e;{let t;for(let n of Object.keys(um))if(um[n]===e){t=n;break}if(t!==void 0)return t;for(let n of Object.keys(cm))if(cm[n]===e){t=n;break}return t!==void 0?t:e.name}}function dte(e){let t={Adagrad:()=>tu.adagrad(.01),Adadelta:()=>tu.adadelta(1,.95,cn()),Adam:()=>tu.adam(.001,.9,.999,cn()),Adamax:()=>tu.adamax(.002,.9,.999,cn(),0),RMSProp:()=>tu.rmsprop(.001,.9,0,cn()),SGD:()=>tu.sgd(.01)};if(t.adagrad=t.Adagrad,t.adadelta=t.Adadelta,t.adam=t.Adam,t.adamax=t.Adamax,t.rmsprop=t.RMSProp,t.sgd=t.SGD,e in t)return t[e]();throw new q(`Unknown Optimizer ${e}`)}var OS=1*1024*1024;function PS(e,t,n=!1){if(e==null||typeof e!="object"||Object.getPrototypeOf(e)!==Object.prototype||!J1(e))throw new Error("User-defined metadata is expected to be a JSON object, but is not.");if(n){let r=JSON.stringify(e);r.length>OS&&console.warn(`User-defined metadata of model "${t}" is too large in size (length=${r.length} when serialized). It is not recommended to store such large objects in user-defined metadata. Please make sure its serialized length is <= ${OS}.`)}}function J1(e){if(e===null)return!0;if(typeof e=="object")if(Object.getPrototypeOf(e)===Object.prototype){let t=Object.keys(e);for(let n of t)if(typeof n!="string"||!J1(e[n]))return!1;return!0}else if(Array.isArray(e)){for(let t of e)if(!J1(t))return!1;return!0}else return!1;else{let t=typeof e;return t==="string"||t==="number"||t==="boolean"}}function hte(e,t,n,r=console.log){let s=fte(e),a=["Layer (type)","Output shape","Param #"];s?(t=t||65,n=n||[.45,.85,1]):(t=t||98,n=n||[.33,.55,.67,1]),n[n.length-1]<=1&&(n=n.map(c=>Math.floor(t*c)));let o;if(!s){a.push("Receives inputs"),o=[];for(let c in e.nodesByDepth)o.push(...e.nodesByDepth[c])}r("_".repeat(t)),hm(a,n,r),r("=".repeat(t));let i=e.layers;for(let c=0;c1||s.length===1&&s[0].inboundLayers.length>1){t=!1;break}r.push(...s)}if(t)for(let s of e.layers){let a=!1;for(let o of s.inboundNodes)if(r.indexOf(o)!==-1)if(a){t=!1;break}else a=!0;if(!t)break}return t}function hm(e,t,n=console.log){let r="";for(let s=0;s0&&(r=r.slice(0,r.length-1)+" "),r+=e[s],r=r.slice(0,t[s]),r+=" ".repeat(t[s]-r.length);n(r)}function mte(e,t,n){let r;try{r=JSON.stringify(e.outputShape)}catch(i){r="multiple"}let s=e.name,a=e.getClassName(),o=[`${s} (${a})`,r,e.countParams().toString()];hm(o,t,n)}function gte(e,t,n,r){let s;try{s=JSON.stringify(e.outputShape)}catch(c){s="multiple"}let a=[];for(let c of e.inboundNodes)if(!(n!=null&&n.length>0&&n.indexOf(c)===-1))for(let d=0;df.name),l=[],u=t.names();for(let f of i)u.indexOf(f)!==-1?l.push(t.getValue(f)):l.push(null);r!=null&&(r.maxNumTensors=-Infinity,r.minNumTensors=Infinity);let c=i.join(",")+"|"+t.names().join(","),d,h;if(tx[c]==null){let f=Ate(o,t);d=f.sorted,h=f.recipientCounts,tx[c]=d,LS[c]=h}d=tx[c],h={},s||Object.assign(h,LS[c]);let p=new ci(t);for(let f=0;fr.maxNumTensors&&(r.maxNumTensors=C),C0,()=>"Expected at least one fetch, got none");let n=[],r={};if(e.length===1){let s=BS(e[0],t);n=s.sorted,r=s.recipientMap}else{let s=new Set;for(let a of e){let{sorted:o,recipientMap:i}=BS(a,t);for(let l of o)s.has(l.name)||(n.push(l),s.add(l.name));for(let l in i)r[l]==null&&(r[l]=new Set),i[l].forEach(u=>r[l].add(u))}}return{sorted:n,recipientCounts:xte(r)}}function xte(e){let t={};for(let n in e)t[n]=e[n].size;return t}function BS(e,t){let n=new Set,r=[],s={};for(let i of t.names())n.add(i);let a=[],o=[];for(a.push(e);a.length>0;){let i=a[a.length-1];if(n.has(i.name)){a.pop();continue}let l=o[o.length-1]===a.length-1;if(i.inputs.length===0||l)a.pop(),r.push(i),n.add(i.name),l&&o.pop();else{o.push(a.length-1);for(let u of i.inputs)s[u.name]==null&&(s[u.name]=new Set),s[u.name].add(i.name),!n.has(u.name)&&a.push(u)}}return{sorted:r,recipientMap:s}}function bte(e){let t;if(e.sourceLayer.inboundNodes.length===1)t=e.sourceLayer.output;else{let n=null;for(let r=0;ry.name)}`);Ga(this.outputs).length!==this.outputs.length&&console.warn(`The list of outputs passed to the model is redundant. All outputs should only appear once. Found: ${this.outputs.map(y=>y.name)}`),this.inputLayers=[],this.inputLayersNodeIndices=[],this.inputLayersTensorIndices=[],this.outputLayers=[],this.outputLayersNodeIndices=[],this.outputLayersTensorIndices=[],this.layers=[],this.internalContainerRefs=[];for(let y of this.outputs){let A=y.sourceLayer,x=y.nodeIndex,b=y.tensorIndex;this.outputLayers.push(A),this.outputLayersNodeIndices.push(x),this.outputLayersTensorIndices.push(b)}for(let y of this.inputs){let A=y.sourceLayer,x=y.nodeIndex,b=y.tensorIndex;Ds(x===0,"input layer has >1 nodes"),Ds(b===0,"input layer has >1 tensors"),this.inputLayers.push(A),this.inputLayersNodeIndices.push(x),this.inputLayersTensorIndices.push(b)}this.inputNames=[],this.outputNames=[],this.feedInputShapes=[],this.feedInputNames=[],this.feedOutputNames=[];for(let y=0;yy.shape),this.internalOutputShapes=this.outputs.map(y=>y.shape);let t={},n={},r={},s={},a={},o=[],i=(y,A,x,b,v,w)=>{(b==null||v==null||w==null)&&(b=y.sourceLayer,v=y.nodeIndex,w=y.tensorIndex);let I=b.inboundNodes[v];if(x.indexOf(I)!==-1)throw new cs(`The tensor ${y.name} at layer "${b.name}" is part of a cycle.`);if(A.indexOf(I)!==-1)return;this.containerNodes.add(Os.nodeKey(b,v)),b.id in a||(a[b.id]=Object.keys(a).length),x.indexOf(I)===-1&&x.push(I);let T=I.inboundLayers.length;for(let C=0;C=0;)x.splice(x.indexOf(I),1);o.push(I)},l=[],u=[];for(let y of this.outputs)i(y,l,u);let c=o.slice().reverse();for(let y of c){n[y.id]=y,y.id in t||(t[y.id]=0);let A=t[y.id],x=r[y.outboundLayer.id]==null?0:r[y.outboundLayer.id];A=Math.max(A,x),r[y.outboundLayer.id]=A,s[y.outboundLayer.id]=y.outboundLayer,t[y.id]=A;for(let b=0;bparseInt(y,10)).sort(Hf);this.layers=[];for(let y of p){let A=h[y];A.sort((x,b)=>{let v=a[x.id],w=a[b.id];return vw?1:0});for(let x of A)x instanceof Os&&this.internalContainerRefs.push(x),this.layers.push(x)}this.layersByDepth=h,p=Object.keys(d).map(y=>parseInt(y,10)).sort(Hf);let f=this.inputs.slice(),m=[];for(let y of p)for(let A of d[y]){let x=A.outboundLayer;if(x!=null){for(let b of A.inputTensors)if(f.indexOf(b)===-1)throw new cs(`Graph disconnected: cannot obtain value for tensor ${b} at layer "${x.name}". The following previous layers were accessed without issue: ${m}`);for(let b of A.outputTensors)f.push(b);m.push(x.name)}}this.nodesByDepth=d;let g=this.layers.map(y=>y.name);for(let y of g){let A=g.filter(x=>x===y).length;if(A!==1)throw new cs(`The name "${y}" is used ${A} times in the model. All layer names should be unique. Layer names: `+JSON.stringify(g))}this.outboundNodes=[],this.inboundNodes=[],new sm({outboundLayer:this,inboundLayers:[],nodeIndices:[],tensorIndices:[],inputTensors:this.inputs,outputTensors:this.outputs,inputMasks:this.inputs.map(y=>null),outputMasks:this.outputs.map(y=>null),inputShapes:this.inputs.map(y=>y.shape),outputShapes:this.outputs.map(y=>y.shape)}),this.built=!0,this._refCount=1}assertNotDisposed(){if(this._refCount===0)throw new Error(`Container '${this.name}' is already disposed.`)}dispose(){this.assertNotDisposed();let e={refCountAfterDispose:null,numDisposedVariables:0};if(--this._refCount==0){for(let t of this.layers)e.numDisposedVariables+=t.dispose().numDisposedVariables;for(let t of this.internalContainerRefs)e.numDisposedVariables+=t.dispose().numDisposedVariables}return e.refCountAfterDispose=this._refCount,e}get trainable(){return this.trainable_}set trainable(e){this.layers.forEach(t=>{t._trainableWeights.forEach(n=>n.trainable=e)}),this.trainable_=e}get trainableWeights(){if(this._trainableWeights.length>0)throw new q("Container instance unexpectedly contains _trainableWeights.The trainable weights of a Container are a union of the trainable weights of its consituent Layers. Its own _trainableWeights must remain an empty Array.");if(!this.trainable)return[];let e=[];for(let t of this.layers)e=e.concat(t.trainableWeights);return e}get nonTrainableWeights(){let e=[];for(let t of this.layers)e.push(...t.nonTrainableWeights);if(!this.trainable){let t=[];for(let n of this.layers)t.push(...n.trainableWeights);return t.concat(e)}return e}get weights(){return this.trainableWeights.concat(this.nonTrainableWeights)}loadWeights(e,t=!0){let n={},r=0;for(let a of this.layers)for(let o of a.weights){if(n[o.originalName]!=null)throw new q(`Duplicate weight name: ${o.originalName}`);n[o.originalName]=o,r++}let s=[];for(let a in e){let o=a;if(n[a]==null){let i=a.split("/");o=i.slice(0,-2).concat([i[i.length-1]]).join("/")}if(n[o]!=null)s.push([n[o],e[a]]);else if(t)throw new q(`Provided weight data has no target variable: ${a}`);delete n[o]}if(t){let a=[];for(let o in n)a.push(o);if(a.length>0)throw new q(`${a.length} of ${r} weights are not set: ${a}`)}G1(s)}updatedConfig(){let e=this.getConfig(),t={};return t.className=this.getClassName(),t.config=e,t.kerasVersion=`tfjs-layers ${ex}`,t.backend="TensorFlow.js",t}toJSON(e,t=!0){let n=Q1(this.updatedConfig());return t?JSON.stringify(n):n}call(e,t){return Z(()=>{e=Dt(e);let n=new ci;for(let r=0;r{e=Dt(e);let n;return t==null?n=si(null,e.length):n=Dt(t),this.runInternalGraph(e,n)[1]})}computeOutputShape(e){let t=nm(e);if(t.length!==this.inputLayers.length)throw new q(`Invalid inputShape argument ${e}: model has ${this.inputLayers.length} tensor inputs.`);let n={};for(let o=0;oparseInt(o,10)).sort(Hf);if(r.length>1)for(let o of r){let i=this.nodesByDepth[o];for(let l of i){let u=l.outboundLayer;if(this.inputLayers.map(f=>f.id).indexOf(u.id)!==-1)continue;let c=[];for(let f=0;fparseInt(i,10)).sort(Hf);for(let i of r){let l=this.nodesByDepth[i];for(let u of l){let c=u.outboundLayer,d=u.inputTensors,h=u.outputTensors,p=new Array;for(let f of d)f.id in n&&p.push(n[f.id]);if(p.length===d.length){let f={},m,g,y,A;if(u.callArgs!=null&&(f=u.callArgs),p.length===1){let[x,b]=p[0];f.mask==null&&(f.mask=b),y=Dt(c.call(x,f)),A=Dt(c.computeMask(x,b)),m=[x],g=[b]}else m=p.map(x=>x[0]),g=p.map(x=>x[1]),f.mask==null&&(f.mask=g),y=Dt(c.call(m,f)),A=Dt(c.computeMask(m,g));if(c.activityRegularizer)throw new Ge("LayersModel invocation with concrete Tensor value(s) in the presence of activity regularizer(s) is not supported yet.");for(let x=0;x{let e=[];for(let t of this.layers)for(let n=0;n0){let f=[];for(let m=0;m0&&m.apply(Jn(y),A)}function l(m){let g=m.name,y=fs(m,t.customObjects!=null?t.customObjects:{});y.setFastWeightInitDuringBuild(r),s[g]=y,m.inboundNodes.forEach(x=>{if(!(x instanceof Array))throw new q(`Corrupted configuration, expected array for nodeData: ${x}`);o(y,x)})}let u=t.name,c=t.layers;for(let m of c)l(m);for(;!YQ(a);)for(let m of c){let g=s[m.name];if(g.name in a){let y=a[g.name];delete a[g.name];for(let A of y)i(g,A)}}let d=[],h=[],p=t.inputLayers;for(let m of p){let g=m[0],y=m[1],A=m[2];Ds(g in s);let b=s[g].inboundNodes[y].outputTensors;d.push(b[A])}let f=t.outputLayers;for(let m of f){let g=m[0],y=m[1],A=m[2];Ds(g in s);let b=s[g].inboundNodes[y].outputTensors;h.push(b[A])}return new e({inputs:d,outputs:h,name:u})}get stateful(){if(this._stateful)throw new q("Container instance unexpectedly has _stateful = true. The statefulness of a Container is determined by the Layers it contains. Its _stateful property must remain the default false.");for(let e of this.layers)if(e.stateful)return!0;return!1}resetStates(){Z(()=>{this.layers.forEach(e=>{e.stateful&&e.resetStates()})})}};function vte(e,t,n){let r=t.length;if(e==null||Array.isArray(e)&&e.length===0)return t.map(s=>null);if(r===1)return Array.isArray(e)&&e.length===1?e:typeof e=="object"&&t[0]in e?[e[t[0]]]:[e];if(Array.isArray(e)){if(e.length!==r)throw new Error(`Provided ${n} is an array of ${e.length} element(s), but the model has ${r} outputs. Make sure a set of weights is provided for each model output.`);return e}else if(typeof e=="object"&&Object.keys(e).length>0&&typeof e[Object.keys(e)[0]]=="object"){let s=[];return t.forEach(a=>{a in e?s.push(e[a]):s.push(null)}),s}else throw new Error(`The model has multiple (${r}) outputs, so ${n} must be either an array with ${r} elements or an object with ${t} keys. Provided ${n} not understood: ${JSON.stringify(e)}`)}function WS(e,t){return vte(e,t,"classWeight")}async function VS(e,t,n,r){if(t!=null||r!=null)throw new Error("Support sampleWeight is not implemented yet");if(n!=null){let s=Z(()=>{if(e.shape.length===1)return e.clone();if(e.shape.length===2)if(e.shape[1]>1){let i=1;return e.argMax(i)}else{if(e.shape[1]===1)return e.reshape([e.shape[0]]);throw new Error(`Encountered unexpected last-dimension size (${e.shape[1]}) during handling of class weights. The size is expected to be >= 1.`)}else throw new Error(`Unexpected rank of target (y) tensor (${e.rank}) during handling of class weights. The rank is expected to be 1 or 2.`)}),a=Array.from(await s.data());je(s);let o=[];return a.forEach(i=>{if(n[i]==null)throw new Error(`classWeight must contain all classes in the training data. The class ${i} exists in the data but not in classWeight`);o.push(n[i])}),_n(o,"float32")}else return null}function wte(e,t){return K(e,t)}var kte=32;function US(e,t){let n,r,s=t;n=s.xs,r=s.ys,k.assert(n!=null&&r!=null,()=>`A Dataset iterator for fitDataset() is expected to generate objects of the form \`{xs: xVal, ys: yVal}\`, where the two values may be \`tf.Tensor\`, an array of Tensors, or a map of string to Tensor. The provided Dataset instead generates ${t}`);let a=HS("input",e.inputNames,n),o=HS("output",e.outputNames,r),i=a[0].shape[0];k.assert(a.length===e.inputs.length,()=>`LayersModel has ${e.inputs.length} inputs, but the dataset provides ${a.length} inputs. (Expected input keys: ${JSON.stringify(e.inputNames)})`),k.assert(o.length===e.outputs.length,()=>`LayersModel has ${e.outputs.length} outputs, but the dataset provides ${o.length} outputs. (Expected output keys: ${JSON.stringify(e.outputNames)})`);for(let l=0;l`Batch size mismatch: input ${e.inputNames[l]} has ${a[l].shape[0]}; expected ${i} based on input ${e.inputNames[0]}.`);for(let l=0;l`Batch size mismatch: output ${e.outputNames[l]} has ${o[l].shape[0]}; expected ${i} based on input ${e.inputNames[0]}.`);return{xs:a,ys:o}}function HS(e,t,n){if(n instanceof Ct)return[n];if(Array.isArray(n))return k.assert(n.length===t.length,()=>`Received an array of ${n.length} Tensors, but expected ${t.length} to match the ${e} keys ${t}.`),n;{let r=[];for(let s of t){if(n[s]==null)throw new q(`The feature data generated by the dataset lacks the required ${e} key '${s}'.`);r.push(n[s])}return r}}function Ite(e){if(e.length===3)throw new Ge("Validation with sample weights is not implemented yet.");return{xs:e[0],ys:e[1]}}async function Ste(e,t,n){let r=n.batchesPerEpoch!=null;if(k.assert(e.optimizer!=null,()=>"You must compile a model before training/testing. Use LayersModel.compile(modelCompileConfig)."),k.assert(n!=null,()=>"For fitDataset(), the 2nd argument (config) is required, but it is not provided in this call."),k.assert(n.epochs!=null&&n.epochs>0&&Number.isInteger(n.epochs),()=>`For fitDataset(), config.epochs is expected to be a positive integer, but got ${n.epochs}`),k.assert(!r||n.batchesPerEpoch>0&&Number.isInteger(n.batchesPerEpoch),()=>`For fitDataset(), config.batchesPerEpoch is expected to be a positive integer if specified, but got ${n.batchesPerEpoch}`),k.assert(n.validationSplit==null,()=>"`validationSplit` is not supported by `fitDataset()`. Use validationData instead."),e.isTraining)throw new Error("Cannot start training because another fit() call is ongoing.");e.isTraining=!0;try{let s=n.validationData!=null,a,o;if(s)if(GS(n.validationData))k.assert(n.validationBatches==null||n.validationBatches>0&&Number.isInteger(n.validationBatches),()=>`For fitDataset() with dataset-based validation, config.validationBatches is expected not to be provided, or to be a positive integer, but got ${n.validationBatches}`);else{let g=Ite(n.validationData);a=g.xs,o=g.ys}let i=e.makeTrainFunction(),l=e.getDedupedMetricsNames(),u;s?u=l.slice().concat(l.map(g=>"val_"+g)):u=l.slice();let c=ES(n.callbacks,n.yieldEvery),d=n.verbose==null?1:n.verbose,{callbackList:h,history:p}=$S(c,d,n.epochs,null,null,Tte(t,n),null,s,u);h.setModel(e),e.history=p,await h.onTrainBegin(),e.stopTraining_=!1;let f=n.initialEpoch==null?0:n.initialEpoch,m=await t.iterator();for(;f=n.batchesPerEpoch:x.done){if(s){let b;GS(n.validationData)?b=Dt(await e.evaluateDataset(n.validationData,{batches:n.validationBatches})):b=Dt(e.evaluate(a,o,{batchSize:n.validationBatchSize==null?kte:n.validationBatchSize,verbose:0}));for(let v=0;v0)throw new Ge("Verbose mode is not implemented yet.");k.assert(!r||n.batches>0&&Number.isInteger(n.batches),()=>`Test loop expects \`batches\` to be a positive integer, but received ${JSON.stringify(n.batches)}`);let o=Nte(t)?t:await t.iterator(),i=0,l=0;for(;r?l{if(u.value){let{xs:c,ys:d}=US(e,u.value),h=c.concat(d),p=Z(()=>s(h));if(je(h),l===0)for(let m=0;mpe(a[m],K(f,g))),l>0&&je(y)}je(p),i+=f,++l}return a}),u.done){r&&console.warn(`Your dataset iterator ran out of data during evaluateDataset(). Interrupting evalution. Make sure that your dataset can generate at least \`batches\` batches (in this case, ${n.batches} batches). You may need to use the repeat() function when building your dataset.`);break}}for(let u=0;u0&&Number.isInteger(e),()=>`batchSize is required to be a positive integer, but got ${e}`)}function Gd(e,t,n){return e==null?[null]:Array.isArray(e)?e.map(r=>li(r,t,n-t)):li(e,t,n-t)}function rx(e,t){return Z(()=>e==null?null:Array.isArray(e)?e.map(n=>rx(n,t)):fS(e,t.dtype==="int32"?t:t.toInt()))}function sx(e,t){let n=[],r=0,s=null;for(;r=e&&(s=e),n.push([r,s]),r=s;return n}async function Ete(e,t,n,r,s,a,o,i,l,u,c,d,h,p,f){s==null&&(s=32),a==null&&(a=1),c==null&&(c=!0),h==null&&(h=0);let m=!1;if(l!=null&&u!=null&&(m=!0),f!=null&&(m=!0,p==null))throw new q("Can only use `validationSteps` when doing step-wise training, i.e., `stepsPerEpoch` must be set.");let g=e.checkNumSamples(n,s,p,"steps_per_epoch"),y;g!=null&&(y=ds(0,g)),o==null&&(o=1);let{callbackList:A,history:x}=$S(i,o,a,h,g,p,s,m,d);A.setModel(e),e.history=x,await A.onTrainBegin(),e.stopTraining_=!1;for(let b=h;b{let M=I[T][0],$=I[T][1],R=li(w,M,$-M);C.batch=T,C.size=$-M;let N=rx(n,R),F=t(N);for(let B=0;B0){if(f=!0,r.validationData.length===2)o=r.validationData[0],i=r.validationData[1];else throw r.validationData.length===3?new Ge("validationData including sample weights is not supported yet."):new q(`When passing validation data, it must contain 2 (valX, valY) or 3 (valX, valY, valSampleWeight) items; ${r.validationData} is invalid.`);let I=!0,T=await e.standardizeUserData(o,i,null,null,I,d);l=T[0],u=T[1],m=l.concat(u)}else if(r.validationSplit!=null&&r.validationSplit>0&&r.validationSplit<1){f=!0;let I=Math.floor(s[0].shape[0]*(1-r.validationSplit)),T=s[0].shape[0];l=Gd(s,I,T),s=Gd(s,0,I),u=Gd(a,I,T),a=Gd(a,0,I),m=l.concat(u)}else r.validationSteps!=null&&(f=!0);let g=s.concat(a).concat(c);e.checkTrainableWeightsConsistency();let y=e.makeTrainFunction(),A=e.getDedupedMetricsNames(),x,b;f?(e.makeTestFunction(),x=e.testFunction,b=A.slice().concat(A.map(I=>"val_"+I))):(x=null,m=[],b=A.slice());let v=ES(r.callbacks,r.yieldEvery);return await Ete(e,y,g,A,d,r.epochs,r.verbose,v,x,m,r.shuffle,b,r.initialEpoch,null,null)}finally{e.isTraining=!1,di(s,t),di(a,n),di(l,o),di(u,i),c!=null&&je(c)}}function jS(e){let t=[];e instanceof Ct&&(e=[e]);for(let n=0;nn.push(s.id));else if(t!=null)for(let s in t){let a=t[s];n.push(a.id)}let r=[];if(e instanceof Ct)n.indexOf(e.id)===-1&&r.push(e);else if(Array.isArray(e))e.forEach(s=>{n.indexOf(s.id)===-1&&r.push(s)});else if(e!=null)for(let s in e){let a=e[s];n.indexOf(a.id)===-1&&r.push(a)}r.forEach(s=>{s.isDisposed||s.dispose()})}function _te(e){return e instanceof Ct}function ax(e){return Array.isArray(e)}function qS(e){return!_te(e)&&!ax(e)}function KS(e,t,n,r=!0,s=""){if(t==null||t.length===0){if(e!=null){let o=!1;if(ax(e)&&e.length>0)o=!0;else if(qS(e)){for(let i in e)if(e.hasOwnProperty(i)){o=!0;break}}else o=!0;if(o)throw new q(`Error when checking model ${s} expected no data, but got ${e}`)}return[]}if(e==null)return t.map(o=>null);let a;if(qS(e)){e=e,a=[];for(let o of t){if(e[o]==null)throw new q(`No data provided for "${o}". Need data for each key in: ${t}`);a.push(e[o])}}else if(ax(e)){if(e=e,e.length!==t.length)throw new q(`Error when checking model ${s}: the Array of Tensors that you are passing to your model is not the size the model expected. Expected to see ${t.length} Tensor(s), but instead got the following list of Tensor(s): ${e}`);a=e}else{if(e=e,t.length>1)throw new q(`The model ${s} expects ${t.length} Tensor(s), but only received one Tensor. Found: Tensor with shape ${e.shape}`);a=[e]}if(a=jS(a),n!=null)for(let o=0;o=0&&u!==c)throw new q(`Error when checking ${s}: expected ${t[o]} to have shape [${n[o]}], but got array with shape [${i.shape}].`)}}return a}function Rte(e,t,n){let r=Ga(e.map(a=>a.shape[0]));r.sort();let s=Ga(t.map(a=>a.shape[0]));if(s.sort(),r.length>1)throw new q(`All input Tensors (x) should have the same number of samples. Got array shapes: ${JSON.stringify(e.map(a=>a.shape))}`);if(s.length>1)throw new q(`All target Tensors (y) should have the same number of samples. Got array shapes: ${JSON.stringify(t.map(a=>a.shape))}`);if(r.length>0&&s.length>0&&!k.arraysEqual(r,s))throw new q(`Input Tensors should have the same number of samples as target Tensors. Found ${r[0]} input sample(s) and ${s[0]} target sample(s).`)}function Dte(e,t,n){let r=[ui,lm,Vd];for(let s=0;s1)throw new q(`The model expects ${t.length} ${s} Tensors, but only received one Tensor. Found: array with shape ${JSON.stringify(e.shape)}.`);a=[e]}if(n!=null)for(let o=0;o[]);let n;if(typeof e=="string"||typeof e=="function")n=[e];else if(Array.isArray(e)||typeof e=="object")n=e;else throw new TypeError(`Type of metrics argument not understood. Expected an string,function, Array, or Object, found: ${e}`);if(Array.isArray(n))return t.map(r=>n);{let r=[];for(let s of t){let a=n.hasOwnProperty(s)?n[s]:[];Array.isArray(a)||(a=[a]),r.push(a)}return r}}var Mte="layers-model",pa=class extends Os{constructor(e){super(e);this.isTraining=!1}summary(e,t,n=console.log){if(!this.built)throw new q("This model has never been called, thus its weights have not been created yet. So no summary can be displayed. Build the model first (e.g., by calling it on some test data).");hte(this,e,t,n)}compile(e){if(e.loss==null&&(e.loss=[]),this.loss=e.loss,typeof e.optimizer=="string")this.optimizer_=dte(e.optimizer),this.isOptimizerOwned=!0;else{if(!(e.optimizer instanceof Ha))throw new q("User-defined optimizer must be an instance of tf.Optimizer.");this.optimizer_=e.optimizer,this.isOptimizerOwned=!1}let t=[];if(!Array.isArray(e.loss)&&typeof e.loss!="string"&&typeof e.loss!="function"){e.loss=e.loss;for(let a in e.loss)if(this.outputNames.indexOf(a)===-1)throw new q(`Unknown entry in loss dictionary: "${a}". Only expected the following keys: ${this.outputNames}`);for(let a of this.outputNames)e.loss[a]==null&&console.warn(`Output "${a}" is missing from loss dictionary. We assume this was done on purpose, and we will not be expecting data to be passed to ${a} during training`),t.push(K1(e.loss[a]))}else if(Array.isArray(e.loss)){if(e.loss.length!==this.outputs.length)throw new q(`When passing an Array as loss, it should have one entry per model output. The model has ${this.outputs.length} output(s), but you passed loss=${e.loss}.`);t=e.loss.map(o=>K1(o))}else{let a=K1(e.loss);this.outputs.forEach(o=>{t.push(a)})}this.lossFunctions=t,this.feedOutputNames=[],this.feedOutputShapes=[],this.feedLossFns=[];for(let a=0;a{for(let a=0;a1&&(this.metricsTensors.push([o,a]),this.metricsNames.push(this.outputNames[a]+"_loss"))}});let r=Fte(e.metrics,this.outputNames),s=(a,o,i)=>{this.outputNames.length>1&&(o=this.outputNames[a]+"_"+o),this.metricsNames.push(o),this.metricsTensors.push([i,a])};ii("metric",()=>{for(let a=0;a{let u="",c,d,h;for(let p of l){if(typeof p=="string"&&["accuracy","acc","crossentropy","ce"].indexOf(p)!==-1){let m=this.internalOutputShapes[a];m[m.length-1]===1||this.lossFunctions[a]===lm?["accuracy","acc"].indexOf(p)!==-1?d=X1:["crossentropy","ce"].indexOf(p)!==-1&&(d=DS):this.lossFunctions[a]===im?["accuracy","acc"].indexOf(p)!==-1?d=FS:["crossentropy","ce"].indexOf(p)!==-1&&(d=MS):["accuracy","acc"].indexOf(p)!==-1?d=Z1:["crossentropy","ce"].indexOf(p)!==-1&&(d=Y1);let g;["accuracy","acc"].indexOf(p)!==-1?g="acc":["crossentropy","ce"].indexOf(p)!==-1&&(g="ce"),h=d,c=u+g}else h=cte(p),c=u+dm(p);let f;ii(c,()=>{f=h}),s(a,c,f)}})(o)}}),this.collectedTrainableWeights=this.trainableWeights}checkTrainableWeightsConsistency(){this.collectedTrainableWeights!=null&&this.trainableWeights.length!==this.collectedTrainableWeights.length&&console.warn("Discrepancy between trainableweights and collected trainable weights. Did you set `model.trainable` without calling `model.compile()` afterwards?")}evaluate(e,t,n={}){let r=n.batchSize==null?32:n.batchSize;nx(r);let s=!0,a=this.standardizeUserDataXY(e,t,s,r);try{let o=a[0].concat(a[1]);this.makeTestFunction();let i=this.testFunction,l=this.testLoop(i,o,r,n.verbose,n.steps);return Jn(l)}finally{di(a[0],e),di(a[1],t)}}async evaluateDataset(e,t){return this.makeTestFunction(),Cte(this,e,t)}checkNumSamples(e,t,n,r="steps"){let s;if(n!=null){if(s=null,t!=null)throw new q(`If ${r} is set, batchSize must be null or undefined.Got batchSize = ${t}`)}else if(e!=null)Array.isArray(e)?s=e[0].shape[0]:s=e.shape[0];else throw new q(`Either the input data should have a defined shape, or ${r} shoud be specified.`);return s}execute(e,t){if(Array.isArray(t)&&t.length===0)throw new q("`outputs` is an empty Array, which is not allowed.");let n=Array.isArray(t),r=n?t:[t],s=this.retrieveSymbolicTensors(r),a=new ci;if(e instanceof Ct&&(e=[e]),Array.isArray(e)){if(e.length!==this.inputs.length)throw new q(`The number of inputs provided (${e.length}) does not match the number of inputs of this model (${this.inputs.length}).`);for(let i=0;io.name);for(let o=0;o0){let r=[];throw t.forEach((s,a)=>{s==null&&r.push(e[a])}),new q(`Cannot find SymbolicTensors for output name(s): ${JSON.stringify(r)}`)}return t}predictLoop(e,t=32,n=!1){return Z(()=>{let r=this.checkNumSamples(e);if(n)throw new Ge("Verbose predictLoop() is not implemented yet.");let s=sx(r,t),a=this.outputs.map(o=>[]);for(let o=0;o{let l=s[o][0],u=s[o][1],c=Gd(e,l,u),d=[];if(Array.isArray(c))for(let p=0;pa[u].push(l));return Jn(a.map(o=>en(o,0)))})}predict(e,t={}){let n=jS(e);XS(n,this.inputNames,this.feedInputShapes,!1);try{let r=t.batchSize==null?32:t.batchSize;return nx(r),this.predictLoop(n,r)}finally{di(n,e)}}predictOnBatch(e){XS(e,this.inputNames,this.feedInputShapes,!0);let t=(Array.isArray(e)?e[0]:e).shape[0];return this.predictLoop(e,t)}standardizeUserDataXY(e,t,n=!0,r){if(this.optimizer_==null)throw new cs("You must compile a model before training/testing. Use LayersModel.compile(modelCompileArgs).");let s=[];for(let a=0;a0&&e[0].shape[0]%r!=0)throw new q(`In a stateful network, you should only pass inputs with a number of samples that is divisible by the batch size ${r}. Found: ${e[0].shape[0]} sample(s).`);return[e,t]}async standardizeUserData(e,t,n,r,s=!0,a){let[o,i]=this.standardizeUserDataXY(e,t,s,a);if(n!=null)throw new Error("sample weight is not supported yet.");let l=null;if(r!=null){let u=WS(r,this.outputNames);l=[];for(let c=0;c{let a=this.checkNumSamples(t,n,s,"steps"),o=[];if(r>0)throw new Ge("Verbose mode is not implemented yet.");if(s!=null)throw new Ge("steps mode in testLoop() is not implemented yet");{let i=sx(a,n),l=_n(ds(0,a));for(let u=0;u1&&(s+=`_${nS(e.slice(0,n),r)}`),t.push(s)}return t}makeTrainFunction(){return e=>{let t=[],n=e.slice(0,this.inputs.length),r=e.slice(this.inputs.length,this.inputs.length+this.outputs.length),s=e.slice(this.inputs.length+this.outputs.length,this.inputs.length+this.outputs.length*2),a=[],o=()=>{let c=[];for(let f=0;f1&&f{p=pe(p,f)}),p},i=this.collectedTrainableWeights.map(c=>c.read()),l=!0;return[this.optimizer_.minimize(o,l,i)].concat(a)}}makeTestFunction(){this.testFunction=e=>Z(()=>{let t=[],n,r=e.slice(0,this.inputs.length),s=e.slice(this.inputs.length,this.inputs.length+this.outputs.length),a=[];for(let l=0;lha(t))}else{let t=Object.keys(this.loss);e={};let n=this.loss;for(let r of t)if(typeof n[r]=="string")e[r]=ha(n[r]);else throw new Error("Serialization of non-string loss is not supported.")}return e}getMetricIdentifiers(){if(typeof this.metrics=="string"||typeof this.metrics=="function")return[ha(dm(this.metrics))];if(Array.isArray(this.metrics))return this.metrics.map(e=>ha(dm(e)));{let e={};for(let t in this.metrics)e[t]=ha(dm(this.metrics[t]));return e}}getTrainingConfig(){return{loss:this.getLossIdentifiers(),metrics:this.getMetricIdentifiers(),optimizer_config:{class_name:this.optimizer.getClassName(),config:this.optimizer.getConfig()}}}loadTrainingConfig(e){if(e.weighted_metrics!=null)throw new Error("Loading weight_metrics is not supported yet.");if(e.loss_weights!=null)throw new Error("Loading loss_weights is not supported yet.");if(e.sample_weight_mode!=null)throw new Error("Loading sample_weight_mode is not supported yet.");let t=Ud(e.optimizer_config),n=fs(t),r;if(typeof e.loss=="string")r=ai(e.loss);else if(Array.isArray(e.loss))r=e.loss.map(a=>ai(a));else if(e.loss!=null){r={};for(let a in e.loss)r[a]=ai(e.loss[a])}let s;if(Array.isArray(e.metrics))s=e.metrics.map(a=>ai(a));else if(e.metrics!=null){s={};for(let a in e.metrics)s[a]=ai(e.metrics[a])}this.compile({loss:r,metrics:s,optimizer:n})}async save(e,t){if(typeof e=="string"){let l=ur.getSaveHandlers(e);if(l.length===0)throw new q(`Cannot find any save handlers for URL '${e}'`);if(l.length>1)throw new q(`Found more than one (${l.length}) save handlers for URL '${e}'`);e=l[0]}if(e.save==null)throw new q("LayersModel.save() cannot proceed because the IOHandler provided does not have the `save` attribute defined.");let n=await ur.encodeWeights(this.getNamedWeights(t)),r=!1,s=null,o={modelTopology:this.toJSON(s,r),format:Mte,generatedBy:`TensorFlow.js tfjs-layers v${ex}`,convertedBy:null};if((t==null?!1:t.includeOptimizer)&&this.optimizer!=null){o.trainingConfig=this.getTrainingConfig();let l="optimizer",{data:u,specs:c}=await ur.encodeWeights(await this.optimizer.getWeights(),l);n.specs.push(...c),n.data=ur.concatenateArrayBuffers([n.data,u])}if(this.userDefinedMetadata!=null){let l=!0;PS(this.userDefinedMetadata,this.name,l),o.userDefinedMetadata=this.userDefinedMetadata}return o.weightData=n.data,o.weightSpecs=n.specs,e.save(o)}setUserDefinedMetadata(e){PS(e,this.name),this.userDefinedMetadata=e}getUserDefinedMetadata(){return this.userDefinedMetadata}};pa.className="Model";ce.registerClass(pa);var ZS=class extends pa{};ZS.className="Functional";ce.registerClass(ZS);async function Ote(e,t){"modelTopology"in e||(e={modelTopology:e}),e=e;let n=e.modelTopology;n.model_config!=null&&(n=n.model_config);let r=Ud(n),s=fs(r,t);if(e.weightsManifest!=null){let a=await ur.loadWeights(e.weightsManifest,e.pathPrefix,s.weights.map(i=>i.originalName)),o={};for(let i of s.weights)o[i.originalName]=a[i.originalName];s.loadWeights(o),je(a)}return s}async function Pte(e,t){if(t==null&&(t={}),typeof e=="string"){let n=ur.getLoadHandlers(e,t);if(n.length===0)n.push(ur.browserHTTPRequest(e,t));else if(n.length>1)throw new q(`Found more than one (${n.length}) load handlers for URL '${e}'`);e=n[0]}return zte(e,void 0,t)}async function zte(e,t,n){if(n==null&&(n={}),e.load==null)throw new q("Cannot proceed with model loading because the IOHandler provided does not have the `load` method implemented.");let r=await e.load(),s=r.modelTopology;s.model_config!=null&&(s=s.model_config);let a=n.strict==null?!0:n.strict,o=r.weightData!=null&&r.weightSpecs!=null&&a,i=fs(Ud(s),t,o),l=r.trainingConfig;if(l!=null&&i.loadTrainingConfig(l),r.userDefinedMetadata!=null&&i.setUserDefinedMetadata(r.userDefinedMetadata),r.weightData!=null){if(r.weightSpecs==null)throw new q("LayersModel artifacts contains weight data, but not weight specs. Therefore loading of weights cannot proceed.");let{modelWeights:u,optimizerWeights:c}=Lte(r.weightData,r.weightSpecs);i.loadWeights(u,a),i.optimizer!=null&&c.length>0&&await i.optimizer.setWeights(c),je(u),je(c.map(d=>d.tensor))}return i}function Lte(e,t){let n=ur.decodeWeights(e,t),r={},s=[];return t.forEach(a=>{a.group==="optimizer"?s.push({name:a.name,tensor:n[a.name]}):r[a.name]=n[a.name]}),{modelWeights:r,optimizerWeights:s}}var ox=class extends pa{constructor(e){super({inputs:[],outputs:[]});if(e=e||{},this.trainable=!0,this.built=!1,this.name=e.name!=null?e.name:tm("sequential_"),e.layers!=null)for(let t of e.layers)this.add(t)}checkShape(e){if(e.inboundNodes[0].outputTensors[0].shape.some(n=>n<0))throw new q(`Negative dimension size caused by adding layer ${e.name} with input shape [${e.inboundNodes[0].inputTensors[0].shape}]`)}add(e){let t=e instanceof ox||e instanceof pa,n;if(t){if(n=e,n.outputs.length!==1)throw new q("All layers in a Sequential model should have a single output tensor. For multi-output layers, use the functional API.");if(n.inputs.length!==1)throw new q("All layers in a Sequential model should have a single input tensor. For multi-input layers, use the functional API.")}if(this.outputs.length===0){if(e.inboundNodes.length===0){if(e.batchInputShape==null)throw new q("The first layer in a Sequential model must get an `inputShape` or `batchInputShape` argument.");let r=kS({batchShape:e.batchInputShape,dtype:e.dtype,name:e.name+"_input"});e.apply(r)}if(t)this.outputs=n.outputs,this.inputs=n.inputs;else{if(e.inboundNodes.length!==1)throw new q(`A layer added to a Sequential model must not already be connected somewhere else. LayersModel received layer ${e.name} which has ${e.inboundNodes.length} pre-existing inbound connections.`);if(e.inboundNodes[0].outputTensors.length!==1)throw new q("All layers in a Sequential model should have a single output tensor. For multi-output layers, use the functional API.");this.checkShape(e),this.outputs=[e.inboundNodes[0].outputTensors[0]],this.inputs=wS(this.outputs[0])}this.inboundNodes=[],new sm({outboundLayer:this,inboundLayers:[],nodeIndices:[],tensorIndices:[],inputTensors:this.inputs,outputTensors:this.outputs,inputMasks:si(null,this.inputs.length),outputMasks:[null],inputShapes:this.inputs.map(r=>r.shape),outputShapes:this.outputs[0].shape})}else{let r=e.apply(this.outputs[0]);if(Array.isArray(r))throw new TypeError("All layers in a Sequential model should have a single output tensor. For multi-output layers, use the functional API.");this.checkShape(e),this.outputs=[r],this.inboundNodes[0].outputTensors=this.outputs,this.inboundNodes[0].outputShapes=[this.outputs[0].shape]}this.layers.push(e),this.built=!1}pop(){if(this.layers.length===0)throw new TypeError("There are no layers in the model.");if(this.layers.pop(),this.layers.length===0)this.outputs=[],this.inboundNodes=[],this.outboundNodes=[];else{let e=this.layers.length-1;this.layers[e].outboundNodes=[],this.outputs=[this.layers[e].output],this.inboundNodes[0].outputTensors=this.outputs,this.inboundNodes[0].outputShapes=[this.outputs[0].shape]}}call(e,t){return this.model==null&&this.build(),this.model.call(e,t)}build(e){if(At(e),this.inputs.length===0||this.outputs.length===0)throw new TypeError("Sequential model cannot be built: model is empty. Add some layers first.");this.model=new pa({inputs:this.inputs,outputs:this.outputs[0],name:this.name+"_model"}),this.model.trainable=this.trainable,this.supportsMasking=this.model.supportsMasking,this.inputLayers=this.model.inputLayers,this.inputLayersNodeIndices=this.model.inputLayersNodeIndices,this.inputLayersTensorIndices=this.model.inputLayersTensorIndices,this.outputLayers=this.model.outputLayers,this.outputLayersNodeIndices=this.model.outputLayersNodeIndices,this.outputLayersTensorIndices=this.model.outputLayersTensorIndices,this.nodesByDepth=this.model.nodesByDepth,this.containerNodes=this.model.containerNodes,this.outputNames=this.model.outputNames,this.inputNames=this.model.inputNames,this.built=!0}countParams(){return this.built||this.build(),super.countParams()}summary(e,t,n=console.log){this.built||this.build(),super.summary(e,t,n)}setWeights(e){this.model==null&&this.build(),this.model.setWeights(e)}evaluate(e,t,n={}){if(!this.built)throw new cs("The model needs to be compiled before being used.");return this.model.evaluate(e,t,n)}async evaluateDataset(e,t){if(!this.built)throw new cs("The model needs to be compiled before being used.");return this.model.evaluateDataset(e,t)}predict(e,t={}){return this.model==null&&this.build(),this.model.predict(e,t)}predictOnBatch(e){return this.model==null&&this.build(),this.model.predictOnBatch(e)}compile(e){this.build(),this.model.compile(e),this.optimizer_=this.model.optimizer,this.isOptimizerOwned=this.model.isOptimizerOwned,this.loss=this.model.loss,this.metrics=this.model.metrics,this.metricsTensors=this.model.metricsTensors,this.metricsNames=this.model.metricsNames}get optimizer(){return this.model==null?void 0:this.model.optimizer}set optimizer(e){this.model.optimizer=e}async fit(e,t,n={}){if(!this.built)throw new cs("The model needs to be compiled before being used.");return this.model.fit(e,t,n)}async fitDataset(e,t){if(!this.built)throw new cs("The model needs to be compiled before being used.");return this.model.fitDataset(e,t)}async trainOnBatch(e,t){return this.model.trainOnBatch(e,t)}static fromConfig(e,t,n={},r=!1){let s,a={};if(t instanceof Array){if(t[0].className==null||t[0].className==="Merge")throw new q("Legacy serialization format not supported yet.");s=t}else k.assert(t.layers!=null,()=>"When the config data for a Sequential model is not an Array, it must be an Object that contains the 'layers' field."),s=t.layers,delete t.layers,a=t;let o=new e(a);if(!(o instanceof ox))throw new Ge(`Sequential.fromConfig called on non-Sequential input: ${o}`);for(let i of s){let u=fs(i,void 0,r);r&&u.setFastWeightInitDuringBuild(!0),o.add(u)}return o}set stopTraining(e){if(this.model==null)throw new q("Cannot set the stopTraining property of a sequential model before it is compiled.");this.model.stopTraining=e}get stopTraining(){if(this.model==null)throw new q("Cannot get the stopTraining property of a sequential model before it is compiled.");return this.model.stopTraining}getConfig(){let e=[];for(let t of this.layers){let n={};n.className=t.getClassName(),n.config=t.getConfig(),e.push(n)}return{name:this.name,layers:e}}},pm=ox;pm.className="Sequential";ce.registerClass(pm);function Bte(e){return new pa(e)}function Wte(e){return new pm(e)}function Vte(e,t){return t==null&&(t={}),Pte(e,t)}function YS(e){return kS(e)}function Ute(e,t){j1.registerCallbackConstructor(e,t)}var er=class extends ce.Serializable{getConfig(){return{}}},JS=class extends er{apply(e,t=1){return mee(e,t)}};JS.className="elu";ce.registerClass(JS);var QS=class extends er{apply(e){return e1(e)}};QS.className="selu";ce.registerClass(QS);var e8=class extends er{apply(e){return ua(e)}};e8.className="relu";ce.registerClass(e8);var t8=class extends er{apply(e){return Z(()=>_d(6,ua(e)))}};t8.className="relu6";ce.registerClass(t8);var n8=class extends er{apply(e){return e}};n8.className="linear";ce.registerClass(n8);var r8=class extends er{apply(e){return Rs(e)}};r8.className="sigmoid";ce.registerClass(r8);var s8=class extends er{apply(e){return yee(e)}};s8.className="hardSigmoid";ce.registerClass(s8);var a8=class extends er{apply(e){return Zl(e)}};a8.className="softplus";ce.registerClass(a8);var o8=class extends er{apply(e){return gee(e)}};o8.className="softsign";ce.registerClass(o8);var i8=class extends er{apply(e){return Kl(e)}};i8.className="tanh";ce.registerClass(i8);var ix=class extends er{apply(e,t=-1){return Of(e,t)}};ix.className="softmax";ce.registerClass(ix);var l8=class extends er{apply(e,t=-1){return UA(e,t)}};l8.className="logSoftmax";ce.registerClass(l8);var u8=class extends er{apply(e,t=1){return Z(()=>Rs(e.mul(t)).mul(e))}};u8.className="swish";ce.registerClass(u8);var c8=class extends er{apply(e){return Z(()=>K(e,Kl(Zl(e))))}};c8.className="mish";ce.registerClass(c8);function Xa(e){return e.getClassName()}function lx(e,t={}){return Md(e,ce.SerializationMap.getMap().classNameMap,t,"activation")}function Za(e){if(e==null){let t={};return t.className="linear",t.config={},lx(t)}if(typeof e=="string"){let t={};return t.className=e,t.config={},lx(t)}else return e instanceof er?e:lx(e)}function ux(e){if(e!=null&&typeof e!="object")throw new Error(`Argument to L1L2 regularizer's constructor is expected to be an object, but received: ${e}`)}var d8=class extends ce.Serializable{},jd=class extends d8{constructor(e){super();ux(e),this.l1=e==null||e.l1==null?.01:e.l1,this.l2=e==null||e.l2==null?.01:e.l2,this.hasL1=this.l1!==0,this.hasL2=this.l2!==0}apply(e){return Z(()=>{let t=un([1]);return this.hasL1&&(t=pe(t,_e(K(this.l1,yn(e))))),this.hasL2&&(t=pe(t,_e(K(this.l2,Bd(e))))),t.asScalar()})}getConfig(){return{l1:this.l1,l2:this.l2}}static fromConfig(e,t){return new e({l1:t.l1,l2:t.l2})}};jd.className="L1L2";ce.registerClass(jd);function Hte(e){return ux(e),new jd({l1:e!=null?e.l1:null,l2:0})}function Gte(e){return ux(e),new jd({l2:e!=null?e.l2:null,l1:0})}var h8={l1l2:"L1L2"};function kt(e){return I1(e)}function p8(e,t={}){return Md(e,ce.SerializationMap.getMap().classNameMap,t,"regularizer")}function Lt(e){if(e==null)return null;if(typeof e=="string"){let n={className:e in h8?h8[e]:e,config:{}};return p8(n)}else return e instanceof d8?e:p8(e)}var cx=class extends st{constructor(e){super(e==null?{}:e);this.supportsMasking=!0,e!=null&&(this.maxValue=e.maxValue)}call(e,t){e=Ke(e);let n=ua(e);return this.maxValue!=null&&(n=cr(n,0,this.maxValue)),n}computeOutputShape(e){return e}getConfig(){let e={maxValue:this.maxValue},t=super.getConfig();return Object.assign(e,t),e}};cx.className="ReLU";ce.registerClass(cx);var dx=class extends st{constructor(e){super(e==null?{}:e);this.DEFAULT_ALPHA=.3,e==null&&(e={}),this.alpha=e.alpha==null?this.DEFAULT_ALPHA:e.alpha}call(e,t){let n=Ke(e);return Cf(n,this.alpha)}computeOutputShape(e){return e}getConfig(){let e={alpha:this.alpha},t=super.getConfig();return Object.assign(e,t),e}};dx.className="LeakyReLU";ce.registerClass(dx);var hx=class extends st{constructor(e){super(e==null?{}:e);if(this.DEFAULT_ALPHA_INITIALIZER="zeros",e==null&&(e={}),this.supportsMasking=!0,this.alphaInitializer=zt(e.alphaInitializer||this.DEFAULT_ALPHA_INITIALIZER),this.alphaRegularizer=Lt(e.alphaRegularizer),this.alphaConstraint=hn(e.alphaConstraint),e.sharedAxes==null)this.sharedAxes=null;else if(Array.isArray(e.sharedAxes))this.sharedAxes=e.sharedAxes;else if(typeof e.sharedAxes=="number")this.sharedAxes=[e.sharedAxes];else throw new q(`Expected sharedAxes to be a number or an array of numbers, but got ${e.sharedAxes}`)}build(e){e=At(e);let t=e.slice(1);if(this.sharedAxes!=null)for(let r of this.sharedAxes)t[r-1]=1;this.alpha=this.addWeight("alpha",t,"float32",this.alphaInitializer,this.alphaRegularizer,!0,this.alphaConstraint);let n={};if(this.sharedAxes!=null)for(let r=1;r(Yt(t),t==="channelsFirst"?pt(e,[0,2,3,1]):e))}function f8(e,t){return Z(()=>(Yt(t),t==="channelsFirst"?pt(e,[0,2,3,4,1]):e))}function jte(e,t,n,r=1,s="valid",a,o=1){return Z(()=>{if(a==null&&(a=us()),Yt(a),e.shape.length!==3)throw new q(`The input of a conv1dWithBias operation should be 3, but is ${e.shape.length} instead.`);if(t.shape.length!==3)throw new q(`The kernel for a conv1dWithBias operation should be 3, but is ${t.shape.length} instead`);if(n!=null&&n.shape.length!==1)throw new q(`The bias for a conv1dWithBias operation should be 1, but is ${t.shape.length} instead`);if(a==="channelsFirst"&&(e=pt(e,[0,2,1])),s==="causal")throw new Ge("The support for CAUSAL padding mode in conv1dWithBias is not implemented yet.");let i=MA(e,t,r,s==="same"?"same":"valid","NWC",o);return n!=null&&(i=hs(i,n)),i})}function m8(e,t,n,r=[1,1],s="valid",a,o,i=null){return Z(()=>{if(a==null&&(a=us()),Yt(a),e.rank!==3&&e.rank!==4)throw new q(`conv2dWithBiasActivation expects input to be of rank 3 or 4, but received ${e.rank}.`);if(t.rank!==3&&t.rank!==4)throw new q(`conv2dWithBiasActivation expects kernel to be of rank 3 or 4, but received ${e.rank}.`);let l=gx(e,a);if(s==="causal")throw new Ge("The support for CAUSAL padding mode in conv1dWithBias is not implemented yet.");return l=ti.conv2d({x:l,filter:t,strides:r,pad:s==="same"?"same":"valid",dilations:o,dataFormat:"NHWC",bias:n,activation:i}),a==="channelsFirst"&&(l=pt(l,[0,3,1,2])),l})}function qte(e,t,n,r=[1,1,1],s="valid",a,o){return Z(()=>{if(a==null&&(a=us()),Yt(a),e.rank!==4&&e.rank!==5)throw new q(`conv3dWithBias expects input to be of rank 4 or 5, but received ${e.rank}.`);if(t.rank!==4&&t.rank!==5)throw new q(`conv3dWithBias expects kernel to be of rank 4 or 5, but received ${e.rank}.`);let i=f8(e,a);if(s==="causal")throw new Ge("The support for CAUSAL padding mode in conv3dWithBias is not implemented yet.");return i=nI(i,t,r,s==="same"?"same":"valid","NDHWC",o),n!=null&&(i=hs(i,n)),a==="channelsFirst"&&(i=pt(i,[0,4,1,2,3])),i})}var yx=class extends st{constructor(e,t){super(t);if(this.bias=null,this.DEFAULT_KERNEL_INITIALIZER="glorotNormal",this.DEFAULT_BIAS_INITIALIZER="zeros",yx.verifyArgs(t),this.rank=e,An(this.rank,"rank"),this.rank!==1&&this.rank!==2&&this.rank!==3)throw new Ge(`Convolution layer for rank other than 1, 2, or 3 (${this.rank}) is not implemented yet.`);if(this.kernelSize=iu(t.kernelSize,e,"kernelSize"),this.strides=iu(t.strides==null?1:t.strides,e,"strides"),this.padding=t.padding==null?"valid":t.padding,Or(this.padding),this.dataFormat=t.dataFormat==null?"channelsLast":t.dataFormat,Yt(this.dataFormat),this.activation=Za(t.activation),this.useBias=t.useBias==null?!0:t.useBias,this.biasInitializer=zt(t.biasInitializer||this.DEFAULT_BIAS_INITIALIZER),this.biasConstraint=hn(t.biasConstraint),this.biasRegularizer=Lt(t.biasRegularizer),this.activityRegularizer=Lt(t.activityRegularizer),this.dilationRate=iu(t.dilationRate==null?1:t.dilationRate,e,"dilationRate"),this.rank===1&&Array.isArray(this.dilationRate)&&this.dilationRate.length!==1)throw new q(`dilationRate must be a number or an array of a single number for 1D convolution, but received ${JSON.stringify(this.dilationRate)}`);if(this.rank===2){if(typeof this.dilationRate=="number")this.dilationRate=[this.dilationRate,this.dilationRate];else if(this.dilationRate.length!==2)throw new q(`dilationRate must be a number or array of two numbers for 2D convolution, but received ${JSON.stringify(this.dilationRate)}`)}else if(this.rank===3){if(typeof this.dilationRate=="number")this.dilationRate=[this.dilationRate,this.dilationRate,this.dilationRate];else if(this.dilationRate.length!==3)throw new q(`dilationRate must be a number or array of three numbers for 3D convolution, but received ${JSON.stringify(this.dilationRate)}`)}}static verifyArgs(e){if(Ds("kernelSize"in e,"required key 'kernelSize' not in config"),typeof e.kernelSize!="number"&&!T1(e.kernelSize,"number",1,3))throw new q(`BaseConv expects config.kernelSize to be number or number[] with length 1, 2, or 3, but received ${JSON.stringify(e.kernelSize)}.`)}getConfig(){let e={kernelSize:this.kernelSize,strides:this.strides,padding:this.padding,dataFormat:this.dataFormat,dilationRate:this.dilationRate,activation:Xa(this.activation),useBias:this.useBias,biasInitializer:Ht(this.biasInitializer),biasRegularizer:kt(this.biasRegularizer),activityRegularizer:kt(this.activityRegularizer),biasConstraint:dn(this.biasConstraint)},t=super.getConfig();return Object.assign(e,t),e}},qd=class extends yx{constructor(e,t){super(e,t);this.kernel=null,qd.verifyArgs(t),this.filters=t.filters,An(this.filters,"filters"),this.kernelInitializer=zt(t.kernelInitializer||this.DEFAULT_KERNEL_INITIALIZER),this.kernelConstraint=hn(t.kernelConstraint),this.kernelRegularizer=Lt(t.kernelRegularizer)}build(e){e=At(e);let t=this.dataFormat==="channelsFirst"?1:e.length-1;if(e[t]==null)throw new q(`The channel dimension of the input should be defined. Found ${e[t]}`);let n=e[t],r=this.kernelSize.concat([n,this.filters]);this.kernel=this.addWeight("kernel",r,null,this.kernelInitializer,this.kernelRegularizer,!0,this.kernelConstraint),this.useBias&&(this.bias=this.addWeight("bias",[this.filters],null,this.biasInitializer,this.biasRegularizer,!0,this.biasConstraint)),this.inputSpec=[{ndim:this.rank+2,axes:{[t]:n}}],this.built=!0}call(e,t){return Z(()=>{e=Ke(e);let n,r=this.bias==null?null:this.bias.read(),s=sS(this.activation.getClassName());if(s!=null&&this.rank===2)n=m8(e,this.kernel.read(),r,this.strides,this.padding,this.dataFormat,this.dilationRate,s);else{if(this.rank===1)n=jte(e,this.kernel.read(),r,this.strides[0],this.padding,this.dataFormat,this.dilationRate[0]);else if(this.rank===2)n=m8(e,this.kernel.read(),r,this.strides,this.padding,this.dataFormat,this.dilationRate);else if(this.rank===3)n=qte(e,this.kernel.read(),r,this.strides,this.padding,this.dataFormat,this.dilationRate);else throw new Ge("convolutions greater than 3D are not implemented yet.");this.activation!=null&&(n=this.activation.apply(n))}return n})}computeOutputShape(e){e=At(e);let t=[],n=this.dataFormat==="channelsLast"?e.slice(1,e.length-1):e.slice(2);for(let s=0;s 0 but got ${JSON.stringify(e.filters)}`)}},g8=class extends qd{constructor(e){super(2,e);g8.verifyArgs(e)}getConfig(){let e=super.getConfig();return delete e.rank,e}static verifyArgs(e){if(typeof e.kernelSize!="number"&&!T1(e.kernelSize,"number",1,2))throw new q(`Conv2D expects config.kernelSize to be number or number[] with length 1 or 2, but received ${JSON.stringify(e.kernelSize)}.`)}},fm=g8;fm.className="Conv2D";ce.registerClass(fm);var y8=class extends qd{constructor(e){super(3,e);y8.verifyArgs(e)}getConfig(){let e=super.getConfig();return delete e.rank,e}static verifyArgs(e){if(typeof e.kernelSize!="number"&&!(Array.isArray(e.kernelSize)&&(e.kernelSize.length===1||e.kernelSize.length===3)))throw new q(`Conv3D expects config.kernelSize to be number or [number, number, number], but received ${JSON.stringify(e.kernelSize)}.`)}},mm=y8;mm.className="Conv3D";ce.registerClass(mm);var Ax=class extends fm{constructor(e){super(e);if(this.inputSpec=[new tn({ndim:4})],this.padding!=="same"&&this.padding!=="valid")throw new q(`Conv2DTranspose currently supports only padding modes 'same' and 'valid', but received padding mode ${this.padding}`)}build(e){if(e=At(e),e.length!==4)throw new q("Input should have rank 4; Received input shape: "+JSON.stringify(e));let t=this.dataFormat==="channelsFirst"?1:e.length-1;if(e[t]==null)throw new q("The channel dimension of the inputs should be defined. Found `None`.");let n=e[t],r=this.kernelSize.concat([this.filters,n]);this.kernel=this.addWeight("kernel",r,"float32",this.kernelInitializer,this.kernelRegularizer,!0,this.kernelConstraint),this.useBias&&(this.bias=this.addWeight("bias",[this.filters],"float32",this.biasInitializer,this.biasRegularizer,!0,this.biasConstraint)),this.inputSpec=[new tn({ndim:4,axes:{[t]:n}})],this.built=!0}call(e,t){return Z(()=>{let n=Ke(e);if(n.shape.length!==4)throw new q(`Conv2DTranspose.call() expects input tensor to be rank-4, but received a tensor of rank-${n.shape.length}`);let r=n.shape,s=r[0],a,o;this.dataFormat==="channelsFirst"?(a=2,o=3):(a=1,o=2);let i=r[a],l=r[o],u=this.kernelSize[0],c=this.kernelSize[1],d=this.strides[0],h=this.strides[1],p=Ps(i,d,u,this.padding),f=Ps(l,h,c,this.padding),m=[s,p,f,this.filters];this.dataFormat!=="channelsLast"&&(n=pt(n,[0,2,3,1]));let g=PA(n,this.kernel.read(),m,this.strides,this.padding);return this.dataFormat!=="channelsLast"&&(g=pt(g,[0,3,1,2])),this.bias!=null&&(g=hs(g,this.bias.read(),this.dataFormat)),this.activation!=null&&(g=this.activation.apply(g)),g})}computeOutputShape(e){e=At(e);let t=e.slice(),n,r,s;this.dataFormat==="channelsFirst"?(n=1,r=2,s=3):(n=3,r=1,s=2);let a=this.kernelSize[0],o=this.kernelSize[1],i=this.strides[0],l=this.strides[1];return t[n]=this.filters,t[r]=Ps(t[r],i,a,this.padding),t[s]=Ps(t[s],l,o,this.padding),t}getConfig(){let e=super.getConfig();return delete e.dilationRate,e}};Ax.className="Conv2DTranspose";ce.registerClass(Ax);var xx=class extends mm{constructor(e){super(e);if(this.inputSpec=[new tn({ndim:5})],this.padding!=="same"&&this.padding!=="valid")throw new q(`Conv3DTranspose currently supports only padding modes 'same' and 'valid', but received padding mode ${this.padding}`)}build(e){if(e=At(e),e.length!==5)throw new q("Input should have rank 5; Received input shape: "+JSON.stringify(e));let t=this.dataFormat==="channelsFirst"?1:e.length-1;if(e[t]==null)throw new q("The channel dimension of the inputs should be defined. Found `None`.");let n=e[t],r=this.kernelSize.concat([this.filters,n]);this.kernel=this.addWeight("kernel",r,"float32",this.kernelInitializer,this.kernelRegularizer,!0,this.kernelConstraint),this.useBias&&(this.bias=this.addWeight("bias",[this.filters],"float32",this.biasInitializer,this.biasRegularizer,!0,this.biasConstraint)),this.inputSpec=[new tn({ndim:5,axes:{[t]:n}})],this.built=!0}call(e,t){return Z(()=>{let n=Ke(e);if(n.shape.length!==5)throw new q(`Conv3DTranspose.call() expects input tensor to be rank-4, but received a tensor of rank-${n.shape.length}`);let r=n.shape,s=r[0],a,o,i;this.dataFormat==="channelsFirst"?(i=2,a=3,o=4):(i=1,a=2,o=3);let l=r[i],u=r[a],c=r[o],d=this.kernelSize[0],h=this.kernelSize[1],p=this.kernelSize[2],f=this.strides[0],m=this.strides[1],g=this.strides[2],y=Ps(l,f,d,this.padding),A=Ps(u,m,h,this.padding),x=Ps(c,g,p,this.padding),b=[s,y,A,x,this.filters];this.dataFormat!=="channelsLast"&&(n=pt(n,[0,2,3,4,1]));let v=Xj(n,this.kernel.read(),b,this.strides,this.padding);return this.dataFormat!=="channelsLast"&&(v=pt(v,[0,4,1,2,3])),this.bias!==null&&(v=hs(v,this.bias.read(),this.dataFormat)),this.activation!==null&&(v=this.activation.apply(v)),v})}computeOutputShape(e){e=At(e);let t=e.slice(),n,r,s,a;this.dataFormat==="channelsFirst"?(n=1,r=2,s=3,a=4):(n=4,r=1,s=2,a=3);let o=this.kernelSize[0],i=this.kernelSize[1],l=this.kernelSize[2],u=this.strides[0],c=this.strides[1],d=this.strides[2];return t[n]=this.filters,t[r]=Ps(t[r],u,o,this.padding),t[s]=Ps(t[s],c,i,this.padding),t[a]=Ps(t[a],d,l,this.padding),t}getConfig(){let e=super.getConfig();return delete e.dilationRate,e}};xx.className="Conv3DTranspose";ce.registerClass(xx);var A8=class extends qd{constructor(e,t){super(e,t);if(this.DEFAULT_DEPTHWISE_INITIALIZER="glorotUniform",this.DEFAULT_POINTWISE_INITIALIZER="glorotUniform",this.depthwiseKernel=null,this.pointwiseKernel=null,t.filters==null)throw new q("The `filters` configuration field is required by SeparableConv, but is unspecified.");if(t.kernelInitializer!=null||t.kernelRegularizer!=null||t.kernelConstraint!=null)throw new q("Fields kernelInitializer, kernelRegularizer and kernelConstraint are invalid for SeparableConv2D. Use depthwiseInitializer, depthwiseRegularizer, depthwiseConstraint, pointwiseInitializer, pointwiseRegularizer and pointwiseConstraint instead.");if(t.padding!=null&&t.padding!=="same"&&t.padding!=="valid")throw new q(`SeparableConv${this.rank}D supports only padding modes: 'same' and 'valid', but received ${JSON.stringify(t.padding)}`);this.depthMultiplier=t.depthMultiplier==null?1:t.depthMultiplier,this.depthwiseInitializer=zt(t.depthwiseInitializer||this.DEFAULT_DEPTHWISE_INITIALIZER),this.depthwiseRegularizer=Lt(t.depthwiseRegularizer),this.depthwiseConstraint=hn(t.depthwiseConstraint),this.pointwiseInitializer=zt(t.depthwiseInitializer||this.DEFAULT_POINTWISE_INITIALIZER),this.pointwiseRegularizer=Lt(t.pointwiseRegularizer),this.pointwiseConstraint=hn(t.pointwiseConstraint)}build(e){if(e=At(e),e.length{e=Ke(e);let n;if(this.rank===1)throw new Ge("1D separable convolution is not implemented yet.");return this.rank===2&&(this.dataFormat==="channelsFirst"&&(e=pt(e,[0,2,3,1])),n=bI(e,this.depthwiseKernel.read(),this.pointwiseKernel.read(),this.strides,this.padding,this.dilationRate,"NHWC")),this.useBias&&(n=hs(n,this.bias.read(),this.dataFormat)),this.activation!=null&&(n=this.activation.apply(n)),this.dataFormat==="channelsFirst"&&(n=pt(n,[0,3,1,2])),n})}getConfig(){let e=super.getConfig();return delete e.rank,delete e.kernelInitializer,delete e.kernelRegularizer,delete e.kernelConstraint,e.depthwiseInitializer=Ht(this.depthwiseInitializer),e.pointwiseInitializer=Ht(this.pointwiseInitializer),e.depthwiseRegularizer=kt(this.depthwiseRegularizer),e.pointwiseRegularizer=kt(this.pointwiseRegularizer),e.depthwiseConstraint=dn(this.depthwiseConstraint),e.pointwiseConstraint=dn(this.pointwiseConstraint),e}};A8.className="SeparableConv";var bx=class extends A8{constructor(e){super(2,e)}};bx.className="SeparableConv2D";ce.registerClass(bx);var x8=class extends qd{constructor(e){super(1,e);x8.verifyArgs(e),this.inputSpec=[{ndim:3}]}getConfig(){let e=super.getConfig();return delete e.rank,delete e.dataFormat,e}static verifyArgs(e){if(typeof e.kernelSize!="number"&&!T1(e.kernelSize,"number",1,1))throw new q(`Conv1D expects config.kernelSize to be number or number[] with length 1, but received ${JSON.stringify(e.kernelSize)}.`)}},vx=x8;vx.className="Conv1D";ce.registerClass(vx);var wx=class extends st{constructor(e){super(e);typeof e.cropping=="number"?this.cropping=[[e.cropping,e.cropping],[e.cropping,e.cropping]]:typeof e.cropping[0]=="number"?this.cropping=[[e.cropping[0],e.cropping[0]],[e.cropping[1],e.cropping[1]]]:this.cropping=e.cropping,this.dataFormat=e.dataFormat===void 0?"channelsLast":e.dataFormat,this.inputSpec=[{ndim:4}]}computeOutputShape(e){return this.dataFormat==="channelsFirst"?[e[0],e[1],e[2]-this.cropping[0][0]-this.cropping[0][1],e[3]-this.cropping[1][0]-this.cropping[1][1]]:[e[0],e[1]-this.cropping[0][0]-this.cropping[0][1],e[2]-this.cropping[1][0]-this.cropping[1][1],e[3]]}call(e,t){return Z(()=>{if(e=Ke(e),this.dataFormat==="channelsLast"){let n=Gf(e,this.cropping[0][0],e.shape[1]-this.cropping[0][0]-this.cropping[0][1],2);return Gf(n,this.cropping[1][0],e.shape[2]-this.cropping[1][1]-this.cropping[1][0],3)}else{let n=Gf(e,this.cropping[0][0],e.shape[2]-this.cropping[0][0]-this.cropping[0][1],3);return Gf(n,this.cropping[1][0],e.shape[3]-this.cropping[1][1]-this.cropping[1][0],4)}})}getConfig(){let e={cropping:this.cropping,dataFormat:this.dataFormat},t=super.getConfig();return Object.assign(e,t),e}};wx.className="Cropping2D";ce.registerClass(wx);var kx=class extends st{constructor(e){super(e);this.DEFAULT_SIZE=[2,2],this.inputSpec=[{ndim:4}],this.size=e.size==null?this.DEFAULT_SIZE:e.size,this.dataFormat=e.dataFormat==null?"channelsLast":e.dataFormat,Yt(this.dataFormat),this.interpolation=e.interpolation==null?"nearest":e.interpolation,lee(this.interpolation)}computeOutputShape(e){if(this.dataFormat==="channelsFirst"){let t=e[2]==null?null:this.size[0]*e[2],n=e[3]==null?null:this.size[1]*e[3];return[e[0],e[1],t,n]}else{let t=e[1]==null?null:this.size[0]*e[1],n=e[2]==null?null:this.size[1]*e[2];return[e[0],t,n,e[3]]}}call(e,t){return Z(()=>{let n=Ke(e),r=n.shape;if(this.dataFormat==="channelsFirst"){n=pt(n,[0,2,3,1]);let s=this.size[0]*r[2],a=this.size[1]*r[3],o=this.interpolation==="nearest"?n.resizeNearestNeighbor([s,a]):n.resizeBilinear([s,a]);return pt(o,[0,3,1,2])}else{let s=this.size[0]*r[1],a=this.size[1]*r[2];return this.interpolation==="nearest"?n.resizeNearestNeighbor([s,a]):n.resizeBilinear([s,a])}})}getConfig(){let e={size:this.size,dataFormat:this.dataFormat},t=super.getConfig();return Object.assign(e,t),e}};kx.className="UpSampling2D";ce.registerClass(kx);function Kte(e,t,n=[1,1],r="valid",s,a){return Z(()=>{s==null&&(s=us()),Yt(s);let o=gx(e,s);if(e.rank!==4)throw new q(`Input for depthwiseConv2d is required to be 4-D, but is instead ${e.rank}-D`);if(t.rank!==4)throw new q(`depthwiseKernel is required to be 4-D, but is instead ${t.rank}-D`);return o=Td(o,t,n,r==="same"?"same":"valid","NHWC",a),s==="channelsFirst"&&(o=pt(o,[0,3,1,2])),o})}var Ix=class extends yx{constructor(e){super(2,e);this.depthwiseKernel=null,this.depthMultiplier=e.depthMultiplier==null?1:e.depthMultiplier,this.depthwiseInitializer=zt(e.depthwiseInitializer||this.DEFAULT_KERNEL_INITIALIZER),this.depthwiseConstraint=hn(e.depthwiseConstraint),this.depthwiseRegularizer=Lt(e.depthwiseRegularizer)}build(e){if(e=At(e),e.length<4)throw new q(`Inputs to DepthwiseConv2D should have rank 4. Received input shape: ${JSON.stringify(e)}.`);let t=this.dataFormat==="channelsFirst"?1:3;if(e[t]==null||e[t]<0)throw new q(`The channel dimension of the inputs to DepthwiseConv2D should be defined, but is not (${e[t]}).`);let n=e[t],r=[this.kernelSize[0],this.kernelSize[1],n,this.depthMultiplier];this.depthwiseKernel=this.addWeight("depthwise_kernel",r,null,this.depthwiseInitializer,this.depthwiseRegularizer,!0,this.depthwiseConstraint),this.useBias?this.bias=this.addWeight("bias",[n*this.depthMultiplier],null,this.biasInitializer,this.biasRegularizer,!0,this.biasConstraint):this.bias=null,this.built=!0}call(e,t){return Z(()=>{e=Ke(e);let n=Kte(e,this.depthwiseKernel.read(),this.strides,this.padding,this.dataFormat,null);return this.useBias&&(n=hs(n,this.bias.read(),this.dataFormat)),this.activation!=null&&(n=this.activation.apply(n)),n})}computeOutputShape(e){e=At(e);let t=this.dataFormat==="channelsFirst"?e[2]:e[1],n=this.dataFormat==="channelsFirst"?e[3]:e[2],r=this.dataFormat==="channelsFirst"?e[1]*this.depthMultiplier:e[3]*this.depthMultiplier,s=ms(t,this.kernelSize[0],this.padding,this.strides[0]),a=ms(n,this.kernelSize[1],this.padding,this.strides[1]);return this.dataFormat==="channelsFirst"?[e[0],r,s,a]:[e[0],s,a,r]}getConfig(){let e=super.getConfig();return e.depthMultiplier=this.depthMultiplier,e.depthwiseInitializer=Ht(this.depthwiseInitializer),e.depthwiseRegularizer=kt(this.depthwiseRegularizer),e.depthwiseConstraint=dn(this.depthwiseRegularizer),e}};Ix.className="DepthwiseConv2D";ce.registerClass(Ix);function b8(e,t,n,r){if(Array.isArray(e)){if(t!=null||n!=null)throw new q("When inputs is an array, neither initialState or constants should be provided");r!=null&&(n=e.slice(e.length-r,e.length),e=e.slice(0,e.length-r)),e.length>1&&(t=e.slice(1,e.length)),e=e[0]}function s(a){return a==null||Array.isArray(a)?a:[a]}return t=s(t),n=s(n),{inputs:e,initialState:t,constants:n}}function v8(e,t,n,r=!1,s,a,o=!1,i=!1){return Z(()=>{let l=t.shape.length;if(l<3)throw new q(`Input should be at least 3D, but is ${l}D.`);let u=[1,0].concat(ds(2,l));if(t=pt(t,u),a!=null)throw new Ge("The rnn() functoin of the deeplearn.js backend does not support constants yet.");o&&console.warn("Backend rnn(): the unroll = true option is not applicable to the imperative deeplearn.js backend."),s!=null&&(s=s.asType("bool").asType("float32"),s.rank===l-1&&(s=$r(s,-1)),s=pt(s,u)),r&&(t=Fr(t,0),s!=null&&(s=Fr(s,0)));let c=[],d,h=n,p=t.shape[0],f=ls(t),m;s!=null&&(m=ls(s));for(let y=0;ye(A,h));if(s==null)d=x[0],h=x[1];else{let b=Z(()=>{let v=m[y],w=Dr(v).sub(v),I=x[0].mul(v).add(h[0].mul(w)),T=h.map((C,M)=>x[1][M].mul(v).add(C.mul(w)));return{output:I,newStates:T}});d=b.output,h=b.newStates}i&&c.push(d)}let g;return i&&(g=Mr(c,1)),[d,g,h]})}var w8=class extends st{constructor(e){super(e);let t;if(e.cell==null)throw new q("cell property is missing for the constructor of RNN.");if(Array.isArray(e.cell)?t=new Am({cells:e.cell}):t=e.cell,t.stateSize==null)throw new q("The RNN cell should have an attribute `stateSize` (tuple of integers, one integer per RNN state).");this.cell=t,this.returnSequences=e.returnSequences==null?!1:e.returnSequences,this.returnState=e.returnState==null?!1:e.returnState,this.goBackwards=e.goBackwards==null?!1:e.goBackwards,this._stateful=e.stateful==null?!1:e.stateful,this.unroll=e.unroll==null?!1:e.unroll,this.supportsMasking=!0,this.inputSpec=[new tn({ndim:3})],this.stateSpec=null,this.states_=null,this.numConstants=null,this.keptStates=[]}getStates(){if(this.states_==null){let e=Array.isArray(this.cell.stateSize)?this.cell.stateSize.length:1;return ds(0,e).map(t=>null)}else return this.states_}setStates(e){this.states_=e}computeOutputShape(e){U1(e)&&(e=e[0]),e=e;let t=this.cell.stateSize;Array.isArray(t)||(t=[t]);let n=t[0],r;if(this.returnSequences?r=[e[0],e[1],n]:r=[e[0],n],this.returnState){let s=[];for(let a of t)s.push([e[0],a]);return[r].concat(s)}else return r}computeMask(e,t){return Z(()=>{Array.isArray(t)&&(t=t[0]);let n=this.returnSequences?t:null;if(this.returnState){let r=this.states.map(s=>null);return[n].concat(r)}else return n})}get states(){if(this.states_==null){let e=Array.isArray(this.cell.stateSize)?this.cell.stateSize.length:1,t=[];for(let n=0;no.shape[o.shape.length-1]),a))throw new q(`An initialState was passed that is not compatible with cell.stateSize. Received stateSpec=${this.stateSpec}; However cell.stateSize is ${this.cell.stateSize}`)}else this.stateSpec=a.map(o=>new tn({shape:[null,o]}));this.stateful&&this.resetStates()}resetStates(e,t=!1){Z(()=>{if(!this.stateful)throw new da("Cannot call resetStates() on an RNN Layer that is not stateful.");let n=this.inputSpec[0].shape[0];if(n==null)throw new q("If an RNN is stateful, it needs to know its batch size. Specify the batch size of your input tensors: \n- If using a Sequential model, specify the batch size by passing a `batchInputShape` option to your first layer.\n- If using the functional API, specify the batch size by passing a `batchShape` option to your Input layer.");if(this.states_==null)Array.isArray(this.cell.stateSize)?this.states_=this.cell.stateSize.map(r=>un([n,r])):this.states_=[un([n,this.cell.stateSize])];else if(e==null)je(this.states_),this.keptStates!=null&&(je(this.keptStates),this.keptStates=[]),Array.isArray(this.cell.stateSize)?this.states_=this.cell.stateSize.map(r=>un([n,r])):this.states_[0]=un([n,this.cell.stateSize]);else{if(Array.isArray(e)||(e=[e]),e.length!==this.states_.length)throw new q(`Layer ${this.name} expects ${this.states_.length} state(s), but it received ${e.length} state value(s). Input received: ${e}`);t===!0?this.keptStates.push(this.states_.slice()):je(this.states_);for(let r=0;rSn(r.clone()))})}apply(e,t){let n=t==null?null:t.initialState,r=t==null?null:t.constants;t==null&&(t={});let s=b8(e,n,r,this.numConstants);e=s.inputs,n=s.initialState,r=s.constants;let a=[],o=[];if(n!=null){t.initialState=n,a=a.concat(n),this.stateSpec=[];for(let l of n)this.stateSpec.push(new tn({shape:l.shape}));o=o.concat(this.stateSpec)}if(r!=null&&(t.constants=r,a=a.concat(r),this.numConstants=r.length),a[0]instanceof ps){let l=[e].concat(a),u=this.inputSpec.concat(o),c=this.inputSpec;this.inputSpec=u;let d=super.apply(l,t);return this.inputSpec=c,d}else return super.apply(e,t)}call(e,t){return Z(()=>{let n=t==null?null:t.mask,r=t==null?null:t.training,s=t==null?null:t.initialState;e=Ke(e),s==null&&(this.stateful?s=this.states_:s=this.getInitialState(e));let a=Array.isArray(this.cell.stateSize)?this.cell.stateSize.length:1;if(s.length!==a)throw new q(`RNN Layer has ${a} state(s) but was passed ${s.length} initial state(s).`);this.unroll&&console.warn("Ignoring unroll = true for RNN layer, due to imperative backend.");let o={training:r},l=v8((p,f)=>{let m=this.cell.call([p].concat(f),o);return[m[0],m.slice(1)]},e,s,this.goBackwards,n,null,this.unroll,this.returnSequences),u=l[0],c=l[1],d=l[2];this.stateful&&this.resetStates(d,r);let h=this.returnSequences?c:u;return this.returnState?[h].concat(d):h})}getInitialState(e){return Z(()=>{let t=un(e.shape);return t=_e(t,[1,2]),t=Ld(t),Array.isArray(this.cell.stateSize)?this.cell.stateSize.map(n=>n>1?F1(t,[1,n]):t):this.cell.stateSize>1?[F1(t,[1,this.cell.stateSize])]:[t]})}get trainableWeights(){return this.trainable?this.cell.trainableWeights:[]}get nonTrainableWeights(){return this.trainable?this.cell.nonTrainableWeights:this.cell.weights}setFastWeightInitDuringBuild(e){super.setFastWeightInitDuringBuild(e),this.cell!=null&&this.cell.setFastWeightInitDuringBuild(e)}getConfig(){let e=super.getConfig(),t={returnSequences:this.returnSequences,returnState:this.returnState,goBackwards:this.goBackwards,stateful:this.stateful,unroll:this.unroll};this.numConstants!=null&&(t.numConstants=this.numConstants);let n=this.cell.getConfig();return this.getClassName()===w8.className&&(t.cell={className:this.cell.getClassName(),config:n}),{...n,...e,...t}}static fromConfig(e,t,n={}){let r=t.cell,s=fs(r,n);return new e(Object.assign(t,{cell:s}))}},fa=w8;fa.className="RNN";ce.registerClass(fa);var Kd=class extends st{},gm=class extends Kd{constructor(e){super(e);this.DEFAULT_ACTIVATION="tanh",this.DEFAULT_KERNEL_INITIALIZER="glorotNormal",this.DEFAULT_RECURRENT_INITIALIZER="orthogonal",this.DEFAULT_BIAS_INITIALIZER="zeros",this.units=e.units,An(this.units,"units"),this.activation=Za(e.activation==null?this.DEFAULT_ACTIVATION:e.activation),this.useBias=e.useBias==null?!0:e.useBias,this.kernelInitializer=zt(e.kernelInitializer||this.DEFAULT_KERNEL_INITIALIZER),this.recurrentInitializer=zt(e.recurrentInitializer||this.DEFAULT_RECURRENT_INITIALIZER),this.biasInitializer=zt(e.biasInitializer||this.DEFAULT_BIAS_INITIALIZER),this.kernelRegularizer=Lt(e.kernelRegularizer),this.recurrentRegularizer=Lt(e.recurrentRegularizer),this.biasRegularizer=Lt(e.biasRegularizer),this.kernelConstraint=hn(e.kernelConstraint),this.recurrentConstraint=hn(e.recurrentConstraint),this.biasConstraint=hn(e.biasConstraint),this.dropout=ru([1,qa([0,e.dropout==null?0:e.dropout])]),this.recurrentDropout=ru([1,qa([0,e.recurrentDropout==null?0:e.recurrentDropout])]),this.stateSize=this.units,this.dropoutMask=null,this.recurrentDropoutMask=null}build(e){e=At(e),this.kernel=this.addWeight("kernel",[e[e.length-1],this.units],null,this.kernelInitializer,this.kernelRegularizer,!0,this.kernelConstraint),this.recurrentKernel=this.addWeight("recurrent_kernel",[this.units,this.units],null,this.recurrentInitializer,this.recurrentRegularizer,!0,this.recurrentConstraint),this.useBias?this.bias=this.addWeight("bias",[this.units],null,this.biasInitializer,this.biasRegularizer,!0,this.biasConstraint):this.bias=null,this.built=!0}call(e,t){return Z(()=>{if(e=e,e.length!==2)throw new q(`SimpleRNNCell expects 2 input Tensors, got ${e.length}.`);let n=e[1];e=e[0];let r=t.training==null?!1:t.training;0Dr(e),rate:this.dropout,training:r})),0Dr(n),rate:this.recurrentDropout,training:r}));let s,a=this.dropoutMask,o=this.recurrentDropoutMask;a!=null?s=Fs(K(e,a),this.kernel.read()):s=Fs(e,this.kernel.read()),this.bias!=null&&(s=hs(s,this.bias.read())),o!=null&&(n=K(n,o));let i=pe(s,Fs(n,this.recurrentKernel.read()));return this.activation!=null&&(i=this.activation.apply(i)),[i,i]})}getConfig(){let e=super.getConfig(),t={units:this.units,activation:Xa(this.activation),useBias:this.useBias,kernelInitializer:Ht(this.kernelInitializer),recurrentInitializer:Ht(this.recurrentInitializer),biasInitializer:Ht(this.biasInitializer),kernelRegularizer:kt(this.kernelRegularizer),recurrentRegularizer:kt(this.recurrentRegularizer),biasRegularizer:kt(this.biasRegularizer),activityRegularizer:kt(this.activityRegularizer),kernelConstraint:dn(this.kernelConstraint),recurrentConstraint:dn(this.recurrentConstraint),biasConstraint:dn(this.biasConstraint),dropout:this.dropout,recurrentDropout:this.recurrentDropout};return{...e,...t}}};gm.className="SimpleRNNCell";ce.registerClass(gm);var Sx=class extends fa{constructor(e){e.cell=new gm(e),super(e)}call(e,t){return Z(()=>{this.cell.dropoutMask!=null&&(je(this.cell.dropoutMask),this.cell.dropoutMask=null),this.cell.recurrentDropoutMask!=null&&(je(this.cell.recurrentDropoutMask),this.cell.recurrentDropoutMask=null);let n=t==null?null:t.mask,r=t==null?null:t.training,s=t==null?null:t.initialState;return super.call(e,{mask:n,training:r,initialState:s})})}static fromConfig(e,t){return new e(t)}};Sx.className="SimpleRNN";ce.registerClass(Sx);var ym=class extends Kd{constructor(e){super(e);if(this.DEFAULT_ACTIVATION="tanh",this.DEFAULT_RECURRENT_ACTIVATION="hardSigmoid",this.DEFAULT_KERNEL_INITIALIZER="glorotNormal",this.DEFAULT_RECURRENT_INITIALIZER="orthogonal",this.DEFAULT_BIAS_INITIALIZER="zeros",e.resetAfter)throw new q("GRUCell does not support reset_after parameter set to true.");this.units=e.units,An(this.units,"units"),this.activation=Za(e.activation===void 0?this.DEFAULT_ACTIVATION:e.activation),this.recurrentActivation=Za(e.recurrentActivation===void 0?this.DEFAULT_RECURRENT_ACTIVATION:e.recurrentActivation),this.useBias=e.useBias==null?!0:e.useBias,this.kernelInitializer=zt(e.kernelInitializer||this.DEFAULT_KERNEL_INITIALIZER),this.recurrentInitializer=zt(e.recurrentInitializer||this.DEFAULT_RECURRENT_INITIALIZER),this.biasInitializer=zt(e.biasInitializer||this.DEFAULT_BIAS_INITIALIZER),this.kernelRegularizer=Lt(e.kernelRegularizer),this.recurrentRegularizer=Lt(e.recurrentRegularizer),this.biasRegularizer=Lt(e.biasRegularizer),this.kernelConstraint=hn(e.kernelConstraint),this.recurrentConstraint=hn(e.recurrentConstraint),this.biasConstraint=hn(e.biasConstraint),this.dropout=ru([1,qa([0,e.dropout==null?0:e.dropout])]),this.recurrentDropout=ru([1,qa([0,e.recurrentDropout==null?0:e.recurrentDropout])]),this.implementation=e.implementation,this.stateSize=this.units,this.dropoutMask=null,this.recurrentDropoutMask=null}build(e){e=At(e);let t=e[e.length-1];this.kernel=this.addWeight("kernel",[t,this.units*3],null,this.kernelInitializer,this.kernelRegularizer,!0,this.kernelConstraint),this.recurrentKernel=this.addWeight("recurrent_kernel",[this.units,this.units*3],null,this.recurrentInitializer,this.recurrentRegularizer,!0,this.recurrentConstraint),this.useBias?this.bias=this.addWeight("bias",[this.units*3],null,this.biasInitializer,this.biasRegularizer,!0,this.biasConstraint):this.bias=null,this.built=!0}call(e,t){return Z(()=>{if(e=e,e.length!==2)throw new q(`GRUCell expects 2 input Tensors (inputs, h, c), got ${e.length}.`);let n=t.training==null?!1:t.training,r=e[1];e=e[0],0Dr(e),rate:this.dropout,training:n,count:3})),0Dr(r),rate:this.recurrentDropout,training:n,count:3}));let s=this.dropoutMask,a=this.recurrentDropoutMask,o,i,l;0{this.cell.dropoutMask!=null&&(je(this.cell.dropoutMask),this.cell.dropoutMask=null),this.cell.recurrentDropoutMask!=null&&(je(this.cell.recurrentDropoutMask),this.cell.recurrentDropoutMask=null);let n=t==null?null:t.mask,r=t==null?null:t.training,s=t==null?null:t.initialState;return super.call(e,{mask:n,training:r,initialState:s})})}static fromConfig(e,t){return t.implmentation===0&&(t.implementation=1),new e(t)}};Tx.className="GRU";ce.registerClass(Tx);var Xd=class extends Kd{constructor(e){super(e);this.DEFAULT_ACTIVATION="tanh",this.DEFAULT_RECURRENT_ACTIVATION="hardSigmoid",this.DEFAULT_KERNEL_INITIALIZER="glorotNormal",this.DEFAULT_RECURRENT_INITIALIZER="orthogonal",this.DEFAULT_BIAS_INITIALIZER="zeros",this.units=e.units,An(this.units,"units"),this.activation=Za(e.activation===void 0?this.DEFAULT_ACTIVATION:e.activation),this.recurrentActivation=Za(e.recurrentActivation===void 0?this.DEFAULT_RECURRENT_ACTIVATION:e.recurrentActivation),this.useBias=e.useBias==null?!0:e.useBias,this.kernelInitializer=zt(e.kernelInitializer||this.DEFAULT_KERNEL_INITIALIZER),this.recurrentInitializer=zt(e.recurrentInitializer||this.DEFAULT_RECURRENT_INITIALIZER),this.biasInitializer=zt(e.biasInitializer||this.DEFAULT_BIAS_INITIALIZER),this.unitForgetBias=e.unitForgetBias,this.kernelRegularizer=Lt(e.kernelRegularizer),this.recurrentRegularizer=Lt(e.recurrentRegularizer),this.biasRegularizer=Lt(e.biasRegularizer),this.kernelConstraint=hn(e.kernelConstraint),this.recurrentConstraint=hn(e.recurrentConstraint),this.biasConstraint=hn(e.biasConstraint),this.dropout=ru([1,qa([0,e.dropout==null?0:e.dropout])]),this.recurrentDropout=ru([1,qa([0,e.recurrentDropout==null?0:e.recurrentDropout])]),this.implementation=e.implementation,this.stateSize=[this.units,this.units],this.dropoutMask=null,this.recurrentDropoutMask=null}build(e){var t;e=At(e);let n=e[e.length-1];this.kernel=this.addWeight("kernel",[n,this.units*4],null,this.kernelInitializer,this.kernelRegularizer,!0,this.kernelConstraint),this.recurrentKernel=this.addWeight("recurrent_kernel",[this.units,this.units*4],null,this.recurrentInitializer,this.recurrentRegularizer,!0,this.recurrentConstraint);let r;if(this.useBias){if(this.unitForgetBias){let s=this.biasInitializer,a=this.units;r=new(t=class extends Zr{apply(o,i){let l=s.apply([a]),u=new qf().apply([a]),c=s.apply([a*2]);return pS(pS(l,u),c)}},t.className="CustomInit",t)}else r=this.biasInitializer;this.bias=this.addWeight("bias",[this.units*4],null,r,this.biasRegularizer,!0,this.biasConstraint)}else this.bias=null;this.built=!0}call(e,t){return Z(()=>{let n=t.training==null?!1:t.training;if(e=e,e.length!==3)throw new q(`LSTMCell expects 3 input Tensors (inputs, h, c), got ${e.length}.`);let r=e[1],s=e[2];e=e[0],0Dr(e),rate:this.dropout,training:n,count:4})),0Dr(r),rate:this.recurrentDropout,training:n,count:4}));let a=this.dropoutMask,o=this.recurrentDropoutMask,i,l,u,c;0{this.cell.dropoutMask!=null&&(je(this.cell.dropoutMask),this.cell.dropoutMask=null),this.cell.recurrentDropoutMask!=null&&(je(this.cell.recurrentDropoutMask),this.cell.recurrentDropoutMask=null);let n=t==null?null:t.mask,r=t==null?null:t.training,s=t==null?null:t.initialState;return super.call(e,{mask:n,training:r,initialState:s})})}static fromConfig(e,t){return t.implmentation===0&&(t.implementation=1),new e(t)}};Nx.className="LSTM";ce.registerClass(Nx);var Am=class extends Kd{constructor(e){super(e);this.cells=e.cells}get stateSize(){let e=[];for(let t of this.cells.slice().reverse())Array.isArray(t.stateSize)?e.push(...t.stateSize):e.push(t.stateSize);return e}call(e,t){return Z(()=>{e=e;let n=e.slice(1),r=[];for(let o of this.cells.slice().reverse())Array.isArray(o.stateSize)?r.push(n.splice(0,o.stateSize.length)):r.push(n.splice(0,1));r.reverse();let s=[],a;for(let o=0;o{ii(`RNNCell_${r}`,()=>{n.build(e),Array.isArray(n.stateSize)?t=n.stateSize[0]:t=n.stateSize,e=[e[0],t]})}),this.built=!0}getConfig(){let e=super.getConfig(),t=s=>({className:s.getClassName(),config:s.getConfig()}),r={cells:this.cells.map(t)};return{...e,...r}}static fromConfig(e,t,n={}){let r=[];for(let s of t.cells)r.push(fs(s,n));return new e({cells:r})}get trainableWeights(){if(!this.trainable)return[];let e=[];for(let t of this.cells)e.push(...t.trainableWeights);return e}get nonTrainableWeights(){let e=[];for(let t of this.cells)e.push(...t.nonTrainableWeights);if(!this.trainable){let t=[];for(let n of this.cells)t.push(...n.trainableWeights);return t.concat(e)}return e}getWeights(){let e=[];for(let t of this.cells)e.push(...t.weights);return H1(e)}setWeights(e){let t=[];for(let n of this.cells){let r=n.weights.length,s=e.splice(r);for(let a=0;amS(t(),n),o=()=>Wd(a,t,r);return!s||s<=1?Sn(o().clone()):Array(s).fill(void 0).map(o).map(l=>Sn(l.clone()))}var k8=class extends fa{constructor(e){if(e.unroll)throw new Ge("Unrolling is not possible with convolutional RNNs.");if(Array.isArray(e.cell))throw new Ge("It is not possible at the moment to stack convolutional cells.");super(e);this.inputSpec=[new tn({ndim:5})]}call(e,t){return Z(()=>{if(this.cell.dropoutMask!=null&&(je(this.cell.dropoutMask),this.cell.dropoutMask=null),this.cell.recurrentDropoutMask!=null&&(je(this.cell.recurrentDropoutMask),this.cell.recurrentDropoutMask=null),t&&t.constants)throw new q("ConvRNN2D cell does not support constants");let n=t==null?null:t.mask,r=t==null?null:t.training,s=t==null?null:t.initialState;return super.call(e,{mask:n,training:r,initialState:s})})}computeOutputShape(e){let t=this.computeSingleOutputShape(e);return this.returnSequences||(t=[t[0],...t.slice(2)]),this.returnState&&(t=[t,...Array(2).fill([e[0],...t.slice(-3)])]),t}getInitialState(e){return Z(()=>{let{stateSize:t}=this.cell,n=e.shape,r=this.computeSingleOutputShape(n),s=[r[0],...r.slice(2)],a=un(s);return Array.isArray(t)?Array(t.length).fill(a):[a]})}resetStates(e,t=!1){Z(()=>{if(!this.stateful)throw new da("Cannot call resetStates() on an RNN Layer that is not stateful.");let n=this.inputSpec[0].shape,r=this.computeSingleOutputShape(n),s=[r[0],...r.slice(2)];if(n[0]==null)throw new q("If an RNN is stateful, it needs to know its batch size. Specify the batch size of your input tensors: \n- If using a Sequential model, specify the batch size by passing a `batchInputShape` option to your first layer.\n- If using the functional API, specify the batch size by passing a `batchShape` option to your Input layer.");if(this.getStates()==null)Array.isArray(this.cell.stateSize)?this.states_=this.cell.stateSize.map(()=>un(s)):this.states_=[un(s)];else if(e==null)je(this.states_),this.keptStates!=null&&(je(this.keptStates),this.keptStates=[]),Array.isArray(this.cell.stateSize)?this.states_=this.cell.stateSize.map(()=>un(s)):this.states_[0]=un(s);else{if(Array.isArray(e)||(e=[e]),e.length!==this.states_.length)throw new q(`Layer ${this.name} expects ${this.states_.length} state(s), but it received ${e.length} state value(s). Input received: ${e}`);t?this.keptStates.push(this.states_.slice()):je(this.states_);for(let o=0;oSn(o.clone()))})}computeSingleOutputShape(e){let{dataFormat:t,filters:n,kernelSize:r,padding:s,strides:a,dilationRate:o}=this.cell,i=t==="channelsFirst",l=e[i?3:2],u=e[i?4:3],c=ms(l,r[0],s,a[0],o[0]),d=ms(u,r[1],s,a[1],o[1]);return[...e.slice(0,2),...i?[n,c,d]:[c,d,n]]}};k8.className="ConvRNN2D";var xm=class extends Xd{constructor(e){let{filters:t,kernelSize:n,strides:r,padding:s,dataFormat:a,dilationRate:o}=e;super({...e,units:t});this.filters=t,An(this.filters,"filters"),this.kernelSize=iu(n,2,"kernelSize"),this.kernelSize.forEach(i=>An(i,"kernelSize")),this.strides=iu(r||1,2,"strides"),this.strides.forEach(i=>An(i,"strides")),this.padding=s||"valid",Or(this.padding),this.dataFormat=a||"channelsLast",Yt(this.dataFormat),this.dilationRate=iu(o||1,2,"dilationRate"),this.dilationRate.forEach(i=>An(i,"dilationRate"))}build(e){var t;e=At(e);let n=this.dataFormat==="channelsFirst"?1:e.length-1;if(e[n]==null)throw new q(`The channel dimension of the input should be defined. Found ${e[n]}`);let r=e[n],s=4,a=this.kernelSize.concat([r,this.filters*s]);this.kernel=this.addWeight("kernel",a,null,this.kernelInitializer,this.kernelRegularizer,!0,this.kernelConstraint);let o=this.kernelSize.concat([this.filters,this.filters*s]);if(this.recurrentKernel=this.addWeight("recurrent_kernel",o,null,this.recurrentInitializer,this.recurrentRegularizer,!0,this.recurrentConstraint),this.useBias){let i;if(this.unitForgetBias){let l=this.biasInitializer,u=this.filters;i=new(t=class extends Zr{apply(c,d){let h=l.apply([u]),p=la([u]),f=l.apply([u*2]);return D1([h,p,f])}},t.className="CustomInit",t)}else i=this.biasInitializer;this.bias=this.addWeight("bias",[this.filters*s],null,i,this.biasRegularizer,!0,this.biasConstraint)}this.built=!0}call(e,t){return Z(()=>{if(e.length!==3)throw new q(`ConvLSTM2DCell expects 3 input Tensors (inputs, h, c), got ${e.length}.`);let n=t.training||!1,r=e[0],s=e[1],a=e[2],o=4;0Dr(r),rate:this.dropout,training:n,count:o}));let i=this.dropoutMask,l=(ee,oe,se)=>!oe||!oe[se]?ee:K(oe[se],ee),u=l(r,i,0),c=l(r,i,1),d=l(r,i,2),h=l(r,i,3);0Dr(s),rate:this.recurrentDropout,training:n,count:o}));let p=this.recurrentDropoutMask,f=l(s,p,0),m=l(s,p,1),g=l(s,p,2),y=l(s,p,3),A=3,[x,b,v,w]=dr(this.kernel.read(),o,A),[I,T,C,M]=this.useBias?dr(this.bias.read(),o):[null,null,null,null];u=this.inputConv(u,x,I,this.padding),c=this.inputConv(c,b,T,this.padding),d=this.inputConv(d,v,C,this.padding),h=this.inputConv(h,w,M,this.padding);let[$,R,N,F]=dr(this.recurrentKernel.read(),o,A);f=this.recurrentConv(f,$),m=this.recurrentConv(m,R),g=this.recurrentConv(g,N),y=this.recurrentConv(y,F);let B=this.recurrentActivation.apply(pe(u,f)),j=this.recurrentActivation.apply(pe(c,m)),X=pe(K(j,a),K(B,this.activation.apply(pe(d,g)))),Y=K(this.recurrentActivation.apply(pe(h,y)),this.activation.apply(X));return[Y,Y,X]})}getConfig(){let{units:e,...t}=super.getConfig(),n={filters:this.filters,kernelSize:this.kernelSize,padding:this.padding,dataFormat:this.dataFormat,dilationRate:this.dilationRate,strides:this.strides};return{...t,...n}}inputConv(e,t,n,r){let s=Ba(e,t,this.strides,r||"valid",this.dataFormat==="channelsFirst"?"NCHW":"NHWC",this.dilationRate);return n?hs(s,n,this.dataFormat):s}recurrentConv(e,t){return Ba(e,t,1,"same",this.dataFormat==="channelsFirst"?"NCHW":"NHWC")}};xm.className="ConvLSTM2DCell";ce.registerClass(xm);var Cx=class extends k8{constructor(e){let t=new xm(e);super({...e,cell:t})}static fromConfig(e,t){return new e(t)}};Cx.className="ConvLSTM2D";ce.registerClass(Cx);var bm=class extends st{constructor(e){super(e);this.rate=Math.max(Math.min(e.rate,1),0),this.noiseShape=e.noiseShape,this.seed=e.seed,this.supportsMasking=!0}getNoiseShape(e){if(this.noiseShape==null)return this.noiseShape;let t=e.shape,n=[];for(let r=0;r{this.invokeCallHook(e,t);let n=Ke(e);if(0mS(n,this.rate,s,this.seed),()=>n,r)}return e})}getConfig(){let e={rate:this.rate,noiseShape:this.noiseShape,seed:this.seed},t=super.getConfig();return Object.assign(e,t),e}dispose(){return super.dispose()}};bm.className="Dropout";ce.registerClass(bm);var Ex=class extends bm{constructor(e){super(e);this.inputSpec=[{ndim:3}]}getNoiseShape(e){let t=e.shape;return[t[0],1,t[2]]}};Ex.className="SpatialDropout1D";ce.registerClass(Ex);var $x=class extends st{constructor(e){super(e);if(this.activation=null,this.useBias=!0,this.kernel=null,this.bias=null,this.DEFAULT_KERNEL_INITIALIZER="glorotNormal",this.DEFAULT_BIAS_INITIALIZER="zeros",e.batchInputShape==null&&e.inputShape==null&&e.inputDim!=null){let t=null;e.batchSize!=null&&(t=e.batchSize),this.batchInputShape=[t,e.inputDim]}this.units=e.units,An(this.units,"units"),this.activation=Za(e.activation),e.useBias!=null&&(this.useBias=e.useBias),this.kernelInitializer=zt(e.kernelInitializer||this.DEFAULT_KERNEL_INITIALIZER),this.biasInitializer=zt(e.biasInitializer||this.DEFAULT_BIAS_INITIALIZER),this.kernelConstraint=hn(e.kernelConstraint),this.biasConstraint=hn(e.biasConstraint),this.kernelRegularizer=Lt(e.kernelRegularizer),this.biasRegularizer=Lt(e.biasRegularizer),this.activityRegularizer=Lt(e.activityRegularizer),this.supportsMasking=!0,this.inputSpec=[{minNDim:2}]}build(e){e=At(e);let t=e[e.length-1];this.kernel==null&&(this.kernel=this.addWeight("kernel",[t,this.units],null,this.kernelInitializer,this.kernelRegularizer,!0,this.kernelConstraint),this.useBias&&(this.bias=this.addWeight("bias",[this.units],null,this.biasInitializer,this.biasRegularizer,!0,this.biasConstraint))),this.inputSpec=[{minNDim:2,axes:{[-1]:t}}],this.built=!0}computeOutputShape(e){e=At(e);let t=e.slice();return t[t.length-1]=this.units,t}call(e,t){return Z(()=>{this.invokeCallHook(e,t);let n=Ke(e),r=sS(this.activation.getClassName()),s;return r!=null?s=Fs(n,this.kernel.read(),r,this.bias?this.bias.read():null):(s=Fs(n,this.kernel.read()),this.bias!=null&&(s=hs(s,this.bias.read())),this.activation!=null&&(s=this.activation.apply(s))),s})}getConfig(){let e={units:this.units,activation:Xa(this.activation),useBias:this.useBias,kernelInitializer:Ht(this.kernelInitializer),biasInitializer:Ht(this.biasInitializer),kernelRegularizer:kt(this.kernelRegularizer),biasRegularizer:kt(this.biasRegularizer),activityRegularizer:kt(this.activityRegularizer),kernelConstraint:dn(this.kernelConstraint),biasConstraint:dn(this.biasConstraint)},t=super.getConfig();return Object.assign(e,t),e}};$x.className="Dense";ce.registerClass($x);var _x=class extends st{constructor(e){e=e||{},super(e),this.inputSpec=[{minNDim:3}],this.dataFormat=e.dataFormat}computeOutputShape(e){e=At(e);for(let t of e.slice(1))if(t==null)throw new q(`The shape of the input to "Flatten" is not fully defined (got ${e.slice(1)}). Make sure to pass a complete "input_shape" or "batch_input_shape" argument to the first layer in your model.`);return[e[0],ja(e,1)]}call(e,t){return Z(()=>{this.invokeCallHook(e,t);let n=Ke(e);if(this.dataFormat==="channelsFirst"&&n.rank>1){let r=[0];for(let s=2;s{this.invokeCallHook(e,t);let n=Ke(e);return this.activation.apply(n)})}getConfig(){let e={activation:Xa(this.activation)},t=super.getConfig();return Object.assign(e,t),e}};Rx.className="Activation";ce.registerClass(Rx);var Dx=class extends st{constructor(e){super(e);this.n=e.n,this.inputSpec=[{ndim:2}]}computeOutputShape(e){return[e[0],this.n,e[1]]}call(e,t){return Z(()=>(e=Ke(e),hee(e,this.n)))}getConfig(){let e={n:this.n},t=super.getConfig();return Object.assign(e,t),e}};Dx.className="RepeatVector";ce.registerClass(Dx);var Fx=class extends st{constructor(e){super(e);this.targetShape=e.targetShape;for(let t=0;t{this.invokeCallHook(e,t);let n=Ke(e),r=n.shape,s=r.slice(0,1).concat(this.fixUnknownDimension(r.slice(1),this.targetShape));return n.reshape(s)})}getConfig(){let e={targetShape:this.targetShape},t=super.getConfig();return Object.assign(e,t),e}};Fx.className="Reshape";ce.registerClass(Fx);var Mx=class extends st{constructor(e){super(e);if(e.dims==null)throw new Error("Required configuration field `dims` is missing during Permute constructor call.");if(!Array.isArray(e.dims))throw new Error(`Permute constructor requires \`dims\` to be an Array, but received ${e.dims} instead.`);let t=ds(1,e.dims.length+1);if(!k.arraysEqual(e.dims.slice().sort(),t))throw new Error("Invalid permutation `dims`: "+JSON.stringify(e.dims)+" `dims` must contain consecutive integers starting from 1.");this.dims=e.dims,this.dimsIncludingBatch=[0].concat(this.dims),this.inputSpec=[new tn({ndim:this.dims.length+1})]}computeOutputShape(e){e=At(e);let t=e.slice();return this.dims.forEach((n,r)=>{t[r+1]=e[n]}),t}call(e,t){return pt(Ke(e),this.dimsIncludingBatch)}getConfig(){let e={dims:this.dims},t=super.getConfig();return Object.assign(e,t),e}};Mx.className="Permute";ce.registerClass(Mx);var Ox=class extends st{constructor(e){super(e==null?{}:e);this.supportsMasking=!0,e!=null?this.maskValue=e.maskValue==null?0:e.maskValue:this.maskValue=0}computeOutputShape(e){return e}getConfig(){let e=super.getConfig(),t={maskValue:this.maskValue};return Object.assign(t,e),t}computeMask(e,t){let n=Ke(e),r=-1;return wf(Yl(n,this.maskValue),r)}call(e,t){return Z(()=>{this.invokeCallHook(e,t);let n=Ke(e),r=-1,s=!0,a=wf(Yl(n,this.maskValue),r,s);return n.mul(a.asType(n.dtype))})}};Ox.className="Masking";ce.registerClass(Ox);var Px=class extends st{constructor(e){super(e);if(this.embeddings=null,this.DEFAULT_EMBEDDINGS_INITIALIZER="randomUniform",e.batchInputShape==null&&e.inputShape==null){let t=null;e.batchSize!=null&&(t=e.batchSize),e.inputLength==null?this.batchInputShape=[t,null]:this.batchInputShape=[t].concat(Dt(e.inputLength))}this.inputDim=e.inputDim,An(this.inputDim,"inputDim"),this.outputDim=e.outputDim,An(this.outputDim,"outputDim"),this.embeddingsInitializer=zt(e.embeddingsInitializer||this.DEFAULT_EMBEDDINGS_INITIALIZER),this.embeddingsRegularizer=Lt(e.embeddingsRegularizer),this.activityRegularizer=Lt(e.activityRegularizer),this.embeddingsConstraint=hn(e.embeddingsConstraint),this.maskZero=e.maskZero,this.supportsMasking=e.maskZero,this.inputLength=e.inputLength}build(e){this.embeddings=this.addWeight("embeddings",[this.inputDim,this.outputDim],this.dtype,this.embeddingsInitializer,this.embeddingsRegularizer,!0,this.embeddingsConstraint),this.built=!0}warnOnIncompatibleInputShape(e){}computeMask(e,t){return Z(()=>this.maskZero?(e=Ke(e),Yl(e,rt(e))):null)}computeOutputShape(e){if(e=At(e),this.inputLength==null)return[...e,this.outputDim];let t=Dt(this.inputLength);if(t.length!==e.length-1)throw new q(`"inputLength" is ${this.inputLength}, but received input shape has shape ${e}`);{let n=0;for(let r=0;r{this.invokeCallHook(e,t);let n=Ke(e);return n.dtype!=="int32"&&(n=zd(n,"int32")),fS(this.embeddings.read(),n.as1D()).reshape(At(this.computeOutputShape(n.shape)))})}getConfig(){let e={inputDim:this.inputDim,outputDim:this.outputDim,embeddingsInitializer:Ht(this.embeddingsInitializer),embeddingsRegularizer:kt(this.embeddingsRegularizer),activityRegularizer:kt(this.activityRegularizer),embeddingsConstraint:dn(this.embeddingsConstraint),maskZero:this.maskZero,inputLength:this.inputLength},t=super.getConfig();return Object.assign(e,t),e}};Px.className="Embedding";ce.registerClass(Px);var hi=class extends st{constructor(e){super(e||{});this.supportsMasking=!0}mergeFunction(e){throw new Ge}computeElementwiseOpOutputShape(e,t){if(e==null||t==null)return null;if(e.length1)throw new q(`Can not merge tensors with different batch sizes. Got tensors with shapes: ${JSON.stringify(e)}.`);let n=e[0]==null?null:e[0].slice(1);for(let s=1;ss.length);e.indexOf(null)===-1&&Ga(r).length===1?this.reshapeRequired=!1:this.reshapeRequired=!0}call(e,t){return Z(()=>{if(e=e,this.reshapeRequired){let n=[],r=e.map(s=>s.rank);if(r.indexOf(null)===-1){let s=qa(r);for(let a of e){let o=a.rank;for(let i=0;i1){let u=ds(1,l).concat([0]);n.push(pt(i,u)),s=!0}else n.push(i)}let a=this.mergeFunction(n),o=a.rank;if(s){if(o==null){let i=a.shape,l=i.length,u=i[l-1],c=[u].concat(i.slice(0,i.length-1));a=pt(a.reshape([-1,u]),[1,0]).reshape(c)}else if(o>1){let i=[o-1].concat(ds(0,o-1));a=pt(a,i)}}return a}}else return this.mergeFunction(e)})}computeOutputShape(e){e=e;let t;e[0]==null?t=null:t=e[0].slice(1);for(let r=1;r{if(t==null)return null;if(!Array.isArray(t))throw new q("`mask` should be an Array");if(!Array.isArray(e))throw new q("`inputs` should be an Array");if(t.length!==e.length)throw new q(`The Array 'inputs' and 'mask' are expected to have the same length, but have different lengths (${e.length} vs ${t.length})`);if(t.every(r=>r==null))return null;t=t.map(r=>r==null?r:$r(r,0));let n=t[0];for(let r=1;r{let t=e[0].clone();for(let n=1;n{let t=e[0].clone();for(let n=1;n{let t=e[0].clone();for(let n=1;n{let t=e[0];for(let n=1;n{let t=e[0];for(let n=1;n1)throw new q("A `Concatenate` layer requires inputs with matching shapes except for the concat axis. Got input shapes: "+JSON.stringify(e))}mergeFunction(e){return Z(()=>D1(e,this.axis))}computeOutputShape(e){if(!(Array.isArray(e)&&Array.isArray(e[0])))throw new q("A `Concatenate` layer should be called on a list of inputs.");let t=e,n=t[0].slice(),r=this.axis<0?n.length+this.axis:this.axis;for(let s of t.slice(1)){if(n[r]==null||s[r]==null){n[r]=null;break}n[r]+=s[r]}return n}computeMask(e,t){if(t==null)return null;if(!Array.isArray(t))throw new q("`mask` should be an array for Concatenate");if(!Array.isArray(e))throw new q("`inputs` should be an array for Concatenate");if(t.length!==e.length)throw new q(`Mismatch in the length of mask (${t.length}) and the legnth of inputs (${e.length})`);return Z(()=>{let n=!0;if(t.forEach(a=>{if(a!=null){n=!1;return}}),n)return null;let r=[];for(let a=0;a3||t.shape.length>3)throw new Ge("batchDot is not implemented for tensors of 4D or higher rank yet");if(k.assert(e.shape.length>=2,()=>`batchDot requires the rank of x to be >= 2, but got ${e.shape.length}`),k.assert(e.shape.length>=2,()=>`batchDot requires the rank of y to be >= 2, but got ${t.shape.length}`),typeof n=="number"&&(n=[n,n]),e.dtype==="complex64"||t.dtype==="complex64")throw new Ge("batchDot is not implemented for complex64-type Tensors yet.");let r=e.shape.length,s=t.shape.length;n==null&&(n=[r-1,s-2]);let a=n;return Z(()=>{let o;if(r>s){o=r-s;let l=[];for(let u=0;ur){o=s-r;let l=[];for(let u=0;u0){let l;r>s?l=r+s-3:l=r-1;let u=[];for(let c=l;c"A `Dot` layer should be called on a list of exactly 2 inputs.");let t=e[0],n=e[1];if(t.length>3||n.length>3)throw new Ge("Dot layer does not support tensors of 4D or higher rank yet.");let r=this.interpretAxes(t,n);if(t[r[0]]!==n[r[1]])throw new q(`Dimension incompatibility: ${t[r[0]]} !== ${n[r[1]]}`)}mergeFunction(e){if(e.length!==2)throw new q(`A \`Dot\` layer must be called on exactly 2 inputs, but received ${e.length} input(s).`);let t=e[0],n=e[1],r;return Array.isArray(this.axes)?r=this.axes.map((s,a)=>Zd(s,e[a].shape.length)):r=[Zd(this.axes,t.shape.length),Zd(this.axes,n.shape.length)],this.normalize&&(t=am(t,r[0]),n=am(n,r[1])),Xte(t,n,r)}interpretAxes(e,t){let n;return Array.isArray(this.axes)?n=this.axes:n=[Zd(this.axes,e.length),Zd(this.axes,t.length)],n}computeOutputShape(e){k.assert(Array.isArray(e)&&e.length===2&&Array.isArray(e[0])&&Array.isArray(e[1]),()=>"A `Dot` layer should be called on a list of exactly 2 inputs.");let t=e[0].slice(),n=e[1].slice();if(t.length>3||n.length>3)throw new Ge("Dot layer does not support tensors of 4D or higher rank yet.");let r=this.interpretAxes(t,n);t.splice(r[0],1),n.splice(r[1],1),n.splice(0,1);let s=t.concat(n);return s.length===1&&s.push(1),s}computeMask(e,t){return null}getConfig(){let e={axes:this.axes,normalize:this.normalize},t=super.getConfig();return Object.assign(e,t),e}};Hx.className="Dot";ce.registerClass(Hx);var Gx=class extends st{constructor(e){super(e);this.supportsMasking=!0,this.stddev=e.stddev}computeOutputShape(e){return e}getConfig(){let e=super.getConfig(),t={stddev:this.stddev};return Object.assign(t,e),t}call(e,t){return Z(()=>{this.invokeCallHook(e,t);let n=Ke(e);return Wd(()=>jf(n.shape,0,this.stddev).add(n),()=>n,t.training||!1)})}};Gx.className="GaussianNoise";ce.registerClass(Gx);var jx=class extends st{constructor(e){super(e);this.supportsMasking=!0,this.rate=e.rate}computeOutputShape(e){return e}getConfig(){let e=super.getConfig(),t={rate:this.rate};return Object.assign(t,e),t}call(e,t){return Z(()=>{this.invokeCallHook(e,t);let n=Ke(e);return this.rate>0&&this.rate<1?Wd(()=>{let s=Math.sqrt(this.rate/(1-this.rate));return n.mul(jf(n.shape,1,s))},()=>n,t.training||!1):n})}};jx.className="GaussianDropout";ce.registerClass(jx);var qx=class extends st{constructor(e){super(e);this.supportsMasking=!0,this.rate=e.rate,this.noiseShape=e.noiseShape}_getNoiseShape(e){return this.noiseShape||Ke(e).shape}computeOutputShape(e){return e}getConfig(){let e=super.getConfig(),t={rate:this.rate};return Object.assign(t,e),t}call(e,t){return Z(()=>{if(this.rate<1&&this.rate>0){let n=this._getNoiseShape(e);return Wd(()=>{let s=Ke(e),a=1.6732632423543772,o=1.0507009873554805,i=-a*o,l=Jo(Rd(n),this.rate);l=zd(l,"float32");let u=((1-this.rate)*(1+this.rate*i**2))**-.5,c=-u*i*this.rate;return s.mul(l).add(l.add(-1).mul(i)).mul(u).add(c)},()=>Ke(e),t.training||!1)}return e})}};qx.className="AlphaDropout";ce.registerClass(qx);function Yd(e,t,n,r,s,a=.001){let o;if(e.rank===2)o=Sj(e,t,n,r,s,a);else if(e.rank===3)o=Nj(e,t,n,r,s,a);else if(e.rank===4)o=Ej(e,t,n,r,s,a);else throw new Ge(`batchNormalization is not implemented for array of rank ${e.rank} yet`);return o}function Zte(e,t,n,r,s=.001){return Z(()=>{let a=qA(e,r),o=a.mean,i=a.variance;return[Yd(e,o,i,n,t,s),o,i]})}function Yte(e,t,n,r,s=.001){return Z(()=>{let a=qA(e,r),o=a.mean,i=a.variance,l=[];for(let f of ds(0,e.rank))r.indexOf(f)!==-1?l.push(1):l.push(e.shape[f]);let u=o.reshape(l),c=i.reshape(l),d=t==null?null:t.reshape(l),h=n==null?null:n.reshape(l);return[Yd(e,u,c,h,d,s),o,i]})}function Jte(e,t,n,r,s=.001){return k.arraysEqual(r.slice().sort(),ds(0,e.rank-1))?Zte(e,t,n,r,s):Yte(e,t,n,r,s)}var Kx=class extends st{constructor(e){e==null&&(e={}),super(e),this.supportsMasking=!0,this.axis=e.axis==null?-1:e.axis,this.momentum=e.momentum==null?.99:e.momentum,this.epsilon=e.epsilon==null?.001:e.epsilon,this.center=e.center==null?!0:e.center,this.scale=e.scale==null?!0:e.scale,this.betaInitializer=zt(e.betaInitializer||"zeros"),this.gammaInitializer=zt(e.gammaInitializer||"ones"),this.movingMeanInitializer=zt(e.movingMeanInitializer||"zeros"),this.movingVarianceInitializer=zt(e.movingVarianceInitializer||"ones"),this.betaConstraint=hn(e.betaConstraint),this.gammaConstraint=hn(e.gammaConstraint),this.betaRegularizer=Lt(e.betaRegularizer),this.gammaRegularizer=Lt(e.gammaRegularizer)}build(e){e=At(e);let t=this.axis>=0?this.axis:this.axis+e.length,n=e[t];if(n==null)throw new q(`Axis ${t} of input tensor should have a defined dimension but the layer received an input with shape ${JSON.stringify(e)}.`);this.inputSpec=[new tn({ndim:e.length,axes:{[t]:n}})];let r=[n];this.scale&&(this.gamma=this.addWeight("gamma",r,null,this.gammaInitializer,this.gammaRegularizer,!0,this.gammaConstraint)),this.center&&(this.beta=this.addWeight("beta",r,null,this.betaInitializer,this.betaRegularizer,!0,this.betaConstraint)),this.movingMean=this.addWeight("moving_mean",r,null,this.movingMeanInitializer,null,!1),this.movingVariance=this.addWeight("moving_variance",r,null,this.movingVarianceInitializer,null,!1),this.built=!0}call(e,t){return Z(()=>{let n=t.training==null?!1:t.training,r=Ke(e),s=r.shape,a=s.length,o=ds(0,a),i=this.axis>=0?this.axis:this.axis+a;o.splice(i,1);let l=si(1,a);l[i]=s[i];let u=o.slice();u.sort();let c=!k.arraysEqual(u,ds(0,a).slice(0,a-1)),d=()=>{if(c){let y=this.movingMean.read().reshape(l),A=this.movingVariance.read().reshape(l),x=this.center?this.beta.read().reshape(l):null,b=this.scale?this.gamma.read().reshape(l):null;return Yd(r,y,A,x,b,this.epsilon)}else return Yd(r,this.movingMean.read(),this.movingVariance.read(),this.beta==null?null:this.beta.read(),this.gamma==null?null:this.gamma.read(),this.epsilon)};if(!n)return d();let[h,p,f]=Jte(r,this.gamma.read(),this.beta.read(),o,this.epsilon),m=(y,A,x)=>{Z(()=>{let b=1-x,v=y.read(),w=v.sub(A).mul(b);y.write(v.sub(w))})};return(()=>{m(this.movingMean,p,this.momentum),m(this.movingVariance,f,this.momentum)})(),h})}getConfig(){let e={axis:this.axis,momentum:this.momentum,epsilon:this.epsilon,center:this.center,scale:this.scale,betaInitializer:Ht(this.betaInitializer),gammaInitializer:Ht(this.gammaInitializer),movingMeanInitializer:Ht(this.movingMeanInitializer),movingVarianceInitializer:Ht(this.movingVarianceInitializer),betaRegularizer:kt(this.betaRegularizer),gammaRegularizer:kt(this.gammaRegularizer),betaConstraint:dn(this.betaConstraint),gammaConstraint:dn(this.gammaConstraint)},t=super.getConfig();return Object.assign(e,t),e}};Kx.className="BatchNormalization";ce.registerClass(Kx);var Xx=class extends st{constructor(e){if(e==null&&(e={}),super(e),this.axis=e.axis==null?-1:e.axis,typeof this.axis=="number"){if(!Number.isInteger(this.axis))throw new Error(`Expected axis to be an integer, but received ${this.axis}`)}else if(Array.isArray(this.axis)){for(let t of this.axis)if(!Number.isInteger(t))throw new Error(`Expected axis to be an array of integers, but received ${JSON.stringify(this.axis)}`)}else throw new Error(`Expected axis to be an integer or an array of integers, but received ${JSON.stringify(this.axis)}`);this.epsilon=e.epsilon==null?.001:e.epsilon,this.center=e.center==null?!0:e.center,this.scale=e.scale==null?!0:e.scale,this.betaInitializer=zt(e.betaInitializer||"zeros"),this.gammaInitializer=zt(e.gammaInitializer||"ones"),this.betaRegularizer=Lt(e.betaRegularizer),this.gammaRegularizer=Lt(e.gammaRegularizer),this.supportsMasking=!0}build(e){e=At(e);let t=e.length;typeof this.axis=="number"&&(this.axis=[this.axis]);for(let s=0;s=t)throw new Error(`Invalid axis: ${s}`);if(this.axis.length!==Ga(this.axis).length)throw new Error(`Found duplicate axes in: ${this.axis}`);let n=this.axis.map(s=>e[s]),r=!0;this.scale?this.gamma=this.addWeight("gamma",n,"float32",this.gammaInitializer,this.gammaRegularizer,r):this.gamma=null,this.center?this.beta=this.addWeight("beta",n,"float32",this.betaInitializer,this.betaRegularizer,r):this.beta=null,this.built=!0}call(e,t){let n=Ke(e),r=n.shape,s=r.length;return Z(()=>{let a=!0,{mean:o,variance:i}=qA(n,this.axis,a),l=si(1,s);for(let f of this.axis)l[f]=r[f];let u=f=>f!=null&&f.shape.length!==s&&this.axis!==[s-1]?f.reshape(l):f,c=u(this.gamma.read()),d=u(this.beta.read()),h=[],p=[];for(let f=0;f{if(e.rank!==4)throw new q(`temporalPadding expects input tensor to be 4-D, but received a ${e.rank}-D tensor.`);if(t==null&&(t=[[1,1],[1,1]]),t.length!==2||t[0].length!==2||t[1].length!==2)throw new q("spatial2dPadding expects `padding` to be an Array of two Arrays, each of which is an Array of two integers.");if(n==null&&(n=us()),n!=="channelsLast"&&n!=="channelsFirst")throw new q(`Unknown data format: ${n}. Supported data formats are 'channelsLast' and 'channelsFirst.`);let r;return n==="channelsFirst"?r=[[0,0],[0,0],t[0],t[1]]:r=[[0,0],t[0],t[1],[0,0]],Wa(e,r)})}var Zx=class extends st{constructor(e){if(e==null&&(e={}),super(e),this.dataFormat=e.dataFormat==null?us():e.dataFormat,e.padding==null)this.padding=[[1,1],[1,1]];else if(typeof e.padding=="number")this.padding=[[e.padding,e.padding],[e.padding,e.padding]];else{if(e.padding=e.padding,e.padding.length!==2)throw new q(`ZeroPadding2D expects padding to be a length-2 array, but received a length-${e.padding.length} array.`);let t,n;if(typeof e.padding[0]=="number")t=[e.padding[0],e.padding[0]],n=[e.padding[1],e.padding[1]];else{if(e.padding=e.padding,e.padding[0].length!==2)throw new q(`ZeroPadding2D expects height padding to be a length-2 array, but received a length-${e.padding[0].length} array.`);if(t=e.padding[0],e.padding[1].length!==2)throw new q(`ZeroPadding2D expects width padding to be a length-2 array, but received a length-${e.padding[1].length} array.`);n=e.padding[1]}this.padding=[t,n]}this.inputSpec=[new tn({ndim:4})]}computeOutputShape(e){e=At(e);let t,n;return this.dataFormat==="channelsFirst"?(e[2]!=null&&e[2]>=0?t=e[2]+this.padding[0][0]+this.padding[0][1]:t=null,e[3]!=null&&e[3]>=0?n=e[3]+this.padding[1][0]+this.padding[1][1]:n=null,[e[0],e[1],t,n]):(e[1]!=null&&e[1]>=0?t=e[1]+this.padding[0][0]+this.padding[0][1]:t=null,e[2]!=null&&e[2]>=0?n=e[2]+this.padding[1][0]+this.padding[1][1]:n=null,[e[0],t,n,e[3]])}call(e,t){return Z(()=>Qte(Ke(e),this.padding,this.dataFormat))}getConfig(){let e={padding:this.padding,dataFormat:this.dataFormat},t=super.getConfig();return Object.assign(e,t),e}};Zx.className="ZeroPadding2D";ce.registerClass(Zx);function vm(e,t,n,r,s,a){return Z(()=>{Yt(s),lS(a),Or(r),n==null&&(n=[1,1]),r==null&&(r="valid"),s==null&&(s=us()),a==null&&(a="max"),e=gx(e,s);let o,i=r==="same"?"same":"valid";return a==="max"?o=$f(e,t,n,i):o=Sf(e,t,n,i),s==="channelsFirst"&&(o=pt(o,[0,3,1,2])),o})}function I8(e,t,n,r,s,a){return Z(()=>{Yt(s),lS(a),Or(r),n==null&&(n=[1,1,1]),r==null&&(r="valid"),s==null&&(s=us()),a==null&&(a="max"),e=f8(e,s);let o,i=r==="same"?"same":"valid";return a==="max"?o=gI(e,t,n,i):o=Q6(e,t,n,i),s==="channelsFirst"&&(o=pt(o,[0,4,1,2,3])),o})}var S8=class extends st{constructor(e){if(e.poolSize==null&&(e.poolSize=2),super(e),typeof e.poolSize=="number")this.poolSize=[e.poolSize];else if(Array.isArray(e.poolSize)&&e.poolSize.length===1&&typeof e.poolSize[0]=="number")this.poolSize=e.poolSize;else throw new q(`poolSize for 1D convolutional layer must be a number or an Array of a single number, but received ${JSON.stringify(e.poolSize)}`);if(An(this.poolSize,"poolSize"),e.strides==null)this.strides=this.poolSize;else if(typeof e.strides=="number")this.strides=[e.strides];else if(Array.isArray(e.strides)&&e.strides.length===1&&typeof e.strides[0]=="number")this.strides=e.strides;else throw new q(`strides for 1D convolutional layer must be a number or an Array of a single number, but received ${JSON.stringify(e.strides)}`);An(this.strides,"strides"),this.padding=e.padding==null?"valid":e.padding,Or(this.padding),this.inputSpec=[new tn({ndim:3})]}computeOutputShape(e){e=At(e);let t=ms(e[1],this.poolSize[0],this.padding,this.strides[0]);return[e[0],t,e[2]]}call(e,t){return Z(()=>{this.invokeCallHook(e,t),e=Ld(Ke(e),2);let n=this.poolingFunction(Ke(e),[this.poolSize[0],1],[this.strides[0],1],this.padding,"channelsLast");return Jl(n,[2])})}getConfig(){let e={poolSize:this.poolSize,padding:this.padding,strides:this.strides},t=super.getConfig();return Object.assign(e,t),e}},Yx=class extends S8{constructor(e){super(e)}poolingFunction(e,t,n,r,s){return Yt(s),Or(r),vm(e,t,n,r,s,"max")}};Yx.className="MaxPooling1D";ce.registerClass(Yx);var Jx=class extends S8{constructor(e){super(e)}poolingFunction(e,t,n,r,s){return Yt(s),Or(r),vm(e,t,n,r,s,"avg")}};Jx.className="AveragePooling1D";ce.registerClass(Jx);var T8=class extends st{constructor(e){if(e.poolSize==null&&(e.poolSize=[2,2]),super(e),this.poolSize=Array.isArray(e.poolSize)?e.poolSize:[e.poolSize,e.poolSize],e.strides==null)this.strides=this.poolSize;else if(Array.isArray(e.strides)){if(e.strides.length!==2)throw new q(`If the strides property of a 2D pooling layer is an Array, it is expected to have a length of 2, but received length ${e.strides.length}.`);this.strides=e.strides}else this.strides=[e.strides,e.strides];An(this.poolSize,"poolSize"),An(this.strides,"strides"),this.padding=e.padding==null?"valid":e.padding,this.dataFormat=e.dataFormat==null?"channelsLast":e.dataFormat,Yt(this.dataFormat),Or(this.padding),this.inputSpec=[new tn({ndim:4})]}computeOutputShape(e){e=At(e);let t=this.dataFormat==="channelsFirst"?e[2]:e[1],n=this.dataFormat==="channelsFirst"?e[3]:e[2];return t=ms(t,this.poolSize[0],this.padding,this.strides[0]),n=ms(n,this.poolSize[1],this.padding,this.strides[1]),this.dataFormat==="channelsFirst"?[e[0],e[1],t,n]:[e[0],t,n,e[3]]}call(e,t){return Z(()=>(this.invokeCallHook(e,t),this.poolingFunction(Ke(e),this.poolSize,this.strides,this.padding,this.dataFormat)))}getConfig(){let e={poolSize:this.poolSize,padding:this.padding,strides:this.strides,dataFormat:this.dataFormat},t=super.getConfig();return Object.assign(e,t),e}},Qx=class extends T8{constructor(e){super(e)}poolingFunction(e,t,n,r,s){return Yt(s),Or(r),vm(e,t,n,r,s,"max")}};Qx.className="MaxPooling2D";ce.registerClass(Qx);var e5=class extends T8{constructor(e){super(e)}poolingFunction(e,t,n,r,s){return Yt(s),Or(r),vm(e,t,n,r,s,"avg")}};e5.className="AveragePooling2D";ce.registerClass(e5);var N8=class extends st{constructor(e){if(e.poolSize==null&&(e.poolSize=[2,2,2]),super(e),this.poolSize=Array.isArray(e.poolSize)?e.poolSize:[e.poolSize,e.poolSize,e.poolSize],e.strides==null)this.strides=this.poolSize;else if(Array.isArray(e.strides)){if(e.strides.length!==3)throw new q(`If the strides property of a 3D pooling layer is an Array, it is expected to have a length of 3, but received length ${e.strides.length}.`);this.strides=e.strides}else this.strides=[e.strides,e.strides,e.strides];An(this.poolSize,"poolSize"),An(this.strides,"strides"),this.padding=e.padding==null?"valid":e.padding,this.dataFormat=e.dataFormat==null?"channelsLast":e.dataFormat,Yt(this.dataFormat),Or(this.padding),this.inputSpec=[new tn({ndim:5})]}computeOutputShape(e){e=At(e);let t=this.dataFormat==="channelsFirst"?e[2]:e[1],n=this.dataFormat==="channelsFirst"?e[3]:e[2],r=this.dataFormat==="channelsFirst"?e[4]:e[3];return t=ms(t,this.poolSize[0],this.padding,this.strides[0]),n=ms(n,this.poolSize[1],this.padding,this.strides[1]),r=ms(r,this.poolSize[2],this.padding,this.strides[2]),this.dataFormat==="channelsFirst"?[e[0],e[1],t,n,r]:[e[0],t,n,r,e[4]]}call(e,t){return Z(()=>(this.invokeCallHook(e,t),this.poolingFunction(Ke(e),this.poolSize,this.strides,this.padding,this.dataFormat)))}getConfig(){let e={poolSize:this.poolSize,padding:this.padding,strides:this.strides,dataFormat:this.dataFormat},t=super.getConfig();return Object.assign(e,t),e}},t5=class extends N8{constructor(e){super(e)}poolingFunction(e,t,n,r,s){return Yt(s),Or(r),I8(e,t,n,r,s,"max")}};t5.className="MaxPooling3D";ce.registerClass(t5);var n5=class extends N8{constructor(e){super(e)}poolingFunction(e,t,n,r,s){return Yt(s),Or(r),I8(e,t,n,r,s,"avg")}};n5.className="AveragePooling3D";ce.registerClass(n5);var C8=class extends st{constructor(e){super(e);this.inputSpec=[new tn({ndim:3})]}computeOutputShape(e){return[e[0],e[2]]}call(e,t){throw new Ge}},r5=class extends C8{constructor(e){super(e||{})}call(e,t){return Z(()=>{let n=Ke(e);return Xt(n,1)})}};r5.className="GlobalAveragePooling1D";ce.registerClass(r5);var s5=class extends C8{constructor(e){super(e||{})}call(e,t){return Z(()=>{let n=Ke(e);return os(n,1)})}};s5.className="GlobalMaxPooling1D";ce.registerClass(s5);var E8=class extends st{constructor(e){super(e);this.dataFormat=e.dataFormat==null?"channelsLast":e.dataFormat,Yt(this.dataFormat),this.inputSpec=[new tn({ndim:4})]}computeOutputShape(e){return e=e,this.dataFormat==="channelsLast"?[e[0],e[3]]:[e[0],e[1]]}call(e,t){throw new Ge}getConfig(){let e={dataFormat:this.dataFormat},t=super.getConfig();return Object.assign(e,t),e}},a5=class extends E8{call(e,t){return Z(()=>{let n=Ke(e);return this.dataFormat==="channelsLast"?Xt(n,[1,2]):Xt(n,[2,3])})}};a5.className="GlobalAveragePooling2D";ce.registerClass(a5);var o5=class extends E8{call(e,t){return Z(()=>{let n=Ke(e);return this.dataFormat==="channelsLast"?os(n,[1,2]):os(n,[2,3])})}};o5.className="GlobalMaxPooling2D";ce.registerClass(o5);var $8=class extends st{constructor(e){super(e);this.layer=e.layer}build(e){this.built=!0}get trainable(){return this.layer!=null?this.layer.trainable:!1}set trainable(e){this.layer!=null&&(this.layer.trainable=e)}get trainableWeights(){return this.layer.trainableWeights}get nonTrainableWeights(){return this.layer.nonTrainableWeights}get updates(){return this.layer._updates}get losses(){return this.layer.losses}getWeights(){return this.layer.getWeights()}setWeights(e){this.layer.setWeights(e)}getConfig(){let e={layer:{className:this.layer.getClassName(),config:this.layer.getConfig()}},t=super.getConfig();return Object.assign(e,t),e}setFastWeightInitDuringBuild(e){super.setFastWeightInitDuringBuild(e),this.layer!=null&&this.layer.setFastWeightInitDuringBuild(e)}static fromConfig(e,t,n={}){let r=t.layer,s=fs(r,n);delete t.layer;let a={layer:s};return Object.assign(a,t),new e(a)}},i5=class extends $8{constructor(e){super(e);this.supportsMasking=!0}build(e){if(e=At(e),e.length<3)throw new q(`TimeDistributed layer expects an input shape >= 3D, but received input shape ${JSON.stringify(e)}`);this.inputSpec=[{shape:e}];let t=[e[0]].concat(e.slice(2));this.layer.built||(this.layer.build(t),this.layer.built=!0),super.build(e)}computeOutputShape(e){e=At(e);let t=[e[0]].concat(e.slice(2)),n=this.layer.computeOutputShape(t),r=e[1];return[n[0],r].concat(n.slice(1))}call(e,t){return Z(()=>(e=Ke(e),v8((a,o)=>[Ke(this.layer.call(a,t)),[]],e,[],!1,null,null,!1,!0)[1]))}};i5.className="TimeDistributed";ce.registerClass(i5);function ene(e){oi(iee,"BidirectionalMergeMode",e)}var tne="concat",l5=class extends $8{constructor(e){super(e);let t=e.layer.getConfig(),n={};n.className=e.layer.getClassName(),n.config=t,this.forwardLayer=fs(n),t.goBackwards=t.goBackwards!==!0;let r={};if(r.className=e.layer.getClassName(),r.config=t,this.backwardLayer=fs(r),this.forwardLayer.name="forward_"+this.forwardLayer.name,this.backwardLayer.name="backward_"+this.backwardLayer.name,this.mergeMode=e.mergeMode===void 0?tne:e.mergeMode,ene(this.mergeMode),e.weights)throw new Ge("weights support is not implemented for Bidirectional layer yet.");this._stateful=e.layer.stateful,this.returnSequences=e.layer.returnSequences,this.returnState=e.layer.returnState,this.supportsMasking=!0,this._trainable=!0,this.inputSpec=e.layer.inputSpec,this.numConstants=null}get trainable(){return this._trainable}set trainable(e){this._trainable=e,this.forwardLayer!=null&&(this.forwardLayer.trainable=e),this.backwardLayer!=null&&(this.backwardLayer.trainable=e)}getWeights(){return this.forwardLayer.getWeights().concat(this.backwardLayer.getWeights())}setWeights(e){let t=e.length,n=Math.floor(t/2);this.forwardLayer.setWeights(e.slice(0,n)),this.backwardLayer.setWeights(e.slice(n))}computeOutputShape(e){let t=this.forwardLayer.computeOutputShape(e);Array.isArray(t)&&Array.isArray(t[0])||(t=[t]),t=t;let n,r,s;return this.returnState&&(s=t.slice(1)),n=t[0],n=n,this.mergeMode==="concat"?(n[n.length-1]*=2,r=[n]):this.mergeMode==null?r=[n,n.slice()]:r=[n],this.returnState?this.mergeMode==null?r.concat(s).concat(s.slice()):[n].concat(s).concat(s.slice()):Jn(r)}apply(e,t){let n=t==null?null:t.initialState,r=t==null?null:t.constants;t==null&&(t={});let s=b8(e,n,r,this.numConstants);if(e=s.inputs,n=s.initialState,r=s.constants,Array.isArray(e)&&(n=e.slice(1),e=e[0]),(n==null||n.length===0)&&r==null)return super.apply(e,t);let a=[],o=[];if(n!=null){let l=n.length;if(l%2>0)throw new q("When passing `initialState` to a Bidrectional RNN, the state should be an Array containing the states of the underlying RNNs.");t.initialState=n,a.push(...n);let u=n.map(c=>new tn({shape:c.shape}));this.forwardLayer.stateSpec=u.slice(0,l/2),this.backwardLayer.stateSpec=u.slice(l/2),o.push(...u)}if(r!=null)throw new Ge("Support for constants in Bidirectional layers is not implemented yet.");let i=a[0]instanceof ps;for(let l of a)if(l instanceof ps!==i)throw new q("The initial state of a Bidirectional layer cannot be specified as a mix of symbolic and non-symbolic tensors");if(i){let l=[e].concat(a),u=this.inputSpec.concat(o),c=this.inputSpec;this.inputSpec=u;let d=super.apply(l,t);return this.inputSpec=c,d}else return super.apply(e,t)}call(e,t){return Z(()=>{let n=t.initialState,r,s;if(n==null)r=this.forwardLayer.call(e,t),s=this.backwardLayer.call(e,t);else{let i=n.slice(0,n.length/2),l=n.slice(n.length/2);r=this.forwardLayer.call(e,Object.assign(t,{initialState:i})),s=this.backwardLayer.call(e,Object.assign(t,{initialState:l}))}let a;this.returnState&&(Array.isArray(r)&&(a=r.slice(1).concat(s.slice(1))),r=r[0],s=s[0]),this.returnSequences&&(s=Fr(s,1));let o;return this.mergeMode==="concat"?o=D1([r,s]):this.mergeMode==="sum"?o=pe(r,s):this.mergeMode==="ave"?o=K(.5,pe(r,s)):this.mergeMode==="mul"?o=K(r,s):this.mergeMode==null&&(o=[r,s]),this.returnState?this.mergeMode==null?o.concat(a):[o].concat(a):o})}resetStates(e){this.forwardLayer.resetStates(),this.backwardLayer.resetStates()}build(e){ii(this.forwardLayer.name,()=>{this.forwardLayer.build(e)}),ii(this.backwardLayer.name,()=>{this.backwardLayer.build(e)}),this.built=!0}computeMask(e,t){Array.isArray(t)&&(t=t[0]);let n;if(this.returnSequences?this.mergeMode==null?n=[t,t]:n=t:this.mergeMode==null?n=[null,null]:n=null,this.returnState){let s=this.forwardLayer.states.map(a=>null);return Array.isArray(n)?n.concat(s).concat(s):[n].concat(s).concat(s)}else return n}get trainableWeights(){return this.forwardLayer.trainableWeights.concat(this.backwardLayer.trainableWeights)}get nonTrainableWeights(){return this.forwardLayer.nonTrainableWeights.concat(this.backwardLayer.nonTrainableWeights)}setFastWeightInitDuringBuild(e){super.setFastWeightInitDuringBuild(e),this.forwardLayer!=null&&this.forwardLayer.setFastWeightInitDuringBuild(e),this.backwardLayer!=null&&this.backwardLayer.setFastWeightInitDuringBuild(e)}getConfig(){let e={mergeMode:this.mergeMode},t=super.getConfig();return Object.assign(e,t),e}static fromConfig(e,t){let n=fs(t.layer);if(delete t.layer,t.numConstants!=null)throw new Ge("Deserialization of a Bidirectional layer with numConstants present is not supported yet.");let r=t;return r.layer=n,new e(r)}};l5.className="Bidirectional";ce.registerClass(l5);function nne(e){return new su(e)}function rne(e){return new px(e)}function sne(e){return new cx(e)}function ane(e){return new dx(e)}function one(e){return new hx(e)}function ine(e){return new mx(e)}function lne(e){return new fx(e)}function une(e){return new vx(e)}function cne(e){return new fm(e)}function dne(e){return new Ax(e)}function hne(e){return new mm(e)}function pne(e){return new xx(e)}function fne(e){return new bx(e)}function mne(e){return new wx(e)}function gne(e){return new kx(e)}function yne(e){return new Ix(e)}function Ane(e){return new Rx(e)}function xne(e){return new $x(e)}function bne(e){return new bm(e)}function vne(e){return new Ex(e)}function wne(e){return new _x(e)}function kne(e){return new Dx(e)}function Ine(e){return new Fx(e)}function Sne(e){return new Mx(e)}function Tne(e){return new Px(e)}function Nne(e){return new zx(e)}function Cne(e){return new Bx(e)}function Ene(e){return new Ux(e)}function $ne(e){return new Wx(e)}function _ne(e){return new Vx(e)}function Rne(e){return new Lx(e)}function Dne(e){return new Hx(e)}function Fne(e){return new Kx(e)}function Mne(e){return new Xx(e)}function One(e){return new Zx(e)}function u5(e){return new Jx(e)}function Pne(e){return u5(e)}function zne(e){return u5(e)}function c5(e){return new e5(e)}function Lne(e){return c5(e)}function Bne(e){return c5(e)}function d5(e){return new n5(e)}function Wne(e){return d5(e)}function Vne(e){return d5(e)}function Une(e){return new r5(e)}function Hne(e){return new a5(e)}function _8(e){return new s5(e)}function R8(e){return new o5(e)}function D8(e){return new Yx(e)}function F8(e){return new Qx(e)}function Gne(e){return new t5(e)}function jne(e){return new Tx(e)}function qne(e){return new ym(e)}function Kne(e){return new Nx(e)}function Xne(e){return new Xd(e)}function Zne(e){return new Sx(e)}function Yne(e){return new gm(e)}function Jne(e){return new Cx(e)}function Qne(e){return new xm(e)}function ere(e){return new fa(e)}function tre(e){return new Am(e)}function nre(e){return new l5(e)}function rre(e){return new i5(e)}var sre=_8,are=R8,ore=D8,ire=F8;function lre(e){return new Gx(e)}function ure(e){return new jx(e)}function cre(e){return new qx(e)}function dre(e){return new Ox(e)}var M8={};De(M8,{MAPE:()=>wre,MSE:()=>Sre,binaryAccuracy:()=>hre,binaryCrossentropy:()=>pre,categoricalAccuracy:()=>mre,categoricalCrossentropy:()=>gre,cosineProximity:()=>xre,mape:()=>kre,meanAbsoluteError:()=>bre,meanAbsolutePercentageError:()=>vre,meanSquaredError:()=>Ire,mse:()=>Tre,precision:()=>yre,recall:()=>Are,sparseCategoricalAccuracy:()=>fre});function hre(e,t){return X1(e,t)}function pre(e,t){return DS(e,t)}function fre(e,t){return FS(e,t)}function mre(e,t){return Z1(e,t)}function gre(e,t){return Y1(e,t)}function yre(e,t){return RS(e,t)}function Are(e,t){return nte(e,t)}function xre(e,t){return q1(e,t)}function bre(e,t){return om(e,t)}function vre(e,t){return ou(e,t)}function wre(e,t){return ou(e,t)}function kre(e,t){return ou(e,t)}function Ire(e,t){return ui(e,t)}function Sre(e,t){return ui(e,t)}function Tre(e,t){return ui(e,t)}var O8={};De(O8,{modelFromJSON:()=>Ote});var P8={};De(P8,{l1:()=>Cre,l1l2:()=>Nre,l2:()=>Ere});function Nre(e){return new jd(e)}function Cre(e){return Hte(e)}function Ere(e){return Gte(e)}var z8=class extends au{constructor(){super(...arguments);this.model=null}setModel(e){if(!(e instanceof pa))throw new Error("model must be a LayersModel, not some other Container");this.model=e}};function wm(e,t){return et}var B8=class extends z8{constructor(e){super();if(e==null&&(e={}),e.restoreBestWeights)throw new Ge("restoreBestWeights = True is not implemented in EarlyStopping yet.");this.monitor=e.monitor||"val_loss",this.minDelta=Math.abs(e.minDelta||0),this.patience=e.patience||0,this.verbose=e.verbose||0,this.mode=e.mode||"auto",this.baseline=e.baseline,["auto","min","max"].indexOf(this.mode)===-1&&(console.warn(`EarlyStopping mode '${this.mode}' is invalid. Falling back to mode 'auto'.`),this.mode="auto"),this.mode==="min"?this.monitorFunc=wm:this.mode==="max"?this.monitorFunc=L8:this.monitor.indexOf("acc")!==-1?this.monitorFunc=L8:this.monitorFunc=wm,this.monitorFunc===wm&&(this.minDelta*=-1)}async onTrainBegin(e){this.wait=0,this.stoppedEpoch=0,this.baseline!=null?this.best=this.baseline:this.best=this.monitorFunc===wm?Infinity:-Infinity}async onEpochEnd(e,t){await Ka(t);let n=this.getMonitorValue(t);n!=null&&(this.monitorFunc(n-this.minDelta,this.best)?(this.best=n,this.wait=0):(this.wait++,this.wait>=this.patience&&(this.stoppedEpoch=e,this.model.stopTraining=!0)))}async onTrainEnd(e){this.stoppedEpoch>0&&this.verbose&&console.log(`Epoch ${this.stoppedEpoch}: early stopping.`)}getMonitorValue(e){e==null&&(e={});let t=e[this.monitor];return t==null&&console.warn(`Metric for EarlyStopping ${this.monitor} is not available. Available metrics are: ${Object.keys(e)}`),t}};function $re(e){return new B8(e)}var _re={earlyStopping:$re},gs;(function(e){e[e.DT_INVALID=0]="DT_INVALID",e[e.DT_FLOAT=1]="DT_FLOAT",e[e.DT_DOUBLE=2]="DT_DOUBLE",e[e.DT_INT32=3]="DT_INT32",e[e.DT_UINT8=4]="DT_UINT8",e[e.DT_INT16=5]="DT_INT16",e[e.DT_INT8=6]="DT_INT8",e[e.DT_STRING=7]="DT_STRING",e[e.DT_COMPLEX64=8]="DT_COMPLEX64",e[e.DT_INT64=9]="DT_INT64",e[e.DT_BOOL=10]="DT_BOOL",e[e.DT_QINT8=11]="DT_QINT8",e[e.DT_QUINT8=12]="DT_QUINT8",e[e.DT_QINT32=13]="DT_QINT32",e[e.DT_BFLOAT16=14]="DT_BFLOAT16",e[e.DT_FLOAT_REF=101]="DT_FLOAT_REF",e[e.DT_DOUBLE_REF=102]="DT_DOUBLE_REF",e[e.DT_INT32_REF=103]="DT_INT32_REF",e[e.DT_UINT8_REF=104]="DT_UINT8_REF",e[e.DT_INT16_REF=105]="DT_INT16_REF",e[e.DT_INT8_REF=106]="DT_INT8_REF",e[e.DT_STRING_REF=107]="DT_STRING_REF",e[e.DT_COMPLEX64_REF=108]="DT_COMPLEX64_REF",e[e.DT_INT64_REF=109]="DT_INT64_REF",e[e.DT_BOOL_REF=110]="DT_BOOL_REF",e[e.DT_QINT8_REF=111]="DT_QINT8_REF",e[e.DT_QUINT8_REF=112]="DT_QUINT8_REF",e[e.DT_QINT32_REF=113]="DT_QINT32_REF",e[e.DT_BFLOAT16_REF=114]="DT_BFLOAT16_REF"})(gs||(gs={}));var W8;(function(e){let t;(function(n){n[n.LEGACY=0]="LEGACY",n[n.V1=1]="V1",n[n.V2=2]="V2"})(t=e.CheckpointFormatVersion||(e.CheckpointFormatVersion={}))})(W8||(W8={}));var h5={};function Rre(e,t){let n={tfOpName:e,category:"custom",inputs:[],attrs:[],customExecutor:t};h5[e]=n}function V8(e){return h5[e]}function Dre(e){delete h5[e]}function S(e,t,n,r,s){let a=t.inputParams[e];if(a&&a.inputIndexStart!==void 0){let i=a.inputIndexStart,l=a.inputIndexEnd===0?void 0:a.inputIndexEnd===void 0?i+1:a.inputIndexEnd;if(a.type==="tensor")return Bn(t.inputNames[a.inputIndexStart],n,r,s);if(a.type==="tensors")return t.inputNames.slice(i,l).map(h=>Bn(h,n,r,s));let u=Bn(t.inputNames.slice(i)[0],n,r,s),c=u.dataSync();return a.type==="number"?c[0]:k.toNestedArray(u.shape,c)}let o=t.attrParams[e];return o&&o.value}function Bn(e,t,n,r){let[s,a]=hr(e);if(r!=null){let i=r.getHashTableHandleByName(s);if(i!=null)return i}let o=n.currentContextIds.find(i=>!!t[km(s,i)]);return o!==void 0?t[km(s,o)][a]:void 0}function Fre(e,t,n){return t[km(e,n.currentContextId)]}function ma(e,t){let[n,r,s]=hr(e);return[km(n,t&&t.currentContextId),r,s]}function km(e,t){return t?`${e}-${t}`:e}function hr(e){let t=e.split(":");if(t.length===1)return[e,0,void 0];let n=t[0],r=t.length===3?t[1]:void 0,s=Number(t[t.length-1]);return[n,s,r]}function Im(e,t,n){let r=S("pad",e,t,n);if(r==="explicit"){r=S("explicitPaddings",e,t,n);let s=[[0,0],[0,0],[0,0],[0,0]];for(let a=0;a<4;a++)s[a][0]=r[a*2],s[a][1]=r[a*2+1];return s}return r}function ga(e){return e.kept?e:qo(e)}var U8={};De(U8,{json:()=>Mre});var Mre=[{tfOpName:"Add",category:"arithmetic",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"AddV2",category:"arithmetic",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"AddN",category:"arithmetic",inputs:[{start:0,end:0,name:"tensors",type:"tensors"}]},{tfOpName:"BiasAdd",category:"arithmetic",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0},{tfName:"data_format",name:"dataFormat",type:"string",notSupported:!0}]},{tfOpName:"Sub",category:"arithmetic",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"RealDiv",category:"arithmetic",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Div",category:"arithmetic",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"DivNoNan",category:"arithmetic",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"FloorDiv",category:"arithmetic",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Mul",category:"arithmetic",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Maximum",category:"arithmetic",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Minimum",category:"arithmetic",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Pow",category:"arithmetic",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"SquaredDifference",category:"arithmetic",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Mod",category:"arithmetic",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"FloorMod",category:"arithmetic",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]}],H8={};De(H8,{json:()=>Ore});var Ore=[{tfOpName:"Abs",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Acos",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Asin",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Atan",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Atan2",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"y",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Ceil",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"ClipByValue",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"clipValueMin",type:"number"},{start:2,name:"clipValueMax",type:"number"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Complex",category:"basic_math",inputs:[{start:0,name:"real",type:"tensor"},{start:1,name:"imag",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"ComplexAbs",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Cos",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Cosh",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Elu",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Exp",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Floor",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Log",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Imag",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0},{tfName:"Tout",name:"outputType",type:"dtype",notSupported:!0}]},{tfOpName:"Neg",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Real",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0},{tfName:"Tout",name:"outputType",type:"dtype",notSupported:!0}]},{tfOpName:"Prelu",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"alpha",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Relu",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Relu6",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Selu",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Sigmoid",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Sin",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Sinh",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Sqrt",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Rsqrt",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Square",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Tan",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Tanh",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Sign",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Round",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Expm1",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Log1p",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Reciprocal",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Softplus",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Asinh",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Acosh",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Atanh",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Erf",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Prod",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"axes",type:"number[]"}],attrs:[{tfName:"keep_dims",name:"keepDims",type:"bool",notSupported:!0},{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"LeakyRelu",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"alpha",name:"alpha",type:"number",defaultValue:.2},{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"IsNan",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]}],G8={};De(G8,{json:()=>Pre});var Pre=[{tfOpName:"EmptyTensorList",category:"control",inputs:[{start:0,name:"elementShape",type:"shape"},{start:1,name:"maxNumElements",type:"number"}],attrs:[{tfName:"element_dtype",name:"elementDType",type:"dtype"}]},{tfOpName:"LoopCond",category:"control",inputs:[{start:0,name:"pred",type:"tensor"}]},{tfOpName:"Switch",category:"control",inputs:[{start:0,name:"data",type:"tensor"},{start:1,name:"pred",type:"tensor"}]},{tfOpName:"Merge",category:"control",inputs:[{start:0,end:0,name:"tensors",type:"tensors"}]},{tfOpName:"Enter",category:"control",inputs:[{start:0,name:"tensor",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0},{tfName:"frame_name",name:"frameName",type:"string"},{tfName:"is_constant",name:"isConstant",type:"bool"}]},{tfOpName:"Exit",category:"control",inputs:[{start:0,name:"tensor",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"NextIteration",category:"control",inputs:[{start:0,name:"tensor",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"TensorArrayV3",category:"control",inputs:[{start:0,name:"size",type:"number"}],attrs:[{tfName:"dtype",name:"dtype",type:"dtype"},{tfName:"element_shape",name:"elementShape",type:"shape"},{tfName:"dynamic_size",name:"dynamicSize",type:"bool"},{tfName:"clear_after_read",name:"clearAfterRead",type:"bool"},{tfName:"identical_element_shapes",name:"identicalElementShapes",type:"bool"},{tfName:"tensor_array_name",name:"name",type:"string"}]},{tfOpName:"TensorArrayWriteV3",category:"control",inputs:[{start:0,name:"tensorArrayId",type:"tensor"},{start:1,name:"index",type:"number"},{start:2,name:"tensor",type:"tensor"},{start:3,name:"flowIn",type:"number"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"TensorArrayReadV3",category:"control",inputs:[{start:0,name:"tensorArrayId",type:"tensor"},{start:1,name:"index",type:"number"},{start:2,name:"flowIn",type:"number"}],attrs:[{tfName:"dtype",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"TensorArrayGatherV3",category:"control",inputs:[{start:0,name:"tensorArrayId",type:"tensor"},{start:1,name:"indices",type:"number[]"},{start:2,name:"flowIn",type:"number"}],attrs:[{tfName:"dtype",name:"dtype",type:"dtype"},{tfName:"element_shape",name:"elementShape",type:"shape"}]},{tfOpName:"TensorArrayScatterV3",category:"control",inputs:[{start:0,name:"tensorArrayId",type:"tensor"},{start:1,name:"indices",type:"number[]"},{start:2,name:"tensor",type:"tensor"},{start:3,name:"flowIn",type:"number"}],attrs:[{tfName:"T",name:"dtype",type:"dtype"}]},{tfOpName:"TensorArrayConcatV3",category:"control",inputs:[{start:0,name:"tensorArrayId",type:"tensor"},{start:1,name:"flowIn",type:"number"}],attrs:[{tfName:"dtype",name:"dtype",type:"dtype"},{tfName:"element_shape_except0",name:"elementShapeExcept0",type:"shape",notSupported:!0}]},{tfOpName:"TensorArraySplitV3",category:"control",inputs:[{start:0,name:"tensorArrayId",type:"tensor"},{start:1,name:"tensor",type:"tensor"},{start:2,name:"lengths",type:"number[]"},{start:3,name:"flowIn",type:"number"}],attrs:[{tfName:"T",name:"dtype",type:"dtype"}]},{tfOpName:"TensorArraySizeV3",category:"control",inputs:[{start:0,name:"tensorArrayId",type:"tensor"},{start:1,name:"flowIn",type:"number"}]},{tfOpName:"TensorArrayCloseV3",category:"control",inputs:[{start:0,name:"tensorArrayId",type:"tensor"}]},{tfOpName:"StatelessIf",category:"control",inputs:[{start:0,name:"cond",type:"tensor"},{start:1,end:0,name:"args",type:"tensors"}],attrs:[{tfName:"then_branch",name:"thenBranch",type:"func"},{tfName:"else_branch",name:"elseBranch",type:"func"}]},{tfOpName:"If",category:"control",inputs:[{start:0,name:"cond",type:"tensor"},{start:1,end:0,name:"args",type:"tensors"}],attrs:[{tfName:"then_branch",name:"thenBranch",type:"func"},{tfName:"else_branch",name:"elseBranch",type:"func"}]},{tfOpName:"StatelessWhile",category:"control",inputs:[{start:0,end:0,name:"args",type:"tensors"}],attrs:[{tfName:"cond",name:"cond",type:"func"},{tfName:"body",name:"body",type:"func"}]},{tfOpName:"While",category:"control",inputs:[{start:0,end:0,name:"args",type:"tensors"}],attrs:[{tfName:"cond",name:"cond",type:"func"},{tfName:"body",name:"body",type:"func"}]},{tfOpName:"TensorListScatter",category:"control",inputs:[{start:0,name:"tensor",type:"tensor"},{start:1,name:"indices",type:"number[]"},{start:2,name:"elementShape",type:"shape"}],attrs:[{tfName:"element_dtype",name:"elementDType",type:"dtype"}]},{tfOpName:"TensorListScatterV2",category:"control",inputs:[{start:0,name:"tensor",type:"tensor"},{start:1,name:"indices",type:"number[]"},{start:2,name:"elementShape",type:"shape"},{start:3,name:"numElements",type:"number"}],attrs:[{tfName:"element_dtype",name:"elementDType",type:"dtype"}]},{tfOpName:"TensorListGather",category:"control",inputs:[{start:0,name:"tensorListId",type:"tensor"},{start:1,name:"indices",type:"number[]"},{start:2,name:"elementShape",type:"shape"}],attrs:[{tfName:"element_dtype",name:"elementDType",type:"dtype"}]},{tfOpName:"TensorListGetItem",category:"control",inputs:[{start:0,name:"tensorListId",type:"tensor"},{start:1,name:"index",type:"number"},{start:2,name:"elementShape",type:"shape"}],attrs:[{tfName:"element_dtype",name:"elementDType",type:"dtype"}]},{tfOpName:"TensorListSetItem",category:"control",inputs:[{start:0,name:"tensorListId",type:"tensor"},{start:1,name:"index",type:"number"},{start:2,name:"tensor",type:"tensor"}],attrs:[{tfName:"element_dtype",name:"elementDType",type:"dtype"}]},{tfOpName:"TensorListReserve",category:"control",inputs:[{start:0,name:"elementShape",type:"shape"},{start:1,name:"numElements",type:"number"}],attrs:[{tfName:"element_dtype",name:"elementDType",type:"dtype"}]},{tfOpName:"TensorListFromTensor",category:"control",inputs:[{start:0,name:"tensor",type:"tensor"},{start:1,name:"elementShape",type:"shape"}],attrs:[{tfName:"element_dtype",name:"elementDType",type:"dtype"}]},{tfOpName:"TensorListStack",category:"control",inputs:[{start:0,name:"tensorListId",type:"tensor"},{start:1,name:"elementShape",type:"shape"}],attrs:[{tfName:"element_dtype",name:"elementDType",type:"dtype"},{tfName:"num_elements",name:"numElements",type:"dtype"}]},{tfOpName:"TensorListSplit",category:"control",inputs:[{start:0,name:"tensor",type:"tensor"},{start:1,name:"elementShape",type:"shape"},{start:2,name:"lengths",type:"number[]"}],attrs:[{tfName:"element_dtype",name:"elementDType",type:"dtype"}]},{tfOpName:"TensorListConcat",category:"control",inputs:[{start:0,name:"tensorListId",type:"tensor"}],attrs:[{tfName:"element_shape",name:"elementShape",type:"shape"},{tfName:"element_dtype",name:"elementDType",type:"dtype"}]},{tfOpName:"TensorListPopBack",category:"control",inputs:[{start:0,name:"tensorListId",type:"tensor"},{start:1,name:"elementShape",type:"shape"}],attrs:[{tfName:"element_dtype",name:"elementDType",type:"dtype"}]},{tfOpName:"TensorListPushBack",category:"control",inputs:[{start:0,name:"tensorListId",type:"tensor"},{start:1,name:"tensor",type:"tensor"}],attrs:[{tfName:"element_dtype",name:"elementDType",type:"dtype"}]}],j8={};De(j8,{json:()=>zre});var zre=[{tfOpName:"AvgPool",category:"convolution",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"strides",name:"strides",type:"number[]"},{tfName:"padding",name:"pad",type:"string"},{tfName:"data_format",name:"dataFormat",type:"string",notSupported:!0},{tfName:"ksize",name:"kernelSize",type:"number[]"},{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"MaxPool",category:"convolution",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"strides",name:"strides",type:"number[]"},{tfName:"padding",name:"pad",type:"string"},{tfName:"data_format",name:"dataFormat",type:"string",notSupported:!0},{tfName:"ksize",name:"kernelSize",type:"number[]"},{tfName:"explicit_paddings",name:"explicitPaddings",type:"number[]",defaultValue:[],notSupported:!0},{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"MaxPoolWithArgmax",category:"convolution",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"strides",name:"strides",type:"number[]"},{tfName:"padding",name:"pad",type:"string"},{tfName:"ksize",name:"kernelSize",type:"number[]"},{tfName:"include_batch_in_index",name:"includeBatchInIndex",type:"bool"},{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"AvgPool3D",category:"convolution",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"strides",name:"strides",type:"number[]"},{tfName:"padding",name:"pad",type:"string"},{tfName:"data_format",name:"dataFormat",type:"string",notSupported:!0},{tfName:"ksize",name:"kernelSize",type:"number[]"},{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"MaxPool3D",category:"convolution",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"strides",name:"strides",type:"number[]"},{tfName:"padding",name:"pad",type:"string"},{tfName:"data_format",name:"dataFormat",type:"string",notSupported:!0},{tfName:"ksize",name:"kernelSize",type:"number[]"},{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Conv1D",category:"convolution",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"filter",type:"tensor"}],attrs:[{tfName:"stride",name:"stride",type:"number"},{tfName:"padding",name:"pad",type:"string"},{tfName:"data_format",name:"dataFormat",type:"string",defaultValue:"NWC"},{tfName:"T",name:"dtype",type:"dtype",notSupported:!0},{tfName:"dilation",name:"dilation",type:"number",defaultValue:1}]},{tfOpName:"Conv2D",category:"convolution",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"filter",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0},{tfName:"strides",name:"strides",type:"number[]"},{tfName:"padding",name:"pad",type:"string"},{tfName:"useCudnnOnGpu",name:"useCudnnOnGpu",type:"bool"},{tfName:"data_format",name:"dataFormat",type:"string",defaultValue:"NHWC"},{tfName:"explicit_paddings",name:"explicitPaddings",type:"number[]",defaultValue:[]},{tfName:"dilations",name:"dilations",type:"number[]"}]},{tfOpName:"_FusedConv2D",category:"convolution",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"filter",type:"tensor"},{start:2,end:0,name:"args",type:"tensors"}],attrs:[{tfName:"num_args",name:"numArgs",type:"number"},{tfName:"T",name:"dtype",type:"dtype",notSupported:!0},{tfName:"strides",name:"strides",type:"number[]"},{tfName:"padding",name:"pad",type:"string"},{tfName:"explicit_paddings",name:"explicitPaddings",type:"number[]",defaultValue:[]},{tfName:"use_cudnn_on_gpu",name:"useCudnnOnGpu",type:"bool",defaultValue:!0},{tfName:"data_format",name:"dataFormat",type:"string",defaultValue:"NHWC"},{tfName:"dilations",name:"dilations",type:"number[]",defaultValue:[1,1,1,1]},{tfName:"fused_ops",name:"fusedOps",type:"string[]",defaultValue:[]},{tfName:"epsilon",name:"epsilon",type:"number",defaultValue:1e-4},{tfName:"leakyrelu_alpha",name:"leakyreluAlpha",type:"number"}]},{tfOpName:"Conv2DBackpropInput",category:"convolution",inputs:[{start:2,name:"x",type:"tensor"},{start:1,name:"filter",type:"tensor"},{start:0,name:"outputShape",type:"number[]"}],attrs:[{tfName:"strides",name:"strides",type:"number[]"},{tfName:"padding",name:"pad",type:"string"},{tfName:"data_format",name:"dataFormat",type:"string",notSupported:!0},{tfName:"explicit_paddings",name:"explicitPaddings",type:"number[]",defaultValue:[]},{tfName:"dilations",name:"dilations",type:"number[]",notSupported:!0}]},{tfOpName:"DepthwiseConv2d",category:"convolution",inputs:[{start:0,name:"input",type:"tensor"},{start:1,name:"filter",type:"tensor"}],attrs:[{tfName:"strides",name:"strides",type:"number[]"},{tfName:"padding",name:"pad",type:"string"},{tfName:"data_format",name:"dataFormat",type:"string",defaultValue:"NHWC"},{tfName:"explicit_paddings",name:"explicitPaddings",type:"number[]",defaultValue:[]},{tfName:"dilations",name:"dilations",type:"number[]"}]},{tfOpName:"DepthwiseConv2dNative",category:"convolution",inputs:[{start:0,name:"input",type:"tensor"},{start:1,name:"filter",type:"tensor"}],attrs:[{tfName:"strides",name:"strides",type:"number[]"},{tfName:"padding",name:"pad",type:"string"},{tfName:"data_format",name:"dataFormat",type:"string",defaultValue:"NHWC"},{tfName:"explicit_paddings",name:"explicitPaddings",type:"number[]",defaultValue:[]},{tfName:"dilations",name:"dilations",type:"number[]"}]},{tfOpName:"FusedDepthwiseConv2dNative",category:"convolution",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"filter",type:"tensor"},{start:2,end:0,name:"args",type:"tensors"}],attrs:[{tfName:"num_args",name:"numArgs",type:"number"},{tfName:"T",name:"dtype",type:"dtype",notSupported:!0},{tfName:"strides",name:"strides",type:"number[]"},{tfName:"padding",name:"pad",type:"string"},{tfName:"data_format",name:"dataFormat",type:"string",defaultValue:"NHWC"},{tfName:"dilations",name:"dilations",type:"number[]",defaultValue:[1,1,1,1]},{tfName:"fused_ops",name:"fusedOps",type:"string[]",defaultValue:[]},{tfName:"explicit_paddings",name:"explicitPaddings",type:"number[]",defaultValue:[]}]},{tfOpName:"Conv3D",category:"convolution",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"filter",type:"tensor"}],attrs:[{tfName:"strides",name:"strides",type:"number[]"},{tfName:"padding",name:"pad",type:"string"},{tfName:"data_format",name:"dataFormat",type:"string",defaultValue:"NHWC"},{tfName:"dilations",name:"dilations",type:"number[]"}]},{tfOpName:"Dilation2D",category:"convolution",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"filter",type:"tensor"}],attrs:[{tfName:"strides",name:"strides",type:"number[]"},{tfName:"rates",name:"dilations",type:"number[]"},{tfName:"padding",name:"pad",type:"string"}]}],q8={};De(q8,{json:()=>Lre});var Lre=[{tfOpName:"Fill",category:"creation",inputs:[{start:0,name:"shape",type:"number[]"},{start:1,name:"value",type:"number"}],attrs:[{tfName:"T",name:"dtype",type:"dtype"}]},{tfOpName:"LinSpace",category:"creation",inputs:[{start:0,name:"start",type:"number"},{start:1,name:"stop",type:"number"},{start:2,name:"num",type:"number"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"OneHot",category:"creation",inputs:[{start:0,name:"indices",type:"tensor"},{start:1,name:"depth",type:"number"},{start:2,name:"onValue",type:"number",defaultValue:1},{start:3,name:"offValue",type:"number",defaultValue:0}],attrs:[{tfName:"axis",name:"axis",type:"number",notSupported:!0},{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Ones",category:"creation",inputs:[{start:0,name:"shape",type:"number[]"}],attrs:[{tfName:"T",name:"dtype",type:"dtype"}]},{tfOpName:"OnesLike",category:"creation",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"dtype",name:"dtype",type:"dtype"}]},{tfOpName:"RandomUniform",category:"creation",inputs:[{start:0,name:"shape",type:"number[]"}],attrs:[{tfName:"minval",name:"minval",type:"number",defaultValue:0},{tfName:"maxval",name:"maxval",type:"number",defaultValue:1},{tfName:"dtype",name:"dtype",type:"dtype"},{tfName:"seed",name:"seed",type:"number",defaultValue:0},{tfName:"seed2",name:"seed2",type:"number",defaultValue:0,notSupported:!0},{tfName:"T",name:"T",type:"number",notSupported:!0}]},{tfOpName:"Range",category:"creation",inputs:[{start:0,name:"start",type:"number"},{start:1,name:"stop",type:"number"},{start:2,name:"step",type:"number",defaultValue:0}],attrs:[{tfName:"Tidx",name:"dtype",type:"dtype"}]},{tfOpName:"TruncatedNormal",category:"creation",inputs:[{start:0,name:"shape",type:"number[]"}],attrs:[{tfName:"means",name:"mean",type:"number",defaultValue:0},{tfName:"stddev",name:"stdDev",type:"number",defaultValue:1},{tfName:"seed",name:"seed",type:"number"},{tfName:"seed2",name:"seed2",type:"number",defaultValue:0,notSupported:!0},{tfName:"dtype",name:"dtype",type:"dtype"},{tfName:"T",name:"T",type:"number",notSupported:!0}]},{tfOpName:"Zeros",category:"creation",inputs:[{start:0,name:"shape",type:"number[]"}],attrs:[{tfName:"T",name:"dtype",type:"dtype"}]},{tfOpName:"ZerosLike",category:"creation",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype"}]},{tfOpName:"Multinomial",category:"creation",inputs:[{start:0,name:"logits",type:"tensor"},{start:1,name:"numSamples",type:"number"}],attrs:[{tfName:"seed",name:"seed",type:"number"},{tfName:"seed2",name:"seed2",type:"number"},{tfName:"T",name:"dtype",type:"dtype"},{tfName:"output_dtype",name:"output_dtype",type:"dtype"}]}],K8={};De(K8,{json:()=>Bre});var Bre=[{tfOpName:"NonMaxSuppressionV2",category:"dynamic",inputs:[{start:0,name:"boxes",type:"tensor"},{start:1,name:"scores",type:"tensor"},{start:2,name:"maxOutputSize",type:"number"},{start:3,name:"iouThreshold",type:"number"}]},{tfOpName:"NonMaxSuppressionV3",category:"dynamic",inputs:[{start:0,name:"boxes",type:"tensor"},{start:1,name:"scores",type:"tensor"},{start:2,name:"maxOutputSize",type:"number"},{start:3,name:"iouThreshold",type:"number"},{start:4,name:"scoreThreshold",type:"number"}]},{tfOpName:"NonMaxSuppressionV4",category:"dynamic",inputs:[{start:0,name:"boxes",type:"tensor"},{start:1,name:"scores",type:"tensor"},{start:2,name:"maxOutputSize",type:"number"},{start:3,name:"iouThreshold",type:"number"},{start:4,name:"scoreThreshold",type:"number"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0},{tfName:"T_threshold",name:"threshold",type:"dtype",notSupported:!0},{tfName:"pad_to_max_output_size",name:"padToMaxOutputSize",type:"bool"}]},{tfOpName:"NonMaxSuppressionV5",category:"dynamic",inputs:[{start:0,name:"boxes",type:"tensor"},{start:1,name:"scores",type:"tensor"},{start:2,name:"maxOutputSize",type:"number"},{start:3,name:"iouThreshold",type:"number"},{start:4,name:"scoreThreshold",type:"number"},{start:5,name:"softNmsSigma",type:"number"}]},{tfOpName:"Where",category:"dynamic",inputs:[{start:0,name:"condition",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"ListDiff",category:"dynamic",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"y",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]}],X8={};De(X8,{json:()=>Wre});var Wre=[{tfOpName:"TopKV2",category:"evaluation",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"k",type:"number"}],attrs:[{tfName:"sorted",name:"sorted",type:"bool"}]},{tfOpName:"Unique",category:"evaluation",inputs:[{start:0,name:"x",type:"tensor"}]},{tfOpName:"UniqueV2",category:"evaluation",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"axis",type:"number"}]}],Z8={};De(Z8,{json:()=>Vre});var Vre=[{tfOpName:"PlaceholderWithDefault",category:"graph",inputs:[{start:0,name:"default",type:"tensor"}],attrs:[{tfName:"shape",name:"shape",type:"shape"},{tfName:"dtype",name:"dtype",type:"dtype"}]},{tfOpName:"Placeholder",category:"graph",attrs:[{tfName:"shape",name:"shape",type:"shape"},{tfName:"dtype",name:"dtype",type:"dtype"}]},{tfOpName:"Const",category:"graph"},{tfOpName:"Identity",category:"graph",inputs:[{start:0,name:"x",type:"tensor"}]},{tfOpName:"IdentityN",category:"graph",inputs:[{start:0,end:0,name:"x",type:"tensors"}]},{tfOpName:"Snapshot",category:"graph",inputs:[{start:0,name:"x",type:"tensor"}]},{tfOpName:"Rank",category:"graph",inputs:[{start:0,name:"x",type:"tensor"}]},{tfOpName:"Size",category:"graph",inputs:[{start:0,name:"x",type:"tensor"}]},{tfOpName:"Shape",category:"graph",inputs:[{start:0,name:"x",type:"tensor"}]},{tfOpName:"ShapeN",category:"graph",inputs:[{start:0,end:0,name:"x",type:"tensors"}]},{tfOpName:"Print",category:"graph",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"data",type:"tensors"}],attrs:[{tfName:"message",name:"message",type:"string"},{tfName:"first_n",name:"firstN",type:"number",notSupported:!0},{tfName:"summarize",name:"summarize",type:"number",defaultValue:3}]},{tfOpName:"NoOp",category:"graph",inputs:[]},{tfOpName:"StopGradient",category:"graph",inputs:[{start:0,name:"x",type:"tensor"}]},{tfOpName:"FakeQuantWithMinMaxVars",category:"graph",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"min",name:"min",type:"number"},{tfName:"max",name:"max",type:"number"}]}],Y8={};De(Y8,{json:()=>Ure});var Ure=[{tfOpName:"HashTable",category:"hash_table",inputs:[],attrs:[{tfName:"shared_name",name:"sharedName",type:"string"},{tfName:"use_node_name_sharing",name:"useNodeNameSharing",type:"bool"},{tfName:"key_dtype",name:"keyDType",type:"dtype"},{tfName:"value_dtype",name:"valueDType",type:"dtype"}]},{tfOpName:"HashTableV2",category:"hash_table",inputs:[],attrs:[{tfName:"shared_name",name:"sharedName",type:"string"},{tfName:"use_node_name_sharing",name:"useNodeNameSharing",type:"bool"},{tfName:"key_dtype",name:"keyDType",type:"dtype"},{tfName:"value_dtype",name:"valueDType",type:"dtype"}]},{tfOpName:"LookupTableImport",category:"hash_table",inputs:[{start:0,name:"tableHandle",type:"tensor"},{start:1,name:"keys",type:"tensor"},{start:2,name:"values",type:"tensor"}],attrs:[{tfName:"Tin",name:"tIn",type:"dtype",notSupported:!0},{tfName:"Tout",name:"tOut",type:"dtype",notSupported:!0}]},{tfOpName:"LookupTableImportV2",category:"hash_table",inputs:[{start:0,name:"tableHandle",type:"tensor"},{start:1,name:"keys",type:"tensor"},{start:2,name:"values",type:"tensor"}],attrs:[{tfName:"Tin",name:"tIn",type:"dtype",notSupported:!0},{tfName:"Tout",name:"tOut",type:"dtype",notSupported:!0}]},{tfOpName:"LookupTableFind",category:"hash_table",inputs:[{start:0,name:"tableHandle",type:"tensor"},{start:1,name:"keys",type:"tensor"},{start:2,name:"defaultValue",type:"tensor"}],attrs:[{tfName:"Tin",name:"tIn",type:"dtype",notSupported:!0},{tfName:"Tout",name:"tOut",type:"dtype",notSupported:!0}]},{tfOpName:"LookupTableFindV2",category:"hash_table",inputs:[{start:0,name:"tableHandle",type:"tensor"},{start:1,name:"keys",type:"tensor"},{start:2,name:"defaultValue",type:"tensor"}],attrs:[{tfName:"Tin",name:"tIn",type:"dtype",notSupported:!0},{tfName:"Tout",name:"tOut",type:"dtype",notSupported:!0}]},{tfOpName:"LookupTableSize",category:"hash_table",inputs:[{start:0,name:"tableHandle",type:"tensor"}]},{tfOpName:"LookupTableSizeV2",category:"hash_table",inputs:[{start:0,name:"tableHandle",type:"tensor"}]}],J8={};De(J8,{json:()=>Hre});var Hre=[{tfOpName:"ResizeBilinear",category:"image",inputs:[{start:0,name:"images",type:"tensor"},{start:1,name:"size",type:"number[]"}],attrs:[{tfName:"align_corners",name:"alignCorners",type:"bool"},{tfName:"half_pixel_centers",name:"halfPixelCenters",type:"bool"},{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"ResizeNearestNeighbor",category:"image",inputs:[{start:0,name:"images",type:"tensor"},{start:1,name:"size",type:"number[]"}],attrs:[{tfName:"align_corners",name:"alignCorners",type:"bool"},{tfName:"half_pixel_centers",name:"halfPixelCenters",type:"bool"},{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"CropAndResize",category:"image",inputs:[{start:0,name:"image",type:"tensor"},{start:1,name:"boxes",type:"tensor"},{start:2,name:"boxInd",type:"tensor"},{start:3,name:"cropSize",type:"number[]"}],attrs:[{tfName:"method",name:"method",type:"string"},{tfName:"extrapolation_value",name:"extrapolationValue",type:"number"}]}],Q8={};De(Q8,{json:()=>Gre});var Gre=[{tfOpName:"Equal",category:"logical",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"NotEqual",category:"logical",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Greater",category:"logical",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"GreaterEqual",category:"logical",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Less",category:"logical",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"LessEqual",category:"logical",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"LogicalAnd",category:"logical",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"LogicalNot",category:"logical",inputs:[{start:0,name:"a",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"LogicalOr",category:"logical",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Select",category:"logical",inputs:[{start:0,name:"condition",type:"tensor"},{start:1,name:"a",type:"tensor"},{start:2,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"SelectV2",category:"logical",inputs:[{start:0,name:"condition",type:"tensor"},{start:1,name:"a",type:"tensor"},{start:2,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]}],eT={};De(eT,{json:()=>jre});var jre=[{tfOpName:"_FusedMatMul",category:"matrices",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"},{start:2,end:0,name:"args",type:"tensors"}],attrs:[{tfName:"num_args",name:"numArgs",type:"number"},{tfName:"fused_ops",name:"fusedOps",type:"string[]",defaultValue:[]},{tfName:"epsilon",name:"epsilon",type:"number",defaultValue:1e-4},{tfName:"transpose_a",name:"transposeA",type:"bool",defaultValue:!1},{tfName:"transpose_b",name:"transposeB",type:"bool",defaultValue:!1},{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"MatMul",category:"matrices",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"transpose_a",name:"transposeA",type:"bool",defaultValue:!1},{tfName:"transpose_b",name:"transposeB",type:"bool",defaultValue:!1},{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"BatchMatMul",category:"matrices",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"adj_x",name:"transposeA",type:"bool",defaultValue:!1},{tfName:"adj_y",name:"transposeB",type:"bool",defaultValue:!1},{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"BatchMatMulV2",category:"matrices",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"adj_x",name:"transposeA",type:"bool",defaultValue:!1},{tfName:"adj_y",name:"transposeB",type:"bool",defaultValue:!1},{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Transpose",category:"matrices",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"perm",type:"number[]"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Einsum",category:"matrices",inputs:[{start:0,end:0,name:"tensors",type:"tensors"}],attrs:[{tfName:"equation",name:"equation",type:"string"},{tfName:"N",name:"n",type:"number",defaultValue:2},{tfName:"T",name:"dtype",type:"dtype"}]}],tT={};De(tT,{json:()=>qre});var qre=[{tfOpName:"FusedBatchNorm",category:"normalization",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"scale",type:"tensor"},{start:2,name:"offset",type:"tensor"},{start:3,name:"mean",type:"tensor"},{start:4,name:"variance",type:"tensor"}],attrs:[{tfName:"epsilon",name:"epsilon",type:"number",defaultValue:.001},{tfName:"data_format",name:"dataFormat",type:"string",notSupported:!0}]},{tfOpName:"FusedBatchNormV2",category:"normalization",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"scale",type:"tensor"},{start:2,name:"offset",type:"tensor"},{start:3,name:"mean",type:"tensor"},{start:4,name:"variance",type:"tensor"}],attrs:[{tfName:"epsilon",name:"epsilon",type:"number",defaultValue:.001},{tfName:"data_format",name:"dataFormat",type:"string",notSupported:!0}]},{tfOpName:"FusedBatchNormV3",category:"normalization",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"scale",type:"tensor"},{start:2,name:"offset",type:"tensor"},{start:3,name:"mean",type:"tensor"},{start:4,name:"variance",type:"tensor"}],attrs:[{tfName:"epsilon",name:"epsilon",type:"number",defaultValue:.001},{tfName:"data_format",name:"dataFormat",type:"string",notSupported:!0}]},{tfOpName:"LRN",category:"normalization",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"depth_radius",name:"radius",type:"number",defaultValue:5},{tfName:"bias",name:"bias",type:"number",defaultValue:1},{tfName:"alpha",name:"alpha",type:"number",defaultValue:1},{tfName:"beta",name:"beta",type:"number",defaultValue:.5}]},{tfOpName:"Softmax",category:"normalization",inputs:[{start:0,name:"x",type:"tensor"}]},{tfOpName:"LogSoftmax",category:"normalization",inputs:[{start:0,name:"x",type:"tensor"}]},{tfOpName:"SparseToDense",category:"normalization",inputs:[{start:0,name:"sparseIndices",type:"tensor"},{start:1,name:"outputShape",type:"number[]"},{start:2,name:"sparseValues",type:"tensor"},{start:3,name:"defaultValue",type:"tensor"}],attrs:[{tfName:"validate_indices",name:"validateIndices",type:"bool",defaultValue:!0,notSupported:!0}]}],nT={};De(nT,{json:()=>Kre});var Kre=[{tfOpName:"Bincount",category:"reduction",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"size",type:"number"},{start:2,name:"weights",type:"tensor"}]},{tfOpName:"DenseBincount",category:"reduction",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"size",type:"number"},{start:2,name:"weights",type:"tensor"}],attrs:[{tfName:"binary_output",name:"binaryOutput",type:"bool"}]},{tfOpName:"Max",category:"reduction",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"axis",type:"number[]"}],attrs:[{tfName:"keep_dims",name:"keepDims",type:"bool"}]},{tfOpName:"Mean",category:"reduction",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"axis",type:"number[]"}],attrs:[{tfName:"keep_dims",name:"keepDims",type:"bool"}]},{tfOpName:"Min",category:"reduction",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"axis",type:"number[]"}],attrs:[{tfName:"keep_dims",name:"keepDims",type:"bool"}]},{tfOpName:"Sum",category:"reduction",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"axis",type:"number[]"}],attrs:[{tfName:"keep_dims",name:"keepDims",type:"bool"}]},{tfOpName:"All",category:"reduction",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"axis",type:"number[]"}],attrs:[{tfName:"keep_dims",name:"keepDims",type:"bool"}]},{tfOpName:"Any",category:"reduction",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"axis",type:"number[]"}],attrs:[{tfName:"keep_dims",name:"keepDims",type:"bool"}]},{tfOpName:"ArgMax",category:"reduction",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"axis",type:"number"}]},{tfOpName:"ArgMin",category:"reduction",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"axis",type:"number"}]},{tfOpName:"Prod",category:"reduction",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"axis",type:"number[]"}],attrs:[{tfName:"keep_dims",name:"keepDims",type:"bool"}]},{tfOpName:"Cumsum",category:"reduction",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"axis",type:"number"}],attrs:[{tfName:"exclusive",name:"exclusive",type:"bool"},{tfName:"reverse",name:"reverse",type:"bool"}]}],rT={};De(rT,{json:()=>Xre});var Xre=[{tfOpName:"ConcatV2",category:"slice_join",inputs:[{start:0,end:-1,name:"tensors",type:"tensors"},{start:-1,name:"axis",type:"number"}],attrs:[{tfName:"N",name:"n",type:"number",defaultValue:2}]},{tfOpName:"Concat",category:"slice_join",inputs:[{start:1,end:0,name:"tensors",type:"tensors"},{start:0,name:"axis",type:"number"}],attrs:[{tfName:"N",name:"n",type:"number",defaultValue:2}]},{tfOpName:"GatherV2",category:"slice_join",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"indices",type:"tensor"},{start:2,name:"axis",type:"number",defaultValue:0}],attrs:[{tfName:"batch_dims",name:"batchDims",type:"number",defaultValue:0}]},{tfOpName:"Gather",category:"slice_join",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"indices",type:"tensor"}],attrs:[{tfName:"validate_indices",name:"validateIndices",type:"bool",notSupported:!0}]},{tfOpName:"Reverse",category:"slice_join",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"dims",type:"bool[]"}]},{tfOpName:"ReverseV2",category:"slice_join",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"axis",type:"number[]"}]},{tfOpName:"Slice",category:"slice_join",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"begin",type:"number[]"},{start:2,name:"size",type:"number[]"}]},{tfOpName:"StridedSlice",category:"slice_join",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"begin",type:"number[]"},{start:2,name:"end",type:"number[]"},{start:3,name:"strides",type:"number[]"}],attrs:[{tfName:"begin_mask",name:"beginMask",type:"number",defaultValue:0},{tfName:"end_mask",name:"endMask",type:"number",defaultValue:0},{tfName:"new_axis_mask",name:"newAxisMask",type:"number",defaultValue:0},{tfName:"ellipsis_mask",name:"ellipsisMask",type:"number",defaultValue:0},{tfName:"shrink_axis_mask",name:"shrinkAxisMask",type:"number",defaultValue:0}]},{tfOpName:"Pack",category:"slice_join",inputs:[{start:0,end:0,name:"tensors",type:"tensors"}],attrs:[{tfName:"axis",name:"axis",type:"number",defaultValue:0}]},{tfOpName:"Unpack",category:"slice_join",inputs:[{start:0,name:"tensor",type:"tensor"}],attrs:[{tfName:"axis",name:"axis",type:"number",defaultValue:0},{tfName:"num",name:"num",type:"number",defaultValue:0,notSupported:!0}]},{tfOpName:"Tile",category:"slice_join",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"reps",type:"number[]"}]},{tfOpName:"Split",category:"slice_join",inputs:[{start:0,name:"axis",type:"number",defaultValue:0},{start:1,name:"x",type:"tensor"}],attrs:[{tfName:"num_split",name:"numOrSizeSplits",type:"number",defaultValue:1}]},{tfOpName:"SplitV",category:"slice_join",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"numOrSizeSplits",type:"number[]"},{start:2,name:"axis",type:"number",defaultValue:0}]},{tfOpName:"ScatterNd",category:"slice_join",inputs:[{start:0,name:"indices",type:"tensor"},{start:1,name:"values",type:"tensor"},{start:2,name:"shape",type:"number[]"}]},{tfOpName:"GatherNd",category:"slice_join",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"indices",type:"tensor"}]},{tfOpName:"SparseToDense",category:"slice_join",inputs:[{start:0,name:"sparseIndices",type:"tensor"},{start:1,name:"outputShape",type:"number[]"},{start:2,name:"sparseValues",type:"tensor"},{start:3,name:"defaultValue",type:"tensor"}],attrs:[{tfName:"validate_indices",name:"validateIndices",type:"bool",defaultValue:!1,notSupported:!0}]}],sT={};De(sT,{json:()=>Zre});var Zre=[{tfOpName:"SparseFillEmptyRows",category:"sparse",inputs:[{start:0,name:"indices",type:"tensor"},{start:1,name:"values",type:"tensor"},{start:2,name:"denseShape",type:"tensor"},{start:3,name:"defaultValue",type:"tensor"}]},{tfOpName:"SparseReshape",category:"sparse",inputs:[{start:0,name:"inputIndices",type:"tensor"},{start:1,name:"inputShape",type:"tensor"},{start:2,name:"newShape",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"SparseSegmentMean",category:"sparse",inputs:[{start:0,name:"data",type:"tensor"},{start:1,name:"indices",type:"tensor"},{start:2,name:"segmentIds",type:"tensor"}]},{tfOpName:"SparseSegmentSum",category:"sparse",inputs:[{start:0,name:"data",type:"tensor"},{start:1,name:"indices",type:"tensor"},{start:2,name:"segmentIds",type:"tensor"}]}],aT={};De(aT,{json:()=>Yre});var Yre=[{tfOpName:"FFT",category:"spectral",inputs:[{start:0,name:"x",type:"tensor"}]},{tfOpName:"IFFT",category:"spectral",inputs:[{start:0,name:"x",type:"tensor"}]},{tfOpName:"RFFT",category:"spectral",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"fft_length",type:"number",notSupported:!0}]},{tfOpName:"IRFFT",category:"spectral",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"fft_length",type:"number",notSupported:!0}]}],oT={};De(oT,{json:()=>Jre});var Jre=[{tfOpName:"StringNGrams",category:"string",inputs:[{start:0,name:"data",type:"tensor"},{start:1,name:"dataSplits",type:"tensor"}],attrs:[{tfName:"separator",name:"separator",type:"string"},{tfName:"ngram_widths",name:"nGramWidths",type:"number[]"},{tfName:"left_pad",name:"leftPad",type:"string"},{tfName:"right_pad",name:"rightPad",type:"string"},{tfName:"pad_width",name:"padWidth",type:"number"},{tfName:"preserve_short_sequences",name:"preserveShortSequences",type:"bool"}],outputs:["ngrams","ngrams_splits"]},{tfOpName:"StringSplit",category:"string",inputs:[{start:0,name:"input",type:"tensor"},{start:1,name:"delimiter",type:"tensor"}],attrs:[{tfName:"skip_empty",name:"skipEmpty",type:"bool"}],outputs:["indices","values","shape"]},{tfOpName:"StringToHashBucketFast",category:"string",inputs:[{start:0,name:"input",type:"tensor"}],attrs:[{tfName:"num_buckets",name:"numBuckets",type:"number"}]}],iT={};De(iT,{json:()=>Qre});var Qre=[{tfOpName:"Cast",category:"transformation",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"SrcT",name:"sdtype",type:"dtype",notSupported:!0},{tfName:"DstT",name:"dtype",type:"dtype"}]},{tfOpName:"ExpandDims",category:"transformation",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"axis",type:"number"}]},{tfOpName:"MirrorPad",category:"transformation",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"padding",type:"number[]"}],attrs:[{tfName:"mode",name:"mode",type:"string"}]},{tfOpName:"Pad",category:"transformation",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"padding",type:"number[]"}],attrs:[{tfName:"constant_value",name:"constantValue",type:"number",defaultValue:0}]},{tfOpName:"PadV2",category:"transformation",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"padding",type:"number[]"},{start:2,name:"constantValue",type:"number",defaultValue:0}]},{tfOpName:"Reshape",category:"transformation",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"shape",type:"number[]"}]},{tfOpName:"Squeeze",category:"transformation",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"axis",tfDeprecatedName:"squeeze_dims",name:"axis",type:"number[]"}]},{tfOpName:"SpaceToBatchND",category:"transformation",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"blockShape",type:"number[]"},{start:2,name:"paddings",type:"number[]"}]},{tfOpName:"BatchToSpaceND",category:"transformation",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"blockShape",type:"number[]"},{start:2,name:"crops",type:"number[]"}]},{tfOpName:"DepthToSpace",category:"transformation",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"block_size",name:"blockSize",type:"number"},{tfName:"data_format",name:"dataFormat",type:"string"}]},{tfOpName:"BroadcastTo",category:"transformation",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"shape",type:"number[]"}],attrs:[]}],lT=class{static get Instance(){return this._instance||(this._instance=new this)}constructor(){let e=[U8,H8,G8,j8,q8,K8,X8,Z8,Y8,J8,Q8,eT,tT,nT,rT,sT,aT,oT,iT],t=[].concat(...e.map(n=>n.json));this.opMappers=t.reduce((n,r)=>(n[r.tfOpName]=r,n),{})}transformGraph(e,t={}){let n=e.node,r=[],s=[],a=[],o=n.reduce((f,m)=>(f[m.name]=this.mapNode(m),m.op.startsWith("Placeholder")?r.push(f[m.name]):m.op==="Const"?s.push(f[m.name]):(m.input==null||m.input.length===0)&&a.push(f[m.name]),f),{}),i=[],l=[],u={},c={};t!=null&&(u=this.mapSignatureEntries(t.inputs),c=this.mapSignatureEntries(t.outputs));let d=Object.keys(o);d.forEach(f=>{let m=o[f];m.inputNames.forEach((g,y)=>{let[A,,x]=ma(g),b=o[A];if(b.outputs!=null){let v=b.outputs.indexOf(x);if(v!==-1){let w=`${A}:${v}`;m.inputNames[y]=w}}m.inputs.push(b),b.children.push(m)})}),Object.keys(c).length===0?d.forEach(f=>{let m=o[f];m.children.length===0&&l.push(m)}):Object.keys(c).forEach(f=>{let[m]=ma(f),g=o[m];g!=null&&(g.signatureKey=c[f],l.push(g))}),Object.keys(u).length>0?Object.keys(u).forEach(f=>{let[m]=ma(f),g=o[m];g&&(g.signatureKey=u[f],i.push(g))}):i=r;let h={};e.library!=null&&e.library.function!=null&&(h=e.library.function.reduce((f,m)=>(f[m.signature.name]=this.mapFunction(m),f),{}));let p={nodes:o,inputs:i,outputs:l,weights:s,placeholders:r,signature:t,functions:h};return a.length>0&&(p.initNodes=a),p}mapSignatureEntries(e){return Object.keys(e||{}).reduce((t,n)=>(t[e[n].name]=n,t),{})}mapNode(e){let t=V8(e.op)||this.opMappers[e.op]||{};e.attr==null&&(e.attr={});let n={name:e.name,op:e.op,category:t.category,inputNames:(e.input||[]).map(r=>r.startsWith("^")?r.substr(1):r),inputs:[],children:[],inputParams:{},attrParams:{},rawAttrs:e.attr,outputs:t.outputs};return t.inputs!=null&&(n.inputParams=t.inputs.reduce((r,s)=>(r[s.name]={type:s.type,inputIndexStart:s.start,inputIndexEnd:s.end},r),{})),t.attrs!=null&&(n.attrParams=t.attrs.reduce((r,s)=>{let a=s.type,o;switch(s.type){case"string":o=p5(e.attr,s.tfName,s.defaultValue),o===void 0&&!!s.tfDeprecatedName&&(o=p5(e.attr,s.tfDeprecatedName,s.defaultValue));break;case"string[]":o=v5(e.attr,s.tfName,s.defaultValue),o===void 0&&!!s.tfDeprecatedName&&(o=v5(e.attr,s.tfDeprecatedName,s.defaultValue));break;case"number":o=m5(e.attr,s.tfName,s.defaultValue||0),o===void 0&&!!s.tfDeprecatedName&&(o=m5(e.attr,s.tfDeprecatedName,s.defaultValue));break;case"number[]":o=b5(e.attr,s.tfName,s.defaultValue),o===void 0&&!!s.tfDeprecatedName&&(o=b5(e.attr,s.tfDeprecatedName,s.defaultValue));break;case"bool":o=f5(e.attr,s.tfName,s.defaultValue),o===void 0&&!!s.tfDeprecatedName&&(o=f5(e.attr,s.tfDeprecatedName,s.defaultValue));break;case"bool[]":o=k5(e.attr,s.tfName,s.defaultValue),o===void 0&&!!s.tfDeprecatedName&&(o=k5(e.attr,s.tfDeprecatedName,s.defaultValue));break;case"shape":o=x5(e.attr,s.tfName,s.defaultValue),o===void 0&&!!s.tfDeprecatedName&&(o=x5(e.attr,s.tfDeprecatedName,s.defaultValue));break;case"shape[]":o=w5(e.attr,s.tfName,s.defaultValue),o===void 0&&!!s.tfDeprecatedName&&(o=w5(e.attr,s.tfDeprecatedName,s.defaultValue));break;case"dtype":o=y5(e.attr,s.tfName,s.defaultValue),o===void 0&&!!s.tfDeprecatedName&&(o=y5(e.attr,s.tfDeprecatedName,s.defaultValue));break;case"dtype[]":o=A5(e.attr,s.tfName,s.defaultValue),o===void 0&&!!s.tfDeprecatedName&&(o=A5(e.attr,s.tfDeprecatedName,s.defaultValue));break;case"func":o=cT(e.attr,s.tfName,s.defaultValue),o===void 0&&!!s.tfDeprecatedName&&(o=cT(e.attr,s.tfDeprecatedName,s.defaultValue));break;case"tensor":case"tensors":break;default:throw new Error(`Unsupported param type: ${s.type} for op: ${e.op}`)}return r[s.name]={value:o,type:a},r},{})),n}mapFunction(e){let t=e.nodeDef,n=[],r=[],s={};t!=null&&(s=t.reduce((c,d)=>(c[d.name]=this.mapNode(d),d.op==="Const"&&r.push(c[d.name]),c),{}));let a=[],o=[];e.signature.inputArg.forEach(c=>{let[d]=ma(c.name),h={name:d,op:"Placeholder",inputs:[],inputNames:[],category:"graph",inputParams:{},attrParams:{dtype:{value:g5(c.type),type:"dtype"}},children:[]};h.signatureKey=c.name,a.push(h),s[d]=h}),Object.keys(s).forEach(c=>{let d=s[c];d.inputNames.forEach((h,p)=>{let[f,,m]=ma(h),g=s[f];if(g.outputs!=null){let y=g.outputs.indexOf(m);if(y!==-1){let A=`${f}:${y}`;d.inputNames[p]=A}}d.inputs.push(g),g.children.push(d)})});let l=e.ret;e.signature.outputArg.forEach(c=>{let[d,h]=ma(l[c.name]),p=s[d];p!=null&&(p.defaultOutput=h,o.push(p))});let u=this.mapArgsToSignature(e);return{nodes:s,inputs:a,outputs:o,weights:r,placeholders:n,signature:u}}mapArgsToSignature(e){return{methodName:e.signature.name,inputs:e.signature.inputArg.reduce((t,n)=>(t[n.name]=this.mapArgToTensorInfo(n),t),{}),outputs:e.signature.outputArg.reduce((t,n)=>(t[n.name]=this.mapArgToTensorInfo(n,e.ret),t),{})}}mapArgToTensorInfo(e,t){let n=e.name;return t!=null&&(n=t[n]),{name:n,dtype:e.type}}};function ese(e){let t=ae().global;if(typeof t.atob!="undefined")return t.atob(e);if(typeof Buffer!="undefined")return new Buffer(e,"base64").toString();throw new Error("Unable to decode base64 in this environment. Missing built-in atob() or Buffer()")}function uT(e,t){let n=Array.isArray(e)?String.fromCharCode.apply(null,e):ese(e);return t?n:n.toLowerCase()}function p5(e,t,n,r=!1){let s=e[t];return s!=null?uT(s.s,r):n}function f5(e,t,n){let r=e[t];return r?r.b:n}function m5(e,t,n){let r=e[t]||{},s=r.i!=null?r.i:r.f!=null?r.f:n;return typeof s=="number"?s:parseInt(s,10)}function g5(e){switch(typeof e=="string"&&(e=gs[e]),e){case gs.DT_FLOAT:return"float32";case gs.DT_INT32:case gs.DT_INT64:case gs.DT_INT8:case gs.DT_UINT8:return"int32";case gs.DT_BOOL:return"bool";case gs.DT_DOUBLE:return"float32";case gs.DT_STRING:return"string";default:return null}}function cT(e,t,n){let r=e[t];return r&&r.func?r.func.name:n}function y5(e,t,n){let r=e[t];return r&&r.type?g5(r.type):n}function A5(e,t,n){let r=e[t];return r&&r.list&&r.list.type?r.list.type.map(s=>g5(s)):n}function dT(e){if(!e.unknownRank)return e.dim!=null?e.dim.map(t=>typeof t.size=="number"?t.size:parseInt(t.size,10)):[]}function x5(e,t,n){let r=e[t];return r&&r.shape?dT(r.shape):n}function b5(e,t,n){let r=e[t];return r?((r.list.f&&r.list.f.length?r.list.f:r.list.i)||[]).map(s=>typeof s=="number"?s:parseInt(s,10)):n}function v5(e,t,n,r=!1){let s=e[t];return s&&s.list&&s.list.s?s.list.s.map(a=>uT(a,r)):n}function w5(e,t,n){let r=e[t];return r&&r.list&&r.list.shape?r.list.shape.map(s=>dT(s)):n}function k5(e,t,n){let r=e[t];return r&&r.list&&r.list.b?r.list.b:n}var tse=class{constructor(e,t,n){this.node=e,this.tensorMap=t,this.context=n,this.inputs=[],this.attrs={},this.inputs=e.inputNames.map(r=>this.getInput(r)),e.rawAttrs!=null&&(this.attrs=Object.keys(e.rawAttrs).reduce((r,s)=>(r[s]=this.getAttr(s),r),{}))}getInput(e){return Bn(e,this.tensorMap,this.context)}getAttr(e,t){let n=this.node.rawAttrs[e];if(n.tensor!=null)return Bn(e,this.tensorMap,this.context);if(n.i!=null||n.f!=null)return m5(this.node.rawAttrs,e,t);if(n.s!=null)return p5(this.node.rawAttrs,e,t);if(n.b!=null)return f5(this.node.rawAttrs,e,t);if(n.shape!=null)return x5(this.node.rawAttrs,e,t);if(n.type!=null)return y5(this.node.rawAttrs,e,t);if(n.list!=null){if(n.list.i!=null||n.list.f!=null)return b5(this.node.rawAttrs,e,t);if(n.list.s!=null)return v5(this.node.rawAttrs,e,t);if(n.list.shape!=null)return w5(this.node.rawAttrs,e,t);if(n.list.b!=null)return k5(this.node.rawAttrs,e,t);if(n.list.type!=null)return A5(this.node.rawAttrs,e,t)}return t}},nse=(e,t,n)=>{switch(e.op){case"BiasAdd":case"AddV2":case"Add":return[pe(S("a",e,t,n),S("b",e,t,n))];case"AddN":return[YG(S("tensors",e,t,n))];case"FloorMod":case"Mod":return[AI(S("a",e,t,n),S("b",e,t,n))];case"Mul":return[K(S("a",e,t,n),S("b",e,t,n))];case"RealDiv":case"Div":return[Re(S("a",e,t,n),S("b",e,t,n))];case"DivNoNan":return[oI(S("a",e,t,n),S("b",e,t,n))];case"FloorDiv":return[_A(S("a",e,t,n),S("b",e,t,n))];case"Sub":return[Ne(S("a",e,t,n),S("b",e,t,n))];case"Minimum":return[_d(S("a",e,t,n),S("b",e,t,n))];case"Maximum":return[ia(S("a",e,t,n),S("b",e,t,n))];case"Pow":return[Va(S("a",e,t,n),S("b",e,t,n))];case"SquaredDifference":return[i1(S("a",e,t,n),S("b",e,t,n))];default:throw TypeError(`Node type ${e.op} is not implemented`)}},rse=(e,t,n)=>{switch(e.op){case"Abs":case"ComplexAbs":return[yn(S("x",e,t,n))];case"Acos":return[V6(S("x",e,t,n))];case"Acosh":return[U6(S("x",e,t,n))];case"Asin":return[G6(S("x",e,t,n))];case"Asinh":return[j6(S("x",e,t,n))];case"Atan":return[q6(S("x",e,t,n))];case"Atan2":return[K6(S("x",e,t,n),S("y",e,t,n))];case"Atanh":return[X6(S("x",e,t,n))];case"Ceil":return[tI(S("x",e,t,n))];case"Complex":return[Uo(S("real",e,t,n),S("imag",e,t,n))];case"Cos":return[Nf(S("x",e,t,n))];case"Cosh":return[zA(S("x",e,t,n))];case"Elu":return[Nd(S("x",e,t,n))];case"Erf":return[iI(S("x",e,t,n))];case"Exp":return[Kr(S("x",e,t,n))];case"Expm1":return[lI(S("x",e,t,n))];case"Floor":return[Ed(S("x",e,t,n))];case"Log":return[Rr(S("x",e,t,n))];case"Log1p":return[VA(S("x",e,t,n))];case"Imag":return[BA(S("x",e,t,n))];case"Neg":return[Kt(S("x",e,t,n))];case"Reciprocal":return[xI(S("x",e,t,n))];case"Real":return[Ff(S("x",e,t,n))];case"Relu":return[ua(S("x",e,t,n))];case"Round":return[JA(S("x",e,t,n))];case"Selu":return[e1(S("x",e,t,n))];case"Sigmoid":return[Rs(S("x",e,t,n))];case"Sin":return[t1(S("x",e,t,n))];case"Sign":return[vI(S("x",e,t,n))];case"Sinh":return[n1(S("x",e,t,n))];case"Softplus":return[Zl(S("x",e,t,n))];case"Sqrt":return[$n(S("x",e,t,n))];case"Square":return[wt(S("x",e,t,n))];case"Tanh":return[Kl(S("x",e,t,n))];case"Tan":return[SI(S("x",e,t,n))];case"ClipByValue":return[cr(S("x",e,t,n),S("clipValueMin",e,t,n),S("clipValueMax",e,t,n))];case"Relu6":return[YA(S("x",e,t,n))];case"Rsqrt":return[QA(Bn(e.inputNames[0],t,n))];case"Prod":return[KA(S("x",e,t,n),S("axes",e,t,n))];case"LeakyRelu":return[Cf(S("x",e,t,n),S("alpha",e,t,n))];case"Prelu":return[Df(S("x",e,t,n),S("alpha",e,t,n))];case"IsNan":return[cI(Bn(e.inputNames[0],t,n))];default:throw TypeError(`Node type ${e.op} is not implemented`)}};function Yr(e,t,n=""){if(!(typeof e=="number"||typeof t=="number")){k.assert(e.length===t.length,()=>n+` Shapes ${e} and ${t} must match`);for(let r=0;rn+` Shapes ${e} and ${t} must match`)}}}function hT(e){return!(typeof e=="number"||e.some(t=>t<0))}function Jd(e,t,n){let r=I5(e,n),s=!hT(r);if(s&&t.length===0)throw new Error(`Tried to calculate elements of an empty list with non-fully-defined elementShape: ${r}`);if(s&&t.forEach(a=>{r=I5(a.shape,r)}),!hT(r))throw new Error(`Non-fully-defined elementShape: ${r}`);return r}function I5(e,t){if(typeof e=="number")return t;if(typeof t=="number")return e;if(e.length!==t.length)throw new Error(`Incompatible ranks during merge: ${e} vs. ${t}`);let n=[];for(let r=0;r=0&&a>=0&&s!==a)throw new Error(`Incompatible shape during merge: ${e} vs. ${t}`);n[r]=s>=0?s:a}return n}var sse=class{constructor(e,t,n,r,s,a,o){this.name=e,this.dtype=t,this.maxSize=n,this.elementShape=r,this.identicalElementShapes=s,this.dynamicSize=a,this.clearAfterRead=o,this.tensors=[],this.closed_=!1,this.idTensor=Fe(0),Sn(this.idTensor)}get id(){return this.idTensor.id}get closed(){return this.closed_}clearAndClose(e){this.tensors.forEach(t=>{(e==null||!e.has(t.tensor.id))&&t.tensor.dispose()}),this.tensors=[],this.closed_=!0,this.idTensor.dispose()}size(){return this.tensors.length}read(e){if(this.closed_)throw new Error(`TensorArray ${this.name} has already been closed.`);if(e<0||e>=this.size())throw new Error(`Tried to read from index ${e}, but array size is: ${this.size()}`);let t=this.tensors[e];if(t.cleared)throw new Error(`TensorArray ${this.name}: Could not read index ${e} twice because it was cleared after a previous read (perhaps try setting clear_after_read = false?).`);return this.clearAfterRead&&(t.cleared=!0),t.read=!0,t.tensor}readMany(e){return e.map(t=>this.read(t))}write(e,t){if(this.closed_)throw new Error(`TensorArray ${this.name} has already been closed.`);if(e<0||!this.dynamicSize&&e>=this.maxSize)throw new Error(`Tried to write to index ${e}, but array is not resizeable and size is: ${this.maxSize}`);let n=this.tensors[e]||{};if(t.dtype!==this.dtype)throw new Error(`TensorArray ${this.name}: Could not write to TensorArray index ${e}, + because the value dtype is ${t.dtype}, but TensorArray dtype is ${this.dtype}.`);if(this.size()===0&&(this.elementShape==null||this.elementShape.length===0)&&(this.elementShape=t.shape),Yr(this.elementShape,t.shape,`TensorArray ${this.name}: Could not write to TensorArray index ${e}.`),n.read)throw new Error(`TensorArray ${this.name}: Could not write to TensorArray index ${e}, because it has already been read.`);if(n.written)throw new Error(`TensorArray ${this.name}: Could not write to TensorArray index ${e}, because it has already been written.`);n.tensor=t,Sn(t),n.written=!0,this.tensors[e]=n}writeMany(e,t){if(e.length!==t.length)throw new Error(`TensorArray ${this.name}: could not write multiple tensors,because the index size: ${e.length} is not the same as tensors size: ${t.length}.`);e.forEach((n,r)=>this.write(n,t[r]))}gather(e,t){if(!!t&&t!==this.dtype)throw new Error(`TensorArray dtype is ${this.dtype} but gather requested dtype ${t}`);if(e)e=e.slice(0,this.size());else{e=[];for(let r=0;r=this.maxSize)throw new Error(`Max index must be < array size (${n} vs. ${this.maxSize})`);this.writeMany(e,ls(t,0))}split(e,t){if(t.dtype!==this.dtype)throw new Error(`TensorArray dtype is ${this.dtype} but tensor has dtype ${t.dtype}`);let n=0,r=e.map(i=>(n+=i,n));if(n!==t.shape[0])throw new Error(`Expected sum of lengths to be equal to tensor.shape[0], but sum of lengths is - ${n}, and tensor's shape is: ${t.shape}`);if(!this.dynamicSize&&e.length!==this.maxSize)throw new Error(`TensorArray's size is not equal to the size of lengths (${this.maxSize} vs. ${e.length}), and the TensorArray is not marked as dynamically resizeable`);let r=n===0?0:t.size/n,s=[];Z(()=>{t=Y(t,[1,n,r]);for(let o=0;o{if(n!==r.dtype)throw new Error(`Invalid data types; op elements ${n}, but list elements ${r.dtype}`);Za(t,r.shape,"TensorList shape mismatch: "),Sn(r)}),this.idTensor=Re(0),this.maxNumElements=a,Sn(this.idTensor)}get id(){return this.idTensor.id}copy(){return new Qh([...this.tensors],this.elementShape,this.elementDtype)}clearAndClose(e){this.tensors.forEach(t=>{(e==null||!e.has(t.id))&&t.dispose()}),this.tensors.length=0,this.idTensor.dispose()}size(){return this.tensors.length}stack(e,t,n=-1){if(t!==this.elementDtype)throw new Error(`Invalid data types; op elements ${t}, but list elements ${this.elementDtype}`);if(n!==-1&&this.tensors.length!==n)throw new Error(`Operation expected a list with ${n} elements but got a list with ${this.tensors.length} elements.`);Za(e,this.elementShape,"TensorList shape mismatch: ");let a=Jh(this.elementShape,this.tensors,e);return Z(()=>{let r=this.tensors.map(s=>Y(s,a));return Fa(r,0)})}popBack(e,t){if(t!==this.elementDtype)throw new Error(`Invalid data types; op elements ${t}, but list elements ${this.elementDtype}`);if(this.size()===0)throw new Error("Trying to pop from an empty list.");let n=Jh(this.elementShape,this.tensors,e),a=this.tensors.pop();return Za(a.shape,e,"TensorList shape mismatch: "),Y(a,n)}pushBack(e){if(e.dtype!==this.elementDtype)throw new Error(`Invalid data types; op elements ${e.dtype}, but list elements ${this.elementDtype}`);if(Za(e.shape,this.elementShape,"TensorList shape mismatch: "),this.maxNumElements===this.size())throw new Error("Trying to push element into a full list.");Sn(e),this.tensors.push(e)}resize(e){if(e<0)throw new Error(`TensorListResize expects size to be non-negative. Got: ${e}`);if(this.maxNumElements!==-1&&e>this.maxNumElements)throw new Error(`TensorListResize input size ${e} is greater maxNumElement ${this.maxNumElements}.`);this.tensors.length=e}getItem(e,t,n){if(n!==this.elementDtype)throw new Error(`Invalid data types; op elements ${n}, but list elements ${this.elementDtype}`);if(e<0||e>this.tensors.length)throw new Error(`Trying to access element ${e} in a list with ${this.tensors.length} elements.`);if(this.tensors[e]==null)throw new Error(`element at index ${e} is null.`);Za(this.tensors[e].shape,t,"TensorList shape mismatch: ");let a=Jh(this.elementShape,this.tensors,t);return Y(this.tensors[e],a)}setItem(e,t){if(t.dtype!==this.elementDtype)throw new Error(`Invalid data types; op elements ${t.dtype}, but list elements ${this.elementDtype}`);if(e<0||this.maxNumElements!==-1&&e>=this.maxNumElements)throw new Error(`Trying to set element ${e} in a list with max ${this.maxNumElements} elements.`);Za(this.elementShape,t.shape,"TensorList shape mismatch: "),Sn(t),this.tensors[e]=t}gather(e,t,n){if(t!==this.elementDtype)throw new Error(`Invalid data types; op elements ${t}, but list elements ${this.elementDtype}`);Za(this.elementShape,n,"TensorList shape mismatch: "),e=e.slice(0,this.size());let a=Jh(this.elementShape,this.tensors,n);return e.length===0?Cr([],[0].concat(a)):Z(()=>{let r=e.map(s=>Y(this.tensors[s],a));return Fa(r,0)})}concat(e,t){if(!!e&&e!==this.elementDtype)throw new Error(`TensorList dtype is ${this.elementDtype} but concat requested dtype ${e}`);Za(this.elementShape,t,"TensorList shape mismatch: ");let n=Jh(this.elementShape,this.tensors,t);return this.size()===0?Cr([],[0].concat(n)):Z(()=>{let a=this.tensors.map(r=>Y(r,n));return en(a,0)})}};function sre(e,t,n){let a=e.dtype;if(e.shape.length<1)throw new Error(`Tensor must be at least a vector, but saw shape: ${e.shape}`);if(e.dtype!==n)throw new Error(`Invalid data types; op elements ${e.dtype}, but list elements ${n}`);let r=e.shape.slice(1);Za(r,t,"TensorList shape mismatch: ");let s=or(e);return new Qh(s,t,a)}function ire(e,t,n){return new Qh([],e,t,n)}function ore(e,t,n,a){if(t.length!==e.shape[0])throw new Error(`Expected len(indices) == tensor.shape[0], but saw: ${t.length} vs. ${e.shape[0]}`);let r=Math.max(...t);if(a!=null&&a!==-1&&r>=a)throw new Error(`Max index must be < array size (${r} vs. ${a})`);let s=new Qh([],n,e.dtype,a),i=or(e,0);return t.forEach((o,l)=>{s.setItem(o,i[l])}),s}function lre(e,t,n){let a=0,r=t.map(d=>(a+=d,a));if(a!==e.shape[0])throw new Error(`Expected sum of lengths to be equal to + ${n}, and tensor's shape is: ${t.shape}`);if(!this.dynamicSize&&e.length!==this.maxSize)throw new Error(`TensorArray's size is not equal to the size of lengths (${this.maxSize} vs. ${e.length}), and the TensorArray is not marked as dynamically resizeable`);let s=n===0?0:t.size/n,a=[];Z(()=>{t=J(t,[1,n,s]);for(let i=0;i{if(n!==s.dtype)throw new Error(`Invalid data types; op elements ${n}, but list elements ${s.dtype}`);Yr(t,s.shape,"TensorList shape mismatch: "),Sn(s)}),this.idTensor=Fe(0),this.maxNumElements=r,Sn(this.idTensor)}get id(){return this.idTensor.id}copy(){return new Qd([...this.tensors],this.elementShape,this.elementDtype)}clearAndClose(e){this.tensors.forEach(t=>{(e==null||!e.has(t.id))&&t.dispose()}),this.tensors.length=0,this.idTensor.dispose()}size(){return this.tensors.length}stack(e,t,n=-1){if(t!==this.elementDtype)throw new Error(`Invalid data types; op elements ${t}, but list elements ${this.elementDtype}`);if(n!==-1&&this.tensors.length!==n)throw new Error(`Operation expected a list with ${n} elements but got a list with ${this.tensors.length} elements.`);Yr(e,this.elementShape,"TensorList shape mismatch: ");let r=Jd(this.elementShape,this.tensors,e);return Z(()=>{let s=this.tensors.map(a=>J(a,r));return Mr(s,0)})}popBack(e,t){if(t!==this.elementDtype)throw new Error(`Invalid data types; op elements ${t}, but list elements ${this.elementDtype}`);if(this.size()===0)throw new Error("Trying to pop from an empty list.");let n=Jd(this.elementShape,this.tensors,e),r=this.tensors.pop();return Yr(r.shape,e,"TensorList shape mismatch: "),J(r,n)}pushBack(e){if(e.dtype!==this.elementDtype)throw new Error(`Invalid data types; op elements ${e.dtype}, but list elements ${this.elementDtype}`);if(Yr(e.shape,this.elementShape,"TensorList shape mismatch: "),this.maxNumElements===this.size())throw new Error("Trying to push element into a full list.");Sn(e),this.tensors.push(e)}resize(e){if(e<0)throw new Error(`TensorListResize expects size to be non-negative. Got: ${e}`);if(this.maxNumElements!==-1&&e>this.maxNumElements)throw new Error(`TensorListResize input size ${e} is greater maxNumElement ${this.maxNumElements}.`);this.tensors.length=e}getItem(e,t,n){if(n!==this.elementDtype)throw new Error(`Invalid data types; op elements ${n}, but list elements ${this.elementDtype}`);if(e<0||e>this.tensors.length)throw new Error(`Trying to access element ${e} in a list with ${this.tensors.length} elements.`);if(this.tensors[e]==null)throw new Error(`element at index ${e} is null.`);Yr(this.tensors[e].shape,t,"TensorList shape mismatch: ");let r=Jd(this.elementShape,this.tensors,t);return J(this.tensors[e],r)}setItem(e,t){if(t.dtype!==this.elementDtype)throw new Error(`Invalid data types; op elements ${t.dtype}, but list elements ${this.elementDtype}`);if(e<0||this.maxNumElements!==-1&&e>=this.maxNumElements)throw new Error(`Trying to set element ${e} in a list with max ${this.maxNumElements} elements.`);Yr(this.elementShape,t.shape,"TensorList shape mismatch: "),Sn(t),this.tensors[e]=t}gather(e,t,n){if(t!==this.elementDtype)throw new Error(`Invalid data types; op elements ${t}, but list elements ${this.elementDtype}`);Yr(this.elementShape,n,"TensorList shape mismatch: "),e=e.slice(0,this.size());let r=Jd(this.elementShape,this.tensors,n);return e.length===0?$s([],[0].concat(r)):Z(()=>{let s=e.map(a=>J(this.tensors[a],r));return Mr(s,0)})}concat(e,t){if(!!e&&e!==this.elementDtype)throw new Error(`TensorList dtype is ${this.elementDtype} but concat requested dtype ${e}`);Yr(this.elementShape,t,"TensorList shape mismatch: ");let n=Jd(this.elementShape,this.tensors,t);return this.size()===0?$s([],[0].concat(n)):Z(()=>{let r=this.tensors.map(s=>J(s,n));return en(r,0)})}};function ase(e,t,n){let r=e.dtype;if(e.shape.length<1)throw new Error(`Tensor must be at least a vector, but saw shape: ${e.shape}`);if(e.dtype!==n)throw new Error(`Invalid data types; op elements ${e.dtype}, but list elements ${n}`);let s=e.shape.slice(1);Yr(s,t,"TensorList shape mismatch: ");let a=ls(e);return new Qd(a,t,r)}function ose(e,t,n){return new Qd([],e,t,n)}function ise(e,t,n,r){if(t.length!==e.shape[0])throw new Error(`Expected len(indices) == tensor.shape[0], but saw: ${t.length} vs. ${e.shape[0]}`);let s=Math.max(...t);if(r!=null&&r!==-1&&s>=r)throw new Error(`Max index must be < array size (${s} vs. ${r})`);let a=new Qd([],n,e.dtype,r),o=ls(e,0);return t.forEach((i,l)=>{a.setItem(i,o[l])}),a}function lse(e,t,n){let r=0,s=t.map(c=>(r+=c,r));if(r!==e.shape[0])throw new Error(`Expected sum of lengths to be equal to tensor.shape[0], but sum of lengths is - ${a}, and tensor's shape is: ${e.shape}`);let s=e.shape.slice(1),i=k5(s,n),o=a===0?0:e.size/a,l=Z(()=>{let d=[];e=Y(e,[1,a,o]);for(let h=0;h{switch(e.op){case"If":case"StatelessIf":{let a=N("thenBranch",e,t,n),r=N("elseBranch",e,t,n),s=N("cond",e,t,n),i=N("args",e,t,n);return(await s.data())[0]?n.functionMap[a].executeFunctionAsync(i,n.tensorArrayMap,n.tensorListMap):n.functionMap[r].executeFunctionAsync(i,n.tensorArrayMap,n.tensorListMap)}case"While":case"StatelessWhile":{let a=N("body",e,t,n),r=N("cond",e,t,n),s=N("args",e,t,n),i=await n.functionMap[r].executeFunctionAsync(s,n.tensorArrayMap,n.tensorListMap),o=s.map(d=>d.id),l=await i[0].data();i.forEach(d=>{!d.kept&&o.indexOf(d.id)===-1&&d.dispose()});let u=s;for(;l[0];){let d=u;u=await n.functionMap[a].executeFunctionAsync(u,n.tensorArrayMap,n.tensorListMap);let h=u.map(c=>c.id);d.forEach(c=>{!c.kept&&o.indexOf(c.id)===-1&&h.indexOf(c.id)===-1&&c.dispose()});let p=await n.functionMap[r].executeFunctionAsync(u,n.tensorArrayMap,n.tensorListMap);l=await p[0].data(),p.forEach(c=>{!c.kept&&o.indexOf(c.id)===-1&&h.indexOf(c.id)===-1&&c.dispose()})}return u}case"LoopCond":{let a=N("pred",e,t,n);return[ms(a)]}case"Switch":{let a=N("pred",e,t,n),r=N("data",e,t,n);return r.kept||(r=ms(r)),(await a.data())[0]?[void 0,r]:[r,void 0]}case"Merge":{let a=e.inputNames.find(r=>Ln(r,t,n)!==void 0);if(a){let r=Ln(a,t,n);return[ms(r)]}return}case"Enter":{let a=N("frameName",e,t,n),r=N("tensor",e,t,n);return n.enterFrame(a),[ms(r)]}case"Exit":{let a=N("tensor",e,t,n);return n.exitFrame(),[ms(a)]}case"NextIteration":{let a=N("tensor",e,t,n);return n.nextIteration(),[ms(a)]}case"TensorArrayV3":{let a=N("size",e,t,n),r=N("dtype",e,t,n),s=N("elementShape",e,t,n),i=N("dynamicSize",e,t,n),o=N("clearAfterRead",e,t,n),l=N("identicalElementShapes",e,t,n),u=N("name",e,t,n),d=new rre(u,r,a,s,l,i,o);return n.addTensorArray(d),[d.idTensor,Re(1)]}case"TensorArrayWriteV3":{let a=N("tensorArrayId",e,t,n),r=N("index",e,t,n),s=N("tensor",e,t,n),i=n.getTensorArray(a.id);return i.write(r,s),[i.idTensor]}case"TensorArrayReadV3":{let a=N("tensorArrayId",e,t,n),r=N("index",e,t,n);return[n.getTensorArray(a.id).read(r)]}case"TensorArrayGatherV3":{let a=N("tensorArrayId",e,t,n),r=N("indices",e,t,n),s=N("dtype",e,t,n);return[n.getTensorArray(a.id).gather(r,s)]}case"TensorArrayScatterV3":{let a=N("tensorArrayId",e,t,n),r=N("indices",e,t,n),s=N("tensor",e,t,n),i=n.getTensorArray(a.id);return i.scatter(r,s),[i.idTensor]}case"TensorArrayConcatV3":{let a=N("tensorArrayId",e,t,n),r=n.getTensorArray(a.id),s=N("dtype",e,t,n);return[r.concat(s)]}case"TensorArraySplitV3":{let a=N("tensorArrayId",e,t,n),r=N("tensor",e,t,n),s=N("lengths",e,t,n),i=n.getTensorArray(a.id);return i.split(s,r),[i.idTensor]}case"TensorArraySizeV3":{let a=N("tensorArrayId",e,t,n),r=n.getTensorArray(a.id);return[Re(r.size(),"int32")]}case"TensorArrayCloseV3":{let a=N("tensorArrayId",e,t,n),r=n.getTensorArray(a.id);return r.clearAndClose(),[r.idTensor]}case"TensorListSetItem":{let a=N("tensorListId",e,t,n),r=N("index",e,t,n),s=N("tensor",e,t,n),i=n.getTensorList(a.id);return i.setItem(r,s),[i.idTensor]}case"TensorListGetItem":{let a=N("tensorListId",e,t,n),r=N("index",e,t,n),s=N("elementShape",e,t,n),i=N("elementDType",e,t,n);return[n.getTensorList(a.id).getItem(r,s,i)]}case"TensorListScatterV2":case"TensorListScatter":{let a=N("indices",e,t,n),r=N("tensor",e,t,n),s=N("elementShape",e,t,n),i=N("numElements",e,t,n),o=ore(r,a,s,i);return n.addTensorList(o),[o.idTensor]}case"TensorListReserve":case"EmptyTensorList":{let a=N("elementShape",e,t,n),r=N("elementDType",e,t,n),s;e.op==="TensorListReserve"?s="numElements":s="maxNumElements";let i=N(s,e,t,n),o=ire(a,r,i);return n.addTensorList(o),[o.idTensor]}case"TensorListGather":{let a=N("tensorListId",e,t,n),r=N("indices",e,t,n),s=N("elementShape",e,t,n),i=N("elementDType",e,t,n);return[n.getTensorList(a.id).gather(r,i,s)]}case"TensorListStack":{let a=N("tensorListId",e,t,n),r=N("elementShape",e,t,n),s=N("elementDType",e,t,n),i=N("numElements",e,t,n);return[n.getTensorList(a.id).stack(r,s,i)]}case"TensorListFromTensor":{let a=N("tensor",e,t,n),r=N("elementShape",e,t,n),s=N("elementDType",e,t,n),i=sre(a,r,s);return n.addTensorList(i),[i.idTensor]}case"TensorListConcat":{let a=N("tensorListId",e,t,n),r=n.getTensorList(a.id),s=N("dtype",e,t,n),i=N("elementShape",e,t,n);return[r.concat(s,i)]}case"TensorListPushBack":{let a=N("tensorListId",e,t,n),r=N("tensor",e,t,n),s=n.getTensorList(a.id);return s.pushBack(r),[s.idTensor]}case"TensorListPopBack":{let a=N("tensorListId",e,t,n),r=N("elementShape",e,t,n),s=N("elementDType",e,t,n);return[n.getTensorList(a.id).popBack(r,s)]}case"TensorListSplit":{let a=N("tensor",e,t,n),r=N("elementShape",e,t,n),s=N("lengths",e,t,n),i=lre(a,s,r);return n.addTensorList(i),[i.idTensor]}default:throw TypeError(`Node type ${e.op} is not implemented`)}};function c9(e,t,n){let[a,r]=N("fusedOps",e,t,n),s=a==="biasadd",i=!s,o=r==="prelu",l=a==="fusedbatchnorm",u=N("numArgs",e,t,n);if(s){if(o&&u!==2)throw new Error("FusedConv2d and DepthwiseConv2d with BiasAdd and Prelu must have two extra arguments: bias and alpha.");if(!o&&s&&u!==1)throw new Error("FusedConv2d and DepthwiseConv2d with BiasAdd must have one extra argument: bias.")}if(l)throw new Error("FusedConv2d and DepthwiseConv2d with FusedBatchNorm is not supported");let d=N("strides",e,t,n),h=I0(e,t,n),p=N("dataFormat",e,t,n).toUpperCase(),c=N("dilations",e,t,n),[m,f]=N("args",e,t,n);i&&(f=m,m=void 0);let g=N("leakyreluAlpha",e,t,n);return{stride:d,pad:h,dataFormat:p,dilations:c,biasArg:m,preluArg:f,activationFunc:r,leakyreluAlpha:g}}var dre=(e,t,n)=>{switch(e.op){case"Conv1D":{let a=N("stride",e,t,n),r=N("pad",e,t,n),s=N("dataFormat",e,t,n).toUpperCase(),i=N("dilation",e,t,n);return[OA(N("x",e,t,n),N("filter",e,t,n),a,r,s,i)]}case"Conv2D":{let a=N("strides",e,t,n),r=I0(e,t,n),s=N("dataFormat",e,t,n).toUpperCase(),i=N("dilations",e,t,n);return[Ws(N("x",e,t,n),N("filter",e,t,n),[a[1],a[2]],r,s,[i[1],i[2]])]}case"_FusedConv2D":{let{stride:a,pad:r,dataFormat:s,dilations:i,biasArg:o,preluArg:l,activationFunc:u,leakyreluAlpha:d}=c9(e,t,n);return[eo.conv2d({x:N("x",e,t,n),filter:N("filter",e,t,n),strides:[a[1],a[2]],pad:r,dataFormat:s,dilations:[i[1],i[2]],bias:o,activation:u,preluActivationWeights:l,leakyreluAlpha:d})]}case"FusedDepthwiseConv2dNative":{let{stride:a,pad:r,dataFormat:s,dilations:i,biasArg:o,preluArg:l,activationFunc:u,leakyreluAlpha:d}=c9(e,t,n);return[eo.depthwiseConv2d({x:N("x",e,t,n),filter:N("filter",e,t,n),strides:[a[1],a[2]],pad:r,dataFormat:s,dilations:[i[1],i[2]],bias:o,activation:u,preluActivationWeights:l,leakyreluAlpha:d})]}case"Conv2DBackpropInput":case"Conv2dTranspose":{let a=N("outputShape",e,t,n),r=N("strides",e,t,n),s=I0(e,t,n);return[_A(N("x",e,t,n),N("filter",e,t,n),a,[r[1],r[2]],s)]}case"DepthwiseConv2dNative":case"DepthwiseConv2d":{let a=N("strides",e,t,n),r=I0(e,t,n),s=N("dilations",e,t,n),i=N("dataFormat",e,t,n).toUpperCase();return[Nh(N("input",e,t,n),N("filter",e,t,n),[a[1],a[2]],r,i,[s[1],s[2]])]}case"Conv3D":{let a=N("strides",e,t,n),r=N("pad",e,t,n),s=N("dataFormat",e,t,n).toUpperCase(),i=N("dilations",e,t,n);return[n8(N("x",e,t,n),N("filter",e,t,n),[a[1],a[2],a[3]],r,s,[i[1],i[2],i[3]])]}case"AvgPool":{let a=N("strides",e,t,n),r=N("pad",e,t,n),s=N("kernelSize",e,t,n);return[Sf(N("x",e,t,n),[s[1],s[2]],[a[1],a[2]],r)]}case"MaxPool":{let a=N("strides",e,t,n),r=N("pad",e,t,n),s=N("kernelSize",e,t,n);return[Mf(N("x",e,t,n),[s[1],s[2]],[a[1],a[2]],r)]}case"MaxPoolWithArgmax":{let a=N("strides",e,t,n),r=N("pad",e,t,n),s=N("kernelSize",e,t,n),i=N("includeBatchInIndex",e,t,n),{result:o,indexes:l}=rK(N("x",e,t,n),[s[1],s[2]],[a[1],a[2]],r,i);return[o,l]}case"AvgPool3D":{let a=N("strides",e,t,n),r=N("pad",e,t,n),s=N("kernelSize",e,t,n);return[Q4(N("x",e,t,n),[s[1],s[2],s[3]],[a[1],a[2],a[3]],r)]}case"MaxPool3D":{let a=N("strides",e,t,n),r=N("pad",e,t,n),s=N("kernelSize",e,t,n);return[g8(N("x",e,t,n),[s[1],s[2],s[3]],[a[1],a[2],a[3]],r)]}case"Dilation2D":{let a=N("strides",e,t,n),r=N("pad",e,t,n),s=N("dilations",e,t,n),i=a[1],o=a[2],l=s[1],u=s[2];return[s8(N("x",e,t,n),N("filter",e,t,n),[i,o],r,[l,u],"NHWC")]}default:throw TypeError(`Node type ${e.op} is not implemented`)}},hre=(e,t,n)=>{switch(e.op){case"Fill":{let a=N("shape",e,t,n),r=N("dtype",e,t,n),s=N("value",e,t,n);return[Eh(a,s,r)]}case"LinSpace":{let a=N("start",e,t,n),r=N("stop",e,t,n),s=N("num",e,t,n);return[Oq(a,r,s)]}case"Multinomial":{let a=N("logits",e,t,n),r=N("numSamples",e,t,n),s=N("seed",e,t,n);return[mK(a,r,s)]}case"OneHot":{let a=N("indices",e,t,n),r=N("depth",e,t,n),s=N("onValue",e,t,n),i=N("offValue",e,t,n);return[kh(a,r,s,i)]}case"Ones":return[os(N("shape",e,t,n),N("dtype",e,t,n))];case"OnesLike":return[$a(N("x",e,t,n))];case"RandomUniform":return[Rh(N("shape",e,t,n),N("minval",e,t,n),N("maxval",e,t,n),N("dtype",e,t,n))];case"Range":{let a=N("start",e,t,n),r=N("stop",e,t,n),s=N("step",e,t,n);return[Fh(a,r,s,N("dtype",e,t,n))]}case"TruncatedNormal":{let a=N("shape",e,t,n),r=N("mean",e,t,n),s=N("stdDev",e,t,n),i=N("seed",e,t,n);return[o2(a,r,s,N("dtype",e,t,n),i)]}case"Zeros":return[un(N("shape",e,t,n),N("dtype",e,t,n))];case"ZerosLike":return[at(N("x",e,t,n))];default:throw TypeError(`Node type ${e.op} is not implemented`)}};function I5(e,t,n){let a=N("boxes",e,t,n),r=N("scores",e,t,n),s=N("maxOutputSize",e,t,n),i=N("iouThreshold",e,t,n),o=N("scoreThreshold",e,t,n),l=N("softNmsSigma",e,t,n);return{boxes:a,scores:r,maxOutputSize:s,iouThreshold:i,scoreThreshold:o,softNmsSigma:l}}var pre=async(e,t,n)=>{switch(e.op){case"NonMaxSuppressionV5":{let{boxes:a,scores:r,maxOutputSize:s,iouThreshold:i,scoreThreshold:o,softNmsSigma:l}=I5(e,t,n),u=await to.nonMaxSuppressionWithScoreAsync(a,r,s,i,o,l);return[u.selectedIndices,u.selectedScores]}case"NonMaxSuppressionV4":{let{boxes:a,scores:r,maxOutputSize:s,iouThreshold:i,scoreThreshold:o}=I5(e,t,n),l=N("padToMaxOutputSize",e,t,n),u=await to.nonMaxSuppressionPaddedAsync(a,r,s,i,o,l);return[u.selectedIndices,u.validOutputs]}case"NonMaxSuppressionV3":case"NonMaxSuppressionV2":{let{boxes:a,scores:r,maxOutputSize:s,iouThreshold:i,scoreThreshold:o}=I5(e,t,n);return[await to.nonMaxSuppressionAsync(a,r,s,i,o)]}case"Where":{let a=we(N("condition",e,t,n),"bool"),r=[await TX(a)];return a.dispose(),r}case"ListDiff":return QK(N("x",e,t,n),N("y",e,t,n));default:throw TypeError(`Node type ${e.op} is not implemented`)}},cre=(e,t,n)=>{switch(e.op){case"TopKV2":{let a=N("x",e,t,n),r=N("k",e,t,n),s=N("sorted",e,t,n),i=N8(a,r,s);return[i.values,i.indices]}case"Unique":{let a=N("x",e,t,n),r=l2(a);return[r.values,r.indices]}case"UniqueV2":{let a=N("x",e,t,n),r=N("axis",e,t,n),s=l2(a,r);return[s.values,s.indices]}default:throw TypeError(`Node type ${e.op} is not implemented`)}},fre=(e,t,n)=>{switch(e.op){case"Const":return t[e.name];case"PlaceholderWithDefault":let a=N("default",e,t,n);return[Ln(e.name,t,n)||a];case"Placeholder":return[Ln(e.name,t,n)];case"Identity":case"StopGradient":case"FakeQuantWithMinMaxVars":{let u=N("x",e,t,n);return[ms(u)]}case"IdentityN":return N("x",e,t,n).map(u=>ms(u));case"Snapshot":let r=N("x",e,t,n);return[ms(r)];case"Shape":return[$n(N("x",e,t,n).shape,"int32")];case"ShapeN":return N("x",e,t,n).map(u=>$n(u.shape));case"Size":return[Re(N("x",e,t,n).size,"int32")];case"Rank":return[Re(N("x",e,t,n).rank,"int32")];case"NoOp":return[Re(1)];case"Print":let s=N("x",e,t,n),i=N("data",e,t,n),o=N("message",e,t,n),l=N("summarize",e,t,n);console.warn("The graph has a tf.print() operation,usually used for debugging, which slows down performance."),console.log(o);for(let u=0;ue.dispose()),this.tensorMap.clear(),this.handle.dispose()}size(){return this.tensorMap.size}tensorSize(){return Re(this.size(),"int32")}async import(e,t){this.checkKeyAndValueTensor(e,t);let n=await e.data();return this.tensorMap.forEach(a=>a.dispose()),this.tensorMap.clear(),Z(()=>{let a=or(t),r=n.length,s=a.length;k.assert(r===s,()=>`The number of elements doesn't match, keys has ${r} elements, the values has ${s} elements.`);for(let i=0;i{let a=[];for(let r=0;r{switch(e.op){case"HashTable":case"HashTableV2":{let r=N("keyDType",e,t,n),s=N("valueDType",e,t,n),i=new mre(r,s);return a.addHashTable(e.name,i),[i.handle]}case"LookupTableImport":case"LookupTableImportV2":{let r=N("tableHandle",e,t,n,a),s=N("keys",e,t,n),i=N("values",e,t,n);return[await a.getHashTableById(r.id).import(s,i)]}case"LookupTableFind":case"LookupTableFindV2":{let r=N("tableHandle",e,t,n,a),s=N("keys",e,t,n),i=N("defaultValue",e,t,n);return[await a.getHashTableById(r.id).find(s,i)]}case"LookupTableSize":case"LookupTableSizeV2":{let r=N("tableHandle",e,t,n,a);return[a.getHashTableById(r.id).tensorSize()]}default:throw TypeError(`Node type ${e.op} is not implemented`)}},yre=(e,t,n)=>{switch(e.op){case"ResizeBilinear":{let a=N("images",e,t,n),r=N("size",e,t,n),s=N("alignCorners",e,t,n),i=N("halfPixelCenters",e,t,n);return[to.resizeBilinear(a,[r[0],r[1]],s,i)]}case"ResizeNearestNeighbor":{let a=N("images",e,t,n),r=N("size",e,t,n),s=N("alignCorners",e,t,n),i=N("halfPixelCenters",e,t,n);return[to.resizeNearestNeighbor(a,[r[0],r[1]],s,i)]}case"CropAndResize":{let a=N("image",e,t,n),r=N("boxes",e,t,n),s=N("boxInd",e,t,n),i=N("cropSize",e,t,n),o=N("method",e,t,n),l=N("extrapolationValue",e,t,n);return[to.cropAndResize(a,r,s,i,o,l)]}default:throw TypeError(`Node type ${e.op} is not implemented`)}},Are=(e,t,n)=>{switch(e.op){case"Equal":return[Xi(N("a",e,t,n),N("b",e,t,n))];case"NotEqual":return[Yl(N("a",e,t,n),N("b",e,t,n))];case"Greater":return[Ca(N("a",e,t,n),N("b",e,t,n))];case"GreaterEqual":return[Yi(N("a",e,t,n),N("b",e,t,n))];case"Less":return[WA(N("a",e,t,n),N("b",e,t,n))];case"LessEqual":return[Ji(N("a",e,t,n),N("b",e,t,n))];case"LogicalAnd":return[ir(N("a",e,t,n),N("b",e,t,n))];case"LogicalNot":return[Cf(N("a",e,t,n))];case"LogicalOr":return[HA(N("a",e,t,n),N("b",e,t,n))];case"Select":case"SelectV2":return[Pn(N("condition",e,t,n),N("a",e,t,n),N("b",e,t,n))];default:throw TypeError(`Node type ${e.op} is not implemented`)}},xre=(e,t,n)=>{switch(e.op){case"BatchMatMul":case"BatchMatMulV2":case"MatMul":return[it(N("a",e,t,n),N("b",e,t,n),N("transposeA",e,t,n),N("transposeB",e,t,n))];case"Einsum":return[cq(N("equation",e,t,n),...N("tensors",e,t,n))];case"Transpose":return[ct(N("x",e,t,n),N("perm",e,t,n))];case"_FusedMatMul":let[a,r]=N("fusedOps",e,t,n),s=a==="biasadd",i=r==="prelu",o=N("numArgs",e,t,n),l=N("leakyreluAlpha",e,t,n);if(s){if(i&&o!==2)throw new Error("Fused MatMul with BiasAdd and Prelu must have two extra arguments: bias and alpha.");if(!i&&o!==1)throw new Error("Fused MatMul with BiasAdd must have one extra argument: bias.")}let[u,d]=N("args",e,t,n);return[eo.matMul({a:N("a",e,t,n),b:N("b",e,t,n),transposeA:N("transposeA",e,t,n),transposeB:N("transposeB",e,t,n),bias:u,activation:r,preluActivationWeights:d,leakyreluAlpha:l})];default:throw TypeError(`Node type ${e.op} is not implemented`)}},bre=(e,t,n)=>{switch(e.op){case"FusedBatchNorm":case"FusedBatchNormV2":return[Xl(N("x",e,t,n),N("mean",e,t,n),N("variance",e,t,n),N("offset",e,t,n),N("scale",e,t,n),N("epsilon",e,t,n))];case"FusedBatchNormV3":return[Xl(N("x",e,t,n),N("mean",e,t,n),N("variance",e,t,n),N("offset",e,t,n),N("scale",e,t,n),N("epsilon",e,t,n))];case"LRN":return[h8(N("x",e,t,n),N("radius",e,t,n),N("bias",e,t,n),N("alpha",e,t,n),N("beta",e,t,n))];case"Softmax":return[_f(N("x",e,t,n))];case"LogSoftmax":return[VA(N("x",e,t,n))];case"SparseToDense":return[M8(N("sparseIndices",e,t,n),N("outputShape",e,t,n),N("sparseValues",e,t,n),N("defaultValue",e,t,n))];default:throw TypeError(`Node type ${e.op} is not implemented`)}},vre=(e,t,n)=>{switch(e.op){case"Max":{let i=N("axis",e,t,n),o=N("keepDims",e,t,n);return[sr(N("x",e,t,n),i,o)]}case"Mean":{let i=N("axis",e,t,n),o=N("keepDims",e,t,n);return[Xt(N("x",e,t,n),i,o)]}case"Min":{let i=N("axis",e,t,n),o=N("keepDims",e,t,n);return[$f(N("x",e,t,n),i,o)]}case"Sum":{let i=N("axis",e,t,n),o=N("keepDims",e,t,n);return[Ce(N("x",e,t,n),i,o)]}case"All":{let i=N("axis",e,t,n),o=N("keepDims",e,t,n);return[$A(N("x",e,t,n),i,o)]}case"Any":{let i=N("axis",e,t,n),o=N("keepDims",e,t,n);return[wf(N("x",e,t,n),i,o)]}case"ArgMax":{let i=N("axis",e,t,n);return[kf(N("x",e,t,n),i)]}case"ArgMin":{let i=N("axis",e,t,n);return[j4(N("x",e,t,n),i)]}case"Prod":{let i=N("axis",e,t,n),o=N("keepDims",e,t,n);return[qA(N("x",e,t,n),i,o)]}case"Cumsum":{let i=N("axis",e,t,n),o=N("exclusive",e,t,n),l=N("reverse",e,t,n);return[PA(N("x",e,t,n),i,o,l)]}case"Bincount":let a=N("x",e,t,n),r=N("weights",e,t,n),s=N("size",e,t,n);return[e8(a,r,s)];case"DenseBincount":{let i=N("x",e,t,n),o=N("weights",e,t,n),l=N("size",e,t,n),u=N("binaryOutput",e,t,n);return[eq(i,o,l,u)]}default:throw TypeError(`Node type ${e.op} is not implemented`)}},wre=(e,t,n)=>{switch(e.op){case"ConcatV2":case"Concat":{let a=N("n",e,t,n),r=N("axis",e,t,n),s=N("tensors",e,t,n);return s=s.slice(0,a),[en(s,r)]}case"Gather":{let a=N("x",e,t,n),r=N("indices",e,t,n);return[Mh(a,we(r,"int32"),0)]}case"GatherV2":{let a=N("axis",e,t,n),r=N("batchDims",e,t,n),s=N("x",e,t,n),i=N("indices",e,t,n);return[Mh(s,we(i,"int32"),a,r)]}case"Reverse":{let a=N("dims",e,t,n),r=[];for(let i=0;i{let a=N("axis",e,t,n),r=N("tensors",e,t,n),s=r[0].shape,i=Jl(r[0]).shape,o=r.map(l=>{let u=k.arraysEqual(l.shape,s);if(!u&&!k.arraysEqual(Jl(l).shape,i))throw new Error("the input tensors shape does not match");return u?l:Y(l,s)});return[Fa(o,a)]});case"Unpack":{let a=N("axis",e,t,n),r=N("tensor",e,t,n);return or(r,a)}case"Tile":{let a=N("reps",e,t,n);return[Zi(N("x",e,t,n),a)]}case"Split":case"SplitV":{let a=N("axis",e,t,n),r=N("numOrSizeSplits",e,t,n),s=N("x",e,t,n);return da(s,r,a)}case"ScatterNd":{let a=N("indices",e,t,n),r=N("values",e,t,n),s=N("shape",e,t,n);return[$X(a,r,s)]}case"GatherNd":{let a=N("x",e,t,n),r=N("indices",e,t,n);return[DX(a,r)]}case"SparseToDense":{let a=N("sparseIndices",e,t,n),r=N("outputShape",e,t,n),s=N("sparseValues",e,t,n),i=N("defaultValue",e,t,n);return[M8(a,s,r,s.dtype===i.dtype?i:we(i,s.dtype))]}default:throw TypeError(`Node type ${e.op} is not implemented`)}},kre=(e,t,n)=>{switch(e.op){case"SparseFillEmptyRows":{let{outputIndices:a,outputValues:r,emptyRowIndicator:s,reverseIndexMap:i}=Vf.sparseFillEmptyRows(N("indices",e,t,n),N("values",e,t,n),N("denseShape",e,t,n),N("defaultValue",e,t,n));return[a,r,s,i]}case"SparseReshape":{let{outputIndices:a,outputShape:r}=Vf.sparseReshape(N("inputIndices",e,t,n),N("inputShape",e,t,n),N("newShape",e,t,n));return[a,r]}case"SparseSegmentMean":return[Vf.sparseSegmentMean(N("data",e,t,n),N("indices",e,t,n),N("segmentIds",e,t,n))];case"SparseSegmentSum":return[Vf.sparseSegmentSum(N("data",e,t,n),N("indices",e,t,n),N("segmentIds",e,t,n))];default:throw TypeError(`Node type ${e.op} is not implemented`)}},Ire=(e,t,n)=>{switch(e.op){case"FFT":return[r2(N("x",e,t,n))];case"IFFT":return[zf(N("x",e,t,n))];case"RFFT":return[s2(N("x",e,t,n))];case"IRFFT":return[k8(N("x",e,t,n))];default:throw TypeError(`Node type ${e.op} is not implemented`)}},Sre=(e,t,n)=>{switch(e.op){case"StringNGrams":{let{nGrams:a,nGramsSplits:r}=p2.stringNGrams(N("data",e,t,n),N("dataSplits",e,t,n),N("separator",e,t,n),N("nGramWidths",e,t,n),N("leftPad",e,t,n),N("rightPad",e,t,n),N("padWidth",e,t,n),N("preserveShortSequences",e,t,n));return[a,r]}case"StringSplit":{let{indices:a,values:r,shape:s}=p2.stringSplit(N("input",e,t,n),N("delimiter",e,t,n),N("skipEmpty",e,t,n));return[a,r,s]}case"StringToHashBucketFast":return[p2.stringToHashBucketFast(N("input",e,t,n),N("numBuckets",e,t,n))];default:throw TypeError(`Node type ${e.op} is not implemented`)}},Nre=(e,t,n)=>{switch(e.op){case"Cast":return[we(N("x",e,t,n),N("dtype",e,t,n))];case"ExpandDims":{let a=N("axis",e,t,n);return[Ea(N("x",e,t,n),a)]}case"Squeeze":{let a=N("axis",e,t,n);return[Jl(N("x",e,t,n),a)]}case"Reshape":return[Y(N("x",e,t,n),N("shape",e,t,n))];case"MirrorPad":return[y8(N("x",e,t,n),N("padding",e,t,n),N("mode",e,t,n))];case"PadV2":case"Pad":return[Bs(N("x",e,t,n),N("padding",e,t,n),N("constantValue",e,t,n))];case"SpaceToBatchND":{let a=N("blockShape",e,t,n),r=N("paddings",e,t,n);return[Rf(N("x",e,t,n),a,r)]}case"BatchToSpaceND":{let a=N("blockShape",e,t,n),r=N("crops",e,t,n);return[Nf(N("x",e,t,n),a,r)]}case"DepthToSpace":{let a=N("blockSize",e,t,n),r=N("dataFormat",e,t,n).toUpperCase();return[r8(N("x",e,t,n),a,r)]}case"BroadcastTo":return[Sh(N("x",e,t,n),N("shape",e,t,n))];default:throw TypeError(`Node type ${e.op} is not implemented`)}};function f9(e,t,n,a){let r=((s,i,o)=>{switch(s.category){case"arithmetic":return Z(()=>nre(s,i,o));case"basic_math":return Z(()=>are(s,i,o));case"control":return ure(s,i,o);case"convolution":return Z(()=>dre(s,i,o));case"creation":return Z(()=>hre(s,i,o));case"dynamic":return pre(s,i,o);case"evaluation":return Z(()=>cre(s,i,o));case"image":return Z(()=>yre(s,i,o));case"graph":return Z(()=>fre(s,i,o));case"logical":return Z(()=>Are(s,i,o));case"matrices":return Z(()=>xre(s,i,o));case"normalization":return Z(()=>bre(s,i,o));case"reduction":return Z(()=>vre(s,i,o));case"slice_join":return Z(()=>wre(s,i,o));case"sparse":return Z(()=>kre(s,i,o));case"spectral":return Z(()=>Ire(s,i,o));case"string":return Z(()=>Sre(s,i,o));case"transformation":return Z(()=>Nre(s,i,o));case"hash_table":return gre(s,i,o,a);case"custom":let l=VS(s.op);if(l&&l.customExecutor)return l.customExecutor(new tre(s,i,o));throw TypeError(`Custom op ${s.op} is not registered.`);default:throw TypeError(`Unknown op '${s.op}'. File an issue at https://github.com/tensorflow/tfjs/issues so we can add it, or register a custom execution with tf.registerOp()`)}})(e,t,n);return k.isPromise(r)?r.then(s=>[].concat(s)):[].concat(r)}var m9=class{constructor(e={},t={},n={},a={}){this.weightMap=e,this.tensorArrayMap=t,this.tensorListMap=n,this.functionMap=a,this.rootContext={id:0,frameName:"",iterationId:0},this.contexts=[this.rootContext],this.lastId=0,this.generateCurrentContextIds()}newFrame(e,t){return{id:e,frameName:t,iterationId:0}}set currentContext(e){this.contexts!==e&&(this.contexts=e,this.generateCurrentContextIds())}get currentContext(){return this.contexts}get currentContextId(){return this._currentContextIds[0]}get currentContextIds(){return this._currentContextIds}generateCurrentContextIds(){let e=[];for(let t=0;tt.id===0&&t.iterationId===0?"":`${t.frameName}-${t.iterationId}`).join("/"):""}enterFrame(e){this.contexts&&(this.lastId++,this.contexts=this.contexts.slice(),this.contexts.push(this.newFrame(this.lastId,e)),this._currentContextIds.unshift(this.contextIdforContexts(this.contexts)))}exitFrame(){if(this.contexts&&this.contexts.length>1)this.contexts=this.contexts.slice(),this.contexts.splice(-1),this.currentContextIds.shift();else throw new Error("Cannot exit frame, the context is empty")}nextIteration(){if(this.contexts&&this.contexts.length>0){this.contexts=this.contexts.slice(),this.lastId++;let e=Object.assign({},this.contexts[this.contexts.length-1]);e.iterationId+=1,e.id=this.lastId,this.contexts.splice(-1,1,e),this._currentContextIds.splice(0,1,this.contextIdforContexts(this.contexts))}else throw new Error("Cannot increase frame iteration, the context is empty")}getWeight(e){return this.weightMap[e]}addTensorArray(e){this.tensorArrayMap[e.id]=e}getTensorArray(e){return this.tensorArrayMap[e]}addTensorList(e){this.tensorListMap[e.id]=e}getTensorList(e){return this.tensorListMap[e]}dispose(e){for(let t in this.tensorArrayMap)this.tensorArrayMap[t].clearAndClose(e);for(let t in this.tensorListMap)this.tensorListMap[t].clearAndClose(e)}};function g9(e,t,n,a){let r=new Set,s=[],i=null,o=null,l=new Set,u=Object.keys(e).map(p=>ha(p)[0]),d=[];a!=null&&(d=a.map(p=>ha(p.name)[0]));let h=[...t];for(;h.length>0;){let p=h.pop();if((y9(p)||$re(p)||Rre(p))&&i==null&&(i=p,o=i.children.map(c=>c.name).filter(c=>r.has(c))),r.add(p.name),n[p.name]==null&&u.indexOf(p.name)===-1&&d.indexOf(p.name)===-1){if(p.inputs.length===0){s.push(p.name);continue}p.inputs.forEach(c=>{l.has(c.name)||(l.add(c.name),h.push(c))})}}return{inputs:e,outputs:t,usedNodes:r,missingInputs:s,dynamicNode:i,syncInputs:o}}function Tre(e,t,n){let{usedNodes:a,inputs:r}=n,s=[],i=Object.keys(r).map(d=>ha(d)[0]).map(d=>e.nodes[d]),o=e.initNodes;i.forEach(d=>{a.has(d.name)&&s.push(d)}),e.weights.forEach(d=>{a.has(d.name)&&s.push(d)}),o!=null&&o.forEach(d=>{a.has(d.name)&&s.push(d)});let l=new Set,u=[];for(;s.length>0;){let d=s.pop();l.add(d.name),t[d.name]||u.push(d),d.children.forEach(h=>{!l.has(h.name)&&a.has(h.name)&&h.inputs.every(p=>l.has(p.name))&&s.push(h)})}return u}var Ere=["Switch","Merge","Enter","Exit","NextIteration","StatelessIf","StatelessWhile","if","While"],Cre=["NonMaxSuppressionV2","NonMaxSuppressionV3","NonMaxSuppressionV5","Where"],Mre=["HashTable","HashTableV2","LookupTableImport","LookupTableImportV2","LookupTableFind","LookupTableFindV2","LookupTableSize","LookupTableSizeV2"];function y9(e){return Ere.indexOf(e.op)>=0}function $re(e){return Cre.indexOf(e.op)>=0}function Rre(e){return Mre.indexOf(e.op)>=0}var S5=class{constructor(e,t){this.graph=e,this.parent=t,this.compiledMap=new Map,this._weightMap={},this.SEPERATOR=",",this._functions={},this._functionExecutorMap={},this._outputs=e.outputs,this._inputs=e.inputs,this._initNodes=e.initNodes,this._signature=e.signature,this._functions=e.functions,e.functions!=null&&Object.keys(e.functions).forEach(n=>{this._functionExecutorMap[n]=new S5(e.functions[n],this)})}get weightIds(){return this.parent?this.parent.weightIds:this._weightIds}get functionExecutorMap(){return this.parent?this.parent.functionExecutorMap:this._functionExecutorMap}get weightMap(){return this.parent?this.parent.weightMap:this._weightMap}set weightMap(e){let t=Object.keys(e).map(n=>e[n].map(a=>a.id));this._weightIds=[].concat(...t),this._weightMap=e}set resourceManager(e){this._resourceManager=e}get inputs(){return this._inputs.map(e=>({name:e.name,shape:e.attrParams.shape?e.attrParams.shape.value:void 0,dtype:e.attrParams.dtype?e.attrParams.dtype.value:void 0}))}get outputs(){return this._outputs.map(e=>({name:e.name,shape:e.attrParams.shape?e.attrParams.shape.value:void 0,dtype:e.attrParams.dtype?e.attrParams.dtype.value:void 0}))}get inputNodes(){return this._inputs.map(e=>e.signatureKey||e.name)}get outputNodes(){return this._outputs.map(e=>{let t=e.signatureKey||e.name;return e.defaultOutput?`${t}:${e.defaultOutput}`:t})}get functions(){return Object.keys(this._functions).reduce((e,t)=>(e[t]=this._functions[t].signature,e),{})}getCompilationKey(e,t){let n=e.map(r=>r.name).sort(),a=t.map(r=>r.name).sort();return n.join(this.SEPERATOR)+"--"+a.join(this.SEPERATOR)}compile(e,t){let n=g9(e,t,this.weightMap,this._initNodes),{missingInputs:a,dynamicNode:r,syncInputs:s}=n;if(r!=null)throw new Error(`This execution contains the node '${r.name}', which has the dynamic op '${r.op}'. Please use model.executeAsync() instead. Alternatively, to avoid the dynamic ops, specify the inputs [${s}]`);if(a.length>0){let i=t.map(l=>l.name),o=Object.keys(e);throw new Error(`Cannot compute the outputs [${i}] from the provided inputs [${o}]. Missing the following inputs: [${a}]`)}return Tre(this.graph,this.weightMap,n)}execute(e,t){e=this.mapInputs(e);let n=Object.keys(e).sort();this.checkInputs(e),this.checkInputShapeAndType(e),t=this.mapOutputs(t),this.checkOutputs(t);let a=n.map(d=>this.graph.nodes[ha(d)[0]]),r=t.map(d=>ha(d)[0]),s=r.map(d=>this.graph.nodes[d]);s.length===0&&(s=this._outputs);let i=this.getCompilationKey(a,s),o=this.compiledMap.get(i);o==null&&(o=this.compile(e,s),this.compiledMap.set(i,o));let l={},u={};return Z(()=>{let d=new m9(this.weightMap,l,u,this.functionExecutorMap),h={...this.weightMap};Object.keys(e).forEach(m=>{let[f,g]=ha(m),y=[];y[g]=e[m],h[f]=y});let p=this.getFrozenTensorIds(h),c={};for(let m=0;mLn(m,h,d))})}getFrozenTensorIds(e){let t=[].concat.apply([],Object.keys(e).map(n=>e[n]).map(n=>n.map(a=>a.id)));return new Set(t)}checkTensorForDisposal(e,t,n,a,r,s,i){t.category==="control"||s.indexOf(e)!==-1||(n[e].forEach(o=>{o!=null&&(i[o.id]=(i[o.id]||0)+t.children.length)}),t.inputs.forEach(o=>{if(o.category!=="control"){let l=Oae(o.name,n,a);l!=null&&l.forEach(u=>{if(u&&!u.kept&&!r.has(u.id)){let d=i[u.id];d===1?(u.dispose(),delete i[u.id]):d!=null&&i[u.id]--}})}}))}async executeAsync(e,t){return this._executeAsync(e,t)}async _executeAsync(e,t,n=!1,a={},r={}){n||(e=this.mapInputs(e),this.checkInputs(e),this.checkInputShapeAndType(e),t=this.mapOutputs(t),this.checkOutputs(t));let s=new m9(this.weightMap,a,r,this.functionExecutorMap),i=await this.executeWithControlFlow(e,s,t,n),o=t.map(h=>Ln(h,i,s)),l=o.map(h=>h.id),u=Object.keys(e).map(h=>e[h].id),d=new Set([...l,...u,...this.weightIds]);return Object.keys(i).forEach(h=>{i[h].forEach(p=>{p&&!p.kept&&!p.isDisposed&&!d.has(p.id)&&p.dispose()})}),this.parent==null&&s.dispose(d),o}async executeFunctionAsync(e,t,n){let a=e.reduce((r,s,i)=>(r[this.inputs[i].name]=s,r),{});return this._executeAsync(a,this.outputNodes,!0,t,n)}async executeWithControlFlow(e,t,n,a){let r=Object.keys(e),s=r.map(A=>this.graph.nodes[ha(A)[0]]),i=n.map(A=>ha(A)[0]),o=i.map(A=>this.graph.nodes[A]);o.length===0&&(o=this._outputs);let{usedNodes:l,missingInputs:u,dynamicNode:d,syncInputs:h}=g9(e,o,this.weightMap,this._initNodes),p=[...s,...this.graph.weights,...this._initNodes||[]].map(A=>({node:A,contexts:t.currentContext})),c={...this.weightMap};Object.keys(e).forEach(A=>{let[x,v]=ha(A),b=[];b[v]=e[A],c[x]=b});let m={},f=this.getFrozenTensorIds(c),g={};for(;p.length>0;){let A=this.processStack(s,p,t,c,g,f,i,m,l);await Promise.all(A)}d==null&&!a&&console.warn("This model execution did not contain any nodes with control flow or dynamic output shapes. You can use model.execute() instead.");let y=o.filter(A=>!y9(A)&&!Ln(A.name,c,t)).map(A=>A.name);if(y.length>0){let A="";throw d!=null&&(A=`Alternatively, to avoid the dynamic ops, use model.execute() and specify the inputs [${h}]`),new Error(`Cannot compute the outputs [${y}] from the provided inputs [${r}]. Consider providing the following inputs: [${u}]. ${A}`)}return c}processStack(e,t,n,a,r,s,i,o,l){let u=[];for(;t.length>0;){let d=t.pop();n.currentContext=d.contexts;let h="";if(d.node.op==="Enter"&&N("isConstant",d.node,a,n)&&([h]=fs(d.node.name,n)),a[d.node.name]==null){let p=f9(d.node,a,n,this._resourceManager);h||([h]=fs(d.node.name,n));let c=n.currentContext;k.isPromise(p)?u.push(p.then(m=>(a[h]=m,n.currentContext=c,this.checkTensorForDisposal(h,d.node,a,n,s,i,o),this.processChildNodes(d.node,t,n,a,r,l),m))):(a[h]=p,this.checkTensorForDisposal(h,d.node,a,n,s,i,o),this.processChildNodes(d.node,t,n,a,r,l))}else this.processChildNodes(d.node,t,n,a,r,l)}return u}processChildNodes(e,t,n,a,r,s){e.children.forEach(i=>{let[o]=fs(i.name,n);r[o]||!s.has(i.name)||(i.op==="Merge"?i.inputNames.some(l=>!!Ln(l,a,n))&&(r[o]=!0,t.push({contexts:n.currentContext,node:i})):i.inputNames.every(l=>!!Ln(l,a,n))&&(r[o]=!0,t.push({contexts:n.currentContext,node:i})))})}dispose(){Object.keys(this.weightMap).forEach(e=>this.weightMap[e].forEach(t=>t.dispose()))}checkInputShapeAndType(e){Object.keys(e).forEach(t=>{let n=e[t],[a]=ha(t),r=this.graph.nodes[a];if(r.attrParams.shape&&r.attrParams.shape.value){let s=r.attrParams.shape.value,i=s.length===n.shape.length&&n.shape.every((o,l)=>s[l]===-1||s[l]===o);k.assert(i,()=>`The shape of dict['${r.name}'] provided in model.execute(dict) must be [${s}], but was [${n.shape}]`)}r.attrParams.dtype&&r.attrParams.dtype.value&&k.assert(n.dtype===r.attrParams.dtype.value,()=>`The dtype of dict['${r.name}'] provided in model.execute(dict) must be ${r.attrParams.dtype.value}, but was ${n.dtype}`)})}mapInputs(e){let t={};for(let n in e)if(this._signature!=null&&this._signature.inputs!=null&&this._signature.inputs[n]!=null){let a=this._signature.inputs[n];t[a.name]=e[n]}else t[n]=e[n];return t}checkInputs(e){let t=Object.keys(e).filter(n=>{let[a]=ha(n);return this.graph.nodes[a]==null});if(t.length>0)throw new Error(`The dict provided in model.execute(dict) has keys: [${t}] that are not part of graph`)}mapOutputs(e){return e.map(t=>this._signature!=null&&this._signature.outputs!=null&&this._signature.outputs[t]!=null?this._signature.outputs[t].name:t,{})}checkOutputs(e){e.forEach(t=>{let[n]=ha(t);if(!this.graph.nodes[n])throw new Error(`The output '${t}' is not found in the graph`)})}},Fre=class{constructor(e={},t={}){this.hashTableNameToHandle=e,this.hashTableMap=t}addHashTable(e,t){this.hashTableNameToHandle[e]=t.handle,this.hashTableMap[t.id]=t}getHashTableHandleByName(e){return this.hashTableNameToHandle[e]}getHashTableById(e){return this.hashTableMap[e]}dispose(){for(let e in this.hashTableMap)this.hashTableMap[e].clearAndClose(),delete this.hashTableMap[e];for(let e in this.hashTableNameToHandle)this.hashTableNameToHandle[e].dispose(),delete this.hashTableNameToHandle[e]}},Ore="?tfjs-format=file",Dre="model.json",A9=class{constructor(e,t={}){this.modelUrl=e,this.loadOptions=t,this.version="n/a",t==null&&(this.loadOptions={}),this.resourceManager=new Fre}get modelVersion(){return this.version}get inputNodes(){return this.executor.inputNodes}get outputNodes(){return this.executor.outputNodes}get inputs(){return this.executor.inputs}get outputs(){return this.executor.outputs}get weights(){return this.executor.weightMap}get metadata(){return this.artifacts.userDefinedMetadata}get modelSignature(){return this.signature}findIOHandler(){let e=this.modelUrl;if(e.load!=null)this.handler=e;else if(this.loadOptions.requestInit!=null)this.handler=la.browserHTTPRequest(e,this.loadOptions);else{let t=la.getLoadHandlers(e,this.loadOptions);if(t.length===0)t.push(la.browserHTTPRequest(e,this.loadOptions));else if(t.length>1)throw new Error(`Found more than one (${t.length}) load handlers for URL '${[e]}'`);this.handler=t[0]}}async load(){if(this.findIOHandler(),this.handler.load==null)throw new Error("Cannot proceed with model loading because the IOHandler provided does not have the `load` method implemented.");let e=await this.handler.load();return this.loadSync(e)}loadSync(e){this.artifacts=e;let t=this.artifacts.modelTopology,n;this.artifacts.userDefinedMetadata!=null&&this.artifacts.userDefinedMetadata.signature!=null?n=this.artifacts.userDefinedMetadata.signature:n=this.artifacts.signature,this.signature=n,this.version=`${t.versions.producer}.${t.versions.minConsumer}`;let a=la.decodeWeights(this.artifacts.weightData,this.artifacts.weightSpecs);if(this.executor=new S5(l9.Instance.transformGraph(t,this.signature)),this.executor.weightMap=this.convertTensorMapToTensorsMap(a),this.executor.resourceManager=this.resourceManager,e.modelInitializer!=null&&e.modelInitializer.node!=null){let r=l9.Instance.transformGraph(e.modelInitializer);this.initializer=new S5(r),this.initializer.weightMap=this.executor.weightMap,this.initializer.resourceManager=this.resourceManager,this.initializer.executeAsync({},[])}return!0}async save(e,t){if(typeof e=="string"){let n=la.getSaveHandlers(e);if(n.length===0)throw new Error(`Cannot find any save handlers for URL '${e}'`);if(n.length>1)throw new Error(`Found more than one (${n.length}) save handlers for URL '${e}'`);e=n[0]}if(e.save==null)throw new Error("GraphModel.save() cannot proceed because the IOHandler provided does not have the `save` attribute defined.");return e.save(this.artifacts)}predict(e,t){return this.execute(e,this.outputNodes)}normalizeInputs(e){if(!(e instanceof Tt)&&!Array.isArray(e))return e;if(e=Array.isArray(e)?e:[e],e.length!==this.inputNodes.length)throw new Error(`Input tensor count mismatch,the graph model has ${this.inputNodes.length} placeholders, while there are ${e.length} input tensors.`);return this.inputNodes.reduce((t,n,a)=>(t[n]=e[a],t),{})}normalizeOutputs(e){return e=e||this.outputNodes,Array.isArray(e)?e:[e]}execute(e,t){e=this.normalizeInputs(e),t=this.normalizeOutputs(t);let n=this.executor.execute(e,t);return n.length>1?n:n[0]}async executeAsync(e,t){e=this.normalizeInputs(e),t=this.normalizeOutputs(t);let n=await this.executor.executeAsync(e,t);return n.length>1?n:n[0]}convertTensorMapToTensorsMap(e){return Object.keys(e).reduce((t,n)=>(t[n]=[e[n]],t),{})}dispose(){this.executor.dispose(),this.initializer&&this.initializer.dispose(),this.resourceManager.dispose()}};async function Et(e,t={}){if(e==null)throw new Error("modelUrl in loadGraphModel() cannot be null. Please provide a url or an IOHandler that loads the model");t==null&&(t={}),t.fromTFHub&&e.load==null&&(e.endsWith("/")||(e=e+"/"),e=`${e}${Dre}${Ore}`);let n=new A9(e,t);return await n.load(),n}var _re="3.7.0",x9={};$e(x9,{CSVDataset:()=>F9,Dataset:()=>uu,FileDataSource:()=>W9,TextLineDataset:()=>M9,URLDataSource:()=>B9,array:()=>sse,csv:()=>gse,func:()=>yse,generator:()=>Ase,microphone:()=>bse,version_data:()=>vse,webcam:()=>xse,zip:()=>ise});var zre=qr(P3()),Pre=qr(P3());function Lre(e,t){return S0(e,t)}function S0(e,t,n=new Map,a=new Set){if(e==null)return null;if(a.has(e))throw new Error("Circular references are not supported.");if(n.has(e))return n.get(e);let r=t(e);if(r.recurse&&r.value!==null)throw new Error("A deep map function may not return both a value and recurse=true.");if(r.recurse)if(lu(e)){let s=Array.isArray(e)?[]:{};a.add(e);for(let i in e){let o=e[i],l=S0(o,t,n,a);s[i]=l}return a.delete(e),s}else throw new Error(`Can't recurse into non-iterable type: ${e}`);else return n.set(e,r.value),r.value}function Wre(e,t=v9){return b9(e,t)}function b9(e,t,n=new Set){let a=e[0];if(n.has(a))throw new Error("Circular references are not supported.");let r=t(e);if(r.recurse&&r.value!==null)throw new Error("A deep zip function may not return both a value and recurse=true.");if(r.recurse)if(lu(a)){let s=Array.isArray(a)?[]:{};n.add(a);for(let i in a){let o=e.map(u=>u[i]),l=b9(o,t,n);s[i]=l}return n.delete(a),s}else throw new Error(`Can't recurse into non-iterable type: ${a}`);else return r.value}function v9(e){return e===null?null:lu(e[0])?{value:null,recurse:!0}:{value:e,recurse:!1}}async function w9(e,t){let n=new Map;S0(e,t,n);for(let a of Array.from(n.keys())){let r=n.get(a);if(k.isPromise(r)){let s=await r;n.set(a,s)}}return S0(e,t,n)}function lu(e){return e!=null&&!ArrayBuffer.isView(e)&&(Array.isArray(e)||typeof e=="object"&&!(e instanceof Tt))}function Bre(e){return e==null||Vre(e)||Array.isArray(e)||typeof e=="object"&&e instanceof Tt||k.isTypedArray(e)}function Vre(e){return e===null||typeof e!="object"&&typeof e!="function"}function Ure(e){return Lre(e,jre)}function jre(e){return e instanceof Tt?{value:e.clone(),recurse:!1}:lu(e)?{value:null,recurse:!0}:{value:e,recurse:!1}}var k9=class{constructor(e){if(this.capacity=e,this.begin=0,this.end=0,e==null)throw new RangeError("Can't create a ring buffer of unknown capacity.");if(e<1)throw new RangeError("Can't create ring buffer of capacity < 1.");this.data=new Array(e),this.doubledCapacity=2*e}wrap(e){for(;e<0;)e+=this.doubledCapacity;return e%this.doubledCapacity}get(e){if(e<0)throw new RangeError("Can't get item at a negative index.");return this.data[e%this.capacity]}set(e,t){if(e<0)throw new RangeError("Can't set item at a negative index.");this.data[e%this.capacity]=t}length(){let e=this.end-this.begin;return e<0&&(e=this.doubledCapacity+e),e}isFull(){return this.length()===this.capacity}isEmpty(){return this.length()===0}push(e){if(this.isFull())throw new RangeError("Ring buffer is full.");this.set(this.end,e),this.end=this.wrap(this.end+1)}pushAll(e){for(let t of e)this.push(t)}pop(){if(this.isEmpty())throw new RangeError("Ring buffer is empty.");this.end=this.wrap(this.end-1);let e=this.get(this.end);return this.set(this.end,void 0),e}unshift(e){if(this.isFull())throw new RangeError("Ring buffer is full.");this.begin=this.wrap(this.begin-1),this.set(this.begin,e)}shift(){if(this.isEmpty())throw new RangeError("Ring buffer is empty.");let e=this.get(this.begin);return this.set(this.begin,void 0),this.begin=this.wrap(this.begin+1),e}shuffleExcise(e){if(this.isEmpty())throw new RangeError("Ring buffer is empty.");let t=this.wrap(this.begin+e),n=this.get(t);return this.set(t,this.pop()),n}},I9=class extends k9{constructor(){super(I9.INITIAL_CAPACITY)}isFull(){return!1}push(e){super.isFull()&&this.expand(),super.push(e)}unshift(e){super.isFull()&&this.expand(),super.unshift(e)}expand(){let e=this.capacity*2,t=new Array(e),n=this.length();for(let a=0;at===!0)}rowMajorBatch(e,t=!0){return new Jre(this,e,t)}columnMajorBatch(e,t=!0,n=v9){return this.rowMajorBatch(e,t).map(a=>Wre(a,n))}concatenate(e,t){return new E9(N9([this,e]),t)}take(e){return e<0||e==null?this:new Yre(this,e)}skip(e){return e<0||e==null?this:new Zre(this,e)}prefetch(e){return new C9(this,e)}shuffle(e,t){return new rse(this,e,t)}serial(){return new Xre(this)}},qre=class extends xn{constructor(e){super();this.items=e,this.trav=0}summary(){return`Array of ${this.items.length} items`}async next(){if(this.trav>=this.items.length)return{value:null,done:!0};let e=this.items[this.trav];return this.trav++,{value:Ure(e),done:!1}}},Kre=class extends xn{constructor(e){super();this.nextFn=e}summary(){return"Function call"}async next(){try{return this.nextFn()}catch(e){throw e.message=`Error thrown while iterating through a dataset: ${e.message}`,e}}},Xre=class extends xn{constructor(e){super();this.upstream=e,this.lastRead=Promise.resolve({value:null,done:!1})}summary(){return`${this.upstream.summary()} -> Serial`}async next(){return this.lastRead=this.lastRead.then(()=>this.serialNext()),this.lastRead}async serialNext(){return this.upstream.next()}},Zre=class extends xn{constructor(e,t){super();this.upstream=e,this.maxCount=t,this.count=0,this.lastRead=Promise.resolve({value:null,done:!1})}summary(){return`${this.upstream.summary()} -> Skip`}async next(){return this.lastRead=this.lastRead.then(()=>this.serialNext()),this.lastRead}async serialNext(){for(;this.count++ Take`}async next(){return this.count++>=this.maxCount?{value:null,done:!0}:this.upstream.next()}},Jre=class extends xn{constructor(e,t,n=!0){super();this.upstream=e,this.batchSize=t,this.enableSmallLastBatch=n,this.lastRead=Promise.resolve({value:null,done:!1})}summary(){return`${this.upstream.summary()} -> RowMajorBatch`}async next(){return this.lastRead=this.lastRead.then(()=>this.serialNext()),this.lastRead}async serialNext(){let e=[];for(;e.length0?{value:e,done:!1}:{value:null,done:!0};e.push(t.value)}return{value:e,done:!1}}},Qre=class extends xn{constructor(e,t){super();this.upstream=e,this.predicate=t,this.lastRead=Promise.resolve({value:null,done:!1})}summary(){return`${this.upstream.summary()} -> Filter`}async next(){return this.lastRead=this.lastRead.then(()=>this.serialNext()),this.lastRead}async serialNext(){for(;;){let e=await this.upstream.next();if(e.done||this.predicate(e.value))return e;Ge(e.value)}}},ese=class extends xn{constructor(e,t){super();this.upstream=e,this.transform=t}summary(){return`${this.upstream.summary()} -> Map`}async next(){let e=await this.upstream.next();if(e.done)return{value:null,done:!0};let t=Er.getTensorsInContainer(e.value),n=this.transform(e.value),a=Er.getTensorsInContainer(n);for(let r of t)Er.isTensorInList(r,a)||r.dispose();return{value:n,done:!1}}},tse=class extends xn{constructor(e,t){super();this.upstream=e,this.handler=t,this.count=0,this.lastRead=Promise.resolve({value:null,done:!1})}summary(){return`${this.upstream.summary()} -> handleErrors`}async next(){return this.lastRead=this.lastRead.then(()=>this.serialNext()),this.lastRead}async serialNext(){for(;;)try{return await this.upstream.next()}catch(e){if(!this.handler(e))return{value:null,done:!0}}}},T9=class extends xn{constructor(e,t){super();this.upstream=e,this.transform=t}summary(){return`${this.upstream.summary()} -> AsyncMap`}async next(){let e=await this.upstream.next();if(e.done)return{value:null,done:!0};let t=Er.getTensorsInContainer(e.value),n=await this.transform(e.value),a=Er.getTensorsInContainer(n);for(let r of t)Er.isTensorInList(r,a)||r.dispose();return{value:n,done:!1}}},T5=class extends xn{constructor(){super();this.outputQueue=new S9,this.lastRead=Promise.resolve({value:null,done:!1})}async next(){return this.lastRead=this.lastRead.then(()=>this.serialNext()),this.lastRead}async serialNext(){for(;this.outputQueue.length()===0;)if(!await this.pump())return{value:null,done:!0};return{value:this.outputQueue.shift(),done:!1}}},nse=class extends T5{constructor(e,t){super();this.upstream=e,this.transform=t}summary(){return`${this.upstream.summary()} -> Flatmap`}async pump(){let e=await this.upstream.next();if(e.done)return!1;let t=Er.getTensorsInContainer(e.value),n=this.transform(e.value),a=Er.getTensorsInContainer(n);this.outputQueue.pushAll(n);for(let r of t)Er.isTensorInList(r,a)||r.dispose();return!0}},E9=class extends xn{constructor(e,t){super();this.baseErrorHandler=t,this.lastRead=null,this.iterator=null,this.moreIterators=e}summary(){return"TODO: fill in upstream of chained summaries -> Chained"}async next(){return this.lastRead=this.readFromChain(this.lastRead),this.lastRead}async readFromChain(e){if(await e,this.iterator==null){let n=await this.moreIterators.next();if(n.done)return{value:null,done:!0};this.iterator=n.value,this.baseErrorHandler!=null&&(this.iterator=this.iterator.handleErrors(this.baseErrorHandler))}let t=await this.iterator.next();return t.done?(this.iterator=null,this.readFromChain(e)):t}},N0;(function(e){e[e.FAIL=0]="FAIL",e[e.SHORTEST=1]="SHORTEST",e[e.LONGEST=2]="LONGEST"})(N0||(N0={}));var ase=class extends xn{constructor(e,t=0){super();this.iterators=e,this.mismatchMode=t,this.count=0,this.currentPromise=null}summary(){return"{TODO: fill in upstream of zip summaries} -> Zip"}async nextState(e){await e;let t=0,n=0;function a(s){return s instanceof xn?{value:s.next().then(i=>(t++,i.done&&n++,i.value)),recurse:!1}:{value:null,recurse:!0}}let r=await w9(this.iterators,a);if(t===n)return{value:null,done:!0};if(n>0)switch(this.mismatchMode){case 0:throw new Error(`Zipped streams should have the same length. Mismatched at element ${this.count}.`);case 1:return{value:null,done:!0};case 2:default:}return this.count++,{value:r,done:!1}}async next(){return this.currentPromise=this.nextState(this.currentPromise),this.currentPromise}},C9=class extends xn{constructor(e,t){super();this.upstream=e,this.bufferSize=t,this.buffer=new k9(t)}summary(){return`${this.upstream.summary()} -> Prefetch`}refill(){for(;!this.buffer.isFull();){let e=this.upstream.next();this.buffer.push(e)}}next(){return this.refill(),this.buffer.shift()}},rse=class extends C9{constructor(e,t,n){super(e,t);this.upstream=e,this.windowSize=t,this.upstreamExhausted=!1,this.random=Pre.alea(n||k.now().toString()),this.lastRead=Promise.resolve({value:null,done:!1})}async next(){return this.lastRead=this.lastRead.then(()=>this.serialNext()),this.lastRead}randomInt(e){return Math.floor(this.random()*e)}chooseIndex(){return this.randomInt(this.buffer.length())}async serialNext(){for(this.upstreamExhausted||this.refill();!this.buffer.isEmpty();){let e=this.chooseIndex(),t=await this.buffer.shuffleExcise(e);if(t.done)this.upstreamExhausted=!0;else return this.refill(),t}return{value:null,done:!0}}},uu=class{constructor(){this.size=null}batch(e,t=!0){let n=this;k.assert(e>0,()=>`batchSize needs to be positive, but it is - ${e}`);let a;return this.size===Infinity||this.size==null?a=this.size:t?a=Math.ceil(this.size/e):a=Math.floor(this.size/e),pa(async()=>(await n.iterator()).columnMajorBatch(e,t,ose),a)}concatenate(e){let t=this,n;return this.size===Infinity||e.size===Infinity?n=Infinity:this.size!=null&&e.size!=null?n=this.size+e.size:n=null,pa(async()=>(await t.iterator()).concatenate(await e.iterator()),n)}filter(e){let t=this,n;return this.size===Infinity?n=Infinity:n=null,pa(async()=>(await t.iterator()).filter(a=>Z(()=>e(a))),n)}async forEachAsync(e){return(await this.iterator()).forEachAsync(e)}map(e){let t=this;return pa(async()=>(await t.iterator()).map(n=>Z(()=>e(n))),this.size)}mapAsync(e){let t=this;return pa(async()=>(await t.iterator()).mapAsync(e),this.size)}prefetch(e){if(e==null)throw new RangeError("`Dataset.prefetch()` requires bufferSize to be specified.");let t=this;return pa(async()=>(await t.iterator()).prefetch(e),this.size)}repeat(e){let t=this,n;return this.size!=null&&e>0?n=this.size*e:e===0?n=0:this.size!=null&&(e===void 0||e<0)?n=Infinity:n=null,pa(async()=>{let a=N5(async()=>({value:await t.iterator(),done:!1}));return Hre(a.take(e))},n)}skip(e){let t=this,n;return this.size!=null&&e>=0&&this.size>=e?n=this.size-e:this.size!=null&&(this.size(await t.iterator()).skip(e),n)}shuffle(e,t,n=!0){if(e==null||e<0)throw this.size==null?new RangeError("`Dataset.shuffle()` requires bufferSize to be specified."):new RangeError(`\`Dataset.shuffle()\` requires bufferSize to be specified. If your data fits in main memory (for regular JS objects), and/or GPU memory (for \`tf.Tensor\`s), consider setting bufferSize to the dataset size (${this.size} elements)`);let a=this,r=zre.alea(t||k.now().toString());return pa(async()=>{let s=r.int32();return n&&(s+=r.int32()),(await a.iterator()).shuffle(e,s.toString())},this.size)}take(e){let t=this,n;return this.size!=null&&this.size>e?n=e:this.size!=null&&this.size<=e?n=this.size:n=null,pa(async()=>(await t.iterator()).take(e),n)}async toArray(){if(this.size===Infinity)throw new Error("Can not convert infinite data stream to array.");return(await this.iterator()).toArray()}async toArrayForTest(){if(this.size===Infinity)throw new Error("Can not convert infinite data stream to array.");return(await this.iterator()).toArrayForTest()}};uu.MAX_BUFFER_SIZE=1e4;function pa(e,t=null){return new class extends uu{constructor(){super(...arguments);this.size=t}async iterator(){return e()}}}function sse(e){return pa(async()=>N9(e),e.length)}function ise(e){if(!lu(e))throw new Error("The argument to zip() must be an object or array.");let t;if(Array.isArray(e))for(let n=0;n{let n=await w9(e,a=>{if(a instanceof uu)return{value:a.iterator(),recurse:!1};if(lu(a))return{value:null,recurse:!0};throw new Error("Leaves of the structure passed to zip() must be Datasets, not primitives.")});return Gre(n,N0.SHORTEST)},t)}function ose(e){if(e===null)return null;let t=e[0];return Bre(t)?{value:lse(e),recurse:!1}:{value:null,recurse:!0}}function lse(e){if(e.length===0)throw new Error("Can't make a batch of zero elements.");return e[0]instanceof Tt?Fa(e):Cr(e)}var M9=class extends uu{constructor(e){super();this.input=e}async iterator(){return(await this.input.iterator()).decodeUTF8().split(` -`).map(e=>(e.endsWith("\r")&&(e=e.slice(0,-1)),e))}},T0='"',ep=Symbol("out"),$9=Symbol("field"),E0=Symbol("quote"),E5=Symbol("quoteafterquote"),R9=Symbol("quoteinquote"),F9=class extends uu{constructor(e,t){super();this.input=e,this.hasHeader=!0,this.fullColumnNames=null,this.columnNamesValidated=!1,this.columnConfigs=null,this.configuredColumnsOnly=!1,this.delimiter=",",this.delimWhitespace=!1,this.base=new M9(e),t||(t={}),this.hasHeader=t.hasHeader!==!1,this.fullColumnNames=t.columnNames,this.columnConfigs=t.columnConfigs,this.configuredColumnsOnly=t.configuredColumnsOnly,t.delimWhitespace?(k.assert(t.delimiter==null,()=>"Delimiter should not be provided when delimWhitespace is true."),this.delimWhitespace=!0,this.delimiter=" "):this.delimiter=t.delimiter?t.delimiter:","}async columnNames(){return this.columnNamesValidated||await this.setColumnNames(),this.configuredColumnsOnly?Object.keys(this.columnConfigs):this.fullColumnNames}async setColumnNames(){let e=await this.maybeReadHeaderLine();if(!this.fullColumnNames&&!e)throw new Error("Column names must be provided if there is no header line.");this.fullColumnNames&&e&&k.assert(e.length===this.fullColumnNames.length,()=>"The length of provided columnNames ("+this.fullColumnNames.length.toString()+") does not match the length of the header line read from file ("+e.length.toString()+")."),this.fullColumnNames||(this.fullColumnNames=e);let t=this.fullColumnNames.reduce((a,r)=>(a[r]=a[r]+1||1,a),{}),n=Object.keys(t).filter(a=>t[a]>1);if(k.assert(n.length===0,()=>"Duplicate column names found: "+n.toString()),this.columnConfigs){for(let a of Object.keys(this.columnConfigs))if(this.fullColumnNames.indexOf(a)===-1)throw new Error('The key "'+a+'" provided in columnConfigs does not match any of the column names ('+this.fullColumnNames.toString()+").")}this.columnNamesValidated=!0}async maybeReadHeaderLine(){if(this.hasHeader){let e=await(await this.base.iterator()).next();if(e.done)throw new Error("No data was found for CSV parsing.");let t=e.value;return this.parseRow(t,!1)}else return null}async iterator(){this.columnNamesValidated||await this.setColumnNames();let e=await this.base.iterator();return this.hasHeader&&(e=e.skip(1)),e.map(t=>this.makeDataElement(t))}makeDataElement(e){let t=this.parseRow(e),n={},a={};for(let r=0;r14||!Number.isInteger(t))throw new Error(`Invalid fftSize: it must be a power of 2 between 2 to 4 and 2 to 14, but got ${this.fftSize}`);if(this.numFrames=e.numFramesPerSpectrogram||43,this.sampleRateHz=e.sampleRateHz,this.columnTruncateLength=e.columnTruncateLength||this.fftSize,this.audioTrackConstraints=e.audioTrackConstraints,this.smoothingTimeConstant=e.smoothingTimeConstant||0,this.includeSpectrogram=e.includeSpectrogram!==!1,this.includeWaveform=e.includeWaveform===!0,!this.includeSpectrogram&&!this.includeWaveform)throw new Error("Both includeSpectrogram and includeWaveform are false. At least one type of data should be returned.")}summary(){return"microphone"}static async create(e={}){if(se().get("IS_NODE"))throw new Error("microphone API is only supported in browser environment.");let t=new O9(e);return await t.start(),t}async start(){try{this.stream=await navigator.mediaDevices.getUserMedia({audio:this.audioTrackConstraints==null?!0:this.audioTrackConstraints,video:!1})}catch(n){throw new Error(`Error thrown while initializing video stream: ${n.message}`)}if(!this.stream)throw new Error("Could not obtain audio from microphone.");let e=window.AudioContext||window.webkitAudioContext;if(this.audioContext=new e,!this.sampleRateHz)this.sampleRateHz=this.audioContext.sampleRate;else if(this.audioContext.sampleRate!==this.sampleRateHz)throw new Error(`Mismatch in sampling rate: Expected: ${this.sampleRateHz}; Actual: ${this.audioContext.sampleRate}`);let t=this.audioContext.createMediaStreamSource(this.stream);this.analyser=this.audioContext.createAnalyser(),this.analyser.fftSize=this.fftSize*2,this.analyser.smoothingTimeConstant=this.smoothingTimeConstant,t.connect(this.analyser),this.freqData=new Float32Array(this.fftSize),this.timeData=new Float32Array(this.fftSize)}async next(){if(this.isClosed)return{value:null,done:!0};let e,t,n=await this.getAudioData();if(this.includeSpectrogram){let a=this.flattenQueue(n.freqDataQueue);e=this.getTensorFromAudioDataArray(a,[this.numFrames,this.columnTruncateLength,1])}if(this.includeWaveform){let a=this.flattenQueue(n.timeDataQueue);t=this.getTensorFromAudioDataArray(a,[this.numFrames*this.fftSize,1])}return{value:{spectrogram:e,waveform:t},done:!1}}async capture(){return(await this.next()).value}async getAudioData(){let e=[],t=[],n=0;return new Promise(a=>{let r=setInterval(()=>{this.includeSpectrogram&&(this.analyser.getFloatFrequencyData(this.freqData),this.freqData[0]===-Infinity&&a({freqDataQueue:e,timeDataQueue:t}),e.push(this.freqData.slice(0,this.columnTruncateLength))),this.includeWaveform&&(this.analyser.getFloatTimeDomainData(this.timeData),t.push(this.timeData.slice())),++n===this.numFrames&&(clearInterval(r),a({freqDataQueue:e,timeDataQueue:t}))},this.fftSize/this.sampleRateHz*1e3)})}stop(){this.isClosed||(this.isClosed=!0,this.analyser.disconnect(),this.audioContext.close(),this.stream!=null&&this.stream.getTracks().length>0&&this.stream.getTracks()[0].stop())}toArray(){throw new Error("Can not convert infinite audio stream to array.")}getSampleRate(){return this.sampleRateHz}flattenQueue(e){let t=e[0].length,n=new Float32Array(e.length*t);return e.forEach((a,r)=>n.set(a,r*t)),n}getTensorFromAudioDataArray(e,t){let n=new Float32Array(k.sizeFromShape(t));return n.set(e,n.length-e.length),Cr(n,t)}},D9=class extends xn{constructor(e,t){super();if(this.webcamVideoElement=e,this.webcamConfig=t,this.isClosed=!0,this.resize=!1,this.needToResize())if(this.resize=!0,this.cropSize=[this.webcamConfig.resizeHeight,this.webcamConfig.resizeWidth],this.cropBoxInd=$n([0],"int32"),this.webcamConfig.centerCrop){let n=this.webcamConfig.resizeWidth*1/this.webcamVideoElement.width,a=this.webcamConfig.resizeHeight*1/this.webcamVideoElement.height,r=(1-n)/2,s=(1-a)/2,i=r+n,o=a+s;this.cropBox=Ql([s,r,o,i],[1,4])}else this.cropBox=Ql([0,0,1,1],[1,4])}summary(){return"webcam"}static async create(e,t={}){if(se().get("IS_NODE"))throw new Error("tf.data.webcam is only supported in browser environment.");if(!e){if(e=document.createElement("video"),!t.resizeWidth||!t.resizeHeight)throw new Error("Please provide webcam video element, or resizeWidth and resizeHeight to create a hidden video element.");e.width=t.resizeWidth,e.height=t.resizeHeight}let n=new D9(e,t);return await n.start(),n}async start(){this.webcamConfig.facingMode&&k.assert(this.webcamConfig.facingMode==="user"||this.webcamConfig.facingMode==="environment",()=>`Invalid webcam facing mode: ${this.webcamConfig.facingMode}. Please provide 'user' or 'environment'`);try{this.stream=await navigator.mediaDevices.getUserMedia({video:{deviceId:this.webcamConfig.deviceId,facingMode:this.webcamConfig.facingMode?this.webcamConfig.facingMode:"user",width:this.webcamVideoElement.width,height:this.webcamVideoElement.height}})}catch(e){throw e.message=`Error thrown while initializing video stream: ${e.message}`,e}if(!this.stream)throw new Error("Could not obtain video from webcam.");try{this.webcamVideoElement.srcObject=this.stream}catch(e){console.log(e),this.webcamVideoElement.src=window.URL.createObjectURL(this.stream)}return this.webcamVideoElement.play(),this.isClosed=!1,new Promise(e=>{this.webcamVideoElement.onloadedmetadata=()=>{e()}})}async next(){if(this.isClosed)return{value:null,done:!0};let e;try{e=k4.fromPixels(this.webcamVideoElement)}catch(t){throw new Error(`Error thrown converting video to pixels: ${JSON.stringify(t)}`)}if(this.resize)try{return{value:this.cropAndResizeFrame(e),done:!1}}catch(t){throw new Error(`Error thrown cropping the video: ${t.message}`)}finally{e.dispose()}else return{value:e,done:!1}}needToResize(){return!!(this.webcamConfig.resizeWidth&&this.webcamConfig.resizeHeight&&(this.webcamVideoElement.width!==this.webcamConfig.resizeWidth||this.webcamVideoElement.height!==this.webcamConfig.resizeHeight))}cropAndResizeFrame(e){return Z(()=>{let t=Ea(we(e,"float32"),0),n;n=to.cropAndResize(t,this.cropBox,this.cropBoxInd,this.cropSize,"bilinear");let a=n.shape;return Y(n,a.slice(1))})}async capture(){return(await this.next()).value}stop(){this.stream.getTracks().forEach(e=>e.stop());try{this.webcamVideoElement.srcObject=null}catch(e){console.log(e),this.webcamVideoElement.src=null}this.isClosed=!0}toArray(){throw new Error("Can not convert infinite video stream to array.")}},_9=class{},z9=class extends xn{split(e){return new use(this,e)}},use=class extends z9{constructor(e,t){super();this.upstream=e,this.impl=new dse(e,t)}summary(){return this.impl.summary()}async next(){return this.impl.next()}},dse=class extends T5{constructor(e,t){super();this.upstream=e,this.separator=t,this.carryover=""}summary(){return`${this.upstream.summary()} -> Split('${this.separator}')`}async pump(){let e=await this.upstream.next();if(e.done)return this.carryover===""?!1:(this.outputQueue.push(this.carryover),this.carryover="",!0);let t=e.value.split(this.separator);t[0]=this.carryover+t[0];for(let n of t.slice(0,-1))this.outputQueue.push(n);return this.carryover=t[t.length-1],!0}},hse=class extends xn{decodeUTF8(){return new pse(this)}},pse=class extends z9{constructor(e){super();this.upstream=e,this.impl=new cse(e)}summary(){return this.impl.summary()}async next(){return this.impl.next()}},cse=class extends T5{constructor(e){super();if(this.upstream=e,se().get("IS_BROWSER"))this.decoder=new TextDecoder("utf-8");else{let{StringDecoder:t}=vR();this.decoder=new t("utf8")}}summary(){return`${this.upstream.summary()} -> Utf8`}async pump(){let e=await this.upstream.next(),t;if(e.done)return!1;t=e.value;let n;return se().get("IS_BROWSER")?n=this.decoder.decode(t,{stream:!0}):n=this.decoder.write(Buffer.from(t.buffer)),this.outputQueue.push(n),!0}},P9=class extends hse{constructor(e,t={}){super();this.file=e,this.options=t,k.assert(e instanceof Uint8Array||(se().get("IS_BROWSER")?e instanceof File||e instanceof Blob:!1),()=>"FileChunkIterator only supports File, Blob and Uint8Array right now."),this.offset=t.offset||0,this.chunkSize=t.chunkSize||1024*1024}summary(){return`FileChunks ${this.file}`}async next(){return this.offset>=(this.file instanceof Uint8Array?this.file.byteLength:this.file.size)?{value:null,done:!0}:{value:await new Promise((e,t)=>{let n=this.offset+this.chunkSize;if(this.file instanceof Uint8Array)e(new Uint8Array(this.file.slice(this.offset,n)));else{let a=new FileReader;a.onload=s=>{let i=a.result;if(i instanceof ArrayBuffer&&(i=new Uint8Array(i)),!(i instanceof Uint8Array))return t(new TypeError("FileReader returned unknown type."));e(i)},a.onabort=s=>t(new Error("Aborted")),a.onerror=s=>t(new Error(s.type));let r=this.file.slice(this.offset,n);a.readAsArrayBuffer(r)}this.offset=n}),done:!1}}};async function fse(e,t={}){let n,a;typeof e=="string"?n=e:(n=e.url,a=mse(e));let r=await k.fetch(n,a);if(r.ok){let s=new Uint8Array(await r.arrayBuffer());return new P9(s,t)}else throw new Error(r.statusText)}var mse=e=>({method:e.method,headers:e.headers,body:e.body,mode:e.mode,credentials:e.credentials,cache:e.cache,redirect:e.redirect,referrer:e.referrer,integrity:e.integrity});function L9(e){return typeof e=="string"&&e.substr(0,7)==="file://"}var W9=class extends _9{constructor(e,t={}){super();this.input=e,this.options=t}async iterator(){if(L9(this.input)&&se().get("IS_NODE")){let e=di("fs");this.input=e.readFileSync(this.input.substr(7))}return new P9(this.input,this.options)}},B9=class extends _9{constructor(e,t={}){super();this.url=e,this.fileOptions=t}async iterator(){return L9(this.url)?new W9(this.url,this.fileOptions).iterator():fse(this.url,this.fileOptions)}};function gse(e,t={}){return new F9(new B9(e),t)}function yse(e){let t=N5(e);return pa(async()=>t)}function Ase(e){return pa(async()=>{let t=await e();return N5(()=>t.next())})}async function xse(e,t){return D9.create(e,t)}async function bse(e){return O9.create(e)}var vse="3.7.0";function Se(e,t){Array.isArray(e)||(e=[e]),e.forEach(n=>{n!=null&&k.assert(n.dtype!=="complex64",()=>`${t} does not support complex64 tensors in the CPU backend.`)})}var wse=us.whereImpl,V9=class extends Wc{constructor(){super();this.blockSize=48,this.firstUse=!0,this.data=new c1(this,Ps())}nextDataId(){return V9.nextDataId++}write(e,t,n){this.firstUse&&(this.firstUse=!1,se().get("IS_NODE")&&M.warn(` + ${r}, and tensor's shape is: ${e.shape}`);let a=e.shape.slice(1),o=I5(a,n),i=r===0?0:e.size/r,l=Z(()=>{let c=[];e=J(e,[1,r,i]);for(let d=0;d{switch(e.op){case"If":case"StatelessIf":{let r=S("thenBranch",e,t,n),s=S("elseBranch",e,t,n),a=S("cond",e,t,n),o=S("args",e,t,n);return(await a.data())[0]?n.functionMap[r].executeFunctionAsync(o,n.tensorArrayMap,n.tensorListMap):n.functionMap[s].executeFunctionAsync(o,n.tensorArrayMap,n.tensorListMap)}case"While":case"StatelessWhile":{let r=S("body",e,t,n),s=S("cond",e,t,n),a=S("args",e,t,n),o=await n.functionMap[s].executeFunctionAsync(a,n.tensorArrayMap,n.tensorListMap),i=a.map(c=>c.id),l=await o[0].data();o.forEach(c=>{!c.kept&&i.indexOf(c.id)===-1&&c.dispose()});let u=a;for(;l[0];){let c=u;u=await n.functionMap[r].executeFunctionAsync(u,n.tensorArrayMap,n.tensorListMap);let d=u.map(p=>p.id);c.forEach(p=>{!p.kept&&i.indexOf(p.id)===-1&&d.indexOf(p.id)===-1&&p.dispose()});let h=await n.functionMap[s].executeFunctionAsync(u,n.tensorArrayMap,n.tensorListMap);l=await h[0].data(),h.forEach(p=>{!p.kept&&i.indexOf(p.id)===-1&&d.indexOf(p.id)===-1&&p.dispose()})}return u}case"LoopCond":{let r=S("pred",e,t,n);return[ga(r)]}case"Switch":{let r=S("pred",e,t,n),s=S("data",e,t,n);return s.kept||(s=ga(s)),(await r.data())[0]?[void 0,s]:[s,void 0]}case"Merge":{let r=e.inputNames.find(s=>Bn(s,t,n)!==void 0);if(r){let s=Bn(r,t,n);return[ga(s)]}return}case"Enter":{let r=S("frameName",e,t,n),s=S("tensor",e,t,n);return n.enterFrame(r),[ga(s)]}case"Exit":{let r=S("tensor",e,t,n);return n.exitFrame(),[ga(r)]}case"NextIteration":{let r=S("tensor",e,t,n);return n.nextIteration(),[ga(r)]}case"TensorArrayV3":{let r=S("size",e,t,n),s=S("dtype",e,t,n),a=S("elementShape",e,t,n),o=S("dynamicSize",e,t,n),i=S("clearAfterRead",e,t,n),l=S("identicalElementShapes",e,t,n),u=S("name",e,t,n),c=new sse(u,s,r,a,l,o,i);return n.addTensorArray(c),[c.idTensor,Fe(1)]}case"TensorArrayWriteV3":{let r=S("tensorArrayId",e,t,n),s=S("index",e,t,n),a=S("tensor",e,t,n),o=n.getTensorArray(r.id);return o.write(s,a),[o.idTensor]}case"TensorArrayReadV3":{let r=S("tensorArrayId",e,t,n),s=S("index",e,t,n);return[n.getTensorArray(r.id).read(s)]}case"TensorArrayGatherV3":{let r=S("tensorArrayId",e,t,n),s=S("indices",e,t,n),a=S("dtype",e,t,n);return[n.getTensorArray(r.id).gather(s,a)]}case"TensorArrayScatterV3":{let r=S("tensorArrayId",e,t,n),s=S("indices",e,t,n),a=S("tensor",e,t,n),o=n.getTensorArray(r.id);return o.scatter(s,a),[o.idTensor]}case"TensorArrayConcatV3":{let r=S("tensorArrayId",e,t,n),s=n.getTensorArray(r.id),a=S("dtype",e,t,n);return[s.concat(a)]}case"TensorArraySplitV3":{let r=S("tensorArrayId",e,t,n),s=S("tensor",e,t,n),a=S("lengths",e,t,n),o=n.getTensorArray(r.id);return o.split(a,s),[o.idTensor]}case"TensorArraySizeV3":{let r=S("tensorArrayId",e,t,n),s=n.getTensorArray(r.id);return[Fe(s.size(),"int32")]}case"TensorArrayCloseV3":{let r=S("tensorArrayId",e,t,n),s=n.getTensorArray(r.id);return s.clearAndClose(),[s.idTensor]}case"TensorListSetItem":{let r=S("tensorListId",e,t,n),s=S("index",e,t,n),a=S("tensor",e,t,n),o=n.getTensorList(r.id);return o.setItem(s,a),[o.idTensor]}case"TensorListGetItem":{let r=S("tensorListId",e,t,n),s=S("index",e,t,n),a=S("elementShape",e,t,n),o=S("elementDType",e,t,n);return[n.getTensorList(r.id).getItem(s,a,o)]}case"TensorListScatterV2":case"TensorListScatter":{let r=S("indices",e,t,n),s=S("tensor",e,t,n),a=S("elementShape",e,t,n),o=S("numElements",e,t,n),i=ise(s,r,a,o);return n.addTensorList(i),[i.idTensor]}case"TensorListReserve":case"EmptyTensorList":{let r=S("elementShape",e,t,n),s=S("elementDType",e,t,n),a;e.op==="TensorListReserve"?a="numElements":a="maxNumElements";let o=S(a,e,t,n),i=ose(r,s,o);return n.addTensorList(i),[i.idTensor]}case"TensorListGather":{let r=S("tensorListId",e,t,n),s=S("indices",e,t,n),a=S("elementShape",e,t,n),o=S("elementDType",e,t,n);return[n.getTensorList(r.id).gather(s,o,a)]}case"TensorListStack":{let r=S("tensorListId",e,t,n),s=S("elementShape",e,t,n),a=S("elementDType",e,t,n),o=S("numElements",e,t,n);return[n.getTensorList(r.id).stack(s,a,o)]}case"TensorListFromTensor":{let r=S("tensor",e,t,n),s=S("elementShape",e,t,n),a=S("elementDType",e,t,n),o=ase(r,s,a);return n.addTensorList(o),[o.idTensor]}case"TensorListConcat":{let r=S("tensorListId",e,t,n),s=n.getTensorList(r.id),a=S("dtype",e,t,n),o=S("elementShape",e,t,n);return[s.concat(a,o)]}case"TensorListPushBack":{let r=S("tensorListId",e,t,n),s=S("tensor",e,t,n),a=n.getTensorList(r.id);return a.pushBack(s),[a.idTensor]}case"TensorListPopBack":{let r=S("tensorListId",e,t,n),s=S("elementShape",e,t,n),a=S("elementDType",e,t,n);return[n.getTensorList(r.id).popBack(s,a)]}case"TensorListSplit":{let r=S("tensor",e,t,n),s=S("elementShape",e,t,n),a=S("lengths",e,t,n),o=lse(r,a,s);return n.addTensorList(o),[o.idTensor]}default:throw TypeError(`Node type ${e.op} is not implemented`)}};function pT(e,t,n){let[r,s]=S("fusedOps",e,t,n),a=r==="biasadd",o=!a,i=s==="prelu",l=r==="fusedbatchnorm",u=S("numArgs",e,t,n);if(a){if(i&&u!==2)throw new Error("FusedConv2d and DepthwiseConv2d with BiasAdd and Prelu must have two extra arguments: bias and alpha.");if(!i&&a&&u!==1)throw new Error("FusedConv2d and DepthwiseConv2d with BiasAdd must have one extra argument: bias.")}if(l)throw new Error("FusedConv2d and DepthwiseConv2d with FusedBatchNorm is not supported");let c=S("strides",e,t,n),d=Im(e,t,n),h=S("dataFormat",e,t,n).toUpperCase(),p=S("dilations",e,t,n),[f,m]=S("args",e,t,n);o&&(m=f,f=void 0);let g=S("leakyreluAlpha",e,t,n);return{stride:c,pad:d,dataFormat:h,dilations:p,biasArg:f,preluArg:m,activationFunc:s,leakyreluAlpha:g}}var cse=(e,t,n)=>{switch(e.op){case"Conv1D":{let r=S("stride",e,t,n),s=S("pad",e,t,n),a=S("dataFormat",e,t,n).toUpperCase(),o=S("dilation",e,t,n);return[MA(S("x",e,t,n),S("filter",e,t,n),r,s,a,o)]}case"Conv2D":{let r=S("strides",e,t,n),s=Im(e,t,n),a=S("dataFormat",e,t,n).toUpperCase(),o=S("dilations",e,t,n);return[Ba(S("x",e,t,n),S("filter",e,t,n),[r[1],r[2]],s,a,[o[1],o[2]])]}case"_FusedConv2D":{let{stride:r,pad:s,dataFormat:a,dilations:o,biasArg:i,preluArg:l,activationFunc:u,leakyreluAlpha:c}=pT(e,t,n);return[ti.conv2d({x:S("x",e,t,n),filter:S("filter",e,t,n),strides:[r[1],r[2]],pad:s,dataFormat:a,dilations:[o[1],o[2]],bias:i,activation:u,preluActivationWeights:l,leakyreluAlpha:c})]}case"FusedDepthwiseConv2dNative":{let{stride:r,pad:s,dataFormat:a,dilations:o,biasArg:i,preluArg:l,activationFunc:u,leakyreluAlpha:c}=pT(e,t,n);return[ti.depthwiseConv2d({x:S("x",e,t,n),filter:S("filter",e,t,n),strides:[r[1],r[2]],pad:s,dataFormat:a,dilations:[o[1],o[2]],bias:i,activation:u,preluActivationWeights:l,leakyreluAlpha:c})]}case"Conv2DBackpropInput":case"Conv2dTranspose":{let r=S("outputShape",e,t,n),s=S("strides",e,t,n),a=Im(e,t,n);return[PA(S("x",e,t,n),S("filter",e,t,n),r,[s[1],s[2]],a)]}case"DepthwiseConv2dNative":case"DepthwiseConv2d":{let r=S("strides",e,t,n),s=Im(e,t,n),a=S("dilations",e,t,n),o=S("dataFormat",e,t,n).toUpperCase();return[Td(S("input",e,t,n),S("filter",e,t,n),[r[1],r[2]],s,o,[a[1],a[2]])]}case"Conv3D":{let r=S("strides",e,t,n),s=S("pad",e,t,n),a=S("dataFormat",e,t,n).toUpperCase(),o=S("dilations",e,t,n);return[nI(S("x",e,t,n),S("filter",e,t,n),[r[1],r[2],r[3]],s,a,[o[1],o[2],o[3]])]}case"AvgPool":{let r=S("strides",e,t,n),s=S("pad",e,t,n),a=S("kernelSize",e,t,n);return[Sf(S("x",e,t,n),[a[1],a[2]],[r[1],r[2]],s)]}case"MaxPool":{let r=S("strides",e,t,n),s=S("pad",e,t,n),a=S("kernelSize",e,t,n);return[$f(S("x",e,t,n),[a[1],a[2]],[r[1],r[2]],s)]}case"MaxPoolWithArgmax":{let r=S("strides",e,t,n),s=S("pad",e,t,n),a=S("kernelSize",e,t,n),o=S("includeBatchInIndex",e,t,n),{result:i,indexes:l}=sK(S("x",e,t,n),[a[1],a[2]],[r[1],r[2]],s,o);return[i,l]}case"AvgPool3D":{let r=S("strides",e,t,n),s=S("pad",e,t,n),a=S("kernelSize",e,t,n);return[Q6(S("x",e,t,n),[a[1],a[2],a[3]],[r[1],r[2],r[3]],s)]}case"MaxPool3D":{let r=S("strides",e,t,n),s=S("pad",e,t,n),a=S("kernelSize",e,t,n);return[gI(S("x",e,t,n),[a[1],a[2],a[3]],[r[1],r[2],r[3]],s)]}case"Dilation2D":{let r=S("strides",e,t,n),s=S("pad",e,t,n),a=S("dilations",e,t,n),o=r[1],i=r[2],l=a[1],u=a[2];return[aI(S("x",e,t,n),S("filter",e,t,n),[o,i],s,[l,u],"NHWC")]}default:throw TypeError(`Node type ${e.op} is not implemented`)}},dse=(e,t,n)=>{switch(e.op){case"Fill":{let r=S("shape",e,t,n),s=S("dtype",e,t,n),a=S("value",e,t,n);return[Cd(r,a,s)]}case"LinSpace":{let r=S("start",e,t,n),s=S("stop",e,t,n),a=S("num",e,t,n);return[Fq(r,s,a)]}case"Multinomial":{let r=S("logits",e,t,n),s=S("numSamples",e,t,n),a=S("seed",e,t,n);return[mK(r,s,a)]}case"OneHot":{let r=S("indices",e,t,n),s=S("depth",e,t,n),a=S("onValue",e,t,n),o=S("offValue",e,t,n);return[kd(r,s,a,o)]}case"Ones":return[la(S("shape",e,t,n),S("dtype",e,t,n))];case"OnesLike":return[Dr(S("x",e,t,n))];case"RandomUniform":return[Rd(S("shape",e,t,n),S("minval",e,t,n),S("maxval",e,t,n),S("dtype",e,t,n))];case"Range":{let r=S("start",e,t,n),s=S("stop",e,t,n),a=S("step",e,t,n);return[Dd(r,s,a,S("dtype",e,t,n))]}case"TruncatedNormal":{let r=S("shape",e,t,n),s=S("mean",e,t,n),a=S("stdDev",e,t,n),o=S("seed",e,t,n);return[l1(r,s,a,S("dtype",e,t,n),o)]}case"Zeros":return[un(S("shape",e,t,n),S("dtype",e,t,n))];case"ZerosLike":return[rt(S("x",e,t,n))];default:throw TypeError(`Node type ${e.op} is not implemented`)}};function S5(e,t,n){let r=S("boxes",e,t,n),s=S("scores",e,t,n),a=S("maxOutputSize",e,t,n),o=S("iouThreshold",e,t,n),i=S("scoreThreshold",e,t,n),l=S("softNmsSigma",e,t,n);return{boxes:r,scores:s,maxOutputSize:a,iouThreshold:o,scoreThreshold:i,softNmsSigma:l}}var hse=async(e,t,n)=>{switch(e.op){case"NonMaxSuppressionV5":{let{boxes:r,scores:s,maxOutputSize:a,iouThreshold:o,scoreThreshold:i,softNmsSigma:l}=S5(e,t,n),u=await ni.nonMaxSuppressionWithScoreAsync(r,s,a,o,i,l);return[u.selectedIndices,u.selectedScores]}case"NonMaxSuppressionV4":{let{boxes:r,scores:s,maxOutputSize:a,iouThreshold:o,scoreThreshold:i}=S5(e,t,n),l=S("padToMaxOutputSize",e,t,n),u=await ni.nonMaxSuppressionPaddedAsync(r,s,a,o,i,l);return[u.selectedIndices,u.validOutputs]}case"NonMaxSuppressionV3":case"NonMaxSuppressionV2":{let{boxes:r,scores:s,maxOutputSize:a,iouThreshold:o,scoreThreshold:i}=S5(e,t,n);return[await ni.nonMaxSuppressionAsync(r,s,a,o,i)]}case"Where":{let r=ke(S("condition",e,t,n),"bool"),s=[await NX(r)];return r.dispose(),s}case"ListDiff":return QK(S("x",e,t,n),S("y",e,t,n));default:throw TypeError(`Node type ${e.op} is not implemented`)}},pse=(e,t,n)=>{switch(e.op){case"TopKV2":{let r=S("x",e,t,n),s=S("k",e,t,n),a=S("sorted",e,t,n),o=TI(r,s,a);return[o.values,o.indices]}case"Unique":{let r=S("x",e,t,n),s=u1(r);return[s.values,s.indices]}case"UniqueV2":{let r=S("x",e,t,n),s=S("axis",e,t,n),a=u1(r,s);return[a.values,a.indices]}default:throw TypeError(`Node type ${e.op} is not implemented`)}},fse=(e,t,n)=>{switch(e.op){case"Const":return t[e.name];case"PlaceholderWithDefault":let r=S("default",e,t,n);return[Bn(e.name,t,n)||r];case"Placeholder":return[Bn(e.name,t,n)];case"Identity":case"StopGradient":case"FakeQuantWithMinMaxVars":{let u=S("x",e,t,n);return[ga(u)]}case"IdentityN":return S("x",e,t,n).map(u=>ga(u));case"Snapshot":let s=S("x",e,t,n);return[ga(s)];case"Shape":return[_n(S("x",e,t,n).shape,"int32")];case"ShapeN":return S("x",e,t,n).map(u=>_n(u.shape));case"Size":return[Fe(S("x",e,t,n).size,"int32")];case"Rank":return[Fe(S("x",e,t,n).rank,"int32")];case"NoOp":return[Fe(1)];case"Print":let a=S("x",e,t,n),o=S("data",e,t,n),i=S("message",e,t,n),l=S("summarize",e,t,n);console.warn("The graph has a tf.print() operation,usually used for debugging, which slows down performance."),console.log(i);for(let u=0;ue.dispose()),this.tensorMap.clear(),this.handle.dispose()}size(){return this.tensorMap.size}tensorSize(){return Fe(this.size(),"int32")}async import(e,t){this.checkKeyAndValueTensor(e,t);let n=await e.data();return this.tensorMap.forEach(r=>r.dispose()),this.tensorMap.clear(),Z(()=>{let r=ls(t),s=n.length,a=r.length;k.assert(s===a,()=>`The number of elements doesn't match, keys has ${s} elements, the values has ${a} elements.`);for(let o=0;o{let r=[];for(let s=0;s{switch(e.op){case"HashTable":case"HashTableV2":{let s=S("keyDType",e,t,n),a=S("valueDType",e,t,n),o=new mse(s,a);return r.addHashTable(e.name,o),[o.handle]}case"LookupTableImport":case"LookupTableImportV2":{let s=S("tableHandle",e,t,n,r),a=S("keys",e,t,n),o=S("values",e,t,n);return[await r.getHashTableById(s.id).import(a,o)]}case"LookupTableFind":case"LookupTableFindV2":{let s=S("tableHandle",e,t,n,r),a=S("keys",e,t,n),o=S("defaultValue",e,t,n);return[await r.getHashTableById(s.id).find(a,o)]}case"LookupTableSize":case"LookupTableSizeV2":{let s=S("tableHandle",e,t,n,r);return[r.getHashTableById(s.id).tensorSize()]}default:throw TypeError(`Node type ${e.op} is not implemented`)}},yse=(e,t,n)=>{switch(e.op){case"ResizeBilinear":{let r=S("images",e,t,n),s=S("size",e,t,n),a=S("alignCorners",e,t,n),o=S("halfPixelCenters",e,t,n);return[ni.resizeBilinear(r,[s[0],s[1]],a,o)]}case"ResizeNearestNeighbor":{let r=S("images",e,t,n),s=S("size",e,t,n),a=S("alignCorners",e,t,n),o=S("halfPixelCenters",e,t,n);return[ni.resizeNearestNeighbor(r,[s[0],s[1]],a,o)]}case"CropAndResize":{let r=S("image",e,t,n),s=S("boxes",e,t,n),a=S("boxInd",e,t,n),o=S("cropSize",e,t,n),i=S("method",e,t,n),l=S("extrapolationValue",e,t,n);return[ni.cropAndResize(r,s,a,o,i,l)]}default:throw TypeError(`Node type ${e.op} is not implemented`)}},Ase=(e,t,n)=>{switch(e.op){case"Equal":return[Zo(S("a",e,t,n),S("b",e,t,n))];case"NotEqual":return[Yl(S("a",e,t,n),S("b",e,t,n))];case"Greater":return[_r(S("a",e,t,n),S("b",e,t,n))];case"GreaterEqual":return[Jo(S("a",e,t,n),S("b",e,t,n))];case"Less":return[WA(S("a",e,t,n),S("b",e,t,n))];case"LessEqual":return[Qo(S("a",e,t,n),S("b",e,t,n))];case"LogicalAnd":return[is(S("a",e,t,n),S("b",e,t,n))];case"LogicalNot":return[Ef(S("a",e,t,n))];case"LogicalOr":return[jA(S("a",e,t,n),S("b",e,t,n))];case"Select":case"SelectV2":return[Ln(S("condition",e,t,n),S("a",e,t,n),S("b",e,t,n))];default:throw TypeError(`Node type ${e.op} is not implemented`)}},xse=(e,t,n)=>{switch(e.op){case"BatchMatMul":case"BatchMatMulV2":case"MatMul":return[ot(S("a",e,t,n),S("b",e,t,n),S("transposeA",e,t,n),S("transposeB",e,t,n))];case"Einsum":return[pq(S("equation",e,t,n),...S("tensors",e,t,n))];case"Transpose":return[pt(S("x",e,t,n),S("perm",e,t,n))];case"_FusedMatMul":let[r,s]=S("fusedOps",e,t,n),a=r==="biasadd",o=s==="prelu",i=S("numArgs",e,t,n),l=S("leakyreluAlpha",e,t,n);if(a){if(o&&i!==2)throw new Error("Fused MatMul with BiasAdd and Prelu must have two extra arguments: bias and alpha.");if(!o&&i!==1)throw new Error("Fused MatMul with BiasAdd must have one extra argument: bias.")}let[u,c]=S("args",e,t,n);return[ti.matMul({a:S("a",e,t,n),b:S("b",e,t,n),transposeA:S("transposeA",e,t,n),transposeB:S("transposeB",e,t,n),bias:u,activation:s,preluActivationWeights:c,leakyreluAlpha:l})];default:throw TypeError(`Node type ${e.op} is not implemented`)}},bse=(e,t,n)=>{switch(e.op){case"FusedBatchNorm":case"FusedBatchNormV2":return[Xl(S("x",e,t,n),S("mean",e,t,n),S("variance",e,t,n),S("offset",e,t,n),S("scale",e,t,n),S("epsilon",e,t,n))];case"FusedBatchNormV3":return[Xl(S("x",e,t,n),S("mean",e,t,n),S("variance",e,t,n),S("offset",e,t,n),S("scale",e,t,n),S("epsilon",e,t,n))];case"LRN":return[dI(S("x",e,t,n),S("radius",e,t,n),S("bias",e,t,n),S("alpha",e,t,n),S("beta",e,t,n))];case"Softmax":return[Of(S("x",e,t,n))];case"LogSoftmax":return[UA(S("x",e,t,n))];case"SparseToDense":return[$I(S("sparseIndices",e,t,n),S("outputShape",e,t,n),S("sparseValues",e,t,n),S("defaultValue",e,t,n))];default:throw TypeError(`Node type ${e.op} is not implemented`)}},vse=(e,t,n)=>{switch(e.op){case"Max":{let o=S("axis",e,t,n),i=S("keepDims",e,t,n);return[os(S("x",e,t,n),o,i)]}case"Mean":{let o=S("axis",e,t,n),i=S("keepDims",e,t,n);return[Xt(S("x",e,t,n),o,i)]}case"Min":{let o=S("axis",e,t,n),i=S("keepDims",e,t,n);return[_f(S("x",e,t,n),o,i)]}case"Sum":{let o=S("axis",e,t,n),i=S("keepDims",e,t,n);return[_e(S("x",e,t,n),o,i)]}case"All":{let o=S("axis",e,t,n),i=S("keepDims",e,t,n);return[RA(S("x",e,t,n),o,i)]}case"Any":{let o=S("axis",e,t,n),i=S("keepDims",e,t,n);return[wf(S("x",e,t,n),o,i)]}case"ArgMax":{let o=S("axis",e,t,n);return[kf(S("x",e,t,n),o)]}case"ArgMin":{let o=S("axis",e,t,n);return[H6(S("x",e,t,n),o)]}case"Prod":{let o=S("axis",e,t,n),i=S("keepDims",e,t,n);return[KA(S("x",e,t,n),o,i)]}case"Cumsum":{let o=S("axis",e,t,n),i=S("exclusive",e,t,n),l=S("reverse",e,t,n);return[LA(S("x",e,t,n),o,i,l)]}case"Bincount":let r=S("x",e,t,n),s=S("weights",e,t,n),a=S("size",e,t,n);return[eI(r,s,a)];case"DenseBincount":{let o=S("x",e,t,n),i=S("weights",e,t,n),l=S("size",e,t,n),u=S("binaryOutput",e,t,n);return[eq(o,i,l,u)]}default:throw TypeError(`Node type ${e.op} is not implemented`)}},wse=(e,t,n)=>{switch(e.op){case"ConcatV2":case"Concat":{let r=S("n",e,t,n),s=S("axis",e,t,n),a=S("tensors",e,t,n);return a=a.slice(0,r),[en(a,s)]}case"Gather":{let r=S("x",e,t,n),s=S("indices",e,t,n);return[$d(r,ke(s,"int32"),0)]}case"GatherV2":{let r=S("axis",e,t,n),s=S("batchDims",e,t,n),a=S("x",e,t,n),o=S("indices",e,t,n);return[$d(a,ke(o,"int32"),r,s)]}case"Reverse":{let r=S("dims",e,t,n),s=[];for(let o=0;o{let r=S("axis",e,t,n),s=S("tensors",e,t,n),a=s[0].shape,o=Jl(s[0]).shape,i=s.map(l=>{let u=k.arraysEqual(l.shape,a);if(!u&&!k.arraysEqual(Jl(l).shape,o))throw new Error("the input tensors shape does not match");return u?l:J(l,a)});return[Mr(i,r)]});case"Unpack":{let r=S("axis",e,t,n),s=S("tensor",e,t,n);return ls(s,r)}case"Tile":{let r=S("reps",e,t,n);return[Yo(S("x",e,t,n),r)]}case"Split":case"SplitV":{let r=S("axis",e,t,n),s=S("numOrSizeSplits",e,t,n),a=S("x",e,t,n);return dr(a,s,r)}case"ScatterNd":{let r=S("indices",e,t,n),s=S("values",e,t,n),a=S("shape",e,t,n);return[_X(r,s,a)]}case"GatherNd":{let r=S("x",e,t,n),s=S("indices",e,t,n);return[MX(r,s)]}case"SparseToDense":{let r=S("sparseIndices",e,t,n),s=S("outputShape",e,t,n),a=S("sparseValues",e,t,n),o=S("defaultValue",e,t,n);return[$I(r,a,s,a.dtype===o.dtype?o:ke(o,a.dtype))]}default:throw TypeError(`Node type ${e.op} is not implemented`)}},kse=(e,t,n)=>{switch(e.op){case"SparseFillEmptyRows":{let{outputIndices:r,outputValues:s,emptyRowIndicator:a,reverseIndexMap:o}=Vf.sparseFillEmptyRows(S("indices",e,t,n),S("values",e,t,n),S("denseShape",e,t,n),S("defaultValue",e,t,n));return[r,s,a,o]}case"SparseReshape":{let{outputIndices:r,outputShape:s}=Vf.sparseReshape(S("inputIndices",e,t,n),S("inputShape",e,t,n),S("newShape",e,t,n));return[r,s]}case"SparseSegmentMean":return[Vf.sparseSegmentMean(S("data",e,t,n),S("indices",e,t,n),S("segmentIds",e,t,n))];case"SparseSegmentSum":return[Vf.sparseSegmentSum(S("data",e,t,n),S("indices",e,t,n),S("segmentIds",e,t,n))];default:throw TypeError(`Node type ${e.op} is not implemented`)}},Ise=(e,t,n)=>{switch(e.op){case"FFT":return[a1(S("x",e,t,n))];case"IFFT":return[Pf(S("x",e,t,n))];case"RFFT":return[o1(S("x",e,t,n))];case"IRFFT":return[kI(S("x",e,t,n))];default:throw TypeError(`Node type ${e.op} is not implemented`)}},Sse=(e,t,n)=>{switch(e.op){case"StringNGrams":{let{nGrams:r,nGramsSplits:s}=p1.stringNGrams(S("data",e,t,n),S("dataSplits",e,t,n),S("separator",e,t,n),S("nGramWidths",e,t,n),S("leftPad",e,t,n),S("rightPad",e,t,n),S("padWidth",e,t,n),S("preserveShortSequences",e,t,n));return[r,s]}case"StringSplit":{let{indices:r,values:s,shape:a}=p1.stringSplit(S("input",e,t,n),S("delimiter",e,t,n),S("skipEmpty",e,t,n));return[r,s,a]}case"StringToHashBucketFast":return[p1.stringToHashBucketFast(S("input",e,t,n),S("numBuckets",e,t,n))];default:throw TypeError(`Node type ${e.op} is not implemented`)}},Tse=(e,t,n)=>{switch(e.op){case"Cast":return[ke(S("x",e,t,n),S("dtype",e,t,n))];case"ExpandDims":{let r=S("axis",e,t,n);return[$r(S("x",e,t,n),r)]}case"Squeeze":{let r=S("axis",e,t,n);return[Jl(S("x",e,t,n),r)]}case"Reshape":return[J(S("x",e,t,n),S("shape",e,t,n))];case"MirrorPad":return[yI(S("x",e,t,n),S("padding",e,t,n),S("mode",e,t,n))];case"PadV2":case"Pad":return[Wa(S("x",e,t,n),S("padding",e,t,n),S("constantValue",e,t,n))];case"SpaceToBatchND":{let r=S("blockShape",e,t,n),s=S("paddings",e,t,n);return[Rf(S("x",e,t,n),r,s)]}case"BatchToSpaceND":{let r=S("blockShape",e,t,n),s=S("crops",e,t,n);return[Tf(S("x",e,t,n),r,s)]}case"DepthToSpace":{let r=S("blockSize",e,t,n),s=S("dataFormat",e,t,n).toUpperCase();return[sI(S("x",e,t,n),r,s)]}case"BroadcastTo":return[Sd(S("x",e,t,n),S("shape",e,t,n))];default:throw TypeError(`Node type ${e.op} is not implemented`)}};function fT(e,t,n,r){let s=((a,o,i)=>{switch(a.category){case"arithmetic":return Z(()=>nse(a,o,i));case"basic_math":return Z(()=>rse(a,o,i));case"control":return use(a,o,i);case"convolution":return Z(()=>cse(a,o,i));case"creation":return Z(()=>dse(a,o,i));case"dynamic":return hse(a,o,i);case"evaluation":return Z(()=>pse(a,o,i));case"image":return Z(()=>yse(a,o,i));case"graph":return Z(()=>fse(a,o,i));case"logical":return Z(()=>Ase(a,o,i));case"matrices":return Z(()=>xse(a,o,i));case"normalization":return Z(()=>bse(a,o,i));case"reduction":return Z(()=>vse(a,o,i));case"slice_join":return Z(()=>wse(a,o,i));case"sparse":return Z(()=>kse(a,o,i));case"spectral":return Z(()=>Ise(a,o,i));case"string":return Z(()=>Sse(a,o,i));case"transformation":return Z(()=>Tse(a,o,i));case"hash_table":return gse(a,o,i,r);case"custom":let l=V8(a.op);if(l&&l.customExecutor)return l.customExecutor(new tse(a,o,i));throw TypeError(`Custom op ${a.op} is not registered.`);default:throw TypeError(`Unknown op '${a.op}'. File an issue at https://github.com/tensorflow/tfjs/issues so we can add it, or register a custom execution with tf.registerOp()`)}})(e,t,n);return k.isPromise(s)?s.then(a=>[].concat(a)):[].concat(s)}var mT=class{constructor(e={},t={},n={},r={}){this.weightMap=e,this.tensorArrayMap=t,this.tensorListMap=n,this.functionMap=r,this.rootContext={id:0,frameName:"",iterationId:0},this.contexts=[this.rootContext],this.lastId=0,this.generateCurrentContextIds()}newFrame(e,t){return{id:e,frameName:t,iterationId:0}}set currentContext(e){this.contexts!==e&&(this.contexts=e,this.generateCurrentContextIds())}get currentContext(){return this.contexts}get currentContextId(){return this._currentContextIds[0]}get currentContextIds(){return this._currentContextIds}generateCurrentContextIds(){let e=[];for(let t=0;tt.id===0&&t.iterationId===0?"":`${t.frameName}-${t.iterationId}`).join("/"):""}enterFrame(e){this.contexts&&(this.lastId++,this.contexts=this.contexts.slice(),this.contexts.push(this.newFrame(this.lastId,e)),this._currentContextIds.unshift(this.contextIdforContexts(this.contexts)))}exitFrame(){if(this.contexts&&this.contexts.length>1)this.contexts=this.contexts.slice(),this.contexts.splice(-1),this.currentContextIds.shift();else throw new Error("Cannot exit frame, the context is empty")}nextIteration(){if(this.contexts&&this.contexts.length>0){this.contexts=this.contexts.slice(),this.lastId++;let e=Object.assign({},this.contexts[this.contexts.length-1]);e.iterationId+=1,e.id=this.lastId,this.contexts.splice(-1,1,e),this._currentContextIds.splice(0,1,this.contextIdforContexts(this.contexts))}else throw new Error("Cannot increase frame iteration, the context is empty")}getWeight(e){return this.weightMap[e]}addTensorArray(e){this.tensorArrayMap[e.id]=e}getTensorArray(e){return this.tensorArrayMap[e]}addTensorList(e){this.tensorListMap[e.id]=e}getTensorList(e){return this.tensorListMap[e]}dispose(e){for(let t in this.tensorArrayMap)this.tensorArrayMap[t].clearAndClose(e);for(let t in this.tensorListMap)this.tensorListMap[t].clearAndClose(e)}};function gT(e,t,n,r){let s=new Set,a=[],o=null,i=null,l=new Set,u=Object.keys(e).map(h=>hr(h)[0]),c=[];r!=null&&(c=r.map(h=>hr(h.name)[0]));let d=[...t];for(;d.length>0;){let h=d.pop();if((yT(h)||_se(h)||Rse(h))&&o==null&&(o=h,i=o.children.map(p=>p.name).filter(p=>s.has(p))),s.add(h.name),n[h.name]==null&&u.indexOf(h.name)===-1&&c.indexOf(h.name)===-1){if(h.inputs.length===0){a.push(h.name);continue}h.inputs.forEach(p=>{l.has(p.name)||(l.add(p.name),d.push(p))})}}return{inputs:e,outputs:t,usedNodes:s,missingInputs:a,dynamicNode:o,syncInputs:i}}function Nse(e,t,n){let{usedNodes:r,inputs:s}=n,a=[],o=Object.keys(s).map(c=>hr(c)[0]).map(c=>e.nodes[c]),i=e.initNodes;o.forEach(c=>{r.has(c.name)&&a.push(c)}),e.weights.forEach(c=>{r.has(c.name)&&a.push(c)}),i!=null&&i.forEach(c=>{r.has(c.name)&&a.push(c)});let l=new Set,u=[];for(;a.length>0;){let c=a.pop();l.add(c.name),t[c.name]||u.push(c),c.children.forEach(d=>{!l.has(d.name)&&r.has(d.name)&&d.inputs.every(h=>l.has(h.name))&&a.push(d)})}return u}var Cse=["Switch","Merge","Enter","Exit","NextIteration","StatelessIf","StatelessWhile","if","While"],Ese=["NonMaxSuppressionV2","NonMaxSuppressionV3","NonMaxSuppressionV5","Where"],$se=["HashTable","HashTableV2","LookupTableImport","LookupTableImportV2","LookupTableFind","LookupTableFindV2","LookupTableSize","LookupTableSizeV2"];function yT(e){return Cse.indexOf(e.op)>=0}function _se(e){return Ese.indexOf(e.op)>=0}function Rse(e){return $se.indexOf(e.op)>=0}var T5=class{constructor(e,t){this.graph=e,this.parent=t,this.compiledMap=new Map,this._weightMap={},this.SEPERATOR=",",this._functions={},this._functionExecutorMap={},this._outputs=e.outputs,this._inputs=e.inputs,this._initNodes=e.initNodes,this._signature=e.signature,this._functions=e.functions,e.functions!=null&&Object.keys(e.functions).forEach(n=>{this._functionExecutorMap[n]=new T5(e.functions[n],this)})}get weightIds(){return this.parent?this.parent.weightIds:this._weightIds}get functionExecutorMap(){return this.parent?this.parent.functionExecutorMap:this._functionExecutorMap}get weightMap(){return this.parent?this.parent.weightMap:this._weightMap}set weightMap(e){let t=Object.keys(e).map(n=>e[n].map(r=>r.id));this._weightIds=[].concat(...t),this._weightMap=e}set resourceManager(e){this._resourceManager=e}get inputs(){return this._inputs.map(e=>({name:e.name,shape:e.attrParams.shape?e.attrParams.shape.value:void 0,dtype:e.attrParams.dtype?e.attrParams.dtype.value:void 0}))}get outputs(){return this._outputs.map(e=>({name:e.name,shape:e.attrParams.shape?e.attrParams.shape.value:void 0,dtype:e.attrParams.dtype?e.attrParams.dtype.value:void 0}))}get inputNodes(){return this._inputs.map(e=>e.signatureKey||e.name)}get outputNodes(){return this._outputs.map(e=>{let t=e.signatureKey||e.name;return e.defaultOutput?`${t}:${e.defaultOutput}`:t})}get functions(){return Object.keys(this._functions).reduce((e,t)=>(e[t]=this._functions[t].signature,e),{})}getCompilationKey(e,t){let n=e.map(s=>s.name).sort(),r=t.map(s=>s.name).sort();return n.join(this.SEPERATOR)+"--"+r.join(this.SEPERATOR)}compile(e,t){let n=gT(e,t,this.weightMap,this._initNodes),{missingInputs:r,dynamicNode:s,syncInputs:a}=n;if(s!=null)throw new Error(`This execution contains the node '${s.name}', which has the dynamic op '${s.op}'. Please use model.executeAsync() instead. Alternatively, to avoid the dynamic ops, specify the inputs [${a}]`);if(r.length>0){let o=t.map(l=>l.name),i=Object.keys(e);throw new Error(`Cannot compute the outputs [${o}] from the provided inputs [${i}]. Missing the following inputs: [${r}]`)}return Nse(this.graph,this.weightMap,n)}execute(e,t){e=this.mapInputs(e);let n=Object.keys(e).sort();this.checkInputs(e),this.checkInputShapeAndType(e),t=this.mapOutputs(t),this.checkOutputs(t);let r=n.map(c=>this.graph.nodes[hr(c)[0]]),s=t.map(c=>hr(c)[0]),a=s.map(c=>this.graph.nodes[c]);a.length===0&&(a=this._outputs);let o=this.getCompilationKey(r,a),i=this.compiledMap.get(o);i==null&&(i=this.compile(e,a),this.compiledMap.set(o,i));let l={},u={};return Z(()=>{let c=new mT(this.weightMap,l,u,this.functionExecutorMap),d={...this.weightMap};Object.keys(e).forEach(f=>{let[m,g]=hr(f),y=[];y[g]=e[f],d[m]=y});let h=this.getFrozenTensorIds(d),p={};for(let f=0;fBn(f,d,c))})}getFrozenTensorIds(e){let t=[].concat.apply([],Object.keys(e).map(n=>e[n]).map(n=>n.map(r=>r.id)));return new Set(t)}checkTensorForDisposal(e,t,n,r,s,a,o){t.category==="control"||a.indexOf(e)!==-1||(n[e].forEach(i=>{i!=null&&(o[i.id]=(o[i.id]||0)+t.children.length)}),t.inputs.forEach(i=>{if(i.category!=="control"){let l=Fre(i.name,n,r);l!=null&&l.forEach(u=>{if(u&&!u.kept&&!s.has(u.id)){let c=o[u.id];c===1?(u.dispose(),delete o[u.id]):c!=null&&o[u.id]--}})}}))}async executeAsync(e,t){return this._executeAsync(e,t)}async _executeAsync(e,t,n=!1,r={},s={}){n||(e=this.mapInputs(e),this.checkInputs(e),this.checkInputShapeAndType(e),t=this.mapOutputs(t),this.checkOutputs(t));let a=new mT(this.weightMap,r,s,this.functionExecutorMap),o=await this.executeWithControlFlow(e,a,t,n),i=t.map(d=>Bn(d,o,a)),l=i.map(d=>d.id),u=Object.keys(e).map(d=>e[d].id),c=new Set([...l,...u,...this.weightIds]);return Object.keys(o).forEach(d=>{o[d].forEach(p=>{p&&!p.kept&&!p.isDisposed&&!c.has(p.id)&&p.dispose()})}),this.parent==null&&a.dispose(c),i}async executeFunctionAsync(e,t,n){let r=e.reduce((s,a,o)=>(s[this.inputs[o].name]=a,s),{});return this._executeAsync(r,this.outputNodes,!0,t,n)}async executeWithControlFlow(e,t,n,r){let s=Object.keys(e),a=s.map(A=>this.graph.nodes[hr(A)[0]]),o=n.map(A=>hr(A)[0]),i=o.map(A=>this.graph.nodes[A]);i.length===0&&(i=this._outputs);let{usedNodes:l,missingInputs:u,dynamicNode:c,syncInputs:d}=gT(e,i,this.weightMap,this._initNodes),h=[...a,...this.graph.weights,...this._initNodes||[]].map(A=>({node:A,contexts:t.currentContext})),p={...this.weightMap};Object.keys(e).forEach(A=>{let[x,b]=hr(A),v=[];v[b]=e[A],p[x]=v});let f={},m=this.getFrozenTensorIds(p),g={};for(;h.length>0;){let A=this.processStack(a,h,t,p,g,m,o,f,l);await Promise.all(A)}c==null&&!r&&console.warn("This model execution did not contain any nodes with control flow or dynamic output shapes. You can use model.execute() instead.");let y=i.filter(A=>!yT(A)&&!Bn(A.name,p,t)).map(A=>A.name);if(y.length>0){let A="";throw c!=null&&(A=`Alternatively, to avoid the dynamic ops, use model.execute() and specify the inputs [${d}]`),new Error(`Cannot compute the outputs [${y}] from the provided inputs [${s}]. Consider providing the following inputs: [${u}]. ${A}`)}return p}processStack(e,t,n,r,s,a,o,i,l){let u=[];for(;t.length>0;){let c=t.pop();n.currentContext=c.contexts;let d="";if(c.node.op==="Enter"&&S("isConstant",c.node,r,n)&&([d]=ma(c.node.name,n)),r[c.node.name]==null){let h=fT(c.node,r,n,this._resourceManager);d||([d]=ma(c.node.name,n));let p=n.currentContext;k.isPromise(h)?u.push(h.then(f=>(r[d]=f,n.currentContext=p,this.checkTensorForDisposal(d,c.node,r,n,a,o,i),this.processChildNodes(c.node,t,n,r,s,l),f))):(r[d]=h,this.checkTensorForDisposal(d,c.node,r,n,a,o,i),this.processChildNodes(c.node,t,n,r,s,l))}else this.processChildNodes(c.node,t,n,r,s,l)}return u}processChildNodes(e,t,n,r,s,a){e.children.forEach(o=>{let[i]=ma(o.name,n);s[i]||!a.has(o.name)||(o.op==="Merge"?o.inputNames.some(l=>!!Bn(l,r,n))&&(s[i]=!0,t.push({contexts:n.currentContext,node:o})):o.inputNames.every(l=>!!Bn(l,r,n))&&(s[i]=!0,t.push({contexts:n.currentContext,node:o})))})}dispose(){Object.keys(this.weightMap).forEach(e=>this.weightMap[e].forEach(t=>t.dispose()))}checkInputShapeAndType(e){Object.keys(e).forEach(t=>{let n=e[t],[r]=hr(t),s=this.graph.nodes[r];if(s.attrParams.shape&&s.attrParams.shape.value){let a=s.attrParams.shape.value,o=a.length===n.shape.length&&n.shape.every((i,l)=>a[l]===-1||a[l]===i);k.assert(o,()=>`The shape of dict['${s.name}'] provided in model.execute(dict) must be [${a}], but was [${n.shape}]`)}s.attrParams.dtype&&s.attrParams.dtype.value&&k.assert(n.dtype===s.attrParams.dtype.value,()=>`The dtype of dict['${s.name}'] provided in model.execute(dict) must be ${s.attrParams.dtype.value}, but was ${n.dtype}`)})}mapInputs(e){let t={};for(let n in e)if(this._signature!=null&&this._signature.inputs!=null&&this._signature.inputs[n]!=null){let r=this._signature.inputs[n];t[r.name]=e[n]}else t[n]=e[n];return t}checkInputs(e){let t=Object.keys(e).filter(n=>{let[r]=hr(n);return this.graph.nodes[r]==null});if(t.length>0)throw new Error(`The dict provided in model.execute(dict) has keys: [${t}] that are not part of graph`)}mapOutputs(e){return e.map(t=>this._signature!=null&&this._signature.outputs!=null&&this._signature.outputs[t]!=null?this._signature.outputs[t].name:t,{})}checkOutputs(e){e.forEach(t=>{let[n]=hr(t);if(!this.graph.nodes[n])throw new Error(`The output '${t}' is not found in the graph`)})}},Dse=class{constructor(e={},t={}){this.hashTableNameToHandle=e,this.hashTableMap=t}addHashTable(e,t){this.hashTableNameToHandle[e]=t.handle,this.hashTableMap[t.id]=t}getHashTableHandleByName(e){return this.hashTableNameToHandle[e]}getHashTableById(e){return this.hashTableMap[e]}dispose(){for(let e in this.hashTableMap)this.hashTableMap[e].clearAndClose(),delete this.hashTableMap[e];for(let e in this.hashTableNameToHandle)this.hashTableNameToHandle[e].dispose(),delete this.hashTableNameToHandle[e]}},Fse="?tfjs-format=file",Mse="model.json",AT=class{constructor(e,t={}){this.modelUrl=e,this.loadOptions=t,this.version="n/a",t==null&&(this.loadOptions={}),this.resourceManager=new Dse}get modelVersion(){return this.version}get inputNodes(){return this.executor.inputNodes}get outputNodes(){return this.executor.outputNodes}get inputs(){return this.executor.inputs}get outputs(){return this.executor.outputs}get weights(){return this.executor.weightMap}get metadata(){return this.artifacts.userDefinedMetadata}get modelSignature(){return this.signature}findIOHandler(){let e=this.modelUrl;if(e.load!=null)this.handler=e;else if(this.loadOptions.requestInit!=null)this.handler=ur.browserHTTPRequest(e,this.loadOptions);else{let t=ur.getLoadHandlers(e,this.loadOptions);if(t.length===0)t.push(ur.browserHTTPRequest(e,this.loadOptions));else if(t.length>1)throw new Error(`Found more than one (${t.length}) load handlers for URL '${[e]}'`);this.handler=t[0]}}async load(){if(this.findIOHandler(),this.handler.load==null)throw new Error("Cannot proceed with model loading because the IOHandler provided does not have the `load` method implemented.");let e=await this.handler.load();return this.loadSync(e)}loadSync(e){this.artifacts=e;let t=this.artifacts.modelTopology,n;this.artifacts.userDefinedMetadata!=null&&this.artifacts.userDefinedMetadata.signature!=null?n=this.artifacts.userDefinedMetadata.signature:n=this.artifacts.signature,this.signature=n,this.version=`${t.versions.producer}.${t.versions.minConsumer}`;let r=ur.decodeWeights(this.artifacts.weightData,this.artifacts.weightSpecs);if(this.executor=new T5(lT.Instance.transformGraph(t,this.signature)),this.executor.weightMap=this.convertTensorMapToTensorsMap(r),this.executor.resourceManager=this.resourceManager,e.modelInitializer!=null&&e.modelInitializer.node!=null){let s=lT.Instance.transformGraph(e.modelInitializer);this.initializer=new T5(s),this.initializer.weightMap=this.executor.weightMap,this.initializer.resourceManager=this.resourceManager,this.initializer.executeAsync({},[])}return!0}async save(e,t){if(typeof e=="string"){let n=ur.getSaveHandlers(e);if(n.length===0)throw new Error(`Cannot find any save handlers for URL '${e}'`);if(n.length>1)throw new Error(`Found more than one (${n.length}) save handlers for URL '${e}'`);e=n[0]}if(e.save==null)throw new Error("GraphModel.save() cannot proceed because the IOHandler provided does not have the `save` attribute defined.");return e.save(this.artifacts)}predict(e,t){return this.execute(e,this.outputNodes)}normalizeInputs(e){if(!(e instanceof Ct)&&!Array.isArray(e))return e;if(e=Array.isArray(e)?e:[e],e.length!==this.inputNodes.length)throw new Error(`Input tensor count mismatch,the graph model has ${this.inputNodes.length} placeholders, while there are ${e.length} input tensors.`);return this.inputNodes.reduce((t,n,r)=>(t[n]=e[r],t),{})}normalizeOutputs(e){return e=e||this.outputNodes,Array.isArray(e)?e:[e]}execute(e,t){e=this.normalizeInputs(e),t=this.normalizeOutputs(t);let n=this.executor.execute(e,t);return n.length>1?n:n[0]}async executeAsync(e,t){e=this.normalizeInputs(e),t=this.normalizeOutputs(t);let n=await this.executor.executeAsync(e,t);return n.length>1?n:n[0]}convertTensorMapToTensorsMap(e){return Object.keys(e).reduce((t,n)=>(t[n]=[e[n]],t),{})}dispose(){this.executor.dispose(),this.initializer&&this.initializer.dispose(),this.resourceManager.dispose()}};async function Et(e,t={}){if(e==null)throw new Error("modelUrl in loadGraphModel() cannot be null. Please provide a url or an IOHandler that loads the model");t==null&&(t={}),t.fromTFHub&&e.load==null&&(e.endsWith("/")||(e=e+"/"),e=`${e}${Mse}${Fse}`);let n=new AT(e,t);return await n.load(),n}var Ose="3.7.0",xT={};De(xT,{CSVDataset:()=>DT,Dataset:()=>uu,FileDataSource:()=>BT,TextLineDataset:()=>$T,URLDataSource:()=>WT,array:()=>aae,csv:()=>gae,func:()=>yae,generator:()=>Aae,microphone:()=>bae,version_data:()=>vae,webcam:()=>xae,zip:()=>oae});var Pse=Ks(z3()),zse=Ks(z3());function Lse(e,t){return Sm(e,t)}function Sm(e,t,n=new Map,r=new Set){if(e==null)return null;if(r.has(e))throw new Error("Circular references are not supported.");if(n.has(e))return n.get(e);let s=t(e);if(s.recurse&&s.value!==null)throw new Error("A deep map function may not return both a value and recurse=true.");if(s.recurse)if(lu(e)){let a=Array.isArray(e)?[]:{};r.add(e);for(let o in e){let i=e[o],l=Sm(i,t,n,r);a[o]=l}return r.delete(e),a}else throw new Error(`Can't recurse into non-iterable type: ${e}`);else return n.set(e,s.value),s.value}function Bse(e,t=vT){return bT(e,t)}function bT(e,t,n=new Set){let r=e[0];if(n.has(r))throw new Error("Circular references are not supported.");let s=t(e);if(s.recurse&&s.value!==null)throw new Error("A deep zip function may not return both a value and recurse=true.");if(s.recurse)if(lu(r)){let a=Array.isArray(r)?[]:{};n.add(r);for(let o in r){let i=e.map(u=>u[o]),l=bT(i,t,n);a[o]=l}return n.delete(r),a}else throw new Error(`Can't recurse into non-iterable type: ${r}`);else return s.value}function vT(e){return e===null?null:lu(e[0])?{value:null,recurse:!0}:{value:e,recurse:!1}}async function wT(e,t){let n=new Map;Sm(e,t,n);for(let s of Array.from(n.keys())){let a=n.get(s);if(k.isPromise(a)){let o=await a;n.set(s,o)}}return Sm(e,t,n)}function lu(e){return e!=null&&!ArrayBuffer.isView(e)&&(Array.isArray(e)||typeof e=="object"&&!(e instanceof Ct))}function Wse(e){return e==null||Vse(e)||Array.isArray(e)||typeof e=="object"&&e instanceof Ct||k.isTypedArray(e)}function Vse(e){return e===null||typeof e!="object"&&typeof e!="function"}function Use(e){return Lse(e,Hse)}function Hse(e){return e instanceof Ct?{value:e.clone(),recurse:!1}:lu(e)?{value:null,recurse:!0}:{value:e,recurse:!1}}var kT=class{constructor(e){if(this.capacity=e,this.begin=0,this.end=0,e==null)throw new RangeError("Can't create a ring buffer of unknown capacity.");if(e<1)throw new RangeError("Can't create ring buffer of capacity < 1.");this.data=new Array(e),this.doubledCapacity=2*e}wrap(e){for(;e<0;)e+=this.doubledCapacity;return e%this.doubledCapacity}get(e){if(e<0)throw new RangeError("Can't get item at a negative index.");return this.data[e%this.capacity]}set(e,t){if(e<0)throw new RangeError("Can't set item at a negative index.");this.data[e%this.capacity]=t}length(){let e=this.end-this.begin;return e<0&&(e=this.doubledCapacity+e),e}isFull(){return this.length()===this.capacity}isEmpty(){return this.length()===0}push(e){if(this.isFull())throw new RangeError("Ring buffer is full.");this.set(this.end,e),this.end=this.wrap(this.end+1)}pushAll(e){for(let t of e)this.push(t)}pop(){if(this.isEmpty())throw new RangeError("Ring buffer is empty.");this.end=this.wrap(this.end-1);let e=this.get(this.end);return this.set(this.end,void 0),e}unshift(e){if(this.isFull())throw new RangeError("Ring buffer is full.");this.begin=this.wrap(this.begin-1),this.set(this.begin,e)}shift(){if(this.isEmpty())throw new RangeError("Ring buffer is empty.");let e=this.get(this.begin);return this.set(this.begin,void 0),this.begin=this.wrap(this.begin+1),e}shuffleExcise(e){if(this.isEmpty())throw new RangeError("Ring buffer is empty.");let t=this.wrap(this.begin+e),n=this.get(t);return this.set(t,this.pop()),n}},IT=class extends kT{constructor(){super(IT.INITIAL_CAPACITY)}isFull(){return!1}push(e){super.isFull()&&this.expand(),super.push(e)}unshift(e){super.isFull()&&this.expand(),super.unshift(e)}expand(){let e=this.capacity*2,t=new Array(e),n=this.length();for(let r=0;rt===!0)}rowMajorBatch(e,t=!0){return new Jse(this,e,t)}columnMajorBatch(e,t=!0,n=vT){return this.rowMajorBatch(e,t).map(s=>Bse(s,n))}concatenate(e,t){return new CT(TT([this,e]),t)}take(e){return e<0||e==null?this:new Yse(this,e)}skip(e){return e<0||e==null?this:new Zse(this,e)}prefetch(e){return new ET(this,e)}shuffle(e,t){return new sae(this,e,t)}serial(){return new Xse(this)}},qse=class extends xn{constructor(e){super();this.items=e,this.trav=0}summary(){return`Array of ${this.items.length} items`}async next(){if(this.trav>=this.items.length)return{value:null,done:!0};let e=this.items[this.trav];return this.trav++,{value:Use(e),done:!1}}},Kse=class extends xn{constructor(e){super();this.nextFn=e}summary(){return"Function call"}async next(){try{return this.nextFn()}catch(e){throw e.message=`Error thrown while iterating through a dataset: ${e.message}`,e}}},Xse=class extends xn{constructor(e){super();this.upstream=e,this.lastRead=Promise.resolve({value:null,done:!1})}summary(){return`${this.upstream.summary()} -> Serial`}async next(){return this.lastRead=this.lastRead.then(()=>this.serialNext()),this.lastRead}async serialNext(){return this.upstream.next()}},Zse=class extends xn{constructor(e,t){super();this.upstream=e,this.maxCount=t,this.count=0,this.lastRead=Promise.resolve({value:null,done:!1})}summary(){return`${this.upstream.summary()} -> Skip`}async next(){return this.lastRead=this.lastRead.then(()=>this.serialNext()),this.lastRead}async serialNext(){for(;this.count++ Take`}async next(){return this.count++>=this.maxCount?{value:null,done:!0}:this.upstream.next()}},Jse=class extends xn{constructor(e,t,n=!0){super();this.upstream=e,this.batchSize=t,this.enableSmallLastBatch=n,this.lastRead=Promise.resolve({value:null,done:!1})}summary(){return`${this.upstream.summary()} -> RowMajorBatch`}async next(){return this.lastRead=this.lastRead.then(()=>this.serialNext()),this.lastRead}async serialNext(){let e=[];for(;e.length0?{value:e,done:!1}:{value:null,done:!0};e.push(t.value)}return{value:e,done:!1}}},Qse=class extends xn{constructor(e,t){super();this.upstream=e,this.predicate=t,this.lastRead=Promise.resolve({value:null,done:!1})}summary(){return`${this.upstream.summary()} -> Filter`}async next(){return this.lastRead=this.lastRead.then(()=>this.serialNext()),this.lastRead}async serialNext(){for(;;){let e=await this.upstream.next();if(e.done||this.predicate(e.value))return e;je(e.value)}}},eae=class extends xn{constructor(e,t){super();this.upstream=e,this.transform=t}summary(){return`${this.upstream.summary()} -> Map`}async next(){let e=await this.upstream.next();if(e.done)return{value:null,done:!0};let t=Es.getTensorsInContainer(e.value),n=this.transform(e.value),r=Es.getTensorsInContainer(n);for(let s of t)Es.isTensorInList(s,r)||s.dispose();return{value:n,done:!1}}},tae=class extends xn{constructor(e,t){super();this.upstream=e,this.handler=t,this.count=0,this.lastRead=Promise.resolve({value:null,done:!1})}summary(){return`${this.upstream.summary()} -> handleErrors`}async next(){return this.lastRead=this.lastRead.then(()=>this.serialNext()),this.lastRead}async serialNext(){for(;;)try{return await this.upstream.next()}catch(e){if(!this.handler(e))return{value:null,done:!0}}}},NT=class extends xn{constructor(e,t){super();this.upstream=e,this.transform=t}summary(){return`${this.upstream.summary()} -> AsyncMap`}async next(){let e=await this.upstream.next();if(e.done)return{value:null,done:!0};let t=Es.getTensorsInContainer(e.value),n=await this.transform(e.value),r=Es.getTensorsInContainer(n);for(let s of t)Es.isTensorInList(s,r)||s.dispose();return{value:n,done:!1}}},C5=class extends xn{constructor(){super();this.outputQueue=new ST,this.lastRead=Promise.resolve({value:null,done:!1})}async next(){return this.lastRead=this.lastRead.then(()=>this.serialNext()),this.lastRead}async serialNext(){for(;this.outputQueue.length()===0;)if(!await this.pump())return{value:null,done:!0};return{value:this.outputQueue.shift(),done:!1}}},nae=class extends C5{constructor(e,t){super();this.upstream=e,this.transform=t}summary(){return`${this.upstream.summary()} -> Flatmap`}async pump(){let e=await this.upstream.next();if(e.done)return!1;let t=Es.getTensorsInContainer(e.value),n=this.transform(e.value),r=Es.getTensorsInContainer(n);this.outputQueue.pushAll(n);for(let s of t)Es.isTensorInList(s,r)||s.dispose();return!0}},CT=class extends xn{constructor(e,t){super();this.baseErrorHandler=t,this.lastRead=null,this.iterator=null,this.moreIterators=e}summary(){return"TODO: fill in upstream of chained summaries -> Chained"}async next(){return this.lastRead=this.readFromChain(this.lastRead),this.lastRead}async readFromChain(e){if(await e,this.iterator==null){let n=await this.moreIterators.next();if(n.done)return{value:null,done:!0};this.iterator=n.value,this.baseErrorHandler!=null&&(this.iterator=this.iterator.handleErrors(this.baseErrorHandler))}let t=await this.iterator.next();return t.done?(this.iterator=null,this.readFromChain(e)):t}},Tm;(function(e){e[e.FAIL=0]="FAIL",e[e.SHORTEST=1]="SHORTEST",e[e.LONGEST=2]="LONGEST"})(Tm||(Tm={}));var rae=class extends xn{constructor(e,t=0){super();this.iterators=e,this.mismatchMode=t,this.count=0,this.currentPromise=null}summary(){return"{TODO: fill in upstream of zip summaries} -> Zip"}async nextState(e){await e;let t=0,n=0;function r(a){return a instanceof xn?{value:a.next().then(i=>(t++,i.done&&n++,i.value)),recurse:!1}:{value:null,recurse:!0}}let s=await wT(this.iterators,r);if(t===n)return{value:null,done:!0};if(n>0)switch(this.mismatchMode){case 0:throw new Error(`Zipped streams should have the same length. Mismatched at element ${this.count}.`);case 1:return{value:null,done:!0};case 2:default:}return this.count++,{value:s,done:!1}}async next(){return this.currentPromise=this.nextState(this.currentPromise),this.currentPromise}},ET=class extends xn{constructor(e,t){super();this.upstream=e,this.bufferSize=t,this.buffer=new kT(t)}summary(){return`${this.upstream.summary()} -> Prefetch`}refill(){for(;!this.buffer.isFull();){let e=this.upstream.next();this.buffer.push(e)}}next(){return this.refill(),this.buffer.shift()}},sae=class extends ET{constructor(e,t,n){super(e,t);this.upstream=e,this.windowSize=t,this.upstreamExhausted=!1,this.random=zse.alea(n||k.now().toString()),this.lastRead=Promise.resolve({value:null,done:!1})}async next(){return this.lastRead=this.lastRead.then(()=>this.serialNext()),this.lastRead}randomInt(e){return Math.floor(this.random()*e)}chooseIndex(){return this.randomInt(this.buffer.length())}async serialNext(){for(this.upstreamExhausted||this.refill();!this.buffer.isEmpty();){let e=this.chooseIndex(),t=await this.buffer.shuffleExcise(e);if(t.done)this.upstreamExhausted=!0;else return this.refill(),t}return{value:null,done:!0}}},uu=class{constructor(){this.size=null}batch(e,t=!0){let n=this;k.assert(e>0,()=>`batchSize needs to be positive, but it is + ${e}`);let r;return this.size===Infinity||this.size==null?r=this.size:t?r=Math.ceil(this.size/e):r=Math.floor(this.size/e),pr(async()=>(await n.iterator()).columnMajorBatch(e,t,iae),r)}concatenate(e){let t=this,n;return this.size===Infinity||e.size===Infinity?n=Infinity:this.size!=null&&e.size!=null?n=this.size+e.size:n=null,pr(async()=>(await t.iterator()).concatenate(await e.iterator()),n)}filter(e){let t=this,n;return this.size===Infinity?n=Infinity:n=null,pr(async()=>(await t.iterator()).filter(r=>Z(()=>e(r))),n)}async forEachAsync(e){return(await this.iterator()).forEachAsync(e)}map(e){let t=this;return pr(async()=>(await t.iterator()).map(n=>Z(()=>e(n))),this.size)}mapAsync(e){let t=this;return pr(async()=>(await t.iterator()).mapAsync(e),this.size)}prefetch(e){if(e==null)throw new RangeError("`Dataset.prefetch()` requires bufferSize to be specified.");let t=this;return pr(async()=>(await t.iterator()).prefetch(e),this.size)}repeat(e){let t=this,n;return this.size!=null&&e>0?n=this.size*e:e===0?n=0:this.size!=null&&(e===void 0||e<0)?n=Infinity:n=null,pr(async()=>{let r=N5(async()=>({value:await t.iterator(),done:!1}));return Gse(r.take(e))},n)}skip(e){let t=this,n;return this.size!=null&&e>=0&&this.size>=e?n=this.size-e:this.size!=null&&(this.size(await t.iterator()).skip(e),n)}shuffle(e,t,n=!0){if(e==null||e<0)throw this.size==null?new RangeError("`Dataset.shuffle()` requires bufferSize to be specified."):new RangeError(`\`Dataset.shuffle()\` requires bufferSize to be specified. If your data fits in main memory (for regular JS objects), and/or GPU memory (for \`tf.Tensor\`s), consider setting bufferSize to the dataset size (${this.size} elements)`);let r=this,s=Pse.alea(t||k.now().toString());return pr(async()=>{let a=s.int32();return n&&(a+=s.int32()),(await r.iterator()).shuffle(e,a.toString())},this.size)}take(e){let t=this,n;return this.size!=null&&this.size>e?n=e:this.size!=null&&this.size<=e?n=this.size:n=null,pr(async()=>(await t.iterator()).take(e),n)}async toArray(){if(this.size===Infinity)throw new Error("Can not convert infinite data stream to array.");return(await this.iterator()).toArray()}async toArrayForTest(){if(this.size===Infinity)throw new Error("Can not convert infinite data stream to array.");return(await this.iterator()).toArrayForTest()}};uu.MAX_BUFFER_SIZE=1e4;function pr(e,t=null){return new class extends uu{constructor(){super(...arguments);this.size=t}async iterator(){return e()}}}function aae(e){return pr(async()=>TT(e),e.length)}function oae(e){if(!lu(e))throw new Error("The argument to zip() must be an object or array.");let t;if(Array.isArray(e))for(let n=0;n{let n=await wT(e,r=>{if(r instanceof uu)return{value:r.iterator(),recurse:!1};if(lu(r))return{value:null,recurse:!0};throw new Error("Leaves of the structure passed to zip() must be Datasets, not primitives.")});return jse(n,Tm.SHORTEST)},t)}function iae(e){if(e===null)return null;let t=e[0];return Wse(t)?{value:lae(e),recurse:!1}:{value:null,recurse:!0}}function lae(e){if(e.length===0)throw new Error("Can't make a batch of zero elements.");return e[0]instanceof Ct?Mr(e):$s(e)}var $T=class extends uu{constructor(e){super();this.input=e}async iterator(){return(await this.input.iterator()).decodeUTF8().split(` +`).map(r=>(r.endsWith("\r")&&(r=r.slice(0,-1)),r))}},Nm='"',eh=Symbol("out"),_T=Symbol("field"),Cm=Symbol("quote"),E5=Symbol("quoteafterquote"),RT=Symbol("quoteinquote"),DT=class extends uu{constructor(e,t){super();this.input=e,this.hasHeader=!0,this.fullColumnNames=null,this.columnNamesValidated=!1,this.columnConfigs=null,this.configuredColumnsOnly=!1,this.delimiter=",",this.delimWhitespace=!1,this.base=new $T(e),t||(t={}),this.hasHeader=t.hasHeader!==!1,this.fullColumnNames=t.columnNames,this.columnConfigs=t.columnConfigs,this.configuredColumnsOnly=t.configuredColumnsOnly,t.delimWhitespace?(k.assert(t.delimiter==null,()=>"Delimiter should not be provided when delimWhitespace is true."),this.delimWhitespace=!0,this.delimiter=" "):this.delimiter=t.delimiter?t.delimiter:","}async columnNames(){return this.columnNamesValidated||await this.setColumnNames(),this.configuredColumnsOnly?Object.keys(this.columnConfigs):this.fullColumnNames}async setColumnNames(){let e=await this.maybeReadHeaderLine();if(!this.fullColumnNames&&!e)throw new Error("Column names must be provided if there is no header line.");this.fullColumnNames&&e&&k.assert(e.length===this.fullColumnNames.length,()=>"The length of provided columnNames ("+this.fullColumnNames.length.toString()+") does not match the length of the header line read from file ("+e.length.toString()+")."),this.fullColumnNames||(this.fullColumnNames=e);let t=this.fullColumnNames.reduce((r,s)=>(r[s]=r[s]+1||1,r),{}),n=Object.keys(t).filter(r=>t[r]>1);if(k.assert(n.length===0,()=>"Duplicate column names found: "+n.toString()),this.columnConfigs){for(let r of Object.keys(this.columnConfigs))if(this.fullColumnNames.indexOf(r)===-1)throw new Error('The key "'+r+'" provided in columnConfigs does not match any of the column names ('+this.fullColumnNames.toString()+").")}this.columnNamesValidated=!0}async maybeReadHeaderLine(){if(this.hasHeader){let t=await(await this.base.iterator()).next();if(t.done)throw new Error("No data was found for CSV parsing.");let n=t.value;return this.parseRow(n,!1)}else return null}async iterator(){this.columnNamesValidated||await this.setColumnNames();let e=await this.base.iterator();return this.hasHeader&&(e=e.skip(1)),e.map(t=>this.makeDataElement(t))}makeDataElement(e){let t=this.parseRow(e),n={},r={};for(let s=0;s14||!Number.isInteger(t))throw new Error(`Invalid fftSize: it must be a power of 2 between 2 to 4 and 2 to 14, but got ${this.fftSize}`);if(this.numFrames=e.numFramesPerSpectrogram||43,this.sampleRateHz=e.sampleRateHz,this.columnTruncateLength=e.columnTruncateLength||this.fftSize,this.audioTrackConstraints=e.audioTrackConstraints,this.smoothingTimeConstant=e.smoothingTimeConstant||0,this.includeSpectrogram=e.includeSpectrogram!==!1,this.includeWaveform=e.includeWaveform===!0,!this.includeSpectrogram&&!this.includeWaveform)throw new Error("Both includeSpectrogram and includeWaveform are false. At least one type of data should be returned.")}summary(){return"microphone"}static async create(e={}){if(ae().get("IS_NODE"))throw new Error("microphone API is only supported in browser environment.");let t=new FT(e);return await t.start(),t}async start(){try{this.stream=await navigator.mediaDevices.getUserMedia({audio:this.audioTrackConstraints==null?!0:this.audioTrackConstraints,video:!1})}catch(n){throw new Error(`Error thrown while initializing video stream: ${n.message}`)}if(!this.stream)throw new Error("Could not obtain audio from microphone.");let e=window.AudioContext||window.webkitAudioContext;if(this.audioContext=new e,!this.sampleRateHz)this.sampleRateHz=this.audioContext.sampleRate;else if(this.audioContext.sampleRate!==this.sampleRateHz)throw new Error(`Mismatch in sampling rate: Expected: ${this.sampleRateHz}; Actual: ${this.audioContext.sampleRate}`);let t=this.audioContext.createMediaStreamSource(this.stream);this.analyser=this.audioContext.createAnalyser(),this.analyser.fftSize=this.fftSize*2,this.analyser.smoothingTimeConstant=this.smoothingTimeConstant,t.connect(this.analyser),this.freqData=new Float32Array(this.fftSize),this.timeData=new Float32Array(this.fftSize)}async next(){if(this.isClosed)return{value:null,done:!0};let e,t,n=await this.getAudioData();if(this.includeSpectrogram){let r=this.flattenQueue(n.freqDataQueue);e=this.getTensorFromAudioDataArray(r,[this.numFrames,this.columnTruncateLength,1])}if(this.includeWaveform){let r=this.flattenQueue(n.timeDataQueue);t=this.getTensorFromAudioDataArray(r,[this.numFrames*this.fftSize,1])}return{value:{spectrogram:e,waveform:t},done:!1}}async capture(){return(await this.next()).value}async getAudioData(){let e=[],t=[],n=0;return new Promise(r=>{let s=setInterval(()=>{this.includeSpectrogram&&(this.analyser.getFloatFrequencyData(this.freqData),this.freqData[0]===-Infinity&&r({freqDataQueue:e,timeDataQueue:t}),e.push(this.freqData.slice(0,this.columnTruncateLength))),this.includeWaveform&&(this.analyser.getFloatTimeDomainData(this.timeData),t.push(this.timeData.slice())),++n===this.numFrames&&(clearInterval(s),r({freqDataQueue:e,timeDataQueue:t}))},this.fftSize/this.sampleRateHz*1e3)})}stop(){this.isClosed||(this.isClosed=!0,this.analyser.disconnect(),this.audioContext.close(),this.stream!=null&&this.stream.getTracks().length>0&&this.stream.getTracks()[0].stop())}toArray(){throw new Error("Can not convert infinite audio stream to array.")}getSampleRate(){return this.sampleRateHz}flattenQueue(e){let t=e[0].length,n=new Float32Array(e.length*t);return e.forEach((r,s)=>n.set(r,s*t)),n}getTensorFromAudioDataArray(e,t){let n=new Float32Array(k.sizeFromShape(t));return n.set(e,n.length-e.length),$s(n,t)}},MT=class extends xn{constructor(e,t){super();if(this.webcamVideoElement=e,this.webcamConfig=t,this.isClosed=!0,this.resize=!1,this.needToResize())if(this.resize=!0,this.cropSize=[this.webcamConfig.resizeHeight,this.webcamConfig.resizeWidth],this.cropBoxInd=_n([0],"int32"),this.webcamConfig.centerCrop){let n=this.webcamConfig.resizeWidth*1/this.webcamVideoElement.width,r=this.webcamConfig.resizeHeight*1/this.webcamVideoElement.height,s=(1-n)/2,a=(1-r)/2,o=s+n,i=r+a;this.cropBox=Ql([a,s,i,o],[1,4])}else this.cropBox=Ql([0,0,1,1],[1,4])}summary(){return"webcam"}static async create(e,t={}){if(ae().get("IS_NODE"))throw new Error("tf.data.webcam is only supported in browser environment.");if(!e){if(e=document.createElement("video"),!t.resizeWidth||!t.resizeHeight)throw new Error("Please provide webcam video element, or resizeWidth and resizeHeight to create a hidden video element.");e.width=t.resizeWidth,e.height=t.resizeHeight}let n=new MT(e,t);return await n.start(),n}async start(){this.webcamConfig.facingMode&&k.assert(this.webcamConfig.facingMode==="user"||this.webcamConfig.facingMode==="environment",()=>`Invalid webcam facing mode: ${this.webcamConfig.facingMode}. Please provide 'user' or 'environment'`);try{this.stream=await navigator.mediaDevices.getUserMedia({video:{deviceId:this.webcamConfig.deviceId,facingMode:this.webcamConfig.facingMode?this.webcamConfig.facingMode:"user",width:this.webcamVideoElement.width,height:this.webcamVideoElement.height}})}catch(e){throw e.message=`Error thrown while initializing video stream: ${e.message}`,e}if(!this.stream)throw new Error("Could not obtain video from webcam.");try{this.webcamVideoElement.srcObject=this.stream}catch(e){console.log(e),this.webcamVideoElement.src=window.URL.createObjectURL(this.stream)}return this.webcamVideoElement.play(),this.isClosed=!1,new Promise(e=>{this.webcamVideoElement.onloadedmetadata=()=>{e()}})}async next(){if(this.isClosed)return{value:null,done:!0};let e;try{e=k6.fromPixels(this.webcamVideoElement)}catch(t){throw new Error(`Error thrown converting video to pixels: ${JSON.stringify(t)}`)}if(this.resize)try{return{value:this.cropAndResizeFrame(e),done:!1}}catch(t){throw new Error(`Error thrown cropping the video: ${t.message}`)}finally{e.dispose()}else return{value:e,done:!1}}needToResize(){return!!(this.webcamConfig.resizeWidth&&this.webcamConfig.resizeHeight&&(this.webcamVideoElement.width!==this.webcamConfig.resizeWidth||this.webcamVideoElement.height!==this.webcamConfig.resizeHeight))}cropAndResizeFrame(e){return Z(()=>{let t=$r(ke(e,"float32"),0),n;n=ni.cropAndResize(t,this.cropBox,this.cropBoxInd,this.cropSize,"bilinear");let r=n.shape;return J(n,r.slice(1))})}async capture(){return(await this.next()).value}stop(){this.stream.getTracks().forEach(t=>t.stop());try{this.webcamVideoElement.srcObject=null}catch(t){console.log(t),this.webcamVideoElement.src=null}this.isClosed=!0}toArray(){throw new Error("Can not convert infinite video stream to array.")}},OT=class{},PT=class extends xn{split(e){return new uae(this,e)}},uae=class extends PT{constructor(e,t){super();this.upstream=e,this.impl=new cae(e,t)}summary(){return this.impl.summary()}async next(){return this.impl.next()}},cae=class extends C5{constructor(e,t){super();this.upstream=e,this.separator=t,this.carryover=""}summary(){return`${this.upstream.summary()} -> Split('${this.separator}')`}async pump(){let e=await this.upstream.next();if(e.done)return this.carryover===""?!1:(this.outputQueue.push(this.carryover),this.carryover="",!0);let t=e.value.split(this.separator);t[0]=this.carryover+t[0];for(let n of t.slice(0,-1))this.outputQueue.push(n);return this.carryover=t[t.length-1],!0}},dae=class extends xn{decodeUTF8(){return new hae(this)}},hae=class extends PT{constructor(e){super();this.upstream=e,this.impl=new pae(e)}summary(){return this.impl.summary()}async next(){return this.impl.next()}},pae=class extends C5{constructor(e){super();if(this.upstream=e,ae().get("IS_BROWSER"))this.decoder=new TextDecoder("utf-8");else{let{StringDecoder:t}=vR();this.decoder=new t("utf8")}}summary(){return`${this.upstream.summary()} -> Utf8`}async pump(){let e=await this.upstream.next(),t;if(e.done)return!1;t=e.value;let n;return ae().get("IS_BROWSER")?n=this.decoder.decode(t,{stream:!0}):n=this.decoder.write(Buffer.from(t.buffer)),this.outputQueue.push(n),!0}},zT=class extends dae{constructor(e,t={}){super();this.file=e,this.options=t,k.assert(e instanceof Uint8Array||(ae().get("IS_BROWSER")?e instanceof File||e instanceof Blob:!1),()=>"FileChunkIterator only supports File, Blob and Uint8Array right now."),this.offset=t.offset||0,this.chunkSize=t.chunkSize||1024*1024}summary(){return`FileChunks ${this.file}`}async next(){return this.offset>=(this.file instanceof Uint8Array?this.file.byteLength:this.file.size)?{value:null,done:!0}:{value:await new Promise((t,n)=>{let r=this.offset+this.chunkSize;if(this.file instanceof Uint8Array)t(new Uint8Array(this.file.slice(this.offset,r)));else{let s=new FileReader;s.onload=o=>{let i=s.result;if(i instanceof ArrayBuffer&&(i=new Uint8Array(i)),!(i instanceof Uint8Array))return n(new TypeError("FileReader returned unknown type."));t(i)},s.onabort=o=>n(new Error("Aborted")),s.onerror=o=>n(new Error(o.type));let a=this.file.slice(this.offset,r);s.readAsArrayBuffer(a)}this.offset=r}),done:!1}}};async function fae(e,t={}){let n,r;typeof e=="string"?n=e:(n=e.url,r=mae(e));let s=await k.fetch(n,r);if(s.ok){let a=new Uint8Array(await s.arrayBuffer());return new zT(a,t)}else throw new Error(s.statusText)}var mae=e=>({method:e.method,headers:e.headers,body:e.body,mode:e.mode,credentials:e.credentials,cache:e.cache,redirect:e.redirect,referrer:e.referrer,integrity:e.integrity});function LT(e){return typeof e=="string"&&e.substr(0,7)==="file://"}var BT=class extends OT{constructor(e,t={}){super();this.input=e,this.options=t}async iterator(){if(LT(this.input)&&ae().get("IS_NODE")){let e=co("fs");this.input=e.readFileSync(this.input.substr(7))}return new zT(this.input,this.options)}},WT=class extends OT{constructor(e,t={}){super();this.url=e,this.fileOptions=t}async iterator(){return LT(this.url)?new BT(this.url,this.fileOptions).iterator():fae(this.url,this.fileOptions)}};function gae(e,t={}){return new DT(new WT(e),t)}function yae(e){let t=N5(e);return pr(async()=>t)}function Aae(e){return pr(async()=>{let t=await e();return N5(()=>t.next())})}async function xae(e,t){return MT.create(e,t)}async function bae(e){return FT.create(e)}var vae="3.7.0";function Te(e,t){Array.isArray(e)||(e=[e]),e.forEach(n=>{n!=null&&k.assert(n.dtype!=="complex64",()=>`${t} does not support complex64 tensors in the CPU backend.`)})}var wae=ca.whereImpl,VT=class extends Bp{constructor(){super();this.blockSize=48,this.firstUse=!0,this.data=new fy(this,za())}nextDataId(){return VT.nextDataId++}write(e,t,n){this.firstUse&&(this.firstUse=!1,ae().get("IS_NODE")&&_.warn(` ============================ Hi there \u{1F44B}. Looks like you are running TensorFlow.js in Node.js. To speed things up dramatically, install our node backend, which binds to TensorFlow C++, by running npm i @tensorflow/tfjs-node, or npm i @tensorflow/tfjs-node-gpu if you have CUDA. Then call require('@tensorflow/tfjs-node'); (-gpu suffix for CUDA) at the start of your program. Visit https://github.com/tensorflow/tfjs-node for more details. -============================`));let a={id:this.nextDataId()};return this.data.set(a,{values:e,dtype:n,refCount:1}),a}makeTensorInfo(e,t,n){let a;if(t==="string"&&n!=null&&n.length>0&&k.isString(n[0])){let r=n.map(s=>k.encodeString(s));a=this.write(r,e,t)}else a=this.write(n,e,t);return{dataId:a,shape:e,dtype:t}}refCount(e){return this.data.has(e)?this.data.get(e).refCount:0}incRef(e){let t=this.data.get(e);t.refCount++}decRef(e){if(this.data.has(e)){let t=this.data.get(e);t.refCount--}}move(e,t,n,a,r){this.data.set(e,{values:t,dtype:a,refCount:r})}numDataIds(){return this.data.numDataIds()}async read(e){return this.readSync(e)}readSync(e){let{dtype:t,complexTensorInfos:n}=this.data.get(e);if(t==="complex64"){let a=this.readSync(n.real.dataId),r=this.readSync(n.imag.dataId);return M.mergeRealAndImagArrays(a,r)}return this.data.get(e).values}bufferSync(e){let t=this.readSync(e.dataId),n=t;if(e.dtype==="string")try{n=t.map(a=>k.decodeString(a))}catch(a){throw new Error("Failed to decode encoded string bytes into utf-8")}return Pe(e.shape,e.dtype,n)}makeOutput(e,t,n){let a=this.write(e,t,n);return Ps().makeTensorFromDataId(a,t,n,this)}disposeData(e,t=!1){if(this.data.has(e)){if(this.data.get(e).refCount--,!t&&this.data.get(e).refCount>0)return!1;let{complexTensorInfos:n}=this.data.get(e);n!=null&&(this.disposeData(n.real.dataId,!0),this.disposeData(n.imag.dataId,!0)),this.data.delete(e)}return!0}disposeIntermediateTensorInfo(e){this.disposeData(e.dataId)}async time(e){let t=k.now();return e(),{kernelMs:k.now()-t}}memory(){return{unreliable:!0,reasons:["The reported memory is an upper bound. Due to automatic garbage collection, the true allocated memory may be less."]}}where(e){Se([e],"where");let t=this.readSync(e.dataId);return wse(e.shape,t)}dispose(){}floatPrecision(){return 32}epsilon(){return super.epsilon()}},C5=V9;C5.nextDataId=0;var U9={};$e(U9,{addImpl:()=>H9,bincountImpl:()=>$5,bincountReduceImpl:()=>G9,ceilImpl:()=>q9,concatImpl:()=>K9,equalImpl:()=>X9,expImpl:()=>Y9,expm1Impl:()=>Q9,floorImpl:()=>eN,gatherNdImpl:()=>tN,gatherV2Impl:()=>nN,greaterEqualImpl:()=>rN,greaterImpl:()=>aN,lessEqualImpl:()=>iN,lessImpl:()=>sN,linSpaceImpl:()=>oN,logImpl:()=>lN,maxImpl:()=>uN,maximumImpl:()=>dN,minimumImpl:()=>hN,multiplyImpl:()=>R5,negImpl:()=>pN,notEqualImpl:()=>cN,prodImpl:()=>fN,rangeImpl:()=>mN,rsqrtImpl:()=>gN,simpleAbsImpl:()=>j9,sliceImpl:()=>yN,sparseFillEmptyRowsImpl:()=>AN,sparseReshapeImpl:()=>xN,sparseSegmentReductionImpl:()=>O5,squaredDifferenceImpl:()=>bN,stridedSliceImpl:()=>vN,stringNGramsImpl:()=>wN,stringSplitImpl:()=>kN,stringToHashBucketFastImpl:()=>IN,subImpl:()=>SN,tileImpl:()=>NN,topKImpl:()=>TN,transposeImpl:()=>F5,uniqueImpl:()=>EN});function j9(e){let t=new Float32Array(e.length);for(let n=0;n{let{x:t}=e.inputs,n=e.backend;Se(t,"abs");let a=new Float32Array(k.sizeFromShape(t.shape)),r=n.data.get(t.dataId).values;return a=j9(r),n.makeOutput(a,t.shape,"float32")},Ise={kernelName:xd,backendName:"cpu",kernelFunc:kse};function nn(e){return(t,n,a,r,s)=>{let i=M.assertAndGetBroadcastShape(t,n),o=i.length,l=k.computeStrides(i),u=k.sizeFromShape(i),d=k.getTypedArrayFromDType(s,u),h=t.length,p=n.length,c=k.computeStrides(t),m=k.computeStrides(n),f=M.getBroadcastDims(t,i),g=M.getBroadcastDims(n,i);if(f.length+g.length===0)for(let y=0;yx[I]=0);let v=k.locToIndex(x,h,c),b=A.slice(-p);g.forEach(I=>b[I]=0);let w=k.locToIndex(b,p,m);d[y]=e(a[v],r[w])}return[d,i]}}function ca(e){let{inputs:t,backend:n}=e,{real:a,imag:r}=t,s=n.data.get(a.dataId).values,i=n.data.get(r.dataId).values,o=n.makeTensorInfo(a.shape,"complex64"),l=n.data.get(o.dataId);return l.complexTensorInfos={real:n.makeTensorInfo(a.shape,"float32",s),imag:n.makeTensorInfo(r.shape,"float32",i)},o}var Sse={kernelName:k1,backendName:"cpu",kernelFunc:ca};function C0(e,t,n="float32"){if(n==="complex64"){let r=C0(e,t,"float32"),s=C0(e,t,"float32");return ca({inputs:{real:r,imag:s},backend:e})}let a=k.makeZerosTypedArray(k.sizeFromShape(t),n);return e.makeTensorInfo(t,n,a)}function zr(e){let{inputs:t,backend:n}=e,{x:a}=t;return n.incRef(a.dataId),{dataId:a.dataId,shape:a.shape,dtype:a.dtype}}var Nse={kernelName:pl,backendName:"cpu",kernelFunc:zr};function co(e){let{inputs:t,backend:n}=e,{input:a}=t,r=n.data.get(a.dataId).complexTensorInfos.real,s=n.data.get(r.dataId).values;return n.makeTensorInfo(r.shape,r.dtype,s)}var Tse={kernelName:j1,backendName:"cpu",kernelFunc:co};function Js(e){let{inputs:t,backend:n,attrs:a}=e,{x:r}=t,{dtype:s}=a;if(s==="complex64"){if(r.dtype==="complex64")return zr({inputs:{x:r},backend:n});let i=C0(n,r.shape,r.dtype),o=Js({inputs:{x:r},backend:n,attrs:{dtype:"float32"}}),l=ca({inputs:{real:o,imag:i},backend:n});return n.disposeIntermediateTensorInfo(i),n.disposeIntermediateTensorInfo(o),l}if(r.dtype==="complex64"){let i=co({inputs:{input:r},backend:n}),o=Js({inputs:{x:i},backend:n,attrs:{dtype:s}});return n.disposeIntermediateTensorInfo(i),o}if(!k.hasEncodingLoss(r.dtype,s)){let i=zr({inputs:{x:r},backend:n});return{dataId:i.dataId,shape:i.shape,dtype:s}}if(s==="int32"){let i=n.data.get(r.dataId).values,o=Int32Array.from(i);return n.makeTensorInfo(r.shape,"int32",o)}if(s==="bool"){let i=n.data.get(r.dataId).values,o=k.toTypedArray([0],r.dtype),[l,u]=nn((d,h)=>d!==h?1:0)(r.shape,[],i,o,"bool");return n.makeTensorInfo(u,"bool",l)}throw new Error(`Error in Cast: failed to cast ${r.dtype} to ${s}`)}var Ese={kernelName:el,backendName:"cpu",kernelFunc:Js};function bn(e,t,n,a){return n==null?({inputs:r,backend:s})=>{let{a:i,b:o}=r,l=s;Se([i,o],e);let u=l.data.get(i.dataId).values,d=l.data.get(o.dataId).values,h=i.dtype==="string"?M.fromUint8ToStringArray(u):u,p=i.dtype==="string"?M.fromUint8ToStringArray(d):d,c=a||i.dtype,[m,f]=t(i.shape,o.shape,h,p,c);return l.makeTensorInfo(f,c,m)}:({inputs:r,backend:s})=>{let{a:i,b:o}=r,l=s;if(i.dtype==="complex64"||o.dtype==="complex64"){let u=Js({inputs:{x:i},backend:l,attrs:{dtype:"complex64"}}),d=l.data.get(u.dataId),h=d.complexTensorInfos.real,p=d.complexTensorInfos.imag,c=l.data.get(h.dataId).values,m=l.data.get(p.dataId).values,f=Js({inputs:{x:o},backend:l,attrs:{dtype:"complex64"}}),g=l.data.get(f.dataId),y=g.complexTensorInfos.real,A=g.complexTensorInfos.imag,x=l.data.get(y.dataId).values,v=l.data.get(A.dataId).values,[b,w,I]=n(i.shape,o.shape,c,m,x,v),T=l.makeTensorInfo(I,"float32",b),C=l.makeTensorInfo(I,"float32",w),z=ca({inputs:{real:T,imag:C},backend:l});return l.disposeIntermediateTensorInfo(u),l.disposeIntermediateTensorInfo(f),l.disposeIntermediateTensorInfo(T),l.disposeIntermediateTensorInfo(C),z}else{let u=l.data.get(i.dataId).values,d=l.data.get(o.dataId).values,h=a||i.dtype,[p,c]=t(i.shape,o.shape,u,d,h);return l.makeTensorInfo(c,h,p)}}}function M5(e){return(t,n,a,r,s,i)=>{let o=M.assertAndGetBroadcastShape(t,n),l=k.sizeFromShape(o),u=o.length,d=k.computeStrides(o),h=k.getTypedArrayFromDType("float32",l),p=k.getTypedArrayFromDType("float32",l),c=M.getBroadcastDims(t,o),m=M.getBroadcastDims(n,o),f=M.mergeRealAndImagArrays(a,r),g=M.mergeRealAndImagArrays(s,i),y=t.length,A=k.computeStrides(t),x=n.length,v=k.computeStrides(n);if(c.length+m.length===0)for(let b=0;bI[S]=0);let T=k.locToIndex(I,y,A),C=w.slice(-x);m.forEach(S=>C[S]=0);let z=k.locToIndex(C,x,v),$=e(f[T*2],f[T*2+1],g[z*2],g[z*2+1]);h[b]=$.real,p[b]=$.imag}return[h,p,o]}}var H9=nn((e,t)=>e+t),Cse=M5((e,t,n,a)=>({real:e+n,imag:t+a})),tp=bn(Os,H9,Cse),Mse={kernelName:Os,backendName:"cpu",kernelFunc:tp};function $5(e,t,n,a,r){let s=k.sizeFromShape(a),i=k.makeZerosTypedArray(r,n);for(let o=0;o=r||(s>0?i[l]+=t[o]:i[l]+=1)}return i}function G9(e,t,n,a=!1){let r=e.shape[0],s=e.shape[1],i=Pe([r,n],t.dtype);for(let o=0;o=n||(a?i.set(1,o,u):t.size>0?i.set(i.get(o,u)+t.get(o,l),o,u):i.set(i.get(o,u)+1,o,u))}return i}function du(e){return(t,n,a)=>{let r=k.getTypedArrayFromDType(n,t.length);for(let s=0;s{let{x:i}=a;if(Se(i,e),i.dtype==="string"||n==="string")throw new Error("unaryKernelFunc does not support string input/output");let o=s,l=o.data.get(i.dataId).values,u=k.sizeFromShape(i.shape),d=n||i.dtype,h=k.getArrayFromDType(d,u);for(let p=0;p{let{x:i}=a;if(Se(i,e),i.dtype==="string"||n==="string")throw new Error("unaryKernelFunc does not support string input/output");let o=s,l=o.data.get(i.dataId).values,u=n||i.dtype,d=t(l,u,r);return o.makeTensorInfo(i.shape,u,d)}}var q9=du(e=>Math.ceil(e)),$se=hu(Ni,q9),Rse={kernelName:Ni,backendName:"cpu",kernelFunc:$se};function K9(e,t,n,a){let r=k.getArrayFromDType(n,k.sizeFromShape(t));if(a&&n!=="string"){let s=0;e.forEach(i=>{let o=k.sizeFromShape(i.shape);r.set(i.vals,s),s+=o})}else{let s=0;e.forEach(i=>{let o=n==="string"?M.fromUint8ToStringArray(i.vals):i.vals,l=0;for(let u=0;ue===t?1:0),Z9=bn(ol,X9,null,"bool"),Fse={kernelName:ol,backendName:"cpu",kernelFunc:Z9},Y9=du(e=>Math.exp(e)),J9=hu(Ei,Y9),Ose={kernelName:Ei,backendName:"cpu",kernelFunc:J9},Q9=du(e=>Math.expm1(e)),Dse=hu(ll,Q9),_se={kernelName:ll,backendName:"cpu",kernelFunc:Dse},eN=du(e=>Math.floor(e)),zse=hu(Ci,eN),Pse={kernelName:Ci,backendName:"cpu",kernelFunc:zse};function tN(e,t,n,a,r,s,i,o,l){let u=Pe([a,s],n);for(let d=0;d=l/s)throw new Error(`Invalid indices: ${h} does not index into ${o}`);for(let c=0;ce>t?1:0),Lse=bn(hl,aN,null,"bool"),Wse={kernelName:hl,backendName:"cpu",kernelFunc:Lse},rN=nn((e,t)=>e>=t?1:0),Bse=bn(Mi,rN,null,"bool"),Vse={kernelName:Mi,backendName:"cpu",kernelFunc:Bse},sN=nn((e,t)=>ee<=t?1:0),Hse=bn(ml,iN,null,"bool"),Gse={kernelName:ml,backendName:"cpu",kernelFunc:Hse};function oN(e,t,n){let a=(t-e)/(n-1),r=k.makeZerosTypedArray(n,"float32");r[0]=e;for(let s=1;sMath.log(e)),qse=hu($i,lN),Kse={kernelName:$i,backendName:"cpu",kernelFunc:qse};function uN(e,t,n,a){let r=k.getTypedArrayFromDType(a,k.sizeFromShape(n));for(let s=0;so)&&(o=u)}r[s]=o}return r}var dN=nn((e,t)=>Math.max(e,t)),Xse=bn(Ri,dN),Zse={kernelName:Ri,backendName:"cpu",kernelFunc:Xse},hN=nn((e,t)=>Math.min(e,t)),Yse=bn(Fi,hN),Jse={kernelName:Fi,backendName:"cpu",kernelFunc:Yse},R5=nn((e,t)=>e*t),Qse=M5((e,t,n,a)=>({real:e*n-t*a,imag:e*a+t*n})),M0=bn(Oi,R5,Qse),eie={kernelName:Oi,backendName:"cpu",kernelFunc:M0};function pN(e,t,n){let a=k.createScalarValue(-1,n);return R5([],t,a,e,n)}function tie(e){let{inputs:t,backend:n}=e,{x:a}=t;Se(a,"neg");let r=n.data.get(a.dataId).values,[s,i]=pN(r,a.shape,a.dtype);return n.makeTensorInfo(i,a.dtype,s)}var nie={kernelName:Hd,backendName:"cpu",kernelFunc:tie},cN=nn((e,t)=>e!==t?1:0),aie=bn(vl,cN,null,"bool"),rie={kernelName:vl,backendName:"cpu",kernelFunc:aie};function F5(e,t,n,a,r){let s=t.length,i=k.sizeFromShape(t),o=k.computeStrides(t),l=k.computeStrides(r),u=k.getTypedArrayFromDType(n,k.sizeFromShape(r));for(let d=0;dn.disposeIntermediateTensorInfo(A)),n.makeTensorInfo(y,g,m)}var oie={kernelName:Yd,backendName:"cpu",kernelFunc:iie};function mN(e,t,n,a){let r=e===t,s=e1;if(r||s||i)return k.makeZerosTypedArray(0,a);let o=Math.abs(Math.ceil((t-e)/n)),l=k.makeZerosTypedArray(o,a);t1/Math.sqrt(e)),lie=hu(Di,gN),uie={kernelName:Di,backendName:"cpu",kernelFunc:lie};function yN(e,t,n,a,r){let s=Cn.isSliceContinous(a,t,n),i=k.sizeFromShape(n),o=k.computeStrides(a);if(s){let h=Cn.computeFlatOffset(t,o);return r==="string"?e.slice(h,h+i):e.subarray(h,h+i)}let l=r==="string"?M.fromUint8ToStringArray(e):e,u=Pe(a,r,l),d=Pe(n,r);for(let h=0;hm+t[f]);d.set(u.get(...c),...p)}return r==="string"?M.fromStringArrayToUint8(d.values):d.values}function fo(e){let{inputs:t,backend:n,attrs:a}=e,{x:r}=t,{begin:s,size:i}=a;Se(r,"slice");let[o,l]=Cn.parseSliceParams(r,s,i);Cn.assertParamsValid(r,o,l);let u=n.data.get(r.dataId).values,d=yN(u,o,l,r.shape,r.dtype);return n.makeTensorInfo(l,r.dtype,d)}var die={kernelName:ah,backendName:"cpu",kernelFunc:fo};function AN(e,t,n,a,r,s,i){let o=t[0],l=s[0],u=new Array(l),d=new Array(o),h=t[1];if(l===0){if(o!==0)throw new Error(`Received SparseTensor with denseShape[0] = 0 but - indices.shape[0] = ${o}`);let g=k.getArrayFromDType(n,0),y=k.getArrayFromDType(r,0);return[g,[0,h],y,u,d]}let p=!0,c=0,m=new Array(l).fill(0);for(let g=0;g=l)throw new Error(`indices(${g}, 0) is invalid: ${y} >= ${l}`);++m[y],p=p&&y>=c,c=y}let f=!0;for(let g=0;g0&&(m[g]+=m[g-1])}if(f&&p){let g=e,y=a;for(let A=0;A0){c[p-1]=1;for(let g=p-2;g>=0;--g)c[g]=c[g+1]*a[g+1]}let m=[];if(o>0){m[o-1]=1;for(let g=o-2;g>=0;--g)m[g]=m[g+1]*l[g+1]}let f=k.getArrayFromDType(n,i*o);for(let g=0;g0?r[o-1]+1:0;if(d<0)throw new Error("segment ids must be >= 0");let h=t.slice();h[0]=d;let p=h.reduce((A,x)=>A*x,1),c=k.getArrayFromDType(n,p);if(o===0)return d>0&&c.fill(i),[c,h];if(d<=0)throw new Error("segment ids must be >= 0");let m=0,f=1,g=0,y=r[m];for(;;){let A=0;if(f=A)throw new Error("segment ids are not increasing")}if(y<0||y>=d)throw new Error(`Segment id ${y} out of range [0, ${d}), possibly because segmentIds input is not sorted.`);y>g&&c.fill(i,g*u,y*u);for(let x=m;x=l[0])throw new Error(`Bad: indices[${x}] == ${a[x]} out of range [0, ${l[0]})`);for(let b=0;bo)break}return g{let n=e-t;return n*n}),hie=bn(_i,bN),pie={kernelName:_i,backendName:"cpu",kernelFunc:hie};function vN(e,t,n,a){let r=Pe(e,t.dtype);for(let s=0;s0?0:i-o),p=0;p+=l*this.leftPad.length;for(let g=0;gg.forEach(y=>c[m++]=y);for(let g=0;g0){f(e[h+d-1]);for(let g=0;g0){let o=t[0];if(o!==0)throw new Error(`First split value must be 0, got ${o}`);for(let l=1;l=o;if(u=u&&t[l]<=n,!u)throw new Error(`Invalid split value ${t[l]}, must be in [${o}, ${n}]`);o=t[l]}if(o!==n)throw new Error(`Last split value must be data size. Expected ${n}, got ${o}`)}let r=a-1,s=k.getArrayFromDType("int32",a);if(n===0||a===0){let o=new Array(n);for(let l=0;l<=r;++l)s[l]=0;return[o,s]}s[0]=0;for(let o=1;o<=r;++o){let l=t[o]-t[o-1],u=0;this.nGramWidths.forEach(d=>{u+=this.getNumNGrams(l,d)}),this.preserveShort&&l>0&&u===0&&(u=1),s[o]=s[o-1]+u}let i=new Array(s[r]);for(let o=0;o{let h=t[o+1]-t[o],p=this.getNumNGrams(h,d);this.createNGrams(e,l,i,u,p,d),u+=p}),this.preserveShort&&u===s[o]){let d=t[o+1]-t[o];if(d===0)continue;let h=d+2*this.padWidth,p=1;this.createNGrams(e,l,i,u,p,h)}}return[i,s]}};function wN(e,t,n,a,r,s,i,o){return new cie(n,a,r,s,i,o).compute(e,t)}function fie(e,t,n){if(!e.length)return[];if(t.length===0){let s=new Array(e.length);for(let i=0;ie-t),mie=M5((e,t,n,a)=>({real:e-n,imag:t-a})),D5=bn(zi,SN,mie),gie={kernelName:zi,backendName:"cpu",kernelFunc:D5};function NN(e,t){let n=new Array(e.rank);for(let r=0;rx.value-A.value);let f=h*a,g=l.subarray(f,f+a),y=u.subarray(f,f+a);for(let A=0;A{for(let g=0;gnew C5,1);var CN=xt(Fd,e=>e>=0?e:Math.exp(e)-1),Aie={kernelName:Fd,backendName:"cpu",kernelFunc:CN};function MN(e){let{inputs:t,backend:n,attrs:a}=e,{x:r}=t,{alpha:s}=a;Se([r],"leakyRelu");let i=k.sizeFromShape(r.shape),o=n.data.get(r.dataId).values,l=k.getTypedArrayFromDType("float32",i);for(let u=0;ue<0?t*e:e);function $N(e){let{inputs:t,backend:n}=e,{x:a,alpha:r}=t;Se([a,r],"prelu");let s=n.data.get(a.dataId).values,i=n.data.get(r.dataId).values,[o,l]=bie(a.shape,r.shape,s,i,a.dtype);return n.makeTensorInfo(l,a.dtype,o)}var vie={kernelName:Sl,backendName:"cpu",kernelFunc:$N},RN=xt(Nl,e=>Math.max(0,e)),wie={kernelName:Nl,backendName:"cpu",kernelFunc:RN},FN=xt(El,e=>Math.min(Math.max(0,e),6)),kie={kernelName:El,backendName:"cpu",kernelFunc:FN},ON=xt(Rl,e=>1/(1+Math.exp(-e))),Iie={kernelName:Rl,backendName:"cpu",kernelFunc:ON};function _5(e,t,n,a,r){if(n==="linear")return zr({inputs:{x:t},backend:e});if(n==="relu")return RN({inputs:{x:t},backend:e});if(n==="elu")return CN({inputs:{x:t},backend:e});if(n==="relu6")return FN({inputs:{x:t},backend:e});if(n==="prelu")return $N({inputs:{x:t,alpha:a},backend:e});if(n==="leakyrelu")return MN({inputs:{x:t},backend:e,attrs:{alpha:r}});if(n==="sigmoid")return ON({inputs:{x:t},backend:e});throw new Error(`Activation ${n} has not been implemented for the CPU backend.`)}function Ot(e){let{inputs:t,backend:n,attrs:a}=e,{x:r}=t,{shape:s}=a,i=k.sizeFromShape(r.shape),o=k.inferFromImplicitShape(s,i),l=k.sizeFromShape(o);k.assert(i===l,()=>`The new shape (${o}) has ${l} elements and the old shape (${r.shape}) has ${i} elements. The new shape and old shape must have the same number of elements.`),n.incRef(r.dataId);let u=n.data.get(r.dataId);if(u.complexTensorInfos!=null){let d=u.complexTensorInfos.real,h=u.complexTensorInfos.imag;d.shape=o,h.shape=o}return{dataId:r.dataId,shape:o,dtype:r.dtype}}var Sie={kernelName:Qd,backendName:"cpu",kernelFunc:Ot};function DN(e){let{inputs:t,backend:n,attrs:a}=e,{a:r,b:s}=t,{transposeA:i,transposeB:o}=a;Se([r,s],"matMul");let l=r.shape.length,u=s.shape.length,d=i?r.shape[l-2]:r.shape[l-1],h=o?s.shape[u-1]:s.shape[u-2],p=i?r.shape[l-1]:r.shape[l-2],c=o?s.shape[u-2]:s.shape[u-1],m=r.shape.slice(0,-2),f=s.shape.slice(0,-2),g=k.sizeFromShape(m),y=k.sizeFromShape(f),A=g===y||g===1||y===1;k.assert(l>=2&&u>=2&&A,()=>`Error in matMul: the input batch dimensions must either be the same or at least one input batch dimension must be 1. Got input batch dimensions of (${m}) and (${f}).`);let x=(g>y?r.shape.slice(0,-2):s.shape.slice(0,-2)).concat([p,c]);k.assert(d===h,()=>`Error in matMul: inner shapes (${d}) and (${h}) of Tensors with shapes ${r.shape} and ${s.shape} and transposeA=${i} and transposeB=${o} must match.`);let v=i?[g,d,p]:[g,p,d],b=o?[y,c,h]:[y,h,c],w=Ot({inputs:{x:r},backend:n,attrs:{shape:v}}),I=Ot({inputs:{x:s},backend:n,attrs:{shape:b}}),T=i?w.shape[1]:w.shape[2],C=i?w.shape[2]:w.shape[1],z=o?I.shape[1]:I.shape[2],$=Math.max(g,y),S=n.data.get(w.dataId).values,D=n.data.get(I.dataId).values,_=k.computeStrides(w.shape),W=k.computeStrides(I.shape),[X,q,Q]=i?[_[0],1,_[1]]:[_[0],_[1],1],[ee,ie,ae]=o?[1,W[1],W[0]]:[W[1],1,W[0]],de=C*z,te=Pe([$,C,z],w.dtype),ce=te.values,he=n.blockSize;for(let ve=0;ve<$;ve++)for(let xe=0;xeMath.acos(e)),Mie={kernelName:bd,backendName:"cpu",kernelFunc:Cie},$ie=xt(vd,e=>Math.acosh(e)),Rie={kernelName:vd,backendName:"cpu",kernelFunc:$ie};function Fie(e){let{inputs:t,backend:n}=e,a=t;Se(t,"addN");let r=a.map(o=>n.data.get(o.dataId).values),s=Pe(a[0].shape,a[0].dtype),i=s.values;for(let o=0;oA&&(A=b,x=v)}c[g]=x}return u.forEach(g=>n.disposeIntermediateTensorInfo(g)),n.makeTensorInfo(d,"int32",c)}var Wie={kernelName:Yo,backendName:"cpu",kernelFunc:Lie};function Bie(e){let{inputs:t,backend:n,attrs:a}=e,{x:r}=t,{axis:s}=a;Se(r,"argMin");let i=k.parseAxisParam(s,r.shape),o=M.getAxesPermutation(i,r.shape.length),l=r,u=[];o!=null&&(l=Da({inputs:{x:r},backend:n,attrs:{perm:o}}),u.push(l),i=M.getInnerMostAxes(i.length,l.shape.length)),i=[i[0]],M.assertAxesAreInnerMostDims("argMin",i,l.shape.length);let[d,h]=M.computeOutAndReduceShapes(l.shape,i),p=k.sizeFromShape(d),c=k.makeZerosTypedArray(p,"int32"),m=k.sizeFromShape(h),f=n.data.get(l.dataId).values;for(let g=0;gn.disposeIntermediateTensorInfo(g)),n.makeTensorInfo(d,"int32",c)}var Vie={kernelName:qc,backendName:"cpu",kernelFunc:Bie},Uie=xt(Id,e=>Math.asin(e)),jie={kernelName:Id,backendName:"cpu",kernelFunc:Uie},Hie=xt(Sd,e=>Math.asinh(e)),Gie={kernelName:Sd,backendName:"cpu",kernelFunc:Hie},qie=xt(Nd,e=>Math.atan(e)),Kie={kernelName:Nd,backendName:"cpu",kernelFunc:qie},Xie=nn((e,t)=>Math.atan2(e,t)),Zie=bn(Ed,Xie),Yie={kernelName:Ed,backendName:"cpu",kernelFunc:Zie},Jie=xt(Td,e=>Math.atanh(e)),Qie={kernelName:Td,backendName:"cpu",kernelFunc:Jie};function z5(e,t,n,a,r,s){let i=r.strideHeight,o=r.strideWidth,l=r.dilationHeight,u=r.dilationWidth,d=r.effectiveFilterHeight,h=r.effectiveFilterWidth,p=r.padInfo.top,c=r.padInfo.left,m=s==="max"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,f=Pe(r.outShape,n),g=f.values,y=r.outShape[1]*r.outShape[2]*r.outShape[3],A=r.outShape[2]*r.outShape[3],x=r.outShape[3];for(let v=0;vq?q=he:s==="avg"&&(Q+=he,ee++)}if(isNaN(q))break}let ie=S+D*x+I;g[ie]=s==="avg"?Q/ee:q}}}return f}function _N(e,t,n,a,r=!1,s=!1){let i=Pe(a.outShape,"int32"),o=a.strideHeight,l=a.strideWidth,u=a.dilationHeight,d=a.dilationWidth,h=a.effectiveFilterHeight,p=a.effectiveFilterWidth,c=a.padInfo.top,m=a.padInfo.left,f=Pe(t,n,e);for(let g=0;gz&&(z=X,r?$=s?((g*a.inHeight+S)*a.inWidth+_)*a.inChannels+y:(S*a.inWidth+_)*a.inChannels+y:$=D*p+W)}}i.set($,g,A,w,y)}}return i}function zN(e,t,n,a,r,s){let i=r.strideDepth,o=r.strideHeight,l=r.strideWidth,u=r.dilationDepth,d=r.dilationHeight,h=r.dilationWidth,p=r.effectiveFilterDepth,c=r.effectiveFilterHeight,m=r.effectiveFilterWidth,f=r.padInfo.front,g=r.padInfo.top,y=r.padInfo.left,A=s==="max"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,x=Pe(r.outShape,n),v=x.values,b=r.outShape[1]*r.outShape[2]*r.outShape[3]*r.outShape[4],w=r.outShape[2]*r.outShape[3]*r.outShape[4],I=r.outShape[3]*r.outShape[4],T=r.outShape[4];for(let C=0;CEe?Ee=Je:s==="avg"&&(Fe+=Je,We++),isNaN(Ee))break}if(isNaN(Ee))break}if(isNaN(Ee))break}let qe=xe+S;v[qe]=s==="avg"?Fe/We:Ee}}}}return x}function eoe(e,t){let n=Pe(t.outShape,"int32"),a=t.strideDepth,r=t.strideHeight,s=t.strideWidth,i=t.dilationDepth,o=t.dilationHeight,l=t.dilationWidth,u=t.effectiveFilterDepth,d=t.effectiveFilterHeight,h=t.effectiveFilterWidth,p=t.padInfo.front,c=t.padInfo.top,m=t.padInfo.left;for(let f=0;f=D&&(D=ae,_=X*d*h+Q*d+ie)}}}n.set(_,f,y,b,C,g)}}}return n}function toe(e){let{inputs:t,backend:n,attrs:a}=e,{x:r}=t;Se(r,"avgPool");let{filterSize:s,strides:i,pad:o,dimRoundingMode:l}=a,u=1;k.assert(M.eitherStridesOrDilationsAreOne(i,u),()=>`Error in avgPool: Either strides or dilations must be 1. Got strides ${i} and dilations '${u}'`);let d=M.computePool2DInfo(r.shape,s,i,u,o,l),h;if(d.filterWidth===1&&d.filterHeight===1&&k.arraysEqual(d.inShape,d.outShape))h=zr({inputs:{x:r},backend:n});else{let p=n.data.get(r.dataId).values,c=k.computeStrides(r.shape),m=z5(p,r.shape,r.dtype,c,d,"avg");h=n.makeTensorInfo(d.outShape,r.dtype,m.values)}return h}var noe={kernelName:Jo,backendName:"cpu",kernelFunc:toe};function aoe(e){let{inputs:t,backend:n,attrs:a}=e,{x:r}=t,{filterSize:s,strides:i,pad:o,dimRoundingMode:l,dataFormat:u}=a;Se(r,"avgPool3d");let d=M.computePool3DInfo(r.shape,s,i,1,o,l,u),h=n.data.get(r.dataId).values,p=zN(h,r.shape,r.dtype,k.computeStrides(r.shape),d,"avg");return n.makeTensorInfo(p.shape,"float32",p.values)}var roe={kernelName:Kc,backendName:"cpu",kernelFunc:aoe};function soe(e){let{inputs:t,backend:n,attrs:a}=e,{dy:r,input:s}=t,{filterSize:i,strides:o,pad:l,dimRoundingMode:u}=a;Se([r,s],"avgPool3DGrad");let d=M.computePool3DInfo(s.shape,i,o,1,l,u),h=d.strideDepth,p=d.strideHeight,c=d.strideWidth,m=d.filterDepth,f=d.filterHeight,g=d.filterWidth,y=d.dilationDepth,A=d.dilationHeight,x=d.dilationWidth,v=d.effectiveFilterDepth,b=d.effectiveFilterHeight,w=d.effectiveFilterWidth,I=v-1-d.padInfo.front,T=w-1-d.padInfo.left,C=b-1-d.padInfo.top,z=Pe(s.shape,"float32"),$=1/(m*f*g),S=n.bufferSync(r);for(let D=0;D=d.outDepth||Math.floor(te)!==te))for(let ce=0;ce=d.outHeight||Math.floor(he)!==he))for(let ve=0;ve=d.outWidth||Math.floor(xe)!==xe||(ae+=S.get(D,te,he,xe,_))}}}z.set(ae*$,D,W,X,q,_)}return n.makeTensorInfo(z.shape,z.dtype,z.values)}var ioe={kernelName:v1,backendName:"cpu",kernelFunc:soe};function ooe(e){let{inputs:t,backend:n,attrs:a}=e,{dy:r,input:s}=t,i=s;Se([r,s],"avgPoolGrad");let{filterSize:o,strides:l,pad:u}=a,d=M.computePool2DInfo(i.shape,o,l,1,u),h=d.strideHeight,p=d.strideWidth,c=d.filterHeight,m=d.filterWidth,f=d.dilationHeight,g=d.dilationWidth,y=d.effectiveFilterHeight,A=d.effectiveFilterWidth,x=A-1-d.padInfo.left,v=y-1-d.padInfo.top,b=Pe(i.shape,"float32"),w=1/(c*m),I=n.data.get(r.dataId).values,T=Pe(r.shape,"float32",I);for(let C=0;C=d.outHeight||Math.floor(q)!==q))for(let Q=0;Q=d.outWidth||Math.floor(ee)!==ee||(W+=T.get(C,q,ee,z))}}b.set(W*w,C,$,S,z)}return n.makeTensorInfo(b.shape,b.dtype,b.values)}var loe={kernelName:b1,backendName:"cpu",kernelFunc:ooe};function uoe(e){let{inputs:t,backend:n,attrs:a}=e,{x:r,scale:s,offset:i,mean:o,variance:l}=t;k.assert(o.shape.length===l.shape.length,()=>"Batch normalization gradient requires mean and variance to have equal ranks."),k.assert(i==null||o.shape.length===i.shape.length,()=>"Batch normalization gradient requires mean and offset to have equal ranks."),k.assert(s==null||o.shape.length===s.shape.length,()=>"Batch normalization gradient requires mean and scale to have equal ranks."),Se([r,o,l,s,i],"batchNorm");let{varianceEpsilon:u}=a;u==null&&(u=.001);let d=n.data.get(r.dataId).values,h=n.data.get(o.dataId).values,p=n.data.get(l.dataId).values,c=s?n.data.get(s.dataId).values:new Float32Array([1]),m=i?n.data.get(i.dataId).values:new Float32Array([0]),f=new Float32Array(d.length),g=m.length,y=c.length,A=p.length,x=h.length,v=0,b=0,w=0,I=0;for(let T=0;T=g&&(v=0),b>=x&&(b=0),w>=y&&(w=0),I>=A&&(I=0);return n.makeTensorInfo(r.shape,r.dtype,f)}var doe={kernelName:dl,backendName:"cpu",kernelFunc:uoe};function hoe(e){let{inputs:t,backend:n,attrs:a}=e,{x:r}=t,{blockShape:s,crops:i}=a;Se([r],"batchToSpaceND");let o=s.reduce((y,A)=>y*A),l=M.getReshaped(r.shape,s,o),u=M.getPermuted(l.length,s.length),d=M.getReshapedPermuted(r.shape,s,o),h=M.getSliceBeginCoords(i,s.length),p=M.getSliceSize(d,i,s.length),c=Ot({inputs:{x:r},backend:n,attrs:{shape:l}}),m=Da({inputs:{x:c},backend:n,attrs:{perm:u}}),f=Ot({inputs:{x:m},backend:n,attrs:{shape:d}}),g=fo({inputs:{x:f},backend:n,attrs:{begin:h,size:p}});return n.disposeIntermediateTensorInfo(c),n.disposeIntermediateTensorInfo(m),n.disposeIntermediateTensorInfo(f),g}var poe={kernelName:Xc,backendName:"cpu",kernelFunc:hoe};function coe(e){let{inputs:t,backend:n,attrs:a}=e,{x:r,weights:s}=t,{size:i}=a,o=n.data.get(r.dataId).values,l=n.data.get(s.dataId).values,u=$5(o,l,s.dtype,s.shape,i);return n.makeTensorInfo([i],s.dtype,u)}var foe={kernelName:w1,backendName:"cpu",kernelFunc:coe},moe=xt(Ti,(e,t)=>{let n=t;return e>n.clipValueMax?n.clipValueMax:e{let{x:t}=e.inputs,n=e.backend,a=new Float32Array(k.sizeFromShape(t.shape)),r=n.data.get(t.dataId),s=r.complexTensorInfos.real,i=r.complexTensorInfos.imag,o=n.data.get(s.dataId).values,l=n.data.get(i.dataId).values;for(let u=0;uf.shape),s);if(k.sizeFromShape(i)===0)return n.makeTensorInfo(i,t[0].dtype,[]);let o=t.filter(f=>k.sizeFromShape(f.shape)>0);if(o.length===1)return zr({inputs:{x:o[0]},backend:n});let l=o.map(f=>f.shape);if(M.assertParamsConsistent(l,s),o[0].dtype==="complex64"){let f=o.map(v=>co({inputs:{input:v},backend:n})),g=o.map(v=>pu({inputs:{input:v},backend:n})),y=cu({inputs:f,backend:n,attrs:{axis:s}}),A=cu({inputs:g,backend:n,attrs:{axis:s}}),x=ca({inputs:{real:y,imag:A},backend:n});return f.forEach(v=>n.disposeIntermediateTensorInfo(v)),g.forEach(v=>n.disposeIntermediateTensorInfo(v)),n.disposeIntermediateTensorInfo(y),n.disposeIntermediateTensorInfo(A),x}let u=o.map(f=>{let g=k.sizeFromShape(f.shape.slice(s));return Ot({inputs:{x:f},backend:n,attrs:{shape:[-1,g]}})}),d=u.map(f=>({vals:n.data.get(f.dataId).values,shape:f.shape}));i=M.computeOutShape(u.map(f=>f.shape),1);let h=u[0].shape[0]===1,p=K9(d,i,t[0].dtype,h),c=M.computeOutShape(o.map(f=>f.shape),s),m=n.makeTensorInfo(c,t[0].dtype,p);return u.forEach(f=>n.disposeIntermediateTensorInfo(f)),m}var boe={kernelName:Cd,backendName:"cpu",kernelFunc:cu};function PN(e){let{inputs:t,backend:n,attrs:a}=e,{x:r,filter:s}=t,{strides:i,pad:o,dataFormat:l,dilations:u,dimRoundingMode:d}=a;Se([r,s],"conv2d");let h=M.convertConv2DDataFormat(l),p=M.computeConv2DInfo(r.shape,s.shape,i,u,o,d,!1,h),c=p.filterHeight,m=p.filterWidth,f=p.dilationHeight,g=p.dilationWidth,y=p.padInfo.left,A=p.padInfo.top,x=p.dataFormat==="channelsLast",v=new Qt(p.outShape,r.dtype),b=k.computeStrides(r.shape),w=k.computeStrides(s.shape),I=b[0],T=x?b[1]:b[2],C=x?b[2]:1,z=x?1:b[1],$=v.strides[0],S=x?v.strides[1]:v.strides[2],D=x?v.strides[2]:1,_=x?1:v.strides[1],W=n.data.get(r.dataId).values,X=n.data.get(s.dataId).values,q=v.values;for(let Q=0;Q=p.inHeight)continue;let ve=ce*w[0],xe=ee+he*T;for(let Ee=0;Ee=p.inWidth)continue;let ft=ve+qe*w[1],mt=xe+Be*C,bt=ft;for(let lt=0;lt=u.inDepth)continue;let Q=X*C[0],ee=$+q*T[1];for(let ie=0;ie=u.inHeight)continue;let he=Q+te*C[1],ve=ee+ce*T[2];for(let xe=0;xe=u.inWidth)continue;let Be=he+We*C[2],ft=ve+qe*u.inChannels,mt=Be;for(let bt=0;btMath.cos(e)),Foe={kernelName:al,backendName:"cpu",kernelFunc:Roe},Ooe=xt(Md,e=>Math.cosh(e)),Doe={kernelName:Md,backendName:"cpu",kernelFunc:Ooe};function _oe(e){let{inputs:t,backend:n,attrs:a}=e,{image:r,boxes:s,boxInd:i}=t,{cropSize:o,method:l,extrapolationValue:u}=a,[d,h,p,c]=r.shape,m=s.shape[0],[f,g]=o,y=Pe([m,f,g,c],"float32"),A=n.data.get(s.dataId).values,x=n.data.get(i.dataId).values,v=n.data.get(r.dataId).values,b=k.computeStrides(r.shape),w=k.computeStrides(y.shape);for(let I=0;I=d)continue;let _=f>1?($-C)*(h-1)/(f-1):0,W=g>1?(S-z)*(p-1)/(g-1):0;for(let X=0;X1?C*(h-1)+X*_:.5*(C+$)*(h-1);if(q<0||q>h-1){for(let Q=0;Q1?z*(p-1)+ae*W:.5*(z+S)*(p-1);if(de<0||de>p-1){for(let ve=0;ve1?z*(p-1)+Q*W:.5*(z+S)*(p-1);if(ee<0||ee>p-1){for(let de=0;dey+m-A-1:(y,A)=>y+A;for(let y=0;y`Only NHWC dataFormat supported on CPU for depthToSpace. Got ${i}`),k.assert(s>1,()=>`blockSize should be > 1 for depthToSpace, but was: ${s}`);let o=r.shape[0],l=r.shape[1],u=r.shape[2],d=r.shape[3],h=l*s,p=u*s,c=d/(s*s),m=n.data.get(r.dataId).values,f=new Float32Array(o*h*p*c),g=0;for(let y=0;y`Error in depthwiseConv2d: Either strides or dilations must be 1. Got strides ${i} and dilations '${p}'`);let c=M.computeConv2DInfo(r.shape,s.shape,i,p,o,u,!0),{filterHeight:m,filterWidth:f,dilationHeight:g,dilationWidth:y,padInfo:A}=c,x=A.left,v=A.top,b=c.outChannels/c.inChannels,w=new Qt(c.outShape,r.dtype),I=n.data.get(r.dataId).values,T=n.data.get(s.dataId).values,C=w.values;for(let z=0;z=c.inHeight)continue;let Q=X*h[0],ee=$+q*d[1];for(let ie=0;ie=c.inWidth)continue;let he=Q+te*h[1],ve=ee+ce*c.inChannels,xe=ae,Ee=he;for(let Fe=0;Fe{let{x:a,filter:r}=e,{strides:s,pad:i,dilations:o}=n,l=t,u=l.data.get(a.dataId).values,d=a.shape.length,h=l.data.get(r.dataId).values,p=r.shape.length,{batchSize:c,inHeight:m,inWidth:f,inChannels:g,outHeight:y,outWidth:A,padInfo:x,strideHeight:v,strideWidth:b,filterHeight:w,filterWidth:I,dilationHeight:T,dilationWidth:C,outShape:z}=M.computeDilation2DInfo(a.shape,r.shape,s,i,"NHWC",o),$=k.sizeFromShape(z),S=z.length,D=k.getArrayFromDType(a.dtype,$);for(let _=0;_=0&&te=0&&heie&&(ie=Ee)}}}let ae=k.locToIndex([_,W,q,ee],S,k.computeStrides(z));D[ae]=ie}}}return{dataId:l.write(k.toTypedArray(D,a.dtype),z,a.dtype),shape:z,dtype:a.dtype}}},Joe={kernelName:R1,backendName:"cpu",kernelFunc:({inputs:e,backend:t,attrs:n})=>{let{x:a,filter:r,dy:s}=e,{strides:i,pad:o,dilations:l}=n,u=t,d=k.toNestedArray(a.shape,u.data.get(a.dataId).values),h=k.toNestedArray(r.shape,u.data.get(r.dataId).values),{batchSize:p,inHeight:c,inWidth:m,inChannels:f,outHeight:g,outWidth:y,padInfo:A,strideHeight:x,strideWidth:v,filterHeight:b,filterWidth:w,dilationHeight:I,dilationWidth:T,outShape:C}=M.computeDilation2DInfo(a.shape,r.shape,i,o,"NHWC",l);k.assert(s.rank===C.length,()=>`Error in ${R1}, dy must have the same rank as output ${C.length}, but got ${s.rank}`);let z=k.toNestedArray(C,u.data.get(s.dataId).values),$=k.makeZerosNestedTypedArray(r.shape,r.dtype);for(let S=0;S=0&&de=0&&ceQ&&(Q=he,ee=ae,ie=te)}}}$[ee][ie][q]+=z[S][D][W][q]}}}return{dataId:u.write(k.toTypedArray($,a.dtype),r.shape,r.dtype),shape:r.shape,dtype:r.dtype}}},Qoe={kernelName:$1,backendName:"cpu",kernelFunc:({inputs:e,backend:t,attrs:n})=>{let{x:a,filter:r,dy:s}=e,{strides:i,pad:o,dilations:l}=n,u=t,d=k.toNestedArray(a.shape,u.data.get(a.dataId).values),h=k.toNestedArray(r.shape,u.data.get(r.dataId).values),{batchSize:p,inHeight:c,inWidth:m,inChannels:f,outHeight:g,outWidth:y,padInfo:A,strideHeight:x,strideWidth:v,filterHeight:b,filterWidth:w,dilationHeight:I,dilationWidth:T,outShape:C}=M.computeDilation2DInfo(a.shape,r.shape,i,o,"NHWC",l);k.assert(s.rank===C.length,()=>`Error in ${$1}, dy must have the same rank as output ${C.length}, but got ${s.rank}`);let z=k.toNestedArray(C,u.data.get(s.dataId).values),$=k.makeZerosNestedTypedArray(a.shape,a.dtype);for(let S=0;S=0&&de=0&&ceQ&&(Q=he,ee=de,ie=ce)}}}$[S][ee][ie][q]+=z[S][D][W][q]}}}return{dataId:u.write(k.toTypedArray($,a.dtype),a.shape,a.dtype),shape:a.shape,dtype:a.dtype}}};function np(e){let{inputs:t,backend:n,attrs:a}=e,{x:r}=t,{axis:s,keepDims:i}=a;Se(r,"sum");let o;r.dtype==="bool"?o=Js({inputs:{x:r},backend:n,attrs:{dtype:"int32"}}):o=zr({inputs:{x:r},backend:n});let l=o.shape.length,u=k.parseAxisParam(s,o.shape),d=M.getAxesPermutation(u,l),h=u,p=o;d!=null&&(p=Da({inputs:{x:o},backend:n,attrs:{perm:d}}),h=M.getInnerMostAxes(h.length,l)),M.assertAxesAreInnerMostDims("sum",h,p.shape.length);let[c,m]=M.computeOutAndReduceShapes(p.shape,h),f=M.upcastType(p.dtype,"int32"),g=C0(n,c,f),y=k.sizeFromShape(m),A=n.data.get(g.dataId).values,x=n.data.get(p.dataId).values;for(let v=0;v=0&&(p=np({inputs:{x:p},backend:n,attrs:{axis:u[f]-(i.length-c),keepDims:!1}}),m.push(p)),c--)}for(let f of m)f!==p&&n.disposeIntermediateTensorInfo(f);return p}var nle={kernelName:F1,backendName:"cpu",kernelFunc:tle};function ale(e){let{inputs:t,backend:n}=e,{dy:a,y:r}=t;Se([a,r],"eluGrad");let s=new Float32Array(k.sizeFromShape(r.shape)),i=n.data.get(r.dataId).values,o=n.data.get(a.dataId).values;for(let l=0;l=1?s[l]=o[l]:s[l]=o[l]*(u+1)}return n.makeTensorInfo(r.shape,"float32",s)}var rle={kernelName:O1,backendName:"cpu",kernelFunc:ale},sle=M.ERF_P,ile=M.ERF_A1,ole=M.ERF_A2,lle=M.ERF_A3,ule=M.ERF_A4,dle=M.ERF_A5,hle=xt(Od,e=>{let t=Math.sign(e),n=Math.abs(e),a=1/(1+sle*n);return t*(1-((((dle*a+ule)*a+lle)*a+ole)*a+ile)*a*Math.exp(-n*n))}),ple={kernelName:Od,backendName:"cpu",kernelFunc:hle};function $0(e){let{inputs:t,backend:n,attrs:a}=e,{input:r}=t,{dim:s}=a,i=r.shape.length,o=r.shape.slice(),l=s;return s<0&&(k.assert(-(i+1)<=s,()=>`Axis must be in the interval [${-(i+1)}, ${i}]`),l=i+s+1),o.splice(l,0,1),Ot({inputs:{x:r},backend:n,attrs:{shape:o}})}var cle={kernelName:Dd,backendName:"cpu",kernelFunc:$0},fle=nn((e,t)=>e/t),P5=bn(il,fle),L5={kernelName:il,backendName:"cpu",kernelFunc:P5};function WN(e,t,n){let a=e.shape,r=a[0],s=a[1],i=n.data.get(e.dataId),o=i.complexTensorInfos.real,l=i.complexTensorInfos.imag,u=[r,s],d=k.sizeFromShape(u),h=k.getTypedArrayFromDType("float32",d),p=k.getTypedArrayFromDType("float32",d);for(let g=0;g{let{image:a}=e,r=n,s=k.getTypedArrayFromDType(a.dtype,k.sizeFromShape(a.shape)),[i,o,l,u]=a.shape,d=r.data.get(a.dataId).values;for(let h=0;h=0&&xMath.floor(e/t)),Ile=bn(ul,kle,null,"int32"),Sle={kernelName:ul,backendName:"cpu",kernelFunc:Ile};function Nle(e){let{inputs:t,backend:n,attrs:a}=e,{x:r,filter:s,bias:i,preluActivationWeights:o}=t,{strides:l,pad:u,dataFormat:d,dilations:h,dimRoundingMode:p,activation:c,leakyreluAlpha:m}=a,f=PN({inputs:{x:r,filter:s},backend:n,attrs:{strides:l,pad:u,dataFormat:d,dilations:h,dimRoundingMode:p}});if(i){let g=f;f=tp({inputs:{a:f,b:i},backend:n}),n.disposeIntermediateTensorInfo(g)}if(c){let g=f;f=_5(n,f,c,o,m),n.disposeIntermediateTensorInfo(g)}return f}var Tle={kernelName:Wl,backendName:"cpu",kernelFunc:Nle};function Ele(e){let{inputs:t,backend:n,attrs:a}=e,{x:r,filter:s,bias:i,preluActivationWeights:o}=t,{strides:l,pad:u,dataFormat:d,dilations:h,dimRoundingMode:p,activation:c,leakyreluAlpha:m}=a,f=LN({inputs:{x:r,filter:s},backend:n,attrs:{strides:l,pad:u,dataFormat:d,dilations:h,dimRoundingMode:p}});if(i){let g=f;f=tp({inputs:{a:f,b:i},backend:n}),n.disposeIntermediateTensorInfo(g)}if(c){let g=f;f=_5(n,f,c,o,m),n.disposeIntermediateTensorInfo(g)}return f}var Cle={kernelName:Bl,backendName:"cpu",kernelFunc:Ele};function Mle(e){let{inputs:t,backend:n}=e,{params:a,indices:r}=t,s=k.sizeFromShape(a.shape),i=r.shape,o=i[i.length-1],[l,u,d,h]=M.prepareAndValidate(a,r);if(u===0)return n.makeTensorInfo(l,a.dtype,[]);let p=n.data.get(r.dataId).values,c=n.bufferSync(a),m=tN(p,c,a.dtype,u,o,d,h,a.shape,s);return n.makeTensorInfo(l,a.dtype,m.values)}var $le={kernelName:Pd,backendName:"cpu",kernelFunc:Mle};function Rle(e){let{inputs:t,backend:n,attrs:a}=e,{x:r,indices:s}=t,{axis:i,batchDims:o}=a;Se([r,s],"gatherV2");let l=o;o==null&&(l=0);let u=k.sizeFromShape(s.shape),d=k.parseAxisParam(i,r.shape)[0],h=M.segment_util.collectGatherOpShapeInfo(r,s,d,l),p=Ot({inputs:{x:r},backend:n,attrs:{shape:[h.batchSize,h.outerSize,h.dimSize,h.sliceSize]}}),c=Ot({inputs:{x:s},backend:n,attrs:{shape:[h.batchSize,u/h.batchSize]}}),m=[h.batchSize,h.outerSize,u/h.batchSize,h.sliceSize],f=n.bufferSync(c),g=n.bufferSync(p),y=nN(g,f,m);return n.disposeIntermediateTensorInfo(p),n.disposeIntermediateTensorInfo(c),n.makeTensorInfo(h.outputShape,y.dtype,y.values)}var Fle={kernelName:zd,backendName:"cpu",kernelFunc:Rle};function Ole(e){let{inputs:t,backend:n}=e,{input:a}=t,r=k.sizeFromShape(a.shape),s=a.shape[a.shape.length-1],i=r/s,o=Ot({inputs:{x:a},backend:n,attrs:{shape:[i,s]}}),l=WN(o,!0,n),u=Ot({inputs:{x:l},backend:n,attrs:{shape:a.shape}});return n.disposeIntermediateTensorInfo(o),n.disposeIntermediateTensorInfo(l),u}var Dle={kernelName:_1,backendName:"cpu",kernelFunc:Ole},_le=xt(Ld,e=>Number.isFinite(e)?1:0,"bool"),zle={kernelName:Ld,backendName:"cpu",kernelFunc:_le},Ple=xt(Wd,e=>Math.abs(e)===Infinity?1:0,"bool"),Lle={kernelName:Wd,backendName:"cpu",kernelFunc:Ple},Wle=xt(Bd,e=>Number.isNaN(e)?1:0,"bool"),Ble={kernelName:Bd,backendName:"cpu",kernelFunc:Wle};function Vle(e){let{backend:t,attrs:n}=e,{start:a,stop:r,num:s}=n,i=oN(a,r,s);return t.makeTensorInfo([i.length],"float32",i)}var Ule={kernelName:P1,backendName:"cpu",kernelFunc:Vle},jle=xt(Vd,e=>Math.log1p(e)),Hle={kernelName:Vd,backendName:"cpu",kernelFunc:jle},Gle=nn((e,t)=>e&&t),qle=bn(Ud,Gle,null,"bool"),Kle={kernelName:Ud,backendName:"cpu",kernelFunc:qle},Xle=xt(ef,e=>e?0:1,"bool"),Zle={kernelName:ef,backendName:"cpu",kernelFunc:Xle},Yle=nn((e,t)=>e||t),Jle=bn(tf,Yle,null,"bool"),Qle={kernelName:tf,backendName:"cpu",kernelFunc:Jle};function eue(e){let{inputs:t,backend:n,attrs:a}=e,{x:r}=t,{depthRadius:s,bias:i,alpha:o,beta:l}=a;Se(r,"LRN");let u=r.shape[3],d=u-1,h=n.data.get(r.dataId).values,p=k.sizeFromShape(r.shape),c=new Float32Array(p);function m(f){let g=f%u,y=f-g+Math.max(0,g-s),A=f-g+Math.min(g+s,d),x=0;for(;y<=A;y++){let v=h[y];x+=v*v}return x}for(let f=0;f`Error in maxPool: Either strides or dilations must be 1. Got strides ${i} and dilations '${u}'`);let d=M.computePool2DInfo(r.shape,s,i,u,o,l),h;if(d.filterWidth===1&&d.filterHeight===1&&k.arraysEqual(d.inShape,d.outShape))h=zr({inputs:{x:r},backend:n});else{let p=n.data.get(r.dataId).values,c=k.computeStrides(r.shape),m=z5(p,r.shape,r.dtype,c,d,"max");h=n.makeTensorInfo(d.outShape,r.dtype,m.values)}return h}var iue={kernelName:yl,backendName:"cpu",kernelFunc:sue};function oue(e){let{inputs:t,backend:n,attrs:a}=e,{x:r}=t,{filterSize:s,strides:i,pad:o,dimRoundingMode:l,dataFormat:u}=a;Se(r,"maxPool3d");let d=M.computePool3DInfo(r.shape,s,i,1,o,l,u),h=n.data.get(r.dataId).values,p=zN(h,r.shape,r.dtype,k.computeStrides(r.shape),d,"max");return n.makeTensorInfo(p.shape,"float32",p.values)}var lue={kernelName:af,backendName:"cpu",kernelFunc:oue};function uue(e){let{inputs:t,backend:n,attrs:a}=e,{dy:r,input:s}=t,{filterSize:i,strides:o,pad:l,dimRoundingMode:u}=a;Se([r,s],"maxPool3DGrad");let d=M.computePool3DInfo(s.shape,i,o,1,l,u),h=n.bufferSync(s),p=eoe(h,d),c=d.strideDepth,m=d.strideHeight,f=d.strideWidth,g=d.dilationDepth,y=d.dilationHeight,A=d.dilationWidth,x=d.effectiveFilterDepth,v=d.effectiveFilterHeight,b=d.effectiveFilterWidth,w=x-1-d.padInfo.front,I=b-1-d.padInfo.left,T=v-1-d.padInfo.top,C=Pe(s.shape,"float32"),z=n.bufferSync(r);for(let $=0;$=d.outDepth||Math.floor(ae)!==ae))for(let de=0;de=d.outHeight||Math.floor(te)!==te))for(let ce=0;ce=d.outWidth||Math.floor(he)!==he)continue;let ve=x*v*b-1-p.get($,ae,te,he,S),xe=ie*v*b+de*b+ce,Ee=ve===xe?1:0;Ee!==0&&(ee+=z.get($,ae,te,he,S)*Ee)}}}C.set(ee,$,D,_,W,S)}return n.makeTensorInfo(C.shape,C.dtype,C.values)}var due={kernelName:B1,backendName:"cpu",kernelFunc:uue};function hue(e){let{inputs:t,backend:n,attrs:a}=e,{dy:r,input:s,output:i}=t,o=s;Se([s,i],"maxPoolGrad");let{filterSize:l,strides:u,pad:d,dimRoundingMode:h}=a,p=M.computePool2DInfo(o.shape,l,u,1,d,h),c=n.data.get(o.dataId).values,m=Pe(p.outShape,o.dtype,_N(c,o.shape,o.dtype,p).values),f=p.strideHeight,g=p.strideWidth,y=p.dilationHeight,A=p.dilationWidth,x=p.effectiveFilterHeight,v=p.effectiveFilterWidth,b=v-1-p.padInfo.left,w=x-1-p.padInfo.top,I=Pe(o.shape,"float32"),T=n.data.get(r.dataId).values,C=Pe(r.shape,"float32",T);for(let z=0;z=p.outHeight||Math.floor(Q)!==Q))for(let ee=0;ee=p.outWidth||Math.floor(ie)!==ie)continue;let ae=x*v-1-m.get(z,Q,ie,$),de=q*v+ee,te=ae===de?1:0;te!==0&&(X+=C.get(z,Q,ie,$)*te)}}I.set(X,z,S,D,$)}return n.makeTensorInfo(I.shape,I.dtype,I.values)}var pue={kernelName:W1,backendName:"cpu",kernelFunc:hue};function cue(e,t,n,a,r){let s=k.computeStrides(t),i=z5(e,t,n,s,r,"max"),o=_N(e,t,n,r,!0,a);return[i.values,o.values]}var fue={kernelName:V1,backendName:"cpu",kernelFunc:({inputs:e,attrs:t,backend:n})=>{let{x:a}=e,{filterSize:r,strides:s,pad:i,includeBatchInIndex:o}=t,l=n;Se(a,"MaxPoolWithArgmax");let u=l.data.get(a.dataId).values,d=M.computePool2DInfo(a.shape,r,s,[1,1],i),[h,p]=cue(u,a.shape,a.dtype,o,d),c=l.write(h,d.outShape,a.dtype),m=l.write(p,d.outShape,a.dtype);return[{dataId:c,shape:d.outShape,dtype:a.dtype},{dataId:m,shape:d.outShape,dtype:"int32"}]}};function mue(e){let{inputs:t,backend:n,attrs:a}=e,{x:r}=t,{axis:s,keepDims:i}=a,o=k.parseAxisParam(s,r.shape),l=M.computeOutAndReduceShapes(r.shape,o)[1],u=k.sizeFromShape(l),d=[],h=n.makeTensorInfo([],"float32",new Float32Array([u]));d.push(h);let p=Js({inputs:{x:r},backend:n,attrs:{dtype:"float32"}});d.push(p);let c=P5({inputs:{a:p,b:h},backend:n});d.push(c);let m=np({inputs:{x:c},backend:n,attrs:{axis:s,keepDims:i}});return d.forEach(f=>n.disposeIntermediateTensorInfo(f)),m}var gue={kernelName:Al,backendName:"cpu",kernelFunc:mue};function yue(e){let{inputs:t,backend:n,attrs:a}=e,{x:r}=t,{axis:s,keepDims:i}=a;Se(r,"min");let o=k.parseAxisParam(s,r.shape),l=o,u=M.getAxesPermutation(l,r.shape.length),d=r;u!=null&&(d=Da({inputs:{x:r},backend:n,attrs:{perm:u}}),l=M.getInnerMostAxes(l.length,r.shape.length)),M.assertAxesAreInnerMostDims("min",l,d.shape.length);let[h,p]=M.computeOutAndReduceShapes(d.shape,l),c=k.sizeFromShape(p),m=k.makeZerosTypedArray(k.sizeFromShape(h),d.dtype),f=n.data.get(d.dataId).values;for(let y=0;yA[0]+r.shape[x]+A[1]),l=s.map(A=>A[0]),u=s.map((A,x)=>A[0]+r.shape[x]),d=i==="reflect"?0:1,h=n.data.get(r.dataId).values,p=r.shape.length,c=k.computeStrides(r.shape),m=k.sizeFromShape(o),f=o.length,g=k.computeStrides(o),y=k.getTypedArrayFromDType(r.dtype,m);for(let A=0;A=u[b]&&(x[b]=(u[b]-1)*2-x[b]+d);x=x.map((b,w)=>b-l[w]);let v=k.locToIndex(x,p,c);y[A]=h[v]}return{dataId:n.write(y,o,r.dtype),shape:o,dtype:r.dtype}}var bue={kernelName:bl,backendName:"cpu",kernelFunc:xue},vue=nn((e,t)=>{let n=e%t;return e<0&&t<0||e>=0&&t>=0?n:(n+t)%t}),wue=bn(jd,vue),kue={kernelName:jd,backendName:"cpu",kernelFunc:wue},Iue=qr(Qg());function VN(e){let{inputs:t,backend:n,attrs:a}=e,{logits:r}=t,{dim:s}=a,i=r.shape.length,o=s;if(o===-1&&(o=i-1),o!==i-1)throw Error(`Softmax along a non-last dimension is not yet supported. Logits was rank ${i} and dim was ${o}`);let l=k.parseAxisParam([o],r.shape),u=BN({inputs:{x:r},backend:n,attrs:{reductionIndices:l,keepDims:!1}}),d=M.expandShapeToKeepDim(u.shape,l),h=Ot({inputs:{x:u},backend:n,attrs:{shape:d}}),p=D5({inputs:{a:r,b:h},backend:n}),c=J9({inputs:{x:p},backend:n}),m=np({inputs:{x:c},backend:n,attrs:{axis:l,keepDims:!1}}),f=Ot({inputs:{x:m},backend:n,attrs:{shape:d}}),g=P5({inputs:{a:c,b:f},backend:n});return n.disposeIntermediateTensorInfo(u),n.disposeIntermediateTensorInfo(h),n.disposeIntermediateTensorInfo(p),n.disposeIntermediateTensorInfo(c),n.disposeIntermediateTensorInfo(m),n.disposeIntermediateTensorInfo(f),g}var Sue={kernelName:Dl,backendName:"cpu",kernelFunc:VN};function Nue(e){let{inputs:t,backend:n,attrs:a}=e,{logits:r}=t,{numSamples:s,seed:i,normalized:o}=a;Se(r,"multinomial");let l=o?r:VN({inputs:{logits:r},backend:n,attrs:{dim:-1}}),u=l.shape[0],d=l.shape[1],h=n.data.get(l.dataId).values,p=[u,s],c=k.makeZerosTypedArray(k.sizeFromShape(p),"int32");for(let m=0;m=0&&d[h]{k.assertShapesMatch(s,d.shape,"All tensors passed to stack must have matching shapes"),k.assert(i===d.dtype,()=>"All tensors passed to stack must have matching dtypes")});let o=[],l=t.map(d=>{let h=$0({inputs:{input:d},backend:n,attrs:{dim:r}});return o.push(h),h}),u=cu({inputs:l,backend:n,attrs:{axis:r}});return o.forEach(d=>n.disposeIntermediateTensorInfo(d)),u}var Bue={kernelName:Zd,backendName:"cpu",kernelFunc:jN};function Vue(e){let{inputs:t,backend:n,attrs:a}=e,{x:r}=t,{paddings:s,constantValue:i}=a;Se(r,"pad");let o=s.map((y,A)=>y[0]+r.shape[A]+y[1]),l=s.map(y=>y[0]),u=n.data.get(r.dataId).values,d=k.sizeFromShape(r.shape),h=r.shape.length,p=k.computeStrides(r.shape),c=k.sizeFromShape(o),m=o.length,f=k.computeStrides(o),g=k.getTypedArrayFromDType(r.dtype,c);i!==0&&g.fill(i);for(let y=0;yv+l[b]),x=k.locToIndex(A,m,f);g[x]=u[y]}return{dataId:n.write(g,o,r.dtype),shape:o,dtype:r.dtype}}var HN={kernelName:kl,backendName:"cpu",kernelFunc:Vue},Uue=nn((e,t)=>Math.pow(e,t)),jue=bn(Il,Uue),Hue={kernelName:Il,backendName:"cpu",kernelFunc:jue};function Gue(e){let{backend:t,attrs:n}=e,{start:a,stop:r,dtype:s,step:i}=n,o=mN(a,r,i,s);return t.makeTensorInfo([o.length],s,o)}var que={kernelName:rf,backendName:"cpu",kernelFunc:Gue},Kue=xt(Jd,e=>1/e),Xue={kernelName:Jd,backendName:"cpu",kernelFunc:Kue};function Zue(e){let{inputs:t,backend:n,attrs:a}=e,{images:r}=t,{alignCorners:s,halfPixelCenters:i,size:o}=a;Se(r,"resizeBilinear");let l=k.computeStrides(r.shape),[u,d]=o,[h,p,c,m]=r.shape,f=n.data.get(r.dataId).values,g=new Float32Array(k.sizeFromShape([h,u,d,m])),y=[s&&u>1?p-1:p,s&&d>1?c-1:c],A=[s&&u>1?u-1:u,s&&d>1?d-1:d],x=0,v=y[0]/A[0],b=y[1]/A[1];for(let w=0;w1?u-1:u,i&&c>1?d-1:d],g=[i&&p>1?p-1:p,i&&c>1?c-1:c],y=f[0]/g[0],A=f[1]/g[1],x=n.data.get(s.dataId).values,v=0;for(let b=0;b1?p-1:p,s&&d>1?c-1:c],A=[s&&u>1?u-1:u,s&&d>1?d-1:d],x=y[0]/A[0],v=y[1]/A[1],b=0;for(let w=0;w1?d-1:d,i&&m>1?h-1:h],A=[i&&c>1?c-1:c,i&&m>1?m-1:m],x=y[0]/A[0],v=y[1]/A[1],b=1/x,w=1/v,I=Math.ceil(b)*2+2,T=Math.ceil(w)*2+2;for(let C=0;C=c)continue;let te=z+de*l[1],ce=de*x,he=Math.min(d-1,i?Math.round(ce):Math.floor(ce));if($===he)for(let ve=0;ve=m)continue;let Ee=te+xe*l[2],Fe=xe*v,We=Math.min(h-1,i?Math.round(Fe):Math.floor(Fe));W===We&&(ie+=g[Ee+ee])}}f[X+ee]=ie}}}}return n.makeTensorInfo(r.shape,r.dtype,f)}var ade={kernelName:H1,backendName:"cpu",kernelFunc:nde};function rde(e){let{inputs:t,backend:n,attrs:a}=e,{x:r}=t,{dims:s}=a;Se(r,"reverse");let i=r.shape.length,o=k.parseAxisParam(s,r.shape);if(i===0)return zr({inputs:{x:r},backend:n});let l=new Qt(r.shape,r.dtype),u=n.bufferSync(r);for(let d=0;dp[c]=r.shape[c]-1-p[c]),l.set(u.get(...p),...h)}return n.makeTensorInfo(l.shape,l.dtype,l.values)}var sde={kernelName:Cl,backendName:"cpu",kernelFunc:rde},ide={kernelName:ch,backendName:"cpu",kernelFunc:({inputs:e,attrs:t,backend:n})=>{let{image:a}=e,{radians:r,fillValue:s,center:i}=t,o=n,l=k.getTypedArrayFromDType(a.dtype,k.sizeFromShape(a.shape)),[u,d,h,p]=a.shape,[c,m]=M.getImageCenter(i,d,h),f=255,g=Math.sin(r),y=Math.cos(r),A=o.data.get(a.dataId).values;for(let x=0;x=0&&D=0&&_{let t=Math.floor(e);return e-t<.5?Math.floor(e):e-t>.5?Math.ceil(e):t%2==0?t:t+1}),lde={kernelName:Ml,backendName:"cpu",kernelFunc:ode};function GN(e,t,n,a,r,s,i,o,l,u){let d=[a/r,r],h=e.values,p=t.values;if(a===0)return Pe(n,t.dtype);let c=Pe(d,t.dtype);c.values.fill(l);for(let m=0;m=a/r)throw new Error(`Invalid indices: ${f} does not index into ${n}`);for(let y=0;y1||r.shape.length===1?1:k.sizeFromShape(r.shape.slice(1));for(let m=0;me>=0?fde*e:cde*(Math.exp(e)-1)),gde={kernelName:nh,backendName:"cpu",kernelFunc:mde},yde=xt(sh,e=>e<0?-1:e>0?1:0),Ade={kernelName:sh,backendName:"cpu",kernelFunc:yde},xde=xt($l,e=>Math.sin(e)),bde={kernelName:$l,backendName:"cpu",kernelFunc:xde},vde=xt(rh,e=>Math.sinh(e)),wde={kernelName:rh,backendName:"cpu",kernelFunc:vde},kde=11920928955078125e-23,qN=Math.log(kde)+2,Ide=xt(ih,e=>{let t=e>-qN,n=eNumber(g)))),n.makeTensorInfo([f.length],a.dtype,new Int32Array(f))]}var Cde={kernelName:q1,backendName:"cpu",kernelFunc:Ede};function Mde(e){let{inputs:t,backend:n}=e,{inputIndices:a,inputShape:r,newShape:s}=t;if(a.shape.length!==2)throw new Error(`Input indices should be a matrix but received shape - ${a.shape}`);if(r.shape.length!==1)throw new Error(`Input shape should be a vector but received shape - ${r.shape}`);if(s.shape.length!==1)throw new Error(`Target shape should be a vector but received shape ${s.shape}`);let i=Array.from(n.data.get(r.dataId).values),o=n.data.get(a.dataId).values,l=Array.from(n.data.get(s.dataId).values),[u,d,h]=xN(o,a.shape,a.dtype,i,l);return[n.makeTensorInfo(d,a.dtype,u),n.makeTensorInfo([h.length],s.dtype,new Int32Array(h))]}var $de={kernelName:K1,backendName:"cpu",kernelFunc:Mde};function Rde(e){let{inputs:t,backend:n}=e,{data:a,indices:r,segmentIds:s}=t;if(a.shape.length<1)throw new Error("Data should be at least 1 dimensional but received scalar");if(r.shape.length!==1)throw new Error(`Indices should be a vector but received shape - ${r.shape}`);if(s.shape.length!==1)throw new Error(`Segment ids should be a vector but received shape - ${s.shape}`);let i=n.data.get(a.dataId).values,o=n.data.get(r.dataId).values,l=n.data.get(s.dataId).values,[u,d]=O5(i,a.shape,a.dtype,o,l,!0);return n.makeTensorInfo(d,a.dtype,u)}var Fde={kernelName:X1,backendName:"cpu",kernelFunc:Rde};function Ode(e){let{inputs:t,backend:n}=e,{data:a,indices:r,segmentIds:s}=t;if(a.shape.length<1)throw new Error("Data should be at least 1 dimensional but received scalar");if(r.shape.length!==1)throw new Error(`Indices should be a vector but received shape - ${r.shape}`);if(s.shape.length!==1)throw new Error(`Segment ids should be a vector but received shape - ${s.shape}`);let i=n.data.get(a.dataId).values,o=n.data.get(r.dataId).values,l=n.data.get(s.dataId).values,[u,d]=O5(i,a.shape,a.dtype,o,l);return n.makeTensorInfo(d,a.dtype,u)}var Dde={kernelName:Z1,backendName:"cpu",kernelFunc:Ode};function _de(e){let{inputs:t,backend:n,attrs:a}=e,{sparseIndices:r,sparseValues:s,defaultValue:i}=t,{outputShape:o}=a,{sliceRank:l,numUpdates:u,sliceSize:d,strides:h,outputSize:p}=M.calculateShapes(s,r,o),c=!1,m=n.bufferSync(r),f=n.bufferSync(s),g=n.data.get(i.dataId).values[0],y=GN(m,f,o,p,d,u,l,h,g,c);return n.makeTensorInfo(o,y.dtype,y.values)}var zde={kernelName:Y1,backendName:"cpu",kernelFunc:_de};function Pde(e){let{inputs:t,backend:n,attrs:a}=e,{x:r}=t,{numOrSizeSplits:s,axis:i}=a,o=k.parseAxisParam(i,r.shape)[0],l=M.prepareSplitSize(r,s,o),u=new Array(r.shape.length).fill(0),d=r.shape.slice();return l.map(h=>{let p=[...d];p[o]=h;let c=fo({inputs:{x:r},backend:n,attrs:{begin:u,size:p}});return u[o]+=h,c})}var Lde={kernelName:oh,backendName:"cpu",kernelFunc:Pde},Wde=xt(Fl,e=>Math.sqrt(e)),Bde={kernelName:Fl,backendName:"cpu",kernelFunc:Wde},Vde={kernelName:lf,backendName:"cpu",kernelFunc:({inputs:e,backend:t})=>{let{x:n}=e,a=t;Se(n,"square");let r=a.data.get(n.dataId).values,s=new Float32Array(r.length);for(let i=0;i{let n=t;return isNaN(e)?NaN:e>0?1:n.alpha}),jde={kernelName:Li,backendName:"cpu",kernelFunc:Ude};function Hde(e){let{inputs:t,backend:n,attrs:a}=e,{x:r}=t,{begin:s,end:i,strides:o,beginMask:l,endMask:u,ellipsisMask:d,newAxisMask:h,shrinkAxisMask:p}=a;Se(r,"stridedSlice");let{nonStrided:c,$begin:m,$strides:f,size:g,newShape:y,outShape:A}=Cn.sliceInfo(r.shape,s,i,o,l,u,d,h,p),x=Ot({inputs:{x:r},backend:n,attrs:{shape:y}}),v;if(c){let w=fo({inputs:{x},backend:n,attrs:{begin:m,size:g}});v=Ot({inputs:{x:w},backend:n,attrs:{shape:A}}),n.disposeIntermediateTensorInfo(w)}else if(A.some(w=>w===0))v=n.makeTensorInfo(A,r.dtype,[]);else{let w=n.bufferSync(x),I=vN(A,w,f,m);v=n.makeTensorInfo(I.shape,I.dtype,I.values)}let b=Ot({inputs:{x:v},backend:n,attrs:{shape:A}});return n.disposeIntermediateTensorInfo(x),n.disposeIntermediateTensorInfo(v),b}var Gde={kernelName:lh,backendName:"cpu",kernelFunc:Hde};function qde(e){let{inputs:t,backend:n,attrs:a}=e,{separator:r,nGramWidths:s,leftPad:i,rightPad:o,padWidth:l,preserveShortSequences:u}=a,{data:d,dataSplits:h}=t,p=n.data.get(d.dataId).values,c=n.data.get(h.dataId).values,[m,f]=wN(p,c,r,s,i,o,l,u);return[n.makeTensorInfo([m.length],"string",m),n.makeTensorInfo(h.shape,"int32",f)]}var Kde={kernelName:J1,backendName:"cpu",kernelFunc:qde};function Xde(e){let{inputs:t,backend:n,attrs:a}=e,{skipEmpty:r}=a,{input:s,delimiter:i}=t;if(s.dtype!=="string")throw new Error("Input must be of datatype string");if(s.shape.length!==1)throw new Error(`Input must be a vector, got shape: ${s.shape}`);if(i.shape.length!==0)throw new Error(`Delimiter must be a scalar, got shape: ${i.shape}`);let o=n.data.get(s.dataId).values,l=n.data.get(i.dataId).values[0],[u,d,h]=kN(o,l,r),p=d.length;return[n.makeTensorInfo([p,2],"int32",u),n.makeTensorInfo([p],"string",d),n.makeTensorInfo([2],"int32",new Int32Array(h))]}var Zde={kernelName:Q1,backendName:"cpu",kernelFunc:Xde};function Yde(e){let{inputs:t,backend:n,attrs:a}=e,{numBuckets:r}=a,{input:s}=t;if(s.dtype!=="string")throw new Error("Input must be of datatype string");if(r<=0)throw new Error("Number of buckets must be at least 1");let i=n.data.get(s.dataId).values,o=IN(i,r);return n.makeTensorInfo(s.shape,"int32",o)}var Jde={kernelName:eA,backendName:"cpu",kernelFunc:Yde},Qde=xt(_l,e=>Math.tan(e)),ehe={kernelName:_l,backendName:"cpu",kernelFunc:Qde},the=xt(zl,e=>Math.tanh(e)),nhe={kernelName:zl,backendName:"cpu",kernelFunc:the};function ahe(e){let{inputs:t,backend:n,attrs:a}=e,{x:r}=t,{reps:s}=a;Se(r,"tile");let i=NN(n.bufferSync(r),s);return n.makeTensorInfo(i.shape,i.dtype,i.values)}var rhe={kernelName:Pi,backendName:"cpu",kernelFunc:ahe};function she(e){let{inputs:t,backend:n,attrs:a}=e,{x:r}=t,{k:s,sorted:i}=a;Se(r,"topk");let o=n.data.get(r.dataId).values,[l,u]=TN(o,r.shape,r.dtype,s,i);return[n.makeTensorInfo(l.shape,l.dtype,l.values),n.makeTensorInfo(u.shape,u.dtype,u.values)]}var ihe={kernelName:uh,backendName:"cpu",kernelFunc:she};function ohe(e){let{inputs:t,attrs:n,backend:a}=e,{image:r,transforms:s}=t,{interpolation:i,fillMode:o,fillValue:l,outputShape:u}=n,[d,h,p,c]=r.shape,[m,f]=u!=null?u:[h,p],g=[d,m,f,c],y=k.computeStrides(r.shape),A=y[0],x=y[1],v=y[2],b=k.getTypedArrayFromDType(r.dtype,k.sizeFromShape(g));b.fill(l);let w=a.data.get(r.dataId).values,I=a.data.get(s.dataId).values;for(let T=0;Tt-1)if(t<=1)n=0;else{let a=2*t;n-=a*Math.trunc(n/a),n>=t&&(n=a-n-1)}return k.clamp(0,n,t-1)}function dhe(e,t){let n=e;if(n<0)if(t<=1)n=0;else{let a=t-1;n+=t*(Math.trunc(-n/a)+1)}else if(n>t-1)if(t<=1)n=0;else{let a=t-1;n-=t*Math.trunc(n/a)}return k.clamp(0,n,t-1)}function hhe(e,t){return e}function phe(e,t){return k.clamp(0,e,t-1)}function ap(e,t,n,a,r,s,i,o,l,u,d){let h=i*a+o*r+l*s+u;return 0<=o&&on.disposeIntermediateTensorInfo(m)),c}var bhe={kernelName:uf,backendName:"cpu",kernelFunc:xhe},vhe=[Eie,Ise,Mie,Rie,Mse,Oie,_ie,Pie,Wie,Vie,jie,Gie,Kie,Yie,Qie,noe,roe,ioe,loe,Nie,doe,poe,foe,Ese,Rse,goe,Sse,Aoe,boe,koe,Soe,voe,Coe,$oe,Toe,Foe,Doe,zoe,Loe,Boe,Uoe,joe,Goe,Koe,Zoe,Yoe,Qoe,Joe,L5,nle,Aie,rle,Fse,ple,Ose,cle,_se,xle,ble,wle,Pse,Sle,Tle,Cle,$le,Fle,Wse,Vse,Nse,Dle,xoe,zle,Lle,Ble,xie,jse,Gse,Ule,Kse,Hle,Kle,Zle,Qle,tue,aue,Zse,iue,lue,due,pue,fue,rue,gue,Aue,Jse,bue,kue,Tue,eie,nie,Mue,Fue,_ue,rie,Pue,Wue,Bue,HN,Hue,vie,oie,que,Tse,Xue,wie,kie,Sie,Yue,Que,tde,ade,sde,ide,lde,uie,dde,pde,gde,Iie,Ade,bde,wde,die,Sue,Sde,Tde,Cde,$de,Fde,Dde,zde,Lde,Bde,Vde,pie,jde,Gde,Kde,Zde,Jde,gie,ele,ehe,nhe,rhe,ihe,sie,lhe,ghe,Ahe,bhe,Lue];for(let e of vhe)sA(e);var XN={};$e(XN,{assertNotComplex:()=>mu,bindCanvasToFramebuffer:()=>Fhe,bindColorTextureToFramebuffer:()=>D0,bindTextureToProgramUniformSampler:()=>dT,bindTextureUnit:()=>oT,bindVertexBufferToProgramAttribute:()=>j5,callAndCheck:()=>ke,canBeRepresented:()=>ZN,createFragmentShader:()=>QN,createFramebuffer:()=>iT,createProgram:()=>eT,createStaticIndexBuffer:()=>aT,createStaticVertexBuffer:()=>nT,createTexture:()=>rT,createVertexShader:()=>JN,getBatchDim:()=>go,getExtensionOrThrow:()=>op,getFramebufferErrorMessage:()=>hT,getMaxTexturesInShader:()=>mT,getNumChannels:()=>$he,getProgramUniformLocation:()=>uT,getProgramUniformLocationOrThrow:()=>lT,getRowsCols:()=>yo,getShapeAs3D:()=>_0,getTextureShapeFromLogicalShape:()=>cT,getWebGLDisjointQueryTimerVersion:()=>gT,getWebGLErrorMessage:()=>YN,getWebGLMaxTextureSize:()=>fT,hasExtension:()=>za,isCapableOfRenderingToFloatTexture:()=>yT,isDownloadFloatTextureEnabled:()=>AT,isReshapeFree:()=>up,isWebGLFenceEnabled:()=>xT,isWebGLVersionEnabled:()=>G5,linkProgram:()=>tT,resetMaxTextureSize:()=>Ohe,resetMaxTexturesInShader:()=>Dhe,unbindColorTextureFromFramebuffer:()=>H5,unbindTextureUnit:()=>Rhe,validateFramebuffer:()=>lp,validateProgram:()=>O0,validateTextureSize:()=>sT});var mo={},V5={alpha:!1,antialias:!1,premultipliedAlpha:!1,preserveDrawingBuffer:!1,depth:!1,stencil:!1,failIfMajorPerformanceCaveat:!0};function F0(e,t){mo[e]=t}function Pr(e){if(!(e in mo)){let n=khe(e);if(n!==null)mo[e]=n;else return console.log("Could not get context for WebGL version",e),null}let t=mo[e];return t.isContextLost()?(delete mo[e],Pr(e)):(t.disable(t.DEPTH_TEST),t.disable(t.STENCIL_TEST),t.disable(t.BLEND),t.disable(t.DITHER),t.disable(t.POLYGON_OFFSET_FILL),t.disable(t.SAMPLE_COVERAGE),t.enable(t.SCISSOR_TEST),t.enable(t.CULL_FACE),t.cullFace(t.BACK),mo[e])}function whe(e){if(typeof OffscreenCanvas!="undefined"&&e===2)return new OffscreenCanvas(300,150);if(typeof document!="undefined")return document.createElement("canvas");throw new Error("Cannot create a canvas in this context")}function khe(e){if(e!==1&&e!==2)throw new Error("Cannot get WebGL rendering context, WebGL is disabled.");let t=whe(e);return t.addEventListener("webglcontextlost",n=>{n.preventDefault(),delete mo[e]},!1),e===1?t.getContext("webgl",V5)||t.getContext("experimental-webgl",V5):t.getContext("webgl2",V5)}var rp;(function(e){e[e.DENSE=0]="DENSE",e[e.SHARED_BATCH=1]="SHARED_BATCH"})(rp||(rp={}));var _a;(function(e){e[e.RENDER=0]="RENDER",e[e.UPLOAD=1]="UPLOAD",e[e.PIXELS=2]="PIXELS",e[e.DOWNLOAD=3]="DOWNLOAD"})(_a||(_a={}));var Nn;(function(e){e[e.UNPACKED_FLOAT16=0]="UNPACKED_FLOAT16",e[e.UNPACKED_FLOAT32=1]="UNPACKED_FLOAT32",e[e.PACKED_4X1_UNSIGNED_BYTE=2]="PACKED_4X1_UNSIGNED_BYTE",e[e.PACKED_2X2_FLOAT32=3]="PACKED_2X2_FLOAT32",e[e.PACKED_2X2_FLOAT16=4]="PACKED_2X2_FLOAT16"})(Nn||(Nn={}));function sp(e,t){return[t,e]}function Ihe(e,t){return e*t}function ip(e){let t=k.sizeFromShape(e),n=Math.ceil(t/4);return k.sizeToSquarishShape(n)}function fu(e,t){return[Math.max(1,Math.ceil(t/2)),Math.max(1,Math.ceil(e/2))]}function She(e,t){let[n,a]=fu(e,t);return n*a*4}function U5(e,t){let n=e,a,r,s,i,o,l,u,d,h,p;return se().getNumber("WEBGL_VERSION")===2?(a=n.R32F,r=n.R16F,s=n.RGBA16F,i=n.RGBA32F,o=n.RED,u=4,d=1,h=n.HALF_FLOAT,p=n.FLOAT):(a=e.RGBA,r=e.RGBA,s=e.RGBA,i=n.RGBA,o=e.RGBA,u=4,d=4,h=t!=null?t.HALF_FLOAT_OES:null,p=e.FLOAT),l=e.RGBA,{internalFormatFloat:a,internalFormatHalfFloat:r,internalFormatPackedHalfFloat:s,internalFormatPackedFloat:i,textureFormatFloat:o,downloadTextureFormat:l,downloadUnpackNumChannels:u,defaultNumChannels:d,textureTypeHalfFloat:h,textureTypeFloat:p}}function ke(e,t){let n=t();return se().getBool("DEBUG")&&Nhe(e),n}function Nhe(e){let t=e.getError();if(t!==e.NO_ERROR)throw new Error("WebGL Error: "+YN(e,t))}var The=596e-10,Ehe=65504;function ZN(e){return!!(se().getBool("WEBGL_RENDER_FLOAT32_ENABLED")||e===0||Thee.getExtension(t),'Extension "'+t+'" not supported on this browser.')}function JN(e,t){let n=gs(e,()=>e.createShader(e.VERTEX_SHADER),"Unable to create vertex WebGLShader.");if(ke(e,()=>e.shaderSource(n,t)),ke(e,()=>e.compileShader(n)),e.getShaderParameter(n,e.COMPILE_STATUS)===!1)throw console.log(e.getShaderInfoLog(n)),new Error("Failed to compile vertex shader.");return n}function QN(e,t){let n=gs(e,()=>e.createShader(e.FRAGMENT_SHADER),"Unable to create fragment WebGLShader.");if(ke(e,()=>e.shaderSource(n,t)),ke(e,()=>e.compileShader(n)),e.getShaderParameter(n,e.COMPILE_STATUS)===!1)throw Mhe(t,e.getShaderInfoLog(n)),new Error("Failed to compile fragment shader.");return n}var Che=/ERROR: [0-9]+:([0-9]+):/g;function Mhe(e,t){let n=Che.exec(t);if(n==null){console.log(`Couldn't parse line number in error: ${t}`),console.log(e);return}let a=+n[1],r=e.split(` -`),s=r.length.toString().length+2,i=r.map((h,p)=>k.rightPad((p+1).toString(),s)+h),o=0;for(let h=0;h0&&k.isString(n[0])){let s=n.map(a=>k.encodeString(a));r=this.write(s,e,t)}else r=this.write(n,e,t);return{dataId:r,shape:e,dtype:t}}refCount(e){return this.data.has(e)?this.data.get(e).refCount:0}incRef(e){let t=this.data.get(e);t.refCount++}decRef(e){if(this.data.has(e)){let t=this.data.get(e);t.refCount--}}move(e,t,n,r,s){this.data.set(e,{values:t,dtype:r,refCount:s})}numDataIds(){return this.data.numDataIds()}async read(e){return this.readSync(e)}readSync(e){let{dtype:t,complexTensorInfos:n}=this.data.get(e);if(t==="complex64"){let r=this.readSync(n.real.dataId),s=this.readSync(n.imag.dataId);return _.mergeRealAndImagArrays(r,s)}return this.data.get(e).values}bufferSync(e){let t=this.readSync(e.dataId),n=t;if(e.dtype==="string")try{n=t.map(r=>k.decodeString(r))}catch(r){throw new Error("Failed to decode encoded string bytes into utf-8")}return Le(e.shape,e.dtype,n)}makeOutput(e,t,n){let r=this.write(e,t,n);return za().makeTensorFromDataId(r,t,n,this)}disposeData(e,t=!1){if(this.data.has(e)){if(this.data.get(e).refCount--,!t&&this.data.get(e).refCount>0)return!1;let{complexTensorInfos:n}=this.data.get(e);n!=null&&(this.disposeData(n.real.dataId,!0),this.disposeData(n.imag.dataId,!0)),this.data.delete(e)}return!0}disposeIntermediateTensorInfo(e){this.disposeData(e.dataId)}async time(e){let t=k.now();return e(),{kernelMs:k.now()-t}}memory(){return{unreliable:!0,reasons:["The reported memory is an upper bound. Due to automatic garbage collection, the true allocated memory may be less."]}}where(e){Te([e],"where");let t=this.readSync(e.dataId);return wae(e.shape,t)}dispose(){}floatPrecision(){return 32}epsilon(){return super.epsilon()}},$5=VT;$5.nextDataId=0;var UT={};De(UT,{addImpl:()=>GT,bincountImpl:()=>R5,bincountReduceImpl:()=>jT,ceilImpl:()=>qT,concatImpl:()=>KT,equalImpl:()=>XT,expImpl:()=>YT,expm1Impl:()=>QT,floorImpl:()=>eN,gatherNdImpl:()=>tN,gatherV2Impl:()=>nN,greaterEqualImpl:()=>sN,greaterImpl:()=>rN,lessEqualImpl:()=>oN,lessImpl:()=>aN,linSpaceImpl:()=>iN,logImpl:()=>lN,maxImpl:()=>uN,maximumImpl:()=>cN,minimumImpl:()=>dN,multiplyImpl:()=>D5,negImpl:()=>hN,notEqualImpl:()=>pN,prodImpl:()=>fN,rangeImpl:()=>mN,rsqrtImpl:()=>gN,simpleAbsImpl:()=>HT,sliceImpl:()=>yN,sparseFillEmptyRowsImpl:()=>AN,sparseReshapeImpl:()=>xN,sparseSegmentReductionImpl:()=>M5,squaredDifferenceImpl:()=>bN,stridedSliceImpl:()=>vN,stringNGramsImpl:()=>wN,stringSplitImpl:()=>kN,stringToHashBucketFastImpl:()=>IN,subImpl:()=>SN,tileImpl:()=>TN,topKImpl:()=>NN,transposeImpl:()=>F5,uniqueImpl:()=>CN});function HT(e){let t=new Float32Array(e.length);for(let n=0;n{let{x:t}=e.inputs,n=e.backend;Te(t,"abs");let r=new Float32Array(k.sizeFromShape(t.shape)),s=n.data.get(t.dataId).values;return r=HT(s),n.makeOutput(r,t.shape,"float32")},Iae={kernelName:xc,backendName:"cpu",kernelFunc:kae};function nn(e){return(t,n,r,s,a)=>{let o=_.assertAndGetBroadcastShape(t,n),i=o.length,l=k.computeStrides(o),u=k.sizeFromShape(o),c=k.getTypedArrayFromDType(a,u),d=t.length,h=n.length,p=k.computeStrides(t),f=k.computeStrides(n),m=_.getBroadcastDims(t,o),g=_.getBroadcastDims(n,o);if(m.length+g.length===0)for(let y=0;yx[I]=0);let b=k.locToIndex(x,d,p),v=A.slice(-h);g.forEach(I=>v[I]=0);let w=k.locToIndex(v,h,f);c[y]=e(r[b],s[w])}return[c,o]}}function fr(e){let{inputs:t,backend:n}=e,{real:r,imag:s}=t,a=n.data.get(r.dataId).values,o=n.data.get(s.dataId).values,i=n.makeTensorInfo(r.shape,"complex64"),l=n.data.get(i.dataId);return l.complexTensorInfos={real:n.makeTensorInfo(r.shape,"float32",a),imag:n.makeTensorInfo(s.shape,"float32",o)},i}var Sae={kernelName:Iy,backendName:"cpu",kernelFunc:fr};function Em(e,t,n="float32"){if(n==="complex64"){let s=Em(e,t,"float32"),a=Em(e,t,"float32");return fr({inputs:{real:s,imag:a},backend:e})}let r=k.makeZerosTypedArray(k.sizeFromShape(t),n);return e.makeTensorInfo(t,n,r)}function zs(e){let{inputs:t,backend:n}=e,{x:r}=t;return n.incRef(r.dataId),{dataId:r.dataId,shape:r.shape,dtype:r.dtype}}var Tae={kernelName:hl,backendName:"cpu",kernelFunc:zs};function pi(e){let{inputs:t,backend:n}=e,{input:r}=t,s=n.data.get(r.dataId).complexTensorInfos.real,a=n.data.get(s.dataId).values;return n.makeTensorInfo(s.shape,s.dtype,a)}var Nae={kernelName:Gy,backendName:"cpu",kernelFunc:pi};function Ja(e){let{inputs:t,backend:n,attrs:r}=e,{x:s}=t,{dtype:a}=r;if(a==="complex64"){if(s.dtype==="complex64")return zs({inputs:{x:s},backend:n});let o=Em(n,s.shape,s.dtype),i=Ja({inputs:{x:s},backend:n,attrs:{dtype:"float32"}}),l=fr({inputs:{real:i,imag:o},backend:n});return n.disposeIntermediateTensorInfo(o),n.disposeIntermediateTensorInfo(i),l}if(s.dtype==="complex64"){let o=pi({inputs:{input:s},backend:n}),i=Ja({inputs:{x:o},backend:n,attrs:{dtype:a}});return n.disposeIntermediateTensorInfo(o),i}if(!k.hasEncodingLoss(s.dtype,a)){let o=zs({inputs:{x:s},backend:n});return{dataId:o.dataId,shape:o.shape,dtype:a}}if(a==="int32"){let o=n.data.get(s.dataId).values,i=Int32Array.from(o);return n.makeTensorInfo(s.shape,"int32",i)}if(a==="bool"){let o=n.data.get(s.dataId).values,i=k.toTypedArray([0],s.dtype),[l,u]=nn((c,d)=>c!==d?1:0)(s.shape,[],o,i,"bool");return n.makeTensorInfo(u,"bool",l)}throw new Error(`Error in Cast: failed to cast ${s.dtype} to ${a}`)}var Cae={kernelName:el,backendName:"cpu",kernelFunc:Ja};function bn(e,t,n,r){return n==null?({inputs:s,backend:a})=>{let{a:o,b:i}=s,l=a;Te([o,i],e);let u=l.data.get(o.dataId).values,c=l.data.get(i.dataId).values,d=o.dtype==="string"?_.fromUint8ToStringArray(u):u,h=o.dtype==="string"?_.fromUint8ToStringArray(c):c,p=r||o.dtype,[f,m]=t(o.shape,i.shape,d,h,p);return l.makeTensorInfo(m,p,f)}:({inputs:s,backend:a})=>{let{a:o,b:i}=s,l=a;if(o.dtype==="complex64"||i.dtype==="complex64"){let u=Ja({inputs:{x:o},backend:l,attrs:{dtype:"complex64"}}),c=l.data.get(u.dataId),d=c.complexTensorInfos.real,h=c.complexTensorInfos.imag,p=l.data.get(d.dataId).values,f=l.data.get(h.dataId).values,m=Ja({inputs:{x:i},backend:l,attrs:{dtype:"complex64"}}),g=l.data.get(m.dataId),y=g.complexTensorInfos.real,A=g.complexTensorInfos.imag,x=l.data.get(y.dataId).values,b=l.data.get(A.dataId).values,[v,w,I]=n(o.shape,i.shape,p,f,x,b),T=l.makeTensorInfo(I,"float32",v),C=l.makeTensorInfo(I,"float32",w),M=fr({inputs:{real:T,imag:C},backend:l});return l.disposeIntermediateTensorInfo(u),l.disposeIntermediateTensorInfo(m),l.disposeIntermediateTensorInfo(T),l.disposeIntermediateTensorInfo(C),M}else{let u=l.data.get(o.dataId).values,c=l.data.get(i.dataId).values,d=r||o.dtype,[h,p]=t(o.shape,i.shape,u,c,d);return l.makeTensorInfo(p,d,h)}}}function _5(e){return(t,n,r,s,a,o)=>{let i=_.assertAndGetBroadcastShape(t,n),l=k.sizeFromShape(i),u=i.length,c=k.computeStrides(i),d=k.getTypedArrayFromDType("float32",l),h=k.getTypedArrayFromDType("float32",l),p=_.getBroadcastDims(t,i),f=_.getBroadcastDims(n,i),m=_.mergeRealAndImagArrays(r,s),g=_.mergeRealAndImagArrays(a,o),y=t.length,A=k.computeStrides(t),x=n.length,b=k.computeStrides(n);if(p.length+f.length===0)for(let v=0;vI[R]=0);let T=k.locToIndex(I,y,A),C=w.slice(-x);f.forEach(R=>C[R]=0);let M=k.locToIndex(C,x,b),$=e(m[T*2],m[T*2+1],g[M*2],g[M*2+1]);d[v]=$.real,h[v]=$.imag}return[d,h,i]}}var GT=nn((e,t)=>e+t),Eae=_5((e,t,n,r)=>({real:e+n,imag:t+r})),th=bn(Fa,GT,Eae),$ae={kernelName:Fa,backendName:"cpu",kernelFunc:th};function R5(e,t,n,r,s){let a=k.sizeFromShape(r),o=k.makeZerosTypedArray(s,n);for(let i=0;i=s||(a>0?o[l]+=t[i]:o[l]+=1)}return o}function jT(e,t,n,r=!1){let s=e.shape[0],a=e.shape[1],o=Le([s,n],t.dtype);for(let i=0;i=n||(r?o.set(1,i,u):t.size>0?o.set(o.get(i,u)+t.get(i,l),i,u):o.set(o.get(i,u)+1,i,u))}return o}function cu(e){return(t,n,r)=>{let s=k.getTypedArrayFromDType(n,t.length);for(let a=0;a{let{x:o}=r;if(Te(o,e),o.dtype==="string"||n==="string")throw new Error("unaryKernelFunc does not support string input/output");let i=a,l=i.data.get(o.dataId).values,u=k.sizeFromShape(o.shape),c=n||o.dtype,d=k.getArrayFromDType(c,u);for(let h=0;h{let{x:o}=r;if(Te(o,e),o.dtype==="string"||n==="string")throw new Error("unaryKernelFunc does not support string input/output");let i=a,l=i.data.get(o.dataId).values,u=n||o.dtype,c=t(l,u,s);return i.makeTensorInfo(o.shape,u,c)}}var qT=cu(e=>Math.ceil(e)),_ae=du(No,qT),Rae={kernelName:No,backendName:"cpu",kernelFunc:_ae};function KT(e,t,n,r){let s=k.getArrayFromDType(n,k.sizeFromShape(t));if(r&&n!=="string"){let a=0;e.forEach(o=>{let i=k.sizeFromShape(o.shape);s.set(o.vals,a),a+=i})}else{let a=0;e.forEach(o=>{let i=n==="string"?_.fromUint8ToStringArray(o.vals):o.vals,l=0;for(let u=0;ue===t?1:0),ZT=bn(il,XT,null,"bool"),Dae={kernelName:il,backendName:"cpu",kernelFunc:ZT},YT=cu(e=>Math.exp(e)),JT=du(Eo,YT),Fae={kernelName:Eo,backendName:"cpu",kernelFunc:JT},QT=cu(e=>Math.expm1(e)),Mae=du(ll,QT),Oae={kernelName:ll,backendName:"cpu",kernelFunc:Mae},eN=cu(e=>Math.floor(e)),Pae=du($o,eN),zae={kernelName:$o,backendName:"cpu",kernelFunc:Pae};function tN(e,t,n,r,s,a,o,i,l){let u=Le([r,a],n);for(let c=0;c=l/a)throw new Error(`Invalid indices: ${d} does not index into ${i}`);for(let p=0;pe>t?1:0),Lae=bn(dl,rN,null,"bool"),Bae={kernelName:dl,backendName:"cpu",kernelFunc:Lae},sN=nn((e,t)=>e>=t?1:0),Wae=bn(_o,sN,null,"bool"),Vae={kernelName:_o,backendName:"cpu",kernelFunc:Wae},aN=nn((e,t)=>ee<=t?1:0),Gae=bn(ml,oN,null,"bool"),jae={kernelName:ml,backendName:"cpu",kernelFunc:Gae};function iN(e,t,n){let r=(t-e)/(n-1),s=k.makeZerosTypedArray(n,"float32");s[0]=e;for(let a=1;aMath.log(e)),qae=du(Ro,lN),Kae={kernelName:Ro,backendName:"cpu",kernelFunc:qae};function uN(e,t,n,r){let s=k.getTypedArrayFromDType(r,k.sizeFromShape(n));for(let a=0;ai)&&(i=u)}s[a]=i}return s}var cN=nn((e,t)=>Math.max(e,t)),Xae=bn(Do,cN),Zae={kernelName:Do,backendName:"cpu",kernelFunc:Xae},dN=nn((e,t)=>Math.min(e,t)),Yae=bn(Fo,dN),Jae={kernelName:Fo,backendName:"cpu",kernelFunc:Yae},D5=nn((e,t)=>e*t),Qae=_5((e,t,n,r)=>({real:e*n-t*r,imag:e*r+t*n})),$m=bn(Mo,D5,Qae),eoe={kernelName:Mo,backendName:"cpu",kernelFunc:$m};function hN(e,t,n){let r=k.createScalarValue(-1,n);return D5([],t,r,e,n)}function toe(e){let{inputs:t,backend:n}=e,{x:r}=t;Te(r,"neg");let s=n.data.get(r.dataId).values,[a,o]=hN(s,r.shape,r.dtype);return n.makeTensorInfo(o,r.dtype,a)}var noe={kernelName:Gc,backendName:"cpu",kernelFunc:toe},pN=nn((e,t)=>e!==t?1:0),roe=bn(vl,pN,null,"bool"),soe={kernelName:vl,backendName:"cpu",kernelFunc:roe};function F5(e,t,n,r,s){let a=t.length,o=k.sizeFromShape(t),i=k.computeStrides(t),l=k.computeStrides(s),u=k.getTypedArrayFromDType(n,k.sizeFromShape(s));for(let c=0;cn.disposeIntermediateTensorInfo(A)),n.makeTensorInfo(y,g,f)}var ioe={kernelName:Yc,backendName:"cpu",kernelFunc:ooe};function mN(e,t,n,r){let s=e===t,a=e1;if(s||a||o)return k.makeZerosTypedArray(0,r);let i=Math.abs(Math.ceil((t-e)/n)),l=k.makeZerosTypedArray(i,r);t1/Math.sqrt(e)),loe=du(Oo,gN),uoe={kernelName:Oo,backendName:"cpu",kernelFunc:loe};function yN(e,t,n,r,s){let a=En.isSliceContinous(r,t,n),o=k.sizeFromShape(n),i=k.computeStrides(r);if(a){let d=En.computeFlatOffset(t,i);return s==="string"?e.slice(d,d+o):e.subarray(d,d+o)}let l=s==="string"?_.fromUint8ToStringArray(e):e,u=Le(r,s,l),c=Le(n,s);for(let d=0;df+t[m]);c.set(u.get(...p),...h)}return s==="string"?_.fromStringArrayToUint8(c.values):c.values}function fi(e){let{inputs:t,backend:n,attrs:r}=e,{x:s}=t,{begin:a,size:o}=r;Te(s,"slice");let[i,l]=En.parseSliceParams(s,a,o);En.assertParamsValid(s,i,l);let u=n.data.get(s.dataId).values,c=yN(u,i,l,s.shape,s.dtype);return n.makeTensorInfo(l,s.dtype,c)}var coe={kernelName:rd,backendName:"cpu",kernelFunc:fi};function AN(e,t,n,r,s,a,o){let i=t[0],l=a[0],u=new Array(l),c=new Array(i),d=t[1];if(l===0){if(i!==0)throw new Error(`Received SparseTensor with denseShape[0] = 0 but + indices.shape[0] = ${i}`);let g=k.getArrayFromDType(n,0),y=k.getArrayFromDType(s,0);return[g,[0,d],y,u,c]}let h=!0,p=0,f=new Array(l).fill(0);for(let g=0;g=l)throw new Error(`indices(${g}, 0) is invalid: ${y} >= ${l}`);++f[y],h=h&&y>=p,p=y}let m=!0;for(let g=0;g0&&(f[g]+=f[g-1])}if(m&&h){let g=e,y=r;for(let A=0;A0){p[h-1]=1;for(let g=h-2;g>=0;--g)p[g]=p[g+1]*r[g+1]}let f=[];if(i>0){f[i-1]=1;for(let g=i-2;g>=0;--g)f[g]=f[g+1]*l[g+1]}let m=k.getArrayFromDType(n,o*i);for(let g=0;g0?s[i-1]+1:0;if(d<0)throw new Error("segment ids must be >= 0");let h=t.slice();h[0]=d;let p=h.reduce((x,b)=>x*b,1),f=k.getArrayFromDType(n,p);if(i===0)return d>0&&f.fill(o),[f,h];if(d<=0)throw new Error("segment ids must be >= 0");let m=0,g=1,y=0,A=s[m];for(;;){let x=0;if(g=x)throw new Error("segment ids are not increasing")}if(A<0||A>=d)throw new Error(`Segment id ${A} out of range [0, ${d}), possibly because segmentIds input is not sorted.`);A>y&&f.fill(o,y*u,A*u);for(let b=m;b=l[0])throw new Error(`Bad: indices[${b}] == ${r[b]} out of range [0, ${l[0]})`);for(let w=0;wi)break}return y{let n=e-t;return n*n}),doe=bn(Po,bN),hoe={kernelName:Po,backendName:"cpu",kernelFunc:doe};function vN(e,t,n,r){let s=Le(e,t.dtype);for(let a=0;a0?0:o-i),h=0;h+=l*this.leftPad.length;for(let y=0;yy.forEach(A=>f[m++]=A);for(let y=0;y0){g(e[d+c-1]);for(let y=0;y0){let i=t[0];if(i!==0)throw new Error(`First split value must be 0, got ${i}`);for(let l=1;l=i;if(u=u&&t[l]<=n,!u)throw new Error(`Invalid split value ${t[l]}, must be in [${i}, ${n}]`);i=t[l]}if(i!==n)throw new Error(`Last split value must be data size. Expected ${n}, got ${i}`)}let s=r-1,a=k.getArrayFromDType("int32",r);if(n===0||r===0){let i=new Array(n);for(let l=0;l<=s;++l)a[l]=0;return[i,a]}a[0]=0;for(let i=1;i<=s;++i){let l=t[i]-t[i-1],u=0;this.nGramWidths.forEach(c=>{u+=this.getNumNGrams(l,c)}),this.preserveShort&&l>0&&u===0&&(u=1),a[i]=a[i-1]+u}let o=new Array(a[s]);for(let i=0;i{let d=t[i+1]-t[i],h=this.getNumNGrams(d,c);this.createNGrams(e,l,o,u,h,c),u+=h}),this.preserveShort&&u===a[i]){let c=t[i+1]-t[i];if(c===0)continue;let d=c+2*this.padWidth,h=1;this.createNGrams(e,l,o,u,h,d)}}return[o,a]}};function wN(e,t,n,r,s,a,o,i){return new poe(n,r,s,a,o,i).compute(e,t)}function foe(e,t,n){if(!e.length)return[];if(t.length===0){let a=new Array(e.length);for(let o=0;oe-t),moe=_5((e,t,n,r)=>({real:e-n,imag:t-r})),O5=bn(zo,SN,moe),goe={kernelName:zo,backendName:"cpu",kernelFunc:O5};function TN(e,t){let n=new Array(e.rank);for(let s=0;sx.value-A.value);let m=d*r,g=l.subarray(m,m+r),y=u.subarray(m,m+r);for(let A=0;A{for(let g=0;gnew $5,1);var EN=xt(Dc,e=>e>=0?e:Math.exp(e)-1),Aoe={kernelName:Dc,backendName:"cpu",kernelFunc:EN};function $N(e){let{inputs:t,backend:n,attrs:r}=e,{x:s}=t,{alpha:a}=r;Te([s],"leakyRelu");let o=k.sizeFromShape(s.shape),i=n.data.get(s.dataId).values,l=k.getTypedArrayFromDType("float32",o);for(let u=0;ue<0?t*e:e);function _N(e){let{inputs:t,backend:n}=e,{x:r,alpha:s}=t;Te([r,s],"prelu");let a=n.data.get(r.dataId).values,o=n.data.get(s.dataId).values,[i,l]=boe(r.shape,s.shape,a,o,r.dtype);return n.makeTensorInfo(l,r.dtype,i)}var voe={kernelName:Sl,backendName:"cpu",kernelFunc:_N},RN=xt(Tl,e=>Math.max(0,e)),woe={kernelName:Tl,backendName:"cpu",kernelFunc:RN},DN=xt(Cl,e=>Math.min(Math.max(0,e),6)),koe={kernelName:Cl,backendName:"cpu",kernelFunc:DN},FN=xt(Rl,e=>1/(1+Math.exp(-e))),Ioe={kernelName:Rl,backendName:"cpu",kernelFunc:FN};function P5(e,t,n,r,s){if(n==="linear")return zs({inputs:{x:t},backend:e});if(n==="relu")return RN({inputs:{x:t},backend:e});if(n==="elu")return EN({inputs:{x:t},backend:e});if(n==="relu6")return DN({inputs:{x:t},backend:e});if(n==="prelu")return _N({inputs:{x:t,alpha:r},backend:e});if(n==="leakyrelu")return $N({inputs:{x:t},backend:e,attrs:{alpha:s}});if(n==="sigmoid")return FN({inputs:{x:t},backend:e});throw new Error(`Activation ${n} has not been implemented for the CPU backend.`)}function Ft(e){let{inputs:t,backend:n,attrs:r}=e,{x:s}=t,{shape:a}=r,o=k.sizeFromShape(s.shape),i=k.inferFromImplicitShape(a,o),l=k.sizeFromShape(i);k.assert(o===l,()=>`The new shape (${i}) has ${l} elements and the old shape (${s.shape}) has ${o} elements. The new shape and old shape must have the same number of elements.`),n.incRef(s.dataId);let u=n.data.get(s.dataId);if(u.complexTensorInfos!=null){let c=u.complexTensorInfos.real,d=u.complexTensorInfos.imag;c.shape=i,d.shape=i}return{dataId:s.dataId,shape:i,dtype:s.dtype}}var Soe={kernelName:Qc,backendName:"cpu",kernelFunc:Ft};function MN(e){let{inputs:t,backend:n,attrs:r}=e,{a:s,b:a}=t,{transposeA:o,transposeB:i}=r;Te([s,a],"matMul");let l=s.shape.length,u=a.shape.length,c=o?s.shape[l-2]:s.shape[l-1],d=i?a.shape[u-1]:a.shape[u-2],h=o?s.shape[l-1]:s.shape[l-2],p=i?a.shape[u-2]:a.shape[u-1],f=s.shape.slice(0,-2),m=a.shape.slice(0,-2),g=k.sizeFromShape(f),y=k.sizeFromShape(m),A=g===y||g===1||y===1;k.assert(l>=2&&u>=2&&A,()=>`Error in matMul: the input batch dimensions must either be the same or at least one input batch dimension must be 1. Got input batch dimensions of (${f}) and (${m}).`);let b=(g>y?s.shape.slice(0,-2):a.shape.slice(0,-2)).concat([h,p]);k.assert(c===d,()=>`Error in matMul: inner shapes (${c}) and (${d}) of Tensors with shapes ${s.shape} and ${a.shape} and transposeA=${o} and transposeB=${i} must match.`);let v=o?[g,c,h]:[g,h,c],w=i?[y,p,d]:[y,d,p],I=Ft({inputs:{x:s},backend:n,attrs:{shape:v}}),T=Ft({inputs:{x:a},backend:n,attrs:{shape:w}}),C=o?I.shape[1]:I.shape[2],M=o?I.shape[2]:I.shape[1],$=i?T.shape[1]:T.shape[2],R=Math.max(g,y),N=n.data.get(I.dataId).values,F=n.data.get(T.dataId).values,B=k.computeStrides(I.shape),j=k.computeStrides(T.shape),[X,Y,ee]=o?[B[0],1,B[1]]:[B[0],B[1],1],[oe,se,ie]=i?[1,j[1],j[0]]:[j[1],1,j[0]],ne=M*$,de=Le([R,M,$],I.dtype),he=de.values,ge=n.blockSize;for(let be=0;beMath.acos(e)),$oe={kernelName:bc,backendName:"cpu",kernelFunc:Eoe},_oe=xt(vc,e=>Math.acosh(e)),Roe={kernelName:vc,backendName:"cpu",kernelFunc:_oe};function Doe(e){let{inputs:t,backend:n}=e,r=t;Te(t,"addN");let s=r.map(i=>n.data.get(i.dataId).values),a=Le(r[0].shape,r[0].dtype),o=a.values;for(let i=0;iA&&(A=v,x=b)}p[g]=x}return u.forEach(g=>n.disposeIntermediateTensorInfo(g)),n.makeTensorInfo(c,"int32",p)}var Boe={kernelName:Yi,backendName:"cpu",kernelFunc:Loe};function Woe(e){let{inputs:t,backend:n,attrs:r}=e,{x:s}=t,{axis:a}=r;Te(s,"argMin");let o=k.parseAxisParam(a,s.shape),i=_.getAxesPermutation(o,s.shape.length),l=s,u=[];i!=null&&(l=Pr({inputs:{x:s},backend:n,attrs:{perm:i}}),u.push(l),o=_.getInnerMostAxes(o.length,l.shape.length)),o=[o[0]],_.assertAxesAreInnerMostDims("argMin",o,l.shape.length);let[c,d]=_.computeOutAndReduceShapes(l.shape,o),h=k.sizeFromShape(c),p=k.makeZerosTypedArray(h,"int32"),f=k.sizeFromShape(d),m=n.data.get(l.dataId).values;for(let g=0;gn.disposeIntermediateTensorInfo(g)),n.makeTensorInfo(c,"int32",p)}var Voe={kernelName:qp,backendName:"cpu",kernelFunc:Woe},Uoe=xt(Ic,e=>Math.asin(e)),Hoe={kernelName:Ic,backendName:"cpu",kernelFunc:Uoe},Goe=xt(Sc,e=>Math.asinh(e)),joe={kernelName:Sc,backendName:"cpu",kernelFunc:Goe},qoe=xt(Tc,e=>Math.atan(e)),Koe={kernelName:Tc,backendName:"cpu",kernelFunc:qoe},Xoe=nn((e,t)=>Math.atan2(e,t)),Zoe=bn(Cc,Xoe),Yoe={kernelName:Cc,backendName:"cpu",kernelFunc:Zoe},Joe=xt(Nc,e=>Math.atanh(e)),Qoe={kernelName:Nc,backendName:"cpu",kernelFunc:Joe};function z5(e,t,n,r,s,a){let o=s.strideHeight,i=s.strideWidth,l=s.dilationHeight,u=s.dilationWidth,c=s.effectiveFilterHeight,d=s.effectiveFilterWidth,h=s.padInfo.top,p=s.padInfo.left,f=a==="max"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,m=Le(s.outShape,n),g=m.values,y=s.outShape[1]*s.outShape[2]*s.outShape[3],A=s.outShape[2]*s.outShape[3],x=s.outShape[3];for(let b=0;bX?X=he:a==="avg"&&(Y+=he,ee++)}if(isNaN(X))break}let oe=R+N*x+I;g[oe]=a==="avg"?Y/ee:X}}}return m}function ON(e,t,n,r,s=!1,a=!1){let o=Le(r.outShape,"int32"),i=r.strideHeight,l=r.strideWidth,u=r.dilationHeight,c=r.dilationWidth,d=r.effectiveFilterHeight,h=r.effectiveFilterWidth,p=r.padInfo.top,f=r.padInfo.left,m=Le(t,n,e);for(let g=0;gM&&(M=j,s?$=a?((g*r.inHeight+R)*r.inWidth+F)*r.inChannels+y:(R*r.inWidth+F)*r.inChannels+y:$=N*h+B)}}o.set($,g,A,w,y)}}return o}function PN(e,t,n,r,s,a){let o=s.strideDepth,i=s.strideHeight,l=s.strideWidth,u=s.dilationDepth,c=s.dilationHeight,d=s.dilationWidth,h=s.effectiveFilterDepth,p=s.effectiveFilterHeight,f=s.effectiveFilterWidth,m=s.padInfo.front,g=s.padInfo.top,y=s.padInfo.left,A=a==="max"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,x=Le(s.outShape,n),b=x.values,v=s.outShape[1]*s.outShape[2]*s.outShape[3]*s.outShape[4],w=s.outShape[2]*s.outShape[3]*s.outShape[4],I=s.outShape[3]*s.outShape[4],T=s.outShape[4];for(let C=0;CEe?Ee=Je:a==="avg"&&($e+=Je,ze++),isNaN(Ee))break}if(isNaN(Ee))break}if(isNaN(Ee))break}let qe=be+R;b[qe]=a==="avg"?$e/ze:Ee}}}}return x}function eie(e,t){let n=Le(t.outShape,"int32"),r=t.strideDepth,s=t.strideHeight,a=t.strideWidth,o=t.dilationDepth,i=t.dilationHeight,l=t.dilationWidth,u=t.effectiveFilterDepth,c=t.effectiveFilterHeight,d=t.effectiveFilterWidth,h=t.padInfo.front,p=t.padInfo.top,f=t.padInfo.left;for(let m=0;m=N&&(N=se,F=j*c*d+Y*c+oe)}}}n.set(F,m,y,v,C,g)}}}return n}function tie(e){let{inputs:t,backend:n,attrs:r}=e,{x:s}=t;Te(s,"avgPool");let{filterSize:a,strides:o,pad:i,dimRoundingMode:l}=r,u=1;k.assert(_.eitherStridesOrDilationsAreOne(o,u),()=>`Error in avgPool: Either strides or dilations must be 1. Got strides ${o} and dilations '${u}'`);let c=_.computePool2DInfo(s.shape,a,o,u,i,l),d;if(c.filterWidth===1&&c.filterHeight===1&&k.arraysEqual(c.inShape,c.outShape))d=zs({inputs:{x:s},backend:n});else{let h=n.data.get(s.dataId).values,p=k.computeStrides(s.shape),f=z5(h,s.shape,s.dtype,p,c,"avg");d=n.makeTensorInfo(c.outShape,s.dtype,f.values)}return d}var nie={kernelName:Ji,backendName:"cpu",kernelFunc:tie};function rie(e){let{inputs:t,backend:n,attrs:r}=e,{x:s}=t,{filterSize:a,strides:o,pad:i,dimRoundingMode:l,dataFormat:u}=r;Te(s,"avgPool3d");let c=_.computePool3DInfo(s.shape,a,o,1,i,l,u),d=n.data.get(s.dataId).values,h=PN(d,s.shape,s.dtype,k.computeStrides(s.shape),c,"avg");return n.makeTensorInfo(h.shape,"float32",h.values)}var sie={kernelName:Kp,backendName:"cpu",kernelFunc:rie};function aie(e){let{inputs:t,backend:n,attrs:r}=e,{dy:s,input:a}=t,{filterSize:o,strides:i,pad:l,dimRoundingMode:u}=r;Te([s,a],"avgPool3DGrad");let c=_.computePool3DInfo(a.shape,o,i,1,l,u),d=c.strideDepth,h=c.strideHeight,p=c.strideWidth,f=c.filterDepth,m=c.filterHeight,g=c.filterWidth,y=c.dilationDepth,A=c.dilationHeight,x=c.dilationWidth,b=c.effectiveFilterDepth,v=c.effectiveFilterHeight,w=c.effectiveFilterWidth,I=b-1-c.padInfo.front,T=w-1-c.padInfo.left,C=v-1-c.padInfo.top,M=Le(a.shape,"float32"),$=1/(f*m*g),R=n.bufferSync(s);for(let N=0;N=c.outDepth||Math.floor(ne)!==ne))for(let de=0;de=c.outHeight||Math.floor(he)!==he))for(let ge=0;ge=c.outWidth||Math.floor(be)!==be)continue;se+=R.get(N,ne,he,be,F)}}}M.set(se*$,N,B,j,X,F)}return n.makeTensorInfo(M.shape,M.dtype,M.values)}var oie={kernelName:wy,backendName:"cpu",kernelFunc:aie};function iie(e){let{inputs:t,backend:n,attrs:r}=e,{dy:s,input:a}=t,o=a;Te([s,a],"avgPoolGrad");let{filterSize:i,strides:l,pad:u}=r,c=_.computePool2DInfo(o.shape,i,l,1,u),d=c.strideHeight,h=c.strideWidth,p=c.filterHeight,f=c.filterWidth,m=c.dilationHeight,g=c.dilationWidth,y=c.effectiveFilterHeight,A=c.effectiveFilterWidth,x=A-1-c.padInfo.left,b=y-1-c.padInfo.top,v=Le(o.shape,"float32"),w=1/(p*f),I=n.data.get(s.dataId).values,T=Le(s.shape,"float32",I);for(let C=0;C=c.outHeight||Math.floor(X)!==X))for(let Y=0;Y=c.outWidth||Math.floor(ee)!==ee)continue;B+=T.get(C,X,ee,M)}}v.set(B*w,C,$,R,M)}return n.makeTensorInfo(v.shape,v.dtype,v.values)}var lie={kernelName:vy,backendName:"cpu",kernelFunc:iie};function uie(e){let{inputs:t,backend:n,attrs:r}=e,{x:s,scale:a,offset:o,mean:i,variance:l}=t;k.assert(i.shape.length===l.shape.length,()=>"Batch normalization gradient requires mean and variance to have equal ranks."),k.assert(o==null||i.shape.length===o.shape.length,()=>"Batch normalization gradient requires mean and offset to have equal ranks."),k.assert(a==null||i.shape.length===a.shape.length,()=>"Batch normalization gradient requires mean and scale to have equal ranks."),Te([s,i,l,a,o],"batchNorm");let{varianceEpsilon:u}=r;u==null&&(u=.001);let c=n.data.get(s.dataId).values,d=n.data.get(i.dataId).values,h=n.data.get(l.dataId).values,p=a?n.data.get(a.dataId).values:new Float32Array([1]),f=o?n.data.get(o.dataId).values:new Float32Array([0]),m=new Float32Array(c.length),g=f.length,y=p.length,A=h.length,x=d.length,b=0,v=0,w=0,I=0;for(let T=0;T=g&&(b=0),v>=x&&(v=0),w>=y&&(w=0),I>=A&&(I=0);return n.makeTensorInfo(s.shape,s.dtype,m)}var cie={kernelName:cl,backendName:"cpu",kernelFunc:uie};function die(e){let{inputs:t,backend:n,attrs:r}=e,{x:s}=t,{blockShape:a,crops:o}=r;Te([s],"batchToSpaceND");let i=a.reduce((y,A)=>y*A),l=_.getReshaped(s.shape,a,i),u=_.getPermuted(l.length,a.length),c=_.getReshapedPermuted(s.shape,a,i),d=_.getSliceBeginCoords(o,a.length),h=_.getSliceSize(c,o,a.length),p=Ft({inputs:{x:s},backend:n,attrs:{shape:l}}),f=Pr({inputs:{x:p},backend:n,attrs:{perm:u}}),m=Ft({inputs:{x:f},backend:n,attrs:{shape:c}}),g=fi({inputs:{x:m},backend:n,attrs:{begin:d,size:h}});return n.disposeIntermediateTensorInfo(p),n.disposeIntermediateTensorInfo(f),n.disposeIntermediateTensorInfo(m),g}var hie={kernelName:Xp,backendName:"cpu",kernelFunc:die};function pie(e){let{inputs:t,backend:n,attrs:r}=e,{x:s,weights:a}=t,{size:o}=r,i=n.data.get(s.dataId).values,l=n.data.get(a.dataId).values,u=R5(i,l,a.dtype,a.shape,o);return n.makeTensorInfo([o],a.dtype,u)}var fie={kernelName:ky,backendName:"cpu",kernelFunc:pie},mie=xt(Co,(e,t)=>{let n=t;return e>n.clipValueMax?n.clipValueMax:e{let{x:t}=e.inputs,n=e.backend,r=new Float32Array(k.sizeFromShape(t.shape)),s=n.data.get(t.dataId),a=s.complexTensorInfos.real,o=s.complexTensorInfos.imag,i=n.data.get(a.dataId).values,l=n.data.get(o.dataId).values;for(let u=0;um.shape),a);if(k.sizeFromShape(o)===0)return n.makeTensorInfo(o,t[0].dtype,[]);let i=t.filter(m=>k.sizeFromShape(m.shape)>0);if(i.length===1)return zs({inputs:{x:i[0]},backend:n});let l=i.map(m=>m.shape);if(_.assertParamsConsistent(l,a),i[0].dtype==="complex64"){let m=i.map(b=>pi({inputs:{input:b},backend:n})),g=i.map(b=>hu({inputs:{input:b},backend:n})),y=pu({inputs:m,backend:n,attrs:{axis:a}}),A=pu({inputs:g,backend:n,attrs:{axis:a}}),x=fr({inputs:{real:y,imag:A},backend:n});return m.forEach(b=>n.disposeIntermediateTensorInfo(b)),g.forEach(b=>n.disposeIntermediateTensorInfo(b)),n.disposeIntermediateTensorInfo(y),n.disposeIntermediateTensorInfo(A),x}let u=i.map(m=>{let g=k.sizeFromShape(m.shape.slice(a));return Ft({inputs:{x:m},backend:n,attrs:{shape:[-1,g]}})}),c=u.map(m=>({vals:n.data.get(m.dataId).values,shape:m.shape}));o=_.computeOutShape(u.map(m=>m.shape),1);let d=u[0].shape[0]===1,h=KT(c,o,t[0].dtype,d),p=_.computeOutShape(i.map(m=>m.shape),a),f=n.makeTensorInfo(p,t[0].dtype,h);return u.forEach(m=>n.disposeIntermediateTensorInfo(m)),f}var bie={kernelName:Ec,backendName:"cpu",kernelFunc:pu};function zN(e){let{inputs:t,backend:n,attrs:r}=e,{x:s,filter:a}=t,{strides:o,pad:i,dataFormat:l,dilations:u,dimRoundingMode:c}=r;Te([s,a],"conv2d");let d=_.convertConv2DDataFormat(l),h=_.computeConv2DInfo(s.shape,a.shape,o,u,i,c,!1,d),p=h.filterHeight,f=h.filterWidth,m=h.dilationHeight,g=h.dilationWidth,y=h.padInfo.left,A=h.padInfo.top,x=h.dataFormat==="channelsLast",b=new Qt(h.outShape,s.dtype),v=k.computeStrides(s.shape),w=k.computeStrides(a.shape),I=v[0],T=x?v[1]:v[2],C=x?v[2]:1,M=x?1:v[1],$=b.strides[0],R=x?b.strides[1]:b.strides[2],N=x?b.strides[2]:1,F=x?1:b.strides[1],B=n.data.get(s.dataId).values,j=n.data.get(a.dataId).values,X=b.values;for(let Y=0;Y=h.inHeight)continue;let ge=de*w[0],be=ee+he*T;for(let Ee=0;Ee=h.inWidth)continue;let vt=ge+qe*w[1],ft=be+We*C,mt=vt;for(let dt=0;dt=u.inDepth)continue;let Y=j*C[0],ee=$+X*T[1];for(let oe=0;oe=u.inHeight)continue;let he=Y+ne*C[1],ge=ee+de*T[2];for(let be=0;be=u.inWidth)continue;let We=he+ze*C[2],vt=ge+qe*u.inChannels,ft=We;for(let mt=0;mtMath.cos(e)),Die={kernelName:rl,backendName:"cpu",kernelFunc:Rie},Fie=xt($c,e=>Math.cosh(e)),Mie={kernelName:$c,backendName:"cpu",kernelFunc:Fie};function Oie(e){let{inputs:t,backend:n,attrs:r}=e,{image:s,boxes:a,boxInd:o}=t,{cropSize:i,method:l,extrapolationValue:u}=r,[c,d,h,p]=s.shape,f=a.shape[0],[m,g]=i,y=Le([f,m,g,p],"float32"),A=n.data.get(a.dataId).values,x=n.data.get(o.dataId).values,b=n.data.get(s.dataId).values,v=k.computeStrides(s.shape),w=k.computeStrides(y.shape);for(let I=0;I=c)continue;let F=m>1?($-C)*(d-1)/(m-1):0,B=g>1?(R-M)*(h-1)/(g-1):0;for(let j=0;j1?C*(d-1)+j*F:.5*(C+$)*(d-1);if(X<0||X>d-1){for(let Y=0;Y1?M*(h-1)+se*B:.5*(M+R)*(h-1);if(ie<0||ie>h-1){for(let ge=0;ge1?M*(h-1)+Y*B:.5*(M+R)*(h-1);if(ee<0||ee>h-1){for(let ie=0;iey+f-A-1:(y,A)=>y+A;for(let y=0;y`Only NHWC dataFormat supported on CPU for depthToSpace. Got ${o}`),k.assert(a>1,()=>`blockSize should be > 1 for depthToSpace, but was: ${a}`);let i=s.shape[0],l=s.shape[1],u=s.shape[2],c=s.shape[3],d=l*a,h=u*a,p=c/(a*a),f=n.data.get(s.dataId).values,m=new Float32Array(i*d*h*p),g=0;for(let y=0;y`Error in depthwiseConv2d: Either strides or dilations must be 1. Got strides ${o} and dilations '${h}'`);let p=_.computeConv2DInfo(s.shape,a.shape,o,h,i,u,!0),{filterHeight:f,filterWidth:m,dilationHeight:g,dilationWidth:y,padInfo:A}=p,x=A.left,b=A.top,v=p.outChannels/p.inChannels,w=new Qt(p.outShape,s.dtype),I=n.data.get(s.dataId).values,T=n.data.get(a.dataId).values,C=w.values;for(let M=0;M=p.inHeight)continue;let Y=j*d[0],ee=$+X*c[1];for(let oe=0;oe=p.inWidth)continue;let he=Y+ne*d[1],ge=ee+de*p.inChannels,be=se,Ee=he;for(let $e=0;$e{let{x:r,filter:s}=e,{strides:a,pad:o,dilations:i}=n,l=t,u=l.data.get(r.dataId).values,c=r.shape.length,d=l.data.get(s.dataId).values,h=s.shape.length,{batchSize:p,inHeight:f,inWidth:m,inChannels:g,outHeight:y,outWidth:A,padInfo:x,strideHeight:b,strideWidth:v,filterHeight:w,filterWidth:I,dilationHeight:T,dilationWidth:C,outShape:M}=_.computeDilation2DInfo(r.shape,s.shape,a,o,"NHWC",i),$=k.sizeFromShape(M),R=M.length,N=k.getArrayFromDType(r.dtype,$);for(let B=0;B=0&&de=0&&gese&&(se=$e)}}}let ie=k.locToIndex([B,j,Y,oe],R,k.computeStrides(M));N[ie]=se}}}return{dataId:l.write(k.toTypedArray(N,r.dtype),M,r.dtype),shape:M,dtype:r.dtype}}},Jie={kernelName:Dy,backendName:"cpu",kernelFunc:({inputs:e,backend:t,attrs:n})=>{let{x:r,filter:s,dy:a}=e,{strides:o,pad:i,dilations:l}=n,u=t,c=k.toNestedArray(r.shape,u.data.get(r.dataId).values),d=k.toNestedArray(s.shape,u.data.get(s.dataId).values),{batchSize:h,inHeight:p,inWidth:f,inChannels:m,outHeight:g,outWidth:y,padInfo:A,strideHeight:x,strideWidth:b,filterHeight:v,filterWidth:w,dilationHeight:I,dilationWidth:T,outShape:C}=_.computeDilation2DInfo(r.shape,s.shape,o,i,"NHWC",l);k.assert(a.rank===C.length,()=>`Error in ${Dy}, dy must have the same rank as output ${C.length}, but got ${a.rank}`);let M=k.toNestedArray(C,u.data.get(a.dataId).values),$=k.makeZerosNestedTypedArray(s.shape,s.dtype);for(let N=0;N=0&&ne=0&&heee&&(ee=ge,oe=ie,se=de)}}}$[oe][se][Y]+=M[N][F][j][Y]}}}return{dataId:u.write(k.toTypedArray($,r.dtype),s.shape,s.dtype),shape:s.shape,dtype:s.dtype}}},Qie={kernelName:Ry,backendName:"cpu",kernelFunc:({inputs:e,backend:t,attrs:n})=>{let{x:r,filter:s,dy:a}=e,{strides:o,pad:i,dilations:l}=n,u=t,c=k.toNestedArray(r.shape,u.data.get(r.dataId).values),d=k.toNestedArray(s.shape,u.data.get(s.dataId).values),{batchSize:h,inHeight:p,inWidth:f,inChannels:m,outHeight:g,outWidth:y,padInfo:A,strideHeight:x,strideWidth:b,filterHeight:v,filterWidth:w,dilationHeight:I,dilationWidth:T,outShape:C}=_.computeDilation2DInfo(r.shape,s.shape,o,i,"NHWC",l);k.assert(a.rank===C.length,()=>`Error in ${Ry}, dy must have the same rank as output ${C.length}, but got ${a.rank}`);let M=k.toNestedArray(C,u.data.get(a.dataId).values),$=k.makeZerosNestedTypedArray(r.shape,r.dtype);for(let N=0;N=0&&ne=0&&heee&&(ee=ge,oe=ne,se=he)}}}$[N][oe][se][Y]+=M[N][F][j][Y]}}}return{dataId:u.write(k.toTypedArray($,r.dtype),r.shape,r.dtype),shape:r.shape,dtype:r.dtype}}};function nh(e){let{inputs:t,backend:n,attrs:r}=e,{x:s}=t,{axis:a,keepDims:o}=r;Te(s,"sum");let i;s.dtype==="bool"?i=Ja({inputs:{x:s},backend:n,attrs:{dtype:"int32"}}):i=zs({inputs:{x:s},backend:n});let l=i.shape.length,u=k.parseAxisParam(a,i.shape),c=_.getAxesPermutation(u,l),d=u,h=i;c!=null&&(h=Pr({inputs:{x:i},backend:n,attrs:{perm:c}}),d=_.getInnerMostAxes(d.length,l)),_.assertAxesAreInnerMostDims("sum",d,h.shape.length);let[p,f]=_.computeOutAndReduceShapes(h.shape,d),m=_.upcastType(h.dtype,"int32"),g=Em(n,p,m),y=k.sizeFromShape(f),A=n.data.get(g.dataId).values,x=n.data.get(h.dataId).values;for(let b=0;b=0&&(h=nh({inputs:{x:h},backend:n,attrs:{axis:u[m]-(o.length-p),keepDims:!1}}),f.push(h)),p--)}for(let m of f)m!==h&&n.disposeIntermediateTensorInfo(m);return h}var nle={kernelName:Fy,backendName:"cpu",kernelFunc:tle};function rle(e){let{inputs:t,backend:n}=e,{dy:r,y:s}=t;Te([r,s],"eluGrad");let a=new Float32Array(k.sizeFromShape(s.shape)),o=n.data.get(s.dataId).values,i=n.data.get(r.dataId).values;for(let l=0;l=1?a[l]=i[l]:a[l]=i[l]*(u+1)}return n.makeTensorInfo(s.shape,"float32",a)}var sle={kernelName:My,backendName:"cpu",kernelFunc:rle},ale=_.ERF_P,ole=_.ERF_A1,ile=_.ERF_A2,lle=_.ERF_A3,ule=_.ERF_A4,cle=_.ERF_A5,dle=xt(Fc,e=>{let t=Math.sign(e),n=Math.abs(e),r=1/(1+ale*n);return t*(1-((((cle*r+ule)*r+lle)*r+ile)*r+ole)*r*Math.exp(-n*n))}),hle={kernelName:Fc,backendName:"cpu",kernelFunc:dle};function _m(e){let{inputs:t,backend:n,attrs:r}=e,{input:s}=t,{dim:a}=r,o=s.shape.length,i=s.shape.slice(),l=a;return a<0&&(k.assert(-(o+1)<=a,()=>`Axis must be in the interval [${-(o+1)}, ${o}]`),l=o+a+1),i.splice(l,0,1),Ft({inputs:{x:s},backend:n,attrs:{shape:i}})}var ple={kernelName:Mc,backendName:"cpu",kernelFunc:_m},fle=nn((e,t)=>e/t),L5=bn(ol,fle),B5={kernelName:ol,backendName:"cpu",kernelFunc:L5};function BN(e,t,n){let r=e.shape,s=r[0],a=r[1],o=n.data.get(e.dataId),i=o.complexTensorInfos.real,l=o.complexTensorInfos.imag,u=[s,a],c=k.sizeFromShape(u),d=k.getTypedArrayFromDType("float32",c),h=k.getTypedArrayFromDType("float32",c);for(let g=0;g{let{image:r}=e,s=n,a=k.getTypedArrayFromDType(r.dtype,k.sizeFromShape(r.shape)),[o,i,l,u]=r.shape,c=s.data.get(r.dataId).values;for(let h=0;h=0&&vMath.floor(e/t)),Ile=bn(ul,kle,null,"int32"),Sle={kernelName:ul,backendName:"cpu",kernelFunc:Ile};function Tle(e){let{inputs:t,backend:n,attrs:r}=e,{x:s,filter:a,bias:o,preluActivationWeights:i}=t,{strides:l,pad:u,dataFormat:c,dilations:d,dimRoundingMode:h,activation:p,leakyreluAlpha:f}=r,m=zN({inputs:{x:s,filter:a},backend:n,attrs:{strides:l,pad:u,dataFormat:c,dilations:d,dimRoundingMode:h}});if(o){let g=m;m=th({inputs:{a:m,b:o},backend:n}),n.disposeIntermediateTensorInfo(g)}if(p){let g=m;m=P5(n,m,p,i,f),n.disposeIntermediateTensorInfo(g)}return m}var Nle={kernelName:Bl,backendName:"cpu",kernelFunc:Tle};function Cle(e){let{inputs:t,backend:n,attrs:r}=e,{x:s,filter:a,bias:o,preluActivationWeights:i}=t,{strides:l,pad:u,dataFormat:c,dilations:d,dimRoundingMode:h,activation:p,leakyreluAlpha:f}=r,m=LN({inputs:{x:s,filter:a},backend:n,attrs:{strides:l,pad:u,dataFormat:c,dilations:d,dimRoundingMode:h}});if(o){let g=m;m=th({inputs:{a:m,b:o},backend:n}),n.disposeIntermediateTensorInfo(g)}if(p){let g=m;m=P5(n,m,p,i,f),n.disposeIntermediateTensorInfo(g)}return m}var Ele={kernelName:Wl,backendName:"cpu",kernelFunc:Cle};function $le(e){let{inputs:t,backend:n}=e,{params:r,indices:s}=t,a=k.sizeFromShape(r.shape),o=s.shape,i=o[o.length-1],[l,u,c,d]=_.prepareAndValidate(r,s);if(u===0)return n.makeTensorInfo(l,r.dtype,[]);let h=n.data.get(s.dataId).values,p=n.bufferSync(r),f=tN(h,p,r.dtype,u,i,c,d,r.shape,a);return n.makeTensorInfo(l,r.dtype,f.values)}var _le={kernelName:zc,backendName:"cpu",kernelFunc:$le};function Rle(e){let{inputs:t,backend:n,attrs:r}=e,{x:s,indices:a}=t,{axis:o,batchDims:i}=r;Te([s,a],"gatherV2");let l=i;i==null&&(l=0);let u=k.sizeFromShape(a.shape),c=k.parseAxisParam(o,s.shape)[0],d=_.segment_util.collectGatherOpShapeInfo(s,a,c,l),h=Ft({inputs:{x:s},backend:n,attrs:{shape:[d.batchSize,d.outerSize,d.dimSize,d.sliceSize]}}),p=Ft({inputs:{x:a},backend:n,attrs:{shape:[d.batchSize,u/d.batchSize]}}),f=[d.batchSize,d.outerSize,u/d.batchSize,d.sliceSize],m=n.bufferSync(p),g=n.bufferSync(h),y=nN(g,m,f);return n.disposeIntermediateTensorInfo(h),n.disposeIntermediateTensorInfo(p),n.makeTensorInfo(d.outputShape,y.dtype,y.values)}var Dle={kernelName:Pc,backendName:"cpu",kernelFunc:Rle};function Fle(e){let{inputs:t,backend:n}=e,{input:r}=t,s=k.sizeFromShape(r.shape),a=r.shape[r.shape.length-1],o=s/a,i=Ft({inputs:{x:r},backend:n,attrs:{shape:[o,a]}}),l=BN(i,!0,n),u=Ft({inputs:{x:l},backend:n,attrs:{shape:r.shape}});return n.disposeIntermediateTensorInfo(i),n.disposeIntermediateTensorInfo(l),u}var Mle={kernelName:Py,backendName:"cpu",kernelFunc:Fle},Ole=xt(Lc,e=>Number.isFinite(e)?1:0,"bool"),Ple={kernelName:Lc,backendName:"cpu",kernelFunc:Ole},zle=xt(Bc,e=>Math.abs(e)===Infinity?1:0,"bool"),Lle={kernelName:Bc,backendName:"cpu",kernelFunc:zle},Ble=xt(Wc,e=>Number.isNaN(e)?1:0,"bool"),Wle={kernelName:Wc,backendName:"cpu",kernelFunc:Ble};function Vle(e){let{backend:t,attrs:n}=e,{start:r,stop:s,num:a}=n,o=iN(r,s,a);return t.makeTensorInfo([o.length],"float32",o)}var Ule={kernelName:Ly,backendName:"cpu",kernelFunc:Vle},Hle=xt(Vc,e=>Math.log1p(e)),Gle={kernelName:Vc,backendName:"cpu",kernelFunc:Hle},jle=nn((e,t)=>e&&t),qle=bn(Uc,jle,null,"bool"),Kle={kernelName:Uc,backendName:"cpu",kernelFunc:qle},Xle=xt(ef,e=>e?0:1,"bool"),Zle={kernelName:ef,backendName:"cpu",kernelFunc:Xle},Yle=nn((e,t)=>e||t),Jle=bn(tf,Yle,null,"bool"),Qle={kernelName:tf,backendName:"cpu",kernelFunc:Jle};function eue(e){let{inputs:t,backend:n,attrs:r}=e,{x:s}=t,{depthRadius:a,bias:o,alpha:i,beta:l}=r;Te(s,"LRN");let u=s.shape[3],c=u-1,d=n.data.get(s.dataId).values,h=k.sizeFromShape(s.shape),p=new Float32Array(h);function f(m){let g=m%u,y=m-g+Math.max(0,g-a),A=m-g+Math.min(g+a,c),x=0;for(;y<=A;y++){let b=d[y];x+=b*b}return x}for(let m=0;m`Error in maxPool: Either strides or dilations must be 1. Got strides ${o} and dilations '${u}'`);let c=_.computePool2DInfo(s.shape,a,o,u,i,l),d;if(c.filterWidth===1&&c.filterHeight===1&&k.arraysEqual(c.inShape,c.outShape))d=zs({inputs:{x:s},backend:n});else{let h=n.data.get(s.dataId).values,p=k.computeStrides(s.shape),f=z5(h,s.shape,s.dtype,p,c,"max");d=n.makeTensorInfo(c.outShape,s.dtype,f.values)}return d}var oue={kernelName:yl,backendName:"cpu",kernelFunc:aue};function iue(e){let{inputs:t,backend:n,attrs:r}=e,{x:s}=t,{filterSize:a,strides:o,pad:i,dimRoundingMode:l,dataFormat:u}=r;Te(s,"maxPool3d");let c=_.computePool3DInfo(s.shape,a,o,1,i,l,u),d=n.data.get(s.dataId).values,h=PN(d,s.shape,s.dtype,k.computeStrides(s.shape),c,"max");return n.makeTensorInfo(h.shape,"float32",h.values)}var lue={kernelName:rf,backendName:"cpu",kernelFunc:iue};function uue(e){let{inputs:t,backend:n,attrs:r}=e,{dy:s,input:a}=t,{filterSize:o,strides:i,pad:l,dimRoundingMode:u}=r;Te([s,a],"maxPool3DGrad");let c=_.computePool3DInfo(a.shape,o,i,1,l,u),d=n.bufferSync(a),h=eie(d,c),p=c.strideDepth,f=c.strideHeight,m=c.strideWidth,g=c.dilationDepth,y=c.dilationHeight,A=c.dilationWidth,x=c.effectiveFilterDepth,b=c.effectiveFilterHeight,v=c.effectiveFilterWidth,w=x-1-c.padInfo.front,I=v-1-c.padInfo.left,T=b-1-c.padInfo.top,C=Le(a.shape,"float32"),M=n.bufferSync(s);for(let $=0;$=c.outDepth||Math.floor(se)!==se))for(let ie=0;ie=c.outHeight||Math.floor(ne)!==ne))for(let de=0;de=c.outWidth||Math.floor(he)!==he)continue;let ge=x*b*v-1-h.get($,se,ne,he,R),be=oe*b*v+ie*v+de,Ee=ge===be?1:0;if(Ee===0)continue;ee+=M.get($,se,ne,he,R)*Ee}}}C.set(ee,$,N,F,B,R)}return n.makeTensorInfo(C.shape,C.dtype,C.values)}var cue={kernelName:Vy,backendName:"cpu",kernelFunc:uue};function due(e){let{inputs:t,backend:n,attrs:r}=e,{dy:s,input:a,output:o}=t,i=a;Te([a,o],"maxPoolGrad");let{filterSize:l,strides:u,pad:c,dimRoundingMode:d}=r,h=_.computePool2DInfo(i.shape,l,u,1,c,d),p=n.data.get(i.dataId).values,f=Le(h.outShape,i.dtype,ON(p,i.shape,i.dtype,h).values),m=h.strideHeight,g=h.strideWidth,y=h.dilationHeight,A=h.dilationWidth,x=h.effectiveFilterHeight,b=h.effectiveFilterWidth,v=b-1-h.padInfo.left,w=x-1-h.padInfo.top,I=Le(i.shape,"float32"),T=n.data.get(s.dataId).values,C=Le(s.shape,"float32",T);for(let M=0;M=h.outHeight||Math.floor(Y)!==Y))for(let ee=0;ee=h.outWidth||Math.floor(oe)!==oe)continue;let se=x*b-1-f.get(M,Y,oe,$),ie=X*b+ee,ne=se===ie?1:0;if(ne===0)continue;j+=C.get(M,Y,oe,$)*ne}}I.set(j,M,R,N,$)}return n.makeTensorInfo(I.shape,I.dtype,I.values)}var hue={kernelName:Wy,backendName:"cpu",kernelFunc:due};function pue(e,t,n,r,s){let a=k.computeStrides(t),o=z5(e,t,n,a,s,"max"),i=ON(e,t,n,s,!0,r);return[o.values,i.values]}var fue={kernelName:Uy,backendName:"cpu",kernelFunc:({inputs:e,attrs:t,backend:n})=>{let{x:r}=e,{filterSize:s,strides:a,pad:o,includeBatchInIndex:i}=t,l=n;Te(r,"MaxPoolWithArgmax");let u=l.data.get(r.dataId).values,c=_.computePool2DInfo(r.shape,s,a,[1,1],o),[d,h]=pue(u,r.shape,r.dtype,i,c),p=l.write(d,c.outShape,r.dtype),f=l.write(h,c.outShape,r.dtype);return[{dataId:p,shape:c.outShape,dtype:r.dtype},{dataId:f,shape:c.outShape,dtype:"int32"}]}};function mue(e){let{inputs:t,backend:n,attrs:r}=e,{x:s}=t,{axis:a,keepDims:o}=r,i=k.parseAxisParam(a,s.shape),u=_.computeOutAndReduceShapes(s.shape,i)[1],c=k.sizeFromShape(u),d=[],h=n.makeTensorInfo([],"float32",new Float32Array([c]));d.push(h);let p=Ja({inputs:{x:s},backend:n,attrs:{dtype:"float32"}});d.push(p);let f=L5({inputs:{a:p,b:h},backend:n});d.push(f);let m=nh({inputs:{x:f},backend:n,attrs:{axis:a,keepDims:o}});return d.forEach(g=>n.disposeIntermediateTensorInfo(g)),m}var gue={kernelName:Al,backendName:"cpu",kernelFunc:mue};function yue(e){let{inputs:t,backend:n,attrs:r}=e,{x:s}=t,{axis:a,keepDims:o}=r;Te(s,"min");let i=k.parseAxisParam(a,s.shape),l=i,u=_.getAxesPermutation(l,s.shape.length),c=s;u!=null&&(c=Pr({inputs:{x:s},backend:n,attrs:{perm:u}}),l=_.getInnerMostAxes(l.length,s.shape.length)),_.assertAxesAreInnerMostDims("min",l,c.shape.length);let[d,h]=_.computeOutAndReduceShapes(c.shape,l),p=k.sizeFromShape(h),f=k.makeZerosTypedArray(k.sizeFromShape(d),c.dtype),m=n.data.get(c.dataId).values;for(let y=0;yx[0]+s.shape[b]+x[1]),l=a.map(x=>x[0]),u=a.map((x,b)=>x[0]+s.shape[b]),c=o==="reflect"?0:1,d=n.data.get(s.dataId).values,h=s.shape.length,p=k.computeStrides(s.shape),f=k.sizeFromShape(i),m=i.length,g=k.computeStrides(i),y=k.getTypedArrayFromDType(s.dtype,f);for(let x=0;x=u[w]&&(b[w]=(u[w]-1)*2-b[w]+c);b=b.map((w,I)=>w-l[I]);let v=k.locToIndex(b,h,p);y[x]=d[v]}return{dataId:n.write(y,i,s.dtype),shape:i,dtype:s.dtype}}var bue={kernelName:bl,backendName:"cpu",kernelFunc:xue},vue=nn((e,t)=>{let n=e%t;return e<0&&t<0||e>=0&&t>=0?n:(n+t)%t}),wue=bn(Hc,vue),kue={kernelName:Hc,backendName:"cpu",kernelFunc:wue},Iue=Ks(e2());function VN(e){let{inputs:t,backend:n,attrs:r}=e,{logits:s}=t,{dim:a}=r,o=s.shape.length,i=a;if(i===-1&&(i=o-1),i!==o-1)throw Error(`Softmax along a non-last dimension is not yet supported. Logits was rank ${o} and dim was ${i}`);let l=k.parseAxisParam([i],s.shape),u=WN({inputs:{x:s},backend:n,attrs:{reductionIndices:l,keepDims:!1}}),c=_.expandShapeToKeepDim(u.shape,l),d=Ft({inputs:{x:u},backend:n,attrs:{shape:c}}),h=O5({inputs:{a:s,b:d},backend:n}),p=JT({inputs:{x:h},backend:n}),f=nh({inputs:{x:p},backend:n,attrs:{axis:l,keepDims:!1}}),m=Ft({inputs:{x:f},backend:n,attrs:{shape:c}}),g=L5({inputs:{a:p,b:m},backend:n});return n.disposeIntermediateTensorInfo(u),n.disposeIntermediateTensorInfo(d),n.disposeIntermediateTensorInfo(h),n.disposeIntermediateTensorInfo(p),n.disposeIntermediateTensorInfo(f),n.disposeIntermediateTensorInfo(m),g}var Sue={kernelName:Ml,backendName:"cpu",kernelFunc:VN};function Tue(e){let{inputs:t,backend:n,attrs:r}=e,{logits:s}=t,{numSamples:a,seed:o,normalized:i}=r;Te(s,"multinomial");let l=i?s:VN({inputs:{logits:s},backend:n,attrs:{dim:-1}}),u=l.shape[0],c=l.shape[1],d=n.data.get(l.dataId).values,h=[u,a],p=k.makeZerosTypedArray(k.sizeFromShape(h),"int32");for(let f=0;f=0&&c[d]{k.assertShapesMatch(a,c.shape,"All tensors passed to stack must have matching shapes"),k.assert(o===c.dtype,()=>"All tensors passed to stack must have matching dtypes")});let i=[],l=t.map(c=>{let d=_m({inputs:{input:c},backend:n,attrs:{dim:s}});return i.push(d),d}),u=pu({inputs:l,backend:n,attrs:{axis:s}});return i.forEach(c=>n.disposeIntermediateTensorInfo(c)),u}var Wue={kernelName:Zc,backendName:"cpu",kernelFunc:HN};function Vue(e){let{inputs:t,backend:n,attrs:r}=e,{x:s}=t,{paddings:a,constantValue:o}=r;Te(s,"pad");let i=a.map((A,x)=>A[0]+s.shape[x]+A[1]),l=a.map(A=>A[0]),u=n.data.get(s.dataId).values,c=k.sizeFromShape(s.shape),d=s.shape.length,h=k.computeStrides(s.shape),p=k.sizeFromShape(i),f=i.length,m=k.computeStrides(i),g=k.getTypedArrayFromDType(s.dtype,p);o!==0&&g.fill(o);for(let A=0;Aw+l[I]),v=k.locToIndex(b,f,m);g[v]=u[A]}return{dataId:n.write(g,i,s.dtype),shape:i,dtype:s.dtype}}var GN={kernelName:kl,backendName:"cpu",kernelFunc:Vue},Uue=nn((e,t)=>Math.pow(e,t)),Hue=bn(Il,Uue),Gue={kernelName:Il,backendName:"cpu",kernelFunc:Hue};function jue(e){let{backend:t,attrs:n}=e,{start:r,stop:s,dtype:a,step:o}=n,i=mN(r,s,o,a);return t.makeTensorInfo([i.length],a,i)}var que={kernelName:sf,backendName:"cpu",kernelFunc:jue},Kue=xt(Jc,e=>1/e),Xue={kernelName:Jc,backendName:"cpu",kernelFunc:Kue};function Zue(e){let{inputs:t,backend:n,attrs:r}=e,{images:s}=t,{alignCorners:a,halfPixelCenters:o,size:i}=r;Te(s,"resizeBilinear");let l=k.computeStrides(s.shape),[u,c]=i,[d,h,p,f]=s.shape,m=n.data.get(s.dataId).values,g=new Float32Array(k.sizeFromShape([d,u,c,f])),y=[a&&u>1?h-1:h,a&&c>1?p-1:p],A=[a&&u>1?u-1:u,a&&c>1?c-1:c],x=0,b=y[0]/A[0],v=y[1]/A[1];for(let w=0;w1?u-1:u,o&&p>1?c-1:c],g=[o&&h>1?h-1:h,o&&p>1?p-1:p],y=m[0]/g[0],A=m[1]/g[1],x=n.data.get(a.dataId).values,b=0;for(let v=0;v1?h-1:h,a&&c>1?p-1:p],A=[a&&u>1?u-1:u,a&&c>1?c-1:c],x=y[0]/A[0],b=y[1]/A[1],v=0;for(let w=0;w1?c-1:c,o&&f>1?d-1:d],A=[o&&p>1?p-1:p,o&&f>1?f-1:f],x=y[0]/A[0],b=y[1]/A[1],v=1/x,w=1/b,I=Math.ceil(v)*2+2,T=Math.ceil(w)*2+2;for(let C=0;C=p)continue;let ne=M+ie*l[1],de=ie*x,he=Math.min(c-1,o?Math.round(de):Math.floor(de));if($===he)for(let ge=0;ge=f)continue;let Ee=ne+be*l[2],$e=be*b,ze=Math.min(d-1,o?Math.round($e):Math.floor($e));B===ze&&(oe+=g[Ee+ee])}}m[j+ee]=oe}}}}return n.makeTensorInfo(s.shape,s.dtype,m)}var rce={kernelName:jy,backendName:"cpu",kernelFunc:nce};function sce(e){let{inputs:t,backend:n,attrs:r}=e,{x:s}=t,{dims:a}=r;Te(s,"reverse");let o=s.shape.length,i=k.parseAxisParam(a,s.shape);if(o===0)return zs({inputs:{x:s},backend:n});let l=new Qt(s.shape,s.dtype),u=n.bufferSync(s);for(let c=0;ch[p]=s.shape[p]-1-h[p]),l.set(u.get(...h),...d)}return n.makeTensorInfo(l.shape,l.dtype,l.values)}var ace={kernelName:El,backendName:"cpu",kernelFunc:sce},oce={kernelName:pd,backendName:"cpu",kernelFunc:({inputs:e,attrs:t,backend:n})=>{let{image:r}=e,{radians:s,fillValue:a,center:o}=t,i=n,l=k.getTypedArrayFromDType(r.dtype,k.sizeFromShape(r.shape)),[u,c,d,h]=r.shape,[p,f]=_.getImageCenter(o,c,d),m=255,g=Math.sin(s),y=Math.cos(s),A=i.data.get(r.dataId).values;for(let b=0;b=0&&F=0&&B{let t=Math.floor(e);return e-t<.5?Math.floor(e):e-t>.5?Math.ceil(e):t%2==0?t:t+1}),lce={kernelName:$l,backendName:"cpu",kernelFunc:ice};function jN(e,t,n,r,s,a,o,i,l,u){let c=[r/s,s],d=e.values,h=t.values;if(r===0)return Le(n,t.dtype);let p=Le(c,t.dtype);p.values.fill(l);for(let f=0;f=r/s)throw new Error(`Invalid indices: ${m} does not index into ${n}`);for(let y=0;y1||s.shape.length===1?1:k.sizeFromShape(s.shape.slice(1));for(let f=0;fe>=0?fce*e:pce*(Math.exp(e)-1)),gce={kernelName:nd,backendName:"cpu",kernelFunc:mce},yce=xt(ad,e=>e<0?-1:e>0?1:0),Ace={kernelName:ad,backendName:"cpu",kernelFunc:yce},xce=xt(_l,e=>Math.sin(e)),bce={kernelName:_l,backendName:"cpu",kernelFunc:xce},vce=xt(sd,e=>Math.sinh(e)),wce={kernelName:sd,backendName:"cpu",kernelFunc:vce},kce=11920928955078125e-23,qN=Math.log(kce)+2,Ice=xt(od,e=>{let t=e>-qN,n=eNumber(g)))),n.makeTensorInfo([m.length],r.dtype,new Int32Array(m))]}var Ece={kernelName:Ky,backendName:"cpu",kernelFunc:Cce};function $ce(e){let{inputs:t,backend:n}=e,{inputIndices:r,inputShape:s,newShape:a}=t;if(r.shape.length!==2)throw new Error(`Input indices should be a matrix but received shape + ${r.shape}`);if(s.shape.length!==1)throw new Error(`Input shape should be a vector but received shape + ${s.shape}`);if(a.shape.length!==1)throw new Error(`Target shape should be a vector but received shape ${a.shape}`);let o=Array.from(n.data.get(s.dataId).values),i=n.data.get(r.dataId).values,l=Array.from(n.data.get(a.dataId).values),[u,c,d]=xN(i,r.shape,r.dtype,o,l);return[n.makeTensorInfo(c,r.dtype,u),n.makeTensorInfo([d.length],a.dtype,new Int32Array(d))]}var _ce={kernelName:Xy,backendName:"cpu",kernelFunc:$ce};function Rce(e){let{inputs:t,backend:n}=e,{data:r,indices:s,segmentIds:a}=t;if(r.shape.length<1)throw new Error("Data should be at least 1 dimensional but received scalar");if(s.shape.length!==1)throw new Error(`Indices should be a vector but received shape + ${s.shape}`);if(a.shape.length!==1)throw new Error(`Segment ids should be a vector but received shape + ${a.shape}`);let o=n.data.get(r.dataId).values,i=n.data.get(s.dataId).values,l=n.data.get(a.dataId).values,[u,c]=M5(o,r.shape,r.dtype,i,l,!0);return n.makeTensorInfo(c,r.dtype,u)}var Dce={kernelName:Zy,backendName:"cpu",kernelFunc:Rce};function Fce(e){let{inputs:t,backend:n}=e,{data:r,indices:s,segmentIds:a}=t;if(r.shape.length<1)throw new Error("Data should be at least 1 dimensional but received scalar");if(s.shape.length!==1)throw new Error(`Indices should be a vector but received shape + ${s.shape}`);if(a.shape.length!==1)throw new Error(`Segment ids should be a vector but received shape + ${a.shape}`);let o=n.data.get(r.dataId).values,i=n.data.get(s.dataId).values,l=n.data.get(a.dataId).values,[u,c]=M5(o,r.shape,r.dtype,i,l);return n.makeTensorInfo(c,r.dtype,u)}var Mce={kernelName:Yy,backendName:"cpu",kernelFunc:Fce};function Oce(e){let{inputs:t,backend:n,attrs:r}=e,{sparseIndices:s,sparseValues:a,defaultValue:o}=t,{outputShape:i}=r,{sliceRank:l,numUpdates:u,sliceSize:c,strides:d,outputSize:h}=_.calculateShapes(a,s,i),p=!1,f=n.bufferSync(s),m=n.bufferSync(a),g=n.data.get(o.dataId).values[0],y=jN(f,m,i,h,c,u,l,d,g,p);return n.makeTensorInfo(i,y.dtype,y.values)}var Pce={kernelName:Jy,backendName:"cpu",kernelFunc:Oce};function zce(e){let{inputs:t,backend:n,attrs:r}=e,{x:s}=t,{numOrSizeSplits:a,axis:o}=r,i=k.parseAxisParam(o,s.shape)[0],l=_.prepareSplitSize(s,a,i),u=new Array(s.shape.length).fill(0),c=s.shape.slice();return l.map(d=>{let h=[...c];h[i]=d;let p=fi({inputs:{x:s},backend:n,attrs:{begin:u,size:h}});return u[i]+=d,p})}var Lce={kernelName:id,backendName:"cpu",kernelFunc:zce},Bce=xt(Dl,e=>Math.sqrt(e)),Wce={kernelName:Dl,backendName:"cpu",kernelFunc:Bce},Vce={kernelName:lf,backendName:"cpu",kernelFunc:({inputs:e,backend:t})=>{let{x:n}=e,r=t;Te(n,"square");let s=r.data.get(n.dataId).values,a=new Float32Array(s.length);for(let i=0;i{let n=t;return isNaN(e)?NaN:e>0?1:n.alpha}),Hce={kernelName:Bo,backendName:"cpu",kernelFunc:Uce};function Gce(e){let{inputs:t,backend:n,attrs:r}=e,{x:s}=t,{begin:a,end:o,strides:i,beginMask:l,endMask:u,ellipsisMask:c,newAxisMask:d,shrinkAxisMask:h}=r;Te(s,"stridedSlice");let{nonStrided:p,$begin:f,$strides:m,size:g,newShape:y,outShape:A}=En.sliceInfo(s.shape,a,o,i,l,u,c,d,h),x=Ft({inputs:{x:s},backend:n,attrs:{shape:y}}),b;if(p){let w=fi({inputs:{x},backend:n,attrs:{begin:f,size:g}});b=Ft({inputs:{x:w},backend:n,attrs:{shape:A}}),n.disposeIntermediateTensorInfo(w)}else if(A.some(w=>w===0))b=n.makeTensorInfo(A,s.dtype,[]);else{let w=n.bufferSync(x),I=vN(A,w,m,f);b=n.makeTensorInfo(I.shape,I.dtype,I.values)}let v=Ft({inputs:{x:b},backend:n,attrs:{shape:A}});return n.disposeIntermediateTensorInfo(x),n.disposeIntermediateTensorInfo(b),v}var jce={kernelName:ld,backendName:"cpu",kernelFunc:Gce};function qce(e){let{inputs:t,backend:n,attrs:r}=e,{separator:s,nGramWidths:a,leftPad:o,rightPad:i,padWidth:l,preserveShortSequences:u}=r,{data:c,dataSplits:d}=t,h=n.data.get(c.dataId).values,p=n.data.get(d.dataId).values,[f,m]=wN(h,p,s,a,o,i,l,u);return[n.makeTensorInfo([f.length],"string",f),n.makeTensorInfo(d.shape,"int32",m)]}var Kce={kernelName:Qy,backendName:"cpu",kernelFunc:qce};function Xce(e){let{inputs:t,backend:n,attrs:r}=e,{skipEmpty:s}=r,{input:a,delimiter:o}=t;if(a.dtype!=="string")throw new Error("Input must be of datatype string");if(a.shape.length!==1)throw new Error(`Input must be a vector, got shape: ${a.shape}`);if(o.shape.length!==0)throw new Error(`Delimiter must be a scalar, got shape: ${o.shape}`);let i=n.data.get(a.dataId).values,l=n.data.get(o.dataId).values[0],[u,c,d]=kN(i,l,s),h=c.length;return[n.makeTensorInfo([h,2],"int32",u),n.makeTensorInfo([h],"string",c),n.makeTensorInfo([2],"int32",new Int32Array(d))]}var Zce={kernelName:eA,backendName:"cpu",kernelFunc:Xce};function Yce(e){let{inputs:t,backend:n,attrs:r}=e,{numBuckets:s}=r,{input:a}=t;if(a.dtype!=="string")throw new Error("Input must be of datatype string");if(s<=0)throw new Error("Number of buckets must be at least 1");let o=n.data.get(a.dataId).values,i=IN(o,s);return n.makeTensorInfo(a.shape,"int32",i)}var Jce={kernelName:tA,backendName:"cpu",kernelFunc:Yce},Qce=xt(Ol,e=>Math.tan(e)),ede={kernelName:Ol,backendName:"cpu",kernelFunc:Qce},tde=xt(Pl,e=>Math.tanh(e)),nde={kernelName:Pl,backendName:"cpu",kernelFunc:tde};function rde(e){let{inputs:t,backend:n,attrs:r}=e,{x:s}=t,{reps:a}=r;Te(s,"tile");let o=TN(n.bufferSync(s),a);return n.makeTensorInfo(o.shape,o.dtype,o.values)}var sde={kernelName:Lo,backendName:"cpu",kernelFunc:rde};function ade(e){let{inputs:t,backend:n,attrs:r}=e,{x:s}=t,{k:a,sorted:o}=r;Te(s,"topk");let i=n.data.get(s.dataId).values,[l,u]=NN(i,s.shape,s.dtype,a,o);return[n.makeTensorInfo(l.shape,l.dtype,l.values),n.makeTensorInfo(u.shape,u.dtype,u.values)]}var ode={kernelName:ud,backendName:"cpu",kernelFunc:ade};function ide(e){let{inputs:t,attrs:n,backend:r}=e,{image:s,transforms:a}=t,{interpolation:o,fillMode:i,fillValue:l,outputShape:u}=n,[c,d,h,p]=s.shape,[f,m]=u!=null?u:[d,h],g=[c,f,m,p],y=k.computeStrides(s.shape),A=y[0],x=y[1],b=y[2],v=k.getTypedArrayFromDType(s.dtype,k.sizeFromShape(g));v.fill(l);let w=r.data.get(s.dataId).values,I=r.data.get(a.dataId).values;for(let C=0;Ct-1)if(t<=1)n=0;else{let r=2*t;n-=r*Math.trunc(n/r),n>=t&&(n=r-n-1)}return k.clamp(0,n,t-1)}function cde(e,t){let n=e;if(n<0)if(t<=1)n=0;else{let r=t-1;n+=t*(Math.trunc(-n/r)+1)}else if(n>t-1)if(t<=1)n=0;else{let r=t-1;n-=t*Math.trunc(n/r)}return k.clamp(0,n,t-1)}function dde(e,t){return e}function hde(e,t){return k.clamp(0,e,t-1)}function rh(e,t,n,r,s,a,o,i,l,u,c){let d=o*r+i*s+l*a+u;return 0<=i&&in.disposeIntermediateTensorInfo(f)),p}var bde={kernelName:uf,backendName:"cpu",kernelFunc:xde},vde=[Coe,Iae,$oe,Roe,$ae,Foe,Ooe,zoe,Boe,Voe,Hoe,joe,Koe,Yoe,Qoe,nie,sie,oie,lie,Toe,cie,hie,fie,Cae,Rae,gie,Sae,Aie,bie,kie,Sie,vie,Eie,_ie,Nie,Die,Mie,Pie,Lie,Wie,Uie,Hie,jie,Kie,Zie,Yie,Qie,Jie,B5,nle,Aoe,sle,Dae,hle,Fae,ple,Oae,xle,ble,wle,zae,Sle,Nle,Ele,_le,Dle,Bae,Vae,Tae,Mle,xie,Ple,Lle,Wle,xoe,Hae,jae,Ule,Kae,Gle,Kle,Zle,Qle,tue,rue,Zae,oue,lue,cue,hue,fue,sue,gue,Aue,Jae,bue,kue,Nue,eoe,noe,$ue,Due,Oue,soe,zue,Bue,Wue,GN,Gue,voe,ioe,que,Nae,Xue,woe,koe,Soe,Yue,Que,tce,rce,ace,oce,lce,uoe,cce,hce,gce,Ioe,Ace,bce,wce,coe,Sue,Sce,Nce,Ece,_ce,Dce,Mce,Pce,Lce,Wce,Vce,hoe,Hce,jce,Kce,Zce,Jce,goe,ele,ede,nde,sde,ode,aoe,lde,gde,Ade,bde,Lue];for(let e of vde)oA(e);var XN={};De(XN,{assertNotComplex:()=>mu,bindCanvasToFramebuffer:()=>Dde,bindColorTextureToFramebuffer:()=>Mm,bindTextureToProgramUniformSampler:()=>cC,bindTextureUnit:()=>iC,bindVertexBufferToProgramAttribute:()=>G5,callAndCheck:()=>Ie,canBeRepresented:()=>ZN,createFragmentShader:()=>QN,createFramebuffer:()=>oC,createProgram:()=>eC,createStaticIndexBuffer:()=>rC,createStaticVertexBuffer:()=>nC,createTexture:()=>sC,createVertexShader:()=>JN,getBatchDim:()=>gi,getExtensionOrThrow:()=>ih,getFramebufferErrorMessage:()=>dC,getMaxTexturesInShader:()=>mC,getNumChannels:()=>_de,getProgramUniformLocation:()=>uC,getProgramUniformLocationOrThrow:()=>lC,getRowsCols:()=>yi,getShapeAs3D:()=>Om,getTextureShapeFromLogicalShape:()=>pC,getWebGLDisjointQueryTimerVersion:()=>gC,getWebGLErrorMessage:()=>YN,getWebGLMaxTextureSize:()=>fC,hasExtension:()=>Lr,isCapableOfRenderingToFloatTexture:()=>yC,isDownloadFloatTextureEnabled:()=>AC,isReshapeFree:()=>uh,isWebGLFenceEnabled:()=>xC,isWebGLVersionEnabled:()=>q5,linkProgram:()=>tC,resetMaxTextureSize:()=>Fde,resetMaxTexturesInShader:()=>Mde,unbindColorTextureFromFramebuffer:()=>j5,unbindTextureUnit:()=>Rde,validateFramebuffer:()=>lh,validateProgram:()=>Fm,validateTextureSize:()=>aC});var mi={},U5={alpha:!1,antialias:!1,premultipliedAlpha:!1,preserveDrawingBuffer:!1,depth:!1,stencil:!1,failIfMajorPerformanceCaveat:!0};function Dm(e,t){mi[e]=t}function Ls(e){if(!(e in mi)){let n=kde(e);if(n!==null)mi[e]=n;else return console.log("Could not get context for WebGL version",e),null}let t=mi[e];return t.isContextLost()?(delete mi[e],Ls(e)):(t.disable(t.DEPTH_TEST),t.disable(t.STENCIL_TEST),t.disable(t.BLEND),t.disable(t.DITHER),t.disable(t.POLYGON_OFFSET_FILL),t.disable(t.SAMPLE_COVERAGE),t.enable(t.SCISSOR_TEST),t.enable(t.CULL_FACE),t.cullFace(t.BACK),mi[e])}function wde(e){if(typeof OffscreenCanvas!="undefined"&&e===2)return new OffscreenCanvas(300,150);if(typeof document!="undefined")return document.createElement("canvas");throw new Error("Cannot create a canvas in this context")}function kde(e){if(e!==1&&e!==2)throw new Error("Cannot get WebGL rendering context, WebGL is disabled.");let t=wde(e);return t.addEventListener("webglcontextlost",n=>{n.preventDefault(),delete mi[e]},!1),e===1?t.getContext("webgl",U5)||t.getContext("experimental-webgl",U5):t.getContext("webgl2",U5)}var sh;(function(e){e[e.DENSE=0]="DENSE",e[e.SHARED_BATCH=1]="SHARED_BATCH"})(sh||(sh={}));var zr;(function(e){e[e.RENDER=0]="RENDER",e[e.UPLOAD=1]="UPLOAD",e[e.PIXELS=2]="PIXELS",e[e.DOWNLOAD=3]="DOWNLOAD"})(zr||(zr={}));var Tn;(function(e){e[e.UNPACKED_FLOAT16=0]="UNPACKED_FLOAT16",e[e.UNPACKED_FLOAT32=1]="UNPACKED_FLOAT32",e[e.PACKED_4X1_UNSIGNED_BYTE=2]="PACKED_4X1_UNSIGNED_BYTE",e[e.PACKED_2X2_FLOAT32=3]="PACKED_2X2_FLOAT32",e[e.PACKED_2X2_FLOAT16=4]="PACKED_2X2_FLOAT16"})(Tn||(Tn={}));function ah(e,t){return[t,e]}function Ide(e,t){return e*t}function oh(e){let t=k.sizeFromShape(e),n=Math.ceil(t/4);return k.sizeToSquarishShape(n)}function fu(e,t){return[Math.max(1,Math.ceil(t/2)),Math.max(1,Math.ceil(e/2))]}function Sde(e,t){let[n,r]=fu(e,t);return n*r*4}function H5(e,t){let n=e,r,s,a,o,i,l,u,c,d,h;return ae().getNumber("WEBGL_VERSION")===2?(r=n.R32F,s=n.R16F,a=n.RGBA16F,o=n.RGBA32F,i=n.RED,u=4,c=1,d=n.HALF_FLOAT,h=n.FLOAT):(r=e.RGBA,s=e.RGBA,a=e.RGBA,o=n.RGBA,i=e.RGBA,u=4,c=4,d=t!=null?t.HALF_FLOAT_OES:null,h=e.FLOAT),l=e.RGBA,{internalFormatFloat:r,internalFormatHalfFloat:s,internalFormatPackedHalfFloat:a,internalFormatPackedFloat:o,textureFormatFloat:i,downloadTextureFormat:l,downloadUnpackNumChannels:u,defaultNumChannels:c,textureTypeHalfFloat:d,textureTypeFloat:h}}function Ie(e,t){let n=t();return ae().getBool("DEBUG")&&Tde(e),n}function Tde(e){let t=e.getError();if(t!==e.NO_ERROR)throw new Error("WebGL Error: "+YN(e,t))}var Nde=596e-10,Cde=65504;function ZN(e){return!!(ae().getBool("WEBGL_RENDER_FLOAT32_ENABLED")||e===0||Ndee.getExtension(t),'Extension "'+t+'" not supported on this browser.')}function JN(e,t){let n=ya(e,()=>e.createShader(e.VERTEX_SHADER),"Unable to create vertex WebGLShader.");if(Ie(e,()=>e.shaderSource(n,t)),Ie(e,()=>e.compileShader(n)),e.getShaderParameter(n,e.COMPILE_STATUS)===!1)throw console.log(e.getShaderInfoLog(n)),new Error("Failed to compile vertex shader.");return n}function QN(e,t){let n=ya(e,()=>e.createShader(e.FRAGMENT_SHADER),"Unable to create fragment WebGLShader.");if(Ie(e,()=>e.shaderSource(n,t)),Ie(e,()=>e.compileShader(n)),e.getShaderParameter(n,e.COMPILE_STATUS)===!1)throw $de(t,e.getShaderInfoLog(n)),new Error("Failed to compile fragment shader.");return n}var Ede=/ERROR: [0-9]+:([0-9]+):/g;function $de(e,t){let n=Ede.exec(t);if(n==null){console.log(`Couldn't parse line number in error: ${t}`),console.log(e);return}let r=+n[1],s=e.split(` +`),a=s.length.toString().length+2,o=s.map((d,h)=>k.rightPad((h+1).toString(),a)+d),i=0;for(let d=0;de.createProgram(),"Unable to create WebGLProgram.")}function tT(e,t){if(ke(e,()=>e.linkProgram(t)),e.getProgramParameter(t,e.LINK_STATUS)===!1)throw console.log(e.getProgramInfoLog(t)),new Error("Failed to link vertex and fragment shaders.")}function O0(e,t){if(ke(e,()=>e.validateProgram(t)),e.getProgramParameter(t,e.VALIDATE_STATUS)===!1)throw console.log(e.getProgramInfoLog(t)),new Error("Shader program validation failed.")}function nT(e,t){let n=gs(e,()=>e.createBuffer(),"Unable to create WebGLBuffer");return ke(e,()=>e.bindBuffer(e.ARRAY_BUFFER,n)),ke(e,()=>e.bufferData(e.ARRAY_BUFFER,t,e.STATIC_DRAW)),n}function aT(e,t){let n=gs(e,()=>e.createBuffer(),"Unable to create WebGLBuffer");return ke(e,()=>e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,n)),ke(e,()=>e.bufferData(e.ELEMENT_ARRAY_BUFFER,t,e.STATIC_DRAW)),n}function $he(){return se().getNumber("WEBGL_VERSION")===2?1:4}function rT(e){return gs(e,()=>e.createTexture(),"Unable to create WebGLTexture.")}function sT(e,t){let n=se().getNumber("WEBGL_MAX_TEXTURE_SIZE");if(e<=0||t<=0){let a=`[${e}x${t}]`;throw new Error("Requested texture size "+a+" is invalid.")}if(e>n||t>n){let a=`[${e}x${t}]`,r=`[${n}x${n}]`;throw new Error("Requested texture size "+a+" greater than WebGL maximum on this browser / GPU "+r+".")}}function iT(e){return gs(e,()=>e.createFramebuffer(),"Unable to create WebGLFramebuffer.")}function j5(e,t,n,a,r,s,i){let o=e.getAttribLocation(t,n);return o===-1?!1:(ke(e,()=>e.bindBuffer(e.ARRAY_BUFFER,a)),ke(e,()=>e.vertexAttribPointer(o,r,e.FLOAT,!1,s,i)),ke(e,()=>e.enableVertexAttribArray(o)),!0)}function oT(e,t,n){pT(e,n),ke(e,()=>e.activeTexture(e.TEXTURE0+n)),ke(e,()=>e.bindTexture(e.TEXTURE_2D,t))}function Rhe(e,t){pT(e,t),ke(e,()=>e.activeTexture(e.TEXTURE0+t)),ke(e,()=>e.bindTexture(e.TEXTURE_2D,null))}function lT(e,t,n){return gs(e,()=>e.getUniformLocation(t,n),'uniform "'+n+'" not present in program.')}function uT(e,t,n){return e.getUniformLocation(t,n)}function dT(e,t,n,a){ke(e,()=>oT(e,t,a)),ke(e,()=>e.uniform1i(n,a))}function Fhe(e){ke(e,()=>e.bindFramebuffer(e.FRAMEBUFFER,null)),ke(e,()=>e.viewport(0,0,e.canvas.width,e.canvas.height)),ke(e,()=>e.scissor(0,0,e.canvas.width,e.canvas.height))}function D0(e,t,n){ke(e,()=>e.bindFramebuffer(e.FRAMEBUFFER,n)),ke(e,()=>e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,t,0))}function H5(e,t){ke(e,()=>e.bindFramebuffer(e.FRAMEBUFFER,t)),ke(e,()=>e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,null,0))}function lp(e){let t=e.checkFramebufferStatus(e.FRAMEBUFFER);if(t!==e.FRAMEBUFFER_COMPLETE)throw new Error("Error binding framebuffer: "+hT(e,t))}function hT(e,t){switch(t){case e.FRAMEBUFFER_INCOMPLETE_ATTACHMENT:return"FRAMEBUFFER_INCOMPLETE_ATTACHMENT";case e.FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT:return"FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT";case e.FRAMEBUFFER_INCOMPLETE_DIMENSIONS:return"FRAMEBUFFER_INCOMPLETE_DIMENSIONS";case e.FRAMEBUFFER_UNSUPPORTED:return"FRAMEBUFFER_UNSUPPORTED";default:return`unknown error ${t}`}}function gs(e,t,n){let a=ke(e,()=>t());if(a==null)throw new Error(n);return a}function pT(e,t){let n=e.MAX_COMBINED_TEXTURE_IMAGE_UNITS-1,a=t+e.TEXTURE0;if(an){let r=`[gl.TEXTURE0, gl.TEXTURE${n}]`;throw new Error(`textureUnit must be in ${r}.`)}}function go(e,t=2){return k.sizeFromShape(e.slice(0,e.length-t))}function yo(e){if(e.length===0)throw Error("Cannot get rows and columns of an empty shape array.");return[e.length>1?e[e.length-2]:1,e[e.length-1]]}function _0(e){let t=[1,1,1];return e.length===0||e.length===1&&e[0]===1||(t=[go(e),...yo(e)]),t}function cT(e,t=!1){let n=se().getNumber("WEBGL_MAX_TEXTURE_SIZE");t&&(n=n*2,e=e.map((r,s)=>s>=e.length-2?k.nearestLargerEven(e[s]):e[s]),e.length===1&&(e=[2,e[0]])),e.length!==2&&(e=k.squeezeShape(e).newShape);let a=k.sizeFromShape(e);if(e.length<=1&&a<=n)return[1,a];if(e.length===2&&e[0]<=n&&e[1]<=n)return e;if(e.length===3&&e[0]*e[1]<=n&&e[2]<=n)return[e[0]*e[1],e[2]];if(e.length===3&&e[0]<=n&&e[1]*e[2]<=n)return[e[0],e[1]*e[2]];if(e.length===4&&e[0]*e[1]*e[2]<=n&&e[3]<=n)return[e[0]*e[1]*e[2],e[3]];if(e.length===4&&e[0]<=n&&e[1]*e[2]*e[3]<=n)return[e[0],e[1]*e[2]*e[3]];if(t){let r=go(e),s=2,i=2;return e.length&&([s,i]=yo(e)),a=r*(s/2)*(i/2),k.sizeToSquarishShape(a).map(o=>o*2)}return k.sizeToSquarishShape(a)}function z0(e){return e%2==0}function up(e,t){if(e=e.slice(-2),t=t.slice(-2),k.arraysEqual(e,t)||!e.length||!t.length||e[0]===0||e[1]===0||t[0]===0||t[1]===0)return!0;if(e.length!==t.length){let n=e.slice(-1)[0],a=t.slice(-1)[0];if(n===a||z0(n)&&z0(a)&&(e[0]===1||t[0]===1))return!0}return e[1]===t[1]&&z0(e[0])&&z0(t[0])}var P0,L0;function fT(e){if(P0==null){let t=Pr(e);P0=t.getParameter(t.MAX_TEXTURE_SIZE)}return P0}function Ohe(){P0=null}function Dhe(){L0=null}function mT(e){if(L0==null){let t=Pr(e);L0=t.getParameter(t.MAX_TEXTURE_IMAGE_UNITS)}return Math.min(16,L0)}function gT(e){if(e===0)return 0;let t,n=Pr(e);return za(n,"EXT_disjoint_timer_query_webgl2")&&e===2?t=2:za(n,"EXT_disjoint_timer_query")?t=1:t=0,t}function za(e,t){return e.getExtension(t)!=null}function G5(e){try{if(Pr(e)!=null)return!0}catch(t){return console.log("Error when getting WebGL context: ",t),!1}return!1}function yT(e){if(e===0)return!1;let t=Pr(e);if(e===1){if(!za(t,"OES_texture_float"))return!1}else if(!za(t,"EXT_color_buffer_float"))return!1;return q5(t)}function AT(e){if(e===0)return!1;let t=Pr(e);if(e===1){if(!za(t,"OES_texture_float")||!za(t,"WEBGL_color_buffer_float"))return!1}else{if(za(t,"EXT_color_buffer_float"))return q5(t);let n="EXT_color_buffer_half_float";if(za(t,n)){let a=t.getExtension(n);return _he(t,a)}return!1}return q5(t)}function q5(e){let t=U5(e),n=e.createTexture();e.bindTexture(e.TEXTURE_2D,n);let a=1,r=1;e.texImage2D(e.TEXTURE_2D,0,t.internalFormatFloat,a,r,0,t.textureFormatFloat,t.textureTypeFloat,null);let s=e.createFramebuffer();e.bindFramebuffer(e.FRAMEBUFFER,s),e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,n,0);let i=e.checkFramebufferStatus(e.FRAMEBUFFER)===e.FRAMEBUFFER_COMPLETE;return e.bindTexture(e.TEXTURE_2D,null),e.bindFramebuffer(e.FRAMEBUFFER,null),e.deleteTexture(n),e.deleteFramebuffer(s),i}function _he(e,t){let n=U5(e,t),a=e.createTexture();e.bindTexture(e.TEXTURE_2D,a);let r=1,s=1;e.texImage2D(e.TEXTURE_2D,0,n.internalFormatHalfFloat,r,s,0,n.textureFormatFloat,n.textureTypeHalfFloat,null);let i=e.createFramebuffer();e.bindFramebuffer(e.FRAMEBUFFER,i),e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,a,0);let o=e.checkFramebufferStatus(e.FRAMEBUFFER)===e.FRAMEBUFFER_COMPLETE;return e.bindTexture(e.TEXTURE_2D,null),e.bindFramebuffer(e.FRAMEBUFFER,null),e.deleteTexture(a),e.deleteFramebuffer(i),o}function xT(e){return e!==2?!1:Pr(e).fenceSync!=null}function mu(e,t){Array.isArray(e)||(e=[e]),e.forEach(n=>{n!=null&&k.assert(n.dtype!=="complex64",()=>`${t} does not support complex64 tensors in the WebGL backend.`)})}var ze=se();ze.registerFlag("HAS_WEBGL",()=>ze.getNumber("WEBGL_VERSION")>0);ze.registerFlag("WEBGL_VERSION",()=>G5(2)?2:G5(1)?1:0);ze.registerFlag("WEBGL_CHECK_NUMERICAL_PROBLEMS",()=>!1);ze.registerFlag("WEBGL_BUFFER_SUPPORTED",()=>ze.get("WEBGL_VERSION")===2);ze.registerFlag("WEBGL_CPU_FORWARD",()=>!0);ze.registerFlag("WEBGL_FORCE_F16_TEXTURES",()=>!1);ze.registerFlag("WEBGL_PACK",()=>ze.getBool("HAS_WEBGL"));ze.registerFlag("WEBGL_PACK_NORMALIZATION",()=>ze.getBool("WEBGL_PACK"));ze.registerFlag("WEBGL_PACK_CLIP",()=>ze.getBool("WEBGL_PACK"));ze.registerFlag("WEBGL_PACK_DEPTHWISECONV",()=>ze.getBool("WEBGL_PACK"));ze.registerFlag("WEBGL_PACK_BINARY_OPERATIONS",()=>ze.getBool("WEBGL_PACK"));ze.registerFlag("WEBGL_PACK_UNARY_OPERATIONS",()=>ze.getBool("WEBGL_PACK"));ze.registerFlag("WEBGL_PACK_ARRAY_OPERATIONS",()=>ze.getBool("WEBGL_PACK"));ze.registerFlag("WEBGL_PACK_IMAGE_OPERATIONS",()=>ze.getBool("WEBGL_PACK"));ze.registerFlag("WEBGL_PACK_REDUCE",()=>ze.getBool("WEBGL_PACK"));ze.registerFlag("WEBGL_LAZILY_UNPACK",()=>ze.getBool("WEBGL_PACK"));ze.registerFlag("WEBGL_CONV_IM2COL",()=>ze.getBool("WEBGL_PACK"));ze.registerFlag("WEBGL_MAX_TEXTURE_SIZE",()=>fT(ze.getNumber("WEBGL_VERSION")));ze.registerFlag("WEBGL_MAX_TEXTURES_IN_SHADER",()=>mT(ze.getNumber("WEBGL_VERSION")));ze.registerFlag("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_VERSION",()=>{let e=ze.getNumber("WEBGL_VERSION");return e===0?0:gT(e)});ze.registerFlag("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_RELIABLE",()=>ze.getNumber("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_VERSION")>0&&!yf.isMobile());ze.registerFlag("WEBGL_RENDER_FLOAT32_CAPABLE",()=>yT(ze.getNumber("WEBGL_VERSION")));ze.registerFlag("WEBGL_RENDER_FLOAT32_ENABLED",()=>ze.getBool("WEBGL_FORCE_F16_TEXTURES")?!1:ze.getBool("WEBGL_RENDER_FLOAT32_CAPABLE"));ze.registerFlag("WEBGL_DOWNLOAD_FLOAT_ENABLED",()=>AT(ze.getNumber("WEBGL_VERSION")));ze.registerFlag("WEBGL_FENCE_API_ENABLED",()=>xT(ze.getNumber("WEBGL_VERSION")));ze.registerFlag("WEBGL_SIZE_UPLOAD_UNIFORM",()=>ze.getBool("WEBGL_RENDER_FLOAT32_ENABLED")?4:0);ze.registerFlag("WEBGL_DELETE_TEXTURE_THRESHOLD",()=>-1,e=>{if(e<0&&e!==-1)throw new Error(`WEBGL_DELETE_TEXTURE_THRESHOLD must be -1 (indicating never delete) or at least 0, but got ${e}.`)});ze.registerFlag("WEBGL_FLUSH_THRESHOLD",()=>yf.isMobile()&&ze.getBool("IS_CHROME")?1:-1,e=>{if(e<0&&e!==-1)throw new Error(`WEBGL_FLUSH_THRESHOLD must be -1 (indicating never manual flush) or at least 0, but got ${e}.`)});ze.registerFlag("CPU_HANDOFF_SIZE_THRESHOLD",()=>128);function Wn(){let e,t,n,a,r,s,i,o,l,u;return se().getNumber("WEBGL_VERSION")===2?(e="#version 300 es",t="in",n="out",a="in",r="texture",s="outputColor",i="out vec4 outputColor;",o=` +`)[0]),console.log(`%c ${k.rightPad(u[0],i)}`,"border:1px solid red; background-color:#e3d2d2; color:#a61717"),console.log(c.join(` +`))}function eC(e){return ya(e,()=>e.createProgram(),"Unable to create WebGLProgram.")}function tC(e,t){if(Ie(e,()=>e.linkProgram(t)),e.getProgramParameter(t,e.LINK_STATUS)===!1)throw console.log(e.getProgramInfoLog(t)),new Error("Failed to link vertex and fragment shaders.")}function Fm(e,t){if(Ie(e,()=>e.validateProgram(t)),e.getProgramParameter(t,e.VALIDATE_STATUS)===!1)throw console.log(e.getProgramInfoLog(t)),new Error("Shader program validation failed.")}function nC(e,t){let n=ya(e,()=>e.createBuffer(),"Unable to create WebGLBuffer");return Ie(e,()=>e.bindBuffer(e.ARRAY_BUFFER,n)),Ie(e,()=>e.bufferData(e.ARRAY_BUFFER,t,e.STATIC_DRAW)),n}function rC(e,t){let n=ya(e,()=>e.createBuffer(),"Unable to create WebGLBuffer");return Ie(e,()=>e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,n)),Ie(e,()=>e.bufferData(e.ELEMENT_ARRAY_BUFFER,t,e.STATIC_DRAW)),n}function _de(){return ae().getNumber("WEBGL_VERSION")===2?1:4}function sC(e){return ya(e,()=>e.createTexture(),"Unable to create WebGLTexture.")}function aC(e,t){let n=ae().getNumber("WEBGL_MAX_TEXTURE_SIZE");if(e<=0||t<=0){let r=`[${e}x${t}]`;throw new Error("Requested texture size "+r+" is invalid.")}if(e>n||t>n){let r=`[${e}x${t}]`,s=`[${n}x${n}]`;throw new Error("Requested texture size "+r+" greater than WebGL maximum on this browser / GPU "+s+".")}}function oC(e){return ya(e,()=>e.createFramebuffer(),"Unable to create WebGLFramebuffer.")}function G5(e,t,n,r,s,a,o){let i=e.getAttribLocation(t,n);return i===-1?!1:(Ie(e,()=>e.bindBuffer(e.ARRAY_BUFFER,r)),Ie(e,()=>e.vertexAttribPointer(i,s,e.FLOAT,!1,a,o)),Ie(e,()=>e.enableVertexAttribArray(i)),!0)}function iC(e,t,n){hC(e,n),Ie(e,()=>e.activeTexture(e.TEXTURE0+n)),Ie(e,()=>e.bindTexture(e.TEXTURE_2D,t))}function Rde(e,t){hC(e,t),Ie(e,()=>e.activeTexture(e.TEXTURE0+t)),Ie(e,()=>e.bindTexture(e.TEXTURE_2D,null))}function lC(e,t,n){return ya(e,()=>e.getUniformLocation(t,n),'uniform "'+n+'" not present in program.')}function uC(e,t,n){return e.getUniformLocation(t,n)}function cC(e,t,n,r){Ie(e,()=>iC(e,t,r)),Ie(e,()=>e.uniform1i(n,r))}function Dde(e){Ie(e,()=>e.bindFramebuffer(e.FRAMEBUFFER,null)),Ie(e,()=>e.viewport(0,0,e.canvas.width,e.canvas.height)),Ie(e,()=>e.scissor(0,0,e.canvas.width,e.canvas.height))}function Mm(e,t,n){Ie(e,()=>e.bindFramebuffer(e.FRAMEBUFFER,n)),Ie(e,()=>e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,t,0))}function j5(e,t){Ie(e,()=>e.bindFramebuffer(e.FRAMEBUFFER,t)),Ie(e,()=>e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,null,0))}function lh(e){let t=e.checkFramebufferStatus(e.FRAMEBUFFER);if(t!==e.FRAMEBUFFER_COMPLETE)throw new Error("Error binding framebuffer: "+dC(e,t))}function dC(e,t){switch(t){case e.FRAMEBUFFER_INCOMPLETE_ATTACHMENT:return"FRAMEBUFFER_INCOMPLETE_ATTACHMENT";case e.FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT:return"FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT";case e.FRAMEBUFFER_INCOMPLETE_DIMENSIONS:return"FRAMEBUFFER_INCOMPLETE_DIMENSIONS";case e.FRAMEBUFFER_UNSUPPORTED:return"FRAMEBUFFER_UNSUPPORTED";default:return`unknown error ${t}`}}function ya(e,t,n){let r=Ie(e,()=>t());if(r==null)throw new Error(n);return r}function hC(e,t){let n=e.MAX_COMBINED_TEXTURE_IMAGE_UNITS-1,r=t+e.TEXTURE0;if(rn){let s=`[gl.TEXTURE0, gl.TEXTURE${n}]`;throw new Error(`textureUnit must be in ${s}.`)}}function gi(e,t=2){return k.sizeFromShape(e.slice(0,e.length-t))}function yi(e){if(e.length===0)throw Error("Cannot get rows and columns of an empty shape array.");return[e.length>1?e[e.length-2]:1,e[e.length-1]]}function Om(e){let t=[1,1,1];return e.length===0||e.length===1&&e[0]===1||(t=[gi(e),...yi(e)]),t}function pC(e,t=!1){let n=ae().getNumber("WEBGL_MAX_TEXTURE_SIZE");t&&(n=n*2,e=e.map((s,a)=>a>=e.length-2?k.nearestLargerEven(e[a]):e[a]),e.length===1&&(e=[2,e[0]])),e.length!==2&&(e=k.squeezeShape(e).newShape);let r=k.sizeFromShape(e);if(e.length<=1&&r<=n)return[1,r];if(e.length===2&&e[0]<=n&&e[1]<=n)return e;if(e.length===3&&e[0]*e[1]<=n&&e[2]<=n)return[e[0]*e[1],e[2]];if(e.length===3&&e[0]<=n&&e[1]*e[2]<=n)return[e[0],e[1]*e[2]];if(e.length===4&&e[0]*e[1]*e[2]<=n&&e[3]<=n)return[e[0]*e[1]*e[2],e[3]];if(e.length===4&&e[0]<=n&&e[1]*e[2]*e[3]<=n)return[e[0],e[1]*e[2]*e[3]];if(t){let s=gi(e),a=2,o=2;return e.length&&([a,o]=yi(e)),r=s*(a/2)*(o/2),k.sizeToSquarishShape(r).map(i=>i*2)}return k.sizeToSquarishShape(r)}function Pm(e){return e%2==0}function uh(e,t){if(e=e.slice(-2),t=t.slice(-2),k.arraysEqual(e,t)||!e.length||!t.length||e[0]===0||e[1]===0||t[0]===0||t[1]===0)return!0;if(e.length!==t.length){let n=e.slice(-1)[0],r=t.slice(-1)[0];if(n===r||Pm(n)&&Pm(r)&&(e[0]===1||t[0]===1))return!0}return e[1]===t[1]&&Pm(e[0])&&Pm(t[0])}var zm,Lm;function fC(e){if(zm==null){let t=Ls(e);zm=t.getParameter(t.MAX_TEXTURE_SIZE)}return zm}function Fde(){zm=null}function Mde(){Lm=null}function mC(e){if(Lm==null){let t=Ls(e);Lm=t.getParameter(t.MAX_TEXTURE_IMAGE_UNITS)}return Math.min(16,Lm)}function gC(e){if(e===0)return 0;let t,n=Ls(e);return Lr(n,"EXT_disjoint_timer_query_webgl2")&&e===2?t=2:Lr(n,"EXT_disjoint_timer_query")?t=1:t=0,t}function Lr(e,t){return e.getExtension(t)!=null}function q5(e){try{if(Ls(e)!=null)return!0}catch(t){return console.log("Error when getting WebGL context: ",t),!1}return!1}function yC(e){if(e===0)return!1;let t=Ls(e);if(e===1){if(!Lr(t,"OES_texture_float"))return!1}else if(!Lr(t,"EXT_color_buffer_float"))return!1;return K5(t)}function AC(e){if(e===0)return!1;let t=Ls(e);if(e===1){if(!Lr(t,"OES_texture_float")||!Lr(t,"WEBGL_color_buffer_float"))return!1}else{if(Lr(t,"EXT_color_buffer_float"))return K5(t);let r="EXT_color_buffer_half_float";if(Lr(t,r)){let s=t.getExtension(r);return Ode(t,s)}return!1}return K5(t)}function K5(e){let t=H5(e),n=e.createTexture();e.bindTexture(e.TEXTURE_2D,n);let r=1,s=1;e.texImage2D(e.TEXTURE_2D,0,t.internalFormatFloat,r,s,0,t.textureFormatFloat,t.textureTypeFloat,null);let a=e.createFramebuffer();e.bindFramebuffer(e.FRAMEBUFFER,a),e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,n,0);let o=e.checkFramebufferStatus(e.FRAMEBUFFER)===e.FRAMEBUFFER_COMPLETE;return e.bindTexture(e.TEXTURE_2D,null),e.bindFramebuffer(e.FRAMEBUFFER,null),e.deleteTexture(n),e.deleteFramebuffer(a),o}function Ode(e,t){let n=H5(e,t),r=e.createTexture();e.bindTexture(e.TEXTURE_2D,r);let s=1,a=1;e.texImage2D(e.TEXTURE_2D,0,n.internalFormatHalfFloat,s,a,0,n.textureFormatFloat,n.textureTypeHalfFloat,null);let o=e.createFramebuffer();e.bindFramebuffer(e.FRAMEBUFFER,o),e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,r,0);let i=e.checkFramebufferStatus(e.FRAMEBUFFER)===e.FRAMEBUFFER_COMPLETE;return e.bindTexture(e.TEXTURE_2D,null),e.bindFramebuffer(e.FRAMEBUFFER,null),e.deleteTexture(r),e.deleteFramebuffer(o),i}function xC(e){return e!==2?!1:Ls(e).fenceSync!=null}function mu(e,t){Array.isArray(e)||(e=[e]),e.forEach(n=>{n!=null&&k.assert(n.dtype!=="complex64",()=>`${t} does not support complex64 tensors in the WebGL backend.`)})}var Pe=ae();Pe.registerFlag("HAS_WEBGL",()=>Pe.getNumber("WEBGL_VERSION")>0);Pe.registerFlag("WEBGL_VERSION",()=>q5(2)?2:q5(1)?1:0);Pe.registerFlag("WEBGL_CHECK_NUMERICAL_PROBLEMS",()=>!1);Pe.registerFlag("WEBGL_BUFFER_SUPPORTED",()=>Pe.get("WEBGL_VERSION")===2);Pe.registerFlag("WEBGL_CPU_FORWARD",()=>!0);Pe.registerFlag("WEBGL_FORCE_F16_TEXTURES",()=>!1);Pe.registerFlag("WEBGL_PACK",()=>Pe.getBool("HAS_WEBGL"));Pe.registerFlag("WEBGL_PACK_NORMALIZATION",()=>Pe.getBool("WEBGL_PACK"));Pe.registerFlag("WEBGL_PACK_CLIP",()=>Pe.getBool("WEBGL_PACK"));Pe.registerFlag("WEBGL_PACK_DEPTHWISECONV",()=>Pe.getBool("WEBGL_PACK"));Pe.registerFlag("WEBGL_PACK_BINARY_OPERATIONS",()=>Pe.getBool("WEBGL_PACK"));Pe.registerFlag("WEBGL_PACK_UNARY_OPERATIONS",()=>Pe.getBool("WEBGL_PACK"));Pe.registerFlag("WEBGL_PACK_ARRAY_OPERATIONS",()=>Pe.getBool("WEBGL_PACK"));Pe.registerFlag("WEBGL_PACK_IMAGE_OPERATIONS",()=>Pe.getBool("WEBGL_PACK"));Pe.registerFlag("WEBGL_PACK_REDUCE",()=>Pe.getBool("WEBGL_PACK"));Pe.registerFlag("WEBGL_LAZILY_UNPACK",()=>Pe.getBool("WEBGL_PACK"));Pe.registerFlag("WEBGL_CONV_IM2COL",()=>Pe.getBool("WEBGL_PACK"));Pe.registerFlag("WEBGL_MAX_TEXTURE_SIZE",()=>fC(Pe.getNumber("WEBGL_VERSION")));Pe.registerFlag("WEBGL_MAX_TEXTURES_IN_SHADER",()=>mC(Pe.getNumber("WEBGL_VERSION")));Pe.registerFlag("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_VERSION",()=>{let e=Pe.getNumber("WEBGL_VERSION");return e===0?0:gC(e)});Pe.registerFlag("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_RELIABLE",()=>Pe.getNumber("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_VERSION")>0&&!yf.isMobile());Pe.registerFlag("WEBGL_RENDER_FLOAT32_CAPABLE",()=>yC(Pe.getNumber("WEBGL_VERSION")));Pe.registerFlag("WEBGL_RENDER_FLOAT32_ENABLED",()=>Pe.getBool("WEBGL_FORCE_F16_TEXTURES")?!1:Pe.getBool("WEBGL_RENDER_FLOAT32_CAPABLE"));Pe.registerFlag("WEBGL_DOWNLOAD_FLOAT_ENABLED",()=>AC(Pe.getNumber("WEBGL_VERSION")));Pe.registerFlag("WEBGL_FENCE_API_ENABLED",()=>xC(Pe.getNumber("WEBGL_VERSION")));Pe.registerFlag("WEBGL_SIZE_UPLOAD_UNIFORM",()=>Pe.getBool("WEBGL_RENDER_FLOAT32_ENABLED")?4:0);Pe.registerFlag("WEBGL_DELETE_TEXTURE_THRESHOLD",()=>-1,e=>{if(e<0&&e!==-1)throw new Error(`WEBGL_DELETE_TEXTURE_THRESHOLD must be -1 (indicating never delete) or at least 0, but got ${e}.`)});Pe.registerFlag("WEBGL_FLUSH_THRESHOLD",()=>yf.isMobile()&&Pe.getBool("IS_CHROME")?1:-1,e=>{if(e<0&&e!==-1)throw new Error(`WEBGL_FLUSH_THRESHOLD must be -1 (indicating never manual flush) or at least 0, but got ${e}.`)});Pe.registerFlag("CPU_HANDOFF_SIZE_THRESHOLD",()=>128);function Wn(){let e,t,n,r,s,a,o,i,l,u;return ae().getNumber("WEBGL_VERSION")===2?(e="#version 300 es",t="in",n="out",r="in",s="texture",a="outputColor",o="out vec4 outputColor;",i=` bool isnan_custom(float val) { return (val > 0.0 || val < 0.0) ? false : val != 0.0; } @@ -96,7 +96,7 @@ Hi there \u{1F44B}. Looks like you are running TensorFlow.js in Node.js. To spee ivec4 newRound(vec4 value) { return ivec4(floor(value + vec4(0.5))); } - `):(e="",t="attribute",n="varying",a="varying",r="texture2D",s="gl_FragColor",i="",o=` + `):(e="",t="attribute",n="varying",r="varying",s="texture2D",a="gl_FragColor",o="",i=` #define isnan(value) isnan_custom(value) bool isnan_custom(float val) { return (val > 0. || val < 1. || val == 0.) ? false : true; @@ -121,11 +121,11 @@ Hi there \u{1F44B}. Looks like you are running TensorFlow.js in Node.js. To spee ivec4 round(vec4 value) { return ivec4(floor(value + vec4(0.5))); } - `),{version:e,attribute:t,varyingVs:n,varyingFs:a,texture2D:r,output:s,defineOutput:i,defineSpecialNaN:o,defineSpecialInf:l,defineRound:u}}function Ao(e,t,n="index"){let a=k.computeStrides(t);return a.map((r,s)=>{let i=`int ${e[s]} = ${n} / ${r}`,o=s===a.length-1?`int ${e[s+1]} = ${n} - ${e[s]} * ${r}`:`index -= ${e[s]} * ${r}`;return`${i}; ${o};`}).join("")}function K5(e){let t=k.computeStrides(e).map(n=>n.toString());return` + `),{version:e,attribute:t,varyingVs:n,varyingFs:r,texture2D:s,output:a,defineOutput:o,defineSpecialNaN:i,defineSpecialInf:l,defineRound:u}}function Ai(e,t,n="index"){let r=k.computeStrides(t);return r.map((s,a)=>{let o=`int ${e[a]} = ${n} / ${s}`,i=a===r.length-1?`int ${e[a+1]} = ${n} - ${e[a]} * ${s}`:`index -= ${e[a]} * ${s}`;return`${o}; ${i};`}).join("")}function X5(e){let t=k.computeStrides(e).map(n=>n.toString());return` int getFlatIndex(ivec3 coords) { return coords.x * ${t[0]} + coords.y * ${t[1]} + coords.z; } -`}var bT=` +`}var bC=` const float FLOAT_MAX = 1.70141184e38; const float FLOAT_MIN = 1.17549435e-38; @@ -164,9 +164,9 @@ Hi there \u{1F44B}. Looks like you are running TensorFlow.js in Node.js. To spee return c / 255.0; } -`,zhe=class{constructor(e){this.variableNames=["A"],this.packedInputs=!1,this.packedOutput=!0,this.outPackingScheme=rp.DENSE;let t=ip(e),n=Wn();this.outputShape=e,this.userCode=` +`,Pde=class{constructor(e){this.variableNames=["A"],this.packedInputs=!1,this.packedOutput=!0,this.outPackingScheme=sh.DENSE;let t=oh(e),n=Wn();this.outputShape=e,this.userCode=` ivec3 outCoordsFromFlatIndex(int index) { - ${Ao(["r","c","d"],e)} + ${Ai(["r","c","d"],e)} return ivec3(r, c, d); } @@ -185,9 +185,9 @@ Hi there \u{1F44B}. Looks like you are running TensorFlow.js in Node.js. To spee ${n.output} = result; } - `}},Phe=class{constructor(e){this.variableNames=["A"],this.packedInputs=!0,this.packedOutput=!0,this.outPackingScheme=rp.DENSE;let t=ip(e),n=Wn();this.outputShape=e,this.userCode=` + `}},zde=class{constructor(e){this.variableNames=["A"],this.packedInputs=!0,this.packedOutput=!0,this.outPackingScheme=sh.DENSE;let t=oh(e),n=Wn();this.outputShape=e,this.userCode=` ivec3 outCoordsFromFlatIndex(int index) { - ${Ao(["r","c","d"],e)} + ${Ai(["r","c","d"],e)} return ivec3(r, c, d); } @@ -206,23 +206,23 @@ Hi there \u{1F44B}. Looks like you are running TensorFlow.js in Node.js. To spee ${n.output} = result; } - `}},Lhe=class{constructor(e){this.variableNames=["A"],this.outTexUsage=_a.DOWNLOAD;let t=Wn();this.outputShape=e,this.userCode=` - ${bT} + `}},Lde=class{constructor(e){this.variableNames=["A"],this.outTexUsage=zr.DOWNLOAD;let t=Wn();this.outputShape=e,this.userCode=` + ${bC} void main() { float x = getAAtOutCoords(); ${t.output} = encode_float(x); } - `}},Whe=class{constructor(e){this.variableNames=["A"],this.packedInputs=!0,this.packedOutput=!1,this.outTexUsage=_a.DOWNLOAD;let t=Wn();this.outputShape=e,this.userCode=` - ${bT} + `}},Bde=class{constructor(e){this.variableNames=["A"],this.packedInputs=!0,this.packedOutput=!1,this.outTexUsage=zr.DOWNLOAD;let t=Wn();this.outputShape=e,this.userCode=` + ${bC} void main() { ivec3 coords = getOutputCoords(); float x = getChannel(getAAtOutCoords(), vec2(coords.y, coords.z)); ${t.output} = encode_float(x); } - `}},Bhe=class{constructor(e,t,n=!1){this.variableNames=["A"];let a=Wn(),[r,s]=t;this.outputShape=e;let i="result";n&&(i="floor(result * 255. + 0.5)"),this.userCode=` - ${K5(e)} + `}},Wde=class{constructor(e,t,n=!1){this.variableNames=["A"];let r=Wn(),[s,a]=t;this.outputShape=e;let o="result";n&&(o="floor(result * 255. + 0.5)"),this.userCode=` + ${X5(e)} void main() { ivec3 coords = getOutputCoords(); @@ -232,10 +232,10 @@ Hi there \u{1F44B}. Looks like you are running TensorFlow.js in Node.js. To spee flatIndex = idiv(flatIndex, 4, 1.); - int r = flatIndex / ${s}; - int c = imod(flatIndex, ${s}); - vec2 uv = (vec2(c, r) + halfCR) / vec2(${s}.0, ${r}.0); - vec4 values = ${a.texture2D}(A, uv); + int r = flatIndex / ${a}; + int c = imod(flatIndex, ${a}); + vec2 uv = (vec2(c, r) + halfCR) / vec2(${a}.0, ${s}.0); + vec4 values = ${r.texture2D}(A, uv); float result; @@ -249,9 +249,9 @@ Hi there \u{1F44B}. Looks like you are running TensorFlow.js in Node.js. To spee result = values[3]; } - ${a.output} = vec4(${i}, 0., 0., 0.); + ${r.output} = vec4(${o}, 0., 0., 0.); } - `}},Vhe=class{constructor(e,t,n=!1){this.variableNames=["A"],this.packedInputs=!1,this.packedOutput=!0;let a=Wn(),[r,s]=t;this.outputShape=e;let i="",o="result";n&&(o="floor(result * 255. + 0.5)");for(let l=0;l<=1;l++)for(let u=0;u<=1;u++){let d=l*2+u;i+=` + `}},Vde=class{constructor(e,t,n=!1){this.variableNames=["A"],this.packedInputs=!1,this.packedOutput=!0;let r=Wn(),[s,a]=t;this.outputShape=e;let o="",i="result";n&&(i="floor(result * 255. + 0.5)");for(let l=0;l<=1;l++)for(let u=0;u<=1;u++){let c=l*2+u;o+=` localCoords = coords; if(localCoords[2] + ${u} < ${e[2]}) { localCoords[2] += ${u}; @@ -263,24 +263,24 @@ Hi there \u{1F44B}. Looks like you are running TensorFlow.js in Node.js. To spee flatIndex = idiv(flatIndex, 4, 1.); - r = flatIndex / ${s}; - c = imod(flatIndex, ${s}); - uv = (vec2(c, r) + halfCR) / vec2(${s}.0, ${r}.0); - values = ${a.texture2D}(A, uv); + r = flatIndex / ${a}; + c = imod(flatIndex, ${a}); + uv = (vec2(c, r) + halfCR) / vec2(${a}.0, ${s}.0); + values = ${r.texture2D}(A, uv); if(offset == 0) { - result[${d}] = values[0]; + result[${c}] = values[0]; } else if(offset == 1) { - result[${d}] = values[1]; + result[${c}] = values[1]; } else if(offset == 2) { - result[${d}] = values[2]; + result[${c}] = values[2]; } else { - result[${d}] = values[3]; + result[${c}] = values[3]; } } } `}this.userCode=` - ${K5(e)} + ${X5(e)} void main() { ivec3 coords = getOutputCoords(); @@ -291,11 +291,11 @@ Hi there \u{1F44B}. Looks like you are running TensorFlow.js in Node.js. To spee vec2 uv; vec4 values; - ${i} + ${o} - ${a.output} = ${o}; + ${r.output} = ${i}; } - `}},vT={};$e(vT,{bindVertexProgramAttributeStreams:()=>MT,createBufferFromOutputTexture:()=>FT,createFloat16MatrixTexture:()=>NT,createFloat16PackedMatrixTexture:()=>CT,createFloat32MatrixTexture:()=>ST,createIndexBuffer:()=>IT,createPackedMatrixTexture:()=>ET,createUnsignedBytesMatrixTexture:()=>TT,createVertexBuffer:()=>kT,createVertexShader:()=>wT,downloadByteEncodedFloatMatrixFromOutputTexture:()=>DT,downloadFloat32MatrixFromBuffer:()=>OT,downloadMatrixFromPackedOutputTexture:()=>zT,downloadPackedMatrixFromBuffer:()=>_T,getInternalFormatForFloat16MatrixTexture:()=>Z5,getInternalFormatForFloat16PackedMatrixTexture:()=>Q5,getInternalFormatForFloat32MatrixTexture:()=>X5,getInternalFormatForPackedMatrixTexture:()=>J5,getInternalFormatForUnsignedBytesMatrixTexture:()=>Y5,uploadDenseMatrixToTexture:()=>$T,uploadPixelDataToTexture:()=>RT});function wT(e){let t=Wn(),n=`${t.version} + `}},vC={};De(vC,{bindVertexProgramAttributeStreams:()=>$C,createBufferFromOutputTexture:()=>DC,createFloat16MatrixTexture:()=>TC,createFloat16PackedMatrixTexture:()=>EC,createFloat32MatrixTexture:()=>SC,createIndexBuffer:()=>IC,createPackedMatrixTexture:()=>CC,createUnsignedBytesMatrixTexture:()=>NC,createVertexBuffer:()=>kC,createVertexShader:()=>wC,downloadByteEncodedFloatMatrixFromOutputTexture:()=>MC,downloadFloat32MatrixFromBuffer:()=>FC,downloadMatrixFromPackedOutputTexture:()=>PC,downloadPackedMatrixFromBuffer:()=>OC,getInternalFormatForFloat16MatrixTexture:()=>Y5,getInternalFormatForFloat16PackedMatrixTexture:()=>eb,getInternalFormatForFloat32MatrixTexture:()=>Z5,getInternalFormatForPackedMatrixTexture:()=>Q5,getInternalFormatForUnsignedBytesMatrixTexture:()=>J5,uploadDenseMatrixToTexture:()=>_C,uploadPixelDataToTexture:()=>RC});function wC(e){let t=Wn(),n=`${t.version} precision highp float; ${t.attribute} vec3 clipSpacePos; ${t.attribute} vec2 uv; @@ -304,22 +304,22 @@ Hi there \u{1F44B}. Looks like you are running TensorFlow.js in Node.js. To spee void main() { gl_Position = vec4(clipSpacePos, 1); resultUV = uv; - }`;return JN(e,n)}function kT(e){let t=new Float32Array([-1,1,0,0,1,-1,-1,0,0,0,1,1,0,1,1,1,-1,0,1,0]);return nT(e,t)}function IT(e){let t=new Uint16Array([0,1,2,2,1,3]);return aT(e,t)}function dp(e,t,n,a,r,s){sT(t,n);let i=rT(e),o=e.TEXTURE_2D;return ke(e,()=>e.bindTexture(o,i)),ke(e,()=>e.texParameteri(o,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE)),ke(e,()=>e.texParameteri(o,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE)),ke(e,()=>e.texParameteri(o,e.TEXTURE_MIN_FILTER,e.NEAREST)),ke(e,()=>e.texParameteri(o,e.TEXTURE_MAG_FILTER,e.NEAREST)),ke(e,()=>e.texImage2D(o,0,a,t,n,0,r,s,null)),ke(e,()=>e.bindTexture(e.TEXTURE_2D,null)),i}function X5(e){return e.internalFormatFloat}function ST(e,t,n,a){let[r,s]=sp(t,n);return dp(e,r,s,X5(a),a.textureFormatFloat,e.FLOAT)}function Z5(e){return e.internalFormatHalfFloat}function NT(e,t,n,a){let[r,s]=sp(t,n);return dp(e,r,s,Z5(a),a.textureFormatFloat,a.textureTypeHalfFloat)}function Y5(e){return e.downloadTextureFormat}function TT(e,t,n,a){let[r,s]=sp(t,n);return dp(e,r,s,Y5(a),e.RGBA,e.UNSIGNED_BYTE)}function J5(e){return e.internalFormatPackedFloat}function ET(e,t,n,a){let[r,s]=fu(t,n);return dp(e,r,s,J5(a),e.RGBA,e.FLOAT)}function Q5(e){return e.internalFormatPackedHalfFloat}function CT(e,t,n,a){let[r,s]=fu(t,n);return dp(e,r,s,Q5(a),e.RGBA,a.textureTypeHalfFloat)}function MT(e,t,n){let a=0,r=3*4,s=3*4+2*4;return ke(e,()=>e.bindBuffer(e.ARRAY_BUFFER,n)),j5(e,t,"clipSpacePos",n,3,s,a)&&j5(e,t,"uv",n,2,s,r)}function $T(e,t,n,a,r,s){ke(e,()=>e.bindTexture(e.TEXTURE_2D,t));let i,o,l;r instanceof Uint8Array?(i=new Uint8Array(n*a*4),o=e.UNSIGNED_BYTE,l=e.RGBA):(i=new Float32Array(n*a*4),o=e.FLOAT,l=s.internalFormatPackedFloat),i.set(r),ke(e,()=>e.texImage2D(e.TEXTURE_2D,0,l,n,a,0,e.RGBA,o,i)),ke(e,()=>e.bindTexture(e.TEXTURE_2D,null))}function RT(e,t,n){ke(e,()=>e.bindTexture(e.TEXTURE_2D,t)),n.data instanceof Uint8Array?ke(e,()=>e.texImage2D(e.TEXTURE_2D,0,e.RGBA,n.width,n.height,0,e.RGBA,e.UNSIGNED_BYTE,n.data)):ke(e,()=>e.texImage2D(e.TEXTURE_2D,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,n)),ke(e,()=>e.bindTexture(e.TEXTURE_2D,null))}function FT(e,t,n,a){let r=e.createBuffer();ke(e,()=>e.bindBuffer(e.PIXEL_PACK_BUFFER,r));let s=4*4*t*n;return ke(e,()=>e.bufferData(e.PIXEL_PACK_BUFFER,s,e.STREAM_READ)),ke(e,()=>e.readPixels(0,0,n,t,e.RGBA,e.FLOAT,0)),ke(e,()=>e.bindBuffer(e.PIXEL_PACK_BUFFER,null)),r}function OT(e,t,n){let a=e,r=new Float32Array(n);return a.bindBuffer(a.PIXEL_PACK_BUFFER,t),a.getBufferSubData(a.PIXEL_PACK_BUFFER,0,r),a.bindBuffer(a.PIXEL_PACK_BUFFER,null),r}function DT(e,t,n,a){let[r,s]=sp(t,n),i=4,o=new Uint8Array(Ihe(t*n,i));return ke(e,()=>e.readPixels(0,0,r,s,a.downloadTextureFormat,e.UNSIGNED_BYTE,o)),new Float32Array(o.buffer)}function _T(e,t,n,a,r,s,i,o){let l=e,u=new Float32Array(She(s,i));return l.bindBuffer(l.PIXEL_PACK_BUFFER,t),l.getBufferSubData(l.PIXEL_PACK_BUFFER,0,u),l.bindBuffer(l.PIXEL_PACK_BUFFER,null),u}function zT(e,t,n){let a=new Float32Array(t*n*4);return ke(e,()=>e.readPixels(0,0,n,t,e.RGBA,e.FLOAT,a)),a}var W0=class{constructor(e){this.outputTexture=null,this.program=null,this.disposed=!1,this.vertexAttrsAreBound=!1,this.itemsToPoll=[];let t=se().getNumber("WEBGL_VERSION");e!=null?(this.gl=e,F0(t,e)):this.gl=Pr(t);let n="WEBGL_color_buffer_float",a="EXT_color_buffer_half_float";if(se().getNumber("WEBGL_VERSION")===1){let r="OES_texture_float",s="OES_texture_half_float";if(this.textureFloatExtension=op(this.gl,r),za(this.gl,s))this.textureHalfFloatExtension=op(this.gl,s);else if(se().get("WEBGL_FORCE_F16_TEXTURES"))throw new Error("GL context does not support half float textures, yet the environment flag WEBGL_FORCE_F16_TEXTURES is set to true.");if(this.colorBufferFloatExtension=this.gl.getExtension(n),za(this.gl,a))this.colorBufferHalfFloatExtension=op(this.gl,a);else if(se().get("WEBGL_FORCE_F16_TEXTURES"))throw new Error("GL context does not support color renderable half floats, yet the environment flag WEBGL_FORCE_F16_TEXTURES is set to true.")}else if(n="EXT_color_buffer_float",za(this.gl,n))this.colorBufferFloatExtension=this.gl.getExtension(n);else if(za(this.gl,a))this.colorBufferHalfFloatExtension=this.gl.getExtension(a);else throw new Error("GL context does not support color renderable floats");this.vertexBuffer=kT(this.gl),this.indexBuffer=IT(this.gl),this.framebuffer=iT(this.gl),this.textureConfig=U5(this.gl,this.textureHalfFloatExtension)}get debug(){return se().getBool("DEBUG")}dispose(){if(this.disposed)return;this.program!=null&&console.warn("Disposing a GPGPUContext that still has a bound WebGLProgram. This is probably a resource leak, delete the program with GPGPUContext.deleteProgram before disposing."),this.outputTexture!=null&&console.warn("Disposing a GPGPUContext that still has a bound output matrix texture. This is probably a resource leak, delete the output matrix texture with GPGPUContext.deleteMatrixTexture before disposing.");let e=this.gl;ke(e,()=>e.finish()),ke(e,()=>e.bindFramebuffer(e.FRAMEBUFFER,null)),ke(e,()=>e.deleteFramebuffer(this.framebuffer)),ke(e,()=>e.bindBuffer(e.ARRAY_BUFFER,null)),ke(e,()=>e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,null)),ke(e,()=>e.deleteBuffer(this.indexBuffer)),this.disposed=!0}createFloat32MatrixTexture(e,t){return this.throwIfDisposed(),ST(this.gl,e,t,this.textureConfig)}createFloat16MatrixTexture(e,t){return this.throwIfDisposed(),NT(this.gl,e,t,this.textureConfig)}createUnsignedBytesMatrixTexture(e,t){return this.throwIfDisposed(),TT(this.gl,e,t,this.textureConfig)}uploadPixelDataToTexture(e,t){this.throwIfDisposed(),RT(this.gl,e,t)}uploadDenseMatrixToTexture(e,t,n,a){this.throwIfDisposed(),$T(this.gl,e,t,n,a,this.textureConfig)}createFloat16PackedMatrixTexture(e,t){return this.throwIfDisposed(),CT(this.gl,e,t,this.textureConfig)}createPackedMatrixTexture(e,t){return this.throwIfDisposed(),ET(this.gl,e,t,this.textureConfig)}deleteMatrixTexture(e){this.throwIfDisposed(),this.outputTexture===e&&(H5(this.gl,this.framebuffer),this.outputTexture=null),ke(this.gl,()=>this.gl.deleteTexture(e))}downloadByteEncodedFloatMatrixFromOutputTexture(e,t,n){return this.downloadMatrixDriver(e,()=>DT(this.gl,t,n,this.textureConfig))}downloadPackedMatrixFromBuffer(e,t,n,a,r,s){return _T(this.gl,e,t,n,a,r,s,this.textureConfig)}downloadFloat32MatrixFromBuffer(e,t){return OT(this.gl,e,t)}createBufferFromTexture(e,t,n){this.bindTextureToFrameBuffer(e);let a=FT(this.gl,t,n,this.textureConfig);return this.unbindTextureToFrameBuffer(),a}createAndWaitForFence(){let e=this.createFence(this.gl);return this.pollFence(e)}createFence(e){let t,n;if(se().getBool("WEBGL_FENCE_API_ENABLED")){let a=e,r=a.fenceSync(a.SYNC_GPU_COMMANDS_COMPLETE,0);e.flush(),n=()=>{let s=a.clientWaitSync(r,0,0);return s===a.ALREADY_SIGNALED||s===a.CONDITION_SATISFIED},t=r}else se().getNumber("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_VERSION")>0?(t=this.beginQuery(),this.endQuery(),n=()=>this.isQueryAvailable(t,se().getNumber("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_VERSION"))):n=()=>!0;return{query:t,isFencePassed:n}}downloadMatrixFromPackedTexture(e,t,n){return this.downloadMatrixDriver(e,()=>zT(this.gl,t,n))}createProgram(e){this.throwIfDisposed();let t=this.gl,n=QN(t,e);this.vertexShader==null&&(this.vertexShader=wT(t));let a=eT(t);return ke(t,()=>t.attachShader(a,this.vertexShader)),ke(t,()=>t.attachShader(a,n)),tT(t,a),this.debug&&O0(t,a),this.vertexAttrsAreBound||(this.setProgram(a),this.vertexAttrsAreBound=MT(t,this.program,this.vertexBuffer)),a}deleteProgram(e){this.throwIfDisposed(),e===this.program&&(this.program=null),e!=null&&ke(this.gl,()=>this.gl.deleteProgram(e))}setProgram(e){this.throwIfDisposed(),this.program=e,this.program!=null&&this.debug&&O0(this.gl,this.program),ke(this.gl,()=>this.gl.useProgram(e))}getUniformLocation(e,t,n=!0){return this.throwIfDisposed(),n?lT(this.gl,e,t):uT(this.gl,e,t)}getAttributeLocation(e,t){return this.throwIfDisposed(),ke(this.gl,()=>this.gl.getAttribLocation(e,t))}getUniformLocationNoThrow(e,t){return this.throwIfDisposed(),this.gl.getUniformLocation(e,t)}setInputMatrixTexture(e,t,n){this.throwIfDisposed(),this.throwIfNoProgram(),dT(this.gl,e,t,n)}setOutputMatrixTexture(e,t,n){this.setOutputMatrixTextureDriver(e,n,t)}setOutputPackedMatrixTexture(e,t,n){this.throwIfDisposed();let[a,r]=fu(t,n);this.setOutputMatrixTextureDriver(e,a,r)}setOutputMatrixWriteRegion(e,t,n,a){this.setOutputMatrixWriteRegionDriver(n,e,a,t)}setOutputPackedMatrixWriteRegion(e,t,n,a){throw new Error("setOutputPackedMatrixWriteRegion not implemented.")}debugValidate(){this.program!=null&&O0(this.gl,this.program),lp(this.gl)}executeProgram(){this.throwIfDisposed(),this.throwIfNoProgram();let e=this.gl;this.debug&&this.debugValidate(),ke(e,()=>e.drawElements(e.TRIANGLES,6,e.UNSIGNED_SHORT,0))}blockUntilAllProgramsCompleted(){this.throwIfDisposed(),ke(this.gl,()=>this.gl.finish())}getQueryTimerExtension(){return this.disjointQueryTimerExtension==null&&(this.disjointQueryTimerExtension=op(this.gl,se().getNumber("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_VERSION")===2?"EXT_disjoint_timer_query_webgl2":"EXT_disjoint_timer_query")),this.disjointQueryTimerExtension}getQueryTimerExtensionWebGL2(){return this.getQueryTimerExtension()}getQueryTimerExtensionWebGL1(){return this.getQueryTimerExtension()}beginQuery(){if(se().getNumber("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_VERSION")===2){let n=this.gl,a=this.getQueryTimerExtensionWebGL2(),r=n.createQuery();return n.beginQuery(a.TIME_ELAPSED_EXT,r),r}let e=this.getQueryTimerExtensionWebGL1(),t=e.createQueryEXT();return e.beginQueryEXT(e.TIME_ELAPSED_EXT,t),t}endQuery(){if(se().getNumber("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_VERSION")===2){let t=this.gl,n=this.getQueryTimerExtensionWebGL2();t.endQuery(n.TIME_ELAPSED_EXT);return}let e=this.getQueryTimerExtensionWebGL1();e.endQueryEXT(e.TIME_ELAPSED_EXT)}async waitForQueryAndGetTime(e){return await k.repeatedTry(()=>this.disposed||this.isQueryAvailable(e,se().getNumber("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_VERSION"))),this.getQueryTime(e,se().getNumber("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_VERSION"))}getQueryTime(e,t){if(t===0)return null;if(t===2){let n=this.gl;return n.getQueryParameter(e,n.QUERY_RESULT)/1e6}else{let n=this.getQueryTimerExtensionWebGL1();return n.getQueryObjectEXT(e,n.QUERY_RESULT_EXT)/1e6}}isQueryAvailable(e,t){if(t===0)return!0;if(t===2){let n=this.gl,a=this.getQueryTimerExtensionWebGL2(),r=n.getQueryParameter(e,n.QUERY_RESULT_AVAILABLE);return this.disjoint==null&&(this.disjoint=this.gl.getParameter(a.GPU_DISJOINT_EXT)),r&&!this.disjoint}else{let n=this.getQueryTimerExtensionWebGL1(),a=n.getQueryObjectEXT(e,n.QUERY_RESULT_AVAILABLE_EXT);return this.disjoint==null&&(this.disjoint=this.gl.getParameter(n.GPU_DISJOINT_EXT)),a&&!this.disjoint}}pollFence(e){return new Promise(t=>{this.addItemToPoll(()=>e.isFencePassed(),()=>t())})}pollItems(){let e=Uhe(this.itemsToPoll.map(t=>t.isDoneFn));for(let t=0;t<=e;++t){let{resolveFn:n}=this.itemsToPoll[t];n()}this.itemsToPoll=this.itemsToPoll.slice(e+1)}addItemToPoll(e,t){this.itemsToPoll.push({isDoneFn:e,resolveFn:t}),!(this.itemsToPoll.length>1)&&k.repeatedTry(()=>(this.pollItems(),this.itemsToPoll.length===0))}bindTextureToFrameBuffer(e){this.throwIfDisposed(),D0(this.gl,e,this.framebuffer),this.debug&&lp(this.gl)}unbindTextureToFrameBuffer(){this.outputTexture!=null?(D0(this.gl,this.outputTexture,this.framebuffer),this.debug&&lp(this.gl)):H5(this.gl,this.framebuffer)}downloadMatrixDriver(e,t){this.bindTextureToFrameBuffer(e);let n=t();return this.unbindTextureToFrameBuffer(),n}setOutputMatrixTextureDriver(e,t,n){this.throwIfDisposed();let a=this.gl;D0(a,e,this.framebuffer),this.debug&&lp(a),this.outputTexture=e,ke(a,()=>a.viewport(0,0,t,n)),ke(a,()=>a.scissor(0,0,t,n))}setOutputMatrixWriteRegionDriver(e,t,n,a){this.throwIfDisposed(),ke(this.gl,()=>this.gl.scissor(e,t,n,a))}throwIfDisposed(){if(this.disposed)throw new Error("Attempted to use disposed GPGPUContext.")}throwIfNoProgram(){if(this.program==null)throw new Error("No GPU program is currently set.")}};function Uhe(e){let t=0;for(;t{let m=k.sizeFromShape(c.shapeInfo.logicalShape);c.shapeInfo.isUniform?r.push(`uniform float ${c.name}${m>1?`[${m}]`:""};`):(r.push(`uniform sampler2D ${c.name};`),r.push(`uniform int offset${c.name};`))});let s=r.join(` -`),i=e.map(c=>Hhe(c,t,a)).join(` -`),o=t.texShape,l=Wn(),u=Khe(l),d,h,p=Yhe(l);return t.isPacked?(d=Ghe(t.logicalShape,o),h=Zhe(l)):(d=qhe(t.logicalShape,o),h=Xhe(l)),a&&(p+=tpe),[p,u,h,s,d,i,n].join(` -`)}function gu(e){let t=e.shapeInfo.logicalShape;switch(t.length){case 0:return cpe(e);case 1:return mpe(e);case 2:return ype(e);case 3:return xpe(e);case 4:return vpe(e);case 5:return wpe(e);case 6:return kpe(e);default:throw new Error(`${t.length}-D input sampling is not yet supported`)}}function LT(e){switch(e.shapeInfo.logicalShape.length){case 0:return ppe(e);case 1:return fpe(e);case 2:return gpe(e);case 3:return Ape(e);default:return bpe(e)}}function Hhe(e,t,n=!1){let a="";n?a+=LT(e):a+=gu(e);let r=e.shapeInfo.logicalShape,s=t.logicalShape;return r.length<=s.length&&(n?a+=Ipe(e,t):a+=Spe(e,t)),a}function Ghe(e,t){switch(e.length){case 0:return WT();case 1:return npe(e,t);case 2:return dpe(e,t);case 3:return rpe(e,t);default:return ipe(e,t)}}function qhe(e,t){switch(e.length){case 0:return WT();case 1:return ape(e,t);case 2:return hpe(e,t);case 3:return spe(e,t);case 4:return ope(e,t);case 5:return lpe(e,t);case 6:return upe(e,t);default:throw new Error(`${e.length}-D output sampling is not yet supported`)}}function Khe(e){return` + }`;return JN(e,n)}function kC(e){let t=new Float32Array([-1,1,0,0,1,-1,-1,0,0,0,1,1,0,1,1,1,-1,0,1,0]);return nC(e,t)}function IC(e){let t=new Uint16Array([0,1,2,2,1,3]);return rC(e,t)}function ch(e,t,n,r,s,a){aC(t,n);let o=sC(e),i=e.TEXTURE_2D;return Ie(e,()=>e.bindTexture(i,o)),Ie(e,()=>e.texParameteri(i,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE)),Ie(e,()=>e.texParameteri(i,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE)),Ie(e,()=>e.texParameteri(i,e.TEXTURE_MIN_FILTER,e.NEAREST)),Ie(e,()=>e.texParameteri(i,e.TEXTURE_MAG_FILTER,e.NEAREST)),Ie(e,()=>e.texImage2D(i,0,r,t,n,0,s,a,null)),Ie(e,()=>e.bindTexture(e.TEXTURE_2D,null)),o}function Z5(e){return e.internalFormatFloat}function SC(e,t,n,r){let[s,a]=ah(t,n);return ch(e,s,a,Z5(r),r.textureFormatFloat,e.FLOAT)}function Y5(e){return e.internalFormatHalfFloat}function TC(e,t,n,r){let[s,a]=ah(t,n);return ch(e,s,a,Y5(r),r.textureFormatFloat,r.textureTypeHalfFloat)}function J5(e){return e.downloadTextureFormat}function NC(e,t,n,r){let[s,a]=ah(t,n);return ch(e,s,a,J5(r),e.RGBA,e.UNSIGNED_BYTE)}function Q5(e){return e.internalFormatPackedFloat}function CC(e,t,n,r){let[s,a]=fu(t,n);return ch(e,s,a,Q5(r),e.RGBA,e.FLOAT)}function eb(e){return e.internalFormatPackedHalfFloat}function EC(e,t,n,r){let[s,a]=fu(t,n);return ch(e,s,a,eb(r),e.RGBA,r.textureTypeHalfFloat)}function $C(e,t,n){let r=0,s=3*4,a=3*4+2*4;return Ie(e,()=>e.bindBuffer(e.ARRAY_BUFFER,n)),G5(e,t,"clipSpacePos",n,3,a,r)&&G5(e,t,"uv",n,2,a,s)}function _C(e,t,n,r,s,a){Ie(e,()=>e.bindTexture(e.TEXTURE_2D,t));let o,i,l;s instanceof Uint8Array?(o=new Uint8Array(n*r*4),i=e.UNSIGNED_BYTE,l=e.RGBA):(o=new Float32Array(n*r*4),i=e.FLOAT,l=a.internalFormatPackedFloat),o.set(s),Ie(e,()=>e.texImage2D(e.TEXTURE_2D,0,l,n,r,0,e.RGBA,i,o)),Ie(e,()=>e.bindTexture(e.TEXTURE_2D,null))}function RC(e,t,n){Ie(e,()=>e.bindTexture(e.TEXTURE_2D,t)),n.data instanceof Uint8Array?Ie(e,()=>e.texImage2D(e.TEXTURE_2D,0,e.RGBA,n.width,n.height,0,e.RGBA,e.UNSIGNED_BYTE,n.data)):Ie(e,()=>e.texImage2D(e.TEXTURE_2D,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,n)),Ie(e,()=>e.bindTexture(e.TEXTURE_2D,null))}function DC(e,t,n,r){let s=e.createBuffer();Ie(e,()=>e.bindBuffer(e.PIXEL_PACK_BUFFER,s));let i=4*4*t*n;return Ie(e,()=>e.bufferData(e.PIXEL_PACK_BUFFER,i,e.STREAM_READ)),Ie(e,()=>e.readPixels(0,0,n,t,e.RGBA,e.FLOAT,0)),Ie(e,()=>e.bindBuffer(e.PIXEL_PACK_BUFFER,null)),s}function FC(e,t,n){let r=e,s=new Float32Array(n);return r.bindBuffer(r.PIXEL_PACK_BUFFER,t),r.getBufferSubData(r.PIXEL_PACK_BUFFER,0,s),r.bindBuffer(r.PIXEL_PACK_BUFFER,null),s}function MC(e,t,n,r){let[s,a]=ah(t,n),o=4,i=new Uint8Array(Ide(t*n,o));return Ie(e,()=>e.readPixels(0,0,s,a,r.downloadTextureFormat,e.UNSIGNED_BYTE,i)),new Float32Array(i.buffer)}function OC(e,t,n,r,s,a,o,i){let l=e,u=new Float32Array(Sde(a,o));return l.bindBuffer(l.PIXEL_PACK_BUFFER,t),l.getBufferSubData(l.PIXEL_PACK_BUFFER,0,u),l.bindBuffer(l.PIXEL_PACK_BUFFER,null),u}function PC(e,t,n){let r=new Float32Array(t*n*4);return Ie(e,()=>e.readPixels(0,0,n,t,e.RGBA,e.FLOAT,r)),r}var Bm=class{constructor(e){this.outputTexture=null,this.program=null,this.disposed=!1,this.vertexAttrsAreBound=!1,this.itemsToPoll=[];let t=ae().getNumber("WEBGL_VERSION");e!=null?(this.gl=e,Dm(t,e)):this.gl=Ls(t);let n="WEBGL_color_buffer_float",r="EXT_color_buffer_half_float";if(ae().getNumber("WEBGL_VERSION")===1){let s="OES_texture_float",a="OES_texture_half_float";if(this.textureFloatExtension=ih(this.gl,s),Lr(this.gl,a))this.textureHalfFloatExtension=ih(this.gl,a);else if(ae().get("WEBGL_FORCE_F16_TEXTURES"))throw new Error("GL context does not support half float textures, yet the environment flag WEBGL_FORCE_F16_TEXTURES is set to true.");if(this.colorBufferFloatExtension=this.gl.getExtension(n),Lr(this.gl,r))this.colorBufferHalfFloatExtension=ih(this.gl,r);else if(ae().get("WEBGL_FORCE_F16_TEXTURES"))throw new Error("GL context does not support color renderable half floats, yet the environment flag WEBGL_FORCE_F16_TEXTURES is set to true.")}else if(n="EXT_color_buffer_float",Lr(this.gl,n))this.colorBufferFloatExtension=this.gl.getExtension(n);else if(Lr(this.gl,r))this.colorBufferHalfFloatExtension=this.gl.getExtension(r);else throw new Error("GL context does not support color renderable floats");this.vertexBuffer=kC(this.gl),this.indexBuffer=IC(this.gl),this.framebuffer=oC(this.gl),this.textureConfig=H5(this.gl,this.textureHalfFloatExtension)}get debug(){return ae().getBool("DEBUG")}dispose(){if(this.disposed)return;this.program!=null&&console.warn("Disposing a GPGPUContext that still has a bound WebGLProgram. This is probably a resource leak, delete the program with GPGPUContext.deleteProgram before disposing."),this.outputTexture!=null&&console.warn("Disposing a GPGPUContext that still has a bound output matrix texture. This is probably a resource leak, delete the output matrix texture with GPGPUContext.deleteMatrixTexture before disposing.");let e=this.gl;Ie(e,()=>e.finish()),Ie(e,()=>e.bindFramebuffer(e.FRAMEBUFFER,null)),Ie(e,()=>e.deleteFramebuffer(this.framebuffer)),Ie(e,()=>e.bindBuffer(e.ARRAY_BUFFER,null)),Ie(e,()=>e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,null)),Ie(e,()=>e.deleteBuffer(this.indexBuffer)),this.disposed=!0}createFloat32MatrixTexture(e,t){return this.throwIfDisposed(),SC(this.gl,e,t,this.textureConfig)}createFloat16MatrixTexture(e,t){return this.throwIfDisposed(),TC(this.gl,e,t,this.textureConfig)}createUnsignedBytesMatrixTexture(e,t){return this.throwIfDisposed(),NC(this.gl,e,t,this.textureConfig)}uploadPixelDataToTexture(e,t){this.throwIfDisposed(),RC(this.gl,e,t)}uploadDenseMatrixToTexture(e,t,n,r){this.throwIfDisposed(),_C(this.gl,e,t,n,r,this.textureConfig)}createFloat16PackedMatrixTexture(e,t){return this.throwIfDisposed(),EC(this.gl,e,t,this.textureConfig)}createPackedMatrixTexture(e,t){return this.throwIfDisposed(),CC(this.gl,e,t,this.textureConfig)}deleteMatrixTexture(e){this.throwIfDisposed(),this.outputTexture===e&&(j5(this.gl,this.framebuffer),this.outputTexture=null),Ie(this.gl,()=>this.gl.deleteTexture(e))}downloadByteEncodedFloatMatrixFromOutputTexture(e,t,n){return this.downloadMatrixDriver(e,()=>MC(this.gl,t,n,this.textureConfig))}downloadPackedMatrixFromBuffer(e,t,n,r,s,a){return OC(this.gl,e,t,n,r,s,a,this.textureConfig)}downloadFloat32MatrixFromBuffer(e,t){return FC(this.gl,e,t)}createBufferFromTexture(e,t,n){this.bindTextureToFrameBuffer(e);let r=DC(this.gl,t,n,this.textureConfig);return this.unbindTextureToFrameBuffer(),r}createAndWaitForFence(){let e=this.createFence(this.gl);return this.pollFence(e)}createFence(e){let t,n;if(ae().getBool("WEBGL_FENCE_API_ENABLED")){let r=e,s=r.fenceSync(r.SYNC_GPU_COMMANDS_COMPLETE,0);e.flush(),n=()=>{let a=r.clientWaitSync(s,0,0);return a===r.ALREADY_SIGNALED||a===r.CONDITION_SATISFIED},t=s}else ae().getNumber("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_VERSION")>0?(t=this.beginQuery(),this.endQuery(),n=()=>this.isQueryAvailable(t,ae().getNumber("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_VERSION"))):n=()=>!0;return{query:t,isFencePassed:n}}downloadMatrixFromPackedTexture(e,t,n){return this.downloadMatrixDriver(e,()=>PC(this.gl,t,n))}createProgram(e){this.throwIfDisposed();let t=this.gl,n=QN(t,e);this.vertexShader==null&&(this.vertexShader=wC(t));let r=eC(t);return Ie(t,()=>t.attachShader(r,this.vertexShader)),Ie(t,()=>t.attachShader(r,n)),tC(t,r),this.debug&&Fm(t,r),this.vertexAttrsAreBound||(this.setProgram(r),this.vertexAttrsAreBound=$C(t,this.program,this.vertexBuffer)),r}deleteProgram(e){this.throwIfDisposed(),e===this.program&&(this.program=null),e!=null&&Ie(this.gl,()=>this.gl.deleteProgram(e))}setProgram(e){this.throwIfDisposed(),this.program=e,this.program!=null&&this.debug&&Fm(this.gl,this.program),Ie(this.gl,()=>this.gl.useProgram(e))}getUniformLocation(e,t,n=!0){return this.throwIfDisposed(),n?lC(this.gl,e,t):uC(this.gl,e,t)}getAttributeLocation(e,t){return this.throwIfDisposed(),Ie(this.gl,()=>this.gl.getAttribLocation(e,t))}getUniformLocationNoThrow(e,t){return this.throwIfDisposed(),this.gl.getUniformLocation(e,t)}setInputMatrixTexture(e,t,n){this.throwIfDisposed(),this.throwIfNoProgram(),cC(this.gl,e,t,n)}setOutputMatrixTexture(e,t,n){this.setOutputMatrixTextureDriver(e,n,t)}setOutputPackedMatrixTexture(e,t,n){this.throwIfDisposed();let[r,s]=fu(t,n);this.setOutputMatrixTextureDriver(e,r,s)}setOutputMatrixWriteRegion(e,t,n,r){this.setOutputMatrixWriteRegionDriver(n,e,r,t)}setOutputPackedMatrixWriteRegion(e,t,n,r){throw new Error("setOutputPackedMatrixWriteRegion not implemented.")}debugValidate(){this.program!=null&&Fm(this.gl,this.program),lh(this.gl)}executeProgram(){this.throwIfDisposed(),this.throwIfNoProgram();let e=this.gl;this.debug&&this.debugValidate(),Ie(e,()=>e.drawElements(e.TRIANGLES,6,e.UNSIGNED_SHORT,0))}blockUntilAllProgramsCompleted(){this.throwIfDisposed(),Ie(this.gl,()=>this.gl.finish())}getQueryTimerExtension(){return this.disjointQueryTimerExtension==null&&(this.disjointQueryTimerExtension=ih(this.gl,ae().getNumber("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_VERSION")===2?"EXT_disjoint_timer_query_webgl2":"EXT_disjoint_timer_query")),this.disjointQueryTimerExtension}getQueryTimerExtensionWebGL2(){return this.getQueryTimerExtension()}getQueryTimerExtensionWebGL1(){return this.getQueryTimerExtension()}beginQuery(){if(ae().getNumber("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_VERSION")===2){let n=this.gl,r=this.getQueryTimerExtensionWebGL2(),s=n.createQuery();return n.beginQuery(r.TIME_ELAPSED_EXT,s),s}let e=this.getQueryTimerExtensionWebGL1(),t=e.createQueryEXT();return e.beginQueryEXT(e.TIME_ELAPSED_EXT,t),t}endQuery(){if(ae().getNumber("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_VERSION")===2){let t=this.gl,n=this.getQueryTimerExtensionWebGL2();t.endQuery(n.TIME_ELAPSED_EXT);return}let e=this.getQueryTimerExtensionWebGL1();e.endQueryEXT(e.TIME_ELAPSED_EXT)}async waitForQueryAndGetTime(e){return await k.repeatedTry(()=>this.disposed||this.isQueryAvailable(e,ae().getNumber("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_VERSION"))),this.getQueryTime(e,ae().getNumber("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_VERSION"))}getQueryTime(e,t){if(t===0)return null;if(t===2){let n=this.gl;return n.getQueryParameter(e,n.QUERY_RESULT)/1e6}else{let n=this.getQueryTimerExtensionWebGL1();return n.getQueryObjectEXT(e,n.QUERY_RESULT_EXT)/1e6}}isQueryAvailable(e,t){if(t===0)return!0;if(t===2){let n=this.gl,r=this.getQueryTimerExtensionWebGL2(),s=n.getQueryParameter(e,n.QUERY_RESULT_AVAILABLE);return this.disjoint==null&&(this.disjoint=this.gl.getParameter(r.GPU_DISJOINT_EXT)),s&&!this.disjoint}else{let n=this.getQueryTimerExtensionWebGL1(),r=n.getQueryObjectEXT(e,n.QUERY_RESULT_AVAILABLE_EXT);return this.disjoint==null&&(this.disjoint=this.gl.getParameter(n.GPU_DISJOINT_EXT)),r&&!this.disjoint}}pollFence(e){return new Promise(t=>{this.addItemToPoll(()=>e.isFencePassed(),()=>t())})}pollItems(){let e=Ude(this.itemsToPoll.map(t=>t.isDoneFn));for(let t=0;t<=e;++t){let{resolveFn:n}=this.itemsToPoll[t];n()}this.itemsToPoll=this.itemsToPoll.slice(e+1)}addItemToPoll(e,t){this.itemsToPoll.push({isDoneFn:e,resolveFn:t}),!(this.itemsToPoll.length>1)&&k.repeatedTry(()=>(this.pollItems(),this.itemsToPoll.length===0))}bindTextureToFrameBuffer(e){this.throwIfDisposed(),Mm(this.gl,e,this.framebuffer),this.debug&&lh(this.gl)}unbindTextureToFrameBuffer(){this.outputTexture!=null?(Mm(this.gl,this.outputTexture,this.framebuffer),this.debug&&lh(this.gl)):j5(this.gl,this.framebuffer)}downloadMatrixDriver(e,t){this.bindTextureToFrameBuffer(e);let n=t();return this.unbindTextureToFrameBuffer(),n}setOutputMatrixTextureDriver(e,t,n){this.throwIfDisposed();let r=this.gl;Mm(r,e,this.framebuffer),this.debug&&lh(r),this.outputTexture=e,Ie(r,()=>r.viewport(0,0,t,n)),Ie(r,()=>r.scissor(0,0,t,n))}setOutputMatrixWriteRegionDriver(e,t,n,r){this.throwIfDisposed(),Ie(this.gl,()=>this.gl.scissor(e,t,n,r))}throwIfDisposed(){if(this.disposed)throw new Error("Attempted to use disposed GPGPUContext.")}throwIfNoProgram(){if(this.program==null)throw new Error("No GPU program is currently set.")}};function Ude(e){let t=0;for(;t{let m=k.sizeFromShape(f.shapeInfo.logicalShape);f.shapeInfo.isUniform?s.push(`uniform float ${f.name}${m>1?`[${m}]`:""};`):(s.push(`uniform sampler2D ${f.name};`),s.push(`uniform int offset${f.name};`))});let a=s.join(` +`),o=e.map(f=>Gde(f,t,r)).join(` +`),i=t.texShape,l=Wn(),u=Kde(l),c,d,h=Yde(l);return t.isPacked?(c=jde(t.logicalShape,i),d=Zde(l)):(c=qde(t.logicalShape,i),d=Xde(l)),r&&(h+=the),[h,u,d,a,c,o,n].join(` +`)}function gu(e){let t=e.shapeInfo.logicalShape;switch(t.length){case 0:return phe(e);case 1:return mhe(e);case 2:return yhe(e);case 3:return xhe(e);case 4:return vhe(e);case 5:return whe(e);case 6:return khe(e);default:throw new Error(`${t.length}-D input sampling is not yet supported`)}}function LC(e){switch(e.shapeInfo.logicalShape.length){case 0:return hhe(e);case 1:return fhe(e);case 2:return ghe(e);case 3:return Ahe(e);default:return bhe(e)}}function Gde(e,t,n=!1){let r="";n?r+=LC(e):r+=gu(e);let s=e.shapeInfo.logicalShape,a=t.logicalShape;return s.length<=a.length&&(n?r+=Ihe(e,t):r+=She(e,t)),r}function jde(e,t){switch(e.length){case 0:return BC();case 1:return nhe(e,t);case 2:return che(e,t);case 3:return she(e,t);default:return ohe(e,t)}}function qde(e,t){switch(e.length){case 0:return BC();case 1:return rhe(e,t);case 2:return dhe(e,t);case 3:return ahe(e,t);case 4:return ihe(e,t);case 5:return lhe(e,t);case 6:return uhe(e,t);default:throw new Error(`${e.length}-D output sampling is not yet supported`)}}function Kde(e){return` float sampleTexture(sampler2D textureSampler, vec2 uv) { return ${e.texture2D}(textureSampler, uv).r; } - `}function Xhe(e){return` + `}function Xde(e){return` void setOutput(float val) { ${e.output} = vec4(val, 0, 0, 0); } - `}function Zhe(e){return` + `}function Zde(e){return` void setOutput(vec4 val) { ${e.output} = val; } - `}function Yhe(e){return`${e.version} + `}function Yde(e){return`${e.version} precision highp float; precision highp int; precision highp sampler2D; @@ -374,10 +374,10 @@ Hi there \u{1F44B}. Looks like you are running TensorFlow.js in Node.js. To spee return fract((p3.x + p3.y) * p3.z); } - ${Jhe} - ${Qhe} - ${epe} - `}var Jhe=` + ${Jde} + ${Qde} + ${ehe} + `}var Jde=` vec2 uvFromFlat(int texNumR, int texNumC, int index) { int texR = index / texNumC; int texC = index - texR * texNumC; @@ -389,7 +389,7 @@ vec2 packedUVfrom1D(int texNumR, int texNumC, int index) { int texC = texelIndex - texR * texNumC; return (vec2(texC, texR) + halfCR) / vec2(texNumC, texNumR); } -`,Qhe=` +`,Qde=` vec2 packedUVfrom2D(int texelsInLogicalRow, int texNumR, int texNumC, int row, int col) { int texelIndex = (row / 2) * texelsInLogicalRow + (col / 2); @@ -397,7 +397,7 @@ vec2 packedUVfrom2D(int texelsInLogicalRow, int texNumR, int texC = texelIndex - texR * texNumC; return (vec2(texC, texR) + halfCR) / vec2(texNumC, texNumR); } -`,epe=` +`,ehe=` vec2 packedUVfrom3D(int texNumR, int texNumC, int texelsInBatch, int texelsInLogicalRow, int b, int row, int col) { @@ -406,7 +406,7 @@ vec2 packedUVfrom3D(int texNumR, int texNumC, int texC = index - texR * texNumC; return (vec2(texC, texR) + halfCR) / vec2(texNumC, texNumR); } -`,tpe=` +`,the=` float getChannel(vec4 frag, vec2 innerDims) { vec2 modCoord = mod(innerDims, 2.); return modCoord.x == 0. ? @@ -417,11 +417,11 @@ vec2 packedUVfrom3D(int texNumR, int texNumC, float modCoord = mod(float(dim), 2.); return modCoord == 0. ? frag.r : frag.g; } -`;function WT(){return` +`;function BC(){return` int getOutputCoords() { return 0; } - `}function npe(e,t){let n=[Math.ceil(t[0]/2),Math.ceil(t[1]/2)];return n[0]===1?` + `}function nhe(e,t){let n=[Math.ceil(t[0]/2),Math.ceil(t[1]/2)];return n[0]===1?` int getOutputCoords() { return 2 * int(resultUV.x * ${n[1]}.0); } @@ -435,7 +435,7 @@ vec2 packedUVfrom3D(int texNumR, int texNumC, vec2(${n[0]}, ${n[1]})); return 2 * (resTexRC.x * ${n[1]} + resTexRC.y); } - `}function ape(e,t){return t[0]===1?` + `}function rhe(e,t){return t[0]===1?` int getOutputCoords() { return int(resultUV.x * ${t[1]}.0); } @@ -449,21 +449,21 @@ vec2 packedUVfrom3D(int texNumR, int texNumC, vec2(${t[0]}, ${t[1]})); return resTexRC.x * ${t[1]} + resTexRC.y; } - `}function rpe(e,t){let n=[Math.ceil(t[0]/2),Math.ceil(t[1]/2)],a=Math.ceil(e[2]/2),r=a*Math.ceil(e[1]/2);return` + `}function she(e,t){let n=[Math.ceil(t[0]/2),Math.ceil(t[1]/2)],r=Math.ceil(e[2]/2),s=r*Math.ceil(e[1]/2);return` ivec3 getOutputCoords() { ivec2 resTexRC = ivec2(resultUV.yx * vec2(${n[0]}, ${n[1]})); int index = resTexRC.x * ${n[1]} + resTexRC.y; - int b = index / ${r}; - index -= b * ${r}; + int b = index / ${s}; + index -= b * ${s}; - int r = 2 * (index / ${a}); - int c = imod(index, ${a}) * 2; + int r = 2 * (index / ${r}); + int c = imod(index, ${r}) * 2; return ivec3(b, r, c); } - `}function spe(e,t){let n=Ao(["r","c","d"],e);return` + `}function ahe(e,t){let n=Ai(["r","c","d"],e);return` ivec3 getOutputCoords() { ivec2 resTexRC = ivec2(resultUV.yx * vec2(${t[0]}, ${t[1]})); @@ -471,26 +471,26 @@ vec2 packedUVfrom3D(int texNumR, int texNumC, ${n} return ivec3(r, c, d); } - `}function ipe(e,t){let n=[Math.ceil(t[0]/2),Math.ceil(t[1]/2)],a=Math.ceil(e[e.length-1]/2),r=a*Math.ceil(e[e.length-2]/2),s=r,i="",o="b, r, c";for(let l=2;l=1?d="coords = 0;":d=o.map(g=>`coords.${h[g+u]} = 0;`).join(` -`);let p="";i<2&&s>0?p="coords":p=e.shapeInfo.logicalShape.map((g,y)=>`coords.${h[y+u]}`).join(", ");let c="return outputValue;",m=k.sizeFromShape(e.shapeInfo.logicalShape)===1,f=k.sizeFromShape(t.logicalShape)===1;if(s===1&&!m&&!f)c=` + `}function Ihe(e,t){let n=e.name,r=n.charAt(0).toUpperCase()+n.slice(1),s="get"+r+"AtOutCoords",a=e.shapeInfo.logicalShape.length,o=t.logicalShape.length,i=zC(e.shapeInfo.logicalShape,t.logicalShape),l=It(o),u=o-a,c,d=["x","y","z","w","u","v"];a===0?c="":o<2&&i.length>=1?c="coords = 0;":c=i.map(A=>`coords.${d[A+u]} = 0;`).join(` +`);let h="";o<2&&a>0?h="coords":h=e.shapeInfo.logicalShape.map((A,x)=>`coords.${d[x+u]}`).join(", ");let p="return outputValue;",m=k.sizeFromShape(e.shapeInfo.logicalShape)===1,y=k.sizeFromShape(t.logicalShape)===1;if(a===1&&!m&&!y)p=` return vec4(outputValue.xy, outputValue.xy); - `;else if(m&&!f)i===1?c=` + `;else if(m&&!y)o===1?p=` return vec4(outputValue.x, outputValue.x, 0., 0.); - `:c=` + `:p=` return vec4(outputValue.x); - `;else if(o.length){let g=s-2,y=s-1;o.indexOf(g)>-1&&o.indexOf(y)>-1?c="return vec4(outputValue.x);":o.indexOf(g)>-1?c="return vec4(outputValue.x, outputValue.y, outputValue.x, outputValue.y);":o.indexOf(y)>-1&&(c="return vec4(outputValue.xx, outputValue.zz);")}return` - vec4 ${r}() { + `;else if(i.length){let A=a-2,x=a-1;i.indexOf(A)>-1&&i.indexOf(x)>-1?p="return vec4(outputValue.x);":i.indexOf(A)>-1?p="return vec4(outputValue.x, outputValue.y, outputValue.x, outputValue.y);":i.indexOf(x)>-1&&(p="return vec4(outputValue.xx, outputValue.zz);")}return` + vec4 ${s}() { ${l} coords = getOutputCoords(); - ${d} - vec4 outputValue = get${a}(${p}); ${c} + vec4 outputValue = get${r}(${h}); + ${p} } - `}function Spe(e,t){let n=e.name,a=n.charAt(0).toUpperCase()+n.slice(1),r="get"+a+"AtOutCoords",s=t.texShape,i=e.shapeInfo.texShape,o=e.shapeInfo.logicalShape.length,l=t.logicalShape.length;if(!e.shapeInfo.isUniform&&o===l&&e.shapeInfo.flatOffset==null&&k.arraysEqual(i,s))return` - float ${r}() { + `}function She(e,t){let n=e.name,r=n.charAt(0).toUpperCase()+n.slice(1),s="get"+r+"AtOutCoords",a=t.texShape,o=e.shapeInfo.texShape,i=e.shapeInfo.logicalShape.length,l=t.logicalShape.length;if(!e.shapeInfo.isUniform&&i===l&&e.shapeInfo.flatOffset==null&&k.arraysEqual(o,a))return` + float ${s}() { return sampleTexture(${n}, resultUV); } - `;let u=kt(l),d=PT(e.shapeInfo.logicalShape,t.logicalShape),h=l-o,p,c=["x","y","z","w","u","v"];o===0?p="":l<2&&d.length>=1?p="coords = 0;":p=d.map(f=>`coords.${c[f+h]} = 0;`).join(` -`);let m="";return l<2&&o>0?m="coords":m=e.shapeInfo.logicalShape.map((f,g)=>`coords.${c[g+h]}`).join(", "),` - float ${r}() { + `;let u=It(l),c=zC(e.shapeInfo.logicalShape,t.logicalShape),d=l-i,h,p=["x","y","z","w","u","v"];i===0?h="":l<2&&c.length>=1?h="coords = 0;":h=c.map(m=>`coords.${p[m+d]} = 0;`).join(` +`);let f="";return l<2&&i>0?f="coords":f=e.shapeInfo.logicalShape.map((m,g)=>`coords.${p[g+d]}`).join(", "),` + float ${s}() { ${u} coords = getOutputCoords(); - ${p} - return get${a}(${m}); + ${h} + return get${r}(${f}); } - `}function kt(e){if(e<=1)return"int";if(e===2)return"ivec2";if(e===3)return"ivec3";if(e===4)return"ivec4";if(e===5)return"ivec5";if(e===6)return"ivec6";throw Error(`GPU for rank ${e} is not yet supported`)}function Au(e,t){let n=JSON.parse(JSON.stringify(e));return n.shapeInfo.logicalShape=t,n}function xu(e,t){return t.map(n=>e[n]).join(", ")}function Npe(e,t,n,a){let r=t.userCode,s=n.map((c,m)=>{let f={logicalShape:c.shape,texShape:c.isUniform?null:c.texData.texShape,isUniform:c.isUniform,isPacked:c.isUniform?!1:c.texData.isPacked,flatOffset:null};return c.texData!=null&&c.texData.slice!=null&&c.texData.slice.flatOffset>0&&(f.flatOffset=c.texData.slice.flatOffset),{name:t.variableNames[m],shapeInfo:f}}),i=s.map(c=>c.shapeInfo),o={logicalShape:a.shape,texShape:a.texData.texShape,isUniform:!1,isPacked:a.texData.isPacked,flatOffset:null},l=jhe(s,o,r,t.packedInputs),u=e.createProgram(l),d=null,h=e.getUniformLocation(u,"NAN",!1);se().getNumber("WEBGL_VERSION")===1&&(d=e.getUniformLocation(u,"INFINITY",!1));let p={};for(let c=0;c{let r=n.logicalShape,s=t[a],i=s.shape;if(!k.arraysEqual(r,i))throw Error(`Binary was compiled with different shapes than the current args. Shapes ${r} and ${i} must match`);if(n.isUniform&&s.isUniform)return;let o=n.texShape,l=s.isUniform?null:s.texData.texShape;if(!k.arraysEqual(o,l))throw Error(`Binary was compiled with different texture shapes than the current args. Shape ${o} and ${l} must match`)})}function Tpe(e,t,n,a,r){BT(t.inShapeInfos,n),BT([t.outShapeInfo],[a]);let s=a.texData.texture,i=a.texData.texShape;a.texData.isPacked?e.setOutputPackedMatrixTexture(s,i[0],i[1]):e.setOutputMatrixTexture(s,i[0],i[1]),e.setProgram(t.webGLProgram),se().getNumber("WEBGL_VERSION")===1&&t.infLoc!==null&&e.gl.uniform1f(t.infLoc,Infinity),t.nanLoc!==null&&e.gl.uniform1f(t.nanLoc,NaN),n.forEach((o,l)=>{let u=t.program.variableNames[l],d=t.uniformLocations[u],h=t.uniformLocations[`offset${u}`];if(d!=null){if(o.isUniform){if(k.sizeFromShape(o.shape)<2)e.gl.uniform1f(d,o.uniformValues[0]);else{let p=o.uniformValues;p instanceof Float32Array||(p=new Float32Array(p)),e.gl.uniform1fv(d,p)}return}o.texData.slice!=null&&h!=null&&e.gl.uniform1i(h,o.texData.slice.flatOffset),e.setInputMatrixTexture(o.texData.texture,d,l)}}),r!=null&&r(e,t.webGLProgram),e.executeProgram()}function Epe(e,t,n){let a="";t.concat(n).forEach(i=>{let o=i.texData!=null&&i.texData.slice!=null&&i.texData.slice.flatOffset>0,l=i.isUniform?"uniform":i.texData.texShape;a+=`${i.shape}_${l}_${o}`});let r=e.userCode,s=e.constructor.name;return s+="_"+a+"_"+r,s}var VT={};$e(VT,{addImpl:()=>HT,bincountImpl:()=>Rpe,bincountReduceImpl:()=>Fpe,ceilImpl:()=>GT,concatImpl:()=>qT,equalImpl:()=>KT,expImpl:()=>XT,expm1Impl:()=>ZT,floorImpl:()=>YT,gatherNdImpl:()=>Ope,gatherV2Impl:()=>Dpe,greaterEqualImpl:()=>QT,greaterImpl:()=>JT,lessEqualImpl:()=>tE,lessImpl:()=>eE,linSpaceImpl:()=>_pe,logImpl:()=>nE,maxImpl:()=>zpe,maximumImpl:()=>aE,minimumImpl:()=>rE,multiplyImpl:()=>ab,negImpl:()=>Lpe,notEqualImpl:()=>sE,prodImpl:()=>Bpe,rangeImpl:()=>iE,rsqrtImpl:()=>oE,simpleAbsImpl:()=>Cpe,sliceImpl:()=>rb,sparseFillEmptyRowsImpl:()=>Vpe,sparseReshapeImpl:()=>Upe,sparseSegmentReductionImpl:()=>jpe,squaredDifferenceImpl:()=>lE,stridedSliceImpl:()=>Hpe,stringNGramsImpl:()=>qpe,stringSplitImpl:()=>Xpe,stringToHashBucketFastImpl:()=>Zpe,subImpl:()=>uE,tileImpl:()=>Jpe,topKImpl:()=>Qpe,transposeImpl:()=>Wpe,uniqueImpl:()=>ece});function UT(e,t){Array.isArray(e)||(e=[e]),e.forEach(n=>{n!=null&&k.assert(n.dtype!=="complex64",()=>`${t} does not support complex64 tensors in the CPU backend.`)})}function Cpe(e){let t=new Float32Array(e.length);for(let n=0;n{let i=M.assertAndGetBroadcastShape(t,n),o=i.length,l=k.computeStrides(i),u=k.sizeFromShape(i),d=k.getTypedArrayFromDType(s,u),h=t.length,p=n.length,c=k.computeStrides(t),m=k.computeStrides(n),f=M.getBroadcastDims(t,i),g=M.getBroadcastDims(n,i);if(f.length+g.length===0)for(let y=0;yx[I]=0);let v=k.locToIndex(x,h,c),b=A.slice(-p);g.forEach(I=>b[I]=0);let w=k.locToIndex(b,p,m);d[y]=e(a[v],r[w])}return[d,i]}}function eb(e){let{inputs:t,backend:n}=e,{real:a,imag:r}=t,s=n.data.get(a.dataId).values,i=n.data.get(r.dataId).values,o=n.makeTensorInfo(a.shape,"complex64"),l=n.data.get(o.dataId);return l.complexTensorInfos={real:n.makeTensorInfo(a.shape,"float32",s),imag:n.makeTensorInfo(r.shape,"float32",i)},o}function tb(e,t,n="float32"){if(n==="complex64"){let r=tb(e,t,"float32"),s=tb(e,t,"float32");return eb({inputs:{real:r,imag:s},backend:e})}let a=k.makeZerosTypedArray(k.sizeFromShape(t),n);return e.makeTensorInfo(t,n,a)}function jT(e){let{inputs:t,backend:n}=e,{x:a}=t;return n.incRef(a.dataId),{dataId:a.dataId,shape:a.shape,dtype:a.dtype}}function Mpe(e){let{inputs:t,backend:n}=e,{input:a}=t,r=n.data.get(a.dataId).complexTensorInfos.real,s=n.data.get(r.dataId).values;return n.makeTensorInfo(r.shape,r.dtype,s)}function B0(e){let{inputs:t,backend:n,attrs:a}=e,{x:r}=t,{dtype:s}=a;if(s==="complex64"){if(r.dtype==="complex64")return jT({inputs:{x:r},backend:n});let i=tb(n,r.shape,r.dtype),o=B0({inputs:{x:r},backend:n,attrs:{dtype:"float32"}}),l=eb({inputs:{real:o,imag:i},backend:n});return n.disposeIntermediateTensorInfo(i),n.disposeIntermediateTensorInfo(o),l}if(r.dtype==="complex64"){let i=Mpe({inputs:{input:r},backend:n}),o=B0({inputs:{x:i},backend:n,attrs:{dtype:s}});return n.disposeIntermediateTensorInfo(i),o}if(!k.hasEncodingLoss(r.dtype,s)){let i=jT({inputs:{x:r},backend:n});return{dataId:i.dataId,shape:i.shape,dtype:s}}if(s==="int32"){let i=n.data.get(r.dataId).values,o=Int32Array.from(i);return n.makeTensorInfo(r.shape,"int32",o)}if(s==="bool"){let i=n.data.get(r.dataId).values,o=k.toTypedArray([0],r.dtype),[l,u]=Pa((d,h)=>d!==h?1:0)(r.shape,[],i,o,"bool");return n.makeTensorInfo(u,"bool",l)}throw new Error(`Error in Cast: failed to cast ${r.dtype} to ${s}`)}function Ya(e,t,n,a){return n==null?({inputs:r,backend:s})=>{let{a:i,b:o}=r,l=s;UT([i,o],e);let u=l.data.get(i.dataId).values,d=l.data.get(o.dataId).values,h=i.dtype==="string"?M.fromUint8ToStringArray(u):u,p=i.dtype==="string"?M.fromUint8ToStringArray(d):d,c=a||i.dtype,[m,f]=t(i.shape,o.shape,h,p,c);return l.makeTensorInfo(f,c,m)}:({inputs:r,backend:s})=>{let{a:i,b:o}=r,l=s;if(i.dtype==="complex64"||o.dtype==="complex64"){let u=B0({inputs:{x:i},backend:l,attrs:{dtype:"complex64"}}),d=l.data.get(u.dataId),h=d.complexTensorInfos.real,p=d.complexTensorInfos.imag,c=l.data.get(h.dataId).values,m=l.data.get(p.dataId).values,f=B0({inputs:{x:o},backend:l,attrs:{dtype:"complex64"}}),g=l.data.get(f.dataId),y=g.complexTensorInfos.real,A=g.complexTensorInfos.imag,x=l.data.get(y.dataId).values,v=l.data.get(A.dataId).values,[b,w,I]=n(i.shape,o.shape,c,m,x,v),T=l.makeTensorInfo(I,"float32",b),C=l.makeTensorInfo(I,"float32",w),z=eb({inputs:{real:T,imag:C},backend:l});return l.disposeIntermediateTensorInfo(u),l.disposeIntermediateTensorInfo(f),l.disposeIntermediateTensorInfo(T),l.disposeIntermediateTensorInfo(C),z}else{let u=l.data.get(i.dataId).values,d=l.data.get(o.dataId).values,h=a||i.dtype,[p,c]=t(i.shape,o.shape,u,d,h);return l.makeTensorInfo(c,h,p)}}}function nb(e){return(t,n,a,r,s,i)=>{let o=M.assertAndGetBroadcastShape(t,n),l=k.sizeFromShape(o),u=o.length,d=k.computeStrides(o),h=k.getTypedArrayFromDType("float32",l),p=k.getTypedArrayFromDType("float32",l),c=M.getBroadcastDims(t,o),m=M.getBroadcastDims(n,o),f=M.mergeRealAndImagArrays(a,r),g=M.mergeRealAndImagArrays(s,i),y=t.length,A=k.computeStrides(t),x=n.length,v=k.computeStrides(n);if(c.length+m.length===0)for(let b=0;bI[S]=0);let T=k.locToIndex(I,y,A),C=w.slice(-x);m.forEach(S=>C[S]=0);let z=k.locToIndex(C,x,v),$=e(f[T*2],f[T*2+1],g[z*2],g[z*2+1]);h[b]=$.real,p[b]=$.imag}return[h,p,o]}}var HT=Pa((e,t)=>e+t),$pe=nb((e,t,n,a)=>({real:e+n,imag:t+a})),Bwe=Ya(Os,HT,$pe);function Rpe(e,t,n,a,r){let s=k.sizeFromShape(a),i=k.makeZerosTypedArray(r,n);for(let o=0;o=r||(s>0?i[l]+=t[o]:i[l]+=1)}return i}function Fpe(e,t,n,a=!1){let r=e.shape[0],s=e.shape[1],i=Pe([r,n],t.dtype);for(let o=0;o=n||(a?i.set(1,o,u):t.size>0?i.set(i.get(o,u)+t.get(o,l),o,u):i.set(i.get(o,u)+1,o,u))}return i}function bu(e){return(t,n,a)=>{let r=k.getTypedArrayFromDType(n,t.length);for(let s=0;s{let{x:i}=a;if(UT(i,e),i.dtype==="string"||n==="string")throw new Error("unaryKernelFunc does not support string input/output");let o=s,l=o.data.get(i.dataId).values,u=n||i.dtype,d=t(l,u,r);return o.makeTensorInfo(i.shape,u,d)}}var GT=bu(e=>Math.ceil(e)),Vwe=vu(Ni,GT);function qT(e,t,n,a){let r=k.getArrayFromDType(n,k.sizeFromShape(t));if(a&&n!=="string"){let s=0;e.forEach(i=>{let o=k.sizeFromShape(i.shape);r.set(i.vals,s),s+=o})}else{let s=0;e.forEach(i=>{let o=n==="string"?M.fromUint8ToStringArray(i.vals):i.vals,l=0;for(let u=0;ue===t?1:0),Uwe=Ya(ol,KT,null,"bool"),XT=bu(e=>Math.exp(e)),jwe=vu(Ei,XT),ZT=bu(e=>Math.expm1(e)),Hwe=vu(ll,ZT),YT=bu(e=>Math.floor(e)),Gwe=vu(Ci,YT);function Ope(e,t,n,a,r,s,i,o,l){let u=Pe([a,s],n);for(let d=0;d=l/s)throw new Error(`Invalid indices: ${h} does not index into ${o}`);for(let c=0;ce>t?1:0),qwe=Ya(hl,JT,null,"bool"),QT=Pa((e,t)=>e>=t?1:0),Kwe=Ya(Mi,QT,null,"bool"),eE=Pa((e,t)=>ee<=t?1:0),Zwe=Ya(ml,tE,null,"bool");function _pe(e,t,n){let a=(t-e)/(n-1),r=k.makeZerosTypedArray(n,"float32");r[0]=e;for(let s=1;sMath.log(e)),Ywe=vu($i,nE);function zpe(e,t,n,a){let r=k.getTypedArrayFromDType(a,k.sizeFromShape(n));for(let s=0;so)&&(o=u)}r[s]=o}return r}var aE=Pa((e,t)=>Math.max(e,t)),Jwe=Ya(Ri,aE),rE=Pa((e,t)=>Math.min(e,t)),Qwe=Ya(Fi,rE),ab=Pa((e,t)=>e*t),Ppe=nb((e,t,n,a)=>({real:e*n-t*a,imag:e*a+t*n})),e7e=Ya(Oi,ab,Ppe);function Lpe(e,t,n){let a=k.createScalarValue(-1,n);return ab([],t,a,e,n)}var sE=Pa((e,t)=>e!==t?1:0),t7e=Ya(vl,sE,null,"bool");function Wpe(e,t,n,a,r){let s=t.length,i=k.sizeFromShape(t),o=k.computeStrides(t),l=k.computeStrides(r),u=k.getTypedArrayFromDType(n,k.sizeFromShape(r));for(let d=0;d1;if(r||s||i)return k.makeZerosTypedArray(0,a);let o=Math.abs(Math.ceil((t-e)/n)),l=k.makeZerosTypedArray(o,a);t1/Math.sqrt(e)),n7e=vu(Di,oE);function rb(e,t,n,a,r){let s=Cn.isSliceContinous(a,t,n),i=k.sizeFromShape(n),o=k.computeStrides(a);if(s){let h=Cn.computeFlatOffset(t,o);return r==="string"?e.slice(h,h+i):e.subarray(h,h+i)}let l=r==="string"?M.fromUint8ToStringArray(e):e,u=Pe(a,r,l),d=Pe(n,r);for(let h=0;hm+t[f]);d.set(u.get(...c),...p)}return r==="string"?M.fromStringArrayToUint8(d.values):d.values}function Vpe(e,t,n,a,r,s,i){let o=t[0],l=s[0],u=new Array(l),d=new Array(o),h=t[1];if(l===0){if(o!==0)throw new Error(`Received SparseTensor with denseShape[0] = 0 but - indices.shape[0] = ${o}`);let g=k.getArrayFromDType(n,0),y=k.getArrayFromDType(r,0);return[g,[0,h],y,u,d]}let p=!0,c=0,m=new Array(l).fill(0);for(let g=0;g=l)throw new Error(`indices(${g}, 0) is invalid: ${y} >= ${l}`);++m[y],p=p&&y>=c,c=y}let f=!0;for(let g=0;g0&&(m[g]+=m[g-1])}if(f&&p){let g=e,y=a;for(let A=0;A0){c[p-1]=1;for(let g=p-2;g>=0;--g)c[g]=c[g+1]*a[g+1]}let m=[];if(o>0){m[o-1]=1;for(let g=o-2;g>=0;--g)m[g]=m[g+1]*l[g+1]}let f=k.getArrayFromDType(n,i*o);for(let g=0;g0?r[o-1]+1:0;if(d<0)throw new Error("segment ids must be >= 0");let h=t.slice();h[0]=d;let p=h.reduce((A,x)=>A*x,1),c=k.getArrayFromDType(n,p);if(o===0)return d>0&&c.fill(i),[c,h];if(d<=0)throw new Error("segment ids must be >= 0");let m=0,f=1,g=0,y=r[m];for(;;){let A=0;if(f=A)throw new Error("segment ids are not increasing")}if(y<0||y>=d)throw new Error(`Segment id ${y} out of range [0, ${d}), possibly because segmentIds input is not sorted.`);y>g&&c.fill(i,g*u,y*u);for(let x=m;x=l[0])throw new Error(`Bad: indices[${x}] == ${a[x]} out of range [0, ${l[0]})`);for(let b=0;bo)break}return g{let n=e-t;return n*n}),a7e=Ya(_i,lE);function Hpe(e,t,n,a){let r=Pe(e,t.dtype);for(let s=0;s0?0:i-o),p=0;p+=l*this.leftPad.length;for(let g=0;gg.forEach(y=>c[m++]=y);for(let g=0;g0){f(e[h+d-1]);for(let g=0;g0){let o=t[0];if(o!==0)throw new Error(`First split value must be 0, got ${o}`);for(let l=1;l=o;if(u=u&&t[l]<=n,!u)throw new Error(`Invalid split value ${t[l]}, must be in [${o}, ${n}]`);o=t[l]}if(o!==n)throw new Error(`Last split value must be data size. Expected ${n}, got ${o}`)}let r=a-1,s=k.getArrayFromDType("int32",a);if(n===0||a===0){let o=new Array(n);for(let l=0;l<=r;++l)s[l]=0;return[o,s]}s[0]=0;for(let o=1;o<=r;++o){let l=t[o]-t[o-1],u=0;this.nGramWidths.forEach(d=>{u+=this.getNumNGrams(l,d)}),this.preserveShort&&l>0&&u===0&&(u=1),s[o]=s[o-1]+u}let i=new Array(s[r]);for(let o=0;o{let h=t[o+1]-t[o],p=this.getNumNGrams(h,d);this.createNGrams(e,l,i,u,p,d),u+=p}),this.preserveShort&&u===s[o]){let d=t[o+1]-t[o];if(d===0)continue;let h=d+2*this.padWidth,p=1;this.createNGrams(e,l,i,u,p,h)}}return[i,s]}};function qpe(e,t,n,a,r,s,i,o){return new Gpe(n,a,r,s,i,o).compute(e,t)}function Kpe(e,t,n){if(!e.length)return[];if(t.length===0){let s=new Array(e.length);for(let i=0;ie-t),Ype=nb((e,t,n,a)=>({real:e-n,imag:t-a})),r7e=Ya(zi,uE,Ype);function Jpe(e,t){let n=new Array(e.rank);for(let r=0;rx.value-A.value);let f=h*a,g=l.subarray(f,f+a),y=u.subarray(f,f+a);for(let A=0;A{for(let g=0;g`${e}.${n}`)}function Bn(e,t){return t===1?[e]:cE(e,t)}function zce(e,t){if(e===1)return"rc";let n="";for(let a=0;ae[n]).join(", ")}function The(e,t,n,r){let s=t.userCode,a=n.map((p,f)=>{let m={logicalShape:p.shape,texShape:p.isUniform?null:p.texData.texShape,isUniform:p.isUniform,isPacked:p.isUniform?!1:p.texData.isPacked,flatOffset:null};return p.texData!=null&&p.texData.slice!=null&&p.texData.slice.flatOffset>0&&(m.flatOffset=p.texData.slice.flatOffset),{name:t.variableNames[f],shapeInfo:m}}),o=a.map(p=>p.shapeInfo),i={logicalShape:r.shape,texShape:r.texData.texShape,isUniform:!1,isPacked:r.texData.isPacked,flatOffset:null},l=Hde(a,i,s,t.packedInputs),u=e.createProgram(l),c=null,d=e.getUniformLocation(u,"NAN",!1);ae().getNumber("WEBGL_VERSION")===1&&(c=e.getUniformLocation(u,"INFINITY",!1));let h={};for(let p=0;p{let s=n.logicalShape,a=t[r],o=a.shape;if(!k.arraysEqual(s,o))throw Error(`Binary was compiled with different shapes than the current args. Shapes ${s} and ${o} must match`);if(n.isUniform&&a.isUniform)return;let i=n.texShape,l=a.isUniform?null:a.texData.texShape;if(!k.arraysEqual(i,l))throw Error(`Binary was compiled with different texture shapes than the current args. Shape ${i} and ${l} must match`)})}function Nhe(e,t,n,r,s){WC(t.inShapeInfos,n),WC([t.outShapeInfo],[r]);let a=r.texData.texture,o=r.texData.texShape;r.texData.isPacked?e.setOutputPackedMatrixTexture(a,o[0],o[1]):e.setOutputMatrixTexture(a,o[0],o[1]),e.setProgram(t.webGLProgram),ae().getNumber("WEBGL_VERSION")===1&&t.infLoc!==null&&e.gl.uniform1f(t.infLoc,Infinity),t.nanLoc!==null&&e.gl.uniform1f(t.nanLoc,NaN),n.forEach((i,l)=>{let u=t.program.variableNames[l],c=t.uniformLocations[u],d=t.uniformLocations[`offset${u}`];if(c!=null){if(i.isUniform){if(k.sizeFromShape(i.shape)<2)e.gl.uniform1f(c,i.uniformValues[0]);else{let h=i.uniformValues;h instanceof Float32Array||(h=new Float32Array(h)),e.gl.uniform1fv(c,h)}return}i.texData.slice!=null&&d!=null&&e.gl.uniform1i(d,i.texData.slice.flatOffset),e.setInputMatrixTexture(i.texData.texture,c,l)}}),s!=null&&s(e,t.webGLProgram),e.executeProgram()}function Che(e,t,n){let r="";t.concat(n).forEach(o=>{let i=o.texData!=null&&o.texData.slice!=null&&o.texData.slice.flatOffset>0,l=o.isUniform?"uniform":o.texData.texShape;r+=`${o.shape}_${l}_${i}`});let s=e.userCode,a=e.constructor.name;return a+="_"+r+"_"+s,a}var VC={};De(VC,{addImpl:()=>GC,bincountImpl:()=>Rhe,bincountReduceImpl:()=>Dhe,ceilImpl:()=>jC,concatImpl:()=>qC,equalImpl:()=>KC,expImpl:()=>XC,expm1Impl:()=>ZC,floorImpl:()=>YC,gatherNdImpl:()=>Fhe,gatherV2Impl:()=>Mhe,greaterEqualImpl:()=>QC,greaterImpl:()=>JC,lessEqualImpl:()=>tE,lessImpl:()=>eE,linSpaceImpl:()=>Ohe,logImpl:()=>nE,maxImpl:()=>Phe,maximumImpl:()=>rE,minimumImpl:()=>sE,multiplyImpl:()=>sb,negImpl:()=>Lhe,notEqualImpl:()=>aE,prodImpl:()=>Whe,rangeImpl:()=>oE,rsqrtImpl:()=>iE,simpleAbsImpl:()=>Ehe,sliceImpl:()=>ab,sparseFillEmptyRowsImpl:()=>Vhe,sparseReshapeImpl:()=>Uhe,sparseSegmentReductionImpl:()=>Hhe,squaredDifferenceImpl:()=>lE,stridedSliceImpl:()=>Ghe,stringNGramsImpl:()=>qhe,stringSplitImpl:()=>Xhe,stringToHashBucketFastImpl:()=>Zhe,subImpl:()=>uE,tileImpl:()=>Jhe,topKImpl:()=>Qhe,transposeImpl:()=>Bhe,uniqueImpl:()=>epe});function UC(e,t){Array.isArray(e)||(e=[e]),e.forEach(n=>{n!=null&&k.assert(n.dtype!=="complex64",()=>`${t} does not support complex64 tensors in the CPU backend.`)})}function Ehe(e){let t=new Float32Array(e.length);for(let n=0;n{let o=_.assertAndGetBroadcastShape(t,n),i=o.length,l=k.computeStrides(o),u=k.sizeFromShape(o),c=k.getTypedArrayFromDType(a,u),d=t.length,h=n.length,p=k.computeStrides(t),f=k.computeStrides(n),m=_.getBroadcastDims(t,o),g=_.getBroadcastDims(n,o);if(m.length+g.length===0)for(let y=0;yx[I]=0);let b=k.locToIndex(x,d,p),v=A.slice(-h);g.forEach(I=>v[I]=0);let w=k.locToIndex(v,h,f);c[y]=e(r[b],s[w])}return[c,o]}}function tb(e){let{inputs:t,backend:n}=e,{real:r,imag:s}=t,a=n.data.get(r.dataId).values,o=n.data.get(s.dataId).values,i=n.makeTensorInfo(r.shape,"complex64"),l=n.data.get(i.dataId);return l.complexTensorInfos={real:n.makeTensorInfo(r.shape,"float32",a),imag:n.makeTensorInfo(s.shape,"float32",o)},i}function nb(e,t,n="float32"){if(n==="complex64"){let s=nb(e,t,"float32"),a=nb(e,t,"float32");return tb({inputs:{real:s,imag:a},backend:e})}let r=k.makeZerosTypedArray(k.sizeFromShape(t),n);return e.makeTensorInfo(t,n,r)}function HC(e){let{inputs:t,backend:n}=e,{x:r}=t;return n.incRef(r.dataId),{dataId:r.dataId,shape:r.shape,dtype:r.dtype}}function $he(e){let{inputs:t,backend:n}=e,{input:r}=t,s=n.data.get(r.dataId).complexTensorInfos.real,a=n.data.get(s.dataId).values;return n.makeTensorInfo(s.shape,s.dtype,a)}function Wm(e){let{inputs:t,backend:n,attrs:r}=e,{x:s}=t,{dtype:a}=r;if(a==="complex64"){if(s.dtype==="complex64")return HC({inputs:{x:s},backend:n});let o=nb(n,s.shape,s.dtype),i=Wm({inputs:{x:s},backend:n,attrs:{dtype:"float32"}}),l=tb({inputs:{real:i,imag:o},backend:n});return n.disposeIntermediateTensorInfo(o),n.disposeIntermediateTensorInfo(i),l}if(s.dtype==="complex64"){let o=$he({inputs:{input:s},backend:n}),i=Wm({inputs:{x:o},backend:n,attrs:{dtype:a}});return n.disposeIntermediateTensorInfo(o),i}if(!k.hasEncodingLoss(s.dtype,a)){let o=HC({inputs:{x:s},backend:n});return{dataId:o.dataId,shape:o.shape,dtype:a}}if(a==="int32"){let o=n.data.get(s.dataId).values,i=Int32Array.from(o);return n.makeTensorInfo(s.shape,"int32",i)}if(a==="bool"){let o=n.data.get(s.dataId).values,i=k.toTypedArray([0],s.dtype),[l,u]=Br((c,d)=>c!==d?1:0)(s.shape,[],o,i,"bool");return n.makeTensorInfo(u,"bool",l)}throw new Error(`Error in Cast: failed to cast ${s.dtype} to ${a}`)}function Jr(e,t,n,r){return n==null?({inputs:s,backend:a})=>{let{a:o,b:i}=s,l=a;UC([o,i],e);let u=l.data.get(o.dataId).values,c=l.data.get(i.dataId).values,d=o.dtype==="string"?_.fromUint8ToStringArray(u):u,h=o.dtype==="string"?_.fromUint8ToStringArray(c):c,p=r||o.dtype,[f,m]=t(o.shape,i.shape,d,h,p);return l.makeTensorInfo(m,p,f)}:({inputs:s,backend:a})=>{let{a:o,b:i}=s,l=a;if(o.dtype==="complex64"||i.dtype==="complex64"){let u=Wm({inputs:{x:o},backend:l,attrs:{dtype:"complex64"}}),c=l.data.get(u.dataId),d=c.complexTensorInfos.real,h=c.complexTensorInfos.imag,p=l.data.get(d.dataId).values,f=l.data.get(h.dataId).values,m=Wm({inputs:{x:i},backend:l,attrs:{dtype:"complex64"}}),g=l.data.get(m.dataId),y=g.complexTensorInfos.real,A=g.complexTensorInfos.imag,x=l.data.get(y.dataId).values,b=l.data.get(A.dataId).values,[v,w,I]=n(o.shape,i.shape,p,f,x,b),T=l.makeTensorInfo(I,"float32",v),C=l.makeTensorInfo(I,"float32",w),M=tb({inputs:{real:T,imag:C},backend:l});return l.disposeIntermediateTensorInfo(u),l.disposeIntermediateTensorInfo(m),l.disposeIntermediateTensorInfo(T),l.disposeIntermediateTensorInfo(C),M}else{let u=l.data.get(o.dataId).values,c=l.data.get(i.dataId).values,d=r||o.dtype,[h,p]=t(o.shape,i.shape,u,c,d);return l.makeTensorInfo(p,d,h)}}}function rb(e){return(t,n,r,s,a,o)=>{let i=_.assertAndGetBroadcastShape(t,n),l=k.sizeFromShape(i),u=i.length,c=k.computeStrides(i),d=k.getTypedArrayFromDType("float32",l),h=k.getTypedArrayFromDType("float32",l),p=_.getBroadcastDims(t,i),f=_.getBroadcastDims(n,i),m=_.mergeRealAndImagArrays(r,s),g=_.mergeRealAndImagArrays(a,o),y=t.length,A=k.computeStrides(t),x=n.length,b=k.computeStrides(n);if(p.length+f.length===0)for(let v=0;vI[R]=0);let T=k.locToIndex(I,y,A),C=w.slice(-x);f.forEach(R=>C[R]=0);let M=k.locToIndex(C,x,b),$=e(m[T*2],m[T*2+1],g[M*2],g[M*2+1]);d[v]=$.real,h[v]=$.imag}return[d,h,i]}}var GC=Br((e,t)=>e+t),_he=rb((e,t,n,r)=>({real:e+n,imag:t+r})),Wwe=Jr(Fa,GC,_he);function Rhe(e,t,n,r,s){let a=k.sizeFromShape(r),o=k.makeZerosTypedArray(s,n);for(let i=0;i=s||(a>0?o[l]+=t[i]:o[l]+=1)}return o}function Dhe(e,t,n,r=!1){let s=e.shape[0],a=e.shape[1],o=Le([s,n],t.dtype);for(let i=0;i=n||(r?o.set(1,i,u):t.size>0?o.set(o.get(i,u)+t.get(i,l),i,u):o.set(o.get(i,u)+1,i,u))}return o}function bu(e){return(t,n,r)=>{let s=k.getTypedArrayFromDType(n,t.length);for(let a=0;a{let{x:o}=r;if(UC(o,e),o.dtype==="string"||n==="string")throw new Error("unaryKernelFunc does not support string input/output");let i=a,l=i.data.get(o.dataId).values,u=n||o.dtype,c=t(l,u,s);return i.makeTensorInfo(o.shape,u,c)}}var jC=bu(e=>Math.ceil(e)),Vwe=vu(No,jC);function qC(e,t,n,r){let s=k.getArrayFromDType(n,k.sizeFromShape(t));if(r&&n!=="string"){let a=0;e.forEach(o=>{let i=k.sizeFromShape(o.shape);s.set(o.vals,a),a+=i})}else{let a=0;e.forEach(o=>{let i=n==="string"?_.fromUint8ToStringArray(o.vals):o.vals,l=0;for(let u=0;ue===t?1:0),Uwe=Jr(il,KC,null,"bool"),XC=bu(e=>Math.exp(e)),Hwe=vu(Eo,XC),ZC=bu(e=>Math.expm1(e)),Gwe=vu(ll,ZC),YC=bu(e=>Math.floor(e)),jwe=vu($o,YC);function Fhe(e,t,n,r,s,a,o,i,l){let u=Le([r,a],n);for(let c=0;c=l/a)throw new Error(`Invalid indices: ${d} does not index into ${i}`);for(let p=0;pe>t?1:0),qwe=Jr(dl,JC,null,"bool"),QC=Br((e,t)=>e>=t?1:0),Kwe=Jr(_o,QC,null,"bool"),eE=Br((e,t)=>ee<=t?1:0),Zwe=Jr(ml,tE,null,"bool");function Ohe(e,t,n){let r=(t-e)/(n-1),s=k.makeZerosTypedArray(n,"float32");s[0]=e;for(let a=1;aMath.log(e)),Ywe=vu(Ro,nE);function Phe(e,t,n,r){let s=k.getTypedArrayFromDType(r,k.sizeFromShape(n));for(let a=0;ai)&&(i=u)}s[a]=i}return s}var rE=Br((e,t)=>Math.max(e,t)),Jwe=Jr(Do,rE),sE=Br((e,t)=>Math.min(e,t)),Qwe=Jr(Fo,sE),sb=Br((e,t)=>e*t),zhe=rb((e,t,n,r)=>({real:e*n-t*r,imag:e*r+t*n})),e7e=Jr(Mo,sb,zhe);function Lhe(e,t,n){let r=k.createScalarValue(-1,n);return sb([],t,r,e,n)}var aE=Br((e,t)=>e!==t?1:0),t7e=Jr(vl,aE,null,"bool");function Bhe(e,t,n,r,s){let a=t.length,o=k.sizeFromShape(t),i=k.computeStrides(t),l=k.computeStrides(s),u=k.getTypedArrayFromDType(n,k.sizeFromShape(s));for(let c=0;c1;if(s||a||o)return k.makeZerosTypedArray(0,r);let i=Math.abs(Math.ceil((t-e)/n)),l=k.makeZerosTypedArray(i,r);t1/Math.sqrt(e)),n7e=vu(Oo,iE);function ab(e,t,n,r,s){let a=En.isSliceContinous(r,t,n),o=k.sizeFromShape(n),i=k.computeStrides(r);if(a){let d=En.computeFlatOffset(t,i);return s==="string"?e.slice(d,d+o):e.subarray(d,d+o)}let l=s==="string"?_.fromUint8ToStringArray(e):e,u=Le(r,s,l),c=Le(n,s);for(let d=0;df+t[m]);c.set(u.get(...p),...h)}return s==="string"?_.fromStringArrayToUint8(c.values):c.values}function Vhe(e,t,n,r,s,a,o){let i=t[0],l=a[0],u=new Array(l),c=new Array(i),d=t[1];if(l===0){if(i!==0)throw new Error(`Received SparseTensor with denseShape[0] = 0 but + indices.shape[0] = ${i}`);let g=k.getArrayFromDType(n,0),y=k.getArrayFromDType(s,0);return[g,[0,d],y,u,c]}let h=!0,p=0,f=new Array(l).fill(0);for(let g=0;g=l)throw new Error(`indices(${g}, 0) is invalid: ${y} >= ${l}`);++f[y],h=h&&y>=p,p=y}let m=!0;for(let g=0;g0&&(f[g]+=f[g-1])}if(m&&h){let g=e,y=r;for(let A=0;A0){p[h-1]=1;for(let g=h-2;g>=0;--g)p[g]=p[g+1]*r[g+1]}let f=[];if(i>0){f[i-1]=1;for(let g=i-2;g>=0;--g)f[g]=f[g+1]*l[g+1]}let m=k.getArrayFromDType(n,o*i);for(let g=0;g0?s[i-1]+1:0;if(d<0)throw new Error("segment ids must be >= 0");let h=t.slice();h[0]=d;let p=h.reduce((x,b)=>x*b,1),f=k.getArrayFromDType(n,p);if(i===0)return d>0&&f.fill(o),[f,h];if(d<=0)throw new Error("segment ids must be >= 0");let m=0,g=1,y=0,A=s[m];for(;;){let x=0;if(g=x)throw new Error("segment ids are not increasing")}if(A<0||A>=d)throw new Error(`Segment id ${A} out of range [0, ${d}), possibly because segmentIds input is not sorted.`);A>y&&f.fill(o,y*u,A*u);for(let b=m;b=l[0])throw new Error(`Bad: indices[${b}] == ${r[b]} out of range [0, ${l[0]})`);for(let w=0;wi)break}return y{let n=e-t;return n*n}),r7e=Jr(Po,lE);function Ghe(e,t,n,r){let s=Le(e,t.dtype);for(let a=0;a0?0:o-i),h=0;h+=l*this.leftPad.length;for(let y=0;yy.forEach(A=>f[m++]=A);for(let y=0;y0){g(e[d+c-1]);for(let y=0;y0){let i=t[0];if(i!==0)throw new Error(`First split value must be 0, got ${i}`);for(let l=1;l=i;if(u=u&&t[l]<=n,!u)throw new Error(`Invalid split value ${t[l]}, must be in [${i}, ${n}]`);i=t[l]}if(i!==n)throw new Error(`Last split value must be data size. Expected ${n}, got ${i}`)}let s=r-1,a=k.getArrayFromDType("int32",r);if(n===0||r===0){let i=new Array(n);for(let l=0;l<=s;++l)a[l]=0;return[i,a]}a[0]=0;for(let i=1;i<=s;++i){let l=t[i]-t[i-1],u=0;this.nGramWidths.forEach(c=>{u+=this.getNumNGrams(l,c)}),this.preserveShort&&l>0&&u===0&&(u=1),a[i]=a[i-1]+u}let o=new Array(a[s]);for(let i=0;i{let d=t[i+1]-t[i],h=this.getNumNGrams(d,c);this.createNGrams(e,l,o,u,h,c),u+=h}),this.preserveShort&&u===a[i]){let c=t[i+1]-t[i];if(c===0)continue;let d=c+2*this.padWidth,h=1;this.createNGrams(e,l,o,u,h,d)}}return[o,a]}};function qhe(e,t,n,r,s,a,o,i){return new jhe(n,r,s,a,o,i).compute(e,t)}function Khe(e,t,n){if(!e.length)return[];if(t.length===0){let a=new Array(e.length);for(let o=0;oe-t),Yhe=rb((e,t,n,r)=>({real:e-n,imag:t-r})),s7e=Jr(zo,uE,Yhe);function Jhe(e,t){let n=new Array(e.rank);for(let s=0;sx.value-A.value);let m=d*r,g=l.subarray(m,m+r),y=u.subarray(m,m+r);for(let A=0;A{for(let g=0;g`${e}.${n}`)}function Vn(e,t){return t===1?[e]:pE(e,t)}function Ppe(e,t){if(e===1)return"rc";let n="";for(let r=0;r ${t[0]}`;let a="";for(let r=e-2;r= ${t[r]}`,r ${t[0]}`;let r="";for(let s=e-2;s= ${t[s]}`,s= ${t}; bool rEdge = rp1 >= ${n}; - `}function Vce(e,t){let n=e.length,a=Lce(n,t);return n===1?`getA(rc), + `}function Vpe(e,t){let n=e.length,r=Lpe(n,t);return n===1?`getA(rc), rc + 1 >= ${e[0]} ? 0. : getA(rc + 1), - 0, 0`:`getA(${a[0]}), - cEdge ? 0. : getA(${a[1]}), - rEdge ? 0. : getA(${a[2]}), - rEdge || cEdge ? 0. : getA(${a[3]})`}var fE=class{constructor(e,t){this.variableNames=["A"],this.packedInputs=!0,this.packedOutput=!0,this.outputShape=e;let n="";for(let a=0;a<4;a++){let r="thisRC = rc;";a%2==1&&(r+="thisRC.z += 1;"),a>1&&(r+="thisRC.y += 1;"),n+=` - ${r} - ${a>0?"if(thisRC.y < rows && thisRC.z < cols){":""} + 0, 0`:`getA(${r[0]}), + cEdge ? 0. : getA(${r[1]}), + rEdge ? 0. : getA(${r[2]}), + rEdge || cEdge ? 0. : getA(${r[3]})`}var fE=class{constructor(e,t){this.variableNames=["A"],this.packedInputs=!0,this.packedOutput=!0,this.outputShape=e;let n="";for(let r=0;r<4;r++){let s="thisRC = rc;";r%2==1&&(s+="thisRC.z += 1;"),r>1&&(s+="thisRC.y += 1;"),n+=` + ${s} + ${r>0?"if(thisRC.y < rows && thisRC.z < cols){":""} int flatIndex = getFlatIndex(thisRC); ivec3 inputRC = inputCoordsFromReshapedOutCoords(flatIndex); vec2 inputRCInnerDims = vec2(float(inputRC.y),float(inputRC.z)); - result[${a}] = + result[${r}] = getChannel(getA(inputRC.x, inputRC.y, inputRC.z), inputRCInnerDims); - ${a>0?"}":""} + ${r>0?"}":""} `}this.userCode=` - ${Uce(t)} - ${K5(e)} + ${Upe(t)} + ${X5(e)} void main() { ivec3 rc = getOutputCoords(); @@ -921,12 +921,12 @@ vec2 packedUVfrom3D(int texNumR, int texNumC, setOutput(result); } - `}};function Uce(e){return` + `}};function Upe(e){return` ivec3 inputCoordsFromReshapedOutCoords(int index) { - ${Ao(["r","c","d"],e)} + ${Ai(["r","c","d"],e)} return ivec3(r, c, d); } - `}var jce=class{constructor(e){this.gpgpu=e,this.numUsedTextures=0,this.numFreeTextures=0,this._numBytesAllocated=0,this._numBytesFree=0,this.freeTextures={},this.logEnabled=!1,this.usedTextures={}}acquireTexture(e,t,n){let a=gE(t,n),r=yE(e,a,n);r in this.freeTextures||(this.freeTextures[r]=[]),r in this.usedTextures||(this.usedTextures[r]=[]);let s=mE(e,a,this.gpgpu.gl,this.gpgpu.textureConfig,n);if(this.freeTextures[r].length>0){this.numFreeTextures--,this.numUsedTextures++,this._numBytesFree-=s,this.log();let o=this.freeTextures[r].shift();return this.usedTextures[r].push(o),o}let i;return a===Nn.PACKED_2X2_FLOAT32?i=this.gpgpu.createPackedMatrixTexture(e[0],e[1]):a===Nn.PACKED_2X2_FLOAT16?i=this.gpgpu.createFloat16PackedMatrixTexture(e[0],e[1]):a===Nn.UNPACKED_FLOAT32?i=this.gpgpu.createFloat32MatrixTexture(e[0],e[1]):a===Nn.UNPACKED_FLOAT16?i=this.gpgpu.createFloat16MatrixTexture(e[0],e[1]):a===Nn.PACKED_4X1_UNSIGNED_BYTE&&(i=this.gpgpu.createUnsignedBytesMatrixTexture(e[0],e[1])),this.usedTextures[r].push(i),this.numUsedTextures++,this._numBytesAllocated+=s,this.log(),i}releaseTexture(e,t,n,a){if(this.freeTextures==null)return;let r=gE(n,a),s=yE(t,r,a);s in this.freeTextures||(this.freeTextures[s]=[]);let i=mE(t,r,this.gpgpu.gl,this.gpgpu.textureConfig,a),o=se().get("WEBGL_DELETE_TEXTURE_THRESHOLD");o!==-1&&this._numBytesAllocated>o?(this.gpgpu.deleteMatrixTexture(e),this._numBytesAllocated-=i):(this.freeTextures[s].push(e),this.numFreeTextures++,this._numBytesFree+=i),this.numUsedTextures--;let l=this.usedTextures[s],u=l.indexOf(e);if(u<0)throw new Error("Cannot release a texture that was never provided by this texture manager");l.splice(u,1),this.log()}log(){if(!this.logEnabled)return;let e=this.numFreeTextures+this.numUsedTextures;console.log("Free/Used",`${this.numFreeTextures} / ${this.numUsedTextures}`,`(${e})`);let t=this._numBytesFree/this._numBytesAllocated;console.log(`Bytes allocated: ${this._numBytesAllocated}`),console.log(`Bytes unused: ${this._numBytesFree} (${Math.round(100*t)}%)`)}get numBytesAllocated(){return this._numBytesAllocated}get numBytesFree(){return this._numBytesFree}getNumUsedTextures(){return this.numUsedTextures}getNumFreeTextures(){return this.numFreeTextures}dispose(){if(this.freeTextures!=null){for(let e in this.freeTextures)this.freeTextures[e].forEach(t=>{this.gpgpu.deleteMatrixTexture(t)});for(let e in this.usedTextures)this.usedTextures[e].forEach(t=>{this.gpgpu.deleteMatrixTexture(t)});this.freeTextures=null,this.usedTextures=null,this.numUsedTextures=0,this.numFreeTextures=0,this._numBytesAllocated=0,this._numBytesFree=0}}};function Hce(e,t){let n=e;if(t===n.R32F)return 4;if(t===n.R16F)return 2;if(t===n.RGBA32F||t===e.RGBA)return 16;if(t===n.RGBA16F)return 8;throw new Error(`Unknown internal format ${t}`)}function mE(e,t,n,a,r){let s=Gce(t,a),i;if(r){let[l,u]=fu(e[0],e[1]);i=l*u}else{let[l,u]=sp(e[0],e[1]);i=l*u}let o=Hce(n,s);return i*o}function Gce(e,t){switch(e){case Nn.PACKED_2X2_FLOAT32:return J5(t);case Nn.PACKED_2X2_FLOAT16:return Q5(t);case Nn.UNPACKED_FLOAT32:return X5(t);case Nn.UNPACKED_FLOAT16:return Z5(t);case Nn.PACKED_4X1_UNSIGNED_BYTE:return Y5(t);default:throw new Error(`Unknown physical texture type ${e}`)}}function qce(e){return se().getBool("WEBGL_RENDER_FLOAT32_ENABLED")?e?Nn.PACKED_2X2_FLOAT32:Nn.UNPACKED_FLOAT32:e?Nn.PACKED_2X2_FLOAT16:Nn.UNPACKED_FLOAT16}function gE(e,t){if(e===_a.UPLOAD)return Nn.PACKED_2X2_FLOAT32;if(e===_a.RENDER||e==null)return qce(t);if(e===_a.DOWNLOAD||e===_a.PIXELS)return Nn.PACKED_4X1_UNSIGNED_BYTE;throw new Error(`Unknown logical texture type ${e}`)}function yE(e,t,n){return`${e[0]}_${e[1]}_${t}_${n}`}var Qs=class{constructor(e,t){this.variableNames=["A"],this.outputShape=e,this.userCode=` + `}var Hpe=class{constructor(e){this.gpgpu=e,this.numUsedTextures=0,this.numFreeTextures=0,this._numBytesAllocated=0,this._numBytesFree=0,this.freeTextures={},this.logEnabled=!1,this.usedTextures={}}acquireTexture(e,t,n){let r=gE(t,n),s=yE(e,r,n);s in this.freeTextures||(this.freeTextures[s]=[]),s in this.usedTextures||(this.usedTextures[s]=[]);let a=mE(e,r,this.gpgpu.gl,this.gpgpu.textureConfig,n);if(this.freeTextures[s].length>0){this.numFreeTextures--,this.numUsedTextures++,this._numBytesFree-=a,this.log();let i=this.freeTextures[s].shift();return this.usedTextures[s].push(i),i}let o;return r===Tn.PACKED_2X2_FLOAT32?o=this.gpgpu.createPackedMatrixTexture(e[0],e[1]):r===Tn.PACKED_2X2_FLOAT16?o=this.gpgpu.createFloat16PackedMatrixTexture(e[0],e[1]):r===Tn.UNPACKED_FLOAT32?o=this.gpgpu.createFloat32MatrixTexture(e[0],e[1]):r===Tn.UNPACKED_FLOAT16?o=this.gpgpu.createFloat16MatrixTexture(e[0],e[1]):r===Tn.PACKED_4X1_UNSIGNED_BYTE&&(o=this.gpgpu.createUnsignedBytesMatrixTexture(e[0],e[1])),this.usedTextures[s].push(o),this.numUsedTextures++,this._numBytesAllocated+=a,this.log(),o}releaseTexture(e,t,n,r){if(this.freeTextures==null)return;let s=gE(n,r),a=yE(t,s,r);a in this.freeTextures||(this.freeTextures[a]=[]);let o=mE(t,s,this.gpgpu.gl,this.gpgpu.textureConfig,r),i=ae().get("WEBGL_DELETE_TEXTURE_THRESHOLD");i!==-1&&this._numBytesAllocated>i?(this.gpgpu.deleteMatrixTexture(e),this._numBytesAllocated-=o):(this.freeTextures[a].push(e),this.numFreeTextures++,this._numBytesFree+=o),this.numUsedTextures--;let l=this.usedTextures[a],u=l.indexOf(e);if(u<0)throw new Error("Cannot release a texture that was never provided by this texture manager");l.splice(u,1),this.log()}log(){if(!this.logEnabled)return;let e=this.numFreeTextures+this.numUsedTextures;console.log("Free/Used",`${this.numFreeTextures} / ${this.numUsedTextures}`,`(${e})`);let t=this._numBytesFree/this._numBytesAllocated;console.log(`Bytes allocated: ${this._numBytesAllocated}`),console.log(`Bytes unused: ${this._numBytesFree} (${Math.round(100*t)}%)`)}get numBytesAllocated(){return this._numBytesAllocated}get numBytesFree(){return this._numBytesFree}getNumUsedTextures(){return this.numUsedTextures}getNumFreeTextures(){return this.numFreeTextures}dispose(){if(this.freeTextures!=null){for(let e in this.freeTextures)this.freeTextures[e].forEach(t=>{this.gpgpu.deleteMatrixTexture(t)});for(let e in this.usedTextures)this.usedTextures[e].forEach(t=>{this.gpgpu.deleteMatrixTexture(t)});this.freeTextures=null,this.usedTextures=null,this.numUsedTextures=0,this.numFreeTextures=0,this._numBytesAllocated=0,this._numBytesFree=0}}};function Gpe(e,t){let n=e;if(t===n.R32F)return 4;if(t===n.R16F)return 2;if(t===n.RGBA32F)return 16;if(t===e.RGBA)return 16;if(t===n.RGBA16F)return 8;throw new Error(`Unknown internal format ${t}`)}function mE(e,t,n,r,s){let a=jpe(t,r),o;if(s){let[l,u]=fu(e[0],e[1]);o=l*u}else{let[l,u]=ah(e[0],e[1]);o=l*u}let i=Gpe(n,a);return o*i}function jpe(e,t){switch(e){case Tn.PACKED_2X2_FLOAT32:return Q5(t);case Tn.PACKED_2X2_FLOAT16:return eb(t);case Tn.UNPACKED_FLOAT32:return Z5(t);case Tn.UNPACKED_FLOAT16:return Y5(t);case Tn.PACKED_4X1_UNSIGNED_BYTE:return J5(t);default:throw new Error(`Unknown physical texture type ${e}`)}}function qpe(e){return ae().getBool("WEBGL_RENDER_FLOAT32_ENABLED")?e?Tn.PACKED_2X2_FLOAT32:Tn.UNPACKED_FLOAT32:e?Tn.PACKED_2X2_FLOAT16:Tn.UNPACKED_FLOAT16}function gE(e,t){if(e===zr.UPLOAD)return Tn.PACKED_2X2_FLOAT32;if(e===zr.RENDER||e==null)return qpe(t);if(e===zr.DOWNLOAD||e===zr.PIXELS)return Tn.PACKED_4X1_UNSIGNED_BYTE;throw new Error(`Unknown logical texture type ${e}`)}function yE(e,t,n){return`${e[0]}_${e[1]}_${t}_${n}`}var Qa=class{constructor(e,t){this.variableNames=["A"],this.outputShape=e,this.userCode=` float unaryOperation(float x) { ${t} } @@ -937,11 +937,11 @@ vec2 packedUVfrom3D(int texNumR, int texNumC, setOutput(y); } - `}},gr="if (isnan(x)) return x;",Kce="return x;",AE="return abs(x);",Xce="return (x >= 0.0) ? x : (exp(x) - 1.0);",Zce=gr+` + `}},ys="if (isnan(x)) return x;",Kpe="return x;",AE="return abs(x);",Xpe="return (x >= 0.0) ? x : (exp(x) - 1.0);",Zpe=ys+` return (x < 0.0) ? 0.0 : x; -`,Yce=gr+` +`,Ype=ys+` return (x < 0.0) ? 0.0 : min(6.0, x); -`,V0="return x;",Jce="return 1.0 / (1.0 + exp(-1.0 * x));",Qce="return x;",efe=` +`,Vm="return x;",Jpe="return 1.0 / (1.0 + exp(-1.0 * x));",Qpe="return x;",efe=` vec4 result; result.r = (x.r >= 0.0) ? x.r : (exp(x.r) - 1.0); @@ -970,7 +970,7 @@ vec2 packedUVfrom3D(int texNumR, int texNumC, result.a = isNaN.a ? x.a : result.a; return result; -`,afe="return 1.0 / (1.0 + exp(-1.0 * x));",wu=class{constructor(e,t){this.variableNames=["A"],this.packedInputs=!0,this.packedOutput=!0,this.outputShape=e,this.userCode=` +`,rfe="return 1.0 / (1.0 + exp(-1.0 * x));",wu=class{constructor(e,t){this.variableNames=["A"],this.packedInputs=!0,this.packedOutput=!0,this.outputShape=e,this.userCode=` vec4 unaryOperation(vec4 x) { ${t} } @@ -981,17 +981,17 @@ vec2 packedUVfrom3D(int texNumR, int texNumC, setOutput(y); } - `}},rfe=class{constructor(e){this.variableNames=["A"],this.packedInputs=!0,this.packedOutput=!1,this.outputShape=e;let t=e.length,n=Bn("rc",t),a=kt(t),r=zce(t,n),s=n.slice(-2),i=t<=1?"rc":`vec2(${s.join(",")})`;this.userCode=` + `}},sfe=class{constructor(e){this.variableNames=["A"],this.packedInputs=!0,this.packedOutput=!1,this.outputShape=e;let t=e.length,n=Vn("rc",t),r=It(t),s=Ppe(t,n),a=n.slice(-2),o=t<=1?"rc":`vec2(${a.join(",")})`;this.userCode=` void main() { - ${a} rc = getOutputCoords(); - vec4 packedInput = getA(${r}); + ${r} rc = getOutputCoords(); + vec4 packedInput = getA(${s}); - setOutput(getChannel(packedInput, ${i})); + setOutput(getChannel(packedInput, ${o})); } - `}},sfe=us.whereImpl,ife=1e-7,ofe=1e-4,ib={};function lfe(e){return e in ib||(ib[e]={}),ib[e]}var ufe=()=>se().getNumber("CPU_HANDOFF_SIZE_THRESHOLD"),dfe=600;function hfe(){return se().global.screen==null?1024:se().global.screen.height*se().global.screen.width*window.devicePixelRatio*dfe/1024/1024}var xE=class extends Wc{constructor(e){super();if(this.pendingRead=new WeakMap,this.pendingDisposal=new WeakSet,this.dataRefCount=new WeakMap,this.numBytesInGPU=0,this.uploadWaitMs=0,this.downloadWaitMs=0,this.lastGlFlushTime=0,this.warnedAboutMemory=!1,this.pendingDeletes=0,this.disposed=!1,!se().getBool("HAS_WEBGL"))throw new Error("WebGL is not supported on this device");if(e==null){let t=Pr(se().getNumber("WEBGL_VERSION"));this.binaryCache=lfe(se().getNumber("WEBGL_VERSION")),this.gpgpu=new W0(t),this.canvas=t.canvas,this.gpgpuCreatedLocally=!0}else this.gpgpu=e,this.binaryCache={},this.gpgpuCreatedLocally=!1,this.canvas=e.gl.canvas;this.textureManager=new jce(this.gpgpu),this.numMBBeforeWarning=hfe(),this.texData=new c1(this,Ps())}nextDataId(){return xE.nextDataId++}numDataIds(){return this.texData.numDataIds()-this.pendingDeletes}write(e,t,n){if((se().getBool("WEBGL_CHECK_NUMERICAL_PROBLEMS")||se().getBool("DEBUG"))&&this.checkNumericalProblems(e),n==="complex64"&&e!=null)throw new Error("Cannot write to a complex64 dtype. Please use tf.complex(real, imag).");let a={id:this.nextDataId()};return this.texData.set(a,{shape:t,dtype:n,values:e,usage:_a.UPLOAD,refCount:1}),a}refCount(e){return this.texData.has(e)?this.texData.get(e).refCount:0}incRef(e){let t=this.texData.get(e);t.refCount++}decRef(e){if(this.texData.has(e)){let t=this.texData.get(e);t.refCount--}}move(e,t,n,a,r){if(se().getBool("DEBUG")&&this.checkNumericalProblems(t),a==="complex64")throw new Error("Cannot write to a complex64 dtype. Please use tf.complex(real, imag).");this.texData.set(e,{shape:n,dtype:a,values:t,usage:_a.UPLOAD,refCount:r})}disposeIntermediateTensorInfo(e){this.disposeData(e.dataId)}readSync(e){let t=this.texData.get(e),{values:n,dtype:a,complexTensorInfos:r,slice:s,shape:i,isPacked:o}=t;if(s!=null){let h;o?h=new wu(i,V0):h=new Qs(i,V0);let p=this.runWebGLProgram(h,[{dataId:e,shape:i,dtype:a}],a),c=this.readSync(p.dataId);return this.disposeIntermediateTensorInfo(p),c}if(n!=null)return this.convertAndCacheOnCPU(e);if(a==="string")return n;let l=this.activeTimers!=null,u;l&&(u=k.now());let d;if(a==="complex64"){let h=this.readSync(r.real.dataId),p=this.readSync(r.imag.dataId);d=M.mergeRealAndImagArrays(h,p)}else d=this.getValuesFromTexture(e);return l&&(this.downloadWaitMs+=k.now()-u),this.convertAndCacheOnCPU(e,d)}async read(e){if(this.pendingRead.has(e)){let c=this.pendingRead.get(e);return new Promise(m=>c.push(m))}let t=this.texData.get(e),{values:n,shape:a,slice:r,dtype:s,complexTensorInfos:i,isPacked:o}=t;if(r!=null){let c;o?c=new wu(a,V0):c=new Qs(a,V0);let m=this.runWebGLProgram(c,[{dataId:e,shape:a,dtype:s}],s),f=this.read(m.dataId);return this.disposeIntermediateTensorInfo(m),f}if(n!=null)return this.convertAndCacheOnCPU(e);if(!se().getBool("WEBGL_DOWNLOAD_FLOAT_ENABLED")&&se().getNumber("WEBGL_VERSION")===2)throw new Error("tensor.data() with WEBGL_DOWNLOAD_FLOAT_ENABLED=false and WEBGL_VERSION=2 not yet supported.");let l=null,u;if(s!=="complex64"&&se().get("WEBGL_BUFFER_SUPPORTED")){u=this.decode(e);let c=this.texData.get(u.dataId);l=this.gpgpu.createBufferFromTexture(c.texture,...ip(a))}this.pendingRead.set(e,[]),s!=="complex64"&&await this.gpgpu.createAndWaitForFence();let d;if(s==="complex64"){let c=await Promise.all([this.read(i.real.dataId),this.read(i.imag.dataId)]),m=c[0],f=c[1];d=M.mergeRealAndImagArrays(m,f)}else if(l==null)d=this.getValuesFromTexture(e);else{let c=k.sizeFromShape(a);d=this.gpgpu.downloadFloat32MatrixFromBuffer(l,c)}u!=null&&this.disposeIntermediateTensorInfo(u);let h=this.convertAndCacheOnCPU(e,d),p=this.pendingRead.get(e);return this.pendingRead.delete(e),p.forEach(c=>c(h)),this.pendingDisposal.has(e)&&(this.pendingDisposal.delete(e),this.disposeData(e)&&Ps().removeDataId(e,this),this.pendingDeletes--),h}bufferSync(e){let t=this.readSync(e.dataId),n=t;if(e.dtype==="string")try{n=t.map(a=>k.decodeString(a))}catch(a){throw new Error("Failed to decode encoded string bytes into utf-8")}return Pe(e.shape,e.dtype,n)}checkNumericalProblems(e){if(e!=null)for(let t=0;t0}async time(e){let t=this.activeTimers,n=[],a=!1;this.programTimersStack==null?(this.programTimersStack=n,a=!0):this.activeTimers.push(n),this.activeTimers=n,e();let r=k.flatten(this.activeTimers.map(o=>o.query)).filter(o=>o!=null),s=k.flatten(this.activeTimers.map(o=>o.name)).filter(o=>o!=null);this.activeTimers=t,a&&(this.programTimersStack=null);let i={uploadWaitMs:this.uploadWaitMs,downloadWaitMs:this.downloadWaitMs,kernelMs:null,wallMs:null};if(se().getNumber("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_RELIABLE")>0){let o=await Promise.all(r);i.kernelMs=k.sum(o),i.getExtraProfileInfo=()=>o.map((l,u)=>({name:s[u],ms:l})).map(l=>`${l.name}: ${l.ms}`).join(", ")}else i.kernelMs={error:"WebGL query timers are not supported in this environment."};return this.uploadWaitMs=0,this.downloadWaitMs=0,i}memory(){return{unreliable:!1,numBytesInGPU:this.numBytesInGPU,numBytesInGPUAllocated:this.textureManager.numBytesAllocated,numBytesInGPUFree:this.textureManager.numBytesFree}}startTimer(){return se().getNumber("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_RELIABLE")>0?this.gpgpu.beginQuery():{startMs:k.now(),endMs:null}}endTimer(e){return se().getNumber("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_RELIABLE")>0?(this.gpgpu.endQuery(),e):(e.endMs=k.now(),e)}async getQueryTime(e){if(se().getNumber("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_RELIABLE")>0)return this.gpgpu.waitForQueryAndGetTime(e);let t=e;return t.endMs-t.startMs}disposeData(e,t=!1){if(this.pendingDisposal.has(e))return!1;if(!this.texData.has(e))return!0;if(t?this.texData.get(e).refCount=0:this.texData.get(e).refCount--,!t&&this.texData.get(e).refCount>0)return!1;if(this.pendingRead.has(e))return this.pendingDisposal.add(e),this.pendingDeletes++,!1;this.releaseGPUData(e);let{complexTensorInfos:n}=this.texData.get(e);return n!=null&&(this.disposeData(n.real.dataId,t),this.disposeData(n.imag.dataId,t)),this.texData.delete(e),!0}releaseGPUData(e){let{texture:t,dtype:n,texShape:a,usage:r,isPacked:s,slice:i}=this.texData.get(e),o=i&&i.origDataId||e,l=this.dataRefCount.get(o);l>1?this.dataRefCount.set(o,l-1):(this.dataRefCount.delete(o),t!=null&&(this.numBytesInGPU-=this.computeBytes(a,n),this.textureManager.releaseTexture(t,a,r,s)));let u=this.texData.get(e);u.texture=null,u.texShape=null,u.isPacked=!1,u.slice=null}getTexture(e){return this.uploadToGPU(e),this.texData.get(e).texture}getDataInfo(e){return this.texData.get(e)}shouldExecuteOnCPU(e,t=ufe){return se().getBool("WEBGL_CPU_FORWARD")&&e.every(n=>this.texData.get(n.dataId).texture==null&&k.sizeFromShape(n.shape)0&&k.isString(n[0])){let r=n.map(s=>k.encodeString(s));a=this.write(r,e,t)}else a=this.write(n,e,t);return this.texData.get(a).usage=null,{dataId:a,shape:e,dtype:t}}makeOutput(e,t,n){let{dataId:a}=this.makeTensorInfo(e,t,n);return Ps().makeTensorFromDataId(a,e,t,this)}unpackTensor(e){let t=new rfe(e.shape);return this.runWebGLProgram(t,[e],e.dtype)}packTensor(e){let t=new Pce(e.shape),n=!0;return this.runWebGLProgram(t,[e],e.dtype,null,n)}packedReshape(e,t){let n=[go(e.shape),...yo(e.shape)],a={dtype:e.dtype,shape:n,dataId:e.dataId},r=[go(t),...yo(t)],s=new fE(r,n),i=!0,o=this.runWebGLProgram(s,[a],e.dtype,null,i);return{dataId:o.dataId,shape:t,dtype:o.dtype}}decode(e){let t=this.texData.get(e),{isPacked:n,shape:a,dtype:r}=t,s=_0(a),i;n?i=new Phe(s):i=new zhe(s);let o=!0,l=this.runWebGLProgram(i,[{shape:s,dtype:r,dataId:e}],r,null,o);return{dtype:r,shape:a,dataId:l.dataId}}runWebGLProgram(e,t,n,a,r=!1){let s=this.makeTensorInfo(e.outputShape,n),i=this.texData.get(s.dataId);if(e.packedOutput&&(i.isPacked=!0),e.outPackingScheme===rp.DENSE){let f=ip(e.outputShape);i.texShape=f.map(g=>g*2)}if(e.outTexUsage!=null&&(i.usage=e.outTexUsage),k.sizeFromShape(s.shape)===0)return i.values=k.getTypedArrayFromDType(s.dtype,0),s;let o=[],l=t.map(f=>{if(f.dtype==="complex64")throw new Error("GPGPUProgram does not support complex64 input. For complex64 dtypes, please separate the program into real and imaginary parts.");let g=this.texData.get(f.dataId);if(g.texture==null){if(!e.packedInputs&&k.sizeFromShape(f.shape)<=se().getNumber("WEBGL_SIZE_UPLOAD_UNIFORM"))return{shape:f.shape,texData:null,isUniform:!0,uniformValues:g.values};e.packedInputs&&(g.isPacked=!0,g.shape=f.shape)}else if(!!g.isPacked!=!!e.packedInputs)f=g.isPacked?this.unpackTensor(f):this.packTensor(f),o.push(f),g=this.texData.get(f.dataId);else if(g.isPacked&&!up(g.shape,f.shape)){let y=f,A=f.shape;f.shape=g.shape,f=this.packedReshape(f,A),o.push(f),g=this.texData.get(f.dataId),y.shape=A}return this.uploadToGPU(f.dataId),{shape:f.shape,texData:g,isUniform:!1}});this.uploadToGPU(s.dataId);let u={shape:s.shape,texData:i,isUniform:!1},d=Epe(e,l,u),h=this.getAndSaveBinary(d,()=>Npe(this.gpgpu,e,l,u)),p=this.activeTimers!=null,c;p&&(c=this.startTimer()),Tpe(this.gpgpu,h,l,u,a),o.forEach(f=>this.disposeIntermediateTensorInfo(f)),p&&(c=this.endTimer(c),this.activeTimers.push({name:e.constructor.name,query:this.getQueryTime(c)}));let m=se().get("WEBGL_FLUSH_THRESHOLD");if(m>0){let f=k.now();f-this.lastGlFlushTime>m&&(this.gpgpu.gl.flush(),this.lastGlFlushTime=f)}if(!se().getBool("WEBGL_LAZILY_UNPACK")&&i.isPacked&&r===!1){let f=this.unpackTensor(s);return this.disposeIntermediateTensorInfo(s),f}return s}compileAndRun(e,t,n,a,r=!1){return n=n||t[0].dtype,this.runWebGLProgram(e,t,n,a,r)}getAndSaveBinary(e,t){return e in this.binaryCache||(this.binaryCache[e]=t()),this.binaryCache[e]}getTextureManager(){return this.textureManager}dispose(){this.disposed||(se().getBool("IS_TEST")||Object.keys(this.binaryCache).forEach(e=>{this.gpgpu.deleteProgram(this.binaryCache[e].webGLProgram),delete this.binaryCache[e]}),this.textureManager.dispose(),this.canvas!=null&&typeof HTMLCanvasElement!="undefined"&&this.canvas instanceof HTMLCanvasElement?this.canvas.remove():this.canvas=null,this.gpgpuCreatedLocally&&(this.gpgpu.program=null,this.gpgpu.dispose()),this.disposed=!0)}floatPrecision(){return this.floatPrecisionValue==null&&(this.floatPrecisionValue=Z(()=>{if(!se().get("WEBGL_RENDER_FLOAT32_ENABLED")){let e=se().getBool("DEBUG");se().set("DEBUG",!1);let t=this.abs(Re(1e-8)).dataSync()[0];if(se().set("DEBUG",e),t>0)return 32}return 16})),this.floatPrecisionValue}epsilon(){return this.floatPrecision()===32?ife:ofe}uploadToGPU(e){let t=this.texData.get(e),{shape:n,dtype:a,values:r,texture:s,usage:i,isPacked:o}=t;if(s!=null)return;let l=this.activeTimers!=null,u;l&&(u=k.now());let d=t.texShape;if(d==null&&(d=cT(n,o),t.texShape=d),r!=null){let h=_0(n),p,c=d[1],m=d[0],f=r instanceof Uint8Array;o?([c,m]=fu(d[0],d[1]),p=new Vhe(h,[m,c],f)):p=new Bhe(h,[m,c],f);let g=this.makeTensorInfo([m,c],a);f?this.texData.get(g.dataId).usage=_a.PIXELS:this.texData.get(g.dataId).usage=_a.UPLOAD,this.gpgpu.uploadDenseMatrixToTexture(this.getTexture(g.dataId),c,m,r);let y=!0,A=this.runWebGLProgram(p,[g],a,null,y),x=this.texData.get(A.dataId);t.texture=x.texture,t.texShape=x.texShape,t.isPacked=x.isPacked,t.usage=x.usage,this.disposeIntermediateTensorInfo(g),this.texData.delete(A.dataId),t.values=null,l&&(this.uploadWaitMs+=k.now()-u)}else{let h=this.acquireTexture(d,i,a,o);t.texture=h}}convertAndCacheOnCPU(e,t){let n=this.texData.get(e),{dtype:a}=n;return this.releaseGPUData(e),t!=null&&(n.values=pfe(t,a)),n.values}acquireTexture(e,t,n,a){if(this.numBytesInGPU+=this.computeBytes(e,n),!this.warnedAboutMemory&&this.numBytesInGPU>this.numMBBeforeWarning*1024*1024){let r=(this.numBytesInGPU/1024/1024).toFixed(2);this.warnedAboutMemory=!0,console.warn(`High memory usage in GPU: ${r} MB, most likely due to a memory leak`)}return this.textureManager.acquireTexture(e,t,a)}computeBytes(e,t){return e[0]*e[1]*k.bytesPerElement(t)}},hp=xE;hp.nextDataId=0;function pfe(e,t){if(t==="float32"||t==="complex64")return e;if(t==="int32"||t==="bool"){let n=t==="int32"?new Int32Array(e.length):new Uint8Array(e.length);for(let a=0;anew hp,2);var ffe={forceHalfFloat:bE},vE=` + `}},afe=ca.whereImpl,ofe=1e-7,ife=1e-4,Um={};function lfe(e){return e in Um||(Um[e]={}),Um[e]}var ufe=ae().getNumber("CPU_HANDOFF_SIZE_THRESHOLD"),cfe=600;function dfe(){return ae().global.screen==null?1024:ae().global.screen.height*ae().global.screen.width*window.devicePixelRatio*cfe/1024/1024}var xE=class extends Bp{constructor(e){super();if(this.pendingRead=new WeakMap,this.pendingDisposal=new WeakSet,this.dataRefCount=new WeakMap,this.numBytesInGPU=0,this.uploadWaitMs=0,this.downloadWaitMs=0,this.lastGlFlushTime=0,this.warnedAboutMemory=!1,this.pendingDeletes=0,this.disposed=!1,!ae().getBool("HAS_WEBGL"))throw new Error("WebGL is not supported on this device");if(e==null){let t=Ls(ae().getNumber("WEBGL_VERSION"));this.binaryCache=lfe(ae().getNumber("WEBGL_VERSION")),this.gpgpu=new Bm(t),this.canvas=t.canvas,this.gpgpuCreatedLocally=!0}else this.gpgpu=e,this.binaryCache={},this.gpgpuCreatedLocally=!1,this.canvas=e.gl.canvas;this.textureManager=new Hpe(this.gpgpu),this.numMBBeforeWarning=dfe(),this.texData=new fy(this,za())}nextDataId(){return xE.nextDataId++}numDataIds(){return this.texData.numDataIds()-this.pendingDeletes}write(e,t,n){if((ae().getBool("WEBGL_CHECK_NUMERICAL_PROBLEMS")||ae().getBool("DEBUG"))&&this.checkNumericalProblems(e),n==="complex64"&&e!=null)throw new Error("Cannot write to a complex64 dtype. Please use tf.complex(real, imag).");let r={id:this.nextDataId()};return this.texData.set(r,{shape:t,dtype:n,values:e,usage:zr.UPLOAD,refCount:1}),r}refCount(e){return this.texData.has(e)?this.texData.get(e).refCount:0}incRef(e){let t=this.texData.get(e);t.refCount++}decRef(e){if(this.texData.has(e)){let t=this.texData.get(e);t.refCount--}}move(e,t,n,r,s){if(ae().getBool("DEBUG")&&this.checkNumericalProblems(t),r==="complex64")throw new Error("Cannot write to a complex64 dtype. Please use tf.complex(real, imag).");this.texData.set(e,{shape:n,dtype:r,values:t,usage:zr.UPLOAD,refCount:s})}disposeIntermediateTensorInfo(e){this.disposeData(e.dataId)}readSync(e){let t=this.texData.get(e),{values:n,dtype:r,complexTensorInfos:s,slice:a,shape:o,isPacked:i}=t;if(a!=null){let d;i?d=new wu(o,Vm):d=new Qa(o,Vm);let h=this.runWebGLProgram(d,[{dataId:e,shape:o,dtype:r}],r),p=this.readSync(h.dataId);return this.disposeIntermediateTensorInfo(h),p}if(n!=null)return this.convertAndCacheOnCPU(e);if(r==="string")return n;let l=this.activeTimers!=null,u;l&&(u=k.now());let c;if(r==="complex64"){let d=this.readSync(s.real.dataId),h=this.readSync(s.imag.dataId);c=_.mergeRealAndImagArrays(d,h)}else c=this.getValuesFromTexture(e);return l&&(this.downloadWaitMs+=k.now()-u),this.convertAndCacheOnCPU(e,c)}async read(e){if(this.pendingRead.has(e)){let p=this.pendingRead.get(e);return new Promise(f=>p.push(f))}let t=this.texData.get(e),{values:n,shape:r,slice:s,dtype:a,complexTensorInfos:o,isPacked:i}=t;if(s!=null){let p;i?p=new wu(r,Vm):p=new Qa(r,Vm);let f=this.runWebGLProgram(p,[{dataId:e,shape:r,dtype:a}],a),m=this.read(f.dataId);return this.disposeIntermediateTensorInfo(f),m}if(n!=null)return this.convertAndCacheOnCPU(e);if(!ae().getBool("WEBGL_DOWNLOAD_FLOAT_ENABLED")&&ae().getNumber("WEBGL_VERSION")===2)throw new Error("tensor.data() with WEBGL_DOWNLOAD_FLOAT_ENABLED=false and WEBGL_VERSION=2 not yet supported.");let l=null,u;if(a!=="complex64"&&ae().get("WEBGL_BUFFER_SUPPORTED")){u=this.decode(e);let p=this.texData.get(u.dataId);l=this.gpgpu.createBufferFromTexture(p.texture,...oh(r))}this.pendingRead.set(e,[]),a!=="complex64"&&await this.gpgpu.createAndWaitForFence();let c;if(a==="complex64"){let p=await Promise.all([this.read(o.real.dataId),this.read(o.imag.dataId)]),f=p[0],m=p[1];c=_.mergeRealAndImagArrays(f,m)}else if(l==null)c=this.getValuesFromTexture(e);else{let p=k.sizeFromShape(r);c=this.gpgpu.downloadFloat32MatrixFromBuffer(l,p)}u!=null&&this.disposeIntermediateTensorInfo(u);let d=this.convertAndCacheOnCPU(e,c),h=this.pendingRead.get(e);return this.pendingRead.delete(e),h.forEach(p=>p(d)),this.pendingDisposal.has(e)&&(this.pendingDisposal.delete(e),this.disposeData(e)&&za().removeDataId(e,this),this.pendingDeletes--),d}bufferSync(e){let t=this.readSync(e.dataId),n=t;if(e.dtype==="string")try{n=t.map(r=>k.decodeString(r))}catch(r){throw new Error("Failed to decode encoded string bytes into utf-8")}return Le(e.shape,e.dtype,n)}checkNumericalProblems(e){if(e!=null)for(let t=0;t0}async time(e){let t=this.activeTimers,n=[],r=!1;this.programTimersStack==null?(this.programTimersStack=n,r=!0):this.activeTimers.push(n),this.activeTimers=n,e();let s=k.flatten(this.activeTimers.map(i=>i.query)).filter(i=>i!=null),a=k.flatten(this.activeTimers.map(i=>i.name)).filter(i=>i!=null);this.activeTimers=t,r&&(this.programTimersStack=null);let o={uploadWaitMs:this.uploadWaitMs,downloadWaitMs:this.downloadWaitMs,kernelMs:null,wallMs:null};if(ae().getNumber("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_RELIABLE")>0){let i=await Promise.all(s);o.kernelMs=k.sum(i),o.getExtraProfileInfo=()=>i.map((l,u)=>({name:a[u],ms:l})).map(l=>`${l.name}: ${l.ms}`).join(", ")}else o.kernelMs={error:"WebGL query timers are not supported in this environment."};return this.uploadWaitMs=0,this.downloadWaitMs=0,o}memory(){return{unreliable:!1,numBytesInGPU:this.numBytesInGPU,numBytesInGPUAllocated:this.textureManager.numBytesAllocated,numBytesInGPUFree:this.textureManager.numBytesFree}}startTimer(){return ae().getNumber("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_RELIABLE")>0?this.gpgpu.beginQuery():{startMs:k.now(),endMs:null}}endTimer(e){return ae().getNumber("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_RELIABLE")>0?(this.gpgpu.endQuery(),e):(e.endMs=k.now(),e)}async getQueryTime(e){if(ae().getNumber("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_RELIABLE")>0)return this.gpgpu.waitForQueryAndGetTime(e);let t=e;return t.endMs-t.startMs}disposeData(e,t=!1){if(this.pendingDisposal.has(e))return!1;if(!this.texData.has(e))return!0;if(t?this.texData.get(e).refCount=0:this.texData.get(e).refCount--,!t&&this.texData.get(e).refCount>0)return!1;if(this.pendingRead.has(e))return this.pendingDisposal.add(e),this.pendingDeletes++,!1;this.releaseGPUData(e);let{complexTensorInfos:n}=this.texData.get(e);return n!=null&&(this.disposeData(n.real.dataId,t),this.disposeData(n.imag.dataId,t)),this.texData.delete(e),!0}releaseGPUData(e){let{texture:t,dtype:n,texShape:r,usage:s,isPacked:a,slice:o}=this.texData.get(e),i=o&&o.origDataId||e,l=this.dataRefCount.get(i);l>1?this.dataRefCount.set(i,l-1):(this.dataRefCount.delete(i),t!=null&&(this.numBytesInGPU-=this.computeBytes(r,n),this.textureManager.releaseTexture(t,r,s,a)));let u=this.texData.get(e);u.texture=null,u.texShape=null,u.isPacked=!1,u.slice=null}getTexture(e){return this.uploadToGPU(e),this.texData.get(e).texture}getDataInfo(e){return this.texData.get(e)}shouldExecuteOnCPU(e,t=ufe){return ae().getBool("WEBGL_CPU_FORWARD")&&e.every(n=>this.texData.get(n.dataId).texture==null&&k.sizeFromShape(n.shape)0&&k.isString(n[0])){let s=n.map(a=>k.encodeString(a));r=this.write(s,e,t)}else r=this.write(n,e,t);return this.texData.get(r).usage=null,{dataId:r,shape:e,dtype:t}}makeOutput(e,t,n){let{dataId:r}=this.makeTensorInfo(e,t,n);return za().makeTensorFromDataId(r,e,t,this)}unpackTensor(e){let t=new sfe(e.shape);return this.runWebGLProgram(t,[e],e.dtype)}packTensor(e){let t=new zpe(e.shape),n=!0;return this.runWebGLProgram(t,[e],e.dtype,null,n)}packedReshape(e,t){let n=[gi(e.shape),...yi(e.shape)],r={dtype:e.dtype,shape:n,dataId:e.dataId},s=[gi(t),...yi(t)],a=new fE(s,n),o=!0,i=this.runWebGLProgram(a,[r],e.dtype,null,o);return{dataId:i.dataId,shape:t,dtype:i.dtype}}decode(e){let t=this.texData.get(e),{isPacked:n,shape:r,dtype:s}=t,a=Om(r),o;n?o=new zde(a):o=new Pde(a);let i=!0,l=this.runWebGLProgram(o,[{shape:a,dtype:s,dataId:e}],s,null,i);return{dtype:s,shape:r,dataId:l.dataId}}runWebGLProgram(e,t,n,r,s=!1){let a=this.makeTensorInfo(e.outputShape,n),o=this.texData.get(a.dataId);if(e.packedOutput&&(o.isPacked=!0),e.outPackingScheme===sh.DENSE){let m=oh(e.outputShape);o.texShape=m.map(g=>g*2)}if(e.outTexUsage!=null&&(o.usage=e.outTexUsage),k.sizeFromShape(a.shape)===0)return o.values=k.getTypedArrayFromDType(a.dtype,0),a;let i=[],l=t.map(m=>{if(m.dtype==="complex64")throw new Error("GPGPUProgram does not support complex64 input. For complex64 dtypes, please separate the program into real and imaginary parts.");let g=this.texData.get(m.dataId);if(g.texture==null){if(!e.packedInputs&&k.sizeFromShape(m.shape)<=ae().getNumber("WEBGL_SIZE_UPLOAD_UNIFORM"))return{shape:m.shape,texData:null,isUniform:!0,uniformValues:g.values};e.packedInputs&&(g.isPacked=!0,g.shape=m.shape)}else if(!!g.isPacked!=!!e.packedInputs)m=g.isPacked?this.unpackTensor(m):this.packTensor(m),i.push(m),g=this.texData.get(m.dataId);else if(g.isPacked&&!uh(g.shape,m.shape)){let y=m,A=m.shape;m.shape=g.shape,m=this.packedReshape(m,A),i.push(m),g=this.texData.get(m.dataId),y.shape=A}return this.uploadToGPU(m.dataId),{shape:m.shape,texData:g,isUniform:!1}});this.uploadToGPU(a.dataId);let u={shape:a.shape,texData:o,isUniform:!1},c=Che(e,l,u),d=this.getAndSaveBinary(c,()=>The(this.gpgpu,e,l,u)),h=this.activeTimers!=null,p;h&&(p=this.startTimer()),Nhe(this.gpgpu,d,l,u,r),i.forEach(m=>this.disposeIntermediateTensorInfo(m)),h&&(p=this.endTimer(p),this.activeTimers.push({name:e.constructor.name,query:this.getQueryTime(p)}));let f=ae().get("WEBGL_FLUSH_THRESHOLD");if(f>0){let m=k.now();m-this.lastGlFlushTime>f&&(this.gpgpu.gl.flush(),this.lastGlFlushTime=m)}if(!ae().getBool("WEBGL_LAZILY_UNPACK")&&o.isPacked&&s===!1){let m=this.unpackTensor(a);return this.disposeIntermediateTensorInfo(a),m}return a}compileAndRun(e,t,n,r,s=!1){return n=n||t[0].dtype,this.runWebGLProgram(e,t,n,r,s)}getAndSaveBinary(e,t){return e in this.binaryCache||(this.binaryCache[e]=t()),this.binaryCache[e]}getTextureManager(){return this.textureManager}dispose(){this.disposed||(ae().getBool("IS_TEST")||Object.keys(this.binaryCache).forEach(t=>{this.gpgpu.deleteProgram(this.binaryCache[t].webGLProgram),delete this.binaryCache[t]}),this.textureManager.dispose(),this.canvas!=null&&typeof HTMLCanvasElement!="undefined"&&this.canvas instanceof HTMLCanvasElement?this.canvas.remove():this.canvas=null,this.gpgpuCreatedLocally&&(this.gpgpu.program=null,this.gpgpu.dispose()),this.disposed=!0)}floatPrecision(){return this.floatPrecisionValue==null&&(this.floatPrecisionValue=Z(()=>{if(!ae().get("WEBGL_RENDER_FLOAT32_ENABLED")){let e=ae().getBool("DEBUG");ae().set("DEBUG",!1);let t=this.abs(Fe(1e-8)).dataSync()[0];if(ae().set("DEBUG",e),t>0)return 32}return 16})),this.floatPrecisionValue}epsilon(){return this.floatPrecision()===32?ofe:ife}uploadToGPU(e){let t=this.texData.get(e),{shape:n,dtype:r,values:s,texture:a,usage:o,isPacked:i}=t;if(a!=null)return;let l=this.activeTimers!=null,u;l&&(u=k.now());let c=t.texShape;if(c==null&&(c=pC(n,i),t.texShape=c),s!=null){let d=Om(n),h,p=c[1],f=c[0],m=s instanceof Uint8Array;i?([p,f]=fu(c[0],c[1]),h=new Vde(d,[f,p],m)):h=new Wde(d,[f,p],m);let g=this.makeTensorInfo([f,p],r);m?this.texData.get(g.dataId).usage=zr.PIXELS:this.texData.get(g.dataId).usage=zr.UPLOAD,this.gpgpu.uploadDenseMatrixToTexture(this.getTexture(g.dataId),p,f,s);let y=!0,A=this.runWebGLProgram(h,[g],r,null,y),x=this.texData.get(A.dataId);t.texture=x.texture,t.texShape=x.texShape,t.isPacked=x.isPacked,t.usage=x.usage,this.disposeIntermediateTensorInfo(g),this.texData.delete(A.dataId),t.values=null,l&&(this.uploadWaitMs+=k.now()-u)}else{let d=this.acquireTexture(c,o,r,i);t.texture=d}}convertAndCacheOnCPU(e,t){let n=this.texData.get(e),{dtype:r}=n;return this.releaseGPUData(e),t!=null&&(n.values=hfe(t,r)),n.values}acquireTexture(e,t,n,r){if(this.numBytesInGPU+=this.computeBytes(e,n),!this.warnedAboutMemory&&this.numBytesInGPU>this.numMBBeforeWarning*1024*1024){let s=(this.numBytesInGPU/1024/1024).toFixed(2);this.warnedAboutMemory=!0,console.warn(`High memory usage in GPU: ${s} MB, most likely due to a memory leak`)}return this.textureManager.acquireTexture(e,t,r)}computeBytes(e,t){return e[0]*e[1]*k.bytesPerElement(t)}},dh=xE;dh.nextDataId=0;function hfe(e,t){if(t==="float32"||t==="complex64")return e;if(t==="int32"||t==="bool"){let n=t==="int32"?new Int32Array(e.length):new Uint8Array(e.length);for(let r=0;rnew dh,2);var ffe={forceHalfFloat:bE},vE=` if (isnan(a)) return a; if (isnan(b)) return b; -`,ku=class{constructor(e,t,n){this.variableNames=["A","B"],this.outputShape=M.assertAndGetBroadcastShape(t,n),this.userCode=` +`,ku=class{constructor(e,t,n){this.variableNames=["A","B"],this.outputShape=_.assertAndGetBroadcastShape(t,n),this.userCode=` float binaryOperation(float a, float b) { ${e} } @@ -1001,26 +1001,26 @@ vec2 packedUVfrom3D(int texNumR, int texNumC, float b = getBAtOutCoords(); setOutput(binaryOperation(a, b)); } - `}},U0=` + `}},Hm=` result.r = isNaN.r > 0. ? NAN : result.r; result.g = isNaN.g > 0. ? NAN : result.g; result.b = isNaN.b > 0. ? NAN : result.b; result.a = isNaN.a > 0. ? NAN : result.a; -`,pp=class{constructor(e,t,n,a=!1){this.variableNames=["A","B"],this.supportsBroadcasting=!0,this.packedInputs=!0,this.packedOutput=!0,this.outputShape=M.assertAndGetBroadcastShape(t,n);let r=this.outputShape.length,s="";if(a)if(r===0||k.sizeFromShape(this.outputShape)===1)s=` +`,hh=class{constructor(e,t,n,r=!1){this.variableNames=["A","B"],this.supportsBroadcasting=!0,this.packedInputs=!0,this.packedOutput=!0,this.outputShape=_.assertAndGetBroadcastShape(t,n);let s=this.outputShape.length,a="";if(r)if(s===0||k.sizeFromShape(this.outputShape)===1)a=` result.y = 0.; result.z = 0.; result.w = 0.; - `;else if(s=` - ${kt(r)} coords = getOutputCoords(); - `,r===1)s+=` + `;else if(a=` + ${It(s)} coords = getOutputCoords(); + `,s===1)a+=` result.y = (coords + 1) >= ${this.outputShape[0]} ? 0. : result.y; result.z = 0.; result.w = 0.; - `;else{let i=Bn("coords",r);s+=` + `;else{let i=Vn("coords",s);a+=` bool nextRowOutOfBounds = - (${i[r-2]} + 1) >= ${this.outputShape[r-2]}; + (${i[s-2]} + 1) >= ${this.outputShape[s-2]}; bool nextColOutOfBounds = - (${i[r-1]} + 1) >= ${this.outputShape[r-1]}; + (${i[s-1]} + 1) >= ${this.outputShape[s-1]}; result.y = nextColOutOfBounds ? 0. : result.y; result.z = nextRowOutOfBounds ? 0. : result.z; result.w = nextColOutOfBounds || nextRowOutOfBounds ? 0. : result.w; @@ -1034,17 +1034,17 @@ vec2 packedUVfrom3D(int texNumR, int texNumC, vec4 b = getBAtOutCoords(); vec4 result = binaryOperation(a, b); - ${s} + ${a} setOutput(result); } - `}};function fa(e){let{inputs:t,backend:n}=e,{x:a}=t;return n.incRef(a.dataId),{dataId:a.dataId,shape:a.shape,dtype:a.dtype}}var mfe={kernelName:pl,backendName:"webgl",kernelFunc:fa};function ei(e){let{inputs:t,backend:n}=e,{real:a,imag:r}=t,s=n.makeTensorInfo(a.shape,"complex64"),i=n.texData.get(s.dataId),o=fa({inputs:{x:a},backend:n}),l=fa({inputs:{x:r},backend:n});return i.complexTensorInfos={real:o,imag:l},s}var gfe={kernelName:k1,backendName:"webgl",kernelFunc:ei},wE="return (a < 0.) ? b * a : a;",kE=` + `}};function mr(e){let{inputs:t,backend:n}=e,{x:r}=t;return n.incRef(r.dataId),{dataId:r.dataId,shape:r.shape,dtype:r.dtype}}var mfe={kernelName:hl,backendName:"webgl",kernelFunc:mr};function eo(e){let{inputs:t,backend:n}=e,{real:r,imag:s}=t,a=n.makeTensorInfo(r.shape,"complex64"),o=n.texData.get(a.dataId),i=mr({inputs:{x:r},backend:n}),l=mr({inputs:{x:s},backend:n});return o.complexTensorInfos={real:i,imag:l},a}var gfe={kernelName:Iy,backendName:"webgl",kernelFunc:eo},wE="return (a < 0.) ? b * a : a;",kE=` vec4 aLessThanZero = vec4(lessThan(a, vec4(0.))); return (aLessThanZero * (b * a)) + ((vec4(1.0) - aLessThanZero) * a); -`;function yfe(e){let{inputs:t,backend:n,attrs:a}=e,{x:r}=t,{alpha:s}=a,i=n.makeTensorInfo([],"float32",k.createScalarValue(s,"float32")),o=se().getBool("WEBGL_PACK_BINARY_OPERATIONS")?new pp(kE,r.shape,i.shape):new ku(wE,r.shape,i.shape),l=n.runWebGLProgram(o,[r,i],r.dtype);return n.disposeIntermediateTensorInfo(i),l}var Afe={kernelName:cl,backendName:"webgl",kernelFunc:yfe},IE="return (a < 0.) ? b * a : a;",SE=` +`;function yfe(e){let{inputs:t,backend:n,attrs:r}=e,{x:s}=t,{alpha:a}=r,o=n.makeTensorInfo([],"float32",k.createScalarValue(a,"float32")),i=ae().getBool("WEBGL_PACK_BINARY_OPERATIONS")?new hh(kE,s.shape,o.shape):new ku(wE,s.shape,o.shape),l=n.runWebGLProgram(i,[s,o],s.dtype);return n.disposeIntermediateTensorInfo(o),l}var Afe={kernelName:pl,backendName:"webgl",kernelFunc:yfe},IE="return (a < 0.) ? b * a : a;",SE=` vec4 aLessThanZero = vec4(lessThan(a, vec4(0.))); return (aLessThanZero * (b * a)) + ((vec4(1.0) - aLessThanZero) * a); -`;function xfe(e){let{inputs:t,backend:n}=e,{x:a,alpha:r}=t,s=se().getBool("WEBGL_PACK_BINARY_OPERATIONS")?new pp(SE,a.shape,r.shape):new ku(IE,a.shape,r.shape);return n.runWebGLProgram(s,[a,r],a.dtype)}var bfe={kernelName:Sl,backendName:"webgl",kernelFunc:xfe},NE="if (isnan(x)) return x;",vfe=` +`;function xfe(e){let{inputs:t,backend:n}=e,{x:r,alpha:s}=t,a=ae().getBool("WEBGL_PACK_BINARY_OPERATIONS")?new hh(SE,r.shape,s.shape):new ku(IE,r.shape,s.shape);return n.runWebGLProgram(a,[r,s],r.dtype)}var bfe={kernelName:Sl,backendName:"webgl",kernelFunc:xfe},TE="if (isnan(x)) return x;",vfe=` if (isnan(a)) return a; if (isnan(b)) return b; `,wfe=` @@ -1052,31 +1052,31 @@ vec2 packedUVfrom3D(int texNumR, int texNumC, result.g = isNaN.g > 0. ? NAN : result.g; result.b = isNaN.b > 0. ? NAN : result.b; result.a = isNaN.a > 0. ? NAN : result.a; -`;function ot({opSnippet:e,packedOpSnippet:t,cpuKernelImpl:n,dtype:a}){return({inputs:r,backend:s})=>{let{x:i}=r,o=s,l=a||i.dtype;if(o.shouldExecuteOnCPU([i])&&n!=null){let h=o.texData.get(i.dataId),p=n(h.values,l);return o.makeTensorInfo(i.shape,l,p)}let u=se().getBool("WEBGL_PACK_UNARY_OPERATIONS")&&t!=null,d;return u?d=new wu(i.shape,t):d=new Qs(i.shape,e),o.runWebGLProgram(d,[i],l)}}function Tn({opSnippet:e,packedOpSnippet:t,checkOutOfBounds:n=!1,supportsComplex:a=!1,cpuKernelImpl:r,dtype:s}){return({inputs:i,backend:o})=>{let{a:l,b:u}=i,d=o;if(a&&l.dtype==="complex64"){let m=d.texData.get(l.dataId),f=d.texData.get(u.dataId),[g,y]=[[m.complexTensorInfos.real,f.complexTensorInfos.real],[m.complexTensorInfos.imag,f.complexTensorInfos.imag]].map(x=>{let[v,b]=x,w={dataId:v.dataId,dtype:v.dtype,shape:l.shape},I={dataId:b.dataId,dtype:b.dtype,shape:u.shape},T=new ku(e,l.shape,u.shape);return d.runWebGLProgram(T,[w,I],Ga(v.dtype,b.dtype))}),A=ei({inputs:{real:g,imag:y},backend:d});return d.disposeIntermediateTensorInfo(g),d.disposeIntermediateTensorInfo(y),A}let h=s||Ga(l.dtype,u.dtype);if((l.dtype==="string"||u.dtype==="string"||d.shouldExecuteOnCPU([l,u]))&&r!=null){let m=d.texData.get(l.dataId).values,f=d.texData.get(u.dataId).values,g=l.dtype==="string"?M.fromUint8ToStringArray(m):m,y=l.dtype==="string"?M.fromUint8ToStringArray(f):f,[A,x]=r(l.shape,u.shape,g,y,h),v=d.makeTensorInfo(x,h),b=d.texData.get(v.dataId);return b.values=A,v}let p=se().getBool("WEBGL_PACK_BINARY_OPERATIONS")&&t!=null,c;return p?c=new pp(t,l.shape,u.shape,n):c=new ku(e,l.shape,u.shape),d.runWebGLProgram(c,[l,u],h)}}function j0(e,t=!1){if(e==="linear")return t?Qce:Kce;if(e==="relu")return t?tfe:Zce;if(e==="elu")return t?efe:Xce;if(e==="relu6")return t?nfe:Yce;if(e==="prelu")return t?SE:IE;if(e==="leakyrelu")return t?kE:wE;if(e==="sigmoid")return t?afe:Jce;throw new Error(`Activation ${e} has not been implemented for the WebGL backend.`)}var TE=class{constructor(e,t,n,a=!1,r=!1,s=!1,i=null,o=!1,l=!1){this.variableNames=["matrixA","matrixB"],this.packedInputs=!0,this.packedOutput=!0,this.outputShape=n;let u=a?e[1]:e[2],d=Math.ceil(u/2),h=a?"i * 2, rc.y":"rc.y, i * 2",p=r?"rc.z, i * 2":"i * 2, rc.z",c=a?["a.xxyy","a.zzww"]:["a.xxzz","a.yyww"],m=r?["b.xzxz","b.ywyw"]:["b.xyxy","b.zwzw"],f="",g="";i&&(o?f=`vec4 activation(vec4 a) { +`;function it({opSnippet:e,packedOpSnippet:t,cpuKernelImpl:n,dtype:r}){return({inputs:s,backend:a})=>{let{x:o}=s,i=a,l=r||o.dtype;if(i.shouldExecuteOnCPU([o])&&n!=null){let d=i.texData.get(o.dataId),h=n(d.values,l);return i.makeTensorInfo(o.shape,l,h)}let u=ae().getBool("WEBGL_PACK_UNARY_OPERATIONS")&&t!=null,c;return u?c=new wu(o.shape,t):c=new Qa(o.shape,e),i.runWebGLProgram(c,[o],l)}}function Nn({opSnippet:e,packedOpSnippet:t,checkOutOfBounds:n=!1,supportsComplex:r=!1,cpuKernelImpl:s,dtype:a}){return({inputs:o,backend:i})=>{let{a:l,b:u}=o,c=i;if(r&&l.dtype==="complex64"){let f=c.texData.get(l.dataId),m=c.texData.get(u.dataId),[g,y]=[[f.complexTensorInfos.real,m.complexTensorInfos.real],[f.complexTensorInfos.imag,m.complexTensorInfos.imag]].map(x=>{let[b,v]=x,w={dataId:b.dataId,dtype:b.dtype,shape:l.shape},I={dataId:v.dataId,dtype:v.dtype,shape:u.shape},T=new ku(e,l.shape,u.shape);return c.runWebGLProgram(T,[w,I],qr(b.dtype,v.dtype))}),A=eo({inputs:{real:g,imag:y},backend:c});return c.disposeIntermediateTensorInfo(g),c.disposeIntermediateTensorInfo(y),A}let d=a||qr(l.dtype,u.dtype);if((l.dtype==="string"||u.dtype==="string"||c.shouldExecuteOnCPU([l,u]))&&s!=null){let f=c.texData.get(l.dataId).values,m=c.texData.get(u.dataId).values,g=l.dtype==="string"?_.fromUint8ToStringArray(f):f,y=l.dtype==="string"?_.fromUint8ToStringArray(m):m,[A,x]=s(l.shape,u.shape,g,y,d),b=c.makeTensorInfo(x,d),v=c.texData.get(b.dataId);return v.values=A,b}let h=ae().getBool("WEBGL_PACK_BINARY_OPERATIONS")&&t!=null,p;return h?p=new hh(t,l.shape,u.shape,n):p=new ku(e,l.shape,u.shape),c.runWebGLProgram(p,[l,u],d)}}function Gm(e,t=!1){if(e==="linear")return t?Qpe:Kpe;if(e==="relu")return t?tfe:Zpe;if(e==="elu")return t?efe:Xpe;if(e==="relu6")return t?nfe:Ype;if(e==="prelu")return t?SE:IE;if(e==="leakyrelu")return t?kE:wE;if(e==="sigmoid")return t?rfe:Jpe;throw new Error(`Activation ${e} has not been implemented for the WebGL backend.`)}var NE=class{constructor(e,t,n,r=!1,s=!1,a=!1,o=null,i=!1,l=!1){this.variableNames=["matrixA","matrixB"],this.packedInputs=!0,this.packedOutput=!0,this.outputShape=n;let u=r?e[1]:e[2],c=Math.ceil(u/2),d=r?"i * 2, rc.y":"rc.y, i * 2",h=s?"rc.z, i * 2":"i * 2, rc.z",p=r?["a.xxyy","a.zzww"]:["a.xxzz","a.yyww"],f=s?["b.xzxz","b.ywyw"]:["b.xyxy","b.zwzw"],m="",g="";o&&(i?m=`vec4 activation(vec4 a) { vec4 b = getPreluActivationWeightsAtOutCoords(); - ${i} - }`:l?f=`vec4 activation(vec4 a) { + ${o} + }`:l?m=`vec4 activation(vec4 a) { vec4 b = getLeakyreluAlphaAtOutCoords(); - ${i} - }`:f=`vec4 activation(vec4 x) { - ${i} - }`,g="result = activation(result);");let y=s?"result += getBiasAtOutCoords();":"";s&&this.variableNames.push("bias"),o&&this.variableNames.push("preluActivationWeights"),l&&this.variableNames.push("leakyreluAlpha");let A="rc.x",x="rc.x";e[0]`The new shape (${l}) has ${u} elements and the old shape (${r.shape}) has ${o} elements. The new shape and old shape must have the same number of elements.`);let d=i.texData.get(r.dataId);return d.isPacked&&!up(r.shape,l)&&!(d.texture!==null&&up(d.shape,l))?Ife(r,l,i):(i.incRef(r.dataId),{dataId:r.dataId,shape:l,dtype:r.dtype})}var Sfe={kernelName:Qd,backendName:"webgl",kernelFunc:be},$E=class{constructor(e,t){this.variableNames=["x"];let{windowSize:n,batchSize:a,inSize:r,outSize:s}=e;this.outputShape=[a,s];let i=Math.floor(n/4)*4,o=n%4,l="sumValue += dot(values, ones);";if(t!=null){let d=1/t;l=`sumValue += dot(values * ${k.isInt(d)?d.toPrecision(2):d}, ones);`}let u="";r%n>0&&(u=` - if (inIdx < 0 || inIdx >= ${r}) { + `}},$E="return a * b;";function ib(e){let{inputs:t,backend:n}=e,{a:r,b:s}=t,a=_.upcastType(r.dtype,s.dtype);if(r.dtype==="complex64"){let i=n.texData.get(r.dataId),l=n.texData.get(s.dataId),u=new EE(CE.REAL,r.shape,s.shape),c=new EE(CE.IMAG,r.shape,s.shape),d=[{dataId:i.complexTensorInfos.real.dataId,dtype:i.complexTensorInfos.real.dtype,shape:r.shape},{dataId:i.complexTensorInfos.imag.dataId,dtype:i.complexTensorInfos.imag.dtype,shape:r.shape},{dataId:l.complexTensorInfos.real.dataId,dtype:l.complexTensorInfos.real.dtype,shape:s.shape},{dataId:l.complexTensorInfos.imag.dataId,dtype:l.complexTensorInfos.imag.dtype,shape:s.shape}],h=n.runWebGLProgram(u,d,"float32"),p=n.runWebGLProgram(c,d,"float32"),f=eo({inputs:{real:h,imag:p},backend:n});return n.disposeIntermediateTensorInfo(h),n.disposeIntermediateTensorInfo(p),f}if(n.shouldExecuteOnCPU([r,s])){let i=n.texData.get(r.dataId),l=n.texData.get(s.dataId),[u,c]=bpe(r.shape,s.shape,i.values,l.values,a),d=n.makeTensorInfo(c,a),h=n.texData.get(d.dataId);return h.values=u,d}let o;return ae().getBool("WEBGL_PACK_BINARY_OPERATIONS")?o=new hh($E,r.shape,s.shape):o=new ku($E,r.shape,s.shape),n.runWebGLProgram(o,[r,s],a)}var kfe={kernelName:Mo,backendName:"webgl",kernelFunc:ib};function Ife(e,t,n){let r=[gi(e.shape),...yi(e.shape)],s={dtype:e.dtype,shape:r,dataId:e.dataId},a=[gi(t),...yi(t)],o=new fE(a,r),i=!0,l=n.runWebGLProgram(o,[s],e.dtype,null,i);return{dataId:l.dataId,shape:t,dtype:l.dtype}}function ve(e){let{inputs:t,backend:n,attrs:r}=e,{x:s}=t,{shape:a}=r,o=n,i=k.sizeFromShape(s.shape),l=k.inferFromImplicitShape(a,i),u=k.sizeFromShape(l);k.assert(i===u,()=>`The new shape (${l}) has ${u} elements and the old shape (${s.shape}) has ${i} elements. The new shape and old shape must have the same number of elements.`);let c=o.texData.get(s.dataId);return c.isPacked&&!uh(s.shape,l)&&!(c.texture!==null&&uh(c.shape,l))?Ife(s,l,o):(o.incRef(s.dataId),{dataId:s.dataId,shape:l,dtype:s.dtype})}var Sfe={kernelName:Qc,backendName:"webgl",kernelFunc:ve},_E=class{constructor(e,t){this.variableNames=["x"];let{windowSize:n,batchSize:r,inSize:s,outSize:a}=e;this.outputShape=[r,a];let o=Math.floor(n/4)*4,i=n%4,l="sumValue += dot(values, ones);";if(t!=null){let c=1/t;l=`sumValue += dot(values * ${k.isInt(c)?c.toPrecision(2):c}, ones);`}let u="";s%n>0&&(u=` + if (inIdx < 0 || inIdx >= ${s}) { return 0.0; } `),this.userCode=` @@ -1124,7 +1124,7 @@ vec2 packedUVfrom3D(int texNumR, int texNumC, float sumValue = 0.0; - for (int i = 0; i < ${i}; i += 4) { + for (int i = 0; i < ${o}; i += 4) { int inIdx = inOffset + i; vec4 values = vec4( getValue(batch, inIdx), @@ -1136,18 +1136,18 @@ vec2 packedUVfrom3D(int texNumR, int texNumC, ${l} } - int inIdx = inOffset + ${i}; - if (${o===1}) { + int inIdx = inOffset + ${o}; + if (${i===1}) { vec4 values = vec4(getValue(batch, inIdx), 0.0, 0.0, 0.0); ${l} - } else if (${o===2}) { + } else if (${i===2}) { vec4 values = vec4( getValue(batch, inIdx), getValue(batch, inIdx + 1), 0.0, 0.0); ${l} - } else if (${o===3}) { + } else if (${i===3}) { vec4 values = vec4( getValue(batch, inIdx), getValue(batch, inIdx + 1), @@ -1157,40 +1157,40 @@ vec2 packedUVfrom3D(int texNumR, int texNumC, } setOutput(sumValue); } - `}},Nfe=class{constructor(e,t){this.variableNames=["x"];let{windowSize:n,batchSize:a,inSize:r,outSize:s}=e;this.outputShape=[a,s];let i="0.0",o="";t==="prod"?i="1.0":t==="min"?(i="1.0 / 1e-20",o="min"):t==="max"&&(i="-1.0 / 1e-20",o="max");let l=`${t}(${t}(${t}(minMaxValue[0], minMaxValue[1]), minMaxValue[2]), minMaxValue[3])`;t==="sum"?l="sumValue":t==="prod"?l="prodValue":t==="all"?l="allValue":t==="any"&&(l="anyValue");let u=Math.floor(n/4)*4,d=n%4,h=` + `}},Tfe=class{constructor(e,t){this.variableNames=["x"];let{windowSize:n,batchSize:r,inSize:s,outSize:a}=e;this.outputShape=[r,a];let o="0.0",i="";t==="prod"?o="1.0":t==="min"?(o="1.0 / 1e-20",i="min"):t==="max"&&(o="-1.0 / 1e-20",i="max");let l=`${t}(${t}(${t}(minMaxValue[0], minMaxValue[1]), minMaxValue[2]), minMaxValue[3])`;t==="sum"?l="sumValue":t==="prod"?l="prodValue":t==="all"?l="allValue":t==="any"&&(l="anyValue");let u=Math.floor(n/4)*4,c=n%4,d=` if (${t==="sum"}) { sumValue += dot(values, ones); } else if (${t==="prod"}) { vec2 tmp = vec2(values[0], values[1]) * vec2(values[2], values[3]); prodValue *= tmp[0] * tmp[1]; } else { - minMaxValue = ${o}(values, minMaxValue); + minMaxValue = ${i}(values, minMaxValue); if (${t==="min"} || ${t==="max"}) { - minMaxValue = ${o}(values, minMaxValue); + minMaxValue = ${i}(values, minMaxValue); bvec4 isNaN = isnan(values); if (isNaN.r || isNaN.g || isNaN.b || isNaN.a) { minMaxValue = vec4(NAN); } } } - `,p="vec4";t==="all"?(i="1.0",h=` + `,h="vec4";t==="all"?(o="1.0",d=` bool reducedAllValue = all(values); float floatedReducedAllValue = float(reducedAllValue); allValue = float(allValue >= 1.0 && floatedReducedAllValue >= 1.0); - `,p="bvec4"):t==="any"&&(i="0.0",h=` + `,h="bvec4"):t==="any"&&(o="0.0",d=` bool reducedAnyValue = any(values); float floatedReducedAnyValue = float(reducedAnyValue); anyValue = float(anyValue >= 1.0 || floatedReducedAnyValue >= 1.0); - `,p="bvec4");let c="";r%n>0&&(c=` - if (inIdx < 0 || inIdx >= ${r}) { + `,h="bvec4");let p="";s%n>0&&(p=` + if (inIdx < 0 || inIdx >= ${s}) { return initializationValue; } `),this.userCode=` - const float initializationValue = ${i}; + const float initializationValue = ${o}; const vec4 ones = vec4(1.0, 1.0, 1.0, 1.0); float getValue(int batch, int inIdx) { - ${c} + ${p} return getX(batch, inIdx); } @@ -1200,7 +1200,7 @@ vec2 packedUVfrom3D(int texNumR, int texNumC, int outIdx = coords[1]; int inOffset = outIdx * ${n}; - vec4 minMaxValue = vec4(${i}); + vec4 minMaxValue = vec4(${o}); float prodValue = 1.0; float sumValue = 0.0; float allValue = 1.0; @@ -1208,161 +1208,161 @@ vec2 packedUVfrom3D(int texNumR, int texNumC, for (int i = 0; i < ${u}; i += 4) { int inIdx = inOffset + i; - ${p} values = ${p}( + ${h} values = ${h}( getValue(batch, inIdx), getValue(batch, inIdx + 1), getValue(batch, inIdx + 2), getValue(batch, inIdx + 3) ); - ${h} + ${d} } int inIdx = inOffset + ${u}; - if (${d===1}) { - ${p} values = ${p}( + if (${c===1}) { + ${h} values = ${h}( getValue(batch, inIdx), initializationValue, initializationValue, initializationValue ); - ${h} - } else if (${d===2}) { - ${p} values = ${p}( + ${d} + } else if (${c===2}) { + ${h} values = ${h}( getValue(batch, inIdx), getValue(batch, inIdx + 1), initializationValue, initializationValue ); - ${h} - } else if (${d===3}) { - ${p} values = ${p}( + ${d} + } else if (${c===3}) { + ${h} values = ${h}( getValue(batch, inIdx), getValue(batch, inIdx + 1), getValue(batch, inIdx + 2), initializationValue ); - ${h} + ${d} } setOutput(${l}); } - `}};function Tfe(e){let t=[];for(;t.length===0||t[t.length-1].outSize!==1;){let n=t.length?t[t.length-1].outSize:e[1],a=M.computeOptimalWindowSize(n);t.push({inSize:n,windowSize:a,outSize:Math.ceil(n/a)})}return t}function bo(e,t,n,a){let r=Tfe(e.shape),s=e;for(let i=0;i6)throw Error(`Transpose for rank ${t} is not yet supported`);let n=["resRC.x","resRC.y","resRC.z","resRC.w","resRC.u","resRC.v"],a=new Array(t);for(let r=0;r6)throw Error(`Packed transpose for rank ${this.rank} is not yet supported.`);let a=kt(this.rank),r=cE("rc",this.rank),s=new Array(this.rank);for(let u=0;u6)throw Error(`Transpose for rank ${t} is not yet supported`);let n=["resRC.x","resRC.y","resRC.z","resRC.w","resRC.u","resRC.v"],r=new Array(t);for(let s=0;s6)throw Error(`Packed transpose for rank ${this.rank} is not yet supported.`);let r=It(this.rank),s=pE("rc",this.rank),a=new Array(this.rank);for(let u=0;u=2&&d>=2&&x,()=>`Error in matMul: the input batch dimensions must either be the same or at least one input batch dimension must be 1. Got input batch dimensions of (${f}) and (${g}).`);let v=(y>A?e.shape.slice(0,-2):t.shape.slice(0,-2)).concat([c,m]);k.assert(h===p,()=>`Error in matMul: inner shapes (${h}) and (${p}) of Tensors with shapes ${e.shape} and ${t.shape} and transposeA=${n} and transposeB=${a} must match.`);let b=n?[y,h,c]:[y,c,h],w=a?[A,m,p]:[A,p,m],I=be({inputs:{x:e},backend:r,attrs:{shape:b}}),T=be({inputs:{x:t},backend:r,attrs:{shape:w}}),C=[I,T],z=Math.max(y,A),$=n?I.shape[1]:I.shape[2],S=s!=null,D=i!=null,_=l==="leakyrelu",W=l!=null?j0(l,!0):null,X=S||D||_||W!=null,q;if((c===1||m===1)&&$>RE&&X===!1){let ee=I,ie=T;n&&(ee=Vn({inputs:{x:I},backend:r,attrs:{perm:[0,2,1]}}),C.push(ee)),a&&(ie=Vn({inputs:{x:T},backend:r,attrs:{perm:[0,2,1]}}),C.push(ie));let ae=m!==1,de=m===1,te=ee;ae&&(te=be({inputs:{x:ee},backend:r,attrs:{shape:[z,$,1]}}),C.push(te));let ce=m===1?2:1,he=ie;de&&(he=be({inputs:{x:ie},backend:r,attrs:{shape:[z,1,$]}}),C.push(he));let ve=ob({inputs:{a:te,b:he},backend:r});q=G0({inputs:{x:ve},backend:r,attrs:{axis:ce,keepDims:!0}}),C.push(ve)}else{let ee=Ga(e.dtype,t.dtype),ie=new TE(b,w,[z,c,m],n,a,S,W,D,_),ae=[I,T];if(s!=null&&ae.push(s),D&&ae.push(i),_){let de=r.makeTensorInfo([],"float32",k.createScalarValue(o,"float32"));ae.push(de),C.push(de)}q=r.runWebGLProgram(ie,ae,ee)}let Q=be({inputs:{x:q},backend:r,attrs:{shape:v}});C.push(q);for(let ee of C)r.disposeIntermediateTensorInfo(ee);return Q}function Ofe(e){let{inputs:t,backend:n,attrs:a}=e,{a:r,b:s,bias:i,preluActivationWeights:o}=t,{transposeA:l,transposeB:u,activation:d,leakyreluAlpha:h}=a;return q0({a:r,b:s,transposeA:l,transposeB:u,backend:n,bias:i,preluActivationWeights:o,leakyreluAlpha:h,activation:d})}var Dfe={kernelName:Ll,backendName:"webgl",kernelFunc:Ofe},FE="return abs(x);";function _fe(e){let{inputs:t,backend:n}=e,{x:a}=t;if(n.shouldExecuteOnCPU([a])&&a.dtype!=="complex64"){let s=n.texData.get(a.dataId),i=hE(s.values);return n.makeTensorInfo(a.shape,a.dtype,i)}let r;return se().getBool("WEBGL_PACK_UNARY_OPERATIONS")?r=new wu(a.shape,FE):r=new Qs(a.shape,FE),n.runWebGLProgram(r,[a],a.dtype)}var zfe={kernelName:xd,backendName:"webgl",kernelFunc:_fe},Pfe=gr+` + `}};function jm(e,t,n){let r=ae().getBool("WEBGL_PACK_ARRAY_OPERATIONS")?new $fe(e.shape,t):new Cfe(e.shape,t);return n.runWebGLProgram(r,[e],e.dtype)}function _fe(e,t,n,r){let s=t,a=e.shape.length,o=k.parseAxisParam(s,e.shape),i=o,l=_.getAxesPermutation(i,a),u=l!=null,c=e;u&&(c=jm(e,l,r),i=_.getInnerMostAxes(i.length,a)),_.assertAxesAreInnerMostDims("sum",i,a);let[d,h]=_.computeOutAndReduceShapes(c.shape,i),p=d;n&&(p=_.expandShapeToKeepDim(d,o));let f=k.sizeFromShape(h),g=k.sizeFromShape(e.shape)/f,y=ve({inputs:{x:c},attrs:{shape:[g,f]},backend:r}),A=pA(e.dtype),x=bi(y,A,"sum",r),b=ve({inputs:{x},attrs:{shape:p},backend:r});return r.disposeIntermediateTensorInfo(y),r.disposeIntermediateTensorInfo(x),u&&r.disposeIntermediateTensorInfo(c),b}function qm(e){let{inputs:t,backend:n,attrs:r}=e,{x:s}=t,{axis:a,keepDims:o}=r;return _fe(s,a,o,n)}var Rfe={kernelName:Fl,backendName:"webgl",kernelFunc:qm};function Un(e){let{inputs:t,backend:n,attrs:r}=e,{x:s}=t,{perm:a}=r,o=n,i=s.shape.length,l=new Array(i);for(let c=0;c=2&&c>=2&&x,()=>`Error in matMul: the input batch dimensions must either be the same or at least one input batch dimension must be 1. Got input batch dimensions of (${m}) and (${g}).`);let v=(y>A?e.shape.slice(0,-2):t.shape.slice(0,-2)).concat([p,f]);k.assert(d===h,()=>`Error in matMul: inner shapes (${d}) and (${h}) of Tensors with shapes ${e.shape} and ${t.shape} and transposeA=${n} and transposeB=${r} must match.`);let w=n?[y,d,p]:[y,p,d],I=r?[A,f,h]:[A,h,f],T=ve({inputs:{x:e},backend:s,attrs:{shape:w}}),C=ve({inputs:{x:t},backend:s,attrs:{shape:I}}),M=[T,C],$=Math.max(y,A),R=n?T.shape[1]:T.shape[2],N=a!=null,F=o!=null,B=l==="leakyrelu",j=l!=null?Gm(l,!0):null,X=N||F||B||j!=null,Y;if((p===1||f===1)&&R>RE&&X===!1){let oe=T,se=C;n&&(oe=Un({inputs:{x:T},backend:s,attrs:{perm:[0,2,1]}}),M.push(oe)),r&&(se=Un({inputs:{x:C},backend:s,attrs:{perm:[0,2,1]}}),M.push(se));let ie=f!==1,ne=f===1,de=oe;ie&&(de=ve({inputs:{x:oe},backend:s,attrs:{shape:[$,R,1]}}),M.push(de));let he=f===1?2:1,ge=se;ne&&(ge=ve({inputs:{x:se},backend:s,attrs:{shape:[$,1,R]}}),M.push(ge));let be=ib({inputs:{a:de,b:ge},backend:s});Y=qm({inputs:{x:be},backend:s,attrs:{axis:he,keepDims:!0}}),M.push(be)}else{let oe=qr(e.dtype,t.dtype),se=new NE(w,I,[$,p,f],n,r,N,j,F,B),ie=[T,C];if(a!=null&&ie.push(a),F&&ie.push(o),B){let ne=s.makeTensorInfo([],"float32",k.createScalarValue(i,"float32"));ie.push(ne),M.push(ne)}Y=s.runWebGLProgram(se,ie,oe)}let ee=ve({inputs:{x:Y},backend:s,attrs:{shape:v}});M.push(Y);for(let oe of M)s.disposeIntermediateTensorInfo(oe);return ee}function Ffe(e){let{inputs:t,backend:n,attrs:r}=e,{a:s,b:a,bias:o,preluActivationWeights:i}=t,{transposeA:l,transposeB:u,activation:c,leakyreluAlpha:d}=r;return Km({a:s,b:a,transposeA:l,transposeB:u,backend:n,bias:o,preluActivationWeights:i,leakyreluAlpha:d,activation:c})}var Mfe={kernelName:Ll,backendName:"webgl",kernelFunc:Ffe},DE="return abs(x);";function Ofe(e){let{inputs:t,backend:n}=e,{x:r}=t;if(n.shouldExecuteOnCPU([r])&&r.dtype!=="complex64"){let a=n.texData.get(r.dataId),o=dE(a.values);return n.makeTensorInfo(r.shape,r.dtype,o)}let s;return ae().getBool("WEBGL_PACK_UNARY_OPERATIONS")?s=new wu(r.shape,DE):s=new Qa(r.shape,DE),n.runWebGLProgram(s,[r],r.dtype)}var Pfe={kernelName:xc,backendName:"webgl",kernelFunc:Ofe},zfe=ys+` if (abs(x) > 1.) { return NAN; } return acos(x); -`,Lfe=ot({opSnippet:Pfe}),Wfe={kernelName:bd,backendName:"webgl",kernelFunc:Lfe},Bfe=gr+` +`,Lfe=it({opSnippet:zfe}),Bfe={kernelName:bc,backendName:"webgl",kernelFunc:Lfe},Wfe=ys+` if (x < 1.0) return NAN; -return log(x + sqrt(x * x - 1.0));`,Vfe=ot({opSnippet:Bfe}),Ufe={kernelName:vd,backendName:"webgl",kernelFunc:Vfe},OE="return a + b;",jfe=Tn({opSnippet:OE,packedOpSnippet:OE,supportsComplex:!0,cpuKernelImpl:tce}),Hfe={kernelName:Os,backendName:"webgl",kernelFunc:jfe},Gfe=class{constructor(e,t){this.outputShape=[],this.outputShape=e,this.variableNames=t.map((r,s)=>`T${s}`);let n=[];this.variableNames.forEach(r=>{n.push(`float v${r} = get${r}AtOutCoords();`)});let a=this.variableNames.map(r=>`v${r}`).join(" + ");this.userCode=` +return log(x + sqrt(x * x - 1.0));`,Vfe=it({opSnippet:Wfe}),Ufe={kernelName:vc,backendName:"webgl",kernelFunc:Vfe},FE="return a + b;",Hfe=Nn({opSnippet:FE,packedOpSnippet:FE,supportsComplex:!0,cpuKernelImpl:tpe}),Gfe={kernelName:Fa,backendName:"webgl",kernelFunc:Hfe},jfe=class{constructor(e,t){this.outputShape=[],this.outputShape=e,this.variableNames=t.map((s,a)=>`T${a}`);let n=[];this.variableNames.forEach(s=>{n.push(`float v${s} = get${s}AtOutCoords();`)});let r=this.variableNames.map(s=>`v${s}`).join(" + ");this.userCode=` void main() { ${n.join(` `)} - float result = ${a}; + float result = ${r}; setOutput(result); } - `}},qfe=class{constructor(e,t){this.outputShape=[],this.packedInputs=!0,this.packedOutput=!0,this.outputShape=e,this.variableNames=t.map((r,s)=>`T${s}`);let n=[];this.variableNames.forEach(r=>{n.push(`vec4 v${r} = get${r}AtOutCoords();`)});let a=this.variableNames.map(r=>`v${r}`).join(" + ");this.userCode=` + `}},qfe=class{constructor(e,t){this.outputShape=[],this.packedInputs=!0,this.packedOutput=!0,this.outputShape=e,this.variableNames=t.map((s,a)=>`T${a}`);let n=[];this.variableNames.forEach(s=>{n.push(`vec4 v${s} = get${s}AtOutCoords();`)});let r=this.variableNames.map(s=>`v${s}`).join(" + ");this.userCode=` void main() { ${n.join(` `)} - vec4 result = ${a}; + vec4 result = ${r}; setOutput(result); } - `}};function K0(e){let{inputs:t,backend:n}=e,a=t;if(a.length===1)return fa({inputs:{x:a[0]},backend:n});if(a.length>se().get("WEBGL_MAX_TEXTURES_IN_SHADER")){let o=Math.floor(a.length/2),l=K0({inputs:a.slice(0,o),backend:n}),u=K0({inputs:a.slice(o),backend:n});return K0({inputs:[l,u],backend:n})}let r=a.map(o=>o.dtype).reduce((o,l)=>Ga(o,l)),s=a.map(o=>o.shape),i=se().getBool("WEBGL_PACK")?new qfe(a[0].shape,s):new Gfe(a[0].shape,s);return n.runWebGLProgram(i,a,r)}var Kfe={kernelName:Zo,backendName:"webgl",kernelFunc:K0};function Xfe(e){let{inputs:t,backend:n,attrs:a}=e,{x:r}=t,{axis:s,keepDims:i}=a,o=r.shape.length,l=k.parseAxisParam(s,r.shape),u=l,d=M.getAxesPermutation(u,o),h=r;d!=null&&(h=Vn({inputs:{x:r},backend:n,attrs:{perm:d}}),u=M.getInnerMostAxes(u.length,o)),M.assertAxesAreInnerMostDims("all",u,o);let[p,c]=M.computeOutAndReduceShapes(h.shape,u),m=k.sizeFromShape(c),f=be({inputs:{x:h},backend:n,attrs:{shape:[-1,m]}}),g=bo(f,f.dtype,"all",n),y;if(i){let A=M.expandShapeToKeepDim(p,l);y=be({inputs:{x:g},backend:n,attrs:{shape:A}})}else y=be({inputs:{x:g},backend:n,attrs:{shape:p}});return n.disposeIntermediateTensorInfo(f),n.disposeIntermediateTensorInfo(g),d!=null&&n.disposeIntermediateTensorInfo(h),y}var Zfe={kernelName:wd,backendName:"webgl",kernelFunc:Xfe};function Yfe(e){let{inputs:t,backend:n,attrs:a}=e,{x:r}=t,{axis:s,keepDims:i}=a,o=r.shape.length,l=k.parseAxisParam(s,r.shape),u=l,d=M.getAxesPermutation(u,o),h=r;d!=null&&(h=Vn({inputs:{x:r},backend:n,attrs:{perm:d}}),u=M.getInnerMostAxes(u.length,o)),M.assertAxesAreInnerMostDims("any",u,o);let[p,c]=M.computeOutAndReduceShapes(h.shape,u),m=k.sizeFromShape(c),f=be({inputs:{x:h},backend:n,attrs:{shape:[-1,m]}}),g=bo(f,f.dtype,"any",n),y;if(i){let A=M.expandShapeToKeepDim(p,l);y=be({inputs:{x:g},backend:n,attrs:{shape:A}})}else y=be({inputs:{x:g},backend:n,attrs:{shape:p}});return n.disposeIntermediateTensorInfo(f),n.disposeIntermediateTensorInfo(g),d!=null&&n.disposeIntermediateTensorInfo(h),y}var Jfe={kernelName:kd,backendName:"webgl",kernelFunc:Yfe},Qfe=class{constructor(e,t,n){this.variableNames=["A"];let{windowSize:a,batchSize:r,outSize:s}=e;n||this.variableNames.push("bestIndicesA"),this.outputShape=[r,s];let i=t==="max"?">":"<",o=n?"inOffset + i;":"round(getBestIndicesA(batch, inOffset + i));";this.userCode=` + `}};function Xm(e){let{inputs:t,backend:n}=e,r=t;if(r.length===1)return mr({inputs:{x:r[0]},backend:n});if(r.length>ae().get("WEBGL_MAX_TEXTURES_IN_SHADER")){let l=Math.floor(r.length/2),u=Xm({inputs:r.slice(0,l),backend:n}),c=Xm({inputs:r.slice(l),backend:n});return Xm({inputs:[u,c],backend:n})}let s=r.map(l=>l.dtype).reduce((l,u)=>qr(l,u)),a=r.map(l=>l.shape),i=ae().getBool("WEBGL_PACK")?new qfe(r[0].shape,a):new jfe(r[0].shape,a);return n.runWebGLProgram(i,r,s)}var Kfe={kernelName:Zi,backendName:"webgl",kernelFunc:Xm};function Xfe(e){let{inputs:t,backend:n,attrs:r}=e,{x:s}=t,{axis:a,keepDims:o}=r,i=s.shape.length,l=k.parseAxisParam(a,s.shape),u=l,c=_.getAxesPermutation(u,i),d=s;c!=null&&(d=Un({inputs:{x:s},backend:n,attrs:{perm:c}}),u=_.getInnerMostAxes(u.length,i)),_.assertAxesAreInnerMostDims("all",u,i);let[h,p]=_.computeOutAndReduceShapes(d.shape,u),f=k.sizeFromShape(p),m=ve({inputs:{x:d},backend:n,attrs:{shape:[-1,f]}}),g=bi(m,m.dtype,"all",n),y;if(o){let A=_.expandShapeToKeepDim(h,l);y=ve({inputs:{x:g},backend:n,attrs:{shape:A}})}else y=ve({inputs:{x:g},backend:n,attrs:{shape:h}});return n.disposeIntermediateTensorInfo(m),n.disposeIntermediateTensorInfo(g),c!=null&&n.disposeIntermediateTensorInfo(d),y}var Zfe={kernelName:wc,backendName:"webgl",kernelFunc:Xfe};function Yfe(e){let{inputs:t,backend:n,attrs:r}=e,{x:s}=t,{axis:a,keepDims:o}=r,i=s.shape.length,l=k.parseAxisParam(a,s.shape),u=l,c=_.getAxesPermutation(u,i),d=s;c!=null&&(d=Un({inputs:{x:s},backend:n,attrs:{perm:c}}),u=_.getInnerMostAxes(u.length,i)),_.assertAxesAreInnerMostDims("any",u,i);let[h,p]=_.computeOutAndReduceShapes(d.shape,u),f=k.sizeFromShape(p),m=ve({inputs:{x:d},backend:n,attrs:{shape:[-1,f]}}),g=bi(m,m.dtype,"any",n),y;if(o){let A=_.expandShapeToKeepDim(h,l);y=ve({inputs:{x:g},backend:n,attrs:{shape:A}})}else y=ve({inputs:{x:g},backend:n,attrs:{shape:h}});return n.disposeIntermediateTensorInfo(m),n.disposeIntermediateTensorInfo(g),c!=null&&n.disposeIntermediateTensorInfo(d),y}var Jfe={kernelName:kc,backendName:"webgl",kernelFunc:Yfe},Qfe=class{constructor(e,t,n){this.variableNames=["A"];let{windowSize:r,batchSize:s,outSize:a}=e;n||this.variableNames.push("bestIndicesA"),this.outputShape=[s,a];let o=t==="max"?">":"<",i=n?"inOffset + i;":"round(getBestIndicesA(batch, inOffset + i));";this.userCode=` void main() { ivec2 coords = getOutputCoords(); int batch = coords[0]; int outIdx = coords[1]; - int inOffset = outIdx * ${a}; + int inOffset = outIdx * ${r}; int bestIndex = inOffset; float bestValue = getA(batch, bestIndex); - for (int i = 0; i < ${a}; i++) { - int inIdx = ${o}; + for (int i = 0; i < ${r}; i++) { + int inIdx = ${i}; float candidate = getA(batch, inIdx); - if (candidate ${i} bestValue) { + if (candidate ${o} bestValue) { bestValue = candidate; bestIndex = inIdx; } } setOutput(float(bestIndex)); } - `}},e0e=class{constructor(e,t,n,a){this.variableNames=["A"],this.packedInputs=!0,this.packedOutput=!0,k.assert(e.length>2,()=>`Packed arg${n.charAt(0).toUpperCase()+n.slice(1)} supports only inputs with rank above 2.`);let r=e[e.length-1],s=Math.ceil(r/t);this.outputShape=e.slice(0,-1),s>1&&this.outputShape.push(s),a||this.variableNames.push("bestIndicesA");let i=this.outputShape,o=i.length,l=kt(o),u=Bn("coords",o),d,h;if(s===1){h=o+1;let I=kt(h);d=` + `}},eme=class{constructor(e,t,n,r){this.variableNames=["A"],this.packedInputs=!0,this.packedOutput=!0,k.assert(e.length>2,()=>`Packed arg${n.charAt(0).toUpperCase()+n.slice(1)} supports only inputs with rank above 2.`);let s=e[e.length-1],a=Math.ceil(s/t);this.outputShape=e.slice(0,-1),a>1&&this.outputShape.push(a),r||this.variableNames.push("bestIndicesA");let o=this.outputShape,i=o.length,l=It(i),u=Vn("coords",i),c,d;if(a===1){d=i+1;let I=It(d);c=` ${I} sourceLocR = ${I}(${u.join()}, 0); - ++${u[o-1]}; + ++${u[i-1]}; ${I} sourceLocG = ${I}(${u.join()}, 0); - ++${u[o-2]}; + ++${u[i-2]}; ${I} sourceLocA = ${I}(${u.join()}, 0); - --${u[o-1]}; + --${u[i-1]}; ${I} sourceLocB = ${I}(${u.join()}, 0); - --${u[o-2]};`}else h=o,d=` + --${u[i-2]};`}else d=i,c=` ${l} sourceLocR = coords; - ++${u[o-1]}; + ++${u[i-1]}; ${l} sourceLocG = coords; - ++${u[o-2]}; + ++${u[i-2]}; ${l} sourceLocA = coords; - --${u[o-1]}; + --${u[i-1]}; ${l} sourceLocB = coords; - --${u[o-2]};`;let p=["x","y","z","w","u","v"].slice(0,h),c="."+p[h-1],m=p.map(I=>"int "+I),f=Bn("sourceLocR",h-1).concat("inIdx.r"),g=Bn("sourceLocG",h-1).concat("inIdx.g"),y=Bn("sourceLocB",h-1).concat("inIdx.b"),A=Bn("sourceLocA",h-1).concat("inIdx.a"),x=n==="max"?"greaterThan":"lessThan",v=a?"":` - inIdx = round(vec4(getBestIndicesAChannel(${f.join()}), + --${u[i-2]};`;let h=["x","y","z","w","u","v"].slice(0,d),p="."+h[d-1],f=h.map(I=>"int "+I),m=Vn("sourceLocR",d-1).concat("inIdx.r"),g=Vn("sourceLocG",d-1).concat("inIdx.g"),y=Vn("sourceLocB",d-1).concat("inIdx.b"),A=Vn("sourceLocA",d-1).concat("inIdx.a"),x=n==="max"?"greaterThan":"lessThan",b=r?"":` + inIdx = round(vec4(getBestIndicesAChannel(${m.join()}), getBestIndicesAChannel(${g.join()}), getBestIndicesAChannel(${y.join()}), - getBestIndicesAChannel(${A.join()})));`,b=`vec4( - getAChannel(${f.join()}), + getBestIndicesAChannel(${A.join()})));`,v=`vec4( + getAChannel(${m.join()}), hasNextCol ? getAChannel(${g.join()}) : 0., hasNextRow ? getAChannel(${y.join()}) : 0., - hasNextRow && hasNextCol ? getAChannel(${A.join()}) : 0.)`,w=a?"":` - float getBestIndicesAChannel(${m.join()}) { - return getChannel(getBestIndicesA(${p.join()}), - vec2(${p.slice(-2).join()})); + hasNextRow && hasNextCol ? getAChannel(${A.join()}) : 0.)`,w=r?"":` + float getBestIndicesAChannel(${f.join()}) { + return getChannel(getBestIndicesA(${h.join()}), + vec2(${h.slice(-2).join()})); }`;this.userCode=` - float getAChannel(${m.join()}) { - return getChannel(getA(${p.join()}), - vec2(${p.slice(-2).join()})); + float getAChannel(${f.join()}) { + return getChannel(getA(${h.join()}), + vec2(${h.slice(-2).join()})); } ${w} void main() { ${l} coords = getOutputCoords(); - bool hasNextCol = ${u[o-1]} < ${i[o-1]-1}; - bool hasNextRow = ${u[o-2]} < ${i[o-2]-1}; - ${d} - ivec4 srcIdx = ivec4(sourceLocR${c}, sourceLocG${c}, - sourceLocB${c}, sourceLocA${c}) * ${t}; + bool hasNextCol = ${u[i-1]} < ${o[i-1]-1}; + bool hasNextRow = ${u[i-2]} < ${o[i-2]-1}; + ${c} + ivec4 srcIdx = ivec4(sourceLocR${p}, sourceLocG${p}, + sourceLocB${p}, sourceLocA${p}) * ${t}; ivec4 inIdx = srcIdx; vec4 bestIndex = vec4(inIdx); - vec4 bestValue = ${b}; + vec4 bestValue = ${v}; for (int i = 0; i < ${t}; i++) { inIdx = srcIdx; - ${v} - vec4 candidate = ${b}; + ${b} + vec4 candidate = ${v}; bvec4 nan = isnan(candidate); bvec4 replace = bvec4( vec4(${x}(candidate, bestValue)) * (vec4(1.0) - vec4(nan))); @@ -1376,25 +1376,25 @@ return log(x + sqrt(x * x - 1.0));`,Vfe=ot({opSnippet:Bfe}),Ufe={kernelName:vd,b } setOutput(bestIndex); } - `}};function DE(e,t,n,a=null){let r=t.shape[0],s=t.shape[1];a!=null&&(r=a.shape[0],s=a.shape[1]);let i=M.computeOptimalWindowSize(s),o={windowSize:i,inSize:s,batchSize:r,outSize:Math.ceil(s/i)},l=new Qfe(o,n,a==null),u=[t];a!=null&&u.push(a);let d=e.runWebGLProgram(l,u,"int32");if(d.shape[1]===1)return d;let h=DE(e,t,n,d);return e.disposeIntermediateTensorInfo(d),h}function _E(e,t,n,a=null){let r=a!=null?a.shape:t.shape,s=r[r.length-1],i=M.computeOptimalWindowSize(s),o=new e0e(r,i,n,a==null),l=a==null?[t]:[t,a],u=e.runWebGLProgram(o,l,"int32");if(u.shape.length===t.shape.length){let d=_E(e,t,n,u);return e.disposeIntermediateTensorInfo(u),d}return u}function zE(e,t,n,a){let r=[n];if(M.assertAxesAreInnerMostDims("arg"+a.charAt(0).toUpperCase()+a.slice(1),r,t.shape.length),!se().getBool("WEBGL_PACK_REDUCE")||t.shape.length<=2){let s=[],[i,o]=M.computeOutAndReduceShapes(t.shape,r),l=k.sizeFromShape(o),u=be({inputs:{x:t},backend:e,attrs:{shape:[-1,l]}});s.push(u);let d=DE(e,u,a);s.push(d);let h=be({inputs:{x:d},backend:e,attrs:{shape:i}});return s.forEach(p=>e.disposeIntermediateTensorInfo(p)),h}return _E(e,t,a)}function t0e(e){let{inputs:t,backend:n,attrs:a}=e,{x:r}=t,{axis:s}=a,i=k.parseAxisParam(s,r.shape),o=M.getAxesPermutation(i,r.shape.length),l=r,u=[];o!=null&&(l=Vn({inputs:{x:r},backend:n,attrs:{perm:o}}),u.push(l),i=M.getInnerMostAxes(i.length,l.shape.length)),M.assertAxesAreInnerMostDims("argMax",[i[0]],l.shape.length);let d=zE(n,l,i[0],"max");return u.forEach(h=>n.disposeIntermediateTensorInfo(h)),d}var n0e={kernelName:Yo,backendName:"webgl",kernelFunc:t0e};function a0e(e){let{inputs:t,backend:n,attrs:a}=e,{x:r}=t,{axis:s}=a,i=k.parseAxisParam(s,r.shape),o=M.getAxesPermutation(i,r.shape.length),l=r,u=[];o!=null&&(l=Vn({inputs:{x:r},backend:n,attrs:{perm:o}}),u.push(l),i=M.getInnerMostAxes(i.length,l.shape.length)),M.assertAxesAreInnerMostDims("argMin",[i[0]],l.shape.length);let d=zE(n,l,i[0],"min");return u.forEach(h=>n.disposeIntermediateTensorInfo(h)),d}var r0e={kernelName:qc,backendName:"webgl",kernelFunc:a0e},s0e=gr+` + `}};function ME(e,t,n,r=null){let s=t.shape[0],a=t.shape[1];r!=null&&(s=r.shape[0],a=r.shape[1]);let o=_.computeOptimalWindowSize(a),i={windowSize:o,inSize:a,batchSize:s,outSize:Math.ceil(a/o)},l=new Qfe(i,n,r==null),u=[t];r!=null&&u.push(r);let c=e.runWebGLProgram(l,u,"int32");if(c.shape[1]===1)return c;let d=ME(e,t,n,c);return e.disposeIntermediateTensorInfo(c),d}function OE(e,t,n,r=null){let s=r!=null?r.shape:t.shape,a=s[s.length-1],o=_.computeOptimalWindowSize(a),i=new eme(s,o,n,r==null),l=r==null?[t]:[t,r],u=e.runWebGLProgram(i,l,"int32");if(u.shape.length===t.shape.length){let c=OE(e,t,n,u);return e.disposeIntermediateTensorInfo(u),c}return u}function PE(e,t,n,r){let s=[n];if(_.assertAxesAreInnerMostDims("arg"+r.charAt(0).toUpperCase()+r.slice(1),s,t.shape.length),!ae().getBool("WEBGL_PACK_REDUCE")||t.shape.length<=2){let a=[],[o,i]=_.computeOutAndReduceShapes(t.shape,s),l=k.sizeFromShape(i),u=ve({inputs:{x:t},backend:e,attrs:{shape:[-1,l]}});a.push(u);let c=ME(e,u,r);a.push(c);let d=ve({inputs:{x:c},backend:e,attrs:{shape:o}});return a.forEach(h=>e.disposeIntermediateTensorInfo(h)),d}return OE(e,t,r)}function tme(e){let{inputs:t,backend:n,attrs:r}=e,{x:s}=t,{axis:a}=r,o=k.parseAxisParam(a,s.shape),i=_.getAxesPermutation(o,s.shape.length),l=s,u=[];i!=null&&(l=Un({inputs:{x:s},backend:n,attrs:{perm:i}}),u.push(l),o=_.getInnerMostAxes(o.length,l.shape.length)),_.assertAxesAreInnerMostDims("argMax",[o[0]],l.shape.length);let c=PE(n,l,o[0],"max");return u.forEach(d=>n.disposeIntermediateTensorInfo(d)),c}var nme={kernelName:Yi,backendName:"webgl",kernelFunc:tme};function rme(e){let{inputs:t,backend:n,attrs:r}=e,{x:s}=t,{axis:a}=r,o=k.parseAxisParam(a,s.shape),i=_.getAxesPermutation(o,s.shape.length),l=s,u=[];i!=null&&(l=Un({inputs:{x:s},backend:n,attrs:{perm:i}}),u.push(l),o=_.getInnerMostAxes(o.length,l.shape.length)),_.assertAxesAreInnerMostDims("argMin",[o[0]],l.shape.length);let c=PE(n,l,o[0],"min");return u.forEach(d=>n.disposeIntermediateTensorInfo(d)),c}var sme={kernelName:qp,backendName:"webgl",kernelFunc:rme},ame=ys+` if (abs(x) > 1.) { return NAN; } return asin(x); -`,i0e=ot({opSnippet:s0e}),o0e={kernelName:Id,backendName:"webgl",kernelFunc:i0e},l0e=gr+"return log(x + sqrt(x * x + 1.0));",u0e=ot({opSnippet:l0e}),d0e={kernelName:Sd,backendName:"webgl",kernelFunc:u0e},h0e=gr+` +`,ome=it({opSnippet:ame}),ime={kernelName:Ic,backendName:"webgl",kernelFunc:ome},lme=ys+"return log(x + sqrt(x * x + 1.0));",ume=it({opSnippet:lme}),cme={kernelName:Sc,backendName:"webgl",kernelFunc:ume},dme=ys+` return atan(x); -`,p0e=ot({opSnippet:h0e}),c0e={kernelName:Nd,backendName:"webgl",kernelFunc:p0e},f0e=vfe+` +`,hme=it({opSnippet:dme}),pme={kernelName:Tc,backendName:"webgl",kernelFunc:hme},fme=vfe+` return atan(a, b); -`,m0e=` +`,mme=` vec4 result = atan(a, b); vec4 isNaN = min(vec4(isnan(a)) + vec4(isnan(b)), vec4(1.0)); `+wfe+` return result; -`,g0e=Tn({opSnippet:f0e,packedOpSnippet:m0e}),y0e={kernelName:Ed,backendName:"webgl",kernelFunc:g0e},A0e=gr+` +`,gme=Nn({opSnippet:fme,packedOpSnippet:mme}),yme={kernelName:Cc,backendName:"webgl",kernelFunc:gme},Ame=ys+` if ((x < -1.0) || (x > 1.0)) return NAN; -return (log(1.0 + x) - log(1.0 - x)) / 2.0;`,x0e=ot({opSnippet:A0e}),b0e={kernelName:Td,backendName:"webgl",kernelFunc:x0e},cp=class{constructor(e,t,n,a=!1,r=!1){if(this.variableNames=["x"],t==="avg"&&n)throw new Error("Cannot compute positions for average pool.");let s=e.filterWidth,i=e.strideHeight,o=e.strideWidth,l=e.dilationHeight,u=e.dilationWidth,d=e.effectiveFilterHeight,h=e.effectiveFilterWidth,p=e.padInfo.top,c=e.padInfo.left;this.outputShape=e.outShape;let m=t==="avg",f=`((batch * ${e.inHeight} + xR) * ${e.inWidth} + xC) * ${e.inChannels} + d`,g=`(xR * ${e.inWidth} + xC) * ${e.inChannels} + d`,y="0.0";if(m||(y="-1.0 / 1e-20"),n){let I=">=";this.userCode=` - const ivec2 strides = ivec2(${i}, ${o}); - const ivec2 pads = ivec2(${p}, ${c}); +return (log(1.0 + x) - log(1.0 - x)) / 2.0;`,xme=it({opSnippet:Ame}),bme={kernelName:Nc,backendName:"webgl",kernelFunc:xme},ph=class{constructor(e,t,n,r=!1,s=!1){if(this.variableNames=["x"],t==="avg"&&n)throw new Error("Cannot compute positions for average pool.");let a=e.filterWidth,o=e.strideHeight,i=e.strideWidth,l=e.dilationHeight,u=e.dilationWidth,c=e.effectiveFilterHeight,d=e.effectiveFilterWidth,h=e.padInfo.top,p=e.padInfo.left;this.outputShape=e.outShape;let f=t==="avg",m=`((batch * ${e.inHeight} + xR) * ${e.inWidth} + xC) * ${e.inChannels} + d`,g=`(xR * ${e.inWidth} + xC) * ${e.inChannels} + d`,y="0.0";if(f||(y="-1.0 / 1e-20"),n){let I=">=";this.userCode=` + const ivec2 strides = ivec2(${o}, ${i}); + const ivec2 pads = ivec2(${h}, ${p}); void main() { ivec4 coords = getOutputCoords(); @@ -1412,7 +1412,7 @@ return (log(1.0 + x) - log(1.0 - x)) / 2.0;`,x0e=ot({opSnippet:A0e}),b0e={kernel int minMaxPosition = 0; float avgValue = 0.0; - for (int wR = 0; wR < ${d}; + for (int wR = 0; wR < ${c}; wR += ${l}) { int xR = xRCorner + wR; @@ -1420,7 +1420,7 @@ return (log(1.0 + x) - log(1.0 - x)) / 2.0;`,x0e=ot({opSnippet:A0e}),b0e={kernel continue; } - for (int wC = 0; wC < ${h}; + for (int wC = 0; wC < ${d}; wC += ${u}) { int xC = xCCorner + wC; @@ -1437,21 +1437,21 @@ return (log(1.0 + x) - log(1.0 - x)) / 2.0;`,x0e=ot({opSnippet:A0e}),b0e={kernel if (value ${I} currMinMaxValue) { minMaxValue = value; minMaxValueFound = 1.0; - minMaxPosition = ${a?r?f:g:`wR * ${h} + wC`}; + minMaxPosition = ${r?s?m:g:`wR * ${d} + wC`}; } } } setOutput(float(minMaxPosition)); } - `;return}let A="max",x=`${t}(${t}(${t}(minMaxValue[0], minMaxValue[1]), minMaxValue[2]), minMaxValue[3])`;t==="avg"&&(x="avgValue / count");let v=Math.floor(s/4)*4,b=s%4,w=` - if (${m}) { + `;return}let A="max",x=`${t}(${t}(${t}(minMaxValue[0], minMaxValue[1]), minMaxValue[2]), minMaxValue[3])`;t==="avg"&&(x="avgValue / count");let b=Math.floor(a/4)*4,v=a%4,w=` + if (${f}) { avgValue += dot(values, ones); } else { minMaxValue = ${A}(values, minMaxValue); } `;this.userCode=` - const ivec2 strides = ivec2(${i}, ${o}); - const ivec2 pads = ivec2(${p}, ${c}); + const ivec2 strides = ivec2(${o}, ${i}); + const ivec2 pads = ivec2(${h}, ${p}); const float initializationValue = ${y}; const vec4 ones = vec4(1.0, 1.0, 1.0, 1.0); @@ -1480,7 +1480,7 @@ return (log(1.0 + x) - log(1.0 - x)) / 2.0;`,x0e=ot({opSnippet:A0e}),b0e={kernel float avgValue = 0.0; count = 0.0; - for (int wR = 0; wR < ${d}; + for (int wR = 0; wR < ${c}; wR += ${l}) { int xR = xRCorner + wR; @@ -1488,7 +1488,7 @@ return (log(1.0 + x) - log(1.0 - x)) / 2.0;`,x0e=ot({opSnippet:A0e}),b0e={kernel continue; } - for (int wC = 0; wC < ${v}; wC += 4) { + for (int wC = 0; wC < ${b}; wC += 4) { int xC = xCCorner + wC * ${u}; vec4 values = vec4( @@ -1501,8 +1501,8 @@ return (log(1.0 + x) - log(1.0 - x)) / 2.0;`,x0e=ot({opSnippet:A0e}),b0e={kernel ${w} } - int xC = xCCorner + ${v}; - if (${b===1}) { + int xC = xCCorner + ${b}; + if (${v===1}) { vec4 values = vec4( getValue(batch, xR, xC, d), initializationValue, @@ -1511,7 +1511,7 @@ return (log(1.0 + x) - log(1.0 - x)) / 2.0;`,x0e=ot({opSnippet:A0e}),b0e={kernel ); ${w} - } else if (${b===2}) { + } else if (${v===2}) { vec4 values = vec4( getValue(batch, xR, xC, d), getValue(batch, xR, xC + ${u}, d), @@ -1520,7 +1520,7 @@ return (log(1.0 + x) - log(1.0 - x)) / 2.0;`,x0e=ot({opSnippet:A0e}),b0e={kernel ); ${w} - } else if (${b===3}) { + } else if (${v===3}) { vec4 values = vec4( getValue(batch, xR, xC, d), getValue(batch, xR, xC + ${u}, d), @@ -1533,10 +1533,10 @@ return (log(1.0 + x) - log(1.0 - x)) / 2.0;`,x0e=ot({opSnippet:A0e}),b0e={kernel } setOutput(${x}); } - `}},lb=class{constructor(e,t,n,a=!1,r=!1){if(this.variableNames=["x"],t==="avg"&&n)throw new Error("Cannot compute positions for average pool.");let s=e.filterWidth,i=e.strideDepth,o=e.strideHeight,l=e.strideWidth,u=e.dilationDepth,d=e.dilationHeight,h=e.dilationWidth,p=e.effectiveFilterDepth,c=e.effectiveFilterHeight,m=e.effectiveFilterWidth,f=e.padInfo.front,g=e.padInfo.top,y=e.padInfo.left;this.outputShape=e.outShape;let A=t==="avg",x="0.0";if(A||(x="-1.0 / 1e-20"),n){let C=">=";this.userCode=` + `}},lb=class{constructor(e,t,n,r=!1,s=!1){if(this.variableNames=["x"],t==="avg"&&n)throw new Error("Cannot compute positions for average pool.");let a=e.filterWidth,o=e.strideDepth,i=e.strideHeight,l=e.strideWidth,u=e.dilationDepth,c=e.dilationHeight,d=e.dilationWidth,h=e.effectiveFilterDepth,p=e.effectiveFilterHeight,f=e.effectiveFilterWidth,m=e.padInfo.front,g=e.padInfo.top,y=e.padInfo.left;this.outputShape=e.outShape;let A=t==="avg",x="0.0";if(A||(x="-1.0 / 1e-20"),n){let C=">=";this.userCode=` const ivec3 strides = - ivec3(${i}, ${o}, ${l}); - const ivec3 pads = ivec3(${f}, ${g}, ${y}); + ivec3(${o}, ${i}, ${l}); + const ivec3 pads = ivec3(${m}, ${g}, ${y}); void main() { ivec5 coords = getOutputCoords(); @@ -1554,7 +1554,7 @@ return (log(1.0 + x) - log(1.0 - x)) / 2.0;`,x0e=ot({opSnippet:A0e}),b0e={kernel float minMaxValueFound = 0.0; int minMaxPosition = 0; - for (int wD = 0; wD < ${p}; + for (int wD = 0; wD < ${h}; wD += ${u}) { int xD = xDCorner + wD; @@ -1562,16 +1562,16 @@ return (log(1.0 + x) - log(1.0 - x)) / 2.0;`,x0e=ot({opSnippet:A0e}),b0e={kernel continue; } - for (int wR = 0; wR < ${c}; - wR += ${d}) { + for (int wR = 0; wR < ${p}; + wR += ${c}) { int xR = xRCorner + wR; if (xR < 0 || xR >= ${e.inHeight}) { continue; } - for (int wC = 0; wC < ${m}; - wC += ${h}) { + for (int wC = 0; wC < ${f}; + wC += ${d}) { int xC = xCCorner + wC; if (xC < 0 || xC >= ${e.inWidth}) { @@ -1587,24 +1587,24 @@ return (log(1.0 + x) - log(1.0 - x)) / 2.0;`,x0e=ot({opSnippet:A0e}),b0e={kernel if (value ${C} currMinMaxValue) { minMaxValue = value; minMaxValueFound = 1.0; - minMaxPosition = ${a?r?`(((batch * ${e.inDepth} + xD) * ${e.inHeight} + xR) * ${e.inWidth} + xC) * ${e.inChannels} + ch`:`((xD * ${e.inHeight} + xR) * ${e.inWidth} + xC) * ${e.inChannels} + ch`:`wD * ${c} * ${m} + - wR * ${m} + wC`}; + minMaxPosition = ${r?s?`(((batch * ${e.inDepth} + xD) * ${e.inHeight} + xR) * ${e.inWidth} + xC) * ${e.inChannels} + ch`:`((xD * ${e.inHeight} + xR) * ${e.inWidth} + xC) * ${e.inChannels} + ch`:`wD * ${p} * ${f} + + wR * ${f} + wC`}; } } } } setOutput(float(minMaxPosition)); } - `;return}let v="max",b=`${t}(${t}(${t}(minMaxValue[0], minMaxValue[1]), minMaxValue[2]), minMaxValue[3])`;t==="avg"&&(b="avgValue / count");let w=Math.floor(s/4)*4,I=s%4,T=` + `;return}let b="max",v=`${t}(${t}(${t}(minMaxValue[0], minMaxValue[1]), minMaxValue[2]), minMaxValue[3])`;t==="avg"&&(v="avgValue / count");let w=Math.floor(a/4)*4,I=a%4,T=` if (${A}) { avgValue += dot(values, ones); } else { - minMaxValue = ${v}(values, minMaxValue); + minMaxValue = ${b}(values, minMaxValue); } `;this.userCode=` const ivec3 strides = - ivec3(${i}, ${o}, ${l}); - const ivec3 pads = ivec3(${f}, ${g}, ${y}); + ivec3(${o}, ${i}, ${l}); + const ivec3 pads = ivec3(${m}, ${g}, ${y}); const float initializationValue = ${x}; const vec4 ones = vec4(1.0, 1.0, 1.0, 1.0); @@ -1634,7 +1634,7 @@ return (log(1.0 + x) - log(1.0 - x)) / 2.0;`,x0e=ot({opSnippet:A0e}),b0e={kernel float avgValue = 0.0; count = 0.0; - for (int wD = 0; wD < ${p}; + for (int wD = 0; wD < ${h}; wD += ${u}) { int xD = xDCorner + wD; @@ -1642,8 +1642,8 @@ return (log(1.0 + x) - log(1.0 - x)) / 2.0;`,x0e=ot({opSnippet:A0e}),b0e={kernel continue; } - for (int wR = 0; wR < ${c}; - wR += ${d}) { + for (int wR = 0; wR < ${p}; + wR += ${c}) { int xR = xRCorner + wR; if (xR < 0 || xR >= ${e.inHeight}) { @@ -1651,13 +1651,13 @@ return (log(1.0 + x) - log(1.0 - x)) / 2.0;`,x0e=ot({opSnippet:A0e}),b0e={kernel } for (int wC = 0; wC < ${w}; wC += 4) { - int xC = xCCorner + wC * ${h}; + int xC = xCCorner + wC * ${d}; vec4 values = vec4( getValue(batch, xD, xR, xC, ch), - getValue(batch, xD, xR, xC + ${h}, ch), - getValue(batch, xD, xR, xC + 2 * ${h}, ch), - getValue(batch, xD, xR, xC + 3 * ${h}, ch) + getValue(batch, xD, xR, xC + ${d}, ch), + getValue(batch, xD, xR, xC + 2 * ${d}, ch), + getValue(batch, xD, xR, xC + 3 * ${d}, ch) ); ${T} @@ -1676,7 +1676,7 @@ return (log(1.0 + x) - log(1.0 - x)) / 2.0;`,x0e=ot({opSnippet:A0e}),b0e={kernel } else if (${I===2}) { vec4 values = vec4( getValue(batch, xD, xR, xC, ch), - getValue(batch, xD, xR, xC + ${h}, ch), + getValue(batch, xD, xR, xC + ${d}, ch), initializationValue, initializationValue ); @@ -1685,20 +1685,20 @@ return (log(1.0 + x) - log(1.0 - x)) / 2.0;`,x0e=ot({opSnippet:A0e}),b0e={kernel } else if (${I===3}) { vec4 values = vec4( getValue(batch, xD, xR, xC, ch), - getValue(batch, xD, xR, xC + ${h}, ch), - getValue(batch, xD, xR, xC + 2 * ${h}, ch), + getValue(batch, xD, xR, xC + ${d}, ch), + getValue(batch, xD, xR, xC + 2 * ${d}, ch), initializationValue ); ${T} } } - setOutput(${b}); + setOutput(${v}); } } - `}};function v0e(e){let{inputs:t,backend:n,attrs:a}=e,{x:r}=t;mu(r,"avgPool");let{filterSize:s,strides:i,pad:o,dimRoundingMode:l}=a,u=1;k.assert(M.eitherStridesOrDilationsAreOne(i,u),()=>`Error in avgPool: Either strides or dilations must be 1. Got strides ${i} and dilations '${u}'`);let d=M.computePool2DInfo(r.shape,s,i,u,o,l);if(d.filterWidth===1&&d.filterHeight===1&&k.arraysEqual(d.inShape,d.outShape))return fa({inputs:{x:r},backend:n});let h=new cp(d,"avg",!1);return n.runWebGLProgram(h,[r],"float32")}var w0e={kernelName:Jo,backendName:"webgl",kernelFunc:v0e};function k0e(e){let{inputs:t,backend:n,attrs:a}=e,{x:r}=t,{filterSize:s,strides:i,pad:o,dimRoundingMode:l,dataFormat:u}=a,d=[1,1,1],h=M.computePool3DInfo(r.shape,s,i,d,o,l,u),p=new lb(h,"avg",!1);return n.runWebGLProgram(p,[r],"float32")}var I0e={kernelName:Kc,backendName:"webgl",kernelFunc:k0e},S0e=class{constructor(e){this.variableNames=["dy"],this.outputShape=e.inShape;let t=e.filterHeight,n=e.filterWidth,a=e.strideHeight,r=e.strideWidth,s=e.dilationHeight,i=e.dilationWidth,o=e.effectiveFilterHeight,l=e.effectiveFilterWidth,u=o-1-e.padInfo.top,d=l-1-e.padInfo.left,h=1/(t*n);this.userCode=` - const ivec2 pads = ivec2(${u}, ${d}); - const float avgMultiplier = float(${h}); + `}};function vme(e){let{inputs:t,backend:n,attrs:r}=e,{x:s}=t;mu(s,"avgPool");let{filterSize:a,strides:o,pad:i,dimRoundingMode:l}=r,u=1;k.assert(_.eitherStridesOrDilationsAreOne(o,u),()=>`Error in avgPool: Either strides or dilations must be 1. Got strides ${o} and dilations '${u}'`);let c=_.computePool2DInfo(s.shape,a,o,u,i,l);if(c.filterWidth===1&&c.filterHeight===1&&k.arraysEqual(c.inShape,c.outShape))return mr({inputs:{x:s},backend:n});let d=new ph(c,"avg",!1);return n.runWebGLProgram(d,[s],"float32")}var wme={kernelName:Ji,backendName:"webgl",kernelFunc:vme};function kme(e){let{inputs:t,backend:n,attrs:r}=e,{x:s}=t,{filterSize:a,strides:o,pad:i,dimRoundingMode:l,dataFormat:u}=r,c=[1,1,1],d=_.computePool3DInfo(s.shape,a,o,c,i,l,u),h=new lb(d,"avg",!1);return n.runWebGLProgram(h,[s],"float32")}var Ime={kernelName:Kp,backendName:"webgl",kernelFunc:kme},Sme=class{constructor(e){this.variableNames=["dy"],this.outputShape=e.inShape;let t=e.filterHeight,n=e.filterWidth,r=e.strideHeight,s=e.strideWidth,a=e.dilationHeight,o=e.dilationWidth,i=e.effectiveFilterHeight,l=e.effectiveFilterWidth,u=i-1-e.padInfo.top,c=l-1-e.padInfo.left,d=1/(t*n);this.userCode=` + const ivec2 pads = ivec2(${u}, ${c}); + const float avgMultiplier = float(${d}); void main() { ivec4 coords = getOutputCoords(); @@ -1712,9 +1712,9 @@ return (log(1.0 + x) - log(1.0 - x)) / 2.0;`,x0e=ot({opSnippet:A0e}),b0e={kernel // Convolve dy(?, ?, d) with pos mask(:, :, d) to get dx(xR, xC, d). // ? = to be determined. : = across all values in that axis. float dotProd = 0.0; - for (int wR = 0; wR < ${o}; - wR += ${s}) { - float dyR = float(dyRCorner + wR) / ${a}.0; + for (int wR = 0; wR < ${i}; + wR += ${a}) { + float dyR = float(dyRCorner + wR) / ${r}.0; if (dyR < 0.0 || dyR >= ${e.outHeight}.0 || fract(dyR) > 0.0) { continue; @@ -1722,8 +1722,8 @@ return (log(1.0 + x) - log(1.0 - x)) / 2.0;`,x0e=ot({opSnippet:A0e}),b0e={kernel int idyR = int(dyR); for (int wC = 0; wC < ${l}; - wC+= ${i}) { - float dyC = float(dyCCorner + wC) / ${r}.0; + wC+= ${o}) { + float dyC = float(dyCCorner + wC) / ${s}.0; if (dyC < 0.0 || dyC >= ${e.outWidth}.0 || fract(dyC) > 0.0) { @@ -1738,8 +1738,8 @@ return (log(1.0 + x) - log(1.0 - x)) / 2.0;`,x0e=ot({opSnippet:A0e}),b0e={kernel } setOutput(dotProd); } - `}},N0e=class{constructor(e){this.variableNames=["dy"],this.outputShape=e.inShape;let t=e.filterDepth,n=e.filterHeight,a=e.filterWidth,r=e.strideDepth,s=e.strideHeight,i=e.strideWidth,o=e.dilationDepth,l=e.dilationHeight,u=e.dilationWidth,d=e.effectiveFilterDepth,h=e.effectiveFilterHeight,p=e.effectiveFilterWidth,c=d-1-e.padInfo.front,m=h-1-e.padInfo.top,f=p-1-e.padInfo.left,g=1/(t*n*a);this.userCode=` - const ivec3 pads = ivec3(${c}, ${m}, ${f}); + `}},Tme=class{constructor(e){this.variableNames=["dy"],this.outputShape=e.inShape;let t=e.filterDepth,n=e.filterHeight,r=e.filterWidth,s=e.strideDepth,a=e.strideHeight,o=e.strideWidth,i=e.dilationDepth,l=e.dilationHeight,u=e.dilationWidth,c=e.effectiveFilterDepth,d=e.effectiveFilterHeight,h=e.effectiveFilterWidth,p=c-1-e.padInfo.front,f=d-1-e.padInfo.top,m=h-1-e.padInfo.left,g=1/(t*n*r);this.userCode=` + const ivec3 pads = ivec3(${p}, ${f}, ${m}); const float avgMultiplier = float(${g}); void main() { @@ -1757,18 +1757,18 @@ return (log(1.0 + x) - log(1.0 - x)) / 2.0;`,x0e=ot({opSnippet:A0e}),b0e={kernel // ? = to be determined. : = across all values in that axis. float dotProd = 0.0; - for (int wD = 0; wD < ${d}; - wD += ${o}) { - float dyD = float(dyDCorner + wD) / ${r}.0; + for (int wD = 0; wD < ${c}; + wD += ${i}) { + float dyD = float(dyDCorner + wD) / ${s}.0; if (dyD < 0.0 || dyD >= ${e.outDepth}.0 || fract(dyD) > 0.0) { continue; } int idyD = int(dyD); - for (int wR = 0; wR < ${h}; + for (int wR = 0; wR < ${d}; wR += ${l}) { - float dyR = float(dyRCorner + wR) / ${s}.0; + float dyR = float(dyRCorner + wR) / ${a}.0; if (dyR < 0.0 || dyR >= ${e.outHeight}.0 || fract(dyR) > 0.0) { @@ -1776,9 +1776,9 @@ return (log(1.0 + x) - log(1.0 - x)) / 2.0;`,x0e=ot({opSnippet:A0e}),b0e={kernel } int idyR = int(dyR); - for (int wC = 0; wC < ${p}; + for (int wC = 0; wC < ${h}; wC += ${u}) { - float dyC = float(dyCCorner + wC) / ${i}.0; + float dyC = float(dyCCorner + wC) / ${o}.0; if (dyC < 0.0 || dyC >= ${e.outWidth}.0 || fract(dyC) > 0.0) { @@ -1794,59 +1794,59 @@ return (log(1.0 + x) - log(1.0 - x)) / 2.0;`,x0e=ot({opSnippet:A0e}),b0e={kernel } setOutput(dotProd); } - `}};function T0e(e){let{inputs:t,backend:n,attrs:a}=e,{dy:r,input:s}=t,i=s,{filterSize:o,strides:l,pad:u,dimRoundingMode:d}=a,h=[1,1,1],p=M.computePool3DInfo(i.shape,o,l,h,u,d),c=new N0e(p);return n.runWebGLProgram(c,[r],i.dtype)}var E0e={kernelName:v1,backendName:"webgl",kernelFunc:T0e};function C0e(e){let{inputs:t,backend:n,attrs:a}=e,{dy:r,input:s}=t,i=s;mu([r,s],"avgPoolGrad");let{filterSize:o,strides:l,pad:u}=a,d=M.computePool2DInfo(i.shape,o,l,1,u),h=new S0e(d);return n.runWebGLProgram(h,[r],i.dtype)}var M0e={kernelName:b1,backendName:"webgl",kernelFunc:C0e};function $0e(e){let{inputs:t,backend:n,attrs:a}=e,{a:r,b:s}=t,{transposeA:i,transposeB:o}=a;return q0({a:r,b:s,transposeA:i,transposeB:o,backend:n})}var R0e={kernelName:Qo,backendName:"webgl",kernelFunc:$0e},F0e=class{constructor(e,t,n,a,r,s){this.outputShape=[],this.variableNames=["x","mean","variance"],M.assertAndGetBroadcastShape(e,t),M.assertAndGetBroadcastShape(e,n);let i="0.0";a!=null&&(M.assertAndGetBroadcastShape(e,a),this.variableNames.push("offset"),i="getOffsetAtOutCoords()");let o="1.0";r!=null&&(M.assertAndGetBroadcastShape(e,r),this.variableNames.push("scale"),o="getScaleAtOutCoords()"),this.outputShape=e,this.userCode=` + `}};function Nme(e){let{inputs:t,backend:n,attrs:r}=e,{dy:s,input:a}=t,o=a,{filterSize:i,strides:l,pad:u,dimRoundingMode:c}=r,d=[1,1,1],h=_.computePool3DInfo(o.shape,i,l,d,u,c),p=new Tme(h);return n.runWebGLProgram(p,[s],o.dtype)}var Cme={kernelName:wy,backendName:"webgl",kernelFunc:Nme};function Eme(e){let{inputs:t,backend:n,attrs:r}=e,{dy:s,input:a}=t,o=a;mu([s,a],"avgPoolGrad");let{filterSize:i,strides:l,pad:u}=r,c=_.computePool2DInfo(o.shape,i,l,1,u),d=new Sme(c);return n.runWebGLProgram(d,[s],o.dtype)}var $me={kernelName:vy,backendName:"webgl",kernelFunc:Eme};function _me(e){let{inputs:t,backend:n,attrs:r}=e,{a:s,b:a}=t,{transposeA:o,transposeB:i}=r;return Km({a:s,b:a,transposeA:o,transposeB:i,backend:n})}var Rme={kernelName:Qi,backendName:"webgl",kernelFunc:_me},Dme=class{constructor(e,t,n,r,s,a){this.outputShape=[],this.variableNames=["x","mean","variance"],_.assertAndGetBroadcastShape(e,t),_.assertAndGetBroadcastShape(e,n);let o="0.0";r!=null&&(_.assertAndGetBroadcastShape(e,r),this.variableNames.push("offset"),o="getOffsetAtOutCoords()");let i="1.0";s!=null&&(_.assertAndGetBroadcastShape(e,s),this.variableNames.push("scale"),i="getScaleAtOutCoords()"),this.outputShape=e,this.userCode=` void main() { float x = getXAtOutCoords(); float mean = getMeanAtOutCoords(); float variance = getVarianceAtOutCoords(); - float offset = ${i}; - float scale = ${o}; - float inv = scale * inversesqrt(variance + float(${s})); + float offset = ${o}; + float scale = ${i}; + float inv = scale * inversesqrt(variance + float(${a})); setOutput(dot(vec3(x, -mean, offset), vec3(inv, inv, 1))); } - `}},O0e=class{constructor(e,t,n,a,r,s){this.packedInputs=!0,this.packedOutput=!0,this.variableNames=["x","mean","variance"],M.assertAndGetBroadcastShape(e,t),M.assertAndGetBroadcastShape(e,n);let i="vec4(0.0)";a!=null&&(M.assertAndGetBroadcastShape(e,a),this.variableNames.push("offset"),i="getOffsetAtOutCoords()");let o="vec4(1.0)";r!=null&&(M.assertAndGetBroadcastShape(e,r),this.variableNames.push("scale"),o="getScaleAtOutCoords()"),this.outputShape=e,this.userCode=` + `}},Fme=class{constructor(e,t,n,r,s,a){this.packedInputs=!0,this.packedOutput=!0,this.variableNames=["x","mean","variance"],_.assertAndGetBroadcastShape(e,t),_.assertAndGetBroadcastShape(e,n);let o="vec4(0.0)";r!=null&&(_.assertAndGetBroadcastShape(e,r),this.variableNames.push("offset"),o="getOffsetAtOutCoords()");let i="vec4(1.0)";s!=null&&(_.assertAndGetBroadcastShape(e,s),this.variableNames.push("scale"),i="getScaleAtOutCoords()"),this.outputShape=e,this.userCode=` void main() { - vec4 offset = ${i}; - vec4 scale = ${o}; + vec4 offset = ${o}; + vec4 scale = ${i}; vec4 x = getXAtOutCoords(); vec4 mean = getMeanAtOutCoords(); vec4 variance = getVarianceAtOutCoords(); - vec4 inv = scale * inversesqrt(variance + vec4(${s})); + vec4 inv = scale * inversesqrt(variance + vec4(${a})); setOutput((x - mean) * inv + offset); } - `}},D0e=({inputs:e,backend:t,attrs:n})=>{let{x:a,mean:r,variance:s,offset:i,scale:o}=e;k.assert(r.shape.length===s.shape.length,()=>"Batch normalization gradient requires mean and variance to have equal ranks."),k.assert(i==null||r.shape.length===i.shape.length,()=>"Batch normalization gradient requires mean and offset to have equal ranks."),k.assert(o==null||r.shape.length===o.shape.length,()=>"Batch normalization gradient requires mean and scale to have equal ranks.");let{varianceEpsilon:l}=n;l==null&&(l=.001);let u=[a,r,s],d=null;i!=null&&(d=i.shape,u.push(i));let h=null;o!=null&&(h=o.shape,u.push(o));let p=se().getBool("WEBGL_PACK_NORMALIZATION")?new O0e(a.shape,r.shape,s.shape,d,h,l):new F0e(a.shape,r.shape,s.shape,d,h,l);return t.runWebGLProgram(p,u,u[0].dtype)},_0e={kernelName:dl,backendName:"webgl",kernelFunc:D0e},z0e=class{constructor(e){this.variableNames=["source"],this.outputShape=e,this.rank=e.length;let t=kt(this.rank),n=`uniform int start[${this.rank}];`,a=P0e(this.rank),r,s=e.map((i,o)=>`sourceLoc.${ub[o]} = start[${o}] + coords.${ub[o]};`);r=` + `}},Mme=({inputs:e,backend:t,attrs:n})=>{let{x:r,mean:s,variance:a,offset:o,scale:i}=e;k.assert(s.shape.length===a.shape.length,()=>"Batch normalization gradient requires mean and variance to have equal ranks."),k.assert(o==null||s.shape.length===o.shape.length,()=>"Batch normalization gradient requires mean and offset to have equal ranks."),k.assert(i==null||s.shape.length===i.shape.length,()=>"Batch normalization gradient requires mean and scale to have equal ranks.");let{varianceEpsilon:l}=n;l==null&&(l=.001);let u=[r,s,a],c=null;o!=null&&(c=o.shape,u.push(o));let d=null;i!=null&&(d=i.shape,u.push(i));let h=ae().getBool("WEBGL_PACK_NORMALIZATION")?new Fme(r.shape,s.shape,a.shape,c,d,l):new Dme(r.shape,s.shape,a.shape,c,d,l);return t.runWebGLProgram(h,u,u[0].dtype)},Ome={kernelName:cl,backendName:"webgl",kernelFunc:Mme},Pme=class{constructor(e){this.variableNames=["source"],this.outputShape=e,this.rank=e.length;let t=It(this.rank),n=`uniform int start[${this.rank}];`,r=zme(this.rank),s,a=e.map((o,i)=>`sourceLoc.${ub[i]} = start[${i}] + coords.${ub[i]};`);s=` ${t} sourceLoc; ${t} coords = getOutputCoords(); - ${s.join(` + ${a.join(` `)} `,this.userCode=` ${n} void main() { - ${r} - setOutput(getSource(${a})); + ${s} + setOutput(getSource(${r})); } - `}getCustomSetupFunc(e){if(e.length!==this.rank)throw Error(`The rank (${this.rank}) of the program must match the length of start (${e.length})`);return(t,n)=>{this.startLoc==null&&(this.startLoc=t.getUniformLocationNoThrow(n,"start"),this.startLoc==null)||t.gl.uniform1iv(this.startLoc,e)}}},ub=["x","y","z","w","u","v"];function P0e(e){if(e===1)return"sourceLoc";if(e<=6)return ub.slice(0,e).map(t=>"sourceLoc."+t).join(",");throw Error(`Slicing for rank ${e} is not yet supported`)}var L0e=class{constructor(e){this.variableNames=["source"],this.packedInputs=!0,this.packedOutput=!0,this.outputShape=e,this.rank=e.length;let t=kt(this.rank),n=Bn("coords",this.rank),a=Bn("sourceLoc",this.rank),r=this.rank===1?"sourceLoc":`vec2(${a.slice(-2).join()})`,s=`getChannel(getSource(${a.join()}), ${r})`,i=` - result.x = ${s}; + `}getCustomSetupFunc(e){if(e.length!==this.rank)throw Error(`The rank (${this.rank}) of the program must match the length of start (${e.length})`);return(t,n)=>{this.startLoc==null&&(this.startLoc=t.getUniformLocationNoThrow(n,"start"),this.startLoc==null)||t.gl.uniform1iv(this.startLoc,e)}}},ub=["x","y","z","w","u","v"];function zme(e){if(e===1)return"sourceLoc";if(e<=6)return ub.slice(0,e).map(t=>"sourceLoc."+t).join(",");throw Error(`Slicing for rank ${e} is not yet supported`)}var Lme=class{constructor(e){this.variableNames=["source"],this.packedInputs=!0,this.packedOutput=!0,this.outputShape=e,this.rank=e.length;let t=It(this.rank),n=Vn("coords",this.rank),r=Vn("sourceLoc",this.rank),s=this.rank===1?"sourceLoc":`vec2(${r.slice(-2).join()})`,a=`getChannel(getSource(${r.join()}), ${s})`,o=` + result.x = ${a}; if (++${n[this.rank-1]} < ${e[this.rank-1]}) { - ++${a[this.rank-1]}; - result.y = ${s}; - --${a[this.rank-1]}; + ++${r[this.rank-1]}; + result.y = ${a}; + --${r[this.rank-1]}; } - `,o=this.rank===1?"":` + `,i=this.rank===1?"":` --${n[this.rank-1]}; if (++${n[this.rank-2]} < ${e[this.rank-2]}) { - ++${a[this.rank-2]}; - result.z = ${s}; + ++${r[this.rank-2]}; + result.z = ${a}; if (++${n[this.rank-1]} < ${e[this.rank-1]}) { - ++${a[this.rank-1]}; - result.w = ${s}; + ++${r[this.rank-1]}; + result.w = ${a}; } } `,l=this.rank<=4?`sourceLoc = coords + - ${t}(${e.map((u,d)=>`start[${d}]`).join()});`:e.map((u,d)=>`${a[d]} = ${n[d]} + start[${d}];`).join(` + ${t}(${e.map((u,c)=>`start[${c}]`).join()});`:e.map((u,c)=>`${r[c]} = ${n[c]} + start[${c}];`).join(` `);this.userCode=` uniform int start[${this.rank}]; void main() { @@ -1854,11 +1854,11 @@ return (log(1.0 + x) - log(1.0 - x)) / 2.0;`,x0e=ot({opSnippet:A0e}),b0e={kernel ${t} sourceLoc; ${l} vec4 result = vec4(0.); - ${i} ${o} + ${i} setOutput(result); } - `}getCustomSetupFunc(e){if(e.length!==this.rank)throw Error(`The rank (${this.rank}) of the program must match the length of start (${e.length})`);return(t,n)=>{this.startLoc==null&&(this.startLoc=t.getUniformLocationNoThrow(n,"start"),this.startLoc==null)||t.gl.uniform1iv(this.startLoc,e)}}};function W0e(e,t,n,a){let r=a.texData.get(e.dataId),s=a.makeTensorInfo(n,e.dtype),i=a.texData.get(s.dataId);Object.assign(i,r),i.refCount=1,i.shape=n,i.dtype=e.dtype;let o=Cn.computeFlatOffset(t,k.computeStrides(e.shape));r.slice&&(o+=r.slice.flatOffset),i.slice={flatOffset:o,origDataId:r.slice&&r.slice.origDataId||e.dataId};let l=a.dataRefCount.get(i.slice.origDataId)||1;return a.dataRefCount.set(i.slice.origDataId,l+1),s}function fp(e){let{inputs:t,backend:n,attrs:a}=e,{x:r}=t,{begin:s,size:i}=a,[o,l]=Cn.parseSliceParams(r,s,i);if(Cn.assertParamsValid(r,o,l),k.sizeFromShape(l)===0)return n.makeTensorInfo(l,r.dtype,[]);if(n.shouldExecuteOnCPU([r])||r.dtype==="string"){let h=n.texData.get(r.dataId),p=Nce(h.values,o,l,r.shape,r.dtype);return n.makeTensorInfo(l,r.dtype,p)}let{isPacked:u}=n.texData.get(r.dataId),d=Cn.isSliceContinous(r.shape,o,l);if(u||!d){let h=se().getBool("WEBGL_PACK_ARRAY_OPERATIONS")?new L0e(l):new z0e(l),p=h.getCustomSetupFunc(o);return n.runWebGLProgram(h,[r],r.dtype,p)}return n.uploadToGPU(r.dataId),W0e(r,o,l,n)}var B0e={kernelName:ah,backendName:"webgl",kernelFunc:fp},V0e=e=>{let{inputs:t,backend:n,attrs:a}=e,{x:r}=t,{blockShape:s,crops:i}=a;k.assert(r.shape.length<=4,()=>"batchToSpaceND for rank > 4 with a WebGL backend not implemented yet");let o=s.reduce((A,x)=>A*x),l=M.getReshaped(r.shape,s,o),u=M.getPermuted(l.length,s.length),d=M.getReshapedPermuted(r.shape,s,o),h=M.getSliceBeginCoords(i,s.length),p=M.getSliceSize(d,i,s.length),c=[],m=be({inputs:{x:r},backend:n,attrs:{shape:l}}),f=Vn({inputs:{x:m},backend:n,attrs:{perm:u}}),g=be({inputs:{x:f},backend:n,attrs:{shape:d}}),y=fp({inputs:{x:g},backend:n,attrs:{begin:h,size:p}});return c.push(m),c.push(f),c.push(g),c.forEach(A=>n.disposeIntermediateTensorInfo(A)),y},U0e={kernelName:Xc,backendName:"webgl",kernelFunc:V0e};function j0e(e){let{inputs:t,backend:n,attrs:a}=e,{x:r,weights:s}=t,{size:i}=a,o=n.readSync(r.dataId),l=n.readSync(s.dataId),u=dE(o,l,s.dtype,s.shape,i);return n.makeTensorInfo([i],s.dtype,u)}var H0e={kernelName:w1,backendName:"webgl",kernelFunc:j0e},G0e="return float(a != b);",PE=Tn({opSnippet:G0e,cpuKernelImpl:wce,dtype:"bool"}),q0e={kernelName:vl,backendName:"webgl",kernelFunc:PE};function mp(e){let{inputs:t,backend:n}=e,{input:a}=t,r=n.texData.get(a.dataId);return fa({inputs:{x:r.complexTensorInfos.real},backend:n})}var K0e={kernelName:j1,backendName:"webgl",kernelFunc:mp},X0e="return float(int(x));";function Z0e(e,t){let n=new Qs(e.shape,X0e),a=t.runWebGLProgram(n,[e],"int32");return{dataId:a.dataId,shape:a.shape,dtype:a.dtype}}function db(e){let{inputs:t,backend:n,attrs:a}=e,{x:r}=t,{dtype:s}=a;if(s==="complex64"){if(r.dtype==="complex64")return fa({inputs:{x:r},backend:n});let i=un(r.shape),o=db({inputs:{x:r},backend:n,attrs:{dtype:"float32"}}),l=ei({inputs:{real:o,imag:i},backend:n});return i.dispose(),n.disposeIntermediateTensorInfo(o),l}if(r.dtype==="complex64"){let i=mp({inputs:{input:r},backend:n}),o=db({inputs:{x:i},backend:n,attrs:{dtype:s}});return n.disposeIntermediateTensorInfo(i),o}if(!k.hasEncodingLoss(r.dtype,s)){let i=fa({inputs:{x:r},backend:n});return{dataId:i.dataId,shape:i.shape,dtype:s}}if(s==="int32")return Z0e(r,n);if(s==="bool"){let i=n.makeTensorInfo([],"bool",k.getTypedArrayFromDType("bool",1)),o=PE({inputs:{a:r,b:i},backend:n});return n.disposeIntermediateTensorInfo(i),o}throw new Error(`Error in Cast: failed to cast ${r.dtype} to ${s}`)}var Y0e={kernelName:el,backendName:"webgl",kernelFunc:db},LE="return ceil(x);",J0e=ot({opSnippet:LE,packedOpSnippet:LE,cpuKernelImpl:ace}),Q0e={kernelName:Ni,backendName:"webgl",kernelFunc:J0e},eme=class{constructor(e){this.variableNames=["A"],this.outputShape=e,this.userCode=` + `}getCustomSetupFunc(e){if(e.length!==this.rank)throw Error(`The rank (${this.rank}) of the program must match the length of start (${e.length})`);return(t,n)=>{this.startLoc==null&&(this.startLoc=t.getUniformLocationNoThrow(n,"start"),this.startLoc==null)||t.gl.uniform1iv(this.startLoc,e)}}};function Bme(e,t,n,r){let s=r.texData.get(e.dataId),a=r.makeTensorInfo(n,e.dtype),o=r.texData.get(a.dataId);Object.assign(o,s),o.refCount=1,o.shape=n,o.dtype=e.dtype;let i=En.computeFlatOffset(t,k.computeStrides(e.shape));s.slice&&(i+=s.slice.flatOffset),o.slice={flatOffset:i,origDataId:s.slice&&s.slice.origDataId||e.dataId};let l=r.dataRefCount.get(o.slice.origDataId)||1;return r.dataRefCount.set(o.slice.origDataId,l+1),a}function fh(e){let{inputs:t,backend:n,attrs:r}=e,{x:s}=t,{begin:a,size:o}=r,[i,l]=En.parseSliceParams(s,a,o);if(En.assertParamsValid(s,i,l),k.sizeFromShape(l)===0)return n.makeTensorInfo(l,s.dtype,[]);if(n.shouldExecuteOnCPU([s])||s.dtype==="string"){let d=n.texData.get(s.dataId),h=Tpe(d.values,i,l,s.shape,s.dtype);return n.makeTensorInfo(l,s.dtype,h)}let{isPacked:u}=n.texData.get(s.dataId),c=En.isSliceContinous(s.shape,i,l);if(u||!c){let d=ae().getBool("WEBGL_PACK_ARRAY_OPERATIONS")?new Lme(l):new Pme(l),h=d.getCustomSetupFunc(i);return n.runWebGLProgram(d,[s],s.dtype,h)}return n.uploadToGPU(s.dataId),Bme(s,i,l,n)}var Wme={kernelName:rd,backendName:"webgl",kernelFunc:fh},Vme=e=>{let{inputs:t,backend:n,attrs:r}=e,{x:s}=t,{blockShape:a,crops:o}=r;k.assert(s.shape.length<=4,()=>"batchToSpaceND for rank > 4 with a WebGL backend not implemented yet");let i=a.reduce((A,x)=>A*x),l=_.getReshaped(s.shape,a,i),u=_.getPermuted(l.length,a.length),c=_.getReshapedPermuted(s.shape,a,i),d=_.getSliceBeginCoords(o,a.length),h=_.getSliceSize(c,o,a.length),p=[],f=ve({inputs:{x:s},backend:n,attrs:{shape:l}}),m=Un({inputs:{x:f},backend:n,attrs:{perm:u}}),g=ve({inputs:{x:m},backend:n,attrs:{shape:c}}),y=fh({inputs:{x:g},backend:n,attrs:{begin:d,size:h}});return p.push(f),p.push(m),p.push(g),p.forEach(A=>n.disposeIntermediateTensorInfo(A)),y},Ume={kernelName:Xp,backendName:"webgl",kernelFunc:Vme};function Hme(e){let{inputs:t,backend:n,attrs:r}=e,{x:s,weights:a}=t,{size:o}=r,i=n.readSync(s.dataId),l=n.readSync(a.dataId),u=cE(i,l,a.dtype,a.shape,o);return n.makeTensorInfo([o],a.dtype,u)}var Gme={kernelName:ky,backendName:"webgl",kernelFunc:Hme},jme="return float(a != b);",zE=Nn({opSnippet:jme,cpuKernelImpl:wpe,dtype:"bool"}),qme={kernelName:vl,backendName:"webgl",kernelFunc:zE};function mh(e){let{inputs:t,backend:n}=e,{input:r}=t,s=n.texData.get(r.dataId);return mr({inputs:{x:s.complexTensorInfos.real},backend:n})}var Kme={kernelName:Gy,backendName:"webgl",kernelFunc:mh},Xme="return float(int(x));";function Zme(e,t){let n=new Qa(e.shape,Xme),r=t.runWebGLProgram(n,[e],"int32");return{dataId:r.dataId,shape:r.shape,dtype:r.dtype}}function cb(e){let{inputs:t,backend:n,attrs:r}=e,{x:s}=t,{dtype:a}=r;if(a==="complex64"){if(s.dtype==="complex64")return mr({inputs:{x:s},backend:n});let o=un(s.shape),i=cb({inputs:{x:s},backend:n,attrs:{dtype:"float32"}}),l=eo({inputs:{real:i,imag:o},backend:n});return o.dispose(),n.disposeIntermediateTensorInfo(i),l}if(s.dtype==="complex64"){let o=mh({inputs:{input:s},backend:n}),i=cb({inputs:{x:o},backend:n,attrs:{dtype:a}});return n.disposeIntermediateTensorInfo(o),i}if(!k.hasEncodingLoss(s.dtype,a)){let o=mr({inputs:{x:s},backend:n});return{dataId:o.dataId,shape:o.shape,dtype:a}}if(a==="int32")return Zme(s,n);if(a==="bool"){let o=n.makeTensorInfo([],"bool",k.getTypedArrayFromDType("bool",1)),l=zE({inputs:{a:s,b:o},backend:n});return n.disposeIntermediateTensorInfo(o),l}throw new Error(`Error in Cast: failed to cast ${s.dtype} to ${a}`)}var Yme={kernelName:el,backendName:"webgl",kernelFunc:cb},LE="return ceil(x);",Jme=it({opSnippet:LE,packedOpSnippet:LE,cpuKernelImpl:rpe}),Qme={kernelName:No,backendName:"webgl",kernelFunc:Jme},e0e=class{constructor(e){this.variableNames=["A"],this.outputShape=e,this.userCode=` uniform float minVal; uniform float maxVal; @@ -1871,7 +1871,7 @@ return (log(1.0 + x) - log(1.0 - x)) / 2.0;`,x0e=ot({opSnippet:A0e}),b0e={kernel setOutput(clamp(value, minVal, maxVal)); } - `}getCustomSetupFunc(e,t){return(n,a)=>{this.minLoc==null&&(this.minLoc=n.getUniformLocationNoThrow(a,"minVal"),this.maxLoc=n.getUniformLocationNoThrow(a,"maxVal")),n.gl.uniform1f(this.minLoc,e),n.gl.uniform1f(this.maxLoc,t)}}},tme=class{constructor(e){this.variableNames=["A"],this.packedInputs=!0,this.packedOutput=!0,this.outputShape=e,this.userCode=` + `}getCustomSetupFunc(e,t){return(n,r)=>{this.minLoc==null&&(this.minLoc=n.getUniformLocationNoThrow(r,"minVal"),this.maxLoc=n.getUniformLocationNoThrow(r,"maxVal")),n.gl.uniform1f(this.minLoc,e),n.gl.uniform1f(this.maxLoc,t)}}},t0e=class{constructor(e){this.variableNames=["A"],this.packedInputs=!0,this.packedOutput=!0,this.outputShape=e,this.userCode=` uniform float minVal; uniform float maxVal; @@ -1885,7 +1885,7 @@ return (log(1.0 + x) - log(1.0 - x)) / 2.0;`,x0e=ot({opSnippet:A0e}),b0e={kernel setOutput(clamp(value, vec4(minVal), vec4(maxVal))); } - `}getCustomSetupFunc(e,t){return(n,a)=>{this.minLoc==null&&(this.minLoc=n.getUniformLocationNoThrow(a,"minVal"),this.maxLoc=n.getUniformLocationNoThrow(a,"maxVal")),n.gl.uniform1f(this.minLoc,e),n.gl.uniform1f(this.maxLoc,t)}}};function nme(e){let{inputs:t,backend:n,attrs:a}=e,{x:r}=t,{clipValueMin:s,clipValueMax:i}=a,o;se().getBool("WEBGL_PACK_CLIP")?o=new tme(r.shape):o=new eme(r.shape);let l=o.getCustomSetupFunc(s,i);return n.runWebGLProgram(o,[r],r.dtype,l)}var ame={kernelName:Ti,backendName:"webgl",kernelFunc:nme},rme=class{constructor(e){this.variableNames=["real","imag"],this.outputShape=e,this.userCode=` + `}getCustomSetupFunc(e,t){return(n,r)=>{this.minLoc==null&&(this.minLoc=n.getUniformLocationNoThrow(r,"minVal"),this.maxLoc=n.getUniformLocationNoThrow(r,"maxVal")),n.gl.uniform1f(this.minLoc,e),n.gl.uniform1f(this.maxLoc,t)}}};function n0e(e){let{inputs:t,backend:n,attrs:r}=e,{x:s}=t,{clipValueMin:a,clipValueMax:o}=r,i;ae().getBool("WEBGL_PACK_CLIP")?i=new t0e(s.shape):i=new e0e(s.shape);let l=i.getCustomSetupFunc(a,o);return n.runWebGLProgram(i,[s],s.dtype,l)}var r0e={kernelName:Co,backendName:"webgl",kernelFunc:n0e},s0e=class{constructor(e){this.variableNames=["real","imag"],this.outputShape=e,this.userCode=` void main() { float re = abs(getRealAtOutCoords()); float im = abs(getImagAtOutCoords()); @@ -1898,7 +1898,7 @@ return (log(1.0 + x) - log(1.0 - x)) / 2.0;`,x0e=ot({opSnippet:A0e}),b0e={kernel mx == 0.0 ? 0.0 : mx * length(vec2(1, min(re, im)/mx)) ); } - `}};function WE(e,t){return{dataId:t.dataId,dtype:t.dtype,shape:e.shape}}function sme(e){let{inputs:t,backend:n}=e,{x:a}=t,r=n.texData.get(a.dataId),s=new rme(a.shape),i=[WE(a,r.complexTensorInfos.real),WE(a,r.complexTensorInfos.imag)];return n.runWebGLProgram(s,i,i[0].dtype)}var ime={kernelName:Zc,backendName:"webgl",kernelFunc:sme},ome=class{constructor(e){this.outputShape=[],this.outputShape=M.computeOutShape(e,1),this.variableNames=e.map((s,i)=>`T${i}`);let t=new Array(e.length-1);t[0]=e[0][1];for(let s=1;s`T${o}`);let t=new Array(e.length-1);t[0]=e[0][1];for(let a=1;a`T${f}`);let o=new Array(e.length-1);o[0]=e[0][t];for(let m=1;m`T${m}`);let i=new Array(e.length-1);i[0]=e[0][t];for(let f=1;f= ${o[m-1]}) { + getT0(${c}), vec2(${u.join()})); + }`;for(let f=1;f= ${i[f-1]}) { return getChannel( - getT${m}(${X0(i,l,f)}), - vec2(${X0(u,l,f)})); - }`}let p=o.length,c=o[o.length-1];h+=` + getT${f}(${Zm(o,l,m)}), + vec2(${Zm(u,l,m)})); + }`}let h=i.length,p=i[i.length-1];d+=` return getChannel( - getT${p}(${X0(i,l,c)}), - vec2(${X0(u,l,c)}));`,this.userCode=` - float getValue(${i.map(m=>"int "+m)}) { - ${h} + getT${h}(${Zm(o,l,p)}), + vec2(${Zm(u,l,p)}));`,this.userCode=` + float getValue(${o.map(f=>"int "+f)}) { + ${d} } void main() { - ${r} coords = getOutputCoords(); - vec4 result = vec4(getValue(${s}), 0., 0., 0.); + ${s} coords = getOutputCoords(); + vec4 result = vec4(getValue(${a}), 0., 0., 0.); - ${s[a-1]} = ${s[a-1]} + 1; - if (${s[a-1]} < ${n[a-1]}) { - result.g = getValue(${s}); + ${a[r-1]} = ${a[r-1]} + 1; + if (${a[r-1]} < ${n[r-1]}) { + result.g = getValue(${a}); } - ${s[a-2]} = ${s[a-2]} + 1; - if (${s[a-2]} < ${n[a-2]}) { - result.a = getValue(${s}); + ${a[r-2]} = ${a[r-2]} + 1; + if (${a[r-2]} < ${n[r-2]}) { + result.a = getValue(${a}); } - ${s[a-1]} = ${s[a-1]} - 1; - if (${s[a-2]} < ${n[a-2]} && - ${s[a-1]} < ${n[a-1]}) { - result.b = getValue(${s}); + ${a[r-1]} = ${a[r-1]} - 1; + if (${a[r-2]} < ${n[r-2]} && + ${a[r-1]} < ${n[r-1]}) { + result.b = getValue(${a}); } setOutput(result); } - `}};function X0(e,t,n){let a=e.indexOf(t);return e.map((r,s)=>s===a?`${r} - ${n}`:r).join()}function Z0(e){let{inputs:t,backend:n}=e,{input:a}=t,r=n.texData.get(a.dataId);return fa({inputs:{x:r.complexTensorInfos.imag},backend:n})}var ume={kernelName:z1,backendName:"webgl",kernelFunc:Z0};function Iu(e,t,n){let a=e[0].dtype;if(a==="complex64"){let d=e.map(f=>mp({inputs:{input:f},backend:n})),h=e.map(f=>Z0({inputs:{input:f},backend:n})),p=Iu(d,t,n),c=Iu(h,t,n),m=ei({inputs:{real:p,imag:c},backend:n});return d.forEach(f=>n.disposeIntermediateTensorInfo(f)),h.forEach(f=>n.disposeIntermediateTensorInfo(f)),n.disposeIntermediateTensorInfo(p),n.disposeIntermediateTensorInfo(c),m}let r=n.shouldExecuteOnCPU(e);if(a==="string"&&(r=!0),r){let d=e.map(y=>{let A=k.sizeFromShape(y.shape.slice(t));return be({inputs:{x:y},backend:n,attrs:{shape:[-1,A]}})}),h=d.map(y=>({vals:n.readSync(y.dataId),shape:y.shape})),p=M.computeOutShape(d.map(y=>y.shape),1),c=d[0].shape[0]===1,m=rce(h,p,a,c),f=M.computeOutShape(e.map(y=>y.shape),t),g=n.makeTensorInfo(f,a,m);return d.forEach(y=>n.disposeIntermediateTensorInfo(y)),g}if(e.length>se().getNumber("WEBGL_MAX_TEXTURES_IN_SHADER")){let d=Math.floor(e.length/2),h=Iu(e.slice(0,d),t,n),p=Iu(e.slice(d),t,n),c=Iu([h,p],t,n);return n.disposeIntermediateTensorInfo(h),n.disposeIntermediateTensorInfo(p),c}if(se().getBool("WEBGL_PACK_ARRAY_OPERATIONS")&&e[0].shape.length>1){let d=new lme(e.map(h=>h.shape),t);return n.runWebGLProgram(d,e,a)}let{tensors2D:s,outShape:i}=dme(e,t,n),o=new ome(s.map(d=>d.shape)),l=n.runWebGLProgram(o,s,a);s.forEach(d=>n.disposeIntermediateTensorInfo(d));let u=be({inputs:{x:l},attrs:{shape:i},backend:n});return n.disposeIntermediateTensorInfo(l),u}function dme(e,t,n){let a=M.computeOutShape(e.map(r=>r.shape),t);return{tensors2D:e.map(r=>be({inputs:{x:r},attrs:{shape:[-1,k.sizeFromShape(r.shape.slice(t))]},backend:n})),outShape:a}}function BE(e){let{inputs:t,backend:n,attrs:a}=e,{axis:r}=a,s=k.parseAxisParam(r,t[0].shape)[0],i=M.computeOutShape(t.map(u=>u.shape),s);if(k.sizeFromShape(i)===0)return n.makeTensorInfo(i,t[0].dtype,[]);let o=t.filter(u=>k.sizeFromShape(u.shape)>0);if(o.length===1)return fa({inputs:{x:o[0]},backend:n});let l=o.map(u=>u.shape);return M.assertParamsConsistent(l,s),Iu(o,s,n)}var hme={kernelName:Cd,backendName:"webgl",kernelFunc:BE},VE=class{constructor(e,t=!1,n=null,a=!1,r=!1){this.variableNames=["x","W"],this.outputShape=e.outShape;let s=e.padInfo.top,i=e.padInfo.left,o=e.strideHeight,l=e.strideWidth,u=e.dilationHeight,d=e.dilationWidth,h=e.filterHeight,p=e.filterWidth,c=Math.floor(e.inChannels/4)*4,m=e.inChannels%4,f=e.dataFormat==="channelsLast",g=f?1:2,y=f?2:3,A=f?3:1,x="",v="";n&&(a?x=`float activation(float a) { + `}};function Zm(e,t,n){let r=e.indexOf(t);return e.map((a,o)=>o===r?`${a} - ${n}`:a).join()}function Ym(e){let{inputs:t,backend:n}=e,{input:r}=t,s=n.texData.get(r.dataId);return mr({inputs:{x:s.complexTensorInfos.imag},backend:n})}var u0e={kernelName:zy,backendName:"webgl",kernelFunc:Ym};function Iu(e,t,n){let r=e[0].dtype;if(r==="complex64"){let c=e.map(m=>mh({inputs:{input:m},backend:n})),d=e.map(m=>Ym({inputs:{input:m},backend:n})),h=Iu(c,t,n),p=Iu(d,t,n),f=eo({inputs:{real:h,imag:p},backend:n});return c.forEach(m=>n.disposeIntermediateTensorInfo(m)),d.forEach(m=>n.disposeIntermediateTensorInfo(m)),n.disposeIntermediateTensorInfo(h),n.disposeIntermediateTensorInfo(p),f}let s=n.shouldExecuteOnCPU(e);if(r==="string"&&(s=!0),s){let c=e.map(y=>{let A=k.sizeFromShape(y.shape.slice(t));return ve({inputs:{x:y},backend:n,attrs:{shape:[-1,A]}})}),d=c.map(y=>({vals:n.readSync(y.dataId),shape:y.shape})),h=_.computeOutShape(c.map(y=>y.shape),1),p=c[0].shape[0]===1,f=spe(d,h,r,p),m=_.computeOutShape(e.map(y=>y.shape),t),g=n.makeTensorInfo(m,r,f);return c.forEach(y=>n.disposeIntermediateTensorInfo(y)),g}if(e.length>ae().getNumber("WEBGL_MAX_TEXTURES_IN_SHADER")){let c=Math.floor(e.length/2),d=Iu(e.slice(0,c),t,n),h=Iu(e.slice(c),t,n),p=Iu([d,h],t,n);return n.disposeIntermediateTensorInfo(d),n.disposeIntermediateTensorInfo(h),p}if(ae().getBool("WEBGL_PACK_ARRAY_OPERATIONS")&&e[0].shape.length>1){let c=new l0e(e.map(d=>d.shape),t);return n.runWebGLProgram(c,e,r)}let{tensors2D:a,outShape:o}=c0e(e,t,n),i=new i0e(a.map(c=>c.shape)),l=n.runWebGLProgram(i,a,r);a.forEach(c=>n.disposeIntermediateTensorInfo(c));let u=ve({inputs:{x:l},attrs:{shape:o},backend:n});return n.disposeIntermediateTensorInfo(l),u}function c0e(e,t,n){let r=_.computeOutShape(e.map(a=>a.shape),t);return{tensors2D:e.map(a=>ve({inputs:{x:a},attrs:{shape:[-1,k.sizeFromShape(a.shape.slice(t))]},backend:n})),outShape:r}}function WE(e){let{inputs:t,backend:n,attrs:r}=e,{axis:s}=r,a=k.parseAxisParam(s,t[0].shape)[0],o=_.computeOutShape(t.map(u=>u.shape),a);if(k.sizeFromShape(o)===0)return n.makeTensorInfo(o,t[0].dtype,[]);let i=t.filter(u=>k.sizeFromShape(u.shape)>0);if(i.length===1)return mr({inputs:{x:i[0]},backend:n});let l=i.map(u=>u.shape);return _.assertParamsConsistent(l,a),Iu(i,a,n)}var d0e={kernelName:Ec,backendName:"webgl",kernelFunc:WE},VE=class{constructor(e,t=!1,n=null,r=!1,s=!1){this.variableNames=["x","W"],this.outputShape=e.outShape;let a=e.padInfo.top,o=e.padInfo.left,i=e.strideHeight,l=e.strideWidth,u=e.dilationHeight,c=e.dilationWidth,d=e.filterHeight,h=e.filterWidth,p=Math.floor(e.inChannels/4)*4,f=e.inChannels%4,m=e.dataFormat==="channelsLast",g=m?1:2,y=m?2:3,A=m?3:1,x="",b="";n&&(r?x=`float activation(float a) { float b = getPreluActivationWeightsAtOutCoords(); ${n} - }`:r?x=`float activation(float a) { + }`:s?x=`float activation(float a) { float b = getLeakyreluAlphaAtOutCoords(); ${n} }`:x=` float activation(float x) { ${n} } - `,v="result = activation(result);");let b=t?"result += getBiasAtOutCoords();":"";t&&this.variableNames.push("bias"),a&&this.variableNames.push("preluActivationWeights"),r&&this.variableNames.push("leakyreluAlpha"),this.userCode=` + `,b="result = activation(result);");let v=t?"result += getBiasAtOutCoords();":"";t&&this.variableNames.push("bias"),r&&this.variableNames.push("preluActivationWeights"),s&&this.variableNames.push("leakyreluAlpha"),this.userCode=` ${x} - const ivec2 strides = ivec2(${o}, ${l}); - const ivec2 pads = ivec2(${s}, ${i}); + const ivec2 strides = ivec2(${i}, ${l}); + const ivec2 pads = ivec2(${a}, ${o}); void main() { ivec4 coords = getOutputCoords(); @@ -1973,21 +1973,21 @@ return (log(1.0 + x) - log(1.0 - x)) / 2.0;`,x0e=ot({opSnippet:A0e}),b0e={kernel // Convolve x(?, ?, d1) with w(:, :, d1, d2) to get y(yR, yC, d2). // ? = to be determined. : = across all values in that axis. float dotProd = 0.0; - for (int wR = 0; wR < ${h}; wR++) { + for (int wR = 0; wR < ${d}; wR++) { int xR = xRCorner + wR * ${u}; if (xR < 0 || xR >= ${e.inHeight}) { continue; } - for (int wC = 0; wC < ${p}; wC++) { - int xC = xCCorner + wC * ${d}; + for (int wC = 0; wC < ${h}; wC++) { + int xC = xCCorner + wC * ${c}; if (xC < 0 || xC >= ${e.inWidth}) { continue; } - for (int d1 = 0; d1 < ${c}; d1 += 4) { + for (int d1 = 0; d1 < ${p}; d1 += 4) { vec4 wValues = vec4( getW(wR, wC, d1, d2), getW(wR, wC, d1 + 1, d2), @@ -1995,7 +1995,7 @@ return (log(1.0 + x) - log(1.0 - x)) / 2.0;`,x0e=ot({opSnippet:A0e}),b0e={kernel getW(wR, wC, d1 + 3, d2) ); - if (${f}) { + if (${m}) { vec4 xValues = vec4( getX(batch, xR, xC, d1), getX(batch, xR, xC, d1 + 1), @@ -2014,57 +2014,57 @@ return (log(1.0 + x) - log(1.0 - x)) / 2.0;`,x0e=ot({opSnippet:A0e}),b0e={kernel } } - if (${m===1}) { + if (${f===1}) { - if (${f}) { + if (${m}) { dotProd += - getX(batch, xR, xC, ${c}) * - getW(wR, wC, ${c}, d2); + getX(batch, xR, xC, ${p}) * + getW(wR, wC, ${p}, d2); } else { dotProd += - getX(batch, ${c}, xR, xC) * - getW(wR, wC, ${c}, d2); + getX(batch, ${p}, xR, xC) * + getW(wR, wC, ${p}, d2); } - } else if (${m===2}) { + } else if (${f===2}) { vec2 wValues = vec2( - getW(wR, wC, ${c}, d2), - getW(wR, wC, ${c} + 1, d2) + getW(wR, wC, ${p}, d2), + getW(wR, wC, ${p} + 1, d2) ); - if (${f}) { + if (${m}) { vec2 xValues = vec2( - getX(batch, xR, xC, ${c}), - getX(batch, xR, xC, ${c} + 1) + getX(batch, xR, xC, ${p}), + getX(batch, xR, xC, ${p} + 1) ); dotProd += dot(xValues, wValues); } else { vec2 xValues = vec2( - getX(batch, ${c}, xR, xC), - getX(batch, ${c} + 1, xR, xC) + getX(batch, ${p}, xR, xC), + getX(batch, ${p} + 1, xR, xC) ); dotProd += dot(xValues, wValues); } - } else if (${m===3}) { + } else if (${f===3}) { vec3 wValues = vec3( - getW(wR, wC, ${c}, d2), - getW(wR, wC, ${c} + 1, d2), - getW(wR, wC, ${c} + 2, d2) + getW(wR, wC, ${p}, d2), + getW(wR, wC, ${p} + 1, d2), + getW(wR, wC, ${p} + 2, d2) ); - if (${f}) { + if (${m}) { vec3 xValues = vec3( - getX(batch, xR, xC, ${c}), - getX(batch, xR, xC, ${c} + 1), - getX(batch, xR, xC, ${c} + 2) + getX(batch, xR, xC, ${p}), + getX(batch, xR, xC, ${p} + 1), + getX(batch, xR, xC, ${p} + 2) ); dotProd += dot(xValues, wValues); } else { vec3 xValues = vec3( - getX(batch, ${c}, xR, xC), - getX(batch, ${c} + 1, xR, xC), - getX(batch, ${c} + 2, xR, xC) + getX(batch, ${p}, xR, xC), + getX(batch, ${p} + 1, xR, xC), + getX(batch, ${p} + 2, xR, xC) ); dotProd += dot(xValues, wValues); } @@ -2074,13 +2074,13 @@ return (log(1.0 + x) - log(1.0 - x)) / 2.0;`,x0e=ot({opSnippet:A0e}),b0e={kernel } float result = dotProd; - ${b} ${v} + ${b} setOutput(result); } - `}},pme=class{constructor(e){this.variableNames=["x","W"],this.outputShape=e.outShape;let t=e.padInfo.front,n=e.padInfo.top,a=e.padInfo.left,r=e.strideDepth,s=e.strideHeight,i=e.strideWidth,o=e.dilationDepth,l=e.dilationHeight,u=e.dilationWidth,d=e.filterDepth,h=e.filterHeight,p=e.filterWidth,c=Math.floor(e.inChannels/4)*4,m=e.inChannels%4;this.userCode=` - const ivec3 strides = ivec3(${r}, ${s}, ${i}); - const ivec3 pads = ivec3(${t}, ${n}, ${a}); + `}},h0e=class{constructor(e){this.variableNames=["x","W"],this.outputShape=e.outShape;let t=e.padInfo.front,n=e.padInfo.top,r=e.padInfo.left,s=e.strideDepth,a=e.strideHeight,o=e.strideWidth,i=e.dilationDepth,l=e.dilationHeight,u=e.dilationWidth,c=e.filterDepth,d=e.filterHeight,h=e.filterWidth,p=Math.floor(e.inChannels/4)*4,f=e.inChannels%4;this.userCode=` + const ivec3 strides = ivec3(${s}, ${a}, ${o}); + const ivec3 pads = ivec3(${t}, ${n}, ${r}); void main() { ivec5 coords = getOutputCoords(); @@ -2096,28 +2096,28 @@ return (log(1.0 + x) - log(1.0 - x)) / 2.0;`,x0e=ot({opSnippet:A0e}),b0e={kernel // y(yF, yR, yC, d2). ? = to be determined. : = across all // values in that axis. float dotProd = 0.0; - for (int wF = 0; wF < ${d}; wF++) { - int xF = xFCorner + wF * ${o}; + for (int wF = 0; wF < ${c}; wF++) { + int xF = xFCorner + wF * ${i}; if (xF < 0 || xF >= ${e.inDepth}) { continue; } - for (int wR = 0; wR < ${h}; wR++) { + for (int wR = 0; wR < ${d}; wR++) { int xR = xRCorner + wR * ${l}; if (xR < 0 || xR >= ${e.inHeight}) { continue; } - for (int wC = 0; wC < ${p}; wC++) { + for (int wC = 0; wC < ${h}; wC++) { int xC = xCCorner + wC * ${u}; if (xC < 0 || xC >= ${e.inWidth}) { continue; } - for (int d1 = 0; d1 < ${c}; d1 += 4) { + for (int d1 = 0; d1 < ${p}; d1 += 4) { vec4 xValues = vec4( getX(batch, xF, xR, xC, d1), getX(batch, xF, xR, xC, d1 + 1), @@ -2134,30 +2134,30 @@ return (log(1.0 + x) - log(1.0 - x)) / 2.0;`,x0e=ot({opSnippet:A0e}),b0e={kernel dotProd += dot(xValues, wValues); } - if (${m===1}) { + if (${f===1}) { dotProd += - getX(batch, xF, xR, xC, ${c}) * - getW(wF, wR, wC, ${c}, d2); - } else if (${m===2}) { + getX(batch, xF, xR, xC, ${p}) * + getW(wF, wR, wC, ${p}, d2); + } else if (${f===2}) { vec2 xValues = vec2( - getX(batch, xF, xR, xC, ${c}), - getX(batch, xF, xR, xC, ${c} + 1) + getX(batch, xF, xR, xC, ${p}), + getX(batch, xF, xR, xC, ${p} + 1) ); vec2 wValues = vec2( - getW(wF, wR, wC, ${c}, d2), - getW(wF, wR, wC, ${c} + 1, d2) + getW(wF, wR, wC, ${p}, d2), + getW(wF, wR, wC, ${p} + 1, d2) ); dotProd += dot(xValues, wValues); - } else if (${m===3}) { + } else if (${f===3}) { vec3 xValues = vec3( - getX(batch, xF, xR, xC, ${c}), - getX(batch, xF, xR, xC, ${c} + 1), - getX(batch, xF, xR, xC, ${c} + 2) + getX(batch, xF, xR, xC, ${p}), + getX(batch, xF, xR, xC, ${p} + 1), + getX(batch, xF, xR, xC, ${p} + 2) ); vec3 wValues = vec3( - getW(wF, wR, wC, ${c}, d2), - getW(wF, wR, wC, ${c} + 1, d2), - getW(wF, wR, wC, ${c} + 2, d2) + getW(wF, wR, wC, ${p}, d2), + getW(wF, wR, wC, ${p} + 1, d2), + getW(wF, wR, wC, ${p} + 2, d2) ); dotProd += dot(xValues, wValues); } @@ -2166,31 +2166,31 @@ return (log(1.0 + x) - log(1.0 - x)) / 2.0;`,x0e=ot({opSnippet:A0e}),b0e={kernel } setOutput(dotProd); } - `}},cme=class{constructor(e,t,n){this.variableNames=["A"],this.packedInputs=!0,this.packedOutput=!0,this.outputShape=e;let{filterWidth:a,inChannels:r,strideWidth:s,strideHeight:i,padInfo:o,outWidth:l,dilationWidth:u,dilationHeight:d,dataFormat:h}=n,{left:p,top:c}=o,m=r*a,f=Wn(),g=h==="channelsLast",y=g?0:1,A=g?1:2,x="";for(let v=0;v<=1;v++)for(let b=0;b<=1;b++)x+=` - blockIndex = rc.y + ${b}; - pos = rc.x + ${v}; + `}},p0e=class{constructor(e,t,n){this.variableNames=["A"],this.packedInputs=!0,this.packedOutput=!0,this.outputShape=e;let{filterWidth:r,inChannels:s,strideWidth:a,strideHeight:o,padInfo:i,outWidth:l,dilationWidth:u,dilationHeight:c,dataFormat:d}=n,{left:h,top:p}=i,f=s*r,m=Wn(),g=d==="channelsLast",y=g?0:1,A=g?1:2,x="";for(let b=0;b<=1;b++)for(let v=0;v<=1;v++)x+=` + blockIndex = rc.y + ${v}; + pos = rc.x + ${b}; if(blockIndex < ${e[1]} && pos < ${e[0]}) { - offsetY = int(blockIndex / (${l})) * ${i} - ${c}; - d0 = offsetY + ${d} * (pos / ${m}); + offsetY = int(blockIndex / (${l})) * ${o} - ${p}; + d0 = offsetY + ${c} * (pos / ${f}); if(d0 < ${t[y]} && d0 >= 0) { - offsetX = int(mod(float(blockIndex), ${l}.) * ${s}. - ${p}.); - d1 = offsetX + ${u} * (int(mod(float(pos), ${m}.) / ${r}.)); + offsetX = int(mod(float(blockIndex), ${l}.) * ${a}. - ${h}.); + d1 = offsetX + ${u} * (int(mod(float(pos), ${f}.) / ${s}.)); if(d1 < ${t[A]} && d1 >= 0) { - ch = int(mod(float(pos), ${r}.)); + ch = int(mod(float(pos), ${s}.)); if (${g}) { innerDims = vec2(d1, ch); - result[${v*2+b}] = getChannel( + result[${b*2+v}] = getChannel( getA(d0, int(innerDims.x), int(innerDims.y)), innerDims); } else { innerDims = vec2(d0, d1); - result[${v*2+b}] = getChannel( + result[${b*2+v}] = getChannel( getA(ch, int(innerDims.x), int(innerDims.y)), innerDims); } @@ -2208,9 +2208,9 @@ return (log(1.0 + x) - log(1.0 - x)) / 2.0;`,x0e=ot({opSnippet:A0e}),b0e={kernel ${x} - ${f.output} = result; + ${m.output} = result; } - `}};function UE({x:e,filter:t,convInfo:n,backend:a,bias:r=null,preluActivationWeights:s=null,leakyreluAlpha:i=0,activation:o=null}){let l=e.shape,u=a.texData.get(e.dataId),d=n.inChannels,h=l[0]*l[1]*l[2],p=n.outChannels,c=n.dataFormat==="channelsLast",m=!1,f=!1,g,y=[],A=(h===1||p===1)&&d>RE,x=l[2]%2!=0&&!!u.isPacked;if(A||!se().getBool("WEBGL_LAZILY_UNPACK")||!se().getBool("WEBGL_PACK_BINARY_OPERATIONS")||!x){let v=c?l[0]*l[1]*l[2]:l[0]*l[2]*l[3],b=be({inputs:{x:e},backend:a,attrs:{shape:[1,v,n.inChannels]}}),w=be({inputs:{x:t},backend:a,attrs:{shape:[1,n.inChannels,n.outChannels]}}),I=q0({a:b,b:w,transposeA:m,transposeB:f,backend:a,bias:r,activation:o,preluActivationWeights:s,leakyreluAlpha:i});g=be({inputs:{x:I},backend:a,attrs:{shape:n.outShape}}),y.push(b),y.push(w),y.push(I)}else{let v=c?l[0]*l[1]*(l[2]+1):l[0]*l[2]*(l[3]+1),b={dataId:e.dataId,shape:[1,v,n.inChannels],dtype:e.dtype},w=u.shape;u.shape=u.shape.slice(),u.shape[u.shape.length-2]++,k.assert(up(u.shape,b.shape),()=>`packed reshape ${u.shape} to ${b.shape} isn't free`);let I=be({inputs:{x:t},backend:a,attrs:{shape:[1,n.inChannels,n.outChannels]}});y.push(I);let T=q0({a:b,b:I,backend:a,transposeA:m,transposeB:f,bias:r,activation:o,preluActivationWeights:s,leakyreluAlpha:i}),C=a.texData.get(T.dataId);k.assert(C.isPacked,()=>"batchMatMul result is expected to be packed"),u.shape=w,C.shape=n.outShape,g=fa({inputs:{x:T},backend:a}),g.shape=n.outShape,y.push(T)}for(let v of y)a.disposeIntermediateTensorInfo(v);return g}function jE({x:e,filter:t,convInfo:n,backend:a,bias:r=null,preluActivationWeights:s=null,leakyreluAlpha:i=0,activation:o=null}){let{filterWidth:l,filterHeight:u,inChannels:d,outWidth:h,outHeight:p,dataFormat:c}=n,m=c==="channelsLast",f=l*u*d,g=p*h,y=[f,g],A=!0,x=!1,v=[],b=be({inputs:{x:e},backend:a,attrs:{shape:e.shape.slice(1)}}),w=be({inputs:{x:t},backend:a,attrs:{shape:[1,f,k.sizeFromShape(t.shape)/f]}});v.push(b),v.push(w);let I=new cme(y,b.shape,n),T=a.runWebGLProgram(I,[b],"float32"),C=be({inputs:{x:T},backend:a,attrs:{shape:[1,y[0],y[1]]}});v.push(T),v.push(C);let z=r!=null,$=s!=null,S=o==="leakyrelu",D=o?j0(o,!0):null,_=new TE(C.shape,w.shape,[1,g,n.outChannels],A,x,z,D,$,S),W=[C,w];if(r&&W.push(r),$&&W.push(s),S){let ee=a.makeTensorInfo([],"float32",k.createScalarValue(i,"float32"));W.push(ee),v.push(ee)}let X=a.runWebGLProgram(_,W,"float32"),q=m?[1,p,h,n.outChannels]:[1,n.outChannels,p,h],Q=be({inputs:{x:X},backend:a,attrs:{shape:q}});v.push(X);for(let ee of v)a.disposeIntermediateTensorInfo(ee);return Q}function fme(e){let{inputs:t,backend:n,attrs:a}=e,{x:r,filter:s}=t,{strides:i,pad:o,dataFormat:l,dilations:u,dimRoundingMode:d}=a,h=M.convertConv2DDataFormat(l),p=M.computeConv2DInfo(r.shape,s.shape,i,u,o,d,!1,h),c;if(p.filterHeight===1&&p.filterWidth===1&&p.dilationHeight===1&&p.dilationWidth===1&&p.strideHeight===1&&p.strideWidth===1&&(p.padInfo.type==="SAME"||p.padInfo.type==="VALID"))c=UE({x:r,filter:s,convInfo:p,backend:n});else if(se().getBool("WEBGL_CONV_IM2COL")&&r.shape[0]===1)c=jE({x:r,filter:s,convInfo:p,backend:n});else{let f=new VE(p);c=n.runWebGLProgram(f,[r,s],"float32")}let m=be({inputs:{x:c},backend:n,attrs:{shape:p.outShape}});return n.disposeIntermediateTensorInfo(c),m}var mme={kernelName:tl,backendName:"webgl",kernelFunc:fme},gme=class{constructor(e){this.variableNames=["x","dy"],this.outputShape=e.filterShape;let t=e.strideHeight,n=e.strideWidth,a=e.padInfo.top,r=e.padInfo.left,s=e.dataFormat==="channelsLast";this.userCode=` + `}};function UE({x:e,filter:t,convInfo:n,backend:r,bias:s=null,preluActivationWeights:a=null,leakyreluAlpha:o=0,activation:i=null}){let l=e.shape,u=r.texData.get(e.dataId),c=n.inChannels,d=l[0]*l[1]*l[2],h=n.outChannels,p=n.dataFormat==="channelsLast",f=!1,m=!1,g,y=[],A=(d===1||h===1)&&c>RE,x=l[2]%2!=0&&!!u.isPacked;if(A||!ae().getBool("WEBGL_LAZILY_UNPACK")||!ae().getBool("WEBGL_PACK_BINARY_OPERATIONS")||!x){let b=p?l[0]*l[1]*l[2]:l[0]*l[2]*l[3],v=ve({inputs:{x:e},backend:r,attrs:{shape:[1,b,n.inChannels]}}),w=ve({inputs:{x:t},backend:r,attrs:{shape:[1,n.inChannels,n.outChannels]}}),I=Km({a:v,b:w,transposeA:f,transposeB:m,backend:r,bias:s,activation:i,preluActivationWeights:a,leakyreluAlpha:o});g=ve({inputs:{x:I},backend:r,attrs:{shape:n.outShape}}),y.push(v),y.push(w),y.push(I)}else{let b=p?l[0]*l[1]*(l[2]+1):l[0]*l[2]*(l[3]+1),v={dataId:e.dataId,shape:[1,b,n.inChannels],dtype:e.dtype},w=u.shape;u.shape=u.shape.slice(),u.shape[u.shape.length-2]++,k.assert(uh(u.shape,v.shape),()=>`packed reshape ${u.shape} to ${v.shape} isn't free`);let I=ve({inputs:{x:t},backend:r,attrs:{shape:[1,n.inChannels,n.outChannels]}});y.push(I);let T=Km({a:v,b:I,backend:r,transposeA:f,transposeB:m,bias:s,activation:i,preluActivationWeights:a,leakyreluAlpha:o}),C=r.texData.get(T.dataId);k.assert(C.isPacked,()=>"batchMatMul result is expected to be packed"),u.shape=w,C.shape=n.outShape,g=mr({inputs:{x:T},backend:r}),g.shape=n.outShape,y.push(T)}for(let b of y)r.disposeIntermediateTensorInfo(b);return g}function HE({x:e,filter:t,convInfo:n,backend:r,bias:s=null,preluActivationWeights:a=null,leakyreluAlpha:o=0,activation:i=null}){let{filterWidth:l,filterHeight:u,inChannels:c,outWidth:d,outHeight:h,dataFormat:p}=n,f=p==="channelsLast",m=l*u*c,g=h*d,y=[m,g],A=!0,x=!1,b=[],v=ve({inputs:{x:e},backend:r,attrs:{shape:e.shape.slice(1)}}),w=ve({inputs:{x:t},backend:r,attrs:{shape:[1,m,k.sizeFromShape(t.shape)/m]}});b.push(v),b.push(w);let I=new p0e(y,v.shape,n),T=r.runWebGLProgram(I,[v],"float32"),C=ve({inputs:{x:T},backend:r,attrs:{shape:[1,y[0],y[1]]}});b.push(T),b.push(C);let M=s!=null,$=a!=null,R=i==="leakyrelu",N=i?Gm(i,!0):null,F=new NE(C.shape,w.shape,[1,g,n.outChannels],A,x,M,N,$,R),B=[C,w];if(s&&B.push(s),$&&B.push(a),R){let ee=r.makeTensorInfo([],"float32",k.createScalarValue(o,"float32"));B.push(ee),b.push(ee)}let j=r.runWebGLProgram(F,B,"float32"),X=f?[1,h,d,n.outChannels]:[1,n.outChannels,h,d],Y=ve({inputs:{x:j},backend:r,attrs:{shape:X}});b.push(j);for(let ee of b)r.disposeIntermediateTensorInfo(ee);return Y}function f0e(e){let{inputs:t,backend:n,attrs:r}=e,{x:s,filter:a}=t,{strides:o,pad:i,dataFormat:l,dilations:u,dimRoundingMode:c}=r,d=_.convertConv2DDataFormat(l),h=_.computeConv2DInfo(s.shape,a.shape,o,u,i,c,!1,d),p;if(h.filterHeight===1&&h.filterWidth===1&&h.dilationHeight===1&&h.dilationWidth===1&&h.strideHeight===1&&h.strideWidth===1&&(h.padInfo.type==="SAME"||h.padInfo.type==="VALID"))p=UE({x:s,filter:a,convInfo:h,backend:n});else if(ae().getBool("WEBGL_CONV_IM2COL")&&s.shape[0]===1)p=HE({x:s,filter:a,convInfo:h,backend:n});else{let m=new VE(h);p=n.runWebGLProgram(m,[s,a],"float32")}let f=ve({inputs:{x:p},backend:n,attrs:{shape:h.outShape}});return n.disposeIntermediateTensorInfo(p),f}var m0e={kernelName:tl,backendName:"webgl",kernelFunc:f0e},g0e=class{constructor(e){this.variableNames=["x","dy"],this.outputShape=e.filterShape;let t=e.strideHeight,n=e.strideWidth,r=e.padInfo.top,s=e.padInfo.left,a=e.dataFormat==="channelsLast";this.userCode=` void main() { ivec4 coords = getOutputCoords(); int wR = coords.x; @@ -2224,20 +2224,20 @@ return (log(1.0 + x) - log(1.0 - x)) / 2.0;`,x0e=ot({opSnippet:A0e}),b0e={kernel for (int b = 0; b < ${e.batchSize}; b++) { for (int yR = 0; yR < ${e.outHeight}; yR++) { - int xR = wR + yR * ${t} - ${a}; + int xR = wR + yR * ${t} - ${r}; if (xR < 0 || xR >= ${e.inHeight}) { continue; } for (int yC = 0; yC < ${e.outWidth}; yC++) { - int xC = wC + yC * ${n} - ${r}; + int xC = wC + yC * ${n} - ${s}; if (xC < 0 || xC >= ${e.inWidth}) { continue; } - if (${s}) { + if (${a}) { float dyValue = getDy(b, yR, yC, d2); float xValue = getX(b, xR, xC, d1); dotProd += (xValue * dyValue); @@ -2252,13 +2252,13 @@ return (log(1.0 + x) - log(1.0 - x)) / 2.0;`,x0e=ot({opSnippet:A0e}),b0e={kernel } setOutput(dotProd); } - `}},yme=class{constructor(e){this.variableNames=["dy","W"],this.outputShape=e.inShape;let t=e.filterHeight,n=e.filterWidth,a=e.strideHeight,r=e.strideWidth,s=e.dataFormat==="channelsLast",i=t-1-e.padInfo.top,o=n-1-e.padInfo.left,l=s?1:2,u=s?2:3,d=s?3:1;this.userCode=` - const ivec2 pads = ivec2(${i}, ${o}); + `}},y0e=class{constructor(e){this.variableNames=["dy","W"],this.outputShape=e.inShape;let t=e.filterHeight,n=e.filterWidth,r=e.strideHeight,s=e.strideWidth,a=e.dataFormat==="channelsLast",o=t-1-e.padInfo.top,i=n-1-e.padInfo.left,l=a?1:2,u=a?2:3,c=a?3:1;this.userCode=` + const ivec2 pads = ivec2(${o}, ${i}); void main() { ivec4 coords = getOutputCoords(); int batch = coords[0]; - int d1 = coords[${d}]; + int d1 = coords[${c}]; ivec2 dyCorner = ivec2(coords[${l}], coords[${u}]) - pads; int dyRCorner = dyCorner.x; @@ -2268,7 +2268,7 @@ return (log(1.0 + x) - log(1.0 - x)) / 2.0;`,x0e=ot({opSnippet:A0e}),b0e={kernel // ? = to be determined. : = across all values in that axis. float dotProd = 0.0; for (int wR = 0; wR < ${t}; wR++) { - float dyR = float(dyRCorner + wR) / ${a}.0; + float dyR = float(dyRCorner + wR) / ${r}.0; if (dyR < 0.0 || dyR >= ${e.outHeight}.0 || fract(dyR) > 0.0) { continue; @@ -2278,7 +2278,7 @@ return (log(1.0 + x) - log(1.0 - x)) / 2.0;`,x0e=ot({opSnippet:A0e}),b0e={kernel int wRPerm = ${t} - 1 - wR; for (int wC = 0; wC < ${n}; wC++) { - float dyC = float(dyCCorner + wC) / ${r}.0; + float dyC = float(dyCCorner + wC) / ${s}.0; if (dyC < 0.0 || dyC >= ${e.outWidth}.0 || fract(dyC) > 0.0) { @@ -2290,7 +2290,7 @@ return (log(1.0 + x) - log(1.0 - x)) / 2.0;`,x0e=ot({opSnippet:A0e}),b0e={kernel for (int d2 = 0; d2 < ${e.outChannels}; d2++) { - if (${s}) { + if (${a}) { float xValue = getDy(batch, idyR, idyC, d2); float wValue = getW(wRPerm, wCPerm, d1, d2); dotProd += xValue * wValue; @@ -2305,7 +2305,7 @@ return (log(1.0 + x) - log(1.0 - x)) / 2.0;`,x0e=ot({opSnippet:A0e}),b0e={kernel } setOutput(dotProd); } - `}},Ame=class{constructor(e){this.variableNames=["x","dy"],this.outputShape=e.filterShape;let t=e.strideDepth,n=e.strideHeight,a=e.strideWidth,r=e.padInfo.front,s=e.padInfo.top,i=e.padInfo.left;this.userCode=` + `}},A0e=class{constructor(e){this.variableNames=["x","dy"],this.outputShape=e.filterShape;let t=e.strideDepth,n=e.strideHeight,r=e.strideWidth,s=e.padInfo.front,a=e.padInfo.top,o=e.padInfo.left;this.userCode=` void main() { ivec5 coords = getOutputCoords(); int wF = coords.x; @@ -2318,21 +2318,21 @@ return (log(1.0 + x) - log(1.0 - x)) / 2.0;`,x0e=ot({opSnippet:A0e}),b0e={kernel for (int b = 0; b < ${e.batchSize}; b++) { for (int yF = 0; yF < ${e.outDepth}; yF++) { - int xF = wF + yF * ${t} - ${r}; + int xF = wF + yF * ${t} - ${s}; if (xF < 0 || xF >= ${e.inDepth}) { continue; } for (int yR = 0; yR < ${e.outHeight}; yR++) { - int xR = wR + yR * ${n} - ${s}; + int xR = wR + yR * ${n} - ${a}; if (xR < 0 || xR >= ${e.inHeight}) { continue; } for (int yC = 0; yC < ${e.outWidth}; yC++) { - int xC = wC + yC * ${a} - ${i}; + int xC = wC + yC * ${r} - ${o}; if (xC < 0 || xC >= ${e.inWidth}) { continue; @@ -2347,8 +2347,8 @@ return (log(1.0 + x) - log(1.0 - x)) / 2.0;`,x0e=ot({opSnippet:A0e}),b0e={kernel } setOutput(dotProd); } - `}},xme=class{constructor(e){this.variableNames=["dy","W"],this.outputShape=e.inShape;let t=e.filterDepth,n=e.filterHeight,a=e.filterWidth,r=e.strideDepth,s=e.strideHeight,i=e.strideWidth,o=t-1-e.padInfo.front,l=n-1-e.padInfo.top,u=a-1-e.padInfo.left;this.userCode=` - const ivec3 pads = ivec3(${o}, ${l}, ${u}); + `}},x0e=class{constructor(e){this.variableNames=["dy","W"],this.outputShape=e.inShape;let t=e.filterDepth,n=e.filterHeight,r=e.filterWidth,s=e.strideDepth,a=e.strideHeight,o=e.strideWidth,i=t-1-e.padInfo.front,l=n-1-e.padInfo.top,u=r-1-e.padInfo.left;this.userCode=` + const ivec3 pads = ivec3(${i}, ${l}, ${u}); void main() { ivec5 coords = getOutputCoords(); @@ -2363,7 +2363,7 @@ return (log(1.0 + x) - log(1.0 - x)) / 2.0;`,x0e=ot({opSnippet:A0e}),b0e={kernel float dotProd = 0.0; for (int wF = 0; wF < ${t}; wF++) { - float dyF = float(dyFCorner + wF) / ${r}.0; + float dyF = float(dyFCorner + wF) / ${s}.0; if (dyF < 0.0 || dyF >= ${e.outDepth}.0 || fract(dyF) > 0.0) { continue; @@ -2373,7 +2373,7 @@ return (log(1.0 + x) - log(1.0 - x)) / 2.0;`,x0e=ot({opSnippet:A0e}),b0e={kernel int wFPerm = ${t} - 1 - wF; for (int wR = 0; wR < ${n}; wR++) { - float dyR = float(dyRCorner + wR) / ${s}.0; + float dyR = float(dyRCorner + wR) / ${a}.0; if (dyR < 0.0 || dyR >= ${e.outHeight}.0 || fract(dyR) > 0.0) { @@ -2383,8 +2383,8 @@ return (log(1.0 + x) - log(1.0 - x)) / 2.0;`,x0e=ot({opSnippet:A0e}),b0e={kernel int wRPerm = ${n} - 1 - wR; - for (int wC = 0; wC < ${a}; wC++) { - float dyC = float(dyCCorner + wC) / ${i}.0; + for (int wC = 0; wC < ${r}; wC++) { + float dyC = float(dyCCorner + wC) / ${o}.0; if (dyC < 0.0 || dyC >= ${e.outWidth}.0 || fract(dyC) > 0.0) { @@ -2392,7 +2392,7 @@ return (log(1.0 + x) - log(1.0 - x)) / 2.0;`,x0e=ot({opSnippet:A0e}),b0e={kernel } int idyC = int(dyC); - int wCPerm = ${a} - 1 - wC; + int wCPerm = ${r} - 1 - wC; for (int d2 = 0; d2 < ${e.outChannels}; d2++) { float xValue = getDy(batch, idyF, idyR, idyC, d2); @@ -2404,13 +2404,13 @@ return (log(1.0 + x) - log(1.0 - x)) / 2.0;`,x0e=ot({opSnippet:A0e}),b0e={kernel } setOutput(dotProd); } - `}};function bme(e){let{inputs:t,backend:n,attrs:a}=e,{x:r,dy:s}=t,{strides:i,pad:o,dataFormat:l,dimRoundingMode:u,filterShape:d}=a,h=M.convertConv2DDataFormat(l),p=M.computeConv2DInfo(r.shape,d,i,1,o,u,!1,h),c=new gme(p);return n.runWebGLProgram(c,[r,s],"float32")}var vme={kernelName:I1,backendName:"webgl",kernelFunc:bme};function wme(e){let{inputs:t,backend:n,attrs:a}=e,{dy:r,filter:s}=t,{inputShape:i,strides:o,pad:l,dataFormat:u,dimRoundingMode:d}=a,h=M.convertConv2DDataFormat(u),p=M.computeConv2DInfo(i,s.shape,o,1,l,d,!1,h),c=new yme(p);return n.runWebGLProgram(c,[r,s],"float32")}var kme={kernelName:nl,backendName:"webgl",kernelFunc:wme};function Ime(e){let{inputs:t,backend:n,attrs:a}=e,{x:r,filter:s}=t,{strides:i,pad:o,dilations:l}=a,u=M.computeConv3DInfo(r.shape,s.shape,i,l,o),d=new pme(u);return n.runWebGLProgram(d,[r,s],"float32")}var Sme={kernelName:Yc,backendName:"webgl",kernelFunc:Ime};function Nme(e){let{inputs:t,backend:n,attrs:a}=e,{x:r,dy:s}=t,{strides:i,pad:o,filterShape:l}=a,u=M.computeConv3DInfo(r.shape,l,i,1,o),d=new Ame(u);return n.runWebGLProgram(d,[r,s],"float32")}var Tme={kernelName:S1,backendName:"webgl",kernelFunc:Nme};function Eme(e){let{inputs:t,backend:n,attrs:a}=e,{dy:r,filter:s}=t,{pad:i,strides:o,inputShape:l}=a,u=M.computeConv3DInfo(l,s.shape,o,1,i),d=new xme(u);return n.runWebGLProgram(d,[r,s],"float32")}var Cme={kernelName:N1,backendName:"webgl",kernelFunc:Eme},Mme=NE+` + `}};function b0e(e){let{inputs:t,backend:n,attrs:r}=e,{x:s,dy:a}=t,{strides:o,pad:i,dataFormat:l,dimRoundingMode:u,filterShape:c}=r,d=_.convertConv2DDataFormat(l),h=_.computeConv2DInfo(s.shape,c,o,1,i,u,!1,d),p=new g0e(h);return n.runWebGLProgram(p,[s,a],"float32")}var v0e={kernelName:Sy,backendName:"webgl",kernelFunc:b0e};function w0e(e){let{inputs:t,backend:n,attrs:r}=e,{dy:s,filter:a}=t,{inputShape:o,strides:i,pad:l,dataFormat:u,dimRoundingMode:c}=r,d=_.convertConv2DDataFormat(u),h=_.computeConv2DInfo(o,a.shape,i,1,l,c,!1,d),p=new y0e(h);return n.runWebGLProgram(p,[s,a],"float32")}var k0e={kernelName:nl,backendName:"webgl",kernelFunc:w0e};function I0e(e){let{inputs:t,backend:n,attrs:r}=e,{x:s,filter:a}=t,{strides:o,pad:i,dilations:l}=r,u=_.computeConv3DInfo(s.shape,a.shape,o,l,i),c=new h0e(u);return n.runWebGLProgram(c,[s,a],"float32")}var S0e={kernelName:Yp,backendName:"webgl",kernelFunc:I0e};function T0e(e){let{inputs:t,backend:n,attrs:r}=e,{x:s,dy:a}=t,{strides:o,pad:i,filterShape:l}=r,u=_.computeConv3DInfo(s.shape,l,o,1,i),c=new A0e(u);return n.runWebGLProgram(c,[s,a],"float32")}var N0e={kernelName:Ty,backendName:"webgl",kernelFunc:T0e};function C0e(e){let{inputs:t,backend:n,attrs:r}=e,{dy:s,filter:a}=t,{pad:o,strides:i,inputShape:l}=r,u=_.computeConv3DInfo(l,a.shape,i,1,o),c=new x0e(u);return n.runWebGLProgram(c,[s,a],"float32")}var E0e={kernelName:Ny,backendName:"webgl",kernelFunc:C0e},$0e=TE+` return cos(x); -`,$me=ot({opSnippet:Mme}),Rme={kernelName:al,backendName:"webgl",kernelFunc:$me},Fme=` +`,_0e=it({opSnippet:$0e}),R0e={kernelName:rl,backendName:"webgl",kernelFunc:_0e},D0e=` float e2x = exp(-x); return (e2x + 1.0 / e2x) / 2.0; -`,Ome=ot({opSnippet:Fme}),Dme={kernelName:Md,backendName:"webgl",kernelFunc:Ome},_me=class{constructor(e,t,n,a,r){this.variableNames=["Image","Boxes","BoxInd"],this.outputShape=[];let[s,i,o,l]=e,[u]=t,[d,h]=n;this.outputShape=[u,d,h,l];let p=a==="bilinear"?1:0,[c,m]=[`${i-1}.0`,`${o-1}.0`],[f,g,y]=d>1?[`${(i-1)/(d-1)}`,"(y2-y1) * height_ratio",`y1*${c} + float(y)*(height_scale)`]:["0.0","0.0",`0.5 * (y1+y2) * ${c}`],[A,x,v]=h>1?[`${(o-1)/(h-1)}`,"(x2-x1) * width_ratio",`x1*${m} + float(x)*(width_scale)`]:["0.0","0.0",`0.5 * (x1+x2) * ${m}`];this.userCode=` - const float height_ratio = float(${f}); +`,F0e=it({opSnippet:D0e}),M0e={kernelName:$c,backendName:"webgl",kernelFunc:F0e},O0e=class{constructor(e,t,n,r,s){this.variableNames=["Image","Boxes","BoxInd"],this.outputShape=[];let[a,o,i,l]=e,[u]=t,[c,d]=n;this.outputShape=[u,c,d,l];let h=r==="bilinear"?1:0,[p,f]=[`${o-1}.0`,`${i-1}.0`],[m,g,y]=c>1?[`${(o-1)/(c-1)}`,"(y2-y1) * height_ratio",`y1*${p} + float(y)*(height_scale)`]:["0.0","0.0",`0.5 * (y1+y2) * ${p}`],[A,x,b]=d>1?[`${(i-1)/(d-1)}`,"(x2-x1) * width_ratio",`x1*${f} + float(x)*(width_scale)`]:["0.0","0.0",`0.5 * (x1+x2) * ${f}`];this.userCode=` + const float height_ratio = float(${m}); const float width_ratio = float(${A}); void main() { ivec4 coords = getOutputCoords(); @@ -2427,7 +2427,7 @@ return (log(1.0 + x) - log(1.0 - x)) / 2.0;`,x0e=ot({opSnippet:A0e}),b0e={kernel // get image in batch index int bInd = round(getBoxInd(b)); - if(bInd < 0 || bInd >= ${s}) { + if(bInd < 0 || bInd >= ${a}) { return; } @@ -2435,18 +2435,18 @@ return (log(1.0 + x) - log(1.0 - x)) / 2.0;`,x0e=ot({opSnippet:A0e}),b0e={kernel float width_scale = ${x}; float in_y = ${y}; - if( in_y < 0.0 || in_y > ${c} ) { - setOutput(float(${r})); + if( in_y < 0.0 || in_y > ${p} ) { + setOutput(float(${s})); return; } - float in_x = ${v}; - if( in_x < 0.0 || in_x > ${m} ) { - setOutput(float(${r})); + float in_x = ${b}; + if( in_x < 0.0 || in_x > ${f} ) { + setOutput(float(${s})); return; } vec2 sourceFracIndexCR = vec2(in_x,in_y); - if(${p} == 1) { + if(${h} == 1) { // Compute the four integer indices. ivec2 sourceFloorCR = ivec2(sourceFracIndexCR); ivec2 sourceCeilCR = ivec2(ceil(sourceFracIndexCR)); @@ -2470,21 +2470,21 @@ return (log(1.0 + x) - log(1.0 - x)) / 2.0;`,x0e=ot({opSnippet:A0e}),b0e={kernel setOutput(newValue); } } - `}},zme=e=>{let{inputs:t,backend:n,attrs:a}=e,{image:r,boxes:s,boxInd:i}=t,{cropSize:o,method:l,extrapolationValue:u}=a,d=new _me(r.shape,s.shape,o,l,u);return n.runWebGLProgram(d,[r,s,i],"float32")},Pme={kernelName:$d,backendName:"webgl",kernelFunc:zme},HE=class{constructor(e,t,n){this.variableNames=["x"],this.outputShape=e;let a=e.length,r=t?"0.0":`getX(${GE(a,"coords")})`,s=e[e.length-1],i="",o="";t?(i=n?`end != ${s-1}`:"end != 0",o=n?"end + 1":"end - 1"):(i=n?`end + pow2 < ${s}`:"end >= pow2",o=n?"end + pow2":"end - pow2"),this.userCode=` + `}},P0e=e=>{let{inputs:t,backend:n,attrs:r}=e,{image:s,boxes:a,boxInd:o}=t,{cropSize:i,method:l,extrapolationValue:u}=r,c=new O0e(s.shape,a.shape,i,l,u);return n.runWebGLProgram(c,[s,a,o],"float32")},z0e={kernelName:_c,backendName:"webgl",kernelFunc:P0e},GE=class{constructor(e,t,n){this.variableNames=["x"],this.outputShape=e;let r=e.length,s=t?"0.0":`getX(${jE(r,"coords")})`,a=e[e.length-1],o="",i="";t?(o=n?`end != ${a-1}`:"end != 0",i=n?"end + 1":"end - 1"):(o=n?`end + pow2 < ${a}`:"end >= pow2",i=n?"end + pow2":"end - pow2"),this.userCode=` uniform float index; void main() { - ${kt(a)} coords = getOutputCoords(); - int end = ${qE(a,"coords")}; - float val = ${r}; + ${It(r)} coords = getOutputCoords(); + int end = ${qE(r,"coords")}; + float val = ${s}; int pow2 = int(pow(2.0, index)); - if (${i}) { - int idx = ${o}; - ${qE(a,"coords")} = idx; - val += getX(${GE(a,"coords")}); + if (${o}) { + int idx = ${i}; + ${qE(r,"coords")} = idx; + val += getX(${jE(r,"coords")}); } setOutput(val); } - `}getCustomSetupFunc(e){return(t,n)=>{this.index==null&&(this.index=t.getUniformLocation(n,"index")),t.gl.uniform1f(this.index,e)}}};function GE(e,t){if(e===1)return`${t}`;if(e===2)return`${t}.x, ${t}.y`;if(e===3)return`${t}.x, ${t}.y, ${t}.z`;if(e===4)return`${t}.x, ${t}.y, ${t}.z, ${t}.w`;throw Error(`Cumulative sum for rank ${e} is not yet supported`)}function qE(e,t){if(e===1)return`${t}`;if(e===2)return`${t}.y`;if(e===3)return`${t}.z`;if(e===4)return`${t}.w`;throw Error(`Cumulative sum for rank ${e} is not yet supported`)}function Lme(e){let{inputs:t,backend:n,attrs:a}=e,{x:r}=t,{axis:s,exclusive:i,reverse:o}=a,l=r.shape.length,u=M.getAxesPermutation([s],l),d=r;u!=null&&(d=Vn({inputs:{x:r},backend:n,attrs:{perm:u}}));let h=M.getInnerMostAxes(1,l)[0];if(h!==l-1)throw new Error(`WebGL cumsum shader expects an inner-most axis=${r.shape.length-1} but got axis=${s}`);let p=d.shape[h],c=fa({inputs:{x:d},backend:n});for(let m=0;m<=Math.ceil(Math.log2(p))-1;m++){let f=new HE(d.shape,!1,o),g=f.getCustomSetupFunc(m),y=c;c=n.runWebGLProgram(f,[c],c.dtype,g),n.disposeIntermediateTensorInfo(y)}if(i){let m=new HE(d.shape,i,o),f=c;c=n.runWebGLProgram(m,[c],c.dtype),n.disposeIntermediateTensorInfo(f)}if(u!=null){let m=M.getUndoAxesPermutation(u),f=Vn({inputs:{x:c},backend:n,attrs:{perm:m}});return n.disposeIntermediateTensorInfo(c),n.disposeIntermediateTensorInfo(d),f}return c}var Wme={kernelName:rl,backendName:"webgl",kernelFunc:Lme};function Bme(e){let{inputs:t,backend:n,attrs:a}=e,{x:r,weights:s}=t,{size:i,binaryOutput:o}=a;if(r.shape.length===1){let l=n.readSync(r.dataId),u=n.readSync(s.dataId),d=dE(l,u,s.dtype,s.shape,i);return n.makeTensorInfo([i],s.dtype,d)}else if(r.shape.length===2){let l=n.bufferSync(r),u=n.bufferSync(s),d=nce(l,u,i,o);return n.makeTensorInfo(d.shape,s.dtype,d.values)}throw new Error(`Error in denseBincount: input must be at most rank 2, but got rank${r.shape.length}.`)}var Vme={kernelName:T1,backendName:"webgl",kernelFunc:Bme},Ume=class{constructor(e,t,n){this.variableNames=["x"],this.outputShape=[],this.outputShape=e,this.blockSize=t,this.dataFormat=n,this.userCode=` + `}getCustomSetupFunc(e){return(t,n)=>{this.index==null&&(this.index=t.getUniformLocation(n,"index")),t.gl.uniform1f(this.index,e)}}};function jE(e,t){if(e===1)return`${t}`;if(e===2)return`${t}.x, ${t}.y`;if(e===3)return`${t}.x, ${t}.y, ${t}.z`;if(e===4)return`${t}.x, ${t}.y, ${t}.z, ${t}.w`;throw Error(`Cumulative sum for rank ${e} is not yet supported`)}function qE(e,t){if(e===1)return`${t}`;if(e===2)return`${t}.y`;if(e===3)return`${t}.z`;if(e===4)return`${t}.w`;throw Error(`Cumulative sum for rank ${e} is not yet supported`)}function L0e(e){let{inputs:t,backend:n,attrs:r}=e,{x:s}=t,{axis:a,exclusive:o,reverse:i}=r,l=s.shape.length,u=_.getAxesPermutation([a],l),c=s;u!=null&&(c=Un({inputs:{x:s},backend:n,attrs:{perm:u}}));let d=_.getInnerMostAxes(1,l)[0];if(d!==l-1)throw new Error(`WebGL cumsum shader expects an inner-most axis=${s.shape.length-1} but got axis=${a}`);let h=c.shape[d],p=mr({inputs:{x:c},backend:n});for(let f=0;f<=Math.ceil(Math.log2(h))-1;f++){let m=new GE(c.shape,!1,i),g=m.getCustomSetupFunc(f),y=p;p=n.runWebGLProgram(m,[p],p.dtype,g),n.disposeIntermediateTensorInfo(y)}if(o){let f=new GE(c.shape,o,i),m=p;p=n.runWebGLProgram(f,[p],p.dtype),n.disposeIntermediateTensorInfo(m)}if(u!=null){let f=_.getUndoAxesPermutation(u),m=Un({inputs:{x:p},backend:n,attrs:{perm:f}});return n.disposeIntermediateTensorInfo(p),n.disposeIntermediateTensorInfo(c),m}return p}var B0e={kernelName:sl,backendName:"webgl",kernelFunc:L0e};function W0e(e){let{inputs:t,backend:n,attrs:r}=e,{x:s,weights:a}=t,{size:o,binaryOutput:i}=r;if(s.shape.length===1){let l=n.readSync(s.dataId),u=n.readSync(a.dataId),c=cE(l,u,a.dtype,a.shape,o);return n.makeTensorInfo([o],a.dtype,c)}else if(s.shape.length===2){let l=n.bufferSync(s),u=n.bufferSync(a),c=npe(l,u,o,i);return n.makeTensorInfo(c.shape,a.dtype,c.values)}throw new Error(`Error in denseBincount: input must be at most rank 2, but got rank${s.shape.length}.`)}var V0e={kernelName:Cy,backendName:"webgl",kernelFunc:W0e},U0e=class{constructor(e,t,n){this.variableNames=["x"],this.outputShape=[],this.outputShape=e,this.blockSize=t,this.dataFormat=n,this.userCode=` void main() { ivec4 coords = getOutputCoords(); int b = coords[0]; @@ -2503,29 +2503,29 @@ return (log(1.0 + x) - log(1.0 - x)) / 2.0;`,x0e=ot({opSnippet:A0e}),b0e={kernel float result = ${this.getInputSamplingString()}; setOutput(result); } - `}getHeightCoordString(){return this.dataFormat==="NHWC"?"coords[1]":"coords[2]"}getWidthCoordString(){return this.dataFormat==="NHWC"?"coords[2]":"coords[3]"}getDepthCoordString(){return this.dataFormat==="NHWC"?"coords[3]":"coords[1]"}getOutputDepthSize(){return this.dataFormat==="NHWC"?this.outputShape[3]:this.outputShape[1]}getInputSamplingString(){return this.dataFormat==="NHWC"?"getX(b, in_h, in_w, in_d)":"getX(b, in_d, in_h, in_w)"}};function jme(e){let{inputs:t,backend:n,attrs:a}=e,{x:r}=t,{blockSize:s,dataFormat:i}=a;k.assert(s>1,()=>`blockSize should be > 1 for depthToSpace, but was: ${s}`);let o=r.shape[0],l=i==="NHWC"?r.shape[1]:r.shape[2],u=i==="NHWC"?r.shape[2]:r.shape[3],d=i==="NHWC"?r.shape[3]:r.shape[1],h=l*s,p=u*s,c=d/(s*s),m=i==="NHWC"?[o,h,p,c]:[o,c,h,p],f=new Ume(m,s,i);return n.runWebGLProgram(f,[r],r.dtype)}var Hme={kernelName:Rd,backendName:"webgl",kernelFunc:jme},KE=class{constructor(e,t=!1,n=null,a=!1,r=!1){this.variableNames=["x","W"],this.outputShape=e.outShape;let s=e.inHeight,i=e.inWidth,o=e.padInfo.top,l=e.padInfo.left,u=e.strideHeight,d=e.strideWidth,h=e.dilationHeight,p=e.dilationWidth,c=e.filterHeight,m=e.filterWidth,f=e.outChannels/e.inChannels,g="",y="";n&&(a?g=`float activation(float a) { + `}getHeightCoordString(){return this.dataFormat==="NHWC"?"coords[1]":"coords[2]"}getWidthCoordString(){return this.dataFormat==="NHWC"?"coords[2]":"coords[3]"}getDepthCoordString(){return this.dataFormat==="NHWC"?"coords[3]":"coords[1]"}getOutputDepthSize(){return this.dataFormat==="NHWC"?this.outputShape[3]:this.outputShape[1]}getInputSamplingString(){return this.dataFormat==="NHWC"?"getX(b, in_h, in_w, in_d)":"getX(b, in_d, in_h, in_w)"}};function H0e(e){let{inputs:t,backend:n,attrs:r}=e,{x:s}=t,{blockSize:a,dataFormat:o}=r;k.assert(a>1,()=>`blockSize should be > 1 for depthToSpace, but was: ${a}`);let i=s.shape[0],l=o==="NHWC"?s.shape[1]:s.shape[2],u=o==="NHWC"?s.shape[2]:s.shape[3],c=o==="NHWC"?s.shape[3]:s.shape[1],d=l*a,h=u*a,p=c/(a*a),f=o==="NHWC"?[i,d,h,p]:[i,p,d,h],m=new U0e(f,a,o);return n.runWebGLProgram(m,[s],s.dtype)}var G0e={kernelName:Rc,backendName:"webgl",kernelFunc:H0e},KE=class{constructor(e,t=!1,n=null,r=!1,s=!1){this.variableNames=["x","W"],this.outputShape=e.outShape;let a=e.inHeight,o=e.inWidth,i=e.padInfo.top,l=e.padInfo.left,u=e.strideHeight,c=e.strideWidth,d=e.dilationHeight,h=e.dilationWidth,p=e.filterHeight,f=e.filterWidth,m=e.outChannels/e.inChannels,g="",y="";n&&(r?g=`float activation(float a) { float b = getPreluActivationWeightsAtOutCoords(); ${n} - }`:r?g=`float activation(float a) { + }`:s?g=`float activation(float a) { float b = getLeakyreluAlphaAtOutCoords(); ${n} }`:g=` float activation(float x) { ${n} } - `,y="result = activation(result);");let A=t?"result += getBiasAtOutCoords();":"";t&&this.variableNames.push("bias"),a&&this.variableNames.push("preluActivationWeights"),r&&this.variableNames.push("leakyreluAlpha"),this.userCode=` + `,y="result = activation(result);");let A=t?"result += getBiasAtOutCoords();":"";t&&this.variableNames.push("bias"),r&&this.variableNames.push("preluActivationWeights"),s&&this.variableNames.push("leakyreluAlpha"),this.userCode=` ${g} - const ivec2 strides = ivec2(${u}, ${d}); - const ivec2 pads = ivec2(${o}, ${l}); + const ivec2 strides = ivec2(${u}, ${c}); + const ivec2 pads = ivec2(${i}, ${l}); void main() { ivec4 coords = getOutputCoords(); int batch = coords.x; ivec2 xRCCorner = coords.yz * strides - pads; int d2 = coords.w; - int d1 = d2 / ${f}; - int q = d2 - d1 * ${f}; + int d1 = d2 / ${m}; + int q = d2 - d1 * ${m}; int xRCorner = xRCCorner.x; int xCCorner = xRCCorner.y; @@ -2534,17 +2534,17 @@ return (log(1.0 + x) - log(1.0 - x)) / 2.0;`,x0e=ot({opSnippet:A0e}),b0e={kernel // ? = to be determined. : = across all values in that axis. float dotProd = 0.0; // TO DO(dsmilkov): Flatten the two for loops and vec4 the operations. - for (int wR = 0; wR < ${c}; wR++) { - int xR = xRCorner + wR * ${h}; + for (int wR = 0; wR < ${p}; wR++) { + int xR = xRCorner + wR * ${d}; - if (xR < 0 || xR >= ${s}) { + if (xR < 0 || xR >= ${a}) { continue; } - for (int wC = 0; wC < ${m}; wC++) { - int xC = xCCorner + wC * ${p}; + for (int wC = 0; wC < ${f}; wC++) { + int xC = xCCorner + wC * ${h}; - if (xC < 0 || xC >= ${i}) { + if (xC < 0 || xC >= ${o}) { continue; } @@ -2559,42 +2559,42 @@ return (log(1.0 + x) - log(1.0 - x)) / 2.0;`,x0e=ot({opSnippet:A0e}),b0e={kernel ${y} setOutput(result); } - `}},XE=class{constructor(e,t=!1,n=null,a=!1,r=!1){this.variableNames=["x","W"],this.packedInputs=!0,this.packedOutput=!0,this.outputShape=e.outShape;let s=e.outChannels/e.inChannels,i=e.inHeight,o=e.inWidth,l=e.padInfo.top,u=e.padInfo.left,d=e.strideHeight,h=e.strideWidth,p=e.dilationHeight,c=e.dilationWidth,m=e.filterHeight,f=e.filterWidth,g=f,y=` + `}},XE=class{constructor(e,t=!1,n=null,r=!1,s=!1){this.variableNames=["x","W"],this.packedInputs=!0,this.packedOutput=!0,this.outputShape=e.outShape;let a=e.outChannels/e.inChannels,o=e.inHeight,i=e.inWidth,l=e.padInfo.top,u=e.padInfo.left,c=e.strideHeight,d=e.strideWidth,h=e.dilationHeight,p=e.dilationWidth,f=e.filterHeight,m=e.filterWidth,g=m,y=` int xR; int xC; int xCOffset; - vec4 wTexel; vec4 previous; vec4 final;`;for(let b=0;b=0 && xR < ${i}) { - `;for(let w=0;w<(g+1)/2;w++){let I=w*2,T=I*c;if(y+=` + xR = xRCorner + ${v*h}; + if (xR >=0 && xR < ${o}) { + `;for(let w=0;w<(g+1)/2;w++){let I=w*2,T=I*p;if(y+=` xC = xCCorner + ${T}; - `,h===1){if(I= 0 && xCOffset < ${o} && xTexelC${T}Ready == 0) { + if (xCOffset >= 0 && xCOffset < ${i} && xTexelC${T}Ready == 0) { xTexelC${T} = getX(batch, xR, xCOffset, d1); // Need to manually clear unused channels in case // we're reading from recycled texture. - if (xCOffset + 1 >= ${o}) { + if (xCOffset + 1 >= ${i}) { xTexelC${T}.zw = vec2(0.0); } xTexelC${T}Ready = 1; } - `,c===1&&T>0?y+=` + `,p===1&&T>0?y+=` xC${I} = vec4(xTexelC${T-2}.zw, xTexelC${T}.xy); `:y+=` xCOffset = xC + 1 - 2; - if (xCOffset >= 0 && xCOffset < ${o}) { + if (xCOffset >= 0 && xCOffset < ${i}) { previous = getX(batch, xR, xCOffset, d1); // Need to manually clear unused channels in case // we're reading from recycled texture. - if (xCOffset + 1 >= ${o}) { + if (xCOffset + 1 >= ${i}) { previous.zw = vec2(0.0); } @@ -2603,31 +2603,31 @@ return (log(1.0 + x) - log(1.0 - x)) / 2.0;`,x0e=ot({opSnippet:A0e}),b0e={kernel xC${I} = vec4(0.0, 0.0, xTexelC${T}.xy); } `):y+=` - if (xC >= 0 && xC < ${o} && xTexelC${T}Ready == 0) { + if (xC >= 0 && xC < ${i} && xTexelC${T}Ready == 0) { xTexelC${T} = getX(batch, xR, xC, d1); - if (xC + 1 >= ${o}) { + if (xC + 1 >= ${i}) { xTexelC${T}.zw = vec2(0.0); } xTexelC${T}Ready = 1; } xC${I} = xTexelC${T}; - `,T+1= 0 && xCOffset < ${o} && xTexelC${T+2}Ready == 0) { + if (xCOffset >= 0 && xCOffset < ${i} && xTexelC${T+2}Ready == 0) { xTexelC${T+2} = getX(batch, xR, xCOffset, d1); // Need to manually clear unused channels in case // we're reading from recycled texture. - if (xCOffset + 1 >= ${o}) { + if (xCOffset + 1 >= ${i}) { xTexelC${T+2}.zw = vec2(0.0); } xTexelC${T+2}Ready = 1; } - `,c>1&&(y+=` + `,p>1&&(y+=` xCOffset -= 2; - if (xCOffset >= 0 && xCOffset < ${o} && xTexelC${T}Ready == 0) { + if (xCOffset >= 0 && xCOffset < ${i} && xTexelC${T}Ready == 0) { xTexelC${T} = getX(batch, xR, xCOffset, d1); xTexelC${T}Ready = 1; } @@ -2638,58 +2638,58 @@ return (log(1.0 + x) - log(1.0 - x)) / 2.0;`,x0e=ot({opSnippet:A0e}),b0e={kernel `:y+=` xCOffset = xC + ${C}; - if (xCOffset >= 0 && xCOffset < ${o} && xTexelC${T+2}Ready == 0) { + if (xCOffset >= 0 && xCOffset < ${i} && xTexelC${T+2}Ready == 0) { xTexelC${T+2} = getX(batch, xR, xCOffset, d1); - if (xCOffset + 1 >= ${o}) { + if (xCOffset + 1 >= ${i}) { xTexelC${T+2}.zw = vec2(0.0); } xTexelC${T+2}Ready = 1; } xC${I+1} = xTexelC${T+2}; - `}}else T= 0 && xCOffset < ${o} && xTexelC${T}Ready == 0) { + `}}else T= 0 && xCOffset < ${i} && xTexelC${T}Ready == 0) { xTexelC${T} = getX(batch, xR, xCOffset, d1); // Need to manually clear unused channels in case // we're reading from recycled texture. - if (xCOffset + 1 >= ${o}) { + if (xCOffset + 1 >= ${i}) { xTexelC${T}.zw = vec2(0.0); } xTexelC${T}Ready = 1; } - if(xC + 1 >= 0 && xC + 1 < ${o} && xTexelC${T+2}Ready == 0) { + if(xC + 1 >= 0 && xC + 1 < ${i} && xTexelC${T+2}Ready == 0) { xTexelC${T+2} = getX(batch, xR, xC + 1, d1); // Need to manually clear unused channels in case // we're reading from recycled texture. - if (xC + 2 >= ${o}) { + if (xC + 2 >= ${i}) { xTexelC${T+2}.zw = vec2(0.0); } xTexelC${T+2}Ready = 1; } xC${I} = vec4(xTexelC${T}.zw, xTexelC${T+2}.zw); - `,T+1= 0 && xCOffset < ${o}) { + xCOffset = xC + 1 + ${d}; + if(xCOffset >= 0 && xCOffset < ${i}) { final = getX(batch, xR, xCOffset, d1); } xC${I+1} = vec4(xTexelC${T+2}.xy, final.xy); `)):(y+=` - if(xC >= 0 && xC < ${o} && xTexelC${T}Ready == 0) { + if(xC >= 0 && xC < ${i} && xTexelC${T}Ready == 0) { xTexelC${T} = getX(batch, xR, xC, d1); - if (xC + 1 >= ${o}) { + if (xC + 1 >= ${i}) { xTexelC${T}.zw = vec2(0.0); } xTexelC${T}Ready = 1; } - xCOffset = xC + ${h}; - if(xCOffset >= 0 && xCOffset < ${o} && xTexelC${T+2}Ready == 0) { + xCOffset = xC + ${d}; + if(xCOffset >= 0 && xCOffset < ${i} && xTexelC${T+2}Ready == 0) { xTexelC${T+2} = getX(batch, xR, xCOffset, d1); - if (xCOffset + 1 >= ${o}) { + if (xCOffset + 1 >= ${i}) { xTexelC${T+2}.zw = vec2(0.); } xTexelC${T+2}Ready = 1; @@ -2697,28 +2697,28 @@ return (log(1.0 + x) - log(1.0 - x)) / 2.0;`,x0e=ot({opSnippet:A0e}),b0e={kernel xC${I} = vec4( xTexelC${T}.xy, xTexelC${T+2}.xy); - `,T+1`Error in depthwiseConv2d: Either strides or dilations must be 1. Got strides ${i} and dilations '${d}'`);let h=M.computeConv2DInfo(r.shape,s.shape,i,d,o,u,!0),p;return se().getBool("WEBGL_PACK_DEPTHWISECONV")&&h.strideWidth<=2&&h.outChannels/h.inChannels==1?p=new XE(h):p=new KE(h),n.runWebGLProgram(p,[r,s],"float32")}var qme={kernelName:sl,backendName:"webgl",kernelFunc:Gme},Kme=class{constructor(e){this.variableNames=["x","dy"],this.outputShape=e.filterShape;let t=e.strideHeight,n=e.strideWidth,a=e.padInfo.top,r=e.padInfo.left,s=e.outChannels/e.inChannels;this.userCode=` + `}};function j0e(e){let{inputs:t,backend:n,attrs:r}=e,{x:s,filter:a}=t,{strides:o,pad:i,dilations:l,dimRoundingMode:u}=r,c=l;c==null&&(c=[1,1]),k.assert(_.eitherStridesOrDilationsAreOne(o,c),()=>`Error in depthwiseConv2d: Either strides or dilations must be 1. Got strides ${o} and dilations '${c}'`);let d=_.computeConv2DInfo(s.shape,a.shape,o,c,i,u,!0),h;return ae().getBool("WEBGL_PACK_DEPTHWISECONV")&&d.strideWidth<=2&&d.outChannels/d.inChannels==1?h=new XE(d):h=new KE(d),n.runWebGLProgram(h,[s,a],"float32")}var q0e={kernelName:al,backendName:"webgl",kernelFunc:j0e},K0e=class{constructor(e){this.variableNames=["x","dy"],this.outputShape=e.filterShape;let t=e.strideHeight,n=e.strideWidth,r=e.padInfo.top,s=e.padInfo.left,a=e.outChannels/e.inChannels;this.userCode=` void main() { ivec4 coords = getOutputCoords(); int wR = coords.x; int wC = coords.y; int d1 = coords.z; int dm = coords.w; - int d2 = d1 * ${s} + dm; + int d2 = d1 * ${a} + dm; float dotProd = 0.0; // TO DO: Vec4 over the batch size for (int b = 0; b < ${e.batchSize}; b++) { for (int yR = 0; yR < ${e.outHeight}; yR++) { - int xR = wR + yR * ${t} - ${a}; + int xR = wR + yR * ${t} - ${r}; if (xR < 0 || xR >= ${e.inHeight}) { continue; } for (int yC = 0; yC < ${e.outWidth}; yC++) { - int xC = wC + yC * ${n} - ${r}; + int xC = wC + yC * ${n} - ${s}; if (xC < 0 || xC >= ${e.inWidth}) { continue; @@ -2777,8 +2777,8 @@ return (log(1.0 + x) - log(1.0 - x)) / 2.0;`,x0e=ot({opSnippet:A0e}),b0e={kernel } setOutput(dotProd); } - `}},Xme=class{constructor(e){this.variableNames=["dy","W"],this.outputShape=e.inShape;let t=e.filterHeight,n=e.filterWidth,a=e.strideHeight,r=e.strideWidth,s=t-1-e.padInfo.top,i=n-1-e.padInfo.left,o=e.outChannels/e.inChannels;this.userCode=` - const ivec2 pads = ivec2(${s}, ${i}); + `}},X0e=class{constructor(e){this.variableNames=["dy","W"],this.outputShape=e.inShape;let t=e.filterHeight,n=e.filterWidth,r=e.strideHeight,s=e.strideWidth,a=t-1-e.padInfo.top,o=n-1-e.padInfo.left,i=e.outChannels/e.inChannels;this.userCode=` + const ivec2 pads = ivec2(${a}, ${o}); void main() { ivec4 coords = getOutputCoords(); @@ -2791,7 +2791,7 @@ return (log(1.0 + x) - log(1.0 - x)) / 2.0;`,x0e=ot({opSnippet:A0e}),b0e={kernel float dotProd = 0.0; for (int wR = 0; wR < ${t}; wR++) { - float dyR = float(dyRCorner + wR) / ${a}.0; + float dyR = float(dyRCorner + wR) / ${r}.0; if (dyR < 0.0 || dyR >= ${e.outHeight}.0 || fract(dyR) > 0.0) { continue; @@ -2801,7 +2801,7 @@ return (log(1.0 + x) - log(1.0 - x)) / 2.0;`,x0e=ot({opSnippet:A0e}),b0e={kernel int wRPerm = ${t} - 1 - wR; for (int wC = 0; wC < ${n}; wC++) { - float dyC = float(dyCCorner + wC) / ${r}.0; + float dyC = float(dyCCorner + wC) / ${s}.0; if (dyC < 0.0 || dyC >= ${e.outWidth}.0 || fract(dyC) > 0.0) { @@ -2812,8 +2812,8 @@ return (log(1.0 + x) - log(1.0 - x)) / 2.0;`,x0e=ot({opSnippet:A0e}),b0e={kernel int wCPerm = ${n} - 1 - wC; // TO DO: Vec4 over the channelMul - for (int dm = 0; dm < ${o}; dm++) { - int d2 = d1 * ${o} + dm; + for (int dm = 0; dm < ${i}; dm++) { + int d2 = d1 * ${i} + dm; float xValue = getDy(batch, idyR, idyC, d2); float wValue = getW(wRPerm, wCPerm, d1, dm); dotProd += xValue * wValue; @@ -2822,15 +2822,15 @@ return (log(1.0 + x) - log(1.0 - x)) / 2.0;`,x0e=ot({opSnippet:A0e}),b0e={kernel } setOutput(dotProd); } - `}};function Zme(e){let{inputs:t,backend:n,attrs:a}=e,{x:r,dy:s}=t,{strides:i,dilations:o,pad:l,dimRoundingMode:u,filterShape:d}=a,h=M.computeConv2DInfo(r.shape,d,i,o,l,u,!0),p=new Kme(h);return n.runWebGLProgram(p,[r,s],"float32")}var Yme={kernelName:E1,backendName:"webgl",kernelFunc:Zme};function Jme(e){let{inputs:t,backend:n,attrs:a}=e,{dy:r,filter:s}=t,{strides:i,dilations:o,pad:l,dimRoundingMode:u,inputShape:d}=a,h=M.computeConv2DInfo(d,s.shape,i,o,l,u,!0),p=new Xme(h);return n.runWebGLProgram(p,[r,s],"float32")}var Qme={kernelName:C1,backendName:"webgl",kernelFunc:Jme},ege=class{constructor(e){this.variableNames=["X"],this.outputShape=[e,e],this.userCode=` + `}};function Z0e(e){let{inputs:t,backend:n,attrs:r}=e,{x:s,dy:a}=t,{strides:o,dilations:i,pad:l,dimRoundingMode:u,filterShape:c}=r,d=_.computeConv2DInfo(s.shape,c,o,i,l,u,!0),h=new K0e(d);return n.runWebGLProgram(h,[s,a],"float32")}var Y0e={kernelName:Ey,backendName:"webgl",kernelFunc:Z0e};function J0e(e){let{inputs:t,backend:n,attrs:r}=e,{dy:s,filter:a}=t,{strides:o,dilations:i,pad:l,dimRoundingMode:u,inputShape:c}=r,d=_.computeConv2DInfo(c,a.shape,o,i,l,u,!0),h=new X0e(d);return n.runWebGLProgram(h,[s,a],"float32")}var Q0e={kernelName:$y,backendName:"webgl",kernelFunc:J0e},ege=class{constructor(e){this.variableNames=["X"],this.outputShape=[e,e],this.userCode=` void main() { ivec2 coords = getOutputCoords(); float val = coords[0] == coords[1] ? getX(coords[0]) : 0.0; setOutput(val); } - `}};function tge(e){let{inputs:t,backend:n}=e,{x:a}=t,r=[...a.shape,...a.shape],s=k.sizeFromShape(a.shape),i=be({inputs:{x:a},backend:n,attrs:{shape:[s]}}),o=new ege(s),l=n.runWebGLProgram(o,[i],i.dtype),u=be({inputs:{x:l},backend:n,attrs:{shape:r}});return n.disposeIntermediateTensorInfo(i),n.disposeIntermediateTensorInfo(l),u}var nge={kernelName:M1,backendName:"webgl",kernelFunc:tge},age=class{constructor(e){this.variableNames=["x","W"],this.outputShape=e.outShape;let{inHeight:t,inWidth:n,padInfo:a,strideHeight:r,strideWidth:s,filterHeight:i,filterWidth:o,dilationHeight:l,dilationWidth:u}=e,{top:d,left:h}=a;this.userCode=` - const ivec2 strides = ivec2(${r}, ${s}); - const ivec2 pads = ivec2(${d}, ${h}); + `}};function tge(e){let{inputs:t,backend:n}=e,{x:r}=t,s=[...r.shape,...r.shape],a=k.sizeFromShape(r.shape),o=ve({inputs:{x:r},backend:n,attrs:{shape:[a]}}),i=new ege(a),l=n.runWebGLProgram(i,[o],o.dtype),u=ve({inputs:{x:l},backend:n,attrs:{shape:s}});return n.disposeIntermediateTensorInfo(o),n.disposeIntermediateTensorInfo(l),u}var nge={kernelName:_y,backendName:"webgl",kernelFunc:tge},rge=class{constructor(e){this.variableNames=["x","W"],this.outputShape=e.outShape;let{inHeight:t,inWidth:n,padInfo:r,strideHeight:s,strideWidth:a,filterHeight:o,filterWidth:i,dilationHeight:l,dilationWidth:u}=e,{top:c,left:d}=r;this.userCode=` + const ivec2 strides = ivec2(${s}, ${a}); + const ivec2 pads = ivec2(${c}, ${d}); const float neg_infinity = -3.4e38; void main() { @@ -2843,11 +2843,11 @@ return (log(1.0 + x) - log(1.0 - x)) / 2.0;`,x0e=ot({opSnippet:A0e}),b0e={kernel int wBeg = outTopLeftCorner.y; float curVal = neg_infinity; - for (int h = 0; h < ${i}; h++) { + for (int h = 0; h < ${o}; h++) { int hIn = hBeg + h * ${l}; if (hIn >= 0 && hIn < ${t}) { - for (int w = 0; w < ${o}; w++) { + for (int w = 0; w < ${i}; w++) { int wIn = wBeg + w * ${u}; if (wIn >= 0 && wIn < ${n}) { @@ -2866,7 +2866,7 @@ return (log(1.0 + x) - log(1.0 - x)) / 2.0;`,x0e=ot({opSnippet:A0e}),b0e={kernel float result = curVal; setOutput(result); } - `}};function rge(e){let{inputs:t,backend:n,attrs:a}=e,{x:r,filter:s}=t,{strides:i,pad:o,dilations:l}=a,u=M.computeDilation2DInfo(r.shape,s.shape,i,o,"NHWC",l),d,h=new age(u);d=n.runWebGLProgram(h,[r,s],"float32");let p=be({inputs:{x:d},backend:n,attrs:{shape:u.outShape}});return n.disposeIntermediateTensorInfo(d),p}var sge={kernelName:Jc,backendName:"webgl",kernelFunc:rge};function ige(e){let{inputs:t,backend:n,attrs:a}=e,{equation:r}=a,s=t,{allDims:i,summedDims:o,idDims:l}=M.decodeEinsumEquation(r,s.length);M.checkEinsumDimSizes(i.length,l,s);let{path:u,steps:d}=M.getEinsumComputePath(o,l),h=d.length,p=null,c=i.length,m=[];for(let f=0;f=0&&(p=G0({inputs:{x:p},backend:n,attrs:{axis:u[f]-(i.length-c),keepDims:!1}}),m.push(p)),c--)}for(let f of m)f!==p&&n.disposeIntermediateTensorInfo(f);return p}var oge={kernelName:F1,backendName:"webgl",kernelFunc:ige},lge="return (x >= 0.0) ? x : (exp(x) - 1.0);",uge=` + `}};function sge(e){let{inputs:t,backend:n,attrs:r}=e,{x:s,filter:a}=t,{strides:o,pad:i,dilations:l}=r,u=_.computeDilation2DInfo(s.shape,a.shape,o,i,"NHWC",l),c,d=new rge(u);c=n.runWebGLProgram(d,[s,a],"float32");let h=ve({inputs:{x:c},backend:n,attrs:{shape:u.outShape}});return n.disposeIntermediateTensorInfo(c),h}var age={kernelName:Jp,backendName:"webgl",kernelFunc:sge};function oge(e){let{inputs:t,backend:n,attrs:r}=e,{equation:s}=r,a=t,{allDims:o,summedDims:i,idDims:l}=_.decodeEinsumEquation(s,a.length);_.checkEinsumDimSizes(o.length,l,a);let{path:u,steps:c}=_.getEinsumComputePath(i,l),d=c.length,h=null,p=o.length,f=[];for(let m=0;m=0&&(h=qm({inputs:{x:h},backend:n,attrs:{axis:u[m]-(o.length-p),keepDims:!1}}),f.push(h)),p--)}for(let m of f)m!==h&&n.disposeIntermediateTensorInfo(m);return h}var ige={kernelName:Fy,backendName:"webgl",kernelFunc:oge},lge="return (x >= 0.0) ? x : (exp(x) - 1.0);",uge=` vec4 result; result.r = (x.r >= 0.0) ? x.r : (exp(x.r) - 1.0); @@ -2875,41 +2875,41 @@ return (log(1.0 + x) - log(1.0 - x)) / 2.0;`,x0e=ot({opSnippet:A0e}),b0e={kernel result.a = (x.a >= 0.0) ? x.a : (exp(x.a) - 1.0); return result; -`,dge=ot({opSnippet:lge,packedOpSnippet:uge}),hge={kernelName:Fd,backendName:"webgl",kernelFunc:dge},pge="return (b >= 1.0) ? a : a * (b + 1.0);",cge=` +`,cge=it({opSnippet:lge,packedOpSnippet:uge}),dge={kernelName:Dc,backendName:"webgl",kernelFunc:cge},hge="return (b >= 1.0) ? a : a * (b + 1.0);",pge=` vec4 bGTEZero = vec4(greaterThanEqual(b, vec4(0.))); return (bGTEZero * a) + ((vec4(1.0) - bGTEZero) * (a * (b + vec4(1.0)))); -`,fge=e=>{let{inputs:t,backend:n}=e,{dy:a,y:r}=t,s=se().getBool("WEBGL_PACK_BINARY_OPERATIONS")?new pp(cge,a.shape,r.shape):new ku(pge,a.shape,r.shape);return n.runWebGLProgram(s,[a,r],a.dtype)},mge={kernelName:O1,backendName:"webgl",kernelFunc:fge},gge=` +`,fge=e=>{let{inputs:t,backend:n}=e,{dy:r,y:s}=t,a=ae().getBool("WEBGL_PACK_BINARY_OPERATIONS")?new hh(pge,r.shape,s.shape):new ku(hge,r.shape,s.shape);return n.runWebGLProgram(a,[r,s],r.dtype)},mge={kernelName:My,backendName:"webgl",kernelFunc:fge},gge=` return vec4(equal(a, b)); -`,yge="return float(a == b);",Age=Tn({opSnippet:yge,packedOpSnippet:gge,dtype:"bool",cpuKernelImpl:sce}),xge={kernelName:ol,backendName:"webgl",kernelFunc:Age},bge=` +`,yge="return float(a == b);",Age=Nn({opSnippet:yge,packedOpSnippet:gge,dtype:"bool",cpuKernelImpl:ape}),xge={kernelName:il,backendName:"webgl",kernelFunc:Age},bge=` // Error function is calculated approximately with elementary function. // See "Handbook of Mathematical Functions with Formulas, // Graphs, and Mathematical Tables", Abramowitz and Stegun. - float p = ${M.ERF_P}; - float a1 = ${M.ERF_A1}; - float a2 = ${M.ERF_A2}; - float a3 = ${M.ERF_A3}; - float a4 = ${M.ERF_A4}; - float a5 = ${M.ERF_A5}; + float p = ${_.ERF_P}; + float a1 = ${_.ERF_A1}; + float a2 = ${_.ERF_A2}; + float a3 = ${_.ERF_A3}; + float a4 = ${_.ERF_A4}; + float a5 = ${_.ERF_A5}; float sign = sign(x); x = abs(x); float t = 1.0 / (1.0 + p * x); return sign * (1.0 - (((((a5*t + a4)*t) + a3)*t + a2)*t + a1)*t*exp(-x*x)); -`,vge=ot({opSnippet:bge}),wge={kernelName:Od,backendName:"webgl",kernelFunc:vge},ZE="return exp(x);",YE=ot({opSnippet:ZE,packedOpSnippet:ZE,cpuKernelImpl:ice}),kge={kernelName:Ei,backendName:"webgl",kernelFunc:YE};function hb(e){let{inputs:t,attrs:n,backend:a}=e,{dim:r}=n,{input:s}=t,i=s.shape.length,o=s.shape.slice(),l=r;return r<0&&(k.assert(-(i+1)<=r,()=>`Axis must be in the interval [${-(i+1)}, ${i}]`),l=i+r+1),o.splice(l,0,1),be({inputs:{x:s},backend:a,attrs:{shape:o}})}var Ige={kernelName:Dd,backendName:"webgl",kernelFunc:hb},JE="return exp(x) - 1.0;",Sge=ot({opSnippet:JE,packedOpSnippet:JE,cpuKernelImpl:oce}),Nge={kernelName:ll,backendName:"webgl",kernelFunc:Sge},QE=class{constructor(e,t,n){this.variableNames=["real","imag"];let a=t[1];this.outputShape=t;let r=n?`2.0 * ${Math.PI}`:`-2.0 * ${Math.PI}`,s=n?`${a}.0`:"1.0",i;if(e==="real")i="return real * expR - imag * expI;";else if(e==="imag")i="return real * expI + imag * expR;";else throw new Error(`FFT component must be either "real" or "imag", got ${e}.`);this.userCode=` - const float exponentMultiplier = ${r}; +`,vge=it({opSnippet:bge}),wge={kernelName:Fc,backendName:"webgl",kernelFunc:vge},ZE="return exp(x);",YE=it({opSnippet:ZE,packedOpSnippet:ZE,cpuKernelImpl:ope}),kge={kernelName:Eo,backendName:"webgl",kernelFunc:YE};function db(e){let{inputs:t,attrs:n,backend:r}=e,{dim:s}=n,{input:a}=t,o=a.shape.length,i=a.shape.slice(),l=s;return s<0&&(k.assert(-(o+1)<=s,()=>`Axis must be in the interval [${-(o+1)}, ${o}]`),l=o+s+1),i.splice(l,0,1),ve({inputs:{x:a},backend:r,attrs:{shape:i}})}var Ige={kernelName:Mc,backendName:"webgl",kernelFunc:db},JE="return exp(x) - 1.0;",Sge=it({opSnippet:JE,packedOpSnippet:JE,cpuKernelImpl:ipe}),Tge={kernelName:ll,backendName:"webgl",kernelFunc:Sge},QE=class{constructor(e,t,n){this.variableNames=["real","imag"];let r=t[1];this.outputShape=t;let s=n?`2.0 * ${Math.PI}`:`-2.0 * ${Math.PI}`,a=n?`${r}.0`:"1.0",o;if(e==="real")o="return real * expR - imag * expI;";else if(e==="imag")o="return real * expI + imag * expR;";else throw new Error(`FFT component must be either "real" or "imag", got ${e}.`);this.userCode=` + const float exponentMultiplier = ${s}; float unaryOpComplex(float real, float expR, float imag, float expI) { - ${i} + ${o} } float mulMatDFT(int batch, int index) { - float indexRatio = float(index) / float(${a}); + float indexRatio = float(index) / float(${r}); float exponentMultiplierTimesIndexRatio = exponentMultiplier * indexRatio; float result = 0.0; - for (int i = 0; i < ${a}; i++) { + for (int i = 0; i < ${r}; i++) { // x = (-2|2 * PI / N) * index * i; float x = exponentMultiplierTimesIndexRatio * float(i); float expR = cos(x); @@ -2918,7 +2918,7 @@ return (log(1.0 + x) - log(1.0 - x)) / 2.0;`,x0e=ot({opSnippet:A0e}),b0e={kernel float imag = getImag(batch, i); result += - unaryOpComplex(real, expR, imag, expI) / ${s}; + unaryOpComplex(real, expR, imag, expI) / ${a}; } return result; @@ -2928,13 +2928,13 @@ return (log(1.0 + x) - log(1.0 - x)) / 2.0;`,x0e=ot({opSnippet:A0e}),b0e={kernel ivec2 coords = getOutputCoords(); setOutput(mulMatDFT(coords[0], coords[1])); } - `}};function eC(e,t,n){let a=n.texData.get(e.dataId),r=k.sizeFromShape(e.shape),s=e.shape[e.shape.length-1],i=r/s,o=be({inputs:{x:e},backend:n,attrs:{shape:[i,s]}}),l=o.shape,u=new QE("real",l,t),d=new QE("imag",l,t),h=[{dataId:a.complexTensorInfos.real.dataId,dtype:a.complexTensorInfos.real.dtype,shape:l},{dataId:a.complexTensorInfos.imag.dataId,dtype:a.complexTensorInfos.imag.dtype,shape:l}],p=n.runWebGLProgram(u,h,"float32"),c=n.runWebGLProgram(d,h,"float32"),m=ei({inputs:{real:p,imag:c},backend:n});n.disposeIntermediateTensorInfo(p),n.disposeIntermediateTensorInfo(c);let f=be({inputs:{x:m},backend:n,attrs:{shape:e.shape}});return n.disposeIntermediateTensorInfo(o),n.disposeIntermediateTensorInfo(m),f}function Tge(e){let{inputs:t,backend:n}=e,{input:a}=t;return eC(a,!1,n)}var Ege={kernelName:D1,backendName:"webgl",kernelFunc:Tge},Cge=class{constructor(e,t){this.outputShape=[],this.variableNames=["x"],this.outputShape=e,this.userCode=` + `}};function e9(e,t,n){let r=n.texData.get(e.dataId),s=k.sizeFromShape(e.shape),a=e.shape[e.shape.length-1],o=s/a,i=ve({inputs:{x:e},backend:n,attrs:{shape:[o,a]}}),l=i.shape,u=new QE("real",l,t),c=new QE("imag",l,t),d=[{dataId:r.complexTensorInfos.real.dataId,dtype:r.complexTensorInfos.real.dtype,shape:l},{dataId:r.complexTensorInfos.imag.dataId,dtype:r.complexTensorInfos.imag.dtype,shape:l}],h=n.runWebGLProgram(u,d,"float32"),p=n.runWebGLProgram(c,d,"float32"),f=eo({inputs:{real:h,imag:p},backend:n});n.disposeIntermediateTensorInfo(h),n.disposeIntermediateTensorInfo(p);let m=ve({inputs:{x:f},backend:n,attrs:{shape:e.shape}});return n.disposeIntermediateTensorInfo(i),n.disposeIntermediateTensorInfo(f),m}function Nge(e){let{inputs:t,backend:n}=e,{input:r}=t;return e9(r,!1,n)}var Cge={kernelName:Oy,backendName:"webgl",kernelFunc:Nge},Ege=class{constructor(e,t){this.outputShape=[],this.variableNames=["x"],this.outputShape=e,this.userCode=` uniform float value; void main() { // Input can be obtained from uniform value. setOutput(value); } - `}getCustomSetupFunc(e){return(t,n)=>{this.valueLoc==null&&(this.valueLoc=t.getUniformLocationNoThrow(n,"value")),t.gl.uniform1f(this.valueLoc,e)}}};function pb(e){let{backend:t,attrs:n}=e,{shape:a,value:r}=n,{dtype:s}=n;if(s=s||k.inferDtype(r),s==="string"){let i=k.getArrayFromDType(s,k.sizeFromShape(a));return i.fill(r),t.makeTensorInfo(a,s,i)}else{let i=new Cge(a,r),o=i.getCustomSetupFunc(r);return t.runWebGLProgram(i,[],s,o)}}var Mge={kernelName:Qc,backendName:"webgl",kernelFunc:pb},$ge=class{constructor(e){this.variableNames=["Image"],this.outputShape=[];let t=e[2];this.outputShape=e,this.userCode=` + `}getCustomSetupFunc(e){return(t,n)=>{this.valueLoc==null&&(this.valueLoc=t.getUniformLocationNoThrow(n,"value")),t.gl.uniform1f(this.valueLoc,e)}}};function hb(e){let{backend:t,attrs:n}=e,{shape:r,value:s}=n,{dtype:a}=n;if(a=a||k.inferDtype(s),a==="string"){let o=k.getArrayFromDType(a,k.sizeFromShape(r));return o.fill(s),t.makeTensorInfo(r,a,o)}else{let o=new Ege(r,s),i=o.getCustomSetupFunc(s);return t.runWebGLProgram(o,[],a,i)}}var $ge={kernelName:Qp,backendName:"webgl",kernelFunc:hb},_ge=class{constructor(e){this.variableNames=["Image"],this.outputShape=[];let t=e[2];this.outputShape=e,this.userCode=` void main() { ivec4 coords = getOutputCoords(); int x = coords[2]; @@ -2948,7 +2948,7 @@ return (log(1.0 + x) - log(1.0 - x)) / 2.0;`,x0e=ot({opSnippet:A0e}),b0e={kernel } setOutput(outputValue); } - `}},Rge={kernelName:_d,backendName:"webgl",kernelFunc:({inputs:e,backend:t})=>{let{image:n}=e,a=t,r=new $ge(n.shape);return a.runWebGLProgram(r,[n],n.dtype)}},tC="return floor(x);",Fge=ot({opSnippet:tC,packedOpSnippet:tC,cpuKernelImpl:lce}),Oge={kernelName:Ci,backendName:"webgl",kernelFunc:Fge},Dge=` + `}},Rge={kernelName:Oc,backendName:"webgl",kernelFunc:({inputs:e,backend:t})=>{let{image:n}=e,r=t,s=new _ge(n.shape);return r.runWebGLProgram(s,[n],n.dtype)}},t9="return floor(x);",Dge=it({opSnippet:t9,packedOpSnippet:t9,cpuKernelImpl:lpe}),Fge={kernelName:$o,backendName:"webgl",kernelFunc:Dge},Mge=` float s = sign(a) * sign(b); int ia = round(a); int ib = round(b); @@ -2958,7 +2958,7 @@ return (log(1.0 + x) - log(1.0 - x)) / 2.0;`,x0e=ot({opSnippet:A0e}),b0e={kernel } else { return NAN; } -`,_ge=` +`,Oge=` ivec4 ia = round(a); ivec4 ib = round(b); bvec4 cond = notEqual(ib, ivec4(0)); @@ -2979,13 +2979,13 @@ return (log(1.0 + x) - log(1.0 - x)) / 2.0;`,x0e=ot({opSnippet:A0e}),b0e={kernel result[3] = idiv(ia[3], ib[3], s[3]); } return vec4(result); -`,zge=Tn({opSnippet:Dge,packedOpSnippet:_ge,dtype:"int32"}),Pge={kernelName:ul,backendName:"webgl",kernelFunc:zge},Lge=class{constructor(e){this.variableNames=["A"];let t=Wn(),[n,a]=e;this.outputShape=e,this.userCode=` +`,Pge=Nn({opSnippet:Mge,packedOpSnippet:Oge,dtype:"int32"}),zge={kernelName:ul,backendName:"webgl",kernelFunc:Pge},Lge=class{constructor(e){this.variableNames=["A"];let t=Wn(),[n,r]=e;this.outputShape=e,this.userCode=` void main() { ivec3 coords = getOutputCoords(); int texR = coords[0]; int texC = coords[1]; int depth = coords[2]; - vec2 uv = (vec2(texC, texR) + halfCR) / vec2(${a}.0, ${n}.0); + vec2 uv = (vec2(texC, texR) + halfCR) / vec2(${r}.0, ${n}.0); vec4 values = ${t.texture2D}(A, uv); float value; @@ -3001,7 +3001,7 @@ return (log(1.0 + x) - log(1.0 - x)) / 2.0;`,x0e=ot({opSnippet:A0e}),b0e={kernel setOutput(floor(value * 255.0 + 0.5)); } - `}},Wge=class{constructor(e){this.variableNames=["A"],this.packedInputs=!1,this.packedOutput=!0;let t=Wn(),[n,a]=e;this.outputShape=e,this.userCode=` + `}},Bge=class{constructor(e){this.variableNames=["A"],this.packedInputs=!1,this.packedOutput=!0;let t=Wn(),[n,r]=e;this.outputShape=e,this.userCode=` void main() { ivec3 coords = getOutputCoords(); int texR = coords[0]; @@ -3016,7 +3016,7 @@ return (log(1.0 + x) - log(1.0 - x)) / 2.0;`,x0e=ot({opSnippet:A0e}),b0e={kernel depth = coords[2] + col; vec2 uv = (vec2(texC, texR) + halfCR) / - vec2(${a}.0, ${n}.0); + vec2(${r}.0, ${n}.0); vec4 values = ${t.texture2D}(A, uv); float value; if (depth == 0) { @@ -3035,32 +3035,32 @@ return (log(1.0 + x) - log(1.0 - x)) / 2.0;`,x0e=ot({opSnippet:A0e}),b0e={kernel ${t.output} = result; } - `}},Bge={kernelName:nA,backendName:"webgl",kernelFunc:Vge},Su;function Vge(e){let{inputs:t,backend:n,attrs:a}=e,{pixels:r}=t,{numChannels:s}=a,i=typeof HTMLVideoElement!="undefined"&&r instanceof HTMLVideoElement,o=typeof HTMLImageElement!="undefined"&&r instanceof HTMLImageElement,[l,u]=i?[r.videoWidth,r.videoHeight]:[r.width,r.height],d=[u,l],h=[u,l,s];(o||i)&&(Su==null&&(Su=document.createElement("canvas").getContext("2d")),Su.canvas.width=l,Su.canvas.height=u,Su.drawImage(r,0,0,l,u),r=Su.canvas);let p=n.makeTensorInfo(d,"int32");n.texData.get(p.dataId).usage=_a.PIXELS,n.gpgpu.uploadPixelDataToTexture(n.getTexture(p.dataId),r);let c=se().getBool("WEBGL_PACK")?new Wge(h):new Lge(h),m=n.runWebGLProgram(c,[p],"int32");return n.disposeData(p.dataId),m}function Uge(e){let{inputs:t,backend:n,attrs:a}=e,{x:r,filter:s,bias:i,preluActivationWeights:o}=t,{strides:l,pad:u,dataFormat:d,dilations:h,dimRoundingMode:p,activation:c,leakyreluAlpha:m}=a,f=M.convertConv2DDataFormat(d),g=M.computeConv2DInfo(r.shape,s.shape,l,h,u,p,!1,f),y,A=[];if(g.filterHeight===1&&g.filterWidth===1&&g.dilationHeight===1&&g.dilationWidth===1&&g.strideHeight===1&&g.strideWidth===1&&(g.padInfo.type==="SAME"||g.padInfo.type==="VALID"))y=UE({x:r,filter:s,convInfo:g,backend:n,bias:i,activation:c,preluActivationWeights:o,leakyreluAlpha:m});else if(se().getBool("WEBGL_CONV_IM2COL")&&r.shape[0]===1)y=jE({x:r,filter:s,convInfo:g,backend:n,bias:i,activation:c,preluActivationWeights:o,leakyreluAlpha:m});else{let v=i!=null,b=o!=null,w=c==="leakyrelu",I=c?j0(c,!1):null,T=new VE(g,v,I,b,w),C=[r,s];if(i&&C.push(i),o&&C.push(o),w){let z=n.makeTensorInfo([],"float32",k.createScalarValue(m,"float32"));C.push(z),A.push(z)}y=n.runWebGLProgram(T,C,"float32")}let x=be({inputs:{x:y},backend:n,attrs:{shape:g.outShape}});return A.push(y),A.forEach(v=>n.disposeIntermediateTensorInfo(v)),x}var jge={kernelName:Wl,backendName:"webgl",kernelFunc:Uge};function Hge(e){let{inputs:t,backend:n,attrs:a}=e,{x:r,filter:s,bias:i,preluActivationWeights:o}=t,{strides:l,pad:u,dilations:d,dimRoundingMode:h,activation:p,leakyreluAlpha:c}=a,m=[],f=d;f==null&&(f=[1,1]),k.assert(M.eitherStridesOrDilationsAreOne(l,f),()=>`Error in depthwiseConv2d: Either strides or dilations must be 1. Got strides ${l} and dilations '${f}'`);let g=M.computeConv2DInfo(r.shape,s.shape,l,f,u,h,!0),y=se().getBool("WEBGL_PACK_DEPTHWISECONV")&&g.strideWidth<=2&&g.outChannels/g.inChannels==1,A=p?j0(p,y):null,x=[r,s],v=i!=null,b=o!=null,w=p==="leakyrelu";if(v&&x.push(i),b&&x.push(o),w){let C=n.makeTensorInfo([],"float32",k.createScalarValue(c,"float32"));x.push(C),m.push(C)}let I;y?I=new XE(g,v,A,b,w):I=new KE(g,v,A,b,w);let T=n.runWebGLProgram(I,x,"float32");return m.forEach(C=>n.disposeIntermediateTensorInfo(C)),T}var Gge={kernelName:Bl,backendName:"webgl",kernelFunc:Hge},qge=class{constructor(e,t,n){this.sliceDim=e,this.strides=t,this.variableNames=["x","indices"],this.outputShape=n;let a=kt(t.length),r=kt(n.length),s=this.sliceDim>1?"strides[j]":"strides";this.userCode=` - ${a} strides = ${a}(${this.strides}); + `}},Wge={kernelName:rA,backendName:"webgl",kernelFunc:Vge},Su;function Vge(e){let{inputs:t,backend:n,attrs:r}=e,{pixels:s}=t,{numChannels:a}=r,o=typeof HTMLVideoElement!="undefined"&&s instanceof HTMLVideoElement,i=typeof HTMLImageElement!="undefined"&&s instanceof HTMLImageElement,[l,u]=o?[s.videoWidth,s.videoHeight]:[s.width,s.height],c=[u,l],d=[u,l,a];(i||o)&&(Su==null&&(Su=document.createElement("canvas").getContext("2d")),Su.canvas.width=l,Su.canvas.height=u,Su.drawImage(s,0,0,l,u),s=Su.canvas);let h=n.makeTensorInfo(c,"int32");n.texData.get(h.dataId).usage=zr.PIXELS,n.gpgpu.uploadPixelDataToTexture(n.getTexture(h.dataId),s);let p=ae().getBool("WEBGL_PACK")?new Bge(d):new Lge(d),f=n.runWebGLProgram(p,[h],"int32");return n.disposeData(h.dataId),f}function Uge(e){let{inputs:t,backend:n,attrs:r}=e,{x:s,filter:a,bias:o,preluActivationWeights:i}=t,{strides:l,pad:u,dataFormat:c,dilations:d,dimRoundingMode:h,activation:p,leakyreluAlpha:f}=r,m=_.convertConv2DDataFormat(c),g=_.computeConv2DInfo(s.shape,a.shape,l,d,u,h,!1,m),y,A=[];if(g.filterHeight===1&&g.filterWidth===1&&g.dilationHeight===1&&g.dilationWidth===1&&g.strideHeight===1&&g.strideWidth===1&&(g.padInfo.type==="SAME"||g.padInfo.type==="VALID"))y=UE({x:s,filter:a,convInfo:g,backend:n,bias:o,activation:p,preluActivationWeights:i,leakyreluAlpha:f});else if(ae().getBool("WEBGL_CONV_IM2COL")&&s.shape[0]===1)y=HE({x:s,filter:a,convInfo:g,backend:n,bias:o,activation:p,preluActivationWeights:i,leakyreluAlpha:f});else{let b=o!=null,v=i!=null,w=p==="leakyrelu",I=p?Gm(p,!1):null,T=new VE(g,b,I,v,w),C=[s,a];if(o&&C.push(o),i&&C.push(i),w){let M=n.makeTensorInfo([],"float32",k.createScalarValue(f,"float32"));C.push(M),A.push(M)}y=n.runWebGLProgram(T,C,"float32")}let x=ve({inputs:{x:y},backend:n,attrs:{shape:g.outShape}});return A.push(y),A.forEach(b=>n.disposeIntermediateTensorInfo(b)),x}var Hge={kernelName:Bl,backendName:"webgl",kernelFunc:Uge};function Gge(e){let{inputs:t,backend:n,attrs:r}=e,{x:s,filter:a,bias:o,preluActivationWeights:i}=t,{strides:l,pad:u,dilations:c,dimRoundingMode:d,activation:h,leakyreluAlpha:p}=r,f=[],m=c;m==null&&(m=[1,1]),k.assert(_.eitherStridesOrDilationsAreOne(l,m),()=>`Error in depthwiseConv2d: Either strides or dilations must be 1. Got strides ${l} and dilations '${m}'`);let g=_.computeConv2DInfo(s.shape,a.shape,l,m,u,d,!0),y=ae().getBool("WEBGL_PACK_DEPTHWISECONV")&&g.strideWidth<=2&&g.outChannels/g.inChannels==1,A=h?Gm(h,y):null,x=[s,a],b=o!=null,v=i!=null,w=h==="leakyrelu";if(b&&x.push(o),v&&x.push(i),w){let C=n.makeTensorInfo([],"float32",k.createScalarValue(p,"float32"));x.push(C),f.push(C)}let I;y?I=new XE(g,b,A,v,w):I=new KE(g,b,A,v,w);let T=n.runWebGLProgram(I,x,"float32");return f.forEach(C=>n.disposeIntermediateTensorInfo(C)),T}var jge={kernelName:Wl,backendName:"webgl",kernelFunc:Gge},qge=class{constructor(e,t,n){this.sliceDim=e,this.strides=t,this.variableNames=["x","indices"],this.outputShape=n;let r=It(t.length),s=It(n.length),a=this.sliceDim>1?"strides[j]":"strides";this.userCode=` + ${r} strides = ${r}(${this.strides}); void main() { - ${r} coords = getOutputCoords(); + ${s} coords = getOutputCoords(); int flattenIndex = 0; for (int j = 0; j < ${this.sliceDim}; j++) { int index = round(getIndices(coords[0], j)); - flattenIndex += index * ${s}; + flattenIndex += index * ${a}; } setOutput(getX(flattenIndex, coords[1])); } - `}};function Kge(e){let{inputs:t,backend:n}=e,{params:a,indices:r}=t,s=r.shape,i=s[s.length-1],o=k.sizeFromShape(a.shape),[l,u,d,h]=M.prepareAndValidate(a,r),p=be({inputs:{x:r},backend:n,attrs:{shape:[u,i]}}),c=be({inputs:{x:a},backend:n,attrs:{shape:[k.sizeFromShape(a.shape)/d,d]}});if(n.shouldExecuteOnCPU([a,r])||a.dtype==="string"){let y=n.readSync(r.dataId),A=n.bufferSync(a),x=uce(y,A,a.dtype,u,i,d,h,a.shape,o);return n.makeTensorInfo(l,a.dtype,x.values)}let m=new qge(i,h,[u,d]),f=n.runWebGLProgram(m,[c,p],c.dtype),g=be({inputs:{x:f},backend:n,attrs:{shape:l}});return n.disposeIntermediateTensorInfo(p),n.disposeIntermediateTensorInfo(c),n.disposeIntermediateTensorInfo(f),g}var Xge={kernelName:Pd,backendName:"webgl",kernelFunc:Kge},Zge=class{constructor(e,t){this.variableNames=["A","indices"],this.outputShape=t,this.rank=t.length;let n=kt(this.rank),a=Yge(e,2);this.userCode=` + `}};function Kge(e){let{inputs:t,backend:n}=e,{params:r,indices:s}=t,a=s.shape,o=a[a.length-1],i=k.sizeFromShape(r.shape),[l,u,c,d]=_.prepareAndValidate(r,s),h=ve({inputs:{x:s},backend:n,attrs:{shape:[u,o]}}),p=ve({inputs:{x:r},backend:n,attrs:{shape:[k.sizeFromShape(r.shape)/c,c]}});if(n.shouldExecuteOnCPU([r,s])||r.dtype==="string"){let y=n.readSync(s.dataId),A=n.bufferSync(r),x=upe(y,A,r.dtype,u,o,c,d,r.shape,i);return n.makeTensorInfo(l,r.dtype,x.values)}let f=new qge(o,d,[u,c]),m=n.runWebGLProgram(f,[p,h],p.dtype),g=ve({inputs:{x:m},backend:n,attrs:{shape:l}});return n.disposeIntermediateTensorInfo(h),n.disposeIntermediateTensorInfo(p),n.disposeIntermediateTensorInfo(m),g}var Xge={kernelName:zc,backendName:"webgl",kernelFunc:Kge},Zge=class{constructor(e,t){this.variableNames=["A","indices"],this.outputShape=t,this.rank=t.length;let n=It(this.rank),r=Yge(e,2);this.userCode=` void main() { ${n} resRC = getOutputCoords(); - setOutput(getA(${a})); + setOutput(getA(${r})); } - `}};function Yge(e,t){let n=["resRC.x","resRC.y","resRC.z","resRC.w"],a=[];for(let r=0;rn.disposeIntermediateTensorInfo(b)),n.makeTensorInfo(u.outputShape,v.dtype,v.values)}let f=new Zge(p.shape,m),g=n.runWebGLProgram(f,[p,c],p.dtype);h.push(g);let y=be({inputs:{x:g},backend:n,attrs:{shape:u.outputShape}});return h.forEach(A=>n.disposeIntermediateTensorInfo(A)),y}var Qge={kernelName:zd,backendName:"webgl",kernelFunc:Jge},eye="return float(a > b);",tye=` + `}};function Yge(e,t){let n=["resRC.x","resRC.y","resRC.z","resRC.w"],r=[];for(let s=0;sn.disposeIntermediateTensorInfo(v)),n.makeTensorInfo(u.outputShape,b.dtype,b.values)}let m=new Zge(h.shape,f),g=n.runWebGLProgram(m,[h,p],h.dtype);d.push(g);let y=ve({inputs:{x:g},backend:n,attrs:{shape:u.outputShape}});return d.forEach(A=>n.disposeIntermediateTensorInfo(A)),y}var Qge={kernelName:Pc,backendName:"webgl",kernelFunc:Jge},e2e="return float(a > b);",t2e=` return vec4(greaterThan(a, b)); -`,nye=Tn({opSnippet:eye,packedOpSnippet:tye,cpuKernelImpl:hce,dtype:"bool"}),aye={kernelName:hl,backendName:"webgl",kernelFunc:nye},rye="return float(a >= b);",sye=` +`,n2e=Nn({opSnippet:e2e,packedOpSnippet:t2e,cpuKernelImpl:dpe,dtype:"bool"}),r2e={kernelName:dl,backendName:"webgl",kernelFunc:n2e},s2e="return float(a >= b);",a2e=` return vec4(greaterThanEqual(a, b)); -`,iye=Tn({opSnippet:rye,packedOpSnippet:sye,dtype:"bool",cpuKernelImpl:pce}),oye={kernelName:Mi,backendName:"webgl",kernelFunc:iye};function lye(e){let{inputs:t,backend:n}=e,{input:a}=t;return eC(a,!0,n)}var uye={kernelName:_1,backendName:"webgl",kernelFunc:lye},dye="return float(!isnan(x) && !isinf(x));",hye=ot({opSnippet:dye,dtype:"bool"}),pye={kernelName:Ld,backendName:"webgl",kernelFunc:hye},cye="return float(isinf(x));",fye=ot({opSnippet:cye,dtype:"bool"}),mye={kernelName:Wd,backendName:"webgl",kernelFunc:fye},gye="return float(isnan(x));",yye=ot({opSnippet:gye,dtype:"bool"}),Aye={kernelName:Bd,backendName:"webgl",kernelFunc:yye},xye="return float(a < b);",bye=` +`,o2e=Nn({opSnippet:s2e,packedOpSnippet:a2e,dtype:"bool",cpuKernelImpl:hpe}),i2e={kernelName:_o,backendName:"webgl",kernelFunc:o2e};function l2e(e){let{inputs:t,backend:n}=e,{input:r}=t;return e9(r,!0,n)}var u2e={kernelName:Py,backendName:"webgl",kernelFunc:l2e},c2e="return float(!isnan(x) && !isinf(x));",d2e=it({opSnippet:c2e,dtype:"bool"}),h2e={kernelName:Lc,backendName:"webgl",kernelFunc:d2e},p2e="return float(isinf(x));",f2e=it({opSnippet:p2e,dtype:"bool"}),m2e={kernelName:Bc,backendName:"webgl",kernelFunc:f2e},g2e="return float(isnan(x));",y2e=it({opSnippet:g2e,dtype:"bool"}),A2e={kernelName:Wc,backendName:"webgl",kernelFunc:y2e},x2e="return float(a < b);",b2e=` return vec4(lessThan(a, b)); -`,vye=Tn({opSnippet:xye,packedOpSnippet:bye,cpuKernelImpl:cce,dtype:"bool"}),wye={kernelName:fl,backendName:"webgl",kernelFunc:vye},kye="return float(a <= b);",Iye=` +`,v2e=Nn({opSnippet:x2e,packedOpSnippet:b2e,cpuKernelImpl:ppe,dtype:"bool"}),w2e={kernelName:fl,backendName:"webgl",kernelFunc:v2e},k2e="return float(a <= b);",I2e=` return vec4(lessThanEqual(a, b)); -`,Sye=Tn({opSnippet:kye,packedOpSnippet:Iye,cpuKernelImpl:fce,dtype:"bool"}),Nye={kernelName:ml,backendName:"webgl",kernelFunc:Sye};function Tye(e){let{backend:t,attrs:n}=e,{start:a,stop:r,num:s}=n,i=mce(a,r,s);return t.makeTensorInfo([i.length],"float32",i)}var Eye={kernelName:P1,backendName:"webgl",kernelFunc:Tye},Cye=`if (x < 0.0) return NAN; - return log(x);`,Mye=` +`,S2e=Nn({opSnippet:k2e,packedOpSnippet:I2e,cpuKernelImpl:fpe,dtype:"bool"}),T2e={kernelName:ml,backendName:"webgl",kernelFunc:S2e};function N2e(e){let{backend:t,attrs:n}=e,{start:r,stop:s,num:a}=n,o=mpe(r,s,a);return t.makeTensorInfo([o.length],"float32",o)}var C2e={kernelName:Ly,backendName:"webgl",kernelFunc:N2e},E2e=`if (x < 0.0) return NAN; + return log(x);`,$2e=` vec4 result = log(x); vec4 isNaN = vec4(lessThan(x, vec4(0.0))); result.r = isNaN.r == 1.0 ? NAN : result.r; @@ -3069,16 +3069,16 @@ return (log(1.0 + x) - log(1.0 - x)) / 2.0;`,x0e=ot({opSnippet:A0e}),b0e={kernel result.a = isNaN.a == 1.0 ? NAN : result.a; return result; -`,$ye=ot({opSnippet:Cye,packedOpSnippet:Mye,cpuKernelImpl:gce}),Rye={kernelName:$i,backendName:"webgl",kernelFunc:$ye},Fye="return log(1.0 + x);",Oye=ot({opSnippet:Fye}),Dye={kernelName:Vd,backendName:"webgl",kernelFunc:Oye},_ye="return float(a >= 1.0 && b >= 1.0);",zye=` +`,_2e=it({opSnippet:E2e,packedOpSnippet:$2e,cpuKernelImpl:gpe}),R2e={kernelName:Ro,backendName:"webgl",kernelFunc:_2e},D2e="return log(1.0 + x);",F2e=it({opSnippet:D2e}),M2e={kernelName:Vc,backendName:"webgl",kernelFunc:F2e},O2e="return float(a >= 1.0 && b >= 1.0);",P2e=` return vec4( vec4(greaterThanEqual(a, vec4(1.0))) * vec4(greaterThanEqual(b, vec4(1.0)))); -`,Pye=Tn({opSnippet:_ye,packedOpSnippet:zye,dtype:"bool"}),Lye={kernelName:Ud,backendName:"webgl",kernelFunc:Pye},Wye="return float(!(x >= 1.0));",Bye=ot({opSnippet:Wye}),Vye={kernelName:ef,backendName:"webgl",kernelFunc:Bye},Uye="return float(a >= 1.0 || b >= 1.0);",jye=` +`,z2e=Nn({opSnippet:O2e,packedOpSnippet:P2e,dtype:"bool"}),L2e={kernelName:Uc,backendName:"webgl",kernelFunc:z2e},B2e="return float(!(x >= 1.0));",W2e=it({opSnippet:B2e}),V2e={kernelName:ef,backendName:"webgl",kernelFunc:W2e},U2e="return float(a >= 1.0 || b >= 1.0);",H2e=` return min( vec4(greaterThanEqual(a, vec4(1.0))) + vec4(greaterThanEqual(b, vec4(1.0))), vec4(1.0)); -`,Hye=Tn({opSnippet:Uye,packedOpSnippet:jye,dtype:"bool"}),Gye={kernelName:tf,backendName:"webgl",kernelFunc:Hye},qye=class{constructor(e,t,n,a,r){this.variableNames=["x"],this.outputShape=[];let s=t,i=e[3]-1;this.outputShape=e;let o,l=`float(${n}) + float(${a}) * sum`;r===.5?o=`inversesqrt(${l})`:r===1?o=`1.0/(${l})`:o=`exp(log(${l}) * float(-${r}));`,this.userCode=` +`,G2e=Nn({opSnippet:U2e,packedOpSnippet:H2e,dtype:"bool"}),j2e={kernelName:tf,backendName:"webgl",kernelFunc:G2e},q2e=class{constructor(e,t,n,r,s){this.variableNames=["x"],this.outputShape=[];let a=t,o=e[3]-1;this.outputShape=e;let i,l=`float(${n}) + float(${r}) * sum`;s===.5?i=`inversesqrt(${l})`:s===1?i=`1.0/(${l})`:i=`exp(log(${l}) * float(-${s}));`,this.userCode=` void main() { ivec4 coords = getOutputCoords(); int b = coords[0]; @@ -3087,17 +3087,17 @@ return (log(1.0 + x) - log(1.0 - x)) / 2.0;`,x0e=ot({opSnippet:A0e}),b0e={kernel int d = coords[3]; float x = getX(b, r, c, d); float sum = 0.0; - for (int j = -${s}; j <= ${s}; j++) { + for (int j = -${a}; j <= ${a}; j++) { int idx = d + j; - if (idx >= 0 && idx <= ${i}) { + if (idx >= 0 && idx <= ${o}) { float z = getX(b, r, c, idx); sum += z * z; } } - float val = x * ${o}; + float val = x * ${i}; setOutput(val); } - `}},Kye=class{constructor(e,t,n,a,r){this.variableNames=["x"],this.outputShape=[],this.packedInputs=!0,this.packedOutput=!0;let s=t,i=e[3]-1;this.outputShape=e;let o,l=`float(${n}) + float(${a}) * sum`;r===.5?o=`inversesqrt(${l})`:r===1?o=`1.0/(${l})`:o=`exp(log(${l}) * float(-${r}));`,this.userCode=` + `}},K2e=class{constructor(e,t,n,r,s){this.variableNames=["x"],this.outputShape=[],this.packedInputs=!0,this.packedOutput=!0;let a=t,o=e[3]-1;this.outputShape=e;let i,l=`float(${n}) + float(${r}) * sum`;s===.5?i=`inversesqrt(${l})`:s===1?i=`1.0/(${l})`:i=`exp(log(${l}) * float(-${s}));`,this.userCode=` void main() { ivec4 coords = getOutputCoords(); int b = coords.x; @@ -3121,7 +3121,7 @@ return (log(1.0 + x) - log(1.0 - x)) / 2.0;`,x0e=ot({opSnippet:A0e}),b0e={kernel getChannel(xFragAtOutputCoords, vec2(c + 1, d + 1)) : 0.0 ); - int firstChannel = d - ${s}; + int firstChannel = d - ${a}; vec2 cache = vec2(0.); if(firstChannel >= 0){ vec4 firstChannelFrag = getX(b, r, c, firstChannel); @@ -3132,10 +3132,10 @@ return (log(1.0 + x) - log(1.0 - x)) / 2.0;`,x0e=ot({opSnippet:A0e}),b0e={kernel } ivec2 depth = ivec2(d, d + 1); - for (int j = - ${s}; j <= ${s}; j++) { + for (int j = - ${a}; j <= ${a}; j++) { ivec2 idx = depth + j; bvec2 aboveLowerBound = greaterThanEqual(idx, ivec2(0)); - bvec2 belowUpperBound = lessThanEqual(idx, ivec2(${i})); + bvec2 belowUpperBound = lessThanEqual(idx, ivec2(${o})); bool depthInRange = aboveLowerBound.x && belowUpperBound.x; bool depthPlusOneInRange = aboveLowerBound.y && belowUpperBound.y; @@ -3156,10 +3156,10 @@ return (log(1.0 + x) - log(1.0 - x)) / 2.0;`,x0e=ot({opSnippet:A0e}),b0e={kernel sum += z * z; } } - vec4 result = xAtOutputCoords * ${o}; + vec4 result = xAtOutputCoords * ${i}; setOutput(result); } - `}},Xye=e=>{let{inputs:t,backend:n,attrs:a}=e,{x:r}=t,{depthRadius:s,bias:i,alpha:o,beta:l}=a,u=se().getBool("WEBGL_PACK_NORMALIZATION")?new Kye(r.shape,s,i,o,l):new qye(r.shape,s,i,o,l);return n.runWebGLProgram(u,[r],r.dtype)},Zye={kernelName:nf,backendName:"webgl",kernelFunc:Xye},Yye=class{constructor(e,t,n,a,r){this.variableNames=["inputImage","outputImage","dy"],this.outputShape=[],this.outputShape=e,this.depth=e[3],this.depthRadius=t,this.bias=n,this.alpha=a,this.beta=r,this.userCode=` + `}},X2e=e=>{let{inputs:t,backend:n,attrs:r}=e,{x:s}=t,{depthRadius:a,bias:o,alpha:i,beta:l}=r,u=ae().getBool("WEBGL_PACK_NORMALIZATION")?new K2e(s.shape,a,o,i,l):new q2e(s.shape,a,o,i,l);return n.runWebGLProgram(u,[s],s.dtype)},Z2e={kernelName:nf,backendName:"webgl",kernelFunc:X2e},Y2e=class{constructor(e,t,n,r,s){this.variableNames=["inputImage","outputImage","dy"],this.outputShape=[],this.outputShape=e,this.depth=e[3],this.depthRadius=t,this.bias=n,this.alpha=r,this.beta=s,this.userCode=` void main() { ivec4 coords = getOutputCoords(); int b = coords[0]; @@ -3188,19 +3188,19 @@ return (log(1.0 + x) - log(1.0 - x)) / 2.0;`,x0e=ot({opSnippet:A0e}),b0e={kernel } } - norm = float(${a}) * norm + float(${n}); + norm = float(${r}) * norm + float(${n}); for(int k = MIN_DEPTH_BEGIN; k < MAX_DEPTH_END; ++k){ if (k < depthBegin){ continue; } else if (k >= depthBegin && k < depthEnd){ - float dyi = -2.0 * float(${a}) - * float(${r}) + float dyi = -2.0 * float(${r}) + * float(${s}) * getInputImage(b ,r ,c, k) * getOutputImage(b, r, c, d) / norm; if (k == d) { - dyi += pow(norm, -1.0 * ${r}); + dyi += pow(norm, -1.0 * ${s}); } if (k == coords[3]) { dyi *= getDy(b, r, c, d); @@ -3214,15 +3214,15 @@ return (log(1.0 + x) - log(1.0 - x)) / 2.0;`,x0e=ot({opSnippet:A0e}),b0e={kernel } setOutput(result); } - `}},Jye=e=>{let{inputs:t,backend:n,attrs:a}=e,{x:r,y:s,dy:i}=t,{depthRadius:o,bias:l,alpha:u,beta:d}=a,h=new Yye(r.shape,o,l,u,d);return n.runWebGLProgram(h,[r,s,i],r.dtype)},Qye={kernelName:L1,backendName:"webgl",kernelFunc:Jye};function e1e(e,t,n,a){let r=k.sizeFromShape(t),s=k.sizeFromShape(e.shape)/r,i=be({inputs:{x:e},attrs:{shape:[s,r]},backend:a}),o=bo(i,e.dtype,"max",a),l=be({inputs:{x:o},attrs:{shape:n},backend:a});return a.disposeIntermediateTensorInfo(i),a.disposeIntermediateTensorInfo(o),l}function nC(e){let{inputs:t,backend:n,attrs:a}=e,{x:r}=t,{reductionIndices:s,keepDims:i}=a,o=r.shape.length,l=k.parseAxisParam(s,r.shape),u=l,d=M.getAxesPermutation(u,o),h=d!=null,p=n.shouldExecuteOnCPU([r]),c=r;if(h){if(p){let A=n.texData.get(c.dataId).values,x=new Array(o);for(let w=0;w{let{inputs:t,backend:n,attrs:r}=e,{x:s,y:a,dy:o}=t,{depthRadius:i,bias:l,alpha:u,beta:c}=r,d=new Y2e(s.shape,i,l,u,c);return n.runWebGLProgram(d,[s,a,o],s.dtype)},Q2e={kernelName:By,backendName:"webgl",kernelFunc:J2e};function eye(e,t,n,r){let s=k.sizeFromShape(t),o=k.sizeFromShape(e.shape)/s,i=ve({inputs:{x:e},attrs:{shape:[o,s]},backend:r}),l=bi(i,e.dtype,"max",r),u=ve({inputs:{x:l},attrs:{shape:n},backend:r});return r.disposeIntermediateTensorInfo(i),r.disposeIntermediateTensorInfo(l),u}function n9(e){let{inputs:t,backend:n,attrs:r}=e,{x:s}=t,{reductionIndices:a,keepDims:o}=r,i=s.shape.length,l=k.parseAxisParam(a,s.shape),u=l,c=_.getAxesPermutation(u,i),d=c!=null,h=n.shouldExecuteOnCPU([s]),p=s;if(d){if(h){let x=n.texData.get(p.dataId).values,b=new Array(i);for(let I=0;I`Error in maxPool: Either strides or dilations must be 1. Got strides ${i} and dilations '${u}'`);let d=M.computePool2DInfo(r.shape,s,i,u,o,l);if(d.filterWidth===1&&d.filterHeight===1&&k.arraysEqual(d.inShape,d.outShape))return fa({inputs:{x:r},backend:n});let h=new cp(d,"max",!1);return n.runWebGLProgram(h,[r],r.dtype)}var o1e={kernelName:yl,backendName:"webgl",kernelFunc:i1e};function l1e(e){let{inputs:t,backend:n,attrs:a}=e,{x:r}=t,{filterSize:s,strides:i,pad:o,dataFormat:l,dimRoundingMode:u}=a,d=[1,1,1],h=M.computePool3DInfo(r.shape,s,i,d,o,u,l),p=new lb(h,"max",!1);return n.runWebGLProgram(p,[r],r.dtype)}var u1e={kernelName:af,backendName:"webgl",kernelFunc:l1e},d1e=class{constructor(e){this.variableNames=["dy","maxPos"],this.outputShape=e.inShape;let t=e.strideHeight,n=e.strideWidth,a=e.dilationHeight,r=e.effectiveFilterHeight,s=e.effectiveFilterWidth,i=r-1-e.padInfo.top,o=s-1-e.padInfo.left,l=r*s-1;this.userCode=` - const ivec2 pads = ivec2(${i}, ${o}); +`,sye=Nn({opSnippet:nye,packedOpSnippet:rye,cpuKernelImpl:Ape}),aye={kernelName:Do,backendName:"webgl",kernelFunc:sye};function oye(e){let{inputs:t,backend:n,attrs:r}=e,{x:s}=t;mu(s,"maxPool");let{filterSize:a,strides:o,pad:i,dimRoundingMode:l}=r,u=1;k.assert(_.eitherStridesOrDilationsAreOne(o,u),()=>`Error in maxPool: Either strides or dilations must be 1. Got strides ${o} and dilations '${u}'`);let c=_.computePool2DInfo(s.shape,a,o,u,i,l);if(c.filterWidth===1&&c.filterHeight===1&&k.arraysEqual(c.inShape,c.outShape))return mr({inputs:{x:s},backend:n});let d=new ph(c,"max",!1);return n.runWebGLProgram(d,[s],s.dtype)}var iye={kernelName:yl,backendName:"webgl",kernelFunc:oye};function lye(e){let{inputs:t,backend:n,attrs:r}=e,{x:s}=t,{filterSize:a,strides:o,pad:i,dataFormat:l,dimRoundingMode:u}=r,c=[1,1,1],d=_.computePool3DInfo(s.shape,a,o,c,i,u,l),h=new lb(d,"max",!1);return n.runWebGLProgram(h,[s],s.dtype)}var uye={kernelName:rf,backendName:"webgl",kernelFunc:lye},cye=class{constructor(e){this.variableNames=["dy","maxPos"],this.outputShape=e.inShape;let t=e.strideHeight,n=e.strideWidth,r=e.dilationHeight,s=e.effectiveFilterHeight,a=e.effectiveFilterWidth,o=s-1-e.padInfo.top,i=a-1-e.padInfo.left,l=s*a-1;this.userCode=` + const ivec2 pads = ivec2(${o}, ${i}); void main() { ivec4 coords = getOutputCoords(); @@ -3236,8 +3236,8 @@ return (log(1.0 + x) - log(1.0 - x)) / 2.0;`,x0e=ot({opSnippet:A0e}),b0e={kernel // Convolve dy(?, ?, d) with pos mask(:, :, d) to get dx(xR, xC, d). // ? = to be determined. : = across all values in that axis. float dotProd = 0.0; - for (int wR = 0; wR < ${r}; - wR += ${a}) { + for (int wR = 0; wR < ${s}; + wR += ${r}) { float dyR = float(dyRCorner + wR) / ${t}.0; if (dyR < 0.0 || dyR >= ${e.outHeight}.0 || fract(dyR) > 0.0) { @@ -3245,7 +3245,7 @@ return (log(1.0 + x) - log(1.0 - x)) / 2.0;`,x0e=ot({opSnippet:A0e}),b0e={kernel } int idyR = int(dyR); - for (int wC = 0; wC < ${s}; wC++) { + for (int wC = 0; wC < ${a}; wC++) { float dyC = float(dyCCorner + wC) / ${n}.0; if (dyC < 0.0 || dyC >= ${e.outWidth}.0 || @@ -3259,7 +3259,7 @@ return (log(1.0 + x) - log(1.0 - x)) / 2.0;`,x0e=ot({opSnippet:A0e}),b0e={kernel // Get the current value, check it against the value from the // position matrix. - int curPosValue = wR * ${s} + wC; + int curPosValue = wR * ${a} + wC; float mask = float(maxPosValue == curPosValue ? 1.0 : 0.0); dotProd += dyValue * mask; @@ -3267,8 +3267,8 @@ return (log(1.0 + x) - log(1.0 - x)) / 2.0;`,x0e=ot({opSnippet:A0e}),b0e={kernel } setOutput(dotProd); } - `}},h1e=class{constructor(e){this.variableNames=["dy","maxPos"],this.outputShape=e.inShape;let t=e.strideDepth,n=e.strideHeight,a=e.strideWidth,r=e.dilationDepth,s=e.dilationHeight,i=e.dilationWidth,o=e.effectiveFilterDepth,l=e.effectiveFilterHeight,u=e.effectiveFilterWidth,d=o-1-e.padInfo.front,h=l-1-e.padInfo.top,p=u-1-e.padInfo.left,c=o*l*u-1;this.userCode=` - const ivec3 pads = ivec3(${d}, ${h}, ${p}); + `}},dye=class{constructor(e){this.variableNames=["dy","maxPos"],this.outputShape=e.inShape;let t=e.strideDepth,n=e.strideHeight,r=e.strideWidth,s=e.dilationDepth,a=e.dilationHeight,o=e.dilationWidth,i=e.effectiveFilterDepth,l=e.effectiveFilterHeight,u=e.effectiveFilterWidth,c=i-1-e.padInfo.front,d=l-1-e.padInfo.top,h=u-1-e.padInfo.left,p=i*l*u-1;this.userCode=` + const ivec3 pads = ivec3(${c}, ${d}, ${h}); void main() { ivec5 coords = getOutputCoords(); @@ -3285,8 +3285,8 @@ return (log(1.0 + x) - log(1.0 - x)) / 2.0;`,x0e=ot({opSnippet:A0e}),b0e={kernel // ? = to be determined. : = across all values in that axis. float dotProd = 0.0; - for (int wD = 0; wD < ${o}; - wD += ${r}) { + for (int wD = 0; wD < ${i}; + wD += ${s}) { float dyD = float(dyDCorner + wD) / ${t}.0; if (dyD < 0.0 || dyD >= ${e.outDepth}.0 || fract(dyD) > 0.0) { @@ -3295,7 +3295,7 @@ return (log(1.0 + x) - log(1.0 - x)) / 2.0;`,x0e=ot({opSnippet:A0e}),b0e={kernel int idyD = int(dyD); for (int wR = 0; wR < ${l}; - wR += ${s}) { + wR += ${a}) { float dyR = float(dyRCorner + wR) / ${n}.0; if (dyR < 0.0 || dyR >= ${e.outHeight}.0 || @@ -3305,8 +3305,8 @@ return (log(1.0 + x) - log(1.0 - x)) / 2.0;`,x0e=ot({opSnippet:A0e}),b0e={kernel int idyR = int(dyR); for (int wC = 0; wC < ${u}; - wC += ${i}) { - float dyC = float(dyCCorner + wC) / ${a}.0; + wC += ${o}) { + float dyC = float(dyCCorner + wC) / ${r}.0; if (dyC < 0.0 || dyC >= ${e.outWidth}.0 || fract(dyC) > 0.0) { @@ -3315,7 +3315,7 @@ return (log(1.0 + x) - log(1.0 - x)) / 2.0;`,x0e=ot({opSnippet:A0e}),b0e={kernel int idyC = int(dyC); float dyValue = getDy(batch, idyD, idyR, idyC, ch); - int maxPosValue = ${c} - + int maxPosValue = ${p} - int(getMaxPos(batch, idyD, idyR, idyC, ch)); // Get the current value, check it against the value from the @@ -3331,16 +3331,16 @@ return (log(1.0 + x) - log(1.0 - x)) / 2.0;`,x0e=ot({opSnippet:A0e}),b0e={kernel } setOutput(dotProd); } - `}};function p1e(e){let{inputs:t,backend:n,attrs:a}=e,{dy:r,input:s}=t,i=s,{filterSize:o,strides:l,pad:u,dimRoundingMode:d}=a,h=[1,1,1],p=M.computePool3DInfo(i.shape,o,l,h,u,d),c=new lb(p,"max",!0),m=n.runWebGLProgram(c,[i],i.dtype),f=new h1e(p),g=n.runWebGLProgram(f,[r,m],i.dtype);return n.disposeIntermediateTensorInfo(m),g}var c1e={kernelName:B1,backendName:"webgl",kernelFunc:p1e};function f1e(e){let{inputs:t,backend:n,attrs:a}=e,{dy:r,input:s,output:i}=t,o=s;mu([s,i],"maxPoolGrad");let{filterSize:l,strides:u,pad:d,dimRoundingMode:h}=a,p=M.computePool2DInfo(o.shape,l,u,1,d,h),c=!0,m=new cp(p,"max",c),f=n.runWebGLProgram(m,[o],o.dtype),g=new d1e(p),y=n.runWebGLProgram(g,[r,f],o.dtype);return n.disposeIntermediateTensorInfo(f),y}var m1e={kernelName:W1,backendName:"webgl",kernelFunc:f1e};function g1e(e,t,n,a){let r=new cp(n,"max",!1),s=a.runWebGLProgram(r,[e],"float32");r=new cp(n,"max",!0,!0,t);let i=a.runWebGLProgram(r,[e],"float32");return[s,i]}var y1e={kernelName:V1,backendName:"webgl",kernelFunc:({inputs:e,attrs:t,backend:n})=>{let{x:a}=e,{filterSize:r,strides:s,pad:i,includeBatchInIndex:o}=t,l=n;k.assert(a.shape.length===4,()=>`Error in maxPool: input must be rank 4 but got rank ${a.shape.length}.`);let u=[1,1];k.assert(M.eitherStridesOrDilationsAreOne(s,u),()=>`Error in maxPool: Either strides or dilations must be 1. Got strides ${s} and dilations '${u}'`);let d=M.computePool2DInfo(a.shape,r,s,u,i),[h,p]=g1e(a,o,d,l);return[h,p]}};function A1e(e,t,n,a){let r=k.sizeFromShape(t),s=k.sizeFromShape(e.shape)/r,i=be({inputs:{x:e},attrs:{shape:[s,r]},backend:a}),o=bo(i,"float32","mean",a),l=be({inputs:{x:o},attrs:{shape:n},backend:a});return a.disposeIntermediateTensorInfo(i),a.disposeIntermediateTensorInfo(o),l}var x1e={kernelName:Al,backendName:"webgl",kernelFunc:({inputs:e,attrs:t,backend:n})=>{let{x:a}=e,{keepDims:r,axis:s}=t,i=n,o=a.shape.length,l=k.parseAxisParam(s,a.shape),u=l,d=M.getAxesPermutation(u,o),h=d!=null,p=i.shouldExecuteOnCPU([a]),c=[],m=a;if(h){if(p){let x=i.texData.get(m.dataId).values,v=new Array(o);for(let I=0;I{let{x:r}=e,{filterSize:s,strides:a,pad:o,includeBatchInIndex:i}=t,l=n;k.assert(r.shape.length===4,()=>`Error in maxPool: input must be rank 4 but got rank ${r.shape.length}.`);let u=[1,1];k.assert(_.eitherStridesOrDilationsAreOne(a,u),()=>`Error in maxPool: Either strides or dilations must be 1. Got strides ${a} and dilations '${u}'`);let c=_.computePool2DInfo(r.shape,s,a,u,o),[d,h]=gye(r,i,c,l);return[d,h]}};function Aye(e,t,n,r){let s=k.sizeFromShape(t),o=k.sizeFromShape(e.shape)/s,i=ve({inputs:{x:e},attrs:{shape:[o,s]},backend:r}),l=bi(i,"float32","mean",r),u=ve({inputs:{x:l},attrs:{shape:n},backend:r});return r.disposeIntermediateTensorInfo(i),r.disposeIntermediateTensorInfo(l),u}var xye={kernelName:Al,backendName:"webgl",kernelFunc:({inputs:e,attrs:t,backend:n})=>{let{x:r}=e,{keepDims:s,axis:a}=t,o=n,i=r.shape.length,l=k.parseAxisParam(a,r.shape),u=l,c=_.getAxesPermutation(u,i),d=c!=null,h=o.shouldExecuteOnCPU([r]),p=[],f=r;if(d){if(h){let b=o.texData.get(f.dataId).values,v=new Array(i);for(let T=0;Tu[0]+e[d]+u[1]);let a=e.length,r=kt(a),s=t.map(u=>u[0]).join(","),i=t.map((u,d)=>u[0]+e[d]).join(","),o=["coords[0]","coords[1]","coords[2]","coords[3]"].slice(0,a),l=n==="reflect"?0:1;if(a===1){this.userCode=` - int start = ${s}; - int end = ${i}; +`,Iye=Nn({opSnippet:wye,packedOpSnippet:kye,cpuKernelImpl:xpe}),Sye={kernelName:Fo,backendName:"webgl",kernelFunc:Iye},Tye=class{constructor(e,t,n){this.variableNames=["x"],this.outputShape=t.map((u,c)=>u[0]+e[c]+u[1]);let r=e.length,s=It(r),a=t.map(u=>u[0]).join(","),o=t.map((u,c)=>u[0]+e[c]).join(","),i=["coords[0]","coords[1]","coords[2]","coords[3]"].slice(0,r),l=n==="reflect"?0:1;if(r===1){this.userCode=` + int start = ${a}; + int end = ${o}; void main() { int outC = getOutputCoords(); @@ -3352,84 +3352,84 @@ return (log(1.0 + x) - log(1.0 - x)) / 2.0;`,x0e=ot({opSnippet:A0e}),b0e={kernel setOutput(getX(outC - start)); } `;return}this.userCode=` - ${r} start = ${r}(${s}); - ${r} end = ${r}(${i}); + ${s} start = ${s}(${a}); + ${s} end = ${s}(${o}); void main() { - ${r} outC = getOutputCoords(); - for (int i = 0; i < ${a}; i++) { + ${s} outC = getOutputCoords(); + for (int i = 0; i < ${r}; i++) { if (outC[i] < start[i]) { outC[i] = start[i] * 2 - outC[i] - ${l}; } else if(outC[i] >= end[i]) { outC[i] = (end[i] - 1) * 2 - outC[i] + ${l}; } } - ${r} coords = outC - start; - setOutput(getX(${o})); + ${s} coords = outC - start; + setOutput(getX(${i})); } - `}},T1e=class{constructor(e,t,n){this.variableNames=["x"],this.packedInputs=!0,this.packedOutput=!0,this.outputShape=t.map((c,m)=>c[0]+e[m]+c[1]);let a=e.length,r=kt(a),s=t.map(c=>c[0]).join(","),i=t.map((c,m)=>c[0]+e[m]).join(","),o=Bn("rc",a),l=Bn("source",a),u=`${o[a-1]} < ${this.outputShape[a-1]}`,d=a===1?"source":`vec2(${l.slice(-2).join()})`,h=n==="reflect"?0:1,p="";if(a===1){let c=` - ${r} source = rc; + `}},Nye=class{constructor(e,t,n){this.variableNames=["x"],this.packedInputs=!0,this.packedOutput=!0,this.outputShape=t.map((p,f)=>p[0]+e[f]+p[1]);let r=e.length,s=It(r),a=t.map(p=>p[0]).join(","),o=t.map((p,f)=>p[0]+e[f]).join(","),i=Vn("rc",r),l=Vn("source",r),u=`${i[r-1]} < ${this.outputShape[r-1]}`,c=r===1?"source":`vec2(${l.slice(-2).join()})`,d=n==="reflect"?0:1,h="";if(r===1){let p=` + ${s} source = rc; if (source < start) { - source = start * 2 - source - ${h}; + source = start * 2 - source - ${d}; } else if (source >= end) { - source = (end - 1) * 2 - source + ${h}; + source = (end - 1) * 2 - source + ${d}; } source -= start; - `;p=` - ${r} rc = outputLoc; - ${c} - result[0] = getChannel(getX(${l.join()}), ${d}); - ${o[a-1]} += 1; + `;h=` + ${s} rc = outputLoc; + ${p} + result[0] = getChannel(getX(${l.join()}), ${c}); + ${i[r-1]} += 1; if(${u}) { - ${c} - result[1] = getChannel(getX(${l.join()}), ${d}); + ${p} + result[1] = getChannel(getX(${l.join()}), ${c}); } - `}else{let c=` - ${r} source = rc; - ${r} lt = ${r}(lessThan(source, start)); - ${r} gte = ${r}(greaterThanEqual(source, end)); - ${r} orig = 1 - (lt + gte); + `}else{let p=` + ${s} source = rc; + ${s} lt = ${s}(lessThan(source, start)); + ${s} gte = ${s}(greaterThanEqual(source, end)); + ${s} orig = 1 - (lt + gte); source = orig * source + - lt * (start * 2 - source - ${h}) + - gte * ((end - 1) * 2 - source + ${h}); + lt * (start * 2 - source - ${d}) + + gte * ((end - 1) * 2 - source + ${d}); source -= start; - `;p=` - ${r} rc = outputLoc; - ${c} - result[0] = getChannel(getX(${l.join()}), ${d}); - ${o[a-1]} += 1; + `;h=` + ${s} rc = outputLoc; + ${p} + result[0] = getChannel(getX(${l.join()}), ${c}); + ${i[r-1]} += 1; if(${u}) { - ${c} - result[1] = getChannel(getX(${l.join()}), ${d}); + ${p} + result[1] = getChannel(getX(${l.join()}), ${c}); } rc = outputLoc; - ${o[a-2]} += 1; - if(${o[a-2]} < ${this.outputShape[a-2]}) { - ${c} - result[2] = getChannel(getX(${l.join()}), ${d}); - ${o[a-1]} += 1; + ${i[r-2]} += 1; + if(${i[r-2]} < ${this.outputShape[r-2]}) { + ${p} + result[2] = getChannel(getX(${l.join()}), ${c}); + ${i[r-1]} += 1; if(${u}) { - ${c} - result[3] = getChannel(getX(${l.join()}), ${d}); + ${p} + result[3] = getChannel(getX(${l.join()}), ${c}); } } `}this.userCode=` - const ${r} start = ${r}(${s}); - const ${r} end = ${r}(${i}); + const ${s} start = ${s}(${a}); + const ${s} end = ${s}(${o}); void main() { - ${r} outputLoc = getOutputCoords(); + ${s} outputLoc = getOutputCoords(); vec4 result = vec4(0.); - ${p} + ${h} setOutput(result); } - `}},E1e=({inputs:e,backend:t,attrs:n})=>{let{x:a}=e,{paddings:r,mode:s}=n,i=se().getBool("WEBGL_PACK_ARRAY_OPERATIONS")?new T1e(a.shape,r,s):new N1e(a.shape,r,s);return t.runWebGLProgram(i,[a],a.dtype)},C1e={kernelName:bl,backendName:"webgl",kernelFunc:E1e},M1e=`if (b == 0.0) return NAN; - return mod(a, b);`,$1e=` + `}},Cye=({inputs:e,backend:t,attrs:n})=>{let{x:r}=e,{paddings:s,mode:a}=n,o=ae().getBool("WEBGL_PACK_ARRAY_OPERATIONS")?new Nye(r.shape,s,a):new Tye(r.shape,s,a);return t.runWebGLProgram(o,[r],r.dtype)},Eye={kernelName:bl,backendName:"webgl",kernelFunc:Cye},$ye=`if (b == 0.0) return NAN; + return mod(a, b);`,_ye=` vec4 result = mod(a, b); vec4 isNaN = vec4(equal(b, vec4(0.0))); - `+U0+` + `+Hm+` return result; -`,R1e=Tn({opSnippet:M1e,packedOpSnippet:$1e}),F1e={kernelName:jd,backendName:"webgl",kernelFunc:R1e},O1e=class{constructor(e,t,n){this.variableNames=["probs"],this.outputShape=[e,n],this.userCode=` +`,Rye=Nn({opSnippet:$ye,packedOpSnippet:_ye}),Dye={kernelName:Hc,backendName:"webgl",kernelFunc:Rye},Fye=class{constructor(e,t,n){this.variableNames=["probs"],this.outputShape=[e,n],this.userCode=` uniform float seed; void main() { @@ -3451,11 +3451,11 @@ return (log(1.0 + x) - log(1.0 - x)) / 2.0;`,x0e=ot({opSnippet:A0e}),b0e={kernel // If no other event happened, last event happened. setOutput(float(${t-1})); } - `}getCustomSetupFunc(e){return(t,n)=>{this.seedLoc==null&&(this.seedLoc=t.getUniformLocation(n,"seed")),t.gl.uniform1f(this.seedLoc,e)}}},D1e=` + `}getCustomSetupFunc(e){return(t,n)=>{this.seedLoc==null&&(this.seedLoc=t.getUniformLocation(n,"seed")),t.gl.uniform1f(this.seedLoc,e)}}},Mye=` if (a == b) { return 1.0; }; -return a / b;`,_1e=` +return a / b;`,Oye=` // vec4 one = vec4(equal(a, b)); // return one + (vec4(1.0) - one) * a / b; vec4 result = a / b; @@ -3473,16 +3473,16 @@ return a / b;`,_1e=` } return result; -`,aC=Tn({opSnippet:D1e,packedOpSnippet:_1e,checkOutOfBounds:!0}),z1e={kernelName:il,backendName:"webgl",kernelFunc:aC},rC="return a - b;",sC=Tn({opSnippet:rC,packedOpSnippet:rC,supportsComplex:!0,cpuKernelImpl:Fce}),P1e={kernelName:zi,backendName:"webgl",kernelFunc:sC};function iC(e){let{inputs:t,backend:n,attrs:a}=e,{logits:r}=t,{dim:s}=a,i=k.parseAxisParam([s],r.shape),o=nC({inputs:{x:r},backend:n,attrs:{reductionIndices:i,keepDims:!1}}),l=M.expandShapeToKeepDim(o.shape,i),u=be({inputs:{x:o},backend:n,attrs:{shape:l}}),d=sC({inputs:{a:r,b:u},backend:n}),h=YE({inputs:{x:d},backend:n}),p=G0({inputs:{x:h},backend:n,attrs:{axis:i,keepDims:!1}}),c=be({inputs:{x:p},backend:n,attrs:{shape:l}}),m=aC({inputs:{a:h,b:c},backend:n});return n.disposeIntermediateTensorInfo(o),n.disposeIntermediateTensorInfo(u),n.disposeIntermediateTensorInfo(d),n.disposeIntermediateTensorInfo(h),n.disposeIntermediateTensorInfo(p),n.disposeIntermediateTensorInfo(c),m}var L1e={kernelName:Dl,backendName:"webgl",kernelFunc:iC};function W1e(e){let{inputs:t,backend:n,attrs:a}=e,{logits:r}=t,{numSamples:s,seed:i,normalized:o}=a,l=o?r:iC({inputs:{logits:r},backend:n,attrs:{dim:r.shape.length-1}}),u=l.shape[0],d=l.shape[1],h=new O1e(u,d,s),p=h.getCustomSetupFunc(i),c=n.runWebGLProgram(h,[l],"int32",p);return o||n.disposeIntermediateTensorInfo(l),c}var B1e={kernelName:U1,backendName:"webgl",kernelFunc:W1e},oC="return -x;";function V1e(e){let{inputs:t,backend:n}=e,{x:a}=t;if(n.shouldExecuteOnCPU([a])){let s=n.texData.get(a.dataId),[i,o]=vce(s.values,a.shape,a.dtype);return n.makeTensorInfo(o,a.dtype,i)}let r;return se().getBool("WEBGL_PACK_UNARY_OPERATIONS")?r=new wu(a.shape,oC):r=new Qs(a.shape,oC),n.runWebGLProgram(r,[a],a.dtype)}var U1e={kernelName:Hd,backendName:"webgl",kernelFunc:V1e},j1e=us.nonMaxSuppressionV3Impl;function H1e(e){M.warn("tf.nonMaxSuppression() in webgl locks the UI thread. Call tf.nonMaxSuppressionAsync() instead");let{inputs:t,backend:n,attrs:a}=e,{boxes:r,scores:s}=t,{maxOutputSize:i,iouThreshold:o,scoreThreshold:l}=a,u=n.readSync(r.dataId),d=n.readSync(s.dataId),{selectedIndices:h}=j1e(u,d,i,o,l);return n.makeTensorInfo([h.length],"int32",new Int32Array(h))}var G1e={kernelName:Gd,backendName:"webgl",kernelFunc:H1e},q1e=us.nonMaxSuppressionV4Impl;function K1e(e){M.warn("tf.nonMaxSuppression() in webgl locks the UI thread. Call tf.nonMaxSuppressionAsync() instead");let{inputs:t,backend:n,attrs:a}=e,{boxes:r,scores:s}=t,{maxOutputSize:i,iouThreshold:o,scoreThreshold:l,padToMaxOutputSize:u}=a,d=n.readSync(r.dataId),h=n.readSync(s.dataId),{selectedIndices:p,validOutputs:c}=q1e(d,h,i,o,l,u);return[n.makeTensorInfo([p.length],"int32",new Int32Array(p)),n.makeTensorInfo([],"int32",new Int32Array([c]))]}var X1e={kernelName:qd,backendName:"webgl",kernelFunc:K1e},Z1e=us.nonMaxSuppressionV5Impl;function Y1e(e){M.warn("tf.nonMaxSuppression() in webgl locks the UI thread. Call tf.nonMaxSuppressionAsync() instead");let{inputs:t,backend:n,attrs:a}=e,{boxes:r,scores:s}=t,{maxOutputSize:i,iouThreshold:o,scoreThreshold:l,softNmsSigma:u}=a,d=n.readSync(r.dataId),h=n.readSync(s.dataId),p=i,c=o,m=l,f=u,{selectedIndices:g,selectedScores:y}=Z1e(d,h,p,c,m,f);return[n.makeTensorInfo([g.length],"int32",new Int32Array(g)),n.makeTensorInfo([y.length],"float32",new Float32Array(y))]}var J1e={kernelName:Kd,backendName:"webgl",kernelFunc:Y1e},Q1e=class{constructor(e,t,n,a){this.variableNames=["indices"],this.outputShape=[e,t],this.userCode=` +`,r9=Nn({opSnippet:Mye,packedOpSnippet:Oye,checkOutOfBounds:!0}),Pye={kernelName:ol,backendName:"webgl",kernelFunc:r9},s9="return a - b;",a9=Nn({opSnippet:s9,packedOpSnippet:s9,supportsComplex:!0,cpuKernelImpl:Dpe}),zye={kernelName:zo,backendName:"webgl",kernelFunc:a9};function o9(e){let{inputs:t,backend:n,attrs:r}=e,{logits:s}=t,{dim:a}=r,o=k.parseAxisParam([a],s.shape),i=n9({inputs:{x:s},backend:n,attrs:{reductionIndices:o,keepDims:!1}}),l=_.expandShapeToKeepDim(i.shape,o),u=ve({inputs:{x:i},backend:n,attrs:{shape:l}}),c=a9({inputs:{a:s,b:u},backend:n}),d=YE({inputs:{x:c},backend:n}),h=qm({inputs:{x:d},backend:n,attrs:{axis:o,keepDims:!1}}),p=ve({inputs:{x:h},backend:n,attrs:{shape:l}}),f=r9({inputs:{a:d,b:p},backend:n});return n.disposeIntermediateTensorInfo(i),n.disposeIntermediateTensorInfo(u),n.disposeIntermediateTensorInfo(c),n.disposeIntermediateTensorInfo(d),n.disposeIntermediateTensorInfo(h),n.disposeIntermediateTensorInfo(p),f}var Lye={kernelName:Ml,backendName:"webgl",kernelFunc:o9};function Bye(e){let{inputs:t,backend:n,attrs:r}=e,{logits:s}=t,{numSamples:a,seed:o,normalized:i}=r,l=i?s:o9({inputs:{logits:s},backend:n,attrs:{dim:s.shape.length-1}}),u=l.shape[0],c=l.shape[1],d=new Fye(u,c,a),h=d.getCustomSetupFunc(o),p=n.runWebGLProgram(d,[l],"int32",h);return i||n.disposeIntermediateTensorInfo(l),p}var Wye={kernelName:Hy,backendName:"webgl",kernelFunc:Bye},i9="return -x;";function Vye(e){let{inputs:t,backend:n}=e,{x:r}=t;if(n.shouldExecuteOnCPU([r])){let a=n.texData.get(r.dataId),[o,i]=vpe(a.values,r.shape,r.dtype);return n.makeTensorInfo(i,r.dtype,o)}let s;return ae().getBool("WEBGL_PACK_UNARY_OPERATIONS")?s=new wu(r.shape,i9):s=new Qa(r.shape,i9),n.runWebGLProgram(s,[r],r.dtype)}var Uye={kernelName:Gc,backendName:"webgl",kernelFunc:Vye},Hye=ca.nonMaxSuppressionV3Impl;function Gye(e){_.warn("tf.nonMaxSuppression() in webgl locks the UI thread. Call tf.nonMaxSuppressionAsync() instead");let{inputs:t,backend:n,attrs:r}=e,{boxes:s,scores:a}=t,{maxOutputSize:o,iouThreshold:i,scoreThreshold:l}=r,u=n.readSync(s.dataId),c=n.readSync(a.dataId),{selectedIndices:d}=Hye(u,c,o,i,l);return n.makeTensorInfo([d.length],"int32",new Int32Array(d))}var jye={kernelName:jc,backendName:"webgl",kernelFunc:Gye},qye=ca.nonMaxSuppressionV4Impl;function Kye(e){_.warn("tf.nonMaxSuppression() in webgl locks the UI thread. Call tf.nonMaxSuppressionAsync() instead");let{inputs:t,backend:n,attrs:r}=e,{boxes:s,scores:a}=t,{maxOutputSize:o,iouThreshold:i,scoreThreshold:l,padToMaxOutputSize:u}=r,c=n.readSync(s.dataId),d=n.readSync(a.dataId),{selectedIndices:h,validOutputs:p}=qye(c,d,o,i,l,u);return[n.makeTensorInfo([h.length],"int32",new Int32Array(h)),n.makeTensorInfo([],"int32",new Int32Array([p]))]}var Xye={kernelName:qc,backendName:"webgl",kernelFunc:Kye},Zye=ca.nonMaxSuppressionV5Impl;function Yye(e){_.warn("tf.nonMaxSuppression() in webgl locks the UI thread. Call tf.nonMaxSuppressionAsync() instead");let{inputs:t,backend:n,attrs:r}=e,{boxes:s,scores:a}=t,{maxOutputSize:o,iouThreshold:i,scoreThreshold:l,softNmsSigma:u}=r,c=n.readSync(s.dataId),d=n.readSync(a.dataId),h=o,p=i,f=l,m=u,{selectedIndices:g,selectedScores:y}=Zye(c,d,h,p,f,m);return[n.makeTensorInfo([g.length],"int32",new Int32Array(g)),n.makeTensorInfo([y.length],"float32",new Float32Array(y))]}var Jye={kernelName:Kc,backendName:"webgl",kernelFunc:Yye},Qye=class{constructor(e,t,n,r){this.variableNames=["indices"],this.outputShape=[e,t],this.userCode=` void main() { ivec2 coords = getOutputCoords(); int index = round(getIndices(coords.x)); - setOutput(mix(float(${a}), float(${n}), + setOutput(mix(float(${r}), float(${n}), float(index == coords.y))); } - `}},eAe=e=>{let{inputs:t,backend:n,attrs:a}=e,{indices:r}=t,{depth:s,onValue:i,offValue:o}=a,l=k.sizeFromShape(r.shape),u=new Q1e(l,s,i,o),d=be({inputs:{x:r},backend:n,attrs:{shape:[l]}}),h=n.runWebGLProgram(u,[d],r.dtype);n.disposeIntermediateTensorInfo(d);let p=[...r.shape,s],c=be({inputs:{x:h},backend:n,attrs:{shape:p}});return n.disposeIntermediateTensorInfo(h),c},tAe={kernelName:wl,backendName:"webgl",kernelFunc:eAe};function Y0(e){let{inputs:t,backend:n}=e,{x:a}=t;if(a.dtype==="complex64"){let r=mp({inputs:{input:a},backend:n}),s=Y0({inputs:{x:r},backend:n}),i=Z0({inputs:{input:a},backend:n}),o=Y0({inputs:{x:i},backend:n}),l=ei({inputs:{real:s,imag:o},backend:n});return n.disposeIntermediateTensorInfo(r),n.disposeIntermediateTensorInfo(s),n.disposeIntermediateTensorInfo(i),n.disposeIntermediateTensorInfo(o),l}else return pb({attrs:{shape:a.shape,dtype:a.dtype,value:a.dtype==="string"?"":0},backend:n})}var nAe={kernelName:ph,backendName:"webgl",kernelFunc:Y0};function lC(e){let{inputs:t,backend:n}=e,{x:a}=t;if(a.dtype==="string")throw new Error("onesLike is not supported under string dtype");if(a.dtype==="complex64"){let r=mp({inputs:{input:a},backend:n}),s=lC({inputs:{x:r},backend:n}),i=Z0({inputs:{input:a},backend:n}),o=Y0({inputs:{x:i},backend:n}),l=ei({inputs:{real:s,imag:o},backend:n});return n.disposeIntermediateTensorInfo(r),n.disposeIntermediateTensorInfo(s),n.disposeIntermediateTensorInfo(i),n.disposeIntermediateTensorInfo(o),l}else return pb({attrs:{shape:a.shape,dtype:a.dtype,value:1},backend:n})}var aAe={kernelName:Xd,backendName:"webgl",kernelFunc:lC};function rAe(e){let{inputs:t,backend:n,attrs:a}=e,{axis:r}=a;if(t.length===1)return hb({inputs:{input:t[0]},backend:n,attrs:{dim:r}});let s=t[0].shape,i=t[0].dtype;t.forEach(d=>{k.assertShapesMatch(s,d.shape,"All tensors passed to stack must have matching shapes"),k.assert(i===d.dtype,()=>"All tensors passed to stack must have matching dtypes")});let o=[],l=t.map(d=>{let h=hb({inputs:{input:d},backend:n,attrs:{dim:r}});return o.push(h),h}),u=BE({inputs:l,backend:n,attrs:{axis:r}});return o.forEach(d=>n.disposeIntermediateTensorInfo(d)),u}var sAe={kernelName:Zd,backendName:"webgl",kernelFunc:rAe},iAe=class{constructor(e,t,n){this.variableNames=["x"],this.outputShape=t.map((l,u)=>l[0]+e[u]+l[1]);let a=e.length,r=kt(a),s=t.map(l=>l[0]).join(","),i=t.map((l,u)=>l[0]+e[u]).join(","),o=["coords[0]","coords[1]","coords[2]","coords[3]"].slice(0,a);if(a===1){this.userCode=` - int start = ${s}; - int end = ${i}; + `}},eAe=e=>{let{inputs:t,backend:n,attrs:r}=e,{indices:s}=t,{depth:a,onValue:o,offValue:i}=r,l=k.sizeFromShape(s.shape),u=new Qye(l,a,o,i),c=ve({inputs:{x:s},backend:n,attrs:{shape:[l]}}),d=n.runWebGLProgram(u,[c],s.dtype);n.disposeIntermediateTensorInfo(c);let h=[...s.shape,a],p=ve({inputs:{x:d},backend:n,attrs:{shape:h}});return n.disposeIntermediateTensorInfo(d),p},tAe={kernelName:wl,backendName:"webgl",kernelFunc:eAe};function Jm(e){let{inputs:t,backend:n}=e,{x:r}=t;if(r.dtype==="complex64"){let s=mh({inputs:{input:r},backend:n}),a=Jm({inputs:{x:s},backend:n}),o=Ym({inputs:{input:r},backend:n}),i=Jm({inputs:{x:o},backend:n}),l=eo({inputs:{real:a,imag:i},backend:n});return n.disposeIntermediateTensorInfo(s),n.disposeIntermediateTensorInfo(a),n.disposeIntermediateTensorInfo(o),n.disposeIntermediateTensorInfo(i),l}else return hb({attrs:{shape:r.shape,dtype:r.dtype,value:r.dtype==="string"?"":0},backend:n})}var nAe={kernelName:hd,backendName:"webgl",kernelFunc:Jm};function l9(e){let{inputs:t,backend:n}=e,{x:r}=t;if(r.dtype==="string")throw new Error("onesLike is not supported under string dtype");if(r.dtype==="complex64"){let s=mh({inputs:{input:r},backend:n}),a=l9({inputs:{x:s},backend:n}),o=Ym({inputs:{input:r},backend:n}),i=Jm({inputs:{x:o},backend:n}),l=eo({inputs:{real:a,imag:i},backend:n});return n.disposeIntermediateTensorInfo(s),n.disposeIntermediateTensorInfo(a),n.disposeIntermediateTensorInfo(o),n.disposeIntermediateTensorInfo(i),l}else return hb({attrs:{shape:r.shape,dtype:r.dtype,value:1},backend:n})}var rAe={kernelName:Xc,backendName:"webgl",kernelFunc:l9};function sAe(e){let{inputs:t,backend:n,attrs:r}=e,{axis:s}=r;if(t.length===1)return db({inputs:{input:t[0]},backend:n,attrs:{dim:s}});let a=t[0].shape,o=t[0].dtype;t.forEach(c=>{k.assertShapesMatch(a,c.shape,"All tensors passed to stack must have matching shapes"),k.assert(o===c.dtype,()=>"All tensors passed to stack must have matching dtypes")});let i=[],l=t.map(c=>{let d=db({inputs:{input:c},backend:n,attrs:{dim:s}});return i.push(d),d}),u=WE({inputs:l,backend:n,attrs:{axis:s}});return i.forEach(c=>n.disposeIntermediateTensorInfo(c)),u}var aAe={kernelName:Zc,backendName:"webgl",kernelFunc:sAe},oAe=class{constructor(e,t,n){this.variableNames=["x"],this.outputShape=t.map((l,u)=>l[0]+e[u]+l[1]);let r=e.length,s=It(r),a=t.map(l=>l[0]).join(","),o=t.map((l,u)=>l[0]+e[u]).join(","),i=["coords[0]","coords[1]","coords[2]","coords[3]"].slice(0,r);if(r===1){this.userCode=` + int start = ${a}; + int end = ${o}; uniform float value; void main() { @@ -3494,45 +3494,45 @@ return a / b;`,_1e=` } } `;return}this.userCode=` - ${r} start = ${r}(${s}); - ${r} end = ${r}(${i}); + ${s} start = ${s}(${a}); + ${s} end = ${s}(${o}); uniform float value; void main() { - ${r} outC = getOutputCoords(); + ${s} outC = getOutputCoords(); if (any(lessThan(outC, start)) || any(greaterThanEqual(outC, end))) { setOutput(value); } else { - ${r} coords = outC - start; - setOutput(getX(${o})); + ${s} coords = outC - start; + setOutput(getX(${i})); } } - `}getCustomSetupFunc(e){return(t,n)=>{this.valueLoc==null&&(this.valueLoc=t.getUniformLocationNoThrow(n,"value")),t.gl.uniform1f(this.valueLoc,e)}}},oAe=class{constructor(e,t,n){this.variableNames=["x"],this.packedInputs=!0,this.packedOutput=!0,this.outputShape=t.map((m,f)=>m[0]+e[f]+m[1]);let a=e.length,r=kt(a),s=t.map(m=>m[0]).join(","),i=t.map((m,f)=>m[0]+e[f]).join(","),o=Bn("rc",a),l=Bn("source",a),u=`${o[a-1]} < ${this.outputShape[a-1]}`,d=a===1?"source":`vec2(${l.slice(-2).join()})`,h=[`${r} rc = outputLoc;`,`${o[a-1]} += 1; + `}getCustomSetupFunc(e){return(t,n)=>{this.valueLoc==null&&(this.valueLoc=t.getUniformLocationNoThrow(n,"value")),t.gl.uniform1f(this.valueLoc,e)}}},iAe=class{constructor(e,t,n){this.variableNames=["x"],this.packedInputs=!0,this.packedOutput=!0,this.outputShape=t.map((f,m)=>f[0]+e[m]+f[1]);let r=e.length,s=It(r),a=t.map(f=>f[0]).join(","),o=t.map((f,m)=>f[0]+e[m]).join(","),i=Vn("rc",r),l=Vn("source",r),u=`${i[r-1]} < ${this.outputShape[r-1]}`,c=r===1?"source":`vec2(${l.slice(-2).join()})`,d=[`${s} rc = outputLoc;`,`${i[r-1]} += 1; if(${u}) { - `,a===1?"":`} + `,r===1?"":`} rc = outputLoc; - ${o[a-2]} += 1; - if(${o[a-2]} < ${this.outputShape[a-2]}) {`,a===1?"":` ${o[a-1]} += 1; - if(${u}) {`],p=a===1?"rc < start || rc >= end":"any(lessThan(rc, start)) || any(greaterThanEqual(rc, end))",c="";for(let m=0,f=a===1?2:4;m= end":"any(lessThan(rc, start)) || any(greaterThanEqual(rc, end))",p="";for(let f=0,m=r===1?2:4;f{this.valueLoc==null&&(this.valueLoc=t.getUniformLocationNoThrow(n,"value")),t.gl.uniform1f(this.valueLoc,e)}}},uC=e=>{let{inputs:t,backend:n,attrs:a}=e,{x:r}=t,{paddings:s,constantValue:i}=a,o=se().getBool("WEBGL_PACK_ARRAY_OPERATIONS")?new oAe(r.shape,s,i):new iAe(r.shape,s,i),l=o.getCustomSetupFunc(i);return n.runWebGLProgram(o,[r],r.dtype,l)},lAe={kernelName:kl,backendName:"webgl",kernelFunc:uC},uAe=` + `}getCustomSetupFunc(e){return(t,n)=>{this.valueLoc==null&&(this.valueLoc=t.getUniformLocationNoThrow(n,"value")),t.gl.uniform1f(this.valueLoc,e)}}},u9=e=>{let{inputs:t,backend:n,attrs:r}=e,{x:s}=t,{paddings:a,constantValue:o}=r,i=ae().getBool("WEBGL_PACK_ARRAY_OPERATIONS")?new iAe(s.shape,a,o):new oAe(s.shape,a,o),l=i.getCustomSetupFunc(o);return n.runWebGLProgram(i,[s],s.dtype,l)},lAe={kernelName:kl,backendName:"webgl",kernelFunc:u9},uAe=` if(a < 0.0 && floor(b) < b){ return NAN; } @@ -3541,7 +3541,7 @@ return a / b;`,_1e=` } return (round(mod(b, 2.0)) != 1) ? pow(abs(a), b) : sign(a) * pow(abs(a), b); -`,dAe=` +`,cAe=` // isModRound1 has 1 for components with round(mod(b, 2.0)) == 1, 0 otherwise. vec4 isModRound1 = vec4(equal(round(mod(b, 2.0)), ivec4(1))); vec4 multiplier = sign(a) * isModRound1 + (vec4(1.0) - isModRound1); @@ -3555,9 +3555,9 @@ return a / b;`,_1e=` result.a = isExpZero.a ? 1.0 : result.a; vec4 isNaN = vec4(lessThan(a, vec4(0.0))) * vec4(lessThan(floor(b), b)); - `+U0+` + `+Hm+` return result; -`,hAe=Tn({opSnippet:uAe,packedOpSnippet:dAe}),pAe={kernelName:Il,backendName:"webgl",kernelFunc:hAe};function cAe(e){let{inputs:t,backend:n,attrs:a}=e,{x:r}=t,{axis:s,keepDims:i}=a,o=r.shape.length,l=[],u=k.parseAxisParam(s,r.shape),d=u,h=M.getAxesPermutation(d,o),p=r;h!=null&&(p=Vn({inputs:{x:r},backend:n,attrs:{perm:h}}),d=M.getInnerMostAxes(d.length,o),l.push(p)),M.assertAxesAreInnerMostDims("prod",d,o);let c;if(n.shouldExecuteOnCPU([p])){let m=n.texData.get(p.dataId).values,{outVals:f,outShape:g,outDtype:y}=kce(p.shape,p.dtype,m,d);c=n.makeTensorInfo(g,y,f)}else{let[m,f]=M.computeOutAndReduceShapes(p.shape,d),g=k.sizeFromShape(f),y=be({inputs:{x:p},backend:n,attrs:{shape:[-1,g]}}),A=pA(r.dtype),x=bo(y,A,"prod",n);c=be({inputs:{x},backend:n,attrs:{shape:m}}),l.push(y),l.push(x)}if(i){l.push(c);let m=M.expandShapeToKeepDim(c.shape,u);c=be({inputs:{x:c},backend:n,attrs:{shape:m}})}return l.forEach(m=>n.disposeIntermediateTensorInfo(m)),c}var fAe={kernelName:Yd,backendName:"webgl",kernelFunc:cAe},dC=e=>{let{backend:t,attrs:n}=e,{start:a,stop:r,step:s,dtype:i}=n,o=Ice(a,r,s,i);return t.makeTensorInfo([o.length],i,o)},mAe={kernelName:rf,backendName:"webgl",kernelFunc:dC},gAe="return 1.0 / x;",yAe=ot({opSnippet:gAe}),AAe={kernelName:Jd,backendName:"webgl",kernelFunc:yAe},xAe=gr+` +`,dAe=Nn({opSnippet:uAe,packedOpSnippet:cAe}),hAe={kernelName:Il,backendName:"webgl",kernelFunc:dAe};function pAe(e){let{inputs:t,backend:n,attrs:r}=e,{x:s}=t,{axis:a,keepDims:o}=r,i=s.shape.length,l=[],u=k.parseAxisParam(a,s.shape),c=u,d=_.getAxesPermutation(c,i),h=s;d!=null&&(h=Un({inputs:{x:s},backend:n,attrs:{perm:d}}),c=_.getInnerMostAxes(c.length,i),l.push(h)),_.assertAxesAreInnerMostDims("prod",c,i);let p;if(n.shouldExecuteOnCPU([h])){let f=n.texData.get(h.dataId).values,{outVals:m,outShape:g,outDtype:y}=kpe(h.shape,h.dtype,f,c);p=n.makeTensorInfo(g,y,m)}else{let[f,m]=_.computeOutAndReduceShapes(h.shape,c),g=k.sizeFromShape(m),y=ve({inputs:{x:h},backend:n,attrs:{shape:[-1,g]}}),A=pA(s.dtype),x=bi(y,A,"prod",n);p=ve({inputs:{x},backend:n,attrs:{shape:f}}),l.push(y),l.push(x)}if(o){l.push(p);let f=_.expandShapeToKeepDim(p.shape,u);p=ve({inputs:{x:p},backend:n,attrs:{shape:f}})}return l.forEach(f=>n.disposeIntermediateTensorInfo(f)),p}var fAe={kernelName:Yc,backendName:"webgl",kernelFunc:pAe},c9=e=>{let{backend:t,attrs:n}=e,{start:r,stop:s,step:a,dtype:o}=n,i=Ipe(r,s,a,o);return t.makeTensorInfo([i.length],o,i)},mAe={kernelName:sf,backendName:"webgl",kernelFunc:c9},gAe="return 1.0 / x;",yAe=it({opSnippet:gAe}),AAe={kernelName:Jc,backendName:"webgl",kernelFunc:yAe},xAe=ys+` return (x < 0.0) ? 0.0 : x; `,bAe=` vec4 result = x * vec4(greaterThanEqual(x, vec4(0.0))); @@ -3569,7 +3569,7 @@ return a / b;`,_1e=` result.a = isNaN.a ? x.a : result.a; return result; -`,vAe=ot({opSnippet:xAe,packedOpSnippet:bAe}),wAe={kernelName:Nl,backendName:"webgl",kernelFunc:vAe},kAe=gr+` +`,vAe=it({opSnippet:xAe,packedOpSnippet:bAe}),wAe={kernelName:Tl,backendName:"webgl",kernelFunc:vAe},kAe=ys+` return (x < 0.0) ? 0.0 : min(6.0, x); `,IAe=` vec4 result = min(x, vec4(6.)) * vec4(greaterThanEqual(x, vec4(0.0))); @@ -3581,11 +3581,11 @@ return a / b;`,_1e=` result.a = isNaN.a ? x.a : result.a; return result; -`,SAe=ot({opSnippet:kAe,packedOpSnippet:IAe}),NAe={kernelName:El,backendName:"webgl",kernelFunc:SAe},TAe=class{constructor(e,t,n,a,r){this.variableNames=["A"],this.outputShape=[];let[s,i,o,l]=e;this.outputShape=[s,t,n,l];let u=[a&&t>1?i-1:i,a&&n>1?o-1:o],d=[a&&t>1?t-1:t,a&&n>1?n-1:n],h;r?h="(vec2(yRC) + vec2(0.5)) * effectiveInputOverOutputRatioRC - vec2(0.5)":h="vec2(yRC) * effectiveInputOverOutputRatioRC",this.userCode=` +`,SAe=it({opSnippet:kAe,packedOpSnippet:IAe}),TAe={kernelName:Cl,backendName:"webgl",kernelFunc:SAe},NAe=class{constructor(e,t,n,r,s){this.variableNames=["A"],this.outputShape=[];let[a,o,i,l]=e;this.outputShape=[a,t,n,l];let u=[r&&t>1?o-1:o,r&&n>1?i-1:i],c=[r&&t>1?t-1:t,r&&n>1?n-1:n],d;s?d="(vec2(yRC) + vec2(0.5)) * effectiveInputOverOutputRatioRC - vec2(0.5)":d="vec2(yRC) * effectiveInputOverOutputRatioRC",this.userCode=` const vec2 effectiveInputOverOutputRatioRC = vec2( - ${u[0]/d[0]}, - ${u[1]/d[1]}); - const vec2 inputShapeRC = vec2(${i}.0, ${o}.0); + ${u[0]/c[0]}, + ${u[1]/c[1]}); + const vec2 inputShapeRC = vec2(${o}.0, ${i}.0); void main() { ivec4 coords = getOutputCoords(); @@ -3594,7 +3594,7 @@ return a / b;`,_1e=` ivec2 yRC = coords.yz; // Fractional source index. - vec2 sourceFracIndexRC = ${h}; + vec2 sourceFracIndexRC = ${d}; // Compute the four integer indices. ivec2 sourceFloorRC = ivec2(max(sourceFracIndexRC, vec2(0.0))); @@ -3614,13 +3614,13 @@ return a / b;`,_1e=` setOutput(newValue); } - `}},EAe=class{constructor(e,t,n,a,r){this.variableNames=["A"],this.packedInputs=!0,this.packedOutput=!0,this.outputShape=[];let[s,i,o,l]=e;this.outputShape=[s,t,n,l];let u=[a&&t>1?i-1:i,a&&n>1?o-1:o],d=[a&&t>1?t-1:t,a&&n>1?n-1:n],h;r?h="(vec3(yRC) + vec3(0.5)) * effectiveInputOverOutputRatioRC - vec3(0.5)":h="vec3(yRC) * effectiveInputOverOutputRatioRC",this.userCode=` + `}},CAe=class{constructor(e,t,n,r,s){this.variableNames=["A"],this.packedInputs=!0,this.packedOutput=!0,this.outputShape=[];let[a,o,i,l]=e;this.outputShape=[a,t,n,l];let u=[r&&t>1?o-1:o,r&&n>1?i-1:i],c=[r&&t>1?t-1:t,r&&n>1?n-1:n],d;s?d="(vec3(yRC) + vec3(0.5)) * effectiveInputOverOutputRatioRC - vec3(0.5)":d="vec3(yRC) * effectiveInputOverOutputRatioRC",this.userCode=` const vec3 effectiveInputOverOutputRatioRC = vec3( - ${u[0]/d[0]}, - ${u[1]/d[1]}, - ${u[1]/d[1]}); - const vec3 inputShapeRC = vec3(${i}.0, ${o}.0, - ${o}.0); + ${u[0]/c[0]}, + ${u[1]/c[1]}, + ${u[1]/c[1]}); + const vec3 inputShapeRC = vec3(${o}.0, ${i}.0, + ${i}.0); float getAValue(int b, int r, int c, int d) { return getChannel(getA(b, r, c, d), vec2(c, d)); @@ -3634,7 +3634,7 @@ return a / b;`,_1e=` ivec3 yRC = coords.yzz + ivec3(0, 0, 1); // Fractional source index. - vec3 sourceFracIndexRC = ${h}; + vec3 sourceFracIndexRC = ${d}; // Compute the four integer indices. ivec3 sourceFloorRC = ivec3(max(sourceFracIndexRC, vec3(0.0))); @@ -3691,7 +3691,7 @@ return a / b;`,_1e=` setOutput(newValue); } - `}};function CAe(e){let{inputs:t,backend:n,attrs:a}=e,{images:r}=t,{alignCorners:s,halfPixelCenters:i,size:o}=a,[l,u]=o,d=se().getBool("WEBGL_PACK_IMAGE_OPERATIONS")?new EAe(r.shape,l,u,s,i):new TAe(r.shape,l,u,s,i);return n.runWebGLProgram(d,[r],"float32")}var MAe={kernelName:Tl,backendName:"webgl",kernelFunc:CAe},$Ae=class{constructor(e,t,n){this.variableNames=["dy"],this.outputShape=[],this.outputShape=t;let[,a,r]=t,[,s,i]=e,o=[n&&s>1?a-1:a,n&&i>1?r-1:r],l=[n&&s>1?s-1:s,n&&i>1?i-1:i],u=o[0]/l[0],d=o[1]/l[1],h=1/u,p=1/d,c=Math.ceil(h)*2+2,m=Math.ceil(p)*2+2;this.userCode=` + `}};function EAe(e){let{inputs:t,backend:n,attrs:r}=e,{images:s}=t,{alignCorners:a,halfPixelCenters:o,size:i}=r,[l,u]=i,c=ae().getBool("WEBGL_PACK_IMAGE_OPERATIONS")?new CAe(s.shape,l,u,a,o):new NAe(s.shape,l,u,a,o);return n.runWebGLProgram(c,[s],"float32")}var $Ae={kernelName:Nl,backendName:"webgl",kernelFunc:EAe},_Ae=class{constructor(e,t,n){this.variableNames=["dy"],this.outputShape=[],this.outputShape=t;let[,r,s]=t,[,a,o]=e,i=[n&&a>1?r-1:r,n&&o>1?s-1:s],l=[n&&a>1?a-1:a,n&&o>1?o-1:o],u=i[0]/l[0],c=i[1]/l[1],d=1/u,h=1/c,p=Math.ceil(d)*2+2,f=Math.ceil(h)*2+2;this.userCode=` void main() { ivec4 coords = getOutputCoords(); int b = coords[0]; @@ -3702,13 +3702,13 @@ return a / b;`,_1e=` float accumulator = 0.0; const float heightScale = float(${u}); - const float widthScale = float(${d}); + const float widthScale = float(${c}); - const float invHeightScale = float(${h}); - const float invWidthScale = float(${p}); + const float invHeightScale = float(${d}); + const float invWidthScale = float(${h}); - const int winHeight = int(${c}); - const int winWidth = int(${m}); + const int winHeight = int(${p}); + const int winWidth = int(${f}); // Compute bounds for where in dy we will look float startRLerp = floor(float(r) * invHeightScale); @@ -3722,7 +3722,7 @@ return a / b;`,_1e=` int dyR = dyROffset + startDyR; // Guard against the window exceeding the bounds of dy - if (dyR < 0 || dyR >= ${s}) { + if (dyR < 0 || dyR >= ${a}) { continue; } @@ -3730,19 +3730,19 @@ return a / b;`,_1e=` int dyC = dyCOffset + startDyC; // Guard against the window exceeding the bounds of dy - if (dyC < 0 || dyC >= ${i}) { + if (dyC < 0 || dyC >= ${o}) { continue; } float dxR = float(dyR) * heightScale; int topDxRIndex = int(floor(dxR)); - int bottomDxRIndex = int(min(ceil(dxR), ${a-1}.0)); + int bottomDxRIndex = int(min(ceil(dxR), ${r-1}.0)); float dxRLerp = dxR - float(topDxRIndex); float inverseDxRLerp = 1.0 - dxRLerp; float dxC = float(dyC) * widthScale; int leftDxCIndex = int(floor(dxC)); - int rightDxCIndex = int(min(ceil(dxC), ${r-1}.0)); + int rightDxCIndex = int(min(ceil(dxC), ${s-1}.0)); float dxCLerp = dxC - float(leftDxCIndex); float inverseDxCLerp = 1.0 - dxCLerp; @@ -3772,11 +3772,11 @@ return a / b;`,_1e=` setOutput(accumulator); } - `}};function RAe(e){let{inputs:t,backend:n,attrs:a}=e,{images:r,dy:s}=t,{alignCorners:i}=a,o=new $Ae(s.shape,r.shape,i);return n.runWebGLProgram(o,[s],s.dtype)}var FAe={kernelName:G1,backendName:"webgl",kernelFunc:RAe},OAe=class{constructor(e,t,n,a,r){this.variableNames=["A"],this.outputShape=[];let[s,i,o,l]=e;this.outputShape=[s,t,n,l];let u=[a&&t>1?i-1:i,a&&n>1?o-1:o],d=[a&&t>1?t-1:t,a&&n>1?n-1:n],h=a?"0.5":"0.0",p;r?p="max((vec2(yRC) + vec2(0.5)) * effectiveInputOverOutputRatioRC, vec2(0.0))":p="vec2(yRC) * effectiveInputOverOutputRatioRC",this.userCode=` + `}};function RAe(e){let{inputs:t,backend:n,attrs:r}=e,{images:s,dy:a}=t,{alignCorners:o}=r,i=new _Ae(a.shape,s.shape,o);return n.runWebGLProgram(i,[a],a.dtype)}var DAe={kernelName:qy,backendName:"webgl",kernelFunc:RAe},FAe=class{constructor(e,t,n,r,s){this.variableNames=["A"],this.outputShape=[];let[a,o,i,l]=e;this.outputShape=[a,t,n,l];let u=[r&&t>1?o-1:o,r&&n>1?i-1:i],c=[r&&t>1?t-1:t,r&&n>1?n-1:n],d=r?"0.5":"0.0",h;s?h="max((vec2(yRC) + vec2(0.5)) * effectiveInputOverOutputRatioRC, vec2(0.0))":h="vec2(yRC) * effectiveInputOverOutputRatioRC",this.userCode=` const vec2 effectiveInputOverOutputRatioRC = vec2( - ${u[0]/d[0]}, - ${u[1]/d[1]}); - const vec2 inputShapeRC = vec2(${i}.0, ${o}.0); + ${u[0]/c[0]}, + ${u[1]/c[1]}); + const vec2 inputShapeRC = vec2(${o}.0, ${i}.0); void main() { ivec4 coords = getOutputCoords(); @@ -3785,22 +3785,22 @@ return a / b;`,_1e=` ivec2 yRC = coords.yz; // Fractional source index. - vec2 sourceFracIndexRC = ${p}; + vec2 sourceFracIndexRC = ${h}; // Compute the coordinators of nearest neighbor point. ivec2 sourceNearestRC = ivec2( - min(inputShapeRC - 1.0, floor(sourceFracIndexRC + ${h}))); + min(inputShapeRC - 1.0, floor(sourceFracIndexRC + ${d}))); float newValue = getA(b, sourceNearestRC.x, sourceNearestRC.y, d); setOutput(newValue); } - `}},DAe=class{constructor(e,t,n,a,r){this.variableNames=["A"],this.packedInputs=!0,this.packedOutput=!0,this.outputShape=[];let[s,i,o,l]=e;this.outputShape=[s,t,n,l];let u=[a&&t>1?i-1:i,a&&n>1?o-1:o],d=[a&&t>1?t-1:t,a&&n>1?n-1:n],h=a?"0.5":"0.0",p;r?p="max((vec3(yRC) + vec3(0.5)) * effectiveInputOverOutputRatioRC, vec3(0.0))":p="vec3(yRC) * effectiveInputOverOutputRatioRC",this.userCode=` + `}},MAe=class{constructor(e,t,n,r,s){this.variableNames=["A"],this.packedInputs=!0,this.packedOutput=!0,this.outputShape=[];let[a,o,i,l]=e;this.outputShape=[a,t,n,l];let u=[r&&t>1?o-1:o,r&&n>1?i-1:i],c=[r&&t>1?t-1:t,r&&n>1?n-1:n],d=r?"0.5":"0.0",h;s?h="max((vec3(yRC) + vec3(0.5)) * effectiveInputOverOutputRatioRC, vec3(0.0))":h="vec3(yRC) * effectiveInputOverOutputRatioRC",this.userCode=` const vec3 effectiveInputOverOutputRatioRC = vec3( - ${u[0]/d[0]}, - ${u[1]/d[1]}, - ${u[1]/d[1]}); - const vec3 inputShapeRC = vec3(${i}.0, ${o}.0, - ${o}.0); + ${u[0]/c[0]}, + ${u[1]/c[1]}, + ${u[1]/c[1]}); + const vec3 inputShapeRC = vec3(${o}.0, ${i}.0, + ${i}.0); float getAValue(int b, int r, int c, int d) { return getChannel(getA(b, r, c, d), vec2(c, d)); @@ -3814,11 +3814,11 @@ return a / b;`,_1e=` ivec3 yRC = coords.yzz + ivec3(0, 0, 1); // Fractional source index. - vec3 sourceFracIndexRC = ${p}; + vec3 sourceFracIndexRC = ${h}; // Compute the coordinators of nearest neighbor point. ivec3 sourceNearestRC = ivec3( - min(inputShapeRC - 1.0, floor(sourceFracIndexRC + ${h}))); + min(inputShapeRC - 1.0, floor(sourceFracIndexRC + ${d}))); // Should we calculate next column and row elements in 2x2 packed cell. bool hasNextCol = d < ${l-1}; @@ -3835,7 +3835,7 @@ return a / b;`,_1e=` setOutput(newValue); } - `}};function _Ae(e){let{inputs:t,backend:n,attrs:a}=e,{images:r}=t,{alignCorners:s,halfPixelCenters:i,size:o}=a,[l,u]=o,d=se().getBool("WEBGL_PACK_IMAGE_OPERATIONS")?new DAe(r.shape,l,u,s,i):new OAe(r.shape,l,u,s,i);return n.runWebGLProgram(d,[r],r.dtype)}var zAe={kernelName:sf,backendName:"webgl",kernelFunc:_Ae},PAe=class{constructor(e,t,n){this.variableNames=["dy"],this.outputShape=[],this.outputShape=t;let[,a,r]=t,[,s,i]=e,o=[n&&s>1?a-1:a,n&&i>1?r-1:r],l=[n&&s>1?s-1:s,n&&i>1?i-1:i],u=o[0]/l[0],d=o[1]/l[1],h=1/u,p=1/d,c=Math.ceil(h)*2+2,m=Math.ceil(p)*2+2;this.userCode=` + `}};function OAe(e){let{inputs:t,backend:n,attrs:r}=e,{images:s}=t,{alignCorners:a,halfPixelCenters:o,size:i}=r,[l,u]=i,c=ae().getBool("WEBGL_PACK_IMAGE_OPERATIONS")?new MAe(s.shape,l,u,a,o):new FAe(s.shape,l,u,a,o);return n.runWebGLProgram(c,[s],s.dtype)}var PAe={kernelName:af,backendName:"webgl",kernelFunc:OAe},zAe=class{constructor(e,t,n){this.variableNames=["dy"],this.outputShape=[],this.outputShape=t;let[,r,s]=t,[,a,o]=e,i=[n&&a>1?r-1:r,n&&o>1?s-1:s],l=[n&&a>1?a-1:a,n&&o>1?o-1:o],u=i[0]/l[0],c=i[1]/l[1],d=1/u,h=1/c,p=Math.ceil(d)*2+2,f=Math.ceil(h)*2+2;this.userCode=` void main() { ivec4 coords = getOutputCoords(); int b = coords[0]; @@ -3846,13 +3846,13 @@ return a / b;`,_1e=` float accumulator = 0.0; const float heightScale = float(${u}); - const float widthScale = float(${d}); + const float widthScale = float(${c}); - const float invHeightScale = float(${h}); - const float invWidthScale = float(${p}); + const float invHeightScale = float(${d}); + const float invWidthScale = float(${h}); - const int winHeight = int(${c}); - const int winWidth = int(${m}); + const int winHeight = int(${p}); + const int winWidth = int(${f}); // Compute bounds for where in dy we will look float startRLerp = floor(float(r) * invHeightScale); @@ -3866,7 +3866,7 @@ return a / b;`,_1e=` int dyR = dyROffset + startDyR; // Guard against the window exceeding the bounds of dy - if (dyR < 0 || dyR >= ${s}) { + if (dyR < 0 || dyR >= ${a}) { continue; } @@ -3874,25 +3874,25 @@ return a / b;`,_1e=` int dyC = dyCOffset + startDyC; // Guard against the window exceeding the bounds of dy - if (dyC < 0 || dyC >= ${i}) { + if (dyC < 0 || dyC >= ${o}) { continue; } float sourceFracRow = - float(${o[0]}) * + float(${i[0]}) * (float(dyR) / float(${l[0]})); float sourceFracCol = - float(${o[1]}) * + float(${i[1]}) * (float(dyC) / float(${l[1]})); int sourceNearestRow = int(min( - float(int(${a}) - 1), + float(int(${r}) - 1), ${n} ? float(round(sourceFracRow)) : float(floor(sourceFracRow)))); int sourceNearestCol = int(min( - float(int(${r}) - 1), + float(int(${s}) - 1), ${n} ? float(round(sourceFracCol)) : float(floor(sourceFracCol)))); @@ -3905,23 +3905,23 @@ return a / b;`,_1e=` setOutput(accumulator); } - `}};function LAe(e){let{inputs:t,backend:n,attrs:a}=e,{images:r,dy:s}=t,{alignCorners:i}=a,o=new PAe(s.shape,r.shape,i);return n.runWebGLProgram(o,[s],s.dtype)}var WAe={kernelName:H1,backendName:"webgl",kernelFunc:LAe},BAe=class{constructor(e,t){this.variableNames=["x"];let n=e.length;if(n>4)throw new Error(`WebGL backend: Reverse of rank-${n} tensor is not yet supported`);if(this.outputShape=e,n===1){this.userCode=` + `}};function LAe(e){let{inputs:t,backend:n,attrs:r}=e,{images:s,dy:a}=t,{alignCorners:o}=r,i=new zAe(a.shape,s.shape,o);return n.runWebGLProgram(i,[a],a.dtype)}var BAe={kernelName:jy,backendName:"webgl",kernelFunc:LAe},WAe=class{constructor(e,t){this.variableNames=["x"];let n=e.length;if(n>4)throw new Error(`WebGL backend: Reverse of rank-${n} tensor is not yet supported`);if(this.outputShape=e,n===1){this.userCode=` void main() { int coord = getOutputCoords(); setOutput(getX(${e[0]} - coord - 1)); } - `;return}let a=i=>t.indexOf(i)!==-1&&e[i]!==1?`${e[i]} - coords[${i}] - 1`:`coords[${i}]`,r=e.map((i,o)=>a(o)).join(","),s=kt(n);this.userCode=` + `;return}let r=o=>t.indexOf(o)!==-1&&e[o]!==1?`${e[o]} - coords[${o}] - 1`:`coords[${o}]`,s=e.map((o,i)=>r(i)).join(","),a=It(n);this.userCode=` void main() { - ${s} coords = getOutputCoords(); - setOutput(getX(${r})); + ${a} coords = getOutputCoords(); + setOutput(getX(${s})); } - `}},VAe=class{constructor(e,t){this.variableNames=["x"],this.packedInputs=!0,this.packedOutput=!0;let n=e.length;if(n>4)throw new Error(`WebGL backend: Reverse of rank-${n} tensor is not yet supported`);this.outputShape=e;let a=Bn("rc",n),r=`${a[n-1]} + 1 < ${this.outputShape[n-1]}`,s=`${a[n-2]} + 1 < ${this.outputShape[n-2]}`,i=kt(n);n===1?this.userCode=` + `}},VAe=class{constructor(e,t){this.variableNames=["x"],this.packedInputs=!0,this.packedOutput=!0;let n=e.length;if(n>4)throw new Error(`WebGL backend: Reverse of rank-${n} tensor is not yet supported`);this.outputShape=e;let r=Vn("rc",n),s=`${r[n-1]} + 1 < ${this.outputShape[n-1]}`,a=`${r[n-2]} + 1 < ${this.outputShape[n-2]}`,o=It(n);n===1?this.userCode=` void main(){ int rc = getOutputCoords(); vec4 result = vec4(0.); result.r = getChannel(getX(${e[0]} - rc - 1), ${e[0]} - rc - 1); - if(${r}){ + if(${s}){ result.g = getChannel(getX(${e[0]} - (rc + 1) - 1), ${e[0]} - (rc + 1) - 1); } @@ -3929,21 +3929,21 @@ return a / b;`,_1e=` } `:this.userCode=` void main() { - ${i} rc = getOutputCoords(); + ${o} rc = getOutputCoords(); vec4 result = vec4(0.); - result.r = ${o(a.slice())}; - if(${r}){ - result.g = ${l(a.slice())}; + result.r = ${i(r.slice())}; + if(${s}){ + result.g = ${l(r.slice())}; } - if(${s}) { - result.b = ${u(a.slice())}; - if(${r}) { - result.a = ${d(a.slice())}; + if(${a}) { + result.b = ${u(r.slice())}; + if(${s}) { + result.a = ${c(r.slice())}; } } setOutput(result); } - `;function o(c){return h(c)}function l(c){return c[n-1]="("+c[n-1]+" + 1)",h(c)}function u(c){return c[n-2]="("+c[n-2]+" + 1)",h(c)}function d(c){return c[n-1]="("+c[n-1]+" + 1)",c[n-2]="("+c[n-2]+" + 1)",h(c)}function h(c){let m=e.map((y,A)=>p(A,c)),f=m.join(","),g=m.slice(-2).join(",");return`getChannel(getX(${f}), vec2(${g}))`}function p(c,m){return t.indexOf(c)!==-1&&e[c]!==1?`${e[c]} - ${m[c]} - 1`:`${m[c]}`}}};function UAe(e){let{inputs:t,backend:n,attrs:a}=e,{x:r}=t,{dims:s}=a,i=r.shape.length,o=k.parseAxisParam(s,r.shape);if(i===0)return fa({inputs:{x:r},backend:n});let l=se().getBool("WEBGL_PACK_ARRAY_OPERATIONS")?new VAe(r.shape,o):new BAe(r.shape,o);return n.runWebGLProgram(l,[r],r.dtype)}var jAe={kernelName:Cl,backendName:"webgl",kernelFunc:UAe},HAe=class{constructor(e,t){this.variableNames=["Image"],this.outputShape=[];let n=e[1],a=e[2];this.outputShape=e;let r="";typeof t=="number"?r=`float outputValue = ${t.toFixed(2)};`:r=` + `;function i(p){return d(p)}function l(p){return p[n-1]="("+p[n-1]+" + 1)",d(p)}function u(p){return p[n-2]="("+p[n-2]+" + 1)",d(p)}function c(p){return p[n-1]="("+p[n-1]+" + 1)",p[n-2]="("+p[n-2]+" + 1)",d(p)}function d(p){let f=e.map((y,A)=>h(A,p)),m=f.join(","),g=f.slice(-2).join(",");return`getChannel(getX(${m}), vec2(${g}))`}function h(p,f){return t.indexOf(p)!==-1&&e[p]!==1?`${e[p]} - ${f[p]} - 1`:`${f[p]}`}}};function UAe(e){let{inputs:t,backend:n,attrs:r}=e,{x:s}=t,{dims:a}=r,o=s.shape.length,i=k.parseAxisParam(a,s.shape);if(o===0)return mr({inputs:{x:s},backend:n});let l=ae().getBool("WEBGL_PACK_ARRAY_OPERATIONS")?new VAe(s.shape,i):new WAe(s.shape,i);return n.runWebGLProgram(l,[s],s.dtype)}var HAe={kernelName:El,backendName:"webgl",kernelFunc:UAe},GAe=class{constructor(e,t){this.variableNames=["Image"],this.outputShape=[];let n=e[1],r=e[2];this.outputShape=e;let s="";typeof t=="number"?s=`float outputValue = ${t.toFixed(2)};`:s=` vec3 fill = vec3(${t.join(",")}); float outputValue = fill[coords[3]];`,this.userCode=` uniform vec4 params; @@ -3957,13 +3957,13 @@ return a / b;`,_1e=` (float(y) - params[1]) * params[3]; int coordX = int(round(coordXFloat + params[0])); int coordY = int(round(coordYFloat + params[1])); - ${r} - if(coordX >= 0 && coordX < ${a} && coordY >= 0 && coordY < ${n}) { + ${s} + if(coordX >= 0 && coordX < ${r} && coordY >= 0 && coordY < ${n}) { outputValue = getImage(coords[0], coordY, coordX, coords[3]); } setOutput(outputValue); } - `}getCustomSetupFunc(e,t,n,a){return(r,s)=>{this.paramsLoc==null&&(this.paramsLoc=r.getUniformLocationNoThrow(s,"params")),r.gl.uniform4f(this.paramsLoc,e,t,n,a)}}},GAe={kernelName:ch,backendName:"webgl",kernelFunc:({inputs:e,attrs:t,backend:n})=>{let{image:a}=e,{radians:r,fillValue:s,center:i}=t,o=n,l=new HAe(a.shape,s),[u,d]=M.getImageCenter(i,a.shape[1],a.shape[2]),h=l.getCustomSetupFunc(u,d,Math.sin(r),Math.cos(r));return o.runWebGLProgram(l,[a],a.dtype,h)}},qAe=` + `}getCustomSetupFunc(e,t,n,r){return(s,a)=>{this.paramsLoc==null&&(this.paramsLoc=s.getUniformLocationNoThrow(a,"params")),s.gl.uniform4f(this.paramsLoc,e,t,n,r)}}},jAe={kernelName:pd,backendName:"webgl",kernelFunc:({inputs:e,attrs:t,backend:n})=>{let{image:r}=e,{radians:s,fillValue:a,center:o}=t,i=n,l=new GAe(r.shape,a),[u,c]=_.getImageCenter(o,r.shape[1],r.shape[2]),d=l.getCustomSetupFunc(u,c,Math.sin(s),Math.cos(s));return i.runWebGLProgram(l,[r],r.dtype,d)}},qAe=` // OpenGL ES does not support round function. // The algorithm is based on banker's rounding. float base = floor(x); @@ -3978,8 +3978,8 @@ return a / b;`,_1e=` return base + 1.0; } } -`,KAe=ot({opSnippet:qAe}),XAe={kernelName:Ml,backendName:"webgl",kernelFunc:KAe},ZAe="return inversesqrt(x);",YAe=ot({opSnippet:ZAe,cpuKernelImpl:Sce}),JAe={kernelName:Di,backendName:"webgl",kernelFunc:YAe},hC=class{constructor(e,t,n,a,r,s,i=!0){this.variableNames=["updates","indices","defaultValue"],this.outputShape=s;let o=kt(r.length),l=kt(s.length),u="";n===1?u="i":n===2&&(u="i, j");let d=`getIndices(${u})`,h="";a===1?h="i":a===2&&(h="i, coords[1]");let p=`getUpdates(${h})`,c=t>1?"strides[j]":"strides";this.userCode=` - ${o} strides = ${o}(${r}); +`,KAe=it({opSnippet:qAe}),XAe={kernelName:$l,backendName:"webgl",kernelFunc:KAe},ZAe="return inversesqrt(x);",YAe=it({opSnippet:ZAe,cpuKernelImpl:Spe}),JAe={kernelName:Oo,backendName:"webgl",kernelFunc:YAe},d9=class{constructor(e,t,n,r,s,a,o=!0){this.variableNames=["updates","indices","defaultValue"],this.outputShape=a;let i=It(s.length),l=It(a.length),u="";n===1?u="i":n===2&&(u="i, j");let c=`getIndices(${u})`,d="";r===1?d="i":r===2&&(d="i, coords[1]");let h=`getUpdates(${d})`,p=t>1?"strides[j]":"strides";this.userCode=` + ${i} strides = ${i}(${s}); void main() { ${l} coords = getOutputCoords(); @@ -3988,41 +3988,41 @@ return a / b;`,_1e=` for (int i = 0; i < ${e}; i++) { int flattenedIndex = 0; for (int j = 0; j < ${t}; j++) { - int index = round(${d}); - flattenedIndex += index * ${c}; + int index = round(${c}); + flattenedIndex += index * ${p}; } if (flattenedIndex == coords[0]) { - sum += ${p}; + sum += ${h}; found = true; } } setOutput(mix(getDefaultValue(), sum, float(found))); } - `}};function QAe(e){let{inputs:t,backend:n,attrs:a}=e,{indices:r,updates:s}=t,{shape:i}=a,{sliceRank:o,numUpdates:l,sliceSize:u,strides:d,outputSize:h}=M.calculateShapes(s,r,i),p=[h/u,u];if(h===0)return n.makeTensorInfo(i,r.dtype);let c=be({inputs:{x:r},backend:n,attrs:{shape:[l,o]}}),m=be({inputs:{x:s},backend:n,attrs:{shape:[l,u]}}),f=n.makeTensorInfo([],"float32",new Float32Array([0])),g=new hC(l,o,c.shape.length,m.shape.length,d,p),y=n.runWebGLProgram(g,[m,c,f],m.dtype),A=be({inputs:{x:y},backend:n,attrs:{shape:i}});return n.disposeIntermediateTensorInfo(c),n.disposeIntermediateTensorInfo(m),n.disposeIntermediateTensorInfo(y),n.disposeIntermediateTensorInfo(f),A}var e2e={kernelName:eh,backendName:"webgl",kernelFunc:QAe},t2e=class{constructor(e,t,n){this.variableNames=["c","a","b"],this.outputShape=t;let a,r;if(n>4)throw Error(`Where for rank ${n} is not yet supported`);if(n===1)r="resRC",a="resRC";else{let i=["resRC.x","resRC.y","resRC.z","resRC.w"],o=[],l=[];for(let u=0;u4)throw Error(`Where for rank ${n} is not yet supported`);if(n===1)s="resRC",r="resRC";else{let o=["resRC.x","resRC.y","resRC.z","resRC.w"],i=[],l=[];for(let u=0;u= 1.0) { - setOutput(getA(${r})); + setOutput(getA(${s})); } else { - setOutput(getB(${r})); + setOutput(getB(${s})); } } - `}};function n2e(e){let{inputs:t,backend:n}=e,{condition:a,t:r,e:s}=t,i=new t2e(a.shape.length,r.shape,r.shape.length);return n.runWebGLProgram(i,[a,r,s],Ga(r.dtype,s.dtype))}var a2e={kernelName:th,backendName:"webgl",kernelFunc:n2e},r2e=` + `}};function n1e(e){let{inputs:t,backend:n}=e,{condition:r,t:s,e:a}=t,o=new t1e(r.shape.length,s.shape,s.shape.length);return n.runWebGLProgram(o,[r,s,a],qr(s.dtype,a.dtype))}var r1e={kernelName:td,backendName:"webgl",kernelFunc:n1e},s1e=` // Stable and Attracting Fixed Point (0, 1) for Normalized Weights. // see: https://arxiv.org/abs/1706.02515 - float scaleAlpha = ${M.SELU_SCALEALPHA}; - float scale = ${M.SELU_SCALE}; + float scaleAlpha = ${_.SELU_SCALEALPHA}; + float scale = ${_.SELU_SCALE}; return (x >= 0.0) ? scale * x : scaleAlpha * (exp(x) - 1.0); -`,s2e=ot({opSnippet:r2e}),i2e={kernelName:nh,backendName:"webgl",kernelFunc:s2e},o2e="return 1.0 / (1.0 + exp(-1.0 * x));",l2e=ot({opSnippet:o2e}),u2e={kernelName:Rl,backendName:"webgl",kernelFunc:l2e},d2e=` +`,a1e=it({opSnippet:s1e}),o1e={kernelName:nd,backendName:"webgl",kernelFunc:a1e},i1e="return 1.0 / (1.0 + exp(-1.0 * x));",l1e=it({opSnippet:i1e}),u1e={kernelName:Rl,backendName:"webgl",kernelFunc:l1e},c1e=` if (isnan(x)) { return 0.0; } return sign(x); -`,h2e=ot({opSnippet:d2e}),p2e={kernelName:sh,backendName:"webgl",kernelFunc:h2e},c2e=NE+` +`,d1e=it({opSnippet:c1e}),h1e={kernelName:ad,backendName:"webgl",kernelFunc:d1e},p1e=TE+` return sin(x); -`,f2e=ot({opSnippet:c2e}),m2e={kernelName:$l,backendName:"webgl",kernelFunc:f2e},g2e=` +`,f1e=it({opSnippet:p1e}),m1e={kernelName:_l,backendName:"webgl",kernelFunc:f1e},g1e=` float e2x = exp(x); return (e2x - 1.0 / e2x) / 2.0; -`,y2e=ot({opSnippet:g2e}),A2e={kernelName:rh,backendName:"webgl",kernelFunc:y2e},x2e=` +`,y1e=it({opSnippet:g1e}),A1e={kernelName:sd,backendName:"webgl",kernelFunc:y1e},x1e=` float epsilon = 1.1920928955078125e-7; float threshold = log(epsilon) + 2.0; @@ -4042,36 +4042,36 @@ return a / b;`,_1e=` result = log(exp_x + 1.0); } return result; -`,b2e=ot({opSnippet:x2e}),v2e={kernelName:ih,backendName:"webgl",kernelFunc:b2e},w2e=e=>{let{inputs:t,backend:n,attrs:a}=e,{x:r}=t,{blockShape:s,paddings:i}=a;k.assert(r.shape.length<=4,()=>"spaceToBatchND for rank > 4 with a WebGL backend not implemented yet");let o=s.reduce((y,A)=>y*A),l=[[0,0]];l.push(...i);for(let y=1+s.length;yn.disposeIntermediateTensorInfo(y)),g},k2e={kernelName:of,backendName:"webgl",kernelFunc:w2e};function I2e(e){let{inputs:t,backend:n}=e,{indices:a,values:r,denseShape:s,defaultValue:i}=t;if(s.shape.length!==1)throw new Error(`Dense shape must be a vector, saw: - ${s.shape}`);if(a.shape.length!==2)throw new Error(`Indices must be a matrix, saw: - ${a.shape}`);if(r.shape.length!==1)throw new Error(`Values must be a vector, saw: - ${r.shape}`);if(i.shape.length!==0)throw new Error(`Default value must be a scalar, saw: - ${i.shape}`);let o=n.readSync(a.dataId),l=n.readSync(r.dataId),u=n.readSync(s.dataId),d=n.readSync(i.dataId)[0],[h,p,c,m,f]=Tce(o,a.shape,a.dtype,l,r.dtype,u,d);return[n.makeTensorInfo(p,a.dtype,h),n.makeTensorInfo([p[0]],r.dtype,c),n.makeTensorInfo([m.length],"bool",new Uint8Array(m.map(g=>Number(g)))),n.makeTensorInfo([f.length],a.dtype,new Int32Array(f))]}var S2e={kernelName:q1,backendName:"webgl",kernelFunc:I2e};function N2e(e){let{inputs:t,backend:n}=e,{inputIndices:a,inputShape:r,newShape:s}=t;if(a.shape.length!==2)throw new Error(`Input indices should be a matrix but received shape ${a.shape}`);if(r.shape.length!==1)throw new Error(`Input shape should be a vector but received shape ${r.shape}`);if(s.shape.length!==1)throw new Error(`Target shape should be a vector but received shape ${s.shape}`);let i=Array.from(n.readSync(r.dataId)),o=n.readSync(a.dataId),l=Array.from(n.readSync(s.dataId)),[u,d,h]=Ece(o,a.shape,a.dtype,i,l);return[n.makeTensorInfo(d,a.dtype,u),n.makeTensorInfo([h.length],s.dtype,new Int32Array(h))]}var T2e={kernelName:K1,backendName:"webgl",kernelFunc:N2e};function E2e(e){let{inputs:t,backend:n}=e,{data:a,indices:r,segmentIds:s}=t;if(a.shape.length<1)throw new Error("Data should be at least 1 dimensional but received scalar");if(r.shape.length!==1)throw new Error(`Indices should be a vector but received shape - ${r.shape}`);if(s.shape.length!==1)throw new Error(`Segment ids should be a vector but received shape - ${s.shape}`);let i=n.readSync(a.dataId),o=n.readSync(r.dataId),l=n.readSync(s.dataId),[u,d]=pE(i,a.shape,a.dtype,o,l,!0);return n.makeTensorInfo(d,a.dtype,u)}var C2e={kernelName:X1,backendName:"webgl",kernelFunc:E2e};function M2e(e){let{inputs:t,backend:n}=e,{data:a,indices:r,segmentIds:s}=t;if(a.shape.length<1)throw new Error("Data should be at least 1 dimensional but received scalar");if(r.shape.length!==1)throw new Error(`Indices should be a vector but received shape - ${r.shape}`);if(s.shape.length!==1)throw new Error(`Segment ids should be a vector but received shape - ${s.shape}`);let i=n.readSync(a.dataId),o=n.readSync(r.dataId),l=n.readSync(s.dataId),[u,d]=pE(i,a.shape,a.dtype,o,l);return n.makeTensorInfo(d,a.dtype,u)}var $2e={kernelName:Z1,backendName:"webgl",kernelFunc:M2e};function R2e(e){let{inputs:t,backend:n,attrs:a}=e,{sparseIndices:r,sparseValues:s,defaultValue:i}=t,{outputShape:o}=a,{sliceRank:l,numUpdates:u,strides:d,outputSize:h}=M.calculateShapes(s,r,o),p=!1,c=new hC(u,l,r.shape.length,s.shape.length,d,[h,1],p),m=n.runWebGLProgram(c,[s,r,i],s.dtype),f=be({inputs:{x:m},backend:n,attrs:{shape:o}});return n.disposeIntermediateTensorInfo(m),f}var F2e={kernelName:Y1,backendName:"webgl",kernelFunc:R2e};function O2e(e){let{inputs:t,backend:n,attrs:a}=e,{x:r}=t,{numOrSizeSplits:s,axis:i}=a,o=k.parseAxisParam(i,r.shape)[0],l=M.prepareSplitSize(r,s,o),u=r.shape.length,d=new Array(u).fill(0),h=r.shape.slice();return l.map(p=>{let c=[...h];c[o]=p;let m=fp({inputs:{x:r},backend:n,attrs:{begin:d,size:c}});return d[o]+=p,m})}var D2e={kernelName:oh,backendName:"webgl",kernelFunc:O2e},_2e="return sqrt(x);",z2e=ot({opSnippet:_2e}),P2e={kernelName:Fl,backendName:"webgl",kernelFunc:z2e},L2e="return x * x;",W2e=ot({opSnippet:L2e}),B2e={kernelName:lf,backendName:"webgl",kernelFunc:W2e},pC="return (a - b) * (a - b);",V2e=Tn({opSnippet:pC,packedOpSnippet:pC}),U2e={kernelName:_i,backendName:"webgl",kernelFunc:V2e};function j2e({inputs:e,attrs:t,backend:n}){let{x:a}=e,r=gr+` +`,b1e=it({opSnippet:x1e}),v1e={kernelName:od,backendName:"webgl",kernelFunc:b1e},w1e=e=>{let{inputs:t,backend:n,attrs:r}=e,{x:s}=t,{blockShape:a,paddings:o}=r;k.assert(s.shape.length<=4,()=>"spaceToBatchND for rank > 4 with a WebGL backend not implemented yet");let i=a.reduce((y,A)=>y*A),l=[[0,0]];l.push(...o);for(let y=1+a.length;yn.disposeIntermediateTensorInfo(y)),g},k1e={kernelName:of,backendName:"webgl",kernelFunc:w1e};function I1e(e){let{inputs:t,backend:n}=e,{indices:r,values:s,denseShape:a,defaultValue:o}=t;if(a.shape.length!==1)throw new Error(`Dense shape must be a vector, saw: + ${a.shape}`);if(r.shape.length!==2)throw new Error(`Indices must be a matrix, saw: + ${r.shape}`);if(s.shape.length!==1)throw new Error(`Values must be a vector, saw: + ${s.shape}`);if(o.shape.length!==0)throw new Error(`Default value must be a scalar, saw: + ${o.shape}`);let i=n.readSync(r.dataId),l=n.readSync(s.dataId),u=n.readSync(a.dataId),c=n.readSync(o.dataId)[0],[d,h,p,f,m]=Npe(i,r.shape,r.dtype,l,s.dtype,u,c);return[n.makeTensorInfo(h,r.dtype,d),n.makeTensorInfo([h[0]],s.dtype,p),n.makeTensorInfo([f.length],"bool",new Uint8Array(f.map(g=>Number(g)))),n.makeTensorInfo([m.length],r.dtype,new Int32Array(m))]}var S1e={kernelName:Ky,backendName:"webgl",kernelFunc:I1e};function T1e(e){let{inputs:t,backend:n}=e,{inputIndices:r,inputShape:s,newShape:a}=t;if(r.shape.length!==2)throw new Error(`Input indices should be a matrix but received shape ${r.shape}`);if(s.shape.length!==1)throw new Error(`Input shape should be a vector but received shape ${s.shape}`);if(a.shape.length!==1)throw new Error(`Target shape should be a vector but received shape ${a.shape}`);let o=Array.from(n.readSync(s.dataId)),i=n.readSync(r.dataId),l=Array.from(n.readSync(a.dataId)),[u,c,d]=Cpe(i,r.shape,r.dtype,o,l);return[n.makeTensorInfo(c,r.dtype,u),n.makeTensorInfo([d.length],a.dtype,new Int32Array(d))]}var N1e={kernelName:Xy,backendName:"webgl",kernelFunc:T1e};function C1e(e){let{inputs:t,backend:n}=e,{data:r,indices:s,segmentIds:a}=t;if(r.shape.length<1)throw new Error("Data should be at least 1 dimensional but received scalar");if(s.shape.length!==1)throw new Error(`Indices should be a vector but received shape + ${s.shape}`);if(a.shape.length!==1)throw new Error(`Segment ids should be a vector but received shape + ${a.shape}`);let o=n.readSync(r.dataId),i=n.readSync(s.dataId),l=n.readSync(a.dataId),[u,c]=hE(o,r.shape,r.dtype,i,l,!0);return n.makeTensorInfo(c,r.dtype,u)}var E1e={kernelName:Zy,backendName:"webgl",kernelFunc:C1e};function $1e(e){let{inputs:t,backend:n}=e,{data:r,indices:s,segmentIds:a}=t;if(r.shape.length<1)throw new Error("Data should be at least 1 dimensional but received scalar");if(s.shape.length!==1)throw new Error(`Indices should be a vector but received shape + ${s.shape}`);if(a.shape.length!==1)throw new Error(`Segment ids should be a vector but received shape + ${a.shape}`);let o=n.readSync(r.dataId),i=n.readSync(s.dataId),l=n.readSync(a.dataId),[u,c]=hE(o,r.shape,r.dtype,i,l);return n.makeTensorInfo(c,r.dtype,u)}var _1e={kernelName:Yy,backendName:"webgl",kernelFunc:$1e};function R1e(e){let{inputs:t,backend:n,attrs:r}=e,{sparseIndices:s,sparseValues:a,defaultValue:o}=t,{outputShape:i}=r,{sliceRank:l,numUpdates:u,strides:c,outputSize:d}=_.calculateShapes(a,s,i),h=!1,p=new d9(u,l,s.shape.length,a.shape.length,c,[d,1],h),f=n.runWebGLProgram(p,[a,s,o],a.dtype),m=ve({inputs:{x:f},backend:n,attrs:{shape:i}});return n.disposeIntermediateTensorInfo(f),m}var D1e={kernelName:Jy,backendName:"webgl",kernelFunc:R1e};function F1e(e){let{inputs:t,backend:n,attrs:r}=e,{x:s}=t,{numOrSizeSplits:a,axis:o}=r,i=k.parseAxisParam(o,s.shape)[0],l=_.prepareSplitSize(s,a,i),u=s.shape.length,c=new Array(u).fill(0),d=s.shape.slice();return l.map(h=>{let p=[...d];p[i]=h;let f=fh({inputs:{x:s},backend:n,attrs:{begin:c,size:p}});return c[i]+=h,f})}var M1e={kernelName:id,backendName:"webgl",kernelFunc:F1e},O1e="return sqrt(x);",P1e=it({opSnippet:O1e}),z1e={kernelName:Dl,backendName:"webgl",kernelFunc:P1e},L1e="return x * x;",B1e=it({opSnippet:L1e}),W1e={kernelName:lf,backendName:"webgl",kernelFunc:B1e},h9="return (a - b) * (a - b);",V1e=Nn({opSnippet:h9,packedOpSnippet:h9}),U1e={kernelName:Po,backendName:"webgl",kernelFunc:V1e};function H1e({inputs:e,attrs:t,backend:n}){let{x:r}=e,s=ys+` return x > 0.0 ? 1.0 : float(${t.alpha}); - `,s=new Qs(a.shape,r);return n.runWebGLProgram(s,[a],a.dtype)}var H2e={kernelName:Li,backendName:"webgl",kernelFunc:j2e},G2e=class{constructor(e,t,n){this.variableNames=["x"],this.outputShape=n;let a=n.length,r=kt(n.length),s=kt(n.length),i="";if(a===1)i="coords * strides + begin";else{let o=0;i=n.map((l,u)=>(o++,n.length===1?`coords * strides[${u}] + begin[${u}]`:`coords[${o-1}] * strides[${u}] + begin[${u}]`)).join(",")}this.userCode=` - ${r} begin = ${r}(${e}); - ${r} strides = ${r}(${t}); + `,a=new Qa(r.shape,s);return n.runWebGLProgram(a,[r],r.dtype)}var G1e={kernelName:Bo,backendName:"webgl",kernelFunc:H1e},j1e=class{constructor(e,t,n){this.variableNames=["x"],this.outputShape=n;let r=n.length,s=It(n.length),a=It(n.length),o="";if(r===1)o="coords * strides + begin";else{let i=0;o=n.map((l,u)=>(i++,n.length===1?`coords * strides[${u}] + begin[${u}]`:`coords[${i-1}] * strides[${u}] + begin[${u}]`)).join(",")}this.userCode=` + ${s} begin = ${s}(${e}); + ${s} strides = ${s}(${t}); void main() { - ${s} coords = getOutputCoords(); - setOutput(getX(${i})); + ${a} coords = getOutputCoords(); + setOutput(getX(${o})); } - `}};function q2e(e){let{inputs:t,backend:n,attrs:a}=e,{x:r}=t,{begin:s,end:i,strides:o,beginMask:l,endMask:u,ellipsisMask:d,newAxisMask:h,shrinkAxisMask:p}=a,{nonStrided:c,$begin:m,$strides:f,size:g,newShape:y,outShape:A}=Cn.sliceInfo(r.shape,s,i,o,l,u,d,h,p),x=be({inputs:{x:r},backend:n,attrs:{shape:y}}),v;if(c){let w=fp({inputs:{x},backend:n,attrs:{begin:m,size:g}});v=be({inputs:{x:w},backend:n,attrs:{shape:A}}),n.disposeIntermediateTensorInfo(w)}else if(A.some(w=>w===0))v=n.makeTensorInfo(A,r.dtype,[]);else if(n.shouldExecuteOnCPU([x])){let w=n.texData.get(x.dataId).values,I=Pe(x.shape,x.dtype,w),T=Cce(A,I,f,m);v=n.makeTensorInfo(A,x.dtype,T.values)}else{let w=new G2e(m,f,A);v=n.runWebGLProgram(w,[x],x.dtype)}let b=be({inputs:{x:v},backend:n,attrs:{shape:A}});return n.disposeIntermediateTensorInfo(x),n.disposeIntermediateTensorInfo(v),b}var K2e={kernelName:lh,backendName:"webgl",kernelFunc:q2e};function X2e(e){let{inputs:t,backend:n,attrs:a}=e,{separator:r,nGramWidths:s,leftPad:i,rightPad:o,padWidth:l,preserveShortSequences:u}=a,{data:d,dataSplits:h}=t,p=n.readSync(d.dataId),c=n.readSync(h.dataId),[m,f]=Mce(p,c,r,s,i,o,l,u);return[n.makeTensorInfo([m.length],"string",m),n.makeTensorInfo(h.shape,"int32",f)]}var Z2e={kernelName:J1,backendName:"webgl",kernelFunc:X2e};function Y2e(e){let{inputs:t,backend:n,attrs:a}=e,{skipEmpty:r}=a,{input:s,delimiter:i}=t;if(s.dtype!=="string")throw new Error("Input must be of datatype string");if(s.shape.length!==1)throw new Error(`Input must be a vector, got shape: ${s.shape}`);if(i.shape.length!==0)throw new Error(`Delimiter must be a scalar, got shape: ${i.shape}`);let o=n.readSync(s.dataId),l=n.readSync(i.dataId)[0],[u,d,h]=$ce(o,l,r),p=d.length;return[n.makeTensorInfo([p,2],"int32",u),n.makeTensorInfo([p],"string",d),n.makeTensorInfo([2],"int32",new Int32Array(h))]}var J2e={kernelName:Q1,backendName:"webgl",kernelFunc:Y2e};function Q2e(e){let{inputs:t,backend:n,attrs:a}=e,{numBuckets:r}=a,{input:s}=t;if(s.dtype!=="string")throw new Error("Input must be of datatype string");if(r<=0)throw new Error("Number of buckets must be at least 1");let i=n.readSync(s.dataId),o=Rce(i,r);return n.makeTensorInfo(s.shape,"int32",o)}var exe={kernelName:eA,backendName:"webgl",kernelFunc:Q2e},txe="return tan(x);",nxe=ot({opSnippet:txe}),axe={kernelName:_l,backendName:"webgl",kernelFunc:nxe},rxe=` + `}};function q1e(e){let{inputs:t,backend:n,attrs:r}=e,{x:s}=t,{begin:a,end:o,strides:i,beginMask:l,endMask:u,ellipsisMask:c,newAxisMask:d,shrinkAxisMask:h}=r,{nonStrided:p,$begin:f,$strides:m,size:g,newShape:y,outShape:A}=En.sliceInfo(s.shape,a,o,i,l,u,c,d,h),x=ve({inputs:{x:s},backend:n,attrs:{shape:y}}),b;if(p){let w=fh({inputs:{x},backend:n,attrs:{begin:f,size:g}});b=ve({inputs:{x:w},backend:n,attrs:{shape:A}}),n.disposeIntermediateTensorInfo(w)}else if(A.some(w=>w===0))b=n.makeTensorInfo(A,s.dtype,[]);else if(n.shouldExecuteOnCPU([x])){let T=n.texData.get(x.dataId).values,C=Le(x.shape,x.dtype,T),M=Epe(A,C,m,f);b=n.makeTensorInfo(A,x.dtype,M.values)}else{let I=new j1e(f,m,A);b=n.runWebGLProgram(I,[x],x.dtype)}let v=ve({inputs:{x:b},backend:n,attrs:{shape:A}});return n.disposeIntermediateTensorInfo(x),n.disposeIntermediateTensorInfo(b),v}var K1e={kernelName:ld,backendName:"webgl",kernelFunc:q1e};function X1e(e){let{inputs:t,backend:n,attrs:r}=e,{separator:s,nGramWidths:a,leftPad:o,rightPad:i,padWidth:l,preserveShortSequences:u}=r,{data:c,dataSplits:d}=t,h=n.readSync(c.dataId),p=n.readSync(d.dataId),[f,m]=$pe(h,p,s,a,o,i,l,u);return[n.makeTensorInfo([f.length],"string",f),n.makeTensorInfo(d.shape,"int32",m)]}var Z1e={kernelName:Qy,backendName:"webgl",kernelFunc:X1e};function Y1e(e){let{inputs:t,backend:n,attrs:r}=e,{skipEmpty:s}=r,{input:a,delimiter:o}=t;if(a.dtype!=="string")throw new Error("Input must be of datatype string");if(a.shape.length!==1)throw new Error(`Input must be a vector, got shape: ${a.shape}`);if(o.shape.length!==0)throw new Error(`Delimiter must be a scalar, got shape: ${o.shape}`);let i=n.readSync(a.dataId),l=n.readSync(o.dataId)[0],[u,c,d]=_pe(i,l,s),h=c.length;return[n.makeTensorInfo([h,2],"int32",u),n.makeTensorInfo([h],"string",c),n.makeTensorInfo([2],"int32",new Int32Array(d))]}var J1e={kernelName:eA,backendName:"webgl",kernelFunc:Y1e};function Q1e(e){let{inputs:t,backend:n,attrs:r}=e,{numBuckets:s}=r,{input:a}=t;if(a.dtype!=="string")throw new Error("Input must be of datatype string");if(s<=0)throw new Error("Number of buckets must be at least 1");let o=n.readSync(a.dataId),i=Rpe(o,s);return n.makeTensorInfo(a.shape,"int32",i)}var exe={kernelName:tA,backendName:"webgl",kernelFunc:Q1e},txe="return tan(x);",nxe=it({opSnippet:txe}),rxe={kernelName:Ol,backendName:"webgl",kernelFunc:nxe},sxe=` float e2x = exp(-2.0 * abs(x)); return sign(x) * (1.0 - e2x) / (1.0 + e2x); -`,sxe=ot({opSnippet:rxe}),ixe={kernelName:zl,backendName:"webgl",kernelFunc:sxe},oxe=class{constructor(e,t){this.variableNames=["A"];let n=new Array(e.length);for(let s=0;s5)throw Error(`Tile for rank ${t} is not yet supported`);if(t===1)return`imod(resRC, ${e[0]})`;let n=["resRC.x","resRC.y","resRC.z","resRC.w","resRC.u"],a=[];for(let r=0;r5){let o=n.readSync(r.dataId),l=r.dtype==="string"?o.map(h=>k.decodeString(h)):o,u=Pe(r.shape,r.dtype,l),d=Oce(u,s);return n.makeTensorInfo(d.shape,d.dtype,d.values)}let i=new oxe(r.shape,s);return n.runWebGLProgram(i,[r],r.dtype)}var uxe={kernelName:Pi,backendName:"webgl",kernelFunc:cC};function dxe(e){let{inputs:t,backend:n,attrs:a}=e,{x:r}=t,{k:s,sorted:i}=a,o=n.readSync(r.dataId),[l,u]=Dce(o,r.shape,r.dtype,s,i);return[n.makeTensorInfo(l.shape,l.dtype,l.values),n.makeTensorInfo(u.shape,u.dtype,u.values)]}var hxe={kernelName:uh,backendName:"webgl",kernelFunc:dxe},pxe=class{constructor(e,t,n,a,r,s){this.variableNames=["Image","Transforms"],this.outputShape=s;let i=n==="nearest"?1:2,o;switch(a){case"constant":o=1;break;case"reflect":o=2;break;case"wrap":o=3;break;case"nearest":o=4;break;default:o=1;break}this.userCode=` + `}};function lxe(e){let t=e.length;if(t>5)throw Error(`Tile for rank ${t} is not yet supported`);if(t===1)return`imod(resRC, ${e[0]})`;let n=["resRC.x","resRC.y","resRC.z","resRC.w","resRC.u"],r=[];for(let s=0;s5){let l=n.readSync(s.dataId),u=s.dtype==="string"?l.map(h=>k.decodeString(h)):l,c=Le(s.shape,s.dtype,u),d=Fpe(c,a);return n.makeTensorInfo(d.shape,d.dtype,d.values)}let o=new ixe(s.shape,a);return n.runWebGLProgram(o,[s],s.dtype)}var uxe={kernelName:Lo,backendName:"webgl",kernelFunc:p9};function cxe(e){let{inputs:t,backend:n,attrs:r}=e,{x:s}=t,{k:a,sorted:o}=r,i=n.readSync(s.dataId),[l,u]=Mpe(i,s.shape,s.dtype,a,o);return[n.makeTensorInfo(l.shape,l.dtype,l.values),n.makeTensorInfo(u.shape,u.dtype,u.values)]}var dxe={kernelName:ud,backendName:"webgl",kernelFunc:cxe},hxe=class{constructor(e,t,n,r,s,a){this.variableNames=["Image","Transforms"],this.outputShape=a;let o=n==="nearest"?1:2,i;switch(r){case"constant":i=1;break;case"reflect":i=2;break;case"wrap":i=3;break;case"nearest":i=4;break;default:i=1;break}this.userCode=` float mapCoord(float outCoord, float len) { float inCoord = outCoord; - if(${o} == 2) { + if(${i} == 2) { if (inCoord < 0.0) { if (len <= 1.0) { inCoord = 0.0; @@ -4095,7 +4095,7 @@ return a / b;`,_1e=` } } return clamp(inCoord, 0.0, len - 1.0); - } else if (${o} == 3) { + } else if (${i} == 3) { if (inCoord < 0.0) { if (len <= 1.0) { inCoord = 0.0; @@ -4112,7 +4112,7 @@ return a / b;`,_1e=` } } return clamp(inCoord, 0.0, len - 1.0); - } else if (${o} == 4) { + } else if (${i} == 4) { return clamp(outCoord, 0.0, len - 1.0); } else { return outCoord; @@ -4125,7 +4125,7 @@ return a / b;`,_1e=` if (0 <= coordY && coordY < ${e} && 0 <= coordX && coordX < ${t}) { outputValue = getImage(batch, coordY, coordX, channel); } else { - outputValue = float(${r}); + outputValue = float(${s}); } return outputValue; } @@ -4149,14 +4149,14 @@ return a / b;`,_1e=` float c2 = getTransforms(batch, 7); float projection = c1 * xf + c2 * yf + 1.0; if (projection == 0.0) { - outputValue = float(${r}); + outputValue = float(${s}); } else { float inX = (a1 * xf + a2 * yf + a3) / projection; float inY = (b1 * xf + b2 * yf + b3) / projection; float mapX = mapCoord(inX, float(${t})); float mapY = mapCoord(inY, float(${e})); - if (${i} == 1) { + if (${o} == 1) { int coordY = int(round(mapY)); int coordX = int(round(mapX)); outputValue = readWithFillValue(batch, coordY, coordX, @@ -4180,26 +4180,26 @@ return a / b;`,_1e=` } setOutput(outputValue); } - `}};function cxe(e){let{inputs:t,backend:n,attrs:a}=e,{image:r,transforms:s}=t,{interpolation:i,fillMode:o,fillValue:l,outputShape:u}=a,[d,h,p,c]=r.shape,[m,f]=u!=null?u:[h,p],g=[d,m,f,c],y=new pxe(h,p,i,o,l,g);return n.runWebGLProgram(y,[r,s],"float32")}var fxe={kernelName:dh,backendName:"webgl",kernelFunc:cxe};function mxe(e){let{inputs:t,attrs:n,backend:a}=e,{axis:r}=n,{x:s}=t;mu(s,"unique"),console.warn("WARNING: ","UI might be locked temporarily as data is being downloaded");let i=a.readSync(s.dataId),{outputValues:o,outputShape:l,indices:u}=_ce(i,r,s.shape,s.dtype);return[a.makeTensorInfo(l,s.dtype,o),a.makeTensorInfo([u.length],"int32",u)]}var gxe={kernelName:tA,backendName:"webgl",kernelFunc:mxe};function yxe(e){let{inputs:t,backend:n,attrs:a}=e,{value:r}=t,{axis:s}=a;s<0&&(s+=r.shape.length);let i=r,o=i.shape.length,l=r.shape[s],u=new Array(o-1),d=0;for(let f=0;fn.disposeIntermediateTensorInfo(f)),m}var Axe={kernelName:hh,backendName:"webgl",kernelFunc:yxe},xxe=class{constructor(e,t){this.variableNames=["x","segmentIds"];let n=e.windowSize,a=e.batchSize,r=e.inSize,s=e.numSegments,i=s*Math.ceil(r/n);this.outputShape=[a,i];let o="0.0",l="sumValue",u=Math.floor(n/4)*4,d=n%4,h=` + `}};function pxe(e){let{inputs:t,backend:n,attrs:r}=e,{image:s,transforms:a}=t,{interpolation:o,fillMode:i,fillValue:l,outputShape:u}=r,[c,d,h,p]=s.shape,[f,m]=u!=null?u:[d,h],g=[c,f,m,p],y=new hxe(d,h,o,i,l,g);return n.runWebGLProgram(y,[s,a],"float32")}var fxe={kernelName:cd,backendName:"webgl",kernelFunc:pxe};function mxe(e){let{inputs:t,attrs:n,backend:r}=e,{axis:s}=n,{x:a}=t;mu(a,"unique"),console.warn("WARNING: ","UI might be locked temporarily as data is being downloaded");let o=r.readSync(a.dataId),{outputValues:i,outputShape:l,indices:u}=Ope(o,s,a.shape,a.dtype);return[r.makeTensorInfo(l,a.dtype,i),r.makeTensorInfo([u.length],"int32",u)]}var gxe={kernelName:nA,backendName:"webgl",kernelFunc:mxe};function yxe(e){let{inputs:t,backend:n,attrs:r}=e,{value:s}=t,{axis:a}=r;a<0&&(a+=s.shape.length);let o=s,i=o.shape.length,l=s.shape[a],u=new Array(i-1),c=0;for(let m=0;mn.disposeIntermediateTensorInfo(m)),f}var Axe={kernelName:dd,backendName:"webgl",kernelFunc:yxe},xxe=class{constructor(e,t){this.variableNames=["x","segmentIds"];let n=e.windowSize,r=e.batchSize,s=e.inSize,a=e.numSegments,o=a*Math.ceil(s/n);this.outputShape=[r,o];let i="0.0",l="sumValue",u=Math.floor(n/4)*4,c=n%4,d=` sumValue += dot(values, segFilter); - `,p="";r%n>0&&(p=` - if (inIdx < 0 || inIdx >= ${r}) { + `,h="";s%n>0&&(h=` + if (inIdx < 0 || inIdx >= ${s}) { return initializationValue; } - `);let c="";r%n>0&&(c=` - if (inIdx < 0 || inIdx >= ${r}) { + `);let p="";s%n>0&&(p=` + if (inIdx < 0 || inIdx >= ${s}) { return -1.0; } `),this.userCode=` - const float initializationValue = ${o}; + const float initializationValue = ${i}; float getValue(int batch, int inIdx) { - ${p} + ${h} return getX(batch, inIdx); } float getSegmentIdAtIndex(int inIdx) { - ${c} + ${p} return getSegmentIds(inIdx); } @@ -4208,8 +4208,8 @@ return a / b;`,_1e=` int batch = coords[0]; int outIdx = coords[1]; int inOffset = int(floor(float(outIdx) / float( - ${s})) * float(${n})); - int currentSeg = int(mod(float(outIdx), float(${s}))); + ${a})) * float(${n})); + int currentSeg = int(mod(float(outIdx), float(${a}))); float sumValue = 0.0; @@ -4229,11 +4229,11 @@ return a / b;`,_1e=` int(getSegmentIdAtIndex(inIdx + 3)) == currentSeg ? 1 : 0 ); - ${h} + ${d} } int inIdx = inOffset + ${u}; - if (${d===1}) { + if (${c===1}) { vec4 values = vec4( getValue(batch, inIdx), initializationValue, @@ -4250,8 +4250,8 @@ return a / b;`,_1e=` 0 ); - ${h} - } else if (${d===2}) { + ${d} + } else if (${c===2}) { vec4 values = vec4( getValue(batch, inIdx), getValue(batch, inIdx + 1), @@ -4266,8 +4266,8 @@ return a / b;`,_1e=` 0 ); - ${h} - } else if (${d===3}) { + ${d} + } else if (${c===3}) { vec4 values = vec4( getValue(batch, inIdx), getValue(batch, inIdx + 1), @@ -4282,18 +4282,18 @@ return a / b;`,_1e=` 0 ); - ${h} + ${d} } setOutput(${l}); } - `}};function bxe(e){let{inputs:t,backend:n,attrs:a}=e,{x:r,segmentIds:s}=t,{numSegments:i}=a,o=r.shape.length,l=[],u=0,d=M.getAxesPermutation([u],o),h=r;d!=null&&(h=Vn({inputs:{x:r},backend:n,attrs:{perm:d}}),l.push(h),u=M.getInnerMostAxes(1,o)[0]);let p=M.segment_util.computeOutShape(h.shape,u,i),c=k.sizeFromShape([h.shape[u]]),m=be({inputs:{x:h},backend:n,attrs:{shape:[-1,c]}});l.push(m);let f=pA(r.dtype),g=(v,b,w,I,T)=>{let C=v.shape[0],z=v.shape[1],$=M.segment_util.segOpComputeOptimalWindowSize(z,T),S={windowSize:$,inSize:z,batchSize:C,numSegments:T},D=new xxe(S,b),_=n.compileAndRun(D,[v,w],I);if(l.push(_),_.shape[1]===T)return _;let W=dC({backend:n,attrs:{start:0,stop:T,step:1,dtype:"float32"}}),X=cC({inputs:{x:W},backend:n,attrs:{reps:[z/$]}});return l.push(W),l.push(X),g(_,b,X,I,T)},y=g(m,"unsortedSegmentSum",s,f,i),A=be({inputs:{x:y},backend:n,attrs:{shape:p}}),x=A;if(d!=null){l.push(A);let v=M.getUndoAxesPermutation(d);x=Vn({inputs:{x},backend:n,attrs:{perm:v}})}return l.forEach(v=>n.disposeIntermediateTensorInfo(v)),x}var vxe={kernelName:uf,backendName:"webgl",kernelFunc:bxe},wxe=[Zye,Qye,Dfe,zfe,Wfe,Ufe,Hfe,Kfe,Zfe,Jfe,n0e,r0e,o0e,d0e,y0e,c0e,b0e,I0e,w0e,E0e,M0e,R0e,_0e,U0e,H0e,Y0e,Q0e,ame,ime,gfe,hme,vme,kme,mme,Tme,Cme,Sme,Rme,Dme,Pme,Wme,Vme,Hme,Yme,Qme,qme,nge,sge,oge,hge,mge,xge,wge,kge,Ige,Nge,Ege,Mge,Rge,Oge,Pge,Bge,jge,Gge,Xge,Qge,aye,oye,mfe,uye,ume,pye,mye,Aye,Afe,wye,Nye,Eye,Dye,Rye,Lye,Vye,Gye,t1e,u1e,o1e,c1e,m1e,y1e,s1e,x1e,v1e,S1e,C1e,F1e,B1e,kfe,U1e,G1e,X1e,J1e,q0e,tAe,aAe,sAe,lAe,pAe,bfe,fAe,mAe,K0e,z1e,AAe,NAe,wAe,Sfe,MAe,FAe,zAe,WAe,jAe,GAe,XAe,JAe,e2e,a2e,i2e,u2e,p2e,m2e,A2e,B0e,L1e,v2e,k2e,S2e,T2e,C2e,$2e,F2e,D2e,P2e,B2e,U2e,H2e,K2e,Z2e,J2e,exe,P1e,Rfe,axe,ixe,uxe,hxe,fxe,Ffe,gxe,Axe,vxe,nAe];for(let e of wxe)sA(e);var na;(function(e){e[e.float32=0]="float32",e[e.int32=1]="int32",e[e.bool=2]="bool",e[e.string=3]="string",e[e.complex64=4]="complex64"})(na||(na={}));var gp;(function(e){e[e.linear=0]="linear",e[e.relu=1]="relu",e[e.relu6=2]="relu6",e[e.prelu=3]="prelu",e[e.leakyrelu=4]="leakyrelu",e[e.sigmoid=5]="sigmoid"})(gp||(gp={}));var fC;function kxe(e){fC=e.wasm.cwrap(Ll,null,["number","array","number","number","array","number","number","number","number","number","number","number","number"])}function Ixe(e){let{inputs:t,backend:n,attrs:a}=e,{a:r,b:s,bias:i,preluActivationWeights:o}=t;if(r.dtype!=="float32"||s.dtype!=="float32")throw new Error("_FusedMatMul for non non-float32 tensors not yet supported.");let{transposeA:l,transposeB:u,activation:d,leakyreluAlpha:h}=a,p=n.dataIdMap.get(r.dataId).id,c=n.dataIdMap.get(s.dataId).id,m=0;if(i!=null){let T=n.dataIdMap.get(i.dataId);if(T.shape.length!==1)throw new Error(`_FusedMatMul only supports rank-1 bias but got rank ${T.shape.length}.`);m=T.id}let f=o==null?0:n.dataIdMap.get(o.dataId).id,g=gp[d];if(g==null)throw new Error(`${d} activation not yet supported for FusedConv2D in the wasm backend.`);let y=l?r.shape[2]:r.shape[1],A=u?s.shape[1]:s.shape[2],x=r.shape[0],v=n.makeOutput([x,y,A],r.dtype),b=n.dataIdMap.get(v.dataId).id,w=new Uint8Array(new Int32Array(r.shape).buffer),I=new Uint8Array(new Int32Array(s.shape).buffer);return fC(p,w,r.shape.length,c,I,s.shape.length,l,u,g,m,f,h||0,b),v}var Sxe={kernelName:Ll,backendName:"wasm",setupFunc:kxe,kernelFunc:Ixe};function Un(e){let t;function n(r){t=r.wasm.cwrap(e,null,["number","number"])}function a(r){let{backend:s,inputs:{x:i}}=r,o=s.dataIdMap.get(i.dataId).id,l=s.makeOutput(i.shape,i.dtype),u=s.dataIdMap.get(l.dataId).id;return k.sizeFromShape(l.shape)===0||t(o,u),l}return{kernelName:e,backendName:"wasm",setupFunc:n,kernelFunc:a}}var Nxe=Un(xd);function jn(e,t,n){let a;function r(i){a=i.wasm.cwrap(e,null,["number","array","number","number","array","number","number","number"])}function s(i){let{backend:o,inputs:l}=i,{a:u,b:d}=l,h=o.dataIdMap.get(u.dataId).id,p=o.dataIdMap.get(d.dataId).id,c=n!=null?n:u.dtype,m=M.assertAndGetBroadcastShape(u.shape,d.shape),f=o.makeOutput(m,c);if(k.sizeFromShape(m)===0)return f;let g=new Uint8Array(new Int32Array(u.shape).buffer),y=new Uint8Array(new Int32Array(d.shape).buffer),A=o.dataIdMap.get(f.dataId).id,x=()=>a(h,g,u.shape.length,p,y,d.shape.length,na[u.dtype],A);if(t&&u.dtype==="float32")return x(),f;let v=M.getBroadcastDims(u.shape,m),b=M.getBroadcastDims(d.shape,m),w=v.every((T,C)=>T===C),I=b.every((T,C)=>T===C);if(w&&I)return x(),f;throw new Error(`Broadcasting along outer dims is not yet supported for ${u.dtype} ${e}.`)}return{kernelName:e,backendName:"wasm",setupFunc:r,kernelFunc:s}}var Txe=!0,Exe=jn(Os,Txe),mC;function Cxe(e){mC=e.wasm.cwrap(Zo,null,["array","number","number","number"])}function Mxe(e){let{inputs:t,backend:n}=e,a=n.makeOutput(t[0].shape,t[0].dtype);if(k.sizeFromShape(a.shape)===0)return a;let r=t.map(o=>n.dataIdMap.get(o.dataId).id),s=new Uint8Array(new Int32Array(r).buffer),i=n.dataIdMap.get(a.dataId).id;return mC(s,r.length,na[a.dtype],i),a}var $xe={kernelName:Zo,backendName:"wasm",setupFunc:Cxe,kernelFunc:Mxe};function J0(e){let{inputs:{x:t},backend:n}=e,a=n.makeOutput(t.shape,t.dtype),r=n.typedArrayFromHeap(t);return n.typedArrayFromHeap(a).set(r),a}var Rxe={kernelName:pl,backendName:"wasm",kernelFunc:J0},gC;function Fxe(e){gC=e.wasm.cwrap(Pl,null,["number","array","number","number","number","array","number"])}function Q0(e){let{inputs:t,backend:n,attrs:a}=e,[r,s]=Dxe(t.x.shape,a.perm),i=!0;for(let m=0;m=r&&(s===-1||a[s]>a[i])&&(s=i);a[s]=r}return[n,a]}var _xe={kernelName:Pl,backendName:"wasm",kernelFunc:Q0,setupFunc:Fxe};function ti(e,t,n){let a=e.shape,r=e.shape.length,s=k.parseAxisParam(t,a),i=s,o=M.getAxesPermutation(i,r),l=null,u=!1;if(o!=null){let d=new Array(r);for(let p=0;p`new shape: ${i}, old shape: ${a.shape}. New shape and old shape must have the same number of elements.`),e.backend.incRef(a.dataId),{dataId:a.dataId,shape:i,dtype:a.dtype}}var Xxe={kernelName:Qd,backendName:"wasm",kernelFunc:yr},vC;function Zxe(e){vC=e.wasm.cwrap(Qo,null,["number","array","number","number","array","number","number","number","number"])}function Yxe(e){let{inputs:t,backend:n,attrs:a}=e,{a:r,b:s}=t,{transposeA:i,transposeB:o}=a;if(r.dtype!=="float32"||s.dtype!=="float32")throw new Error("BatchMatMul for non non-float32 tensors not yet supported.");let l=r.shape.length,u=s.shape.length,d=i?r.shape[l-2]:r.shape[l-1],h=o?s.shape[u-1]:s.shape[u-2],p=i?r.shape[l-1]:r.shape[l-2],c=o?s.shape[u-2]:s.shape[u-1],m=r.shape.slice(0,-2),f=s.shape.slice(0,-2),g=k.sizeFromShape(m),y=k.sizeFromShape(f),A=g===y||g===1||y===1;k.assert(l>=2&&u>=2&&A,()=>`Error in matMul: the input batch dimensions must either be the same or at least one input batch dimension must be 1. Got input batch dimensions of (${m}) and (${f}).`);let x=(g>y?r.shape.slice(0,-2):s.shape.slice(0,-2)).concat([p,c]);k.assert(d===h,()=>`Error in matMul: inner shapes (${d}) and (${h}) of Tensors with shapes ${r.shape} and ${s.shape} and transposeA=${i} and transposeB=${o} must match.`);let v=i?[g,d,p]:[g,p,d],b=o?[y,c,h]:[y,h,c],w=yr({inputs:{x:r},backend:n,attrs:{shape:v}}),I=yr({inputs:{x:s},backend:n,attrs:{shape:b}}),T=n.dataIdMap.get(w.dataId).id,C=n.dataIdMap.get(I.dataId).id,z=i?w.shape[2]:w.shape[1],$=o?I.shape[1]:I.shape[2],S=Math.max(g,y),D=n.makeOutput([S,z,$],w.dtype),_=n.dataIdMap.get(D.dataId).id,W=new Uint8Array(new Int32Array(w.shape).buffer),X=new Uint8Array(new Int32Array(I.shape).buffer);return vC(T,W,w.shape.length,C,X,I.shape.length,i,o,_),n.disposeData(w.dataId),n.disposeData(I.dataId),D.shape=x,D}var Jxe={kernelName:Qo,backendName:"wasm",setupFunc:Zxe,kernelFunc:Yxe};function em(e){let{inputs:{x:t},attrs:{dtype:n},backend:a}=e,r=a.makeOutput(t.shape,n),s=a.typedArrayFromHeap(t);return a.typedArrayFromHeap(r).set(s),r}var Qxe={kernelName:el,backendName:"wasm",kernelFunc:em},e5e=Un(Ni),wC;function t5e(e){wC=e.wasm.cwrap(Ti,null,["number","number","number","number"])}function n5e(e){let{inputs:t,backend:n,attrs:a}=e,{x:r}=t,{clipValueMin:s,clipValueMax:i}=a,o=n.dataIdMap.get(r.dataId).id,l=n.makeOutput(r.shape,r.dtype),u=n.dataIdMap.get(l.dataId).id;return wC(o,s,i,u),l}var a5e={kernelName:Ti,backendName:"wasm",setupFunc:t5e,kernelFunc:n5e};function kC(e){let{inputs:t,backend:n}=e,a=k.parseAxisParam(e.attrs.axis,t[0].shape)[0],r=M.computeOutShape(t.map(c=>c.shape),a),s=t.filter(c=>k.sizeFromShape(c.shape)>0);if(s.length===1)return J0({inputs:{x:s[0]},backend:n});let i=n.makeOutput(r,t[0].dtype);if(k.sizeFromShape(r)===0)return i;let o=s.map(c=>c.shape);if(M.assertParamsConsistent(o,a),s[0].dtype==="string"){let c=s.map(x=>{let v=k.sizeFromShape(x.shape.slice(a));return yr({inputs:{x},backend:n,attrs:{shape:[-1,v]}})}),m=c.map(x=>({vals:n.readSync(x.dataId),shape:x.shape}));r=M.computeOutShape(c.map(x=>x.shape),1);let f=c[0].shape[0]===1,g=qT(m,r,t[0].dtype,f),y=M.computeOutShape(s.map(x=>x.shape),a);i.shape=y;let A=n.dataIdMap.get(i.dataId);return A.stringBytes=M.fromStringArrayToUint8(g),c.forEach(x=>n.disposeData(x.dataId)),i}let l=k.sizeFromShape(s[0].shape.slice(0,a)),u=0,d=s.map(c=>{let m=k.sizeFromShape(c.shape.slice(a));return u+=m,m}),h=s.map(c=>n.typedArrayFromHeap(c)),p=n.typedArrayFromHeap(i);for(let c=0;c`cumsum does not support ${r.dtype} tensors in the WASM backend`);let u=M.getAxesPermutation([s],l),d=r;u!==null&&(d=Q0({inputs:{x:r},attrs:{perm:u},backend:n}));let h=M.getInnerMostAxes(1,l)[0];M.assertAxesAreInnerMostDims("cumsum",[h],l);let p=n.makeOutput(d.shape,d.dtype),c=d.shape[h],m=n.dataIdMap.get(d.dataId).id,f=n.dataIdMap.get(p.dataId).id;TC(m,i?1:0,o?1:0,c,f,na[r.dtype]);let g=p;if(u!==null){let y=M.getUndoAxesPermutation(u);g=Q0({inputs:{x:p},attrs:{perm:y},backend:n}),n.disposeData(d.dataId),n.disposeData(p.dataId)}return g}var y5e={kernelName:rl,backendName:"wasm",setupFunc:m5e,kernelFunc:g5e},EC;function A5e(e){EC=e.wasm.cwrap(Rd,null,["number","number","number","array","number","array","array","number","number"])}function x5e(e){let{backend:t,inputs:n,attrs:a}=e,{x:r}=n,{blockSize:s,dataFormat:i}=a;k.assert(s>1,()=>`blockSize should be > 1 for depthToSpace, but was: ${s}`);let o=r.shape[0],l=i==="NHWC"?r.shape[1]:r.shape[2],u=i==="NHWC"?r.shape[2]:r.shape[3],d=i==="NHWC"?r.shape[3]:r.shape[1],h=l*s,p=u*s,c=d/(s*s),m=i==="NHWC"?[o,h,p,c]:[o,c,h,p],f=t.makeOutput(m,"float32"),g=t.dataIdMap.get(r.dataId).id,y=new Uint8Array(new Int32Array(k.computeStrides(r.shape)).buffer),A=new Uint8Array(new Int32Array(m).buffer),x=new Uint8Array(new Int32Array(k.computeStrides(m)).buffer),v=t.dataIdMap.get(f.dataId).id;return EC(g,s,i==="NHWC"?1:0,y,r.shape.length-1,A,x,m.length,v),f}var b5e={kernelName:Rd,backendName:"wasm",setupFunc:A5e,kernelFunc:x5e},CC;function v5e(e){CC=e.wasm.cwrap(sl,null,["number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number"])}function w5e(e){let{inputs:t,attrs:n,backend:a}=e,{x:r,filter:s}=t,i=a.dataIdMap.get(r.dataId).id,o=a.dataIdMap.get(s.dataId).id,{strides:l,dilations:u,pad:d,dimRoundingMode:h}=n,p=u==null?[1,1]:u,c=M.computeConv2DInfo(r.shape,s.shape,l,p,d,h,!0),m=c.filterHeight,f=c.filterWidth,g=c.padInfo.top,y=c.padInfo.right,A=c.padInfo.bottom,x=c.padInfo.left,v=c.dilationHeight,b=c.dilationWidth,w=c.strideHeight,I=c.strideWidth,T=c.inChannels,C=c.outChannels,z=c.padInfo.type==="SAME"?1:0;if(c.dataFormat!=="channelsLast")throw new Error(`wasm backend DepthwiseConv2dNative does not support dataFormat:'${c.dataFormat}'. Please use 'channelsLast'.`);let $=a.makeOutput(c.outShape,"float32"),S=a.dataIdMap.get($.dataId).id;return CC(i,r.shape[0],r.shape[1],r.shape[2],o,m,f,g,y,A,x,z,v,b,w,I,T,C,S),$}var k5e={kernelName:sl,backendName:"wasm",setupFunc:v5e,kernelFunc:w5e},I5e=!1,S5e=jn(ol,I5e,"bool"),N5e=Un(Ei);function fb(e){let{inputs:t,attrs:n,backend:a}=e,{input:r}=t,{dim:s}=n,i=r.shape.length,o=r.shape.slice(),l=s;return s<0&&(k.assert(-(i+1)<=s,()=>`Axis must be in the interval [${-(i+1)}, ${i}]`),l=i+s+1),o.splice(l,0,1),yr({inputs:{x:r},backend:a,attrs:{shape:o}})}var T5e={kernelName:Dd,backendName:"wasm",kernelFunc:fb};function E5e(e){let{attrs:{shape:t,value:n,dtype:a},backend:r}=e,s=r.makeOutput(t,a);return r.typedArrayFromHeap(s).fill(n),s}var C5e={kernelName:Qc,backendName:"wasm",kernelFunc:E5e},MC;function M5e(e){MC=e.wasm.cwrap(_d,null,["number","number","number","number","number","number"])}function $5e(e){let{inputs:t,backend:n}=e,{image:a}=t,r=n.makeOutput(a.shape,a.dtype),s=n.dataIdMap.get(a.dataId).id,i=n.dataIdMap.get(r.dataId).id,[o,l,u,d]=a.shape;return MC(s,o,l,u,d,i),r}var R5e={kernelName:_d,backendName:"wasm",kernelFunc:$5e,setupFunc:M5e},F5e=Un(Ci),O5e=!1,D5e=jn(ul,O5e),$C;function _5e(e){$C=e.wasm.cwrap(dl,null,["number","number","number","number","number","number","number"])}function z5e(e){let{backend:t,inputs:n,attrs:a}=e,{varianceEpsilon:r}=a,{x:s,mean:i,variance:o,offset:l,scale:u}=n,d=t.dataIdMap.get(s.dataId).id,h=t.dataIdMap.get(i.dataId).id,p=t.dataIdMap.get(o.dataId).id,c=l!=null?t.dataIdMap.get(l.dataId).id:0,m=u!=null?t.dataIdMap.get(u.dataId).id:0,f=t.makeOutput(s.shape,s.dtype);if(k.sizeFromShape(s.shape)===0)return f;let g=t.dataIdMap.get(f.dataId).id;return $C(d,h,p,c,m,r,g),f}var P5e={kernelName:dl,backendName:"wasm",setupFunc:_5e,kernelFunc:z5e},RC;function L5e(e){RC=e.wasm.cwrap(Wl,null,["number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number"])}function W5e(e){let{inputs:t,attrs:n,backend:a}=e,{x:r,filter:s,bias:i,preluActivationWeights:o}=t,{strides:l,pad:u,dilations:d,dataFormat:h,dimRoundingMode:p,activation:c,leakyreluAlpha:m}=n,f=M.computeConv2DInfo(r.shape,s.shape,l,d,u,p),g=gp[c];if(g==null)throw new Error(`${c} activation not yet supported for FusedConv2D in the wasm backend.`);let y=a.dataIdMap.get(r.dataId).id,A=a.dataIdMap.get(s.dataId).id,x=f.outChannels,v=0;if(i!=null){let te=a.dataIdMap.get(i.dataId);if(te.shape.length!==1)throw new Error(`FusedConv2D only supports rank-1 bias but got rank ${te.shape.length}.`);if(te.shape[0]!==x)throw new Error(`FusedConv2D bias shape (${te.shape}) does not match the number of output channels (${x})`);v=te.id}let b=f.filterHeight,w=f.filterWidth,I=f.padInfo.top,T=f.padInfo.right,C=f.padInfo.bottom,z=f.padInfo.left,$=f.dilationHeight,S=f.dilationWidth,D=f.strideHeight,_=f.strideWidth,W=f.inChannels,X=f.padInfo.type==="SAME"?1:0,q=f.batchSize,Q=f.inHeight,ee=f.inWidth;if(h!=="NHWC")throw new Error(`wasm backend FusedConv2D does not support dataFormat:'${h}'. Please use 'NHWC'.`);let ie=a.makeOutput(f.outShape,"float32"),ae=a.dataIdMap.get(ie.dataId).id,de=o==null?0:a.dataIdMap.get(o.dataId).id;return RC(y,q,Q,ee,A,b,w,v,I,T,C,z,X,$,S,D,_,W,x,g,de,m||0,ae),ie}var B5e={kernelName:Wl,backendName:"wasm",setupFunc:L5e,kernelFunc:W5e},FC;function V5e(e){FC=e.wasm.cwrap(Bl,null,["number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number"])}function U5e(e){let{inputs:t,attrs:n,backend:a}=e,{x:r,filter:s,bias:i,preluActivationWeights:o}=t,{strides:l,pad:u,dilations:d,dataFormat:h,dimRoundingMode:p,activation:c,leakyreluAlpha:m}=n,f=M.computeConv2DInfo(r.shape,s.shape,l,d,u,p,!0),g=gp[c];if(g==null)throw new Error(`${c} activation not yet supported for FusedDepthwiseConv2D in the wasm backend.`);let y=a.dataIdMap.get(r.dataId).id,A=a.dataIdMap.get(s.dataId).id,x=f.outChannels,v=0;if(i!=null){let te=a.dataIdMap.get(i.dataId);if(te.shape.length!==1)throw new Error(`FusedDepthwiseConv2D only supports rank-1 bias but got rank ${te.shape.length}.`);if(te.shape[0]!==x)throw new Error(`FusedDepthwiseConv2D bias shape (${te.shape}) does not match the number of output channels (${x})`);v=te.id}let b=f.filterHeight,w=f.filterWidth,I=f.padInfo.top,T=f.padInfo.right,C=f.padInfo.bottom,z=f.padInfo.left,$=f.dilationHeight,S=f.dilationWidth,D=f.strideHeight,_=f.strideWidth,W=f.inChannels,X=f.padInfo.type==="SAME"?1:0,q=f.batchSize,Q=f.inHeight,ee=f.inWidth;if(h!=="NHWC")throw new Error(`wasm backend FusedDepthwiseConv2D does not support dataFormat:'${h}'. Please use 'NHWC'.`);let ie=a.makeOutput(f.outShape,"float32"),ae=a.dataIdMap.get(ie.dataId).id,de=o==null?0:a.dataIdMap.get(o.dataId).id;return FC(y,q,Q,ee,A,b,w,v,I,T,C,z,X,$,S,D,_,W,x,g,de,m||0,ae),ie}var j5e={kernelName:Bl,backendName:"wasm",setupFunc:V5e,kernelFunc:U5e},OC;function H5e(e){OC=e.wasm.cwrap(Pd,null,["number","number","number","number","number","number","array","number"])}function G5e(e){let{backend:t,inputs:n}=e,{params:a,indices:r}=n,[s,i,o,l]=S4.prepareAndValidate(a,r),u=t.makeOutput(s,a.dtype);if(i===0)return u;let d=r.shape,h=d[d.length-1],p=t.dataIdMap.get(a.dataId).id,c=t.dataIdMap.get(r.dataId).id,m=new Uint8Array(new Int32Array(l).buffer),f=t.dataIdMap.get(u.dataId).id;return OC(p,na[a.dtype],c,i,h,o,m,f),u}var q5e={kernelName:Pd,backendName:"wasm",setupFunc:H5e,kernelFunc:G5e},DC;function K5e(e){DC=e.wasm.cwrap("Gather",null,["number","number","array","number","number","number","array","number"])}function X5e(e){let{backend:t,inputs:n,attrs:a}=e,{x:r,indices:s}=n,{axis:i,batchDims:o}=a,l=k.parseAxisParam(i,r.shape)[0],u=M.segment_util.collectGatherOpShapeInfo(r,s,l,o),d=yr({inputs:{x:r},attrs:{shape:[u.batchSize,u.outerSize,u.dimSize,u.sliceSize]},backend:t}),h=k.sizeFromShape(s.shape),p=yr({inputs:{x:s},attrs:{shape:[u.batchSize,h/u.batchSize]},backend:t}),c=[u.batchSize,u.outerSize,h/u.batchSize,u.sliceSize],m=t.makeOutput(c,r.dtype);if(k.sizeFromShape(r.shape)===0)return m;let f=d.shape.length-1,g=t.dataIdMap.get(d.dataId).id,y=t.dataIdMap.get(p.dataId).id,A=t.dataIdMap.get(m.dataId).id,x=new Uint8Array(new Int32Array(k.computeStrides(d.shape)).buffer),v=new Uint8Array(new Int32Array(k.computeStrides(c)).buffer);return DC(g,na[r.dtype],x,f,y,u.batchSize,v,A),t.disposeData(d.dataId),t.disposeData(p.dataId),m.shape=u.outputShape,m}var Z5e={kernelName:zd,backendName:"wasm",setupFunc:K5e,kernelFunc:X5e},Y5e=!1,J5e=jn(hl,Y5e,"bool"),Q5e=!1,ebe=jn(Mi,Q5e,"bool"),_C;function tbe(e){_C=e.wasm.cwrap(cl,null,["number","number","number"])}function nbe(e){let{inputs:{x:t},attrs:{alpha:n},backend:a}=e,r=a.dataIdMap.get(t.dataId).id,s=a.makeOutput(t.shape,t.dtype);if(k.sizeFromShape(t.shape)!==0){let i=a.dataIdMap.get(s.dataId).id;_C(r,n,i)}return s}var abe={kernelName:cl,backendName:"wasm",setupFunc:tbe,kernelFunc:nbe},rbe=!1,sbe=jn(fl,rbe,"bool"),ibe=!1,obe=jn(ml,ibe,"bool"),lbe=Un($i),ube=!1,dbe=jn(Ud,ube,"bool"),zC;function hbe(e){zC=e.wasm.cwrap(gl,null,["number, number, number"])}function pbe(e){let{backend:t,inputs:n,attrs:a}=e,{reductionIndices:r,keepDims:s}=a,{x:i}=n,o=t.dataIdMap.get(i.dataId).id,l=i,{transposed:u,axes:d,originalAxes:h,inputWasTransposed:p}=ti(i,r,t);if(p){let A=t.dataIdMap.get(u.dataId).id;l=u,o=A}let c=l.shape.length;M.assertAxesAreInnerMostDims("max",d,c);let[m,f]=M.computeOutAndReduceShapes(l.shape,d),g=k.sizeFromShape(f),y=t.makeOutput(m,i.dtype);if(k.sizeFromShape(l.shape)!==0){let A=t.dataIdMap.get(y.dataId).id;zC(o,g,A)}if(p&&t.disposeData(u.dataId),s){let A=M.expandShapeToKeepDim(y.shape,h);y.shape=A}return y}var cbe={kernelName:gl,backendName:"wasm",setupFunc:hbe,kernelFunc:pbe},fbe=!1,mbe=jn(Ri,fbe),PC;function gbe(e){PC=e.wasm.cwrap(yl,null,["number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number"])}function ybe(e){let{inputs:t,attrs:n,backend:a}=e,r=t.x,s=a.dataIdMap.get(r.dataId).id,{filterSize:i,strides:o,pad:l,dimRoundingMode:u}=n,d=M.computePool2DInfo(r.shape,i,o,1,l,u),h=d.filterHeight,p=d.filterWidth,c=d.padInfo.top,m=d.padInfo.right,f=d.padInfo.bottom,g=d.padInfo.left,y=d.dilationHeight,A=d.dilationWidth,x=d.strideHeight,v=d.strideWidth,b=d.inChannels,w=d.outChannels;if(d.dataFormat!=="channelsLast")throw new Error(`wasm backend does not support dataFormat:'${d.dataFormat}'. Please use 'channelsLast'.`);let I=a.makeOutput(d.outShape,"float32"),T=a.dataIdMap.get(I.dataId).id;return PC(s,r.shape[0],r.shape[1],r.shape[2],h,p,c,m,f,g,y,A,x,v,b,w,T),I}var Abe={kernelName:yl,backendName:"wasm",setupFunc:gbe,kernelFunc:ybe},LC;function xbe(e){LC=e.wasm.cwrap(Al,null,["number, number, number"])}function bbe(e){let{backend:t,inputs:n,attrs:a}=e,{axis:r,keepDims:s}=a,{x:i}=n,o=t.dataIdMap.get(i.dataId).id,l=o,u=i,{transposed:d,axes:h,originalAxes:p,inputWasTransposed:c}=ti(i,r,t),m=h;if(c){let v=t.dataIdMap.get(d.dataId).id;v!==o&&(u=d,l=v,m=M.getInnerMostAxes(m.length,u.shape.length))}M.assertAxesAreInnerMostDims("mean",m,u.shape.length);let[f,g]=M.computeOutAndReduceShapes(u.shape,m),y=k.sizeFromShape(g),A=u;u.dtype!=="float32"&&(A=em({backend:t,inputs:{x:u},attrs:{dtype:"float32"}}),l=t.dataIdMap.get(A.dataId).id);let x=t.makeOutput(f,"float32");if(k.sizeFromShape(u.shape)!==0){let v=t.dataIdMap.get(x.dataId).id;LC(l,y,v)}if(c&&t.disposeData(d.dataId),s){let v=M.expandShapeToKeepDim(x.shape,p);x.shape=v}return u.dtype!=="float32"&&t.disposeData(A.dataId),x}var vbe={kernelName:Al,backendName:"wasm",setupFunc:xbe,kernelFunc:bbe},WC;function wbe(e){WC=e.wasm.cwrap(xl,null,["number, number, number"])}function kbe(e){let{backend:t,inputs:n,attrs:a}=e,{axis:r,keepDims:s}=a,{x:i}=n,o=t.dataIdMap.get(i.dataId).id,l=o,u=i,{transposed:d,axes:h,originalAxes:p,inputWasTransposed:c}=ti(i,r,t);if(c){let x=t.dataIdMap.get(d.dataId).id;x!==o&&(u=d,l=x)}let m=u.shape.length;M.assertAxesAreInnerMostDims("min",h,m);let[f,g]=M.computeOutAndReduceShapes(u.shape,h),y=k.sizeFromShape(g),A=t.makeOutput(f,u.dtype);if(k.sizeFromShape(u.shape)!==0){let x=t.dataIdMap.get(A.dataId).id;WC(l,y,x)}if(c&&t.disposeData(d.dataId),s){let x=M.expandShapeToKeepDim(A.shape,p);A.shape=x}return A}var Ibe={kernelName:xl,backendName:"wasm",setupFunc:wbe,kernelFunc:kbe},Sbe=!1,Nbe=jn(Fi,Sbe),mb;(function(e){e[e.reflect=0]="reflect",e[e.symmetric=1]="symmetric"})(mb||(mb={}));var BC;function Tbe(e){BC=e.wasm.cwrap(bl,null,["number","array","number","number","array","array","number","number"])}function Ebe(e){let{inputs:{x:t},backend:n,attrs:{paddings:a,mode:r}}=e,s=a.map((m,f)=>m[0]+t.shape[f]+m[1]),i=n.dataIdMap.get(t.dataId).id,o=n.makeOutput(s,t.dtype),l=n.dataIdMap.get(o.dataId).id,u=new Uint8Array(new Int32Array(t.shape).buffer),d=a.map(m=>m[0]),h=a.map(m=>m[1]),p=new Uint8Array(new Int32Array(d).buffer),c=new Uint8Array(new Int32Array(h).buffer);return BC(i,u,t.shape.length,na[t.dtype],p,c,mb[r],l),o}var Cbe={kernelName:bl,backendName:"wasm",kernelFunc:Ebe,setupFunc:Tbe},Mbe=!0,$be=jn(Oi,Mbe),Rbe=Un(Hd);function gb(e,t){let n=new Int32Array(e.wasm.HEAPU8.buffer,t,4),a=n[0],r=n[1],s=n[2],i=n[3];return e.wasm._free(t),{pSelectedIndices:a,selectedSize:r,pSelectedScores:s,pValidOutputs:i}}var VC;function Fbe(e){VC=e.wasm.cwrap(Gd,"number",["number","number","number","number","number"])}function Obe(e){let{backend:t,inputs:n,attrs:a}=e,{iouThreshold:r,maxOutputSize:s,scoreThreshold:i}=a,{boxes:o,scores:l}=n,u=t.dataIdMap.get(o.dataId).id,d=t.dataIdMap.get(l.dataId).id,h=VC(u,d,s,r,i),{pSelectedIndices:p,selectedSize:c,pSelectedScores:m,pValidOutputs:f}=gb(t,h);return t.wasm._free(m),t.wasm._free(f),t.makeOutput([c],"int32",p)}var Dbe={kernelName:Gd,backendName:"wasm",setupFunc:Fbe,kernelFunc:Obe},UC;function _be(e){UC=e.wasm.cwrap(qd,"number",["number","number","number","number","number","bool"])}function zbe(e){let{backend:t,inputs:n,attrs:a}=e,{iouThreshold:r,maxOutputSize:s,scoreThreshold:i,padToMaxOutputSize:o}=a,{boxes:l,scores:u}=n,d=t.dataIdMap.get(l.dataId).id,h=t.dataIdMap.get(u.dataId).id,p=UC(d,h,s,r,i,o),{pSelectedIndices:c,selectedSize:m,pSelectedScores:f,pValidOutputs:g}=gb(t,p);t.wasm._free(f);let y=t.makeOutput([m],"int32",c),A=t.makeOutput([],"int32",g);return[y,A]}var Pbe={kernelName:qd,backendName:"wasm",setupFunc:_be,kernelFunc:zbe},jC;function Lbe(e){jC=e.wasm.cwrap(Kd,"number",["number","number","number","number","number","number"])}function Wbe(e){let{backend:t,inputs:n,attrs:a}=e,{iouThreshold:r,maxOutputSize:s,scoreThreshold:i,softNmsSigma:o}=a,{boxes:l,scores:u}=n,d=t.dataIdMap.get(l.dataId).id,h=t.dataIdMap.get(u.dataId).id,p=jC(d,h,s,r,i,o),{pSelectedIndices:c,selectedSize:m,pSelectedScores:f,pValidOutputs:g}=gb(t,p);t.wasm._free(g);let y=t.makeOutput([m],"int32",c),A=t.makeOutput([m],"float32",f);return[y,A]}var Bbe={kernelName:Kd,backendName:"wasm",setupFunc:Lbe,kernelFunc:Wbe},Vbe=!1,Ube=jn(vl,Vbe,"bool"),HC;function jbe(e){HC=e.wasm.cwrap(wl,null,["number","number","number","number","number"])}function Hbe(e){let{inputs:t,backend:n,attrs:a}=e,{indices:r}=t,{depth:s,onValue:i,offValue:o}=a,l=n.makeOutput([...r.shape,s],"int32"),u=n.dataIdMap.get(l.dataId).id,d=n.dataIdMap.get(r.dataId).id;return HC(d,s,i,o,u),l}var Gbe={kernelName:wl,backendName:"wasm",setupFunc:jbe,kernelFunc:Hbe};function qbe(e){let{inputs:{x:t},backend:n}=e,a=n.makeOutput(t.shape,t.dtype);return n.typedArrayFromHeap(a).fill(1),a}var Kbe={kernelName:Xd,backendName:"wasm",kernelFunc:qbe};function Xbe(e){let{inputs:t,backend:n,attrs:a}=e,{axis:r}=a;if(t.length===1)return fb({inputs:{input:t[0]},backend:n,attrs:{dim:r}});let s=t[0].shape,i=t[0].dtype;t.forEach(d=>{k.assertShapesMatch(s,d.shape,"All tensors passed to stack must have matching shapes"),k.assert(i===d.dtype,()=>"All tensors passed to stack must have matching dtypes")});let o=[],l=t.map(d=>{let h=fb({inputs:{input:d},backend:n,attrs:{dim:r}});return o.push(h),h}),u=kC({inputs:l,backend:n,attrs:{axis:r}});return o.forEach(d=>n.disposeData(d.dataId)),u}var Zbe={kernelName:Zd,backendName:"wasm",kernelFunc:Xbe},GC;function Ybe(e){GC=e.wasm.cwrap(kl,null,["number","array","number","number","array","array","number","number"])}function Jbe(e){let{inputs:{x:t},backend:n,attrs:{paddings:a,constantValue:r}}=e,s=a.map((m,f)=>m[0]+t.shape[f]+m[1]),i=n.dataIdMap.get(t.dataId).id,o=n.makeOutput(s,t.dtype),l=n.dataIdMap.get(o.dataId).id,u=new Uint8Array(new Int32Array(t.shape).buffer),d=a.map(m=>m[0]),h=a.map(m=>m[1]),p=new Uint8Array(new Int32Array(d).buffer),c=new Uint8Array(new Int32Array(h).buffer);return GC(i,u,t.shape.length,na[t.dtype],p,c,r,l),o}var Qbe={kernelName:kl,backendName:"wasm",kernelFunc:Jbe,setupFunc:Ybe},e3e=!1,t3e=jn(Il,e3e),qC;function n3e(e){qC=e.wasm.cwrap(Sl,null,["number","number","number"])}function a3e(e){let{inputs:t,backend:n}=e,{x:a,alpha:r}=t,s=n.dataIdMap.get(a.dataId).id,i=n.dataIdMap.get(r.dataId).id,o=n.makeOutput(a.shape,"float32"),l=n.dataIdMap.get(o.dataId).id;return qC(s,i,l),o}var r3e={kernelName:Sl,backendName:"wasm",setupFunc:n3e,kernelFunc:a3e},KC;function s3e(e){KC=e.wasm.cwrap(Yd,null,["number","number","number","number"])}function i3e(e){let{backend:t,inputs:n,attrs:a}=e,{axis:r,keepDims:s}=a,{x:i}=n,o=t.dataIdMap.get(i.dataId).id,l=o,u=i,{transposed:d,axes:h,originalAxes:p,inputWasTransposed:c}=ti(i,r,t),m=h;if(c){let x=t.dataIdMap.get(d.dataId).id;x!==o&&(u=d,l=x,m=M.getInnerMostAxes(m.length,u.shape.length))}M.assertAxesAreInnerMostDims("prod",m,u.shape.length);let[f,g]=M.computeOutAndReduceShapes(u.shape,m),y=k.sizeFromShape(g),A=t.makeOutput(f,u.dtype);if(k.sizeFromShape(u.shape)!==0){let x=t.dataIdMap.get(A.dataId).id;KC(l,y,na[A.dtype],x)}if(c&&t.disposeData(d.dataId),s){let x=M.expandShapeToKeepDim(A.shape,p);A.shape=x}return A}var o3e={kernelName:Yd,backendName:"wasm",setupFunc:s3e,kernelFunc:i3e},l3e=e=>{let{backend:t,attrs:n}=e,{start:a,stop:r,step:s,dtype:i}=n,o=iE(a,r,s,i),l=t.makeOutput([o.length],i);return t.typedArrayFromHeap(l).set(o),l},u3e={kernelName:rf,backendName:"wasm",kernelFunc:l3e},d3e=!0,h3e=jn(il,d3e),p3e=Un(Nl),c3e=Un(El),XC;function f3e(e){XC=e.wasm.cwrap(Tl,null,["number","number","number","number","number","number","number","number","number","number"])}function m3e(e){let{backend:t,inputs:n,attrs:a}=e,{images:r}=n,{alignCorners:s,halfPixelCenters:i,size:o}=a,[l,u]=o,[d,h,p,c]=r.shape,m=[d,l,u,c],f=t.dataIdMap.get(r.dataId),g;f.dtype!=="float32"&&(g=em({backend:t,inputs:{x:r},attrs:{dtype:"float32"}}),f=t.dataIdMap.get(g.dataId));let y=f.id,A=t.makeOutput(m,"float32");if(k.sizeFromShape(r.shape)===0)return A;let x=t.dataIdMap.get(A.dataId).id;return XC(y,d,h,p,c,l,u,s?1:0,i?1:0,x),g!=null&&t.disposeData(g.dataId),A}var g3e={kernelName:Tl,backendName:"wasm",setupFunc:f3e,kernelFunc:m3e},ZC;function y3e(e){ZC=e.wasm.cwrap(Cl,null,["number","array","number","array","number","number"])}function A3e(e){let{inputs:t,backend:n,attrs:a}=e,{x:r}=t,{dims:s}=a,i=k.parseAxisParam(s,r.shape);if(r.shape.length===0)return J0({inputs:{x:r},backend:n});let o=n.makeOutput(r.shape,r.dtype),l=n.dataIdMap.get(r.dataId).id,u=n.dataIdMap.get(o.dataId).id,d=new Uint8Array(new Int32Array(i).buffer),h=new Uint8Array(new Int32Array(r.shape).buffer);ZC(l,d,i.length,h,r.shape.length,u);let p=yr({inputs:{x:o},attrs:{shape:r.shape},backend:n});return n.disposeData(o.dataId),p}var x3e={kernelName:Cl,backendName:"wasm",kernelFunc:A3e,setupFunc:y3e},YC;function b3e(e){YC=e.wasm.cwrap(ch,null,["number","number","number","number","number","number","number","number","array","number","number"])}function v3e(e){let{inputs:t,backend:n,attrs:a}=e,{image:r}=t,{radians:s,fillValue:i,center:o}=a,l=n.makeOutput(r.shape,r.dtype),u=n.dataIdMap.get(r.dataId).id,d=n.dataIdMap.get(l.dataId).id,[h,p,c,m]=r.shape,[f,g]=M.getImageCenter(o,p,c),y=i===0,A=255,x=typeof i=="number"?[i,i,i,y?0:A]:[...i,A],v=new Uint8Array(new Int32Array(x).buffer);return YC(u,h,p,c,m,s,f,g,v,x.length,d),l}var w3e={kernelName:ch,backendName:"wasm",kernelFunc:v3e,setupFunc:b3e},k3e=Un(Ml),I3e=Un(Di),JC;function S3e(e){JC=e.wasm.cwrap(eh,null,["number","number","number","number","number","number","array","number","number"])}function N3e(e){let{backend:t,inputs:n,attrs:a}=e,{indices:r,updates:s}=n,{shape:i}=a,o=t.makeOutput(i,s.dtype);if(k.sizeFromShape(i)===0)return o;let{sliceRank:l,numUpdates:u,sliceSize:d,strides:h,outputSize:p}=T4.calculateShapes(s,r,i),c=t.dataIdMap.get(r.dataId).id,m=t.dataIdMap.get(s.dataId).id,f=new Uint8Array(new Int32Array(h).buffer),g=t.dataIdMap.get(o.dataId).id;return JC(c,m,na[s.dtype],l,u,d,f,p,g),o}var T3e={kernelName:eh,backendName:"wasm",setupFunc:S3e,kernelFunc:N3e},QC;function E3e(e){QC=e.wasm.cwrap("SelectV2",null,["number","number","number","number","number"])}function C3e(e){let{inputs:t,backend:n}=e,{condition:a,t:r,e:s}=t,i=n.dataIdMap.get(a.dataId).id,o=n.dataIdMap.get(r.dataId).id,l=n.dataIdMap.get(s.dataId).id,u=n.makeOutput(r.shape,r.dtype),d=n.dataIdMap.get(u.dataId).id,h=a.shape.length,p=r.shape.length,c=h===0||h>1||p===1?1:k.sizeFromShape(r.shape.slice(1));return QC(i,o,l,c,d),u}var M3e={kernelName:th,backendName:"wasm",kernelFunc:C3e,setupFunc:E3e},eM;function $3e(e){eM=e.wasm.cwrap(Rl,null,["number","number"])}function R3e(e){let{backend:t,inputs:{x:n}}=e,a=t.dataIdMap.get(n.dataId).id,r=t.makeOutput(n.shape,n.dtype),s=t.dataIdMap.get(r.dataId).id;return k.sizeFromShape(r.shape)===0||eM(a,s),r}var F3e={kernelName:"Sigmoid",backendName:"wasm",setupFunc:$3e,kernelFunc:R3e},O3e=Un($l);function tm(e){let{inputs:{x:t},attrs:{begin:n,size:a},backend:r}=e,[s,i]=Cn.parseSliceParams(t,n,a),o=Cn.isSliceContinous(t.shape,s,i),l=r.readSync(t.dataId),u=r.makeOutput(i,t.dtype),d=k.computeStrides(t.shape),h=r.dataIdMap.get(u.dataId);if(o){let m=Cn.computeFlatOffset(s,d);return t.dtype==="string"?h.stringBytes=l.slice(m,m+k.sizeFromShape(i)):r.typedArrayFromHeap(u).set(l.subarray(m,m+k.sizeFromShape(i))),u}if(t.dtype==="string"){let m=rb(l,s,i,t.shape,t.dtype);return h.stringBytes=m,u}let p=r.typedArrayFromHeap(u),c=t.shape.length;if(c===2)D3e(l,d[0],p,s,i);else if(c===3)_3e(l,d[0],d[1],p,s,i);else if(c===4)z3e(l,d[0],d[1],d[2],p,s,i);else{let m=rb(l,s,i,t.shape,t.dtype);p.set(m)}return u}function D3e(e,t,n,a,r){let s=0,i=a[0],o=a[1],l=i+r[0];for(let u=i;u{let p=[...d];p[o]=h;let c=tm({inputs:{x:r},attrs:{begin:u,size:p},backend:a});return u[o]+=h,c})}var U3e={kernelName:oh,backendName:"wasm",kernelFunc:V3e},j3e=Un(Fl),H3e=Un(lf),G3e=!0,q3e=jn(_i,G3e),nM;function K3e(e){nM=e.wasm.cwrap(Li,null,["number","number","number"])}function X3e(e){let{backend:t,inputs:n,attrs:a}=e,{alpha:r}=a,{x:s}=n,i=t.dataIdMap.get(s.dataId).id,o=t.makeOutput(s.shape,s.dtype),l=t.dataIdMap.get(o.dataId).id;return nM(i,r,l),o}var Z3e={kernelName:Li,backendName:"wasm",setupFunc:K3e,kernelFunc:X3e},aM;function Y3e(e){aM=e.wasm.cwrap(lh,null,["number","array","number","array","array","array","array","array","number","number"])}function J3e(e){let{backend:t,inputs:n,attrs:a}=e,{x:r}=n,{begin:s,end:i,strides:o}=a;o==null&&(o=new Array(s.length));let{beginMask:l,endMask:u,ellipsisMask:d,newAxisMask:h,shrinkAxisMask:p}=a,c=M.slice_util.maskToAxes(d);if(c.length>1)throw new Error("Multiple ellipses in slice is not allowed.");if(d!==0&&h!==0)throw new Error("Using both ellipsisMask and newAxisMask is not yet supported.");if(d!==0&&p!==0)throw new Error("Using both ellipsisMask and shrinkAxisMask is not yet supported.");let m=r.shape.length-s.length,f=M.slice_util.maskToAxes(h),g=r.shape.slice();f.forEach(z=>{s[z]=0,i[z]=1,g.splice(z,0,1)});let y=yr({inputs:{x:r},attrs:{shape:g},backend:t}),{begin:A,end:x,strides:v}=M.slice_util.getNormalizedAxes(y.shape,c,m,s,i,o,l,u,d);s=A,i=x,o=v;let b=M.slice_util.maskToAxes(p);b.forEach(z=>{i[z]=s[z]+1,o[z]=1});let w=M.slice_util.computeOutShape(s,i,o),I=w.filter((z,$)=>b.indexOf($)===-1);if(o.every(z=>z===1)){let z=tm({inputs:{x:y},attrs:{begin:s,size:w},backend:t});t.disposeData(y.dataId);let $=yr({inputs:{x:z},attrs:{shape:I},backend:t});return t.disposeData(z.dataId),$}let T=t.makeOutput(I,"float32");if(!I.some(z=>z===0)){let z=t.dataIdMap.get(y.dataId).id,$=new Uint8Array(new Int32Array(k.computeStrides(y.shape)).buffer),S=new Uint8Array(new Int32Array(s).buffer),D=new Uint8Array(new Int32Array(i).buffer),_=new Uint8Array(new Int32Array(o).buffer),W=new Uint8Array(new Int32Array(I).buffer),X=new Uint8Array(new Int32Array(k.computeStrides(I)).buffer),q=t.dataIdMap.get(T.dataId).id;aM(z,$,y.shape.length,S,D,_,W,X,I.length,q)}t.disposeData(y.dataId);let C=yr({inputs:{x:T},attrs:{shape:I},backend:t});return t.disposeData(T.dataId),C}var Q3e={kernelName:lh,backendName:"wasm",setupFunc:Y3e,kernelFunc:J3e},eve=!0,tve=jn(zi,eve),rM;function nve(e){rM=e.wasm.cwrap(Ol,null,["number, number, number"])}function ave(e){let{backend:t,inputs:n,attrs:a}=e,{axis:r,keepDims:s}=a,{x:i}=n,o=t.dataIdMap.get(i.dataId).id,l=o,u=i,{transposed:d,axes:h,originalAxes:p,inputWasTransposed:c}=ti(i,r,t),m=h;if(c){let x=t.dataIdMap.get(d.dataId).id;x!==o&&(u=d,l=x,m=M.getInnerMostAxes(m.length,u.shape.length))}M.assertAxesAreInnerMostDims("sum",m,u.shape.length);let[f,g]=M.computeOutAndReduceShapes(u.shape,m),y=k.sizeFromShape(g),A=t.makeOutput(f,u.dtype);if(k.sizeFromShape(u.shape)!==0){let x=t.dataIdMap.get(A.dataId).id;rM(l,y,x)}if(c&&t.disposeData(d.dataId),s){let x=M.expandShapeToKeepDim(A.shape,p);A.shape=x}return A}var rve={kernelName:Ol,backendName:"wasm",setupFunc:nve,kernelFunc:ave},sve=Un(_l),ive=Un(zl),sM;function ove(e){sM=e.wasm.cwrap(Pi,null,["number","array","number","array","number","number"])}function lve(e){let{inputs:t,backend:n,attrs:a}=e,{x:r}=t,s=n.dataIdMap.get(r.dataId).id,{reps:i}=a,o=new Array(r.shape.length);for(let p=0;p{let{x:a}=e,{k:r,sorted:s}=n,i=t.dataIdMap.get(a.dataId).id,o=new Uint8Array(new Int32Array(a.shape).buffer),l=a.shape.slice();l[l.length-1]=r;let u=t.makeOutput(l,a.dtype),d=t.dataIdMap.get(u.dataId).id,h=t.makeOutput(l,"int32"),p=t.dataIdMap.get(h.dataId).id;return iM(i,o,a.shape.length,na[a.dtype],r,s,d,p),[u,h]},pve={kernelName:uh,backendName:"wasm",setupFunc:dve,kernelFunc:hve},oM;function cve(e){oM=e.wasm.cwrap(dh,null,["number","number","bool","number","number","number","number","number","number","array","number","number","number","number","number"])}function fve(e){let{backend:t,inputs:n,attrs:a}=e,{image:r,transforms:s}=n,{interpolation:i,fillMode:o,fillValue:l,outputShape:u}=a,[d,h,p,c]=r.shape,[m,f]=u!=null?u:[h,p],g=[d,m,f,c],y=new Uint8Array(new Int32Array(k.computeStrides(r.shape)).buffer),A=t.makeOutput(g,r.dtype),x=t.dataIdMap.get(A.dataId).id,v=t.dataIdMap.get(r.dataId).id,b=t.dataIdMap.get(s.dataId).id,w=i==="nearest"?1:2,I;switch(o){case"constant":I=1;break;case"reflect":I=2;break;case"wrap":I=3;break;case"nearest":I=4;break;default:I=1;break}return oM(v,b,s.shape[0]>1,d,m,f,c,p,h,y,r.shape.length-1,w,I,l,x),A}var mve={kernelName:dh,backendName:"wasm",setupFunc:cve,kernelFunc:fve};function gve(e){let{inputs:t,backend:n,attrs:a}=e,{value:r}=t,{axis:s}=a;s<0&&(s+=r.shape.length);let i=r.shape[s],o=r.shape.length,l=new Array(o-1),u=0;for(let c=0;c({dataId:c,dtype:m,shape:l}))}var yve={kernelName:hh,backendName:"wasm",kernelFunc:gve};function Ave(e){let{inputs:{x:t},backend:n}=e,a=n.makeOutput(t.shape,t.dtype);return n.typedArrayFromHeap(a).fill(0),a}var xve={kernelName:ph,backendName:"wasm",kernelFunc:Ave},bve=[Nxe,Exe,$xe,Lxe,Vxe,Hxe,Kxe,Jxe,Qxe,e5e,a5e,r5e,o5e,d5e,h5e,f5e,y5e,b5e,k5e,S5e,N5e,T5e,C5e,R5e,F5e,D5e,Sxe,P5e,B5e,j5e,q5e,Z5e,J5e,ebe,Rxe,abe,sbe,obe,lbe,dbe,cbe,mbe,Abe,vbe,Ibe,Nbe,Cbe,$be,Rbe,Dbe,Pbe,Bbe,Ube,Gbe,Kbe,Zbe,Qbe,t3e,r3e,o3e,u3e,h3e,p3e,c3e,Xxe,g3e,x3e,w3e,I3e,k3e,T3e,M3e,F3e,O3e,P3e,B3e,U3e,j3e,H3e,q3e,Z3e,Q3e,tve,rve,sve,ive,uve,pve,mve,_xe,yve,xve];for(let e of bve)sA(e);var yb=se();yb.registerFlag("WASM_HAS_SIMD_SUPPORT",async()=>WebAssembly.validate(new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,2,1,0,10,9,1,7,0,65,0,253,15,26,11])));yb.registerFlag("WASM_HAS_MULTITHREAD_SUPPORT",async()=>{if(yb.get("IS_NODE"))return!1;try{return new MessageChannel().port1.postMessage(new SharedArrayBuffer(1)),WebAssembly.validate(new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,2,1,0,5,4,1,3,1,1,10,11,1,9,0,65,0,254,16,2,0,26,11]))}catch(e){return!1}});var lM=qr(IR()),vve='var Module={};function threadPrintErr(){var text=Array.prototype.slice.call(arguments).join(" ");console.error(text)}function threadAlert(){var text=Array.prototype.slice.call(arguments).join(" ");postMessage({cmd:"alert",text:text,threadId:Module["_pthread_self"]()})}var err=threadPrintErr;this.alert=threadAlert;Module["instantiateWasm"]=function(info,receiveInstance){var instance=new WebAssembly.Instance(Module["wasmModule"],info);Module["wasmModule"]=null;receiveInstance(instance);return instance.exports};function moduleLoaded(){}this.onmessage=function(e){try{if(e.data.cmd==="load"){Module["wasmModule"]=e.data.wasmModule;Module["wasmMemory"]=e.data.wasmMemory;Module["buffer"]=Module["wasmMemory"].buffer;Module["ENVIRONMENT_IS_PTHREAD"]=true;if(typeof e.data.urlOrBlob==="string"){importScripts(e.data.urlOrBlob)}else{var objectUrl=URL.createObjectURL(e.data.urlOrBlob);importScripts(objectUrl);URL.revokeObjectURL(objectUrl)}WasmBackendModuleThreadedSimd(Module).then(function(instance){Module=instance;moduleLoaded()})}else if(e.data.cmd==="objectTransfer"){Module["PThread"].receiveObjectTransfer(e.data)}else if(e.data.cmd==="run"){Module["__performance_now_clock_drift"]=performance.now()-e.data.time;Module["__emscripten_thread_init"](e.data.threadInfoStruct,0,0);var max=e.data.stackBase;var top=e.data.stackBase+e.data.stackSize;Module["establishStackSpace"](top,max);Module["_emscripten_tls_init"]();Module["PThread"].receiveObjectTransfer(e.data);Module["PThread"].setThreadStatus(Module["_pthread_self"](),1);try{var result=Module["invokeEntryPoint"](e.data.start_routine,e.data.arg);if(!Module["getNoExitRuntime"]())Module["PThread"].threadExit(result)}catch(ex){if(ex==="Canceled!"){Module["PThread"].threadCancel()}else if(ex!="unwind"){if(ex instanceof Module["ExitStatus"]){if(Module["getNoExitRuntime"]()){}else{Module["PThread"].threadExit(ex.status)}}else{Module["PThread"].threadExit(-2);throw ex}}}}else if(e.data.cmd==="cancel"){if(Module["_pthread_self"]()){Module["PThread"].threadCancel()}}else if(e.data.target==="setimmediate"){}else if(e.data.cmd==="processThreadQueue"){if(Module["_pthread_self"]()){Module["_emscripten_current_thread_process_queued_calls"]()}}else{err("worker.js received unknown command "+e.data.cmd);err(e.data)}}catch(ex){err("worker.js onmessage() captured an uncaught exception: "+ex);if(ex&&ex.stack)err(ex.stack);throw ex}};if(typeof process==="object"&&typeof process.versions==="object"&&typeof process.versions.node==="string"){self={location:{href:__filename}};var onmessage=this.onmessage;var nodeWorkerThreads=require("worker_threads");global.Worker=nodeWorkerThreads.Worker;var parentPort=nodeWorkerThreads.parentPort;parentPort.on("message",function(data){onmessage({data:data})});var nodeFS=require("fs");var nodeRead=function(filename){return nodeFS.readFileSync(filename,"utf8")};function globalEval(x){global.require=require;global.Module=Module;eval.call(null,x)}importScripts=function(f){globalEval(nodeRead(f))};postMessage=function(msg){parentPort.postMessage(msg)};if(typeof performance==="undefined"){performance={now:function(){return Date.now()}}}}',wve=qr(SR()),uM=class extends Wc{constructor(e){super();this.wasm=e,this.dataIdNextNumber=1,this.wasm.tfjs.init(),this.dataIdMap=new c1(this,Ps())}write(e,t,n){let a={id:this.dataIdNextNumber++};return this.move(a,e,t,n,1),a}numDataIds(){return this.dataIdMap.numDataIds()}async time(e){let t=k.now();return e(),{kernelMs:k.now()-t}}move(e,t,n,a,r){let s=this.dataIdNextNumber++;if(a==="string"){let u=t;this.dataIdMap.set(e,{id:s,stringBytes:u,shape:n,dtype:a,memoryOffset:null,refCount:r});return}let i=k.sizeFromShape(n),o=i*k.bytesPerElement(a),l=this.wasm._malloc(o);this.dataIdMap.set(e,{id:s,memoryOffset:l,shape:n,dtype:a,refCount:r}),this.wasm.tfjs.registerTensor(s,i,l),t!=null&&this.wasm.HEAPU8.set(new Uint8Array(t.buffer,t.byteOffset,o),l)}async read(e){return this.readSync(e)}readSync(e){let{memoryOffset:t,dtype:n,shape:a,stringBytes:r}=this.dataIdMap.get(e);if(n==="string")return r;let s=this.wasm.HEAPU8.slice(t,t+k.sizeFromShape(a)*k.bytesPerElement(n));return Sve(s.buffer,n)}disposeData(e,t=!1){if(this.dataIdMap.has(e)){let n=this.dataIdMap.get(e);if(n.refCount--,!t&&n.refCount>0)return!1;this.wasm._free(n.memoryOffset),this.wasm.tfjs.disposeData(n.id),this.dataIdMap.delete(e)}return!0}refCount(e){return this.dataIdMap.has(e)?this.dataIdMap.get(e).refCount:0}incRef(e){let t=this.dataIdMap.get(e);t!=null&&t.refCount++}floatPrecision(){return 32}getMemoryOffset(e){return this.dataIdMap.get(e).memoryOffset}dispose(){this.wasm.tfjs.dispose(),"PThread"in this.wasm&&this.wasm.PThread.terminateAllThreads(),this.wasm=null}memory(){return{unreliable:!1}}makeOutput(e,t,n){let a;if(n==null)a=this.write(null,e,t);else{let r=this.dataIdNextNumber++;a={id:r},this.dataIdMap.set(a,{id:r,memoryOffset:n,shape:e,dtype:t,refCount:1});let s=k.sizeFromShape(e);this.wasm.tfjs.registerTensor(r,s,n)}return{dataId:a,shape:e,dtype:t}}typedArrayFromHeap({shape:e,dtype:t,dataId:n}){let a=this.wasm.HEAPU8.buffer,{memoryOffset:r}=this.dataIdMap.get(n),s=k.sizeFromShape(e);switch(t){case"float32":return new Float32Array(a,r,s);case"int32":return new Int32Array(a,r,s);case"bool":return new Uint8Array(a,r,s);default:throw new Error(`Unknown dtype ${t}`)}}};function kve(e){return(t,n)=>(k.fetch(e,{credentials:"same-origin"}).then(a=>{a.ok||t.env.a(`failed to load wasm binary file at '${e}'`),a.arrayBuffer().then(r=>{WebAssembly.instantiate(r,t).then(s=>{n(s.instance,s.module)})})}),{})}function dM(e,t,n){if(nm!=null)return nm;let a="tfjs-backend-wasm.wasm";return e&&t?a="tfjs-backend-wasm-threaded-simd.wasm":e&&(a="tfjs-backend-wasm-simd.wasm"),Ap!=null&&Ap[a]!=null?Ap[a]:n+a}async function Ive(){let[e,t]=await Promise.all([se().getAsync("WASM_HAS_SIMD_SUPPORT"),se().getAsync("WASM_HAS_MULTITHREAD_SUPPORT")]);return new Promise((n,a)=>{let r={};r.locateFile=(o,l)=>{if(o.endsWith(".worker.js")){let u=vve,d=new Blob([u],{type:"application/javascript"});return URL.createObjectURL(d)}return o.endsWith(".wasm")?dM(e,t,yp!=null?yp:l):l+o},Ab&&(r.instantiateWasm=kve(dM(e,t,yp!=null?yp:"")));let s=!1;r.onAbort=()=>{s||xp||(xp=!0,a({message:"Make sure the server can serve the `.wasm` file relative to the bundled js file. For more details see https://github.com/tensorflow/tfjs/blob/master/tfjs-backend-wasm/README.md#using-bundlers"}))};let i;t&&e&&nm==null?(r.mainScriptUrlOrBlob=new Blob(["var WasmBackendModuleThreadedSimd = "+lM.default.toString()],{type:"text/javascript"}),i=(0,lM.default)(r)):i=(0,wve.default)(r),i.then(o=>{s=!0,xp=!1;let l=null;o.tfjs={init:o.cwrap("init",null,[]),registerTensor:o.cwrap("register_tensor",null,["number","number","number"]),disposeData:o.cwrap("dispose_data",l,["number"]),dispose:o.cwrap("dispose",l,[])},n({wasm:o})})})}function Sve(e,t){switch(t){case"float32":return new Float32Array(e);case"int32":return new Int32Array(e);case"bool":return new Uint8Array(e);default:throw new Error(`Unknown dtype ${t}`)}}var Nve=["tfjs-backend-wasm.wasm","tfjs-backend-wasm-simd.wasm","tfjs-backend-wasm-threaded-simd.wasm"],nm=null,yp=null,Ap={},xp=!1,Ab=!1;function Tve(e,t=!1){if(B4("setWasmPath has been deprecated in favor of setWasmPaths and will be removed in a future release."),xp)throw new Error("The WASM backend was already initialized. Make sure you call `setWasmPath()` before you call `tf.setBackend()` or `tf.ready()`");nm=e,Ab=t}function Eve(e,t=!1){if(xp)throw new Error("The WASM backend was already initialized. Make sure you call `setWasmPaths()` before you call `tf.setBackend()` or `tf.ready()`");if(typeof e=="string")yp=e;else{Ap=e;let n=Nve.filter(a=>Ap[a]==null);if(n.length>0)throw new Error(`There were no entries found for the following binaries: ${n.join(",")}. Please either call setWasmPaths with a map providing a path for each binary, or with a string indicating the directory where all the binaries can be found.`)}Ab=t}var Cve="3.7.0",Mve=2;CA("wasm",async()=>{let{wasm:e}=await Ive();return new uM(e)},Mve);var $ve={tfjs:NR,"tfjs-core":TR,"tfjs-data":ER,"tfjs-layers":CR,"tfjs-converter":MR,"tfjs-backend-cpu":$R,"tfjs-backend-webgl":RR,"tfjs-backend-wasm":FR};var ma={name:"humangl",priority:99,canvas:null,gl:null,width:1024,height:1024,webGLattr:{alpha:!1,antialias:!1,premultipliedAlpha:!1,preserveDrawingBuffer:!1,depth:!1,stencil:!1,failIfMajorPerformanceCaveat:!1,desynchronized:!0}};function hM(){if(!Gy(ma.name)){ge("backend registration:",ma.name);try{ma.canvas=typeof OffscreenCanvas!="undefined"?new OffscreenCanvas(ma.width,ma.height):document.createElement("canvas")}catch(e){ge("error: cannot create canvas:",e);return}try{ma.gl=ma.canvas.getContext("webgl2",ma.webGLattr)}catch(e){ge("error: cannot get WebGL2 context:",e);return}try{F0(2,ma.gl)}catch(e){ge("error: cannot set WebGL2 context:",e);return}try{let e=new W0(ma.gl);qy(ma.name,()=>new hp(e),ma.priority)}catch(e){ge("error: cannot register WebGL backend:",e);return}try{Lo("webgl").forEach(t=>{let n={...t,backendName:ma.name};rc(n)})}catch(e){ge("error: cannot update WebGL backend registration:",e);return}try{ka.set("WEBGL_VERSION",2)}catch(e){ge("error: cannot set WebGL backend flags:",e);return}ge("backend registered:",ma.name)}}function pM(e,t){let n=[e.startPoint[0]*t[0],e.startPoint[1]*t[1]],a=[e.endPoint[0]*t[0],e.endPoint[1]*t[1]];return{startPoint:n,endPoint:a}}function vp(e){return[Math.abs(e.endPoint[0]-e.startPoint[0]),Math.abs(e.endPoint[1]-e.startPoint[1])]}function Nu(e){return[e.startPoint[0]+(e.endPoint[0]-e.startPoint[0])/2,e.startPoint[1]+(e.endPoint[1]-e.startPoint[1])/2]}function Tu(e,t,n){let a=t.shape[1],r=t.shape[2],s=[[e.startPoint[1]/a,e.startPoint[0]/r,e.endPoint[1]/a,e.endPoint[0]/r]];return Ye.cropAndResize(t,s,[0],n)}function am(e,t=1.5){let n=Nu(e),a=vp(e),r=[t*a[0]/2,t*a[1]/2],s=[n[0]-r[0],n[1]-r[1]],i=[n[0]+r[0],n[1]+r[1]];return{startPoint:s,endPoint:i,landmarks:e.landmarks}}function rm(e){let t=Nu(e),n=vp(e),r=Math.max(...n)/2,s=[Math.round(t[0]-r),Math.round(t[1]-r)],i=[Math.round(t[0]+r),Math.round(t[1]+r)];return{startPoint:s,endPoint:i,landmarks:e.landmarks}}function xb(e){let t=e.map(s=>s[0]),n=e.map(s=>s[1]),a=[Math.min(...t),Math.min(...n)],r=[Math.max(...t),Math.max(...n)];return{startPoint:a,endPoint:r,landmarks:e}}var cM=e=>({startPoint:Ze(e,[0,0],[-1,2]),endPoint:Ze(e,[0,2],[-1,2])});var sm=[[1,0,0],[0,1,0],[0,0,1]];function Rve(e){return e-2*Math.PI*Math.floor((e+Math.PI)/(2*Math.PI))}function bb(e,t){let n=Math.PI/2-Math.atan2(-(t[1]-e[1]),t[0]-e[0]);return Rve(n)}function fM(e,t){return[[1,0,e],[0,1,t],[0,0,1]]}function ni(e,t){let n=0;for(let a=0;a{let u=Ye.resizeBilinear(t,[this.inputSize,this.inputSize]).div(127.5).sub(.5),d=this.model.execute(u),h;if(Array.isArray(d)){let f=d.sort((x,v)=>x.size-v.size),g=sn([f[0],f[2]],2),y=sn([f[1],f[3]],2);h=sn([y,g],1).squeeze(0)}else h=Yn(d);let p=Ove(h,this.anchors,[this.inputSize,this.inputSize]),c=Ze(h,[0,0],[-1,1]),m=Sr(c).squeeze().dataSync();return[h,p,m]}),s=await Ye.nonMaxSuppressionAsync(a,r,this.config.face.detector.maxDetected,this.config.face.detector.iouThreshold,this.config.face.detector.minConfidence),i=s.arraySync();s.dispose();let o=[];for(let l=0;lthis.config.face.detector.minConfidence){let d=Ze(a,[i[l],0],[1,-1]),h=cM(d);d.dispose();let p=this.anchorsData[i[l]],c=Ue(()=>Ze(n,[i[l],xM-1],[1,-1]).squeeze().reshape([xM,-1]));o.push({box:h,landmarks:c,anchor:p,confidence:u})}}return n.dispose(),a.dispose(),{boxes:o,scaleFactor:[t.shape[2]/this.inputSize,t.shape[1]/this.inputSize]}}};async function vM(e){let t=await Et(Mt(e.modelBasePath,e.face.detector.modelPath),{fromTFHub:e.face.detector.modelPath.includes("tfhub.dev")}),n=new bM(t,e);return!t||!t.modelUrl?ge("load model failed:",e.face.detector.modelPath):e.debug&&ge("load model:",t.modelUrl),n}var Lr={silhouette:[10,338,297,332,284,251,389,356,454,323,361,288,397,365,379,378,400,377,152,148,176,149,150,136,172,58,132,93,234,127,162,21,54,103,67,109],lipsUpperOuter:[61,185,40,39,37,0,267,269,270,409,291],lipsLowerOuter:[146,91,181,84,17,314,405,321,375,291],lipsUpperInner:[78,191,80,81,82,13,312,311,310,415,308],lipsLowerInner:[78,95,88,178,87,14,317,402,318,324,308],rightEyeUpper0:[246,161,160,159,158,157,173],rightEyeLower0:[33,7,163,144,145,153,154,155,133],rightEyeUpper1:[247,30,29,27,28,56,190],rightEyeLower1:[130,25,110,24,23,22,26,112,243],rightEyeUpper2:[113,225,224,223,222,221,189],rightEyeLower2:[226,31,228,229,230,231,232,233,244],rightEyeLower3:[143,111,117,118,119,120,121,128,245],rightEyebrowUpper:[156,70,63,105,66,107,55,193],rightEyebrowLower:[35,124,46,53,52,65],rightEyeIris:[473,474,475,476,477],leftEyeUpper0:[466,388,387,386,385,384,398],leftEyeLower0:[263,249,390,373,374,380,381,382,362],leftEyeUpper1:[467,260,259,257,258,286,414],leftEyeLower1:[359,255,339,254,253,252,256,341,463],leftEyeUpper2:[342,445,444,443,442,441,413],leftEyeLower2:[446,261,448,449,450,451,452,453,464],leftEyeLower3:[372,340,346,347,348,349,350,357,465],leftEyebrowUpper:[383,300,293,334,296,336,285,417],leftEyebrowLower:[265,353,276,283,282,295],leftEyeIris:[468,469,470,471,472],midwayBetweenEyes:[168],noseTip:[1],noseBottom:[2],noseRightCorner:[98],noseLeftCorner:[327],rightCheek:[205],leftCheek:[425]},vb=[{key:"EyeUpper0",indices:[9,10,11,12,13,14,15]},{key:"EyeUpper1",indices:[25,26,27,28,29,30,31]},{key:"EyeUpper2",indices:[41,42,43,44,45,46,47]},{key:"EyeLower0",indices:[0,1,2,3,4,5,6,7,8]},{key:"EyeLower1",indices:[16,17,18,19,20,21,22,23,24]},{key:"EyeLower2",indices:[32,33,34,35,36,37,38,39,40]},{key:"EyeLower3",indices:[54,55,56,57,58,59,60,61,62]}],wp=[[.499976992607117,.652534008026123],[.500025987625122,.547487020492554],[.499974012374878,.602371990680695],[.482113003730774,.471979022026062],[.500150978565216,.527155995368958],[.499909996986389,.498252987861633],[.499523013830185,.40106201171875],[.289712011814117,.380764007568359],[.499954998493195,.312398016452789],[.499987006187439,.269918978214264],[.500023007392883,.107050001621246],[.500023007392883,.666234016418457],[.5000159740448,.679224014282227],[.500023007392883,.692348003387451],[.499976992607117,.695277988910675],[.499976992607117,.70593398809433],[.499976992607117,.719385027885437],[.499976992607117,.737019002437592],[.499967992305756,.781370997428894],[.499816000461578,.562981009483337],[.473773002624512,.573909997940063],[.104906998574734,.254140973091125],[.365929991006851,.409575998783112],[.338757991790771,.41302502155304],[.311120003461838,.409460008144379],[.274657994508743,.389131009578705],[.393361985683441,.403706014156342],[.345234006643295,.344011008739471],[.370094001293182,.346076011657715],[.319321990013123,.347265005111694],[.297903001308441,.353591024875641],[.24779200553894,.410809993743896],[.396889001131058,.842755019664764],[.280097991228104,.375599980354309],[.106310002505779,.399955987930298],[.2099249958992,.391353011131287],[.355807989835739,.534406006336212],[.471751004457474,.65040397644043],[.474155008792877,.680191993713379],[.439785003662109,.657229006290436],[.414617002010345,.66654098033905],[.450374007225037,.680860996246338],[.428770989179611,.682690978050232],[.374971002340317,.727805018424988],[.486716985702515,.547628998756409],[.485300987958908,.527395009994507],[.257764995098114,.314490020275116],[.401223003864288,.455172002315521],[.429818987846375,.548614978790283],[.421351999044418,.533740997314453],[.276895999908447,.532056987285614],[.483370006084442,.499586999416351],[.33721199631691,.282882988452911],[.296391993761063,.293242990970612],[.169294998049736,.193813979625702],[.447580009698868,.302609980106354],[.392390012741089,.353887975215912],[.354490011930466,.696784019470215],[.067304998636246,.730105042457581],[.442739009857178,.572826027870178],[.457098007202148,.584792017936707],[.381974011659622,.694710969924927],[.392388999462128,.694203019142151],[.277076005935669,.271932005882263],[.422551989555359,.563233017921448],[.385919004678726,.281364023685455],[.383103013038635,.255840003490448],[.331431001424789,.119714021682739],[.229923993349075,.232002973556519],[.364500999450684,.189113974571228],[.229622006416321,.299540996551514],[.173287004232407,.278747975826263],[.472878992557526,.666198015213013],[.446828007698059,.668527007102966],[.422762006521225,.673889994621277],[.445307999849319,.580065965652466],[.388103008270264,.693961024284363],[.403039008378983,.706539988517761],[.403629004955292,.693953037261963],[.460041999816895,.557139039039612],[.431158006191254,.692366003990173],[.452181994915009,.692366003990173],[.475387006998062,.692366003990173],[.465828001499176,.779190003871918],[.472328990697861,.736225962638855],[.473087012767792,.717857003211975],[.473122000694275,.704625964164734],[.473033010959625,.695277988910675],[.427942007780075,.695277988910675],[.426479011774063,.703539967536926],[.423162013292313,.711845993995667],[.4183090031147,.720062971115112],[.390094995498657,.639572978019714],[.013953999616206,.560034036636353],[.499913990497589,.58014702796936],[.413199990987778,.69539999961853],[.409626007080078,.701822996139526],[.468080013990402,.601534962654114],[.422728985548019,.585985004901886],[.463079988956451,.593783974647522],[.37211999297142,.47341400384903],[.334562003612518,.496073007583618],[.411671012639999,.546965003013611],[.242175996303558,.14767599105835],[.290776997804642,.201445996761322],[.327338010072708,.256527006626129],[.399509996175766,.748921036720276],[.441727995872498,.261676013469696],[.429764986038208,.187834024429321],[.412198007106781,.108901023864746],[.288955003023148,.398952007293701],[.218936994671822,.435410976409912],[.41278201341629,.398970007896423],[.257135003805161,.355440020561218],[.427684992551804,.437960982322693],[.448339998722076,.536936044692993],[.178560003638268,.45755398273468],[.247308000922203,.457193970680237],[.286267012357712,.467674970626831],[.332827985286713,.460712015628815],[.368755996227264,.447206974029541],[.398963987827301,.432654976844788],[.476410001516342,.405806005001068],[.189241006970406,.523923993110657],[.228962004184723,.348950982093811],[.490725994110107,.562400996685028],[.404670000076294,.485132992267609],[.019469000399113,.401564002037048],[.426243007183075,.420431017875671],[.396993011236191,.548797011375427],[.266469985246658,.376977026462555],[.439121007919312,.51895797252655],[.032313998788595,.644356966018677],[.419054001569748,.387154996395111],[.462783008813858,.505746960639954],[.238978996872902,.779744982719421],[.198220998048782,.831938028335571],[.107550002634525,.540755033493042],[.183610007166862,.740257024765015],[.134409993886948,.333683013916016],[.385764002799988,.883153975009918],[.490967005491257,.579378008842468],[.382384985685349,.508572995662689],[.174399003386497,.397670984268188],[.318785011768341,.39623498916626],[.343364000320435,.400596976280212],[.396100014448166,.710216999053955],[.187885001301765,.588537991046906],[.430987000465393,.944064974784851],[.318993002176285,.898285031318665],[.266247987747192,.869701027870178],[.500023007392883,.190576016902924],[.499976992607117,.954452991485596],[.366169989109039,.398822009563446],[.393207013607025,.39553701877594],[.410373002290726,.391080021858215],[.194993004202843,.342101991176605],[.388664990663528,.362284004688263],[.365961998701096,.355970978736877],[.343364000320435,.355356991291046],[.318785011768341,.35834002494812],[.301414996385574,.363156020641327],[.058132998645306,.319076001644135],[.301414996385574,.387449026107788],[.499987989664078,.618434011936188],[.415838003158569,.624195992946625],[.445681989192963,.566076993942261],[.465844005346298,.620640993118286],[.49992299079895,.351523995399475],[.288718998432159,.819945991039276],[.335278987884521,.852819979190826],[.440512001514435,.902418971061707],[.128294005990028,.791940987110138],[.408771991729736,.373893976211548],[.455606997013092,.451801002025604],[.499877005815506,.908990025520325],[.375436991453171,.924192011356354],[.11421000212431,.615022003650665],[.448662012815475,.695277988910675],[.4480200111866,.704632043838501],[.447111994028091,.715808033943176],[.444831997156143,.730794012546539],[.430011987686157,.766808986663818],[.406787008047104,.685672998428345],[.400738000869751,.681069016456604],[.392399996519089,.677703022956848],[.367855995893478,.663918972015381],[.247923001646996,.601333022117615],[.452769994735718,.420849978923798],[.43639200925827,.359887003898621],[.416164010763168,.368713974952698],[.413385987281799,.692366003990173],[.228018000721931,.683571994304657],[.468268007040024,.352671027183533],[.411361992359161,.804327011108398],[.499989002943039,.469825029373169],[.479153990745544,.442654013633728],[.499974012374878,.439637005329132],[.432112008333206,.493588984012604],[.499886006116867,.866917014122009],[.49991300702095,.821729004383087],[.456548988819122,.819200992584229],[.344549000263214,.745438992977142],[.37890899181366,.574010014533997],[.374292999505997,.780184984207153],[.319687992334366,.570737957954407],[.357154995203018,.604269981384277],[.295284003019333,.621580958366394],[.447750002145767,.862477004528046],[.410986006259918,.508723020553589],[.31395098567009,.775308012962341],[.354128003120422,.812552988529205],[.324548006057739,.703992962837219],[.189096003770828,.646299958229065],[.279776990413666,.71465802192688],[.1338230073452,.682700991630554],[.336768001317978,.644733011722565],[.429883986711502,.466521978378296],[.455527991056442,.548622965812683],[.437114000320435,.558896005153656],[.467287987470627,.529924988746643],[.414712011814117,.335219979286194],[.37704598903656,.322777986526489],[.344107985496521,.320150971412659],[.312875986099243,.32233202457428],[.283526003360748,.333190023899078],[.241245999932289,.382785975933075],[.102986000478268,.468762993812561],[.267612010240555,.424560010433197],[.297879010438919,.433175981044769],[.333433985710144,.433878004550934],[.366427004337311,.426115989685059],[.396012008190155,.416696012020111],[.420121014118195,.41022801399231],[.007561000064015,.480777025222778],[.432949006557465,.569517970085144],[.458638995885849,.479089021682739],[.473466008901596,.545744001865387],[.476087987422943,.563830018043518],[.468472003936768,.555056989192963],[.433990985155106,.582361996173859],[.483518004417419,.562983989715576],[.482482999563217,.57784903049469],[.42645001411438,.389798998832703],[.438998997211456,.39649498462677],[.450067013502121,.400434017181396],[.289712011814117,.368252992630005],[.276670008897781,.363372981548309],[.517862021923065,.471948027610779],[.710287988185883,.380764007568359],[.526226997375488,.573909997940063],[.895093023777008,.254140973091125],[.634069979190826,.409575998783112],[.661242008209229,.41302502155304],[.688880026340485,.409460008144379],[.725341975688934,.389131009578705],[.606630027294159,.40370500087738],[.654766023159027,.344011008739471],[.629905998706818,.346076011657715],[.680678009986877,.347265005111694],[.702096998691559,.353591024875641],[.75221198797226,.410804986953735],[.602918028831482,.842862963676453],[.719901978969574,.375599980354309],[.893692970275879,.399959981441498],[.790081977844238,.391354024410248],[.643998026847839,.534487962722778],[.528249025344849,.65040397644043],[.525849997997284,.680191040039062],[.560214996337891,.657229006290436],[.585384011268616,.66654098033905],[.549625992774963,.680860996246338],[.57122802734375,.682691991329193],[.624852001667023,.72809898853302],[.513050019741058,.547281980514526],[.51509702205658,.527251958847046],[.742246985435486,.314507007598877],[.598631024360657,.454979002475739],[.570338010787964,.548575043678284],[.578631997108459,.533622980117798],[.723087012767792,.532054007053375],[.516445994377136,.499638974666595],[.662801027297974,.282917976379395],[.70362401008606,.293271005153656],[.830704987049103,.193813979625702],[.552385985851288,.302568018436432],[.607609987258911,.353887975215912],[.645429015159607,.696707010269165],[.932694971561432,.730105042457581],[.557260990142822,.572826027870178],[.542901992797852,.584792017936707],[.6180260181427,.694710969924927],[.607590973377228,.694203019142151],[.722943007946014,.271963000297546],[.577413976192474,.563166975975037],[.614082992076874,.281386971473694],[.616907000541687,.255886018276215],[.668509006500244,.119913995265961],[.770092010498047,.232020974159241],[.635536015033722,.189248979091644],[.77039098739624,.299556016921997],[.826722025871277,.278755009174347],[.527121007442474,.666198015213013],[.553171992301941,.668527007102966],[.577238023281097,.673889994621277],[.554691970348358,.580065965652466],[.611896991729736,.693961024284363],[.59696102142334,.706539988517761],[.596370995044708,.693953037261963],[.539958000183105,.557139039039612],[.568841993808746,.692366003990173],[.547818005084991,.692366003990173],[.52461302280426,.692366003990173],[.534089982509613,.779141008853912],[.527670979499817,.736225962638855],[.526912987232208,.717857003211975],[.526877999305725,.704625964164734],[.526966989040375,.695277988910675],[.572058022022247,.695277988910675],[.573521018028259,.703539967536926],[.57683801651001,.711845993995667],[.581691026687622,.720062971115112],[.609944999217987,.639909982681274],[.986046016216278,.560034036636353],[.5867999792099,.69539999961853],[.590372025966644,.701822996139526],[.531915009021759,.601536989212036],[.577268004417419,.585934996604919],[.536915004253387,.593786001205444],[.627542972564697,.473352015018463],[.665585994720459,.495950996875763],[.588353991508484,.546862006187439],[.757824003696442,.14767599105835],[.709249973297119,.201507985591888],[.672684013843536,.256581008434296],[.600408971309662,.74900496006012],[.55826598405838,.261672019958496],[.570303976535797,.187870979309082],[.588165998458862,.109044015407562],[.711045026779175,.398952007293701],[.781069993972778,.435405015945435],[.587247014045715,.398931980133057],[.742869973182678,.355445981025696],[.572156012058258,.437651991844177],[.55186802148819,.536570012569427],[.821442008018494,.457556009292603],[.752701997756958,.457181990146637],[.71375697851181,.467626988887787],[.66711300611496,.460672974586487],[.631101012229919,.447153985500336],[.6008620262146,.432473003864288],[.523481011390686,.405627012252808],[.810747981071472,.523926019668579],[.771045982837677,.348959028720856],[.509127020835876,.562718033790588],[.595292985439301,.485023975372314],[.980530977249146,.401564002037048],[.573499977588654,.420000016689301],[.602994978427887,.548687994480133],[.733529984951019,.376977026462555],[.560611009597778,.519016981124878],[.967685997486115,.644356966018677],[.580985009670258,.387160003185272],[.537728011608124,.505385041236877],[.760966002941132,.779752969741821],[.801778972148895,.831938028335571],[.892440974712372,.54076099395752],[.816350996494293,.740260004997253],[.865594983100891,.333687007427216],[.614073991775513,.883246004581451],[.508952975273132,.579437971115112],[.617941975593567,.508316040039062],[.825608015060425,.397674977779388],[.681214988231659,.39623498916626],[.656635999679565,.400596976280212],[.603900015354156,.710216999053955],[.81208598613739,.588539004325867],[.56801301240921,.944564998149872],[.681007981300354,.898285031318665],[.733752012252808,.869701027870178],[.633830010890961,.398822009563446],[.606792986392975,.39553701877594],[.589659988880157,.391062021255493],[.805015981197357,.342108011245728],[.611334979534149,.362284004688263],[.634037971496582,.355970978736877],[.656635999679565,.355356991291046],[.681214988231659,.35834002494812],[.698584973812103,.363156020641327],[.941866993904114,.319076001644135],[.698584973812103,.387449026107788],[.584177017211914,.624107003211975],[.554318010807037,.566076993942261],[.534153997898102,.62064003944397],[.711217999458313,.819975018501282],[.664629995822906,.852871000766754],[.559099972248077,.902631998062134],[.871706008911133,.791940987110138],[.591234028339386,.373893976211548],[.544341027736664,.451583981513977],[.624562978744507,.924192011356354],[.88577002286911,.615028977394104],[.551338016986847,.695277988910675],[.551980018615723,.704632043838501],[.552887976169586,.715808033943176],[.555167973041534,.730794012546539],[.569944024085999,.767035007476807],[.593203008174896,.685675978660583],[.599261999130249,.681069016456604],[.607599973678589,.677703022956848],[.631937980651855,.663500010967255],[.752032995223999,.601315021514893],[.547226011753082,.420395016670227],[.563543975353241,.359827995300293],[.583841025829315,.368713974952698],[.586614012718201,.692366003990173],[.771915018558502,.683578014373779],[.531597018241882,.352482974529266],[.588370978832245,.804440975189209],[.52079701423645,.442565023899078],[.567984998226166,.493479013442993],[.543282985687256,.819254994392395],[.655317008495331,.745514988899231],[.621008992195129,.574018001556396],[.625559985637665,.78031200170517],[.680198013782501,.570719003677368],[.64276397228241,.604337990283966],[.704662978649139,.621529996395111],[.552012026309967,.862591981887817],[.589071989059448,.508637011051178],[.685944974422455,.775357007980347],[.645735025405884,.812640011310577],[.675342977046967,.703978002071381],[.810858011245728,.646304965019226],[.72012197971344,.714666962623596],[.866151988506317,.682704985141754],[.663187026977539,.644596993923187],[.570082008838654,.466325998306274],[.544561982154846,.548375964164734],[.562758982181549,.558784961700439],[.531987011432648,.530140042304993],[.585271000862122,.335177004337311],[.622952997684479,.32277899980545],[.655896008014679,.320163011550903],[.687132000923157,.322345972061157],[.716481983661652,.333200991153717],[.758756995201111,.382786989212036],[.897013008594513,.468769013881683],[.732392013072968,.424547016620636],[.70211398601532,.433162987232208],[.66652500629425,.433866024017334],[.633504986763,.426087975502014],[.603875994682312,.416586995124817],[.579657971858978,.409945011138916],[.992439985275269,.480777025222778],[.567192018032074,.569419980049133],[.54136598110199,.478899002075195],[.526564002037048,.546118021011353],[.523913025856018,.563830018043518],[.531529009342194,.555056989192963],[.566035985946655,.582329034805298],[.51631098985672,.563053965568542],[.5174720287323,.577877044677734],[.573594987392426,.389806985855103],[.560697972774506,.395331978797913],[.549755990505219,.399751007556915],[.710287988185883,.368252992630005],[.723330020904541,.363372981548309]],vo=[127,34,139,11,0,37,232,231,120,72,37,39,128,121,47,232,121,128,104,69,67,175,171,148,157,154,155,118,50,101,73,39,40,9,151,108,48,115,131,194,204,211,74,40,185,80,42,183,40,92,186,230,229,118,202,212,214,83,18,17,76,61,146,160,29,30,56,157,173,106,204,194,135,214,192,203,165,98,21,71,68,51,45,4,144,24,23,77,146,91,205,50,187,201,200,18,91,106,182,90,91,181,85,84,17,206,203,36,148,171,140,92,40,39,193,189,244,159,158,28,247,246,161,236,3,196,54,68,104,193,168,8,117,228,31,189,193,55,98,97,99,126,47,100,166,79,218,155,154,26,209,49,131,135,136,150,47,126,217,223,52,53,45,51,134,211,170,140,67,69,108,43,106,91,230,119,120,226,130,247,63,53,52,238,20,242,46,70,156,78,62,96,46,53,63,143,34,227,173,155,133,123,117,111,44,125,19,236,134,51,216,206,205,154,153,22,39,37,167,200,201,208,36,142,100,57,212,202,20,60,99,28,158,157,35,226,113,160,159,27,204,202,210,113,225,46,43,202,204,62,76,77,137,123,116,41,38,72,203,129,142,64,98,240,49,102,64,41,73,74,212,216,207,42,74,184,169,170,211,170,149,176,105,66,69,122,6,168,123,147,187,96,77,90,65,55,107,89,90,180,101,100,120,63,105,104,93,137,227,15,86,85,129,102,49,14,87,86,55,8,9,100,47,121,145,23,22,88,89,179,6,122,196,88,95,96,138,172,136,215,58,172,115,48,219,42,80,81,195,3,51,43,146,61,171,175,199,81,82,38,53,46,225,144,163,110,246,33,7,52,65,66,229,228,117,34,127,234,107,108,69,109,108,151,48,64,235,62,78,191,129,209,126,111,35,143,163,161,246,117,123,50,222,65,52,19,125,141,221,55,65,3,195,197,25,7,33,220,237,44,70,71,139,122,193,245,247,130,33,71,21,162,153,158,159,170,169,150,188,174,196,216,186,92,144,160,161,2,97,167,141,125,241,164,167,37,72,38,12,145,159,160,38,82,13,63,68,71,226,35,111,158,153,154,101,50,205,206,92,165,209,198,217,165,167,97,220,115,218,133,112,243,239,238,241,214,135,169,190,173,133,171,208,32,125,44,237,86,87,178,85,86,179,84,85,180,83,84,181,201,83,182,137,93,132,76,62,183,61,76,184,57,61,185,212,57,186,214,207,187,34,143,156,79,239,237,123,137,177,44,1,4,201,194,32,64,102,129,213,215,138,59,166,219,242,99,97,2,94,141,75,59,235,24,110,228,25,130,226,23,24,229,22,23,230,26,22,231,112,26,232,189,190,243,221,56,190,28,56,221,27,28,222,29,27,223,30,29,224,247,30,225,238,79,20,166,59,75,60,75,240,147,177,215,20,79,166,187,147,213,112,233,244,233,128,245,128,114,188,114,217,174,131,115,220,217,198,236,198,131,134,177,132,58,143,35,124,110,163,7,228,110,25,356,389,368,11,302,267,452,350,349,302,303,269,357,343,277,452,453,357,333,332,297,175,152,377,384,398,382,347,348,330,303,304,270,9,336,337,278,279,360,418,262,431,304,408,409,310,415,407,270,409,410,450,348,347,422,430,434,313,314,17,306,307,375,387,388,260,286,414,398,335,406,418,364,367,416,423,358,327,251,284,298,281,5,4,373,374,253,307,320,321,425,427,411,421,313,18,321,405,406,320,404,405,315,16,17,426,425,266,377,400,369,322,391,269,417,465,464,386,257,258,466,260,388,456,399,419,284,332,333,417,285,8,346,340,261,413,441,285,327,460,328,355,371,329,392,439,438,382,341,256,429,420,360,364,394,379,277,343,437,443,444,283,275,440,363,431,262,369,297,338,337,273,375,321,450,451,349,446,342,467,293,334,282,458,461,462,276,353,383,308,324,325,276,300,293,372,345,447,382,398,362,352,345,340,274,1,19,456,248,281,436,427,425,381,256,252,269,391,393,200,199,428,266,330,329,287,273,422,250,462,328,258,286,384,265,353,342,387,259,257,424,431,430,342,353,276,273,335,424,292,325,307,366,447,345,271,303,302,423,266,371,294,455,460,279,278,294,271,272,304,432,434,427,272,407,408,394,430,431,395,369,400,334,333,299,351,417,168,352,280,411,325,319,320,295,296,336,319,403,404,330,348,349,293,298,333,323,454,447,15,16,315,358,429,279,14,15,316,285,336,9,329,349,350,374,380,252,318,402,403,6,197,419,318,319,325,367,364,365,435,367,397,344,438,439,272,271,311,195,5,281,273,287,291,396,428,199,311,271,268,283,444,445,373,254,339,263,466,249,282,334,296,449,347,346,264,447,454,336,296,299,338,10,151,278,439,455,292,407,415,358,371,355,340,345,372,390,249,466,346,347,280,442,443,282,19,94,370,441,442,295,248,419,197,263,255,359,440,275,274,300,383,368,351,412,465,263,467,466,301,368,389,380,374,386,395,378,379,412,351,419,436,426,322,373,390,388,2,164,393,370,462,461,164,0,267,302,11,12,374,373,387,268,12,13,293,300,301,446,261,340,385,384,381,330,266,425,426,423,391,429,355,437,391,327,326,440,457,438,341,382,362,459,457,461,434,430,394,414,463,362,396,369,262,354,461,457,316,403,402,315,404,403,314,405,404,313,406,405,421,418,406,366,401,361,306,408,407,291,409,408,287,410,409,432,436,410,434,416,411,264,368,383,309,438,457,352,376,401,274,275,4,421,428,262,294,327,358,433,416,367,289,455,439,462,370,326,2,326,370,305,460,455,254,449,448,255,261,446,253,450,449,252,451,450,256,452,451,341,453,452,413,464,463,441,413,414,258,442,441,257,443,442,259,444,443,260,445,444,467,342,445,459,458,250,289,392,290,290,328,460,376,433,435,250,290,392,411,416,433,341,463,464,453,464,465,357,465,412,343,412,399,360,363,440,437,399,456,420,456,363,401,435,288,372,383,353,339,255,249,448,261,255,133,243,190,133,155,112,33,246,247,33,130,25,398,384,286,362,398,414,362,463,341,263,359,467,263,249,255,466,467,260,75,60,166,238,239,79,162,127,139,72,11,37,121,232,120,73,72,39,114,128,47,233,232,128,103,104,67,152,175,148,173,157,155,119,118,101,74,73,40,107,9,108,49,48,131,32,194,211,184,74,185,191,80,183,185,40,186,119,230,118,210,202,214,84,83,17,77,76,146,161,160,30,190,56,173,182,106,194,138,135,192,129,203,98,54,21,68,5,51,4,145,144,23,90,77,91,207,205,187,83,201,18,181,91,182,180,90,181,16,85,17,205,206,36,176,148,140,165,92,39,245,193,244,27,159,28,30,247,161,174,236,196,103,54,104,55,193,8,111,117,31,221,189,55,240,98,99,142,126,100,219,166,218,112,155,26,198,209,131,169,135,150,114,47,217,224,223,53,220,45,134,32,211,140,109,67,108,146,43,91,231,230,120,113,226,247,105,63,52,241,238,242,124,46,156,95,78,96,70,46,63,116,143,227,116,123,111,1,44,19,3,236,51,207,216,205,26,154,22,165,39,167,199,200,208,101,36,100,43,57,202,242,20,99,56,28,157,124,35,113,29,160,27,211,204,210,124,113,46,106,43,204,96,62,77,227,137,116,73,41,72,36,203,142,235,64,240,48,49,64,42,41,74,214,212,207,183,42,184,210,169,211,140,170,176,104,105,69,193,122,168,50,123,187,89,96,90,66,65,107,179,89,180,119,101,120,68,63,104,234,93,227,16,15,85,209,129,49,15,14,86,107,55,9,120,100,121,153,145,22,178,88,179,197,6,196,89,88,96,135,138,136,138,215,172,218,115,219,41,42,81,5,195,51,57,43,61,208,171,199,41,81,38,224,53,225,24,144,110,105,52,66,118,229,117,227,34,234,66,107,69,10,109,151,219,48,235,183,62,191,142,129,126,116,111,143,7,163,246,118,117,50,223,222,52,94,19,141,222,221,65,196,3,197,45,220,44,156,70,139,188,122,245,139,71,162,145,153,159,149,170,150,122,188,196,206,216,92,163,144,161,164,2,167,242,141,241,0,164,37,11,72,12,144,145,160,12,38,13,70,63,71,31,226,111,157,158,154,36,101,205,203,206,165,126,209,217,98,165,97,237,220,218,237,239,241,210,214,169,140,171,32,241,125,237,179,86,178,180,85,179,181,84,180,182,83,181,194,201,182,177,137,132,184,76,183,185,61,184,186,57,185,216,212,186,192,214,187,139,34,156,218,79,237,147,123,177,45,44,4,208,201,32,98,64,129,192,213,138,235,59,219,141,242,97,97,2,141,240,75,235,229,24,228,31,25,226,230,23,229,231,22,230,232,26,231,233,112,232,244,189,243,189,221,190,222,28,221,223,27,222,224,29,223,225,30,224,113,247,225,99,60,240,213,147,215,60,20,166,192,187,213,243,112,244,244,233,245,245,128,188,188,114,174,134,131,220,174,217,236,236,198,134,215,177,58,156,143,124,25,110,7,31,228,25,264,356,368,0,11,267,451,452,349,267,302,269,350,357,277,350,452,357,299,333,297,396,175,377,381,384,382,280,347,330,269,303,270,151,9,337,344,278,360,424,418,431,270,304,409,272,310,407,322,270,410,449,450,347,432,422,434,18,313,17,291,306,375,259,387,260,424,335,418,434,364,416,391,423,327,301,251,298,275,281,4,254,373,253,375,307,321,280,425,411,200,421,18,335,321,406,321,320,405,314,315,17,423,426,266,396,377,369,270,322,269,413,417,464,385,386,258,248,456,419,298,284,333,168,417,8,448,346,261,417,413,285,326,327,328,277,355,329,309,392,438,381,382,256,279,429,360,365,364,379,355,277,437,282,443,283,281,275,363,395,431,369,299,297,337,335,273,321,348,450,349,359,446,467,283,293,282,250,458,462,300,276,383,292,308,325,283,276,293,264,372,447,346,352,340,354,274,19,363,456,281,426,436,425,380,381,252,267,269,393,421,200,428,371,266,329,432,287,422,290,250,328,385,258,384,446,265,342,386,387,257,422,424,430,445,342,276,422,273,424,306,292,307,352,366,345,268,271,302,358,423,371,327,294,460,331,279,294,303,271,304,436,432,427,304,272,408,395,394,431,378,395,400,296,334,299,6,351,168,376,352,411,307,325,320,285,295,336,320,319,404,329,330,349,334,293,333,366,323,447,316,15,315,331,358,279,317,14,316,8,285,9,277,329,350,253,374,252,319,318,403,351,6,419,324,318,325,397,367,365,288,435,397,278,344,439,310,272,311,248,195,281,375,273,291,175,396,199,312,311,268,276,283,445,390,373,339,295,282,296,448,449,346,356,264,454,337,336,299,337,338,151,294,278,455,308,292,415,429,358,355,265,340,372,388,390,466,352,346,280,295,442,282,354,19,370,285,441,295,195,248,197,457,440,274,301,300,368,417,351,465,251,301,389,385,380,386,394,395,379,399,412,419,410,436,322,387,373,388,326,2,393,354,370,461,393,164,267,268,302,12,386,374,387,312,268,13,298,293,301,265,446,340,380,385,381,280,330,425,322,426,391,420,429,437,393,391,326,344,440,438,458,459,461,364,434,394,428,396,262,274,354,457,317,316,402,316,315,403,315,314,404,314,313,405,313,421,406,323,366,361,292,306,407,306,291,408,291,287,409,287,432,410,427,434,411,372,264,383,459,309,457,366,352,401,1,274,4,418,421,262,331,294,358,435,433,367,392,289,439,328,462,326,94,2,370,289,305,455,339,254,448,359,255,446,254,253,449,253,252,450,252,256,451,256,341,452,414,413,463,286,441,414,286,258,441,258,257,442,257,259,443,259,260,444,260,467,445,309,459,250,305,289,290,305,290,460,401,376,435,309,250,392,376,411,433,453,341,464,357,453,465,343,357,412,437,343,399,344,360,440,420,437,456,360,420,363,361,401,288,265,372,353,390,339,249,339,448,255];var Dve=[127,234,132,58,172,150,149,148,152,377,378,379,397,288,361,454,356,70,63,105,66,107,336,296,334,293,300,168,6,195,4,98,97,2,326,327,33,160,158,133,153,144,362,385,387,263,373,380,57,40,37,0,267,270,287,321,314,17,84,91,78,81,13,311,308,402,14,178],_ve=[33,133,362,263,1,62,308,159,145,386,374,6,102,331,2,13,14,70,105,107,336,334,300,54,10,284,50,280,234,454,58,288,152],zve=[33,133,362,263,1,78,308],g7e=Dve.map(e=>wp[e]),y7e=_ve.map(e=>wp[e]),A7e=zve.map(e=>wp[e]);var wb=Lr.leftEyeLower0,kb=Lr.rightEyeLower0,Eu={leftBounds:[wb[0],wb[wb.length-1]],rightBounds:[kb[0],kb[kb.length-1]]},om={count:468,mouth:13,symmetryLine:[13,Lr.midwayBetweenEyes[0]]},wM={leftEye:0,rightEye:1,nose:2,mouth:3,leftEar:4,rightEar:5,symmetryLine:[3,2]},Cu={upperCenter:3,lowerCenter:4,index:71,numCoordinates:76};function lm(e,t,n,a){for(let r=0;r[s[0]/this.meshSize*(h[0]-this.meshSize/2),s[1]/this.meshSize*(h[1]-this.meshSize/2),h[2]]),o=a!==0?im(a,[0,0]):sm,l=a!==0?i.map(h=>[...yM(h,o),h[2]]):i,u=a!==0?gM(r):sm,d=[...Nu({startPoint:n.startPoint,endPoint:n.endPoint}),1];return l.map(h=>[Math.round(h[0]+ni(d,u[0])),Math.round(h[1]+ni(d,u[1])),Math.round(h[2])])}getLeftToRightEyeDepthDifference(t){let n=t[Eu.leftBounds[0]][2],a=t[Eu.rightBounds[0]][2];return n-a}getEyeBox(t,n,a,r,s=!1){let i=rm(am(xb([t[a],t[r]]),this.irisEnlarge)),o=vp(i),l=Ye.cropAndResize(n,[[i.startPoint[1]/this.meshSize,i.startPoint[0]/this.meshSize,i.endPoint[1]/this.meshSize,i.endPoint[0]/this.meshSize]],[0],[this.irisSize,this.irisSize]);return s&&ka.flags.IS_BROWSER&&(l=Ye.flipLeftRight(l)),{box:i,boxSize:o,crop:l}}getEyeCoords(t,n,a,r=!1){let s=[];for(let i=0;i{let u=i;return l===2?u=r:l===4&&(u=s),[o[0],o[1],u]})}async predict(t,n){let a=!1,r;if((this.skipped===0||this.skipped>n.face.detector.skipFrames||!n.face.mesh.enabled||!n.skipFrame)&&(r=await this.boundingBoxDetector.getBoundingBoxes(t),this.skipped=0),n.skipFrame&&this.skipped++,!n.skipFrame||r&&r.boxes&&(!n.face.mesh.enabled||r.boxes.length!==this.detectedFaces&&this.detectedFaces!==n.face.detector.maxDetected)){this.storedBoxes=[],this.detectedFaces=0;for(let i of r.boxes)this.storedBoxes.push({startPoint:i.box.startPoint.dataSync(),endPoint:i.box.endPoint.dataSync(),landmarks:i.landmarks.arraySync(),confidence:i.confidence});this.storedBoxes.length>0&&(a=!0)}if(a){if(!r||!r.boxes||r.boxes.length===0)return this.storedBoxes=[],this.detectedFaces=0,null;for(let i=0;i{i.box.startPoint.dispose(),i.box.endPoint.dispose(),i.landmarks.dispose()});let s=Ue(()=>this.storedBoxes.map((i,o)=>{let l,u=0,d;if(n.face.detector.rotation&&n.face.mesh.enabled&&ka.flags.IS_BROWSER){let[x,v]=i.landmarks.length>=om.count?om.symmetryLine:wM.symmetryLine;u=bb(i.landmarks[x],i.landmarks[v]);let b=Nu({startPoint:i.startPoint,endPoint:i.endPoint}),w=[b[0]/t.shape[2],b[1]/t.shape[1]],I=Ye.rotateWithOffset(t,u,0,w);d=im(-u,b),n.face.mesh.enabled?l=Tu({startPoint:i.startPoint,endPoint:i.endPoint},I,[this.meshSize,this.meshSize]).div(255):l=Tu({startPoint:i.startPoint,endPoint:i.endPoint},I,[this.boxSize,this.boxSize]).div(255)}else{d=sm;let x=t.clone();n.face.mesh.enabled?l=Tu({startPoint:i.startPoint,endPoint:i.endPoint},x,[this.meshSize,this.meshSize]).div(255):l=Tu({startPoint:i.startPoint,endPoint:i.endPoint},x,[this.boxSize,this.boxSize]).div(255)}if(!n.face.mesh.enabled)return{mesh:[],box:i,faceConfidence:null,boxConfidence:i.confidence,confidence:i.confidence,image:l};let[,h,p]=this.meshDetector.execute(l),c=h.dataSync()[0];if(c=om.count?om.symmetryLine:wM.symmetryLine;u=bb(i.landmarks[x],i.landmarks[v]);let b=Nu({startPoint:i.startPoint,endPoint:i.endPoint}),w=[b[0]/t.shape[2],b[1]/t.shape[1]],I=Ye.rotateWithOffset(t.toFloat(),u,0,w);d=im(-u,b),l=Tu({startPoint:i.startPoint,endPoint:i.endPoint},I,[this.meshSize,this.meshSize]).div(255)}let A={mesh:g,box:i,faceConfidence:c,boxConfidence:i.confidence,image:l};return this.storedBoxes[o]={...rm(i),confidence:i.confidence,faceConfidence:c},A}));return n.face.mesh.enabled&&(this.storedBoxes=this.storedBoxes.filter(i=>i.confidence>n.face.detector.minConfidence)),this.detectedFaces=s.length,s}};var Zt=[null,null,null],Sb;async function kM(e,t){let n=await Sb.predict(e,t),a=[],r=0;for(let s of n||[]){if(!s||s.isDisposedInternal)continue;let i=s.mesh.map(d=>[d[0]/(e.shape[2]||0),d[1]/(e.shape[1]||0),d[2]/Sb.meshSize]),o={};if(s.mesh&&s.mesh.length>0)for(let d of Object.keys(Lr))o[d]=Lr[d].map(h=>s.mesh[h]);let l=s.box?[Math.trunc(Math.max(0,s.box.startPoint[0])),Math.trunc(Math.max(0,s.box.startPoint[1])),Math.trunc(Math.min(e.shape[2]||0,s.box.endPoint[0])-Math.max(0,s.box.startPoint[0])),Math.trunc(Math.min(e.shape[1]||0,s.box.endPoint[1])-Math.max(0,s.box.startPoint[1]))]:[0,0,0,0],u=s.box?[s.box.startPoint[0]/(e.shape[2]||0),s.box.startPoint[1]/(e.shape[1]||0),(s.box.endPoint[0]-s.box.startPoint[0])/(e.shape[2]||0),(s.box.endPoint[1]-s.box.startPoint[1])/(e.shape[1]||0)]:[0,0,0,0];a.push({id:r++,score:Math.round(100*s.faceConfidence||100*s.boxConfidence||0)/100,boxScore:Math.round(100*s.boxConfidence)/100,faceScore:Math.round(100*s.faceConfidence)/100,box:l,boxRaw:u,mesh:s.mesh,meshRaw:i,annotations:o,image:s.image,tensor:s.image}),s.coords&&s.coords.dispose()}return a}async function Nb(e){return!Zt[0]&&e.face.enabled||!Zt[1]&&e.face.mesh.enabled||!Zt[2]&&e.face.iris.enabled?(Zt=await Promise.all([!Zt[0]&&e.face.enabled?vM(e):null,!Zt[1]&&e.face.mesh.enabled?Et(Mt(e.modelBasePath,e.face.mesh.modelPath),{fromTFHub:e.face.mesh.modelPath.includes("tfhub.dev")}):null,!Zt[2]&&e.face.iris.enabled?Et(Mt(e.modelBasePath,e.face.iris.modelPath),{fromTFHub:e.face.iris.modelPath.includes("tfhub.dev")}):null]),e.face.mesh.enabled&&(!Zt[1]||!Zt[1].modelUrl?ge("load model failed:",e.face.mesh.modelPath):e.debug&&ge("load model:",Zt[1].modelUrl)),e.face.iris.enabled&&(!Zt[2]||!Zt[2].modelUrl?ge("load model failed:",e.face.iris.modelPath):e.debug&&ge("load model:",Zt[2].modelUrl))):e.debug&&(Zt[0]&&ge("cached model:",Zt[0].model.modelUrl),Zt[1]&&ge("cached model:",Zt[1].modelUrl),Zt[2]&&ge("cached model:",Zt[2].modelUrl)),Sb=new Ib(Zt[0],Zt[1],Zt[2]),Zt}var IM=vo,SM=wp;var Pve=["angry","disgust","fear","happy","sad","surprise","neutral"],Ar,um=[],NM=0,Tb=Number.MAX_SAFE_INTEGER,Eb=[.2989,.587,.114];async function Cb(e){return Ar?e.debug&&ge("cached model:",Ar.modelUrl):(Ar=await Et(Mt(e.modelBasePath,e.face.emotion.modelPath)),!Ar||!Ar.modelUrl?ge("load model failed:",e.face.emotion.modelPath):e.debug&&ge("load model:",Ar.modelUrl)),Ar}async function Mb(e,t,n,a){return Ar?Tb0?(Tb++,um[n]):(Tb=0,new Promise(async r=>{let s=Ye.resizeBilinear(e,[Ar.inputs[0].shape[2],Ar.inputs[0].shape[1]],!1),[i,o,l]=es(s,3,3);s.dispose();let u=fe(i,Eb[0]),d=fe(o,Eb[1]),h=fe(l,Eb[2]);i.dispose(),o.dispose(),l.dispose();let p=Ky([u,d,h]);u.dispose(),d.dispose(),h.dispose();let c=Ue(()=>p.sub(.5).mul(2));p.dispose();let m=[];if(t.face.emotion.enabled){let f=await Ar.predict(c),g=f.dataSync();Ve(f);for(let y=0;yt.face.emotion.minConfidence&&m.push({score:Math.min(.99,Math.trunc(100*g[y])/100),emotion:Pve[y]});m.sort((y,A)=>A.score-y.score)}c.dispose(),um[n]=m,NM=a,r(m)})):null}var xr,dm=[],TM=0,$b=Number.MAX_SAFE_INTEGER;async function Rb(e){let t=Mt(e.modelBasePath,e.face.description.modelPath);return xr?e.debug&&ge("cached model:",t):(xr=await Et(t),xr?e.debug&&ge("load model:",t):ge("load model failed:",e.face.description.modelPath)),xr}function Fb(e,t,n=2){if(!e||!t||(e==null?void 0:e.length)===0||(t==null?void 0:t.length)===0||(e==null?void 0:e.length)!==(t==null?void 0:t.length))return 0;let a=5*e.map((s,i)=>Math.abs(e[i]-t[i])**n).reduce((s,i)=>s+i,0)**(1/n);return Math.max(0,100-a)/100}function EM(e,t,n=0){let a={similarity:0,name:"",source:"",embedding:[]};if(!e||!t||!Array.isArray(e)||!Array.isArray(t))return a;for(let r of t)if(r.embedding&&r.name){let s=Fb(e,r.embedding);s>n&&s>a.similarity&&(a={...r,similarity:s})}return a}function Ob(e){return Ue(()=>{let n=e.image||e.tensor||e;if(!(n instanceof St))return null;let a=[[.05,.15,.85,.85]];return xr.inputs[0].shape?(n.shape.length===3?Ye.cropAndResize(Qr(n,0),a,[0],[xr.inputs[0].shape[2],xr.inputs[0].shape[1]]):Ye.cropAndResize(n,a,[0],[xr.inputs[0].shape[2],xr.inputs[0].shape[1]])).mul(255):null})}async function Db(e,t,n,a){var r,s;return xr?$b0?($b++,dm[n]):($b=0,new Promise(async i=>{let o=Ob(e),l,u={age:0,gender:"unknown",genderScore:0,descriptor:[]};t.face.description.enabled&&(l=await xr.predict(o)),Ve(o),l&&(Ue(()=>{let d=l.find(f=>f.shape[1]===1).dataSync(),h=Math.trunc(200*Math.abs(d[0]-.5))/100;h>t.face.description.minConfidence&&(u.gender=d[0]<=.5?"female":"male",u.genderScore=Math.min(.99,h));let p=l.find(f=>f.shape[1]===100).argMax(1).dataSync()[0],c=l.find(f=>f.shape[1]===100).dataSync();u.age=Math.round(c[p-1]>c[p+1]?10*p-100*c[p-1]:10*p+100*c[p+1])/10;let m=l.find(f=>f.shape[1]===1024);u.descriptor=[...m.dataSync()]}),l.forEach(d=>Ve(d))),dm[n]=u,TM=a,i(u)})):null}var Lve=e=>{let t=(h,p)=>Math.atan2(h[1]-p[1],h[0]-p[0]);if(!e.annotations.rightEyeIris||!e.annotations.leftEyeIris)return{bearing:0,strength:0};let n=[0,-.1],a=1,r=e.mesh[33][2]>e.mesh[263][2],s=r?e.mesh[473]:e.mesh[468],i=r?[(e.mesh[133][0]+e.mesh[33][0])/2,(e.mesh[133][1]+e.mesh[33][1])/2]:[(e.mesh[263][0]+e.mesh[362][0])/2,(e.mesh[263][1]+e.mesh[362][1])/2],o=r?[e.mesh[133][0]-e.mesh[33][0],e.mesh[23][1]-e.mesh[27][1]]:[e.mesh[263][0]-e.mesh[362][0],e.mesh[253][1]-e.mesh[257][1]],l=[(i[0]-s[0])/o[0]-n[0],a*(s[1]-i[1])/o[1]-n[1]],u=Math.sqrt(l[0]**2+l[1]**2);return u=Math.min(u,e.boxRaw[2]/2,e.boxRaw[3]/2),{bearing:(t([0,0],l)+Math.PI/2)%Math.PI,strength:u}},Wve=(e,t)=>{let n=g=>{let y=Math.sqrt(g[0]*g[0]+g[1]*g[1]+g[2]*g[2]);return g[0]/=y,g[1]/=y,g[2]/=y,g},a=(g,y)=>{let A=g[0]-y[0],x=g[1]-y[1],v=g[2]-y[2];return[A,x,v]},r=(g,y)=>{let A=g[1]*y[2]-g[2]*y[1],x=g[2]*y[0]-g[0]*y[2],v=g[0]*y[1]-g[1]*y[0];return[A,x,v]},s=g=>{let[y,A,x,v,b,w,I,T,C]=g,z,$,S;return v<1?v>-1?(S=Math.asin(v),$=Math.atan2(-I,y),z=Math.atan2(-w,b)):(S=-Math.PI/2,$=-Math.atan2(T,C),z=0):(S=Math.PI/2,$=Math.atan2(T,C),z=0),{pitch:2*-z,yaw:2*-$,roll:2*-S}},i=g=>{let y=(x,v,b,w)=>Math.atan2(w-v,b-x);return{pitch:y(g[10][1],g[10][2],g[152][1],g[152][2]),yaw:y(g[33][0],g[33][2],g[263][0],g[263][2]),roll:y(g[33][0],g[33][1],g[263][0],g[263][1])}},o=e.meshRaw;if(!o||o.length<300)return{angle:{pitch:0,yaw:0,roll:0},matrix:[1,0,0,0,1,0,0,0,1],gaze:{bearing:0,strength:0}};let l=Math.max(e.boxRaw[2]*t[0],e.boxRaw[3]*t[1])/1.5,u=[o[10],o[152],o[234],o[454]].map(g=>[g[0]*t[0]/l,g[1]*t[1]/l,g[2]]),d=n(a(u[1],u[0])),h=n(a(u[3],u[2])),p=n(r(h,d));h=r(d,p);let c=[h[0],h[1],h[2],d[0],d[1],d[2],p[0],p[1],p[2]],m=s(c),f=o.length===478?Lve(e):{bearing:0,strength:0};return{angle:m,matrix:c,gaze:f}},_b=async(e,t)=>{var d,h,p,c,m,f;let n,a,r,s,i,o,l=[];e.state="run:face",n=st();let u=await kM(t,e.config);if(e.performance.face=Math.trunc(st()-n),!t.shape||t.shape.length!==4)return[];if(!u)return[];for(let g=0;g(e[t]=n,e),{}),Bve=[["leftHip","leftShoulder"],["leftElbow","leftShoulder"],["leftElbow","leftWrist"],["leftHip","leftKnee"],["leftKnee","leftAnkle"],["rightHip","rightShoulder"],["rightElbow","rightShoulder"],["rightElbow","rightWrist"],["rightHip","rightKnee"],["rightKnee","rightAnkle"],["leftShoulder","rightShoulder"],["leftHip","rightHip"]],Vve=Bve.map(([e,t])=>[Ip[e],Ip[t]]),MM=[["nose","leftEye"],["leftEye","leftEar"],["nose","rightEye"],["rightEye","rightEar"],["nose","leftShoulder"],["leftShoulder","leftElbow"],["leftElbow","leftWrist"],["leftShoulder","leftHip"],["leftHip","leftKnee"],["leftKnee","leftAnkle"],["nose","rightShoulder"],["rightShoulder","rightElbow"],["rightElbow","rightWrist"],["rightShoulder","rightHip"],["rightHip","rightKnee"],["rightKnee","rightAnkle"]];function $M(e){let t=e.reduce(({maxX:n,maxY:a,minX:r,minY:s},{position:{x:i,y:o}})=>({maxX:Math.max(n,i),maxY:Math.max(a,o),minX:Math.min(r,i),minY:Math.min(s,o)}),{maxX:Number.NEGATIVE_INFINITY,maxY:Number.NEGATIVE_INFINITY,minX:Number.POSITIVE_INFINITY,minY:Number.POSITIVE_INFINITY});return[t.minX,t.minY,t.maxX-t.minX,t.maxY-t.minY]}function RM(e,[t,n],[a,r]){let s=t/a,i=n/r,o=(u,d)=>({id:d,score:u.score,boxRaw:[u.box[0]/r,u.box[1]/a,u.box[2]/r,u.box[3]/a],box:[Math.trunc(u.box[0]*i),Math.trunc(u.box[1]*s),Math.trunc(u.box[2]*i),Math.trunc(u.box[3]*s)],keypoints:u.keypoints.map(({score:h,part:p,position:c})=>({score:h,part:p,position:[Math.trunc(c.x*i),Math.trunc(c.y*s)],positionRaw:[c.x/a,c.y/a]}))});return e.map((u,d)=>o(u,d))}var zb=class{constructor(t,n){this.priorityQueue=new Array(t),this.numberOfElements=-1,this.getElementValue=n}enqueue(t){this.priorityQueue[++this.numberOfElements]=t,this.swim(this.numberOfElements)}dequeue(){let t=this.priorityQueue[0];return this.exchange(0,this.numberOfElements--),this.sink(0),this.priorityQueue[this.numberOfElements+1]=null,t}empty(){return this.numberOfElements===-1}size(){return this.numberOfElements+1}all(){return this.priorityQueue.slice(0,this.numberOfElements+1)}max(){return this.priorityQueue[0]}swim(t){for(;t>0&&this.less(Math.floor(t/2),t);)this.exchange(t,Math.floor(t/2)),t=Math.floor(t/2)}sink(t){for(;2*t<=this.numberOfElements;){let n=2*t;if(nn?n:e}function FM(e,t,n,a){let r=n-e,s=a-t;return r*r+s*s}function Bb(e,t){return{x:e.x+t.x,y:e.y+t.y}}var hm=1,Mu=16,Uve=50**2;function OM(e,t,n,a,r,s,i=2){let o=y=>({y:s.get(y.y,y.x,e),x:s.get(y.y,y.x,s.shape[2]/2+e)}),l=(y,A,x)=>({y:Wb(Math.round(y.y/Mu),0,A-1),x:Wb(Math.round(y.x/Mu),0,x-1)}),[u,d]=a.shape,h=l(t.position,u,d),p=o(h),m=Bb(t.position,p);for(let y=0;y[Ip[p],Ip[c]]),i=s.map(([,p])=>p),o=s.map(([p])=>p),l=t.shape[2],u=i.length,d=new Array(l),h=Lb(e.part,Mu,n);d[e.part.id]={score:e.score,part:kp[e.part.id],position:h};for(let p=u-1;p>=0;--p){let c=i[p],m=o[p];d[c]&&!d[m]&&(d[m]=OM(p,d[c],m,t,n,r))}for(let p=0;pt){o=!1;break}if(!o)break}return o}function Gve(e,t){let[n,a,r]=t.shape,s=new zb(n*a*r,({score:i})=>i);for(let i=0;i{var i;let s=(i=r[a])==null?void 0:i.position;return s?FM(n,t,s.y,s.x)<=Uve:!1})}function qve(e,t){return t.reduce((a,{position:r,score:s},i)=>(DM(e,r,i)||(a+=s),a),0)/t.length}function _M(e,t,n,a,r,s){let i=[],o=Gve(s,t);for(;i.lengthc.score>s);let h=qve(i,d),p=$M(d);h>s&&i.push({keypoints:d,box:p,score:Math.round(100*h)/100})}return i}var ga,Kve=["MobilenetV1/offset_2/BiasAdd","MobilenetV1/heatmap_2/BiasAdd","MobilenetV1/displacement_fwd_2/BiasAdd","MobilenetV1/displacement_bwd_2/BiasAdd"];async function Vb(e,t){let n=Ue(()=>{if(!ga.inputs[0].shape)return[];let o=Ye.resizeBilinear(e,[ga.inputs[0].shape[2],ga.inputs[0].shape[1]]).toFloat().div(127.5).sub(1),u=ga.execute(o,Kve).map(d=>Yn(d,[0]));return u[1]=u[1].sigmoid(),u}),a=await Promise.all(n.map(i=>i.buffer()));for(let i of n)i.dispose();let r=await _M(a[0],a[1],a[2],a[3],t.body.maxDetected,t.body.minConfidence);return ga.inputs[0].shape?RM(r,[e.shape[1],e.shape[2]],[ga.inputs[0].shape[2],ga.inputs[0].shape[1]]):[]}async function Ub(e){return ga?e.debug&&ge("cached model:",ga.modelUrl):(ga=await Et(Mt(e.modelBasePath,e.body.modelPath)),!ga||!ga.modelUrl?ge("load model failed:",e.body.modelPath):e.debug&&ge("load model:",ga.modelUrl)),ga}function pm(e){return[Math.abs(e.endPoint[0]-e.startPoint[0]),Math.abs(e.endPoint[1]-e.startPoint[1])]}function Sp(e){return[e.startPoint[0]+(e.endPoint[0]-e.startPoint[0])/2,e.startPoint[1]+(e.endPoint[1]-e.startPoint[1])/2]}function zM(e,t,n){let a=t.shape[1],r=t.shape[2],s=[[e.startPoint[1]/a,e.startPoint[0]/r,e.endPoint[1]/a,e.endPoint[0]/r]];return Ye.cropAndResize(t,s,[0],n)}function PM(e,t){let n=[e.startPoint[0]*t[0],e.startPoint[1]*t[1]],a=[e.endPoint[0]*t[0],e.endPoint[1]*t[1]],r=e.palmLandmarks.map(s=>[s[0]*t[0],s[1]*t[1]]);return{startPoint:n,endPoint:a,palmLandmarks:r,confidence:e.confidence}}function cm(e,t=1.5){let n=Sp(e),a=pm(e),r=[t*a[0]/2,t*a[1]/2],s=[n[0]-r[0],n[1]-r[1]],i=[n[0]+r[0],n[1]+r[1]];return{startPoint:s,endPoint:i,palmLandmarks:e.palmLandmarks}}function fm(e){let t=Sp(e),n=pm(e),r=Math.max(...n)/2,s=[t[0]-r,t[1]-r],i=[t[0]+r,t[1]+r];return{startPoint:s,endPoint:i,palmLandmarks:e.palmLandmarks}}var LM=[{x:.015625,y:.015625},{x:.015625,y:.015625},{x:.046875,y:.015625},{x:.046875,y:.015625},{x:.078125,y:.015625},{x:.078125,y:.015625},{x:.109375,y:.015625},{x:.109375,y:.015625},{x:.140625,y:.015625},{x:.140625,y:.015625},{x:.171875,y:.015625},{x:.171875,y:.015625},{x:.203125,y:.015625},{x:.203125,y:.015625},{x:.234375,y:.015625},{x:.234375,y:.015625},{x:.265625,y:.015625},{x:.265625,y:.015625},{x:.296875,y:.015625},{x:.296875,y:.015625},{x:.328125,y:.015625},{x:.328125,y:.015625},{x:.359375,y:.015625},{x:.359375,y:.015625},{x:.390625,y:.015625},{x:.390625,y:.015625},{x:.421875,y:.015625},{x:.421875,y:.015625},{x:.453125,y:.015625},{x:.453125,y:.015625},{x:.484375,y:.015625},{x:.484375,y:.015625},{x:.515625,y:.015625},{x:.515625,y:.015625},{x:.546875,y:.015625},{x:.546875,y:.015625},{x:.578125,y:.015625},{x:.578125,y:.015625},{x:.609375,y:.015625},{x:.609375,y:.015625},{x:.640625,y:.015625},{x:.640625,y:.015625},{x:.671875,y:.015625},{x:.671875,y:.015625},{x:.703125,y:.015625},{x:.703125,y:.015625},{x:.734375,y:.015625},{x:.734375,y:.015625},{x:.765625,y:.015625},{x:.765625,y:.015625},{x:.796875,y:.015625},{x:.796875,y:.015625},{x:.828125,y:.015625},{x:.828125,y:.015625},{x:.859375,y:.015625},{x:.859375,y:.015625},{x:.890625,y:.015625},{x:.890625,y:.015625},{x:.921875,y:.015625},{x:.921875,y:.015625},{x:.953125,y:.015625},{x:.953125,y:.015625},{x:.984375,y:.015625},{x:.984375,y:.015625},{x:.015625,y:.046875},{x:.015625,y:.046875},{x:.046875,y:.046875},{x:.046875,y:.046875},{x:.078125,y:.046875},{x:.078125,y:.046875},{x:.109375,y:.046875},{x:.109375,y:.046875},{x:.140625,y:.046875},{x:.140625,y:.046875},{x:.171875,y:.046875},{x:.171875,y:.046875},{x:.203125,y:.046875},{x:.203125,y:.046875},{x:.234375,y:.046875},{x:.234375,y:.046875},{x:.265625,y:.046875},{x:.265625,y:.046875},{x:.296875,y:.046875},{x:.296875,y:.046875},{x:.328125,y:.046875},{x:.328125,y:.046875},{x:.359375,y:.046875},{x:.359375,y:.046875},{x:.390625,y:.046875},{x:.390625,y:.046875},{x:.421875,y:.046875},{x:.421875,y:.046875},{x:.453125,y:.046875},{x:.453125,y:.046875},{x:.484375,y:.046875},{x:.484375,y:.046875},{x:.515625,y:.046875},{x:.515625,y:.046875},{x:.546875,y:.046875},{x:.546875,y:.046875},{x:.578125,y:.046875},{x:.578125,y:.046875},{x:.609375,y:.046875},{x:.609375,y:.046875},{x:.640625,y:.046875},{x:.640625,y:.046875},{x:.671875,y:.046875},{x:.671875,y:.046875},{x:.703125,y:.046875},{x:.703125,y:.046875},{x:.734375,y:.046875},{x:.734375,y:.046875},{x:.765625,y:.046875},{x:.765625,y:.046875},{x:.796875,y:.046875},{x:.796875,y:.046875},{x:.828125,y:.046875},{x:.828125,y:.046875},{x:.859375,y:.046875},{x:.859375,y:.046875},{x:.890625,y:.046875},{x:.890625,y:.046875},{x:.921875,y:.046875},{x:.921875,y:.046875},{x:.953125,y:.046875},{x:.953125,y:.046875},{x:.984375,y:.046875},{x:.984375,y:.046875},{x:.015625,y:.078125},{x:.015625,y:.078125},{x:.046875,y:.078125},{x:.046875,y:.078125},{x:.078125,y:.078125},{x:.078125,y:.078125},{x:.109375,y:.078125},{x:.109375,y:.078125},{x:.140625,y:.078125},{x:.140625,y:.078125},{x:.171875,y:.078125},{x:.171875,y:.078125},{x:.203125,y:.078125},{x:.203125,y:.078125},{x:.234375,y:.078125},{x:.234375,y:.078125},{x:.265625,y:.078125},{x:.265625,y:.078125},{x:.296875,y:.078125},{x:.296875,y:.078125},{x:.328125,y:.078125},{x:.328125,y:.078125},{x:.359375,y:.078125},{x:.359375,y:.078125},{x:.390625,y:.078125},{x:.390625,y:.078125},{x:.421875,y:.078125},{x:.421875,y:.078125},{x:.453125,y:.078125},{x:.453125,y:.078125},{x:.484375,y:.078125},{x:.484375,y:.078125},{x:.515625,y:.078125},{x:.515625,y:.078125},{x:.546875,y:.078125},{x:.546875,y:.078125},{x:.578125,y:.078125},{x:.578125,y:.078125},{x:.609375,y:.078125},{x:.609375,y:.078125},{x:.640625,y:.078125},{x:.640625,y:.078125},{x:.671875,y:.078125},{x:.671875,y:.078125},{x:.703125,y:.078125},{x:.703125,y:.078125},{x:.734375,y:.078125},{x:.734375,y:.078125},{x:.765625,y:.078125},{x:.765625,y:.078125},{x:.796875,y:.078125},{x:.796875,y:.078125},{x:.828125,y:.078125},{x:.828125,y:.078125},{x:.859375,y:.078125},{x:.859375,y:.078125},{x:.890625,y:.078125},{x:.890625,y:.078125},{x:.921875,y:.078125},{x:.921875,y:.078125},{x:.953125,y:.078125},{x:.953125,y:.078125},{x:.984375,y:.078125},{x:.984375,y:.078125},{x:.015625,y:.109375},{x:.015625,y:.109375},{x:.046875,y:.109375},{x:.046875,y:.109375},{x:.078125,y:.109375},{x:.078125,y:.109375},{x:.109375,y:.109375},{x:.109375,y:.109375},{x:.140625,y:.109375},{x:.140625,y:.109375},{x:.171875,y:.109375},{x:.171875,y:.109375},{x:.203125,y:.109375},{x:.203125,y:.109375},{x:.234375,y:.109375},{x:.234375,y:.109375},{x:.265625,y:.109375},{x:.265625,y:.109375},{x:.296875,y:.109375},{x:.296875,y:.109375},{x:.328125,y:.109375},{x:.328125,y:.109375},{x:.359375,y:.109375},{x:.359375,y:.109375},{x:.390625,y:.109375},{x:.390625,y:.109375},{x:.421875,y:.109375},{x:.421875,y:.109375},{x:.453125,y:.109375},{x:.453125,y:.109375},{x:.484375,y:.109375},{x:.484375,y:.109375},{x:.515625,y:.109375},{x:.515625,y:.109375},{x:.546875,y:.109375},{x:.546875,y:.109375},{x:.578125,y:.109375},{x:.578125,y:.109375},{x:.609375,y:.109375},{x:.609375,y:.109375},{x:.640625,y:.109375},{x:.640625,y:.109375},{x:.671875,y:.109375},{x:.671875,y:.109375},{x:.703125,y:.109375},{x:.703125,y:.109375},{x:.734375,y:.109375},{x:.734375,y:.109375},{x:.765625,y:.109375},{x:.765625,y:.109375},{x:.796875,y:.109375},{x:.796875,y:.109375},{x:.828125,y:.109375},{x:.828125,y:.109375},{x:.859375,y:.109375},{x:.859375,y:.109375},{x:.890625,y:.109375},{x:.890625,y:.109375},{x:.921875,y:.109375},{x:.921875,y:.109375},{x:.953125,y:.109375},{x:.953125,y:.109375},{x:.984375,y:.109375},{x:.984375,y:.109375},{x:.015625,y:.140625},{x:.015625,y:.140625},{x:.046875,y:.140625},{x:.046875,y:.140625},{x:.078125,y:.140625},{x:.078125,y:.140625},{x:.109375,y:.140625},{x:.109375,y:.140625},{x:.140625,y:.140625},{x:.140625,y:.140625},{x:.171875,y:.140625},{x:.171875,y:.140625},{x:.203125,y:.140625},{x:.203125,y:.140625},{x:.234375,y:.140625},{x:.234375,y:.140625},{x:.265625,y:.140625},{x:.265625,y:.140625},{x:.296875,y:.140625},{x:.296875,y:.140625},{x:.328125,y:.140625},{x:.328125,y:.140625},{x:.359375,y:.140625},{x:.359375,y:.140625},{x:.390625,y:.140625},{x:.390625,y:.140625},{x:.421875,y:.140625},{x:.421875,y:.140625},{x:.453125,y:.140625},{x:.453125,y:.140625},{x:.484375,y:.140625},{x:.484375,y:.140625},{x:.515625,y:.140625},{x:.515625,y:.140625},{x:.546875,y:.140625},{x:.546875,y:.140625},{x:.578125,y:.140625},{x:.578125,y:.140625},{x:.609375,y:.140625},{x:.609375,y:.140625},{x:.640625,y:.140625},{x:.640625,y:.140625},{x:.671875,y:.140625},{x:.671875,y:.140625},{x:.703125,y:.140625},{x:.703125,y:.140625},{x:.734375,y:.140625},{x:.734375,y:.140625},{x:.765625,y:.140625},{x:.765625,y:.140625},{x:.796875,y:.140625},{x:.796875,y:.140625},{x:.828125,y:.140625},{x:.828125,y:.140625},{x:.859375,y:.140625},{x:.859375,y:.140625},{x:.890625,y:.140625},{x:.890625,y:.140625},{x:.921875,y:.140625},{x:.921875,y:.140625},{x:.953125,y:.140625},{x:.953125,y:.140625},{x:.984375,y:.140625},{x:.984375,y:.140625},{x:.015625,y:.171875},{x:.015625,y:.171875},{x:.046875,y:.171875},{x:.046875,y:.171875},{x:.078125,y:.171875},{x:.078125,y:.171875},{x:.109375,y:.171875},{x:.109375,y:.171875},{x:.140625,y:.171875},{x:.140625,y:.171875},{x:.171875,y:.171875},{x:.171875,y:.171875},{x:.203125,y:.171875},{x:.203125,y:.171875},{x:.234375,y:.171875},{x:.234375,y:.171875},{x:.265625,y:.171875},{x:.265625,y:.171875},{x:.296875,y:.171875},{x:.296875,y:.171875},{x:.328125,y:.171875},{x:.328125,y:.171875},{x:.359375,y:.171875},{x:.359375,y:.171875},{x:.390625,y:.171875},{x:.390625,y:.171875},{x:.421875,y:.171875},{x:.421875,y:.171875},{x:.453125,y:.171875},{x:.453125,y:.171875},{x:.484375,y:.171875},{x:.484375,y:.171875},{x:.515625,y:.171875},{x:.515625,y:.171875},{x:.546875,y:.171875},{x:.546875,y:.171875},{x:.578125,y:.171875},{x:.578125,y:.171875},{x:.609375,y:.171875},{x:.609375,y:.171875},{x:.640625,y:.171875},{x:.640625,y:.171875},{x:.671875,y:.171875},{x:.671875,y:.171875},{x:.703125,y:.171875},{x:.703125,y:.171875},{x:.734375,y:.171875},{x:.734375,y:.171875},{x:.765625,y:.171875},{x:.765625,y:.171875},{x:.796875,y:.171875},{x:.796875,y:.171875},{x:.828125,y:.171875},{x:.828125,y:.171875},{x:.859375,y:.171875},{x:.859375,y:.171875},{x:.890625,y:.171875},{x:.890625,y:.171875},{x:.921875,y:.171875},{x:.921875,y:.171875},{x:.953125,y:.171875},{x:.953125,y:.171875},{x:.984375,y:.171875},{x:.984375,y:.171875},{x:.015625,y:.203125},{x:.015625,y:.203125},{x:.046875,y:.203125},{x:.046875,y:.203125},{x:.078125,y:.203125},{x:.078125,y:.203125},{x:.109375,y:.203125},{x:.109375,y:.203125},{x:.140625,y:.203125},{x:.140625,y:.203125},{x:.171875,y:.203125},{x:.171875,y:.203125},{x:.203125,y:.203125},{x:.203125,y:.203125},{x:.234375,y:.203125},{x:.234375,y:.203125},{x:.265625,y:.203125},{x:.265625,y:.203125},{x:.296875,y:.203125},{x:.296875,y:.203125},{x:.328125,y:.203125},{x:.328125,y:.203125},{x:.359375,y:.203125},{x:.359375,y:.203125},{x:.390625,y:.203125},{x:.390625,y:.203125},{x:.421875,y:.203125},{x:.421875,y:.203125},{x:.453125,y:.203125},{x:.453125,y:.203125},{x:.484375,y:.203125},{x:.484375,y:.203125},{x:.515625,y:.203125},{x:.515625,y:.203125},{x:.546875,y:.203125},{x:.546875,y:.203125},{x:.578125,y:.203125},{x:.578125,y:.203125},{x:.609375,y:.203125},{x:.609375,y:.203125},{x:.640625,y:.203125},{x:.640625,y:.203125},{x:.671875,y:.203125},{x:.671875,y:.203125},{x:.703125,y:.203125},{x:.703125,y:.203125},{x:.734375,y:.203125},{x:.734375,y:.203125},{x:.765625,y:.203125},{x:.765625,y:.203125},{x:.796875,y:.203125},{x:.796875,y:.203125},{x:.828125,y:.203125},{x:.828125,y:.203125},{x:.859375,y:.203125},{x:.859375,y:.203125},{x:.890625,y:.203125},{x:.890625,y:.203125},{x:.921875,y:.203125},{x:.921875,y:.203125},{x:.953125,y:.203125},{x:.953125,y:.203125},{x:.984375,y:.203125},{x:.984375,y:.203125},{x:.015625,y:.234375},{x:.015625,y:.234375},{x:.046875,y:.234375},{x:.046875,y:.234375},{x:.078125,y:.234375},{x:.078125,y:.234375},{x:.109375,y:.234375},{x:.109375,y:.234375},{x:.140625,y:.234375},{x:.140625,y:.234375},{x:.171875,y:.234375},{x:.171875,y:.234375},{x:.203125,y:.234375},{x:.203125,y:.234375},{x:.234375,y:.234375},{x:.234375,y:.234375},{x:.265625,y:.234375},{x:.265625,y:.234375},{x:.296875,y:.234375},{x:.296875,y:.234375},{x:.328125,y:.234375},{x:.328125,y:.234375},{x:.359375,y:.234375},{x:.359375,y:.234375},{x:.390625,y:.234375},{x:.390625,y:.234375},{x:.421875,y:.234375},{x:.421875,y:.234375},{x:.453125,y:.234375},{x:.453125,y:.234375},{x:.484375,y:.234375},{x:.484375,y:.234375},{x:.515625,y:.234375},{x:.515625,y:.234375},{x:.546875,y:.234375},{x:.546875,y:.234375},{x:.578125,y:.234375},{x:.578125,y:.234375},{x:.609375,y:.234375},{x:.609375,y:.234375},{x:.640625,y:.234375},{x:.640625,y:.234375},{x:.671875,y:.234375},{x:.671875,y:.234375},{x:.703125,y:.234375},{x:.703125,y:.234375},{x:.734375,y:.234375},{x:.734375,y:.234375},{x:.765625,y:.234375},{x:.765625,y:.234375},{x:.796875,y:.234375},{x:.796875,y:.234375},{x:.828125,y:.234375},{x:.828125,y:.234375},{x:.859375,y:.234375},{x:.859375,y:.234375},{x:.890625,y:.234375},{x:.890625,y:.234375},{x:.921875,y:.234375},{x:.921875,y:.234375},{x:.953125,y:.234375},{x:.953125,y:.234375},{x:.984375,y:.234375},{x:.984375,y:.234375},{x:.015625,y:.265625},{x:.015625,y:.265625},{x:.046875,y:.265625},{x:.046875,y:.265625},{x:.078125,y:.265625},{x:.078125,y:.265625},{x:.109375,y:.265625},{x:.109375,y:.265625},{x:.140625,y:.265625},{x:.140625,y:.265625},{x:.171875,y:.265625},{x:.171875,y:.265625},{x:.203125,y:.265625},{x:.203125,y:.265625},{x:.234375,y:.265625},{x:.234375,y:.265625},{x:.265625,y:.265625},{x:.265625,y:.265625},{x:.296875,y:.265625},{x:.296875,y:.265625},{x:.328125,y:.265625},{x:.328125,y:.265625},{x:.359375,y:.265625},{x:.359375,y:.265625},{x:.390625,y:.265625},{x:.390625,y:.265625},{x:.421875,y:.265625},{x:.421875,y:.265625},{x:.453125,y:.265625},{x:.453125,y:.265625},{x:.484375,y:.265625},{x:.484375,y:.265625},{x:.515625,y:.265625},{x:.515625,y:.265625},{x:.546875,y:.265625},{x:.546875,y:.265625},{x:.578125,y:.265625},{x:.578125,y:.265625},{x:.609375,y:.265625},{x:.609375,y:.265625},{x:.640625,y:.265625},{x:.640625,y:.265625},{x:.671875,y:.265625},{x:.671875,y:.265625},{x:.703125,y:.265625},{x:.703125,y:.265625},{x:.734375,y:.265625},{x:.734375,y:.265625},{x:.765625,y:.265625},{x:.765625,y:.265625},{x:.796875,y:.265625},{x:.796875,y:.265625},{x:.828125,y:.265625},{x:.828125,y:.265625},{x:.859375,y:.265625},{x:.859375,y:.265625},{x:.890625,y:.265625},{x:.890625,y:.265625},{x:.921875,y:.265625},{x:.921875,y:.265625},{x:.953125,y:.265625},{x:.953125,y:.265625},{x:.984375,y:.265625},{x:.984375,y:.265625},{x:.015625,y:.296875},{x:.015625,y:.296875},{x:.046875,y:.296875},{x:.046875,y:.296875},{x:.078125,y:.296875},{x:.078125,y:.296875},{x:.109375,y:.296875},{x:.109375,y:.296875},{x:.140625,y:.296875},{x:.140625,y:.296875},{x:.171875,y:.296875},{x:.171875,y:.296875},{x:.203125,y:.296875},{x:.203125,y:.296875},{x:.234375,y:.296875},{x:.234375,y:.296875},{x:.265625,y:.296875},{x:.265625,y:.296875},{x:.296875,y:.296875},{x:.296875,y:.296875},{x:.328125,y:.296875},{x:.328125,y:.296875},{x:.359375,y:.296875},{x:.359375,y:.296875},{x:.390625,y:.296875},{x:.390625,y:.296875},{x:.421875,y:.296875},{x:.421875,y:.296875},{x:.453125,y:.296875},{x:.453125,y:.296875},{x:.484375,y:.296875},{x:.484375,y:.296875},{x:.515625,y:.296875},{x:.515625,y:.296875},{x:.546875,y:.296875},{x:.546875,y:.296875},{x:.578125,y:.296875},{x:.578125,y:.296875},{x:.609375,y:.296875},{x:.609375,y:.296875},{x:.640625,y:.296875},{x:.640625,y:.296875},{x:.671875,y:.296875},{x:.671875,y:.296875},{x:.703125,y:.296875},{x:.703125,y:.296875},{x:.734375,y:.296875},{x:.734375,y:.296875},{x:.765625,y:.296875},{x:.765625,y:.296875},{x:.796875,y:.296875},{x:.796875,y:.296875},{x:.828125,y:.296875},{x:.828125,y:.296875},{x:.859375,y:.296875},{x:.859375,y:.296875},{x:.890625,y:.296875},{x:.890625,y:.296875},{x:.921875,y:.296875},{x:.921875,y:.296875},{x:.953125,y:.296875},{x:.953125,y:.296875},{x:.984375,y:.296875},{x:.984375,y:.296875},{x:.015625,y:.328125},{x:.015625,y:.328125},{x:.046875,y:.328125},{x:.046875,y:.328125},{x:.078125,y:.328125},{x:.078125,y:.328125},{x:.109375,y:.328125},{x:.109375,y:.328125},{x:.140625,y:.328125},{x:.140625,y:.328125},{x:.171875,y:.328125},{x:.171875,y:.328125},{x:.203125,y:.328125},{x:.203125,y:.328125},{x:.234375,y:.328125},{x:.234375,y:.328125},{x:.265625,y:.328125},{x:.265625,y:.328125},{x:.296875,y:.328125},{x:.296875,y:.328125},{x:.328125,y:.328125},{x:.328125,y:.328125},{x:.359375,y:.328125},{x:.359375,y:.328125},{x:.390625,y:.328125},{x:.390625,y:.328125},{x:.421875,y:.328125},{x:.421875,y:.328125},{x:.453125,y:.328125},{x:.453125,y:.328125},{x:.484375,y:.328125},{x:.484375,y:.328125},{x:.515625,y:.328125},{x:.515625,y:.328125},{x:.546875,y:.328125},{x:.546875,y:.328125},{x:.578125,y:.328125},{x:.578125,y:.328125},{x:.609375,y:.328125},{x:.609375,y:.328125},{x:.640625,y:.328125},{x:.640625,y:.328125},{x:.671875,y:.328125},{x:.671875,y:.328125},{x:.703125,y:.328125},{x:.703125,y:.328125},{x:.734375,y:.328125},{x:.734375,y:.328125},{x:.765625,y:.328125},{x:.765625,y:.328125},{x:.796875,y:.328125},{x:.796875,y:.328125},{x:.828125,y:.328125},{x:.828125,y:.328125},{x:.859375,y:.328125},{x:.859375,y:.328125},{x:.890625,y:.328125},{x:.890625,y:.328125},{x:.921875,y:.328125},{x:.921875,y:.328125},{x:.953125,y:.328125},{x:.953125,y:.328125},{x:.984375,y:.328125},{x:.984375,y:.328125},{x:.015625,y:.359375},{x:.015625,y:.359375},{x:.046875,y:.359375},{x:.046875,y:.359375},{x:.078125,y:.359375},{x:.078125,y:.359375},{x:.109375,y:.359375},{x:.109375,y:.359375},{x:.140625,y:.359375},{x:.140625,y:.359375},{x:.171875,y:.359375},{x:.171875,y:.359375},{x:.203125,y:.359375},{x:.203125,y:.359375},{x:.234375,y:.359375},{x:.234375,y:.359375},{x:.265625,y:.359375},{x:.265625,y:.359375},{x:.296875,y:.359375},{x:.296875,y:.359375},{x:.328125,y:.359375},{x:.328125,y:.359375},{x:.359375,y:.359375},{x:.359375,y:.359375},{x:.390625,y:.359375},{x:.390625,y:.359375},{x:.421875,y:.359375},{x:.421875,y:.359375},{x:.453125,y:.359375},{x:.453125,y:.359375},{x:.484375,y:.359375},{x:.484375,y:.359375},{x:.515625,y:.359375},{x:.515625,y:.359375},{x:.546875,y:.359375},{x:.546875,y:.359375},{x:.578125,y:.359375},{x:.578125,y:.359375},{x:.609375,y:.359375},{x:.609375,y:.359375},{x:.640625,y:.359375},{x:.640625,y:.359375},{x:.671875,y:.359375},{x:.671875,y:.359375},{x:.703125,y:.359375},{x:.703125,y:.359375},{x:.734375,y:.359375},{x:.734375,y:.359375},{x:.765625,y:.359375},{x:.765625,y:.359375},{x:.796875,y:.359375},{x:.796875,y:.359375},{x:.828125,y:.359375},{x:.828125,y:.359375},{x:.859375,y:.359375},{x:.859375,y:.359375},{x:.890625,y:.359375},{x:.890625,y:.359375},{x:.921875,y:.359375},{x:.921875,y:.359375},{x:.953125,y:.359375},{x:.953125,y:.359375},{x:.984375,y:.359375},{x:.984375,y:.359375},{x:.015625,y:.390625},{x:.015625,y:.390625},{x:.046875,y:.390625},{x:.046875,y:.390625},{x:.078125,y:.390625},{x:.078125,y:.390625},{x:.109375,y:.390625},{x:.109375,y:.390625},{x:.140625,y:.390625},{x:.140625,y:.390625},{x:.171875,y:.390625},{x:.171875,y:.390625},{x:.203125,y:.390625},{x:.203125,y:.390625},{x:.234375,y:.390625},{x:.234375,y:.390625},{x:.265625,y:.390625},{x:.265625,y:.390625},{x:.296875,y:.390625},{x:.296875,y:.390625},{x:.328125,y:.390625},{x:.328125,y:.390625},{x:.359375,y:.390625},{x:.359375,y:.390625},{x:.390625,y:.390625},{x:.390625,y:.390625},{x:.421875,y:.390625},{x:.421875,y:.390625},{x:.453125,y:.390625},{x:.453125,y:.390625},{x:.484375,y:.390625},{x:.484375,y:.390625},{x:.515625,y:.390625},{x:.515625,y:.390625},{x:.546875,y:.390625},{x:.546875,y:.390625},{x:.578125,y:.390625},{x:.578125,y:.390625},{x:.609375,y:.390625},{x:.609375,y:.390625},{x:.640625,y:.390625},{x:.640625,y:.390625},{x:.671875,y:.390625},{x:.671875,y:.390625},{x:.703125,y:.390625},{x:.703125,y:.390625},{x:.734375,y:.390625},{x:.734375,y:.390625},{x:.765625,y:.390625},{x:.765625,y:.390625},{x:.796875,y:.390625},{x:.796875,y:.390625},{x:.828125,y:.390625},{x:.828125,y:.390625},{x:.859375,y:.390625},{x:.859375,y:.390625},{x:.890625,y:.390625},{x:.890625,y:.390625},{x:.921875,y:.390625},{x:.921875,y:.390625},{x:.953125,y:.390625},{x:.953125,y:.390625},{x:.984375,y:.390625},{x:.984375,y:.390625},{x:.015625,y:.421875},{x:.015625,y:.421875},{x:.046875,y:.421875},{x:.046875,y:.421875},{x:.078125,y:.421875},{x:.078125,y:.421875},{x:.109375,y:.421875},{x:.109375,y:.421875},{x:.140625,y:.421875},{x:.140625,y:.421875},{x:.171875,y:.421875},{x:.171875,y:.421875},{x:.203125,y:.421875},{x:.203125,y:.421875},{x:.234375,y:.421875},{x:.234375,y:.421875},{x:.265625,y:.421875},{x:.265625,y:.421875},{x:.296875,y:.421875},{x:.296875,y:.421875},{x:.328125,y:.421875},{x:.328125,y:.421875},{x:.359375,y:.421875},{x:.359375,y:.421875},{x:.390625,y:.421875},{x:.390625,y:.421875},{x:.421875,y:.421875},{x:.421875,y:.421875},{x:.453125,y:.421875},{x:.453125,y:.421875},{x:.484375,y:.421875},{x:.484375,y:.421875},{x:.515625,y:.421875},{x:.515625,y:.421875},{x:.546875,y:.421875},{x:.546875,y:.421875},{x:.578125,y:.421875},{x:.578125,y:.421875},{x:.609375,y:.421875},{x:.609375,y:.421875},{x:.640625,y:.421875},{x:.640625,y:.421875},{x:.671875,y:.421875},{x:.671875,y:.421875},{x:.703125,y:.421875},{x:.703125,y:.421875},{x:.734375,y:.421875},{x:.734375,y:.421875},{x:.765625,y:.421875},{x:.765625,y:.421875},{x:.796875,y:.421875},{x:.796875,y:.421875},{x:.828125,y:.421875},{x:.828125,y:.421875},{x:.859375,y:.421875},{x:.859375,y:.421875},{x:.890625,y:.421875},{x:.890625,y:.421875},{x:.921875,y:.421875},{x:.921875,y:.421875},{x:.953125,y:.421875},{x:.953125,y:.421875},{x:.984375,y:.421875},{x:.984375,y:.421875},{x:.015625,y:.453125},{x:.015625,y:.453125},{x:.046875,y:.453125},{x:.046875,y:.453125},{x:.078125,y:.453125},{x:.078125,y:.453125},{x:.109375,y:.453125},{x:.109375,y:.453125},{x:.140625,y:.453125},{x:.140625,y:.453125},{x:.171875,y:.453125},{x:.171875,y:.453125},{x:.203125,y:.453125},{x:.203125,y:.453125},{x:.234375,y:.453125},{x:.234375,y:.453125},{x:.265625,y:.453125},{x:.265625,y:.453125},{x:.296875,y:.453125},{x:.296875,y:.453125},{x:.328125,y:.453125},{x:.328125,y:.453125},{x:.359375,y:.453125},{x:.359375,y:.453125},{x:.390625,y:.453125},{x:.390625,y:.453125},{x:.421875,y:.453125},{x:.421875,y:.453125},{x:.453125,y:.453125},{x:.453125,y:.453125},{x:.484375,y:.453125},{x:.484375,y:.453125},{x:.515625,y:.453125},{x:.515625,y:.453125},{x:.546875,y:.453125},{x:.546875,y:.453125},{x:.578125,y:.453125},{x:.578125,y:.453125},{x:.609375,y:.453125},{x:.609375,y:.453125},{x:.640625,y:.453125},{x:.640625,y:.453125},{x:.671875,y:.453125},{x:.671875,y:.453125},{x:.703125,y:.453125},{x:.703125,y:.453125},{x:.734375,y:.453125},{x:.734375,y:.453125},{x:.765625,y:.453125},{x:.765625,y:.453125},{x:.796875,y:.453125},{x:.796875,y:.453125},{x:.828125,y:.453125},{x:.828125,y:.453125},{x:.859375,y:.453125},{x:.859375,y:.453125},{x:.890625,y:.453125},{x:.890625,y:.453125},{x:.921875,y:.453125},{x:.921875,y:.453125},{x:.953125,y:.453125},{x:.953125,y:.453125},{x:.984375,y:.453125},{x:.984375,y:.453125},{x:.015625,y:.484375},{x:.015625,y:.484375},{x:.046875,y:.484375},{x:.046875,y:.484375},{x:.078125,y:.484375},{x:.078125,y:.484375},{x:.109375,y:.484375},{x:.109375,y:.484375},{x:.140625,y:.484375},{x:.140625,y:.484375},{x:.171875,y:.484375},{x:.171875,y:.484375},{x:.203125,y:.484375},{x:.203125,y:.484375},{x:.234375,y:.484375},{x:.234375,y:.484375},{x:.265625,y:.484375},{x:.265625,y:.484375},{x:.296875,y:.484375},{x:.296875,y:.484375},{x:.328125,y:.484375},{x:.328125,y:.484375},{x:.359375,y:.484375},{x:.359375,y:.484375},{x:.390625,y:.484375},{x:.390625,y:.484375},{x:.421875,y:.484375},{x:.421875,y:.484375},{x:.453125,y:.484375},{x:.453125,y:.484375},{x:.484375,y:.484375},{x:.484375,y:.484375},{x:.515625,y:.484375},{x:.515625,y:.484375},{x:.546875,y:.484375},{x:.546875,y:.484375},{x:.578125,y:.484375},{x:.578125,y:.484375},{x:.609375,y:.484375},{x:.609375,y:.484375},{x:.640625,y:.484375},{x:.640625,y:.484375},{x:.671875,y:.484375},{x:.671875,y:.484375},{x:.703125,y:.484375},{x:.703125,y:.484375},{x:.734375,y:.484375},{x:.734375,y:.484375},{x:.765625,y:.484375},{x:.765625,y:.484375},{x:.796875,y:.484375},{x:.796875,y:.484375},{x:.828125,y:.484375},{x:.828125,y:.484375},{x:.859375,y:.484375},{x:.859375,y:.484375},{x:.890625,y:.484375},{x:.890625,y:.484375},{x:.921875,y:.484375},{x:.921875,y:.484375},{x:.953125,y:.484375},{x:.953125,y:.484375},{x:.984375,y:.484375},{x:.984375,y:.484375},{x:.015625,y:.515625},{x:.015625,y:.515625},{x:.046875,y:.515625},{x:.046875,y:.515625},{x:.078125,y:.515625},{x:.078125,y:.515625},{x:.109375,y:.515625},{x:.109375,y:.515625},{x:.140625,y:.515625},{x:.140625,y:.515625},{x:.171875,y:.515625},{x:.171875,y:.515625},{x:.203125,y:.515625},{x:.203125,y:.515625},{x:.234375,y:.515625},{x:.234375,y:.515625},{x:.265625,y:.515625},{x:.265625,y:.515625},{x:.296875,y:.515625},{x:.296875,y:.515625},{x:.328125,y:.515625},{x:.328125,y:.515625},{x:.359375,y:.515625},{x:.359375,y:.515625},{x:.390625,y:.515625},{x:.390625,y:.515625},{x:.421875,y:.515625},{x:.421875,y:.515625},{x:.453125,y:.515625},{x:.453125,y:.515625},{x:.484375,y:.515625},{x:.484375,y:.515625},{x:.515625,y:.515625},{x:.515625,y:.515625},{x:.546875,y:.515625},{x:.546875,y:.515625},{x:.578125,y:.515625},{x:.578125,y:.515625},{x:.609375,y:.515625},{x:.609375,y:.515625},{x:.640625,y:.515625},{x:.640625,y:.515625},{x:.671875,y:.515625},{x:.671875,y:.515625},{x:.703125,y:.515625},{x:.703125,y:.515625},{x:.734375,y:.515625},{x:.734375,y:.515625},{x:.765625,y:.515625},{x:.765625,y:.515625},{x:.796875,y:.515625},{x:.796875,y:.515625},{x:.828125,y:.515625},{x:.828125,y:.515625},{x:.859375,y:.515625},{x:.859375,y:.515625},{x:.890625,y:.515625},{x:.890625,y:.515625},{x:.921875,y:.515625},{x:.921875,y:.515625},{x:.953125,y:.515625},{x:.953125,y:.515625},{x:.984375,y:.515625},{x:.984375,y:.515625},{x:.015625,y:.546875},{x:.015625,y:.546875},{x:.046875,y:.546875},{x:.046875,y:.546875},{x:.078125,y:.546875},{x:.078125,y:.546875},{x:.109375,y:.546875},{x:.109375,y:.546875},{x:.140625,y:.546875},{x:.140625,y:.546875},{x:.171875,y:.546875},{x:.171875,y:.546875},{x:.203125,y:.546875},{x:.203125,y:.546875},{x:.234375,y:.546875},{x:.234375,y:.546875},{x:.265625,y:.546875},{x:.265625,y:.546875},{x:.296875,y:.546875},{x:.296875,y:.546875},{x:.328125,y:.546875},{x:.328125,y:.546875},{x:.359375,y:.546875},{x:.359375,y:.546875},{x:.390625,y:.546875},{x:.390625,y:.546875},{x:.421875,y:.546875},{x:.421875,y:.546875},{x:.453125,y:.546875},{x:.453125,y:.546875},{x:.484375,y:.546875},{x:.484375,y:.546875},{x:.515625,y:.546875},{x:.515625,y:.546875},{x:.546875,y:.546875},{x:.546875,y:.546875},{x:.578125,y:.546875},{x:.578125,y:.546875},{x:.609375,y:.546875},{x:.609375,y:.546875},{x:.640625,y:.546875},{x:.640625,y:.546875},{x:.671875,y:.546875},{x:.671875,y:.546875},{x:.703125,y:.546875},{x:.703125,y:.546875},{x:.734375,y:.546875},{x:.734375,y:.546875},{x:.765625,y:.546875},{x:.765625,y:.546875},{x:.796875,y:.546875},{x:.796875,y:.546875},{x:.828125,y:.546875},{x:.828125,y:.546875},{x:.859375,y:.546875},{x:.859375,y:.546875},{x:.890625,y:.546875},{x:.890625,y:.546875},{x:.921875,y:.546875},{x:.921875,y:.546875},{x:.953125,y:.546875},{x:.953125,y:.546875},{x:.984375,y:.546875},{x:.984375,y:.546875},{x:.015625,y:.578125},{x:.015625,y:.578125},{x:.046875,y:.578125},{x:.046875,y:.578125},{x:.078125,y:.578125},{x:.078125,y:.578125},{x:.109375,y:.578125},{x:.109375,y:.578125},{x:.140625,y:.578125},{x:.140625,y:.578125},{x:.171875,y:.578125},{x:.171875,y:.578125},{x:.203125,y:.578125},{x:.203125,y:.578125},{x:.234375,y:.578125},{x:.234375,y:.578125},{x:.265625,y:.578125},{x:.265625,y:.578125},{x:.296875,y:.578125},{x:.296875,y:.578125},{x:.328125,y:.578125},{x:.328125,y:.578125},{x:.359375,y:.578125},{x:.359375,y:.578125},{x:.390625,y:.578125},{x:.390625,y:.578125},{x:.421875,y:.578125},{x:.421875,y:.578125},{x:.453125,y:.578125},{x:.453125,y:.578125},{x:.484375,y:.578125},{x:.484375,y:.578125},{x:.515625,y:.578125},{x:.515625,y:.578125},{x:.546875,y:.578125},{x:.546875,y:.578125},{x:.578125,y:.578125},{x:.578125,y:.578125},{x:.609375,y:.578125},{x:.609375,y:.578125},{x:.640625,y:.578125},{x:.640625,y:.578125},{x:.671875,y:.578125},{x:.671875,y:.578125},{x:.703125,y:.578125},{x:.703125,y:.578125},{x:.734375,y:.578125},{x:.734375,y:.578125},{x:.765625,y:.578125},{x:.765625,y:.578125},{x:.796875,y:.578125},{x:.796875,y:.578125},{x:.828125,y:.578125},{x:.828125,y:.578125},{x:.859375,y:.578125},{x:.859375,y:.578125},{x:.890625,y:.578125},{x:.890625,y:.578125},{x:.921875,y:.578125},{x:.921875,y:.578125},{x:.953125,y:.578125},{x:.953125,y:.578125},{x:.984375,y:.578125},{x:.984375,y:.578125},{x:.015625,y:.609375},{x:.015625,y:.609375},{x:.046875,y:.609375},{x:.046875,y:.609375},{x:.078125,y:.609375},{x:.078125,y:.609375},{x:.109375,y:.609375},{x:.109375,y:.609375},{x:.140625,y:.609375},{x:.140625,y:.609375},{x:.171875,y:.609375},{x:.171875,y:.609375},{x:.203125,y:.609375},{x:.203125,y:.609375},{x:.234375,y:.609375},{x:.234375,y:.609375},{x:.265625,y:.609375},{x:.265625,y:.609375},{x:.296875,y:.609375},{x:.296875,y:.609375},{x:.328125,y:.609375},{x:.328125,y:.609375},{x:.359375,y:.609375},{x:.359375,y:.609375},{x:.390625,y:.609375},{x:.390625,y:.609375},{x:.421875,y:.609375},{x:.421875,y:.609375},{x:.453125,y:.609375},{x:.453125,y:.609375},{x:.484375,y:.609375},{x:.484375,y:.609375},{x:.515625,y:.609375},{x:.515625,y:.609375},{x:.546875,y:.609375},{x:.546875,y:.609375},{x:.578125,y:.609375},{x:.578125,y:.609375},{x:.609375,y:.609375},{x:.609375,y:.609375},{x:.640625,y:.609375},{x:.640625,y:.609375},{x:.671875,y:.609375},{x:.671875,y:.609375},{x:.703125,y:.609375},{x:.703125,y:.609375},{x:.734375,y:.609375},{x:.734375,y:.609375},{x:.765625,y:.609375},{x:.765625,y:.609375},{x:.796875,y:.609375},{x:.796875,y:.609375},{x:.828125,y:.609375},{x:.828125,y:.609375},{x:.859375,y:.609375},{x:.859375,y:.609375},{x:.890625,y:.609375},{x:.890625,y:.609375},{x:.921875,y:.609375},{x:.921875,y:.609375},{x:.953125,y:.609375},{x:.953125,y:.609375},{x:.984375,y:.609375},{x:.984375,y:.609375},{x:.015625,y:.640625},{x:.015625,y:.640625},{x:.046875,y:.640625},{x:.046875,y:.640625},{x:.078125,y:.640625},{x:.078125,y:.640625},{x:.109375,y:.640625},{x:.109375,y:.640625},{x:.140625,y:.640625},{x:.140625,y:.640625},{x:.171875,y:.640625},{x:.171875,y:.640625},{x:.203125,y:.640625},{x:.203125,y:.640625},{x:.234375,y:.640625},{x:.234375,y:.640625},{x:.265625,y:.640625},{x:.265625,y:.640625},{x:.296875,y:.640625},{x:.296875,y:.640625},{x:.328125,y:.640625},{x:.328125,y:.640625},{x:.359375,y:.640625},{x:.359375,y:.640625},{x:.390625,y:.640625},{x:.390625,y:.640625},{x:.421875,y:.640625},{x:.421875,y:.640625},{x:.453125,y:.640625},{x:.453125,y:.640625},{x:.484375,y:.640625},{x:.484375,y:.640625},{x:.515625,y:.640625},{x:.515625,y:.640625},{x:.546875,y:.640625},{x:.546875,y:.640625},{x:.578125,y:.640625},{x:.578125,y:.640625},{x:.609375,y:.640625},{x:.609375,y:.640625},{x:.640625,y:.640625},{x:.640625,y:.640625},{x:.671875,y:.640625},{x:.671875,y:.640625},{x:.703125,y:.640625},{x:.703125,y:.640625},{x:.734375,y:.640625},{x:.734375,y:.640625},{x:.765625,y:.640625},{x:.765625,y:.640625},{x:.796875,y:.640625},{x:.796875,y:.640625},{x:.828125,y:.640625},{x:.828125,y:.640625},{x:.859375,y:.640625},{x:.859375,y:.640625},{x:.890625,y:.640625},{x:.890625,y:.640625},{x:.921875,y:.640625},{x:.921875,y:.640625},{x:.953125,y:.640625},{x:.953125,y:.640625},{x:.984375,y:.640625},{x:.984375,y:.640625},{x:.015625,y:.671875},{x:.015625,y:.671875},{x:.046875,y:.671875},{x:.046875,y:.671875},{x:.078125,y:.671875},{x:.078125,y:.671875},{x:.109375,y:.671875},{x:.109375,y:.671875},{x:.140625,y:.671875},{x:.140625,y:.671875},{x:.171875,y:.671875},{x:.171875,y:.671875},{x:.203125,y:.671875},{x:.203125,y:.671875},{x:.234375,y:.671875},{x:.234375,y:.671875},{x:.265625,y:.671875},{x:.265625,y:.671875},{x:.296875,y:.671875},{x:.296875,y:.671875},{x:.328125,y:.671875},{x:.328125,y:.671875},{x:.359375,y:.671875},{x:.359375,y:.671875},{x:.390625,y:.671875},{x:.390625,y:.671875},{x:.421875,y:.671875},{x:.421875,y:.671875},{x:.453125,y:.671875},{x:.453125,y:.671875},{x:.484375,y:.671875},{x:.484375,y:.671875},{x:.515625,y:.671875},{x:.515625,y:.671875},{x:.546875,y:.671875},{x:.546875,y:.671875},{x:.578125,y:.671875},{x:.578125,y:.671875},{x:.609375,y:.671875},{x:.609375,y:.671875},{x:.640625,y:.671875},{x:.640625,y:.671875},{x:.671875,y:.671875},{x:.671875,y:.671875},{x:.703125,y:.671875},{x:.703125,y:.671875},{x:.734375,y:.671875},{x:.734375,y:.671875},{x:.765625,y:.671875},{x:.765625,y:.671875},{x:.796875,y:.671875},{x:.796875,y:.671875},{x:.828125,y:.671875},{x:.828125,y:.671875},{x:.859375,y:.671875},{x:.859375,y:.671875},{x:.890625,y:.671875},{x:.890625,y:.671875},{x:.921875,y:.671875},{x:.921875,y:.671875},{x:.953125,y:.671875},{x:.953125,y:.671875},{x:.984375,y:.671875},{x:.984375,y:.671875},{x:.015625,y:.703125},{x:.015625,y:.703125},{x:.046875,y:.703125},{x:.046875,y:.703125},{x:.078125,y:.703125},{x:.078125,y:.703125},{x:.109375,y:.703125},{x:.109375,y:.703125},{x:.140625,y:.703125},{x:.140625,y:.703125},{x:.171875,y:.703125},{x:.171875,y:.703125},{x:.203125,y:.703125},{x:.203125,y:.703125},{x:.234375,y:.703125},{x:.234375,y:.703125},{x:.265625,y:.703125},{x:.265625,y:.703125},{x:.296875,y:.703125},{x:.296875,y:.703125},{x:.328125,y:.703125},{x:.328125,y:.703125},{x:.359375,y:.703125},{x:.359375,y:.703125},{x:.390625,y:.703125},{x:.390625,y:.703125},{x:.421875,y:.703125},{x:.421875,y:.703125},{x:.453125,y:.703125},{x:.453125,y:.703125},{x:.484375,y:.703125},{x:.484375,y:.703125},{x:.515625,y:.703125},{x:.515625,y:.703125},{x:.546875,y:.703125},{x:.546875,y:.703125},{x:.578125,y:.703125},{x:.578125,y:.703125},{x:.609375,y:.703125},{x:.609375,y:.703125},{x:.640625,y:.703125},{x:.640625,y:.703125},{x:.671875,y:.703125},{x:.671875,y:.703125},{x:.703125,y:.703125},{x:.703125,y:.703125},{x:.734375,y:.703125},{x:.734375,y:.703125},{x:.765625,y:.703125},{x:.765625,y:.703125},{x:.796875,y:.703125},{x:.796875,y:.703125},{x:.828125,y:.703125},{x:.828125,y:.703125},{x:.859375,y:.703125},{x:.859375,y:.703125},{x:.890625,y:.703125},{x:.890625,y:.703125},{x:.921875,y:.703125},{x:.921875,y:.703125},{x:.953125,y:.703125},{x:.953125,y:.703125},{x:.984375,y:.703125},{x:.984375,y:.703125},{x:.015625,y:.734375},{x:.015625,y:.734375},{x:.046875,y:.734375},{x:.046875,y:.734375},{x:.078125,y:.734375},{x:.078125,y:.734375},{x:.109375,y:.734375},{x:.109375,y:.734375},{x:.140625,y:.734375},{x:.140625,y:.734375},{x:.171875,y:.734375},{x:.171875,y:.734375},{x:.203125,y:.734375},{x:.203125,y:.734375},{x:.234375,y:.734375},{x:.234375,y:.734375},{x:.265625,y:.734375},{x:.265625,y:.734375},{x:.296875,y:.734375},{x:.296875,y:.734375},{x:.328125,y:.734375},{x:.328125,y:.734375},{x:.359375,y:.734375},{x:.359375,y:.734375},{x:.390625,y:.734375},{x:.390625,y:.734375},{x:.421875,y:.734375},{x:.421875,y:.734375},{x:.453125,y:.734375},{x:.453125,y:.734375},{x:.484375,y:.734375},{x:.484375,y:.734375},{x:.515625,y:.734375},{x:.515625,y:.734375},{x:.546875,y:.734375},{x:.546875,y:.734375},{x:.578125,y:.734375},{x:.578125,y:.734375},{x:.609375,y:.734375},{x:.609375,y:.734375},{x:.640625,y:.734375},{x:.640625,y:.734375},{x:.671875,y:.734375},{x:.671875,y:.734375},{x:.703125,y:.734375},{x:.703125,y:.734375},{x:.734375,y:.734375},{x:.734375,y:.734375},{x:.765625,y:.734375},{x:.765625,y:.734375},{x:.796875,y:.734375},{x:.796875,y:.734375},{x:.828125,y:.734375},{x:.828125,y:.734375},{x:.859375,y:.734375},{x:.859375,y:.734375},{x:.890625,y:.734375},{x:.890625,y:.734375},{x:.921875,y:.734375},{x:.921875,y:.734375},{x:.953125,y:.734375},{x:.953125,y:.734375},{x:.984375,y:.734375},{x:.984375,y:.734375},{x:.015625,y:.765625},{x:.015625,y:.765625},{x:.046875,y:.765625},{x:.046875,y:.765625},{x:.078125,y:.765625},{x:.078125,y:.765625},{x:.109375,y:.765625},{x:.109375,y:.765625},{x:.140625,y:.765625},{x:.140625,y:.765625},{x:.171875,y:.765625},{x:.171875,y:.765625},{x:.203125,y:.765625},{x:.203125,y:.765625},{x:.234375,y:.765625},{x:.234375,y:.765625},{x:.265625,y:.765625},{x:.265625,y:.765625},{x:.296875,y:.765625},{x:.296875,y:.765625},{x:.328125,y:.765625},{x:.328125,y:.765625},{x:.359375,y:.765625},{x:.359375,y:.765625},{x:.390625,y:.765625},{x:.390625,y:.765625},{x:.421875,y:.765625},{x:.421875,y:.765625},{x:.453125,y:.765625},{x:.453125,y:.765625},{x:.484375,y:.765625},{x:.484375,y:.765625},{x:.515625,y:.765625},{x:.515625,y:.765625},{x:.546875,y:.765625},{x:.546875,y:.765625},{x:.578125,y:.765625},{x:.578125,y:.765625},{x:.609375,y:.765625},{x:.609375,y:.765625},{x:.640625,y:.765625},{x:.640625,y:.765625},{x:.671875,y:.765625},{x:.671875,y:.765625},{x:.703125,y:.765625},{x:.703125,y:.765625},{x:.734375,y:.765625},{x:.734375,y:.765625},{x:.765625,y:.765625},{x:.765625,y:.765625},{x:.796875,y:.765625},{x:.796875,y:.765625},{x:.828125,y:.765625},{x:.828125,y:.765625},{x:.859375,y:.765625},{x:.859375,y:.765625},{x:.890625,y:.765625},{x:.890625,y:.765625},{x:.921875,y:.765625},{x:.921875,y:.765625},{x:.953125,y:.765625},{x:.953125,y:.765625},{x:.984375,y:.765625},{x:.984375,y:.765625},{x:.015625,y:.796875},{x:.015625,y:.796875},{x:.046875,y:.796875},{x:.046875,y:.796875},{x:.078125,y:.796875},{x:.078125,y:.796875},{x:.109375,y:.796875},{x:.109375,y:.796875},{x:.140625,y:.796875},{x:.140625,y:.796875},{x:.171875,y:.796875},{x:.171875,y:.796875},{x:.203125,y:.796875},{x:.203125,y:.796875},{x:.234375,y:.796875},{x:.234375,y:.796875},{x:.265625,y:.796875},{x:.265625,y:.796875},{x:.296875,y:.796875},{x:.296875,y:.796875},{x:.328125,y:.796875},{x:.328125,y:.796875},{x:.359375,y:.796875},{x:.359375,y:.796875},{x:.390625,y:.796875},{x:.390625,y:.796875},{x:.421875,y:.796875},{x:.421875,y:.796875},{x:.453125,y:.796875},{x:.453125,y:.796875},{x:.484375,y:.796875},{x:.484375,y:.796875},{x:.515625,y:.796875},{x:.515625,y:.796875},{x:.546875,y:.796875},{x:.546875,y:.796875},{x:.578125,y:.796875},{x:.578125,y:.796875},{x:.609375,y:.796875},{x:.609375,y:.796875},{x:.640625,y:.796875},{x:.640625,y:.796875},{x:.671875,y:.796875},{x:.671875,y:.796875},{x:.703125,y:.796875},{x:.703125,y:.796875},{x:.734375,y:.796875},{x:.734375,y:.796875},{x:.765625,y:.796875},{x:.765625,y:.796875},{x:.796875,y:.796875},{x:.796875,y:.796875},{x:.828125,y:.796875},{x:.828125,y:.796875},{x:.859375,y:.796875},{x:.859375,y:.796875},{x:.890625,y:.796875},{x:.890625,y:.796875},{x:.921875,y:.796875},{x:.921875,y:.796875},{x:.953125,y:.796875},{x:.953125,y:.796875},{x:.984375,y:.796875},{x:.984375,y:.796875},{x:.015625,y:.828125},{x:.015625,y:.828125},{x:.046875,y:.828125},{x:.046875,y:.828125},{x:.078125,y:.828125},{x:.078125,y:.828125},{x:.109375,y:.828125},{x:.109375,y:.828125},{x:.140625,y:.828125},{x:.140625,y:.828125},{x:.171875,y:.828125},{x:.171875,y:.828125},{x:.203125,y:.828125},{x:.203125,y:.828125},{x:.234375,y:.828125},{x:.234375,y:.828125},{x:.265625,y:.828125},{x:.265625,y:.828125},{x:.296875,y:.828125},{x:.296875,y:.828125},{x:.328125,y:.828125},{x:.328125,y:.828125},{x:.359375,y:.828125},{x:.359375,y:.828125},{x:.390625,y:.828125},{x:.390625,y:.828125},{x:.421875,y:.828125},{x:.421875,y:.828125},{x:.453125,y:.828125},{x:.453125,y:.828125},{x:.484375,y:.828125},{x:.484375,y:.828125},{x:.515625,y:.828125},{x:.515625,y:.828125},{x:.546875,y:.828125},{x:.546875,y:.828125},{x:.578125,y:.828125},{x:.578125,y:.828125},{x:.609375,y:.828125},{x:.609375,y:.828125},{x:.640625,y:.828125},{x:.640625,y:.828125},{x:.671875,y:.828125},{x:.671875,y:.828125},{x:.703125,y:.828125},{x:.703125,y:.828125},{x:.734375,y:.828125},{x:.734375,y:.828125},{x:.765625,y:.828125},{x:.765625,y:.828125},{x:.796875,y:.828125},{x:.796875,y:.828125},{x:.828125,y:.828125},{x:.828125,y:.828125},{x:.859375,y:.828125},{x:.859375,y:.828125},{x:.890625,y:.828125},{x:.890625,y:.828125},{x:.921875,y:.828125},{x:.921875,y:.828125},{x:.953125,y:.828125},{x:.953125,y:.828125},{x:.984375,y:.828125},{x:.984375,y:.828125},{x:.015625,y:.859375},{x:.015625,y:.859375},{x:.046875,y:.859375},{x:.046875,y:.859375},{x:.078125,y:.859375},{x:.078125,y:.859375},{x:.109375,y:.859375},{x:.109375,y:.859375},{x:.140625,y:.859375},{x:.140625,y:.859375},{x:.171875,y:.859375},{x:.171875,y:.859375},{x:.203125,y:.859375},{x:.203125,y:.859375},{x:.234375,y:.859375},{x:.234375,y:.859375},{x:.265625,y:.859375},{x:.265625,y:.859375},{x:.296875,y:.859375},{x:.296875,y:.859375},{x:.328125,y:.859375},{x:.328125,y:.859375},{x:.359375,y:.859375},{x:.359375,y:.859375},{x:.390625,y:.859375},{x:.390625,y:.859375},{x:.421875,y:.859375},{x:.421875,y:.859375},{x:.453125,y:.859375},{x:.453125,y:.859375},{x:.484375,y:.859375},{x:.484375,y:.859375},{x:.515625,y:.859375},{x:.515625,y:.859375},{x:.546875,y:.859375},{x:.546875,y:.859375},{x:.578125,y:.859375},{x:.578125,y:.859375},{x:.609375,y:.859375},{x:.609375,y:.859375},{x:.640625,y:.859375},{x:.640625,y:.859375},{x:.671875,y:.859375},{x:.671875,y:.859375},{x:.703125,y:.859375},{x:.703125,y:.859375},{x:.734375,y:.859375},{x:.734375,y:.859375},{x:.765625,y:.859375},{x:.765625,y:.859375},{x:.796875,y:.859375},{x:.796875,y:.859375},{x:.828125,y:.859375},{x:.828125,y:.859375},{x:.859375,y:.859375},{x:.859375,y:.859375},{x:.890625,y:.859375},{x:.890625,y:.859375},{x:.921875,y:.859375},{x:.921875,y:.859375},{x:.953125,y:.859375},{x:.953125,y:.859375},{x:.984375,y:.859375},{x:.984375,y:.859375},{x:.015625,y:.890625},{x:.015625,y:.890625},{x:.046875,y:.890625},{x:.046875,y:.890625},{x:.078125,y:.890625},{x:.078125,y:.890625},{x:.109375,y:.890625},{x:.109375,y:.890625},{x:.140625,y:.890625},{x:.140625,y:.890625},{x:.171875,y:.890625},{x:.171875,y:.890625},{x:.203125,y:.890625},{x:.203125,y:.890625},{x:.234375,y:.890625},{x:.234375,y:.890625},{x:.265625,y:.890625},{x:.265625,y:.890625},{x:.296875,y:.890625},{x:.296875,y:.890625},{x:.328125,y:.890625},{x:.328125,y:.890625},{x:.359375,y:.890625},{x:.359375,y:.890625},{x:.390625,y:.890625},{x:.390625,y:.890625},{x:.421875,y:.890625},{x:.421875,y:.890625},{x:.453125,y:.890625},{x:.453125,y:.890625},{x:.484375,y:.890625},{x:.484375,y:.890625},{x:.515625,y:.890625},{x:.515625,y:.890625},{x:.546875,y:.890625},{x:.546875,y:.890625},{x:.578125,y:.890625},{x:.578125,y:.890625},{x:.609375,y:.890625},{x:.609375,y:.890625},{x:.640625,y:.890625},{x:.640625,y:.890625},{x:.671875,y:.890625},{x:.671875,y:.890625},{x:.703125,y:.890625},{x:.703125,y:.890625},{x:.734375,y:.890625},{x:.734375,y:.890625},{x:.765625,y:.890625},{x:.765625,y:.890625},{x:.796875,y:.890625},{x:.796875,y:.890625},{x:.828125,y:.890625},{x:.828125,y:.890625},{x:.859375,y:.890625},{x:.859375,y:.890625},{x:.890625,y:.890625},{x:.890625,y:.890625},{x:.921875,y:.890625},{x:.921875,y:.890625},{x:.953125,y:.890625},{x:.953125,y:.890625},{x:.984375,y:.890625},{x:.984375,y:.890625},{x:.015625,y:.921875},{x:.015625,y:.921875},{x:.046875,y:.921875},{x:.046875,y:.921875},{x:.078125,y:.921875},{x:.078125,y:.921875},{x:.109375,y:.921875},{x:.109375,y:.921875},{x:.140625,y:.921875},{x:.140625,y:.921875},{x:.171875,y:.921875},{x:.171875,y:.921875},{x:.203125,y:.921875},{x:.203125,y:.921875},{x:.234375,y:.921875},{x:.234375,y:.921875},{x:.265625,y:.921875},{x:.265625,y:.921875},{x:.296875,y:.921875},{x:.296875,y:.921875},{x:.328125,y:.921875},{x:.328125,y:.921875},{x:.359375,y:.921875},{x:.359375,y:.921875},{x:.390625,y:.921875},{x:.390625,y:.921875},{x:.421875,y:.921875},{x:.421875,y:.921875},{x:.453125,y:.921875},{x:.453125,y:.921875},{x:.484375,y:.921875},{x:.484375,y:.921875},{x:.515625,y:.921875},{x:.515625,y:.921875},{x:.546875,y:.921875},{x:.546875,y:.921875},{x:.578125,y:.921875},{x:.578125,y:.921875},{x:.609375,y:.921875},{x:.609375,y:.921875},{x:.640625,y:.921875},{x:.640625,y:.921875},{x:.671875,y:.921875},{x:.671875,y:.921875},{x:.703125,y:.921875},{x:.703125,y:.921875},{x:.734375,y:.921875},{x:.734375,y:.921875},{x:.765625,y:.921875},{x:.765625,y:.921875},{x:.796875,y:.921875},{x:.796875,y:.921875},{x:.828125,y:.921875},{x:.828125,y:.921875},{x:.859375,y:.921875},{x:.859375,y:.921875},{x:.890625,y:.921875},{x:.890625,y:.921875},{x:.921875,y:.921875},{x:.921875,y:.921875},{x:.953125,y:.921875},{x:.953125,y:.921875},{x:.984375,y:.921875},{x:.984375,y:.921875},{x:.015625,y:.953125},{x:.015625,y:.953125},{x:.046875,y:.953125},{x:.046875,y:.953125},{x:.078125,y:.953125},{x:.078125,y:.953125},{x:.109375,y:.953125},{x:.109375,y:.953125},{x:.140625,y:.953125},{x:.140625,y:.953125},{x:.171875,y:.953125},{x:.171875,y:.953125},{x:.203125,y:.953125},{x:.203125,y:.953125},{x:.234375,y:.953125},{x:.234375,y:.953125},{x:.265625,y:.953125},{x:.265625,y:.953125},{x:.296875,y:.953125},{x:.296875,y:.953125},{x:.328125,y:.953125},{x:.328125,y:.953125},{x:.359375,y:.953125},{x:.359375,y:.953125},{x:.390625,y:.953125},{x:.390625,y:.953125},{x:.421875,y:.953125},{x:.421875,y:.953125},{x:.453125,y:.953125},{x:.453125,y:.953125},{x:.484375,y:.953125},{x:.484375,y:.953125},{x:.515625,y:.953125},{x:.515625,y:.953125},{x:.546875,y:.953125},{x:.546875,y:.953125},{x:.578125,y:.953125},{x:.578125,y:.953125},{x:.609375,y:.953125},{x:.609375,y:.953125},{x:.640625,y:.953125},{x:.640625,y:.953125},{x:.671875,y:.953125},{x:.671875,y:.953125},{x:.703125,y:.953125},{x:.703125,y:.953125},{x:.734375,y:.953125},{x:.734375,y:.953125},{x:.765625,y:.953125},{x:.765625,y:.953125},{x:.796875,y:.953125},{x:.796875,y:.953125},{x:.828125,y:.953125},{x:.828125,y:.953125},{x:.859375,y:.953125},{x:.859375,y:.953125},{x:.890625,y:.953125},{x:.890625,y:.953125},{x:.921875,y:.953125},{x:.921875,y:.953125},{x:.953125,y:.953125},{x:.953125,y:.953125},{x:.984375,y:.953125},{x:.984375,y:.953125},{x:.015625,y:.984375},{x:.015625,y:.984375},{x:.046875,y:.984375},{x:.046875,y:.984375},{x:.078125,y:.984375},{x:.078125,y:.984375},{x:.109375,y:.984375},{x:.109375,y:.984375},{x:.140625,y:.984375},{x:.140625,y:.984375},{x:.171875,y:.984375},{x:.171875,y:.984375},{x:.203125,y:.984375},{x:.203125,y:.984375},{x:.234375,y:.984375},{x:.234375,y:.984375},{x:.265625,y:.984375},{x:.265625,y:.984375},{x:.296875,y:.984375},{x:.296875,y:.984375},{x:.328125,y:.984375},{x:.328125,y:.984375},{x:.359375,y:.984375},{x:.359375,y:.984375},{x:.390625,y:.984375},{x:.390625,y:.984375},{x:.421875,y:.984375},{x:.421875,y:.984375},{x:.453125,y:.984375},{x:.453125,y:.984375},{x:.484375,y:.984375},{x:.484375,y:.984375},{x:.515625,y:.984375},{x:.515625,y:.984375},{x:.546875,y:.984375},{x:.546875,y:.984375},{x:.578125,y:.984375},{x:.578125,y:.984375},{x:.609375,y:.984375},{x:.609375,y:.984375},{x:.640625,y:.984375},{x:.640625,y:.984375},{x:.671875,y:.984375},{x:.671875,y:.984375},{x:.703125,y:.984375},{x:.703125,y:.984375},{x:.734375,y:.984375},{x:.734375,y:.984375},{x:.765625,y:.984375},{x:.765625,y:.984375},{x:.796875,y:.984375},{x:.796875,y:.984375},{x:.828125,y:.984375},{x:.828125,y:.984375},{x:.859375,y:.984375},{x:.859375,y:.984375},{x:.890625,y:.984375},{x:.890625,y:.984375},{x:.921875,y:.984375},{x:.921875,y:.984375},{x:.953125,y:.984375},{x:.953125,y:.984375},{x:.984375,y:.984375},{x:.984375,y:.984375},{x:.03125,y:.03125},{x:.03125,y:.03125},{x:.09375,y:.03125},{x:.09375,y:.03125},{x:.15625,y:.03125},{x:.15625,y:.03125},{x:.21875,y:.03125},{x:.21875,y:.03125},{x:.28125,y:.03125},{x:.28125,y:.03125},{x:.34375,y:.03125},{x:.34375,y:.03125},{x:.40625,y:.03125},{x:.40625,y:.03125},{x:.46875,y:.03125},{x:.46875,y:.03125},{x:.53125,y:.03125},{x:.53125,y:.03125},{x:.59375,y:.03125},{x:.59375,y:.03125},{x:.65625,y:.03125},{x:.65625,y:.03125},{x:.71875,y:.03125},{x:.71875,y:.03125},{x:.78125,y:.03125},{x:.78125,y:.03125},{x:.84375,y:.03125},{x:.84375,y:.03125},{x:.90625,y:.03125},{x:.90625,y:.03125},{x:.96875,y:.03125},{x:.96875,y:.03125},{x:.03125,y:.09375},{x:.03125,y:.09375},{x:.09375,y:.09375},{x:.09375,y:.09375},{x:.15625,y:.09375},{x:.15625,y:.09375},{x:.21875,y:.09375},{x:.21875,y:.09375},{x:.28125,y:.09375},{x:.28125,y:.09375},{x:.34375,y:.09375},{x:.34375,y:.09375},{x:.40625,y:.09375},{x:.40625,y:.09375},{x:.46875,y:.09375},{x:.46875,y:.09375},{x:.53125,y:.09375},{x:.53125,y:.09375},{x:.59375,y:.09375},{x:.59375,y:.09375},{x:.65625,y:.09375},{x:.65625,y:.09375},{x:.71875,y:.09375},{x:.71875,y:.09375},{x:.78125,y:.09375},{x:.78125,y:.09375},{x:.84375,y:.09375},{x:.84375,y:.09375},{x:.90625,y:.09375},{x:.90625,y:.09375},{x:.96875,y:.09375},{x:.96875,y:.09375},{x:.03125,y:.15625},{x:.03125,y:.15625},{x:.09375,y:.15625},{x:.09375,y:.15625},{x:.15625,y:.15625},{x:.15625,y:.15625},{x:.21875,y:.15625},{x:.21875,y:.15625},{x:.28125,y:.15625},{x:.28125,y:.15625},{x:.34375,y:.15625},{x:.34375,y:.15625},{x:.40625,y:.15625},{x:.40625,y:.15625},{x:.46875,y:.15625},{x:.46875,y:.15625},{x:.53125,y:.15625},{x:.53125,y:.15625},{x:.59375,y:.15625},{x:.59375,y:.15625},{x:.65625,y:.15625},{x:.65625,y:.15625},{x:.71875,y:.15625},{x:.71875,y:.15625},{x:.78125,y:.15625},{x:.78125,y:.15625},{x:.84375,y:.15625},{x:.84375,y:.15625},{x:.90625,y:.15625},{x:.90625,y:.15625},{x:.96875,y:.15625},{x:.96875,y:.15625},{x:.03125,y:.21875},{x:.03125,y:.21875},{x:.09375,y:.21875},{x:.09375,y:.21875},{x:.15625,y:.21875},{x:.15625,y:.21875},{x:.21875,y:.21875},{x:.21875,y:.21875},{x:.28125,y:.21875},{x:.28125,y:.21875},{x:.34375,y:.21875},{x:.34375,y:.21875},{x:.40625,y:.21875},{x:.40625,y:.21875},{x:.46875,y:.21875},{x:.46875,y:.21875},{x:.53125,y:.21875},{x:.53125,y:.21875},{x:.59375,y:.21875},{x:.59375,y:.21875},{x:.65625,y:.21875},{x:.65625,y:.21875},{x:.71875,y:.21875},{x:.71875,y:.21875},{x:.78125,y:.21875},{x:.78125,y:.21875},{x:.84375,y:.21875},{x:.84375,y:.21875},{x:.90625,y:.21875},{x:.90625,y:.21875},{x:.96875,y:.21875},{x:.96875,y:.21875},{x:.03125,y:.28125},{x:.03125,y:.28125},{x:.09375,y:.28125},{x:.09375,y:.28125},{x:.15625,y:.28125},{x:.15625,y:.28125},{x:.21875,y:.28125},{x:.21875,y:.28125},{x:.28125,y:.28125},{x:.28125,y:.28125},{x:.34375,y:.28125},{x:.34375,y:.28125},{x:.40625,y:.28125},{x:.40625,y:.28125},{x:.46875,y:.28125},{x:.46875,y:.28125},{x:.53125,y:.28125},{x:.53125,y:.28125},{x:.59375,y:.28125},{x:.59375,y:.28125},{x:.65625,y:.28125},{x:.65625,y:.28125},{x:.71875,y:.28125},{x:.71875,y:.28125},{x:.78125,y:.28125},{x:.78125,y:.28125},{x:.84375,y:.28125},{x:.84375,y:.28125},{x:.90625,y:.28125},{x:.90625,y:.28125},{x:.96875,y:.28125},{x:.96875,y:.28125},{x:.03125,y:.34375},{x:.03125,y:.34375},{x:.09375,y:.34375},{x:.09375,y:.34375},{x:.15625,y:.34375},{x:.15625,y:.34375},{x:.21875,y:.34375},{x:.21875,y:.34375},{x:.28125,y:.34375},{x:.28125,y:.34375},{x:.34375,y:.34375},{x:.34375,y:.34375},{x:.40625,y:.34375},{x:.40625,y:.34375},{x:.46875,y:.34375},{x:.46875,y:.34375},{x:.53125,y:.34375},{x:.53125,y:.34375},{x:.59375,y:.34375},{x:.59375,y:.34375},{x:.65625,y:.34375},{x:.65625,y:.34375},{x:.71875,y:.34375},{x:.71875,y:.34375},{x:.78125,y:.34375},{x:.78125,y:.34375},{x:.84375,y:.34375},{x:.84375,y:.34375},{x:.90625,y:.34375},{x:.90625,y:.34375},{x:.96875,y:.34375},{x:.96875,y:.34375},{x:.03125,y:.40625},{x:.03125,y:.40625},{x:.09375,y:.40625},{x:.09375,y:.40625},{x:.15625,y:.40625},{x:.15625,y:.40625},{x:.21875,y:.40625},{x:.21875,y:.40625},{x:.28125,y:.40625},{x:.28125,y:.40625},{x:.34375,y:.40625},{x:.34375,y:.40625},{x:.40625,y:.40625},{x:.40625,y:.40625},{x:.46875,y:.40625},{x:.46875,y:.40625},{x:.53125,y:.40625},{x:.53125,y:.40625},{x:.59375,y:.40625},{x:.59375,y:.40625},{x:.65625,y:.40625},{x:.65625,y:.40625},{x:.71875,y:.40625},{x:.71875,y:.40625},{x:.78125,y:.40625},{x:.78125,y:.40625},{x:.84375,y:.40625},{x:.84375,y:.40625},{x:.90625,y:.40625},{x:.90625,y:.40625},{x:.96875,y:.40625},{x:.96875,y:.40625},{x:.03125,y:.46875},{x:.03125,y:.46875},{x:.09375,y:.46875},{x:.09375,y:.46875},{x:.15625,y:.46875},{x:.15625,y:.46875},{x:.21875,y:.46875},{x:.21875,y:.46875},{x:.28125,y:.46875},{x:.28125,y:.46875},{x:.34375,y:.46875},{x:.34375,y:.46875},{x:.40625,y:.46875},{x:.40625,y:.46875},{x:.46875,y:.46875},{x:.46875,y:.46875},{x:.53125,y:.46875},{x:.53125,y:.46875},{x:.59375,y:.46875},{x:.59375,y:.46875},{x:.65625,y:.46875},{x:.65625,y:.46875},{x:.71875,y:.46875},{x:.71875,y:.46875},{x:.78125,y:.46875},{x:.78125,y:.46875},{x:.84375,y:.46875},{x:.84375,y:.46875},{x:.90625,y:.46875},{x:.90625,y:.46875},{x:.96875,y:.46875},{x:.96875,y:.46875},{x:.03125,y:.53125},{x:.03125,y:.53125},{x:.09375,y:.53125},{x:.09375,y:.53125},{x:.15625,y:.53125},{x:.15625,y:.53125},{x:.21875,y:.53125},{x:.21875,y:.53125},{x:.28125,y:.53125},{x:.28125,y:.53125},{x:.34375,y:.53125},{x:.34375,y:.53125},{x:.40625,y:.53125},{x:.40625,y:.53125},{x:.46875,y:.53125},{x:.46875,y:.53125},{x:.53125,y:.53125},{x:.53125,y:.53125},{x:.59375,y:.53125},{x:.59375,y:.53125},{x:.65625,y:.53125},{x:.65625,y:.53125},{x:.71875,y:.53125},{x:.71875,y:.53125},{x:.78125,y:.53125},{x:.78125,y:.53125},{x:.84375,y:.53125},{x:.84375,y:.53125},{x:.90625,y:.53125},{x:.90625,y:.53125},{x:.96875,y:.53125},{x:.96875,y:.53125},{x:.03125,y:.59375},{x:.03125,y:.59375},{x:.09375,y:.59375},{x:.09375,y:.59375},{x:.15625,y:.59375},{x:.15625,y:.59375},{x:.21875,y:.59375},{x:.21875,y:.59375},{x:.28125,y:.59375},{x:.28125,y:.59375},{x:.34375,y:.59375},{x:.34375,y:.59375},{x:.40625,y:.59375},{x:.40625,y:.59375},{x:.46875,y:.59375},{x:.46875,y:.59375},{x:.53125,y:.59375},{x:.53125,y:.59375},{x:.59375,y:.59375},{x:.59375,y:.59375},{x:.65625,y:.59375},{x:.65625,y:.59375},{x:.71875,y:.59375},{x:.71875,y:.59375},{x:.78125,y:.59375},{x:.78125,y:.59375},{x:.84375,y:.59375},{x:.84375,y:.59375},{x:.90625,y:.59375},{x:.90625,y:.59375},{x:.96875,y:.59375},{x:.96875,y:.59375},{x:.03125,y:.65625},{x:.03125,y:.65625},{x:.09375,y:.65625},{x:.09375,y:.65625},{x:.15625,y:.65625},{x:.15625,y:.65625},{x:.21875,y:.65625},{x:.21875,y:.65625},{x:.28125,y:.65625},{x:.28125,y:.65625},{x:.34375,y:.65625},{x:.34375,y:.65625},{x:.40625,y:.65625},{x:.40625,y:.65625},{x:.46875,y:.65625},{x:.46875,y:.65625},{x:.53125,y:.65625},{x:.53125,y:.65625},{x:.59375,y:.65625},{x:.59375,y:.65625},{x:.65625,y:.65625},{x:.65625,y:.65625},{x:.71875,y:.65625},{x:.71875,y:.65625},{x:.78125,y:.65625},{x:.78125,y:.65625},{x:.84375,y:.65625},{x:.84375,y:.65625},{x:.90625,y:.65625},{x:.90625,y:.65625},{x:.96875,y:.65625},{x:.96875,y:.65625},{x:.03125,y:.71875},{x:.03125,y:.71875},{x:.09375,y:.71875},{x:.09375,y:.71875},{x:.15625,y:.71875},{x:.15625,y:.71875},{x:.21875,y:.71875},{x:.21875,y:.71875},{x:.28125,y:.71875},{x:.28125,y:.71875},{x:.34375,y:.71875},{x:.34375,y:.71875},{x:.40625,y:.71875},{x:.40625,y:.71875},{x:.46875,y:.71875},{x:.46875,y:.71875},{x:.53125,y:.71875},{x:.53125,y:.71875},{x:.59375,y:.71875},{x:.59375,y:.71875},{x:.65625,y:.71875},{x:.65625,y:.71875},{x:.71875,y:.71875},{x:.71875,y:.71875},{x:.78125,y:.71875},{x:.78125,y:.71875},{x:.84375,y:.71875},{x:.84375,y:.71875},{x:.90625,y:.71875},{x:.90625,y:.71875},{x:.96875,y:.71875},{x:.96875,y:.71875},{x:.03125,y:.78125},{x:.03125,y:.78125},{x:.09375,y:.78125},{x:.09375,y:.78125},{x:.15625,y:.78125},{x:.15625,y:.78125},{x:.21875,y:.78125},{x:.21875,y:.78125},{x:.28125,y:.78125},{x:.28125,y:.78125},{x:.34375,y:.78125},{x:.34375,y:.78125},{x:.40625,y:.78125},{x:.40625,y:.78125},{x:.46875,y:.78125},{x:.46875,y:.78125},{x:.53125,y:.78125},{x:.53125,y:.78125},{x:.59375,y:.78125},{x:.59375,y:.78125},{x:.65625,y:.78125},{x:.65625,y:.78125},{x:.71875,y:.78125},{x:.71875,y:.78125},{x:.78125,y:.78125},{x:.78125,y:.78125},{x:.84375,y:.78125},{x:.84375,y:.78125},{x:.90625,y:.78125},{x:.90625,y:.78125},{x:.96875,y:.78125},{x:.96875,y:.78125},{x:.03125,y:.84375},{x:.03125,y:.84375},{x:.09375,y:.84375},{x:.09375,y:.84375},{x:.15625,y:.84375},{x:.15625,y:.84375},{x:.21875,y:.84375},{x:.21875,y:.84375},{x:.28125,y:.84375},{x:.28125,y:.84375},{x:.34375,y:.84375},{x:.34375,y:.84375},{x:.40625,y:.84375},{x:.40625,y:.84375},{x:.46875,y:.84375},{x:.46875,y:.84375},{x:.53125,y:.84375},{x:.53125,y:.84375},{x:.59375,y:.84375},{x:.59375,y:.84375},{x:.65625,y:.84375},{x:.65625,y:.84375},{x:.71875,y:.84375},{x:.71875,y:.84375},{x:.78125,y:.84375},{x:.78125,y:.84375},{x:.84375,y:.84375},{x:.84375,y:.84375},{x:.90625,y:.84375},{x:.90625,y:.84375},{x:.96875,y:.84375},{x:.96875,y:.84375},{x:.03125,y:.90625},{x:.03125,y:.90625},{x:.09375,y:.90625},{x:.09375,y:.90625},{x:.15625,y:.90625},{x:.15625,y:.90625},{x:.21875,y:.90625},{x:.21875,y:.90625},{x:.28125,y:.90625},{x:.28125,y:.90625},{x:.34375,y:.90625},{x:.34375,y:.90625},{x:.40625,y:.90625},{x:.40625,y:.90625},{x:.46875,y:.90625},{x:.46875,y:.90625},{x:.53125,y:.90625},{x:.53125,y:.90625},{x:.59375,y:.90625},{x:.59375,y:.90625},{x:.65625,y:.90625},{x:.65625,y:.90625},{x:.71875,y:.90625},{x:.71875,y:.90625},{x:.78125,y:.90625},{x:.78125,y:.90625},{x:.84375,y:.90625},{x:.84375,y:.90625},{x:.90625,y:.90625},{x:.90625,y:.90625},{x:.96875,y:.90625},{x:.96875,y:.90625},{x:.03125,y:.96875},{x:.03125,y:.96875},{x:.09375,y:.96875},{x:.09375,y:.96875},{x:.15625,y:.96875},{x:.15625,y:.96875},{x:.21875,y:.96875},{x:.21875,y:.96875},{x:.28125,y:.96875},{x:.28125,y:.96875},{x:.34375,y:.96875},{x:.34375,y:.96875},{x:.40625,y:.96875},{x:.40625,y:.96875},{x:.46875,y:.96875},{x:.46875,y:.96875},{x:.53125,y:.96875},{x:.53125,y:.96875},{x:.59375,y:.96875},{x:.59375,y:.96875},{x:.65625,y:.96875},{x:.65625,y:.96875},{x:.71875,y:.96875},{x:.71875,y:.96875},{x:.78125,y:.96875},{x:.78125,y:.96875},{x:.84375,y:.96875},{x:.84375,y:.96875},{x:.90625,y:.96875},{x:.90625,y:.96875},{x:.96875,y:.96875},{x:.96875,y:.96875},{x:.0625,y:.0625},{x:.0625,y:.0625},{x:.0625,y:.0625},{x:.0625,y:.0625},{x:.0625,y:.0625},{x:.0625,y:.0625},{x:.1875,y:.0625},{x:.1875,y:.0625},{x:.1875,y:.0625},{x:.1875,y:.0625},{x:.1875,y:.0625},{x:.1875,y:.0625},{x:.3125,y:.0625},{x:.3125,y:.0625},{x:.3125,y:.0625},{x:.3125,y:.0625},{x:.3125,y:.0625},{x:.3125,y:.0625},{x:.4375,y:.0625},{x:.4375,y:.0625},{x:.4375,y:.0625},{x:.4375,y:.0625},{x:.4375,y:.0625},{x:.4375,y:.0625},{x:.5625,y:.0625},{x:.5625,y:.0625},{x:.5625,y:.0625},{x:.5625,y:.0625},{x:.5625,y:.0625},{x:.5625,y:.0625},{x:.6875,y:.0625},{x:.6875,y:.0625},{x:.6875,y:.0625},{x:.6875,y:.0625},{x:.6875,y:.0625},{x:.6875,y:.0625},{x:.8125,y:.0625},{x:.8125,y:.0625},{x:.8125,y:.0625},{x:.8125,y:.0625},{x:.8125,y:.0625},{x:.8125,y:.0625},{x:.9375,y:.0625},{x:.9375,y:.0625},{x:.9375,y:.0625},{x:.9375,y:.0625},{x:.9375,y:.0625},{x:.9375,y:.0625},{x:.0625,y:.1875},{x:.0625,y:.1875},{x:.0625,y:.1875},{x:.0625,y:.1875},{x:.0625,y:.1875},{x:.0625,y:.1875},{x:.1875,y:.1875},{x:.1875,y:.1875},{x:.1875,y:.1875},{x:.1875,y:.1875},{x:.1875,y:.1875},{x:.1875,y:.1875},{x:.3125,y:.1875},{x:.3125,y:.1875},{x:.3125,y:.1875},{x:.3125,y:.1875},{x:.3125,y:.1875},{x:.3125,y:.1875},{x:.4375,y:.1875},{x:.4375,y:.1875},{x:.4375,y:.1875},{x:.4375,y:.1875},{x:.4375,y:.1875},{x:.4375,y:.1875},{x:.5625,y:.1875},{x:.5625,y:.1875},{x:.5625,y:.1875},{x:.5625,y:.1875},{x:.5625,y:.1875},{x:.5625,y:.1875},{x:.6875,y:.1875},{x:.6875,y:.1875},{x:.6875,y:.1875},{x:.6875,y:.1875},{x:.6875,y:.1875},{x:.6875,y:.1875},{x:.8125,y:.1875},{x:.8125,y:.1875},{x:.8125,y:.1875},{x:.8125,y:.1875},{x:.8125,y:.1875},{x:.8125,y:.1875},{x:.9375,y:.1875},{x:.9375,y:.1875},{x:.9375,y:.1875},{x:.9375,y:.1875},{x:.9375,y:.1875},{x:.9375,y:.1875},{x:.0625,y:.3125},{x:.0625,y:.3125},{x:.0625,y:.3125},{x:.0625,y:.3125},{x:.0625,y:.3125},{x:.0625,y:.3125},{x:.1875,y:.3125},{x:.1875,y:.3125},{x:.1875,y:.3125},{x:.1875,y:.3125},{x:.1875,y:.3125},{x:.1875,y:.3125},{x:.3125,y:.3125},{x:.3125,y:.3125},{x:.3125,y:.3125},{x:.3125,y:.3125},{x:.3125,y:.3125},{x:.3125,y:.3125},{x:.4375,y:.3125},{x:.4375,y:.3125},{x:.4375,y:.3125},{x:.4375,y:.3125},{x:.4375,y:.3125},{x:.4375,y:.3125},{x:.5625,y:.3125},{x:.5625,y:.3125},{x:.5625,y:.3125},{x:.5625,y:.3125},{x:.5625,y:.3125},{x:.5625,y:.3125},{x:.6875,y:.3125},{x:.6875,y:.3125},{x:.6875,y:.3125},{x:.6875,y:.3125},{x:.6875,y:.3125},{x:.6875,y:.3125},{x:.8125,y:.3125},{x:.8125,y:.3125},{x:.8125,y:.3125},{x:.8125,y:.3125},{x:.8125,y:.3125},{x:.8125,y:.3125},{x:.9375,y:.3125},{x:.9375,y:.3125},{x:.9375,y:.3125},{x:.9375,y:.3125},{x:.9375,y:.3125},{x:.9375,y:.3125},{x:.0625,y:.4375},{x:.0625,y:.4375},{x:.0625,y:.4375},{x:.0625,y:.4375},{x:.0625,y:.4375},{x:.0625,y:.4375},{x:.1875,y:.4375},{x:.1875,y:.4375},{x:.1875,y:.4375},{x:.1875,y:.4375},{x:.1875,y:.4375},{x:.1875,y:.4375},{x:.3125,y:.4375},{x:.3125,y:.4375},{x:.3125,y:.4375},{x:.3125,y:.4375},{x:.3125,y:.4375},{x:.3125,y:.4375},{x:.4375,y:.4375},{x:.4375,y:.4375},{x:.4375,y:.4375},{x:.4375,y:.4375},{x:.4375,y:.4375},{x:.4375,y:.4375},{x:.5625,y:.4375},{x:.5625,y:.4375},{x:.5625,y:.4375},{x:.5625,y:.4375},{x:.5625,y:.4375},{x:.5625,y:.4375},{x:.6875,y:.4375},{x:.6875,y:.4375},{x:.6875,y:.4375},{x:.6875,y:.4375},{x:.6875,y:.4375},{x:.6875,y:.4375},{x:.8125,y:.4375},{x:.8125,y:.4375},{x:.8125,y:.4375},{x:.8125,y:.4375},{x:.8125,y:.4375},{x:.8125,y:.4375},{x:.9375,y:.4375},{x:.9375,y:.4375},{x:.9375,y:.4375},{x:.9375,y:.4375},{x:.9375,y:.4375},{x:.9375,y:.4375},{x:.0625,y:.5625},{x:.0625,y:.5625},{x:.0625,y:.5625},{x:.0625,y:.5625},{x:.0625,y:.5625},{x:.0625,y:.5625},{x:.1875,y:.5625},{x:.1875,y:.5625},{x:.1875,y:.5625},{x:.1875,y:.5625},{x:.1875,y:.5625},{x:.1875,y:.5625},{x:.3125,y:.5625},{x:.3125,y:.5625},{x:.3125,y:.5625},{x:.3125,y:.5625},{x:.3125,y:.5625},{x:.3125,y:.5625},{x:.4375,y:.5625},{x:.4375,y:.5625},{x:.4375,y:.5625},{x:.4375,y:.5625},{x:.4375,y:.5625},{x:.4375,y:.5625},{x:.5625,y:.5625},{x:.5625,y:.5625},{x:.5625,y:.5625},{x:.5625,y:.5625},{x:.5625,y:.5625},{x:.5625,y:.5625},{x:.6875,y:.5625},{x:.6875,y:.5625},{x:.6875,y:.5625},{x:.6875,y:.5625},{x:.6875,y:.5625},{x:.6875,y:.5625},{x:.8125,y:.5625},{x:.8125,y:.5625},{x:.8125,y:.5625},{x:.8125,y:.5625},{x:.8125,y:.5625},{x:.8125,y:.5625},{x:.9375,y:.5625},{x:.9375,y:.5625},{x:.9375,y:.5625},{x:.9375,y:.5625},{x:.9375,y:.5625},{x:.9375,y:.5625},{x:.0625,y:.6875},{x:.0625,y:.6875},{x:.0625,y:.6875},{x:.0625,y:.6875},{x:.0625,y:.6875},{x:.0625,y:.6875},{x:.1875,y:.6875},{x:.1875,y:.6875},{x:.1875,y:.6875},{x:.1875,y:.6875},{x:.1875,y:.6875},{x:.1875,y:.6875},{x:.3125,y:.6875},{x:.3125,y:.6875},{x:.3125,y:.6875},{x:.3125,y:.6875},{x:.3125,y:.6875},{x:.3125,y:.6875},{x:.4375,y:.6875},{x:.4375,y:.6875},{x:.4375,y:.6875},{x:.4375,y:.6875},{x:.4375,y:.6875},{x:.4375,y:.6875},{x:.5625,y:.6875},{x:.5625,y:.6875},{x:.5625,y:.6875},{x:.5625,y:.6875},{x:.5625,y:.6875},{x:.5625,y:.6875},{x:.6875,y:.6875},{x:.6875,y:.6875},{x:.6875,y:.6875},{x:.6875,y:.6875},{x:.6875,y:.6875},{x:.6875,y:.6875},{x:.8125,y:.6875},{x:.8125,y:.6875},{x:.8125,y:.6875},{x:.8125,y:.6875},{x:.8125,y:.6875},{x:.8125,y:.6875},{x:.9375,y:.6875},{x:.9375,y:.6875},{x:.9375,y:.6875},{x:.9375,y:.6875},{x:.9375,y:.6875},{x:.9375,y:.6875},{x:.0625,y:.8125},{x:.0625,y:.8125},{x:.0625,y:.8125},{x:.0625,y:.8125},{x:.0625,y:.8125},{x:.0625,y:.8125},{x:.1875,y:.8125},{x:.1875,y:.8125},{x:.1875,y:.8125},{x:.1875,y:.8125},{x:.1875,y:.8125},{x:.1875,y:.8125},{x:.3125,y:.8125},{x:.3125,y:.8125},{x:.3125,y:.8125},{x:.3125,y:.8125},{x:.3125,y:.8125},{x:.3125,y:.8125},{x:.4375,y:.8125},{x:.4375,y:.8125},{x:.4375,y:.8125},{x:.4375,y:.8125},{x:.4375,y:.8125},{x:.4375,y:.8125},{x:.5625,y:.8125},{x:.5625,y:.8125},{x:.5625,y:.8125},{x:.5625,y:.8125},{x:.5625,y:.8125},{x:.5625,y:.8125},{x:.6875,y:.8125},{x:.6875,y:.8125},{x:.6875,y:.8125},{x:.6875,y:.8125},{x:.6875,y:.8125},{x:.6875,y:.8125},{x:.8125,y:.8125},{x:.8125,y:.8125},{x:.8125,y:.8125},{x:.8125,y:.8125},{x:.8125,y:.8125},{x:.8125,y:.8125},{x:.9375,y:.8125},{x:.9375,y:.8125},{x:.9375,y:.8125},{x:.9375,y:.8125},{x:.9375,y:.8125},{x:.9375,y:.8125},{x:.0625,y:.9375},{x:.0625,y:.9375},{x:.0625,y:.9375},{x:.0625,y:.9375},{x:.0625,y:.9375},{x:.0625,y:.9375},{x:.1875,y:.9375},{x:.1875,y:.9375},{x:.1875,y:.9375},{x:.1875,y:.9375},{x:.1875,y:.9375},{x:.1875,y:.9375},{x:.3125,y:.9375},{x:.3125,y:.9375},{x:.3125,y:.9375},{x:.3125,y:.9375},{x:.3125,y:.9375},{x:.3125,y:.9375},{x:.4375,y:.9375},{x:.4375,y:.9375},{x:.4375,y:.9375},{x:.4375,y:.9375},{x:.4375,y:.9375},{x:.4375,y:.9375},{x:.5625,y:.9375},{x:.5625,y:.9375},{x:.5625,y:.9375},{x:.5625,y:.9375},{x:.5625,y:.9375},{x:.5625,y:.9375},{x:.6875,y:.9375},{x:.6875,y:.9375},{x:.6875,y:.9375},{x:.6875,y:.9375},{x:.6875,y:.9375},{x:.6875,y:.9375},{x:.8125,y:.9375},{x:.8125,y:.9375},{x:.8125,y:.9375},{x:.8125,y:.9375},{x:.8125,y:.9375},{x:.8125,y:.9375},{x:.9375,y:.9375},{x:.9375,y:.9375},{x:.9375,y:.9375},{x:.9375,y:.9375},{x:.9375,y:.9375},{x:.9375,y:.9375}];var jb=class{constructor(t){var n;this.model=t,this.anchors=LM.map(a=>[a.x,a.y]),this.anchorsTensor=ns(this.anchors),this.inputSize=(n=this.model)==null?void 0:n.inputs[0].shape[2],this.inputSizeTensor=oa([this.inputSize,this.inputSize]),this.doubleInputSizeTensor=oa([this.inputSize*2,this.inputSize*2])}normalizeBoxes(t){return Ue(()=>{let n=Ze(t,[0,0],[-1,2]),a=Ze(t,[0,2],[-1,2]),r=De(Qe(n,this.inputSizeTensor),this.anchorsTensor),s=Qe(a,this.doubleInputSizeTensor),i=fe(je(r,s),this.inputSizeTensor),o=fe(De(r,s),this.inputSizeTensor);return ld([i,o],1)})}normalizeLandmarks(t,n){return Ue(()=>{let a=De(Qe(t.reshape([-1,7,2]),this.inputSizeTensor),this.anchors[n]);return fe(a,this.inputSizeTensor)})}async getBoxes(t,n){let a=this.model.predict(t),r=Yn(a);a.dispose();let s=Ue(()=>Sr(Ze(r,[0,0],[-1,1])).squeeze()),i=s.dataSync(),o=Ze(r,[0,1],[-1,4]),l=this.normalizeBoxes(o);o.dispose();let u=await Ye.nonMaxSuppressionAsync(l,i,n.hand.maxDetected,n.hand.iouThreshold,n.hand.minConfidence),d=u.arraySync();s.dispose(),u.dispose();let h=[];for(let p of d)if(i[p]>=n.hand.minConfidence){let c=Ze(l,[p,0],[1,-1]),m=Ze(r,[p,5],[1,14]),f=Ue(()=>this.normalizeLandmarks(m,p).reshape([-1,2]));m.dispose(),h.push({box:c,palmLandmarks:f,confidence:i[p]})}return r.dispose(),l.dispose(),h}async estimateHandBounds(t,n){let a=t.shape[1],r=t.shape[2],s=Ue(()=>t.resizeBilinear([this.inputSize,this.inputSize]).div(127.5).sub(1)),i=await this.getBoxes(s,n);s.dispose();let o=[];if(!i||i.length===0)return o;for(let l of i){let u=l.box.dataSync(),d=u.slice(0,2),h=u.slice(2,4),p=l.palmLandmarks.arraySync();l.box.dispose(),l.palmLandmarks.dispose(),o.push(PM({startPoint:d,endPoint:h,palmLandmarks:p,confidence:l.confidence},[r/this.inputSize,a/this.inputSize]))}return o}};function Xve(e){return e-2*Math.PI*Math.floor((e+Math.PI)/(2*Math.PI))}function WM(e,t){let n=Math.PI/2-Math.atan2(-(t[1]-e[1]),t[0]-e[0]);return Xve(n)}var BM=(e,t)=>[[1,0,e],[0,1,t],[0,0,1]];function ai(e,t){let n=0;for(let a=0;ai[0]),a=t.map(i=>i[1]),r=[Math.min(...n),Math.min(...a)],s=[Math.max(...n),Math.max(...a)];return{startPoint:r,endPoint:s}}getBoxForPalmLandmarks(t,n){let a=t.map(s=>Gb([...s,1],n)),r=this.calculateLandmarksBoundingBox(a);return cm(fm(r),Yve)}getBoxForHandLandmarks(t){let n=this.calculateLandmarksBoundingBox(t),a=cm(fm(n),jM);a.palmLandmarks=[];for(let r=0;r[i[0]*(c[0]-this.inputSize/2),i[1]*(c[1]-this.inputSize/2),i[2]*c[2]]),l=Hb(a,[0,0]),u=o.map(c=>[...Gb(c,l),c[2]]),d=UM(r),h=[...Sp(n),1],p=[ai(h,d[0]),ai(h,d[1])];return u.map(c=>[Math.trunc(c[0]+p[0]),Math.trunc(c[1]+p[1]),Math.trunc(c[2])])}async estimateHands(t,n){let a=!1,r;(this.skipped===0||this.skipped>n.hand.skipFrames||!n.hand.landmarks||!n.skipFrame)&&(r=await this.handDetector.estimateHandBounds(t,n),this.skipped=0),n.skipFrame&&this.skipped++,r&&r.length>0&&(r.length!==this.detectedHands&&this.detectedHands!==n.hand.maxDetected||!n.hand.landmarks)&&(this.detectedHands=0,this.storedBoxes=[...r],this.storedBoxes.length>0&&(a=!0));let s=[];for(let i=0;i=n.hand.minConfidence){let x=le(y,[-1,3]),v=x.arraySync();y.dispose(),x.dispose();let b=this.transformRawCoords(v,c,l,p),w=this.getBoxForHandLandmarks(b);this.storedBoxes[i]={...w,confidence:A};let I={landmarks:b,confidence:A,box:{topLeft:w.startPoint,bottomRight:w.endPoint}};s.push(I)}else this.storedBoxes[i]=null;y.dispose()}else{let l=cm(fm(o),jM),u={confidence:o.confidence,box:{topLeft:l.startPoint,bottomRight:l.endPoint}};s.push(u)}}return this.storedBoxes=this.storedBoxes.filter(i=>i!==null),this.detectedHands=s.length,s}};var GM={thumb:[1,2,3,4],indexFinger:[5,6,7,8],middleFinger:[9,10,11,12],ringFinger:[13,14,15,16],pinky:[17,18,19,20],palmBase:[0]},ri,si,qM;async function Kb(e,t){let n=await qM.estimateHands(e,t);if(!n)return[];let a=[];for(let r=0;rn[r].landmarks[d]);let i=n[r].landmarks,o=[Number.MAX_SAFE_INTEGER,Number.MAX_SAFE_INTEGER,0,0],l=[0,0,0,0];if(i&&i.length>0){for(let u of i)u[0]o[2]&&(o[2]=u[0]),u[1]>o[3]&&(o[3]=u[1]);o[2]-=o[0],o[3]-=o[1],l=[o[0]/(e.shape[2]||0),o[1]/(e.shape[1]||0),o[2]/(e.shape[2]||0),o[3]/(e.shape[1]||0)]}else o=n[r].box?[Math.trunc(Math.max(0,n[r].box.topLeft[0])),Math.trunc(Math.max(0,n[r].box.topLeft[1])),Math.trunc(Math.min(e.shape[2]||0,n[r].box.bottomRight[0])-Math.max(0,n[r].box.topLeft[0])),Math.trunc(Math.min(e.shape[1]||0,n[r].box.bottomRight[1])-Math.max(0,n[r].box.topLeft[1]))]:[0,0,0,0],l=[n[r].box.topLeft[0]/(e.shape[2]||0),n[r].box.topLeft[1]/(e.shape[1]||0),(n[r].box.bottomRight[0]-n[r].box.topLeft[0])/(e.shape[2]||0),(n[r].box.bottomRight[1]-n[r].box.topLeft[1])/(e.shape[1]||0)];a.push({id:r,score:Math.round(100*n[r].confidence)/100,box:o,boxRaw:l,keypoints:i,annotations:s})}return a}async function Xb(e){!ri||!si?([ri,si]=await Promise.all([e.hand.enabled?Et(Mt(e.modelBasePath,e.hand.detector.modelPath),{fromTFHub:e.hand.detector.modelPath.includes("tfhub.dev")}):null,e.hand.landmarks?Et(Mt(e.modelBasePath,e.hand.skeleton.modelPath),{fromTFHub:e.hand.skeleton.modelPath.includes("tfhub.dev")}):null]),e.hand.enabled&&(!ri||!ri.modelUrl?ge("load model failed:",e.hand.detector.modelPath):e.debug&&ge("load model:",ri.modelUrl),!si||!si.modelUrl?ge("load model failed:",e.hand.skeleton.modelPath):e.debug&&ge("load model:",si.modelUrl))):(e.debug&&ge("cached model:",ri.modelUrl),e.debug&&ge("cached model:",si.modelUrl));let t=new jb(ri);return qM=new qb(t,si),[ri,si]}var KM=["nose","leftEyeInside","leftEye","leftEyeOutside","rightEyeInside","rightEye","rightEyeOutside","leftEar","rightEar","leftMouth","rightMouth","leftShoulder","rightShoulder","leftElbow","rightElbow","leftWrist","rightWrist","leftPalm","rightPalm","leftIndex","rightIndex","leftPinky","rightPinky","leftHip","rightHip","leftKnee","rightKnee","leftAnkle","rightAnkle","leftHeel","rightHeel","leftFoot","rightFoot","midHip","forehead","leftThumb","leftHand","rightThumb","rightHand"],XM=["nose","leftEyeInside","leftEye","leftEyeOutside","rightEyeInside","rightEye","rightEyeOutside","leftEar","rightEar","leftMouth","rightMouth","leftShoulder","rightShoulder","leftElbow","rightElbow","left:15","right:16","left:17","right:18","left:19","right:20","left:21","right:22","leftChest","rightChest","neck","forehead","left:27","right:28","left:29","right:30"];var aa;async function mm(e){return aa?e.debug&&ge("cached model:",aa.modelUrl):(aa=await Et(Mt(e.modelBasePath,e.body.modelPath)),aa.width=parseInt(aa.signature.inputs["input_1:0"].tensorShape.dim[2].size),aa.height=parseInt(aa.signature.inputs["input_1:0"].tensorShape.dim[1].size),!aa||!aa.modelUrl?ge("load model failed:",e.body.modelPath):e.debug&&ge("load model:",aa.modelUrl)),aa}async function Zb(e,t){var f;if(!aa)return[];if(!t.body.enabled)return[];let n={width:e.shape[2]||0,height:e.shape[1]||0},a=Ye.resizeBilinear(e,[aa.width,aa.height],!1),r=Qe(a,[255]);a.dispose();let s=await aa.predict(r),i=((f=s.find(g=>g.size===195||g.size===155))==null?void 0:f.dataSync())||[];s.forEach(g=>g.dispose()),r.dispose();let o=[],l=(i==null?void 0:i.length)===195?KM:XM,u=5;for(let g=0;gg.position[0]),h=o.map(g=>g.position[1]),p=[Math.min(...d),Math.min(...h),Math.max(...d)-Math.min(...d),Math.max(...h)-Math.min(...d)],c=[0,0,0,0],m=o.reduce((g,y)=>y.score>g?y.score:g,0);return[{id:0,score:m,box:p,boxRaw:c,keypoints:o}]}var ra,Wr=[],Yb=[0,0,0,0],Jb=[0,0,0,0],gm=0,Qb=Number.MAX_SAFE_INTEGER,ewe=["head","neck","rightShoulder","rightElbow","rightWrist","chest","leftShoulder","leftElbow","leftWrist","pelvis","rightHip","rightKnee","rightAnkle","leftHip","leftKnee","leftAnkle"];async function ZM(e){return ra?e.debug&&ge("cached model:",ra.modelUrl):(ra=await Et(Mt(e.modelBasePath,e.body.modelPath)),!ra||!ra.modelUrl?ge("load model failed:",e.body.modelPath):e.debug&&ge("load model:",ra.modelUrl)),ra}function twe(e,t){let[n,a]=e.shape;return Ue(()=>{let r=(o,l)=>je(o,fe(Qe(o,dt(l,"int32")),dt(l,"int32"))),s=le(e,[a*n]),i=$s(s,0).dataSync()[0];if(i>t){let o=Xy(s,0),l=r(o,n).dataSync()[0],u=Qe(o,dt(n,"int32")).dataSync()[0];return[l,u,i]}return[0,0,i]})}async function e3(e,t){return Qb0?(Qb++,[{id:0,score:gm,box:Yb,boxRaw:Jb,keypoints:Wr}]):(Qb=0,new Promise(async n=>{let a=Ue(()=>{if(!ra.inputs[0].shape)return null;let u=Ye.resizeBilinear(e,[ra.inputs[0].shape[2],ra.inputs[0].shape[1]],!1);return fe(u,2).sub(1)}),r;if(t.body.enabled&&(r=await ra.predict(a)),a.dispose(),r){Wr.length=0;let u=r.squeeze();Ve(r);let d=u.unstack(2);Ve(u);for(let h=0;ht.body.minConfidence&&Wr.push({score:Math.round(100*m)/100,part:ewe[h],positionRaw:[p/ra.inputs[0].shape[2],c/ra.inputs[0].shape[1]],position:[Math.round(e.shape[2]*p/ra.inputs[0].shape[2]),Math.round(e.shape[1]*c/ra.inputs[0].shape[1])]})}d.forEach(h=>Ve(h))}gm=Wr.reduce((u,d)=>d.score>u?d.score:u,0);let s=Wr.map(u=>u.position[0]),i=Wr.map(u=>u.position[1]);Yb=[Math.min(...s),Math.min(...i),Math.max(...s)-Math.min(...s),Math.max(...i)-Math.min(...i)];let o=Wr.map(u=>u.positionRaw[0]),l=Wr.map(u=>u.positionRaw[1]);Jb=[Math.min(...o),Math.min(...l),Math.max(...o)-Math.min(...o),Math.max(...l)-Math.min(...l)],n([{id:0,score:gm,box:Yb,boxRaw:Jb,keypoints:Wr}])}))}var br,Br=[],t3=[0,0,0,0],n3=[0,0,0,0],$u=0,a3=Number.MAX_SAFE_INTEGER,nwe=["nose","leftEye","rightEye","leftEar","rightEar","leftShoulder","rightShoulder","leftElbow","rightElbow","leftWrist","rightWrist","leftHip","rightHip","leftKnee","rightKnee","leftAnkle","rightAnkle"];async function r3(e){return br?e.debug&&ge("cached model:",br.modelUrl):(br=await Et(Mt(e.modelBasePath,e.body.modelPath)),!br||!br.modelUrl?ge("load model failed:",e.body.modelPath):e.debug&&ge("load model:",br.modelUrl)),br}async function s3(e,t){return a30?(a3++,[{id:0,score:$u,box:t3,boxRaw:n3,keypoints:Br}]):(a3=0,new Promise(async n=>{let a=Ue(()=>{if(!br.inputs[0].shape)return null;let u=Ye.resizeBilinear(e,[br.inputs[0].shape[2],br.inputs[0].shape[1]],!1);return zt(u,"int32")}),r;if(t.body.enabled&&(r=await br.predict(a)),a.dispose(),r){Br.length=0;let u=r.arraySync();Ve(r);let d=u[0][0];for(let h=0;ht.body.minConfidence&&Br.push({score:Math.round(100*$u)/100,part:nwe[h],positionRaw:[d[h][1],d[h][0]],position:[Math.round((e.shape[2]||0)*d[h][1]),Math.round((e.shape[1]||0)*d[h][0])]})}$u=Br.reduce((u,d)=>d.score>u?d.score:u,0);let s=Br.map(u=>u.position[0]),i=Br.map(u=>u.position[1]);t3=[Math.min(...s),Math.min(...i),Math.max(...s)-Math.min(...s),Math.max(...i)-Math.min(...i)];let o=Br.map(u=>u.positionRaw[0]),l=Br.map(u=>u.positionRaw[1]);n3=[Math.min(...o),Math.min(...l),Math.max(...o)-Math.min(...o),Math.max(...l)-Math.min(...l)],n([{id:0,score:$u,box:t3,boxRaw:n3,keypoints:Br}])}))}var Ru=[{class:1,label:"person"},{class:2,label:"bicycle"},{class:3,label:"car"},{class:4,label:"motorcycle"},{class:5,label:"airplane"},{class:6,label:"bus"},{class:7,label:"train"},{class:8,label:"truck"},{class:9,label:"boat"},{class:10,label:"traffic light"},{class:11,label:"fire hydrant"},{class:12,label:"stop sign"},{class:13,label:"parking meter"},{class:14,label:"bench"},{class:15,label:"bird"},{class:16,label:"cat"},{class:17,label:"dog"},{class:18,label:"horse"},{class:19,label:"sheep"},{class:20,label:"cow"},{class:21,label:"elephant"},{class:22,label:"bear"},{class:23,label:"zebra"},{class:24,label:"giraffe"},{class:25,label:"backpack"},{class:26,label:"umbrella"},{class:27,label:"handbag"},{class:28,label:"tie"},{class:29,label:"suitcase"},{class:30,label:"frisbee"},{class:31,label:"skis"},{class:32,label:"snowboard"},{class:33,label:"sports ball"},{class:34,label:"kite"},{class:35,label:"baseball bat"},{class:36,label:"baseball glove"},{class:37,label:"skateboard"},{class:38,label:"surfboard"},{class:39,label:"tennis racket"},{class:40,label:"bottle"},{class:41,label:"wine glass"},{class:42,label:"cup"},{class:43,label:"fork"},{class:44,label:"knife"},{class:45,label:"spoon"},{class:46,label:"bowl"},{class:47,label:"banana"},{class:48,label:"apple"},{class:49,label:"sandwich"},{class:50,label:"orange"},{class:51,label:"broccoli"},{class:52,label:"carrot"},{class:53,label:"hot dog"},{class:54,label:"pizza"},{class:55,label:"donut"},{class:56,label:"cake"},{class:57,label:"chair"},{class:58,label:"couch"},{class:59,label:"potted plant"},{class:60,label:"bed"},{class:61,label:"dining table"},{class:62,label:"toilet"},{class:63,label:"tv"},{class:64,label:"laptop"},{class:65,label:"mouse"},{class:66,label:"remote"},{class:67,label:"keyboard"},{class:68,label:"cell phone"},{class:69,label:"microwave"},{class:70,label:"oven"},{class:71,label:"toaster"},{class:72,label:"sink"},{class:73,label:"refrigerator"},{class:74,label:"book"},{class:75,label:"clock"},{class:76,label:"vase"},{class:77,label:"scissors"},{class:78,label:"teddy bear"},{class:79,label:"hair drier"},{class:80,label:"toothbrush"}];var ya,i3=[],o3=Number.MAX_SAFE_INTEGER,ym=2.5;async function l3(e){if(ya)e.debug&&ge("cached model:",ya.modelUrl);else{ya=await Et(Mt(e.modelBasePath,e.object.modelPath));let t=Object.values(ya.modelSignature.inputs);if(ya.inputSize=Array.isArray(t)?parseInt(t[0].tensorShape.dim[2].size):null,!ya.inputSize)throw new Error(`Human: Cannot determine model inputSize: ${e.object.modelPath}`);!ya||!ya.modelUrl?ge("load model failed:",e.object.modelPath):e.debug&&ge("load model:",ya.modelUrl)}return ya}async function awe(e,t,n,a){let r=0,s=[];for(let u of[1,2,4])Ue(()=>{var g,y;let d=u*13,h=(g=e.find(A=>A.shape[1]===d**2&&A.shape[2]===Ru.length))==null?void 0:g.squeeze(),p=(y=e.find(A=>A.shape[1]===d**2&&A.shape[2]a.object.minConfidence&&x!==61){let b=(.5+Math.trunc(A%d))/d,w=(.5+Math.trunc(A/d))/d,I=m[A].map(W=>W*(d/u/t)),[T,C]=[b-ym/u*I[0],w-ym/u*I[1]],[z,$]=[b+ym/u*I[2]-T,w+ym/u*I[3]-C],S=[T,C,z,$];S=S.map(W=>Math.max(0,Math.min(W,1)));let D=[S[0]*n[0],S[1]*n[1],S[2]*n[0],S[3]*n[1]],_={id:r++,score:Math.round(100*v)/100,class:x+1,label:Ru[x].label,box:D.map(W=>Math.trunc(W)),boxRaw:S};s.push(_)}}});e.forEach(u=>Ve(u));let i=s.map(u=>[u.boxRaw[1],u.boxRaw[0],u.boxRaw[3],u.boxRaw[2]]),o=s.map(u=>u.score),l=[];if(i&&i.length>0){let u=await Ye.nonMaxSuppressionAsync(i,o,a.object.maxDetected,a.object.iouThreshold,a.object.minConfidence);l=u.dataSync(),Ve(u)}return s=s.filter((u,d)=>l.includes(d)).sort((u,d)=>d.score-u.score),s}async function u3(e,t){return o30?(o3++,i3):(o3=0,new Promise(async n=>{let a=[e.shape[2],e.shape[1]],r=Ye.resizeBilinear(e,[ya.inputSize,ya.inputSize],!1),s=r.div(255),i=s.transpose([0,3,1,2]);s.dispose(),r.dispose();let o;t.object.enabled&&(o=await ya.predict(i)),i.dispose();let l=await awe(o,ya.inputSize,a,t);i3=l,n(l)}))}var Aa,d3=[],h3=Number.MAX_SAFE_INTEGER;async function p3(e){if(Aa)e.debug&&ge("cached model:",Aa.modelUrl);else{Aa=await Et(Mt(e.modelBasePath,e.object.modelPath));let t=Object.values(Aa.modelSignature.inputs);if(Aa.inputSize=Array.isArray(t)?parseInt(t[0].tensorShape.dim[2].size):null,!Aa.inputSize)throw new Error(`Human: Cannot determine model inputSize: ${e.object.modelPath}`);!Aa||!Aa.modelUrl?ge("load model failed:",e.object.modelPath):e.debug&&ge("load model:",Aa.modelUrl)}return Aa}async function rwe(e,t,n,a){if(!e)return[];let r=[],s=e.arraySync(),i=Yn(e);e.dispose();let o=es(i,6,1);i.dispose();let u=Ii([o[1],o[0],o[3],o[2]],1).squeeze(),d=o[4].squeeze(),h=o[5].squeeze();o.forEach(f=>f.dispose());let p=await Ye.nonMaxSuppressionAsync(u,d,a.object.maxDetected,a.object.iouThreshold,a.object.minConfidence);u.dispose(),d.dispose(),h.dispose();let c=p.dataSync();p.dispose();let m=0;for(let f of c){let g=Math.trunc(100*s[0][f][4])/100,y=s[0][f][5],A=Ru[y].label,x=[s[0][f][0]/t,s[0][f][1]/t,s[0][f][2]/t,s[0][f][3]/t],v=[Math.trunc(x[0]*n[0]),Math.trunc(x[1]*n[1]),Math.trunc(x[2]*n[0]),Math.trunc(x[3]*n[1])];r.push({id:m++,score:g,class:y,label:A,box:v,boxRaw:x})}return r}async function c3(e,t){return h30?(h3++,d3):(h3=0,new Promise(async n=>{let a=[e.shape[2],e.shape[1]],r=Ye.resizeBilinear(e,[Aa.inputSize,Aa.inputSize]),s=t.object.enabled?Aa.execute(r,["tower_0/detections"]):null;r.dispose();let i=await rwe(s,Aa.inputSize,a,t);d3=i,n(i)}))}var YM=e=>{if(!e)return[];let t=[];for(let n=0;nl.part==="leftWrist"),r=e[n].keypoints.find(l=>l.part==="rightWrist"),s=e[n].keypoints.find(l=>l.part==="nose");s&&a&&r&&a.position.yl.part==="leftShoulder"),o=e[n].keypoints.find(l=>l.part==="rightShoulder");i&&o&&t.push({body:n,gesture:`leaning ${i.position.y>o.position.y?"left":"right"}`})}return t},JM=e=>{if(!e)return[];let t=[];for(let n=0;n0){let a=e[n].mesh[33][2]-e[n].mesh[263][2];Math.abs(a)<10?t.push({face:n,gesture:"facing center"}):t.push({face:n,gesture:`facing ${a<0?"left":"right"}`}),Math.abs(e[n].mesh[374][1]-e[n].mesh[386][1])/Math.abs(e[n].mesh[443][1]-e[n].mesh[450][1])<.2&&t.push({face:n,gesture:"blink left eye"}),Math.abs(e[n].mesh[145][1]-e[n].mesh[159][1])/Math.abs(e[n].mesh[223][1]-e[n].mesh[230][1])<.2&&t.push({face:n,gesture:"blink right eye"});let i=Math.min(100,500*Math.abs(e[n].mesh[13][1]-e[n].mesh[14][1])/Math.abs(e[n].mesh[10][1]-e[n].mesh[152][1]));i>10&&t.push({face:n,gesture:`mouth ${Math.trunc(i)}% open`});let o=e[n].mesh[152][2];Math.abs(o)>10&&t.push({face:n,gesture:`head ${o<0?"up":"down"}`})}return t},QM=e=>{if(!e)return[];let t=[];for(let n=0;n.06||h>.06)&&(u=!1),p>.06&&t.push({iris:n,gesture:"looking right"}),h>.06&&t.push({iris:n,gesture:"looking left"});let c=Math.abs(e[n].mesh[145][1]-e[n].annotations.rightEyeIris[0][1])/e[n].box[3],m=Math.abs(e[n].mesh[374][1]-e[n].annotations.leftEyeIris[0][1])/e[n].box[3];(m<.01||c<.01||m>.022||c>.022)&&(u=!1),(m<.01||c<.01)&&t.push({iris:n,gesture:"looking down"}),(m>.022||c>.022)&&t.push({iris:n,gesture:"looking up"}),u&&t.push({iris:n,gesture:"looking center"})}return t},e$=e=>{if(!e)return[];let t=[];for(let n=0;n0){let r=a.reduce((i,o)=>i.position[2]i.position[1](u[p]=0,h))},r=function(o,l){let u=e.createShader(l);if(e.shaderSource(u,o),e.compileShader(u),!e.getShaderParameter(u,e.COMPILE_STATUS))throw new Error("Filter: GL compile failed",e.getShaderInfoLog(u));return u};this.uniform={},this.attribute={};let s=r(t,e.VERTEX_SHADER),i=r(n,e.FRAGMENT_SHADER);if(this.id=e.createProgram(),e.attachShader(this.id,s),e.attachShader(this.id,i),e.linkProgram(this.id),!e.getProgramParameter(this.id,e.LINK_STATUS))throw new Error("Filter: GL link failed",e.getProgramInfoLog(this.id));e.useProgram(this.id),a(t,"attribute",this.attribute);for(let o in this.attribute)this.attribute[o]=e.getAttribLocation(this.id,o);a(t,"uniform",this.uniform),a(n,"uniform",this.uniform);for(let o in this.uniform)this.uniform[o]=e.getUniformLocation(this.id,o)}function t$(e){e||(e={});let t=0,n=null,a=!1,r=-1,s=[null,null],i=[],o=-1,l=-1,u=null,d=null,h={},p=e.canvas||document.createElement("canvas"),c={},m={INTERMEDIATE:1},f=p.getContext("webgl");if(!f)throw new Error("Filter: getContext() failed");this.addFilter=function(b){let w=Array.prototype.slice.call(arguments,1),I=h[b];i.push({func:I,args:w})},this.reset=function(){i=[]};let g=function(b,w){if(!(b===o&&w===l)){if(p.width=b,o=b,p.height=w,l=w,!u){let I=new Float32Array([-1,-1,0,1,1,-1,1,1,-1,1,0,0,-1,1,0,0,1,-1,1,1,1,1,1,0]);u=f.createBuffer(),f.bindBuffer(f.ARRAY_BUFFER,u),f.bufferData(f.ARRAY_BUFFER,I,f.STATIC_DRAW),f.pixelStorei(f.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!0)}f.viewport(0,0,o,l),s=[null,null]}},y=function(b,w){let I=f.createFramebuffer();f.bindFramebuffer(f.FRAMEBUFFER,I);let T=f.createRenderbuffer();f.bindRenderbuffer(f.RENDERBUFFER,T);let C=f.createTexture();return f.bindTexture(f.TEXTURE_2D,C),f.texImage2D(f.TEXTURE_2D,0,f.RGBA,b,w,0,f.RGBA,f.UNSIGNED_BYTE,null),f.texParameteri(f.TEXTURE_2D,f.TEXTURE_MAG_FILTER,f.LINEAR),f.texParameteri(f.TEXTURE_2D,f.TEXTURE_MIN_FILTER,f.LINEAR),f.texParameteri(f.TEXTURE_2D,f.TEXTURE_WRAP_S,f.CLAMP_TO_EDGE),f.texParameteri(f.TEXTURE_2D,f.TEXTURE_WRAP_T,f.CLAMP_TO_EDGE),f.framebufferTexture2D(f.FRAMEBUFFER,f.COLOR_ATTACHMENT0,f.TEXTURE_2D,C,0),f.bindTexture(f.TEXTURE_2D,null),f.bindFramebuffer(f.FRAMEBUFFER,null),{fbo:I,texture:C}},A=function(b){return s[b]=s[b]||y(o,l),s[b]},x=function(b=null){var C,z;let w=null,I=null,T=!1;t===0?w=n:w=(C=A(r))==null?void 0:C.texture,t++,a&&!(b&m.INTERMEDIATE)?(I=null,T=t%2==0):(r=(r+1)%2,I=(z=A(r))==null?void 0:z.fbo),f.bindTexture(f.TEXTURE_2D,w),f.bindFramebuffer(f.FRAMEBUFFER,I),f.uniform1f(d.uniform.flipY,T?-1:1),f.drawArrays(f.TRIANGLES,0,6)};this.apply=function(b){if(g(b.width,b.height),t=0,n||(n=f.createTexture()),f.bindTexture(f.TEXTURE_2D,n),f.texParameteri(f.TEXTURE_2D,f.TEXTURE_WRAP_S,f.CLAMP_TO_EDGE),f.texParameteri(f.TEXTURE_2D,f.TEXTURE_WRAP_T,f.CLAMP_TO_EDGE),f.texParameteri(f.TEXTURE_2D,f.TEXTURE_MIN_FILTER,f.NEAREST),f.texParameteri(f.TEXTURE_2D,f.TEXTURE_MAG_FILTER,f.NEAREST),f.texImage2D(f.TEXTURE_2D,0,f.RGBA,f.RGBA,f.UNSIGNED_BYTE,b),i.length===0)return x(),p;for(let w=0;w{let C=b.shape[0],M=b.shape[1],$=_.segment_util.segOpComputeOptimalWindowSize(M,T),R={windowSize:$,inSize:M,batchSize:C,numSegments:T},N=new xxe(R,v),F=n.compileAndRun(N,[b,w],I);if(l.push(F),F.shape[1]===T)return F;let B=c9({backend:n,attrs:{start:0,stop:T,step:1,dtype:"float32"}}),j=p9({inputs:{x:B},backend:n,attrs:{reps:[M/$]}});return l.push(B),l.push(j),g(F,v,j,I,T)},y=g(f,"unsortedSegmentSum",a,m,o),A=ve({inputs:{x:y},backend:n,attrs:{shape:h}}),x=A;if(c!=null){l.push(A);let b=_.getUndoAxesPermutation(c);x=Un({inputs:{x},backend:n,attrs:{perm:b}})}return l.forEach(b=>n.disposeIntermediateTensorInfo(b)),x}var vxe={kernelName:uf,backendName:"webgl",kernelFunc:bxe},wxe=[Z2e,Q2e,Mfe,Pfe,Bfe,Ufe,Gfe,Kfe,Zfe,Jfe,nme,sme,ime,cme,yme,pme,bme,Ime,wme,Cme,$me,Rme,Ome,Ume,Gme,Yme,Qme,r0e,o0e,gfe,d0e,v0e,k0e,m0e,N0e,E0e,S0e,R0e,M0e,z0e,B0e,V0e,G0e,Y0e,Q0e,q0e,nge,age,ige,dge,mge,xge,wge,kge,Ige,Tge,Cge,$ge,Rge,Fge,zge,Wge,Hge,jge,Xge,Qge,r2e,i2e,mfe,u2e,u0e,h2e,m2e,A2e,Afe,w2e,T2e,C2e,M2e,R2e,L2e,V2e,j2e,tye,uye,iye,pye,mye,yye,aye,xye,vye,Sye,Eye,Dye,Wye,kfe,Uye,jye,Xye,Jye,qme,tAe,rAe,aAe,lAe,hAe,bfe,fAe,mAe,Kme,Pye,AAe,TAe,wAe,Sfe,$Ae,DAe,PAe,BAe,HAe,jAe,XAe,JAe,e1e,r1e,o1e,u1e,h1e,m1e,A1e,Wme,Lye,v1e,k1e,S1e,N1e,E1e,_1e,D1e,M1e,z1e,W1e,U1e,G1e,K1e,Z1e,J1e,exe,zye,Rfe,rxe,oxe,uxe,dxe,fxe,Dfe,gxe,Axe,vxe,nAe];for(let e of wxe)oA(e);var tr;(function(e){e[e.float32=0]="float32",e[e.int32=1]="int32",e[e.bool=2]="bool",e[e.string=3]="string",e[e.complex64=4]="complex64"})(tr||(tr={}));var gh;(function(e){e[e.linear=0]="linear",e[e.relu=1]="relu",e[e.relu6=2]="relu6",e[e.prelu=3]="prelu",e[e.leakyrelu=4]="leakyrelu",e[e.sigmoid=5]="sigmoid"})(gh||(gh={}));var f9;function kxe(e){f9=e.wasm.cwrap(Ll,null,["number","array","number","number","array","number","number","number","number","number","number","number","number"])}function Ixe(e){let{inputs:t,backend:n,attrs:r}=e,{a:s,b:a,bias:o,preluActivationWeights:i}=t;if(s.dtype!=="float32"||a.dtype!=="float32")throw new Error("_FusedMatMul for non non-float32 tensors not yet supported.");let{transposeA:l,transposeB:u,activation:c,leakyreluAlpha:d}=r,h=n.dataIdMap.get(s.dataId).id,p=n.dataIdMap.get(a.dataId).id,f=0;if(o!=null){let T=n.dataIdMap.get(o.dataId);if(T.shape.length!==1)throw new Error(`_FusedMatMul only supports rank-1 bias but got rank ${T.shape.length}.`);f=T.id}let m=i==null?0:n.dataIdMap.get(i.dataId).id,g=gh[c];if(g==null)throw new Error(`${c} activation not yet supported for FusedConv2D in the wasm backend.`);let y=l?s.shape[2]:s.shape[1],A=u?a.shape[1]:a.shape[2],x=s.shape[0],b=n.makeOutput([x,y,A],s.dtype),v=n.dataIdMap.get(b.dataId).id,w=new Uint8Array(new Int32Array(s.shape).buffer),I=new Uint8Array(new Int32Array(a.shape).buffer);return f9(h,w,s.shape.length,p,I,a.shape.length,l,u,g,f,m,d||0,v),b}var Sxe={kernelName:Ll,backendName:"wasm",setupFunc:kxe,kernelFunc:Ixe};function Hn(e){let t;function n(s){t=s.wasm.cwrap(e,null,["number","number"])}function r(s){let{backend:a,inputs:{x:o}}=s,i=a.dataIdMap.get(o.dataId).id,l=a.makeOutput(o.shape,o.dtype),u=a.dataIdMap.get(l.dataId).id;return k.sizeFromShape(l.shape)===0||t(i,u),l}return{kernelName:e,backendName:"wasm",setupFunc:n,kernelFunc:r}}var Txe=Hn(xc);function Gn(e,t,n){let r;function s(o){r=o.wasm.cwrap(e,null,["number","array","number","number","array","number","number","number"])}function a(o){let{backend:i,inputs:l}=o,{a:u,b:c}=l,d=i.dataIdMap.get(u.dataId).id,h=i.dataIdMap.get(c.dataId).id,p=n!=null?n:u.dtype,f=_.assertAndGetBroadcastShape(u.shape,c.shape),m=i.makeOutput(f,p);if(k.sizeFromShape(f)===0)return m;let g=new Uint8Array(new Int32Array(u.shape).buffer),y=new Uint8Array(new Int32Array(c.shape).buffer),A=i.dataIdMap.get(m.dataId).id,x=()=>r(d,g,u.shape.length,h,y,c.shape.length,tr[u.dtype],A);if(t&&u.dtype==="float32")return x(),m;let b=_.getBroadcastDims(u.shape,f),v=_.getBroadcastDims(c.shape,f),w=b.every((T,C)=>T===C),I=v.every((T,C)=>T===C);if(w&&I)return x(),m;throw new Error(`Broadcasting along outer dims is not yet supported for ${u.dtype} ${e}.`)}return{kernelName:e,backendName:"wasm",setupFunc:s,kernelFunc:a}}var Nxe=!0,Cxe=Gn(Fa,Nxe),m9;function Exe(e){m9=e.wasm.cwrap(Zi,null,["array","number","number","number"])}function $xe(e){let{inputs:t,backend:n}=e,r=n.makeOutput(t[0].shape,t[0].dtype);if(k.sizeFromShape(r.shape)===0)return r;let s=t.map(i=>n.dataIdMap.get(i.dataId).id),a=new Uint8Array(new Int32Array(s).buffer),o=n.dataIdMap.get(r.dataId).id;return m9(a,s.length,tr[r.dtype],o),r}var _xe={kernelName:Zi,backendName:"wasm",setupFunc:Exe,kernelFunc:$xe};function Qm(e){let{inputs:{x:t},backend:n}=e,r=n.makeOutput(t.shape,t.dtype),s=n.typedArrayFromHeap(t);return n.typedArrayFromHeap(r).set(s),r}var Rxe={kernelName:hl,backendName:"wasm",kernelFunc:Qm},g9;function Dxe(e){g9=e.wasm.cwrap(zl,null,["number","array","number","number","number","array","number"])}function e0(e){let{inputs:t,backend:n,attrs:r}=e,[s,a]=Mxe(t.x.shape,r.perm),o=!0;for(let f=0;f=s&&(a===-1||r[a]>r[o])&&(a=o);r[a]=s}return[n,r]}var Oxe={kernelName:zl,backendName:"wasm",kernelFunc:e0,setupFunc:Dxe};function to(e,t,n){let r=e.shape,s=e.shape.length,a=k.parseAxisParam(t,r),o=a,i=_.getAxesPermutation(o,s),l=null,u=!1;if(i!=null){let c=new Array(s);for(let p=0;p`new shape: ${o}, old shape: ${r.shape}. New shape and old shape must have the same number of elements.`),e.backend.incRef(r.dataId),{dataId:r.dataId,shape:o,dtype:r.dtype}}var Xxe={kernelName:Qc,backendName:"wasm",kernelFunc:As},v9;function Zxe(e){v9=e.wasm.cwrap(Qi,null,["number","array","number","number","array","number","number","number","number"])}function Yxe(e){let{inputs:t,backend:n,attrs:r}=e,{a:s,b:a}=t,{transposeA:o,transposeB:i}=r;if(s.dtype!=="float32"||a.dtype!=="float32")throw new Error("BatchMatMul for non non-float32 tensors not yet supported.");let l=s.shape.length,u=a.shape.length,c=o?s.shape[l-2]:s.shape[l-1],d=i?a.shape[u-1]:a.shape[u-2],h=o?s.shape[l-1]:s.shape[l-2],p=i?a.shape[u-2]:a.shape[u-1],f=s.shape.slice(0,-2),m=a.shape.slice(0,-2),g=k.sizeFromShape(f),y=k.sizeFromShape(m),A=g===y||g===1||y===1;k.assert(l>=2&&u>=2&&A,()=>`Error in matMul: the input batch dimensions must either be the same or at least one input batch dimension must be 1. Got input batch dimensions of (${f}) and (${m}).`);let b=(g>y?s.shape.slice(0,-2):a.shape.slice(0,-2)).concat([h,p]);k.assert(c===d,()=>`Error in matMul: inner shapes (${c}) and (${d}) of Tensors with shapes ${s.shape} and ${a.shape} and transposeA=${o} and transposeB=${i} must match.`);let v=o?[g,c,h]:[g,h,c],w=i?[y,p,d]:[y,d,p],I=As({inputs:{x:s},backend:n,attrs:{shape:v}}),T=As({inputs:{x:a},backend:n,attrs:{shape:w}}),C=n.dataIdMap.get(I.dataId).id,M=n.dataIdMap.get(T.dataId).id,$=o?I.shape[2]:I.shape[1],R=i?T.shape[1]:T.shape[2],N=Math.max(g,y),F=n.makeOutput([N,$,R],I.dtype),B=n.dataIdMap.get(F.dataId).id,j=new Uint8Array(new Int32Array(I.shape).buffer),X=new Uint8Array(new Int32Array(T.shape).buffer);return v9(C,j,I.shape.length,M,X,T.shape.length,o,i,B),n.disposeData(I.dataId),n.disposeData(T.dataId),F.shape=b,F}var Jxe={kernelName:Qi,backendName:"wasm",setupFunc:Zxe,kernelFunc:Yxe};function t0(e){let{inputs:{x:t},attrs:{dtype:n},backend:r}=e,s=r.makeOutput(t.shape,n),a=r.typedArrayFromHeap(t);return r.typedArrayFromHeap(s).set(a),s}var Qxe={kernelName:el,backendName:"wasm",kernelFunc:t0},e5e=Hn(No),w9;function t5e(e){w9=e.wasm.cwrap(Co,null,["number","number","number","number"])}function n5e(e){let{inputs:t,backend:n,attrs:r}=e,{x:s}=t,{clipValueMin:a,clipValueMax:o}=r,i=n.dataIdMap.get(s.dataId).id,l=n.makeOutput(s.shape,s.dtype),u=n.dataIdMap.get(l.dataId).id;return w9(i,a,o,u),l}var r5e={kernelName:Co,backendName:"wasm",setupFunc:t5e,kernelFunc:n5e};function k9(e){let{inputs:t,backend:n}=e,r=k.parseAxisParam(e.attrs.axis,t[0].shape)[0],s=_.computeOutShape(t.map(p=>p.shape),r),a=t.filter(p=>k.sizeFromShape(p.shape)>0);if(a.length===1)return Qm({inputs:{x:a[0]},backend:n});let o=n.makeOutput(s,t[0].dtype);if(k.sizeFromShape(s)===0)return o;let i=a.map(p=>p.shape);if(_.assertParamsConsistent(i,r),a[0].dtype==="string"){let p=a.map(x=>{let b=k.sizeFromShape(x.shape.slice(r));return As({inputs:{x},backend:n,attrs:{shape:[-1,b]}})}),f=p.map(x=>({vals:n.readSync(x.dataId),shape:x.shape}));s=_.computeOutShape(p.map(x=>x.shape),1);let m=p[0].shape[0]===1,g=qC(f,s,t[0].dtype,m),y=_.computeOutShape(a.map(x=>x.shape),r);o.shape=y;let A=n.dataIdMap.get(o.dataId);return A.stringBytes=_.fromStringArrayToUint8(g),p.forEach(x=>n.disposeData(x.dataId)),o}let l=k.sizeFromShape(a[0].shape.slice(0,r)),u=0,c=a.map(p=>{let f=k.sizeFromShape(p.shape.slice(r));return u+=f,f}),d=a.map(p=>n.typedArrayFromHeap(p)),h=n.typedArrayFromHeap(o);for(let p=0;p`cumsum does not support ${s.dtype} tensors in the WASM backend`);let u=_.getAxesPermutation([a],l),c=s;u!==null&&(c=e0({inputs:{x:s},attrs:{perm:u},backend:n}));let d=_.getInnerMostAxes(1,l)[0];_.assertAxesAreInnerMostDims("cumsum",[d],l);let h=n.makeOutput(c.shape,c.dtype),p=c.shape[d],f=n.dataIdMap.get(c.dataId).id,m=n.dataIdMap.get(h.dataId).id;N9(f,o?1:0,i?1:0,p,m,tr[s.dtype]);let g=h;if(u!==null){let y=_.getUndoAxesPermutation(u);g=e0({inputs:{x:h},attrs:{perm:y},backend:n}),n.disposeData(c.dataId),n.disposeData(h.dataId)}return g}var y5e={kernelName:sl,backendName:"wasm",setupFunc:m5e,kernelFunc:g5e},C9;function A5e(e){C9=e.wasm.cwrap(Rc,null,["number","number","number","array","number","array","array","number","number"])}function x5e(e){let{backend:t,inputs:n,attrs:r}=e,{x:s}=n,{blockSize:a,dataFormat:o}=r;k.assert(a>1,()=>`blockSize should be > 1 for depthToSpace, but was: ${a}`);let i=s.shape[0],l=o==="NHWC"?s.shape[1]:s.shape[2],u=o==="NHWC"?s.shape[2]:s.shape[3],c=o==="NHWC"?s.shape[3]:s.shape[1],d=l*a,h=u*a,p=c/(a*a),f=o==="NHWC"?[i,d,h,p]:[i,p,d,h],m=t.makeOutput(f,"float32"),y=t.dataIdMap.get(s.dataId).id,A=new Uint8Array(new Int32Array(k.computeStrides(s.shape)).buffer),x=new Uint8Array(new Int32Array(f).buffer),b=new Uint8Array(new Int32Array(k.computeStrides(f)).buffer),v=t.dataIdMap.get(m.dataId).id;return C9(y,a,o==="NHWC"?1:0,A,s.shape.length-1,x,b,f.length,v),m}var b5e={kernelName:Rc,backendName:"wasm",setupFunc:A5e,kernelFunc:x5e},E9;function v5e(e){E9=e.wasm.cwrap(al,null,["number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number"])}function w5e(e){let{inputs:t,attrs:n,backend:r}=e,{x:s,filter:a}=t,o=r.dataIdMap.get(s.dataId).id,i=r.dataIdMap.get(a.dataId).id,{strides:l,dilations:u,pad:c,dimRoundingMode:d}=n,h=u==null?[1,1]:u,p=_.computeConv2DInfo(s.shape,a.shape,l,h,c,d,!0),f=p.filterHeight,m=p.filterWidth,g=p.padInfo.top,y=p.padInfo.right,A=p.padInfo.bottom,x=p.padInfo.left,b=p.dilationHeight,v=p.dilationWidth,w=p.strideHeight,I=p.strideWidth,T=p.inChannels,C=p.outChannels,M=p.padInfo.type==="SAME"?1:0;if(p.dataFormat!=="channelsLast")throw new Error(`wasm backend DepthwiseConv2dNative does not support dataFormat:'${p.dataFormat}'. Please use 'channelsLast'.`);let $=r.makeOutput(p.outShape,"float32"),R=r.dataIdMap.get($.dataId).id;return E9(o,s.shape[0],s.shape[1],s.shape[2],i,f,m,g,y,A,x,M,b,v,w,I,T,C,R),$}var k5e={kernelName:al,backendName:"wasm",setupFunc:v5e,kernelFunc:w5e},I5e=!1,S5e=Gn(il,I5e,"bool"),T5e=Hn(Eo);function fb(e){let{inputs:t,attrs:n,backend:r}=e,{input:s}=t,{dim:a}=n,o=s.shape.length,i=s.shape.slice(),l=a;return a<0&&(k.assert(-(o+1)<=a,()=>`Axis must be in the interval [${-(o+1)}, ${o}]`),l=o+a+1),i.splice(l,0,1),As({inputs:{x:s},backend:r,attrs:{shape:i}})}var N5e={kernelName:Mc,backendName:"wasm",kernelFunc:fb};function C5e(e){let{attrs:{shape:t,value:n,dtype:r},backend:s}=e,a=s.makeOutput(t,r);return s.typedArrayFromHeap(a).fill(n),a}var E5e={kernelName:Qp,backendName:"wasm",kernelFunc:C5e},$9;function $5e(e){$9=e.wasm.cwrap(Oc,null,["number","number","number","number","number","number"])}function _5e(e){let{inputs:t,backend:n}=e,{image:r}=t,s=n.makeOutput(r.shape,r.dtype),a=n.dataIdMap.get(r.dataId).id,o=n.dataIdMap.get(s.dataId).id,[i,l,u,c]=r.shape;return $9(a,i,l,u,c,o),s}var R5e={kernelName:Oc,backendName:"wasm",kernelFunc:_5e,setupFunc:$5e},D5e=Hn($o),F5e=!1,M5e=Gn(ul,F5e),_9;function O5e(e){_9=e.wasm.cwrap(cl,null,["number","number","number","number","number","number","number"])}function P5e(e){let{backend:t,inputs:n,attrs:r}=e,{varianceEpsilon:s}=r,{x:a,mean:o,variance:i,offset:l,scale:u}=n,c=t.dataIdMap.get(a.dataId).id,d=t.dataIdMap.get(o.dataId).id,h=t.dataIdMap.get(i.dataId).id,p=l!=null?t.dataIdMap.get(l.dataId).id:0,f=u!=null?t.dataIdMap.get(u.dataId).id:0,m=t.makeOutput(a.shape,a.dtype);if(k.sizeFromShape(a.shape)===0)return m;let g=t.dataIdMap.get(m.dataId).id;return _9(c,d,h,p,f,s,g),m}var z5e={kernelName:cl,backendName:"wasm",setupFunc:O5e,kernelFunc:P5e},R9;function L5e(e){R9=e.wasm.cwrap(Bl,null,["number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number"])}function B5e(e){let{inputs:t,attrs:n,backend:r}=e,{x:s,filter:a,bias:o,preluActivationWeights:i}=t,{strides:l,pad:u,dilations:c,dataFormat:d,dimRoundingMode:h,activation:p,leakyreluAlpha:f}=n,m=_.computeConv2DInfo(s.shape,a.shape,l,c,u,h),g=gh[p];if(g==null)throw new Error(`${p} activation not yet supported for FusedConv2D in the wasm backend.`);let y=r.dataIdMap.get(s.dataId).id,A=r.dataIdMap.get(a.dataId).id,x=m.outChannels,b=0;if(o!=null){let ne=r.dataIdMap.get(o.dataId);if(ne.shape.length!==1)throw new Error(`FusedConv2D only supports rank-1 bias but got rank ${ne.shape.length}.`);if(ne.shape[0]!==x)throw new Error(`FusedConv2D bias shape (${ne.shape}) does not match the number of output channels (${x})`);b=ne.id}let v=m.filterHeight,w=m.filterWidth,I=m.padInfo.top,T=m.padInfo.right,C=m.padInfo.bottom,M=m.padInfo.left,$=m.dilationHeight,R=m.dilationWidth,N=m.strideHeight,F=m.strideWidth,B=m.inChannels,j=m.padInfo.type==="SAME"?1:0,X=m.batchSize,Y=m.inHeight,ee=m.inWidth;if(d!=="NHWC")throw new Error(`wasm backend FusedConv2D does not support dataFormat:'${d}'. Please use 'NHWC'.`);let oe=r.makeOutput(m.outShape,"float32"),se=r.dataIdMap.get(oe.dataId).id,ie=i==null?0:r.dataIdMap.get(i.dataId).id;return R9(y,X,Y,ee,A,v,w,b,I,T,C,M,j,$,R,N,F,B,x,g,ie,f||0,se),oe}var W5e={kernelName:Bl,backendName:"wasm",setupFunc:L5e,kernelFunc:B5e},D9;function V5e(e){D9=e.wasm.cwrap(Wl,null,["number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number"])}function U5e(e){let{inputs:t,attrs:n,backend:r}=e,{x:s,filter:a,bias:o,preluActivationWeights:i}=t,{strides:l,pad:u,dilations:c,dataFormat:d,dimRoundingMode:h,activation:p,leakyreluAlpha:f}=n,m=_.computeConv2DInfo(s.shape,a.shape,l,c,u,h,!0),g=gh[p];if(g==null)throw new Error(`${p} activation not yet supported for FusedDepthwiseConv2D in the wasm backend.`);let y=r.dataIdMap.get(s.dataId).id,A=r.dataIdMap.get(a.dataId).id,x=m.outChannels,b=0;if(o!=null){let ne=r.dataIdMap.get(o.dataId);if(ne.shape.length!==1)throw new Error(`FusedDepthwiseConv2D only supports rank-1 bias but got rank ${ne.shape.length}.`);if(ne.shape[0]!==x)throw new Error(`FusedDepthwiseConv2D bias shape (${ne.shape}) does not match the number of output channels (${x})`);b=ne.id}let v=m.filterHeight,w=m.filterWidth,I=m.padInfo.top,T=m.padInfo.right,C=m.padInfo.bottom,M=m.padInfo.left,$=m.dilationHeight,R=m.dilationWidth,N=m.strideHeight,F=m.strideWidth,B=m.inChannels,j=m.padInfo.type==="SAME"?1:0,X=m.batchSize,Y=m.inHeight,ee=m.inWidth;if(d!=="NHWC")throw new Error(`wasm backend FusedDepthwiseConv2D does not support dataFormat:'${d}'. Please use 'NHWC'.`);let oe=r.makeOutput(m.outShape,"float32"),se=r.dataIdMap.get(oe.dataId).id,ie=i==null?0:r.dataIdMap.get(i.dataId).id;return D9(y,X,Y,ee,A,v,w,b,I,T,C,M,j,$,R,N,F,B,x,g,ie,f||0,se),oe}var H5e={kernelName:Wl,backendName:"wasm",setupFunc:V5e,kernelFunc:U5e},F9;function G5e(e){F9=e.wasm.cwrap(zc,null,["number","number","number","number","number","number","array","number"])}function j5e(e){let{backend:t,inputs:n}=e,{params:r,indices:s}=n,[a,o,i,l]=S6.prepareAndValidate(r,s),u=t.makeOutput(a,r.dtype);if(o===0)return u;let c=s.shape,d=c[c.length-1],p=t.dataIdMap.get(r.dataId).id,m=t.dataIdMap.get(s.dataId).id,g=new Uint8Array(new Int32Array(l).buffer),y=t.dataIdMap.get(u.dataId).id;return F9(p,tr[r.dtype],m,o,d,i,g,y),u}var q5e={kernelName:zc,backendName:"wasm",setupFunc:G5e,kernelFunc:j5e},M9;function K5e(e){M9=e.wasm.cwrap("Gather",null,["number","number","array","number","number","number","array","number"])}function X5e(e){let{backend:t,inputs:n,attrs:r}=e,{x:s,indices:a}=n,{axis:o,batchDims:i}=r,l=k.parseAxisParam(o,s.shape)[0],u=_.segment_util.collectGatherOpShapeInfo(s,a,l,i),c=As({inputs:{x:s},attrs:{shape:[u.batchSize,u.outerSize,u.dimSize,u.sliceSize]},backend:t}),d=k.sizeFromShape(a.shape),h=As({inputs:{x:a},attrs:{shape:[u.batchSize,d/u.batchSize]},backend:t}),p=[u.batchSize,u.outerSize,d/u.batchSize,u.sliceSize],f=t.makeOutput(p,s.dtype);if(k.sizeFromShape(s.shape)===0)return f;let m=c.shape.length-1,y=t.dataIdMap.get(c.dataId).id,x=t.dataIdMap.get(h.dataId).id,b=t.dataIdMap.get(f.dataId).id,v=new Uint8Array(new Int32Array(k.computeStrides(c.shape)).buffer),w=new Uint8Array(new Int32Array(k.computeStrides(p)).buffer);return M9(y,tr[s.dtype],v,m,x,u.batchSize,w,b),t.disposeData(c.dataId),t.disposeData(h.dataId),f.shape=u.outputShape,f}var Z5e={kernelName:Pc,backendName:"wasm",setupFunc:K5e,kernelFunc:X5e},Y5e=!1,J5e=Gn(dl,Y5e,"bool"),Q5e=!1,ebe=Gn(_o,Q5e,"bool"),O9;function tbe(e){O9=e.wasm.cwrap(pl,null,["number","number","number"])}function nbe(e){let{inputs:{x:t},attrs:{alpha:n},backend:r}=e,s=r.dataIdMap.get(t.dataId).id,a=r.makeOutput(t.shape,t.dtype);if(k.sizeFromShape(t.shape)!==0){let o=r.dataIdMap.get(a.dataId).id;O9(s,n,o)}return a}var rbe={kernelName:pl,backendName:"wasm",setupFunc:tbe,kernelFunc:nbe},sbe=!1,abe=Gn(fl,sbe,"bool"),obe=!1,ibe=Gn(ml,obe,"bool"),lbe=Hn(Ro),ube=!1,cbe=Gn(Uc,ube,"bool"),P9;function dbe(e){P9=e.wasm.cwrap(gl,null,["number, number, number"])}function hbe(e){let{backend:t,inputs:n,attrs:r}=e,{reductionIndices:s,keepDims:a}=r,{x:o}=n,l=t.dataIdMap.get(o.dataId).id,u=o,{transposed:c,axes:d,originalAxes:h,inputWasTransposed:p}=to(o,s,t);if(p){let x=t.dataIdMap.get(c.dataId).id;u=c,l=x}let f=u.shape.length;_.assertAxesAreInnerMostDims("max",d,f);let[m,g]=_.computeOutAndReduceShapes(u.shape,d),y=k.sizeFromShape(g),A=t.makeOutput(m,o.dtype);if(k.sizeFromShape(u.shape)!==0){let x=t.dataIdMap.get(A.dataId).id;P9(l,y,x)}if(p&&t.disposeData(c.dataId),a){let x=_.expandShapeToKeepDim(A.shape,h);A.shape=x}return A}var pbe={kernelName:gl,backendName:"wasm",setupFunc:dbe,kernelFunc:hbe},fbe=!1,mbe=Gn(Do,fbe),z9;function gbe(e){z9=e.wasm.cwrap(yl,null,["number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number"])}function ybe(e){let{inputs:t,attrs:n,backend:r}=e,s=t.x,a=r.dataIdMap.get(s.dataId).id,{filterSize:o,strides:i,pad:l,dimRoundingMode:u}=n,c=_.computePool2DInfo(s.shape,o,i,1,l,u),d=c.filterHeight,h=c.filterWidth,p=c.padInfo.top,f=c.padInfo.right,m=c.padInfo.bottom,g=c.padInfo.left,y=c.dilationHeight,A=c.dilationWidth,x=c.strideHeight,b=c.strideWidth,v=c.inChannels,w=c.outChannels;if(c.dataFormat!=="channelsLast")throw new Error(`wasm backend does not support dataFormat:'${c.dataFormat}'. Please use 'channelsLast'.`);let I=r.makeOutput(c.outShape,"float32"),T=r.dataIdMap.get(I.dataId).id;return z9(a,s.shape[0],s.shape[1],s.shape[2],d,h,p,f,m,g,y,A,x,b,v,w,T),I}var Abe={kernelName:yl,backendName:"wasm",setupFunc:gbe,kernelFunc:ybe},L9;function xbe(e){L9=e.wasm.cwrap(Al,null,["number, number, number"])}function bbe(e){let{backend:t,inputs:n,attrs:r}=e,{axis:s,keepDims:a}=r,{x:o}=n,i=t.dataIdMap.get(o.dataId).id,l=i,u=o,{transposed:c,axes:d,originalAxes:h,inputWasTransposed:p}=to(o,s,t),f=d;if(p){let b=t.dataIdMap.get(c.dataId).id;b!==i&&(u=c,l=b,f=_.getInnerMostAxes(f.length,u.shape.length))}_.assertAxesAreInnerMostDims("mean",f,u.shape.length);let[m,g]=_.computeOutAndReduceShapes(u.shape,f),y=k.sizeFromShape(g),A=u;u.dtype!=="float32"&&(A=t0({backend:t,inputs:{x:u},attrs:{dtype:"float32"}}),l=t.dataIdMap.get(A.dataId).id);let x=t.makeOutput(m,"float32");if(k.sizeFromShape(u.shape)!==0){let b=t.dataIdMap.get(x.dataId).id;L9(l,y,b)}if(p&&t.disposeData(c.dataId),a){let b=_.expandShapeToKeepDim(x.shape,h);x.shape=b}return u.dtype!=="float32"&&t.disposeData(A.dataId),x}var vbe={kernelName:Al,backendName:"wasm",setupFunc:xbe,kernelFunc:bbe},B9;function wbe(e){B9=e.wasm.cwrap(xl,null,["number, number, number"])}function kbe(e){let{backend:t,inputs:n,attrs:r}=e,{axis:s,keepDims:a}=r,{x:o}=n,i=t.dataIdMap.get(o.dataId).id,l=i,u=o,{transposed:c,axes:d,originalAxes:h,inputWasTransposed:p}=to(o,s,t);if(p){let x=t.dataIdMap.get(c.dataId).id;x!==i&&(u=c,l=x)}let f=u.shape.length;_.assertAxesAreInnerMostDims("min",d,f);let[m,g]=_.computeOutAndReduceShapes(u.shape,d),y=k.sizeFromShape(g),A=t.makeOutput(m,u.dtype);if(k.sizeFromShape(u.shape)!==0){let x=t.dataIdMap.get(A.dataId).id;B9(l,y,x)}if(p&&t.disposeData(c.dataId),a){let x=_.expandShapeToKeepDim(A.shape,h);A.shape=x}return A}var Ibe={kernelName:xl,backendName:"wasm",setupFunc:wbe,kernelFunc:kbe},Sbe=!1,Tbe=Gn(Fo,Sbe),mb;(function(e){e[e.reflect=0]="reflect",e[e.symmetric=1]="symmetric"})(mb||(mb={}));var W9;function Nbe(e){W9=e.wasm.cwrap(bl,null,["number","array","number","number","array","array","number","number"])}function Cbe(e){let{inputs:{x:t},backend:n,attrs:{paddings:r,mode:s}}=e,a=r.map((f,m)=>f[0]+t.shape[m]+f[1]),o=n.dataIdMap.get(t.dataId).id,i=n.makeOutput(a,t.dtype),l=n.dataIdMap.get(i.dataId).id,u=new Uint8Array(new Int32Array(t.shape).buffer),c=r.map(f=>f[0]),d=r.map(f=>f[1]),h=new Uint8Array(new Int32Array(c).buffer),p=new Uint8Array(new Int32Array(d).buffer);return W9(o,u,t.shape.length,tr[t.dtype],h,p,mb[s],l),i}var Ebe={kernelName:bl,backendName:"wasm",kernelFunc:Cbe,setupFunc:Nbe},$be=!0,_be=Gn(Mo,$be),Rbe=Hn(Gc);function gb(e,t){let n=new Int32Array(e.wasm.HEAPU8.buffer,t,4),r=n[0],s=n[1],a=n[2],o=n[3];return e.wasm._free(t),{pSelectedIndices:r,selectedSize:s,pSelectedScores:a,pValidOutputs:o}}var V9;function Dbe(e){V9=e.wasm.cwrap(jc,"number",["number","number","number","number","number"])}function Fbe(e){let{backend:t,inputs:n,attrs:r}=e,{iouThreshold:s,maxOutputSize:a,scoreThreshold:o}=r,{boxes:i,scores:l}=n,u=t.dataIdMap.get(i.dataId).id,c=t.dataIdMap.get(l.dataId).id,d=V9(u,c,a,s,o),{pSelectedIndices:h,selectedSize:p,pSelectedScores:f,pValidOutputs:m}=gb(t,d);return t.wasm._free(f),t.wasm._free(m),t.makeOutput([p],"int32",h)}var Mbe={kernelName:jc,backendName:"wasm",setupFunc:Dbe,kernelFunc:Fbe},U9;function Obe(e){U9=e.wasm.cwrap(qc,"number",["number","number","number","number","number","bool"])}function Pbe(e){let{backend:t,inputs:n,attrs:r}=e,{iouThreshold:s,maxOutputSize:a,scoreThreshold:o,padToMaxOutputSize:i}=r,{boxes:l,scores:u}=n,c=t.dataIdMap.get(l.dataId).id,d=t.dataIdMap.get(u.dataId).id,h=U9(c,d,a,s,o,i),{pSelectedIndices:p,selectedSize:f,pSelectedScores:m,pValidOutputs:g}=gb(t,h);t.wasm._free(m);let y=t.makeOutput([f],"int32",p),A=t.makeOutput([],"int32",g);return[y,A]}var zbe={kernelName:qc,backendName:"wasm",setupFunc:Obe,kernelFunc:Pbe},H9;function Lbe(e){H9=e.wasm.cwrap(Kc,"number",["number","number","number","number","number","number"])}function Bbe(e){let{backend:t,inputs:n,attrs:r}=e,{iouThreshold:s,maxOutputSize:a,scoreThreshold:o,softNmsSigma:i}=r,{boxes:l,scores:u}=n,c=t.dataIdMap.get(l.dataId).id,d=t.dataIdMap.get(u.dataId).id,h=H9(c,d,a,s,o,i),{pSelectedIndices:p,selectedSize:f,pSelectedScores:m,pValidOutputs:g}=gb(t,h);t.wasm._free(g);let y=t.makeOutput([f],"int32",p),A=t.makeOutput([f],"float32",m);return[y,A]}var Wbe={kernelName:Kc,backendName:"wasm",setupFunc:Lbe,kernelFunc:Bbe},Vbe=!1,Ube=Gn(vl,Vbe,"bool"),G9;function Hbe(e){G9=e.wasm.cwrap(wl,null,["number","number","number","number","number"])}function Gbe(e){let{inputs:t,backend:n,attrs:r}=e,{indices:s}=t,{depth:a,onValue:o,offValue:i}=r,l=n.makeOutput([...s.shape,a],"int32"),u=n.dataIdMap.get(l.dataId).id,d=n.dataIdMap.get(s.dataId).id;return G9(d,a,o,i,u),l}var jbe={kernelName:wl,backendName:"wasm",setupFunc:Hbe,kernelFunc:Gbe};function qbe(e){let{inputs:{x:t},backend:n}=e,r=n.makeOutput(t.shape,t.dtype);return n.typedArrayFromHeap(r).fill(1),r}var Kbe={kernelName:Xc,backendName:"wasm",kernelFunc:qbe};function Xbe(e){let{inputs:t,backend:n,attrs:r}=e,{axis:s}=r;if(t.length===1)return fb({inputs:{input:t[0]},backend:n,attrs:{dim:s}});let a=t[0].shape,o=t[0].dtype;t.forEach(c=>{k.assertShapesMatch(a,c.shape,"All tensors passed to stack must have matching shapes"),k.assert(o===c.dtype,()=>"All tensors passed to stack must have matching dtypes")});let i=[],l=t.map(c=>{let d=fb({inputs:{input:c},backend:n,attrs:{dim:s}});return i.push(d),d}),u=k9({inputs:l,backend:n,attrs:{axis:s}});return i.forEach(c=>n.disposeData(c.dataId)),u}var Zbe={kernelName:Zc,backendName:"wasm",kernelFunc:Xbe},j9;function Ybe(e){j9=e.wasm.cwrap(kl,null,["number","array","number","number","array","array","number","number"])}function Jbe(e){let{inputs:{x:t},backend:n,attrs:{paddings:r,constantValue:s}}=e,a=r.map((f,m)=>f[0]+t.shape[m]+f[1]),o=n.dataIdMap.get(t.dataId).id,i=n.makeOutput(a,t.dtype),l=n.dataIdMap.get(i.dataId).id,u=new Uint8Array(new Int32Array(t.shape).buffer),c=r.map(f=>f[0]),d=r.map(f=>f[1]),h=new Uint8Array(new Int32Array(c).buffer),p=new Uint8Array(new Int32Array(d).buffer);return j9(o,u,t.shape.length,tr[t.dtype],h,p,s,l),i}var Qbe={kernelName:kl,backendName:"wasm",kernelFunc:Jbe,setupFunc:Ybe},e3e=!1,t3e=Gn(Il,e3e),q9;function n3e(e){q9=e.wasm.cwrap(Sl,null,["number","number","number"])}function r3e(e){let{inputs:t,backend:n}=e,{x:r,alpha:s}=t,a=n.dataIdMap.get(r.dataId).id,o=n.dataIdMap.get(s.dataId).id,i=n.makeOutput(r.shape,"float32"),l=n.dataIdMap.get(i.dataId).id;return q9(a,o,l),i}var s3e={kernelName:Sl,backendName:"wasm",setupFunc:n3e,kernelFunc:r3e},K9;function a3e(e){K9=e.wasm.cwrap(Yc,null,["number","number","number","number"])}function o3e(e){let{backend:t,inputs:n,attrs:r}=e,{axis:s,keepDims:a}=r,{x:o}=n,i=t.dataIdMap.get(o.dataId).id,l=i,u=o,{transposed:c,axes:d,originalAxes:h,inputWasTransposed:p}=to(o,s,t),f=d;if(p){let x=t.dataIdMap.get(c.dataId).id;x!==i&&(u=c,l=x,f=_.getInnerMostAxes(f.length,u.shape.length))}_.assertAxesAreInnerMostDims("prod",f,u.shape.length);let[m,g]=_.computeOutAndReduceShapes(u.shape,f),y=k.sizeFromShape(g),A=t.makeOutput(m,u.dtype);if(k.sizeFromShape(u.shape)!==0){let x=t.dataIdMap.get(A.dataId).id;K9(l,y,tr[A.dtype],x)}if(p&&t.disposeData(c.dataId),a){let x=_.expandShapeToKeepDim(A.shape,h);A.shape=x}return A}var i3e={kernelName:Yc,backendName:"wasm",setupFunc:a3e,kernelFunc:o3e},l3e=e=>{let{backend:t,attrs:n}=e,{start:r,stop:s,step:a,dtype:o}=n,i=oE(r,s,a,o),l=t.makeOutput([i.length],o);return t.typedArrayFromHeap(l).set(i),l},u3e={kernelName:sf,backendName:"wasm",kernelFunc:l3e},c3e=!0,d3e=Gn(ol,c3e),h3e=Hn(Tl),p3e=Hn(Cl),X9;function f3e(e){X9=e.wasm.cwrap(Nl,null,["number","number","number","number","number","number","number","number","number","number"])}function m3e(e){let{backend:t,inputs:n,attrs:r}=e,{images:s}=n,{alignCorners:a,halfPixelCenters:o,size:i}=r,[l,u]=i,[c,d,h,p]=s.shape,f=[c,l,u,p],m=t.dataIdMap.get(s.dataId),g;m.dtype!=="float32"&&(g=t0({backend:t,inputs:{x:s},attrs:{dtype:"float32"}}),m=t.dataIdMap.get(g.dataId));let y=m.id,A=t.makeOutput(f,"float32");if(k.sizeFromShape(s.shape)===0)return A;let x=t.dataIdMap.get(A.dataId).id;return X9(y,c,d,h,p,l,u,a?1:0,o?1:0,x),g!=null&&t.disposeData(g.dataId),A}var g3e={kernelName:Nl,backendName:"wasm",setupFunc:f3e,kernelFunc:m3e},Z9;function y3e(e){Z9=e.wasm.cwrap(El,null,["number","array","number","array","number","number"])}function A3e(e){let{inputs:t,backend:n,attrs:r}=e,{x:s}=t,{dims:a}=r,o=k.parseAxisParam(a,s.shape);if(s.shape.length===0)return Qm({inputs:{x:s},backend:n});let i=n.makeOutput(s.shape,s.dtype),l=n.dataIdMap.get(s.dataId).id,u=n.dataIdMap.get(i.dataId).id,c=new Uint8Array(new Int32Array(o).buffer),d=new Uint8Array(new Int32Array(s.shape).buffer);Z9(l,c,o.length,d,s.shape.length,u);let h=As({inputs:{x:i},attrs:{shape:s.shape},backend:n});return n.disposeData(i.dataId),h}var x3e={kernelName:El,backendName:"wasm",kernelFunc:A3e,setupFunc:y3e},Y9;function b3e(e){Y9=e.wasm.cwrap(pd,null,["number","number","number","number","number","number","number","number","array","number","number"])}function v3e(e){let{inputs:t,backend:n,attrs:r}=e,{image:s}=t,{radians:a,fillValue:o,center:i}=r,l=n.makeOutput(s.shape,s.dtype),u=n.dataIdMap.get(s.dataId).id,c=n.dataIdMap.get(l.dataId).id,[d,h,p,f]=s.shape,[m,g]=_.getImageCenter(i,h,p),y=o===0,A=255,x=typeof o=="number"?[o,o,o,y?0:A]:[...o,A],b=new Uint8Array(new Int32Array(x).buffer);return Y9(u,d,h,p,f,a,m,g,b,x.length,c),l}var w3e={kernelName:pd,backendName:"wasm",kernelFunc:v3e,setupFunc:b3e},k3e=Hn($l),I3e=Hn(Oo),J9;function S3e(e){J9=e.wasm.cwrap(ed,null,["number","number","number","number","number","number","array","number","number"])}function T3e(e){let{backend:t,inputs:n,attrs:r}=e,{indices:s,updates:a}=n,{shape:o}=r,i=t.makeOutput(o,a.dtype);if(k.sizeFromShape(o)===0)return i;let{sliceRank:l,numUpdates:u,sliceSize:c,strides:d,outputSize:h}=N6.calculateShapes(a,s,o),f=t.dataIdMap.get(s.dataId).id,g=t.dataIdMap.get(a.dataId).id,y=new Uint8Array(new Int32Array(d).buffer),A=t.dataIdMap.get(i.dataId).id;return J9(f,g,tr[a.dtype],l,u,c,y,h,A),i}var N3e={kernelName:ed,backendName:"wasm",setupFunc:S3e,kernelFunc:T3e},Q9;function C3e(e){Q9=e.wasm.cwrap("SelectV2",null,["number","number","number","number","number"])}function E3e(e){let{inputs:t,backend:n}=e,{condition:r,t:s,e:a}=t,o=n.dataIdMap.get(r.dataId).id,i=n.dataIdMap.get(s.dataId).id,l=n.dataIdMap.get(a.dataId).id,u=n.makeOutput(s.shape,s.dtype),c=n.dataIdMap.get(u.dataId).id,d=r.shape.length,h=s.shape.length,p=d===0||d>1||h===1?1:k.sizeFromShape(s.shape.slice(1));return Q9(o,i,l,p,c),u}var $3e={kernelName:td,backendName:"wasm",kernelFunc:E3e,setupFunc:C3e},e$;function _3e(e){e$=e.wasm.cwrap(Rl,null,["number","number"])}function R3e(e){let{backend:t,inputs:{x:n}}=e,r=t.dataIdMap.get(n.dataId).id,s=t.makeOutput(n.shape,n.dtype),a=t.dataIdMap.get(s.dataId).id;return k.sizeFromShape(s.shape)===0||e$(r,a),s}var D3e={kernelName:"Sigmoid",backendName:"wasm",setupFunc:_3e,kernelFunc:R3e},F3e=Hn(_l);function n0(e){let{inputs:{x:t},attrs:{begin:n,size:r},backend:s}=e,[a,o]=En.parseSliceParams(t,n,r),i=En.isSliceContinous(t.shape,a,o),l=s.readSync(t.dataId),u=s.makeOutput(o,t.dtype),c=k.computeStrides(t.shape),d=s.dataIdMap.get(u.dataId);if(i){let f=En.computeFlatOffset(a,c);return t.dtype==="string"?d.stringBytes=l.slice(f,f+k.sizeFromShape(o)):s.typedArrayFromHeap(u).set(l.subarray(f,f+k.sizeFromShape(o))),u}if(t.dtype==="string"){let f=ab(l,a,o,t.shape,t.dtype);return d.stringBytes=f,u}let h=s.typedArrayFromHeap(u),p=t.shape.length;if(p===2)M3e(l,c[0],h,a,o);else if(p===3)O3e(l,c[0],c[1],h,a,o);else if(p===4)P3e(l,c[0],c[1],c[2],h,a,o);else{let f=ab(l,a,o,t.shape,t.dtype);h.set(f)}return u}function M3e(e,t,n,r,s){let a=0,o=r[0],i=r[1],l=o+s[0];for(let u=o;u{let h=[...c];h[i]=d;let p=n0({inputs:{x:s},attrs:{begin:u,size:h},backend:r});return u[i]+=d,p})}var U3e={kernelName:id,backendName:"wasm",kernelFunc:V3e},H3e=Hn(Dl),G3e=Hn(lf),j3e=!0,q3e=Gn(Po,j3e),n$;function K3e(e){n$=e.wasm.cwrap(Bo,null,["number","number","number"])}function X3e(e){let{backend:t,inputs:n,attrs:r}=e,{alpha:s}=r,{x:a}=n,o=t.dataIdMap.get(a.dataId).id,i=t.makeOutput(a.shape,a.dtype),l=t.dataIdMap.get(i.dataId).id;return n$(o,s,l),i}var Z3e={kernelName:Bo,backendName:"wasm",setupFunc:K3e,kernelFunc:X3e},r$;function Y3e(e){r$=e.wasm.cwrap(ld,null,["number","array","number","array","array","array","array","array","number","number"])}function J3e(e){let{backend:t,inputs:n,attrs:r}=e,{x:s}=n,{begin:a,end:o,strides:i}=r;i==null&&(i=new Array(a.length));let{beginMask:l,endMask:u,ellipsisMask:c,newAxisMask:d,shrinkAxisMask:h}=r,p=_.slice_util.maskToAxes(c);if(p.length>1)throw new Error("Multiple ellipses in slice is not allowed.");if(c!==0&&d!==0)throw new Error("Using both ellipsisMask and newAxisMask is not yet supported.");if(c!==0&&h!==0)throw new Error("Using both ellipsisMask and shrinkAxisMask is not yet supported.");let f=s.shape.length-a.length,m=_.slice_util.maskToAxes(d),g=s.shape.slice();m.forEach($=>{a[$]=0,o[$]=1,g.splice($,0,1)});let y=As({inputs:{x:s},attrs:{shape:g},backend:t}),{begin:A,end:x,strides:b}=_.slice_util.getNormalizedAxes(y.shape,p,f,a,o,i,l,u,c);a=A,o=x,i=b;let v=_.slice_util.maskToAxes(h);v.forEach($=>{o[$]=a[$]+1,i[$]=1});let w=_.slice_util.computeOutShape(a,o,i),I=w.filter(($,R)=>v.indexOf(R)===-1);if(i.every($=>$===1)){let $=n0({inputs:{x:y},attrs:{begin:a,size:w},backend:t});t.disposeData(y.dataId);let R=As({inputs:{x:$},attrs:{shape:I},backend:t});return t.disposeData($.dataId),R}let C=t.makeOutput(I,"float32");if(!I.some($=>$===0)){let $=t.dataIdMap.get(y.dataId).id,R=new Uint8Array(new Int32Array(k.computeStrides(y.shape)).buffer),N=new Uint8Array(new Int32Array(a).buffer),F=new Uint8Array(new Int32Array(o).buffer),B=new Uint8Array(new Int32Array(i).buffer),j=new Uint8Array(new Int32Array(I).buffer),X=new Uint8Array(new Int32Array(k.computeStrides(I)).buffer),Y=t.dataIdMap.get(C.dataId).id;r$($,R,y.shape.length,N,F,B,j,X,I.length,Y)}t.disposeData(y.dataId);let M=As({inputs:{x:C},attrs:{shape:I},backend:t});return t.disposeData(C.dataId),M}var Q3e={kernelName:ld,backendName:"wasm",setupFunc:Y3e,kernelFunc:J3e},eve=!0,tve=Gn(zo,eve),s$;function nve(e){s$=e.wasm.cwrap(Fl,null,["number, number, number"])}function rve(e){let{backend:t,inputs:n,attrs:r}=e,{axis:s,keepDims:a}=r,{x:o}=n,i=t.dataIdMap.get(o.dataId).id,l=i,u=o,{transposed:c,axes:d,originalAxes:h,inputWasTransposed:p}=to(o,s,t),f=d;if(p){let x=t.dataIdMap.get(c.dataId).id;x!==i&&(u=c,l=x,f=_.getInnerMostAxes(f.length,u.shape.length))}_.assertAxesAreInnerMostDims("sum",f,u.shape.length);let[m,g]=_.computeOutAndReduceShapes(u.shape,f),y=k.sizeFromShape(g),A=t.makeOutput(m,u.dtype);if(k.sizeFromShape(u.shape)!==0){let x=t.dataIdMap.get(A.dataId).id;s$(l,y,x)}if(p&&t.disposeData(c.dataId),a){let x=_.expandShapeToKeepDim(A.shape,h);A.shape=x}return A}var sve={kernelName:Fl,backendName:"wasm",setupFunc:nve,kernelFunc:rve},ave=Hn(Ol),ove=Hn(Pl),a$;function ive(e){a$=e.wasm.cwrap(Lo,null,["number","array","number","array","number","number"])}function lve(e){let{inputs:t,backend:n,attrs:r}=e,{x:s}=t,a=n.dataIdMap.get(s.dataId).id,{reps:o}=r,i=new Array(s.shape.length);for(let h=0;h{let{x:r}=e,{k:s,sorted:a}=n,o=t.dataIdMap.get(r.dataId).id,i=new Uint8Array(new Int32Array(r.shape).buffer),l=r.shape.slice();l[l.length-1]=s;let u=t.makeOutput(l,r.dtype),c=t.dataIdMap.get(u.dataId).id,d=t.makeOutput(l,"int32"),h=t.dataIdMap.get(d.dataId).id;return o$(o,i,r.shape.length,tr[r.dtype],s,a,c,h),[u,d]},hve={kernelName:ud,backendName:"wasm",setupFunc:cve,kernelFunc:dve},i$;function pve(e){i$=e.wasm.cwrap(cd,null,["number","number","bool","number","number","number","number","number","number","array","number","number","number","number","number"])}function fve(e){let{backend:t,inputs:n,attrs:r}=e,{image:s,transforms:a}=n,{interpolation:o,fillMode:i,fillValue:l,outputShape:u}=r,[c,d,h,p]=s.shape,[f,m]=u!=null?u:[d,h],g=[c,f,m,p],y=new Uint8Array(new Int32Array(k.computeStrides(s.shape)).buffer),A=t.makeOutput(g,s.dtype),x=t.dataIdMap.get(A.dataId).id,v=t.dataIdMap.get(s.dataId).id,I=t.dataIdMap.get(a.dataId).id,T=o==="nearest"?1:2,C;switch(i){case"constant":C=1;break;case"reflect":C=2;break;case"wrap":C=3;break;case"nearest":C=4;break;default:C=1;break}return i$(v,I,a.shape[0]>1,c,f,m,p,h,d,y,s.shape.length-1,T,C,l,x),A}var mve={kernelName:cd,backendName:"wasm",setupFunc:pve,kernelFunc:fve};function gve(e){let{inputs:t,backend:n,attrs:r}=e,{value:s}=t,{axis:a}=r;a<0&&(a+=s.shape.length);let o=s.shape[a],i=s.shape.length,l=new Array(i-1),u=0;for(let p=0;p({dataId:p,dtype:f,shape:l}))}var yve={kernelName:dd,backendName:"wasm",kernelFunc:gve};function Ave(e){let{inputs:{x:t},backend:n}=e,r=n.makeOutput(t.shape,t.dtype);return n.typedArrayFromHeap(r).fill(0),r}var xve={kernelName:hd,backendName:"wasm",kernelFunc:Ave},bve=[Txe,Cxe,_xe,Lxe,Vxe,Gxe,Kxe,Jxe,Qxe,e5e,r5e,s5e,i5e,c5e,d5e,f5e,y5e,b5e,k5e,S5e,T5e,N5e,E5e,R5e,D5e,M5e,Sxe,z5e,W5e,H5e,q5e,Z5e,J5e,ebe,Rxe,rbe,abe,ibe,lbe,cbe,pbe,mbe,Abe,vbe,Ibe,Tbe,Ebe,_be,Rbe,Mbe,zbe,Wbe,Ube,jbe,Kbe,Zbe,Qbe,t3e,s3e,i3e,u3e,d3e,h3e,p3e,Xxe,g3e,x3e,w3e,I3e,k3e,N3e,$3e,D3e,F3e,z3e,W3e,U3e,H3e,G3e,q3e,Z3e,Q3e,tve,sve,ave,ove,uve,hve,mve,Oxe,yve,xve];for(let e of bve)oA(e);var yb=ae();yb.registerFlag("WASM_HAS_SIMD_SUPPORT",async()=>WebAssembly.validate(new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,2,1,0,10,9,1,7,0,65,0,253,15,26,11])));yb.registerFlag("WASM_HAS_MULTITHREAD_SUPPORT",async()=>{if(yb.get("IS_NODE"))return!1;try{return new MessageChannel().port1.postMessage(new SharedArrayBuffer(1)),WebAssembly.validate(new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,2,1,0,5,4,1,3,1,1,10,11,1,9,0,65,0,254,16,2,0,26,11]))}catch(e){return!1}});var l$=Ks(IR()),vve='var Module={};function threadPrintErr(){var text=Array.prototype.slice.call(arguments).join(" ");console.error(text)}function threadAlert(){var text=Array.prototype.slice.call(arguments).join(" ");postMessage({cmd:"alert",text:text,threadId:Module["_pthread_self"]()})}var err=threadPrintErr;this.alert=threadAlert;Module["instantiateWasm"]=function(info,receiveInstance){var instance=new WebAssembly.Instance(Module["wasmModule"],info);Module["wasmModule"]=null;receiveInstance(instance);return instance.exports};function moduleLoaded(){}this.onmessage=function(e){try{if(e.data.cmd==="load"){Module["wasmModule"]=e.data.wasmModule;Module["wasmMemory"]=e.data.wasmMemory;Module["buffer"]=Module["wasmMemory"].buffer;Module["ENVIRONMENT_IS_PTHREAD"]=true;if(typeof e.data.urlOrBlob==="string"){importScripts(e.data.urlOrBlob)}else{var objectUrl=URL.createObjectURL(e.data.urlOrBlob);importScripts(objectUrl);URL.revokeObjectURL(objectUrl)}WasmBackendModuleThreadedSimd(Module).then(function(instance){Module=instance;moduleLoaded()})}else if(e.data.cmd==="objectTransfer"){Module["PThread"].receiveObjectTransfer(e.data)}else if(e.data.cmd==="run"){Module["__performance_now_clock_drift"]=performance.now()-e.data.time;Module["__emscripten_thread_init"](e.data.threadInfoStruct,0,0);var max=e.data.stackBase;var top=e.data.stackBase+e.data.stackSize;Module["establishStackSpace"](top,max);Module["_emscripten_tls_init"]();Module["PThread"].receiveObjectTransfer(e.data);Module["PThread"].setThreadStatus(Module["_pthread_self"](),1);try{var result=Module["invokeEntryPoint"](e.data.start_routine,e.data.arg);if(!Module["getNoExitRuntime"]())Module["PThread"].threadExit(result)}catch(ex){if(ex==="Canceled!"){Module["PThread"].threadCancel()}else if(ex!="unwind"){if(ex instanceof Module["ExitStatus"]){if(Module["getNoExitRuntime"]()){}else{Module["PThread"].threadExit(ex.status)}}else{Module["PThread"].threadExit(-2);throw ex}}}}else if(e.data.cmd==="cancel"){if(Module["_pthread_self"]()){Module["PThread"].threadCancel()}}else if(e.data.target==="setimmediate"){}else if(e.data.cmd==="processThreadQueue"){if(Module["_pthread_self"]()){Module["_emscripten_current_thread_process_queued_calls"]()}}else{err("worker.js received unknown command "+e.data.cmd);err(e.data)}}catch(ex){err("worker.js onmessage() captured an uncaught exception: "+ex);if(ex&&ex.stack)err(ex.stack);throw ex}};if(typeof process==="object"&&typeof process.versions==="object"&&typeof process.versions.node==="string"){self={location:{href:__filename}};var onmessage=this.onmessage;var nodeWorkerThreads=require("worker_threads");global.Worker=nodeWorkerThreads.Worker;var parentPort=nodeWorkerThreads.parentPort;parentPort.on("message",function(data){onmessage({data:data})});var nodeFS=require("fs");var nodeRead=function(filename){return nodeFS.readFileSync(filename,"utf8")};function globalEval(x){global.require=require;global.Module=Module;eval.call(null,x)}importScripts=function(f){globalEval(nodeRead(f))};postMessage=function(msg){parentPort.postMessage(msg)};if(typeof performance==="undefined"){performance={now:function(){return Date.now()}}}}',wve=Ks(SR()),u$=class extends Bp{constructor(e){super();this.wasm=e,this.dataIdNextNumber=1,this.wasm.tfjs.init(),this.dataIdMap=new fy(this,za())}write(e,t,n){let r={id:this.dataIdNextNumber++};return this.move(r,e,t,n,1),r}numDataIds(){return this.dataIdMap.numDataIds()}async time(e){let t=k.now();return e(),{kernelMs:k.now()-t}}move(e,t,n,r,s){let a=this.dataIdNextNumber++;if(r==="string"){let u=t;this.dataIdMap.set(e,{id:a,stringBytes:u,shape:n,dtype:r,memoryOffset:null,refCount:s});return}let o=k.sizeFromShape(n),i=o*k.bytesPerElement(r),l=this.wasm._malloc(i);this.dataIdMap.set(e,{id:a,memoryOffset:l,shape:n,dtype:r,refCount:s}),this.wasm.tfjs.registerTensor(a,o,l),t!=null&&this.wasm.HEAPU8.set(new Uint8Array(t.buffer,t.byteOffset,i),l)}async read(e){return this.readSync(e)}readSync(e){let{memoryOffset:t,dtype:n,shape:r,stringBytes:s}=this.dataIdMap.get(e);if(n==="string")return s;let a=this.wasm.HEAPU8.slice(t,t+k.sizeFromShape(r)*k.bytesPerElement(n));return Sve(a.buffer,n)}disposeData(e,t=!1){if(this.dataIdMap.has(e)){let n=this.dataIdMap.get(e);if(n.refCount--,!t&&n.refCount>0)return!1;this.wasm._free(n.memoryOffset),this.wasm.tfjs.disposeData(n.id),this.dataIdMap.delete(e)}return!0}refCount(e){return this.dataIdMap.has(e)?this.dataIdMap.get(e).refCount:0}incRef(e){let t=this.dataIdMap.get(e);t!=null&&t.refCount++}floatPrecision(){return 32}getMemoryOffset(e){return this.dataIdMap.get(e).memoryOffset}dispose(){this.wasm.tfjs.dispose(),"PThread"in this.wasm&&this.wasm.PThread.terminateAllThreads(),this.wasm=null}memory(){return{unreliable:!1}}makeOutput(e,t,n){let r;if(n==null)r=this.write(null,e,t);else{let s=this.dataIdNextNumber++;r={id:s},this.dataIdMap.set(r,{id:s,memoryOffset:n,shape:e,dtype:t,refCount:1});let a=k.sizeFromShape(e);this.wasm.tfjs.registerTensor(s,a,n)}return{dataId:r,shape:e,dtype:t}}typedArrayFromHeap({shape:e,dtype:t,dataId:n}){let r=this.wasm.HEAPU8.buffer,{memoryOffset:s}=this.dataIdMap.get(n),a=k.sizeFromShape(e);switch(t){case"float32":return new Float32Array(r,s,a);case"int32":return new Int32Array(r,s,a);case"bool":return new Uint8Array(r,s,a);default:throw new Error(`Unknown dtype ${t}`)}}};function kve(e){return(t,n)=>(k.fetch(e,{credentials:"same-origin"}).then(r=>{r.ok||t.env.a(`failed to load wasm binary file at '${e}'`),r.arrayBuffer().then(s=>{WebAssembly.instantiate(s,t).then(a=>{n(a.instance,a.module)})})}),{})}function c$(e,t,n){if(r0!=null)return r0;let r="tfjs-backend-wasm.wasm";return e&&t?r="tfjs-backend-wasm-threaded-simd.wasm":e&&(r="tfjs-backend-wasm-simd.wasm"),Ah!=null&&Ah[r]!=null?Ah[r]:n+r}async function Ive(){let[e,t]=await Promise.all([ae().getAsync("WASM_HAS_SIMD_SUPPORT"),ae().getAsync("WASM_HAS_MULTITHREAD_SUPPORT")]);return new Promise((n,r)=>{let s={};s.locateFile=(i,l)=>{if(i.endsWith(".worker.js")){let u=vve,c=new Blob([u],{type:"application/javascript"});return URL.createObjectURL(c)}return i.endsWith(".wasm")?c$(e,t,yh!=null?yh:l):l+i},Ab&&(s.instantiateWasm=kve(c$(e,t,yh!=null?yh:"")));let a=!1;s.onAbort=()=>{if(a||xh)return;xh=!0,r({message:"Make sure the server can serve the `.wasm` file relative to the bundled js file. For more details see https://github.com/tensorflow/tfjs/blob/master/tfjs-backend-wasm/README.md#using-bundlers"})};let o;t&&e&&r0==null?(s.mainScriptUrlOrBlob=new Blob(["var WasmBackendModuleThreadedSimd = "+l$.default.toString()],{type:"text/javascript"}),o=(0,l$.default)(s)):o=(0,wve.default)(s),o.then(i=>{a=!0,xh=!1;let l=null;i.tfjs={init:i.cwrap("init",null,[]),registerTensor:i.cwrap("register_tensor",null,["number","number","number"]),disposeData:i.cwrap("dispose_data",l,["number"]),dispose:i.cwrap("dispose",l,[])},n({wasm:i})})})}function Sve(e,t){switch(t){case"float32":return new Float32Array(e);case"int32":return new Int32Array(e);case"bool":return new Uint8Array(e);default:throw new Error(`Unknown dtype ${t}`)}}var Tve=["tfjs-backend-wasm.wasm","tfjs-backend-wasm-simd.wasm","tfjs-backend-wasm-threaded-simd.wasm"],r0=null,yh=null,Ah={},xh=!1,Ab=!1;function Nve(e,t=!1){if(W6("setWasmPath has been deprecated in favor of setWasmPaths and will be removed in a future release."),xh)throw new Error("The WASM backend was already initialized. Make sure you call `setWasmPath()` before you call `tf.setBackend()` or `tf.ready()`");r0=e,Ab=t}function Cve(e,t=!1){if(xh)throw new Error("The WASM backend was already initialized. Make sure you call `setWasmPaths()` before you call `tf.setBackend()` or `tf.ready()`");if(typeof e=="string")yh=e;else{Ah=e;let n=Tve.filter(r=>Ah[r]==null);if(n.length>0)throw new Error(`There were no entries found for the following binaries: ${n.join(",")}. Please either call setWasmPaths with a map providing a path for each binary, or with a string indicating the directory where all the binaries can be found.`)}Ab=t}var Eve="3.7.0",$ve=2;$A("wasm",async()=>{let{wasm:e}=await Ive();return new u$(e)},$ve);var _ve={tfjs:TR,"tfjs-core":NR,"tfjs-data":CR,"tfjs-layers":ER,"tfjs-converter":$R,"tfjs-backend-cpu":_R,"tfjs-backend-webgl":RR,"tfjs-backend-wasm":DR};var gr={name:"humangl",priority:99,canvas:null,gl:null,width:1024,height:1024,webGLattr:{alpha:!1,antialias:!1,premultipliedAlpha:!1,preserveDrawingBuffer:!1,depth:!1,stencil:!1,failIfMajorPerformanceCaveat:!1,desynchronized:!0}};function d$(){if(!q2(gr.name)){me("backend registration:",gr.name);try{gr.canvas=typeof OffscreenCanvas!="undefined"?new OffscreenCanvas(gr.width,gr.height):document.createElement("canvas")}catch(e){me("error: cannot create canvas:",e);return}try{gr.gl=gr.canvas.getContext("webgl2",gr.webGLattr)}catch(e){me("error: cannot get WebGL2 context:",e);return}try{Dm(2,gr.gl)}catch(e){me("error: cannot set WebGL2 context:",e);return}try{let e=new Bm(gr.gl);K2(gr.name,()=>new dh(e),gr.priority)}catch(e){me("error: cannot register WebGL backend:",e);return}try{Li("webgl").forEach(t=>{let n={...t,backendName:gr.name};sp(n)})}catch(e){me("error: cannot update WebGL backend registration:",e);return}try{Sr.set("WEBGL_VERSION",2)}catch(e){me("error: cannot set WebGL backend flags:",e);return}me("backend registered:",gr.name)}}function h$(e,t){let n=[e.startPoint[0]*t[0],e.startPoint[1]*t[1]],r=[e.endPoint[0]*t[0],e.endPoint[1]*t[1]];return{startPoint:n,endPoint:r}}function vh(e){return[Math.abs(e.endPoint[0]-e.startPoint[0]),Math.abs(e.endPoint[1]-e.startPoint[1])]}function Tu(e){return[e.startPoint[0]+(e.endPoint[0]-e.startPoint[0])/2,e.startPoint[1]+(e.endPoint[1]-e.startPoint[1])/2]}function Nu(e,t,n){let r=t.shape[1],s=t.shape[2],a=[[e.startPoint[1]/r,e.startPoint[0]/s,e.endPoint[1]/r,e.endPoint[0]/s]];return Ye.cropAndResize(t,a,[0],n)}function s0(e,t=1.5){let n=Tu(e),r=vh(e),s=[t*r[0]/2,t*r[1]/2],a=[n[0]-s[0],n[1]-s[1]],o=[n[0]+s[0],n[1]+s[1]];return{startPoint:a,endPoint:o,landmarks:e.landmarks}}function a0(e){let t=Tu(e),n=vh(e),s=Math.max(...n)/2,a=[Math.round(t[0]-s),Math.round(t[1]-s)],o=[Math.round(t[0]+s),Math.round(t[1]+s)];return{startPoint:a,endPoint:o,landmarks:e.landmarks}}function xb(e){let t=e.map(a=>a[0]),n=e.map(a=>a[1]),r=[Math.min(...t),Math.min(...n)],s=[Math.max(...t),Math.max(...n)];return{startPoint:r,endPoint:s,landmarks:e}}var p$=e=>({startPoint:Ze(e,[0,0],[-1,2]),endPoint:Ze(e,[0,2],[-1,2])});var o0=[[1,0,0],[0,1,0],[0,0,1]];function Rve(e){return e-2*Math.PI*Math.floor((e+Math.PI)/(2*Math.PI))}function bb(e,t){let n=Math.PI/2-Math.atan2(-(t[1]-e[1]),t[0]-e[0]);return Rve(n)}function f$(e,t){return[[1,0,e],[0,1,t],[0,0,1]]}function no(e,t){let n=0;for(let r=0;r{let u=Ye.resizeBilinear(t,[this.inputSize,this.inputSize]).div(127.5).sub(.5),c=this.model.execute(u),d;if(Array.isArray(c)){let m=c.sort((x,b)=>x.size-b.size),g=an([m[0],m[2]],2),y=an([m[1],m[3]],2);d=an([y,g],1).squeeze(0)}else d=Zn(c);let h=Fve(d,this.anchors,[this.inputSize,this.inputSize]),p=Ze(d,[0,0],[-1,1]),f=Ts(p).squeeze().dataSync();return[d,h,f]}),a=await Ye.nonMaxSuppressionAsync(r,s,this.config.face.detector.maxDetected,this.config.face.detector.iouThreshold,this.config.face.detector.minConfidence),o=a.arraySync();a.dispose();let i=[];for(let l=0;lthis.config.face.detector.minConfidence){let c=Ze(r,[o[l],0],[1,-1]),d=p$(c);c.dispose();let h=this.anchorsData[o[l]],p=Ue(()=>Ze(n,[o[l],x$-1],[1,-1]).squeeze().reshape([x$,-1]));i.push({box:d,landmarks:p,anchor:h,confidence:u})}}return n.dispose(),r.dispose(),{boxes:i,scaleFactor:[t.shape[2]/this.inputSize,t.shape[1]/this.inputSize]}}};async function v$(e){let t=await Et($t(e.modelBasePath,e.face.detector.modelPath),{fromTFHub:e.face.detector.modelPath.includes("tfhub.dev")}),n=new b$(t,e);return!t||!t.modelUrl?me("load model failed:",e.face.detector.modelPath):e.debug&&me("load model:",t.modelUrl),n}var Bs={silhouette:[10,338,297,332,284,251,389,356,454,323,361,288,397,365,379,378,400,377,152,148,176,149,150,136,172,58,132,93,234,127,162,21,54,103,67,109],lipsUpperOuter:[61,185,40,39,37,0,267,269,270,409,291],lipsLowerOuter:[146,91,181,84,17,314,405,321,375,291],lipsUpperInner:[78,191,80,81,82,13,312,311,310,415,308],lipsLowerInner:[78,95,88,178,87,14,317,402,318,324,308],rightEyeUpper0:[246,161,160,159,158,157,173],rightEyeLower0:[33,7,163,144,145,153,154,155,133],rightEyeUpper1:[247,30,29,27,28,56,190],rightEyeLower1:[130,25,110,24,23,22,26,112,243],rightEyeUpper2:[113,225,224,223,222,221,189],rightEyeLower2:[226,31,228,229,230,231,232,233,244],rightEyeLower3:[143,111,117,118,119,120,121,128,245],rightEyebrowUpper:[156,70,63,105,66,107,55,193],rightEyebrowLower:[35,124,46,53,52,65],rightEyeIris:[473,474,475,476,477],leftEyeUpper0:[466,388,387,386,385,384,398],leftEyeLower0:[263,249,390,373,374,380,381,382,362],leftEyeUpper1:[467,260,259,257,258,286,414],leftEyeLower1:[359,255,339,254,253,252,256,341,463],leftEyeUpper2:[342,445,444,443,442,441,413],leftEyeLower2:[446,261,448,449,450,451,452,453,464],leftEyeLower3:[372,340,346,347,348,349,350,357,465],leftEyebrowUpper:[383,300,293,334,296,336,285,417],leftEyebrowLower:[265,353,276,283,282,295],leftEyeIris:[468,469,470,471,472],midwayBetweenEyes:[168],noseTip:[1],noseBottom:[2],noseRightCorner:[98],noseLeftCorner:[327],rightCheek:[205],leftCheek:[425]},vb=[{key:"EyeUpper0",indices:[9,10,11,12,13,14,15]},{key:"EyeUpper1",indices:[25,26,27,28,29,30,31]},{key:"EyeUpper2",indices:[41,42,43,44,45,46,47]},{key:"EyeLower0",indices:[0,1,2,3,4,5,6,7,8]},{key:"EyeLower1",indices:[16,17,18,19,20,21,22,23,24]},{key:"EyeLower2",indices:[32,33,34,35,36,37,38,39,40]},{key:"EyeLower3",indices:[54,55,56,57,58,59,60,61,62]}],wh=[[.499976992607117,.652534008026123],[.500025987625122,.547487020492554],[.499974012374878,.602371990680695],[.482113003730774,.471979022026062],[.500150978565216,.527155995368958],[.499909996986389,.498252987861633],[.499523013830185,.40106201171875],[.289712011814117,.380764007568359],[.499954998493195,.312398016452789],[.499987006187439,.269918978214264],[.500023007392883,.107050001621246],[.500023007392883,.666234016418457],[.5000159740448,.679224014282227],[.500023007392883,.692348003387451],[.499976992607117,.695277988910675],[.499976992607117,.70593398809433],[.499976992607117,.719385027885437],[.499976992607117,.737019002437592],[.499967992305756,.781370997428894],[.499816000461578,.562981009483337],[.473773002624512,.573909997940063],[.104906998574734,.254140973091125],[.365929991006851,.409575998783112],[.338757991790771,.41302502155304],[.311120003461838,.409460008144379],[.274657994508743,.389131009578705],[.393361985683441,.403706014156342],[.345234006643295,.344011008739471],[.370094001293182,.346076011657715],[.319321990013123,.347265005111694],[.297903001308441,.353591024875641],[.24779200553894,.410809993743896],[.396889001131058,.842755019664764],[.280097991228104,.375599980354309],[.106310002505779,.399955987930298],[.2099249958992,.391353011131287],[.355807989835739,.534406006336212],[.471751004457474,.65040397644043],[.474155008792877,.680191993713379],[.439785003662109,.657229006290436],[.414617002010345,.66654098033905],[.450374007225037,.680860996246338],[.428770989179611,.682690978050232],[.374971002340317,.727805018424988],[.486716985702515,.547628998756409],[.485300987958908,.527395009994507],[.257764995098114,.314490020275116],[.401223003864288,.455172002315521],[.429818987846375,.548614978790283],[.421351999044418,.533740997314453],[.276895999908447,.532056987285614],[.483370006084442,.499586999416351],[.33721199631691,.282882988452911],[.296391993761063,.293242990970612],[.169294998049736,.193813979625702],[.447580009698868,.302609980106354],[.392390012741089,.353887975215912],[.354490011930466,.696784019470215],[.067304998636246,.730105042457581],[.442739009857178,.572826027870178],[.457098007202148,.584792017936707],[.381974011659622,.694710969924927],[.392388999462128,.694203019142151],[.277076005935669,.271932005882263],[.422551989555359,.563233017921448],[.385919004678726,.281364023685455],[.383103013038635,.255840003490448],[.331431001424789,.119714021682739],[.229923993349075,.232002973556519],[.364500999450684,.189113974571228],[.229622006416321,.299540996551514],[.173287004232407,.278747975826263],[.472878992557526,.666198015213013],[.446828007698059,.668527007102966],[.422762006521225,.673889994621277],[.445307999849319,.580065965652466],[.388103008270264,.693961024284363],[.403039008378983,.706539988517761],[.403629004955292,.693953037261963],[.460041999816895,.557139039039612],[.431158006191254,.692366003990173],[.452181994915009,.692366003990173],[.475387006998062,.692366003990173],[.465828001499176,.779190003871918],[.472328990697861,.736225962638855],[.473087012767792,.717857003211975],[.473122000694275,.704625964164734],[.473033010959625,.695277988910675],[.427942007780075,.695277988910675],[.426479011774063,.703539967536926],[.423162013292313,.711845993995667],[.4183090031147,.720062971115112],[.390094995498657,.639572978019714],[.013953999616206,.560034036636353],[.499913990497589,.58014702796936],[.413199990987778,.69539999961853],[.409626007080078,.701822996139526],[.468080013990402,.601534962654114],[.422728985548019,.585985004901886],[.463079988956451,.593783974647522],[.37211999297142,.47341400384903],[.334562003612518,.496073007583618],[.411671012639999,.546965003013611],[.242175996303558,.14767599105835],[.290776997804642,.201445996761322],[.327338010072708,.256527006626129],[.399509996175766,.748921036720276],[.441727995872498,.261676013469696],[.429764986038208,.187834024429321],[.412198007106781,.108901023864746],[.288955003023148,.398952007293701],[.218936994671822,.435410976409912],[.41278201341629,.398970007896423],[.257135003805161,.355440020561218],[.427684992551804,.437960982322693],[.448339998722076,.536936044692993],[.178560003638268,.45755398273468],[.247308000922203,.457193970680237],[.286267012357712,.467674970626831],[.332827985286713,.460712015628815],[.368755996227264,.447206974029541],[.398963987827301,.432654976844788],[.476410001516342,.405806005001068],[.189241006970406,.523923993110657],[.228962004184723,.348950982093811],[.490725994110107,.562400996685028],[.404670000076294,.485132992267609],[.019469000399113,.401564002037048],[.426243007183075,.420431017875671],[.396993011236191,.548797011375427],[.266469985246658,.376977026462555],[.439121007919312,.51895797252655],[.032313998788595,.644356966018677],[.419054001569748,.387154996395111],[.462783008813858,.505746960639954],[.238978996872902,.779744982719421],[.198220998048782,.831938028335571],[.107550002634525,.540755033493042],[.183610007166862,.740257024765015],[.134409993886948,.333683013916016],[.385764002799988,.883153975009918],[.490967005491257,.579378008842468],[.382384985685349,.508572995662689],[.174399003386497,.397670984268188],[.318785011768341,.39623498916626],[.343364000320435,.400596976280212],[.396100014448166,.710216999053955],[.187885001301765,.588537991046906],[.430987000465393,.944064974784851],[.318993002176285,.898285031318665],[.266247987747192,.869701027870178],[.500023007392883,.190576016902924],[.499976992607117,.954452991485596],[.366169989109039,.398822009563446],[.393207013607025,.39553701877594],[.410373002290726,.391080021858215],[.194993004202843,.342101991176605],[.388664990663528,.362284004688263],[.365961998701096,.355970978736877],[.343364000320435,.355356991291046],[.318785011768341,.35834002494812],[.301414996385574,.363156020641327],[.058132998645306,.319076001644135],[.301414996385574,.387449026107788],[.499987989664078,.618434011936188],[.415838003158569,.624195992946625],[.445681989192963,.566076993942261],[.465844005346298,.620640993118286],[.49992299079895,.351523995399475],[.288718998432159,.819945991039276],[.335278987884521,.852819979190826],[.440512001514435,.902418971061707],[.128294005990028,.791940987110138],[.408771991729736,.373893976211548],[.455606997013092,.451801002025604],[.499877005815506,.908990025520325],[.375436991453171,.924192011356354],[.11421000212431,.615022003650665],[.448662012815475,.695277988910675],[.4480200111866,.704632043838501],[.447111994028091,.715808033943176],[.444831997156143,.730794012546539],[.430011987686157,.766808986663818],[.406787008047104,.685672998428345],[.400738000869751,.681069016456604],[.392399996519089,.677703022956848],[.367855995893478,.663918972015381],[.247923001646996,.601333022117615],[.452769994735718,.420849978923798],[.43639200925827,.359887003898621],[.416164010763168,.368713974952698],[.413385987281799,.692366003990173],[.228018000721931,.683571994304657],[.468268007040024,.352671027183533],[.411361992359161,.804327011108398],[.499989002943039,.469825029373169],[.479153990745544,.442654013633728],[.499974012374878,.439637005329132],[.432112008333206,.493588984012604],[.499886006116867,.866917014122009],[.49991300702095,.821729004383087],[.456548988819122,.819200992584229],[.344549000263214,.745438992977142],[.37890899181366,.574010014533997],[.374292999505997,.780184984207153],[.319687992334366,.570737957954407],[.357154995203018,.604269981384277],[.295284003019333,.621580958366394],[.447750002145767,.862477004528046],[.410986006259918,.508723020553589],[.31395098567009,.775308012962341],[.354128003120422,.812552988529205],[.324548006057739,.703992962837219],[.189096003770828,.646299958229065],[.279776990413666,.71465802192688],[.1338230073452,.682700991630554],[.336768001317978,.644733011722565],[.429883986711502,.466521978378296],[.455527991056442,.548622965812683],[.437114000320435,.558896005153656],[.467287987470627,.529924988746643],[.414712011814117,.335219979286194],[.37704598903656,.322777986526489],[.344107985496521,.320150971412659],[.312875986099243,.32233202457428],[.283526003360748,.333190023899078],[.241245999932289,.382785975933075],[.102986000478268,.468762993812561],[.267612010240555,.424560010433197],[.297879010438919,.433175981044769],[.333433985710144,.433878004550934],[.366427004337311,.426115989685059],[.396012008190155,.416696012020111],[.420121014118195,.41022801399231],[.007561000064015,.480777025222778],[.432949006557465,.569517970085144],[.458638995885849,.479089021682739],[.473466008901596,.545744001865387],[.476087987422943,.563830018043518],[.468472003936768,.555056989192963],[.433990985155106,.582361996173859],[.483518004417419,.562983989715576],[.482482999563217,.57784903049469],[.42645001411438,.389798998832703],[.438998997211456,.39649498462677],[.450067013502121,.400434017181396],[.289712011814117,.368252992630005],[.276670008897781,.363372981548309],[.517862021923065,.471948027610779],[.710287988185883,.380764007568359],[.526226997375488,.573909997940063],[.895093023777008,.254140973091125],[.634069979190826,.409575998783112],[.661242008209229,.41302502155304],[.688880026340485,.409460008144379],[.725341975688934,.389131009578705],[.606630027294159,.40370500087738],[.654766023159027,.344011008739471],[.629905998706818,.346076011657715],[.680678009986877,.347265005111694],[.702096998691559,.353591024875641],[.75221198797226,.410804986953735],[.602918028831482,.842862963676453],[.719901978969574,.375599980354309],[.893692970275879,.399959981441498],[.790081977844238,.391354024410248],[.643998026847839,.534487962722778],[.528249025344849,.65040397644043],[.525849997997284,.680191040039062],[.560214996337891,.657229006290436],[.585384011268616,.66654098033905],[.549625992774963,.680860996246338],[.57122802734375,.682691991329193],[.624852001667023,.72809898853302],[.513050019741058,.547281980514526],[.51509702205658,.527251958847046],[.742246985435486,.314507007598877],[.598631024360657,.454979002475739],[.570338010787964,.548575043678284],[.578631997108459,.533622980117798],[.723087012767792,.532054007053375],[.516445994377136,.499638974666595],[.662801027297974,.282917976379395],[.70362401008606,.293271005153656],[.830704987049103,.193813979625702],[.552385985851288,.302568018436432],[.607609987258911,.353887975215912],[.645429015159607,.696707010269165],[.932694971561432,.730105042457581],[.557260990142822,.572826027870178],[.542901992797852,.584792017936707],[.6180260181427,.694710969924927],[.607590973377228,.694203019142151],[.722943007946014,.271963000297546],[.577413976192474,.563166975975037],[.614082992076874,.281386971473694],[.616907000541687,.255886018276215],[.668509006500244,.119913995265961],[.770092010498047,.232020974159241],[.635536015033722,.189248979091644],[.77039098739624,.299556016921997],[.826722025871277,.278755009174347],[.527121007442474,.666198015213013],[.553171992301941,.668527007102966],[.577238023281097,.673889994621277],[.554691970348358,.580065965652466],[.611896991729736,.693961024284363],[.59696102142334,.706539988517761],[.596370995044708,.693953037261963],[.539958000183105,.557139039039612],[.568841993808746,.692366003990173],[.547818005084991,.692366003990173],[.52461302280426,.692366003990173],[.534089982509613,.779141008853912],[.527670979499817,.736225962638855],[.526912987232208,.717857003211975],[.526877999305725,.704625964164734],[.526966989040375,.695277988910675],[.572058022022247,.695277988910675],[.573521018028259,.703539967536926],[.57683801651001,.711845993995667],[.581691026687622,.720062971115112],[.609944999217987,.639909982681274],[.986046016216278,.560034036636353],[.5867999792099,.69539999961853],[.590372025966644,.701822996139526],[.531915009021759,.601536989212036],[.577268004417419,.585934996604919],[.536915004253387,.593786001205444],[.627542972564697,.473352015018463],[.665585994720459,.495950996875763],[.588353991508484,.546862006187439],[.757824003696442,.14767599105835],[.709249973297119,.201507985591888],[.672684013843536,.256581008434296],[.600408971309662,.74900496006012],[.55826598405838,.261672019958496],[.570303976535797,.187870979309082],[.588165998458862,.109044015407562],[.711045026779175,.398952007293701],[.781069993972778,.435405015945435],[.587247014045715,.398931980133057],[.742869973182678,.355445981025696],[.572156012058258,.437651991844177],[.55186802148819,.536570012569427],[.821442008018494,.457556009292603],[.752701997756958,.457181990146637],[.71375697851181,.467626988887787],[.66711300611496,.460672974586487],[.631101012229919,.447153985500336],[.6008620262146,.432473003864288],[.523481011390686,.405627012252808],[.810747981071472,.523926019668579],[.771045982837677,.348959028720856],[.509127020835876,.562718033790588],[.595292985439301,.485023975372314],[.980530977249146,.401564002037048],[.573499977588654,.420000016689301],[.602994978427887,.548687994480133],[.733529984951019,.376977026462555],[.560611009597778,.519016981124878],[.967685997486115,.644356966018677],[.580985009670258,.387160003185272],[.537728011608124,.505385041236877],[.760966002941132,.779752969741821],[.801778972148895,.831938028335571],[.892440974712372,.54076099395752],[.816350996494293,.740260004997253],[.865594983100891,.333687007427216],[.614073991775513,.883246004581451],[.508952975273132,.579437971115112],[.617941975593567,.508316040039062],[.825608015060425,.397674977779388],[.681214988231659,.39623498916626],[.656635999679565,.400596976280212],[.603900015354156,.710216999053955],[.81208598613739,.588539004325867],[.56801301240921,.944564998149872],[.681007981300354,.898285031318665],[.733752012252808,.869701027870178],[.633830010890961,.398822009563446],[.606792986392975,.39553701877594],[.589659988880157,.391062021255493],[.805015981197357,.342108011245728],[.611334979534149,.362284004688263],[.634037971496582,.355970978736877],[.656635999679565,.355356991291046],[.681214988231659,.35834002494812],[.698584973812103,.363156020641327],[.941866993904114,.319076001644135],[.698584973812103,.387449026107788],[.584177017211914,.624107003211975],[.554318010807037,.566076993942261],[.534153997898102,.62064003944397],[.711217999458313,.819975018501282],[.664629995822906,.852871000766754],[.559099972248077,.902631998062134],[.871706008911133,.791940987110138],[.591234028339386,.373893976211548],[.544341027736664,.451583981513977],[.624562978744507,.924192011356354],[.88577002286911,.615028977394104],[.551338016986847,.695277988910675],[.551980018615723,.704632043838501],[.552887976169586,.715808033943176],[.555167973041534,.730794012546539],[.569944024085999,.767035007476807],[.593203008174896,.685675978660583],[.599261999130249,.681069016456604],[.607599973678589,.677703022956848],[.631937980651855,.663500010967255],[.752032995223999,.601315021514893],[.547226011753082,.420395016670227],[.563543975353241,.359827995300293],[.583841025829315,.368713974952698],[.586614012718201,.692366003990173],[.771915018558502,.683578014373779],[.531597018241882,.352482974529266],[.588370978832245,.804440975189209],[.52079701423645,.442565023899078],[.567984998226166,.493479013442993],[.543282985687256,.819254994392395],[.655317008495331,.745514988899231],[.621008992195129,.574018001556396],[.625559985637665,.78031200170517],[.680198013782501,.570719003677368],[.64276397228241,.604337990283966],[.704662978649139,.621529996395111],[.552012026309967,.862591981887817],[.589071989059448,.508637011051178],[.685944974422455,.775357007980347],[.645735025405884,.812640011310577],[.675342977046967,.703978002071381],[.810858011245728,.646304965019226],[.72012197971344,.714666962623596],[.866151988506317,.682704985141754],[.663187026977539,.644596993923187],[.570082008838654,.466325998306274],[.544561982154846,.548375964164734],[.562758982181549,.558784961700439],[.531987011432648,.530140042304993],[.585271000862122,.335177004337311],[.622952997684479,.32277899980545],[.655896008014679,.320163011550903],[.687132000923157,.322345972061157],[.716481983661652,.333200991153717],[.758756995201111,.382786989212036],[.897013008594513,.468769013881683],[.732392013072968,.424547016620636],[.70211398601532,.433162987232208],[.66652500629425,.433866024017334],[.633504986763,.426087975502014],[.603875994682312,.416586995124817],[.579657971858978,.409945011138916],[.992439985275269,.480777025222778],[.567192018032074,.569419980049133],[.54136598110199,.478899002075195],[.526564002037048,.546118021011353],[.523913025856018,.563830018043518],[.531529009342194,.555056989192963],[.566035985946655,.582329034805298],[.51631098985672,.563053965568542],[.5174720287323,.577877044677734],[.573594987392426,.389806985855103],[.560697972774506,.395331978797913],[.549755990505219,.399751007556915],[.710287988185883,.368252992630005],[.723330020904541,.363372981548309]],vi=[127,34,139,11,0,37,232,231,120,72,37,39,128,121,47,232,121,128,104,69,67,175,171,148,157,154,155,118,50,101,73,39,40,9,151,108,48,115,131,194,204,211,74,40,185,80,42,183,40,92,186,230,229,118,202,212,214,83,18,17,76,61,146,160,29,30,56,157,173,106,204,194,135,214,192,203,165,98,21,71,68,51,45,4,144,24,23,77,146,91,205,50,187,201,200,18,91,106,182,90,91,181,85,84,17,206,203,36,148,171,140,92,40,39,193,189,244,159,158,28,247,246,161,236,3,196,54,68,104,193,168,8,117,228,31,189,193,55,98,97,99,126,47,100,166,79,218,155,154,26,209,49,131,135,136,150,47,126,217,223,52,53,45,51,134,211,170,140,67,69,108,43,106,91,230,119,120,226,130,247,63,53,52,238,20,242,46,70,156,78,62,96,46,53,63,143,34,227,173,155,133,123,117,111,44,125,19,236,134,51,216,206,205,154,153,22,39,37,167,200,201,208,36,142,100,57,212,202,20,60,99,28,158,157,35,226,113,160,159,27,204,202,210,113,225,46,43,202,204,62,76,77,137,123,116,41,38,72,203,129,142,64,98,240,49,102,64,41,73,74,212,216,207,42,74,184,169,170,211,170,149,176,105,66,69,122,6,168,123,147,187,96,77,90,65,55,107,89,90,180,101,100,120,63,105,104,93,137,227,15,86,85,129,102,49,14,87,86,55,8,9,100,47,121,145,23,22,88,89,179,6,122,196,88,95,96,138,172,136,215,58,172,115,48,219,42,80,81,195,3,51,43,146,61,171,175,199,81,82,38,53,46,225,144,163,110,246,33,7,52,65,66,229,228,117,34,127,234,107,108,69,109,108,151,48,64,235,62,78,191,129,209,126,111,35,143,163,161,246,117,123,50,222,65,52,19,125,141,221,55,65,3,195,197,25,7,33,220,237,44,70,71,139,122,193,245,247,130,33,71,21,162,153,158,159,170,169,150,188,174,196,216,186,92,144,160,161,2,97,167,141,125,241,164,167,37,72,38,12,145,159,160,38,82,13,63,68,71,226,35,111,158,153,154,101,50,205,206,92,165,209,198,217,165,167,97,220,115,218,133,112,243,239,238,241,214,135,169,190,173,133,171,208,32,125,44,237,86,87,178,85,86,179,84,85,180,83,84,181,201,83,182,137,93,132,76,62,183,61,76,184,57,61,185,212,57,186,214,207,187,34,143,156,79,239,237,123,137,177,44,1,4,201,194,32,64,102,129,213,215,138,59,166,219,242,99,97,2,94,141,75,59,235,24,110,228,25,130,226,23,24,229,22,23,230,26,22,231,112,26,232,189,190,243,221,56,190,28,56,221,27,28,222,29,27,223,30,29,224,247,30,225,238,79,20,166,59,75,60,75,240,147,177,215,20,79,166,187,147,213,112,233,244,233,128,245,128,114,188,114,217,174,131,115,220,217,198,236,198,131,134,177,132,58,143,35,124,110,163,7,228,110,25,356,389,368,11,302,267,452,350,349,302,303,269,357,343,277,452,453,357,333,332,297,175,152,377,384,398,382,347,348,330,303,304,270,9,336,337,278,279,360,418,262,431,304,408,409,310,415,407,270,409,410,450,348,347,422,430,434,313,314,17,306,307,375,387,388,260,286,414,398,335,406,418,364,367,416,423,358,327,251,284,298,281,5,4,373,374,253,307,320,321,425,427,411,421,313,18,321,405,406,320,404,405,315,16,17,426,425,266,377,400,369,322,391,269,417,465,464,386,257,258,466,260,388,456,399,419,284,332,333,417,285,8,346,340,261,413,441,285,327,460,328,355,371,329,392,439,438,382,341,256,429,420,360,364,394,379,277,343,437,443,444,283,275,440,363,431,262,369,297,338,337,273,375,321,450,451,349,446,342,467,293,334,282,458,461,462,276,353,383,308,324,325,276,300,293,372,345,447,382,398,362,352,345,340,274,1,19,456,248,281,436,427,425,381,256,252,269,391,393,200,199,428,266,330,329,287,273,422,250,462,328,258,286,384,265,353,342,387,259,257,424,431,430,342,353,276,273,335,424,292,325,307,366,447,345,271,303,302,423,266,371,294,455,460,279,278,294,271,272,304,432,434,427,272,407,408,394,430,431,395,369,400,334,333,299,351,417,168,352,280,411,325,319,320,295,296,336,319,403,404,330,348,349,293,298,333,323,454,447,15,16,315,358,429,279,14,15,316,285,336,9,329,349,350,374,380,252,318,402,403,6,197,419,318,319,325,367,364,365,435,367,397,344,438,439,272,271,311,195,5,281,273,287,291,396,428,199,311,271,268,283,444,445,373,254,339,263,466,249,282,334,296,449,347,346,264,447,454,336,296,299,338,10,151,278,439,455,292,407,415,358,371,355,340,345,372,390,249,466,346,347,280,442,443,282,19,94,370,441,442,295,248,419,197,263,255,359,440,275,274,300,383,368,351,412,465,263,467,466,301,368,389,380,374,386,395,378,379,412,351,419,436,426,322,373,390,388,2,164,393,370,462,461,164,0,267,302,11,12,374,373,387,268,12,13,293,300,301,446,261,340,385,384,381,330,266,425,426,423,391,429,355,437,391,327,326,440,457,438,341,382,362,459,457,461,434,430,394,414,463,362,396,369,262,354,461,457,316,403,402,315,404,403,314,405,404,313,406,405,421,418,406,366,401,361,306,408,407,291,409,408,287,410,409,432,436,410,434,416,411,264,368,383,309,438,457,352,376,401,274,275,4,421,428,262,294,327,358,433,416,367,289,455,439,462,370,326,2,326,370,305,460,455,254,449,448,255,261,446,253,450,449,252,451,450,256,452,451,341,453,452,413,464,463,441,413,414,258,442,441,257,443,442,259,444,443,260,445,444,467,342,445,459,458,250,289,392,290,290,328,460,376,433,435,250,290,392,411,416,433,341,463,464,453,464,465,357,465,412,343,412,399,360,363,440,437,399,456,420,456,363,401,435,288,372,383,353,339,255,249,448,261,255,133,243,190,133,155,112,33,246,247,33,130,25,398,384,286,362,398,414,362,463,341,263,359,467,263,249,255,466,467,260,75,60,166,238,239,79,162,127,139,72,11,37,121,232,120,73,72,39,114,128,47,233,232,128,103,104,67,152,175,148,173,157,155,119,118,101,74,73,40,107,9,108,49,48,131,32,194,211,184,74,185,191,80,183,185,40,186,119,230,118,210,202,214,84,83,17,77,76,146,161,160,30,190,56,173,182,106,194,138,135,192,129,203,98,54,21,68,5,51,4,145,144,23,90,77,91,207,205,187,83,201,18,181,91,182,180,90,181,16,85,17,205,206,36,176,148,140,165,92,39,245,193,244,27,159,28,30,247,161,174,236,196,103,54,104,55,193,8,111,117,31,221,189,55,240,98,99,142,126,100,219,166,218,112,155,26,198,209,131,169,135,150,114,47,217,224,223,53,220,45,134,32,211,140,109,67,108,146,43,91,231,230,120,113,226,247,105,63,52,241,238,242,124,46,156,95,78,96,70,46,63,116,143,227,116,123,111,1,44,19,3,236,51,207,216,205,26,154,22,165,39,167,199,200,208,101,36,100,43,57,202,242,20,99,56,28,157,124,35,113,29,160,27,211,204,210,124,113,46,106,43,204,96,62,77,227,137,116,73,41,72,36,203,142,235,64,240,48,49,64,42,41,74,214,212,207,183,42,184,210,169,211,140,170,176,104,105,69,193,122,168,50,123,187,89,96,90,66,65,107,179,89,180,119,101,120,68,63,104,234,93,227,16,15,85,209,129,49,15,14,86,107,55,9,120,100,121,153,145,22,178,88,179,197,6,196,89,88,96,135,138,136,138,215,172,218,115,219,41,42,81,5,195,51,57,43,61,208,171,199,41,81,38,224,53,225,24,144,110,105,52,66,118,229,117,227,34,234,66,107,69,10,109,151,219,48,235,183,62,191,142,129,126,116,111,143,7,163,246,118,117,50,223,222,52,94,19,141,222,221,65,196,3,197,45,220,44,156,70,139,188,122,245,139,71,162,145,153,159,149,170,150,122,188,196,206,216,92,163,144,161,164,2,167,242,141,241,0,164,37,11,72,12,144,145,160,12,38,13,70,63,71,31,226,111,157,158,154,36,101,205,203,206,165,126,209,217,98,165,97,237,220,218,237,239,241,210,214,169,140,171,32,241,125,237,179,86,178,180,85,179,181,84,180,182,83,181,194,201,182,177,137,132,184,76,183,185,61,184,186,57,185,216,212,186,192,214,187,139,34,156,218,79,237,147,123,177,45,44,4,208,201,32,98,64,129,192,213,138,235,59,219,141,242,97,97,2,141,240,75,235,229,24,228,31,25,226,230,23,229,231,22,230,232,26,231,233,112,232,244,189,243,189,221,190,222,28,221,223,27,222,224,29,223,225,30,224,113,247,225,99,60,240,213,147,215,60,20,166,192,187,213,243,112,244,244,233,245,245,128,188,188,114,174,134,131,220,174,217,236,236,198,134,215,177,58,156,143,124,25,110,7,31,228,25,264,356,368,0,11,267,451,452,349,267,302,269,350,357,277,350,452,357,299,333,297,396,175,377,381,384,382,280,347,330,269,303,270,151,9,337,344,278,360,424,418,431,270,304,409,272,310,407,322,270,410,449,450,347,432,422,434,18,313,17,291,306,375,259,387,260,424,335,418,434,364,416,391,423,327,301,251,298,275,281,4,254,373,253,375,307,321,280,425,411,200,421,18,335,321,406,321,320,405,314,315,17,423,426,266,396,377,369,270,322,269,413,417,464,385,386,258,248,456,419,298,284,333,168,417,8,448,346,261,417,413,285,326,327,328,277,355,329,309,392,438,381,382,256,279,429,360,365,364,379,355,277,437,282,443,283,281,275,363,395,431,369,299,297,337,335,273,321,348,450,349,359,446,467,283,293,282,250,458,462,300,276,383,292,308,325,283,276,293,264,372,447,346,352,340,354,274,19,363,456,281,426,436,425,380,381,252,267,269,393,421,200,428,371,266,329,432,287,422,290,250,328,385,258,384,446,265,342,386,387,257,422,424,430,445,342,276,422,273,424,306,292,307,352,366,345,268,271,302,358,423,371,327,294,460,331,279,294,303,271,304,436,432,427,304,272,408,395,394,431,378,395,400,296,334,299,6,351,168,376,352,411,307,325,320,285,295,336,320,319,404,329,330,349,334,293,333,366,323,447,316,15,315,331,358,279,317,14,316,8,285,9,277,329,350,253,374,252,319,318,403,351,6,419,324,318,325,397,367,365,288,435,397,278,344,439,310,272,311,248,195,281,375,273,291,175,396,199,312,311,268,276,283,445,390,373,339,295,282,296,448,449,346,356,264,454,337,336,299,337,338,151,294,278,455,308,292,415,429,358,355,265,340,372,388,390,466,352,346,280,295,442,282,354,19,370,285,441,295,195,248,197,457,440,274,301,300,368,417,351,465,251,301,389,385,380,386,394,395,379,399,412,419,410,436,322,387,373,388,326,2,393,354,370,461,393,164,267,268,302,12,386,374,387,312,268,13,298,293,301,265,446,340,380,385,381,280,330,425,322,426,391,420,429,437,393,391,326,344,440,438,458,459,461,364,434,394,428,396,262,274,354,457,317,316,402,316,315,403,315,314,404,314,313,405,313,421,406,323,366,361,292,306,407,306,291,408,291,287,409,287,432,410,427,434,411,372,264,383,459,309,457,366,352,401,1,274,4,418,421,262,331,294,358,435,433,367,392,289,439,328,462,326,94,2,370,289,305,455,339,254,448,359,255,446,254,253,449,253,252,450,252,256,451,256,341,452,414,413,463,286,441,414,286,258,441,258,257,442,257,259,443,259,260,444,260,467,445,309,459,250,305,289,290,305,290,460,401,376,435,309,250,392,376,411,433,453,341,464,357,453,465,343,357,412,437,343,399,344,360,440,420,437,456,360,420,363,361,401,288,265,372,353,390,339,249,339,448,255];var Mve=[127,234,132,58,172,150,149,148,152,377,378,379,397,288,361,454,356,70,63,105,66,107,336,296,334,293,300,168,6,195,4,98,97,2,326,327,33,160,158,133,153,144,362,385,387,263,373,380,57,40,37,0,267,270,287,321,314,17,84,91,78,81,13,311,308,402,14,178],Ove=[33,133,362,263,1,62,308,159,145,386,374,6,102,331,2,13,14,70,105,107,336,334,300,54,10,284,50,280,234,454,58,288,152],Pve=[33,133,362,263,1,78,308],g7e=Mve.map(e=>wh[e]),y7e=Ove.map(e=>wh[e]),A7e=Pve.map(e=>wh[e]);var wb=Bs.leftEyeLower0,kb=Bs.rightEyeLower0,Cu={leftBounds:[wb[0],wb[wb.length-1]],rightBounds:[kb[0],kb[kb.length-1]]},l0={count:468,mouth:13,symmetryLine:[13,Bs.midwayBetweenEyes[0]]},w$={leftEye:0,rightEye:1,nose:2,mouth:3,leftEar:4,rightEar:5,symmetryLine:[3,2]},Eu={upperCenter:3,lowerCenter:4,index:71,numCoordinates:76};function u0(e,t,n,r){for(let s=0;s[a[0]/this.meshSize*(d[0]-this.meshSize/2),a[1]/this.meshSize*(d[1]-this.meshSize/2),d[2]]),i=r!==0?i0(r,[0,0]):o0,l=r!==0?o.map(d=>[...y$(d,i),d[2]]):o,u=r!==0?g$(s):o0,c=[...Tu({startPoint:n.startPoint,endPoint:n.endPoint}),1];return l.map(d=>[Math.round(d[0]+no(c,u[0])),Math.round(d[1]+no(c,u[1])),Math.round(d[2])])}getLeftToRightEyeDepthDifference(t){let n=t[Cu.leftBounds[0]][2],r=t[Cu.rightBounds[0]][2];return n-r}getEyeBox(t,n,r,s,a=!1){let o=a0(s0(xb([t[r],t[s]]),this.irisEnlarge)),i=vh(o),l=Ye.cropAndResize(n,[[o.startPoint[1]/this.meshSize,o.startPoint[0]/this.meshSize,o.endPoint[1]/this.meshSize,o.endPoint[0]/this.meshSize]],[0],[this.irisSize,this.irisSize]);return a&&Sr.flags.IS_BROWSER&&(l=Ye.flipLeftRight(l)),{box:o,boxSize:i,crop:l}}getEyeCoords(t,n,r,s=!1){let a=[];for(let o=0;o{let u=o;return l===2?u=s:l===4&&(u=a),[i[0],i[1],u]})}async predict(t,n){let r=!1,s;if((this.skipped===0||this.skipped>n.face.detector.skipFrames||!n.face.mesh.enabled||!n.skipFrame)&&(s=await this.boundingBoxDetector.getBoundingBoxes(t),this.skipped=0),n.skipFrame&&this.skipped++,!n.skipFrame||s&&s.boxes&&(!n.face.mesh.enabled||s.boxes.length!==this.detectedFaces&&this.detectedFaces!==n.face.detector.maxDetected)){this.storedBoxes=[],this.detectedFaces=0;for(let o of s.boxes)this.storedBoxes.push({startPoint:o.box.startPoint.dataSync(),endPoint:o.box.endPoint.dataSync(),landmarks:o.landmarks.arraySync(),confidence:o.confidence});this.storedBoxes.length>0&&(r=!0)}if(r){if(!s||!s.boxes||s.boxes.length===0)return this.storedBoxes=[],this.detectedFaces=0,null;for(let o=0;o{o.box.startPoint.dispose(),o.box.endPoint.dispose(),o.landmarks.dispose()});let a=Ue(()=>this.storedBoxes.map((o,i)=>{let l,u=0,c;if(n.face.detector.rotation&&n.face.mesh.enabled&&Sr.flags.IS_BROWSER){let[x,b]=o.landmarks.length>=l0.count?l0.symmetryLine:w$.symmetryLine;u=bb(o.landmarks[x],o.landmarks[b]);let v=Tu({startPoint:o.startPoint,endPoint:o.endPoint}),w=[v[0]/t.shape[2],v[1]/t.shape[1]],I=Ye.rotateWithOffset(t,u,0,w);c=i0(-u,v),n.face.mesh.enabled?l=Nu({startPoint:o.startPoint,endPoint:o.endPoint},I,[this.meshSize,this.meshSize]).div(255):l=Nu({startPoint:o.startPoint,endPoint:o.endPoint},I,[this.boxSize,this.boxSize]).div(255)}else{c=o0;let x=t.clone();n.face.mesh.enabled?l=Nu({startPoint:o.startPoint,endPoint:o.endPoint},x,[this.meshSize,this.meshSize]).div(255):l=Nu({startPoint:o.startPoint,endPoint:o.endPoint},x,[this.boxSize,this.boxSize]).div(255)}if(!n.face.mesh.enabled)return{mesh:[],box:o,faceConfidence:null,boxConfidence:o.confidence,confidence:o.confidence,image:l};let[,d,h]=this.meshDetector.execute(l),p=d.dataSync()[0];if(p=l0.count?l0.symmetryLine:w$.symmetryLine;u=bb(o.landmarks[x],o.landmarks[b]);let v=Tu({startPoint:o.startPoint,endPoint:o.endPoint}),w=[v[0]/t.shape[2],v[1]/t.shape[1]],I=Ye.rotateWithOffset(t.toFloat(),u,0,w);c=i0(-u,v),l=Nu({startPoint:o.startPoint,endPoint:o.endPoint},I,[this.meshSize,this.meshSize]).div(255)}let A={mesh:g,box:o,faceConfidence:p,boxConfidence:o.confidence,image:l};return this.storedBoxes[i]={...a0(o),confidence:o.confidence,faceConfidence:p},A}));return n.face.mesh.enabled&&(this.storedBoxes=this.storedBoxes.filter(o=>o.confidence>n.face.detector.minConfidence)),this.detectedFaces=a.length,a}};var Zt=[null,null,null],Sb;async function k$(e,t){let n=await Sb.predict(e,t),r=[],s=0;for(let a of n||[]){if(!a||a.isDisposedInternal)continue;let o=a.mesh.map(c=>[c[0]/(e.shape[2]||0),c[1]/(e.shape[1]||0),c[2]/Sb.meshSize]),i={};if(a.mesh&&a.mesh.length>0)for(let c of Object.keys(Bs))i[c]=Bs[c].map(d=>a.mesh[d]);let l=a.box?[Math.trunc(Math.max(0,a.box.startPoint[0])),Math.trunc(Math.max(0,a.box.startPoint[1])),Math.trunc(Math.min(e.shape[2]||0,a.box.endPoint[0])-Math.max(0,a.box.startPoint[0])),Math.trunc(Math.min(e.shape[1]||0,a.box.endPoint[1])-Math.max(0,a.box.startPoint[1]))]:[0,0,0,0],u=a.box?[a.box.startPoint[0]/(e.shape[2]||0),a.box.startPoint[1]/(e.shape[1]||0),(a.box.endPoint[0]-a.box.startPoint[0])/(e.shape[2]||0),(a.box.endPoint[1]-a.box.startPoint[1])/(e.shape[1]||0)]:[0,0,0,0];r.push({id:s++,score:Math.round(100*a.faceConfidence||100*a.boxConfidence||0)/100,boxScore:Math.round(100*a.boxConfidence)/100,faceScore:Math.round(100*a.faceConfidence)/100,box:l,boxRaw:u,mesh:a.mesh,meshRaw:o,annotations:i,image:a.image,tensor:a.image}),a.coords&&a.coords.dispose()}return r}async function Tb(e){return!Zt[0]&&e.face.enabled||!Zt[1]&&e.face.mesh.enabled||!Zt[2]&&e.face.iris.enabled?(Zt=await Promise.all([!Zt[0]&&e.face.enabled?v$(e):null,!Zt[1]&&e.face.mesh.enabled?Et($t(e.modelBasePath,e.face.mesh.modelPath),{fromTFHub:e.face.mesh.modelPath.includes("tfhub.dev")}):null,!Zt[2]&&e.face.iris.enabled?Et($t(e.modelBasePath,e.face.iris.modelPath),{fromTFHub:e.face.iris.modelPath.includes("tfhub.dev")}):null]),e.face.mesh.enabled&&(!Zt[1]||!Zt[1].modelUrl?me("load model failed:",e.face.mesh.modelPath):e.debug&&me("load model:",Zt[1].modelUrl)),e.face.iris.enabled&&(!Zt[2]||!Zt[2].modelUrl?me("load model failed:",e.face.iris.modelPath):e.debug&&me("load model:",Zt[2].modelUrl))):e.debug&&(Zt[0]&&me("cached model:",Zt[0].model.modelUrl),Zt[1]&&me("cached model:",Zt[1].modelUrl),Zt[2]&&me("cached model:",Zt[2].modelUrl)),Sb=new Ib(Zt[0],Zt[1],Zt[2]),Zt}var I$=vi,S$=wh;var zve=["angry","disgust","fear","happy","sad","surprise","neutral"],xs,c0=[],T$=0,Nb=Number.MAX_SAFE_INTEGER,Cb=[.2989,.587,.114];async function Eb(e){return xs?e.debug&&me("cached model:",xs.modelUrl):(xs=await Et($t(e.modelBasePath,e.face.emotion.modelPath)),!xs||!xs.modelUrl?me("load model failed:",e.face.emotion.modelPath):e.debug&&me("load model:",xs.modelUrl)),xs}async function $b(e,t,n,r){return xs?Nb0?(Nb++,c0[n]):(Nb=0,new Promise(async s=>{let a=Ye.resizeBilinear(e,[xs.inputs[0].shape[2],xs.inputs[0].shape[1]],!1),[o,i,l]=ta(a,3,3);a.dispose();let u=fe(o,Cb[0]),c=fe(i,Cb[1]),d=fe(l,Cb[2]);o.dispose(),i.dispose(),l.dispose();let h=X2([u,c,d]);u.dispose(),c.dispose(),d.dispose();let p=Ue(()=>h.sub(.5).mul(2));h.dispose();let f=[];if(t.face.emotion.enabled){let m=await xs.predict(p),g=m.dataSync();Ve(m);for(let y=0;yt.face.emotion.minConfidence&&f.push({score:Math.min(.99,Math.trunc(100*g[y])/100),emotion:zve[y]});f.sort((y,A)=>A.score-y.score)}p.dispose(),c0[n]=f,T$=r,s(f)})):null}var bs,d0=[],N$=0,_b=Number.MAX_SAFE_INTEGER;async function Rb(e){let t=$t(e.modelBasePath,e.face.description.modelPath);return bs?e.debug&&me("cached model:",t):(bs=await Et(t),bs?e.debug&&me("load model:",t):me("load model failed:",e.face.description.modelPath)),bs}function Db(e,t,n=2){if(!e||!t||(e==null?void 0:e.length)===0||(t==null?void 0:t.length)===0||(e==null?void 0:e.length)!==(t==null?void 0:t.length))return 0;let r=5*e.map((a,o)=>Math.abs(e[o]-t[o])**n).reduce((a,o)=>a+o,0)**(1/n);return Math.max(0,100-r)/100}function C$(e,t,n=0){let r={similarity:0,name:"",source:"",embedding:[]};if(!e||!t||!Array.isArray(e)||!Array.isArray(t))return r;for(let s of t)if(s.embedding&&s.name){let a=Db(e,s.embedding);a>n&&a>r.similarity&&(r={...s,similarity:a})}return r}function Fb(e){return Ue(()=>{let n=e.image||e.tensor||e;if(!(n instanceof Tt))return null;let r=[[.05,.15,.85,.85]];return bs.inputs[0].shape?(n.shape.length===3?Ye.cropAndResize(ea(n,0),r,[0],[bs.inputs[0].shape[2],bs.inputs[0].shape[1]]):Ye.cropAndResize(n,r,[0],[bs.inputs[0].shape[2],bs.inputs[0].shape[1]])).mul(255):null})}async function Mb(e,t,n,r){var s,a;return bs?_b0?(_b++,d0[n]):(_b=0,new Promise(async o=>{let i=Fb(e),l,u={age:0,gender:"unknown",genderScore:0,descriptor:[]};t.face.description.enabled&&(l=await bs.predict(i)),Ve(i),l&&(Ue(()=>{let c=l.find(m=>m.shape[1]===1).dataSync(),d=Math.trunc(200*Math.abs(c[0]-.5))/100;d>t.face.description.minConfidence&&(u.gender=c[0]<=.5?"female":"male",u.genderScore=Math.min(.99,d));let h=l.find(m=>m.shape[1]===100).argMax(1).dataSync()[0],p=l.find(m=>m.shape[1]===100).dataSync();u.age=Math.round(p[h-1]>p[h+1]?10*h-100*p[h-1]:10*h+100*p[h+1])/10;let f=l.find(m=>m.shape[1]===1024);u.descriptor=[...f.dataSync()]}),l.forEach(c=>Ve(c))),d0[n]=u,N$=r,o(u)})):null}var Lve=e=>{let t=(d,h)=>Math.atan2(d[1]-h[1],d[0]-h[0]);if(!e.annotations.rightEyeIris||!e.annotations.leftEyeIris)return{bearing:0,strength:0};let n=[0,-.1],r=1,s=e.mesh[33][2]>e.mesh[263][2],a=s?e.mesh[473]:e.mesh[468],o=s?[(e.mesh[133][0]+e.mesh[33][0])/2,(e.mesh[133][1]+e.mesh[33][1])/2]:[(e.mesh[263][0]+e.mesh[362][0])/2,(e.mesh[263][1]+e.mesh[362][1])/2],i=s?[e.mesh[133][0]-e.mesh[33][0],e.mesh[23][1]-e.mesh[27][1]]:[e.mesh[263][0]-e.mesh[362][0],e.mesh[253][1]-e.mesh[257][1]],l=[(o[0]-a[0])/i[0]-n[0],r*(a[1]-o[1])/i[1]-n[1]],u=Math.sqrt(l[0]**2+l[1]**2);return u=Math.min(u,e.boxRaw[2]/2,e.boxRaw[3]/2),{bearing:(t([0,0],l)+Math.PI/2)%Math.PI,strength:u}},Bve=(e,t)=>{let n=g=>{let y=Math.sqrt(g[0]*g[0]+g[1]*g[1]+g[2]*g[2]);return g[0]/=y,g[1]/=y,g[2]/=y,g},r=(g,y)=>{let A=g[0]-y[0],x=g[1]-y[1],b=g[2]-y[2];return[A,x,b]},s=(g,y)=>{let A=g[1]*y[2]-g[2]*y[1],x=g[2]*y[0]-g[0]*y[2],b=g[0]*y[1]-g[1]*y[0];return[A,x,b]},a=g=>{let[y,A,x,b,v,w,I,T,C]=g,M,$,R;return b<1?b>-1?(R=Math.asin(b),$=Math.atan2(-I,y),M=Math.atan2(-w,v)):(R=-Math.PI/2,$=-Math.atan2(T,C),M=0):(R=Math.PI/2,$=Math.atan2(T,C),M=0),{pitch:2*-M,yaw:2*-$,roll:2*-R}},o=g=>{let y=(x,b,v,w)=>Math.atan2(w-b,v-x);return{pitch:y(g[10][1],g[10][2],g[152][1],g[152][2]),yaw:y(g[33][0],g[33][2],g[263][0],g[263][2]),roll:y(g[33][0],g[33][1],g[263][0],g[263][1])}},i=e.meshRaw;if(!i||i.length<300)return{angle:{pitch:0,yaw:0,roll:0},matrix:[1,0,0,0,1,0,0,0,1],gaze:{bearing:0,strength:0}};let l=Math.max(e.boxRaw[2]*t[0],e.boxRaw[3]*t[1])/1.5,u=[i[10],i[152],i[234],i[454]].map(g=>[g[0]*t[0]/l,g[1]*t[1]/l,g[2]]),c=n(r(u[1],u[0])),d=n(r(u[3],u[2])),h=n(s(d,c));d=s(c,h);let p=[d[0],d[1],d[2],c[0],c[1],c[2],h[0],h[1],h[2]],f=a(p),m=i.length===478?Lve(e):{bearing:0,strength:0};return{angle:f,matrix:p,gaze:m}},Ob=async(e,t)=>{var c,d,h,p,f,m;let n,r,s,a,o,i,l=[];e.state="run:face",n=at();let u=await k$(t,e.config);if(e.performance.face=Math.trunc(at()-n),!t.shape||t.shape.length!==4)return[];if(!u)return[];for(let g=0;g(e[t]=n,e),{}),Wve=[["leftHip","leftShoulder"],["leftElbow","leftShoulder"],["leftElbow","leftWrist"],["leftHip","leftKnee"],["leftKnee","leftAnkle"],["rightHip","rightShoulder"],["rightElbow","rightShoulder"],["rightElbow","rightWrist"],["rightHip","rightKnee"],["rightKnee","rightAnkle"],["leftShoulder","rightShoulder"],["leftHip","rightHip"]],Vve=Wve.map(([e,t])=>[Ih[e],Ih[t]]),$$=[["nose","leftEye"],["leftEye","leftEar"],["nose","rightEye"],["rightEye","rightEar"],["nose","leftShoulder"],["leftShoulder","leftElbow"],["leftElbow","leftWrist"],["leftShoulder","leftHip"],["leftHip","leftKnee"],["leftKnee","leftAnkle"],["nose","rightShoulder"],["rightShoulder","rightElbow"],["rightElbow","rightWrist"],["rightShoulder","rightHip"],["rightHip","rightKnee"],["rightKnee","rightAnkle"]];function _$(e){let t=e.reduce(({maxX:n,maxY:r,minX:s,minY:a},{position:{x:o,y:i}})=>({maxX:Math.max(n,o),maxY:Math.max(r,i),minX:Math.min(s,o),minY:Math.min(a,i)}),{maxX:Number.NEGATIVE_INFINITY,maxY:Number.NEGATIVE_INFINITY,minX:Number.POSITIVE_INFINITY,minY:Number.POSITIVE_INFINITY});return[t.minX,t.minY,t.maxX-t.minX,t.maxY-t.minY]}function R$(e,[t,n],[r,s]){let a=t/r,o=n/s,i=(u,c)=>({id:c,score:u.score,boxRaw:[u.box[0]/s,u.box[1]/r,u.box[2]/s,u.box[3]/r],box:[Math.trunc(u.box[0]*o),Math.trunc(u.box[1]*a),Math.trunc(u.box[2]*o),Math.trunc(u.box[3]*a)],keypoints:u.keypoints.map(({score:d,part:h,position:p})=>({score:d,part:h,position:[Math.trunc(p.x*o),Math.trunc(p.y*a)],positionRaw:[p.x/r,p.y/r]}))});return e.map((u,c)=>i(u,c))}var Pb=class{constructor(t,n){this.priorityQueue=new Array(t),this.numberOfElements=-1,this.getElementValue=n}enqueue(t){this.priorityQueue[++this.numberOfElements]=t,this.swim(this.numberOfElements)}dequeue(){let t=this.priorityQueue[0];return this.exchange(0,this.numberOfElements--),this.sink(0),this.priorityQueue[this.numberOfElements+1]=null,t}empty(){return this.numberOfElements===-1}size(){return this.numberOfElements+1}all(){return this.priorityQueue.slice(0,this.numberOfElements+1)}max(){return this.priorityQueue[0]}swim(t){for(;t>0&&this.less(Math.floor(t/2),t);)this.exchange(t,Math.floor(t/2)),t=Math.floor(t/2)}sink(t){for(;2*t<=this.numberOfElements;){let n=2*t;if(nn?n:e}function D$(e,t,n,r){let s=n-e,a=r-t;return s*s+a*a}function Wb(e,t){return{x:e.x+t.x,y:e.y+t.y}}var h0=1,$u=16,Uve=50**2;function F$(e,t,n,r,s,a,o=2){let i=y=>({y:a.get(y.y,y.x,e),x:a.get(y.y,y.x,a.shape[2]/2+e)}),l=(y,A,x)=>({y:Bb(Math.round(y.y/$u),0,A-1),x:Bb(Math.round(y.x/$u),0,x-1)}),[u,c]=r.shape,d=l(t.position,u,c),h=i(d),f=Wb(t.position,h);for(let y=0;y[Ih[h],Ih[p]]),o=a.map(([,h])=>h),i=a.map(([h])=>h),l=t.shape[2],u=o.length,c=new Array(l),d=Lb(e.part,$u,n);c[e.part.id]={score:e.score,part:kh[e.part.id],position:d};for(let h=u-1;h>=0;--h){let p=o[h],f=i[h];c[p]&&!c[f]&&(c[f]=F$(h,c[p],f,t,n,s))}for(let h=0;ht){i=!1;break}if(!i)break}return i}function jve(e,t){let[n,r,s]=t.shape,a=new Pb(n*r*s,({score:o})=>o);for(let o=0;o{var o;let a=(o=s[r])==null?void 0:o.position;return a?D$(n,t,a.y,a.x)<=Uve:!1})}function qve(e,t){return t.reduce((r,{position:s,score:a},o)=>(M$(e,s,o)||(r+=a),r),0)/t.length}function O$(e,t,n,r,s,a){let o=[],i=jve(a,t);for(;o.lengthp.score>a);let d=qve(o,c),h=_$(c);d>a&&o.push({keypoints:c,box:h,score:Math.round(100*d)/100})}return o}var yr,Kve=["MobilenetV1/offset_2/BiasAdd","MobilenetV1/heatmap_2/BiasAdd","MobilenetV1/displacement_fwd_2/BiasAdd","MobilenetV1/displacement_bwd_2/BiasAdd"];async function Vb(e,t){let n=Ue(()=>{if(!yr.inputs[0].shape)return[];let i=Ye.resizeBilinear(e,[yr.inputs[0].shape[2],yr.inputs[0].shape[1]]).toFloat().div(127.5).sub(1),u=yr.execute(i,Kve).map(c=>Zn(c,[0]));return u[1]=u[1].sigmoid(),u}),r=await Promise.all(n.map(o=>o.buffer()));for(let o of n)o.dispose();let s=await O$(r[0],r[1],r[2],r[3],t.body.maxDetected,t.body.minConfidence);return yr.inputs[0].shape?R$(s,[e.shape[1],e.shape[2]],[yr.inputs[0].shape[2],yr.inputs[0].shape[1]]):[]}async function Ub(e){return yr?e.debug&&me("cached model:",yr.modelUrl):(yr=await Et($t(e.modelBasePath,e.body.modelPath)),!yr||!yr.modelUrl?me("load model failed:",e.body.modelPath):e.debug&&me("load model:",yr.modelUrl)),yr}function p0(e){return[Math.abs(e.endPoint[0]-e.startPoint[0]),Math.abs(e.endPoint[1]-e.startPoint[1])]}function Sh(e){return[e.startPoint[0]+(e.endPoint[0]-e.startPoint[0])/2,e.startPoint[1]+(e.endPoint[1]-e.startPoint[1])/2]}function P$(e,t,n){let r=t.shape[1],s=t.shape[2],a=[[e.startPoint[1]/r,e.startPoint[0]/s,e.endPoint[1]/r,e.endPoint[0]/s]];return Ye.cropAndResize(t,a,[0],n)}function z$(e,t){let n=[e.startPoint[0]*t[0],e.startPoint[1]*t[1]],r=[e.endPoint[0]*t[0],e.endPoint[1]*t[1]],s=e.palmLandmarks.map(a=>[a[0]*t[0],a[1]*t[1]]);return{startPoint:n,endPoint:r,palmLandmarks:s,confidence:e.confidence}}function f0(e,t=1.5){let n=Sh(e),r=p0(e),s=[t*r[0]/2,t*r[1]/2],a=[n[0]-s[0],n[1]-s[1]],o=[n[0]+s[0],n[1]+s[1]];return{startPoint:a,endPoint:o,palmLandmarks:e.palmLandmarks}}function m0(e){let t=Sh(e),n=p0(e),s=Math.max(...n)/2,a=[t[0]-s,t[1]-s],o=[t[0]+s,t[1]+s];return{startPoint:a,endPoint:o,palmLandmarks:e.palmLandmarks}}var L$=[{x:.015625,y:.015625},{x:.015625,y:.015625},{x:.046875,y:.015625},{x:.046875,y:.015625},{x:.078125,y:.015625},{x:.078125,y:.015625},{x:.109375,y:.015625},{x:.109375,y:.015625},{x:.140625,y:.015625},{x:.140625,y:.015625},{x:.171875,y:.015625},{x:.171875,y:.015625},{x:.203125,y:.015625},{x:.203125,y:.015625},{x:.234375,y:.015625},{x:.234375,y:.015625},{x:.265625,y:.015625},{x:.265625,y:.015625},{x:.296875,y:.015625},{x:.296875,y:.015625},{x:.328125,y:.015625},{x:.328125,y:.015625},{x:.359375,y:.015625},{x:.359375,y:.015625},{x:.390625,y:.015625},{x:.390625,y:.015625},{x:.421875,y:.015625},{x:.421875,y:.015625},{x:.453125,y:.015625},{x:.453125,y:.015625},{x:.484375,y:.015625},{x:.484375,y:.015625},{x:.515625,y:.015625},{x:.515625,y:.015625},{x:.546875,y:.015625},{x:.546875,y:.015625},{x:.578125,y:.015625},{x:.578125,y:.015625},{x:.609375,y:.015625},{x:.609375,y:.015625},{x:.640625,y:.015625},{x:.640625,y:.015625},{x:.671875,y:.015625},{x:.671875,y:.015625},{x:.703125,y:.015625},{x:.703125,y:.015625},{x:.734375,y:.015625},{x:.734375,y:.015625},{x:.765625,y:.015625},{x:.765625,y:.015625},{x:.796875,y:.015625},{x:.796875,y:.015625},{x:.828125,y:.015625},{x:.828125,y:.015625},{x:.859375,y:.015625},{x:.859375,y:.015625},{x:.890625,y:.015625},{x:.890625,y:.015625},{x:.921875,y:.015625},{x:.921875,y:.015625},{x:.953125,y:.015625},{x:.953125,y:.015625},{x:.984375,y:.015625},{x:.984375,y:.015625},{x:.015625,y:.046875},{x:.015625,y:.046875},{x:.046875,y:.046875},{x:.046875,y:.046875},{x:.078125,y:.046875},{x:.078125,y:.046875},{x:.109375,y:.046875},{x:.109375,y:.046875},{x:.140625,y:.046875},{x:.140625,y:.046875},{x:.171875,y:.046875},{x:.171875,y:.046875},{x:.203125,y:.046875},{x:.203125,y:.046875},{x:.234375,y:.046875},{x:.234375,y:.046875},{x:.265625,y:.046875},{x:.265625,y:.046875},{x:.296875,y:.046875},{x:.296875,y:.046875},{x:.328125,y:.046875},{x:.328125,y:.046875},{x:.359375,y:.046875},{x:.359375,y:.046875},{x:.390625,y:.046875},{x:.390625,y:.046875},{x:.421875,y:.046875},{x:.421875,y:.046875},{x:.453125,y:.046875},{x:.453125,y:.046875},{x:.484375,y:.046875},{x:.484375,y:.046875},{x:.515625,y:.046875},{x:.515625,y:.046875},{x:.546875,y:.046875},{x:.546875,y:.046875},{x:.578125,y:.046875},{x:.578125,y:.046875},{x:.609375,y:.046875},{x:.609375,y:.046875},{x:.640625,y:.046875},{x:.640625,y:.046875},{x:.671875,y:.046875},{x:.671875,y:.046875},{x:.703125,y:.046875},{x:.703125,y:.046875},{x:.734375,y:.046875},{x:.734375,y:.046875},{x:.765625,y:.046875},{x:.765625,y:.046875},{x:.796875,y:.046875},{x:.796875,y:.046875},{x:.828125,y:.046875},{x:.828125,y:.046875},{x:.859375,y:.046875},{x:.859375,y:.046875},{x:.890625,y:.046875},{x:.890625,y:.046875},{x:.921875,y:.046875},{x:.921875,y:.046875},{x:.953125,y:.046875},{x:.953125,y:.046875},{x:.984375,y:.046875},{x:.984375,y:.046875},{x:.015625,y:.078125},{x:.015625,y:.078125},{x:.046875,y:.078125},{x:.046875,y:.078125},{x:.078125,y:.078125},{x:.078125,y:.078125},{x:.109375,y:.078125},{x:.109375,y:.078125},{x:.140625,y:.078125},{x:.140625,y:.078125},{x:.171875,y:.078125},{x:.171875,y:.078125},{x:.203125,y:.078125},{x:.203125,y:.078125},{x:.234375,y:.078125},{x:.234375,y:.078125},{x:.265625,y:.078125},{x:.265625,y:.078125},{x:.296875,y:.078125},{x:.296875,y:.078125},{x:.328125,y:.078125},{x:.328125,y:.078125},{x:.359375,y:.078125},{x:.359375,y:.078125},{x:.390625,y:.078125},{x:.390625,y:.078125},{x:.421875,y:.078125},{x:.421875,y:.078125},{x:.453125,y:.078125},{x:.453125,y:.078125},{x:.484375,y:.078125},{x:.484375,y:.078125},{x:.515625,y:.078125},{x:.515625,y:.078125},{x:.546875,y:.078125},{x:.546875,y:.078125},{x:.578125,y:.078125},{x:.578125,y:.078125},{x:.609375,y:.078125},{x:.609375,y:.078125},{x:.640625,y:.078125},{x:.640625,y:.078125},{x:.671875,y:.078125},{x:.671875,y:.078125},{x:.703125,y:.078125},{x:.703125,y:.078125},{x:.734375,y:.078125},{x:.734375,y:.078125},{x:.765625,y:.078125},{x:.765625,y:.078125},{x:.796875,y:.078125},{x:.796875,y:.078125},{x:.828125,y:.078125},{x:.828125,y:.078125},{x:.859375,y:.078125},{x:.859375,y:.078125},{x:.890625,y:.078125},{x:.890625,y:.078125},{x:.921875,y:.078125},{x:.921875,y:.078125},{x:.953125,y:.078125},{x:.953125,y:.078125},{x:.984375,y:.078125},{x:.984375,y:.078125},{x:.015625,y:.109375},{x:.015625,y:.109375},{x:.046875,y:.109375},{x:.046875,y:.109375},{x:.078125,y:.109375},{x:.078125,y:.109375},{x:.109375,y:.109375},{x:.109375,y:.109375},{x:.140625,y:.109375},{x:.140625,y:.109375},{x:.171875,y:.109375},{x:.171875,y:.109375},{x:.203125,y:.109375},{x:.203125,y:.109375},{x:.234375,y:.109375},{x:.234375,y:.109375},{x:.265625,y:.109375},{x:.265625,y:.109375},{x:.296875,y:.109375},{x:.296875,y:.109375},{x:.328125,y:.109375},{x:.328125,y:.109375},{x:.359375,y:.109375},{x:.359375,y:.109375},{x:.390625,y:.109375},{x:.390625,y:.109375},{x:.421875,y:.109375},{x:.421875,y:.109375},{x:.453125,y:.109375},{x:.453125,y:.109375},{x:.484375,y:.109375},{x:.484375,y:.109375},{x:.515625,y:.109375},{x:.515625,y:.109375},{x:.546875,y:.109375},{x:.546875,y:.109375},{x:.578125,y:.109375},{x:.578125,y:.109375},{x:.609375,y:.109375},{x:.609375,y:.109375},{x:.640625,y:.109375},{x:.640625,y:.109375},{x:.671875,y:.109375},{x:.671875,y:.109375},{x:.703125,y:.109375},{x:.703125,y:.109375},{x:.734375,y:.109375},{x:.734375,y:.109375},{x:.765625,y:.109375},{x:.765625,y:.109375},{x:.796875,y:.109375},{x:.796875,y:.109375},{x:.828125,y:.109375},{x:.828125,y:.109375},{x:.859375,y:.109375},{x:.859375,y:.109375},{x:.890625,y:.109375},{x:.890625,y:.109375},{x:.921875,y:.109375},{x:.921875,y:.109375},{x:.953125,y:.109375},{x:.953125,y:.109375},{x:.984375,y:.109375},{x:.984375,y:.109375},{x:.015625,y:.140625},{x:.015625,y:.140625},{x:.046875,y:.140625},{x:.046875,y:.140625},{x:.078125,y:.140625},{x:.078125,y:.140625},{x:.109375,y:.140625},{x:.109375,y:.140625},{x:.140625,y:.140625},{x:.140625,y:.140625},{x:.171875,y:.140625},{x:.171875,y:.140625},{x:.203125,y:.140625},{x:.203125,y:.140625},{x:.234375,y:.140625},{x:.234375,y:.140625},{x:.265625,y:.140625},{x:.265625,y:.140625},{x:.296875,y:.140625},{x:.296875,y:.140625},{x:.328125,y:.140625},{x:.328125,y:.140625},{x:.359375,y:.140625},{x:.359375,y:.140625},{x:.390625,y:.140625},{x:.390625,y:.140625},{x:.421875,y:.140625},{x:.421875,y:.140625},{x:.453125,y:.140625},{x:.453125,y:.140625},{x:.484375,y:.140625},{x:.484375,y:.140625},{x:.515625,y:.140625},{x:.515625,y:.140625},{x:.546875,y:.140625},{x:.546875,y:.140625},{x:.578125,y:.140625},{x:.578125,y:.140625},{x:.609375,y:.140625},{x:.609375,y:.140625},{x:.640625,y:.140625},{x:.640625,y:.140625},{x:.671875,y:.140625},{x:.671875,y:.140625},{x:.703125,y:.140625},{x:.703125,y:.140625},{x:.734375,y:.140625},{x:.734375,y:.140625},{x:.765625,y:.140625},{x:.765625,y:.140625},{x:.796875,y:.140625},{x:.796875,y:.140625},{x:.828125,y:.140625},{x:.828125,y:.140625},{x:.859375,y:.140625},{x:.859375,y:.140625},{x:.890625,y:.140625},{x:.890625,y:.140625},{x:.921875,y:.140625},{x:.921875,y:.140625},{x:.953125,y:.140625},{x:.953125,y:.140625},{x:.984375,y:.140625},{x:.984375,y:.140625},{x:.015625,y:.171875},{x:.015625,y:.171875},{x:.046875,y:.171875},{x:.046875,y:.171875},{x:.078125,y:.171875},{x:.078125,y:.171875},{x:.109375,y:.171875},{x:.109375,y:.171875},{x:.140625,y:.171875},{x:.140625,y:.171875},{x:.171875,y:.171875},{x:.171875,y:.171875},{x:.203125,y:.171875},{x:.203125,y:.171875},{x:.234375,y:.171875},{x:.234375,y:.171875},{x:.265625,y:.171875},{x:.265625,y:.171875},{x:.296875,y:.171875},{x:.296875,y:.171875},{x:.328125,y:.171875},{x:.328125,y:.171875},{x:.359375,y:.171875},{x:.359375,y:.171875},{x:.390625,y:.171875},{x:.390625,y:.171875},{x:.421875,y:.171875},{x:.421875,y:.171875},{x:.453125,y:.171875},{x:.453125,y:.171875},{x:.484375,y:.171875},{x:.484375,y:.171875},{x:.515625,y:.171875},{x:.515625,y:.171875},{x:.546875,y:.171875},{x:.546875,y:.171875},{x:.578125,y:.171875},{x:.578125,y:.171875},{x:.609375,y:.171875},{x:.609375,y:.171875},{x:.640625,y:.171875},{x:.640625,y:.171875},{x:.671875,y:.171875},{x:.671875,y:.171875},{x:.703125,y:.171875},{x:.703125,y:.171875},{x:.734375,y:.171875},{x:.734375,y:.171875},{x:.765625,y:.171875},{x:.765625,y:.171875},{x:.796875,y:.171875},{x:.796875,y:.171875},{x:.828125,y:.171875},{x:.828125,y:.171875},{x:.859375,y:.171875},{x:.859375,y:.171875},{x:.890625,y:.171875},{x:.890625,y:.171875},{x:.921875,y:.171875},{x:.921875,y:.171875},{x:.953125,y:.171875},{x:.953125,y:.171875},{x:.984375,y:.171875},{x:.984375,y:.171875},{x:.015625,y:.203125},{x:.015625,y:.203125},{x:.046875,y:.203125},{x:.046875,y:.203125},{x:.078125,y:.203125},{x:.078125,y:.203125},{x:.109375,y:.203125},{x:.109375,y:.203125},{x:.140625,y:.203125},{x:.140625,y:.203125},{x:.171875,y:.203125},{x:.171875,y:.203125},{x:.203125,y:.203125},{x:.203125,y:.203125},{x:.234375,y:.203125},{x:.234375,y:.203125},{x:.265625,y:.203125},{x:.265625,y:.203125},{x:.296875,y:.203125},{x:.296875,y:.203125},{x:.328125,y:.203125},{x:.328125,y:.203125},{x:.359375,y:.203125},{x:.359375,y:.203125},{x:.390625,y:.203125},{x:.390625,y:.203125},{x:.421875,y:.203125},{x:.421875,y:.203125},{x:.453125,y:.203125},{x:.453125,y:.203125},{x:.484375,y:.203125},{x:.484375,y:.203125},{x:.515625,y:.203125},{x:.515625,y:.203125},{x:.546875,y:.203125},{x:.546875,y:.203125},{x:.578125,y:.203125},{x:.578125,y:.203125},{x:.609375,y:.203125},{x:.609375,y:.203125},{x:.640625,y:.203125},{x:.640625,y:.203125},{x:.671875,y:.203125},{x:.671875,y:.203125},{x:.703125,y:.203125},{x:.703125,y:.203125},{x:.734375,y:.203125},{x:.734375,y:.203125},{x:.765625,y:.203125},{x:.765625,y:.203125},{x:.796875,y:.203125},{x:.796875,y:.203125},{x:.828125,y:.203125},{x:.828125,y:.203125},{x:.859375,y:.203125},{x:.859375,y:.203125},{x:.890625,y:.203125},{x:.890625,y:.203125},{x:.921875,y:.203125},{x:.921875,y:.203125},{x:.953125,y:.203125},{x:.953125,y:.203125},{x:.984375,y:.203125},{x:.984375,y:.203125},{x:.015625,y:.234375},{x:.015625,y:.234375},{x:.046875,y:.234375},{x:.046875,y:.234375},{x:.078125,y:.234375},{x:.078125,y:.234375},{x:.109375,y:.234375},{x:.109375,y:.234375},{x:.140625,y:.234375},{x:.140625,y:.234375},{x:.171875,y:.234375},{x:.171875,y:.234375},{x:.203125,y:.234375},{x:.203125,y:.234375},{x:.234375,y:.234375},{x:.234375,y:.234375},{x:.265625,y:.234375},{x:.265625,y:.234375},{x:.296875,y:.234375},{x:.296875,y:.234375},{x:.328125,y:.234375},{x:.328125,y:.234375},{x:.359375,y:.234375},{x:.359375,y:.234375},{x:.390625,y:.234375},{x:.390625,y:.234375},{x:.421875,y:.234375},{x:.421875,y:.234375},{x:.453125,y:.234375},{x:.453125,y:.234375},{x:.484375,y:.234375},{x:.484375,y:.234375},{x:.515625,y:.234375},{x:.515625,y:.234375},{x:.546875,y:.234375},{x:.546875,y:.234375},{x:.578125,y:.234375},{x:.578125,y:.234375},{x:.609375,y:.234375},{x:.609375,y:.234375},{x:.640625,y:.234375},{x:.640625,y:.234375},{x:.671875,y:.234375},{x:.671875,y:.234375},{x:.703125,y:.234375},{x:.703125,y:.234375},{x:.734375,y:.234375},{x:.734375,y:.234375},{x:.765625,y:.234375},{x:.765625,y:.234375},{x:.796875,y:.234375},{x:.796875,y:.234375},{x:.828125,y:.234375},{x:.828125,y:.234375},{x:.859375,y:.234375},{x:.859375,y:.234375},{x:.890625,y:.234375},{x:.890625,y:.234375},{x:.921875,y:.234375},{x:.921875,y:.234375},{x:.953125,y:.234375},{x:.953125,y:.234375},{x:.984375,y:.234375},{x:.984375,y:.234375},{x:.015625,y:.265625},{x:.015625,y:.265625},{x:.046875,y:.265625},{x:.046875,y:.265625},{x:.078125,y:.265625},{x:.078125,y:.265625},{x:.109375,y:.265625},{x:.109375,y:.265625},{x:.140625,y:.265625},{x:.140625,y:.265625},{x:.171875,y:.265625},{x:.171875,y:.265625},{x:.203125,y:.265625},{x:.203125,y:.265625},{x:.234375,y:.265625},{x:.234375,y:.265625},{x:.265625,y:.265625},{x:.265625,y:.265625},{x:.296875,y:.265625},{x:.296875,y:.265625},{x:.328125,y:.265625},{x:.328125,y:.265625},{x:.359375,y:.265625},{x:.359375,y:.265625},{x:.390625,y:.265625},{x:.390625,y:.265625},{x:.421875,y:.265625},{x:.421875,y:.265625},{x:.453125,y:.265625},{x:.453125,y:.265625},{x:.484375,y:.265625},{x:.484375,y:.265625},{x:.515625,y:.265625},{x:.515625,y:.265625},{x:.546875,y:.265625},{x:.546875,y:.265625},{x:.578125,y:.265625},{x:.578125,y:.265625},{x:.609375,y:.265625},{x:.609375,y:.265625},{x:.640625,y:.265625},{x:.640625,y:.265625},{x:.671875,y:.265625},{x:.671875,y:.265625},{x:.703125,y:.265625},{x:.703125,y:.265625},{x:.734375,y:.265625},{x:.734375,y:.265625},{x:.765625,y:.265625},{x:.765625,y:.265625},{x:.796875,y:.265625},{x:.796875,y:.265625},{x:.828125,y:.265625},{x:.828125,y:.265625},{x:.859375,y:.265625},{x:.859375,y:.265625},{x:.890625,y:.265625},{x:.890625,y:.265625},{x:.921875,y:.265625},{x:.921875,y:.265625},{x:.953125,y:.265625},{x:.953125,y:.265625},{x:.984375,y:.265625},{x:.984375,y:.265625},{x:.015625,y:.296875},{x:.015625,y:.296875},{x:.046875,y:.296875},{x:.046875,y:.296875},{x:.078125,y:.296875},{x:.078125,y:.296875},{x:.109375,y:.296875},{x:.109375,y:.296875},{x:.140625,y:.296875},{x:.140625,y:.296875},{x:.171875,y:.296875},{x:.171875,y:.296875},{x:.203125,y:.296875},{x:.203125,y:.296875},{x:.234375,y:.296875},{x:.234375,y:.296875},{x:.265625,y:.296875},{x:.265625,y:.296875},{x:.296875,y:.296875},{x:.296875,y:.296875},{x:.328125,y:.296875},{x:.328125,y:.296875},{x:.359375,y:.296875},{x:.359375,y:.296875},{x:.390625,y:.296875},{x:.390625,y:.296875},{x:.421875,y:.296875},{x:.421875,y:.296875},{x:.453125,y:.296875},{x:.453125,y:.296875},{x:.484375,y:.296875},{x:.484375,y:.296875},{x:.515625,y:.296875},{x:.515625,y:.296875},{x:.546875,y:.296875},{x:.546875,y:.296875},{x:.578125,y:.296875},{x:.578125,y:.296875},{x:.609375,y:.296875},{x:.609375,y:.296875},{x:.640625,y:.296875},{x:.640625,y:.296875},{x:.671875,y:.296875},{x:.671875,y:.296875},{x:.703125,y:.296875},{x:.703125,y:.296875},{x:.734375,y:.296875},{x:.734375,y:.296875},{x:.765625,y:.296875},{x:.765625,y:.296875},{x:.796875,y:.296875},{x:.796875,y:.296875},{x:.828125,y:.296875},{x:.828125,y:.296875},{x:.859375,y:.296875},{x:.859375,y:.296875},{x:.890625,y:.296875},{x:.890625,y:.296875},{x:.921875,y:.296875},{x:.921875,y:.296875},{x:.953125,y:.296875},{x:.953125,y:.296875},{x:.984375,y:.296875},{x:.984375,y:.296875},{x:.015625,y:.328125},{x:.015625,y:.328125},{x:.046875,y:.328125},{x:.046875,y:.328125},{x:.078125,y:.328125},{x:.078125,y:.328125},{x:.109375,y:.328125},{x:.109375,y:.328125},{x:.140625,y:.328125},{x:.140625,y:.328125},{x:.171875,y:.328125},{x:.171875,y:.328125},{x:.203125,y:.328125},{x:.203125,y:.328125},{x:.234375,y:.328125},{x:.234375,y:.328125},{x:.265625,y:.328125},{x:.265625,y:.328125},{x:.296875,y:.328125},{x:.296875,y:.328125},{x:.328125,y:.328125},{x:.328125,y:.328125},{x:.359375,y:.328125},{x:.359375,y:.328125},{x:.390625,y:.328125},{x:.390625,y:.328125},{x:.421875,y:.328125},{x:.421875,y:.328125},{x:.453125,y:.328125},{x:.453125,y:.328125},{x:.484375,y:.328125},{x:.484375,y:.328125},{x:.515625,y:.328125},{x:.515625,y:.328125},{x:.546875,y:.328125},{x:.546875,y:.328125},{x:.578125,y:.328125},{x:.578125,y:.328125},{x:.609375,y:.328125},{x:.609375,y:.328125},{x:.640625,y:.328125},{x:.640625,y:.328125},{x:.671875,y:.328125},{x:.671875,y:.328125},{x:.703125,y:.328125},{x:.703125,y:.328125},{x:.734375,y:.328125},{x:.734375,y:.328125},{x:.765625,y:.328125},{x:.765625,y:.328125},{x:.796875,y:.328125},{x:.796875,y:.328125},{x:.828125,y:.328125},{x:.828125,y:.328125},{x:.859375,y:.328125},{x:.859375,y:.328125},{x:.890625,y:.328125},{x:.890625,y:.328125},{x:.921875,y:.328125},{x:.921875,y:.328125},{x:.953125,y:.328125},{x:.953125,y:.328125},{x:.984375,y:.328125},{x:.984375,y:.328125},{x:.015625,y:.359375},{x:.015625,y:.359375},{x:.046875,y:.359375},{x:.046875,y:.359375},{x:.078125,y:.359375},{x:.078125,y:.359375},{x:.109375,y:.359375},{x:.109375,y:.359375},{x:.140625,y:.359375},{x:.140625,y:.359375},{x:.171875,y:.359375},{x:.171875,y:.359375},{x:.203125,y:.359375},{x:.203125,y:.359375},{x:.234375,y:.359375},{x:.234375,y:.359375},{x:.265625,y:.359375},{x:.265625,y:.359375},{x:.296875,y:.359375},{x:.296875,y:.359375},{x:.328125,y:.359375},{x:.328125,y:.359375},{x:.359375,y:.359375},{x:.359375,y:.359375},{x:.390625,y:.359375},{x:.390625,y:.359375},{x:.421875,y:.359375},{x:.421875,y:.359375},{x:.453125,y:.359375},{x:.453125,y:.359375},{x:.484375,y:.359375},{x:.484375,y:.359375},{x:.515625,y:.359375},{x:.515625,y:.359375},{x:.546875,y:.359375},{x:.546875,y:.359375},{x:.578125,y:.359375},{x:.578125,y:.359375},{x:.609375,y:.359375},{x:.609375,y:.359375},{x:.640625,y:.359375},{x:.640625,y:.359375},{x:.671875,y:.359375},{x:.671875,y:.359375},{x:.703125,y:.359375},{x:.703125,y:.359375},{x:.734375,y:.359375},{x:.734375,y:.359375},{x:.765625,y:.359375},{x:.765625,y:.359375},{x:.796875,y:.359375},{x:.796875,y:.359375},{x:.828125,y:.359375},{x:.828125,y:.359375},{x:.859375,y:.359375},{x:.859375,y:.359375},{x:.890625,y:.359375},{x:.890625,y:.359375},{x:.921875,y:.359375},{x:.921875,y:.359375},{x:.953125,y:.359375},{x:.953125,y:.359375},{x:.984375,y:.359375},{x:.984375,y:.359375},{x:.015625,y:.390625},{x:.015625,y:.390625},{x:.046875,y:.390625},{x:.046875,y:.390625},{x:.078125,y:.390625},{x:.078125,y:.390625},{x:.109375,y:.390625},{x:.109375,y:.390625},{x:.140625,y:.390625},{x:.140625,y:.390625},{x:.171875,y:.390625},{x:.171875,y:.390625},{x:.203125,y:.390625},{x:.203125,y:.390625},{x:.234375,y:.390625},{x:.234375,y:.390625},{x:.265625,y:.390625},{x:.265625,y:.390625},{x:.296875,y:.390625},{x:.296875,y:.390625},{x:.328125,y:.390625},{x:.328125,y:.390625},{x:.359375,y:.390625},{x:.359375,y:.390625},{x:.390625,y:.390625},{x:.390625,y:.390625},{x:.421875,y:.390625},{x:.421875,y:.390625},{x:.453125,y:.390625},{x:.453125,y:.390625},{x:.484375,y:.390625},{x:.484375,y:.390625},{x:.515625,y:.390625},{x:.515625,y:.390625},{x:.546875,y:.390625},{x:.546875,y:.390625},{x:.578125,y:.390625},{x:.578125,y:.390625},{x:.609375,y:.390625},{x:.609375,y:.390625},{x:.640625,y:.390625},{x:.640625,y:.390625},{x:.671875,y:.390625},{x:.671875,y:.390625},{x:.703125,y:.390625},{x:.703125,y:.390625},{x:.734375,y:.390625},{x:.734375,y:.390625},{x:.765625,y:.390625},{x:.765625,y:.390625},{x:.796875,y:.390625},{x:.796875,y:.390625},{x:.828125,y:.390625},{x:.828125,y:.390625},{x:.859375,y:.390625},{x:.859375,y:.390625},{x:.890625,y:.390625},{x:.890625,y:.390625},{x:.921875,y:.390625},{x:.921875,y:.390625},{x:.953125,y:.390625},{x:.953125,y:.390625},{x:.984375,y:.390625},{x:.984375,y:.390625},{x:.015625,y:.421875},{x:.015625,y:.421875},{x:.046875,y:.421875},{x:.046875,y:.421875},{x:.078125,y:.421875},{x:.078125,y:.421875},{x:.109375,y:.421875},{x:.109375,y:.421875},{x:.140625,y:.421875},{x:.140625,y:.421875},{x:.171875,y:.421875},{x:.171875,y:.421875},{x:.203125,y:.421875},{x:.203125,y:.421875},{x:.234375,y:.421875},{x:.234375,y:.421875},{x:.265625,y:.421875},{x:.265625,y:.421875},{x:.296875,y:.421875},{x:.296875,y:.421875},{x:.328125,y:.421875},{x:.328125,y:.421875},{x:.359375,y:.421875},{x:.359375,y:.421875},{x:.390625,y:.421875},{x:.390625,y:.421875},{x:.421875,y:.421875},{x:.421875,y:.421875},{x:.453125,y:.421875},{x:.453125,y:.421875},{x:.484375,y:.421875},{x:.484375,y:.421875},{x:.515625,y:.421875},{x:.515625,y:.421875},{x:.546875,y:.421875},{x:.546875,y:.421875},{x:.578125,y:.421875},{x:.578125,y:.421875},{x:.609375,y:.421875},{x:.609375,y:.421875},{x:.640625,y:.421875},{x:.640625,y:.421875},{x:.671875,y:.421875},{x:.671875,y:.421875},{x:.703125,y:.421875},{x:.703125,y:.421875},{x:.734375,y:.421875},{x:.734375,y:.421875},{x:.765625,y:.421875},{x:.765625,y:.421875},{x:.796875,y:.421875},{x:.796875,y:.421875},{x:.828125,y:.421875},{x:.828125,y:.421875},{x:.859375,y:.421875},{x:.859375,y:.421875},{x:.890625,y:.421875},{x:.890625,y:.421875},{x:.921875,y:.421875},{x:.921875,y:.421875},{x:.953125,y:.421875},{x:.953125,y:.421875},{x:.984375,y:.421875},{x:.984375,y:.421875},{x:.015625,y:.453125},{x:.015625,y:.453125},{x:.046875,y:.453125},{x:.046875,y:.453125},{x:.078125,y:.453125},{x:.078125,y:.453125},{x:.109375,y:.453125},{x:.109375,y:.453125},{x:.140625,y:.453125},{x:.140625,y:.453125},{x:.171875,y:.453125},{x:.171875,y:.453125},{x:.203125,y:.453125},{x:.203125,y:.453125},{x:.234375,y:.453125},{x:.234375,y:.453125},{x:.265625,y:.453125},{x:.265625,y:.453125},{x:.296875,y:.453125},{x:.296875,y:.453125},{x:.328125,y:.453125},{x:.328125,y:.453125},{x:.359375,y:.453125},{x:.359375,y:.453125},{x:.390625,y:.453125},{x:.390625,y:.453125},{x:.421875,y:.453125},{x:.421875,y:.453125},{x:.453125,y:.453125},{x:.453125,y:.453125},{x:.484375,y:.453125},{x:.484375,y:.453125},{x:.515625,y:.453125},{x:.515625,y:.453125},{x:.546875,y:.453125},{x:.546875,y:.453125},{x:.578125,y:.453125},{x:.578125,y:.453125},{x:.609375,y:.453125},{x:.609375,y:.453125},{x:.640625,y:.453125},{x:.640625,y:.453125},{x:.671875,y:.453125},{x:.671875,y:.453125},{x:.703125,y:.453125},{x:.703125,y:.453125},{x:.734375,y:.453125},{x:.734375,y:.453125},{x:.765625,y:.453125},{x:.765625,y:.453125},{x:.796875,y:.453125},{x:.796875,y:.453125},{x:.828125,y:.453125},{x:.828125,y:.453125},{x:.859375,y:.453125},{x:.859375,y:.453125},{x:.890625,y:.453125},{x:.890625,y:.453125},{x:.921875,y:.453125},{x:.921875,y:.453125},{x:.953125,y:.453125},{x:.953125,y:.453125},{x:.984375,y:.453125},{x:.984375,y:.453125},{x:.015625,y:.484375},{x:.015625,y:.484375},{x:.046875,y:.484375},{x:.046875,y:.484375},{x:.078125,y:.484375},{x:.078125,y:.484375},{x:.109375,y:.484375},{x:.109375,y:.484375},{x:.140625,y:.484375},{x:.140625,y:.484375},{x:.171875,y:.484375},{x:.171875,y:.484375},{x:.203125,y:.484375},{x:.203125,y:.484375},{x:.234375,y:.484375},{x:.234375,y:.484375},{x:.265625,y:.484375},{x:.265625,y:.484375},{x:.296875,y:.484375},{x:.296875,y:.484375},{x:.328125,y:.484375},{x:.328125,y:.484375},{x:.359375,y:.484375},{x:.359375,y:.484375},{x:.390625,y:.484375},{x:.390625,y:.484375},{x:.421875,y:.484375},{x:.421875,y:.484375},{x:.453125,y:.484375},{x:.453125,y:.484375},{x:.484375,y:.484375},{x:.484375,y:.484375},{x:.515625,y:.484375},{x:.515625,y:.484375},{x:.546875,y:.484375},{x:.546875,y:.484375},{x:.578125,y:.484375},{x:.578125,y:.484375},{x:.609375,y:.484375},{x:.609375,y:.484375},{x:.640625,y:.484375},{x:.640625,y:.484375},{x:.671875,y:.484375},{x:.671875,y:.484375},{x:.703125,y:.484375},{x:.703125,y:.484375},{x:.734375,y:.484375},{x:.734375,y:.484375},{x:.765625,y:.484375},{x:.765625,y:.484375},{x:.796875,y:.484375},{x:.796875,y:.484375},{x:.828125,y:.484375},{x:.828125,y:.484375},{x:.859375,y:.484375},{x:.859375,y:.484375},{x:.890625,y:.484375},{x:.890625,y:.484375},{x:.921875,y:.484375},{x:.921875,y:.484375},{x:.953125,y:.484375},{x:.953125,y:.484375},{x:.984375,y:.484375},{x:.984375,y:.484375},{x:.015625,y:.515625},{x:.015625,y:.515625},{x:.046875,y:.515625},{x:.046875,y:.515625},{x:.078125,y:.515625},{x:.078125,y:.515625},{x:.109375,y:.515625},{x:.109375,y:.515625},{x:.140625,y:.515625},{x:.140625,y:.515625},{x:.171875,y:.515625},{x:.171875,y:.515625},{x:.203125,y:.515625},{x:.203125,y:.515625},{x:.234375,y:.515625},{x:.234375,y:.515625},{x:.265625,y:.515625},{x:.265625,y:.515625},{x:.296875,y:.515625},{x:.296875,y:.515625},{x:.328125,y:.515625},{x:.328125,y:.515625},{x:.359375,y:.515625},{x:.359375,y:.515625},{x:.390625,y:.515625},{x:.390625,y:.515625},{x:.421875,y:.515625},{x:.421875,y:.515625},{x:.453125,y:.515625},{x:.453125,y:.515625},{x:.484375,y:.515625},{x:.484375,y:.515625},{x:.515625,y:.515625},{x:.515625,y:.515625},{x:.546875,y:.515625},{x:.546875,y:.515625},{x:.578125,y:.515625},{x:.578125,y:.515625},{x:.609375,y:.515625},{x:.609375,y:.515625},{x:.640625,y:.515625},{x:.640625,y:.515625},{x:.671875,y:.515625},{x:.671875,y:.515625},{x:.703125,y:.515625},{x:.703125,y:.515625},{x:.734375,y:.515625},{x:.734375,y:.515625},{x:.765625,y:.515625},{x:.765625,y:.515625},{x:.796875,y:.515625},{x:.796875,y:.515625},{x:.828125,y:.515625},{x:.828125,y:.515625},{x:.859375,y:.515625},{x:.859375,y:.515625},{x:.890625,y:.515625},{x:.890625,y:.515625},{x:.921875,y:.515625},{x:.921875,y:.515625},{x:.953125,y:.515625},{x:.953125,y:.515625},{x:.984375,y:.515625},{x:.984375,y:.515625},{x:.015625,y:.546875},{x:.015625,y:.546875},{x:.046875,y:.546875},{x:.046875,y:.546875},{x:.078125,y:.546875},{x:.078125,y:.546875},{x:.109375,y:.546875},{x:.109375,y:.546875},{x:.140625,y:.546875},{x:.140625,y:.546875},{x:.171875,y:.546875},{x:.171875,y:.546875},{x:.203125,y:.546875},{x:.203125,y:.546875},{x:.234375,y:.546875},{x:.234375,y:.546875},{x:.265625,y:.546875},{x:.265625,y:.546875},{x:.296875,y:.546875},{x:.296875,y:.546875},{x:.328125,y:.546875},{x:.328125,y:.546875},{x:.359375,y:.546875},{x:.359375,y:.546875},{x:.390625,y:.546875},{x:.390625,y:.546875},{x:.421875,y:.546875},{x:.421875,y:.546875},{x:.453125,y:.546875},{x:.453125,y:.546875},{x:.484375,y:.546875},{x:.484375,y:.546875},{x:.515625,y:.546875},{x:.515625,y:.546875},{x:.546875,y:.546875},{x:.546875,y:.546875},{x:.578125,y:.546875},{x:.578125,y:.546875},{x:.609375,y:.546875},{x:.609375,y:.546875},{x:.640625,y:.546875},{x:.640625,y:.546875},{x:.671875,y:.546875},{x:.671875,y:.546875},{x:.703125,y:.546875},{x:.703125,y:.546875},{x:.734375,y:.546875},{x:.734375,y:.546875},{x:.765625,y:.546875},{x:.765625,y:.546875},{x:.796875,y:.546875},{x:.796875,y:.546875},{x:.828125,y:.546875},{x:.828125,y:.546875},{x:.859375,y:.546875},{x:.859375,y:.546875},{x:.890625,y:.546875},{x:.890625,y:.546875},{x:.921875,y:.546875},{x:.921875,y:.546875},{x:.953125,y:.546875},{x:.953125,y:.546875},{x:.984375,y:.546875},{x:.984375,y:.546875},{x:.015625,y:.578125},{x:.015625,y:.578125},{x:.046875,y:.578125},{x:.046875,y:.578125},{x:.078125,y:.578125},{x:.078125,y:.578125},{x:.109375,y:.578125},{x:.109375,y:.578125},{x:.140625,y:.578125},{x:.140625,y:.578125},{x:.171875,y:.578125},{x:.171875,y:.578125},{x:.203125,y:.578125},{x:.203125,y:.578125},{x:.234375,y:.578125},{x:.234375,y:.578125},{x:.265625,y:.578125},{x:.265625,y:.578125},{x:.296875,y:.578125},{x:.296875,y:.578125},{x:.328125,y:.578125},{x:.328125,y:.578125},{x:.359375,y:.578125},{x:.359375,y:.578125},{x:.390625,y:.578125},{x:.390625,y:.578125},{x:.421875,y:.578125},{x:.421875,y:.578125},{x:.453125,y:.578125},{x:.453125,y:.578125},{x:.484375,y:.578125},{x:.484375,y:.578125},{x:.515625,y:.578125},{x:.515625,y:.578125},{x:.546875,y:.578125},{x:.546875,y:.578125},{x:.578125,y:.578125},{x:.578125,y:.578125},{x:.609375,y:.578125},{x:.609375,y:.578125},{x:.640625,y:.578125},{x:.640625,y:.578125},{x:.671875,y:.578125},{x:.671875,y:.578125},{x:.703125,y:.578125},{x:.703125,y:.578125},{x:.734375,y:.578125},{x:.734375,y:.578125},{x:.765625,y:.578125},{x:.765625,y:.578125},{x:.796875,y:.578125},{x:.796875,y:.578125},{x:.828125,y:.578125},{x:.828125,y:.578125},{x:.859375,y:.578125},{x:.859375,y:.578125},{x:.890625,y:.578125},{x:.890625,y:.578125},{x:.921875,y:.578125},{x:.921875,y:.578125},{x:.953125,y:.578125},{x:.953125,y:.578125},{x:.984375,y:.578125},{x:.984375,y:.578125},{x:.015625,y:.609375},{x:.015625,y:.609375},{x:.046875,y:.609375},{x:.046875,y:.609375},{x:.078125,y:.609375},{x:.078125,y:.609375},{x:.109375,y:.609375},{x:.109375,y:.609375},{x:.140625,y:.609375},{x:.140625,y:.609375},{x:.171875,y:.609375},{x:.171875,y:.609375},{x:.203125,y:.609375},{x:.203125,y:.609375},{x:.234375,y:.609375},{x:.234375,y:.609375},{x:.265625,y:.609375},{x:.265625,y:.609375},{x:.296875,y:.609375},{x:.296875,y:.609375},{x:.328125,y:.609375},{x:.328125,y:.609375},{x:.359375,y:.609375},{x:.359375,y:.609375},{x:.390625,y:.609375},{x:.390625,y:.609375},{x:.421875,y:.609375},{x:.421875,y:.609375},{x:.453125,y:.609375},{x:.453125,y:.609375},{x:.484375,y:.609375},{x:.484375,y:.609375},{x:.515625,y:.609375},{x:.515625,y:.609375},{x:.546875,y:.609375},{x:.546875,y:.609375},{x:.578125,y:.609375},{x:.578125,y:.609375},{x:.609375,y:.609375},{x:.609375,y:.609375},{x:.640625,y:.609375},{x:.640625,y:.609375},{x:.671875,y:.609375},{x:.671875,y:.609375},{x:.703125,y:.609375},{x:.703125,y:.609375},{x:.734375,y:.609375},{x:.734375,y:.609375},{x:.765625,y:.609375},{x:.765625,y:.609375},{x:.796875,y:.609375},{x:.796875,y:.609375},{x:.828125,y:.609375},{x:.828125,y:.609375},{x:.859375,y:.609375},{x:.859375,y:.609375},{x:.890625,y:.609375},{x:.890625,y:.609375},{x:.921875,y:.609375},{x:.921875,y:.609375},{x:.953125,y:.609375},{x:.953125,y:.609375},{x:.984375,y:.609375},{x:.984375,y:.609375},{x:.015625,y:.640625},{x:.015625,y:.640625},{x:.046875,y:.640625},{x:.046875,y:.640625},{x:.078125,y:.640625},{x:.078125,y:.640625},{x:.109375,y:.640625},{x:.109375,y:.640625},{x:.140625,y:.640625},{x:.140625,y:.640625},{x:.171875,y:.640625},{x:.171875,y:.640625},{x:.203125,y:.640625},{x:.203125,y:.640625},{x:.234375,y:.640625},{x:.234375,y:.640625},{x:.265625,y:.640625},{x:.265625,y:.640625},{x:.296875,y:.640625},{x:.296875,y:.640625},{x:.328125,y:.640625},{x:.328125,y:.640625},{x:.359375,y:.640625},{x:.359375,y:.640625},{x:.390625,y:.640625},{x:.390625,y:.640625},{x:.421875,y:.640625},{x:.421875,y:.640625},{x:.453125,y:.640625},{x:.453125,y:.640625},{x:.484375,y:.640625},{x:.484375,y:.640625},{x:.515625,y:.640625},{x:.515625,y:.640625},{x:.546875,y:.640625},{x:.546875,y:.640625},{x:.578125,y:.640625},{x:.578125,y:.640625},{x:.609375,y:.640625},{x:.609375,y:.640625},{x:.640625,y:.640625},{x:.640625,y:.640625},{x:.671875,y:.640625},{x:.671875,y:.640625},{x:.703125,y:.640625},{x:.703125,y:.640625},{x:.734375,y:.640625},{x:.734375,y:.640625},{x:.765625,y:.640625},{x:.765625,y:.640625},{x:.796875,y:.640625},{x:.796875,y:.640625},{x:.828125,y:.640625},{x:.828125,y:.640625},{x:.859375,y:.640625},{x:.859375,y:.640625},{x:.890625,y:.640625},{x:.890625,y:.640625},{x:.921875,y:.640625},{x:.921875,y:.640625},{x:.953125,y:.640625},{x:.953125,y:.640625},{x:.984375,y:.640625},{x:.984375,y:.640625},{x:.015625,y:.671875},{x:.015625,y:.671875},{x:.046875,y:.671875},{x:.046875,y:.671875},{x:.078125,y:.671875},{x:.078125,y:.671875},{x:.109375,y:.671875},{x:.109375,y:.671875},{x:.140625,y:.671875},{x:.140625,y:.671875},{x:.171875,y:.671875},{x:.171875,y:.671875},{x:.203125,y:.671875},{x:.203125,y:.671875},{x:.234375,y:.671875},{x:.234375,y:.671875},{x:.265625,y:.671875},{x:.265625,y:.671875},{x:.296875,y:.671875},{x:.296875,y:.671875},{x:.328125,y:.671875},{x:.328125,y:.671875},{x:.359375,y:.671875},{x:.359375,y:.671875},{x:.390625,y:.671875},{x:.390625,y:.671875},{x:.421875,y:.671875},{x:.421875,y:.671875},{x:.453125,y:.671875},{x:.453125,y:.671875},{x:.484375,y:.671875},{x:.484375,y:.671875},{x:.515625,y:.671875},{x:.515625,y:.671875},{x:.546875,y:.671875},{x:.546875,y:.671875},{x:.578125,y:.671875},{x:.578125,y:.671875},{x:.609375,y:.671875},{x:.609375,y:.671875},{x:.640625,y:.671875},{x:.640625,y:.671875},{x:.671875,y:.671875},{x:.671875,y:.671875},{x:.703125,y:.671875},{x:.703125,y:.671875},{x:.734375,y:.671875},{x:.734375,y:.671875},{x:.765625,y:.671875},{x:.765625,y:.671875},{x:.796875,y:.671875},{x:.796875,y:.671875},{x:.828125,y:.671875},{x:.828125,y:.671875},{x:.859375,y:.671875},{x:.859375,y:.671875},{x:.890625,y:.671875},{x:.890625,y:.671875},{x:.921875,y:.671875},{x:.921875,y:.671875},{x:.953125,y:.671875},{x:.953125,y:.671875},{x:.984375,y:.671875},{x:.984375,y:.671875},{x:.015625,y:.703125},{x:.015625,y:.703125},{x:.046875,y:.703125},{x:.046875,y:.703125},{x:.078125,y:.703125},{x:.078125,y:.703125},{x:.109375,y:.703125},{x:.109375,y:.703125},{x:.140625,y:.703125},{x:.140625,y:.703125},{x:.171875,y:.703125},{x:.171875,y:.703125},{x:.203125,y:.703125},{x:.203125,y:.703125},{x:.234375,y:.703125},{x:.234375,y:.703125},{x:.265625,y:.703125},{x:.265625,y:.703125},{x:.296875,y:.703125},{x:.296875,y:.703125},{x:.328125,y:.703125},{x:.328125,y:.703125},{x:.359375,y:.703125},{x:.359375,y:.703125},{x:.390625,y:.703125},{x:.390625,y:.703125},{x:.421875,y:.703125},{x:.421875,y:.703125},{x:.453125,y:.703125},{x:.453125,y:.703125},{x:.484375,y:.703125},{x:.484375,y:.703125},{x:.515625,y:.703125},{x:.515625,y:.703125},{x:.546875,y:.703125},{x:.546875,y:.703125},{x:.578125,y:.703125},{x:.578125,y:.703125},{x:.609375,y:.703125},{x:.609375,y:.703125},{x:.640625,y:.703125},{x:.640625,y:.703125},{x:.671875,y:.703125},{x:.671875,y:.703125},{x:.703125,y:.703125},{x:.703125,y:.703125},{x:.734375,y:.703125},{x:.734375,y:.703125},{x:.765625,y:.703125},{x:.765625,y:.703125},{x:.796875,y:.703125},{x:.796875,y:.703125},{x:.828125,y:.703125},{x:.828125,y:.703125},{x:.859375,y:.703125},{x:.859375,y:.703125},{x:.890625,y:.703125},{x:.890625,y:.703125},{x:.921875,y:.703125},{x:.921875,y:.703125},{x:.953125,y:.703125},{x:.953125,y:.703125},{x:.984375,y:.703125},{x:.984375,y:.703125},{x:.015625,y:.734375},{x:.015625,y:.734375},{x:.046875,y:.734375},{x:.046875,y:.734375},{x:.078125,y:.734375},{x:.078125,y:.734375},{x:.109375,y:.734375},{x:.109375,y:.734375},{x:.140625,y:.734375},{x:.140625,y:.734375},{x:.171875,y:.734375},{x:.171875,y:.734375},{x:.203125,y:.734375},{x:.203125,y:.734375},{x:.234375,y:.734375},{x:.234375,y:.734375},{x:.265625,y:.734375},{x:.265625,y:.734375},{x:.296875,y:.734375},{x:.296875,y:.734375},{x:.328125,y:.734375},{x:.328125,y:.734375},{x:.359375,y:.734375},{x:.359375,y:.734375},{x:.390625,y:.734375},{x:.390625,y:.734375},{x:.421875,y:.734375},{x:.421875,y:.734375},{x:.453125,y:.734375},{x:.453125,y:.734375},{x:.484375,y:.734375},{x:.484375,y:.734375},{x:.515625,y:.734375},{x:.515625,y:.734375},{x:.546875,y:.734375},{x:.546875,y:.734375},{x:.578125,y:.734375},{x:.578125,y:.734375},{x:.609375,y:.734375},{x:.609375,y:.734375},{x:.640625,y:.734375},{x:.640625,y:.734375},{x:.671875,y:.734375},{x:.671875,y:.734375},{x:.703125,y:.734375},{x:.703125,y:.734375},{x:.734375,y:.734375},{x:.734375,y:.734375},{x:.765625,y:.734375},{x:.765625,y:.734375},{x:.796875,y:.734375},{x:.796875,y:.734375},{x:.828125,y:.734375},{x:.828125,y:.734375},{x:.859375,y:.734375},{x:.859375,y:.734375},{x:.890625,y:.734375},{x:.890625,y:.734375},{x:.921875,y:.734375},{x:.921875,y:.734375},{x:.953125,y:.734375},{x:.953125,y:.734375},{x:.984375,y:.734375},{x:.984375,y:.734375},{x:.015625,y:.765625},{x:.015625,y:.765625},{x:.046875,y:.765625},{x:.046875,y:.765625},{x:.078125,y:.765625},{x:.078125,y:.765625},{x:.109375,y:.765625},{x:.109375,y:.765625},{x:.140625,y:.765625},{x:.140625,y:.765625},{x:.171875,y:.765625},{x:.171875,y:.765625},{x:.203125,y:.765625},{x:.203125,y:.765625},{x:.234375,y:.765625},{x:.234375,y:.765625},{x:.265625,y:.765625},{x:.265625,y:.765625},{x:.296875,y:.765625},{x:.296875,y:.765625},{x:.328125,y:.765625},{x:.328125,y:.765625},{x:.359375,y:.765625},{x:.359375,y:.765625},{x:.390625,y:.765625},{x:.390625,y:.765625},{x:.421875,y:.765625},{x:.421875,y:.765625},{x:.453125,y:.765625},{x:.453125,y:.765625},{x:.484375,y:.765625},{x:.484375,y:.765625},{x:.515625,y:.765625},{x:.515625,y:.765625},{x:.546875,y:.765625},{x:.546875,y:.765625},{x:.578125,y:.765625},{x:.578125,y:.765625},{x:.609375,y:.765625},{x:.609375,y:.765625},{x:.640625,y:.765625},{x:.640625,y:.765625},{x:.671875,y:.765625},{x:.671875,y:.765625},{x:.703125,y:.765625},{x:.703125,y:.765625},{x:.734375,y:.765625},{x:.734375,y:.765625},{x:.765625,y:.765625},{x:.765625,y:.765625},{x:.796875,y:.765625},{x:.796875,y:.765625},{x:.828125,y:.765625},{x:.828125,y:.765625},{x:.859375,y:.765625},{x:.859375,y:.765625},{x:.890625,y:.765625},{x:.890625,y:.765625},{x:.921875,y:.765625},{x:.921875,y:.765625},{x:.953125,y:.765625},{x:.953125,y:.765625},{x:.984375,y:.765625},{x:.984375,y:.765625},{x:.015625,y:.796875},{x:.015625,y:.796875},{x:.046875,y:.796875},{x:.046875,y:.796875},{x:.078125,y:.796875},{x:.078125,y:.796875},{x:.109375,y:.796875},{x:.109375,y:.796875},{x:.140625,y:.796875},{x:.140625,y:.796875},{x:.171875,y:.796875},{x:.171875,y:.796875},{x:.203125,y:.796875},{x:.203125,y:.796875},{x:.234375,y:.796875},{x:.234375,y:.796875},{x:.265625,y:.796875},{x:.265625,y:.796875},{x:.296875,y:.796875},{x:.296875,y:.796875},{x:.328125,y:.796875},{x:.328125,y:.796875},{x:.359375,y:.796875},{x:.359375,y:.796875},{x:.390625,y:.796875},{x:.390625,y:.796875},{x:.421875,y:.796875},{x:.421875,y:.796875},{x:.453125,y:.796875},{x:.453125,y:.796875},{x:.484375,y:.796875},{x:.484375,y:.796875},{x:.515625,y:.796875},{x:.515625,y:.796875},{x:.546875,y:.796875},{x:.546875,y:.796875},{x:.578125,y:.796875},{x:.578125,y:.796875},{x:.609375,y:.796875},{x:.609375,y:.796875},{x:.640625,y:.796875},{x:.640625,y:.796875},{x:.671875,y:.796875},{x:.671875,y:.796875},{x:.703125,y:.796875},{x:.703125,y:.796875},{x:.734375,y:.796875},{x:.734375,y:.796875},{x:.765625,y:.796875},{x:.765625,y:.796875},{x:.796875,y:.796875},{x:.796875,y:.796875},{x:.828125,y:.796875},{x:.828125,y:.796875},{x:.859375,y:.796875},{x:.859375,y:.796875},{x:.890625,y:.796875},{x:.890625,y:.796875},{x:.921875,y:.796875},{x:.921875,y:.796875},{x:.953125,y:.796875},{x:.953125,y:.796875},{x:.984375,y:.796875},{x:.984375,y:.796875},{x:.015625,y:.828125},{x:.015625,y:.828125},{x:.046875,y:.828125},{x:.046875,y:.828125},{x:.078125,y:.828125},{x:.078125,y:.828125},{x:.109375,y:.828125},{x:.109375,y:.828125},{x:.140625,y:.828125},{x:.140625,y:.828125},{x:.171875,y:.828125},{x:.171875,y:.828125},{x:.203125,y:.828125},{x:.203125,y:.828125},{x:.234375,y:.828125},{x:.234375,y:.828125},{x:.265625,y:.828125},{x:.265625,y:.828125},{x:.296875,y:.828125},{x:.296875,y:.828125},{x:.328125,y:.828125},{x:.328125,y:.828125},{x:.359375,y:.828125},{x:.359375,y:.828125},{x:.390625,y:.828125},{x:.390625,y:.828125},{x:.421875,y:.828125},{x:.421875,y:.828125},{x:.453125,y:.828125},{x:.453125,y:.828125},{x:.484375,y:.828125},{x:.484375,y:.828125},{x:.515625,y:.828125},{x:.515625,y:.828125},{x:.546875,y:.828125},{x:.546875,y:.828125},{x:.578125,y:.828125},{x:.578125,y:.828125},{x:.609375,y:.828125},{x:.609375,y:.828125},{x:.640625,y:.828125},{x:.640625,y:.828125},{x:.671875,y:.828125},{x:.671875,y:.828125},{x:.703125,y:.828125},{x:.703125,y:.828125},{x:.734375,y:.828125},{x:.734375,y:.828125},{x:.765625,y:.828125},{x:.765625,y:.828125},{x:.796875,y:.828125},{x:.796875,y:.828125},{x:.828125,y:.828125},{x:.828125,y:.828125},{x:.859375,y:.828125},{x:.859375,y:.828125},{x:.890625,y:.828125},{x:.890625,y:.828125},{x:.921875,y:.828125},{x:.921875,y:.828125},{x:.953125,y:.828125},{x:.953125,y:.828125},{x:.984375,y:.828125},{x:.984375,y:.828125},{x:.015625,y:.859375},{x:.015625,y:.859375},{x:.046875,y:.859375},{x:.046875,y:.859375},{x:.078125,y:.859375},{x:.078125,y:.859375},{x:.109375,y:.859375},{x:.109375,y:.859375},{x:.140625,y:.859375},{x:.140625,y:.859375},{x:.171875,y:.859375},{x:.171875,y:.859375},{x:.203125,y:.859375},{x:.203125,y:.859375},{x:.234375,y:.859375},{x:.234375,y:.859375},{x:.265625,y:.859375},{x:.265625,y:.859375},{x:.296875,y:.859375},{x:.296875,y:.859375},{x:.328125,y:.859375},{x:.328125,y:.859375},{x:.359375,y:.859375},{x:.359375,y:.859375},{x:.390625,y:.859375},{x:.390625,y:.859375},{x:.421875,y:.859375},{x:.421875,y:.859375},{x:.453125,y:.859375},{x:.453125,y:.859375},{x:.484375,y:.859375},{x:.484375,y:.859375},{x:.515625,y:.859375},{x:.515625,y:.859375},{x:.546875,y:.859375},{x:.546875,y:.859375},{x:.578125,y:.859375},{x:.578125,y:.859375},{x:.609375,y:.859375},{x:.609375,y:.859375},{x:.640625,y:.859375},{x:.640625,y:.859375},{x:.671875,y:.859375},{x:.671875,y:.859375},{x:.703125,y:.859375},{x:.703125,y:.859375},{x:.734375,y:.859375},{x:.734375,y:.859375},{x:.765625,y:.859375},{x:.765625,y:.859375},{x:.796875,y:.859375},{x:.796875,y:.859375},{x:.828125,y:.859375},{x:.828125,y:.859375},{x:.859375,y:.859375},{x:.859375,y:.859375},{x:.890625,y:.859375},{x:.890625,y:.859375},{x:.921875,y:.859375},{x:.921875,y:.859375},{x:.953125,y:.859375},{x:.953125,y:.859375},{x:.984375,y:.859375},{x:.984375,y:.859375},{x:.015625,y:.890625},{x:.015625,y:.890625},{x:.046875,y:.890625},{x:.046875,y:.890625},{x:.078125,y:.890625},{x:.078125,y:.890625},{x:.109375,y:.890625},{x:.109375,y:.890625},{x:.140625,y:.890625},{x:.140625,y:.890625},{x:.171875,y:.890625},{x:.171875,y:.890625},{x:.203125,y:.890625},{x:.203125,y:.890625},{x:.234375,y:.890625},{x:.234375,y:.890625},{x:.265625,y:.890625},{x:.265625,y:.890625},{x:.296875,y:.890625},{x:.296875,y:.890625},{x:.328125,y:.890625},{x:.328125,y:.890625},{x:.359375,y:.890625},{x:.359375,y:.890625},{x:.390625,y:.890625},{x:.390625,y:.890625},{x:.421875,y:.890625},{x:.421875,y:.890625},{x:.453125,y:.890625},{x:.453125,y:.890625},{x:.484375,y:.890625},{x:.484375,y:.890625},{x:.515625,y:.890625},{x:.515625,y:.890625},{x:.546875,y:.890625},{x:.546875,y:.890625},{x:.578125,y:.890625},{x:.578125,y:.890625},{x:.609375,y:.890625},{x:.609375,y:.890625},{x:.640625,y:.890625},{x:.640625,y:.890625},{x:.671875,y:.890625},{x:.671875,y:.890625},{x:.703125,y:.890625},{x:.703125,y:.890625},{x:.734375,y:.890625},{x:.734375,y:.890625},{x:.765625,y:.890625},{x:.765625,y:.890625},{x:.796875,y:.890625},{x:.796875,y:.890625},{x:.828125,y:.890625},{x:.828125,y:.890625},{x:.859375,y:.890625},{x:.859375,y:.890625},{x:.890625,y:.890625},{x:.890625,y:.890625},{x:.921875,y:.890625},{x:.921875,y:.890625},{x:.953125,y:.890625},{x:.953125,y:.890625},{x:.984375,y:.890625},{x:.984375,y:.890625},{x:.015625,y:.921875},{x:.015625,y:.921875},{x:.046875,y:.921875},{x:.046875,y:.921875},{x:.078125,y:.921875},{x:.078125,y:.921875},{x:.109375,y:.921875},{x:.109375,y:.921875},{x:.140625,y:.921875},{x:.140625,y:.921875},{x:.171875,y:.921875},{x:.171875,y:.921875},{x:.203125,y:.921875},{x:.203125,y:.921875},{x:.234375,y:.921875},{x:.234375,y:.921875},{x:.265625,y:.921875},{x:.265625,y:.921875},{x:.296875,y:.921875},{x:.296875,y:.921875},{x:.328125,y:.921875},{x:.328125,y:.921875},{x:.359375,y:.921875},{x:.359375,y:.921875},{x:.390625,y:.921875},{x:.390625,y:.921875},{x:.421875,y:.921875},{x:.421875,y:.921875},{x:.453125,y:.921875},{x:.453125,y:.921875},{x:.484375,y:.921875},{x:.484375,y:.921875},{x:.515625,y:.921875},{x:.515625,y:.921875},{x:.546875,y:.921875},{x:.546875,y:.921875},{x:.578125,y:.921875},{x:.578125,y:.921875},{x:.609375,y:.921875},{x:.609375,y:.921875},{x:.640625,y:.921875},{x:.640625,y:.921875},{x:.671875,y:.921875},{x:.671875,y:.921875},{x:.703125,y:.921875},{x:.703125,y:.921875},{x:.734375,y:.921875},{x:.734375,y:.921875},{x:.765625,y:.921875},{x:.765625,y:.921875},{x:.796875,y:.921875},{x:.796875,y:.921875},{x:.828125,y:.921875},{x:.828125,y:.921875},{x:.859375,y:.921875},{x:.859375,y:.921875},{x:.890625,y:.921875},{x:.890625,y:.921875},{x:.921875,y:.921875},{x:.921875,y:.921875},{x:.953125,y:.921875},{x:.953125,y:.921875},{x:.984375,y:.921875},{x:.984375,y:.921875},{x:.015625,y:.953125},{x:.015625,y:.953125},{x:.046875,y:.953125},{x:.046875,y:.953125},{x:.078125,y:.953125},{x:.078125,y:.953125},{x:.109375,y:.953125},{x:.109375,y:.953125},{x:.140625,y:.953125},{x:.140625,y:.953125},{x:.171875,y:.953125},{x:.171875,y:.953125},{x:.203125,y:.953125},{x:.203125,y:.953125},{x:.234375,y:.953125},{x:.234375,y:.953125},{x:.265625,y:.953125},{x:.265625,y:.953125},{x:.296875,y:.953125},{x:.296875,y:.953125},{x:.328125,y:.953125},{x:.328125,y:.953125},{x:.359375,y:.953125},{x:.359375,y:.953125},{x:.390625,y:.953125},{x:.390625,y:.953125},{x:.421875,y:.953125},{x:.421875,y:.953125},{x:.453125,y:.953125},{x:.453125,y:.953125},{x:.484375,y:.953125},{x:.484375,y:.953125},{x:.515625,y:.953125},{x:.515625,y:.953125},{x:.546875,y:.953125},{x:.546875,y:.953125},{x:.578125,y:.953125},{x:.578125,y:.953125},{x:.609375,y:.953125},{x:.609375,y:.953125},{x:.640625,y:.953125},{x:.640625,y:.953125},{x:.671875,y:.953125},{x:.671875,y:.953125},{x:.703125,y:.953125},{x:.703125,y:.953125},{x:.734375,y:.953125},{x:.734375,y:.953125},{x:.765625,y:.953125},{x:.765625,y:.953125},{x:.796875,y:.953125},{x:.796875,y:.953125},{x:.828125,y:.953125},{x:.828125,y:.953125},{x:.859375,y:.953125},{x:.859375,y:.953125},{x:.890625,y:.953125},{x:.890625,y:.953125},{x:.921875,y:.953125},{x:.921875,y:.953125},{x:.953125,y:.953125},{x:.953125,y:.953125},{x:.984375,y:.953125},{x:.984375,y:.953125},{x:.015625,y:.984375},{x:.015625,y:.984375},{x:.046875,y:.984375},{x:.046875,y:.984375},{x:.078125,y:.984375},{x:.078125,y:.984375},{x:.109375,y:.984375},{x:.109375,y:.984375},{x:.140625,y:.984375},{x:.140625,y:.984375},{x:.171875,y:.984375},{x:.171875,y:.984375},{x:.203125,y:.984375},{x:.203125,y:.984375},{x:.234375,y:.984375},{x:.234375,y:.984375},{x:.265625,y:.984375},{x:.265625,y:.984375},{x:.296875,y:.984375},{x:.296875,y:.984375},{x:.328125,y:.984375},{x:.328125,y:.984375},{x:.359375,y:.984375},{x:.359375,y:.984375},{x:.390625,y:.984375},{x:.390625,y:.984375},{x:.421875,y:.984375},{x:.421875,y:.984375},{x:.453125,y:.984375},{x:.453125,y:.984375},{x:.484375,y:.984375},{x:.484375,y:.984375},{x:.515625,y:.984375},{x:.515625,y:.984375},{x:.546875,y:.984375},{x:.546875,y:.984375},{x:.578125,y:.984375},{x:.578125,y:.984375},{x:.609375,y:.984375},{x:.609375,y:.984375},{x:.640625,y:.984375},{x:.640625,y:.984375},{x:.671875,y:.984375},{x:.671875,y:.984375},{x:.703125,y:.984375},{x:.703125,y:.984375},{x:.734375,y:.984375},{x:.734375,y:.984375},{x:.765625,y:.984375},{x:.765625,y:.984375},{x:.796875,y:.984375},{x:.796875,y:.984375},{x:.828125,y:.984375},{x:.828125,y:.984375},{x:.859375,y:.984375},{x:.859375,y:.984375},{x:.890625,y:.984375},{x:.890625,y:.984375},{x:.921875,y:.984375},{x:.921875,y:.984375},{x:.953125,y:.984375},{x:.953125,y:.984375},{x:.984375,y:.984375},{x:.984375,y:.984375},{x:.03125,y:.03125},{x:.03125,y:.03125},{x:.09375,y:.03125},{x:.09375,y:.03125},{x:.15625,y:.03125},{x:.15625,y:.03125},{x:.21875,y:.03125},{x:.21875,y:.03125},{x:.28125,y:.03125},{x:.28125,y:.03125},{x:.34375,y:.03125},{x:.34375,y:.03125},{x:.40625,y:.03125},{x:.40625,y:.03125},{x:.46875,y:.03125},{x:.46875,y:.03125},{x:.53125,y:.03125},{x:.53125,y:.03125},{x:.59375,y:.03125},{x:.59375,y:.03125},{x:.65625,y:.03125},{x:.65625,y:.03125},{x:.71875,y:.03125},{x:.71875,y:.03125},{x:.78125,y:.03125},{x:.78125,y:.03125},{x:.84375,y:.03125},{x:.84375,y:.03125},{x:.90625,y:.03125},{x:.90625,y:.03125},{x:.96875,y:.03125},{x:.96875,y:.03125},{x:.03125,y:.09375},{x:.03125,y:.09375},{x:.09375,y:.09375},{x:.09375,y:.09375},{x:.15625,y:.09375},{x:.15625,y:.09375},{x:.21875,y:.09375},{x:.21875,y:.09375},{x:.28125,y:.09375},{x:.28125,y:.09375},{x:.34375,y:.09375},{x:.34375,y:.09375},{x:.40625,y:.09375},{x:.40625,y:.09375},{x:.46875,y:.09375},{x:.46875,y:.09375},{x:.53125,y:.09375},{x:.53125,y:.09375},{x:.59375,y:.09375},{x:.59375,y:.09375},{x:.65625,y:.09375},{x:.65625,y:.09375},{x:.71875,y:.09375},{x:.71875,y:.09375},{x:.78125,y:.09375},{x:.78125,y:.09375},{x:.84375,y:.09375},{x:.84375,y:.09375},{x:.90625,y:.09375},{x:.90625,y:.09375},{x:.96875,y:.09375},{x:.96875,y:.09375},{x:.03125,y:.15625},{x:.03125,y:.15625},{x:.09375,y:.15625},{x:.09375,y:.15625},{x:.15625,y:.15625},{x:.15625,y:.15625},{x:.21875,y:.15625},{x:.21875,y:.15625},{x:.28125,y:.15625},{x:.28125,y:.15625},{x:.34375,y:.15625},{x:.34375,y:.15625},{x:.40625,y:.15625},{x:.40625,y:.15625},{x:.46875,y:.15625},{x:.46875,y:.15625},{x:.53125,y:.15625},{x:.53125,y:.15625},{x:.59375,y:.15625},{x:.59375,y:.15625},{x:.65625,y:.15625},{x:.65625,y:.15625},{x:.71875,y:.15625},{x:.71875,y:.15625},{x:.78125,y:.15625},{x:.78125,y:.15625},{x:.84375,y:.15625},{x:.84375,y:.15625},{x:.90625,y:.15625},{x:.90625,y:.15625},{x:.96875,y:.15625},{x:.96875,y:.15625},{x:.03125,y:.21875},{x:.03125,y:.21875},{x:.09375,y:.21875},{x:.09375,y:.21875},{x:.15625,y:.21875},{x:.15625,y:.21875},{x:.21875,y:.21875},{x:.21875,y:.21875},{x:.28125,y:.21875},{x:.28125,y:.21875},{x:.34375,y:.21875},{x:.34375,y:.21875},{x:.40625,y:.21875},{x:.40625,y:.21875},{x:.46875,y:.21875},{x:.46875,y:.21875},{x:.53125,y:.21875},{x:.53125,y:.21875},{x:.59375,y:.21875},{x:.59375,y:.21875},{x:.65625,y:.21875},{x:.65625,y:.21875},{x:.71875,y:.21875},{x:.71875,y:.21875},{x:.78125,y:.21875},{x:.78125,y:.21875},{x:.84375,y:.21875},{x:.84375,y:.21875},{x:.90625,y:.21875},{x:.90625,y:.21875},{x:.96875,y:.21875},{x:.96875,y:.21875},{x:.03125,y:.28125},{x:.03125,y:.28125},{x:.09375,y:.28125},{x:.09375,y:.28125},{x:.15625,y:.28125},{x:.15625,y:.28125},{x:.21875,y:.28125},{x:.21875,y:.28125},{x:.28125,y:.28125},{x:.28125,y:.28125},{x:.34375,y:.28125},{x:.34375,y:.28125},{x:.40625,y:.28125},{x:.40625,y:.28125},{x:.46875,y:.28125},{x:.46875,y:.28125},{x:.53125,y:.28125},{x:.53125,y:.28125},{x:.59375,y:.28125},{x:.59375,y:.28125},{x:.65625,y:.28125},{x:.65625,y:.28125},{x:.71875,y:.28125},{x:.71875,y:.28125},{x:.78125,y:.28125},{x:.78125,y:.28125},{x:.84375,y:.28125},{x:.84375,y:.28125},{x:.90625,y:.28125},{x:.90625,y:.28125},{x:.96875,y:.28125},{x:.96875,y:.28125},{x:.03125,y:.34375},{x:.03125,y:.34375},{x:.09375,y:.34375},{x:.09375,y:.34375},{x:.15625,y:.34375},{x:.15625,y:.34375},{x:.21875,y:.34375},{x:.21875,y:.34375},{x:.28125,y:.34375},{x:.28125,y:.34375},{x:.34375,y:.34375},{x:.34375,y:.34375},{x:.40625,y:.34375},{x:.40625,y:.34375},{x:.46875,y:.34375},{x:.46875,y:.34375},{x:.53125,y:.34375},{x:.53125,y:.34375},{x:.59375,y:.34375},{x:.59375,y:.34375},{x:.65625,y:.34375},{x:.65625,y:.34375},{x:.71875,y:.34375},{x:.71875,y:.34375},{x:.78125,y:.34375},{x:.78125,y:.34375},{x:.84375,y:.34375},{x:.84375,y:.34375},{x:.90625,y:.34375},{x:.90625,y:.34375},{x:.96875,y:.34375},{x:.96875,y:.34375},{x:.03125,y:.40625},{x:.03125,y:.40625},{x:.09375,y:.40625},{x:.09375,y:.40625},{x:.15625,y:.40625},{x:.15625,y:.40625},{x:.21875,y:.40625},{x:.21875,y:.40625},{x:.28125,y:.40625},{x:.28125,y:.40625},{x:.34375,y:.40625},{x:.34375,y:.40625},{x:.40625,y:.40625},{x:.40625,y:.40625},{x:.46875,y:.40625},{x:.46875,y:.40625},{x:.53125,y:.40625},{x:.53125,y:.40625},{x:.59375,y:.40625},{x:.59375,y:.40625},{x:.65625,y:.40625},{x:.65625,y:.40625},{x:.71875,y:.40625},{x:.71875,y:.40625},{x:.78125,y:.40625},{x:.78125,y:.40625},{x:.84375,y:.40625},{x:.84375,y:.40625},{x:.90625,y:.40625},{x:.90625,y:.40625},{x:.96875,y:.40625},{x:.96875,y:.40625},{x:.03125,y:.46875},{x:.03125,y:.46875},{x:.09375,y:.46875},{x:.09375,y:.46875},{x:.15625,y:.46875},{x:.15625,y:.46875},{x:.21875,y:.46875},{x:.21875,y:.46875},{x:.28125,y:.46875},{x:.28125,y:.46875},{x:.34375,y:.46875},{x:.34375,y:.46875},{x:.40625,y:.46875},{x:.40625,y:.46875},{x:.46875,y:.46875},{x:.46875,y:.46875},{x:.53125,y:.46875},{x:.53125,y:.46875},{x:.59375,y:.46875},{x:.59375,y:.46875},{x:.65625,y:.46875},{x:.65625,y:.46875},{x:.71875,y:.46875},{x:.71875,y:.46875},{x:.78125,y:.46875},{x:.78125,y:.46875},{x:.84375,y:.46875},{x:.84375,y:.46875},{x:.90625,y:.46875},{x:.90625,y:.46875},{x:.96875,y:.46875},{x:.96875,y:.46875},{x:.03125,y:.53125},{x:.03125,y:.53125},{x:.09375,y:.53125},{x:.09375,y:.53125},{x:.15625,y:.53125},{x:.15625,y:.53125},{x:.21875,y:.53125},{x:.21875,y:.53125},{x:.28125,y:.53125},{x:.28125,y:.53125},{x:.34375,y:.53125},{x:.34375,y:.53125},{x:.40625,y:.53125},{x:.40625,y:.53125},{x:.46875,y:.53125},{x:.46875,y:.53125},{x:.53125,y:.53125},{x:.53125,y:.53125},{x:.59375,y:.53125},{x:.59375,y:.53125},{x:.65625,y:.53125},{x:.65625,y:.53125},{x:.71875,y:.53125},{x:.71875,y:.53125},{x:.78125,y:.53125},{x:.78125,y:.53125},{x:.84375,y:.53125},{x:.84375,y:.53125},{x:.90625,y:.53125},{x:.90625,y:.53125},{x:.96875,y:.53125},{x:.96875,y:.53125},{x:.03125,y:.59375},{x:.03125,y:.59375},{x:.09375,y:.59375},{x:.09375,y:.59375},{x:.15625,y:.59375},{x:.15625,y:.59375},{x:.21875,y:.59375},{x:.21875,y:.59375},{x:.28125,y:.59375},{x:.28125,y:.59375},{x:.34375,y:.59375},{x:.34375,y:.59375},{x:.40625,y:.59375},{x:.40625,y:.59375},{x:.46875,y:.59375},{x:.46875,y:.59375},{x:.53125,y:.59375},{x:.53125,y:.59375},{x:.59375,y:.59375},{x:.59375,y:.59375},{x:.65625,y:.59375},{x:.65625,y:.59375},{x:.71875,y:.59375},{x:.71875,y:.59375},{x:.78125,y:.59375},{x:.78125,y:.59375},{x:.84375,y:.59375},{x:.84375,y:.59375},{x:.90625,y:.59375},{x:.90625,y:.59375},{x:.96875,y:.59375},{x:.96875,y:.59375},{x:.03125,y:.65625},{x:.03125,y:.65625},{x:.09375,y:.65625},{x:.09375,y:.65625},{x:.15625,y:.65625},{x:.15625,y:.65625},{x:.21875,y:.65625},{x:.21875,y:.65625},{x:.28125,y:.65625},{x:.28125,y:.65625},{x:.34375,y:.65625},{x:.34375,y:.65625},{x:.40625,y:.65625},{x:.40625,y:.65625},{x:.46875,y:.65625},{x:.46875,y:.65625},{x:.53125,y:.65625},{x:.53125,y:.65625},{x:.59375,y:.65625},{x:.59375,y:.65625},{x:.65625,y:.65625},{x:.65625,y:.65625},{x:.71875,y:.65625},{x:.71875,y:.65625},{x:.78125,y:.65625},{x:.78125,y:.65625},{x:.84375,y:.65625},{x:.84375,y:.65625},{x:.90625,y:.65625},{x:.90625,y:.65625},{x:.96875,y:.65625},{x:.96875,y:.65625},{x:.03125,y:.71875},{x:.03125,y:.71875},{x:.09375,y:.71875},{x:.09375,y:.71875},{x:.15625,y:.71875},{x:.15625,y:.71875},{x:.21875,y:.71875},{x:.21875,y:.71875},{x:.28125,y:.71875},{x:.28125,y:.71875},{x:.34375,y:.71875},{x:.34375,y:.71875},{x:.40625,y:.71875},{x:.40625,y:.71875},{x:.46875,y:.71875},{x:.46875,y:.71875},{x:.53125,y:.71875},{x:.53125,y:.71875},{x:.59375,y:.71875},{x:.59375,y:.71875},{x:.65625,y:.71875},{x:.65625,y:.71875},{x:.71875,y:.71875},{x:.71875,y:.71875},{x:.78125,y:.71875},{x:.78125,y:.71875},{x:.84375,y:.71875},{x:.84375,y:.71875},{x:.90625,y:.71875},{x:.90625,y:.71875},{x:.96875,y:.71875},{x:.96875,y:.71875},{x:.03125,y:.78125},{x:.03125,y:.78125},{x:.09375,y:.78125},{x:.09375,y:.78125},{x:.15625,y:.78125},{x:.15625,y:.78125},{x:.21875,y:.78125},{x:.21875,y:.78125},{x:.28125,y:.78125},{x:.28125,y:.78125},{x:.34375,y:.78125},{x:.34375,y:.78125},{x:.40625,y:.78125},{x:.40625,y:.78125},{x:.46875,y:.78125},{x:.46875,y:.78125},{x:.53125,y:.78125},{x:.53125,y:.78125},{x:.59375,y:.78125},{x:.59375,y:.78125},{x:.65625,y:.78125},{x:.65625,y:.78125},{x:.71875,y:.78125},{x:.71875,y:.78125},{x:.78125,y:.78125},{x:.78125,y:.78125},{x:.84375,y:.78125},{x:.84375,y:.78125},{x:.90625,y:.78125},{x:.90625,y:.78125},{x:.96875,y:.78125},{x:.96875,y:.78125},{x:.03125,y:.84375},{x:.03125,y:.84375},{x:.09375,y:.84375},{x:.09375,y:.84375},{x:.15625,y:.84375},{x:.15625,y:.84375},{x:.21875,y:.84375},{x:.21875,y:.84375},{x:.28125,y:.84375},{x:.28125,y:.84375},{x:.34375,y:.84375},{x:.34375,y:.84375},{x:.40625,y:.84375},{x:.40625,y:.84375},{x:.46875,y:.84375},{x:.46875,y:.84375},{x:.53125,y:.84375},{x:.53125,y:.84375},{x:.59375,y:.84375},{x:.59375,y:.84375},{x:.65625,y:.84375},{x:.65625,y:.84375},{x:.71875,y:.84375},{x:.71875,y:.84375},{x:.78125,y:.84375},{x:.78125,y:.84375},{x:.84375,y:.84375},{x:.84375,y:.84375},{x:.90625,y:.84375},{x:.90625,y:.84375},{x:.96875,y:.84375},{x:.96875,y:.84375},{x:.03125,y:.90625},{x:.03125,y:.90625},{x:.09375,y:.90625},{x:.09375,y:.90625},{x:.15625,y:.90625},{x:.15625,y:.90625},{x:.21875,y:.90625},{x:.21875,y:.90625},{x:.28125,y:.90625},{x:.28125,y:.90625},{x:.34375,y:.90625},{x:.34375,y:.90625},{x:.40625,y:.90625},{x:.40625,y:.90625},{x:.46875,y:.90625},{x:.46875,y:.90625},{x:.53125,y:.90625},{x:.53125,y:.90625},{x:.59375,y:.90625},{x:.59375,y:.90625},{x:.65625,y:.90625},{x:.65625,y:.90625},{x:.71875,y:.90625},{x:.71875,y:.90625},{x:.78125,y:.90625},{x:.78125,y:.90625},{x:.84375,y:.90625},{x:.84375,y:.90625},{x:.90625,y:.90625},{x:.90625,y:.90625},{x:.96875,y:.90625},{x:.96875,y:.90625},{x:.03125,y:.96875},{x:.03125,y:.96875},{x:.09375,y:.96875},{x:.09375,y:.96875},{x:.15625,y:.96875},{x:.15625,y:.96875},{x:.21875,y:.96875},{x:.21875,y:.96875},{x:.28125,y:.96875},{x:.28125,y:.96875},{x:.34375,y:.96875},{x:.34375,y:.96875},{x:.40625,y:.96875},{x:.40625,y:.96875},{x:.46875,y:.96875},{x:.46875,y:.96875},{x:.53125,y:.96875},{x:.53125,y:.96875},{x:.59375,y:.96875},{x:.59375,y:.96875},{x:.65625,y:.96875},{x:.65625,y:.96875},{x:.71875,y:.96875},{x:.71875,y:.96875},{x:.78125,y:.96875},{x:.78125,y:.96875},{x:.84375,y:.96875},{x:.84375,y:.96875},{x:.90625,y:.96875},{x:.90625,y:.96875},{x:.96875,y:.96875},{x:.96875,y:.96875},{x:.0625,y:.0625},{x:.0625,y:.0625},{x:.0625,y:.0625},{x:.0625,y:.0625},{x:.0625,y:.0625},{x:.0625,y:.0625},{x:.1875,y:.0625},{x:.1875,y:.0625},{x:.1875,y:.0625},{x:.1875,y:.0625},{x:.1875,y:.0625},{x:.1875,y:.0625},{x:.3125,y:.0625},{x:.3125,y:.0625},{x:.3125,y:.0625},{x:.3125,y:.0625},{x:.3125,y:.0625},{x:.3125,y:.0625},{x:.4375,y:.0625},{x:.4375,y:.0625},{x:.4375,y:.0625},{x:.4375,y:.0625},{x:.4375,y:.0625},{x:.4375,y:.0625},{x:.5625,y:.0625},{x:.5625,y:.0625},{x:.5625,y:.0625},{x:.5625,y:.0625},{x:.5625,y:.0625},{x:.5625,y:.0625},{x:.6875,y:.0625},{x:.6875,y:.0625},{x:.6875,y:.0625},{x:.6875,y:.0625},{x:.6875,y:.0625},{x:.6875,y:.0625},{x:.8125,y:.0625},{x:.8125,y:.0625},{x:.8125,y:.0625},{x:.8125,y:.0625},{x:.8125,y:.0625},{x:.8125,y:.0625},{x:.9375,y:.0625},{x:.9375,y:.0625},{x:.9375,y:.0625},{x:.9375,y:.0625},{x:.9375,y:.0625},{x:.9375,y:.0625},{x:.0625,y:.1875},{x:.0625,y:.1875},{x:.0625,y:.1875},{x:.0625,y:.1875},{x:.0625,y:.1875},{x:.0625,y:.1875},{x:.1875,y:.1875},{x:.1875,y:.1875},{x:.1875,y:.1875},{x:.1875,y:.1875},{x:.1875,y:.1875},{x:.1875,y:.1875},{x:.3125,y:.1875},{x:.3125,y:.1875},{x:.3125,y:.1875},{x:.3125,y:.1875},{x:.3125,y:.1875},{x:.3125,y:.1875},{x:.4375,y:.1875},{x:.4375,y:.1875},{x:.4375,y:.1875},{x:.4375,y:.1875},{x:.4375,y:.1875},{x:.4375,y:.1875},{x:.5625,y:.1875},{x:.5625,y:.1875},{x:.5625,y:.1875},{x:.5625,y:.1875},{x:.5625,y:.1875},{x:.5625,y:.1875},{x:.6875,y:.1875},{x:.6875,y:.1875},{x:.6875,y:.1875},{x:.6875,y:.1875},{x:.6875,y:.1875},{x:.6875,y:.1875},{x:.8125,y:.1875},{x:.8125,y:.1875},{x:.8125,y:.1875},{x:.8125,y:.1875},{x:.8125,y:.1875},{x:.8125,y:.1875},{x:.9375,y:.1875},{x:.9375,y:.1875},{x:.9375,y:.1875},{x:.9375,y:.1875},{x:.9375,y:.1875},{x:.9375,y:.1875},{x:.0625,y:.3125},{x:.0625,y:.3125},{x:.0625,y:.3125},{x:.0625,y:.3125},{x:.0625,y:.3125},{x:.0625,y:.3125},{x:.1875,y:.3125},{x:.1875,y:.3125},{x:.1875,y:.3125},{x:.1875,y:.3125},{x:.1875,y:.3125},{x:.1875,y:.3125},{x:.3125,y:.3125},{x:.3125,y:.3125},{x:.3125,y:.3125},{x:.3125,y:.3125},{x:.3125,y:.3125},{x:.3125,y:.3125},{x:.4375,y:.3125},{x:.4375,y:.3125},{x:.4375,y:.3125},{x:.4375,y:.3125},{x:.4375,y:.3125},{x:.4375,y:.3125},{x:.5625,y:.3125},{x:.5625,y:.3125},{x:.5625,y:.3125},{x:.5625,y:.3125},{x:.5625,y:.3125},{x:.5625,y:.3125},{x:.6875,y:.3125},{x:.6875,y:.3125},{x:.6875,y:.3125},{x:.6875,y:.3125},{x:.6875,y:.3125},{x:.6875,y:.3125},{x:.8125,y:.3125},{x:.8125,y:.3125},{x:.8125,y:.3125},{x:.8125,y:.3125},{x:.8125,y:.3125},{x:.8125,y:.3125},{x:.9375,y:.3125},{x:.9375,y:.3125},{x:.9375,y:.3125},{x:.9375,y:.3125},{x:.9375,y:.3125},{x:.9375,y:.3125},{x:.0625,y:.4375},{x:.0625,y:.4375},{x:.0625,y:.4375},{x:.0625,y:.4375},{x:.0625,y:.4375},{x:.0625,y:.4375},{x:.1875,y:.4375},{x:.1875,y:.4375},{x:.1875,y:.4375},{x:.1875,y:.4375},{x:.1875,y:.4375},{x:.1875,y:.4375},{x:.3125,y:.4375},{x:.3125,y:.4375},{x:.3125,y:.4375},{x:.3125,y:.4375},{x:.3125,y:.4375},{x:.3125,y:.4375},{x:.4375,y:.4375},{x:.4375,y:.4375},{x:.4375,y:.4375},{x:.4375,y:.4375},{x:.4375,y:.4375},{x:.4375,y:.4375},{x:.5625,y:.4375},{x:.5625,y:.4375},{x:.5625,y:.4375},{x:.5625,y:.4375},{x:.5625,y:.4375},{x:.5625,y:.4375},{x:.6875,y:.4375},{x:.6875,y:.4375},{x:.6875,y:.4375},{x:.6875,y:.4375},{x:.6875,y:.4375},{x:.6875,y:.4375},{x:.8125,y:.4375},{x:.8125,y:.4375},{x:.8125,y:.4375},{x:.8125,y:.4375},{x:.8125,y:.4375},{x:.8125,y:.4375},{x:.9375,y:.4375},{x:.9375,y:.4375},{x:.9375,y:.4375},{x:.9375,y:.4375},{x:.9375,y:.4375},{x:.9375,y:.4375},{x:.0625,y:.5625},{x:.0625,y:.5625},{x:.0625,y:.5625},{x:.0625,y:.5625},{x:.0625,y:.5625},{x:.0625,y:.5625},{x:.1875,y:.5625},{x:.1875,y:.5625},{x:.1875,y:.5625},{x:.1875,y:.5625},{x:.1875,y:.5625},{x:.1875,y:.5625},{x:.3125,y:.5625},{x:.3125,y:.5625},{x:.3125,y:.5625},{x:.3125,y:.5625},{x:.3125,y:.5625},{x:.3125,y:.5625},{x:.4375,y:.5625},{x:.4375,y:.5625},{x:.4375,y:.5625},{x:.4375,y:.5625},{x:.4375,y:.5625},{x:.4375,y:.5625},{x:.5625,y:.5625},{x:.5625,y:.5625},{x:.5625,y:.5625},{x:.5625,y:.5625},{x:.5625,y:.5625},{x:.5625,y:.5625},{x:.6875,y:.5625},{x:.6875,y:.5625},{x:.6875,y:.5625},{x:.6875,y:.5625},{x:.6875,y:.5625},{x:.6875,y:.5625},{x:.8125,y:.5625},{x:.8125,y:.5625},{x:.8125,y:.5625},{x:.8125,y:.5625},{x:.8125,y:.5625},{x:.8125,y:.5625},{x:.9375,y:.5625},{x:.9375,y:.5625},{x:.9375,y:.5625},{x:.9375,y:.5625},{x:.9375,y:.5625},{x:.9375,y:.5625},{x:.0625,y:.6875},{x:.0625,y:.6875},{x:.0625,y:.6875},{x:.0625,y:.6875},{x:.0625,y:.6875},{x:.0625,y:.6875},{x:.1875,y:.6875},{x:.1875,y:.6875},{x:.1875,y:.6875},{x:.1875,y:.6875},{x:.1875,y:.6875},{x:.1875,y:.6875},{x:.3125,y:.6875},{x:.3125,y:.6875},{x:.3125,y:.6875},{x:.3125,y:.6875},{x:.3125,y:.6875},{x:.3125,y:.6875},{x:.4375,y:.6875},{x:.4375,y:.6875},{x:.4375,y:.6875},{x:.4375,y:.6875},{x:.4375,y:.6875},{x:.4375,y:.6875},{x:.5625,y:.6875},{x:.5625,y:.6875},{x:.5625,y:.6875},{x:.5625,y:.6875},{x:.5625,y:.6875},{x:.5625,y:.6875},{x:.6875,y:.6875},{x:.6875,y:.6875},{x:.6875,y:.6875},{x:.6875,y:.6875},{x:.6875,y:.6875},{x:.6875,y:.6875},{x:.8125,y:.6875},{x:.8125,y:.6875},{x:.8125,y:.6875},{x:.8125,y:.6875},{x:.8125,y:.6875},{x:.8125,y:.6875},{x:.9375,y:.6875},{x:.9375,y:.6875},{x:.9375,y:.6875},{x:.9375,y:.6875},{x:.9375,y:.6875},{x:.9375,y:.6875},{x:.0625,y:.8125},{x:.0625,y:.8125},{x:.0625,y:.8125},{x:.0625,y:.8125},{x:.0625,y:.8125},{x:.0625,y:.8125},{x:.1875,y:.8125},{x:.1875,y:.8125},{x:.1875,y:.8125},{x:.1875,y:.8125},{x:.1875,y:.8125},{x:.1875,y:.8125},{x:.3125,y:.8125},{x:.3125,y:.8125},{x:.3125,y:.8125},{x:.3125,y:.8125},{x:.3125,y:.8125},{x:.3125,y:.8125},{x:.4375,y:.8125},{x:.4375,y:.8125},{x:.4375,y:.8125},{x:.4375,y:.8125},{x:.4375,y:.8125},{x:.4375,y:.8125},{x:.5625,y:.8125},{x:.5625,y:.8125},{x:.5625,y:.8125},{x:.5625,y:.8125},{x:.5625,y:.8125},{x:.5625,y:.8125},{x:.6875,y:.8125},{x:.6875,y:.8125},{x:.6875,y:.8125},{x:.6875,y:.8125},{x:.6875,y:.8125},{x:.6875,y:.8125},{x:.8125,y:.8125},{x:.8125,y:.8125},{x:.8125,y:.8125},{x:.8125,y:.8125},{x:.8125,y:.8125},{x:.8125,y:.8125},{x:.9375,y:.8125},{x:.9375,y:.8125},{x:.9375,y:.8125},{x:.9375,y:.8125},{x:.9375,y:.8125},{x:.9375,y:.8125},{x:.0625,y:.9375},{x:.0625,y:.9375},{x:.0625,y:.9375},{x:.0625,y:.9375},{x:.0625,y:.9375},{x:.0625,y:.9375},{x:.1875,y:.9375},{x:.1875,y:.9375},{x:.1875,y:.9375},{x:.1875,y:.9375},{x:.1875,y:.9375},{x:.1875,y:.9375},{x:.3125,y:.9375},{x:.3125,y:.9375},{x:.3125,y:.9375},{x:.3125,y:.9375},{x:.3125,y:.9375},{x:.3125,y:.9375},{x:.4375,y:.9375},{x:.4375,y:.9375},{x:.4375,y:.9375},{x:.4375,y:.9375},{x:.4375,y:.9375},{x:.4375,y:.9375},{x:.5625,y:.9375},{x:.5625,y:.9375},{x:.5625,y:.9375},{x:.5625,y:.9375},{x:.5625,y:.9375},{x:.5625,y:.9375},{x:.6875,y:.9375},{x:.6875,y:.9375},{x:.6875,y:.9375},{x:.6875,y:.9375},{x:.6875,y:.9375},{x:.6875,y:.9375},{x:.8125,y:.9375},{x:.8125,y:.9375},{x:.8125,y:.9375},{x:.8125,y:.9375},{x:.8125,y:.9375},{x:.8125,y:.9375},{x:.9375,y:.9375},{x:.9375,y:.9375},{x:.9375,y:.9375},{x:.9375,y:.9375},{x:.9375,y:.9375},{x:.9375,y:.9375}];var Hb=class{constructor(t){var n;this.model=t,this.anchors=L$.map(r=>[r.x,r.y]),this.anchorsTensor=ra(this.anchors),this.inputSize=(n=this.model)==null?void 0:n.inputs[0].shape[2],this.inputSizeTensor=lr([this.inputSize,this.inputSize]),this.doubleInputSizeTensor=lr([this.inputSize*2,this.inputSize*2])}normalizeBoxes(t){return Ue(()=>{let n=Ze(t,[0,0],[-1,2]),r=Ze(t,[0,2],[-1,2]),s=Me(Qe(n,this.inputSizeTensor),this.anchorsTensor),a=Qe(r,this.doubleInputSizeTensor),o=fe(He(s,a),this.inputSizeTensor),i=fe(Me(s,a),this.inputSizeTensor);return lc([o,i],1)})}normalizeLandmarks(t,n){return Ue(()=>{let r=Me(Qe(t.reshape([-1,7,2]),this.inputSizeTensor),this.anchors[n]);return fe(r,this.inputSizeTensor)})}async getBoxes(t,n){let r=this.model.predict(t),s=Zn(r);r.dispose();let a=Ue(()=>Ts(Ze(s,[0,0],[-1,1])).squeeze()),o=a.dataSync(),i=Ze(s,[0,1],[-1,4]),l=this.normalizeBoxes(i);i.dispose();let u=await Ye.nonMaxSuppressionAsync(l,o,n.hand.maxDetected,n.hand.iouThreshold,n.hand.minConfidence),c=u.arraySync();a.dispose(),u.dispose();let d=[];for(let h of c)if(o[h]>=n.hand.minConfidence){let p=Ze(l,[h,0],[1,-1]),f=Ze(s,[h,5],[1,14]),m=Ue(()=>this.normalizeLandmarks(f,h).reshape([-1,2]));f.dispose(),d.push({box:p,palmLandmarks:m,confidence:o[h]})}return s.dispose(),l.dispose(),d}async estimateHandBounds(t,n){let r=t.shape[1],s=t.shape[2],a=Ue(()=>t.resizeBilinear([this.inputSize,this.inputSize]).div(127.5).sub(1)),o=await this.getBoxes(a,n);a.dispose();let i=[];if(!o||o.length===0)return i;for(let l of o){let u=l.box.dataSync(),c=u.slice(0,2),d=u.slice(2,4),h=l.palmLandmarks.arraySync();l.box.dispose(),l.palmLandmarks.dispose(),i.push(z$({startPoint:c,endPoint:d,palmLandmarks:h,confidence:l.confidence},[s/this.inputSize,r/this.inputSize]))}return i}};function Xve(e){return e-2*Math.PI*Math.floor((e+Math.PI)/(2*Math.PI))}function B$(e,t){let n=Math.PI/2-Math.atan2(-(t[1]-e[1]),t[0]-e[0]);return Xve(n)}var W$=(e,t)=>[[1,0,e],[0,1,t],[0,0,1]];function ro(e,t){let n=0;for(let r=0;ro[0]),r=t.map(o=>o[1]),s=[Math.min(...n),Math.min(...r)],a=[Math.max(...n),Math.max(...r)];return{startPoint:s,endPoint:a}}getBoxForPalmLandmarks(t,n){let r=t.map(a=>jb([...a,1],n)),s=this.calculateLandmarksBoundingBox(r);return f0(m0(s),Yve)}getBoxForHandLandmarks(t){let n=this.calculateLandmarksBoundingBox(t),r=f0(m0(n),H$);r.palmLandmarks=[];for(let s=0;s[o[0]*(p[0]-this.inputSize/2),o[1]*(p[1]-this.inputSize/2),o[2]*p[2]]),l=Gb(r,[0,0]),u=i.map(p=>[...jb(p,l),p[2]]),c=U$(s),d=[...Sh(n),1],h=[ro(d,c[0]),ro(d,c[1])];return u.map(p=>[Math.trunc(p[0]+h[0]),Math.trunc(p[1]+h[1]),Math.trunc(p[2])])}async estimateHands(t,n){let r=!1,s;(this.skipped===0||this.skipped>n.hand.skipFrames||!n.hand.landmarks||!n.skipFrame)&&(s=await this.handDetector.estimateHandBounds(t,n),this.skipped=0),n.skipFrame&&this.skipped++,s&&s.length>0&&(s.length!==this.detectedHands&&this.detectedHands!==n.hand.maxDetected||!n.hand.landmarks)&&(this.detectedHands=0,this.storedBoxes=[...s],this.storedBoxes.length>0&&(r=!0));let a=[];for(let o=0;o=n.hand.minConfidence){let x=ue(y,[-1,3]),b=x.arraySync();y.dispose(),x.dispose();let v=this.transformRawCoords(b,p,l,h),w=this.getBoxForHandLandmarks(v);this.storedBoxes[o]={...w,confidence:A};let I={landmarks:v,confidence:A,box:{topLeft:w.startPoint,bottomRight:w.endPoint}};a.push(I)}else this.storedBoxes[o]=null;y.dispose()}else{let l=f0(m0(i),H$),u={confidence:i.confidence,box:{topLeft:l.startPoint,bottomRight:l.endPoint}};a.push(u)}}return this.storedBoxes=this.storedBoxes.filter(o=>o!==null),this.detectedHands=a.length,a}};var j$={thumb:[1,2,3,4],indexFinger:[5,6,7,8],middleFinger:[9,10,11,12],ringFinger:[13,14,15,16],pinky:[17,18,19,20],palmBase:[0]},so,ao,q$;async function Kb(e,t){let n=await q$.estimateHands(e,t);if(!n)return[];let r=[];for(let s=0;sn[s].landmarks[c]);let o=n[s].landmarks,i=[Number.MAX_SAFE_INTEGER,Number.MAX_SAFE_INTEGER,0,0],l=[0,0,0,0];if(o&&o.length>0){for(let u of o)u[0]i[2]&&(i[2]=u[0]),u[1]>i[3]&&(i[3]=u[1]);i[2]-=i[0],i[3]-=i[1],l=[i[0]/(e.shape[2]||0),i[1]/(e.shape[1]||0),i[2]/(e.shape[2]||0),i[3]/(e.shape[1]||0)]}else i=n[s].box?[Math.trunc(Math.max(0,n[s].box.topLeft[0])),Math.trunc(Math.max(0,n[s].box.topLeft[1])),Math.trunc(Math.min(e.shape[2]||0,n[s].box.bottomRight[0])-Math.max(0,n[s].box.topLeft[0])),Math.trunc(Math.min(e.shape[1]||0,n[s].box.bottomRight[1])-Math.max(0,n[s].box.topLeft[1]))]:[0,0,0,0],l=[n[s].box.topLeft[0]/(e.shape[2]||0),n[s].box.topLeft[1]/(e.shape[1]||0),(n[s].box.bottomRight[0]-n[s].box.topLeft[0])/(e.shape[2]||0),(n[s].box.bottomRight[1]-n[s].box.topLeft[1])/(e.shape[1]||0)];r.push({id:s,score:Math.round(100*n[s].confidence)/100,box:i,boxRaw:l,keypoints:o,annotations:a})}return r}async function Xb(e){!so||!ao?([so,ao]=await Promise.all([e.hand.enabled?Et($t(e.modelBasePath,e.hand.detector.modelPath),{fromTFHub:e.hand.detector.modelPath.includes("tfhub.dev")}):null,e.hand.landmarks?Et($t(e.modelBasePath,e.hand.skeleton.modelPath),{fromTFHub:e.hand.skeleton.modelPath.includes("tfhub.dev")}):null]),e.hand.enabled&&(!so||!so.modelUrl?me("load model failed:",e.hand.detector.modelPath):e.debug&&me("load model:",so.modelUrl),!ao||!ao.modelUrl?me("load model failed:",e.hand.skeleton.modelPath):e.debug&&me("load model:",ao.modelUrl))):(e.debug&&me("cached model:",so.modelUrl),e.debug&&me("cached model:",ao.modelUrl));let t=new Hb(so);return q$=new qb(t,ao),[so,ao]}var K$=["nose","leftEyeInside","leftEye","leftEyeOutside","rightEyeInside","rightEye","rightEyeOutside","leftEar","rightEar","leftMouth","rightMouth","leftShoulder","rightShoulder","leftElbow","rightElbow","leftWrist","rightWrist","leftPalm","rightPalm","leftIndex","rightIndex","leftPinky","rightPinky","leftHip","rightHip","leftKnee","rightKnee","leftAnkle","rightAnkle","leftHeel","rightHeel","leftFoot","rightFoot","midHip","forehead","leftThumb","leftHand","rightThumb","rightHand"],X$=["nose","leftEyeInside","leftEye","leftEyeOutside","rightEyeInside","rightEye","rightEyeOutside","leftEar","rightEar","leftMouth","rightMouth","leftShoulder","rightShoulder","leftElbow","rightElbow","left:15","right:16","left:17","right:18","left:19","right:20","left:21","right:22","leftChest","rightChest","neck","forehead","left:27","right:28","left:29","right:30"];var nr;async function g0(e){return nr?e.debug&&me("cached model:",nr.modelUrl):(nr=await Et($t(e.modelBasePath,e.body.modelPath)),nr.width=parseInt(nr.signature.inputs["input_1:0"].tensorShape.dim[2].size),nr.height=parseInt(nr.signature.inputs["input_1:0"].tensorShape.dim[1].size),!nr||!nr.modelUrl?me("load model failed:",e.body.modelPath):e.debug&&me("load model:",nr.modelUrl)),nr}async function Zb(e,t){var m;if(!nr)return[];if(!t.body.enabled)return[];let n={width:e.shape[2]||0,height:e.shape[1]||0},r=Ye.resizeBilinear(e,[nr.width,nr.height],!1),s=Qe(r,[255]);r.dispose();let a=await nr.predict(s),o=((m=a.find(g=>g.size===195||g.size===155))==null?void 0:m.dataSync())||[];a.forEach(g=>g.dispose()),s.dispose();let i=[],l=(o==null?void 0:o.length)===195?K$:X$,u=5;for(let g=0;gg.position[0]),d=i.map(g=>g.position[1]),h=[Math.min(...c),Math.min(...d),Math.max(...c)-Math.min(...c),Math.max(...d)-Math.min(...c)],p=[0,0,0,0],f=i.reduce((g,y)=>y.score>g?y.score:g,0);return[{id:0,score:f,box:h,boxRaw:p,keypoints:i}]}var rr,Ws=[],Yb=[0,0,0,0],Jb=[0,0,0,0],y0=0,Qb=Number.MAX_SAFE_INTEGER,ewe=["head","neck","rightShoulder","rightElbow","rightWrist","chest","leftShoulder","leftElbow","leftWrist","pelvis","rightHip","rightKnee","rightAnkle","leftHip","leftKnee","leftAnkle"];async function Z$(e){return rr?e.debug&&me("cached model:",rr.modelUrl):(rr=await Et($t(e.modelBasePath,e.body.modelPath)),!rr||!rr.modelUrl?me("load model failed:",e.body.modelPath):e.debug&&me("load model:",rr.modelUrl)),rr}function twe(e,t){let[n,r]=e.shape;return Ue(()=>{let s=(i,l)=>He(i,fe(Qe(i,ut(l,"int32")),ut(l,"int32"))),a=ue(e,[r*n]),o=_a(a,0).dataSync()[0];if(o>t){let i=Z2(a,0),l=s(i,n).dataSync()[0],u=Qe(i,ut(n,"int32")).dataSync()[0];return[l,u,o]}return[0,0,o]})}async function e3(e,t){return Qb0?(Qb++,[{id:0,score:y0,box:Yb,boxRaw:Jb,keypoints:Ws}]):(Qb=0,new Promise(async n=>{let r=Ue(()=>{if(!rr.inputs[0].shape)return null;let u=Ye.resizeBilinear(e,[rr.inputs[0].shape[2],rr.inputs[0].shape[1]],!1);return fe(u,2).sub(1)}),s;if(t.body.enabled&&(s=await rr.predict(r)),r.dispose(),s){Ws.length=0;let u=s.squeeze();Ve(s);let c=u.unstack(2);Ve(u);for(let d=0;dt.body.minConfidence&&Ws.push({score:Math.round(100*f)/100,part:ewe[d],positionRaw:[h/rr.inputs[0].shape[2],p/rr.inputs[0].shape[1]],position:[Math.round(e.shape[2]*h/rr.inputs[0].shape[2]),Math.round(e.shape[1]*p/rr.inputs[0].shape[1])]})}c.forEach(d=>Ve(d))}y0=Ws.reduce((u,c)=>c.score>u?c.score:u,0);let a=Ws.map(u=>u.position[0]),o=Ws.map(u=>u.position[1]);Yb=[Math.min(...a),Math.min(...o),Math.max(...a)-Math.min(...a),Math.max(...o)-Math.min(...o)];let i=Ws.map(u=>u.positionRaw[0]),l=Ws.map(u=>u.positionRaw[1]);Jb=[Math.min(...i),Math.min(...l),Math.max(...i)-Math.min(...i),Math.max(...l)-Math.min(...l)],n([{id:0,score:y0,box:Yb,boxRaw:Jb,keypoints:Ws}])}))}var vs,Vs=[],t3=[0,0,0,0],n3=[0,0,0,0],_u=0,r3=Number.MAX_SAFE_INTEGER,nwe=["nose","leftEye","rightEye","leftEar","rightEar","leftShoulder","rightShoulder","leftElbow","rightElbow","leftWrist","rightWrist","leftHip","rightHip","leftKnee","rightKnee","leftAnkle","rightAnkle"];async function s3(e){return vs?e.debug&&me("cached model:",vs.modelUrl):(vs=await Et($t(e.modelBasePath,e.body.modelPath)),!vs||!vs.modelUrl?me("load model failed:",e.body.modelPath):e.debug&&me("load model:",vs.modelUrl)),vs}async function a3(e,t){return r30?(r3++,[{id:0,score:_u,box:t3,boxRaw:n3,keypoints:Vs}]):(r3=0,new Promise(async n=>{let r=Ue(()=>{if(!vs.inputs[0].shape)return null;let u=Ye.resizeBilinear(e,[vs.inputs[0].shape[2],vs.inputs[0].shape[1]],!1);return Pt(u,"int32")}),s;if(t.body.enabled&&(s=await vs.predict(r)),r.dispose(),s){Vs.length=0;let u=s.arraySync();Ve(s);let c=u[0][0];for(let d=0;dt.body.minConfidence&&Vs.push({score:Math.round(100*_u)/100,part:nwe[d],positionRaw:[c[d][1],c[d][0]],position:[Math.round((e.shape[2]||0)*c[d][1]),Math.round((e.shape[1]||0)*c[d][0])]})}_u=Vs.reduce((u,c)=>c.score>u?c.score:u,0);let a=Vs.map(u=>u.position[0]),o=Vs.map(u=>u.position[1]);t3=[Math.min(...a),Math.min(...o),Math.max(...a)-Math.min(...a),Math.max(...o)-Math.min(...o)];let i=Vs.map(u=>u.positionRaw[0]),l=Vs.map(u=>u.positionRaw[1]);n3=[Math.min(...i),Math.min(...l),Math.max(...i)-Math.min(...i),Math.max(...l)-Math.min(...l)],n([{id:0,score:_u,box:t3,boxRaw:n3,keypoints:Vs}])}))}var Ru=[{class:1,label:"person"},{class:2,label:"bicycle"},{class:3,label:"car"},{class:4,label:"motorcycle"},{class:5,label:"airplane"},{class:6,label:"bus"},{class:7,label:"train"},{class:8,label:"truck"},{class:9,label:"boat"},{class:10,label:"traffic light"},{class:11,label:"fire hydrant"},{class:12,label:"stop sign"},{class:13,label:"parking meter"},{class:14,label:"bench"},{class:15,label:"bird"},{class:16,label:"cat"},{class:17,label:"dog"},{class:18,label:"horse"},{class:19,label:"sheep"},{class:20,label:"cow"},{class:21,label:"elephant"},{class:22,label:"bear"},{class:23,label:"zebra"},{class:24,label:"giraffe"},{class:25,label:"backpack"},{class:26,label:"umbrella"},{class:27,label:"handbag"},{class:28,label:"tie"},{class:29,label:"suitcase"},{class:30,label:"frisbee"},{class:31,label:"skis"},{class:32,label:"snowboard"},{class:33,label:"sports ball"},{class:34,label:"kite"},{class:35,label:"baseball bat"},{class:36,label:"baseball glove"},{class:37,label:"skateboard"},{class:38,label:"surfboard"},{class:39,label:"tennis racket"},{class:40,label:"bottle"},{class:41,label:"wine glass"},{class:42,label:"cup"},{class:43,label:"fork"},{class:44,label:"knife"},{class:45,label:"spoon"},{class:46,label:"bowl"},{class:47,label:"banana"},{class:48,label:"apple"},{class:49,label:"sandwich"},{class:50,label:"orange"},{class:51,label:"broccoli"},{class:52,label:"carrot"},{class:53,label:"hot dog"},{class:54,label:"pizza"},{class:55,label:"donut"},{class:56,label:"cake"},{class:57,label:"chair"},{class:58,label:"couch"},{class:59,label:"potted plant"},{class:60,label:"bed"},{class:61,label:"dining table"},{class:62,label:"toilet"},{class:63,label:"tv"},{class:64,label:"laptop"},{class:65,label:"mouse"},{class:66,label:"remote"},{class:67,label:"keyboard"},{class:68,label:"cell phone"},{class:69,label:"microwave"},{class:70,label:"oven"},{class:71,label:"toaster"},{class:72,label:"sink"},{class:73,label:"refrigerator"},{class:74,label:"book"},{class:75,label:"clock"},{class:76,label:"vase"},{class:77,label:"scissors"},{class:78,label:"teddy bear"},{class:79,label:"hair drier"},{class:80,label:"toothbrush"}];var Ar,o3=[],i3=Number.MAX_SAFE_INTEGER,A0=2.5;async function l3(e){if(Ar)e.debug&&me("cached model:",Ar.modelUrl);else{Ar=await Et($t(e.modelBasePath,e.object.modelPath));let t=Object.values(Ar.modelSignature.inputs);if(Ar.inputSize=Array.isArray(t)?parseInt(t[0].tensorShape.dim[2].size):null,!Ar.inputSize)throw new Error(`Human: Cannot determine model inputSize: ${e.object.modelPath}`);!Ar||!Ar.modelUrl?me("load model failed:",e.object.modelPath):e.debug&&me("load model:",Ar.modelUrl)}return Ar}async function rwe(e,t,n,r){let s=0,a=[];for(let u of[1,2,4])Ue(()=>{var g,y;let c=u*13,d=(g=e.find(A=>A.shape[1]===c**2&&A.shape[2]===Ru.length))==null?void 0:g.squeeze(),h=(y=e.find(A=>A.shape[1]===c**2&&A.shape[2]r.object.minConfidence&&x!==61){let v=(.5+Math.trunc(A%c))/c,w=(.5+Math.trunc(A/c))/c,I=f[A].map(B=>B*(c/u/t)),[T,C]=[v-A0/u*I[0],w-A0/u*I[1]],[M,$]=[v+A0/u*I[2]-T,w+A0/u*I[3]-C],R=[T,C,M,$];R=R.map(B=>Math.max(0,Math.min(B,1)));let N=[R[0]*n[0],R[1]*n[1],R[2]*n[0],R[3]*n[1]],F={id:s++,score:Math.round(100*b)/100,class:x+1,label:Ru[x].label,box:N.map(B=>Math.trunc(B)),boxRaw:R};a.push(F)}}});e.forEach(u=>Ve(u));let o=a.map(u=>[u.boxRaw[1],u.boxRaw[0],u.boxRaw[3],u.boxRaw[2]]),i=a.map(u=>u.score),l=[];if(o&&o.length>0){let u=await Ye.nonMaxSuppressionAsync(o,i,r.object.maxDetected,r.object.iouThreshold,r.object.minConfidence);l=u.dataSync(),Ve(u)}return a=a.filter((u,c)=>l.includes(c)).sort((u,c)=>c.score-u.score),a}async function u3(e,t){return i30?(i3++,o3):(i3=0,new Promise(async n=>{let r=[e.shape[2],e.shape[1]],s=Ye.resizeBilinear(e,[Ar.inputSize,Ar.inputSize],!1),a=s.div(255),o=a.transpose([0,3,1,2]);a.dispose(),s.dispose();let i;t.object.enabled&&(i=await Ar.predict(o)),o.dispose();let l=await rwe(i,Ar.inputSize,r,t);o3=l,n(l)}))}var xr,c3=[],d3=Number.MAX_SAFE_INTEGER;async function h3(e){if(xr)e.debug&&me("cached model:",xr.modelUrl);else{xr=await Et($t(e.modelBasePath,e.object.modelPath));let t=Object.values(xr.modelSignature.inputs);if(xr.inputSize=Array.isArray(t)?parseInt(t[0].tensorShape.dim[2].size):null,!xr.inputSize)throw new Error(`Human: Cannot determine model inputSize: ${e.object.modelPath}`);!xr||!xr.modelUrl?me("load model failed:",e.object.modelPath):e.debug&&me("load model:",xr.modelUrl)}return xr}async function swe(e,t,n,r){if(!e)return[];let s=[],a=e.arraySync(),o=Zn(e);e.dispose();let i=ta(o,6,1);o.dispose();let u=So([i[1],i[0],i[3],i[2]],1).squeeze(),c=i[4].squeeze(),d=i[5].squeeze();i.forEach(m=>m.dispose());let h=await Ye.nonMaxSuppressionAsync(u,c,r.object.maxDetected,r.object.iouThreshold,r.object.minConfidence);u.dispose(),c.dispose(),d.dispose();let p=h.dataSync();h.dispose();let f=0;for(let m of p){let g=Math.trunc(100*a[0][m][4])/100,y=a[0][m][5],A=Ru[y].label,x=[a[0][m][0]/t,a[0][m][1]/t,a[0][m][2]/t,a[0][m][3]/t],b=[Math.trunc(x[0]*n[0]),Math.trunc(x[1]*n[1]),Math.trunc(x[2]*n[0]),Math.trunc(x[3]*n[1])];s.push({id:f++,score:g,class:y,label:A,box:b,boxRaw:x})}return s}async function p3(e,t){return d30?(d3++,c3):(d3=0,new Promise(async n=>{let r=[e.shape[2],e.shape[1]],s=Ye.resizeBilinear(e,[xr.inputSize,xr.inputSize]),a=t.object.enabled?xr.execute(s,["tower_0/detections"]):null;s.dispose();let o=await swe(a,xr.inputSize,r,t);c3=o,n(o)}))}var Y$=e=>{if(!e)return[];let t=[];for(let n=0;nl.part==="leftWrist"),s=e[n].keypoints.find(l=>l.part==="rightWrist"),a=e[n].keypoints.find(l=>l.part==="nose");a&&r&&s&&r.position.yl.part==="leftShoulder"),i=e[n].keypoints.find(l=>l.part==="rightShoulder");o&&i&&t.push({body:n,gesture:`leaning ${o.position.y>i.position.y?"left":"right"}`})}return t},J$=e=>{if(!e)return[];let t=[];for(let n=0;n0){let r=e[n].mesh[33][2]-e[n].mesh[263][2];Math.abs(r)<10?t.push({face:n,gesture:"facing center"}):t.push({face:n,gesture:`facing ${r<0?"left":"right"}`}),Math.abs(e[n].mesh[374][1]-e[n].mesh[386][1])/Math.abs(e[n].mesh[443][1]-e[n].mesh[450][1])<.2&&t.push({face:n,gesture:"blink left eye"}),Math.abs(e[n].mesh[145][1]-e[n].mesh[159][1])/Math.abs(e[n].mesh[223][1]-e[n].mesh[230][1])<.2&&t.push({face:n,gesture:"blink right eye"});let o=Math.min(100,500*Math.abs(e[n].mesh[13][1]-e[n].mesh[14][1])/Math.abs(e[n].mesh[10][1]-e[n].mesh[152][1]));o>10&&t.push({face:n,gesture:`mouth ${Math.trunc(o)}% open`});let i=e[n].mesh[152][2];Math.abs(i)>10&&t.push({face:n,gesture:`head ${i<0?"up":"down"}`})}return t},Q$=e=>{if(!e)return[];let t=[];for(let n=0;n.06||d>.06)&&(u=!1),h>.06&&t.push({iris:n,gesture:"looking right"}),d>.06&&t.push({iris:n,gesture:"looking left"});let p=Math.abs(e[n].mesh[145][1]-e[n].annotations.rightEyeIris[0][1])/e[n].box[3],f=Math.abs(e[n].mesh[374][1]-e[n].annotations.leftEyeIris[0][1])/e[n].box[3];(f<.01||p<.01||f>.022||p>.022)&&(u=!1),(f<.01||p<.01)&&t.push({iris:n,gesture:"looking down"}),(f>.022||p>.022)&&t.push({iris:n,gesture:"looking up"}),u&&t.push({iris:n,gesture:"looking center"})}return t},e_=e=>{if(!e)return[];let t=[];for(let n=0;n0){let s=r.reduce((o,i)=>o.position[2]o.position[1](u[h]=0,d))},s=function(i,l){let u=e.createShader(l);if(e.shaderSource(u,i),e.compileShader(u),!e.getShaderParameter(u,e.COMPILE_STATUS))throw new Error("Filter: GL compile failed",e.getShaderInfoLog(u));return u};this.uniform={},this.attribute={};let a=s(t,e.VERTEX_SHADER),o=s(n,e.FRAGMENT_SHADER);if(this.id=e.createProgram(),e.attachShader(this.id,a),e.attachShader(this.id,o),e.linkProgram(this.id),!e.getProgramParameter(this.id,e.LINK_STATUS))throw new Error("Filter: GL link failed",e.getProgramInfoLog(this.id));e.useProgram(this.id),r(t,"attribute",this.attribute);for(let i in this.attribute)this.attribute[i]=e.getAttribLocation(this.id,i);r(t,"uniform",this.uniform),r(n,"uniform",this.uniform);for(let i in this.uniform)this.uniform[i]=e.getUniformLocation(this.id,i)}function t_(e){e||(e={});let t=0,n=null,r=!1,s=-1,a=[null,null],o=[],i=-1,l=-1,u=null,c=null,d={},h=e.canvas||document.createElement("canvas"),p={},f={INTERMEDIATE:1},m=h.getContext("webgl");if(!m)throw new Error("Filter: getContext() failed");this.addFilter=function(v){let w=Array.prototype.slice.call(arguments,1),I=d[v];o.push({func:I,args:w})},this.reset=function(){o=[]};let g=function(v,w){if(!(v===i&&w===l)){if(h.width=v,i=v,h.height=w,l=w,!u){let I=new Float32Array([-1,-1,0,1,1,-1,1,1,-1,1,0,0,-1,1,0,0,1,-1,1,1,1,1,1,0]);u=m.createBuffer(),m.bindBuffer(m.ARRAY_BUFFER,u),m.bufferData(m.ARRAY_BUFFER,I,m.STATIC_DRAW),m.pixelStorei(m.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!0)}m.viewport(0,0,i,l),a=[null,null]}},y=function(v,w){let I=m.createFramebuffer();m.bindFramebuffer(m.FRAMEBUFFER,I);let T=m.createRenderbuffer();m.bindRenderbuffer(m.RENDERBUFFER,T);let C=m.createTexture();return m.bindTexture(m.TEXTURE_2D,C),m.texImage2D(m.TEXTURE_2D,0,m.RGBA,v,w,0,m.RGBA,m.UNSIGNED_BYTE,null),m.texParameteri(m.TEXTURE_2D,m.TEXTURE_MAG_FILTER,m.LINEAR),m.texParameteri(m.TEXTURE_2D,m.TEXTURE_MIN_FILTER,m.LINEAR),m.texParameteri(m.TEXTURE_2D,m.TEXTURE_WRAP_S,m.CLAMP_TO_EDGE),m.texParameteri(m.TEXTURE_2D,m.TEXTURE_WRAP_T,m.CLAMP_TO_EDGE),m.framebufferTexture2D(m.FRAMEBUFFER,m.COLOR_ATTACHMENT0,m.TEXTURE_2D,C,0),m.bindTexture(m.TEXTURE_2D,null),m.bindFramebuffer(m.FRAMEBUFFER,null),{fbo:I,texture:C}},A=function(v){return a[v]=a[v]||y(i,l),a[v]},x=function(v=null){var C,M;let w=null,I=null,T=!1;t===0?w=n:w=(C=A(s))==null?void 0:C.texture,t++,r&&!(v&f.INTERMEDIATE)?(I=null,T=t%2==0):(s=(s+1)%2,I=(M=A(s))==null?void 0:M.fbo),m.bindTexture(m.TEXTURE_2D,w),m.bindFramebuffer(m.FRAMEBUFFER,I),m.uniform1f(c.uniform.flipY,T?-1:1),m.drawArrays(m.TRIANGLES,0,6)};this.apply=function(v){if(g(v.width,v.height),t=0,n||(n=m.createTexture()),m.bindTexture(m.TEXTURE_2D,n),m.texParameteri(m.TEXTURE_2D,m.TEXTURE_WRAP_S,m.CLAMP_TO_EDGE),m.texParameteri(m.TEXTURE_2D,m.TEXTURE_WRAP_T,m.CLAMP_TO_EDGE),m.texParameteri(m.TEXTURE_2D,m.TEXTURE_MIN_FILTER,m.NEAREST),m.texParameteri(m.TEXTURE_2D,m.TEXTURE_MAG_FILTER,m.NEAREST),m.texImage2D(m.TEXTURE_2D,0,m.RGBA,m.RGBA,m.UNSIGNED_BYTE,v),o.length===0)return x(),h;for(let w=0;w0,s=e.naturalHeight||e.videoHeight||e.height||e.shape&&e.shape[2]>0;if(!r||!s)return{tensor:null,canvas:_e};let i=r,o=s;if(i>Am&&(i=Am,o=i*s/r),o>Am&&(o=Am,i=o*r/s),t.filter.width>0?i=t.filter.width:t.filter.height>0&&(i=r*(t.filter.height/s)),t.filter.height>0?o=t.filter.height:t.filter.width>0&&(o=s*(t.filter.width/r)),!i||!o)throw new Error("Human: Input cannot determine dimension");(!_e||(_e==null?void 0:_e.width)!==i||(_e==null?void 0:_e.height)!==o)&&(_e=typeof OffscreenCanvas!="undefined"?new OffscreenCanvas(i,o):document.createElement("canvas"),(_e==null?void 0:_e.width)!==i&&(_e.width=i),(_e==null?void 0:_e.height)!==o&&(_e.height=o));let l=_e.getContext("2d");if(e instanceof ImageData?l.putImageData(e,0,0):t.filter.flip&&typeof l.translate!="undefined"?(l.translate(r,0),l.scale(-1,1),l.drawImage(e,0,0,r,s,0,0,_e==null?void 0:_e.width,_e==null?void 0:_e.height),l.setTransform(1,0,0,1,0,0)):l.drawImage(e,0,0,r,s,0,0,_e==null?void 0:_e.width,_e==null?void 0:_e.height),t.filter.enabled){if((!an||!Wt||_e.width!==Wt.width||(_e==null?void 0:_e.height)!==(Wt==null?void 0:Wt.height))&&(Wt=typeof OffscreenCanvas!="undefined"?new OffscreenCanvas(_e==null?void 0:_e.width,_e==null?void 0:_e.height):document.createElement("canvas"),(Wt==null?void 0:Wt.width)!==(_e==null?void 0:_e.width)&&(Wt.width=_e==null?void 0:_e.width),(Wt==null?void 0:Wt.height)!==(_e==null?void 0:_e.height)&&(Wt.height=_e==null?void 0:_e.height),an=ka.flags.IS_BROWSER?new t$({canvas:Wt}):null),!an)return{tensor:null,canvas:_e};an.reset(),an.addFilter("brightness",t.filter.brightness),t.filter.contrast!==0&&an.addFilter("contrast",t.filter.contrast),t.filter.sharpness!==0&&an.addFilter("sharpen",t.filter.sharpness),t.filter.blur!==0&&an.addFilter("blur",t.filter.blur),t.filter.saturation!==0&&an.addFilter("saturation",t.filter.saturation),t.filter.hue!==0&&an.addFilter("hue",t.filter.hue),t.filter.negative&&an.addFilter("negative"),t.filter.sepia&&an.addFilter("sepia"),t.filter.vintage&&an.addFilter("brownie"),t.filter.sepia&&an.addFilter("sepia"),t.filter.kodachrome&&an.addFilter("kodachrome"),t.filter.technicolor&&an.addFilter("technicolor"),t.filter.polaroid&&an.addFilter("polaroid"),t.filter.pixelate!==0&&an.addFilter("pixelate",t.filter.pixelate),an.apply(_e)}else Wt=_e,an&&(an=null);let u;if(Wt.data){let d=[Wt.height,Wt.width,3];u=mc(Wt.data,d,"int32")}else if(Wt instanceof ImageData)u=Ua?Ua.fromPixels(Wt):null;else if(t.backend==="webgl"||t.backend==="humangl"){let d=typeof OffscreenCanvas!="undefined"?new OffscreenCanvas(i,o):document.createElement("canvas");d.width=i,d.height=o;let h=d.getContext("2d");h==null||h.drawImage(Wt,0,0),u=Ua?Ua.fromPixels(d):null}else{let d=typeof OffscreenCanvas!="undefined"?new OffscreenCanvas(i,o):document.createElement("canvas");d.width=i,d.height=o;let h=d.getContext("2d");h==null||h.drawImage(Wt,0,0);let p=h==null?void 0:h.getImageData(0,0,i,o);u=Ua?Ua.fromPixels(p):null}if(u){let d=u.toFloat();n=d.expandDims(0),u.dispose(),d.dispose()}}let a=t.filter.return?Wt:null;return{tensor:n,canvas:a}}var g3={};$3(g3,{all:()=>lwe,body:()=>r$,canvas:()=>owe,face:()=>a$,gesture:()=>n$,hand:()=>s$,object:()=>i$,options:()=>ii,person:()=>iwe});var ii={color:"rgba(173, 216, 230, 0.6)",labelColor:"rgba(173, 216, 230, 1)",shadowColor:"black",font:'small-caps 14px "Segoe UI"',lineHeight:24,lineWidth:6,pointSize:2,roundRect:28,drawPoints:!1,drawLabels:!0,drawBoxes:!0,drawPolygons:!0,drawGaze:!0,fillPolygons:!1,useDepth:!0,useCurves:!1,bufferedOutput:!0},xm=e=>Math.round(e*180/Math.PI);function f3(e,t,n,a=0,r){e.fillStyle=r.useDepth&&a?`rgba(${127.5+2*a}, ${127.5-2*a}, 255, 0.3)`:r.color,e.beginPath(),e.arc(t,n,r.pointSize,0,2*Math.PI),e.fill()}function Np(e,t,n,a,r,s){if(e.beginPath(),s.useCurves){let i=(t+t+a)/2,o=(n+n+r)/2;e.ellipse(i,o,a/2,r/2,0,0,2*Math.PI)}else e.lineWidth=s.lineWidth,e.moveTo(t+s.roundRect,n),e.lineTo(t+a-s.roundRect,n),e.quadraticCurveTo(t+a,n,t+a,n+s.roundRect),e.lineTo(t+a,n+r-s.roundRect),e.quadraticCurveTo(t+a,n+r,t+a-s.roundRect,n+r),e.lineTo(t+s.roundRect,n+r),e.quadraticCurveTo(t,n+r,t,n+r-s.roundRect),e.lineTo(t,n+s.roundRect),e.quadraticCurveTo(t,n,t+s.roundRect,n),e.closePath();e.stroke()}function m3(e,t=[],n){if(!(t===void 0||t.length===0)){e.beginPath(),e.moveTo(t[0][0],t[0][1]);for(let a of t){let r=a[2]||0;e.strokeStyle=n.useDepth&&r?`rgba(${127.5+2*r}, ${127.5-2*r}, 255, 0.3)`:n.color,e.fillStyle=n.useDepth&&r?`rgba(${127.5+2*r}, ${127.5-2*r}, 255, 0.3)`:n.color,e.lineTo(a[0],Math.round(a[1]))}e.stroke(),n.fillPolygons&&(e.closePath(),e.fill())}}function Tp(e,t=[],n){if(!(t===void 0||t.length===0)){if(!n.useCurves||t.length<=2){m3(e,t,n);return}e.moveTo(t[0][0],t[0][1]);for(let a=0;a1&&l[1].length>0){let u=o[1]>0?`#${o[1]}`:"",d=`${o[0]} ${u}: ${l[1]}`;a.shadowColor&&a.shadowColor!==""&&(r.fillStyle=a.shadowColor,r.fillText(d,8,2+s*a.lineHeight)),r.fillStyle=a.labelColor,r.fillText(d,6,0+s*a.lineHeight),s+=1}}}async function a$(e,t,n){var s,i,o,l;let a=ia(ii,n);if(!t||!e||!(e instanceof HTMLCanvasElement))return;let r=e.getContext("2d");if(!!r)for(let u of t){r.font=a.font,r.strokeStyle=a.color,r.fillStyle=a.color,a.drawBoxes&&Np(r,u.box[0],u.box[1],u.box[2],u.box[3],a);let d=[];if(d.push(`face: ${Math.trunc(100*u.score)}%`),u.genderScore&&d.push(`${u.gender||""} ${Math.trunc(100*u.genderScore)}%`),u.age&&d.push(`age: ${u.age||""}`),u.iris&&d.push(`distance: ${u.iris}`),u.emotion&&u.emotion.length>0){let h=u.emotion.map(p=>`${Math.trunc(100*p.score)}% ${p.emotion}`);h.length>3&&(h.length=3),d.push(h.join(" "))}u.rotation&&u.rotation.angle&&u.rotation.gaze&&(u.rotation.angle.roll&&d.push(`roll: ${xm(u.rotation.angle.roll)}\xB0 yaw:${xm(u.rotation.angle.yaw)}\xB0 pitch:${xm(u.rotation.angle.pitch)}\xB0`),u.rotation.gaze.bearing&&d.push(`gaze: ${xm(u.rotation.gaze.bearing)}\xB0`)),d.length===0&&d.push("face"),r.fillStyle=a.color;for(let h=d.length-1;h>=0;h--){let p=Math.max(u.box[0],0),c=h*a.lineHeight+u.box[1];a.shadowColor&&a.shadowColor!==""&&(r.fillStyle=a.shadowColor,r.fillText(d[h],p+5,c+16)),r.fillStyle=a.labelColor,r.fillText(d[h],p+4,c+15)}if(r.lineWidth=1,u.mesh&&u.mesh.length>0){if(a.drawPoints)for(let h of u.mesh)f3(r,h[0],h[1],h[2],a);if(a.drawPolygons){r.lineWidth=1;for(let h=0;hu.mesh[c]);m3(r,p,a)}if(u.annotations&&u.annotations.leftEyeIris){r.strokeStyle=a.useDepth?"rgba(255, 200, 255, 0.3)":a.color,r.beginPath();let h=Math.abs(u.annotations.leftEyeIris[3][0]-u.annotations.leftEyeIris[1][0])/2,p=Math.abs(u.annotations.leftEyeIris[4][1]-u.annotations.leftEyeIris[2][1])/2;r.ellipse(u.annotations.leftEyeIris[0][0],u.annotations.leftEyeIris[0][1],h,p,0,0,2*Math.PI),r.stroke(),a.fillPolygons&&(r.fillStyle=a.useDepth?"rgba(255, 255, 200, 0.3)":a.color,r.fill())}if(u.annotations&&u.annotations.rightEyeIris){r.strokeStyle=a.useDepth?"rgba(255, 200, 255, 0.3)":a.color,r.beginPath();let h=Math.abs(u.annotations.rightEyeIris[3][0]-u.annotations.rightEyeIris[1][0])/2,p=Math.abs(u.annotations.rightEyeIris[4][1]-u.annotations.rightEyeIris[2][1])/2;r.ellipse(u.annotations.rightEyeIris[0][0],u.annotations.rightEyeIris[0][1],h,p,0,0,2*Math.PI),r.stroke(),a.fillPolygons&&(r.fillStyle=a.useDepth?"rgba(255, 255, 200, 0.3)":a.color,r.fill())}if(a.drawGaze&&((i=(s=u.rotation)==null?void 0:s.gaze)==null?void 0:i.strength)&&((l=(o=u.rotation)==null?void 0:o.gaze)==null?void 0:l.bearing)&&u.annotations.leftEyeIris&&u.annotations.rightEyeIris&&u.annotations.leftEyeIris[0]&&u.annotations.rightEyeIris[0]){r.strokeStyle="pink",r.beginPath();let h=[u.annotations.leftEyeIris[0][0]+Math.sin(u.rotation.gaze.bearing)*u.rotation.gaze.strength*u.box[3],u.annotations.leftEyeIris[0][1]+Math.cos(u.rotation.gaze.bearing)*u.rotation.gaze.strength*u.box[2]];r.moveTo(u.annotations.leftEyeIris[0][0],u.annotations.leftEyeIris[0][1]),r.lineTo(h[0],h[1]);let p=[u.annotations.rightEyeIris[0][0]+Math.sin(u.rotation.gaze.bearing)*u.rotation.gaze.strength*u.box[3],u.annotations.rightEyeIris[0][1]+Math.cos(u.rotation.gaze.bearing)*u.rotation.gaze.strength*u.box[2]];r.moveTo(u.annotations.rightEyeIris[0][0],u.annotations.rightEyeIris[0][1]),r.lineTo(p[0],p[1]),r.stroke()}}}}}async function r$(e,t,n){var s;let a=ia(ii,n);if(!t||!e||!(e instanceof HTMLCanvasElement))return;let r=e.getContext("2d");if(!!r){r.lineJoin="round";for(let i=0;iu.part==="leftShoulder"),o&&l.push([o.position[0],o.position[1]]),o=t[i].keypoints.find(u=>u.part==="rightShoulder"),o&&l.push([o.position[0],o.position[1]]),Tp(r,l,a),l.length=0,o=t[i].keypoints.find(u=>u.part==="rightShoulder"),o&&l.push([o.position[0],o.position[1]]),o=t[i].keypoints.find(u=>u.part==="rightHip"),o&&l.push([o.position[0],o.position[1]]),o=t[i].keypoints.find(u=>u.part==="leftHip"),o&&l.push([o.position[0],o.position[1]]),o=t[i].keypoints.find(u=>u.part==="leftShoulder"),o&&l.push([o.position[0],o.position[1]]),l.length===4&&m3(r,l,a),l.length=0,o=t[i].keypoints.find(u=>u.part==="leftHip"),o&&l.push([o.position[0],o.position[1]]),o=t[i].keypoints.find(u=>u.part==="leftKnee"),o&&l.push([o.position[0],o.position[1]]),o=t[i].keypoints.find(u=>u.part==="leftAnkle"),o&&l.push([o.position[0],o.position[1]]),o=t[i].keypoints.find(u=>u.part==="leftHeel"),o&&l.push([o.position[0],o.position[1]]),o=t[i].keypoints.find(u=>u.part==="leftFoot"),o&&l.push([o.position[0],o.position[1]]),Tp(r,l,a),l.length=0,o=t[i].keypoints.find(u=>u.part==="rightHip"),o&&l.push([o.position[0],o.position[1]]),o=t[i].keypoints.find(u=>u.part==="rightKnee"),o&&l.push([o.position[0],o.position[1]]),o=t[i].keypoints.find(u=>u.part==="rightAnkle"),o&&l.push([o.position[0],o.position[1]]),o=t[i].keypoints.find(u=>u.part==="rightHeel"),o&&l.push([o.position[0],o.position[1]]),o=t[i].keypoints.find(u=>u.part==="rightFoot"),o&&l.push([o.position[0],o.position[1]]),Tp(r,l,a),l.length=0,o=t[i].keypoints.find(u=>u.part==="leftShoulder"),o&&l.push([o.position[0],o.position[1]]),o=t[i].keypoints.find(u=>u.part==="leftElbow"),o&&l.push([o.position[0],o.position[1]]),o=t[i].keypoints.find(u=>u.part==="leftWrist"),o&&l.push([o.position[0],o.position[1]]),o=t[i].keypoints.find(u=>u.part==="leftPalm"),o&&l.push([o.position[0],o.position[1]]),Tp(r,l,a),l.length=0,o=t[i].keypoints.find(u=>u.part==="rightShoulder"),o&&l.push([o.position[0],o.position[1]]),o=t[i].keypoints.find(u=>u.part==="rightElbow"),o&&l.push([o.position[0],o.position[1]]),o=t[i].keypoints.find(u=>u.part==="rightWrist"),o&&l.push([o.position[0],o.position[1]]),o=t[i].keypoints.find(u=>u.part==="rightPalm"),o&&l.push([o.position[0],o.position[1]]),Tp(r,l,a)}}}}async function s$(e,t,n){let a=ia(ii,n);if(!t||!e||!(e instanceof HTMLCanvasElement))return;let r=e.getContext("2d");if(!!r){r.lineJoin="round",r.font=a.font;for(let s of t){if(a.drawBoxes&&(r.strokeStyle=a.color,r.fillStyle=a.color,Np(r,s.box[0],s.box[1],s.box[2],s.box[3],a),a.drawLabels&&(a.shadowColor&&a.shadowColor!==""&&(r.fillStyle=a.shadowColor,r.fillText("hand",s.box[0]+3,1+s.box[1]+a.lineHeight,s.box[2])),r.fillStyle=a.labelColor,r.fillText("hand",s.box[0]+2,0+s.box[1]+a.lineHeight,s.box[2])),r.stroke()),a.drawPoints&&s.keypoints&&s.keypoints.length>0)for(let i of s.keypoints)r.fillStyle=a.useDepth?`rgba(${127.5+2*i[2]}, ${127.5-2*i[2]}, 255, 0.5)`:a.color,f3(r,i[0],i[1],0,a);if(a.drawLabels){let i=(o,l)=>{r.fillStyle=a.useDepth?`rgba(${127.5+2*o[o.length-1][2]}, ${127.5-2*o[o.length-1][2]}, 255, 0.5)`:a.color,r.fillText(l,o[o.length-1][0]+4,o[o.length-1][1]+4)};r.font=a.font,i(s.annotations.indexFinger,"index"),i(s.annotations.middleFinger,"middle"),i(s.annotations.ringFinger,"ring"),i(s.annotations.pinky,"pinky"),i(s.annotations.thumb,"thumb"),i(s.annotations.palmBase,"palm")}if(a.drawPolygons){let i=o=>{if(!!o)for(let l=0;l0?l-1:0][0],o[l>0?l-1:0][1]),r.lineTo(o[l][0],o[l][1]),r.stroke()};r.lineWidth=a.lineWidth,i(s.annotations.indexFinger),i(s.annotations.middleFinger),i(s.annotations.ringFinger),i(s.annotations.pinky),i(s.annotations.thumb)}}}}async function i$(e,t,n){let a=ia(ii,n);if(!t||!e||!(e instanceof HTMLCanvasElement))return;let r=e.getContext("2d");if(!!r){r.lineJoin="round",r.font=a.font;for(let s of t)if(a.drawBoxes){if(r.strokeStyle=a.color,r.fillStyle=a.color,Np(r,s.box[0],s.box[1],s.box[2],s.box[3],a),a.drawLabels){let i=`${Math.round(100*s.score)}% ${s.label}`;a.shadowColor&&a.shadowColor!==""&&(r.fillStyle=a.shadowColor,r.fillText(i,s.box[0]+3,1+s.box[1]+a.lineHeight,s.box[2])),r.fillStyle=a.labelColor,r.fillText(i,s.box[0]+2,0+s.box[1]+a.lineHeight,s.box[2])}r.stroke()}}}async function iwe(e,t,n){let a=ia(ii,n);if(!t||!e||!(e instanceof HTMLCanvasElement))return;let r=e.getContext("2d");if(!!r){r.lineJoin="round",r.font=a.font;for(let s=0;s_.box[0]&&I.box[0]<_.box[0]+_.box[2]&&I.box[1]+I.box[3]>_.box[1]&&I.box[1]+I.box[3]<_.box[1]+_.box[3]&&(T.body=_);if(T.body)for(let _ of n)_.box[0]+_.box[2]>T.body.box[0]&&_.box[0]+_.box[2]T.body.box[1]&&_.box[1]+_.box[3]T.body.box[0]&&_.box[1]+_.box[3]>T.body.box[1]&&_.box[1]+_.box[3]{_&&_.length===4&&(C.push(_[0],_[0]+_[2]),z.push(_[1],_[1]+_[3]))};$((y=T.face)==null?void 0:y.box),$((A=T.body)==null?void 0:A.box),$((v=(x=T.hands)==null?void 0:x.left)==null?void 0:v.box),$((w=(b=T.hands)==null?void 0:b.right)==null?void 0:w.box);let S=Math.min(...C),D=Math.min(...z);T.box=[S,D,Math.max(...C)-S,Math.max(...z)-D],r&&r.length===4&&(T.boxRaw=[T.box[0]/r[2],T.box[1]/r[1],T.box[2]/r[2],T.box[3]/r[1]]),i.push(T)}return i}var Le={face:[],body:[],hand:[],gesture:[],object:[],persons:[],performance:{},timestamp:0};function l$(e){var r,s,i,o,l,u,d,h,p,c,m,f,g,y,A,x,v,b,w,I,T;let t=Date.now()-e.timestamp,n=t<1e3?8-Math.log(t):1;if(Le.canvas=e.canvas,!Le.body||e.body.length!==Le.body.length)Le.body=JSON.parse(JSON.stringify(e.body));else for(let C=0;C((n-1)*Le.body[C].box[_]+D)/n),$=e.body[C].boxRaw.map((D,_)=>((n-1)*Le.body[C].boxRaw[_]+D)/n),S=e.body[C].keypoints.map((D,_)=>({score:D.score,part:D.part,position:[Le.body[C].keypoints[_]?((n-1)*Le.body[C].keypoints[_].position[0]+D.position[0])/n:D.position[0],Le.body[C].keypoints[_]?((n-1)*Le.body[C].keypoints[_].position[1]+D.position[1])/n:D.position[1]],positionRaw:[Le.body[C].keypoints[_]?((n-1)*Le.body[C].keypoints[_].positionRaw[0]+D.positionRaw[0])/n:D.position[0],Le.body[C].keypoints[_]?((n-1)*Le.body[C].keypoints[_].positionRaw[1]+D.positionRaw[1])/n:D.position[1]]}));Le.body[C]={...e.body[C],box:z,boxRaw:$,keypoints:S}}if(!Le.hand||e.hand.length!==Le.hand.length)Le.hand=JSON.parse(JSON.stringify(e.hand));else for(let C=0;C((n-1)*Le.hand[C].box[X]+W)/n),$=e.hand[C].boxRaw.map((W,X)=>((n-1)*Le.hand[C].boxRaw[X]+W)/n),S=e.hand[C].keypoints.map((W,X)=>W.map((q,Q)=>((n-1)*Le.hand[C].keypoints[X][Q]+q)/n)),D=Object.keys(e.hand[C].annotations),_={};for(let W of D)_[W]=e.hand[C].annotations[W].map((X,q)=>X.map((Q,ee)=>((n-1)*Le.hand[C].annotations[W][q][ee]+Q)/n));Le.hand[C]={...e.hand[C],box:z,boxRaw:$,keypoints:S,annotations:_}}if(!Le.face||e.face.length!==Le.face.length)Le.face=JSON.parse(JSON.stringify(e.face));else for(let C=0;C((n-1)*Le.face[C].box[_]+D)/n),$=e.face[C].boxRaw.map((D,_)=>((n-1)*Le.face[C].boxRaw[_]+D)/n),S={matrix:[0,0,0,0,0,0,0,0,0],angle:{roll:0,yaw:0,pitch:0},gaze:{bearing:0,strength:0}};S.matrix=(r=e.face[C].rotation)==null?void 0:r.matrix,S.angle={roll:((n-1)*(((i=(s=Le.face[C].rotation)==null?void 0:s.angle)==null?void 0:i.roll)||0)+(((l=(o=e.face[C].rotation)==null?void 0:o.angle)==null?void 0:l.roll)||0))/n,yaw:((n-1)*(((d=(u=Le.face[C].rotation)==null?void 0:u.angle)==null?void 0:d.yaw)||0)+(((p=(h=e.face[C].rotation)==null?void 0:h.angle)==null?void 0:p.yaw)||0))/n,pitch:((n-1)*(((m=(c=Le.face[C].rotation)==null?void 0:c.angle)==null?void 0:m.pitch)||0)+(((g=(f=e.face[C].rotation)==null?void 0:f.angle)==null?void 0:g.pitch)||0))/n},S.gaze={bearing:((n-1)*(((A=(y=Le.face[C].rotation)==null?void 0:y.gaze)==null?void 0:A.bearing)||0)+(((v=(x=e.face[C].rotation)==null?void 0:x.gaze)==null?void 0:v.bearing)||0))/n,strength:((n-1)*(((w=(b=Le.face[C].rotation)==null?void 0:b.gaze)==null?void 0:w.strength)||0)+(((T=(I=e.face[C].rotation)==null?void 0:I.gaze)==null?void 0:T.strength)||0))/n},Le.face[C]={...e.face[C],rotation:S,box:z,boxRaw:$}}if(!Le.object||e.object.length!==Le.object.length)Le.object=JSON.parse(JSON.stringify(e.object));else for(let C=0;C((n-1)*Le.object[C].box[D]+S)/n),$=e.object[C].boxRaw.map((S,D)=>((n-1)*Le.object[C].boxRaw[D]+S)/n);Le.object[C]={...e.object[C],box:z,boxRaw:$}}let a=e.persons;if(!Le.persons||a.length!==Le.persons.length)Le.persons=JSON.parse(JSON.stringify(a));else for(let C=0;C((n-1)*Le.persons[C].box[$]+z)/n);return Le.gesture=e.gesture,Le.performance=e.performance,Le}var La,y3=!1;async function bm(e){return La?e.debug&&ge("cached model:",La.modelUrl):(La=await Et(Mt(e.modelBasePath,e.segmentation.modelPath)),!La||!La.modelUrl?ge("load model failed:",e.segmentation.modelPath):e.debug&&ge("load model:",La.modelUrl)),La}async function A3(e){var m,f;let t=((m=e.tensor)==null?void 0:m.shape[1])||0,n=((f=e.tensor)==null?void 0:f.shape[2])||0;if(!e.tensor||!La||!La.inputs[0].shape)return null;let a=Ye.resizeBilinear(e.tensor,[La.inputs[0].shape[1],La.inputs[0].shape[2]],!1),r=a.div(255),s=La.predict(r);Ve(a),Ve(r);let i=Yn(s,0),o;if(i.shape[2]===2){let g=i.softmax(),[y,A]=fd(g,2),x=A.expandDims(2),v=x.expandDims(0);Ve(g),Ve(y),Ve(A);let b=Ye.cropAndResize(v,[[0,0,.5,.5]],[0],[t,n]);o=b.squeeze(0),Ve(b),Ve(x),Ve(v)}else o=Ye.resizeBilinear(i,[t,n]);if(typeof document=="undefined")return o.dataSync();let l=typeof OffscreenCanvas!="undefined"?new OffscreenCanvas(t,n):document.createElement("canvas");l.width=t,l.height=n,Ua&&await Ua.toPixels(o,l),Ve(o),Ve(i),Ve(s);let u=typeof OffscreenCanvas!="undefined"?new OffscreenCanvas(t,n):document.createElement("canvas");u.width=t,u.height=n;let d=u.getContext("2d");d.filter="blur(8px",await d.drawImage(l,0,0);let h=d.getImageData(0,0,t,n).data,p=typeof OffscreenCanvas!="undefined"?new OffscreenCanvas(t,n):document.createElement("canvas");p.width=t,p.height=n;let c=p.getContext("2d");return e.canvas&&await c.drawImage(e.canvas,0,0),c.globalCompositeOperation="darken",c.filter="blur(8px)",await c.drawImage(l,0,0),c.globalCompositeOperation="source-over",c.filter="none",e.canvas=p,h}async function u$(e,t,n){var s;if(y3)return null;y3=!0,La||await bm(n);let a=wo(e,n),r=await A3(a);if(Ve(a.tensor),t&&r){let i=wo(t,n),o=i.canvas;Ve(i.tensor);let l=a.canvas,u=(s=l.getContext("2d"))==null?void 0:s.getImageData(0,0,l.width,l.height).data,d=typeof OffscreenCanvas!="undefined"?new OffscreenCanvas(l.width,l.height):document.createElement("canvas");d.width=l.width,d.height=l.height;let h=d.getContext("2d");h.globalCompositeOperation="copy",h.drawImage(o,0,0,d.width,d.height);let p=h.getImageData(0,0,d.width,d.height);for(let c=0;c0,a=e.naturalHeight||e.videoHeight||e.height||e.shape&&e.shape[2]>0;if(!s||!a)return{tensor:null,canvas:Oe};let o=s,i=a;if(o>x0&&(o=x0,i=o*a/s),i>x0&&(i=x0,o=i*s/a),t.filter.width>0?o=t.filter.width:t.filter.height>0&&(o=s*(t.filter.height/a)),t.filter.height>0?i=t.filter.height:t.filter.width>0&&(i=a*(t.filter.width/s)),!o||!i)throw new Error("Human: Input cannot determine dimension");(!Oe||(Oe==null?void 0:Oe.width)!==o||(Oe==null?void 0:Oe.height)!==i)&&(Oe=typeof OffscreenCanvas!="undefined"?new OffscreenCanvas(o,i):document.createElement("canvas"),(Oe==null?void 0:Oe.width)!==o&&(Oe.width=o),(Oe==null?void 0:Oe.height)!==i&&(Oe.height=i));let l=Oe.getContext("2d");if(e instanceof ImageData?l.putImageData(e,0,0):t.filter.flip&&typeof l.translate!="undefined"?(l.translate(s,0),l.scale(-1,1),l.drawImage(e,0,0,s,a,0,0,Oe==null?void 0:Oe.width,Oe==null?void 0:Oe.height),l.setTransform(1,0,0,1,0,0)):l.drawImage(e,0,0,s,a,0,0,Oe==null?void 0:Oe.width,Oe==null?void 0:Oe.height),t.filter.enabled){if((!rn||!Bt||Oe.width!==Bt.width||(Oe==null?void 0:Oe.height)!==(Bt==null?void 0:Bt.height))&&(Bt=typeof OffscreenCanvas!="undefined"?new OffscreenCanvas(Oe==null?void 0:Oe.width,Oe==null?void 0:Oe.height):document.createElement("canvas"),(Bt==null?void 0:Bt.width)!==(Oe==null?void 0:Oe.width)&&(Bt.width=Oe==null?void 0:Oe.width),(Bt==null?void 0:Bt.height)!==(Oe==null?void 0:Oe.height)&&(Bt.height=Oe==null?void 0:Oe.height),rn=Sr.flags.IS_BROWSER?new t_({canvas:Bt}):null),!rn)return{tensor:null,canvas:Oe};rn.reset(),rn.addFilter("brightness",t.filter.brightness),t.filter.contrast!==0&&rn.addFilter("contrast",t.filter.contrast),t.filter.sharpness!==0&&rn.addFilter("sharpen",t.filter.sharpness),t.filter.blur!==0&&rn.addFilter("blur",t.filter.blur),t.filter.saturation!==0&&rn.addFilter("saturation",t.filter.saturation),t.filter.hue!==0&&rn.addFilter("hue",t.filter.hue),t.filter.negative&&rn.addFilter("negative"),t.filter.sepia&&rn.addFilter("sepia"),t.filter.vintage&&rn.addFilter("brownie"),t.filter.sepia&&rn.addFilter("sepia"),t.filter.kodachrome&&rn.addFilter("kodachrome"),t.filter.technicolor&&rn.addFilter("technicolor"),t.filter.polaroid&&rn.addFilter("polaroid"),t.filter.pixelate!==0&&rn.addFilter("pixelate",t.filter.pixelate),rn.apply(Oe)}else Bt=Oe,rn&&(rn=null);let u;if(Bt.data){let c=[Bt.height,Bt.width,3];u=mp(Bt.data,c,"int32")}else if(Bt instanceof ImageData)u=Hr?Hr.fromPixels(Bt):null;else if(t.backend==="webgl"||t.backend==="humangl"){let c=typeof OffscreenCanvas!="undefined"?new OffscreenCanvas(o,i):document.createElement("canvas");c.width=o,c.height=i;let d=c.getContext("2d");d==null||d.drawImage(Bt,0,0),u=Hr?Hr.fromPixels(c):null}else{let c=typeof OffscreenCanvas!="undefined"?new OffscreenCanvas(o,i):document.createElement("canvas");c.width=o,c.height=i;let d=c.getContext("2d");d==null||d.drawImage(Bt,0,0);let h=d==null?void 0:d.getImageData(0,0,o,i);u=Hr?Hr.fromPixels(h):null}if(u){let c=u.toFloat();n=c.expandDims(0),u.dispose(),c.dispose()}}let r=t.filter.return?Bt:null;return{tensor:n,canvas:r}}var g3={};_3(g3,{all:()=>lwe,body:()=>s_,canvas:()=>iwe,face:()=>r_,gesture:()=>n_,hand:()=>a_,object:()=>o_,options:()=>oo,person:()=>owe});var oo={color:"rgba(173, 216, 230, 0.6)",labelColor:"rgba(173, 216, 230, 1)",shadowColor:"black",font:'small-caps 14px "Segoe UI"',lineHeight:24,lineWidth:6,pointSize:2,roundRect:28,drawPoints:!1,drawLabels:!0,drawBoxes:!0,drawPolygons:!0,drawGaze:!0,fillPolygons:!1,useDepth:!0,useCurves:!1,bufferedOutput:!0},b0=e=>Math.round(e*180/Math.PI);function f3(e,t,n,r=0,s){e.fillStyle=s.useDepth&&r?`rgba(${127.5+2*r}, ${127.5-2*r}, 255, 0.3)`:s.color,e.beginPath(),e.arc(t,n,s.pointSize,0,2*Math.PI),e.fill()}function Th(e,t,n,r,s,a){if(e.beginPath(),a.useCurves){let o=(t+t+r)/2,i=(n+n+s)/2;e.ellipse(o,i,r/2,s/2,0,0,2*Math.PI)}else e.lineWidth=a.lineWidth,e.moveTo(t+a.roundRect,n),e.lineTo(t+r-a.roundRect,n),e.quadraticCurveTo(t+r,n,t+r,n+a.roundRect),e.lineTo(t+r,n+s-a.roundRect),e.quadraticCurveTo(t+r,n+s,t+r-a.roundRect,n+s),e.lineTo(t+a.roundRect,n+s),e.quadraticCurveTo(t,n+s,t,n+s-a.roundRect),e.lineTo(t,n+a.roundRect),e.quadraticCurveTo(t,n,t+a.roundRect,n),e.closePath();e.stroke()}function m3(e,t=[],n){if(!(t===void 0||t.length===0)){e.beginPath(),e.moveTo(t[0][0],t[0][1]);for(let r of t){let s=r[2]||0;e.strokeStyle=n.useDepth&&s?`rgba(${127.5+2*s}, ${127.5-2*s}, 255, 0.3)`:n.color,e.fillStyle=n.useDepth&&s?`rgba(${127.5+2*s}, ${127.5-2*s}, 255, 0.3)`:n.color,e.lineTo(r[0],Math.round(r[1]))}e.stroke(),n.fillPolygons&&(e.closePath(),e.fill())}}function Nh(e,t=[],n){if(!(t===void 0||t.length===0)){if(!n.useCurves||t.length<=2){m3(e,t,n);return}e.moveTo(t[0][0],t[0][1]);for(let r=0;r1&&l[1].length>0){let u=i[1]>0?`#${i[1]}`:"",c=`${i[0]} ${u}: ${l[1]}`;r.shadowColor&&r.shadowColor!==""&&(s.fillStyle=r.shadowColor,s.fillText(c,8,2+a*r.lineHeight)),s.fillStyle=r.labelColor,s.fillText(c,6,0+a*r.lineHeight),a+=1}}}async function r_(e,t,n){var a,o,i,l;let r=ir(oo,n);if(!t||!e||!(e instanceof HTMLCanvasElement))return;let s=e.getContext("2d");if(!!s)for(let u of t){s.font=r.font,s.strokeStyle=r.color,s.fillStyle=r.color,r.drawBoxes&&Th(s,u.box[0],u.box[1],u.box[2],u.box[3],r);let c=[];if(c.push(`face: ${Math.trunc(100*u.score)}%`),u.genderScore&&c.push(`${u.gender||""} ${Math.trunc(100*u.genderScore)}%`),u.age&&c.push(`age: ${u.age||""}`),u.iris&&c.push(`distance: ${u.iris}`),u.emotion&&u.emotion.length>0){let d=u.emotion.map(h=>`${Math.trunc(100*h.score)}% ${h.emotion}`);d.length>3&&(d.length=3),c.push(d.join(" "))}u.rotation&&u.rotation.angle&&u.rotation.gaze&&(u.rotation.angle.roll&&c.push(`roll: ${b0(u.rotation.angle.roll)}\xB0 yaw:${b0(u.rotation.angle.yaw)}\xB0 pitch:${b0(u.rotation.angle.pitch)}\xB0`),u.rotation.gaze.bearing&&c.push(`gaze: ${b0(u.rotation.gaze.bearing)}\xB0`)),c.length===0&&c.push("face"),s.fillStyle=r.color;for(let d=c.length-1;d>=0;d--){let h=Math.max(u.box[0],0),p=d*r.lineHeight+u.box[1];r.shadowColor&&r.shadowColor!==""&&(s.fillStyle=r.shadowColor,s.fillText(c[d],h+5,p+16)),s.fillStyle=r.labelColor,s.fillText(c[d],h+4,p+15)}if(s.lineWidth=1,u.mesh&&u.mesh.length>0){if(r.drawPoints)for(let d of u.mesh)f3(s,d[0],d[1],d[2],r);if(r.drawPolygons){s.lineWidth=1;for(let d=0;du.mesh[p]);m3(s,h,r)}if(u.annotations&&u.annotations.leftEyeIris){s.strokeStyle=r.useDepth?"rgba(255, 200, 255, 0.3)":r.color,s.beginPath();let d=Math.abs(u.annotations.leftEyeIris[3][0]-u.annotations.leftEyeIris[1][0])/2,h=Math.abs(u.annotations.leftEyeIris[4][1]-u.annotations.leftEyeIris[2][1])/2;s.ellipse(u.annotations.leftEyeIris[0][0],u.annotations.leftEyeIris[0][1],d,h,0,0,2*Math.PI),s.stroke(),r.fillPolygons&&(s.fillStyle=r.useDepth?"rgba(255, 255, 200, 0.3)":r.color,s.fill())}if(u.annotations&&u.annotations.rightEyeIris){s.strokeStyle=r.useDepth?"rgba(255, 200, 255, 0.3)":r.color,s.beginPath();let d=Math.abs(u.annotations.rightEyeIris[3][0]-u.annotations.rightEyeIris[1][0])/2,h=Math.abs(u.annotations.rightEyeIris[4][1]-u.annotations.rightEyeIris[2][1])/2;s.ellipse(u.annotations.rightEyeIris[0][0],u.annotations.rightEyeIris[0][1],d,h,0,0,2*Math.PI),s.stroke(),r.fillPolygons&&(s.fillStyle=r.useDepth?"rgba(255, 255, 200, 0.3)":r.color,s.fill())}if(r.drawGaze&&((o=(a=u.rotation)==null?void 0:a.gaze)==null?void 0:o.strength)&&((l=(i=u.rotation)==null?void 0:i.gaze)==null?void 0:l.bearing)&&u.annotations.leftEyeIris&&u.annotations.rightEyeIris&&u.annotations.leftEyeIris[0]&&u.annotations.rightEyeIris[0]){s.strokeStyle="pink",s.beginPath();let d=[u.annotations.leftEyeIris[0][0]+Math.sin(u.rotation.gaze.bearing)*u.rotation.gaze.strength*u.box[3],u.annotations.leftEyeIris[0][1]+Math.cos(u.rotation.gaze.bearing)*u.rotation.gaze.strength*u.box[2]];s.moveTo(u.annotations.leftEyeIris[0][0],u.annotations.leftEyeIris[0][1]),s.lineTo(d[0],d[1]);let h=[u.annotations.rightEyeIris[0][0]+Math.sin(u.rotation.gaze.bearing)*u.rotation.gaze.strength*u.box[3],u.annotations.rightEyeIris[0][1]+Math.cos(u.rotation.gaze.bearing)*u.rotation.gaze.strength*u.box[2]];s.moveTo(u.annotations.rightEyeIris[0][0],u.annotations.rightEyeIris[0][1]),s.lineTo(h[0],h[1]),s.stroke()}}}}}async function s_(e,t,n){var a;let r=ir(oo,n);if(!t||!e||!(e instanceof HTMLCanvasElement))return;let s=e.getContext("2d");if(!!s){s.lineJoin="round";for(let o=0;ou.part==="leftShoulder"),i&&l.push([i.position[0],i.position[1]]),i=t[o].keypoints.find(u=>u.part==="rightShoulder"),i&&l.push([i.position[0],i.position[1]]),Nh(s,l,r),l.length=0,i=t[o].keypoints.find(u=>u.part==="rightShoulder"),i&&l.push([i.position[0],i.position[1]]),i=t[o].keypoints.find(u=>u.part==="rightHip"),i&&l.push([i.position[0],i.position[1]]),i=t[o].keypoints.find(u=>u.part==="leftHip"),i&&l.push([i.position[0],i.position[1]]),i=t[o].keypoints.find(u=>u.part==="leftShoulder"),i&&l.push([i.position[0],i.position[1]]),l.length===4&&m3(s,l,r),l.length=0,i=t[o].keypoints.find(u=>u.part==="leftHip"),i&&l.push([i.position[0],i.position[1]]),i=t[o].keypoints.find(u=>u.part==="leftKnee"),i&&l.push([i.position[0],i.position[1]]),i=t[o].keypoints.find(u=>u.part==="leftAnkle"),i&&l.push([i.position[0],i.position[1]]),i=t[o].keypoints.find(u=>u.part==="leftHeel"),i&&l.push([i.position[0],i.position[1]]),i=t[o].keypoints.find(u=>u.part==="leftFoot"),i&&l.push([i.position[0],i.position[1]]),Nh(s,l,r),l.length=0,i=t[o].keypoints.find(u=>u.part==="rightHip"),i&&l.push([i.position[0],i.position[1]]),i=t[o].keypoints.find(u=>u.part==="rightKnee"),i&&l.push([i.position[0],i.position[1]]),i=t[o].keypoints.find(u=>u.part==="rightAnkle"),i&&l.push([i.position[0],i.position[1]]),i=t[o].keypoints.find(u=>u.part==="rightHeel"),i&&l.push([i.position[0],i.position[1]]),i=t[o].keypoints.find(u=>u.part==="rightFoot"),i&&l.push([i.position[0],i.position[1]]),Nh(s,l,r),l.length=0,i=t[o].keypoints.find(u=>u.part==="leftShoulder"),i&&l.push([i.position[0],i.position[1]]),i=t[o].keypoints.find(u=>u.part==="leftElbow"),i&&l.push([i.position[0],i.position[1]]),i=t[o].keypoints.find(u=>u.part==="leftWrist"),i&&l.push([i.position[0],i.position[1]]),i=t[o].keypoints.find(u=>u.part==="leftPalm"),i&&l.push([i.position[0],i.position[1]]),Nh(s,l,r),l.length=0,i=t[o].keypoints.find(u=>u.part==="rightShoulder"),i&&l.push([i.position[0],i.position[1]]),i=t[o].keypoints.find(u=>u.part==="rightElbow"),i&&l.push([i.position[0],i.position[1]]),i=t[o].keypoints.find(u=>u.part==="rightWrist"),i&&l.push([i.position[0],i.position[1]]),i=t[o].keypoints.find(u=>u.part==="rightPalm"),i&&l.push([i.position[0],i.position[1]]),Nh(s,l,r)}}}}async function a_(e,t,n){let r=ir(oo,n);if(!t||!e||!(e instanceof HTMLCanvasElement))return;let s=e.getContext("2d");if(!!s){s.lineJoin="round",s.font=r.font;for(let a of t){if(r.drawBoxes&&(s.strokeStyle=r.color,s.fillStyle=r.color,Th(s,a.box[0],a.box[1],a.box[2],a.box[3],r),r.drawLabels&&(r.shadowColor&&r.shadowColor!==""&&(s.fillStyle=r.shadowColor,s.fillText("hand",a.box[0]+3,1+a.box[1]+r.lineHeight,a.box[2])),s.fillStyle=r.labelColor,s.fillText("hand",a.box[0]+2,0+a.box[1]+r.lineHeight,a.box[2])),s.stroke()),r.drawPoints&&a.keypoints&&a.keypoints.length>0)for(let o of a.keypoints)s.fillStyle=r.useDepth?`rgba(${127.5+2*o[2]}, ${127.5-2*o[2]}, 255, 0.5)`:r.color,f3(s,o[0],o[1],0,r);if(r.drawLabels){let o=(i,l)=>{s.fillStyle=r.useDepth?`rgba(${127.5+2*i[i.length-1][2]}, ${127.5-2*i[i.length-1][2]}, 255, 0.5)`:r.color,s.fillText(l,i[i.length-1][0]+4,i[i.length-1][1]+4)};s.font=r.font,o(a.annotations.indexFinger,"index"),o(a.annotations.middleFinger,"middle"),o(a.annotations.ringFinger,"ring"),o(a.annotations.pinky,"pinky"),o(a.annotations.thumb,"thumb"),o(a.annotations.palmBase,"palm")}if(r.drawPolygons){let o=i=>{if(!!i)for(let l=0;l0?l-1:0][0],i[l>0?l-1:0][1]),s.lineTo(i[l][0],i[l][1]),s.stroke()};s.lineWidth=r.lineWidth,o(a.annotations.indexFinger),o(a.annotations.middleFinger),o(a.annotations.ringFinger),o(a.annotations.pinky),o(a.annotations.thumb)}}}}async function o_(e,t,n){let r=ir(oo,n);if(!t||!e||!(e instanceof HTMLCanvasElement))return;let s=e.getContext("2d");if(!!s){s.lineJoin="round",s.font=r.font;for(let a of t)if(r.drawBoxes){if(s.strokeStyle=r.color,s.fillStyle=r.color,Th(s,a.box[0],a.box[1],a.box[2],a.box[3],r),r.drawLabels){let o=`${Math.round(100*a.score)}% ${a.label}`;r.shadowColor&&r.shadowColor!==""&&(s.fillStyle=r.shadowColor,s.fillText(o,a.box[0]+3,1+a.box[1]+r.lineHeight,a.box[2])),s.fillStyle=r.labelColor,s.fillText(o,a.box[0]+2,0+a.box[1]+r.lineHeight,a.box[2])}s.stroke()}}}async function owe(e,t,n){let r=ir(oo,n);if(!t||!e||!(e instanceof HTMLCanvasElement))return;let s=e.getContext("2d");if(!!s){s.lineJoin="round",s.font=r.font;for(let a=0;aF.box[0]&&I.box[0]F.box[1]&&I.box[1]+I.box[3]T.body.box[0]&&F.box[0]+F.box[2]T.body.box[1]&&F.box[1]+F.box[3]T.body.box[0]&&F.box[1]+F.box[3]>T.body.box[1]&&F.box[1]+F.box[3]{F&&F.length===4&&(C.push(F[0],F[0]+F[2]),M.push(F[1],F[1]+F[3]))};$((y=T.face)==null?void 0:y.box),$((A=T.body)==null?void 0:A.box),$((b=(x=T.hands)==null?void 0:x.left)==null?void 0:b.box),$((w=(v=T.hands)==null?void 0:v.right)==null?void 0:w.box);let R=Math.min(...C),N=Math.min(...M);T.box=[R,N,Math.max(...C)-R,Math.max(...M)-N],s&&s.length===4&&(T.boxRaw=[T.box[0]/s[2],T.box[1]/s[1],T.box[2]/s[2],T.box[3]/s[1]]),o.push(T)}return o}var Be={face:[],body:[],hand:[],gesture:[],object:[],persons:[],performance:{},timestamp:0};function l_(e){var s,a,o,i,l,u,c,d,h,p,f,m,g,y,A,x,b,v,w,I,T;let t=Date.now()-e.timestamp,n=t<1e3?8-Math.log(t):1;if(Be.canvas=e.canvas,!Be.body||e.body.length!==Be.body.length)Be.body=JSON.parse(JSON.stringify(e.body));else for(let C=0;C((n-1)*Be.body[C].box[F]+N)/n),$=e.body[C].boxRaw.map((N,F)=>((n-1)*Be.body[C].boxRaw[F]+N)/n),R=e.body[C].keypoints.map((N,F)=>({score:N.score,part:N.part,position:[Be.body[C].keypoints[F]?((n-1)*Be.body[C].keypoints[F].position[0]+N.position[0])/n:N.position[0],Be.body[C].keypoints[F]?((n-1)*Be.body[C].keypoints[F].position[1]+N.position[1])/n:N.position[1]],positionRaw:[Be.body[C].keypoints[F]?((n-1)*Be.body[C].keypoints[F].positionRaw[0]+N.positionRaw[0])/n:N.position[0],Be.body[C].keypoints[F]?((n-1)*Be.body[C].keypoints[F].positionRaw[1]+N.positionRaw[1])/n:N.position[1]]}));Be.body[C]={...e.body[C],box:M,boxRaw:$,keypoints:R}}if(!Be.hand||e.hand.length!==Be.hand.length)Be.hand=JSON.parse(JSON.stringify(e.hand));else for(let C=0;C((n-1)*Be.hand[C].box[j]+B)/n),$=e.hand[C].boxRaw.map((B,j)=>((n-1)*Be.hand[C].boxRaw[j]+B)/n),R=e.hand[C].keypoints.map((B,j)=>B.map((X,Y)=>((n-1)*Be.hand[C].keypoints[j][Y]+X)/n)),N=Object.keys(e.hand[C].annotations),F={};for(let B of N)F[B]=e.hand[C].annotations[B].map((j,X)=>j.map((Y,ee)=>((n-1)*Be.hand[C].annotations[B][X][ee]+Y)/n));Be.hand[C]={...e.hand[C],box:M,boxRaw:$,keypoints:R,annotations:F}}if(!Be.face||e.face.length!==Be.face.length)Be.face=JSON.parse(JSON.stringify(e.face));else for(let C=0;C((n-1)*Be.face[C].box[F]+N)/n),$=e.face[C].boxRaw.map((N,F)=>((n-1)*Be.face[C].boxRaw[F]+N)/n),R={matrix:[0,0,0,0,0,0,0,0,0],angle:{roll:0,yaw:0,pitch:0},gaze:{bearing:0,strength:0}};R.matrix=(s=e.face[C].rotation)==null?void 0:s.matrix,R.angle={roll:((n-1)*(((o=(a=Be.face[C].rotation)==null?void 0:a.angle)==null?void 0:o.roll)||0)+(((l=(i=e.face[C].rotation)==null?void 0:i.angle)==null?void 0:l.roll)||0))/n,yaw:((n-1)*(((c=(u=Be.face[C].rotation)==null?void 0:u.angle)==null?void 0:c.yaw)||0)+(((h=(d=e.face[C].rotation)==null?void 0:d.angle)==null?void 0:h.yaw)||0))/n,pitch:((n-1)*(((f=(p=Be.face[C].rotation)==null?void 0:p.angle)==null?void 0:f.pitch)||0)+(((g=(m=e.face[C].rotation)==null?void 0:m.angle)==null?void 0:g.pitch)||0))/n},R.gaze={bearing:((n-1)*(((A=(y=Be.face[C].rotation)==null?void 0:y.gaze)==null?void 0:A.bearing)||0)+(((b=(x=e.face[C].rotation)==null?void 0:x.gaze)==null?void 0:b.bearing)||0))/n,strength:((n-1)*(((w=(v=Be.face[C].rotation)==null?void 0:v.gaze)==null?void 0:w.strength)||0)+(((T=(I=e.face[C].rotation)==null?void 0:I.gaze)==null?void 0:T.strength)||0))/n},Be.face[C]={...e.face[C],rotation:R,box:M,boxRaw:$}}if(!Be.object||e.object.length!==Be.object.length)Be.object=JSON.parse(JSON.stringify(e.object));else for(let C=0;C((n-1)*Be.object[C].box[N]+R)/n),$=e.object[C].boxRaw.map((R,N)=>((n-1)*Be.object[C].boxRaw[N]+R)/n);Be.object[C]={...e.object[C],box:M,boxRaw:$}}let r=e.persons;if(!Be.persons||r.length!==Be.persons.length)Be.persons=JSON.parse(JSON.stringify(r));else for(let C=0;C((n-1)*Be.persons[C].box[$]+M)/n);return Be.gesture=e.gesture,Be.performance=e.performance,Be}var Wr,y3=!1;async function v0(e){return Wr?e.debug&&me("cached model:",Wr.modelUrl):(Wr=await Et($t(e.modelBasePath,e.segmentation.modelPath)),!Wr||!Wr.modelUrl?me("load model failed:",e.segmentation.modelPath):e.debug&&me("load model:",Wr.modelUrl)),Wr}async function A3(e){var f,m;let t=((f=e.tensor)==null?void 0:f.shape[1])||0,n=((m=e.tensor)==null?void 0:m.shape[2])||0;if(!e.tensor||!Wr||!Wr.inputs[0].shape)return null;let r=Ye.resizeBilinear(e.tensor,[Wr.inputs[0].shape[1],Wr.inputs[0].shape[2]],!1),s=r.div(255),a=Wr.predict(s);Ve(r),Ve(s);let o=Zn(a,0),i;if(o.shape[2]===2){let g=o.softmax(),[y,A]=fc(g,2),x=A.expandDims(2),b=x.expandDims(0);Ve(g),Ve(y),Ve(A);let v=Ye.cropAndResize(b,[[0,0,.5,.5]],[0],[t,n]);i=v.squeeze(0),Ve(v),Ve(x),Ve(b)}else i=Ye.resizeBilinear(o,[t,n]);if(typeof document=="undefined")return i.dataSync();let l=typeof OffscreenCanvas!="undefined"?new OffscreenCanvas(t,n):document.createElement("canvas");l.width=t,l.height=n,Hr&&await Hr.toPixels(i,l),Ve(i),Ve(o),Ve(a);let u=typeof OffscreenCanvas!="undefined"?new OffscreenCanvas(t,n):document.createElement("canvas");u.width=t,u.height=n;let c=u.getContext("2d");c.filter="blur(8px",await c.drawImage(l,0,0);let d=c.getImageData(0,0,t,n).data,h=typeof OffscreenCanvas!="undefined"?new OffscreenCanvas(t,n):document.createElement("canvas");h.width=t,h.height=n;let p=h.getContext("2d");return e.canvas&&await p.drawImage(e.canvas,0,0),p.globalCompositeOperation="darken",p.filter="blur(8px)",await p.drawImage(l,0,0),p.globalCompositeOperation="source-over",p.filter="none",e.canvas=h,d}async function u_(e,t,n){var a;if(y3)return null;y3=!0,Wr||await v0(n);let r=wi(e,n),s=await A3(r);if(Ve(r.tensor),t&&s){let o=wi(t,n),i=o.canvas;Ve(o.tensor);let l=r.canvas,u=(a=l.getContext("2d"))==null?void 0:a.getImageData(0,0,l.width,l.height).data,c=typeof OffscreenCanvas!="undefined"?new OffscreenCanvas(l.width,l.height):document.createElement("canvas");c.width=l.width,c.height=l.height;let d=c.getContext("2d");d.globalCompositeOperation="copy",d.drawImage(i,0,0,c.width,c.height);let h=d.getImageData(0,0,c.width,c.height);for(let p=0;p{if(!Fn(this,Ep))return;let n=this.tf.engine().state.numTensors,a=Fn(this,Fu);Ja(this,Fu,n);let r=n-a;r!==0&&ge(...t,r)};wa(this,km,t=>{if(!Fn(this,Cp))return null;if(!t)return"input is not defined";if(this.tf.ENV.flags.IS_NODE&&!(t instanceof St))return"input must be a tensor";try{this.tf.getBackend()}catch(n){return"backend not loaded"}return null});wa(this,Mp,async(t=!1)=>{var n;if(this.config.backend&&this.config.backend.length>0&&t||this.tf.getBackend()!==this.config.backend){let a=st();if(this.state="backend",this.config.backend&&this.config.backend.length>0){if(typeof window=="undefined"&&typeof WorkerGlobalScope!="undefined"&&this.config.debug&&ge("running inside web worker"),this.tf.ENV.flags.IS_BROWSER&&this.config.backend==="tensorflow"&&(this.config.backend="webgl"),this.tf.ENV.flags.IS_NODE&&(this.config.backend==="webgl"||this.config.backend==="humangl")&&(this.config.backend="tensorflow"),this.config.debug&&ge("setting backend:",this.config.backend),this.config.backend==="wasm"){if(this.config.debug&&ge("wasm path:",this.config.wasmPath),typeof((n=this.tf)==null?void 0:n.setWasmPaths)!="undefined")this.tf.setWasmPaths(this.config.wasmPath);else throw new Error("Human: WASM backend is not loaded");let r=await this.tf.env().getAsync("WASM_HAS_SIMD_SUPPORT"),s=await this.tf.env().getAsync("WASM_HAS_MULTITHREAD_SUPPORT");this.config.debug&&ge(`wasm execution: ${r?"SIMD":"no SIMD"} ${s?"multithreaded":"singlethreaded"}`),this.config.debug&&!r&&ge("warning: wasm simd support is not enabled")}this.config.backend==="humangl"&&hM();try{await this.tf.setBackend(this.config.backend)}catch(r){ge("error: cannot set backend:",this.config.backend,r)}}if(this.tf.enableProdMode(),this.tf.getBackend()==="webgl"||this.tf.getBackend()==="humangl"){this.tf.ENV.set("CHECK_COMPUTATION_FOR_ERRORS",!1),this.tf.ENV.set("WEBGL_CPU_FORWARD",!0),this.tf.ENV.set("WEBGL_PACK_DEPTHWISECONV",!0),typeof this.config.deallocate!="undefined"&&this.config.deallocate&&(ge("changing webgl: WEBGL_DELETE_TEXTURE_THRESHOLD:",!0),this.tf.ENV.set("WEBGL_DELETE_TEXTURE_THRESHOLD",0));let r=await this.tf.backend().getGPGPUContext().gl;this.config.debug&&ge(`gl version:${r.getParameter(r.VERSION)} renderer:${r.getParameter(r.RENDERER)}`)}await this.tf.ready(),this.performance.backend=Math.trunc(st()-a)}});this.next=t=>l$(t||this.result);wa(this,Im,async t=>{if(this.config.cacheSensitivity===0)return!1;let n=32,a=t.resizeBilinear([Math.trunc(t.shape[1]/n),Math.trunc(t.shape[2]/n)]),r=a.dataSync(),s=0;for(let l=0;l10*this.config.cacheSensitivity?0:i),o});wa(this,Sm,async()=>{let t=(r,s="application/octet-stream")=>fetch(`data:${s};base64,${r}`).then(i=>i.blob()),n,a;switch(this.config.warmup){case"face":n=await t(vm);break;case"full":n=await t(wm);break;default:n=null}if(n){let r=await createImageBitmap(n);a=await this.detect(r,this.config),r.close()}return a});wa(this,Nm,async()=>new Promise(t=>{let n,a=0;switch(this.config.warmup){case"face":a=256,n="data:image/jpeg;base64,"+vm;break;case"full":case"body":a=1200,n="data:image/jpeg;base64,"+wm;break;default:n=null}let r=new Image;r.onload=async()=>{let s=typeof OffscreenCanvas!="undefined"?new OffscreenCanvas(a,a):document.createElement("canvas");s.width=r.naturalWidth,s.height=r.naturalHeight;let i=s.getContext("2d");i==null||i.drawImage(r,0,0);let o=await this.detect(s,this.config);t(o)},n?r.src=n:t(null)}));wa(this,Tm,async()=>{let t=r=>Buffer.from(r,"base64"),n;if(this.config.warmup==="face"&&(n=t(vm)),(this.config.warmup==="body"||this.config.warmup==="full")&&(n=t(wm)),!n)return null;let a;if(typeof void 0!="undefined"){let r=(void 0).decodeJpeg(n),s=r.expandDims(0);this.tf.dispose(r),a=await this.detect(s,this.config),this.tf.dispose(s)}else this.config.debug&&ge("Warmup tfjs-node not loaded");return a});this.config=ia(F3,t||{}),this.tf=bp,this.draw=g3,this.version=d$,this.state="idle",Ja(this,Fu,0),Ja(this,Ep,!1),Ja(this,Cp,!1),Ja(this,ko,!0),Ja(this,Ou,0),this.performance={backend:0,load:0,image:0,frames:0,cached:0,changed:0,total:0,draw:0},this.models={face:null,posenet:null,blazepose:null,efficientpose:null,movenet:null,handpose:null,age:null,gender:null,emotion:null,embedding:null,nanodet:null,centernet:null,faceres:null,segmentation:null},this.image=n=>wo(n,this.config),this.faceTriangulation=IM,this.faceUVMap=SM,this.sysinfo=O3(),Ja(this,Io,1)}similarity(t,n){return Fb(t,n)}segmentation(t,n){return u$(t,n,this.config)}enhance(t){return Ob(t)}match(t,n,a=0){return EM(t,n,a)}async load(t){this.state="load";let n=st();t&&(this.config=ia(this.config,t)),Fn(this,ko)&&(this.config.debug&&ge(`version: ${this.version}`),this.config.debug&&ge(`tfjs version: ${this.tf.version_core}`),this.config.debug&&ge("platform:",this.sysinfo.platform),this.config.debug&&ge("agent:",this.sysinfo.agent),await Fn(this,Mp).call(this,!0),this.tf.ENV.flags.IS_BROWSER&&(this.config.debug&&ge("configuration:",this.config),this.config.debug&&ge("tf flags:",this.tf.ENV.flags))),this.config.async?[this.models.face,this.models.emotion,this.models.handpose,this.models.posenet,this.models.blazepose,this.models.efficientpose,this.models.movenet,this.models.nanodet,this.models.centernet,this.models.faceres,this.models.segmentation]=await Promise.all([this.models.face||(this.config.face.enabled?Nb(this.config):null),this.models.emotion||(this.config.face.enabled&&this.config.face.emotion.enabled?Cb(this.config):null),this.models.handpose||(this.config.hand.enabled?Xb(this.config):null),this.models.posenet||(this.config.body.enabled&&this.config.body.modelPath.includes("posenet")?Ub(this.config):null),this.models.blazepose||(this.config.body.enabled&&this.config.body.modelPath.includes("blazepose")?mm(this.config):null),this.models.efficientpose||(this.config.body.enabled&&this.config.body.modelPath.includes("efficientpose")?ZM(this.config):null),this.models.movenet||(this.config.body.enabled&&this.config.body.modelPath.includes("movenet")?r3(this.config):null),this.models.nanodet||(this.config.object.enabled&&this.config.object.modelPath.includes("nanodet")?l3(this.config):null),this.models.centernet||(this.config.object.enabled&&this.config.object.modelPath.includes("centernet")?p3(this.config):null),this.models.faceres||(this.config.face.enabled&&this.config.face.description.enabled?Rb(this.config):null),this.models.segmentation||(this.config.segmentation.enabled?bm(this.config):null)]):(this.config.face.enabled&&!this.models.face&&(this.models.face=await Nb(this.config)),this.config.face.enabled&&this.config.face.emotion.enabled&&!this.models.emotion&&(this.models.emotion=await Cb(this.config)),this.config.hand.enabled&&!this.models.handpose&&(this.models.handpose=await Xb(this.config)),this.config.body.enabled&&!this.models.posenet&&this.config.body.modelPath.includes("posenet")&&(this.models.posenet=await Ub(this.config)),this.config.body.enabled&&!this.models.blazepose&&this.config.body.modelPath.includes("blazepose")&&(this.models.blazepose=await mm(this.config)),this.config.body.enabled&&!this.models.efficientpose&&this.config.body.modelPath.includes("efficientpose")&&(this.models.efficientpose=await mm(this.config)),this.config.body.enabled&&!this.models.movenet&&this.config.body.modelPath.includes("movenet")&&(this.models.movenet=await r3(this.config)),this.config.object.enabled&&!this.models.nanodet&&this.config.object.modelPath.includes("nanodet")&&(this.models.nanodet=await l3(this.config)),this.config.object.enabled&&!this.models.centernet&&this.config.object.modelPath.includes("centernet")&&(this.models.centernet=await p3(this.config)),this.config.face.enabled&&this.config.face.description.enabled&&!this.models.faceres&&(this.models.faceres=await Rb(this.config)),this.config.segmentation.enabled&&!this.models.segmentation&&(this.models.segmentation=await bm(this.config))),Fn(this,ko)&&(this.config.debug&&ge("tf engine state:",this.tf.engine().state.numBytes,"bytes",this.tf.engine().state.numTensors,"tensors"),Ja(this,ko,!1));let a=Math.trunc(st()-n);a>(this.performance.load||0)&&(this.performance.load=a)}async detect(t,n){return new Promise(async a=>{this.state="config";let r,s;this.config=ia(this.config,n),this.state="check";let i=Fn(this,km).call(this,t);i&&(ge(i,t),a({error:i}));let o=st();await Fn(this,Mp).call(this),await this.load(),r=st();let l=wo(t,this.config);if(this.performance.image=Math.trunc(st()-r),this.analyze("Get Image:"),this.config.segmentation.enabled&&l&&l.tensor&&(this.analyze("Start Segmentation:"),this.state="run:segmentation",r=st(),await A3(l),s=Math.trunc(st()-r),s>0&&(this.performance.segmentation=s),l.canvas&&(l.tensor.dispose(),l=wo(l.canvas,this.config)),this.analyze("End Segmentation:")),!l||!l.tensor){ge("could not convert input to tensor"),a({error:"could not convert input to tensor"});return}r=st(),this.config.skipFrame=await Fn(this,Im).call(this,l.tensor),this.performance.frames||(this.performance.frames=0),this.performance.cached||(this.performance.cached=0),this.performance.frames++,this.config.skipFrame&&this.performance.cached++,this.performance.changed=Math.trunc(st()-r),this.analyze("Check Changed:");let u,d,h,p;this.config.async?(u=this.config.face.enabled?_b(this,l.tensor):[],this.performance.face&&delete this.performance.face):(this.state="run:face",r=st(),u=this.config.face.enabled?await _b(this,l.tensor):[],s=Math.trunc(st()-r),s>0&&(this.performance.face=s)),this.analyze("Start Body:"),this.config.async?(this.config.body.modelPath.includes("posenet")?d=this.config.body.enabled?Vb(l.tensor,this.config):[]:this.config.body.modelPath.includes("blazepose")?d=this.config.body.enabled?Zb(l.tensor,this.config):[]:this.config.body.modelPath.includes("efficientpose")?d=this.config.body.enabled?e3(l.tensor,this.config):[]:this.config.body.modelPath.includes("movenet")&&(d=this.config.body.enabled?s3(l.tensor,this.config):[]),this.performance.body&&delete this.performance.body):(this.state="run:body",r=st(),this.config.body.modelPath.includes("posenet")?d=this.config.body.enabled?await Vb(l.tensor,this.config):[]:this.config.body.modelPath.includes("blazepose")?d=this.config.body.enabled?await Zb(l.tensor,this.config):[]:this.config.body.modelPath.includes("efficientpose")?d=this.config.body.enabled?await e3(l.tensor,this.config):[]:this.config.body.modelPath.includes("movenet")&&(d=this.config.body.enabled?await s3(l.tensor,this.config):[]),s=Math.trunc(st()-r),s>0&&(this.performance.body=s)),this.analyze("End Body:"),this.analyze("Start Hand:"),this.config.async?(h=this.config.hand.enabled?Kb(l.tensor,this.config):[],this.performance.hand&&delete this.performance.hand):(this.state="run:hand",r=st(),h=this.config.hand.enabled?await Kb(l.tensor,this.config):[],s=Math.trunc(st()-r),s>0&&(this.performance.hand=s)),this.analyze("End Hand:"),this.analyze("Start Object:"),this.config.async?(this.config.object.modelPath.includes("nanodet")?p=this.config.object.enabled?u3(l.tensor,this.config):[]:this.config.object.modelPath.includes("centernet")&&(p=this.config.object.enabled?c3(l.tensor,this.config):[]),this.performance.object&&delete this.performance.object):(this.state="run:object",r=st(),this.config.object.modelPath.includes("nanodet")?p=this.config.object.enabled?await u3(l.tensor,this.config):[]:this.config.object.modelPath.includes("centernet")&&(p=this.config.object.enabled?await c3(l.tensor,this.config):[]),s=Math.trunc(st()-r),s>0&&(this.performance.object=s)),this.analyze("End Object:"),this.config.async&&([u,d,h,p]=await Promise.all([u,d,h,p]));let c=[];this.config.gesture.enabled&&(r=st(),c=[...JM(u),...YM(d),...e$(h),...QM(u)],this.config.async?this.performance.gesture&&delete this.performance.gesture:this.performance.gesture=Math.trunc(st()-r)),this.performance.total=Math.trunc(st()-o),this.state="idle",this.result={face:u,body:d,hand:h,gesture:c,object:p,performance:this.performance,canvas:l.canvas,timestamp:Date.now(),get persons(){var m;return o$(u,d,h,c,(m=l==null?void 0:l.tensor)==null?void 0:m.shape)}},Ve(l.tensor),a(this.result)})}async warmup(t){let n=st();if(t&&(this.config=ia(this.config,t)),!this.config.warmup||this.config.warmup==="none")return{error:"null"};let a;typeof createImageBitmap=="function"?a=await Fn(this,Sm).call(this):typeof Image!="undefined"?a=await Fn(this,Nm).call(this):a=await Fn(this,Tm).call(this);let r=st();return this.config.debug&&ge("Warmup",this.config.warmup,Math.round(r-n),"ms",a),a}};Fu=new WeakMap,Ep=new WeakMap,Cp=new WeakMap,ko=new WeakMap,Io=new WeakMap,Ou=new WeakMap,km=new WeakMap,Mp=new WeakMap,Im=new WeakMap,Sm=new WeakMap,Nm=new WeakMap,Tm=new WeakMap;export{dwe as Human,dwe as default}; +2Q==`;var c_="2.0.0";var Du,Ch,Eh,ki,Ii,Fu,I0,$h,S0,T0,N0,C0,cwe=class{constructor(t){Ir(this,Du,void 0);Ir(this,Ch,void 0);Ir(this,Eh,void 0);Ir(this,ki,void 0);Ir(this,Ii,void 0);Ir(this,Fu,void 0);this.analyze=(...t)=>{if(!Fn(this,Ch))return;let n=this.tf.engine().state.numTensors,r=Fn(this,Du);Qr(this,Du,n);let s=n-r;s!==0&&me(...t,s)};Ir(this,I0,t=>{if(!Fn(this,Eh))return null;if(!t)return"input is not defined";if(this.tf.ENV.flags.IS_NODE&&!(t instanceof Tt))return"input must be a tensor";try{this.tf.getBackend()}catch(n){return"backend not loaded"}return null});Ir(this,$h,async(t=!1)=>{var n;if(this.config.backend&&this.config.backend.length>0&&t||this.tf.getBackend()!==this.config.backend){let r=at();if(this.state="backend",this.config.backend&&this.config.backend.length>0){if(typeof window=="undefined"&&typeof WorkerGlobalScope!="undefined"&&this.config.debug&&me("running inside web worker"),this.tf.ENV.flags.IS_BROWSER&&this.config.backend==="tensorflow"&&(this.config.backend="webgl"),this.tf.ENV.flags.IS_NODE&&(this.config.backend==="webgl"||this.config.backend==="humangl")&&(this.config.backend="tensorflow"),this.config.debug&&me("setting backend:",this.config.backend),this.config.backend==="wasm"){if(this.config.debug&&me("wasm path:",this.config.wasmPath),typeof((n=this.tf)==null?void 0:n.setWasmPaths)!="undefined")this.tf.setWasmPaths(this.config.wasmPath);else throw new Error("Human: WASM backend is not loaded");let s=await this.tf.env().getAsync("WASM_HAS_SIMD_SUPPORT"),a=await this.tf.env().getAsync("WASM_HAS_MULTITHREAD_SUPPORT");this.config.debug&&me(`wasm execution: ${s?"SIMD":"no SIMD"} ${a?"multithreaded":"singlethreaded"}`),this.config.debug&&!s&&me("warning: wasm simd support is not enabled")}this.config.backend==="humangl"&&d$();try{await this.tf.setBackend(this.config.backend)}catch(s){me("error: cannot set backend:",this.config.backend,s)}}if(this.tf.enableProdMode(),this.tf.getBackend()==="webgl"||this.tf.getBackend()==="humangl"){this.tf.ENV.set("CHECK_COMPUTATION_FOR_ERRORS",!1),this.tf.ENV.set("WEBGL_CPU_FORWARD",!0),this.tf.ENV.set("WEBGL_PACK_DEPTHWISECONV",!0),typeof this.config.deallocate!="undefined"&&this.config.deallocate&&(me("changing webgl: WEBGL_DELETE_TEXTURE_THRESHOLD:",!0),this.tf.ENV.set("WEBGL_DELETE_TEXTURE_THRESHOLD",0));let s=await this.tf.backend().getGPGPUContext().gl;this.config.debug&&me(`gl version:${s.getParameter(s.VERSION)} renderer:${s.getParameter(s.RENDERER)}`)}await this.tf.ready(),this.performance.backend=Math.trunc(at()-r)}});this.next=t=>l_(t||this.result);Ir(this,S0,async t=>{if(this.config.cacheSensitivity===0)return!1;let n=32,r=t.resizeBilinear([Math.trunc(t.shape[1]/n),Math.trunc(t.shape[2]/n)]),s=r.dataSync(),a=0;for(let l=0;l10*this.config.cacheSensitivity?0:o),i});Ir(this,T0,async()=>{let t=(s,a="application/octet-stream")=>fetch(`data:${a};base64,${s}`).then(o=>o.blob()),n,r;switch(this.config.warmup){case"face":n=await t(w0);break;case"full":n=await t(k0);break;default:n=null}if(n){let s=await createImageBitmap(n);r=await this.detect(s,this.config),s.close()}return r});Ir(this,N0,async()=>new Promise(t=>{let n,r=0;switch(this.config.warmup){case"face":r=256,n="data:image/jpeg;base64,"+w0;break;case"full":case"body":r=1200,n="data:image/jpeg;base64,"+k0;break;default:n=null}let s=new Image;s.onload=async()=>{let a=typeof OffscreenCanvas!="undefined"?new OffscreenCanvas(r,r):document.createElement("canvas");a.width=s.naturalWidth,a.height=s.naturalHeight;let o=a.getContext("2d");o==null||o.drawImage(s,0,0);let i=await this.detect(a,this.config);t(i)},n?s.src=n:t(null)}));Ir(this,C0,async()=>{let t=s=>Buffer.from(s,"base64"),n;if(this.config.warmup==="face"&&(n=t(w0)),(this.config.warmup==="body"||this.config.warmup==="full")&&(n=t(k0)),!n)return null;let r;if(typeof void 0!="undefined"){let s=(void 0).decodeJpeg(n),a=s.expandDims(0);this.tf.dispose(s),r=await this.detect(a,this.config),this.tf.dispose(a)}else this.config.debug&&me("Warmup tfjs-node not loaded");return r});this.config=ir(D3,t||{}),this.tf=bh,this.draw=g3,this.version=c_,this.state="idle",Qr(this,Du,0),Qr(this,Ch,!1),Qr(this,Eh,!1),Qr(this,ki,!0),Qr(this,Fu,0),this.performance={backend:0,load:0,image:0,frames:0,cached:0,changed:0,total:0,draw:0},this.models={face:null,posenet:null,blazepose:null,efficientpose:null,movenet:null,handpose:null,age:null,gender:null,emotion:null,embedding:null,nanodet:null,centernet:null,faceres:null,segmentation:null},this.image=n=>wi(n,this.config),this.faceTriangulation=I$,this.faceUVMap=S$,this.sysinfo=F3(),Qr(this,Ii,1)}similarity(t,n){return Db(t,n)}segmentation(t,n){return u_(t,n,this.config)}enhance(t){return Fb(t)}match(t,n,r=0){return C$(t,n,r)}async load(t){this.state="load";let n=at();t&&(this.config=ir(this.config,t)),Fn(this,ki)&&(this.config.debug&&me(`version: ${this.version}`),this.config.debug&&me(`tfjs version: ${this.tf.version_core}`),this.config.debug&&me("platform:",this.sysinfo.platform),this.config.debug&&me("agent:",this.sysinfo.agent),await Fn(this,$h).call(this,!0),this.tf.ENV.flags.IS_BROWSER&&(this.config.debug&&me("configuration:",this.config),this.config.debug&&me("tf flags:",this.tf.ENV.flags))),this.config.async?[this.models.face,this.models.emotion,this.models.handpose,this.models.posenet,this.models.blazepose,this.models.efficientpose,this.models.movenet,this.models.nanodet,this.models.centernet,this.models.faceres,this.models.segmentation]=await Promise.all([this.models.face||(this.config.face.enabled?Tb(this.config):null),this.models.emotion||(this.config.face.enabled&&this.config.face.emotion.enabled?Eb(this.config):null),this.models.handpose||(this.config.hand.enabled?Xb(this.config):null),this.models.posenet||(this.config.body.enabled&&this.config.body.modelPath.includes("posenet")?Ub(this.config):null),this.models.blazepose||(this.config.body.enabled&&this.config.body.modelPath.includes("blazepose")?g0(this.config):null),this.models.efficientpose||(this.config.body.enabled&&this.config.body.modelPath.includes("efficientpose")?Z$(this.config):null),this.models.movenet||(this.config.body.enabled&&this.config.body.modelPath.includes("movenet")?s3(this.config):null),this.models.nanodet||(this.config.object.enabled&&this.config.object.modelPath.includes("nanodet")?l3(this.config):null),this.models.centernet||(this.config.object.enabled&&this.config.object.modelPath.includes("centernet")?h3(this.config):null),this.models.faceres||(this.config.face.enabled&&this.config.face.description.enabled?Rb(this.config):null),this.models.segmentation||(this.config.segmentation.enabled?v0(this.config):null)]):(this.config.face.enabled&&!this.models.face&&(this.models.face=await Tb(this.config)),this.config.face.enabled&&this.config.face.emotion.enabled&&!this.models.emotion&&(this.models.emotion=await Eb(this.config)),this.config.hand.enabled&&!this.models.handpose&&(this.models.handpose=await Xb(this.config)),this.config.body.enabled&&!this.models.posenet&&this.config.body.modelPath.includes("posenet")&&(this.models.posenet=await Ub(this.config)),this.config.body.enabled&&!this.models.blazepose&&this.config.body.modelPath.includes("blazepose")&&(this.models.blazepose=await g0(this.config)),this.config.body.enabled&&!this.models.efficientpose&&this.config.body.modelPath.includes("efficientpose")&&(this.models.efficientpose=await g0(this.config)),this.config.body.enabled&&!this.models.movenet&&this.config.body.modelPath.includes("movenet")&&(this.models.movenet=await s3(this.config)),this.config.object.enabled&&!this.models.nanodet&&this.config.object.modelPath.includes("nanodet")&&(this.models.nanodet=await l3(this.config)),this.config.object.enabled&&!this.models.centernet&&this.config.object.modelPath.includes("centernet")&&(this.models.centernet=await h3(this.config)),this.config.face.enabled&&this.config.face.description.enabled&&!this.models.faceres&&(this.models.faceres=await Rb(this.config)),this.config.segmentation.enabled&&!this.models.segmentation&&(this.models.segmentation=await v0(this.config))),Fn(this,ki)&&(this.config.debug&&me("tf engine state:",this.tf.engine().state.numBytes,"bytes",this.tf.engine().state.numTensors,"tensors"),Qr(this,ki,!1));let r=Math.trunc(at()-n);r>(this.performance.load||0)&&(this.performance.load=r)}async detect(t,n){return new Promise(async r=>{this.state="config";let s,a;this.config=ir(this.config,n),this.state="check";let o=Fn(this,I0).call(this,t);o&&(me(o,t),r({error:o}));let i=at();await Fn(this,$h).call(this),await this.load(),s=at();let l=wi(t,this.config);if(this.performance.image=Math.trunc(at()-s),this.analyze("Get Image:"),this.config.segmentation.enabled&&l&&l.tensor&&(this.analyze("Start Segmentation:"),this.state="run:segmentation",s=at(),await A3(l),a=Math.trunc(at()-s),a>0&&(this.performance.segmentation=a),l.canvas&&(l.tensor.dispose(),l=wi(l.canvas,this.config)),this.analyze("End Segmentation:")),!l||!l.tensor){me("could not convert input to tensor"),r({error:"could not convert input to tensor"});return}s=at(),this.config.skipFrame=await Fn(this,S0).call(this,l.tensor),this.performance.frames||(this.performance.frames=0),this.performance.cached||(this.performance.cached=0),this.performance.frames++,this.config.skipFrame&&this.performance.cached++,this.performance.changed=Math.trunc(at()-s),this.analyze("Check Changed:");let u,c,d,h;this.config.async?(u=this.config.face.enabled?Ob(this,l.tensor):[],this.performance.face&&delete this.performance.face):(this.state="run:face",s=at(),u=this.config.face.enabled?await Ob(this,l.tensor):[],a=Math.trunc(at()-s),a>0&&(this.performance.face=a)),this.analyze("Start Body:"),this.config.async?(this.config.body.modelPath.includes("posenet")?c=this.config.body.enabled?Vb(l.tensor,this.config):[]:this.config.body.modelPath.includes("blazepose")?c=this.config.body.enabled?Zb(l.tensor,this.config):[]:this.config.body.modelPath.includes("efficientpose")?c=this.config.body.enabled?e3(l.tensor,this.config):[]:this.config.body.modelPath.includes("movenet")&&(c=this.config.body.enabled?a3(l.tensor,this.config):[]),this.performance.body&&delete this.performance.body):(this.state="run:body",s=at(),this.config.body.modelPath.includes("posenet")?c=this.config.body.enabled?await Vb(l.tensor,this.config):[]:this.config.body.modelPath.includes("blazepose")?c=this.config.body.enabled?await Zb(l.tensor,this.config):[]:this.config.body.modelPath.includes("efficientpose")?c=this.config.body.enabled?await e3(l.tensor,this.config):[]:this.config.body.modelPath.includes("movenet")&&(c=this.config.body.enabled?await a3(l.tensor,this.config):[]),a=Math.trunc(at()-s),a>0&&(this.performance.body=a)),this.analyze("End Body:"),this.analyze("Start Hand:"),this.config.async?(d=this.config.hand.enabled?Kb(l.tensor,this.config):[],this.performance.hand&&delete this.performance.hand):(this.state="run:hand",s=at(),d=this.config.hand.enabled?await Kb(l.tensor,this.config):[],a=Math.trunc(at()-s),a>0&&(this.performance.hand=a)),this.analyze("End Hand:"),this.analyze("Start Object:"),this.config.async?(this.config.object.modelPath.includes("nanodet")?h=this.config.object.enabled?u3(l.tensor,this.config):[]:this.config.object.modelPath.includes("centernet")&&(h=this.config.object.enabled?p3(l.tensor,this.config):[]),this.performance.object&&delete this.performance.object):(this.state="run:object",s=at(),this.config.object.modelPath.includes("nanodet")?h=this.config.object.enabled?await u3(l.tensor,this.config):[]:this.config.object.modelPath.includes("centernet")&&(h=this.config.object.enabled?await p3(l.tensor,this.config):[]),a=Math.trunc(at()-s),a>0&&(this.performance.object=a)),this.analyze("End Object:"),this.config.async&&([u,c,d,h]=await Promise.all([u,c,d,h]));let p=[];this.config.gesture.enabled&&(s=at(),p=[...J$(u),...Y$(c),...e_(d),...Q$(u)],this.config.async?this.performance.gesture&&delete this.performance.gesture:this.performance.gesture=Math.trunc(at()-s)),this.performance.total=Math.trunc(at()-i),this.state="idle",this.result={face:u,body:c,hand:d,gesture:p,object:h,performance:this.performance,canvas:l.canvas,timestamp:Date.now(),get persons(){var f;return i_(u,c,d,p,(f=l==null?void 0:l.tensor)==null?void 0:f.shape)}},Ve(l.tensor),r(this.result)})}async warmup(t){let n=at();if(t&&(this.config=ir(this.config,t)),!this.config.warmup||this.config.warmup==="none")return{error:"null"};let r;typeof createImageBitmap=="function"?r=await Fn(this,T0).call(this):typeof Image!="undefined"?r=await Fn(this,N0).call(this):r=await Fn(this,C0).call(this);let s=at();return this.config.debug&&me("Warmup",this.config.warmup,Math.round(s-n),"ms",r),r}};Du=new WeakMap,Ch=new WeakMap,Eh=new WeakMap,ki=new WeakMap,Ii=new WeakMap,Fu=new WeakMap,I0=new WeakMap,$h=new WeakMap,S0=new WeakMap,T0=new WeakMap,N0=new WeakMap,C0=new WeakMap;export{cwe as Human,cwe as default}; /** * @license * Copyright 2017 Google LLC. All Rights Reserved. diff --git a/dist/human.esm.js.map b/dist/human.esm.js.map index d0c00dd6..cccb104a 100644 --- a/dist/human.esm.js.map +++ b/dist/human.esm.js.map @@ -1,7 +1,7 @@ { "version": 3, "sources": ["../src/helpers.ts", "../src/config.ts", "../src/sysinfo.ts", "../node_modules/.pnpm/long@4.0.0/node_modules/long/src/long.js", "../node_modules/.pnpm/node-fetch@2.6.1/node_modules/node-fetch/browser.js", "../node_modules/.pnpm/seedrandom@2.4.3/node_modules/seedrandom/lib/alea.js", "../node_modules/.pnpm/seedrandom@2.4.3/node_modules/seedrandom/lib/xor128.js", "../node_modules/.pnpm/seedrandom@2.4.3/node_modules/seedrandom/lib/xorwow.js", "../node_modules/.pnpm/seedrandom@2.4.3/node_modules/seedrandom/lib/xorshift7.js", "../node_modules/.pnpm/seedrandom@2.4.3/node_modules/seedrandom/lib/xor4096.js", "../node_modules/.pnpm/seedrandom@2.4.3/node_modules/seedrandom/lib/tychei.js", "(disabled):crypto", "../node_modules/.pnpm/seedrandom@2.4.3/node_modules/seedrandom/seedrandom.js", "../node_modules/.pnpm/seedrandom@2.4.3/node_modules/seedrandom/index.js", "../node_modules/.pnpm/seedrandom@3.0.5/node_modules/seedrandom/lib/alea.js", "../node_modules/.pnpm/seedrandom@3.0.5/node_modules/seedrandom/lib/xor128.js", "../node_modules/.pnpm/seedrandom@3.0.5/node_modules/seedrandom/lib/xorwow.js", "../node_modules/.pnpm/seedrandom@3.0.5/node_modules/seedrandom/lib/xorshift7.js", "../node_modules/.pnpm/seedrandom@3.0.5/node_modules/seedrandom/lib/xor4096.js", "../node_modules/.pnpm/seedrandom@3.0.5/node_modules/seedrandom/lib/tychei.js", "../node_modules/.pnpm/seedrandom@3.0.5/node_modules/seedrandom/seedrandom.js", "../node_modules/.pnpm/seedrandom@3.0.5/node_modules/seedrandom/index.js", "../node_modules/.pnpm/string_decoder@1.1.1/node_modules/string_decoder/lib/string_decoder.js", "(disabled):path", "(disabled):worker_threads", "(disabled):perf_hooks", "../node_modules/.pnpm/@tensorflow+tfjs-backend-wasm@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-wasm/wasm-out/tfjs-backend-wasm-threaded-simd.js", "../node_modules/.pnpm/@tensorflow+tfjs-backend-wasm@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-wasm/wasm-out/tfjs-backend-wasm.js", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/backends/backend.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/util_base.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/environment.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/global_util.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/kernel_names.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/kernel_registry.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/util.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/hash_util.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/profiler.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/tape.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/tensor_format.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/tensor.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/tensor_util.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/types.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/engine.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/device_util.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/flags.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/tensor_util_env.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/operation.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/complex.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/tensor_ops_util.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/tensor.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/io/types.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/io/io_utils.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/io/router_registry.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/io/indexed_db.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/io/local_storage.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/io/model_management.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/platforms/platform_browser.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/platforms/platform_node.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/buffer.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/cast.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/clone.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/print.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/base_side_effects.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/io/io.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/io/browser_files.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/io/progress.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/io/weights_loader.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/io/http.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/io/passthrough.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/math.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/mat_mul.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/one_hot.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/transpose.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/confusion_matrix.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/browser.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/tensor3d.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/gather_nd_util.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/scatter_nd_util.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/slice_util.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/serialization.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/test_util.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/version.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/model_types.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/globals.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/add.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/floorDiv.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/div.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/mul.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/abs.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/acos.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/acosh.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/add_n.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/all.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/any.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/arg_max.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/arg_min.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/asin.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/asinh.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/atan.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/atan2.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/atanh.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/conv_util.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/reshape.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/avg_pool.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/avg_pool_3d.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/concat.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/sigmoid.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/slice.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/tanh.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/basic_lstm_cell.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/batch_to_space_nd.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/batchnorm_util.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/batchnorm.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/batchnorm2d.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/batchnorm3d.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/batchnorm4d.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/bincount.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/broadcast_to.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/ceil.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/clip_by_value.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/concat_1d.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/concat_2d.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/concat_3d.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/concat_4d.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/conv2d.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/conv1d.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/conv2d_backprop_input.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/conv2d_transpose.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/conv3d.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/conv3d_backprop_input.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/conv3d_transpose.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/cos.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/cosh.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/cumsum.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/dense_bincount.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/depth_to_space.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/depthwise_conv2d.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/diag.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/dilation2d.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/broadcast_util.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/equal.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/where.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/zeros_like.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/div_no_nan.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/dot.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/einsum.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/elu.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/erf.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/exp.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/expand_dims.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/expm1.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/tile.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/eye.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/fill.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/floor.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/gather.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/greater.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/greater_equal.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/imag.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/is_finite.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/is_inf.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/is_nan.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/leaky_relu.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/less.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/less_equal.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/linspace.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/local_response_normalization.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/log.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/log1p.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/gradients.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/neg.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/softplus.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/log_sigmoid.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/max.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/sub.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/sum.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/log_softmax.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/axis_util.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/log_sum_exp.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/logical_and.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/logical_not.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/logical_or.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/logical_xor.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/max_pool.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/max_pool_3d.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/max_pool_with_argmax.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/maximum.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/mean.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/zeros.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/ones.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/meshgrid.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/min.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/minimum.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/mirror_pad.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/mod.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/square.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/moments.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/multi_rnn_cell.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/multinomial.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/not_equal.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/ones_like.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/outer_product.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/pad.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/pad1d.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/pad2d.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/pad3d.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/pad4d.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/space_to_batch_nd.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/pool.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/pow.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/prelu.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/prod.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/rand.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/rand_util.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/random_gamma.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/random_normal.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/random_uniform.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/range.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/real.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/reciprocal.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/relu.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/relu6.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/reverse.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/reverse_1d.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/reverse_2d.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/reverse_3d.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/reverse_4d.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/round.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/rsqrt.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/scalar.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/selu.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/separable_conv2d.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/setdiff1d_async.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/sign.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/sin.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/sinh.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/slice1d.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/slice2d.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/slice3d.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/slice4d.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/softmax.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/spectral/fft.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/spectral/ifft.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/spectral/irfft.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/split.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/spectral/rfft.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/sqrt.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/squared_difference.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/squeeze.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/stack.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/step.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/strided_slice.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/tan.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/tensor1d.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/tensor2d.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/tensor4d.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/tensor5d.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/tensor6d.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/topk.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/truncated_normal.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/unique.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/unsorted_segment_sum.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/unstack.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/variable.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/backends/where_impl.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/where_async.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/boolean_mask.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/norm.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/moving_average.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/scatter_nd.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/sparse_to_dense_util.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/sparse_to_dense.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/gather_nd.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/dropout_util.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/dropout.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/signal_ops_util.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/in_top_k.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/fused_ops.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/conv2d_backprop_filter.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/fused_util.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/fused/conv2d.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/depthwise_conv2d_native_backprop_filter.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/depthwise_conv2d_native_backprop_input.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/fused/depthwise_conv2d.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/fused/mat_mul.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/fused_types.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/signal/hamming_window.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/signal/hann_window.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/signal/frame.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/signal/stft.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/image/crop_and_resize.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/image/flip_left_right.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/image/rotate_with_offset.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/nonmax_util.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/image/non_max_suppression.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/backends/non_max_suppression_util.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/backends/non_max_suppression_impl.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/image/non_max_suppression_async.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/image/non_max_suppression_with_score.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/image/non_max_suppression_with_score_async.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/image/non_max_suppression_padded.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/image/non_max_suppression_padded_async.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/image/resize_bilinear.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/image/resize_nearest_neighbor.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/image/threshold.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/image/transform.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/linalg/band_part.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/linalg/gram_schmidt.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/linalg/qr.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/loss_ops_utils.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/losses/compute_weighted_loss.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/losses/absolute_difference.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/losses/cosine_distance.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/losses/hinge_loss.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/losses/huber_loss.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/losses/log_loss.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/losses/mean_squared_error.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/losses/sigmoid_cross_entropy.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/losses/softmax_cross_entropy.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/sparse/sparse_fill_empty_rows.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/sparse/sparse_reshape.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/sparse/sparse_segment_mean.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/sparse/sparse_segment_sum.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/string/string_n_grams.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/string/string_split.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/string/string_to_hash_bucket_fast.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/ops.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/optimizers/optimizer.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/optimizers/adadelta_optimizer.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/optimizers/adagrad_optimizer.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/optimizers/adam_optimizer.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/optimizers/adamax_optimizer.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/optimizers/sgd_optimizer.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/optimizers/momentum_optimizer.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/optimizers/rmsprop_optimizer.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/tensor_types.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/optimizers/optimizer_constructors.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/train.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/platforms/platform.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/browser_util.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/backends/backend_util.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/concat_util.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/reduce_util.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/rotate_util.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/array_ops_util.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/selu_util.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/erf_util.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/log.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/backends/complex_util.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/backends/einsum_util.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/split_util.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/segment_util.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/backends/kernel_impls.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/base.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/index.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/backends/backend.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/util_base.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/environment.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/global_util.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/kernel_names.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/kernel_registry.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/util.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/hash_util.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/profiler.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/tape.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/tensor_format.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/tensor.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/tensor_util.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/types.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/engine.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/device_util.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/flags.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/tensor_util_env.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/operation.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/complex.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/tensor_ops_util.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/tensor.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/io/types.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/io/io_utils.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/io/router_registry.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/io/indexed_db.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/io/local_storage.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/io/model_management.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/platforms/platform_browser.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/platforms/platform_node.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/buffer.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/cast.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/clone.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/print.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/base_side_effects.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/io/io.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/io/browser_files.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/io/progress.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/io/weights_loader.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/io/http.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/io/passthrough.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/mat_mul.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/one_hot.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/transpose.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/confusion_matrix.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/math.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/browser.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/tensor3d.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/gather_nd_util.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/scatter_nd_util.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/slice_util.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/serialization.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/test_util.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/version.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/globals.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/add.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/floorDiv.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/div.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/mul.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/abs.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/acos.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/acosh.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/add_n.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/all.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/any.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/arg_max.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/arg_min.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/asin.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/asinh.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/atan.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/atan2.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/atanh.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/conv_util.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/reshape.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/avg_pool.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/avg_pool_3d.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/concat.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/sigmoid.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/slice.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/tanh.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/basic_lstm_cell.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/batch_to_space_nd.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/batchnorm_util.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/batchnorm.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/batchnorm2d.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/batchnorm3d.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/batchnorm4d.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/bincount.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/broadcast_to.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/ceil.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/clip_by_value.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/concat_1d.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/concat_2d.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/concat_3d.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/concat_4d.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/conv2d.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/conv1d.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/conv2d_backprop_input.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/conv2d_transpose.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/conv3d.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/conv3d_backprop_input.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/conv3d_transpose.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/cos.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/cosh.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/cumsum.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/dense_bincount.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/depth_to_space.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/depthwise_conv2d.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/diag.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/dilation2d.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/broadcast_util.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/equal.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/where.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/zeros_like.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/div_no_nan.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/dot.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/einsum.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/elu.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/erf.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/exp.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/expand_dims.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/expm1.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/tile.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/eye.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/fill.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/floor.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/gather.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/greater.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/greater_equal.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/imag.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/is_finite.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/is_inf.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/is_nan.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/leaky_relu.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/less.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/less_equal.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/linspace.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/local_response_normalization.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/log.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/log1p.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/gradients.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/neg.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/softplus.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/log_sigmoid.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/max.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/sub.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/sum.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/log_softmax.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/axis_util.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/log_sum_exp.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/logical_and.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/logical_not.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/logical_or.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/logical_xor.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/max_pool.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/max_pool_3d.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/max_pool_with_argmax.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/maximum.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/mean.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/zeros.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/ones.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/meshgrid.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/min.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/minimum.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/mirror_pad.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/mod.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/square.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/moments.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/multi_rnn_cell.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/multinomial.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/not_equal.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/ones_like.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/outer_product.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/pad.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/pad1d.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/pad2d.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/pad3d.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/pad4d.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/space_to_batch_nd.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/pool.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/pow.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/prelu.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/prod.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/rand.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/rand_util.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/random_gamma.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/random_normal.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/random_uniform.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/range.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/real.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/reciprocal.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/relu.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/relu6.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/reverse.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/reverse_1d.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/reverse_2d.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/reverse_3d.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/reverse_4d.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/round.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/rsqrt.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/scalar.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/selu.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/separable_conv2d.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/setdiff1d_async.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/sign.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/sin.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/sinh.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/slice1d.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/slice2d.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/slice3d.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/slice4d.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/softmax.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/spectral/fft.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/spectral/ifft.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/spectral/irfft.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/split.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/spectral/rfft.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/sqrt.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/squared_difference.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/squeeze.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/stack.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/step.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/strided_slice.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/tan.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/tensor1d.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/tensor2d.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/tensor4d.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/tensor5d.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/tensor6d.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/topk.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/truncated_normal.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/unique.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/unsorted_segment_sum.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/unstack.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/variable.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/backends/where_impl.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/where_async.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/boolean_mask.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/norm.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/moving_average.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/scatter_nd.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/sparse_to_dense_util.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/sparse_to_dense.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/gather_nd.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/dropout_util.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/dropout.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/signal_ops_util.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/in_top_k.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/fused_ops.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/conv2d_backprop_filter.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/fused_util.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/fused/conv2d.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/depthwise_conv2d_native_backprop_filter.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/depthwise_conv2d_native_backprop_input.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/fused/depthwise_conv2d.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/fused/mat_mul.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/signal/hamming_window.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/signal/hann_window.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/signal/frame.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/signal/stft.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/image/crop_and_resize.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/image/flip_left_right.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/image/rotate_with_offset.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/nonmax_util.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/image/non_max_suppression.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/backends/non_max_suppression_util.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/backends/non_max_suppression_impl.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/image/non_max_suppression_async.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/image/non_max_suppression_with_score.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/image/non_max_suppression_with_score_async.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/image/non_max_suppression_padded.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/image/non_max_suppression_padded_async.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/image/resize_bilinear.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/image/resize_nearest_neighbor.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/image/threshold.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/image/transform.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/linalg/band_part.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/linalg/gram_schmidt.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/linalg/qr.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/loss_ops_utils.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/losses/compute_weighted_loss.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/losses/absolute_difference.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/losses/cosine_distance.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/losses/hinge_loss.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/losses/huber_loss.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/losses/log_loss.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/losses/mean_squared_error.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/losses/sigmoid_cross_entropy.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/losses/softmax_cross_entropy.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/sparse/sparse_fill_empty_rows.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/sparse/sparse_reshape.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/sparse/sparse_segment_mean.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/sparse/sparse_segment_sum.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/string/string_n_grams.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/string/string_split.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/string/string_to_hash_bucket_fast.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/ops.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/optimizers/optimizer.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/optimizers/adadelta_optimizer.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/optimizers/adagrad_optimizer.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/optimizers/adam_optimizer.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/optimizers/adamax_optimizer.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/optimizers/sgd_optimizer.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/optimizers/momentum_optimizer.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/optimizers/rmsprop_optimizer.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/optimizers/optimizer_constructors.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/train.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/browser_util.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/backends/backend_util.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/concat_util.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/reduce_util.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/rotate_util.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/array_ops_util.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/selu_util.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/erf_util.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/log.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/backends/complex_util.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/backends/einsum_util.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/split_util.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/segment_util.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/backends/kernel_impls.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/base.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/index.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/public/chained_ops/abs.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/public/chained_ops/acos.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/public/chained_ops/acosh.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/public/chained_ops/add.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/public/chained_ops/all.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/public/chained_ops/any.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/public/chained_ops/arg_max.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/public/chained_ops/arg_min.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/public/chained_ops/as_scalar.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/public/chained_ops/as_type.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/public/chained_ops/as1d.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/public/chained_ops/as2d.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/public/chained_ops/as3d.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/public/chained_ops/as4d.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/public/chained_ops/as5d.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/public/chained_ops/asin.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/public/chained_ops/asinh.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/public/chained_ops/atan.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/public/chained_ops/atan2.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/public/chained_ops/atanh.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/public/chained_ops/avg_pool.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/public/chained_ops/batch_to_space_nd.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/public/chained_ops/batchnorm.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/public/chained_ops/broadcast_to.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/public/chained_ops/cast.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/public/chained_ops/ceil.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/public/chained_ops/clip_by_value.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/public/chained_ops/concat.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/public/chained_ops/conv1d.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/public/chained_ops/conv2d_transpose.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/public/chained_ops/conv2d.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/public/chained_ops/cos.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/public/chained_ops/cosh.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/public/chained_ops/cumsum.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/public/chained_ops/depth_to_space.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/public/chained_ops/depthwise_conv2d.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/public/chained_ops/dilation2d.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/public/chained_ops/div_no_nan.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/public/chained_ops/div.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/public/chained_ops/dot.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/public/chained_ops/elu.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/public/chained_ops/equal.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/public/chained_ops/erf.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/public/chained_ops/exp.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/public/chained_ops/expand_dims.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/public/chained_ops/expm1.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/public/chained_ops/fft.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/public/chained_ops/flatten.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/public/chained_ops/floor.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/public/chained_ops/floorDiv.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/public/chained_ops/gather.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/public/chained_ops/greater_equal.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/public/chained_ops/greater.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/public/chained_ops/ifft.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/public/chained_ops/irfft.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/public/chained_ops/is_finite.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/public/chained_ops/is_inf.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/public/chained_ops/is_nan.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/public/chained_ops/leaky_relu.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/public/chained_ops/less_equal.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/public/chained_ops/less.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/public/chained_ops/local_response_normalization.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/public/chained_ops/log_sigmoid.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/public/chained_ops/log_softmax.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/public/chained_ops/log_sum_exp.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/public/chained_ops/log.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/public/chained_ops/log1p.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/public/chained_ops/logical_and.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/public/chained_ops/logical_not.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/public/chained_ops/logical_or.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/public/chained_ops/logical_xor.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/public/chained_ops/mat_mul.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/public/chained_ops/max_pool.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/public/chained_ops/max.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/public/chained_ops/maximum.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/public/chained_ops/mean.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/public/chained_ops/min.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/public/chained_ops/minimum.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/public/chained_ops/mirror_pad.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/public/chained_ops/mod.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/public/chained_ops/mul.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/public/chained_ops/neg.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/public/chained_ops/norm.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/public/chained_ops/not_equal.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/public/chained_ops/one_hot.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/public/chained_ops/ones_like.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/public/chained_ops/pad.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/public/chained_ops/pool.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/public/chained_ops/pow.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/public/chained_ops/prelu.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/public/chained_ops/prod.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/public/chained_ops/reciprocal.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/public/chained_ops/relu.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/public/chained_ops/relu6.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/public/chained_ops/reshape_as.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/public/chained_ops/reshape.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/public/chained_ops/resize_bilinear.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/public/chained_ops/resize_nearest_neighbor.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/public/chained_ops/reverse.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/public/chained_ops/rfft.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/public/chained_ops/round.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/public/chained_ops/rsqrt.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/public/chained_ops/selu.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/public/chained_ops/separable_conv2d.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/public/chained_ops/sigmoid.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/public/chained_ops/sign.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/public/chained_ops/sin.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/public/chained_ops/sinh.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/public/chained_ops/slice.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/public/chained_ops/softmax.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/public/chained_ops/softplus.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/public/chained_ops/space_to_batch_nd.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/public/chained_ops/split.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/public/chained_ops/sqrt.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/public/chained_ops/square.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/public/chained_ops/squared_difference.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/public/chained_ops/squeeze.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/public/chained_ops/stack.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/public/chained_ops/step.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/public/chained_ops/strided_slice.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/public/chained_ops/sub.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/public/chained_ops/sum.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/public/chained_ops/tan.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/public/chained_ops/tanh.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/public/chained_ops/tile.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/public/chained_ops/to_bool.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/public/chained_ops/to_float.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/public/chained_ops/to_int.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/public/chained_ops/topk.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/public/chained_ops/transpose.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/public/chained_ops/unique.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/public/chained_ops/unsorted_segment_sum.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/public/chained_ops/unstack.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/public/chained_ops/where.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/public/chained_ops/zeros_like.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/public/chained_ops/register_all_chained_ops.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/gradients/Abs_grad.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/gradients/Acos_grad.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/gradients/Acosh_grad.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/gradients/Add_grad.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/gradients/AddN_grad.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/gradients/ArgMax_grad.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/gradients/ArgMin_grad.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/gradients/Asin_grad.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/gradients/Asinh_grad.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/gradients/Atan2_grad.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/gradients/Atan_grad.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/gradients/Atanh_grad.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/avg_pool_3d_grad.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/gradients/AvgPool3D_grad.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/avg_pool_grad.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/gradients/AvgPool_grad.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/gradients/BatchMatMul_grad.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/gradients/BatchToSpaceND_grad.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/gradients/BroadcastTo_grad.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/gradients/Cast_grad.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/gradients/Ceil_grad.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/gradients/ClipByValue_grad.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/gradients/ComplexAbs_grad.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/gradients/Concat_grad.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/gradients/Conv2D_grad.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/gradients/Conv2DBackpropInput_grad.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/conv3d_backprop_filter.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/gradients/Conv3D_grad.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/gradients/Cos_grad.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/gradients/Cosh_grad.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/gradients/Cumsum_grad.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/gradients/DepthwiseConv2dNative_grad.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/gradients/Dilation2D_grad.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/gradients/Elu_grad.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/gradients/Erf_grad.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/gradients/Exp_grad.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/gradients/ExpandDims_grad.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/gradients/Expm1_grad.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/gradients/Floor_grad.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/gradients/FloorDiv_grad.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/gradients/FusedBatchNorm_grad.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/gradients/GatherV2_grad.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/gradients/GreaterEqual_grad.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/gradients/Identity_grad.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/gradients/IsFinite_grad.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/gradients/IsInf_grad.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/gradients/IsNan_grad.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/gradients/LeakyRelu_grad.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/gradients/Log1p_grad.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/gradients/Log_grad.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/gradients/LogSoftmax_grad.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/local_response_normalization_backprop.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/gradients/LRN_grad.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/gradients/min_max_grad_util.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/gradients/Max_grad.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/gradients/Maximum_grad.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/max_pool_3d_grad.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/gradients/MaxPool3D_grad.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/max_pool_grad.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/gradients/MaxPool_grad.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/gradients/Mean_grad.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/gradients/Min_grad.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/gradients/Minimum_grad.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/gradients/MirrorPad_grad.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/gradients/Mod_grad.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/gradients/Multiply_grad.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/gradients/Neg_grad.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/gradients/OneHot_grad.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/gradients/OnesLike_grad.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/gradients/Pack_grad.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/gradients/PadV2_grad.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/gradients/Pow_grad.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/gradients/Prelu_grad.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/gradients/RealDiv_grad.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/gradients/Reciprocal_grad.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/gradients/Relu6_grad.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/gradients/Relu_grad.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/gradients/Reshape_grad.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/gradients/ResizeBilinear_grad.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/gradients/ResizeNearestNeighbor_grad.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/gradients/Reverse_grad.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/gradients/Round_grad.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/gradients/Rsqrt_grad.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/gradients/Select_grad.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/gradients/Selu_grad.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/gradients/Sigmoid_grad.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/gradients/Sign_grad.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/gradients/Sin_grad.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/gradients/Sinh_grad.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/gradients/Slice_grad.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/gradients/Softmax_grad.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/gradients/Softplus_grad.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/gradients/SpaceToBatchND_grad.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/gradients/SplitV_grad.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/gradients/Sqrt_grad.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/gradients/Square_grad.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/gradients/SquaredDifference_grad.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/gradients/Step_grad.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/gradients/Sub_grad.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/gradients/Sum_grad.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/gradients/Tan_grad.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/gradients/Tanh_grad.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/gradients/Tile_grad.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/gradients/Transpose_grad.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/gradients/Unpack_grad.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/gradients/UnsortedSegmentSum_grad.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/gradients/ZerosLike_grad.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/register_all_gradients.ts", "../node_modules/.pnpm/@tensorflow+tfjs-layers@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-layers/src/exports_constraints.ts", "../node_modules/.pnpm/@tensorflow+tfjs-layers@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-layers/src/backend/common.ts", "../node_modules/.pnpm/@tensorflow+tfjs-layers@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-layers/src/errors.ts", "../node_modules/.pnpm/@tensorflow+tfjs-layers@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-layers/src/utils/generic_utils.ts", "../node_modules/.pnpm/@tensorflow+tfjs-layers@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-layers/src/constraints.ts", "../node_modules/.pnpm/@tensorflow+tfjs-layers@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-layers/src/exports_initializers.ts", "../node_modules/.pnpm/@tensorflow+tfjs-layers@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-layers/src/keras_format/common.ts", "../node_modules/.pnpm/@tensorflow+tfjs-layers@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-layers/src/common.ts", "../node_modules/.pnpm/@tensorflow+tfjs-layers@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-layers/src/utils/math_utils.ts", "../node_modules/.pnpm/@tensorflow+tfjs-layers@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-layers/src/backend/tfjs_backend.ts", "../node_modules/.pnpm/@tensorflow+tfjs-layers@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-layers/src/keras_format/initializer_config.ts", "../node_modules/.pnpm/@tensorflow+tfjs-layers@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-layers/src/initializers.ts", "../node_modules/.pnpm/@tensorflow+tfjs-layers@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-layers/src/exports_layers.ts", "../node_modules/.pnpm/@tensorflow+tfjs-layers@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-layers/src/backend/state.ts", "../node_modules/.pnpm/@tensorflow+tfjs-layers@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-layers/src/utils/types_utils.ts", "../node_modules/.pnpm/@tensorflow+tfjs-layers@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-layers/src/utils/variable_utils.ts", "../node_modules/.pnpm/@tensorflow+tfjs-layers@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-layers/src/variables.ts", "../node_modules/.pnpm/@tensorflow+tfjs-layers@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-layers/src/engine/topology.ts", "../node_modules/.pnpm/@tensorflow+tfjs-layers@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-layers/src/engine/input_layer.ts", "../node_modules/.pnpm/@tensorflow+tfjs-layers@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-layers/src/logs.ts", "../node_modules/.pnpm/@tensorflow+tfjs-layers@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-layers/src/base_callbacks.ts", "../node_modules/.pnpm/@tensorflow+tfjs-layers@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-layers/src/layers/serialization.ts", "../node_modules/.pnpm/@tensorflow+tfjs-layers@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-layers/src/losses.ts", "../node_modules/.pnpm/@tensorflow+tfjs-layers@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-layers/src/metrics.ts", "../node_modules/.pnpm/@tensorflow+tfjs-layers@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-layers/src/optimizers.ts", "../node_modules/.pnpm/@tensorflow+tfjs-layers@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-layers/src/user_defined_metadata.ts", "../node_modules/.pnpm/@tensorflow+tfjs-layers@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-layers/src/utils/layer_utils.ts", "../node_modules/.pnpm/@tensorflow+tfjs-layers@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-layers/src/utils/serialization_utils.ts", "../node_modules/.pnpm/@tensorflow+tfjs-layers@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-layers/src/version.ts", "../node_modules/.pnpm/@tensorflow+tfjs-layers@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-layers/src/engine/executor.ts", "../node_modules/.pnpm/@tensorflow+tfjs-layers@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-layers/src/engine/container.ts", "../node_modules/.pnpm/@tensorflow+tfjs-layers@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-layers/src/engine/training_utils.ts", "../node_modules/.pnpm/@tensorflow+tfjs-layers@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-layers/src/engine/training_dataset.ts", "../node_modules/.pnpm/@tensorflow+tfjs-layers@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-layers/src/engine/training_tensors.ts", "../node_modules/.pnpm/@tensorflow+tfjs-layers@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-layers/src/engine/training.ts", "../node_modules/.pnpm/@tensorflow+tfjs-layers@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-layers/src/models.ts", "../node_modules/.pnpm/@tensorflow+tfjs-layers@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-layers/src/exports.ts", "../node_modules/.pnpm/@tensorflow+tfjs-layers@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-layers/src/activations.ts", "../node_modules/.pnpm/@tensorflow+tfjs-layers@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-layers/src/regularizers.ts", "../node_modules/.pnpm/@tensorflow+tfjs-layers@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-layers/src/layers/advanced_activations.ts", "../node_modules/.pnpm/@tensorflow+tfjs-layers@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-layers/src/utils/conv_utils.ts", "../node_modules/.pnpm/@tensorflow+tfjs-layers@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-layers/src/layers/convolutional.ts", "../node_modules/.pnpm/@tensorflow+tfjs-layers@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-layers/src/layers/convolutional_depthwise.ts", "../node_modules/.pnpm/@tensorflow+tfjs-layers@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-layers/src/layers/recurrent.ts", "../node_modules/.pnpm/@tensorflow+tfjs-layers@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-layers/src/layers/convolutional_recurrent.ts", "../node_modules/.pnpm/@tensorflow+tfjs-layers@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-layers/src/layers/core.ts", "../node_modules/.pnpm/@tensorflow+tfjs-layers@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-layers/src/layers/embeddings.ts", "../node_modules/.pnpm/@tensorflow+tfjs-layers@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-layers/src/layers/merge.ts", "../node_modules/.pnpm/@tensorflow+tfjs-layers@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-layers/src/layers/noise.ts", "../node_modules/.pnpm/@tensorflow+tfjs-layers@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-layers/src/layers/normalization.ts", "../node_modules/.pnpm/@tensorflow+tfjs-layers@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-layers/src/layers/padding.ts", "../node_modules/.pnpm/@tensorflow+tfjs-layers@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-layers/src/layers/pooling.ts", "../node_modules/.pnpm/@tensorflow+tfjs-layers@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-layers/src/layers/wrappers.ts", "../node_modules/.pnpm/@tensorflow+tfjs-layers@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-layers/src/exports_metrics.ts", "../node_modules/.pnpm/@tensorflow+tfjs-layers@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-layers/src/exports_models.ts", "../node_modules/.pnpm/@tensorflow+tfjs-layers@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-layers/src/exports_regularizers.ts", "../node_modules/.pnpm/@tensorflow+tfjs-layers@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-layers/src/callbacks.ts", "../node_modules/.pnpm/@tensorflow+tfjs-layers@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-layers/src/index.ts", "../node_modules/.pnpm/@tensorflow+tfjs-converter@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-converter/src/data/compiled_api.ts", "../node_modules/.pnpm/@tensorflow+tfjs-converter@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-converter/src/operations/custom_op/register.ts", "../node_modules/.pnpm/@tensorflow+tfjs-converter@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-converter/src/operations/executors/utils.ts", "../node_modules/.pnpm/@tensorflow+tfjs-converter@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-converter/src/operations/op_list/arithmetic.ts", "../node_modules/.pnpm/@tensorflow+tfjs-converter@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-converter/src/operations/op_list/basic_math.ts", "../node_modules/.pnpm/@tensorflow+tfjs-converter@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-converter/src/operations/op_list/control.ts", "../node_modules/.pnpm/@tensorflow+tfjs-converter@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-converter/src/operations/op_list/convolution.ts", "../node_modules/.pnpm/@tensorflow+tfjs-converter@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-converter/src/operations/op_list/creation.ts", "../node_modules/.pnpm/@tensorflow+tfjs-converter@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-converter/src/operations/op_list/dynamic.ts", "../node_modules/.pnpm/@tensorflow+tfjs-converter@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-converter/src/operations/op_list/evaluation.ts", "../node_modules/.pnpm/@tensorflow+tfjs-converter@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-converter/src/operations/op_list/graph.ts", "../node_modules/.pnpm/@tensorflow+tfjs-converter@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-converter/src/operations/op_list/hash_table.ts", "../node_modules/.pnpm/@tensorflow+tfjs-converter@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-converter/src/operations/op_list/image.ts", "../node_modules/.pnpm/@tensorflow+tfjs-converter@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-converter/src/operations/op_list/logical.ts", "../node_modules/.pnpm/@tensorflow+tfjs-converter@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-converter/src/operations/op_list/matrices.ts", "../node_modules/.pnpm/@tensorflow+tfjs-converter@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-converter/src/operations/op_list/normalization.ts", "../node_modules/.pnpm/@tensorflow+tfjs-converter@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-converter/src/operations/op_list/reduction.ts", "../node_modules/.pnpm/@tensorflow+tfjs-converter@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-converter/src/operations/op_list/slice_join.ts", "../node_modules/.pnpm/@tensorflow+tfjs-converter@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-converter/src/operations/op_list/sparse.ts", "../node_modules/.pnpm/@tensorflow+tfjs-converter@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-converter/src/operations/op_list/spectral.ts", "../node_modules/.pnpm/@tensorflow+tfjs-converter@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-converter/src/operations/op_list/string.ts", "../node_modules/.pnpm/@tensorflow+tfjs-converter@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-converter/src/operations/op_list/transformation.ts", "../node_modules/.pnpm/@tensorflow+tfjs-converter@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-converter/src/operations/operation_mapper.ts", "../node_modules/.pnpm/@tensorflow+tfjs-converter@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-converter/src/operations/custom_op/node_value_impl.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-core/src/ops/ops_for_converter.ts", "../node_modules/.pnpm/@tensorflow+tfjs-converter@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-converter/src/operations/executors/arithmetic_executor.ts", "../node_modules/.pnpm/@tensorflow+tfjs-converter@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-converter/src/operations/executors/basic_math_executor.ts", "../node_modules/.pnpm/@tensorflow+tfjs-converter@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-converter/src/executor/tensor_utils.ts", "../node_modules/.pnpm/@tensorflow+tfjs-converter@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-converter/src/executor/tensor_array.ts", "../node_modules/.pnpm/@tensorflow+tfjs-converter@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-converter/src/executor/tensor_list.ts", "../node_modules/.pnpm/@tensorflow+tfjs-converter@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-converter/src/operations/executors/control_executor.ts", "../node_modules/.pnpm/@tensorflow+tfjs-converter@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-converter/src/operations/executors/convolution_executor.ts", "../node_modules/.pnpm/@tensorflow+tfjs-converter@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-converter/src/operations/executors/creation_executor.ts", "../node_modules/.pnpm/@tensorflow+tfjs-converter@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-converter/src/operations/executors/dynamic_executor.ts", "../node_modules/.pnpm/@tensorflow+tfjs-converter@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-converter/src/operations/executors/evaluation_executor.ts", "../node_modules/.pnpm/@tensorflow+tfjs-converter@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-converter/src/operations/executors/graph_executor.ts", "../node_modules/.pnpm/@tensorflow+tfjs-converter@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-converter/src/executor/hash_table.ts", "../node_modules/.pnpm/@tensorflow+tfjs-converter@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-converter/src/operations/executors/hash_table_executor.ts", "../node_modules/.pnpm/@tensorflow+tfjs-converter@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-converter/src/operations/executors/image_executor.ts", "../node_modules/.pnpm/@tensorflow+tfjs-converter@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-converter/src/operations/executors/logical_executor.ts", "../node_modules/.pnpm/@tensorflow+tfjs-converter@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-converter/src/operations/executors/matrices_executor.ts", "../node_modules/.pnpm/@tensorflow+tfjs-converter@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-converter/src/operations/executors/normalization_executor.ts", "../node_modules/.pnpm/@tensorflow+tfjs-converter@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-converter/src/operations/executors/reduction_executor.ts", "../node_modules/.pnpm/@tensorflow+tfjs-converter@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-converter/src/operations/executors/slice_join_executor.ts", "../node_modules/.pnpm/@tensorflow+tfjs-converter@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-converter/src/operations/executors/sparse_executor.ts", "../node_modules/.pnpm/@tensorflow+tfjs-converter@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-converter/src/operations/executors/spectral_executor.ts", "../node_modules/.pnpm/@tensorflow+tfjs-converter@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-converter/src/operations/executors/string_executor.ts", "../node_modules/.pnpm/@tensorflow+tfjs-converter@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-converter/src/operations/executors/transformation_executor.ts", "../node_modules/.pnpm/@tensorflow+tfjs-converter@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-converter/src/operations/operation_executor.ts", "../node_modules/.pnpm/@tensorflow+tfjs-converter@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-converter/src/executor/execution_context.ts", "../node_modules/.pnpm/@tensorflow+tfjs-converter@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-converter/src/executor/model_analysis.ts", "../node_modules/.pnpm/@tensorflow+tfjs-converter@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-converter/src/executor/graph_executor.ts", "../node_modules/.pnpm/@tensorflow+tfjs-converter@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-converter/src/executor/resource_manager.ts", "../node_modules/.pnpm/@tensorflow+tfjs-converter@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-converter/src/executor/graph_model.ts", "../node_modules/.pnpm/@tensorflow+tfjs-converter@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-converter/src/operations/types.ts", "../node_modules/.pnpm/@tensorflow+tfjs-converter@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-converter/src/version.ts", "../node_modules/.pnpm/@tensorflow+tfjs-converter@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-converter/src/index.ts", "../node_modules/.pnpm/@tensorflow+tfjs-data@3.7.0_2d23fca999276b6587569019c21cba8f/node_modules/@tensorflow/tfjs-data/src/index.ts", "../node_modules/.pnpm/@tensorflow+tfjs-data@3.7.0_2d23fca999276b6587569019c21cba8f/node_modules/@tensorflow/tfjs-data/src/dataset.ts", "../node_modules/.pnpm/@tensorflow+tfjs-data@3.7.0_2d23fca999276b6587569019c21cba8f/node_modules/@tensorflow/tfjs-data/src/iterators/lazy_iterator.ts", "../node_modules/.pnpm/@tensorflow+tfjs-data@3.7.0_2d23fca999276b6587569019c21cba8f/node_modules/@tensorflow/tfjs-data/src/util/deep_map.ts", "../node_modules/.pnpm/@tensorflow+tfjs-data@3.7.0_2d23fca999276b6587569019c21cba8f/node_modules/@tensorflow/tfjs-data/src/util/deep_clone.ts", "../node_modules/.pnpm/@tensorflow+tfjs-data@3.7.0_2d23fca999276b6587569019c21cba8f/node_modules/@tensorflow/tfjs-data/src/util/ring_buffer.ts", "../node_modules/.pnpm/@tensorflow+tfjs-data@3.7.0_2d23fca999276b6587569019c21cba8f/node_modules/@tensorflow/tfjs-data/src/util/growing_ring_buffer.ts", "../node_modules/.pnpm/@tensorflow+tfjs-data@3.7.0_2d23fca999276b6587569019c21cba8f/node_modules/@tensorflow/tfjs-data/src/datasets/text_line_dataset.ts", "../node_modules/.pnpm/@tensorflow+tfjs-data@3.7.0_2d23fca999276b6587569019c21cba8f/node_modules/@tensorflow/tfjs-data/src/datasets/csv_dataset.ts", "../node_modules/.pnpm/@tensorflow+tfjs-data@3.7.0_2d23fca999276b6587569019c21cba8f/node_modules/@tensorflow/tfjs-data/src/iterators/microphone_iterator.ts", "../node_modules/.pnpm/@tensorflow+tfjs-data@3.7.0_2d23fca999276b6587569019c21cba8f/node_modules/@tensorflow/tfjs-data/src/iterators/webcam_iterator.ts", "../node_modules/.pnpm/@tensorflow+tfjs-data@3.7.0_2d23fca999276b6587569019c21cba8f/node_modules/@tensorflow/tfjs-data/src/datasource.ts", "../node_modules/.pnpm/@tensorflow+tfjs-data@3.7.0_2d23fca999276b6587569019c21cba8f/node_modules/@tensorflow/tfjs-data/src/iterators/string_iterator.ts", "../node_modules/.pnpm/@tensorflow+tfjs-data@3.7.0_2d23fca999276b6587569019c21cba8f/node_modules/@tensorflow/tfjs-data/src/iterators/byte_chunk_iterator.ts", "../node_modules/.pnpm/@tensorflow+tfjs-data@3.7.0_2d23fca999276b6587569019c21cba8f/node_modules/@tensorflow/tfjs-data/src/iterators/file_chunk_iterator.ts", "../node_modules/.pnpm/@tensorflow+tfjs-data@3.7.0_2d23fca999276b6587569019c21cba8f/node_modules/@tensorflow/tfjs-data/src/iterators/url_chunk_iterator.ts", "../node_modules/.pnpm/@tensorflow+tfjs-data@3.7.0_2d23fca999276b6587569019c21cba8f/node_modules/@tensorflow/tfjs-data/src/util/source_util.ts", "../node_modules/.pnpm/@tensorflow+tfjs-data@3.7.0_2d23fca999276b6587569019c21cba8f/node_modules/@tensorflow/tfjs-data/src/sources/file_data_source.ts", "../node_modules/.pnpm/@tensorflow+tfjs-data@3.7.0_2d23fca999276b6587569019c21cba8f/node_modules/@tensorflow/tfjs-data/src/sources/url_data_source.ts", "../node_modules/.pnpm/@tensorflow+tfjs-data@3.7.0_2d23fca999276b6587569019c21cba8f/node_modules/@tensorflow/tfjs-data/src/readers.ts", "../node_modules/.pnpm/@tensorflow+tfjs-data@3.7.0_2d23fca999276b6587569019c21cba8f/node_modules/@tensorflow/tfjs-data/src/types.ts", "../node_modules/.pnpm/@tensorflow+tfjs-data@3.7.0_2d23fca999276b6587569019c21cba8f/node_modules/@tensorflow/tfjs-data/src/version.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-cpu/src/cpu_util.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-cpu/src/backend_cpu.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-cpu/src/shared.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/Abs.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-cpu/src/utils/binary_impl.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/Complex.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-cpu/src/utils/zeros_impl.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/Identity.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/Real.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/Cast.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-cpu/src/utils/binary_utils.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/Add.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/Bincount_impl.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-cpu/src/utils/unary_impl.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-cpu/src/utils/unary_utils.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/Ceil.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/Concat_impl.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/Equal.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/Exp.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/Expm1.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/Floor.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/GatherNd_Impl.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/GatherV2_impl.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/Greater.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/GreaterEqual.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/Less.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/LessEqual.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/LinSpace_impl.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/Log.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/Max_impl.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/Maximum.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/Minimum.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/Multiply.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/Neg.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/NotEqual.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/Transpose_impl.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/Transpose.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/Prod.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/Range_impl.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/Rsqrt.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/Slice.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/SparseFillEmptyRows_impl.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/SparseReshape_impl.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/SparseSegmentReduction_impl.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/SquaredDifference.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/StridedSlice_impl.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/StringNGrams_impl.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/StringSplit_impl.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/StringToHashBucketFast_impl.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/Sub.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/Tile_impl.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/TopK_impl.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/Unique_impl.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-cpu/src/utils/binary_types.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-cpu/src/version.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-cpu/src/base.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/Elu.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/LeakyRelu.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/Prelu.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/Relu.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/Relu6.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/Sigmoid.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-cpu/src/utils/fused_utils.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/Reshape.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/BatchMatMul.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/_FusedMatMul.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/Acos.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/Acosh.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/AddN.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/All.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/Any.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/ArgMax.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/ArgMin.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/Asin.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/Asinh.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/Atan.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/Atan2.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/Atanh.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-cpu/src/utils/pool_utils.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/AvgPool.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/AvgPool3D.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/AvgPool3DGrad.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/AvgPoolGrad.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/BatchNorm.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/BatchToSpaceND.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/Bincount.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/Clip.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/ComplexAbs.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/Imag.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/Concat.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/Conv2D.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/Conv2DBackpropFilter.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/Conv2DBackpropInput.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/Conv3D.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/Conv3DBackpropFilterV2.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/Conv3DBackpropInputV2.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/Cos.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/Cosh.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/CropAndResize.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/Cumsum.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/DenseBincount.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/DepthToSpace.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/DepthwiseConv2dNative.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/DepthwiseConv2dNativeBackpropFilter.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/DepthwiseConv2dNativeBackpropInput.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/Diag.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/Dilation2D.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/Dilation2DBackpropFilter.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/Dilation2DBackpropInput.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/Sum.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/Einsum.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/EluGrad.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/Erf.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/ExpandDims.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/RealDiv.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-cpu/src/utils/fft_utils.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/FFT.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/Fill.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/FlipLeftRight.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/FloorDiv.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/FusedConv2D.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/FusedDepthwiseConv2D.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/GatherNd.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/GatherV2.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/IFFT.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/IsFinite.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/IsInf.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/IsNaN.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/LinSpace.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/Log1p.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/LogicalAnd.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/LogicalNot.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/LogicalOr.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/LRN.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/LRNGrad.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/Max.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/MaxPool.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/MaxPool3D.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/MaxPool3DGrad.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/MaxPoolGrad.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/MaxPoolWithArgmax_impl.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/MaxPoolWithArgmax.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/Mean.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/Min.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/MirrorPad.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/Mod.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/Multinomial.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/Softmax.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/NonMaxSuppressionV3.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/NonMaxSuppressionV4.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/NonMaxSuppressionV5.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/OneHot.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/ZerosLike.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/OnesLike.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/Pack.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/PadV2.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/Pow.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/Range.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/Reciprocal.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/ResizeBilinear.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/ResizeBilinearGrad.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/ResizeNearestNeighbor.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/ResizeNearestNeighborGrad.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/Reverse.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/RotateWithOffset.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/Round.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/Scatter_impl.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/ScatterNd.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/Select.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/Selu.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/Sign.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/Sin.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/Sinh.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/Softplus.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/SpaceToBatchND.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/SparseFillEmptyRows.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/SparseReshape.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/SparseSegmentMean.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/SparseSegmentSum.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/SparseToDense.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/SplitV.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/Sqrt.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/Square.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/Step.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/StridedSlice.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/StringNGrams.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/StringSplit.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/StringToHashBucketFast.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/Tan.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/Tanh.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/Tile.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/TopK.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/Transform.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/Unique.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/Unpack.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/UnsortedSegmentSum.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-cpu/src/register_all_kernels.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-cpu/src/index.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-webgl/src/webgl_util.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-webgl/src/canvas_util.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-webgl/src/tex_util.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-webgl/src/flags_webgl.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-webgl/src/glsl_version.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-webgl/src/shader_compiler_util.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-webgl/src/decode_matrix_gpu.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-webgl/src/decode_matrix_packed_gpu.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-webgl/src/encode_float_gpu.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-webgl/src/encode_float_packed_gpu.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-webgl/src/encode_matrix_gpu.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-webgl/src/encode_matrix_packed_gpu.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-webgl/src/gpgpu_util.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-webgl/src/gpgpu_context.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-webgl/src/shader_compiler.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-webgl/src/gpgpu_math.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-cpu/src/shared.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-cpu/src/cpu_util.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/Abs.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-cpu/src/utils/binary_impl.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/Complex.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-cpu/src/utils/zeros_impl.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/Identity.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/Real.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/Cast.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-cpu/src/utils/binary_utils.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/Add.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/Bincount_impl.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-cpu/src/utils/unary_impl.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-cpu/src/utils/unary_utils.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/Ceil.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/Concat_impl.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/Equal.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/Exp.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/Expm1.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/Floor.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/GatherNd_Impl.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/GatherV2_impl.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/Greater.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/GreaterEqual.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/Less.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/LessEqual.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/LinSpace_impl.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/Log.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/Max_impl.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/Maximum.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/Minimum.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/Multiply.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/Neg.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/NotEqual.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/Transpose_impl.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/Transpose.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/Prod.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/Range_impl.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/Rsqrt.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/Slice.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/SparseFillEmptyRows_impl.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/SparseReshape_impl.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/SparseSegmentReduction_impl.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/SquaredDifference.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/StridedSlice_impl.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/StringNGrams_impl.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/StringSplit_impl.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/StringToHashBucketFast_impl.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/Sub.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/Tile_impl.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/TopK_impl.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/Unique_impl.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernel_utils/shared.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-webgl/src/packing_util.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-webgl/src/pack_gpu.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-webgl/src/reshape_packed_gpu.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-webgl/src/texture_manager.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-webgl/src/unaryop_gpu.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-webgl/src/unaryop_packed_gpu.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-webgl/src/unpack_gpu.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-webgl/src/backend_webgl.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-webgl/src/version.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-webgl/src/webgl.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-webgl/src/base.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-webgl/src/binaryop_gpu.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-webgl/src/binaryop_packed_gpu.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/Identity.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/Complex.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/LeakyRelu.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/Prelu.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernel_utils/kernel_funcs_utils.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-webgl/src/mulmat_packed_gpu.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-webgl/src/binaryop_complex_gpu.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/Multiply.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernel_utils/reshape.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/Reshape.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-webgl/src/mean_gpu.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-webgl/src/reduce_gpu.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernel_utils/reduce.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-webgl/src/transpose_gpu.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-webgl/src/transpose_packed_gpu.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/Transpose_impl.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/Sum_impl.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/Sum.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/Transpose.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/BatchMatMul_impl.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/_FusedMatMul.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/Abs.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/Acos.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/Acosh.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/Add.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-webgl/src/addn_gpu.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-webgl/src/addn_packed_gpu.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/AddN.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/All.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/Any.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-webgl/src/argminmax_gpu.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-webgl/src/argminmax_packed_gpu.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernel_utils/arg_min_max.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/ArgMax.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/ArgMin.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/Asin.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/Asinh.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/Atan.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/Atan2.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/Atanh.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-webgl/src/pool_gpu.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/AvgPool.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/AvgPool3D.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-webgl/src/avg_pool_backprop_gpu.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/AvgPool3DGrad.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/AvgPoolGrad.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/BatchMatMul.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-webgl/src/batchnorm_gpu.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-webgl/src/batchnorm_packed_gpu.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/BatchNorm.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-webgl/src/slice_gpu.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-webgl/src/slice_packed_gpu.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/Slice.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/BatchToSpaceND.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/Bincount.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/NotEqual.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/Real.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernel_utils/int.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/Cast.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/Ceil.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-webgl/src/clip_gpu.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-webgl/src/clip_packed_gpu.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/ClipByValue.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-webgl/src/complex_abs_gpu.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/ComplexAbs.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-webgl/src/concat_gpu.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-webgl/src/concat_packed_gpu.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/Imag.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/Concat_impl.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/Concat.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-webgl/src/conv_gpu.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-webgl/src/im2col_packed_gpu.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/Conv2D_impl.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/Conv2D.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-webgl/src/conv_backprop_gpu.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/Conv2DBackpropFilter.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/Conv2DBackpropInput.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/Conv3D.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/Conv3DBackpropFilterV2.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/Conv3DBackpropInputV2.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/Cos.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/Cosh.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-webgl/src/crop_and_resize_gpu.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/CropAndResize.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-webgl/src/cumsum_gpu.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/Cumsum.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/DenseBincount.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-webgl/src/depth_to_space_gpu.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/DepthToSpace.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-webgl/src/conv_gpu_depthwise.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-webgl/src/conv_packed_gpu_depthwise.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/DepthwiseConv2dNative.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-webgl/src/conv_backprop_gpu_depthwise.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/DepthwiseConv2dNativeBackpropFilter.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/DepthwiseConv2dNativeBackpropInput.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-webgl/src/diag_gpu.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/Diag.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-webgl/src/dilation_gpu.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/Dilation2D.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/Einsum.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/Elu.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/EluGrad.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/Equal.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/Erf.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/Exp.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/ExpandDims.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/Expm1.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-webgl/src/fft_gpu.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/FFT_impl.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/FFT.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-webgl/src/fill_gpu.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/Fill.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-webgl/src/flip_left_right_gpu.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/FlipLeftRight.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/Floor.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/FloorDiv.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/FromPixels_utils/from_pixels_gpu.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/FromPixels_utils/from_pixels_packed_gpu.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/FromPixels.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/FusedConv2D.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/FusedDepthwiseConv2D.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-webgl/src/gather_nd_gpu.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/GatherNd.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-webgl/src/gather_gpu.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/GatherV2.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/Greater.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/GreaterEqual.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/IFFT.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/IsFinite.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/IsInf.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/IsNaN.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/Less.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/LessEqual.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/LinSpace.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/Log.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/Log1p.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/LogicalAnd.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/LogicalNot.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/LogicalOr.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-webgl/src/lrn_gpu.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-webgl/src/lrn_packed_gpu.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/LRN.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-webgl/src/lrn_grad_gpu.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/LRNGrad.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/Max_impl.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/Max.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/Maximum.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/MaxPool.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/MaxPool3D.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-webgl/src/max_pool_backprop_gpu.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/MaxPool3DGrad.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/MaxPoolGrad.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/MaxPoolWithArgmax_impl.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/MaxPoolWithArgmax.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/Mean_impl.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/Mean.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/Min.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/Minimum.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-webgl/src/mirror_pad_gpu.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-webgl/src/mirror_pad_packed_gpu.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/MirrorPad.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/Mod.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-webgl/src/multinomial_gpu.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/RealDiv.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/Sub.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/Softmax.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/Multinomial.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/Neg.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/NonMaxSuppressionV3.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/NonMaxSuppressionV4.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/NonMaxSuppressionV5.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-webgl/src/onehot_gpu.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/OneHot.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/ZerosLike.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/OnesLike.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/Pack.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-webgl/src/pad_gpu.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-webgl/src/pad_packed_gpu.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/PadV2.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/Pow.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/Prod.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/Range.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/Reciprocal.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/Relu.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/Relu6.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-webgl/src/resize_bilinear_gpu.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-webgl/src/resize_bilinear_packed_gpu.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/ResizeBilinear.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-webgl/src/resize_bilinear_backprop_gpu.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/ResizeBilinearGrad.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-webgl/src/resize_nearest_neighbor_gpu.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-webgl/src/resize_nearest_neighbor_packed_gpu.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/ResizeNearestNeighbor.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-webgl/src/resize_nearest_neighbor_backprop_gpu.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/ResizeNearestNeighborGrad.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-webgl/src/reverse_gpu.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-webgl/src/reverse_packed_gpu.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/Reverse.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-webgl/src/rotate_gpu.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/RotateWithOffset.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/Round.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/Rsqrt.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-webgl/src/scatter_gpu.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/ScatterNd.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-webgl/src/select_gpu.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/Select.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/Selu.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/Sigmoid.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/Sign.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/Sin.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/Sinh.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/Softplus.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/SpaceToBatchND.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/SparseFillEmptyRows.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/SparseReshape.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/SparseSegmentMean.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/SparseSegmentSum.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/SparseToDense.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/SplitV.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/Sqrt.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/Square.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/SquaredDifference.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/Step.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-webgl/src/strided_slice_gpu.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/StridedSlice.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/StringNGrams.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/StringSplit.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/StringToHashBucketFast.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/Tan.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/Tanh.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-webgl/src/tile_gpu.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/Tile.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/TopK.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-webgl/src/transform_gpu.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/Transform.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/Unique.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/Unpack.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-webgl/src/segment_gpu.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/UnsortedSegmentSum.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-webgl/src/register_all_kernels.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-webgl/src/index.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-wasm@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-wasm/src/kernels/types.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-wasm@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-wasm/src/kernels/_FusedMatMul.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-wasm@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-wasm/src/kernels/unary_kernel.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-wasm@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-wasm/src/kernels/Abs.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-wasm@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-wasm/src/kernels/binary_kernel.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-wasm@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-wasm/src/kernels/Add.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-wasm@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-wasm/src/kernels/AddN.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-wasm@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-wasm/src/kernels/Identity.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-wasm@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-wasm/src/kernels/Transpose.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-wasm@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-wasm/src/kernels/kernel_utils.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-wasm@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-wasm/src/kernels/All.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-wasm@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-wasm/src/kernels/Any.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-wasm@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-wasm/src/kernels/ArgMax.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-wasm@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-wasm/src/kernels/AvgPool.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-wasm@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-wasm/src/kernels/Reshape.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-wasm@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-wasm/src/kernels/BatchMatMul.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-wasm@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-wasm/src/kernels/Cast.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-wasm@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-wasm/src/kernels/Ceil.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-wasm@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-wasm/src/kernels/ClipByValue.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-wasm@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-wasm/src/kernel_utils/shared.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-wasm@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-wasm/src/kernels/Concat.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-wasm@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-wasm/src/kernels/Conv2D.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-wasm@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-wasm/src/kernels/Conv2DBackpropInput.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-wasm@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-wasm/src/kernels/Cos.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-wasm@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-wasm/src/kernels/CropAndResize.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-wasm@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-wasm/src/kernels/Cumsum.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-wasm@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-wasm/src/kernels/DepthToSpace.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-wasm@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-wasm/src/kernels/DepthwiseConv2dNative.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-wasm@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-wasm/src/kernels/Equal.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-wasm@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-wasm/src/kernels/Exp.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-wasm@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-wasm/src/kernels/ExpandDims.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-wasm@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-wasm/src/kernels/Fill.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-wasm@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-wasm/src/kernels/FlipLeftRight.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-wasm@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-wasm/src/kernels/Floor.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-wasm@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-wasm/src/kernels/FloorDiv.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-wasm@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-wasm/src/kernels/FusedBatchNorm.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-wasm@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-wasm/src/kernels/FusedConv2D.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-wasm@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-wasm/src/kernels/FusedDepthwiseConv2D.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-wasm@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-wasm/src/kernels/GatherNd.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-wasm@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-wasm/src/kernels/GatherV2.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-wasm@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-wasm/src/kernels/Greater.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-wasm@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-wasm/src/kernels/GreaterEqual.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-wasm@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-wasm/src/kernels/LeakyRelu.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-wasm@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-wasm/src/kernels/Less.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-wasm@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-wasm/src/kernels/LessEqual.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-wasm@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-wasm/src/kernels/Log.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-wasm@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-wasm/src/kernels/LogicalAnd.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-wasm@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-wasm/src/kernels/Max.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-wasm@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-wasm/src/kernels/Maximum.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-wasm@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-wasm/src/kernels/MaxPool.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-wasm@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-wasm/src/kernels/Mean.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-wasm@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-wasm/src/kernels/Min.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-wasm@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-wasm/src/kernels/Minimum.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-wasm@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-wasm/src/kernels/MirrorPad.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-wasm@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-wasm/src/kernels/Multiply.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-wasm@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-wasm/src/kernels/Neg.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-wasm@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-wasm/src/kernels/NonMaxSuppression_util.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-wasm@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-wasm/src/kernels/NonMaxSuppressionV3.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-wasm@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-wasm/src/kernels/NonMaxSuppressionV4.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-wasm@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-wasm/src/kernels/NonMaxSuppressionV5.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-wasm@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-wasm/src/kernels/NotEqual.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-wasm@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-wasm/src/kernels/OneHot.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-wasm@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-wasm/src/kernels/OnesLike.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-wasm@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-wasm/src/kernels/Pack.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-wasm@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-wasm/src/kernels/PadV2.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-wasm@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-wasm/src/kernels/Pow.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-wasm@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-wasm/src/kernels/Prelu.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-wasm@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-wasm/src/kernels/Prod.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-wasm@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-wasm/src/kernels/Range.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-wasm@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-wasm/src/kernels/RealDiv.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-wasm@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-wasm/src/kernels/Relu.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-wasm@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-wasm/src/kernels/Relu6.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-wasm@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-wasm/src/kernels/ResizeBilinear.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-wasm@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-wasm/src/kernels/Reverse.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-wasm@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-wasm/src/kernels/RotateWithOffset.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-wasm@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-wasm/src/kernels/Round.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-wasm@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-wasm/src/kernels/Rsqrt.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-wasm@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-wasm/src/kernels/ScatterNd.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-wasm@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-wasm/src/kernels/Select.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-wasm@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-wasm/src/kernels/Sigmoid.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-wasm@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-wasm/src/kernels/Sin.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-wasm@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-wasm/src/kernels/Slice.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-wasm@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-wasm/src/kernels/Softmax.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-wasm@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-wasm/src/kernels/SplitV.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-wasm@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-wasm/src/kernels/Sqrt.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-wasm@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-wasm/src/kernels/Square.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-wasm@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-wasm/src/kernels/SquaredDifference.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-wasm@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-wasm/src/kernels/Step.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-wasm@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-wasm/src/kernels/StridedSlice.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-wasm@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-wasm/src/kernels/Sub.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-wasm@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-wasm/src/kernels/Sum.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-wasm@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-wasm/src/kernels/Tan.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-wasm@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-wasm/src/kernels/Tanh.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-wasm@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-wasm/src/kernels/Tile.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-wasm@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-wasm/src/kernels/TopK.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-wasm@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-wasm/src/kernels/Transform.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-wasm@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-wasm/src/kernels/Unpack.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-wasm@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-wasm/src/kernels/ZerosLike.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-wasm@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-wasm/src/register_all_kernels.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-wasm@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-wasm/src/flags_wasm.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-wasm@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-wasm/src/backend_wasm.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-wasm@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-wasm/wasm-out/tfjs-backend-wasm-threaded-simd.worker.js", "../node_modules/.pnpm/@tensorflow+tfjs-backend-wasm@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-wasm/src/version.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-wasm@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-wasm/src/base.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-wasm@3.7.0_@tensorflow+tfjs-core@3.7.0/node_modules/@tensorflow/tfjs-backend-wasm/src/index.ts", "../tfjs/tf-browser.ts", "../src/tfjs/backend.ts", "../src/blazeface/box.ts", "../src/blazeface/util.ts", "../src/blazeface/blazeface.ts", "../src/blazeface/coords.ts", "../src/blazeface/facepipeline.ts", "../src/blazeface/facemesh.ts", "../src/emotion/emotion.ts", "../src/faceres/faceres.ts", "../src/face.ts", "../src/posenet/keypoints.ts", "../src/posenet/utils.ts", "../src/posenet/poses.ts", "../src/posenet/posenet.ts", "../src/handpose/box.ts", "../src/handpose/anchors.ts", "../src/handpose/handdetector.ts", "../src/handpose/util.ts", "../src/handpose/handpipeline.ts", "../src/handpose/handpose.ts", "../src/blazepose/annotations.ts", "../src/blazepose/blazepose.ts", "../src/efficientpose/efficientpose.ts", "../src/movenet/movenet.ts", "../src/object/labels.ts", "../src/object/nanodet.ts", "../src/object/centernet.ts", "../src/gesture/gesture.ts", "../src/image/imagefx.js", "../src/image/image.ts", "../src/draw/draw.ts", "../src/persons.ts", "../src/interpolate.ts", "../src/segmentation/segmentation.ts", "../src/sample.ts", "../src/human.ts"], - "sourcesContent": ["/**\n * Simple helper functions used accross codebase\n */\n\n// helper function: join two paths\nexport function join(folder: string, file: string): string {\n const separator = folder.endsWith('/') ? '' : '/';\n const skipJoin = file.startsWith('.') || file.startsWith('/') || file.startsWith('http:') || file.startsWith('https:') || file.startsWith('file:');\n const path = skipJoin ? `${file}` : `${folder}${separator}${file}`;\n if (!path.toLocaleLowerCase().includes('.json')) throw new Error(`Human: ModelPath Error: ${path} Expecting JSON file`);\n return path;\n}\n\n// helper function: wrapper around console output\nexport function log(...msg): void {\n const dt = new Date();\n const ts = `${dt.getHours().toString().padStart(2, '0')}:${dt.getMinutes().toString().padStart(2, '0')}:${dt.getSeconds().toString().padStart(2, '0')}.${dt.getMilliseconds().toString().padStart(3, '0')}`;\n // eslint-disable-next-line no-console\n if (msg) console.log(ts, 'Human:', ...msg);\n}\n\n// helper function: gets elapsed time on both browser and nodejs\nexport const now = () => {\n if (typeof performance !== 'undefined') return performance.now();\n return parseInt((Number(process.hrtime.bigint()) / 1000 / 1000).toString());\n};\n\n// helper function: perform deep merge of multiple objects so it allows full inheriance with overrides\nexport function mergeDeep(...objects) {\n const isObject = (obj) => obj && typeof obj === 'object';\n return objects.reduce((prev, obj) => {\n Object.keys(obj || {}).forEach((key) => {\n const pVal = prev[key];\n const oVal = obj[key];\n if (Array.isArray(pVal) && Array.isArray(oVal)) prev[key] = pVal.concat(...oVal);\n else if (isObject(pVal) && isObject(oVal)) prev[key] = mergeDeep(pVal, oVal);\n else prev[key] = oVal;\n });\n return prev;\n }, {});\n}\n\n// helper function: return min and max from input array\nexport const minmax = (data) => data.reduce((acc, val) => {\n acc[0] = (acc[0] === undefined || val < acc[0]) ? val : acc[0];\n acc[1] = (acc[1] === undefined || val > acc[1]) ? val : acc[1];\n return acc;\n}, []);\n", "/* eslint-disable indent */\n/* eslint-disable no-multi-spaces */\n\n/**\n * Configuration interface definition for **Human** library\n *\n * Contains all configurable parameters\n * @typedef Config\n */\nexport interface Config {\n /** Backend used for TFJS operations */\n backend: null | '' | 'cpu' | 'wasm' | 'webgl' | 'humangl' | 'tensorflow',\n\n /** Path to *.wasm files if backend is set to `wasm` */\n wasmPath: string,\n\n /** Print debug statements to console */\n debug: boolean,\n\n /** Perform model loading and inference concurrently or sequentially */\n async: boolean,\n\n /** What to use for `human.warmup()`\n * - warmup pre-initializes all models for faster inference but can take significant time on startup\n * - only used for `webgl` and `humangl` backends\n */\n warmup: 'none' | 'face' | 'full' | 'body',\n\n /** Base model path (typically starting with file://, http:// or https://) for all models\n * - individual modelPath values are relative to this path\n */\n modelBasePath: string,\n\n /** Cache sensitivity\n * - values 0..1 where 0.01 means reset cache if input changed more than 1%\n * - set to 0 to disable caching\n */\n cacheSensitivity: number;\n\n /** Cache sensitivity\n * - values 0..1 where 0.01 means reset cache if input changed more than 1%\n * - set to 0 to disable caching\n */\n skipFrame: boolean;\n\n /** Run input through image filters before inference\n * - image filters run with near-zero latency as they are executed on the GPU\n */\n filter: {\n enabled: boolean,\n /** Resize input width\n * - if both width and height are set to 0, there is no resizing\n * - if just one is set, second one is scaled automatically\n * - if both are set, values are used as-is\n */\n width: number,\n /** Resize input height\n * - if both width and height are set to 0, there is no resizing\n * - if just one is set, second one is scaled automatically\n * - if both are set, values are used as-is\n */\n height: number,\n /** Return processed canvas imagedata in result */\n return: boolean,\n /** Flip input as mirror image */\n flip: boolean,\n /** Range: -1 (darken) to 1 (lighten) */\n brightness: number,\n /** Range: -1 (reduce contrast) to 1 (increase contrast) */\n contrast: number,\n /** Range: 0 (no sharpening) to 1 (maximum sharpening) */\n sharpness: number,\n /** Range: 0 (no blur) to N (blur radius in pixels) */\n blur: number\n /** Range: -1 (reduce saturation) to 1 (increase saturation) */\n saturation: number,\n /** Range: 0 (no change) to 360 (hue rotation in degrees) */\n hue: number,\n /** Image negative */\n negative: boolean,\n /** Image sepia colors */\n sepia: boolean,\n /** Image vintage colors */\n vintage: boolean,\n /** Image kodachrome colors */\n kodachrome: boolean,\n /** Image technicolor colors */\n technicolor: boolean,\n /** Image polaroid camera effect */\n polaroid: boolean,\n /** Range: 0 (no pixelate) to N (number of pixels to pixelate) */\n pixelate: number,\n },\n // type definition end\n\n /** Controlls gesture detection */\n gesture: {\n enabled: boolean,\n },\n\n /** Controlls and configures all face-specific options:\n * - face detection, face mesh detection, age, gender, emotion detection and face description\n * Parameters:\n * - enabled: true/false\n * - modelPath: path for each of face models\n * - minConfidence: threshold for discarding a prediction\n * - iouThreshold: ammount of overlap between two detected objects before one object is removed\n * - maxDetected: maximum number of faces detected in the input, should be set to the minimum number for performance\n * - rotation: use calculated rotated face image or just box with rotation as-is, false means higher performance, but incorrect mesh mapping on higher face angles\n * - return: return extracted face as tensor for futher user processing\n */\n face: {\n enabled: boolean,\n detector: {\n modelPath: string,\n rotation: boolean,\n maxDetected: number,\n skipFrames: number,\n minConfidence: number,\n iouThreshold: number,\n return: boolean,\n },\n mesh: {\n enabled: boolean,\n modelPath: string,\n },\n iris: {\n enabled: boolean,\n modelPath: string,\n },\n description: {\n enabled: boolean,\n modelPath: string,\n skipFrames: number,\n minConfidence: number,\n },\n emotion: {\n enabled: boolean,\n minConfidence: number,\n skipFrames: number,\n modelPath: string,\n },\n },\n\n /** Controlls and configures all body detection specific options\n * - enabled: true/false\n * - modelPath: body pose model, can be absolute path or relative to modelBasePath\n * - minConfidence: threshold for discarding a prediction\n * - maxDetected: maximum number of people detected in the input, should be set to the minimum number for performance\n */\n body: {\n enabled: boolean,\n modelPath: string,\n maxDetected: number,\n minConfidence: number,\n skipFrames: number,\n },\n\n /** Controlls and configures all hand detection specific options\n * - enabled: true/false\n * - landmarks: detect hand landmarks or just hand boundary box\n * - modelPath: paths for hand detector and hand skeleton models, can be absolute path or relative to modelBasePath\n * - minConfidence: threshold for discarding a prediction\n * - iouThreshold: ammount of overlap between two detected objects before one object is removed\n * - maxDetected: maximum number of hands detected in the input, should be set to the minimum number for performance\n * - rotation: use best-guess rotated hand image or just box with rotation as-is, false means higher performance, but incorrect finger mapping if hand is inverted\n */\n hand: {\n enabled: boolean,\n rotation: boolean,\n skipFrames: number,\n minConfidence: number,\n iouThreshold: number,\n maxDetected: number,\n landmarks: boolean,\n detector: {\n modelPath: string,\n },\n skeleton: {\n modelPath: string,\n },\n },\n\n /** Controlls and configures all object detection specific options\n * - enabled: true/false\n * - modelPath: object detection model, can be absolute path or relative to modelBasePath\n * - minConfidence: minimum score that detection must have to return as valid object\n * - iouThreshold: ammount of overlap between two detected objects before one object is removed\n * - maxDetected: maximum number of detections to return\n */\n object: {\n enabled: boolean,\n modelPath: string,\n minConfidence: number,\n iouThreshold: number,\n maxDetected: number,\n skipFrames: number,\n },\n\n /** Controlls and configures all body segmentation module\n * removes background from input containing person\n * if segmentation is enabled it will run as preprocessing task before any other model\n * alternatively leave it disabled and use it on-demand using human.segmentation method which can\n * remove background or replace it with user-provided background\n *\n * - enabled: true/false\n * - modelPath: object detection model, can be absolute path or relative to modelBasePath\n */\n segmentation: {\n enabled: boolean,\n modelPath: string,\n },\n}\n\nconst config: Config = {\n backend: 'webgl', // select tfjs backend to use, leave empty to use default backend\n // can be 'webgl', 'wasm', 'cpu', or 'humangl' which is a custom version of webgl\n modelBasePath: '../models/', // base path for all models\n wasmPath: '../node_modules/@tensorflow/tfjs-backend-wasm/dist/', // path for wasm binaries, only used for backend: wasm\n debug: true, // print additional status messages to console\n async: true, // execute enabled models in parallel\n warmup: 'full', // what to use for human.warmup(), can be 'none', 'face', 'full'\n // warmup pre-initializes all models for faster inference but can take\n // significant time on startup\n // only used for `webgl` and `humangl` backends\n cacheSensitivity: 0.75, // cache sensitivity\n // values 0..1 where 0.01 means reset cache if input changed more than 1%\n // set to 0 to disable caching\n skipFrame: false, // internal & dynamic\n filter: { // run input through image filters before inference\n // image filters run with near-zero latency as they are executed on the GPU\n enabled: true, // enable image pre-processing filters\n width: 0, // resize input width\n height: 0, // resize input height\n // if both width and height are set to 0, there is no resizing\n // if just one is set, second one is scaled automatically\n // if both are set, values are used as-is\n flip: false, // flip input as mirror image\n return: true, // return processed canvas imagedata in result\n brightness: 0, // range: -1 (darken) to 1 (lighten)\n contrast: 0, // range: -1 (reduce contrast) to 1 (increase contrast)\n sharpness: 0, // range: 0 (no sharpening) to 1 (maximum sharpening)\n blur: 0, // range: 0 (no blur) to N (blur radius in pixels)\n saturation: 0, // range: -1 (reduce saturation) to 1 (increase saturation)\n hue: 0, // range: 0 (no change) to 360 (hue rotation in degrees)\n negative: false, // image negative\n sepia: false, // image sepia colors\n vintage: false, // image vintage colors\n kodachrome: false, // image kodachrome colors\n technicolor: false, // image technicolor colors\n polaroid: false, // image polaroid camera effect\n pixelate: 0, // range: 0 (no pixelate) to N (number of pixels to pixelate)\n },\n\n gesture: {\n enabled: true, // enable gesture recognition based on model results\n },\n\n face: {\n enabled: true, // controls if specified modul is enabled\n // face.enabled is required for all face models:\n // detector, mesh, iris, age, gender, emotion\n // (note: module is not loaded until it is required)\n detector: {\n modelPath: 'blazeface.json', // detector model, can be absolute path or relative to modelBasePath\n rotation: true, // use best-guess rotated face image or just box with rotation as-is\n // false means higher performance, but incorrect mesh mapping if face angle is above 20 degrees\n // this parameter is not valid in nodejs\n maxDetected: 15, // maximum number of faces detected in the input\n // should be set to the minimum number for performance\n skipFrames: 15, // how many max frames to go without re-running the face bounding box detector\n // only used when cacheSensitivity is not zero\n // e.g., if model is running st 25 FPS, we can re-use existing bounding\n // box for updated face analysis as the head probably hasn't moved much\n // in short time (10 * 1/25 = 0.25 sec)\n minConfidence: 0.2, // threshold for discarding a prediction\n iouThreshold: 0.1, // ammount of overlap between two detected objects before one object is removed\n return: false, // return extracted face as tensor\n },\n\n mesh: {\n enabled: true,\n modelPath: 'facemesh.json', // facemesh model, can be absolute path or relative to modelBasePath\n },\n\n iris: {\n enabled: true,\n modelPath: 'iris.json', // face iris model\n // can be either absolute path or relative to modelBasePath\n },\n\n description: {\n enabled: true, // to improve accuracy of face description extraction it is\n // recommended to enable detector.rotation and mesh.enabled\n modelPath: 'faceres.json', // face description model\n // can be either absolute path or relative to modelBasePath\n skipFrames: 11, // how many max frames to go without re-running the detector\n // only used when cacheSensitivity is not zero\n minConfidence: 0.1, // threshold for discarding a prediction\n },\n\n emotion: {\n enabled: true,\n minConfidence: 0.1, // threshold for discarding a prediction\n skipFrames: 17, // how max many frames to go without re-running the detector\n // only used when cacheSensitivity is not zero\n modelPath: 'emotion.json', // face emotion model, can be absolute path or relative to modelBasePath\n },\n },\n\n body: {\n enabled: true,\n modelPath: 'movenet-lightning.json', // body model, can be absolute path or relative to modelBasePath\n // can be 'posenet', 'blazepose', 'efficientpose', 'movenet-lightning', 'movenet-thunder'\n maxDetected: 1, // maximum number of people detected in the input\n // should be set to the minimum number for performance\n // only valid for posenet as other models detects single pose\n minConfidence: 0.2, // threshold for discarding a prediction\n skipFrames: 1, // how many max frames to go without re-running the detector\n // only used when cacheSensitivity is not zero\n},\n\n hand: {\n enabled: true,\n rotation: true, // use best-guess rotated hand image or just box with rotation as-is\n // false means higher performance, but incorrect finger mapping if hand is inverted\n skipFrames: 18, // how many max frames to go without re-running the hand bounding box detector\n // only used when cacheSensitivity is not zero\n // e.g., if model is running st 25 FPS, we can re-use existing bounding\n // box for updated hand skeleton analysis as the hand probably\n // hasn't moved much in short time (10 * 1/25 = 0.25 sec)\n minConfidence: 0.1, // threshold for discarding a prediction\n iouThreshold: 0.1, // ammount of overlap between two detected objects before one object is removed\n maxDetected: 2, // maximum number of hands detected in the input\n // should be set to the minimum number for performance\n landmarks: true, // detect hand landmarks or just hand boundary box\n detector: {\n modelPath: 'handdetect.json', // hand detector model, can be absolute path or relative to modelBasePath\n },\n skeleton: {\n modelPath: 'handskeleton.json', // hand skeleton model, can be absolute path or relative to modelBasePath\n },\n },\n\n object: {\n enabled: false,\n modelPath: 'mb3-centernet.json', // experimental: object detection model, can be absolute path or relative to modelBasePath\n // can be 'mb3-centernet' or 'nanodet'\n minConfidence: 0.2, // threshold for discarding a prediction\n iouThreshold: 0.4, // ammount of overlap between two detected objects before one object is removed\n maxDetected: 10, // maximum number of objects detected in the input\n skipFrames: 19, // how many max frames to go without re-running the detector\n // only used when cacheSensitivity is not zero\n },\n\n segmentation: {\n enabled: false, // controlls and configures all body segmentation module\n // removes background from input containing person\n // if segmentation is enabled it will run as preprocessing task before any other model\n // alternatively leave it disabled and use it on-demand using human.segmentation method which can\n // remove background or replace it with user-provided background\n modelPath: 'selfie.json', // experimental: object detection model, can be absolute path or relative to modelBasePath\n // can be 'selfie' or 'meet'\n },\n};\nexport { config as defaults };\n", "/**\n * Helper function that returns basic system info\n */\nexport function info(): { platform: string, agent: string } {\n let platform;\n let agent;\n if (typeof navigator !== 'undefined') {\n const raw = navigator.userAgent.match(/\\(([^()]+)\\)/g);\n if (raw && raw[0]) {\n const platformMatch = raw[0].match(/\\(([^()]+)\\)/g);\n platform = platformMatch ? platformMatch[0].replace(/\\(|\\)/g, '') : '';\n agent = navigator.userAgent.replace(raw[0], '');\n if (platform[1]) agent = agent.replace(raw[1], '');\n agent = agent.replace(/ /g, ' ');\n }\n } else if (typeof process !== 'undefined') {\n platform = `${process.platform} ${process.arch}`;\n agent = `NodeJS ${process.version}`;\n }\n return { platform, agent };\n}\n", "module.exports = Long;\r\n\r\n/**\r\n * wasm optimizations, to do native i64 multiplication and divide\r\n */\r\nvar wasm = null;\r\n\r\ntry {\r\n wasm = new WebAssembly.Instance(new WebAssembly.Module(new Uint8Array([\r\n 0, 97, 115, 109, 1, 0, 0, 0, 1, 13, 2, 96, 0, 1, 127, 96, 4, 127, 127, 127, 127, 1, 127, 3, 7, 6, 0, 1, 1, 1, 1, 1, 6, 6, 1, 127, 1, 65, 0, 11, 7, 50, 6, 3, 109, 117, 108, 0, 1, 5, 100, 105, 118, 95, 115, 0, 2, 5, 100, 105, 118, 95, 117, 0, 3, 5, 114, 101, 109, 95, 115, 0, 4, 5, 114, 101, 109, 95, 117, 0, 5, 8, 103, 101, 116, 95, 104, 105, 103, 104, 0, 0, 10, 191, 1, 6, 4, 0, 35, 0, 11, 36, 1, 1, 126, 32, 0, 173, 32, 1, 173, 66, 32, 134, 132, 32, 2, 173, 32, 3, 173, 66, 32, 134, 132, 126, 34, 4, 66, 32, 135, 167, 36, 0, 32, 4, 167, 11, 36, 1, 1, 126, 32, 0, 173, 32, 1, 173, 66, 32, 134, 132, 32, 2, 173, 32, 3, 173, 66, 32, 134, 132, 127, 34, 4, 66, 32, 135, 167, 36, 0, 32, 4, 167, 11, 36, 1, 1, 126, 32, 0, 173, 32, 1, 173, 66, 32, 134, 132, 32, 2, 173, 32, 3, 173, 66, 32, 134, 132, 128, 34, 4, 66, 32, 135, 167, 36, 0, 32, 4, 167, 11, 36, 1, 1, 126, 32, 0, 173, 32, 1, 173, 66, 32, 134, 132, 32, 2, 173, 32, 3, 173, 66, 32, 134, 132, 129, 34, 4, 66, 32, 135, 167, 36, 0, 32, 4, 167, 11, 36, 1, 1, 126, 32, 0, 173, 32, 1, 173, 66, 32, 134, 132, 32, 2, 173, 32, 3, 173, 66, 32, 134, 132, 130, 34, 4, 66, 32, 135, 167, 36, 0, 32, 4, 167, 11\r\n ])), {}).exports;\r\n} catch (e) {\r\n // no wasm support :(\r\n}\r\n\r\n/**\r\n * Constructs a 64 bit two's-complement integer, given its low and high 32 bit values as *signed* integers.\r\n * See the from* functions below for more convenient ways of constructing Longs.\r\n * @exports Long\r\n * @class A Long class for representing a 64 bit two's-complement integer value.\r\n * @param {number} low The low (signed) 32 bits of the long\r\n * @param {number} high The high (signed) 32 bits of the long\r\n * @param {boolean=} unsigned Whether unsigned or not, defaults to signed\r\n * @constructor\r\n */\r\nfunction Long(low, high, unsigned) {\r\n\r\n /**\r\n * The low 32 bits as a signed value.\r\n * @type {number}\r\n */\r\n this.low = low | 0;\r\n\r\n /**\r\n * The high 32 bits as a signed value.\r\n * @type {number}\r\n */\r\n this.high = high | 0;\r\n\r\n /**\r\n * Whether unsigned or not.\r\n * @type {boolean}\r\n */\r\n this.unsigned = !!unsigned;\r\n}\r\n\r\n// The internal representation of a long is the two given signed, 32-bit values.\r\n// We use 32-bit pieces because these are the size of integers on which\r\n// Javascript performs bit-operations. For operations like addition and\r\n// multiplication, we split each number into 16 bit pieces, which can easily be\r\n// multiplied within Javascript's floating-point representation without overflow\r\n// or change in sign.\r\n//\r\n// In the algorithms below, we frequently reduce the negative case to the\r\n// positive case by negating the input(s) and then post-processing the result.\r\n// Note that we must ALWAYS check specially whether those values are MIN_VALUE\r\n// (-2^63) because -MIN_VALUE == MIN_VALUE (since 2^63 cannot be represented as\r\n// a positive number, it overflows back into a negative). Not handling this\r\n// case would often result in infinite recursion.\r\n//\r\n// Common constant values ZERO, ONE, NEG_ONE, etc. are defined below the from*\r\n// methods on which they depend.\r\n\r\n/**\r\n * An indicator used to reliably determine if an object is a Long or not.\r\n * @type {boolean}\r\n * @const\r\n * @private\r\n */\r\nLong.prototype.__isLong__;\r\n\r\nObject.defineProperty(Long.prototype, \"__isLong__\", { value: true });\r\n\r\n/**\r\n * @function\r\n * @param {*} obj Object\r\n * @returns {boolean}\r\n * @inner\r\n */\r\nfunction isLong(obj) {\r\n return (obj && obj[\"__isLong__\"]) === true;\r\n}\r\n\r\n/**\r\n * Tests if the specified object is a Long.\r\n * @function\r\n * @param {*} obj Object\r\n * @returns {boolean}\r\n */\r\nLong.isLong = isLong;\r\n\r\n/**\r\n * A cache of the Long representations of small integer values.\r\n * @type {!Object}\r\n * @inner\r\n */\r\nvar INT_CACHE = {};\r\n\r\n/**\r\n * A cache of the Long representations of small unsigned integer values.\r\n * @type {!Object}\r\n * @inner\r\n */\r\nvar UINT_CACHE = {};\r\n\r\n/**\r\n * @param {number} value\r\n * @param {boolean=} unsigned\r\n * @returns {!Long}\r\n * @inner\r\n */\r\nfunction fromInt(value, unsigned) {\r\n var obj, cachedObj, cache;\r\n if (unsigned) {\r\n value >>>= 0;\r\n if (cache = (0 <= value && value < 256)) {\r\n cachedObj = UINT_CACHE[value];\r\n if (cachedObj)\r\n return cachedObj;\r\n }\r\n obj = fromBits(value, (value | 0) < 0 ? -1 : 0, true);\r\n if (cache)\r\n UINT_CACHE[value] = obj;\r\n return obj;\r\n } else {\r\n value |= 0;\r\n if (cache = (-128 <= value && value < 128)) {\r\n cachedObj = INT_CACHE[value];\r\n if (cachedObj)\r\n return cachedObj;\r\n }\r\n obj = fromBits(value, value < 0 ? -1 : 0, false);\r\n if (cache)\r\n INT_CACHE[value] = obj;\r\n return obj;\r\n }\r\n}\r\n\r\n/**\r\n * Returns a Long representing the given 32 bit integer value.\r\n * @function\r\n * @param {number} value The 32 bit integer in question\r\n * @param {boolean=} unsigned Whether unsigned or not, defaults to signed\r\n * @returns {!Long} The corresponding Long value\r\n */\r\nLong.fromInt = fromInt;\r\n\r\n/**\r\n * @param {number} value\r\n * @param {boolean=} unsigned\r\n * @returns {!Long}\r\n * @inner\r\n */\r\nfunction fromNumber(value, unsigned) {\r\n if (isNaN(value))\r\n return unsigned ? UZERO : ZERO;\r\n if (unsigned) {\r\n if (value < 0)\r\n return UZERO;\r\n if (value >= TWO_PWR_64_DBL)\r\n return MAX_UNSIGNED_VALUE;\r\n } else {\r\n if (value <= -TWO_PWR_63_DBL)\r\n return MIN_VALUE;\r\n if (value + 1 >= TWO_PWR_63_DBL)\r\n return MAX_VALUE;\r\n }\r\n if (value < 0)\r\n return fromNumber(-value, unsigned).neg();\r\n return fromBits((value % TWO_PWR_32_DBL) | 0, (value / TWO_PWR_32_DBL) | 0, unsigned);\r\n}\r\n\r\n/**\r\n * Returns a Long representing the given value, provided that it is a finite number. Otherwise, zero is returned.\r\n * @function\r\n * @param {number} value The number in question\r\n * @param {boolean=} unsigned Whether unsigned or not, defaults to signed\r\n * @returns {!Long} The corresponding Long value\r\n */\r\nLong.fromNumber = fromNumber;\r\n\r\n/**\r\n * @param {number} lowBits\r\n * @param {number} highBits\r\n * @param {boolean=} unsigned\r\n * @returns {!Long}\r\n * @inner\r\n */\r\nfunction fromBits(lowBits, highBits, unsigned) {\r\n return new Long(lowBits, highBits, unsigned);\r\n}\r\n\r\n/**\r\n * Returns a Long representing the 64 bit integer that comes by concatenating the given low and high bits. Each is\r\n * assumed to use 32 bits.\r\n * @function\r\n * @param {number} lowBits The low 32 bits\r\n * @param {number} highBits The high 32 bits\r\n * @param {boolean=} unsigned Whether unsigned or not, defaults to signed\r\n * @returns {!Long} The corresponding Long value\r\n */\r\nLong.fromBits = fromBits;\r\n\r\n/**\r\n * @function\r\n * @param {number} base\r\n * @param {number} exponent\r\n * @returns {number}\r\n * @inner\r\n */\r\nvar pow_dbl = Math.pow; // Used 4 times (4*8 to 15+4)\r\n\r\n/**\r\n * @param {string} str\r\n * @param {(boolean|number)=} unsigned\r\n * @param {number=} radix\r\n * @returns {!Long}\r\n * @inner\r\n */\r\nfunction fromString(str, unsigned, radix) {\r\n if (str.length === 0)\r\n throw Error('empty string');\r\n if (str === \"NaN\" || str === \"Infinity\" || str === \"+Infinity\" || str === \"-Infinity\")\r\n return ZERO;\r\n if (typeof unsigned === 'number') {\r\n // For goog.math.long compatibility\r\n radix = unsigned,\r\n unsigned = false;\r\n } else {\r\n unsigned = !! unsigned;\r\n }\r\n radix = radix || 10;\r\n if (radix < 2 || 36 < radix)\r\n throw RangeError('radix');\r\n\r\n var p;\r\n if ((p = str.indexOf('-')) > 0)\r\n throw Error('interior hyphen');\r\n else if (p === 0) {\r\n return fromString(str.substring(1), unsigned, radix).neg();\r\n }\r\n\r\n // Do several (8) digits each time through the loop, so as to\r\n // minimize the calls to the very expensive emulated div.\r\n var radixToPower = fromNumber(pow_dbl(radix, 8));\r\n\r\n var result = ZERO;\r\n for (var i = 0; i < str.length; i += 8) {\r\n var size = Math.min(8, str.length - i),\r\n value = parseInt(str.substring(i, i + size), radix);\r\n if (size < 8) {\r\n var power = fromNumber(pow_dbl(radix, size));\r\n result = result.mul(power).add(fromNumber(value));\r\n } else {\r\n result = result.mul(radixToPower);\r\n result = result.add(fromNumber(value));\r\n }\r\n }\r\n result.unsigned = unsigned;\r\n return result;\r\n}\r\n\r\n/**\r\n * Returns a Long representation of the given string, written using the specified radix.\r\n * @function\r\n * @param {string} str The textual representation of the Long\r\n * @param {(boolean|number)=} unsigned Whether unsigned or not, defaults to signed\r\n * @param {number=} radix The radix in which the text is written (2-36), defaults to 10\r\n * @returns {!Long} The corresponding Long value\r\n */\r\nLong.fromString = fromString;\r\n\r\n/**\r\n * @function\r\n * @param {!Long|number|string|!{low: number, high: number, unsigned: boolean}} val\r\n * @param {boolean=} unsigned\r\n * @returns {!Long}\r\n * @inner\r\n */\r\nfunction fromValue(val, unsigned) {\r\n if (typeof val === 'number')\r\n return fromNumber(val, unsigned);\r\n if (typeof val === 'string')\r\n return fromString(val, unsigned);\r\n // Throws for non-objects, converts non-instanceof Long:\r\n return fromBits(val.low, val.high, typeof unsigned === 'boolean' ? unsigned : val.unsigned);\r\n}\r\n\r\n/**\r\n * Converts the specified value to a Long using the appropriate from* function for its type.\r\n * @function\r\n * @param {!Long|number|string|!{low: number, high: number, unsigned: boolean}} val Value\r\n * @param {boolean=} unsigned Whether unsigned or not, defaults to signed\r\n * @returns {!Long}\r\n */\r\nLong.fromValue = fromValue;\r\n\r\n// NOTE: the compiler should inline these constant values below and then remove these variables, so there should be\r\n// no runtime penalty for these.\r\n\r\n/**\r\n * @type {number}\r\n * @const\r\n * @inner\r\n */\r\nvar TWO_PWR_16_DBL = 1 << 16;\r\n\r\n/**\r\n * @type {number}\r\n * @const\r\n * @inner\r\n */\r\nvar TWO_PWR_24_DBL = 1 << 24;\r\n\r\n/**\r\n * @type {number}\r\n * @const\r\n * @inner\r\n */\r\nvar TWO_PWR_32_DBL = TWO_PWR_16_DBL * TWO_PWR_16_DBL;\r\n\r\n/**\r\n * @type {number}\r\n * @const\r\n * @inner\r\n */\r\nvar TWO_PWR_64_DBL = TWO_PWR_32_DBL * TWO_PWR_32_DBL;\r\n\r\n/**\r\n * @type {number}\r\n * @const\r\n * @inner\r\n */\r\nvar TWO_PWR_63_DBL = TWO_PWR_64_DBL / 2;\r\n\r\n/**\r\n * @type {!Long}\r\n * @const\r\n * @inner\r\n */\r\nvar TWO_PWR_24 = fromInt(TWO_PWR_24_DBL);\r\n\r\n/**\r\n * @type {!Long}\r\n * @inner\r\n */\r\nvar ZERO = fromInt(0);\r\n\r\n/**\r\n * Signed zero.\r\n * @type {!Long}\r\n */\r\nLong.ZERO = ZERO;\r\n\r\n/**\r\n * @type {!Long}\r\n * @inner\r\n */\r\nvar UZERO = fromInt(0, true);\r\n\r\n/**\r\n * Unsigned zero.\r\n * @type {!Long}\r\n */\r\nLong.UZERO = UZERO;\r\n\r\n/**\r\n * @type {!Long}\r\n * @inner\r\n */\r\nvar ONE = fromInt(1);\r\n\r\n/**\r\n * Signed one.\r\n * @type {!Long}\r\n */\r\nLong.ONE = ONE;\r\n\r\n/**\r\n * @type {!Long}\r\n * @inner\r\n */\r\nvar UONE = fromInt(1, true);\r\n\r\n/**\r\n * Unsigned one.\r\n * @type {!Long}\r\n */\r\nLong.UONE = UONE;\r\n\r\n/**\r\n * @type {!Long}\r\n * @inner\r\n */\r\nvar NEG_ONE = fromInt(-1);\r\n\r\n/**\r\n * Signed negative one.\r\n * @type {!Long}\r\n */\r\nLong.NEG_ONE = NEG_ONE;\r\n\r\n/**\r\n * @type {!Long}\r\n * @inner\r\n */\r\nvar MAX_VALUE = fromBits(0xFFFFFFFF|0, 0x7FFFFFFF|0, false);\r\n\r\n/**\r\n * Maximum signed value.\r\n * @type {!Long}\r\n */\r\nLong.MAX_VALUE = MAX_VALUE;\r\n\r\n/**\r\n * @type {!Long}\r\n * @inner\r\n */\r\nvar MAX_UNSIGNED_VALUE = fromBits(0xFFFFFFFF|0, 0xFFFFFFFF|0, true);\r\n\r\n/**\r\n * Maximum unsigned value.\r\n * @type {!Long}\r\n */\r\nLong.MAX_UNSIGNED_VALUE = MAX_UNSIGNED_VALUE;\r\n\r\n/**\r\n * @type {!Long}\r\n * @inner\r\n */\r\nvar MIN_VALUE = fromBits(0, 0x80000000|0, false);\r\n\r\n/**\r\n * Minimum signed value.\r\n * @type {!Long}\r\n */\r\nLong.MIN_VALUE = MIN_VALUE;\r\n\r\n/**\r\n * @alias Long.prototype\r\n * @inner\r\n */\r\nvar LongPrototype = Long.prototype;\r\n\r\n/**\r\n * Converts the Long to a 32 bit integer, assuming it is a 32 bit integer.\r\n * @returns {number}\r\n */\r\nLongPrototype.toInt = function toInt() {\r\n return this.unsigned ? this.low >>> 0 : this.low;\r\n};\r\n\r\n/**\r\n * Converts the Long to a the nearest floating-point representation of this value (double, 53 bit mantissa).\r\n * @returns {number}\r\n */\r\nLongPrototype.toNumber = function toNumber() {\r\n if (this.unsigned)\r\n return ((this.high >>> 0) * TWO_PWR_32_DBL) + (this.low >>> 0);\r\n return this.high * TWO_PWR_32_DBL + (this.low >>> 0);\r\n};\r\n\r\n/**\r\n * Converts the Long to a string written in the specified radix.\r\n * @param {number=} radix Radix (2-36), defaults to 10\r\n * @returns {string}\r\n * @override\r\n * @throws {RangeError} If `radix` is out of range\r\n */\r\nLongPrototype.toString = function toString(radix) {\r\n radix = radix || 10;\r\n if (radix < 2 || 36 < radix)\r\n throw RangeError('radix');\r\n if (this.isZero())\r\n return '0';\r\n if (this.isNegative()) { // Unsigned Longs are never negative\r\n if (this.eq(MIN_VALUE)) {\r\n // We need to change the Long value before it can be negated, so we remove\r\n // the bottom-most digit in this base and then recurse to do the rest.\r\n var radixLong = fromNumber(radix),\r\n div = this.div(radixLong),\r\n rem1 = div.mul(radixLong).sub(this);\r\n return div.toString(radix) + rem1.toInt().toString(radix);\r\n } else\r\n return '-' + this.neg().toString(radix);\r\n }\r\n\r\n // Do several (6) digits each time through the loop, so as to\r\n // minimize the calls to the very expensive emulated div.\r\n var radixToPower = fromNumber(pow_dbl(radix, 6), this.unsigned),\r\n rem = this;\r\n var result = '';\r\n while (true) {\r\n var remDiv = rem.div(radixToPower),\r\n intval = rem.sub(remDiv.mul(radixToPower)).toInt() >>> 0,\r\n digits = intval.toString(radix);\r\n rem = remDiv;\r\n if (rem.isZero())\r\n return digits + result;\r\n else {\r\n while (digits.length < 6)\r\n digits = '0' + digits;\r\n result = '' + digits + result;\r\n }\r\n }\r\n};\r\n\r\n/**\r\n * Gets the high 32 bits as a signed integer.\r\n * @returns {number} Signed high bits\r\n */\r\nLongPrototype.getHighBits = function getHighBits() {\r\n return this.high;\r\n};\r\n\r\n/**\r\n * Gets the high 32 bits as an unsigned integer.\r\n * @returns {number} Unsigned high bits\r\n */\r\nLongPrototype.getHighBitsUnsigned = function getHighBitsUnsigned() {\r\n return this.high >>> 0;\r\n};\r\n\r\n/**\r\n * Gets the low 32 bits as a signed integer.\r\n * @returns {number} Signed low bits\r\n */\r\nLongPrototype.getLowBits = function getLowBits() {\r\n return this.low;\r\n};\r\n\r\n/**\r\n * Gets the low 32 bits as an unsigned integer.\r\n * @returns {number} Unsigned low bits\r\n */\r\nLongPrototype.getLowBitsUnsigned = function getLowBitsUnsigned() {\r\n return this.low >>> 0;\r\n};\r\n\r\n/**\r\n * Gets the number of bits needed to represent the absolute value of this Long.\r\n * @returns {number}\r\n */\r\nLongPrototype.getNumBitsAbs = function getNumBitsAbs() {\r\n if (this.isNegative()) // Unsigned Longs are never negative\r\n return this.eq(MIN_VALUE) ? 64 : this.neg().getNumBitsAbs();\r\n var val = this.high != 0 ? this.high : this.low;\r\n for (var bit = 31; bit > 0; bit--)\r\n if ((val & (1 << bit)) != 0)\r\n break;\r\n return this.high != 0 ? bit + 33 : bit + 1;\r\n};\r\n\r\n/**\r\n * Tests if this Long's value equals zero.\r\n * @returns {boolean}\r\n */\r\nLongPrototype.isZero = function isZero() {\r\n return this.high === 0 && this.low === 0;\r\n};\r\n\r\n/**\r\n * Tests if this Long's value equals zero. This is an alias of {@link Long#isZero}.\r\n * @returns {boolean}\r\n */\r\nLongPrototype.eqz = LongPrototype.isZero;\r\n\r\n/**\r\n * Tests if this Long's value is negative.\r\n * @returns {boolean}\r\n */\r\nLongPrototype.isNegative = function isNegative() {\r\n return !this.unsigned && this.high < 0;\r\n};\r\n\r\n/**\r\n * Tests if this Long's value is positive.\r\n * @returns {boolean}\r\n */\r\nLongPrototype.isPositive = function isPositive() {\r\n return this.unsigned || this.high >= 0;\r\n};\r\n\r\n/**\r\n * Tests if this Long's value is odd.\r\n * @returns {boolean}\r\n */\r\nLongPrototype.isOdd = function isOdd() {\r\n return (this.low & 1) === 1;\r\n};\r\n\r\n/**\r\n * Tests if this Long's value is even.\r\n * @returns {boolean}\r\n */\r\nLongPrototype.isEven = function isEven() {\r\n return (this.low & 1) === 0;\r\n};\r\n\r\n/**\r\n * Tests if this Long's value equals the specified's.\r\n * @param {!Long|number|string} other Other value\r\n * @returns {boolean}\r\n */\r\nLongPrototype.equals = function equals(other) {\r\n if (!isLong(other))\r\n other = fromValue(other);\r\n if (this.unsigned !== other.unsigned && (this.high >>> 31) === 1 && (other.high >>> 31) === 1)\r\n return false;\r\n return this.high === other.high && this.low === other.low;\r\n};\r\n\r\n/**\r\n * Tests if this Long's value equals the specified's. This is an alias of {@link Long#equals}.\r\n * @function\r\n * @param {!Long|number|string} other Other value\r\n * @returns {boolean}\r\n */\r\nLongPrototype.eq = LongPrototype.equals;\r\n\r\n/**\r\n * Tests if this Long's value differs from the specified's.\r\n * @param {!Long|number|string} other Other value\r\n * @returns {boolean}\r\n */\r\nLongPrototype.notEquals = function notEquals(other) {\r\n return !this.eq(/* validates */ other);\r\n};\r\n\r\n/**\r\n * Tests if this Long's value differs from the specified's. This is an alias of {@link Long#notEquals}.\r\n * @function\r\n * @param {!Long|number|string} other Other value\r\n * @returns {boolean}\r\n */\r\nLongPrototype.neq = LongPrototype.notEquals;\r\n\r\n/**\r\n * Tests if this Long's value differs from the specified's. This is an alias of {@link Long#notEquals}.\r\n * @function\r\n * @param {!Long|number|string} other Other value\r\n * @returns {boolean}\r\n */\r\nLongPrototype.ne = LongPrototype.notEquals;\r\n\r\n/**\r\n * Tests if this Long's value is less than the specified's.\r\n * @param {!Long|number|string} other Other value\r\n * @returns {boolean}\r\n */\r\nLongPrototype.lessThan = function lessThan(other) {\r\n return this.comp(/* validates */ other) < 0;\r\n};\r\n\r\n/**\r\n * Tests if this Long's value is less than the specified's. This is an alias of {@link Long#lessThan}.\r\n * @function\r\n * @param {!Long|number|string} other Other value\r\n * @returns {boolean}\r\n */\r\nLongPrototype.lt = LongPrototype.lessThan;\r\n\r\n/**\r\n * Tests if this Long's value is less than or equal the specified's.\r\n * @param {!Long|number|string} other Other value\r\n * @returns {boolean}\r\n */\r\nLongPrototype.lessThanOrEqual = function lessThanOrEqual(other) {\r\n return this.comp(/* validates */ other) <= 0;\r\n};\r\n\r\n/**\r\n * Tests if this Long's value is less than or equal the specified's. This is an alias of {@link Long#lessThanOrEqual}.\r\n * @function\r\n * @param {!Long|number|string} other Other value\r\n * @returns {boolean}\r\n */\r\nLongPrototype.lte = LongPrototype.lessThanOrEqual;\r\n\r\n/**\r\n * Tests if this Long's value is less than or equal the specified's. This is an alias of {@link Long#lessThanOrEqual}.\r\n * @function\r\n * @param {!Long|number|string} other Other value\r\n * @returns {boolean}\r\n */\r\nLongPrototype.le = LongPrototype.lessThanOrEqual;\r\n\r\n/**\r\n * Tests if this Long's value is greater than the specified's.\r\n * @param {!Long|number|string} other Other value\r\n * @returns {boolean}\r\n */\r\nLongPrototype.greaterThan = function greaterThan(other) {\r\n return this.comp(/* validates */ other) > 0;\r\n};\r\n\r\n/**\r\n * Tests if this Long's value is greater than the specified's. This is an alias of {@link Long#greaterThan}.\r\n * @function\r\n * @param {!Long|number|string} other Other value\r\n * @returns {boolean}\r\n */\r\nLongPrototype.gt = LongPrototype.greaterThan;\r\n\r\n/**\r\n * Tests if this Long's value is greater than or equal the specified's.\r\n * @param {!Long|number|string} other Other value\r\n * @returns {boolean}\r\n */\r\nLongPrototype.greaterThanOrEqual = function greaterThanOrEqual(other) {\r\n return this.comp(/* validates */ other) >= 0;\r\n};\r\n\r\n/**\r\n * Tests if this Long's value is greater than or equal the specified's. This is an alias of {@link Long#greaterThanOrEqual}.\r\n * @function\r\n * @param {!Long|number|string} other Other value\r\n * @returns {boolean}\r\n */\r\nLongPrototype.gte = LongPrototype.greaterThanOrEqual;\r\n\r\n/**\r\n * Tests if this Long's value is greater than or equal the specified's. This is an alias of {@link Long#greaterThanOrEqual}.\r\n * @function\r\n * @param {!Long|number|string} other Other value\r\n * @returns {boolean}\r\n */\r\nLongPrototype.ge = LongPrototype.greaterThanOrEqual;\r\n\r\n/**\r\n * Compares this Long's value with the specified's.\r\n * @param {!Long|number|string} other Other value\r\n * @returns {number} 0 if they are the same, 1 if the this is greater and -1\r\n * if the given one is greater\r\n */\r\nLongPrototype.compare = function compare(other) {\r\n if (!isLong(other))\r\n other = fromValue(other);\r\n if (this.eq(other))\r\n return 0;\r\n var thisNeg = this.isNegative(),\r\n otherNeg = other.isNegative();\r\n if (thisNeg && !otherNeg)\r\n return -1;\r\n if (!thisNeg && otherNeg)\r\n return 1;\r\n // At this point the sign bits are the same\r\n if (!this.unsigned)\r\n return this.sub(other).isNegative() ? -1 : 1;\r\n // Both are positive if at least one is unsigned\r\n return (other.high >>> 0) > (this.high >>> 0) || (other.high === this.high && (other.low >>> 0) > (this.low >>> 0)) ? -1 : 1;\r\n};\r\n\r\n/**\r\n * Compares this Long's value with the specified's. This is an alias of {@link Long#compare}.\r\n * @function\r\n * @param {!Long|number|string} other Other value\r\n * @returns {number} 0 if they are the same, 1 if the this is greater and -1\r\n * if the given one is greater\r\n */\r\nLongPrototype.comp = LongPrototype.compare;\r\n\r\n/**\r\n * Negates this Long's value.\r\n * @returns {!Long} Negated Long\r\n */\r\nLongPrototype.negate = function negate() {\r\n if (!this.unsigned && this.eq(MIN_VALUE))\r\n return MIN_VALUE;\r\n return this.not().add(ONE);\r\n};\r\n\r\n/**\r\n * Negates this Long's value. This is an alias of {@link Long#negate}.\r\n * @function\r\n * @returns {!Long} Negated Long\r\n */\r\nLongPrototype.neg = LongPrototype.negate;\r\n\r\n/**\r\n * Returns the sum of this and the specified Long.\r\n * @param {!Long|number|string} addend Addend\r\n * @returns {!Long} Sum\r\n */\r\nLongPrototype.add = function add(addend) {\r\n if (!isLong(addend))\r\n addend = fromValue(addend);\r\n\r\n // Divide each number into 4 chunks of 16 bits, and then sum the chunks.\r\n\r\n var a48 = this.high >>> 16;\r\n var a32 = this.high & 0xFFFF;\r\n var a16 = this.low >>> 16;\r\n var a00 = this.low & 0xFFFF;\r\n\r\n var b48 = addend.high >>> 16;\r\n var b32 = addend.high & 0xFFFF;\r\n var b16 = addend.low >>> 16;\r\n var b00 = addend.low & 0xFFFF;\r\n\r\n var c48 = 0, c32 = 0, c16 = 0, c00 = 0;\r\n c00 += a00 + b00;\r\n c16 += c00 >>> 16;\r\n c00 &= 0xFFFF;\r\n c16 += a16 + b16;\r\n c32 += c16 >>> 16;\r\n c16 &= 0xFFFF;\r\n c32 += a32 + b32;\r\n c48 += c32 >>> 16;\r\n c32 &= 0xFFFF;\r\n c48 += a48 + b48;\r\n c48 &= 0xFFFF;\r\n return fromBits((c16 << 16) | c00, (c48 << 16) | c32, this.unsigned);\r\n};\r\n\r\n/**\r\n * Returns the difference of this and the specified Long.\r\n * @param {!Long|number|string} subtrahend Subtrahend\r\n * @returns {!Long} Difference\r\n */\r\nLongPrototype.subtract = function subtract(subtrahend) {\r\n if (!isLong(subtrahend))\r\n subtrahend = fromValue(subtrahend);\r\n return this.add(subtrahend.neg());\r\n};\r\n\r\n/**\r\n * Returns the difference of this and the specified Long. This is an alias of {@link Long#subtract}.\r\n * @function\r\n * @param {!Long|number|string} subtrahend Subtrahend\r\n * @returns {!Long} Difference\r\n */\r\nLongPrototype.sub = LongPrototype.subtract;\r\n\r\n/**\r\n * Returns the product of this and the specified Long.\r\n * @param {!Long|number|string} multiplier Multiplier\r\n * @returns {!Long} Product\r\n */\r\nLongPrototype.multiply = function multiply(multiplier) {\r\n if (this.isZero())\r\n return ZERO;\r\n if (!isLong(multiplier))\r\n multiplier = fromValue(multiplier);\r\n\r\n // use wasm support if present\r\n if (wasm) {\r\n var low = wasm.mul(this.low,\r\n this.high,\r\n multiplier.low,\r\n multiplier.high);\r\n return fromBits(low, wasm.get_high(), this.unsigned);\r\n }\r\n\r\n if (multiplier.isZero())\r\n return ZERO;\r\n if (this.eq(MIN_VALUE))\r\n return multiplier.isOdd() ? MIN_VALUE : ZERO;\r\n if (multiplier.eq(MIN_VALUE))\r\n return this.isOdd() ? MIN_VALUE : ZERO;\r\n\r\n if (this.isNegative()) {\r\n if (multiplier.isNegative())\r\n return this.neg().mul(multiplier.neg());\r\n else\r\n return this.neg().mul(multiplier).neg();\r\n } else if (multiplier.isNegative())\r\n return this.mul(multiplier.neg()).neg();\r\n\r\n // If both longs are small, use float multiplication\r\n if (this.lt(TWO_PWR_24) && multiplier.lt(TWO_PWR_24))\r\n return fromNumber(this.toNumber() * multiplier.toNumber(), this.unsigned);\r\n\r\n // Divide each long into 4 chunks of 16 bits, and then add up 4x4 products.\r\n // We can skip products that would overflow.\r\n\r\n var a48 = this.high >>> 16;\r\n var a32 = this.high & 0xFFFF;\r\n var a16 = this.low >>> 16;\r\n var a00 = this.low & 0xFFFF;\r\n\r\n var b48 = multiplier.high >>> 16;\r\n var b32 = multiplier.high & 0xFFFF;\r\n var b16 = multiplier.low >>> 16;\r\n var b00 = multiplier.low & 0xFFFF;\r\n\r\n var c48 = 0, c32 = 0, c16 = 0, c00 = 0;\r\n c00 += a00 * b00;\r\n c16 += c00 >>> 16;\r\n c00 &= 0xFFFF;\r\n c16 += a16 * b00;\r\n c32 += c16 >>> 16;\r\n c16 &= 0xFFFF;\r\n c16 += a00 * b16;\r\n c32 += c16 >>> 16;\r\n c16 &= 0xFFFF;\r\n c32 += a32 * b00;\r\n c48 += c32 >>> 16;\r\n c32 &= 0xFFFF;\r\n c32 += a16 * b16;\r\n c48 += c32 >>> 16;\r\n c32 &= 0xFFFF;\r\n c32 += a00 * b32;\r\n c48 += c32 >>> 16;\r\n c32 &= 0xFFFF;\r\n c48 += a48 * b00 + a32 * b16 + a16 * b32 + a00 * b48;\r\n c48 &= 0xFFFF;\r\n return fromBits((c16 << 16) | c00, (c48 << 16) | c32, this.unsigned);\r\n};\r\n\r\n/**\r\n * Returns the product of this and the specified Long. This is an alias of {@link Long#multiply}.\r\n * @function\r\n * @param {!Long|number|string} multiplier Multiplier\r\n * @returns {!Long} Product\r\n */\r\nLongPrototype.mul = LongPrototype.multiply;\r\n\r\n/**\r\n * Returns this Long divided by the specified. The result is signed if this Long is signed or\r\n * unsigned if this Long is unsigned.\r\n * @param {!Long|number|string} divisor Divisor\r\n * @returns {!Long} Quotient\r\n */\r\nLongPrototype.divide = function divide(divisor) {\r\n if (!isLong(divisor))\r\n divisor = fromValue(divisor);\r\n if (divisor.isZero())\r\n throw Error('division by zero');\r\n\r\n // use wasm support if present\r\n if (wasm) {\r\n // guard against signed division overflow: the largest\r\n // negative number / -1 would be 1 larger than the largest\r\n // positive number, due to two's complement.\r\n if (!this.unsigned &&\r\n this.high === -0x80000000 &&\r\n divisor.low === -1 && divisor.high === -1) {\r\n // be consistent with non-wasm code path\r\n return this;\r\n }\r\n var low = (this.unsigned ? wasm.div_u : wasm.div_s)(\r\n this.low,\r\n this.high,\r\n divisor.low,\r\n divisor.high\r\n );\r\n return fromBits(low, wasm.get_high(), this.unsigned);\r\n }\r\n\r\n if (this.isZero())\r\n return this.unsigned ? UZERO : ZERO;\r\n var approx, rem, res;\r\n if (!this.unsigned) {\r\n // This section is only relevant for signed longs and is derived from the\r\n // closure library as a whole.\r\n if (this.eq(MIN_VALUE)) {\r\n if (divisor.eq(ONE) || divisor.eq(NEG_ONE))\r\n return MIN_VALUE; // recall that -MIN_VALUE == MIN_VALUE\r\n else if (divisor.eq(MIN_VALUE))\r\n return ONE;\r\n else {\r\n // At this point, we have |other| >= 2, so |this/other| < |MIN_VALUE|.\r\n var halfThis = this.shr(1);\r\n approx = halfThis.div(divisor).shl(1);\r\n if (approx.eq(ZERO)) {\r\n return divisor.isNegative() ? ONE : NEG_ONE;\r\n } else {\r\n rem = this.sub(divisor.mul(approx));\r\n res = approx.add(rem.div(divisor));\r\n return res;\r\n }\r\n }\r\n } else if (divisor.eq(MIN_VALUE))\r\n return this.unsigned ? UZERO : ZERO;\r\n if (this.isNegative()) {\r\n if (divisor.isNegative())\r\n return this.neg().div(divisor.neg());\r\n return this.neg().div(divisor).neg();\r\n } else if (divisor.isNegative())\r\n return this.div(divisor.neg()).neg();\r\n res = ZERO;\r\n } else {\r\n // The algorithm below has not been made for unsigned longs. It's therefore\r\n // required to take special care of the MSB prior to running it.\r\n if (!divisor.unsigned)\r\n divisor = divisor.toUnsigned();\r\n if (divisor.gt(this))\r\n return UZERO;\r\n if (divisor.gt(this.shru(1))) // 15 >>> 1 = 7 ; with divisor = 8 ; true\r\n return UONE;\r\n res = UZERO;\r\n }\r\n\r\n // Repeat the following until the remainder is less than other: find a\r\n // floating-point that approximates remainder / other *from below*, add this\r\n // into the result, and subtract it from the remainder. It is critical that\r\n // the approximate value is less than or equal to the real value so that the\r\n // remainder never becomes negative.\r\n rem = this;\r\n while (rem.gte(divisor)) {\r\n // Approximate the result of division. This may be a little greater or\r\n // smaller than the actual value.\r\n approx = Math.max(1, Math.floor(rem.toNumber() / divisor.toNumber()));\r\n\r\n // We will tweak the approximate result by changing it in the 48-th digit or\r\n // the smallest non-fractional digit, whichever is larger.\r\n var log2 = Math.ceil(Math.log(approx) / Math.LN2),\r\n delta = (log2 <= 48) ? 1 : pow_dbl(2, log2 - 48),\r\n\r\n // Decrease the approximation until it is smaller than the remainder. Note\r\n // that if it is too large, the product overflows and is negative.\r\n approxRes = fromNumber(approx),\r\n approxRem = approxRes.mul(divisor);\r\n while (approxRem.isNegative() || approxRem.gt(rem)) {\r\n approx -= delta;\r\n approxRes = fromNumber(approx, this.unsigned);\r\n approxRem = approxRes.mul(divisor);\r\n }\r\n\r\n // We know the answer can't be zero... and actually, zero would cause\r\n // infinite recursion since we would make no progress.\r\n if (approxRes.isZero())\r\n approxRes = ONE;\r\n\r\n res = res.add(approxRes);\r\n rem = rem.sub(approxRem);\r\n }\r\n return res;\r\n};\r\n\r\n/**\r\n * Returns this Long divided by the specified. This is an alias of {@link Long#divide}.\r\n * @function\r\n * @param {!Long|number|string} divisor Divisor\r\n * @returns {!Long} Quotient\r\n */\r\nLongPrototype.div = LongPrototype.divide;\r\n\r\n/**\r\n * Returns this Long modulo the specified.\r\n * @param {!Long|number|string} divisor Divisor\r\n * @returns {!Long} Remainder\r\n */\r\nLongPrototype.modulo = function modulo(divisor) {\r\n if (!isLong(divisor))\r\n divisor = fromValue(divisor);\r\n\r\n // use wasm support if present\r\n if (wasm) {\r\n var low = (this.unsigned ? wasm.rem_u : wasm.rem_s)(\r\n this.low,\r\n this.high,\r\n divisor.low,\r\n divisor.high\r\n );\r\n return fromBits(low, wasm.get_high(), this.unsigned);\r\n }\r\n\r\n return this.sub(this.div(divisor).mul(divisor));\r\n};\r\n\r\n/**\r\n * Returns this Long modulo the specified. This is an alias of {@link Long#modulo}.\r\n * @function\r\n * @param {!Long|number|string} divisor Divisor\r\n * @returns {!Long} Remainder\r\n */\r\nLongPrototype.mod = LongPrototype.modulo;\r\n\r\n/**\r\n * Returns this Long modulo the specified. This is an alias of {@link Long#modulo}.\r\n * @function\r\n * @param {!Long|number|string} divisor Divisor\r\n * @returns {!Long} Remainder\r\n */\r\nLongPrototype.rem = LongPrototype.modulo;\r\n\r\n/**\r\n * Returns the bitwise NOT of this Long.\r\n * @returns {!Long}\r\n */\r\nLongPrototype.not = function not() {\r\n return fromBits(~this.low, ~this.high, this.unsigned);\r\n};\r\n\r\n/**\r\n * Returns the bitwise AND of this Long and the specified.\r\n * @param {!Long|number|string} other Other Long\r\n * @returns {!Long}\r\n */\r\nLongPrototype.and = function and(other) {\r\n if (!isLong(other))\r\n other = fromValue(other);\r\n return fromBits(this.low & other.low, this.high & other.high, this.unsigned);\r\n};\r\n\r\n/**\r\n * Returns the bitwise OR of this Long and the specified.\r\n * @param {!Long|number|string} other Other Long\r\n * @returns {!Long}\r\n */\r\nLongPrototype.or = function or(other) {\r\n if (!isLong(other))\r\n other = fromValue(other);\r\n return fromBits(this.low | other.low, this.high | other.high, this.unsigned);\r\n};\r\n\r\n/**\r\n * Returns the bitwise XOR of this Long and the given one.\r\n * @param {!Long|number|string} other Other Long\r\n * @returns {!Long}\r\n */\r\nLongPrototype.xor = function xor(other) {\r\n if (!isLong(other))\r\n other = fromValue(other);\r\n return fromBits(this.low ^ other.low, this.high ^ other.high, this.unsigned);\r\n};\r\n\r\n/**\r\n * Returns this Long with bits shifted to the left by the given amount.\r\n * @param {number|!Long} numBits Number of bits\r\n * @returns {!Long} Shifted Long\r\n */\r\nLongPrototype.shiftLeft = function shiftLeft(numBits) {\r\n if (isLong(numBits))\r\n numBits = numBits.toInt();\r\n if ((numBits &= 63) === 0)\r\n return this;\r\n else if (numBits < 32)\r\n return fromBits(this.low << numBits, (this.high << numBits) | (this.low >>> (32 - numBits)), this.unsigned);\r\n else\r\n return fromBits(0, this.low << (numBits - 32), this.unsigned);\r\n};\r\n\r\n/**\r\n * Returns this Long with bits shifted to the left by the given amount. This is an alias of {@link Long#shiftLeft}.\r\n * @function\r\n * @param {number|!Long} numBits Number of bits\r\n * @returns {!Long} Shifted Long\r\n */\r\nLongPrototype.shl = LongPrototype.shiftLeft;\r\n\r\n/**\r\n * Returns this Long with bits arithmetically shifted to the right by the given amount.\r\n * @param {number|!Long} numBits Number of bits\r\n * @returns {!Long} Shifted Long\r\n */\r\nLongPrototype.shiftRight = function shiftRight(numBits) {\r\n if (isLong(numBits))\r\n numBits = numBits.toInt();\r\n if ((numBits &= 63) === 0)\r\n return this;\r\n else if (numBits < 32)\r\n return fromBits((this.low >>> numBits) | (this.high << (32 - numBits)), this.high >> numBits, this.unsigned);\r\n else\r\n return fromBits(this.high >> (numBits - 32), this.high >= 0 ? 0 : -1, this.unsigned);\r\n};\r\n\r\n/**\r\n * Returns this Long with bits arithmetically shifted to the right by the given amount. This is an alias of {@link Long#shiftRight}.\r\n * @function\r\n * @param {number|!Long} numBits Number of bits\r\n * @returns {!Long} Shifted Long\r\n */\r\nLongPrototype.shr = LongPrototype.shiftRight;\r\n\r\n/**\r\n * Returns this Long with bits logically shifted to the right by the given amount.\r\n * @param {number|!Long} numBits Number of bits\r\n * @returns {!Long} Shifted Long\r\n */\r\nLongPrototype.shiftRightUnsigned = function shiftRightUnsigned(numBits) {\r\n if (isLong(numBits))\r\n numBits = numBits.toInt();\r\n numBits &= 63;\r\n if (numBits === 0)\r\n return this;\r\n else {\r\n var high = this.high;\r\n if (numBits < 32) {\r\n var low = this.low;\r\n return fromBits((low >>> numBits) | (high << (32 - numBits)), high >>> numBits, this.unsigned);\r\n } else if (numBits === 32)\r\n return fromBits(high, 0, this.unsigned);\r\n else\r\n return fromBits(high >>> (numBits - 32), 0, this.unsigned);\r\n }\r\n};\r\n\r\n/**\r\n * Returns this Long with bits logically shifted to the right by the given amount. This is an alias of {@link Long#shiftRightUnsigned}.\r\n * @function\r\n * @param {number|!Long} numBits Number of bits\r\n * @returns {!Long} Shifted Long\r\n */\r\nLongPrototype.shru = LongPrototype.shiftRightUnsigned;\r\n\r\n/**\r\n * Returns this Long with bits logically shifted to the right by the given amount. This is an alias of {@link Long#shiftRightUnsigned}.\r\n * @function\r\n * @param {number|!Long} numBits Number of bits\r\n * @returns {!Long} Shifted Long\r\n */\r\nLongPrototype.shr_u = LongPrototype.shiftRightUnsigned;\r\n\r\n/**\r\n * Converts this Long to signed.\r\n * @returns {!Long} Signed long\r\n */\r\nLongPrototype.toSigned = function toSigned() {\r\n if (!this.unsigned)\r\n return this;\r\n return fromBits(this.low, this.high, false);\r\n};\r\n\r\n/**\r\n * Converts this Long to unsigned.\r\n * @returns {!Long} Unsigned long\r\n */\r\nLongPrototype.toUnsigned = function toUnsigned() {\r\n if (this.unsigned)\r\n return this;\r\n return fromBits(this.low, this.high, true);\r\n};\r\n\r\n/**\r\n * Converts this Long to its byte representation.\r\n * @param {boolean=} le Whether little or big endian, defaults to big endian\r\n * @returns {!Array.} Byte representation\r\n */\r\nLongPrototype.toBytes = function toBytes(le) {\r\n return le ? this.toBytesLE() : this.toBytesBE();\r\n};\r\n\r\n/**\r\n * Converts this Long to its little endian byte representation.\r\n * @returns {!Array.} Little endian byte representation\r\n */\r\nLongPrototype.toBytesLE = function toBytesLE() {\r\n var hi = this.high,\r\n lo = this.low;\r\n return [\r\n lo & 0xff,\r\n lo >>> 8 & 0xff,\r\n lo >>> 16 & 0xff,\r\n lo >>> 24 ,\r\n hi & 0xff,\r\n hi >>> 8 & 0xff,\r\n hi >>> 16 & 0xff,\r\n hi >>> 24\r\n ];\r\n};\r\n\r\n/**\r\n * Converts this Long to its big endian byte representation.\r\n * @returns {!Array.} Big endian byte representation\r\n */\r\nLongPrototype.toBytesBE = function toBytesBE() {\r\n var hi = this.high,\r\n lo = this.low;\r\n return [\r\n hi >>> 24 ,\r\n hi >>> 16 & 0xff,\r\n hi >>> 8 & 0xff,\r\n hi & 0xff,\r\n lo >>> 24 ,\r\n lo >>> 16 & 0xff,\r\n lo >>> 8 & 0xff,\r\n lo & 0xff\r\n ];\r\n};\r\n\r\n/**\r\n * Creates a Long from its byte representation.\r\n * @param {!Array.} bytes Byte representation\r\n * @param {boolean=} unsigned Whether unsigned or not, defaults to signed\r\n * @param {boolean=} le Whether little or big endian, defaults to big endian\r\n * @returns {Long} The corresponding Long value\r\n */\r\nLong.fromBytes = function fromBytes(bytes, unsigned, le) {\r\n return le ? Long.fromBytesLE(bytes, unsigned) : Long.fromBytesBE(bytes, unsigned);\r\n};\r\n\r\n/**\r\n * Creates a Long from its little endian byte representation.\r\n * @param {!Array.} bytes Little endian byte representation\r\n * @param {boolean=} unsigned Whether unsigned or not, defaults to signed\r\n * @returns {Long} The corresponding Long value\r\n */\r\nLong.fromBytesLE = function fromBytesLE(bytes, unsigned) {\r\n return new Long(\r\n bytes[0] |\r\n bytes[1] << 8 |\r\n bytes[2] << 16 |\r\n bytes[3] << 24,\r\n bytes[4] |\r\n bytes[5] << 8 |\r\n bytes[6] << 16 |\r\n bytes[7] << 24,\r\n unsigned\r\n );\r\n};\r\n\r\n/**\r\n * Creates a Long from its big endian byte representation.\r\n * @param {!Array.} bytes Big endian byte representation\r\n * @param {boolean=} unsigned Whether unsigned or not, defaults to signed\r\n * @returns {Long} The corresponding Long value\r\n */\r\nLong.fromBytesBE = function fromBytesBE(bytes, unsigned) {\r\n return new Long(\r\n bytes[4] << 24 |\r\n bytes[5] << 16 |\r\n bytes[6] << 8 |\r\n bytes[7],\r\n bytes[0] << 24 |\r\n bytes[1] << 16 |\r\n bytes[2] << 8 |\r\n bytes[3],\r\n unsigned\r\n );\r\n};\r\n", "", "// A port of an algorithm by Johannes Baag\u00F8e , 2010\n// http://baagoe.com/en/RandomMusings/javascript/\n// https://github.com/nquinlan/better-random-numbers-for-javascript-mirror\n// Original work is under MIT license -\n\n// Copyright (C) 2010 by Johannes Baag\u00F8e \n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n// \n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n// \n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n\n\n\n(function(global, module, define) {\n\nfunction Alea(seed) {\n var me = this, mash = Mash();\n\n me.next = function() {\n var t = 2091639 * me.s0 + me.c * 2.3283064365386963e-10; // 2^-32\n me.s0 = me.s1;\n me.s1 = me.s2;\n return me.s2 = t - (me.c = t | 0);\n };\n\n // Apply the seeding algorithm from Baagoe.\n me.c = 1;\n me.s0 = mash(' ');\n me.s1 = mash(' ');\n me.s2 = mash(' ');\n me.s0 -= mash(seed);\n if (me.s0 < 0) { me.s0 += 1; }\n me.s1 -= mash(seed);\n if (me.s1 < 0) { me.s1 += 1; }\n me.s2 -= mash(seed);\n if (me.s2 < 0) { me.s2 += 1; }\n mash = null;\n}\n\nfunction copy(f, t) {\n t.c = f.c;\n t.s0 = f.s0;\n t.s1 = f.s1;\n t.s2 = f.s2;\n return t;\n}\n\nfunction impl(seed, opts) {\n var xg = new Alea(seed),\n state = opts && opts.state,\n prng = xg.next;\n prng.int32 = function() { return (xg.next() * 0x100000000) | 0; }\n prng.double = function() {\n return prng() + (prng() * 0x200000 | 0) * 1.1102230246251565e-16; // 2^-53\n };\n prng.quick = prng;\n if (state) {\n if (typeof(state) == 'object') copy(state, xg);\n prng.state = function() { return copy(xg, {}); }\n }\n return prng;\n}\n\nfunction Mash() {\n var n = 0xefc8249d;\n\n var mash = function(data) {\n data = data.toString();\n for (var i = 0; i < data.length; i++) {\n n += data.charCodeAt(i);\n var h = 0.02519603282416938 * n;\n n = h >>> 0;\n h -= n;\n h *= n;\n n = h >>> 0;\n h -= n;\n n += h * 0x100000000; // 2^32\n }\n return (n >>> 0) * 2.3283064365386963e-10; // 2^-32\n };\n\n return mash;\n}\n\n\nif (module && module.exports) {\n module.exports = impl;\n} else if (define && define.amd) {\n define(function() { return impl; });\n} else {\n this.alea = impl;\n}\n\n})(\n this,\n (typeof module) == 'object' && module, // present in node.js\n (typeof define) == 'function' && define // present with an AMD loader\n);\n\n\n", "// A Javascript implementaion of the \"xor128\" prng algorithm by\n// George Marsaglia. See http://www.jstatsoft.org/v08/i14/paper\n\n(function(global, module, define) {\n\nfunction XorGen(seed) {\n var me = this, strseed = '';\n\n me.x = 0;\n me.y = 0;\n me.z = 0;\n me.w = 0;\n\n // Set up generator function.\n me.next = function() {\n var t = me.x ^ (me.x << 11);\n me.x = me.y;\n me.y = me.z;\n me.z = me.w;\n return me.w ^= (me.w >>> 19) ^ t ^ (t >>> 8);\n };\n\n if (seed === (seed | 0)) {\n // Integer seed.\n me.x = seed;\n } else {\n // String seed.\n strseed += seed;\n }\n\n // Mix in string seed, then discard an initial batch of 64 values.\n for (var k = 0; k < strseed.length + 64; k++) {\n me.x ^= strseed.charCodeAt(k) | 0;\n me.next();\n }\n}\n\nfunction copy(f, t) {\n t.x = f.x;\n t.y = f.y;\n t.z = f.z;\n t.w = f.w;\n return t;\n}\n\nfunction impl(seed, opts) {\n var xg = new XorGen(seed),\n state = opts && opts.state,\n prng = function() { return (xg.next() >>> 0) / 0x100000000; };\n prng.double = function() {\n do {\n var top = xg.next() >>> 11,\n bot = (xg.next() >>> 0) / 0x100000000,\n result = (top + bot) / (1 << 21);\n } while (result === 0);\n return result;\n };\n prng.int32 = xg.next;\n prng.quick = prng;\n if (state) {\n if (typeof(state) == 'object') copy(state, xg);\n prng.state = function() { return copy(xg, {}); }\n }\n return prng;\n}\n\nif (module && module.exports) {\n module.exports = impl;\n} else if (define && define.amd) {\n define(function() { return impl; });\n} else {\n this.xor128 = impl;\n}\n\n})(\n this,\n (typeof module) == 'object' && module, // present in node.js\n (typeof define) == 'function' && define // present with an AMD loader\n);\n\n\n", "// A Javascript implementaion of the \"xorwow\" prng algorithm by\n// George Marsaglia. See http://www.jstatsoft.org/v08/i14/paper\n\n(function(global, module, define) {\n\nfunction XorGen(seed) {\n var me = this, strseed = '';\n\n // Set up generator function.\n me.next = function() {\n var t = (me.x ^ (me.x >>> 2));\n me.x = me.y; me.y = me.z; me.z = me.w; me.w = me.v;\n return (me.d = (me.d + 362437 | 0)) +\n (me.v = (me.v ^ (me.v << 4)) ^ (t ^ (t << 1))) | 0;\n };\n\n me.x = 0;\n me.y = 0;\n me.z = 0;\n me.w = 0;\n me.v = 0;\n\n if (seed === (seed | 0)) {\n // Integer seed.\n me.x = seed;\n } else {\n // String seed.\n strseed += seed;\n }\n\n // Mix in string seed, then discard an initial batch of 64 values.\n for (var k = 0; k < strseed.length + 64; k++) {\n me.x ^= strseed.charCodeAt(k) | 0;\n if (k == strseed.length) {\n me.d = me.x << 10 ^ me.x >>> 4;\n }\n me.next();\n }\n}\n\nfunction copy(f, t) {\n t.x = f.x;\n t.y = f.y;\n t.z = f.z;\n t.w = f.w;\n t.v = f.v;\n t.d = f.d;\n return t;\n}\n\nfunction impl(seed, opts) {\n var xg = new XorGen(seed),\n state = opts && opts.state,\n prng = function() { return (xg.next() >>> 0) / 0x100000000; };\n prng.double = function() {\n do {\n var top = xg.next() >>> 11,\n bot = (xg.next() >>> 0) / 0x100000000,\n result = (top + bot) / (1 << 21);\n } while (result === 0);\n return result;\n };\n prng.int32 = xg.next;\n prng.quick = prng;\n if (state) {\n if (typeof(state) == 'object') copy(state, xg);\n prng.state = function() { return copy(xg, {}); }\n }\n return prng;\n}\n\nif (module && module.exports) {\n module.exports = impl;\n} else if (define && define.amd) {\n define(function() { return impl; });\n} else {\n this.xorwow = impl;\n}\n\n})(\n this,\n (typeof module) == 'object' && module, // present in node.js\n (typeof define) == 'function' && define // present with an AMD loader\n);\n\n\n", "// A Javascript implementaion of the \"xorshift7\" algorithm by\n// Fran\u00E7ois Panneton and Pierre L'ecuyer:\n// \"On the Xorgshift Random Number Generators\"\n// http://saluc.engr.uconn.edu/refs/crypto/rng/panneton05onthexorshift.pdf\n\n(function(global, module, define) {\n\nfunction XorGen(seed) {\n var me = this;\n\n // Set up generator function.\n me.next = function() {\n // Update xor generator.\n var X = me.x, i = me.i, t, v, w;\n t = X[i]; t ^= (t >>> 7); v = t ^ (t << 24);\n t = X[(i + 1) & 7]; v ^= t ^ (t >>> 10);\n t = X[(i + 3) & 7]; v ^= t ^ (t >>> 3);\n t = X[(i + 4) & 7]; v ^= t ^ (t << 7);\n t = X[(i + 7) & 7]; t = t ^ (t << 13); v ^= t ^ (t << 9);\n X[i] = v;\n me.i = (i + 1) & 7;\n return v;\n };\n\n function init(me, seed) {\n var j, w, X = [];\n\n if (seed === (seed | 0)) {\n // Seed state array using a 32-bit integer.\n w = X[0] = seed;\n } else {\n // Seed state using a string.\n seed = '' + seed;\n for (j = 0; j < seed.length; ++j) {\n X[j & 7] = (X[j & 7] << 15) ^\n (seed.charCodeAt(j) + X[(j + 1) & 7] << 13);\n }\n }\n // Enforce an array length of 8, not all zeroes.\n while (X.length < 8) X.push(0);\n for (j = 0; j < 8 && X[j] === 0; ++j);\n if (j == 8) w = X[7] = -1; else w = X[j];\n\n me.x = X;\n me.i = 0;\n\n // Discard an initial 256 values.\n for (j = 256; j > 0; --j) {\n me.next();\n }\n }\n\n init(me, seed);\n}\n\nfunction copy(f, t) {\n t.x = f.x.slice();\n t.i = f.i;\n return t;\n}\n\nfunction impl(seed, opts) {\n if (seed == null) seed = +(new Date);\n var xg = new XorGen(seed),\n state = opts && opts.state,\n prng = function() { return (xg.next() >>> 0) / 0x100000000; };\n prng.double = function() {\n do {\n var top = xg.next() >>> 11,\n bot = (xg.next() >>> 0) / 0x100000000,\n result = (top + bot) / (1 << 21);\n } while (result === 0);\n return result;\n };\n prng.int32 = xg.next;\n prng.quick = prng;\n if (state) {\n if (state.x) copy(state, xg);\n prng.state = function() { return copy(xg, {}); }\n }\n return prng;\n}\n\nif (module && module.exports) {\n module.exports = impl;\n} else if (define && define.amd) {\n define(function() { return impl; });\n} else {\n this.xorshift7 = impl;\n}\n\n})(\n this,\n (typeof module) == 'object' && module, // present in node.js\n (typeof define) == 'function' && define // present with an AMD loader\n);\n\n", "// A Javascript implementaion of Richard Brent's Xorgens xor4096 algorithm.\n//\n// This fast non-cryptographic random number generator is designed for\n// use in Monte-Carlo algorithms. It combines a long-period xorshift\n// generator with a Weyl generator, and it passes all common batteries\n// of stasticial tests for randomness while consuming only a few nanoseconds\n// for each prng generated. For background on the generator, see Brent's\n// paper: \"Some long-period random number generators using shifts and xors.\"\n// http://arxiv.org/pdf/1004.3115v1.pdf\n//\n// Usage:\n//\n// var xor4096 = require('xor4096');\n// random = xor4096(1); // Seed with int32 or string.\n// assert.equal(random(), 0.1520436450538547); // (0, 1) range, 53 bits.\n// assert.equal(random.int32(), 1806534897); // signed int32, 32 bits.\n//\n// For nonzero numeric keys, this impelementation provides a sequence\n// identical to that by Brent's xorgens 3 implementaion in C. This\n// implementation also provides for initalizing the generator with\n// string seeds, or for saving and restoring the state of the generator.\n//\n// On Chrome, this prng benchmarks about 2.1 times slower than\n// Javascript's built-in Math.random().\n\n(function(global, module, define) {\n\nfunction XorGen(seed) {\n var me = this;\n\n // Set up generator function.\n me.next = function() {\n var w = me.w,\n X = me.X, i = me.i, t, v;\n // Update Weyl generator.\n me.w = w = (w + 0x61c88647) | 0;\n // Update xor generator.\n v = X[(i + 34) & 127];\n t = X[i = ((i + 1) & 127)];\n v ^= v << 13;\n t ^= t << 17;\n v ^= v >>> 15;\n t ^= t >>> 12;\n // Update Xor generator array state.\n v = X[i] = v ^ t;\n me.i = i;\n // Result is the combination.\n return (v + (w ^ (w >>> 16))) | 0;\n };\n\n function init(me, seed) {\n var t, v, i, j, w, X = [], limit = 128;\n if (seed === (seed | 0)) {\n // Numeric seeds initialize v, which is used to generates X.\n v = seed;\n seed = null;\n } else {\n // String seeds are mixed into v and X one character at a time.\n seed = seed + '\\0';\n v = 0;\n limit = Math.max(limit, seed.length);\n }\n // Initialize circular array and weyl value.\n for (i = 0, j = -32; j < limit; ++j) {\n // Put the unicode characters into the array, and shuffle them.\n if (seed) v ^= seed.charCodeAt((j + 32) % seed.length);\n // After 32 shuffles, take v as the starting w value.\n if (j === 0) w = v;\n v ^= v << 10;\n v ^= v >>> 15;\n v ^= v << 4;\n v ^= v >>> 13;\n if (j >= 0) {\n w = (w + 0x61c88647) | 0; // Weyl.\n t = (X[j & 127] ^= (v + w)); // Combine xor and weyl to init array.\n i = (0 == t) ? i + 1 : 0; // Count zeroes.\n }\n }\n // We have detected all zeroes; make the key nonzero.\n if (i >= 128) {\n X[(seed && seed.length || 0) & 127] = -1;\n }\n // Run the generator 512 times to further mix the state before using it.\n // Factoring this as a function slows the main generator, so it is just\n // unrolled here. The weyl generator is not advanced while warming up.\n i = 127;\n for (j = 4 * 128; j > 0; --j) {\n v = X[(i + 34) & 127];\n t = X[i = ((i + 1) & 127)];\n v ^= v << 13;\n t ^= t << 17;\n v ^= v >>> 15;\n t ^= t >>> 12;\n X[i] = v ^ t;\n }\n // Storing state as object members is faster than using closure variables.\n me.w = w;\n me.X = X;\n me.i = i;\n }\n\n init(me, seed);\n}\n\nfunction copy(f, t) {\n t.i = f.i;\n t.w = f.w;\n t.X = f.X.slice();\n return t;\n};\n\nfunction impl(seed, opts) {\n if (seed == null) seed = +(new Date);\n var xg = new XorGen(seed),\n state = opts && opts.state,\n prng = function() { return (xg.next() >>> 0) / 0x100000000; };\n prng.double = function() {\n do {\n var top = xg.next() >>> 11,\n bot = (xg.next() >>> 0) / 0x100000000,\n result = (top + bot) / (1 << 21);\n } while (result === 0);\n return result;\n };\n prng.int32 = xg.next;\n prng.quick = prng;\n if (state) {\n if (state.X) copy(state, xg);\n prng.state = function() { return copy(xg, {}); }\n }\n return prng;\n}\n\nif (module && module.exports) {\n module.exports = impl;\n} else if (define && define.amd) {\n define(function() { return impl; });\n} else {\n this.xor4096 = impl;\n}\n\n})(\n this, // window object or global\n (typeof module) == 'object' && module, // present in node.js\n (typeof define) == 'function' && define // present with an AMD loader\n);\n", "// A Javascript implementaion of the \"Tyche-i\" prng algorithm by\n// Samuel Neves and Filipe Araujo.\n// See https://eden.dei.uc.pt/~sneves/pubs/2011-snfa2.pdf\n\n(function(global, module, define) {\n\nfunction XorGen(seed) {\n var me = this, strseed = '';\n\n // Set up generator function.\n me.next = function() {\n var b = me.b, c = me.c, d = me.d, a = me.a;\n b = (b << 25) ^ (b >>> 7) ^ c;\n c = (c - d) | 0;\n d = (d << 24) ^ (d >>> 8) ^ a;\n a = (a - b) | 0;\n me.b = b = (b << 20) ^ (b >>> 12) ^ c;\n me.c = c = (c - d) | 0;\n me.d = (d << 16) ^ (c >>> 16) ^ a;\n return me.a = (a - b) | 0;\n };\n\n /* The following is non-inverted tyche, which has better internal\n * bit diffusion, but which is about 25% slower than tyche-i in JS.\n me.next = function() {\n var a = me.a, b = me.b, c = me.c, d = me.d;\n a = (me.a + me.b | 0) >>> 0;\n d = me.d ^ a; d = d << 16 ^ d >>> 16;\n c = me.c + d | 0;\n b = me.b ^ c; b = b << 12 ^ d >>> 20;\n me.a = a = a + b | 0;\n d = d ^ a; me.d = d = d << 8 ^ d >>> 24;\n me.c = c = c + d | 0;\n b = b ^ c;\n return me.b = (b << 7 ^ b >>> 25);\n }\n */\n\n me.a = 0;\n me.b = 0;\n me.c = 2654435769 | 0;\n me.d = 1367130551;\n\n if (seed === Math.floor(seed)) {\n // Integer seed.\n me.a = (seed / 0x100000000) | 0;\n me.b = seed | 0;\n } else {\n // String seed.\n strseed += seed;\n }\n\n // Mix in string seed, then discard an initial batch of 64 values.\n for (var k = 0; k < strseed.length + 20; k++) {\n me.b ^= strseed.charCodeAt(k) | 0;\n me.next();\n }\n}\n\nfunction copy(f, t) {\n t.a = f.a;\n t.b = f.b;\n t.c = f.c;\n t.d = f.d;\n return t;\n};\n\nfunction impl(seed, opts) {\n var xg = new XorGen(seed),\n state = opts && opts.state,\n prng = function() { return (xg.next() >>> 0) / 0x100000000; };\n prng.double = function() {\n do {\n var top = xg.next() >>> 11,\n bot = (xg.next() >>> 0) / 0x100000000,\n result = (top + bot) / (1 << 21);\n } while (result === 0);\n return result;\n };\n prng.int32 = xg.next;\n prng.quick = prng;\n if (state) {\n if (typeof(state) == 'object') copy(state, xg);\n prng.state = function() { return copy(xg, {}); }\n }\n return prng;\n}\n\nif (module && module.exports) {\n module.exports = impl;\n} else if (define && define.amd) {\n define(function() { return impl; });\n} else {\n this.tychei = impl;\n}\n\n})(\n this,\n (typeof module) == 'object' && module, // present in node.js\n (typeof define) == 'function' && define // present with an AMD loader\n);\n\n\n", "", "/*\nCopyright 2014 David Bau.\n\nPermission is hereby granted, free of charge, to any person obtaining\na copy of this software and associated documentation files (the\n\"Software\"), to deal in the Software without restriction, including\nwithout limitation the rights to use, copy, modify, merge, publish,\ndistribute, sublicense, and/or sell copies of the Software, and to\npermit persons to whom the Software is furnished to do so, subject to\nthe following conditions:\n\nThe above copyright notice and this permission notice shall be\nincluded in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\nMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.\nIN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY\nCLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,\nTORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\nSOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n*/\n\n(function (pool, math) {\n//\n// The following constants are related to IEEE 754 limits.\n//\nvar global = this,\n width = 256, // each RC4 output is 0 <= x < 256\n chunks = 6, // at least six RC4 outputs for each double\n digits = 52, // there are 52 significant digits in a double\n rngname = 'random', // rngname: name for Math.random and Math.seedrandom\n startdenom = math.pow(width, chunks),\n significance = math.pow(2, digits),\n overflow = significance * 2,\n mask = width - 1,\n nodecrypto; // node.js crypto module, initialized at the bottom.\n\n//\n// seedrandom()\n// This is the seedrandom function described above.\n//\nfunction seedrandom(seed, options, callback) {\n var key = [];\n options = (options == true) ? { entropy: true } : (options || {});\n\n // Flatten the seed string or build one from local entropy if needed.\n var shortseed = mixkey(flatten(\n options.entropy ? [seed, tostring(pool)] :\n (seed == null) ? autoseed() : seed, 3), key);\n\n // Use the seed to initialize an ARC4 generator.\n var arc4 = new ARC4(key);\n\n // This function returns a random double in [0, 1) that contains\n // randomness in every bit of the mantissa of the IEEE 754 value.\n var prng = function() {\n var n = arc4.g(chunks), // Start with a numerator n < 2 ^ 48\n d = startdenom, // and denominator d = 2 ^ 48.\n x = 0; // and no 'extra last byte'.\n while (n < significance) { // Fill up all significant digits by\n n = (n + x) * width; // shifting numerator and\n d *= width; // denominator and generating a\n x = arc4.g(1); // new least-significant-byte.\n }\n while (n >= overflow) { // To avoid rounding up, before adding\n n /= 2; // last byte, shift everything\n d /= 2; // right using integer math until\n x >>>= 1; // we have exactly the desired bits.\n }\n return (n + x) / d; // Form the number within [0, 1).\n };\n\n prng.int32 = function() { return arc4.g(4) | 0; }\n prng.quick = function() { return arc4.g(4) / 0x100000000; }\n prng.double = prng;\n\n // Mix the randomness into accumulated entropy.\n mixkey(tostring(arc4.S), pool);\n\n // Calling convention: what to return as a function of prng, seed, is_math.\n return (options.pass || callback ||\n function(prng, seed, is_math_call, state) {\n if (state) {\n // Load the arc4 state from the given state if it has an S array.\n if (state.S) { copy(state, arc4); }\n // Only provide the .state method if requested via options.state.\n prng.state = function() { return copy(arc4, {}); }\n }\n\n // If called as a method of Math (Math.seedrandom()), mutate\n // Math.random because that is how seedrandom.js has worked since v1.0.\n if (is_math_call) { math[rngname] = prng; return seed; }\n\n // Otherwise, it is a newer calling convention, so return the\n // prng directly.\n else return prng;\n })(\n prng,\n shortseed,\n 'global' in options ? options.global : (this == math),\n options.state);\n}\nmath['seed' + rngname] = seedrandom;\n\n//\n// ARC4\n//\n// An ARC4 implementation. The constructor takes a key in the form of\n// an array of at most (width) integers that should be 0 <= x < (width).\n//\n// The g(count) method returns a pseudorandom integer that concatenates\n// the next (count) outputs from ARC4. Its return value is a number x\n// that is in the range 0 <= x < (width ^ count).\n//\nfunction ARC4(key) {\n var t, keylen = key.length,\n me = this, i = 0, j = me.i = me.j = 0, s = me.S = [];\n\n // The empty key [] is treated as [0].\n if (!keylen) { key = [keylen++]; }\n\n // Set up S using the standard key scheduling algorithm.\n while (i < width) {\n s[i] = i++;\n }\n for (i = 0; i < width; i++) {\n s[i] = s[j = mask & (j + key[i % keylen] + (t = s[i]))];\n s[j] = t;\n }\n\n // The \"g\" method returns the next (count) outputs as one number.\n (me.g = function(count) {\n // Using instance members instead of closure state nearly doubles speed.\n var t, r = 0,\n i = me.i, j = me.j, s = me.S;\n while (count--) {\n t = s[i = mask & (i + 1)];\n r = r * width + s[mask & ((s[i] = s[j = mask & (j + t)]) + (s[j] = t))];\n }\n me.i = i; me.j = j;\n return r;\n // For robust unpredictability, the function call below automatically\n // discards an initial batch of values. This is called RC4-drop[256].\n // See http://google.com/search?q=rsa+fluhrer+response&btnI\n })(width);\n}\n\n//\n// copy()\n// Copies internal state of ARC4 to or from a plain object.\n//\nfunction copy(f, t) {\n t.i = f.i;\n t.j = f.j;\n t.S = f.S.slice();\n return t;\n};\n\n//\n// flatten()\n// Converts an object tree to nested arrays of strings.\n//\nfunction flatten(obj, depth) {\n var result = [], typ = (typeof obj), prop;\n if (depth && typ == 'object') {\n for (prop in obj) {\n try { result.push(flatten(obj[prop], depth - 1)); } catch (e) {}\n }\n }\n return (result.length ? result : typ == 'string' ? obj : obj + '\\0');\n}\n\n//\n// mixkey()\n// Mixes a string seed into a key that is an array of integers, and\n// returns a shortened string seed that is equivalent to the result key.\n//\nfunction mixkey(seed, key) {\n var stringseed = seed + '', smear, j = 0;\n while (j < stringseed.length) {\n key[mask & j] =\n mask & ((smear ^= key[mask & j] * 19) + stringseed.charCodeAt(j++));\n }\n return tostring(key);\n}\n\n//\n// autoseed()\n// Returns an object for autoseeding, using window.crypto and Node crypto\n// module if available.\n//\nfunction autoseed() {\n try {\n var out;\n if (nodecrypto && (out = nodecrypto.randomBytes)) {\n // The use of 'out' to remember randomBytes makes tight minified code.\n out = out(width);\n } else {\n out = new Uint8Array(width);\n (global.crypto || global.msCrypto).getRandomValues(out);\n }\n return tostring(out);\n } catch (e) {\n var browser = global.navigator,\n plugins = browser && browser.plugins;\n return [+new Date, global, plugins, global.screen, tostring(pool)];\n }\n}\n\n//\n// tostring()\n// Converts an array of charcodes to a string\n//\nfunction tostring(a) {\n return String.fromCharCode.apply(0, a);\n}\n\n//\n// When seedrandom.js is loaded, we immediately mix a few bits\n// from the built-in RNG into the entropy pool. Because we do\n// not want to interfere with deterministic PRNG state later,\n// seedrandom will not call math.random on its own again after\n// initialization.\n//\nmixkey(math.random(), pool);\n\n//\n// Nodejs and AMD support: export the implementation as a module using\n// either convention.\n//\nif ((typeof module) == 'object' && module.exports) {\n module.exports = seedrandom;\n // When in node.js, try using crypto package for autoseeding.\n try {\n nodecrypto = require('crypto');\n } catch (ex) {}\n} else if ((typeof define) == 'function' && define.amd) {\n define(function() { return seedrandom; });\n}\n\n// End anonymous scope, and pass initial values.\n})(\n [], // pool: entropy pool starts empty\n Math // math: package containing random, pow, and seedrandom\n);\n", "// A library of seedable RNGs implemented in Javascript.\n//\n// Usage:\n//\n// var seedrandom = require('seedrandom');\n// var random = seedrandom(1); // or any seed.\n// var x = random(); // 0 <= x < 1. Every bit is random.\n// var x = random.quick(); // 0 <= x < 1. 32 bits of randomness.\n\n// alea, a 53-bit multiply-with-carry generator by Johannes Baag\u00F8e.\n// Period: ~2^116\n// Reported to pass all BigCrush tests.\nvar alea = require('./lib/alea');\n\n// xor128, a pure xor-shift generator by George Marsaglia.\n// Period: 2^128-1.\n// Reported to fail: MatrixRank and LinearComp.\nvar xor128 = require('./lib/xor128');\n\n// xorwow, George Marsaglia's 160-bit xor-shift combined plus weyl.\n// Period: 2^192-2^32\n// Reported to fail: CollisionOver, SimpPoker, and LinearComp.\nvar xorwow = require('./lib/xorwow');\n\n// xorshift7, by Fran\u00E7ois Panneton and Pierre L'ecuyer, takes\n// a different approach: it adds robustness by allowing more shifts\n// than Marsaglia's original three. It is a 7-shift generator\n// with 256 bits, that passes BigCrush with no systmatic failures.\n// Period 2^256-1.\n// No systematic BigCrush failures reported.\nvar xorshift7 = require('./lib/xorshift7');\n\n// xor4096, by Richard Brent, is a 4096-bit xor-shift with a\n// very long period that also adds a Weyl generator. It also passes\n// BigCrush with no systematic failures. Its long period may\n// be useful if you have many generators and need to avoid\n// collisions.\n// Period: 2^4128-2^32.\n// No systematic BigCrush failures reported.\nvar xor4096 = require('./lib/xor4096');\n\n// Tyche-i, by Samuel Neves and Filipe Araujo, is a bit-shifting random\n// number generator derived from ChaCha, a modern stream cipher.\n// https://eden.dei.uc.pt/~sneves/pubs/2011-snfa2.pdf\n// Period: ~2^127\n// No systematic BigCrush failures reported.\nvar tychei = require('./lib/tychei');\n\n// The original ARC4-based prng included in this library.\n// Period: ~2^1600\nvar sr = require('./seedrandom');\n\nsr.alea = alea;\nsr.xor128 = xor128;\nsr.xorwow = xorwow;\nsr.xorshift7 = xorshift7;\nsr.xor4096 = xor4096;\nsr.tychei = tychei;\n\nmodule.exports = sr;\n", "// A port of an algorithm by Johannes Baag\u00F8e , 2010\n// http://baagoe.com/en/RandomMusings/javascript/\n// https://github.com/nquinlan/better-random-numbers-for-javascript-mirror\n// Original work is under MIT license -\n\n// Copyright (C) 2010 by Johannes Baag\u00F8e \n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n\n\n\n(function(global, module, define) {\n\nfunction Alea(seed) {\n var me = this, mash = Mash();\n\n me.next = function() {\n var t = 2091639 * me.s0 + me.c * 2.3283064365386963e-10; // 2^-32\n me.s0 = me.s1;\n me.s1 = me.s2;\n return me.s2 = t - (me.c = t | 0);\n };\n\n // Apply the seeding algorithm from Baagoe.\n me.c = 1;\n me.s0 = mash(' ');\n me.s1 = mash(' ');\n me.s2 = mash(' ');\n me.s0 -= mash(seed);\n if (me.s0 < 0) { me.s0 += 1; }\n me.s1 -= mash(seed);\n if (me.s1 < 0) { me.s1 += 1; }\n me.s2 -= mash(seed);\n if (me.s2 < 0) { me.s2 += 1; }\n mash = null;\n}\n\nfunction copy(f, t) {\n t.c = f.c;\n t.s0 = f.s0;\n t.s1 = f.s1;\n t.s2 = f.s2;\n return t;\n}\n\nfunction impl(seed, opts) {\n var xg = new Alea(seed),\n state = opts && opts.state,\n prng = xg.next;\n prng.int32 = function() { return (xg.next() * 0x100000000) | 0; }\n prng.double = function() {\n return prng() + (prng() * 0x200000 | 0) * 1.1102230246251565e-16; // 2^-53\n };\n prng.quick = prng;\n if (state) {\n if (typeof(state) == 'object') copy(state, xg);\n prng.state = function() { return copy(xg, {}); }\n }\n return prng;\n}\n\nfunction Mash() {\n var n = 0xefc8249d;\n\n var mash = function(data) {\n data = String(data);\n for (var i = 0; i < data.length; i++) {\n n += data.charCodeAt(i);\n var h = 0.02519603282416938 * n;\n n = h >>> 0;\n h -= n;\n h *= n;\n n = h >>> 0;\n h -= n;\n n += h * 0x100000000; // 2^32\n }\n return (n >>> 0) * 2.3283064365386963e-10; // 2^-32\n };\n\n return mash;\n}\n\n\nif (module && module.exports) {\n module.exports = impl;\n} else if (define && define.amd) {\n define(function() { return impl; });\n} else {\n this.alea = impl;\n}\n\n})(\n this,\n (typeof module) == 'object' && module, // present in node.js\n (typeof define) == 'function' && define // present with an AMD loader\n);\n\n\n", "// A Javascript implementaion of the \"xor128\" prng algorithm by\n// George Marsaglia. See http://www.jstatsoft.org/v08/i14/paper\n\n(function(global, module, define) {\n\nfunction XorGen(seed) {\n var me = this, strseed = '';\n\n me.x = 0;\n me.y = 0;\n me.z = 0;\n me.w = 0;\n\n // Set up generator function.\n me.next = function() {\n var t = me.x ^ (me.x << 11);\n me.x = me.y;\n me.y = me.z;\n me.z = me.w;\n return me.w ^= (me.w >>> 19) ^ t ^ (t >>> 8);\n };\n\n if (seed === (seed | 0)) {\n // Integer seed.\n me.x = seed;\n } else {\n // String seed.\n strseed += seed;\n }\n\n // Mix in string seed, then discard an initial batch of 64 values.\n for (var k = 0; k < strseed.length + 64; k++) {\n me.x ^= strseed.charCodeAt(k) | 0;\n me.next();\n }\n}\n\nfunction copy(f, t) {\n t.x = f.x;\n t.y = f.y;\n t.z = f.z;\n t.w = f.w;\n return t;\n}\n\nfunction impl(seed, opts) {\n var xg = new XorGen(seed),\n state = opts && opts.state,\n prng = function() { return (xg.next() >>> 0) / 0x100000000; };\n prng.double = function() {\n do {\n var top = xg.next() >>> 11,\n bot = (xg.next() >>> 0) / 0x100000000,\n result = (top + bot) / (1 << 21);\n } while (result === 0);\n return result;\n };\n prng.int32 = xg.next;\n prng.quick = prng;\n if (state) {\n if (typeof(state) == 'object') copy(state, xg);\n prng.state = function() { return copy(xg, {}); }\n }\n return prng;\n}\n\nif (module && module.exports) {\n module.exports = impl;\n} else if (define && define.amd) {\n define(function() { return impl; });\n} else {\n this.xor128 = impl;\n}\n\n})(\n this,\n (typeof module) == 'object' && module, // present in node.js\n (typeof define) == 'function' && define // present with an AMD loader\n);\n\n\n", "// A Javascript implementaion of the \"xorwow\" prng algorithm by\n// George Marsaglia. See http://www.jstatsoft.org/v08/i14/paper\n\n(function(global, module, define) {\n\nfunction XorGen(seed) {\n var me = this, strseed = '';\n\n // Set up generator function.\n me.next = function() {\n var t = (me.x ^ (me.x >>> 2));\n me.x = me.y; me.y = me.z; me.z = me.w; me.w = me.v;\n return (me.d = (me.d + 362437 | 0)) +\n (me.v = (me.v ^ (me.v << 4)) ^ (t ^ (t << 1))) | 0;\n };\n\n me.x = 0;\n me.y = 0;\n me.z = 0;\n me.w = 0;\n me.v = 0;\n\n if (seed === (seed | 0)) {\n // Integer seed.\n me.x = seed;\n } else {\n // String seed.\n strseed += seed;\n }\n\n // Mix in string seed, then discard an initial batch of 64 values.\n for (var k = 0; k < strseed.length + 64; k++) {\n me.x ^= strseed.charCodeAt(k) | 0;\n if (k == strseed.length) {\n me.d = me.x << 10 ^ me.x >>> 4;\n }\n me.next();\n }\n}\n\nfunction copy(f, t) {\n t.x = f.x;\n t.y = f.y;\n t.z = f.z;\n t.w = f.w;\n t.v = f.v;\n t.d = f.d;\n return t;\n}\n\nfunction impl(seed, opts) {\n var xg = new XorGen(seed),\n state = opts && opts.state,\n prng = function() { return (xg.next() >>> 0) / 0x100000000; };\n prng.double = function() {\n do {\n var top = xg.next() >>> 11,\n bot = (xg.next() >>> 0) / 0x100000000,\n result = (top + bot) / (1 << 21);\n } while (result === 0);\n return result;\n };\n prng.int32 = xg.next;\n prng.quick = prng;\n if (state) {\n if (typeof(state) == 'object') copy(state, xg);\n prng.state = function() { return copy(xg, {}); }\n }\n return prng;\n}\n\nif (module && module.exports) {\n module.exports = impl;\n} else if (define && define.amd) {\n define(function() { return impl; });\n} else {\n this.xorwow = impl;\n}\n\n})(\n this,\n (typeof module) == 'object' && module, // present in node.js\n (typeof define) == 'function' && define // present with an AMD loader\n);\n\n\n", "// A Javascript implementaion of the \"xorshift7\" algorithm by\n// Fran\u00E7ois Panneton and Pierre L'ecuyer:\n// \"On the Xorgshift Random Number Generators\"\n// http://saluc.engr.uconn.edu/refs/crypto/rng/panneton05onthexorshift.pdf\n\n(function(global, module, define) {\n\nfunction XorGen(seed) {\n var me = this;\n\n // Set up generator function.\n me.next = function() {\n // Update xor generator.\n var X = me.x, i = me.i, t, v, w;\n t = X[i]; t ^= (t >>> 7); v = t ^ (t << 24);\n t = X[(i + 1) & 7]; v ^= t ^ (t >>> 10);\n t = X[(i + 3) & 7]; v ^= t ^ (t >>> 3);\n t = X[(i + 4) & 7]; v ^= t ^ (t << 7);\n t = X[(i + 7) & 7]; t = t ^ (t << 13); v ^= t ^ (t << 9);\n X[i] = v;\n me.i = (i + 1) & 7;\n return v;\n };\n\n function init(me, seed) {\n var j, w, X = [];\n\n if (seed === (seed | 0)) {\n // Seed state array using a 32-bit integer.\n w = X[0] = seed;\n } else {\n // Seed state using a string.\n seed = '' + seed;\n for (j = 0; j < seed.length; ++j) {\n X[j & 7] = (X[j & 7] << 15) ^\n (seed.charCodeAt(j) + X[(j + 1) & 7] << 13);\n }\n }\n // Enforce an array length of 8, not all zeroes.\n while (X.length < 8) X.push(0);\n for (j = 0; j < 8 && X[j] === 0; ++j);\n if (j == 8) w = X[7] = -1; else w = X[j];\n\n me.x = X;\n me.i = 0;\n\n // Discard an initial 256 values.\n for (j = 256; j > 0; --j) {\n me.next();\n }\n }\n\n init(me, seed);\n}\n\nfunction copy(f, t) {\n t.x = f.x.slice();\n t.i = f.i;\n return t;\n}\n\nfunction impl(seed, opts) {\n if (seed == null) seed = +(new Date);\n var xg = new XorGen(seed),\n state = opts && opts.state,\n prng = function() { return (xg.next() >>> 0) / 0x100000000; };\n prng.double = function() {\n do {\n var top = xg.next() >>> 11,\n bot = (xg.next() >>> 0) / 0x100000000,\n result = (top + bot) / (1 << 21);\n } while (result === 0);\n return result;\n };\n prng.int32 = xg.next;\n prng.quick = prng;\n if (state) {\n if (state.x) copy(state, xg);\n prng.state = function() { return copy(xg, {}); }\n }\n return prng;\n}\n\nif (module && module.exports) {\n module.exports = impl;\n} else if (define && define.amd) {\n define(function() { return impl; });\n} else {\n this.xorshift7 = impl;\n}\n\n})(\n this,\n (typeof module) == 'object' && module, // present in node.js\n (typeof define) == 'function' && define // present with an AMD loader\n);\n\n", "// A Javascript implementaion of Richard Brent's Xorgens xor4096 algorithm.\n//\n// This fast non-cryptographic random number generator is designed for\n// use in Monte-Carlo algorithms. It combines a long-period xorshift\n// generator with a Weyl generator, and it passes all common batteries\n// of stasticial tests for randomness while consuming only a few nanoseconds\n// for each prng generated. For background on the generator, see Brent's\n// paper: \"Some long-period random number generators using shifts and xors.\"\n// http://arxiv.org/pdf/1004.3115v1.pdf\n//\n// Usage:\n//\n// var xor4096 = require('xor4096');\n// random = xor4096(1); // Seed with int32 or string.\n// assert.equal(random(), 0.1520436450538547); // (0, 1) range, 53 bits.\n// assert.equal(random.int32(), 1806534897); // signed int32, 32 bits.\n//\n// For nonzero numeric keys, this impelementation provides a sequence\n// identical to that by Brent's xorgens 3 implementaion in C. This\n// implementation also provides for initalizing the generator with\n// string seeds, or for saving and restoring the state of the generator.\n//\n// On Chrome, this prng benchmarks about 2.1 times slower than\n// Javascript's built-in Math.random().\n\n(function(global, module, define) {\n\nfunction XorGen(seed) {\n var me = this;\n\n // Set up generator function.\n me.next = function() {\n var w = me.w,\n X = me.X, i = me.i, t, v;\n // Update Weyl generator.\n me.w = w = (w + 0x61c88647) | 0;\n // Update xor generator.\n v = X[(i + 34) & 127];\n t = X[i = ((i + 1) & 127)];\n v ^= v << 13;\n t ^= t << 17;\n v ^= v >>> 15;\n t ^= t >>> 12;\n // Update Xor generator array state.\n v = X[i] = v ^ t;\n me.i = i;\n // Result is the combination.\n return (v + (w ^ (w >>> 16))) | 0;\n };\n\n function init(me, seed) {\n var t, v, i, j, w, X = [], limit = 128;\n if (seed === (seed | 0)) {\n // Numeric seeds initialize v, which is used to generates X.\n v = seed;\n seed = null;\n } else {\n // String seeds are mixed into v and X one character at a time.\n seed = seed + '\\0';\n v = 0;\n limit = Math.max(limit, seed.length);\n }\n // Initialize circular array and weyl value.\n for (i = 0, j = -32; j < limit; ++j) {\n // Put the unicode characters into the array, and shuffle them.\n if (seed) v ^= seed.charCodeAt((j + 32) % seed.length);\n // After 32 shuffles, take v as the starting w value.\n if (j === 0) w = v;\n v ^= v << 10;\n v ^= v >>> 15;\n v ^= v << 4;\n v ^= v >>> 13;\n if (j >= 0) {\n w = (w + 0x61c88647) | 0; // Weyl.\n t = (X[j & 127] ^= (v + w)); // Combine xor and weyl to init array.\n i = (0 == t) ? i + 1 : 0; // Count zeroes.\n }\n }\n // We have detected all zeroes; make the key nonzero.\n if (i >= 128) {\n X[(seed && seed.length || 0) & 127] = -1;\n }\n // Run the generator 512 times to further mix the state before using it.\n // Factoring this as a function slows the main generator, so it is just\n // unrolled here. The weyl generator is not advanced while warming up.\n i = 127;\n for (j = 4 * 128; j > 0; --j) {\n v = X[(i + 34) & 127];\n t = X[i = ((i + 1) & 127)];\n v ^= v << 13;\n t ^= t << 17;\n v ^= v >>> 15;\n t ^= t >>> 12;\n X[i] = v ^ t;\n }\n // Storing state as object members is faster than using closure variables.\n me.w = w;\n me.X = X;\n me.i = i;\n }\n\n init(me, seed);\n}\n\nfunction copy(f, t) {\n t.i = f.i;\n t.w = f.w;\n t.X = f.X.slice();\n return t;\n};\n\nfunction impl(seed, opts) {\n if (seed == null) seed = +(new Date);\n var xg = new XorGen(seed),\n state = opts && opts.state,\n prng = function() { return (xg.next() >>> 0) / 0x100000000; };\n prng.double = function() {\n do {\n var top = xg.next() >>> 11,\n bot = (xg.next() >>> 0) / 0x100000000,\n result = (top + bot) / (1 << 21);\n } while (result === 0);\n return result;\n };\n prng.int32 = xg.next;\n prng.quick = prng;\n if (state) {\n if (state.X) copy(state, xg);\n prng.state = function() { return copy(xg, {}); }\n }\n return prng;\n}\n\nif (module && module.exports) {\n module.exports = impl;\n} else if (define && define.amd) {\n define(function() { return impl; });\n} else {\n this.xor4096 = impl;\n}\n\n})(\n this, // window object or global\n (typeof module) == 'object' && module, // present in node.js\n (typeof define) == 'function' && define // present with an AMD loader\n);\n", "// A Javascript implementaion of the \"Tyche-i\" prng algorithm by\n// Samuel Neves and Filipe Araujo.\n// See https://eden.dei.uc.pt/~sneves/pubs/2011-snfa2.pdf\n\n(function(global, module, define) {\n\nfunction XorGen(seed) {\n var me = this, strseed = '';\n\n // Set up generator function.\n me.next = function() {\n var b = me.b, c = me.c, d = me.d, a = me.a;\n b = (b << 25) ^ (b >>> 7) ^ c;\n c = (c - d) | 0;\n d = (d << 24) ^ (d >>> 8) ^ a;\n a = (a - b) | 0;\n me.b = b = (b << 20) ^ (b >>> 12) ^ c;\n me.c = c = (c - d) | 0;\n me.d = (d << 16) ^ (c >>> 16) ^ a;\n return me.a = (a - b) | 0;\n };\n\n /* The following is non-inverted tyche, which has better internal\n * bit diffusion, but which is about 25% slower than tyche-i in JS.\n me.next = function() {\n var a = me.a, b = me.b, c = me.c, d = me.d;\n a = (me.a + me.b | 0) >>> 0;\n d = me.d ^ a; d = d << 16 ^ d >>> 16;\n c = me.c + d | 0;\n b = me.b ^ c; b = b << 12 ^ d >>> 20;\n me.a = a = a + b | 0;\n d = d ^ a; me.d = d = d << 8 ^ d >>> 24;\n me.c = c = c + d | 0;\n b = b ^ c;\n return me.b = (b << 7 ^ b >>> 25);\n }\n */\n\n me.a = 0;\n me.b = 0;\n me.c = 2654435769 | 0;\n me.d = 1367130551;\n\n if (seed === Math.floor(seed)) {\n // Integer seed.\n me.a = (seed / 0x100000000) | 0;\n me.b = seed | 0;\n } else {\n // String seed.\n strseed += seed;\n }\n\n // Mix in string seed, then discard an initial batch of 64 values.\n for (var k = 0; k < strseed.length + 20; k++) {\n me.b ^= strseed.charCodeAt(k) | 0;\n me.next();\n }\n}\n\nfunction copy(f, t) {\n t.a = f.a;\n t.b = f.b;\n t.c = f.c;\n t.d = f.d;\n return t;\n};\n\nfunction impl(seed, opts) {\n var xg = new XorGen(seed),\n state = opts && opts.state,\n prng = function() { return (xg.next() >>> 0) / 0x100000000; };\n prng.double = function() {\n do {\n var top = xg.next() >>> 11,\n bot = (xg.next() >>> 0) / 0x100000000,\n result = (top + bot) / (1 << 21);\n } while (result === 0);\n return result;\n };\n prng.int32 = xg.next;\n prng.quick = prng;\n if (state) {\n if (typeof(state) == 'object') copy(state, xg);\n prng.state = function() { return copy(xg, {}); }\n }\n return prng;\n}\n\nif (module && module.exports) {\n module.exports = impl;\n} else if (define && define.amd) {\n define(function() { return impl; });\n} else {\n this.tychei = impl;\n}\n\n})(\n this,\n (typeof module) == 'object' && module, // present in node.js\n (typeof define) == 'function' && define // present with an AMD loader\n);\n\n\n", "/*\nCopyright 2019 David Bau.\n\nPermission is hereby granted, free of charge, to any person obtaining\na copy of this software and associated documentation files (the\n\"Software\"), to deal in the Software without restriction, including\nwithout limitation the rights to use, copy, modify, merge, publish,\ndistribute, sublicense, and/or sell copies of the Software, and to\npermit persons to whom the Software is furnished to do so, subject to\nthe following conditions:\n\nThe above copyright notice and this permission notice shall be\nincluded in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\nMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.\nIN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY\nCLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,\nTORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\nSOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n*/\n\n(function (global, pool, math) {\n//\n// The following constants are related to IEEE 754 limits.\n//\n\nvar width = 256, // each RC4 output is 0 <= x < 256\n chunks = 6, // at least six RC4 outputs for each double\n digits = 52, // there are 52 significant digits in a double\n rngname = 'random', // rngname: name for Math.random and Math.seedrandom\n startdenom = math.pow(width, chunks),\n significance = math.pow(2, digits),\n overflow = significance * 2,\n mask = width - 1,\n nodecrypto; // node.js crypto module, initialized at the bottom.\n\n//\n// seedrandom()\n// This is the seedrandom function described above.\n//\nfunction seedrandom(seed, options, callback) {\n var key = [];\n options = (options == true) ? { entropy: true } : (options || {});\n\n // Flatten the seed string or build one from local entropy if needed.\n var shortseed = mixkey(flatten(\n options.entropy ? [seed, tostring(pool)] :\n (seed == null) ? autoseed() : seed, 3), key);\n\n // Use the seed to initialize an ARC4 generator.\n var arc4 = new ARC4(key);\n\n // This function returns a random double in [0, 1) that contains\n // randomness in every bit of the mantissa of the IEEE 754 value.\n var prng = function() {\n var n = arc4.g(chunks), // Start with a numerator n < 2 ^ 48\n d = startdenom, // and denominator d = 2 ^ 48.\n x = 0; // and no 'extra last byte'.\n while (n < significance) { // Fill up all significant digits by\n n = (n + x) * width; // shifting numerator and\n d *= width; // denominator and generating a\n x = arc4.g(1); // new least-significant-byte.\n }\n while (n >= overflow) { // To avoid rounding up, before adding\n n /= 2; // last byte, shift everything\n d /= 2; // right using integer math until\n x >>>= 1; // we have exactly the desired bits.\n }\n return (n + x) / d; // Form the number within [0, 1).\n };\n\n prng.int32 = function() { return arc4.g(4) | 0; }\n prng.quick = function() { return arc4.g(4) / 0x100000000; }\n prng.double = prng;\n\n // Mix the randomness into accumulated entropy.\n mixkey(tostring(arc4.S), pool);\n\n // Calling convention: what to return as a function of prng, seed, is_math.\n return (options.pass || callback ||\n function(prng, seed, is_math_call, state) {\n if (state) {\n // Load the arc4 state from the given state if it has an S array.\n if (state.S) { copy(state, arc4); }\n // Only provide the .state method if requested via options.state.\n prng.state = function() { return copy(arc4, {}); }\n }\n\n // If called as a method of Math (Math.seedrandom()), mutate\n // Math.random because that is how seedrandom.js has worked since v1.0.\n if (is_math_call) { math[rngname] = prng; return seed; }\n\n // Otherwise, it is a newer calling convention, so return the\n // prng directly.\n else return prng;\n })(\n prng,\n shortseed,\n 'global' in options ? options.global : (this == math),\n options.state);\n}\n\n//\n// ARC4\n//\n// An ARC4 implementation. The constructor takes a key in the form of\n// an array of at most (width) integers that should be 0 <= x < (width).\n//\n// The g(count) method returns a pseudorandom integer that concatenates\n// the next (count) outputs from ARC4. Its return value is a number x\n// that is in the range 0 <= x < (width ^ count).\n//\nfunction ARC4(key) {\n var t, keylen = key.length,\n me = this, i = 0, j = me.i = me.j = 0, s = me.S = [];\n\n // The empty key [] is treated as [0].\n if (!keylen) { key = [keylen++]; }\n\n // Set up S using the standard key scheduling algorithm.\n while (i < width) {\n s[i] = i++;\n }\n for (i = 0; i < width; i++) {\n s[i] = s[j = mask & (j + key[i % keylen] + (t = s[i]))];\n s[j] = t;\n }\n\n // The \"g\" method returns the next (count) outputs as one number.\n (me.g = function(count) {\n // Using instance members instead of closure state nearly doubles speed.\n var t, r = 0,\n i = me.i, j = me.j, s = me.S;\n while (count--) {\n t = s[i = mask & (i + 1)];\n r = r * width + s[mask & ((s[i] = s[j = mask & (j + t)]) + (s[j] = t))];\n }\n me.i = i; me.j = j;\n return r;\n // For robust unpredictability, the function call below automatically\n // discards an initial batch of values. This is called RC4-drop[256].\n // See http://google.com/search?q=rsa+fluhrer+response&btnI\n })(width);\n}\n\n//\n// copy()\n// Copies internal state of ARC4 to or from a plain object.\n//\nfunction copy(f, t) {\n t.i = f.i;\n t.j = f.j;\n t.S = f.S.slice();\n return t;\n};\n\n//\n// flatten()\n// Converts an object tree to nested arrays of strings.\n//\nfunction flatten(obj, depth) {\n var result = [], typ = (typeof obj), prop;\n if (depth && typ == 'object') {\n for (prop in obj) {\n try { result.push(flatten(obj[prop], depth - 1)); } catch (e) {}\n }\n }\n return (result.length ? result : typ == 'string' ? obj : obj + '\\0');\n}\n\n//\n// mixkey()\n// Mixes a string seed into a key that is an array of integers, and\n// returns a shortened string seed that is equivalent to the result key.\n//\nfunction mixkey(seed, key) {\n var stringseed = seed + '', smear, j = 0;\n while (j < stringseed.length) {\n key[mask & j] =\n mask & ((smear ^= key[mask & j] * 19) + stringseed.charCodeAt(j++));\n }\n return tostring(key);\n}\n\n//\n// autoseed()\n// Returns an object for autoseeding, using window.crypto and Node crypto\n// module if available.\n//\nfunction autoseed() {\n try {\n var out;\n if (nodecrypto && (out = nodecrypto.randomBytes)) {\n // The use of 'out' to remember randomBytes makes tight minified code.\n out = out(width);\n } else {\n out = new Uint8Array(width);\n (global.crypto || global.msCrypto).getRandomValues(out);\n }\n return tostring(out);\n } catch (e) {\n var browser = global.navigator,\n plugins = browser && browser.plugins;\n return [+new Date, global, plugins, global.screen, tostring(pool)];\n }\n}\n\n//\n// tostring()\n// Converts an array of charcodes to a string\n//\nfunction tostring(a) {\n return String.fromCharCode.apply(0, a);\n}\n\n//\n// When seedrandom.js is loaded, we immediately mix a few bits\n// from the built-in RNG into the entropy pool. Because we do\n// not want to interfere with deterministic PRNG state later,\n// seedrandom will not call math.random on its own again after\n// initialization.\n//\nmixkey(math.random(), pool);\n\n//\n// Nodejs and AMD support: export the implementation as a module using\n// either convention.\n//\nif ((typeof module) == 'object' && module.exports) {\n module.exports = seedrandom;\n // When in node.js, try using crypto package for autoseeding.\n try {\n nodecrypto = require('crypto');\n } catch (ex) {}\n} else if ((typeof define) == 'function' && define.amd) {\n define(function() { return seedrandom; });\n} else {\n // When included as a plain script, set up Math.seedrandom global.\n math['seed' + rngname] = seedrandom;\n}\n\n\n// End anonymous scope, and pass initial values.\n})(\n // global: `self` in browsers (including strict mode and web workers),\n // otherwise `this` in Node and other environments\n (typeof self !== 'undefined') ? self : this,\n [], // pool: entropy pool starts empty\n Math // math: package containing random, pow, and seedrandom\n);\n", "// A library of seedable RNGs implemented in Javascript.\n//\n// Usage:\n//\n// var seedrandom = require('seedrandom');\n// var random = seedrandom(1); // or any seed.\n// var x = random(); // 0 <= x < 1. Every bit is random.\n// var x = random.quick(); // 0 <= x < 1. 32 bits of randomness.\n\n// alea, a 53-bit multiply-with-carry generator by Johannes Baag\u00F8e.\n// Period: ~2^116\n// Reported to pass all BigCrush tests.\nvar alea = require('./lib/alea');\n\n// xor128, a pure xor-shift generator by George Marsaglia.\n// Period: 2^128-1.\n// Reported to fail: MatrixRank and LinearComp.\nvar xor128 = require('./lib/xor128');\n\n// xorwow, George Marsaglia's 160-bit xor-shift combined plus weyl.\n// Period: 2^192-2^32\n// Reported to fail: CollisionOver, SimpPoker, and LinearComp.\nvar xorwow = require('./lib/xorwow');\n\n// xorshift7, by Fran\u00E7ois Panneton and Pierre L'ecuyer, takes\n// a different approach: it adds robustness by allowing more shifts\n// than Marsaglia's original three. It is a 7-shift generator\n// with 256 bits, that passes BigCrush with no systmatic failures.\n// Period 2^256-1.\n// No systematic BigCrush failures reported.\nvar xorshift7 = require('./lib/xorshift7');\n\n// xor4096, by Richard Brent, is a 4096-bit xor-shift with a\n// very long period that also adds a Weyl generator. It also passes\n// BigCrush with no systematic failures. Its long period may\n// be useful if you have many generators and need to avoid\n// collisions.\n// Period: 2^4128-2^32.\n// No systematic BigCrush failures reported.\nvar xor4096 = require('./lib/xor4096');\n\n// Tyche-i, by Samuel Neves and Filipe Araujo, is a bit-shifting random\n// number generator derived from ChaCha, a modern stream cipher.\n// https://eden.dei.uc.pt/~sneves/pubs/2011-snfa2.pdf\n// Period: ~2^127\n// No systematic BigCrush failures reported.\nvar tychei = require('./lib/tychei');\n\n// The original ARC4-based prng included in this library.\n// Period: ~2^1600\nvar sr = require('./seedrandom');\n\nsr.alea = alea;\nsr.xor128 = xor128;\nsr.xorwow = xorwow;\nsr.xorshift7 = xorshift7;\nsr.xor4096 = xor4096;\nsr.tychei = tychei;\n\nmodule.exports = sr;\n", "", "", "", "", "\nvar WasmBackendModuleThreadedSimd = (function() {\n var _scriptDir = typeof document !== 'undefined' && document.currentScript ? document.currentScript.src : undefined;\n if (typeof __filename !== 'undefined') _scriptDir = _scriptDir || __filename;\n return (\nfunction(WasmBackendModuleThreadedSimd) {\n WasmBackendModuleThreadedSimd = WasmBackendModuleThreadedSimd || {};\n\nfunction GROWABLE_HEAP_I8(){if(wasmMemory.buffer!=buffer){updateGlobalBufferAndViews(wasmMemory.buffer)}return HEAP8}function GROWABLE_HEAP_U8(){if(wasmMemory.buffer!=buffer){updateGlobalBufferAndViews(wasmMemory.buffer)}return HEAPU8}function GROWABLE_HEAP_I32(){if(wasmMemory.buffer!=buffer){updateGlobalBufferAndViews(wasmMemory.buffer)}return HEAP32}function GROWABLE_HEAP_U32(){if(wasmMemory.buffer!=buffer){updateGlobalBufferAndViews(wasmMemory.buffer)}return HEAPU32}function GROWABLE_HEAP_F64(){if(wasmMemory.buffer!=buffer){updateGlobalBufferAndViews(wasmMemory.buffer)}return HEAPF64}var Module=typeof WasmBackendModuleThreadedSimd!==\"undefined\"?WasmBackendModuleThreadedSimd:{};var readyPromiseResolve,readyPromiseReject;Module[\"ready\"]=new Promise(function(resolve,reject){readyPromiseResolve=resolve;readyPromiseReject=reject});var moduleOverrides={};var key;for(key in Module){if(Module.hasOwnProperty(key)){moduleOverrides[key]=Module[key]}}var arguments_=[];var thisProgram=\"./this.program\";var quit_=function(status,toThrow){throw toThrow};var ENVIRONMENT_IS_WEB=false;var ENVIRONMENT_IS_WORKER=false;var ENVIRONMENT_IS_NODE=false;var ENVIRONMENT_IS_SHELL=false;ENVIRONMENT_IS_WEB=typeof window===\"object\";ENVIRONMENT_IS_WORKER=typeof importScripts===\"function\";ENVIRONMENT_IS_NODE=typeof process===\"object\"&&typeof process.versions===\"object\"&&typeof process.versions.node===\"string\";ENVIRONMENT_IS_SHELL=!ENVIRONMENT_IS_WEB&&!ENVIRONMENT_IS_NODE&&!ENVIRONMENT_IS_WORKER;var ENVIRONMENT_IS_PTHREAD=Module[\"ENVIRONMENT_IS_PTHREAD\"]||false;if(ENVIRONMENT_IS_PTHREAD){buffer=Module[\"buffer\"]}var scriptDirectory=\"\";function locateFile(path){if(Module[\"locateFile\"]){return Module[\"locateFile\"](path,scriptDirectory)}return scriptDirectory+path}var read_,readAsync,readBinary,setWindowTitle;var nodeFS;var nodePath;if(ENVIRONMENT_IS_NODE){if(ENVIRONMENT_IS_WORKER){scriptDirectory=require(\"path\").dirname(scriptDirectory)+\"/\"}else{scriptDirectory=__dirname+\"/\"}read_=function shell_read(filename,binary){if(!nodeFS)nodeFS=require(\"fs\");if(!nodePath)nodePath=require(\"path\");filename=nodePath[\"normalize\"](filename);return nodeFS[\"readFileSync\"](filename,binary?null:\"utf8\")};readBinary=function readBinary(filename){var ret=read_(filename,true);if(!ret.buffer){ret=new Uint8Array(ret)}assert(ret.buffer);return ret};if(process[\"argv\"].length>1){thisProgram=process[\"argv\"][1].replace(/\\\\/g,\"/\")}arguments_=process[\"argv\"].slice(2);process[\"on\"](\"uncaughtException\",function(ex){if(!(ex instanceof ExitStatus)){throw ex}});process[\"on\"](\"unhandledRejection\",abort);quit_=function(status){process[\"exit\"](status)};Module[\"inspect\"]=function(){return\"[Emscripten Module object]\"};var nodeWorkerThreads;try{nodeWorkerThreads=require(\"worker_threads\")}catch(e){console.error('The \"worker_threads\" module is not supported in this node.js build - perhaps a newer version is needed?');throw e}global.Worker=nodeWorkerThreads.Worker}else if(ENVIRONMENT_IS_SHELL){if(typeof read!=\"undefined\"){read_=function shell_read(f){return read(f)}}readBinary=function readBinary(f){var data;if(typeof readbuffer===\"function\"){return new Uint8Array(readbuffer(f))}data=read(f,\"binary\");assert(typeof data===\"object\");return data};if(typeof scriptArgs!=\"undefined\"){arguments_=scriptArgs}else if(typeof arguments!=\"undefined\"){arguments_=arguments}if(typeof quit===\"function\"){quit_=function(status){quit(status)}}if(typeof print!==\"undefined\"){if(typeof console===\"undefined\")console={};console.log=print;console.warn=console.error=typeof printErr!==\"undefined\"?printErr:print}}else if(ENVIRONMENT_IS_WEB||ENVIRONMENT_IS_WORKER){if(ENVIRONMENT_IS_WORKER){scriptDirectory=self.location.href}else if(typeof document!==\"undefined\"&&document.currentScript){scriptDirectory=document.currentScript.src}if(typeof _scriptDir !== \"undefined\" && _scriptDir){scriptDirectory=_scriptDir}if(scriptDirectory.indexOf(\"blob:\")!==0){scriptDirectory=scriptDirectory.substr(0,scriptDirectory.lastIndexOf(\"/\")+1)}else{scriptDirectory=\"\"}if(ENVIRONMENT_IS_NODE){read_=function shell_read(filename,binary){if(!nodeFS)nodeFS=require(\"fs\");if(!nodePath)nodePath=require(\"path\");filename=nodePath[\"normalize\"](filename);return nodeFS[\"readFileSync\"](filename,binary?null:\"utf8\")};readBinary=function readBinary(filename){var ret=read_(filename,true);if(!ret.buffer){ret=new Uint8Array(ret)}assert(ret.buffer);return ret}}else{read_=function(url){var xhr=new XMLHttpRequest;xhr.open(\"GET\",url,false);xhr.send(null);return xhr.responseText};if(ENVIRONMENT_IS_WORKER){readBinary=function(url){var xhr=new XMLHttpRequest;xhr.open(\"GET\",url,false);xhr.responseType=\"arraybuffer\";xhr.send(null);return new Uint8Array(xhr.response)}}readAsync=function(url,onload,onerror){var xhr=new XMLHttpRequest;xhr.open(\"GET\",url,true);xhr.responseType=\"arraybuffer\";xhr.onload=function(){if(xhr.status==200||xhr.status==0&&xhr.response){onload(xhr.response);return}onerror()};xhr.onerror=onerror;xhr.send(null)}}setWindowTitle=function(title){document.title=title}}else{}if(ENVIRONMENT_IS_NODE){if(typeof performance===\"undefined\"){global.performance=require(\"perf_hooks\").performance}}var out=Module[\"print\"]||console.log.bind(console);var err=Module[\"printErr\"]||console.warn.bind(console);for(key in moduleOverrides){if(moduleOverrides.hasOwnProperty(key)){Module[key]=moduleOverrides[key]}}moduleOverrides=null;if(Module[\"arguments\"])arguments_=Module[\"arguments\"];if(Module[\"thisProgram\"])thisProgram=Module[\"thisProgram\"];if(Module[\"quit\"])quit_=Module[\"quit\"];var Atomics_load=Atomics.load;var Atomics_store=Atomics.store;var Atomics_compareExchange=Atomics.compareExchange;var wasmBinary;if(Module[\"wasmBinary\"])wasmBinary=Module[\"wasmBinary\"];var noExitRuntime=Module[\"noExitRuntime\"]||true;if(typeof WebAssembly!==\"object\"){abort(\"no native wasm support detected\")}var wasmMemory;var wasmModule;var ABORT=false;var EXITSTATUS;function assert(condition,text){if(!condition){abort(\"Assertion failed: \"+text)}}function getCFunc(ident){var func=Module[\"_\"+ident];assert(func,\"Cannot call unknown function \"+ident+\", make sure it is exported\");return func}function ccall(ident,returnType,argTypes,args,opts){var toC={\"string\":function(str){var ret=0;if(str!==null&&str!==undefined&&str!==0){var len=(str.length<<2)+1;ret=stackAlloc(len);stringToUTF8(str,ret,len)}return ret},\"array\":function(arr){var ret=stackAlloc(arr.length);writeArrayToMemory(arr,ret);return ret}};function convertReturnValue(ret){if(returnType===\"string\")return UTF8ToString(ret);if(returnType===\"boolean\")return Boolean(ret);return ret}var func=getCFunc(ident);var cArgs=[];var stack=0;if(args){for(var i=0;i=endIdx)){var u0=heap[idx++];if(!u0)return str;if(!(u0&128)){str+=String.fromCharCode(u0);continue}var u1=heap[idx++]&63;if((u0&224)==192){str+=String.fromCharCode((u0&31)<<6|u1);continue}var u2=heap[idx++]&63;if((u0&240)==224){u0=(u0&15)<<12|u1<<6|u2}else{u0=(u0&7)<<18|u1<<12|u2<<6|heap[idx++]&63}if(u0<65536){str+=String.fromCharCode(u0)}else{var ch=u0-65536;str+=String.fromCharCode(55296|ch>>10,56320|ch&1023)}}return str}function UTF8ToString(ptr,maxBytesToRead){return ptr?UTF8ArrayToString(GROWABLE_HEAP_U8(),ptr,maxBytesToRead):\"\"}function stringToUTF8Array(str,heap,outIdx,maxBytesToWrite){if(!(maxBytesToWrite>0))return 0;var startIdx=outIdx;var endIdx=outIdx+maxBytesToWrite-1;for(var i=0;i=55296&&u<=57343){var u1=str.charCodeAt(++i);u=65536+((u&1023)<<10)|u1&1023}if(u<=127){if(outIdx>=endIdx)break;heap[outIdx++]=u}else if(u<=2047){if(outIdx+1>=endIdx)break;heap[outIdx++]=192|u>>6;heap[outIdx++]=128|u&63}else if(u<=65535){if(outIdx+2>=endIdx)break;heap[outIdx++]=224|u>>12;heap[outIdx++]=128|u>>6&63;heap[outIdx++]=128|u&63}else{if(outIdx+3>=endIdx)break;heap[outIdx++]=240|u>>18;heap[outIdx++]=128|u>>12&63;heap[outIdx++]=128|u>>6&63;heap[outIdx++]=128|u&63}}heap[outIdx]=0;return outIdx-startIdx}function stringToUTF8(str,outPtr,maxBytesToWrite){return stringToUTF8Array(str,GROWABLE_HEAP_U8(),outPtr,maxBytesToWrite)}function lengthBytesUTF8(str){var len=0;for(var i=0;i=55296&&u<=57343)u=65536+((u&1023)<<10)|str.charCodeAt(++i)&1023;if(u<=127)++len;else if(u<=2047)len+=2;else if(u<=65535)len+=3;else len+=4}return len}function writeArrayToMemory(array,buffer){GROWABLE_HEAP_I8().set(array,buffer)}function alignUp(x,multiple){if(x%multiple>0){x+=multiple-x%multiple}return x}var buffer,HEAP8,HEAPU8,HEAP16,HEAPU16,HEAP32,HEAPU32,HEAPF32,HEAPF64;function updateGlobalBufferAndViews(buf){buffer=buf;Module[\"HEAP8\"]=HEAP8=new Int8Array(buf);Module[\"HEAP16\"]=HEAP16=new Int16Array(buf);Module[\"HEAP32\"]=HEAP32=new Int32Array(buf);Module[\"HEAPU8\"]=HEAPU8=new Uint8Array(buf);Module[\"HEAPU16\"]=HEAPU16=new Uint16Array(buf);Module[\"HEAPU32\"]=HEAPU32=new Uint32Array(buf);Module[\"HEAPF32\"]=HEAPF32=new Float32Array(buf);Module[\"HEAPF64\"]=HEAPF64=new Float64Array(buf)}var INITIAL_MEMORY=Module[\"INITIAL_MEMORY\"]||16777216;if(ENVIRONMENT_IS_PTHREAD){wasmMemory=Module[\"wasmMemory\"];buffer=Module[\"buffer\"]}else{if(Module[\"wasmMemory\"]){wasmMemory=Module[\"wasmMemory\"]}else{wasmMemory=new WebAssembly.Memory({\"initial\":INITIAL_MEMORY/65536,\"maximum\":2147483648/65536,\"shared\":true});if(!(wasmMemory.buffer instanceof SharedArrayBuffer)){err(\"requested a shared WebAssembly.Memory but the returned buffer is not a SharedArrayBuffer, indicating that while the browser has SharedArrayBuffer it does not have WebAssembly threads support - you may need to set a flag\");if(ENVIRONMENT_IS_NODE){console.log(\"(on node you may need: --experimental-wasm-threads --experimental-wasm-bulk-memory and also use a recent version)\")}throw Error(\"bad memory\")}}}if(wasmMemory){buffer=wasmMemory.buffer}INITIAL_MEMORY=buffer.byteLength;updateGlobalBufferAndViews(buffer);var wasmTable;var __ATPRERUN__=[];var __ATINIT__=[];var __ATMAIN__=[];var __ATEXIT__=[];var __ATPOSTRUN__=[];var runtimeInitialized=false;var runtimeExited=false;if(!ENVIRONMENT_IS_PTHREAD)__ATINIT__.push({func:function(){___wasm_call_ctors()}});function preRun(){if(ENVIRONMENT_IS_PTHREAD)return;if(Module[\"preRun\"]){if(typeof Module[\"preRun\"]==\"function\")Module[\"preRun\"]=[Module[\"preRun\"]];while(Module[\"preRun\"].length){addOnPreRun(Module[\"preRun\"].shift())}}callRuntimeCallbacks(__ATPRERUN__)}function initRuntime(){runtimeInitialized=true;if(ENVIRONMENT_IS_PTHREAD)return;callRuntimeCallbacks(__ATINIT__)}function preMain(){if(ENVIRONMENT_IS_PTHREAD)return;callRuntimeCallbacks(__ATMAIN__)}function exitRuntime(){if(ENVIRONMENT_IS_PTHREAD)return;runtimeExited=true}function postRun(){if(ENVIRONMENT_IS_PTHREAD)return;if(Module[\"postRun\"]){if(typeof Module[\"postRun\"]==\"function\")Module[\"postRun\"]=[Module[\"postRun\"]];while(Module[\"postRun\"].length){addOnPostRun(Module[\"postRun\"].shift())}}callRuntimeCallbacks(__ATPOSTRUN__)}function addOnPreRun(cb){__ATPRERUN__.unshift(cb)}function addOnPostRun(cb){__ATPOSTRUN__.unshift(cb)}var runDependencies=0;var runDependencyWatcher=null;var dependenciesFulfilled=null;function addRunDependency(id){assert(!ENVIRONMENT_IS_PTHREAD,\"addRunDependency cannot be used in a pthread worker\");runDependencies++;if(Module[\"monitorRunDependencies\"]){Module[\"monitorRunDependencies\"](runDependencies)}}function removeRunDependency(id){runDependencies--;if(Module[\"monitorRunDependencies\"]){Module[\"monitorRunDependencies\"](runDependencies)}if(runDependencies==0){if(runDependencyWatcher!==null){clearInterval(runDependencyWatcher);runDependencyWatcher=null}if(dependenciesFulfilled){var callback=dependenciesFulfilled;dependenciesFulfilled=null;callback()}}}Module[\"preloadedImages\"]={};Module[\"preloadedAudios\"]={};function abort(what){if(Module[\"onAbort\"]){Module[\"onAbort\"](what)}if(ENVIRONMENT_IS_PTHREAD)console.error(\"Pthread aborting at \"+(new Error).stack);what+=\"\";err(what);ABORT=true;EXITSTATUS=1;what=\"abort(\"+what+\"). Build with -s ASSERTIONS=1 for more info.\";var e=new WebAssembly.RuntimeError(what);readyPromiseReject(e);throw e}function hasPrefix(str,prefix){return String.prototype.startsWith?str.startsWith(prefix):str.indexOf(prefix)===0}var dataURIPrefix=\"data:application/octet-stream;base64,\";function isDataURI(filename){return hasPrefix(filename,dataURIPrefix)}var fileURIPrefix=\"file://\";function isFileURI(filename){return hasPrefix(filename,fileURIPrefix)}var wasmBinaryFile=\"tfjs-backend-wasm-threaded-simd.wasm\";if(!isDataURI(wasmBinaryFile)){wasmBinaryFile=locateFile(wasmBinaryFile)}function getBinary(file){try{if(file==wasmBinaryFile&&wasmBinary){return new Uint8Array(wasmBinary)}if(readBinary){return readBinary(file)}else{throw\"both async and sync fetching of the wasm failed\"}}catch(err){abort(err)}}function getBinaryPromise(){if(!wasmBinary&&(ENVIRONMENT_IS_WEB||ENVIRONMENT_IS_WORKER)){if(typeof fetch===\"function\"&&!isFileURI(wasmBinaryFile)){return fetch(wasmBinaryFile,{credentials:\"same-origin\"}).then(function(response){if(!response[\"ok\"]){throw\"failed to load wasm binary file at '\"+wasmBinaryFile+\"'\"}return response[\"arrayBuffer\"]()}).catch(function(){return getBinary(wasmBinaryFile)})}else{if(readAsync){return new Promise(function(resolve,reject){readAsync(wasmBinaryFile,function(response){resolve(new Uint8Array(response))},reject)})}}}return Promise.resolve().then(function(){return getBinary(wasmBinaryFile)})}function createWasm(){var info={\"a\":asmLibraryArg};function receiveInstance(instance,module){var exports=instance.exports;Module[\"asm\"]=exports;wasmTable=Module[\"asm\"][\"F\"];wasmModule=module;if(!ENVIRONMENT_IS_PTHREAD){var numWorkersToLoad=PThread.unusedWorkers.length;PThread.unusedWorkers.forEach(function(w){PThread.loadWasmModuleToWorker(w,function(){if(!--numWorkersToLoad)removeRunDependency(\"wasm-instantiate\")})})}}if(!ENVIRONMENT_IS_PTHREAD){addRunDependency(\"wasm-instantiate\")}function receiveInstantiatedSource(output){receiveInstance(output[\"instance\"],output[\"module\"])}function instantiateArrayBuffer(receiver){return getBinaryPromise().then(function(binary){return WebAssembly.instantiate(binary,info)}).then(receiver,function(reason){err(\"failed to asynchronously prepare wasm: \"+reason);abort(reason)})}function instantiateAsync(){if(!wasmBinary&&typeof WebAssembly.instantiateStreaming===\"function\"&&!isDataURI(wasmBinaryFile)&&!isFileURI(wasmBinaryFile)&&typeof fetch===\"function\"){return fetch(wasmBinaryFile,{credentials:\"same-origin\"}).then(function(response){var result=WebAssembly.instantiateStreaming(response,info);return result.then(receiveInstantiatedSource,function(reason){err(\"wasm streaming compile failed: \"+reason);err(\"falling back to ArrayBuffer instantiation\");return instantiateArrayBuffer(receiveInstantiatedSource)})})}else{return instantiateArrayBuffer(receiveInstantiatedSource)}}if(Module[\"instantiateWasm\"]){try{var exports=Module[\"instantiateWasm\"](info,receiveInstance);return exports}catch(e){err(\"Module.instantiateWasm callback failed with error: \"+e);return false}}instantiateAsync().catch(readyPromiseReject);return{}}var ASM_CONSTS={9816:function(){throw\"Canceled!\"},9834:function($0,$1){setTimeout(function(){__emscripten_do_dispatch_to_thread($0,$1)},0)}};function initPthreadsJS(){PThread.initRuntime()}function callRuntimeCallbacks(callbacks){while(callbacks.length>0){var callback=callbacks.shift();if(typeof callback==\"function\"){callback(Module);continue}var func=callback.func;if(typeof func===\"number\"){if(callback.arg===undefined){wasmTable.get(func)()}else{wasmTable.get(func)(callback.arg)}}else{func(callback.arg===undefined?null:callback.arg)}}}function _emscripten_futex_wake(addr,count){if(addr<=0||addr>GROWABLE_HEAP_I8().length||addr&3!=0||count<0)return-28;if(count==0)return 0;if(count>=2147483647)count=Infinity;var mainThreadWaitAddress=Atomics.load(GROWABLE_HEAP_I32(),__emscripten_main_thread_futex>>2);var mainThreadWoken=0;if(mainThreadWaitAddress==addr){var loadedAddr=Atomics.compareExchange(GROWABLE_HEAP_I32(),__emscripten_main_thread_futex>>2,mainThreadWaitAddress,0);if(loadedAddr==mainThreadWaitAddress){--count;mainThreadWoken=1;if(count<=0)return 1}}var ret=Atomics.notify(GROWABLE_HEAP_I32(),addr>>2,count);if(ret>=0)return ret+mainThreadWoken;throw\"Atomics.notify returned an unexpected value \"+ret}Module[\"_emscripten_futex_wake\"]=_emscripten_futex_wake;function killThread(pthread_ptr){if(ENVIRONMENT_IS_PTHREAD)throw\"Internal Error! killThread() can only ever be called from main application thread!\";if(!pthread_ptr)throw\"Internal Error! Null pthread_ptr in killThread!\";GROWABLE_HEAP_I32()[pthread_ptr+12>>2]=0;var pthread=PThread.pthreads[pthread_ptr];pthread.worker.terminate();PThread.freeThreadData(pthread);PThread.runningWorkers.splice(PThread.runningWorkers.indexOf(pthread.worker),1);pthread.worker.pthread=undefined}function cancelThread(pthread_ptr){if(ENVIRONMENT_IS_PTHREAD)throw\"Internal Error! cancelThread() can only ever be called from main application thread!\";if(!pthread_ptr)throw\"Internal Error! Null pthread_ptr in cancelThread!\";var pthread=PThread.pthreads[pthread_ptr];pthread.worker.postMessage({\"cmd\":\"cancel\"})}function cleanupThread(pthread_ptr){if(ENVIRONMENT_IS_PTHREAD)throw\"Internal Error! cleanupThread() can only ever be called from main application thread!\";if(!pthread_ptr)throw\"Internal Error! Null pthread_ptr in cleanupThread!\";var pthread=PThread.pthreads[pthread_ptr];if(pthread){GROWABLE_HEAP_I32()[pthread_ptr+12>>2]=0;var worker=pthread.worker;PThread.returnWorkerToPool(worker)}}var PThread={unusedWorkers:[],runningWorkers:[],initMainThreadBlock:function(){var pthreadPoolSize=Math.min(4,Math.max(1,(navigator.hardwareConcurrency||1)/2));for(var i=0;i>2]=tb;var headPtr=tb+152;GROWABLE_HEAP_I32()[headPtr>>2]=headPtr;var tlsMemory=_malloc(512);for(var i=0;i<128;++i)GROWABLE_HEAP_U32()[tlsMemory/4+i]=0;Atomics.store(GROWABLE_HEAP_U32(),tb+100>>2,tlsMemory);Atomics.store(GROWABLE_HEAP_U32(),tb+40>>2,tb);__emscripten_thread_init(tb,!ENVIRONMENT_IS_WORKER,1);_emscripten_register_main_browser_thread_id(tb)},initWorker:function(){},pthreads:{},threadExitHandlers:[],setThreadStatus:function(){},runExitHandlers:function(){while(PThread.threadExitHandlers.length>0){PThread.threadExitHandlers.pop()()}if(ENVIRONMENT_IS_PTHREAD&&_pthread_self())___pthread_tsd_run_dtors()},runExitHandlersAndDeinitThread:function(tb,exitCode){Atomics.store(GROWABLE_HEAP_U32(),tb+56>>2,1);Atomics.store(GROWABLE_HEAP_U32(),tb+60>>2,0);PThread.runExitHandlers();Atomics.store(GROWABLE_HEAP_U32(),tb+4>>2,exitCode);Atomics.store(GROWABLE_HEAP_U32(),tb+0>>2,1);_emscripten_futex_wake(tb+0,2147483647);__emscripten_thread_init(0,0,0)},threadExit:function(exitCode){var tb=_pthread_self();if(tb){PThread.runExitHandlersAndDeinitThread(tb,exitCode);if(ENVIRONMENT_IS_PTHREAD){postMessage({\"cmd\":\"exit\"})}}},threadCancel:function(){PThread.runExitHandlersAndDeinitThread(_pthread_self(),-1);postMessage({\"cmd\":\"cancelDone\"})},terminateAllThreads:function(){for(var t in PThread.pthreads){var pthread=PThread.pthreads[t];if(pthread&&pthread.worker){PThread.returnWorkerToPool(pthread.worker)}}PThread.pthreads={};for(var i=0;i>2];GROWABLE_HEAP_I32()[pthread.threadInfoStruct+100>>2]=0;_free(tlsMemory);_free(pthread.threadInfoStruct)}pthread.threadInfoStruct=0;if(pthread.allocatedOwnStack&&pthread.stackBase)_free(pthread.stackBase);pthread.stackBase=0;if(pthread.worker)pthread.worker.pthread=null},returnWorkerToPool:function(worker){PThread.runWithoutMainThreadQueuedCalls(function(){delete PThread.pthreads[worker.pthread.threadInfoStruct];PThread.unusedWorkers.push(worker);PThread.runningWorkers.splice(PThread.runningWorkers.indexOf(worker),1);PThread.freeThreadData(worker.pthread);worker.pthread=undefined})},runWithoutMainThreadQueuedCalls:function(func){GROWABLE_HEAP_I32()[__emscripten_allow_main_runtime_queued_calls>>2]=0;try{func()}finally{GROWABLE_HEAP_I32()[__emscripten_allow_main_runtime_queued_calls>>2]=1}},receiveObjectTransfer:function(data){},loadWasmModuleToWorker:function(worker,onFinishedLoading){worker.onmessage=function(e){var d=e[\"data\"];var cmd=d[\"cmd\"];if(worker.pthread)PThread.currentProxiedOperationCallerThread=worker.pthread.threadInfoStruct;if(d[\"targetThread\"]&&d[\"targetThread\"]!=_pthread_self()){var thread=PThread.pthreads[d.targetThread];if(thread){thread.worker.postMessage(e.data,d[\"transferList\"])}else{console.error('Internal error! Worker sent a message \"'+cmd+'\" to target pthread '+d[\"targetThread\"]+\", but that thread no longer exists!\")}PThread.currentProxiedOperationCallerThread=undefined;return}if(cmd===\"processQueuedMainThreadWork\"){_emscripten_main_thread_process_queued_calls()}else if(cmd===\"spawnThread\"){spawnThread(e.data)}else if(cmd===\"cleanupThread\"){cleanupThread(d[\"thread\"])}else if(cmd===\"killThread\"){killThread(d[\"thread\"])}else if(cmd===\"cancelThread\"){cancelThread(d[\"thread\"])}else if(cmd===\"loaded\"){worker.loaded=true;if(onFinishedLoading)onFinishedLoading(worker);if(worker.runPthread){worker.runPthread();delete worker.runPthread}}else if(cmd===\"print\"){out(\"Thread \"+d[\"threadId\"]+\": \"+d[\"text\"])}else if(cmd===\"printErr\"){err(\"Thread \"+d[\"threadId\"]+\": \"+d[\"text\"])}else if(cmd===\"alert\"){alert(\"Thread \"+d[\"threadId\"]+\": \"+d[\"text\"])}else if(cmd===\"exit\"){var detached=worker.pthread&&Atomics.load(GROWABLE_HEAP_U32(),worker.pthread.threadInfoStruct+64>>2);if(detached){PThread.returnWorkerToPool(worker)}}else if(cmd===\"exitProcess\"){try{exit(d[\"returnCode\"])}catch(e){if(e instanceof ExitStatus)return;throw e}}else if(cmd===\"cancelDone\"){PThread.returnWorkerToPool(worker)}else if(cmd===\"objectTransfer\"){PThread.receiveObjectTransfer(e.data)}else if(e.data.target===\"setimmediate\"){worker.postMessage(e.data)}else{err(\"worker sent an unknown command \"+cmd)}PThread.currentProxiedOperationCallerThread=undefined};worker.onerror=function(e){err(\"pthread sent an error! \"+e.filename+\":\"+e.lineno+\": \"+e.message)};if(ENVIRONMENT_IS_NODE){worker.on(\"message\",function(data){worker.onmessage({data:data})});worker.on(\"error\",function(data){worker.onerror(data)});worker.on(\"exit\",function(data){})}worker.postMessage({\"cmd\":\"load\",\"urlOrBlob\":Module[\"mainScriptUrlOrBlob\"]||_scriptDir,\"wasmMemory\":wasmMemory,\"wasmModule\":wasmModule})},allocateUnusedWorker:function(){var pthreadMainJs=locateFile(\"tfjs-backend-wasm-threaded-simd.worker.js\");PThread.unusedWorkers.push(new Worker(pthreadMainJs))},getNewWorker:function(){if(PThread.unusedWorkers.length==0){PThread.allocateUnusedWorker();PThread.loadWasmModuleToWorker(PThread.unusedWorkers[0])}if(PThread.unusedWorkers.length>0)return PThread.unusedWorkers.pop();else return null},busySpinWait:function(msecs){var t=performance.now()+msecs;while(performance.now()>2]=value;return value}function _atexit(func,arg){if(ENVIRONMENT_IS_PTHREAD)return _emscripten_proxy_to_main_thread_js(1,1,func,arg)}function __emscripten_notify_thread_queue(targetThreadId,mainThreadId){if(targetThreadId==mainThreadId){postMessage({\"cmd\":\"processQueuedMainThreadWork\"})}else if(ENVIRONMENT_IS_PTHREAD){postMessage({\"targetThread\":targetThreadId,\"cmd\":\"processThreadQueue\"})}else{var pthread=PThread.pthreads[targetThreadId];var worker=pthread&&pthread.worker;if(!worker){return}worker.postMessage({\"cmd\":\"processThreadQueue\"})}return 1}function _abort(){abort()}function _emscripten_asm_const_int(code,sigPtr,argbuf){var args=readAsmConstArgs(sigPtr,argbuf);return ASM_CONSTS[code].apply(null,args)}function _emscripten_conditional_set_current_thread_status(expectedStatus,newStatus){}function _emscripten_futex_wait(addr,val,timeout){if(addr<=0||addr>GROWABLE_HEAP_I8().length||addr&3!=0)return-28;if(!ENVIRONMENT_IS_WEB){var ret=Atomics.wait(GROWABLE_HEAP_I32(),addr>>2,val,timeout);if(ret===\"timed-out\")return-73;if(ret===\"not-equal\")return-6;if(ret===\"ok\")return 0;throw\"Atomics.wait returned an unexpected value \"+ret}else{if(Atomics.load(GROWABLE_HEAP_I32(),addr>>2)!=val){return-6}var tNow=performance.now();var tEnd=tNow+timeout;var lastAddr=Atomics.exchange(GROWABLE_HEAP_I32(),__emscripten_main_thread_futex>>2,addr);while(1){tNow=performance.now();if(tNow>tEnd){lastAddr=Atomics.exchange(GROWABLE_HEAP_I32(),__emscripten_main_thread_futex>>2,0);return-73}lastAddr=Atomics.exchange(GROWABLE_HEAP_I32(),__emscripten_main_thread_futex>>2,0);if(lastAddr==0){break}_emscripten_main_thread_process_queued_calls();if(Atomics.load(GROWABLE_HEAP_I32(),addr>>2)!=val){return-6}lastAddr=Atomics.exchange(GROWABLE_HEAP_I32(),__emscripten_main_thread_futex>>2,addr)}return 0}}function _emscripten_memcpy_big(dest,src,num){GROWABLE_HEAP_U8().copyWithin(dest,src,src+num)}function _emscripten_num_logical_cores(){if(ENVIRONMENT_IS_NODE)return require(\"os\").cpus().length;return navigator[\"hardwareConcurrency\"]}function _emscripten_proxy_to_main_thread_js(index,sync){var numCallArgs=arguments.length-2;var stack=stackSave();var serializedNumCallArgs=numCallArgs;var args=stackAlloc(serializedNumCallArgs*8);var b=args>>3;for(var i=0;i>=2;while(ch=GROWABLE_HEAP_U8()[sigPtr++]){var double=ch<105;if(double&&buf&1)buf++;readAsmConstArgsArray.push(double?GROWABLE_HEAP_F64()[buf++>>1]:GROWABLE_HEAP_I32()[buf]);++buf}return readAsmConstArgsArray}function _emscripten_receive_on_main_thread_js(index,numCallArgs,args){_emscripten_receive_on_main_thread_js_callArgs.length=numCallArgs;var b=args>>3;for(var i=0;i>>16);updateGlobalBufferAndViews(wasmMemory.buffer);return 1}catch(e){}}function _emscripten_resize_heap(requestedSize){var oldSize=_emscripten_get_heap_size();if(requestedSize<=oldSize){return false}var maxHeapSize=2147483648;if(requestedSize>maxHeapSize){return false}for(var cutDown=1;cutDown<=4;cutDown*=2){var overGrownHeapSize=oldSize*(1+.2/cutDown);overGrownHeapSize=Math.min(overGrownHeapSize,requestedSize+100663296);var newSize=Math.min(maxHeapSize,alignUp(Math.max(requestedSize,overGrownHeapSize),65536));var replacement=emscripten_realloc_buffer(newSize);if(replacement){return true}}return false}var JSEvents={inEventHandler:0,removeAllEventListeners:function(){for(var i=JSEvents.eventHandlers.length-1;i>=0;--i){JSEvents._removeHandler(i)}JSEvents.eventHandlers=[];JSEvents.deferredCalls=[]},registerRemoveEventListeners:function(){if(!JSEvents.removeEventListenersRegistered){__ATEXIT__.push(JSEvents.removeAllEventListeners);JSEvents.removeEventListenersRegistered=true}},deferredCalls:[],deferCall:function(targetFunction,precedence,argsList){function arraysHaveEqualContent(arrA,arrB){if(arrA.length!=arrB.length)return false;for(var i in arrA){if(arrA[i]!=arrB[i])return false}return true}for(var i in JSEvents.deferredCalls){var call=JSEvents.deferredCalls[i];if(call.targetFunction==targetFunction&&arraysHaveEqualContent(call.argsList,argsList)){return}}JSEvents.deferredCalls.push({targetFunction:targetFunction,precedence:precedence,argsList:argsList});JSEvents.deferredCalls.sort(function(x,y){return x.precedence>2]=eventTypeId;GROWABLE_HEAP_I32()[varargs+4>>2]=eventData;GROWABLE_HEAP_I32()[varargs+8>>2]=userData;__emscripten_call_on_thread(0,targetThread,637534208,eventHandlerFunc,eventData,varargs);stackRestore(stackTop)},getTargetThreadForEventCallback:function(targetThread){switch(targetThread){case 1:return 0;case 2:return PThread.currentProxiedOperationCallerThread;default:return targetThread}},getNodeNameForTarget:function(target){if(!target)return\"\";if(target==window)return\"#window\";if(target==screen)return\"#screen\";return target&&target.nodeName?target.nodeName:\"\"},fullscreenEnabled:function(){return document.fullscreenEnabled||document.webkitFullscreenEnabled}};function stringToNewUTF8(jsString){var length=lengthBytesUTF8(jsString)+1;var cString=_malloc(length);stringToUTF8(jsString,cString,length);return cString}function _emscripten_set_offscreencanvas_size_on_target_thread_js(targetThread,targetCanvas,width,height){var stackTop=stackSave();var varargs=stackAlloc(12);var targetCanvasPtr=0;if(targetCanvas){targetCanvasPtr=stringToNewUTF8(targetCanvas)}GROWABLE_HEAP_I32()[varargs>>2]=targetCanvasPtr;GROWABLE_HEAP_I32()[varargs+4>>2]=width;GROWABLE_HEAP_I32()[varargs+8>>2]=height;__emscripten_call_on_thread(0,targetThread,657457152,0,targetCanvasPtr,varargs);stackRestore(stackTop)}function _emscripten_set_offscreencanvas_size_on_target_thread(targetThread,targetCanvas,width,height){targetCanvas=targetCanvas?UTF8ToString(targetCanvas):\"\";_emscripten_set_offscreencanvas_size_on_target_thread_js(targetThread,targetCanvas,width,height)}function maybeCStringToJsString(cString){return cString>2?UTF8ToString(cString):cString}var specialHTMLTargets=[0,typeof document!==\"undefined\"?document:0,typeof window!==\"undefined\"?window:0];function findEventTarget(target){target=maybeCStringToJsString(target);var domElement=specialHTMLTargets[target]||(typeof document!==\"undefined\"?document.querySelector(target):undefined);return domElement}function findCanvasEventTarget(target){return findEventTarget(target)}function _emscripten_set_canvas_element_size_calling_thread(target,width,height){var canvas=findCanvasEventTarget(target);if(!canvas)return-4;if(canvas.canvasSharedPtr){GROWABLE_HEAP_I32()[canvas.canvasSharedPtr>>2]=width;GROWABLE_HEAP_I32()[canvas.canvasSharedPtr+4>>2]=height}if(canvas.offscreenCanvas||!canvas.controlTransferredOffscreen){if(canvas.offscreenCanvas)canvas=canvas.offscreenCanvas;var autoResizeViewport=false;if(canvas.GLctxObject&&canvas.GLctxObject.GLctx){var prevViewport=canvas.GLctxObject.GLctx.getParameter(2978);autoResizeViewport=prevViewport[0]===0&&prevViewport[1]===0&&prevViewport[2]===canvas.width&&prevViewport[3]===canvas.height}canvas.width=width;canvas.height=height;if(autoResizeViewport){canvas.GLctxObject.GLctx.viewport(0,0,width,height)}}else if(canvas.canvasSharedPtr){var targetThread=GROWABLE_HEAP_I32()[canvas.canvasSharedPtr+8>>2];_emscripten_set_offscreencanvas_size_on_target_thread(targetThread,target,width,height);return 1}else{return-4}return 0}function _emscripten_set_canvas_element_size_main_thread(target,width,height){if(ENVIRONMENT_IS_PTHREAD)return _emscripten_proxy_to_main_thread_js(2,1,target,width,height);return _emscripten_set_canvas_element_size_calling_thread(target,width,height)}function _emscripten_set_canvas_element_size(target,width,height){var canvas=findCanvasEventTarget(target);if(canvas){return _emscripten_set_canvas_element_size_calling_thread(target,width,height)}else{return _emscripten_set_canvas_element_size_main_thread(target,width,height)}}function _emscripten_set_current_thread_status(newStatus){}function _emscripten_set_thread_name(threadId,name){}function __webgl_enable_ANGLE_instanced_arrays(ctx){var ext=ctx.getExtension(\"ANGLE_instanced_arrays\");if(ext){ctx[\"vertexAttribDivisor\"]=function(index,divisor){ext[\"vertexAttribDivisorANGLE\"](index,divisor)};ctx[\"drawArraysInstanced\"]=function(mode,first,count,primcount){ext[\"drawArraysInstancedANGLE\"](mode,first,count,primcount)};ctx[\"drawElementsInstanced\"]=function(mode,count,type,indices,primcount){ext[\"drawElementsInstancedANGLE\"](mode,count,type,indices,primcount)};return 1}}function __webgl_enable_OES_vertex_array_object(ctx){var ext=ctx.getExtension(\"OES_vertex_array_object\");if(ext){ctx[\"createVertexArray\"]=function(){return ext[\"createVertexArrayOES\"]()};ctx[\"deleteVertexArray\"]=function(vao){ext[\"deleteVertexArrayOES\"](vao)};ctx[\"bindVertexArray\"]=function(vao){ext[\"bindVertexArrayOES\"](vao)};ctx[\"isVertexArray\"]=function(vao){return ext[\"isVertexArrayOES\"](vao)};return 1}}function __webgl_enable_WEBGL_draw_buffers(ctx){var ext=ctx.getExtension(\"WEBGL_draw_buffers\");if(ext){ctx[\"drawBuffers\"]=function(n,bufs){ext[\"drawBuffersWEBGL\"](n,bufs)};return 1}}function __webgl_enable_WEBGL_multi_draw(ctx){return!!(ctx.multiDrawWebgl=ctx.getExtension(\"WEBGL_multi_draw\"))}var GL={counter:1,buffers:[],programs:[],framebuffers:[],renderbuffers:[],textures:[],uniforms:[],shaders:[],vaos:[],contexts:{},offscreenCanvases:{},timerQueriesEXT:[],programInfos:{},stringCache:{},unpackAlignment:4,recordError:function recordError(errorCode){if(!GL.lastError){GL.lastError=errorCode}},getNewId:function(table){var ret=GL.counter++;for(var i=table.length;i>2]:-1;source+=UTF8ToString(GROWABLE_HEAP_I32()[string+i*4>>2],len<0?undefined:len)}return source},createContext:function(canvas,webGLContextAttributes){var ctx=canvas.getContext(\"webgl\",webGLContextAttributes);if(!ctx)return 0;var handle=GL.registerContext(ctx,webGLContextAttributes);return handle},registerContext:function(ctx,webGLContextAttributes){var handle=_malloc(8);GROWABLE_HEAP_I32()[handle+4>>2]=_pthread_self();var context={handle:handle,attributes:webGLContextAttributes,version:webGLContextAttributes.majorVersion,GLctx:ctx};if(ctx.canvas)ctx.canvas.GLctxObject=context;GL.contexts[handle]=context;if(typeof webGLContextAttributes.enableExtensionsByDefault===\"undefined\"||webGLContextAttributes.enableExtensionsByDefault){GL.initExtensions(context)}return handle},makeContextCurrent:function(contextHandle){GL.currentContext=GL.contexts[contextHandle];Module.ctx=GLctx=GL.currentContext&&GL.currentContext.GLctx;return!(contextHandle&&!GLctx)},getContext:function(contextHandle){return GL.contexts[contextHandle]},deleteContext:function(contextHandle){if(GL.currentContext===GL.contexts[contextHandle])GL.currentContext=null;if(typeof JSEvents===\"object\")JSEvents.removeAllHandlersOnTarget(GL.contexts[contextHandle].GLctx.canvas);if(GL.contexts[contextHandle]&&GL.contexts[contextHandle].GLctx.canvas)GL.contexts[contextHandle].GLctx.canvas.GLctxObject=undefined;_free(GL.contexts[contextHandle].handle);GL.contexts[contextHandle]=null},initExtensions:function(context){if(!context)context=GL.currentContext;if(context.initExtensionsDone)return;context.initExtensionsDone=true;var GLctx=context.GLctx;__webgl_enable_ANGLE_instanced_arrays(GLctx);__webgl_enable_OES_vertex_array_object(GLctx);__webgl_enable_WEBGL_draw_buffers(GLctx);GLctx.disjointTimerQueryExt=GLctx.getExtension(\"EXT_disjoint_timer_query\");__webgl_enable_WEBGL_multi_draw(GLctx);var exts=GLctx.getSupportedExtensions()||[];exts.forEach(function(ext){if(ext.indexOf(\"lose_context\")<0&&ext.indexOf(\"debug\")<0){GLctx.getExtension(ext)}})},populateUniformTable:function(program){var p=GL.programs[program];var ptable=GL.programInfos[program]={uniforms:{},maxUniformLength:0,maxAttributeLength:-1,maxUniformBlockNameLength:-1};var utable=ptable.uniforms;var numUniforms=GLctx.getProgramParameter(p,35718);for(var i=0;i>2;var powerPreference=GROWABLE_HEAP_I32()[a+(24>>2)];var contextAttributes={\"alpha\":!!GROWABLE_HEAP_I32()[a+(0>>2)],\"depth\":!!GROWABLE_HEAP_I32()[a+(4>>2)],\"stencil\":!!GROWABLE_HEAP_I32()[a+(8>>2)],\"antialias\":!!GROWABLE_HEAP_I32()[a+(12>>2)],\"premultipliedAlpha\":!!GROWABLE_HEAP_I32()[a+(16>>2)],\"preserveDrawingBuffer\":!!GROWABLE_HEAP_I32()[a+(20>>2)],\"powerPreference\":__emscripten_webgl_power_preferences[powerPreference],\"failIfMajorPerformanceCaveat\":!!GROWABLE_HEAP_I32()[a+(28>>2)],majorVersion:GROWABLE_HEAP_I32()[a+(32>>2)],minorVersion:GROWABLE_HEAP_I32()[a+(36>>2)],enableExtensionsByDefault:GROWABLE_HEAP_I32()[a+(40>>2)],explicitSwapControl:GROWABLE_HEAP_I32()[a+(44>>2)],proxyContextToMainThread:GROWABLE_HEAP_I32()[a+(48>>2)],renderViaOffscreenBackBuffer:GROWABLE_HEAP_I32()[a+(52>>2)]};var canvas=findCanvasEventTarget(target);if(!canvas){return 0}if(contextAttributes.explicitSwapControl){return 0}var contextHandle=GL.createContext(canvas,contextAttributes);return contextHandle}function _emscripten_webgl_create_context(a0,a1){return _emscripten_webgl_do_create_context(a0,a1)}var SYSCALLS={mappings:{},buffers:[null,[],[]],printChar:function(stream,curr){var buffer=SYSCALLS.buffers[stream];if(curr===0||curr===10){(stream===1?out:err)(UTF8ArrayToString(buffer,0));buffer.length=0}else{buffer.push(curr)}},varargs:undefined,get:function(){SYSCALLS.varargs+=4;var ret=GROWABLE_HEAP_I32()[SYSCALLS.varargs-4>>2];return ret},getStr:function(ptr){var ret=UTF8ToString(ptr);return ret},get64:function(low,high){return low}};function _fd_close(fd){if(ENVIRONMENT_IS_PTHREAD)return _emscripten_proxy_to_main_thread_js(3,1,fd);return 0}function _fd_seek(fd,offset_low,offset_high,whence,newOffset){if(ENVIRONMENT_IS_PTHREAD)return _emscripten_proxy_to_main_thread_js(4,1,fd,offset_low,offset_high,whence,newOffset)}function _fd_write(fd,iov,iovcnt,pnum){if(ENVIRONMENT_IS_PTHREAD)return _emscripten_proxy_to_main_thread_js(5,1,fd,iov,iovcnt,pnum);var num=0;for(var i=0;i>2];var len=GROWABLE_HEAP_I32()[iov+(i*8+4)>>2];for(var j=0;j>2]=num;return 0}function _pthread_cleanup_pop(execute){var routine=PThread.threadExitHandlers.pop();if(execute)routine()}function _pthread_cleanup_push(routine,arg){PThread.threadExitHandlers.push(function(){wasmTable.get(routine)(arg)})}function spawnThread(threadParams){if(ENVIRONMENT_IS_PTHREAD)throw\"Internal Error! spawnThread() can only ever be called from main application thread!\";var worker=PThread.getNewWorker();if(worker.pthread!==undefined)throw\"Internal error!\";if(!threadParams.pthread_ptr)throw\"Internal error, no pthread ptr!\";PThread.runningWorkers.push(worker);var tlsMemory=_malloc(128*4);for(var i=0;i<128;++i){GROWABLE_HEAP_I32()[tlsMemory+i*4>>2]=0}var stackHigh=threadParams.stackBase+threadParams.stackSize;var pthread=PThread.pthreads[threadParams.pthread_ptr]={worker:worker,stackBase:threadParams.stackBase,stackSize:threadParams.stackSize,allocatedOwnStack:threadParams.allocatedOwnStack,threadInfoStruct:threadParams.pthread_ptr};var tis=pthread.threadInfoStruct>>2;Atomics.store(GROWABLE_HEAP_U32(),tis+(64>>2),threadParams.detached);Atomics.store(GROWABLE_HEAP_U32(),tis+(100>>2),tlsMemory);Atomics.store(GROWABLE_HEAP_U32(),tis+(40>>2),pthread.threadInfoStruct);Atomics.store(GROWABLE_HEAP_U32(),tis+(80>>2),threadParams.stackSize);Atomics.store(GROWABLE_HEAP_U32(),tis+(76>>2),stackHigh);Atomics.store(GROWABLE_HEAP_U32(),tis+(104>>2),threadParams.stackSize);Atomics.store(GROWABLE_HEAP_U32(),tis+(104+8>>2),stackHigh);Atomics.store(GROWABLE_HEAP_U32(),tis+(104+12>>2),threadParams.detached);var global_libc=_emscripten_get_global_libc();var global_locale=global_libc+40;Atomics.store(GROWABLE_HEAP_U32(),tis+(172>>2),global_locale);worker.pthread=pthread;var msg={\"cmd\":\"run\",\"start_routine\":threadParams.startRoutine,\"arg\":threadParams.arg,\"threadInfoStruct\":threadParams.pthread_ptr,\"stackBase\":threadParams.stackBase,\"stackSize\":threadParams.stackSize};worker.runPthread=function(){msg.time=performance.now();worker.postMessage(msg,threadParams.transferList)};if(worker.loaded){worker.runPthread();delete worker.runPthread}}function _pthread_create(pthread_ptr,attr,start_routine,arg){if(typeof SharedArrayBuffer===\"undefined\"){err(\"Current environment does not support SharedArrayBuffer, pthreads are not available!\");return 6}if(!pthread_ptr){err(\"pthread_create called with a null thread pointer!\");return 28}var transferList=[];var error=0;if(ENVIRONMENT_IS_PTHREAD&&(transferList.length===0||error)){return _emscripten_sync_run_in_main_thread_4(687865856,pthread_ptr,attr,start_routine,arg)}if(error)return error;var stackSize=0;var stackBase=0;var detached=0;if(attr&&attr!=-1){stackSize=GROWABLE_HEAP_I32()[attr>>2];stackSize+=81920;stackBase=GROWABLE_HEAP_I32()[attr+8>>2];detached=GROWABLE_HEAP_I32()[attr+12>>2]!==0}else{stackSize=2097152}var allocatedOwnStack=stackBase==0;if(allocatedOwnStack){stackBase=_memalign(16,stackSize)}else{stackBase-=stackSize;assert(stackBase>0)}var threadInfoStruct=_malloc(228);for(var i=0;i<228>>2;++i)GROWABLE_HEAP_U32()[(threadInfoStruct>>2)+i]=0;GROWABLE_HEAP_I32()[pthread_ptr>>2]=threadInfoStruct;GROWABLE_HEAP_I32()[threadInfoStruct+12>>2]=threadInfoStruct;var headPtr=threadInfoStruct+152;GROWABLE_HEAP_I32()[headPtr>>2]=headPtr;var threadParams={stackBase:stackBase,stackSize:stackSize,allocatedOwnStack:allocatedOwnStack,detached:detached,startRoutine:start_routine,pthread_ptr:threadInfoStruct,arg:arg,transferList:transferList};if(ENVIRONMENT_IS_PTHREAD){threadParams.cmd=\"spawnThread\";postMessage(threadParams,transferList)}else{spawnThread(threadParams)}return 0}function _sysconf(name){if(ENVIRONMENT_IS_PTHREAD)return _emscripten_proxy_to_main_thread_js(6,1,name);switch(name){case 30:return 16384;case 85:var maxHeapSize=2147483648;return maxHeapSize/16384;case 132:case 133:case 12:case 137:case 138:case 15:case 235:case 16:case 17:case 18:case 19:case 20:case 149:case 13:case 10:case 236:case 153:case 9:case 21:case 22:case 159:case 154:case 14:case 77:case 78:case 139:case 82:case 68:case 67:case 164:case 11:case 29:case 47:case 48:case 95:case 52:case 51:case 46:return 200809;case 27:case 246:case 127:case 128:case 23:case 24:case 160:case 161:case 181:case 182:case 242:case 183:case 184:case 243:case 244:case 245:case 165:case 178:case 179:case 49:case 50:case 168:case 169:case 175:case 170:case 171:case 172:case 97:case 76:case 32:case 173:case 35:case 80:case 81:case 79:return-1;case 176:case 177:case 7:case 155:case 8:case 157:case 125:case 126:case 92:case 93:case 129:case 130:case 131:case 94:case 91:return 1;case 74:case 60:case 69:case 70:case 4:return 1024;case 31:case 42:case 72:return 32;case 87:case 26:case 33:return 2147483647;case 34:case 1:return 47839;case 38:case 36:return 99;case 43:case 37:return 2048;case 0:return 2097152;case 3:return 65536;case 28:return 32768;case 44:return 32767;case 75:return 16384;case 39:return 1e3;case 89:return 700;case 71:return 256;case 40:return 255;case 2:return 100;case 180:return 64;case 25:return 20;case 5:return 16;case 6:return 6;case 73:return 4;case 84:{if(typeof navigator===\"object\")return navigator[\"hardwareConcurrency\"]||1;return 1}}setErrNo(28);return-1}if(!ENVIRONMENT_IS_PTHREAD)PThread.initMainThreadBlock();var GLctx;var proxiedFunctionTable=[null,_atexit,_emscripten_set_canvas_element_size_main_thread,_fd_close,_fd_seek,_fd_write,_sysconf];var asmLibraryArg={\"e\":___assert_fail,\"r\":___call_main,\"x\":__emscripten_notify_thread_queue,\"b\":_abort,\"y\":_emscripten_asm_const_int,\"j\":_emscripten_conditional_set_current_thread_status,\"c\":_emscripten_futex_wait,\"d\":_emscripten_futex_wake,\"f\":_emscripten_get_now,\"p\":_emscripten_memcpy_big,\"z\":_emscripten_num_logical_cores,\"u\":_emscripten_receive_on_main_thread_js,\"q\":_emscripten_resize_heap,\"v\":_emscripten_set_canvas_element_size,\"i\":_emscripten_set_current_thread_status,\"t\":_emscripten_set_thread_name,\"w\":_emscripten_webgl_create_context,\"m\":_fd_close,\"n\":_fd_seek,\"g\":_fd_write,\"o\":initPthreadsJS,\"a\":wasmMemory||Module[\"wasmMemory\"],\"k\":_pthread_cleanup_pop,\"l\":_pthread_cleanup_push,\"h\":_pthread_create,\"s\":_sysconf};var asm=createWasm();var ___wasm_call_ctors=Module[\"___wasm_call_ctors\"]=function(){return(___wasm_call_ctors=Module[\"___wasm_call_ctors\"]=Module[\"asm\"][\"A\"]).apply(null,arguments)};var _init=Module[\"_init\"]=function(){return(_init=Module[\"_init\"]=Module[\"asm\"][\"B\"]).apply(null,arguments)};var _register_tensor=Module[\"_register_tensor\"]=function(){return(_register_tensor=Module[\"_register_tensor\"]=Module[\"asm\"][\"C\"]).apply(null,arguments)};var _dispose_data=Module[\"_dispose_data\"]=function(){return(_dispose_data=Module[\"_dispose_data\"]=Module[\"asm\"][\"D\"]).apply(null,arguments)};var _dispose=Module[\"_dispose\"]=function(){return(_dispose=Module[\"_dispose\"]=Module[\"asm\"][\"E\"]).apply(null,arguments)};var _Abs=Module[\"_Abs\"]=function(){return(_Abs=Module[\"_Abs\"]=Module[\"asm\"][\"G\"]).apply(null,arguments)};var _Add=Module[\"_Add\"]=function(){return(_Add=Module[\"_Add\"]=Module[\"asm\"][\"H\"]).apply(null,arguments)};var _AddN=Module[\"_AddN\"]=function(){return(_AddN=Module[\"_AddN\"]=Module[\"asm\"][\"I\"]).apply(null,arguments)};var _All=Module[\"_All\"]=function(){return(_All=Module[\"_All\"]=Module[\"asm\"][\"J\"]).apply(null,arguments)};var _Any=Module[\"_Any\"]=function(){return(_Any=Module[\"_Any\"]=Module[\"asm\"][\"K\"]).apply(null,arguments)};var _ArgMax=Module[\"_ArgMax\"]=function(){return(_ArgMax=Module[\"_ArgMax\"]=Module[\"asm\"][\"L\"]).apply(null,arguments)};var _AvgPool=Module[\"_AvgPool\"]=function(){return(_AvgPool=Module[\"_AvgPool\"]=Module[\"asm\"][\"M\"]).apply(null,arguments)};var _BatchMatMul=Module[\"_BatchMatMul\"]=function(){return(_BatchMatMul=Module[\"_BatchMatMul\"]=Module[\"asm\"][\"N\"]).apply(null,arguments)};var _Ceil=Module[\"_Ceil\"]=function(){return(_Ceil=Module[\"_Ceil\"]=Module[\"asm\"][\"O\"]).apply(null,arguments)};var _ClipByValue=Module[\"_ClipByValue\"]=function(){return(_ClipByValue=Module[\"_ClipByValue\"]=Module[\"asm\"][\"P\"]).apply(null,arguments)};var _Conv2D=Module[\"_Conv2D\"]=function(){return(_Conv2D=Module[\"_Conv2D\"]=Module[\"asm\"][\"Q\"]).apply(null,arguments)};var _Conv2DBackpropInput=Module[\"_Conv2DBackpropInput\"]=function(){return(_Conv2DBackpropInput=Module[\"_Conv2DBackpropInput\"]=Module[\"asm\"][\"R\"]).apply(null,arguments)};var _Cos=Module[\"_Cos\"]=function(){return(_Cos=Module[\"_Cos\"]=Module[\"asm\"][\"S\"]).apply(null,arguments)};var _CropAndResize=Module[\"_CropAndResize\"]=function(){return(_CropAndResize=Module[\"_CropAndResize\"]=Module[\"asm\"][\"T\"]).apply(null,arguments)};var _Cumsum=Module[\"_Cumsum\"]=function(){return(_Cumsum=Module[\"_Cumsum\"]=Module[\"asm\"][\"U\"]).apply(null,arguments)};var _DepthToSpace=Module[\"_DepthToSpace\"]=function(){return(_DepthToSpace=Module[\"_DepthToSpace\"]=Module[\"asm\"][\"V\"]).apply(null,arguments)};var _DepthwiseConv2dNative=Module[\"_DepthwiseConv2dNative\"]=function(){return(_DepthwiseConv2dNative=Module[\"_DepthwiseConv2dNative\"]=Module[\"asm\"][\"W\"]).apply(null,arguments)};var _Equal=Module[\"_Equal\"]=function(){return(_Equal=Module[\"_Equal\"]=Module[\"asm\"][\"X\"]).apply(null,arguments)};var _Exp=Module[\"_Exp\"]=function(){return(_Exp=Module[\"_Exp\"]=Module[\"asm\"][\"Y\"]).apply(null,arguments)};var _FlipLeftRight=Module[\"_FlipLeftRight\"]=function(){return(_FlipLeftRight=Module[\"_FlipLeftRight\"]=Module[\"asm\"][\"Z\"]).apply(null,arguments)};var _Floor=Module[\"_Floor\"]=function(){return(_Floor=Module[\"_Floor\"]=Module[\"asm\"][\"_\"]).apply(null,arguments)};var _FloorDiv=Module[\"_FloorDiv\"]=function(){return(_FloorDiv=Module[\"_FloorDiv\"]=Module[\"asm\"][\"$\"]).apply(null,arguments)};var _FusedBatchNorm=Module[\"_FusedBatchNorm\"]=function(){return(_FusedBatchNorm=Module[\"_FusedBatchNorm\"]=Module[\"asm\"][\"aa\"]).apply(null,arguments)};var _FusedConv2D=Module[\"_FusedConv2D\"]=function(){return(_FusedConv2D=Module[\"_FusedConv2D\"]=Module[\"asm\"][\"ba\"]).apply(null,arguments)};var _FusedDepthwiseConv2D=Module[\"_FusedDepthwiseConv2D\"]=function(){return(_FusedDepthwiseConv2D=Module[\"_FusedDepthwiseConv2D\"]=Module[\"asm\"][\"ca\"]).apply(null,arguments)};var _Gather=Module[\"_Gather\"]=function(){return(_Gather=Module[\"_Gather\"]=Module[\"asm\"][\"da\"]).apply(null,arguments)};var _GatherNd=Module[\"_GatherNd\"]=function(){return(_GatherNd=Module[\"_GatherNd\"]=Module[\"asm\"][\"ea\"]).apply(null,arguments)};var _Greater=Module[\"_Greater\"]=function(){return(_Greater=Module[\"_Greater\"]=Module[\"asm\"][\"fa\"]).apply(null,arguments)};var _GreaterEqual=Module[\"_GreaterEqual\"]=function(){return(_GreaterEqual=Module[\"_GreaterEqual\"]=Module[\"asm\"][\"ga\"]).apply(null,arguments)};var _LeakyRelu=Module[\"_LeakyRelu\"]=function(){return(_LeakyRelu=Module[\"_LeakyRelu\"]=Module[\"asm\"][\"ha\"]).apply(null,arguments)};var _Less=Module[\"_Less\"]=function(){return(_Less=Module[\"_Less\"]=Module[\"asm\"][\"ia\"]).apply(null,arguments)};var _LessEqual=Module[\"_LessEqual\"]=function(){return(_LessEqual=Module[\"_LessEqual\"]=Module[\"asm\"][\"ja\"]).apply(null,arguments)};var _Log=Module[\"_Log\"]=function(){return(_Log=Module[\"_Log\"]=Module[\"asm\"][\"ka\"]).apply(null,arguments)};var _LogicalAnd=Module[\"_LogicalAnd\"]=function(){return(_LogicalAnd=Module[\"_LogicalAnd\"]=Module[\"asm\"][\"la\"]).apply(null,arguments)};var _Max=Module[\"_Max\"]=function(){return(_Max=Module[\"_Max\"]=Module[\"asm\"][\"ma\"]).apply(null,arguments)};var _MaxPool=Module[\"_MaxPool\"]=function(){return(_MaxPool=Module[\"_MaxPool\"]=Module[\"asm\"][\"na\"]).apply(null,arguments)};var _Maximum=Module[\"_Maximum\"]=function(){return(_Maximum=Module[\"_Maximum\"]=Module[\"asm\"][\"oa\"]).apply(null,arguments)};var _Mean=Module[\"_Mean\"]=function(){return(_Mean=Module[\"_Mean\"]=Module[\"asm\"][\"pa\"]).apply(null,arguments)};var _Min=Module[\"_Min\"]=function(){return(_Min=Module[\"_Min\"]=Module[\"asm\"][\"qa\"]).apply(null,arguments)};var _Minimum=Module[\"_Minimum\"]=function(){return(_Minimum=Module[\"_Minimum\"]=Module[\"asm\"][\"ra\"]).apply(null,arguments)};var _MirrorPad=Module[\"_MirrorPad\"]=function(){return(_MirrorPad=Module[\"_MirrorPad\"]=Module[\"asm\"][\"sa\"]).apply(null,arguments)};var _Multiply=Module[\"_Multiply\"]=function(){return(_Multiply=Module[\"_Multiply\"]=Module[\"asm\"][\"ta\"]).apply(null,arguments)};var _Neg=Module[\"_Neg\"]=function(){return(_Neg=Module[\"_Neg\"]=Module[\"asm\"][\"ua\"]).apply(null,arguments)};var _NonMaxSuppressionV3=Module[\"_NonMaxSuppressionV3\"]=function(){return(_NonMaxSuppressionV3=Module[\"_NonMaxSuppressionV3\"]=Module[\"asm\"][\"va\"]).apply(null,arguments)};var _NonMaxSuppressionV4=Module[\"_NonMaxSuppressionV4\"]=function(){return(_NonMaxSuppressionV4=Module[\"_NonMaxSuppressionV4\"]=Module[\"asm\"][\"wa\"]).apply(null,arguments)};var _NonMaxSuppressionV5=Module[\"_NonMaxSuppressionV5\"]=function(){return(_NonMaxSuppressionV5=Module[\"_NonMaxSuppressionV5\"]=Module[\"asm\"][\"xa\"]).apply(null,arguments)};var _NotEqual=Module[\"_NotEqual\"]=function(){return(_NotEqual=Module[\"_NotEqual\"]=Module[\"asm\"][\"ya\"]).apply(null,arguments)};var _OneHot=Module[\"_OneHot\"]=function(){return(_OneHot=Module[\"_OneHot\"]=Module[\"asm\"][\"za\"]).apply(null,arguments)};var _PadV2=Module[\"_PadV2\"]=function(){return(_PadV2=Module[\"_PadV2\"]=Module[\"asm\"][\"Aa\"]).apply(null,arguments)};var _Pow=Module[\"_Pow\"]=function(){return(_Pow=Module[\"_Pow\"]=Module[\"asm\"][\"Ba\"]).apply(null,arguments)};var _Prelu=Module[\"_Prelu\"]=function(){return(_Prelu=Module[\"_Prelu\"]=Module[\"asm\"][\"Ca\"]).apply(null,arguments)};var _Prod=Module[\"_Prod\"]=function(){return(_Prod=Module[\"_Prod\"]=Module[\"asm\"][\"Da\"]).apply(null,arguments)};var _RealDiv=Module[\"_RealDiv\"]=function(){return(_RealDiv=Module[\"_RealDiv\"]=Module[\"asm\"][\"Ea\"]).apply(null,arguments)};var _Relu=Module[\"_Relu\"]=function(){return(_Relu=Module[\"_Relu\"]=Module[\"asm\"][\"Fa\"]).apply(null,arguments)};var _Relu6=Module[\"_Relu6\"]=function(){return(_Relu6=Module[\"_Relu6\"]=Module[\"asm\"][\"Ga\"]).apply(null,arguments)};var _ResizeBilinear=Module[\"_ResizeBilinear\"]=function(){return(_ResizeBilinear=Module[\"_ResizeBilinear\"]=Module[\"asm\"][\"Ha\"]).apply(null,arguments)};var _Reverse=Module[\"_Reverse\"]=function(){return(_Reverse=Module[\"_Reverse\"]=Module[\"asm\"][\"Ia\"]).apply(null,arguments)};var _RotateWithOffset=Module[\"_RotateWithOffset\"]=function(){return(_RotateWithOffset=Module[\"_RotateWithOffset\"]=Module[\"asm\"][\"Ja\"]).apply(null,arguments)};var _Round=Module[\"_Round\"]=function(){return(_Round=Module[\"_Round\"]=Module[\"asm\"][\"Ka\"]).apply(null,arguments)};var _Rsqrt=Module[\"_Rsqrt\"]=function(){return(_Rsqrt=Module[\"_Rsqrt\"]=Module[\"asm\"][\"La\"]).apply(null,arguments)};var _ScatterNd=Module[\"_ScatterNd\"]=function(){return(_ScatterNd=Module[\"_ScatterNd\"]=Module[\"asm\"][\"Ma\"]).apply(null,arguments)};var _SelectV2=Module[\"_SelectV2\"]=function(){return(_SelectV2=Module[\"_SelectV2\"]=Module[\"asm\"][\"Na\"]).apply(null,arguments)};var _Sigmoid=Module[\"_Sigmoid\"]=function(){return(_Sigmoid=Module[\"_Sigmoid\"]=Module[\"asm\"][\"Oa\"]).apply(null,arguments)};var _Sin=Module[\"_Sin\"]=function(){return(_Sin=Module[\"_Sin\"]=Module[\"asm\"][\"Pa\"]).apply(null,arguments)};var _Softmax=Module[\"_Softmax\"]=function(){return(_Softmax=Module[\"_Softmax\"]=Module[\"asm\"][\"Qa\"]).apply(null,arguments)};var _Sqrt=Module[\"_Sqrt\"]=function(){return(_Sqrt=Module[\"_Sqrt\"]=Module[\"asm\"][\"Ra\"]).apply(null,arguments)};var _Square=Module[\"_Square\"]=function(){return(_Square=Module[\"_Square\"]=Module[\"asm\"][\"Sa\"]).apply(null,arguments)};var _SquaredDifference=Module[\"_SquaredDifference\"]=function(){return(_SquaredDifference=Module[\"_SquaredDifference\"]=Module[\"asm\"][\"Ta\"]).apply(null,arguments)};var _Step=Module[\"_Step\"]=function(){return(_Step=Module[\"_Step\"]=Module[\"asm\"][\"Ua\"]).apply(null,arguments)};var _StridedSlice=Module[\"_StridedSlice\"]=function(){return(_StridedSlice=Module[\"_StridedSlice\"]=Module[\"asm\"][\"Va\"]).apply(null,arguments)};var _Sub=Module[\"_Sub\"]=function(){return(_Sub=Module[\"_Sub\"]=Module[\"asm\"][\"Wa\"]).apply(null,arguments)};var _Sum=Module[\"_Sum\"]=function(){return(_Sum=Module[\"_Sum\"]=Module[\"asm\"][\"Xa\"]).apply(null,arguments)};var _Tan=Module[\"_Tan\"]=function(){return(_Tan=Module[\"_Tan\"]=Module[\"asm\"][\"Ya\"]).apply(null,arguments)};var _Tanh=Module[\"_Tanh\"]=function(){return(_Tanh=Module[\"_Tanh\"]=Module[\"asm\"][\"Za\"]).apply(null,arguments)};var _Tile=Module[\"_Tile\"]=function(){return(_Tile=Module[\"_Tile\"]=Module[\"asm\"][\"_a\"]).apply(null,arguments)};var _TopK=Module[\"_TopK\"]=function(){return(_TopK=Module[\"_TopK\"]=Module[\"asm\"][\"$a\"]).apply(null,arguments)};var _Transform=Module[\"_Transform\"]=function(){return(_Transform=Module[\"_Transform\"]=Module[\"asm\"][\"ab\"]).apply(null,arguments)};var _Transpose=Module[\"_Transpose\"]=function(){return(_Transpose=Module[\"_Transpose\"]=Module[\"asm\"][\"bb\"]).apply(null,arguments)};var __FusedMatMul=Module[\"__FusedMatMul\"]=function(){return(__FusedMatMul=Module[\"__FusedMatMul\"]=Module[\"asm\"][\"cb\"]).apply(null,arguments)};var _malloc=Module[\"_malloc\"]=function(){return(_malloc=Module[\"_malloc\"]=Module[\"asm\"][\"db\"]).apply(null,arguments)};var _free=Module[\"_free\"]=function(){return(_free=Module[\"_free\"]=Module[\"asm\"][\"eb\"]).apply(null,arguments)};var ___errno_location=Module[\"___errno_location\"]=function(){return(___errno_location=Module[\"___errno_location\"]=Module[\"asm\"][\"fb\"]).apply(null,arguments)};var _emscripten_get_global_libc=Module[\"_emscripten_get_global_libc\"]=function(){return(_emscripten_get_global_libc=Module[\"_emscripten_get_global_libc\"]=Module[\"asm\"][\"gb\"]).apply(null,arguments)};var _pthread_self=Module[\"_pthread_self\"]=function(){return(_pthread_self=Module[\"_pthread_self\"]=Module[\"asm\"][\"hb\"]).apply(null,arguments)};var ___pthread_tsd_run_dtors=Module[\"___pthread_tsd_run_dtors\"]=function(){return(___pthread_tsd_run_dtors=Module[\"___pthread_tsd_run_dtors\"]=Module[\"asm\"][\"ib\"]).apply(null,arguments)};var _emscripten_main_thread_process_queued_calls=Module[\"_emscripten_main_thread_process_queued_calls\"]=function(){return(_emscripten_main_thread_process_queued_calls=Module[\"_emscripten_main_thread_process_queued_calls\"]=Module[\"asm\"][\"jb\"]).apply(null,arguments)};var _emscripten_current_thread_process_queued_calls=Module[\"_emscripten_current_thread_process_queued_calls\"]=function(){return(_emscripten_current_thread_process_queued_calls=Module[\"_emscripten_current_thread_process_queued_calls\"]=Module[\"asm\"][\"kb\"]).apply(null,arguments)};var _emscripten_register_main_browser_thread_id=Module[\"_emscripten_register_main_browser_thread_id\"]=function(){return(_emscripten_register_main_browser_thread_id=Module[\"_emscripten_register_main_browser_thread_id\"]=Module[\"asm\"][\"lb\"]).apply(null,arguments)};var __emscripten_do_dispatch_to_thread=Module[\"__emscripten_do_dispatch_to_thread\"]=function(){return(__emscripten_do_dispatch_to_thread=Module[\"__emscripten_do_dispatch_to_thread\"]=Module[\"asm\"][\"mb\"]).apply(null,arguments)};var _emscripten_sync_run_in_main_thread_4=Module[\"_emscripten_sync_run_in_main_thread_4\"]=function(){return(_emscripten_sync_run_in_main_thread_4=Module[\"_emscripten_sync_run_in_main_thread_4\"]=Module[\"asm\"][\"nb\"]).apply(null,arguments)};var _emscripten_run_in_main_runtime_thread_js=Module[\"_emscripten_run_in_main_runtime_thread_js\"]=function(){return(_emscripten_run_in_main_runtime_thread_js=Module[\"_emscripten_run_in_main_runtime_thread_js\"]=Module[\"asm\"][\"ob\"]).apply(null,arguments)};var __emscripten_call_on_thread=Module[\"__emscripten_call_on_thread\"]=function(){return(__emscripten_call_on_thread=Module[\"__emscripten_call_on_thread\"]=Module[\"asm\"][\"pb\"]).apply(null,arguments)};var _emscripten_tls_init=Module[\"_emscripten_tls_init\"]=function(){return(_emscripten_tls_init=Module[\"_emscripten_tls_init\"]=Module[\"asm\"][\"qb\"]).apply(null,arguments)};var __emscripten_thread_init=Module[\"__emscripten_thread_init\"]=function(){return(__emscripten_thread_init=Module[\"__emscripten_thread_init\"]=Module[\"asm\"][\"rb\"]).apply(null,arguments)};var stackSave=Module[\"stackSave\"]=function(){return(stackSave=Module[\"stackSave\"]=Module[\"asm\"][\"sb\"]).apply(null,arguments)};var stackRestore=Module[\"stackRestore\"]=function(){return(stackRestore=Module[\"stackRestore\"]=Module[\"asm\"][\"tb\"]).apply(null,arguments)};var stackAlloc=Module[\"stackAlloc\"]=function(){return(stackAlloc=Module[\"stackAlloc\"]=Module[\"asm\"][\"ub\"]).apply(null,arguments)};var _emscripten_stack_set_limits=Module[\"_emscripten_stack_set_limits\"]=function(){return(_emscripten_stack_set_limits=Module[\"_emscripten_stack_set_limits\"]=Module[\"asm\"][\"vb\"]).apply(null,arguments)};var _memalign=Module[\"_memalign\"]=function(){return(_memalign=Module[\"_memalign\"]=Module[\"asm\"][\"wb\"]).apply(null,arguments)};var __emscripten_allow_main_runtime_queued_calls=Module[\"__emscripten_allow_main_runtime_queued_calls\"]=9808;var __emscripten_main_thread_futex=Module[\"__emscripten_main_thread_futex\"]=11432;Module[\"cwrap\"]=cwrap;Module[\"PThread\"]=PThread;Module[\"PThread\"]=PThread;Module[\"wasmMemory\"]=wasmMemory;Module[\"ExitStatus\"]=ExitStatus;var calledRun;function ExitStatus(status){this.name=\"ExitStatus\";this.message=\"Program terminated with exit(\"+status+\")\";this.status=status}dependenciesFulfilled=function runCaller(){if(!calledRun)run();if(!calledRun)dependenciesFulfilled=runCaller};function run(args){args=args||arguments_;if(runDependencies>0){return}if(ENVIRONMENT_IS_PTHREAD){readyPromiseResolve(Module);initRuntime();postMessage({\"cmd\":\"loaded\"});return}preRun();if(runDependencies>0){return}function doRun(){if(calledRun)return;calledRun=true;Module[\"calledRun\"]=true;if(ABORT)return;initRuntime();preMain();readyPromiseResolve(Module);if(Module[\"onRuntimeInitialized\"])Module[\"onRuntimeInitialized\"]();postRun()}if(Module[\"setStatus\"]){Module[\"setStatus\"](\"Running...\");setTimeout(function(){setTimeout(function(){Module[\"setStatus\"](\"\")},1);doRun()},1)}else{doRun()}}Module[\"run\"]=run;function exit(status,implicit){if(implicit&&noExitRuntime&&status===0){return}if(!implicit){if(ENVIRONMENT_IS_PTHREAD){postMessage({\"cmd\":\"exitProcess\",\"returnCode\":status});throw new ExitStatus(status)}else{}}if(noExitRuntime){}else{PThread.terminateAllThreads();EXITSTATUS=status;exitRuntime();if(Module[\"onExit\"])Module[\"onExit\"](status);ABORT=true}quit_(status,new ExitStatus(status))}if(Module[\"preInit\"]){if(typeof Module[\"preInit\"]==\"function\")Module[\"preInit\"]=[Module[\"preInit\"]];while(Module[\"preInit\"].length>0){Module[\"preInit\"].pop()()}}if(ENVIRONMENT_IS_PTHREAD){noExitRuntime=false;PThread.initWorker()}run();\n\n\n return WasmBackendModuleThreadedSimd.ready\n}\n);\n})();\nif (typeof exports === 'object' && typeof module === 'object')\n module.exports = WasmBackendModuleThreadedSimd;\nelse if (typeof define === 'function' && define['amd'])\n define([], function() { return WasmBackendModuleThreadedSimd; });\nelse if (typeof exports === 'object')\n exports[\"WasmBackendModuleThreadedSimd\"] = WasmBackendModuleThreadedSimd;\n", "\nvar WasmBackendModule = (function() {\n var _scriptDir = typeof document !== 'undefined' && document.currentScript ? document.currentScript.src : undefined;\n if (typeof __filename !== 'undefined') _scriptDir = _scriptDir || __filename;\n return (\nfunction(WasmBackendModule) {\n WasmBackendModule = WasmBackendModule || {};\n\nvar Module=typeof WasmBackendModule!==\"undefined\"?WasmBackendModule:{};var readyPromiseResolve,readyPromiseReject;Module[\"ready\"]=new Promise(function(resolve,reject){readyPromiseResolve=resolve;readyPromiseReject=reject});var moduleOverrides={};var key;for(key in Module){if(Module.hasOwnProperty(key)){moduleOverrides[key]=Module[key]}}var arguments_=[];var thisProgram=\"./this.program\";var quit_=function(status,toThrow){throw toThrow};var ENVIRONMENT_IS_WEB=false;var ENVIRONMENT_IS_WORKER=false;var ENVIRONMENT_IS_NODE=false;var ENVIRONMENT_IS_SHELL=false;ENVIRONMENT_IS_WEB=typeof window===\"object\";ENVIRONMENT_IS_WORKER=typeof importScripts===\"function\";ENVIRONMENT_IS_NODE=typeof process===\"object\"&&typeof process.versions===\"object\"&&typeof process.versions.node===\"string\";ENVIRONMENT_IS_SHELL=!ENVIRONMENT_IS_WEB&&!ENVIRONMENT_IS_NODE&&!ENVIRONMENT_IS_WORKER;var scriptDirectory=\"\";function locateFile(path){if(Module[\"locateFile\"]){return Module[\"locateFile\"](path,scriptDirectory)}return scriptDirectory+path}var read_,readAsync,readBinary,setWindowTitle;var nodeFS;var nodePath;if(ENVIRONMENT_IS_NODE){if(ENVIRONMENT_IS_WORKER){scriptDirectory=require(\"path\").dirname(scriptDirectory)+\"/\"}else{scriptDirectory=__dirname+\"/\"}read_=function shell_read(filename,binary){if(!nodeFS)nodeFS=require(\"fs\");if(!nodePath)nodePath=require(\"path\");filename=nodePath[\"normalize\"](filename);return nodeFS[\"readFileSync\"](filename,binary?null:\"utf8\")};readBinary=function readBinary(filename){var ret=read_(filename,true);if(!ret.buffer){ret=new Uint8Array(ret)}assert(ret.buffer);return ret};if(process[\"argv\"].length>1){thisProgram=process[\"argv\"][1].replace(/\\\\/g,\"/\")}arguments_=process[\"argv\"].slice(2);process[\"on\"](\"uncaughtException\",function(ex){if(!(ex instanceof ExitStatus)){throw ex}});process[\"on\"](\"unhandledRejection\",abort);quit_=function(status){process[\"exit\"](status)};Module[\"inspect\"]=function(){return\"[Emscripten Module object]\"}}else if(ENVIRONMENT_IS_SHELL){if(typeof read!=\"undefined\"){read_=function shell_read(f){return read(f)}}readBinary=function readBinary(f){var data;if(typeof readbuffer===\"function\"){return new Uint8Array(readbuffer(f))}data=read(f,\"binary\");assert(typeof data===\"object\");return data};if(typeof scriptArgs!=\"undefined\"){arguments_=scriptArgs}else if(typeof arguments!=\"undefined\"){arguments_=arguments}if(typeof quit===\"function\"){quit_=function(status){quit(status)}}if(typeof print!==\"undefined\"){if(typeof console===\"undefined\")console={};console.log=print;console.warn=console.error=typeof printErr!==\"undefined\"?printErr:print}}else if(ENVIRONMENT_IS_WEB||ENVIRONMENT_IS_WORKER){if(ENVIRONMENT_IS_WORKER){scriptDirectory=self.location.href}else if(typeof document!==\"undefined\"&&document.currentScript){scriptDirectory=document.currentScript.src}if(_scriptDir){scriptDirectory=_scriptDir}if(scriptDirectory.indexOf(\"blob:\")!==0){scriptDirectory=scriptDirectory.substr(0,scriptDirectory.lastIndexOf(\"/\")+1)}else{scriptDirectory=\"\"}{read_=function(url){var xhr=new XMLHttpRequest;xhr.open(\"GET\",url,false);xhr.send(null);return xhr.responseText};if(ENVIRONMENT_IS_WORKER){readBinary=function(url){var xhr=new XMLHttpRequest;xhr.open(\"GET\",url,false);xhr.responseType=\"arraybuffer\";xhr.send(null);return new Uint8Array(xhr.response)}}readAsync=function(url,onload,onerror){var xhr=new XMLHttpRequest;xhr.open(\"GET\",url,true);xhr.responseType=\"arraybuffer\";xhr.onload=function(){if(xhr.status==200||xhr.status==0&&xhr.response){onload(xhr.response);return}onerror()};xhr.onerror=onerror;xhr.send(null)}}setWindowTitle=function(title){document.title=title}}else{}var out=Module[\"print\"]||console.log.bind(console);var err=Module[\"printErr\"]||console.warn.bind(console);for(key in moduleOverrides){if(moduleOverrides.hasOwnProperty(key)){Module[key]=moduleOverrides[key]}}moduleOverrides=null;if(Module[\"arguments\"])arguments_=Module[\"arguments\"];if(Module[\"thisProgram\"])thisProgram=Module[\"thisProgram\"];if(Module[\"quit\"])quit_=Module[\"quit\"];var wasmBinary;if(Module[\"wasmBinary\"])wasmBinary=Module[\"wasmBinary\"];var noExitRuntime=Module[\"noExitRuntime\"]||true;if(typeof WebAssembly!==\"object\"){abort(\"no native wasm support detected\")}var wasmMemory;var ABORT=false;var EXITSTATUS;function assert(condition,text){if(!condition){abort(\"Assertion failed: \"+text)}}function getCFunc(ident){var func=Module[\"_\"+ident];assert(func,\"Cannot call unknown function \"+ident+\", make sure it is exported\");return func}function ccall(ident,returnType,argTypes,args,opts){var toC={\"string\":function(str){var ret=0;if(str!==null&&str!==undefined&&str!==0){var len=(str.length<<2)+1;ret=stackAlloc(len);stringToUTF8(str,ret,len)}return ret},\"array\":function(arr){var ret=stackAlloc(arr.length);writeArrayToMemory(arr,ret);return ret}};function convertReturnValue(ret){if(returnType===\"string\")return UTF8ToString(ret);if(returnType===\"boolean\")return Boolean(ret);return ret}var func=getCFunc(ident);var cArgs=[];var stack=0;if(args){for(var i=0;i=endIdx))++endPtr;if(endPtr-idx>16&&heap.subarray&&UTF8Decoder){return UTF8Decoder.decode(heap.subarray(idx,endPtr))}else{var str=\"\";while(idx>10,56320|ch&1023)}}}return str}function UTF8ToString(ptr,maxBytesToRead){return ptr?UTF8ArrayToString(HEAPU8,ptr,maxBytesToRead):\"\"}function stringToUTF8Array(str,heap,outIdx,maxBytesToWrite){if(!(maxBytesToWrite>0))return 0;var startIdx=outIdx;var endIdx=outIdx+maxBytesToWrite-1;for(var i=0;i=55296&&u<=57343){var u1=str.charCodeAt(++i);u=65536+((u&1023)<<10)|u1&1023}if(u<=127){if(outIdx>=endIdx)break;heap[outIdx++]=u}else if(u<=2047){if(outIdx+1>=endIdx)break;heap[outIdx++]=192|u>>6;heap[outIdx++]=128|u&63}else if(u<=65535){if(outIdx+2>=endIdx)break;heap[outIdx++]=224|u>>12;heap[outIdx++]=128|u>>6&63;heap[outIdx++]=128|u&63}else{if(outIdx+3>=endIdx)break;heap[outIdx++]=240|u>>18;heap[outIdx++]=128|u>>12&63;heap[outIdx++]=128|u>>6&63;heap[outIdx++]=128|u&63}}heap[outIdx]=0;return outIdx-startIdx}function stringToUTF8(str,outPtr,maxBytesToWrite){return stringToUTF8Array(str,HEAPU8,outPtr,maxBytesToWrite)}function writeArrayToMemory(array,buffer){HEAP8.set(array,buffer)}function alignUp(x,multiple){if(x%multiple>0){x+=multiple-x%multiple}return x}var buffer,HEAP8,HEAPU8,HEAP16,HEAPU16,HEAP32,HEAPU32,HEAPF32,HEAPF64;function updateGlobalBufferAndViews(buf){buffer=buf;Module[\"HEAP8\"]=HEAP8=new Int8Array(buf);Module[\"HEAP16\"]=HEAP16=new Int16Array(buf);Module[\"HEAP32\"]=HEAP32=new Int32Array(buf);Module[\"HEAPU8\"]=HEAPU8=new Uint8Array(buf);Module[\"HEAPU16\"]=HEAPU16=new Uint16Array(buf);Module[\"HEAPU32\"]=HEAPU32=new Uint32Array(buf);Module[\"HEAPF32\"]=HEAPF32=new Float32Array(buf);Module[\"HEAPF64\"]=HEAPF64=new Float64Array(buf)}var INITIAL_MEMORY=Module[\"INITIAL_MEMORY\"]||16777216;var wasmTable;var __ATPRERUN__=[];var __ATINIT__=[];var __ATMAIN__=[];var __ATPOSTRUN__=[];var runtimeInitialized=false;__ATINIT__.push({func:function(){___wasm_call_ctors()}});function preRun(){if(Module[\"preRun\"]){if(typeof Module[\"preRun\"]==\"function\")Module[\"preRun\"]=[Module[\"preRun\"]];while(Module[\"preRun\"].length){addOnPreRun(Module[\"preRun\"].shift())}}callRuntimeCallbacks(__ATPRERUN__)}function initRuntime(){runtimeInitialized=true;callRuntimeCallbacks(__ATINIT__)}function preMain(){callRuntimeCallbacks(__ATMAIN__)}function postRun(){if(Module[\"postRun\"]){if(typeof Module[\"postRun\"]==\"function\")Module[\"postRun\"]=[Module[\"postRun\"]];while(Module[\"postRun\"].length){addOnPostRun(Module[\"postRun\"].shift())}}callRuntimeCallbacks(__ATPOSTRUN__)}function addOnPreRun(cb){__ATPRERUN__.unshift(cb)}function addOnPostRun(cb){__ATPOSTRUN__.unshift(cb)}var runDependencies=0;var runDependencyWatcher=null;var dependenciesFulfilled=null;function addRunDependency(id){runDependencies++;if(Module[\"monitorRunDependencies\"]){Module[\"monitorRunDependencies\"](runDependencies)}}function removeRunDependency(id){runDependencies--;if(Module[\"monitorRunDependencies\"]){Module[\"monitorRunDependencies\"](runDependencies)}if(runDependencies==0){if(runDependencyWatcher!==null){clearInterval(runDependencyWatcher);runDependencyWatcher=null}if(dependenciesFulfilled){var callback=dependenciesFulfilled;dependenciesFulfilled=null;callback()}}}Module[\"preloadedImages\"]={};Module[\"preloadedAudios\"]={};function abort(what){if(Module[\"onAbort\"]){Module[\"onAbort\"](what)}what+=\"\";err(what);ABORT=true;EXITSTATUS=1;what=\"abort(\"+what+\"). Build with -s ASSERTIONS=1 for more info.\";var e=new WebAssembly.RuntimeError(what);readyPromiseReject(e);throw e}function hasPrefix(str,prefix){return String.prototype.startsWith?str.startsWith(prefix):str.indexOf(prefix)===0}var dataURIPrefix=\"data:application/octet-stream;base64,\";function isDataURI(filename){return hasPrefix(filename,dataURIPrefix)}var fileURIPrefix=\"file://\";function isFileURI(filename){return hasPrefix(filename,fileURIPrefix)}var wasmBinaryFile=\"tfjs-backend-wasm.wasm\";if(!isDataURI(wasmBinaryFile)){wasmBinaryFile=locateFile(wasmBinaryFile)}function getBinary(file){try{if(file==wasmBinaryFile&&wasmBinary){return new Uint8Array(wasmBinary)}if(readBinary){return readBinary(file)}else{throw\"both async and sync fetching of the wasm failed\"}}catch(err){abort(err)}}function getBinaryPromise(){if(!wasmBinary&&(ENVIRONMENT_IS_WEB||ENVIRONMENT_IS_WORKER)){if(typeof fetch===\"function\"&&!isFileURI(wasmBinaryFile)){return fetch(wasmBinaryFile,{credentials:\"same-origin\"}).then(function(response){if(!response[\"ok\"]){throw\"failed to load wasm binary file at '\"+wasmBinaryFile+\"'\"}return response[\"arrayBuffer\"]()}).catch(function(){return getBinary(wasmBinaryFile)})}else{if(readAsync){return new Promise(function(resolve,reject){readAsync(wasmBinaryFile,function(response){resolve(new Uint8Array(response))},reject)})}}}return Promise.resolve().then(function(){return getBinary(wasmBinaryFile)})}function createWasm(){var info={\"a\":asmLibraryArg};function receiveInstance(instance,module){var exports=instance.exports;Module[\"asm\"]=exports;wasmMemory=Module[\"asm\"][\"i\"];updateGlobalBufferAndViews(wasmMemory.buffer);wasmTable=Module[\"asm\"][\"o\"];removeRunDependency(\"wasm-instantiate\")}addRunDependency(\"wasm-instantiate\");function receiveInstantiatedSource(output){receiveInstance(output[\"instance\"])}function instantiateArrayBuffer(receiver){return getBinaryPromise().then(function(binary){return WebAssembly.instantiate(binary,info)}).then(receiver,function(reason){err(\"failed to asynchronously prepare wasm: \"+reason);abort(reason)})}function instantiateAsync(){if(!wasmBinary&&typeof WebAssembly.instantiateStreaming===\"function\"&&!isDataURI(wasmBinaryFile)&&!isFileURI(wasmBinaryFile)&&typeof fetch===\"function\"){return fetch(wasmBinaryFile,{credentials:\"same-origin\"}).then(function(response){var result=WebAssembly.instantiateStreaming(response,info);return result.then(receiveInstantiatedSource,function(reason){err(\"wasm streaming compile failed: \"+reason);err(\"falling back to ArrayBuffer instantiation\");return instantiateArrayBuffer(receiveInstantiatedSource)})})}else{return instantiateArrayBuffer(receiveInstantiatedSource)}}if(Module[\"instantiateWasm\"]){try{var exports=Module[\"instantiateWasm\"](info,receiveInstance);return exports}catch(e){err(\"Module.instantiateWasm callback failed with error: \"+e);return false}}instantiateAsync().catch(readyPromiseReject);return{}}function callRuntimeCallbacks(callbacks){while(callbacks.length>0){var callback=callbacks.shift();if(typeof callback==\"function\"){callback(Module);continue}var func=callback.func;if(typeof func===\"number\"){if(callback.arg===undefined){wasmTable.get(func)()}else{wasmTable.get(func)(callback.arg)}}else{func(callback.arg===undefined?null:callback.arg)}}}function _abort(){abort()}function _emscripten_memcpy_big(dest,src,num){HEAPU8.copyWithin(dest,src,src+num)}function _emscripten_get_heap_size(){return HEAPU8.length}function emscripten_realloc_buffer(size){try{wasmMemory.grow(size-buffer.byteLength+65535>>>16);updateGlobalBufferAndViews(wasmMemory.buffer);return 1}catch(e){}}function _emscripten_resize_heap(requestedSize){var oldSize=_emscripten_get_heap_size();var maxHeapSize=2147483648;if(requestedSize>maxHeapSize){return false}for(var cutDown=1;cutDown<=4;cutDown*=2){var overGrownHeapSize=oldSize*(1+.2/cutDown);overGrownHeapSize=Math.min(overGrownHeapSize,requestedSize+100663296);var newSize=Math.min(maxHeapSize,alignUp(Math.max(requestedSize,overGrownHeapSize),65536));var replacement=emscripten_realloc_buffer(newSize);if(replacement){return true}}return false}var SYSCALLS={mappings:{},buffers:[null,[],[]],printChar:function(stream,curr){var buffer=SYSCALLS.buffers[stream];if(curr===0||curr===10){(stream===1?out:err)(UTF8ArrayToString(buffer,0));buffer.length=0}else{buffer.push(curr)}},varargs:undefined,get:function(){SYSCALLS.varargs+=4;var ret=HEAP32[SYSCALLS.varargs-4>>2];return ret},getStr:function(ptr){var ret=UTF8ToString(ptr);return ret},get64:function(low,high){return low}};function _fd_close(fd){return 0}function _fd_seek(fd,offset_low,offset_high,whence,newOffset){}function _fd_write(fd,iov,iovcnt,pnum){var num=0;for(var i=0;i>2];var len=HEAP32[iov+(i*8+4)>>2];for(var j=0;j>2]=num;return 0}function _pthread_create(){return 6}function setErrNo(value){HEAP32[___errno_location()>>2]=value;return value}function _sysconf(name){switch(name){case 30:return 16384;case 85:var maxHeapSize=2147483648;return maxHeapSize/16384;case 132:case 133:case 12:case 137:case 138:case 15:case 235:case 16:case 17:case 18:case 19:case 20:case 149:case 13:case 10:case 236:case 153:case 9:case 21:case 22:case 159:case 154:case 14:case 77:case 78:case 139:case 82:case 68:case 67:case 164:case 11:case 29:case 47:case 48:case 95:case 52:case 51:case 46:return 200809;case 27:case 246:case 127:case 128:case 23:case 24:case 160:case 161:case 181:case 182:case 242:case 183:case 184:case 243:case 244:case 245:case 165:case 178:case 179:case 49:case 50:case 168:case 169:case 175:case 170:case 171:case 172:case 97:case 76:case 32:case 173:case 35:case 80:case 81:case 79:return-1;case 176:case 177:case 7:case 155:case 8:case 157:case 125:case 126:case 92:case 93:case 129:case 130:case 131:case 94:case 91:return 1;case 74:case 60:case 69:case 70:case 4:return 1024;case 31:case 42:case 72:return 32;case 87:case 26:case 33:return 2147483647;case 34:case 1:return 47839;case 38:case 36:return 99;case 43:case 37:return 2048;case 0:return 2097152;case 3:return 65536;case 28:return 32768;case 44:return 32767;case 75:return 16384;case 39:return 1e3;case 89:return 700;case 71:return 256;case 40:return 255;case 2:return 100;case 180:return 64;case 25:return 20;case 5:return 16;case 6:return 6;case 73:return 4;case 84:{if(typeof navigator===\"object\")return navigator[\"hardwareConcurrency\"]||1;return 1}}setErrNo(28);return-1}var asmLibraryArg={\"a\":_abort,\"d\":_emscripten_memcpy_big,\"e\":_emscripten_resize_heap,\"f\":_fd_close,\"c\":_fd_seek,\"b\":_fd_write,\"g\":_pthread_create,\"h\":_sysconf};var asm=createWasm();var ___wasm_call_ctors=Module[\"___wasm_call_ctors\"]=function(){return(___wasm_call_ctors=Module[\"___wasm_call_ctors\"]=Module[\"asm\"][\"j\"]).apply(null,arguments)};var _init=Module[\"_init\"]=function(){return(_init=Module[\"_init\"]=Module[\"asm\"][\"k\"]).apply(null,arguments)};var _register_tensor=Module[\"_register_tensor\"]=function(){return(_register_tensor=Module[\"_register_tensor\"]=Module[\"asm\"][\"l\"]).apply(null,arguments)};var _dispose_data=Module[\"_dispose_data\"]=function(){return(_dispose_data=Module[\"_dispose_data\"]=Module[\"asm\"][\"m\"]).apply(null,arguments)};var _dispose=Module[\"_dispose\"]=function(){return(_dispose=Module[\"_dispose\"]=Module[\"asm\"][\"n\"]).apply(null,arguments)};var _Abs=Module[\"_Abs\"]=function(){return(_Abs=Module[\"_Abs\"]=Module[\"asm\"][\"p\"]).apply(null,arguments)};var _Add=Module[\"_Add\"]=function(){return(_Add=Module[\"_Add\"]=Module[\"asm\"][\"q\"]).apply(null,arguments)};var _AddN=Module[\"_AddN\"]=function(){return(_AddN=Module[\"_AddN\"]=Module[\"asm\"][\"r\"]).apply(null,arguments)};var _All=Module[\"_All\"]=function(){return(_All=Module[\"_All\"]=Module[\"asm\"][\"s\"]).apply(null,arguments)};var _Any=Module[\"_Any\"]=function(){return(_Any=Module[\"_Any\"]=Module[\"asm\"][\"t\"]).apply(null,arguments)};var _ArgMax=Module[\"_ArgMax\"]=function(){return(_ArgMax=Module[\"_ArgMax\"]=Module[\"asm\"][\"u\"]).apply(null,arguments)};var _AvgPool=Module[\"_AvgPool\"]=function(){return(_AvgPool=Module[\"_AvgPool\"]=Module[\"asm\"][\"v\"]).apply(null,arguments)};var _BatchMatMul=Module[\"_BatchMatMul\"]=function(){return(_BatchMatMul=Module[\"_BatchMatMul\"]=Module[\"asm\"][\"w\"]).apply(null,arguments)};var _Ceil=Module[\"_Ceil\"]=function(){return(_Ceil=Module[\"_Ceil\"]=Module[\"asm\"][\"x\"]).apply(null,arguments)};var _ClipByValue=Module[\"_ClipByValue\"]=function(){return(_ClipByValue=Module[\"_ClipByValue\"]=Module[\"asm\"][\"y\"]).apply(null,arguments)};var _Conv2D=Module[\"_Conv2D\"]=function(){return(_Conv2D=Module[\"_Conv2D\"]=Module[\"asm\"][\"z\"]).apply(null,arguments)};var _Conv2DBackpropInput=Module[\"_Conv2DBackpropInput\"]=function(){return(_Conv2DBackpropInput=Module[\"_Conv2DBackpropInput\"]=Module[\"asm\"][\"A\"]).apply(null,arguments)};var _Cos=Module[\"_Cos\"]=function(){return(_Cos=Module[\"_Cos\"]=Module[\"asm\"][\"B\"]).apply(null,arguments)};var _CropAndResize=Module[\"_CropAndResize\"]=function(){return(_CropAndResize=Module[\"_CropAndResize\"]=Module[\"asm\"][\"C\"]).apply(null,arguments)};var _Cumsum=Module[\"_Cumsum\"]=function(){return(_Cumsum=Module[\"_Cumsum\"]=Module[\"asm\"][\"D\"]).apply(null,arguments)};var _DepthToSpace=Module[\"_DepthToSpace\"]=function(){return(_DepthToSpace=Module[\"_DepthToSpace\"]=Module[\"asm\"][\"E\"]).apply(null,arguments)};var _DepthwiseConv2dNative=Module[\"_DepthwiseConv2dNative\"]=function(){return(_DepthwiseConv2dNative=Module[\"_DepthwiseConv2dNative\"]=Module[\"asm\"][\"F\"]).apply(null,arguments)};var _Equal=Module[\"_Equal\"]=function(){return(_Equal=Module[\"_Equal\"]=Module[\"asm\"][\"G\"]).apply(null,arguments)};var _Exp=Module[\"_Exp\"]=function(){return(_Exp=Module[\"_Exp\"]=Module[\"asm\"][\"H\"]).apply(null,arguments)};var _FlipLeftRight=Module[\"_FlipLeftRight\"]=function(){return(_FlipLeftRight=Module[\"_FlipLeftRight\"]=Module[\"asm\"][\"I\"]).apply(null,arguments)};var _Floor=Module[\"_Floor\"]=function(){return(_Floor=Module[\"_Floor\"]=Module[\"asm\"][\"J\"]).apply(null,arguments)};var _FloorDiv=Module[\"_FloorDiv\"]=function(){return(_FloorDiv=Module[\"_FloorDiv\"]=Module[\"asm\"][\"K\"]).apply(null,arguments)};var _FusedBatchNorm=Module[\"_FusedBatchNorm\"]=function(){return(_FusedBatchNorm=Module[\"_FusedBatchNorm\"]=Module[\"asm\"][\"L\"]).apply(null,arguments)};var _FusedConv2D=Module[\"_FusedConv2D\"]=function(){return(_FusedConv2D=Module[\"_FusedConv2D\"]=Module[\"asm\"][\"M\"]).apply(null,arguments)};var _FusedDepthwiseConv2D=Module[\"_FusedDepthwiseConv2D\"]=function(){return(_FusedDepthwiseConv2D=Module[\"_FusedDepthwiseConv2D\"]=Module[\"asm\"][\"N\"]).apply(null,arguments)};var _Gather=Module[\"_Gather\"]=function(){return(_Gather=Module[\"_Gather\"]=Module[\"asm\"][\"O\"]).apply(null,arguments)};var _GatherNd=Module[\"_GatherNd\"]=function(){return(_GatherNd=Module[\"_GatherNd\"]=Module[\"asm\"][\"P\"]).apply(null,arguments)};var _Greater=Module[\"_Greater\"]=function(){return(_Greater=Module[\"_Greater\"]=Module[\"asm\"][\"Q\"]).apply(null,arguments)};var _GreaterEqual=Module[\"_GreaterEqual\"]=function(){return(_GreaterEqual=Module[\"_GreaterEqual\"]=Module[\"asm\"][\"R\"]).apply(null,arguments)};var _LeakyRelu=Module[\"_LeakyRelu\"]=function(){return(_LeakyRelu=Module[\"_LeakyRelu\"]=Module[\"asm\"][\"S\"]).apply(null,arguments)};var _Less=Module[\"_Less\"]=function(){return(_Less=Module[\"_Less\"]=Module[\"asm\"][\"T\"]).apply(null,arguments)};var _LessEqual=Module[\"_LessEqual\"]=function(){return(_LessEqual=Module[\"_LessEqual\"]=Module[\"asm\"][\"U\"]).apply(null,arguments)};var _Log=Module[\"_Log\"]=function(){return(_Log=Module[\"_Log\"]=Module[\"asm\"][\"V\"]).apply(null,arguments)};var _LogicalAnd=Module[\"_LogicalAnd\"]=function(){return(_LogicalAnd=Module[\"_LogicalAnd\"]=Module[\"asm\"][\"W\"]).apply(null,arguments)};var _Max=Module[\"_Max\"]=function(){return(_Max=Module[\"_Max\"]=Module[\"asm\"][\"X\"]).apply(null,arguments)};var _MaxPool=Module[\"_MaxPool\"]=function(){return(_MaxPool=Module[\"_MaxPool\"]=Module[\"asm\"][\"Y\"]).apply(null,arguments)};var _Maximum=Module[\"_Maximum\"]=function(){return(_Maximum=Module[\"_Maximum\"]=Module[\"asm\"][\"Z\"]).apply(null,arguments)};var _Mean=Module[\"_Mean\"]=function(){return(_Mean=Module[\"_Mean\"]=Module[\"asm\"][\"_\"]).apply(null,arguments)};var _Min=Module[\"_Min\"]=function(){return(_Min=Module[\"_Min\"]=Module[\"asm\"][\"$\"]).apply(null,arguments)};var _Minimum=Module[\"_Minimum\"]=function(){return(_Minimum=Module[\"_Minimum\"]=Module[\"asm\"][\"aa\"]).apply(null,arguments)};var _MirrorPad=Module[\"_MirrorPad\"]=function(){return(_MirrorPad=Module[\"_MirrorPad\"]=Module[\"asm\"][\"ba\"]).apply(null,arguments)};var _Multiply=Module[\"_Multiply\"]=function(){return(_Multiply=Module[\"_Multiply\"]=Module[\"asm\"][\"ca\"]).apply(null,arguments)};var _Neg=Module[\"_Neg\"]=function(){return(_Neg=Module[\"_Neg\"]=Module[\"asm\"][\"da\"]).apply(null,arguments)};var _NonMaxSuppressionV3=Module[\"_NonMaxSuppressionV3\"]=function(){return(_NonMaxSuppressionV3=Module[\"_NonMaxSuppressionV3\"]=Module[\"asm\"][\"ea\"]).apply(null,arguments)};var _NonMaxSuppressionV4=Module[\"_NonMaxSuppressionV4\"]=function(){return(_NonMaxSuppressionV4=Module[\"_NonMaxSuppressionV4\"]=Module[\"asm\"][\"fa\"]).apply(null,arguments)};var _NonMaxSuppressionV5=Module[\"_NonMaxSuppressionV5\"]=function(){return(_NonMaxSuppressionV5=Module[\"_NonMaxSuppressionV5\"]=Module[\"asm\"][\"ga\"]).apply(null,arguments)};var _NotEqual=Module[\"_NotEqual\"]=function(){return(_NotEqual=Module[\"_NotEqual\"]=Module[\"asm\"][\"ha\"]).apply(null,arguments)};var _OneHot=Module[\"_OneHot\"]=function(){return(_OneHot=Module[\"_OneHot\"]=Module[\"asm\"][\"ia\"]).apply(null,arguments)};var _PadV2=Module[\"_PadV2\"]=function(){return(_PadV2=Module[\"_PadV2\"]=Module[\"asm\"][\"ja\"]).apply(null,arguments)};var _Pow=Module[\"_Pow\"]=function(){return(_Pow=Module[\"_Pow\"]=Module[\"asm\"][\"ka\"]).apply(null,arguments)};var _Prelu=Module[\"_Prelu\"]=function(){return(_Prelu=Module[\"_Prelu\"]=Module[\"asm\"][\"la\"]).apply(null,arguments)};var _Prod=Module[\"_Prod\"]=function(){return(_Prod=Module[\"_Prod\"]=Module[\"asm\"][\"ma\"]).apply(null,arguments)};var _RealDiv=Module[\"_RealDiv\"]=function(){return(_RealDiv=Module[\"_RealDiv\"]=Module[\"asm\"][\"na\"]).apply(null,arguments)};var _Relu=Module[\"_Relu\"]=function(){return(_Relu=Module[\"_Relu\"]=Module[\"asm\"][\"oa\"]).apply(null,arguments)};var _Relu6=Module[\"_Relu6\"]=function(){return(_Relu6=Module[\"_Relu6\"]=Module[\"asm\"][\"pa\"]).apply(null,arguments)};var _ResizeBilinear=Module[\"_ResizeBilinear\"]=function(){return(_ResizeBilinear=Module[\"_ResizeBilinear\"]=Module[\"asm\"][\"qa\"]).apply(null,arguments)};var _Reverse=Module[\"_Reverse\"]=function(){return(_Reverse=Module[\"_Reverse\"]=Module[\"asm\"][\"ra\"]).apply(null,arguments)};var _RotateWithOffset=Module[\"_RotateWithOffset\"]=function(){return(_RotateWithOffset=Module[\"_RotateWithOffset\"]=Module[\"asm\"][\"sa\"]).apply(null,arguments)};var _Round=Module[\"_Round\"]=function(){return(_Round=Module[\"_Round\"]=Module[\"asm\"][\"ta\"]).apply(null,arguments)};var _Rsqrt=Module[\"_Rsqrt\"]=function(){return(_Rsqrt=Module[\"_Rsqrt\"]=Module[\"asm\"][\"ua\"]).apply(null,arguments)};var _ScatterNd=Module[\"_ScatterNd\"]=function(){return(_ScatterNd=Module[\"_ScatterNd\"]=Module[\"asm\"][\"va\"]).apply(null,arguments)};var _SelectV2=Module[\"_SelectV2\"]=function(){return(_SelectV2=Module[\"_SelectV2\"]=Module[\"asm\"][\"wa\"]).apply(null,arguments)};var _Sigmoid=Module[\"_Sigmoid\"]=function(){return(_Sigmoid=Module[\"_Sigmoid\"]=Module[\"asm\"][\"xa\"]).apply(null,arguments)};var _Sin=Module[\"_Sin\"]=function(){return(_Sin=Module[\"_Sin\"]=Module[\"asm\"][\"ya\"]).apply(null,arguments)};var _Softmax=Module[\"_Softmax\"]=function(){return(_Softmax=Module[\"_Softmax\"]=Module[\"asm\"][\"za\"]).apply(null,arguments)};var _Sqrt=Module[\"_Sqrt\"]=function(){return(_Sqrt=Module[\"_Sqrt\"]=Module[\"asm\"][\"Aa\"]).apply(null,arguments)};var _Square=Module[\"_Square\"]=function(){return(_Square=Module[\"_Square\"]=Module[\"asm\"][\"Ba\"]).apply(null,arguments)};var _SquaredDifference=Module[\"_SquaredDifference\"]=function(){return(_SquaredDifference=Module[\"_SquaredDifference\"]=Module[\"asm\"][\"Ca\"]).apply(null,arguments)};var _Step=Module[\"_Step\"]=function(){return(_Step=Module[\"_Step\"]=Module[\"asm\"][\"Da\"]).apply(null,arguments)};var _StridedSlice=Module[\"_StridedSlice\"]=function(){return(_StridedSlice=Module[\"_StridedSlice\"]=Module[\"asm\"][\"Ea\"]).apply(null,arguments)};var _Sub=Module[\"_Sub\"]=function(){return(_Sub=Module[\"_Sub\"]=Module[\"asm\"][\"Fa\"]).apply(null,arguments)};var _Sum=Module[\"_Sum\"]=function(){return(_Sum=Module[\"_Sum\"]=Module[\"asm\"][\"Ga\"]).apply(null,arguments)};var _Tan=Module[\"_Tan\"]=function(){return(_Tan=Module[\"_Tan\"]=Module[\"asm\"][\"Ha\"]).apply(null,arguments)};var _Tanh=Module[\"_Tanh\"]=function(){return(_Tanh=Module[\"_Tanh\"]=Module[\"asm\"][\"Ia\"]).apply(null,arguments)};var _Tile=Module[\"_Tile\"]=function(){return(_Tile=Module[\"_Tile\"]=Module[\"asm\"][\"Ja\"]).apply(null,arguments)};var _TopK=Module[\"_TopK\"]=function(){return(_TopK=Module[\"_TopK\"]=Module[\"asm\"][\"Ka\"]).apply(null,arguments)};var _Transform=Module[\"_Transform\"]=function(){return(_Transform=Module[\"_Transform\"]=Module[\"asm\"][\"La\"]).apply(null,arguments)};var _Transpose=Module[\"_Transpose\"]=function(){return(_Transpose=Module[\"_Transpose\"]=Module[\"asm\"][\"Ma\"]).apply(null,arguments)};var __FusedMatMul=Module[\"__FusedMatMul\"]=function(){return(__FusedMatMul=Module[\"__FusedMatMul\"]=Module[\"asm\"][\"Na\"]).apply(null,arguments)};var _malloc=Module[\"_malloc\"]=function(){return(_malloc=Module[\"_malloc\"]=Module[\"asm\"][\"Oa\"]).apply(null,arguments)};var _free=Module[\"_free\"]=function(){return(_free=Module[\"_free\"]=Module[\"asm\"][\"Pa\"]).apply(null,arguments)};var ___errno_location=Module[\"___errno_location\"]=function(){return(___errno_location=Module[\"___errno_location\"]=Module[\"asm\"][\"Qa\"]).apply(null,arguments)};var stackSave=Module[\"stackSave\"]=function(){return(stackSave=Module[\"stackSave\"]=Module[\"asm\"][\"Ra\"]).apply(null,arguments)};var stackRestore=Module[\"stackRestore\"]=function(){return(stackRestore=Module[\"stackRestore\"]=Module[\"asm\"][\"Sa\"]).apply(null,arguments)};var stackAlloc=Module[\"stackAlloc\"]=function(){return(stackAlloc=Module[\"stackAlloc\"]=Module[\"asm\"][\"Ta\"]).apply(null,arguments)};Module[\"cwrap\"]=cwrap;var calledRun;function ExitStatus(status){this.name=\"ExitStatus\";this.message=\"Program terminated with exit(\"+status+\")\";this.status=status}dependenciesFulfilled=function runCaller(){if(!calledRun)run();if(!calledRun)dependenciesFulfilled=runCaller};function run(args){args=args||arguments_;if(runDependencies>0){return}preRun();if(runDependencies>0){return}function doRun(){if(calledRun)return;calledRun=true;Module[\"calledRun\"]=true;if(ABORT)return;initRuntime();preMain();readyPromiseResolve(Module);if(Module[\"onRuntimeInitialized\"])Module[\"onRuntimeInitialized\"]();postRun()}if(Module[\"setStatus\"]){Module[\"setStatus\"](\"Running...\");setTimeout(function(){setTimeout(function(){Module[\"setStatus\"](\"\")},1);doRun()},1)}else{doRun()}}Module[\"run\"]=run;if(Module[\"preInit\"]){if(typeof Module[\"preInit\"]==\"function\")Module[\"preInit\"]=[Module[\"preInit\"]];while(Module[\"preInit\"].length>0){Module[\"preInit\"].pop()()}}run();\n\n\n return WasmBackendModule.ready\n}\n);\n})();\nif (typeof exports === 'object' && typeof module === 'object')\n module.exports = WasmBackendModule;\nelse if (typeof define === 'function' && define['amd'])\n define([], function() { return WasmBackendModule; });\nelse if (typeof exports === 'object')\n exports[\"WasmBackendModule\"] = WasmBackendModule;\n", "/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {Backend, DataId} from '../tensor';\nimport {BackendValues, DataType} from '../types';\n\nexport const EPSILON_FLOAT32 = 1e-7;\nexport const EPSILON_FLOAT16 = 1e-4;\n\n// Required information for all backends.\nexport interface BackendTimingInfo {\n kernelMs: number|{error: string};\n getExtraProfileInfo?(): string; // a field for additional timing information\n // e.g. packing / unpacking for WebGL backend\n}\n\nexport interface TensorStorage {\n read(dataId: DataId): Promise;\n readSync(dataId: DataId): BackendValues;\n disposeData(dataId: DataId, force?: boolean): boolean;\n write(values: BackendValues, shape: number[], dtype: DataType): DataId;\n move(\n dataId: DataId, values: BackendValues, shape: number[], dtype: DataType,\n refCount: number): void;\n memory(): {unreliable: boolean;}; // Backend-specific information.\n /** Returns number of data ids currently in the storage. */\n numDataIds(): number;\n refCount(dataId: DataId): number;\n}\n\n/** Convenient class for storing tensor-related data. */\nexport class DataStorage {\n private data = new WeakMap();\n private dataIdsCount = 0;\n\n constructor(private backend: KernelBackend, private dataMover: DataMover) {}\n\n get(dataId: DataId) {\n if (!this.data.has(dataId)) {\n this.dataMover.moveData(this.backend, dataId);\n }\n return this.data.get(dataId);\n }\n\n set(dataId: DataId, value: T): void {\n this.dataIdsCount++;\n this.data.set(dataId, value);\n }\n\n has(dataId: DataId): boolean {\n return this.data.has(dataId);\n }\n\n delete(dataId: DataId): boolean {\n this.dataIdsCount--;\n return this.data.delete(dataId);\n }\n\n numDataIds(): number {\n return this.dataIdsCount;\n }\n}\n\nexport interface DataMover {\n /**\n * To be called by backends whenever they see a dataId that they don't own.\n * Upon calling this method, the mover will fetch the tensor from another\n * backend and register it with the current active backend.\n */\n moveData(backend: KernelBackend, dataId: DataId): void;\n}\n\nexport interface BackendTimer {\n // check if backend timer is available\n timerAvailable(): boolean;\n time(f: () => void): Promise;\n}\n\n/**\n * The interface that defines the kernels that should be implemented when\n * adding a new backend. New backends don't need to implement every one of the\n * methods, this can be done gradually (throw an error for unimplemented\n * methods).\n */\nexport class KernelBackend implements TensorStorage, Backend, BackendTimer {\n refCount(dataId: DataId): number {\n return notYetImplemented('refCount');\n }\n incRef(dataId: DataId): void {\n return notYetImplemented('incRef');\n }\n timerAvailable(): boolean {\n return true;\n }\n time(f: () => void): Promise {\n return notYetImplemented('time');\n }\n read(dataId: object): Promise {\n return notYetImplemented('read');\n }\n readSync(dataId: object): BackendValues {\n return notYetImplemented('readSync');\n }\n numDataIds(): number {\n return notYetImplemented('numDataIds');\n }\n disposeData(dataId: object, force?: boolean): boolean {\n return notYetImplemented('disposeData');\n }\n write(values: BackendValues, shape: number[], dtype: DataType): DataId {\n return notYetImplemented('write');\n }\n move(\n dataId: DataId, values: BackendValues, shape: number[], dtype: DataType,\n refCount: number): void {\n return notYetImplemented('move');\n }\n memory(): {unreliable: boolean; reasons?: string[]} {\n return notYetImplemented('memory');\n }\n /** Returns the highest precision for floats in bits (e.g. 16 or 32) */\n floatPrecision(): 16|32 {\n return notYetImplemented('floatPrecision');\n }\n /** Returns the smallest representable number. */\n epsilon(): number {\n return this.floatPrecision() === 32 ? EPSILON_FLOAT32 : EPSILON_FLOAT16;\n }\n dispose(): void {\n return notYetImplemented('dispose');\n }\n}\n\nfunction notYetImplemented(kernelName: string): never {\n throw new Error(\n `'${kernelName}' not yet implemented or not found in the registry. ` +\n `This kernel may not be supported by the tfjs backend you have chosen`);\n}\n", "/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {DataType, DataTypeMap, FlatVector, NumericDataType, RecursiveArray, TensorLike, TypedArray} from './types';\n\n/**\n * Shuffles the array in-place using Fisher-Yates algorithm.\n *\n * ```js\n * const a = [1, 2, 3, 4, 5];\n * tf.util.shuffle(a);\n * console.log(a);\n * ```\n *\n * @param array The array to shuffle in-place.\n *\n * @doc {heading: 'Util', namespace: 'util'}\n */\n// tslint:disable-next-line:no-any\nexport function shuffle(array: any[]|Uint32Array|Int32Array|\n Float32Array): void {\n let counter = array.length;\n let temp = 0;\n let index = 0;\n // While there are elements in the array\n while (counter > 0) {\n // Pick a random index\n index = (Math.random() * counter) | 0;\n // Decrease counter by 1\n counter--;\n // And swap the last element with it\n temp = array[counter];\n array[counter] = array[index];\n array[index] = temp;\n }\n}\n\n/**\n * Shuffles two arrays in-place the same way using Fisher-Yates algorithm.\n *\n * ```js\n * const a = [1,2,3,4,5];\n * const b = [11,22,33,44,55];\n * tf.util.shuffleCombo(a, b);\n * console.log(a, b);\n * ```\n *\n * @param array The first array to shuffle in-place.\n * @param array2 The second array to shuffle in-place with the same permutation\n * as the first array.\n *\n * @doc {heading: 'Util', namespace: 'util'}\n */\nexport function shuffleCombo(\n // tslint:disable-next-line:no-any\n array: any[]|Uint32Array|Int32Array|Float32Array,\n // tslint:disable-next-line:no-any\n array2: any[]|Uint32Array|Int32Array|Float32Array): void {\n if (array.length !== array2.length) {\n throw new Error(\n `Array sizes must match to be shuffled together ` +\n `First array length was ${array.length}` +\n `Second array length was ${array2.length}`);\n }\n let counter = array.length;\n let temp, temp2;\n let index = 0;\n // While there are elements in the array\n while (counter > 0) {\n // Pick a random index\n index = (Math.random() * counter) | 0;\n // Decrease counter by 1\n counter--;\n // And swap the last element of each array with it\n temp = array[counter];\n temp2 = array2[counter];\n array[counter] = array[index];\n array2[counter] = array2[index];\n array[index] = temp;\n array2[index] = temp2;\n }\n}\n\n/** Clamps a value to a specified range. */\nexport function clamp(min: number, x: number, max: number): number {\n return Math.max(min, Math.min(x, max));\n}\n\nexport function nearestLargerEven(val: number): number {\n return val % 2 === 0 ? val : val + 1;\n}\n\nexport function sum(arr: number[]): number {\n let sum = 0;\n for (let i = 0; i < arr.length; i++) {\n sum += arr[i];\n }\n return sum;\n}\n\n/**\n * Returns a sample from a uniform [a, b) distribution.\n *\n * @param a The minimum support (inclusive).\n * @param b The maximum support (exclusive).\n * @return A pseudorandom number on the half-open interval [a,b).\n */\nexport function randUniform(a: number, b: number) {\n const r = Math.random();\n return (b * r) + (1 - r) * a;\n}\n\n/** Returns the squared Euclidean distance between two vectors. */\nexport function distSquared(a: FlatVector, b: FlatVector): number {\n let result = 0;\n for (let i = 0; i < a.length; i++) {\n const diff = Number(a[i]) - Number(b[i]);\n result += diff * diff;\n }\n return result;\n}\n\n/**\n * Asserts that the expression is true. Otherwise throws an error with the\n * provided message.\n *\n * ```js\n * const x = 2;\n * tf.util.assert(x === 2, 'x is not 2');\n * ```\n *\n * @param expr The expression to assert (as a boolean).\n * @param msg A function that returns the message to report when throwing an\n * error. We use a function for performance reasons.\n *\n * @doc {heading: 'Util', namespace: 'util'}\n */\nexport function assert(expr: boolean, msg: () => string) {\n if (!expr) {\n throw new Error(typeof msg === 'string' ? msg : msg());\n }\n}\n\nexport function assertShapesMatch(\n shapeA: number[], shapeB: number[], errorMessagePrefix = ''): void {\n assert(\n arraysEqual(shapeA, shapeB),\n () => errorMessagePrefix + ` Shapes ${shapeA} and ${shapeB} must match`);\n}\n\nexport function assertNonNull(a: TensorLike): void {\n assert(\n a != null,\n () => `The input to the tensor constructor must be a non-null value.`);\n}\n\n// NOTE: We explicitly type out what T extends instead of any so that\n// util.flatten on a nested array of number doesn't try to infer T as a\n// number[][], causing us to explicitly type util.flatten().\n/**\n * Flattens an arbitrarily nested array.\n *\n * ```js\n * const a = [[1, 2], [3, 4], [5, [6, [7]]]];\n * const flat = tf.util.flatten(a);\n * console.log(flat);\n * ```\n *\n * @param arr The nested array to flatten.\n * @param result The destination array which holds the elements.\n * @param skipTypedArray If true, avoids flattening the typed arrays. Defaults\n * to false.\n *\n * @doc {heading: 'Util', namespace: 'util'}\n */\nexport function\nflatten|TypedArray>(\n arr: T|RecursiveArray, result: T[] = [], skipTypedArray = false): T[] {\n if (result == null) {\n result = [];\n }\n if (Array.isArray(arr) || isTypedArray(arr) && !skipTypedArray) {\n for (let i = 0; i < arr.length; ++i) {\n flatten(arr[i], result, skipTypedArray);\n }\n } else {\n result.push(arr as T);\n }\n return result;\n}\n\n/**\n * Returns the size (number of elements) of the tensor given its shape.\n *\n * ```js\n * const shape = [3, 4, 2];\n * const size = tf.util.sizeFromShape(shape);\n * console.log(size);\n * ```\n *\n * @doc {heading: 'Util', namespace: 'util'}\n */\nexport function sizeFromShape(shape: number[]): number {\n if (shape.length === 0) {\n // Scalar.\n return 1;\n }\n let size = shape[0];\n for (let i = 1; i < shape.length; i++) {\n size *= shape[i];\n }\n return size;\n}\n\nexport function isScalarShape(shape: number[]): boolean {\n return shape.length === 0;\n}\n\nexport function arraysEqual(n1: FlatVector, n2: FlatVector) {\n if (n1 === n2) {\n return true;\n }\n if (n1 == null || n2 == null) {\n return false;\n }\n\n if (n1.length !== n2.length) {\n return false;\n }\n for (let i = 0; i < n1.length; i++) {\n if (n1[i] !== n2[i]) {\n return false;\n }\n }\n return true;\n}\n\nexport function isInt(a: number): boolean {\n return a % 1 === 0;\n}\n\nexport function tanh(x: number): number {\n // tslint:disable-next-line:no-any\n if ((Math as any).tanh != null) {\n // tslint:disable-next-line:no-any\n return (Math as any).tanh(x);\n }\n if (x === Infinity) {\n return 1;\n } else if (x === -Infinity) {\n return -1;\n } else {\n const e2x = Math.exp(2 * x);\n return (e2x - 1) / (e2x + 1);\n }\n}\n\nexport function sizeToSquarishShape(size: number): [number, number] {\n const width = Math.ceil(Math.sqrt(size));\n return [width, Math.ceil(size / width)];\n}\n\n/**\n * Creates a new array with randomized indicies to a given quantity.\n *\n * ```js\n * const randomTen = tf.util.createShuffledIndices(10);\n * console.log(randomTen);\n * ```\n *\n * @param number Quantity of how many shuffled indicies to create.\n *\n * @doc {heading: 'Util', namespace: 'util'}\n */\nexport function createShuffledIndices(n: number): Uint32Array {\n const shuffledIndices = new Uint32Array(n);\n for (let i = 0; i < n; ++i) {\n shuffledIndices[i] = i;\n }\n shuffle(shuffledIndices);\n return shuffledIndices;\n}\n\nexport function rightPad(a: string, size: number): string {\n if (size <= a.length) {\n return a;\n }\n return a + ' '.repeat(size - a.length);\n}\n\nexport function repeatedTry(\n checkFn: () => boolean, delayFn = (counter: number) => 0,\n maxCounter?: number): Promise {\n return new Promise((resolve, reject) => {\n let tryCount = 0;\n\n const tryFn = () => {\n if (checkFn()) {\n resolve();\n return;\n }\n\n tryCount++;\n\n const nextBackoff = delayFn(tryCount);\n\n if (maxCounter != null && tryCount >= maxCounter) {\n reject();\n return;\n }\n setTimeout(tryFn, nextBackoff);\n };\n\n tryFn();\n });\n}\n\n/**\n * Given the full size of the array and a shape that may contain -1 as the\n * implicit dimension, returns the inferred shape where -1 is replaced.\n * E.g. For shape=[2, -1, 3] and size=24, it will return [2, 4, 3].\n *\n * @param shape The shape, which may contain -1 in some dimension.\n * @param size The full size (number of elements) of the array.\n * @return The inferred shape where -1 is replaced with the inferred size.\n */\nexport function inferFromImplicitShape(\n shape: number[], size: number): number[] {\n let shapeProd = 1;\n let implicitIdx = -1;\n\n for (let i = 0; i < shape.length; ++i) {\n if (shape[i] >= 0) {\n shapeProd *= shape[i];\n } else if (shape[i] === -1) {\n if (implicitIdx !== -1) {\n throw Error(\n `Shapes can only have 1 implicit size. ` +\n `Found -1 at dim ${implicitIdx} and dim ${i}`);\n }\n implicitIdx = i;\n } else if (shape[i] < 0) {\n throw Error(`Shapes can not be < 0. Found ${shape[i]} at dim ${i}`);\n }\n }\n\n if (implicitIdx === -1) {\n if (size > 0 && size !== shapeProd) {\n throw Error(`Size(${size}) must match the product of shape ${shape}`);\n }\n return shape;\n }\n\n if (shapeProd === 0) {\n throw Error(\n `Cannot infer the missing size in [${shape}] when ` +\n `there are 0 elements`);\n }\n if (size % shapeProd !== 0) {\n throw Error(\n `The implicit shape can't be a fractional number. ` +\n `Got ${size} / ${shapeProd}`);\n }\n\n const newShape = shape.slice();\n newShape[implicitIdx] = size / shapeProd;\n return newShape;\n}\n\nexport function parseAxisParam(\n axis: number|number[], shape: number[]): number[] {\n const rank = shape.length;\n\n // Normalize input\n axis = axis == null ? shape.map((s, i) => i) : [].concat(axis);\n\n // Check for valid range\n assert(\n axis.every(ax => ax >= -rank && ax < rank),\n () =>\n `All values in axis param must be in range [-${rank}, ${rank}) but ` +\n `got axis ${axis}`);\n\n // Check for only integers\n assert(\n axis.every(ax => isInt(ax)),\n () => `All values in axis param must be integers but ` +\n `got axis ${axis}`);\n\n // Handle negative axis.\n return axis.map(a => a < 0 ? rank + a : a);\n}\n\n/** Reduces the shape by removing all dimensions of shape 1. */\nexport function squeezeShape(shape: number[], axis?: number[]):\n {newShape: number[], keptDims: number[]} {\n const newShape: number[] = [];\n const keptDims: number[] = [];\n const isEmptyArray = axis != null && Array.isArray(axis) && axis.length === 0;\n const axes = (axis == null || isEmptyArray) ?\n null :\n parseAxisParam(axis, shape).sort();\n let j = 0;\n for (let i = 0; i < shape.length; ++i) {\n if (axes != null) {\n if (axes[j] === i && shape[i] !== 1) {\n throw new Error(\n `Can't squeeze axis ${i} since its dim '${shape[i]}' is not 1`);\n }\n if ((axes[j] == null || axes[j] > i) && shape[i] === 1) {\n newShape.push(shape[i]);\n keptDims.push(i);\n }\n if (axes[j] <= i) {\n j++;\n }\n }\n if (shape[i] !== 1) {\n newShape.push(shape[i]);\n keptDims.push(i);\n }\n }\n return {newShape, keptDims};\n}\n\nexport function getTypedArrayFromDType(\n dtype: D, size: number): DataTypeMap[D] {\n let values = null;\n if (dtype == null || dtype === 'float32') {\n values = new Float32Array(size);\n } else if (dtype === 'int32') {\n values = new Int32Array(size);\n } else if (dtype === 'bool') {\n values = new Uint8Array(size);\n } else {\n throw new Error(`Unknown data type ${dtype}`);\n }\n return values as DataTypeMap[D];\n}\n\nexport function getArrayFromDType(\n dtype: D, size: number): DataTypeMap[D] {\n let values = null;\n if (dtype == null || dtype === 'float32') {\n values = new Float32Array(size);\n } else if (dtype === 'int32') {\n values = new Int32Array(size);\n } else if (dtype === 'bool') {\n values = new Uint8Array(size);\n } else if (dtype === 'string') {\n values = new Array<'string'>(size);\n } else {\n throw new Error(`Unknown data type ${dtype}`);\n }\n return values as DataTypeMap[D];\n}\n\nexport function checkConversionForErrors(\n vals: DataTypeMap[D]|number[], dtype: D): void {\n for (let i = 0; i < vals.length; i++) {\n const num = vals[i] as number;\n if (isNaN(num) || !isFinite(num)) {\n throw Error(`A tensor of type ${dtype} being uploaded contains ${num}.`);\n }\n }\n}\n\n/** Returns true if the dtype is valid. */\nexport function isValidDtype(dtype: DataType): boolean {\n return dtype === 'bool' || dtype === 'complex64' || dtype === 'float32' ||\n dtype === 'int32' || dtype === 'string';\n}\n\n/**\n * Returns true if the new type can't encode the old type without loss of\n * precision.\n */\nexport function hasEncodingLoss(oldType: DataType, newType: DataType): boolean {\n if (newType === 'complex64') {\n return false;\n }\n if (newType === 'float32' && oldType !== 'complex64') {\n return false;\n }\n if (newType === 'int32' && oldType !== 'float32' && oldType !== 'complex64') {\n return false;\n }\n if (newType === 'bool' && oldType === 'bool') {\n return false;\n }\n return true;\n}\n\nexport function isTypedArray(a: {}): a is Float32Array|Int32Array|Uint8Array {\n return a instanceof Float32Array || a instanceof Int32Array ||\n a instanceof Uint8Array;\n}\n\nexport function bytesPerElement(dtype: DataType): number {\n if (dtype === 'float32' || dtype === 'int32') {\n return 4;\n } else if (dtype === 'complex64') {\n return 8;\n } else if (dtype === 'bool') {\n return 1;\n } else {\n throw new Error(`Unknown dtype ${dtype}`);\n }\n}\n\n/**\n * Returns the approximate number of bytes allocated in the string array - 2\n * bytes per character. Computing the exact bytes for a native string in JS is\n * not possible since it depends on the encoding of the html page that serves\n * the website.\n */\nexport function bytesFromStringArray(arr: Uint8Array[]): number {\n if (arr == null) {\n return 0;\n }\n let bytes = 0;\n arr.forEach(x => bytes += x.length);\n return bytes;\n}\n\n/** Returns true if the value is a string. */\nexport function isString(value: {}): value is string {\n return typeof value === 'string' || value instanceof String;\n}\n\nexport function isBoolean(value: {}): boolean {\n return typeof value === 'boolean';\n}\n\nexport function isNumber(value: {}): boolean {\n return typeof value === 'number';\n}\n\nexport function inferDtype(values: TensorLike): DataType {\n if (Array.isArray(values)) {\n return inferDtype(values[0]);\n }\n if (values instanceof Float32Array) {\n return 'float32';\n } else if (values instanceof Int32Array || values instanceof Uint8Array) {\n return 'int32';\n } else if (isNumber(values)) {\n return 'float32';\n } else if (isString(values)) {\n return 'string';\n } else if (isBoolean(values)) {\n return 'bool';\n }\n return 'float32';\n}\n\nexport function isFunction(f: Function) {\n return !!(f && f.constructor && f.call && f.apply);\n}\n\nexport function nearestDivisor(size: number, start: number): number {\n for (let i = start; i < size; ++i) {\n if (size % i === 0) {\n return i;\n }\n }\n return size;\n}\n\nexport function computeStrides(shape: number[]): number[] {\n const rank = shape.length;\n if (rank < 2) {\n return [];\n }\n\n // Last dimension has implicit stride of 1, thus having D-1 (instead of D)\n // strides.\n const strides = new Array(rank - 1);\n strides[rank - 2] = shape[rank - 1];\n for (let i = rank - 3; i >= 0; --i) {\n strides[i] = strides[i + 1] * shape[i + 1];\n }\n return strides;\n}\n\nfunction createNestedArray(\n offset: number, shape: number[], a: TypedArray, isComplex = false) {\n const ret = new Array();\n if (shape.length === 1) {\n const d = shape[0] * (isComplex ? 2 : 1);\n for (let i = 0; i < d; i++) {\n ret[i] = a[offset + i];\n }\n } else {\n const d = shape[0];\n const rest = shape.slice(1);\n const len = rest.reduce((acc, c) => acc * c) * (isComplex ? 2 : 1);\n for (let i = 0; i < d; i++) {\n ret[i] = createNestedArray(offset + i * len, rest, a, isComplex);\n }\n }\n return ret;\n}\n\n// Provide a nested array of TypedArray in given shape.\nexport function toNestedArray(\n shape: number[], a: TypedArray, isComplex = false) {\n if (shape.length === 0) {\n // Scalar type should return a single number.\n return a[0];\n }\n const size = shape.reduce((acc, c) => acc * c) * (isComplex ? 2 : 1);\n if (size === 0) {\n // A tensor with shape zero should be turned into empty list.\n return [];\n }\n if (size !== a.length) {\n throw new Error(`[${shape}] does not match the input size ${a.length}${\n isComplex ? ' for a complex tensor' : ''}.`);\n }\n\n return createNestedArray(0, shape, a, isComplex);\n}\n\nexport function makeOnesTypedArray(\n size: number, dtype: D): DataTypeMap[D] {\n const array = makeZerosTypedArray(size, dtype);\n for (let i = 0; i < array.length; i++) {\n array[i] = 1;\n }\n return array;\n}\n\nexport function makeZerosTypedArray(\n size: number, dtype: D): DataTypeMap[D] {\n if (dtype == null || dtype === 'float32' || dtype === 'complex64') {\n return new Float32Array(size) as DataTypeMap[D];\n } else if (dtype === 'int32') {\n return new Int32Array(size) as DataTypeMap[D];\n } else if (dtype === 'bool') {\n return new Uint8Array(size) as DataTypeMap[D];\n } else {\n throw new Error(`Unknown data type ${dtype}`);\n }\n}\n\n/**\n * Make nested `TypedArray` filled with zeros.\n * @param shape The shape information for the nested array.\n * @param dtype dtype of the array element.\n */\nexport function makeZerosNestedTypedArray(\n shape: number[], dtype: D) {\n const size = shape.reduce((prev, curr) => prev * curr, 1);\n if (dtype == null || dtype === 'float32') {\n return toNestedArray(shape, new Float32Array(size));\n } else if (dtype === 'int32') {\n return toNestedArray(shape, new Int32Array(size));\n } else if (dtype === 'bool') {\n return toNestedArray(shape, new Uint8Array(size));\n } else {\n throw new Error(`Unknown data type ${dtype}`);\n }\n}\n\nexport function assertNonNegativeIntegerDimensions(shape: number[]) {\n shape.forEach(dimSize => {\n assert(\n Number.isInteger(dimSize) && dimSize >= 0,\n () =>\n `Tensor must have a shape comprised of positive integers but got ` +\n `shape [${shape}].`);\n });\n}\n\n/**\n * Computes flat index for a given location (multidimentionsal index) in a\n * Tensor/multidimensional array.\n *\n * @param locs Location in the tensor.\n * @param rank Rank of the tensor.\n * @param strides Tensor strides.\n */\nexport function locToIndex(\n locs: number[], rank: number, strides: number[]): number {\n if (rank === 0) {\n return 0;\n } else if (rank === 1) {\n return locs[0];\n }\n let index = locs[locs.length - 1];\n for (let i = 0; i < locs.length - 1; ++i) {\n index += strides[i] * locs[i];\n }\n return index;\n}\n\n/**\n * Computes the location (multidimensional index) in a tensor/multidimentional\n * array for a given flat index.\n *\n * @param index Index in flat array.\n * @param rank Rank of tensor.\n * @param strides Strides of tensor.\n */\nexport function indexToLoc(\n index: number, rank: number, strides: number[]): number[] {\n if (rank === 0) {\n return [];\n } else if (rank === 1) {\n return [index];\n }\n const locs: number[] = new Array(rank);\n for (let i = 0; i < locs.length - 1; ++i) {\n locs[i] = Math.floor(index / strides[i]);\n index -= locs[i] * strides[i];\n }\n locs[locs.length - 1] = index;\n return locs;\n}\n\n/**\n * This method asserts whether an object is a Promise instance.\n * @param object\n */\n// tslint:disable-next-line: no-any\nexport function isPromise(object: any) {\n // We chose to not use 'obj instanceOf Promise' for two reasons:\n // 1. It only reliably works for es6 Promise, not other Promise\n // implementations.\n // 2. It doesn't work with framework that uses zone.js. zone.js monkey patch\n // the async calls, so it is possible the obj (patched) is comparing to a\n // pre-patched Promise.\n return object && object.then && typeof object.then === 'function';\n}\n", "/**\n * @license\n * Copyright 2017 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {Platform} from './platforms/platform';\nimport {isPromise} from './util_base';\n\n// Expects flags from URL in the format ?tfjsflags=FLAG1:1,FLAG2:true.\nconst TENSORFLOWJS_FLAGS_PREFIX = 'tfjsflags';\n\ntype FlagValue = number|boolean;\ntype FlagEvaluationFn = (() => FlagValue)|(() => Promise);\nexport type Flags = {\n [featureName: string]: FlagValue\n};\nexport type FlagRegistryEntry = {\n evaluationFn: FlagEvaluationFn;\n setHook?: (value: FlagValue) => void;\n};\n\n/**\n * The environment contains evaluated flags as well as the registered platform.\n * This is always used as a global singleton and can be retrieved with\n * `tf.env()`.\n *\n * @doc {heading: 'Environment'}\n */\nexport class Environment {\n private flags: Flags = {};\n private flagRegistry: {[flagName: string]: FlagRegistryEntry} = {};\n\n private urlFlags: Flags = {};\n\n platformName: string;\n platform: Platform;\n\n // Jasmine spies on this in 'environment_test.ts'\n getQueryParams = getQueryParams;\n\n // tslint:disable-next-line: no-any\n constructor(public global: any) {\n this.populateURLFlags();\n }\n\n setPlatform(platformName: string, platform: Platform) {\n if (this.platform != null) {\n console.warn(\n `Platform ${this.platformName} has already been set. ` +\n `Overwriting the platform with ${platform}.`);\n }\n this.platformName = platformName;\n this.platform = platform;\n }\n\n registerFlag(\n flagName: string, evaluationFn: FlagEvaluationFn,\n setHook?: (value: FlagValue) => void) {\n this.flagRegistry[flagName] = {evaluationFn, setHook};\n\n // Override the flag value from the URL. This has to happen here because the\n // environment is initialized before flags get registered.\n if (this.urlFlags[flagName] != null) {\n const flagValue = this.urlFlags[flagName];\n console.warn(\n `Setting feature override from URL ${flagName}: ${flagValue}.`);\n this.set(flagName, flagValue);\n }\n }\n\n async getAsync(flagName: string): Promise {\n if (flagName in this.flags) {\n return this.flags[flagName];\n }\n\n this.flags[flagName] = await this.evaluateFlag(flagName);\n return this.flags[flagName];\n }\n\n get(flagName: string): FlagValue {\n if (flagName in this.flags) {\n return this.flags[flagName];\n }\n\n const flagValue = this.evaluateFlag(flagName);\n if (isPromise(flagValue)) {\n throw new Error(\n `Flag ${flagName} cannot be synchronously evaluated. ` +\n `Please use getAsync() instead.`);\n }\n\n this.flags[flagName] = flagValue as number | boolean;\n\n return this.flags[flagName];\n }\n\n getNumber(flagName: string): number {\n return this.get(flagName) as number;\n }\n\n getBool(flagName: string): boolean {\n return this.get(flagName) as boolean;\n }\n\n getFlags(): Flags {\n return this.flags;\n }\n // For backwards compatibility.\n get features(): Flags {\n return this.flags;\n }\n\n set(flagName: string, value: FlagValue): void {\n if (this.flagRegistry[flagName] == null) {\n throw new Error(\n `Cannot set flag ${flagName} as it has not been registered.`);\n }\n this.flags[flagName] = value;\n if (this.flagRegistry[flagName].setHook != null) {\n this.flagRegistry[flagName].setHook(value);\n }\n }\n\n private evaluateFlag(flagName: string): FlagValue|Promise {\n if (this.flagRegistry[flagName] == null) {\n throw new Error(\n `Cannot evaluate flag '${flagName}': no evaluation function found.`);\n }\n return this.flagRegistry[flagName].evaluationFn();\n }\n\n setFlags(flags: Flags) {\n this.flags = Object.assign({}, flags);\n }\n\n reset() {\n this.flags = {};\n this.urlFlags = {};\n this.populateURLFlags();\n }\n\n private populateURLFlags(): void {\n if (typeof this.global === 'undefined' ||\n typeof this.global.location === 'undefined' ||\n typeof this.global.location.search === 'undefined') {\n return;\n }\n\n const urlParams = this.getQueryParams(this.global.location.search);\n if (TENSORFLOWJS_FLAGS_PREFIX in urlParams) {\n const keyValues = urlParams[TENSORFLOWJS_FLAGS_PREFIX].split(',');\n keyValues.forEach(keyValue => {\n const [key, value] = keyValue.split(':') as [string, string];\n this.urlFlags[key] = parseValue(key, value);\n });\n }\n }\n}\n\nexport function getQueryParams(queryString: string): {[key: string]: string} {\n const params = {};\n queryString.replace(/[?&]([^=?&]+)(?:=([^&]*))?/g, (s, ...t) => {\n decodeParam(params, t[0], t[1]);\n return t.join('=');\n });\n return params;\n}\n\nfunction decodeParam(\n params: {[key: string]: string}, name: string, value?: string) {\n params[decodeURIComponent(name)] = decodeURIComponent(value || '');\n}\n\nfunction parseValue(flagName: string, value: string): FlagValue {\n value = value.toLowerCase();\n if (value === 'true' || value === 'false') {\n return value === 'true';\n } else if (`${+ value}` === value) {\n return +value;\n }\n throw new Error(\n `Could not parse value flag value ${value} for flag ${flagName}.`);\n}\n\n/**\n * Returns the current environment (a global singleton).\n *\n * The environment object contains the evaluated feature values as well as the\n * active platform.\n *\n * @doc {heading: 'Environment'}\n */\nexport function env() {\n return ENV;\n}\n\nexport let ENV: Environment = null;\nexport function setEnvironmentGlobal(environment: Environment) {\n ENV = environment;\n}\n", "/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\n// Note that the identifier globalNameSpace is scoped to this module, but will\n// always resolve to the same global object regardless of how the module is\n// resolved.\n// tslint:disable-next-line:no-any\nlet globalNameSpace: {_tfGlobals: Map};\n// tslint:disable-next-line:no-any\nexport function getGlobalNamespace(): {_tfGlobals: Map} {\n if (globalNameSpace == null) {\n // tslint:disable-next-line:no-any\n let ns: any;\n if (typeof (window) !== 'undefined') {\n ns = window;\n } else if (typeof (global) !== 'undefined') {\n ns = global;\n } else if (typeof (process) !== 'undefined') {\n ns = process;\n } else if (typeof (self) !== 'undefined') {\n ns = self;\n } else {\n throw new Error('Could not find a global object');\n }\n globalNameSpace = ns;\n }\n return globalNameSpace;\n}\n\n// tslint:disable-next-line:no-any\nfunction getGlobalMap(): Map {\n const ns = getGlobalNamespace();\n if (ns._tfGlobals == null) {\n ns._tfGlobals = new Map();\n }\n return ns._tfGlobals;\n}\n\n/**\n * Returns a globally accessible 'singleton' object.\n *\n * @param key the name of the object\n * @param init a function to initialize to initialize this object\n * the first time it is fetched.\n */\nexport function getGlobal(key: string, init: () => T): T {\n const globalMap = getGlobalMap();\n if (globalMap.has(key)) {\n return globalMap.get(key);\n } else {\n const singleton = init();\n globalMap.set(key, singleton);\n return globalMap.get(key);\n }\n}\n", "/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n// Allow UpperCamelCase variable names\n// tslint:disable: variable-name\n// Unfortunately just enabling PascalCase per file (tslint:enable:\n// allow-pascal-case) doesn't work.\nimport {NamedTensorInfoMap, TensorInfo} from './kernel_registry';\nimport {ExplicitPadding} from './ops/conv_util';\nimport {Activation} from './ops/fused_types';\nimport {DataType, PixelData} from './types';\n\nexport const Abs = 'Abs';\nexport type AbsInputs = UnaryInputs;\n\nexport const Acos = 'Acos';\nexport type AcosInputs = UnaryInputs;\n\nexport const Acosh = 'Acosh';\nexport type AcoshInputs = UnaryInputs;\n\nexport const Add = 'Add';\nexport type AddInputs = BinaryInputs;\n\nexport const AddN = 'AddN';\nexport type AddNInputs = TensorInfo[];\n\nexport const All = 'All';\nexport type AllInputs = Pick;\nexport interface AllAttrs {\n axis: number|number[];\n keepDims: boolean;\n}\n\nexport const Any = 'Any';\nexport type AnyInputs = Pick;\nexport interface AnyAttrs {\n axis: number|number[];\n keepDims: boolean;\n}\n\nexport const ArgMax = 'ArgMax';\nexport type ArgMaxInputs = Pick;\nexport interface ArgMaxAttrs {\n axis: number;\n}\n\nexport const ArgMin = 'ArgMin';\nexport type ArgMinInputs = Pick;\nexport interface ArgMinAttrs {\n axis: number;\n}\n\nexport const Asin = 'Asin';\nexport type AsinInputs = UnaryInputs;\n\nexport const Asinh = 'Asinh';\nexport type AsinhInputs = UnaryInputs;\n\nexport const Atan = 'Atan';\nexport type AtanInputs = UnaryInputs;\n\nexport const Atanh = 'Atanh';\nexport type AtanhInputs = UnaryInputs;\n\nexport const Atan2 = 'Atan2';\nexport type Atan2Inputs = BinaryInputs;\n\nexport const AvgPool = 'AvgPool';\nexport type AvgPoolInputs = Pick;\nexport interface AvgPoolAttrs {\n filterSize: [number, number]|number;\n strides: [number, number]|number;\n pad: 'valid'|'same'|number;\n dimRoundingMode?: 'floor'|'round'|'ceil';\n}\n\nexport const AvgPoolGrad = 'AvgPoolGrad';\nexport type AvgPoolGradInputs = Pick;\nexport interface AvgPoolGradAttrs {\n filterSize: [number, number]|number;\n strides: [number, number]|number;\n pad: 'valid'|'same'|number;\n}\n\nexport const AvgPool3D = 'AvgPool3D';\nexport type AvgPool3DInputs = Pick;\nexport interface AvgPool3DAttrs {\n filterSize: [number, number, number]|number;\n strides: [number, number, number]|number;\n pad: 'valid'|'same'|number;\n dimRoundingMode?: 'floor'|'round'|'ceil';\n dataFormat: 'NDHWC'|'NCDHW';\n}\n\nexport const AvgPool3DGrad = 'AvgPool3DGrad';\nexport type AvgPool3DGradInputs = Pick;\nexport interface AvgPool3DGradAttrs {\n filterSize: [number, number, number]|number;\n strides: [number, number, number]|number;\n pad: 'valid'|'same'|number;\n dimRoundingMode?: 'floor'|'round'|'ceil';\n}\n\nexport const BatchMatMul = 'BatchMatMul';\nexport type BatchMatMulInputs = Pick;\nexport interface BatchMatMulAttrs {\n transposeA: boolean;\n transposeB: boolean;\n}\n\nexport const BatchToSpaceND = 'BatchToSpaceND';\nexport type BatchToSpaceNDInputs = Pick;\nexport interface BatchToSpaceNDAttrs {\n blockShape: number[];\n crops: number[][];\n}\n\nexport type BinaryInputs = Pick;\n\nexport const Bincount = 'Bincount';\nexport type BincountInputs = Pick;\nexport interface BincountAttrs {\n size: number;\n}\n\nexport const BroadcastTo = 'BroadcastTo';\nexport type BroadcastToInputs = Pick;\nexport interface BroadCastToAttrs {\n shape: number[];\n inputShape: number[]; // for gradient\n}\n\nexport const Cast = 'Cast';\nexport type CastInputs = UnaryInputs;\nexport interface CastAttrs {\n dtype: DataType;\n}\n\nexport const Ceil = 'Ceil';\nexport type CeilInputs = UnaryInputs;\n\nexport const ClipByValue = 'ClipByValue';\nexport type ClipByValueInputs = UnaryInputs;\nexport interface ClipByValueAttrs {\n clipValueMin: number;\n clipValueMax: number;\n}\n\nexport const Complex = 'Complex';\nexport type ComplexInputs = Pick;\n\nexport const ComplexAbs = 'ComplexAbs';\nexport type ComplexAbsInputs = UnaryInputs;\n\nexport const Concat = 'Concat';\nexport type ConcatInputs = TensorInfo[];\nexport interface ConcatAttrs {\n axis: number;\n}\n\nexport const Conv2D = 'Conv2D';\nexport type Conv2DInputs = Pick;\nexport interface Conv2DAttrs {\n strides: [number, number]|number;\n pad: 'valid'|'same'|number|ExplicitPadding;\n dataFormat: 'NHWC'|'NCHW';\n dilations: [number, number]|number;\n dimRoundingMode?: 'floor'|'round'|'ceil';\n}\n\nexport const Conv2DBackpropFilter = 'Conv2DBackpropFilter';\nexport type Conv2DBackpropFilterInputs = Pick;\nexport interface Conv2DBackpropFilterAttrs {\n strides: [number, number]|number;\n pad: 'valid'|'same'|number|ExplicitPadding;\n dataFormat: 'NHWC'|'NCHW';\n dimRoundingMode?: 'floor'|'round'|'ceil';\n filterShape: [number, number, number, number];\n}\n\nexport const Conv2DBackpropInput = 'Conv2DBackpropInput';\nexport type Conv2DBackpropInputInputs = Pick;\nexport interface Conv2DBackpropInputAttrs {\n strides: [number, number]|number;\n pad: 'valid'|'same'|number|ExplicitPadding;\n dataFormat: 'NHWC'|'NCHW';\n dimRoundingMode?: 'floor'|'round'|'ceil';\n inputShape: [number, number, number, number];\n}\n\nexport const Conv3D = 'Conv3D';\nexport type Conv3DInputs = Pick;\nexport interface Conv3DAttrs {\n strides: [number, number, number]|number;\n pad: 'valid'|'same';\n dataFormat: 'NDHWC'|'NCDHW';\n dilations: [number, number, number]|number;\n}\n\nexport const Conv3DBackpropFilterV2 = 'Conv3DBackpropFilterV2';\nexport type Conv3DBackpropFilterV2Inputs = Pick;\n\nexport interface Conv3DBackpropFilterV2Attrs {\n strides: [number, number, number]|number;\n pad: 'valid'|'same';\n filterShape: [number, number, number, number, number];\n}\n\nexport const Conv3DBackpropInputV2 = 'Conv3DBackpropInputV2';\nexport type Conv3DBackpropInputV2Inputs =\n Pick;\nexport interface Conv3DBackpropInputV2Attrs {\n strides: [number, number, number]|number;\n pad: 'valid'|'same';\n inputShape: [number, number, number, number, number];\n}\n\nexport const Cos = 'Cos';\nexport type CosInputs = UnaryInputs;\n\nexport const Cosh = 'Cosh';\nexport type CoshInputs = UnaryInputs;\n\nexport const Cumsum = 'Cumsum';\nexport type CumsumInputs = Pick;\nexport interface CumsumAttrs {\n axis: number;\n exclusive: boolean;\n reverse: boolean;\n}\n\nexport const CropAndResize = 'CropAndResize';\nexport type CropAndResizeInputs =\n Pick;\nexport interface CropAndResizeAttrs {\n cropSize: [number, number];\n method: 'bilinear'|'nearest';\n extrapolationValue: number;\n}\n\nexport const DenseBincount = 'DenseBincount';\nexport type DenseBincountInputs = Pick;\nexport interface DenseBincountAttrs {\n size: number;\n binaryOutput?: boolean;\n}\n\nexport const DepthToSpace = 'DepthToSpace';\nexport type DepthToSpaceInputs = Pick;\nexport interface DepthToSpaceAttrs {\n blockSize: number;\n dataFormat: 'NHWC'|'NCHW';\n}\n\nexport const DepthwiseConv2dNative = 'DepthwiseConv2dNative';\nexport type DepthwiseConv2dNativeInputs =\n Pick;\nexport interface DepthwiseConv2dNativeAttrs {\n strides: [number, number]|number;\n pad: 'valid'|'same'|number|ExplicitPadding;\n dataFormat: 'NHWC'|'NCHW';\n dilations: [number, number]|number;\n dimRoundingMode?: 'floor'|'round'|'ceil';\n}\n\nexport const DepthwiseConv2dNativeBackpropFilter =\n 'DepthwiseConv2dNativeBackpropFilter';\nexport type DepthwiseConv2dNativeBackpropFilterInputs =\n Pick;\nexport interface DepthwiseConv2dNativeBackpropFilterAttrs {\n strides: [number, number]|number;\n dilations: [number, number]|number;\n pad: 'valid'|'same'|number|ExplicitPadding;\n dimRoundingMode?: 'floor'|'round'|'ceil';\n filterShape: [number, number, number, number];\n}\n\nexport const DepthwiseConv2dNativeBackpropInput =\n 'DepthwiseConv2dNativeBackpropInput';\nexport type DepthwiseConv2dNativeBackpropInputInputs =\n Pick;\nexport interface DepthwiseConv2dNativeBackpropInputAttrs {\n strides: [number, number]|number;\n dilations: [number, number]|number;\n pad: 'valid'|'same'|number|ExplicitPadding;\n dimRoundingMode?: 'floor'|'round'|'ceil';\n inputShape: [number, number, number, number];\n}\n\nexport const Diag = 'Diag';\nexport type DiagInputs = Pick;\n\nexport const Dilation2D = 'Dilation2D';\nexport type Dilation2DInputs = Pick;\nexport interface Dilation2DAttrs {\n strides: [number, number]|number;\n pad: 'valid'|'same'|number;\n dilations: [number, number]|number;\n}\n\nexport const Dilation2DBackpropInput = 'Dilation2DBackpropInput';\nexport type Dilation2DBackpropInputInputs =\n Pick;\n\nexport const Dilation2DBackpropFilter = 'Dilation2DBackpropFilter';\nexport type Dilation2DBackpropFilterInputs =\n Pick;\n\nexport const RealDiv = 'RealDiv';\nexport type RealDivInputs = BinaryInputs;\n\nexport const Einsum = 'Einsum';\nexport type EinsumInputs = TensorInfo[];\nexport interface EinsumAttrs {\n equation: string;\n}\n\nexport const Elu = 'Elu';\nexport type EluInputs = Pick;\n\nexport const EluGrad = 'EluGrad';\nexport type EluGradInputs = Pick;\n\nexport const Erf = 'Erf';\nexport type ErfInputs = UnaryInputs;\n\nexport const Equal = 'Equal';\nexport type EqualInputs = BinaryInputs;\n\nexport const Exp = 'Exp';\nexport type ExpInputs = UnaryInputs;\n\nexport const ExpandDims = 'ExpandDims';\nexport type ExpandDimsInputs = Pick;\nexport interface ExpandDimsAttrs {\n dim: number;\n}\n\nexport const Expm1 = 'Expm1';\nexport type Expm1Inputs = UnaryInputs;\n\nexport const FFT = 'FFT';\nexport type FFTInputs = Pick;\n\nexport const Fill = 'Fill';\nexport interface FillAttrs {\n shape: number[];\n value: number|string;\n dtype: DataType;\n}\n\nexport const FlipLeftRight = 'FlipLeftRight';\nexport type FlipLeftRightInputs = Pick;\n\nexport const Floor = 'Floor';\nexport type FloorInputs = UnaryInputs;\n\nexport const FloorDiv = 'FloorDiv';\nexport type FloorDivInputs = BinaryInputs;\n\nexport const FusedBatchNorm = 'FusedBatchNorm';\nexport type FusedBatchNormInputs =\n Pick;\nexport interface FusedBatchNormAttrs {\n varianceEpsilon: number;\n}\n\nexport const GatherV2 = 'GatherV2';\nexport type GatherV2Inputs = Pick;\nexport interface GatherV2Attrs {\n axis: number;\n batchDims: number;\n}\n\nexport const GatherNd = 'GatherNd';\nexport type GatherNdInputs = Pick;\n\nexport const Greater = 'Greater';\nexport type GreaterInputs = BinaryInputs;\n\nexport const GreaterEqual = 'GreaterEqual';\nexport type GreaterEqualInputs = BinaryInputs;\n\nexport const Identity = 'Identity';\nexport type IdentityInputs = Pick;\n\nexport const IFFT = 'IFFT';\nexport type IFFTInputs = Pick;\n\nexport const Imag = 'Imag';\nexport type ImagInputs = Pick;\n\nexport const IsFinite = 'IsFinite';\nexport type IsFiniteInputs = UnaryInputs;\n\nexport const IsInf = 'IsInf';\nexport type IsInfInputs = UnaryInputs;\n\nexport const IsNan = 'IsNan';\nexport type IsNanInputs = UnaryInputs;\n\nexport const LeakyRelu = 'LeakyRelu';\nexport type LeakyReluInputs = Pick;\nexport interface LeakyReluAttrs {\n alpha: number;\n}\n\nexport const Less = 'Less';\nexport type LessInputs = BinaryInputs;\n\nexport const LessEqual = 'LessEqual';\nexport type LessEqualInputs = BinaryInputs;\n\nexport const LinSpace = 'LinSpace';\nexport interface LinSpaceAttrs {\n start: number;\n stop: number;\n num: number;\n}\nexport const Log = 'Log';\nexport type LogInputs = UnaryInputs;\n\nexport const Log1p = 'Log1p';\nexport type Log1pInputs = UnaryInputs;\n\nexport const LogicalAnd = 'LogicalAnd';\nexport type LogicalAndInputs = BinaryInputs;\n\nexport const LogicalNot = 'LogicalNot';\nexport type LogicalNotInputs = Pick;\n\nexport const LogicalOr = 'LogicalOr';\nexport type LogicalOrInputs = BinaryInputs;\n\nexport const LogSoftmax = 'LogSoftmax';\nexport type LogSoftmaxInputs = Pick;\nexport interface LogSoftmaxAttrs {\n axis: number;\n}\n\nexport const LRN = 'LRN';\nexport type LRNInputs = Pick;\nexport interface LRNAttrs {\n depthRadius: number;\n bias: number;\n alpha: number;\n beta: number;\n}\n\nexport const LRNGrad = 'LRNGrad';\nexport type LRNGradInputs = Pick;\nexport interface LRNGradAttrs {\n depthRadius: number;\n bias: number;\n alpha: number;\n beta: number;\n}\n\nexport const Max = 'Max';\nexport type MaxInputs = Pick;\nexport interface MaxAttrs {\n reductionIndices: number|number[];\n keepDims: boolean;\n}\n\nexport const Maximum = 'Maximum';\nexport type MaximumInputs = BinaryInputs;\n\nexport const MaxPool = 'MaxPool';\nexport type MaxPoolInputs = Pick;\nexport interface MaxPoolAttrs {\n filterSize: [number, number]|number;\n strides: [number, number]|number;\n pad: 'valid'|'same'|number;\n dimRoundingMode?: 'floor'|'round'|'ceil';\n}\n\nexport const MaxPoolGrad = 'MaxPoolGrad';\nexport type MaxPoolGradInputs = Pick;\nexport interface MaxPoolGradAttrs {\n filterSize: [number, number]|number;\n strides: [number, number]|number;\n pad: 'valid'|'same'|number;\n dimRoundingMode?: 'floor'|'round'|'ceil';\n}\n\nexport const MaxPool3D = 'MaxPool3D';\nexport type MaxPool3DInputs = Pick;\nexport interface MaxPool3DAttrs {\n filterSize: [number, number, number]|number;\n strides: [number, number, number]|number;\n pad: 'valid'|'same'|number;\n dataFormat: 'NDHWC'|'NCDHW';\n dimRoundingMode?: 'floor'|'round'|'ceil';\n}\n\nexport const MaxPool3DGrad = 'MaxPool3DGrad';\nexport type MaxPool3DGradInputs =\n Pick;\nexport interface MaxPool3DGradAttrs {\n filterSize: [number, number, number]|number;\n strides: [number, number, number]|number;\n pad: 'valid'|'same'|number;\n dimRoundingMode?: 'floor'|'round'|'ceil';\n}\n\nexport const MaxPoolWithArgmax = 'MaxPoolWithArgmax';\nexport type MaxPoolWithArgmaxInputs = Pick;\nexport interface MaxPoolWithArgmaxAttrs {\n filterSize: [number, number]|number;\n strides: [number, number]|number;\n pad: 'valid'|'same'|number;\n includeBatchInIndex: boolean;\n}\n\nexport const Mean = 'Mean';\nexport type MeanInputs = Pick;\nexport interface MeanAttrs {\n axis: number|number[];\n keepDims: boolean;\n}\n\nexport const Min = 'Min';\nexport type MinInputs = Pick;\nexport interface MinAttrs {\n axis: number|number[];\n keepDims: boolean;\n}\n\nexport const Minimum = 'Minimum';\nexport type MinimumInputs = BinaryInputs;\n\nexport const MirrorPad = 'MirrorPad';\nexport type MirrorPadInputs = Pick;\nexport interface MirrorPadAttrs {\n paddings: Array<[number, number]>;\n mode: 'reflect'|'symmetric';\n}\n\nexport const Mod = 'Mod';\nexport type ModInputs = BinaryInputs;\n\nexport const Multinomial = 'Multinomial';\nexport type MultinomialInputs = Pick;\nexport interface MultinomialAttrs {\n numSamples: number;\n seed: number;\n normalized: boolean;\n}\n\nexport const Multiply = 'Multiply';\nexport type MultiplyInputs = BinaryInputs;\n\nexport const Neg = 'Neg';\nexport type NegInputs = UnaryInputs;\n\nexport const NotEqual = 'NotEqual';\nexport type NotEqualInputs = BinaryInputs;\n\nexport const NonMaxSuppressionV3 = 'NonMaxSuppressionV3';\nexport type NonMaxSuppressionV3Inputs =\n Pick;\nexport interface NonMaxSuppressionV3Attrs {\n maxOutputSize: number;\n iouThreshold: number;\n scoreThreshold: number;\n}\n\nexport const NonMaxSuppressionV4 = 'NonMaxSuppressionV4';\nexport type NonMaxSuppressionV4Inputs =\n Pick;\nexport interface NonMaxSuppressionV4Attrs {\n maxOutputSize: number;\n iouThreshold: number;\n scoreThreshold: number;\n padToMaxOutputSize: boolean;\n}\n\nexport const NonMaxSuppressionV5 = 'NonMaxSuppressionV5';\nexport type NonMaxSuppressionV5Inputs =\n Pick;\nexport interface NonMaxSuppressionV5Attrs {\n maxOutputSize: number;\n iouThreshold: number;\n scoreThreshold: number;\n softNmsSigma: number;\n}\n\nexport const OnesLike = 'OnesLike';\nexport type OnesLikeInputs = UnaryInputs;\n\nexport const OneHot = 'OneHot';\nexport type OneHotInputs = Pick;\nexport interface OneHotAttrs {\n depth: number;\n onValue: number;\n offValue: number;\n}\n\nexport const Pack = 'Pack';\nexport type PackInputs = TensorInfo[];\nexport interface PackAttrs {\n axis: number;\n}\n\nexport const PadV2 = 'PadV2';\nexport type PadV2Inputs = Pick;\nexport interface PadV2Attrs {\n paddings: Array<[number, number]>;\n constantValue: number;\n}\n\nexport const Pool = 'Pool';\nexport type PoolInputs = Pick;\n\nexport const Pow = 'Pow';\nexport type PowInputs = BinaryInputs;\n\nexport const Prelu = 'Prelu';\nexport type PreluInputs = Pick;\n\nexport const Prod = 'Prod';\nexport type ProdInputs = Pick;\nexport interface ProdAttrs {\n axis: number|number[];\n keepDims: boolean;\n}\n\nexport const Range = 'Range';\nexport interface RangeAttrs {\n start: number;\n stop: number;\n step: number;\n dtype: 'float32'|'int32';\n}\n\nexport const Real = 'Real';\nexport type RealInputs = Pick;\n\nexport const Reciprocal = 'Reciprocal';\nexport type ReciprocalInputs = UnaryInputs;\n\nexport const Relu = 'Relu';\nexport type ReluInputs = Pick;\n\nexport const Reshape = 'Reshape';\nexport type ReshapeInputs = Pick;\nexport interface ReshapeAttrs {\n shape: number[];\n}\n\nexport const ResizeNearestNeighbor = 'ResizeNearestNeighbor';\nexport type ResizeNearestNeighborInputs = Pick;\nexport interface ResizeNearestNeighborAttrs {\n alignCorners: boolean;\n halfPixelCenters: boolean;\n size: [number, number];\n}\n\nexport const ResizeNearestNeighborGrad = 'ResizeNearestNeighborGrad';\nexport type ResizeNearestNeighborGradInputs =\n Pick;\nexport type ResizeNearestNeighborGradAttrs = ResizeNearestNeighborAttrs;\n\nexport const ResizeBilinear = 'ResizeBilinear';\nexport type ResizeBilinearInputs = Pick;\nexport interface ResizeBilinearAttrs {\n alignCorners: boolean;\n halfPixelCenters: boolean;\n size: [number, number];\n}\n\nexport const ResizeBilinearGrad = 'ResizeBilinearGrad';\nexport type ResizeBilinearGradInputs = Pick;\nexport type ResizeBilinearGradAttrs = ResizeBilinearAttrs;\n\nexport const Relu6 = 'Relu6';\nexport type Relu6Inputs = Pick;\n\nexport const Reverse = 'Reverse';\nexport type ReverseInputs = Pick;\nexport interface ReverseAttrs {\n dims: number|number[];\n}\n\nexport const Round = 'Round';\nexport type RoundInputs = UnaryInputs;\n\nexport const Rsqrt = 'Rsqrt';\nexport type RsqrtInputs = UnaryInputs;\n\nexport const ScatterNd = 'ScatterNd';\nexport type ScatterNdInputs = Pick;\nexport interface ScatterNdAttrs {\n shape: number[];\n}\n\nexport const Select = 'Select';\nexport type SelectInputs = Pick;\n\nexport const Selu = 'Selu';\nexport type SeluInputs = Pick;\n\nexport const Slice = 'Slice';\nexport type SliceInputs = Pick;\nexport interface SliceAttrs {\n begin: number|number[];\n size: number|number[];\n}\nexport const Sin = 'Sin';\nexport type SinInputs = UnaryInputs;\n\nexport const Sinh = 'Sinh';\nexport type SinhInputs = UnaryInputs;\n\nexport const Sign = 'Sign';\nexport type SignInputs = UnaryInputs;\n\nexport const Sigmoid = 'Sigmoid';\nexport type SigmoidInputs = UnaryInputs;\n\nexport const Softplus = 'Softplus';\nexport type SoftplusInputs = UnaryInputs;\n\nexport const Sqrt = 'Sqrt';\nexport type SqrtInputs = UnaryInputs;\n\nexport const Sum = 'Sum';\nexport type SumInputs = Pick;\nexport interface SumAttrs {\n axis: number|number[];\n keepDims: boolean;\n}\n\nexport const SpaceToBatchND = 'SpaceToBatchND';\nexport type SpaceToBatchNDInputs = Pick;\nexport interface SpaceToBatchNDAttrs {\n blockShape: number[];\n paddings: number[][];\n}\n\nexport const SplitV = 'SplitV';\nexport type SplitVInputs = Pick;\nexport interface SplitVAttrs {\n numOrSizeSplits: number[]|number;\n axis: number;\n}\n\nexport const Softmax = 'Softmax';\nexport type SoftmaxInputs = Pick;\nexport interface SoftmaxAttrs {\n dim: number;\n}\n\nexport const SparseFillEmptyRows = 'SparseFillEmptyRows';\nexport type SparseFillEmptyRowsInputs =\n Pick;\n\nexport const SparseReshape = 'SparseReshape';\nexport type SparseReshapeInputs =\n Pick;\n\nexport const SparseSegmentMean = 'SparseSegmentMean';\nexport type SparseSegmentMeanInputs =\n Pick;\n\nexport const SparseSegmentSum = 'SparseSegmentSum';\nexport type SparseSegmentSumInputs =\n Pick;\n\nexport const SparseToDense = 'SparseToDense';\nexport type SparseToDenseInputs =\n Pick;\nexport interface SparseToDenseAttrs {\n outputShape: number[];\n}\n\nexport const SquaredDifference = 'SquaredDifference';\nexport type SquaredDifferenceInputs = BinaryInputs;\n\nexport const Square = 'Square';\nexport type SquareInputs = Pick;\n\nexport const StridedSlice = 'StridedSlice';\nexport type StridedSliceInputs = Pick;\nexport interface StridedSliceAttrs {\n begin: number[];\n end: number[];\n strides: number[];\n beginMask: number;\n endMask: number;\n ellipsisMask: number;\n newAxisMask: number;\n shrinkAxisMask: number;\n}\n\nexport const StringNGrams = 'StringNGrams';\nexport type StringNGramsInputs = Pick;\nexport interface StringNGramsAttrs {\n separator: string;\n nGramWidths: number[];\n leftPad: string;\n rightPad: string;\n padWidth: number;\n preserveShortSequences: boolean;\n}\n\nexport const StringSplit = 'StringSplit';\nexport type StringSplitInputs = Pick;\nexport interface StringSplitAttrs {\n skipEmpty: boolean;\n}\n\nexport const StringToHashBucketFast = 'StringToHashBucketFast';\nexport type StringToHashBucketFastInputs = Pick;\nexport interface StringToHashBucketFastAttrs {\n numBuckets: number;\n}\n\nexport const Sub = 'Sub';\nexport type SubInputs = BinaryInputs;\n\nexport const Tan = 'Tan';\nexport type TanInputs = UnaryInputs;\n\nexport const Tanh = 'Tanh';\nexport type TanhInputs = UnaryInputs;\n\nexport const Tile = 'Tile';\nexport type TileInputs = Pick;\nexport interface TileAttrs {\n reps: number[];\n}\n\nexport const TopK = 'TopK';\nexport type TopKInputs = Pick;\nexport interface TopKAttrs {\n k: number;\n sorted: boolean;\n}\n\nexport const Transform = 'Transform';\nexport type TransformInputs = Pick;\nexport interface TransformAttrs {\n interpolation: 'nearest'|'bilinear';\n fillMode: 'constant'|'reflect'|'wrap'|'nearest';\n fillValue: number;\n outputShape?: [number, number];\n}\n\nexport const Transpose = 'Transpose';\nexport type TransposeInputs = Pick;\nexport interface TransposeAttrs {\n perm: number[];\n}\n\nexport const Unique = 'Unique';\nexport type UniqueInputs = Pick;\nexport interface UniqueAttrs {\n axis: number;\n}\n\nexport type UnaryInputs = Pick;\n\nexport const Unpack = 'Unpack';\nexport type UnpackInputs = Pick;\nexport interface UnpackAttrs {\n axis: number;\n}\n\nexport const UnsortedSegmentSum = 'UnsortedSegmentSum';\nexport type UnsortedSegmentSumInputs =\n Pick;\nexport interface UnsortedSegmentSumAttrs {\n numSegments: number;\n}\n\nexport const ZerosLike = 'ZerosLike';\nexport type ZerosLikeInputs = UnaryInputs;\n\n/**\n * TensorFlow.js-only kernels\n */\nexport const Step = 'Step';\nexport type StepInputs = UnaryInputs;\nexport interface StepAttrs {\n alpha: number;\n}\n\nexport const FromPixels = 'FromPixels';\nexport interface FromPixelsInputs {\n pixels: PixelData|ImageData|HTMLImageElement|HTMLCanvasElement|\n HTMLVideoElement|ImageBitmap;\n}\nexport interface FromPixelsAttrs {\n numChannels: number;\n}\n\nexport const RotateWithOffset = 'RotateWithOffset';\nexport type RotateWithOffsetInputs = Pick;\nexport interface RotateWithOffsetAttrs {\n radians: number;\n fillValue: number|[number, number, number];\n center: number|[number, number];\n}\n\nexport const _FusedMatMul = '_FusedMatMul';\n// tslint:disable-next-line: class-name\nexport interface _FusedMatMulInputs extends NamedTensorInfoMap {\n a: TensorInfo;\n b: TensorInfo;\n bias?: TensorInfo;\n preluActivationWeights?: TensorInfo;\n}\n// tslint:disable-next-line: class-name\nexport interface _FusedMatMulAttrs {\n transposeA: boolean;\n transposeB: boolean;\n activation: Activation;\n leakyreluAlpha?: number;\n}\n\nexport const FusedConv2D = 'FusedConv2D';\nexport interface FusedConv2DInputs extends NamedTensorInfoMap {\n x: TensorInfo;\n filter: TensorInfo;\n bias?: TensorInfo;\n preluActivationWeights?: TensorInfo;\n}\nexport interface FusedConv2DAttrs {\n strides: [number, number]|number;\n pad: 'valid'|'same'|number|ExplicitPadding;\n dataFormat: 'NHWC'|'NCHW';\n dilations: [number, number]|number;\n dimRoundingMode: 'floor'|'round'|'ceil';\n activation: Activation;\n leakyreluAlpha?: number;\n}\n\nexport const FusedDepthwiseConv2D = 'FusedDepthwiseConv2D';\nexport interface FusedDepthwiseConv2DInputs extends NamedTensorInfoMap {\n x: TensorInfo;\n filter: TensorInfo;\n bias?: TensorInfo;\n preluActivationWeights?: TensorInfo;\n}\nexport interface FusedDepthwiseConv2DAttrs {\n strides: [number, number]|number;\n pad: 'valid'|'same'|number|ExplicitPadding;\n dataFormat: 'NHWC'|'NCHW';\n dilations: [number, number]|number;\n dimRoundingMode: 'floor'|'round'|'ceil';\n activation: Activation;\n leakyreluAlpha?: number;\n}\n", "/**\n * @license\n * Copyright 2019 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\nimport {env} from './environment';\n\nimport {getGlobal} from './global_util';\nimport {NamedGradientMap} from './tape';\nimport {Tensor} from './tensor';\nimport {DataType, RecursiveArray} from './types';\n\nconst kernelRegistry =\n getGlobal('kernelRegistry', () => new Map());\nconst gradRegistry =\n getGlobal('gradRegistry', () => new Map());\n\nexport type DataId = object;\n\ntype AttributeValue =\n number|number[]|boolean|boolean[]|string|string[]|NamedAttrMap;\n\n/** These are extra non-tensor/primitive params passed to kernel functions. */\nexport type Attribute = AttributeValue|RecursiveArray;\n\n/** Specifies the code to run when executing a kernel. */\nexport type KernelFunc = (params: {\n inputs: NamedTensorInfoMap,\n backend: {},\n attrs?: NamedAttrMap,\n}) => TensorInfo|TensorInfo[];\n\n/** The function to run when computing a gradient during backprop. */\nexport type GradFunc =\n (dy: Tensor|Tensor[], saved: Tensor[], attrs: NamedAttrMap) =>\n NamedGradientMap;\n\n/** Function that gets called after the backend initializes. */\nexport type KernelSetupFunc = (backend: {}) => void;\n/** Function that gets called right before the backend is disposed. */\nexport type KernelDisposeFunc = KernelSetupFunc;\n\n/** Config object for registering a kernel in the global registry. */\nexport interface KernelConfig {\n kernelName: string;\n backendName: string;\n kernelFunc: KernelFunc;\n setupFunc?: KernelSetupFunc;\n disposeFunc?: KernelDisposeFunc;\n}\n\n/** Config object for registering a gradient in the global registry. */\nexport interface GradConfig {\n kernelName: string;\n inputsToSave?: string[];\n // When saveAllInputs is true, all inputs will be saved. Only use this flag\n // if inputs is an array of Tensors.\n saveAllInputs?: boolean;\n outputsToSave?: boolean[];\n gradFunc: GradFunc;\n}\n\n/** Holds metadata for a given tensor. */\nexport interface TensorInfo {\n dataId: DataId;\n shape: number[];\n dtype: DataType;\n}\n\nexport interface NamedTensorInfoMap {\n [name: string]: TensorInfo;\n}\n\nexport interface NamedAttrMap {\n [name: string]: Attribute;\n}\n\n/**\n * Returns the kernel function (code) associated with the provided names.\n *\n * @param kernelName The official name of the kernel.\n * @param backendName The official name of the backend.\n */\nexport function getKernel(\n kernelName: string, backendName: string): KernelConfig {\n const key = makeKey(kernelName, backendName);\n return kernelRegistry.get(key);\n}\n\n/**\n * Returns the registered gradient info associated with the provided kernel.\n * @param kernelName The official TF kernel name.\n */\nexport function getGradient(kernelName: string): GradConfig {\n return gradRegistry.get(kernelName);\n}\n\nexport function getKernelsForBackend(backendName: string): KernelConfig[] {\n const it = kernelRegistry.entries();\n const result: KernelConfig[] = [];\n\n while (true) {\n const {done, value} = it.next();\n if (done) {\n break;\n }\n const [key, config] = value;\n const [backend, ] = key.split('_');\n if (backend === backendName) {\n result.push(config);\n }\n }\n return result;\n}\n\n/**\n * Registers the function (forward pass) for the kernel in a global registry.\n *\n * @param config A config object with the following properties:\n * - `kernelName` The official name of the kernel.\n * - `backendName` The official name of the backend.\n * - `kernelFunc` The function to run during the forward pass of the kernel.\n * - `setupFunc` Optional. Gets called once, after the backend initializes.\n * - `disposeFunc` Optional. Gets called once, right before the backend is\n * disposed.\n */\nexport function registerKernel(config: KernelConfig) {\n const {kernelName, backendName} = config;\n const key = makeKey(kernelName, backendName);\n if (kernelRegistry.has(key)) {\n console.warn(\n `The kernel '${kernelName}' for backend ` +\n `'${backendName}' is already registered`);\n }\n kernelRegistry.set(key, config);\n}\n\n/**\n * Registers a gradient function for a given kernel in the global registry,\n * to be used during the back-propagation of that kernel.\n *\n * @param config An object with the following properties:\n * - `kernelName` The name of the kernel that the gradient function is for.\n * - `gradFunc` The function to run during back-propagation.\n */\nexport function registerGradient(config: GradConfig) {\n const {kernelName} = config;\n\n if (gradRegistry.has(kernelName)) {\n // TODO (yassogba) after 3.0 assess whether we need to keep this gated\n // to debug mode.\n if (env().getBool('DEBUG')) {\n console.warn(`Overriding the gradient for '${kernelName}'`);\n }\n }\n gradRegistry.set(kernelName, config);\n}\n\n/**\n * Removes the kernel function from the registry.\n *\n * @param kernelName The official name of the kernel.\n * @param backendName The official name of the backend.\n *\n */\nexport function unregisterKernel(\n kernelName: string, backendName: string): void {\n const key = makeKey(kernelName, backendName);\n if (!kernelRegistry.has(key)) {\n throw new Error(\n `The kernel '${kernelName}' for backend ` +\n `'${backendName}' is not registered`);\n }\n kernelRegistry.delete(key);\n}\n\n/** Removes the registered gradient from the global registry. */\nexport function unregisterGradient(kernelName: string): void {\n if (!gradRegistry.has(kernelName)) {\n throw new Error(\n `The gradient '${kernelName}' for backend is not registered`);\n }\n gradRegistry.delete(kernelName);\n}\n\n/**\n * Finds kernels that have already been registered to a backend and re-registers\n * them for a new backend. Useful for registering custom backends.\n * @param registeredBackendName Already registered backend.\n * @param newBackendName New backend.\n */\nexport function copyRegisteredKernels(\n registeredBackendName: string, newBackendName: string): void {\n const kernels = getKernelsForBackend(registeredBackendName);\n kernels.forEach(kernelConfig => {\n const newKernelConfig =\n Object.assign({}, kernelConfig, {backendName: newBackendName});\n registerKernel(newKernelConfig);\n });\n}\n\nfunction makeKey(kernelName: string, backendName: string) {\n return `${backendName}_${kernelName}`;\n}\n", "/**\n * @license\n * Copyright 2017 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {env} from './environment';\nimport {BackendValues, DataType, TensorLike, TypedArray} from './types';\nimport * as base from './util_base';\nexport * from './util_base';\nexport * from './hash_util';\n\n/**\n * Create typed array for scalar value. Used for storing in `DataStorage`.\n */\nexport function createScalarValue(\n value: DataType, dtype: DataType): BackendValues {\n if (dtype === 'string') {\n return encodeString(value);\n }\n\n return toTypedArray([value], dtype);\n}\n\nfunction noConversionNeeded(a: TensorLike, dtype: DataType): boolean {\n return (a instanceof Float32Array && dtype === 'float32') ||\n (a instanceof Int32Array && dtype === 'int32') ||\n (a instanceof Uint8Array && dtype === 'bool');\n}\n\nexport function toTypedArray(a: TensorLike, dtype: DataType): TypedArray {\n if (dtype === 'string') {\n throw new Error('Cannot convert a string[] to a TypedArray');\n }\n if (Array.isArray(a)) {\n a = base.flatten(a);\n }\n\n if (env().getBool('DEBUG')) {\n base.checkConversionForErrors(a as number[], dtype);\n }\n if (noConversionNeeded(a, dtype)) {\n return a as TypedArray;\n }\n if (dtype == null || dtype === 'float32' || dtype === 'complex64') {\n return new Float32Array(a as number[]);\n } else if (dtype === 'int32') {\n return new Int32Array(a as number[]);\n } else if (dtype === 'bool') {\n const bool = new Uint8Array((a as number[]).length);\n for (let i = 0; i < bool.length; ++i) {\n if (Math.round((a as number[])[i]) !== 0) {\n bool[i] = 1;\n }\n }\n return bool;\n } else {\n throw new Error(`Unknown data type ${dtype}`);\n }\n}\n\n/**\n * Returns the current high-resolution time in milliseconds relative to an\n * arbitrary time in the past. It works across different platforms (node.js,\n * browsers).\n *\n * ```js\n * console.log(tf.util.now());\n * ```\n *\n * @doc {heading: 'Util', namespace: 'util'}\n */\nexport function now(): number {\n return env().platform.now();\n}\n\n/**\n * Returns a platform-specific implementation of\n * [`fetch`](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API).\n *\n * If `fetch` is defined on the global object (`window`, `process`, etc.),\n * `tf.util.fetch` returns that function.\n *\n * If not, `tf.util.fetch` returns a platform-specific solution.\n *\n * ```js\n * const resource = await tf.util.fetch('https://unpkg.com/@tensorflow/tfjs');\n * // handle response\n * ```\n *\n * @doc {heading: 'Util'}\n */\nexport function fetch(\n path: string, requestInits?: RequestInit): Promise {\n return env().platform.fetch(path, requestInits);\n}\n\n/**\n * Encodes the provided string into bytes using the provided encoding scheme.\n *\n * @param s The string to encode.\n * @param encoding The encoding scheme. Defaults to utf-8.\n *\n * @doc {heading: 'Util'}\n */\nexport function encodeString(s: string, encoding = 'utf-8'): Uint8Array {\n encoding = encoding || 'utf-8';\n return env().platform.encode(s, encoding);\n}\n\n/**\n * Decodes the provided bytes into a string using the provided encoding scheme.\n * @param bytes The bytes to decode.\n *\n * @param encoding The encoding scheme. Defaults to utf-8.\n *\n * @doc {heading: 'Util'}\n */\nexport function decodeString(bytes: Uint8Array, encoding = 'utf-8'): string {\n encoding = encoding || 'utf-8';\n return env().platform.decode(bytes, encoding);\n}\n", "/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n// Workaround for allowing cjs module to be included in bundle created by\n// rollup.\nimport * as LongExports from 'long';\n// tslint:disable-next-line\nconst Long: LongExports.LongConstructor =\n // tslint:disable-next-line\n (LongExports as any).default || LongExports;\n\nexport function hexToLong(hex: string): Long {\n return Long.fromString(hex, true, 16);\n}\n\n// Some primes between 2^63 and 2^64 for various uses.\n// Hex 0xc3a5c85c97cb3127\nconst k0: Long = hexToLong('c3a5c85c97cb3127');\n// Hex 0xb492b66fbe98f273\nconst k1: Long = hexToLong('b492b66fbe98f273');\n// Hex 0x9ae16a3b2f90404f\nconst k2: Long = hexToLong('9ae16a3b2f90404f');\n\nfunction shiftMix(val: Long): Long {\n return val.xor(val.shru(47));\n}\n\nfunction fetch(s: Uint8Array, offset: number, numBytes: number): Long {\n const bytes = s.slice(offset, offset + numBytes);\n return Long.fromBytes(Array.from(bytes), true, true);\n}\n\nfunction fetch64(s: Uint8Array, offset: number): Long {\n return fetch(s, offset, 8);\n}\n\nfunction fetch32(s: Uint8Array, offset: number): Long {\n return fetch(s, offset, 4);\n}\n\nfunction rotate64(val: Long, shift: number): Long {\n // Avoid shifting by 64: doing so yields an undefined result.\n return shift === 0 ? val : val.shru(shift).or(val.shl(64 - shift));\n}\n\nfunction hashLen16(u: Long, v: Long, mul = hexToLong('9ddfea08eb382d69')) {\n // Murmur-inspired hashing.\n let a = u.xor(v).mul(mul);\n a = a.xor(a.shru(47));\n let b = v.xor(a).mul(mul);\n b = b.xor(b.shru(47));\n b = b.mul(mul);\n return b;\n}\n\n// Return a 16-byte hash for 48 bytes. Quick and dirty.\n// Callers do best to use \"random-looking\" values for a and b.\nfunction weakHashLen32WithSeeds(\n w: Long, x: Long, y: Long, z: Long, a: Long, b: Long) {\n a = a.add(w);\n b = rotate64(b.add(a).add(z), 21);\n const c = a;\n a = a.add(x);\n a = a.add(y);\n b = b.add(rotate64(a, 44));\n return [a.add(z), b.add(c)];\n}\n\nfunction weakHashLen32WithSeedsStr(\n s: Uint8Array, offset: number, a: Long, b: Long) {\n return weakHashLen32WithSeeds(\n fetch64(s, offset), fetch64(s, offset + 8), fetch64(s, offset + 16),\n fetch64(s, offset + 24), a, b);\n}\n\nfunction hashLen0to16(s: Uint8Array, len = s.length): Long {\n if (len >= 8) {\n const mul = k2.add(len * 2);\n const a = fetch64(s, 0).add(k2);\n const b = fetch64(s, len - 8);\n const c = rotate64(b, 37).mul(mul).add(a);\n const d = rotate64(a, 25).add(b).mul(mul);\n return hashLen16(c, d, mul);\n }\n if (len >= 4) {\n const mul = k2.add(len * 2);\n const a = fetch32(s, 0);\n return hashLen16(a.shl(3).add(len), fetch32(s, len - 4), mul);\n }\n if (len > 0) {\n const a = s[0];\n const b = s[len >> 1];\n const c = s[len - 1];\n const y = a + (b << 8);\n const z = len + (c << 2);\n return shiftMix(k2.mul(y).xor(k0.mul(z))).mul(k2);\n }\n return k2;\n}\n\nfunction hashLen17to32(s: Uint8Array, len = s.length): Long {\n const mul = k2.add(len * 2);\n const a = fetch64(s, 0).mul(k1);\n const b = fetch64(s, 8);\n const c = fetch64(s, len - 8).mul(mul);\n const d = fetch64(s, len - 16).mul(k2);\n return hashLen16(\n rotate64(a.add(b), 43).add(rotate64(c, 30)).add(d),\n a.add(rotate64(b.add(k2), 18)).add(c), mul);\n}\n\nfunction hashLen33to64(s: Uint8Array, len = s.length): Long {\n const mul = k2.add(len * 2);\n const a = fetch64(s, 0).mul(k2);\n const b = fetch64(s, 8);\n const c = fetch64(s, len - 8).mul(mul);\n const d = fetch64(s, len - 16).mul(k2);\n const y = rotate64(a.add(b), 43).add(rotate64(c, 30)).add(d);\n const z = hashLen16(y, a.add(rotate64(b.add(k2), 18)).add(c), mul);\n const e = fetch64(s, 16).mul(mul);\n const f = fetch64(s, 24);\n const g = y.add(fetch64(s, len - 32)).mul(mul);\n const h = z.add(fetch64(s, len - 24)).mul(mul);\n return hashLen16(\n rotate64(e.add(f), 43).add(rotate64(g, 30)).add(h),\n e.add(rotate64(f.add(a), 18)).add(g), mul);\n}\n\nexport function fingerPrint64(s: Uint8Array, len = s.length): Long {\n const seed: Long = Long.fromNumber(81, true);\n if (len <= 32) {\n if (len <= 16) {\n return hashLen0to16(s, len);\n } else {\n return hashLen17to32(s, len);\n }\n } else if (len <= 64) {\n return hashLen33to64(s, len);\n }\n\n // For strings over 64 bytes we loop. Internal state consists of\n // 56 bytes: v, w, x, y, and z.\n let x = seed;\n let y = seed.mul(k1).add(113);\n\n let z = shiftMix(y.mul(k2).add(113)).mul(k2);\n let v = [Long.UZERO, Long.UZERO];\n let w = [Long.UZERO, Long.UZERO];\n x = x.mul(k2).add(fetch64(s, 0));\n\n let offset = 0;\n // Set end so that after the loop we have 1 to 64 bytes left to process.\n const end = ((len - 1) >> 6) * 64;\n const last64 = end + ((len - 1) & 63) - 63;\n\n do {\n x = rotate64(x.add(y).add(v[0]).add(fetch64(s, offset + 8)), 37).mul(k1);\n y = rotate64(y.add(v[1]).add(fetch64(s, offset + 48)), 42).mul(k1);\n x = x.xor(w[1]);\n y = y.add(v[0]).add(fetch64(s, offset + 40));\n z = rotate64(z.add(w[0]), 33).mul(k1);\n v = weakHashLen32WithSeedsStr(s, offset, v[1].mul(k1), x.add(w[0]));\n w = weakHashLen32WithSeedsStr(\n s, offset + 32, z.add(w[1]), y.add(fetch64(s, offset + 16)));\n\n [z, x] = [x, z];\n offset += 64;\n } while (offset !== end);\n const mul = k1.add(z.and(0xff).shl(1));\n // Point to the last 64 bytes of input.\n offset = last64;\n\n w[0] = w[0].add((len - 1) & 63);\n v[0] = v[0].add(w[0]);\n w[0] = w[0].add(v[0]);\n\n x = rotate64(x.add(y).add(v[0]).add(fetch64(s, offset + 8)), 37).mul(mul);\n y = rotate64(y.add(v[1]).add(fetch64(s, offset + 48)), 42).mul(mul);\n x = x.xor(w[1].mul(9));\n y = y.add(v[0].mul(9).add(fetch64(s, offset + 40)));\n z = rotate64(z.add(w[0]), 33).mul(mul);\n v = weakHashLen32WithSeedsStr(s, offset, v[1].mul(mul), x.add(w[0]));\n w = weakHashLen32WithSeedsStr(\n s, offset + 32, z.add(w[1]), y.add(fetch64(s, offset + 16)));\n\n [z, x] = [x, z];\n\n return hashLen16(\n hashLen16(v[0], w[0], mul).add(shiftMix(y).mul(k0)).add(z),\n hashLen16(v[1], w[1], mul).add(x), mul);\n}\n", "/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {BackendTimer, BackendTimingInfo} from './backends/backend';\nimport {env} from './environment';\nimport {Tensor} from './tensor';\nimport {NamedTensorMap} from './tensor_types';\nimport {DataType, DataTypeMap, TypedArray} from './types';\nimport * as util from './util';\n\nexport type KernelProfile = {\n kernelName: string,\n outputs: Tensor[],\n inputs: NamedTensorMap,\n timeMs: Promise,\n extraInfo: Promise\n};\n\nexport class Profiler {\n constructor(private backendTimer: BackendTimer, private logger?: Logger) {\n if (logger == null) {\n this.logger = new Logger();\n }\n }\n\n profileKernel(kernelName: string, inputs: NamedTensorMap, f: () => Tensor[]):\n KernelProfile {\n let outputs: Tensor[];\n const holdResultWrapperFn = () => {\n outputs = f();\n };\n let timer: Promise;\n const start = util.now();\n if (this.backendTimer.timerAvailable()) {\n timer = this.backendTimer.time(holdResultWrapperFn);\n } else {\n holdResultWrapperFn();\n for (const output of outputs) {\n output.dataSync();\n }\n timer = Promise.resolve({kernelMs: util.now() - start});\n }\n if (env().getBool('CHECK_COMPUTATION_FOR_ERRORS')) {\n for (let i = 0; i < outputs.length; i++) {\n const output = outputs[i];\n // Dangling promise here because we don't want to propagate up\n // asynchronicity.\n output.data().then(tensorVals => {\n checkComputationForErrors(tensorVals, output.dtype, kernelName);\n });\n }\n }\n\n const kernelProfile = {\n kernelName,\n outputs,\n inputs,\n timeMs: timer.then(timing => timing.kernelMs),\n extraInfo: timer.then(\n timing => timing.getExtraProfileInfo != null ?\n timing.getExtraProfileInfo() :\n '')\n };\n return kernelProfile;\n }\n\n logKernelProfile(kernelProfile: KernelProfile): void {\n const {kernelName, outputs, timeMs, inputs, extraInfo} = kernelProfile;\n\n outputs.forEach(result => {\n Promise.all([result.data(), timeMs, extraInfo]).then(valueContainer => {\n this.logger.logKernelProfile(\n kernelName, result, valueContainer[0], valueContainer[1], inputs,\n valueContainer[2]);\n });\n });\n }\n}\n\nexport function checkComputationForErrors(\n vals: DataTypeMap[D], dtype: D, kernelName: string): boolean {\n if (dtype !== 'float32') {\n // Only floating point computations will generate NaN values\n return false;\n }\n for (let i = 0; i < vals.length; i++) {\n const num = vals[i] as number;\n if (isNaN(num) || !isFinite(num)) {\n // Throwing custom exception so behavior is testable.\n console.warn(`Found ${num} in the result of '${kernelName}'`);\n return true;\n }\n }\n return false;\n}\n\nexport class Logger {\n logKernelProfile(\n name: string, result: Tensor, vals: TypedArray,\n timeMs: number|{error: string}, inputs: NamedTensorMap,\n extraInfo?: string) {\n const time = typeof timeMs === 'number' ? util.rightPad(`${timeMs}ms`, 9) :\n timeMs['error'];\n const paddedName = util.rightPad(name, 25);\n const rank = result.rank;\n const size = result.size;\n const shape = util.rightPad(result.shape.toString(), 14);\n let inputShapesDescription = '';\n\n for (const name in inputs) {\n const input = inputs[name];\n if (input != null) {\n // The input might be a non-tensor (e.g HTMLImageElement), in which case\n // we claim the output shape as input shape.\n const inputShape = input.shape || result.shape;\n const inputRank = inputShape.length;\n inputShapesDescription +=\n `${name}: ${inputRank}D ${inputRank > 0 ? inputShape : ''} `;\n }\n }\n\n console.log(\n `%c${paddedName}\\t%c${time}\\t%c${rank}D ${shape}\\t%c${size}\\t%c${\n inputShapesDescription}\\t%c${extraInfo}`,\n 'font-weight:bold', 'color:red', 'color:blue', 'color: orange',\n 'color: green', 'color: steelblue');\n }\n}\n", "/**\n * @license\n * Copyright 2017 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {Tensor} from './tensor';\nimport {NamedTensorMap} from './tensor_types';\nimport * as util from './util';\n\nexport interface TapeNode {\n id: number;\n kernelName: string;\n outputs: Tensor[];\n inputs: NamedTensorMap;\n // Optional params, defined only for ops with gradient impl.\n gradient?: (dys: Tensor[]) => NamedGradientMap;\n saved?: Tensor[];\n}\n\nexport type NamedGradientMap = {\n [inputName: string]: () => Tensor;\n};\n\n/**\n * Computes a list of TapeNodes that connect x to y, filtering everything else\n * out and preserving the order of the original tape elements.\n *\n * @param tape The tape elements to filter.\n * @param xs The input Tensors.\n * @param y The output Tensor.\n */\nexport function getFilteredNodesXToY(\n tape: TapeNode[], xs: Tensor[], y: Tensor): TapeNode[] {\n // Forward pass to compute all the nodes and Tensors that are transitively a\n // function of x.\n const tensorsFromX: {[tensorId: number]: boolean} = {};\n const nodesFromX: {[nodeId: number]: boolean} = {};\n for (let i = 0; i < xs.length; i++) {\n tensorsFromX[xs[i].id] = true;\n }\n\n for (let i = 0; i < tape.length; i++) {\n const node = tape[i];\n const nodeInputs = node.inputs;\n for (const inputName in nodeInputs) {\n const input = nodeInputs[inputName];\n\n let anyInputFromX = false;\n for (let j = 0; j < xs.length; j++) {\n if (tensorsFromX[input.id]) {\n node.outputs.forEach(output => tensorsFromX[output.id] = true);\n anyInputFromX = true;\n nodesFromX[node.id] = true;\n break;\n }\n }\n\n if (anyInputFromX) {\n break;\n }\n }\n }\n\n // Backward pass to find all of the nodes and Tensors that lead to y.\n const tensorsLeadToY: {[tensorId: number]: boolean} = {};\n tensorsLeadToY[y.id] = true;\n const nodesToY: {[nodeId: number]: boolean} = {};\n\n for (let i = tape.length - 1; i >= 0; i--) {\n const node = tape[i];\n const nodeInputs = node.inputs;\n\n // If any of the outputs lead to y, mark all of the inputs as leading to y.\n for (let j = 0; j < node.outputs.length; j++) {\n if (tensorsLeadToY[node.outputs[j].id]) {\n for (const inputName in nodeInputs) {\n tensorsLeadToY[nodeInputs[inputName].id] = true;\n nodesToY[node.id] = true;\n }\n break;\n }\n }\n }\n\n // Return the paths that come from x and lead to y.\n const filteredTape: TapeNode[] = [];\n for (let i = 0; i < tape.length; i++) {\n const node = tape[i];\n\n if (nodesFromX[node.id] && nodesToY[node.id]) {\n // Prune the inputs from the node that aren't a function of x.\n const prunedInputs: {[inputName: string]: Tensor} = {};\n for (const inputName in node.inputs) {\n const nodeInput = node.inputs[inputName];\n if (tensorsFromX[nodeInput.id]) {\n prunedInputs[inputName] = nodeInput;\n }\n }\n\n // Copy the node and overwrite inputsAndArgs to the pruned version.\n const prunedNode = Object.assign({}, node);\n prunedNode.inputs = prunedInputs;\n prunedNode.outputs = node.outputs;\n\n filteredTape.push(prunedNode);\n }\n }\n\n return filteredTape;\n}\n\n/**\n * Backpropagate gradients through the filtered TapeNodes.\n *\n * @param tensorAccumulatedGradientMap A map of Tensor to its gradient. This map\n * is mutated by this method.\n * @param filteredTape The filtered TapeNodes to backprop through.\n */\nexport function backpropagateGradients(\n tensorAccumulatedGradientMap: {[tensorId: number]: Tensor},\n filteredTape: TapeNode[], tidy: (f: Function) => Tensor,\n add: (a: Tensor, b: Tensor) => Tensor) {\n // Walk the tape backward and keep a map of Tensor to its gradient.\n for (let i = filteredTape.length - 1; i >= 0; i--) {\n const node = filteredTape[i];\n\n const dys: Tensor[] = [];\n node.outputs.forEach(o => {\n const gradTensor = tensorAccumulatedGradientMap[o.id];\n if (gradTensor != null) {\n dys.push(gradTensor);\n } else {\n // This particular output is not in the back-propagation subgraph, so it\n // does not affect the final output, thus we put null for its dy.\n dys.push(null);\n }\n });\n\n if (node.gradient == null) {\n throw new Error(\n `Cannot compute gradient: gradient function not found ` +\n `for ${node.kernelName}.`);\n }\n\n // Backprop dy through this node and accumulate gradients over the inputs.\n const inputGradients = node.gradient(dys);\n\n for (const inputName in node.inputs) {\n if (!(inputName in inputGradients)) {\n throw new Error(\n `Cannot backprop through input ${inputName}. ` +\n `Available gradients found: ${Object.keys(inputGradients)}.`);\n }\n\n // Call the gradient function.\n const dx = tidy(() => inputGradients[inputName]());\n if (dx.dtype !== 'float32') {\n throw new Error(\n `Error in gradient for op ${\n node.kernelName}. The gradient of input ` +\n `${inputName} must have 'float32' dtype, but has '${dx.dtype}'`);\n }\n const x = node.inputs[inputName];\n if (!util.arraysEqual(dx.shape, x.shape)) {\n throw new Error(\n `Error in gradient for op ${\n node.kernelName}. The gradient of input ` +\n `'${inputName}' has shape '${dx.shape}', which does not match ` +\n `the shape of the input '${x.shape}'`);\n }\n\n if (tensorAccumulatedGradientMap[x.id] == null) {\n tensorAccumulatedGradientMap[x.id] = dx;\n } else {\n const curGradient = tensorAccumulatedGradientMap[x.id];\n tensorAccumulatedGradientMap[x.id] = add(curGradient, dx);\n curGradient.dispose();\n }\n }\n }\n}\n", "/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {DataType, TypedArray} from './types';\nimport {computeStrides, isString, rightPad, sizeFromShape} from './util';\n\n// Maximum number of values before we decide to show ellipsis.\nconst FORMAT_LIMIT_NUM_VALS = 20;\n// Number of first and last values to show when displaying a, b,...,y, z.\nconst FORMAT_NUM_FIRST_LAST_VALS = 3;\n// Number of significant digits to show.\nconst FORMAT_NUM_SIG_DIGITS = 7;\n\nexport function tensorToString(\n vals: TypedArray|string[], shape: number[], dtype: DataType,\n verbose: boolean) {\n const strides = computeStrides(shape);\n const padPerCol = computeMaxSizePerColumn(vals, shape, dtype, strides);\n const rank = shape.length;\n const valsLines = subTensorToString(vals, shape, dtype, strides, padPerCol);\n const lines = ['Tensor'];\n if (verbose) {\n lines.push(` dtype: ${dtype}`);\n lines.push(` rank: ${rank}`);\n lines.push(` shape: [${shape}]`);\n lines.push(` values:`);\n }\n lines.push(valsLines.map(l => ' ' + l).join('\\n'));\n return lines.join('\\n');\n}\n\nfunction computeMaxSizePerColumn(\n vals: TypedArray|string[], shape: number[], dtype: DataType,\n strides: number[]): number[] {\n const n = sizeFromShape(shape);\n const numCols = strides[strides.length - 1];\n const padPerCol = new Array(numCols).fill(0);\n const rank = shape.length;\n const valuesOrTuples =\n dtype === 'complex64' ? createComplexTuples(vals) : vals;\n\n if (rank > 1) {\n for (let row = 0; row < n / numCols; row++) {\n const offset = row * numCols;\n for (let j = 0; j < numCols; j++) {\n padPerCol[j] = Math.max(\n padPerCol[j],\n valToString(valuesOrTuples[offset + j], 0, dtype).length);\n }\n }\n }\n return padPerCol;\n}\n\nfunction valToString(\n val: number|string|[number, number], pad: number, dtype: DataType) {\n let valStr: string;\n if (Array.isArray(val)) {\n valStr = `${parseFloat(val[0].toFixed(FORMAT_NUM_SIG_DIGITS))} + ` +\n `${parseFloat(val[1].toFixed(FORMAT_NUM_SIG_DIGITS))}j`;\n } else if (isString(val)) {\n valStr = `'${val}'`;\n } else if (dtype === 'bool') {\n valStr = boolNumToString(val);\n } else {\n valStr = parseFloat(val.toFixed(FORMAT_NUM_SIG_DIGITS)).toString();\n }\n\n return rightPad(valStr, pad);\n}\n\nfunction boolNumToString(v: number): string {\n return v === 0 ? 'false' : 'true';\n}\n\nfunction subTensorToString(\n vals: TypedArray|string[], shape: number[], dtype: DataType,\n strides: number[], padPerCol: number[], isLast = true): string[] {\n const storagePerElement = dtype === 'complex64' ? 2 : 1;\n\n const size = shape[0];\n const rank = shape.length;\n if (rank === 0) {\n if (dtype === 'complex64') {\n const complexTuple = createComplexTuples(vals);\n return [valToString(complexTuple[0], 0, dtype)];\n }\n if (dtype === 'bool') {\n return [boolNumToString(vals[0] as number)];\n }\n return [vals[0].toString()];\n }\n\n if (rank === 1) {\n if (size > FORMAT_LIMIT_NUM_VALS) {\n const firstValsSize = FORMAT_NUM_FIRST_LAST_VALS * storagePerElement;\n\n let firstVals = Array.from(\n vals.slice(0, firstValsSize));\n let lastVals = Array.from(vals.slice(\n (size - FORMAT_NUM_FIRST_LAST_VALS) * storagePerElement,\n size * storagePerElement));\n if (dtype === 'complex64') {\n firstVals = createComplexTuples(firstVals);\n lastVals = createComplexTuples(lastVals);\n }\n return [\n '[' +\n firstVals.map((x, i) => valToString(x, padPerCol[i], dtype))\n .join(', ') +\n ', ..., ' +\n lastVals\n .map(\n (x, i) => valToString(\n x, padPerCol[size - FORMAT_NUM_FIRST_LAST_VALS + i], dtype))\n .join(', ') +\n ']'\n ];\n }\n const displayVals: Array =\n dtype === 'complex64' ? createComplexTuples(vals) :\n Array.from(vals);\n\n return [\n '[' +\n displayVals.map((x, i) => valToString(x, padPerCol[i], dtype))\n .join(', ') +\n ']'\n ];\n }\n\n // The array is rank 2 or more.\n const subshape = shape.slice(1);\n const substrides = strides.slice(1);\n const stride = strides[0] * storagePerElement;\n const lines: string[] = [];\n if (size > FORMAT_LIMIT_NUM_VALS) {\n for (let i = 0; i < FORMAT_NUM_FIRST_LAST_VALS; i++) {\n const start = i * stride;\n const end = start + stride;\n lines.push(...subTensorToString(\n vals.slice(start, end), subshape, dtype, substrides, padPerCol,\n false /* isLast */));\n }\n lines.push('...');\n for (let i = size - FORMAT_NUM_FIRST_LAST_VALS; i < size; i++) {\n const start = i * stride;\n const end = start + stride;\n lines.push(...subTensorToString(\n vals.slice(start, end), subshape, dtype, substrides, padPerCol,\n i === size - 1 /* isLast */));\n }\n } else {\n for (let i = 0; i < size; i++) {\n const start = i * stride;\n const end = start + stride;\n lines.push(...subTensorToString(\n vals.slice(start, end), subshape, dtype, substrides, padPerCol,\n i === size - 1 /* isLast */));\n }\n }\n const sep = rank === 2 ? ',' : '';\n lines[0] = '[' + lines[0] + sep;\n for (let i = 1; i < lines.length - 1; i++) {\n lines[i] = ' ' + lines[i] + sep;\n }\n let newLineSep = ',\\n';\n for (let i = 2; i < rank; i++) {\n newLineSep += '\\n';\n }\n lines[lines.length - 1] =\n ' ' + lines[lines.length - 1] + ']' + (isLast ? '' : newLineSep);\n return lines;\n}\n\nfunction createComplexTuples(vals: Array<{}>|\n TypedArray): Array<[number, number]> {\n const complexTuples: Array<[number, number]> = [];\n for (let i = 0; i < vals.length; i += 2) {\n complexTuples.push([vals[i], vals[i + 1]] as [number, number]);\n }\n return complexTuples;\n}\n", "/**\n * @license\n * Copyright 2017 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {getGlobal} from './global_util';\nimport {tensorToString} from './tensor_format';\nimport {ArrayMap, BackendValues, DataType, DataTypeMap, DataValues, NumericDataType, Rank, ShapeMap, SingleValueMap, TypedArray} from './types';\nimport * as util from './util';\nimport {computeStrides, toNestedArray} from './util';\n\nexport interface TensorData {\n dataId?: DataId;\n values?: DataTypeMap[D];\n}\n\n// This interface mimics KernelBackend (in backend.ts), which would create a\n// circular dependency if imported.\nexport interface Backend {}\n\n/**\n * A mutable object, similar to `tf.Tensor`, that allows users to set values\n * at locations before converting to an immutable `tf.Tensor`.\n *\n * See `tf.buffer` for creating a tensor buffer.\n *\n * @doc {heading: 'Tensors', subheading: 'Classes'}\n */\nexport class TensorBuffer {\n size: number;\n shape: ShapeMap[R];\n strides: number[];\n values: DataTypeMap[D];\n\n constructor(shape: ShapeMap[R], public dtype: D, values?: DataTypeMap[D]) {\n this.shape = shape.slice() as ShapeMap[R];\n this.size = util.sizeFromShape(shape);\n\n if (values != null) {\n const n = values.length;\n util.assert(\n n === this.size,\n () => `Length of values '${n}' does not match the size ` +\n `inferred by the shape '${this.size}'.`);\n }\n if (dtype === 'complex64') {\n throw new Error(\n `complex64 dtype TensorBuffers are not supported. Please create ` +\n `a TensorBuffer for the real and imaginary parts separately and ` +\n `call tf.complex(real, imag).`);\n }\n this.values = values || util.getArrayFromDType(dtype, this.size);\n this.strides = computeStrides(shape);\n }\n\n /**\n * Sets a value in the buffer at a given location.\n *\n * @param value The value to set.\n * @param locs The location indices.\n *\n * @doc {heading: 'Tensors', subheading: 'Creation'}\n */\n set(value: SingleValueMap[D], ...locs: number[]): void {\n if (locs.length === 0) {\n locs = [0];\n }\n util.assert(\n locs.length === this.rank,\n () => `The number of provided coordinates (${locs.length}) must ` +\n `match the rank (${this.rank})`);\n\n const index = this.locToIndex(locs);\n this.values[index] = value as number;\n }\n\n /**\n * Returns the value in the buffer at the provided location.\n *\n * @param locs The location indices.\n *\n * @doc {heading: 'Tensors', subheading: 'Creation'}\n */\n get(...locs: number[]): SingleValueMap[D] {\n if (locs.length === 0) {\n locs = [0];\n }\n let i = 0;\n for (const loc of locs) {\n if (loc < 0 || loc >= this.shape[i]) {\n const msg = `Requested out of range element at ${locs}. ` +\n ` Buffer shape=${this.shape}`;\n throw new Error(msg);\n }\n i++;\n }\n let index = locs[locs.length - 1];\n for (let i = 0; i < locs.length - 1; ++i) {\n index += this.strides[i] * locs[i];\n }\n return this.values[index] as SingleValueMap[D];\n }\n\n locToIndex(locs: number[]): number {\n if (this.rank === 0) {\n return 0;\n } else if (this.rank === 1) {\n return locs[0];\n }\n let index = locs[locs.length - 1];\n for (let i = 0; i < locs.length - 1; ++i) {\n index += this.strides[i] * locs[i];\n }\n return index;\n }\n\n indexToLoc(index: number): number[] {\n if (this.rank === 0) {\n return [];\n } else if (this.rank === 1) {\n return [index];\n }\n const locs: number[] = new Array(this.shape.length);\n for (let i = 0; i < locs.length - 1; ++i) {\n locs[i] = Math.floor(index / this.strides[i]);\n index -= locs[i] * this.strides[i];\n }\n locs[locs.length - 1] = index;\n return locs;\n }\n\n get rank() {\n return this.shape.length;\n }\n\n /**\n * Creates an immutable `tf.Tensor` object from the buffer.\n *\n * @doc {heading: 'Tensors', subheading: 'Creation'}\n */\n toTensor(): Tensor {\n return trackerFn().makeTensor(this.values, this.shape, this.dtype) as\n Tensor;\n }\n}\n\nexport interface TensorTracker {\n makeTensor(\n values: DataValues, shape: number[], dtype: DataType,\n backend?: Backend): Tensor;\n makeVariable(\n initialValue: Tensor, trainable?: boolean, name?: string,\n dtype?: DataType): Variable;\n incRef(a: Tensor, backend: Backend): void;\n disposeTensor(t: Tensor): void;\n disposeVariable(v: Variable): void;\n read(dataId: DataId): Promise;\n readSync(dataId: DataId): BackendValues;\n}\n\n/**\n * The Tensor class calls into this handler to delegate chaining operations.\n */\nexport interface OpHandler {\n cast(x: T, dtype: DataType): T;\n buffer(\n shape: ShapeMap[R], dtype: D,\n values?: DataTypeMap[D]): TensorBuffer;\n print(x: T, verbose: boolean): void;\n clone(x: T): T;\n // TODO(yassogba) bring reshape back?\n}\n\n// For tracking tensor creation and disposal.\nlet trackerFn: () => TensorTracker = null;\n// Used by chaining methods to call into ops.\nlet opHandler: OpHandler = null;\n// Used to warn about deprecated methods.\nlet deprecationWarningFn: (msg: string) => void = null;\n// This here so that we can use this method on dev branches and keep the\n// functionality at master.\n// tslint:disable-next-line:no-unused-expression\n[deprecationWarningFn];\n\n/**\n * An external consumer can register itself as the tensor tracker. This way\n * the Tensor class can notify the tracker for every tensor created and\n * disposed.\n */\nexport function setTensorTracker(fn: () => TensorTracker) {\n trackerFn = fn;\n}\n\n/**\n * An external consumer can register itself as the op handler. This way the\n * Tensor class can have chaining methods that call into ops via the op\n * handler.\n */\nexport function setOpHandler(handler: OpHandler) {\n opHandler = handler;\n}\n\n/**\n * Sets the deprecation warning function to be used by this file. This way the\n * Tensor class can be a leaf but still use the environment.\n */\nexport function setDeprecationWarningFn(fn: (msg: string) => void) {\n deprecationWarningFn = fn;\n}\n\n/**\n * We wrap data id since we use weak map to avoid memory leaks.\n * Since we have our own memory management, we have a reference counter\n * mapping a tensor to its data, so there is always a pointer (even if that\n * data is otherwise garbage collectable).\n * See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/\n * Global_Objects/WeakMap\n */\nexport type DataId = object; // object instead of {} to force non-primitive.\n\n// Declare this namespace to make Tensor class augmentation work in google3.\nexport declare namespace Tensor {}\n/**\n * A `tf.Tensor` object represents an immutable, multidimensional array of\n * numbers that has a shape and a data type.\n *\n * For performance reasons, functions that create tensors do not necessarily\n * perform a copy of the data passed to them (e.g. if the data is passed as a\n * `Float32Array`), and changes to the data will change the tensor. This is not\n * a feature and is not supported. To avoid this behavior, use the tensor before\n * changing the input data or create a copy with `copy = tf.add(yourTensor, 0)`.\n *\n * See `tf.tensor` for details on how to create a `tf.Tensor`.\n *\n * @doc {heading: 'Tensors', subheading: 'Classes'}\n */\nexport class Tensor {\n /** Unique id of this tensor. */\n readonly id: number;\n /**\n * Id of the bucket holding the data for this tensor. Multiple arrays can\n * point to the same bucket (e.g. when calling array.reshape()).\n */\n dataId: DataId;\n /** The shape of the tensor. */\n readonly shape: ShapeMap[R];\n /** Number of elements in the tensor. */\n readonly size: number;\n /** The data type for the array. */\n readonly dtype: DataType;\n /** The rank type for the array (see `Rank` enum). */\n readonly rankType: R;\n\n /** Whether this tensor has been globally kept. */\n kept = false;\n /** The id of the scope this tensor is being tracked in. */\n scopeId: number;\n\n /**\n * Number of elements to skip in each dimension when indexing. See\n * https://docs.scipy.org/doc/numpy/reference/generated/\\\n * numpy.ndarray.strides.html\n */\n readonly strides: number[];\n\n constructor(shape: ShapeMap[R], dtype: DataType, dataId: DataId, id: number) {\n this.shape = shape.slice() as ShapeMap[R];\n this.dtype = dtype || 'float32';\n this.size = util.sizeFromShape(shape);\n this.strides = computeStrides(shape);\n this.dataId = dataId;\n this.id = id;\n this.rankType = (this.rank < 5 ? this.rank.toString() : 'higher') as R;\n }\n\n get rank(): number {\n return this.shape.length;\n }\n\n /**\n * Returns a promise of `tf.TensorBuffer` that holds the underlying data.\n *\n * @doc {heading: 'Tensors', subheading: 'Classes'}\n */\n async buffer(): Promise> {\n const vals = await this.data();\n return opHandler.buffer(this.shape, this.dtype as D, vals);\n }\n\n /**\n * Returns a `tf.TensorBuffer` that holds the underlying data.\n * @doc {heading: 'Tensors', subheading: 'Classes'}\n */\n bufferSync(): TensorBuffer {\n return opHandler.buffer(this.shape, this.dtype as D, this.dataSync());\n }\n\n /**\n * Returns the tensor data as a nested array. The transfer of data is done\n * asynchronously.\n *\n * @doc {heading: 'Tensors', subheading: 'Classes'}\n */\n async array(): Promise {\n const vals = await this.data();\n return toNestedArray(this.shape, vals, this.dtype === 'complex64') as\n ArrayMap[R];\n }\n\n /**\n * Returns the tensor data as a nested array. The transfer of data is done\n * synchronously.\n *\n * @doc {heading: 'Tensors', subheading: 'Classes'}\n */\n arraySync(): ArrayMap[R] {\n return toNestedArray(\n this.shape, this.dataSync(), this.dtype === 'complex64') as\n ArrayMap[R];\n }\n\n /**\n * Asynchronously downloads the values from the `tf.Tensor`. Returns a\n * promise of `TypedArray` that resolves when the computation has finished.\n *\n * @doc {heading: 'Tensors', subheading: 'Classes'}\n */\n async data(): Promise {\n this.throwIfDisposed();\n const data = trackerFn().read(this.dataId);\n if (this.dtype === 'string') {\n const bytes = await data as Uint8Array[];\n try {\n return bytes.map(b => util.decodeString(b)) as DataTypeMap[D];\n } catch {\n throw new Error(\n 'Failed to decode the string bytes into utf-8. ' +\n 'To get the original bytes, call tensor.bytes().');\n }\n }\n return data as Promise;\n }\n\n /**\n * Synchronously downloads the values from the `tf.Tensor`. This blocks the\n * UI thread until the values are ready, which can cause performance issues.\n *\n * @doc {heading: 'Tensors', subheading: 'Classes'}\n */\n dataSync(): DataTypeMap[D] {\n this.throwIfDisposed();\n const data = trackerFn().readSync(this.dataId);\n if (this.dtype === 'string') {\n try {\n return (data as Uint8Array[]).map(b => util.decodeString(b)) as\n DataTypeMap[D];\n } catch {\n throw new Error(\n 'Failed to decode the string bytes into utf-8. ' +\n 'To get the original bytes, call tensor.bytes().');\n }\n }\n return data as DataTypeMap[D];\n }\n\n /** Returns the underlying bytes of the tensor's data. */\n async bytes(): Promise {\n this.throwIfDisposed();\n const data = await trackerFn().read(this.dataId);\n if (this.dtype === 'string') {\n return data as Uint8Array[];\n } else {\n return new Uint8Array((data as TypedArray).buffer);\n }\n }\n\n /**\n * Disposes `tf.Tensor` from memory.\n *\n * @doc {heading: 'Tensors', subheading: 'Classes'}\n */\n dispose(): void {\n if (this.isDisposed) {\n return;\n }\n trackerFn().disposeTensor(this);\n this.isDisposedInternal = true;\n }\n\n protected isDisposedInternal = false;\n get isDisposed(): boolean {\n return this.isDisposedInternal;\n }\n\n throwIfDisposed() {\n if (this.isDisposed) {\n throw new Error(`Tensor is disposed.`);\n }\n }\n\n /**\n * Prints the `tf.Tensor`. See `tf.print` for details.\n *\n * @param verbose Whether to print verbose information about the tensor,\n * including dtype and size.\n *\n * @doc {heading: 'Tensors', subheading: 'Classes'}\n */\n print(verbose = false): void {\n return opHandler.print(this, verbose);\n }\n\n /**\n * Returns a copy of the tensor. See `tf.clone` for details.\n * @doc {heading: 'Tensors', subheading: 'Classes'}\n */\n clone(this: T): T {\n this.throwIfDisposed();\n return opHandler.clone(this);\n }\n\n /**\n * Returns a human-readable description of the tensor. Useful for logging.\n *\n * @doc {heading: 'Tensors', subheading: 'Classes'}\n */\n toString(verbose = false): string {\n const vals = this.dataSync();\n return tensorToString(vals, this.shape, this.dtype, verbose);\n }\n\n cast(dtype: DataType): T {\n this.throwIfDisposed();\n return opHandler.cast(this as T, dtype);\n }\n variable(trainable = true, name?: string, dtype?: DataType): Variable {\n this.throwIfDisposed();\n return trackerFn().makeVariable(this, trainable, name, dtype) as\n Variable;\n }\n}\nObject.defineProperty(Tensor, Symbol.hasInstance, {\n value: (instance: Tensor) => {\n // Implementation note: we should use properties of the object that will be\n // defined before the constructor body has finished executing (methods).\n // This is because when this code is transpiled by babel, babel will call\n // classCallCheck before the constructor body is run.\n // See https://github.com/tensorflow/tfjs/issues/3384 for backstory.\n return !!instance && instance.data != null && instance.dataSync != null &&\n instance.throwIfDisposed != null;\n }\n});\n\nexport function getGlobalTensorClass() {\n // Use getGlobal so that we can augment the Tensor class across package\n // boundaries becase the node resolution alg may result in different modules\n // being returned for this file depending on the path they are loaded from.\n return getGlobal('Tensor', () => {\n return Tensor;\n });\n}\n\n// Global side effect. Cache global reference to Tensor class\ngetGlobalTensorClass();\n\nexport interface NumericTensor extends Tensor {\n dtype: NumericDataType;\n dataSync(): DataTypeMap[D];\n data(): Promise;\n}\n\nexport interface StringTensor extends Tensor {\n dtype: 'string';\n dataSync(): DataTypeMap[D];\n data(): Promise;\n}\n\n/** @doclink Tensor */\nexport type Scalar = Tensor;\n/** @doclink Tensor */\nexport type Tensor1D = Tensor;\n/** @doclink Tensor */\nexport type Tensor2D = Tensor;\n/** @doclink Tensor */\nexport type Tensor3D = Tensor;\n/** @doclink Tensor */\nexport type Tensor4D = Tensor;\n/** @doclink Tensor */\nexport type Tensor5D = Tensor;\n/** @doclink Tensor */\nexport type Tensor6D = Tensor;\n\n/**\n * A mutable `tf.Tensor`, useful for persisting state, e.g. for training.\n *\n * @doc {heading: 'Tensors', subheading: 'Classes'}\n */\nexport class Variable extends Tensor {\n name: string;\n\n constructor(\n initialValue: Tensor, public trainable: boolean, name: string,\n tensorId: number) {\n super(\n initialValue.shape, initialValue.dtype, initialValue.dataId, tensorId);\n this.name = name;\n }\n\n /**\n * Assign a new `tf.Tensor` to this variable. The new `tf.Tensor` must have\n * the same shape and dtype as the old `tf.Tensor`.\n *\n * @param newValue New tensor to be assigned to this variable.\n *\n * @doc {heading: 'Tensors', subheading: 'Classes'}\n */\n assign(newValue: Tensor): void {\n if (newValue.dtype !== this.dtype) {\n throw new Error(\n `dtype of the new value (${newValue.dtype}) and ` +\n `previous value (${this.dtype}) must match`);\n }\n if (!util.arraysEqual(newValue.shape, this.shape)) {\n throw new Error(\n `shape of the new value (${newValue.shape}) and ` +\n `previous value (${this.shape}) must match`);\n }\n trackerFn().disposeTensor(this);\n this.dataId = newValue.dataId;\n trackerFn().incRef(this, null /* backend */);\n }\n\n dispose(): void {\n trackerFn().disposeVariable(this);\n this.isDisposedInternal = true;\n }\n}\n\nObject.defineProperty(Variable, Symbol.hasInstance, {\n value: (instance: Variable) => {\n return instance instanceof Tensor && instance.assign != null &&\n instance.assign instanceof Function;\n }\n});\n", "/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {Tensor} from './tensor';\nimport {TensorContainer, TensorContainerArray} from './tensor_types';\nimport {upcastType} from './types';\nimport {assert} from './util';\n\nexport function makeTypesMatch(a: T, b: T): [T, T] {\n if (a.dtype === b.dtype) {\n return [a, b];\n }\n const dtype = upcastType(a.dtype, b.dtype);\n return [a.cast(dtype), b.cast(dtype)];\n}\n\nexport function assertTypesMatch(a: Tensor, b: Tensor): void {\n assert(\n a.dtype === b.dtype,\n () => `The dtypes of the first(${a.dtype}) and` +\n ` second(${b.dtype}) input must match`);\n}\n\nexport function isTensorInList(tensor: Tensor, tensorList: Tensor[]): boolean {\n return tensorList.some(x => x.id === tensor.id);\n}\n\n/**\n * Extracts any `Tensor`s found within the provided object.\n *\n * @param container an object that may be a `Tensor` or may directly contain\n * `Tensor`s, such as a `Tensor[]` or `{key: Tensor, ...}`. In general it\n * is safe to pass any object here, except that `Promise`s are not\n * supported.\n * @returns An array of `Tensors` found within the passed object. If the\n * argument is simply a `Tensor', a list containing that `Tensor` is\n * returned. If the object is not a `Tensor` or does not\n * contain `Tensors`, an empty list is returned.\n */\nexport function getTensorsInContainer(result: TensorContainer): Tensor[] {\n const list: Tensor[] = [];\n const seen = new Set<{}|void>();\n walkTensorContainer(result, list, seen);\n return list;\n}\n\nfunction walkTensorContainer(\n container: TensorContainer, list: Tensor[], seen: Set<{}|void>): void {\n if (container == null) {\n return;\n }\n if (container instanceof Tensor) {\n list.push(container);\n return;\n }\n if (!isIterable(container)) {\n return;\n }\n // Iteration over keys works also for arrays.\n const iterable = container as TensorContainerArray;\n for (const k in iterable) {\n const val = iterable[k];\n if (!seen.has(val)) {\n seen.add(val);\n walkTensorContainer(val, list, seen);\n }\n }\n}\n\n// tslint:disable-next-line:no-any\nfunction isIterable(obj: any): boolean {\n return Array.isArray(obj) || typeof obj === 'object';\n}\n", "/**\n * @license\n * Copyright 2017 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\n/** @docalias number[] */\nexport interface ShapeMap {\n R0: number[];\n R1: [number];\n R2: [number, number];\n R3: [number, number, number];\n R4: [number, number, number, number];\n R5: [number, number, number, number, number];\n R6: [number, number, number, number, number, number];\n}\n\n/** @docalias number[] */\nexport interface ArrayMap {\n R0: number;\n R1: number[];\n R2: number[][];\n R3: number[][][];\n R4: number[][][][];\n R5: number[][][][][];\n R6: number[][][][][][];\n}\n\nexport interface DataTypeMap {\n float32: Float32Array;\n int32: Int32Array;\n bool: Uint8Array;\n complex64: Float32Array;\n string: string[];\n}\n\nexport interface SingleValueMap {\n bool: boolean;\n int32: number;\n float32: number;\n complex64: number;\n string: string;\n}\n\n/** @docalias 'float32'|'int32'|'bool'|'complex64'|'string' */\nexport type DataType = keyof DataTypeMap;\nexport type NumericDataType = 'float32'|'int32'|'bool'|'complex64';\nexport type TypedArray = Float32Array|Int32Array|Uint8Array;\n/** Tensor data used in tensor creation and user-facing API. */\nexport type DataValues = DataTypeMap[DataType];\n/** The underlying tensor data that gets stored in a backend. */\nexport type BackendValues = Float32Array|Int32Array|Uint8Array|Uint8Array[];\n\nexport enum Rank {\n R0 = 'R0',\n R1 = 'R1',\n R2 = 'R2',\n R3 = 'R3',\n R4 = 'R4',\n R5 = 'R5',\n R6 = 'R6'\n}\n\nexport type FlatVector = boolean[]|number[]|TypedArray;\nexport type RegularArray =\n T[]|T[][]|T[][][]|T[][][][]|T[][][][][]|T[][][][][][];\n\n// tslint:disable-next-line:no-any\nexport interface RecursiveArray {\n [index: number]: T|RecursiveArray;\n}\n\n// Looks for upcasting types. Used, for example, in operations with mixed dtype\n// inputs.\nenum UpcastInt32AndMap {\n 'float32' = 'float32',\n 'int32' = 'int32',\n 'bool' = 'int32',\n 'complex64' = 'complex64'\n}\n\nenum UpcastBoolAndMap {\n 'float32' = 'float32',\n 'int32' = 'int32',\n 'bool' = 'bool',\n 'complex64' = 'complex64'\n}\n\nenum UpcastFloat32AndMap {\n 'float32' = 'float32',\n 'int32' = 'float32',\n 'bool' = 'float32',\n 'complex64' = 'complex64'\n}\n\nenum UpcastComplex64AndMap {\n 'float32' = 'complex64',\n 'int32' = 'complex64',\n 'bool' = 'complex64',\n 'complex64' = 'complex64'\n}\n\nconst upcastTypeMap = {\n 'float32': UpcastFloat32AndMap,\n 'int32': UpcastInt32AndMap,\n 'bool': UpcastBoolAndMap,\n 'complex64': UpcastComplex64AndMap\n};\n\nexport function upcastType(typeA: DataType, typeB: DataType): DataType {\n if (typeA === 'string' || typeB === 'string') {\n if (typeA === 'string' && typeB === 'string') {\n return 'string';\n }\n throw new Error(`Can not upcast ${typeA} with ${typeB}`);\n }\n return upcastTypeMap[typeA][typeB];\n}\n\n/** Returns the output type after summation. */\nexport function sumOutType(type: DataType): DataType {\n return upcastType(type, 'int32');\n}\n\n/** @docalias TypedArray|Array */\nexport type TensorLike =\n TypedArray|number|boolean|string|RecursiveArray|\n RecursiveArray|RecursiveArray|Uint8Array[];\nexport type ScalarLike = number|boolean|string|Uint8Array;\n/** @docalias TypedArray|Array */\nexport type TensorLike1D = TypedArray|number[]|boolean[]|string[]|Uint8Array[];\n/** @docalias TypedArray|Array */\nexport type TensorLike2D = TypedArray|number[]|number[][]|boolean[]|boolean[][]|\n string[]|string[][]|Uint8Array[]|Uint8Array[][];\n/** @docalias TypedArray|Array */\nexport type TensorLike3D = TypedArray|number[]|number[][][]|boolean[]|\n boolean[][][]|string[]|string[][][]|Uint8Array[]|Uint8Array[][][];\n/** @docalias TypedArray|Array */\nexport type TensorLike4D = TypedArray|number[]|number[][][][]|boolean[]|\n boolean[][][][]|string[]|string[][][][]|Uint8Array[]|Uint8Array[][][][];\n/** @docalias TypedArray|Array */\nexport type TensorLike5D =\n TypedArray|number[]|number[][][][][]|boolean[]|boolean[][][][][]|string[]|\n string[][][][][]|Uint8Array[]|Uint8Array[][][][][];\n/** @docalias TypedArray|Array */\nexport type TensorLike6D =\n TypedArray|number[]|number[][][][][][]|boolean[]|boolean[][][][][][]|\n string[]|string[][][][][][]|Uint8Array[]|Uint8Array[][][][][];\n\n/** Type for representing image data in Uint8Array type. */\nexport interface PixelData {\n width: number;\n height: number;\n data: Uint8Array;\n}\n", "/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {BackendTimingInfo, DataMover, KernelBackend} from './backends/backend';\nimport {Environment, setEnvironmentGlobal} from './environment';\nimport {getGlobalNamespace} from './global_util';\nimport {Add, Cast, Identity} from './kernel_names';\nimport {getGradient, getKernel, getKernelsForBackend, GradFunc, NamedAttrMap, TensorInfo} from './kernel_registry';\nimport {KernelProfile, Profiler} from './profiler';\nimport {backpropagateGradients, getFilteredNodesXToY, TapeNode} from './tape';\nimport {DataId, setTensorTracker, Tensor, TensorTracker, Variable} from './tensor';\nimport {GradSaveFunc, NamedTensorMap, NamedVariableMap, TensorContainer} from './tensor_types';\nimport {getTensorsInContainer} from './tensor_util';\nimport {BackendValues, DataType, DataValues} from './types';\nimport * as util from './util';\nimport {bytesFromStringArray, makeOnesTypedArray, now, sizeFromShape} from './util';\n\n/**\n * A function that computes an output. The save function is for saving tensors\n * computed in the forward pass, that we need in the backward pass.\n */\nexport type ForwardFunc = (backend: KernelBackend, save?: GradSaveFunc) => T;\n\n/**\n * @docalias (a: Tensor, b: Tensor,..., save?: Function) => {\n * value: Tensor,\n * gradFunc: (dy: Tensor, saved?: NamedTensorMap) => Tensor | Tensor[]\n * }\n */\nexport type CustomGradientFunc =\n (...inputs: Array) => {\n value: T;\n gradFunc: (dy: T, saved: Tensor[]) => Tensor | Tensor[];\n };\n\nexport type MemoryInfo = {\n numTensors: number; numDataBuffers: number; numBytes: number;\n unreliable?: boolean; reasons: string[];\n};\n\ntype KernelInfo = {\n name: string; bytesAdded: number; totalBytesSnapshot: number;\n tensorsAdded: number;\n totalTensorsSnapshot: number;\n inputShapes: number[][];\n outputShapes: number[][];\n kernelTimeMs: number | {error: string} | Promise;\n extraInfo: string | Promise;\n};\n\nexport type ProfileInfo = {\n newBytes: number; newTensors: number; peakBytes: number;\n kernels: KernelInfo[];\n result: TensorContainer;\n kernelNames: string[];\n};\n\nexport interface TimingInfo extends BackendTimingInfo {\n wallMs: number;\n}\n\n/** @docalias Function */\nexport type ScopeFn = () => T;\n\ninterface ScopeState {\n track: Tensor[];\n name: string;\n id: number;\n}\n\ninterface RegisteredKernelInvocation {\n kernelName: string;\n inputs: I;\n attrs?: NamedAttrMap;\n}\n\ninterface CustomGradKernelInvocation {\n forwardFunc: ForwardFunc;\n backwardsFunc: (dy: T, saved: Tensor[]) => {\n [P in keyof I]: () => I[P]\n };\n inputs: I;\n attrs?: NamedAttrMap;\n}\n\nfunction isRegisteredKernelInvocation(\n kernelInvocation: RegisteredKernelInvocation|\n CustomGradKernelInvocation):\n kernelInvocation is RegisteredKernelInvocation {\n return (kernelInvocation as RegisteredKernelInvocation).kernelName != null;\n}\n\nclass EngineState {\n // Public since optimizers will use it.\n registeredVariables: NamedVariableMap = {};\n\n nextTapeNodeId = 0;\n numBytes = 0;\n numTensors = 0;\n numStringTensors = 0;\n numDataBuffers = 0;\n\n activeTape: TapeNode[];\n // Number of nested tf.grad() statements when computing higher-order\n // gradients. E.g. `1` for first-order gradients and `2` for second-order\n // gradients. Used to track if the tape should be removed after a backprop.\n gradientDepth = 0;\n // Number of nested kernel calls. When kernel depth is greater than 1, we turn\n // off the tape.\n kernelDepth = 0;\n\n // Keep Tensors that parallel the tapes.\n activeScope: ScopeState;\n scopeStack: ScopeState[] = [];\n /**\n * Keeps track of the number of data moves during a kernel execution. We\n * maintain a stack since kernels can call other kernels, recursively.\n */\n numDataMovesStack: number[] = [];\n nextScopeId = 0;\n\n tensorInfo = new WeakMap();\n\n profiling = false;\n activeProfile: ProfileInfo = {\n newBytes: 0,\n newTensors: 0,\n peakBytes: 0,\n kernels: [],\n result: null,\n get kernelNames():\n string[] {\n return Array.from(new Set(this.kernels.map(k => k.name)));\n }\n };\n\n dispose() {\n for (const variableName in this.registeredVariables) {\n this.registeredVariables[variableName].dispose();\n }\n }\n}\n\nexport class Engine implements TensorTracker, DataMover {\n state: EngineState;\n backendName: string;\n registry: {[id: string]: KernelBackend} = {};\n registryFactory: {\n [id: string]: {\n factory: () => KernelBackend | Promise,\n priority: number\n }\n } = {};\n\n private profiler: Profiler;\n private backendInstance: KernelBackend;\n private pendingBackendInit: Promise;\n private pendingBackendInitId = 0;\n\n constructor(public ENV: Environment) {\n this.state = new EngineState();\n }\n\n async ready(): Promise {\n if (this.pendingBackendInit != null) {\n return this.pendingBackendInit.then(() => {});\n }\n if (this.backendInstance != null) {\n return;\n }\n const sortedBackends = this.getSortedBackends();\n\n for (let i = 0; i < sortedBackends.length; i++) {\n const backendName = sortedBackends[i];\n const success = await this.initializeBackend(backendName).success;\n if (success) {\n await this.setBackend(backendName);\n return;\n }\n }\n\n throw new Error(\n `Could not initialize any backends, all backend initializations ` +\n `failed.`);\n }\n\n get backend(): KernelBackend {\n if (this.pendingBackendInit != null) {\n throw new Error(\n `Backend '${this.backendName}' has not yet been initialized. Make ` +\n `sure to await tf.ready() or await tf.setBackend() before calling ` +\n `other methods`);\n }\n if (this.backendInstance == null) {\n const {name, asyncInit} = this.initializeBackendsAndReturnBest();\n if (asyncInit) {\n throw new Error(\n `The highest priority backend '${name}' has not yet been ` +\n `initialized. Make sure to await tf.ready() or ` +\n `await tf.setBackend() before calling other methods`);\n }\n this.setBackend(name);\n }\n return this.backendInstance;\n }\n\n backendNames(): string[] {\n return Object.keys(this.registryFactory);\n }\n\n findBackend(backendName: string): KernelBackend {\n if (!(backendName in this.registry)) {\n // If the backend hasn't been initialized but we have a registry entry for\n // it, initialize it and return it.\n if (backendName in this.registryFactory) {\n const {asyncInit} = this.initializeBackend(backendName);\n if (asyncInit) {\n // Backend is not ready yet.\n return null;\n }\n } else {\n return null;\n }\n }\n return this.registry[backendName];\n }\n\n findBackendFactory(backendName: string):\n () => KernelBackend | Promise {\n if (!(backendName in this.registryFactory)) {\n return null;\n }\n return this.registryFactory[backendName].factory;\n }\n\n registerBackend(\n backendName: string,\n factory: () => KernelBackend | Promise,\n priority = 1): boolean {\n if (backendName in this.registryFactory) {\n console.warn(\n `${backendName} backend was already registered. ` +\n `Reusing existing backend factory.`);\n return false;\n }\n this.registryFactory[backendName] = {factory, priority};\n return true;\n }\n\n async setBackend(backendName: string): Promise {\n if (this.registryFactory[backendName] == null) {\n throw new Error(`Backend name '${backendName}' not found in registry`);\n }\n this.backendName = backendName;\n if (this.registry[backendName] == null) {\n this.backendInstance = null;\n const {success, asyncInit} = this.initializeBackend(backendName);\n const result = asyncInit ? await success : success;\n if (!result) {\n return false;\n }\n }\n this.backendInstance = this.registry[backendName];\n this.setupRegisteredKernels();\n // Reset the profiler.\n this.profiler = new Profiler(this.backendInstance);\n\n return true;\n }\n\n private setupRegisteredKernels(): void {\n const kernels = getKernelsForBackend(this.backendName);\n kernels.forEach(kernel => {\n if (kernel.setupFunc != null) {\n kernel.setupFunc(this.backendInstance);\n }\n });\n }\n\n private disposeRegisteredKernels(backendName: string): void {\n const kernels = getKernelsForBackend(backendName);\n kernels.forEach(kernel => {\n if (kernel.disposeFunc != null) {\n kernel.disposeFunc(this.registry[backendName]);\n }\n });\n }\n\n /**\n * Initializes a backend by looking up the backend name in the factory\n * registry and calling the factory method. Returns a boolean representing\n * whether the initialization of the backend suceeded. Throws an error if\n * there is no backend in the factory registry.\n */\n private initializeBackend(backendName: string):\n {success: boolean|Promise, asyncInit: boolean} {\n const registryFactoryEntry = this.registryFactory[backendName];\n if (registryFactoryEntry == null) {\n throw new Error(\n `Cannot initialize backend ${backendName}, no registration found.`);\n }\n\n try {\n const backend = registryFactoryEntry.factory();\n /* Test if the factory returns a promise.\n Done in a more liberal way than\n previous 'Promise.resolve(backend)===backend'\n as we needed to account for custom Promise\n implementations (e.g. Angular) */\n if (backend && !(backend instanceof KernelBackend) &&\n typeof backend.then === 'function') {\n const promiseId = ++this.pendingBackendInitId;\n const success =\n backend\n .then(backendInstance => {\n // Outdated promise. Another backend was set in the meantime.\n if (promiseId < this.pendingBackendInitId) {\n return false;\n }\n this.registry[backendName] = backendInstance;\n this.pendingBackendInit = null;\n return true;\n })\n .catch(err => {\n // Outdated promise. Another backend was set in the meantime.\n if (promiseId < this.pendingBackendInitId) {\n return false;\n }\n this.pendingBackendInit = null;\n console.warn(\n `Initialization of backend ${backendName} failed`);\n console.warn(err.stack || err.message);\n return false;\n });\n this.pendingBackendInit = success;\n return {success, asyncInit: true};\n } else {\n this.registry[backendName] = backend as KernelBackend;\n return {success: true, asyncInit: false};\n }\n } catch (err) {\n console.warn(`Initialization of backend ${backendName} failed`);\n console.warn(err.stack || err.message);\n return {success: false, asyncInit: false};\n }\n }\n\n removeBackend(backendName: string): void {\n if (!(backendName in this.registryFactory)) {\n throw new Error(`${backendName} backend not found in registry`);\n }\n if (this.backendName === backendName && this.pendingBackendInit != null) {\n // There is a pending promise of the backend we want to remove. Make it\n // obsolete.\n this.pendingBackendInitId++;\n }\n\n if (backendName in this.registry) {\n this.disposeRegisteredKernels(backendName);\n this.registry[backendName].dispose();\n delete this.registry[backendName];\n }\n\n delete this.registryFactory[backendName];\n\n // Unset the backend if it is active.\n if (this.backendName === backendName) {\n this.pendingBackendInit = null;\n this.backendName = null;\n this.backendInstance = null;\n }\n }\n\n private getSortedBackends(): string[] {\n if (Object.keys(this.registryFactory).length === 0) {\n throw new Error('No backend found in registry.');\n }\n return Object.keys(this.registryFactory).sort((a: string, b: string) => {\n // Highest priority comes first.\n return this.registryFactory[b].priority -\n this.registryFactory[a].priority;\n });\n }\n\n private initializeBackendsAndReturnBest():\n {name: string, asyncInit: boolean} {\n const sortedBackends = this.getSortedBackends();\n\n for (let i = 0; i < sortedBackends.length; i++) {\n const backendName = sortedBackends[i];\n const {success, asyncInit} = this.initializeBackend(backendName);\n if (asyncInit || success) {\n return {name: backendName, asyncInit};\n }\n }\n throw new Error(\n `Could not initialize any backends, all backend initializations ` +\n `failed.`);\n }\n\n moveData(backend: KernelBackend, dataId: DataId) {\n const info = this.state.tensorInfo.get(dataId);\n const srcBackend = info.backend;\n const values = this.readSync(dataId);\n const refCount = srcBackend.refCount(dataId);\n // Delete the tensor from the old backend and move it to the new\n // backend.\n srcBackend.disposeData(dataId, true);\n info.backend = backend;\n backend.move(dataId, values, info.shape, info.dtype, refCount);\n if (this.shouldCheckForMemLeaks()) {\n // Track the number of moves during a kernel execution to correctly\n // detect memory leaks.\n this.state.numDataMovesStack[this.state.numDataMovesStack.length - 1]++;\n }\n }\n\n tidy(nameOrFn: string|ScopeFn, fn?: ScopeFn):\n T {\n let name: string = null;\n if (fn == null) {\n // Called with only 1 argument.\n if (typeof nameOrFn !== 'function') {\n throw new Error('Please provide a function to tidy()');\n }\n fn = nameOrFn;\n } else {\n // Called with 2 arguments.\n if (typeof nameOrFn !== 'string' && !(nameOrFn instanceof String)) {\n throw new Error(\n 'When calling with two arguments, the first argument ' +\n 'to tidy() must be a string');\n }\n if (typeof fn !== 'function') {\n throw new Error(\n 'When calling with two arguments, the 2nd argument ' +\n 'to tidy() must be a function');\n }\n name = nameOrFn as string;\n // TODO(nsthorat,smilkov): Do operation logging and performance\n // profiling.\n }\n let result: T;\n return this.scopedRun(\n () => this.startScope(name), () => this.endScope(result), () => {\n result = fn();\n if (result instanceof Promise) {\n console.error('Cannot return a Promise inside of tidy.');\n }\n return result;\n });\n }\n\n private scopedRun(start: () => void, end: () => void, f: () => T): T {\n start();\n try {\n const res = f();\n end();\n return res;\n } catch (ex) {\n end();\n throw ex;\n }\n }\n\n private static nextTensorId = 0;\n private nextTensorId(): number {\n return Engine.nextTensorId++;\n }\n\n private static nextVariableId = 0;\n private nextVariableId(): number {\n return Engine.nextVariableId++;\n }\n\n /**\n * This method is called instead of the public-facing tensor.clone() when\n * saving a tensor for backwards pass. It makes sure to add the clone\n * operation to the tape regardless of being called inside a kernel\n * execution.\n */\n private clone(x: Tensor): Tensor {\n const y: Tensor = ENGINE.runKernel(Identity, {x} as {} as NamedTensorMap);\n const inputs = {x};\n const grad = (dy: Tensor) => ({\n x: () => {\n const dtype = 'float32';\n const gradInputs = {x: dy};\n const attrs = {dtype};\n\n return ENGINE.runKernel(\n Cast, gradInputs as {} as NamedTensorMap,\n // tslint:disable-next-line: no-unnecessary-type-assertion\n attrs as {} as NamedAttrMap) as Tensor;\n }\n });\n const saved: Tensor[] = [];\n this.addTapeNode(this.state.activeScope.name, inputs, [y], grad, saved, {});\n return y;\n }\n\n /**\n * Execute a kernel with the given name and return the output tensor.\n *\n * @param kernelName The name of the kernel to execute.\n * @param inputs A map of input names to tensors.\n * @param attrs A map of attribute names to their values. An attribute is a\n * primitive (non-tensor) input to the kernel.\n * @param inputsToSave A list of tensors, inputs to save for the backprop\n * computation.\n * @param outputsToSave A list of booleans, specifying which output to save\n * for the backprop computation. These are booleans since the output\n * tensors are not visible to the user.\n */\n runKernel(\n kernelName: string, inputs: NamedTensorMap, attrs?: NamedAttrMap): T {\n const hasKernel = getKernel(kernelName, this.backendName) != null;\n if (!hasKernel) {\n throw new Error(`Kernel '${kernelName}' not registered for backend '${\n this.backendName}'`);\n }\n return this.runKernelFunc({kernelName, inputs, attrs});\n }\n\n private shouldCheckForMemLeaks(): boolean {\n return this.ENV.getBool('IS_TEST');\n }\n\n private checkKernelForMemLeak(\n kernelName: string, numDataIdsBefore: number,\n outInfos: TensorInfo[]): void {\n const numDataIdsAfter = this.backend.numDataIds();\n\n // Count the number of data ids associated with the result of the kernel.\n let numOutputDataIds = 0;\n outInfos.forEach(info => {\n // Complex numbers allocate 3 data ids, one for 'real', one for\n // 'imaginary', and one for the container that holds the former two.\n numOutputDataIds += (info.dtype === 'complex64' ? 3 : 1);\n });\n\n // Account for the number of moves during kernel execution. A \"data move\"\n // can happen in the middle of a kernel execution, placing a new (key,value)\n // pair in the data storage. Since data moves have net zero effect (we\n // always remove the data from the old backend), we have to cancel them out\n // when detecting memory leaks.\n const numMoves =\n this.state.numDataMovesStack[this.state.numDataMovesStack.length - 1];\n const dataIdsLeaked =\n numDataIdsAfter - numDataIdsBefore - numOutputDataIds - numMoves;\n if (dataIdsLeaked > 0) {\n throw new Error(\n `Backend '${this.backendName}' has an internal memory leak ` +\n `(${dataIdsLeaked} data ids) after running '${kernelName}'`);\n }\n }\n\n /**\n * Internal helper method to execute a kernel Func\n *\n * Use `runKernel` to execute kernels from outside of engine.\n */\n private runKernelFunc(\n kernelParams: RegisteredKernelInvocation|\n CustomGradKernelInvocation): T {\n let outputs: Tensor[];\n let saved: Tensor[] = [];\n const isTapeOn = this.isTapeOn();\n\n const startingBytecount = this.state.numBytes;\n const startingNumTensors = this.state.numTensors;\n\n if (this.shouldCheckForMemLeaks()) {\n this.state.numDataMovesStack.push(0);\n }\n\n let kernelFunc: () => Tensor[];\n if (this.backendName == null) {\n // backend has not been initialized yet (backend initialization is lazy\n // can be deferred until an op/ kernel is run).\n // The below getter has side effects that will try to initialize the\n // backend and set properties like this.backendName\n // tslint:disable-next-line: no-unused-expression\n this.backend;\n }\n\n let out: TensorInfo|TensorInfo[];\n\n const kernelOrScopeName = isRegisteredKernelInvocation(kernelParams) ?\n kernelParams.kernelName :\n this.state.activeScope != null ? this.state.activeScope.name : '';\n\n // Create the kernelFunc from either a registered kernel OR passed in\n // forward/backward functions (used by custom grad). In this context a\n // kernelFunc wraps a kernel implementation with some bookkeeping.\n\n if (isRegisteredKernelInvocation(kernelParams)) {\n const {kernelName, inputs, attrs} = kernelParams;\n if (this.backendName == null) {\n // backend has not been initialized yet (backend initialization is lazy\n // can be deferred until an op/ kernel is run).\n // The below getter has side effects that will try to initialize the\n // backend and set properties like this.backendName\n // tslint:disable-next-line: no-unused-expression\n this.backend;\n }\n const kernel = getKernel(kernelName, this.backendName);\n util.assert(\n kernel != null,\n () => `Cannot find registered kernel '${kernelName}' for backend '${\n this.backendName}'`);\n\n kernelFunc = () => {\n const numDataIdsBefore = this.backend.numDataIds();\n out = kernel.kernelFunc({inputs, attrs, backend: this.backend});\n const outInfos = Array.isArray(out) ? out : [out];\n if (this.shouldCheckForMemLeaks()) {\n this.checkKernelForMemLeak(kernelName, numDataIdsBefore, outInfos);\n }\n\n const outTensors = outInfos.map((outInfo: TensorInfo|Tensor) => {\n // todo (yassogba) remove this option (Tensor) when node backend\n // methods have been modularized and they all return tensorInfo.\n // TensorInfos do not have a rank attribute.\n if ((outInfo as Tensor).rank != null) {\n return outInfo as Tensor;\n }\n const {dataId, shape, dtype} = outInfo as TensorInfo;\n return this.makeTensorFromDataId(dataId, shape, dtype);\n });\n\n // Save any required inputs and outputs.\n\n // Do not save unless we are recording to the tape. Otherwise it would\n // cause a mem leak since there would be no backprop for these tensors\n // (which would otherwise dispose them).\n if (isTapeOn) {\n const tensorsToSave =\n this.getTensorsForGradient(kernelName, inputs, outTensors);\n saved = this.saveTensorsForBackwardMode(tensorsToSave);\n }\n return outTensors;\n };\n } else {\n const {forwardFunc} = kernelParams;\n // Running a customGrad op.\n const saveFunc: GradSaveFunc = (tensors) => {\n // Do not save unless we are recording to the tape. Otherwise it would\n // cause a mem leak since we would never run backprop, which disposes\n // the kept tensors.\n if (!isTapeOn) {\n return;\n }\n saved = tensors.map(tensor => this.keep(this.clone(tensor)));\n };\n\n kernelFunc = () => {\n const numDataIdsBefore = this.backend.numDataIds();\n out = this.tidy(() => forwardFunc(this.backend, saveFunc));\n const outs = (Array.isArray(out) ? out : [out]) as Tensor[];\n if (this.shouldCheckForMemLeaks()) {\n // Scope name is used to print a more helpful error message if needed.\n this.checkKernelForMemLeak(kernelOrScopeName, numDataIdsBefore, outs);\n }\n return outs;\n };\n }\n\n //\n // Run the kernelFunc. Optionally profiling it.\n //\n const {inputs, attrs} = kernelParams;\n const backwardsFunc = isRegisteredKernelInvocation(kernelParams) ?\n null :\n kernelParams.backwardsFunc;\n\n let kernelProfile: KernelProfile;\n this.scopedRun(\n // Stop recording to a tape when running a kernel.\n () => this.state.kernelDepth++, () => this.state.kernelDepth--, () => {\n if (!this.ENV.getBool('DEBUG') && !this.state.profiling) {\n outputs = kernelFunc();\n } else {\n kernelProfile = this.profiler.profileKernel(\n kernelOrScopeName, inputs, () => kernelFunc());\n if (this.ENV.getBool('DEBUG')) {\n this.profiler.logKernelProfile(kernelProfile);\n }\n outputs = kernelProfile.outputs;\n }\n });\n\n if (isTapeOn) {\n this.addTapeNode(\n kernelOrScopeName, inputs, outputs, backwardsFunc, saved, attrs);\n }\n\n if (this.state.profiling) {\n this.state.activeProfile.kernels.push({\n name: kernelOrScopeName,\n bytesAdded: this.state.numBytes - startingBytecount,\n totalBytesSnapshot: this.state.numBytes,\n tensorsAdded: this.state.numTensors - startingNumTensors,\n totalTensorsSnapshot: this.state.numTensors,\n inputShapes: Object.keys(inputs).map(\n key => inputs[key] != null ? inputs[key].shape : null),\n outputShapes: outputs.map(item => item.shape),\n kernelTimeMs: kernelProfile.timeMs,\n extraInfo: kernelProfile.extraInfo\n });\n }\n return (Array.isArray(out) ? outputs : outputs[0]) as T;\n }\n\n /**\n * Saves tensors used in forward mode for use in backward mode.\n *\n * @param tensors the list of tensors to save.\n */\n private saveTensorsForBackwardMode(tensors: Tensor[]): Tensor[] {\n const saved = tensors.map(tensor => this.keep(this.clone(tensor)));\n return saved;\n }\n\n /**\n * Returns a list of tensors to save for a given gradient calculation.\n *\n * @param kernelName name of kernel to look up gradient for.\n * @param inputs a map of input tensors.\n * @param outputs an array of output tensors from forward mode of kernel.\n */\n private getTensorsForGradient(\n kernelName: string, inputs: NamedTensorMap,\n outputs: Tensor[]): Tensor[]|null {\n const gradConfig = getGradient(kernelName);\n if (gradConfig != null) {\n const inputsToSave: string[] = gradConfig.inputsToSave || [];\n const outputsToSave: boolean[] = gradConfig.outputsToSave || [];\n\n // If saveAllInputs is true, all inputs will be saved. Otherwise, inputs\n // specified in inputsToSave will be saved.\n let inputTensorsToSave: Tensor[];\n if (gradConfig.saveAllInputs) {\n util.assert(\n Array.isArray(inputs),\n () => 'saveAllInputs is true, expected inputs to be an array.');\n\n inputTensorsToSave = Object.keys(inputs).map((key) => inputs[key]);\n } else {\n inputTensorsToSave = inputsToSave.map((inputName) => inputs[inputName]);\n }\n\n const outputTensorsToSave: Tensor[] =\n outputs.filter((_, i) => outputsToSave[i]);\n\n return inputTensorsToSave.concat(outputTensorsToSave);\n }\n // We return an empty list rather than throw an error because the kernel we\n // are looking up may not actually be relevant to backproping through the\n // overall function\n //\n // See 'does not error if irrelevant (pruned) ops are missing grads' test\n // in gradients_test.ts for an example.\n return [];\n }\n\n /**\n * Internal method used by public APIs for tensor creation. Makes a new\n * tensor with the provided shape, dtype and values. It always\n * creates a new data id and writes the values to the underlying backend.\n */\n makeTensor(\n values: DataValues, shape: number[], dtype: DataType,\n backend?: KernelBackend): Tensor {\n if (values == null) {\n throw new Error('Values passed to engine.makeTensor() are null');\n }\n dtype = dtype || 'float32';\n backend = backend || this.backend;\n let backendVals = values as BackendValues;\n if (dtype === 'string' && util.isString(values[0])) {\n backendVals = (values as string[]).map(d => util.encodeString(d));\n }\n const dataId = backend.write(backendVals, shape, dtype);\n const t = new Tensor(shape, dtype, dataId, this.nextTensorId());\n this.trackTensor(t, backend);\n\n // Count bytes for string tensors.\n if (dtype === 'string') {\n const info = this.state.tensorInfo.get(dataId);\n const newBytes = bytesFromStringArray(backendVals as Uint8Array[]);\n this.state.numBytes += newBytes - info.bytes;\n info.bytes = newBytes;\n }\n return t;\n }\n\n /**\n * Internal method used by backends. Makes a new tensor\n * that is a wrapper around an existing data id. It doesn't create\n * a new data id, only increments the ref count used in memory tracking.\n */\n makeTensorFromDataId(\n dataId: DataId, shape: number[], dtype: DataType,\n backend?: KernelBackend): Tensor {\n dtype = dtype || 'float32';\n const t = new Tensor(shape, dtype, dataId, this.nextTensorId());\n this.trackTensor(t, backend);\n return t;\n }\n\n makeVariable(\n initialValue: Tensor, trainable = true, name?: string,\n dtype?: DataType): Variable {\n name = name || this.nextVariableId().toString();\n if (dtype != null && dtype !== initialValue.dtype) {\n initialValue = initialValue.cast(dtype);\n }\n const v = new Variable(initialValue, trainable, name, this.nextTensorId());\n if (this.state.registeredVariables[v.name] != null) {\n throw new Error(`Variable with name ${v.name} was already registered`);\n }\n this.state.registeredVariables[v.name] = v;\n this.incRef(v, this.backend);\n return v;\n }\n\n trackTensor(a: Tensor, backend: KernelBackend): void {\n this.state.numTensors++;\n if (a.dtype === 'string') {\n this.state.numStringTensors++;\n }\n // Bytes for complex numbers are counted by their components. Bytes for\n // string tensors are counted when writing values.\n let bytes = 0;\n if (a.dtype !== 'complex64' && a.dtype !== 'string') {\n bytes = a.size * util.bytesPerElement(a.dtype);\n }\n this.state.numBytes += bytes;\n\n if (!this.state.tensorInfo.has(a.dataId)) {\n this.state.numDataBuffers++;\n this.state.tensorInfo.set(a.dataId, {\n backend: backend || this.backend,\n dtype: a.dtype,\n shape: a.shape,\n bytes\n });\n }\n\n if (!(a instanceof Variable)) {\n this.track(a);\n }\n }\n\n // Track the tensor by dataId and increase the refCount for the dataId in the\n // backend.\n // TODO(pyu10055): This is currently used by makeVariable method, to increase\n // refCount on the backend for the dataId. It can potentially be replaced with\n // Identity op indead of calling backend directly.\n incRef(a: Tensor, backend: KernelBackend): void {\n this.trackTensor(a, backend);\n this.backend.incRef(a.dataId);\n }\n\n removeDataId(dataId: DataId, backend: KernelBackend) {\n if (this.state.tensorInfo.has(dataId) &&\n this.state.tensorInfo.get(dataId).backend === backend) {\n this.state.tensorInfo.delete(dataId);\n this.state.numDataBuffers--;\n }\n }\n disposeTensor(a: Tensor): void {\n if (!this.state.tensorInfo.has(a.dataId)) {\n return;\n }\n const info = this.state.tensorInfo.get(a.dataId);\n\n this.state.numTensors--;\n if (a.dtype === 'string') {\n this.state.numStringTensors--;\n this.state.numBytes -= info.bytes;\n }\n // Don't count bytes for complex numbers as they are counted by their\n // components.\n if (a.dtype !== 'complex64' && a.dtype !== 'string') {\n const bytes = a.size * util.bytesPerElement(a.dtype);\n this.state.numBytes -= bytes;\n }\n\n // Remove the reference to dataId if backend dispose the data successfully\n if (info.backend.disposeData(a.dataId)) {\n this.removeDataId(a.dataId, info.backend);\n }\n\n // TODO(nsthorat): Construct an error and save the stack trace for\n // debugging when in debug mode. Creating a stack trace is too expensive\n // to do unconditionally.\n }\n\n disposeVariables(): void {\n for (const varName in this.state.registeredVariables) {\n const v = this.state.registeredVariables[varName];\n this.disposeVariable(v);\n }\n }\n\n disposeVariable(v: Variable): void {\n this.disposeTensor(v);\n if (this.state.registeredVariables[v.name] != null) {\n delete this.state.registeredVariables[v.name];\n }\n }\n\n memory(): MemoryInfo {\n const info = this.backend.memory() as MemoryInfo;\n info.numTensors = this.state.numTensors;\n info.numDataBuffers = this.state.numDataBuffers;\n info.numBytes = this.state.numBytes;\n if (this.state.numStringTensors > 0) {\n info.unreliable = true;\n if (info.reasons == null) {\n info.reasons = [];\n }\n info.reasons.push(\n 'Memory usage by string tensors is approximate ' +\n '(2 bytes per character)');\n }\n return info;\n }\n\n async profile(query: () => (TensorContainer | Promise)):\n Promise {\n this.state.profiling = true;\n\n const startBytes = this.state.numBytes;\n const startNumTensors = this.state.numTensors;\n\n this.state.activeProfile.kernels = [];\n this.state.activeProfile.result = await query();\n\n this.state.profiling = false;\n\n this.state.activeProfile.peakBytes = Math.max(\n ...this.state.activeProfile.kernels.map(d => d.totalBytesSnapshot));\n this.state.activeProfile.newBytes = this.state.numBytes - startBytes;\n this.state.activeProfile.newTensors =\n this.state.numTensors - startNumTensors;\n for (const kernel of this.state.activeProfile.kernels) {\n kernel.kernelTimeMs = await kernel.kernelTimeMs;\n kernel.extraInfo = await kernel.extraInfo;\n }\n return this.state.activeProfile;\n }\n\n isTapeOn(): boolean {\n return this.state.gradientDepth > 0 && this.state.kernelDepth === 0;\n }\n\n private addTapeNode(\n kernelName: string, inputs: NamedTensorMap, outputs: Tensor[],\n gradientsFunc: GradFunc, saved: Tensor[], attrs: NamedAttrMap): void {\n const tapeNode: TapeNode =\n {id: this.state.nextTapeNodeId++, kernelName, inputs, outputs, saved};\n\n const gradConfig = getGradient(kernelName);\n if (gradConfig != null) {\n gradientsFunc = gradConfig.gradFunc;\n }\n if (gradientsFunc != null) {\n tapeNode.gradient = (dys: Tensor[]) => {\n // TODO(smilkov): To optimize back-prop, pass dys that are not used in\n // the backprop graph to the user as null instead of zeros\n dys = dys.map((dy, i) => {\n if (dy == null) {\n const output = outputs[i];\n const vals = util.makeZerosTypedArray(output.size, output.dtype);\n return this.makeTensor(vals, output.shape, output.dtype);\n }\n return dy;\n });\n // Grad functions of ops with single outputs expect a dy, while ops\n // with multiple outputs expect dys (array of dy).\n return gradientsFunc(dys.length > 1 ? dys : dys[0], saved, attrs);\n };\n }\n this.state.activeTape.push(tapeNode);\n }\n\n keep(result: T): T {\n result.kept = true;\n return result;\n }\n\n private startTape() {\n if (this.state.gradientDepth === 0) {\n this.state.activeTape = [];\n }\n this.state.gradientDepth++;\n }\n\n private endTape() {\n this.state.gradientDepth--;\n }\n\n /**\n * Start a scope. Use this with endScope() to achieve the same functionality\n * as scope() without the need for a function closure.\n */\n startScope(name?: string) {\n const scopeInfo: ScopeState = {\n track: [],\n name: 'unnamed scope',\n id: this.state.nextScopeId++\n };\n if (name) {\n scopeInfo.name = name;\n }\n this.state.scopeStack.push(scopeInfo);\n this.state.activeScope = scopeInfo;\n }\n\n /**\n * End a scope. Use this with startScope() to achieve the same functionality\n * as scope() without the need for a function closure.\n */\n endScope(result?: TensorContainer) {\n const tensorsToTrackInParent = getTensorsInContainer(result);\n const tensorsToTrackInParentSet =\n new Set(tensorsToTrackInParent.map(t => t.id));\n\n // Dispose the arrays tracked in this scope.\n for (let i = 0; i < this.state.activeScope.track.length; i++) {\n const tensor = this.state.activeScope.track[i];\n if (!tensor.kept && !tensorsToTrackInParentSet.has(tensor.id)) {\n tensor.dispose();\n }\n }\n\n const oldScope = this.state.scopeStack.pop();\n this.state.activeScope = this.state.scopeStack.length === 0 ?\n null :\n this.state.scopeStack[this.state.scopeStack.length - 1];\n\n // Track the current result in the parent scope.\n tensorsToTrackInParent.forEach(tensor => {\n // Only track the tensor if was allocated in the inner scope and is not\n // globally kept.\n if (!tensor.kept && tensor.scopeId === oldScope.id) {\n this.track(tensor);\n }\n });\n }\n\n /**\n * Returns gradients of `f` with respect to each of the `xs`. The gradients\n * returned are of the same length as `xs`, but some might be null if `f`\n * was not a function of that `x`. It also takes optional dy to multiply the\n * gradient, which defaults to `1`.\n */\n gradients(\n f: () => T, xs: Tensor[], dy?: T,\n allowNoGradients = false): {value: T, grads: Tensor[]} {\n util.assert(\n xs.length > 0, () => 'gradients() received an empty list of xs.');\n if (dy != null && dy.dtype !== 'float32') {\n throw new Error(`dy must have 'float32' dtype, but has '${dy.dtype}'`);\n }\n\n const y = this.scopedRun(\n () => this.startTape(), () => this.endTape(),\n () => this.tidy('forward', f));\n\n util.assert(\n y instanceof Tensor,\n () => 'The result y returned by f() must be a tensor.');\n // Filter out the nodes that don't connect x => y.\n const filteredTape = getFilteredNodesXToY(this.state.activeTape, xs, y);\n if (!allowNoGradients && filteredTape.length === 0 && xs.length > 0) {\n throw new Error(\n 'Cannot compute gradient of y=f(x) with respect to x. Make sure ' +\n 'that the f you passed encloses all operations that lead from x ' +\n 'to y.');\n }\n\n return this.tidy('backward', () => {\n const accumulatedGradientMap: {[tensorId: number]: Tensor} = {};\n accumulatedGradientMap[y.id] = (dy == null) ? ones(y.shape) : dy;\n\n // Backprop gradients through the filtered nodes.\n backpropagateGradients(\n accumulatedGradientMap, filteredTape,\n // Pass the tidy function to avoid circular dep with `tape.ts`.\n f => this.tidy(f as ScopeFn),\n // Pass an add function to avoide a circular dep with `tape.ts`.\n add);\n const grads = xs.map(x => accumulatedGradientMap[x.id]);\n\n if (this.state.gradientDepth === 0) {\n // This means that we are not computing higher-order gradients\n // and can clean up the tape.\n this.state.activeTape.forEach(node => {\n for (const tensor of node.saved) {\n tensor.dispose();\n }\n });\n this.state.activeTape = null;\n }\n return {value: y, grads};\n });\n }\n\n customGrad(f: CustomGradientFunc):\n (...args: Array) => T {\n util.assert(\n util.isFunction(f),\n () => 'The f passed in customGrad(f) must be a function.');\n return (...inputs: Tensor[]): T => {\n util.assert(\n inputs.every(t => t instanceof Tensor),\n () => 'The args passed in customGrad(f)(x1, x2,...) must all be ' +\n 'tensors');\n\n let res: {\n value: T,\n gradFunc: (dy: T, saved: Tensor[]) => Tensor | Tensor[],\n };\n const inputMap: NamedTensorMap = {};\n inputs.forEach((input, i) => {\n inputMap[i] = input;\n });\n\n const forwardFunc: ForwardFunc = (_, save) => {\n res = f(...[...inputs, save]);\n util.assert(\n res.value instanceof Tensor,\n () => 'The function f passed in customGrad(f) must return an ' +\n 'object where `obj.value` is a tensor');\n util.assert(\n util.isFunction(res.gradFunc),\n () => 'The function f passed in customGrad(f) must return an ' +\n 'object where `obj.gradFunc` is a function.');\n return res.value;\n };\n\n const backwardsFunc = (dy: T, saved: Tensor[]) => {\n const gradRes = res.gradFunc(dy, saved);\n const grads: Tensor[] = Array.isArray(gradRes) ? gradRes : [gradRes];\n util.assert(\n grads.length === inputs.length,\n () => 'The function f passed in customGrad(f) must return an ' +\n 'object where `obj.gradFunc` is a function that returns ' +\n 'the same number of tensors as inputs passed to f(...).');\n util.assert(\n grads.every(t => t instanceof Tensor),\n () => 'The function f passed in customGrad(f) must return an ' +\n 'object where `obj.gradFunc` is a function that returns ' +\n 'a list of only tensors.');\n const gradMap: {[key: string]: () => Tensor} = {};\n grads.forEach((grad, i) => {\n gradMap[i] = () => grad;\n });\n return gradMap;\n };\n\n return this.runKernelFunc({\n forwardFunc,\n backwardsFunc,\n inputs: inputMap,\n });\n };\n }\n\n readSync(dataId: DataId): BackendValues {\n // Route the read to the correct backend.\n const info = this.state.tensorInfo.get(dataId);\n return info.backend.readSync(dataId);\n }\n read(dataId: DataId): Promise {\n // Route the read to the correct backend.\n const info = this.state.tensorInfo.get(dataId);\n return info.backend.read(dataId);\n }\n\n async time(query: () => void): Promise {\n const start = now();\n const timingInfo = await this.backend.time(query) as TimingInfo;\n timingInfo.wallMs = now() - start;\n return timingInfo;\n }\n\n /**\n * Tracks a Tensor in the current scope to be automatically cleaned up\n * when the current scope ends, and returns the value.\n *\n * @param result The Tensor to track in the current scope.\n */\n private track(result: T): T {\n if (this.state.activeScope != null) {\n result.scopeId = this.state.activeScope.id;\n this.state.activeScope.track.push(result);\n }\n\n return result;\n }\n\n get registeredVariables(): NamedVariableMap {\n return this.state.registeredVariables;\n }\n\n /**\n * Resets the engine state. Removes all backends but does not remove\n * registered backend factories.\n */\n reset(): void {\n // Make any pending promise obsolete.\n this.pendingBackendInitId++;\n\n this.state.dispose();\n this.ENV.reset();\n this.state = new EngineState();\n\n for (const backendName in this.registry) {\n this.disposeRegisteredKernels(backendName);\n this.registry[backendName].dispose();\n delete this.registry[backendName];\n }\n this.backendName = null;\n this.backendInstance = null;\n this.pendingBackendInit = null;\n }\n}\n\nfunction ones(shape: number[]): Tensor {\n const values = makeOnesTypedArray(sizeFromShape(shape), 'float32');\n return ENGINE.makeTensor(values, shape, 'float32');\n}\n\nexport function getOrMakeEngine(): Engine {\n const ns = getGlobalNamespace() as {} as {_tfengine: Engine};\n if (ns._tfengine == null) {\n const environment = new Environment(ns);\n ns._tfengine = new Engine(environment);\n }\n setEnvironmentGlobal(ns._tfengine.ENV);\n\n // Tell the current tensor interface that the global engine is responsible\n // for tracking.\n setTensorTracker(() => ns._tfengine);\n return ns._tfengine;\n}\n\nexport const ENGINE = getOrMakeEngine();\n\n/**\n * A implementation of the add op for use within engine and tape.\n *\n * This allows us to avoid a circular dependency between add.ts and engine.\n * It is exported to be available in tape tests.\n */\nexport function add(a: Tensor, b: Tensor): Tensor {\n // We duplicate Add here to avoid a circular dependency with add.ts.\n const inputs = {a, b};\n return ENGINE.runKernel(Add, inputs as {} as NamedTensorMap);\n}\n", "/**\n * @license\n * Copyright 2017 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\n// tslint:disable-next-line:no-any\nfunction _isNavigatorDefined(): boolean {\n return typeof navigator !== 'undefined' && navigator != null;\n}\n\nexport function isMobile(nav?: Navigator): boolean {\n if (nav || _isNavigatorDefined()) {\n if (!nav) {\n nav = navigator;\n }\n if (nav.product === 'ReactNative') {\n return true;\n }\n\n // tslint:disable-next-line:no-any\n const a = nav.userAgent || nav.vendor || (window as any).opera;\n // tslint:disable-next-line:max-line-length\n return /(android|bb\\d+|meego).+mobile|avantgo|bada\\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i\n .test(a) ||\n // tslint:disable-next-line:max-line-length\n /1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\\-(n|u)|c55\\/|capi|ccwa|cdm\\-|cell|chtm|cldc|cmd\\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\\-s|devi|dica|dmob|do(c|p)o|ds(12|\\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\\-|_)|g1 u|g560|gene|gf\\-5|g\\-mo|go(\\.w|od)|gr(ad|un)|haie|hcit|hd\\-(m|p|t)|hei\\-|hi(pt|ta)|hp( i|ip)|hs\\-c|ht(c(\\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\\-(20|go|ma)|i230|iac( |\\-|\\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\\/)|klon|kpt |kwc\\-|kyo(c|k)|le(no|xi)|lg( g|\\/(k|l|u)|50|54|\\-[a-w])|libw|lynx|m1\\-w|m3ga|m50\\/|ma(te|ui|xo)|mc(01|21|ca)|m\\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\\-2|po(ck|rt|se)|prox|psio|pt\\-g|qa\\-a|qc(07|12|21|32|60|\\-[2-7]|i\\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\\-|oo|p\\-)|sdk\\/|se(c(\\-|0|1)|47|mc|nd|ri)|sgh\\-|shar|sie(\\-|m)|sk\\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\\-|v\\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\\-|tdg\\-|tel(i|m)|tim\\-|t\\-mo|to(pl|sh)|ts(70|m\\-|m3|m5)|tx\\-9|up(\\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\\-|your|zeto|zte\\-/i\n .test(a.substr(0, 4));\n }\n return false;\n}\n\nexport function isBrowser(): boolean {\n return (typeof window !== 'undefined' && window.document != null) ||\n //@ts-ignore\n (typeof WorkerGlobalScope !== 'undefined');\n}\n", "/**\n * @license\n * Copyright 2019 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\nimport './engine';\n\nimport * as device_util from './device_util';\nimport {env} from './environment';\n\nconst ENV = env();\n\n/**\n * This file contains environment-related flag registrations.\n */\n\n/** Whether to enable debug mode. */\nENV.registerFlag('DEBUG', () => false, debugValue => {\n if (debugValue) {\n console.warn(\n 'Debugging mode is ON. The output of every math call will ' +\n 'be downloaded to CPU and checked for NaNs. ' +\n 'This significantly impacts performance.');\n }\n});\n\n/** Whether we are in a browser (as versus, say, node.js) environment. */\nENV.registerFlag('IS_BROWSER', () => device_util.isBrowser());\n\n/** Whether we are in a browser (as versus, say, node.js) environment. */\nENV.registerFlag(\n 'IS_NODE',\n () => (typeof process !== 'undefined') &&\n (typeof process.versions !== 'undefined') &&\n (typeof process.versions.node !== 'undefined'));\n\n/** Whether this browser is Chrome. */\nENV.registerFlag(\n 'IS_CHROME',\n () => typeof navigator !== 'undefined' && navigator != null &&\n navigator.userAgent != null && /Chrome/.test(navigator.userAgent) &&\n /Google Inc/.test(navigator.vendor));\n\n/**\n * True when the environment is \"production\" where we disable safety checks\n * to gain performance.\n */\nENV.registerFlag('PROD', () => false);\n\n/**\n * Whether to do sanity checks when inferring a shape from user-provided\n * values, used when creating a new tensor.\n */\nENV.registerFlag(\n 'TENSORLIKE_CHECK_SHAPE_CONSISTENCY', () => ENV.getBool('DEBUG'));\n\n/** Whether deprecation warnings are enabled. */\nENV.registerFlag('DEPRECATION_WARNINGS_ENABLED', () => true);\n\n/** True if running unit tests. */\nENV.registerFlag('IS_TEST', () => false);\n\n/** Whether to check computation result for errors. */\nENV.registerFlag('CHECK_COMPUTATION_FOR_ERRORS', () => true);\n\n/** Whether the backend needs to wrap input to imageBitmap. */\nENV.registerFlag('WRAP_TO_IMAGEBITMAP', () => false);\n", "/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {ENGINE} from './engine';\nimport {env} from './environment';\nimport {Tensor} from './tensor';\nimport {DataType, TensorLike} from './types';\nimport {assert, flatten, inferDtype, isTypedArray, toTypedArray} from './util';\n\nexport function inferShape(val: TensorLike, dtype?: DataType): number[] {\n let firstElem: typeof val = val;\n\n if (isTypedArray(val)) {\n return dtype === 'string' ? [] : [val.length];\n }\n if (!Array.isArray(val)) {\n return []; // Scalar.\n }\n const shape: number[] = [];\n\n while (Array.isArray(firstElem) ||\n isTypedArray(firstElem) && dtype !== 'string') {\n shape.push(firstElem.length);\n firstElem = firstElem[0];\n }\n if (Array.isArray(val) &&\n env().getBool('TENSORLIKE_CHECK_SHAPE_CONSISTENCY')) {\n deepAssertShapeConsistency(val, shape, []);\n }\n\n return shape;\n}\n\nfunction deepAssertShapeConsistency(\n val: TensorLike, shape: number[], indices: number[]) {\n indices = indices || [];\n if (!(Array.isArray(val)) && !isTypedArray(val)) {\n assert(\n shape.length === 0,\n () => `Element arr[${indices.join('][')}] is a primitive, ` +\n `but should be an array/TypedArray of ${shape[0]} elements`);\n return;\n }\n assert(\n shape.length > 0,\n () => `Element arr[${indices.join('][')}] should be a primitive, ` +\n `but is an array of ${val.length} elements`);\n assert(\n val.length === shape[0],\n () => `Element arr[${indices.join('][')}] should have ${shape[0]} ` +\n `elements, but has ${val.length} elements`);\n const subShape = shape.slice(1);\n for (let i = 0; i < val.length; ++i) {\n deepAssertShapeConsistency(val[i], subShape, indices.concat(i));\n }\n}\n\nfunction assertDtype(\n expectedDtype: DataType|'numeric'|'string_or_numeric',\n actualDType: DataType, argName: string, functionName: string) {\n if (expectedDtype === 'string_or_numeric') {\n return;\n }\n if (expectedDtype == null) {\n throw new Error(`Expected dtype cannot be null.`);\n }\n if (expectedDtype !== 'numeric' && expectedDtype !== actualDType ||\n expectedDtype === 'numeric' && actualDType === 'string') {\n throw new Error(\n `Argument '${argName}' passed to '${functionName}' must ` +\n `be ${expectedDtype} tensor, but got ${actualDType} tensor`);\n }\n}\n\nexport function convertToTensor(\n x: T|TensorLike, argName: string, functionName: string,\n parseAsDtype: DataType|'numeric'|'string_or_numeric' = 'numeric'): T {\n if (x instanceof Tensor) {\n assertDtype(parseAsDtype, x.dtype, argName, functionName);\n return x;\n }\n let inferredDtype = inferDtype(x);\n // If the user expects a bool/int/float, use that info to update the\n // inferredDtype when it is not a string.\n if (inferredDtype !== 'string' &&\n ['bool', 'int32', 'float32'].indexOf(parseAsDtype) >= 0) {\n inferredDtype = parseAsDtype as DataType;\n }\n assertDtype(parseAsDtype, inferredDtype, argName, functionName);\n\n if ((x == null) ||\n (!isTypedArray(x) && !Array.isArray(x) && typeof x !== 'number' &&\n typeof x !== 'boolean' && typeof x !== 'string')) {\n const type = x == null ? 'null' : (x as {}).constructor.name;\n throw new Error(\n `Argument '${argName}' passed to '${functionName}' must be a ` +\n `Tensor or TensorLike, but got '${type}'`);\n }\n const inferredShape = inferShape(x, inferredDtype);\n if (!isTypedArray(x) && !Array.isArray(x)) {\n x = [x] as number[];\n }\n const skipTypedArray = true;\n const values = inferredDtype !== 'string' ?\n toTypedArray(x, inferredDtype as DataType) :\n flatten(x as string[], [], skipTypedArray) as string[];\n return ENGINE.makeTensor(values, inferredShape, inferredDtype) as T;\n}\n\nexport function convertToTensorArray(\n arg: Array, argName: string, functionName: string,\n parseAsDtype: DataType|'numeric'|'string_or_numeric' = 'numeric'): T[] {\n if (!Array.isArray(arg)) {\n throw new Error(\n `Argument ${argName} passed to ${functionName} must be a ` +\n '`Tensor[]` or `TensorLike[]`');\n }\n const tensors = arg as T[];\n return tensors.map(\n (t, i) =>\n convertToTensor(t, `${argName}[${i}]`, functionName, parseAsDtype));\n}\n", "/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\nimport {ENGINE} from '../engine';\nimport {isPromise} from '../util';\n\nexport const OP_SCOPE_SUFFIX = '__op';\n\n/**\n * Used for wrapping functions that perform math operations on\n * Tensors. The function will be wrapped in a named scope that cleans all\n * memory usage after the function is done.\n */\nexport function op(f: {[name: string]: T}): T {\n const keys = Object.keys(f);\n if (keys.length !== 1) {\n throw new Error(\n `Please provide an object with a single key ` +\n `(operation name) mapping to a function. Got an object with ` +\n `${keys.length} keys.`);\n }\n\n let opName = keys[0];\n const fn = f[opName];\n\n // Strip the underscore from the end of the function name.\n if (opName.endsWith('_')) {\n opName = opName.substring(0, opName.length - 1);\n }\n\n // add an __op suffix to distinguish ops from kernels in tf.profile\n opName = opName + OP_SCOPE_SUFFIX;\n\n // tslint:disable-next-line:no-any\n const f2 = (...args: any[]) => {\n ENGINE.startScope(opName);\n try {\n const result = fn(...args);\n if (isPromise(result)) {\n console.error('Cannot return a Promise inside of tidy.');\n }\n ENGINE.endScope(result);\n return result;\n } catch (ex) {\n ENGINE.endScope(null);\n throw ex;\n }\n };\n Object.defineProperty(f2, 'name', {value: opName, configurable: true});\n\n // tslint:disable-next-line:no-any\n return f2 as any as T;\n}\n", "/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\nimport {ENGINE} from '../engine';\nimport {Complex, ComplexInputs} from '../kernel_names';\nimport {Tensor} from '../tensor';\nimport {NamedTensorMap} from '../tensor_types';\nimport {convertToTensor} from '../tensor_util_env';\nimport {TensorLike} from '../types';\nimport * as util from '../util';\n\nimport {op} from './operation';\n\n/**\n * Converts two real numbers to a complex number.\n *\n * Given a tensor `real` representing the real part of a complex number, and a\n * tensor `imag` representing the imaginary part of a complex number, this\n * operation returns complex numbers elementwise of the form [r0, i0, r1, i1],\n * where r represents the real part and i represents the imag part.\n *\n * The input tensors real and imag must have the same shape.\n *\n * ```js\n * const real = tf.tensor1d([2.25, 3.25]);\n * const imag = tf.tensor1d([4.75, 5.75]);\n * const complex = tf.complex(real, imag);\n *\n * complex.print();\n * ```\n *\n * @doc {heading: 'Tensors', subheading: 'Creation'}\n */\nfunction complex_(real: T|TensorLike, imag: T|TensorLike): T {\n const $real = convertToTensor(real, 'real', 'complex');\n const $imag = convertToTensor(imag, 'imag', 'complex');\n util.assertShapesMatch(\n $real.shape, $imag.shape,\n `real and imag shapes, ${$real.shape} and ${$imag.shape}, ` +\n `must match in call to tf.complex().`);\n\n const inputs: ComplexInputs = {real: $real, imag: $imag};\n return ENGINE.runKernel(Complex, inputs as {} as NamedTensorMap);\n}\n\nexport const complex = op({complex_});\n", "/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {ENGINE} from '../engine';\nimport {Tensor} from '../tensor';\nimport {TensorLike, TypedArray} from '../types';\nimport {DataType} from '../types';\nimport {assert, assertNonNegativeIntegerDimensions, flatten, inferDtype, isTypedArray, sizeFromShape, toTypedArray} from '../util';\n\n/** This is shared code across all tensor creation methods. */\nexport function makeTensor(\n values: TensorLike, shape: number[], inferredShape: number[],\n dtype?: DataType): Tensor {\n if (dtype == null) {\n dtype = inferDtype(values);\n }\n if (dtype === 'complex64') {\n throw new Error(\n `Cannot construct a complex64 tensor directly. ` +\n `Please use tf.complex(real, imag).`);\n }\n if (!isTypedArray(values) && !Array.isArray(values) &&\n typeof values !== 'number' && typeof values !== 'boolean' &&\n typeof values !== 'string') {\n throw new Error(\n 'values passed to tensor(values) must be a number/boolean/string or ' +\n 'an array of numbers/booleans/strings, or a TypedArray');\n }\n if (shape != null) {\n assertNonNegativeIntegerDimensions(shape);\n\n const providedSize = sizeFromShape(shape);\n const inferredSize = sizeFromShape(inferredShape);\n assert(\n providedSize === inferredSize,\n () =>\n `Based on the provided shape, [${shape}], the tensor should have ` +\n `${providedSize} values but has ${inferredSize}`);\n\n for (let i = 0; i < inferredShape.length; ++i) {\n const inferred = inferredShape[i];\n const flatDimsDontMatch = i === inferredShape.length - 1 ?\n inferred !== sizeFromShape(shape.slice(i)) :\n true;\n assert(\n inferredShape[i] === shape[i] || !flatDimsDontMatch,\n () => `Error creating a new Tensor. Inferred shape ` +\n `(${inferredShape}) does not match the provided ` +\n `shape (${shape}). `);\n }\n }\n\n if (!isTypedArray(values) && !Array.isArray(values)) {\n values = [values] as number[];\n }\n\n shape = shape || inferredShape;\n values = dtype !== 'string' ?\n toTypedArray(values, dtype) :\n flatten(values as string[], [], true) as string[];\n return ENGINE.makeTensor(values as TypedArray, shape, dtype);\n}\n", "/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {Tensor} from '../tensor';\nimport {inferShape} from '../tensor_util_env';\nimport {TensorLike} from '../types';\nimport {DataType, Rank, ShapeMap} from '../types';\n\nimport {makeTensor} from './tensor_ops_util';\n\n/**\n * Creates a `tf.Tensor` with the provided values, shape and dtype.\n *\n * ```js\n * // Pass an array of values to create a vector.\n * tf.tensor([1, 2, 3, 4]).print();\n * ```\n *\n * ```js\n * // Pass a nested array of values to make a matrix or a higher\n * // dimensional tensor.\n * tf.tensor([[1, 2], [3, 4]]).print();\n * ```\n *\n * ```js\n * // Pass a flat array and specify a shape yourself.\n * tf.tensor([1, 2, 3, 4], [2, 2]).print();\n * ```\n *\n * @param values The values of the tensor. Can be nested array of numbers,\n * or a flat array, or a `TypedArray`. If the values are strings,\n * they will be encoded as utf-8 and kept as `Uint8Array[]`.\n * @param shape The shape of the tensor. Optional. If not provided,\n * it is inferred from `values`.\n * @param dtype The data type.\n *\n * @doc {heading: 'Tensors', subheading: 'Creation'}\n */\nexport function tensor(\n values: TensorLike, shape?: ShapeMap[R], dtype?: DataType): Tensor {\n const inferredShape = inferShape(values, dtype);\n return makeTensor(values, shape, inferredShape, dtype) as Tensor;\n}\n", "/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\n/* Type definitions for exporting and importing of models. */\n\n/**\n * A map from Tensor dtype to number of bytes per element of the Tensor.\n */\nexport const DTYPE_VALUE_SIZE_MAP: {[dtype: string]: number} = {\n 'float32': 4,\n 'float16': 2,\n 'int32': 4,\n 'uint16': 2,\n 'uint8': 1,\n 'bool': 1,\n 'complex64': 8\n};\n\n/**\n * A weight manifest.\n *\n * The weight manifest consists of an ordered list of weight-manifest groups.\n * Each weight-manifest group (\"group\" for short hereafter) consists of a\n * number of weight values stored in a number of paths.\n * See the documentation of `WeightManifestGroupConfig` below for more details.\n */\nexport declare type WeightsManifestConfig = WeightsManifestGroupConfig[];\n\n/**\n * A weight-manifest group.\n *\n * Consists of an ordered list of weight values encoded in binary format,\n * stored in an ordered list of paths.\n */\nexport declare interface WeightsManifestGroupConfig {\n /**\n * An ordered list of paths.\n *\n * Paths are intentionally abstract in order to be general. For example, they\n * can be relative URL paths or relative paths on the file system.\n */\n paths: string[];\n\n /**\n * Specifications of the weights stored in the paths.\n */\n weights: WeightsManifestEntry[];\n}\n\n/**\n * Group to which the weight belongs.\n *\n * - 'optimizer': Weight from a stateful optimizer.\n */\nexport type WeightGroup = 'model'|'optimizer';\n\n/**\n * An entry in the weight manifest.\n *\n * The entry contains specification of a weight.\n */\nexport declare interface WeightsManifestEntry {\n /**\n * Name of the weight, e.g., 'Dense_1/bias'\n */\n name: string;\n\n /**\n * Shape of the weight.\n */\n shape: number[];\n\n /**\n * Data type of the weight.\n */\n dtype: 'float32'|'int32'|'bool'|'string'|'complex64';\n\n /**\n * Type of the weight.\n *\n * Optional.\n *\n * The value 'optimizer' indicates the weight belongs to an optimizer\n * (i.e., used only during model training and not during inference).\n */\n group?: WeightGroup;\n\n /**\n * Information for dequantization of the weight.\n */\n quantization?: {\n scale?: number, // The scaling constant to multiply by.\n min?: number, // The (possibly nudged) minimum weight to add.\n dtype: 'uint16'|'uint8'|'float16' // The dtype of the quantized weights.\n };\n}\n\n/**\n * Options for saving a model.\n * @innamespace io\n */\nexport interface SaveConfig {\n /**\n * Whether to save only the trainable weights of the model, ignoring the\n * non-trainable ones.\n */\n trainableOnly?: boolean;\n\n /**\n * Whether the optimizer will be saved (if exists).\n *\n * Default: `false`.\n */\n includeOptimizer?: boolean;\n}\n\n/**\n * Result of a saving operation.\n */\nexport interface SaveResult {\n /**\n * Information about the model artifacts saved.\n */\n modelArtifactsInfo: ModelArtifactsInfo;\n\n /**\n * HTTP responses from the server that handled the model-saving request (if\n * any). This is applicable only to server-based saving routes.\n */\n responses?: Response[];\n\n /**\n * Error messages and related data (if any).\n */\n errors?: Array<{}|string>;\n}\n\nexport declare interface ModelArtifactsInfo {\n /**\n * Timestamp for when the model is saved.\n */\n dateSaved: Date;\n\n /**\n * TODO (cais,yassogba) consider removing GraphDef as GraphDefs now\n * come in a JSON format and none of our IOHandlers support a non json\n * format. We could conder replacing this with 'Binary' if we want to\n * allow future handlers to save to non json formats (though they will\n * probably want more information than 'Binary').\n * Type of the model topology\n *\n * Type of the model topology\n *\n * Possible values:\n * - JSON: JSON config (human-readable, e.g., Keras JSON).\n * - GraphDef: TensorFlow\n * [GraphDef](https://www.tensorflow.org/extend/tool_developers/#graphdef)\n * protocol buffer (binary).\n */\n modelTopologyType: 'JSON'|'GraphDef';\n\n /**\n * Size of model topology (Keras JSON or GraphDef), in bytes.\n */\n modelTopologyBytes?: number;\n\n /**\n * Size of weight specification or manifest, in bytes.\n */\n weightSpecsBytes?: number;\n\n /**\n * Size of weight value data, in bytes.\n */\n weightDataBytes?: number;\n}\n\n/** Model training configuration. */\nexport declare interface TrainingConfig {\n // TODO(cais): Tighten the typing once keras spec is available to tfjs-core.\n // See\n // tslint:disable-next-line:max-line-length\n // https://github.com/tensorflow/tfjs-layers/blob/master/src/keras_format/training_config.ts\n /** Optimizer used for the model training. */\n optimizer_config: {};\n\n // TODO(cais): Tighten the typing once keras spec is available to tfjs-core.\n /** Loss function(s) for the model's output(s). */\n loss: string|string[]|{[key: string]: string};\n\n // TODO(cais): Tighten the typing once keras spec is available to tfjs-core.\n /** Metric function(s) for the model's output(s). */\n metrics?: string[]|{[key: string]: string};\n\n // TODO(cais): Tighten the typing once keras spec is available to tfjs-core.\n weighted_metrics?: string[];\n\n // TODO(cais): Tighten the typing once keras spec is available to tfjs-core.\n sample_weight_mode?: string;\n\n loss_weights?: number[]|{[key: string]: number};\n}\n\n/**\n * The serialized artifacts of a model, including topology and weights.\n *\n * The `modelTopology`, `trainingConfig`, `weightSpecs` and `weightData` fields\n * of this interface are optional, in order to support topology- or weights-only\n * saving and loading.\n *\n * Note this interface is used internally in IOHandlers. For the file format\n * written to disk as `model.json`, see `ModelJSON`.\n */\nexport declare interface ModelArtifacts {\n /**\n * Model topology.\n *\n * For Keras-style `tf.Model`s, this is a JSON object.\n * For TensorFlow-style models (e.g., `SavedModel`), this is the JSON\n * encoding of the `GraphDef` protocol buffer.\n */\n modelTopology?: {}|ArrayBuffer;\n\n /**\n * Serialized configuration for the model's training.\n */\n trainingConfig?: TrainingConfig;\n\n /**\n * Weight specifications.\n *\n * This corresponds to the weightsData below.\n */\n weightSpecs?: WeightsManifestEntry[];\n\n /**\n * Binary buffer for all weight values concatenated in the order specified\n * by `weightSpecs`.\n */\n weightData?: ArrayBuffer;\n\n /**\n * Hard-coded format name for models saved from TensorFlow.js or converted\n * by TensorFlow.js Converter.\n */\n format?: string;\n\n /**\n * What library is responsible for originally generating this artifact.\n *\n * Used for debugging purposes. E.g., 'TensorFlow.js v1.0.0'.\n */\n generatedBy?: string;\n\n /**\n * What library or tool is responsible for converting the original model\n * to this format, applicable only if the model is output by a converter.\n *\n * Used for debugging purposes. E.g., 'TensorFlow.js Converter v1.0.0'.\n *\n * A value of `null` means the model artifacts are generated without any\n * conversion process (e.g., saved directly from a TensorFlow.js\n * `tf.LayersModel` instance.)\n */\n convertedBy?: string|null;\n\n /**\n * Inputs and outputs signature for saved model.\n */\n signature?: {};\n\n /**\n * User-defined metadata about the model.\n */\n userDefinedMetadata?: {[key: string]: {}};\n\n /**\n * Initializer for the model.\n */\n modelInitializer?: {};\n}\n\n/**\n * The on-disk format of the `model.json` file.\n *\n * TF.js 1.0 always populates the optional fields when writing model.json.\n * Prior versions did not provide those fields.\n */\nexport declare interface ModelJSON {\n /**\n * Model topology.\n *\n * For Keras-style `tf.Model`s, this is a JSON object.\n * For TensorFlow-style models (e.g., `SavedModel`), this is the JSON\n * encoding of the `GraphDef` protocol buffer.\n */\n modelTopology: {};\n\n /** Model training configuration. */\n trainingConfig?: TrainingConfig;\n\n /**\n * Weights manifest.\n *\n * The weights manifest consists of an ordered list of weight-manifest\n * groups. Each weight-manifest group consists of a number of weight values\n * stored in a number of paths. See the documentation of\n * `WeightsManifestConfig` for more details.\n */\n weightsManifest: WeightsManifestConfig;\n\n /**\n * Hard-coded format name for models saved from TensorFlow.js or converted\n * by TensorFlow.js Converter.\n */\n format?: string;\n\n /**\n * What library is responsible for originally generating this artifact.\n *\n * Used for debugging purposes. E.g., 'TensorFlow.js v1.0.0'.\n */\n generatedBy?: string;\n\n /**\n * What library or tool is responsible for converting the original model\n * to this format, applicable only if the model is output by a converter.\n *\n * Used for debugging purposes. E.g., 'TensorFlow.js Converter v1.0.0'.\n *\n * A value of `null` means the model artifacts are generated without any\n * conversion process (e.g., saved directly from a TensorFlow.js\n * `tf.LayersModel` instance.)\n */\n convertedBy?: string|null;\n\n /**\n * Inputs and outputs signature for saved model.\n */\n signature?: {};\n\n /**\n * User-defined metadata about the model.\n */\n userDefinedMetadata?: {[key: string]: {}};\n\n /**\n * Initializer for the model.\n */\n modelInitializer?: {};\n}\n\n/**\n * Type definition for handlers of loading operations.\n */\nexport type LoadHandler = () => Promise;\n\n/**\n * Type definition for handlers of saving operations.\n */\nexport type SaveHandler = (modelArtifact: ModelArtifacts) =>\n Promise;\n\n/**\n * Interface for a model import/export handler.\n *\n * The `save` and `load` handlers are both optional, in order to allow handlers\n * that support only saving or loading.\n */\n// tslint:disable-next-line:interface-name\nexport interface IOHandler {\n save?: SaveHandler;\n load?: LoadHandler;\n}\n\n/**\n * An interface for the manager of a model store.\n *\n * A model store is defined as a storage medium on which multiple models can\n * be stored. Each stored model has a unique `path` as its identifier.\n * A `ModelStoreManager` for the store allows actions including\n *\n * - Listing the models stored in the store.\n * - Deleting a model from the store.\n */\nexport interface ModelStoreManager {\n /**\n * List all models in the model store.\n *\n * @returns A dictionary mapping paths of existing models to their\n * model artifacts info. Model artifacts info include type of the model's\n * topology, byte sizes of the topology, weights, etc.\n */\n listModels(): Promise<{[path: string]: ModelArtifactsInfo}>;\n\n /**\n * Remove a model specified by `path`.\n *\n * @param path\n * @returns ModelArtifactsInfo of the deleted model (if and only if deletion\n * is successful).\n * @throws Error if deletion fails, e.g., if no model exists at `path`.\n */\n removeModel(path: string): Promise;\n}\n\n/**\n * Callback for the progress of a long-running action such as an HTTP\n * request for a large binary object.\n *\n * `fraction` should be a number in the [0, 1] interval, indicating how\n * much of the action has completed.\n */\nexport type OnProgressCallback = (fraction: number) => void;\n\n/** @innamespace io */\nexport interface LoadOptions {\n /**\n * RequestInit (options) for HTTP requests.\n *\n * For detailed information on the supported fields, see\n * [https://developer.mozilla.org/en-US/docs/Web/API/Request/Request](\n * https://developer.mozilla.org/en-US/docs/Web/API/Request/Request)\n */\n requestInit?: RequestInit;\n\n /**\n * Progress callback.\n */\n onProgress?: OnProgressCallback;\n\n /**\n * A function used to override the `window.fetch` function.\n */\n fetchFunc?: Function;\n\n /**\n * Strict loading model: whether extraneous weights or missing\n * weights should trigger an `Error`.\n *\n * If `true`, require that the provided weights exactly match those\n * required by the layers. `false` means that both extra weights\n * and missing weights will be silently ignored.\n *\n * Default: `true`.\n */\n strict?: boolean;\n\n /**\n * Path prefix for weight files, by default this is calculated from the\n * path of the model JSON file.\n *\n * For instance, if the path to the model JSON file is\n * `http://localhost/foo/model.json`, then the default path prefix will be\n * `http://localhost/foo/`. If a weight file has the path value\n * `group1-shard1of2` in the weight manifest, then the weight file will be\n * loaded from `http://localhost/foo/group1-shard1of2` by default. However,\n * if you provide a `weightPathPrefix` value of\n * `http://localhost/foo/alt-weights`, then the weight file will be loaded\n * from the path `http://localhost/foo/alt-weights/group1-shard1of2` instead.\n */\n weightPathPrefix?: string;\n\n /**\n * Whether the module or model is to be loaded from TF Hub.\n *\n * Setting this to `true` allows passing a TF-Hub module URL, omitting the\n * standard model file name and the query parameters.\n *\n * Default: `false`.\n */\n fromTFHub?: boolean;\n\n /**\n * An async function to convert weight file name to URL. The weight file\n * names are stored in model.json's weightsManifest.paths field. By default we\n * consider weight files are colocated with the model.json file. For example:\n * model.json URL: https://www.google.com/models/1/model.json\n * group1-shard1of1.bin url:\n * https://www.google.com/models/1/group1-shard1of1.bin\n *\n * With this func you can convert the weight file name to any URL.\n */\n weightUrlConverter?: (weightFileName: string) => Promise;\n}\n\n/**\n * Additional options for Platform.fetch\n */\nexport interface RequestDetails {\n /**\n * Is this request for a binary file (as opposed to a json file)\n */\n isBinary?: boolean;\n}\n", "/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {complex} from '../ops/complex';\n\nimport {tensor} from '../ops/tensor';\nimport {NamedTensor, NamedTensorMap} from '../tensor_types';\nimport {TypedArray} from '../types';\nimport {sizeFromShape} from '../util';\n\nimport {DTYPE_VALUE_SIZE_MAP, ModelArtifacts, ModelArtifactsInfo, WeightGroup, WeightsManifestEntry} from './types';\n\n/** Number of bytes reserved for the length of the string. (32bit integer). */\nconst NUM_BYTES_STRING_LENGTH = 4;\n\n/**\n * Encode a map from names to weight values as an ArrayBuffer, along with an\n * `Array` of `WeightsManifestEntry` as specification of the encoded weights.\n *\n * This function does not perform sharding.\n *\n * This function is the reverse of `decodeWeights`.\n *\n * @param tensors A map (\"dict\") from names to tensors.\n * @param group Group to which the weights belong (optional).\n * @returns A `Promise` of\n * - A flat `ArrayBuffer` with all the binary values of the `Tensor`s\n * concatenated.\n * - An `Array` of `WeightManifestEntry`s, carrying information including\n * tensor names, `dtype`s and shapes.\n * @throws Error: on unsupported tensor `dtype`.\n */\nexport async function encodeWeights(\n tensors: NamedTensorMap|NamedTensor[], group?: WeightGroup):\n Promise<{data: ArrayBuffer, specs: WeightsManifestEntry[]}> {\n // TODO(adarob, cais): Support quantization.\n const specs: WeightsManifestEntry[] = [];\n const dataPromises: Array> = [];\n\n const names: string[] = Array.isArray(tensors) ?\n tensors.map(tensor => tensor.name) :\n Object.keys(tensors);\n\n for (let i = 0; i < names.length; ++i) {\n const name = names[i];\n const t = Array.isArray(tensors) ? tensors[i].tensor : tensors[name];\n if (t.dtype !== 'float32' && t.dtype !== 'int32' && t.dtype !== 'bool' &&\n t.dtype !== 'string' && t.dtype !== 'complex64') {\n throw new Error(`Unsupported dtype in weight '${name}': ${t.dtype}`);\n }\n const spec: WeightsManifestEntry = {name, shape: t.shape, dtype: t.dtype};\n if (t.dtype === 'string') {\n const utf8bytes = new Promise(async resolve => {\n const vals = await t.bytes() as Uint8Array[];\n const totalNumBytes = vals.reduce((p, c) => p + c.length, 0) +\n NUM_BYTES_STRING_LENGTH * vals.length;\n const bytes = new Uint8Array(totalNumBytes);\n let offset = 0;\n for (let i = 0; i < vals.length; i++) {\n const val = vals[i];\n const bytesOfLength =\n new Uint8Array(new Uint32Array([val.length]).buffer);\n bytes.set(bytesOfLength, offset);\n offset += NUM_BYTES_STRING_LENGTH;\n bytes.set(val, offset);\n offset += val.length;\n }\n resolve(bytes);\n });\n dataPromises.push(utf8bytes);\n } else {\n dataPromises.push(t.data());\n }\n if (group != null) {\n spec.group = group;\n }\n specs.push(spec);\n }\n\n const tensorValues = await Promise.all(dataPromises);\n return {data: concatenateTypedArrays(tensorValues), specs};\n}\n\n/**\n * Decode flat ArrayBuffer as weights.\n *\n * This function does not handle sharding.\n *\n * This function is the reverse of `encodeWeights`.\n *\n * @param buffer A flat ArrayBuffer carrying the binary values of the tensors\n * concatenated in the order specified in `specs`.\n * @param specs Specifications of the names, dtypes and shapes of the tensors\n * whose value are encoded by `buffer`.\n * @return A map from tensor name to tensor value, with the names corresponding\n * to names in `specs`.\n * @throws Error, if any of the tensors has unsupported dtype.\n */\nexport function decodeWeights(\n buffer: ArrayBuffer, specs: WeightsManifestEntry[]): NamedTensorMap {\n // TODO(adarob, cais): Support quantization.\n const out: NamedTensorMap = {};\n let float16Decode: (buffer: Uint16Array) => Float32Array | undefined;\n let offset = 0;\n for (const spec of specs) {\n const name = spec.name;\n const dtype = spec.dtype;\n const shape = spec.shape;\n const size = sizeFromShape(shape);\n let values: TypedArray|string[]|Uint8Array[];\n\n if ('quantization' in spec) {\n const quantization = spec.quantization;\n if (quantization.dtype === 'uint8' || quantization.dtype === 'uint16') {\n if (!('min' in quantization && 'scale' in quantization)) {\n throw new Error(\n `Weight ${spec.name} with quantization ${quantization.dtype} ` +\n `doesn't have corresponding metadata min and scale.`);\n }\n } else if (quantization.dtype === 'float16') {\n if (dtype !== 'float32') {\n throw new Error(\n `Weight ${spec.name} is quantized with ${quantization.dtype} ` +\n `which only supports weights of type float32 not ${dtype}.`);\n }\n } else {\n throw new Error(\n `Weight ${spec.name} has unknown ` +\n `quantization dtype ${quantization.dtype}. ` +\n `Supported quantization dtypes are: ` +\n `'uint8', 'uint16', and 'float16'.`);\n }\n const quantizationSizeFactor = DTYPE_VALUE_SIZE_MAP[quantization.dtype];\n const byteBuffer =\n buffer.slice(offset, offset + size * quantizationSizeFactor);\n const quantizedArray = (quantization.dtype === 'uint8') ?\n new Uint8Array(byteBuffer) :\n new Uint16Array(byteBuffer);\n if (dtype === 'float32') {\n if (quantization.dtype === 'uint8' || quantization.dtype === 'uint16') {\n values = new Float32Array(quantizedArray.length);\n for (let i = 0; i < quantizedArray.length; i++) {\n const v = quantizedArray[i];\n values[i] = v * quantization.scale + quantization.min;\n }\n } else if (quantization.dtype === 'float16') {\n if (float16Decode === undefined) {\n float16Decode = getFloat16Decoder();\n }\n values = float16Decode(quantizedArray as Uint16Array);\n } else {\n throw new Error(\n `Unsupported quantization type ${quantization.dtype} ` +\n `for weight type float32.`);\n }\n } else if (dtype === 'int32') {\n if (quantization.dtype !== 'uint8' && quantization.dtype !== 'uint16') {\n throw new Error(\n `Unsupported quantization type ${quantization.dtype} ` +\n `for weight type int32.`);\n }\n values = new Int32Array(quantizedArray.length);\n for (let i = 0; i < quantizedArray.length; i++) {\n const v = quantizedArray[i];\n values[i] = Math.round(v * quantization.scale + quantization.min);\n }\n } else {\n throw new Error(`Unsupported dtype in weight '${name}': ${dtype}`);\n }\n offset += size * quantizationSizeFactor;\n } else if (dtype === 'string') {\n const size = sizeFromShape(spec.shape);\n values = [];\n for (let i = 0; i < size; i++) {\n const byteLength = new Uint32Array(\n buffer.slice(offset, offset + NUM_BYTES_STRING_LENGTH))[0];\n offset += NUM_BYTES_STRING_LENGTH;\n const bytes = new Uint8Array(buffer.slice(offset, offset + byteLength));\n (values as Uint8Array[]).push(bytes);\n offset += byteLength;\n }\n } else {\n const dtypeFactor = DTYPE_VALUE_SIZE_MAP[dtype];\n const byteBuffer = buffer.slice(offset, offset + size * dtypeFactor);\n\n if (dtype === 'float32') {\n values = new Float32Array(byteBuffer);\n } else if (dtype === 'int32') {\n values = new Int32Array(byteBuffer);\n } else if (dtype === 'bool') {\n values = new Uint8Array(byteBuffer);\n } else if (dtype === 'complex64') {\n values = new Float32Array(byteBuffer);\n const real = new Float32Array(values.length / 2);\n const image = new Float32Array(values.length / 2);\n for (let i = 0; i < real.length; i++) {\n real[i] = values[i * 2];\n image[i] = values[i * 2 + 1];\n }\n const realTensor = tensor(real, shape, 'float32');\n const imageTensor = tensor(image, shape, 'float32');\n out[name] = complex(realTensor, imageTensor);\n realTensor.dispose();\n imageTensor.dispose();\n } else {\n throw new Error(`Unsupported dtype in weight '${name}': ${dtype}`);\n }\n offset += size * dtypeFactor;\n }\n if (dtype !== 'complex64') {\n out[name] = tensor(values, shape, dtype);\n }\n }\n return out;\n}\n\n/**\n * Concatenate TypedArrays into an ArrayBuffer.\n */\nexport function concatenateTypedArrays(xs: TypedArray[]): ArrayBuffer {\n // TODO(adarob, cais): Support quantization.\n if (xs === null) {\n throw new Error(`Invalid input value: ${JSON.stringify(xs)}`);\n }\n\n let totalByteLength = 0;\n\n // `normalizedXs` is here for this reason: a `TypedArray`'s `buffer'\n // can have a different byte length from that of the `TypedArray` itself,\n // for example, when the `TypedArray` is created from an offset in an\n // `ArrayBuffer`. `normliazedXs` holds `TypedArray`s whose `buffer`s match\n // the `TypedArray` in byte length. If an element of `xs` does not show\n // this property, a new `TypedArray` that satisfy this property will be\n // constructed and pushed into `normalizedXs`.\n const normalizedXs: TypedArray[] = [];\n xs.forEach((x: TypedArray) => {\n totalByteLength += x.byteLength;\n // tslint:disable:no-any\n normalizedXs.push(\n x.byteLength === x.buffer.byteLength ? x :\n new (x.constructor as any)(x));\n if (!(x as any instanceof Float32Array || x as any instanceof Int32Array ||\n x as any instanceof Uint8Array)) {\n throw new Error(`Unsupported TypedArray subtype: ${x.constructor.name}`);\n }\n // tslint:enable:no-any\n });\n\n const y = new Uint8Array(totalByteLength);\n let offset = 0;\n normalizedXs.forEach((x: TypedArray) => {\n y.set(new Uint8Array(x.buffer), offset);\n offset += x.byteLength;\n });\n\n return y.buffer;\n}\n\n// Use Buffer on Node.js instead of Blob/atob/btoa\nconst useNodeBuffer = typeof Buffer !== 'undefined' &&\n (typeof Blob === 'undefined' || typeof atob === 'undefined' ||\n typeof btoa === 'undefined');\n\n/**\n * Calculate the byte length of a JavaScript string.\n *\n * Note that a JavaScript string can contain wide characters, therefore the\n * length of the string is not necessarily equal to the byte length.\n *\n * @param str Input string.\n * @returns Byte length.\n */\nexport function stringByteLength(str: string): number {\n if (useNodeBuffer) {\n return Buffer.byteLength(str);\n }\n return new Blob([str]).size;\n}\n\n/**\n * Encode an ArrayBuffer as a base64 encoded string.\n *\n * @param buffer `ArrayBuffer` to be converted.\n * @returns A string that base64-encodes `buffer`.\n */\nexport function arrayBufferToBase64String(buffer: ArrayBuffer): string {\n if (useNodeBuffer) {\n return Buffer.from(buffer).toString('base64');\n }\n const buf = new Uint8Array(buffer);\n let s = '';\n for (let i = 0, l = buf.length; i < l; i++) {\n s += String.fromCharCode(buf[i]);\n }\n return btoa(s);\n}\n\n/**\n * Decode a base64 string as an ArrayBuffer.\n *\n * @param str Base64 string.\n * @returns Decoded `ArrayBuffer`.\n */\nexport function base64StringToArrayBuffer(str: string): ArrayBuffer {\n if (useNodeBuffer) {\n const buf = Buffer.from(str, 'base64');\n return buf.buffer.slice(buf.byteOffset, buf.byteOffset + buf.byteLength);\n }\n const s = atob(str);\n const buffer = new Uint8Array(s.length);\n for (let i = 0; i < s.length; ++i) {\n buffer.set([s.charCodeAt(i)], i);\n }\n return buffer.buffer;\n}\n\n/**\n * Concatenate a number of ArrayBuffers into one.\n *\n * @param buffers A number of array buffers to concatenate.\n * @returns Result of concatenating `buffers` in order.\n */\nexport function concatenateArrayBuffers(buffers: ArrayBuffer[]): ArrayBuffer {\n if (buffers.length === 1) {\n return buffers[0];\n }\n\n let totalByteLength = 0;\n buffers.forEach((buffer: ArrayBuffer) => {\n totalByteLength += buffer.byteLength;\n });\n\n const temp = new Uint8Array(totalByteLength);\n let offset = 0;\n buffers.forEach((buffer: ArrayBuffer) => {\n temp.set(new Uint8Array(buffer), offset);\n offset += buffer.byteLength;\n });\n return temp.buffer;\n}\n\n/**\n * Get the basename of a path.\n *\n * Behaves in a way analogous to Linux's basename command.\n *\n * @param path\n */\nexport function basename(path: string): string {\n const SEPARATOR = '/';\n path = path.trim();\n while (path.endsWith(SEPARATOR)) {\n path = path.slice(0, path.length - 1);\n }\n const items = path.split(SEPARATOR);\n return items[items.length - 1];\n}\n\n/**\n * Populate ModelArtifactsInfo fields for a model with JSON topology.\n * @param modelArtifacts\n * @returns A ModelArtifactsInfo object.\n */\nexport function getModelArtifactsInfoForJSON(modelArtifacts: ModelArtifacts):\n ModelArtifactsInfo {\n if (modelArtifacts.modelTopology instanceof ArrayBuffer) {\n throw new Error('Expected JSON model topology, received ArrayBuffer.');\n }\n\n return {\n dateSaved: new Date(),\n modelTopologyType: 'JSON',\n modelTopologyBytes: modelArtifacts.modelTopology == null ?\n 0 :\n stringByteLength(JSON.stringify(modelArtifacts.modelTopology)),\n weightSpecsBytes: modelArtifacts.weightSpecs == null ?\n 0 :\n stringByteLength(JSON.stringify(modelArtifacts.weightSpecs)),\n weightDataBytes: modelArtifacts.weightData == null ?\n 0 :\n modelArtifacts.weightData.byteLength,\n };\n}\n\n/**\n * Computes mantisa table for casting Float16 to Float32\n * See http://www.fox-toolkit.org/ftp/fasthalffloatconversion.pdf\n *\n * @returns Uint32Array, 2048 mantissa lookup values.\n */\nfunction computeFloat16MantisaTable(): Uint32Array {\n const convertMantissa = (i: number): number => {\n let m = i << 13;\n let e = 0;\n\n while ((m & 0x00800000) === 0) {\n e -= 0x00800000;\n m <<= 1;\n }\n m &= ~0x00800000;\n e += 0x38800000;\n\n return m | e;\n };\n\n const mantisaTable = new Uint32Array(2048);\n\n mantisaTable[0] = 0;\n for (let i = 1; i < 1024; i++) {\n mantisaTable[i] = convertMantissa(i);\n }\n for (let i = 1024; i < 2048; i++) {\n mantisaTable[i] = 0x38000000 + ((i - 1024) << 13);\n }\n\n return mantisaTable;\n}\n\n/**\n * Computes exponent table for casting Float16 to Float32\n * See http://www.fox-toolkit.org/ftp/fasthalffloatconversion.pdf\n *\n * @returns Uint32Array, 64 exponent lookup values.\n */\nfunction computeFloat16ExponentTable(): Uint32Array {\n const exponentTable = new Uint32Array(64);\n\n exponentTable[0] = 0;\n exponentTable[31] = 0x47800000;\n exponentTable[32] = 0x80000000;\n exponentTable[63] = 0xc7800000;\n for (let i = 1; i < 31; i++) {\n exponentTable[i] = i << 23;\n }\n for (let i = 33; i < 63; i++) {\n exponentTable[i] = 0x80000000 + ((i - 32) << 23);\n }\n\n return exponentTable;\n}\n\n/**\n * Computes offset table for casting Float16 to Float32\n * See http://www.fox-toolkit.org/ftp/fasthalffloatconversion.pdf\n *\n * @returns Uint32Array, 6d offset values.\n */\nfunction computeFloat16OffsetTable(): Uint32Array {\n const offsetTable = new Uint32Array(64);\n\n for (let i = 0; i < 64; i++) {\n offsetTable[i] = 1024;\n }\n offsetTable[0] = offsetTable[32] = 0;\n\n return offsetTable;\n}\n\n/**\n * Retrieve a Float16 decoder which will decode a ByteArray of Float16 values\n * to a Float32Array.\n *\n * @returns Function (buffer: Uint16Array) => Float32Array which decodes\n * the Uint16Array of Float16 bytes to a Float32Array.\n */\nexport function getFloat16Decoder(): (buffer: Uint16Array) => Float32Array {\n // Algorithm is based off of\n // http://www.fox-toolkit.org/ftp/fasthalffloatconversion.pdf\n\n // Cache lookup tables\n const mantisaTable = computeFloat16MantisaTable();\n const exponentTable = computeFloat16ExponentTable();\n const offsetTable = computeFloat16OffsetTable();\n\n return (quantizedArray: Uint16Array) => {\n const buffer = new ArrayBuffer(4 * quantizedArray.length);\n const bufferUint32View = new Uint32Array(buffer);\n for (let index = 0; index < quantizedArray.length; index++) {\n const float16Bits = quantizedArray[index];\n const float32Bits =\n mantisaTable[offsetTable[float16Bits >> 10] + (float16Bits & 0x3ff)] +\n exponentTable[float16Bits >> 10];\n bufferUint32View[index] = float32Bits;\n }\n return new Float32Array(buffer);\n };\n}\n", "/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {IOHandler, LoadOptions} from './types';\n\nexport type IORouter = (url: string|string[], loadOptions?: LoadOptions) =>\n IOHandler;\n\nexport class IORouterRegistry {\n // Singleton instance.\n private static instance: IORouterRegistry;\n\n private saveRouters: IORouter[];\n private loadRouters: IORouter[];\n\n private constructor() {\n this.saveRouters = [];\n this.loadRouters = [];\n }\n\n private static getInstance(): IORouterRegistry {\n if (IORouterRegistry.instance == null) {\n IORouterRegistry.instance = new IORouterRegistry();\n }\n return IORouterRegistry.instance;\n }\n\n /**\n * Register a save-handler router.\n *\n * @param saveRouter A function that maps a URL-like string onto an instance\n * of `IOHandler` with the `save` method defined or `null`.\n */\n static registerSaveRouter(saveRouter: IORouter) {\n IORouterRegistry.getInstance().saveRouters.push(saveRouter);\n }\n\n /**\n * Register a load-handler router.\n *\n * @param loadRouter A function that maps a URL-like string onto an instance\n * of `IOHandler` with the `load` method defined or `null`.\n */\n static registerLoadRouter(loadRouter: IORouter) {\n IORouterRegistry.getInstance().loadRouters.push(loadRouter);\n }\n\n /**\n * Look up IOHandler for saving, given a URL-like string.\n *\n * @param url\n * @returns If only one match is found, an instance of IOHandler with the\n * `save` method defined. If no match is found, `null`.\n * @throws Error, if more than one match is found.\n */\n static getSaveHandlers(url: string|string[]): IOHandler[] {\n return IORouterRegistry.getHandlers(url, 'save');\n }\n\n /**\n * Look up IOHandler for loading, given a URL-like string.\n *\n * @param url\n * @param loadOptions Optional, custom load options.\n * @returns All valid handlers for `url`, given the currently registered\n * handler routers.\n */\n static getLoadHandlers(url: string|string[], loadOptions?: LoadOptions):\n IOHandler[] {\n return IORouterRegistry.getHandlers(url, 'load', loadOptions);\n }\n\n private static getHandlers(\n url: string|string[], handlerType: 'save'|'load',\n loadOptions?: LoadOptions): IOHandler[] {\n const validHandlers: IOHandler[] = [];\n const routers = handlerType === 'load' ?\n IORouterRegistry.getInstance().loadRouters :\n IORouterRegistry.getInstance().saveRouters;\n routers.forEach(router => {\n const handler = router(url, loadOptions);\n if (handler !== null) {\n validHandlers.push(handler);\n }\n });\n return validHandlers;\n }\n}\n\nexport const registerSaveRouter = (loudRouter: IORouter) =>\n IORouterRegistry.registerSaveRouter(loudRouter);\nexport const registerLoadRouter = (loudRouter: IORouter) =>\n IORouterRegistry.registerLoadRouter(loudRouter);\nexport const getSaveHandlers = (url: string|string[]) =>\n IORouterRegistry.getSaveHandlers(url);\nexport const getLoadHandlers =\n (url: string|string[], loadOptions?: LoadOptions) =>\n IORouterRegistry.getLoadHandlers(url, loadOptions);\n", "/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport '../flags';\n\nimport {env} from '../environment';\n\nimport {getModelArtifactsInfoForJSON} from './io_utils';\nimport {IORouter, IORouterRegistry} from './router_registry';\nimport {IOHandler, ModelArtifacts, ModelArtifactsInfo, ModelStoreManager, SaveResult} from './types';\n\nconst DATABASE_NAME = 'tensorflowjs';\nconst DATABASE_VERSION = 1;\n\n// Model data and ModelArtifactsInfo (metadata) are stored in two separate\n// stores for efficient access of the list of stored models and their metadata.\n// 1. The object store for model data: topology, weights and weight manifests.\nconst MODEL_STORE_NAME = 'models_store';\n// 2. The object store for ModelArtifactsInfo, including meta-information such\n// as the type of topology (JSON vs binary), byte size of the topology, byte\n// size of the weights, etc.\nconst INFO_STORE_NAME = 'model_info_store';\n\n/**\n * Delete the entire database for tensorflow.js, including the models store.\n */\nexport async function deleteDatabase(): Promise {\n const idbFactory = getIndexedDBFactory();\n\n return new Promise((resolve, reject) => {\n const deleteRequest = idbFactory.deleteDatabase(DATABASE_NAME);\n deleteRequest.onsuccess = () => resolve();\n deleteRequest.onerror = error => reject(error);\n });\n}\n\nfunction getIndexedDBFactory(): IDBFactory {\n if (!env().getBool('IS_BROWSER')) {\n // TODO(cais): Add more info about what IOHandler subtypes are available.\n // Maybe point to a doc page on the web and/or automatically determine\n // the available IOHandlers and print them in the error message.\n throw new Error(\n 'Failed to obtain IndexedDB factory because the current environment' +\n 'is not a web browser.');\n }\n // tslint:disable-next-line:no-any\n const theWindow: any = typeof window === 'undefined' ? self : window;\n const factory = theWindow.indexedDB || theWindow.mozIndexedDB ||\n theWindow.webkitIndexedDB || theWindow.msIndexedDB ||\n theWindow.shimIndexedDB;\n if (factory == null) {\n throw new Error(\n 'The current browser does not appear to support IndexedDB.');\n }\n return factory;\n}\n\nfunction setUpDatabase(openRequest: IDBRequest) {\n const db = openRequest.result as IDBDatabase;\n db.createObjectStore(MODEL_STORE_NAME, {keyPath: 'modelPath'});\n db.createObjectStore(INFO_STORE_NAME, {keyPath: 'modelPath'});\n}\n\n/**\n * IOHandler subclass: Browser IndexedDB.\n *\n * See the doc string of `browserIndexedDB` for more details.\n */\nexport class BrowserIndexedDB implements IOHandler {\n protected readonly indexedDB: IDBFactory;\n protected readonly modelPath: string;\n\n static readonly URL_SCHEME = 'indexeddb://';\n\n constructor(modelPath: string) {\n this.indexedDB = getIndexedDBFactory();\n\n if (modelPath == null || !modelPath) {\n throw new Error(\n 'For IndexedDB, modelPath must not be null, undefined or empty.');\n }\n this.modelPath = modelPath;\n }\n\n async save(modelArtifacts: ModelArtifacts): Promise {\n // TODO(cais): Support saving GraphDef models.\n if (modelArtifacts.modelTopology instanceof ArrayBuffer) {\n throw new Error(\n 'BrowserLocalStorage.save() does not support saving model topology ' +\n 'in binary formats yet.');\n }\n\n return this.databaseAction(this.modelPath, modelArtifacts) as\n Promise;\n }\n\n async load(): Promise {\n return this.databaseAction(this.modelPath) as Promise;\n }\n\n /**\n * Perform database action to put model artifacts into or read model artifacts\n * from IndexedDB object store.\n *\n * Whether the action is put or get depends on whether `modelArtifacts` is\n * specified. If it is specified, the action will be put; otherwise the action\n * will be get.\n *\n * @param modelPath A unique string path for the model.\n * @param modelArtifacts If specified, it will be the model artifacts to be\n * stored in IndexedDB.\n * @returns A `Promise` of `SaveResult`, if the action is put, or a `Promise`\n * of `ModelArtifacts`, if the action is get.\n */\n private databaseAction(modelPath: string, modelArtifacts?: ModelArtifacts):\n Promise {\n return new Promise((resolve, reject) => {\n const openRequest = this.indexedDB.open(DATABASE_NAME, DATABASE_VERSION);\n openRequest.onupgradeneeded = () => setUpDatabase(openRequest);\n\n openRequest.onsuccess = () => {\n const db = openRequest.result;\n\n if (modelArtifacts == null) {\n // Read model out from object store.\n const modelTx = db.transaction(MODEL_STORE_NAME, 'readonly');\n const modelStore = modelTx.objectStore(MODEL_STORE_NAME);\n const getRequest = modelStore.get(this.modelPath);\n getRequest.onsuccess = () => {\n if (getRequest.result == null) {\n db.close();\n return reject(new Error(\n `Cannot find model with path '${this.modelPath}' ` +\n `in IndexedDB.`));\n } else {\n resolve(getRequest.result.modelArtifacts);\n }\n };\n getRequest.onerror = error => {\n db.close();\n return reject(getRequest.error);\n };\n modelTx.oncomplete = () => db.close();\n } else {\n // Put model into object store.\n const modelArtifactsInfo: ModelArtifactsInfo =\n getModelArtifactsInfoForJSON(modelArtifacts);\n // First, put ModelArtifactsInfo into info store.\n const infoTx = db.transaction(INFO_STORE_NAME, 'readwrite');\n let infoStore = infoTx.objectStore(INFO_STORE_NAME);\n const putInfoRequest =\n infoStore.put({modelPath: this.modelPath, modelArtifactsInfo});\n let modelTx: IDBTransaction;\n putInfoRequest.onsuccess = () => {\n // Second, put model data into model store.\n modelTx = db.transaction(MODEL_STORE_NAME, 'readwrite');\n const modelStore = modelTx.objectStore(MODEL_STORE_NAME);\n const putModelRequest = modelStore.put({\n modelPath: this.modelPath,\n modelArtifacts,\n modelArtifactsInfo\n });\n putModelRequest.onsuccess = () => resolve({modelArtifactsInfo});\n putModelRequest.onerror = error => {\n // If the put-model request fails, roll back the info entry as\n // well.\n infoStore = infoTx.objectStore(INFO_STORE_NAME);\n const deleteInfoRequest = infoStore.delete(this.modelPath);\n deleteInfoRequest.onsuccess = () => {\n db.close();\n return reject(putModelRequest.error);\n };\n deleteInfoRequest.onerror = error => {\n db.close();\n return reject(putModelRequest.error);\n };\n };\n };\n putInfoRequest.onerror = error => {\n db.close();\n return reject(putInfoRequest.error);\n };\n infoTx.oncomplete = () => {\n if (modelTx == null) {\n db.close();\n } else {\n modelTx.oncomplete = () => db.close();\n }\n };\n }\n };\n openRequest.onerror = error => reject(openRequest.error);\n });\n }\n}\n\nexport const indexedDBRouter: IORouter = (url: string|string[]) => {\n if (!env().getBool('IS_BROWSER')) {\n return null;\n } else {\n if (!Array.isArray(url) && url.startsWith(BrowserIndexedDB.URL_SCHEME)) {\n return browserIndexedDB(url.slice(BrowserIndexedDB.URL_SCHEME.length));\n } else {\n return null;\n }\n }\n};\nIORouterRegistry.registerSaveRouter(indexedDBRouter);\nIORouterRegistry.registerLoadRouter(indexedDBRouter);\n\n/**\n * Creates a browser IndexedDB IOHandler for saving and loading models.\n *\n * ```js\n * const model = tf.sequential();\n * model.add(\n * tf.layers.dense({units: 1, inputShape: [100], activation: 'sigmoid'}));\n *\n * const saveResult = await model.save('indexeddb://MyModel'));\n * console.log(saveResult);\n * ```\n *\n * @param modelPath A unique identifier for the model to be saved. Must be a\n * non-empty string.\n * @returns An instance of `BrowserIndexedDB` (sublcass of `IOHandler`),\n * which can be used with, e.g., `tf.Model.save`.\n */\nexport function browserIndexedDB(modelPath: string): IOHandler {\n return new BrowserIndexedDB(modelPath);\n}\n\nfunction maybeStripScheme(key: string) {\n return key.startsWith(BrowserIndexedDB.URL_SCHEME) ?\n key.slice(BrowserIndexedDB.URL_SCHEME.length) :\n key;\n}\n\nexport class BrowserIndexedDBManager implements ModelStoreManager {\n private indexedDB: IDBFactory;\n\n constructor() {\n this.indexedDB = getIndexedDBFactory();\n }\n\n async listModels(): Promise<{[path: string]: ModelArtifactsInfo}> {\n return new Promise<{[path: string]: ModelArtifactsInfo}>(\n (resolve, reject) => {\n const openRequest =\n this.indexedDB.open(DATABASE_NAME, DATABASE_VERSION);\n openRequest.onupgradeneeded = () => setUpDatabase(openRequest);\n\n openRequest.onsuccess = () => {\n const db = openRequest.result;\n const tx = db.transaction(INFO_STORE_NAME, 'readonly');\n const store = tx.objectStore(INFO_STORE_NAME);\n // tslint:disable:max-line-length\n // Need to cast `store` as `any` here because TypeScript's DOM\n // library does not have the `getAll()` method even though the\n // method is supported in the latest version of most mainstream\n // browsers:\n // https://developer.mozilla.org/en-US/docs/Web/API/IDBObjectStore/getAll\n // tslint:enable:max-line-length\n // tslint:disable-next-line:no-any\n const getAllInfoRequest = (store as any).getAll() as IDBRequest;\n getAllInfoRequest.onsuccess = () => {\n const out: {[path: string]: ModelArtifactsInfo} = {};\n for (const item of getAllInfoRequest.result) {\n out[item.modelPath] = item.modelArtifactsInfo;\n }\n resolve(out);\n };\n getAllInfoRequest.onerror = error => {\n db.close();\n return reject(getAllInfoRequest.error);\n };\n tx.oncomplete = () => db.close();\n };\n openRequest.onerror = error => reject(openRequest.error);\n });\n }\n\n async removeModel(path: string): Promise {\n path = maybeStripScheme(path);\n return new Promise((resolve, reject) => {\n const openRequest = this.indexedDB.open(DATABASE_NAME, DATABASE_VERSION);\n openRequest.onupgradeneeded = () => setUpDatabase(openRequest);\n\n openRequest.onsuccess = () => {\n const db = openRequest.result;\n const infoTx = db.transaction(INFO_STORE_NAME, 'readwrite');\n const infoStore = infoTx.objectStore(INFO_STORE_NAME);\n\n const getInfoRequest = infoStore.get(path);\n let modelTx: IDBTransaction;\n getInfoRequest.onsuccess = () => {\n if (getInfoRequest.result == null) {\n db.close();\n return reject(new Error(\n `Cannot find model with path '${path}' ` +\n `in IndexedDB.`));\n } else {\n // First, delete the entry in the info store.\n const deleteInfoRequest = infoStore.delete(path);\n const deleteModelData = () => {\n // Second, delete the entry in the model store.\n modelTx = db.transaction(MODEL_STORE_NAME, 'readwrite');\n const modelStore = modelTx.objectStore(MODEL_STORE_NAME);\n const deleteModelRequest = modelStore.delete(path);\n deleteModelRequest.onsuccess = () =>\n resolve(getInfoRequest.result.modelArtifactsInfo);\n deleteModelRequest.onerror = error =>\n reject(getInfoRequest.error);\n };\n // Proceed with deleting model data regardless of whether deletion\n // of info data succeeds or not.\n deleteInfoRequest.onsuccess = deleteModelData;\n deleteInfoRequest.onerror = error => {\n deleteModelData();\n db.close();\n return reject(getInfoRequest.error);\n };\n }\n };\n getInfoRequest.onerror = error => {\n db.close();\n return reject(getInfoRequest.error);\n };\n\n infoTx.oncomplete = () => {\n if (modelTx == null) {\n db.close();\n } else {\n modelTx.oncomplete = () => db.close();\n }\n };\n };\n openRequest.onerror = error => reject(openRequest.error);\n });\n }\n}\n", "/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport '../flags';\nimport {env} from '../environment';\n\nimport {assert} from '../util';\nimport {arrayBufferToBase64String, base64StringToArrayBuffer, getModelArtifactsInfoForJSON} from './io_utils';\nimport {IORouter, IORouterRegistry} from './router_registry';\nimport {IOHandler, ModelArtifacts, ModelArtifactsInfo, ModelStoreManager, SaveResult} from './types';\n\nconst PATH_SEPARATOR = '/';\nconst PATH_PREFIX = 'tensorflowjs_models';\nconst INFO_SUFFIX = 'info';\nconst MODEL_TOPOLOGY_SUFFIX = 'model_topology';\nconst WEIGHT_SPECS_SUFFIX = 'weight_specs';\nconst WEIGHT_DATA_SUFFIX = 'weight_data';\nconst MODEL_METADATA_SUFFIX = 'model_metadata';\n\n/**\n * Purge all tensorflow.js-saved model artifacts from local storage.\n *\n * @returns Paths of the models purged.\n */\nexport function purgeLocalStorageArtifacts(): string[] {\n if (!env().getBool('IS_BROWSER') || typeof window === 'undefined' ||\n typeof window.localStorage === 'undefined') {\n throw new Error(\n 'purgeLocalStorageModels() cannot proceed because local storage is ' +\n 'unavailable in the current environment.');\n }\n const LS = window.localStorage;\n const purgedModelPaths: string[] = [];\n for (let i = 0; i < LS.length; ++i) {\n const key = LS.key(i);\n const prefix = PATH_PREFIX + PATH_SEPARATOR;\n if (key.startsWith(prefix) && key.length > prefix.length) {\n LS.removeItem(key);\n const modelName = getModelPathFromKey(key);\n if (purgedModelPaths.indexOf(modelName) === -1) {\n purgedModelPaths.push(modelName);\n }\n }\n }\n return purgedModelPaths;\n}\n\nfunction getModelKeys(path: string): {\n info: string,\n topology: string,\n weightSpecs: string,\n weightData: string,\n modelMetadata: string\n} {\n return {\n info: [PATH_PREFIX, path, INFO_SUFFIX].join(PATH_SEPARATOR),\n topology: [PATH_PREFIX, path, MODEL_TOPOLOGY_SUFFIX].join(PATH_SEPARATOR),\n weightSpecs: [PATH_PREFIX, path, WEIGHT_SPECS_SUFFIX].join(PATH_SEPARATOR),\n weightData: [PATH_PREFIX, path, WEIGHT_DATA_SUFFIX].join(PATH_SEPARATOR),\n modelMetadata:\n [PATH_PREFIX, path, MODEL_METADATA_SUFFIX].join(PATH_SEPARATOR)\n };\n}\n\n/**\n * Get model path from a local-storage key.\n *\n * E.g., 'tensorflowjs_models/my/model/1/info' --> 'my/model/1'\n *\n * @param key\n */\nfunction getModelPathFromKey(key: string) {\n const items = key.split(PATH_SEPARATOR);\n if (items.length < 3) {\n throw new Error(`Invalid key format: ${key}`);\n }\n return items.slice(1, items.length - 1).join(PATH_SEPARATOR);\n}\n\nfunction maybeStripScheme(key: string) {\n return key.startsWith(BrowserLocalStorage.URL_SCHEME) ?\n key.slice(BrowserLocalStorage.URL_SCHEME.length) :\n key;\n}\n\ndeclare type LocalStorageKeys = {\n info: string,\n topology: string,\n weightSpecs: string,\n weightData: string,\n modelMetadata: string\n};\n\n/**\n * IOHandler subclass: Browser Local Storage.\n *\n * See the doc string to `browserLocalStorage` for more details.\n */\nexport class BrowserLocalStorage implements IOHandler {\n protected readonly LS: Storage;\n protected readonly modelPath: string;\n protected readonly keys: LocalStorageKeys;\n\n static readonly URL_SCHEME = 'localstorage://';\n\n constructor(modelPath: string) {\n if (!env().getBool('IS_BROWSER') || typeof window === 'undefined' ||\n typeof window.localStorage === 'undefined') {\n // TODO(cais): Add more info about what IOHandler subtypes are\n // available.\n // Maybe point to a doc page on the web and/or automatically determine\n // the available IOHandlers and print them in the error message.\n throw new Error(\n 'The current environment does not support local storage.');\n }\n this.LS = window.localStorage;\n\n if (modelPath == null || !modelPath) {\n throw new Error(\n 'For local storage, modelPath must not be null, undefined or empty.');\n }\n this.modelPath = modelPath;\n this.keys = getModelKeys(this.modelPath);\n }\n\n /**\n * Save model artifacts to browser local storage.\n *\n * See the documentation to `browserLocalStorage` for details on the saved\n * artifacts.\n *\n * @param modelArtifacts The model artifacts to be stored.\n * @returns An instance of SaveResult.\n */\n async save(modelArtifacts: ModelArtifacts): Promise {\n if (modelArtifacts.modelTopology instanceof ArrayBuffer) {\n throw new Error(\n 'BrowserLocalStorage.save() does not support saving model topology ' +\n 'in binary formats yet.');\n } else {\n const topology = JSON.stringify(modelArtifacts.modelTopology);\n const weightSpecs = JSON.stringify(modelArtifacts.weightSpecs);\n\n const modelArtifactsInfo: ModelArtifactsInfo =\n getModelArtifactsInfoForJSON(modelArtifacts);\n\n try {\n this.LS.setItem(this.keys.info, JSON.stringify(modelArtifactsInfo));\n this.LS.setItem(this.keys.topology, topology);\n this.LS.setItem(this.keys.weightSpecs, weightSpecs);\n this.LS.setItem(\n this.keys.weightData,\n arrayBufferToBase64String(modelArtifacts.weightData));\n const result: ModelArtifacts = {\n format: modelArtifacts.format,\n generatedBy: modelArtifacts.generatedBy,\n convertedBy: modelArtifacts.convertedBy\n };\n if (modelArtifacts.signature != null) {\n result.signature = modelArtifacts.signature;\n }\n if (modelArtifacts.userDefinedMetadata != null) {\n result.userDefinedMetadata = modelArtifacts.userDefinedMetadata;\n }\n if (modelArtifacts.modelInitializer != null) {\n result.modelInitializer = modelArtifacts.modelInitializer;\n }\n this.LS.setItem(this.keys.modelMetadata, JSON.stringify(result));\n\n return {modelArtifactsInfo};\n } catch (err) {\n // If saving failed, clean up all items saved so far.\n this.LS.removeItem(this.keys.info);\n this.LS.removeItem(this.keys.topology);\n this.LS.removeItem(this.keys.weightSpecs);\n this.LS.removeItem(this.keys.weightData);\n this.LS.removeItem(this.keys.modelMetadata);\n\n throw new Error(\n `Failed to save model '${this.modelPath}' to local storage: ` +\n `size quota being exceeded is a possible cause of this failure: ` +\n `modelTopologyBytes=${modelArtifactsInfo.modelTopologyBytes}, ` +\n `weightSpecsBytes=${modelArtifactsInfo.weightSpecsBytes}, ` +\n `weightDataBytes=${modelArtifactsInfo.weightDataBytes}.`);\n }\n }\n }\n\n /**\n * Load a model from local storage.\n *\n * See the documentation to `browserLocalStorage` for details on the saved\n * artifacts.\n *\n * @returns The loaded model (if loading succeeds).\n */\n async load(): Promise {\n const info =\n JSON.parse(this.LS.getItem(this.keys.info)) as ModelArtifactsInfo;\n if (info == null) {\n throw new Error(\n `In local storage, there is no model with name '${this.modelPath}'`);\n }\n\n if (info.modelTopologyType !== 'JSON') {\n throw new Error(\n 'BrowserLocalStorage does not support loading non-JSON model ' +\n 'topology yet.');\n }\n\n const out: ModelArtifacts = {};\n\n // Load topology.\n const topology = JSON.parse(this.LS.getItem(this.keys.topology));\n if (topology == null) {\n throw new Error(\n `In local storage, the topology of model '${this.modelPath}' ` +\n `is missing.`);\n }\n out.modelTopology = topology;\n\n // Load weight specs.\n const weightSpecs = JSON.parse(this.LS.getItem(this.keys.weightSpecs));\n if (weightSpecs == null) {\n throw new Error(\n `In local storage, the weight specs of model '${this.modelPath}' ` +\n `are missing.`);\n }\n out.weightSpecs = weightSpecs;\n\n // Load meta-data fields.\n const metadataString = this.LS.getItem(this.keys.modelMetadata);\n if (metadataString != null) {\n const metadata = JSON.parse(metadataString) as ModelArtifacts;\n out.format = metadata['format'];\n out.generatedBy = metadata['generatedBy'];\n out.convertedBy = metadata['convertedBy'];\n if (metadata['signature'] != null) {\n out.signature = metadata['signature'];\n }\n if (metadata['userDefinedMetadata'] != null) {\n out.userDefinedMetadata = metadata['userDefinedMetadata'];\n }\n if (metadata['modelInitializer'] != null) {\n out.modelInitializer = metadata['modelInitializer'];\n }\n }\n\n // Load weight data.\n const weightDataBase64 = this.LS.getItem(this.keys.weightData);\n if (weightDataBase64 == null) {\n throw new Error(\n `In local storage, the binary weight values of model ` +\n `'${this.modelPath}' are missing.`);\n }\n out.weightData = base64StringToArrayBuffer(weightDataBase64);\n\n return out;\n }\n}\n\nexport const localStorageRouter: IORouter = (url: string|string[]) => {\n if (!env().getBool('IS_BROWSER')) {\n return null;\n } else {\n if (!Array.isArray(url) && url.startsWith(BrowserLocalStorage.URL_SCHEME)) {\n return browserLocalStorage(\n url.slice(BrowserLocalStorage.URL_SCHEME.length));\n } else {\n return null;\n }\n }\n};\nIORouterRegistry.registerSaveRouter(localStorageRouter);\nIORouterRegistry.registerLoadRouter(localStorageRouter);\n\n/**\n * Factory function for local storage IOHandler.\n *\n * This `IOHandler` supports both `save` and `load`.\n *\n * For each model's saved artifacts, four items are saved to local storage.\n * - `${PATH_SEPARATOR}/${modelPath}/info`: Contains meta-info about the\n * model, such as date saved, type of the topology, size in bytes, etc.\n * - `${PATH_SEPARATOR}/${modelPath}/topology`: Model topology. For Keras-\n * style models, this is a stringized JSON.\n * - `${PATH_SEPARATOR}/${modelPath}/weight_specs`: Weight specs of the\n * model, can be used to decode the saved binary weight values (see\n * item below).\n * - `${PATH_SEPARATOR}/${modelPath}/weight_data`: Concatenated binary\n * weight values, stored as a base64-encoded string.\n *\n * Saving may throw an `Error` if the total size of the artifacts exceed the\n * browser-specific quota.\n *\n * @param modelPath A unique identifier for the model to be saved. Must be a\n * non-empty string.\n * @returns An instance of `IOHandler`, which can be used with, e.g.,\n * `tf.Model.save`.\n */\nexport function browserLocalStorage(modelPath: string): IOHandler {\n return new BrowserLocalStorage(modelPath);\n}\n\nexport class BrowserLocalStorageManager implements ModelStoreManager {\n private readonly LS: Storage;\n\n constructor() {\n assert(\n env().getBool('IS_BROWSER'),\n () => 'Current environment is not a web browser');\n assert(\n typeof window === 'undefined' ||\n typeof window.localStorage !== 'undefined',\n () => 'Current browser does not appear to support localStorage');\n this.LS = window.localStorage;\n }\n\n async listModels(): Promise<{[path: string]: ModelArtifactsInfo}> {\n const out: {[path: string]: ModelArtifactsInfo} = {};\n const prefix = PATH_PREFIX + PATH_SEPARATOR;\n const suffix = PATH_SEPARATOR + INFO_SUFFIX;\n for (let i = 0; i < this.LS.length; ++i) {\n const key = this.LS.key(i);\n if (key.startsWith(prefix) && key.endsWith(suffix)) {\n const modelPath = getModelPathFromKey(key);\n out[modelPath] = JSON.parse(this.LS.getItem(key)) as ModelArtifactsInfo;\n }\n }\n return out;\n }\n\n async removeModel(path: string): Promise {\n path = maybeStripScheme(path);\n const keys = getModelKeys(path);\n if (this.LS.getItem(keys.info) == null) {\n throw new Error(`Cannot find model at path '${path}'`);\n }\n const info = JSON.parse(this.LS.getItem(keys.info)) as ModelArtifactsInfo;\n\n this.LS.removeItem(keys.info);\n this.LS.removeItem(keys.topology);\n this.LS.removeItem(keys.weightSpecs);\n this.LS.removeItem(keys.weightData);\n return info;\n }\n}\n", "/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\n/**\n * Classes and functions for model management across multiple storage mediums.\n *\n * Supported client actions:\n * - Listing models on all registered storage mediums.\n * - Remove model by URL from any registered storage mediums, by using URL\n * string.\n * - Moving or copying model from one path to another in the same medium or from\n * one medium to another, by using URL strings.\n */\n\nimport {assert} from '../util';\n\nimport {IORouterRegistry} from './router_registry';\nimport {ModelArtifactsInfo, ModelStoreManager} from './types';\n\nconst URL_SCHEME_SUFFIX = '://';\n\nexport class ModelStoreManagerRegistry {\n // Singleton instance.\n private static instance: ModelStoreManagerRegistry;\n\n private managers: {[scheme: string]: ModelStoreManager};\n\n private constructor() {\n this.managers = {};\n }\n\n private static getInstance(): ModelStoreManagerRegistry {\n if (ModelStoreManagerRegistry.instance == null) {\n ModelStoreManagerRegistry.instance = new ModelStoreManagerRegistry();\n }\n return ModelStoreManagerRegistry.instance;\n }\n\n /**\n * Register a save-handler router.\n *\n * @param saveRouter A function that maps a URL-like string onto an instance\n * of `IOHandler` with the `save` method defined or `null`.\n */\n static registerManager(scheme: string, manager: ModelStoreManager) {\n assert(scheme != null, () => 'scheme must not be undefined or null.');\n if (scheme.endsWith(URL_SCHEME_SUFFIX)) {\n scheme = scheme.slice(0, scheme.indexOf(URL_SCHEME_SUFFIX));\n }\n assert(scheme.length > 0, () => 'scheme must not be an empty string.');\n const registry = ModelStoreManagerRegistry.getInstance();\n assert(\n registry.managers[scheme] == null,\n () => `A model store manager is already registered for scheme '${\n scheme}'.`);\n registry.managers[scheme] = manager;\n }\n\n static getManager(scheme: string): ModelStoreManager {\n const manager = this.getInstance().managers[scheme];\n if (manager == null) {\n throw new Error(`Cannot find model manager for scheme '${scheme}'`);\n }\n return manager;\n }\n\n static getSchemes(): string[] {\n return Object.keys(this.getInstance().managers);\n }\n}\n\n/**\n * Helper method for parsing a URL string into a scheme and a path.\n *\n * @param url E.g., 'localstorage://my-model'\n * @returns A dictionary with two fields: scheme and path.\n * Scheme: e.g., 'localstorage' in the example above.\n * Path: e.g., 'my-model' in the example above.\n */\nfunction parseURL(url: string): {scheme: string, path: string} {\n if (url.indexOf(URL_SCHEME_SUFFIX) === -1) {\n throw new Error(\n `The url string provided does not contain a scheme. ` +\n `Supported schemes are: ` +\n `${ModelStoreManagerRegistry.getSchemes().join(',')}`);\n }\n return {\n scheme: url.split(URL_SCHEME_SUFFIX)[0],\n path: url.split(URL_SCHEME_SUFFIX)[1],\n };\n}\n\nasync function cloneModelInternal(\n sourceURL: string, destURL: string,\n deleteSource = false): Promise {\n assert(\n sourceURL !== destURL,\n () => `Old path and new path are the same: '${sourceURL}'`);\n\n const loadHandlers = IORouterRegistry.getLoadHandlers(sourceURL);\n assert(\n loadHandlers.length > 0,\n () => `Copying failed because no load handler is found for source URL ${\n sourceURL}.`);\n assert(\n loadHandlers.length < 2,\n () => `Copying failed because more than one (${loadHandlers.length}) ` +\n `load handlers for source URL ${sourceURL}.`);\n const loadHandler = loadHandlers[0];\n\n const saveHandlers = IORouterRegistry.getSaveHandlers(destURL);\n assert(\n saveHandlers.length > 0,\n () => `Copying failed because no save handler is found for destination ` +\n `URL ${destURL}.`);\n assert(\n saveHandlers.length < 2,\n () => `Copying failed because more than one (${loadHandlers.length}) ` +\n `save handlers for destination URL ${destURL}.`);\n const saveHandler = saveHandlers[0];\n\n const sourceScheme = parseURL(sourceURL).scheme;\n const sourcePath = parseURL(sourceURL).path;\n const sameMedium = sourceScheme === parseURL(sourceURL).scheme;\n\n const modelArtifacts = await loadHandler.load();\n\n // If moving within the same storage medium, remove the old model as soon as\n // the loading is done. Without doing this, it is possible that the combined\n // size of the two models will cause the cloning to fail.\n if (deleteSource && sameMedium) {\n await ModelStoreManagerRegistry.getManager(sourceScheme)\n .removeModel(sourcePath);\n }\n\n const saveResult = await saveHandler.save(modelArtifacts);\n\n // If moving between mediums, the deletion is done after the save succeeds.\n // This guards against the case in which saving to the destination medium\n // fails.\n if (deleteSource && !sameMedium) {\n await ModelStoreManagerRegistry.getManager(sourceScheme)\n .removeModel(sourcePath);\n }\n\n return saveResult.modelArtifactsInfo;\n}\n\n/**\n * List all models stored in registered storage mediums.\n *\n * For a web browser environment, the registered mediums are Local Storage and\n * IndexedDB.\n *\n * ```js\n * // First create and save a model.\n * const model = tf.sequential();\n * model.add(tf.layers.dense(\n * {units: 1, inputShape: [10], activation: 'sigmoid'}));\n * await model.save('localstorage://demo/management/model1');\n *\n * // Then list existing models.\n * console.log(JSON.stringify(await tf.io.listModels()));\n *\n * // Delete the model.\n * await tf.io.removeModel('localstorage://demo/management/model1');\n *\n * // List models again.\n * console.log(JSON.stringify(await tf.io.listModels()));\n * ```\n *\n * @returns A `Promise` of a dictionary mapping URLs of existing models to\n * their model artifacts info. URLs include medium-specific schemes, e.g.,\n * 'indexeddb://my/model/1'. Model artifacts info include type of the\n * model's topology, byte sizes of the topology, weights, etc.\n *\n * @doc {\n * heading: 'Models',\n * subheading: 'Management',\n * namespace: 'io',\n * ignoreCI: true\n * }\n */\nasync function listModels(): Promise<{[url: string]: ModelArtifactsInfo}> {\n const schemes = ModelStoreManagerRegistry.getSchemes();\n const out: {[url: string]: ModelArtifactsInfo} = {};\n for (const scheme of schemes) {\n const schemeOut =\n await ModelStoreManagerRegistry.getManager(scheme).listModels();\n for (const path in schemeOut) {\n const url = scheme + URL_SCHEME_SUFFIX + path;\n out[url] = schemeOut[path];\n }\n }\n return out;\n}\n\n/**\n * Remove a model specified by URL from a reigstered storage medium.\n *\n * ```js\n * // First create and save a model.\n * const model = tf.sequential();\n * model.add(tf.layers.dense(\n * {units: 1, inputShape: [10], activation: 'sigmoid'}));\n * await model.save('localstorage://demo/management/model1');\n *\n * // Then list existing models.\n * console.log(JSON.stringify(await tf.io.listModels()));\n *\n * // Delete the model.\n * await tf.io.removeModel('localstorage://demo/management/model1');\n *\n * // List models again.\n * console.log(JSON.stringify(await tf.io.listModels()));\n * ```\n *\n * @param url A URL to a stored model, with a scheme prefix, e.g.,\n * 'localstorage://my-model-1', 'indexeddb://my/model/2'.\n * @returns ModelArtifactsInfo of the deleted model (if and only if deletion\n * is successful).\n * @throws Error if deletion fails, e.g., if no model exists at `path`.\n *\n * @doc {\n * heading: 'Models',\n * subheading: 'Management',\n * namespace: 'io',\n * ignoreCI: true\n * }\n */\nasync function removeModel(url: string): Promise {\n const schemeAndPath = parseURL(url);\n const manager = ModelStoreManagerRegistry.getManager(schemeAndPath.scheme);\n return manager.removeModel(schemeAndPath.path);\n}\n\n/**\n * Copy a model from one URL to another.\n *\n * This function supports:\n *\n * 1. Copying within a storage medium, e.g.,\n * `tf.io.copyModel('localstorage://model-1', 'localstorage://model-2')`\n * 2. Copying between two storage mediums, e.g.,\n * `tf.io.copyModel('localstorage://model-1', 'indexeddb://model-1')`\n *\n * ```js\n * // First create and save a model.\n * const model = tf.sequential();\n * model.add(tf.layers.dense(\n * {units: 1, inputShape: [10], activation: 'sigmoid'}));\n * await model.save('localstorage://demo/management/model1');\n *\n * // Then list existing models.\n * console.log(JSON.stringify(await tf.io.listModels()));\n *\n * // Copy the model, from Local Storage to IndexedDB.\n * await tf.io.copyModel(\n * 'localstorage://demo/management/model1',\n * 'indexeddb://demo/management/model1');\n *\n * // List models again.\n * console.log(JSON.stringify(await tf.io.listModels()));\n *\n * // Remove both models.\n * await tf.io.removeModel('localstorage://demo/management/model1');\n * await tf.io.removeModel('indexeddb://demo/management/model1');\n * ```\n *\n * @param sourceURL Source URL of copying.\n * @param destURL Destination URL of copying.\n * @returns ModelArtifactsInfo of the copied model (if and only if copying\n * is successful).\n * @throws Error if copying fails, e.g., if no model exists at `sourceURL`, or\n * if `oldPath` and `newPath` are identical.\n *\n * @doc {\n * heading: 'Models',\n * subheading: 'Management',\n * namespace: 'io',\n * ignoreCI: true\n * }\n */\nasync function copyModel(\n sourceURL: string, destURL: string): Promise {\n const deleteSource = false;\n return cloneModelInternal(sourceURL, destURL, deleteSource);\n}\n\n/**\n * Move a model from one URL to another.\n *\n * This function supports:\n *\n * 1. Moving within a storage medium, e.g.,\n * `tf.io.moveModel('localstorage://model-1', 'localstorage://model-2')`\n * 2. Moving between two storage mediums, e.g.,\n * `tf.io.moveModel('localstorage://model-1', 'indexeddb://model-1')`\n *\n * ```js\n * // First create and save a model.\n * const model = tf.sequential();\n * model.add(tf.layers.dense(\n * {units: 1, inputShape: [10], activation: 'sigmoid'}));\n * await model.save('localstorage://demo/management/model1');\n *\n * // Then list existing models.\n * console.log(JSON.stringify(await tf.io.listModels()));\n *\n * // Move the model, from Local Storage to IndexedDB.\n * await tf.io.moveModel(\n * 'localstorage://demo/management/model1',\n * 'indexeddb://demo/management/model1');\n *\n * // List models again.\n * console.log(JSON.stringify(await tf.io.listModels()));\n *\n * // Remove the moved model.\n * await tf.io.removeModel('indexeddb://demo/management/model1');\n * ```\n *\n * @param sourceURL Source URL of moving.\n * @param destURL Destination URL of moving.\n * @returns ModelArtifactsInfo of the copied model (if and only if copying\n * is successful).\n * @throws Error if moving fails, e.g., if no model exists at `sourceURL`, or\n * if `oldPath` and `newPath` are identical.\n *\n * @doc {\n * heading: 'Models',\n * subheading: 'Management',\n * namespace: 'io',\n * ignoreCI: true\n * }\n */\nasync function moveModel(\n sourceURL: string, destURL: string): Promise {\n const deleteSource = true;\n return cloneModelInternal(sourceURL, destURL, deleteSource);\n}\n\nexport {moveModel, copyModel, removeModel, listModels};\n", "/**\n * @license\n * Copyright 2019 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport '../flags';\n\nimport {env} from '../environment';\nimport {BrowserIndexedDB, BrowserIndexedDBManager} from '../io/indexed_db';\nimport {BrowserLocalStorage, BrowserLocalStorageManager} from '../io/local_storage';\nimport {ModelStoreManagerRegistry} from '../io/model_management';\n\nimport {Platform} from './platform';\n\nexport class PlatformBrowser implements Platform {\n // According to the spec, the built-in encoder can do only UTF-8 encoding.\n // https://developer.mozilla.org/en-US/docs/Web/API/TextEncoder/TextEncoder\n private textEncoder: TextEncoder;\n\n fetch(path: string, init?: RequestInit): Promise {\n return fetch(path, init);\n }\n\n now(): number {\n return performance.now();\n }\n\n encode(text: string, encoding: string): Uint8Array {\n if (encoding !== 'utf-8' && encoding !== 'utf8') {\n throw new Error(\n `Browser's encoder only supports utf-8, but got ${encoding}`);\n }\n if (this.textEncoder == null) {\n this.textEncoder = new TextEncoder();\n }\n return this.textEncoder.encode(text);\n }\n decode(bytes: Uint8Array, encoding: string): string {\n return new TextDecoder(encoding).decode(bytes);\n }\n}\n\nif (env().get('IS_BROWSER')) {\n env().setPlatform('browser', new PlatformBrowser());\n\n // Register LocalStorage IOHandler\n try {\n ModelStoreManagerRegistry.registerManager(\n BrowserLocalStorage.URL_SCHEME, new BrowserLocalStorageManager());\n } catch (err) {\n }\n\n // Register IndexedDB IOHandler\n try {\n ModelStoreManagerRegistry.registerManager(\n BrowserIndexedDB.URL_SCHEME, new BrowserIndexedDBManager());\n } catch (err) {\n }\n}\n", "/**\n * @license\n * Copyright 2019 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\nimport {env} from '../environment';\n\nimport {Platform} from './platform';\n\n// We are wrapping this within an object so it can be stubbed by Jasmine.\nexport const getNodeFetch = {\n // tslint:disable-next-line:no-require-imports\n importFetch: () => require('node-fetch')\n};\n\ntype FetchFn = (url: string, init?: RequestInit) => Promise;\nlet systemFetch: FetchFn;\n// These getters and setters are for testing so we don't export a mutable\n// variable.\nexport function resetSystemFetch() {\n systemFetch = null;\n}\nexport function setSystemFetch(fetchFn: FetchFn) {\n systemFetch = fetchFn;\n}\nexport function getSystemFetch(): FetchFn {\n return systemFetch;\n}\n\nexport class PlatformNode implements Platform {\n private textEncoder: TextEncoder;\n // tslint:disable-next-line:no-any\n util: any;\n\n constructor() {\n // tslint:disable-next-line:no-require-imports\n this.util = require('util');\n // According to the spec, the built-in encoder can do only UTF-8 encoding.\n // https://developer.mozilla.org/en-US/docs/Web/API/TextEncoder/TextEncoder\n this.textEncoder = new this.util.TextEncoder();\n }\n\n fetch(path: string, requestInits?: RequestInit): Promise {\n if (env().global.fetch != null) {\n return env().global.fetch(path, requestInits);\n }\n\n if (systemFetch == null) {\n systemFetch = getNodeFetch.importFetch();\n }\n return systemFetch(path, requestInits);\n }\n\n now(): number {\n const time = process.hrtime();\n return time[0] * 1000 + time[1] / 1000000;\n }\n\n encode(text: string, encoding: string): Uint8Array {\n if (encoding !== 'utf-8' && encoding !== 'utf8') {\n throw new Error(\n `Node built-in encoder only supports utf-8, but got ${encoding}`);\n }\n return this.textEncoder.encode(text);\n }\n decode(bytes: Uint8Array, encoding: string): string {\n if (bytes.length === 0) {\n return '';\n }\n return new this.util.TextDecoder(encoding).decode(bytes);\n }\n}\n\nif (env().get('IS_NODE')) {\n env().setPlatform('node', new PlatformNode());\n}\n", "/**\n * @license\n * Copyright 2020 Google Inc. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {TensorBuffer} from '../tensor';\nimport {DataType, DataTypeMap, Rank, ShapeMap} from '../types';\nimport * as util from '../util';\n\n/**\n * Creates an empty `tf.TensorBuffer` with the specified `shape` and `dtype`.\n *\n * The values are stored in CPU as `TypedArray`. Fill the buffer using\n * `buffer.set()`, or by modifying directly `buffer.values`.\n *\n * When done, call `buffer.toTensor()` to get an immutable `tf.Tensor` with\n * those values.\n *\n * ```js\n * // Create a buffer and set values at particular indices.\n * const buffer = tf.buffer([2, 2]);\n * buffer.set(3, 0, 0);\n * buffer.set(5, 1, 0);\n *\n * // Convert the buffer back to a tensor.\n * buffer.toTensor().print();\n * ```\n *\n * @param shape An array of integers defining the output tensor shape.\n * @param dtype The dtype of the buffer. Defaults to 'float32'.\n * @param values The values of the buffer as `TypedArray`. Defaults to\n * zeros.\n *\n * @doc {heading: 'Tensors', subheading: 'Creation'}\n */\nexport function buffer(\n shape: ShapeMap[R], dtype: D = 'float32' as D,\n values?: DataTypeMap[D]): TensorBuffer {\n dtype = dtype || 'float32' as D;\n util.assertNonNegativeIntegerDimensions(shape);\n return new TensorBuffer(shape, dtype, values);\n}\n", "/**\n * @license\n * Copyright 2020 Google Inc. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\nimport {ENGINE} from '../engine';\nimport {Cast, CastAttrs, CastInputs} from '../kernel_names';\nimport {NamedAttrMap} from '../kernel_registry';\nimport {Tensor} from '../tensor';\nimport {NamedTensorMap} from '../tensor_types';\nimport {convertToTensor} from '../tensor_util_env';\nimport {DataType, TensorLike} from '../types';\nimport * as util from '../util';\n\nimport {op} from './operation';\n\n/**\n * Casts a `tf.Tensor` to a new dtype.\n *\n * ```js\n * const x = tf.tensor1d([1.5, 2.5, 3]);\n * tf.cast(x, 'int32').print();\n * ```\n * @param x The input tensor to be casted.\n * @param dtype The dtype to cast the input tensor to.\n *\n * @doc {heading: 'Tensors', subheading: 'Transformations'}\n */\nfunction cast_(x: T|TensorLike, dtype: DataType): T {\n const $x = convertToTensor(x, 'x', 'cast');\n\n // Sanity checks.\n if (!util.isValidDtype(dtype)) {\n throw new Error(`Failed to cast to unknown dtype ${dtype}`);\n }\n if (dtype === 'string' && $x.dtype !== 'string' ||\n dtype !== 'string' && $x.dtype === 'string') {\n throw new Error('Only strings can be casted to strings');\n }\n\n const inputs: CastInputs = {x: $x};\n const attrs: CastAttrs = {dtype};\n\n return ENGINE.runKernel(\n Cast, inputs as {} as NamedTensorMap, attrs as {} as NamedAttrMap);\n}\n\nexport const cast = op({cast_});\n", "/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {ENGINE} from '../engine';\nimport {Identity, IdentityInputs} from '../kernel_names';\nimport {Tensor} from '../tensor';\nimport {NamedTensorMap} from '../tensor_types';\nimport {convertToTensor} from '../tensor_util_env';\nimport {TensorLike} from '../types';\n\nimport {op} from './operation';\n\n/**\n * Creates a new tensor with the same values and shape as the specified\n * tensor.\n *\n * ```js\n * const x = tf.tensor([1, 2]);\n *\n * x.clone().print();\n * ```\n *\n * @param x The tensor to clone.\n *\n * @doc {heading: 'Tensors', subheading: 'Creation'}\n */\nfunction clone_(x: T|TensorLike): T {\n const $x = convertToTensor(x, 'x', 'clone', 'string_or_numeric');\n const inputs: IdentityInputs = {x: $x};\n\n // Note this op is called tf.identity in python. Hence the kernel name used\n // here.\n return ENGINE.runKernel(Identity, inputs as {} as NamedTensorMap);\n}\n\nexport const clone = op({clone_});\n", "/**\n * @license\n * Copyright 2020 Google Inc. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {Tensor} from '../tensor';\n\n/**\n * Prints information about the `tf.Tensor` including its data.\n *\n * ```js\n * const verbose = true;\n * tf.tensor2d([1, 2, 3, 4], [2, 2]).print(verbose);\n * ```\n * @param x The tensor to be printed.\n * @param verbose Whether to print verbose information about the ` Tensor`,\n * including dtype and size.\n *\n * @doc {heading: 'Tensors', subheading: 'Creation'}\n */\nexport function print(x: T, verbose = false): void {\n console.log(x.toString(verbose));\n}\n", "/**\n * @license\n * Copyright 2020 Google Inc. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\n// Required side effectful code for tfjs-core\n\n// Set up Engine and ENV\nimport {getOrMakeEngine} from './engine';\ngetOrMakeEngine();\n\n// Register backend-agnostic flags.\nimport './flags';\n// Register platforms\nimport './platforms/platform_browser';\nimport './platforms/platform_node';\n\n// Set up OpHandler\nimport {buffer} from './ops/buffer';\nimport {cast} from './ops/cast';\nimport {clone} from './ops/clone';\nimport {print} from './ops/print';\nimport {OpHandler, setOpHandler} from './tensor';\nconst opHandler: OpHandler = {\n buffer,\n cast,\n clone,\n print\n};\nsetOpHandler(opHandler);\n", "/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\n// Importing local_storage and indexed_db is necessary for the routers to be\n// registered.\nimport './indexed_db';\nimport './local_storage';\n\nimport {browserFiles} from './browser_files';\nimport {browserHTTPRequest, http, isHTTPScheme} from './http';\nimport {concatenateArrayBuffers, decodeWeights, encodeWeights, getModelArtifactsInfoForJSON} from './io_utils';\nimport {fromMemory, withSaveHandler} from './passthrough';\nimport {getLoadHandlers, getSaveHandlers, registerLoadRouter, registerSaveRouter} from './router_registry';\nimport {IOHandler, LoadHandler, LoadOptions, ModelArtifacts, ModelArtifactsInfo, ModelJSON, ModelStoreManager, OnProgressCallback, RequestDetails, SaveConfig, SaveHandler, SaveResult, WeightGroup, WeightsManifestConfig, WeightsManifestEntry} from './types';\nimport {loadWeights, weightsLoaderFactory} from './weights_loader';\n\nexport {copyModel, listModels, moveModel, removeModel} from './model_management';\nexport {\n browserFiles,\n browserHTTPRequest,\n concatenateArrayBuffers,\n decodeWeights,\n encodeWeights,\n fromMemory,\n getLoadHandlers,\n getModelArtifactsInfoForJSON,\n getSaveHandlers,\n http,\n IOHandler,\n isHTTPScheme,\n LoadHandler,\n LoadOptions,\n loadWeights,\n ModelArtifacts,\n ModelArtifactsInfo,\n ModelJSON,\n ModelStoreManager,\n OnProgressCallback,\n registerLoadRouter,\n registerSaveRouter,\n RequestDetails,\n SaveConfig,\n SaveHandler,\n SaveResult,\n WeightGroup,\n weightsLoaderFactory,\n WeightsManifestConfig,\n WeightsManifestEntry,\n withSaveHandler\n};\n", "/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\n/**\n * IOHandlers related to files, such as browser-triggered file downloads,\n * user-selected files in browser.\n */\n\nimport '../flags';\nimport {env} from '../environment';\n\nimport {basename, concatenateArrayBuffers, getModelArtifactsInfoForJSON} from './io_utils';\nimport {IORouter, IORouterRegistry} from './router_registry';\nimport {IOHandler, ModelArtifacts, ModelJSON, SaveResult, WeightsManifestConfig, WeightsManifestEntry} from './types';\n\nconst DEFAULT_FILE_NAME_PREFIX = 'model';\nconst DEFAULT_JSON_EXTENSION_NAME = '.json';\nconst DEFAULT_WEIGHT_DATA_EXTENSION_NAME = '.weights.bin';\n\nfunction defer(f: () => T): Promise {\n return new Promise(resolve => setTimeout(resolve)).then(f);\n}\n\nexport class BrowserDownloads implements IOHandler {\n private readonly modelTopologyFileName: string;\n private readonly weightDataFileName: string;\n private readonly jsonAnchor: HTMLAnchorElement;\n private readonly weightDataAnchor: HTMLAnchorElement;\n\n static readonly URL_SCHEME = 'downloads://';\n\n constructor(fileNamePrefix?: string) {\n if (!env().getBool('IS_BROWSER')) {\n // TODO(cais): Provide info on what IOHandlers are available under the\n // current environment.\n throw new Error(\n 'browserDownloads() cannot proceed because the current environment ' +\n 'is not a browser.');\n }\n\n if (fileNamePrefix.startsWith(BrowserDownloads.URL_SCHEME)) {\n fileNamePrefix = fileNamePrefix.slice(BrowserDownloads.URL_SCHEME.length);\n }\n if (fileNamePrefix == null || fileNamePrefix.length === 0) {\n fileNamePrefix = DEFAULT_FILE_NAME_PREFIX;\n }\n\n this.modelTopologyFileName = fileNamePrefix + DEFAULT_JSON_EXTENSION_NAME;\n this.weightDataFileName =\n fileNamePrefix + DEFAULT_WEIGHT_DATA_EXTENSION_NAME;\n }\n\n async save(modelArtifacts: ModelArtifacts): Promise {\n if (typeof (document) === 'undefined') {\n throw new Error(\n 'Browser downloads are not supported in ' +\n 'this environment since `document` is not present');\n }\n const weightsURL = window.URL.createObjectURL(new Blob(\n [modelArtifacts.weightData], {type: 'application/octet-stream'}));\n\n if (modelArtifacts.modelTopology instanceof ArrayBuffer) {\n throw new Error(\n 'BrowserDownloads.save() does not support saving model topology ' +\n 'in binary formats yet.');\n } else {\n const weightsManifest: WeightsManifestConfig = [{\n paths: ['./' + this.weightDataFileName],\n weights: modelArtifacts.weightSpecs\n }];\n const modelTopologyAndWeightManifest: ModelJSON = {\n modelTopology: modelArtifacts.modelTopology,\n format: modelArtifacts.format,\n generatedBy: modelArtifacts.generatedBy,\n convertedBy: modelArtifacts.convertedBy,\n weightsManifest\n };\n if (modelArtifacts.signature != null) {\n modelTopologyAndWeightManifest.signature = modelArtifacts.signature;\n }\n if (modelArtifacts.userDefinedMetadata != null) {\n modelTopologyAndWeightManifest.userDefinedMetadata =\n modelArtifacts.userDefinedMetadata;\n }\n if (modelArtifacts.modelInitializer != null) {\n modelTopologyAndWeightManifest.modelInitializer =\n modelArtifacts.modelInitializer;\n }\n const modelTopologyAndWeightManifestURL =\n window.URL.createObjectURL(new Blob(\n [JSON.stringify(modelTopologyAndWeightManifest)],\n {type: 'application/json'}));\n\n // If anchor elements are not provided, create them without attaching them\n // to parents, so that the downloaded file names can be controlled.\n const jsonAnchor = this.jsonAnchor == null ? document.createElement('a') :\n this.jsonAnchor;\n jsonAnchor.download = this.modelTopologyFileName;\n jsonAnchor.href = modelTopologyAndWeightManifestURL;\n // Trigger downloads by evoking a click event on the download anchors.\n // When multiple downloads are started synchronously, Firefox will only\n // save the last one.\n await defer(() => jsonAnchor.dispatchEvent(new MouseEvent('click')));\n\n if (modelArtifacts.weightData != null) {\n const weightDataAnchor = this.weightDataAnchor == null ?\n document.createElement('a') :\n this.weightDataAnchor;\n weightDataAnchor.download = this.weightDataFileName;\n weightDataAnchor.href = weightsURL;\n await defer(\n () => weightDataAnchor.dispatchEvent(new MouseEvent('click')));\n }\n\n return {modelArtifactsInfo: getModelArtifactsInfoForJSON(modelArtifacts)};\n }\n }\n}\n\nclass BrowserFiles implements IOHandler {\n private readonly files: File[];\n\n constructor(files: File[]) {\n if (files == null || files.length < 1) {\n throw new Error(\n `When calling browserFiles, at least 1 file is required, ` +\n `but received ${files}`);\n }\n this.files = files;\n }\n\n async load(): Promise {\n const jsonFile = this.files[0];\n const weightFiles = this.files.slice(1);\n\n return new Promise((resolve, reject) => {\n const jsonReader = new FileReader();\n jsonReader.onload = (event: Event) => {\n // tslint:disable-next-line:no-any\n const modelJSON = JSON.parse((event.target as any).result) as ModelJSON;\n const modelTopology = modelJSON.modelTopology;\n if (modelTopology == null) {\n reject(new Error(\n `modelTopology field is missing from file ${jsonFile.name}`));\n return;\n }\n\n if (weightFiles.length === 0) {\n resolve({modelTopology});\n }\n\n const weightsManifest = modelJSON.weightsManifest;\n if (weightsManifest == null) {\n reject(new Error(\n `weightManifest field is missing from file ${jsonFile.name}`));\n return;\n }\n\n let pathToFile: {[path: string]: File};\n try {\n pathToFile =\n this.checkManifestAndWeightFiles(weightsManifest, weightFiles);\n } catch (err) {\n reject(err);\n return;\n }\n\n const weightSpecs: WeightsManifestEntry[] = [];\n const paths: string[] = [];\n const perFileBuffers: ArrayBuffer[] = [];\n weightsManifest.forEach(weightsGroup => {\n weightsGroup.paths.forEach(path => {\n paths.push(path);\n perFileBuffers.push(null);\n });\n weightSpecs.push(...weightsGroup.weights);\n });\n\n weightsManifest.forEach(weightsGroup => {\n weightsGroup.paths.forEach(path => {\n const weightFileReader = new FileReader();\n weightFileReader.onload = (event: Event) => {\n // tslint:disable-next-line:no-any\n const weightData = (event.target as any).result as ArrayBuffer;\n const index = paths.indexOf(path);\n perFileBuffers[index] = weightData;\n if (perFileBuffers.indexOf(null) === -1) {\n const result: ModelArtifacts = {\n modelTopology,\n weightSpecs,\n weightData: concatenateArrayBuffers(perFileBuffers),\n format: modelJSON.format,\n generatedBy: modelJSON.generatedBy,\n convertedBy: modelJSON.convertedBy\n };\n if (modelJSON.signature != null) {\n result.signature = modelJSON.signature;\n }\n if (modelJSON.userDefinedMetadata != null) {\n result.userDefinedMetadata = modelJSON.userDefinedMetadata;\n }\n if (modelJSON.modelInitializer != null) {\n result.modelInitializer = modelJSON.modelInitializer;\n }\n resolve(result);\n }\n };\n weightFileReader.onerror = error =>\n reject(`Failed to weights data from file of path '${path}'.`);\n weightFileReader.readAsArrayBuffer(pathToFile[path]);\n });\n });\n };\n jsonReader.onerror = error => reject(\n `Failed to read model topology and weights manifest JSON ` +\n `from file '${jsonFile.name}'. BrowserFiles supports loading ` +\n `Keras-style tf.Model artifacts only.`);\n jsonReader.readAsText(jsonFile);\n });\n }\n\n /**\n * Check the compatibility between weights manifest and weight files.\n */\n private checkManifestAndWeightFiles(\n manifest: WeightsManifestConfig, files: File[]): {[path: string]: File} {\n const basenames: string[] = [];\n const fileNames = files.map(file => basename(file.name));\n const pathToFile: {[path: string]: File} = {};\n for (const group of manifest) {\n group.paths.forEach(path => {\n const pathBasename = basename(path);\n if (basenames.indexOf(pathBasename) !== -1) {\n throw new Error(\n `Duplicate file basename found in weights manifest: ` +\n `'${pathBasename}'`);\n }\n basenames.push(pathBasename);\n if (fileNames.indexOf(pathBasename) === -1) {\n throw new Error(\n `Weight file with basename '${pathBasename}' is not provided.`);\n } else {\n pathToFile[path] = files[fileNames.indexOf(pathBasename)];\n }\n });\n }\n\n if (basenames.length !== files.length) {\n throw new Error(\n `Mismatch in the number of files in weights manifest ` +\n `(${basenames.length}) and the number of weight files provided ` +\n `(${files.length}).`);\n }\n return pathToFile;\n }\n}\n\nexport const browserDownloadsRouter: IORouter = (url: string|string[]) => {\n if (!env().getBool('IS_BROWSER')) {\n return null;\n } else {\n if (!Array.isArray(url) && url.startsWith(BrowserDownloads.URL_SCHEME)) {\n return browserDownloads(url.slice(BrowserDownloads.URL_SCHEME.length));\n } else {\n return null;\n }\n }\n};\nIORouterRegistry.registerSaveRouter(browserDownloadsRouter);\n\n/**\n * Creates an IOHandler that triggers file downloads from the browser.\n *\n * The returned `IOHandler` instance can be used as model exporting methods such\n * as `tf.Model.save` and supports only saving.\n *\n * ```js\n * const model = tf.sequential();\n * model.add(tf.layers.dense(\n * {units: 1, inputShape: [10], activation: 'sigmoid'}));\n * const saveResult = await model.save('downloads://mymodel');\n * // This will trigger downloading of two files:\n * // 'mymodel.json' and 'mymodel.weights.bin'.\n * console.log(saveResult);\n * ```\n *\n * @param fileNamePrefix Prefix name of the files to be downloaded. For use with\n * `tf.Model`, `fileNamePrefix` should follow either of the following two\n * formats:\n * 1. `null` or `undefined`, in which case the default file\n * names will be used:\n * - 'model.json' for the JSON file containing the model topology and\n * weights manifest.\n * - 'model.weights.bin' for the binary file containing the binary weight\n * values.\n * 2. A single string or an Array of a single string, as the file name prefix.\n * For example, if `'foo'` is provided, the downloaded JSON\n * file and binary weights file will be named 'foo.json' and\n * 'foo.weights.bin', respectively.\n * @param config Additional configuration for triggering downloads.\n * @returns An instance of `BrowserDownloads` `IOHandler`.\n *\n * @doc {\n * heading: 'Models',\n * subheading: 'Loading',\n * namespace: 'io',\n * ignoreCI: true\n * }\n */\nexport function browserDownloads(fileNamePrefix = 'model'): IOHandler {\n return new BrowserDownloads(fileNamePrefix);\n}\n\n/**\n * Creates an IOHandler that loads model artifacts from user-selected files.\n *\n * This method can be used for loading from files such as user-selected files\n * in the browser.\n * When used in conjunction with `tf.loadLayersModel`, an instance of\n * `tf.LayersModel` (Keras-style) can be constructed from the loaded artifacts.\n *\n * ```js\n * // Note: This code snippet won't run properly without the actual file input\n * // elements in the HTML DOM.\n *\n * // Suppose there are two HTML file input (``)\n * // elements.\n * const uploadJSONInput = document.getElementById('upload-json');\n * const uploadWeightsInput = document.getElementById('upload-weights');\n * const model = await tf.loadLayersModel(tf.io.browserFiles(\n * [uploadJSONInput.files[0], uploadWeightsInput.files[0]]));\n * ```\n *\n * @param files `File`s to load from. Currently, this function supports only\n * loading from files that contain Keras-style models (i.e., `tf.Model`s), for\n * which an `Array` of `File`s is expected (in that order):\n * - A JSON file containing the model topology and weight manifest.\n * - Optionally, One or more binary files containing the binary weights.\n * These files must have names that match the paths in the `weightsManifest`\n * contained by the aforementioned JSON file, or errors will be thrown\n * during loading. These weights files have the same format as the ones\n * generated by `tensorflowjs_converter` that comes with the `tensorflowjs`\n * Python PIP package. If no weights files are provided, only the model\n * topology will be loaded from the JSON file above.\n * @returns An instance of `Files` `IOHandler`.\n *\n * @doc {\n * heading: 'Models',\n * subheading: 'Loading',\n * namespace: 'io',\n * ignoreCI: true\n * }\n */\nexport function browserFiles(files: File[]): IOHandler {\n return new BrowserFiles(files);\n}\n", "/**\n * @license\n * Copyright 2019 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {assert} from '../util';\n\nimport {OnProgressCallback} from './types';\n\n/**\n * Monitor Promise.all progress, fire onProgress callback function.\n *\n * @param promises Promise list going to be monitored\n * @param onProgress Callback function. Fired when a promise resolved.\n * @param startFraction Optional fraction start. Default to 0.\n * @param endFraction Optional fraction end. Default to 1.\n */\nexport function monitorPromisesProgress(\n promises: Array>, onProgress: OnProgressCallback,\n startFraction?: number, endFraction?: number) {\n checkPromises(promises);\n startFraction = startFraction == null ? 0 : startFraction;\n endFraction = endFraction == null ? 1 : endFraction;\n checkFraction(startFraction, endFraction);\n let resolvedPromise = 0;\n\n const registerMonitor = (promise: Promise<{}>) => {\n promise.then(value => {\n const fraction = startFraction +\n ++resolvedPromise / promises.length * (endFraction - startFraction);\n // pass fraction as parameter to callback function.\n onProgress(fraction);\n return value;\n });\n return promise;\n };\n\n function checkPromises(promises: Array>): void {\n assert(\n promises != null && Array.isArray(promises) && promises.length > 0,\n () => 'promises must be a none empty array');\n }\n\n function checkFraction(startFraction: number, endFraction: number): void {\n assert(\n startFraction >= 0 && startFraction <= 1,\n () => `Progress fraction must be in range [0, 1], but ` +\n `got startFraction ${startFraction}`);\n assert(\n endFraction >= 0 && endFraction <= 1,\n () => `Progress fraction must be in range [0, 1], but ` +\n `got endFraction ${endFraction}`);\n assert(\n endFraction >= startFraction,\n () => `startFraction must be no more than endFraction, but ` +\n `got startFraction ${startFraction} and endFraction ` +\n `${endFraction}`);\n }\n\n return Promise.all(promises.map(registerMonitor));\n}\n", "/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {env} from '../environment';\n\nimport {NamedTensorMap} from '../tensor_types';\nimport * as util from '../util';\nimport {decodeWeights} from './io_utils';\nimport {monitorPromisesProgress} from './progress';\nimport {DTYPE_VALUE_SIZE_MAP, LoadOptions, WeightsManifestConfig, WeightsManifestEntry} from './types';\n\n/**\n * Reads binary weights data from a number of URLs.\n *\n * @param fetchURLs URLs to send the HTTP requests at, using `fetch` calls.\n * @param requestOptions RequestInit (options) for the HTTP requests.\n * @param fetchFunc Optional overriding value for the `window.fetch` function.\n * @param onProgress Optional, progress callback function, fired periodically\n * before the load is completed.\n * @returns A `Promise` of an Array of `ArrayBuffer`. The Array has the same\n * length as `fetchURLs`.\n */\nexport async function loadWeightsAsArrayBuffer(\n fetchURLs: string[], loadOptions?: LoadOptions): Promise {\n if (loadOptions == null) {\n loadOptions = {};\n }\n\n const fetchFunc = loadOptions.fetchFunc == null ? env().platform.fetch :\n loadOptions.fetchFunc;\n\n // Create the requests for all of the weights in parallel.\n const requests = fetchURLs.map(\n fetchURL =>\n fetchFunc(fetchURL, loadOptions.requestInit, {isBinary: true}));\n\n const fetchStartFraction = 0;\n const fetchEndFraction = 0.5;\n\n const responses = loadOptions.onProgress == null ?\n await Promise.all(requests) :\n await monitorPromisesProgress(\n requests, loadOptions.onProgress, fetchStartFraction,\n fetchEndFraction);\n\n const bufferPromises = responses.map(response => response.arrayBuffer());\n\n const bufferStartFraction = 0.5;\n const bufferEndFraction = 1;\n\n const buffers = loadOptions.onProgress == null ?\n await Promise.all(bufferPromises) :\n await monitorPromisesProgress(\n bufferPromises, loadOptions.onProgress, bufferStartFraction,\n bufferEndFraction);\n return buffers;\n}\n\n/**\n * Reads a weights manifest JSON configuration, fetches the weights and\n * returns them as `Tensor`s.\n *\n * @param manifest The weights manifest JSON.\n * @param filePathPrefix The path prefix for filenames given in the manifest.\n * Defaults to the empty string.\n * @param weightNames The names of the weights to be fetched.\n */\nexport async function loadWeights(\n manifest: WeightsManifestConfig, filePathPrefix = '',\n weightNames?: string[],\n requestInit?: RequestInit): Promise {\n // TODO(nsthorat): Groups are currently fetched atomically. If you need a\n // single weight from a group, the whole group will be fetched. At a future\n // date, we should support fetching only the individual shards within a\n // group that are needed to reconstruct the requested weight.\n // TODO(cais): Use `decodeWeights` for implementation.\n\n const fetchWeights = (fetchUrls: string[]) =>\n loadWeightsAsArrayBuffer(fetchUrls, {requestInit});\n const loadWeights = weightsLoaderFactory(fetchWeights);\n\n return loadWeights(manifest, filePathPrefix, weightNames);\n}\n\n/**\n * Creates a function, which reads a weights manifest JSON configuration,\n * fetches the weight files using the specified function and returns them as\n * `Tensor`s.\n *\n * ```js\n * // example for creating a nodejs weight loader, which reads the weight files\n * // from disk using fs.readFileSync\n *\n * import * as fs from 'fs'\n *\n * const fetchWeightsFromDisk = (filePaths: string[]) =>\n * filePaths.map(filePath => fs.readFileSync(filePath).buffer)\n *\n * const loadWeights = tf.io.weightsLoaderFactory(fetchWeightsFromDisk)\n *\n * const manifest = JSON.parse(\n * fs.readFileSync('./my_model-weights_manifest').toString()\n * )\n * const weightMap = await loadWeights(manifest, './')\n * ```\n * @param fetchWeightsFunction The function used for fetching the weight files.\n * @returns Weight loading function.\n */\nexport function weightsLoaderFactory(\n fetchWeightsFunction: (fetchUrls: string[]) => Promise):\n (manifest: WeightsManifestConfig, filePathPrefix?: string,\n weightNames?: string[]) => Promise {\n return async(\n manifest: WeightsManifestConfig, filePathPrefix = '',\n weightNames?: string[]): Promise => {\n // Collect all the groups, weights, and their relative offsets to be\n // fetched.\n const groupIndicesToFetchMap = manifest.map(() => false);\n const groupWeightsToFetch: {\n [group: number]: Array<{\n manifestEntry: WeightsManifestEntry; groupOffset: number;\n sizeBytes: number;\n }>\n } = {};\n const weightsFound =\n weightNames != null ? weightNames.map(() => false) : [];\n const allManifestWeightNames: string[] = [];\n manifest.forEach((manifestGroupConfig, groupIndex) => {\n let groupOffset = 0;\n manifestGroupConfig.weights.forEach(weightsEntry => {\n const rawDtype = ('quantization' in weightsEntry) ?\n weightsEntry.quantization.dtype :\n weightsEntry.dtype;\n\n const weightsBytes = DTYPE_VALUE_SIZE_MAP[rawDtype] *\n util.sizeFromShape(weightsEntry.shape);\n\n const enqueueWeightsForFetchingFn = () => {\n groupIndicesToFetchMap[groupIndex] = true;\n if (groupWeightsToFetch[groupIndex] == null) {\n groupWeightsToFetch[groupIndex] = [];\n }\n\n groupWeightsToFetch[groupIndex].push({\n manifestEntry: weightsEntry,\n groupOffset,\n sizeBytes: weightsBytes\n });\n };\n\n if (weightNames != null) {\n weightNames.forEach((weightName, weightIndex) => {\n if (weightName === weightsEntry.name) {\n enqueueWeightsForFetchingFn();\n weightsFound[weightIndex] = true;\n }\n });\n } else {\n enqueueWeightsForFetchingFn();\n }\n\n allManifestWeightNames.push(weightsEntry.name);\n groupOffset += weightsBytes;\n });\n });\n\n if (!weightsFound.every(found => found)) {\n const weightsNotFound = weightNames.filter((_, i) => !weightsFound[i]);\n throw new Error(\n `Could not find weights in manifest with names: ` +\n `${weightsNotFound.join(', ')}. \\n` +\n `Manifest JSON has weights with names: ` +\n `${allManifestWeightNames.join(', ')}.`);\n }\n\n // Convert the one-hot boolean groupId => shouldFetch map to a list of group\n // IDs.\n const groupIndicesToFetch =\n groupIndicesToFetchMap.reduce((accumulator, shouldFetch, i) => {\n if (shouldFetch) {\n accumulator.push(i);\n }\n return accumulator;\n }, []);\n\n const fetchUrls: string[] = [];\n groupIndicesToFetch.forEach(i => {\n manifest[i].paths.forEach(filepath => {\n const fetchUrl = filePathPrefix +\n (!filePathPrefix.endsWith('/') ? '/' : '') + filepath;\n fetchUrls.push(fetchUrl);\n });\n });\n const buffers = await fetchWeightsFunction(fetchUrls);\n\n const weightsTensorMap: NamedTensorMap = {};\n let bufferIndexOffset = 0;\n groupIndicesToFetch.forEach(i => {\n const numBuffers = manifest[i].paths.length;\n\n let groupBytes = 0;\n for (let i = 0; i < numBuffers; i++) {\n groupBytes += buffers[bufferIndexOffset + i].byteLength;\n }\n\n // Create a buffer for the whole group.\n const groupBuffer = new ArrayBuffer(groupBytes);\n const groupByteBuffer = new Uint8Array(groupBuffer);\n let groupBufferOffset = 0;\n for (let i = 0; i < numBuffers; i++) {\n const buffer = new Uint8Array(buffers[bufferIndexOffset + i]);\n groupByteBuffer.set(buffer, groupBufferOffset);\n groupBufferOffset += buffer.byteLength;\n }\n\n const weightsEntries = groupWeightsToFetch[i];\n weightsEntries.forEach(weightsEntry => {\n const byteBuffer = groupBuffer.slice(\n weightsEntry.groupOffset,\n weightsEntry.groupOffset + weightsEntry.sizeBytes);\n const nameToTensorMap =\n decodeWeights(byteBuffer, [weightsEntry.manifestEntry]);\n for (const name in nameToTensorMap) {\n weightsTensorMap[name] = nameToTensorMap[name];\n }\n });\n\n bufferIndexOffset += numBuffers;\n });\n\n return weightsTensorMap;\n };\n}\n", "/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\n/**\n * IOHandler implementations based on HTTP requests in the web browser.\n *\n * Uses [`fetch`](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API).\n */\n\nimport {env} from '../environment';\n\nimport {assert} from '../util';\nimport {concatenateArrayBuffers, getModelArtifactsInfoForJSON} from './io_utils';\nimport {IORouter, IORouterRegistry} from './router_registry';\nimport {IOHandler, LoadOptions, ModelArtifacts, ModelJSON, OnProgressCallback, SaveResult, WeightsManifestConfig, WeightsManifestEntry} from './types';\nimport {loadWeightsAsArrayBuffer} from './weights_loader';\n\nconst OCTET_STREAM_MIME_TYPE = 'application/octet-stream';\nconst JSON_TYPE = 'application/json';\nexport class HTTPRequest implements IOHandler {\n protected readonly path: string;\n protected readonly requestInit: RequestInit;\n\n private readonly fetch: Function;\n private readonly weightUrlConverter: (weightName: string) => Promise;\n\n readonly DEFAULT_METHOD = 'POST';\n\n static readonly URL_SCHEME_REGEX = /^https?:\\/\\//;\n\n private readonly weightPathPrefix: string;\n private readonly onProgress: OnProgressCallback;\n\n constructor(path: string, loadOptions?: LoadOptions) {\n if (loadOptions == null) {\n loadOptions = {};\n }\n this.weightPathPrefix = loadOptions.weightPathPrefix;\n this.onProgress = loadOptions.onProgress;\n this.weightUrlConverter = loadOptions.weightUrlConverter;\n\n if (loadOptions.fetchFunc != null) {\n assert(\n typeof loadOptions.fetchFunc === 'function',\n () => 'Must pass a function that matches the signature of ' +\n '`fetch` (see ' +\n 'https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API)');\n this.fetch = loadOptions.fetchFunc;\n } else {\n this.fetch = env().platform.fetch;\n }\n\n assert(\n path != null && path.length > 0,\n () => 'URL path for http must not be null, undefined or ' +\n 'empty.');\n\n if (Array.isArray(path)) {\n assert(\n path.length === 2,\n () => 'URL paths for http must have a length of 2, ' +\n `(actual length is ${path.length}).`);\n }\n this.path = path;\n\n if (loadOptions.requestInit != null &&\n loadOptions.requestInit.body != null) {\n throw new Error(\n 'requestInit is expected to have no pre-existing body, but has one.');\n }\n this.requestInit = loadOptions.requestInit || {};\n }\n\n async save(modelArtifacts: ModelArtifacts): Promise {\n if (modelArtifacts.modelTopology instanceof ArrayBuffer) {\n throw new Error(\n 'BrowserHTTPRequest.save() does not support saving model topology ' +\n 'in binary formats yet.');\n }\n\n const init = Object.assign({method: this.DEFAULT_METHOD}, this.requestInit);\n init.body = new FormData();\n\n const weightsManifest: WeightsManifestConfig = [{\n paths: ['./model.weights.bin'],\n weights: modelArtifacts.weightSpecs,\n }];\n const modelTopologyAndWeightManifest: ModelJSON = {\n modelTopology: modelArtifacts.modelTopology,\n format: modelArtifacts.format,\n generatedBy: modelArtifacts.generatedBy,\n convertedBy: modelArtifacts.convertedBy,\n weightsManifest\n };\n if (modelArtifacts.signature != null) {\n modelTopologyAndWeightManifest.signature = modelArtifacts.signature;\n }\n if (modelArtifacts.userDefinedMetadata != null) {\n modelTopologyAndWeightManifest.userDefinedMetadata =\n modelArtifacts.userDefinedMetadata;\n }\n if (modelArtifacts.modelInitializer != null) {\n modelTopologyAndWeightManifest.modelInitializer =\n modelArtifacts.modelInitializer;\n }\n\n init.body.append(\n 'model.json',\n new Blob(\n [JSON.stringify(modelTopologyAndWeightManifest)],\n {type: JSON_TYPE}),\n 'model.json');\n\n if (modelArtifacts.weightData != null) {\n init.body.append(\n 'model.weights.bin',\n new Blob([modelArtifacts.weightData], {type: OCTET_STREAM_MIME_TYPE}),\n 'model.weights.bin');\n }\n\n const response = await this.fetch(this.path, init);\n\n if (response.ok) {\n return {\n modelArtifactsInfo: getModelArtifactsInfoForJSON(modelArtifacts),\n responses: [response],\n };\n } else {\n throw new Error(\n `BrowserHTTPRequest.save() failed due to HTTP response status ` +\n `${response.status}.`);\n }\n }\n\n /**\n * Load model artifacts via HTTP request(s).\n *\n * See the documentation to `tf.io.http` for details on the saved\n * artifacts.\n *\n * @returns The loaded model artifacts (if loading succeeds).\n */\n async load(): Promise {\n const modelConfigRequest = await this.fetch(this.path, this.requestInit);\n\n if (!modelConfigRequest.ok) {\n throw new Error(\n `Request to ${this.path} failed with status code ` +\n `${modelConfigRequest.status}. Please verify this URL points to ` +\n `the model JSON of the model to load.`);\n }\n let modelConfig: ModelJSON;\n try {\n modelConfig = await modelConfigRequest.json();\n } catch (e) {\n let message = `Failed to parse model JSON of response from ${this.path}.`;\n // TODO(nsthorat): Remove this after some time when we're comfortable that\n // .pb files are mostly gone.\n if (this.path.endsWith('.pb')) {\n message += ' Your path contains a .pb file extension. ' +\n 'Support for .pb models have been removed in TensorFlow.js 1.0 ' +\n 'in favor of .json models. You can re-convert your Python ' +\n 'TensorFlow model using the TensorFlow.js 1.0 conversion scripts ' +\n 'or you can convert your.pb models with the \\'pb2json\\'' +\n 'NPM script in the tensorflow/tfjs-converter repository.';\n } else {\n message += ' Please make sure the server is serving valid ' +\n 'JSON for this request.';\n }\n throw new Error(message);\n }\n const modelTopology = modelConfig.modelTopology;\n const weightsManifest = modelConfig.weightsManifest;\n const generatedBy = modelConfig.generatedBy;\n const convertedBy = modelConfig.convertedBy;\n const format = modelConfig.format;\n const signature = modelConfig.signature;\n const userDefinedMetadata = modelConfig.userDefinedMetadata;\n\n // We do not allow both modelTopology and weightsManifest to be missing.\n if (modelTopology == null && weightsManifest == null) {\n throw new Error(\n `The JSON from HTTP path ${this.path} contains neither model ` +\n `topology or manifest for weights.`);\n }\n\n let weightSpecs: WeightsManifestEntry[];\n let weightData: ArrayBuffer;\n if (weightsManifest != null) {\n const results = await this.loadWeights(weightsManifest);\n [weightSpecs, weightData] = results;\n }\n\n const artifacts: ModelArtifacts = {\n modelTopology,\n weightSpecs,\n weightData,\n generatedBy,\n convertedBy,\n format\n };\n\n if (signature != null) {\n artifacts.signature = signature;\n }\n if (userDefinedMetadata != null) {\n artifacts.userDefinedMetadata = userDefinedMetadata;\n }\n\n const initializer = modelConfig.modelInitializer;\n if (initializer) {\n artifacts.modelInitializer = initializer;\n }\n\n return artifacts;\n }\n\n private async loadWeights(weightsManifest: WeightsManifestConfig):\n Promise<[WeightsManifestEntry[], ArrayBuffer]> {\n const weightPath = Array.isArray(this.path) ? this.path[1] : this.path;\n const [prefix, suffix] = parseUrl(weightPath);\n const pathPrefix = this.weightPathPrefix || prefix;\n\n const weightSpecs = [];\n for (const entry of weightsManifest) {\n weightSpecs.push(...entry.weights);\n }\n\n const fetchURLs: string[] = [];\n const urlPromises: Array> = [];\n for (const weightsGroup of weightsManifest) {\n for (const path of weightsGroup.paths) {\n if (this.weightUrlConverter != null) {\n urlPromises.push(this.weightUrlConverter(path));\n } else {\n fetchURLs.push(pathPrefix + path + suffix);\n }\n }\n }\n\n if (this.weightUrlConverter) {\n fetchURLs.push(...await Promise.all(urlPromises));\n }\n\n const buffers = await loadWeightsAsArrayBuffer(fetchURLs, {\n requestInit: this.requestInit,\n fetchFunc: this.fetch,\n onProgress: this.onProgress\n });\n return [weightSpecs, concatenateArrayBuffers(buffers)];\n }\n}\n\n/**\n * Extract the prefix and suffix of the url, where the prefix is the path before\n * the last file, and suffix is the search params after the last file.\n * ```\n * const url = 'http://tfhub.dev/model/1/tensorflowjs_model.pb?tfjs-format=file'\n * [prefix, suffix] = parseUrl(url)\n * // prefix = 'http://tfhub.dev/model/1/'\n * // suffix = '?tfjs-format=file'\n * ```\n * @param url the model url to be parsed.\n */\nexport function parseUrl(url: string): [string, string] {\n const lastSlash = url.lastIndexOf('/');\n const lastSearchParam = url.lastIndexOf('?');\n const prefix = url.substring(0, lastSlash);\n const suffix =\n lastSearchParam > lastSlash ? url.substring(lastSearchParam) : '';\n return [prefix + '/', suffix];\n}\n\nexport function isHTTPScheme(url: string): boolean {\n return url.match(HTTPRequest.URL_SCHEME_REGEX) != null;\n}\n\nexport const httpRouter: IORouter =\n (url: string, loadOptions?: LoadOptions) => {\n if (typeof fetch === 'undefined' &&\n (loadOptions == null || loadOptions.fetchFunc == null)) {\n // `http` uses `fetch` or `node-fetch`, if one wants to use it in\n // an environment that is not the browser or node they have to setup a\n // global fetch polyfill.\n return null;\n } else {\n let isHTTP = true;\n if (Array.isArray(url)) {\n isHTTP = url.every(urlItem => isHTTPScheme(urlItem));\n } else {\n isHTTP = isHTTPScheme(url);\n }\n if (isHTTP) {\n return http(url, loadOptions);\n }\n }\n return null;\n };\nIORouterRegistry.registerSaveRouter(httpRouter);\nIORouterRegistry.registerLoadRouter(httpRouter);\n\n/**\n * Creates an IOHandler subtype that sends model artifacts to HTTP server.\n *\n * An HTTP request of the `multipart/form-data` mime type will be sent to the\n * `path` URL. The form data includes artifacts that represent the topology\n * and/or weights of the model. In the case of Keras-style `tf.Model`, two\n * blobs (files) exist in form-data:\n * - A JSON file consisting of `modelTopology` and `weightsManifest`.\n * - A binary weights file consisting of the concatenated weight values.\n * These files are in the same format as the one generated by\n * [tfjs_converter](https://js.tensorflow.org/tutorials/import-keras.html).\n *\n * The following code snippet exemplifies the client-side code that uses this\n * function:\n *\n * ```js\n * const model = tf.sequential();\n * model.add(\n * tf.layers.dense({units: 1, inputShape: [100], activation: 'sigmoid'}));\n *\n * const saveResult = await model.save(tf.io.http(\n * 'http://model-server:5000/upload', {requestInit: {method: 'PUT'}}));\n * console.log(saveResult);\n * ```\n *\n * If the default `POST` method is to be used, without any custom parameters\n * such as headers, you can simply pass an HTTP or HTTPS URL to `model.save`:\n *\n * ```js\n * const saveResult = await model.save('http://model-server:5000/upload');\n * ```\n *\n * The following GitHub Gist\n * https://gist.github.com/dsmilkov/1b6046fd6132d7408d5257b0976f7864\n * implements a server based on [flask](https://github.com/pallets/flask) that\n * can receive the request. Upon receiving the model artifacts via the requst,\n * this particular server reconsistutes instances of [Keras\n * Models](https://keras.io/models/model/) in memory.\n *\n *\n * @param path A URL path to the model.\n * Can be an absolute HTTP path (e.g.,\n * 'http://localhost:8000/model-upload)') or a relative path (e.g.,\n * './model-upload').\n * @param requestInit Request configurations to be used when sending\n * HTTP request to server using `fetch`. It can contain fields such as\n * `method`, `credentials`, `headers`, `mode`, etc. See\n * https://developer.mozilla.org/en-US/docs/Web/API/Request/Request\n * for more information. `requestInit` must not have a body, because the\n * body will be set by TensorFlow.js. File blobs representing the model\n * topology (filename: 'model.json') and the weights of the model (filename:\n * 'model.weights.bin') will be appended to the body. If `requestInit` has a\n * `body`, an Error will be thrown.\n * @param loadOptions Optional configuration for the loading. It includes the\n * following fields:\n * - weightPathPrefix Optional, this specifies the path prefix for weight\n * files, by default this is calculated from the path param.\n * - fetchFunc Optional, custom `fetch` function. E.g., in Node.js,\n * the `fetch` from node-fetch can be used here.\n * - onProgress Optional, progress callback function, fired periodically\n * before the load is completed.\n * @returns An instance of `IOHandler`.\n *\n * @doc {\n * heading: 'Models',\n * subheading: 'Loading',\n * namespace: 'io',\n * ignoreCI: true\n * }\n */\nexport function http(path: string, loadOptions?: LoadOptions): IOHandler {\n return new HTTPRequest(path, loadOptions);\n}\n\n/**\n * Deprecated. Use `tf.io.http`.\n * @param path\n * @param loadOptions\n */\nexport function browserHTTPRequest(\n path: string, loadOptions?: LoadOptions): IOHandler {\n return http(path, loadOptions);\n}\n", "/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\n/**\n * IOHandlers that pass through the in-memory ModelArtifacts format.\n */\n\nimport {IOHandler, ModelArtifacts, SaveResult, TrainingConfig, WeightsManifestEntry} from './types';\n\nclass PassthroughLoader implements IOHandler {\n constructor(private readonly modelArtifacts?: ModelArtifacts) {}\n\n async load(): Promise {\n return this.modelArtifacts;\n }\n}\n\nclass PassthroughSaver implements IOHandler {\n constructor(\n private readonly saveHandler:\n (artifacts: ModelArtifacts) => Promise) {}\n\n async save(modelArtifacts: ModelArtifacts) {\n return this.saveHandler(modelArtifacts);\n }\n}\n\n/**\n * Creates an IOHandler that loads model artifacts from memory.\n *\n * When used in conjunction with `tf.loadLayersModel`, an instance of\n * `tf.LayersModel` (Keras-style) can be constructed from the loaded artifacts.\n *\n * ```js\n * const model = await tf.loadLayersModel(tf.io.fromMemory(\n * modelTopology, weightSpecs, weightData));\n * ```\n *\n * @param modelArtifacts a object containing model topology (i.e., parsed from\n * the JSON format).\n * @param weightSpecs An array of `WeightsManifestEntry` objects describing the\n * names, shapes, types, and quantization of the weight data.\n * @param weightData A single `ArrayBuffer` containing the weight data,\n * concatenated in the order described by the weightSpecs.\n * @param trainingConfig Model training configuration. Optional.\n *\n * @returns A passthrough `IOHandler` that simply loads the provided data.\n */\nexport function fromMemory(\n modelArtifacts: {}|ModelArtifacts, weightSpecs?: WeightsManifestEntry[],\n weightData?: ArrayBuffer, trainingConfig?: TrainingConfig): IOHandler {\n if (arguments.length === 1) {\n const isModelArtifacts =\n (modelArtifacts as ModelArtifacts).modelTopology != null ||\n (modelArtifacts as ModelArtifacts).weightSpecs != null;\n if (isModelArtifacts) {\n return new PassthroughLoader(modelArtifacts as ModelArtifacts);\n } else {\n // Legacy support: with only modelTopology.\n // TODO(cais): Remove this deprecated API.\n console.warn(\n 'Please call tf.io.fromMemory() with only one argument. ' +\n 'The argument should be of type ModelArtifacts. ' +\n 'The multi-argument signature of tf.io.fromMemory() has been ' +\n 'deprecated and will be removed in a future release.');\n return new PassthroughLoader({modelTopology: modelArtifacts as {}});\n }\n } else {\n // Legacy support.\n // TODO(cais): Remove this deprecated API.\n console.warn(\n 'Please call tf.io.fromMemory() with only one argument. ' +\n 'The argument should be of type ModelArtifacts. ' +\n 'The multi-argument signature of tf.io.fromMemory() has been ' +\n 'deprecated and will be removed in a future release.');\n return new PassthroughLoader({\n modelTopology: modelArtifacts as {},\n weightSpecs,\n weightData,\n trainingConfig\n });\n }\n}\n\n/**\n * Creates an IOHandler that passes saved model artifacts to a callback.\n *\n * ```js\n * function handleSave(artifacts) {\n * // ... do something with the artifacts ...\n * return {modelArtifactsInfo: {...}, ...};\n * }\n *\n * const saveResult = model.save(tf.io.withSaveHandler(handleSave));\n * ```\n *\n * @param saveHandler A function that accepts a `ModelArtifacts` and returns a\n * `SaveResult`.\n */\nexport function withSaveHandler(\n saveHandler: (artifacts: ModelArtifacts) =>\n Promise): IOHandler {\n return new PassthroughSaver(saveHandler);\n}\n", "/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\n/**\n * Exports under the tf.math.* namespace.\n */\n\nimport {confusionMatrix} from './ops/confusion_matrix';\n\nexport {confusionMatrix};\n", "/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\nimport {ENGINE} from '../engine';\nimport {BatchMatMul, BatchMatMulAttrs, BatchMatMulInputs} from '../kernel_names';\nimport {NamedAttrMap} from '../kernel_registry';\nimport {Tensor} from '../tensor';\nimport {NamedTensorMap} from '../tensor_types';\nimport {makeTypesMatch} from '../tensor_util';\nimport {convertToTensor} from '../tensor_util_env';\nimport {TensorLike} from '../types';\n\nimport {op} from './operation';\n\n/**\n * Computes the dot product of two matrices, A * B. These must be matrices.\n *\n * ```js\n * const a = tf.tensor2d([1, 2], [1, 2]);\n * const b = tf.tensor2d([1, 2, 3, 4], [2, 2]);\n *\n * a.matMul(b).print(); // or tf.matMul(a, b)\n * ```\n * @param a First matrix in dot product operation.\n * @param b Second matrix in dot product operation.\n * @param transposeA If true, `a` is transposed before multiplication.\n * @param transposeB If true, `b` is transposed before multiplication.\n *\n * @doc {heading: 'Operations', subheading: 'Matrices'}\n */\nfunction matMul_(\n a: Tensor|TensorLike, b: Tensor|TensorLike, transposeA = false,\n transposeB = false): T {\n let $a = convertToTensor(a, 'a', 'matMul');\n let $b = convertToTensor(b, 'b', 'matMul');\n [$a, $b] = makeTypesMatch($a, $b);\n\n const inputs: BatchMatMulInputs = {a: $a, b: $b};\n const attrs: BatchMatMulAttrs = {transposeA, transposeB};\n\n return ENGINE.runKernel(\n BatchMatMul, inputs as {} as NamedTensorMap, attrs as {} as NamedAttrMap);\n}\n\nexport const matMul = op({matMul_});\n", "/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {ENGINE} from '../engine';\nimport {OneHot, OneHotAttrs, OneHotInputs} from '../kernel_names';\nimport {NamedAttrMap} from '../kernel_registry';\nimport {Tensor} from '../tensor';\nimport {NamedTensorMap} from '../tensor_types';\nimport {convertToTensor} from '../tensor_util_env';\nimport {TensorLike} from '../types';\n\nimport {op} from './operation';\n\n/**\n * Creates a one-hot `tf.Tensor`. The locations represented by `indices` take\n * value `onValue` (defaults to 1), while all other locations take value\n * `offValue` (defaults to 0). If `indices` is rank `R`, the output has rank\n * `R+1` with the last axis of size `depth`.\n *\n * ```js\n * tf.oneHot(tf.tensor1d([0, 1], 'int32'), 3).print();\n * ```\n *\n * @param indices `tf.Tensor` of indices with dtype `int32`.\n * @param depth The depth of the one hot dimension.\n * @param onValue A number used to fill in the output when the index matches\n * the location.\n * @param offValue A number used to fill in the output when the index does\n * not match the location.\n *\n * @doc {heading: 'Tensors', subheading: 'Creation'}\n */\nfunction oneHot_(\n indices: Tensor|TensorLike, depth: number, onValue = 1,\n offValue = 0): Tensor {\n if (depth < 2) {\n throw new Error(`Error in oneHot: depth must be >=2, but it is ${depth}`);\n }\n const $indices = convertToTensor(indices, 'indices', 'oneHot', 'int32');\n\n const inputs: OneHotInputs = {indices: $indices};\n const attrs: OneHotAttrs = {depth, onValue, offValue};\n\n return ENGINE.runKernel(\n OneHot, inputs as unknown as NamedTensorMap,\n attrs as unknown as NamedAttrMap);\n}\n\nexport const oneHot = op({oneHot_});\n", "/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {ENGINE} from '../engine';\nimport {Transpose, TransposeAttrs, TransposeInputs} from '../kernel_names';\nimport {NamedAttrMap} from '../kernel_registry';\nimport {Tensor} from '../tensor';\nimport {NamedTensorMap} from '../tensor_types';\nimport {convertToTensor} from '../tensor_util_env';\nimport {TensorLike} from '../types';\nimport * as util from '../util';\n\nimport {op} from './operation';\n\n/**\n * Transposes the `tf.Tensor`. Permutes the dimensions according to `perm`.\n *\n * The returned `tf.Tensor`'s dimension `i` will correspond to the input\n * dimension `perm[i]`. If `perm` is not given, it is set to `[n-1...0]`,\n * where `n` is the rank of the input `tf.Tensor`. Hence by default, this\n * operation performs a regular matrix transpose on 2-D input `tf.Tensor`s.\n *\n * ```js\n * const a = tf.tensor2d([1, 2, 3, 4, 5, 6], [2, 3]);\n *\n * a.transpose().print(); // or tf.transpose(a)\n * ```\n *\n * @param x The tensor to transpose.\n * @param perm The permutation of the dimensions of a.\n *\n * @doc {heading: 'Operations', subheading: 'Matrices'}\n */\nfunction transpose_(x: T|TensorLike, perm?: number[]): T {\n const $x = convertToTensor(x, 'x', 'transpose');\n\n if (perm == null) {\n perm = $x.shape.map((s, i) => i).reverse();\n }\n util.assert(\n $x.rank === perm.length,\n () => `Error in transpose: rank of input ${$x.rank} ` +\n `must match length of perm ${perm}.`);\n perm.forEach(axis => {\n util.assert(\n axis >= 0 && axis < $x.rank,\n () => `All entries in 'perm' must be between 0 and ${$x.rank - 1}` +\n ` but got ${perm}`);\n });\n\n if ($x.rank <= 1) {\n return $x.clone();\n }\n\n const inputs: TransposeInputs = {x: $x};\n const attrs: TransposeAttrs = {perm};\n\n return ENGINE.runKernel(\n Transpose, inputs as {} as NamedTensorMap, attrs as {} as NamedAttrMap);\n}\n\nexport const transpose = op({transpose_});\n", "/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {Tensor1D, Tensor2D} from '../tensor';\nimport {convertToTensor} from '../tensor_util_env';\nimport {TensorLike} from '../types';\nimport * as util from '../util';\n\nimport {cast} from './cast';\nimport {matMul} from './mat_mul';\nimport {oneHot} from './one_hot';\nimport {op} from './operation';\nimport {transpose} from './transpose';\n\n/**\n * Computes the confusion matrix from true labels and predicted labels.\n *\n * ```js\n * const labels = tf.tensor1d([0, 1, 2, 1, 0], 'int32');\n * const predictions = tf.tensor1d([0, 2, 2, 1, 0], 'int32');\n * const numClasses = 3;\n * const out = tf.math.confusionMatrix(labels, predictions, numClasses);\n * out.print();\n * // Expected output matrix:\n * // [[2, 0, 0],\n * // [0, 1, 1],\n * // [0, 0, 1]]\n * ```\n *\n * @param labels The target labels, assumed to be 0-based integers\n * for the classes. The shape is `[numExamples]`, where\n * `numExamples` is the number of examples included.\n * @param predictions The predicted classes, assumed to be\n * 0-based integers for the classes. Must have the same shape as `labels`.\n * @param numClasses Number of all classes, as an integer.\n * Its value must be larger than the largest element in `labels` and\n * `predictions`.\n * @returns The confusion matrix as a int32-type 2D tensor. The value at\n * row `r` and column `c` is the number of times examples of actual class\n * `r` were predicted as class `c`.\n *\n * @doc {heading: 'Operations', subheading: 'Evaluation'}\n */\nexport function confusionMatrix_(\n labels: Tensor1D|TensorLike, predictions: Tensor1D|TensorLike,\n numClasses: number): Tensor2D {\n const $labels = convertToTensor(labels, 'labels', 'confusionMatrix');\n const $predictions =\n convertToTensor(predictions, 'predictions', 'confusionMatrix');\n\n util.assert(\n numClasses == null || numClasses > 0 && Number.isInteger(numClasses),\n () => `If provided, numClasses must be a positive integer, ` +\n `but got ${numClasses}`);\n util.assert(\n $labels.rank === 1,\n () => `Expected the rank of labels to be 1, but got ${$labels.rank}`);\n util.assert(\n $predictions.rank === 1,\n () => `Expected the rank of predictions to be 1, ` +\n `but got ${$predictions.rank}`);\n util.assert(\n $labels.shape[0] === $predictions.shape[0],\n () => `Mismatch in the number of examples: ` +\n `${$labels.shape[0]} vs. ${$predictions.shape[0]}. ` +\n `Labels and predictions should have the same number of elements.`);\n util.assert(\n numClasses > 0 && Number.isInteger(numClasses),\n () => `numClasses is required to be a positive integer, but got ` +\n `${numClasses}`);\n // TODO(cais): In the future, if oneHot supports tensors inputs for\n // `numClasses`, `confusionMatrix` can make `numClasses` optional.\n\n const oneHotLabels = oneHot(cast($labels, 'int32'), numClasses) as Tensor2D;\n const oneHotPredictions =\n oneHot(cast($predictions, 'int32'), numClasses) as Tensor2D;\n const oneHotLabelsT: Tensor2D = transpose(oneHotLabels);\n const product: Tensor2D = matMul(oneHotLabelsT, oneHotPredictions);\n return cast(product, 'int32');\n}\n\nexport const confusionMatrix = op({confusionMatrix_});\n", "/**\n * @license\n * Copyright 2019 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {ENGINE} from '../engine';\nimport {env} from '../environment';\nimport {FromPixels, FromPixelsAttrs, FromPixelsInputs} from '../kernel_names';\nimport {getKernel, NamedAttrMap} from '../kernel_registry';\nimport {Tensor, Tensor2D, Tensor3D} from '../tensor';\nimport {NamedTensorMap} from '../tensor_types';\nimport {convertToTensor} from '../tensor_util_env';\nimport {PixelData, TensorLike} from '../types';\n\nimport {cast} from './cast';\nimport {op} from './operation';\nimport {tensor3d} from './tensor3d';\n\nlet fromPixels2DContext: CanvasRenderingContext2D;\n\n/**\n * Creates a `tf.Tensor` from an image.\n *\n * ```js\n * const image = new ImageData(1, 1);\n * image.data[0] = 100;\n * image.data[1] = 150;\n * image.data[2] = 200;\n * image.data[3] = 255;\n *\n * tf.browser.fromPixels(image).print();\n * ```\n *\n * @param pixels The input image to construct the tensor from. The\n * supported image types are all 4-channel. You can also pass in an image\n * object with following attributes:\n * `{data: Uint8Array; width: number; height: number}`\n * @param numChannels The number of channels of the output tensor. A\n * numChannels value less than 4 allows you to ignore channels. Defaults to\n * 3 (ignores alpha channel of input image).\n *\n * @returns A Tensor3D with the shape `[height, width, numChannels]`.\n *\n * @doc {heading: 'Browser', namespace: 'browser', ignoreCI: true}\n */\nfunction fromPixels_(\n pixels: PixelData|ImageData|HTMLImageElement|HTMLCanvasElement|\n HTMLVideoElement|ImageBitmap,\n numChannels = 3): Tensor3D {\n // Sanity checks.\n if (numChannels > 4) {\n throw new Error(\n 'Cannot construct Tensor with more than 4 channels from pixels.');\n }\n if (pixels == null) {\n throw new Error('pixels passed to tf.browser.fromPixels() can not be null');\n }\n let isPixelData = false;\n let isImageData = false;\n let isVideo = false;\n let isImage = false;\n let isCanvasLike = false;\n let isImageBitmap = false;\n if ((pixels as PixelData).data instanceof Uint8Array) {\n isPixelData = true;\n } else if (\n typeof (ImageData) !== 'undefined' && pixels instanceof ImageData) {\n isImageData = true;\n } else if (\n typeof (HTMLVideoElement) !== 'undefined' &&\n pixels instanceof HTMLVideoElement) {\n isVideo = true;\n } else if (\n typeof (HTMLImageElement) !== 'undefined' &&\n pixels instanceof HTMLImageElement) {\n isImage = true;\n // tslint:disable-next-line: no-any\n } else if ((pixels as any).getContext != null) {\n isCanvasLike = true;\n } else if (\n typeof (ImageBitmap) !== 'undefined' && pixels instanceof ImageBitmap) {\n isImageBitmap = true;\n } else {\n throw new Error(\n 'pixels passed to tf.browser.fromPixels() must be either an ' +\n `HTMLVideoElement, HTMLImageElement, HTMLCanvasElement, ImageData ` +\n `in browser, or OffscreenCanvas, ImageData in webworker` +\n ` or {data: Uint32Array, width: number, height: number}, ` +\n `but was ${(pixels as {}).constructor.name}`);\n }\n if (isVideo) {\n const HAVE_CURRENT_DATA_READY_STATE = 2;\n if (isVideo &&\n (pixels as HTMLVideoElement).readyState <\n HAVE_CURRENT_DATA_READY_STATE) {\n throw new Error(\n 'The video element has not loaded data yet. Please wait for ' +\n '`loadeddata` event on the