diff --git a/.vscode/settings.json b/.vscode/settings.json index e2400d4..e9b38e5 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -53,6 +53,5 @@ "thread": "cpp", "cinttypes": "cpp", "typeinfo": "cpp" - }, - "C_Cpp.errorSquiggles": "Disabled" + } } \ No newline at end of file diff --git a/index.html b/index.html index 12155f6..c0a74bd 100644 --- a/index.html +++ b/index.html @@ -336,7 +336,7 @@ 1 - pi.SET_PULL_DOWN + pi.PULL_DOWN 6 @@ -440,6 +440,18 @@ + + + + 0 + + + + + abc + + + diff --git a/index.js b/index.js index 6cbf734..5d6930b 100644 --- a/index.js +++ b/index.js @@ -87,6 +87,9 @@ Blockly.Msg["GPIO_CLOSE_TOOLTIP"] = "GPIOとの接続を終了します。"; Blockly.Msg["GPIO_CLOSE_TITLE"] = "GPIO の後片付けをする"; Blockly.Msg["GPIO_SET_INPUT_TITLE"] = "GPIO %1 を入力モードにして %2"; Blockly.Msg["GPIO_SET_INPUT_TOOLTIP"] = "GPIO端子を入力モードにして、プルアップ・プルダウン・無しを設定します。"; +Blockly.Msg["GPIO_SET_INPUT_PULLUP"] = "プルアップ"; +Blockly.Msg["GPIO_SET_INPUT_PULLDOWN"] = "プルダウン"; +Blockly.Msg["GPIO_SET_INPUT_PULLNONE"] = "プル無し"; Blockly.Msg["GPIO_SET_OUTPUT_TITLE"] = "GPIO %1 を出力モードにする"; Blockly.Msg["GPIO_SET_OUTPUT_TOOLTIP"] = "GPIO端子のモードを出力に設定します。"; Blockly.Msg["GPIO_READ_TITLE"] = "GPIO %1 の値"; @@ -117,6 +120,8 @@ Blockly.Msg["I2C_WRITE_BYTE_DATA_TITLE"] = "レジスタ %1 に %2 を書き込 Blockly.Msg["I2C_WRITE_BYTE_DATA_TOOLTIP"] = "デバイスの指定されたレジスタに1バイトを書き込みます。"; Blockly.Msg["I2C_READ_BYTE_DATA_TITLE"] = "レジスタ %1 の値"; Blockly.Msg["I2C_READ_BYTE_DATA_TOOLTIP"] = "デバイスの指定されたレジスタから1バイトを読み込みます。"; +Blockly.Msg["I2C_WRITE_I2C_BLOCK_DATA_TITLE"] = "レジスタ %1 に %2 を書き込む"; +Blockly.Msg["I2C_WRITE_I2C_BLOCK_DATA_TOOLTIP"] = "デバイスの指定されたレジスタに最大32バイトのテキストデータを書き込みます。"; Blockly.Msg["I2C_READ_DEVICE_TITLE"] = "i2cデバイスから %1 バイト受け取る"; Blockly.Msg["I2C_READ_DEVICE_TOOLTIP"] = "デバイスから指定したバイト数のデータを受け取ります。データが指定の長さより短いこともあります。"; Blockly.Msg["I2C_WRITE_DEVICE_TITLE"] = "i2c デバイスに %1 を送信"; diff --git a/index_elutil.js b/index_elutil.js index b6e493c..0c76c0f 100644 --- a/index_elutil.js +++ b/index_elutil.js @@ -12,8 +12,9 @@ const ugj_const = { executable_path: './bin/', localStorage_fname: 'ocoge.json', error_ja_all: 'エラーが発生しました。\n『おこげ倶楽部』までお問い合わせください。', - PIG: 'pigpio', - LG: 'lgpio' + pig: 'pigpio', + lg: 'lgpio', // lgpioがテストフェーズを終えてハードウェアPWMを実装したら切り替えを実装予定 + i2c_defbus: '6' // 文字列リテラルで指定 } /** クラス elUtil ****************************************************************** */ @@ -28,7 +29,8 @@ class elUtil { this.wsChanged = false; this.mascotFilePath = this.path.join(ugj_const.mascot_path, ugj_const.mascot_defname); this.children = []; - this.gpio_backend = ugj_const.PIG; + this.gpio_backend = ugj_const.pig; + this.i2c_bus = ugj_const.i2c_defbus; } // 0で数値の桁合わせ : NUM=値 LEN=桁数 zeroPadding(NUM, LEN) { @@ -226,6 +228,11 @@ class elUtil { return this.mascotFilePath; } + // i2cバス番号変更 + setI2cbusNo(n) { + this.i2c_bus = n; + } + // ファイル名にアプリケーションのドキュメントルートまでのパスをつけて返す getDocPath(filename) { diff --git a/lib/face-api.js b/lib/face-api.js deleted file mode 100644 index 7fd2229..0000000 --- a/lib/face-api.js +++ /dev/null @@ -1,6197 +0,0 @@ -(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : - typeof define === 'function' && define.amd ? define(['exports'], factory) : - (factory((global.faceapi = global.faceapi || {}))); -}(this, (function (exports) { 'use strict'; - - /** - * @license - * Copyright 2018 Google LLC. All Rights Reserved. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============================================================================= - */ - var extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t;}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);};function __extends(e,t){function n(){this.constructor=e;}extendStatics(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n);}var __assign=Object.assign||function(e){for(var t,n=1,r=arguments.length;n0&&o[o.length-1])&&(6===a[0]||2===a[0])){i=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]0;)r=Math.random()*t|0,n=e[--t],e[t]=e[r],e[r]=n;}function clamp(e,t,n){return Math.max(e,Math.min(t,n))}function randUniform(e,t){var n=Math.random();return t*n+(1-n)*e}function distSquared(e,t){for(var n=0,r=0;r0,function(){return "Element arr["+n.join("][")+"] should be a primitive, but is an array of "+e.length+" elements"}),assert(e.length===t[0],function(){return "Element arr["+n.join("][")+"] should have "+t[0]+" elements, but has "+e.length+" elements"});for(var r=t.slice(1),o=0;o1;--t)if(e%t==0)return [t,e/t];return [1,e]}function createShuffledIndices(e){for(var t=new Uint32Array(e),n=0;n=n?o():setTimeout(i,s);}};i();})}function inferFromImplicitShape(e,t){for(var n=1,r=-1,o=0;o=0)n*=e[o];else if(-1===e[o]){if(-1!==r)throw Error("Shapes can only have 1 implicit size. Found -1 at dim "+r+" and dim "+o);r=o;}else if(e[o]<0)throw Error("Shapes can not be < 0. Found "+e[o]+" at dim "+o);if(-1===r){if(t>0&&t!==n)throw Error("Size("+t+") must match the product of shape "+e);return e}if(0===n)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);var a=e.slice();return a[r]=t/n,a}function squeezeShape(e,t){for(var n=[],r=[],o=0,a=0;aa)&&1===e[a]&&(n.push(e[a]),r.push(a)),t[o]<=a&&o++;}1!==e[a]&&(n.push(e[a]),r.push(a));}return {newShape:n,keptDims:r}}function getTypedArrayFromDType(e,t){var n=null;if(null==e||"float32"===e)n=new Float32Array(t);else if("int32"===e)n=new Int32Array(t);else{if("bool"!==e)throw new Error("Unknown data type "+e);n=new Uint8Array(t);}return n}function checkComputationForNaN(e,t,n){if("float32"===t)for(var r=0;r=0;--r)n[r]=n[r+1]*e[r+1];return n}function toTypedArray(e,t,n){return noConversionNeeded(e,t)?e:(Array.isArray(e)&&(e=flatten(e)),copyTypedArray(e,t,n))}function noConversionNeeded(e,t){return e instanceof Float32Array&&"float32"===t||e instanceof Int32Array&&"int32"===t||e instanceof Uint8Array&&"bool"===t}function makeOnesTypedArray(e,t){for(var n=makeZerosTypedArray(e,t),r=0;r1)for(var l=0;lFORMAT_LIMIT_NUM_VALS){var l=FORMAT_NUM_FIRST_LAST_VALS*i,c=Array.from(e.subarray(0,l)),p=Array.from(e.subarray(s-FORMAT_NUM_FIRST_LAST_VALS*i,s));return "complex64"===n&&(c=createComplexTuples(c),p=createComplexTuples(p)),["["+c.map(function(e,t){return valToString(e,o[t])}).join(", ")+", ..., "+p.map(function(e,t){return valToString(e,o[s-FORMAT_NUM_FIRST_LAST_VALS+t])}).join(", ")+"]"]}return ["["+("complex64"===n?createComplexTuples(e):Array.from(e)).map(function(e,t){return valToString(e,o[t])}).join(", ")+"]"]}var d=t.slice(1),h=r.slice(1),f=r[0]*i,m=[];if(s>FORMAT_LIMIT_NUM_VALS){for(var g=0;g=0;a--)for(i=(f=e[a]).inputs,c=0;c=0;r--)n(r);}function assertTypesMatch(e,t){assert(e.dtype===t.dtype,"The dtypes of the first("+e.dtype+") and second("+t.dtype+") input must match");}function isTensorInList(e,t){for(var n=0;n {...}) to avoid memory leaks.");return this.keepTensors.add(e.id),e},e.prototype.startScope=function(e,t){void 0===t&&(t=!1),t&&0===this.gradientScopeCount&&(this.activeTape=[]),t&&this.gradientScopeCount++;var n={track:[],name:"unnamed scope"};e&&(n.name=e),this.scopeStack.push(n),this.activeScope=n;},e.prototype.endScope=function(e,t){var n=this;void 0===t&&(t=!1),t&&(this.gradientScopeCount--,0===this.gradientScopeCount&&(this.activeTape=null));var r=new Set(this.keepTensors),o=getTensorsInContainer(e);o.forEach(function(e){return r.add(e.id)});for(var a=0;a0,"gradients() received an empty list of xs."),this.tidy("gradients",function(){var a=e();assert(a instanceof Tensor,"The result y returned by f() must be a tensor.");var i=getFilteredNodesXToY(o.activeTape,t,a);if(!r&&0===i.length&&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.");var s={};return s[a.id]=null==n?ones(a.shape):n,backpropagateGradients(s,i),{value:a,grads:t.map(function(e){return s[e.id]})}},!0)},e.prototype.customGrad=function(e){var t=this;return assert(isFunction(e),"The f passed in customGrad(f) must be a function."),function(){for(var n,r,o=[],a=0;a {op();...}); to avoid memory leaks.");return this.activeScope.track.push(e),e},e}();function ones(e){var t=makeOnesTypedArray(sizeFromShape(e),"float32");return Tensor.make(e,{values:t})}!function(e){e[e.NUMBER=0]="NUMBER",e[e.BOOLEAN=1]="BOOLEAN",e[e.STRING=2]="STRING";}(Type||(Type={}));var URL_PROPERTIES=[{name:"DEBUG",type:Type.BOOLEAN},{name:"IS_BROWSER",type:Type.BOOLEAN},{name:"WEBGL_PAGING_ENABLED",type:Type.BOOLEAN},{name:"WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_VERSION",type:Type.NUMBER},{name:"WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_RELIABLE",type:Type.BOOLEAN},{name:"WEBGL_VERSION",type:Type.NUMBER},{name:"WEBGL_RENDER_FLOAT32_ENABLED",type:Type.BOOLEAN},{name:"WEBGL_DOWNLOAD_FLOAT_ENABLED",type:Type.BOOLEAN},{name:"WEBGL_FENCE_API_ENABLED",type:Type.BOOLEAN},{name:"BACKEND",type:Type.STRING},{name:"EPSILON",type:Type.NUMBER}];function isWebGLVersionEnabled(e,t){var n;try{n=getWebGLRenderingContext(e,t);}catch(e){return !1}return null!=n&&(loseContext(n),!0)}function getWebGLDisjointQueryTimerVersion(e,t){if(0===e)return 0;var n,r=getWebGLRenderingContext(e,t);return n=hasExtension(r,"EXT_disjoint_timer_query_webgl2")&&2===e?2:hasExtension(r,"EXT_disjoint_timer_query")?1:0,null!=r&&loseContext(r),n}function isRenderToFloatTextureEnabled(e,t){if(0===e)return !1;var n=getWebGLRenderingContext(e,t);if(1===e){if(!hasExtension(n,"OES_texture_float"))return !1}else if(!hasExtension(n,"EXT_color_buffer_float"))return !1;var r=createFloatTextureAndBindToFramebuffer(n,e);return loseContext(n),r}function isDownloadFloatTextureEnabled(e,t){if(0===e)return !1;var n=getWebGLRenderingContext(e,t);if(1===e){if(!hasExtension(n,"OES_texture_float"))return !1;if(!hasExtension(n,"WEBGL_color_buffer_float"))return !1}else if(!hasExtension(n,"EXT_color_buffer_float"))return !1;var r=createFloatTextureAndBindToFramebuffer(n,e);return loseContext(n),r}function isWebGLFenceEnabled(e,t){if(2!==e)return !1;var n=getWebGLRenderingContext(e,t),r=null!=n.fenceSync;return loseContext(n),r}function isChrome(){return "undefined"!=typeof navigator&&null!=navigator&&null!=navigator.userAgent&&/Chrome/.test(navigator.userAgent)&&/Google Inc/.test(navigator.vendor)}var TENSORFLOWJS_FLAGS_PREFIX="tfjsflags";function getFeaturesFromURL(){var e={};if("undefined"==typeof window||void 0===window.location)return e;var t=getQueryParams(window.location.search);if(TENSORFLOWJS_FLAGS_PREFIX in t){var n={};t[TENSORFLOWJS_FLAGS_PREFIX].split(",").forEach(function(e){var t=e.split(":"),r=t[0],o=t[1];n[r]=o;}),URL_PROPERTIES.forEach(function(t){t.name in n&&(console.log("Setting feature override from URL "+t.name+": "+n[t.name]),t.type===Type.NUMBER?e[t.name]=+n[t.name]:t.type===Type.BOOLEAN?e[t.name]="true"===n[t.name]:t.type===Type.STRING?e[t.name]=n[t.name]:console.warn("Unknown URL param: "+t.name+"."));});}return e}function hasExtension(e,t){return null!=e.getExtension(t)}function getWebGLRenderingContext(e,t){if(0===e||!t)throw new Error("Cannot get WebGL rendering context, WebGL is disabled.");var n=document.createElement("canvas");return 1===e?n.getContext("webgl")||n.getContext("experimental-webgl"):n.getContext("webgl2")}function loseContext(e){if(null!=e){var t=e.getExtension("WEBGL_lose_context");if(null==t)throw new Error("Extension WEBGL_lose_context not supported on this browser.");t.loseContext();}}function createFloatTextureAndBindToFramebuffer(e,t){var n=e.createFramebuffer(),r=e.createTexture();e.bindTexture(e.TEXTURE_2D,r);var o=2===t?e.RGBA32F:e.RGBA;e.texImage2D(e.TEXTURE_2D,0,o,1,1,0,e.RGBA,e.FLOAT,null),e.bindFramebuffer(e.FRAMEBUFFER,n),e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,r,0);var a=e.checkFramebufferStatus(e.FRAMEBUFFER)===e.FRAMEBUFFER_COMPLETE;return e.bindTexture(e.TEXTURE_2D,null),e.bindFramebuffer(e.FRAMEBUFFER,null),e.deleteTexture(r),e.deleteFramebuffer(n),a}function getQueryParams(e){var t={};return e.replace(/[?&]([^=?&]+)(?:=([^&]*))?/g,function(e){for(var n=[],r=1;r0&&!isMobile();if("HAS_WEBGL"===e)return this.get("WEBGL_VERSION")>0;if("WEBGL_VERSION"===e)return isWebGLVersionEnabled(2,this.get("IS_BROWSER"))?2:isWebGLVersionEnabled(1,this.get("IS_BROWSER"))?1:0;if("WEBGL_RENDER_FLOAT32_ENABLED"===e)return isRenderToFloatTextureEnabled(this.get("WEBGL_VERSION"),this.get("IS_BROWSER"));if("WEBGL_DOWNLOAD_FLOAT_ENABLED"===e)return isDownloadFloatTextureEnabled(this.get("WEBGL_VERSION"),this.get("IS_BROWSER"));if("WEBGL_FENCE_API_ENABLED"===e)return isWebGLFenceEnabled(this.get("WEBGL_VERSION"),this.get("IS_BROWSER"));if("TEST_EPSILON"===e)return 32===this.backend.floatPrecision()?TEST_EPSILON_FLOAT32:TEST_EPSILON_FLOAT16;if("EPSILON"===e)return 32===this.backend.floatPrecision()?EPSILON_FLOAT32:EPSILON_FLOAT16;throw new Error("Unknown feature "+e+".")},e.prototype.setFeatures=function(e){this.features=Object.assign({},e);},e.prototype.reset=function(){this.features=getFeaturesFromURL(),null!=this.globalEngine&&(this.globalEngine=null);},Object.defineProperty(e.prototype,"backend",{get:function(){return this.engine.backend},enumerable:!0,configurable:!0}),e.prototype.findBackend=function(e){return e in this.registry?this.registry[e].backend:null},e.prototype.registerBackend=function(e,t,n,r){var o=this;if(void 0===n&&(n=1),e in this.registry)return console.warn(e+" backend was already registered. Reusing existing backend"),null!=r&&r(function(){return o.engine}),!1;try{var a=t();return a.setDataMover({moveData:function(e){return o.engine.moveData(e)}}),this.registry[e]={backend:a,priority:n},!0}catch(t){return console.warn("Registration of backend "+e+" failed"),console.warn(t.stack||t.message),!1}},e.prototype.removeBackend=function(e){if(!(e in this.registry))throw new Error(e+" backend not found in registry");this.registry[e].backend.dispose(),delete this.registry[e];},Object.defineProperty(e.prototype,"engine",{get:function(){return this.initEngine(),this.globalEngine},enumerable:!0,configurable:!0}),e.prototype.initEngine=function(){var e=this;if(null==this.globalEngine){this.backendName=this.get("BACKEND");var t=this.findBackend(this.backendName);this.globalEngine=new Engine(t,!1,function(){return e.get("DEBUG")});}},e}();function getGlobalNamespace(){var e;if("undefined"!=typeof window)e=window;else{if("undefined"==typeof process)throw new Error("Could not find a global object");e=process;}return e}function getOrMakeEnvironment(){var e=getGlobalNamespace();return null==e.ENV&&(e.ENV=new Environment(getFeaturesFromURL()),setTensorTracker(function(){return e.ENV.engine})),e.ENV}var ENV=getOrMakeEnvironment(),environment=Object.freeze({Environment:Environment,ENV:ENV});function grad(e){return assert(isFunction(e),"The f passed in grad(f) must be a function"),function(t,n){return assert(t instanceof Tensor,"The x passed in grad(f)(x) must be a tensor"),assert(null==n||n instanceof Tensor,"The dy passed in grad(f)(x, dy) must be a tensor"),ENV.engine.tidy(function(){var r=ENV.engine.gradients(function(){return e(t)},[t],n),o=r.value,a=r.grads;return null!=n&&assertShapesMatch(o.shape,n.shape,"The shape of dy passed in grad(f)(x, dy) must match the shape returned by f(x)"),checkGrads(a),a[0]})}}function grads(e){return assert(isFunction(e),"The f passed in grads(f) must be a function"),function(t,n){return assert(Array.isArray(t)&&t.every(function(e){return e instanceof Tensor}),"The args passed in grads(f)(args) must be an array of tensors"),assert(null==n||n instanceof Tensor,"The dy passed in grads(f)(args, dy) must be a tensor"),ENV.engine.tidy(function(){var r=ENV.engine.gradients(function(){return e.apply(void 0,t)},t,n),o=r.value,a=r.grads;return null!=n&&assertShapesMatch(o.shape,n.shape,"The shape of dy passed in grads(f)([x1,...], dy) must match the shape returned by f([x1,...])"),checkGrads(a),a})}}function valueAndGrad(e){return assert(isFunction(e),"The f passed in valueAndGrad(f) must be a function"),function(t,n){assert(t instanceof Tensor,"The x passed in valueAndGrad(f)(x) must be a tensor"),assert(null==n||n instanceof Tensor,"The dy passed in valueAndGrad(f)(x, dy) must be a tensor");var r=ENV.engine.gradients(function(){return e(t)},[t],n),o=r.grads,a=r.value;return checkGrads(o),{grad:o[0],value:a}}}function valueAndGrads(e){return assert(isFunction(e),"The f passed in valueAndGrads(f) must be a function"),function(t,n){assert(Array.isArray(t)&&t.every(function(e){return e instanceof Tensor}),"The args passed in valueAndGrads(f)(args) must be array of tensors"),assert(null==n||n instanceof Tensor,"The dy passed in valueAndGrads(f)(args, dy) must be a tensor");var r=ENV.engine.gradients(function(){return e.apply(void 0,t)},t,n);return null!=n&&assertShapesMatch(r.value.shape,n.shape,"The shape of dy passed in valueAndGrads(f)([x1,...], dy) must match the shape returned by f([x1,...])"),checkGrads(r.grads),r}}function variableGrads(e,t){if(assert(isFunction(e),"The f passed in variableGrads(f) must be a function"),assert(null==t||Array.isArray(t)&&t.every(function(e){return e instanceof Variable}),"The varList passed in variableGrads(f, varList) must be an array of variables"),null==t)for(var n in t=[],ENV.engine.registeredVariables)t.push(ENV.engine.registeredVariables[n]);var r=t.length;assert((t=t.filter(function(e){return e.trainable})).length>0,"variableGrads() expects at least one of the input variables to be trainable, but none of the "+r+" variables is trainable.");var o=ENV.engine.gradients(e,t,null,!0),a=o.value,i=o.grads;assert(i.some(function(e){return null!=e}),"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()."),assert(0===a.rank,"The f passed in variableGrads(f) must return a scalar, but it returned a rank-"+a.rank+" tensor");var s={};return t.forEach(function(e,t){null!=i[t]&&(s[e.name]=i[t]);}),{value:a,grads:s}}function customGrad(e){return ENV.engine.customGrad(e)}function checkGrads(e){if(e.filter(function(e){return null==e}).length>0)throw new Error("Cannot compute gradient of y=f(x) with respect to x. Make sure that\n the f you passed encloses all operations that lead from x to y.")}var tidy=Environment.tidy,keep=Environment.keep,dispose=Environment.dispose,time=Environment.time,profile=Environment.profile;function warn(){for(var e=[],t=0;t=2*t+1||o%2==1?i.push(o):a.push(o);r.push.apply(r,a),r.push(0),r.push.apply(r,i);}return r}function getReshapedPermuted(e,t,n,r){void 0===r&&(r=!0);var o=[];r?o.push(e[0]/n):o.push(e[0]*n);for(var a=1;a=-n&&e=0&&tt||n===e){r=!0;break}n=nearestDivisor(e,n+1);}return n}function computeOutShape$1(e,t,n){for(var r=[],o=e.length,a=0;a0?o>=c[t]:o<=c[t]);o+=r[t])n+=1;return n}),[l,h,p]}function startForAxis(e,t,n,r,o){var a=t[o];e&1<0?Number.MIN_SAFE_INTEGER:Number.MAX_SAFE_INTEGER);var i=r[o];return a<0&&(a+=i),a=clamp(0,a,i-1)}function stopForAxis(e,t,n,r,o){var a=t[o];e&1<0?Number.MAX_SAFE_INTEGER:Number.MIN_SAFE_INTEGER);var i=r[o];return a<0&&(a+=i),a=n[o]>0?clamp(0,a,i):clamp(-1,a,i-1)}function convertToTensor(e,t,n,r){if(void 0===r&&(r="float32"),r=r||"float32",e instanceof Tensor)return e;if(!isTypedArray(e)&&!Array.isArray(e)&&"number"!=typeof e&&"boolean"!=typeof e)throw new Error("Argument '"+t+"' passed to '"+n+"' must be a Tensor or TensorLike, but got "+e.constructor.name);var o=inferShape(e);return isTypedArray(e)||Array.isArray(e)||(e=[e]),Tensor.make(o,{values:toTypedArray(e,r,ENV.get("DEBUG"))},r)}function convertToTensorArray(e,t,n){if(!Array.isArray(e))throw new Error("Argument "+t+" passed to "+n+" must be a `Tensor[]` or `TensorLike[]`");return e.map(function(e,r){return convertToTensor(e,t+"["+r+"]",n)})}function op(e){var t=Object.keys(e);if(1!==t.length)throw new Error("Please provide an object with a single key (operation name) mapping to a function. Got an object with "+t.length+" keys.");var n=t[0],r=e[n];n.endsWith("_")&&(n=n.substring(0,n.length-1));var o=function(){for(var e=[],t=0;t1)return zeros([0],r);var o=makeZerosTypedArray(Math.abs(Math.ceil((t-e)/n)),r);to}).sort(function(e,t){return t.score-e.score}),i=[],s=0;s=0;--d){if(intersectionOverUnion(e,c,i[d])>=r){p=!0;break}}if(!p&&(i.push(c),i.length>=n))break}return tensor1d(i,"int32")}function intersectionOverUnion(e,t,n){var r=e.subarray(4*t,4*t+4),o=e.subarray(4*n,4*n+4),a=Math.min(r[0],r[2]),i=Math.min(r[1],r[3]),s=Math.max(r[0],r[2]),u=Math.max(r[1],r[3]),l=Math.min(o[0],o[2]),c=Math.min(o[1],o[3]),p=Math.max(o[0],o[2]),d=Math.max(o[1],o[3]),h=(s-a)*(u-i),f=(p-l)*(d-c);if(h<=0||f<=0)return 0;var m=Math.max(a,l),g=Math.max(i,c),v=Math.min(s,p),y=Math.min(u,d),x=Math.max(v-m,0)*Math.max(y-g,0);return x/(h+f-x)}function split(e,t,n){var r=Array(e.rank).fill(0),o=e.shape.slice();return t.map(function(t){o[n]=t;var a=e.slice(r,o);return r[n]+=t,a})}function topkImpl(e,t,n,r,o){for(var a=t[t.length-1],i=[e.length/a,a],s=i[0],u=i[1],l=getTypedArrayFromDType(n,s*r),c=getTypedArrayFromDType("int32",s*r),p=0;p":"<",u=n?"inOffset + i;":"round(getBestIndicesA(batch, inOffset + i));";this.userCode="\n void main() {\n ivec2 coords = getOutputCoords();\n int batch = coords[0];\n int outIdx = coords[1];\n int inOffset = outIdx * "+r+";\n\n int bestIndex = 0;\n float bestValue = getA(batch, inOffset);\n\n for (int i = 0; i < "+r+"; i++) {\n int inIdx = "+u+";\n float candidate = getA(batch, inIdx);\n if (candidate "+s+" bestValue) {\n bestValue = candidate;\n bestIndex = inIdx;\n }\n }\n setOutput(float(bestIndex));\n }\n ";}}(),AvgPool2DBackpropProgram=function(){return function(e){this.variableNames=["dy"],this.outputShape=e.inShape;var t=e.filterHeight,n=e.filterWidth,r=e.strideHeight,o=e.strideWidth,a=t-1-e.padInfo.top,i=n-1-e.padInfo.left,s=1/(t*n);this.userCode="\n const ivec2 pads = ivec2("+a+", "+i+");\n const float avgMultiplier = float("+s+");\n\n void main() {\n ivec4 coords = getOutputCoords();\n int b = coords[0];\n int d = coords[3];\n\n ivec2 dyRCCorner = coords.yz - pads;\n int dyRCorner = dyRCCorner.x;\n int dyCCorner = dyRCCorner.y;\n\n // Convolve dy(?, ?, d) with pos mask(:, :, d) to get dx(xR, xC, d).\n // ? = to be determined. : = across all values in that axis.\n float dotProd = 0.0;\n for (int wR = 0; wR < "+t+"; wR++) {\n float dyR = float(dyRCorner + wR) / "+r+".0;\n\n if (dyR < 0.0 || dyR >= "+e.outHeight+".0 || fract(dyR) > 0.0) {\n continue;\n }\n int idyR = int(dyR);\n\n for (int wC = 0; wC < "+n+"; wC++) {\n float dyC = float(dyCCorner + wC) / "+o+".0;\n\n if (dyC < 0.0 || dyC >= "+e.outWidth+".0 ||\n fract(dyC) > 0.0) {\n continue;\n }\n int idyC = int(dyC);\n\n float dyValue = getDy(b, idyR, idyC, d);\n\n dotProd += dyValue * avgMultiplier;\n }\n }\n setOutput(dotProd);\n }\n ";}}();function getBroadcastDims(e,t){for(var n=e.length,r=[],o=0;o1&&1===i&&r.unshift(a);}return r}function getReductionAxes(e,t){for(var n=[],r=0;r1)&&n.unshift(a);}return n}function broadcastDimsAreOuter(e){for(var t=0;t= "+e.inHeight+") {\n continue;\n }\n\n for (int yC = 0; yC < "+e.outWidth+"; yC++) {\n int xC = wC + yC * "+n+" - "+o+";\n\n if (xC < 0 || xC >= "+e.inWidth+") {\n continue;\n }\n\n float dyValue = getDy(b, yR, yC, d2);\n float xValue = getX(b, xR, xC, d1);\n dotProd += (xValue * dyValue);\n }\n }\n }\n setOutput(dotProd);\n }\n ";}}(),Conv2DDerInputProgram=function(){return function(e){this.variableNames=["dy","W"],this.outputShape=e.inShape;var t=e.filterHeight,n=e.filterWidth,r=e.strideHeight,o=e.strideWidth,a=t-1-e.padInfo.top,i=n-1-e.padInfo.left;this.userCode="\n const ivec2 pads = ivec2("+a+", "+i+");\n\n void main() {\n ivec4 coords = getOutputCoords();\n int batch = coords[0];\n int d1 = coords[3];\n\n ivec2 dyCorner = coords.yz - pads;\n int dyRCorner = dyCorner.x;\n int dyCCorner = dyCorner.y;\n\n // Convolve dy(?, ?, d2) with w(:, :, d1, d2) to compute dx(xR, xC, d1).\n // ? = to be determined. : = across all values in that axis.\n float dotProd = 0.0;\n for (int wR = 0; wR < "+t+"; wR++) {\n float dyR = float(dyRCorner + wR) / "+r+".0;\n\n if (dyR < 0.0 || dyR >= "+e.outHeight+".0 || fract(dyR) > 0.0) {\n continue;\n }\n int idyR = int(dyR);\n\n int wRPerm = "+t+" - 1 - wR;\n\n for (int wC = 0; wC < "+n+"; wC++) {\n float dyC = float(dyCCorner + wC) / "+o+".0;\n\n if (dyC < 0.0 || dyC >= "+e.outWidth+".0 ||\n fract(dyC) > 0.0) {\n continue;\n }\n int idyC = int(dyC);\n\n int wCPerm = "+n+" - 1 - wC;\n\n for (int d2 = 0; d2 < "+e.outChannels+"; d2++) {\n float xValue = getDy(batch, idyR, idyC, d2);\n float wValue = getW(wRPerm, wCPerm, d1, d2);\n dotProd += xValue * wValue;\n }\n }\n }\n setOutput(dotProd);\n }\n ";}}(),DepthwiseConv2DDerFilterProgram=function(){return function(e){this.variableNames=["x","dy"],this.outputShape=e.filterShape;var t=e.strideHeight,n=e.strideWidth,r=e.padInfo.top,o=e.padInfo.left,a=e.outChannels/e.inChannels;this.userCode="\n void main() {\n ivec4 coords = getOutputCoords();\n int wR = coords.x;\n int wC = coords.y;\n int d1 = coords.z;\n int dm = coords.w;\n int d2 = d1 * "+a+" + dm;\n\n float dotProd = 0.0;\n\n // TODO: Vec4 over the batch size\n for (int b = 0; b < "+e.batchSize+"; b++) {\n for (int yR = 0; yR < "+e.outHeight+"; yR++) {\n int xR = wR + yR * "+t+" - "+r+";\n\n if (xR < 0 || xR >= "+e.inHeight+") {\n continue;\n }\n\n for (int yC = 0; yC < "+e.outWidth+"; yC++) {\n int xC = wC + yC * "+n+" - "+o+";\n\n if (xC < 0 || xC >= "+e.inWidth+") {\n continue;\n }\n\n float dyValue = getDy(b, yR, yC, d2);\n float xValue = getX(b, xR, xC, d1);\n dotProd += (xValue * dyValue);\n }\n }\n }\n setOutput(dotProd);\n }\n ";}}(),DepthwiseConv2DDerInputProgram=function(){return function(e){this.variableNames=["dy","W"],this.outputShape=e.inShape;var t=e.filterHeight,n=e.filterWidth,r=e.strideHeight,o=e.strideWidth,a=t-1-e.padInfo.top,i=n-1-e.padInfo.left,s=e.outChannels/e.inChannels;this.userCode="\n const ivec2 pads = ivec2("+a+", "+i+");\n\n void main() {\n ivec4 coords = getOutputCoords();\n int batch = coords[0];\n int d1 = coords[3];\n ivec2 dyCorner = coords.yz - pads;\n int dyRCorner = dyCorner.x;\n int dyCCorner = dyCorner.y;\n\n float dotProd = 0.0;\n\n for (int wR = 0; wR < "+t+"; wR++) {\n float dyR = float(dyRCorner + wR) / "+r+".0;\n\n if (dyR < 0.0 || dyR >= "+e.outHeight+".0 || fract(dyR) > 0.0) {\n continue;\n }\n int idyR = int(dyR);\n\n int wRPerm = "+t+" - 1 - wR;\n\n for (int wC = 0; wC < "+n+"; wC++) {\n float dyC = float(dyCCorner + wC) / "+o+".0;\n\n if (dyC < 0.0 || dyC >= "+e.outWidth+".0 ||\n fract(dyC) > 0.0) {\n continue;\n }\n int idyC = int(dyC);\n\n int wCPerm = "+n+" - 1 - wC;\n\n // TODO: Vec4 over the channelMul\n for (int dm = 0; dm < "+s+"; dm++) {\n int d2 = d1 * "+s+" + dm;\n float xValue = getDy(batch, idyR, idyC, d2);\n float wValue = getW(wRPerm, wCPerm, d1, dm);\n dotProd += xValue * wValue;\n }\n }\n }\n setOutput(dotProd);\n }\n ";}}(),Conv2DProgram=function(){return function(e){this.variableNames=["x","W"],this.outputShape=e.outShape;var t=e.padInfo.top,n=e.padInfo.left,r=e.strideHeight,o=e.strideWidth,a=e.dilationHeight,i=e.dilationWidth,s=e.filterHeight,u=e.filterWidth,l=4*Math.floor(e.inChannels/4),c=e.inChannels%4;this.userCode="\n const ivec2 strides = ivec2("+r+", "+o+");\n const ivec2 pads = ivec2("+t+", "+n+");\n\n void main() {\n ivec4 coords = getOutputCoords();\n int batch = coords[0];\n int d2 = coords[3];\n\n ivec2 xRCCorner = coords.yz * strides - pads;\n int xRCorner = xRCCorner.x;\n int xCCorner = xRCCorner.y;\n\n // Convolve x(?, ?, d1) with w(:, :, d1, d2) to get y(yR, yC, d2).\n // ? = to be determined. : = across all values in that axis.\n float dotProd = 0.0;\n for (int wR = 0; wR < "+s+"; wR++) {\n int xR = xRCorner + wR * "+a+";\n\n if (xR < 0 || xR >= "+e.inHeight+") {\n continue;\n }\n\n for (int wC = 0; wC < "+u+"; wC++) {\n int xC = xCCorner + wC * "+i+";\n\n if (xC < 0 || xC >= "+e.inWidth+") {\n continue;\n }\n\n for (int d1 = 0; d1 < "+l+"; d1 += 4) {\n vec4 xValues = vec4(\n getX(batch, xR, xC, d1),\n getX(batch, xR, xC, d1 + 1),\n getX(batch, xR, xC, d1 + 2),\n getX(batch, xR, xC, d1 + 3)\n );\n vec4 wValues = vec4(\n getW(wR, wC, d1, d2),\n getW(wR, wC, d1 + 1, d2),\n getW(wR, wC, d1 + 2, d2),\n getW(wR, wC, d1 + 3, d2)\n );\n\n dotProd += dot(xValues, wValues);\n }\n\n if ("+(1===c)+") {\n dotProd +=\n getX(batch, xR, xC, "+l+") *\n getW(wR, wC, "+l+", d2);\n } else if ("+(2===c)+") {\n vec2 xValues = vec2(\n getX(batch, xR, xC, "+l+"),\n getX(batch, xR, xC, "+l+" + 1)\n );\n vec2 wValues = vec2(\n getW(wR, wC, "+l+", d2),\n getW(wR, wC, "+l+" + 1, d2)\n );\n dotProd += dot(xValues, wValues);\n } else if ("+(3===c)+") {\n vec3 xValues = vec3(\n getX(batch, xR, xC, "+l+"),\n getX(batch, xR, xC, "+l+" + 1),\n getX(batch, xR, xC, "+l+" + 2)\n );\n vec3 wValues = vec3(\n getW(wR, wC, "+l+", d2),\n getW(wR, wC, "+l+" + 1, d2),\n getW(wR, wC, "+l+" + 2, d2)\n );\n dotProd += dot(xValues, wValues);\n }\n }\n }\n setOutput(dotProd);\n }\n ";}}(),DepthwiseConv2DProgram=function(){return function(e){this.variableNames=["x","W"],this.outputShape=e.outShape;var t=e.inHeight,n=e.inWidth,r=e.padInfo.top,o=e.padInfo.left,a=e.strideHeight,i=e.strideWidth,s=e.dilationHeight,u=e.dilationWidth,l=e.filterHeight,c=e.filterWidth,p=e.outChannels/e.inChannels;this.userCode="\n const ivec2 strides = ivec2("+a+", "+i+");\n const ivec2 pads = ivec2("+r+", "+o+");\n\n void main() {\n ivec4 coords = getOutputCoords();\n int batch = coords.x;\n ivec2 xRCCorner = coords.yz * strides - pads;\n int d2 = coords.w;\n int d1 = d2 / "+p+";\n int q = d2 - d1 * "+p+";\n\n int xRCorner = xRCCorner.x;\n int xCCorner = xRCCorner.y;\n\n // Convolve x(?, ?, d1) with w(:, :, d1, q) to get y(yR, yC, d2).\n // ? = to be determined. : = across all values in that axis.\n float dotProd = 0.0;\n // TODO(dsmilkov): Flatten the two for loops and vec4 the operations.\n for (int wR = 0; wR < "+l+"; wR++) {\n int xR = xRCorner + wR * "+s+";\n\n if (xR < 0 || xR >= "+t+") {\n continue;\n }\n\n for (int wC = 0; wC < "+c+"; wC++) {\n int xC = xCCorner + wC * "+u+";\n\n if (xC < 0 || xC >= "+n+") {\n continue;\n }\n\n float xVal = getX(batch, xR, xC, d1);\n float wVal = getW(wR, wC, d1, q);\n dotProd += xVal * wVal;\n }\n }\n setOutput(dotProd);\n }\n ";}}(),CropAndResizeProgram=function(){return function(e,t,n,r,o){this.variableNames=["Image","Boxes","BoxInd"],this.outputShape=[];var a=e[0],i=e[1],s=e[2],u=e[3],l=t[0],c=n[0],p=n[1];this.outputShape=[l,c,p,u];var d="bilinear"===r?1:0,h=[i-1+".0",s-1+".0"],f=h[0],m=h[1],g=c>1?[""+(i-1)/(c-1),"(y2-y1) * height_ratio","y1*"+f+" + float(y)*(height_scale)"]:["0.0","0.0","0.5 * (y1+y2) * "+f],v=g[0],y=g[1],x=g[2],T=p>1?[""+(s-1)/(p-1),"(x2-x1) * width_ratio","x1*"+m+" + float(x)*(width_scale)"]:["0.0","0.0","0.5 * (x1+x2) * "+m],b=T[0],S=T[1],E=T[2];this.userCode="\n const float height_ratio = float("+v+");\n const float width_ratio = float("+b+");\n void main() {\n ivec4 coords = getOutputCoords();\n int b = coords[0];\n int y = coords[1];\n int x = coords[2];\n int d = coords[3];\n\n // get box vals\n float y1 = getBoxes(b,0);\n float x1 = getBoxes(b,1);\n float y2 = getBoxes(b,2);\n float x2 = getBoxes(b,3);\n\n // get image in batch index\n int bInd = round(getBoxInd(b));\n if(bInd < 0 || bInd >= "+a+") {\n return;\n }\n\n float height_scale = "+y+";\n float width_scale = "+S+";\n\n float in_y = "+x+";\n if( in_y < 0.0 || in_y > "+f+" ) {\n setOutput(float("+o+"));\n return;\n }\n float in_x = "+E+";\n if( in_x < 0.0 || in_x > "+m+" ) {\n setOutput(float("+o+"));\n return;\n }\n\n vec2 sourceFracIndexRC = vec2(in_y,in_x);\n if("+d+" == 1) {\n // Compute the four integer indices.\n ivec2 sourceFloorRC = ivec2(sourceFracIndexRC);\n ivec2 sourceCeilRC = ivec2(ceil(sourceFracIndexRC));\n\n float topLeft = getImage(b, sourceFloorRC.x, sourceFloorRC.y, d);\n float bottomLeft = getImage(b, sourceCeilRC.x, sourceFloorRC.y, d);\n float topRight = getImage(b, sourceFloorRC.x, sourceCeilRC.y, d);\n float bottomRight = getImage(b, sourceCeilRC.x, sourceCeilRC.y, d);\n\n vec2 fracRC = sourceFracIndexRC - vec2(sourceFloorRC);\n\n float top = topLeft + (topRight - topLeft) * fracRC.y;\n float bottom = bottomLeft + (bottomRight - bottomLeft) * fracRC.y;\n float newValue = top + (bottom - top) * fracRC.x;\n setOutput(newValue);\n } else {\n // Compute the coordinators of nearest neighbor point.\n ivec2 sourceNearestRC = ivec2(floor(\n sourceFracIndexRC + vec2(0.5,0.5)));\n float newValue = getImage(b, sourceNearestRC.x, sourceNearestRC.y, d);\n setOutput(newValue);\n }\n }\n ";}}();function makeShader(e,t,n,r){var o=e.map(function(e){var t=sizeFromShape(e.shapeInfo.logicalShape);return e.shapeInfo.isUniform?"uniform float "+e.name+(t>1?"["+t+"]":"")+";":"uniform sampler2D "+e.name+";"});o=o.join("\n");var a,i=e.map(function(e){return getInputSamplingSnippet(e,t,r)}).join("\n"),s=t.texShape;return a=t.isPacked?getPackedOutputSamplingSnippet(t.logicalShape,s):getOutputSamplingSnippet(t.logicalShape,s),[SHADER_PREFIX,FLOAT_TEXTURE_SAMPLE_SNIPPET,FLOAT_TEXTURE_SETOUTPUT_SNIPPET,o,a,i,n].join("\n")}function getSamplerFromInInfo(e){var t=e.shapeInfo.logicalShape;switch(t.length){case 0:return getSamplerScalar(e);case 1:return getSampler1D(e);case 2:return getSampler2D(e);case 3:return getSampler3D(e);case 4:return getSampler4D(e);case 5:return getSampler5D(e);case 6:return getSampler6D(e);default:throw new Error(t.length+"-D input sampling is not yet supported")}}function getInputSamplingSnippet(e,t,n){var r=getSamplerFlat(e);return r+=getSamplerFromInInfo(e),(n||arraysEqual(e.shapeInfo.logicalShape,t.logicalShape))&&(r+=getSamplerAtOutputCoords(e,t,n)),r}function getPackedOutputSamplingSnippet(e,t){switch(e.length){case 0:return getOutputScalarCoords();case 2:return getOutputPacked2DCoords(e,t);default:throw new Error(e.length+"-D output packed sampling is not yet supported")}}function getOutputSamplingSnippet(e,t){switch(e.length){case 0:return getOutputScalarCoords();case 1:return getOutput1DCoords(e,t);case 2:return getOutput2DCoords(e,t);case 3:return getOutput3DCoords(e,t);case 4:return getOutput4DCoords(e,t);case 5:return getOutput5DCoords(e,t);case 6:return getOutput6DCoords(e,t);default:throw new Error(e.length+"-D output sampling is not yet supported")}}var SAMPLE_1D_SNIPPET="\nvec2 UVfrom1D(int texNumR, int texNumC, int index) {\n int texR = index / texNumC;\n int texC = index - texR * texNumC;\n return (vec2(texC, texR) + halfCR) / vec2(texNumC, texNumR);\n}\n",SAMPLE_2D_SNIPPET="\nvec2 UVfrom2D(int texNumR, int texNumC, int numC, int row, int col) {\n int index = row * numC + col;\n int texR = index / texNumC;\n int texC = index - texR * texNumC;\n return (vec2(texC, texR) + halfCR) / vec2(texNumC, texNumR);\n}\n",SAMPLE_3D_SNIPPET="\nvec2 UVfrom3D(int texNumR, int texNumC, int stride0,\n int stride1, int row, int col, int depth) {\n // Explicitly use integer operations as dot() only works on floats.\n int index = row * stride0 + col * stride1 + depth;\n int texR = index / texNumC;\n int texC = index - texR * texNumC;\n return (vec2(texC, texR) + halfCR) / vec2(texNumC, texNumR);\n}\n",SAMPLE_4D_SNIPPET="\nvec2 UVfrom4D(int texNumR, int texNumC, int stride0,\n int stride1, int stride2, int row, int col, int depth,\n int depth2) {\n // Explicitly use integer operations as dot() only works on floats.\n int index = row * stride0 + col * stride1 + depth * stride2 + depth2;\n int texR = index / texNumC;\n int texC = index - texR * texNumC;\n return (vec2(texC, texR) + halfCR) / vec2(texNumC, texNumR);\n}\n",SAMPLE_5D_SNIPPET="\nvec2 UVfrom5D(int texNumR, int texNumC, int stride0,\n int stride1, int stride2, int stride3, int row, int col, int depth,\n int depth2, int depth3) {\n // Explicitly use integer operations as dot() only works on floats.\n int index = row * stride0 + col * stride1 +\n depth * stride2 + depth2 * stride3 + depth3;\n int texR = index / texNumC;\n int texC = index - texR * texNumC;\n return (vec2(texC, texR) + halfCR) / vec2(texNumC, texNumR);\n}\n",SAMPLE_6D_SNIPPET="\nvec2 UVfrom6D(int texNumR, int texNumC, int stride0,\n int stride1, int stride2, int stride3, int stride4,\n int row, int col, int depth, int depth2, int depth3, int depth4) {\n // Explicitly use integer operations as dot() only works on floats.\n int index = row * stride0 + col * stride1 + depth * stride2 + depth2 *\n stride3 + depth3 * stride4 + depth4;\n int texR = index / texNumC;\n int texC = index - texR * texNumC;\n return (vec2(texC, texR) + halfCR) / vec2(texNumC, texNumR);\n}\n",FLOAT_TEXTURE_SAMPLE_SNIPPET="\n float sampleTexture(sampler2D textureSampler, vec2 uv) {\n return texture2D(textureSampler, uv).r;\n }\n",FLOAT_TEXTURE_SETOUTPUT_SNIPPET="\n void setOutput(float val) {\n gl_FragColor = vec4(val, 0, 0, 0);\n }\n",SHADER_PREFIX="\n precision highp float;\n precision highp int;\n varying vec2 resultUV;\n const vec2 halfCR = vec2(0.5, 0.5);\n\n struct ivec5\n {\n int x;\n int y;\n int z;\n int w;\n int u;\n };\n\n struct ivec6\n {\n int x;\n int y;\n int z;\n int w;\n int u;\n int v;\n };\n\n bool isNaN(float val) {\n return (val < 0.0 || 0.0 < val || val == 0.0) ? false : true;\n }\n\n bool hasNaN(vec4 values) {\n vec4 v1 = values * values;\n vec4 v2 = values * values;\n return any(notEqual(v1, v2));\n }\n\n float getNaN(vec4 values) {\n return dot(vec4(1), values);\n }\n\n int round(float value) {\n return int(floor(value + 0.5));\n }\n\n int imod(int x, int y) {\n return x - y * (x / y);\n }\n\n //Based on the work of Dave Hoskins\n //https://www.shadertoy.com/view/4djSRW\n #define HASHSCALE1 443.8975\n float random(float seed){\n vec2 p = resultUV * seed;\n vec3 p3 = fract(vec3(p.xyx) * HASHSCALE1);\n p3 += dot(p3, p3.yzx + 19.19);\n return fract((p3.x + p3.y) * p3.z);\n }\n\n "+SAMPLE_1D_SNIPPET+"\n "+SAMPLE_2D_SNIPPET+"\n "+SAMPLE_3D_SNIPPET+"\n "+SAMPLE_4D_SNIPPET+"\n "+SAMPLE_5D_SNIPPET+"\n "+SAMPLE_6D_SNIPPET+"\n";function getOutputScalarCoords(){return "\n int getOutputCoords() {\n return 0;\n }\n "}function getOutput1DCoords(e,t){return 1===t[0]?"\n int getOutputCoords() {\n return int(resultUV.x * "+t[1]+".0);\n }\n ":1===t[1]?"\n int getOutputCoords() {\n return int(resultUV.y * "+t[0]+".0);\n }\n ":"\n int getOutputCoords() {\n ivec2 resTexRC = ivec2(resultUV.yx *\n vec2("+t[0]+", "+t[1]+"));\n return resTexRC.x * "+t[1]+" + resTexRC.y;\n }\n "}function getOutput3DCoords(e,t){var n=e[1]*e[2],r=e[2];return "\n ivec3 getOutputCoords() {\n ivec2 resTexRC = ivec2(resultUV.yx *\n vec2("+t[0]+", "+t[1]+"));\n int index = resTexRC.x * "+t[1]+" + resTexRC.y;\n int r = index / "+n+";\n index -= r * "+n+";\n int c = index / "+r+";\n int d = index - c * "+r+";\n return ivec3(r, c, d);\n }\n "}function getOutput4DCoords(e,t){var n=e[3],r=e[2]*n,o=e[1]*r;return "\n ivec4 getOutputCoords() {\n ivec2 resTexRC = ivec2(resultUV.yx *\n vec2("+t[0]+", "+t[1]+"));\n int index = resTexRC.x * "+t[1]+" + resTexRC.y;\n\n int r = index / "+o+";\n index -= r * "+o+";\n\n int c = index / "+r+";\n index -= c * "+r+";\n\n int d = index / "+n+";\n int d2 = index - d * "+n+";\n\n return ivec4(r, c, d, d2);\n }\n "}function getOutput5DCoords(e,t){var n=e[4],r=e[3]*n,o=e[2]*r,a=e[1]*o;return "\n ivec5 getOutputCoords() {\n ivec2 resTexRC = ivec2(resultUV.yx * vec2("+t[0]+",\n "+t[1]+"));\n\n int index = resTexRC.x * "+t[1]+" + resTexRC.y;\n\n int r = index / "+a+";\n index -= r * "+a+";\n\n int c = index / "+o+";\n index -= c * "+o+";\n\n int d = index / "+r+";\n index -= d * "+r+";\n\n int d2 = index / "+n+";\n int d3 = index - d2 * "+n+";\n\n ivec5 outShape = ivec5(r, c, d, d2, d3);\n return outShape;\n }\n "}function getOutput6DCoords(e,t){var n=e[5],r=e[4]*n,o=e[3]*r,a=e[2]*o,i=e[1]*a;return "\n ivec6 getOutputCoords() {\n ivec2 resTexRC = ivec2(resultUV.yx *\n vec2("+t[0]+", "+t[1]+"));\n int index = resTexRC.x * "+t[1]+" + resTexRC.y;\n\n int r = index / "+i+";\n index -= r * "+i+";\n\n int c = index / "+a+";\n index -= c * "+a+";\n\n int d = index / "+o+";\n index -= d * "+o+";\n\n int d2 = index / "+r+";\n index -= d2 * "+r+";\n\n int d3 = index / "+n+";\n int d4 = index - d3 * "+n+";\n\n ivec6 result = ivec6(r, c, d, d2, d3, d4);\n return result;\n }\n "}function getOutputPacked2DCoords(e,t){return "\n ivec2 getOutputCoords() {\n return 2 * ivec2(resultUV.yx * vec2("+Math.ceil(t[0]/2)+", "+Math.ceil(t[1]/2)+"));\n }\n "}function getOutput2DCoords(e,t){return arraysEqual(e,t)?"\n ivec2 getOutputCoords() {\n return ivec2(resultUV.yx * vec2("+t[0]+", "+t[1]+"));\n }\n ":1===e[1]?"\n ivec2 getOutputCoords() {\n ivec2 resTexRC = ivec2(resultUV.yx *\n vec2("+t[0]+", "+t[1]+"));\n int index = resTexRC.x * "+t[1]+" + resTexRC.y;\n return ivec2(index, 0);\n }\n ":1===e[0]?"\n ivec2 getOutputCoords() {\n ivec2 resTexRC = ivec2(resultUV.yx *\n vec2("+t[0]+", "+t[1]+"));\n int index = resTexRC.x * "+t[1]+" + resTexRC.y;\n return ivec2(0, index);\n }\n ":"\n ivec2 getOutputCoords() {\n ivec2 resTexRC = ivec2(resultUV.yx *\n vec2("+t[0]+", "+t[1]+"));\n int index = resTexRC.x * "+t[1]+" + resTexRC.y;\n int r = index / "+e[1]+";\n int c = index - r * "+e[1]+";\n return ivec2(r, c);\n }\n "}function getSamplerScalar(e){var t=e.name,n="get"+t.charAt(0).toUpperCase()+t.slice(1);return e.shapeInfo.isUniform?"float "+n+"() {return "+t+";}":"\n float "+n+"() {\n return sampleTexture("+t+", halfCR);\n }\n "}function getSampler1D(e){var t=e.name,n="get"+t.charAt(0).toUpperCase()+t.slice(1);return "\n float "+n+"(int index) {\n return "+n+"Flat(index);\n }\n "}function getSampler2D(e){var t=e.shapeInfo.logicalShape,n=e.name,r="get"+n.charAt(0).toUpperCase()+n.slice(1),o=e.shapeInfo.texShape;if(null!=o&&arraysEqual(t,o)){var a=o[0];return "\n float "+r+"(int row, int col) {\n vec2 uv = (vec2(col, row) + halfCR) / vec2("+o[1]+".0, "+a+".0);\n return sampleTexture("+n+", uv);\n }\n "}var i=squeezeShape(t),s=i.newShape,u=i.keptDims,l=s;if(l.length=1?"coords = 0;":s.map(function(e){return "coords["+(e+u)+"] = 0;"}).join("\n"))+"\n return get"+n+"("+(a<2&&o>0?"coords":e.shapeInfo.logicalShape.map(function(e,t){return "coords["+(t+u)+"]"}).join(", "))+");\n }\n "}function getSamplerAtOutputCoords(e,t,n){var r=e.name,o=r.charAt(0).toUpperCase()+r.slice(1),a="get"+o+"AtOutCoords",i=getBroadcastDims(e.shapeInfo.logicalShape,t.logicalShape),s=e.shapeInfo.logicalShape.length,u=t.logicalShape.length,l=n&&(u>s||i.length>0),c=broadcastDimsAreOuter(i),p=e.shapeInfo.isUniform;if(l&&!c)return getBroadcastOutputCoordsSampler(e,t,o,a);var d=sizeFromShape(e.shapeInfo.logicalShape),h="";l&&c&&(h="\n int mainPart = index / "+d+";\n index -= mainPart * "+d+";\n ");var f=t.texShape;if(p)return 1===d?"float "+a+"() {return "+r+";}":"\n float "+a+"() {\n ivec2 resTexRC = ivec2(resultUV.yx *\n vec2("+f[0]+", "+f[1]+"));\n int index = resTexRC.x * "+f[1]+" + resTexRC.y;\n "+h+"\n return get"+o+"Flat(index);\n }\n ";var m=e.shapeInfo.texShape;return arraysEqual(m,f)?"\n float "+a+"() {\n return sampleTexture("+r+", resultUV);\n }\n ":"\n float "+a+"() {\n ivec2 resTexRC = ivec2(resultUV.yx *\n vec2("+f[0]+", "+f[1]+"));\n int index = resTexRC.x * "+f[1]+" + resTexRC.y;\n "+h+"\n int texR = index / "+m[1]+";\n int texC = index - texR * "+m[1]+";\n vec2 uv = (vec2(texC, texR) + halfCR) /\n vec2("+m[1]+".0, "+m[0]+".0);\n\n return sampleTexture("+r+", uv);\n }\n "}function getCoordsDataType(e){if(e<=1)return "int";if(2===e)return "ivec2";if(3===e)return "ivec3";if(4===e)return "ivec4";if(5===e)return "ivec5";if(6===e)return "ivec6";throw Error("GPU for rank "+e+" is not yet supported")}function squeezeInputInfo(e,t){var n=JSON.parse(JSON.stringify(e));return n.shapeInfo.logicalShape=t,n}function getSqueezedParams(e,t){return t.map(function(t){return e[t]}).join(", ")}var CumSumProgram=function(){return function(e,t,n){this.variableNames=["x"],this.outputShape=e;var r=e.length,o=e[e.length-1],a=n?"<":">";this.userCode="\n int getIndex(int i) {\n "+(n?"return "+o+" -i - 1;":"return i;")+"\n }\n\n void main() {\n "+getCoordsDataType(r)+" coords = getOutputCoords();\n int end = "+getFinalCoord(r,"coords")+";\n float val = 0.0;\n for (int i = "+o+" - 1; i >= 0; i -= 1) {\n int idx = getIndex(i);\n if (idx "+a+" end) {\n continue;\n }\n if (idx == end && "+t+") {\n continue;\n }\n "+getFinalCoord(r,"coords")+" = idx;\n val += getX("+getCoords(r,"coords")+");\n }\n setOutput(val);\n }\n ";}}();function getCoords(e,t){if(1===e)return ""+t;if(2===e)return t+".x, "+t+".y";if(3===e)return t+".x, "+t+".y, "+t+".z";if(4===e)return t+".x, "+t+".y, "+t+".z, "+t+".w";throw Error("Cumulative sum for rank "+e+" is not yet supported")}function getFinalCoord(e,t){if(1===e)return ""+t;if(2===e)return t+".y";if(3===e)return t+".z";if(4===e)return t+".w";throw Error("Cumulative sum for rank "+e+" is not yet supported")}var TextureUsage,PhysicalTextureType,DepthToSpaceProgram=function(){function e(e,t,n){this.variableNames=["x"],this.outputShape=[],this.outputShape=e,this.blockSize=t,this.dataFormat=n,this.userCode="\n void main() {\n ivec4 coords = getOutputCoords();\n int b = coords[0];\n int h = "+this.getHeightCoordString()+";\n int w = "+this.getWidthCoordString()+";\n int d = "+this.getDepthCoordString()+";\n\n int in_h = h / "+t+";\n int offset_h = imod(h, "+t+");\n int in_w = w / "+t+";\n int offset_w = imod(w, "+t+");\n int offset_d = (offset_h * "+t+" + offset_w) *\n "+this.getOutputDepthSize()+";\n int in_d = d + offset_d;\n\n float result = "+this.getInputSamplingString()+";\n setOutput(result);\n }\n ";}return e.prototype.getHeightCoordString=function(){return "NHWC"===this.dataFormat?"coords[1]":"coords[2]"},e.prototype.getWidthCoordString=function(){return "NHWC"===this.dataFormat?"coords[2]":"coords[3]"},e.prototype.getDepthCoordString=function(){return "NHWC"===this.dataFormat?"coords[3]":"coords[1]"},e.prototype.getOutputDepthSize=function(){return "NHWC"===this.dataFormat?this.outputShape[3]:this.outputShape[1]},e.prototype.getInputSamplingString=function(){return "NHWC"===this.dataFormat?"getX(b, in_h, in_w, in_d)":"getX(b, in_d, in_h, in_w)"},e}(),EncodeFloatProgram=function(){return function(e){this.variableNames=["A"],this.outputShape=e,this.userCode="\n const float FLOAT_MAX = 1.70141184e38;\n const float FLOAT_MIN = 1.17549435e-38;\n\n lowp vec4 encode_float(highp float v) {\n if (isNaN(v)) {\n return vec4(255, 255, 255, 255);\n }\n\n highp float av = abs(v);\n\n if(av < FLOAT_MIN) {\n return vec4(0.0, 0.0, 0.0, 0.0);\n } else if(v > FLOAT_MAX) {\n return vec4(0.0, 0.0, 128.0, 127.0) / 255.0;\n } else if(v < -FLOAT_MAX) {\n return vec4(0.0, 0.0, 128.0, 255.0) / 255.0;\n }\n\n highp vec4 c = vec4(0,0,0,0);\n\n highp float e = floor(log2(av));\n highp float m = exp2(fract(log2(av))) - 1.0;\n\n c[2] = floor(128.0 * m);\n m -= c[2] / 128.0;\n c[1] = floor(32768.0 * m);\n m -= c[1] / 32768.0;\n c[0] = floor(8388608.0 * m);\n\n highp float ebias = e + 127.0;\n c[3] = floor(ebias / 2.0);\n ebias -= c[3] * 2.0;\n c[2] += floor(ebias) * 128.0;\n\n c[3] += 128.0 * step(0.0, -v);\n\n return c / 255.0;\n }\n\n void main() {\n float x = getAAtOutCoords();\n gl_FragColor = encode_float(x);\n }\n ";}}(),FromPixelsProgram=function(){return function(e){this.variableNames=["A"];var t=e[0],n=e[1];this.outputShape=e,this.userCode="\n void main() {\n ivec3 coords = getOutputCoords();\n int texR = coords[0];\n int texC = coords[1];\n int depth = coords[2];\n vec2 uv = (vec2(texC, texR) + halfCR) / vec2("+n+".0, "+t+".0);\n\n vec4 values = texture2D(A, uv);\n float value;\n if (depth == 0) {\n value = values.r;\n } else if (depth == 1) {\n value = values.g;\n } else if (depth == 2) {\n value = values.b;\n } else if (depth == 3) {\n value = values.a;\n }\n\n setOutput(floor(value * 255.0 + 0.5));\n }\n ";}}(),GatherProgram=function(){return function(e,t,n){this.variableNames=["A","indices"];var r=e.slice();r[n]=t,this.outputShape=r,this.rank=r.length;var o=getCoordsDataType(this.rank),a=getSourceCoords(e,n);this.userCode="\n void main() {\n "+o+" resRC = getOutputCoords();\n setOutput(getA("+a+"));\n }\n ";}}();function getSourceCoords(e,t){var n=e.length;if(n>4)throw Error("Gather for rank "+n+" is not yet supported");if(1===n)return "int(getIndices(resRC))";for(var r=["resRC.x","resRC.y","resRC.z","resRC.w"],o=[],a=0;a= "+r);for(var o=0,a=0;a= "+r);for(var o=0,a=0;a= "+o);for(var a=getPackedMatrixTextureShapeWidthHeight(t,n),i=a[0],s=a[1],u=n%2==1,l=t%2==1,c=Math.floor(n/2),p=Math.floor(t/2),d=u?4:0,h=n,f=0,m=0;m= "+o);for(var a=n%2==1,i=t%2==1,s=Math.floor(n/2),u=Math.floor(t/2),l=getPackedMatrixTextureShapeWidthHeight(t,n),c=l[0],p=l[1],d=a?4:0,h=n+(a?1:0),f=0,m=0,g=n,v=0;vr||n>r){o="["+t+"x"+n+"]";throw new Error("Requested texture size "+o+" greater than WebGL maximum on this browser / GPU "+("["+r+"x"+r+"]")+".")}}function createFramebuffer(e){return throwIfNull(e,function(){return e.createFramebuffer()},"Unable to create WebGLFramebuffer.")}function bindVertexBufferToProgramAttribute(e,t,n,r,o,a,i){var s=e.getAttribLocation(t,n);return -1!==s&&(callAndCheck(e,function(){return e.bindBuffer(e.ARRAY_BUFFER,r)}),callAndCheck(e,function(){return e.vertexAttribPointer(s,o,e.FLOAT,!1,a,i)}),callAndCheck(e,function(){return e.enableVertexAttribArray(s)}),!0)}function bindTextureUnit(e,t,n){validateTextureUnit(e,n),callAndCheck(e,function(){return e.activeTexture(e.TEXTURE0+n)}),callAndCheck(e,function(){return e.bindTexture(e.TEXTURE_2D,t)});}function unbindTextureUnit(e,t){validateTextureUnit(e,t),callAndCheck(e,function(){return e.activeTexture(e.TEXTURE0+t)}),callAndCheck(e,function(){return e.bindTexture(e.TEXTURE_2D,null)});}function getProgramUniformLocationOrThrow(e,t,n){return throwIfNull(e,function(){return e.getUniformLocation(t,n)},'uniform "'+n+'" not present in program.')}function getProgramUniformLocation(e,t,n){return e.getUniformLocation(t,n)}function bindTextureToProgramUniformSampler(e,t,n,r,o){callAndCheck(e,function(){return bindTextureUnit(e,n,o)}),callAndCheck(e,function(){return e.uniform1i(r,o)});}function bindCanvasToFramebuffer(e){callAndCheck(e,function(){return e.bindFramebuffer(e.FRAMEBUFFER,null)}),callAndCheck(e,function(){return e.viewport(0,0,e.canvas.width,e.canvas.height)}),callAndCheck(e,function(){return e.scissor(0,0,e.canvas.width,e.canvas.height)});}function bindColorTextureToFramebuffer(e,t,n){callAndCheck(e,function(){return e.bindFramebuffer(e.FRAMEBUFFER,n)}),callAndCheck(e,function(){return e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,t,0)});}function unbindColorTextureFromFramebuffer(e,t){callAndCheck(e,function(){return e.bindFramebuffer(e.FRAMEBUFFER,t)}),callAndCheck(e,function(){return e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,null,0)});}function validateFramebuffer(e){var t=e.checkFramebufferStatus(e.FRAMEBUFFER);if(t!==e.FRAMEBUFFER_COMPLETE)throw new Error("Error binding framebuffer: "+getFramebufferErrorMessage(e,t))}function getFramebufferErrorMessage(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 throwIfNull(e,t,n){var r=callAndCheck(e,function(){return t()});if(null==r)throw new Error(n);return r}function validateTextureUnit(e,t){var n=e.MAX_COMBINED_TEXTURE_IMAGE_UNITS-1,r=t+e.TEXTURE0;if(rn)throw new Error("textureUnit must be in "+("[gl.TEXTURE0, gl.TEXTURE"+n+"]")+".")}function getTextureShapeFromLogicalShape(e,t){2!==t.length&&(t=squeezeShape(t).newShape);var n=queryMaxTextureSize(e),r=sizeFromShape(t);return t.length<=1&&r<=n?[r,1]:2===t.length&&t[0]<=n&&t[1]<=n?t:3===t.length&&t[0]<=n&&t[1]*t[2]<=n?[t[0],t[1]*t[2]]:4===t.length&&t[0]<=n&&t[1]*t[2]*t[3]<=n?[t[0],t[1]*t[2]*t[3]]:sizeToSquarishShape(r)}var webgl_util=Object.freeze({createWebGLRenderingContext:createWebGLRenderingContext,createWebGLRenderingContextFromCanvas:createWebGLRenderingContextFromCanvas,callAndCheck:callAndCheck,enableDebugWebGLErrorChecking:enableDebugWebGLErrorChecking,checkWebGLError:checkWebGLError,getWebGLErrorMessage:getWebGLErrorMessage,getExtensionOrThrow:getExtensionOrThrow,createVertexShader:createVertexShader,createFragmentShader:createFragmentShader,createProgram:createProgram,linkProgram:linkProgram,validateProgram:validateProgram,createStaticVertexBuffer:createStaticVertexBuffer,createStaticIndexBuffer:createStaticIndexBuffer,queryMaxTextureSize:queryMaxTextureSize,getNumChannels:getNumChannels,createTexture:createTexture,validateTextureSize:validateTextureSize,createFramebuffer:createFramebuffer,bindVertexBufferToProgramAttribute:bindVertexBufferToProgramAttribute,bindTextureUnit:bindTextureUnit,unbindTextureUnit:unbindTextureUnit,getProgramUniformLocationOrThrow:getProgramUniformLocationOrThrow,getProgramUniformLocation:getProgramUniformLocation,bindTextureToProgramUniformSampler:bindTextureToProgramUniformSampler,bindCanvasToFramebuffer:bindCanvasToFramebuffer,bindColorTextureToFramebuffer:bindColorTextureToFramebuffer,unbindColorTextureFromFramebuffer:unbindColorTextureFromFramebuffer,validateFramebuffer:validateFramebuffer,getFramebufferErrorMessage:getFramebufferErrorMessage,getTextureShapeFromLogicalShape:getTextureShapeFromLogicalShape});function getWebGLContextAttributes(){return {alpha:!1,antialias:!1,premultipliedAlpha:!1,preserveDrawingBuffer:!1,depth:!1,stencil:!1,failIfMajorPerformanceCaveat:!0}}function createWebGLContext(e){var t,n=getWebGLContextAttributes();return callAndCheck(t=null!=e?createWebGLRenderingContextFromCanvas(e,n):createWebGLRenderingContext(n),function(){return t.disable(t.DEPTH_TEST)}),callAndCheck(t,function(){return t.disable(t.STENCIL_TEST)}),callAndCheck(t,function(){return t.disable(t.BLEND)}),callAndCheck(t,function(){return t.disable(t.DITHER)}),callAndCheck(t,function(){return t.disable(t.POLYGON_OFFSET_FILL)}),callAndCheck(t,function(){return t.disable(t.SAMPLE_COVERAGE)}),callAndCheck(t,function(){return t.enable(t.SCISSOR_TEST)}),callAndCheck(t,function(){return t.enable(t.CULL_FACE)}),callAndCheck(t,function(){return t.cullFace(t.BACK)}),t}function createVertexShader$1(e){return createVertexShader(e,"\n precision highp float;\n attribute vec3 clipSpacePos;\n attribute vec2 uv;\n varying vec2 resultUV;\n\n void main() {\n gl_Position = vec4(clipSpacePos, 1);\n resultUV = uv;\n }")}function createVertexBuffer(e){return createStaticVertexBuffer(e,new Float32Array([-1,1,0,0,1,-1,-1,0,0,0,1,1,0,1,1,1,-1,0,1,0]))}function createIndexBuffer(e){return createStaticIndexBuffer(e,new Uint16Array([0,1,2,2,1,3]))}function getTextureConfig(e,t){var n,r,o,a,i,s,u,l=e;return 2===ENV.get("WEBGL_VERSION")?(n=l.R32F,r=l.R16F,o=l.RGBA32F,a=l.RED,i=4,s=1,u=l.HALF_FLOAT):(n=e.RGBA,r=e.RGBA,o=l.RGBA,a=e.RGBA,i=4,s=4,u=null!=t?t.HALF_FLOAT_OES:null),{internalFormatFloat:n,internalFormatHalfFloat:r,internalFormatPackedFloat:o,textureFormatFloat:a,downloadTextureFormat:e.RGBA,downloadUnpackNumChannels:i,defaultNumChannels:s,textureTypeHalfFloat:u}}function createAndConfigureTexture(e,t,n,r,o,a){validateTextureSize(e,t,n);var i=createTexture(e),s=e.TEXTURE_2D;return callAndCheck(e,function(){return e.bindTexture(s,i)}),callAndCheck(e,function(){return e.texParameteri(s,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE)}),callAndCheck(e,function(){return e.texParameteri(s,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE)}),callAndCheck(e,function(){return e.texParameteri(s,e.TEXTURE_MIN_FILTER,e.NEAREST)}),callAndCheck(e,function(){return e.texParameteri(s,e.TEXTURE_MAG_FILTER,e.NEAREST)}),callAndCheck(e,function(){return e.texImage2D(s,0,r,t,n,0,o,a,null)}),callAndCheck(e,function(){return e.bindTexture(e.TEXTURE_2D,null)}),i}function createFloat32MatrixTexture(e,t,n,r){var o=getUnpackedMatrixTextureShapeWidthHeight(t,n);return createAndConfigureTexture(e,o[0],o[1],r.internalFormatFloat,r.textureFormatFloat,e.FLOAT)}function createFloat16MatrixTexture(e,t,n,r){var o=getUnpackedMatrixTextureShapeWidthHeight(t,n);return createAndConfigureTexture(e,o[0],o[1],r.internalFormatFloat,r.textureFormatFloat,r.textureTypeHalfFloat)}function createUnsignedBytesMatrixTexture(e,t,n,r){var o=getUnpackedMatrixTextureShapeWidthHeight(t,n);return createAndConfigureTexture(e,o[0],o[1],e.RGBA,e.RGBA,e.UNSIGNED_BYTE)}function createPackedMatrixTexture(e,t,n,r){var o=getPackedMatrixTextureShapeWidthHeight(t,n);return createAndConfigureTexture(e,o[0],o[1],r.internalFormatPackedFloat,e.RGBA,e.FLOAT)}function bindVertexProgramAttributeStreams(e,t,n){return callAndCheck(e,function(){return e.bindBuffer(e.ARRAY_BUFFER,n)}),bindVertexBufferToProgramAttribute(e,t,"clipSpacePos",n,3,20,0)&&bindVertexBufferToProgramAttribute(e,t,"uv",n,2,20,12)}function uploadPixelDataToTexture(e,t,n){callAndCheck(e,function(){return e.bindTexture(e.TEXTURE_2D,t)}),callAndCheck(e,function(){return e.texImage2D(e.TEXTURE_2D,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,n)}),callAndCheck(e,function(){return e.bindTexture(e.TEXTURE_2D,null)});}function uploadDataToTexture(e,t,n,r,o,a){validateTextureSize(e,n,r),callAndCheck(e,function(){return e.bindTexture(e.TEXTURE_2D,t)}),callAndCheck(e,function(){return e.texSubImage2D(e.TEXTURE_2D,0,0,0,n,r,a,e.FLOAT,o)}),callAndCheck(e,function(){return e.bindTexture(e.TEXTURE_2D,null)});}function uploadMatrixToTexture(e,t,n,r,o,a,i){var s,u=getUnpackedMatrixTextureShapeWidthHeight(n,r),l=u[0],c=u[1];1===i.defaultNumChannels?s=o:encodeMatrixToUnpackedArray(o,s=new Float32Array(getUnpackedArraySizeFromMatrixSize(o.length,a)),a),uploadDataToTexture(e,t,l,c,s,i.textureFormatFloat);}function uploadMatrixToPackedTexture(e,t,n,r,o,a){var i=getPackedMatrixTextureShapeWidthHeight(n,r),s=i[0],u=i[1],l=new Float32Array(getPackedRGBAArraySizeFromMatrixShape(n,r));encodeMatrixToPackedRGBA(o,n,r,l),uploadDataToTexture(e,t,s,u,l,e.RGBA);}function maybeCreateBufferFromOutputTexture(e,t,n,r,o){var a=t;if(2===ENV.get("WEBGL_VERSION")){var i=e,s=i.createBuffer();callAndCheck(e,function(){return e.bindBuffer(i.PIXEL_PACK_BUFFER,s)});var u=4*getUnpackedArraySizeFromMatrixSize(n*r,o.downloadUnpackNumChannels);callAndCheck(e,function(){return e.bufferData(i.PIXEL_PACK_BUFFER,u,e.STATIC_DRAW)}),callAndCheck(e,function(){return i.readPixels(0,0,r,n,e.RGBA,e.FLOAT,0)}),callAndCheck(e,function(){return e.bindBuffer(i.PIXEL_PACK_BUFFER,null)}),a=s;}return a}function downloadFloat32MatrixFromBuffer(e,t,n,r,o){var a=e,i=new Float32Array(getUnpackedArraySizeFromMatrixSize(n*r,o.downloadUnpackNumChannels));a.bindBuffer(e.ARRAY_BUFFER,t),a.getBufferSubData(e.ARRAY_BUFFER,0,i),a.bindBuffer(e.ARRAY_BUFFER,null);var s=new Float32Array(n*r);return decodeMatrixFromUnpackedArray(i,s,o.downloadUnpackNumChannels),s}function downloadFloat32MatrixFromOutputTexture(e,t,n,r){var o=getUnpackedMatrixTextureShapeWidthHeight(t,n),a=o[0],i=o[1],s=new Float32Array(getUnpackedArraySizeFromMatrixSize(t*n,r.downloadUnpackNumChannels));callAndCheck(e,function(){return e.readPixels(0,0,a,i,r.downloadTextureFormat,e.FLOAT,s)});var u=new Float32Array(t*n);return decodeMatrixFromUnpackedArray(s,u,r.downloadUnpackNumChannels),u}function downloadByteEncodedFloatMatrixFromOutputTexture(e,t,n,r){var o=getUnpackedMatrixTextureShapeWidthHeight(t,n),a=o[0],i=o[1],s=new Uint8Array(getUnpackedArraySizeFromMatrixSize(t*n,4));return callAndCheck(e,function(){return e.readPixels(0,0,a,i,r.downloadTextureFormat,e.UNSIGNED_BYTE,s)}),new Float32Array(s.buffer)}function downloadMatrixFromPackedOutputTexture(e,t,n,r){var o=getPackedMatrixTextureShapeWidthHeight(t,n),a=o[0],i=o[1],s=new Float32Array(getPackedRGBAArraySizeFromMatrixShape(t,n));callAndCheck(e,function(){return e.readPixels(0,0,a,i,e.RGBA,e.FLOAT,s)});var u=new Float32Array(t*n);return decodeMatrixFromPackedRGBA(s,t,n,u)}var gpgpu_util=Object.freeze({getWebGLContextAttributes:getWebGLContextAttributes,createWebGLContext:createWebGLContext,createVertexShader:createVertexShader$1,createVertexBuffer:createVertexBuffer,createIndexBuffer:createIndexBuffer,getTextureConfig:getTextureConfig,createFloat32MatrixTexture:createFloat32MatrixTexture,createFloat16MatrixTexture:createFloat16MatrixTexture,createUnsignedBytesMatrixTexture:createUnsignedBytesMatrixTexture,createPackedMatrixTexture:createPackedMatrixTexture,bindVertexProgramAttributeStreams:bindVertexProgramAttributeStreams,uploadPixelDataToTexture:uploadPixelDataToTexture,uploadMatrixToTexture:uploadMatrixToTexture,uploadMatrixToPackedTexture:uploadMatrixToPackedTexture,maybeCreateBufferFromOutputTexture:maybeCreateBufferFromOutputTexture,downloadFloat32MatrixFromBuffer:downloadFloat32MatrixFromBuffer,downloadFloat32MatrixFromOutputTexture:downloadFloat32MatrixFromOutputTexture,downloadByteEncodedFloatMatrixFromOutputTexture:downloadByteEncodedFloatMatrixFromOutputTexture,downloadMatrixFromPackedOutputTexture:downloadMatrixFromPackedOutputTexture}),GPGPUContext=function(){function e(e){this.outputTexture=null,this.program=null,this.disposed=!1,this.autoDebugValidate=!1,this.vertexAttrsAreBound=!1,this.itemsToPoll=[],this.gl=null!=e?e:createWebGLContext(),1===ENV.get("WEBGL_VERSION")?(this.textureFloatExtension=getExtensionOrThrow(this.gl,"OES_texture_float"),this.colorBufferFloatExtension=this.gl.getExtension("WEBGL_color_buffer_float"),ENV.get("WEBGL_RENDER_FLOAT32_ENABLED")||(this.textureHalfFloatExtension=getExtensionOrThrow(this.gl,"OES_texture_half_float"),this.colorBufferHalfFloatExtension=this.gl.getExtension("EXT_color_buffer_half_float"))):this.colorBufferFloatExtension=getExtensionOrThrow(this.gl,"EXT_color_buffer_float"),this.loseContextExtension=getExtensionOrThrow(this.gl,"WEBGL_lose_context"),this.vertexBuffer=createVertexBuffer(this.gl),this.indexBuffer=createIndexBuffer(this.gl),this.framebuffer=createFramebuffer(this.gl),this.textureConfig=getTextureConfig(this.gl,this.textureHalfFloatExtension);}return e.prototype.dispose=function(){var e=this;if(!this.disposed){null!=this.program&&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."),null!=this.outputTexture&&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.");var t=this.gl;callAndCheck(t,function(){return t.finish()}),callAndCheck(t,function(){return t.bindFramebuffer(t.FRAMEBUFFER,null)}),callAndCheck(t,function(){return t.deleteFramebuffer(e.framebuffer)}),callAndCheck(t,function(){return t.bindBuffer(t.ARRAY_BUFFER,null)}),callAndCheck(t,function(){return t.deleteBuffer(e.vertexBuffer)}),callAndCheck(t,function(){return t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,null)}),callAndCheck(t,function(){return t.deleteBuffer(e.indexBuffer)}),this.loseContextExtension.loseContext(),this.disposed=!0;}},e.prototype.enableAutomaticDebugValidation=function(e){this.autoDebugValidate=e,enableDebugWebGLErrorChecking(e);},e.prototype.createFloat32MatrixTexture=function(e,t){return this.throwIfDisposed(),createFloat32MatrixTexture(this.gl,e,t,this.textureConfig)},e.prototype.createFloat16MatrixTexture=function(e,t){return this.throwIfDisposed(),createFloat16MatrixTexture(this.gl,e,t,this.textureConfig)},e.prototype.createUnsignedBytesMatrixTexture=function(e,t){return this.throwIfDisposed(),createUnsignedBytesMatrixTexture(this.gl,e,t,this.textureConfig)},e.prototype.uploadPixelDataToTexture=function(e,t){this.throwIfDisposed(),uploadPixelDataToTexture(this.gl,e,t);},e.prototype.createPackedMatrixTexture=function(e,t){return this.throwIfDisposed(),createPackedMatrixTexture(this.gl,e,t,this.textureConfig)},e.prototype.deleteMatrixTexture=function(e){var t=this;this.throwIfDisposed(),this.outputTexture===e&&(unbindColorTextureFromFramebuffer(this.gl,this.framebuffer),this.outputTexture=null),callAndCheck(this.gl,function(){return t.gl.deleteTexture(e)});},e.prototype.uploadMatrixToTexture=function(e,t,n,r){this.throwIfDisposed();var o=getNumChannels();return uploadMatrixToTexture(this.gl,e,t,n,r,o,this.textureConfig)},e.prototype.uploadMatrixToPackedTexture=function(e,t,n,r){return this.throwIfDisposed(),uploadMatrixToPackedTexture(this.gl,e,t,n,r,this.textureConfig)},e.prototype.downloadFloat32MatrixFromOutputTexture=function(e,t,n){var r=this;return this.downloadMatrixDriver(e,function(){return downloadFloat32MatrixFromOutputTexture(r.gl,t,n,r.textureConfig)})},e.prototype.downloadByteEncodedFloatMatrixFromOutputTexture=function(e,t,n){var r=this;return this.downloadMatrixDriver(e,function(){return downloadByteEncodedFloatMatrixFromOutputTexture(r.gl,t,n,r.textureConfig)})},e.prototype.downloadFloat32MatrixFromBuffer=function(e,t,n){return downloadFloat32MatrixFromBuffer(this.gl,e,t,n,this.textureConfig)},e.prototype.maybeCreateBufferFromTexture=function(e,t,n){this.bindTextureToFrameBuffer(e);var r=maybeCreateBufferFromOutputTexture(this.gl,e,t,n,this.textureConfig);return this.unbindTextureToFrameBuffer(),r},e.prototype.createAndWaitForFence=function(){var e=this.createFence(this.gl);return this.pollFence(e)},e.prototype.createFence=function(e){var t,n,r=this;if(ENV.get("WEBGL_FENCE_API_ENABLED")){var o=e,a=o.fenceSync(o.SYNC_GPU_COMMANDS_COMPLETE,0);e.flush(),n=function(){var e=o.clientWaitSync(a,0,0);return e===o.ALREADY_SIGNALED||e===o.CONDITION_SATISFIED},t=a;}else ENV.get("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_VERSION")>0?(t=this.beginQuery(),this.endQuery(),n=function(){return r.isQueryAvailable(t,ENV.get("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_VERSION"))}):n=function(){return !0};return {query:t,isFencePassed:n}},e.prototype.downloadMatrixFromPackedTexture=function(e,t,n){var r=this;return this.downloadMatrixDriver(e,function(){return downloadMatrixFromPackedOutputTexture(r.gl,t,n,r.textureConfig)})},e.prototype.createProgram=function(e){this.throwIfDisposed();var t=this.gl,n=createFragmentShader(t,e),r=createVertexShader$1(t),o=createProgram(t);return callAndCheck(t,function(){return t.attachShader(o,r)}),callAndCheck(t,function(){return t.attachShader(o,n)}),linkProgram(t,o),this.autoDebugValidate&&validateProgram(t,o),this.vertexAttrsAreBound||(this.setProgram(o),this.vertexAttrsAreBound=bindVertexProgramAttributeStreams(t,this.program,this.vertexBuffer)),o},e.prototype.deleteProgram=function(e){var t=this;this.throwIfDisposed(),e===this.program&&(this.program=null),null!=e&&callAndCheck(this.gl,function(){return t.gl.deleteProgram(e)});},e.prototype.setProgram=function(e){var t=this;this.throwIfDisposed(),this.program=e,null!=this.program&&this.autoDebugValidate&&validateProgram(this.gl,this.program),callAndCheck(this.gl,function(){return t.gl.useProgram(e)});},e.prototype.getUniformLocation=function(e,t,n){return void 0===n&&(n=!0),this.throwIfDisposed(),n?getProgramUniformLocationOrThrow(this.gl,e,t):getProgramUniformLocation(this.gl,e,t)},e.prototype.getAttributeLocation=function(e,t){var n=this;return this.throwIfDisposed(),callAndCheck(this.gl,function(){return n.gl.getAttribLocation(e,t)})},e.prototype.getUniformLocationNoThrow=function(e,t){return this.throwIfDisposed(),this.gl.getUniformLocation(e,t)},e.prototype.setInputMatrixTexture=function(e,t,n){this.throwIfDisposed(),this.throwIfNoProgram(),bindTextureToProgramUniformSampler(this.gl,this.program,e,t,n);},e.prototype.setOutputMatrixTexture=function(e,t,n){this.setOutputMatrixTextureDriver(e,n,t);},e.prototype.setOutputPackedMatrixTexture=function(e,t,n){this.throwIfDisposed();var r=getPackedMatrixTextureShapeWidthHeight(t,n),o=r[0],a=r[1];this.setOutputMatrixTextureDriver(e,o,a);},e.prototype.setOutputMatrixWriteRegion=function(e,t,n,r){this.setOutputMatrixWriteRegionDriver(n,e,r,t);},e.prototype.setOutputPackedMatrixWriteRegion=function(e,t,n,r){throw new Error("setOutputPackedMatrixWriteRegion not implemented.")},e.prototype.debugValidate=function(){null!=this.program&&validateProgram(this.gl,this.program),validateFramebuffer(this.gl);},e.prototype.executeProgram=function(){this.throwIfDisposed(),this.throwIfNoProgram();var e=this.gl;this.autoDebugValidate&&this.debugValidate(),callAndCheck(e,function(){return e.drawElements(e.TRIANGLES,6,e.UNSIGNED_SHORT,0)});},e.prototype.blockUntilAllProgramsCompleted=function(){var e=this;this.throwIfDisposed(),callAndCheck(this.gl,function(){return e.gl.finish()});},e.prototype.getQueryTimerExtension=function(){return null==this.disjointQueryTimerExtension&&(this.disjointQueryTimerExtension=getExtensionOrThrow(this.gl,2===ENV.get("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_VERSION")?"EXT_disjoint_timer_query_webgl2":"EXT_disjoint_timer_query")),this.disjointQueryTimerExtension},e.prototype.getQueryTimerExtensionWebGL2=function(){return this.getQueryTimerExtension()},e.prototype.getQueryTimerExtensionWebGL1=function(){return this.getQueryTimerExtension()},e.prototype.beginQuery=function(){if(2===ENV.get("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_VERSION")){var e=this.gl,t=this.getQueryTimerExtensionWebGL2(),n=e.createQuery();return e.beginQuery(t.TIME_ELAPSED_EXT,n),n}var r=this.getQueryTimerExtensionWebGL1(),o=r.createQueryEXT();return r.beginQueryEXT(r.TIME_ELAPSED_EXT,o),o},e.prototype.endQuery=function(){if(2!==ENV.get("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_VERSION")){var e=this.getQueryTimerExtensionWebGL1();e.endQueryEXT(e.TIME_ELAPSED_EXT);}else{var t=this.gl,n=this.getQueryTimerExtensionWebGL2();t.endQuery(n.TIME_ELAPSED_EXT);}},e.prototype.waitForQueryAndGetTime=function(e){return __awaiter(this,void 0,void 0,function(){var t=this;return __generator(this,function(n){switch(n.label){case 0:return [4,repeatedTry(function(){return t.isQueryAvailable(e,ENV.get("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_VERSION"))})];case 1:return n.sent(),[2,this.getQueryTime(e,ENV.get("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_VERSION"))]}})})},e.prototype.getQueryTime=function(e,t){if(0===t)return null;if(2===t){var n=this.gl;return n.getQueryParameter(e,n.QUERY_RESULT)/1e6}var r=this.getQueryTimerExtensionWebGL1();return r.getQueryObjectEXT(e,r.QUERY_RESULT_EXT)/1e6},e.prototype.isQueryAvailable=function(e,t){if(0===t)return !0;if(2===t){var n=this.gl,r=this.getQueryTimerExtensionWebGL2(),o=n.getQueryParameter(e,n.QUERY_RESULT_AVAILABLE);return null==this.disjoint&&(this.disjoint=this.gl.getParameter(r.GPU_DISJOINT_EXT)),o&&!this.disjoint}o=(r=this.getQueryTimerExtensionWebGL1()).getQueryObjectEXT(e,r.QUERY_RESULT_AVAILABLE_EXT);return null==this.disjoint&&(this.disjoint=this.gl.getParameter(r.GPU_DISJOINT_EXT)),o&&!this.disjoint},e.prototype.pollFence=function(e){var t=this;return new Promise(function(n){t.addItemToPoll(function(){return e.isFencePassed()},function(){return n()});})},e.prototype.pollItems=function(){for(var e=binSearchLastTrue(this.itemsToPoll.map(function(e){return e.isDoneFn})),t=0;t<=e;++t){(0, this.itemsToPoll[t].resolveFn)();}this.itemsToPoll=this.itemsToPoll.slice(e+1);},e.prototype.addItemToPoll=function(e,t){var n=this;this.itemsToPoll.push({isDoneFn:e,resolveFn:t}),this.itemsToPoll.length>1||repeatedTry(function(){return n.pollItems(),0===n.itemsToPoll.length});},e.prototype.bindTextureToFrameBuffer=function(e){this.throwIfDisposed(),bindColorTextureToFramebuffer(this.gl,e,this.framebuffer),this.autoDebugValidate&&validateFramebuffer(this.gl);},e.prototype.unbindTextureToFrameBuffer=function(){null!=this.outputTexture?(bindColorTextureToFramebuffer(this.gl,this.outputTexture,this.framebuffer),this.autoDebugValidate&&validateFramebuffer(this.gl)):unbindColorTextureFromFramebuffer(this.gl,this.framebuffer);},e.prototype.downloadMatrixDriver=function(e,t){this.bindTextureToFrameBuffer(e);var n=t();return this.unbindTextureToFrameBuffer(),n},e.prototype.setOutputMatrixTextureDriver=function(e,t,n){this.throwIfDisposed();var r=this.gl;bindColorTextureToFramebuffer(r,e,this.framebuffer),this.autoDebugValidate&&validateFramebuffer(r),this.outputTexture=e,callAndCheck(r,function(){return r.viewport(0,0,t,n)}),callAndCheck(r,function(){return r.scissor(0,0,t,n)});},e.prototype.setOutputMatrixWriteRegionDriver=function(e,t,n,r){var o=this;this.throwIfDisposed(),callAndCheck(this.gl,function(){return o.gl.scissor(e,t,n,r)});},e.prototype.throwIfDisposed=function(){if(this.disposed)throw new Error("Attempted to use disposed GPGPUContext.")},e.prototype.throwIfNoProgram=function(){if(null==this.program)throw new Error("No GPU program is currently set.")},e}();function binSearchLastTrue(e){for(var t=0,n=e.length-1,r=-1;t<=n;){var o=t+n>>1;e[o]()?(r=o,t=o+1):n=o-1;}return r}function compileProgram(e,t,n,r){for(var o=t.userCode,a=n.map(function(e,n){var r={logicalShape:e.shape,texShape:e.isUniform?null:e.texData.texShape,isUniform:e.isUniform,isPacked:!e.isUniform&&e.texData.usage===TextureUsage.PACK};return {name:t.variableNames[n],shapeInfo:r}}),i=a.map(function(e){return e.shapeInfo}),s={logicalShape:r.shape,texShape:r.texData.texShape,isUniform:!1,isPacked:r.texData.usage===TextureUsage.PACK},u=makeShader(a,s,o,!0===t.supportsBroadcasting),l=e.createProgram(u),c={},p=0;p= 0 && idx <= "+s+") {\n float z = getX(b, r, c, idx);\n sum += z * z;\n }\n }\n float val = x * "+a+";\n setOutput(val);\n }\n ";}}(),LRNGradProgram=function(){return function(e,t,n,r,o){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=o,this.userCode="\n void main() {\n ivec4 coords = getOutputCoords();\n int b = coords[0];\n int r = coords[1];\n int c = coords[2];\n\n float result = 0.0;\n for (int d = 0; d < "+this.depth+"; ++d) {\n int depthBegin = int(max(0.0, float(d - "+t+")));\n int depthEnd = int(min(float("+this.depth+"),\n float(d + "+t+" + 1)));\n\n const int MIN_DEPTH_BEGIN = 0;\n const int MAX_DEPTH_END = "+this.depth+";\n\n float norm = 0.0;\n for (int k = MIN_DEPTH_BEGIN; k < MAX_DEPTH_END; ++k) {\n if (k < depthBegin){\n continue;\n }\n else if (k >= depthBegin && k < depthEnd) {\n norm += getInputImage(b, r, c, k) * getInputImage(b, r, c, k);\n }\n else {\n break;\n }\n }\n\n norm = float("+r+") * norm + float("+n+");\n\n for(int k = MIN_DEPTH_BEGIN; k < MAX_DEPTH_END; ++k){\n if (k < depthBegin){\n continue;\n }\n else if (k >= depthBegin && k < depthEnd){\n float dyi = -2.0 * float("+r+")\n * float("+o+")\n * getInputImage(b ,r ,c, k) * getOutputImage(b, r, c, d)\n / norm;\n if (k == d) {\n dyi += pow(norm, -1.0 * "+o+");\n }\n if (k == coords[3]) {\n dyi *= getDy(b, r, c, d);\n result += dyi;\n }\n }\n else {\n break;\n }\n }\n }\n setOutput(result);\n }\n ";}}(),MaxPool2DBackpropProgram=function(){return function(e){this.variableNames=["dy","maxPos"],this.outputShape=e.inShape;var t=e.filterHeight,n=e.filterWidth,r=e.strideHeight,o=e.strideWidth,a=t-1-e.padInfo.top,i=n-1-e.padInfo.left,s=t*n-1;this.userCode="\n const ivec2 pads = ivec2("+a+", "+i+");\n\n void main() {\n ivec4 coords = getOutputCoords();\n int b = coords[0];\n int d = coords[3];\n\n ivec2 dyRCCorner = coords.yz - pads;\n int dyRCorner = dyRCCorner.x;\n int dyCCorner = dyRCCorner.y;\n\n // Convolve dy(?, ?, d) with pos mask(:, :, d) to get dx(xR, xC, d).\n // ? = to be determined. : = across all values in that axis.\n float dotProd = 0.0;\n for (int wR = 0; wR < "+t+"; wR++) {\n float dyR = float(dyRCorner + wR) / "+r+".0;\n\n if (dyR < 0.0 || dyR >= "+e.outHeight+".0 || fract(dyR) > 0.0) {\n continue;\n }\n int idyR = int(dyR);\n\n for (int wC = 0; wC < "+n+"; wC++) {\n float dyC = float(dyCCorner + wC) / "+o+".0;\n\n if (dyC < 0.0 || dyC >= "+e.outWidth+".0 ||\n fract(dyC) > 0.0) {\n continue;\n }\n int idyC = int(dyC);\n\n float dyValue = getDy(b, idyR, idyC, d);\n int maxPosValue = "+s+" - int(getMaxPos(b, idyR, idyC, d));\n\n // Get the current value, check it against the value from the\n // position matrix.\n int curPosValue = wR * "+n+" + wC;\n float mask = float(maxPosValue == curPosValue ? 1.0 : 0.0);\n\n dotProd += dyValue * mask;\n }\n }\n setOutput(dotProd);\n }\n ";}}(),MatMulProgram=function(){return function(e,t,n,r){void 0===n&&(n=!1),void 0===r&&(r=!1),this.variableNames=["matrixA","matrixB"];var o=e[0],a=n?e[2]:e[1],i=r?t[1]:t[2],s=n?e[1]:e[2];this.outputShape=[o,a,i];var u=function(e,t){return n?"batch, "+t+" + "+e+", aRow":"batch, aRow, "+t+" + "+e},l=function(e,t){return r?"batch, bCol, "+t+" + "+e:"batch, "+t+" + "+e+", bCol"},c=4*Math.floor(s/4),p=s%4;this.userCode=" float dotARowBCol(int batch, int aRow, int bCol) {\n float result = 0.0;\n for (int i = 0; i < "+c+"; i += 4) {\n vec4 a = vec4(\n getMatrixA("+u(0,"i")+"),\n getMatrixA("+u(1,"i")+"),\n getMatrixA("+u(2,"i")+"),\n getMatrixA("+u(3,"i")+")\n );\n vec4 b = vec4(\n getMatrixB("+l(0,"i")+"),\n getMatrixB("+l(1,"i")+"),\n getMatrixB("+l(2,"i")+"),\n getMatrixB("+l(3,"i")+")\n );\n\n result += dot(a, b);\n }\n\n if ("+(1===p)+") {\n result += getMatrixA("+u(0,c)+") *\n getMatrixB("+l(0,c)+");\n } else if ("+(2===p)+") {\n vec2 a = vec2(\n getMatrixA("+u(0,c)+"),\n getMatrixA("+u(1,c)+")\n );\n vec2 b = vec2(\n getMatrixB("+l(0,c)+"),\n getMatrixB("+l(1,c)+")\n );\n result += dot(a, b);\n } else if ("+(3===p)+") {\n vec3 a = vec3(\n getMatrixA("+u(0,c)+"),\n getMatrixA("+u(1,c)+"),\n getMatrixA("+u(2,c)+")\n );\n vec3 b = vec3(\n getMatrixB("+l(0,c)+"),\n getMatrixB("+l(1,c)+"),\n getMatrixB("+l(2,c)+")\n );\n result += dot(a, b);\n }\n\n return result;\n }\n\n void main() {\n ivec3 resBRC = getOutputCoords();\n setOutput(dotARowBCol(resBRC.x, resBRC.y, resBRC.z));\n }\n ";}}(),MatMulPackedProgram=function(){return function(e,t,n,r,o){void 0===r&&(r=!1),void 0===o&&(o=!1),this.variableNames=["matrixA","matrixB"],this.outputShape=n;var a=r?e[0]:e[1],i=Math.ceil(a/2),s=r?"resultUV.t, center":"center, resultUV.t",u=o?"center, resultUV.s":"resultUV.s, center",l=r?["a.xxyy","a.zzww"]:["a.xxzz","a.yyww"],c=o?["b.xzxz","b.ywyw"]:["b.xyxy","b.zwzw"];this.userCode="\n const float sharedDimension = "+i+".0;\n\n vec4 dot2x2ARowBCol() {\n vec4 result = vec4(0);\n for (int ii = 0; ii < "+i+"; ii++) {\n float i = float(ii);\n float center = (i + 0.5) / sharedDimension;\n vec4 a = texture2D(matrixA, vec2("+s+"));\n vec4 b = texture2D(matrixB, vec2("+u+"));\n\n result += ("+l[0]+" * "+c[0]+") + ("+l[1]+" * "+c[1]+");\n }\n return result;\n }\n\n void main() {\n gl_FragColor = dot2x2ARowBCol();\n }\n ";}}(),MultinomialProgram=function(){function e(e,t,n){this.variableNames=["probs"],this.outputShape=[e,n],this.userCode="\n uniform float seed;\n\n void main() {\n ivec2 coords = getOutputCoords();\n int batch = coords[0];\n\n float r = random(seed);\n float cdf = 0.0;\n\n for (int i = 0; i < "+(t-1)+"; i++) {\n cdf += getProbs(batch, i);\n\n if (r < cdf) {\n setOutput(float(i));\n return;\n }\n }\n\n // If no other event happened, last event happened.\n setOutput(float("+(t-1)+"));\n }\n ";}return e.prototype.getCustomSetupFunc=function(e){var t=this;return function(n,r){null==t.seedLoc&&(t.seedLoc=n.getUniformLocation(r,"seed")),n.gl.uniform1f(t.seedLoc,e);}},e}(),OneHotProgram=function(){return function(e,t,n,r){this.variableNames=["indices"],this.outputShape=[e,t],this.userCode="\n void main() {\n ivec2 coords = getOutputCoords();\n int index = round(getIndices(coords.x));\n setOutput(mix(float("+r+"), float("+n+"),\n float(index == coords.y)));\n }\n ";}}(),PackProgram=function(){return function(e){this.variableNames=["A"],this.outputShape=e,this.userCode="\n void main() {\n ivec2 rc = getOutputCoords();\n\n int r = rc.x;\n int c = rc.y;\n int rp1 = r + 1;\n int cp1 = c + 1;\n\n bool cEdge = cp1 >= "+e[1]+";\n bool rEdge = rp1 >= "+e[0]+";\n\n gl_FragColor = vec4(\n getA(r, c),\n cEdge ? 0. : getA(r, cp1),\n rEdge ? 0. : getA(rp1, c),\n rEdge || cEdge ? 0. : getA(rp1, cp1)\n );\n }\n ";}}(),PadProgram=function(){return function(e,t,n){this.variableNames=["x"],this.outputShape=t.map(function(t,n){return t[0]+e[n]+t[1]});var r=e.length,o=getCoordsDataType(r),a=t.map(function(e){return e[0]}).join(","),i=t.map(function(t,n){return t[0]+e[n]}).join(","),s=["coords[0]","coords[1]","coords[2]","coords[3]"].slice(0,r);this.userCode=1!==r?"\n "+o+" start = "+o+"("+a+");\n "+o+" end = "+o+"("+i+");\n\n void main() {\n "+o+" outC = getOutputCoords();\n if (any(lessThan(outC, start)) || any(greaterThanEqual(outC, end))) {\n setOutput(float("+n+"));\n } else {\n "+o+" coords = outC - start;\n setOutput(getX("+s+"));\n }\n }\n ":"\n int start = "+a+";\n int end = "+i+";\n\n void main() {\n int outC = getOutputCoords();\n if (outC < start || outC >= end) {\n setOutput(float("+n+"));\n } else {\n setOutput(getX(outC - start));\n }\n }\n ";}}(),Pool2DProgram=function(){return function(e,t,n){if(this.variableNames=["x"],"avg"===t&&n)throw new Error("Cannot compute positions for average pool.");var r=e.filterHeight,o=e.filterWidth,a=e.strideHeight,i=e.strideWidth,s=e.padInfo.top,u=e.padInfo.left;this.outputShape=e.outShape;var l="avg"===t,c="0.0";if(l||(c="-1.0 / 0.0"),n)this.userCode="\n const ivec2 strides = ivec2("+a+", "+i+");\n const ivec2 pads = ivec2("+s+", "+u+");\n\n void main() {\n ivec4 coords = getOutputCoords();\n int batch = coords[0];\n int d = coords[3];\n\n ivec2 xRCCorner = coords.yz * strides - pads;\n int xRCorner = xRCCorner.x;\n int xCCorner = xRCCorner.y;\n\n // max/min x(?, ?, d) to get y(yR, yC, d).\n // ? = to be determined\n float minMaxValue = 0.0;\n float minMaxValueFound = 0.0;\n int minMaxPosition = 0;\n float avgValue = 0.0;\n\n for (int wR = 0; wR < "+r+"; wR++) {\n int xR = xRCorner + wR;\n\n if (xR < 0 || xR >= "+e.inHeight+") {\n continue;\n }\n\n for (int wC = 0; wC < "+o+"; wC++) {\n int xC = xCCorner + wC;\n\n if (xC < 0 || xC >= "+e.inWidth+") {\n continue;\n }\n\n float value = getX(batch, xR, xC, d);\n\n // If a min / max value has already been found, use it. If not,\n // use the current value.\n float currMinMaxValue = mix(\n value, minMaxValue, minMaxValueFound);\n if (value >= currMinMaxValue) {\n minMaxValue = value;\n minMaxValueFound = 1.0;\n minMaxPosition = wR * "+o+" + wC;\n }\n }\n }\n setOutput(float(minMaxPosition));\n }\n ";else{var p=t+"("+t+"("+t+"(minMaxValue[0], minMaxValue[1]), minMaxValue[2]), minMaxValue[3])";"avg"===t&&(p="avgValue / count");var d=4*Math.floor(o/4),h=o%4,f="\n if ("+l+") {\n avgValue += dot(values, ones);\n } else {\n minMaxValue = max(values, minMaxValue);\n }\n ";this.userCode="\n const ivec2 strides = ivec2("+a+", "+i+");\n const ivec2 pads = ivec2("+s+", "+u+");\n const float initializationValue = "+c+";\n const vec4 ones = vec4(1.0, 1.0, 1.0, 1.0);\n\n float count = 0.0;\n\n float getValue(int batch, int xR, int xC, int d) {\n if (xC < 0 || xC >= "+e.inWidth+") {\n return initializationValue;\n }\n count += 1.0;\n return getX(batch, xR, xC, d);\n }\n\n void main() {\n ivec4 coords = getOutputCoords();\n int batch = coords[0];\n int d = coords[3];\n\n ivec2 xRCCorner = coords.yz * strides - pads;\n int xRCorner = xRCCorner.x;\n int xCCorner = xRCCorner.y;\n\n // max/min x(?, ?, d) to get y(yR, yC, d).\n // ? = to be determined\n vec4 minMaxValue = vec4("+c+");\n float avgValue = 0.0;\n count = 0.0;\n\n for (int wR = 0; wR < "+r+"; wR++) {\n int xR = xRCorner + wR;\n\n if (xR < 0 || xR >= "+e.inHeight+") {\n continue;\n }\n\n for (int wC = 0; wC < "+d+"; wC += 4) {\n int xC = xCCorner + wC;\n\n vec4 values = vec4(\n getValue(batch, xR, xC, d),\n getValue(batch, xR, xC + 1, d),\n getValue(batch, xR, xC + 2, d),\n getValue(batch, xR, xC + 3, d)\n );\n\n "+f+"\n }\n\n int xC = xCCorner + "+d+";\n if ("+(1===h)+") {\n vec4 values = vec4(\n getValue(batch, xR, xC, d),\n initializationValue,\n initializationValue,\n initializationValue\n );\n\n "+f+"\n } else if ("+(2===h)+") {\n vec4 values = vec4(\n getValue(batch, xR, xC, d),\n getValue(batch, xR, xC + 1, d),\n initializationValue,\n initializationValue\n );\n\n "+f+"\n } else if ("+(3===h)+") {\n vec4 values = vec4(\n getValue(batch, xR, xC, d),\n getValue(batch, xR, xC + 1, d),\n getValue(batch, xR, xC + 2, d),\n initializationValue\n );\n\n "+f+"\n }\n }\n setOutput("+p+");\n }\n ";}}}(),ReduceProgram=function(){return function(e,t){this.variableNames=["x"];var n=e.windowSize,r=e.batchSize,o=e.inSize,a=Math.ceil(o/n);this.outputShape=[r,a];var i="0.0",s="";"min"===t?(i="1.0 / 0.0",s="min"):"max"===t&&(i="-1.0 / 0.0",s="max");var u=t+"("+t+"("+t+"(minMaxValue[0], minMaxValue[1]), minMaxValue[2]), minMaxValue[3])";"sum"===t?u="sumValue":"all"===t?u="allValue":"any"===t&&(u="anyValue");var l=4*Math.floor(n/4),c=n%4,p="\n if ("+("sum"===t)+") {\n sumValue += dot(values, ones);\n } else {\n minMaxValue = "+s+"(values, minMaxValue);\n }\n ",d="vec4";"all"===t?(i="1.0",p="\n bool reducedAllValue = all(values);\n float floatedReducedAllValue = float(reducedAllValue);\n allValue = float(allValue >= 1.0 && floatedReducedAllValue >= 1.0);\n ",d="bvec4"):"any"===t&&(i="0.0",p="\n bool reducedAnyValue = any(values);\n float floatedReducedAnyValue = float(reducedAnyValue);\n anyValue = float(anyValue >= 1.0 || floatedReducedAnyValue >= 1.0);\n ",d="bvec4");var h="";o%n>0&&(h="\n if (inIdx < 0 || inIdx >= "+o+") {\n return initializationValue;\n }\n "),this.userCode="\n const float initializationValue = "+i+";\n const vec4 ones = vec4(1.0, 1.0, 1.0, 1.0);\n\n float getValue(int batch, int inIdx) {\n "+h+"\n return getX(batch, inIdx);\n }\n\n void main() {\n ivec2 coords = getOutputCoords();\n int batch = coords[0];\n int outIdx = coords[1];\n int inOffset = outIdx * "+n+";\n\n vec4 minMaxValue = vec4("+i+");\n float sumValue = 0.0;\n float allValue = 1.0;\n float anyValue = 0.0;\n\n for (int i = 0; i < "+l+"; i += 4) {\n int inIdx = inOffset + i;\n "+d+" values = "+d+"(\n getValue(batch, inIdx),\n getValue(batch, inIdx + 1),\n getValue(batch, inIdx + 2),\n getValue(batch, inIdx + 3)\n );\n\n "+p+"\n }\n\n int inIdx = inOffset + "+l+";\n if ("+(1===c)+") {\n "+d+" values = "+d+"(\n getValue(batch, inIdx),\n initializationValue,\n initializationValue,\n initializationValue\n );\n\n "+p+"\n } else if ("+(2===c)+") {\n "+d+" values = "+d+"(\n getValue(batch, inIdx),\n getValue(batch, inIdx + 1),\n initializationValue,\n initializationValue\n );\n\n "+p+"\n } else if ("+(3===c)+") {\n "+d+" values = "+d+"(\n getValue(batch, inIdx),\n getValue(batch, inIdx + 1),\n getValue(batch, inIdx + 2),\n initializationValue\n );\n\n "+p+"\n }\n setOutput("+u+");\n }\n ";}}(),ResizeBilinearBackpropProgram=function(){return function(e,t,n){this.variableNames=["dy"],this.outputShape=[],this.outputShape=t.shape;var r=t.shape,o=r[1],a=r[2],i=e.shape,s=i[1],u=i[2],l=[n&&s>1?o-1:o,n&&u>1?a-1:a],c=[n&&s>1?s-1:s,n&&u>1?u-1:u],p=l[0]/c[0],d=l[1]/c[1],h=1/p,f=1/d,m=2*Math.ceil(h)+2,g=2*Math.ceil(f)+2;this.userCode="\n void main() {\n ivec4 coords = getOutputCoords();\n int b = coords[0];\n int d = coords[3];\n int r = coords[1];\n int c = coords[2];\n\n float accumulator = 0.0;\n\n const float heightScale = float("+p+");\n const float widthScale = float("+d+");\n\n const float invHeightScale = float("+h+");\n const float invWidthScale = float("+f+");\n\n const int winHeight = int("+m+");\n const int winWidth = int("+g+");\n\n // Compute bounds for where in dy we will look\n float startRLerp = floor(float(r) * invHeightScale);\n int startDyR = int(startRLerp - float(winHeight / 2));\n\n float startCLerp = floor(float(c) * invWidthScale);\n int startDyC = int(startCLerp - float(winWidth / 2));\n\n // Loop over dy\n for (int dyROffset = 0; dyROffset < winHeight; dyROffset++) {\n int dyR = dyROffset + startDyR;\n\n // Guard against the window exceeding the bounds of dy\n if (dyR < 0 || dyR >= "+s+") {\n continue;\n }\n\n for (int dyCOffset = 0; dyCOffset < winWidth; dyCOffset++) {\n int dyC = dyCOffset + startDyC;\n\n // Guard against the window exceeding the bounds of dy\n if (dyC < 0 || dyC >= "+u+") {\n continue;\n }\n\n float dxR = float(dyR) * heightScale;\n int topDxRIndex = int(floor(dxR));\n int bottomDxRIndex = int(min(ceil(dxR), "+(o-1)+".0));\n float dxRLerp = dxR - float(topDxRIndex);\n float inverseDxRLerp = 1.0 - dxRLerp;\n\n float dxC = float(dyC) * widthScale;\n int leftDxCIndex = int(floor(dxC));\n int rightDxCIndex = int(min(ceil(dxC), "+(a-1)+".0));\n float dxCLerp = dxC - float(leftDxCIndex);\n float inverseDxCLerp = 1.0 - dxCLerp;\n\n if (r == topDxRIndex && c == leftDxCIndex) {\n // topLeft\n accumulator +=\n getDy(b, dyR, dyC, d) * inverseDxRLerp * inverseDxCLerp;\n }\n\n if (r == topDxRIndex && c == rightDxCIndex) {\n // topRight\n accumulator += getDy(b, dyR, dyC, d) * inverseDxRLerp * dxCLerp;\n }\n\n if (r == bottomDxRIndex && c == leftDxCIndex) {\n // bottomLeft\n accumulator += getDy(b, dyR, dyC, d) * dxRLerp * inverseDxCLerp;\n }\n\n if (r == bottomDxRIndex && c == rightDxCIndex) {\n // bottomRight\n accumulator += getDy(b, dyR, dyC, d) * dxRLerp * dxCLerp;\n }\n }\n }\n // End loop over dy\n\n setOutput(accumulator);\n }\n ";}}(),ResizeBilinearProgram=function(){return function(e,t,n,r){this.variableNames=["A"],this.outputShape=[];var o=e[0],a=e[1],i=e[2],s=e[3];this.outputShape=[o,t,n,s];var u=[r&&t>1?a-1:a,r&&n>1?i-1:i],l=[r&&t>1?t-1:t,r&&n>1?n-1:n];this.userCode="\n const vec2 effectiveInputOverOutputRatioRC = vec2(\n "+u[0]/l[0]+",\n "+u[1]/l[1]+");\n const vec2 inputShapeRC = vec2("+a+".0, "+i+".0);\n\n void main() {\n ivec4 coords = getOutputCoords();\n int b = coords[0];\n int d = coords[3];\n ivec2 yRC = coords.yz;\n\n // Fractional source index.\n vec2 sourceFracIndexRC = vec2(yRC) * effectiveInputOverOutputRatioRC;\n\n // Compute the four integer indices.\n ivec2 sourceFloorRC = ivec2(sourceFracIndexRC);\n ivec2 sourceCeilRC = ivec2(\n min(inputShapeRC - 1.0, ceil(sourceFracIndexRC)));\n\n float topLeft = getA(b, sourceFloorRC.x, sourceFloorRC.y, d);\n float bottomLeft = getA(b, sourceCeilRC.x, sourceFloorRC.y, d);\n float topRight = getA(b, sourceFloorRC.x, sourceCeilRC.y, d);\n float bottomRight = getA(b, sourceCeilRC.x, sourceCeilRC.y, d);\n\n vec2 fracRC = sourceFracIndexRC - vec2(sourceFloorRC);\n\n float top = topLeft + (topRight - topLeft) * fracRC.y;\n float bottom = bottomLeft + (bottomRight - bottomLeft) * fracRC.y;\n float newValue = top + (bottom - top) * fracRC.x;\n\n setOutput(newValue);\n }\n ";}}(),ResizeNearestNeigborBackpropProgram=function(){return function(e,t,n){this.variableNames=["dy"],this.outputShape=[],this.outputShape=t.shape;var r=t.shape,o=r[1],a=r[2],i=e.shape,s=i[1],u=i[2],l=[n&&s>1?o-1:o,n&&u>1?a-1:a],c=[n&&s>1?s-1:s,n&&u>1?u-1:u],p=l[0]/c[0],d=l[1]/c[1],h=1/p,f=1/d,m=2*Math.ceil(h)+2,g=2*Math.ceil(f)+2;this.userCode="\n void main() {\n ivec4 coords = getOutputCoords();\n int b = coords[0];\n int d = coords[3];\n int r = coords[1];\n int c = coords[2];\n\n float accumulator = 0.0;\n\n const float heightScale = float("+p+");\n const float widthScale = float("+d+");\n\n const float invHeightScale = float("+h+");\n const float invWidthScale = float("+f+");\n\n const int winHeight = int("+m+");\n const int winWidth = int("+g+");\n\n // Compute bounds for where in dy we will look\n float startRLerp = floor(float(r) * invHeightScale);\n int startDyR = int(floor(startRLerp - float(winHeight / 2)));\n\n float startCLerp = floor(float(c) * invWidthScale);\n int startDyC = int(floor(startCLerp - float(winWidth / 2)));\n\n // Loop over dy\n for (int dyROffset = 0; dyROffset < winHeight; dyROffset++) {\n int dyR = dyROffset + startDyR;\n\n // Guard against the window exceeding the bounds of dy\n if (dyR < 0 || dyR >= "+s+") {\n continue;\n }\n\n for (int dyCOffset = 0; dyCOffset < winWidth; dyCOffset++) {\n int dyC = dyCOffset + startDyC;\n\n // Guard against the window exceeding the bounds of dy\n if (dyC < 0 || dyC >= "+u+") {\n continue;\n }\n\n float sourceFracRow =\n float("+l[0]+") *\n (float(dyR) / float("+c[0]+"));\n\n float sourceFracCol =\n float("+l[1]+") *\n (float(dyC) / float("+c[1]+"));\n\n int sourceNearestRow = int(min(\n float(int("+o+") - 1),\n "+n+" ? float(round(sourceFracRow)) :\n float(floor(sourceFracRow))));\n\n int sourceNearestCol = int(min(\n float(int("+a+") - 1),\n "+n+" ? float(round(sourceFracCol)) :\n float(floor(sourceFracCol))));\n\n if (r == sourceNearestRow && c == sourceNearestCol) {\n accumulator += getDy(b, dyR, dyC, d);\n }\n }\n }\n // End loop over dy\n\n setOutput(accumulator);\n }\n ";}}(),ResizeNearestNeighborProgram=function(){return function(e,t,n,r){this.variableNames=["A"],this.outputShape=[];var o=e[0],a=e[1],i=e[2],s=e[3];this.outputShape=[o,t,n,s];var u=[r&&t>1?a-1:a,r&&n>1?i-1:i],l=[r&&t>1?t-1:t,r&&n>1?n-1:n],c=r?"0.5":"0.0";this.userCode="\n const vec2 effectiveInputOverOutputRatioRC = vec2(\n "+u[0]/l[0]+",\n "+u[1]/l[1]+");\n const vec2 inputShapeRC = vec2("+a+".0, "+i+".0);\n\n void main() {\n ivec4 coords = getOutputCoords();\n int b = coords[0];\n int d = coords[3];\n ivec2 yRC = coords.yz;\n\n // Fractional source index.\n vec2 sourceFracIndexRC = vec2(yRC) * effectiveInputOverOutputRatioRC;\n\n // Compute the coordinators of nearest neighbor point.\n ivec2 sourceNearestRC = ivec2(\n min(inputShapeRC - 1.0, floor(sourceFracIndexRC + "+c+")));\n\n float newValue = getA(b, sourceNearestRC.x, sourceNearestRC.y, d);\n\n setOutput(newValue);\n }\n ";}}(),ReverseProgram=function(){return function(e,t){this.variableNames=["x"];var n=e.length;if(n>4)throw new Error("WebGL backend: Reverse of rank-"+n+" tensor is not yet supported");if(this.outputShape=e,1!==n){var r=e.map(function(n,r){return function(n){return -1!==t.indexOf(n)&&1!==e[n]?e[n]+" - coords["+n+"] - 1":"coords["+n+"]"}(r)}).join(","),o=getCoordsDataType(n);this.userCode="\n void main() {\n "+o+" coords = getOutputCoords();\n setOutput(getX("+r+"));\n }\n ";}else this.userCode="\n void main() {\n int coord = getOutputCoords();\n setOutput(getX("+e[0]+" - coord - 1));\n }\n ";}}(),SegmentOpProgram=function(){return function(e,t){this.variableNames=["x","segmentIds"];var n=e.windowSize,r=e.batchSize,o=e.inSize,a=e.numSegments,i=a*Math.ceil(o/n);this.outputShape=[r,i];var s=4*Math.floor(n/4),u=n%4,l="\n sumValue += dot(values, filter);\n ",c="";o%n>0&&(c="\n if (inIdx < 0 || inIdx >= "+o+") {\n return initializationValue;\n }\n ");var p="";o%n>0&&(p="\n if (inIdx < 0 || inIdx >= "+o+") {\n return -1.0;\n }\n "),this.userCode="\n const float initializationValue = 0.0;\n\n float getValue(int batch, int inIdx) {\n "+c+"\n return getX(batch, inIdx);\n }\n\n float getSegmentIdAtIndex(int inIdx) {\n "+p+"\n return getSegmentIds(inIdx);\n }\n\n void main() {\n ivec2 coords = getOutputCoords();\n int batch = coords[0];\n int outIdx = coords[1];\n int inOffset = int(floor(float(outIdx) / float(\n "+a+")) * float("+n+"));\n int currentSeg = int(mod(float(outIdx), float("+a+")));\n\n float sumValue = 0.0;\n\n for (int i = 0; i < "+s+"; i += 4) {\n int inIdx = inOffset + i;\n vec4 values = vec4(\n getValue(batch, inIdx),\n getValue(batch, inIdx + 1),\n getValue(batch, inIdx + 2),\n getValue(batch, inIdx + 3)\n );\n\n vec4 filter = vec4(\n int(getSegmentIdAtIndex(inIdx)) == currentSeg ? 1 : 0,\n int(getSegmentIdAtIndex(inIdx + 1)) == currentSeg ? 1 : 0,\n int(getSegmentIdAtIndex(inIdx + 2)) == currentSeg ? 1 : 0,\n int(getSegmentIdAtIndex(inIdx + 3)) == currentSeg ? 1 : 0\n );\n\n "+l+"\n }\n\n int inIdx = inOffset + "+s+";\n if ("+(1===u)+") {\n vec4 values = vec4(\n getValue(batch, inIdx),\n initializationValue,\n initializationValue,\n initializationValue\n );\n\n int inIdxSeg = int(getSegmentIdAtIndex(inIdx));\n\n vec4 filter = vec4(\n int(getSegmentIdAtIndex(inIdx)) == currentSeg ? 1 : 0,\n 0,\n 0,\n 0\n );\n\n "+l+"\n } else if ("+(2===u)+") {\n vec4 values = vec4(\n getValue(batch, inIdx),\n getValue(batch, inIdx + 1),\n initializationValue,\n initializationValue\n );\n\n vec4 filter = vec4(\n int(getSegmentIdAtIndex(inIdx)) == currentSeg ? 1 : 0,\n int(getSegmentIdAtIndex(inIdx + 1)) == currentSeg ? 1 : 0,\n 0,\n 0\n );\n\n "+l+"\n } else if ("+(3===u)+") {\n vec4 values = vec4(\n getValue(batch, inIdx),\n getValue(batch, inIdx + 1),\n getValue(batch, inIdx + 2),\n initializationValue\n );\n\n vec4 filter = vec4(\n int(getSegmentIdAtIndex(inIdx)) == currentSeg ? 1 : 0,\n int(getSegmentIdAtIndex(inIdx + 1)) == currentSeg ? 1 : 0,\n int(getSegmentIdAtIndex(inIdx + 2)) == currentSeg ? 1 : 0,\n 0\n );\n\n "+l+"\n }\n setOutput(sumValue);\n }\n ";}}(),SelectProgram=function(){return function(e,t,n){var r,o;if(this.variableNames=["c","a","b"],this.outputShape=t,n>4)throw Error("Where for rank "+n+" is not yet supported");if(1===n)o="resRC",r="resRC";else{for(var a=["resRC.x","resRC.y","resRC.z","resRC.w"],i=[],s=[],u=0;u= 1.0) {\n setOutput(getA("+o+"));\n } else {\n setOutput(getB("+o+"));\n }\n }\n ";}}(),SliceProgram=function(){function e(e){this.variableNames=["source"],this.outputShape=e,this.rank=e.length;var t=getCoordsDataType(this.rank),n=getCoords$1(this.rank);this.userCode="\n uniform "+t+" start;\n\n void main() {\n "+t+" sourceLoc = start + getOutputCoords();\n setOutput(getSource("+n+"));\n }\n ";}return e.prototype.getCustomSetupFunc=function(e){var t=this;if(e.length!==this.rank)throw Error("The rank ("+this.rank+") of the program must match the length of start ("+e.length+")");return function(n,r){if(null!=t.startLoc||(t.startLoc=n.getUniformLocationNoThrow(r,"start"),null!=t.startLoc))if(1===t.rank)n.gl.uniform1i(t.startLoc,e[0]);else if(2===t.rank)n.gl.uniform2i(t.startLoc,e[0],e[1]);else if(3===t.rank)n.gl.uniform3i(t.startLoc,e[0],e[1],e[2]);else{if(4!==t.rank)throw Error("Slicing for rank "+t.rank+" is not yet supported");n.gl.uniform4i(t.startLoc,e[0],e[1],e[2],e[3]);}}},e}();function getCoords$1(e){if(1===e)return "sourceLoc";if(2===e)return "sourceLoc.x, sourceLoc.y";if(3===e)return "sourceLoc.x, sourceLoc.y, sourceLoc.z";if(4===e)return "sourceLoc.x, sourceLoc.y, sourceLoc.z, sourceLoc.w";throw Error("Slicing for rank "+e+" is not yet supported")}var StridedSliceProgram=function(){return function(e,t,n,r){this.variableNames=["x"];var o=n.filter(function(e,t){return -1===r.indexOf(t)});this.outputShape=o;var a=n.length,i=getCoordsDataType(n.length),s=getCoordsDataType(o.length),u="";if(1===a)u="coords * strides + begin";else{var l=0;u=n.map(function(e,t){return -1===r.indexOf(t)?(l++,1===o.length?"coords * strides["+t+"] + begin["+t+"]":"coords["+(l-1)+"] * strides["+t+"] + begin["+t+"]"):"begin["+t+"]"}).join(",");}this.userCode="\n "+i+" begin = "+i+"("+e+");\n "+i+" strides = "+i+"("+t+");\n\n void main() {\n "+s+" coords = getOutputCoords();\n setOutput(getX("+u+"));\n }\n ";}}(),TextureManager=function(){function e(e){this.gpgpu=e,this.numUsedTextures=0,this.numFreeTextures=0,this.freeTextures={},this.logEnabled=!1,this.usedTextures={};}return e.prototype.acquireTexture=function(e,t){var n,r=getPhysicalFromLogicalTextureType(t),o=getKeyFromTextureShape(e,r);if(o in this.freeTextures||(this.freeTextures[o]=[]),o in this.usedTextures||(this.usedTextures[o]=[]),this.freeTextures[o].length>0){this.numFreeTextures--,this.numUsedTextures++,this.log();var a=this.freeTextures[o].shift();return this.usedTextures[o].push(a),a}return this.numUsedTextures++,this.log(),r===PhysicalTextureType.PACKED_2X2_FLOAT32?n=this.gpgpu.createPackedMatrixTexture(e[0],e[1]):r===PhysicalTextureType.UNPACKED_FLOAT32?n=this.gpgpu.createFloat32MatrixTexture(e[0],e[1]):r===PhysicalTextureType.UNPACKED_FLOAT16?n=this.gpgpu.createFloat16MatrixTexture(e[0],e[1]):r===PhysicalTextureType.PACKED_4X1_UNSIGNED_BYTE&&(n=this.gpgpu.createUnsignedBytesMatrixTexture(e[0],e[1])),this.usedTextures[o].push(n),n},e.prototype.releaseTexture=function(e,t,n){if(null!=this.freeTextures){var r=getKeyFromTextureShape(t,getPhysicalFromLogicalTextureType(n));r in this.freeTextures||(this.freeTextures[r]=[]),this.freeTextures[r].push(e),this.numFreeTextures++,this.numUsedTextures--;var o=this.usedTextures[r],a=o.indexOf(e);if(a<0)throw new Error("Cannot release a texture that was never provided by this texture manager");o.splice(a,1),this.log();}},e.prototype.log=function(){if(this.logEnabled){var e=this.numFreeTextures+this.numUsedTextures;console.log("Free/Used",this.numFreeTextures+" / "+this.numUsedTextures,"("+e+")");}},e.prototype.getNumUsedTextures=function(){return this.numUsedTextures},e.prototype.getNumFreeTextures=function(){return this.numFreeTextures},e.prototype.dispose=function(){var e=this;if(null!=this.freeTextures){for(var t in this.freeTextures)this.freeTextures[t].forEach(function(t){e.gpgpu.deleteMatrixTexture(t);});for(var t in this.usedTextures)this.usedTextures[t].forEach(function(t){e.gpgpu.deleteMatrixTexture(t);});this.freeTextures=null,this.usedTextures=null,this.numUsedTextures=0,this.numFreeTextures=0;}},e}();function getPhysicalFromLogicalTextureType(e){if(e===TextureUsage.DOWNLOAD||e===TextureUsage.PIXELS)return PhysicalTextureType.PACKED_4X1_UNSIGNED_BYTE;if(e===TextureUsage.UPLOAD)return PhysicalTextureType.UNPACKED_FLOAT32;if(e===TextureUsage.RENDER)return ENV.get("WEBGL_RENDER_FLOAT32_ENABLED")?PhysicalTextureType.UNPACKED_FLOAT32:PhysicalTextureType.UNPACKED_FLOAT16;if(e===TextureUsage.PACK)return PhysicalTextureType.PACKED_2X2_FLOAT32;throw new Error("Unknown logical texture type "+e)}function getKeyFromTextureShape(e,t){return e[0]+"_"+e[1]+"_"+t}var TileProgram=function(){return function(e,t){this.variableNames=["A"];for(var n=new Array(e.length),r=0;r5)throw Error("Tile for rank "+t+" is not yet supported");if(1===t)return "imod(resRC, "+e[0]+")";for(var n=["resRC.x","resRC.y","resRC.z","resRC.w","resRC.u"],r=[],o=0;o6)throw Error("Transpose for rank "+t+" is not yet supported");for(var n=["resRC.x","resRC.y","resRC.z","resRC.w","resRC.u","resRC.v"],r=new Array(t),o=0;o= 0.0) ? scale * x : scaleAlpha * (exp(x) - 1.0);\n";function STEP(e){return void 0===e&&(e=0),CHECK_NAN_SNIPPET$1+"\n return x > 0.0 ? 1.0 : float("+e+");\n "}var NEG="return -x;",CEIL="return ceil(x);",FLOOR="return floor(x);",SIGN="\n if (isNaN(x)) { return 0.0; }\n return sign(x);\n",ROUND="\n // OpenGL ES does not support round function.\n // The algorithm is based on banker's rounding.\n float base = floor(x);\n if ((x - base) < 0.5) {\n return floor(x);\n } else if ((x - base) > 0.5) {\n return ceil(x);\n } else {\n if (mod(base, 2.0) == 0.0) {\n return base;\n } else {\n return base + 1.0;\n }\n }\n",EXP="return exp(x);",EXPM1="return exp(x) - 1.0;",LOG="if (x < 0.0) return NAN;\n return log(x);",LOG1P="return log(1.0 + x);",SQRT="return sqrt(x);",RSQRT="return inversesqrt(x);",SIGMOID="return 1.0 / (1.0 + exp(-1.0 * x));",SOFTPLUS="\n float epsilon = 1.1920928955078125e-7;\n float threshold = log(epsilon) + 2.0;\n\n bool too_large = x > -threshold;\n bool too_small = x < threshold;\n\n float result;\n float exp_x = exp(x);\n\n if (too_large){\n result = x;\n }\n else if (too_small){\n result = exp_x;\n }\n else{\n result = log(exp_x + 1.0);\n }\n return result;\n",SIN=CHECK_NAN_SNIPPET$1+"\n return sin(x);\n",COS=CHECK_NAN_SNIPPET$1+"\n return cos(x);\n",TAN="return tan(x);",ASIN="return asin(x);",ACOS="return acos(x);",ATAN=CHECK_NAN_SNIPPET$1+"\n return atan(x);\n",SINH="\n float e2x = exp(x);\n return (e2x - 1.0 / e2x) / 2.0;\n",COSH="\n float e2x = exp(-x);\n return (e2x + 1.0 / e2x) / 2.0;\n",TANH="\n float e2x = exp(-2.0 * abs(x));\n return sign(x) * (1.0 - e2x) / (1.0 + e2x);\n",ASINH="return log(x + sqrt(x * x + 1.0));",ACOSH=CHECK_NAN_SNIPPET$1+"\n if (x < 1.0) return NAN;\n return log(x + sqrt(x * x - 1.0));",ATANH=CHECK_NAN_SNIPPET$1+"\n if ((x < -1.0) || (x > 1.0)) return NAN;\n return (log(1.0 + x) - log(1.0 - x)) / 2.0;",ERF='\n // Error function is calculated approximately with elementary function.\n // See "Handbook of Mathematical Functions with Formulas,\n // Graphs, and Mathematical Tables", Abramowitz and Stegun.\n float p = '+ERF_P+";\n float a1 = "+ERF_A1+";\n float a2 = "+ERF_A2+";\n float a3 = "+ERF_A3+";\n float a4 = "+ERF_A4+";\n float a5 = "+ERF_A5+";\n\n float t = 1.0 / (1.0 + p * x);\n return 1.0 - (((((a5*t + a4)*t) + a3)*t + a2)*t + a1)*t*exp(-x*x);\n",SQUARE="return x * x;",RECIPROCAL="return 1.0 / x;",LOGICAL_NOT="return float(!(x >= 1.0));",TO_INT="return float(int(x));",UnpackProgram=function(){return function(e){this.variableNames=["A"],this.outputShape=e,this.userCode="\n const vec2 onePixel = 1. / vec2("+e[1]+", "+e[0]+");\n\n void main() {\n ivec2 rc = getOutputCoords();\n vec2 modCoord = mod(vec2(rc.y, rc.x), 2.);\n\n vec4 packedInput = texture2D(A,\n resultUV - step(1., modCoord) * onePixel);\n\n setOutput(\n modCoord.x == 0. ?\n (modCoord.y == 0. ? packedInput.r : packedInput.b) :\n (modCoord.y == 0. ? packedInput.g : packedInput.a)\n );\n }\n ";}}();function concat1d_(e){return concat(e,0)}function concat2d_(e,t){return concat(e,t)}function concat3d_(e,t){return concat(e,t)}function concat4d_(e,t){return concat(e,t)}function concat_(e,t){void 0===t&&(t=0),assert(e.length>=1,"Pass at least one tensor to concat");var n=convertToTensorArray(e,"tensors","concat");t=parseAxisParam(t,n[0].shape)[0];var r=computeOutShape(n.map(function(e){return e.shape}),t);if(0===sizeFromShape(r))return tensor([],r);if(1===(n=n.filter(function(e){return e.size>0})).length)return n[0];var o=n.map(function(e){return e.shape});assertParamsConsistent(o,t);var a=n;return ENV.engine.runKernel(function(e){return e.concat(n,t)},a,function(e){var n=o.map(function(e){return e[t]});return split$1(e,n,t).map(function(e){return function(){return e}})})}function split_(e,t,n){void 0===n&&(n=0);var r,o=convertToTensor(e,"x","split");n=parseAxisParam(n,o.shape)[0],"number"==typeof t?(assert(o.shape[n]%t==0,"Number of splits must evenly divide the axis."),r=Array(t).fill(o.shape[n]/t)):(assert(o.shape[n]===t.reduce(function(e,t){return e+t}),"The sum of sizes must match the size of the axis dimension."),r=t);return ENV.engine.runKernel(function(e){return e.split(o,r,n)},{$x:o},function(e){return {$x:function(){return concat(e,n)}}})}var concat=op({concat_:concat_}),concat1d=op({concat1d_:concat1d_}),concat2d=op({concat2d_:concat2d_}),concat3d=op({concat3d_:concat3d_}),concat4d=op({concat4d_:concat4d_}),split$1=op({split_:split_});function createCommonjsModule(e,t){return e(t={exports:{}},t.exports),t.exports}var alea=createCommonjsModule(function(e){!function(e,t,n){function r(e,t){return t.c=e.c,t.s0=e.s0,t.s1=e.s1,t.s2=e.s2,t}function o(e,t){var n=new function(e){var t,n=this,r=(t=4022871197,function(e){e=e.toString();for(var n=0;n>>0,t=(r*=t)>>>0,t+=4294967296*(r-=t);}return 2.3283064365386963e-10*(t>>>0)});n.next=function(){var e=2091639*n.s0+2.3283064365386963e-10*n.c;return n.s0=n.s1,n.s1=n.s2,n.s2=e-(n.c=0|e)},n.c=1,n.s0=r(" "),n.s1=r(" "),n.s2=r(" "),n.s0-=r(e),n.s0<0&&(n.s0+=1),n.s1-=r(e),n.s1<0&&(n.s1+=1),n.s2-=r(e),n.s2<0&&(n.s2+=1),r=null;}(e),o=t&&t.state,a=n.next;return a.int32=function(){return 4294967296*n.next()|0},a.double=function(){return a()+1.1102230246251565e-16*(2097152*a()|0)},a.quick=a,o&&("object"==typeof o&&r(o,n),a.state=function(){return r(n,{})}),a}t&&t.exports?t.exports=o:n&&n.amd?n(function(){return o}):this.alea=o;}(0,e,!1);}),xor128=createCommonjsModule(function(e){!function(e,t,n){function r(e,t){return t.x=e.x,t.y=e.y,t.z=e.z,t.w=e.w,t}function o(e,t){var n=new function(e){var t=this,n="";t.x=0,t.y=0,t.z=0,t.w=0,t.next=function(){var e=t.x^t.x<<11;return t.x=t.y,t.y=t.z,t.z=t.w,t.w^=t.w>>>19^e^e>>>8},e===(0|e)?t.x=e:n+=e;for(var r=0;r>>0)/4294967296};return a.double=function(){do{var e=((n.next()>>>11)+(n.next()>>>0)/4294967296)/(1<<21);}while(0===e);return e},a.int32=n.next,a.quick=a,o&&("object"==typeof o&&r(o,n),a.state=function(){return r(n,{})}),a}t&&t.exports?t.exports=o:n&&n.amd?n(function(){return o}):this.xor128=o;}(0,e,!1);}),xorwow=createCommonjsModule(function(e){!function(e,t,n){function r(e,t){return t.x=e.x,t.y=e.y,t.z=e.z,t.w=e.w,t.v=e.v,t.d=e.d,t}function o(e,t){var n=new function(e){var t=this,n="";t.next=function(){var e=t.x^t.x>>>2;return t.x=t.y,t.y=t.z,t.z=t.w,t.w=t.v,(t.d=t.d+362437|0)+(t.v=t.v^t.v<<4^e^e<<1)|0},t.x=0,t.y=0,t.z=0,t.w=0,t.v=0,e===(0|e)?t.x=e:n+=e;for(var r=0;r>>4),t.next();}(e),o=t&&t.state,a=function(){return (n.next()>>>0)/4294967296};return a.double=function(){do{var e=((n.next()>>>11)+(n.next()>>>0)/4294967296)/(1<<21);}while(0===e);return e},a.int32=n.next,a.quick=a,o&&("object"==typeof o&&r(o,n),a.state=function(){return r(n,{})}),a}t&&t.exports?t.exports=o:n&&n.amd?n(function(){return o}):this.xorwow=o;}(0,e,!1);}),xorshift7=createCommonjsModule(function(e){!function(e,t,n){function r(e,t){return t.x=e.x.slice(),t.i=e.i,t}function o(e,t){null==e&&(e=+new Date);var n=new function(e){var t=this;t.next=function(){var e,n,r=t.x,o=t.i;return e=r[o],n=(e^=e>>>7)^e<<24,n^=(e=r[o+1&7])^e>>>10,n^=(e=r[o+3&7])^e>>>3,n^=(e=r[o+4&7])^e<<7,e=r[o+7&7],n^=(e^=e<<13)^e<<9,r[o]=n,t.i=o+1&7,n},function(e,t){var n,r=[];if(t===(0|t))r[0]=t;else for(t=""+t,n=0;n0;--n)e.next();}(t,e);}(e),o=t&&t.state,a=function(){return (n.next()>>>0)/4294967296};return a.double=function(){do{var e=((n.next()>>>11)+(n.next()>>>0)/4294967296)/(1<<21);}while(0===e);return e},a.int32=n.next,a.quick=a,o&&(o.x&&r(o,n),a.state=function(){return r(n,{})}),a}t&&t.exports?t.exports=o:n&&n.amd?n(function(){return o}):this.xorshift7=o;}(0,e,!1);}),xor4096=createCommonjsModule(function(e){!function(e,t,n){function r(e,t){return t.i=e.i,t.w=e.w,t.X=e.X.slice(),t}function o(e,t){null==e&&(e=+new Date);var n=new function(e){var t=this;t.next=function(){var e,n,r=t.w,o=t.X,a=t.i;return t.w=r=r+1640531527|0,n=o[a+34&127],e=o[a=a+1&127],n^=n<<13,e^=e<<17,n^=n>>>15,e^=e>>>12,n=o[a]=n^e,t.i=a,n+(r^r>>>16)|0},function(e,t){var n,r,o,a,i,s=[],u=128;for(t===(0|t)?(r=t,t=null):(t+="\0",r=0,u=Math.max(u,t.length)),o=0,a=-32;a>>15,r^=r<<4,r^=r>>>13,a>=0&&(i=i+1640531527|0,o=0==(n=s[127&a]^=r+i)?o+1:0);for(o>=128&&(s[127&(t&&t.length||0)]=-1),o=127,a=512;a>0;--a)r=s[o+34&127],n=s[o=o+1&127],r^=r<<13,n^=n<<17,r^=r>>>15,n^=n>>>12,s[o]=r^n;e.w=i,e.X=s,e.i=o;}(t,e);}(e),o=t&&t.state,a=function(){return (n.next()>>>0)/4294967296};return a.double=function(){do{var e=((n.next()>>>11)+(n.next()>>>0)/4294967296)/(1<<21);}while(0===e);return e},a.int32=n.next,a.quick=a,o&&(o.X&&r(o,n),a.state=function(){return r(n,{})}),a}t&&t.exports?t.exports=o:n&&n.amd?n(function(){return o}):this.xor4096=o;}(0,e,!1);}),tychei=createCommonjsModule(function(e){!function(e,t,n){function r(e,t){return t.a=e.a,t.b=e.b,t.c=e.c,t.d=e.d,t}function o(e,t){var n=new function(e){var t=this,n="";t.next=function(){var e=t.b,n=t.c,r=t.d,o=t.a;return e=e<<25^e>>>7^n,n=n-r|0,r=r<<24^r>>>8^o,o=o-e|0,t.b=e=e<<20^e>>>12^n,t.c=n=n-r|0,t.d=r<<16^n>>>16^o,t.a=o-e|0},t.a=0,t.b=0,t.c=-1640531527,t.d=1367130551,e===Math.floor(e)?(t.a=e/4294967296|0,t.b=0|e):n+=e;for(var r=0;r>>0)/4294967296};return a.double=function(){do{var e=((n.next()>>>11)+(n.next()>>>0)/4294967296)/(1<<21);}while(0===e);return e},a.int32=n.next,a.quick=a,o&&("object"==typeof o&&r(o,n),a.state=function(){return r(n,{})}),a}t&&t.exports?t.exports=o:n&&n.amd?n(function(){return o}):this.tychei=o;}(0,e,!1);}),seedrandom=createCommonjsModule(function(e){!function(t,n){var r,o=this,a=256,i=6,s="random",u=n.pow(a,i),l=n.pow(2,52),c=2*l,p=a-1;function d(e,d,g){var v=[],y=f(function e(t,n){var r,o=[],a=typeof t;if(n&&"object"==a)for(r in t)try{o.push(e(t[r],n-1));}catch(e){}return o.length?o:"string"==a?t:t+"\0"}((d=1==d?{entropy:!0}:d||{}).entropy?[e,m(t)]:null==e?function(){try{var e;return r&&(e=r.randomBytes)?e=e(a):(e=new Uint8Array(a),(o.crypto||o.msCrypto).getRandomValues(e)),m(e)}catch(e){var n=o.navigator,i=n&&n.plugins;return [+new Date,o,i,o.screen,m(t)]}}():e,3),v),x=new function(e){var t,n=e.length,r=this,o=0,i=r.i=r.j=0,s=r.S=[];n||(e=[n++]);for(;o=c;)e/=2,t/=2,n>>>=1;return (e+n)/t};return T.int32=function(){return 0|x.g(4)},T.quick=function(){return x.g(4)/4294967296},T.double=T,f(m(x.S),t),(d.pass||g||function(e,t,r,o){return o&&(o.S&&h(o,x),e.state=function(){return h(x,{})}),r?(n[s]=e,t):e})(T,y,"global"in d?d.global:this==n,d.state)}function h(e,t){return t.i=e.i,t.j=e.j,t.S=e.S.slice(),t}function f(e,t){for(var n,r=e+"",o=0;o=1||0===i);var s=Math.sqrt(-2*Math.log(i)/i);t=this.mean+this.stdDev*o*s,n=this.mean+this.stdDev*a*s,this.truncated&&!this.isValidTruncated(t)||(r=!0);}return this.truncated&&!this.isValidTruncated(n)||(this.nextVal=this.convertValue(n)),this.convertValue(t)},e.prototype.convertValue=function(e){return null==this.dtype||"float32"===this.dtype?e:Math.round(e)},e.prototype.isValidTruncated=function(e){return e<=this.upper&&e>=this.lower},e}();function clone_(e){var t=convertToTensor(e,"x","clone");return ENV.engine.runKernel(function(e){return Tensor.make(t.shape,{dataId:t.dataId},t.dtype)},{$x:t},function(e){return {$x:function(){return e.toFloat()}}})}function eye_(e,t,n,r){void 0===r&&(r="float32"),null==t&&(t=e);for(var o=buffer([e,t],r),a=e<=t?e:t,i=0;i2)throw new Error("Rank of probabilities must be 1 or 2, but is "+i);n=n||Math.random();var s=1===i?o.as2D(1,-1):o,u=ENV.engine.runKernel(function(e){return e.multinomial(s,r,t,n)},{logits2D:s});return 1===i?u.as1D():u}function oneHot_(e,t,n,r){void 0===n&&(n=1),void 0===r&&(r=0);var o=convertToTensor(e,"indices","oneHot","int32");if(assert("int32"===o.dtype,"Indices must be of dtype `int32`"),t<2)throw new Error("Error in oneHot: depth must be >=2, but it is "+t);return ENV.engine.runKernel(function(e){return e.oneHot(o,t,n,r)},{$indices:o},function(e){return {$indices:function(){return zerosLike(o)}}})}function fromPixels_(e,t){if(void 0===t&&(t=3),t>4)throw new Error("Cannot construct Tensor with more than 4 channels from pixels.");return ENV.engine.fromPixels(e,t)}function toPixels(e,t){return __awaiter(this,void 0,void 0,function(){var n,r,o,a,i,s,u,l,c,p,d,h,f,m,g,v,y,x,T,b;return __generator(this,function(S){switch(S.label){case 0:if(2!==(n=convertToTensor(e,"img","toPixels","int32")).rank&&3!==n.rank)throw new Error("toPixels only supports rank 2 or 3 tensors, got rank "+n.rank+".");if(r=n.shape.slice(0,2),o=r[0],a=r[1],(i=2===n.rank?1:n.shape[2])>4||2===i)throw new Error("toPixels only supports depth of size 1, 3 or 4 but got "+i);return s=n.min(),u=n.max(),[4,s.data()];case 1:return l=S.sent()[0],[4,u.data()];case 2:if(c=S.sent()[0],s.dispose(),u.dispose(),"float32"===n.dtype){if(l<0||c>1)throw new Error("Tensor values for a float32 Tensor must be in the range [0 - 1] but got range ["+l+" - "+c+"].")}else{if("int32"!==n.dtype)throw new Error("Unsupported type for toPixels: "+n.dtype+". Please use float32 or int32 tensors.");if(l<0||c>255)throw new Error("Tensor values for a int32 Tensor must be in the range [0 - 255] but got range ["+l+" - "+c+"].")}return [4,n.data()];case 3:for(p=S.sent(),d="float32"===n.dtype?255:1,h=new Uint8ClampedArray(a*o*4),f=0;f=1,"Pass at least one tensor to tf.stack"),1===n.length)return n[0].expandDims(t);var r=n[0].rank,o=n[0].shape,a=n[0].dtype;assert(t<=r,"Axis must be <= rank of the tensor"),n.forEach(function(e){assertShapesMatch(o,e.shape,"All tensors passed to stack must have matching shapes");}),n.forEach(function(e){assert(a===e.dtype,"All tensors passed to stack must have matching dtypes");});var i=n.map(function(e){return e.expandDims(t)});return concat(i,t)}function batchToSpaceND_(e,t,n){var r=convertToTensor(e,"x","batchToSpaceND"),o=t.reduce(function(e,t){return e*t});assert(r.rank>=1+t.length,"input rank should be > than [blockShape] but got "+r.rank),assert(n.length===t.length,"crops.shape[0] must be equal to [blockShape] but got "+n.length),assert(r.shape[0]%o==0,"input tensor batch must be divisible by prod( blockShape )");return ENV.engine.runKernel(function(e){return e.batchToSpaceND(r,t,n)},{$x:r},function(e){return {$x:function(){return e.spaceToBatchND(t,n)}}})}function spaceToBatchND_(e,t,n){var r=convertToTensor(e,"x","spaceToBatchND");assert(r.rank>=1+t.length,"input rank "+r.rank+" should be > than [blockShape] "+t.length),assert(n.length===t.length,"paddings.shape[0] "+n.length+" must be equal to [blockShape] "+t.length),assert(r.shape.reduce(function(e,r,o){return o>0&&o<=t.length?e&&(r+n[o-1][0]+n[o-1][1])%t[o-1]==0:e},!0),"input spatial dimensions "+r.shape.slice(1)+" with paddings "+n.toString()+" must be divisible by blockShapes "+t.toString());return ENV.engine.runKernel(function(e){return e.spaceToBatchND(r,t,n)},{$x:r},function(e){return {$x:function(){return e.batchToSpaceND(t,n)}}})}function unstack_(e,t){void 0===t&&(t=0);for(var n,r=convertToTensor(e,"x","unstack"),o=r.shape[t],a=Array(r.rank-1).fill(0),i=0,s=0;s=0,"Negative dimension size caused by overflow when multiplying\n "+o+" and "+t+" for depthToSpace with input shape\n "+r.shape),assert(a*t>=0,"Negative dimension size caused by overflow when multiplying\n "+a+" and "+t+" for depthToSpace with input shape\n "+r.shape),assert(i%(t*t)==0,"Dimension size must be evenly divisible by "+t*t+" but is "+i+" for depthToSpace with input shape "+r.shape),ENV.engine.runKernel(function(e){return e.depthToSpace(r,t,n)},{$x:r})}function buffer(e,t,n){return void 0===t&&(t="float32"),new TensorBuffer(e,t,n)}function print(e,t){void 0===t&&(t=!1),console.log(e.toString(t));}var batchToSpaceND=op({batchToSpaceND_:batchToSpaceND_}),cast=op({cast_:cast_}),clone=op({clone_:clone_}),cumsum=op({cumsum_:cumsum_}),depthToSpace=op({depthToSpace_:depthToSpace_}),expandDims=op({expandDims_:expandDims_}),eye=op({eye_:eye_}),fromPixels=op({fromPixels_:fromPixels_}),multinomial=op({multinomial_:multinomial_}),oneHot=op({oneHot_:oneHot_}),pad=op({pad_:pad_}),pad1d=op({pad1d_:pad1d_}),pad2d=op({pad2d_:pad2d_}),pad3d=op({pad3d_:pad3d_}),pad4d=op({pad4d_:pad4d_}),rand=op({rand_:rand_}),randomNormal=op({randomNormal_:randomNormal_}),randomUniform=op({randomUniform_:randomUniform_}),reshape=op({reshape_:reshape_}),spaceToBatchND=op({spaceToBatchND_:spaceToBatchND_}),squeeze=op({squeeze_:squeeze_}),stack=op({stack_:stack_}),tile=op({tile_:tile_}),truncatedNormal=op({truncatedNormal_:truncatedNormal_}),unstack=op({unstack_:unstack_});function whereImpl(e,t){for(var n=[],r=0;r0?this.gpgpu.beginQuery():{startMs:performance.now(),endMs:null}},e.prototype.endTimer=function(e){return ENV.get("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_VERSION")>0?(this.gpgpu.endQuery(),e):(e.endMs=performance.now(),e)},e.prototype.getQueryTime=function(e){return __awaiter(this,void 0,void 0,function(){var t;return __generator(this,function(n){return ENV.get("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_VERSION")>0?[2,this.gpgpu.waitForQueryAndGetTime(e)]:[2,(t=e).endMs-t.startMs]})})},e.prototype.disposeData=function(e){if(!this.pendingDisposal.has(e))if(this.pendingRead.has(e))this.pendingDisposal.add(e);else if(this.texData.has(e)){var t=this.texData.get(e),n=t.texture,r=t.texShape,o=t.usage,a=t.complexTensors;null!=n&&this.releaseTexture(e,n,r,o),null!=a&&(a.real.dispose(),a.imag.dispose()),this.texData.delete(e);}},e.prototype.getTexture=function(e){return this.uploadToGPU(e),this.texData.get(e).texture},e.prototype.getGPGPUContext=function(){return this.gpgpu},e.prototype.getCanvas=function(){return this.canvas},e.prototype.complex=function(e,t){var n=this.makeOutputArray(e.shape,"complex64");return this.texData.get(n.dataId).complexTensors={real:ENV.engine.keep(e.clone()),imag:ENV.engine.keep(t.clone())},n},e.prototype.real=function(e){return this.texData.get(e.dataId).complexTensors.real.clone()},e.prototype.imag=function(e){return this.texData.get(e.dataId).complexTensors.imag.clone()},e.prototype.slice=function(e,t,n){var r=new SliceProgram(n),o=r.getCustomSetupFunc(t);return this.compileAndRun(r,[e],null,o)},e.prototype.stridedSlice=function(e,t,n,r,o,a,i,s,u){var l=getStridedSlicedInfo(e.shape,t,n,r,o,a,i,s,u),c=l[0],p=l[1],d=l[2],h=p.filter(function(e,t){return -1===d.indexOf(t)});if(h.some(function(e){return 0===e}))return tensor([],h);var f=new StridedSliceProgram(c,r,p,d);return this.compileAndRun(f,[e])},e.prototype.reverse=function(e,t){var n=new ReverseProgram(e.shape,t);return this.compileAndRun(n,[e])},e.prototype.concat2Tensors=function(e,t,n){var r=computeOutShape([e.shape,t.shape],n),o=e.as2D(-1,sizeFromShape(e.shape.slice(n))),a=t.as2D(-1,sizeFromShape(t.shape.slice(n))),i=new ConcatProgram(o.shape,a.shape);return this.compileAndRun(i,[o,a]).reshape(r)},e.prototype.concat=function(e,t){if(1===e.length)return e[0];for(var n=e[0],r=1;r 4 with a WebGL backend not implemented yet");var r=t.reduce(function(e,t){return e*t}),o=getReshaped(e.shape,t,r),a=getPermuted(o.length,t.length),i=getReshapedPermuted(e.shape,t,r),s=getSliceBeginCoords(n,t.length),u=getSliceSize(i,n,t.length);return e.reshape(o).transpose(a).reshape(i).slice(s,u)},e.prototype.spaceToBatchND=function(e,t,n){assert(e.rank<=4,"spaceToBatchND for rank > 4 with a WebGL backend not implemented yet");var r=t.reduce(function(e,t){return e*t}),o=[[0,0]];o.push.apply(o,n);for(var a=1+t.length;a1,"blockSize should be > 1 for depthToSpace, but was: "+t);var r=e.shape[0],o=("NHWC"===n?e.shape[1]:e.shape[2])*t,a=("NHWC"===n?e.shape[2]:e.shape[3])*t,i=("NHWC"===n?e.shape[3]:e.shape[1])/(t*t),s=new DepthToSpaceProgram("NHWC"===n?[r,o,a,i]:[r,i,o,a],t,n);return this.compileAndRun(s,[e])},e.prototype.split=function(e,t,n){return split(e,t,n)},e.prototype.makeOutputArray=function(e,t){return Tensor.make(e,{},t)},e.prototype.compileAndRun=function(e,t,n,r,o){var a=this;if(void 0===o&&(o=!0),null==n&&(n=this.makeOutputArray(e.outputShape,t[0].dtype)),0===n.size)return this.texData.get(n.dataId).values=getTypedArrayFromDType(n.dtype,0),n;var i=t.map(function(e){if("complex64"===e.dtype)throw new Error("GPGPUProgram does not support complex64 input. For complex64 dtypes, please separate the program into real and imaginary parts.");var t=a.texData.get(e.dataId);return null==t.texture&&sizeFromShape(e.shape)<=SIZE_UPLOAD_UNIFORM?{shape:e.shape,texData:null,isUniform:!0,uniformValues:a.readSync(e.dataId)}:(a.uploadToGPU(e.dataId),{shape:e.shape,texData:t,isUniform:!1})});this.uploadToGPU(n.dataId);var s,u={shape:n.shape,texData:this.texData.get(n.dataId),isUniform:!1},l=makeShaderKey(e,i,u),c=this.getAndSaveBinary(l,function(){return compileProgram(a.gpgpu,e,i,u)}),p=null!=this.activeTimers;if(p&&(s=this.startTimer()),runProgram(c,i,u,r),ENV.get("WEBGL_PAGING_ENABLED")&&o&&this.numBytesInGPU>this.NUM_BYTES_BEFORE_PAGING)for(var d=this.numBytesInGPU-this.NUM_BYTES_BEFORE_PAGING;d>0&&this.lruDataGPU.length>0;){var h=this.lruDataGPU.shift(),f=this.texData.get(h),m=f.shape,g=f.dtype;d-=this.computeBytes(m,g),this.read(h);}return p&&(s=this.endTimer(s),this.activeTimers.push(this.getQueryTime(s))),n},e.prototype.getAndSaveBinary=function(e,t){return e in this.binaryCache||(this.binaryCache[e]=t()),this.binaryCache[e]},e.prototype.getTextureManager=function(){return this.textureManager},e.prototype.dispose=function(){if(!this.disposed){for(var e in this.binaryCache)this.gpgpu.deleteProgram(this.binaryCache[e].webGLProgram);this.textureManager.dispose(),this.canvas.remove(),null!=this.fromPixelsCanvas&&this.fromPixelsCanvas.remove(),this.gpgpuCreatedLocally&&this.gpgpu.dispose(),this.disposed=!0;}},e.prototype.floatPrecision=function(){var e=this;return tidy(function(){return e.abs(scalar(1e-8)).get()>0?32:16})},e.prototype.uploadToGPU=function(e){var t=this.texData.get(e),n=t.shape,r=t.values,o=t.texture,a=t.dtype,i=t.usage;if(ENV.get("WEBGL_PAGING_ENABLED")&&null!=o){this.lruDataGPU.indexOf(e)>=0&&(this.lruDataGPU.splice(this.lruDataGPU.indexOf(e),1),this.lruDataGPU.push(e));}else{var s,u=null!=this.activeTimers;u&&(s=performance.now());var l=getTextureShapeFromLogicalShape(this.gpgpu.gl,n);t.texShape=l;var c=this.acquireTexture(e,l,i);t.texture=c,null!=r&&(this.gpgpu.uploadMatrixToTexture(c,l[0],l[1],typedArrayToFloat32(r,a)),t.values=null,u&&(this.uploadWaitMs+=performance.now()-s));}},e.prototype.cacheOnCPU=function(e,t){var n=this.delayedStorage,r=this.texData.get(e),o=r.texture,a=r.texShape,i=r.dtype,s=r.usage;n&&null!=o&&(this.releaseTexture(e,o,a,s),r.texture=null,r.texShape=null),r.usage=TextureUsage.UPLOAD,null!=t&&(r.values=float32ToTypedArray(t,i));},e.prototype.releaseTexture=function(e,t,n,r){var o=this.texData.get(e),a=o.shape,i=o.dtype;if(ENV.get("WEBGL_PAGING_ENABLED")){var s=this.lruDataGPU.indexOf(e);s>=0&&this.lruDataGPU.splice(s,1);}this.numBytesInGPU-=this.computeBytes(a,i),this.textureManager.releaseTexture(t,n,r);},e.prototype.acquireTexture=function(e,t,n){var r=this.texData.get(e),o=r.shape,a=r.dtype;return ENV.get("WEBGL_PAGING_ENABLED")&&this.lruDataGPU.push(e),this.numBytesInGPU+=this.computeBytes(o,a),this.textureManager.acquireTexture(t,n)},e.prototype.computeBytes=function(e,t){return sizeFromShape(e)*bytesPerElement(t)},e}();function float32ToTypedArray(e,t){if("float32"===t||"complex64"===t)return e;if("int32"===t||"bool"===t){for(var n="int32"===t?new Int32Array(e.length):new Uint8Array(e.length),r=0;r=2&&a.rank>=2&&o.rank===a.rank,"Error in matMul: inputs must have the same rank of at least 2, got ranks "+o.rank+" and "+a.rank+"."),assert(arraysEqual(c,p),"Error in matMul: outer dimensions ("+c+") and ("+p+") of Tensors with shapes "+o.shape+" and "+a.shape+" must match."),assert(i===s,"Error in matMul: inner shapes ("+i+") and ("+s+") of Tensors with shapes "+o.shape+" and "+a.shape+" and transposeA="+n+" and transposeB="+r+" must match.");var f=o.shape.slice(0,-2).concat([u,l]),m=n?o.as3D(d,i,u):o.as3D(d,u,i),g=r?a.as3D(h,l,s):a.as3D(h,s,l);return ENV.engine.runKernel(function(e){return e.batchMatMul(m,g,n,r)},{$a:m,$b:g},function(e){return n||r?!n&&r?{$a:function(){return e.matMul(g.toFloat(),!1,!1)},$b:function(){return e.matMul(m.toFloat(),!0,!1)}}:n&&!r?{$a:function(){return g.toFloat().matMul(e,!1,!0)},$b:function(){return m.toFloat().matMul(e,!1,!1)}}:{$a:function(){return g.toFloat().matMul(e,!0,!0)},$b:function(){return e.matMul(m.toFloat(),!0,!0)}}:{$a:function(){return e.matMul(g.toFloat(),!1,!0)},$b:function(){return m.toFloat().matMul(e,!0,!1)}}}).reshape(f)}function outerProduct_(e,t){var n=convertToTensor(e,"v1","outerProduct"),r=convertToTensor(t,"v2","outerProduct");return assert(1===n.rank&&1===r.rank,"Error in outerProduct: inputs must be rank 1, but got ranks "+n.rank+" and "+r.rank+"."),n.as2D(-1,1).matMul(r.as2D(1,-1))}function dot_(e,t){var n=convertToTensor(e,"t1","dot"),r=convertToTensor(t,"t2","dot");assert(!(1!==n.rank&&2!==n.rank||1!==r.rank&&2!==r.rank),"Error in dot: inputs must all be rank 1 or 2, but got ranks "+n.rank+" and "+r.rank+".");var o=1===n.rank?n.size:n.shape[1],a=1===r.rank?r.size:r.shape[0];return assert(o===a,"Error in dot: inner dimensions of inputs must match, but got "+o+" and "+a+"."),1===n.rank&&1===r.rank?n.as2D(1,-1).matMul(r.as2D(-1,1)).asScalar():1===n.rank&&2===r.rank?n.as2D(1,-1).matMul(r.as2D(r.shape[0],r.shape[1])).as1D():2===n.rank&&1===r.rank?n.matMul(r.as2D(-1,1)).as1D():n.matMul(r.as2D(r.shape[0],r.shape[1]))}var matMul=op({matMul_:matMul_}),dot=op({dot_:dot_}),outerProduct=op({outerProduct_:outerProduct_});function conv1d_(e,t,n,r,o,a,i){void 0===o&&(o="NWC"),void 0===a&&(a=1);var s=convertToTensor(e,"x","conv1d"),u=convertToTensor(t,"filter","conv1d"),l=s,c=!1;2===s.rank&&(c=!0,l=s.as3D(1,s.shape[0],s.shape[1])),assert(3===l.rank,"Error in conv1d: input must be rank 3, but got rank "+l.rank+"."),assert(3===u.rank,"Error in conv1d: filter must be rank 3, but got rank "+u.rank+"."),null!=i&&assert(isInt(r),"Error in conv1d: pad must be an integer when using, dimRoundingMode "+i+" but got pad "+r+"."),assert(l.shape[2]===u.shape[1],"Error in conv1d: depth of input ("+l.shape[2]+") must match input depth for filter "+u.shape[1]+"."),assert(eitherStridesOrDilationsAreOne(n,a),"Error in conv1D: Either stride or dilation must be 1. Got stride "+n+" and dilation '"+a+"'"),assert("NWC"===o,"Error in conv1d: got dataFormat of "+o+" but only NWC is currently supported.");var p=u.as4D(1,u.shape[0],u.shape[1],u.shape[2]),d=l.as4D(l.shape[0],1,l.shape[1],l.shape[2]),h=conv2d(d,p,[1,n],r,"NHWC",[1,a],i);return c?h.as2D(h.shape[2],h.shape[3]):h.as3D(h.shape[0],h.shape[2],h.shape[3])}function conv2d_(e,t,n,r,o,a,i){void 0===o&&(o="NHWC"),void 0===a&&(a=[1,1]);var s=convertToTensor(e,"x","conv2d"),u=convertToTensor(t,"filter","conv2d"),l=s,c=!1;3===s.rank&&(c=!0,l=s.as4D(1,s.shape[0],s.shape[1],s.shape[2])),assert(4===l.rank,"Error in conv2d: input must be rank 4, but got rank "+l.rank+"."),assert(4===u.rank,"Error in conv2d: filter must be rank 4, but got rank "+u.rank+"."),null!=i&&assert(isInt(r),"Error in conv2d: pad must be an integer when using, dimRoundingMode "+i+" but got pad "+r+"."),assert(l.shape[3]===u.shape[2],"Error in conv2d: depth of input ("+l.shape[3]+") must match input depth for filter "+u.shape[2]+"."),assert(eitherStridesOrDilationsAreOne(n,a),"Error in conv2D: Either strides or dilations must be 1. Got strides "+n+" and dilations '"+a+"'"),assert("NHWC"===o,"Error in conv2d: got dataFormat of "+o+" but only NHWC is currently supported.");var p,d=computeConv2DInfo(l.shape,u.shape,n,a,r,i);if(1===d.filterHeight&&1===d.filterWidth&&1===d.dilationHeight&&1===d.dilationWidth&&1===d.strideHeight&&1===d.strideWidth&&"SAME"===d.padInfo.type){var h=l.reshape([-1,d.inChannels]),f=u.reshape([d.inChannels,d.outChannels]);p=matMul(h,f).reshape(d.outShape);}else{p=ENV.engine.runKernel(function(e){return e.conv2d(l,u,d)},{x:l,$filter:u},function(e){return assert(tupleValuesAreOne(a),"Error in gradient of conv2D: dilation rates greater than 1 are notyet supported in gradients. Got dilations '"+a+"'"),{x:function(){return conv2dDerInput_(l.shape,e,u,n,r)},$filter:function(){return conv2dDerFilter_(l,e,u.shape,n,r)}}});}return c?p.as3D(p.shape[1],p.shape[2],p.shape[3]):p}function conv2dDerInput_(e,t,n,r,o,a){assert(e.length===t.rank,"Length of inShape ("+e.length+") and rank of dy ("+t.rank+") must match");var i=e,s=t,u=!1;3===t.rank&&(u=!0,s=t.as4D(1,t.shape[0],t.shape[1],t.shape[2]),i=[1,e[0],e[1],e[2]]);var l=i[3],c=s.shape[3];assert(4===i.length,"Error in conv2dDerInput: inShape must be length 4, but got length "+i.length+"."),assert(4===s.rank,"Error in conv2dDerInput: dy must be rank 4, but got rank "+s.rank),assert(4===n.rank,"Error in conv2dDerInput: filter must be rank 4, but got rank "+n.rank),assert(l===n.shape[2],"Error in conv2dDerInput: depth of input ("+l+") must match input depth for filter "+n.shape[2]+"."),assert(c===n.shape[3],"Error in conv2dDerInput: depth of output ("+c+") must match output depth for filter "+n.shape[3]+"."),null!=a&&assert(isInt(o),"Error in conv2dDerInput: pad must be an integer when using, dimRoundingMode "+a+" but got pad "+o+".");var p=computeConv2DInfo(i,n.shape,r,1,o,a),d=ENV.engine.runKernel(function(e){return e.conv2dDerInput(s,n,p)},{dy4D:s});return u?d.as3D(d.shape[1],d.shape[2],d.shape[3]):d}function conv2dDerFilter_(e,t,n,r,o,a){var i=e;3===e.rank&&(i=e.as4D(1,e.shape[0],e.shape[1],e.shape[2]));var s=t;3===s.rank&&(s=t.as4D(1,t.shape[0],t.shape[1],t.shape[2])),assert(4===i.rank,"Error in conv2dDerFilter: input must be rank 4, but got shape "+i.shape+"."),assert(4===s.rank,"Error in conv2dDerFilter: dy must be rank 4, but got shape "+s.shape+"."),assert(4===n.length,"Error in conv2dDerFilter: filterShape must be length 4, but got "+n+"."),assert(i.shape[3]===n[2],"Error in conv2dDerFilter: depth of input "+i.shape[3]+") must match input depth in filter ("+n[2]+"."),assert(s.shape[3]===n[3],"Error in conv2dDerFilter: depth of dy ("+s.shape[3]+") must match output depth for filter ("+n[3]+")."),null!=a&&assert(isInt(o),"Error in conv2dDerFilter: pad must be an integer when using, dimRoundingMode "+a+" but got pad "+o+".");var u=computeConv2DInfo(i.shape,n,r,1,o,a);return ENV.engine.runKernel(function(e){return e.conv2dDerFilter(i,s,u)},{x4D:i,dy4D:s})}function conv2dTranspose_(e,t,n,r,o,a){return conv2dDerInput_(n,convertToTensor(e,"x","conv2dTranspose"),convertToTensor(t,"filter","conv2dTranspose"),r,o,a)}function depthwiseConv2d_(e,t,n,r,o,a,i){void 0===o&&(o="NHWC"),void 0===a&&(a=[1,1]);var s=convertToTensor(e,"x","depthwiseConv2d"),u=convertToTensor(t,"filter","depthwiseConv2d"),l=s,c=!1;3===s.rank&&(c=!0,l=s.as4D(1,s.shape[0],s.shape[1],s.shape[2])),assert(4===l.rank,"Error in depthwiseConv2d: input must be rank 4, but got rank "+l.rank+"."),assert(4===u.rank,"Error in depthwiseConv2d: filter must be rank 4, but got rank "+u.rank+"."),assert(l.shape[3]===u.shape[2],"Error in depthwiseConv2d: number of input channels ("+l.shape[3]+") must match the inChannels dimension in filter "+u.shape[2]+"."),null==a&&(a=[1,1]),assert(eitherStridesOrDilationsAreOne(n,a),"Error in depthwiseConv2d: Either strides or dilations must be 1. Got strides "+n+" and dilations '"+a+"'"),null!=i&&assert(isInt(r),"Error in depthwiseConv2d: pad must be an integer when using, dimRoundingMode "+i+" but got pad "+r+".");var p=computeConv2DInfo(l.shape,u.shape,n,a,r,i,!0),d=ENV.engine.runKernel(function(e){return e.depthwiseConv2D(l,u,p)},{x:l,$filter:u},function(e){return assert(tupleValuesAreOne(a),"Error in gradient of depthwiseConv2d: dilation rates greater than 1 are not yet supported. Got dilations '"+a+"'"),{x:function(){return depthwiseConv2dDerInput(l.shape,e,u,p)},$filter:function(){return depthwiseConv2dDerFilter(l,e,u.shape,p)}}});return c?d.as3D(d.shape[1],d.shape[2],d.shape[3]):d}function separableConv2d_(e,t,n,r,o,a,i){void 0===a&&(a=[1,1]),void 0===i&&(i="NHWC");var s=convertToTensor(e,"x","separableConv2d"),u=convertToTensor(t,"depthwiseFilter","separableConv2d"),l=convertToTensor(n,"pointwiseFilter","separableConv2d"),c=s,p=!1;if(3===s.rank&&(p=!0,c=s.as4D(1,s.shape[0],s.shape[1],s.shape[2])),"NCHW"===i)throw new Error("separableConv2d currently does not support dataFormat NCHW; only NHWC is supported");assert(4===c.rank,"Error in separableConv2d: input must be rank 4, but got rank "+c.rank+"."),assert(4===u.rank,"Error in separableConv2d: depthwise filter must be rank 4, but got rank "+u.rank+"."),assert(4===l.rank,"Error in separableConv2d: pointwise filter must be rank 4, but got rank "+u.rank+"."),assert(1===l.shape[0],"Error in separableConv2d: the first dimension of pointwise filter must be 1, but got "+l.shape[0]+"."),assert(1===l.shape[1],"Error in separableConv2d: the second dimension of pointwise filter must be 1, but got "+l.shape[1]+".");var d=u.shape[2],h=u.shape[3];assert(l.shape[2]===d*h,"Error in separableConv2d: the third dimension of pointwise filter must be "+d*h+", but got "+l.shape[2]+".");var f=depthwiseConv2d(c,u,r,o,i,a),m=conv2d(f,l,1,"valid",i);return p?m.as3D(m.shape[1],m.shape[2],m.shape[3]):m}function parseTupleParam$1(e){return "number"==typeof e?[e,e]:e}function tupleValuesAreOne(e){var t=parseTupleParam$1(e),n=t[0],r=t[1];return 1===n&&1===r}function eitherStridesOrDilationsAreOne(e,t){return tupleValuesAreOne(e)||tupleValuesAreOne(t)}function depthwiseConv2dDerInput(e,t,n,r){var o=t,a=!1;3===t.rank&&(a=!0,o=t.as4D(1,t.shape[0],t.shape[1],t.shape[2]));var i=ENV.engine.runKernel(function(e){return e.depthwiseConv2DDerInput(o,n,r)},{dy4D:o});return a?i.as3D(i.shape[1],i.shape[2],i.shape[3]):i}function depthwiseConv2dDerFilter(e,t,n,r){var o=e;3===e.rank&&(o=e.as4D(1,e.shape[0],e.shape[1],e.shape[2]));var a=t;return 3===a.rank&&(a=t.as4D(1,t.shape[0],t.shape[1],t.shape[2])),ENV.engine.runKernel(function(e){return e.depthwiseConv2DDerFilter(o,a,r)},{x4D:o,dy4D:a})}var conv1d=op({conv1d_:conv1d_}),conv2d=op({conv2d_:conv2d_}),depthwiseConv2d=op({depthwiseConv2d_:depthwiseConv2d_}),separableConv2d=op({separableConv2d_:separableConv2d_}),conv2dTranspose=op({conv2dTranspose_:conv2dTranspose_});function reverse1d_(e){var t=convertToTensor(e,"x","reverse");return assert(1===t.rank,"Error in reverse1D: x must be rank 1 but got\n rank "+t.rank+"."),reverse(t,0)}function reverse2d_(e,t){var n=convertToTensor(e,"x","reverse");return assert(2===n.rank,"Error in reverse2D: x must be rank 2 but got\n rank "+n.rank+"."),reverse(n,t)}function reverse3d_(e,t){var n=convertToTensor(e,"x","reverse");return assert(3===n.rank,"Error in reverse3D: x must be rank 3 but got\n rank "+n.rank+"."),reverse(n,t)}function reverse4d_(e,t){var n=convertToTensor(e,"x","reverse");return assert(4===n.rank,"Error in reverse4D: x must be rank 4 but got\n rank "+n.rank+"."),reverse(n,t)}function reverse_(e,t){var n=convertToTensor(e,"x","reverse");if(0===n.rank)return n.clone();var r=parseAxisParam(t,n.shape);return ENV.engine.runKernel(function(e){return e.reverse(n,r)},{$x:n},function(e){return {$x:function(){return e.reverse(r)}}}).reshapeAs(n)}var reverse=op({reverse_:reverse_}),reverse1d=op({reverse1d_:reverse1d_}),reverse2d=op({reverse2d_:reverse2d_}),reverse3d=op({reverse3d_:reverse3d_}),reverse4d=op({reverse4d_:reverse4d_});function maxPool_(e,t,n,r,o){var a=convertToTensor(e,"x","maxPool"),i=a,s=!1;3===a.rank&&(s=!0,i=a.as4D(1,a.shape[0],a.shape[1],a.shape[2])),assert(4===i.rank,"Error in maxPool: input must be rank 4 but got rank "+i.rank+"."),null!=o&&assert(isInt(r),"Error in maxPool: pad must be an integer when using, dimRoundingMode "+o+" but got pad "+r+".");var u=computePool2DInfo(i.shape,t,n,r,o),l=ENV.engine.runKernel(function(e,t){return t(e.maxPool(i,u))},{x:i},function(e,o){var a=o[0];return {x:function(){return maxPoolBackprop(e,i,a,t,n,r)}}});return s?l.as3D(l.shape[1],l.shape[2],l.shape[3]):l}function avgPool_(e,t,n,r,o){var a=convertToTensor(e,"x","avgPool");assert("float32"===a.dtype,"The input dtype to avgPool must be float32");var i=a,s=!1;3===a.rank&&(s=!0,i=a.as4D(1,a.shape[0],a.shape[1],a.shape[2])),assert(4===i.rank,"Error in avgPool: x must be rank 4 but got rank "+i.rank+"."),null!=o&&assert(isInt(r),"Error in avgPool: pad must be an integer when using, dimRoundingMode "+o+" but got pad "+r+".");var u=computePool2DInfo(i.shape,t,n,r),l=ENV.engine.runKernel(function(e){return e.avgPool(i,u)},{x:i},function(e){return {x:function(){return avgPoolBackprop(e,i,t,n,r)}}});return l=l.cast(a.dtype),s?l.as3D(l.shape[1],l.shape[2],l.shape[3]):l}function maxPoolBackprop(e,t,n,r,o,a,i){var s=convertToTensor(e,"dy","maxPoolBackprop"),u=convertToTensor(t,"input","maxPoolBackprop"),l=convertToTensor(n,"output","maxPoolBackprop");assert(u.rank===s.rank,"Rank of input ("+u.rank+") does not match rank of dy ("+s.rank+")"),assert(4===s.rank,"Error in maxPoolBackprop: dy must be rank 4 but got rank "+s.rank+"."),assert(4===u.rank,"Error in maxPoolBackprop: input must be rank 4 but got rank "+u.rank+"."),null!=i&&assert(isInt(a),"Error in maxPoolBackprop: pad must be an integer when using, dimRoundingMode "+i+" but got pad "+a+".");var c=computePool2DInfo(u.shape,r,o,a,i);return ENV.engine.runKernel(function(e){return e.maxPoolBackprop(s,u,l,c)},{$dy:s,$input:u})}function avgPoolBackprop(e,t,n,r,o){var a=convertToTensor(e,"dy","avgPoolBackprop"),i=convertToTensor(t,"input","avgPoolBackprop");assert(i.rank===a.rank,"Rank of input ("+i.rank+") does not match rank of dy ("+a.rank+")");var s=i,u=a,l=!1;3===i.rank&&(l=!0,s=i.as4D(1,i.shape[0],i.shape[1],i.shape[2]),u=a.as4D(1,a.shape[0],a.shape[1],a.shape[2])),assert(4===u.rank,"Error in avgPoolBackprop: dy must be rank 4 but got rank "+u.rank+"."),assert(4===s.rank,"Error in avgPoolBackprop: input must be rank 4 but got rank "+s.rank+".");var c=computePool2DInfo(s.shape,n,r,o),p=ENV.engine.runKernel(function(e){return e.avgPoolBackprop(u,s,c)},{dy4D:u,input4D:s});return l?p.as3D(p.shape[1],p.shape[2],p.shape[3]):p}var maxPool=op({maxPool_:maxPool_}),avgPool=op({avgPool_:avgPool_});function slice1d_(e,t,n){var r=convertToTensor(e,"x","slice1d");return assert(1===r.rank,"slice1d expects a rank-1 tensor, but got a rank-"+r.rank+" tensor"),slice(r,[t],[n])}function slice2d_(e,t,n){var r=convertToTensor(e,"x","slice2d");return assert(2===r.rank,"slice1d expects a rank-2 tensor, but got a rank-"+r.rank+" tensor"),slice(r,t,n)}function slice3d_(e,t,n){var r=convertToTensor(e,"x","slice3d");return assert(3===r.rank,"slice1d expects a rank-3 tensor, but got a rank-"+r.rank+" tensor"),slice(r,t,n)}function slice4d_(e,t,n){var r=convertToTensor(e,"x","slice4d");return assert(4===r.rank,"slice1d expects a rank-4 tensor, but got a rank-"+r.rank+" tensor"),slice(r,t,n)}function slice_(e,t,n){var r,o,a=convertToTensor(e,"x","slice");if(0===a.rank)throw new Error("Slicing scalar is not possible");r="number"==typeof t?[t].concat(new Array(a.rank-1).fill(0)):t.length=0?e:(assert(-1===e,"Bad value in size"),a.shape[t]-r[t])}),assertParamsValid(a,r,o);var i=a.shape;return ENV.engine.runKernel(function(e){return e.slice(a,r,o)},{$x:a},function(e){for(var t=[],n=0;n0&&(t=t.sum(r)),t.reshape(n.shape)},$b:function(){var t=e,n=getReductionAxes(r.shape,o);return n.length>0&&(t=t.sum(n)),t.reshape(r.shape)}}})}function addN_(e){assert(Array.isArray(e),function(){return "The argument passed to tf.addN() must be a list of tensors"}),assert(e.length>=1,function(){return "Must pass at least one tensor to tf.addN(), but got "+e.length});var t=e.map(function(e,t){return convertToTensor(e,"tensors"+t,"addN")}),n=t[0];t.forEach(function(e){if(e.dtype!==n.dtype)throw new Error("All tensors passed to tf.addN() must have the same dtype")}),t.forEach(function(e){if(!arraysEqual(e.shape,n.shape))throw new Error("All tensors passed to tf.addN() must have the same shape")});var r=t;return ENV.engine.runKernel(function(e){return e.addN(t)},r,function(e){var n={};return t.forEach(function(t,r){n[r]=function(){return e.clone()};}),n})}function addStrict_(e,t){return assertShapesMatch(e.shape,t.shape,"Error in addStrict: "),e.add(t)}function sub_(e,t){var n=convertToTensor(e,"a","sub"),r=convertToTensor(t,"b","sub");assertTypesMatch(n,r);var o=assertAndGetBroadcastShape(n.shape,r.shape);return ENV.engine.runKernel(function(e){return e.subtract(n,r)},{$a:n,$b:r},function(e){return {$a:function(){var t=e,r=getReductionAxes(n.shape,o);return r.length>0&&(t=t.sum(r)),t.reshape(n.shape)},$b:function(){var t=e,n=getReductionAxes(r.shape,o);return n.length>0&&(t=t.sum(n)),t.neg().reshape(r.shape)}}})}function subStrict_(e,t){return assertShapesMatch(e.shape,t.shape,"Error in subStrict: "),e.sub(t)}function pow_(e,t){var n=convertToTensor(e,"base","pow"),r=convertToTensor(t,"exp","pow"),o=assertAndGetBroadcastShape(n.shape,r.shape);e=n.cast(upcastType(n.dtype,r.dtype)),t=r.cast(upcastType(n.dtype,r.dtype));return ENV.engine.runKernel(function(e,t){return t(e.pow(n,r))},{$base:n,$exp:r},function(e,t){var a=t[0];return {$base:function(){var t=e.mul(r.toFloat().mul(a.div(n))),i=getReductionAxes(n.shape,o);return i.length>0&&(t=t.sum(i)),t.reshape(n.shape)},$exp:function(){var t=e.mul(a.mul(n.log()).toFloat()),i=getReductionAxes(r.shape,o);return i.length>0&&(t=t.sum(i)),t.reshape(r.shape)}}})}function powStrict_(e,t){return assertShapesMatch(e.shape,t.shape,"Error in powStrict: "),e.pow(t)}function mul_(e,t){var n=convertToTensor(e,"a","mul"),r=convertToTensor(t,"b","mul");assertTypesMatch(n,r);var o=assertAndGetBroadcastShape(n.shape,r.shape);return ENV.engine.runKernel(function(e){return e.multiply(n,r)},{$a:n,$b:r},function(e){return {$a:function(){var t=e.mul(r.toFloat()),a=getReductionAxes(n.shape,o);return a.length>0?t.sum(a).reshape(n.shape):t},$b:function(){var t=e.mul(n.toFloat()),a=getReductionAxes(r.shape,o);return a.length>0?t.sum(a).reshape(r.shape):t}}})}function mulStrict_(e,t){return assertShapesMatch(e.shape,t.shape,"Error in multiplyStrict: "),e.mul(t)}function div_(e,t){var n,r=convertToTensor(e,"a","div"),o=convertToTensor(t,"b","div");if(assertTypesMatch(r,o),"int32"===r.dtype&&"int32"===o.dtype)return floorDiv(r,o);n=function(e){return e.realDivide(r,o)};var a=assertAndGetBroadcastShape(r.shape,o.shape);return ENV.engine.runKernel(n,{$a:r,$b:o},function(e){return {$a:function(){var t=e.div(o.toFloat()),n=getReductionAxes(r.shape,a);return n.length>0?t.sum(n).reshape(r.shape):t},$b:function(){var t=e.mul(r.toFloat()),n=getReductionAxes(o.shape,a);n.length>0&&(t=t.sum(n).reshape(o.shape));var i=o.square();return t.div(i.toFloat()).neg()}}})}function floorDiv_(e,t){var n=convertToTensor(e,"a","floorDiv"),r=convertToTensor(t,"b","floorDiv");assertTypesMatch(n,r);var o=assertAndGetBroadcastShape(n.shape,r.shape);return ENV.engine.runKernel(function(e){return e.floorDiv(n,r)},{$a:n,$b:r},function(e){return {$a:function(){var t=e.div(r.toFloat()),a=getReductionAxes(n.shape,o);return a.length>0?t.sum(a).reshape(n.shape):t},$b:function(){var t=e.mul(n.toFloat()),a=getReductionAxes(r.shape,o);a.length>0&&(t=t.sum(a).reshape(r.shape));var i=r.square();return t.div(i.toFloat()).neg()}}})}function divStrict_(e,t){return assertShapesMatch(e.shape,t.shape,"Error in divideStrict: "),e.div(t)}function mod_(e,t){var n=convertToTensor(e,"a","mod"),r=convertToTensor(t,"b","mod");assertTypesMatch(n,r);var o=assertAndGetBroadcastShape(n.shape,r.shape);return ENV.engine.runKernel(function(e){return e.mod(n,r)},{$a:n,$b:r},function(e){return {$a:function(){var t=getReductionAxes(n.shape,o);return t.length>0?e.sum(t).reshape(n.shape):e},$b:function(){var t=e.mul(n.div(r).floor().neg()),a=getReductionAxes(r.shape,o);return a.length>0?t.sum(a).reshape(r.shape):t}}})}function modStrict_(e,t){return assertShapesMatch(e.shape,t.shape,"Error in modStrict: "),e.mod(t)}function minimum_(e,t){var n=convertToTensor(e,"a","minimum"),r=convertToTensor(t,"b","minimum");assertTypesMatch(n,r),"bool"===n.dtype&&(n=n.toInt()),"bool"===r.dtype&&(r=r.toInt()),assertAndGetBroadcastShape(n.shape,r.shape);return ENV.engine.runKernel(function(e){return e.minimum(n,r)},{$a:n,$b:r},function(e){return {$a:function(){return e.mul(n.lessEqual(r).toFloat())},$b:function(){return e.mul(n.greater(r).toFloat())}}})}function minimumStrict_(e,t){return assertShapesMatch(e.shape,t.shape,"Error in minimumStrict: "),e.minimum(t)}function maximum_(e,t){var n=convertToTensor(e,"a","maximum"),r=convertToTensor(t,"b","maximum");assertTypesMatch(n,r),"bool"===n.dtype&&(n=n.toInt()),"bool"===r.dtype&&(r=r.toInt()),assertAndGetBroadcastShape(n.shape,r.shape);return ENV.engine.runKernel(function(e){return e.maximum(n,r)},{$a:n,$b:r},function(e){return {$a:function(){return e.mul(n.greaterEqual(r).toFloat())},$b:function(){return e.mul(n.less(r).toFloat())}}})}function maximumStrict_(e,t){return assertShapesMatch(e.shape,t.shape,"Error in maximumStrict: "),e.maximum(t)}function squaredDifference_(e,t){var n=convertToTensor(e,"a","squaredDifference"),r=convertToTensor(t,"b","squaredDifference");assertTypesMatch(n,r),assertAndGetBroadcastShape(n.shape,r.shape);return ENV.engine.runKernel(function(e){return e.squaredDifference(n,r)},{$a:n,$b:r},function(e){var t=scalar(2);return {$a:function(){return e.mul(n.sub(r).mul(t))},$b:function(){return e.mul(r.sub(n).mul(t))}}})}function squaredDifferenceStrict_(e,t){return assertShapesMatch(e.shape,t.shape,"Error in squaredDifferenceStrict: "),e.squaredDifference(t)}function atan2_(e,t){var n=convertToTensor(e,"a","atan2"),r=convertToTensor(t,"b","atan2");assertTypesMatch(n,r);var o=assertAndGetBroadcastShape(n.shape,r.shape);return ENV.engine.runKernel(function(e){return e.atan2(n,r)},{$a:n,$b:r},function(e){return {$a:function(){var t=add(n.square(),r.square()),a=e.mul(r.div(t)),i=getReductionAxes(n.shape,o);return i.length>0&&(a=a.sum(i)),a.reshape(n.shape)},$b:function(){var t=add(n.square(),r.square()),a=neg(e.mul(n.div(t))),i=getReductionAxes(r.shape,o);return i.length>0&&(a=a.sum(i)),a.reshape(r.shape)}}})}var add=op({add_:add_}),addN=op({addN_:addN_}),addStrict=op({addStrict_:addStrict_}),atan2=op({atan2_:atan2_}),div=op({div_:div_}),divStrict=op({divStrict_:divStrict_}),floorDiv=op({floorDiv_:floorDiv_}),maximum=op({maximum_:maximum_}),maximumStrict=op({maximumStrict_:maximumStrict_}),minimum=op({minimum_:minimum_}),minimumStrict=op({minimumStrict_:minimumStrict_}),mod=op({mod_:mod_}),modStrict=op({modStrict_:modStrict_}),mul=op({mul_:mul_}),mulStrict=op({mulStrict_:mulStrict_}),pow=op({pow_:pow_}),powStrict=op({powStrict_:powStrict_}),squaredDifference=op({squaredDifference_:squaredDifference_}),squaredDifferenceStrict=op({squaredDifferenceStrict_:squaredDifferenceStrict_}),sub=op({sub_:sub_}),subStrict=op({subStrict_:subStrict_});function logicalNot_(e){var t=convertToTensor(e,"x","logicalNot","bool");return assert("bool"===t.dtype,"Error Array must be of type bool."),ENV.engine.runKernel(function(e){return e.logicalNot(t)},{$x:t})}function logicalAnd_(e,t){var n=convertToTensor(e,"a","logicalAnd","bool"),r=convertToTensor(t,"b","logicalAnd","bool");return assert("bool"===n.dtype&&"bool"===r.dtype,"Error Array must be of type bool."),assertAndGetBroadcastShape(n.shape,r.shape),ENV.engine.runKernel(function(e){return e.logicalAnd(n,r)},{$a:n,$b:r})}function logicalOr_(e,t){var n=convertToTensor(e,"a","logicalOr","bool"),r=convertToTensor(t,"b","logicalOr","bool");return assert("bool"===n.dtype&&"bool"===r.dtype,"Error Array must be of type bool."),assertAndGetBroadcastShape(n.shape,r.shape),ENV.engine.runKernel(function(e){return e.logicalOr(n,r)},{$a:n,$b:r})}function logicalXor_(e,t){var n=convertToTensor(e,"a","logicalXor","bool"),r=convertToTensor(t,"b","logicalXor","bool");return assert("bool"===n.dtype&&"bool"===r.dtype,"Error Array must be of type bool."),assertAndGetBroadcastShape(n.shape,r.shape),logicalOr(e,t).logicalAnd(logicalAnd(e,t).logicalNot())}function where_(e,t,n){var r=convertToTensor(t,"a","where"),o=convertToTensor(n,"b","where"),a=convertToTensor(e,"condition","where","bool");assert("bool"===a.dtype,"Error Condition must be of type bool."),assertShapesMatch(r.shape,o.shape,"Error in where: "),1===a.rank?assert(a.shape[0]===r.shape[0],"The first dimension of `a` must match the size of `condition`."):assertShapesMatch(a.shape,o.shape,"Error in where: ");return ENV.engine.runKernel(function(e){return e.select(a,r,o)},{$condition:a,$a:r,$b:o},function(e){return {$condition:function(){return zerosLike(a)},$a:function(){return e.mul(a.cast(r.dtype))},$b:function(){return e.mul(a.logicalNot().cast(o.dtype))}}})}function whereAsync_(e){return __awaiter(this,void 0,void 0,function(){var t,n,r;return __generator(this,function(o){switch(o.label){case 0:return assert("bool"===(t=convertToTensor(e,"condition","where","bool")).dtype,"Condition must be of type bool."),[4,t.data()];case 1:return n=o.sent(),r=whereImpl(t.shape,n),e!==t&&t.dispose(),[2,r]}})})}var logicalAnd=op({logicalAnd_:logicalAnd_}),logicalNot=op({logicalNot_:logicalNot_}),logicalOr=op({logicalOr_:logicalOr_}),logicalXor=op({logicalXor_:logicalXor_}),where=op({where_:where_}),whereAsync=whereAsync_;function relu_(e){var t=convertToTensor(e,"x","relu");if("bool"===t.dtype)return t.toInt();return ENV.engine.runKernel(function(e){return e.relu(t)},{$x:t},function(e){var n=t.step();return {$x:function(){return e.mulStrict(n.toFloat())}}})}function elu_(e){var t=convertToTensor(e,"x","elu");return ENV.engine.runKernel(function(e,n){return n(e.elu(t))},{$x:t},function(e,t){var n=t[0];return {$x:function(){return ENV.engine.runKernel(function(t){return t.eluDer(e,n)},{dy:e,y:n})}}})}function selu_(e){var t=convertToTensor(e,"x","selu");return ENV.engine.runKernel(function(e){return e.selu(t)},{$x:t},function(e){return {$x:function(){var n=t.greater(scalar(0)),r=scalar(SELU_SCALEALPHA),o=scalar(SELU_SCALE),a=e.mul(o),i=e.mul(r).mul(t.toFloat().exp());return where(n,a,i)}}})}function leakyRelu_(e,t){void 0===t&&(t=.2);var n=convertToTensor(e,"x","leakyRelu");return maximum(scalar(t).mul(n),n)}function prelu_(e,t){var n=convertToTensor(e,"x","prelu"),r=convertToTensor(t,"alpha","prelu"),o=scalar(0);return maximum(o,n).add(r.mul(minimum(o,n)))}var elu=op({elu_:elu_}),leakyRelu=op({leakyRelu_:leakyRelu_}),prelu=op({prelu_:prelu_}),relu=op({relu_:relu_}),selu=op({selu_:selu_});function transpose_(e,t){var n=convertToTensor(e,"x","transpose");if(null==t&&(t=n.shape.map(function(e,t){return t}).reverse()),assert(n.rank===t.length,"Error in transpose: rank of input "+n.rank+" must match length of perm "+t+"."),t.forEach(function(e){assert(e>=0&&eo)throw new Error("'k' passed to topk() must be <= the last dimension ("+o+") but got "+t);var a=ENV.engine.runKernel(function(e){return e.topk(r,t,n)},{$x:r});return {values:a[0],indices:a[1]}}var Reduction,topk=op({topk_:topk_});function computeWeightedLoss_(e,t,n){void 0===n&&(n=Reduction.SUM_BY_NONZERO_WEIGHTS);var r=convertToTensor(e,"losses","computeWeightedLoss"),o=null;null!=t&&(o=convertToTensor(t,"weights","computeWeightedLoss"));var a=null==o?r:r.mul(o);if(n===Reduction.NONE)return a;if(n===Reduction.SUM)return a.sum();if(n===Reduction.MEAN){if(null==o)return a.mean();var i=sizeFromShape(r.shape)/sizeFromShape(o.shape),s=a.sum().div(o.sum());return i>1?s.div(scalar(i)):s}if(n===Reduction.SUM_BY_NONZERO_WEIGHTS){if(null==o)return a.sum().div(scalar(r.size));var u=o.mul(ones$1(r.shape)).notEqual(scalar(0)).sum().toFloat();return a.sum().div(u)}throw Error("Unknown reduction: "+n)}function absoluteDifference_(e,t,n,r){void 0===r&&(r=Reduction.SUM_BY_NONZERO_WEIGHTS);var o=convertToTensor(e,"labels","absoluteDifference"),a=convertToTensor(t,"predictions","absoluteDifference"),i=null;null!=n&&(i=convertToTensor(n,"weights","absoluteDifference")),assertShapesMatch(o.shape,a.shape,"Error in absoluteDifference: ");var s=o.sub(a).abs();return computeWeightedLoss(s,i,r)}function meanSquaredError_(e,t,n,r){void 0===r&&(r=Reduction.SUM_BY_NONZERO_WEIGHTS);var o=convertToTensor(e,"labels","meanSquaredError"),a=convertToTensor(t,"predictions","meanSquaredError"),i=null;null!=n&&(i=convertToTensor(n,"weights","meanSquaredError")),assertShapesMatch(o.shape,a.shape,"Error in meanSquaredError: ");var s=o.squaredDifference(a);return computeWeightedLoss(s,i,r)}function cosineDistance_(e,t,n,r,o){void 0===o&&(o=Reduction.SUM_BY_NONZERO_WEIGHTS);var a=convertToTensor(e,"labels","cosineDistance"),i=convertToTensor(t,"predictions","cosineDistance"),s=null;null!=r&&(s=convertToTensor(r,"weights","cosineDistance")),assertShapesMatch(a.shape,i.shape,"Error in cosineDistance: ");var u=scalar(1).sub(a.mul(i).sum(n,!0));return computeWeightedLoss(u,s,o)}function hingeLoss_(e,t,n,r){void 0===r&&(r=Reduction.SUM_BY_NONZERO_WEIGHTS);var o=convertToTensor(e,"labels","hingeLoss"),a=convertToTensor(t,"predictions","hingeLoss"),i=null;null!=n&&(i=convertToTensor(n,"weights","hingeLoss")),assertShapesMatch(o.shape,a.shape,"Error in hingeLoss: ");var s=scalar(1);o=scalar(2).mul(o).sub(s);var u=s.sub(o.mul(a)).relu();return computeWeightedLoss(u,i,r)}function logLoss_(e,t,n,r,o){void 0===r&&(r=1e-7),void 0===o&&(o=Reduction.SUM_BY_NONZERO_WEIGHTS);var a=convertToTensor(e,"labels","logLoss"),i=convertToTensor(t,"predictions","logLoss"),s=null;null!=n&&(s=convertToTensor(n,"weights","logLoss")),assertShapesMatch(a.shape,i.shape,"Error in logLoss: ");var u=scalar(1),l=scalar(r),c=a.mul(i.add(l).log()).neg().sub(u.sub(a).mul(u.sub(i).add(l).log()));return computeWeightedLoss(c,s,o)}function sigmoidCrossEntropyWithLogits_(e,t){var n=convertToTensor(e,"labels","sigmoidCrossEntropyWithLogits"),r=convertToTensor(t,"logits","sigmoidCrossEntropyWithLogits");assertShapesMatch(n.shape,r.shape,"Error in sigmoidCrossEntropyWithLogits: ");var o=r.relu(),a=r.mul(n),i=r.abs().neg().exp().log1p();return o.sub(a).add(i)}function sigmoidCrossEntropy_(e,t,n,r,o){void 0===r&&(r=0),void 0===o&&(o=Reduction.SUM_BY_NONZERO_WEIGHTS);var a=convertToTensor(e,"multiClassLabels","sigmoidCrossEntropy"),i=convertToTensor(t,"logits","sigmoidCrossEntropy"),s=null;if(null!=n&&(s=convertToTensor(n,"weights","sigmoidCrossEntropy")),assertShapesMatch(a.shape,i.shape,"Error in sigmoidCrossEntropy: "),r>0){var u=scalar(r),l=scalar(1),c=scalar(.5);a=a.mul(l.sub(u)).add(c.mul(u));}var p=sigmoidCrossEntropyWithLogits_(a,i);return computeWeightedLoss(p,s,o)}function huberLoss_(e,t,n,r,o){void 0===r&&(r=1),void 0===o&&(o=Reduction.SUM_BY_NONZERO_WEIGHTS);var a=convertToTensor(e,"labels","huberLoss"),i=convertToTensor(t,"predictions","huberLoss"),s=null;null!=n&&(s=convertToTensor(n,"weights","huberLoss")),assertShapesMatch(a.shape,i.shape,"Error in huberLoss: ");var u=scalar(r),l=i.sub(a).abs(),c=minimum(l,u),p=l.sub(c),d=scalar(.5).mul(c.square()).add(u.mul(p));return computeWeightedLoss(d,s,o)}function softmaxCrossEntropyWithLogits_(e,t,n){if(void 0===n&&(n=-1),-1===n&&(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 customGrad(function(e,t){var r=t.logSumExp([n],!0),o=t.toFloat().sub(r);return {value:o.mul(e).neg().sum([n]),gradFunc:function(t){var r=expandShapeToKeepDim(t.shape,[n]);return [t.reshape(r).mul(e.toFloat().sub(o.exp())),t.reshape(r).mul(o.exp().sub(e.toFloat()))]}}})(e,t)}function softmaxCrossEntropy_(e,t,n,r,o){void 0===r&&(r=0),void 0===o&&(o=Reduction.SUM_BY_NONZERO_WEIGHTS);var a=convertToTensor(e,"onehotLabels","softmaxCrossEntropy"),i=convertToTensor(t,"logits","softmaxCrossEntropy"),s=null;if(null!=n&&(s=convertToTensor(n,"weights","softmaxCrossEntropy")),assertShapesMatch(a.shape,i.shape,"Error in softmaxCrossEntropy: "),r>0){var u=scalar(r),l=scalar(1),c=scalar(a.shape[1]);a=a.mul(l.sub(u)).add(u.div(c));}var p=softmaxCrossEntropyWithLogits_(a,i);return computeWeightedLoss(p,s,o)}!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";}(Reduction||(Reduction={}));var absoluteDifference=op({absoluteDifference_:absoluteDifference_}),computeWeightedLoss=op({computeWeightedLoss_:computeWeightedLoss_}),cosineDistance=op({cosineDistance_:cosineDistance_}),hingeLoss=op({hingeLoss_:hingeLoss_}),huberLoss=op({huberLoss_:huberLoss_}),logLoss=op({logLoss_:logLoss_}),meanSquaredError=op({meanSquaredError_:meanSquaredError_}),sigmoidCrossEntropy=op({sigmoidCrossEntropy_:sigmoidCrossEntropy_}),softmaxCrossEntropy=op({softmaxCrossEntropy_:softmaxCrossEntropy_}),loss_ops=Object.freeze({get Reduction(){return Reduction},absoluteDifference:absoluteDifference,computeWeightedLoss:computeWeightedLoss,cosineDistance:cosineDistance,hingeLoss:hingeLoss,huberLoss:huberLoss,logLoss:logLoss,meanSquaredError:meanSquaredError,sigmoidCrossEntropy:sigmoidCrossEntropy,softmaxCrossEntropy:softmaxCrossEntropy});function gramSchmidt_(e){var t;if(Array.isArray(e)){t=!1,assert(null!=e&&e.length>0,"Gram-Schmidt process: input must not be null, undefined, or empty");for(var n=e[0].shape[0],r=1;r0)for(var n=0;n= 2, but got rank "+e.rank);if(2===e.rank)return qr2d(e,t);var n=e.shape.slice(0,e.shape.length-2).reduce(function(e,t){return e*t}),r=[],o=[];return unstack(e.reshape([n,e.shape[e.shape.length-2],e.shape[e.shape.length-1]]),0).forEach(function(e){var n=qr2d(e,t),a=n[0],i=n[1];r.push(a),o.push(i);}),[stack(r,0).reshape(e.shape),stack(o,0).reshape(e.shape)]}function qr2d(e,t){return void 0===t&&(t=!1),ENV.engine.tidy(function(){if(2!==e.shape.length)throw new Error("qr2d() requires a 2D Tensor, but got a "+e.shape.length+"D Tensor.");for(var n=e.shape[0],r=e.shape[1],o=eye(n),a=e.clone(),i=tensor2d([[1]],[1,1]),s=i.clone(),u=n>=r?r:n,l=function(e){var t,u=a,l=s,c=o;t=ENV.engine.tidy(function(){var t=a.slice([e,e],[n-e,1]),u=t.norm(),l=a.slice([e,e],[1,1]),c=l.sign().neg(),p=l.sub(c.mul(u)),d=t.div(p);s=1===d.shape[0]?i.clone():i.concat(d.slice([1,0],[d.shape[0]-1,d.shape[1]]),0);var h=c.matMul(p).div(u).neg(),f=a.slice([e,0],[n-e,r]),m=h.mul(s);a=0===e?f.sub(m.matMul(s.transpose().matMul(f))):a.slice([0,0],[e,r]).concat(f.sub(m.matMul(s.transpose().matMul(f))),0);var g=o.slice([0,e],[n,o.shape[1]-e]);return o=0===e?g.sub(g.matMul(s).matMul(m.transpose())):o.slice([0,0],[n,e]).concat(g.sub(g.matMul(s).matMul(m.transpose())),1),[s,a,o]}),s=t[0],a=t[1],o=t[2],dispose([u,l,c]);},c=0;cr&&(o=o.slice([0,0],[n,r]),a=a.slice([0,0],[r,r])),[o,a]})}var gramSchmidt=op({gramSchmidt_:gramSchmidt_}),qr=op({qr_:qr_}),linalg_ops=Object.freeze({gramSchmidt:gramSchmidt,qr:qr});function resizeBilinear_(e,t,n){void 0===n&&(n=!1);var r=convertToTensor(e,"images","resizeBilinear");assert(3===r.rank||4===r.rank,"Error in resizeBilinear: x must be rank 3 or 4, but got rank "+r.rank+"."),assert(2===t.length,"Error in resizeBilinear: new shape must 2D, but got shape "+t+".");var o=r,a=!1;3===r.rank&&(a=!0,o=r.as4D(1,r.shape[0],r.shape[1],r.shape[2]));var i=t[0],s=t[1],u=ENV.engine.runKernel(function(e,t){return e.resizeBilinear(o,i,s,n)},{batchImages:o},function(e,t){return {batchImages:function(){return ENV.engine.runKernel(function(t){return t.resizeBilinearBackprop(e,o,n)},{})}}});return a?u.as3D(u.shape[1],u.shape[2],u.shape[3]):u}function resizeNearestNeighbor_(e,t,n){void 0===n&&(n=!1);var r=convertToTensor(e,"images","resizeNearestNeighbor");assert(3===r.rank||4===r.rank,"Error in resizeNearestNeighbor: x must be rank 3 or 4, but got rank "+r.rank+"."),assert(2===t.length,"Error in resizeNearestNeighbor: new shape must 2D, but got shape "+t+"."),assert("float32"===r.dtype||"int32"===r.dtype,"`images` must have `int32` or `float32` as dtype");var o=r,a=!1;3===r.rank&&(a=!0,o=r.as4D(1,r.shape[0],r.shape[1],r.shape[2]));var i=t[0],s=t[1],u=ENV.engine.runKernel(function(e,t){return e.resizeNearestNeighbor(o,i,s,n)},{batchImages:o},function(e,t){return {batchImages:function(){return ENV.engine.runKernel(function(t){return t.resizeNearestNeighborBackprop(e,o,n)},{})}}});return a?u.as3D(u.shape[1],u.shape[2],u.shape[3]):u}function nonMaxSuppression_(e,t,n,r,o){void 0===r&&(r=.5),void 0===o&&(o=Number.NEGATIVE_INFINITY);var a=convertToTensor(e,"boxes","nonMaxSuppression"),i=convertToTensor(t,"scores","nonMaxSuppression"),s=nonMaxSuppSanityCheck(a,i,n,r,o);return n=s.maxOutputSize,r=s.iouThreshold,o=s.scoreThreshold,ENV.engine.runKernel(function(e){return e.nonMaxSuppression(a,i,n,r,o)},{$boxes:a})}function nonMaxSuppressionAsync_(e,t,n,r,o){return void 0===r&&(r=.5),void 0===o&&(o=Number.NEGATIVE_INFINITY),__awaiter(this,void 0,void 0,function(){var a,i,s,u,l,c;return __generator(this,function(p){switch(p.label){case 0:return a=convertToTensor(e,"boxes","nonMaxSuppressionAsync"),i=convertToTensor(t,"scores","nonMaxSuppressionAsync"),s=nonMaxSuppSanityCheck(a,i,n,r,o),n=s.maxOutputSize,r=s.iouThreshold,o=s.scoreThreshold,[4,a.data()];case 1:return u=p.sent(),[4,i.data()];case 2:return l=p.sent(),c=nonMaxSuppressionImpl(u,l,n,r,o),a!==e&&a.dispose(),i!==t&&i.dispose(),[2,c]}})})}function nonMaxSuppSanityCheck(e,t,n,r,o){null==r&&(r=.5),null==o&&(o=Number.NEGATIVE_INFINITY);var a=e.shape[0];return n=Math.min(n,a),assert(0<=r&&r<=1,"iouThreshold must be in [0, 1], but was '"+r+"'"),assert(2===e.rank,"boxes must be a 2D tensor, but was of rank '"+e.rank+"'"),assert(4===e.shape[1],"boxes must have 4 columns, but 2nd dimension was "+e.shape[1]),assert(1===t.rank,"scores must be a 1D tensor"),assert(t.shape[0]===a,"scores has incompatible shape with boxes. Expected "+a+", but was "+t.shape[0]),{maxOutputSize:n,iouThreshold:r,scoreThreshold:o}}function cropAndResize_(e,t,n,r,o,a){var i=convertToTensor(e,"image","cropAndResize","float32"),s=convertToTensor(t,"boxes","cropAndResize","float32"),u=convertToTensor(n,"boxInd","cropAndResize","int32");o=o||"bilinear",a=a||0;var l=s.shape[0];assert(4===i.rank,"Error in cropAndResize: image must be rank 4,but got rank "+i.rank+"."),assert(2===s.rank&&4===s.shape[1],"Error in cropAndResize: boxes must be have size ["+l+",4] but had shape "+s.shape+"."),assert(1===u.rank&&u.shape[0]===l,"Error in cropAndResize: boxInd must be have size ["+l+"] but had shape "+s.shape+"."),assert("int32"===u.dtype,"Error in cropAndResize: boxInd must be of dtype int32, but got dtype "+u.dtype+"."),assert(2===r.length,"Error in cropAndResize: cropSize must be of length 2, but got length "+r.length+"."),assert(r[0]>=1&&r[1]>=1,"cropSize must be atleast [1,1], but was "+r),assert("bilinear"===o||"nearest"===o,"method must be bilinear or nearest, but was "+o);return ENV.engine.runKernel(function(e,t){return e.cropAndResize(i,s,u,r,o,a)},{$image:i,$boxes:s})}var resizeBilinear=op({resizeBilinear_:resizeBilinear_}),resizeNearestNeighbor=op({resizeNearestNeighbor_:resizeNearestNeighbor_}),nonMaxSuppression=op({nonMaxSuppression_:nonMaxSuppression_}),nonMaxSuppressionAsync=nonMaxSuppressionAsync_,cropAndResize=cropAndResize_,image_ops=Object.freeze({resizeBilinear:resizeBilinear,resizeNearestNeighbor:resizeNearestNeighbor,nonMaxSuppression:nonMaxSuppression,nonMaxSuppressionAsync:nonMaxSuppressionAsync,cropAndResize:cropAndResize}),ops=Object.freeze({image:image_ops,linalg:linalg_ops,losses:loss_ops,op:op,batchNormalization2d:batchNormalization2d,batchNormalization3d:batchNormalization3d,batchNormalization4d:batchNormalization4d,batchNormalization:batchNormalization,complex:complex,real:real,imag:imag,concat:concat,concat1d:concat1d,concat2d:concat2d,concat3d:concat3d,concat4d:concat4d,split:split$1,conv1d:conv1d,conv2d:conv2d,depthwiseConv2d:depthwiseConv2d,separableConv2d:separableConv2d,conv2dTranspose:conv2dTranspose,matMul:matMul,dot:dot,outerProduct:outerProduct,reverse:reverse,reverse1d:reverse1d,reverse2d:reverse2d,reverse3d:reverse3d,reverse4d:reverse4d,maxPool:maxPool,avgPool:avgPool,slice:slice,slice1d:slice1d,slice2d:slice2d,slice3d:slice3d,slice4d:slice4d,abs:abs,acos:acos,acosh:acosh,asin:asin,asinh:asinh,atan:atan,atanh:atanh,ceil:ceil,clipByValue:clipByValue,cos:cos,cosh:cosh,erf:erf,exp:exp,expm1:expm1,floor:floor,log:log$1,log1p:log1p,logSigmoid:logSigmoid,neg:neg,reciprocal:reciprocal,round:round,rsqrt:rsqrt,sigmoid:sigmoid,sign:sign,sin:sin,sinh:sinh,softplus:softplus,sqrt:sqrt,square:square,step:step,tan:tan,tanh:tanh$1,all:all,any:any,argMax:argMax,argMin:argMin,logSumExp:logSumExp,max:max,mean:mean,min:min,moments:moments,sum:sum,equal:equal,equalStrict:equalStrict,greater:greater,greaterEqual:greaterEqual,greaterEqualStrict:greaterEqualStrict,greaterStrict:greaterStrict,less:less,lessEqual:lessEqual,lessEqualStrict:lessEqualStrict,lessStrict:lessStrict,notEqual:notEqual,notEqualStrict:notEqualStrict,add:add,addN:addN,addStrict:addStrict,atan2:atan2,div:div,divStrict:divStrict,floorDiv:floorDiv,maximum:maximum,maximumStrict:maximumStrict,minimum:minimum,minimumStrict:minimumStrict,mod:mod,modStrict:modStrict,mul:mul,mulStrict:mulStrict,pow:pow,powStrict:powStrict,squaredDifference:squaredDifference,squaredDifferenceStrict:squaredDifferenceStrict,sub:sub,subStrict:subStrict,elu:elu,leakyRelu:leakyRelu,prelu:prelu,relu:relu,selu:selu,logicalAnd:logicalAnd,logicalNot:logicalNot,logicalOr:logicalOr,logicalXor:logicalXor,where:where,whereAsync:whereAsync,buffer:buffer,toPixels:toPixels,print:print,batchToSpaceND:batchToSpaceND,cast:cast,clone:clone,cumsum:cumsum,depthToSpace:depthToSpace,expandDims:expandDims,eye:eye,fromPixels:fromPixels,multinomial:multinomial,oneHot:oneHot,pad:pad,pad1d:pad1d,pad2d:pad2d,pad3d:pad3d,pad4d:pad4d,rand:rand,randomNormal:randomNormal,randomUniform:randomUniform,reshape:reshape,spaceToBatchND:spaceToBatchND,squeeze:squeeze,stack:stack,tile:tile,truncatedNormal:truncatedNormal,unstack:unstack,fill:fill,linspace:linspace,ones:ones$1,range:range,scalar:scalar,tensor:tensor,tensor1d:tensor1d,tensor2d:tensor2d,tensor3d:tensor3d,tensor4d:tensor4d,tensor5d:tensor5d,tensor6d:tensor6d,zeros:zeros,onesLike:onesLike,zerosLike:zerosLike,transpose:transpose,softmax:softmax,localResponseNormalization:localResponseNormalization,norm:norm,gather:gather,unsortedSegmentSum:unsortedSegmentSum,basicLSTMCell:basicLSTMCell,multiRNNCell:multiRNNCell,movingAverage:movingAverage,stridedSlice:stridedSlice,topk:topk}),MathBackendCPU=function(){function e(){this.blockSize=48,this.firstUse=!0,ENV.get("IS_BROWSER")&&(this.canvas=document.createElement("canvas"));}return e.prototype.setDataMover=function(e){this.data=new DataStorage(e);},e.prototype.register=function(e,t,n){if(this.firstUse&&(this.firstUse=!1,ENV.get("IS_NODE")&&warn("\n============================\nHi there 👋. 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.\n============================\n")),this.data.has(e))throw new Error("Data buffer is already registered");this.data.set(e,{dtype:n});},e.prototype.write=function(e,t){if(null==t)throw new Error("MathBackendCPU.write(): values can not be null");this.data.get(e).values=t;},e.prototype.fromPixels=function(e,t){if(null==e)throw new Error("pixels passed to tf.fromPixels() can not be null");var n,r;if(ENV.get("IS_NODE")&&null==e.getContext)throw new Error("When running in node, pixels must be an HTMLCanvasElement like the one returned by the `canvas` npm package");if(null!=e.getContext)n=e.getContext("2d").getImageData(0,0,e.width,e.height).data;else if(e instanceof ImageData)n=e.data;else{if(!(e instanceof HTMLImageElement||e instanceof HTMLVideoElement))throw new Error("pixels passed to tf.fromPixels() must be either an HTMLVideoElement, HTMLImageElement, HTMLCanvasElement or ImageData, but was "+e.constructor.name);if(null==this.canvas)throw new Error("Can't read pixels from HTMLImageElement outside the browser.");this.canvas.width=e.width,this.canvas.height=e.height,this.canvas.getContext("2d").drawImage(e,0,0,e.width,e.height),n=this.canvas.getContext("2d").getImageData(0,0,e.width,e.height).data;}if(4===t)r=new Int32Array(n);else{var o=e.width*e.height;r=new Int32Array(o*t);for(var a=0;ad&&(d=m,h=f);}u[c]=h;}return i},e.prototype.cumsum=function(e,t,n,r){if(this.assertNotComplex(e,"cumsum"),t!==e.rank-1)throw new Error("backend.cumsum in CPU expects an inner-most axis="+(e.rank-1)+" but got axis="+t);for(var o=upcastType(e.dtype,"int32"),a=zeros(e.shape,o),i=a.dataSync(),s=e.dataSync(),u=e.shape[e.rank-1],l=r?function(e,t){return e+u-t-1}:function(e,t){return e+t},c=0;ct?1:0})},e.prototype.greaterEqual=function(e,t){return this.assertNotComplex([e,t],"greaterEqual"),this.broadcastedBinaryOp(e,t,"bool",function(e,t){return e>=t?1:0})},e.prototype.logicalNot=function(e){this.assertNotComplex(e,"logicalNot");for(var t=e.dataSync(),n=new Int32Array(t.length),r=0;r1||1===t.rank?1:t.shape[1],c=0;c=0&&t>=0?n:(n+t)%t})},e.prototype.max=function(e,t){this.assertNotComplex(e,"max"),assertAxesAreInnerMostDims("max",t,e.rank);for(var n=computeOutAndReduceShapes(e.shape,t),r=n[0],o=n[1],a=zeros(r,e.dtype),i=sizeFromShape(o),s=a.dataSync(),u=e.dataSync(),l=0;lp&&(p=h);}s[l]=p;}return a},e.prototype.maximum=function(e,t){return this.assertNotComplex([e,t],"maximum"),this.broadcastedBinaryOp(e,t,e.dtype,function(e,t){return Math.max(e,t)})},e.prototype.all=function(e,t){this.assertNotComplex(e,"all"),assertAxesAreInnerMostDims("all",t,e.rank);for(var n=computeOutAndReduceShapes(e.shape,t),r=n[0],o=n[1],a=zeros(r,e.dtype),i=sizeFromShape(o),s=a.dataSync(),u=e.dataSync(),l=0;l0?n[r]=1:n[r]=0;return Tensor.make(e.shape,{values:n})},e.prototype.round=function(e){this.assertNotComplex(e,"round");for(var t=e.dataSync(),n=new Float32Array(t.length),r=0;r.5?n[r]=Math.ceil(t[r]):n[r]=o%2==0?o:o+1;}return Tensor.make(e.shape,{values:n})},e.prototype.exp=function(e){this.assertNotComplex(e,"exp");for(var t=e.dataSync(),n=new Float32Array(t.length),r=0;r=0?o:Math.exp(o)-1;}return Tensor.make(e.shape,{values:t})},e.prototype.eluDer=function(e,t){this.assertNotComplex([e,t],"eluDer");for(var n=new Float32Array(t.size),r=t.dataSync(),o=e.dataSync(),a=0;a=1?o[a]:o[a]*(i+1);}return Tensor.make(t.shape,{values:n})},e.prototype.selu=function(e){this.assertNotComplex(e,"selu");for(var t=SELU_SCALEALPHA,n=SELU_SCALE,r=new Float32Array(e.size),o=e.dataSync(),a=0;a=0?n*i:t*(Math.exp(i)-1);}return Tensor.make(e.shape,{values:r})},e.prototype.clip=function(e,t,n){this.assertNotComplex(e,"clip");for(var r=new Float32Array(e.size),o=e.dataSync(),a=0;an?n:i-t,i=r[o]0?1:t;}return Tensor.make(e.shape,{values:n})},e.prototype.conv2d=function(e,t,n){this.assertNotComplex([e,t],"conv2d");for(var r=n.filterHeight,o=n.filterWidth,a=n.dilationHeight,i=n.dilationWidth,s=n.padInfo.left,u=n.padInfo.top,l=buffer(n.outShape,e.dtype),c=e.dataSync(),p=t.dataSync(),d=l.values,h=0;h=n.inHeight))for(var b=x*t.strides[0],S=f+T*e.strides[1],E=0;E=n.inWidth))for(var R=b+C*t.strides[1],N=S+_*n.inChannels,k=R,I=0;I=n.inHeight))for(var S=T*t.strides[0],E=m+b*e.strides[1],w=0;w=n.inWidth))for(var N=S+_*t.strides[1],k=E+R*n.inChannels,I=A,D=N,M=0;Mb?b=C:"avg"===n&&(S+=C,E++);}if(isNaN(b))break}s.set("avg"===n?S/E:b,p,h,v,d);}return s.toTensor()},e.prototype.maxPool=function(e,t){return this.pool(e,t,"max")},e.prototype.maxPoolPositions=function(e,t){for(var n=buffer(t.outShape,"int32"),r=t.strideHeight,o=t.strideWidth,a=t.filterHeight,i=t.filterWidth,s=t.padInfo.top,u=t.padInfo.left,l=0;lx&&(x=A,T=S*i+w);}n.set(T,l,p,m,c);}return n.toTensor()},e.prototype.maxPoolBackprop=function(e,t,n,r){this.assertNotComplex([t,n],"maxPoolBackprop");for(var o=this.maxPoolPositions(t,r),a=r.strideHeight,i=r.strideWidth,s=r.filterHeight,u=r.filterWidth,l=u-1-r.padInfo.left,c=s-1-r.padInfo.top,p=buffer(t.shape,"float32"),d=0;d=r.outHeight||Math.floor(T)!==T))for(var b=0;b=r.outWidth||Math.floor(S)!==S)){var E=s*u-1-o.get(d,T,S,h)===x*u+b?1:0;if(0!==E)y+=e.get(d,T,S,h)*E;}}}p.set(y,d,f,m,h);}return p.toTensor()},e.prototype.avgPoolBackprop=function(e,t,n){this.assertNotComplex([e,t],"avgPoolBackprop");for(var r=n.strideHeight,o=n.strideWidth,a=n.filterHeight,i=n.filterWidth,s=i-1-n.padInfo.left,u=a-1-n.padInfo.top,l=buffer(t.shape,"float32"),c=1/(a*i),p=0;p=n.outHeight||Math.floor(x)!==x))for(var T=0;T=n.outWidth||Math.floor(b)!==b))v+=e.get(p,x,b,d);}}l.set(v*c,p,h,f,d);}return l.toTensor()},e.prototype.cast=function(e,t){return castTensor(e,t,this)},e.prototype.reshape=function(e,t){return reshapeTensor(e,t)},e.prototype.avgPool=function(e,t){return this.assertNotComplex(e,"avgPool"),this.pool(e,t,"avg").toFloat()},e.prototype.resizeBilinear=function(e,t,n,r){this.assertNotComplex(e,"resizeBilinear");for(var o=e.shape,a=o[0],i=o[1],s=o[2],u=o[3],l=buffer([a,t,n,u],e.dtype),c=[r&&t>1?i-1:i,r&&n>1?s-1:s],p=[r&&t>1?t-1:t,r&&n>1?n-1:n],d=0;d1?a-1:a,n&&c>1?i-1:i],h=[n&&l>1?l-1:l,n&&c>1?c-1:c],f=d[0]/h[0],m=d[1]/h[1],g=0;g1?i-1:i,r&&n>1?s-1:s],p=[r&&t>1?t-1:t,r&&n>1?n-1:n],d=0;d1?a-1:a,n&&c>1?i-1:i],h=[n&&l>1?l-1:l,n&&c>1?c-1:c],f=1/(d[0]/h[0]),m=1/(d[1]/h[1]),g=2*Math.ceil(f)+2,v=2*Math.ceil(m)+2,y=0;y=l))for(var N=0;N=c)){var I=d[0]*(R/h[0]),D=d[1]*(k/h[1]),M=Math.min(a-1,n?Math.round(I):Math.floor(I)),O=Math.min(i-1,n?Math.round(D):Math.floor(D));x===M&&T===O&&(C+=e.get(y,R,k,A));}}}p.set(C,y,x,T,A);}return p.toTensor()},e.prototype.batchNormalization=function(e,t,n,r,o,a){this.assertNotComplex([e,t,n,o,a],"batchNormalization");for(var i=e.dataSync(),s=t.dataSync(),u=n.dataSync(),l=o?o.dataSync():new Float32Array([1]),c=a?a.dataSync():new Float32Array([0]),p=new Float32Array(i.length),d=c.length,h=l.length,f=u.length,m=s.length,g=0,v=0,y=0,x=0,T=0;T=d&&(g=0),v>=m&&(v=0),y>=h&&(y=0),x>=f&&(x=0);return tensor4d(p,e.shape)},e.prototype.localResponseNormalization4D=function(e,t,n,r,o){this.assertNotComplex(e,"localResponseNormalization4D");var a=e.shape[3],i=a-1,s=e.dataSync(),u=sizeFromShape(e.shape),l=new Float32Array(u);function c(e){for(var n=e%a,r=e-n+Math.max(0,n-t),o=e-n+Math.min(n+t,i),u=0;r<=o;r++){var l=s[r];u+=l*l;}return u}for(var p=0;p=0&&e.get(a)1,"blockSize should be > 1 for depthToSpace, but was: "+t);for(var r=e.shape[0],o=e.shape[1],a=e.shape[2],i=e.shape[3],s=o*t,u=a*t,l=i/(t*t),c=e.dataSync(),p=new Float32Array(r*s*u*l),d=0,h=0;h=s))for(var _=d>1?(w-S)*(u-1)/(d-1):0,R=h>1?(A-E)*(l-1)/(h-1):0,N=0;N1?S*(u-1)+N*_:.5*(S+w)*(u-1);if(k<0||k>u-1)for(var I=0;I1?E*(l-1)+I*R:.5*(E+A)*(l-1))<0||q>l-1)for(D=0;D1?E*(l-1)+I*R:.5*(E+A)*(l-1))<0||q>l-1)for(D=0;D0,"scheme must not be an empty string.");var r=e.getInstance();assert(null==r.managers[t],"A model store manager is already registered for scheme '"+t+"'."),r.managers[t]=n;},e.getManager=function(e){var t=this.getInstance().managers[e];if(null==t)throw new Error("Cannot find model manager for scheme '"+e+"'");return t},e.getSchemes=function(){return Object.keys(this.getInstance().managers)},e}();function parseURL(e){if(-1===e.indexOf(URL_SCHEME_SUFFIX))throw new Error("The url string provided does not contain a scheme. Supported schemes are: "+ModelStoreManagerRegistry.getSchemes().join(","));return {scheme:e.split(URL_SCHEME_SUFFIX)[0],path:e.split(URL_SCHEME_SUFFIX)[1]}}function cloneModelInternal(e,t,n){return void 0===n&&(n=!1),__awaiter(this,void 0,void 0,function(){var r,o,a,i,s,u,l,c,p;return __generator(this,function(d){switch(d.label){case 0:return assert(e!==t,"Old path and new path are the same: '"+e+"'"),assert((r=IORouterRegistry.getLoadHandlers(e)).length>0,"Copying failed because no load handler is found for source URL "+e+"."),assert(r.length<2,"Copying failed because more than one ("+r.length+") load handlers for source URL "+e+"."),o=r[0],assert((a=IORouterRegistry.getSaveHandlers(t)).length>0,"Copying failed because no save handler is found for destination URL "+t+"."),assert(a.length<2,"Copying failed because more than one ("+r.length+") save handlers for destination URL "+t+"."),i=a[0],s=parseURL(e).scheme,u=parseURL(e).path,l=s===parseURL(e).scheme,[4,o.load()];case 1:return c=d.sent(),n&&l?[4,ModelStoreManagerRegistry.getManager(s).removeModel(u)]:[3,3];case 2:d.sent(),d.label=3;case 3:return [4,i.save(c)];case 4:return p=d.sent(),!n||l?[3,6]:[4,ModelStoreManagerRegistry.getManager(s).removeModel(u)];case 5:d.sent(),d.label=6;case 6:return [2,p.modelArtifactsInfo]}})})}function listModels(){return __awaiter(this,void 0,void 0,function(){var e,t,n,r,o,a,i;return __generator(this,function(s){switch(s.label){case 0:e=ModelStoreManagerRegistry.getSchemes(),t={},n=0,r=e,s.label=1;case 1:return n0,"URL path for browserHTTPRequest must not be null, undefined or empty."),Array.isArray(e)&&assert(2===e.length,"URL paths for browserHTTPRequest must have a length of 2, (actual length is "+e.length+")."),this.path=e,null!=t&&null!=t.body)throw new Error("requestInit is expected to have no pre-existing body, but has one.");this.requestInit=t||{};}return e.prototype.save=function(e){return __awaiter(this,void 0,void 0,function(){var t,n,r,o;return __generator(this,function(a){switch(a.label){case 0:if(e.modelTopology instanceof ArrayBuffer)throw new Error("BrowserHTTPRequest.save() does not support saving model topology in binary formats yet.");return (t=Object.assign({method:this.DEFAULT_METHOD},this.requestInit)).body=new FormData,n=[{paths:["./model.weights.bin"],weights:e.weightSpecs}],r={modelTopology:e.modelTopology,weightsManifest:n},t.body.append("model.json",new Blob([JSON.stringify(r)],{type:"application/json"}),"model.json"),null!=e.weightData&&t.body.append("model.weights.bin",new Blob([e.weightData],{type:"application/octet-stream"}),"model.weights.bin"),[4,fetch(this.path,t)];case 1:if(200===(o=a.sent()).status)return [2,{modelArtifactsInfo:getModelArtifactsInfoForJSON(e),responses:[o]}];throw new Error("BrowserHTTPRequest.save() failed due to HTTP response status "+o.status+".")}})})},e.prototype.load=function(){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(e){return [2,Array.isArray(this.path)?this.loadBinaryModel():this.loadJSONModel()]})})},e.prototype.loadBinaryTopology=function(){return __awaiter(this,void 0,void 0,function(){var e;return __generator(this,function(t){switch(t.label){case 0:return t.trys.push([0,3,,4]),[4,fetch(this.path[0],this.requestInit)];case 1:return [4,t.sent().arrayBuffer()];case 2:return [2,t.sent()];case 3:throw e=t.sent(),new Error(this.path[0]+" not found. "+e);case 4:return [2]}})})},e.prototype.loadBinaryModel=function(){return __awaiter(this,void 0,void 0,function(){var e,t,n,r,o,a,i,s;return __generator(this,function(u){switch(u.label){case 0:return e=this.loadBinaryTopology(),[4,fetch(this.path[1],this.requestInit)];case 1:return t=u.sent(),[4,Promise.all([e,t])];case 2:return n=u.sent(),r=n[0],[4,n[1].json()];case 3:return null==(o=u.sent())?[3,5]:[4,this.loadWeights(o)];case 4:s=u.sent(),a=s[0],i=s[1],u.label=5;case 5:return [2,{modelTopology:r,weightSpecs:a,weightData:i}]}})})},e.prototype.loadJSONModel=function(){return __awaiter(this,void 0,void 0,function(){var e,t,n,r,o,a,i;return __generator(this,function(s){switch(s.label){case 0:return [4,fetch(this.path,this.requestInit)];case 1:return [4,s.sent().json()];case 2:if(e=s.sent(),t=e.modelTopology,n=e.weightsManifest,null==t&&null==n)throw new Error("The JSON from HTTP path "+this.path+" contains neither model topology or manifest for weights.");return null==n?[3,4]:(a=e.weightsManifest,[4,this.loadWeights(a)]);case 3:i=s.sent(),r=i[0],o=i[1],s.label=4;case 4:return [2,{modelTopology:t,weightSpecs:r,weightData:o}]}})})},e.prototype.loadWeights=function(e){return __awaiter(this,void 0,void 0,function(){var t,n,r,o,a,i,s,u,l;return __generator(this,function(c){switch(c.label){case 0:for(t=Array.isArray(this.path)?this.path[1]:this.path,n=[],r=0,o=e;r0&&(e=__assign({weightSpecs:this.weightSpecs},e)),null!=this.weightData&&this.weightData.byteLength>0&&(e=__assign({weightData:this.weightData},e)),[2,e]})})},e}(),PassthroughSaver=function(){function e(e){this.saveHandler=e;}return e.prototype.save=function(e){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(t){return [2,this.saveHandler(e)]})})},e}();function fromMemory(e,t,n){return new PassthroughLoader(e,t,n)}function withSaveHandler(e){return new PassthroughSaver(e)}var registerSaveRouter=IORouterRegistry.registerSaveRouter,registerLoadRouter=IORouterRegistry.registerLoadRouter,getSaveHandlers=IORouterRegistry.getSaveHandlers,getLoadHandlers=IORouterRegistry.getLoadHandlers,io=Object.freeze({browserFiles:browserFiles,browserHTTPRequest:browserHTTPRequest,concatenateArrayBuffers:concatenateArrayBuffers,decodeWeights:decodeWeights,encodeWeights:encodeWeights,fromMemory:fromMemory,getLoadHandlers:getLoadHandlers,getModelArtifactsInfoForJSON:getModelArtifactsInfoForJSON,getSaveHandlers:getSaveHandlers,loadWeights:loadWeights,registerLoadRouter:registerLoadRouter,registerSaveRouter:registerSaveRouter,withSaveHandler:withSaveHandler,copyModel:copyModel,listModels:listModels,moveModel:moveModel,removeModel:removeModel}),Serializable=function(){function e(){}return e.prototype.getClassName=function(){return this.constructor.className},e.fromConfig=function(e,t){return new e(t)},e}(),SerializationMap=function(){function e(){this.classNameMap={};}return e.getMap=function(){return null==e.instance&&(e.instance=new e),e.instance},e.register=function(t){e.getMap().classNameMap[t.className]=[t,t.fromConfig];},e}();function registerClass(e){assert(null!=e.className,"Class being registered does not have the static className property defined."),assert("string"==typeof e.className,"className is required to be a string, but got type "+typeof e.className),assert(e.className.length>0,"Class being registered has an empty-string as its className, which is disallowed."),SerializationMap.register(e);}var serialization=Object.freeze({Serializable:Serializable,SerializationMap:SerializationMap,registerClass:registerClass}),WEBGL_ENVS={HAS_WEBGL:!0},NODE_ENVS={IS_NODE:!0},CHROME_ENVS={IS_CHROME:!0},BROWSER_ENVS={IS_BROWSER:!0},CPU_ENVS={HAS_WEBGL:!1},ALL_ENVS={};function expectArraysClose(e,t,n){if(null==n&&(n=ENV.get("TEST_EPSILON")),e instanceof Tensor||t instanceof Tensor){if(e instanceof Tensor&&t instanceof Tensor){if(e.dtype!==t.dtype)throw new Error("Arrays are of different type actual: "+e.dtype+" vs expected: "+t.dtype+".");if(!arraysEqual(e.shape,t.shape))throw new Error("Arrays are of different shape actual: "+e.shape+" vs expected: "+t.shape+".")}}else{var r=e.constructor.name,o=t.constructor.name;if(r!==o)throw new Error("Arrays are of different type actual: "+r+" vs expected: "+o)}var a,i;if(a=e instanceof Tensor?e.dataSync():e,i=t instanceof Tensor?t.dataSync():t,a.length!==i.length)throw new Error("Arrays have different lengths actual: "+a.length+" vs expected: "+i.length+".\nActual: "+a+".\nExpected: "+i+".");for(var s=0;sn)}function expectValuesInRange(e,t,n){var r;r=e instanceof Tensor?e.dataSync():e;for(var o=0;on)throw new Error("Value out of range:"+r[o]+" low: "+t+", high: "+n)}function expectArrayBuffersEqual(e,t){expect(new Float32Array(e)).toEqual(new Float32Array(t));}var test_util=Object.freeze({WEBGL_ENVS:WEBGL_ENVS,NODE_ENVS:NODE_ENVS,CHROME_ENVS:CHROME_ENVS,BROWSER_ENVS:BROWSER_ENVS,CPU_ENVS:CPU_ENVS,ALL_ENVS:ALL_ENVS,expectArraysClose:expectArraysClose,expectPromiseToFail:expectPromiseToFail,expectArraysEqual:expectArraysEqual,expectNumbersClose:expectNumbersClose,expectValuesInRange:expectValuesInRange,expectArrayBuffersEqual:expectArrayBuffersEqual}),version="0.13.2",webgl=Object.freeze({gpgpu_util:gpgpu_util,webgl_util:webgl_util,MathBackendWebGL:MathBackendWebGL,GPGPUContext:GPGPUContext}),Optimizer=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return __extends(t,e),t.prototype.minimize=function(e,t,n){void 0===t&&(t=!1);var r=this.computeGradients(e,n),o=r.value,a=r.grads;return this.applyGradients(a),Object.keys(a).forEach(function(e){return a[e].dispose()}),t?o:(o.dispose(),null)},t.prototype.computeGradients=function(e,t){return variableGrads(e,t)},t}(Serializable),AdadeltaOptimizer=function(e){function t(t,n,r){void 0===r&&(r=null);var o=e.call(this)||this;return o.learningRate=t,o.rho=n,o.epsilon=r,o.accumulatedGrads={},o.accumulatedUpdates={},o.c=keep(scalar(-t)),o.rhoScalar=keep(scalar(n)),o.oneMinusRho=keep(scalar(1-n)),null===r&&(r=ENV.get("EPSILON")),o.epsilonScalar=keep(scalar(r)),o}return __extends(t,e),t.prototype.applyGradients=function(e){var t=this,n=function(n){var o=ENV.engine.registeredVariables[n];if(null==r.accumulatedGrads[n]){tidy(function(){t.accumulatedGrads[n]=zerosLike(o).variable(!1);});}if(null==r.accumulatedUpdates[n]){tidy(function(){t.accumulatedUpdates[n]=zerosLike(o).variable(!1);});}var a=e[n],i=r.accumulatedGrads[n],s=r.accumulatedUpdates[n];tidy(function(){var e=t.rhoScalar.mul(i).add(t.oneMinusRho.mul(a.square())),r=s.add(t.epsilonScalar).sqrt().div(i.add(t.epsilonScalar).sqrt()).mul(a),u=t.rhoScalar.mul(s).add(t.oneMinusRho.mul(r.square()));t.accumulatedGrads[n].assign(e),t.accumulatedUpdates[n].assign(u);var l=t.c.mul(r).add(o);o.assign(l);});},r=this;for(var o in e)n(o);},t.prototype.dispose=function(){var e=this;this.c.dispose(),this.epsilonScalar.dispose(),this.rhoScalar.dispose(),this.oneMinusRho.dispose(),null!=this.accumulatedUpdates&&(Object.keys(this.accumulatedUpdates).forEach(function(t){return e.accumulatedUpdates[t].dispose()}),Object.keys(this.accumulatedGrads).forEach(function(t){return e.accumulatedGrads[t].dispose()}));},t.prototype.getConfig=function(){return {learningRate:this.learningRate,rho:this.rho,epsilon:this.epsilon}},t.fromConfig=function(e,t){return new e(t.learningRate,t.rho,t.epsilon)},t.className="AdadeltaOptimizer",t}(Optimizer);registerClass(AdadeltaOptimizer);var AdagradOptimizer=function(e){function t(t,n){void 0===n&&(n=.1);var r=e.call(this)||this;return r.learningRate=t,r.initialAccumulatorValue=n,r.accumulatedGrads={},r.c=keep(scalar(-t)),r.epsilon=keep(scalar(ENV.get("EPSILON"))),r}return __extends(t,e),t.prototype.applyGradients=function(e){var t=this,n=function(n){var o=ENV.engine.registeredVariables[n];if(null==r.accumulatedGrads[n]){tidy(function(){t.accumulatedGrads[n]=fill(o.shape,t.initialAccumulatorValue).variable(!1);});}var a=e[n],i=r.accumulatedGrads[n];tidy(function(){var e=i.add(a.square());t.accumulatedGrads[n].assign(e);var r=t.c.mul(a.div(e.add(t.epsilon).sqrt())).add(o);o.assign(r);});},r=this;for(var o in e)n(o);},t.prototype.dispose=function(){var e=this;this.epsilon.dispose(),this.c.dispose(),null!=this.accumulatedGrads&&Object.keys(this.accumulatedGrads).forEach(function(t){return e.accumulatedGrads[t].dispose()});},t.prototype.getConfig=function(){return {learningRate:this.learningRate,initialAccumulatorValue:this.initialAccumulatorValue}},t.fromConfig=function(e,t){return new e(t.learningRate,t.initialAccumulatorValue)},t.className="AdagradOptimizer",t}(Optimizer);registerClass(AdagradOptimizer);var AdamOptimizer=function(e){function t(t,n,r,o){void 0===o&&(o=null);var a=e.call(this)||this;return a.learningRate=t,a.beta1=n,a.beta2=r,a.epsilon=o,a.accumulatedFirstMoment={},a.accumulatedSecondMoment={},a.c=keep(scalar(-t)),a.beta1Scalar=keep(scalar(n)),a.beta2Scalar=keep(scalar(r)),tidy(function(){a.accBeta1=scalar(n).variable(),a.accBeta2=scalar(r).variable();}),a.oneMinusBeta1=keep(scalar(1-n)),a.oneMinusBeta2=keep(scalar(1-r)),a.one=keep(scalar(1)),null===o&&(o=ENV.get("EPSILON")),a.epsScalar=keep(scalar(o)),a}return __extends(t,e),t.prototype.applyGradients=function(e){var t=this;tidy(function(){var n=t.one.sub(t.accBeta1),r=t.one.sub(t.accBeta2);for(var o in e){var a=ENV.engine.registeredVariables[o];if(null==t.accumulatedFirstMoment[o]){var i=!1;t.accumulatedFirstMoment[o]=zerosLike(a).variable(i);}if(null==t.accumulatedSecondMoment[o]){i=!1;t.accumulatedSecondMoment[o]=zerosLike(a).variable(i);}var s=e[o],u=t.accumulatedFirstMoment[o],l=t.accumulatedSecondMoment[o],c=t.beta1Scalar.mul(u).add(t.oneMinusBeta1.mul(s)),p=t.beta2Scalar.mul(l).add(t.oneMinusBeta2.mul(s.square())),d=c.div(n),h=p.div(r);t.accumulatedFirstMoment[o].assign(c),t.accumulatedSecondMoment[o].assign(p);var f=t.c.mul(d.div(t.epsScalar.add(h.sqrt()))).add(a);a.assign(f);}t.accBeta1.assign(t.accBeta1.mul(t.beta1Scalar)),t.accBeta2.assign(t.accBeta2.mul(t.beta2Scalar));});},t.prototype.dispose=function(){var e=this;this.c.dispose(),this.epsScalar.dispose(),this.beta1Scalar.dispose(),this.beta2Scalar.dispose(),this.accBeta1.dispose(),this.accBeta2.dispose(),this.oneMinusBeta1.dispose(),this.oneMinusBeta2.dispose(),this.one.dispose(),null!=this.accumulatedFirstMoment&&Object.keys(this.accumulatedFirstMoment).forEach(function(t){return e.accumulatedFirstMoment[t].dispose()}),null!=this.accumulatedSecondMoment&&Object.keys(this.accumulatedSecondMoment).forEach(function(t){return e.accumulatedSecondMoment[t].dispose()});},t.prototype.getConfig=function(){return {learningRate:this.learningRate,beta1:this.beta1,beta2:this.beta2,epsilon:this.epsilon}},t.fromConfig=function(e,t){return new e(t.learningRate,t.beta1,t.beta2,t.epsilon)},t.className="AdamOptimizer",t}(Optimizer);registerClass(AdamOptimizer);var AdamaxOptimizer=function(e){function t(t,n,r,o,a){void 0===o&&(o=null),void 0===a&&(a=0);var i=e.call(this)||this;return i.learningRate=t,i.beta1=n,i.beta2=r,i.epsilon=o,i.decay=a,i.accumulatedFirstMoment={},i.accumulatedWeightedInfNorm={},i.c=keep(scalar(-t)),i.beta1Scalar=keep(scalar(n)),i.beta2Scalar=keep(scalar(r)),i.decayScalar=keep(scalar(a)),tidy(function(){i.iteration=scalar(0).variable(),i.accBeta1=scalar(n).variable();}),i.oneMinusBeta1=keep(scalar(1-n)),i.one=keep(scalar(1)),null===o&&(o=ENV.get("EPSILON")),i.epsScalar=keep(scalar(o)),i}return __extends(t,e),t.prototype.applyGradients=function(e){var t=this;tidy(function(){var n=t.one.sub(t.accBeta1),r=t.c.div(t.one.add(t.decayScalar.mul(t.iteration)));for(var o in e){var a=ENV.engine.registeredVariables[o];if(null==t.accumulatedFirstMoment[o]){var i=!1;t.accumulatedFirstMoment[o]=zerosLike(a).variable(i);}if(null==t.accumulatedWeightedInfNorm[o]){i=!1;t.accumulatedWeightedInfNorm[o]=zerosLike(a).variable(i);}var s=e[o],u=t.accumulatedFirstMoment[o],l=t.accumulatedWeightedInfNorm[o],c=t.beta1Scalar.mul(u).add(t.oneMinusBeta1.mul(s)),p=t.beta2Scalar.mul(l),d=s.abs(),h=p.maximum(d);t.accumulatedFirstMoment[o].assign(c),t.accumulatedWeightedInfNorm[o].assign(h);var f=r.div(n).mul(c.div(t.epsScalar.add(h))).add(a);a.assign(f);}t.iteration.assign(t.iteration.add(t.one)),t.accBeta1.assign(t.accBeta1.mul(t.beta1Scalar));});},t.prototype.dispose=function(){var e=this;this.c.dispose(),this.epsScalar.dispose(),this.accBeta1.dispose(),this.beta1Scalar.dispose(),this.beta2Scalar.dispose(),this.oneMinusBeta1.dispose(),this.decayScalar.dispose(),this.iteration.dispose(),this.one.dispose(),null!=this.accumulatedFirstMoment&&Object.keys(this.accumulatedFirstMoment).forEach(function(t){return e.accumulatedFirstMoment[t].dispose()}),null!=this.accumulatedWeightedInfNorm&&Object.keys(this.accumulatedWeightedInfNorm).forEach(function(t){return e.accumulatedWeightedInfNorm[t].dispose()});},t.prototype.getConfig=function(){return {learningRate:this.learningRate,beta1:this.beta1,beta2:this.beta2,epsilon:this.epsilon,decay:this.decay}},t.fromConfig=function(e,t){return new e(t.learningRate,t.beta1,t.beta2,t.epsilon,t.decay)},t.className="AdamaxOptimizer",t}(Optimizer);registerClass(AdamaxOptimizer);var SGDOptimizer=function(e){function t(t){var n=e.call(this)||this;return n.learningRate=t,n.setLearningRate(t),n}return __extends(t,e),t.prototype.applyGradients=function(e){var t=this;Object.keys(e).forEach(function(n){var r=e[n],o=ENV.engine.registeredVariables[n];tidy(function(){var e=t.c.mul(r).add(o);o.assign(e);});});},t.prototype.setLearningRate=function(e){this.learningRate=e,null!=this.c&&this.c.dispose(),this.c=keep(scalar(-e));},t.prototype.dispose=function(){this.c.dispose();},t.prototype.getConfig=function(){return {learningRate:this.learningRate}},t.fromConfig=function(e,t){return new e(t.learningRate)},t.className="SGDOptimizer",t}(Optimizer);registerClass(SGDOptimizer);var MomentumOptimizer=function(e){function t(t,n,r){void 0===r&&(r=!1);var o=e.call(this,t)||this;return o.learningRate=t,o.momentum=n,o.useNesterov=r,o.m=scalar(o.momentum),o.accumulations={},o}return __extends(t,e),t.prototype.applyGradients=function(e){var t=this,n=function(n){var o=ENV.engine.registeredVariables[n];if(null==r.accumulations[n]){tidy(function(){t.accumulations[n]=zerosLike(o).variable(!1);});}var a=r.accumulations[n],i=e[n];tidy(function(){var e,r=t.m.mul(a).add(i);e=t.useNesterov?t.c.mul(i.add(r.mul(t.m))).add(o):t.c.mul(r).add(o),t.accumulations[n].assign(r),o.assign(e);});},r=this;for(var o in e)n(o);},t.prototype.dispose=function(){if(e.prototype.dispose.call(this),this.m.dispose(),null!=this.accumulations)for(var t in this.accumulations)this.accumulations[t].dispose();},t.prototype.setMomentum=function(e){this.momentum=e;},t.prototype.getConfig=function(){return {learningRate:this.learningRate,momentum:this.momentum,useNesterov:this.useNesterov}},t.fromConfig=function(e,t){return new e(t.learningRate,t.momentum,t.useNesterov)},t.className="MomentumOptimizer",t}(SGDOptimizer);registerClass(MomentumOptimizer);var RMSPropOptimizer=function(e){function t(t,n,r,o,a){void 0===n&&(n=.9),void 0===r&&(r=0),void 0===o&&(o=null),void 0===a&&(a=!1);var i=e.call(this)||this;return i.learningRate=t,i.decay=n,i.momentum=r,i.epsilon=o,i.accumulatedMeanSquares={},i.accumulatedMeanGrads={},i.accumulatedMoments={},i.c=keep(scalar(t)),i.decayScalar=keep(scalar(n)),i.momentumScalar=keep(scalar(r)),i.oneMinusDecay=keep(scalar(1-n)),i.centered=a,null===o&&(o=ENV.get("EPSILON")),i.epsilonScalar=keep(scalar(o)),i}return __extends(t,e),t.prototype.applyGradients=function(e){var t=this,n=function(n){var o=ENV.engine.registeredVariables[n];if(null==r.accumulatedMeanSquares[n]){tidy(function(){t.accumulatedMeanSquares[n]=zerosLike(o).variable(!1);});}if(null==r.accumulatedMeanGrads[n]&&r.centered){tidy(function(){t.accumulatedMeanGrads[n]=zerosLike(o).variable(!1);});}if(null==r.accumulatedMoments[n]){tidy(function(){t.accumulatedMoments[n]=zerosLike(o).variable(!1);});}var a=r.accumulatedMeanSquares[n],i=r.accumulatedMeanGrads[n],s=r.accumulatedMoments[n],u=e[n];tidy(function(){var e=t.decayScalar.mul(a).add(t.oneMinusDecay.mul(u.square()));if(t.centered){var r=t.decayScalar.mul(i).add(t.oneMinusDecay.mul(u)),l=t.momentumScalar.mul(s).add(t.c.mul(u).div(e.sub(r.square().add(t.epsilonScalar)).sqrt()));t.accumulatedMeanSquares[n].assign(e),t.accumulatedMeanGrads[n].assign(r),t.accumulatedMoments[n].assign(l);var c=o.sub(l);o.assign(c);}else{var p=t.decayScalar.mul(a).add(t.oneMinusDecay.mul(u.square()));l=t.momentumScalar.mul(s).add(t.c.mul(u).div(p.add(t.epsilonScalar).sqrt()));t.accumulatedMeanSquares[n].assign(p),t.accumulatedMoments[n].assign(l);c=o.sub(l);o.assign(c);}});},r=this;for(var o in e)n(o);},t.prototype.dispose=function(){var e=this;this.c.dispose(),this.epsilonScalar.dispose(),this.decayScalar.dispose(),this.momentumScalar.dispose(),this.oneMinusDecay.dispose(),null!=this.accumulatedMeanSquares&&Object.keys(this.accumulatedMeanSquares).forEach(function(t){return e.accumulatedMeanSquares[t].dispose()}),null!=this.accumulatedMeanGrads&&this.centered&&Object.keys(this.accumulatedMeanGrads).forEach(function(t){return e.accumulatedMeanGrads[t].dispose()}),null!=this.accumulatedMoments&&Object.keys(this.accumulatedMoments).forEach(function(t){return e.accumulatedMoments[t].dispose()});},t.prototype.getConfig=function(){return {learningRate:this.learningRate,decay:this.decay,momentum:this.momentum,epsilon:this.epsilon,centered:this.centered}},t.fromConfig=function(e,t){return new e(t.learningRate,t.decay,t.momentum,t.epsilon,t.centered)},t.className="RMSPropOptimizer",t}(Optimizer);registerClass(RMSPropOptimizer);var OptimizerConstructors=function(){function e(){}return e.sgd=function(e){return new SGDOptimizer(e)},e.momentum=function(e,t,n){return void 0===n&&(n=!1),new MomentumOptimizer(e,t,n)},e.rmsprop=function(e,t,n,r,o){return void 0===t&&(t=.9),void 0===n&&(n=0),void 0===r&&(r=null),void 0===o&&(o=!1),new RMSPropOptimizer(e,t,n,r,o)},e.adam=function(e,t,n,r){return void 0===e&&(e=.001),void 0===t&&(t=.9),void 0===n&&(n=.999),void 0===r&&(r=null),new AdamOptimizer(e,t,n,r)},e.adadelta=function(e,t,n){return void 0===e&&(e=.001),void 0===t&&(t=.95),void 0===n&&(n=null),new AdadeltaOptimizer(e,t,n)},e.adamax=function(e,t,n,r,o){return void 0===e&&(e=.002),void 0===t&&(t=.9),void 0===n&&(n=.999),void 0===r&&(r=null),void 0===o&&(o=0),new AdamaxOptimizer(e,t,n,r,o)},e.adagrad=function(e,t){return void 0===t&&(t=.1),new AdagradOptimizer(e,t)},e}(),train={sgd:OptimizerConstructors.sgd,momentum:OptimizerConstructors.momentum,adadelta:OptimizerConstructors.adadelta,adagrad:OptimizerConstructors.adagrad,rmsprop:OptimizerConstructors.rmsprop,adamax:OptimizerConstructors.adamax,adam:OptimizerConstructors.adam},setBackend=Environment.setBackend,getBackend=Environment.getBackend,disposeVariables=Environment.disposeVariables,memory=Environment.memory;setOpHandler(ops); - - var tfCore_esm = /*#__PURE__*/Object.freeze({ - setBackend: setBackend, - getBackend: getBackend, - disposeVariables: disposeVariables, - memory: memory, - version_core: version, - nextFrame: nextFrame, - environment: environment, - io: io, - serialization: serialization, - test_util: test_util, - util: util, - webgl: webgl, - AdadeltaOptimizer: AdadeltaOptimizer, - AdagradOptimizer: AdagradOptimizer, - AdamOptimizer: AdamOptimizer, - AdamaxOptimizer: AdamaxOptimizer, - MomentumOptimizer: MomentumOptimizer, - Optimizer: Optimizer, - RMSPropOptimizer: RMSPropOptimizer, - SGDOptimizer: SGDOptimizer, - Tensor: Tensor, - TensorBuffer: TensorBuffer, - variable: variable, - Variable: Variable, - get Rank () { return Rank; }, - get Reduction () { return Reduction; }, - ENV: ENV, - Environment: Environment, - DataStorage: DataStorage, - image: image_ops, - linalg: linalg_ops, - losses: loss_ops, - op: op, - batchNormalization2d: batchNormalization2d, - batchNormalization3d: batchNormalization3d, - batchNormalization4d: batchNormalization4d, - batchNormalization: batchNormalization, - complex: complex, - real: real, - imag: imag, - concat: concat, - concat1d: concat1d, - concat2d: concat2d, - concat3d: concat3d, - concat4d: concat4d, - split: split$1, - conv1d: conv1d, - conv2d: conv2d, - depthwiseConv2d: depthwiseConv2d, - separableConv2d: separableConv2d, - conv2dTranspose: conv2dTranspose, - matMul: matMul, - dot: dot, - outerProduct: outerProduct, - reverse: reverse, - reverse1d: reverse1d, - reverse2d: reverse2d, - reverse3d: reverse3d, - reverse4d: reverse4d, - maxPool: maxPool, - avgPool: avgPool, - slice: slice, - slice1d: slice1d, - slice2d: slice2d, - slice3d: slice3d, - slice4d: slice4d, - abs: abs, - acos: acos, - acosh: acosh, - asin: asin, - asinh: asinh, - atan: atan, - atanh: atanh, - ceil: ceil, - clipByValue: clipByValue, - cos: cos, - cosh: cosh, - erf: erf, - exp: exp, - expm1: expm1, - floor: floor, - log: log$1, - log1p: log1p, - logSigmoid: logSigmoid, - neg: neg, - reciprocal: reciprocal, - round: round, - rsqrt: rsqrt, - sigmoid: sigmoid, - sign: sign, - sin: sin, - sinh: sinh, - softplus: softplus, - sqrt: sqrt, - square: square, - step: step, - tan: tan, - tanh: tanh$1, - all: all, - any: any, - argMax: argMax, - argMin: argMin, - logSumExp: logSumExp, - max: max, - mean: mean, - min: min, - moments: moments, - sum: sum, - equal: equal, - equalStrict: equalStrict, - greater: greater, - greaterEqual: greaterEqual, - greaterEqualStrict: greaterEqualStrict, - greaterStrict: greaterStrict, - less: less, - lessEqual: lessEqual, - lessEqualStrict: lessEqualStrict, - lessStrict: lessStrict, - notEqual: notEqual, - notEqualStrict: notEqualStrict, - add: add, - addN: addN, - addStrict: addStrict, - atan2: atan2, - div: div, - divStrict: divStrict, - floorDiv: floorDiv, - maximum: maximum, - maximumStrict: maximumStrict, - minimum: minimum, - minimumStrict: minimumStrict, - mod: mod, - modStrict: modStrict, - mul: mul, - mulStrict: mulStrict, - pow: pow, - powStrict: powStrict, - squaredDifference: squaredDifference, - squaredDifferenceStrict: squaredDifferenceStrict, - sub: sub, - subStrict: subStrict, - elu: elu, - leakyRelu: leakyRelu, - prelu: prelu, - relu: relu, - selu: selu, - logicalAnd: logicalAnd, - logicalNot: logicalNot, - logicalOr: logicalOr, - logicalXor: logicalXor, - where: where, - whereAsync: whereAsync, - buffer: buffer, - toPixels: toPixels, - print: print, - batchToSpaceND: batchToSpaceND, - cast: cast, - clone: clone, - cumsum: cumsum, - depthToSpace: depthToSpace, - expandDims: expandDims, - eye: eye, - fromPixels: fromPixels, - multinomial: multinomial, - oneHot: oneHot, - pad: pad, - pad1d: pad1d, - pad2d: pad2d, - pad3d: pad3d, - pad4d: pad4d, - rand: rand, - randomNormal: randomNormal, - randomUniform: randomUniform, - reshape: reshape, - spaceToBatchND: spaceToBatchND, - squeeze: squeeze, - stack: stack, - tile: tile, - truncatedNormal: truncatedNormal, - unstack: unstack, - fill: fill, - linspace: linspace, - ones: ones$1, - range: range, - scalar: scalar, - tensor: tensor, - tensor1d: tensor1d, - tensor2d: tensor2d, - tensor3d: tensor3d, - tensor4d: tensor4d, - tensor5d: tensor5d, - tensor6d: tensor6d, - zeros: zeros, - onesLike: onesLike, - zerosLike: zerosLike, - transpose: transpose, - softmax: softmax, - localResponseNormalization: localResponseNormalization, - norm: norm, - gather: gather, - unsortedSegmentSum: unsortedSegmentSum, - basicLSTMCell: basicLSTMCell, - multiRNNCell: multiRNNCell, - movingAverage: movingAverage, - stridedSlice: stridedSlice, - topk: topk, - train: train, - tidy: tidy, - keep: keep, - dispose: dispose, - time: time, - profile: profile, - customGrad: customGrad, - grad: grad, - grads: grads, - valueAndGrad: valueAndGrad, - valueAndGrads: valueAndGrads, - variableGrads: variableGrads - }); - - /*! ***************************************************************************** - Copyright (c) Microsoft Corporation. All rights reserved. - Licensed under the Apache License, Version 2.0 (the "License"); you may not use - this file except in compliance with the License. You may obtain a copy of the - License at http://www.apache.org/licenses/LICENSE-2.0 - - THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED - WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, - MERCHANTABLITY OR NON-INFRINGEMENT. - - See the Apache Version 2.0 License for specific language governing permissions - and limitations under the License. - ***************************************************************************** */ - /* global Reflect, Promise */ - - var extendStatics$1 = function(d, b) { - extendStatics$1 = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; - return extendStatics$1(d, b); - }; - - function __extends$1(d, b) { - extendStatics$1(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - } - - var __assign$1 = function() { - __assign$1 = Object.assign || function __assign(t) { - for (var s, i = 1, n = arguments.length; i < n; i++) { - s = arguments[i]; - for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; - } - return t; - }; - return __assign$1.apply(this, arguments); - }; - - function __awaiter$1(thisArg, _arguments, P, generator) { - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } - function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } - function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); - } - - function __generator$1(thisArg, body) { - var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; - return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; - function verb(n) { return function (v) { return step([n, v]); }; } - function step(op) { - if (f) throw new TypeError("Generator is already executing."); - while (_) try { - if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; - if (y = 0, t) op = [op[0] & 2, t.value]; - switch (op[0]) { - case 0: case 1: t = op; break; - case 4: _.label++; return { value: op[1], done: false }; - case 5: _.label++; y = op[1]; op = [0]; continue; - case 7: op = _.ops.pop(); _.trys.pop(); continue; - default: - if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } - if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } - if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } - if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } - if (t[2]) _.ops.pop(); - _.trys.pop(); continue; - } - op = body.call(thisArg, _); - } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } - if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; - } - } - - var commonjsGlobal$1 = typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {}; - - function createCommonjsModule$1(fn, module) { - return module = { exports: {} }, fn(module, module.exports), module.exports; - } - - var isBuffer = function isBuffer(arg) { - return arg instanceof Buffer; - }; - - var inherits_browser = createCommonjsModule$1(function (module) { - if (typeof Object.create === 'function') { - // implementation from standard node.js 'util' module - module.exports = function inherits(ctor, superCtor) { - ctor.super_ = superCtor; - ctor.prototype = Object.create(superCtor.prototype, { - constructor: { - value: ctor, - enumerable: false, - writable: true, - configurable: true - } - }); - }; - } else { - // old school shim for old browsers - module.exports = function inherits(ctor, superCtor) { - ctor.super_ = superCtor; - var TempCtor = function () {}; - TempCtor.prototype = superCtor.prototype; - ctor.prototype = new TempCtor(); - ctor.prototype.constructor = ctor; - }; - } - }); - - var inherits = createCommonjsModule$1(function (module) { - try { - var util = util$1; - if (typeof util.inherits !== 'function') throw ''; - module.exports = util.inherits; - } catch (e) { - module.exports = inherits_browser; - } - }); - - var util$1 = createCommonjsModule$1(function (module, exports) { - // Copyright Joyent, Inc. and other Node contributors. - // - // Permission is hereby granted, free of charge, to any person obtaining a - // copy of this software and associated documentation files (the - // "Software"), to deal in the Software without restriction, including - // without limitation the rights to use, copy, modify, merge, publish, - // distribute, sublicense, and/or sell copies of the Software, and to permit - // persons to whom the Software is furnished to do so, subject to the - // following conditions: - // - // The above copyright notice and this permission notice shall be included - // in all copies or substantial portions of the Software. - // - // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN - // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, - // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR - // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE - // USE OR OTHER DEALINGS IN THE SOFTWARE. - - var formatRegExp = /%[sdj%]/g; - exports.format = function(f) { - if (!isString(f)) { - var objects = []; - for (var i = 0; i < arguments.length; i++) { - objects.push(inspect(arguments[i])); - } - return objects.join(' '); - } - - var i = 1; - var args = arguments; - var len = args.length; - var str = String(f).replace(formatRegExp, function(x) { - if (x === '%%') return '%'; - if (i >= len) return x; - switch (x) { - case '%s': return String(args[i++]); - case '%d': return Number(args[i++]); - case '%j': - try { - return JSON.stringify(args[i++]); - } catch (_) { - return '[Circular]'; - } - default: - return x; - } - }); - for (var x = args[i]; i < len; x = args[++i]) { - if (isNull(x) || !isObject(x)) { - str += ' ' + x; - } else { - str += ' ' + inspect(x); - } - } - return str; - }; - - - // Mark that a method should not be used. - // Returns a modified function which warns once by default. - // If --no-deprecation is set, then it is a no-op. - exports.deprecate = function(fn, msg) { - // Allow for deprecating things in the process of starting up. - if (isUndefined(commonjsGlobal$1.process)) { - return function() { - return exports.deprecate(fn, msg).apply(this, arguments); - }; - } - - if (process.noDeprecation === true) { - return fn; - } - - var warned = false; - function deprecated() { - if (!warned) { - if (process.throwDeprecation) { - throw new Error(msg); - } else if (process.traceDeprecation) { - console.trace(msg); - } else { - console.error(msg); - } - warned = true; - } - return fn.apply(this, arguments); - } - - return deprecated; - }; - - - var debugs = {}; - var debugEnviron; - exports.debuglog = function(set) { - if (isUndefined(debugEnviron)) - debugEnviron = process.env.NODE_DEBUG || ''; - set = set.toUpperCase(); - if (!debugs[set]) { - if (new RegExp('\\b' + set + '\\b', 'i').test(debugEnviron)) { - var pid = process.pid; - debugs[set] = function() { - var msg = exports.format.apply(exports, arguments); - console.error('%s %d: %s', set, pid, msg); - }; - } else { - debugs[set] = function() {}; - } - } - return debugs[set]; - }; - - - /** - * Echos the value of a value. Trys to print the value out - * in the best way possible given the different types. - * - * @param {Object} obj The object to print out. - * @param {Object} opts Optional options object that alters the output. - */ - /* legacy: obj, showHidden, depth, colors*/ - function inspect(obj, opts) { - // default options - var ctx = { - seen: [], - stylize: stylizeNoColor - }; - // legacy... - if (arguments.length >= 3) ctx.depth = arguments[2]; - if (arguments.length >= 4) ctx.colors = arguments[3]; - if (isBoolean(opts)) { - // legacy... - ctx.showHidden = opts; - } else if (opts) { - // got an "options" object - exports._extend(ctx, opts); - } - // set default options - if (isUndefined(ctx.showHidden)) ctx.showHidden = false; - if (isUndefined(ctx.depth)) ctx.depth = 2; - if (isUndefined(ctx.colors)) ctx.colors = false; - if (isUndefined(ctx.customInspect)) ctx.customInspect = true; - if (ctx.colors) ctx.stylize = stylizeWithColor; - return formatValue(ctx, obj, ctx.depth); - } - exports.inspect = inspect; - - - // http://en.wikipedia.org/wiki/ANSI_escape_code#graphics - inspect.colors = { - 'bold' : [1, 22], - 'italic' : [3, 23], - 'underline' : [4, 24], - 'inverse' : [7, 27], - 'white' : [37, 39], - 'grey' : [90, 39], - 'black' : [30, 39], - 'blue' : [34, 39], - 'cyan' : [36, 39], - 'green' : [32, 39], - 'magenta' : [35, 39], - 'red' : [31, 39], - 'yellow' : [33, 39] - }; - - // Don't use 'blue' not visible on cmd.exe - inspect.styles = { - 'special': 'cyan', - 'number': 'yellow', - 'boolean': 'yellow', - 'undefined': 'grey', - 'null': 'bold', - 'string': 'green', - 'date': 'magenta', - // "name": intentionally not styling - 'regexp': 'red' - }; - - - function stylizeWithColor(str, styleType) { - var style = inspect.styles[styleType]; - - if (style) { - return '\u001b[' + inspect.colors[style][0] + 'm' + str + - '\u001b[' + inspect.colors[style][1] + 'm'; - } else { - return str; - } - } - - - function stylizeNoColor(str, styleType) { - return str; - } - - - function arrayToHash(array) { - var hash = {}; - - array.forEach(function(val, idx) { - hash[val] = true; - }); - - return hash; - } - - - function formatValue(ctx, value, recurseTimes) { - // Provide a hook for user-specified inspect functions. - // Check that value is an object with an inspect function on it - if (ctx.customInspect && - value && - isFunction(value.inspect) && - // Filter out the util module, it's inspect function is special - value.inspect !== exports.inspect && - // Also filter out any prototype objects using the circular check. - !(value.constructor && value.constructor.prototype === value)) { - var ret = value.inspect(recurseTimes, ctx); - if (!isString(ret)) { - ret = formatValue(ctx, ret, recurseTimes); - } - return ret; - } - - // Primitive types cannot have properties - var primitive = formatPrimitive(ctx, value); - if (primitive) { - return primitive; - } - - // Look up the keys of the object. - var keys = Object.keys(value); - var visibleKeys = arrayToHash(keys); - - if (ctx.showHidden) { - keys = Object.getOwnPropertyNames(value); - } - - // IE doesn't make error fields non-enumerable - // http://msdn.microsoft.com/en-us/library/ie/dww52sbt(v=vs.94).aspx - if (isError(value) - && (keys.indexOf('message') >= 0 || keys.indexOf('description') >= 0)) { - return formatError(value); - } - - // Some type of object without properties can be shortcutted. - if (keys.length === 0) { - if (isFunction(value)) { - var name = value.name ? ': ' + value.name : ''; - return ctx.stylize('[Function' + name + ']', 'special'); - } - if (isRegExp(value)) { - return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp'); - } - if (isDate(value)) { - return ctx.stylize(Date.prototype.toString.call(value), 'date'); - } - if (isError(value)) { - return formatError(value); - } - } - - var base = '', array = false, braces = ['{', '}']; - - // Make Array say that they are Array - if (isArray(value)) { - array = true; - braces = ['[', ']']; - } - - // Make functions say that they are functions - if (isFunction(value)) { - var n = value.name ? ': ' + value.name : ''; - base = ' [Function' + n + ']'; - } - - // Make RegExps say that they are RegExps - if (isRegExp(value)) { - base = ' ' + RegExp.prototype.toString.call(value); - } - - // Make dates with properties first say the date - if (isDate(value)) { - base = ' ' + Date.prototype.toUTCString.call(value); - } - - // Make error with message first say the error - if (isError(value)) { - base = ' ' + formatError(value); - } - - if (keys.length === 0 && (!array || value.length == 0)) { - return braces[0] + base + braces[1]; - } - - if (recurseTimes < 0) { - if (isRegExp(value)) { - return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp'); - } else { - return ctx.stylize('[Object]', 'special'); - } - } - - ctx.seen.push(value); - - var output; - if (array) { - output = formatArray(ctx, value, recurseTimes, visibleKeys, keys); - } else { - output = keys.map(function(key) { - return formatProperty(ctx, value, recurseTimes, visibleKeys, key, array); - }); - } - - ctx.seen.pop(); - - return reduceToSingleString(output, base, braces); - } - - - function formatPrimitive(ctx, value) { - if (isUndefined(value)) - return ctx.stylize('undefined', 'undefined'); - if (isString(value)) { - var simple = '\'' + JSON.stringify(value).replace(/^"|"$/g, '') - .replace(/'/g, "\\'") - .replace(/\\"/g, '"') + '\''; - return ctx.stylize(simple, 'string'); - } - if (isNumber(value)) - return ctx.stylize('' + value, 'number'); - if (isBoolean(value)) - return ctx.stylize('' + value, 'boolean'); - // For some reason typeof null is "object", so special case here. - if (isNull(value)) - return ctx.stylize('null', 'null'); - } - - - function formatError(value) { - return '[' + Error.prototype.toString.call(value) + ']'; - } - - - function formatArray(ctx, value, recurseTimes, visibleKeys, keys) { - var output = []; - for (var i = 0, l = value.length; i < l; ++i) { - if (hasOwnProperty(value, String(i))) { - output.push(formatProperty(ctx, value, recurseTimes, visibleKeys, - String(i), true)); - } else { - output.push(''); - } - } - keys.forEach(function(key) { - if (!key.match(/^\d+$/)) { - output.push(formatProperty(ctx, value, recurseTimes, visibleKeys, - key, true)); - } - }); - return output; - } - - - function formatProperty(ctx, value, recurseTimes, visibleKeys, key, array) { - var name, str, desc; - desc = Object.getOwnPropertyDescriptor(value, key) || { value: value[key] }; - if (desc.get) { - if (desc.set) { - str = ctx.stylize('[Getter/Setter]', 'special'); - } else { - str = ctx.stylize('[Getter]', 'special'); - } - } else { - if (desc.set) { - str = ctx.stylize('[Setter]', 'special'); - } - } - if (!hasOwnProperty(visibleKeys, key)) { - name = '[' + key + ']'; - } - if (!str) { - if (ctx.seen.indexOf(desc.value) < 0) { - if (isNull(recurseTimes)) { - str = formatValue(ctx, desc.value, null); - } else { - str = formatValue(ctx, desc.value, recurseTimes - 1); - } - if (str.indexOf('\n') > -1) { - if (array) { - str = str.split('\n').map(function(line) { - return ' ' + line; - }).join('\n').substr(2); - } else { - str = '\n' + str.split('\n').map(function(line) { - return ' ' + line; - }).join('\n'); - } - } - } else { - str = ctx.stylize('[Circular]', 'special'); - } - } - if (isUndefined(name)) { - if (array && key.match(/^\d+$/)) { - return str; - } - name = JSON.stringify('' + key); - if (name.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)) { - name = name.substr(1, name.length - 2); - name = ctx.stylize(name, 'name'); - } else { - name = name.replace(/'/g, "\\'") - .replace(/\\"/g, '"') - .replace(/(^"|"$)/g, "'"); - name = ctx.stylize(name, 'string'); - } - } - - return name + ': ' + str; - } - - - function reduceToSingleString(output, base, braces) { - var length = output.reduce(function(prev, cur) { - if (cur.indexOf('\n') >= 0) ; - return prev + cur.replace(/\u001b\[\d\d?m/g, '').length + 1; - }, 0); - - if (length > 60) { - return braces[0] + - (base === '' ? '' : base + '\n ') + - ' ' + - output.join(',\n ') + - ' ' + - braces[1]; - } - - return braces[0] + base + ' ' + output.join(', ') + ' ' + braces[1]; - } - - - // NOTE: These type checking functions intentionally don't use `instanceof` - // because it is fragile and can be easily faked with `Object.create()`. - function isArray(ar) { - return Array.isArray(ar); - } - exports.isArray = isArray; - - function isBoolean(arg) { - return typeof arg === 'boolean'; - } - exports.isBoolean = isBoolean; - - function isNull(arg) { - return arg === null; - } - exports.isNull = isNull; - - function isNullOrUndefined(arg) { - return arg == null; - } - exports.isNullOrUndefined = isNullOrUndefined; - - function isNumber(arg) { - return typeof arg === 'number'; - } - exports.isNumber = isNumber; - - function isString(arg) { - return typeof arg === 'string'; - } - exports.isString = isString; - - function isSymbol(arg) { - return typeof arg === 'symbol'; - } - exports.isSymbol = isSymbol; - - function isUndefined(arg) { - return arg === void 0; - } - exports.isUndefined = isUndefined; - - function isRegExp(re) { - return isObject(re) && objectToString(re) === '[object RegExp]'; - } - exports.isRegExp = isRegExp; - - function isObject(arg) { - return typeof arg === 'object' && arg !== null; - } - exports.isObject = isObject; - - function isDate(d) { - return isObject(d) && objectToString(d) === '[object Date]'; - } - exports.isDate = isDate; - - function isError(e) { - return isObject(e) && - (objectToString(e) === '[object Error]' || e instanceof Error); - } - exports.isError = isError; - - function isFunction(arg) { - return typeof arg === 'function'; - } - exports.isFunction = isFunction; - - function isPrimitive(arg) { - return arg === null || - typeof arg === 'boolean' || - typeof arg === 'number' || - typeof arg === 'string' || - typeof arg === 'symbol' || // ES6 symbol - typeof arg === 'undefined'; - } - exports.isPrimitive = isPrimitive; - - exports.isBuffer = isBuffer; - - function objectToString(o) { - return Object.prototype.toString.call(o); - } - - - function pad(n) { - return n < 10 ? '0' + n.toString(10) : n.toString(10); - } - - - var months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', - 'Oct', 'Nov', 'Dec']; - - // 26 Feb 16:19:34 - function timestamp() { - var d = new Date(); - var time = [pad(d.getHours()), - pad(d.getMinutes()), - pad(d.getSeconds())].join(':'); - return [d.getDate(), months[d.getMonth()], time].join(' '); - } - - - // log is just a thin wrapper to console.log that prepends a timestamp - exports.log = function() { - console.log('%s - %s', timestamp(), exports.format.apply(exports, arguments)); - }; - - - /** - * Inherit the prototype methods from one constructor into another. - * - * The Function.prototype.inherits from lang.js rewritten as a standalone - * function (not on Function.prototype). NOTE: If this file is to be loaded - * during bootstrapping this function needs to be rewritten using some native - * functions as prototype setup using normal JavaScript does not work as - * expected during bootstrapping (see mirror.js in r114903). - * - * @param {function} ctor Constructor function which needs to inherit the - * prototype. - * @param {function} superCtor Constructor function to inherit prototype from. - */ - exports.inherits = inherits; - - exports._extend = function(origin, add) { - // Don't do anything if add isn't an object - if (!add || !isObject(add)) return origin; - - var keys = Object.keys(add); - var i = keys.length; - while (i--) { - origin[keys[i]] = add[keys[i]]; - } - return origin; - }; - - function hasOwnProperty(obj, prop) { - return Object.prototype.hasOwnProperty.call(obj, prop); - } - }); - var util_1 = util$1.format; - var util_2 = util$1.deprecate; - var util_3 = util$1.debuglog; - var util_4 = util$1.inspect; - var util_5 = util$1.isArray; - var util_6 = util$1.isBoolean; - var util_7 = util$1.isNull; - var util_8 = util$1.isNullOrUndefined; - var util_9 = util$1.isNumber; - var util_10 = util$1.isString; - var util_11 = util$1.isSymbol; - var util_12 = util$1.isUndefined; - var util_13 = util$1.isRegExp; - var util_14 = util$1.isObject; - var util_15 = util$1.isDate; - var util_16 = util$1.isError; - var util_17 = util$1.isFunction; - var util_18 = util$1.isPrimitive; - var util_19 = util$1.isBuffer; - var util_20 = util$1.log; - var util_21 = util$1.inherits; - var util_22 = util$1._extend; - - var Dimensions = /** @class */ (function () { - function Dimensions(width, height) { - if (!util_9(width) || !util_9(height)) { - throw new Error("Dimensions.constructor - expected width and height to be valid numbers, instead have " + JSON.stringify({ width: width, height: height })); - } - this._width = width; - this._height = height; - } - Object.defineProperty(Dimensions.prototype, "width", { - get: function () { return this._width; }, - enumerable: true, - configurable: true - }); - Object.defineProperty(Dimensions.prototype, "height", { - get: function () { return this._height; }, - enumerable: true, - configurable: true - }); - Dimensions.prototype.reverse = function () { - return new Dimensions(1 / this.width, 1 / this.height); - }; - return Dimensions; - }()); - - var Point = /** @class */ (function () { - function Point(x, y) { - this._x = x; - this._y = y; - } - Object.defineProperty(Point.prototype, "x", { - get: function () { return this._x; }, - enumerable: true, - configurable: true - }); - Object.defineProperty(Point.prototype, "y", { - get: function () { return this._y; }, - enumerable: true, - configurable: true - }); - Point.prototype.add = function (pt) { - return new Point(this.x + pt.x, this.y + pt.y); - }; - Point.prototype.sub = function (pt) { - return new Point(this.x - pt.x, this.y - pt.y); - }; - Point.prototype.mul = function (pt) { - return new Point(this.x * pt.x, this.y * pt.y); - }; - Point.prototype.div = function (pt) { - return new Point(this.x / pt.x, this.y / pt.y); - }; - Point.prototype.abs = function () { - return new Point(Math.abs(this.x), Math.abs(this.y)); - }; - Point.prototype.magnitude = function () { - return Math.sqrt(Math.pow(this.x, 2) + Math.pow(this.y, 2)); - }; - Point.prototype.floor = function () { - return new Point(Math.floor(this.x), Math.floor(this.y)); - }; - return Point; - }()); - - function isTensor(tensor$$1, dim) { - return tensor$$1 instanceof Tensor && tensor$$1.shape.length === dim; - } - function isTensor1D(tensor$$1) { - return isTensor(tensor$$1, 1); - } - function isTensor2D(tensor$$1) { - return isTensor(tensor$$1, 2); - } - function isTensor3D(tensor$$1) { - return isTensor(tensor$$1, 3); - } - function isTensor4D(tensor$$1) { - return isTensor(tensor$$1, 4); - } - function isFloat(num) { - return num % 1 !== 0; - } - function isEven(num) { - return num % 2 === 0; - } - function round$1(num, prec) { - if (prec === void 0) { prec = 2; } - var f = Math.pow(10, prec); - return Math.floor(num * f) / f; - } - function isDimensions(obj) { - return obj && obj.width && obj.height; - } - function computeReshapedDimensions(_a, inputSize) { - var width = _a.width, height = _a.height; - var scale = inputSize / Math.max(height, width); - return new Dimensions(Math.round(width * scale), Math.round(height * scale)); - } - function getCenterPoint(pts) { - return pts.reduce(function (sum$$1, pt) { return sum$$1.add(pt); }, new Point(0, 0)) - .div(new Point(pts.length, pts.length)); - } - function range$1(num, start, step$$1) { - return Array(num).fill(0).map(function (_, i) { return start + (i * step$$1); }); - } - function isValidNumber(num) { - return !!num && num !== Infinity && num !== -Infinity && !isNaN(num) || num === 0; - } - function isValidProbablitiy(num) { - return isValidNumber(num) && 0 <= num && num <= 1.0; - } - - var Box = /** @class */ (function () { - // TODO: MTCNN boxes sometimes have negative widths or heights, figure out why and remove - // allowNegativeDimensions flag again - function Box(_box, allowNegativeDimensions) { - if (allowNegativeDimensions === void 0) { allowNegativeDimensions = false; } - var box = (_box || {}); - var isBbox = [box.left, box.top, box.right, box.bottom].every(isValidNumber); - var isRect = [box.x, box.y, box.width, box.height].every(isValidNumber); - if (!isRect && !isBbox) { - throw new Error("Box.constructor - expected box to be IBoundingBox | IRect, instead have " + JSON.stringify(box)); - } - var _a = isRect - ? [box.x, box.y, box.width, box.height] - : [box.left, box.top, box.right - box.left, box.bottom - box.top], x = _a[0], y = _a[1], width = _a[2], height = _a[3]; - Box.assertIsValidBox({ x: x, y: y, width: width, height: height }, 'Box.constructor', allowNegativeDimensions); - this._x = x; - this._y = y; - this._width = width; - this._height = height; - } - Box.isRect = function (rect) { - return !!rect && [rect.x, rect.y, rect.width, rect.height].every(isValidNumber); - }; - Box.assertIsValidBox = function (box, callee, allowNegativeDimensions) { - if (allowNegativeDimensions === void 0) { allowNegativeDimensions = false; } - if (!Box.isRect(box)) { - throw new Error(callee + " - invalid box: " + JSON.stringify(box) + ", expected object with properties x, y, width, height"); - } - if (!allowNegativeDimensions && (box.width < 0 || box.height < 0)) { - throw new Error(callee + " - width (" + box.width + ") and height (" + box.height + ") must be positive numbers"); - } - }; - Object.defineProperty(Box.prototype, "x", { - get: function () { return this._x; }, - enumerable: true, - configurable: true - }); - Object.defineProperty(Box.prototype, "y", { - get: function () { return this._y; }, - enumerable: true, - configurable: true - }); - Object.defineProperty(Box.prototype, "width", { - get: function () { return this._width; }, - enumerable: true, - configurable: true - }); - Object.defineProperty(Box.prototype, "height", { - get: function () { return this._height; }, - enumerable: true, - configurable: true - }); - Object.defineProperty(Box.prototype, "left", { - get: function () { return this.x; }, - enumerable: true, - configurable: true - }); - Object.defineProperty(Box.prototype, "top", { - get: function () { return this.y; }, - enumerable: true, - configurable: true - }); - Object.defineProperty(Box.prototype, "right", { - get: function () { return this.x + this.width; }, - enumerable: true, - configurable: true - }); - Object.defineProperty(Box.prototype, "bottom", { - get: function () { return this.y + this.height; }, - enumerable: true, - configurable: true - }); - Object.defineProperty(Box.prototype, "area", { - get: function () { return this.width * this.height; }, - enumerable: true, - configurable: true - }); - Box.prototype.round = function () { - var _a = [this.x, this.y, this.width, this.height] - .map(function (val) { return Math.round(val); }), x = _a[0], y = _a[1], width = _a[2], height = _a[3]; - return new Box({ x: x, y: y, width: width, height: height }); - }; - Box.prototype.floor = function () { - var _a = [this.x, this.y, this.width, this.height] - .map(function (val) { return Math.floor(val); }), x = _a[0], y = _a[1], width = _a[2], height = _a[3]; - return new Box({ x: x, y: y, width: width, height: height }); - }; - Box.prototype.toSquare = function () { - var _a = this, x = _a.x, y = _a.y, width = _a.width, height = _a.height; - var diff = Math.abs(width - height); - if (width < height) { - x -= (diff / 2); - width += diff; - } - if (height < width) { - y -= (diff / 2); - height += diff; - } - return new Box({ x: x, y: y, width: width, height: height }); - }; - Box.prototype.rescale = function (s) { - var scaleX = isDimensions(s) ? s.width : s; - var scaleY = isDimensions(s) ? s.height : s; - return new Box({ - x: this.x * scaleX, - y: this.y * scaleY, - width: this.width * scaleX, - height: this.height * scaleY - }); - }; - Box.prototype.pad = function (padX, padY) { - var _a = [ - this.x - (padX / 2), - this.y - (padY / 2), - this.width + padX, - this.height + padY - ], x = _a[0], y = _a[1], width = _a[2], height = _a[3]; - return new Box({ x: x, y: y, width: width, height: height }); - }; - Box.prototype.clipAtImageBorders = function (imgWidth, imgHeight) { - var _a = this, x = _a.x, y = _a.y, right = _a.right, bottom = _a.bottom; - var clippedX = Math.max(x, 0); - var clippedY = Math.max(y, 0); - var newWidth = right - clippedX; - var newHeight = bottom - clippedY; - var clippedWidth = Math.min(newWidth, imgWidth - clippedX); - var clippedHeight = Math.min(newHeight, imgHeight - clippedY); - return (new Box({ x: clippedX, y: clippedY, width: clippedWidth, height: clippedHeight })).floor(); - }; - Box.prototype.padAtBorders = function (imageHeight, imageWidth) { - var w = this.width + 1; - var h = this.height + 1; - var dx = 1; - var dy = 1; - var edx = w; - var edy = h; - var x = this.left; - var y = this.top; - var ex = this.right; - var ey = this.bottom; - if (ex > imageWidth) { - edx = -ex + imageWidth + w; - ex = imageWidth; - } - if (ey > imageHeight) { - edy = -ey + imageHeight + h; - ey = imageHeight; - } - if (x < 1) { - edy = 2 - x; - x = 1; - } - if (y < 1) { - edy = 2 - y; - y = 1; - } - return { dy: dy, edy: edy, dx: dx, edx: edx, y: y, ey: ey, x: x, ex: ex, w: w, h: h }; - }; - Box.prototype.calibrate = function (region) { - return new Box({ - left: this.left + (region.left * this.width), - top: this.top + (region.top * this.height), - right: this.right + (region.right * this.width), - bottom: this.bottom + (region.bottom * this.height) - }).toSquare().round(); - }; - return Box; - }()); - - var BoundingBox = /** @class */ (function (_super) { - __extends$1(BoundingBox, _super); - function BoundingBox(left, top, right, bottom) { - return _super.call(this, { left: left, top: top, right: right, bottom: bottom }) || this; - } - return BoundingBox; - }(Box)); - - var BoxWithText = /** @class */ (function (_super) { - __extends$1(BoxWithText, _super); - function BoxWithText(box, text) { - var _this = _super.call(this, box) || this; - _this._text = text; - return _this; - } - Object.defineProperty(BoxWithText.prototype, "text", { - get: function () { return this._text; }, - enumerable: true, - configurable: true - }); - return BoxWithText; - }(Box)); - - var LabeledBox = /** @class */ (function (_super) { - __extends$1(LabeledBox, _super); - function LabeledBox(box, label) { - var _this = _super.call(this, box) || this; - _this._label = label; - return _this; - } - LabeledBox.assertIsValidLabeledBox = function (box, callee) { - Box.assertIsValidBox(box, callee); - if (!isValidNumber(box.label)) { - throw new Error(callee + " - expected property label (" + box.label + ") to be a number"); - } - }; - Object.defineProperty(LabeledBox.prototype, "label", { - get: function () { return this._label; }, - enumerable: true, - configurable: true - }); - return LabeledBox; - }(Box)); - - var ObjectDetection = /** @class */ (function () { - function ObjectDetection(score, classScore, className, relativeBox, imageDims) { - this._imageDims = new Dimensions(imageDims.width, imageDims.height); - this._score = score; - this._classScore = classScore; - this._className = className; - this._box = new Box(relativeBox).rescale(this._imageDims); - } - Object.defineProperty(ObjectDetection.prototype, "score", { - get: function () { return this._score; }, - enumerable: true, - configurable: true - }); - Object.defineProperty(ObjectDetection.prototype, "classScore", { - get: function () { return this._classScore; }, - enumerable: true, - configurable: true - }); - Object.defineProperty(ObjectDetection.prototype, "className", { - get: function () { return this._className; }, - enumerable: true, - configurable: true - }); - Object.defineProperty(ObjectDetection.prototype, "box", { - get: function () { return this._box; }, - enumerable: true, - configurable: true - }); - Object.defineProperty(ObjectDetection.prototype, "imageDims", { - get: function () { return this._imageDims; }, - enumerable: true, - configurable: true - }); - Object.defineProperty(ObjectDetection.prototype, "imageWidth", { - get: function () { return this.imageDims.width; }, - enumerable: true, - configurable: true - }); - Object.defineProperty(ObjectDetection.prototype, "imageHeight", { - get: function () { return this.imageDims.height; }, - enumerable: true, - configurable: true - }); - Object.defineProperty(ObjectDetection.prototype, "relativeBox", { - get: function () { return new Box(this._box).rescale(this.imageDims.reverse()); }, - enumerable: true, - configurable: true - }); - ObjectDetection.prototype.forSize = function (width, height) { - return new ObjectDetection(this.score, this.classScore, this.className, this.relativeBox, { width: width, height: height }); - }; - return ObjectDetection; - }()); - - var PredictedBox = /** @class */ (function (_super) { - __extends$1(PredictedBox, _super); - function PredictedBox(box, label, score, classScore) { - var _this = _super.call(this, box, label) || this; - _this._score = score; - _this._classScore = classScore; - return _this; - } - PredictedBox.assertIsValidPredictedBox = function (box, callee) { - LabeledBox.assertIsValidLabeledBox(box, callee); - if (!isValidProbablitiy(box.score) - || !isValidProbablitiy(box.classScore)) { - throw new Error(callee + " - expected properties score (" + box.score + ") and (" + box.classScore + ") to be a number between [0, 1]"); - } - }; - Object.defineProperty(PredictedBox.prototype, "score", { - get: function () { return this._score; }, - enumerable: true, - configurable: true - }); - Object.defineProperty(PredictedBox.prototype, "classScore", { - get: function () { return this._classScore; }, - enumerable: true, - configurable: true - }); - return PredictedBox; - }(LabeledBox)); - - var Rect = /** @class */ (function (_super) { - __extends$1(Rect, _super); - function Rect(x, y, width, height) { - return _super.call(this, { x: x, y: y, width: width, height: height }) || this; - } - return Rect; - }(Box)); - - function disposeUnusedWeightTensors(weightMap, paramMappings) { - Object.keys(weightMap).forEach(function (path) { - if (!paramMappings.some(function (pm) { return pm.originalPath === path; })) { - weightMap[path].dispose(); - } - }); - } - - function extractWeightEntryFactory(weightMap, paramMappings) { - return function (originalPath, paramRank, mappedPath) { - var tensor = weightMap[originalPath]; - if (!isTensor(tensor, paramRank)) { - throw new Error("expected weightMap[" + originalPath + "] to be a Tensor" + paramRank + "D, instead have " + tensor); - } - paramMappings.push({ originalPath: originalPath, paramPath: mappedPath || originalPath }); - return tensor; - }; - } - - function extractWeightsFactory(weights) { - var remainingWeights = weights; - function extractWeights(numWeights) { - var ret = remainingWeights.slice(0, numWeights); - remainingWeights = remainingWeights.slice(numWeights); - return ret; - } - function getRemainingWeights() { - return remainingWeights; - } - return { - extractWeights: extractWeights, - getRemainingWeights: getRemainingWeights - }; - } - - function getModelUris(uri, defaultModelName) { - var defaultManifestFilename = defaultModelName + "-weights_manifest.json"; - if (!uri) { - return { - modelBaseUri: '', - manifestUri: defaultManifestFilename - }; - } - if (uri === '/') { - return { - modelBaseUri: '/', - manifestUri: "/" + defaultManifestFilename - }; - } - var protocol = uri.startsWith('http://') ? 'http://' : uri.startsWith('https://') ? 'https://' : ''; - uri = uri.replace(protocol, ''); - var parts = uri.split('/').filter(function (s) { return s; }); - var manifestFile = uri.endsWith('.json') - ? parts[parts.length - 1] - : defaultManifestFilename; - var modelBaseUri = protocol + (uri.endsWith('.json') ? parts.slice(0, parts.length - 1) : parts).join('/'); - modelBaseUri = uri.startsWith('/') ? "/" + modelBaseUri : modelBaseUri; - return { - modelBaseUri: modelBaseUri, - manifestUri: modelBaseUri === '/' ? "/" + manifestFile : modelBaseUri + "/" + manifestFile - }; - } - - function isMediaLoaded(media) { - return (media instanceof HTMLImageElement && media.complete) - || (media instanceof HTMLVideoElement && media.readyState >= 3); - } - - function awaitMediaLoaded(media) { - return new Promise(function (resolve, reject) { - if (media instanceof HTMLCanvasElement || isMediaLoaded(media)) { - return resolve(); - } - function onLoad(e) { - if (!e.currentTarget) - return; - e.currentTarget.removeEventListener('load', onLoad); - e.currentTarget.removeEventListener('error', onError); - resolve(e); - } - function onError(e) { - if (!e.currentTarget) - return; - e.currentTarget.removeEventListener('load', onLoad); - e.currentTarget.removeEventListener('error', onError); - reject(e); - } - media.addEventListener('load', onLoad); - media.addEventListener('error', onError); - }); - } - - function bufferToImage(buf) { - return new Promise(function (resolve, reject) { - if (!(buf instanceof Blob)) { - return reject('bufferToImage - expected buf to be of type: Blob'); - } - var reader = new FileReader(); - reader.onload = function () { - if (typeof reader.result !== 'string') { - return reject('bufferToImage - expected reader.result to be a string, in onload'); - } - var img = new Image(); - img.onload = function () { return resolve(img); }; - img.onerror = reject; - img.src = reader.result; - }; - reader.onerror = reject; - reader.readAsDataURL(buf); - }); - } - - function getContext2dOrThrow(canvas) { - var ctx = canvas.getContext('2d'); - if (!ctx) { - throw new Error('canvas 2d context is null'); - } - return ctx; - } - - function getMediaDimensions(input) { - if (input instanceof HTMLImageElement) { - return new Dimensions(input.naturalWidth, input.naturalHeight); - } - if (input instanceof HTMLVideoElement) { - return new Dimensions(input.videoWidth, input.videoHeight); - } - return new Dimensions(input.width, input.height); - } - - function createCanvas(_a) { - var width = _a.width, height = _a.height; - var canvas = document.createElement('canvas'); - canvas.width = width; - canvas.height = height; - return canvas; - } - function createCanvasFromMedia(media, dims) { - if (!isMediaLoaded(media)) { - throw new Error('createCanvasFromMedia - media has not finished loading yet'); - } - var _a = dims || getMediaDimensions(media), width = _a.width, height = _a.height; - var canvas = createCanvas({ width: width, height: height }); - getContext2dOrThrow(canvas).drawImage(media, 0, 0, width, height); - return canvas; - } - - function getDefaultDrawOptions(options) { - if (options === void 0) { options = {}; } - return Object.assign({}, { - boxColor: 'blue', - textColor: 'red', - lineWidth: 2, - fontSize: 20, - fontStyle: 'Georgia', - withScore: true, - withClassName: true - }, options); - } - - function drawBox(ctx, x, y, w, h, options) { - var drawOptions = Object.assign(getDefaultDrawOptions(), (options || {})); - ctx.strokeStyle = drawOptions.boxColor; - ctx.lineWidth = drawOptions.lineWidth; - ctx.strokeRect(x, y, w, h); - } - - function drawText(ctx, x, y, text, options) { - if (options === void 0) { options = {}; } - var drawOptions = Object.assign(getDefaultDrawOptions(), options); - var padText = 2 + drawOptions.lineWidth; - ctx.fillStyle = drawOptions.textColor; - ctx.font = drawOptions.fontSize + "px " + drawOptions.fontStyle; - ctx.fillText(text, x + padText, y + padText + (drawOptions.fontSize * 0.6)); - } - - function resolveInput(arg) { - if (typeof arg === 'string') { - return document.getElementById(arg); - } - return arg; - } - - function drawDetection(canvasArg, detection, options) { - var canvas = resolveInput(canvasArg); - if (!(canvas instanceof HTMLCanvasElement)) { - throw new Error('drawDetection - expected canvas to be of type: HTMLCanvasElement'); - } - var detectionArray = Array.isArray(detection) - ? detection - : [detection]; - detectionArray.forEach(function (det) { - var _a = det instanceof ObjectDetection ? det.box : det, x = _a.x, y = _a.y, width = _a.width, height = _a.height; - var drawOptions = getDefaultDrawOptions(options); - var ctx = getContext2dOrThrow(canvas); - drawBox(ctx, x, y, width, height, drawOptions); - var withScore = drawOptions.withScore; - var text = det instanceof BoxWithText - ? det.text - : ((withScore && det instanceof PredictedBox) - ? "" + round$1(det.score) - : (det instanceof ObjectDetection - ? "" + det.className + (withScore ? " (" + round$1(det.score) + ")" : '') - : '')); - if (text) { - drawText(ctx, x, y + height, text, drawOptions); - } - }); - } - - function fetchOrThrow(url, init) { - return __awaiter$1(this, void 0, void 0, function () { - var res; - return __generator$1(this, function (_a) { - switch (_a.label) { - case 0: return [4 /*yield*/, fetch(url, init)]; - case 1: - res = _a.sent(); - if (!(res.status < 400)) { - throw new Error("failed to fetch: (" + res.status + ") " + res.statusText + ", from url: " + res.url); - } - return [2 /*return*/, res]; - } - }); - }); - } - - function fetchImage(uri) { - return __awaiter$1(this, void 0, void 0, function () { - var res, blob; - return __generator$1(this, function (_a) { - switch (_a.label) { - case 0: return [4 /*yield*/, fetchOrThrow(uri)]; - case 1: - res = _a.sent(); - return [4 /*yield*/, (res).blob()]; - case 2: - blob = _a.sent(); - if (!blob.type.startsWith('image/')) { - throw new Error("fetchImage - expected blob type to be of type image/*, instead have: " + blob.type + ", for url: " + res.url); - } - return [2 /*return*/, bufferToImage(blob)]; - } - }); - }); - } - - function fetchJson(uri) { - return __awaiter$1(this, void 0, void 0, function () { - return __generator$1(this, function (_a) { - switch (_a.label) { - case 0: return [4 /*yield*/, fetchOrThrow(uri)]; - case 1: return [2 /*return*/, (_a.sent()).json()]; - } - }); - }); - } - - function fetchNetWeights(uri) { - return __awaiter$1(this, void 0, void 0, function () { - var _a; - return __generator$1(this, function (_b) { - switch (_b.label) { - case 0: - _a = Float32Array.bind; - return [4 /*yield*/, fetchOrThrow(uri)]; - case 1: return [4 /*yield*/, (_b.sent()).arrayBuffer()]; - case 2: return [2 /*return*/, new (_a.apply(Float32Array, [void 0, _b.sent()]))()]; - } - }); - }); - } - - function imageTensorToCanvas(imgTensor, canvas) { - return __awaiter$1(this, void 0, void 0, function () { - var targetCanvas, _a, height, width, numChannels, imgTensor3D; - return __generator$1(this, function (_b) { - switch (_b.label) { - case 0: - targetCanvas = canvas || document.createElement('canvas'); - _a = imgTensor.shape.slice(isTensor4D(imgTensor) ? 1 : 0), height = _a[0], width = _a[1], numChannels = _a[2]; - imgTensor3D = tidy(function () { return imgTensor.as3D(height, width, numChannels).toInt(); }); - return [4 /*yield*/, toPixels(imgTensor3D, targetCanvas)]; - case 1: - _b.sent(); - imgTensor3D.dispose(); - return [2 /*return*/, targetCanvas]; - } - }); - }); - } - - function imageToSquare(input, inputSize, centerImage) { - if (centerImage === void 0) { centerImage = false; } - if (!(input instanceof HTMLImageElement || input instanceof HTMLCanvasElement)) { - throw new Error('imageToSquare - expected arg0 to be HTMLImageElement | HTMLCanvasElement'); - } - var dims = getMediaDimensions(input); - var scale = inputSize / Math.max(dims.height, dims.width); - var width = scale * dims.width; - var height = scale * dims.height; - var targetCanvas = createCanvas({ width: inputSize, height: inputSize }); - var inputCanvas = input instanceof HTMLCanvasElement ? input : createCanvasFromMedia(input); - var offset = Math.abs(width - height) / 2; - var dx = centerImage && width < height ? offset : 0; - var dy = centerImage && height < width ? offset : 0; - getContext2dOrThrow(targetCanvas).drawImage(inputCanvas, dx, dy, width, height); - return targetCanvas; - } - - function isMediaElement(input) { - return input instanceof HTMLImageElement - || input instanceof HTMLVideoElement - || input instanceof HTMLCanvasElement; - } - - function loadWeightMap(uri, defaultModelName) { - return __awaiter$1(this, void 0, void 0, function () { - var _a, manifestUri, modelBaseUri, manifest; - return __generator$1(this, function (_b) { - switch (_b.label) { - case 0: - _a = getModelUris(uri, defaultModelName), manifestUri = _a.manifestUri, modelBaseUri = _a.modelBaseUri; - return [4 /*yield*/, fetchJson(manifestUri)]; - case 1: - manifest = _b.sent(); - return [2 /*return*/, io.loadWeights(manifest, modelBaseUri)]; - } - }); - }); - } - - /** - * Pads the smaller dimension of an image tensor with zeros, such that width === height. - * - * @param imgTensor The image tensor. - * @param isCenterImage (optional, default: false) If true, add an equal amount of padding on - * both sides of the minor dimension oof the image. - * @returns The padded tensor with width === height. - */ - function padToSquare(imgTensor, isCenterImage) { - if (isCenterImage === void 0) { isCenterImage = false; } - return tidy(function () { - var _a = imgTensor.shape.slice(1), height = _a[0], width = _a[1]; - if (height === width) { - return imgTensor; - } - var dimDiff = Math.abs(height - width); - var paddingAmount = Math.round(dimDiff * (isCenterImage ? 0.5 : 1)); - var paddingAxis = height > width ? 2 : 1; - var createPaddingTensor = function (paddingAmount) { - var paddingTensorShape = imgTensor.shape.slice(); - paddingTensorShape[paddingAxis] = paddingAmount; - return fill(paddingTensorShape, 0); - }; - var paddingTensorAppend = createPaddingTensor(paddingAmount); - var remainingPaddingAmount = dimDiff - paddingTensorAppend.shape[paddingAxis]; - var paddingTensorPrepend = isCenterImage && remainingPaddingAmount - ? createPaddingTensor(remainingPaddingAmount) - : null; - var tensorsToStack = [ - paddingTensorPrepend, - imgTensor, - paddingTensorAppend - ] - .filter(function (t) { return t !== null; }); - return concat(tensorsToStack, paddingAxis); - }); - } - - var NetInput = /** @class */ (function () { - function NetInput(inputs, treatAsBatchInput) { - if (treatAsBatchInput === void 0) { treatAsBatchInput = false; } - var _this = this; - this._imageTensors = []; - this._canvases = []; - this._treatAsBatchInput = false; - this._inputDimensions = []; - if (!Array.isArray(inputs)) { - throw new Error("NetInput.constructor - expected inputs to be an Array of TResolvedNetInput or to be instanceof tf.Tensor4D, instead have " + inputs); - } - this._treatAsBatchInput = treatAsBatchInput; - this._batchSize = inputs.length; - inputs.forEach(function (input, idx) { - if (isTensor3D(input)) { - _this._imageTensors[idx] = input; - _this._inputDimensions[idx] = input.shape; - return; - } - if (isTensor4D(input)) { - var batchSize = input.shape[0]; - if (batchSize !== 1) { - throw new Error("NetInput - tf.Tensor4D with batchSize " + batchSize + " passed, but not supported in input array"); - } - _this._imageTensors[idx] = input; - _this._inputDimensions[idx] = input.shape.slice(1); - return; - } - var canvas = input instanceof HTMLCanvasElement ? input : createCanvasFromMedia(input); - _this._canvases[idx] = canvas; - _this._inputDimensions[idx] = [canvas.height, canvas.width, 3]; - }); - } - Object.defineProperty(NetInput.prototype, "imageTensors", { - get: function () { - return this._imageTensors; - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(NetInput.prototype, "canvases", { - get: function () { - return this._canvases; - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(NetInput.prototype, "isBatchInput", { - get: function () { - return this.batchSize > 1 || this._treatAsBatchInput; - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(NetInput.prototype, "batchSize", { - get: function () { - return this._batchSize; - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(NetInput.prototype, "inputDimensions", { - get: function () { - return this._inputDimensions; - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(NetInput.prototype, "inputSize", { - get: function () { - return this._inputSize; - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(NetInput.prototype, "reshapedInputDimensions", { - get: function () { - var _this = this; - return range$1(this.batchSize, 0, 1).map(function (_, batchIdx) { return _this.getReshapedInputDimensions(batchIdx); }); - }, - enumerable: true, - configurable: true - }); - NetInput.prototype.getInput = function (batchIdx) { - return this.canvases[batchIdx] || this.imageTensors[batchIdx]; - }; - NetInput.prototype.getInputDimensions = function (batchIdx) { - return this._inputDimensions[batchIdx]; - }; - NetInput.prototype.getInputHeight = function (batchIdx) { - return this._inputDimensions[batchIdx][0]; - }; - NetInput.prototype.getInputWidth = function (batchIdx) { - return this._inputDimensions[batchIdx][1]; - }; - NetInput.prototype.getReshapedInputDimensions = function (batchIdx) { - if (typeof this.inputSize !== 'number') { - throw new Error('getReshapedInputDimensions - inputSize not set, toBatchTensor has not been called yet'); - } - var width = this.getInputWidth(batchIdx); - var height = this.getInputHeight(batchIdx); - return computeReshapedDimensions({ width: width, height: height }, this.inputSize); - }; - /** - * Create a batch tensor from all input canvases and tensors - * with size [batchSize, inputSize, inputSize, 3]. - * - * @param inputSize Height and width of the tensor. - * @param isCenterImage (optional, default: false) If true, add an equal amount of padding on - * both sides of the minor dimension oof the image. - * @returns The batch tensor. - */ - NetInput.prototype.toBatchTensor = function (inputSize, isCenterInputs) { - var _this = this; - if (isCenterInputs === void 0) { isCenterInputs = true; } - this._inputSize = inputSize; - return tidy(function () { - var inputTensors = range$1(_this.batchSize, 0, 1).map(function (batchIdx) { - var input = _this.getInput(batchIdx); - if (input instanceof Tensor) { - var imgTensor = isTensor4D(input) ? input : input.expandDims(); - imgTensor = padToSquare(imgTensor, isCenterInputs); - if (imgTensor.shape[1] !== inputSize || imgTensor.shape[2] !== inputSize) { - imgTensor = image_ops.resizeBilinear(imgTensor, [inputSize, inputSize]); - } - return imgTensor.as3D(inputSize, inputSize, 3); - } - if (input instanceof HTMLCanvasElement) { - return fromPixels(imageToSquare(input, inputSize, isCenterInputs)); - } - throw new Error("toBatchTensor - at batchIdx " + batchIdx + ", expected input to be instanceof tf.Tensor or instanceof HTMLCanvasElement, instead have " + input); - }); - var batchTensor = stack(inputTensors.map(function (t) { return t.toFloat(); })).as4D(_this.batchSize, inputSize, inputSize, 3); - return batchTensor; - }); - }; - return NetInput; - }()); - - /** - * Validates the input to make sure, they are valid net inputs and awaits all media elements - * to be finished loading. - * - * @param input The input, which can be a media element or an array of different media elements. - * @returns A NetInput instance, which can be passed into one of the neural networks. - */ - function toNetInput(inputs) { - return __awaiter$1(this, void 0, void 0, function () { - var inputArgArray, getIdxHint, inputArray; - return __generator$1(this, function (_a) { - switch (_a.label) { - case 0: - if (inputs instanceof NetInput) { - return [2 /*return*/, inputs]; - } - inputArgArray = Array.isArray(inputs) - ? inputs - : [inputs]; - if (!inputArgArray.length) { - throw new Error('toNetInput - empty array passed as input'); - } - getIdxHint = function (idx) { return Array.isArray(inputs) ? " at input index " + idx + ":" : ''; }; - inputArray = inputArgArray.map(resolveInput); - inputArray.forEach(function (input, i) { - if (!isMediaElement(input) && !isTensor3D(input) && !isTensor4D(input)) { - if (typeof inputArgArray[i] === 'string') { - throw new Error("toNetInput -" + getIdxHint(i) + " string passed, but could not resolve HTMLElement for element id " + inputArgArray[i]); - } - throw new Error("toNetInput -" + getIdxHint(i) + " expected media to be of type HTMLImageElement | HTMLVideoElement | HTMLCanvasElement | tf.Tensor3D, or to be an element id"); - } - if (isTensor4D(input)) { - // if tf.Tensor4D is passed in the input array, the batch size has to be 1 - var batchSize = input.shape[0]; - if (batchSize !== 1) { - throw new Error("toNetInput -" + getIdxHint(i) + " tf.Tensor4D with batchSize " + batchSize + " passed, but not supported in input array"); - } - } - }); - // wait for all media elements being loaded - return [4 /*yield*/, Promise.all(inputArray.map(function (input) { return isMediaElement(input) && awaitMediaLoaded(input); }))]; - case 1: - // wait for all media elements being loaded - _a.sent(); - return [2 /*return*/, new NetInput(inputArray, Array.isArray(inputs))]; - } - }); - }); - } - - function iou(box1, box2, isIOU) { - if (isIOU === void 0) { isIOU = true; } - var width = Math.max(0.0, Math.min(box1.right, box2.right) - Math.max(box1.left, box2.left)); - var height = Math.max(0.0, Math.min(box1.bottom, box2.bottom) - Math.max(box1.top, box2.top)); - var interSection = width * height; - return isIOU - ? interSection / (box1.area + box2.area - interSection) - : interSection / Math.min(box1.area, box2.area); - } - - function nonMaxSuppression$1(boxes, scores, iouThreshold, isIOU) { - if (isIOU === void 0) { isIOU = true; } - var indicesSortedByScore = scores - .map(function (score, boxIndex) { return ({ score: score, boxIndex: boxIndex }); }) - .sort(function (c1, c2) { return c1.score - c2.score; }) - .map(function (c) { return c.boxIndex; }); - var pick = []; - var _loop_1 = function () { - var curr = indicesSortedByScore.pop(); - pick.push(curr); - var indices = indicesSortedByScore; - var outputs = []; - for (var i = 0; i < indices.length; i++) { - var idx = indices[i]; - var currBox = boxes[curr]; - var idxBox = boxes[idx]; - outputs.push(iou(currBox, idxBox, isIOU)); - } - indicesSortedByScore = indicesSortedByScore.filter(function (_, j) { return outputs[j] <= iouThreshold; }); - }; - while (indicesSortedByScore.length > 0) { - _loop_1(); - } - return pick; - } - - function normalize(x, meanRgb) { - return tidy(function () { - var r = meanRgb[0], g = meanRgb[1], b = meanRgb[2]; - var avg_r = fill(x.shape.slice(0, 3).concat([1]), r); - var avg_g = fill(x.shape.slice(0, 3).concat([1]), g); - var avg_b = fill(x.shape.slice(0, 3).concat([1]), b); - var avg_rgb = concat([avg_r, avg_g, avg_b], 3); - return sub(x, avg_rgb); - }); - } - - function shuffleArray(inputArray) { - var array = inputArray.slice(); - for (var i = array.length - 1; i > 0; i--) { - var j = Math.floor(Math.random() * (i + 1)); - var x = array[i]; - array[i] = array[j]; - array[j] = x; - } - return array; - } - - function sigmoid$1(x) { - return 1 / (1 + Math.exp(-x)); - } - function inverseSigmoid(x) { - return Math.log(x / (1 - x)); - } - - var NeuralNetwork = /** @class */ (function () { - function NeuralNetwork(_name) { - this._name = _name; - this._params = undefined; - this._paramMappings = []; - } - Object.defineProperty(NeuralNetwork.prototype, "params", { - get: function () { return this._params; }, - enumerable: true, - configurable: true - }); - Object.defineProperty(NeuralNetwork.prototype, "paramMappings", { - get: function () { return this._paramMappings; }, - enumerable: true, - configurable: true - }); - Object.defineProperty(NeuralNetwork.prototype, "isLoaded", { - get: function () { return !!this.params; }, - enumerable: true, - configurable: true - }); - NeuralNetwork.prototype.getParamFromPath = function (paramPath) { - var _a = this.traversePropertyPath(paramPath), obj = _a.obj, objProp = _a.objProp; - return obj[objProp]; - }; - NeuralNetwork.prototype.reassignParamFromPath = function (paramPath, tensor$$1) { - var _a = this.traversePropertyPath(paramPath), obj = _a.obj, objProp = _a.objProp; - obj[objProp].dispose(); - obj[objProp] = tensor$$1; - }; - NeuralNetwork.prototype.getParamList = function () { - var _this = this; - return this._paramMappings.map(function (_a) { - var paramPath = _a.paramPath; - return ({ - path: paramPath, - tensor: _this.getParamFromPath(paramPath) - }); - }); - }; - NeuralNetwork.prototype.getTrainableParams = function () { - return this.getParamList().filter(function (param) { return param.tensor instanceof Variable; }); - }; - NeuralNetwork.prototype.getFrozenParams = function () { - return this.getParamList().filter(function (param) { return !(param.tensor instanceof Variable); }); - }; - NeuralNetwork.prototype.variable = function () { - var _this = this; - this.getFrozenParams().forEach(function (_a) { - var path = _a.path, tensor$$1 = _a.tensor; - _this.reassignParamFromPath(path, tensor$$1.variable()); - }); - }; - NeuralNetwork.prototype.freeze = function () { - var _this = this; - this.getTrainableParams().forEach(function (_a) { - var path = _a.path, variable$$1 = _a.tensor; - var tensor$$1 = tensor(variable$$1.dataSync()); - variable$$1.dispose(); - _this.reassignParamFromPath(path, tensor$$1); - }); - }; - NeuralNetwork.prototype.dispose = function (throwOnRedispose) { - if (throwOnRedispose === void 0) { throwOnRedispose = true; } - this.getParamList().forEach(function (param) { - if (throwOnRedispose && param.tensor.isDisposed) { - throw new Error("param tensor has already been disposed for path " + param.path); - } - param.tensor.dispose(); - }); - this._params = undefined; - }; - NeuralNetwork.prototype.serializeParams = function () { - return new Float32Array(this.getParamList() - .map(function (_a) { - var tensor$$1 = _a.tensor; - return Array.from(tensor$$1.dataSync()); - }) - .reduce(function (flat, arr) { return flat.concat(arr); })); - }; - NeuralNetwork.prototype.load = function (weightsOrUrl) { - return __awaiter$1(this, void 0, void 0, function () { - var _a, paramMappings, params; - return __generator$1(this, function (_b) { - switch (_b.label) { - case 0: - if (weightsOrUrl instanceof Float32Array) { - this.extractWeights(weightsOrUrl); - return [2 /*return*/]; - } - if (weightsOrUrl && typeof weightsOrUrl !== 'string') { - throw new Error(this._name + ".load - expected model uri, or weights as Float32Array"); - } - return [4 /*yield*/, this.loadQuantizedParams(weightsOrUrl)]; - case 1: - _a = _b.sent(), paramMappings = _a.paramMappings, params = _a.params; - this._paramMappings = paramMappings; - this._params = params; - return [2 /*return*/]; - } - }); - }); - }; - NeuralNetwork.prototype.extractWeights = function (weights) { - var _a = this.extractParams(weights), paramMappings = _a.paramMappings, params = _a.params; - this._paramMappings = paramMappings; - this._params = params; - }; - NeuralNetwork.prototype.traversePropertyPath = function (paramPath) { - if (!this.params) { - throw new Error("traversePropertyPath - model has no loaded params"); - } - var result = paramPath.split('/').reduce(function (res, objProp) { - if (!res.nextObj.hasOwnProperty(objProp)) { - throw new Error("traversePropertyPath - object does not have property " + objProp + ", for path " + paramPath); - } - return { obj: res.nextObj, objProp: objProp, nextObj: res.nextObj[objProp] }; - }, { nextObj: this.params }); - var obj = result.obj, objProp = result.objProp; - if (!obj || !objProp || !(obj[objProp] instanceof Tensor)) { - throw new Error("traversePropertyPath - parameter is not a tensor, for path " + paramPath); - } - return { obj: obj, objProp: objProp }; - }; - NeuralNetwork.prototype.loadQuantizedParams = function (_) { - throw new Error(this._name + ".loadQuantizedParams - not implemented"); - }; - NeuralNetwork.prototype.extractParams = function (_) { - throw new Error(this._name + ".extractParams - not implemented"); - }; - return NeuralNetwork; - }()); - - var FaceDetection = /** @class */ (function (_super) { - __extends$1(FaceDetection, _super); - function FaceDetection(score, relativeBox, imageDims) { - return _super.call(this, score, score, '', relativeBox, imageDims) || this; - } - return FaceDetection; - }(ObjectDetection)); - - var FaceDetectionWithLandmarks = /** @class */ (function () { - function FaceDetectionWithLandmarks(detection, unshiftedLandmarks) { - this._detection = detection; - this._unshiftedLandmarks = unshiftedLandmarks; - } - Object.defineProperty(FaceDetectionWithLandmarks.prototype, "detection", { - get: function () { return this._detection; }, - enumerable: true, - configurable: true - }); - Object.defineProperty(FaceDetectionWithLandmarks.prototype, "unshiftedLandmarks", { - get: function () { return this._unshiftedLandmarks; }, - enumerable: true, - configurable: true - }); - Object.defineProperty(FaceDetectionWithLandmarks.prototype, "alignedRect", { - get: function () { - var rect = this.landmarks.align(); - var imageDims = this.detection.imageDims; - return new FaceDetection(this._detection.score, rect.rescale(imageDims.reverse()), imageDims); - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(FaceDetectionWithLandmarks.prototype, "landmarks", { - get: function () { - var _a = this.detection.box, x = _a.x, y = _a.y; - return this._unshiftedLandmarks.shiftBy(x, y); - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(FaceDetectionWithLandmarks.prototype, "faceDetection", { - // aliases for backward compatibily - get: function () { return this.detection; }, - enumerable: true, - configurable: true - }); - Object.defineProperty(FaceDetectionWithLandmarks.prototype, "faceLandmarks", { - get: function () { return this.landmarks; }, - enumerable: true, - configurable: true - }); - FaceDetectionWithLandmarks.prototype.forSize = function (width, height) { - var resizedDetection = this._detection.forSize(width, height); - var resizedLandmarks = this._unshiftedLandmarks.forSize(resizedDetection.box.width, resizedDetection.box.height); - return new FaceDetectionWithLandmarks(resizedDetection, resizedLandmarks); - }; - return FaceDetectionWithLandmarks; - }()); - - // face alignment constants - var relX = 0.5; - var relY = 0.43; - var relScale = 0.45; - var FaceLandmarks = /** @class */ (function () { - function FaceLandmarks(relativeFaceLandmarkPositions, imgDims, shift) { - if (shift === void 0) { shift = new Point(0, 0); } - var width = imgDims.width, height = imgDims.height; - this._imgDims = new Dimensions(width, height); - this._shift = shift; - this._positions = relativeFaceLandmarkPositions.map(function (pt) { return pt.mul(new Point(width, height)).add(shift); }); - } - Object.defineProperty(FaceLandmarks.prototype, "shift", { - get: function () { return new Point(this._shift.x, this._shift.y); }, - enumerable: true, - configurable: true - }); - Object.defineProperty(FaceLandmarks.prototype, "imageWidth", { - get: function () { return this._imgDims.width; }, - enumerable: true, - configurable: true - }); - Object.defineProperty(FaceLandmarks.prototype, "imageHeight", { - get: function () { return this._imgDims.height; }, - enumerable: true, - configurable: true - }); - Object.defineProperty(FaceLandmarks.prototype, "positions", { - get: function () { return this._positions; }, - enumerable: true, - configurable: true - }); - Object.defineProperty(FaceLandmarks.prototype, "relativePositions", { - get: function () { - var _this = this; - return this._positions.map(function (pt) { return pt.sub(_this._shift).div(new Point(_this.imageWidth, _this.imageHeight)); }); - }, - enumerable: true, - configurable: true - }); - FaceLandmarks.prototype.forSize = function (width, height) { - return new this.constructor(this.relativePositions, { width: width, height: height }); - }; - FaceLandmarks.prototype.shiftBy = function (x, y) { - return new this.constructor(this.relativePositions, this._imgDims, new Point(x, y)); - }; - FaceLandmarks.prototype.shiftByPoint = function (pt) { - return this.shiftBy(pt.x, pt.y); - }; - /** - * Aligns the face landmarks after face detection from the relative positions of the faces - * bounding box, or it's current shift. This function should be used to align the face images - * after face detection has been performed, before they are passed to the face recognition net. - * This will make the computed face descriptor more accurate. - * - * @param detection (optional) The bounding box of the face or the face detection result. If - * no argument was passed the position of the face landmarks are assumed to be relative to - * it's current shift. - * @returns The bounding box of the aligned face. - */ - FaceLandmarks.prototype.align = function (detection) { - if (detection) { - var box = detection instanceof FaceDetection - ? detection.box.floor() - : detection; - return this.shiftBy(box.x, box.y).align(); - } - var centers = this.getRefPointsForAlignment(); - var leftEyeCenter = centers[0], rightEyeCenter = centers[1], mouthCenter = centers[2]; - var distToMouth = function (pt) { return mouthCenter.sub(pt).magnitude(); }; - var eyeToMouthDist = (distToMouth(leftEyeCenter) + distToMouth(rightEyeCenter)) / 2; - var size = Math.floor(eyeToMouthDist / relScale); - var refPoint = getCenterPoint(centers); - // TODO: pad in case rectangle is out of image bounds - var x = Math.floor(Math.max(0, refPoint.x - (relX * size))); - var y = Math.floor(Math.max(0, refPoint.y - (relY * size))); - return new Rect(x, y, Math.min(size, this.imageWidth + x), Math.min(size, this.imageHeight + y)); - }; - FaceLandmarks.prototype.getRefPointsForAlignment = function () { - throw new Error('getRefPointsForAlignment not implemented by base class'); - }; - return FaceLandmarks; - }()); - - var FaceLandmarks5 = /** @class */ (function (_super) { - __extends$1(FaceLandmarks5, _super); - function FaceLandmarks5() { - return _super !== null && _super.apply(this, arguments) || this; - } - FaceLandmarks5.prototype.getRefPointsForAlignment = function () { - var pts = this.positions; - return [ - pts[0], - pts[1], - getCenterPoint([pts[3], pts[4]]) - ]; - }; - return FaceLandmarks5; - }(FaceLandmarks)); - - var FaceLandmarks68 = /** @class */ (function (_super) { - __extends$1(FaceLandmarks68, _super); - function FaceLandmarks68() { - return _super !== null && _super.apply(this, arguments) || this; - } - FaceLandmarks68.prototype.getJawOutline = function () { - return this.positions.slice(0, 17); - }; - FaceLandmarks68.prototype.getLeftEyeBrow = function () { - return this.positions.slice(17, 22); - }; - FaceLandmarks68.prototype.getRightEyeBrow = function () { - return this.positions.slice(22, 27); - }; - FaceLandmarks68.prototype.getNose = function () { - return this.positions.slice(27, 36); - }; - FaceLandmarks68.prototype.getLeftEye = function () { - return this.positions.slice(36, 42); - }; - FaceLandmarks68.prototype.getRightEye = function () { - return this.positions.slice(42, 48); - }; - FaceLandmarks68.prototype.getMouth = function () { - return this.positions.slice(48, 68); - }; - FaceLandmarks68.prototype.getRefPointsForAlignment = function () { - return [ - this.getLeftEye(), - this.getRightEye(), - this.getMouth() - ].map(getCenterPoint); - }; - return FaceLandmarks68; - }(FaceLandmarks)); - - var FaceMatch = /** @class */ (function () { - function FaceMatch(label, distance) { - this._label = label; - this._distance = distance; - } - Object.defineProperty(FaceMatch.prototype, "label", { - get: function () { return this._label; }, - enumerable: true, - configurable: true - }); - Object.defineProperty(FaceMatch.prototype, "distance", { - get: function () { return this._distance; }, - enumerable: true, - configurable: true - }); - FaceMatch.prototype.toString = function (withDistance) { - if (withDistance === void 0) { withDistance = true; } - return "" + this.label + (withDistance ? " (" + round$1(this.distance) + ")" : ''); - }; - return FaceMatch; - }()); - - var FullFaceDescription = /** @class */ (function (_super) { - __extends$1(FullFaceDescription, _super); - function FullFaceDescription(detection, unshiftedLandmarks, descriptor) { - var _this = _super.call(this, detection, unshiftedLandmarks) || this; - _this._descriptor = descriptor; - return _this; - } - Object.defineProperty(FullFaceDescription.prototype, "descriptor", { - get: function () { - return this._descriptor; - }, - enumerable: true, - configurable: true - }); - FullFaceDescription.prototype.forSize = function (width, height) { - var _a = _super.prototype.forSize.call(this, width, height), detection = _a.detection, landmarks = _a.landmarks; - return new FullFaceDescription(detection, landmarks, this.descriptor); - }; - return FullFaceDescription; - }(FaceDetectionWithLandmarks)); - - var LabeledFaceDescriptors = /** @class */ (function () { - function LabeledFaceDescriptors(label, descriptors) { - if (!(typeof label === 'string')) { - throw new Error('LabeledFaceDescriptors - constructor expected label to be a string'); - } - if (!Array.isArray(descriptors) || descriptors.some(function (desc) { return !(desc instanceof Float32Array); })) { - throw new Error('LabeledFaceDescriptors - constructor expected descriptors to be an array of Float32Array'); - } - this._label = label; - this._descriptors = descriptors; - } - Object.defineProperty(LabeledFaceDescriptors.prototype, "label", { - get: function () { return this._label; }, - enumerable: true, - configurable: true - }); - Object.defineProperty(LabeledFaceDescriptors.prototype, "descriptors", { - get: function () { return this._descriptors; }, - enumerable: true, - configurable: true - }); - return LabeledFaceDescriptors; - }()); - - function drawContour(ctx, points, isClosed) { - if (isClosed === void 0) { isClosed = false; } - ctx.beginPath(); - points.slice(1).forEach(function (_a, prevIdx) { - var x = _a.x, y = _a.y; - var from = points[prevIdx]; - ctx.moveTo(from.x, from.y); - ctx.lineTo(x, y); - }); - if (isClosed) { - var from = points[points.length - 1]; - var to = points[0]; - if (!from || !to) { - return; - } - ctx.moveTo(from.x, from.y); - ctx.lineTo(to.x, to.y); - } - ctx.stroke(); - } - - function drawLandmarks(canvasArg, faceLandmarks, options) { - var canvas = resolveInput(canvasArg); - if (!(canvas instanceof HTMLCanvasElement)) { - throw new Error('drawLandmarks - expected canvas to be of type: HTMLCanvasElement'); - } - var drawOptions = Object.assign(getDefaultDrawOptions(options), (options || {})); - var drawLines = Object.assign({ drawLines: false }, (options || {})).drawLines; - var ctx = getContext2dOrThrow(canvas); - var lineWidth = drawOptions.lineWidth, _a = drawOptions.color, color = _a === void 0 ? 'blue' : _a; - var faceLandmarksArray = Array.isArray(faceLandmarks) ? faceLandmarks : [faceLandmarks]; - faceLandmarksArray.forEach(function (landmarks) { - if (drawLines && landmarks instanceof FaceLandmarks68) { - ctx.strokeStyle = color; - ctx.lineWidth = lineWidth; - drawContour(ctx, landmarks.getJawOutline()); - drawContour(ctx, landmarks.getLeftEyeBrow()); - drawContour(ctx, landmarks.getRightEyeBrow()); - drawContour(ctx, landmarks.getNose()); - drawContour(ctx, landmarks.getLeftEye(), true); - drawContour(ctx, landmarks.getRightEye(), true); - drawContour(ctx, landmarks.getMouth(), true); - return; - } - // else draw points - var ptOffset = lineWidth / 2; - ctx.fillStyle = color; - landmarks.positions.forEach(function (pt) { return ctx.fillRect(pt.x - ptOffset, pt.y - ptOffset, lineWidth, lineWidth); }); - }); - } - - /** - * Extracts the image regions containing the detected faces. - * - * @param input The image that face detection has been performed on. - * @param detections The face detection results or face bounding boxes for that image. - * @returns The Canvases of the corresponding image region for each detected face. - */ - function extractFaces(input, detections) { - return __awaiter$1(this, void 0, void 0, function () { - var canvas, netInput, tensorOrCanvas, _a, ctx, boxes; - return __generator$1(this, function (_b) { - switch (_b.label) { - case 0: - canvas = input; - if (!!(input instanceof HTMLCanvasElement)) return [3 /*break*/, 5]; - return [4 /*yield*/, toNetInput(input)]; - case 1: - netInput = _b.sent(); - if (netInput.batchSize > 1) { - throw new Error('extractFaces - batchSize > 1 not supported'); - } - tensorOrCanvas = netInput.getInput(0); - if (!(tensorOrCanvas instanceof HTMLCanvasElement)) return [3 /*break*/, 2]; - _a = tensorOrCanvas; - return [3 /*break*/, 4]; - case 2: return [4 /*yield*/, imageTensorToCanvas(tensorOrCanvas)]; - case 3: - _a = _b.sent(); - _b.label = 4; - case 4: - canvas = _a; - _b.label = 5; - case 5: - ctx = getContext2dOrThrow(canvas); - boxes = detections.map(function (det) { return det instanceof FaceDetection - ? det.forSize(canvas.width, canvas.height).box.floor() - : det; }) - .map(function (box) { return box.clipAtImageBorders(canvas.width, canvas.height); }); - return [2 /*return*/, boxes.map(function (_a) { - var x = _a.x, y = _a.y, width = _a.width, height = _a.height; - var faceImg = createCanvas({ width: width, height: height }); - getContext2dOrThrow(faceImg) - .putImageData(ctx.getImageData(x, y, width, height), 0, 0); - return faceImg; - })]; - } - }); - }); - } - - /** - * Extracts the tensors of the image regions containing the detected faces. - * Useful if you want to compute the face descriptors for the face images. - * Using this method is faster then extracting a canvas for each face and - * converting them to tensors individually. - * - * @param imageTensor The image tensor that face detection has been performed on. - * @param detections The face detection results or face bounding boxes for that image. - * @returns Tensors of the corresponding image region for each detected face. - */ - function extractFaceTensors(imageTensor, detections) { - return __awaiter$1(this, void 0, void 0, function () { - return __generator$1(this, function (_a) { - if (isTensor4D(imageTensor) && imageTensor.shape[0] > 1) { - throw new Error('extractFaceTensors - batchSize > 1 not supported'); - } - return [2 /*return*/, tidy(function () { - var _a = imageTensor.shape.slice(isTensor4D(imageTensor) ? 1 : 0), imgHeight = _a[0], imgWidth = _a[1], numChannels = _a[2]; - var boxes = detections.map(function (det) { return det instanceof FaceDetection - ? det.forSize(imgWidth, imgHeight).box - : det; }) - .map(function (box) { return box.clipAtImageBorders(imgWidth, imgHeight); }); - var faceTensors = boxes.map(function (_a) { - var x = _a.x, y = _a.y, width = _a.width, height = _a.height; - return slice3d(imageTensor.as3D(imgHeight, imgWidth, numChannels), [y, x, 0], [height, width, numChannels]); - }); - return faceTensors; - })]; - }); - }); - } - - function depthwiseSeparableConv(x, params, stride) { - return tidy(function () { - var out = separableConv2d(x, params.depthwise_filter, params.pointwise_filter, stride, 'same'); - out = add(out, params.bias); - return out; - }); - } - - function convLayer(x, params, padding, withRelu) { - if (padding === void 0) { padding = 'same'; } - if (withRelu === void 0) { withRelu = false; } - return tidy(function () { - var out = add(conv2d(x, params.filters, [1, 1], padding), params.bias); - return withRelu ? relu(out) : out; - }); - } - - function extractConvParamsFactory(extractWeights, paramMappings) { - return function (channelsIn, channelsOut, filterSize, mappedPrefix) { - var filters = tensor4d(extractWeights(channelsIn * channelsOut * filterSize * filterSize), [filterSize, filterSize, channelsIn, channelsOut]); - var bias = tensor1d(extractWeights(channelsOut)); - paramMappings.push({ paramPath: mappedPrefix + "/filters" }, { paramPath: mappedPrefix + "/bias" }); - return { filters: filters, bias: bias }; - }; - } - - function extractFCParamsFactory(extractWeights, paramMappings) { - return function (channelsIn, channelsOut, mappedPrefix) { - var fc_weights = tensor2d(extractWeights(channelsIn * channelsOut), [channelsIn, channelsOut]); - var fc_bias = tensor1d(extractWeights(channelsOut)); - paramMappings.push({ paramPath: mappedPrefix + "/weights" }, { paramPath: mappedPrefix + "/bias" }); - return { - weights: fc_weights, - bias: fc_bias - }; - }; - } - - var SeparableConvParams = /** @class */ (function () { - function SeparableConvParams(depthwise_filter, pointwise_filter, bias) { - this.depthwise_filter = depthwise_filter; - this.pointwise_filter = pointwise_filter; - this.bias = bias; - } - return SeparableConvParams; - }()); - - function extractSeparableConvParamsFactory(extractWeights, paramMappings) { - return function (channelsIn, channelsOut, mappedPrefix) { - var depthwise_filter = tensor4d(extractWeights(3 * 3 * channelsIn), [3, 3, channelsIn, 1]); - var pointwise_filter = tensor4d(extractWeights(channelsIn * channelsOut), [1, 1, channelsIn, channelsOut]); - var bias = tensor1d(extractWeights(channelsOut)); - paramMappings.push({ paramPath: mappedPrefix + "/depthwise_filter" }, { paramPath: mappedPrefix + "/pointwise_filter" }, { paramPath: mappedPrefix + "/bias" }); - return new SeparableConvParams(depthwise_filter, pointwise_filter, bias); - }; - } - function loadSeparableConvParamsFactory(extractWeightEntry) { - return function (prefix) { - var depthwise_filter = extractWeightEntry(prefix + "/depthwise_filter", 4); - var pointwise_filter = extractWeightEntry(prefix + "/pointwise_filter", 4); - var bias = extractWeightEntry(prefix + "/bias", 1); - return new SeparableConvParams(depthwise_filter, pointwise_filter, bias); - }; - } - - var isNumber = function (arg) { return typeof arg === 'number'; }; - function validateConfig(config) { - if (!config) { - throw new Error("invalid config: " + config); - } - if (typeof config.withSeparableConvs !== 'boolean') { - throw new Error("config.withSeparableConvs has to be a boolean, have: " + config.withSeparableConvs); - } - if (!isNumber(config.iouThreshold) || config.iouThreshold < 0 || config.iouThreshold > 1.0) { - throw new Error("config.iouThreshold has to be a number between [0, 1], have: " + config.iouThreshold); - } - if (!Array.isArray(config.classes) - || !config.classes.length - || !config.classes.every(function (c) { return typeof c === 'string'; })) { - throw new Error("config.classes has to be an array class names: string[], have: " + JSON.stringify(config.classes)); - } - if (!Array.isArray(config.anchors) - || !config.anchors.length - || !config.anchors.map(function (a) { return a || {}; }).every(function (a) { return isNumber(a.x) && isNumber(a.y); })) { - throw new Error("config.anchors has to be an array of { x: number, y: number }, have: " + JSON.stringify(config.anchors)); - } - if (config.meanRgb && (!Array.isArray(config.meanRgb) - || config.meanRgb.length !== 3 - || !config.meanRgb.every(isNumber))) { - throw new Error("config.meanRgb has to be an array of shape [number, number, number], have: " + JSON.stringify(config.meanRgb)); - } - } - function validateTrainConfig(config) { - if (![config.noObjectScale, config.objectScale, config.coordScale, config.classScale].every(isNumber)) { - throw new Error("for training you have to specify noObjectScale, objectScale, coordScale, classScale parameters in your config.json file"); - } - return config; - } - - var CELL_SIZE = 32; - var DEFAULT_FILTER_SIZES = [ - 3, 16, 32, 64, 128, 256, 512, 1024, 1024 - ]; - - function leaky(x) { - return tidy(function () { - var min$$1 = mul(x, scalar(0.10000000149011612)); - return add(relu(sub(x, min$$1)), min$$1); - //return tf.maximum(x, min) - }); - } - - function convWithBatchNorm(x, params) { - return tidy(function () { - var out = pad(x, [[0, 0], [1, 1], [1, 1], [0, 0]]); - out = conv2d(out, params.conv.filters, [1, 1], 'valid'); - out = sub(out, params.bn.sub); - out = mul(out, params.bn.truediv); - out = add(out, params.conv.bias); - return leaky(out); - }); - } - - function depthwiseSeparableConv$1(x, params) { - return tidy(function () { - var out = pad(x, [[0, 0], [1, 1], [1, 1], [0, 0]]); - out = separableConv2d(out, params.depthwise_filter, params.pointwise_filter, [1, 1], 'valid'); - out = add(out, params.bias); - return leaky(out); - }); - } - - function extractorsFactory(extractWeights, paramMappings) { - var extractConvParams = extractConvParamsFactory(extractWeights, paramMappings); - function extractBatchNormParams(size, mappedPrefix) { - var sub$$1 = tensor1d(extractWeights(size)); - var truediv = tensor1d(extractWeights(size)); - paramMappings.push({ paramPath: mappedPrefix + "/sub" }, { paramPath: mappedPrefix + "/truediv" }); - return { sub: sub$$1, truediv: truediv }; - } - function extractConvWithBatchNormParams(channelsIn, channelsOut, mappedPrefix) { - var conv = extractConvParams(channelsIn, channelsOut, 3, mappedPrefix + "/conv"); - var bn = extractBatchNormParams(channelsOut, mappedPrefix + "/bn"); - return { conv: conv, bn: bn }; - } - var extractSeparableConvParams = extractSeparableConvParamsFactory(extractWeights, paramMappings); - return { - extractConvParams: extractConvParams, - extractConvWithBatchNormParams: extractConvWithBatchNormParams, - extractSeparableConvParams: extractSeparableConvParams - }; - } - function extractParams(weights, config, boxEncodingSize, filterSizes) { - var _a = extractWeightsFactory(weights), extractWeights = _a.extractWeights, getRemainingWeights = _a.getRemainingWeights; - var paramMappings = []; - var _b = extractorsFactory(extractWeights, paramMappings), extractConvParams = _b.extractConvParams, extractConvWithBatchNormParams = _b.extractConvWithBatchNormParams, extractSeparableConvParams = _b.extractSeparableConvParams; - var params; - if (config.withSeparableConvs) { - var s0 = filterSizes[0], s1 = filterSizes[1], s2 = filterSizes[2], s3 = filterSizes[3], s4 = filterSizes[4], s5 = filterSizes[5], s6 = filterSizes[6], s7 = filterSizes[7], s8 = filterSizes[8]; - var conv0 = config.isFirstLayerConv2d - ? extractConvParams(s0, s1, 3, 'conv0') - : extractSeparableConvParams(s0, s1, 'conv0'); - var conv1 = extractSeparableConvParams(s1, s2, 'conv1'); - var conv2 = extractSeparableConvParams(s2, s3, 'conv2'); - var conv3 = extractSeparableConvParams(s3, s4, 'conv3'); - var conv4 = extractSeparableConvParams(s4, s5, 'conv4'); - var conv5 = extractSeparableConvParams(s5, s6, 'conv5'); - var conv6 = s7 ? extractSeparableConvParams(s6, s7, 'conv6') : undefined; - var conv7 = s8 ? extractSeparableConvParams(s7, s8, 'conv7') : undefined; - var conv8 = extractConvParams(s8 || s7 || s6, 5 * boxEncodingSize, 1, 'conv8'); - params = { conv0: conv0, conv1: conv1, conv2: conv2, conv3: conv3, conv4: conv4, conv5: conv5, conv6: conv6, conv7: conv7, conv8: conv8 }; - } - else { - var s0 = filterSizes[0], s1 = filterSizes[1], s2 = filterSizes[2], s3 = filterSizes[3], s4 = filterSizes[4], s5 = filterSizes[5], s6 = filterSizes[6], s7 = filterSizes[7], s8 = filterSizes[8]; - var conv0 = extractConvWithBatchNormParams(s0, s1, 'conv0'); - var conv1 = extractConvWithBatchNormParams(s1, s2, 'conv1'); - var conv2 = extractConvWithBatchNormParams(s2, s3, 'conv2'); - var conv3 = extractConvWithBatchNormParams(s3, s4, 'conv3'); - var conv4 = extractConvWithBatchNormParams(s4, s5, 'conv4'); - var conv5 = extractConvWithBatchNormParams(s5, s6, 'conv5'); - var conv6 = extractConvWithBatchNormParams(s6, s7, 'conv6'); - var conv7 = extractConvWithBatchNormParams(s7, s8, 'conv7'); - var conv8 = extractConvParams(s8, 5 * boxEncodingSize, 1, 'conv8'); - params = { conv0: conv0, conv1: conv1, conv2: conv2, conv3: conv3, conv4: conv4, conv5: conv5, conv6: conv6, conv7: conv7, conv8: conv8 }; - } - if (getRemainingWeights().length !== 0) { - throw new Error("weights remaing after extract: " + getRemainingWeights().length); - } - return { params: params, paramMappings: paramMappings }; - } - - function extractorsFactory$1(weightMap, paramMappings) { - var extractWeightEntry = extractWeightEntryFactory(weightMap, paramMappings); - function extractBatchNormParams(prefix) { - var sub = extractWeightEntry(prefix + "/sub", 1); - var truediv = extractWeightEntry(prefix + "/truediv", 1); - return { sub: sub, truediv: truediv }; - } - function extractConvParams(prefix) { - var filters = extractWeightEntry(prefix + "/filters", 4); - var bias = extractWeightEntry(prefix + "/bias", 1); - return { filters: filters, bias: bias }; - } - function extractConvWithBatchNormParams(prefix) { - var conv = extractConvParams(prefix + "/conv"); - var bn = extractBatchNormParams(prefix + "/bn"); - return { conv: conv, bn: bn }; - } - var extractSeparableConvParams = loadSeparableConvParamsFactory(extractWeightEntry); - return { - extractConvParams: extractConvParams, - extractConvWithBatchNormParams: extractConvWithBatchNormParams, - extractSeparableConvParams: extractSeparableConvParams - }; - } - function loadQuantizedParams(uri, config, defaultModelName) { - if (defaultModelName === void 0) { defaultModelName = ''; } - return __awaiter$1(this, void 0, void 0, function () { - var weightMap, paramMappings, _a, extractConvParams, extractConvWithBatchNormParams, extractSeparableConvParams, params, numFilters; - return __generator$1(this, function (_b) { - switch (_b.label) { - case 0: return [4 /*yield*/, loadWeightMap(uri, defaultModelName)]; - case 1: - weightMap = _b.sent(); - paramMappings = []; - _a = extractorsFactory$1(weightMap, paramMappings), extractConvParams = _a.extractConvParams, extractConvWithBatchNormParams = _a.extractConvWithBatchNormParams, extractSeparableConvParams = _a.extractSeparableConvParams; - if (config.withSeparableConvs) { - numFilters = (config.filterSizes && config.filterSizes.length || 9); - params = { - conv0: config.isFirstLayerConv2d ? extractConvParams('conv0') : extractSeparableConvParams('conv0'), - conv1: extractSeparableConvParams('conv1'), - conv2: extractSeparableConvParams('conv2'), - conv3: extractSeparableConvParams('conv3'), - conv4: extractSeparableConvParams('conv4'), - conv5: extractSeparableConvParams('conv5'), - conv6: numFilters > 7 ? extractSeparableConvParams('conv6') : undefined, - conv7: numFilters > 8 ? extractSeparableConvParams('conv7') : undefined, - conv8: extractConvParams('conv8') - }; - } - else { - params = { - conv0: extractConvWithBatchNormParams('conv0'), - conv1: extractConvWithBatchNormParams('conv1'), - conv2: extractConvWithBatchNormParams('conv2'), - conv3: extractConvWithBatchNormParams('conv3'), - conv4: extractConvWithBatchNormParams('conv4'), - conv5: extractConvWithBatchNormParams('conv5'), - conv6: extractConvWithBatchNormParams('conv6'), - conv7: extractConvWithBatchNormParams('conv7'), - conv8: extractConvParams('conv8') - }; - } - disposeUnusedWeightTensors(weightMap, paramMappings); - return [2 /*return*/, { params: params, paramMappings: paramMappings }]; - } - }); - }); - } - - var TinyYolov2SizeType; - (function (TinyYolov2SizeType) { - TinyYolov2SizeType[TinyYolov2SizeType["XS"] = 224] = "XS"; - TinyYolov2SizeType[TinyYolov2SizeType["SM"] = 320] = "SM"; - TinyYolov2SizeType[TinyYolov2SizeType["MD"] = 416] = "MD"; - TinyYolov2SizeType[TinyYolov2SizeType["LG"] = 608] = "LG"; - })(TinyYolov2SizeType || (TinyYolov2SizeType = {})); - var TinyYolov2Options = /** @class */ (function () { - function TinyYolov2Options(_a) { - var _b = _a === void 0 ? {} : _a, inputSize = _b.inputSize, scoreThreshold = _b.scoreThreshold; - this._name = 'TinyYolov2Options'; - this._inputSize = inputSize || 416; - this._scoreThreshold = scoreThreshold || 0.5; - if (typeof this._inputSize !== 'number' || this._inputSize % 32 !== 0) { - throw new Error(this._name + " - expected inputSize to be a number divisible by 32"); - } - if (typeof this._scoreThreshold !== 'number' || this._scoreThreshold <= 0 || this._scoreThreshold >= 1) { - throw new Error(this._name + " - expected scoreThreshold to be a number between 0 and 1"); - } - } - Object.defineProperty(TinyYolov2Options.prototype, "inputSize", { - get: function () { return this._inputSize; }, - enumerable: true, - configurable: true - }); - Object.defineProperty(TinyYolov2Options.prototype, "scoreThreshold", { - get: function () { return this._scoreThreshold; }, - enumerable: true, - configurable: true - }); - return TinyYolov2Options; - }()); - - var TinyYolov2 = /** @class */ (function (_super) { - __extends$1(TinyYolov2, _super); - function TinyYolov2(config) { - var _this = _super.call(this, 'TinyYolov2') || this; - validateConfig(config); - _this._config = config; - return _this; - } - Object.defineProperty(TinyYolov2.prototype, "config", { - get: function () { - return this._config; - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(TinyYolov2.prototype, "withClassScores", { - get: function () { - return this.config.withClassScores || this.config.classes.length > 1; - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(TinyYolov2.prototype, "boxEncodingSize", { - get: function () { - return 5 + (this.withClassScores ? this.config.classes.length : 0); - }, - enumerable: true, - configurable: true - }); - TinyYolov2.prototype.runTinyYolov2 = function (x, params) { - var out = convWithBatchNorm(x, params.conv0); - out = maxPool(out, [2, 2], [2, 2], 'same'); - out = convWithBatchNorm(out, params.conv1); - out = maxPool(out, [2, 2], [2, 2], 'same'); - out = convWithBatchNorm(out, params.conv2); - out = maxPool(out, [2, 2], [2, 2], 'same'); - out = convWithBatchNorm(out, params.conv3); - out = maxPool(out, [2, 2], [2, 2], 'same'); - out = convWithBatchNorm(out, params.conv4); - out = maxPool(out, [2, 2], [2, 2], 'same'); - out = convWithBatchNorm(out, params.conv5); - out = maxPool(out, [2, 2], [1, 1], 'same'); - out = convWithBatchNorm(out, params.conv6); - out = convWithBatchNorm(out, params.conv7); - return convLayer(out, params.conv8, 'valid', false); - }; - TinyYolov2.prototype.runMobilenet = function (x, params) { - var out = this.config.isFirstLayerConv2d - ? leaky(convLayer(x, params.conv0, 'valid', false)) - : depthwiseSeparableConv$1(x, params.conv0); - out = maxPool(out, [2, 2], [2, 2], 'same'); - out = depthwiseSeparableConv$1(out, params.conv1); - out = maxPool(out, [2, 2], [2, 2], 'same'); - out = depthwiseSeparableConv$1(out, params.conv2); - out = maxPool(out, [2, 2], [2, 2], 'same'); - out = depthwiseSeparableConv$1(out, params.conv3); - out = maxPool(out, [2, 2], [2, 2], 'same'); - out = depthwiseSeparableConv$1(out, params.conv4); - out = maxPool(out, [2, 2], [2, 2], 'same'); - out = depthwiseSeparableConv$1(out, params.conv5); - out = maxPool(out, [2, 2], [1, 1], 'same'); - out = params.conv6 ? depthwiseSeparableConv$1(out, params.conv6) : out; - out = params.conv7 ? depthwiseSeparableConv$1(out, params.conv7) : out; - return convLayer(out, params.conv8, 'valid', false); - }; - TinyYolov2.prototype.forwardInput = function (input, inputSize) { - var _this = this; - var params = this.params; - if (!params) { - throw new Error('TinyYolov2 - load model before inference'); - } - return tidy(function () { - var batchTensor = input.toBatchTensor(inputSize, false).toFloat(); - batchTensor = _this.config.meanRgb - ? normalize(batchTensor, _this.config.meanRgb) - : batchTensor; - batchTensor = batchTensor.div(scalar(256)); - return _this.config.withSeparableConvs - ? _this.runMobilenet(batchTensor, params) - : _this.runTinyYolov2(batchTensor, params); - }); - }; - TinyYolov2.prototype.forward = function (input, inputSize) { - return __awaiter$1(this, void 0, void 0, function () { - var _a; - return __generator$1(this, function (_b) { - switch (_b.label) { - case 0: - _a = this.forwardInput; - return [4 /*yield*/, toNetInput(input)]; - case 1: return [4 /*yield*/, _a.apply(this, [_b.sent(), inputSize])]; - case 2: return [2 /*return*/, _b.sent()]; - } - }); - }); - }; - TinyYolov2.prototype.detect = function (input, forwardParams) { - if (forwardParams === void 0) { forwardParams = {}; } - return __awaiter$1(this, void 0, void 0, function () { - var _this = this; - var _a, inputSize, scoreThreshold, netInput, out, out0, inputDimensions, results, boxes, scores, classScores, classNames, indices, detections; - return __generator$1(this, function (_b) { - switch (_b.label) { - case 0: - _a = new TinyYolov2Options(forwardParams), inputSize = _a.inputSize, scoreThreshold = _a.scoreThreshold; - return [4 /*yield*/, toNetInput(input)]; - case 1: - netInput = _b.sent(); - return [4 /*yield*/, this.forwardInput(netInput, inputSize)]; - case 2: - out = _b.sent(); - out0 = tidy(function () { return unstack(out)[0].expandDims(); }); - inputDimensions = { - width: netInput.getInputWidth(0), - height: netInput.getInputHeight(0) - }; - results = this.extractBoxes(out0, netInput.getReshapedInputDimensions(0), scoreThreshold); - out.dispose(); - out0.dispose(); - boxes = results.map(function (res) { return res.box; }); - scores = results.map(function (res) { return res.score; }); - classScores = results.map(function (res) { return res.classScore; }); - classNames = results.map(function (res) { return _this.config.classes[res.label]; }); - indices = nonMaxSuppression$1(boxes.map(function (box) { return box.rescale(inputSize); }), scores, this.config.iouThreshold, true); - detections = indices.map(function (idx) { - return new ObjectDetection(scores[idx], classScores[idx], classNames[idx], boxes[idx], inputDimensions); - }); - return [2 /*return*/, detections]; - } - }); - }); - }; - TinyYolov2.prototype.loadQuantizedParams = function (modelUri, defaultModelName) { - if (defaultModelName === void 0) { defaultModelName = ''; } - if (!modelUri) { - throw new Error('loadQuantizedParams - please specify the modelUri'); - } - return loadQuantizedParams(modelUri, this.config, defaultModelName); - }; - TinyYolov2.prototype.extractParams = function (weights) { - var filterSizes = this.config.filterSizes || DEFAULT_FILTER_SIZES; - var numFilters = filterSizes ? filterSizes.length : undefined; - if (numFilters !== 7 && numFilters !== 8 && numFilters !== 9) { - throw new Error("TinyYolov2 - expected 7 | 8 | 9 convolutional filters, but found " + numFilters + " filterSizes in config"); - } - return extractParams(weights, this.config, this.boxEncodingSize, filterSizes); - }; - TinyYolov2.prototype.extractBoxes = function (outputTensor, inputBlobDimensions, scoreThreshold) { - var _this = this; - var width = inputBlobDimensions.width, height = inputBlobDimensions.height; - var inputSize = Math.max(width, height); - var correctionFactorX = inputSize / width; - var correctionFactorY = inputSize / height; - var numCells = outputTensor.shape[1]; - var numBoxes = this.config.anchors.length; - var _a = tidy(function () { - var reshaped = outputTensor.reshape([numCells, numCells, numBoxes, _this.boxEncodingSize]); - var boxes = reshaped.slice([0, 0, 0, 0], [numCells, numCells, numBoxes, 4]); - var scores = reshaped.slice([0, 0, 0, 4], [numCells, numCells, numBoxes, 1]); - var classScores = _this.withClassScores - ? softmax(reshaped.slice([0, 0, 0, 5], [numCells, numCells, numBoxes, _this.config.classes.length]), 3) - : scalar(0); - return [boxes, scores, classScores]; - }), boxesTensor = _a[0], scoresTensor = _a[1], classScoresTensor = _a[2]; - var results = []; - for (var row = 0; row < numCells; row++) { - for (var col = 0; col < numCells; col++) { - for (var anchor = 0; anchor < numBoxes; anchor++) { - var score = sigmoid$1(scoresTensor.get(row, col, anchor, 0)); - if (!scoreThreshold || score > scoreThreshold) { - var ctX = ((col + sigmoid$1(boxesTensor.get(row, col, anchor, 0))) / numCells) * correctionFactorX; - var ctY = ((row + sigmoid$1(boxesTensor.get(row, col, anchor, 1))) / numCells) * correctionFactorY; - var width_1 = ((Math.exp(boxesTensor.get(row, col, anchor, 2)) * this.config.anchors[anchor].x) / numCells) * correctionFactorX; - var height_1 = ((Math.exp(boxesTensor.get(row, col, anchor, 3)) * this.config.anchors[anchor].y) / numCells) * correctionFactorY; - var x = (ctX - (width_1 / 2)); - var y = (ctY - (height_1 / 2)); - var pos = { row: row, col: col, anchor: anchor }; - var _b = this.withClassScores - ? this.extractPredictedClass(classScoresTensor, pos) - : { classScore: 1, label: 0 }, classScore = _b.classScore, label = _b.label; - results.push(__assign$1({ box: new BoundingBox(x, y, x + width_1, y + height_1), score: score, classScore: score * classScore, label: label }, pos)); - } - } - } - } - boxesTensor.dispose(); - scoresTensor.dispose(); - classScoresTensor.dispose(); - return results; - }; - TinyYolov2.prototype.extractPredictedClass = function (classesTensor, pos) { - var row = pos.row, col = pos.col, anchor = pos.anchor; - return Array(this.config.classes.length).fill(0) - .map(function (_, i) { return classesTensor.get(row, col, anchor, i); }) - .map(function (classScore, label) { return ({ - classScore: classScore, - label: label - }); }) - .reduce(function (max$$1, curr) { return max$$1.classScore > curr.classScore ? max$$1 : curr; }); - }; - return TinyYolov2; - }(NeuralNetwork)); - - var TinyYolov2LossFunction = /** @class */ (function () { - function TinyYolov2LossFunction(outputTensor, groundTruth, predictedBoxes, reshapedImgDims, config) { - this._config = config; - this._reshapedImgDims = reshapedImgDims; - this._outputTensor = outputTensor; - this._predictedBoxes = predictedBoxes; - this.validateGroundTruthBoxes(groundTruth); - this._groundTruth = this.assignGroundTruthToAnchors(groundTruth); - var groundTruthMask = this.createGroundTruthMask(); - var _a = this.createCoordAndScoreMasks(), coordBoxOffsetMask = _a.coordBoxOffsetMask, coordBoxSizeMask = _a.coordBoxSizeMask, scoreMask = _a.scoreMask; - this.noObjectLossMask = tidy(function () { return mul(scoreMask, sub(scalar(1), groundTruthMask)); }); - this.objectLossMask = tidy(function () { return mul(scoreMask, groundTruthMask); }); - this.coordBoxOffsetMask = tidy(function () { return mul(coordBoxOffsetMask, groundTruthMask); }); - this.coordBoxSizeMask = tidy(function () { return mul(coordBoxSizeMask, groundTruthMask); }); - var classScoresMask = tidy(function () { return sub(scalar(1), coordBoxOffsetMask.add(coordBoxSizeMask).add(scoreMask)); }); - this.groundTruthClassScoresMask = tidy(function () { return mul(classScoresMask, groundTruthMask); }); - } - Object.defineProperty(TinyYolov2LossFunction.prototype, "config", { - get: function () { - return this._config; - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(TinyYolov2LossFunction.prototype, "reshapedImgDims", { - get: function () { - return this._reshapedImgDims; - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(TinyYolov2LossFunction.prototype, "outputTensor", { - get: function () { - return this._outputTensor; - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(TinyYolov2LossFunction.prototype, "groundTruth", { - get: function () { - return this._groundTruth; - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(TinyYolov2LossFunction.prototype, "predictedBoxes", { - get: function () { - return this._predictedBoxes; - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(TinyYolov2LossFunction.prototype, "inputSize", { - get: function () { - return Math.max(this.reshapedImgDims.width, this.reshapedImgDims.height); - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(TinyYolov2LossFunction.prototype, "withClassScores", { - get: function () { - return this._config.withClassScores || this._config.classes.length > 1; - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(TinyYolov2LossFunction.prototype, "boxEncodingSize", { - get: function () { - return 5 + (this.withClassScores ? this._config.classes.length : 0); - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(TinyYolov2LossFunction.prototype, "anchors", { - get: function () { - return this._config.anchors; - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(TinyYolov2LossFunction.prototype, "numBoxes", { - get: function () { - return this.anchors.length; - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(TinyYolov2LossFunction.prototype, "numCells", { - get: function () { - return this.inputSize / CELL_SIZE; - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(TinyYolov2LossFunction.prototype, "gridCellEncodingSize", { - get: function () { - return this.boxEncodingSize * this.numBoxes; - }, - enumerable: true, - configurable: true - }); - TinyYolov2LossFunction.prototype.toOutputTensorShape = function (tensor$$1) { - var _this = this; - return tidy(function () { return tensor$$1.reshape([1, _this.numCells, _this.numCells, _this.gridCellEncodingSize]); }); - }; - TinyYolov2LossFunction.prototype.computeLoss = function () { - var _this = this; - return tidy(function () { - var noObjectLoss = _this.computeNoObjectLoss(); - var objectLoss = _this.computeObjectLoss(); - var coordLoss = _this.computeCoordLoss(); - var classLoss = _this.withClassScores - ? _this.computeClassLoss() - : scalar(0); - var totalLoss = tidy(function () { return noObjectLoss.add(objectLoss).add(coordLoss).add(classLoss); }); - return { - noObjectLoss: noObjectLoss, - objectLoss: objectLoss, - coordLoss: coordLoss, - classLoss: classLoss, - totalLoss: totalLoss - }; - }); - }; - TinyYolov2LossFunction.prototype.computeNoObjectLoss = function () { - var _this = this; - return tidy(function () { - return _this.computeLossTerm(_this.config.noObjectScale, _this.toOutputTensorShape(_this.noObjectLossMask), sigmoid(_this.outputTensor)); - }); - }; - TinyYolov2LossFunction.prototype.computeObjectLoss = function () { - var _this = this; - return tidy(function () { - return _this.computeLossTerm(_this.config.objectScale, _this.toOutputTensorShape(_this.objectLossMask), sub(_this.toOutputTensorShape(_this.computeIous()), sigmoid(_this.outputTensor))); - }); - }; - TinyYolov2LossFunction.prototype.computeClassLoss = function () { - var _this = this; - return tidy(function () { - var classLossTensor = tidy(function () { - var predClassScores = mul(softmax(_this.outputTensor.reshape([_this.numCells, _this.numCells, _this.numBoxes, _this.boxEncodingSize]), 3), _this.groundTruthClassScoresMask); - var gtClassScores = _this.createOneHotClassScoreMask(); - return sub(gtClassScores, predClassScores); - }); - return _this.computeLossTerm(_this.config.classScale, scalar(1), classLossTensor); - }); - }; - TinyYolov2LossFunction.prototype.computeCoordLoss = function () { - var _this = this; - return tidy(function () { - return _this.computeLossTerm(_this.config.coordScale, scalar(1), add(_this.computeCoordBoxOffsetError(), _this.computeCoordBoxSizeError())); - }); - }; - TinyYolov2LossFunction.prototype.computeCoordBoxOffsetError = function () { - var _this = this; - return tidy(function () { - var mask = _this.toOutputTensorShape(_this.coordBoxOffsetMask); - var gtBoxOffsets = mul(mask, _this.toOutputTensorShape(_this.computeCoordBoxOffsets())); - var predBoxOffsets = mul(mask, sigmoid(_this.outputTensor)); - return sub(gtBoxOffsets, predBoxOffsets); - }); - }; - TinyYolov2LossFunction.prototype.computeCoordBoxSizeError = function () { - var _this = this; - return tidy(function () { - var mask = _this.toOutputTensorShape(_this.coordBoxSizeMask); - var gtBoxSizes = mul(mask, _this.toOutputTensorShape(_this.computeCoordBoxSizes())); - var predBoxSizes = mul(mask, _this.outputTensor); - return sub(gtBoxSizes, predBoxSizes); - }); - }; - TinyYolov2LossFunction.prototype.computeLossTerm = function (scale, mask, lossTensor) { - var _this = this; - return tidy(function () { return mul(scalar(scale), _this.squaredSumOverMask(mask, lossTensor)); }); - }; - TinyYolov2LossFunction.prototype.squaredSumOverMask = function (mask, lossTensor) { - return tidy(function () { return sum(square(mul(mask, lossTensor))); }); - }; - TinyYolov2LossFunction.prototype.validateGroundTruthBoxes = function (groundTruth) { - var _this = this; - groundTruth.forEach(function (_a) { - var x = _a.x, y = _a.y, width = _a.width, height = _a.height, label = _a.label; - if (typeof label !== 'number' || label < 0 || label > (_this.config.classes.length - 1)) { - throw new Error("invalid ground truth data, expected label to be a number in [0, " + (_this.config.classes.length - 1) + "]"); - } - if (x < 0 || x > 1 || y < 0 || y > 1 || width < 0 || (x + width) > 1 || height < 0 || (y + height) > 1) { - throw new Error("invalid ground truth data, box is out of image boundaries " + JSON.stringify({ x: x, y: y, width: width, height: height })); - } - }); - }; - TinyYolov2LossFunction.prototype.assignGroundTruthToAnchors = function (groundTruth) { - var _this = this; - var groundTruthBoxes = groundTruth - .map(function (_a) { - var x = _a.x, y = _a.y, width = _a.width, height = _a.height, label = _a.label; - return ({ - box: new Rect(x, y, width, height), - label: label - }); - }); - return groundTruthBoxes.map(function (_a) { - var box = _a.box, label = _a.label; - var _b = box.rescale(_this.reshapedImgDims), left = _b.left, top = _b.top, bottom = _b.bottom, right = _b.right, x = _b.x, y = _b.y, width = _b.width, height = _b.height; - var ctX = left + (width / 2); - var ctY = top + (height / 2); - var col = Math.floor((ctX / _this.inputSize) * _this.numCells); - var row = Math.floor((ctY / _this.inputSize) * _this.numCells); - var anchorsByIou = _this.anchors.map(function (anchor, idx) { return ({ - idx: idx, - iou: iou(new BoundingBox(0, 0, anchor.x * CELL_SIZE, anchor.y * CELL_SIZE), new BoundingBox(0, 0, width, height)) - }); }).sort(function (a1, a2) { return a2.iou - a1.iou; }); - var anchor = anchorsByIou[0].idx; - return { row: row, col: col, anchor: anchor, box: box, label: label }; - }); - }; - TinyYolov2LossFunction.prototype.createGroundTruthMask = function () { - var _this = this; - var mask = zeros([this.numCells, this.numCells, this.numBoxes, this.boxEncodingSize]); - var buf = mask.buffer(); - this.groundTruth.forEach(function (_a) { - var row = _a.row, col = _a.col, anchor = _a.anchor; - for (var i = 0; i < _this.boxEncodingSize; i++) { - buf.set(1, row, col, anchor, i); - } - }); - return mask; - }; - TinyYolov2LossFunction.prototype.createCoordAndScoreMasks = function () { - var _this = this; - return tidy(function () { - var coordBoxOffsetMask = zeros([_this.numCells, _this.numCells, _this.numBoxes, _this.boxEncodingSize]); - var coordBoxSizeMask = zeros([_this.numCells, _this.numCells, _this.numBoxes, _this.boxEncodingSize]); - var scoreMask = zeros([_this.numCells, _this.numCells, _this.numBoxes, _this.boxEncodingSize]); - var coordBoxOffsetBuf = coordBoxOffsetMask.buffer(); - var coordBoxSizeBuf = coordBoxSizeMask.buffer(); - var scoreBuf = scoreMask.buffer(); - for (var row = 0; row < _this.numCells; row++) { - for (var col = 0; col < _this.numCells; col++) { - for (var anchor = 0; anchor < _this.numBoxes; anchor++) { - coordBoxOffsetBuf.set(1, row, col, anchor, 0); - coordBoxOffsetBuf.set(1, row, col, anchor, 1); - coordBoxSizeBuf.set(1, row, col, anchor, 2); - coordBoxSizeBuf.set(1, row, col, anchor, 3); - scoreBuf.set(1, row, col, anchor, 4); - } - } - } - return { coordBoxOffsetMask: coordBoxOffsetMask, coordBoxSizeMask: coordBoxSizeMask, scoreMask: scoreMask }; - }); - }; - TinyYolov2LossFunction.prototype.createOneHotClassScoreMask = function () { - var mask = zeros([this.numCells, this.numCells, this.numBoxes, this.boxEncodingSize]); - var buf = mask.buffer(); - var classValuesOffset = 5; - this.groundTruth.forEach(function (_a) { - var row = _a.row, col = _a.col, anchor = _a.anchor, label = _a.label; - buf.set(1, row, col, anchor, classValuesOffset + label); - }); - return mask; - }; - TinyYolov2LossFunction.prototype.computeIous = function () { - var _this = this; - var isSameAnchor = function (p1) { return function (p2) { - return p1.row === p2.row - && p1.col === p2.col - && p1.anchor === p2.anchor; - }; }; - var ious = zeros([this.numCells, this.numCells, this.gridCellEncodingSize]); - var buf = ious.buffer(); - this.groundTruth.forEach(function (_a) { - var row = _a.row, col = _a.col, anchor = _a.anchor, box = _a.box; - var predBox = _this.predictedBoxes.find(isSameAnchor({ row: row, col: col, anchor: anchor })); - if (!predBox) { - throw new Error("no output box found for: row " + row + ", col " + col + ", anchor " + anchor); - } - var boxIou = iou(box.rescale(_this.reshapedImgDims), predBox.box.rescale(_this.reshapedImgDims)); - var anchorOffset = _this.boxEncodingSize * anchor; - var scoreValueOffset = 4; - buf.set(boxIou, row, col, anchorOffset + scoreValueOffset); - }); - return ious; - }; - TinyYolov2LossFunction.prototype.computeCoordBoxOffsets = function () { - var _this = this; - var offsets = zeros([this.numCells, this.numCells, this.numBoxes, this.boxEncodingSize]); - var buf = offsets.buffer(); - this.groundTruth.forEach(function (_a) { - var row = _a.row, col = _a.col, anchor = _a.anchor, box = _a.box; - var _b = box.rescale(_this.reshapedImgDims), left = _b.left, top = _b.top, right = _b.right, bottom = _b.bottom; - var centerX = (left + right) / 2; - var centerY = (top + bottom) / 2; - var dCenterX = centerX - (col * CELL_SIZE); - var dCenterY = centerY - (row * CELL_SIZE); - // inverseSigmoid(0) === -Infinity, inverseSigmoid(1) === Infinity - //const dx = inverseSigmoid(Math.min(0.999, Math.max(0.001, dCenterX / CELL_SIZE))) - //const dy = inverseSigmoid(Math.min(0.999, Math.max(0.001, dCenterY / CELL_SIZE))) - var dx = dCenterX / CELL_SIZE; - var dy = dCenterY / CELL_SIZE; - buf.set(dx, row, col, anchor, 0); - buf.set(dy, row, col, anchor, 1); - }); - return offsets; - }; - TinyYolov2LossFunction.prototype.computeCoordBoxSizes = function () { - var _this = this; - var sizes = zeros([this.numCells, this.numCells, this.numBoxes, this.boxEncodingSize]); - var buf = sizes.buffer(); - this.groundTruth.forEach(function (_a) { - var row = _a.row, col = _a.col, anchor = _a.anchor, box = _a.box; - var _b = box.rescale(_this.reshapedImgDims), width = _b.width, height = _b.height; - var dw = Math.log(width / (_this.anchors[anchor].x * CELL_SIZE)); - var dh = Math.log(height / (_this.anchors[anchor].y * CELL_SIZE)); - buf.set(dw, row, col, anchor, 2); - buf.set(dh, row, col, anchor, 3); - }); - return sizes; - }; - return TinyYolov2LossFunction; - }()); - - function getDefaultBackwardOptions(options) { - return Object.assign({}, { - minBoxSize: CELL_SIZE - }, options); - } - - var TinyYolov2Trainable = /** @class */ (function (_super) { - __extends$1(TinyYolov2Trainable, _super); - function TinyYolov2Trainable(trainableConfig, optimizer) { - var _this = _super.call(this, trainableConfig) || this; - _this._trainableConfig = validateTrainConfig(trainableConfig); - _this._optimizer = optimizer; - return _this; - } - Object.defineProperty(TinyYolov2Trainable.prototype, "trainableConfig", { - get: function () { - return this._trainableConfig; - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(TinyYolov2Trainable.prototype, "optimizer", { - get: function () { - return this._optimizer; - }, - enumerable: true, - configurable: true - }); - TinyYolov2Trainable.prototype.backward = function (img, groundTruth, inputSize, options) { - if (options === void 0) { options = {}; } - return __awaiter$1(this, void 0, void 0, function () { - var _this = this; - var _a, minBoxSize, reportLosses, reshapedImgDims, filteredGroundTruthBoxes, netInput, loss; - return __generator$1(this, function (_b) { - switch (_b.label) { - case 0: - _a = getDefaultBackwardOptions(options), minBoxSize = _a.minBoxSize, reportLosses = _a.reportLosses; - reshapedImgDims = computeReshapedDimensions(getMediaDimensions(img), inputSize); - filteredGroundTruthBoxes = this.filterGroundTruthBoxes(groundTruth, reshapedImgDims, minBoxSize); - if (!filteredGroundTruthBoxes.length) { - return [2 /*return*/, null]; - } - return [4 /*yield*/, toNetInput(imageToSquare(img, inputSize))]; - case 1: - netInput = _b.sent(); - loss = this.optimizer.minimize(function () { - var _a = _this.computeLoss(_this.forwardInput(netInput, inputSize), filteredGroundTruthBoxes, reshapedImgDims), noObjectLoss = _a.noObjectLoss, objectLoss = _a.objectLoss, coordLoss = _a.coordLoss, classLoss = _a.classLoss, totalLoss = _a.totalLoss; - if (reportLosses) { - var losses = { - totalLoss: totalLoss.dataSync()[0], - noObjectLoss: noObjectLoss.dataSync()[0], - objectLoss: objectLoss.dataSync()[0], - coordLoss: coordLoss.dataSync()[0], - classLoss: classLoss.dataSync()[0] - }; - var report = { - losses: losses, - numBoxes: filteredGroundTruthBoxes.length, - inputSize: inputSize - }; - reportLosses(report); - } - return totalLoss; - }, true); - return [2 /*return*/, loss]; - } - }); - }); - }; - TinyYolov2Trainable.prototype.computeLoss = function (outputTensor, groundTruth, reshapedImgDims) { - var config = validateTrainConfig(this.config); - var inputSize = Math.max(reshapedImgDims.width, reshapedImgDims.height); - if (!inputSize) { - throw new Error("computeLoss - invalid inputSize: " + inputSize); - } - var predictedBoxes = this.extractBoxes(outputTensor, reshapedImgDims); - return tidy(function () { - var lossFunction = new TinyYolov2LossFunction(outputTensor, groundTruth, predictedBoxes, reshapedImgDims, config); - return lossFunction.computeLoss(); - }); - }; - TinyYolov2Trainable.prototype.filterGroundTruthBoxes = function (groundTruth, imgDims, minBoxSize) { - var imgHeight = imgDims.height, imgWidth = imgDims.width; - return groundTruth.filter(function (_a) { - var x = _a.x, y = _a.y, width = _a.width, height = _a.height; - var box = (new Rect(x, y, width, height)) - .rescale({ height: imgHeight, width: imgWidth }); - var isTooTiny = box.width < minBoxSize || box.height < minBoxSize; - return !isTooTiny; - }); - }; - TinyYolov2Trainable.prototype.load = function (weightsOrUrl) { - return __awaiter$1(this, void 0, void 0, function () { - return __generator$1(this, function (_a) { - switch (_a.label) { - case 0: return [4 /*yield*/, _super.prototype.load.call(this, weightsOrUrl)]; - case 1: - _a.sent(); - this.variable(); - return [2 /*return*/]; - } - }); - }); - }; - return TinyYolov2Trainable; - }(TinyYolov2)); - - function extractorsFactory$2(extractWeights, paramMappings) { - function extractSeparableConvParams(channelsIn, channelsOut, mappedPrefix) { - var depthwise_filter = tensor4d(extractWeights(3 * 3 * channelsIn), [3, 3, channelsIn, 1]); - var pointwise_filter = tensor4d(extractWeights(channelsIn * channelsOut), [1, 1, channelsIn, channelsOut]); - var bias = tensor1d(extractWeights(channelsOut)); - paramMappings.push({ paramPath: mappedPrefix + "/depthwise_filter" }, { paramPath: mappedPrefix + "/pointwise_filter" }, { paramPath: mappedPrefix + "/bias" }); - return new SeparableConvParams(depthwise_filter, pointwise_filter, bias); - } - function extractFCParams(channelsIn, channelsOut, mappedPrefix) { - var weights = tensor2d(extractWeights(channelsIn * channelsOut), [channelsIn, channelsOut]); - var bias = tensor1d(extractWeights(channelsOut)); - paramMappings.push({ paramPath: mappedPrefix + "/weights" }, { paramPath: mappedPrefix + "/bias" }); - return { - weights: weights, - bias: bias - }; - } - var extractConvParams = extractConvParamsFactory(extractWeights, paramMappings); - function extractDenseBlock3Params(channelsIn, channelsOut, mappedPrefix, isFirstLayer) { - if (isFirstLayer === void 0) { isFirstLayer = false; } - var conv0 = isFirstLayer - ? extractConvParams(channelsIn, channelsOut, 3, mappedPrefix + "/conv0") - : extractSeparableConvParams(channelsIn, channelsOut, mappedPrefix + "/conv0"); - var conv1 = extractSeparableConvParams(channelsOut, channelsOut, mappedPrefix + "/conv1"); - var conv2 = extractSeparableConvParams(channelsOut, channelsOut, mappedPrefix + "/conv2"); - return { conv0: conv0, conv1: conv1, conv2: conv2 }; - } - function extractDenseBlock4Params(channelsIn, channelsOut, mappedPrefix, isFirstLayer) { - if (isFirstLayer === void 0) { isFirstLayer = false; } - var _a = extractDenseBlock3Params(channelsIn, channelsOut, mappedPrefix, isFirstLayer), conv0 = _a.conv0, conv1 = _a.conv1, conv2 = _a.conv2; - var conv3 = extractSeparableConvParams(channelsOut, channelsOut, mappedPrefix + "/conv3"); - return { conv0: conv0, conv1: conv1, conv2: conv2, conv3: conv3 }; - } - return { - extractDenseBlock3Params: extractDenseBlock3Params, - extractDenseBlock4Params: extractDenseBlock4Params, - extractFCParams: extractFCParams - }; - } - - function extractParams$1(weights) { - var paramMappings = []; - var _a = extractWeightsFactory(weights), extractWeights = _a.extractWeights, getRemainingWeights = _a.getRemainingWeights; - var _b = extractorsFactory$2(extractWeights, paramMappings), extractDenseBlock4Params = _b.extractDenseBlock4Params, extractFCParams = _b.extractFCParams; - var dense0 = extractDenseBlock4Params(3, 32, 'dense0', true); - var dense1 = extractDenseBlock4Params(32, 64, 'dense1'); - var dense2 = extractDenseBlock4Params(64, 128, 'dense2'); - var dense3 = extractDenseBlock4Params(128, 256, 'dense3'); - var fc = extractFCParams(256, 136, 'fc'); - if (getRemainingWeights().length !== 0) { - throw new Error("weights remaing after extract: " + getRemainingWeights().length); - } - return { - paramMappings: paramMappings, - params: { dense0: dense0, dense1: dense1, dense2: dense2, dense3: dense3, fc: fc } - }; - } - - var FaceLandmark68NetBase = /** @class */ (function (_super) { - __extends$1(FaceLandmark68NetBase, _super); - function FaceLandmark68NetBase(_name) { - var _this = _super.call(this, _name) || this; - _this.__name = _name; - return _this; - } - FaceLandmark68NetBase.prototype.runNet = function (_) { - throw new Error(this.__name + " - runNet not implemented"); - }; - FaceLandmark68NetBase.prototype.postProcess = function (output, inputSize, originalDimensions) { - var inputDimensions = originalDimensions.map(function (_a) { - var width = _a.width, height = _a.height; - var scale = inputSize / Math.max(height, width); - return { - width: width * scale, - height: height * scale - }; - }); - var batchSize = inputDimensions.length; - return tidy(function () { - var createInterleavedTensor = function (fillX, fillY) { - return stack([ - fill([68], fillX), - fill([68], fillY) - ], 1).as2D(1, 136).as1D(); - }; - var getPadding = function (batchIdx, cond) { - var _a = inputDimensions[batchIdx], width = _a.width, height = _a.height; - return cond(width, height) ? Math.abs(width - height) / 2 : 0; - }; - var getPaddingX = function (batchIdx) { return getPadding(batchIdx, function (w, h) { return w < h; }); }; - var getPaddingY = function (batchIdx) { return getPadding(batchIdx, function (w, h) { return h < w; }); }; - var landmarkTensors = output - .mul(fill([batchSize, 136], inputSize)) - .sub(stack(Array.from(Array(batchSize), function (_, batchIdx) { - return createInterleavedTensor(getPaddingX(batchIdx), getPaddingY(batchIdx)); - }))) - .div(stack(Array.from(Array(batchSize), function (_, batchIdx) { - return createInterleavedTensor(inputDimensions[batchIdx].width, inputDimensions[batchIdx].height); - }))); - return landmarkTensors; - }); - }; - FaceLandmark68NetBase.prototype.forwardInput = function (input) { - var _this = this; - return tidy(function () { - var out = _this.runNet(input); - return _this.postProcess(out, input.inputSize, input.inputDimensions.map(function (_a) { - var height = _a[0], width = _a[1]; - return ({ height: height, width: width }); - })); - }); - }; - FaceLandmark68NetBase.prototype.forward = function (input) { - return __awaiter$1(this, void 0, void 0, function () { - var _a; - return __generator$1(this, function (_b) { - switch (_b.label) { - case 0: - _a = this.forwardInput; - return [4 /*yield*/, toNetInput(input)]; - case 1: return [2 /*return*/, _a.apply(this, [_b.sent()])]; - } - }); - }); - }; - FaceLandmark68NetBase.prototype.detectLandmarks = function (input) { - return __awaiter$1(this, void 0, void 0, function () { - var _this = this; - var netInput, landmarkTensors, landmarksForBatch; - return __generator$1(this, function (_a) { - switch (_a.label) { - case 0: return [4 /*yield*/, toNetInput(input)]; - case 1: - netInput = _a.sent(); - landmarkTensors = tidy(function () { return unstack(_this.forwardInput(netInput)); }); - return [4 /*yield*/, Promise.all(landmarkTensors.map(function (landmarkTensor, batchIdx) { return __awaiter$1(_this, void 0, void 0, function () { - var landmarksArray, _a, _b, xCoords, yCoords; - return __generator$1(this, function (_c) { - switch (_c.label) { - case 0: - _b = (_a = Array).from; - return [4 /*yield*/, landmarkTensor.data()]; - case 1: - landmarksArray = _b.apply(_a, [_c.sent()]); - xCoords = landmarksArray.filter(function (_, i) { return isEven(i); }); - yCoords = landmarksArray.filter(function (_, i) { return !isEven(i); }); - return [2 /*return*/, new FaceLandmarks68(Array(68).fill(0).map(function (_, i) { return new Point(xCoords[i], yCoords[i]); }), { - height: netInput.getInputHeight(batchIdx), - width: netInput.getInputWidth(batchIdx), - })]; - } - }); - }); }))]; - case 2: - landmarksForBatch = _a.sent(); - landmarkTensors.forEach(function (t) { return t.dispose(); }); - return [2 /*return*/, netInput.isBatchInput - ? landmarksForBatch - : landmarksForBatch[0]]; - } - }); - }); - }; - return FaceLandmark68NetBase; - }(NeuralNetwork)); - - function fullyConnectedLayer(x, params) { - return tidy(function () { - return add(matMul(x, params.weights), params.bias); - }); - } - - function loadParamsFactory(weightMap, paramMappings) { - var extractWeightEntry = extractWeightEntryFactory(weightMap, paramMappings); - function extractConvParams(prefix) { - var filters = extractWeightEntry(prefix + "/filters", 4); - var bias = extractWeightEntry(prefix + "/bias", 1); - return { filters: filters, bias: bias }; - } - function extractSeparableConvParams(prefix) { - var depthwise_filter = extractWeightEntry(prefix + "/depthwise_filter", 4); - var pointwise_filter = extractWeightEntry(prefix + "/pointwise_filter", 4); - var bias = extractWeightEntry(prefix + "/bias", 1); - return new SeparableConvParams(depthwise_filter, pointwise_filter, bias); - } - function extractDenseBlock3Params(prefix, isFirstLayer) { - if (isFirstLayer === void 0) { isFirstLayer = false; } - var conv0 = isFirstLayer - ? extractConvParams(prefix + "/conv0") - : extractSeparableConvParams(prefix + "/conv0"); - var conv1 = extractSeparableConvParams(prefix + "/conv1"); - var conv2 = extractSeparableConvParams(prefix + "/conv2"); - return { conv0: conv0, conv1: conv1, conv2: conv2 }; - } - function extractDenseBlock4Params(prefix, isFirstLayer) { - if (isFirstLayer === void 0) { isFirstLayer = false; } - var conv0 = isFirstLayer - ? extractConvParams(prefix + "/conv0") - : extractSeparableConvParams(prefix + "/conv0"); - var conv1 = extractSeparableConvParams(prefix + "/conv1"); - var conv2 = extractSeparableConvParams(prefix + "/conv2"); - var conv3 = extractSeparableConvParams(prefix + "/conv3"); - return { conv0: conv0, conv1: conv1, conv2: conv2, conv3: conv3 }; - } - function extractFcParams(prefix) { - var weights = extractWeightEntry(prefix + "/weights", 2); - var bias = extractWeightEntry(prefix + "/bias", 1); - return { weights: weights, bias: bias }; - } - return { - extractDenseBlock3Params: extractDenseBlock3Params, - extractDenseBlock4Params: extractDenseBlock4Params, - extractFcParams: extractFcParams - }; - } - - var DEFAULT_MODEL_NAME = 'face_landmark_68_model'; - function loadQuantizedParams$1(uri) { - return __awaiter$1(this, void 0, void 0, function () { - var weightMap, paramMappings, _a, extractDenseBlock4Params, extractFcParams, params; - return __generator$1(this, function (_b) { - switch (_b.label) { - case 0: return [4 /*yield*/, loadWeightMap(uri, DEFAULT_MODEL_NAME)]; - case 1: - weightMap = _b.sent(); - paramMappings = []; - _a = loadParamsFactory(weightMap, paramMappings), extractDenseBlock4Params = _a.extractDenseBlock4Params, extractFcParams = _a.extractFcParams; - params = { - dense0: extractDenseBlock4Params('dense0', true), - dense1: extractDenseBlock4Params('dense1'), - dense2: extractDenseBlock4Params('dense2'), - dense3: extractDenseBlock4Params('dense3'), - fc: extractFcParams('fc') - }; - disposeUnusedWeightTensors(weightMap, paramMappings); - return [2 /*return*/, { params: params, paramMappings: paramMappings }]; - } - }); - }); - } - - function denseBlock(x, denseBlockParams, isFirstLayer) { - if (isFirstLayer === void 0) { isFirstLayer = false; } - return tidy(function () { - var out1 = relu(isFirstLayer - ? add(conv2d(x, denseBlockParams.conv0.filters, [2, 2], 'same'), denseBlockParams.conv0.bias) - : depthwiseSeparableConv(x, denseBlockParams.conv0, [2, 2])); - var out2 = depthwiseSeparableConv(out1, denseBlockParams.conv1, [1, 1]); - var in3 = relu(add(out1, out2)); - var out3 = depthwiseSeparableConv(in3, denseBlockParams.conv2, [1, 1]); - var in4 = relu(add(out1, add(out2, out3))); - var out4 = depthwiseSeparableConv(in4, denseBlockParams.conv3, [1, 1]); - return relu(add(out1, add(out2, add(out3, out4)))); - }); - } - var FaceLandmark68Net = /** @class */ (function (_super) { - __extends$1(FaceLandmark68Net, _super); - function FaceLandmark68Net() { - return _super.call(this, 'FaceLandmark68Net') || this; - } - FaceLandmark68Net.prototype.runNet = function (input) { - var params = this.params; - if (!params) { - throw new Error('FaceLandmark68Net - load model before inference'); - } - return tidy(function () { - var batchTensor = input.toBatchTensor(112, true); - var meanRgb = [122.782, 117.001, 104.298]; - var normalized = normalize(batchTensor, meanRgb).div(scalar(255)); - var out = denseBlock(normalized, params.dense0, true); - out = denseBlock(out, params.dense1); - out = denseBlock(out, params.dense2); - out = denseBlock(out, params.dense3); - out = avgPool(out, [7, 7], [2, 2], 'valid'); - return fullyConnectedLayer(out.as2D(out.shape[0], -1), params.fc); - }); - }; - FaceLandmark68Net.prototype.loadQuantizedParams = function (uri) { - return loadQuantizedParams$1(uri); - }; - FaceLandmark68Net.prototype.extractParams = function (weights) { - return extractParams$1(weights); - }; - return FaceLandmark68Net; - }(FaceLandmark68NetBase)); - - function extractParamsTiny(weights) { - var paramMappings = []; - var _a = extractWeightsFactory(weights), extractWeights = _a.extractWeights, getRemainingWeights = _a.getRemainingWeights; - var _b = extractorsFactory$2(extractWeights, paramMappings), extractDenseBlock3Params = _b.extractDenseBlock3Params, extractFCParams = _b.extractFCParams; - var dense0 = extractDenseBlock3Params(3, 32, 'dense0', true); - var dense1 = extractDenseBlock3Params(32, 64, 'dense1'); - var dense2 = extractDenseBlock3Params(64, 128, 'dense2'); - var fc = extractFCParams(128, 136, 'fc'); - if (getRemainingWeights().length !== 0) { - throw new Error("weights remaing after extract: " + getRemainingWeights().length); - } - return { - paramMappings: paramMappings, - params: { dense0: dense0, dense1: dense1, dense2: dense2, fc: fc } - }; - } - - var DEFAULT_MODEL_NAME$1 = 'face_landmark_68_tiny_model'; - function loadQuantizedParamsTiny(uri) { - return __awaiter$1(this, void 0, void 0, function () { - var weightMap, paramMappings, _a, extractDenseBlock3Params, extractFcParams, params; - return __generator$1(this, function (_b) { - switch (_b.label) { - case 0: return [4 /*yield*/, loadWeightMap(uri, DEFAULT_MODEL_NAME$1)]; - case 1: - weightMap = _b.sent(); - paramMappings = []; - _a = loadParamsFactory(weightMap, paramMappings), extractDenseBlock3Params = _a.extractDenseBlock3Params, extractFcParams = _a.extractFcParams; - params = { - dense0: extractDenseBlock3Params('dense0', true), - dense1: extractDenseBlock3Params('dense1'), - dense2: extractDenseBlock3Params('dense2'), - fc: extractFcParams('fc') - }; - disposeUnusedWeightTensors(weightMap, paramMappings); - return [2 /*return*/, { params: params, paramMappings: paramMappings }]; - } - }); - }); - } - - function denseBlock$1(x, denseBlockParams, isFirstLayer) { - if (isFirstLayer === void 0) { isFirstLayer = false; } - return tidy(function () { - var out1 = relu(isFirstLayer - ? add(conv2d(x, denseBlockParams.conv0.filters, [2, 2], 'same'), denseBlockParams.conv0.bias) - : depthwiseSeparableConv(x, denseBlockParams.conv0, [2, 2])); - var out2 = depthwiseSeparableConv(out1, denseBlockParams.conv1, [1, 1]); - var in3 = relu(add(out1, out2)); - var out3 = depthwiseSeparableConv(in3, denseBlockParams.conv2, [1, 1]); - return relu(add(out1, add(out2, out3))); - }); - } - var FaceLandmark68TinyNet = /** @class */ (function (_super) { - __extends$1(FaceLandmark68TinyNet, _super); - function FaceLandmark68TinyNet() { - return _super.call(this, 'FaceLandmark68TinyNet') || this; - } - FaceLandmark68TinyNet.prototype.runNet = function (input) { - var params = this.params; - if (!params) { - throw new Error('FaceLandmark68TinyNet - load model before inference'); - } - return tidy(function () { - var batchTensor = input.toBatchTensor(112, true); - var meanRgb = [122.782, 117.001, 104.298]; - var normalized = normalize(batchTensor, meanRgb).div(scalar(255)); - var out = denseBlock$1(normalized, params.dense0, true); - out = denseBlock$1(out, params.dense1); - out = denseBlock$1(out, params.dense2); - out = avgPool(out, [14, 14], [2, 2], 'valid'); - return fullyConnectedLayer(out.as2D(out.shape[0], -1), params.fc); - }); - }; - FaceLandmark68TinyNet.prototype.loadQuantizedParams = function (uri) { - return loadQuantizedParamsTiny(uri); - }; - FaceLandmark68TinyNet.prototype.extractParams = function (weights) { - return extractParamsTiny(weights); - }; - return FaceLandmark68TinyNet; - }(FaceLandmark68NetBase)); - - var FaceLandmarkNet = /** @class */ (function (_super) { - __extends$1(FaceLandmarkNet, _super); - function FaceLandmarkNet() { - return _super !== null && _super.apply(this, arguments) || this; - } - return FaceLandmarkNet; - }(FaceLandmark68Net)); - function createFaceLandmarkNet(weights) { - var net = new FaceLandmarkNet(); - net.extractWeights(weights); - return net; - } - - function scale(x, params) { - return add(mul(x, params.weights), params.biases); - } - - function convLayer$1(x, params, strides, withRelu, padding) { - if (padding === void 0) { padding = 'same'; } - var _a = params.conv, filters = _a.filters, bias = _a.bias; - var out = conv2d(x, filters, strides, padding); - out = add(out, bias); - out = scale(out, params.scale); - return withRelu ? relu(out) : out; - } - function conv(x, params) { - return convLayer$1(x, params, [1, 1], true); - } - function convNoRelu(x, params) { - return convLayer$1(x, params, [1, 1], false); - } - function convDown(x, params) { - return convLayer$1(x, params, [2, 2], true, 'valid'); - } - - function extractorsFactory$3(extractWeights, paramMappings) { - function extractFilterValues(numFilterValues, numFilters, filterSize) { - var weights = extractWeights(numFilterValues); - var depth = weights.length / (numFilters * filterSize * filterSize); - if (isFloat(depth)) { - throw new Error("depth has to be an integer: " + depth + ", weights.length: " + weights.length + ", numFilters: " + numFilters + ", filterSize: " + filterSize); - } - return tidy(function () { return transpose(tensor4d(weights, [numFilters, depth, filterSize, filterSize]), [2, 3, 1, 0]); }); - } - function extractConvParams(numFilterValues, numFilters, filterSize, mappedPrefix) { - var filters = extractFilterValues(numFilterValues, numFilters, filterSize); - var bias = tensor1d(extractWeights(numFilters)); - paramMappings.push({ paramPath: mappedPrefix + "/filters" }, { paramPath: mappedPrefix + "/bias" }); - return { filters: filters, bias: bias }; - } - function extractScaleLayerParams(numWeights, mappedPrefix) { - var weights = tensor1d(extractWeights(numWeights)); - var biases = tensor1d(extractWeights(numWeights)); - paramMappings.push({ paramPath: mappedPrefix + "/weights" }, { paramPath: mappedPrefix + "/biases" }); - return { - weights: weights, - biases: biases - }; - } - function extractConvLayerParams(numFilterValues, numFilters, filterSize, mappedPrefix) { - var conv = extractConvParams(numFilterValues, numFilters, filterSize, mappedPrefix + "/conv"); - var scale = extractScaleLayerParams(numFilters, mappedPrefix + "/scale"); - return { conv: conv, scale: scale }; - } - function extractResidualLayerParams(numFilterValues, numFilters, filterSize, mappedPrefix, isDown) { - if (isDown === void 0) { isDown = false; } - var conv1 = extractConvLayerParams((isDown ? 0.5 : 1) * numFilterValues, numFilters, filterSize, mappedPrefix + "/conv1"); - var conv2 = extractConvLayerParams(numFilterValues, numFilters, filterSize, mappedPrefix + "/conv2"); - return { conv1: conv1, conv2: conv2 }; - } - return { - extractConvLayerParams: extractConvLayerParams, - extractResidualLayerParams: extractResidualLayerParams - }; - } - function extractParams$2(weights) { - var _a = extractWeightsFactory(weights), extractWeights = _a.extractWeights, getRemainingWeights = _a.getRemainingWeights; - var paramMappings = []; - var _b = extractorsFactory$3(extractWeights, paramMappings), extractConvLayerParams = _b.extractConvLayerParams, extractResidualLayerParams = _b.extractResidualLayerParams; - var conv32_down = extractConvLayerParams(4704, 32, 7, 'conv32_down'); - var conv32_1 = extractResidualLayerParams(9216, 32, 3, 'conv32_1'); - var conv32_2 = extractResidualLayerParams(9216, 32, 3, 'conv32_2'); - var conv32_3 = extractResidualLayerParams(9216, 32, 3, 'conv32_3'); - var conv64_down = extractResidualLayerParams(36864, 64, 3, 'conv64_down', true); - var conv64_1 = extractResidualLayerParams(36864, 64, 3, 'conv64_1'); - var conv64_2 = extractResidualLayerParams(36864, 64, 3, 'conv64_2'); - var conv64_3 = extractResidualLayerParams(36864, 64, 3, 'conv64_3'); - var conv128_down = extractResidualLayerParams(147456, 128, 3, 'conv128_down', true); - var conv128_1 = extractResidualLayerParams(147456, 128, 3, 'conv128_1'); - var conv128_2 = extractResidualLayerParams(147456, 128, 3, 'conv128_2'); - var conv256_down = extractResidualLayerParams(589824, 256, 3, 'conv256_down', true); - var conv256_1 = extractResidualLayerParams(589824, 256, 3, 'conv256_1'); - var conv256_2 = extractResidualLayerParams(589824, 256, 3, 'conv256_2'); - var conv256_down_out = extractResidualLayerParams(589824, 256, 3, 'conv256_down_out'); - var fc = tidy(function () { return transpose(tensor2d(extractWeights(256 * 128), [128, 256]), [1, 0]); }); - paramMappings.push({ paramPath: "fc" }); - if (getRemainingWeights().length !== 0) { - throw new Error("weights remaing after extract: " + getRemainingWeights().length); - } - var params = { - conv32_down: conv32_down, - conv32_1: conv32_1, - conv32_2: conv32_2, - conv32_3: conv32_3, - conv64_down: conv64_down, - conv64_1: conv64_1, - conv64_2: conv64_2, - conv64_3: conv64_3, - conv128_down: conv128_down, - conv128_1: conv128_1, - conv128_2: conv128_2, - conv256_down: conv256_down, - conv256_1: conv256_1, - conv256_2: conv256_2, - conv256_down_out: conv256_down_out, - fc: fc - }; - return { params: params, paramMappings: paramMappings }; - } - - var DEFAULT_MODEL_NAME$2 = 'face_recognition_model'; - function extractorsFactory$4(weightMap, paramMappings) { - var extractWeightEntry = extractWeightEntryFactory(weightMap, paramMappings); - function extractScaleLayerParams(prefix) { - var weights = extractWeightEntry(prefix + "/scale/weights", 1); - var biases = extractWeightEntry(prefix + "/scale/biases", 1); - return { weights: weights, biases: biases }; - } - function extractConvLayerParams(prefix) { - var filters = extractWeightEntry(prefix + "/conv/filters", 4); - var bias = extractWeightEntry(prefix + "/conv/bias", 1); - var scale = extractScaleLayerParams(prefix); - return { conv: { filters: filters, bias: bias }, scale: scale }; - } - function extractResidualLayerParams(prefix) { - return { - conv1: extractConvLayerParams(prefix + "/conv1"), - conv2: extractConvLayerParams(prefix + "/conv2") - }; - } - return { - extractConvLayerParams: extractConvLayerParams, - extractResidualLayerParams: extractResidualLayerParams - }; - } - function loadQuantizedParams$2(uri) { - return __awaiter$1(this, void 0, void 0, function () { - var weightMap, paramMappings, _a, extractConvLayerParams, extractResidualLayerParams, conv32_down, conv32_1, conv32_2, conv32_3, conv64_down, conv64_1, conv64_2, conv64_3, conv128_down, conv128_1, conv128_2, conv256_down, conv256_1, conv256_2, conv256_down_out, fc, params; - return __generator$1(this, function (_b) { - switch (_b.label) { - case 0: return [4 /*yield*/, loadWeightMap(uri, DEFAULT_MODEL_NAME$2)]; - case 1: - weightMap = _b.sent(); - paramMappings = []; - _a = extractorsFactory$4(weightMap, paramMappings), extractConvLayerParams = _a.extractConvLayerParams, extractResidualLayerParams = _a.extractResidualLayerParams; - conv32_down = extractConvLayerParams('conv32_down'); - conv32_1 = extractResidualLayerParams('conv32_1'); - conv32_2 = extractResidualLayerParams('conv32_2'); - conv32_3 = extractResidualLayerParams('conv32_3'); - conv64_down = extractResidualLayerParams('conv64_down'); - conv64_1 = extractResidualLayerParams('conv64_1'); - conv64_2 = extractResidualLayerParams('conv64_2'); - conv64_3 = extractResidualLayerParams('conv64_3'); - conv128_down = extractResidualLayerParams('conv128_down'); - conv128_1 = extractResidualLayerParams('conv128_1'); - conv128_2 = extractResidualLayerParams('conv128_2'); - conv256_down = extractResidualLayerParams('conv256_down'); - conv256_1 = extractResidualLayerParams('conv256_1'); - conv256_2 = extractResidualLayerParams('conv256_2'); - conv256_down_out = extractResidualLayerParams('conv256_down_out'); - fc = weightMap['fc']; - paramMappings.push({ originalPath: 'fc', paramPath: 'fc' }); - if (!isTensor2D(fc)) { - throw new Error("expected weightMap[fc] to be a Tensor2D, instead have " + fc); - } - params = { - conv32_down: conv32_down, - conv32_1: conv32_1, - conv32_2: conv32_2, - conv32_3: conv32_3, - conv64_down: conv64_down, - conv64_1: conv64_1, - conv64_2: conv64_2, - conv64_3: conv64_3, - conv128_down: conv128_down, - conv128_1: conv128_1, - conv128_2: conv128_2, - conv256_down: conv256_down, - conv256_1: conv256_1, - conv256_2: conv256_2, - conv256_down_out: conv256_down_out, - fc: fc - }; - disposeUnusedWeightTensors(weightMap, paramMappings); - return [2 /*return*/, { params: params, paramMappings: paramMappings }]; - } - }); - }); - } - - function residual(x, params) { - var out = conv(x, params.conv1); - out = convNoRelu(out, params.conv2); - out = add(out, x); - out = relu(out); - return out; - } - function residualDown(x, params) { - var out = convDown(x, params.conv1); - out = convNoRelu(out, params.conv2); - var pooled = avgPool(x, 2, 2, 'valid'); - var zeros$$1 = zeros(pooled.shape); - var isPad = pooled.shape[3] !== out.shape[3]; - var isAdjustShape = pooled.shape[1] !== out.shape[1] || pooled.shape[2] !== out.shape[2]; - if (isAdjustShape) { - var padShapeX = out.shape.slice(); - padShapeX[1] = 1; - var zerosW = zeros(padShapeX); - out = concat([out, zerosW], 1); - var padShapeY = out.shape.slice(); - padShapeY[2] = 1; - var zerosH = zeros(padShapeY); - out = concat([out, zerosH], 2); - } - pooled = isPad ? concat([pooled, zeros$$1], 3) : pooled; - out = add(pooled, out); - out = relu(out); - return out; - } - - var FaceRecognitionNet = /** @class */ (function (_super) { - __extends$1(FaceRecognitionNet, _super); - function FaceRecognitionNet() { - return _super.call(this, 'FaceRecognitionNet') || this; - } - FaceRecognitionNet.prototype.forwardInput = function (input) { - var params = this.params; - if (!params) { - throw new Error('FaceRecognitionNet - load model before inference'); - } - return tidy(function () { - var batchTensor = input.toBatchTensor(150, true).toFloat(); - var meanRgb = [122.782, 117.001, 104.298]; - var normalized = normalize(batchTensor, meanRgb).div(scalar(256)); - var out = convDown(normalized, params.conv32_down); - out = maxPool(out, 3, 2, 'valid'); - out = residual(out, params.conv32_1); - out = residual(out, params.conv32_2); - out = residual(out, params.conv32_3); - out = residualDown(out, params.conv64_down); - out = residual(out, params.conv64_1); - out = residual(out, params.conv64_2); - out = residual(out, params.conv64_3); - out = residualDown(out, params.conv128_down); - out = residual(out, params.conv128_1); - out = residual(out, params.conv128_2); - out = residualDown(out, params.conv256_down); - out = residual(out, params.conv256_1); - out = residual(out, params.conv256_2); - out = residualDown(out, params.conv256_down_out); - var globalAvg = out.mean([1, 2]); - var fullyConnected = matMul(globalAvg, params.fc); - return fullyConnected; - }); - }; - FaceRecognitionNet.prototype.forward = function (input) { - return __awaiter$1(this, void 0, void 0, function () { - var _a; - return __generator$1(this, function (_b) { - switch (_b.label) { - case 0: - _a = this.forwardInput; - return [4 /*yield*/, toNetInput(input)]; - case 1: return [2 /*return*/, _a.apply(this, [_b.sent()])]; - } - }); - }); - }; - FaceRecognitionNet.prototype.computeFaceDescriptor = function (input) { - return __awaiter$1(this, void 0, void 0, function () { - var _this = this; - var netInput, faceDescriptorTensors, faceDescriptorsForBatch; - return __generator$1(this, function (_a) { - switch (_a.label) { - case 0: return [4 /*yield*/, toNetInput(input)]; - case 1: - netInput = _a.sent(); - faceDescriptorTensors = tidy(function () { return unstack(_this.forwardInput(netInput)); }); - return [4 /*yield*/, Promise.all(faceDescriptorTensors.map(function (t) { return t.data(); }))]; - case 2: - faceDescriptorsForBatch = _a.sent(); - faceDescriptorTensors.forEach(function (t) { return t.dispose(); }); - return [2 /*return*/, netInput.isBatchInput - ? faceDescriptorsForBatch - : faceDescriptorsForBatch[0]]; - } - }); - }); - }; - FaceRecognitionNet.prototype.loadQuantizedParams = function (uri) { - return loadQuantizedParams$2(uri); - }; - FaceRecognitionNet.prototype.extractParams = function (weights) { - return extractParams$2(weights); - }; - return FaceRecognitionNet; - }(NeuralNetwork)); - - function createFaceRecognitionNet(weights) { - var net = new FaceRecognitionNet(); - net.extractWeights(weights); - return net; - } - - var MtcnnOptions = /** @class */ (function () { - function MtcnnOptions(_a) { - var _b = _a === void 0 ? {} : _a, minFaceSize = _b.minFaceSize, scaleFactor = _b.scaleFactor, maxNumScales = _b.maxNumScales, scoreThresholds = _b.scoreThresholds, scaleSteps = _b.scaleSteps; - this._name = 'MtcnnOptions'; - this._minFaceSize = minFaceSize || 20; - this._scaleFactor = scaleFactor || 0.709; - this._maxNumScales = maxNumScales || 10; - this._scoreThresholds = scoreThresholds || [0.6, 0.7, 0.7]; - this._scaleSteps = scaleSteps; - if (typeof this._minFaceSize !== 'number' || this._minFaceSize < 0) { - throw new Error(this._name + " - expected minFaceSize to be a number > 0"); - } - if (typeof this._scaleFactor !== 'number' || this._scaleFactor <= 0 || this._scaleFactor >= 1) { - throw new Error(this._name + " - expected scaleFactor to be a number between 0 and 1"); - } - if (typeof this._maxNumScales !== 'number' || this._maxNumScales < 0) { - throw new Error(this._name + " - expected maxNumScales to be a number > 0"); - } - if (!Array.isArray(this._scoreThresholds) - || this._scoreThresholds.length !== 3 - || this._scoreThresholds.some(function (th) { return typeof th !== 'number'; })) { - throw new Error(this._name + " - expected scoreThresholds to be an array of numbers of length 3"); - } - if (this._scaleSteps - && (!Array.isArray(this._scaleSteps) || this._scaleSteps.some(function (th) { return typeof th !== 'number'; }))) { - throw new Error(this._name + " - expected scaleSteps to be an array of numbers"); - } - } - Object.defineProperty(MtcnnOptions.prototype, "minFaceSize", { - get: function () { return this._minFaceSize; }, - enumerable: true, - configurable: true - }); - Object.defineProperty(MtcnnOptions.prototype, "scaleFactor", { - get: function () { return this._scaleFactor; }, - enumerable: true, - configurable: true - }); - Object.defineProperty(MtcnnOptions.prototype, "maxNumScales", { - get: function () { return this._maxNumScales; }, - enumerable: true, - configurable: true - }); - Object.defineProperty(MtcnnOptions.prototype, "scoreThresholds", { - get: function () { return this._scoreThresholds; }, - enumerable: true, - configurable: true - }); - Object.defineProperty(MtcnnOptions.prototype, "scaleSteps", { - get: function () { return this._scaleSteps; }, - enumerable: true, - configurable: true - }); - return MtcnnOptions; - }()); - - function extractorsFactory$5(extractWeights, paramMappings) { - function extractDepthwiseConvParams(numChannels, mappedPrefix) { - var filters = tensor4d(extractWeights(3 * 3 * numChannels), [3, 3, numChannels, 1]); - var batch_norm_scale = tensor1d(extractWeights(numChannels)); - var batch_norm_offset = tensor1d(extractWeights(numChannels)); - var batch_norm_mean = tensor1d(extractWeights(numChannels)); - var batch_norm_variance = tensor1d(extractWeights(numChannels)); - paramMappings.push({ paramPath: mappedPrefix + "/filters" }, { paramPath: mappedPrefix + "/batch_norm_scale" }, { paramPath: mappedPrefix + "/batch_norm_offset" }, { paramPath: mappedPrefix + "/batch_norm_mean" }, { paramPath: mappedPrefix + "/batch_norm_variance" }); - return { - filters: filters, - batch_norm_scale: batch_norm_scale, - batch_norm_offset: batch_norm_offset, - batch_norm_mean: batch_norm_mean, - batch_norm_variance: batch_norm_variance - }; - } - function extractConvParams(channelsIn, channelsOut, filterSize, mappedPrefix, isPointwiseConv) { - var filters = tensor4d(extractWeights(channelsIn * channelsOut * filterSize * filterSize), [filterSize, filterSize, channelsIn, channelsOut]); - var bias = tensor1d(extractWeights(channelsOut)); - paramMappings.push({ paramPath: mappedPrefix + "/filters" }, { paramPath: mappedPrefix + "/" + (isPointwiseConv ? 'batch_norm_offset' : 'bias') }); - return { filters: filters, bias: bias }; - } - function extractPointwiseConvParams(channelsIn, channelsOut, filterSize, mappedPrefix) { - var _a = extractConvParams(channelsIn, channelsOut, filterSize, mappedPrefix, true), filters = _a.filters, bias = _a.bias; - return { - filters: filters, - batch_norm_offset: bias - }; - } - function extractConvPairParams(channelsIn, channelsOut, mappedPrefix) { - var depthwise_conv = extractDepthwiseConvParams(channelsIn, mappedPrefix + "/depthwise_conv"); - var pointwise_conv = extractPointwiseConvParams(channelsIn, channelsOut, 1, mappedPrefix + "/pointwise_conv"); - return { depthwise_conv: depthwise_conv, pointwise_conv: pointwise_conv }; - } - function extractMobilenetV1Params() { - var conv_0 = extractPointwiseConvParams(3, 32, 3, 'mobilenetv1/conv_0'); - var conv_1 = extractConvPairParams(32, 64, 'mobilenetv1/conv_1'); - var conv_2 = extractConvPairParams(64, 128, 'mobilenetv1/conv_2'); - var conv_3 = extractConvPairParams(128, 128, 'mobilenetv1/conv_3'); - var conv_4 = extractConvPairParams(128, 256, 'mobilenetv1/conv_4'); - var conv_5 = extractConvPairParams(256, 256, 'mobilenetv1/conv_5'); - var conv_6 = extractConvPairParams(256, 512, 'mobilenetv1/conv_6'); - var conv_7 = extractConvPairParams(512, 512, 'mobilenetv1/conv_7'); - var conv_8 = extractConvPairParams(512, 512, 'mobilenetv1/conv_8'); - var conv_9 = extractConvPairParams(512, 512, 'mobilenetv1/conv_9'); - var conv_10 = extractConvPairParams(512, 512, 'mobilenetv1/conv_10'); - var conv_11 = extractConvPairParams(512, 512, 'mobilenetv1/conv_11'); - var conv_12 = extractConvPairParams(512, 1024, 'mobilenetv1/conv_12'); - var conv_13 = extractConvPairParams(1024, 1024, 'mobilenetv1/conv_13'); - return { - conv_0: conv_0, - conv_1: conv_1, - conv_2: conv_2, - conv_3: conv_3, - conv_4: conv_4, - conv_5: conv_5, - conv_6: conv_6, - conv_7: conv_7, - conv_8: conv_8, - conv_9: conv_9, - conv_10: conv_10, - conv_11: conv_11, - conv_12: conv_12, - conv_13: conv_13 - }; - } - function extractPredictionLayerParams() { - var conv_0 = extractPointwiseConvParams(1024, 256, 1, 'prediction_layer/conv_0'); - var conv_1 = extractPointwiseConvParams(256, 512, 3, 'prediction_layer/conv_1'); - var conv_2 = extractPointwiseConvParams(512, 128, 1, 'prediction_layer/conv_2'); - var conv_3 = extractPointwiseConvParams(128, 256, 3, 'prediction_layer/conv_3'); - var conv_4 = extractPointwiseConvParams(256, 128, 1, 'prediction_layer/conv_4'); - var conv_5 = extractPointwiseConvParams(128, 256, 3, 'prediction_layer/conv_5'); - var conv_6 = extractPointwiseConvParams(256, 64, 1, 'prediction_layer/conv_6'); - var conv_7 = extractPointwiseConvParams(64, 128, 3, 'prediction_layer/conv_7'); - var box_encoding_0_predictor = extractConvParams(512, 12, 1, 'prediction_layer/box_predictor_0/box_encoding_predictor'); - var class_predictor_0 = extractConvParams(512, 9, 1, 'prediction_layer/box_predictor_0/class_predictor'); - var box_encoding_1_predictor = extractConvParams(1024, 24, 1, 'prediction_layer/box_predictor_1/box_encoding_predictor'); - var class_predictor_1 = extractConvParams(1024, 18, 1, 'prediction_layer/box_predictor_1/class_predictor'); - var box_encoding_2_predictor = extractConvParams(512, 24, 1, 'prediction_layer/box_predictor_2/box_encoding_predictor'); - var class_predictor_2 = extractConvParams(512, 18, 1, 'prediction_layer/box_predictor_2/class_predictor'); - var box_encoding_3_predictor = extractConvParams(256, 24, 1, 'prediction_layer/box_predictor_3/box_encoding_predictor'); - var class_predictor_3 = extractConvParams(256, 18, 1, 'prediction_layer/box_predictor_3/class_predictor'); - var box_encoding_4_predictor = extractConvParams(256, 24, 1, 'prediction_layer/box_predictor_4/box_encoding_predictor'); - var class_predictor_4 = extractConvParams(256, 18, 1, 'prediction_layer/box_predictor_4/class_predictor'); - var box_encoding_5_predictor = extractConvParams(128, 24, 1, 'prediction_layer/box_predictor_5/box_encoding_predictor'); - var class_predictor_5 = extractConvParams(128, 18, 1, 'prediction_layer/box_predictor_5/class_predictor'); - var box_predictor_0 = { - box_encoding_predictor: box_encoding_0_predictor, - class_predictor: class_predictor_0 - }; - var box_predictor_1 = { - box_encoding_predictor: box_encoding_1_predictor, - class_predictor: class_predictor_1 - }; - var box_predictor_2 = { - box_encoding_predictor: box_encoding_2_predictor, - class_predictor: class_predictor_2 - }; - var box_predictor_3 = { - box_encoding_predictor: box_encoding_3_predictor, - class_predictor: class_predictor_3 - }; - var box_predictor_4 = { - box_encoding_predictor: box_encoding_4_predictor, - class_predictor: class_predictor_4 - }; - var box_predictor_5 = { - box_encoding_predictor: box_encoding_5_predictor, - class_predictor: class_predictor_5 - }; - return { - conv_0: conv_0, - conv_1: conv_1, - conv_2: conv_2, - conv_3: conv_3, - conv_4: conv_4, - conv_5: conv_5, - conv_6: conv_6, - conv_7: conv_7, - box_predictor_0: box_predictor_0, - box_predictor_1: box_predictor_1, - box_predictor_2: box_predictor_2, - box_predictor_3: box_predictor_3, - box_predictor_4: box_predictor_4, - box_predictor_5: box_predictor_5 - }; - } - return { - extractMobilenetV1Params: extractMobilenetV1Params, - extractPredictionLayerParams: extractPredictionLayerParams - }; - } - function extractParams$3(weights) { - var paramMappings = []; - var _a = extractWeightsFactory(weights), extractWeights = _a.extractWeights, getRemainingWeights = _a.getRemainingWeights; - var _b = extractorsFactory$5(extractWeights, paramMappings), extractMobilenetV1Params = _b.extractMobilenetV1Params, extractPredictionLayerParams = _b.extractPredictionLayerParams; - var mobilenetv1 = extractMobilenetV1Params(); - var prediction_layer = extractPredictionLayerParams(); - var extra_dim = tensor3d(extractWeights(5118 * 4), [1, 5118, 4]); - var output_layer = { - extra_dim: extra_dim - }; - paramMappings.push({ paramPath: 'output_layer/extra_dim' }); - if (getRemainingWeights().length !== 0) { - throw new Error("weights remaing after extract: " + getRemainingWeights().length); - } - return { - params: { - mobilenetv1: mobilenetv1, - prediction_layer: prediction_layer, - output_layer: output_layer - }, - paramMappings: paramMappings - }; - } - - var DEFAULT_MODEL_NAME$3 = 'ssd_mobilenetv1_model'; - function extractorsFactory$6(weightMap, paramMappings) { - var extractWeightEntry = extractWeightEntryFactory(weightMap, paramMappings); - function extractPointwiseConvParams(prefix, idx, mappedPrefix) { - var filters = extractWeightEntry(prefix + "/Conv2d_" + idx + "_pointwise/weights", 4, mappedPrefix + "/filters"); - var batch_norm_offset = extractWeightEntry(prefix + "/Conv2d_" + idx + "_pointwise/convolution_bn_offset", 1, mappedPrefix + "/batch_norm_offset"); - return { filters: filters, batch_norm_offset: batch_norm_offset }; - } - function extractConvPairParams(idx) { - var mappedPrefix = "mobilenetv1/conv_" + idx; - var prefixDepthwiseConv = "MobilenetV1/Conv2d_" + idx + "_depthwise"; - var mappedPrefixDepthwiseConv = mappedPrefix + "/depthwise_conv"; - var mappedPrefixPointwiseConv = mappedPrefix + "/pointwise_conv"; - var filters = extractWeightEntry(prefixDepthwiseConv + "/depthwise_weights", 4, mappedPrefixDepthwiseConv + "/filters"); - var batch_norm_scale = extractWeightEntry(prefixDepthwiseConv + "/BatchNorm/gamma", 1, mappedPrefixDepthwiseConv + "/batch_norm_scale"); - var batch_norm_offset = extractWeightEntry(prefixDepthwiseConv + "/BatchNorm/beta", 1, mappedPrefixDepthwiseConv + "/batch_norm_offset"); - var batch_norm_mean = extractWeightEntry(prefixDepthwiseConv + "/BatchNorm/moving_mean", 1, mappedPrefixDepthwiseConv + "/batch_norm_mean"); - var batch_norm_variance = extractWeightEntry(prefixDepthwiseConv + "/BatchNorm/moving_variance", 1, mappedPrefixDepthwiseConv + "/batch_norm_variance"); - return { - depthwise_conv: { - filters: filters, - batch_norm_scale: batch_norm_scale, - batch_norm_offset: batch_norm_offset, - batch_norm_mean: batch_norm_mean, - batch_norm_variance: batch_norm_variance - }, - pointwise_conv: extractPointwiseConvParams('MobilenetV1', idx, mappedPrefixPointwiseConv) - }; - } - function extractMobilenetV1Params() { - return { - conv_0: extractPointwiseConvParams('MobilenetV1', 0, 'mobilenetv1/conv_0'), - conv_1: extractConvPairParams(1), - conv_2: extractConvPairParams(2), - conv_3: extractConvPairParams(3), - conv_4: extractConvPairParams(4), - conv_5: extractConvPairParams(5), - conv_6: extractConvPairParams(6), - conv_7: extractConvPairParams(7), - conv_8: extractConvPairParams(8), - conv_9: extractConvPairParams(9), - conv_10: extractConvPairParams(10), - conv_11: extractConvPairParams(11), - conv_12: extractConvPairParams(12), - conv_13: extractConvPairParams(13) - }; - } - function extractConvParams(prefix, mappedPrefix) { - var filters = extractWeightEntry(prefix + "/weights", 4, mappedPrefix + "/filters"); - var bias = extractWeightEntry(prefix + "/biases", 1, mappedPrefix + "/bias"); - return { filters: filters, bias: bias }; - } - function extractBoxPredictorParams(idx) { - var box_encoding_predictor = extractConvParams("Prediction/BoxPredictor_" + idx + "/BoxEncodingPredictor", "prediction_layer/box_predictor_" + idx + "/box_encoding_predictor"); - var class_predictor = extractConvParams("Prediction/BoxPredictor_" + idx + "/ClassPredictor", "prediction_layer/box_predictor_" + idx + "/class_predictor"); - return { box_encoding_predictor: box_encoding_predictor, class_predictor: class_predictor }; - } - function extractPredictionLayerParams() { - return { - conv_0: extractPointwiseConvParams('Prediction', 0, 'prediction_layer/conv_0'), - conv_1: extractPointwiseConvParams('Prediction', 1, 'prediction_layer/conv_1'), - conv_2: extractPointwiseConvParams('Prediction', 2, 'prediction_layer/conv_2'), - conv_3: extractPointwiseConvParams('Prediction', 3, 'prediction_layer/conv_3'), - conv_4: extractPointwiseConvParams('Prediction', 4, 'prediction_layer/conv_4'), - conv_5: extractPointwiseConvParams('Prediction', 5, 'prediction_layer/conv_5'), - conv_6: extractPointwiseConvParams('Prediction', 6, 'prediction_layer/conv_6'), - conv_7: extractPointwiseConvParams('Prediction', 7, 'prediction_layer/conv_7'), - box_predictor_0: extractBoxPredictorParams(0), - box_predictor_1: extractBoxPredictorParams(1), - box_predictor_2: extractBoxPredictorParams(2), - box_predictor_3: extractBoxPredictorParams(3), - box_predictor_4: extractBoxPredictorParams(4), - box_predictor_5: extractBoxPredictorParams(5) - }; - } - return { - extractMobilenetV1Params: extractMobilenetV1Params, - extractPredictionLayerParams: extractPredictionLayerParams - }; - } - function loadQuantizedParams$3(uri) { - return __awaiter$1(this, void 0, void 0, function () { - var weightMap, paramMappings, _a, extractMobilenetV1Params, extractPredictionLayerParams, extra_dim, params; - return __generator$1(this, function (_b) { - switch (_b.label) { - case 0: return [4 /*yield*/, loadWeightMap(uri, DEFAULT_MODEL_NAME$3)]; - case 1: - weightMap = _b.sent(); - paramMappings = []; - _a = extractorsFactory$6(weightMap, paramMappings), extractMobilenetV1Params = _a.extractMobilenetV1Params, extractPredictionLayerParams = _a.extractPredictionLayerParams; - extra_dim = weightMap['Output/extra_dim']; - paramMappings.push({ originalPath: 'Output/extra_dim', paramPath: 'output_layer/extra_dim' }); - if (!isTensor3D(extra_dim)) { - throw new Error("expected weightMap['Output/extra_dim'] to be a Tensor3D, instead have " + extra_dim); - } - params = { - mobilenetv1: extractMobilenetV1Params(), - prediction_layer: extractPredictionLayerParams(), - output_layer: { - extra_dim: extra_dim - } - }; - disposeUnusedWeightTensors(weightMap, paramMappings); - return [2 /*return*/, { params: params, paramMappings: paramMappings }]; - } - }); - }); - } - - function pointwiseConvLayer(x, params, strides) { - return tidy(function () { - var out = conv2d(x, params.filters, strides, 'same'); - out = add(out, params.batch_norm_offset); - return clipByValue(out, 0, 6); - }); - } - - var epsilon = 0.0010000000474974513; - function depthwiseConvLayer(x, params, strides) { - return tidy(function () { - var out = depthwiseConv2d(x, params.filters, strides, 'same'); - out = batchNormalization(out, params.batch_norm_mean, params.batch_norm_variance, epsilon, params.batch_norm_scale, params.batch_norm_offset); - return clipByValue(out, 0, 6); - }); - } - function getStridesForLayerIdx(layerIdx) { - return [2, 4, 6, 12].some(function (idx) { return idx === layerIdx; }) ? [2, 2] : [1, 1]; - } - function mobileNetV1(x, params) { - return tidy(function () { - var conv11 = null; - var out = pointwiseConvLayer(x, params.conv_0, [2, 2]); - var convPairParams = [ - params.conv_1, - params.conv_2, - params.conv_3, - params.conv_4, - params.conv_5, - params.conv_6, - params.conv_7, - params.conv_8, - params.conv_9, - params.conv_10, - params.conv_11, - params.conv_12, - params.conv_13 - ]; - convPairParams.forEach(function (param, i) { - var layerIdx = i + 1; - var depthwiseConvStrides = getStridesForLayerIdx(layerIdx); - out = depthwiseConvLayer(out, param.depthwise_conv, depthwiseConvStrides); - out = pointwiseConvLayer(out, param.pointwise_conv, [1, 1]); - if (layerIdx === 11) { - conv11 = out; - } - }); - if (conv11 === null) { - throw new Error('mobileNetV1 - output of conv layer 11 is null'); - } - return { - out: out, - conv11: conv11 - }; - }); - } - - function nonMaxSuppression$2(boxes, scores, maxOutputSize, iouThreshold, scoreThreshold) { - var numBoxes = boxes.shape[0]; - var outputSize = Math.min(maxOutputSize, numBoxes); - var candidates = scores - .map(function (score, boxIndex) { return ({ score: score, boxIndex: boxIndex }); }) - .filter(function (c) { return c.score > scoreThreshold; }) - .sort(function (c1, c2) { return c2.score - c1.score; }); - var suppressFunc = function (x) { return x <= iouThreshold ? 1 : 0; }; - var selected = []; - candidates.forEach(function (c) { - if (selected.length >= outputSize) { - return; - } - var originalScore = c.score; - for (var j = selected.length - 1; j >= 0; --j) { - var iou = IOU(boxes, c.boxIndex, selected[j]); - if (iou === 0.0) { - continue; - } - c.score *= suppressFunc(iou); - if (c.score <= scoreThreshold) { - break; - } - } - if (originalScore === c.score) { - selected.push(c.boxIndex); - } - }); - return selected; - } - function IOU(boxes, i, j) { - var yminI = Math.min(boxes.get(i, 0), boxes.get(i, 2)); - var xminI = Math.min(boxes.get(i, 1), boxes.get(i, 3)); - var ymaxI = Math.max(boxes.get(i, 0), boxes.get(i, 2)); - var xmaxI = Math.max(boxes.get(i, 1), boxes.get(i, 3)); - var yminJ = Math.min(boxes.get(j, 0), boxes.get(j, 2)); - var xminJ = Math.min(boxes.get(j, 1), boxes.get(j, 3)); - var ymaxJ = Math.max(boxes.get(j, 0), boxes.get(j, 2)); - var xmaxJ = Math.max(boxes.get(j, 1), boxes.get(j, 3)); - var areaI = (ymaxI - yminI) * (xmaxI - xminI); - var areaJ = (ymaxJ - yminJ) * (xmaxJ - xminJ); - if (areaI <= 0 || areaJ <= 0) { - return 0.0; - } - var intersectionYmin = Math.max(yminI, yminJ); - var intersectionXmin = Math.max(xminI, xminJ); - var intersectionYmax = Math.min(ymaxI, ymaxJ); - var intersectionXmax = Math.min(xmaxI, xmaxJ); - var intersectionArea = Math.max(intersectionYmax - intersectionYmin, 0.0) * - Math.max(intersectionXmax - intersectionXmin, 0.0); - return intersectionArea / (areaI + areaJ - intersectionArea); - } - - function getCenterCoordinatesAndSizesLayer(x) { - var vec = unstack(transpose(x, [1, 0])); - var sizes = [ - sub(vec[2], vec[0]), - sub(vec[3], vec[1]) - ]; - var centers = [ - add(vec[0], div(sizes[0], scalar(2))), - add(vec[1], div(sizes[1], scalar(2))) - ]; - return { - sizes: sizes, - centers: centers - }; - } - function decodeBoxesLayer(x0, x1) { - var _a = getCenterCoordinatesAndSizesLayer(x0), sizes = _a.sizes, centers = _a.centers; - var vec = unstack(transpose(x1, [1, 0])); - var div0_out = div(mul(exp(div(vec[2], scalar(5))), sizes[0]), scalar(2)); - var add0_out = add(mul(div(vec[0], scalar(10)), sizes[0]), centers[0]); - var div1_out = div(mul(exp(div(vec[3], scalar(5))), sizes[1]), scalar(2)); - var add1_out = add(mul(div(vec[1], scalar(10)), sizes[1]), centers[1]); - return transpose(stack([ - sub(add0_out, div0_out), - sub(add1_out, div1_out), - add(add0_out, div0_out), - add(add1_out, div1_out) - ]), [1, 0]); - } - function outputLayer(boxPredictions, classPredictions, params) { - return tidy(function () { - var batchSize = boxPredictions.shape[0]; - var boxes = decodeBoxesLayer(reshape(tile(params.extra_dim, [batchSize, 1, 1]), [-1, 4]), reshape(boxPredictions, [-1, 4])); - boxes = reshape(boxes, [batchSize, (boxes.shape[0] / batchSize), 4]); - var scoresAndClasses = sigmoid(slice(classPredictions, [0, 0, 1], [-1, -1, -1])); - var scores = slice(scoresAndClasses, [0, 0, 0], [-1, -1, 1]); - scores = reshape(scores, [batchSize, scores.shape[1]]); - var boxesByBatch = unstack(boxes); - var scoresByBatch = unstack(scores); - return { - boxes: boxesByBatch, - scores: scoresByBatch - }; - }); - } - - function boxPredictionLayer(x, params) { - return tidy(function () { - var batchSize = x.shape[0]; - var boxPredictionEncoding = reshape(convLayer(x, params.box_encoding_predictor), [batchSize, -1, 1, 4]); - var classPrediction = reshape(convLayer(x, params.class_predictor), [batchSize, -1, 3]); - return { - boxPredictionEncoding: boxPredictionEncoding, - classPrediction: classPrediction - }; - }); - } - - function predictionLayer(x, conv11, params) { - return tidy(function () { - var conv0 = pointwiseConvLayer(x, params.conv_0, [1, 1]); - var conv1 = pointwiseConvLayer(conv0, params.conv_1, [2, 2]); - var conv2 = pointwiseConvLayer(conv1, params.conv_2, [1, 1]); - var conv3 = pointwiseConvLayer(conv2, params.conv_3, [2, 2]); - var conv4 = pointwiseConvLayer(conv3, params.conv_4, [1, 1]); - var conv5 = pointwiseConvLayer(conv4, params.conv_5, [2, 2]); - var conv6 = pointwiseConvLayer(conv5, params.conv_6, [1, 1]); - var conv7 = pointwiseConvLayer(conv6, params.conv_7, [2, 2]); - var boxPrediction0 = boxPredictionLayer(conv11, params.box_predictor_0); - var boxPrediction1 = boxPredictionLayer(x, params.box_predictor_1); - var boxPrediction2 = boxPredictionLayer(conv1, params.box_predictor_2); - var boxPrediction3 = boxPredictionLayer(conv3, params.box_predictor_3); - var boxPrediction4 = boxPredictionLayer(conv5, params.box_predictor_4); - var boxPrediction5 = boxPredictionLayer(conv7, params.box_predictor_5); - var boxPredictions = concat([ - boxPrediction0.boxPredictionEncoding, - boxPrediction1.boxPredictionEncoding, - boxPrediction2.boxPredictionEncoding, - boxPrediction3.boxPredictionEncoding, - boxPrediction4.boxPredictionEncoding, - boxPrediction5.boxPredictionEncoding - ], 1); - var classPredictions = concat([ - boxPrediction0.classPrediction, - boxPrediction1.classPrediction, - boxPrediction2.classPrediction, - boxPrediction3.classPrediction, - boxPrediction4.classPrediction, - boxPrediction5.classPrediction - ], 1); - return { - boxPredictions: boxPredictions, - classPredictions: classPredictions - }; - }); - } - - var SsdMobilenetv1Options = /** @class */ (function () { - function SsdMobilenetv1Options(_a) { - var _b = _a === void 0 ? {} : _a, minConfidence = _b.minConfidence, maxResults = _b.maxResults; - this._name = 'SsdMobilenetv1Options'; - this._minConfidence = minConfidence || 0.5; - this._maxResults = maxResults || 100; - if (typeof this._minConfidence !== 'number' || this._minConfidence <= 0 || this._minConfidence >= 1) { - throw new Error(this._name + " - expected minConfidence to be a number between 0 and 1"); - } - if (typeof this._maxResults !== 'number') { - throw new Error(this._name + " - expected maxResults to be a number"); - } - } - Object.defineProperty(SsdMobilenetv1Options.prototype, "minConfidence", { - get: function () { return this._minConfidence; }, - enumerable: true, - configurable: true - }); - Object.defineProperty(SsdMobilenetv1Options.prototype, "maxResults", { - get: function () { return this._maxResults; }, - enumerable: true, - configurable: true - }); - return SsdMobilenetv1Options; - }()); - - var SsdMobilenetv1 = /** @class */ (function (_super) { - __extends$1(SsdMobilenetv1, _super); - function SsdMobilenetv1() { - return _super.call(this, 'SsdMobilenetv1') || this; - } - SsdMobilenetv1.prototype.forwardInput = function (input) { - var params = this.params; - if (!params) { - throw new Error('SsdMobilenetv1 - load model before inference'); - } - return tidy(function () { - var batchTensor = input.toBatchTensor(512, false).toFloat(); - var x = sub(mul(batchTensor, scalar(0.007843137718737125)), scalar(1)); - var features = mobileNetV1(x, params.mobilenetv1); - var _a = predictionLayer(features.out, features.conv11, params.prediction_layer), boxPredictions = _a.boxPredictions, classPredictions = _a.classPredictions; - return outputLayer(boxPredictions, classPredictions, params.output_layer); - }); - }; - SsdMobilenetv1.prototype.forward = function (input) { - return __awaiter$1(this, void 0, void 0, function () { - var _a; - return __generator$1(this, function (_b) { - switch (_b.label) { - case 0: - _a = this.forwardInput; - return [4 /*yield*/, toNetInput(input)]; - case 1: return [2 /*return*/, _a.apply(this, [_b.sent()])]; - } - }); - }); - }; - SsdMobilenetv1.prototype.locateFaces = function (input, options) { - if (options === void 0) { options = {}; } - return __awaiter$1(this, void 0, void 0, function () { - var _a, maxResults, minConfidence, netInput, _b, _boxes, _scores, boxes, scores, i, scoresData, _c, _d, iouThreshold, indices, reshapedDims, inputSize, padX, padY, results; - return __generator$1(this, function (_e) { - switch (_e.label) { - case 0: - _a = new SsdMobilenetv1Options(options), maxResults = _a.maxResults, minConfidence = _a.minConfidence; - return [4 /*yield*/, toNetInput(input)]; - case 1: - netInput = _e.sent(); - _b = this.forwardInput(netInput), _boxes = _b.boxes, _scores = _b.scores; - boxes = _boxes[0]; - scores = _scores[0]; - for (i = 1; i < _boxes.length; i++) { - _boxes[i].dispose(); - _scores[i].dispose(); - } - _d = (_c = Array).from; - return [4 /*yield*/, scores.data()]; - case 2: - scoresData = _d.apply(_c, [_e.sent()]); - iouThreshold = 0.5; - indices = nonMaxSuppression$2(boxes, scoresData, maxResults, iouThreshold, minConfidence); - reshapedDims = netInput.getReshapedInputDimensions(0); - inputSize = netInput.inputSize; - padX = inputSize / reshapedDims.width; - padY = inputSize / reshapedDims.height; - results = indices - .map(function (idx) { - var _a = [ - Math.max(0, boxes.get(idx, 0)), - Math.min(1.0, boxes.get(idx, 2)) - ].map(function (val) { return val * padY; }), top = _a[0], bottom = _a[1]; - var _b = [ - Math.max(0, boxes.get(idx, 1)), - Math.min(1.0, boxes.get(idx, 3)) - ].map(function (val) { return val * padX; }), left = _b[0], right = _b[1]; - return new FaceDetection(scoresData[idx], new Rect(left, top, right - left, bottom - top), { - height: netInput.getInputHeight(0), - width: netInput.getInputWidth(0) - }); - }); - boxes.dispose(); - scores.dispose(); - return [2 /*return*/, results]; - } - }); - }); - }; - SsdMobilenetv1.prototype.loadQuantizedParams = function (uri) { - return loadQuantizedParams$3(uri); - }; - SsdMobilenetv1.prototype.extractParams = function (weights) { - return extractParams$3(weights); - }; - return SsdMobilenetv1; - }(NeuralNetwork)); - - function createSsdMobilenetv1(weights) { - var net = new SsdMobilenetv1(); - net.extractWeights(weights); - return net; - } - function createFaceDetectionNet(weights) { - return createSsdMobilenetv1(weights); - } - // alias for backward compatibily - var FaceDetectionNet = /** @class */ (function (_super) { - __extends$1(FaceDetectionNet, _super); - function FaceDetectionNet() { - return _super !== null && _super.apply(this, arguments) || this; - } - return FaceDetectionNet; - }(SsdMobilenetv1)); - - var TinyFaceDetectorOptions = /** @class */ (function (_super) { - __extends$1(TinyFaceDetectorOptions, _super); - function TinyFaceDetectorOptions() { - var _this = _super !== null && _super.apply(this, arguments) || this; - _this._name = 'TinyFaceDetectorOptions'; - return _this; - } - return TinyFaceDetectorOptions; - }(TinyYolov2Options)); - - var ComposableTask = /** @class */ (function () { - function ComposableTask() { - } - ComposableTask.prototype.then = function (onfulfilled) { - return __awaiter$1(this, void 0, void 0, function () { - var _a; - return __generator$1(this, function (_b) { - switch (_b.label) { - case 0: - _a = onfulfilled; - return [4 /*yield*/, this.run()]; - case 1: return [2 /*return*/, _a.apply(void 0, [_b.sent()])]; - } - }); - }); - }; - ComposableTask.prototype.run = function () { - return __awaiter$1(this, void 0, void 0, function () { - return __generator$1(this, function (_a) { - throw new Error('ComposableTask - run is not implemented'); - }); - }); - }; - return ComposableTask; - }()); - - function bgrToRgbTensor(tensor$$1) { - return tidy(function () { return stack(unstack(tensor$$1, 3).reverse(), 3); }); - } - - var CELL_STRIDE = 2; - var CELL_SIZE$1 = 12; - - function extractorsFactory$7(extractWeights, paramMappings) { - var extractConvParams = extractConvParamsFactory(extractWeights, paramMappings); - var extractFCParams = extractFCParamsFactory(extractWeights, paramMappings); - function extractPReluParams(size, paramPath) { - var alpha = tensor1d(extractWeights(size)); - paramMappings.push({ paramPath: paramPath }); - return alpha; - } - function extractSharedParams(numFilters, mappedPrefix, isRnet) { - if (isRnet === void 0) { isRnet = false; } - var conv1 = extractConvParams(numFilters[0], numFilters[1], 3, mappedPrefix + "/conv1"); - var prelu1_alpha = extractPReluParams(numFilters[1], mappedPrefix + "/prelu1_alpha"); - var conv2 = extractConvParams(numFilters[1], numFilters[2], 3, mappedPrefix + "/conv2"); - var prelu2_alpha = extractPReluParams(numFilters[2], mappedPrefix + "/prelu2_alpha"); - var conv3 = extractConvParams(numFilters[2], numFilters[3], isRnet ? 2 : 3, mappedPrefix + "/conv3"); - var prelu3_alpha = extractPReluParams(numFilters[3], mappedPrefix + "/prelu3_alpha"); - return { conv1: conv1, prelu1_alpha: prelu1_alpha, conv2: conv2, prelu2_alpha: prelu2_alpha, conv3: conv3, prelu3_alpha: prelu3_alpha }; - } - function extractPNetParams() { - var sharedParams = extractSharedParams([3, 10, 16, 32], 'pnet'); - var conv4_1 = extractConvParams(32, 2, 1, 'pnet/conv4_1'); - var conv4_2 = extractConvParams(32, 4, 1, 'pnet/conv4_2'); - return __assign$1({}, sharedParams, { conv4_1: conv4_1, conv4_2: conv4_2 }); - } - function extractRNetParams() { - var sharedParams = extractSharedParams([3, 28, 48, 64], 'rnet', true); - var fc1 = extractFCParams(576, 128, 'rnet/fc1'); - var prelu4_alpha = extractPReluParams(128, 'rnet/prelu4_alpha'); - var fc2_1 = extractFCParams(128, 2, 'rnet/fc2_1'); - var fc2_2 = extractFCParams(128, 4, 'rnet/fc2_2'); - return __assign$1({}, sharedParams, { fc1: fc1, prelu4_alpha: prelu4_alpha, fc2_1: fc2_1, fc2_2: fc2_2 }); - } - function extractONetParams() { - var sharedParams = extractSharedParams([3, 32, 64, 64], 'onet'); - var conv4 = extractConvParams(64, 128, 2, 'onet/conv4'); - var prelu4_alpha = extractPReluParams(128, 'onet/prelu4_alpha'); - var fc1 = extractFCParams(1152, 256, 'onet/fc1'); - var prelu5_alpha = extractPReluParams(256, 'onet/prelu5_alpha'); - var fc2_1 = extractFCParams(256, 2, 'onet/fc2_1'); - var fc2_2 = extractFCParams(256, 4, 'onet/fc2_2'); - var fc2_3 = extractFCParams(256, 10, 'onet/fc2_3'); - return __assign$1({}, sharedParams, { conv4: conv4, prelu4_alpha: prelu4_alpha, fc1: fc1, prelu5_alpha: prelu5_alpha, fc2_1: fc2_1, fc2_2: fc2_2, fc2_3: fc2_3 }); - } - return { - extractPNetParams: extractPNetParams, - extractRNetParams: extractRNetParams, - extractONetParams: extractONetParams - }; - } - function extractParams$4(weights) { - var _a = extractWeightsFactory(weights), extractWeights = _a.extractWeights, getRemainingWeights = _a.getRemainingWeights; - var paramMappings = []; - var _b = extractorsFactory$7(extractWeights, paramMappings), extractPNetParams = _b.extractPNetParams, extractRNetParams = _b.extractRNetParams, extractONetParams = _b.extractONetParams; - var pnet = extractPNetParams(); - var rnet = extractRNetParams(); - var onet = extractONetParams(); - if (getRemainingWeights().length !== 0) { - throw new Error("weights remaing after extract: " + getRemainingWeights().length); - } - return { params: { pnet: pnet, rnet: rnet, onet: onet }, paramMappings: paramMappings }; - } - - function getSizesForScale(scale, _a) { - var height = _a[0], width = _a[1]; - return { - height: Math.floor(height * scale), - width: Math.floor(width * scale) - }; - } - - var DEFAULT_MODEL_NAME$4 = 'mtcnn_model'; - function extractorsFactory$8(weightMap, paramMappings) { - var extractWeightEntry = extractWeightEntryFactory(weightMap, paramMappings); - function extractConvParams(prefix) { - var filters = extractWeightEntry(prefix + "/weights", 4, prefix + "/filters"); - var bias = extractWeightEntry(prefix + "/bias", 1); - return { filters: filters, bias: bias }; - } - function extractFCParams(prefix) { - var weights = extractWeightEntry(prefix + "/weights", 2); - var bias = extractWeightEntry(prefix + "/bias", 1); - return { weights: weights, bias: bias }; - } - function extractPReluParams(paramPath) { - return extractWeightEntry(paramPath, 1); - } - function extractSharedParams(prefix) { - var conv1 = extractConvParams(prefix + "/conv1"); - var prelu1_alpha = extractPReluParams(prefix + "/prelu1_alpha"); - var conv2 = extractConvParams(prefix + "/conv2"); - var prelu2_alpha = extractPReluParams(prefix + "/prelu2_alpha"); - var conv3 = extractConvParams(prefix + "/conv3"); - var prelu3_alpha = extractPReluParams(prefix + "/prelu3_alpha"); - return { conv1: conv1, prelu1_alpha: prelu1_alpha, conv2: conv2, prelu2_alpha: prelu2_alpha, conv3: conv3, prelu3_alpha: prelu3_alpha }; - } - function extractPNetParams() { - var sharedParams = extractSharedParams('pnet'); - var conv4_1 = extractConvParams('pnet/conv4_1'); - var conv4_2 = extractConvParams('pnet/conv4_2'); - return __assign$1({}, sharedParams, { conv4_1: conv4_1, conv4_2: conv4_2 }); - } - function extractRNetParams() { - var sharedParams = extractSharedParams('rnet'); - var fc1 = extractFCParams('rnet/fc1'); - var prelu4_alpha = extractPReluParams('rnet/prelu4_alpha'); - var fc2_1 = extractFCParams('rnet/fc2_1'); - var fc2_2 = extractFCParams('rnet/fc2_2'); - return __assign$1({}, sharedParams, { fc1: fc1, prelu4_alpha: prelu4_alpha, fc2_1: fc2_1, fc2_2: fc2_2 }); - } - function extractONetParams() { - var sharedParams = extractSharedParams('onet'); - var conv4 = extractConvParams('onet/conv4'); - var prelu4_alpha = extractPReluParams('onet/prelu4_alpha'); - var fc1 = extractFCParams('onet/fc1'); - var prelu5_alpha = extractPReluParams('onet/prelu5_alpha'); - var fc2_1 = extractFCParams('onet/fc2_1'); - var fc2_2 = extractFCParams('onet/fc2_2'); - var fc2_3 = extractFCParams('onet/fc2_3'); - return __assign$1({}, sharedParams, { conv4: conv4, prelu4_alpha: prelu4_alpha, fc1: fc1, prelu5_alpha: prelu5_alpha, fc2_1: fc2_1, fc2_2: fc2_2, fc2_3: fc2_3 }); - } - return { - extractPNetParams: extractPNetParams, - extractRNetParams: extractRNetParams, - extractONetParams: extractONetParams - }; - } - function loadQuantizedParams$4(uri) { - return __awaiter$1(this, void 0, void 0, function () { - var weightMap, paramMappings, _a, extractPNetParams, extractRNetParams, extractONetParams, pnet, rnet, onet; - return __generator$1(this, function (_b) { - switch (_b.label) { - case 0: return [4 /*yield*/, loadWeightMap(uri, DEFAULT_MODEL_NAME$4)]; - case 1: - weightMap = _b.sent(); - paramMappings = []; - _a = extractorsFactory$8(weightMap, paramMappings), extractPNetParams = _a.extractPNetParams, extractRNetParams = _a.extractRNetParams, extractONetParams = _a.extractONetParams; - pnet = extractPNetParams(); - rnet = extractRNetParams(); - onet = extractONetParams(); - disposeUnusedWeightTensors(weightMap, paramMappings); - return [2 /*return*/, { params: { pnet: pnet, rnet: rnet, onet: onet }, paramMappings: paramMappings }]; - } - }); - }); - } - - function pyramidDown(minFaceSize, scaleFactor, dims) { - var height = dims[0], width = dims[1]; - var m = CELL_SIZE$1 / minFaceSize; - var scales = []; - var minLayer = Math.min(height, width) * m; - var exp = 0; - while (minLayer >= 12) { - scales.push(m * Math.pow(scaleFactor, exp)); - minLayer = minLayer * scaleFactor; - exp += 1; - } - return scales; - } - - var MtcnnBox = /** @class */ (function (_super) { - __extends$1(MtcnnBox, _super); - function MtcnnBox(left, top, right, bottom) { - return _super.call(this, { left: left, top: top, right: right, bottom: bottom }, true) || this; - } - return MtcnnBox; - }(Box)); - - function normalize$1(x) { - return tidy(function () { return mul(sub(x, scalar(127.5)), scalar(0.0078125)); }); - } - - function prelu$1(x, alpha) { - return tidy(function () { - return add(relu(x), mul(alpha, neg(relu(neg(x))))); - }); - } - - function sharedLayer(x, params, isPnet) { - if (isPnet === void 0) { isPnet = false; } - return tidy(function () { - var out = convLayer(x, params.conv1, 'valid'); - out = prelu$1(out, params.prelu1_alpha); - out = maxPool(out, isPnet ? [2, 2] : [3, 3], [2, 2], 'same'); - out = convLayer(out, params.conv2, 'valid'); - out = prelu$1(out, params.prelu2_alpha); - out = isPnet ? out : maxPool(out, [3, 3], [2, 2], 'valid'); - out = convLayer(out, params.conv3, 'valid'); - out = prelu$1(out, params.prelu3_alpha); - return out; - }); - } - - function PNet(x, params) { - return tidy(function () { - var out = sharedLayer(x, params, true); - var conv = convLayer(out, params.conv4_1, 'valid'); - var max$$1 = expandDims(max(conv, 3), 3); - var prob = softmax(sub(conv, max$$1), 3); - var regions = convLayer(out, params.conv4_2, 'valid'); - return { prob: prob, regions: regions }; - }); - } - - function rescaleAndNormalize(x, scale) { - return tidy(function () { - var _a = getSizesForScale(scale, x.shape.slice(1)), height = _a.height, width = _a.width; - var resized = image_ops.resizeBilinear(x, [height, width]); - var normalized = normalize$1(resized); - return transpose(normalized, [0, 2, 1, 3]); - }); - } - function extractBoundingBoxes(scoresTensor, regionsTensor, scale, scoreThreshold) { - // TODO: fix this!, maybe better to use tf.gather here - var indices = []; - for (var y = 0; y < scoresTensor.shape[0]; y++) { - for (var x = 0; x < scoresTensor.shape[1]; x++) { - if (scoresTensor.get(y, x) >= scoreThreshold) { - indices.push(new Point(x, y)); - } - } - } - var boundingBoxes = indices.map(function (idx) { - var cell = new BoundingBox(Math.round((idx.y * CELL_STRIDE + 1) / scale), Math.round((idx.x * CELL_STRIDE + 1) / scale), Math.round((idx.y * CELL_STRIDE + CELL_SIZE$1) / scale), Math.round((idx.x * CELL_STRIDE + CELL_SIZE$1) / scale)); - var score = scoresTensor.get(idx.y, idx.x); - var region = new MtcnnBox(regionsTensor.get(idx.y, idx.x, 0), regionsTensor.get(idx.y, idx.x, 1), regionsTensor.get(idx.y, idx.x, 2), regionsTensor.get(idx.y, idx.x, 3)); - return { - cell: cell, - score: score, - region: region - }; - }); - return boundingBoxes; - } - function stage1(imgTensor, scales, scoreThreshold, params, stats) { - stats.stage1 = []; - var pnetOutputs = scales.map(function (scale) { return tidy(function () { - var statsForScale = { scale: scale }; - var resized = rescaleAndNormalize(imgTensor, scale); - var ts = Date.now(); - var _a = PNet(resized, params), prob = _a.prob, regions = _a.regions; - statsForScale.pnet = Date.now() - ts; - var scoresTensor = unstack(unstack(prob, 3)[1])[0]; - var regionsTensor = unstack(regions)[0]; - return { - scoresTensor: scoresTensor, - regionsTensor: regionsTensor, - scale: scale, - statsForScale: statsForScale - }; - }); }); - var boxesForScale = pnetOutputs.map(function (_a) { - var scoresTensor = _a.scoresTensor, regionsTensor = _a.regionsTensor, scale = _a.scale, statsForScale = _a.statsForScale; - var boundingBoxes = extractBoundingBoxes(scoresTensor, regionsTensor, scale, scoreThreshold); - scoresTensor.dispose(); - regionsTensor.dispose(); - if (!boundingBoxes.length) { - stats.stage1.push(statsForScale); - return []; - } - var ts = Date.now(); - var indices = nonMaxSuppression$1(boundingBoxes.map(function (bbox) { return bbox.cell; }), boundingBoxes.map(function (bbox) { return bbox.score; }), 0.5); - statsForScale.nms = Date.now() - ts; - statsForScale.numBoxes = indices.length; - stats.stage1.push(statsForScale); - return indices.map(function (boxIdx) { return boundingBoxes[boxIdx]; }); - }); - var allBoxes = boxesForScale.reduce(function (all$$1, boxes) { return all$$1.concat(boxes); }, []); - var finalBoxes = []; - var finalScores = []; - if (allBoxes.length > 0) { - var ts = Date.now(); - var indices = nonMaxSuppression$1(allBoxes.map(function (bbox) { return bbox.cell; }), allBoxes.map(function (bbox) { return bbox.score; }), 0.7); - stats.stage1_nms = Date.now() - ts; - finalScores = indices.map(function (idx) { return allBoxes[idx].score; }); - finalBoxes = indices - .map(function (idx) { return allBoxes[idx]; }) - .map(function (_a) { - var cell = _a.cell, region = _a.region; - return new BoundingBox(cell.left + (region.left * cell.width), cell.top + (region.top * cell.height), cell.right + (region.right * cell.width), cell.bottom + (region.bottom * cell.height)).toSquare().round(); - }); - } - return { - boxes: finalBoxes, - scores: finalScores - }; - } - - function extractImagePatches(img, boxes, _a) { - var width = _a.width, height = _a.height; - return __awaiter$1(this, void 0, void 0, function () { - var _this = this; - var imgCtx, bitmaps, imagePatchesDatas; - return __generator$1(this, function (_b) { - switch (_b.label) { - case 0: - imgCtx = getContext2dOrThrow(img); - return [4 /*yield*/, Promise.all(boxes.map(function (box) { return __awaiter$1(_this, void 0, void 0, function () { - var _a, y, ey, x, ex, fromX, fromY, imgData; - return __generator$1(this, function (_b) { - _a = box.padAtBorders(img.height, img.width), y = _a.y, ey = _a.ey, x = _a.x, ex = _a.ex; - fromX = x - 1; - fromY = y - 1; - imgData = imgCtx.getImageData(fromX, fromY, (ex - fromX), (ey - fromY)); - return [2 /*return*/, createImageBitmap(imgData)]; - }); - }); }))]; - case 1: - bitmaps = _b.sent(); - imagePatchesDatas = []; - bitmaps.forEach(function (bmp) { - var patch = createCanvas({ width: width, height: height }); - var patchCtx = getContext2dOrThrow(patch); - patchCtx.drawImage(bmp, 0, 0, width, height); - var data = patchCtx.getImageData(0, 0, width, height).data; - var currData = []; - // RGBA -> BGR - for (var i = 0; i < data.length; i += 4) { - currData.push(data[i + 2]); - currData.push(data[i + 1]); - currData.push(data[i]); - } - imagePatchesDatas.push(currData); - }); - return [2 /*return*/, imagePatchesDatas.map(function (data) { - var t = tidy(function () { - var imagePatchTensor = transpose(tensor4d(data, [1, width, height, 3]), [0, 2, 1, 3]).toFloat(); - return normalize$1(imagePatchTensor); - }); - return t; - })]; - } - }); - }); - } - - function RNet(x, params) { - return tidy(function () { - var convOut = sharedLayer(x, params); - var vectorized = reshape(convOut, [convOut.shape[0], params.fc1.weights.shape[0]]); - var fc1 = fullyConnectedLayer(vectorized, params.fc1); - var prelu4 = prelu$1(fc1, params.prelu4_alpha); - var fc2_1 = fullyConnectedLayer(prelu4, params.fc2_1); - var max$$1 = expandDims(max(fc2_1, 1), 1); - var prob = softmax(sub(fc2_1, max$$1), 1); - var regions = fullyConnectedLayer(prelu4, params.fc2_2); - var scores = unstack(prob, 1)[1]; - return { scores: scores, regions: regions }; - }); - } - - function stage2(img, inputBoxes, scoreThreshold, params, stats) { - return __awaiter$1(this, void 0, void 0, function () { - var ts, rnetInputs, rnetOuts, scoresTensor, scores, _a, _b, indices, filteredBoxes, filteredScores, finalBoxes, finalScores, indicesNms, regions_1; - return __generator$1(this, function (_c) { - switch (_c.label) { - case 0: - ts = Date.now(); - return [4 /*yield*/, extractImagePatches(img, inputBoxes, { width: 24, height: 24 })]; - case 1: - rnetInputs = _c.sent(); - stats.stage2_extractImagePatches = Date.now() - ts; - ts = Date.now(); - rnetOuts = rnetInputs.map(function (rnetInput) { - var out = RNet(rnetInput, params); - rnetInput.dispose(); - return out; - }); - stats.stage2_rnet = Date.now() - ts; - scoresTensor = rnetOuts.length > 1 - ? concat(rnetOuts.map(function (out) { return out.scores; })) - : rnetOuts[0].scores; - _b = (_a = Array).from; - return [4 /*yield*/, scoresTensor.data()]; - case 2: - scores = _b.apply(_a, [_c.sent()]); - scoresTensor.dispose(); - indices = scores - .map(function (score, idx) { return ({ score: score, idx: idx }); }) - .filter(function (c) { return c.score > scoreThreshold; }) - .map(function (_a) { - var idx = _a.idx; - return idx; - }); - filteredBoxes = indices.map(function (idx) { return inputBoxes[idx]; }); - filteredScores = indices.map(function (idx) { return scores[idx]; }); - finalBoxes = []; - finalScores = []; - if (filteredBoxes.length > 0) { - ts = Date.now(); - indicesNms = nonMaxSuppression$1(filteredBoxes, filteredScores, 0.7); - stats.stage2_nms = Date.now() - ts; - regions_1 = indicesNms.map(function (idx) { - return new MtcnnBox(rnetOuts[indices[idx]].regions.get(0, 0), rnetOuts[indices[idx]].regions.get(0, 1), rnetOuts[indices[idx]].regions.get(0, 2), rnetOuts[indices[idx]].regions.get(0, 3)); - }); - finalScores = indicesNms.map(function (idx) { return filteredScores[idx]; }); - finalBoxes = indicesNms.map(function (idx, i) { return filteredBoxes[idx].calibrate(regions_1[i]); }); - } - rnetOuts.forEach(function (t) { - t.regions.dispose(); - t.scores.dispose(); - }); - return [2 /*return*/, { - boxes: finalBoxes, - scores: finalScores - }]; - } - }); - }); - } - - function ONet(x, params) { - return tidy(function () { - var out = sharedLayer(x, params); - out = maxPool(out, [2, 2], [2, 2], 'same'); - out = convLayer(out, params.conv4, 'valid'); - out = prelu$1(out, params.prelu4_alpha); - var vectorized = reshape(out, [out.shape[0], params.fc1.weights.shape[0]]); - var fc1 = fullyConnectedLayer(vectorized, params.fc1); - var prelu5 = prelu$1(fc1, params.prelu5_alpha); - var fc2_1 = fullyConnectedLayer(prelu5, params.fc2_1); - var max$$1 = expandDims(max(fc2_1, 1), 1); - var prob = softmax(sub(fc2_1, max$$1), 1); - var regions = fullyConnectedLayer(prelu5, params.fc2_2); - var points = fullyConnectedLayer(prelu5, params.fc2_3); - var scores = unstack(prob, 1)[1]; - return { scores: scores, regions: regions, points: points }; - }); - } - - function stage3(img, inputBoxes, scoreThreshold, params, stats) { - return __awaiter$1(this, void 0, void 0, function () { - var ts, onetInputs, onetOuts, scoresTensor, scores, _a, _b, indices, filteredRegions, filteredBoxes, filteredScores, finalBoxes, finalScores, points, indicesNms; - return __generator$1(this, function (_c) { - switch (_c.label) { - case 0: - ts = Date.now(); - return [4 /*yield*/, extractImagePatches(img, inputBoxes, { width: 48, height: 48 })]; - case 1: - onetInputs = _c.sent(); - stats.stage3_extractImagePatches = Date.now() - ts; - ts = Date.now(); - onetOuts = onetInputs.map(function (onetInput) { - var out = ONet(onetInput, params); - onetInput.dispose(); - return out; - }); - stats.stage3_onet = Date.now() - ts; - scoresTensor = onetOuts.length > 1 - ? concat(onetOuts.map(function (out) { return out.scores; })) - : onetOuts[0].scores; - _b = (_a = Array).from; - return [4 /*yield*/, scoresTensor.data()]; - case 2: - scores = _b.apply(_a, [_c.sent()]); - scoresTensor.dispose(); - indices = scores - .map(function (score, idx) { return ({ score: score, idx: idx }); }) - .filter(function (c) { return c.score > scoreThreshold; }) - .map(function (_a) { - var idx = _a.idx; - return idx; - }); - filteredRegions = indices.map(function (idx) { return new MtcnnBox(onetOuts[idx].regions.get(0, 0), onetOuts[idx].regions.get(0, 1), onetOuts[idx].regions.get(0, 2), onetOuts[idx].regions.get(0, 3)); }); - filteredBoxes = indices - .map(function (idx, i) { return inputBoxes[idx].calibrate(filteredRegions[i]); }); - filteredScores = indices.map(function (idx) { return scores[idx]; }); - finalBoxes = []; - finalScores = []; - points = []; - if (filteredBoxes.length > 0) { - ts = Date.now(); - indicesNms = nonMaxSuppression$1(filteredBoxes, filteredScores, 0.7, false); - stats.stage3_nms = Date.now() - ts; - finalBoxes = indicesNms.map(function (idx) { return filteredBoxes[idx]; }); - finalScores = indicesNms.map(function (idx) { return filteredScores[idx]; }); - points = indicesNms.map(function (idx, i) { - return Array(5).fill(0).map(function (_, ptIdx) { - return new Point(((onetOuts[idx].points.get(0, ptIdx) * (finalBoxes[i].width + 1)) + finalBoxes[i].left), ((onetOuts[idx].points.get(0, ptIdx + 5) * (finalBoxes[i].height + 1)) + finalBoxes[i].top)); - }); - }); - } - onetOuts.forEach(function (t) { - t.regions.dispose(); - t.scores.dispose(); - t.points.dispose(); - }); - return [2 /*return*/, { - boxes: finalBoxes, - scores: finalScores, - points: points - }]; - } - }); - }); - } - - var Mtcnn = /** @class */ (function (_super) { - __extends$1(Mtcnn, _super); - function Mtcnn() { - return _super.call(this, 'Mtcnn') || this; - } - Mtcnn.prototype.forwardInput = function (input, forwardParams) { - if (forwardParams === void 0) { forwardParams = {}; } - return __awaiter$1(this, void 0, void 0, function () { - var params, inputCanvas, stats, tsTotal, imgTensor, onReturn, _a, height, width, _b, minFaceSize, scaleFactor, maxNumScales, scoreThresholds, scaleSteps, scales, ts, out1, out2, out3, results; - return __generator$1(this, function (_c) { - switch (_c.label) { - case 0: - params = this.params; - if (!params) { - throw new Error('Mtcnn - load model before inference'); - } - inputCanvas = input.canvases[0]; - if (!inputCanvas) { - throw new Error('Mtcnn - inputCanvas is not defined, note that passing tensors into Mtcnn.forwardInput is not supported yet.'); - } - stats = {}; - tsTotal = Date.now(); - imgTensor = tidy(function () { - return bgrToRgbTensor(expandDims(fromPixels(inputCanvas)).toFloat()); - }); - onReturn = function (results) { - // dispose tensors on return - imgTensor.dispose(); - stats.total = Date.now() - tsTotal; - return results; - }; - _a = imgTensor.shape.slice(1), height = _a[0], width = _a[1]; - _b = new MtcnnOptions(forwardParams), minFaceSize = _b.minFaceSize, scaleFactor = _b.scaleFactor, maxNumScales = _b.maxNumScales, scoreThresholds = _b.scoreThresholds, scaleSteps = _b.scaleSteps; - scales = (scaleSteps || pyramidDown(minFaceSize, scaleFactor, [height, width])) - .filter(function (scale) { - var sizes = getSizesForScale(scale, [height, width]); - return Math.min(sizes.width, sizes.height) > CELL_SIZE$1; - }) - .slice(0, maxNumScales); - stats.scales = scales; - stats.pyramid = scales.map(function (scale) { return getSizesForScale(scale, [height, width]); }); - ts = Date.now(); - return [4 /*yield*/, stage1(imgTensor, scales, scoreThresholds[0], params.pnet, stats)]; - case 1: - out1 = _c.sent(); - stats.total_stage1 = Date.now() - ts; - if (!out1.boxes.length) { - return [2 /*return*/, onReturn({ results: [], stats: stats })]; - } - stats.stage2_numInputBoxes = out1.boxes.length; - // using the inputCanvas to extract and resize the image patches, since it is faster - // than doing this on the gpu - ts = Date.now(); - return [4 /*yield*/, stage2(inputCanvas, out1.boxes, scoreThresholds[1], params.rnet, stats)]; - case 2: - out2 = _c.sent(); - stats.total_stage2 = Date.now() - ts; - if (!out2.boxes.length) { - return [2 /*return*/, onReturn({ results: [], stats: stats })]; - } - stats.stage3_numInputBoxes = out2.boxes.length; - ts = Date.now(); - return [4 /*yield*/, stage3(inputCanvas, out2.boxes, scoreThresholds[2], params.onet, stats)]; - case 3: - out3 = _c.sent(); - stats.total_stage3 = Date.now() - ts; - results = out3.boxes.map(function (box, idx) { return new FaceDetectionWithLandmarks(new FaceDetection(out3.scores[idx], new Rect(box.left / width, box.top / height, box.width / width, box.height / height), { - height: height, - width: width - }), new FaceLandmarks5(out3.points[idx].map(function (pt) { return pt.sub(new Point(box.left, box.top)).div(new Point(box.width, box.height)); }), { width: box.width, height: box.height })); }); - return [2 /*return*/, onReturn({ results: results, stats: stats })]; - } - }); - }); - }; - Mtcnn.prototype.forward = function (input, forwardParams) { - if (forwardParams === void 0) { forwardParams = {}; } - return __awaiter$1(this, void 0, void 0, function () { - var _a; - return __generator$1(this, function (_b) { - switch (_b.label) { - case 0: - _a = this.forwardInput; - return [4 /*yield*/, toNetInput(input)]; - case 1: return [4 /*yield*/, _a.apply(this, [_b.sent(), - forwardParams])]; - case 2: return [2 /*return*/, (_b.sent()).results]; - } - }); - }); - }; - Mtcnn.prototype.forwardWithStats = function (input, forwardParams) { - if (forwardParams === void 0) { forwardParams = {}; } - return __awaiter$1(this, void 0, void 0, function () { - var _a; - return __generator$1(this, function (_b) { - switch (_b.label) { - case 0: - _a = this.forwardInput; - return [4 /*yield*/, toNetInput(input)]; - case 1: return [2 /*return*/, _a.apply(this, [_b.sent(), - forwardParams])]; - } - }); - }); - }; - // none of the param tensors are quantized yet - Mtcnn.prototype.loadQuantizedParams = function (uri) { - return loadQuantizedParams$4(uri); - }; - Mtcnn.prototype.extractParams = function (weights) { - return extractParams$4(weights); - }; - return Mtcnn; - }(NeuralNetwork)); - - var IOU_THRESHOLD = 0.4; - var BOX_ANCHORS = [ - new Point(1.603231, 2.094468), - new Point(6.041143, 7.080126), - new Point(2.882459, 3.518061), - new Point(4.266906, 5.178857), - new Point(9.041765, 10.66308) - ]; - var MEAN_RGB = [117.001, 114.697, 97.404]; - var DEFAULT_MODEL_NAME$5 = 'tiny_face_detector_model'; - - var TinyFaceDetector = /** @class */ (function (_super) { - __extends$1(TinyFaceDetector, _super); - function TinyFaceDetector() { - var _this = this; - var config = { - withSeparableConvs: true, - iouThreshold: IOU_THRESHOLD, - classes: ['face'], - anchors: BOX_ANCHORS, - meanRgb: MEAN_RGB, - isFirstLayerConv2d: true, - filterSizes: [3, 16, 32, 64, 128, 256, 512] - }; - _this = _super.call(this, config) || this; - return _this; - } - Object.defineProperty(TinyFaceDetector.prototype, "anchors", { - get: function () { - return this.config.anchors; - }, - enumerable: true, - configurable: true - }); - TinyFaceDetector.prototype.locateFaces = function (input, forwardParams) { - return __awaiter$1(this, void 0, void 0, function () { - var objectDetections; - return __generator$1(this, function (_a) { - switch (_a.label) { - case 0: return [4 /*yield*/, this.detect(input, forwardParams)]; - case 1: - objectDetections = _a.sent(); - return [2 /*return*/, objectDetections.map(function (det) { return new FaceDetection(det.score, det.relativeBox, { width: det.imageWidth, height: det.imageHeight }); })]; - } - }); - }); - }; - TinyFaceDetector.prototype.loadQuantizedParams = function (modelUri) { - var defaultModelName = DEFAULT_MODEL_NAME$5; - return _super.prototype.loadQuantizedParams.call(this, modelUri, defaultModelName); - }; - return TinyFaceDetector; - }(TinyYolov2)); - - var IOU_THRESHOLD$1 = 0.4; - var BOX_ANCHORS$1 = [ - new Point(0.738768, 0.874946), - new Point(2.42204, 2.65704), - new Point(4.30971, 7.04493), - new Point(10.246, 4.59428), - new Point(12.6868, 11.8741) - ]; - var BOX_ANCHORS_SEPARABLE = [ - new Point(1.603231, 2.094468), - new Point(6.041143, 7.080126), - new Point(2.882459, 3.518061), - new Point(4.266906, 5.178857), - new Point(9.041765, 10.66308) - ]; - var MEAN_RGB_SEPARABLE = [117.001, 114.697, 97.404]; - var DEFAULT_MODEL_NAME$6 = 'tiny_yolov2_model'; - var DEFAULT_MODEL_NAME_SEPARABLE_CONV = 'tiny_yolov2_separable_conv_model'; - - var TinyYolov2$1 = /** @class */ (function (_super) { - __extends$1(TinyYolov2$$1, _super); - function TinyYolov2$$1(withSeparableConvs) { - if (withSeparableConvs === void 0) { withSeparableConvs = true; } - var _this = this; - var config = Object.assign({}, { - withSeparableConvs: withSeparableConvs, - iouThreshold: IOU_THRESHOLD$1, - classes: ['face'] - }, withSeparableConvs - ? { - anchors: BOX_ANCHORS_SEPARABLE, - meanRgb: MEAN_RGB_SEPARABLE - } - : { - anchors: BOX_ANCHORS$1, - withClassScores: true - }); - _this = _super.call(this, config) || this; - return _this; - } - Object.defineProperty(TinyYolov2$$1.prototype, "withSeparableConvs", { - get: function () { - return this.config.withSeparableConvs; - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(TinyYolov2$$1.prototype, "anchors", { - get: function () { - return this.config.anchors; - }, - enumerable: true, - configurable: true - }); - TinyYolov2$$1.prototype.locateFaces = function (input, forwardParams) { - return __awaiter$1(this, void 0, void 0, function () { - var objectDetections; - return __generator$1(this, function (_a) { - switch (_a.label) { - case 0: return [4 /*yield*/, this.detect(input, forwardParams)]; - case 1: - objectDetections = _a.sent(); - return [2 /*return*/, objectDetections.map(function (det) { return new FaceDetection(det.score, det.relativeBox, { width: det.imageWidth, height: det.imageHeight }); })]; - } - }); - }); - }; - TinyYolov2$$1.prototype.loadQuantizedParams = function (modelUri) { - var defaultModelName = this.withSeparableConvs ? DEFAULT_MODEL_NAME_SEPARABLE_CONV : DEFAULT_MODEL_NAME$6; - return _super.prototype.loadQuantizedParams.call(this, modelUri, defaultModelName); - }; - return TinyYolov2$$1; - }(TinyYolov2)); - - var nets = { - ssdMobilenetv1: new SsdMobilenetv1(), - tinyFaceDetector: new TinyFaceDetector(), - tinyYolov2: new TinyYolov2$1(), - mtcnn: new Mtcnn(), - faceLandmark68Net: new FaceLandmark68Net(), - faceLandmark68TinyNet: new FaceLandmark68TinyNet(), - faceRecognitionNet: new FaceRecognitionNet() - }; - /** - * Attempts to detect all faces in an image using SSD Mobilenetv1 Network. - * - * @param input The input image. - * @param options (optional, default: see SsdMobilenetv1Options constructor for default parameters). - * @returns Bounding box of each face with score. - */ - var ssdMobilenetv1 = function (input, options) { - return nets.ssdMobilenetv1.locateFaces(input, options); - }; - /** - * Attempts to detect all faces in an image using the Tiny Face Detector. - * - * @param input The input image. - * @param options (optional, default: see TinyFaceDetectorOptions constructor for default parameters). - * @returns Bounding box of each face with score. - */ - var tinyFaceDetector = function (input, options) { - return nets.tinyFaceDetector.locateFaces(input, options); - }; - /** - * Attempts to detect all faces in an image using the Tiny Yolov2 Network. - * - * @param input The input image. - * @param options (optional, default: see TinyYolov2Options constructor for default parameters). - * @returns Bounding box of each face with score. - */ - var tinyYolov2 = function (input, options) { - return nets.tinyYolov2.locateFaces(input, options); - }; - /** - * Attempts to detect all faces in an image and the 5 point face landmarks - * of each detected face using the MTCNN Network. - * - * @param input The input image. - * @param options (optional, default: see MtcnnOptions constructor for default parameters). - * @returns Bounding box of each face with score and 5 point face landmarks. - */ - var mtcnn = function (input, options) { - return nets.mtcnn.forward(input, options); - }; - /** - * Detects the 68 point face landmark positions of the face shown in an image. - * - * @param inputs The face image extracted from the bounding box of a face. Can - * also be an array of input images, which will be batch processed. - * @returns 68 point face landmarks or array thereof in case of batch input. - */ - var detectFaceLandmarks = function (input) { - return nets.faceLandmark68Net.detectLandmarks(input); - }; - /** - * Detects the 68 point face landmark positions of the face shown in an image - * using a tinier version of the 68 point face landmark model, which is slightly - * faster at inference, but also slightly less accurate. - * - * @param inputs The face image extracted from the bounding box of a face. Can - * also be an array of input images, which will be batch processed. - * @returns 68 point face landmarks or array thereof in case of batch input. - */ - var detectFaceLandmarksTiny = function (input) { - return nets.faceLandmark68TinyNet.detectLandmarks(input); - }; - /** - * Computes a 128 entry vector (face descriptor / face embeddings) from the face shown in an image, - * which uniquely represents the features of that persons face. The computed face descriptor can - * be used to measure the similarity between faces, by computing the euclidean distance of two - * face descriptors. - * - * @param inputs The face image extracted from the aligned bounding box of a face. Can - * also be an array of input images, which will be batch processed. - * @returns Face descriptor with 128 entries or array thereof in case of batch input. - */ - var computeFaceDescriptor = function (input) { - return nets.faceRecognitionNet.computeFaceDescriptor(input); - }; - var loadSsdMobilenetv1Model = function (url) { return nets.ssdMobilenetv1.load(url); }; - var loadTinyFaceDetectorModel = function (url) { return nets.tinyFaceDetector.load(url); }; - var loadMtcnnModel = function (url) { return nets.mtcnn.load(url); }; - var loadTinyYolov2Model = function (url) { return nets.tinyYolov2.load(url); }; - var loadFaceLandmarkModel = function (url) { return nets.faceLandmark68Net.load(url); }; - var loadFaceLandmarkTinyModel = function (url) { return nets.faceLandmark68TinyNet.load(url); }; - var loadFaceRecognitionModel = function (url) { return nets.faceRecognitionNet.load(url); }; - // backward compatibility - var loadFaceDetectionModel = loadSsdMobilenetv1Model; - var locateFaces = ssdMobilenetv1; - var detectLandmarks = detectFaceLandmarks; - - var ComputeFaceDescriptorsTaskBase = /** @class */ (function (_super) { - __extends$1(ComputeFaceDescriptorsTaskBase, _super); - function ComputeFaceDescriptorsTaskBase(detectFaceLandmarksTask, input) { - var _this = _super.call(this) || this; - _this.detectFaceLandmarksTask = detectFaceLandmarksTask; - _this.input = input; - return _this; - } - return ComputeFaceDescriptorsTaskBase; - }(ComposableTask)); - var ComputeAllFaceDescriptorsTask = /** @class */ (function (_super) { - __extends$1(ComputeAllFaceDescriptorsTask, _super); - function ComputeAllFaceDescriptorsTask() { - return _super !== null && _super.apply(this, arguments) || this; - } - ComputeAllFaceDescriptorsTask.prototype.run = function () { - return __awaiter$1(this, void 0, void 0, function () { - var _this = this; - var facesWithLandmarks, alignedFaceCanvases; - return __generator$1(this, function (_a) { - switch (_a.label) { - case 0: return [4 /*yield*/, this.detectFaceLandmarksTask]; - case 1: - facesWithLandmarks = _a.sent(); - return [4 /*yield*/, extractFaces(this.input, facesWithLandmarks.map(function (_a) { - var landmarks = _a.landmarks; - return landmarks.align(); - }))]; - case 2: - alignedFaceCanvases = _a.sent(); - return [4 /*yield*/, Promise.all(facesWithLandmarks.map(function (_a, i) { - var detection = _a.detection, landmarks = _a.landmarks; - return __awaiter$1(_this, void 0, void 0, function () { - var descriptor; - return __generator$1(this, function (_b) { - switch (_b.label) { - case 0: return [4 /*yield*/, nets.faceRecognitionNet.computeFaceDescriptor(alignedFaceCanvases[i])]; - case 1: - descriptor = _b.sent(); - return [2 /*return*/, new FullFaceDescription(detection, landmarks, descriptor)]; - } - }); - }); - }))]; - case 3: return [2 /*return*/, _a.sent()]; - } - }); - }); - }; - return ComputeAllFaceDescriptorsTask; - }(ComputeFaceDescriptorsTaskBase)); - var ComputeSingleFaceDescriptorTask = /** @class */ (function (_super) { - __extends$1(ComputeSingleFaceDescriptorTask, _super); - function ComputeSingleFaceDescriptorTask() { - return _super !== null && _super.apply(this, arguments) || this; - } - ComputeSingleFaceDescriptorTask.prototype.run = function () { - return __awaiter$1(this, void 0, void 0, function () { - var detectionWithLandmarks, detection, landmarks, alignedRect, alignedFaceCanvas, descriptor; - return __generator$1(this, function (_a) { - switch (_a.label) { - case 0: return [4 /*yield*/, this.detectFaceLandmarksTask]; - case 1: - detectionWithLandmarks = _a.sent(); - if (!detectionWithLandmarks) { - return [2 /*return*/]; - } - detection = detectionWithLandmarks.detection, landmarks = detectionWithLandmarks.landmarks, alignedRect = detectionWithLandmarks.alignedRect; - return [4 /*yield*/, extractFaces(this.input, [alignedRect])]; - case 2: - alignedFaceCanvas = (_a.sent())[0]; - return [4 /*yield*/, nets.faceRecognitionNet.computeFaceDescriptor(alignedFaceCanvas)]; - case 3: - descriptor = _a.sent(); - return [2 /*return*/, new FullFaceDescription(detection, landmarks, descriptor)]; - } - }); - }); - }; - return ComputeSingleFaceDescriptorTask; - }(ComputeFaceDescriptorsTaskBase)); - - var DetectFaceLandmarksTaskBase = /** @class */ (function (_super) { - __extends$1(DetectFaceLandmarksTaskBase, _super); - function DetectFaceLandmarksTaskBase(detectFacesTask, input, useTinyLandmarkNet) { - var _this = _super.call(this) || this; - _this.detectFacesTask = detectFacesTask; - _this.input = input; - _this.useTinyLandmarkNet = useTinyLandmarkNet; - return _this; - } - Object.defineProperty(DetectFaceLandmarksTaskBase.prototype, "landmarkNet", { - get: function () { - return this.useTinyLandmarkNet - ? nets.faceLandmark68TinyNet - : nets.faceLandmark68Net; - }, - enumerable: true, - configurable: true - }); - return DetectFaceLandmarksTaskBase; - }(ComposableTask)); - var DetectAllFaceLandmarksTask = /** @class */ (function (_super) { - __extends$1(DetectAllFaceLandmarksTask, _super); - function DetectAllFaceLandmarksTask() { - return _super !== null && _super.apply(this, arguments) || this; - } - DetectAllFaceLandmarksTask.prototype.run = function () { - return __awaiter$1(this, void 0, void 0, function () { - var _this = this; - var detections, faceCanvases, faceLandmarksByFace; - return __generator$1(this, function (_a) { - switch (_a.label) { - case 0: return [4 /*yield*/, this.detectFacesTask]; - case 1: - detections = _a.sent(); - return [4 /*yield*/, extractFaces(this.input, detections)]; - case 2: - faceCanvases = _a.sent(); - return [4 /*yield*/, Promise.all(faceCanvases.map(function (canvas) { return _this.landmarkNet.detectLandmarks(canvas); }))]; - case 3: - faceLandmarksByFace = _a.sent(); - return [2 /*return*/, detections.map(function (detection, i) { - return new FaceDetectionWithLandmarks(detection, faceLandmarksByFace[i]); - })]; - } - }); - }); - }; - DetectAllFaceLandmarksTask.prototype.withFaceDescriptors = function () { - return new ComputeAllFaceDescriptorsTask(this, this.input); - }; - return DetectAllFaceLandmarksTask; - }(DetectFaceLandmarksTaskBase)); - var DetectSingleFaceLandmarksTask = /** @class */ (function (_super) { - __extends$1(DetectSingleFaceLandmarksTask, _super); - function DetectSingleFaceLandmarksTask() { - return _super !== null && _super.apply(this, arguments) || this; - } - DetectSingleFaceLandmarksTask.prototype.run = function () { - return __awaiter$1(this, void 0, void 0, function () { - var detection, faceCanvas, _a, _b; - return __generator$1(this, function (_c) { - switch (_c.label) { - case 0: return [4 /*yield*/, this.detectFacesTask]; - case 1: - detection = _c.sent(); - if (!detection) { - return [2 /*return*/]; - } - return [4 /*yield*/, extractFaces(this.input, [detection])]; - case 2: - faceCanvas = (_c.sent())[0]; - _a = FaceDetectionWithLandmarks.bind; - _b = [void 0, detection]; - return [4 /*yield*/, this.landmarkNet.detectLandmarks(faceCanvas)]; - case 3: return [2 /*return*/, new (_a.apply(FaceDetectionWithLandmarks, _b.concat([_c.sent()])))()]; - } - }); - }); - }; - DetectSingleFaceLandmarksTask.prototype.withFaceDescriptor = function () { - return new ComputeSingleFaceDescriptorTask(this, this.input); - }; - return DetectSingleFaceLandmarksTask; - }(DetectFaceLandmarksTaskBase)); - - var DetectFacesTaskBase = /** @class */ (function (_super) { - __extends$1(DetectFacesTaskBase, _super); - function DetectFacesTaskBase(input, options) { - if (options === void 0) { options = new SsdMobilenetv1Options(); } - var _this = _super.call(this) || this; - _this.input = input; - _this.options = options; - return _this; - } - return DetectFacesTaskBase; - }(ComposableTask)); - var DetectAllFacesTask = /** @class */ (function (_super) { - __extends$1(DetectAllFacesTask, _super); - function DetectAllFacesTask() { - return _super !== null && _super.apply(this, arguments) || this; - } - DetectAllFacesTask.prototype.run = function () { - return __awaiter$1(this, void 0, void 0, function () { - var _a, input, options, faceDetectionFunction; - return __generator$1(this, function (_b) { - switch (_b.label) { - case 0: - _a = this, input = _a.input, options = _a.options; - if (!(options instanceof MtcnnOptions)) return [3 /*break*/, 2]; - return [4 /*yield*/, nets.mtcnn.forward(input, options)]; - case 1: return [2 /*return*/, (_b.sent()) - .map(function (result) { return result.faceDetection; })]; - case 2: - faceDetectionFunction = options instanceof TinyFaceDetectorOptions - ? function (input) { return nets.tinyFaceDetector.locateFaces(input, options); } - : (options instanceof SsdMobilenetv1Options - ? function (input) { return nets.ssdMobilenetv1.locateFaces(input, options); } - : (options instanceof TinyYolov2Options - ? function (input) { return nets.tinyYolov2.locateFaces(input, options); } - : null)); - if (!faceDetectionFunction) { - throw new Error('detectFaces - expected options to be instance of TinyFaceDetectorOptions | SsdMobilenetv1Options | MtcnnOptions | TinyYolov2Options'); - } - return [2 /*return*/, faceDetectionFunction(input)]; - } - }); - }); - }; - DetectAllFacesTask.prototype.withFaceLandmarks = function (useTinyLandmarkNet) { - if (useTinyLandmarkNet === void 0) { useTinyLandmarkNet = false; } - return new DetectAllFaceLandmarksTask(this, this.input, useTinyLandmarkNet); - }; - return DetectAllFacesTask; - }(DetectFacesTaskBase)); - var DetectSingleFaceTask = /** @class */ (function (_super) { - __extends$1(DetectSingleFaceTask, _super); - function DetectSingleFaceTask() { - return _super !== null && _super.apply(this, arguments) || this; - } - DetectSingleFaceTask.prototype.run = function () { - return __awaiter$1(this, void 0, void 0, function () { - return __generator$1(this, function (_a) { - switch (_a.label) { - case 0: return [4 /*yield*/, new DetectAllFacesTask(this.input, this.options)]; - case 1: return [2 /*return*/, (_a.sent()) - .sort(function (f1, f2) { return f1.score - f2.score; })[0]]; - } - }); - }); - }; - DetectSingleFaceTask.prototype.withFaceLandmarks = function (useTinyLandmarkNet) { - if (useTinyLandmarkNet === void 0) { useTinyLandmarkNet = false; } - return new DetectSingleFaceLandmarksTask(this, this.input, useTinyLandmarkNet); - }; - return DetectSingleFaceTask; - }(DetectFacesTaskBase)); - - function detectSingleFace(input, options) { - if (options === void 0) { options = new SsdMobilenetv1Options(); } - return new DetectSingleFaceTask(input, options); - } - function detectAllFaces(input, options) { - if (options === void 0) { options = new SsdMobilenetv1Options(); } - return new DetectAllFacesTask(input, options); - } - - // export allFaces API for backward compatibility - function allFacesSsdMobilenetv1(input, minConfidence) { - return __awaiter$1(this, void 0, void 0, function () { - return __generator$1(this, function (_a) { - switch (_a.label) { - case 0: return [4 /*yield*/, detectAllFaces(input, new SsdMobilenetv1Options(minConfidence ? { minConfidence: minConfidence } : {})) - .withFaceLandmarks() - .withFaceDescriptors()]; - case 1: return [2 /*return*/, _a.sent()]; - } - }); - }); - } - function allFacesTinyYolov2(input, forwardParams) { - if (forwardParams === void 0) { forwardParams = {}; } - return __awaiter$1(this, void 0, void 0, function () { - return __generator$1(this, function (_a) { - switch (_a.label) { - case 0: return [4 /*yield*/, detectAllFaces(input, new TinyYolov2Options(forwardParams)) - .withFaceLandmarks() - .withFaceDescriptors()]; - case 1: return [2 /*return*/, _a.sent()]; - } - }); - }); - } - function allFacesMtcnn(input, forwardParams) { - if (forwardParams === void 0) { forwardParams = {}; } - return __awaiter$1(this, void 0, void 0, function () { - return __generator$1(this, function (_a) { - switch (_a.label) { - case 0: return [4 /*yield*/, detectAllFaces(input, new MtcnnOptions(forwardParams)) - .withFaceLandmarks() - .withFaceDescriptors()]; - case 1: return [2 /*return*/, _a.sent()]; - } - }); - }); - } - var allFaces = allFacesSsdMobilenetv1; - - function euclideanDistance(arr1, arr2) { - if (arr1.length !== arr2.length) - throw new Error('euclideanDistance: arr1.length !== arr2.length'); - var desc1 = Array.from(arr1); - var desc2 = Array.from(arr2); - return Math.sqrt(desc1 - .map(function (val, i) { return val - desc2[i]; }) - .reduce(function (res, diff) { return res + Math.pow(diff, 2); }, 0)); - } - - var FaceMatcher = /** @class */ (function () { - function FaceMatcher(inputs, distanceThreshold) { - if (distanceThreshold === void 0) { distanceThreshold = 0.6; } - this._distanceThreshold = distanceThreshold; - var inputArray = Array.isArray(inputs) ? inputs : [inputs]; - if (!inputArray.length) { - throw new Error("FaceRecognizer.constructor - expected atleast one input"); - } - var count = 1; - var createUniqueLabel = function () { return "person " + count++; }; - this._labeledDescriptors = inputArray.map(function (desc) { - if (desc instanceof LabeledFaceDescriptors) { - return desc; - } - if (desc instanceof FullFaceDescription) { - return new LabeledFaceDescriptors(createUniqueLabel(), [desc.descriptor]); - } - if (desc instanceof Float32Array) { - return new LabeledFaceDescriptors(createUniqueLabel(), [desc]); - } - throw new Error("FaceRecognizer.constructor - expected inputs to be of type LabeledFaceDescriptors | FullFaceDescription | Float32Array | Array"); - }); - } - Object.defineProperty(FaceMatcher.prototype, "labeledDescriptors", { - get: function () { return this._labeledDescriptors; }, - enumerable: true, - configurable: true - }); - Object.defineProperty(FaceMatcher.prototype, "distanceThreshold", { - get: function () { return this._distanceThreshold; }, - enumerable: true, - configurable: true - }); - FaceMatcher.prototype.computeMeanDistance = function (queryDescriptor, descriptors) { - return descriptors - .map(function (d) { return euclideanDistance(d, queryDescriptor); }) - .reduce(function (d1, d2) { return d1 + d2; }, 0) - / (descriptors.length || 1); - }; - FaceMatcher.prototype.matchDescriptor = function (queryDescriptor) { - var _this = this; - return this.labeledDescriptors - .map(function (_a) { - var descriptors = _a.descriptors, label = _a.label; - return new FaceMatch(label, _this.computeMeanDistance(queryDescriptor, descriptors)); - }) - .reduce(function (best, curr) { return best.distance < curr.distance ? best : curr; }); - }; - FaceMatcher.prototype.findBestMatch = function (queryDescriptor) { - var bestMatch = this.matchDescriptor(queryDescriptor); - return bestMatch.distance < this.distanceThreshold - ? bestMatch - : new FaceMatch('unknown', bestMatch.distance); - }; - return FaceMatcher; - }()); - - function createMtcnn(weights) { - var net = new Mtcnn(); - net.extractWeights(weights); - return net; - } - - function createTinyFaceDetector(weights) { - var net = new TinyFaceDetector(); - net.extractWeights(weights); - return net; - } - - function createTinyYolov2(weights, withSeparableConvs) { - if (withSeparableConvs === void 0) { withSeparableConvs = true; } - var net = new TinyYolov2$1(withSeparableConvs); - net.extractWeights(weights); - return net; - } - - exports.tf = tfCore_esm; - exports.BoundingBox = BoundingBox; - exports.Box = Box; - exports.BoxWithText = BoxWithText; - exports.Dimensions = Dimensions; - exports.LabeledBox = LabeledBox; - exports.ObjectDetection = ObjectDetection; - exports.Point = Point; - exports.PredictedBox = PredictedBox; - exports.Rect = Rect; - exports.disposeUnusedWeightTensors = disposeUnusedWeightTensors; - exports.extractWeightEntryFactory = extractWeightEntryFactory; - exports.extractWeightsFactory = extractWeightsFactory; - exports.getModelUris = getModelUris; - exports.awaitMediaLoaded = awaitMediaLoaded; - exports.bufferToImage = bufferToImage; - exports.createCanvas = createCanvas; - exports.createCanvasFromMedia = createCanvasFromMedia; - exports.drawBox = drawBox; - exports.drawDetection = drawDetection; - exports.drawText = drawText; - exports.fetchImage = fetchImage; - exports.fetchJson = fetchJson; - exports.fetchNetWeights = fetchNetWeights; - exports.fetchOrThrow = fetchOrThrow; - exports.getContext2dOrThrow = getContext2dOrThrow; - exports.getDefaultDrawOptions = getDefaultDrawOptions; - exports.getMediaDimensions = getMediaDimensions; - exports.imageTensorToCanvas = imageTensorToCanvas; - exports.imageToSquare = imageToSquare; - exports.isMediaElement = isMediaElement; - exports.isMediaLoaded = isMediaLoaded; - exports.loadWeightMap = loadWeightMap; - exports.NetInput = NetInput; - exports.resolveInput = resolveInput; - exports.toNetInput = toNetInput; - exports.sigmoid = sigmoid$1; - exports.inverseSigmoid = inverseSigmoid; - exports.iou = iou; - exports.nonMaxSuppression = nonMaxSuppression$1; - exports.normalize = normalize; - exports.padToSquare = padToSquare; - exports.shuffleArray = shuffleArray; - exports.isTensor = isTensor; - exports.isTensor1D = isTensor1D; - exports.isTensor2D = isTensor2D; - exports.isTensor3D = isTensor3D; - exports.isTensor4D = isTensor4D; - exports.isFloat = isFloat; - exports.isEven = isEven; - exports.round = round$1; - exports.isDimensions = isDimensions; - exports.computeReshapedDimensions = computeReshapedDimensions; - exports.getCenterPoint = getCenterPoint; - exports.range = range$1; - exports.isValidNumber = isValidNumber; - exports.isValidProbablitiy = isValidProbablitiy; - exports.NeuralNetwork = NeuralNetwork; - exports.FaceDetection = FaceDetection; - exports.FaceDetectionWithLandmarks = FaceDetectionWithLandmarks; - exports.FaceLandmarks = FaceLandmarks; - exports.FaceLandmarks5 = FaceLandmarks5; - exports.FaceLandmarks68 = FaceLandmarks68; - exports.FaceMatch = FaceMatch; - exports.FullFaceDescription = FullFaceDescription; - exports.LabeledFaceDescriptors = LabeledFaceDescriptors; - exports.drawContour = drawContour; - exports.drawLandmarks = drawLandmarks; - exports.extractFaces = extractFaces; - exports.extractFaceTensors = extractFaceTensors; - exports.FaceLandmarkNet = FaceLandmarkNet; - exports.createFaceLandmarkNet = createFaceLandmarkNet; - exports.FaceLandmark68Net = FaceLandmark68Net; - exports.FaceLandmark68TinyNet = FaceLandmark68TinyNet; - exports.createFaceRecognitionNet = createFaceRecognitionNet; - exports.FaceRecognitionNet = FaceRecognitionNet; - exports.allFacesSsdMobilenetv1 = allFacesSsdMobilenetv1; - exports.allFacesTinyYolov2 = allFacesTinyYolov2; - exports.allFacesMtcnn = allFacesMtcnn; - exports.allFaces = allFaces; - exports.ComposableTask = ComposableTask; - exports.ComputeFaceDescriptorsTaskBase = ComputeFaceDescriptorsTaskBase; - exports.ComputeAllFaceDescriptorsTask = ComputeAllFaceDescriptorsTask; - exports.ComputeSingleFaceDescriptorTask = ComputeSingleFaceDescriptorTask; - exports.detectSingleFace = detectSingleFace; - exports.detectAllFaces = detectAllFaces; - exports.DetectFacesTaskBase = DetectFacesTaskBase; - exports.DetectAllFacesTask = DetectAllFacesTask; - exports.DetectSingleFaceTask = DetectSingleFaceTask; - exports.DetectFaceLandmarksTaskBase = DetectFaceLandmarksTaskBase; - exports.DetectAllFaceLandmarksTask = DetectAllFaceLandmarksTask; - exports.DetectSingleFaceLandmarksTask = DetectSingleFaceLandmarksTask; - exports.FaceMatcher = FaceMatcher; - exports.nets = nets; - exports.ssdMobilenetv1 = ssdMobilenetv1; - exports.tinyFaceDetector = tinyFaceDetector; - exports.tinyYolov2 = tinyYolov2; - exports.mtcnn = mtcnn; - exports.detectFaceLandmarks = detectFaceLandmarks; - exports.detectFaceLandmarksTiny = detectFaceLandmarksTiny; - exports.computeFaceDescriptor = computeFaceDescriptor; - exports.loadSsdMobilenetv1Model = loadSsdMobilenetv1Model; - exports.loadTinyFaceDetectorModel = loadTinyFaceDetectorModel; - exports.loadMtcnnModel = loadMtcnnModel; - exports.loadTinyYolov2Model = loadTinyYolov2Model; - exports.loadFaceLandmarkModel = loadFaceLandmarkModel; - exports.loadFaceLandmarkTinyModel = loadFaceLandmarkTinyModel; - exports.loadFaceRecognitionModel = loadFaceRecognitionModel; - exports.loadFaceDetectionModel = loadFaceDetectionModel; - exports.locateFaces = locateFaces; - exports.detectLandmarks = detectLandmarks; - exports.createMtcnn = createMtcnn; - exports.Mtcnn = Mtcnn; - exports.MtcnnOptions = MtcnnOptions; - exports.createSsdMobilenetv1 = createSsdMobilenetv1; - exports.createFaceDetectionNet = createFaceDetectionNet; - exports.FaceDetectionNet = FaceDetectionNet; - exports.SsdMobilenetv1 = SsdMobilenetv1; - exports.SsdMobilenetv1Options = SsdMobilenetv1Options; - exports.createTinyFaceDetector = createTinyFaceDetector; - exports.TinyFaceDetector = TinyFaceDetector; - exports.TinyFaceDetectorOptions = TinyFaceDetectorOptions; - exports.createTinyYolov2 = createTinyYolov2; - exports.TinyYolov2 = TinyYolov2$1; - exports.euclideanDistance = euclideanDistance; - - Object.defineProperty(exports, '__esModule', { value: true }); - -}))); -//# sourceMappingURL=face-api.js.map diff --git a/lib/face.py b/lib/face.py deleted file mode 100644 index dfa130f..0000000 --- a/lib/face.py +++ /dev/null @@ -1,53 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -import sys -import cv2 -import time - -# 引数 -args = sys.argv -isWIN = 0 -if len(args) >= 2: - if args[1] == "-w": - isWIN = 1 - -# カメラの準備 -faceCascade = cv2.CascadeClassifier('scripts/haarcascade_frontalface_alt.xml') - -capture = cv2.VideoCapture(0) # カメラセット -# 画像サイズの指定 -ret = capture.set(3, 320) -ret = capture.set(4, 180) - -try: - while True: - ret, image = capture.read() # 画像取得 - gray_image = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY) - face = faceCascade.detectMultiScale( - gray_image, scaleFactor=1.3, minNeighbors=2, minSize=(30, 30)) - - if len(face) > 0: # 一番大きい顔を選ぶ - bigw = 0 - for (x, y, w, h) in face: - if w > bigw: - bigx = x - bigw = w - - if isWIN: - cv2.rectangle(image, (x, y), (x+w, y+h), (0, 255, 0), 2) - - pos = (bigx+(bigw/2)) - 160 # 顔の位置 - - print pos - sys.stdout.flush() - - if isWIN: # カメラ画像表示 - cv2.imshow("Camera Test", image) - # キーが押されたら保存・終了 - if cv2.waitKey(10) == 32: # 32:[Space] - pass - -except KeyboardInterrupt: - capture.release() - cv2.destroyAllWindows() - print "正常終了" diff --git a/lib/haarcascade_frontalface_alt.xml b/lib/haarcascade_frontalface_alt.xml deleted file mode 100644 index 5a6f275..0000000 --- a/lib/haarcascade_frontalface_alt.xml +++ /dev/null @@ -1,26161 +0,0 @@ - - - - - 20 20 - - <_> - - - <_> - - <_> - - - - <_>3 7 14 4 -1. - <_>3 9 14 2 2. - 0 - 4.0141958743333817e-003 - 0.0337941907346249 - 0.8378106951713562 - <_> - - <_> - - - - <_>1 2 18 4 -1. - <_>7 2 6 4 3. - 0 - 0.0151513395830989 - 0.1514132022857666 - 0.7488812208175659 - <_> - - <_> - - - - <_>1 7 15 9 -1. - <_>1 10 15 3 3. - 0 - 4.2109931819140911e-003 - 0.0900492817163467 - 0.6374819874763489 - 0.8226894140243530 - -1 - -1 - <_> - - - <_> - - <_> - - - - <_>5 6 2 6 -1. - <_>5 9 2 3 2. - 0 - 1.6227109590545297e-003 - 0.0693085864186287 - 0.7110946178436279 - <_> - - <_> - - - - <_>7 5 6 3 -1. - <_>9 5 2 3 3. - 0 - 2.2906649392098188e-003 - 0.1795803010463715 - 0.6668692231178284 - <_> - - <_> - - - - <_>4 0 12 9 -1. - <_>4 3 12 3 3. - 0 - 5.0025708042085171e-003 - 0.1693672984838486 - 0.6554006934165955 - <_> - - <_> - - - - <_>6 9 10 8 -1. - <_>6 13 10 4 2. - 0 - 7.9659894108772278e-003 - 0.5866332054138184 - 0.0914145186543465 - <_> - - <_> - - - - <_>3 6 14 8 -1. - <_>3 10 14 4 2. - 0 - -3.5227010957896709e-003 - 0.1413166970014572 - 0.6031895875930786 - <_> - - <_> - - - - <_>14 1 6 10 -1. - <_>14 1 3 10 2. - 0 - 0.0366676896810532 - 0.3675672113895416 - 0.7920318245887756 - <_> - - <_> - - - - <_>7 8 5 12 -1. - <_>7 12 5 4 3. - 0 - 9.3361474573612213e-003 - 0.6161385774612427 - 0.2088509947061539 - <_> - - <_> - - - - <_>1 1 18 3 -1. - <_>7 1 6 3 3. - 0 - 8.6961314082145691e-003 - 0.2836230993270874 - 0.6360273957252502 - <_> - - <_> - - - - <_>1 8 17 2 -1. - <_>1 9 17 1 2. - 0 - 1.1488880263641477e-003 - 0.2223580926656723 - 0.5800700783729553 - <_> - - <_> - - - - <_>16 6 4 2 -1. - <_>16 7 4 1 2. - 0 - -2.1484689787030220e-003 - 0.2406464070081711 - 0.5787054896354675 - <_> - - <_> - - - - <_>5 17 2 2 -1. - <_>5 18 2 1 2. - 0 - 2.1219060290604830e-003 - 0.5559654831886292 - 0.1362237036228180 - <_> - - <_> - - - - <_>14 2 6 12 -1. - <_>14 2 3 12 2. - 0 - -0.0939491465687752 - 0.8502737283706665 - 0.4717740118503571 - <_> - - <_> - - - - <_>4 0 4 12 -1. - <_>4 0 2 6 2. - <_>6 6 2 6 2. - 0 - 1.3777789426967502e-003 - 0.5993673801422119 - 0.2834529876708984 - <_> - - <_> - - - - <_>2 11 18 8 -1. - <_>8 11 6 8 3. - 0 - 0.0730631574988365 - 0.4341886043548584 - 0.7060034275054932 - <_> - - <_> - - - - <_>5 7 10 2 -1. - <_>5 8 10 1 2. - 0 - 3.6767389974556863e-004 - 0.3027887940406799 - 0.6051574945449829 - <_> - - <_> - - - - <_>15 11 5 3 -1. - <_>15 12 5 1 3. - 0 - -6.0479710809886456e-003 - 0.1798433959484100 - 0.5675256848335266 - 6.9566087722778320 - 0 - -1 - <_> - - - <_> - - <_> - - - - <_>5 3 10 9 -1. - <_>5 6 10 3 3. - 0 - -0.0165106896311045 - 0.6644225120544434 - 0.1424857974052429 - <_> - - <_> - - - - <_>9 4 2 14 -1. - <_>9 11 2 7 2. - 0 - 2.7052499353885651e-003 - 0.6325352191925049 - 0.1288477033376694 - <_> - - <_> - - - - <_>3 5 4 12 -1. - <_>3 9 4 4 3. - 0 - 2.8069869149476290e-003 - 0.1240288019180298 - 0.6193193197250366 - <_> - - <_> - - - - <_>4 5 12 5 -1. - <_>8 5 4 5 3. - 0 - -1.5402400167658925e-003 - 0.1432143002748489 - 0.5670015811920166 - <_> - - <_> - - - - <_>5 6 10 8 -1. - <_>5 10 10 4 2. - 0 - -5.6386279175058007e-004 - 0.1657433062791824 - 0.5905207991600037 - <_> - - <_> - - - - <_>8 0 6 9 -1. - <_>8 3 6 3 3. - 0 - 1.9253729842603207e-003 - 0.2695507109165192 - 0.5738824009895325 - <_> - - <_> - - - - <_>9 12 1 8 -1. - <_>9 16 1 4 2. - 0 - -5.0214841030538082e-003 - 0.1893538981676102 - 0.5782774090766907 - <_> - - <_> - - - - <_>0 7 20 6 -1. - <_>0 9 20 2 3. - 0 - 2.6365420781075954e-003 - 0.2309329062700272 - 0.5695425868034363 - <_> - - <_> - - - - <_>7 0 6 17 -1. - <_>9 0 2 17 3. - 0 - -1.5127769438549876e-003 - 0.2759602069854736 - 0.5956642031669617 - <_> - - <_> - - - - <_>9 0 6 4 -1. - <_>11 0 2 4 3. - 0 - -0.0101574398577213 - 0.1732538044452667 - 0.5522047281265259 - <_> - - <_> - - - - <_>5 1 6 4 -1. - <_>7 1 2 4 3. - 0 - -0.0119536602869630 - 0.1339409947395325 - 0.5559014081954956 - <_> - - <_> - - - - <_>12 1 6 16 -1. - <_>14 1 2 16 3. - 0 - 4.8859491944313049e-003 - 0.3628703951835632 - 0.6188849210739136 - <_> - - <_> - - - - <_>0 5 18 8 -1. - <_>0 5 9 4 2. - <_>9 9 9 4 2. - 0 - -0.0801329165697098 - 0.0912110507488251 - 0.5475944876670837 - <_> - - <_> - - - - <_>8 15 10 4 -1. - <_>13 15 5 2 2. - <_>8 17 5 2 2. - 0 - 1.0643280111253262e-003 - 0.3715142905712128 - 0.5711399912834168 - <_> - - <_> - - - - <_>3 1 4 8 -1. - <_>3 1 2 4 2. - <_>5 5 2 4 2. - 0 - -1.3419450260698795e-003 - 0.5953313708305359 - 0.3318097889423370 - <_> - - <_> - - - - <_>3 6 14 10 -1. - <_>10 6 7 5 2. - <_>3 11 7 5 2. - 0 - -0.0546011403203011 - 0.1844065934419632 - 0.5602846145629883 - <_> - - <_> - - - - <_>2 1 6 16 -1. - <_>4 1 2 16 3. - 0 - 2.9071690514683723e-003 - 0.3594244122505188 - 0.6131715178489685 - <_> - - <_> - - - - <_>0 18 20 2 -1. - <_>0 19 20 1 2. - 0 - 7.4718717951327562e-004 - 0.5994353294372559 - 0.3459562957286835 - <_> - - <_> - - - - <_>8 13 4 3 -1. - <_>8 14 4 1 3. - 0 - 4.3013808317482471e-003 - 0.4172652065753937 - 0.6990845203399658 - <_> - - <_> - - - - <_>9 14 2 3 -1. - <_>9 15 2 1 3. - 0 - 4.5017572119832039e-003 - 0.4509715139865875 - 0.7801457047462463 - <_> - - <_> - - - - <_>0 12 9 6 -1. - <_>0 14 9 2 3. - 0 - 0.0241385009139776 - 0.5438212752342224 - 0.1319826990365982 - 9.4985427856445313 - 1 - -1 - <_> - - - <_> - - <_> - - - - <_>5 7 3 4 -1. - <_>5 9 3 2 2. - 0 - 1.9212230108678341e-003 - 0.1415266990661621 - 0.6199870705604553 - <_> - - <_> - - - - <_>9 3 2 16 -1. - <_>9 11 2 8 2. - 0 - -1.2748669541906565e-004 - 0.6191074252128601 - 0.1884928941726685 - <_> - - <_> - - - - <_>3 6 13 8 -1. - <_>3 10 13 4 2. - 0 - 5.1409931620582938e-004 - 0.1487396955490112 - 0.5857927799224854 - <_> - - <_> - - - - <_>12 3 8 2 -1. - <_>12 3 4 2 2. - 0 - 4.1878609918057919e-003 - 0.2746909856796265 - 0.6359239816665649 - <_> - - <_> - - - - <_>8 8 4 12 -1. - <_>8 12 4 4 3. - 0 - 5.1015717908740044e-003 - 0.5870851278305054 - 0.2175628989934921 - <_> - - <_> - - - - <_>11 3 8 6 -1. - <_>15 3 4 3 2. - <_>11 6 4 3 2. - 0 - -2.1448440384119749e-003 - 0.5880944728851318 - 0.2979590892791748 - <_> - - <_> - - - - <_>7 1 6 19 -1. - <_>9 1 2 19 3. - 0 - -2.8977119363844395e-003 - 0.2373327016830444 - 0.5876647233963013 - <_> - - <_> - - - - <_>9 0 6 4 -1. - <_>11 0 2 4 3. - 0 - -0.0216106791049242 - 0.1220654994249344 - 0.5194202065467835 - <_> - - <_> - - - - <_>3 1 9 3 -1. - <_>6 1 3 3 3. - 0 - -4.6299318782985210e-003 - 0.2631230950355530 - 0.5817409157752991 - <_> - - <_> - - - - <_>8 15 10 4 -1. - <_>13 15 5 2 2. - <_>8 17 5 2 2. - 0 - 5.9393711853772402e-004 - 0.3638620078563690 - 0.5698544979095459 - <_> - - <_> - - - - <_>0 3 6 10 -1. - <_>3 3 3 10 2. - 0 - 0.0538786612451077 - 0.4303531050682068 - 0.7559366226196289 - <_> - - <_> - - - - <_>3 4 15 15 -1. - <_>3 9 15 5 3. - 0 - 1.8887349870055914e-003 - 0.2122603058815002 - 0.5613427162170410 - <_> - - <_> - - - - <_>6 5 8 6 -1. - <_>6 7 8 2 3. - 0 - -2.3635339457541704e-003 - 0.5631849169731140 - 0.2642767131328583 - <_> - - <_> - - - - <_>4 4 12 10 -1. - <_>10 4 6 5 2. - <_>4 9 6 5 2. - 0 - 0.0240177996456623 - 0.5797107815742493 - 0.2751705944538117 - <_> - - <_> - - - - <_>6 4 4 4 -1. - <_>8 4 2 4 2. - 0 - 2.0543030404951423e-004 - 0.2705242037773132 - 0.5752568840980530 - <_> - - <_> - - - - <_>15 11 1 2 -1. - <_>15 12 1 1 2. - 0 - 8.4790197433903813e-004 - 0.5435624718666077 - 0.2334876954555512 - <_> - - <_> - - - - <_>3 11 2 2 -1. - <_>3 12 2 1 2. - 0 - 1.4091329649090767e-003 - 0.5319424867630005 - 0.2063155025243759 - <_> - - <_> - - - - <_>16 11 1 3 -1. - <_>16 12 1 1 3. - 0 - 1.4642629539594054e-003 - 0.5418980717658997 - 0.3068861067295075 - <_> - - <_> - - - - <_>3 15 6 4 -1. - <_>3 15 3 2 2. - <_>6 17 3 2 2. - 0 - 1.6352549428120255e-003 - 0.3695372939109802 - 0.6112868189811707 - <_> - - <_> - - - - <_>6 7 8 2 -1. - <_>6 8 8 1 2. - 0 - 8.3172752056270838e-004 - 0.3565036952495575 - 0.6025236248970032 - <_> - - <_> - - - - <_>3 11 1 3 -1. - <_>3 12 1 1 3. - 0 - -2.0998890977352858e-003 - 0.1913982033729553 - 0.5362827181816101 - <_> - - <_> - - - - <_>6 0 12 2 -1. - <_>6 1 12 1 2. - 0 - -7.4213981861248612e-004 - 0.3835555016994476 - 0.5529310107231140 - <_> - - <_> - - - - <_>9 14 2 3 -1. - <_>9 15 2 1 3. - 0 - 3.2655049581080675e-003 - 0.4312896132469177 - 0.7101895809173584 - <_> - - <_> - - - - <_>7 15 6 2 -1. - <_>7 16 6 1 2. - 0 - 8.9134991867467761e-004 - 0.3984830975532532 - 0.6391963958740234 - <_> - - <_> - - - - <_>0 5 4 6 -1. - <_>0 7 4 2 3. - 0 - -0.0152841797098517 - 0.2366732954978943 - 0.5433713793754578 - <_> - - <_> - - - - <_>4 12 12 2 -1. - <_>8 12 4 2 3. - 0 - 4.8381411470472813e-003 - 0.5817500948905945 - 0.3239189088344574 - <_> - - <_> - - - - <_>6 3 1 9 -1. - <_>6 6 1 3 3. - 0 - -9.1093179071322083e-004 - 0.5540593862533569 - 0.2911868989467621 - <_> - - <_> - - - - <_>10 17 3 2 -1. - <_>11 17 1 2 3. - 0 - -6.1275060288608074e-003 - 0.1775255054235458 - 0.5196629166603088 - <_> - - <_> - - - - <_>9 9 2 2 -1. - <_>9 10 2 1 2. - 0 - -4.4576259097084403e-004 - 0.3024170100688934 - 0.5533593893051148 - <_> - - <_> - - - - <_>7 6 6 4 -1. - <_>9 6 2 4 3. - 0 - 0.0226465407758951 - 0.4414930939674377 - 0.6975377202033997 - <_> - - <_> - - - - <_>7 17 3 2 -1. - <_>8 17 1 2 3. - 0 - -1.8804960418492556e-003 - 0.2791394889354706 - 0.5497952103614807 - <_> - - <_> - - - - <_>10 17 3 3 -1. - <_>11 17 1 3 3. - 0 - 7.0889107882976532e-003 - 0.5263199210166931 - 0.2385547012090683 - <_> - - <_> - - - - <_>8 12 3 2 -1. - <_>8 13 3 1 2. - 0 - 1.7318050377070904e-003 - 0.4319379031658173 - 0.6983600854873657 - <_> - - <_> - - - - <_>9 3 6 2 -1. - <_>11 3 2 2 3. - 0 - -6.8482700735330582e-003 - 0.3082042932510376 - 0.5390920042991638 - <_> - - <_> - - - - <_>3 11 14 4 -1. - <_>3 13 14 2 2. - 0 - -1.5062530110299122e-005 - 0.5521922111511231 - 0.3120366036891937 - <_> - - <_> - - - - <_>1 10 18 4 -1. - <_>10 10 9 2 2. - <_>1 12 9 2 2. - 0 - 0.0294755697250366 - 0.5401322841644287 - 0.1770603060722351 - <_> - - <_> - - - - <_>0 10 3 3 -1. - <_>0 11 3 1 3. - 0 - 8.1387329846620560e-003 - 0.5178617835044861 - 0.1211019009351730 - <_> - - <_> - - - - <_>9 1 6 6 -1. - <_>11 1 2 6 3. - 0 - 0.0209429506212473 - 0.5290294289588928 - 0.3311221897602081 - <_> - - <_> - - - - <_>8 7 3 6 -1. - <_>9 7 1 6 3. - 0 - -9.5665529370307922e-003 - 0.7471994161605835 - 0.4451968967914581 - 18.4129695892333980 - 2 - -1 - <_> - - - <_> - - <_> - - - - <_>1 0 18 9 -1. - <_>1 3 18 3 3. - 0 - -2.8206960996612906e-004 - 0.2064086049795151 - 0.6076732277870178 - <_> - - <_> - - - - <_>12 10 2 6 -1. - <_>12 13 2 3 2. - 0 - 1.6790600493550301e-003 - 0.5851997137069702 - 0.1255383938550949 - <_> - - <_> - - - - <_>0 5 19 8 -1. - <_>0 9 19 4 2. - 0 - 6.9827912375330925e-004 - 0.0940184295177460 - 0.5728961229324341 - <_> - - <_> - - - - <_>7 0 6 9 -1. - <_>9 0 2 9 3. - 0 - 7.8959012171253562e-004 - 0.1781987994909287 - 0.5694308876991272 - <_> - - <_> - - - - <_>5 3 6 1 -1. - <_>7 3 2 1 3. - 0 - -2.8560499195009470e-003 - 0.1638399064540863 - 0.5788664817810059 - <_> - - <_> - - - - <_>11 3 6 1 -1. - <_>13 3 2 1 3. - 0 - -3.8122469559311867e-003 - 0.2085440009832382 - 0.5508564710617065 - <_> - - <_> - - - - <_>5 10 4 6 -1. - <_>5 13 4 3 2. - 0 - 1.5896620461717248e-003 - 0.5702760815620422 - 0.1857215017080307 - <_> - - <_> - - - - <_>11 3 6 1 -1. - <_>13 3 2 1 3. - 0 - 0.0100783398374915 - 0.5116943120956421 - 0.2189770042896271 - <_> - - <_> - - - - <_>4 4 12 6 -1. - <_>4 6 12 2 3. - 0 - -0.0635263025760651 - 0.7131379842758179 - 0.4043813049793243 - <_> - - <_> - - - - <_>15 12 2 6 -1. - <_>15 14 2 2 3. - 0 - -9.1031491756439209e-003 - 0.2567181885242462 - 0.5463973283767700 - <_> - - <_> - - - - <_>9 3 2 2 -1. - <_>10 3 1 2 2. - 0 - -2.4035000242292881e-003 - 0.1700665950775147 - 0.5590974092483521 - <_> - - <_> - - - - <_>9 3 3 1 -1. - <_>10 3 1 1 3. - 0 - 1.5226360410451889e-003 - 0.5410556793212891 - 0.2619054019451141 - <_> - - <_> - - - - <_>1 1 4 14 -1. - <_>3 1 2 14 2. - 0 - 0.0179974399507046 - 0.3732436895370483 - 0.6535220742225647 - <_> - - <_> - - - - <_>9 0 4 4 -1. - <_>11 0 2 2 2. - <_>9 2 2 2 2. - 0 - -6.4538191072642803e-003 - 0.2626481950283051 - 0.5537446141242981 - <_> - - <_> - - - - <_>7 5 1 14 -1. - <_>7 12 1 7 2. - 0 - -0.0118807600811124 - 0.2003753930330277 - 0.5544745922088623 - <_> - - <_> - - - - <_>19 0 1 4 -1. - <_>19 2 1 2 2. - 0 - 1.2713660253211856e-003 - 0.5591902732849121 - 0.3031975924968720 - <_> - - <_> - - - - <_>5 5 6 4 -1. - <_>8 5 3 4 2. - 0 - 1.1376109905540943e-003 - 0.2730407118797302 - 0.5646508932113648 - <_> - - <_> - - - - <_>9 18 3 2 -1. - <_>10 18 1 2 3. - 0 - -4.2651998810470104e-003 - 0.1405909061431885 - 0.5461820960044861 - <_> - - <_> - - - - <_>8 18 3 2 -1. - <_>9 18 1 2 3. - 0 - -2.9602861031889915e-003 - 0.1795035004615784 - 0.5459290146827698 - <_> - - <_> - - - - <_>4 5 12 6 -1. - <_>4 7 12 2 3. - 0 - -8.8448226451873779e-003 - 0.5736783146858215 - 0.2809219956398010 - <_> - - <_> - - - - <_>3 12 2 6 -1. - <_>3 14 2 2 3. - 0 - -6.6430689767003059e-003 - 0.2370675951242447 - 0.5503826141357422 - <_> - - <_> - - - - <_>10 8 2 12 -1. - <_>10 12 2 4 3. - 0 - 3.9997808635234833e-003 - 0.5608199834823608 - 0.3304282128810883 - <_> - - <_> - - - - <_>7 18 3 2 -1. - <_>8 18 1 2 3. - 0 - -4.1221720166504383e-003 - 0.1640105992555618 - 0.5378993153572083 - <_> - - <_> - - - - <_>9 0 6 2 -1. - <_>11 0 2 2 3. - 0 - 0.0156249096617103 - 0.5227649211883545 - 0.2288603931665421 - <_> - - <_> - - - - <_>5 11 9 3 -1. - <_>5 12 9 1 3. - 0 - -0.0103564197197557 - 0.7016193866729736 - 0.4252927899360657 - <_> - - <_> - - - - <_>9 0 6 2 -1. - <_>11 0 2 2 3. - 0 - -8.7960809469223022e-003 - 0.2767347097396851 - 0.5355830192565918 - <_> - - <_> - - - - <_>1 1 18 5 -1. - <_>7 1 6 5 3. - 0 - 0.1622693985700607 - 0.4342240095138550 - 0.7442579269409180 - <_> - - <_> - - - - <_>8 0 4 4 -1. - <_>10 0 2 2 2. - <_>8 2 2 2 2. - 0 - 4.5542530715465546e-003 - 0.5726485848426819 - 0.2582125067710877 - <_> - - <_> - - - - <_>3 12 1 3 -1. - <_>3 13 1 1 3. - 0 - -2.1309209987521172e-003 - 0.2106848061084747 - 0.5361018776893616 - <_> - - <_> - - - - <_>8 14 5 3 -1. - <_>8 15 5 1 3. - 0 - -0.0132084200158715 - 0.7593790888786316 - 0.4552468061447144 - <_> - - <_> - - - - <_>5 4 10 12 -1. - <_>5 4 5 6 2. - <_>10 10 5 6 2. - 0 - -0.0659966766834259 - 0.1252475976943970 - 0.5344039797782898 - <_> - - <_> - - - - <_>9 6 9 12 -1. - <_>9 10 9 4 3. - 0 - 7.9142656177282333e-003 - 0.3315384089946747 - 0.5601043105125427 - <_> - - <_> - - - - <_>2 2 12 14 -1. - <_>2 2 6 7 2. - <_>8 9 6 7 2. - 0 - 0.0208942797034979 - 0.5506049990653992 - 0.2768838107585907 - 15.3241395950317380 - 3 - -1 - <_> - - - <_> - - <_> - - - - <_>4 7 12 2 -1. - <_>8 7 4 2 3. - 0 - 1.1961159761995077e-003 - 0.1762690991163254 - 0.6156241297721863 - <_> - - <_> - - - - <_>7 4 6 4 -1. - <_>7 6 6 2 2. - 0 - -1.8679830245673656e-003 - 0.6118106842041016 - 0.1832399964332581 - <_> - - <_> - - - - <_>4 5 11 8 -1. - <_>4 9 11 4 2. - 0 - -1.9579799845814705e-004 - 0.0990442633628845 - 0.5723816156387329 - <_> - - <_> - - - - <_>3 10 16 4 -1. - <_>3 12 16 2 2. - 0 - -8.0255657667294145e-004 - 0.5579879879951477 - 0.2377282977104187 - <_> - - <_> - - - - <_>0 0 16 2 -1. - <_>0 1 16 1 2. - 0 - -2.4510810617357492e-003 - 0.2231457978487015 - 0.5858935117721558 - <_> - - <_> - - - - <_>7 5 6 2 -1. - <_>9 5 2 2 3. - 0 - 5.0361850298941135e-004 - 0.2653993964195252 - 0.5794103741645813 - <_> - - <_> - - - - <_>3 2 6 10 -1. - <_>3 2 3 5 2. - <_>6 7 3 5 2. - 0 - 4.0293349884450436e-003 - 0.5803827047348023 - 0.2484865039587021 - <_> - - <_> - - - - <_>10 5 8 15 -1. - <_>10 10 8 5 3. - 0 - -0.0144517095759511 - 0.1830351948738098 - 0.5484204888343811 - <_> - - <_> - - - - <_>3 14 8 6 -1. - <_>3 14 4 3 2. - <_>7 17 4 3 2. - 0 - 2.0380979403853416e-003 - 0.3363558948040009 - 0.6051092743873596 - <_> - - <_> - - - - <_>14 2 2 2 -1. - <_>14 3 2 1 2. - 0 - -1.6155190533027053e-003 - 0.2286642044782639 - 0.5441246032714844 - <_> - - <_> - - - - <_>1 10 7 6 -1. - <_>1 13 7 3 2. - 0 - 3.3458340913057327e-003 - 0.5625913143157959 - 0.2392338067293167 - <_> - - <_> - - - - <_>15 4 4 3 -1. - <_>15 4 2 3 2. - 0 - 1.6379579901695251e-003 - 0.3906993865966797 - 0.5964621901512146 - <_> - - <_> - - - - <_>2 9 14 6 -1. - <_>2 9 7 3 2. - <_>9 12 7 3 2. - 0 - 0.0302512105554342 - 0.5248482227325440 - 0.1575746983289719 - <_> - - <_> - - - - <_>5 7 10 4 -1. - <_>5 9 10 2 2. - 0 - 0.0372519902884960 - 0.4194310903549194 - 0.6748418807983398 - <_> - - <_> - - - - <_>6 9 8 8 -1. - <_>6 9 4 4 2. - <_>10 13 4 4 2. - 0 - -0.0251097902655602 - 0.1882549971342087 - 0.5473451018333435 - <_> - - <_> - - - - <_>14 1 3 2 -1. - <_>14 2 3 1 2. - 0 - -5.3099058568477631e-003 - 0.1339973062276840 - 0.5227110981941223 - <_> - - <_> - - - - <_>1 4 4 2 -1. - <_>3 4 2 2 2. - 0 - 1.2086479691788554e-003 - 0.3762088119983673 - 0.6109635829925537 - <_> - - <_> - - - - <_>11 10 2 8 -1. - <_>11 14 2 4 2. - 0 - -0.0219076797366142 - 0.2663142979145050 - 0.5404006838798523 - <_> - - <_> - - - - <_>0 0 5 3 -1. - <_>0 1 5 1 3. - 0 - 5.4116579703986645e-003 - 0.5363578796386719 - 0.2232273072004318 - <_> - - <_> - - - - <_>2 5 18 8 -1. - <_>11 5 9 4 2. - <_>2 9 9 4 2. - 0 - 0.0699463263154030 - 0.5358232855796814 - 0.2453698068857193 - <_> - - <_> - - - - <_>6 6 1 6 -1. - <_>6 9 1 3 2. - 0 - 3.4520021290518343e-004 - 0.2409671992063522 - 0.5376930236816406 - <_> - - <_> - - - - <_>19 1 1 3 -1. - <_>19 2 1 1 3. - 0 - 1.2627709656953812e-003 - 0.5425856709480286 - 0.3155693113803864 - <_> - - <_> - - - - <_>7 6 6 6 -1. - <_>9 6 2 6 3. - 0 - 0.0227195098996162 - 0.4158405959606171 - 0.6597865223884583 - <_> - - <_> - - - - <_>19 1 1 3 -1. - <_>19 2 1 1 3. - 0 - -1.8111000536009669e-003 - 0.2811253070831299 - 0.5505244731903076 - <_> - - <_> - - - - <_>3 13 2 3 -1. - <_>3 14 2 1 3. - 0 - 3.3469670452177525e-003 - 0.5260028243064880 - 0.1891465038061142 - <_> - - <_> - - - - <_>8 4 8 12 -1. - <_>12 4 4 6 2. - <_>8 10 4 6 2. - 0 - 4.0791751234792173e-004 - 0.5673509240150452 - 0.3344210088253021 - <_> - - <_> - - - - <_>5 2 6 3 -1. - <_>7 2 2 3 3. - 0 - 0.0127347996458411 - 0.5343592166900635 - 0.2395612001419067 - <_> - - <_> - - - - <_>6 1 9 10 -1. - <_>6 6 9 5 2. - 0 - -7.3119727894663811e-003 - 0.6010890007019043 - 0.4022207856178284 - <_> - - <_> - - - - <_>0 4 6 12 -1. - <_>2 4 2 12 3. - 0 - -0.0569487512111664 - 0.8199151158332825 - 0.4543190896511078 - <_> - - <_> - - - - <_>15 13 2 3 -1. - <_>15 14 2 1 3. - 0 - -5.0116591155529022e-003 - 0.2200281023979187 - 0.5357710719108582 - <_> - - <_> - - - - <_>7 14 5 3 -1. - <_>7 15 5 1 3. - 0 - 6.0334368608891964e-003 - 0.4413081109523773 - 0.7181751132011414 - <_> - - <_> - - - - <_>15 13 3 3 -1. - <_>15 14 3 1 3. - 0 - 3.9437441155314445e-003 - 0.5478860735893250 - 0.2791733145713806 - <_> - - <_> - - - - <_>6 14 8 3 -1. - <_>6 15 8 1 3. - 0 - -3.6591119132936001e-003 - 0.6357867717742920 - 0.3989723920822144 - <_> - - <_> - - - - <_>15 13 3 3 -1. - <_>15 14 3 1 3. - 0 - -3.8456181064248085e-003 - 0.3493686020374298 - 0.5300664901733398 - <_> - - <_> - - - - <_>2 13 3 3 -1. - <_>2 14 3 1 3. - 0 - -7.1926261298358440e-003 - 0.1119614988565445 - 0.5229672789573669 - <_> - - <_> - - - - <_>4 7 12 12 -1. - <_>10 7 6 6 2. - <_>4 13 6 6 2. - 0 - -0.0527989417314529 - 0.2387102991342545 - 0.5453451275825501 - <_> - - <_> - - - - <_>9 7 2 6 -1. - <_>10 7 1 6 2. - 0 - -7.9537667334079742e-003 - 0.7586917877197266 - 0.4439376890659332 - <_> - - <_> - - - - <_>8 9 5 2 -1. - <_>8 10 5 1 2. - 0 - -2.7344180271029472e-003 - 0.2565476894378662 - 0.5489321947097778 - <_> - - <_> - - - - <_>8 6 3 4 -1. - <_>9 6 1 4 3. - 0 - -1.8507939530536532e-003 - 0.6734347939491272 - 0.4252474904060364 - <_> - - <_> - - - - <_>9 6 2 8 -1. - <_>9 10 2 4 2. - 0 - 0.0159189198166132 - 0.5488352775573731 - 0.2292661964893341 - <_> - - <_> - - - - <_>7 7 3 6 -1. - <_>8 7 1 6 3. - 0 - -1.2687679845839739e-003 - 0.6104331016540527 - 0.4022389948368073 - <_> - - <_> - - - - <_>11 3 3 3 -1. - <_>12 3 1 3 3. - 0 - 6.2883910723030567e-003 - 0.5310853123664856 - 0.1536193042993546 - <_> - - <_> - - - - <_>5 4 6 1 -1. - <_>7 4 2 1 3. - 0 - -6.2259892001748085e-003 - 0.1729111969470978 - 0.5241606235504150 - <_> - - <_> - - - - <_>5 6 10 3 -1. - <_>5 7 10 1 3. - 0 - -0.0121325999498367 - 0.6597759723663330 - 0.4325182139873505 - 21.0106391906738280 - 4 - -1 - <_> - - - <_> - - <_> - - - - <_>7 3 6 9 -1. - <_>7 6 6 3 3. - 0 - -3.9184908382594585e-003 - 0.6103435158729553 - 0.1469330936670303 - <_> - - <_> - - - - <_>6 7 9 1 -1. - <_>9 7 3 1 3. - 0 - 1.5971299726516008e-003 - 0.2632363140583038 - 0.5896466970443726 - <_> - - <_> - - - - <_>2 8 16 8 -1. - <_>2 12 16 4 2. - 0 - 0.0177801102399826 - 0.5872874259948731 - 0.1760361939668655 - <_> - - <_> - - - - <_>14 6 2 6 -1. - <_>14 9 2 3 2. - 0 - 6.5334769897162914e-004 - 0.1567801982164383 - 0.5596066117286682 - <_> - - <_> - - - - <_>1 5 6 15 -1. - <_>1 10 6 5 3. - 0 - -2.8353091329336166e-004 - 0.1913153976202011 - 0.5732036232948303 - <_> - - <_> - - - - <_>10 0 6 9 -1. - <_>10 3 6 3 3. - 0 - 1.6104689566418529e-003 - 0.2914913892745972 - 0.5623080730438232 - <_> - - <_> - - - - <_>6 6 7 14 -1. - <_>6 13 7 7 2. - 0 - -0.0977506190538406 - 0.1943476945161820 - 0.5648233294487000 - <_> - - <_> - - - - <_>13 7 3 6 -1. - <_>13 9 3 2 3. - 0 - 5.5182358482852578e-004 - 0.3134616911411285 - 0.5504639744758606 - <_> - - <_> - - - - <_>1 8 15 4 -1. - <_>6 8 5 4 3. - 0 - -0.0128582203760743 - 0.2536481916904450 - 0.5760142803192139 - <_> - - <_> - - - - <_>11 2 3 10 -1. - <_>11 7 3 5 2. - 0 - 4.1530239395797253e-003 - 0.5767722129821777 - 0.3659774065017700 - <_> - - <_> - - - - <_>3 7 4 6 -1. - <_>3 9 4 2 3. - 0 - 1.7092459602281451e-003 - 0.2843191027641296 - 0.5918939113616943 - <_> - - <_> - - - - <_>13 3 6 10 -1. - <_>15 3 2 10 3. - 0 - 7.5217359699308872e-003 - 0.4052427113056183 - 0.6183109283447266 - <_> - - <_> - - - - <_>5 7 8 10 -1. - <_>5 7 4 5 2. - <_>9 12 4 5 2. - 0 - 2.2479810286313295e-003 - 0.5783755183219910 - 0.3135401010513306 - <_> - - <_> - - - - <_>4 4 12 12 -1. - <_>10 4 6 6 2. - <_>4 10 6 6 2. - 0 - 0.0520062111318111 - 0.5541312098503113 - 0.1916636973619461 - <_> - - <_> - - - - <_>1 4 6 9 -1. - <_>3 4 2 9 3. - 0 - 0.0120855299755931 - 0.4032655954360962 - 0.6644591093063355 - <_> - - <_> - - - - <_>11 3 2 5 -1. - <_>11 3 1 5 2. - 0 - 1.4687820112158079e-005 - 0.3535977900028229 - 0.5709382891654968 - <_> - - <_> - - - - <_>7 3 2 5 -1. - <_>8 3 1 5 2. - 0 - 7.1395188570022583e-006 - 0.3037444949150085 - 0.5610269904136658 - <_> - - <_> - - - - <_>10 14 2 3 -1. - <_>10 15 2 1 3. - 0 - -4.6001640148460865e-003 - 0.7181087136268616 - 0.4580326080322266 - <_> - - <_> - - - - <_>5 12 6 2 -1. - <_>8 12 3 2 2. - 0 - 2.0058949012309313e-003 - 0.5621951818466187 - 0.2953684031963348 - <_> - - <_> - - - - <_>9 14 2 3 -1. - <_>9 15 2 1 3. - 0 - 4.5050270855426788e-003 - 0.4615387916564941 - 0.7619017958641052 - <_> - - <_> - - - - <_>4 11 12 6 -1. - <_>4 14 12 3 2. - 0 - 0.0117468303069472 - 0.5343837141990662 - 0.1772529035806656 - <_> - - <_> - - - - <_>11 11 5 9 -1. - <_>11 14 5 3 3. - 0 - -0.0583163388073444 - 0.1686245948076248 - 0.5340772271156311 - <_> - - <_> - - - - <_>6 15 3 2 -1. - <_>6 16 3 1 2. - 0 - 2.3629379575140774e-004 - 0.3792056143283844 - 0.6026803851127625 - <_> - - <_> - - - - <_>11 0 3 5 -1. - <_>12 0 1 5 3. - 0 - -7.8156180679798126e-003 - 0.1512867063283920 - 0.5324323773384094 - <_> - - <_> - - - - <_>5 5 6 7 -1. - <_>8 5 3 7 2. - 0 - -0.0108761601150036 - 0.2081822007894516 - 0.5319945216178894 - <_> - - <_> - - - - <_>13 0 1 9 -1. - <_>13 3 1 3 3. - 0 - -2.7745519764721394e-003 - 0.4098246991634369 - 0.5210328102111816 - <_> - - <_> - - - - <_>3 2 4 8 -1. - <_>3 2 2 4 2. - <_>5 6 2 4 2. - 0 - -7.8276381827890873e-004 - 0.5693274140357971 - 0.3478842079639435 - <_> - - <_> - - - - <_>13 12 4 6 -1. - <_>13 14 4 2 3. - 0 - 0.0138704096898437 - 0.5326750874519348 - 0.2257698029279709 - <_> - - <_> - - - - <_>3 12 4 6 -1. - <_>3 14 4 2 3. - 0 - -0.0236749108880758 - 0.1551305055618286 - 0.5200707912445068 - <_> - - <_> - - - - <_>13 11 3 4 -1. - <_>13 13 3 2 2. - 0 - -1.4879409718560055e-005 - 0.5500566959381104 - 0.3820176124572754 - <_> - - <_> - - - - <_>4 4 4 3 -1. - <_>4 5 4 1 3. - 0 - 3.6190641112625599e-003 - 0.4238683879375458 - 0.6639748215675354 - <_> - - <_> - - - - <_>7 5 11 8 -1. - <_>7 9 11 4 2. - 0 - -0.0198171101510525 - 0.2150038033723831 - 0.5382357835769653 - <_> - - <_> - - - - <_>7 8 3 4 -1. - <_>8 8 1 4 3. - 0 - -3.8154039066284895e-003 - 0.6675711274147034 - 0.4215297102928162 - <_> - - <_> - - - - <_>9 1 6 1 -1. - <_>11 1 2 1 3. - 0 - -4.9775829538702965e-003 - 0.2267289012670517 - 0.5386328101158142 - <_> - - <_> - - - - <_>5 5 3 3 -1. - <_>5 6 3 1 3. - 0 - 2.2441020701080561e-003 - 0.4308691024780273 - 0.6855735778808594 - <_> - - <_> - - - - <_>0 9 20 6 -1. - <_>10 9 10 3 2. - <_>0 12 10 3 2. - 0 - 0.0122824599966407 - 0.5836614966392517 - 0.3467479050159454 - <_> - - <_> - - - - <_>8 6 3 5 -1. - <_>9 6 1 5 3. - 0 - -2.8548699337989092e-003 - 0.7016944885253906 - 0.4311453998088837 - <_> - - <_> - - - - <_>11 0 1 3 -1. - <_>11 1 1 1 3. - 0 - -3.7875669077038765e-003 - 0.2895345091819763 - 0.5224946141242981 - <_> - - <_> - - - - <_>4 2 4 2 -1. - <_>4 3 4 1 2. - 0 - -1.2201230274513364e-003 - 0.2975570857524872 - 0.5481644868850708 - <_> - - <_> - - - - <_>12 6 4 3 -1. - <_>12 7 4 1 3. - 0 - 0.0101605998352170 - 0.4888817965984345 - 0.8182697892189026 - <_> - - <_> - - - - <_>5 0 6 4 -1. - <_>7 0 2 4 3. - 0 - -0.0161745697259903 - 0.1481492966413498 - 0.5239992737770081 - <_> - - <_> - - - - <_>9 7 3 8 -1. - <_>10 7 1 8 3. - 0 - 0.0192924607545137 - 0.4786309897899628 - 0.7378190755844116 - <_> - - <_> - - - - <_>9 7 2 2 -1. - <_>10 7 1 2 2. - 0 - -3.2479539513587952e-003 - 0.7374222874641419 - 0.4470643997192383 - <_> - - <_> - - - - <_>6 7 14 4 -1. - <_>13 7 7 2 2. - <_>6 9 7 2 2. - 0 - -9.3803480267524719e-003 - 0.3489154875278473 - 0.5537996292114258 - <_> - - <_> - - - - <_>0 5 3 6 -1. - <_>0 7 3 2 3. - 0 - -0.0126061299815774 - 0.2379686981439591 - 0.5315443277359009 - <_> - - <_> - - - - <_>13 11 3 4 -1. - <_>13 13 3 2 2. - 0 - -0.0256219301372766 - 0.1964688003063202 - 0.5138769745826721 - <_> - - <_> - - - - <_>4 11 3 4 -1. - <_>4 13 3 2 2. - 0 - -7.5741496402770281e-005 - 0.5590522885322571 - 0.3365853130817413 - <_> - - <_> - - - - <_>5 9 12 8 -1. - <_>11 9 6 4 2. - <_>5 13 6 4 2. - 0 - -0.0892108827829361 - 0.0634046569466591 - 0.5162634849548340 - <_> - - <_> - - - - <_>9 12 1 3 -1. - <_>9 13 1 1 3. - 0 - -2.7670480776578188e-003 - 0.7323467731475830 - 0.4490706026554108 - <_> - - <_> - - - - <_>10 15 2 4 -1. - <_>10 17 2 2 2. - 0 - 2.7152578695677221e-004 - 0.4114834964275360 - 0.5985518097877502 - 23.9187908172607420 - 5 - -1 - <_> - - - <_> - - <_> - - - - <_>7 7 6 1 -1. - <_>9 7 2 1 3. - 0 - 1.4786219689995050e-003 - 0.2663545012474060 - 0.6643316745758057 - <_> - - <_> - - - - <_>12 3 6 6 -1. - <_>15 3 3 3 2. - <_>12 6 3 3 2. - 0 - -1.8741659587249160e-003 - 0.6143848896026611 - 0.2518512904644013 - <_> - - <_> - - - - <_>0 4 10 6 -1. - <_>0 6 10 2 3. - 0 - -1.7151009524241090e-003 - 0.5766341090202332 - 0.2397463023662567 - <_> - - <_> - - - - <_>8 3 8 14 -1. - <_>12 3 4 7 2. - <_>8 10 4 7 2. - 0 - -1.8939269939437509e-003 - 0.5682045817375183 - 0.2529144883155823 - <_> - - <_> - - - - <_>4 4 7 15 -1. - <_>4 9 7 5 3. - 0 - -5.3006052039563656e-003 - 0.1640675961971283 - 0.5556079745292664 - <_> - - <_> - - - - <_>12 2 6 8 -1. - <_>15 2 3 4 2. - <_>12 6 3 4 2. - 0 - -0.0466625317931175 - 0.6123154163360596 - 0.4762830138206482 - <_> - - <_> - - - - <_>2 2 6 8 -1. - <_>2 2 3 4 2. - <_>5 6 3 4 2. - 0 - -7.9431332414969802e-004 - 0.5707858800888062 - 0.2839404046535492 - <_> - - <_> - - - - <_>2 13 18 7 -1. - <_>8 13 6 7 3. - 0 - 0.0148916700854898 - 0.4089672863483429 - 0.6006367206573486 - <_> - - <_> - - - - <_>4 3 8 14 -1. - <_>4 3 4 7 2. - <_>8 10 4 7 2. - 0 - -1.2046529445797205e-003 - 0.5712450742721558 - 0.2705289125442505 - <_> - - <_> - - - - <_>18 1 2 6 -1. - <_>18 3 2 2 3. - 0 - 6.0619381256401539e-003 - 0.5262504220008850 - 0.3262225985527039 - <_> - - <_> - - - - <_>9 11 2 3 -1. - <_>9 12 2 1 3. - 0 - -2.5286648888140917e-003 - 0.6853830814361572 - 0.4199256896972656 - <_> - - <_> - - - - <_>18 1 2 6 -1. - <_>18 3 2 2 3. - 0 - -5.9010218828916550e-003 - 0.3266282081604004 - 0.5434812903404236 - <_> - - <_> - - - - <_>0 1 2 6 -1. - <_>0 3 2 2 3. - 0 - 5.6702760048210621e-003 - 0.5468410849571228 - 0.2319003939628601 - <_> - - <_> - - - - <_>1 5 18 6 -1. - <_>1 7 18 2 3. - 0 - -3.0304100364446640e-003 - 0.5570667982101440 - 0.2708238065242767 - <_> - - <_> - - - - <_>0 2 6 7 -1. - <_>3 2 3 7 2. - 0 - 2.9803649522364140e-003 - 0.3700568974018097 - 0.5890625715255737 - <_> - - <_> - - - - <_>7 3 6 14 -1. - <_>7 10 6 7 2. - 0 - -0.0758405104279518 - 0.2140070050954819 - 0.5419948101043701 - <_> - - <_> - - - - <_>3 7 13 10 -1. - <_>3 12 13 5 2. - 0 - 0.0192625392228365 - 0.5526772141456604 - 0.2726590037345886 - <_> - - <_> - - - - <_>11 15 2 2 -1. - <_>11 16 2 1 2. - 0 - 1.8888259364757687e-004 - 0.3958011865615845 - 0.6017209887504578 - <_> - - <_> - - - - <_>2 11 16 4 -1. - <_>2 11 8 2 2. - <_>10 13 8 2 2. - 0 - 0.0293695498257875 - 0.5241373777389526 - 0.1435758024454117 - <_> - - <_> - - - - <_>13 7 6 4 -1. - <_>16 7 3 2 2. - <_>13 9 3 2 2. - 0 - 1.0417619487270713e-003 - 0.3385409116744995 - 0.5929983258247376 - <_> - - <_> - - - - <_>6 10 3 9 -1. - <_>6 13 3 3 3. - 0 - 2.6125640142709017e-003 - 0.5485377907752991 - 0.3021597862243652 - <_> - - <_> - - - - <_>14 6 1 6 -1. - <_>14 9 1 3 2. - 0 - 9.6977467183023691e-004 - 0.3375276029109955 - 0.5532032847404480 - <_> - - <_> - - - - <_>5 10 4 1 -1. - <_>7 10 2 1 2. - 0 - 5.9512659208849072e-004 - 0.5631743073463440 - 0.3359399139881134 - <_> - - <_> - - - - <_>3 8 15 5 -1. - <_>8 8 5 5 3. - 0 - -0.1015655994415283 - 0.0637350380420685 - 0.5230425000190735 - <_> - - <_> - - - - <_>1 6 5 4 -1. - <_>1 8 5 2 2. - 0 - 0.0361566990613937 - 0.5136963129043579 - 0.1029528975486755 - <_> - - <_> - - - - <_>3 1 17 6 -1. - <_>3 3 17 2 3. - 0 - 3.4624140243977308e-003 - 0.3879320025444031 - 0.5558289289474487 - <_> - - <_> - - - - <_>6 7 8 2 -1. - <_>10 7 4 2 2. - 0 - 0.0195549800992012 - 0.5250086784362793 - 0.1875859946012497 - <_> - - <_> - - - - <_>9 7 3 2 -1. - <_>10 7 1 2 3. - 0 - -2.3121440317481756e-003 - 0.6672028899192810 - 0.4679641127586365 - <_> - - <_> - - - - <_>8 7 3 2 -1. - <_>9 7 1 2 3. - 0 - -1.8605289515107870e-003 - 0.7163379192352295 - 0.4334670901298523 - <_> - - <_> - - - - <_>8 9 4 2 -1. - <_>8 10 4 1 2. - 0 - -9.4026362057775259e-004 - 0.3021360933780670 - 0.5650203227996826 - <_> - - <_> - - - - <_>8 8 4 3 -1. - <_>8 9 4 1 3. - 0 - -5.2418331615626812e-003 - 0.1820009052753449 - 0.5250256061553955 - <_> - - <_> - - - - <_>9 5 6 4 -1. - <_>9 5 3 4 2. - 0 - 1.1729019752237946e-004 - 0.3389188051223755 - 0.5445973277091980 - <_> - - <_> - - - - <_>8 13 4 3 -1. - <_>8 14 4 1 3. - 0 - 1.1878840159624815e-003 - 0.4085349142551422 - 0.6253563165664673 - <_> - - <_> - - - - <_>4 7 12 6 -1. - <_>10 7 6 3 2. - <_>4 10 6 3 2. - 0 - -0.0108813596889377 - 0.3378399014472961 - 0.5700082778930664 - <_> - - <_> - - - - <_>8 14 4 3 -1. - <_>8 15 4 1 3. - 0 - 1.7354859737679362e-003 - 0.4204635918140411 - 0.6523038744926453 - <_> - - <_> - - - - <_>9 7 3 3 -1. - <_>9 8 3 1 3. - 0 - -6.5119052305817604e-003 - 0.2595216035842896 - 0.5428143739700317 - <_> - - <_> - - - - <_>7 4 3 8 -1. - <_>8 4 1 8 3. - 0 - -1.2136430013924837e-003 - 0.6165143847465515 - 0.3977893888950348 - <_> - - <_> - - - - <_>10 0 3 6 -1. - <_>11 0 1 6 3. - 0 - -0.0103542404249310 - 0.1628028005361557 - 0.5219504833221436 - <_> - - <_> - - - - <_>6 3 4 8 -1. - <_>8 3 2 8 2. - 0 - 5.5858830455690622e-004 - 0.3199650943279266 - 0.5503574013710022 - <_> - - <_> - - - - <_>14 3 6 13 -1. - <_>14 3 3 13 2. - 0 - 0.0152996499091387 - 0.4103994071483612 - 0.6122388243675232 - <_> - - <_> - - - - <_>8 13 3 6 -1. - <_>8 16 3 3 2. - 0 - -0.0215882100164890 - 0.1034912988543510 - 0.5197384953498840 - <_> - - <_> - - - - <_>14 3 6 13 -1. - <_>14 3 3 13 2. - 0 - -0.1283462941646576 - 0.8493865132331848 - 0.4893102943897247 - <_> - - <_> - - - - <_>0 7 10 4 -1. - <_>0 7 5 2 2. - <_>5 9 5 2 2. - 0 - -2.2927189711481333e-003 - 0.3130157887935638 - 0.5471575260162354 - <_> - - <_> - - - - <_>14 3 6 13 -1. - <_>14 3 3 13 2. - 0 - 0.0799151062965393 - 0.4856320917606354 - 0.6073989272117615 - <_> - - <_> - - - - <_>0 3 6 13 -1. - <_>3 3 3 13 2. - 0 - -0.0794410929083824 - 0.8394674062728882 - 0.4624533057212830 - <_> - - <_> - - - - <_>9 1 4 1 -1. - <_>9 1 2 1 2. - 0 - -5.2800010889768600e-003 - 0.1881695985794067 - 0.5306698083877564 - <_> - - <_> - - - - <_>8 0 2 1 -1. - <_>9 0 1 1 2. - 0 - 1.0463109938427806e-003 - 0.5271229147911072 - 0.2583065927028656 - <_> - - <_> - - - - <_>10 16 4 4 -1. - <_>12 16 2 2 2. - <_>10 18 2 2 2. - 0 - 2.6317298761568964e-004 - 0.4235304892063141 - 0.5735440850257874 - <_> - - <_> - - - - <_>9 6 2 3 -1. - <_>10 6 1 3 2. - 0 - -3.6173160187900066e-003 - 0.6934396028518677 - 0.4495444893836975 - <_> - - <_> - - - - <_>4 5 12 2 -1. - <_>8 5 4 2 3. - 0 - 0.0114218797534704 - 0.5900921225547791 - 0.4138193130493164 - <_> - - <_> - - - - <_>8 7 3 5 -1. - <_>9 7 1 5 3. - 0 - -1.9963278900831938e-003 - 0.6466382741928101 - 0.4327239990234375 - 24.5278797149658200 - 6 - -1 - <_> - - - <_> - - <_> - - - - <_>6 4 8 6 -1. - <_>6 6 8 2 3. - 0 - -9.9691245704889297e-003 - 0.6142324209213257 - 0.2482212036848068 - <_> - - <_> - - - - <_>9 5 2 12 -1. - <_>9 11 2 6 2. - 0 - 7.3073059320449829e-004 - 0.5704951882362366 - 0.2321965992450714 - <_> - - <_> - - - - <_>4 6 6 8 -1. - <_>4 10 6 4 2. - 0 - 6.4045301405712962e-004 - 0.2112251967191696 - 0.5814933180809021 - <_> - - <_> - - - - <_>12 2 8 5 -1. - <_>12 2 4 5 2. - 0 - 4.5424019917845726e-003 - 0.2950482070446014 - 0.5866311788558960 - <_> - - <_> - - - - <_>0 8 18 3 -1. - <_>0 9 18 1 3. - 0 - 9.2477443104144186e-005 - 0.2990990877151489 - 0.5791326761245728 - <_> - - <_> - - - - <_>8 12 4 8 -1. - <_>8 16 4 4 2. - 0 - -8.6603146046400070e-003 - 0.2813029885292053 - 0.5635542273521423 - <_> - - <_> - - - - <_>0 2 8 5 -1. - <_>4 2 4 5 2. - 0 - 8.0515816807746887e-003 - 0.3535369038581848 - 0.6054757237434387 - <_> - - <_> - - - - <_>13 11 3 4 -1. - <_>13 13 3 2 2. - 0 - 4.3835240649059415e-004 - 0.5596532225608826 - 0.2731510996818543 - <_> - - <_> - - - - <_>5 11 6 1 -1. - <_>7 11 2 1 3. - 0 - -9.8168973636347800e-005 - 0.5978031754493713 - 0.3638561069965363 - <_> - - <_> - - - - <_>11 3 3 1 -1. - <_>12 3 1 1 3. - 0 - -1.1298790341243148e-003 - 0.2755252122879028 - 0.5432729125022888 - <_> - - <_> - - - - <_>7 13 5 3 -1. - <_>7 14 5 1 3. - 0 - 6.4356150105595589e-003 - 0.4305641949176788 - 0.7069833278656006 - <_> - - <_> - - - - <_>11 11 7 6 -1. - <_>11 14 7 3 2. - 0 - -0.0568293295800686 - 0.2495242953300476 - 0.5294997096061707 - <_> - - <_> - - - - <_>2 11 7 6 -1. - <_>2 14 7 3 2. - 0 - 4.0668169967830181e-003 - 0.5478553175926209 - 0.2497723996639252 - <_> - - <_> - - - - <_>12 14 2 6 -1. - <_>12 16 2 2 3. - 0 - 4.8164798499783501e-005 - 0.3938601016998291 - 0.5706356167793274 - <_> - - <_> - - - - <_>8 14 3 3 -1. - <_>8 15 3 1 3. - 0 - 6.1795017682015896e-003 - 0.4407606124877930 - 0.7394766807556152 - <_> - - <_> - - - - <_>11 0 3 5 -1. - <_>12 0 1 5 3. - 0 - 6.4985752105712891e-003 - 0.5445243120193481 - 0.2479152977466583 - <_> - - <_> - - - - <_>6 1 4 9 -1. - <_>8 1 2 9 2. - 0 - -1.0211090557277203e-003 - 0.2544766962528229 - 0.5338971018791199 - <_> - - <_> - - - - <_>10 3 6 1 -1. - <_>12 3 2 1 3. - 0 - -5.4247528314590454e-003 - 0.2718858122825623 - 0.5324069261550903 - <_> - - <_> - - - - <_>8 8 3 4 -1. - <_>8 10 3 2 2. - 0 - -1.0559899965301156e-003 - 0.3178288042545319 - 0.5534508824348450 - <_> - - <_> - - - - <_>8 12 4 2 -1. - <_>8 13 4 1 2. - 0 - 6.6465808777138591e-004 - 0.4284219145774841 - 0.6558194160461426 - <_> - - <_> - - - - <_>5 18 4 2 -1. - <_>5 19 4 1 2. - 0 - -2.7524109464138746e-004 - 0.5902860760688782 - 0.3810262978076935 - <_> - - <_> - - - - <_>2 1 18 6 -1. - <_>2 3 18 2 3. - 0 - 4.2293202131986618e-003 - 0.3816489875316620 - 0.5709385871887207 - <_> - - <_> - - - - <_>6 0 3 2 -1. - <_>7 0 1 2 3. - 0 - -3.2868210691958666e-003 - 0.1747743934392929 - 0.5259544253349304 - <_> - - <_> - - - - <_>13 8 6 2 -1. - <_>16 8 3 1 2. - <_>13 9 3 1 2. - 0 - 1.5611879643984139e-004 - 0.3601722121238709 - 0.5725612044334412 - <_> - - <_> - - - - <_>6 10 3 6 -1. - <_>6 13 3 3 2. - 0 - -7.3621381488919724e-006 - 0.5401858091354370 - 0.3044497072696686 - <_> - - <_> - - - - <_>0 13 20 4 -1. - <_>10 13 10 2 2. - <_>0 15 10 2 2. - 0 - -0.0147672500461340 - 0.3220770061016083 - 0.5573434829711914 - <_> - - <_> - - - - <_>7 7 6 5 -1. - <_>9 7 2 5 3. - 0 - 0.0244895908981562 - 0.4301528036594391 - 0.6518812775611877 - <_> - - <_> - - - - <_>11 0 2 2 -1. - <_>11 1 2 1 2. - 0 - -3.7652091123163700e-004 - 0.3564583063125610 - 0.5598236918449402 - <_> - - <_> - - - - <_>1 8 6 2 -1. - <_>1 8 3 1 2. - <_>4 9 3 1 2. - 0 - 7.3657688517414499e-006 - 0.3490782976150513 - 0.5561897754669190 - <_> - - <_> - - - - <_>0 2 20 2 -1. - <_>10 2 10 1 2. - <_>0 3 10 1 2. - 0 - -0.0150999398902059 - 0.1776272058486939 - 0.5335299968719482 - <_> - - <_> - - - - <_>7 14 5 3 -1. - <_>7 15 5 1 3. - 0 - -3.8316650316119194e-003 - 0.6149687767028809 - 0.4221394062042236 - <_> - - <_> - - - - <_>7 13 6 6 -1. - <_>10 13 3 3 2. - <_>7 16 3 3 2. - 0 - 0.0169254001230001 - 0.5413014888763428 - 0.2166585028171539 - <_> - - <_> - - - - <_>9 12 2 3 -1. - <_>9 13 2 1 3. - 0 - -3.0477850232273340e-003 - 0.6449490785598755 - 0.4354617893695831 - <_> - - <_> - - - - <_>16 11 1 6 -1. - <_>16 13 1 2 3. - 0 - 3.2140589319169521e-003 - 0.5400155186653137 - 0.3523217141628265 - <_> - - <_> - - - - <_>3 11 1 6 -1. - <_>3 13 1 2 3. - 0 - -4.0023201145231724e-003 - 0.2774524092674255 - 0.5338417291641235 - <_> - - <_> - - - - <_>4 4 14 12 -1. - <_>11 4 7 6 2. - <_>4 10 7 6 2. - 0 - 7.4182129465043545e-003 - 0.5676739215850830 - 0.3702817857265472 - <_> - - <_> - - - - <_>5 4 3 3 -1. - <_>5 5 3 1 3. - 0 - -8.8764587417244911e-003 - 0.7749221920967102 - 0.4583688974380493 - <_> - - <_> - - - - <_>12 3 3 3 -1. - <_>13 3 1 3 3. - 0 - 2.7311739977449179e-003 - 0.5338721871376038 - 0.3996661007404327 - <_> - - <_> - - - - <_>6 6 8 3 -1. - <_>6 7 8 1 3. - 0 - -2.5082379579544067e-003 - 0.5611963272094727 - 0.3777498900890350 - <_> - - <_> - - - - <_>12 3 3 3 -1. - <_>13 3 1 3 3. - 0 - -8.0541074275970459e-003 - 0.2915228903293610 - 0.5179182887077332 - <_> - - <_> - - - - <_>3 1 4 10 -1. - <_>3 1 2 5 2. - <_>5 6 2 5 2. - 0 - -9.7938813269138336e-004 - 0.5536432862281799 - 0.3700192868709564 - <_> - - <_> - - - - <_>5 7 10 2 -1. - <_>5 7 5 2 2. - 0 - -5.8745909482240677e-003 - 0.3754391074180603 - 0.5679376125335693 - <_> - - <_> - - - - <_>8 7 3 3 -1. - <_>9 7 1 3 3. - 0 - -4.4936719350516796e-003 - 0.7019699215888977 - 0.4480949938297272 - <_> - - <_> - - - - <_>15 12 2 3 -1. - <_>15 13 2 1 3. - 0 - -5.4389229044318199e-003 - 0.2310364991426468 - 0.5313386917114258 - <_> - - <_> - - - - <_>7 8 3 4 -1. - <_>8 8 1 4 3. - 0 - -7.5094640487805009e-004 - 0.5864868760108948 - 0.4129343032836914 - <_> - - <_> - - - - <_>13 4 1 12 -1. - <_>13 10 1 6 2. - 0 - 1.4528800420521293e-005 - 0.3732407093048096 - 0.5619621276855469 - <_> - - <_> - - - - <_>4 5 12 12 -1. - <_>4 5 6 6 2. - <_>10 11 6 6 2. - 0 - 0.0407580696046352 - 0.5312091112136841 - 0.2720521986484528 - <_> - - <_> - - - - <_>7 14 7 3 -1. - <_>7 15 7 1 3. - 0 - 6.6505931317806244e-003 - 0.4710015952587128 - 0.6693493723869324 - <_> - - <_> - - - - <_>3 12 2 3 -1. - <_>3 13 2 1 3. - 0 - 4.5759351924061775e-003 - 0.5167819261550903 - 0.1637275964021683 - <_> - - <_> - - - - <_>3 2 14 2 -1. - <_>10 2 7 1 2. - <_>3 3 7 1 2. - 0 - 6.5269311890006065e-003 - 0.5397608876228333 - 0.2938531935214996 - <_> - - <_> - - - - <_>0 1 3 10 -1. - <_>1 1 1 10 3. - 0 - -0.0136603796854615 - 0.7086488008499146 - 0.4532200098037720 - <_> - - <_> - - - - <_>9 0 6 5 -1. - <_>11 0 2 5 3. - 0 - 0.0273588690906763 - 0.5206481218338013 - 0.3589231967926025 - <_> - - <_> - - - - <_>5 7 6 2 -1. - <_>8 7 3 2 2. - 0 - 6.2197551596909761e-004 - 0.3507075905799866 - 0.5441123247146606 - <_> - - <_> - - - - <_>7 1 6 10 -1. - <_>7 6 6 5 2. - 0 - -3.3077080734074116e-003 - 0.5859522819519043 - 0.4024891853332520 - <_> - - <_> - - - - <_>1 1 18 3 -1. - <_>7 1 6 3 3. - 0 - -0.0106311095878482 - 0.6743267178535461 - 0.4422602951526642 - <_> - - <_> - - - - <_>16 3 3 6 -1. - <_>16 5 3 2 3. - 0 - 0.0194416493177414 - 0.5282716155052185 - 0.1797904968261719 - 27.1533508300781250 - 7 - -1 - <_> - - - <_> - - <_> - - - - <_>6 3 7 6 -1. - <_>6 6 7 3 2. - 0 - -5.5052167735993862e-003 - 0.5914731025695801 - 0.2626559138298035 - <_> - - <_> - - - - <_>4 7 12 2 -1. - <_>8 7 4 2 3. - 0 - 1.9562279339879751e-003 - 0.2312581986188889 - 0.5741627216339111 - <_> - - <_> - - - - <_>0 4 17 10 -1. - <_>0 9 17 5 2. - 0 - -8.8924784213304520e-003 - 0.1656530052423477 - 0.5626654028892517 - <_> - - <_> - - - - <_>3 4 15 16 -1. - <_>3 12 15 8 2. - 0 - 0.0836383774876595 - 0.5423449873924255 - 0.1957294940948486 - <_> - - <_> - - - - <_>7 15 6 4 -1. - <_>7 17 6 2 2. - 0 - 1.2282270472496748e-003 - 0.3417904078960419 - 0.5992503762245178 - <_> - - <_> - - - - <_>15 2 4 9 -1. - <_>15 2 2 9 2. - 0 - 5.7629169896245003e-003 - 0.3719581961631775 - 0.6079903841018677 - <_> - - <_> - - - - <_>2 3 3 2 -1. - <_>2 4 3 1 2. - 0 - -1.6417410224676132e-003 - 0.2577486038208008 - 0.5576915740966797 - <_> - - <_> - - - - <_>13 6 7 9 -1. - <_>13 9 7 3 3. - 0 - 3.4113149158656597e-003 - 0.2950749099254608 - 0.5514171719551086 - <_> - - <_> - - - - <_>8 11 4 3 -1. - <_>8 12 4 1 3. - 0 - -0.0110693201422691 - 0.7569358944892883 - 0.4477078914642334 - <_> - - <_> - - - - <_>0 2 20 6 -1. - <_>10 2 10 3 2. - <_>0 5 10 3 2. - 0 - 0.0348659716546535 - 0.5583708882331848 - 0.2669621109962463 - <_> - - <_> - - - - <_>3 2 6 10 -1. - <_>3 2 3 5 2. - <_>6 7 3 5 2. - 0 - 6.5701099811121821e-004 - 0.5627313256263733 - 0.2988890111446381 - <_> - - <_> - - - - <_>13 10 3 4 -1. - <_>13 12 3 2 2. - 0 - -0.0243391301482916 - 0.2771185040473938 - 0.5108863115310669 - <_> - - <_> - - - - <_>4 10 3 4 -1. - <_>4 12 3 2 2. - 0 - 5.9435202274471521e-004 - 0.5580651760101318 - 0.3120341897010803 - <_> - - <_> - - - - <_>7 5 6 3 -1. - <_>9 5 2 3 3. - 0 - 2.2971509024500847e-003 - 0.3330250084400177 - 0.5679075717926025 - <_> - - <_> - - - - <_>7 6 6 8 -1. - <_>7 10 6 4 2. - 0 - -3.7801829166710377e-003 - 0.2990534901618958 - 0.5344808101654053 - <_> - - <_> - - - - <_>0 11 20 6 -1. - <_>0 14 20 3 2. - 0 - -0.1342066973447800 - 0.1463858932256699 - 0.5392568111419678 - <_> - - <_> - - - - <_>4 13 4 6 -1. - <_>4 13 2 3 2. - <_>6 16 2 3 2. - 0 - 7.5224548345431685e-004 - 0.3746953904628754 - 0.5692734718322754 - <_> - - <_> - - - - <_>6 0 8 12 -1. - <_>10 0 4 6 2. - <_>6 6 4 6 2. - 0 - -0.0405455417931080 - 0.2754747867584229 - 0.5484297871589661 - <_> - - <_> - - - - <_>2 0 15 2 -1. - <_>2 1 15 1 2. - 0 - 1.2572970008477569e-003 - 0.3744584023952484 - 0.5756075978279114 - <_> - - <_> - - - - <_>9 12 2 3 -1. - <_>9 13 2 1 3. - 0 - -7.4249948374927044e-003 - 0.7513859272003174 - 0.4728231132030487 - <_> - - <_> - - - - <_>3 12 1 2 -1. - <_>3 13 1 1 2. - 0 - 5.0908129196614027e-004 - 0.5404896736145020 - 0.2932321131229401 - <_> - - <_> - - - - <_>9 11 2 3 -1. - <_>9 12 2 1 3. - 0 - -1.2808450264856219e-003 - 0.6169779896736145 - 0.4273349046707153 - <_> - - <_> - - - - <_>7 3 3 1 -1. - <_>8 3 1 1 3. - 0 - -1.8348860321566463e-003 - 0.2048496007919312 - 0.5206472277641296 - <_> - - <_> - - - - <_>17 7 3 6 -1. - <_>17 9 3 2 3. - 0 - 0.0274848695844412 - 0.5252984762191773 - 0.1675522029399872 - <_> - - <_> - - - - <_>7 2 3 2 -1. - <_>8 2 1 2 3. - 0 - 2.2372419480234385e-003 - 0.5267782807350159 - 0.2777658104896545 - <_> - - <_> - - - - <_>11 4 5 3 -1. - <_>11 5 5 1 3. - 0 - -8.8635291904211044e-003 - 0.6954557895660400 - 0.4812048971652985 - <_> - - <_> - - - - <_>4 4 5 3 -1. - <_>4 5 5 1 3. - 0 - 4.1753971017897129e-003 - 0.4291887879371643 - 0.6349195837974548 - <_> - - <_> - - - - <_>19 3 1 2 -1. - <_>19 4 1 1 2. - 0 - -1.7098189564421773e-003 - 0.2930536866188049 - 0.5361248850822449 - <_> - - <_> - - - - <_>5 5 4 3 -1. - <_>5 6 4 1 3. - 0 - 6.5328548662364483e-003 - 0.4495325088500977 - 0.7409694194793701 - <_> - - <_> - - - - <_>17 7 3 6 -1. - <_>17 9 3 2 3. - 0 - -9.5372907817363739e-003 - 0.3149119913578033 - 0.5416501760482788 - <_> - - <_> - - - - <_>0 7 3 6 -1. - <_>0 9 3 2 3. - 0 - 0.0253109894692898 - 0.5121892094612122 - 0.1311707943677902 - <_> - - <_> - - - - <_>14 2 6 9 -1. - <_>14 5 6 3 3. - 0 - 0.0364609695971012 - 0.5175911784172058 - 0.2591339945793152 - <_> - - <_> - - - - <_>0 4 5 6 -1. - <_>0 6 5 2 3. - 0 - 0.0208543296903372 - 0.5137140154838562 - 0.1582316011190414 - <_> - - <_> - - - - <_>10 5 6 2 -1. - <_>12 5 2 2 3. - 0 - -8.7207747856155038e-004 - 0.5574309825897217 - 0.4398978948593140 - <_> - - <_> - - - - <_>4 5 6 2 -1. - <_>6 5 2 2 3. - 0 - -1.5227000403683633e-005 - 0.5548940896987915 - 0.3708069920539856 - <_> - - <_> - - - - <_>8 1 4 6 -1. - <_>8 3 4 2 3. - 0 - -8.4316509310156107e-004 - 0.3387419879436493 - 0.5554211139678955 - <_> - - <_> - - - - <_>0 2 3 6 -1. - <_>0 4 3 2 3. - 0 - 3.6037859972566366e-003 - 0.5358061790466309 - 0.3411171138286591 - <_> - - <_> - - - - <_>6 6 8 3 -1. - <_>6 7 8 1 3. - 0 - -6.8057891912758350e-003 - 0.6125202775001526 - 0.4345862865447998 - <_> - - <_> - - - - <_>0 1 5 9 -1. - <_>0 4 5 3 3. - 0 - -0.0470216609537601 - 0.2358165979385376 - 0.5193738937377930 - <_> - - <_> - - - - <_>16 0 4 15 -1. - <_>16 0 2 15 2. - 0 - -0.0369541086256504 - 0.7323111295700073 - 0.4760943949222565 - <_> - - <_> - - - - <_>1 10 3 2 -1. - <_>1 11 3 1 2. - 0 - 1.0439479956403375e-003 - 0.5419455170631409 - 0.3411330878734589 - <_> - - <_> - - - - <_>14 4 1 10 -1. - <_>14 9 1 5 2. - 0 - -2.1050689974799752e-004 - 0.2821694016456604 - 0.5554947257041931 - <_> - - <_> - - - - <_>0 1 4 12 -1. - <_>2 1 2 12 2. - 0 - -0.0808315873146057 - 0.9129930138587952 - 0.4697434902191162 - <_> - - <_> - - - - <_>11 11 4 2 -1. - <_>11 11 2 2 2. - 0 - -3.6579059087671340e-004 - 0.6022670269012451 - 0.3978292942047119 - <_> - - <_> - - - - <_>5 11 4 2 -1. - <_>7 11 2 2 2. - 0 - -1.2545920617412776e-004 - 0.5613213181495667 - 0.3845539987087250 - <_> - - <_> - - - - <_>3 8 15 5 -1. - <_>8 8 5 5 3. - 0 - -0.0687864869832993 - 0.2261611968278885 - 0.5300496816635132 - <_> - - <_> - - - - <_>0 0 6 10 -1. - <_>3 0 3 10 2. - 0 - 0.0124157899990678 - 0.4075691998004913 - 0.5828812122344971 - <_> - - <_> - - - - <_>11 4 3 2 -1. - <_>12 4 1 2 3. - 0 - -4.7174817882478237e-003 - 0.2827253937721252 - 0.5267757773399353 - <_> - - <_> - - - - <_>8 12 3 8 -1. - <_>8 16 3 4 2. - 0 - 0.0381368584930897 - 0.5074741244316101 - 0.1023615971207619 - <_> - - <_> - - - - <_>8 14 5 3 -1. - <_>8 15 5 1 3. - 0 - -2.8168049175292253e-003 - 0.6169006824493408 - 0.4359692931175232 - <_> - - <_> - - - - <_>7 14 4 3 -1. - <_>7 15 4 1 3. - 0 - 8.1303603947162628e-003 - 0.4524433016777039 - 0.7606095075607300 - <_> - - <_> - - - - <_>11 4 3 2 -1. - <_>12 4 1 2 3. - 0 - 6.0056019574403763e-003 - 0.5240408778190613 - 0.1859712004661560 - <_> - - <_> - - - - <_>3 15 14 4 -1. - <_>3 15 7 2 2. - <_>10 17 7 2 2. - 0 - 0.0191393196582794 - 0.5209379196166992 - 0.2332071959972382 - <_> - - <_> - - - - <_>2 2 16 4 -1. - <_>10 2 8 2 2. - <_>2 4 8 2 2. - 0 - 0.0164457596838474 - 0.5450702905654907 - 0.3264234960079193 - <_> - - <_> - - - - <_>0 8 6 12 -1. - <_>3 8 3 12 2. - 0 - -0.0373568907380104 - 0.6999046802520752 - 0.4533241987228394 - <_> - - <_> - - - - <_>5 7 10 2 -1. - <_>5 7 5 2 2. - 0 - -0.0197279006242752 - 0.2653664946556091 - 0.5412809848785400 - <_> - - <_> - - - - <_>9 7 2 5 -1. - <_>10 7 1 5 2. - 0 - 6.6972579807043076e-003 - 0.4480566084384918 - 0.7138652205467224 - <_> - - <_> - - - - <_>13 7 6 4 -1. - <_>16 7 3 2 2. - <_>13 9 3 2 2. - 0 - 7.4457528535276651e-004 - 0.4231350123882294 - 0.5471320152282715 - <_> - - <_> - - - - <_>0 13 8 2 -1. - <_>0 14 8 1 2. - 0 - 1.1790640419349074e-003 - 0.5341702103614807 - 0.3130455017089844 - <_> - - <_> - - - - <_>13 7 6 4 -1. - <_>16 7 3 2 2. - <_>13 9 3 2 2. - 0 - 0.0349806100130081 - 0.5118659734725952 - 0.3430530130863190 - <_> - - <_> - - - - <_>1 7 6 4 -1. - <_>1 7 3 2 2. - <_>4 9 3 2 2. - 0 - 5.6859792675822973e-004 - 0.3532187044620514 - 0.5468639731407166 - <_> - - <_> - - - - <_>12 6 1 12 -1. - <_>12 12 1 6 2. - 0 - -0.0113406497985125 - 0.2842353880405426 - 0.5348700881004334 - <_> - - <_> - - - - <_>9 5 2 6 -1. - <_>10 5 1 6 2. - 0 - -6.6228108480572701e-003 - 0.6883640289306641 - 0.4492664933204651 - <_> - - <_> - - - - <_>14 12 2 3 -1. - <_>14 13 2 1 3. - 0 - -8.0160330981016159e-003 - 0.1709893941879273 - 0.5224308967590332 - <_> - - <_> - - - - <_>4 12 2 3 -1. - <_>4 13 2 1 3. - 0 - 1.4206819469109178e-003 - 0.5290846228599548 - 0.2993383109569550 - <_> - - <_> - - - - <_>8 12 4 3 -1. - <_>8 13 4 1 3. - 0 - -2.7801711112260818e-003 - 0.6498854160308838 - 0.4460499882698059 - <_> - - <_> - - - - <_>5 2 2 4 -1. - <_>5 2 1 2 2. - <_>6 4 1 2 2. - 0 - -1.4747589593753219e-003 - 0.3260438144207001 - 0.5388113260269165 - <_> - - <_> - - - - <_>5 5 11 3 -1. - <_>5 6 11 1 3. - 0 - -0.0238303393125534 - 0.7528941035270691 - 0.4801219999790192 - <_> - - <_> - - - - <_>7 6 4 12 -1. - <_>7 12 4 6 2. - 0 - 6.9369790144264698e-003 - 0.5335165858268738 - 0.3261427879333496 - <_> - - <_> - - - - <_>12 13 8 5 -1. - <_>12 13 4 5 2. - 0 - 8.2806255668401718e-003 - 0.4580394029617310 - 0.5737829804420471 - <_> - - <_> - - - - <_>7 6 1 12 -1. - <_>7 12 1 6 2. - 0 - -0.0104395002126694 - 0.2592320144176483 - 0.5233827829360962 - 34.5541114807128910 - 8 - -1 - <_> - - - <_> - - <_> - - - - <_>1 2 6 3 -1. - <_>4 2 3 3 2. - 0 - 7.2006587870419025e-003 - 0.3258886039257050 - 0.6849808096885681 - <_> - - <_> - - - - <_>9 5 6 10 -1. - <_>12 5 3 5 2. - <_>9 10 3 5 2. - 0 - -2.8593589086085558e-003 - 0.5838881134986877 - 0.2537829875946045 - <_> - - <_> - - - - <_>5 5 8 12 -1. - <_>5 5 4 6 2. - <_>9 11 4 6 2. - 0 - 6.8580528022721410e-004 - 0.5708081722259522 - 0.2812424004077911 - <_> - - <_> - - - - <_>0 7 20 6 -1. - <_>0 9 20 2 3. - 0 - 7.9580191522836685e-003 - 0.2501051127910614 - 0.5544260740280151 - <_> - - <_> - - - - <_>4 2 2 2 -1. - <_>4 3 2 1 2. - 0 - -1.2124150525778532e-003 - 0.2385368049144745 - 0.5433350205421448 - <_> - - <_> - - - - <_>4 18 12 2 -1. - <_>8 18 4 2 3. - 0 - 7.9426132142543793e-003 - 0.3955070972442627 - 0.6220757961273193 - <_> - - <_> - - - - <_>7 4 4 16 -1. - <_>7 12 4 8 2. - 0 - 2.4630590341985226e-003 - 0.5639708042144775 - 0.2992357909679413 - <_> - - <_> - - - - <_>7 6 7 8 -1. - <_>7 10 7 4 2. - 0 - -6.0396599583327770e-003 - 0.2186512947082520 - 0.5411676764488220 - <_> - - <_> - - - - <_>6 3 3 1 -1. - <_>7 3 1 1 3. - 0 - -1.2988339876756072e-003 - 0.2350706011056900 - 0.5364584922790527 - <_> - - <_> - - - - <_>11 15 2 4 -1. - <_>11 17 2 2 2. - 0 - 2.2299369447864592e-004 - 0.3804112970829010 - 0.5729606151580811 - <_> - - <_> - - - - <_>3 5 4 8 -1. - <_>3 9 4 4 2. - 0 - 1.4654280385002494e-003 - 0.2510167956352234 - 0.5258268713951111 - <_> - - <_> - - - - <_>7 1 6 12 -1. - <_>7 7 6 6 2. - 0 - -8.1210042117163539e-004 - 0.5992823839187622 - 0.3851158916950226 - <_> - - <_> - - - - <_>4 6 6 2 -1. - <_>6 6 2 2 3. - 0 - -1.3836020370945334e-003 - 0.5681396126747131 - 0.3636586964130402 - <_> - - <_> - - - - <_>16 4 4 6 -1. - <_>16 6 4 2 3. - 0 - -0.0279364492744207 - 0.1491317003965378 - 0.5377560257911682 - <_> - - <_> - - - - <_>3 3 5 2 -1. - <_>3 4 5 1 2. - 0 - -4.6919551095925272e-004 - 0.3692429959774017 - 0.5572484731674194 - <_> - - <_> - - - - <_>9 11 2 3 -1. - <_>9 12 2 1 3. - 0 - -4.9829659983515739e-003 - 0.6758509278297424 - 0.4532504081726074 - <_> - - <_> - - - - <_>2 16 4 2 -1. - <_>2 17 4 1 2. - 0 - 1.8815309740602970e-003 - 0.5368022918701172 - 0.2932539880275726 - <_> - - <_> - - - - <_>7 13 6 6 -1. - <_>10 13 3 3 2. - <_>7 16 3 3 2. - 0 - -0.0190675500780344 - 0.1649377048015595 - 0.5330067276954651 - <_> - - <_> - - - - <_>7 0 3 4 -1. - <_>8 0 1 4 3. - 0 - -4.6906559728085995e-003 - 0.1963925957679749 - 0.5119361877441406 - <_> - - <_> - - - - <_>8 15 4 3 -1. - <_>8 16 4 1 3. - 0 - 5.9777139686048031e-003 - 0.4671171903610230 - 0.7008398175239563 - <_> - - <_> - - - - <_>0 4 4 6 -1. - <_>0 6 4 2 3. - 0 - -0.0333031304180622 - 0.1155416965484619 - 0.5104162096977234 - <_> - - <_> - - - - <_>5 6 12 3 -1. - <_>9 6 4 3 3. - 0 - 0.0907441079616547 - 0.5149660110473633 - 0.1306173056364059 - <_> - - <_> - - - - <_>7 6 6 14 -1. - <_>9 6 2 14 3. - 0 - 9.3555898638442159e-004 - 0.3605481088161469 - 0.5439859032630920 - <_> - - <_> - - - - <_>9 7 3 3 -1. - <_>10 7 1 3 3. - 0 - 0.0149016501381993 - 0.4886212050914764 - 0.7687569856643677 - <_> - - <_> - - - - <_>6 12 2 4 -1. - <_>6 14 2 2 2. - 0 - 6.1594118596985936e-004 - 0.5356813073158264 - 0.3240939080715179 - <_> - - <_> - - - - <_>10 12 7 6 -1. - <_>10 14 7 2 3. - 0 - -0.0506709888577461 - 0.1848621964454651 - 0.5230404138565064 - <_> - - <_> - - - - <_>1 0 15 2 -1. - <_>1 1 15 1 2. - 0 - 6.8665749859064817e-004 - 0.3840579986572266 - 0.5517945885658264 - <_> - - <_> - - - - <_>14 0 6 6 -1. - <_>14 0 3 6 2. - 0 - 8.3712432533502579e-003 - 0.4288564026355743 - 0.6131753921508789 - <_> - - <_> - - - - <_>5 3 3 1 -1. - <_>6 3 1 1 3. - 0 - -1.2953069526702166e-003 - 0.2913674116134644 - 0.5280737876892090 - <_> - - <_> - - - - <_>14 0 6 6 -1. - <_>14 0 3 6 2. - 0 - -0.0419416800141335 - 0.7554799914360046 - 0.4856030941009522 - <_> - - <_> - - - - <_>0 3 20 10 -1. - <_>0 8 20 5 2. - 0 - -0.0235293805599213 - 0.2838279902935028 - 0.5256081223487854 - <_> - - <_> - - - - <_>14 0 6 6 -1. - <_>14 0 3 6 2. - 0 - 0.0408574491739273 - 0.4870935082435608 - 0.6277297139167786 - <_> - - <_> - - - - <_>0 0 6 6 -1. - <_>3 0 3 6 2. - 0 - -0.0254068691283464 - 0.7099707722663879 - 0.4575029015541077 - <_> - - <_> - - - - <_>19 15 1 2 -1. - <_>19 16 1 1 2. - 0 - -4.1415440500713885e-004 - 0.4030886888504028 - 0.5469412207603455 - <_> - - <_> - - - - <_>0 2 4 8 -1. - <_>2 2 2 8 2. - 0 - 0.0218241196125746 - 0.4502024054527283 - 0.6768701076507568 - <_> - - <_> - - - - <_>2 1 18 4 -1. - <_>11 1 9 2 2. - <_>2 3 9 2 2. - 0 - 0.0141140399500728 - 0.5442860722541809 - 0.3791700005531311 - <_> - - <_> - - - - <_>8 12 1 2 -1. - <_>8 13 1 1 2. - 0 - 6.7214590671937913e-005 - 0.4200463891029358 - 0.5873476266860962 - <_> - - <_> - - - - <_>5 2 10 6 -1. - <_>10 2 5 3 2. - <_>5 5 5 3 2. - 0 - -7.9417638480663300e-003 - 0.3792561888694763 - 0.5585265755653381 - <_> - - <_> - - - - <_>9 7 2 4 -1. - <_>10 7 1 4 2. - 0 - -7.2144409641623497e-003 - 0.7253103852272034 - 0.4603548943996429 - <_> - - <_> - - - - <_>9 7 3 3 -1. - <_>10 7 1 3 3. - 0 - 2.5817339774221182e-003 - 0.4693301916122437 - 0.5900238752365112 - <_> - - <_> - - - - <_>4 5 12 8 -1. - <_>8 5 4 8 3. - 0 - 0.1340931951999664 - 0.5149213075637817 - 0.1808844953775406 - <_> - - <_> - - - - <_>15 15 4 3 -1. - <_>15 16 4 1 3. - 0 - 2.2962710354477167e-003 - 0.5399743914604187 - 0.3717867136001587 - <_> - - <_> - - - - <_>8 18 3 1 -1. - <_>9 18 1 1 3. - 0 - -2.1575849968940020e-003 - 0.2408495992422104 - 0.5148863792419434 - <_> - - <_> - - - - <_>9 13 4 3 -1. - <_>9 14 4 1 3. - 0 - -4.9196188338100910e-003 - 0.6573588252067566 - 0.4738740026950836 - <_> - - <_> - - - - <_>7 13 4 3 -1. - <_>7 14 4 1 3. - 0 - 1.6267469618469477e-003 - 0.4192821979522705 - 0.6303114295005798 - <_> - - <_> - - - - <_>19 15 1 2 -1. - <_>19 16 1 1 2. - 0 - 3.3413388882763684e-004 - 0.5540298223495483 - 0.3702101111412048 - <_> - - <_> - - - - <_>0 15 8 4 -1. - <_>0 17 8 2 2. - 0 - -0.0266980808228254 - 0.1710917949676514 - 0.5101410746574402 - <_> - - <_> - - - - <_>9 3 6 4 -1. - <_>11 3 2 4 3. - 0 - -0.0305618792772293 - 0.1904218047857285 - 0.5168793797492981 - <_> - - <_> - - - - <_>8 14 4 3 -1. - <_>8 15 4 1 3. - 0 - 2.8511548880487680e-003 - 0.4447506964206696 - 0.6313853859901428 - <_> - - <_> - - - - <_>3 14 14 6 -1. - <_>3 16 14 2 3. - 0 - -0.0362114794552326 - 0.2490727007389069 - 0.5377349257469177 - <_> - - <_> - - - - <_>6 3 6 6 -1. - <_>6 6 6 3 2. - 0 - -2.4115189444273710e-003 - 0.5381243228912354 - 0.3664236962795258 - <_> - - <_> - - - - <_>5 11 10 6 -1. - <_>5 14 10 3 2. - 0 - -7.7253201743587852e-004 - 0.5530232191085815 - 0.3541550040245056 - <_> - - <_> - - - - <_>3 10 3 4 -1. - <_>4 10 1 4 3. - 0 - 2.9481729143299162e-004 - 0.4132699072360992 - 0.5667243003845215 - <_> - - <_> - - - - <_>13 9 2 2 -1. - <_>13 9 1 2 2. - 0 - -6.2334560789167881e-003 - 0.0987872332334518 - 0.5198668837547302 - <_> - - <_> - - - - <_>5 3 6 4 -1. - <_>7 3 2 4 3. - 0 - -0.0262747295200825 - 0.0911274924874306 - 0.5028107166290283 - <_> - - <_> - - - - <_>9 7 3 3 -1. - <_>10 7 1 3 3. - 0 - 5.3212260827422142e-003 - 0.4726648926734924 - 0.6222720742225647 - <_> - - <_> - - - - <_>2 12 2 3 -1. - <_>2 13 2 1 3. - 0 - -4.1129058226943016e-003 - 0.2157457023859024 - 0.5137804746627808 - <_> - - <_> - - - - <_>9 8 3 12 -1. - <_>9 12 3 4 3. - 0 - 3.2457809429615736e-003 - 0.5410770773887634 - 0.3721776902675629 - <_> - - <_> - - - - <_>3 14 4 6 -1. - <_>3 14 2 3 2. - <_>5 17 2 3 2. - 0 - -0.0163597092032433 - 0.7787874937057495 - 0.4685291945934296 - <_> - - <_> - - - - <_>16 15 2 2 -1. - <_>16 16 2 1 2. - 0 - 3.2166109303943813e-004 - 0.5478987097740173 - 0.4240373969078064 - <_> - - <_> - - - - <_>2 15 2 2 -1. - <_>2 16 2 1 2. - 0 - 6.4452440710738301e-004 - 0.5330560803413391 - 0.3501324951648712 - <_> - - <_> - - - - <_>8 12 4 3 -1. - <_>8 13 4 1 3. - 0 - -7.8909732401371002e-003 - 0.6923521161079407 - 0.4726569056510925 - <_> - - <_> - - - - <_>0 7 20 1 -1. - <_>10 7 10 1 2. - 0 - 0.0483362115919590 - 0.5055900216102600 - 0.0757492035627365 - <_> - - <_> - - - - <_>7 6 8 3 -1. - <_>7 6 4 3 2. - 0 - -7.5178127735853195e-004 - 0.3783741891384125 - 0.5538573861122131 - <_> - - <_> - - - - <_>5 7 8 2 -1. - <_>9 7 4 2 2. - 0 - -2.4953910615295172e-003 - 0.3081651031970978 - 0.5359612107276917 - <_> - - <_> - - - - <_>9 7 3 5 -1. - <_>10 7 1 5 3. - 0 - -2.2385010961443186e-003 - 0.6633958816528320 - 0.4649342894554138 - <_> - - <_> - - - - <_>8 7 3 5 -1. - <_>9 7 1 5 3. - 0 - -1.7988430336117744e-003 - 0.6596844792366028 - 0.4347187876701355 - <_> - - <_> - - - - <_>11 1 3 5 -1. - <_>12 1 1 5 3. - 0 - 8.7860915809869766e-003 - 0.5231832861900330 - 0.2315579950809479 - <_> - - <_> - - - - <_>6 2 3 6 -1. - <_>7 2 1 6 3. - 0 - 3.6715380847454071e-003 - 0.5204250216484070 - 0.2977376878261566 - <_> - - <_> - - - - <_>14 14 6 5 -1. - <_>14 14 3 5 2. - 0 - -0.0353364497423172 - 0.7238878011703491 - 0.4861505031585693 - <_> - - <_> - - - - <_>9 8 2 2 -1. - <_>9 9 2 1 2. - 0 - -6.9189240457490087e-004 - 0.3105022013187408 - 0.5229824781417847 - <_> - - <_> - - - - <_>10 7 1 3 -1. - <_>10 8 1 1 3. - 0 - -3.3946109469980001e-003 - 0.3138968050479889 - 0.5210173726081848 - <_> - - <_> - - - - <_>6 6 2 2 -1. - <_>6 6 1 1 2. - <_>7 7 1 1 2. - 0 - 9.8569283727556467e-004 - 0.4536580145359039 - 0.6585097908973694 - <_> - - <_> - - - - <_>2 11 18 4 -1. - <_>11 11 9 2 2. - <_>2 13 9 2 2. - 0 - -0.0501631014049053 - 0.1804454028606415 - 0.5198916792869568 - <_> - - <_> - - - - <_>6 6 2 2 -1. - <_>6 6 1 1 2. - <_>7 7 1 1 2. - 0 - -2.2367259953171015e-003 - 0.7255702018737793 - 0.4651359021663666 - <_> - - <_> - - - - <_>0 15 20 2 -1. - <_>0 16 20 1 2. - 0 - 7.4326287722215056e-004 - 0.4412921071052551 - 0.5898545980453491 - <_> - - <_> - - - - <_>4 14 2 3 -1. - <_>4 15 2 1 3. - 0 - -9.3485182151198387e-004 - 0.3500052988529205 - 0.5366017818450928 - <_> - - <_> - - - - <_>8 14 4 3 -1. - <_>8 15 4 1 3. - 0 - 0.0174979399889708 - 0.4912194907665253 - 0.8315284848213196 - <_> - - <_> - - - - <_>8 7 2 3 -1. - <_>8 8 2 1 3. - 0 - -1.5200000489130616e-003 - 0.3570275902748108 - 0.5370560288429260 - <_> - - <_> - - - - <_>9 10 2 3 -1. - <_>9 11 2 1 3. - 0 - 7.8003940870985389e-004 - 0.4353772103786469 - 0.5967335104942322 - 39.1072883605957030 - 9 - -1 - <_> - - - <_> - - <_> - - - - <_>5 4 10 4 -1. - <_>5 6 10 2 2. - 0 - -9.9945552647113800e-003 - 0.6162583231925964 - 0.3054533004760742 - <_> - - <_> - - - - <_>9 7 6 4 -1. - <_>12 7 3 2 2. - <_>9 9 3 2 2. - 0 - -1.1085229925811291e-003 - 0.5818294882774353 - 0.3155578076839447 - <_> - - <_> - - - - <_>4 7 3 6 -1. - <_>4 9 3 2 3. - 0 - 1.0364380432292819e-003 - 0.2552052140235901 - 0.5692911744117737 - <_> - - <_> - - - - <_>11 15 4 4 -1. - <_>13 15 2 2 2. - <_>11 17 2 2 2. - 0 - 6.8211311008781195e-004 - 0.3685089945793152 - 0.5934931039810181 - <_> - - <_> - - - - <_>7 8 4 2 -1. - <_>7 9 4 1 2. - 0 - -6.8057340104132891e-004 - 0.2332392036914825 - 0.5474792122840881 - <_> - - <_> - - - - <_>13 1 4 3 -1. - <_>13 1 2 3 2. - 0 - 2.6068789884448051e-004 - 0.3257457017898560 - 0.5667545795440674 - <_> - - <_> - - - - <_>5 15 4 4 -1. - <_>5 15 2 2 2. - <_>7 17 2 2 2. - 0 - 5.1607372006401420e-004 - 0.3744716942310333 - 0.5845472812652588 - <_> - - <_> - - - - <_>9 5 4 7 -1. - <_>9 5 2 7 2. - 0 - 8.5007521556690335e-004 - 0.3420371115207672 - 0.5522807240486145 - <_> - - <_> - - - - <_>5 6 8 3 -1. - <_>9 6 4 3 2. - 0 - -1.8607829697430134e-003 - 0.2804419994354248 - 0.5375424027442932 - <_> - - <_> - - - - <_>9 9 2 2 -1. - <_>9 10 2 1 2. - 0 - -1.5033970121294260e-003 - 0.2579050958156586 - 0.5498952269554138 - <_> - - <_> - - - - <_>7 15 5 3 -1. - <_>7 16 5 1 3. - 0 - 2.3478909861296415e-003 - 0.4175156056880951 - 0.6313710808753967 - <_> - - <_> - - - - <_>11 10 4 3 -1. - <_>11 10 2 3 2. - 0 - -2.8880240279249847e-004 - 0.5865169763565064 - 0.4052666127681732 - <_> - - <_> - - - - <_>6 9 8 10 -1. - <_>6 14 8 5 2. - 0 - 8.9405477046966553e-003 - 0.5211141109466553 - 0.2318654060363770 - <_> - - <_> - - - - <_>10 11 6 2 -1. - <_>10 11 3 2 2. - 0 - -0.0193277392536402 - 0.2753432989120483 - 0.5241525769233704 - <_> - - <_> - - - - <_>4 11 6 2 -1. - <_>7 11 3 2 2. - 0 - -2.0202060113660991e-004 - 0.5722978711128235 - 0.3677195906639099 - <_> - - <_> - - - - <_>11 3 8 1 -1. - <_>11 3 4 1 2. - 0 - 2.1179069299250841e-003 - 0.4466108083724976 - 0.5542430877685547 - <_> - - <_> - - - - <_>6 3 3 2 -1. - <_>7 3 1 2 3. - 0 - -1.7743760254234076e-003 - 0.2813253104686737 - 0.5300959944725037 - <_> - - <_> - - - - <_>14 5 6 5 -1. - <_>14 5 3 5 2. - 0 - 4.2234458960592747e-003 - 0.4399709999561310 - 0.5795428156852722 - <_> - - <_> - - - - <_>7 5 2 12 -1. - <_>7 11 2 6 2. - 0 - -0.0143752200528979 - 0.2981117963790894 - 0.5292059183120728 - <_> - - <_> - - - - <_>8 11 4 3 -1. - <_>8 12 4 1 3. - 0 - -0.0153491804376245 - 0.7705215215682983 - 0.4748171865940094 - <_> - - <_> - - - - <_>4 1 2 3 -1. - <_>5 1 1 3 2. - 0 - 1.5152279956964776e-005 - 0.3718844056129456 - 0.5576897263526917 - <_> - - <_> - - - - <_>18 3 2 6 -1. - <_>18 5 2 2 3. - 0 - -9.1293919831514359e-003 - 0.3615196049213409 - 0.5286766886711121 - <_> - - <_> - - - - <_>0 3 2 6 -1. - <_>0 5 2 2 3. - 0 - 2.2512159775942564e-003 - 0.5364704728126526 - 0.3486298024654388 - <_> - - <_> - - - - <_>9 12 2 3 -1. - <_>9 13 2 1 3. - 0 - -4.9696918576955795e-003 - 0.6927651762962341 - 0.4676836133003235 - <_> - - <_> - - - - <_>7 13 4 3 -1. - <_>7 14 4 1 3. - 0 - -0.0128290103748441 - 0.7712153792381287 - 0.4660735130310059 - <_> - - <_> - - - - <_>18 0 2 6 -1. - <_>18 2 2 2 3. - 0 - -9.3660065904259682e-003 - 0.3374983966350555 - 0.5351287722587585 - <_> - - <_> - - - - <_>0 0 2 6 -1. - <_>0 2 2 2 3. - 0 - 3.2452319283038378e-003 - 0.5325189828872681 - 0.3289610147476196 - <_> - - <_> - - - - <_>8 14 6 3 -1. - <_>8 15 6 1 3. - 0 - -0.0117235602810979 - 0.6837652921676636 - 0.4754300117492676 - <_> - - <_> - - - - <_>7 4 2 4 -1. - <_>8 4 1 4 2. - 0 - 2.9257940695970319e-005 - 0.3572087883949280 - 0.5360502004623413 - <_> - - <_> - - - - <_>8 5 4 6 -1. - <_>8 7 4 2 3. - 0 - -2.2244219508138485e-005 - 0.5541427135467529 - 0.3552064001560211 - <_> - - <_> - - - - <_>6 4 2 2 -1. - <_>7 4 1 2 2. - 0 - 5.0881509669125080e-003 - 0.5070844292640686 - 0.1256462037563324 - <_> - - <_> - - - - <_>3 14 14 4 -1. - <_>10 14 7 2 2. - <_>3 16 7 2 2. - 0 - 0.0274296794086695 - 0.5269560217857361 - 0.1625818014144898 - <_> - - <_> - - - - <_>6 15 6 2 -1. - <_>6 15 3 1 2. - <_>9 16 3 1 2. - 0 - -6.4142867922782898e-003 - 0.7145588994026184 - 0.4584197103977203 - <_> - - <_> - - - - <_>14 15 6 2 -1. - <_>14 16 6 1 2. - 0 - 3.3479959238320589e-003 - 0.5398612022399902 - 0.3494696915149689 - <_> - - <_> - - - - <_>2 12 12 8 -1. - <_>2 16 12 4 2. - 0 - -0.0826354920864105 - 0.2439192980527878 - 0.5160226225852966 - <_> - - <_> - - - - <_>7 7 7 2 -1. - <_>7 8 7 1 2. - 0 - 1.0261740535497665e-003 - 0.3886891901493073 - 0.5767908096313477 - <_> - - <_> - - - - <_>0 2 18 2 -1. - <_>0 3 18 1 2. - 0 - -1.6307090409100056e-003 - 0.3389458060264587 - 0.5347700715065002 - <_> - - <_> - - - - <_>9 6 2 5 -1. - <_>9 6 1 5 2. - 0 - 2.4546680506318808e-003 - 0.4601413905620575 - 0.6387246847152710 - <_> - - <_> - - - - <_>7 5 3 8 -1. - <_>8 5 1 8 3. - 0 - -9.9476519972085953e-004 - 0.5769879221916199 - 0.4120396077632904 - <_> - - <_> - - - - <_>9 6 3 4 -1. - <_>10 6 1 4 3. - 0 - 0.0154091902077198 - 0.4878709018230438 - 0.7089822292327881 - <_> - - <_> - - - - <_>4 13 3 2 -1. - <_>4 14 3 1 2. - 0 - 1.1784400558099151e-003 - 0.5263553261756897 - 0.2895244956016541 - <_> - - <_> - - - - <_>9 4 6 3 -1. - <_>11 4 2 3 3. - 0 - -0.0277019198983908 - 0.1498828977346420 - 0.5219606757164002 - <_> - - <_> - - - - <_>5 4 6 3 -1. - <_>7 4 2 3 3. - 0 - -0.0295053999871016 - 0.0248933192342520 - 0.4999816119670868 - <_> - - <_> - - - - <_>14 11 5 2 -1. - <_>14 12 5 1 2. - 0 - 4.5159430010244250e-004 - 0.5464622974395752 - 0.4029662907123566 - <_> - - <_> - - - - <_>1 2 6 9 -1. - <_>3 2 2 9 3. - 0 - 7.1772639639675617e-003 - 0.4271056950092316 - 0.5866296887397766 - <_> - - <_> - - - - <_>14 6 6 13 -1. - <_>14 6 3 13 2. - 0 - -0.0741820484399796 - 0.6874179244041443 - 0.4919027984142304 - <_> - - <_> - - - - <_>3 6 14 8 -1. - <_>3 6 7 4 2. - <_>10 10 7 4 2. - 0 - -0.0172541607171297 - 0.3370676040649414 - 0.5348739027976990 - <_> - - <_> - - - - <_>16 0 4 11 -1. - <_>16 0 2 11 2. - 0 - 0.0148515598848462 - 0.4626792967319489 - 0.6129904985427856 - <_> - - <_> - - - - <_>3 4 12 12 -1. - <_>3 4 6 6 2. - <_>9 10 6 6 2. - 0 - 0.0100020002573729 - 0.5346122980117798 - 0.3423453867435455 - <_> - - <_> - - - - <_>11 4 5 3 -1. - <_>11 5 5 1 3. - 0 - 2.0138120744377375e-003 - 0.4643830060958862 - 0.5824304223060608 - <_> - - <_> - - - - <_>4 11 4 2 -1. - <_>4 12 4 1 2. - 0 - 1.5135470312088728e-003 - 0.5196396112442017 - 0.2856149971485138 - <_> - - <_> - - - - <_>10 7 2 2 -1. - <_>10 7 1 2 2. - 0 - 3.1381431035697460e-003 - 0.4838162958621979 - 0.5958529710769653 - <_> - - <_> - - - - <_>8 7 2 2 -1. - <_>9 7 1 2 2. - 0 - -5.1450440660119057e-003 - 0.8920302987098694 - 0.4741412103176117 - <_> - - <_> - - - - <_>9 17 3 2 -1. - <_>10 17 1 2 3. - 0 - -4.4736708514392376e-003 - 0.2033942937850952 - 0.5337278842926025 - <_> - - <_> - - - - <_>5 6 3 3 -1. - <_>5 7 3 1 3. - 0 - 1.9628470763564110e-003 - 0.4571633934974670 - 0.6725863218307495 - <_> - - <_> - - - - <_>10 0 3 3 -1. - <_>11 0 1 3 3. - 0 - 5.4260450415313244e-003 - 0.5271108150482178 - 0.2845670878887177 - <_> - - <_> - - - - <_>5 6 6 2 -1. - <_>5 6 3 1 2. - <_>8 7 3 1 2. - 0 - 4.9611460417509079e-004 - 0.4138312935829163 - 0.5718597769737244 - <_> - - <_> - - - - <_>12 16 4 3 -1. - <_>12 17 4 1 3. - 0 - 9.3728788197040558e-003 - 0.5225151181221008 - 0.2804847061634064 - <_> - - <_> - - - - <_>3 12 3 2 -1. - <_>3 13 3 1 2. - 0 - 6.0500897234305739e-004 - 0.5236768722534180 - 0.3314523994922638 - <_> - - <_> - - - - <_>9 12 3 2 -1. - <_>9 13 3 1 2. - 0 - 5.6792551185935736e-004 - 0.4531059861183167 - 0.6276971101760864 - <_> - - <_> - - - - <_>1 11 16 4 -1. - <_>1 11 8 2 2. - <_>9 13 8 2 2. - 0 - 0.0246443394571543 - 0.5130851864814758 - 0.2017143964767456 - <_> - - <_> - - - - <_>12 4 3 3 -1. - <_>12 5 3 1 3. - 0 - -0.0102904504165053 - 0.7786595225334168 - 0.4876641035079956 - <_> - - <_> - - - - <_>4 4 5 3 -1. - <_>4 5 5 1 3. - 0 - 2.0629419013857841e-003 - 0.4288598895072937 - 0.5881264209747315 - <_> - - <_> - - - - <_>12 16 4 3 -1. - <_>12 17 4 1 3. - 0 - -5.0519481301307678e-003 - 0.3523977994918823 - 0.5286008715629578 - <_> - - <_> - - - - <_>5 4 3 3 -1. - <_>5 5 3 1 3. - 0 - -5.7692620903253555e-003 - 0.6841086149215698 - 0.4588094055652618 - <_> - - <_> - - - - <_>9 0 2 2 -1. - <_>9 1 2 1 2. - 0 - -4.5789941214025021e-004 - 0.3565520048141480 - 0.5485978126525879 - <_> - - <_> - - - - <_>8 9 4 2 -1. - <_>8 10 4 1 2. - 0 - -7.5918837683275342e-004 - 0.3368793129920960 - 0.5254197120666504 - <_> - - <_> - - - - <_>8 8 4 3 -1. - <_>8 9 4 1 3. - 0 - -1.7737259622663260e-003 - 0.3422161042690277 - 0.5454015135765076 - <_> - - <_> - - - - <_>0 13 6 3 -1. - <_>2 13 2 3 3. - 0 - -8.5610467940568924e-003 - 0.6533612012863159 - 0.4485856890678406 - <_> - - <_> - - - - <_>16 14 3 2 -1. - <_>16 15 3 1 2. - 0 - 1.7277270089834929e-003 - 0.5307580232620239 - 0.3925352990627289 - <_> - - <_> - - - - <_>1 18 18 2 -1. - <_>7 18 6 2 3. - 0 - -0.0281996093690395 - 0.6857458949089050 - 0.4588584005832672 - <_> - - <_> - - - - <_>16 14 3 2 -1. - <_>16 15 3 1 2. - 0 - -1.7781109781935811e-003 - 0.4037851095199585 - 0.5369856953620911 - <_> - - <_> - - - - <_>1 14 3 2 -1. - <_>1 15 3 1 2. - 0 - 3.3177141449414194e-004 - 0.5399798750877380 - 0.3705750107765198 - <_> - - <_> - - - - <_>7 14 6 3 -1. - <_>7 15 6 1 3. - 0 - 2.6385399978607893e-003 - 0.4665437042713165 - 0.6452730894088745 - <_> - - <_> - - - - <_>5 14 8 3 -1. - <_>5 15 8 1 3. - 0 - -2.1183069329708815e-003 - 0.5914781093597412 - 0.4064677059650421 - <_> - - <_> - - - - <_>10 6 4 14 -1. - <_>10 6 2 14 2. - 0 - -0.0147732896730304 - 0.3642038106918335 - 0.5294762849807739 - <_> - - <_> - - - - <_>6 6 4 14 -1. - <_>8 6 2 14 2. - 0 - -0.0168154407292604 - 0.2664231956005096 - 0.5144972801208496 - <_> - - <_> - - - - <_>13 5 2 3 -1. - <_>13 6 2 1 3. - 0 - -6.3370140269398689e-003 - 0.6779531240463257 - 0.4852097928524017 - <_> - - <_> - - - - <_>7 16 6 1 -1. - <_>9 16 2 1 3. - 0 - -4.4560048991115764e-005 - 0.5613964796066284 - 0.4153054058551788 - <_> - - <_> - - - - <_>9 12 3 3 -1. - <_>9 13 3 1 3. - 0 - -1.0240620467811823e-003 - 0.5964478254318237 - 0.4566304087638855 - <_> - - <_> - - - - <_>7 0 3 3 -1. - <_>8 0 1 3 3. - 0 - -2.3161689750850201e-003 - 0.2976115047931671 - 0.5188159942626953 - <_> - - <_> - - - - <_>4 0 16 18 -1. - <_>4 9 16 9 2. - 0 - 0.5321757197380066 - 0.5187839269638062 - 0.2202631980180740 - <_> - - <_> - - - - <_>1 1 16 14 -1. - <_>1 8 16 7 2. - 0 - -0.1664305031299591 - 0.1866022944450378 - 0.5060343146324158 - <_> - - <_> - - - - <_>3 9 15 4 -1. - <_>8 9 5 4 3. - 0 - 0.1125352978706360 - 0.5212125182151794 - 0.1185022965073586 - <_> - - <_> - - - - <_>6 12 7 3 -1. - <_>6 13 7 1 3. - 0 - 9.3046864494681358e-003 - 0.4589937031269074 - 0.6826149225234985 - <_> - - <_> - - - - <_>14 15 2 3 -1. - <_>14 16 2 1 3. - 0 - -4.6255099587142467e-003 - 0.3079940974712372 - 0.5225008726119995 - <_> - - <_> - - - - <_>2 3 16 14 -1. - <_>2 3 8 7 2. - <_>10 10 8 7 2. - 0 - -0.1111646965146065 - 0.2101044058799744 - 0.5080801844596863 - <_> - - <_> - - - - <_>16 2 4 18 -1. - <_>18 2 2 9 2. - <_>16 11 2 9 2. - 0 - -0.0108884396031499 - 0.5765355229377747 - 0.4790464043617249 - <_> - - <_> - - - - <_>4 15 2 3 -1. - <_>4 16 2 1 3. - 0 - 5.8564301580190659e-003 - 0.5065100193023682 - 0.1563598960638046 - <_> - - <_> - - - - <_>16 2 4 18 -1. - <_>18 2 2 9 2. - <_>16 11 2 9 2. - 0 - 0.0548543892800808 - 0.4966914951801300 - 0.7230510711669922 - <_> - - <_> - - - - <_>1 1 8 3 -1. - <_>1 2 8 1 3. - 0 - -0.0111973397433758 - 0.2194979041814804 - 0.5098798274993897 - <_> - - <_> - - - - <_>8 11 4 3 -1. - <_>8 12 4 1 3. - 0 - 4.4069071300327778e-003 - 0.4778401851654053 - 0.6770902872085571 - <_> - - <_> - - - - <_>5 11 5 9 -1. - <_>5 14 5 3 3. - 0 - -0.0636652931571007 - 0.1936362981796265 - 0.5081024169921875 - <_> - - <_> - - - - <_>16 0 4 11 -1. - <_>16 0 2 11 2. - 0 - -9.8081491887569427e-003 - 0.5999063253402710 - 0.4810341000556946 - <_> - - <_> - - - - <_>7 0 6 1 -1. - <_>9 0 2 1 3. - 0 - -2.1717099007219076e-003 - 0.3338333964347839 - 0.5235472917556763 - <_> - - <_> - - - - <_>16 3 3 7 -1. - <_>17 3 1 7 3. - 0 - -0.0133155202493072 - 0.6617069840431213 - 0.4919213056564331 - <_> - - <_> - - - - <_>1 3 3 7 -1. - <_>2 3 1 7 3. - 0 - 2.5442079640924931e-003 - 0.4488744139671326 - 0.6082184910774231 - <_> - - <_> - - - - <_>7 8 6 12 -1. - <_>7 12 6 4 3. - 0 - 0.0120378397405148 - 0.5409392118453980 - 0.3292432129383087 - <_> - - <_> - - - - <_>0 0 4 11 -1. - <_>2 0 2 11 2. - 0 - -0.0207010507583618 - 0.6819120049476624 - 0.4594995975494385 - <_> - - <_> - - - - <_>14 0 6 20 -1. - <_>14 0 3 20 2. - 0 - 0.0276082791388035 - 0.4630792140960693 - 0.5767282843589783 - <_> - - <_> - - - - <_>0 3 1 2 -1. - <_>0 4 1 1 2. - 0 - 1.2370620388537645e-003 - 0.5165379047393799 - 0.2635016143321991 - <_> - - <_> - - - - <_>5 5 10 8 -1. - <_>10 5 5 4 2. - <_>5 9 5 4 2. - 0 - -0.0376693382859230 - 0.2536393105983734 - 0.5278980135917664 - <_> - - <_> - - - - <_>4 7 12 4 -1. - <_>4 7 6 2 2. - <_>10 9 6 2 2. - 0 - -1.8057259730994701e-003 - 0.3985156118869782 - 0.5517500042915344 - 50.6104812622070310 - 10 - -1 - <_> - - - <_> - - <_> - - - - <_>2 1 6 4 -1. - <_>5 1 3 4 2. - 0 - 4.4299028813838959e-003 - 0.2891018092632294 - 0.6335226297378540 - <_> - - <_> - - - - <_>9 7 6 4 -1. - <_>12 7 3 2 2. - <_>9 9 3 2 2. - 0 - -2.3813319858163595e-003 - 0.6211789250373840 - 0.3477487862110138 - <_> - - <_> - - - - <_>5 6 2 6 -1. - <_>5 9 2 3 2. - 0 - 2.2915711160749197e-003 - 0.2254412025213242 - 0.5582118034362793 - <_> - - <_> - - - - <_>9 16 6 4 -1. - <_>12 16 3 2 2. - <_>9 18 3 2 2. - 0 - 9.9457940086722374e-004 - 0.3711710870265961 - 0.5930070877075195 - <_> - - <_> - - - - <_>9 4 2 12 -1. - <_>9 10 2 6 2. - 0 - 7.7164667891338468e-004 - 0.5651720166206360 - 0.3347995877265930 - <_> - - <_> - - - - <_>7 1 6 18 -1. - <_>9 1 2 18 3. - 0 - -1.1386410333216190e-003 - 0.3069126009941101 - 0.5508630871772766 - <_> - - <_> - - - - <_>4 12 12 2 -1. - <_>8 12 4 2 3. - 0 - -1.6403039626311511e-004 - 0.5762827992439270 - 0.3699047863483429 - <_> - - <_> - - - - <_>8 8 6 2 -1. - <_>8 9 6 1 2. - 0 - 2.9793529392918572e-005 - 0.2644244134426117 - 0.5437911152839661 - <_> - - <_> - - - - <_>8 0 3 6 -1. - <_>9 0 1 6 3. - 0 - 8.5774902254343033e-003 - 0.5051138997077942 - 0.1795724928379059 - <_> - - <_> - - - - <_>11 18 3 2 -1. - <_>11 19 3 1 2. - 0 - -2.6032689493149519e-004 - 0.5826969146728516 - 0.4446826875209808 - <_> - - <_> - - - - <_>1 1 17 4 -1. - <_>1 3 17 2 2. - 0 - -6.1404630541801453e-003 - 0.3113852143287659 - 0.5346971750259399 - <_> - - <_> - - - - <_>11 8 4 12 -1. - <_>11 8 2 12 2. - 0 - -0.0230869501829147 - 0.3277946114540100 - 0.5331197977066040 - <_> - - <_> - - - - <_>8 14 4 3 -1. - <_>8 15 4 1 3. - 0 - -0.0142436502501369 - 0.7381709814071655 - 0.4588063061237335 - <_> - - <_> - - - - <_>12 3 2 17 -1. - <_>12 3 1 17 2. - 0 - 0.0194871295243502 - 0.5256630778312683 - 0.2274471968412399 - <_> - - <_> - - - - <_>4 7 6 1 -1. - <_>6 7 2 1 3. - 0 - -9.6681108698248863e-004 - 0.5511230826377869 - 0.3815006911754608 - <_> - - <_> - - - - <_>18 3 2 3 -1. - <_>18 4 2 1 3. - 0 - 3.1474709976464510e-003 - 0.5425636768341065 - 0.2543726861476898 - <_> - - <_> - - - - <_>8 4 3 4 -1. - <_>8 6 3 2 2. - 0 - -1.8026070029009134e-004 - 0.5380191802978516 - 0.3406304121017456 - <_> - - <_> - - - - <_>4 5 12 10 -1. - <_>4 10 12 5 2. - 0 - -6.0266260989010334e-003 - 0.3035801947116852 - 0.5420572161674500 - <_> - - <_> - - - - <_>5 18 4 2 -1. - <_>7 18 2 2 2. - 0 - 4.4462960795499384e-004 - 0.3990997076034546 - 0.5660110116004944 - <_> - - <_> - - - - <_>17 2 3 6 -1. - <_>17 4 3 2 3. - 0 - 2.2609760053455830e-003 - 0.5562806725502014 - 0.3940688073635101 - <_> - - <_> - - - - <_>7 7 6 6 -1. - <_>9 7 2 6 3. - 0 - 0.0511330589652061 - 0.4609653949737549 - 0.7118561863899231 - <_> - - <_> - - - - <_>17 2 3 6 -1. - <_>17 4 3 2 3. - 0 - -0.0177863091230392 - 0.2316166013479233 - 0.5322144031524658 - <_> - - <_> - - - - <_>8 0 3 4 -1. - <_>9 0 1 4 3. - 0 - -4.9679628573358059e-003 - 0.2330771982669830 - 0.5122029185295105 - <_> - - <_> - - - - <_>9 14 2 3 -1. - <_>9 15 2 1 3. - 0 - 2.0667689386755228e-003 - 0.4657444059848785 - 0.6455488204956055 - <_> - - <_> - - - - <_>0 12 6 3 -1. - <_>0 13 6 1 3. - 0 - 7.4413768015801907e-003 - 0.5154392123222351 - 0.2361633926630020 - <_> - - <_> - - - - <_>8 14 4 3 -1. - <_>8 15 4 1 3. - 0 - -3.6277279723435640e-003 - 0.6219773292541504 - 0.4476661086082459 - <_> - - <_> - - - - <_>3 12 2 3 -1. - <_>3 13 2 1 3. - 0 - -5.3530759178102016e-003 - 0.1837355047464371 - 0.5102208256721497 - <_> - - <_> - - - - <_>5 6 12 7 -1. - <_>9 6 4 7 3. - 0 - 0.1453091949224472 - 0.5145987272262573 - 0.1535930931568146 - <_> - - <_> - - - - <_>0 2 3 6 -1. - <_>0 4 3 2 3. - 0 - 2.4394490756094456e-003 - 0.5343660116195679 - 0.3624661862850189 - <_> - - <_> - - - - <_>14 6 1 3 -1. - <_>14 7 1 1 3. - 0 - -3.1283390708267689e-003 - 0.6215007901191711 - 0.4845592081546783 - <_> - - <_> - - - - <_>2 0 3 14 -1. - <_>3 0 1 14 3. - 0 - 1.7940260004252195e-003 - 0.4299261868000031 - 0.5824198126792908 - <_> - - <_> - - - - <_>12 14 5 6 -1. - <_>12 16 5 2 3. - 0 - 0.0362538211047649 - 0.5260334014892578 - 0.1439467966556549 - <_> - - <_> - - - - <_>4 14 5 6 -1. - <_>4 16 5 2 3. - 0 - -5.1746722310781479e-003 - 0.3506538867950440 - 0.5287045240402222 - <_> - - <_> - - - - <_>11 10 2 2 -1. - <_>12 10 1 1 2. - <_>11 11 1 1 2. - 0 - 6.5383297624066472e-004 - 0.4809640944004059 - 0.6122040152549744 - <_> - - <_> - - - - <_>5 0 3 14 -1. - <_>6 0 1 14 3. - 0 - -0.0264802295714617 - 0.1139362007379532 - 0.5045586228370667 - <_> - - <_> - - - - <_>10 15 2 3 -1. - <_>10 16 2 1 3. - 0 - -3.0440660193562508e-003 - 0.6352095007896423 - 0.4794734120368958 - <_> - - <_> - - - - <_>0 2 2 3 -1. - <_>0 3 2 1 3. - 0 - 3.6993520334362984e-003 - 0.5131118297576904 - 0.2498510926961899 - <_> - - <_> - - - - <_>5 11 12 6 -1. - <_>5 14 12 3 2. - 0 - -3.6762931267730892e-004 - 0.5421394705772400 - 0.3709532022476196 - <_> - - <_> - - - - <_>6 11 3 9 -1. - <_>6 14 3 3 3. - 0 - -0.0413822606205940 - 0.1894959956407547 - 0.5081691741943359 - <_> - - <_> - - - - <_>11 10 2 2 -1. - <_>12 10 1 1 2. - <_>11 11 1 1 2. - 0 - -1.0532729793339968e-003 - 0.6454367041587830 - 0.4783608913421631 - <_> - - <_> - - - - <_>5 6 1 3 -1. - <_>5 7 1 1 3. - 0 - -2.1648600231856108e-003 - 0.6215031147003174 - 0.4499826133251190 - <_> - - <_> - - - - <_>4 9 13 3 -1. - <_>4 10 13 1 3. - 0 - -5.6747748749330640e-004 - 0.3712610900402069 - 0.5419334769248962 - <_> - - <_> - - - - <_>1 7 15 6 -1. - <_>6 7 5 6 3. - 0 - 0.1737584024667740 - 0.5023643970489502 - 0.1215742006897926 - <_> - - <_> - - - - <_>4 5 12 6 -1. - <_>8 5 4 6 3. - 0 - -2.9049699660390615e-003 - 0.3240267932415009 - 0.5381883978843689 - <_> - - <_> - - - - <_>8 10 4 3 -1. - <_>8 11 4 1 3. - 0 - 1.2299539521336555e-003 - 0.4165507853031158 - 0.5703486204147339 - <_> - - <_> - - - - <_>15 14 1 3 -1. - <_>15 15 1 1 3. - 0 - -5.4329237900674343e-004 - 0.3854042887687683 - 0.5547549128532410 - <_> - - <_> - - - - <_>1 11 5 3 -1. - <_>1 12 5 1 3. - 0 - -8.3297258242964745e-003 - 0.2204494029283524 - 0.5097082853317261 - <_> - - <_> - - - - <_>7 1 7 12 -1. - <_>7 7 7 6 2. - 0 - -1.0417630255687982e-004 - 0.5607066154479981 - 0.4303036034107208 - <_> - - <_> - - - - <_>0 1 6 10 -1. - <_>0 1 3 5 2. - <_>3 6 3 5 2. - 0 - 0.0312047004699707 - 0.4621657133102417 - 0.6982004046440125 - <_> - - <_> - - - - <_>16 1 4 3 -1. - <_>16 2 4 1 3. - 0 - 7.8943502157926559e-003 - 0.5269594192504883 - 0.2269068062305450 - <_> - - <_> - - - - <_>5 5 2 3 -1. - <_>5 6 2 1 3. - 0 - -4.3645310215651989e-003 - 0.6359223127365112 - 0.4537956118583679 - <_> - - <_> - - - - <_>12 2 3 5 -1. - <_>13 2 1 5 3. - 0 - 7.6793059706687927e-003 - 0.5274767875671387 - 0.2740483880043030 - <_> - - <_> - - - - <_>0 3 4 6 -1. - <_>0 5 4 2 3. - 0 - -0.0254311393946409 - 0.2038519978523254 - 0.5071732997894287 - <_> - - <_> - - - - <_>8 12 4 2 -1. - <_>8 13 4 1 2. - 0 - 8.2000601105391979e-004 - 0.4587455093860626 - 0.6119868159294128 - <_> - - <_> - - - - <_>8 18 3 1 -1. - <_>9 18 1 1 3. - 0 - 2.9284600168466568e-003 - 0.5071274042129517 - 0.2028204947710037 - <_> - - <_> - - - - <_>11 10 2 2 -1. - <_>12 10 1 1 2. - <_>11 11 1 1 2. - 0 - 4.5256470912136137e-005 - 0.4812104105949402 - 0.5430821776390076 - <_> - - <_> - - - - <_>7 10 2 2 -1. - <_>7 10 1 1 2. - <_>8 11 1 1 2. - 0 - 1.3158309739083052e-003 - 0.4625813961029053 - 0.6779323220252991 - <_> - - <_> - - - - <_>11 11 4 4 -1. - <_>11 13 4 2 2. - 0 - 1.5870389761403203e-003 - 0.5386291742324829 - 0.3431465029716492 - <_> - - <_> - - - - <_>8 12 3 8 -1. - <_>9 12 1 8 3. - 0 - -0.0215396601706743 - 0.0259425006806850 - 0.5003222823143005 - <_> - - <_> - - - - <_>13 0 6 3 -1. - <_>13 1 6 1 3. - 0 - 0.0143344802781940 - 0.5202844738960266 - 0.1590632945299149 - <_> - - <_> - - - - <_>8 8 3 4 -1. - <_>9 8 1 4 3. - 0 - -8.3881383761763573e-003 - 0.7282481193542481 - 0.4648044109344482 - <_> - - <_> - - - - <_>5 7 10 10 -1. - <_>10 7 5 5 2. - <_>5 12 5 5 2. - 0 - 9.1906841844320297e-003 - 0.5562356710433960 - 0.3923191130161285 - <_> - - <_> - - - - <_>3 18 8 2 -1. - <_>3 18 4 1 2. - <_>7 19 4 1 2. - 0 - -5.8453059755265713e-003 - 0.6803392767906189 - 0.4629127979278565 - <_> - - <_> - - - - <_>10 2 6 8 -1. - <_>12 2 2 8 3. - 0 - -0.0547077991068363 - 0.2561671137809753 - 0.5206125974655151 - <_> - - <_> - - - - <_>4 2 6 8 -1. - <_>6 2 2 8 3. - 0 - 9.1142775490880013e-003 - 0.5189620256423950 - 0.3053877055644989 - <_> - - <_> - - - - <_>11 0 3 7 -1. - <_>12 0 1 7 3. - 0 - -0.0155750000849366 - 0.1295074969530106 - 0.5169094800949097 - <_> - - <_> - - - - <_>7 11 2 1 -1. - <_>8 11 1 1 2. - 0 - -1.2050600344082341e-004 - 0.5735098123550415 - 0.4230825006961823 - <_> - - <_> - - - - <_>15 14 1 3 -1. - <_>15 15 1 1 3. - 0 - 1.2273970060050488e-003 - 0.5289878249168396 - 0.4079791903495789 - <_> - - <_> - - - - <_>7 15 2 2 -1. - <_>7 15 1 1 2. - <_>8 16 1 1 2. - 0 - -1.2186600361019373e-003 - 0.6575639843940735 - 0.4574409127235413 - <_> - - <_> - - - - <_>15 14 1 3 -1. - <_>15 15 1 1 3. - 0 - -3.3256649039685726e-003 - 0.3628047108650208 - 0.5195019841194153 - <_> - - <_> - - - - <_>6 0 3 7 -1. - <_>7 0 1 7 3. - 0 - -0.0132883097976446 - 0.1284265965223312 - 0.5043488740921021 - <_> - - <_> - - - - <_>18 1 2 7 -1. - <_>18 1 1 7 2. - 0 - -3.3839771058410406e-003 - 0.6292240023612976 - 0.4757505953311920 - <_> - - <_> - - - - <_>2 0 8 20 -1. - <_>2 10 8 10 2. - 0 - -0.2195422053337097 - 0.1487731933593750 - 0.5065013766288757 - <_> - - <_> - - - - <_>3 0 15 6 -1. - <_>3 2 15 2 3. - 0 - 4.9111708067357540e-003 - 0.4256102144718170 - 0.5665838718414307 - <_> - - <_> - - - - <_>4 3 12 2 -1. - <_>4 4 12 1 2. - 0 - -1.8744950648397207e-004 - 0.4004144072532654 - 0.5586857199668884 - <_> - - <_> - - - - <_>16 0 4 5 -1. - <_>16 0 2 5 2. - 0 - -5.2178641781210899e-003 - 0.6009116172790527 - 0.4812706112861633 - <_> - - <_> - - - - <_>7 0 3 4 -1. - <_>8 0 1 4 3. - 0 - -1.1111519997939467e-003 - 0.3514933884143829 - 0.5287089943885803 - <_> - - <_> - - - - <_>16 0 4 5 -1. - <_>16 0 2 5 2. - 0 - 4.4036400504410267e-003 - 0.4642275869846344 - 0.5924085974693298 - <_> - - <_> - - - - <_>1 7 6 13 -1. - <_>3 7 2 13 3. - 0 - 0.1229949966073036 - 0.5025529265403748 - 0.0691524818539619 - <_> - - <_> - - - - <_>16 0 4 5 -1. - <_>16 0 2 5 2. - 0 - -0.0123135102912784 - 0.5884591937065125 - 0.4934012889862061 - <_> - - <_> - - - - <_>0 0 4 5 -1. - <_>2 0 2 5 2. - 0 - 4.1471039876341820e-003 - 0.4372239112854004 - 0.5893477797508240 - <_> - - <_> - - - - <_>14 12 3 6 -1. - <_>14 14 3 2 3. - 0 - -3.5502649843692780e-003 - 0.4327551126480103 - 0.5396270155906677 - <_> - - <_> - - - - <_>3 12 3 6 -1. - <_>3 14 3 2 3. - 0 - -0.0192242693156004 - 0.1913134008646011 - 0.5068330764770508 - <_> - - <_> - - - - <_>16 1 4 3 -1. - <_>16 2 4 1 3. - 0 - 1.4395059552043676e-003 - 0.5308178067207336 - 0.4243533015251160 - <_> - - <_> - - - - <_>8 7 2 10 -1. - <_>8 7 1 5 2. - <_>9 12 1 5 2. - 0 - -6.7751999013125896e-003 - 0.6365395784378052 - 0.4540086090564728 - <_> - - <_> - - - - <_>11 11 4 4 -1. - <_>11 13 4 2 2. - 0 - 7.0119630545377731e-003 - 0.5189834237098694 - 0.3026199936866760 - <_> - - <_> - - - - <_>0 1 4 3 -1. - <_>0 2 4 1 3. - 0 - 5.4014651104807854e-003 - 0.5105062127113342 - 0.2557682991027832 - <_> - - <_> - - - - <_>13 4 1 3 -1. - <_>13 5 1 1 3. - 0 - 9.0274988906458020e-004 - 0.4696914851665497 - 0.5861827731132507 - <_> - - <_> - - - - <_>7 15 3 5 -1. - <_>8 15 1 5 3. - 0 - 0.0114744501188397 - 0.5053645968437195 - 0.1527177989482880 - <_> - - <_> - - - - <_>9 7 3 5 -1. - <_>10 7 1 5 3. - 0 - -6.7023430019617081e-003 - 0.6508980989456177 - 0.4890604019165039 - <_> - - <_> - - - - <_>8 7 3 5 -1. - <_>9 7 1 5 3. - 0 - -2.0462959073483944e-003 - 0.6241816878318787 - 0.4514600038528442 - <_> - - <_> - - - - <_>10 6 4 14 -1. - <_>10 6 2 14 2. - 0 - -9.9951568990945816e-003 - 0.3432781100273132 - 0.5400953888893127 - <_> - - <_> - - - - <_>0 5 5 6 -1. - <_>0 7 5 2 3. - 0 - -0.0357007086277008 - 0.1878059059381485 - 0.5074077844619751 - <_> - - <_> - - - - <_>9 5 6 4 -1. - <_>9 5 3 4 2. - 0 - 4.5584561303257942e-004 - 0.3805277049541473 - 0.5402569770812988 - <_> - - <_> - - - - <_>0 0 18 10 -1. - <_>6 0 6 10 3. - 0 - -0.0542606003582478 - 0.6843714714050293 - 0.4595097005367279 - <_> - - <_> - - - - <_>10 6 4 14 -1. - <_>10 6 2 14 2. - 0 - 6.0600461438298225e-003 - 0.5502905249595642 - 0.4500527977943420 - <_> - - <_> - - - - <_>6 6 4 14 -1. - <_>8 6 2 14 2. - 0 - -6.4791832119226456e-003 - 0.3368858098983765 - 0.5310757160186768 - <_> - - <_> - - - - <_>13 4 1 3 -1. - <_>13 5 1 1 3. - 0 - -1.4939469983801246e-003 - 0.6487640142440796 - 0.4756175875663757 - <_> - - <_> - - - - <_>5 1 2 3 -1. - <_>6 1 1 3 2. - 0 - 1.4610530342906713e-005 - 0.4034579098224640 - 0.5451064109802246 - <_> - - <_> - - - - <_>18 1 2 18 -1. - <_>19 1 1 9 2. - <_>18 10 1 9 2. - 0 - -7.2321938350796700e-003 - 0.6386873722076416 - 0.4824739992618561 - <_> - - <_> - - - - <_>2 1 4 3 -1. - <_>2 2 4 1 3. - 0 - -4.0645818226039410e-003 - 0.2986421883106232 - 0.5157335996627808 - <_> - - <_> - - - - <_>18 1 2 18 -1. - <_>19 1 1 9 2. - <_>18 10 1 9 2. - 0 - 0.0304630808532238 - 0.5022199749946594 - 0.7159956097602844 - <_> - - <_> - - - - <_>1 14 4 6 -1. - <_>1 14 2 3 2. - <_>3 17 2 3 2. - 0 - -8.0544911324977875e-003 - 0.6492452025413513 - 0.4619275033473969 - <_> - - <_> - - - - <_>10 11 7 6 -1. - <_>10 13 7 2 3. - 0 - 0.0395051389932632 - 0.5150570869445801 - 0.2450613975524902 - <_> - - <_> - - - - <_>0 10 6 10 -1. - <_>0 10 3 5 2. - <_>3 15 3 5 2. - 0 - 8.4530208259820938e-003 - 0.4573669135570526 - 0.6394037008285523 - <_> - - <_> - - - - <_>11 0 3 4 -1. - <_>12 0 1 4 3. - 0 - -1.1688120430335402e-003 - 0.3865512013435364 - 0.5483661293983460 - <_> - - <_> - - - - <_>5 10 5 6 -1. - <_>5 13 5 3 2. - 0 - 2.8070670086890459e-003 - 0.5128579139709473 - 0.2701480090618134 - <_> - - <_> - - - - <_>14 6 1 8 -1. - <_>14 10 1 4 2. - 0 - 4.7365209320560098e-004 - 0.4051581919193268 - 0.5387461185455322 - <_> - - <_> - - - - <_>1 7 18 6 -1. - <_>1 7 9 3 2. - <_>10 10 9 3 2. - 0 - 0.0117410803213716 - 0.5295950174331665 - 0.3719413876533508 - <_> - - <_> - - - - <_>9 7 2 2 -1. - <_>9 7 1 2 2. - 0 - 3.1833238899707794e-003 - 0.4789406955242157 - 0.6895126104354858 - <_> - - <_> - - - - <_>5 9 4 5 -1. - <_>7 9 2 5 2. - 0 - 7.0241501089185476e-004 - 0.5384489297866821 - 0.3918080925941467 - 54.6200714111328130 - 11 - -1 - <_> - - - <_> - - <_> - - - - <_>7 6 6 3 -1. - <_>9 6 2 3 3. - 0 - 0.0170599296689034 - 0.3948527872562408 - 0.7142534852027893 - <_> - - <_> - - - - <_>1 0 18 4 -1. - <_>7 0 6 4 3. - 0 - 0.0218408405780792 - 0.3370316028594971 - 0.6090016961097717 - <_> - - <_> - - - - <_>7 15 2 4 -1. - <_>7 17 2 2 2. - 0 - 2.4520049919374287e-004 - 0.3500576019287109 - 0.5987902283668518 - <_> - - <_> - - - - <_>1 0 19 9 -1. - <_>1 3 19 3 3. - 0 - 8.3272606134414673e-003 - 0.3267528116703033 - 0.5697240829467773 - <_> - - <_> - - - - <_>3 7 3 6 -1. - <_>3 9 3 2 3. - 0 - 5.7148298947140574e-004 - 0.3044599890708923 - 0.5531656742095947 - <_> - - <_> - - - - <_>13 7 4 4 -1. - <_>15 7 2 2 2. - <_>13 9 2 2 2. - 0 - 6.7373987985774875e-004 - 0.3650012016296387 - 0.5672631263732910 - <_> - - <_> - - - - <_>3 7 4 4 -1. - <_>3 7 2 2 2. - <_>5 9 2 2 2. - 0 - 3.4681590477703139e-005 - 0.3313541114330292 - 0.5388727188110352 - <_> - - <_> - - - - <_>9 6 10 8 -1. - <_>9 10 10 4 2. - 0 - -5.8563398197293282e-003 - 0.2697942852973938 - 0.5498778820037842 - <_> - - <_> - - - - <_>3 8 14 12 -1. - <_>3 14 14 6 2. - 0 - 8.5102273151278496e-003 - 0.5269358158111572 - 0.2762879133224487 - <_> - - <_> - - - - <_>6 5 10 12 -1. - <_>11 5 5 6 2. - <_>6 11 5 6 2. - 0 - -0.0698172077536583 - 0.2909603118896484 - 0.5259246826171875 - <_> - - <_> - - - - <_>9 11 2 3 -1. - <_>9 12 2 1 3. - 0 - -8.6113670840859413e-004 - 0.5892577171325684 - 0.4073697924613953 - <_> - - <_> - - - - <_>9 5 6 5 -1. - <_>9 5 3 5 2. - 0 - 9.7149249631911516e-004 - 0.3523564040660858 - 0.5415862202644348 - <_> - - <_> - - - - <_>9 4 2 4 -1. - <_>9 6 2 2 2. - 0 - -1.4727490452060010e-005 - 0.5423017740249634 - 0.3503156006336212 - <_> - - <_> - - - - <_>9 5 6 5 -1. - <_>9 5 3 5 2. - 0 - 0.0484202913939953 - 0.5193945765495300 - 0.3411195874214172 - <_> - - <_> - - - - <_>5 5 6 5 -1. - <_>8 5 3 5 2. - 0 - 1.3257140526548028e-003 - 0.3157769143581390 - 0.5335376262664795 - <_> - - <_> - - - - <_>11 2 6 1 -1. - <_>13 2 2 1 3. - 0 - 1.4922149603080470e-005 - 0.4451299905776978 - 0.5536553859710693 - <_> - - <_> - - - - <_>3 2 6 1 -1. - <_>5 2 2 1 3. - 0 - -2.7173398993909359e-003 - 0.3031741976737976 - 0.5248088836669922 - <_> - - <_> - - - - <_>13 5 2 3 -1. - <_>13 6 2 1 3. - 0 - 2.9219500720500946e-003 - 0.4781453013420105 - 0.6606041789054871 - <_> - - <_> - - - - <_>0 10 1 4 -1. - <_>0 12 1 2 2. - 0 - -1.9804988987743855e-003 - 0.3186308145523071 - 0.5287625193595886 - <_> - - <_> - - - - <_>13 5 2 3 -1. - <_>13 6 2 1 3. - 0 - -4.0012109093368053e-003 - 0.6413596868515015 - 0.4749928116798401 - <_> - - <_> - - - - <_>8 18 3 2 -1. - <_>9 18 1 2 3. - 0 - -4.3491991236805916e-003 - 0.1507498025894165 - 0.5098996758460999 - <_> - - <_> - - - - <_>6 15 9 2 -1. - <_>6 16 9 1 2. - 0 - 1.3490889687091112e-003 - 0.4316158890724182 - 0.5881167054176331 - <_> - - <_> - - - - <_>8 14 4 3 -1. - <_>8 15 4 1 3. - 0 - 0.0185970701277256 - 0.4735553860664368 - 0.9089794158935547 - <_> - - <_> - - - - <_>18 4 2 4 -1. - <_>18 6 2 2 2. - 0 - -1.8562379991635680e-003 - 0.3553189039230347 - 0.5577837228775024 - <_> - - <_> - - - - <_>5 5 2 3 -1. - <_>5 6 2 1 3. - 0 - 2.2940430790185928e-003 - 0.4500094950199127 - 0.6580877900123596 - <_> - - <_> - - - - <_>15 16 3 2 -1. - <_>15 17 3 1 2. - 0 - 2.9982850537635386e-004 - 0.5629242062568665 - 0.3975878953933716 - <_> - - <_> - - - - <_>0 0 3 9 -1. - <_>0 3 3 3 3. - 0 - 3.5455459728837013e-003 - 0.5381547212600708 - 0.3605485856533051 - <_> - - <_> - - - - <_>9 7 3 3 -1. - <_>9 8 3 1 3. - 0 - 9.6104722470045090e-003 - 0.5255997180938721 - 0.1796745955944061 - <_> - - <_> - - - - <_>8 7 3 3 -1. - <_>8 8 3 1 3. - 0 - -6.2783220782876015e-003 - 0.2272856980562210 - 0.5114030241966248 - <_> - - <_> - - - - <_>9 5 2 6 -1. - <_>9 5 1 6 2. - 0 - 3.4598479978740215e-003 - 0.4626308083534241 - 0.6608219146728516 - <_> - - <_> - - - - <_>8 6 3 4 -1. - <_>9 6 1 4 3. - 0 - -1.3112019514665008e-003 - 0.6317539811134338 - 0.4436857998371124 - <_> - - <_> - - - - <_>7 6 8 12 -1. - <_>11 6 4 6 2. - <_>7 12 4 6 2. - 0 - 2.6876179035753012e-003 - 0.5421109795570374 - 0.4054022133350372 - <_> - - <_> - - - - <_>5 6 8 12 -1. - <_>5 6 4 6 2. - <_>9 12 4 6 2. - 0 - 3.9118169806897640e-003 - 0.5358477830886841 - 0.3273454904556274 - <_> - - <_> - - - - <_>12 4 3 3 -1. - <_>12 5 3 1 3. - 0 - -0.0142064504325390 - 0.7793576717376709 - 0.4975781142711639 - <_> - - <_> - - - - <_>2 16 3 2 -1. - <_>2 17 3 1 2. - 0 - 7.1705528534948826e-004 - 0.5297319889068604 - 0.3560903966426849 - <_> - - <_> - - - - <_>12 4 3 3 -1. - <_>12 5 3 1 3. - 0 - 1.6635019565001130e-003 - 0.4678094089031220 - 0.5816481709480286 - <_> - - <_> - - - - <_>2 12 6 6 -1. - <_>2 14 6 2 3. - 0 - 3.3686188980937004e-003 - 0.5276734232902527 - 0.3446420133113861 - <_> - - <_> - - - - <_>7 13 6 3 -1. - <_>7 14 6 1 3. - 0 - 0.0127995302900672 - 0.4834679961204529 - 0.7472159266471863 - <_> - - <_> - - - - <_>6 14 6 3 -1. - <_>6 15 6 1 3. - 0 - 3.3901201095432043e-003 - 0.4511859118938446 - 0.6401721239089966 - <_> - - <_> - - - - <_>14 15 5 3 -1. - <_>14 16 5 1 3. - 0 - 4.7070779837667942e-003 - 0.5335658788681030 - 0.3555220961570740 - <_> - - <_> - - - - <_>5 4 3 3 -1. - <_>5 5 3 1 3. - 0 - 1.4819339849054813e-003 - 0.4250707030296326 - 0.5772724151611328 - <_> - - <_> - - - - <_>14 15 5 3 -1. - <_>14 16 5 1 3. - 0 - -6.9995759986341000e-003 - 0.3003320097923279 - 0.5292900204658508 - <_> - - <_> - - - - <_>5 3 6 2 -1. - <_>7 3 2 2 3. - 0 - 0.0159390103071928 - 0.5067319273948669 - 0.1675581932067871 - <_> - - <_> - - - - <_>8 15 4 3 -1. - <_>8 16 4 1 3. - 0 - 7.6377349905669689e-003 - 0.4795069992542267 - 0.7085601091384888 - <_> - - <_> - - - - <_>1 15 5 3 -1. - <_>1 16 5 1 3. - 0 - 6.7334040068089962e-003 - 0.5133113265037537 - 0.2162470072507858 - <_> - - <_> - - - - <_>8 13 4 6 -1. - <_>10 13 2 3 2. - <_>8 16 2 3 2. - 0 - -0.0128588099032640 - 0.1938841938972473 - 0.5251371860504150 - <_> - - <_> - - - - <_>7 8 3 3 -1. - <_>8 8 1 3 3. - 0 - -6.2270800117403269e-004 - 0.5686538219451904 - 0.4197868108749390 - <_> - - <_> - - - - <_>12 0 5 4 -1. - <_>12 2 5 2 2. - 0 - -5.2651681471616030e-004 - 0.4224168956279755 - 0.5429695844650269 - <_> - - <_> - - - - <_>0 2 20 2 -1. - <_>0 2 10 1 2. - <_>10 3 10 1 2. - 0 - 0.0110750999301672 - 0.5113775134086609 - 0.2514517903327942 - <_> - - <_> - - - - <_>1 0 18 4 -1. - <_>7 0 6 4 3. - 0 - -0.0367282517254353 - 0.7194662094116211 - 0.4849618971347809 - <_> - - <_> - - - - <_>4 3 6 1 -1. - <_>6 3 2 1 3. - 0 - -2.8207109426148236e-004 - 0.3840261995792389 - 0.5394446253776550 - <_> - - <_> - - - - <_>4 18 13 2 -1. - <_>4 19 13 1 2. - 0 - -2.7489690110087395e-003 - 0.5937088727951050 - 0.4569182097911835 - <_> - - <_> - - - - <_>2 10 3 6 -1. - <_>2 12 3 2 3. - 0 - 0.0100475195795298 - 0.5138576030731201 - 0.2802298069000244 - <_> - - <_> - - - - <_>14 12 6 8 -1. - <_>17 12 3 4 2. - <_>14 16 3 4 2. - 0 - -8.1497840583324432e-003 - 0.6090037226676941 - 0.4636121094226837 - <_> - - <_> - - - - <_>4 13 10 6 -1. - <_>4 13 5 3 2. - <_>9 16 5 3 2. - 0 - -6.8833888508379459e-003 - 0.3458611071109772 - 0.5254660248756409 - <_> - - <_> - - - - <_>14 12 1 2 -1. - <_>14 13 1 1 2. - 0 - -1.4039360394235700e-005 - 0.5693104267120361 - 0.4082083106040955 - <_> - - <_> - - - - <_>8 13 4 3 -1. - <_>8 14 4 1 3. - 0 - 1.5498419525101781e-003 - 0.4350537061691284 - 0.5806517004966736 - <_> - - <_> - - - - <_>14 12 2 2 -1. - <_>14 13 2 1 2. - 0 - -6.7841499112546444e-003 - 0.1468873023986816 - 0.5182775259017944 - <_> - - <_> - - - - <_>4 12 2 2 -1. - <_>4 13 2 1 2. - 0 - 2.1705629478674382e-004 - 0.5293524265289307 - 0.3456174135208130 - <_> - - <_> - - - - <_>8 12 9 2 -1. - <_>8 13 9 1 2. - 0 - 3.1198898795992136e-004 - 0.4652450978755951 - 0.5942413806915283 - <_> - - <_> - - - - <_>9 14 2 3 -1. - <_>9 15 2 1 3. - 0 - 5.4507530294358730e-003 - 0.4653508961200714 - 0.7024846076965332 - <_> - - <_> - - - - <_>11 10 3 6 -1. - <_>11 13 3 3 2. - 0 - -2.5818689027801156e-004 - 0.5497295260429382 - 0.3768967092037201 - <_> - - <_> - - - - <_>5 6 9 12 -1. - <_>5 12 9 6 2. - 0 - -0.0174425393342972 - 0.3919087946414948 - 0.5457497835159302 - <_> - - <_> - - - - <_>11 10 3 6 -1. - <_>11 13 3 3 2. - 0 - -0.0453435294330120 - 0.1631357073783875 - 0.5154908895492554 - <_> - - <_> - - - - <_>6 10 3 6 -1. - <_>6 13 3 3 2. - 0 - 1.9190689781680703e-003 - 0.5145897865295410 - 0.2791895866394043 - <_> - - <_> - - - - <_>5 4 11 3 -1. - <_>5 5 11 1 3. - 0 - -6.0177869163453579e-003 - 0.6517636179924011 - 0.4756332933902741 - <_> - - <_> - - - - <_>7 1 5 10 -1. - <_>7 6 5 5 2. - 0 - -4.0720738470554352e-003 - 0.5514652729034424 - 0.4092685878276825 - <_> - - <_> - - - - <_>2 8 18 2 -1. - <_>2 9 18 1 2. - 0 - 3.9855059003457427e-004 - 0.3165240883827210 - 0.5285550951957703 - <_> - - <_> - - - - <_>7 17 5 3 -1. - <_>7 18 5 1 3. - 0 - -6.5418570302426815e-003 - 0.6853377819061279 - 0.4652808904647827 - <_> - - <_> - - - - <_>5 9 12 1 -1. - <_>9 9 4 1 3. - 0 - 3.4845089539885521e-003 - 0.5484588146209717 - 0.4502759873867035 - <_> - - <_> - - - - <_>0 14 6 6 -1. - <_>0 14 3 3 2. - <_>3 17 3 3 2. - 0 - -0.0136967804282904 - 0.6395779848098755 - 0.4572555124759674 - <_> - - <_> - - - - <_>5 9 12 1 -1. - <_>9 9 4 1 3. - 0 - -0.0173471402376890 - 0.2751072943210602 - 0.5181614756584168 - <_> - - <_> - - - - <_>3 9 12 1 -1. - <_>7 9 4 1 3. - 0 - -4.0885428898036480e-003 - 0.3325636088848114 - 0.5194984078407288 - <_> - - <_> - - - - <_>14 10 6 7 -1. - <_>14 10 3 7 2. - 0 - -9.4687901437282562e-003 - 0.5942280888557434 - 0.4851819872856140 - <_> - - <_> - - - - <_>1 0 16 2 -1. - <_>1 1 16 1 2. - 0 - 1.7084840219467878e-003 - 0.4167110919952393 - 0.5519806146621704 - <_> - - <_> - - - - <_>10 9 10 9 -1. - <_>10 12 10 3 3. - 0 - 9.4809094443917274e-003 - 0.5433894991874695 - 0.4208514988422394 - <_> - - <_> - - - - <_>0 1 10 2 -1. - <_>5 1 5 2 2. - 0 - -4.7389650717377663e-003 - 0.6407189965248108 - 0.4560655057430267 - <_> - - <_> - - - - <_>17 3 2 3 -1. - <_>17 4 2 1 3. - 0 - 6.5761050209403038e-003 - 0.5214555263519287 - 0.2258227020502091 - <_> - - <_> - - - - <_>1 3 2 3 -1. - <_>1 4 2 1 3. - 0 - -2.1690549328923225e-003 - 0.3151527941226959 - 0.5156704783439636 - <_> - - <_> - - - - <_>9 7 3 6 -1. - <_>10 7 1 6 3. - 0 - 0.0146601703017950 - 0.4870837032794952 - 0.6689941287040710 - <_> - - <_> - - - - <_>6 5 4 3 -1. - <_>8 5 2 3 2. - 0 - 1.7231999663636088e-004 - 0.3569748997688294 - 0.5251078009605408 - <_> - - <_> - - - - <_>7 5 6 6 -1. - <_>9 5 2 6 3. - 0 - -0.0218037609010935 - 0.8825920820236206 - 0.4966329932212830 - <_> - - <_> - - - - <_>3 4 12 12 -1. - <_>3 4 6 6 2. - <_>9 10 6 6 2. - 0 - -0.0947361066937447 - 0.1446162015199661 - 0.5061113834381104 - <_> - - <_> - - - - <_>9 2 6 15 -1. - <_>11 2 2 15 3. - 0 - 5.5825551971793175e-003 - 0.5396478772163391 - 0.4238066077232361 - <_> - - <_> - - - - <_>2 2 6 17 -1. - <_>4 2 2 17 3. - 0 - 1.9517090404406190e-003 - 0.4170410931110382 - 0.5497786998748779 - <_> - - <_> - - - - <_>14 10 6 7 -1. - <_>14 10 3 7 2. - 0 - 0.0121499001979828 - 0.4698367118835449 - 0.5664274096488953 - <_> - - <_> - - - - <_>0 10 6 7 -1. - <_>3 10 3 7 2. - 0 - -7.5169620104134083e-003 - 0.6267772912979126 - 0.4463135898113251 - <_> - - <_> - - - - <_>9 2 6 15 -1. - <_>11 2 2 15 3. - 0 - -0.0716679096221924 - 0.3097011148929596 - 0.5221003293991089 - <_> - - <_> - - - - <_>5 2 6 15 -1. - <_>7 2 2 15 3. - 0 - -0.0882924199104309 - 0.0811238884925842 - 0.5006365180015564 - <_> - - <_> - - - - <_>17 9 3 6 -1. - <_>17 11 3 2 3. - 0 - 0.0310630798339844 - 0.5155503749847412 - 0.1282255947589874 - <_> - - <_> - - - - <_>6 7 6 6 -1. - <_>8 7 2 6 3. - 0 - 0.0466218404471874 - 0.4699777960777283 - 0.7363960742950440 - <_> - - <_> - - - - <_>1 10 18 6 -1. - <_>10 10 9 3 2. - <_>1 13 9 3 2. - 0 - -0.0121894897893071 - 0.3920530080795288 - 0.5518996715545654 - <_> - - <_> - - - - <_>0 9 10 9 -1. - <_>0 12 10 3 3. - 0 - 0.0130161102861166 - 0.5260658264160156 - 0.3685136139392853 - <_> - - <_> - - - - <_>8 15 4 3 -1. - <_>8 16 4 1 3. - 0 - -3.4952899441123009e-003 - 0.6339294910430908 - 0.4716280996799469 - <_> - - <_> - - - - <_>5 12 3 4 -1. - <_>5 14 3 2 2. - 0 - -4.4015039748046547e-005 - 0.5333027243614197 - 0.3776184916496277 - <_> - - <_> - - - - <_>3 3 16 12 -1. - <_>3 9 16 6 2. - 0 - -0.1096649020910263 - 0.1765342056751251 - 0.5198346972465515 - <_> - - <_> - - - - <_>1 1 12 12 -1. - <_>1 1 6 6 2. - <_>7 7 6 6 2. - 0 - -9.0279558207839727e-004 - 0.5324159860610962 - 0.3838908076286316 - <_> - - <_> - - - - <_>10 4 2 4 -1. - <_>11 4 1 2 2. - <_>10 6 1 2 2. - 0 - 7.1126641705632210e-004 - 0.4647929966449738 - 0.5755224227905273 - <_> - - <_> - - - - <_>0 9 10 2 -1. - <_>0 9 5 1 2. - <_>5 10 5 1 2. - 0 - -3.1250279862433672e-003 - 0.3236708939075470 - 0.5166770815849304 - <_> - - <_> - - - - <_>9 11 3 3 -1. - <_>9 12 3 1 3. - 0 - 2.4144679773598909e-003 - 0.4787439107894898 - 0.6459717750549316 - <_> - - <_> - - - - <_>3 12 9 2 -1. - <_>3 13 9 1 2. - 0 - 4.4391240226104856e-004 - 0.4409308135509491 - 0.6010255813598633 - <_> - - <_> - - - - <_>9 9 2 2 -1. - <_>9 10 2 1 2. - 0 - -2.2611189342569560e-004 - 0.4038113951683044 - 0.5493255853652954 - 50.1697311401367190 - 12 - -1 - <_> - - - <_> - - <_> - - - - <_>3 4 13 6 -1. - <_>3 6 13 2 3. - 0 - -0.0469012893736362 - 0.6600171923637390 - 0.3743801116943359 - <_> - - <_> - - - - <_>9 7 6 4 -1. - <_>12 7 3 2 2. - <_>9 9 3 2 2. - 0 - -1.4568349579349160e-003 - 0.5783991217613220 - 0.3437797129154205 - <_> - - <_> - - - - <_>1 0 6 8 -1. - <_>4 0 3 8 2. - 0 - 5.5598369799554348e-003 - 0.3622266948223114 - 0.5908216238021851 - <_> - - <_> - - - - <_>9 5 2 12 -1. - <_>9 11 2 6 2. - 0 - 7.3170487303286791e-004 - 0.5500419139862061 - 0.2873558104038239 - <_> - - <_> - - - - <_>4 4 3 10 -1. - <_>4 9 3 5 2. - 0 - 1.3318009441718459e-003 - 0.2673169970512390 - 0.5431019067764282 - <_> - - <_> - - - - <_>6 17 8 3 -1. - <_>6 18 8 1 3. - 0 - 2.4347059661522508e-004 - 0.3855027854442596 - 0.5741388797760010 - <_> - - <_> - - - - <_>0 5 10 6 -1. - <_>0 7 10 2 3. - 0 - -3.0512469820678234e-003 - 0.5503209829330444 - 0.3462845087051392 - <_> - - <_> - - - - <_>13 2 3 2 -1. - <_>13 3 3 1 2. - 0 - -6.8657199153676629e-004 - 0.3291221857070923 - 0.5429509282112122 - <_> - - <_> - - - - <_>7 5 4 5 -1. - <_>9 5 2 5 2. - 0 - 1.4668200165033340e-003 - 0.3588382005691528 - 0.5351811051368713 - <_> - - <_> - - - - <_>12 14 3 6 -1. - <_>12 16 3 2 3. - 0 - 3.2021870720200241e-004 - 0.4296841919422150 - 0.5700234174728394 - <_> - - <_> - - - - <_>1 11 8 2 -1. - <_>1 12 8 1 2. - 0 - 7.4122188379988074e-004 - 0.5282164812088013 - 0.3366870880126953 - <_> - - <_> - - - - <_>7 13 6 3 -1. - <_>7 14 6 1 3. - 0 - 3.8330298848450184e-003 - 0.4559567868709564 - 0.6257336139678955 - <_> - - <_> - - - - <_>0 5 3 6 -1. - <_>0 7 3 2 3. - 0 - -0.0154564399272203 - 0.2350116968154907 - 0.5129452943801880 - <_> - - <_> - - - - <_>13 2 3 2 -1. - <_>13 3 3 1 2. - 0 - 2.6796779129654169e-003 - 0.5329415202140808 - 0.4155062139034271 - <_> - - <_> - - - - <_>4 14 4 6 -1. - <_>4 14 2 3 2. - <_>6 17 2 3 2. - 0 - 2.8296569362282753e-003 - 0.4273087978363037 - 0.5804538130760193 - <_> - - <_> - - - - <_>13 2 3 2 -1. - <_>13 3 3 1 2. - 0 - -3.9444249123334885e-003 - 0.2912611961364746 - 0.5202686190605164 - <_> - - <_> - - - - <_>8 2 4 12 -1. - <_>8 6 4 4 3. - 0 - 2.7179559692740440e-003 - 0.5307688117027283 - 0.3585677146911621 - <_> - - <_> - - - - <_>14 0 6 8 -1. - <_>17 0 3 4 2. - <_>14 4 3 4 2. - 0 - 5.9077627956867218e-003 - 0.4703775048255920 - 0.5941585898399353 - <_> - - <_> - - - - <_>7 17 3 2 -1. - <_>8 17 1 2 3. - 0 - -4.2240349575877190e-003 - 0.2141567021608353 - 0.5088796019554138 - <_> - - <_> - - - - <_>8 12 4 2 -1. - <_>8 13 4 1 2. - 0 - 4.0725888684391975e-003 - 0.4766413867473602 - 0.6841061115264893 - <_> - - <_> - - - - <_>6 0 8 12 -1. - <_>6 0 4 6 2. - <_>10 6 4 6 2. - 0 - 0.0101495301350951 - 0.5360798835754395 - 0.3748497068881989 - <_> - - <_> - - - - <_>14 0 2 10 -1. - <_>15 0 1 5 2. - <_>14 5 1 5 2. - 0 - -1.8864999583456665e-004 - 0.5720130205154419 - 0.3853805065155029 - <_> - - <_> - - - - <_>5 3 8 6 -1. - <_>5 3 4 3 2. - <_>9 6 4 3 2. - 0 - -4.8864358104765415e-003 - 0.3693122863769531 - 0.5340958833694458 - <_> - - <_> - - - - <_>14 0 6 10 -1. - <_>17 0 3 5 2. - <_>14 5 3 5 2. - 0 - 0.0261584799736738 - 0.4962374866008759 - 0.6059989929199219 - <_> - - <_> - - - - <_>9 14 1 2 -1. - <_>9 15 1 1 2. - 0 - 4.8560759751126170e-004 - 0.4438945949077606 - 0.6012468934059143 - <_> - - <_> - - - - <_>15 10 4 3 -1. - <_>15 11 4 1 3. - 0 - 0.0112687097862363 - 0.5244250297546387 - 0.1840388029813767 - <_> - - <_> - - - - <_>8 14 2 3 -1. - <_>8 15 2 1 3. - 0 - -2.8114619199186563e-003 - 0.6060283780097961 - 0.4409897029399872 - <_> - - <_> - - - - <_>3 13 14 4 -1. - <_>10 13 7 2 2. - <_>3 15 7 2 2. - 0 - -5.6112729944288731e-003 - 0.3891170918941498 - 0.5589237213134766 - <_> - - <_> - - - - <_>1 10 4 3 -1. - <_>1 11 4 1 3. - 0 - 8.5680093616247177e-003 - 0.5069345831871033 - 0.2062619030475617 - <_> - - <_> - - - - <_>9 11 6 1 -1. - <_>11 11 2 1 3. - 0 - -3.8172779022715986e-004 - 0.5882201790809631 - 0.4192610979080200 - <_> - - <_> - - - - <_>5 11 6 1 -1. - <_>7 11 2 1 3. - 0 - -1.7680290329735726e-004 - 0.5533605813980103 - 0.4003368914127350 - <_> - - <_> - - - - <_>3 5 16 15 -1. - <_>3 10 16 5 3. - 0 - 6.5112537704408169e-003 - 0.3310146927833557 - 0.5444191098213196 - <_> - - <_> - - - - <_>6 12 4 2 -1. - <_>8 12 2 2 2. - 0 - -6.5948683186434209e-005 - 0.5433831810951233 - 0.3944905996322632 - <_> - - <_> - - - - <_>4 4 12 10 -1. - <_>10 4 6 5 2. - <_>4 9 6 5 2. - 0 - 6.9939051754772663e-003 - 0.5600358247756958 - 0.4192714095115662 - <_> - - <_> - - - - <_>8 6 3 4 -1. - <_>9 6 1 4 3. - 0 - -4.6744439750909805e-003 - 0.6685466766357422 - 0.4604960978031158 - <_> - - <_> - - - - <_>8 12 4 8 -1. - <_>10 12 2 4 2. - <_>8 16 2 4 2. - 0 - 0.0115898502990603 - 0.5357121229171753 - 0.2926830053329468 - <_> - - <_> - - - - <_>8 14 4 3 -1. - <_>8 15 4 1 3. - 0 - 0.0130078401416540 - 0.4679817855358124 - 0.7307463288307190 - <_> - - <_> - - - - <_>12 2 3 2 -1. - <_>13 2 1 2 3. - 0 - -1.1008579749614000e-003 - 0.3937501013278961 - 0.5415065288543701 - <_> - - <_> - - - - <_>8 15 3 2 -1. - <_>8 16 3 1 2. - 0 - 6.0472649056464434e-004 - 0.4242376089096069 - 0.5604041218757629 - <_> - - <_> - - - - <_>6 0 9 14 -1. - <_>9 0 3 14 3. - 0 - -0.0144948400557041 - 0.3631210029125214 - 0.5293182730674744 - <_> - - <_> - - - - <_>9 6 2 3 -1. - <_>10 6 1 3 2. - 0 - -5.3056948818266392e-003 - 0.6860452294349670 - 0.4621821045875549 - <_> - - <_> - - - - <_>10 8 2 3 -1. - <_>10 9 2 1 3. - 0 - -8.1829127157106996e-004 - 0.3944096863269806 - 0.5420439243316650 - <_> - - <_> - - - - <_>0 9 4 6 -1. - <_>0 11 4 2 3. - 0 - -0.0190775208175182 - 0.1962621957063675 - 0.5037891864776611 - <_> - - <_> - - - - <_>6 0 8 2 -1. - <_>6 1 8 1 2. - 0 - 3.5549470339901745e-004 - 0.4086259007453919 - 0.5613973140716553 - <_> - - <_> - - - - <_>6 14 7 3 -1. - <_>6 15 7 1 3. - 0 - 1.9679730758070946e-003 - 0.4489121139049530 - 0.5926123261451721 - <_> - - <_> - - - - <_>8 10 8 9 -1. - <_>8 13 8 3 3. - 0 - 6.9189141504466534e-003 - 0.5335925817489624 - 0.3728385865688324 - <_> - - <_> - - - - <_>5 2 3 2 -1. - <_>6 2 1 2 3. - 0 - 2.9872779268771410e-003 - 0.5111321210861206 - 0.2975643873214722 - <_> - - <_> - - - - <_>14 1 6 8 -1. - <_>17 1 3 4 2. - <_>14 5 3 4 2. - 0 - -6.2264618463814259e-003 - 0.5541489720344544 - 0.4824537932872772 - <_> - - <_> - - - - <_>0 1 6 8 -1. - <_>0 1 3 4 2. - <_>3 5 3 4 2. - 0 - 0.0133533002808690 - 0.4586423933506012 - 0.6414797902107239 - <_> - - <_> - - - - <_>1 2 18 6 -1. - <_>10 2 9 3 2. - <_>1 5 9 3 2. - 0 - 0.0335052385926247 - 0.5392425060272217 - 0.3429994881153107 - <_> - - <_> - - - - <_>9 3 2 1 -1. - <_>10 3 1 1 2. - 0 - -2.5294460356235504e-003 - 0.1703713983297348 - 0.5013315081596375 - <_> - - <_> - - - - <_>13 2 4 6 -1. - <_>15 2 2 3 2. - <_>13 5 2 3 2. - 0 - -1.2801629491150379e-003 - 0.5305461883544922 - 0.4697405099868774 - <_> - - <_> - - - - <_>5 4 3 3 -1. - <_>5 5 3 1 3. - 0 - 7.0687388069927692e-003 - 0.4615545868873596 - 0.6436504721641541 - <_> - - <_> - - - - <_>13 5 1 3 -1. - <_>13 6 1 1 3. - 0 - 9.6880499040707946e-004 - 0.4833599030971527 - 0.6043894290924072 - <_> - - <_> - - - - <_>2 16 5 3 -1. - <_>2 17 5 1 3. - 0 - 3.9647659286856651e-003 - 0.5187637209892273 - 0.3231816887855530 - <_> - - <_> - - - - <_>13 2 4 6 -1. - <_>15 2 2 3 2. - <_>13 5 2 3 2. - 0 - -0.0220577307045460 - 0.4079256951808929 - 0.5200980901718140 - <_> - - <_> - - - - <_>3 2 4 6 -1. - <_>3 2 2 3 2. - <_>5 5 2 3 2. - 0 - -6.6906312713399529e-004 - 0.5331609249114990 - 0.3815600872039795 - <_> - - <_> - - - - <_>13 5 1 2 -1. - <_>13 6 1 1 2. - 0 - -6.7009328631684184e-004 - 0.5655422210693359 - 0.4688901901245117 - <_> - - <_> - - - - <_>5 5 2 2 -1. - <_>5 6 2 1 2. - 0 - 7.4284552829340100e-004 - 0.4534381031990051 - 0.6287400126457214 - <_> - - <_> - - - - <_>13 9 2 2 -1. - <_>13 9 1 2 2. - 0 - 2.2227810695767403e-003 - 0.5350633263587952 - 0.3303655982017517 - <_> - - <_> - - - - <_>5 9 2 2 -1. - <_>6 9 1 2 2. - 0 - -5.4130521602928638e-003 - 0.1113687008619309 - 0.5005434751510620 - <_> - - <_> - - - - <_>13 17 3 2 -1. - <_>13 18 3 1 2. - 0 - -1.4520040167553816e-005 - 0.5628737807273865 - 0.4325133860111237 - <_> - - <_> - - - - <_>6 16 4 4 -1. - <_>6 16 2 2 2. - <_>8 18 2 2 2. - 0 - 2.3369169502984732e-004 - 0.4165835082530975 - 0.5447791218757629 - <_> - - <_> - - - - <_>9 16 2 3 -1. - <_>9 17 2 1 3. - 0 - 4.2894547805190086e-003 - 0.4860391020774841 - 0.6778649091720581 - <_> - - <_> - - - - <_>0 13 9 6 -1. - <_>0 15 9 2 3. - 0 - 5.9103150852024555e-003 - 0.5262305140495300 - 0.3612113893032074 - <_> - - <_> - - - - <_>9 14 2 6 -1. - <_>9 17 2 3 2. - 0 - 0.0129005396738648 - 0.5319377183914185 - 0.3250288069248200 - <_> - - <_> - - - - <_>9 15 2 3 -1. - <_>9 16 2 1 3. - 0 - 4.6982979401946068e-003 - 0.4618245065212250 - 0.6665925979614258 - <_> - - <_> - - - - <_>1 10 18 6 -1. - <_>1 12 18 2 3. - 0 - 0.0104398597031832 - 0.5505670905113220 - 0.3883604109287262 - <_> - - <_> - - - - <_>8 11 4 2 -1. - <_>8 12 4 1 2. - 0 - 3.0443191062659025e-003 - 0.4697853028774262 - 0.7301844954490662 - <_> - - <_> - - - - <_>7 9 6 2 -1. - <_>7 10 6 1 2. - 0 - -6.1593751888722181e-004 - 0.3830839097499847 - 0.5464984178543091 - <_> - - <_> - - - - <_>8 8 2 3 -1. - <_>8 9 2 1 3. - 0 - -3.4247159492224455e-003 - 0.2566300034523010 - 0.5089530944824219 - <_> - - <_> - - - - <_>17 5 3 4 -1. - <_>18 5 1 4 3. - 0 - -9.3538565561175346e-003 - 0.6469966173171997 - 0.4940795898437500 - <_> - - <_> - - - - <_>1 19 18 1 -1. - <_>7 19 6 1 3. - 0 - 0.0523389987647533 - 0.4745982885360718 - 0.7878770828247070 - <_> - - <_> - - - - <_>9 0 3 2 -1. - <_>10 0 1 2 3. - 0 - 3.5765620414167643e-003 - 0.5306664705276489 - 0.2748498022556305 - <_> - - <_> - - - - <_>1 8 1 6 -1. - <_>1 10 1 2 3. - 0 - 7.1555317845195532e-004 - 0.5413125753402710 - 0.4041908979415894 - <_> - - <_> - - - - <_>12 17 8 3 -1. - <_>12 17 4 3 2. - 0 - -0.0105166798457503 - 0.6158512234687805 - 0.4815283119678497 - <_> - - <_> - - - - <_>0 5 3 4 -1. - <_>1 5 1 4 3. - 0 - 7.7347927726805210e-003 - 0.4695805907249451 - 0.7028980851173401 - <_> - - <_> - - - - <_>9 7 2 3 -1. - <_>9 8 2 1 3. - 0 - -4.3226778507232666e-003 - 0.2849566042423248 - 0.5304684042930603 - <_> - - <_> - - - - <_>7 11 2 2 -1. - <_>7 11 1 1 2. - <_>8 12 1 1 2. - 0 - -2.5534399319440126e-003 - 0.7056984901428223 - 0.4688892066478729 - <_> - - <_> - - - - <_>11 3 2 5 -1. - <_>11 3 1 5 2. - 0 - 1.0268510231981054e-004 - 0.3902932107448578 - 0.5573464035987854 - <_> - - <_> - - - - <_>7 3 2 5 -1. - <_>8 3 1 5 2. - 0 - 7.1395188570022583e-006 - 0.3684231936931610 - 0.5263987779617310 - <_> - - <_> - - - - <_>15 13 2 3 -1. - <_>15 14 2 1 3. - 0 - -1.6711989883333445e-003 - 0.3849175870418549 - 0.5387271046638489 - <_> - - <_> - - - - <_>5 6 2 3 -1. - <_>5 7 2 1 3. - 0 - 4.9260449595749378e-003 - 0.4729771912097931 - 0.7447251081466675 - <_> - - <_> - - - - <_>4 19 15 1 -1. - <_>9 19 5 1 3. - 0 - 4.3908702209591866e-003 - 0.4809181094169617 - 0.5591921806335449 - <_> - - <_> - - - - <_>1 19 15 1 -1. - <_>6 19 5 1 3. - 0 - -0.0177936293184757 - 0.6903678178787231 - 0.4676927030086517 - <_> - - <_> - - - - <_>15 13 2 3 -1. - <_>15 14 2 1 3. - 0 - 2.0469669252634048e-003 - 0.5370690226554871 - 0.3308162093162537 - <_> - - <_> - - - - <_>5 0 4 15 -1. - <_>7 0 2 15 2. - 0 - 0.0298914890736341 - 0.5139865279197693 - 0.3309059143066406 - <_> - - <_> - - - - <_>9 6 2 5 -1. - <_>9 6 1 5 2. - 0 - 1.5494900289922953e-003 - 0.4660237133502960 - 0.6078342795372009 - <_> - - <_> - - - - <_>9 5 2 7 -1. - <_>10 5 1 7 2. - 0 - 1.4956969534978271e-003 - 0.4404835999011993 - 0.5863919854164124 - <_> - - <_> - - - - <_>16 11 3 3 -1. - <_>16 12 3 1 3. - 0 - 9.5885928021743894e-004 - 0.5435971021652222 - 0.4208523035049439 - <_> - - <_> - - - - <_>1 11 3 3 -1. - <_>1 12 3 1 3. - 0 - 4.9643701640889049e-004 - 0.5370578169822693 - 0.4000622034072876 - <_> - - <_> - - - - <_>6 6 8 3 -1. - <_>6 7 8 1 3. - 0 - -2.7280810754746199e-003 - 0.5659412741661072 - 0.4259642958641052 - <_> - - <_> - - - - <_>0 15 6 2 -1. - <_>0 16 6 1 2. - 0 - 2.3026480339467525e-003 - 0.5161657929420471 - 0.3350869119167328 - <_> - - <_> - - - - <_>1 0 18 6 -1. - <_>7 0 6 6 3. - 0 - 0.2515163123607636 - 0.4869661927223206 - 0.7147309780120850 - <_> - - <_> - - - - <_>6 0 3 4 -1. - <_>7 0 1 4 3. - 0 - -4.6328022144734859e-003 - 0.2727448940277100 - 0.5083789825439453 - <_> - - <_> - - - - <_>14 10 4 10 -1. - <_>16 10 2 5 2. - <_>14 15 2 5 2. - 0 - -0.0404344908893108 - 0.6851438879966736 - 0.5021767020225525 - <_> - - <_> - - - - <_>3 2 3 2 -1. - <_>4 2 1 2 3. - 0 - 1.4972220014897175e-005 - 0.4284465014934540 - 0.5522555112838745 - <_> - - <_> - - - - <_>11 2 2 2 -1. - <_>11 3 2 1 2. - 0 - -2.4050309730228037e-004 - 0.4226118922233582 - 0.5390074849128723 - <_> - - <_> - - - - <_>2 10 4 10 -1. - <_>2 10 2 5 2. - <_>4 15 2 5 2. - 0 - 0.0236578397452831 - 0.4744631946086884 - 0.7504366040229797 - <_> - - <_> - - - - <_>0 13 20 6 -1. - <_>10 13 10 3 2. - <_>0 16 10 3 2. - 0 - -8.1449104472994804e-003 - 0.4245058894157410 - 0.5538362860679627 - <_> - - <_> - - - - <_>0 5 2 15 -1. - <_>1 5 1 15 2. - 0 - -3.6992130335420370e-003 - 0.5952357053756714 - 0.4529713094234467 - <_> - - <_> - - - - <_>1 7 18 4 -1. - <_>10 7 9 2 2. - <_>1 9 9 2 2. - 0 - -6.7718601785600185e-003 - 0.4137794077396393 - 0.5473399758338928 - <_> - - <_> - - - - <_>0 0 2 17 -1. - <_>1 0 1 17 2. - 0 - 4.2669530957937241e-003 - 0.4484114944934845 - 0.5797994136810303 - <_> - - <_> - - - - <_>2 6 16 6 -1. - <_>10 6 8 3 2. - <_>2 9 8 3 2. - 0 - 1.7791989957913756e-003 - 0.5624858736991882 - 0.4432444870471954 - <_> - - <_> - - - - <_>8 14 1 3 -1. - <_>8 15 1 1 3. - 0 - 1.6774770338088274e-003 - 0.4637751877307892 - 0.6364241838455200 - <_> - - <_> - - - - <_>8 15 4 2 -1. - <_>8 16 4 1 2. - 0 - 1.1732629500329494e-003 - 0.4544503092765808 - 0.5914415717124939 - <_> - - <_> - - - - <_>5 2 8 2 -1. - <_>5 2 4 1 2. - <_>9 3 4 1 2. - 0 - 8.6998171173036098e-004 - 0.5334752798080444 - 0.3885917961597443 - <_> - - <_> - - - - <_>6 11 8 6 -1. - <_>6 14 8 3 2. - 0 - 7.6378340600058436e-004 - 0.5398585200309753 - 0.3744941949844360 - <_> - - <_> - - - - <_>9 13 2 2 -1. - <_>9 14 2 1 2. - 0 - 1.5684569370932877e-004 - 0.4317873120307922 - 0.5614616274833679 - <_> - - <_> - - - - <_>18 4 2 6 -1. - <_>18 6 2 2 3. - 0 - -0.0215113703161478 - 0.1785925030708313 - 0.5185542702674866 - <_> - - <_> - - - - <_>9 12 2 2 -1. - <_>9 13 2 1 2. - 0 - 1.3081369979772717e-004 - 0.4342499077320099 - 0.5682849884033203 - <_> - - <_> - - - - <_>18 4 2 6 -1. - <_>18 6 2 2 3. - 0 - 0.0219920407980680 - 0.5161716938018799 - 0.2379394024610519 - <_> - - <_> - - - - <_>9 13 1 3 -1. - <_>9 14 1 1 3. - 0 - -8.0136500764638186e-004 - 0.5986763238906860 - 0.4466426968574524 - <_> - - <_> - - - - <_>18 4 2 6 -1. - <_>18 6 2 2 3. - 0 - -8.2736099138855934e-003 - 0.4108217954635620 - 0.5251057147979736 - <_> - - <_> - - - - <_>0 4 2 6 -1. - <_>0 6 2 2 3. - 0 - 3.6831789184361696e-003 - 0.5173814296722412 - 0.3397518098354340 - <_> - - <_> - - - - <_>9 12 3 3 -1. - <_>9 13 3 1 3. - 0 - -7.9525681212544441e-003 - 0.6888983249664307 - 0.4845924079418182 - <_> - - <_> - - - - <_>3 13 2 3 -1. - <_>3 14 2 1 3. - 0 - 1.5382299898192286e-003 - 0.5178567171096802 - 0.3454113900661469 - <_> - - <_> - - - - <_>13 13 4 3 -1. - <_>13 14 4 1 3. - 0 - -0.0140435304492712 - 0.1678421050310135 - 0.5188667774200440 - <_> - - <_> - - - - <_>5 4 3 3 -1. - <_>5 5 3 1 3. - 0 - 1.4315890148282051e-003 - 0.4368256926536560 - 0.5655773878097534 - <_> - - <_> - - - - <_>5 2 10 6 -1. - <_>5 4 10 2 3. - 0 - -0.0340142287313938 - 0.7802296280860901 - 0.4959217011928558 - <_> - - <_> - - - - <_>3 13 4 3 -1. - <_>3 14 4 1 3. - 0 - -0.0120272999629378 - 0.1585101038217545 - 0.5032231807708740 - <_> - - <_> - - - - <_>3 7 15 5 -1. - <_>8 7 5 5 3. - 0 - 0.1331661939620972 - 0.5163304805755615 - 0.2755128145217896 - <_> - - <_> - - - - <_>3 7 12 2 -1. - <_>7 7 4 2 3. - 0 - -1.5221949433907866e-003 - 0.3728317916393280 - 0.5214552283287048 - <_> - - <_> - - - - <_>10 3 3 9 -1. - <_>11 3 1 9 3. - 0 - -9.3929271679371595e-004 - 0.5838379263877869 - 0.4511165022850037 - <_> - - <_> - - - - <_>8 6 4 6 -1. - <_>10 6 2 6 2. - 0 - 0.0277197398245335 - 0.4728286862373352 - 0.7331544756889343 - <_> - - <_> - - - - <_>9 7 4 3 -1. - <_>9 8 4 1 3. - 0 - 3.1030150130391121e-003 - 0.5302202105522156 - 0.4101563096046448 - <_> - - <_> - - - - <_>0 9 4 9 -1. - <_>2 9 2 9 2. - 0 - 0.0778612196445465 - 0.4998334050178528 - 0.1272961944341660 - <_> - - <_> - - - - <_>9 13 3 5 -1. - <_>10 13 1 5 3. - 0 - -0.0158549398183823 - 0.0508333593606949 - 0.5165656208992004 - <_> - - <_> - - - - <_>7 7 6 3 -1. - <_>9 7 2 3 3. - 0 - -4.9725300632417202e-003 - 0.6798133850097656 - 0.4684231877326965 - <_> - - <_> - - - - <_>9 7 3 5 -1. - <_>10 7 1 5 3. - 0 - -9.7676506265997887e-004 - 0.6010771989822388 - 0.4788931906223297 - <_> - - <_> - - - - <_>5 7 8 2 -1. - <_>9 7 4 2 2. - 0 - -2.4647710379213095e-003 - 0.3393397927284241 - 0.5220503807067871 - <_> - - <_> - - - - <_>5 9 12 2 -1. - <_>9 9 4 2 3. - 0 - -6.7937700077891350e-003 - 0.4365136921405792 - 0.5239663124084473 - <_> - - <_> - - - - <_>5 6 10 3 -1. - <_>10 6 5 3 2. - 0 - 0.0326080210506916 - 0.5052723884582520 - 0.2425214946269989 - <_> - - <_> - - - - <_>10 12 3 1 -1. - <_>11 12 1 1 3. - 0 - -5.8514421107247472e-004 - 0.5733973979949951 - 0.4758574068546295 - <_> - - <_> - - - - <_>0 1 11 15 -1. - <_>0 6 11 5 3. - 0 - -0.0296326000243425 - 0.3892289102077484 - 0.5263597965240479 - 66.6691207885742190 - 13 - -1 - <_> - - - <_> - - <_> - - - - <_>1 0 18 6 -1. - <_>7 0 6 6 3. - 0 - 0.0465508513152599 - 0.3276950120925903 - 0.6240522861480713 - <_> - - <_> - - - - <_>7 7 6 1 -1. - <_>9 7 2 1 3. - 0 - 7.9537127166986465e-003 - 0.4256485104560852 - 0.6942939162254334 - <_> - - <_> - - - - <_>5 16 6 4 -1. - <_>5 16 3 2 2. - <_>8 18 3 2 2. - 0 - 6.8221561377868056e-004 - 0.3711487054824829 - 0.5900732874870300 - <_> - - <_> - - - - <_>6 5 9 8 -1. - <_>6 9 9 4 2. - 0 - -1.9348249770700932e-004 - 0.2041133940219879 - 0.5300545096397400 - <_> - - <_> - - - - <_>5 10 2 6 -1. - <_>5 13 2 3 2. - 0 - -2.6710508973337710e-004 - 0.5416126251220703 - 0.3103179037570953 - <_> - - <_> - - - - <_>7 6 8 10 -1. - <_>11 6 4 5 2. - <_>7 11 4 5 2. - 0 - 2.7818060480058193e-003 - 0.5277832746505737 - 0.3467069864273071 - <_> - - <_> - - - - <_>5 6 8 10 -1. - <_>5 6 4 5 2. - <_>9 11 4 5 2. - 0 - -4.6779078547842801e-004 - 0.5308231115341187 - 0.3294492065906525 - <_> - - <_> - - - - <_>9 5 2 2 -1. - <_>9 6 2 1 2. - 0 - -3.0335160772665404e-005 - 0.5773872733116150 - 0.3852097094058991 - <_> - - <_> - - - - <_>5 12 8 2 -1. - <_>5 13 8 1 2. - 0 - 7.8038009814918041e-004 - 0.4317438900470734 - 0.6150057911872864 - <_> - - <_> - - - - <_>10 2 8 2 -1. - <_>10 3 8 1 2. - 0 - -4.2553851380944252e-003 - 0.2933903932571411 - 0.5324292778968811 - <_> - - <_> - - - - <_>4 0 2 10 -1. - <_>4 0 1 5 2. - <_>5 5 1 5 2. - 0 - -2.4735610350035131e-004 - 0.5468844771385193 - 0.3843030035495758 - <_> - - <_> - - - - <_>9 10 2 2 -1. - <_>9 11 2 1 2. - 0 - -1.4724259381182492e-004 - 0.4281542897224426 - 0.5755587220191956 - <_> - - <_> - - - - <_>2 8 15 3 -1. - <_>2 9 15 1 3. - 0 - 1.1864770203828812e-003 - 0.3747301101684570 - 0.5471466183662415 - <_> - - <_> - - - - <_>8 13 4 3 -1. - <_>8 14 4 1 3. - 0 - 2.3936580400913954e-003 - 0.4537783861160278 - 0.6111528873443604 - <_> - - <_> - - - - <_>7 2 3 2 -1. - <_>8 2 1 2 3. - 0 - -1.5390539774671197e-003 - 0.2971341907978058 - 0.5189538002014160 - <_> - - <_> - - - - <_>7 13 6 3 -1. - <_>7 14 6 1 3. - 0 - -7.1968790143728256e-003 - 0.6699066758155823 - 0.4726476967334747 - <_> - - <_> - - - - <_>9 9 2 2 -1. - <_>9 10 2 1 2. - 0 - -4.1499789222143590e-004 - 0.3384954035282135 - 0.5260317921638489 - <_> - - <_> - - - - <_>17 2 3 6 -1. - <_>17 4 3 2 3. - 0 - 4.4359830208122730e-003 - 0.5399122238159180 - 0.3920140862464905 - <_> - - <_> - - - - <_>1 5 3 4 -1. - <_>2 5 1 4 3. - 0 - 2.6606200262904167e-003 - 0.4482578039169312 - 0.6119617819786072 - <_> - - <_> - - - - <_>14 8 4 6 -1. - <_>14 10 4 2 3. - 0 - -1.5287200221791863e-003 - 0.3711237907409668 - 0.5340266227722168 - <_> - - <_> - - - - <_>1 4 3 8 -1. - <_>2 4 1 8 3. - 0 - -4.7397250309586525e-003 - 0.6031088232994080 - 0.4455145001411438 - <_> - - <_> - - - - <_>8 13 4 6 -1. - <_>8 16 4 3 2. - 0 - -0.0148291299119592 - 0.2838754057884216 - 0.5341861844062805 - <_> - - <_> - - - - <_>3 14 2 2 -1. - <_>3 15 2 1 2. - 0 - 9.2275557108223438e-004 - 0.5209547281265259 - 0.3361653983592987 - <_> - - <_> - - - - <_>14 8 4 6 -1. - <_>14 10 4 2 3. - 0 - 0.0835298076272011 - 0.5119969844818115 - 0.0811644494533539 - <_> - - <_> - - - - <_>2 8 4 6 -1. - <_>2 10 4 2 3. - 0 - -7.5633148662745953e-004 - 0.3317120075225830 - 0.5189831256866455 - <_> - - <_> - - - - <_>10 14 1 6 -1. - <_>10 17 1 3 2. - 0 - 9.8403859883546829e-003 - 0.5247598290443420 - 0.2334959059953690 - <_> - - <_> - - - - <_>7 5 3 6 -1. - <_>8 5 1 6 3. - 0 - -1.5953830443322659e-003 - 0.5750094056129456 - 0.4295622110366821 - <_> - - <_> - - - - <_>11 2 2 6 -1. - <_>12 2 1 3 2. - <_>11 5 1 3 2. - 0 - 3.4766020689858124e-005 - 0.4342445135116577 - 0.5564029216766357 - <_> - - <_> - - - - <_>6 6 6 5 -1. - <_>8 6 2 5 3. - 0 - 0.0298629105091095 - 0.4579147100448608 - 0.6579188108444214 - <_> - - <_> - - - - <_>17 1 3 6 -1. - <_>17 3 3 2 3. - 0 - 0.0113255903124809 - 0.5274311900138855 - 0.3673888146877289 - <_> - - <_> - - - - <_>8 7 3 5 -1. - <_>9 7 1 5 3. - 0 - -8.7828645482659340e-003 - 0.7100368738174439 - 0.4642167091369629 - <_> - - <_> - - - - <_>9 18 3 2 -1. - <_>10 18 1 2 3. - 0 - 4.3639959767460823e-003 - 0.5279216170310974 - 0.2705877125263214 - <_> - - <_> - - - - <_>8 18 3 2 -1. - <_>9 18 1 2 3. - 0 - 4.1804728098213673e-003 - 0.5072525143623352 - 0.2449083030223846 - <_> - - <_> - - - - <_>12 3 5 2 -1. - <_>12 4 5 1 2. - 0 - -4.5668511302210391e-004 - 0.4283105134963989 - 0.5548691153526306 - <_> - - <_> - - - - <_>7 1 5 12 -1. - <_>7 7 5 6 2. - 0 - -3.7140368949621916e-003 - 0.5519387722015381 - 0.4103653132915497 - <_> - - <_> - - - - <_>1 0 18 4 -1. - <_>7 0 6 4 3. - 0 - -0.0253042895346880 - 0.6867002248764038 - 0.4869889020919800 - <_> - - <_> - - - - <_>4 2 2 2 -1. - <_>4 3 2 1 2. - 0 - -3.4454080741852522e-004 - 0.3728874027729034 - 0.5287693142890930 - <_> - - <_> - - - - <_>11 14 4 2 -1. - <_>13 14 2 1 2. - <_>11 15 2 1 2. - 0 - -8.3935231668874621e-004 - 0.6060152053833008 - 0.4616062045097351 - <_> - - <_> - - - - <_>0 2 3 6 -1. - <_>0 4 3 2 3. - 0 - 0.0172800496220589 - 0.5049635767936707 - 0.1819823980331421 - <_> - - <_> - - - - <_>9 7 2 3 -1. - <_>9 8 2 1 3. - 0 - -6.3595077954232693e-003 - 0.1631239950656891 - 0.5232778787612915 - <_> - - <_> - - - - <_>5 5 1 3 -1. - <_>5 6 1 1 3. - 0 - 1.0298109846189618e-003 - 0.4463278055191040 - 0.6176549196243286 - <_> - - <_> - - - - <_>10 10 6 1 -1. - <_>10 10 3 1 2. - 0 - 1.0117109632119536e-003 - 0.5473384857177734 - 0.4300698935985565 - <_> - - <_> - - - - <_>4 10 6 1 -1. - <_>7 10 3 1 2. - 0 - -0.0103088002651930 - 0.1166985034942627 - 0.5000867247581482 - <_> - - <_> - - - - <_>9 17 3 3 -1. - <_>9 18 3 1 3. - 0 - 5.4682018235325813e-003 - 0.4769287109375000 - 0.6719213724136353 - <_> - - <_> - - - - <_>4 14 1 3 -1. - <_>4 15 1 1 3. - 0 - -9.1696460731327534e-004 - 0.3471089899539948 - 0.5178164839744568 - <_> - - <_> - - - - <_>12 5 3 3 -1. - <_>12 6 3 1 3. - 0 - 2.3922820109874010e-003 - 0.4785236120223999 - 0.6216310858726502 - <_> - - <_> - - - - <_>4 5 12 3 -1. - <_>4 6 12 1 3. - 0 - -7.5573818758130074e-003 - 0.5814796090126038 - 0.4410085082054138 - <_> - - <_> - - - - <_>9 8 2 3 -1. - <_>9 9 2 1 3. - 0 - -7.7024032361805439e-004 - 0.3878000080585480 - 0.5465722084045410 - <_> - - <_> - - - - <_>4 9 3 3 -1. - <_>5 9 1 3 3. - 0 - -8.7125990539789200e-003 - 0.1660051047801971 - 0.4995836019515991 - <_> - - <_> - - - - <_>6 0 9 17 -1. - <_>9 0 3 17 3. - 0 - -0.0103063201531768 - 0.4093391001224518 - 0.5274233818054199 - <_> - - <_> - - - - <_>9 12 1 3 -1. - <_>9 13 1 1 3. - 0 - -2.0940979011356831e-003 - 0.6206194758415222 - 0.4572280049324036 - <_> - - <_> - - - - <_>9 5 2 15 -1. - <_>9 10 2 5 3. - 0 - 6.8099051713943481e-003 - 0.5567759275436401 - 0.4155600070953369 - <_> - - <_> - - - - <_>8 14 2 3 -1. - <_>8 15 2 1 3. - 0 - -1.0746059706434608e-003 - 0.5638927817344666 - 0.4353024959564209 - <_> - - <_> - - - - <_>10 14 1 3 -1. - <_>10 15 1 1 3. - 0 - 2.1550289820879698e-003 - 0.4826265871524811 - 0.6749758124351502 - <_> - - <_> - - - - <_>7 1 6 5 -1. - <_>9 1 2 5 3. - 0 - 0.0317423194646835 - 0.5048379898071289 - 0.1883248984813690 - <_> - - <_> - - - - <_>0 0 20 2 -1. - <_>0 0 10 2 2. - 0 - -0.0783827230334282 - 0.2369548976421356 - 0.5260158181190491 - <_> - - <_> - - - - <_>2 13 5 3 -1. - <_>2 14 5 1 3. - 0 - 5.7415119372308254e-003 - 0.5048828721046448 - 0.2776469886302948 - <_> - - <_> - - - - <_>9 11 2 3 -1. - <_>9 12 2 1 3. - 0 - -2.9014600440859795e-003 - 0.6238604784011841 - 0.4693317115306854 - <_> - - <_> - - - - <_>2 5 9 15 -1. - <_>2 10 9 5 3. - 0 - -2.6427931152284145e-003 - 0.3314141929149628 - 0.5169777274131775 - <_> - - <_> - - - - <_>5 0 12 10 -1. - <_>11 0 6 5 2. - <_>5 5 6 5 2. - 0 - -0.1094966009259224 - 0.2380045056343079 - 0.5183441042900085 - <_> - - <_> - - - - <_>5 1 2 3 -1. - <_>6 1 1 3 2. - 0 - 7.4075913289561868e-005 - 0.4069635868072510 - 0.5362150073051453 - <_> - - <_> - - - - <_>10 7 6 1 -1. - <_>12 7 2 1 3. - 0 - -5.0593802006915212e-004 - 0.5506706237792969 - 0.4374594092369080 - <_> - - <_> - - - - <_>3 1 2 10 -1. - <_>3 1 1 5 2. - <_>4 6 1 5 2. - 0 - -8.2131777890026569e-004 - 0.5525709986686707 - 0.4209375977516174 - <_> - - <_> - - - - <_>13 7 2 1 -1. - <_>13 7 1 1 2. - 0 - -6.0276539443293586e-005 - 0.5455474853515625 - 0.4748266041278839 - <_> - - <_> - - - - <_>4 13 4 6 -1. - <_>4 15 4 2 3. - 0 - 6.8065142259001732e-003 - 0.5157995820045471 - 0.3424577116966248 - <_> - - <_> - - - - <_>13 7 2 1 -1. - <_>13 7 1 1 2. - 0 - 1.7202789895236492e-003 - 0.5013207793235779 - 0.6331263780593872 - <_> - - <_> - - - - <_>5 7 2 1 -1. - <_>6 7 1 1 2. - 0 - -1.3016929733566940e-004 - 0.5539718270301819 - 0.4226869940757752 - <_> - - <_> - - - - <_>2 12 18 4 -1. - <_>11 12 9 2 2. - <_>2 14 9 2 2. - 0 - -4.8016388900578022e-003 - 0.4425095021724701 - 0.5430780053138733 - <_> - - <_> - - - - <_>5 7 2 2 -1. - <_>5 7 1 1 2. - <_>6 8 1 1 2. - 0 - -2.5399310979992151e-003 - 0.7145782113075256 - 0.4697605073451996 - <_> - - <_> - - - - <_>16 3 4 2 -1. - <_>16 4 4 1 2. - 0 - -1.4278929447755218e-003 - 0.4070445001125336 - 0.5399605035781860 - <_> - - <_> - - - - <_>0 2 2 18 -1. - <_>0 2 1 9 2. - <_>1 11 1 9 2. - 0 - -0.0251425504684448 - 0.7884690761566162 - 0.4747352004051209 - <_> - - <_> - - - - <_>1 2 18 4 -1. - <_>10 2 9 2 2. - <_>1 4 9 2 2. - 0 - -3.8899609353393316e-003 - 0.4296191930770874 - 0.5577110052108765 - <_> - - <_> - - - - <_>9 14 1 3 -1. - <_>9 15 1 1 3. - 0 - 4.3947459198534489e-003 - 0.4693162143230438 - 0.7023944258689880 - <_> - - <_> - - - - <_>2 12 18 4 -1. - <_>11 12 9 2 2. - <_>2 14 9 2 2. - 0 - 0.0246784202754498 - 0.5242322087287903 - 0.3812510073184967 - <_> - - <_> - - - - <_>0 12 18 4 -1. - <_>0 12 9 2 2. - <_>9 14 9 2 2. - 0 - 0.0380476787686348 - 0.5011739730834961 - 0.1687828004360199 - <_> - - <_> - - - - <_>11 4 5 3 -1. - <_>11 5 5 1 3. - 0 - 7.9424865543842316e-003 - 0.4828582108020783 - 0.6369568109512329 - <_> - - <_> - - - - <_>6 4 7 3 -1. - <_>6 5 7 1 3. - 0 - -1.5110049862414598e-003 - 0.5906485915184021 - 0.4487667977809906 - <_> - - <_> - - - - <_>13 17 3 3 -1. - <_>13 18 3 1 3. - 0 - 6.4201741479337215e-003 - 0.5241097807884216 - 0.2990570068359375 - <_> - - <_> - - - - <_>8 1 3 4 -1. - <_>9 1 1 4 3. - 0 - -2.9802159406244755e-003 - 0.3041465878486633 - 0.5078489780426025 - <_> - - <_> - - - - <_>11 4 2 4 -1. - <_>11 4 1 4 2. - 0 - -7.4580078944563866e-004 - 0.4128139019012451 - 0.5256826281547546 - <_> - - <_> - - - - <_>0 17 9 3 -1. - <_>3 17 3 3 3. - 0 - -0.0104709500446916 - 0.5808395147323608 - 0.4494296014308929 - <_> - - <_> - - - - <_>11 0 2 8 -1. - <_>12 0 1 4 2. - <_>11 4 1 4 2. - 0 - 9.3369204550981522e-003 - 0.5246552824974060 - 0.2658948898315430 - <_> - - <_> - - - - <_>0 8 6 12 -1. - <_>0 8 3 6 2. - <_>3 14 3 6 2. - 0 - 0.0279369000345469 - 0.4674955010414124 - 0.7087256908416748 - <_> - - <_> - - - - <_>10 7 4 12 -1. - <_>10 13 4 6 2. - 0 - 7.4277678504586220e-003 - 0.5409486889839172 - 0.3758518099784851 - <_> - - <_> - - - - <_>5 3 8 14 -1. - <_>5 10 8 7 2. - 0 - -0.0235845092684031 - 0.3758639991283417 - 0.5238550901412964 - <_> - - <_> - - - - <_>14 10 6 1 -1. - <_>14 10 3 1 2. - 0 - 1.1452640173956752e-003 - 0.4329578876495361 - 0.5804247260093689 - <_> - - <_> - - - - <_>0 4 10 4 -1. - <_>0 6 10 2 2. - 0 - -4.3468660442158580e-004 - 0.5280618071556091 - 0.3873069882392883 - <_> - - <_> - - - - <_>10 0 5 8 -1. - <_>10 4 5 4 2. - 0 - 0.0106485402211547 - 0.4902113080024719 - 0.5681251883506775 - <_> - - <_> - - - - <_>8 1 4 8 -1. - <_>8 1 2 4 2. - <_>10 5 2 4 2. - 0 - -3.9418050437234342e-004 - 0.5570880174636841 - 0.4318251013755798 - <_> - - <_> - - - - <_>9 11 6 1 -1. - <_>11 11 2 1 3. - 0 - -1.3270479394122958e-004 - 0.5658439993858337 - 0.4343554973602295 - <_> - - <_> - - - - <_>8 9 3 4 -1. - <_>9 9 1 4 3. - 0 - -2.0125510636717081e-003 - 0.6056739091873169 - 0.4537523984909058 - <_> - - <_> - - - - <_>18 4 2 6 -1. - <_>18 6 2 2 3. - 0 - 2.4854319635778666e-003 - 0.5390477180480957 - 0.4138010144233704 - <_> - - <_> - - - - <_>8 8 3 4 -1. - <_>9 8 1 4 3. - 0 - 1.8237880431115627e-003 - 0.4354828894138336 - 0.5717188715934753 - <_> - - <_> - - - - <_>7 1 13 3 -1. - <_>7 2 13 1 3. - 0 - -0.0166566595435143 - 0.3010913133621216 - 0.5216122865676880 - <_> - - <_> - - - - <_>7 13 6 1 -1. - <_>9 13 2 1 3. - 0 - 8.0349558265879750e-004 - 0.5300151109695435 - 0.3818396925926209 - <_> - - <_> - - - - <_>12 11 3 6 -1. - <_>12 13 3 2 3. - 0 - 3.4170378930866718e-003 - 0.5328028798103333 - 0.4241400063037872 - <_> - - <_> - - - - <_>5 11 6 1 -1. - <_>7 11 2 1 3. - 0 - -3.6222729249857366e-004 - 0.5491728186607361 - 0.4186977148056030 - <_> - - <_> - - - - <_>1 4 18 10 -1. - <_>10 4 9 5 2. - <_>1 9 9 5 2. - 0 - -0.1163002029061317 - 0.1440722048282623 - 0.5226451158523560 - <_> - - <_> - - - - <_>8 6 4 9 -1. - <_>8 9 4 3 3. - 0 - -0.0146950101479888 - 0.7747725248336792 - 0.4715717136859894 - <_> - - <_> - - - - <_>8 6 4 3 -1. - <_>8 7 4 1 3. - 0 - 2.1972130052745342e-003 - 0.5355433821678162 - 0.3315644860267639 - <_> - - <_> - - - - <_>8 7 3 3 -1. - <_>9 7 1 3 3. - 0 - -4.6965209185145795e-004 - 0.5767235159873962 - 0.4458136856555939 - <_> - - <_> - - - - <_>14 15 4 3 -1. - <_>14 16 4 1 3. - 0 - 6.5144998952746391e-003 - 0.5215674042701721 - 0.3647888898849487 - <_> - - <_> - - - - <_>5 10 3 10 -1. - <_>6 10 1 10 3. - 0 - 0.0213000606745481 - 0.4994204938411713 - 0.1567950993776321 - <_> - - <_> - - - - <_>8 15 4 3 -1. - <_>8 16 4 1 3. - 0 - 3.1881409231573343e-003 - 0.4742200076580048 - 0.6287270188331604 - <_> - - <_> - - - - <_>0 8 1 6 -1. - <_>0 10 1 2 3. - 0 - 9.0019777417182922e-004 - 0.5347954034805298 - 0.3943752050399780 - <_> - - <_> - - - - <_>10 15 1 3 -1. - <_>10 16 1 1 3. - 0 - -5.1772277802228928e-003 - 0.6727191805839539 - 0.5013138055801392 - <_> - - <_> - - - - <_>2 15 4 3 -1. - <_>2 16 4 1 3. - 0 - -4.3764649890363216e-003 - 0.3106675148010254 - 0.5128793120384216 - <_> - - <_> - - - - <_>18 3 2 8 -1. - <_>19 3 1 4 2. - <_>18 7 1 4 2. - 0 - 2.6299960445612669e-003 - 0.4886310100555420 - 0.5755215883255005 - <_> - - <_> - - - - <_>0 3 2 8 -1. - <_>0 3 1 4 2. - <_>1 7 1 4 2. - 0 - -2.0458688959479332e-003 - 0.6025794148445129 - 0.4558076858520508 - <_> - - <_> - - - - <_>3 7 14 10 -1. - <_>10 7 7 5 2. - <_>3 12 7 5 2. - 0 - 0.0694827064871788 - 0.5240747928619385 - 0.2185259014368057 - <_> - - <_> - - - - <_>0 7 19 3 -1. - <_>0 8 19 1 3. - 0 - 0.0240489393472672 - 0.5011867284774780 - 0.2090622037649155 - <_> - - <_> - - - - <_>12 6 3 3 -1. - <_>12 7 3 1 3. - 0 - 3.1095340382307768e-003 - 0.4866712093353272 - 0.7108548283576965 - <_> - - <_> - - - - <_>0 6 1 3 -1. - <_>0 7 1 1 3. - 0 - -1.2503260513767600e-003 - 0.3407891094684601 - 0.5156195163726807 - <_> - - <_> - - - - <_>12 6 3 3 -1. - <_>12 7 3 1 3. - 0 - -1.0281190043315291e-003 - 0.5575572252273560 - 0.4439432024955750 - <_> - - <_> - - - - <_>5 6 3 3 -1. - <_>5 7 3 1 3. - 0 - -8.8893622159957886e-003 - 0.6402000784873962 - 0.4620442092418671 - <_> - - <_> - - - - <_>8 2 4 2 -1. - <_>8 3 4 1 2. - 0 - -6.1094801640138030e-004 - 0.3766441941261292 - 0.5448899865150452 - <_> - - <_> - - - - <_>6 3 4 12 -1. - <_>8 3 2 12 2. - 0 - -5.7686357758939266e-003 - 0.3318648934364319 - 0.5133677124977112 - <_> - - <_> - - - - <_>13 6 2 3 -1. - <_>13 7 2 1 3. - 0 - 1.8506490159779787e-003 - 0.4903570115566254 - 0.6406934857368469 - <_> - - <_> - - - - <_>0 10 20 4 -1. - <_>0 12 20 2 2. - 0 - -0.0997994691133499 - 0.1536051034927368 - 0.5015562176704407 - <_> - - <_> - - - - <_>2 0 17 14 -1. - <_>2 7 17 7 2. - 0 - -0.3512834906578064 - 0.0588231310248375 - 0.5174378752708435 - <_> - - <_> - - - - <_>0 0 6 10 -1. - <_>0 0 3 5 2. - <_>3 5 3 5 2. - 0 - -0.0452445708215237 - 0.6961488723754883 - 0.4677872955799103 - <_> - - <_> - - - - <_>14 6 6 4 -1. - <_>14 6 3 4 2. - 0 - 0.0714815780520439 - 0.5167986154556274 - 0.1038092970848084 - <_> - - <_> - - - - <_>0 6 6 4 -1. - <_>3 6 3 4 2. - 0 - 2.1895780228078365e-003 - 0.4273078143596649 - 0.5532060861587524 - <_> - - <_> - - - - <_>13 2 7 2 -1. - <_>13 3 7 1 2. - 0 - -5.9242651332169771e-004 - 0.4638943970203400 - 0.5276389122009277 - <_> - - <_> - - - - <_>0 2 7 2 -1. - <_>0 3 7 1 2. - 0 - 1.6788389766588807e-003 - 0.5301648974418640 - 0.3932034969329834 - <_> - - <_> - - - - <_>6 11 14 2 -1. - <_>13 11 7 1 2. - <_>6 12 7 1 2. - 0 - -2.2163488902151585e-003 - 0.5630694031715393 - 0.4757033884525299 - <_> - - <_> - - - - <_>8 5 2 2 -1. - <_>8 5 1 1 2. - <_>9 6 1 1 2. - 0 - 1.1568699846975505e-004 - 0.4307535886764526 - 0.5535702705383301 - <_> - - <_> - - - - <_>13 9 2 3 -1. - <_>13 9 1 3 2. - 0 - -7.2017288766801357e-003 - 0.1444882005453110 - 0.5193064212799072 - <_> - - <_> - - - - <_>1 1 3 12 -1. - <_>2 1 1 12 3. - 0 - 8.9081272017210722e-004 - 0.4384432137012482 - 0.5593621134757996 - <_> - - <_> - - - - <_>17 4 1 3 -1. - <_>17 5 1 1 3. - 0 - 1.9605009583756328e-004 - 0.5340415835380554 - 0.4705956876277924 - <_> - - <_> - - - - <_>2 4 1 3 -1. - <_>2 5 1 1 3. - 0 - 5.2022142335772514e-004 - 0.5213856101036072 - 0.3810079097747803 - <_> - - <_> - - - - <_>14 5 1 3 -1. - <_>14 6 1 1 3. - 0 - 9.4588572392240167e-004 - 0.4769414961338043 - 0.6130738854408264 - <_> - - <_> - - - - <_>7 16 2 3 -1. - <_>7 17 2 1 3. - 0 - 9.1698471806012094e-005 - 0.4245009124279022 - 0.5429363250732422 - <_> - - <_> - - - - <_>8 13 4 6 -1. - <_>10 13 2 3 2. - <_>8 16 2 3 2. - 0 - 2.1833200007677078e-003 - 0.5457730889320374 - 0.4191075861454010 - <_> - - <_> - - - - <_>5 5 1 3 -1. - <_>5 6 1 1 3. - 0 - -8.6039671441540122e-004 - 0.5764588713645935 - 0.4471659958362579 - <_> - - <_> - - - - <_>16 0 4 20 -1. - <_>16 0 2 20 2. - 0 - -0.0132362395524979 - 0.6372823119163513 - 0.4695009887218475 - <_> - - <_> - - - - <_>5 1 2 6 -1. - <_>5 1 1 3 2. - <_>6 4 1 3 2. - 0 - 4.3376701069064438e-004 - 0.5317873954772949 - 0.3945829868316650 - 67.6989212036132810 - 14 - -1 - <_> - - - <_> - - <_> - - - - <_>5 4 10 4 -1. - <_>5 6 10 2 2. - 0 - -0.0248471498489380 - 0.6555516719818115 - 0.3873311877250671 - <_> - - <_> - - - - <_>15 2 4 12 -1. - <_>15 2 2 12 2. - 0 - 6.1348611488938332e-003 - 0.3748072087764740 - 0.5973997712135315 - <_> - - <_> - - - - <_>7 6 4 12 -1. - <_>7 12 4 6 2. - 0 - 6.4498498104512691e-003 - 0.5425491929054260 - 0.2548811137676239 - <_> - - <_> - - - - <_>14 5 1 8 -1. - <_>14 9 1 4 2. - 0 - 6.3491211039945483e-004 - 0.2462442070245743 - 0.5387253761291504 - <_> - - <_> - - - - <_>1 4 14 10 -1. - <_>1 4 7 5 2. - <_>8 9 7 5 2. - 0 - 1.4023890253156424e-003 - 0.5594322085380554 - 0.3528657853603363 - <_> - - <_> - - - - <_>11 6 6 14 -1. - <_>14 6 3 7 2. - <_>11 13 3 7 2. - 0 - 3.0044000595808029e-004 - 0.3958503901958466 - 0.5765938162803650 - <_> - - <_> - - - - <_>3 6 6 14 -1. - <_>3 6 3 7 2. - <_>6 13 3 7 2. - 0 - 1.0042409849120304e-004 - 0.3698996901512146 - 0.5534998178482056 - <_> - - <_> - - - - <_>4 9 15 2 -1. - <_>9 9 5 2 3. - 0 - -5.0841490738093853e-003 - 0.3711090981960297 - 0.5547800064086914 - <_> - - <_> - - - - <_>7 14 6 3 -1. - <_>7 15 6 1 3. - 0 - -0.0195372607558966 - 0.7492755055427551 - 0.4579297006130219 - <_> - - <_> - - - - <_>6 3 14 4 -1. - <_>13 3 7 2 2. - <_>6 5 7 2 2. - 0 - -7.4532740654831287e-006 - 0.5649787187576294 - 0.3904069960117340 - <_> - - <_> - - - - <_>1 9 15 2 -1. - <_>6 9 5 2 3. - 0 - -3.6079459823668003e-003 - 0.3381088078022003 - 0.5267801284790039 - <_> - - <_> - - - - <_>6 11 8 9 -1. - <_>6 14 8 3 3. - 0 - 2.0697501022368670e-003 - 0.5519291162490845 - 0.3714388906955719 - <_> - - <_> - - - - <_>7 4 3 8 -1. - <_>8 4 1 8 3. - 0 - -4.6463840408250690e-004 - 0.5608214735984802 - 0.4113566875457764 - <_> - - <_> - - - - <_>14 6 2 6 -1. - <_>14 9 2 3 2. - 0 - 7.5490452582016587e-004 - 0.3559206128120422 - 0.5329356193542481 - <_> - - <_> - - - - <_>5 7 6 4 -1. - <_>5 7 3 2 2. - <_>8 9 3 2 2. - 0 - -9.8322238773107529e-004 - 0.5414795875549316 - 0.3763205111026764 - <_> - - <_> - - - - <_>1 1 18 19 -1. - <_>7 1 6 19 3. - 0 - -0.0199406407773495 - 0.6347903013229370 - 0.4705299139022827 - <_> - - <_> - - - - <_>1 2 6 5 -1. - <_>4 2 3 5 2. - 0 - 3.7680300883948803e-003 - 0.3913489878177643 - 0.5563716292381287 - <_> - - <_> - - - - <_>12 17 6 2 -1. - <_>12 18 6 1 2. - 0 - -9.4528505578637123e-003 - 0.2554892897605896 - 0.5215116739273071 - <_> - - <_> - - - - <_>2 17 6 2 -1. - <_>2 18 6 1 2. - 0 - 2.9560849070549011e-003 - 0.5174679160118103 - 0.3063920140266419 - <_> - - <_> - - - - <_>17 3 3 6 -1. - <_>17 5 3 2 3. - 0 - 9.1078737750649452e-003 - 0.5388448238372803 - 0.2885963022708893 - <_> - - <_> - - - - <_>8 17 3 3 -1. - <_>8 18 3 1 3. - 0 - 1.8219229532405734e-003 - 0.4336043000221252 - 0.5852196812629700 - <_> - - <_> - - - - <_>10 13 2 6 -1. - <_>10 16 2 3 2. - 0 - 0.0146887395530939 - 0.5287361741065979 - 0.2870005965232849 - <_> - - <_> - - - - <_>7 13 6 3 -1. - <_>7 14 6 1 3. - 0 - -0.0143879903480411 - 0.7019448876380920 - 0.4647370874881744 - <_> - - <_> - - - - <_>17 3 3 6 -1. - <_>17 5 3 2 3. - 0 - -0.0189866498112679 - 0.2986552119255066 - 0.5247011780738831 - <_> - - <_> - - - - <_>8 13 2 3 -1. - <_>8 14 2 1 3. - 0 - 1.1527639580890536e-003 - 0.4323473870754242 - 0.5931661725044251 - <_> - - <_> - - - - <_>9 3 6 2 -1. - <_>11 3 2 2 3. - 0 - 0.0109336702153087 - 0.5286864042282105 - 0.3130319118499756 - <_> - - <_> - - - - <_>0 3 3 6 -1. - <_>0 5 3 2 3. - 0 - -0.0149327302351594 - 0.2658419013023377 - 0.5084077119827271 - <_> - - <_> - - - - <_>8 5 4 6 -1. - <_>8 7 4 2 3. - 0 - -2.9970539617352188e-004 - 0.5463526844978333 - 0.3740724027156830 - <_> - - <_> - - - - <_>5 5 3 2 -1. - <_>5 6 3 1 2. - 0 - 4.1677621193230152e-003 - 0.4703496992588043 - 0.7435721755027771 - <_> - - <_> - - - - <_>10 1 3 4 -1. - <_>11 1 1 4 3. - 0 - -6.3905320130288601e-003 - 0.2069258987903595 - 0.5280538201332092 - <_> - - <_> - - - - <_>1 2 5 9 -1. - <_>1 5 5 3 3. - 0 - 4.5029609464108944e-003 - 0.5182648897171021 - 0.3483543097972870 - <_> - - <_> - - - - <_>13 6 2 3 -1. - <_>13 7 2 1 3. - 0 - -9.2040365561842918e-003 - 0.6803777217864990 - 0.4932360053062439 - <_> - - <_> - - - - <_>0 6 14 3 -1. - <_>7 6 7 3 2. - 0 - 0.0813272595405579 - 0.5058398842811585 - 0.2253051996231079 - <_> - - <_> - - - - <_>2 11 18 8 -1. - <_>2 15 18 4 2. - 0 - -0.1507928073406220 - 0.2963424921035767 - 0.5264679789543152 - <_> - - <_> - - - - <_>5 6 2 3 -1. - <_>5 7 2 1 3. - 0 - 3.3179009333252907e-003 - 0.4655495882034302 - 0.7072932124137878 - <_> - - <_> - - - - <_>10 6 4 2 -1. - <_>12 6 2 1 2. - <_>10 7 2 1 2. - 0 - 7.7402801252901554e-004 - 0.4780347943305969 - 0.5668237805366516 - <_> - - <_> - - - - <_>6 6 4 2 -1. - <_>6 6 2 1 2. - <_>8 7 2 1 2. - 0 - 6.8199541419744492e-004 - 0.4286996126174927 - 0.5722156763076782 - <_> - - <_> - - - - <_>10 1 3 4 -1. - <_>11 1 1 4 3. - 0 - 5.3671570494771004e-003 - 0.5299307107925415 - 0.3114621937274933 - <_> - - <_> - - - - <_>7 1 2 7 -1. - <_>8 1 1 7 2. - 0 - 9.7018666565418243e-005 - 0.3674638867378235 - 0.5269461870193481 - <_> - - <_> - - - - <_>4 2 15 14 -1. - <_>4 9 15 7 2. - 0 - -0.1253408938646317 - 0.2351492047309876 - 0.5245791077613831 - <_> - - <_> - - - - <_>8 7 3 2 -1. - <_>9 7 1 2 3. - 0 - -5.2516269497573376e-003 - 0.7115936875343323 - 0.4693767130374908 - <_> - - <_> - - - - <_>2 3 18 4 -1. - <_>11 3 9 2 2. - <_>2 5 9 2 2. - 0 - -7.8342109918594360e-003 - 0.4462651014328003 - 0.5409085750579834 - <_> - - <_> - - - - <_>9 7 2 2 -1. - <_>10 7 1 2 2. - 0 - -1.1310069821774960e-003 - 0.5945618748664856 - 0.4417662024497986 - <_> - - <_> - - - - <_>13 9 2 3 -1. - <_>13 9 1 3 2. - 0 - 1.7601120052859187e-003 - 0.5353249907493591 - 0.3973453044891357 - <_> - - <_> - - - - <_>5 2 6 2 -1. - <_>7 2 2 2 3. - 0 - -8.1581249833106995e-004 - 0.3760268092155457 - 0.5264726877212524 - <_> - - <_> - - - - <_>9 5 2 7 -1. - <_>9 5 1 7 2. - 0 - -3.8687589112669230e-003 - 0.6309912800788879 - 0.4749819934368134 - <_> - - <_> - - - - <_>5 9 2 3 -1. - <_>6 9 1 3 2. - 0 - 1.5207129763439298e-003 - 0.5230181813240051 - 0.3361223936080933 - <_> - - <_> - - - - <_>6 0 14 18 -1. - <_>6 9 14 9 2. - 0 - 0.5458673834800720 - 0.5167139768600464 - 0.1172635033726692 - <_> - - <_> - - - - <_>2 16 6 3 -1. - <_>2 17 6 1 3. - 0 - 0.0156501904129982 - 0.4979439079761505 - 0.1393294930458069 - <_> - - <_> - - - - <_>9 7 3 6 -1. - <_>10 7 1 6 3. - 0 - -0.0117318602278829 - 0.7129650712013245 - 0.4921196103096008 - <_> - - <_> - - - - <_>7 8 4 3 -1. - <_>7 9 4 1 3. - 0 - -6.1765122227370739e-003 - 0.2288102954626083 - 0.5049701929092407 - <_> - - <_> - - - - <_>7 12 6 3 -1. - <_>7 13 6 1 3. - 0 - 2.2457661107182503e-003 - 0.4632433950901032 - 0.6048725843429565 - <_> - - <_> - - - - <_>9 12 2 3 -1. - <_>9 13 2 1 3. - 0 - -5.1915869116783142e-003 - 0.6467421054840088 - 0.4602192938327789 - <_> - - <_> - - - - <_>7 12 6 2 -1. - <_>9 12 2 2 3. - 0 - -0.0238278806209564 - 0.1482000946998596 - 0.5226079225540161 - <_> - - <_> - - - - <_>5 11 4 6 -1. - <_>5 14 4 3 2. - 0 - 1.0284580057486892e-003 - 0.5135489106178284 - 0.3375957012176514 - <_> - - <_> - - - - <_>11 12 7 2 -1. - <_>11 13 7 1 2. - 0 - -0.0100788502022624 - 0.2740561068058014 - 0.5303567051887512 - <_> - - <_> - - - - <_>6 10 8 6 -1. - <_>6 10 4 3 2. - <_>10 13 4 3 2. - 0 - 2.6168930344283581e-003 - 0.5332670807838440 - 0.3972454071044922 - <_> - - <_> - - - - <_>11 10 3 4 -1. - <_>11 12 3 2 2. - 0 - 5.4385367548093200e-004 - 0.5365604162216187 - 0.4063411951065064 - <_> - - <_> - - - - <_>9 16 2 3 -1. - <_>9 17 2 1 3. - 0 - 5.3510512225329876e-003 - 0.4653759002685547 - 0.6889045834541321 - <_> - - <_> - - - - <_>13 3 1 9 -1. - <_>13 6 1 3 3. - 0 - -1.5274790348485112e-003 - 0.5449501276016235 - 0.3624723851680756 - <_> - - <_> - - - - <_>1 13 14 6 -1. - <_>1 15 14 2 3. - 0 - -0.0806244164705276 - 0.1656087040901184 - 0.5000287294387817 - <_> - - <_> - - - - <_>13 6 1 6 -1. - <_>13 9 1 3 2. - 0 - 0.0221920292824507 - 0.5132731199264526 - 0.2002808004617691 - <_> - - <_> - - - - <_>0 4 3 8 -1. - <_>1 4 1 8 3. - 0 - 7.3100631125271320e-003 - 0.4617947936058044 - 0.6366536021232605 - <_> - - <_> - - - - <_>18 0 2 18 -1. - <_>18 0 1 18 2. - 0 - -6.4063072204589844e-003 - 0.5916250944137573 - 0.4867860972881317 - <_> - - <_> - - - - <_>2 3 6 2 -1. - <_>2 4 6 1 2. - 0 - -7.6415040530264378e-004 - 0.3888409137725830 - 0.5315797924995422 - <_> - - <_> - - - - <_>9 0 8 6 -1. - <_>9 2 8 2 3. - 0 - 7.6734489994123578e-004 - 0.4159064888954163 - 0.5605279803276062 - <_> - - <_> - - - - <_>6 6 1 6 -1. - <_>6 9 1 3 2. - 0 - 6.1474501853808761e-004 - 0.3089022040367127 - 0.5120148062705994 - <_> - - <_> - - - - <_>14 8 6 3 -1. - <_>14 9 6 1 3. - 0 - -5.0105270929634571e-003 - 0.3972199857234955 - 0.5207306146621704 - <_> - - <_> - - - - <_>0 0 2 18 -1. - <_>1 0 1 18 2. - 0 - -8.6909132078289986e-003 - 0.6257408261299133 - 0.4608575999736786 - <_> - - <_> - - - - <_>1 18 18 2 -1. - <_>10 18 9 1 2. - <_>1 19 9 1 2. - 0 - -0.0163914598524570 - 0.2085209935903549 - 0.5242266058921814 - <_> - - <_> - - - - <_>3 15 2 2 -1. - <_>3 16 2 1 2. - 0 - 4.0973909199237823e-004 - 0.5222427248954773 - 0.3780320882797241 - <_> - - <_> - - - - <_>8 14 5 3 -1. - <_>8 15 5 1 3. - 0 - -2.5242289993911982e-003 - 0.5803927183151245 - 0.4611890017986298 - <_> - - <_> - - - - <_>8 14 2 3 -1. - <_>8 15 2 1 3. - 0 - 5.0945312250405550e-004 - 0.4401271939277649 - 0.5846015810966492 - <_> - - <_> - - - - <_>12 3 3 3 -1. - <_>13 3 1 3 3. - 0 - 1.9656419754028320e-003 - 0.5322325229644775 - 0.4184590876102448 - <_> - - <_> - - - - <_>7 5 6 2 -1. - <_>9 5 2 2 3. - 0 - 5.6298897834494710e-004 - 0.3741844892501831 - 0.5234565734863281 - <_> - - <_> - - - - <_>15 5 5 2 -1. - <_>15 6 5 1 2. - 0 - -6.7946797935292125e-004 - 0.4631041884422302 - 0.5356478095054627 - <_> - - <_> - - - - <_>0 5 5 2 -1. - <_>0 6 5 1 2. - 0 - 7.2856349870562553e-003 - 0.5044670104980469 - 0.2377564013004303 - <_> - - <_> - - - - <_>17 14 1 6 -1. - <_>17 17 1 3 2. - 0 - -0.0174594894051552 - 0.7289121150970459 - 0.5050435066223145 - <_> - - <_> - - - - <_>2 9 9 3 -1. - <_>5 9 3 3 3. - 0 - -0.0254217498004436 - 0.6667134761810303 - 0.4678100049495697 - <_> - - <_> - - - - <_>12 3 3 3 -1. - <_>13 3 1 3 3. - 0 - -1.5647639520466328e-003 - 0.4391759037971497 - 0.5323626995086670 - <_> - - <_> - - - - <_>0 0 4 18 -1. - <_>2 0 2 18 2. - 0 - 0.0114443600177765 - 0.4346440136432648 - 0.5680012106895447 - <_> - - <_> - - - - <_>17 6 1 3 -1. - <_>17 7 1 1 3. - 0 - -6.7352550104260445e-004 - 0.4477140903472900 - 0.5296812057495117 - <_> - - <_> - - - - <_>2 14 1 6 -1. - <_>2 17 1 3 2. - 0 - 9.3194209039211273e-003 - 0.4740200042724609 - 0.7462607026100159 - <_> - - <_> - - - - <_>19 8 1 2 -1. - <_>19 9 1 1 2. - 0 - 1.3328490604180843e-004 - 0.5365061759948731 - 0.4752134978771210 - <_> - - <_> - - - - <_>5 3 3 3 -1. - <_>6 3 1 3 3. - 0 - -7.8815799206495285e-003 - 0.1752219051122665 - 0.5015255212783814 - <_> - - <_> - - - - <_>9 16 2 3 -1. - <_>9 17 2 1 3. - 0 - -5.7985680177807808e-003 - 0.7271236777305603 - 0.4896200895309448 - <_> - - <_> - - - - <_>2 6 1 3 -1. - <_>2 7 1 1 3. - 0 - -3.8922499516047537e-004 - 0.4003908932209015 - 0.5344941020011902 - <_> - - <_> - - - - <_>12 4 8 2 -1. - <_>16 4 4 1 2. - <_>12 5 4 1 2. - 0 - -1.9288610201328993e-003 - 0.5605612993240356 - 0.4803955852985382 - <_> - - <_> - - - - <_>0 4 8 2 -1. - <_>0 4 4 1 2. - <_>4 5 4 1 2. - 0 - 8.4214154630899429e-003 - 0.4753246903419495 - 0.7623608708381653 - <_> - - <_> - - - - <_>2 16 18 4 -1. - <_>2 18 18 2 2. - 0 - 8.1655876711010933e-003 - 0.5393261909484863 - 0.4191643893718720 - <_> - - <_> - - - - <_>7 15 2 4 -1. - <_>7 17 2 2 2. - 0 - 4.8280550981871784e-004 - 0.4240800142288208 - 0.5399821996688843 - <_> - - <_> - - - - <_>4 0 14 3 -1. - <_>4 1 14 1 3. - 0 - -2.7186630759388208e-003 - 0.4244599938392639 - 0.5424923896789551 - <_> - - <_> - - - - <_>0 0 4 20 -1. - <_>2 0 2 20 2. - 0 - -0.0125072300434113 - 0.5895841717720032 - 0.4550411105155945 - <_> - - <_> - - - - <_>12 4 4 8 -1. - <_>14 4 2 4 2. - <_>12 8 2 4 2. - 0 - -0.0242865197360516 - 0.2647134959697723 - 0.5189179778099060 - <_> - - <_> - - - - <_>6 7 2 2 -1. - <_>6 7 1 1 2. - <_>7 8 1 1 2. - 0 - -2.9676330741494894e-003 - 0.7347682714462280 - 0.4749749898910523 - <_> - - <_> - - - - <_>10 6 2 3 -1. - <_>10 7 2 1 3. - 0 - -0.0125289997085929 - 0.2756049931049347 - 0.5177599787712097 - <_> - - <_> - - - - <_>8 7 3 2 -1. - <_>8 8 3 1 2. - 0 - -1.0104000102728605e-003 - 0.3510560989379883 - 0.5144724249839783 - <_> - - <_> - - - - <_>8 2 6 12 -1. - <_>8 8 6 6 2. - 0 - -2.1348530426621437e-003 - 0.5637925863265991 - 0.4667319953441620 - <_> - - <_> - - - - <_>4 0 11 12 -1. - <_>4 4 11 4 3. - 0 - 0.0195642597973347 - 0.4614573121070862 - 0.6137639880180359 - <_> - - <_> - - - - <_>14 9 6 11 -1. - <_>16 9 2 11 3. - 0 - -0.0971463471651077 - 0.2998378872871399 - 0.5193555951118469 - <_> - - <_> - - - - <_>0 14 4 3 -1. - <_>0 15 4 1 3. - 0 - 4.5014568604528904e-003 - 0.5077884793281555 - 0.3045755922794342 - <_> - - <_> - - - - <_>9 10 2 3 -1. - <_>9 11 2 1 3. - 0 - 6.3706971704959869e-003 - 0.4861018955707550 - 0.6887500882148743 - <_> - - <_> - - - - <_>5 11 3 2 -1. - <_>5 12 3 1 2. - 0 - -9.0721528977155685e-003 - 0.1673395931720734 - 0.5017563104629517 - <_> - - <_> - - - - <_>9 15 3 3 -1. - <_>10 15 1 3 3. - 0 - -5.3537208586931229e-003 - 0.2692756950855255 - 0.5242633223533630 - <_> - - <_> - - - - <_>8 8 3 4 -1. - <_>9 8 1 4 3. - 0 - -0.0109328404068947 - 0.7183864116668701 - 0.4736028909683228 - <_> - - <_> - - - - <_>9 15 3 3 -1. - <_>10 15 1 3 3. - 0 - 8.2356072962284088e-003 - 0.5223966836929321 - 0.2389862984418869 - <_> - - <_> - - - - <_>7 7 3 2 -1. - <_>8 7 1 2 3. - 0 - -1.0038160253316164e-003 - 0.5719355940818787 - 0.4433943033218384 - <_> - - <_> - - - - <_>2 10 16 4 -1. - <_>10 10 8 2 2. - <_>2 12 8 2 2. - 0 - 4.0859128348529339e-003 - 0.5472841858863831 - 0.4148836135864258 - <_> - - <_> - - - - <_>2 3 4 17 -1. - <_>4 3 2 17 2. - 0 - 0.1548541933298111 - 0.4973812103271484 - 0.0610615983605385 - <_> - - <_> - - - - <_>15 13 2 7 -1. - <_>15 13 1 7 2. - 0 - 2.0897459762636572e-004 - 0.4709174036979675 - 0.5423889160156250 - <_> - - <_> - - - - <_>2 2 6 1 -1. - <_>5 2 3 1 2. - 0 - 3.3316991175524890e-004 - 0.4089626967906952 - 0.5300992131233215 - <_> - - <_> - - - - <_>5 2 12 4 -1. - <_>9 2 4 4 3. - 0 - -0.0108134001493454 - 0.6104369759559631 - 0.4957334101200104 - <_> - - <_> - - - - <_>6 0 8 12 -1. - <_>6 0 4 6 2. - <_>10 6 4 6 2. - 0 - 0.0456560105085373 - 0.5069689154624939 - 0.2866660058498383 - <_> - - <_> - - - - <_>13 7 2 2 -1. - <_>14 7 1 1 2. - <_>13 8 1 1 2. - 0 - 1.2569549726322293e-003 - 0.4846917092800140 - 0.6318171024322510 - <_> - - <_> - - - - <_>0 12 20 6 -1. - <_>0 14 20 2 3. - 0 - -0.1201507002115250 - 0.0605261400341988 - 0.4980959892272949 - <_> - - <_> - - - - <_>14 7 2 3 -1. - <_>14 7 1 3 2. - 0 - -1.0533799650147557e-004 - 0.5363109707832336 - 0.4708042144775391 - <_> - - <_> - - - - <_>0 8 9 12 -1. - <_>3 8 3 12 3. - 0 - -0.2070319056510925 - 0.0596603304147720 - 0.4979098141193390 - <_> - - <_> - - - - <_>3 0 16 2 -1. - <_>3 0 8 2 2. - 0 - 1.2909180077258497e-004 - 0.4712977111339569 - 0.5377997756004334 - <_> - - <_> - - - - <_>6 15 3 3 -1. - <_>6 16 3 1 3. - 0 - 3.8818528992123902e-004 - 0.4363538026809692 - 0.5534191131591797 - <_> - - <_> - - - - <_>8 15 6 3 -1. - <_>8 16 6 1 3. - 0 - -2.9243610333651304e-003 - 0.5811185836791992 - 0.4825215935707092 - <_> - - <_> - - - - <_>0 10 1 6 -1. - <_>0 12 1 2 3. - 0 - 8.3882332546636462e-004 - 0.5311700105667114 - 0.4038138985633850 - <_> - - <_> - - - - <_>10 9 4 3 -1. - <_>10 10 4 1 3. - 0 - -1.9061550265178084e-003 - 0.3770701885223389 - 0.5260015130043030 - <_> - - <_> - - - - <_>9 15 2 3 -1. - <_>9 16 2 1 3. - 0 - 8.9514348655939102e-003 - 0.4766167998313904 - 0.7682183980941773 - <_> - - <_> - - - - <_>5 7 10 1 -1. - <_>5 7 5 1 2. - 0 - 0.0130834598094225 - 0.5264462828636169 - 0.3062222003936768 - <_> - - <_> - - - - <_>4 0 12 19 -1. - <_>10 0 6 19 2. - 0 - -0.2115933001041412 - 0.6737198233604431 - 0.4695810079574585 - <_> - - <_> - - - - <_>0 6 20 6 -1. - <_>10 6 10 3 2. - <_>0 9 10 3 2. - 0 - 3.1493250280618668e-003 - 0.5644835233688355 - 0.4386953115463257 - <_> - - <_> - - - - <_>3 6 2 2 -1. - <_>3 6 1 1 2. - <_>4 7 1 1 2. - 0 - 3.9754100725986063e-004 - 0.4526061117649078 - 0.5895630121231079 - <_> - - <_> - - - - <_>15 6 2 2 -1. - <_>16 6 1 1 2. - <_>15 7 1 1 2. - 0 - -1.3814480043947697e-003 - 0.6070582270622253 - 0.4942413866519928 - <_> - - <_> - - - - <_>3 6 2 2 -1. - <_>3 6 1 1 2. - <_>4 7 1 1 2. - 0 - -5.8122188784182072e-004 - 0.5998213291168213 - 0.4508252143859863 - <_> - - <_> - - - - <_>14 4 1 12 -1. - <_>14 10 1 6 2. - 0 - -2.3905329871922731e-003 - 0.4205588996410370 - 0.5223848223686218 - <_> - - <_> - - - - <_>2 5 16 10 -1. - <_>2 5 8 5 2. - <_>10 10 8 5 2. - 0 - 0.0272689294070005 - 0.5206447243690491 - 0.3563301861286163 - <_> - - <_> - - - - <_>9 17 3 2 -1. - <_>10 17 1 2 3. - 0 - -3.7658358924090862e-003 - 0.3144704103469849 - 0.5218814015388489 - <_> - - <_> - - - - <_>1 4 2 2 -1. - <_>1 5 2 1 2. - 0 - -1.4903489500284195e-003 - 0.3380196094512940 - 0.5124437212944031 - <_> - - <_> - - - - <_>5 0 15 5 -1. - <_>10 0 5 5 3. - 0 - -0.0174282304942608 - 0.5829960703849793 - 0.4919725954532623 - <_> - - <_> - - - - <_>0 0 15 5 -1. - <_>5 0 5 5 3. - 0 - -0.0152780301868916 - 0.6163144707679749 - 0.4617887139320374 - <_> - - <_> - - - - <_>11 2 2 17 -1. - <_>11 2 1 17 2. - 0 - 0.0319956094026566 - 0.5166357159614563 - 0.1712764054536820 - <_> - - <_> - - - - <_>7 2 2 17 -1. - <_>8 2 1 17 2. - 0 - -3.8256710395216942e-003 - 0.3408012092113495 - 0.5131387710571289 - <_> - - <_> - - - - <_>15 11 2 9 -1. - <_>15 11 1 9 2. - 0 - -8.5186436772346497e-003 - 0.6105518937110901 - 0.4997941851615906 - <_> - - <_> - - - - <_>3 11 2 9 -1. - <_>4 11 1 9 2. - 0 - 9.0641621500253677e-004 - 0.4327270984649658 - 0.5582311153411865 - <_> - - <_> - - - - <_>5 16 14 4 -1. - <_>5 16 7 4 2. - 0 - 0.0103448498994112 - 0.4855653047561646 - 0.5452420115470886 - 69.2298736572265630 - 15 - -1 - <_> - - - <_> - - <_> - - - - <_>1 4 18 1 -1. - <_>7 4 6 1 3. - 0 - 7.8981826081871986e-003 - 0.3332524895668030 - 0.5946462154388428 - <_> - - <_> - - - - <_>13 7 6 4 -1. - <_>16 7 3 2 2. - <_>13 9 3 2 2. - 0 - 1.6170160379260778e-003 - 0.3490641117095947 - 0.5577868819236755 - <_> - - <_> - - - - <_>9 8 2 12 -1. - <_>9 12 2 4 3. - 0 - -5.5449741194024682e-004 - 0.5542566180229187 - 0.3291530013084412 - <_> - - <_> - - - - <_>12 1 6 6 -1. - <_>12 3 6 2 3. - 0 - 1.5428980113938451e-003 - 0.3612579107284546 - 0.5545979142189026 - <_> - - <_> - - - - <_>5 2 6 6 -1. - <_>5 2 3 3 2. - <_>8 5 3 3 2. - 0 - -1.0329450014978647e-003 - 0.3530139029026032 - 0.5576140284538269 - <_> - - <_> - - - - <_>9 16 6 4 -1. - <_>12 16 3 2 2. - <_>9 18 3 2 2. - 0 - 7.7698158565908670e-004 - 0.3916778862476349 - 0.5645321011543274 - <_> - - <_> - - - - <_>1 2 18 3 -1. - <_>7 2 6 3 3. - 0 - 0.1432030051946640 - 0.4667482078075409 - 0.7023633122444153 - <_> - - <_> - - - - <_>7 4 9 10 -1. - <_>7 9 9 5 2. - 0 - -7.3866490274667740e-003 - 0.3073684871196747 - 0.5289257764816284 - <_> - - <_> - - - - <_>5 9 4 4 -1. - <_>7 9 2 4 2. - 0 - -6.2936742324382067e-004 - 0.5622118115425110 - 0.4037049114704132 - <_> - - <_> - - - - <_>11 10 3 6 -1. - <_>11 13 3 3 2. - 0 - 7.8893528552725911e-004 - 0.5267661213874817 - 0.3557874858379364 - <_> - - <_> - - - - <_>7 11 5 3 -1. - <_>7 12 5 1 3. - 0 - -0.0122280502691865 - 0.6668320894241333 - 0.4625549912452698 - <_> - - <_> - - - - <_>7 11 6 6 -1. - <_>10 11 3 3 2. - <_>7 14 3 3 2. - 0 - 3.5420239437371492e-003 - 0.5521438121795654 - 0.3869673013687134 - <_> - - <_> - - - - <_>0 0 10 9 -1. - <_>0 3 10 3 3. - 0 - -1.0585320414975286e-003 - 0.3628678023815155 - 0.5320926904678345 - <_> - - <_> - - - - <_>13 14 1 6 -1. - <_>13 16 1 2 3. - 0 - 1.4935660146875307e-005 - 0.4632444977760315 - 0.5363323092460632 - <_> - - <_> - - - - <_>0 2 3 6 -1. - <_>0 4 3 2 3. - 0 - 5.2537708543241024e-003 - 0.5132231712341309 - 0.3265708982944489 - <_> - - <_> - - - - <_>8 14 4 3 -1. - <_>8 15 4 1 3. - 0 - -8.2338023930788040e-003 - 0.6693689823150635 - 0.4774140119552612 - <_> - - <_> - - - - <_>6 14 1 6 -1. - <_>6 16 1 2 3. - 0 - 2.1866810129722580e-005 - 0.4053862094879150 - 0.5457931160926819 - <_> - - <_> - - - - <_>9 15 2 3 -1. - <_>9 16 2 1 3. - 0 - -3.8150229956954718e-003 - 0.6454995870590210 - 0.4793178141117096 - <_> - - <_> - - - - <_>6 4 3 3 -1. - <_>7 4 1 3 3. - 0 - 1.1105879675596952e-003 - 0.5270407199859619 - 0.3529678881168366 - <_> - - <_> - - - - <_>9 0 11 3 -1. - <_>9 1 11 1 3. - 0 - -5.7707689702510834e-003 - 0.3803547024726868 - 0.5352957844734192 - <_> - - <_> - - - - <_>0 6 20 3 -1. - <_>0 7 20 1 3. - 0 - -3.0158339068293571e-003 - 0.5339403152465820 - 0.3887133002281189 - <_> - - <_> - - - - <_>10 1 1 2 -1. - <_>10 2 1 1 2. - 0 - -8.5453689098358154e-004 - 0.3564616143703461 - 0.5273603796958923 - <_> - - <_> - - - - <_>9 6 2 6 -1. - <_>10 6 1 6 2. - 0 - 0.0110505102202296 - 0.4671907126903534 - 0.6849737763404846 - <_> - - <_> - - - - <_>5 8 12 1 -1. - <_>9 8 4 1 3. - 0 - 0.0426058396697044 - 0.5151473283767700 - 0.0702200904488564 - <_> - - <_> - - - - <_>3 8 12 1 -1. - <_>7 8 4 1 3. - 0 - -3.0781750101596117e-003 - 0.3041661083698273 - 0.5152602195739746 - <_> - - <_> - - - - <_>9 7 3 5 -1. - <_>10 7 1 5 3. - 0 - -5.4815728217363358e-003 - 0.6430295705795288 - 0.4897229969501495 - <_> - - <_> - - - - <_>3 9 6 2 -1. - <_>6 9 3 2 2. - 0 - 3.1881860923022032e-003 - 0.5307493209838867 - 0.3826209902763367 - <_> - - <_> - - - - <_>12 9 3 3 -1. - <_>12 10 3 1 3. - 0 - 3.5947180003859103e-004 - 0.4650047123432159 - 0.5421904921531677 - <_> - - <_> - - - - <_>7 0 6 1 -1. - <_>9 0 2 1 3. - 0 - -4.0705031715333462e-003 - 0.2849679887294769 - 0.5079116225242615 - <_> - - <_> - - - - <_>12 9 3 3 -1. - <_>12 10 3 1 3. - 0 - -0.0145941702648997 - 0.2971645891666412 - 0.5128461718559265 - <_> - - <_> - - - - <_>7 10 2 1 -1. - <_>8 10 1 1 2. - 0 - -1.1947689927183092e-004 - 0.5631098151206970 - 0.4343082010746002 - <_> - - <_> - - - - <_>6 4 9 13 -1. - <_>9 4 3 13 3. - 0 - -6.9344649091362953e-004 - 0.4403578042984009 - 0.5359959006309509 - <_> - - <_> - - - - <_>6 8 4 2 -1. - <_>6 9 4 1 2. - 0 - 1.4834799912932795e-005 - 0.3421008884906769 - 0.5164697766304016 - <_> - - <_> - - - - <_>16 2 4 6 -1. - <_>16 2 2 6 2. - 0 - 9.0296985581517220e-003 - 0.4639343023300171 - 0.6114075183868408 - <_> - - <_> - - - - <_>0 17 6 3 -1. - <_>0 18 6 1 3. - 0 - -8.0640818923711777e-003 - 0.2820158898830414 - 0.5075494050979614 - <_> - - <_> - - - - <_>10 10 3 10 -1. - <_>10 15 3 5 2. - 0 - 0.0260621197521687 - 0.5208905935287476 - 0.2688778042793274 - <_> - - <_> - - - - <_>8 7 3 5 -1. - <_>9 7 1 5 3. - 0 - 0.0173146594315767 - 0.4663713872432709 - 0.6738539934158325 - <_> - - <_> - - - - <_>10 4 4 3 -1. - <_>10 4 2 3 2. - 0 - 0.0226666405797005 - 0.5209349989891052 - 0.2212723940610886 - <_> - - <_> - - - - <_>8 4 3 8 -1. - <_>9 4 1 8 3. - 0 - -2.1965929772704840e-003 - 0.6063101291656494 - 0.4538190066814423 - <_> - - <_> - - - - <_>6 6 9 13 -1. - <_>9 6 3 13 3. - 0 - -9.5282476395368576e-003 - 0.4635204970836639 - 0.5247430801391602 - <_> - - <_> - - - - <_>6 0 8 12 -1. - <_>6 0 4 6 2. - <_>10 6 4 6 2. - 0 - 8.0943619832396507e-003 - 0.5289440155029297 - 0.3913882076740265 - <_> - - <_> - - - - <_>14 2 6 8 -1. - <_>16 2 2 8 3. - 0 - -0.0728773325681686 - 0.7752001881599426 - 0.4990234971046448 - <_> - - <_> - - - - <_>6 0 3 6 -1. - <_>7 0 1 6 3. - 0 - -6.9009521976113319e-003 - 0.2428039014339447 - 0.5048090219497681 - <_> - - <_> - - - - <_>14 2 6 8 -1. - <_>16 2 2 8 3. - 0 - -0.0113082397729158 - 0.5734364986419678 - 0.4842376112937927 - <_> - - <_> - - - - <_>0 5 6 6 -1. - <_>0 8 6 3 2. - 0 - 0.0596132017672062 - 0.5029836297035217 - 0.2524977028369904 - <_> - - <_> - - - - <_>9 12 6 2 -1. - <_>12 12 3 1 2. - <_>9 13 3 1 2. - 0 - -2.8624620754271746e-003 - 0.6073045134544373 - 0.4898459911346436 - <_> - - <_> - - - - <_>8 17 3 2 -1. - <_>9 17 1 2 3. - 0 - 4.4781449250876904e-003 - 0.5015289187431335 - 0.2220316976308823 - <_> - - <_> - - - - <_>11 6 2 2 -1. - <_>12 6 1 1 2. - <_>11 7 1 1 2. - 0 - -1.7513240454718471e-003 - 0.6614428758621216 - 0.4933868944644928 - <_> - - <_> - - - - <_>1 9 18 2 -1. - <_>7 9 6 2 3. - 0 - 0.0401634201407433 - 0.5180878043174744 - 0.3741044998168945 - <_> - - <_> - - - - <_>11 6 2 2 -1. - <_>12 6 1 1 2. - <_>11 7 1 1 2. - 0 - 3.4768949262797832e-004 - 0.4720416963100433 - 0.5818032026290894 - <_> - - <_> - - - - <_>3 4 12 8 -1. - <_>7 4 4 8 3. - 0 - 2.6551650371402502e-003 - 0.3805010914802551 - 0.5221335887908936 - <_> - - <_> - - - - <_>13 11 5 3 -1. - <_>13 12 5 1 3. - 0 - -8.7706279009580612e-003 - 0.2944166064262390 - 0.5231295228004456 - <_> - - <_> - - - - <_>9 10 2 3 -1. - <_>9 11 2 1 3. - 0 - -5.5122091434895992e-003 - 0.7346177101135254 - 0.4722816944122315 - <_> - - <_> - - - - <_>14 7 2 3 -1. - <_>14 7 1 3 2. - 0 - 6.8672042107209563e-004 - 0.5452876091003418 - 0.4242413043975830 - <_> - - <_> - - - - <_>5 4 1 3 -1. - <_>5 5 1 1 3. - 0 - 5.6019669864326715e-004 - 0.4398862123489380 - 0.5601285099983215 - <_> - - <_> - - - - <_>13 4 2 3 -1. - <_>13 5 2 1 3. - 0 - 2.4143769405782223e-003 - 0.4741686880588532 - 0.6136621832847595 - <_> - - <_> - - - - <_>5 4 2 3 -1. - <_>5 5 2 1 3. - 0 - -1.5680900542065501e-003 - 0.6044552922248840 - 0.4516409933567047 - <_> - - <_> - - - - <_>9 8 2 3 -1. - <_>9 9 2 1 3. - 0 - -3.6827491130679846e-003 - 0.2452459037303925 - 0.5294982194900513 - <_> - - <_> - - - - <_>8 9 2 2 -1. - <_>8 10 2 1 2. - 0 - -2.9409190756268799e-004 - 0.3732838034629822 - 0.5251451134681702 - <_> - - <_> - - - - <_>15 14 1 4 -1. - <_>15 16 1 2 2. - 0 - 4.2847759323194623e-004 - 0.5498809814453125 - 0.4065535068511963 - <_> - - <_> - - - - <_>3 12 2 2 -1. - <_>3 13 2 1 2. - 0 - -4.8817070201039314e-003 - 0.2139908969402313 - 0.4999957084655762 - <_> - - <_> - - - - <_>12 15 2 2 -1. - <_>13 15 1 1 2. - <_>12 16 1 1 2. - 0 - 2.7272020815871656e-004 - 0.4650287032127380 - 0.5813428759574890 - <_> - - <_> - - - - <_>9 13 2 2 -1. - <_>9 14 2 1 2. - 0 - 2.0947199664078653e-004 - 0.4387486875057221 - 0.5572792887687683 - <_> - - <_> - - - - <_>4 11 14 9 -1. - <_>4 14 14 3 3. - 0 - 0.0485011897981167 - 0.5244972705841065 - 0.3212889134883881 - <_> - - <_> - - - - <_>7 13 4 3 -1. - <_>7 14 4 1 3. - 0 - -4.5166411437094212e-003 - 0.6056813001632690 - 0.4545882046222687 - <_> - - <_> - - - - <_>15 14 1 4 -1. - <_>15 16 1 2 2. - 0 - -0.0122916800901294 - 0.2040929049253464 - 0.5152214169502258 - <_> - - <_> - - - - <_>4 14 1 4 -1. - <_>4 16 1 2 2. - 0 - 4.8549679922871292e-004 - 0.5237604975700378 - 0.3739503026008606 - <_> - - <_> - - - - <_>14 0 6 13 -1. - <_>16 0 2 13 3. - 0 - 0.0305560491979122 - 0.4960533976554871 - 0.5938246250152588 - <_> - - <_> - - - - <_>4 1 2 12 -1. - <_>4 1 1 6 2. - <_>5 7 1 6 2. - 0 - -1.5105320198927075e-004 - 0.5351303815841675 - 0.4145204126834869 - <_> - - <_> - - - - <_>11 14 6 6 -1. - <_>14 14 3 3 2. - <_>11 17 3 3 2. - 0 - 2.4937440175563097e-003 - 0.4693366885185242 - 0.5514941215515137 - <_> - - <_> - - - - <_>3 14 6 6 -1. - <_>3 14 3 3 2. - <_>6 17 3 3 2. - 0 - -0.0123821301385760 - 0.6791396737098694 - 0.4681667983531952 - <_> - - <_> - - - - <_>14 17 3 2 -1. - <_>14 18 3 1 2. - 0 - -5.1333461888134480e-003 - 0.3608739078044891 - 0.5229160189628601 - <_> - - <_> - - - - <_>3 17 3 2 -1. - <_>3 18 3 1 2. - 0 - 5.1919277757406235e-004 - 0.5300073027610779 - 0.3633613884449005 - <_> - - <_> - - - - <_>14 0 6 13 -1. - <_>16 0 2 13 3. - 0 - 0.1506042033433914 - 0.5157316923141480 - 0.2211782038211823 - <_> - - <_> - - - - <_>0 0 6 13 -1. - <_>2 0 2 13 3. - 0 - 7.7144149690866470e-003 - 0.4410496950149536 - 0.5776609182357788 - <_> - - <_> - - - - <_>10 10 7 6 -1. - <_>10 12 7 2 3. - 0 - 9.4443522393703461e-003 - 0.5401855111122131 - 0.3756650090217590 - <_> - - <_> - - - - <_>6 15 2 2 -1. - <_>6 15 1 1 2. - <_>7 16 1 1 2. - 0 - 2.5006249779835343e-004 - 0.4368270933628082 - 0.5607374906539917 - <_> - - <_> - - - - <_>6 11 8 6 -1. - <_>10 11 4 3 2. - <_>6 14 4 3 2. - 0 - -3.3077150583267212e-003 - 0.4244799017906189 - 0.5518230795860291 - <_> - - <_> - - - - <_>7 6 2 2 -1. - <_>7 6 1 1 2. - <_>8 7 1 1 2. - 0 - 7.4048910755664110e-004 - 0.4496962130069733 - 0.5900576710700989 - <_> - - <_> - - - - <_>2 2 16 6 -1. - <_>10 2 8 3 2. - <_>2 5 8 3 2. - 0 - 0.0440920516848564 - 0.5293493270874023 - 0.3156355023384094 - <_> - - <_> - - - - <_>5 4 3 3 -1. - <_>5 5 3 1 3. - 0 - 3.3639909233897924e-003 - 0.4483296871185303 - 0.5848662257194519 - <_> - - <_> - - - - <_>11 7 3 10 -1. - <_>11 12 3 5 2. - 0 - -3.9760079234838486e-003 - 0.4559507071971893 - 0.5483639240264893 - <_> - - <_> - - - - <_>6 7 3 10 -1. - <_>6 12 3 5 2. - 0 - 2.7716930489987135e-003 - 0.5341786146163940 - 0.3792484104633331 - <_> - - <_> - - - - <_>10 7 3 2 -1. - <_>11 7 1 2 3. - 0 - -2.4123019829858094e-004 - 0.5667188763618469 - 0.4576973021030426 - <_> - - <_> - - - - <_>8 12 4 2 -1. - <_>8 13 4 1 2. - 0 - 4.9425667384639382e-004 - 0.4421244859695435 - 0.5628787279129028 - <_> - - <_> - - - - <_>10 1 1 3 -1. - <_>10 2 1 1 3. - 0 - -3.8876468897797167e-004 - 0.4288370907306671 - 0.5391063094139099 - <_> - - <_> - - - - <_>1 2 4 18 -1. - <_>1 2 2 9 2. - <_>3 11 2 9 2. - 0 - -0.0500488989055157 - 0.6899513006210327 - 0.4703742861747742 - <_> - - <_> - - - - <_>12 4 4 12 -1. - <_>12 10 4 6 2. - 0 - -0.0366354808211327 - 0.2217779010534287 - 0.5191826224327087 - <_> - - <_> - - - - <_>0 0 1 6 -1. - <_>0 2 1 2 3. - 0 - 2.4273579474538565e-003 - 0.5136224031448364 - 0.3497397899627686 - <_> - - <_> - - - - <_>9 11 2 3 -1. - <_>9 12 2 1 3. - 0 - 1.9558030180633068e-003 - 0.4826192855834961 - 0.6408380866050720 - <_> - - <_> - - - - <_>8 7 4 3 -1. - <_>8 8 4 1 3. - 0 - -1.7494610510766506e-003 - 0.3922835886478424 - 0.5272685289382935 - <_> - - <_> - - - - <_>10 7 3 2 -1. - <_>11 7 1 2 3. - 0 - 0.0139550799503922 - 0.5078201889991760 - 0.8416504859924316 - <_> - - <_> - - - - <_>7 7 3 2 -1. - <_>8 7 1 2 3. - 0 - -2.1896739781368524e-004 - 0.5520489811897278 - 0.4314234852790833 - <_> - - <_> - - - - <_>9 4 6 1 -1. - <_>11 4 2 1 3. - 0 - -1.5131309628486633e-003 - 0.3934605121612549 - 0.5382571220397949 - <_> - - <_> - - - - <_>8 7 2 3 -1. - <_>9 7 1 3 2. - 0 - -4.3622800149023533e-003 - 0.7370628714561462 - 0.4736475944519043 - <_> - - <_> - - - - <_>12 7 8 6 -1. - <_>16 7 4 3 2. - <_>12 10 4 3 2. - 0 - 0.0651605874300003 - 0.5159279704093933 - 0.3281595110893250 - <_> - - <_> - - - - <_>0 7 8 6 -1. - <_>0 7 4 3 2. - <_>4 10 4 3 2. - 0 - -2.3567399475723505e-003 - 0.3672826886177063 - 0.5172886252403259 - <_> - - <_> - - - - <_>18 2 2 10 -1. - <_>19 2 1 5 2. - <_>18 7 1 5 2. - 0 - 0.0151466596871614 - 0.5031493902206421 - 0.6687604188919067 - <_> - - <_> - - - - <_>0 2 6 4 -1. - <_>3 2 3 4 2. - 0 - -0.0228509604930878 - 0.6767519712448120 - 0.4709596931934357 - <_> - - <_> - - - - <_>9 4 6 1 -1. - <_>11 4 2 1 3. - 0 - 4.8867650330066681e-003 - 0.5257998108863831 - 0.4059878885746002 - <_> - - <_> - - - - <_>7 15 2 2 -1. - <_>7 15 1 1 2. - <_>8 16 1 1 2. - 0 - 1.7619599821045995e-003 - 0.4696272909641266 - 0.6688278913497925 - <_> - - <_> - - - - <_>11 13 1 6 -1. - <_>11 16 1 3 2. - 0 - -1.2942519970238209e-003 - 0.4320712983608246 - 0.5344281792640686 - <_> - - <_> - - - - <_>8 13 1 6 -1. - <_>8 16 1 3 2. - 0 - 0.0109299495816231 - 0.4997706115245819 - 0.1637486070394516 - <_> - - <_> - - - - <_>14 3 2 1 -1. - <_>14 3 1 1 2. - 0 - 2.9958489903947338e-005 - 0.4282417893409729 - 0.5633224248886108 - <_> - - <_> - - - - <_>8 15 2 3 -1. - <_>8 16 2 1 3. - 0 - -6.5884361974895000e-003 - 0.6772121191024780 - 0.4700526893138886 - <_> - - <_> - - - - <_>12 15 7 4 -1. - <_>12 17 7 2 2. - 0 - 3.2527779694646597e-003 - 0.5313397049903870 - 0.4536148905754089 - <_> - - <_> - - - - <_>4 14 12 3 -1. - <_>4 15 12 1 3. - 0 - -4.0435739792883396e-003 - 0.5660061836242676 - 0.4413388967514038 - <_> - - <_> - - - - <_>10 3 3 2 -1. - <_>11 3 1 2 3. - 0 - -1.2523540062829852e-003 - 0.3731913864612579 - 0.5356451869010925 - <_> - - <_> - - - - <_>4 12 2 2 -1. - <_>4 13 2 1 2. - 0 - 1.9246719602961093e-004 - 0.5189986228942871 - 0.3738811016082764 - <_> - - <_> - - - - <_>10 11 4 6 -1. - <_>10 14 4 3 2. - 0 - -0.0385896712541580 - 0.2956373989582062 - 0.5188810825347900 - <_> - - <_> - - - - <_>7 13 2 2 -1. - <_>7 13 1 1 2. - <_>8 14 1 1 2. - 0 - 1.5489870565943420e-004 - 0.4347135126590729 - 0.5509533286094666 - <_> - - <_> - - - - <_>4 11 14 4 -1. - <_>11 11 7 2 2. - <_>4 13 7 2 2. - 0 - -0.0337638482451439 - 0.3230330049991608 - 0.5195475816726685 - <_> - - <_> - - - - <_>1 18 18 2 -1. - <_>7 18 6 2 3. - 0 - -8.2657067105174065e-003 - 0.5975489020347595 - 0.4552114009857178 - <_> - - <_> - - - - <_>11 18 2 2 -1. - <_>12 18 1 1 2. - <_>11 19 1 1 2. - 0 - 1.4481440302915871e-005 - 0.4745678007602692 - 0.5497426986694336 - <_> - - <_> - - - - <_>7 18 2 2 -1. - <_>7 18 1 1 2. - <_>8 19 1 1 2. - 0 - 1.4951299817766994e-005 - 0.4324473142623901 - 0.5480644106864929 - <_> - - <_> - - - - <_>12 18 8 2 -1. - <_>12 19 8 1 2. - 0 - -0.0187417995184660 - 0.1580052971839905 - 0.5178533196449280 - <_> - - <_> - - - - <_>7 14 6 2 -1. - <_>7 15 6 1 2. - 0 - 1.7572239739820361e-003 - 0.4517636895179749 - 0.5773764252662659 - <_> - - <_> - - - - <_>8 12 4 8 -1. - <_>10 12 2 4 2. - <_>8 16 2 4 2. - 0 - -3.1391119118779898e-003 - 0.4149647951126099 - 0.5460842251777649 - <_> - - <_> - - - - <_>4 9 3 3 -1. - <_>4 10 3 1 3. - 0 - 6.6656779381446540e-005 - 0.4039090871810913 - 0.5293084979057312 - <_> - - <_> - - - - <_>7 10 6 2 -1. - <_>9 10 2 2 3. - 0 - 6.7743421532213688e-003 - 0.4767651855945587 - 0.6121956110000610 - <_> - - <_> - - - - <_>5 0 4 15 -1. - <_>7 0 2 15 2. - 0 - -7.3868161998689175e-003 - 0.3586258888244629 - 0.5187280774116516 - <_> - - <_> - - - - <_>8 6 12 14 -1. - <_>12 6 4 14 3. - 0 - 0.0140409301966429 - 0.4712139964103699 - 0.5576155781745911 - <_> - - <_> - - - - <_>5 16 3 3 -1. - <_>5 17 3 1 3. - 0 - -5.5258329957723618e-003 - 0.2661027014255524 - 0.5039281249046326 - <_> - - <_> - - - - <_>8 1 12 19 -1. - <_>12 1 4 19 3. - 0 - 0.3868423998355866 - 0.5144339799880981 - 0.2525899112224579 - <_> - - <_> - - - - <_>3 0 3 2 -1. - <_>3 1 3 1 2. - 0 - 1.1459240340627730e-004 - 0.4284994900226593 - 0.5423371195793152 - <_> - - <_> - - - - <_>10 12 4 5 -1. - <_>10 12 2 5 2. - 0 - -0.0184675697237253 - 0.3885835111141205 - 0.5213062167167664 - <_> - - <_> - - - - <_>6 12 4 5 -1. - <_>8 12 2 5 2. - 0 - -4.5907011372037232e-004 - 0.5412563085556030 - 0.4235909879207611 - <_> - - <_> - - - - <_>11 11 2 2 -1. - <_>12 11 1 1 2. - <_>11 12 1 1 2. - 0 - 1.2527540093287826e-003 - 0.4899305105209351 - 0.6624091267585754 - <_> - - <_> - - - - <_>0 2 3 6 -1. - <_>0 4 3 2 3. - 0 - 1.4910609461367130e-003 - 0.5286778211593628 - 0.4040051996707916 - <_> - - <_> - - - - <_>11 11 2 2 -1. - <_>12 11 1 1 2. - <_>11 12 1 1 2. - 0 - -7.5435562757775187e-004 - 0.6032990217208862 - 0.4795120060443878 - <_> - - <_> - - - - <_>7 6 4 10 -1. - <_>7 11 4 5 2. - 0 - -6.9478838704526424e-003 - 0.4084401130676270 - 0.5373504161834717 - <_> - - <_> - - - - <_>11 11 2 2 -1. - <_>12 11 1 1 2. - <_>11 12 1 1 2. - 0 - 2.8092920547351241e-004 - 0.4846062958240509 - 0.5759382247924805 - <_> - - <_> - - - - <_>2 13 5 2 -1. - <_>2 14 5 1 2. - 0 - 9.6073717577382922e-004 - 0.5164741277694702 - 0.3554979860782623 - <_> - - <_> - - - - <_>11 11 2 2 -1. - <_>12 11 1 1 2. - <_>11 12 1 1 2. - 0 - -2.6883929967880249e-004 - 0.5677582025527954 - 0.4731765985488892 - <_> - - <_> - - - - <_>7 11 2 2 -1. - <_>7 11 1 1 2. - <_>8 12 1 1 2. - 0 - 2.1599370520561934e-003 - 0.4731487035751343 - 0.7070567011833191 - <_> - - <_> - - - - <_>14 13 3 3 -1. - <_>14 14 3 1 3. - 0 - 5.6235301308333874e-003 - 0.5240243077278137 - 0.2781791985034943 - <_> - - <_> - - - - <_>3 13 3 3 -1. - <_>3 14 3 1 3. - 0 - -5.0243991427123547e-003 - 0.2837013900279999 - 0.5062304139137268 - <_> - - <_> - - - - <_>9 14 2 3 -1. - <_>9 15 2 1 3. - 0 - -9.7611639648675919e-003 - 0.7400717735290527 - 0.4934569001197815 - <_> - - <_> - - - - <_>8 7 3 3 -1. - <_>8 8 3 1 3. - 0 - 4.1515100747346878e-003 - 0.5119131207466126 - 0.3407008051872253 - <_> - - <_> - - - - <_>13 5 3 3 -1. - <_>13 6 3 1 3. - 0 - 6.2465080991387367e-003 - 0.4923788011074066 - 0.6579058766365051 - <_> - - <_> - - - - <_>0 9 5 3 -1. - <_>0 10 5 1 3. - 0 - -7.0597478188574314e-003 - 0.2434711009263992 - 0.5032842159271240 - <_> - - <_> - - - - <_>13 5 3 3 -1. - <_>13 6 3 1 3. - 0 - -2.0587709732353687e-003 - 0.5900310873985291 - 0.4695087075233460 - <_> - - <_> - - - - <_>9 12 2 8 -1. - <_>9 12 1 4 2. - <_>10 16 1 4 2. - 0 - -2.4146060459315777e-003 - 0.3647317886352539 - 0.5189201831817627 - <_> - - <_> - - - - <_>11 7 2 2 -1. - <_>12 7 1 1 2. - <_>11 8 1 1 2. - 0 - -1.4817609917372465e-003 - 0.6034948229789734 - 0.4940128028392792 - <_> - - <_> - - - - <_>0 16 6 4 -1. - <_>3 16 3 4 2. - 0 - -6.3016400672495365e-003 - 0.5818989872932434 - 0.4560427963733673 - <_> - - <_> - - - - <_>10 6 2 3 -1. - <_>10 7 2 1 3. - 0 - 3.4763428848236799e-003 - 0.5217475891113281 - 0.3483993113040924 - <_> - - <_> - - - - <_>9 5 2 6 -1. - <_>9 7 2 2 3. - 0 - -0.0222508702427149 - 0.2360700070858002 - 0.5032082796096802 - <_> - - <_> - - - - <_>12 15 8 4 -1. - <_>12 15 4 4 2. - 0 - -0.0306125506758690 - 0.6499186754226685 - 0.4914919137954712 - <_> - - <_> - - - - <_>0 14 8 6 -1. - <_>4 14 4 6 2. - 0 - 0.0130574796348810 - 0.4413323104381561 - 0.5683764219284058 - <_> - - <_> - - - - <_>9 0 3 2 -1. - <_>10 0 1 2 3. - 0 - -6.0095742810517550e-004 - 0.4359731078147888 - 0.5333483219146729 - <_> - - <_> - - - - <_>4 15 4 2 -1. - <_>6 15 2 2 2. - 0 - -4.1514250915497541e-004 - 0.5504062771797180 - 0.4326060116291046 - <_> - - <_> - - - - <_>12 7 3 13 -1. - <_>13 7 1 13 3. - 0 - -0.0137762902304530 - 0.4064112901687622 - 0.5201548933982849 - <_> - - <_> - - - - <_>5 7 3 13 -1. - <_>6 7 1 13 3. - 0 - -0.0322965085506439 - 0.0473519712686539 - 0.4977194964885712 - <_> - - <_> - - - - <_>9 6 3 9 -1. - <_>9 9 3 3 3. - 0 - 0.0535569787025452 - 0.4881733059883118 - 0.6666939258575440 - <_> - - <_> - - - - <_>4 4 7 12 -1. - <_>4 10 7 6 2. - 0 - 8.1889545544981956e-003 - 0.5400037169456482 - 0.4240820109844208 - <_> - - <_> - - - - <_>12 12 2 2 -1. - <_>13 12 1 1 2. - <_>12 13 1 1 2. - 0 - 2.1055320394225419e-004 - 0.4802047908306122 - 0.5563852787017822 - <_> - - <_> - - - - <_>6 12 2 2 -1. - <_>6 12 1 1 2. - <_>7 13 1 1 2. - 0 - -2.4382730480283499e-003 - 0.7387793064117432 - 0.4773685038089752 - <_> - - <_> - - - - <_>8 9 4 2 -1. - <_>10 9 2 1 2. - <_>8 10 2 1 2. - 0 - 3.2835570164024830e-003 - 0.5288546085357666 - 0.3171291947364807 - <_> - - <_> - - - - <_>3 6 2 2 -1. - <_>3 6 1 1 2. - <_>4 7 1 1 2. - 0 - 2.3729570675641298e-003 - 0.4750812947750092 - 0.7060170769691467 - <_> - - <_> - - - - <_>16 6 3 2 -1. - <_>16 7 3 1 2. - 0 - -1.4541699783876538e-003 - 0.3811730146408081 - 0.5330739021301270 - 79.2490768432617190 - 16 - -1 - <_> - - - <_> - - <_> - - - - <_>0 7 19 4 -1. - <_>0 9 19 2 2. - 0 - 0.0557552389800549 - 0.4019156992435455 - 0.6806036829948425 - <_> - - <_> - - - - <_>10 2 10 1 -1. - <_>10 2 5 1 2. - 0 - 2.4730248842388391e-003 - 0.3351148962974548 - 0.5965719819068909 - <_> - - <_> - - - - <_>9 4 2 12 -1. - <_>9 10 2 6 2. - 0 - -3.5031698644161224e-004 - 0.5557708144187927 - 0.3482286930084229 - <_> - - <_> - - - - <_>12 18 4 1 -1. - <_>12 18 2 1 2. - 0 - 5.4167630150914192e-004 - 0.4260858893394470 - 0.5693380832672119 - <_> - - <_> - - - - <_>1 7 6 4 -1. - <_>1 7 3 2 2. - <_>4 9 3 2 2. - 0 - 7.7193678589537740e-004 - 0.3494240045547485 - 0.5433688759803772 - <_> - - <_> - - - - <_>12 0 6 13 -1. - <_>14 0 2 13 3. - 0 - -1.5999219613149762e-003 - 0.4028499126434326 - 0.5484359264373779 - <_> - - <_> - - - - <_>2 0 6 13 -1. - <_>4 0 2 13 3. - 0 - -1.1832080053864047e-004 - 0.3806901872158051 - 0.5425465106964111 - <_> - - <_> - - - - <_>10 5 8 8 -1. - <_>10 9 8 4 2. - 0 - 3.2909031142480671e-004 - 0.2620100080966950 - 0.5429521799087524 - <_> - - <_> - - - - <_>8 3 2 5 -1. - <_>9 3 1 5 2. - 0 - 2.9518108931370080e-004 - 0.3799768984317780 - 0.5399264097213745 - <_> - - <_> - - - - <_>8 4 9 1 -1. - <_>11 4 3 1 3. - 0 - 9.0466710389591753e-005 - 0.4433645009994507 - 0.5440226197242737 - <_> - - <_> - - - - <_>3 4 9 1 -1. - <_>6 4 3 1 3. - 0 - 1.5007190086180344e-005 - 0.3719654977321625 - 0.5409119725227356 - <_> - - <_> - - - - <_>1 0 18 10 -1. - <_>7 0 6 10 3. - 0 - 0.1393561065196991 - 0.5525395870208740 - 0.4479042887687683 - <_> - - <_> - - - - <_>7 17 5 3 -1. - <_>7 18 5 1 3. - 0 - 1.6461990308016539e-003 - 0.4264501035213471 - 0.5772169828414917 - <_> - - <_> - - - - <_>7 11 6 1 -1. - <_>9 11 2 1 3. - 0 - 4.9984431825578213e-004 - 0.4359526038169861 - 0.5685871243476868 - <_> - - <_> - - - - <_>2 2 3 2 -1. - <_>2 3 3 1 2. - 0 - -1.0971280280500650e-003 - 0.3390136957168579 - 0.5205408930778503 - <_> - - <_> - - - - <_>8 12 4 2 -1. - <_>8 13 4 1 2. - 0 - 6.6919892560690641e-004 - 0.4557456076145172 - 0.5980659723281860 - <_> - - <_> - - - - <_>6 10 3 6 -1. - <_>6 13 3 3 2. - 0 - 8.6471042595803738e-004 - 0.5134841203689575 - 0.2944033145904541 - <_> - - <_> - - - - <_>11 4 2 4 -1. - <_>11 4 1 4 2. - 0 - -2.7182599296793342e-004 - 0.3906578123569489 - 0.5377181172370911 - <_> - - <_> - - - - <_>7 4 2 4 -1. - <_>8 4 1 4 2. - 0 - 3.0249499104684219e-005 - 0.3679609894752502 - 0.5225688815116882 - <_> - - <_> - - - - <_>9 6 2 4 -1. - <_>9 6 1 4 2. - 0 - -8.5225896909832954e-003 - 0.7293102145195007 - 0.4892365038394928 - <_> - - <_> - - - - <_>6 13 8 3 -1. - <_>6 14 8 1 3. - 0 - 1.6705560265108943e-003 - 0.4345324933528900 - 0.5696138143539429 - <_> - - <_> - - - - <_>9 15 3 4 -1. - <_>10 15 1 4 3. - 0 - -7.1433838456869125e-003 - 0.2591280043125153 - 0.5225623846054077 - <_> - - <_> - - - - <_>9 2 2 17 -1. - <_>10 2 1 17 2. - 0 - -0.0163193698972464 - 0.6922279000282288 - 0.4651575982570648 - <_> - - <_> - - - - <_>7 0 6 1 -1. - <_>9 0 2 1 3. - 0 - 4.8034260980784893e-003 - 0.5352262854576111 - 0.3286302983760834 - <_> - - <_> - - - - <_>8 15 3 4 -1. - <_>9 15 1 4 3. - 0 - -7.5421929359436035e-003 - 0.2040544003248215 - 0.5034546256065369 - <_> - - <_> - - - - <_>7 13 7 3 -1. - <_>7 14 7 1 3. - 0 - -0.0143631100654602 - 0.6804888844490051 - 0.4889059066772461 - <_> - - <_> - - - - <_>8 16 3 3 -1. - <_>9 16 1 3 3. - 0 - 8.9063588529825211e-004 - 0.5310695767402649 - 0.3895480930805206 - <_> - - <_> - - - - <_>6 2 8 10 -1. - <_>6 7 8 5 2. - 0 - -4.4060191139578819e-003 - 0.5741562843322754 - 0.4372426867485046 - <_> - - <_> - - - - <_>2 5 8 8 -1. - <_>2 9 8 4 2. - 0 - -1.8862540309783071e-004 - 0.2831785976886749 - 0.5098205208778381 - <_> - - <_> - - - - <_>14 16 2 2 -1. - <_>14 17 2 1 2. - 0 - -3.7979281041771173e-003 - 0.3372507989406586 - 0.5246580243110657 - <_> - - <_> - - - - <_>4 16 2 2 -1. - <_>4 17 2 1 2. - 0 - 1.4627049677073956e-004 - 0.5306674242019653 - 0.3911710083484650 - <_> - - <_> - - - - <_>10 11 4 6 -1. - <_>10 14 4 3 2. - 0 - -4.9164638767251745e-005 - 0.5462496280670166 - 0.3942720890045166 - <_> - - <_> - - - - <_>6 11 4 6 -1. - <_>6 14 4 3 2. - 0 - -0.0335825011134148 - 0.2157824039459229 - 0.5048211812973023 - <_> - - <_> - - - - <_>10 14 1 3 -1. - <_>10 15 1 1 3. - 0 - -3.5339309833943844e-003 - 0.6465312242507935 - 0.4872696995735169 - <_> - - <_> - - - - <_>8 14 4 3 -1. - <_>8 15 4 1 3. - 0 - 5.0144111737608910e-003 - 0.4617668092250824 - 0.6248074769973755 - <_> - - <_> - - - - <_>10 0 4 6 -1. - <_>12 0 2 3 2. - <_>10 3 2 3 2. - 0 - 0.0188173707574606 - 0.5220689177513123 - 0.2000052034854889 - <_> - - <_> - - - - <_>0 3 20 2 -1. - <_>0 4 20 1 2. - 0 - -1.3434339780360460e-003 - 0.4014537930488586 - 0.5301619768142700 - <_> - - <_> - - - - <_>12 0 8 2 -1. - <_>16 0 4 1 2. - <_>12 1 4 1 2. - 0 - 1.7557960236445069e-003 - 0.4794039130210877 - 0.5653169751167297 - <_> - - <_> - - - - <_>2 12 10 8 -1. - <_>2 16 10 4 2. - 0 - -0.0956374630331993 - 0.2034195065498352 - 0.5006706714630127 - <_> - - <_> - - - - <_>17 7 2 10 -1. - <_>18 7 1 5 2. - <_>17 12 1 5 2. - 0 - -0.0222412291914225 - 0.7672473192214966 - 0.5046340227127075 - <_> - - <_> - - - - <_>1 7 2 10 -1. - <_>1 7 1 5 2. - <_>2 12 1 5 2. - 0 - -0.0155758196488023 - 0.7490342259407044 - 0.4755851030349731 - <_> - - <_> - - - - <_>15 10 3 6 -1. - <_>15 12 3 2 3. - 0 - 5.3599118255078793e-003 - 0.5365303754806519 - 0.4004670977592468 - <_> - - <_> - - - - <_>4 4 6 2 -1. - <_>6 4 2 2 3. - 0 - -0.0217634998261929 - 0.0740154981613159 - 0.4964174926280975 - <_> - - <_> - - - - <_>0 5 20 6 -1. - <_>0 7 20 2 3. - 0 - -0.1656159013509750 - 0.2859103083610535 - 0.5218086242675781 - <_> - - <_> - - - - <_>0 0 8 2 -1. - <_>0 0 4 1 2. - <_>4 1 4 1 2. - 0 - 1.6461320046801120e-004 - 0.4191615879535675 - 0.5380793213844299 - <_> - - <_> - - - - <_>1 0 18 4 -1. - <_>7 0 6 4 3. - 0 - -8.9077502489089966e-003 - 0.6273192763328552 - 0.4877404868602753 - <_> - - <_> - - - - <_>1 13 6 2 -1. - <_>1 14 6 1 2. - 0 - 8.6346449097618461e-004 - 0.5159940719604492 - 0.3671025931835175 - <_> - - <_> - - - - <_>10 8 3 4 -1. - <_>11 8 1 4 3. - 0 - -1.3751760125160217e-003 - 0.5884376764297485 - 0.4579083919525147 - <_> - - <_> - - - - <_>6 1 6 1 -1. - <_>8 1 2 1 3. - 0 - -1.4081239933148026e-003 - 0.3560509979724884 - 0.5139945149421692 - <_> - - <_> - - - - <_>8 14 4 3 -1. - <_>8 15 4 1 3. - 0 - -3.9342888630926609e-003 - 0.5994288921356201 - 0.4664272069931030 - <_> - - <_> - - - - <_>1 6 18 2 -1. - <_>10 6 9 2 2. - 0 - -0.0319669283926487 - 0.3345462083816528 - 0.5144183039665222 - <_> - - <_> - - - - <_>15 11 1 2 -1. - <_>15 12 1 1 2. - 0 - -1.5089280168467667e-005 - 0.5582656264305115 - 0.4414057135581970 - <_> - - <_> - - - - <_>6 5 1 2 -1. - <_>6 6 1 1 2. - 0 - 5.1994470413774252e-004 - 0.4623680114746094 - 0.6168993711471558 - <_> - - <_> - - - - <_>13 4 1 3 -1. - <_>13 5 1 1 3. - 0 - -3.4220460802316666e-003 - 0.6557074785232544 - 0.4974805116653442 - <_> - - <_> - - - - <_>2 15 1 2 -1. - <_>2 16 1 1 2. - 0 - 1.7723299970384687e-004 - 0.5269501805305481 - 0.3901908099651337 - <_> - - <_> - - - - <_>12 4 4 3 -1. - <_>12 5 4 1 3. - 0 - 1.5716759953647852e-003 - 0.4633373022079468 - 0.5790457725524902 - <_> - - <_> - - - - <_>0 0 7 3 -1. - <_>0 1 7 1 3. - 0 - -8.9041329920291901e-003 - 0.2689608037471771 - 0.5053591132164002 - <_> - - <_> - - - - <_>9 12 6 2 -1. - <_>9 12 3 2 2. - 0 - 4.0677518700249493e-004 - 0.5456603169441223 - 0.4329898953437805 - <_> - - <_> - - - - <_>5 4 2 3 -1. - <_>5 5 2 1 3. - 0 - 6.7604780197143555e-003 - 0.4648993909358978 - 0.6689761877059937 - <_> - - <_> - - - - <_>18 4 2 3 -1. - <_>18 5 2 1 3. - 0 - 2.9100088868290186e-003 - 0.5309703946113586 - 0.3377839922904968 - <_> - - <_> - - - - <_>3 0 8 6 -1. - <_>3 2 8 2 3. - 0 - 1.3885459629818797e-003 - 0.4074738919734955 - 0.5349133014678955 - <_> - - <_> - - - - <_>0 2 20 6 -1. - <_>10 2 10 3 2. - <_>0 5 10 3 2. - 0 - -0.0767642632126808 - 0.1992176026105881 - 0.5228242278099060 - <_> - - <_> - - - - <_>4 7 2 4 -1. - <_>5 7 1 4 2. - 0 - -2.2688310127705336e-004 - 0.5438501834869385 - 0.4253072142601013 - <_> - - <_> - - - - <_>3 10 15 2 -1. - <_>8 10 5 2 3. - 0 - -6.3094152137637138e-003 - 0.4259178936481476 - 0.5378909707069397 - <_> - - <_> - - - - <_>3 0 12 11 -1. - <_>9 0 6 11 2. - 0 - -0.1100727990269661 - 0.6904156804084778 - 0.4721749126911163 - <_> - - <_> - - - - <_>13 0 2 6 -1. - <_>13 0 1 6 2. - 0 - 2.8619659133255482e-004 - 0.4524914920330048 - 0.5548306107521057 - <_> - - <_> - - - - <_>0 19 2 1 -1. - <_>1 19 1 1 2. - 0 - 2.9425329557852820e-005 - 0.5370373725891113 - 0.4236463904380798 - <_> - - <_> - - - - <_>16 10 4 10 -1. - <_>18 10 2 5 2. - <_>16 15 2 5 2. - 0 - -0.0248865708708763 - 0.6423557996749878 - 0.4969303905963898 - <_> - - <_> - - - - <_>4 8 10 3 -1. - <_>4 9 10 1 3. - 0 - 0.0331488512456417 - 0.4988475143909454 - 0.1613811999559403 - <_> - - <_> - - - - <_>14 12 3 3 -1. - <_>14 13 3 1 3. - 0 - 7.8491691965609789e-004 - 0.5416026115417481 - 0.4223009049892426 - <_> - - <_> - - - - <_>0 10 4 10 -1. - <_>0 10 2 5 2. - <_>2 15 2 5 2. - 0 - 4.7087189741432667e-003 - 0.4576328992843628 - 0.6027557849884033 - <_> - - <_> - - - - <_>18 3 2 6 -1. - <_>18 5 2 2 3. - 0 - 2.4144479539245367e-003 - 0.5308973193168640 - 0.4422498941421509 - <_> - - <_> - - - - <_>6 6 1 3 -1. - <_>6 7 1 1 3. - 0 - 1.9523180089890957e-003 - 0.4705634117126465 - 0.6663324832916260 - <_> - - <_> - - - - <_>7 7 7 2 -1. - <_>7 8 7 1 2. - 0 - 1.3031980488449335e-003 - 0.4406126141548157 - 0.5526962280273438 - <_> - - <_> - - - - <_>0 3 2 6 -1. - <_>0 5 2 2 3. - 0 - 4.4735497795045376e-003 - 0.5129023790359497 - 0.3301498889923096 - <_> - - <_> - - - - <_>11 1 3 1 -1. - <_>12 1 1 1 3. - 0 - -2.6652868837118149e-003 - 0.3135471045970917 - 0.5175036191940308 - <_> - - <_> - - - - <_>5 0 2 6 -1. - <_>6 0 1 6 2. - 0 - 1.3666770246345550e-004 - 0.4119370877742767 - 0.5306876897811890 - <_> - - <_> - - - - <_>1 1 18 14 -1. - <_>7 1 6 14 3. - 0 - -0.0171264503151178 - 0.6177806258201599 - 0.4836578965187073 - <_> - - <_> - - - - <_>4 6 8 3 -1. - <_>8 6 4 3 2. - 0 - -2.6601430727168918e-004 - 0.3654330968856812 - 0.5169736742973328 - <_> - - <_> - - - - <_>9 12 6 2 -1. - <_>9 12 3 2 2. - 0 - -0.0229323804378510 - 0.3490915000438690 - 0.5163992047309876 - <_> - - <_> - - - - <_>5 12 6 2 -1. - <_>8 12 3 2 2. - 0 - 2.3316550068557262e-003 - 0.5166299939155579 - 0.3709389865398407 - <_> - - <_> - - - - <_>10 7 3 5 -1. - <_>11 7 1 5 3. - 0 - 0.0169256608933210 - 0.5014736056327820 - 0.8053988218307495 - <_> - - <_> - - - - <_>7 7 3 5 -1. - <_>8 7 1 5 3. - 0 - -8.9858826249837875e-003 - 0.6470788717269898 - 0.4657020866870880 - <_> - - <_> - - - - <_>13 0 3 10 -1. - <_>14 0 1 10 3. - 0 - -0.0118746999651194 - 0.3246378898620606 - 0.5258755087852478 - <_> - - <_> - - - - <_>4 11 3 2 -1. - <_>4 12 3 1 2. - 0 - 1.9350569345988333e-004 - 0.5191941857337952 - 0.3839643895626068 - <_> - - <_> - - - - <_>17 3 3 6 -1. - <_>18 3 1 6 3. - 0 - 5.8713490143418312e-003 - 0.4918133914470673 - 0.6187043190002441 - <_> - - <_> - - - - <_>1 8 18 10 -1. - <_>1 13 18 5 2. - 0 - -0.2483879029750824 - 0.1836802959442139 - 0.4988150000572205 - <_> - - <_> - - - - <_>13 0 3 10 -1. - <_>14 0 1 10 3. - 0 - 0.0122560001909733 - 0.5227053761482239 - 0.3632029891014099 - <_> - - <_> - - - - <_>9 14 2 3 -1. - <_>9 15 2 1 3. - 0 - 8.3990179700776935e-004 - 0.4490250051021576 - 0.5774148106575012 - <_> - - <_> - - - - <_>16 3 3 7 -1. - <_>17 3 1 7 3. - 0 - 2.5407369248569012e-003 - 0.4804787039756775 - 0.5858299136161804 - <_> - - <_> - - - - <_>4 0 3 10 -1. - <_>5 0 1 10 3. - 0 - -0.0148224299773574 - 0.2521049976348877 - 0.5023537278175354 - <_> - - <_> - - - - <_>16 3 3 7 -1. - <_>17 3 1 7 3. - 0 - -5.7973959483206272e-003 - 0.5996695756912231 - 0.4853715002536774 - <_> - - <_> - - - - <_>0 9 1 2 -1. - <_>0 10 1 1 2. - 0 - 7.2662148158997297e-004 - 0.5153716802597046 - 0.3671779930591583 - <_> - - <_> - - - - <_>18 1 2 10 -1. - <_>18 1 1 10 2. - 0 - -0.0172325801104307 - 0.6621719002723694 - 0.4994656145572662 - <_> - - <_> - - - - <_>0 1 2 10 -1. - <_>1 1 1 10 2. - 0 - 7.8624086454510689e-003 - 0.4633395075798035 - 0.6256101727485657 - <_> - - <_> - - - - <_>10 16 3 4 -1. - <_>11 16 1 4 3. - 0 - -4.7343620099127293e-003 - 0.3615573048591614 - 0.5281885266304016 - <_> - - <_> - - - - <_>2 8 3 3 -1. - <_>3 8 1 3 3. - 0 - 8.3048478700220585e-004 - 0.4442889094352722 - 0.5550957918167114 - <_> - - <_> - - - - <_>11 0 2 6 -1. - <_>12 0 1 3 2. - <_>11 3 1 3 2. - 0 - 7.6602199114859104e-003 - 0.5162935256958008 - 0.2613354921340942 - <_> - - <_> - - - - <_>7 0 2 6 -1. - <_>7 0 1 3 2. - <_>8 3 1 3 2. - 0 - -4.1048377752304077e-003 - 0.2789632081985474 - 0.5019031763076782 - <_> - - <_> - - - - <_>16 3 3 7 -1. - <_>17 3 1 7 3. - 0 - 4.8512578941881657e-003 - 0.4968984127044678 - 0.5661668181419373 - <_> - - <_> - - - - <_>1 3 3 7 -1. - <_>2 3 1 7 3. - 0 - 9.9896453320980072e-004 - 0.4445607960224152 - 0.5551813244819641 - <_> - - <_> - - - - <_>14 1 6 16 -1. - <_>16 1 2 16 3. - 0 - -0.2702363133430481 - 0.0293882098048925 - 0.5151314139366150 - <_> - - <_> - - - - <_>0 1 6 16 -1. - <_>2 1 2 16 3. - 0 - -0.0130906803533435 - 0.5699399709701538 - 0.4447459876537323 - <_> - - <_> - - - - <_>2 0 16 8 -1. - <_>10 0 8 4 2. - <_>2 4 8 4 2. - 0 - -9.4342790544033051e-003 - 0.4305466115474701 - 0.5487895011901856 - <_> - - <_> - - - - <_>6 8 5 3 -1. - <_>6 9 5 1 3. - 0 - -1.5482039889320731e-003 - 0.3680317103862763 - 0.5128080844879150 - <_> - - <_> - - - - <_>9 7 3 3 -1. - <_>10 7 1 3 3. - 0 - 5.3746132180094719e-003 - 0.4838916957378388 - 0.6101555824279785 - <_> - - <_> - - - - <_>8 8 4 3 -1. - <_>8 9 4 1 3. - 0 - 1.5786769799888134e-003 - 0.5325223207473755 - 0.4118548035621643 - <_> - - <_> - - - - <_>9 6 2 4 -1. - <_>9 6 1 4 2. - 0 - 3.6856050137430429e-003 - 0.4810948073863983 - 0.6252303123474121 - <_> - - <_> - - - - <_>0 7 15 1 -1. - <_>5 7 5 1 3. - 0 - 9.3887019902467728e-003 - 0.5200229883193970 - 0.3629410862922669 - <_> - - <_> - - - - <_>8 2 7 9 -1. - <_>8 5 7 3 3. - 0 - 0.0127926301211119 - 0.4961709976196289 - 0.6738016009330750 - <_> - - <_> - - - - <_>1 7 16 4 -1. - <_>1 7 8 2 2. - <_>9 9 8 2 2. - 0 - -3.3661040943115950e-003 - 0.4060279130935669 - 0.5283598899841309 - <_> - - <_> - - - - <_>6 12 8 2 -1. - <_>6 13 8 1 2. - 0 - 3.9771420415490866e-004 - 0.4674113988876343 - 0.5900775194168091 - <_> - - <_> - - - - <_>8 11 3 3 -1. - <_>8 12 3 1 3. - 0 - 1.4868030557408929e-003 - 0.4519116878509522 - 0.6082053780555725 - <_> - - <_> - - - - <_>4 5 14 10 -1. - <_>11 5 7 5 2. - <_>4 10 7 5 2. - 0 - -0.0886867493391037 - 0.2807899117469788 - 0.5180991888046265 - <_> - - <_> - - - - <_>4 12 3 2 -1. - <_>4 13 3 1 2. - 0 - -7.4296112870797515e-005 - 0.5295584201812744 - 0.4087625145912170 - <_> - - <_> - - - - <_>9 11 6 1 -1. - <_>11 11 2 1 3. - 0 - -1.4932939848222304e-005 - 0.5461400151252747 - 0.4538542926311493 - <_> - - <_> - - - - <_>4 9 7 6 -1. - <_>4 11 7 2 3. - 0 - 5.9162238612771034e-003 - 0.5329161286354065 - 0.4192134141921997 - <_> - - <_> - - - - <_>7 10 6 3 -1. - <_>7 11 6 1 3. - 0 - 1.1141640134155750e-003 - 0.4512017965316773 - 0.5706217288970947 - <_> - - <_> - - - - <_>9 11 2 2 -1. - <_>9 12 2 1 2. - 0 - 8.9249362645205110e-005 - 0.4577805995941162 - 0.5897638201713562 - <_> - - <_> - - - - <_>0 5 20 6 -1. - <_>0 7 20 2 3. - 0 - 2.5319510605186224e-003 - 0.5299603939056397 - 0.3357639014720917 - <_> - - <_> - - - - <_>6 4 6 1 -1. - <_>8 4 2 1 3. - 0 - 0.0124262003228068 - 0.4959059059619904 - 0.1346601992845535 - <_> - - <_> - - - - <_>9 11 6 1 -1. - <_>11 11 2 1 3. - 0 - 0.0283357501029968 - 0.5117079019546509 - 6.1043637106195092e-004 - <_> - - <_> - - - - <_>5 11 6 1 -1. - <_>7 11 2 1 3. - 0 - 6.6165882162749767e-003 - 0.4736349880695343 - 0.7011628150939941 - <_> - - <_> - - - - <_>10 16 3 4 -1. - <_>11 16 1 4 3. - 0 - 8.0468766391277313e-003 - 0.5216417908668518 - 0.3282819986343384 - <_> - - <_> - - - - <_>8 7 3 3 -1. - <_>9 7 1 3 3. - 0 - -1.1193980462849140e-003 - 0.5809860825538635 - 0.4563739001750946 - <_> - - <_> - - - - <_>2 12 16 8 -1. - <_>2 16 16 4 2. - 0 - 0.0132775902748108 - 0.5398362278938294 - 0.4103901088237763 - <_> - - <_> - - - - <_>0 15 15 2 -1. - <_>0 16 15 1 2. - 0 - 4.8794739996083081e-004 - 0.4249286055564880 - 0.5410590767860413 - <_> - - <_> - - - - <_>15 4 5 6 -1. - <_>15 6 5 2 3. - 0 - 0.0112431701272726 - 0.5269963741302490 - 0.3438215851783752 - <_> - - <_> - - - - <_>9 5 2 4 -1. - <_>10 5 1 4 2. - 0 - -8.9896668214350939e-004 - 0.5633075833320618 - 0.4456613063812256 - <_> - - <_> - - - - <_>8 10 9 6 -1. - <_>8 12 9 2 3. - 0 - 6.6677159629762173e-003 - 0.5312889218330383 - 0.4362679123878479 - <_> - - <_> - - - - <_>2 19 15 1 -1. - <_>7 19 5 1 3. - 0 - 0.0289472993463278 - 0.4701794981956482 - 0.6575797796249390 - <_> - - <_> - - - - <_>10 16 3 4 -1. - <_>11 16 1 4 3. - 0 - -0.0234000496566296 - 0. - 0.5137398838996887 - <_> - - <_> - - - - <_>0 15 20 4 -1. - <_>0 17 20 2 2. - 0 - -0.0891170501708984 - 0.0237452797591686 - 0.4942430853843689 - <_> - - <_> - - - - <_>10 16 3 4 -1. - <_>11 16 1 4 3. - 0 - -0.0140546001493931 - 0.3127323091030121 - 0.5117511153221130 - <_> - - <_> - - - - <_>7 16 3 4 -1. - <_>8 16 1 4 3. - 0 - 8.1239398568868637e-003 - 0.5009049177169800 - 0.2520025968551636 - <_> - - <_> - - - - <_>9 16 3 3 -1. - <_>9 17 3 1 3. - 0 - -4.9964650534093380e-003 - 0.6387143731117249 - 0.4927811920642853 - <_> - - <_> - - - - <_>8 11 4 6 -1. - <_>8 14 4 3 2. - 0 - 3.1253970228135586e-003 - 0.5136849880218506 - 0.3680452108383179 - <_> - - <_> - - - - <_>9 6 2 12 -1. - <_>9 10 2 4 3. - 0 - 6.7669642157852650e-003 - 0.5509843826293945 - 0.4363631904125214 - <_> - - <_> - - - - <_>8 17 4 3 -1. - <_>8 18 4 1 3. - 0 - -2.3711440153419971e-003 - 0.6162335276603699 - 0.4586946964263916 - <_> - - <_> - - - - <_>9 18 8 2 -1. - <_>13 18 4 1 2. - <_>9 19 4 1 2. - 0 - -5.3522791713476181e-003 - 0.6185457706451416 - 0.4920490980148315 - <_> - - <_> - - - - <_>1 18 8 2 -1. - <_>1 19 8 1 2. - 0 - -0.0159688591957092 - 0.1382617950439453 - 0.4983252882957459 - <_> - - <_> - - - - <_>13 5 6 15 -1. - <_>15 5 2 15 3. - 0 - 4.7676060348749161e-003 - 0.4688057899475098 - 0.5490046143531799 - <_> - - <_> - - - - <_>9 8 2 2 -1. - <_>9 9 2 1 2. - 0 - -2.4714691098779440e-003 - 0.2368514984846115 - 0.5003952980041504 - <_> - - <_> - - - - <_>9 5 2 3 -1. - <_>9 5 1 3 2. - 0 - -7.1033788844943047e-004 - 0.5856394171714783 - 0.4721533060073853 - <_> - - <_> - - - - <_>1 5 6 15 -1. - <_>3 5 2 15 3. - 0 - -0.1411755979061127 - 0.0869000628590584 - 0.4961591064929962 - <_> - - <_> - - - - <_>4 1 14 8 -1. - <_>11 1 7 4 2. - <_>4 5 7 4 2. - 0 - 0.1065180972218514 - 0.5138837099075317 - 0.1741005033254623 - <_> - - <_> - - - - <_>2 4 4 16 -1. - <_>2 4 2 8 2. - <_>4 12 2 8 2. - 0 - -0.0527447499334812 - 0.7353636026382446 - 0.4772881865501404 - <_> - - <_> - - - - <_>12 4 3 12 -1. - <_>12 10 3 6 2. - 0 - -4.7431760467588902e-003 - 0.3884406089782715 - 0.5292701721191406 - <_> - - <_> - - - - <_>4 5 10 12 -1. - <_>4 5 5 6 2. - <_>9 11 5 6 2. - 0 - 9.9676765967160463e-004 - 0.5223492980003357 - 0.4003424048423767 - <_> - - <_> - - - - <_>9 14 2 3 -1. - <_>9 15 2 1 3. - 0 - 8.0284131690859795e-003 - 0.4959106147289276 - 0.7212964296340942 - <_> - - <_> - - - - <_>5 4 2 3 -1. - <_>5 5 2 1 3. - 0 - 8.6025858763605356e-004 - 0.4444884061813355 - 0.5538476109504700 - <_> - - <_> - - - - <_>12 2 4 10 -1. - <_>14 2 2 5 2. - <_>12 7 2 5 2. - 0 - 9.3191501218825579e-004 - 0.5398371219635010 - 0.4163244068622589 - <_> - - <_> - - - - <_>6 4 7 3 -1. - <_>6 5 7 1 3. - 0 - -2.5082060601562262e-003 - 0.5854265093803406 - 0.4562500119209290 - <_> - - <_> - - - - <_>2 0 18 2 -1. - <_>11 0 9 1 2. - <_>2 1 9 1 2. - 0 - -2.1378761157393456e-003 - 0.4608069062232971 - 0.5280259251594544 - <_> - - <_> - - - - <_>0 0 18 2 -1. - <_>0 0 9 1 2. - <_>9 1 9 1 2. - 0 - -2.1546049974858761e-003 - 0.3791126906871796 - 0.5255997180938721 - <_> - - <_> - - - - <_>13 13 4 6 -1. - <_>15 13 2 3 2. - <_>13 16 2 3 2. - 0 - -7.6214009895920753e-003 - 0.5998609066009522 - 0.4952073991298676 - <_> - - <_> - - - - <_>3 13 4 6 -1. - <_>3 13 2 3 2. - <_>5 16 2 3 2. - 0 - 2.2055360022932291e-003 - 0.4484206140041351 - 0.5588530898094177 - <_> - - <_> - - - - <_>10 12 2 6 -1. - <_>10 15 2 3 2. - 0 - 1.2586950324475765e-003 - 0.5450747013092041 - 0.4423840939998627 - <_> - - <_> - - - - <_>5 9 10 10 -1. - <_>5 9 5 5 2. - <_>10 14 5 5 2. - 0 - -5.0926720723509789e-003 - 0.4118275046348572 - 0.5263035893440247 - <_> - - <_> - - - - <_>11 4 4 2 -1. - <_>13 4 2 1 2. - <_>11 5 2 1 2. - 0 - -2.5095739401876926e-003 - 0.5787907838821411 - 0.4998494982719421 - <_> - - <_> - - - - <_>7 12 6 8 -1. - <_>10 12 3 8 2. - 0 - -0.0773275569081306 - 0.8397865891456604 - 0.4811120033264160 - <_> - - <_> - - - - <_>12 2 4 10 -1. - <_>14 2 2 5 2. - <_>12 7 2 5 2. - 0 - -0.0414858199656010 - 0.2408611029386520 - 0.5176993012428284 - <_> - - <_> - - - - <_>8 11 2 1 -1. - <_>9 11 1 1 2. - 0 - 1.0355669655837119e-004 - 0.4355360865592957 - 0.5417054295539856 - <_> - - <_> - - - - <_>10 5 1 12 -1. - <_>10 9 1 4 3. - 0 - 1.3255809899419546e-003 - 0.5453971028327942 - 0.4894095063209534 - <_> - - <_> - - - - <_>0 11 6 9 -1. - <_>3 11 3 9 2. - 0 - -8.0598732456564903e-003 - 0.5771024227142334 - 0.4577918946743012 - <_> - - <_> - - - - <_>12 2 4 10 -1. - <_>14 2 2 5 2. - <_>12 7 2 5 2. - 0 - 0.0190586205571890 - 0.5169867873191834 - 0.3400475084781647 - <_> - - <_> - - - - <_>4 2 4 10 -1. - <_>4 2 2 5 2. - <_>6 7 2 5 2. - 0 - -0.0350578911602497 - 0.2203243970870972 - 0.5000503063201904 - <_> - - <_> - - - - <_>11 4 4 2 -1. - <_>13 4 2 1 2. - <_>11 5 2 1 2. - 0 - 5.7296059094369411e-003 - 0.5043408274650574 - 0.6597570776939392 - <_> - - <_> - - - - <_>0 14 6 3 -1. - <_>0 15 6 1 3. - 0 - -0.0116483299061656 - 0.2186284959316254 - 0.4996652901172638 - <_> - - <_> - - - - <_>11 4 4 2 -1. - <_>13 4 2 1 2. - <_>11 5 2 1 2. - 0 - 1.4544479781761765e-003 - 0.5007681846618652 - 0.5503727793693543 - <_> - - <_> - - - - <_>6 1 3 2 -1. - <_>7 1 1 2 3. - 0 - -2.5030909455381334e-004 - 0.4129841029644013 - 0.5241670012474060 - <_> - - <_> - - - - <_>11 4 4 2 -1. - <_>13 4 2 1 2. - <_>11 5 2 1 2. - 0 - -8.2907272735610604e-004 - 0.5412868261337280 - 0.4974496066570282 - <_> - - <_> - - - - <_>5 4 4 2 -1. - <_>5 4 2 1 2. - <_>7 5 2 1 2. - 0 - 1.0862209601327777e-003 - 0.4605529904365540 - 0.5879228711128235 - <_> - - <_> - - - - <_>13 0 2 12 -1. - <_>14 0 1 6 2. - <_>13 6 1 6 2. - 0 - 2.0000500080641359e-004 - 0.5278854966163635 - 0.4705209136009216 - <_> - - <_> - - - - <_>6 0 3 10 -1. - <_>7 0 1 10 3. - 0 - 2.9212920926511288e-003 - 0.5129609704017639 - 0.3755536973476410 - <_> - - <_> - - - - <_>3 0 17 8 -1. - <_>3 4 17 4 2. - 0 - 0.0253874007612467 - 0.4822691977024078 - 0.5790768265724182 - <_> - - <_> - - - - <_>0 4 20 4 -1. - <_>0 6 20 2 2. - 0 - -3.1968469265848398e-003 - 0.5248395204544067 - 0.3962840139865875 - 87.6960296630859380 - 17 - -1 - <_> - - - <_> - - <_> - - - - <_>0 3 8 2 -1. - <_>4 3 4 2 2. - 0 - 5.8031738735735416e-003 - 0.3498983979225159 - 0.5961983203887940 - <_> - - <_> - - - - <_>8 11 4 3 -1. - <_>8 12 4 1 3. - 0 - -9.0003069490194321e-003 - 0.6816636919975281 - 0.4478552043437958 - <_> - - <_> - - - - <_>5 7 6 4 -1. - <_>5 7 3 2 2. - <_>8 9 3 2 2. - 0 - -1.1549659539014101e-003 - 0.5585706233978272 - 0.3578251004219055 - <_> - - <_> - - - - <_>8 3 4 9 -1. - <_>8 6 4 3 3. - 0 - -1.1069850297644734e-003 - 0.5365036129951477 - 0.3050428032875061 - <_> - - <_> - - - - <_>8 15 1 4 -1. - <_>8 17 1 2 2. - 0 - 1.0308309720130637e-004 - 0.3639095127582550 - 0.5344635844230652 - <_> - - <_> - - - - <_>4 5 12 7 -1. - <_>8 5 4 7 3. - 0 - -5.0984839908778667e-003 - 0.2859157025814056 - 0.5504264831542969 - <_> - - <_> - - - - <_>4 2 4 10 -1. - <_>4 2 2 5 2. - <_>6 7 2 5 2. - 0 - 8.2572200335562229e-004 - 0.5236523747444153 - 0.3476041853427887 - <_> - - <_> - - - - <_>3 0 17 2 -1. - <_>3 1 17 1 2. - 0 - 9.9783325567841530e-003 - 0.4750322103500366 - 0.6219646930694580 - <_> - - <_> - - - - <_>2 2 16 15 -1. - <_>2 7 16 5 3. - 0 - -0.0374025292694569 - 0.3343375921249390 - 0.5278062820434570 - <_> - - <_> - - - - <_>15 2 5 2 -1. - <_>15 3 5 1 2. - 0 - 4.8548257909715176e-003 - 0.5192180871963501 - 0.3700444102287293 - <_> - - <_> - - - - <_>9 3 2 2 -1. - <_>10 3 1 2 2. - 0 - -1.8664470408111811e-003 - 0.2929843962192535 - 0.5091944932937622 - <_> - - <_> - - - - <_>4 5 16 15 -1. - <_>4 10 16 5 3. - 0 - 0.0168888904154301 - 0.3686845898628235 - 0.5431225895881653 - <_> - - <_> - - - - <_>7 13 5 6 -1. - <_>7 16 5 3 2. - 0 - -5.8372621424496174e-003 - 0.3632183969020844 - 0.5221335887908936 - <_> - - <_> - - - - <_>10 7 3 2 -1. - <_>11 7 1 2 3. - 0 - -1.4713739510625601e-003 - 0.5870683789253235 - 0.4700650870800018 - <_> - - <_> - - - - <_>8 3 3 1 -1. - <_>9 3 1 1 3. - 0 - -1.1522950371727347e-003 - 0.3195894956588745 - 0.5140954256057739 - <_> - - <_> - - - - <_>9 16 3 3 -1. - <_>9 17 3 1 3. - 0 - -4.2560300789773464e-003 - 0.6301859021186829 - 0.4814921021461487 - <_> - - <_> - - - - <_>0 2 5 2 -1. - <_>0 3 5 1 2. - 0 - -6.7378291860222816e-003 - 0.1977048069238663 - 0.5025808215141296 - <_> - - <_> - - - - <_>12 5 4 3 -1. - <_>12 6 4 1 3. - 0 - 0.0113826701417565 - 0.4954132139682770 - 0.6867045760154724 - <_> - - <_> - - - - <_>1 7 12 1 -1. - <_>5 7 4 1 3. - 0 - 5.1794708706438541e-003 - 0.5164427757263184 - 0.3350647985935211 - <_> - - <_> - - - - <_>7 5 6 14 -1. - <_>7 12 6 7 2. - 0 - -0.1174378991127014 - 0.2315246015787125 - 0.5234413743019104 - <_> - - <_> - - - - <_>0 0 8 10 -1. - <_>0 0 4 5 2. - <_>4 5 4 5 2. - 0 - 0.0287034492939711 - 0.4664297103881836 - 0.6722521185874939 - <_> - - <_> - - - - <_>9 1 3 2 -1. - <_>10 1 1 2 3. - 0 - 4.8231030814349651e-003 - 0.5220875144004822 - 0.2723532915115356 - <_> - - <_> - - - - <_>8 1 3 2 -1. - <_>9 1 1 2 3. - 0 - 2.6798530016094446e-003 - 0.5079277157783508 - 0.2906948924064636 - <_> - - <_> - - - - <_>12 4 3 3 -1. - <_>12 5 3 1 3. - 0 - 8.0504082143306732e-003 - 0.4885950982570648 - 0.6395021080970764 - <_> - - <_> - - - - <_>7 4 6 16 -1. - <_>7 12 6 8 2. - 0 - 4.8054959625005722e-003 - 0.5197256803512573 - 0.3656663894653320 - <_> - - <_> - - - - <_>12 4 3 3 -1. - <_>12 5 3 1 3. - 0 - -2.2420159075409174e-003 - 0.6153467893600464 - 0.4763701856136322 - <_> - - <_> - - - - <_>2 3 2 6 -1. - <_>2 5 2 2 3. - 0 - -0.0137577103450894 - 0.2637344896793366 - 0.5030903220176697 - <_> - - <_> - - - - <_>14 2 6 9 -1. - <_>14 5 6 3 3. - 0 - -0.1033829972147942 - 0.2287521958351135 - 0.5182461142539978 - <_> - - <_> - - - - <_>5 4 3 3 -1. - <_>5 5 3 1 3. - 0 - -9.4432085752487183e-003 - 0.6953303813934326 - 0.4694949090480804 - <_> - - <_> - - - - <_>9 17 3 2 -1. - <_>10 17 1 2 3. - 0 - 8.0271181650459766e-004 - 0.5450655221939087 - 0.4268783926963806 - <_> - - <_> - - - - <_>5 5 2 3 -1. - <_>5 6 2 1 3. - 0 - -4.1945669800043106e-003 - 0.6091387867927551 - 0.4571642875671387 - <_> - - <_> - - - - <_>13 11 3 6 -1. - <_>13 13 3 2 3. - 0 - 0.0109422104433179 - 0.5241063237190247 - 0.3284547030925751 - <_> - - <_> - - - - <_>3 14 2 6 -1. - <_>3 17 2 3 2. - 0 - -5.7841069065034389e-004 - 0.5387929081916809 - 0.4179368913173676 - <_> - - <_> - - - - <_>14 3 6 2 -1. - <_>14 4 6 1 2. - 0 - -2.0888620056211948e-003 - 0.4292691051959992 - 0.5301715731620789 - <_> - - <_> - - - - <_>0 8 16 2 -1. - <_>0 9 16 1 2. - 0 - 3.2383969519287348e-003 - 0.3792347908020020 - 0.5220744013786316 - <_> - - <_> - - - - <_>14 3 6 2 -1. - <_>14 4 6 1 2. - 0 - 4.9075027927756310e-003 - 0.5237283110618591 - 0.4126757979393005 - <_> - - <_> - - - - <_>0 0 5 6 -1. - <_>0 2 5 2 3. - 0 - -0.0322779417037964 - 0.1947655975818634 - 0.4994502067565918 - <_> - - <_> - - - - <_>12 5 4 3 -1. - <_>12 6 4 1 3. - 0 - -8.9711230248212814e-003 - 0.6011285185813904 - 0.4929032027721405 - <_> - - <_> - - - - <_>4 11 3 6 -1. - <_>4 13 3 2 3. - 0 - 0.0153210898861289 - 0.5009753704071045 - 0.2039822041988373 - <_> - - <_> - - - - <_>12 5 4 3 -1. - <_>12 6 4 1 3. - 0 - 2.0855569746345282e-003 - 0.4862189888954163 - 0.5721694827079773 - <_> - - <_> - - - - <_>9 5 1 3 -1. - <_>9 6 1 1 3. - 0 - 5.0615021027624607e-003 - 0.5000218749046326 - 0.1801805943250656 - <_> - - <_> - - - - <_>12 5 4 3 -1. - <_>12 6 4 1 3. - 0 - -3.7174751050770283e-003 - 0.5530117154121399 - 0.4897592961788178 - <_> - - <_> - - - - <_>6 6 8 12 -1. - <_>6 12 8 6 2. - 0 - -0.0121705001220107 - 0.4178605973720551 - 0.5383723974227905 - <_> - - <_> - - - - <_>12 5 4 3 -1. - <_>12 6 4 1 3. - 0 - 4.6248398721218109e-003 - 0.4997169971466065 - 0.5761327147483826 - <_> - - <_> - - - - <_>5 12 9 2 -1. - <_>8 12 3 2 3. - 0 - -2.1040429419372231e-004 - 0.5331807136535645 - 0.4097681045532227 - <_> - - <_> - - - - <_>12 5 4 3 -1. - <_>12 6 4 1 3. - 0 - -0.0146417804062366 - 0.5755925178527832 - 0.5051776170730591 - <_> - - <_> - - - - <_>4 5 4 3 -1. - <_>4 6 4 1 3. - 0 - 3.3199489116668701e-003 - 0.4576976895332336 - 0.6031805872917175 - <_> - - <_> - - - - <_>6 6 9 2 -1. - <_>9 6 3 2 3. - 0 - 3.7236879579722881e-003 - 0.4380396902561188 - 0.5415883064270020 - <_> - - <_> - - - - <_>4 11 1 3 -1. - <_>4 12 1 1 3. - 0 - 8.2951161311939359e-004 - 0.5163031816482544 - 0.3702219128608704 - <_> - - <_> - - - - <_>14 12 6 6 -1. - <_>14 12 3 6 2. - 0 - -0.0114084901288152 - 0.6072946786880493 - 0.4862565100193024 - <_> - - <_> - - - - <_>7 0 3 7 -1. - <_>8 0 1 7 3. - 0 - -4.5320121571421623e-003 - 0.3292475938796997 - 0.5088962912559509 - <_> - - <_> - - - - <_>9 8 3 3 -1. - <_>10 8 1 3 3. - 0 - 5.1276017911732197e-003 - 0.4829767942428589 - 0.6122708916664124 - <_> - - <_> - - - - <_>8 8 3 3 -1. - <_>9 8 1 3 3. - 0 - 9.8583158105611801e-003 - 0.4660679996013641 - 0.6556177139282227 - <_> - - <_> - - - - <_>5 10 11 3 -1. - <_>5 11 11 1 3. - 0 - 0.0369859188795090 - 0.5204849243164063 - 0.1690472066402435 - <_> - - <_> - - - - <_>5 7 10 1 -1. - <_>10 7 5 1 2. - 0 - 4.6491161920130253e-003 - 0.5167322158813477 - 0.3725225031375885 - <_> - - <_> - - - - <_>9 7 3 2 -1. - <_>10 7 1 2 3. - 0 - -4.2664702050387859e-003 - 0.6406493186950684 - 0.4987342953681946 - <_> - - <_> - - - - <_>8 7 3 2 -1. - <_>9 7 1 2 3. - 0 - -4.7956590424291790e-004 - 0.5897293090820313 - 0.4464873969554901 - <_> - - <_> - - - - <_>11 9 4 2 -1. - <_>11 9 2 2 2. - 0 - 3.6827160511165857e-003 - 0.5441560745239258 - 0.3472662866115570 - <_> - - <_> - - - - <_>5 9 4 2 -1. - <_>7 9 2 2 2. - 0 - -0.0100598800927401 - 0.2143162935972214 - 0.5004829764366150 - <_> - - <_> - - - - <_>14 10 2 4 -1. - <_>14 12 2 2 2. - 0 - -3.0361840617842972e-004 - 0.5386424064636231 - 0.4590323865413666 - <_> - - <_> - - - - <_>7 7 3 2 -1. - <_>8 7 1 2 3. - 0 - -1.4545479789376259e-003 - 0.5751184225082398 - 0.4497095048427582 - <_> - - <_> - - - - <_>14 17 6 3 -1. - <_>14 18 6 1 3. - 0 - 1.6515209572389722e-003 - 0.5421937704086304 - 0.4238520860671997 - <_> - - <_> - - - - <_>4 5 12 12 -1. - <_>4 5 6 6 2. - <_>10 11 6 6 2. - 0 - -7.8468639403581619e-003 - 0.4077920913696289 - 0.5258157253265381 - <_> - - <_> - - - - <_>6 9 8 8 -1. - <_>10 9 4 4 2. - <_>6 13 4 4 2. - 0 - -5.1259850151836872e-003 - 0.4229275882244110 - 0.5479453206062317 - <_> - - <_> - - - - <_>0 4 15 4 -1. - <_>5 4 5 4 3. - 0 - -0.0368909612298012 - 0.6596375703811646 - 0.4674678146839142 - <_> - - <_> - - - - <_>13 2 4 1 -1. - <_>13 2 2 1 2. - 0 - 2.4035639944486320e-004 - 0.4251135885715485 - 0.5573202967643738 - <_> - - <_> - - - - <_>4 12 2 2 -1. - <_>4 13 2 1 2. - 0 - -1.5150169929256663e-005 - 0.5259246826171875 - 0.4074114859104157 - <_> - - <_> - - - - <_>8 13 4 3 -1. - <_>8 14 4 1 3. - 0 - 2.2108471021056175e-003 - 0.4671722948551178 - 0.5886352062225342 - <_> - - <_> - - - - <_>9 13 2 3 -1. - <_>9 14 2 1 3. - 0 - -1.1568620102480054e-003 - 0.5711066126823425 - 0.4487161934375763 - <_> - - <_> - - - - <_>13 11 2 3 -1. - <_>13 12 2 1 3. - 0 - 4.9996292218565941e-003 - 0.5264198184013367 - 0.2898327112197876 - <_> - - <_> - - - - <_>7 12 4 4 -1. - <_>7 12 2 2 2. - <_>9 14 2 2 2. - 0 - -1.4656189596280456e-003 - 0.3891738057136536 - 0.5197871923446655 - <_> - - <_> - - - - <_>10 11 2 2 -1. - <_>11 11 1 1 2. - <_>10 12 1 1 2. - 0 - -1.1975039960816503e-003 - 0.5795872807502747 - 0.4927955865859985 - <_> - - <_> - - - - <_>8 17 3 2 -1. - <_>9 17 1 2 3. - 0 - -4.4954330660402775e-003 - 0.2377603054046631 - 0.5012555122375488 - <_> - - <_> - - - - <_>10 11 2 2 -1. - <_>11 11 1 1 2. - <_>10 12 1 1 2. - 0 - 1.4997160178609192e-004 - 0.4876626133918762 - 0.5617607831954956 - <_> - - <_> - - - - <_>0 17 6 3 -1. - <_>0 18 6 1 3. - 0 - 2.6391509454697371e-003 - 0.5168088078498840 - 0.3765509128570557 - <_> - - <_> - - - - <_>10 11 2 2 -1. - <_>11 11 1 1 2. - <_>10 12 1 1 2. - 0 - -2.9368131072260439e-004 - 0.5446649193763733 - 0.4874630868434906 - <_> - - <_> - - - - <_>8 11 2 2 -1. - <_>8 11 1 1 2. - <_>9 12 1 1 2. - 0 - 1.4211760135367513e-003 - 0.4687897861003876 - 0.6691331863403320 - <_> - - <_> - - - - <_>12 5 8 4 -1. - <_>12 5 4 4 2. - 0 - 0.0794276371598244 - 0.5193443894386292 - 0.2732945978641510 - <_> - - <_> - - - - <_>0 5 8 4 -1. - <_>4 5 4 4 2. - 0 - 0.0799375027418137 - 0.4971731007099152 - 0.1782083958387375 - <_> - - <_> - - - - <_>13 2 4 1 -1. - <_>13 2 2 1 2. - 0 - 0.0110892597585917 - 0.5165994763374329 - 0.3209475874900818 - <_> - - <_> - - - - <_>3 2 4 1 -1. - <_>5 2 2 1 2. - 0 - 1.6560709627810866e-004 - 0.4058471918106079 - 0.5307276248931885 - <_> - - <_> - - - - <_>10 0 4 2 -1. - <_>12 0 2 1 2. - <_>10 1 2 1 2. - 0 - -5.3354292176663876e-003 - 0.3445056974887848 - 0.5158129930496216 - <_> - - <_> - - - - <_>7 12 3 1 -1. - <_>8 12 1 1 3. - 0 - 1.1287260567769408e-003 - 0.4594863057136536 - 0.6075533032417297 - <_> - - <_> - - - - <_>8 11 4 8 -1. - <_>10 11 2 4 2. - <_>8 15 2 4 2. - 0 - -0.0219692196696997 - 0.1680400967597961 - 0.5228595733642578 - <_> - - <_> - - - - <_>9 9 2 2 -1. - <_>9 10 2 1 2. - 0 - -2.1775320055894554e-004 - 0.3861596882343292 - 0.5215672850608826 - <_> - - <_> - - - - <_>3 18 15 2 -1. - <_>3 19 15 1 2. - 0 - 2.0200149447191507e-004 - 0.5517979264259338 - 0.4363039135932922 - <_> - - <_> - - - - <_>2 6 2 12 -1. - <_>2 6 1 6 2. - <_>3 12 1 6 2. - 0 - -0.0217331498861313 - 0.7999460101127625 - 0.4789851009845734 - <_> - - <_> - - - - <_>9 8 2 3 -1. - <_>9 9 2 1 3. - 0 - -8.4399932529777288e-004 - 0.4085975885391235 - 0.5374773144721985 - <_> - - <_> - - - - <_>7 10 3 2 -1. - <_>8 10 1 2 3. - 0 - -4.3895249837078154e-004 - 0.5470405220985413 - 0.4366143047809601 - <_> - - <_> - - - - <_>11 11 3 1 -1. - <_>12 11 1 1 3. - 0 - 1.5092400135472417e-003 - 0.4988996982574463 - 0.5842149257659912 - <_> - - <_> - - - - <_>6 11 3 1 -1. - <_>7 11 1 1 3. - 0 - -3.5547839943319559e-003 - 0.6753690242767334 - 0.4721005856990814 - <_> - - <_> - - - - <_>9 2 4 2 -1. - <_>11 2 2 1 2. - <_>9 3 2 1 2. - 0 - 4.8191400128416717e-004 - 0.5415853857994080 - 0.4357109069824219 - <_> - - <_> - - - - <_>4 12 2 3 -1. - <_>4 13 2 1 3. - 0 - -6.0264398343861103e-003 - 0.2258509993553162 - 0.4991880953311920 - <_> - - <_> - - - - <_>2 1 18 3 -1. - <_>8 1 6 3 3. - 0 - -0.0116681400686502 - 0.6256554722785950 - 0.4927498996257782 - <_> - - <_> - - - - <_>5 1 4 14 -1. - <_>7 1 2 14 2. - 0 - -2.8718370012938976e-003 - 0.3947784900665283 - 0.5245801806449890 - <_> - - <_> - - - - <_>8 16 12 3 -1. - <_>8 16 6 3 2. - 0 - 0.0170511696487665 - 0.4752511084079742 - 0.5794224143028259 - <_> - - <_> - - - - <_>1 17 18 3 -1. - <_>7 17 6 3 3. - 0 - -0.0133520802482963 - 0.6041104793548584 - 0.4544535875320435 - <_> - - <_> - - - - <_>9 14 2 6 -1. - <_>9 17 2 3 2. - 0 - -3.9301801007241011e-004 - 0.4258275926113129 - 0.5544905066490173 - <_> - - <_> - - - - <_>9 12 1 8 -1. - <_>9 16 1 4 2. - 0 - 3.0483349692076445e-003 - 0.5233420133590698 - 0.3780272901058197 - <_> - - <_> - - - - <_>9 14 2 3 -1. - <_>9 15 2 1 3. - 0 - -4.3579288758337498e-003 - 0.6371889114379883 - 0.4838674068450928 - <_> - - <_> - - - - <_>9 6 2 12 -1. - <_>9 10 2 4 3. - 0 - 5.6661018170416355e-003 - 0.5374705791473389 - 0.4163666069507599 - <_> - - <_> - - - - <_>12 9 3 3 -1. - <_>12 10 3 1 3. - 0 - 6.0677339206449687e-005 - 0.4638795852661133 - 0.5311625003814697 - <_> - - <_> - - - - <_>0 1 4 8 -1. - <_>2 1 2 8 2. - 0 - 0.0367381609976292 - 0.4688656032085419 - 0.6466524004936218 - <_> - - <_> - - - - <_>9 1 6 2 -1. - <_>12 1 3 1 2. - <_>9 2 3 1 2. - 0 - 8.6528137326240540e-003 - 0.5204318761825562 - 0.2188657969236374 - <_> - - <_> - - - - <_>1 3 12 14 -1. - <_>1 10 12 7 2. - 0 - -0.1537135988473892 - 0.1630371958017349 - 0.4958840012550354 - <_> - - <_> - - - - <_>8 12 4 2 -1. - <_>10 12 2 1 2. - <_>8 13 2 1 2. - 0 - -4.1560421232134104e-004 - 0.5774459242820740 - 0.4696458876132965 - <_> - - <_> - - - - <_>1 9 10 2 -1. - <_>1 9 5 1 2. - <_>6 10 5 1 2. - 0 - -1.2640169588848948e-003 - 0.3977175951004028 - 0.5217198133468628 - <_> - - <_> - - - - <_>8 15 4 3 -1. - <_>8 16 4 1 3. - 0 - -3.5473341122269630e-003 - 0.6046528220176697 - 0.4808315038681030 - <_> - - <_> - - - - <_>6 8 8 3 -1. - <_>6 9 8 1 3. - 0 - 3.0019069527043030e-005 - 0.3996723890304565 - 0.5228201150894165 - <_> - - <_> - - - - <_>9 15 5 3 -1. - <_>9 16 5 1 3. - 0 - 1.3113019522279501e-003 - 0.4712158143520355 - 0.5765997767448425 - <_> - - <_> - - - - <_>8 7 4 3 -1. - <_>8 8 4 1 3. - 0 - -1.3374709524214268e-003 - 0.4109584987163544 - 0.5253170132637024 - <_> - - <_> - - - - <_>7 7 6 2 -1. - <_>7 8 6 1 2. - 0 - 0.0208767093718052 - 0.5202993750572205 - 0.1757981926202774 - <_> - - <_> - - - - <_>5 7 8 2 -1. - <_>5 7 4 1 2. - <_>9 8 4 1 2. - 0 - -7.5497948564589024e-003 - 0.6566609740257263 - 0.4694975018501282 - <_> - - <_> - - - - <_>12 9 3 3 -1. - <_>12 10 3 1 3. - 0 - 0.0241885501891375 - 0.5128673911094666 - 0.3370220959186554 - <_> - - <_> - - - - <_>4 7 4 2 -1. - <_>4 8 4 1 2. - 0 - -2.9358828905969858e-003 - 0.6580786705017090 - 0.4694541096687317 - <_> - - <_> - - - - <_>14 2 6 9 -1. - <_>14 5 6 3 3. - 0 - 0.0575579293072224 - 0.5146445035934448 - 0.2775259912014008 - <_> - - <_> - - - - <_>4 9 3 3 -1. - <_>5 9 1 3 3. - 0 - -1.1343370424583554e-003 - 0.3836601972579956 - 0.5192667245864868 - <_> - - <_> - - - - <_>12 9 3 3 -1. - <_>12 10 3 1 3. - 0 - 0.0168169997632504 - 0.5085592865943909 - 0.6177260875701904 - <_> - - <_> - - - - <_>0 2 6 9 -1. - <_>0 5 6 3 3. - 0 - 5.0535178743302822e-003 - 0.5138763189315796 - 0.3684791922569275 - <_> - - <_> - - - - <_>17 3 3 6 -1. - <_>18 3 1 6 3. - 0 - -4.5874710194766521e-003 - 0.5989655256271362 - 0.4835202097892761 - <_> - - <_> - - - - <_>0 3 3 6 -1. - <_>1 3 1 6 3. - 0 - 1.6882460331544280e-003 - 0.4509486854076386 - 0.5723056793212891 - <_> - - <_> - - - - <_>17 14 1 2 -1. - <_>17 15 1 1 2. - 0 - -1.6554000321775675e-003 - 0.3496770858764648 - 0.5243319272994995 - <_> - - <_> - - - - <_>4 9 4 3 -1. - <_>6 9 2 3 2. - 0 - -0.0193738006055355 - 0.1120536997914314 - 0.4968712925910950 - <_> - - <_> - - - - <_>12 9 3 3 -1. - <_>12 10 3 1 3. - 0 - 0.0103744501248002 - 0.5148196816444397 - 0.4395213127136231 - <_> - - <_> - - - - <_>5 9 3 3 -1. - <_>5 10 3 1 3. - 0 - 1.4973050565458834e-004 - 0.4084999859333038 - 0.5269886851310730 - <_> - - <_> - - - - <_>9 5 6 8 -1. - <_>12 5 3 4 2. - <_>9 9 3 4 2. - 0 - -0.0429819300770760 - 0.6394104957580566 - 0.5018504261970520 - <_> - - <_> - - - - <_>5 5 6 8 -1. - <_>5 5 3 4 2. - <_>8 9 3 4 2. - 0 - 8.3065936341881752e-003 - 0.4707553982734680 - 0.6698353290557861 - <_> - - <_> - - - - <_>16 1 4 6 -1. - <_>16 4 4 3 2. - 0 - -4.1285790503025055e-003 - 0.4541369080543518 - 0.5323647260665894 - <_> - - <_> - - - - <_>1 0 6 20 -1. - <_>3 0 2 20 3. - 0 - 1.7399420030415058e-003 - 0.4333961904048920 - 0.5439866185188294 - <_> - - <_> - - - - <_>12 11 3 2 -1. - <_>13 11 1 2 3. - 0 - 1.1739750334527344e-004 - 0.4579687118530273 - 0.5543426275253296 - <_> - - <_> - - - - <_>5 11 3 2 -1. - <_>6 11 1 2 3. - 0 - 1.8585780344437808e-004 - 0.4324643909931183 - 0.5426754951477051 - <_> - - <_> - - - - <_>9 4 6 1 -1. - <_>11 4 2 1 3. - 0 - 5.5587692186236382e-003 - 0.5257220864295960 - 0.3550611138343811 - <_> - - <_> - - - - <_>0 0 8 3 -1. - <_>4 0 4 3 2. - 0 - -7.9851560294628143e-003 - 0.6043018102645874 - 0.4630635976791382 - <_> - - <_> - - - - <_>15 0 2 5 -1. - <_>15 0 1 5 2. - 0 - 6.0594122624024749e-004 - 0.4598254859447479 - 0.5533195137977600 - <_> - - <_> - - - - <_>4 1 3 2 -1. - <_>5 1 1 2 3. - 0 - -2.2983040253166109e-004 - 0.4130752086639404 - 0.5322461128234863 - <_> - - <_> - - - - <_>7 0 6 15 -1. - <_>9 0 2 15 3. - 0 - 4.3740210821852088e-004 - 0.4043039977550507 - 0.5409289002418518 - <_> - - <_> - - - - <_>6 11 3 1 -1. - <_>7 11 1 1 3. - 0 - 2.9482020181603730e-004 - 0.4494963884353638 - 0.5628852248191834 - <_> - - <_> - - - - <_>12 0 3 4 -1. - <_>13 0 1 4 3. - 0 - 0.0103126596659422 - 0.5177510976791382 - 0.2704316973686218 - <_> - - <_> - - - - <_>5 4 6 1 -1. - <_>7 4 2 1 3. - 0 - -7.7241109684109688e-003 - 0.1988019049167633 - 0.4980553984642029 - <_> - - <_> - - - - <_>12 7 3 2 -1. - <_>12 8 3 1 2. - 0 - -4.6797208487987518e-003 - 0.6644750237464905 - 0.5018296241760254 - <_> - - <_> - - - - <_>0 1 4 6 -1. - <_>0 4 4 3 2. - 0 - -5.0755459815263748e-003 - 0.3898304998874664 - 0.5185269117355347 - <_> - - <_> - - - - <_>12 7 3 2 -1. - <_>12 8 3 1 2. - 0 - 2.2479740437120199e-003 - 0.4801808893680573 - 0.5660336017608643 - <_> - - <_> - - - - <_>2 16 3 3 -1. - <_>2 17 3 1 3. - 0 - 8.3327008178457618e-004 - 0.5210919976234436 - 0.3957188129425049 - <_> - - <_> - - - - <_>13 8 6 10 -1. - <_>16 8 3 5 2. - <_>13 13 3 5 2. - 0 - -0.0412793308496475 - 0.6154541969299316 - 0.5007054209709168 - <_> - - <_> - - - - <_>0 9 5 2 -1. - <_>0 10 5 1 2. - 0 - -5.0930189900100231e-004 - 0.3975942134857178 - 0.5228403806686401 - <_> - - <_> - - - - <_>12 11 2 2 -1. - <_>13 11 1 1 2. - <_>12 12 1 1 2. - 0 - 1.2568780221045017e-003 - 0.4979138076305389 - 0.5939183235168457 - <_> - - <_> - - - - <_>3 15 3 3 -1. - <_>3 16 3 1 3. - 0 - 8.0048497766256332e-003 - 0.4984497129917145 - 0.1633366048336029 - <_> - - <_> - - - - <_>12 7 3 2 -1. - <_>12 8 3 1 2. - 0 - -1.1879300000146031e-003 - 0.5904964804649353 - 0.4942624866962433 - <_> - - <_> - - - - <_>5 7 3 2 -1. - <_>5 8 3 1 2. - 0 - 6.1948952497914433e-004 - 0.4199557900428772 - 0.5328726172447205 - <_> - - <_> - - - - <_>9 5 9 9 -1. - <_>9 8 9 3 3. - 0 - 6.6829859279096127e-003 - 0.5418602824211121 - 0.4905889034271240 - <_> - - <_> - - - - <_>5 0 3 7 -1. - <_>6 0 1 7 3. - 0 - -3.7062340416014194e-003 - 0.3725939095020294 - 0.5138000249862671 - <_> - - <_> - - - - <_>5 2 12 5 -1. - <_>9 2 4 5 3. - 0 - -0.0397394113242626 - 0.6478961110115051 - 0.5050346851348877 - <_> - - <_> - - - - <_>6 11 2 2 -1. - <_>6 11 1 1 2. - <_>7 12 1 1 2. - 0 - 1.4085009461268783e-003 - 0.4682339131832123 - 0.6377884149551392 - <_> - - <_> - - - - <_>15 15 3 2 -1. - <_>15 16 3 1 2. - 0 - 3.9322688826359808e-004 - 0.5458530187606812 - 0.4150482118129730 - <_> - - <_> - - - - <_>2 15 3 2 -1. - <_>2 16 3 1 2. - 0 - -1.8979819724336267e-003 - 0.3690159916877747 - 0.5149704217910767 - <_> - - <_> - - - - <_>14 12 6 8 -1. - <_>17 12 3 4 2. - <_>14 16 3 4 2. - 0 - -0.0139704402536154 - 0.6050562858581543 - 0.4811357855796814 - <_> - - <_> - - - - <_>2 8 15 6 -1. - <_>7 8 5 6 3. - 0 - -0.1010081991553307 - 0.2017080038785934 - 0.4992361962795258 - <_> - - <_> - - - - <_>2 2 18 17 -1. - <_>8 2 6 17 3. - 0 - -0.0173469204455614 - 0.5713148713111877 - 0.4899486005306244 - <_> - - <_> - - - - <_>5 1 4 1 -1. - <_>7 1 2 1 2. - 0 - 1.5619759506080300e-004 - 0.4215388894081116 - 0.5392642021179199 - <_> - - <_> - - - - <_>5 2 12 5 -1. - <_>9 2 4 5 3. - 0 - 0.1343892961740494 - 0.5136151909828186 - 0.3767612874507904 - <_> - - <_> - - - - <_>3 2 12 5 -1. - <_>7 2 4 5 3. - 0 - -0.0245822407305241 - 0.7027357816696167 - 0.4747906923294067 - <_> - - <_> - - - - <_>4 9 12 4 -1. - <_>10 9 6 2 2. - <_>4 11 6 2 2. - 0 - -3.8553720805794001e-003 - 0.4317409098148346 - 0.5427716970443726 - <_> - - <_> - - - - <_>5 15 6 2 -1. - <_>5 15 3 1 2. - <_>8 16 3 1 2. - 0 - -2.3165249731391668e-003 - 0.5942698717117310 - 0.4618647992610931 - <_> - - <_> - - - - <_>10 14 2 3 -1. - <_>10 15 2 1 3. - 0 - -4.8518120311200619e-003 - 0.6191568970680237 - 0.4884895086288452 - <_> - - <_> - - - - <_>0 13 20 2 -1. - <_>0 13 10 1 2. - <_>10 14 10 1 2. - 0 - 2.4699938949197531e-003 - 0.5256664752960205 - 0.4017199873924255 - <_> - - <_> - - - - <_>4 9 12 8 -1. - <_>10 9 6 4 2. - <_>4 13 6 4 2. - 0 - 0.0454969592392445 - 0.5237867832183838 - 0.2685773968696594 - <_> - - <_> - - - - <_>8 13 3 6 -1. - <_>8 16 3 3 2. - 0 - -0.0203195996582508 - 0.2130445986986160 - 0.4979738891124725 - <_> - - <_> - - - - <_>10 12 2 2 -1. - <_>10 13 2 1 2. - 0 - 2.6994998916052282e-004 - 0.4814041852951050 - 0.5543122291564941 - <_> - - <_> - - - - <_>9 12 2 2 -1. - <_>9 12 1 1 2. - <_>10 13 1 1 2. - 0 - -1.8232699949294329e-003 - 0.6482579708099365 - 0.4709989130496979 - <_> - - <_> - - - - <_>4 11 14 4 -1. - <_>11 11 7 2 2. - <_>4 13 7 2 2. - 0 - -6.3015790656208992e-003 - 0.4581927955150604 - 0.5306236147880554 - <_> - - <_> - - - - <_>8 5 4 2 -1. - <_>8 6 4 1 2. - 0 - -2.4139499873854220e-004 - 0.5232086777687073 - 0.4051763117313385 - <_> - - <_> - - - - <_>10 10 6 3 -1. - <_>12 10 2 3 3. - 0 - -1.0330369696021080e-003 - 0.5556201934814453 - 0.4789193868637085 - <_> - - <_> - - - - <_>2 14 1 2 -1. - <_>2 15 1 1 2. - 0 - 1.8041160365100950e-004 - 0.5229442715644836 - 0.4011810123920441 - <_> - - <_> - - - - <_>13 8 6 12 -1. - <_>16 8 3 6 2. - <_>13 14 3 6 2. - 0 - -0.0614078603684902 - 0.6298682093620300 - 0.5010703206062317 - <_> - - <_> - - - - <_>1 8 6 12 -1. - <_>1 8 3 6 2. - <_>4 14 3 6 2. - 0 - -0.0695439130067825 - 0.7228280901908875 - 0.4773184061050415 - <_> - - <_> - - - - <_>10 0 6 10 -1. - <_>12 0 2 10 3. - 0 - -0.0705426633358002 - 0.2269513010978699 - 0.5182529091835022 - <_> - - <_> - - - - <_>5 11 8 4 -1. - <_>5 11 4 2 2. - <_>9 13 4 2 2. - 0 - 2.4423799477517605e-003 - 0.5237097144126892 - 0.4098151028156281 - <_> - - <_> - - - - <_>10 16 8 4 -1. - <_>14 16 4 2 2. - <_>10 18 4 2 2. - 0 - 1.5494349645450711e-003 - 0.4773750901222229 - 0.5468043088912964 - <_> - - <_> - - - - <_>7 7 6 6 -1. - <_>9 7 2 6 3. - 0 - -0.0239142198115587 - 0.7146975994110107 - 0.4783824980258942 - <_> - - <_> - - - - <_>10 2 4 10 -1. - <_>10 2 2 10 2. - 0 - -0.0124536901712418 - 0.2635296881198883 - 0.5241122841835022 - <_> - - <_> - - - - <_>6 1 4 9 -1. - <_>8 1 2 9 2. - 0 - -2.0760179904755205e-004 - 0.3623757064342499 - 0.5113608837127686 - <_> - - <_> - - - - <_>12 19 2 1 -1. - <_>12 19 1 1 2. - 0 - 2.9781080229440704e-005 - 0.4705932140350342 - 0.5432801842689514 - 90.2533493041992190 - 18 - -1 - <_> - - - <_> - - <_> - - - - <_>1 2 4 9 -1. - <_>3 2 2 9 2. - 0 - 0.0117727499455214 - 0.3860518932342529 - 0.6421167254447937 - <_> - - <_> - - - - <_>7 5 6 4 -1. - <_>9 5 2 4 3. - 0 - 0.0270375702530146 - 0.4385654926300049 - 0.6754038929939270 - <_> - - <_> - - - - <_>9 4 2 4 -1. - <_>9 6 2 2 2. - 0 - -3.6419500247575343e-005 - 0.5487101078033447 - 0.3423315882682800 - <_> - - <_> - - - - <_>14 5 2 8 -1. - <_>14 9 2 4 2. - 0 - 1.9995409529656172e-003 - 0.3230532109737396 - 0.5400317907333374 - <_> - - <_> - - - - <_>7 6 5 12 -1. - <_>7 12 5 6 2. - 0 - 4.5278300531208515e-003 - 0.5091639757156372 - 0.2935043871402741 - <_> - - <_> - - - - <_>14 6 2 6 -1. - <_>14 9 2 3 2. - 0 - 4.7890920541249216e-004 - 0.4178153872489929 - 0.5344064235687256 - <_> - - <_> - - - - <_>4 6 2 6 -1. - <_>4 9 2 3 2. - 0 - 1.1720920447260141e-003 - 0.2899182140827179 - 0.5132070779800415 - <_> - - <_> - - - - <_>8 15 10 4 -1. - <_>13 15 5 2 2. - <_>8 17 5 2 2. - 0 - 9.5305702416226268e-004 - 0.4280124902725220 - 0.5560845136642456 - <_> - - <_> - - - - <_>6 18 2 2 -1. - <_>7 18 1 2 2. - 0 - 1.5099150004971307e-005 - 0.4044871926307678 - 0.5404760241508484 - <_> - - <_> - - - - <_>11 3 6 2 -1. - <_>11 4 6 1 2. - 0 - -6.0817901976406574e-004 - 0.4271768927574158 - 0.5503466129302979 - <_> - - <_> - - - - <_>2 0 16 6 -1. - <_>2 2 16 2 3. - 0 - 3.3224520739167929e-003 - 0.3962723910808563 - 0.5369734764099121 - <_> - - <_> - - - - <_>11 3 6 2 -1. - <_>11 4 6 1 2. - 0 - -1.1037490330636501e-003 - 0.4727177917957306 - 0.5237749814987183 - <_> - - <_> - - - - <_>4 11 10 3 -1. - <_>4 12 10 1 3. - 0 - -1.4350269921123981e-003 - 0.5603008270263672 - 0.4223509132862091 - <_> - - <_> - - - - <_>11 3 6 2 -1. - <_>11 4 6 1 2. - 0 - 2.0767399109899998e-003 - 0.5225917100906372 - 0.4732725918292999 - <_> - - <_> - - - - <_>3 3 6 2 -1. - <_>3 4 6 1 2. - 0 - -1.6412809782195836e-004 - 0.3999075889587402 - 0.5432739853858948 - <_> - - <_> - - - - <_>16 0 4 7 -1. - <_>16 0 2 7 2. - 0 - 8.8302437216043472e-003 - 0.4678385853767395 - 0.6027327179908752 - <_> - - <_> - - - - <_>0 14 9 6 -1. - <_>0 16 9 2 3. - 0 - -0.0105520701035857 - 0.3493967056274414 - 0.5213974714279175 - <_> - - <_> - - - - <_>9 16 3 3 -1. - <_>9 17 3 1 3. - 0 - -2.2731600329279900e-003 - 0.6185818910598755 - 0.4749062955379486 - <_> - - <_> - - - - <_>4 6 6 2 -1. - <_>6 6 2 2 3. - 0 - -8.4786332445219159e-004 - 0.5285341143608093 - 0.3843482136726379 - <_> - - <_> - - - - <_>15 11 1 3 -1. - <_>15 12 1 1 3. - 0 - 1.2081359745934606e-003 - 0.5360640883445740 - 0.3447335958480835 - <_> - - <_> - - - - <_>5 5 2 3 -1. - <_>5 6 2 1 3. - 0 - 2.6512730401009321e-003 - 0.4558292031288147 - 0.6193962097167969 - <_> - - <_> - - - - <_>10 9 2 2 -1. - <_>10 10 2 1 2. - 0 - -1.1012479662895203e-003 - 0.3680230081081390 - 0.5327628254890442 - <_> - - <_> - - - - <_>3 1 4 3 -1. - <_>5 1 2 3 2. - 0 - 4.9561518244445324e-004 - 0.3960595130920410 - 0.5274940729141235 - <_> - - <_> - - - - <_>16 0 4 7 -1. - <_>16 0 2 7 2. - 0 - -0.0439017713069916 - 0.7020444869995117 - 0.4992839097976685 - <_> - - <_> - - - - <_>0 0 20 1 -1. - <_>10 0 10 1 2. - 0 - 0.0346903502941132 - 0.5049164295196533 - 0.2766602933406830 - <_> - - <_> - - - - <_>15 11 1 3 -1. - <_>15 12 1 1 3. - 0 - -2.7442190330475569e-003 - 0.2672632932662964 - 0.5274971127510071 - <_> - - <_> - - - - <_>0 4 3 4 -1. - <_>1 4 1 4 3. - 0 - 3.3316588960587978e-003 - 0.4579482972621918 - 0.6001101732254028 - <_> - - <_> - - - - <_>16 3 3 6 -1. - <_>16 5 3 2 3. - 0 - -0.0200445707887411 - 0.3171594142913818 - 0.5235717892646790 - <_> - - <_> - - - - <_>1 3 3 6 -1. - <_>1 5 3 2 3. - 0 - 1.3492030557245016e-003 - 0.5265362858772278 - 0.4034324884414673 - <_> - - <_> - - - - <_>6 2 12 6 -1. - <_>12 2 6 3 2. - <_>6 5 6 3 2. - 0 - 2.9702018946409225e-003 - 0.5332456827163696 - 0.4571984112262726 - <_> - - <_> - - - - <_>8 10 4 3 -1. - <_>8 11 4 1 3. - 0 - 6.3039981760084629e-003 - 0.4593310952186585 - 0.6034635901451111 - <_> - - <_> - - - - <_>4 2 14 6 -1. - <_>11 2 7 3 2. - <_>4 5 7 3 2. - 0 - -0.0129365902394056 - 0.4437963962554932 - 0.5372971296310425 - <_> - - <_> - - - - <_>9 11 2 3 -1. - <_>9 12 2 1 3. - 0 - 4.0148729458451271e-003 - 0.4680323898792267 - 0.6437833905220032 - <_> - - <_> - - - - <_>15 13 2 3 -1. - <_>15 14 2 1 3. - 0 - -2.6401679497212172e-003 - 0.3709631860256195 - 0.5314332842826843 - <_> - - <_> - - - - <_>8 12 4 3 -1. - <_>8 13 4 1 3. - 0 - 0.0139184398576617 - 0.4723555147647858 - 0.7130808830261231 - <_> - - <_> - - - - <_>15 11 1 3 -1. - <_>15 12 1 1 3. - 0 - -4.5087869511917233e-004 - 0.4492394030094147 - 0.5370404124259949 - <_> - - <_> - - - - <_>7 13 5 2 -1. - <_>7 14 5 1 2. - 0 - 2.5384349282830954e-004 - 0.4406864047050476 - 0.5514402985572815 - <_> - - <_> - - - - <_>7 12 6 3 -1. - <_>7 13 6 1 3. - 0 - 2.2710000630468130e-003 - 0.4682416915893555 - 0.5967984199523926 - <_> - - <_> - - - - <_>5 11 4 4 -1. - <_>5 13 4 2 2. - 0 - 2.4120779708027840e-003 - 0.5079392194747925 - 0.3018598854541779 - <_> - - <_> - - - - <_>11 4 3 3 -1. - <_>12 4 1 3 3. - 0 - -3.6025670851813629e-005 - 0.5601037144660950 - 0.4471096992492676 - <_> - - <_> - - - - <_>6 4 3 3 -1. - <_>7 4 1 3 3. - 0 - -7.4905529618263245e-003 - 0.2207535058259964 - 0.4989944100379944 - <_> - - <_> - - - - <_>16 5 3 6 -1. - <_>17 5 1 6 3. - 0 - -0.0175131205469370 - 0.6531215906143189 - 0.5017648935317993 - <_> - - <_> - - - - <_>3 6 12 7 -1. - <_>7 6 4 7 3. - 0 - 0.1428163051605225 - 0.4967963099479675 - 0.1482062041759491 - <_> - - <_> - - - - <_>16 5 3 6 -1. - <_>17 5 1 6 3. - 0 - 5.5345268920063972e-003 - 0.4898946881294251 - 0.5954223871231079 - <_> - - <_> - - - - <_>3 13 2 3 -1. - <_>3 14 2 1 3. - 0 - -9.6323591424152255e-004 - 0.3927116990089417 - 0.5196074247360230 - <_> - - <_> - - - - <_>16 5 3 6 -1. - <_>17 5 1 6 3. - 0 - -2.0370010752230883e-003 - 0.5613325238227844 - 0.4884858131408691 - <_> - - <_> - - - - <_>1 5 3 6 -1. - <_>2 5 1 6 3. - 0 - 1.6614829655736685e-003 - 0.4472880065441132 - 0.5578880906105042 - <_> - - <_> - - - - <_>1 9 18 1 -1. - <_>7 9 6 1 3. - 0 - -3.1188090797513723e-003 - 0.3840532898902893 - 0.5397477746009827 - <_> - - <_> - - - - <_>0 9 8 7 -1. - <_>4 9 4 7 2. - 0 - -6.4000617712736130e-003 - 0.5843983888626099 - 0.4533218145370483 - <_> - - <_> - - - - <_>12 11 8 2 -1. - <_>12 12 8 1 2. - 0 - 3.1319601112045348e-004 - 0.5439221858978272 - 0.4234727919101715 - <_> - - <_> - - - - <_>0 11 8 2 -1. - <_>0 12 8 1 2. - 0 - -0.0182220991700888 - 0.1288464963436127 - 0.4958404898643494 - <_> - - <_> - - - - <_>9 13 2 3 -1. - <_>9 14 2 1 3. - 0 - 8.7969247251749039e-003 - 0.4951297938823700 - 0.7153480052947998 - <_> - - <_> - - - - <_>4 10 12 4 -1. - <_>4 10 6 2 2. - <_>10 12 6 2 2. - 0 - -4.2395070195198059e-003 - 0.3946599960327148 - 0.5194936990737915 - <_> - - <_> - - - - <_>9 3 3 7 -1. - <_>10 3 1 7 3. - 0 - 9.7086271271109581e-003 - 0.4897503852844238 - 0.6064900159835815 - <_> - - <_> - - - - <_>7 2 3 5 -1. - <_>8 2 1 5 3. - 0 - -3.9934171363711357e-003 - 0.3245440125465393 - 0.5060828924179077 - <_> - - <_> - - - - <_>9 12 4 6 -1. - <_>11 12 2 3 2. - <_>9 15 2 3 2. - 0 - -0.0167850591242313 - 0.1581953018903732 - 0.5203778743743897 - <_> - - <_> - - - - <_>8 7 3 6 -1. - <_>9 7 1 6 3. - 0 - 0.0182720907032490 - 0.4680935144424439 - 0.6626979112625122 - <_> - - <_> - - - - <_>15 4 4 2 -1. - <_>15 5 4 1 2. - 0 - 5.6872838176786900e-003 - 0.5211697816848755 - 0.3512184917926788 - <_> - - <_> - - - - <_>8 7 3 3 -1. - <_>9 7 1 3 3. - 0 - -1.0739039862528443e-003 - 0.5768386125564575 - 0.4529845118522644 - <_> - - <_> - - - - <_>14 2 6 4 -1. - <_>14 4 6 2 2. - 0 - -3.7093870341777802e-003 - 0.4507763087749481 - 0.5313581228256226 - <_> - - <_> - - - - <_>7 16 6 1 -1. - <_>9 16 2 1 3. - 0 - -2.1110709349159151e-004 - 0.5460820198059082 - 0.4333376884460449 - <_> - - <_> - - - - <_>15 13 2 3 -1. - <_>15 14 2 1 3. - 0 - 1.0670139454305172e-003 - 0.5371856093406677 - 0.4078390896320343 - <_> - - <_> - - - - <_>8 7 3 10 -1. - <_>9 7 1 10 3. - 0 - 3.5943021066486835e-003 - 0.4471287131309509 - 0.5643836259841919 - <_> - - <_> - - - - <_>11 10 2 6 -1. - <_>11 12 2 2 3. - 0 - -5.1776031032204628e-003 - 0.4499393105506897 - 0.5280330181121826 - <_> - - <_> - - - - <_>6 10 4 1 -1. - <_>8 10 2 1 2. - 0 - -2.5414369883947074e-004 - 0.5516173243522644 - 0.4407708048820496 - <_> - - <_> - - - - <_>10 9 2 2 -1. - <_>10 10 2 1 2. - 0 - 6.3522560521960258e-003 - 0.5194190144538879 - 0.2465227991342545 - <_> - - <_> - - - - <_>8 9 2 2 -1. - <_>8 10 2 1 2. - 0 - -4.4205080484971404e-004 - 0.3830705881118774 - 0.5139682292938232 - <_> - - <_> - - - - <_>12 7 2 2 -1. - <_>13 7 1 1 2. - <_>12 8 1 1 2. - 0 - 7.4488727841526270e-004 - 0.4891090989112854 - 0.5974786877632141 - <_> - - <_> - - - - <_>5 7 2 2 -1. - <_>5 7 1 1 2. - <_>6 8 1 1 2. - 0 - -3.5116379149258137e-003 - 0.7413681745529175 - 0.4768764972686768 - <_> - - <_> - - - - <_>13 0 3 14 -1. - <_>14 0 1 14 3. - 0 - -0.0125409103929996 - 0.3648819029331207 - 0.5252826809883118 - <_> - - <_> - - - - <_>4 0 3 14 -1. - <_>5 0 1 14 3. - 0 - 9.4931852072477341e-003 - 0.5100492835044861 - 0.3629586994647980 - <_> - - <_> - - - - <_>13 4 3 14 -1. - <_>14 4 1 14 3. - 0 - 0.0129611501470208 - 0.5232442021369934 - 0.4333561062812805 - <_> - - <_> - - - - <_>9 14 2 3 -1. - <_>9 15 2 1 3. - 0 - 4.7209449112415314e-003 - 0.4648149013519287 - 0.6331052780151367 - <_> - - <_> - - - - <_>8 14 4 3 -1. - <_>8 15 4 1 3. - 0 - -2.3119079414755106e-003 - 0.5930309891700745 - 0.4531058073043823 - <_> - - <_> - - - - <_>4 2 3 16 -1. - <_>5 2 1 16 3. - 0 - -2.8262299019843340e-003 - 0.3870477974414825 - 0.5257101058959961 - <_> - - <_> - - - - <_>7 2 8 10 -1. - <_>7 7 8 5 2. - 0 - -1.4311339473351836e-003 - 0.5522503256797791 - 0.4561854898929596 - <_> - - <_> - - - - <_>6 14 7 3 -1. - <_>6 15 7 1 3. - 0 - 1.9378310535103083e-003 - 0.4546220898628235 - 0.5736966729164124 - <_> - - <_> - - - - <_>9 2 10 12 -1. - <_>14 2 5 6 2. - <_>9 8 5 6 2. - 0 - 2.6343559147790074e-004 - 0.5345739126205444 - 0.4571875035762787 - <_> - - <_> - - - - <_>6 7 8 2 -1. - <_>6 8 8 1 2. - 0 - 7.8257522545754910e-004 - 0.3967815935611725 - 0.5220187902450562 - <_> - - <_> - - - - <_>8 13 4 6 -1. - <_>8 16 4 3 2. - 0 - -0.0195504408329725 - 0.2829642891883850 - 0.5243508219718933 - <_> - - <_> - - - - <_>6 6 1 3 -1. - <_>6 7 1 1 3. - 0 - 4.3914958951063454e-004 - 0.4590066969394684 - 0.5899090170860291 - <_> - - <_> - - - - <_>16 2 4 6 -1. - <_>16 4 4 2 3. - 0 - 0.0214520003646612 - 0.5231410861015320 - 0.2855378985404968 - <_> - - <_> - - - - <_>6 6 4 2 -1. - <_>6 6 2 1 2. - <_>8 7 2 1 2. - 0 - 5.8973580598831177e-004 - 0.4397256970405579 - 0.5506421923637390 - <_> - - <_> - - - - <_>16 2 4 6 -1. - <_>16 4 4 2 3. - 0 - -0.0261576101183891 - 0.3135079145431519 - 0.5189175009727478 - <_> - - <_> - - - - <_>0 2 4 6 -1. - <_>0 4 4 2 3. - 0 - -0.0139598604291677 - 0.3213272988796234 - 0.5040717720985413 - <_> - - <_> - - - - <_>9 6 2 6 -1. - <_>9 6 1 6 2. - 0 - -6.3699018210172653e-003 - 0.6387544870376587 - 0.4849506914615631 - <_> - - <_> - - - - <_>3 4 6 10 -1. - <_>3 9 6 5 2. - 0 - -8.5613820701837540e-003 - 0.2759132087230682 - 0.5032019019126892 - <_> - - <_> - - - - <_>9 5 2 6 -1. - <_>9 5 1 6 2. - 0 - 9.6622901037335396e-004 - 0.4685640931129456 - 0.5834879279136658 - <_> - - <_> - - - - <_>3 13 2 3 -1. - <_>3 14 2 1 3. - 0 - 7.6550268568098545e-004 - 0.5175207257270813 - 0.3896422088146210 - <_> - - <_> - - - - <_>13 13 3 2 -1. - <_>13 14 3 1 2. - 0 - -8.1833340227603912e-003 - 0.2069136947393417 - 0.5208122134208679 - <_> - - <_> - - - - <_>2 16 10 4 -1. - <_>2 16 5 2 2. - <_>7 18 5 2 2. - 0 - -9.3976939097046852e-003 - 0.6134091019630432 - 0.4641222953796387 - <_> - - <_> - - - - <_>5 6 10 6 -1. - <_>10 6 5 3 2. - <_>5 9 5 3 2. - 0 - 4.8028980381786823e-003 - 0.5454108119010925 - 0.4395219981670380 - <_> - - <_> - - - - <_>7 14 1 3 -1. - <_>7 15 1 1 3. - 0 - -3.5680569708347321e-003 - 0.6344485282897949 - 0.4681093990802765 - <_> - - <_> - - - - <_>14 16 6 3 -1. - <_>14 17 6 1 3. - 0 - 4.0733120404183865e-003 - 0.5292683243751526 - 0.4015620052814484 - <_> - - <_> - - - - <_>5 4 3 3 -1. - <_>5 5 3 1 3. - 0 - 1.2568129459396005e-003 - 0.4392988085746765 - 0.5452824831008911 - <_> - - <_> - - - - <_>7 4 10 3 -1. - <_>7 5 10 1 3. - 0 - -2.9065010603517294e-003 - 0.5898832082748413 - 0.4863379895687103 - <_> - - <_> - - - - <_>0 4 5 4 -1. - <_>0 6 5 2 2. - 0 - -2.4409340694546700e-003 - 0.4069364964962006 - 0.5247421860694885 - <_> - - <_> - - - - <_>13 11 3 9 -1. - <_>13 14 3 3 3. - 0 - 0.0248307008296251 - 0.5182725787162781 - 0.3682524859905243 - <_> - - <_> - - - - <_>4 11 3 9 -1. - <_>4 14 3 3 3. - 0 - -0.0488540083169937 - 0.1307577937841415 - 0.4961281120777130 - <_> - - <_> - - - - <_>9 7 2 1 -1. - <_>9 7 1 1 2. - 0 - -1.6110379947349429e-003 - 0.6421005725860596 - 0.4872662127017975 - <_> - - <_> - - - - <_>5 0 6 17 -1. - <_>7 0 2 17 3. - 0 - -0.0970094799995422 - 0.0477693490684032 - 0.4950988888740540 - <_> - - <_> - - - - <_>10 3 6 3 -1. - <_>10 3 3 3 2. - 0 - 1.1209240183234215e-003 - 0.4616267085075378 - 0.5354745984077454 - <_> - - <_> - - - - <_>2 2 15 4 -1. - <_>7 2 5 4 3. - 0 - -1.3064090162515640e-003 - 0.6261854171752930 - 0.4638805985450745 - <_> - - <_> - - - - <_>8 2 8 2 -1. - <_>12 2 4 1 2. - <_>8 3 4 1 2. - 0 - 4.5771620352752507e-004 - 0.5384417772293091 - 0.4646640121936798 - <_> - - <_> - - - - <_>8 1 3 6 -1. - <_>8 3 3 2 3. - 0 - -6.3149951165542006e-004 - 0.3804047107696533 - 0.5130257010459900 - <_> - - <_> - - - - <_>9 17 2 2 -1. - <_>9 18 2 1 2. - 0 - 1.4505970466416329e-004 - 0.4554310142993927 - 0.5664461851119995 - <_> - - <_> - - - - <_>0 0 2 14 -1. - <_>1 0 1 14 2. - 0 - -0.0164745505899191 - 0.6596958041191101 - 0.4715859889984131 - <_> - - <_> - - - - <_>12 0 7 3 -1. - <_>12 1 7 1 3. - 0 - 0.0133695797994733 - 0.5195466279983521 - 0.3035964965820313 - <_> - - <_> - - - - <_>1 14 1 2 -1. - <_>1 15 1 1 2. - 0 - 1.0271780047332868e-004 - 0.5229176282882690 - 0.4107066094875336 - <_> - - <_> - - - - <_>14 12 2 8 -1. - <_>15 12 1 4 2. - <_>14 16 1 4 2. - 0 - -5.5311559699475765e-003 - 0.6352887749671936 - 0.4960907101631165 - <_> - - <_> - - - - <_>1 0 7 3 -1. - <_>1 1 7 1 3. - 0 - -2.6187049224972725e-003 - 0.3824546039104462 - 0.5140984058380127 - <_> - - <_> - - - - <_>14 12 2 8 -1. - <_>15 12 1 4 2. - <_>14 16 1 4 2. - 0 - 5.0834268331527710e-003 - 0.4950439929962158 - 0.6220818758010864 - <_> - - <_> - - - - <_>6 0 8 12 -1. - <_>6 0 4 6 2. - <_>10 6 4 6 2. - 0 - 0.0798181593418121 - 0.4952335953712463 - 0.1322475969791412 - <_> - - <_> - - - - <_>6 1 8 9 -1. - <_>6 4 8 3 3. - 0 - -0.0992265865206718 - 0.7542728781700134 - 0.5008416771888733 - <_> - - <_> - - - - <_>5 2 2 2 -1. - <_>5 3 2 1 2. - 0 - -6.5174017800018191e-004 - 0.3699302971363068 - 0.5130121111869812 - <_> - - <_> - - - - <_>13 14 6 6 -1. - <_>16 14 3 3 2. - <_>13 17 3 3 2. - 0 - -0.0189968496561050 - 0.6689178943634033 - 0.4921202957630158 - <_> - - <_> - - - - <_>0 17 20 2 -1. - <_>0 17 10 1 2. - <_>10 18 10 1 2. - 0 - 0.0173468999564648 - 0.4983300864696503 - 0.1859198063611984 - <_> - - <_> - - - - <_>10 3 2 6 -1. - <_>11 3 1 3 2. - <_>10 6 1 3 2. - 0 - 5.5082101607695222e-004 - 0.4574424028396606 - 0.5522121787071228 - <_> - - <_> - - - - <_>5 12 6 2 -1. - <_>8 12 3 2 2. - 0 - 2.0056050270795822e-003 - 0.5131744742393494 - 0.3856469988822937 - <_> - - <_> - - - - <_>10 7 6 13 -1. - <_>10 7 3 13 2. - 0 - -7.7688191086053848e-003 - 0.4361700117588043 - 0.5434309244155884 - <_> - - <_> - - - - <_>5 15 10 5 -1. - <_>10 15 5 5 2. - 0 - 0.0508782789111137 - 0.4682720899581909 - 0.6840639710426331 - <_> - - <_> - - - - <_>10 4 4 10 -1. - <_>10 4 2 10 2. - 0 - -2.2901780903339386e-003 - 0.4329245090484619 - 0.5306099057197571 - <_> - - <_> - - - - <_>5 7 2 1 -1. - <_>6 7 1 1 2. - 0 - -1.5715380141045898e-004 - 0.5370057225227356 - 0.4378164112567902 - <_> - - <_> - - - - <_>10 3 6 7 -1. - <_>10 3 3 7 2. - 0 - 0.1051924005150795 - 0.5137274265289307 - 0.0673614665865898 - <_> - - <_> - - - - <_>4 3 6 7 -1. - <_>7 3 3 7 2. - 0 - 2.7198919560760260e-003 - 0.4112060964107513 - 0.5255665183067322 - <_> - - <_> - - - - <_>1 7 18 5 -1. - <_>7 7 6 5 3. - 0 - 0.0483377799391747 - 0.5404623746871948 - 0.4438967108726502 - <_> - - <_> - - - - <_>3 17 4 3 -1. - <_>5 17 2 3 2. - 0 - 9.5703761326149106e-004 - 0.4355969130992889 - 0.5399510860443115 - <_> - - <_> - - - - <_>8 14 12 6 -1. - <_>14 14 6 3 2. - <_>8 17 6 3 2. - 0 - -0.0253712590783834 - 0.5995175242424011 - 0.5031024813652039 - <_> - - <_> - - - - <_>0 13 20 4 -1. - <_>0 13 10 2 2. - <_>10 15 10 2 2. - 0 - 0.0524579510092735 - 0.4950287938117981 - 0.1398351043462753 - <_> - - <_> - - - - <_>4 5 14 2 -1. - <_>11 5 7 1 2. - <_>4 6 7 1 2. - 0 - -0.0123656298965216 - 0.6397299170494080 - 0.4964106082916260 - <_> - - <_> - - - - <_>1 2 10 12 -1. - <_>1 2 5 6 2. - <_>6 8 5 6 2. - 0 - -0.1458971947431564 - 0.1001669988036156 - 0.4946322143077850 - <_> - - <_> - - - - <_>6 1 14 3 -1. - <_>6 2 14 1 3. - 0 - -0.0159086007624865 - 0.3312329947948456 - 0.5208340883255005 - <_> - - <_> - - - - <_>8 16 2 3 -1. - <_>8 17 2 1 3. - 0 - 3.9486068999394774e-004 - 0.4406363964080811 - 0.5426102876663208 - <_> - - <_> - - - - <_>9 17 3 2 -1. - <_>10 17 1 2 3. - 0 - -5.2454001270234585e-003 - 0.2799589931964874 - 0.5189967155456543 - <_> - - <_> - - - - <_>5 15 4 2 -1. - <_>5 15 2 1 2. - <_>7 16 2 1 2. - 0 - -5.0421799533069134e-003 - 0.6987580060958862 - 0.4752142131328583 - <_> - - <_> - - - - <_>10 15 1 3 -1. - <_>10 16 1 1 3. - 0 - 2.9812189750373363e-003 - 0.4983288943767548 - 0.6307479739189148 - <_> - - <_> - - - - <_>8 16 4 4 -1. - <_>8 16 2 2 2. - <_>10 18 2 2 2. - 0 - -7.2884308174252510e-003 - 0.2982333004474640 - 0.5026869773864746 - <_> - - <_> - - - - <_>6 11 8 6 -1. - <_>6 14 8 3 2. - 0 - 1.5094350092113018e-003 - 0.5308442115783691 - 0.3832970857620239 - <_> - - <_> - - - - <_>2 13 5 2 -1. - <_>2 14 5 1 2. - 0 - -9.3340799212455750e-003 - 0.2037964016199112 - 0.4969817101955414 - <_> - - <_> - - - - <_>13 14 6 6 -1. - <_>16 14 3 3 2. - <_>13 17 3 3 2. - 0 - 0.0286671407520771 - 0.5025696754455566 - 0.6928027272224426 - <_> - - <_> - - - - <_>1 9 18 4 -1. - <_>7 9 6 4 3. - 0 - 0.1701968014240265 - 0.4960052967071533 - 0.1476442962884903 - <_> - - <_> - - - - <_>13 14 6 6 -1. - <_>16 14 3 3 2. - <_>13 17 3 3 2. - 0 - -3.2614478841423988e-003 - 0.5603063702583313 - 0.4826056063175201 - <_> - - <_> - - - - <_>0 2 1 6 -1. - <_>0 4 1 2 3. - 0 - 5.5769277969375253e-004 - 0.5205562114715576 - 0.4129633009433746 - <_> - - <_> - - - - <_>5 0 15 20 -1. - <_>5 10 15 10 2. - 0 - 0.3625833988189697 - 0.5221652984619141 - 0.3768612146377564 - <_> - - <_> - - - - <_>1 14 6 6 -1. - <_>1 14 3 3 2. - <_>4 17 3 3 2. - 0 - -0.0116151301190257 - 0.6022682785987854 - 0.4637489914894104 - <_> - - <_> - - - - <_>8 14 4 6 -1. - <_>10 14 2 3 2. - <_>8 17 2 3 2. - 0 - -4.0795197710394859e-003 - 0.4070447087287903 - 0.5337479114532471 - <_> - - <_> - - - - <_>7 11 2 1 -1. - <_>8 11 1 1 2. - 0 - 5.7204300537705421e-004 - 0.4601835012435913 - 0.5900393128395081 - <_> - - <_> - - - - <_>9 17 3 2 -1. - <_>10 17 1 2 3. - 0 - 6.7543348995968699e-004 - 0.5398252010345459 - 0.4345428943634033 - <_> - - <_> - - - - <_>8 17 3 2 -1. - <_>9 17 1 2 3. - 0 - 6.3295697327703238e-004 - 0.5201563239097595 - 0.4051358997821808 - <_> - - <_> - - - - <_>12 14 4 6 -1. - <_>14 14 2 3 2. - <_>12 17 2 3 2. - 0 - 1.2435320531949401e-003 - 0.4642387926578522 - 0.5547441244125366 - <_> - - <_> - - - - <_>4 14 4 6 -1. - <_>4 14 2 3 2. - <_>6 17 2 3 2. - 0 - -4.7363857738673687e-003 - 0.6198567152023315 - 0.4672552049160004 - <_> - - <_> - - - - <_>13 14 2 6 -1. - <_>14 14 1 3 2. - <_>13 17 1 3 2. - 0 - -6.4658462069928646e-003 - 0.6837332844734192 - 0.5019000768661499 - <_> - - <_> - - - - <_>5 14 2 6 -1. - <_>5 14 1 3 2. - <_>6 17 1 3 2. - 0 - 3.5017321351915598e-004 - 0.4344803094863892 - 0.5363622903823853 - <_> - - <_> - - - - <_>7 0 6 12 -1. - <_>7 4 6 4 3. - 0 - 1.5754920605104417e-004 - 0.4760079085826874 - 0.5732020735740662 - <_> - - <_> - - - - <_>0 7 12 2 -1. - <_>4 7 4 2 3. - 0 - 9.9774366244673729e-003 - 0.5090985894203186 - 0.3635039925575256 - <_> - - <_> - - - - <_>10 3 3 13 -1. - <_>11 3 1 13 3. - 0 - -4.1464529931545258e-004 - 0.5570064783096314 - 0.4593802094459534 - <_> - - <_> - - - - <_>7 3 3 13 -1. - <_>8 3 1 13 3. - 0 - -3.5888899583369493e-004 - 0.5356845855712891 - 0.4339134991168976 - <_> - - <_> - - - - <_>10 8 6 3 -1. - <_>10 9 6 1 3. - 0 - 4.0463250479660928e-004 - 0.4439803063869476 - 0.5436776876449585 - <_> - - <_> - - - - <_>3 11 3 2 -1. - <_>4 11 1 2 3. - 0 - -8.2184787606820464e-004 - 0.4042294919490814 - 0.5176299214363098 - <_> - - <_> - - - - <_>13 12 6 8 -1. - <_>16 12 3 4 2. - <_>13 16 3 4 2. - 0 - 5.9467419050633907e-003 - 0.4927651882171631 - 0.5633779764175415 - <_> - - <_> - - - - <_>7 6 6 5 -1. - <_>9 6 2 5 3. - 0 - -0.0217533893883228 - 0.8006293773651123 - 0.4800840914249420 - <_> - - <_> - - - - <_>17 11 2 7 -1. - <_>17 11 1 7 2. - 0 - -0.0145403798669577 - 0.3946054875850678 - 0.5182222723960877 - <_> - - <_> - - - - <_>3 13 8 2 -1. - <_>7 13 4 2 2. - 0 - -0.0405107699334621 - 0.0213249903172255 - 0.4935792982578278 - <_> - - <_> - - - - <_>6 9 8 3 -1. - <_>6 10 8 1 3. - 0 - -5.8458268176764250e-004 - 0.4012795984745026 - 0.5314025282859802 - <_> - - <_> - - - - <_>4 3 4 3 -1. - <_>4 4 4 1 3. - 0 - 5.5151800625026226e-003 - 0.4642418920993805 - 0.5896260738372803 - <_> - - <_> - - - - <_>11 3 4 3 -1. - <_>11 4 4 1 3. - 0 - -6.0626221820712090e-003 - 0.6502159237861633 - 0.5016477704048157 - <_> - - <_> - - - - <_>1 4 17 12 -1. - <_>1 8 17 4 3. - 0 - 0.0945358425378799 - 0.5264708995819092 - 0.4126827120780945 - <_> - - <_> - - - - <_>11 3 4 3 -1. - <_>11 4 4 1 3. - 0 - 4.7315051779150963e-003 - 0.4879199862480164 - 0.5892447829246521 - <_> - - <_> - - - - <_>4 8 6 3 -1. - <_>4 9 6 1 3. - 0 - -5.2571471314877272e-004 - 0.3917280137538910 - 0.5189412832260132 - <_> - - <_> - - - - <_>12 3 5 3 -1. - <_>12 4 5 1 3. - 0 - -2.5464049540460110e-003 - 0.5837599039077759 - 0.4985705912113190 - <_> - - <_> - - - - <_>1 11 2 7 -1. - <_>2 11 1 7 2. - 0 - -0.0260756891220808 - 0.1261983960866928 - 0.4955821931362152 - <_> - - <_> - - - - <_>15 12 2 8 -1. - <_>16 12 1 4 2. - <_>15 16 1 4 2. - 0 - -5.4779709316790104e-003 - 0.5722513794898987 - 0.5010265707969666 - <_> - - <_> - - - - <_>4 8 11 3 -1. - <_>4 9 11 1 3. - 0 - 5.1337741315364838e-003 - 0.5273262262344360 - 0.4226376116275787 - <_> - - <_> - - - - <_>9 13 6 2 -1. - <_>12 13 3 1 2. - <_>9 14 3 1 2. - 0 - 4.7944980906322598e-004 - 0.4450066983699799 - 0.5819587111473084 - <_> - - <_> - - - - <_>6 13 4 3 -1. - <_>6 14 4 1 3. - 0 - -2.1114079281687737e-003 - 0.5757653117179871 - 0.4511714875698090 - <_> - - <_> - - - - <_>9 12 3 3 -1. - <_>10 12 1 3 3. - 0 - -0.0131799904629588 - 0.1884381026029587 - 0.5160734057426453 - <_> - - <_> - - - - <_>5 3 3 3 -1. - <_>5 4 3 1 3. - 0 - -4.7968099825084209e-003 - 0.6589789986610413 - 0.4736118912696838 - <_> - - <_> - - - - <_>9 4 2 3 -1. - <_>9 5 2 1 3. - 0 - 6.7483168095350266e-003 - 0.5259429812431335 - 0.3356395065784454 - <_> - - <_> - - - - <_>0 2 16 3 -1. - <_>0 3 16 1 3. - 0 - 1.4623369788751006e-003 - 0.5355271100997925 - 0.4264092147350311 - <_> - - <_> - - - - <_>15 12 2 8 -1. - <_>16 12 1 4 2. - <_>15 16 1 4 2. - 0 - 4.7645159065723419e-003 - 0.5034406781196594 - 0.5786827802658081 - <_> - - <_> - - - - <_>3 12 2 8 -1. - <_>3 12 1 4 2. - <_>4 16 1 4 2. - 0 - 6.8066660314798355e-003 - 0.4756605029106140 - 0.6677829027175903 - <_> - - <_> - - - - <_>14 13 3 6 -1. - <_>14 15 3 2 3. - 0 - 3.6608621012419462e-003 - 0.5369611978530884 - 0.4311546981334686 - <_> - - <_> - - - - <_>3 13 3 6 -1. - <_>3 15 3 2 3. - 0 - 0.0214496403932571 - 0.4968641996383667 - 0.1888816058635712 - <_> - - <_> - - - - <_>6 5 10 2 -1. - <_>11 5 5 1 2. - <_>6 6 5 1 2. - 0 - 4.1678901761770248e-003 - 0.4930733144283295 - 0.5815368890762329 - <_> - - <_> - - - - <_>2 14 14 6 -1. - <_>2 17 14 3 2. - 0 - 8.6467564105987549e-003 - 0.5205205082893372 - 0.4132595062255859 - <_> - - <_> - - - - <_>10 14 1 3 -1. - <_>10 15 1 1 3. - 0 - -3.6114078829996288e-004 - 0.5483555197715759 - 0.4800927937030792 - <_> - - <_> - - - - <_>4 16 2 2 -1. - <_>4 16 1 1 2. - <_>5 17 1 1 2. - 0 - 1.0808729566633701e-003 - 0.4689902067184448 - 0.6041421294212341 - <_> - - <_> - - - - <_>10 6 2 3 -1. - <_>10 7 2 1 3. - 0 - 5.7719959877431393e-003 - 0.5171142220497131 - 0.3053277134895325 - <_> - - <_> - - - - <_>0 17 20 2 -1. - <_>0 17 10 1 2. - <_>10 18 10 1 2. - 0 - 1.5720770461484790e-003 - 0.5219978094100952 - 0.4178803861141205 - <_> - - <_> - - - - <_>13 6 1 3 -1. - <_>13 7 1 1 3. - 0 - -1.9307859474793077e-003 - 0.5860369801521301 - 0.4812920093536377 - <_> - - <_> - - - - <_>8 13 3 2 -1. - <_>9 13 1 2 3. - 0 - -7.8926272690296173e-003 - 0.1749276965856552 - 0.4971733987331390 - <_> - - <_> - - - - <_>12 2 3 3 -1. - <_>13 2 1 3 3. - 0 - -2.2224679123610258e-003 - 0.4342589080333710 - 0.5212848186492920 - <_> - - <_> - - - - <_>3 18 2 2 -1. - <_>3 18 1 1 2. - <_>4 19 1 1 2. - 0 - 1.9011989934369922e-003 - 0.4765186905860901 - 0.6892055273056030 - <_> - - <_> - - - - <_>9 16 3 4 -1. - <_>10 16 1 4 3. - 0 - 2.7576119173318148e-003 - 0.5262191295623779 - 0.4337486028671265 - <_> - - <_> - - - - <_>6 6 1 3 -1. - <_>6 7 1 1 3. - 0 - 5.1787449046969414e-003 - 0.4804069101810455 - 0.7843729257583618 - <_> - - <_> - - - - <_>13 1 5 2 -1. - <_>13 2 5 1 2. - 0 - -9.0273341629654169e-004 - 0.4120846986770630 - 0.5353423953056335 - <_> - - <_> - - - - <_>7 14 6 2 -1. - <_>7 14 3 1 2. - <_>10 15 3 1 2. - 0 - 5.1797959022223949e-003 - 0.4740372896194458 - 0.6425960063934326 - <_> - - <_> - - - - <_>11 3 3 4 -1. - <_>12 3 1 4 3. - 0 - -0.0101140001788735 - 0.2468792051076889 - 0.5175017714500427 - <_> - - <_> - - - - <_>1 13 12 6 -1. - <_>5 13 4 6 3. - 0 - -0.0186170600354671 - 0.5756294131278992 - 0.4628978967666626 - <_> - - <_> - - - - <_>14 11 5 2 -1. - <_>14 12 5 1 2. - 0 - 5.9225959703326225e-003 - 0.5169625878334045 - 0.3214271068572998 - <_> - - <_> - - - - <_>2 15 14 4 -1. - <_>2 15 7 2 2. - <_>9 17 7 2 2. - 0 - -6.2945079989731312e-003 - 0.3872014880180359 - 0.5141636729240418 - <_> - - <_> - - - - <_>3 7 14 2 -1. - <_>10 7 7 1 2. - <_>3 8 7 1 2. - 0 - 6.5353019163012505e-003 - 0.4853048920631409 - 0.6310489773750305 - <_> - - <_> - - - - <_>1 11 4 2 -1. - <_>1 12 4 1 2. - 0 - 1.0878399480134249e-003 - 0.5117315053939819 - 0.3723258972167969 - <_> - - <_> - - - - <_>14 0 6 14 -1. - <_>16 0 2 14 3. - 0 - -0.0225422400981188 - 0.5692740082740784 - 0.4887112975120544 - <_> - - <_> - - - - <_>4 11 1 3 -1. - <_>4 12 1 1 3. - 0 - -3.0065660830587149e-003 - 0.2556012868881226 - 0.5003992915153503 - <_> - - <_> - - - - <_>14 0 6 14 -1. - <_>16 0 2 14 3. - 0 - 7.4741272255778313e-003 - 0.4810872972011566 - 0.5675926804542542 - <_> - - <_> - - - - <_>1 10 3 7 -1. - <_>2 10 1 7 3. - 0 - 0.0261623207479715 - 0.4971194863319397 - 0.1777237057685852 - <_> - - <_> - - - - <_>8 12 9 2 -1. - <_>8 13 9 1 2. - 0 - 9.4352738233283162e-004 - 0.4940010905265808 - 0.5491250753402710 - <_> - - <_> - - - - <_>0 6 20 1 -1. - <_>10 6 10 1 2. - 0 - 0.0333632417023182 - 0.5007612109184265 - 0.2790724039077759 - <_> - - <_> - - - - <_>8 4 4 4 -1. - <_>8 4 2 4 2. - 0 - -0.0151186501607299 - 0.7059578895568848 - 0.4973031878471375 - <_> - - <_> - - - - <_>0 0 2 2 -1. - <_>0 1 2 1 2. - 0 - 9.8648946732282639e-004 - 0.5128620266914368 - 0.3776761889457703 - 104.7491989135742200 - 19 - -1 - <_> - - - <_> - - <_> - - - - <_>5 3 10 9 -1. - <_>5 6 10 3 3. - 0 - -0.0951507985591888 - 0.6470757126808167 - 0.4017286896705627 - <_> - - <_> - - - - <_>15 2 4 10 -1. - <_>15 2 2 10 2. - 0 - 6.2702340073883533e-003 - 0.3999822139739990 - 0.5746449232101440 - <_> - - <_> - - - - <_>8 2 2 7 -1. - <_>9 2 1 7 2. - 0 - 3.0018089455552399e-004 - 0.3558770120143890 - 0.5538809895515442 - <_> - - <_> - - - - <_>7 4 12 1 -1. - <_>11 4 4 1 3. - 0 - 1.1757409665733576e-003 - 0.4256534874439240 - 0.5382617712020874 - <_> - - <_> - - - - <_>3 4 9 1 -1. - <_>6 4 3 1 3. - 0 - 4.4235268433112651e-005 - 0.3682908117771149 - 0.5589926838874817 - <_> - - <_> - - - - <_>15 10 1 4 -1. - <_>15 12 1 2 2. - 0 - -2.9936920327600092e-005 - 0.5452470183372498 - 0.4020367860794067 - <_> - - <_> - - - - <_>4 10 6 4 -1. - <_>7 10 3 4 2. - 0 - 3.0073199886828661e-003 - 0.5239058136940002 - 0.3317843973636627 - <_> - - <_> - - - - <_>15 9 1 6 -1. - <_>15 12 1 3 2. - 0 - -0.0105138896033168 - 0.4320689141750336 - 0.5307983756065369 - <_> - - <_> - - - - <_>7 17 6 3 -1. - <_>7 18 6 1 3. - 0 - 8.3476826548576355e-003 - 0.4504637122154236 - 0.6453298926353455 - <_> - - <_> - - - - <_>14 3 2 16 -1. - <_>15 3 1 8 2. - <_>14 11 1 8 2. - 0 - -3.1492270063608885e-003 - 0.4313425123691559 - 0.5370525121688843 - <_> - - <_> - - - - <_>4 9 1 6 -1. - <_>4 12 1 3 2. - 0 - -1.4435649973165710e-005 - 0.5326603055000305 - 0.3817971944808960 - <_> - - <_> - - - - <_>12 1 5 2 -1. - <_>12 2 5 1 2. - 0 - -4.2855090578086674e-004 - 0.4305163919925690 - 0.5382009744644165 - <_> - - <_> - - - - <_>6 18 4 2 -1. - <_>6 18 2 1 2. - <_>8 19 2 1 2. - 0 - 1.5062429883982986e-004 - 0.4235970973968506 - 0.5544965267181397 - <_> - - <_> - - - - <_>2 4 16 10 -1. - <_>10 4 8 5 2. - <_>2 9 8 5 2. - 0 - 0.0715598315000534 - 0.5303059816360474 - 0.2678802907466888 - <_> - - <_> - - - - <_>6 5 1 10 -1. - <_>6 10 1 5 2. - 0 - 8.4095180500298738e-004 - 0.3557108938694000 - 0.5205433964729309 - <_> - - <_> - - - - <_>4 8 15 2 -1. - <_>9 8 5 2 3. - 0 - 0.0629865005612373 - 0.5225362777709961 - 0.2861376106739044 - <_> - - <_> - - - - <_>1 8 15 2 -1. - <_>6 8 5 2 3. - 0 - -3.3798629883676767e-003 - 0.3624185919761658 - 0.5201697945594788 - <_> - - <_> - - - - <_>9 5 3 6 -1. - <_>9 7 3 2 3. - 0 - -1.1810739670181647e-004 - 0.5474476814270020 - 0.3959893882274628 - <_> - - <_> - - - - <_>5 7 8 2 -1. - <_>9 7 4 2 2. - 0 - -5.4505601292476058e-004 - 0.3740422129631043 - 0.5215715765953064 - <_> - - <_> - - - - <_>9 11 2 3 -1. - <_>9 12 2 1 3. - 0 - -1.8454910023137927e-003 - 0.5893052220344544 - 0.4584448933601379 - <_> - - <_> - - - - <_>1 0 16 3 -1. - <_>1 1 16 1 3. - 0 - -4.3832371011376381e-004 - 0.4084582030773163 - 0.5385351181030273 - <_> - - <_> - - - - <_>11 2 7 2 -1. - <_>11 3 7 1 2. - 0 - -2.4000830017030239e-003 - 0.3777455091476440 - 0.5293580293655396 - <_> - - <_> - - - - <_>5 1 10 18 -1. - <_>5 7 10 6 3. - 0 - -0.0987957417964935 - 0.2963612079620361 - 0.5070089101791382 - <_> - - <_> - - - - <_>17 4 3 2 -1. - <_>18 4 1 2 3. - 0 - 3.1798239797353745e-003 - 0.4877632856369019 - 0.6726443767547607 - <_> - - <_> - - - - <_>8 13 1 3 -1. - <_>8 14 1 1 3. - 0 - 3.2406419632025063e-004 - 0.4366911053657532 - 0.5561109781265259 - <_> - - <_> - - - - <_>3 14 14 6 -1. - <_>3 16 14 2 3. - 0 - -0.0325472503900528 - 0.3128157854080200 - 0.5308616161346436 - <_> - - <_> - - - - <_>0 2 3 4 -1. - <_>1 2 1 4 3. - 0 - -7.7561130747199059e-003 - 0.6560224890708923 - 0.4639872014522553 - <_> - - <_> - - - - <_>12 1 5 2 -1. - <_>12 2 5 1 2. - 0 - 0.0160272493958473 - 0.5172680020332336 - 0.3141897916793823 - <_> - - <_> - - - - <_>3 1 5 2 -1. - <_>3 2 5 1 2. - 0 - 7.1002350523485802e-006 - 0.4084446132183075 - 0.5336294770240784 - <_> - - <_> - - - - <_>10 13 2 3 -1. - <_>10 14 2 1 3. - 0 - 7.3422808200120926e-003 - 0.4966922104358673 - 0.6603465080261231 - <_> - - <_> - - - - <_>8 13 2 3 -1. - <_>8 14 2 1 3. - 0 - -1.6970280557870865e-003 - 0.5908237099647522 - 0.4500182867050171 - <_> - - <_> - - - - <_>14 12 2 3 -1. - <_>14 13 2 1 3. - 0 - 2.4118260480463505e-003 - 0.5315160751342773 - 0.3599720895290375 - <_> - - <_> - - - - <_>7 2 2 3 -1. - <_>7 3 2 1 3. - 0 - -5.5300937965512276e-003 - 0.2334040999412537 - 0.4996814131736755 - <_> - - <_> - - - - <_>5 6 10 4 -1. - <_>10 6 5 2 2. - <_>5 8 5 2 2. - 0 - -2.6478730142116547e-003 - 0.5880935788154602 - 0.4684734046459198 - <_> - - <_> - - - - <_>9 13 1 6 -1. - <_>9 16 1 3 2. - 0 - 0.0112956296652555 - 0.4983777105808258 - 0.1884590983390808 - <_> - - <_> - - - - <_>10 12 2 2 -1. - <_>11 12 1 1 2. - <_>10 13 1 1 2. - 0 - -6.6952878842130303e-004 - 0.5872138142585754 - 0.4799019992351532 - <_> - - <_> - - - - <_>4 12 2 3 -1. - <_>4 13 2 1 3. - 0 - 1.4410680159926414e-003 - 0.5131189227104187 - 0.3501011133193970 - <_> - - <_> - - - - <_>14 4 6 6 -1. - <_>14 6 6 2 3. - 0 - 2.4637870956212282e-003 - 0.5339372158050537 - 0.4117639064788818 - <_> - - <_> - - - - <_>8 17 2 3 -1. - <_>8 18 2 1 3. - 0 - 3.3114518737420440e-004 - 0.4313383102416992 - 0.5398246049880981 - <_> - - <_> - - - - <_>16 4 4 6 -1. - <_>16 6 4 2 3. - 0 - -0.0335572697222233 - 0.2675336897373200 - 0.5179154872894287 - <_> - - <_> - - - - <_>0 4 4 6 -1. - <_>0 6 4 2 3. - 0 - 0.0185394193977118 - 0.4973869919776917 - 0.2317177057266235 - <_> - - <_> - - - - <_>14 6 2 3 -1. - <_>14 6 1 3 2. - 0 - -2.9698139405809343e-004 - 0.5529708266258240 - 0.4643664062023163 - <_> - - <_> - - - - <_>4 9 8 1 -1. - <_>8 9 4 1 2. - 0 - -4.5577259152196348e-004 - 0.5629584193229675 - 0.4469191133975983 - <_> - - <_> - - - - <_>8 12 4 3 -1. - <_>8 13 4 1 3. - 0 - -0.0101589802652597 - 0.6706212759017944 - 0.4925918877124786 - <_> - - <_> - - - - <_>5 12 10 6 -1. - <_>5 14 10 2 3. - 0 - -2.2413829356082715e-005 - 0.5239421725273132 - 0.3912901878356934 - <_> - - <_> - - - - <_>11 12 1 2 -1. - <_>11 13 1 1 2. - 0 - 7.2034963523037732e-005 - 0.4799438118934631 - 0.5501788854598999 - <_> - - <_> - - - - <_>8 15 4 2 -1. - <_>8 16 4 1 2. - 0 - -6.9267209619283676e-003 - 0.6930009722709656 - 0.4698084890842438 - <_> - - <_> - - - - <_>6 9 8 8 -1. - <_>10 9 4 4 2. - <_>6 13 4 4 2. - 0 - -7.6997838914394379e-003 - 0.4099623858928680 - 0.5480883121490479 - <_> - - <_> - - - - <_>7 12 4 6 -1. - <_>7 12 2 3 2. - <_>9 15 2 3 2. - 0 - -7.3130549862980843e-003 - 0.3283475935459137 - 0.5057886242866516 - <_> - - <_> - - - - <_>10 11 3 1 -1. - <_>11 11 1 1 3. - 0 - 1.9650589674711227e-003 - 0.4978047013282776 - 0.6398249864578247 - <_> - - <_> - - - - <_>9 7 2 10 -1. - <_>9 7 1 5 2. - <_>10 12 1 5 2. - 0 - 7.1647600270807743e-003 - 0.4661160111427307 - 0.6222137212753296 - <_> - - <_> - - - - <_>8 0 6 6 -1. - <_>10 0 2 6 3. - 0 - -0.0240786392241716 - 0.2334644943475723 - 0.5222162008285523 - <_> - - <_> - - - - <_>3 11 2 6 -1. - <_>3 13 2 2 3. - 0 - -0.0210279691964388 - 0.1183653995394707 - 0.4938226044178009 - <_> - - <_> - - - - <_>16 12 1 2 -1. - <_>16 13 1 1 2. - 0 - 3.6017020465806127e-004 - 0.5325019955635071 - 0.4116711020469666 - <_> - - <_> - - - - <_>1 14 6 6 -1. - <_>1 14 3 3 2. - <_>4 17 3 3 2. - 0 - -0.0172197297215462 - 0.6278762221336365 - 0.4664269089698792 - <_> - - <_> - - - - <_>13 1 3 6 -1. - <_>14 1 1 6 3. - 0 - -7.8672142699360847e-003 - 0.3403415083885193 - 0.5249736905097961 - <_> - - <_> - - - - <_>8 8 2 2 -1. - <_>8 9 2 1 2. - 0 - -4.4777389848604798e-004 - 0.3610411882400513 - 0.5086259245872498 - <_> - - <_> - - - - <_>9 9 3 3 -1. - <_>10 9 1 3 3. - 0 - 5.5486010387539864e-003 - 0.4884265959262848 - 0.6203498244285584 - <_> - - <_> - - - - <_>8 7 3 3 -1. - <_>8 8 3 1 3. - 0 - -6.9461148232221603e-003 - 0.2625930011272430 - 0.5011097192764282 - <_> - - <_> - - - - <_>14 0 2 3 -1. - <_>14 0 1 3 2. - 0 - 1.3569870498031378e-004 - 0.4340794980525971 - 0.5628312230110169 - <_> - - <_> - - - - <_>1 0 18 9 -1. - <_>7 0 6 9 3. - 0 - -0.0458802506327629 - 0.6507998704910278 - 0.4696274995803833 - <_> - - <_> - - - - <_>11 5 4 15 -1. - <_>11 5 2 15 2. - 0 - -0.0215825606137514 - 0.3826502859592438 - 0.5287616848945618 - <_> - - <_> - - - - <_>5 5 4 15 -1. - <_>7 5 2 15 2. - 0 - -0.0202095396816731 - 0.3233368098735809 - 0.5074477195739746 - <_> - - <_> - - - - <_>14 0 2 3 -1. - <_>14 0 1 3 2. - 0 - 5.8496710844337940e-003 - 0.5177603960037231 - 0.4489670991897583 - <_> - - <_> - - - - <_>4 0 2 3 -1. - <_>5 0 1 3 2. - 0 - -5.7476379879517481e-005 - 0.4020850956439972 - 0.5246363878250122 - <_> - - <_> - - - - <_>11 12 2 2 -1. - <_>12 12 1 1 2. - <_>11 13 1 1 2. - 0 - -1.1513100471347570e-003 - 0.6315072178840637 - 0.4905154109001160 - <_> - - <_> - - - - <_>7 12 2 2 -1. - <_>7 12 1 1 2. - <_>8 13 1 1 2. - 0 - 1.9862831104546785e-003 - 0.4702459871768951 - 0.6497151255607605 - <_> - - <_> - - - - <_>12 0 3 4 -1. - <_>13 0 1 4 3. - 0 - -5.2719512023031712e-003 - 0.3650383949279785 - 0.5227652788162231 - <_> - - <_> - - - - <_>4 11 3 3 -1. - <_>4 12 3 1 3. - 0 - 1.2662699446082115e-003 - 0.5166100859642029 - 0.3877618014812470 - <_> - - <_> - - - - <_>12 7 4 2 -1. - <_>12 8 4 1 2. - 0 - -6.2919440679252148e-003 - 0.7375894188880920 - 0.5023847818374634 - <_> - - <_> - - - - <_>8 10 3 2 -1. - <_>9 10 1 2 3. - 0 - 6.7360111279413104e-004 - 0.4423226118087769 - 0.5495585799217224 - <_> - - <_> - - - - <_>9 9 3 2 -1. - <_>10 9 1 2 3. - 0 - -1.0523450328037143e-003 - 0.5976396203041077 - 0.4859583079814911 - <_> - - <_> - - - - <_>8 9 3 2 -1. - <_>9 9 1 2 3. - 0 - -4.4216238893568516e-004 - 0.5955939292907715 - 0.4398930966854096 - <_> - - <_> - - - - <_>12 0 3 4 -1. - <_>13 0 1 4 3. - 0 - 1.1747940443456173e-003 - 0.5349888205528259 - 0.4605058133602142 - <_> - - <_> - - - - <_>5 0 3 4 -1. - <_>6 0 1 4 3. - 0 - 5.2457437850534916e-003 - 0.5049191117286682 - 0.2941577136516571 - <_> - - <_> - - - - <_>4 14 12 4 -1. - <_>10 14 6 2 2. - <_>4 16 6 2 2. - 0 - -0.0245397202670574 - 0.2550177872180939 - 0.5218586921691895 - <_> - - <_> - - - - <_>8 13 2 3 -1. - <_>8 14 2 1 3. - 0 - 7.3793041519820690e-004 - 0.4424861073493958 - 0.5490816235542297 - <_> - - <_> - - - - <_>10 10 3 8 -1. - <_>10 14 3 4 2. - 0 - 1.4233799884095788e-003 - 0.5319514274597168 - 0.4081355929374695 - <_> - - <_> - - - - <_>8 10 4 8 -1. - <_>8 10 2 4 2. - <_>10 14 2 4 2. - 0 - -2.4149110540747643e-003 - 0.4087659120559692 - 0.5238950252532959 - <_> - - <_> - - - - <_>10 8 3 1 -1. - <_>11 8 1 1 3. - 0 - -1.2165299849584699e-003 - 0.5674579143524170 - 0.4908052980899811 - <_> - - <_> - - - - <_>9 12 1 6 -1. - <_>9 15 1 3 2. - 0 - -1.2438809499144554e-003 - 0.4129425883293152 - 0.5256118178367615 - <_> - - <_> - - - - <_>10 8 3 1 -1. - <_>11 8 1 1 3. - 0 - 6.1942739412188530e-003 - 0.5060194134712219 - 0.7313653230667114 - <_> - - <_> - - - - <_>7 8 3 1 -1. - <_>8 8 1 1 3. - 0 - -1.6607169527560472e-003 - 0.5979632139205933 - 0.4596369862556458 - <_> - - <_> - - - - <_>5 2 15 14 -1. - <_>5 9 15 7 2. - 0 - -0.0273162592202425 - 0.4174365103244782 - 0.5308842062950134 - <_> - - <_> - - - - <_>2 1 2 10 -1. - <_>2 1 1 5 2. - <_>3 6 1 5 2. - 0 - -1.5845570014789701e-003 - 0.5615804791450501 - 0.4519486129283905 - <_> - - <_> - - - - <_>14 14 2 3 -1. - <_>14 15 2 1 3. - 0 - -1.5514739789068699e-003 - 0.4076187014579773 - 0.5360785126686096 - <_> - - <_> - - - - <_>2 7 3 3 -1. - <_>3 7 1 3 3. - 0 - 3.8446558755822480e-004 - 0.4347293972969055 - 0.5430442094802856 - <_> - - <_> - - - - <_>17 4 3 3 -1. - <_>17 5 3 1 3. - 0 - -0.0146722598001361 - 0.1659304946660996 - 0.5146093964576721 - <_> - - <_> - - - - <_>0 4 3 3 -1. - <_>0 5 3 1 3. - 0 - 8.1608882173895836e-003 - 0.4961819052696228 - 0.1884745955467224 - <_> - - <_> - - - - <_>13 5 6 2 -1. - <_>16 5 3 1 2. - <_>13 6 3 1 2. - 0 - 1.1121659772470593e-003 - 0.4868263900279999 - 0.6093816161155701 - <_> - - <_> - - - - <_>4 19 12 1 -1. - <_>8 19 4 1 3. - 0 - -7.2603770531713963e-003 - 0.6284325122833252 - 0.4690375924110413 - <_> - - <_> - - - - <_>12 12 2 4 -1. - <_>12 14 2 2 2. - 0 - -2.4046430189628154e-004 - 0.5575000047683716 - 0.4046044051647186 - <_> - - <_> - - - - <_>3 15 1 3 -1. - <_>3 16 1 1 3. - 0 - -2.3348190006799996e-004 - 0.4115762114524841 - 0.5252848267555237 - <_> - - <_> - - - - <_>11 16 6 4 -1. - <_>11 16 3 4 2. - 0 - 5.5736480280756950e-003 - 0.4730072915554047 - 0.5690100789070129 - <_> - - <_> - - - - <_>2 10 3 10 -1. - <_>3 10 1 10 3. - 0 - 0.0306237693876028 - 0.4971886873245239 - 0.1740095019340515 - <_> - - <_> - - - - <_>12 8 2 4 -1. - <_>12 8 1 4 2. - 0 - 9.2074798885732889e-004 - 0.5372117757797241 - 0.4354872107505798 - <_> - - <_> - - - - <_>6 8 2 4 -1. - <_>7 8 1 4 2. - 0 - -4.3550739064812660e-005 - 0.5366883873939514 - 0.4347316920757294 - <_> - - <_> - - - - <_>10 14 2 3 -1. - <_>10 14 1 3 2. - 0 - -6.6452710889279842e-003 - 0.3435518145561218 - 0.5160533189773560 - <_> - - <_> - - - - <_>5 1 10 3 -1. - <_>10 1 5 3 2. - 0 - 0.0432219989597797 - 0.4766792058944702 - 0.7293652892112732 - <_> - - <_> - - - - <_>10 7 3 2 -1. - <_>11 7 1 2 3. - 0 - 2.2331769578158855e-003 - 0.5029315948486328 - 0.5633171200752258 - <_> - - <_> - - - - <_>5 6 9 2 -1. - <_>8 6 3 2 3. - 0 - 3.1829739455133677e-003 - 0.4016092121601105 - 0.5192136764526367 - <_> - - <_> - - - - <_>9 8 2 2 -1. - <_>9 9 2 1 2. - 0 - -1.8027749320026487e-004 - 0.4088315963745117 - 0.5417919754981995 - <_> - - <_> - - - - <_>2 11 16 6 -1. - <_>2 11 8 3 2. - <_>10 14 8 3 2. - 0 - -5.2934689447283745e-003 - 0.4075677096843720 - 0.5243561863899231 - <_> - - <_> - - - - <_>12 7 2 2 -1. - <_>13 7 1 1 2. - <_>12 8 1 1 2. - 0 - 1.2750959722325206e-003 - 0.4913282990455627 - 0.6387010812759399 - <_> - - <_> - - - - <_>9 5 2 3 -1. - <_>9 6 2 1 3. - 0 - 4.3385322205722332e-003 - 0.5031672120094299 - 0.2947346866130829 - <_> - - <_> - - - - <_>9 7 3 2 -1. - <_>10 7 1 2 3. - 0 - 8.5250744596123695e-003 - 0.4949789047241211 - 0.6308869123458862 - <_> - - <_> - - - - <_>5 1 8 12 -1. - <_>5 7 8 6 2. - 0 - -9.4266352243721485e-004 - 0.5328366756439209 - 0.4285649955272675 - <_> - - <_> - - - - <_>13 5 2 2 -1. - <_>13 6 2 1 2. - 0 - 1.3609660090878606e-003 - 0.4991525113582611 - 0.5941501259803772 - <_> - - <_> - - - - <_>5 5 2 2 -1. - <_>5 6 2 1 2. - 0 - 4.4782509212382138e-004 - 0.4573504030704498 - 0.5854480862617493 - <_> - - <_> - - - - <_>12 4 3 3 -1. - <_>12 5 3 1 3. - 0 - 1.3360050506889820e-003 - 0.4604358971118927 - 0.5849052071571350 - <_> - - <_> - - - - <_>4 14 2 3 -1. - <_>4 15 2 1 3. - 0 - -6.0967548051849008e-004 - 0.3969388902187347 - 0.5229423046112061 - <_> - - <_> - - - - <_>12 4 3 3 -1. - <_>12 5 3 1 3. - 0 - -2.3656780831515789e-003 - 0.5808320045471191 - 0.4898357093334198 - <_> - - <_> - - - - <_>5 4 3 3 -1. - <_>5 5 3 1 3. - 0 - 1.0734340175986290e-003 - 0.4351210892200470 - 0.5470039248466492 - <_> - - <_> - - - - <_>9 14 2 6 -1. - <_>10 14 1 3 2. - <_>9 17 1 3 2. - 0 - 2.1923359017819166e-003 - 0.5355060100555420 - 0.3842903971672058 - <_> - - <_> - - - - <_>8 14 3 2 -1. - <_>9 14 1 2 3. - 0 - 5.4968618787825108e-003 - 0.5018138885498047 - 0.2827191948890686 - <_> - - <_> - - - - <_>9 5 6 6 -1. - <_>11 5 2 6 3. - 0 - -0.0753688216209412 - 0.1225076019763947 - 0.5148826837539673 - <_> - - <_> - - - - <_>5 5 6 6 -1. - <_>7 5 2 6 3. - 0 - 0.0251344703137875 - 0.4731766879558563 - 0.7025446295738220 - <_> - - <_> - - - - <_>13 13 1 2 -1. - <_>13 14 1 1 2. - 0 - -2.9358599931583740e-005 - 0.5430532097816467 - 0.4656086862087250 - <_> - - <_> - - - - <_>0 2 10 2 -1. - <_>0 3 10 1 2. - 0 - -5.8355910005047917e-004 - 0.4031040072441101 - 0.5190119743347168 - <_> - - <_> - - - - <_>13 13 1 2 -1. - <_>13 14 1 1 2. - 0 - -2.6639450807124376e-003 - 0.4308126866817474 - 0.5161771178245544 - <_> - - <_> - - - - <_>5 7 2 2 -1. - <_>5 7 1 1 2. - <_>6 8 1 1 2. - 0 - -1.3804089976474643e-003 - 0.6219829916954041 - 0.4695515930652618 - <_> - - <_> - - - - <_>13 5 2 7 -1. - <_>13 5 1 7 2. - 0 - 1.2313219485804439e-003 - 0.5379363894462585 - 0.4425831139087677 - <_> - - <_> - - - - <_>6 13 1 2 -1. - <_>6 14 1 1 2. - 0 - -1.4644179827882908e-005 - 0.5281640291213989 - 0.4222503006458283 - <_> - - <_> - - - - <_>11 0 3 7 -1. - <_>12 0 1 7 3. - 0 - -0.0128188095986843 - 0.2582092881202698 - 0.5179932713508606 - <_> - - <_> - - - - <_>0 3 2 16 -1. - <_>0 3 1 8 2. - <_>1 11 1 8 2. - 0 - 0.0228521898388863 - 0.4778693020343781 - 0.7609264254570007 - <_> - - <_> - - - - <_>11 0 3 7 -1. - <_>12 0 1 7 3. - 0 - 8.2305970136076212e-004 - 0.5340992212295532 - 0.4671724140644074 - <_> - - <_> - - - - <_>6 0 3 7 -1. - <_>7 0 1 7 3. - 0 - 0.0127701200544834 - 0.4965761005878449 - 0.1472366005182266 - <_> - - <_> - - - - <_>11 16 8 4 -1. - <_>11 16 4 4 2. - 0 - -0.0500515103340149 - 0.6414994001388550 - 0.5016592144966126 - <_> - - <_> - - - - <_>1 16 8 4 -1. - <_>5 16 4 4 2. - 0 - 0.0157752707600594 - 0.4522320032119751 - 0.5685362219810486 - <_> - - <_> - - - - <_>13 5 2 7 -1. - <_>13 5 1 7 2. - 0 - -0.0185016207396984 - 0.2764748930931091 - 0.5137959122657776 - <_> - - <_> - - - - <_>5 5 2 7 -1. - <_>6 5 1 7 2. - 0 - 2.4626250378787518e-003 - 0.5141941905021668 - 0.3795408010482788 - <_> - - <_> - - - - <_>18 6 2 14 -1. - <_>18 13 2 7 2. - 0 - 0.0629161670804024 - 0.5060648918151856 - 0.6580433845520020 - <_> - - <_> - - - - <_>6 10 3 4 -1. - <_>6 12 3 2 2. - 0 - -2.1648500478477217e-005 - 0.5195388197898865 - 0.4019886851310730 - <_> - - <_> - - - - <_>14 7 1 2 -1. - <_>14 8 1 1 2. - 0 - 2.1180990152060986e-003 - 0.4962365031242371 - 0.5954458713531494 - <_> - - <_> - - - - <_>0 1 18 6 -1. - <_>0 1 9 3 2. - <_>9 4 9 3 2. - 0 - -0.0166348908096552 - 0.3757933080196381 - 0.5175446867942810 - <_> - - <_> - - - - <_>14 7 1 2 -1. - <_>14 8 1 1 2. - 0 - -2.8899470344185829e-003 - 0.6624013781547546 - 0.5057178735733032 - <_> - - <_> - - - - <_>0 6 2 14 -1. - <_>0 13 2 7 2. - 0 - 0.0767832621932030 - 0.4795796871185303 - 0.8047714829444885 - <_> - - <_> - - - - <_>17 0 3 12 -1. - <_>18 0 1 12 3. - 0 - 3.9170677773654461e-003 - 0.4937882125377655 - 0.5719941854476929 - <_> - - <_> - - - - <_>0 6 18 3 -1. - <_>0 7 18 1 3. - 0 - -0.0726706013083458 - 0.0538945607841015 - 0.4943903982639313 - <_> - - <_> - - - - <_>6 0 14 16 -1. - <_>6 8 14 8 2. - 0 - 0.5403950214385986 - 0.5129774212837219 - 0.1143338978290558 - <_> - - <_> - - - - <_>0 0 3 12 -1. - <_>1 0 1 12 3. - 0 - 2.9510019812732935e-003 - 0.4528343975543976 - 0.5698574185371399 - <_> - - <_> - - - - <_>13 0 3 7 -1. - <_>14 0 1 7 3. - 0 - 3.4508369863033295e-003 - 0.5357726812362671 - 0.4218730926513672 - <_> - - <_> - - - - <_>5 7 1 2 -1. - <_>5 8 1 1 2. - 0 - -4.2077939724549651e-004 - 0.5916172862052918 - 0.4637925922870636 - <_> - - <_> - - - - <_>14 4 6 6 -1. - <_>14 6 6 2 3. - 0 - 3.3051050268113613e-003 - 0.5273385047912598 - 0.4382042884826660 - <_> - - <_> - - - - <_>5 7 7 2 -1. - <_>5 8 7 1 2. - 0 - 4.7735060798004270e-004 - 0.4046528041362763 - 0.5181884765625000 - <_> - - <_> - - - - <_>8 6 6 9 -1. - <_>8 9 6 3 3. - 0 - -0.0259285103529692 - 0.7452235817909241 - 0.5089386105537415 - <_> - - <_> - - - - <_>5 4 6 1 -1. - <_>7 4 2 1 3. - 0 - -2.9729790985584259e-003 - 0.3295435905456543 - 0.5058795213699341 - <_> - - <_> - - - - <_>13 0 6 4 -1. - <_>16 0 3 2 2. - <_>13 2 3 2 2. - 0 - 5.8508329093456268e-003 - 0.4857144057750702 - 0.5793024897575378 - <_> - - <_> - - - - <_>1 2 18 12 -1. - <_>1 6 18 4 3. - 0 - -0.0459675192832947 - 0.4312731027603149 - 0.5380653142929077 - <_> - - <_> - - - - <_>3 2 17 12 -1. - <_>3 6 17 4 3. - 0 - 0.1558596044778824 - 0.5196170210838318 - 0.1684713959693909 - <_> - - <_> - - - - <_>5 14 7 3 -1. - <_>5 15 7 1 3. - 0 - 0.0151648297905922 - 0.4735757112503052 - 0.6735026836395264 - <_> - - <_> - - - - <_>10 14 1 3 -1. - <_>10 15 1 1 3. - 0 - -1.0604249546304345e-003 - 0.5822926759719849 - 0.4775702953338623 - <_> - - <_> - - - - <_>3 14 3 3 -1. - <_>3 15 3 1 3. - 0 - 6.6476291976869106e-003 - 0.4999198913574219 - 0.2319535017013550 - <_> - - <_> - - - - <_>14 4 6 6 -1. - <_>14 6 6 2 3. - 0 - -0.0122311301529408 - 0.4750893115997315 - 0.5262982249259949 - <_> - - <_> - - - - <_>0 4 6 6 -1. - <_>0 6 6 2 3. - 0 - 5.6528882123529911e-003 - 0.5069767832756043 - 0.3561818897724152 - <_> - - <_> - - - - <_>12 5 4 3 -1. - <_>12 6 4 1 3. - 0 - 1.2977829901501536e-003 - 0.4875693917274475 - 0.5619062781333923 - <_> - - <_> - - - - <_>4 5 4 3 -1. - <_>4 6 4 1 3. - 0 - 0.0107815898954868 - 0.4750770032405853 - 0.6782308220863342 - <_> - - <_> - - - - <_>18 0 2 6 -1. - <_>18 2 2 2 3. - 0 - 2.8654779307544231e-003 - 0.5305461883544922 - 0.4290736019611359 - <_> - - <_> - - - - <_>8 1 4 9 -1. - <_>10 1 2 9 2. - 0 - 2.8663428965955973e-003 - 0.4518479108810425 - 0.5539351105690002 - <_> - - <_> - - - - <_>6 6 8 2 -1. - <_>6 6 4 2 2. - 0 - -5.1983320154249668e-003 - 0.4149119853973389 - 0.5434188842773438 - <_> - - <_> - - - - <_>6 5 4 2 -1. - <_>6 5 2 1 2. - <_>8 6 2 1 2. - 0 - 5.3739990107715130e-003 - 0.4717896878719330 - 0.6507657170295715 - <_> - - <_> - - - - <_>10 5 2 3 -1. - <_>10 6 2 1 3. - 0 - -0.0146415298804641 - 0.2172164022922516 - 0.5161777138710022 - <_> - - <_> - - - - <_>9 5 1 3 -1. - <_>9 6 1 1 3. - 0 - -1.5042580344015732e-005 - 0.5337383747100830 - 0.4298836886882782 - <_> - - <_> - - - - <_>9 10 2 2 -1. - <_>9 11 2 1 2. - 0 - -1.1875660129589960e-004 - 0.4604594111442566 - 0.5582447052001953 - <_> - - <_> - - - - <_>0 8 4 3 -1. - <_>0 9 4 1 3. - 0 - 0.0169955305755138 - 0.4945895075798035 - 0.0738800764083862 - <_> - - <_> - - - - <_>6 0 8 6 -1. - <_>6 3 8 3 2. - 0 - -0.0350959412753582 - 0.7005509138107300 - 0.4977591037750244 - <_> - - <_> - - - - <_>1 0 6 4 -1. - <_>1 0 3 2 2. - <_>4 2 3 2 2. - 0 - 2.4217350874096155e-003 - 0.4466265141963959 - 0.5477694272994995 - <_> - - <_> - - - - <_>13 0 3 7 -1. - <_>14 0 1 7 3. - 0 - -9.6340337768197060e-004 - 0.4714098870754242 - 0.5313338041305542 - <_> - - <_> - - - - <_>9 16 2 2 -1. - <_>9 17 2 1 2. - 0 - 1.6391130338888615e-004 - 0.4331546127796173 - 0.5342242121696472 - <_> - - <_> - - - - <_>11 4 6 10 -1. - <_>11 9 6 5 2. - 0 - -0.0211414601653814 - 0.2644700109958649 - 0.5204498767852783 - <_> - - <_> - - - - <_>0 10 19 2 -1. - <_>0 11 19 1 2. - 0 - 8.7775202700868249e-004 - 0.5208349823951721 - 0.4152742922306061 - <_> - - <_> - - - - <_>9 5 8 9 -1. - <_>9 8 8 3 3. - 0 - -0.0279439203441143 - 0.6344125270843506 - 0.5018811821937561 - <_> - - <_> - - - - <_>4 0 3 7 -1. - <_>5 0 1 7 3. - 0 - 6.7297378554940224e-003 - 0.5050438046455383 - 0.3500863909721375 - <_> - - <_> - - - - <_>8 6 4 12 -1. - <_>10 6 2 6 2. - <_>8 12 2 6 2. - 0 - 0.0232810396701097 - 0.4966318011283875 - 0.6968677043914795 - <_> - - <_> - - - - <_>0 2 6 4 -1. - <_>0 4 6 2 2. - 0 - -0.0116449799388647 - 0.3300260007381439 - 0.5049629807472229 - <_> - - <_> - - - - <_>8 15 4 3 -1. - <_>8 16 4 1 3. - 0 - 0.0157643090933561 - 0.4991598129272461 - 0.7321153879165649 - <_> - - <_> - - - - <_>8 0 3 7 -1. - <_>9 0 1 7 3. - 0 - -1.3611479662358761e-003 - 0.3911735117435455 - 0.5160670876502991 - <_> - - <_> - - - - <_>9 5 3 4 -1. - <_>10 5 1 4 3. - 0 - -8.1522337859496474e-004 - 0.5628911256790161 - 0.4949719011783600 - <_> - - <_> - - - - <_>8 5 3 4 -1. - <_>9 5 1 4 3. - 0 - -6.0066272271797061e-004 - 0.5853595137596130 - 0.4550595879554749 - <_> - - <_> - - - - <_>7 6 6 1 -1. - <_>9 6 2 1 3. - 0 - 4.9715518252924085e-004 - 0.4271470010280609 - 0.5443599224090576 - <_> - - <_> - - - - <_>7 14 4 4 -1. - <_>7 14 2 2 2. - <_>9 16 2 2 2. - 0 - 2.3475370835512877e-003 - 0.5143110752105713 - 0.3887656927108765 - <_> - - <_> - - - - <_>13 14 4 6 -1. - <_>15 14 2 3 2. - <_>13 17 2 3 2. - 0 - -8.9261569082736969e-003 - 0.6044502258300781 - 0.4971720874309540 - <_> - - <_> - - - - <_>7 8 1 8 -1. - <_>7 12 1 4 2. - 0 - -0.0139199104160070 - 0.2583160996437073 - 0.5000367760658264 - <_> - - <_> - - - - <_>16 0 2 8 -1. - <_>17 0 1 4 2. - <_>16 4 1 4 2. - 0 - 1.0209949687123299e-003 - 0.4857374131679535 - 0.5560358166694641 - <_> - - <_> - - - - <_>2 0 2 8 -1. - <_>2 0 1 4 2. - <_>3 4 1 4 2. - 0 - -2.7441629208624363e-003 - 0.5936884880065918 - 0.4645777046680450 - <_> - - <_> - - - - <_>6 1 14 3 -1. - <_>6 2 14 1 3. - 0 - -0.0162001308053732 - 0.3163014948368073 - 0.5193495154380798 - <_> - - <_> - - - - <_>7 9 3 10 -1. - <_>7 14 3 5 2. - 0 - 4.3331980705261230e-003 - 0.5061224102973938 - 0.3458878993988037 - <_> - - <_> - - - - <_>9 14 2 2 -1. - <_>9 15 2 1 2. - 0 - 5.8497930876910686e-004 - 0.4779017865657806 - 0.5870177745819092 - <_> - - <_> - - - - <_>7 7 6 8 -1. - <_>7 11 6 4 2. - 0 - -2.2466450463980436e-003 - 0.4297851026058197 - 0.5374773144721985 - <_> - - <_> - - - - <_>9 7 3 6 -1. - <_>9 10 3 3 2. - 0 - 2.3146099410951138e-003 - 0.5438671708106995 - 0.4640969932079315 - <_> - - <_> - - - - <_>7 13 3 3 -1. - <_>7 14 3 1 3. - 0 - 8.7679121643304825e-003 - 0.4726893007755280 - 0.6771789789199829 - <_> - - <_> - - - - <_>9 9 2 2 -1. - <_>9 10 2 1 2. - 0 - -2.2448020172305405e-004 - 0.4229173064231873 - 0.5428048968315125 - <_> - - <_> - - - - <_>0 1 18 2 -1. - <_>6 1 6 2 3. - 0 - -7.4336021207273006e-003 - 0.6098880767822266 - 0.4683673977851868 - <_> - - <_> - - - - <_>7 1 6 14 -1. - <_>7 8 6 7 2. - 0 - -2.3189240600913763e-003 - 0.5689436793327332 - 0.4424242079257965 - <_> - - <_> - - - - <_>1 9 18 1 -1. - <_>7 9 6 1 3. - 0 - -2.1042178850620985e-003 - 0.3762221038341522 - 0.5187087059020996 - <_> - - <_> - - - - <_>9 7 2 2 -1. - <_>9 7 1 2 2. - 0 - 4.6034841216169298e-004 - 0.4699405133724213 - 0.5771207213401794 - <_> - - <_> - - - - <_>9 3 2 9 -1. - <_>10 3 1 9 2. - 0 - 1.0547629790380597e-003 - 0.4465216994285584 - 0.5601701736450195 - <_> - - <_> - - - - <_>18 14 2 3 -1. - <_>18 15 2 1 3. - 0 - 8.7148818420246243e-004 - 0.5449805259704590 - 0.3914709091186523 - <_> - - <_> - - - - <_>7 11 3 1 -1. - <_>8 11 1 1 3. - 0 - 3.3364820410497487e-004 - 0.4564009010791779 - 0.5645738840103149 - <_> - - <_> - - - - <_>10 8 3 4 -1. - <_>11 8 1 4 3. - 0 - -1.4853250468149781e-003 - 0.5747377872467041 - 0.4692778885364533 - <_> - - <_> - - - - <_>7 14 3 6 -1. - <_>8 14 1 6 3. - 0 - 3.0251620337367058e-003 - 0.5166196823120117 - 0.3762814104557037 - <_> - - <_> - - - - <_>10 8 3 4 -1. - <_>11 8 1 4 3. - 0 - 5.0280741415917873e-003 - 0.5002111792564392 - 0.6151527166366577 - <_> - - <_> - - - - <_>7 8 3 4 -1. - <_>8 8 1 4 3. - 0 - -5.8164511574432254e-004 - 0.5394598245620728 - 0.4390751123428345 - <_> - - <_> - - - - <_>7 9 6 9 -1. - <_>7 12 6 3 3. - 0 - 0.0451415292918682 - 0.5188326835632324 - 0.2063035964965820 - <_> - - <_> - - - - <_>0 14 2 3 -1. - <_>0 15 2 1 3. - 0 - -1.0795620037242770e-003 - 0.3904685080051422 - 0.5137907266616821 - <_> - - <_> - - - - <_>11 12 1 2 -1. - <_>11 13 1 1 2. - 0 - 1.5995999274309725e-004 - 0.4895322918891907 - 0.5427504181861877 - <_> - - <_> - - - - <_>4 3 8 3 -1. - <_>8 3 4 3 2. - 0 - -0.0193592701107264 - 0.6975228786468506 - 0.4773507118225098 - <_> - - <_> - - - - <_>0 4 20 6 -1. - <_>0 4 10 6 2. - 0 - 0.2072550952434540 - 0.5233635902404785 - 0.3034991919994354 - <_> - - <_> - - - - <_>9 14 1 3 -1. - <_>9 15 1 1 3. - 0 - -4.1953290929086506e-004 - 0.5419396758079529 - 0.4460186064243317 - <_> - - <_> - - - - <_>8 14 4 3 -1. - <_>8 15 4 1 3. - 0 - 2.2582069505006075e-003 - 0.4815764129161835 - 0.6027408838272095 - <_> - - <_> - - - - <_>0 15 14 4 -1. - <_>0 17 14 2 2. - 0 - -6.7811207845807076e-003 - 0.3980278968811035 - 0.5183305740356445 - <_> - - <_> - - - - <_>1 14 18 6 -1. - <_>1 17 18 3 2. - 0 - 0.0111543098464608 - 0.5431231856346130 - 0.4188759922981262 - <_> - - <_> - - - - <_>0 0 10 6 -1. - <_>0 0 5 3 2. - <_>5 3 5 3 2. - 0 - 0.0431624315679073 - 0.4738228023052216 - 0.6522961258888245 - 105.7611007690429700 - 20 - -1 - diff --git a/lib/predict.js b/lib/predict.js deleted file mode 100644 index 354f8e9..0000000 --- a/lib/predict.js +++ /dev/null @@ -1,123 +0,0 @@ -const CLASSES = {0:'zero', 1:'one', 2:'two', 3:'three', 4:'four',5:'five', 6:'six', 7:'seven', 8:'eight', 9:'nine'} - -//----------------------- -// start button event -//----------------------- - -$("#start-button").click(function(){ - loadModel() ; - startWebcam(); -}); - -//----------------------- -// load model -//----------------------- - -let model; -async function loadModel() { - console.log("model loading.."); - $("#console").html(`
  • model loading...
  • `); - model=await tf.loadModel(`http://localhost:8080/sign_language_vgg16/model.json`); - console.log("model loaded."); - $("#console").html(`
  • VGG16 pre trained model loaded.
  • `); -}; - -//----------------------- -// start webcam -//----------------------- - -var video; -function startWebcam() { - console.log("video streaming start."); - $("#console").html(`
  • video streaming start.
  • `); - video = $('#main-stream-video').get(0); - vendorUrl = window.URL || window.webkitURL; - - navigator.getMedia = navigator.getUserMedia || - navigator.webkitGetUserMedia || - navigator.mozGetUserMedia || - navigator.msGetUserMedia; - - navigator.getMedia({ - video: true, - audio: false - }, function(stream) { - localStream = stream; - video.srcObject = stream; - video.play(); - }, function(error) { - alert("Something wrong with webcam!"); - }); -} - -//----------------------- -// predict button event -//----------------------- - -$("#predict-button").click(function(){ - setInterval(predict, 1000/10); -}); - -//----------------------- -// TensorFlow.js method -// predict tensor -//----------------------- - -async function predict(){ - let tensor = captureWebcam(); - - let prediction = await model.predict(tensor).data(); - let results = Array.from(prediction) - .map(function(p,i){ - return { - probability: p, - className: CLASSES[i] - }; - }).sort(function(a,b){ - return b.probability-a.probability; - }).slice(0,5); - - $("#console").empty(); - - results.forEach(function(p){ - $("#console").append(`
  • ${p.className} : ${p.probability.toFixed(6)}
  • `); - console.log(p.className,p.probability.toFixed(6)) - }); - -}; - -//------------------------------ -// capture streaming video -// to a canvas object -//------------------------------ - -function captureWebcam() { - var canvas = document.createElement("canvas"); - var context = canvas.getContext('2d'); - canvas.width = video.width; - canvas.height = video.height; - - context.drawImage(video, 0, 0, video.width, video.height); - tensor_image = preprocessImage(canvas); - - return tensor_image; -} - -//----------------------- -// TensorFlow.js method -// image to tensor -//----------------------- - -function preprocessImage(image){ - let tensor = tf.fromPixels(image).resizeNearestNeighbor([100,100]).toFloat(); - let offset = tf.scalar(255); - return tensor.div(offset).expandDims(); -} - -//----------------------- -// clear button event -//----------------------- - -$("#clear-button").click(function clear() { - location.reload(); -}); \ No newline at end of file diff --git a/lib/sign_language_vgg16/group1-shard1of1 b/lib/sign_language_vgg16/group1-shard1of1 deleted file mode 100644 index c276805..0000000 Binary files a/lib/sign_language_vgg16/group1-shard1of1 and /dev/null differ diff --git a/lib/sign_language_vgg16/group2-shard1of1 b/lib/sign_language_vgg16/group2-shard1of1 deleted file mode 100644 index 78489ef..0000000 Binary files a/lib/sign_language_vgg16/group2-shard1of1 and /dev/null differ diff --git a/lib/sign_language_vgg16/group3-shard1of1 b/lib/sign_language_vgg16/group3-shard1of1 deleted file mode 100644 index b2ca983..0000000 Binary files a/lib/sign_language_vgg16/group3-shard1of1 and /dev/null differ diff --git a/lib/sign_language_vgg16/group4-shard1of1 b/lib/sign_language_vgg16/group4-shard1of1 deleted file mode 100644 index ef06f84..0000000 Binary files a/lib/sign_language_vgg16/group4-shard1of1 and /dev/null differ diff --git a/lib/sign_language_vgg16/group5-shard1of2 b/lib/sign_language_vgg16/group5-shard1of2 deleted file mode 100644 index cd46475..0000000 Binary files a/lib/sign_language_vgg16/group5-shard1of2 and /dev/null differ diff --git a/lib/sign_language_vgg16/group5-shard2of2 b/lib/sign_language_vgg16/group5-shard2of2 deleted file mode 100644 index c90f7d9..0000000 Binary files a/lib/sign_language_vgg16/group5-shard2of2 and /dev/null differ diff --git a/lib/sign_language_vgg16/group6-shard1of1 b/lib/sign_language_vgg16/group6-shard1of1 deleted file mode 100644 index 5c2e564..0000000 Binary files a/lib/sign_language_vgg16/group6-shard1of1 and /dev/null differ diff --git a/lib/sign_language_vgg16/model.json b/lib/sign_language_vgg16/model.json deleted file mode 100644 index 59371c9..0000000 --- a/lib/sign_language_vgg16/model.json +++ /dev/null @@ -1 +0,0 @@ -{"weightsManifest": [{"paths": ["group1-shard1of1"], "weights": [{"name": "conv2d_1/kernel", "dtype": "float32", "shape": [3, 3, 3, 32]}, {"name": "conv2d_1/bias", "dtype": "float32", "shape": [32]}]}, {"paths": ["group2-shard1of1"], "weights": [{"name": "conv2d_2/kernel", "dtype": "float32", "shape": [3, 3, 32, 64]}, {"name": "conv2d_2/bias", "dtype": "float32", "shape": [64]}]}, {"paths": ["group3-shard1of1"], "weights": [{"name": "conv2d_3/kernel", "dtype": "float32", "shape": [3, 3, 64, 128]}, {"name": "conv2d_3/bias", "dtype": "float32", "shape": [128]}]}, {"paths": ["group4-shard1of1"], "weights": [{"name": "conv2d_4/kernel", "dtype": "float32", "shape": [3, 3, 128, 128]}, {"name": "conv2d_4/bias", "dtype": "float32", "shape": [128]}]}, {"paths": ["group5-shard1of2", "group5-shard2of2"], "weights": [{"name": "dense_1/kernel", "dtype": "float32", "shape": [2048, 512]}, {"name": "dense_1/bias", "dtype": "float32", "shape": [512]}]}, {"paths": ["group6-shard1of1"], "weights": [{"name": "dense_2/kernel", "dtype": "float32", "shape": [512, 10]}, {"name": "dense_2/bias", "dtype": "float32", "shape": [10]}]}], "modelTopology": {"keras_version": "2.1.5", "model_config": {"config": [{"config": {"kernel_initializer": {"config": {"mode": "fan_avg", "seed": null, "scale": 1.0, "distribution": "uniform"}, "class_name": "VarianceScaling"}, "kernel_constraint": null, "dtype": "float32", "kernel_size": [3, 3], "kernel_regularizer": null, "filters": 32, "strides": [1, 1], "activity_regularizer": null, "data_format": "channels_last", "bias_initializer": {"config": {}, "class_name": "Zeros"}, "name": "conv2d_1", "bias_regularizer": null, "dilation_rate": [1, 1], "use_bias": true, "activation": "relu", "padding": "valid", "trainable": true, "batch_input_shape": [null, 100, 100, 3], "bias_constraint": null}, "class_name": "Conv2D"}, {"config": {"name": "max_pooling2d_1", "strides": [2, 2], "padding": "valid", "trainable": true, "data_format": "channels_last", "pool_size": [2, 2]}, "class_name": "MaxPooling2D"}, {"config": {"kernel_initializer": {"config": {"mode": "fan_avg", "seed": null, "scale": 1.0, "distribution": "uniform"}, "class_name": "VarianceScaling"}, "kernel_constraint": null, "bias_regularizer": null, "strides": [1, 1], "kernel_regularizer": null, "filters": 64, "kernel_size": [3, 3], "activity_regularizer": null, "bias_initializer": {"config": {}, "class_name": "Zeros"}, "name": "conv2d_2", "dilation_rate": [1, 1], "use_bias": true, "activation": "relu", "padding": "valid", "trainable": true, "data_format": "channels_last", "bias_constraint": null}, "class_name": "Conv2D"}, {"config": {"name": "max_pooling2d_2", "strides": [2, 2], "padding": "valid", "trainable": true, "data_format": "channels_last", "pool_size": [2, 2]}, "class_name": "MaxPooling2D"}, {"config": {"kernel_initializer": {"config": {"mode": "fan_avg", "seed": null, "scale": 1.0, "distribution": "uniform"}, "class_name": "VarianceScaling"}, "kernel_constraint": null, "bias_regularizer": null, "strides": [1, 1], "kernel_regularizer": null, "filters": 128, "kernel_size": [3, 3], "activity_regularizer": null, "bias_initializer": {"config": {}, "class_name": "Zeros"}, "name": "conv2d_3", "dilation_rate": [1, 1], "use_bias": true, "activation": "relu", "padding": "valid", "trainable": true, "data_format": "channels_last", "bias_constraint": null}, "class_name": "Conv2D"}, {"config": {"name": "max_pooling2d_3", "strides": [2, 2], "padding": "valid", "trainable": true, "data_format": "channels_last", "pool_size": [2, 2]}, "class_name": "MaxPooling2D"}, {"config": {"kernel_initializer": {"config": {"mode": "fan_avg", "seed": null, "scale": 1.0, "distribution": "uniform"}, "class_name": "VarianceScaling"}, "kernel_constraint": null, "bias_regularizer": null, "strides": [1, 1], "kernel_regularizer": null, "filters": 128, "kernel_size": [3, 3], "activity_regularizer": null, "bias_initializer": {"config": {}, "class_name": "Zeros"}, "name": "conv2d_4", "dilation_rate": [1, 1], "use_bias": true, "activation": "relu", "padding": "valid", "trainable": true, "data_format": "channels_last", "bias_constraint": null}, "class_name": "Conv2D"}, {"config": {"name": "max_pooling2d_4", "strides": [2, 2], "padding": "valid", "trainable": true, "data_format": "channels_last", "pool_size": [2, 2]}, "class_name": "MaxPooling2D"}, {"config": {"name": "flatten_1", "trainable": true}, "class_name": "Flatten"}, {"config": {"name": "dropout_1", "noise_shape": null, "trainable": true, "rate": 0.5, "seed": null}, "class_name": "Dropout"}, {"config": {"kernel_initializer": {"config": {"mode": "fan_avg", "seed": null, "scale": 1.0, "distribution": "uniform"}, "class_name": "VarianceScaling"}, "units": 512, "kernel_regularizer": null, "activation": "relu", "activity_regularizer": null, "bias_initializer": {"config": {}, "class_name": "Zeros"}, "name": "dense_1", "use_bias": true, "kernel_constraint": null, "bias_regularizer": null, "trainable": true, "bias_constraint": null}, "class_name": "Dense"}, {"config": {"kernel_initializer": {"config": {"mode": "fan_avg", "seed": null, "scale": 1.0, "distribution": "uniform"}, "class_name": "VarianceScaling"}, "units": 10, "kernel_regularizer": null, "activation": "softmax", "activity_regularizer": null, "bias_initializer": {"config": {}, "class_name": "Zeros"}, "name": "dense_2", "use_bias": true, "kernel_constraint": null, "bias_regularizer": null, "trainable": true, "bias_constraint": null}, "class_name": "Dense"}], "class_name": "Sequential"}, "training_config": {"loss": "categorical_crossentropy", "loss_weights": null, "metrics": ["acc"], "optimizer_config": {"config": {"epsilon": 1e-07, "amsgrad": false, "beta_2": 0.9990000128746033, "beta_1": 0.8999999761581421, "lr": 0.0010000000474974513, "decay": 0.0}, "class_name": "Adam"}, "sample_weight_mode": null}, "backend": "tensorflow"}} \ No newline at end of file diff --git a/lib/tensorflow.min.js b/lib/tensorflow.min.js deleted file mode 100644 index 89bbdd4..0000000 --- a/lib/tensorflow.min.js +++ /dev/null @@ -1,2 +0,0 @@ -// @tensorflow/tfjs Copyright 2018 Google -!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t(e.tf=e.tf||{})}(this,function(exports){"use strict";var extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])};function __extends(e,t){function r(){this.constructor=e}extendStatics(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}function __decorate(e,t,r,n){var a,o=arguments.length,i=o<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)i=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(a=e[s])&&(i=(o<3?a(i):o>3?a(t,r,i):a(t,r))||i);return o>3&&i&&Object.defineProperty(t,r,i),i}function __awaiter(e,t,r,n){return new(r||(r=Promise))(function(a,o){function i(e){try{u(n.next(e))}catch(e){o(e)}}function s(e){try{u(n.throw(e))}catch(e){o(e)}}function u(e){e.done?a(e.value):new r(function(t){t(e.value)}).then(i,s)}u((n=n.apply(e,t||[])).next())})}function __generator(e,t){var r,n,a,o,i={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(r)throw new TypeError("Generator is already executing.");for(;i;)try{if(r=1,n&&(a=2&o[0]?n.return:o[0]?n.throw||((a=n.return)&&a.call(n),0):n.next)&&!(a=a.call(n,o[1])).done)return a;switch(n=0,a&&(o=[2&o[0],a.value]),o[0]){case 0:case 1:a=o;break;case 4:return i.label++,{value:o[1],done:!1};case 5:i.label++,n=o[1],o=[0];continue;case 7:o=i.ops.pop(),i.trys.pop();continue;default:if(!(a=(a=i.trys).length>0&&a[a.length-1])&&(6===o[0]||2===o[0])){i=0;continue}if(3===o[0]&&(!a||o[1]>a[0]&&o[1]0;)n=Math.random()*t|0,r=e[--t],e[t]=e[n],e[n]=r}function clamp(e,t,r){return Math.max(e,Math.min(t,r))}function randUniform(e,t){return Math.random()*(t-e)+e}function distSquared(e,t){for(var r=0,n=0;n0,function(){return"Element arr["+r.join("][")+"] should be a primitive, but is an array of "+e.length+" elements"}),assert(e.length===t[0],function(){return"Element arr["+r.join("][")+"] should have "+t[0]+" elements, but has "+e.length+" elements"});for(var n=t.slice(1),a=0;a1;--t)if(e%t==0)return[t,e/t];return[1,e]}function createShuffledIndices(e){for(var t=new Uint32Array(e),r=0;r=r?a():setTimeout(i,s)}};i()})}function getQueryParams(e){var t={};return e.replace(/[?&]([^=?&]+)(?:=([^&]*))?/g,function(e){for(var r=[],n=1;n0)r*=e[a];else if(-1===e[a]){if(-1!==n)throw Error("Shapes can only have 1 implicit size. Found - 1 at dim "+n+" and dim "+a);n=a}else if(e[a]<=0)throw Error("Shapes can not be <= 0. Found "+e[a]+" at dim "+a);if(-1===n){if(t>0&&t!==r)throw Error("Size("+t+") must match the product of shape "+e);return e}if(t%r!=0)throw Error("The implicit shape can't be a fractional number. Got "+t+" / "+r);var o=e.slice();return o[n]=t/r,o}function squeezeShape(e,t){for(var r=[],n=[],a=0,o=0;o1)throw new Error("Can't squeeze axis "+o+" since its dim '"+e[o]+"' is not 1");(null==t[a]||t[a]>o)&&1===e[o]&&(r.push(e[o]),n.push(o)),t[a]<=o&&a++}e[o]>1&&(r.push(e[o]),n.push(o))}return{newShape:r,keptDims:n}}function getTypedArrayFromDType(e,t){var r=null;if(null==e||"float32"===e)r=new Float32Array(t);else if("int32"===e)r=new Int32Array(t);else{if("bool"!==e)throw new Error("Unknown data type "+e);r=new Uint8Array(t)}return r}function checkForNaN(e,t,r){if("float32"===t)for(var n=0;n=0;--n)r[n]=r[n+1]*e[n+1];return r}function toTypedArray(e,t){return noConversionNeeded(e,t)?e:(Array.isArray(e)&&(e=flatten(e)),copyTypedArray(e,t))}function noConversionNeeded(e,t){return e instanceof Float32Array&&"float32"===t||e instanceof Int32Array&&"int32"===t||e instanceof Uint8Array&&"bool"===t}function makeOnesTypedArray(e,t){for(var r=makeZerosTypedArray(e,t),n=0;n1)for(var i=0;iFORMAT_LIMIT_NUM_VALS){var s=Array.from(e.subarray(0,FORMAT_NUM_FIRST_LAST_VALS)),u=Array.from(e.subarray(o-FORMAT_NUM_FIRST_LAST_VALS,o));return["["+s.map(function(e,t){return valToString(e,n[t])}).join(", ")+", ..., "+u.map(function(e,t){return valToString(e,n[o-FORMAT_NUM_FIRST_LAST_VALS+t])}).join(", ")+"]"]}return["["+Array.from(e).map(function(e,t){return valToString(e,n[t])}).join(", ")+"]"]}var l=t.slice(1),c=r.slice(1),p=r[0],d=[];if(o>FORMAT_LIMIT_NUM_VALS){for(var h=0;h1)return e.zeros([0],a);var o=makeZerosTypedArray(Math.abs(Math.ceil((r-t)/n)),a);r=0;o--){i=(m=e[o]).inputs;var h=[];for(h.push(m.output),c=0;c=0;r--){var n=t[r],a=e[n.output.id];if(null==n.gradient)throw new Error("Cannot compute gradient: gradient function not found for "+n.name+".");var o=n.gradient(a);for(var i in n.inputs){if(!(i in o))throw new Error("Cannot backprop through input "+i+". Available gradients found: "+Object.keys(o)+".");var s=o[i](),u=n.inputs[i];if(!arraysEqual(s.shape,u.shape))throw new Error("Error in gradient for op "+n.name+". The gradient of input '"+i+"' has shape '"+s.shape+"', which does not match the shape of the input '"+u.shape+"'");if(null==e[u.id])e[u.id]=s;else{var l=e[u.id];e[u.id]=l.add(s),l.dispose()}}}}var Type,Engine=function(){function e(e,t,r){this.backend=e,this.safeMode=t,this.debugMode=r,this.registeredVariables={},this.refCounter=new WeakMap,this.nextTapeNodeId=0,this.numBytes=0,this.numTensors=0,this.numDataBuffers=0,this.gradientScopeCount=0,this.customGradientDepth=0,this.keepTensors=new Set,this.activeScope={track:[]},this.scopeStack=[this.activeScope],this.profiler=new Profiler(e)}return e.prototype.tidy=function(e,t,r){void 0===r&&(r=!1);var n=null;if(null==t){if("function"!=typeof e)throw new Error("Please provide a function to tidy()");t=e}else{if("string"!=typeof e&&!(e instanceof String))throw new Error("When calling with two arguments, the first argument to tidy() must be a string");if("function"!=typeof t)throw new Error("When calling with two arguments, the 2nd argument to tidy() must be a function");n=e}this.startScope(n,r);var a=t();return a instanceof Promise&&console.error("Cannot return a Promise inside of tidy."),this.endScope(a,r),a},e.prototype.runKernel=function(e,t,r){var n,a=this,o=[],i=function(e){return o.push(e),e},s=this.activeScope.name;if(this.customGradientDepth++,n=this.debugMode?this.profiler.profileKernel(s,function(){return e(a.backend,i)}):e(this.backend,i),this.customGradientDepth--,this.shouldRecord()){var u={id:this.nextTapeNodeId++,name:s,inputs:t,output:n};null!=r&&(u.gradient=function(e){return r(e,o)}),this.activeTape.push(u)}return n},e.prototype.registerTensor=function(e){var t=this.refCounter.has(e.dataId)?this.refCounter.get(e.dataId):0;this.numTensors++,0===t&&(this.numDataBuffers++,this.numBytes+=sizeFromShape(e.shape)*bytesPerElement(e.dtype),this.backend.register(e.dataId,e.shape,e.dtype)),this.refCounter.set(e.dataId,t+1),e instanceof Variable||this.track(e)},e.prototype.registerVariable=function(e){if(null!=this.registeredVariables[e.name])throw new Error("Variable with name "+e.name+" was already registered");this.registeredVariables[e.name]=e},e.prototype.disposeTensor=function(e){if(this.refCounter.has(e.dataId)){this.keepTensors.has(e.id)&&this.keepTensors.delete(e.id),this.numTensors--;var t=this.refCounter.get(e.dataId);t<=1?(this.refCounter.delete(e.dataId),this.backend.disposeData(e.dataId),this.numDataBuffers--,this.numBytes-=sizeFromShape(e.shape)*bytesPerElement(e.dtype)):this.refCounter.set(e.dataId,t-1)}},e.prototype.disposeVariables=function(){for(var e in this.registeredVariables){var t=this.registeredVariables[e];this.disposeTensor(t),delete this.registeredVariables[e]}},e.prototype.memory=function(){var e=this.backend.memory();return e.numTensors=this.numTensors,e.numDataBuffers=this.numDataBuffers,e.numBytes=this.numBytes,e},e.prototype.shouldRecord=function(){return null!=this.activeTape&&0===this.customGradientDepth},e.prototype.addTapeNode=function(e,t,r){var n={};e.forEach(function(e,t){n[t]=e});var a={id:this.nextTapeNodeId++,name:this.activeScope.name,inputs:n,output:t,gradient:function(e){var t={};return r(e).forEach(function(e,r){t[r]=function(){return e}}),t}};this.activeTape.push(a)},e.prototype.keep=function(e){if(1===this.scopeStack.length&&this.safeMode)throw new Error("Safe mode is ON. Enclose all tensor operations inside tf.tidy(): tf.tidy(() => {...}) to avoid memory leaks.");return this.keepTensors.add(e.id),e},e.prototype.startScope=function(e,t){void 0===t&&(t=!1),t&&0===this.gradientScopeCount&&(this.activeTape=[]),t&&this.gradientScopeCount++;var r={track:[]};e&&(r.name=e),this.scopeStack.push(r),this.activeScope=r},e.prototype.endScope=function(e,t){var r=this;void 0===t&&(t=!1),t&&(this.gradientScopeCount--,0===this.gradientScopeCount&&(this.activeTape=null));var n=new Set(this.keepTensors),a=getTensorsInContainer(e);a.forEach(function(e){return n.add(e.id)});for(var o=0;o0,"gradients() received an empty list of xs."),this.tidy("gradients",function(){var o=e();assert(o instanceof Tensor,"The result y returned by f() must be a tensor.");var i=getFilteredNodesXToY(a.activeTape,t,o);if(!n&&0===i.length&&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.");var s={};return s[o.id]=null==r?TensorOps.ones(o.shape):r,backpropagateGradients(s,i),{value:o,grads:t.map(function(e){return s[e.id]})}},!0)},e.prototype.customGrad=function(e){var t=this;return assert(isFunction(e),"The f passed in customGrad(f) must be a function."),function(){for(var r,n=[],a=0;a {op();...}); to avoid memory leaks.");return this.activeScope.track.push(e),e},e}(),e;e=Type||(Type={}),e[e.NUMBER=0]="NUMBER",e[e.BOOLEAN=1]="BOOLEAN",e[e.STRING=2]="STRING";var URL_PROPERTIES=[{name:"DEBUG",type:Type.BOOLEAN},{name:"IS_BROWSER",type:Type.BOOLEAN},{name:"WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_VERSION",type:Type.NUMBER},{name:"WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_RELIABLE",type:Type.BOOLEAN},{name:"WEBGL_VERSION",type:Type.NUMBER},{name:"WEBGL_RENDER_FLOAT32_ENABLED",type:Type.BOOLEAN},{name:"WEBGL_DOWNLOAD_FLOAT_ENABLED",type:Type.BOOLEAN},{name:"WEBGL_GET_BUFFER_SUB_DATA_ASYNC_EXTENSION_ENABLED",type:Type.BOOLEAN},{name:"BACKEND",type:Type.STRING}];function isWebGLVersionEnabled(e,t){var r;try{r=getWebGLRenderingContext(e,t)}catch(e){return!1}return null!=r&&(loseContext(r),!0)}function getWebGLDisjointQueryTimerVersion(e,t){if(0===e)return 0;var r,n=getWebGLRenderingContext(e,t);return r=hasExtension(n,"EXT_disjoint_timer_query_webgl2")&&2===e?2:hasExtension(n,"EXT_disjoint_timer_query")?1:0,null!=n&&loseContext(n),r}function isRenderToFloatTextureEnabled(e,t){if(0===e)return!1;var r=getWebGLRenderingContext(e,t);if(1===e){if(!hasExtension(r,"OES_texture_float"))return!1}else if(!hasExtension(r,"EXT_color_buffer_float"))return!1;createFloatTextureAndBindToFramebuffer(r,e);var n=r.checkFramebufferStatus(r.FRAMEBUFFER)===r.FRAMEBUFFER_COMPLETE;return loseContext(r),n}function isDownloadFloatTextureEnabled(e,t){if(0===e)return!1;var r=getWebGLRenderingContext(e,t);if(1===e){if(!hasExtension(r,"OES_texture_float"))return!1}else if(!hasExtension(r,"EXT_color_buffer_float"))return!1;createFloatTextureAndBindToFramebuffer(r,e),r.readPixels(0,0,1,1,r.RGBA,r.FLOAT,new Float32Array(4));var n=r.getError()===r.NO_ERROR;return loseContext(r),n}function isWebGLGetBufferSubDataAsyncExtensionEnabled(e,t){if(e>0)return!1;if(2!==e)return!1;var r=getWebGLRenderingContext(e,t),n=hasExtension(r,"WEBGL_get_buffer_sub_data_async");return loseContext(r),n}function isChrome(){return null!=navigator&&null!=navigator.userAgent&&/Chrome/.test(navigator.userAgent)&&/Google Inc/.test(navigator.vendor)}var TENSORFLOWJS_FLAGS_PREFIX="tfjsflags";function getFeaturesFromURL(){var e={};if("undefined"==typeof window||void 0===window.location)return e;var t=getQueryParams(window.location.search);if(TENSORFLOWJS_FLAGS_PREFIX in t){var r={};t[TENSORFLOWJS_FLAGS_PREFIX].split(",").forEach(function(e){var t=e.split(":"),n=t[0],a=t[1];r[n]=a}),URL_PROPERTIES.forEach(function(t){t.name in r&&(console.log("Setting feature override from URL "+t.name+": "+r[t.name]),t.type===Type.NUMBER?e[t.name]=+r[t.name]:t.type===Type.BOOLEAN?e[t.name]="true"===r[t.name]:t.type===Type.STRING?e[t.name]=r[t.name]:console.warn("Unknown URL param: "+t.name+"."))})}return e}function hasExtension(e,t){return null!=e.getExtension(t)}function getWebGLRenderingContext(e,t){if(0===e||!t)throw new Error("Cannot get WebGL rendering context, WebGL is disabled.");var r=document.createElement("canvas");return 1===e?r.getContext("webgl")||r.getContext("experimental-webgl"):r.getContext("webgl2")}function loseContext(e){if(null!=e){var t=e.getExtension("WEBGL_lose_context");if(null==t)throw new Error("Extension WEBGL_lose_context not supported on this browser.");t.loseContext()}}function createFloatTextureAndBindToFramebuffer(e,t){var r=e.createFramebuffer(),n=e.createTexture();e.bindTexture(e.TEXTURE_2D,n);var a=2===t?e.RGBA32F:e.RGBA;e.texImage2D(e.TEXTURE_2D,0,a,1,1,0,e.RGBA,e.FLOAT,null),e.bindFramebuffer(e.FRAMEBUFFER,r),e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,n,0)}var TEST_EPSILON_FLOAT32_ENABLED=.001,TEST_EPSILON_FLOAT32_DISABLED=.1,Environment=function(){function e(e){this.features={},this.registry={},null!=e&&(this.features=e),this.get("DEBUG")&&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.")}return e.setBackend=function(e,t){if(void 0===t&&(t=!1),!(e in ENV.registry))throw new Error("Backend type '"+e+"' not found in registry");ENV.initBackend(e,t)},e.getBackend=function(){return ENV.initDefaultBackend(),ENV.currentBackend},e.disposeVariables=function(){ENV.engine.disposeVariables()},e.memory=function(){return ENV.engine.memory()},e.tidy=function(e,t,r){return void 0===r&&(r=!1),ENV.engine.tidy(e,t,r)},e.dispose=function(e){getTensorsInContainer(e).forEach(function(e){return e.dispose()})},e.keep=function(e){return ENV.engine.keep(e)},e.time=function(e){return ENV.engine.time(e)},e.prototype.get=function(e){return e in this.features?this.features[e]:(this.features[e]=this.evaluateFeature(e),this.features[e])},e.prototype.getFeatures=function(){return this.features},e.prototype.set=function(e,t){this.features[e]=t},e.prototype.getBestBackendType=function(){var e=this;if(0===Object.keys(this.registry).length)throw new Error("No backend found in registry.");return Object.keys(this.registry).map(function(t){return{name:t,entry:e.registry[t]}}).sort(function(e,t){return t.entry.priority-e.entry.priority})[0].name},e.prototype.evaluateFeature=function(e){if("DEBUG"===e)return!1;if("IS_BROWSER"===e)return"undefined"!=typeof window;if("IS_NODE"===e)return"undefined"!=typeof process&&void 0!==process.versions.node;if("IS_CHROME"===e)return isChrome();if("BACKEND"===e)return this.getBestBackendType();if("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_VERSION"===e){var t=this.get("WEBGL_VERSION");return 0===t?0:getWebGLDisjointQueryTimerVersion(t,this.get("IS_BROWSER"))}if("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_RELIABLE"===e)return this.get("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_VERSION")>0&&!isMobile();if("WEBGL_VERSION"===e)return isWebGLVersionEnabled(2,this.get("IS_BROWSER"))?2:isWebGLVersionEnabled(1,this.get("IS_BROWSER"))?1:0;if("WEBGL_RENDER_FLOAT32_ENABLED"===e)return isRenderToFloatTextureEnabled(this.get("WEBGL_VERSION"),this.get("IS_BROWSER"));if("WEBGL_DOWNLOAD_FLOAT_ENABLED"===e)return isDownloadFloatTextureEnabled(this.get("WEBGL_VERSION"),this.get("IS_BROWSER"));if("WEBGL_GET_BUFFER_SUB_DATA_ASYNC_EXTENSION_ENABLED"===e)return isWebGLGetBufferSubDataAsyncExtensionEnabled(this.get("WEBGL_VERSION"),this.get("IS_BROWSER"));if("TEST_EPSILON"===e)return this.get("WEBGL_RENDER_FLOAT32_ENABLED")?TEST_EPSILON_FLOAT32_ENABLED:TEST_EPSILON_FLOAT32_DISABLED;throw new Error("Unknown feature "+e+".")},e.prototype.setFeatures=function(e){this.features=e},e.prototype.reset=function(){this.features=getFeaturesFromURL(),null!=this.globalEngine&&(this.globalEngine=null)},e.prototype.initBackend=function(e,t){void 0===t&&(t=!1),this.currentBackend=e;var r=this.findBackend(e);this.globalEngine=new Engine(r,t,this.get("DEBUG"))},e.prototype.findBackend=function(e){return e in this.registry?this.registry[e].backend:null},e.prototype.registerBackend=function(e,t,r,n){var a=this;if(void 0===r&&(r=1),e in this.registry)return console.warn(e+" backend was already registered. Reusing existing backend"),null!=n&&n(function(){return a.engine}),!1;try{var o=t();return this.registry[e]={backend:o,priority:r},!0}catch(t){return console.warn("Registration of backend "+e+" failed"),console.warn(t.stack||t.message),!1}},e.prototype.removeBackend=function(e){if(!(e in this.registry))throw new Error(e+" backend not found in registry");this.registry[e].backend.dispose(),delete this.registry[e]},Object.defineProperty(e.prototype,"engine",{get:function(){return this.initDefaultBackend(),this.globalEngine},enumerable:!0,configurable:!0}),e.prototype.initDefaultBackend=function(){null==this.globalEngine&&this.initBackend(this.get("BACKEND"),!1)},__decorate([doc({heading:"Environment"})],e,"setBackend",null),__decorate([doc({heading:"Environment"})],e,"getBackend",null),__decorate([doc({heading:"Environment"})],e,"disposeVariables",null),__decorate([doc({heading:"Performance",subheading:"Memory"})],e,"memory",null),__decorate([doc({heading:"Performance",subheading:"Memory"})],e,"tidy",null),__decorate([doc({heading:"Performance",subheading:"Memory"})],e,"dispose",null),__decorate([doc({heading:"Performance",subheading:"Memory"})],e,"keep",null),__decorate([doc({heading:"Performance",subheading:"Timing"})],e,"time",null),e}();function getGlobalNamespace(){var e;if("undefined"!=typeof window)e=window;else{if("undefined"==typeof process)throw new Error("Could not find a global object");e=process}return e}function getOrMakeEnvironment(){var e=getGlobalNamespace();return null==e.ENV&&(e.ENV=new Environment(getFeaturesFromURL()),setTensorTracker(function(){return e.ENV.engine})),e.ENV}var DType,UpcastInt32AndMap,UpcastBoolAndMap,UpcastFloat32AndMap,ENV=getOrMakeEnvironment(),environment=Object.freeze({Environment:Environment,ENV:ENV});function axesAreInnerMostDims(e,t){for(var r=0;r=-r&&e=0&&r=1,"Pass at least one tensor to concat");var r=convertToTensorArray(e,"tensors","concat"),n=r[0];if(1===r.length)return n;for(var a=parseAxisParam(t,n.shape),o=1;o>>0,t=(n*=t)>>>0,t+=4294967296*(n-=t)}return 2.3283064365386963e-10*(t>>>0)});r.next=function(){var e=2091639*r.s0+2.3283064365386963e-10*r.c;return r.s0=r.s1,r.s1=r.s2,r.s2=e-(r.c=0|e)},r.c=1,r.s0=n(" "),r.s1=n(" "),r.s2=n(" "),r.s0-=n(e),r.s0<0&&(r.s0+=1),r.s1-=n(e),r.s1<0&&(r.s1+=1),r.s2-=n(e),r.s2<0&&(r.s2+=1),n=null}(e),a=t&&t.state,o=r.next;return o.int32=function(){return 4294967296*r.next()|0},o.double=function(){return o()+1.1102230246251565e-16*(2097152*o()|0)},o.quick=o,a&&("object"==typeof a&&n(a,r),o.state=function(){return n(r,{})}),o}t&&t.exports?t.exports=a:this.alea=a}(0,e)}),xor128=createCommonjsModule(function(e){!function(e,t,r){function n(e,t){return t.x=e.x,t.y=e.y,t.z=e.z,t.w=e.w,t}function a(e,t){var r=new function(e){var t=this,r="";t.x=0,t.y=0,t.z=0,t.w=0,t.next=function(){var e=t.x^t.x<<11;return t.x=t.y,t.y=t.z,t.z=t.w,t.w^=t.w>>>19^e^e>>>8},e===(0|e)?t.x=e:r+=e;for(var n=0;n>>0)/4294967296};return o.double=function(){do{var e=((r.next()>>>11)+(r.next()>>>0)/4294967296)/(1<<21)}while(0===e);return e},o.int32=r.next,o.quick=o,a&&("object"==typeof a&&n(a,r),o.state=function(){return n(r,{})}),o}t&&t.exports?t.exports=a:this.xor128=a}(0,e)}),xorwow=createCommonjsModule(function(e){!function(e,t,r){function n(e,t){return t.x=e.x,t.y=e.y,t.z=e.z,t.w=e.w,t.v=e.v,t.d=e.d,t}function a(e,t){var r=new function(e){var t=this,r="";t.next=function(){var e=t.x^t.x>>>2;return t.x=t.y,t.y=t.z,t.z=t.w,t.w=t.v,(t.d=t.d+362437|0)+(t.v=t.v^t.v<<4^e^e<<1)|0},t.x=0,t.y=0,t.z=0,t.w=0,t.v=0,e===(0|e)?t.x=e:r+=e;for(var n=0;n>>4),t.next()}(e),a=t&&t.state,o=function(){return(r.next()>>>0)/4294967296};return o.double=function(){do{var e=((r.next()>>>11)+(r.next()>>>0)/4294967296)/(1<<21)}while(0===e);return e},o.int32=r.next,o.quick=o,a&&("object"==typeof a&&n(a,r),o.state=function(){return n(r,{})}),o}t&&t.exports?t.exports=a:this.xorwow=a}(0,e)}),xorshift7=createCommonjsModule(function(e){!function(e,t,r){function n(e,t){return t.x=e.x.slice(),t.i=e.i,t}function a(e,t){null==e&&(e=+new Date);var r=new function(e){var t=this;t.next=function(){var e,r,n=t.x,a=t.i;return e=n[a],r=(e^=e>>>7)^e<<24,r^=(e=n[a+1&7])^e>>>10,r^=(e=n[a+3&7])^e>>>3,r^=(e=n[a+4&7])^e<<7,e=n[a+7&7],r^=(e^=e<<13)^e<<9,n[a]=r,t.i=a+1&7,r},function(e,t){var r,n=[];if(t===(0|t))n[0]=t;else for(t=""+t,r=0;r0;--r)e.next()}(t,e)}(e),a=t&&t.state,o=function(){return(r.next()>>>0)/4294967296};return o.double=function(){do{var e=((r.next()>>>11)+(r.next()>>>0)/4294967296)/(1<<21)}while(0===e);return e},o.int32=r.next,o.quick=o,a&&(a.x&&n(a,r),o.state=function(){return n(r,{})}),o}t&&t.exports?t.exports=a:this.xorshift7=a}(0,e)}),xor4096=createCommonjsModule(function(e){!function(e,t,r){function n(e,t){return t.i=e.i,t.w=e.w,t.X=e.X.slice(),t}function a(e,t){null==e&&(e=+new Date);var r=new function(e){var t=this;t.next=function(){var e,r,n=t.w,a=t.X,o=t.i;return t.w=n=n+1640531527|0,r=a[o+34&127],e=a[o=o+1&127],r^=r<<13,e^=e<<17,r^=r>>>15,e^=e>>>12,r=a[o]=r^e,t.i=o,r+(n^n>>>16)|0},function(e,t){var r,n,a,o,i,s=[],u=128;for(t===(0|t)?(n=t,t=null):(t+="\0",n=0,u=Math.max(u,t.length)),a=0,o=-32;o>>15,n^=n<<4,n^=n>>>13,o>=0&&(i=i+1640531527|0,a=0==(r=s[127&o]^=n+i)?a+1:0);for(a>=128&&(s[127&(t&&t.length||0)]=-1),a=127,o=512;o>0;--o)n=s[a+34&127],r=s[a=a+1&127],n^=n<<13,r^=r<<17,n^=n>>>15,r^=r>>>12,s[a]=n^r;e.w=i,e.X=s,e.i=a}(t,e)}(e),a=t&&t.state,o=function(){return(r.next()>>>0)/4294967296};return o.double=function(){do{var e=((r.next()>>>11)+(r.next()>>>0)/4294967296)/(1<<21)}while(0===e);return e},o.int32=r.next,o.quick=o,a&&(a.X&&n(a,r),o.state=function(){return n(r,{})}),o}t&&t.exports?t.exports=a:this.xor4096=a}(0,e)}),tychei=createCommonjsModule(function(e){!function(e,t,r){function n(e,t){return t.a=e.a,t.b=e.b,t.c=e.c,t.d=e.d,t}function a(e,t){var r=new function(e){var t=this,r="";t.next=function(){var e=t.b,r=t.c,n=t.d,a=t.a;return e=e<<25^e>>>7^r,r=r-n|0,n=n<<24^n>>>8^a,a=a-e|0,t.b=e=e<<20^e>>>12^r,t.c=r=r-n|0,t.d=n<<16^r>>>16^a,t.a=a-e|0},t.a=0,t.b=0,t.c=-1640531527,t.d=1367130551,e===Math.floor(e)?(t.a=e/4294967296|0,t.b=0|e):r+=e;for(var n=0;n>>0)/4294967296};return o.double=function(){do{var e=((r.next()>>>11)+(r.next()>>>0)/4294967296)/(1<<21)}while(0===e);return e},o.int32=r.next,o.quick=o,a&&("object"==typeof a&&n(a,r),o.state=function(){return n(r,{})}),o}t&&t.exports?t.exports=a:this.tychei=a}(0,e)}),seedrandom=createCommonjsModule(function(e){!function(t,r){var n,a=this,o=256,i=6,s="random",u=r.pow(o,i),l=r.pow(2,52),c=2*l,p=o-1;function d(e,d,g){var y=[],v=f(function e(t,r){var n,a=[],o=typeof t;if(r&&"object"==o)for(n in t)try{a.push(e(t[n],r-1))}catch(e){}return a.length?a:"string"==o?t:t+"\0"}((d=1==d?{entropy:!0}:d||{}).entropy?[e,m(t)]:null==e?function(){try{var e;return n&&(e=n.randomBytes)?e=e(o):(e=new Uint8Array(o),(a.crypto||a.msCrypto).getRandomValues(e)),m(e)}catch(e){var r=a.navigator,i=r&&r.plugins;return[+new Date,a,i,a.screen,m(t)]}}():e,3),y),b=new function(e){var t,r=e.length,n=this,a=0,i=n.i=n.j=0,s=n.S=[];for(r||(e=[r++]);a=c;)e/=2,t/=2,r>>>=1;return(e+r)/t};return x.int32=function(){return 0|b.g(4)},x.quick=function(){return b.g(4)/4294967296},x.double=x,f(m(b.S),t),(d.pass||g||function(e,t,n,a){return a&&(a.S&&h(a,b),e.state=function(){return h(b,{})}),n?(r[s]=e,t):e})(x,v,"global"in d?d.global:this==r,d.state)}function h(e,t){return t.i=e.i,t.j=e.j,t.S=e.S.slice(),t}function f(e,t){for(var r,n=e+"",a=0;a=1||0===i);var s=Math.sqrt(-2*Math.log(i)/i);t=this.mean+this.stdDev*a*s,r=this.mean+this.stdDev*o*s,this.truncated&&!this.isValidTruncated(t)||(n=!0)}return this.truncated&&!this.isValidTruncated(r)||(this.nextVal=this.convertValue(r)),this.convertValue(t)},e.prototype.convertValue=function(e){return null==this.dtype||"float32"===this.dtype?e:Math.round(e)},e.prototype.isValidTruncated=function(e){return e<=this.upper&&e>=this.lower},e}(),ArrayOps=function(){function e(){}return e.clone=function(e){var t=convertToTensor(e,"x","clone");return ENV.engine.runKernel(function(e){return Tensor.make(t.shape,{dataId:t.dataId},t.dtype)},{$x:t},function(e){return{$x:function(){return e.toFloat()}}})},e.eye=function(t,r,n,a){void 0===a&&(a="float32"),null==r&&(r=t);for(var o=e.buffer([t,r],a),i=t<=r?t:r,s=0;s2)throw new Error("Rank of probabilities must be 1 or 2, but is "+i);r=r||Math.random();var s=1===i?a.as2D(1,-1):a,u=ENV.engine.runKernel(function(e){return e.multinomial(s,n,t,r)},{logits2D:s});return 1===i?u.as1D():u},e.oneHot=function(e,t,r,n){void 0===r&&(r=1),void 0===n&&(n=0);var a=convertToTensor(e,"indices","oneHot","int32");if(assert("int32"===a.dtype,"Indices must be of dtype `int32`"),t<2)throw new Error("Error in oneHot: depth must be >=2, but it is "+t);return ENV.engine.runKernel(function(e){return e.oneHot(a,t,r,n)},{$indices:a})},e.fromPixels=function(e,t){if(void 0===t&&(t=3),t>4)throw new Error("Cannot construct Tensor with more than 4 channels from pixels.");return ENV.engine.fromPixels(e,t)},e.toPixels=function(e,t){return __awaiter(this,void 0,void 0,function(){var r,n,a,o,i,s,u,l,c,p,d,h,f,m,g,y,v,b,x,w;return __generator(this,function(S){switch(S.label){case 0:if(2!==(r=convertToTensor(e,"img","toPixels","int32")).rank&&3!==r.rank)throw new Error("toPixels only supports rank 2 or 3 tensors, got rank "+r.rank+".");if(n=r.shape.slice(0,2),a=n[0],o=n[1],(i=2===r.rank?1:r.shape[2])>4||2===i)throw new Error("toPixels only supports depth of size 1, 3 or 4 but got "+i);return s=r.min(),u=r.max(),[4,s.data()];case 1:return l=S.sent()[0],[4,u.data()];case 2:if(c=S.sent()[0],s.dispose(),u.dispose(),"float32"===r.dtype){if(l<0||c>1)throw new Error("Tensor values for a float32 Tensor must be in the range [0 - 1] but got range ["+l+" - "+c+"].")}else{if("int32"!==r.dtype)throw new Error("Unsupported type for toPixels: "+r.dtype+". Please use float32 or int32 tensors.");if(l<0||c>255)throw new Error("Tensor values for a int32 Tensor must be in the range [0 - 255] but got range ["+l+" - "+c+"].")}return[4,r.data()];case 3:for(p=S.sent(),d="float32"===r.dtype?255:1,h=new Uint8ClampedArray(o*a*4),f=0;f=1,"Pass at least one tensor to tf.stack"),1===r.length)return r[0].expandDims(t);var n=r[0].rank,a=r[0].shape,o=r[0].dtype;assert(t<=n,"Axis must be <= rank of the tensor"),r.forEach(function(e){assertShapesMatch(a,e.shape,"All tensors passed to stack must have matching shapes")}),r.forEach(function(e){assert(o===e.dtype,"All tensors passed to stack must have matching dtypes")});var i=r.map(function(e){return e.expandDims(t)});return ConcatOps.concat(i,t)},e.unstack=function(e,t){void 0===t&&(t=0);for(var r,n=convertToTensor(e,"x","unstack"),a=n.shape[t],o=Array(n.rank-1).fill(0),i=0,s=0;s1&&1===i&&n.unshift(o)}return n}function getReductionAxes(e,t){for(var r=[],n=0;n1)&&r.unshift(o)}return r}function broadcastDimsAreOuter(e){for(var t=0;t1&&s>1&&i!==s)throw Error(n);r.unshift(Math.max(i,s))}return r}var UnaryOps=function(){function e(){}return e.neg=function(e){var t=convertToTensor(e,"x","neg");return ENV.engine.runKernel(function(e){return e.neg(t)},{$x:t},function(e){return{$x:function(){return e.neg()}}})},e.ceil=function(e){var t=convertToTensor(e,"x","ceil");return ENV.engine.runKernel(function(e){return e.ceil(t)},{$x:t},function(e){return{$x:function(){return TensorOps.zerosLike(e)}}})},e.floor=function(e){var t=convertToTensor(e,"x","floor");return ENV.engine.runKernel(function(e){return e.floor(t)},{$x:t},function(e){return{$x:function(){return TensorOps.zerosLike(e)}}})},e.sign=function(e){var t=convertToTensor(e,"x","sign");return ENV.engine.runKernel(function(e){return e.sign(t)},{$x:t},function(e){return{$x:function(){return TensorOps.zerosLike(e)}}})},e.round=function(e){var t=convertToTensor(e,"x","round");return ENV.engine.runKernel(function(e){return e.round(t)},{$x:t},function(e){return{$x:function(){return TensorOps.zerosLike(e)}}})},e.exp=function(e){var t=convertToTensor(e,"x","exp");return ENV.engine.runKernel(function(e,r){return r(e.exp(t))},{$x:t},function(e,t){var r=t[0];return{$x:function(){return e.mulStrict(r)}}})},e.expm1=function(e){var t=convertToTensor(e,"x","expm1");return ENV.engine.runKernel(function(e){return e.expm1(t)},{$x:t},function(e){return{$x:function(){return e.mulStrict(t.exp())}}})},e.log=function(e){var t=convertToTensor(e,"x","log");return ENV.engine.runKernel(function(e){return e.log(t)},{$x:t},function(e){return{$x:function(){return e.divStrict(t.toFloat())}}})},e.log1p=function(e){var t=convertToTensor(e,"x","log1p");return ENV.engine.runKernel(function(e){return e.log1p(t)},{$x:t},function(e){return{$x:function(){return e.divStrict(t.add(TensorOps.scalar(1)))}}})},e.sqrt=function(e){var t=convertToTensor(e,"x","sqrt");return ENV.engine.runKernel(function(e){return e.sqrt(t)},{$x:t},function(e){return{$x:function(){return e.divStrict(t.toFloat().sqrt().mul(TensorOps.scalar(2)))}}})},e.rsqrt=function(e){var t=convertToTensor(e,"x","rsqrt");return ENV.engine.runKernel(function(e){return e.rsqrt(t)},{$x:t},function(e){return{$x:function(){return e.divStrict(t.pow(TensorOps.scalar(1.5)).mul(TensorOps.scalar(2))).neg()}}})},e.square=function(e){var t=convertToTensor(e,"x","square");return ENV.engine.runKernel(function(e){return e.square(t)},{$x:t},function(e){return{$x:function(){return e.mulStrict(t.toFloat().mul(TensorOps.scalar(2)))}}})},e.reciprocal=function(e){var t=convertToTensor(e,"x","reciprocal");return ENV.engine.runKernel(function(e){return e.reciprocal(t)},{$x:t},function(e){return{$x:function(){return e.divStrict(t.square().neg())}}})},e.abs=function(e){var t=convertToTensor(e,"x","abs");return ENV.engine.runKernel(function(e){return e.abs(t)},{$x:t},function(e){return{$x:function(){return e.mulStrict(t.toFloat().step(-1))}}})},e.clipByValue=function(e,t,r){var n=convertToTensor(e,"x","clipByValue");return assert(t<=r,"Error in clip: min ("+t+") must be less than or equal to max ("+r+")."),ENV.engine.runKernel(function(e){return e.clip(n,t,r)},{$x:n},function(e){return{$x:function(){return e.where(n.greaterEqual(TensorOps.scalar(t)).logicalAnd(n.lessEqual(TensorOps.scalar(r))),TensorOps.zerosLike(e))}}})},e.sigmoid=function(e){var t=convertToTensor(e,"x","sigmoid");return ENV.engine.runKernel(function(e,r){return r(e.sigmoid(t))},{$x:t},function(e,t){var r=t[0];return{$x:function(){return e.mulStrict(r.mul(TensorOps.scalar(1).sub(r)))}}})},e.logSigmoid=function(e){var t=convertToTensor(e,"x","logSigmoid");return ENV.engine.runKernel(function(e){return e.softplus(t.neg()).neg()},{$x:t},function(e){return{$x:function(){return e.mulStrict(t.neg().sigmoid())}}})},e.softplus=function(e){var t=convertToTensor(e,"x","softplus");return ENV.engine.runKernel(function(e){return e.softplus(t)},{$x:t},function(e){return{$x:function(){return e.mulStrict(t.sigmoid())}}})},e.sin=function(e){var t=convertToTensor(e,"x","sin");return ENV.engine.runKernel(function(e){return e.sin(t)},{$x:t},function(e){return{$x:function(){return t.toFloat().cos().mulStrict(e)}}})},e.cos=function(e){var t=convertToTensor(e,"x","cos");return ENV.engine.runKernel(function(e){return e.cos(t)},{$x:t},function(e){return{$x:function(){return t.toFloat().sin().neg().mulStrict(e)}}})},e.tan=function(e){var t=convertToTensor(e,"x","tan");return ENV.engine.runKernel(function(e){return e.tan(t)},{$x:t},function(e){return{$x:function(){return e.divStrict(t.cos().square())}}})},e.asin=function(e){var t=convertToTensor(e,"x","asin");return ENV.engine.runKernel(function(e){return e.asin(t)},{$x:t},function(e){return{$x:function(){return e.divStrict(TensorOps.scalar(1).sub(t.toFloat().square()).sqrt())}}})},e.acos=function(e){var t=convertToTensor(e,"x","acos");return ENV.engine.runKernel(function(e){return e.acos(t)},{$x:t},function(e){return{$x:function(){return e.divStrict(TensorOps.scalar(1).sub(t.toFloat().square()).sqrt()).neg()}}})},e.atan=function(e){var t=convertToTensor(e,"x","atan");return ENV.engine.runKernel(function(e){return e.atan(t)},{$x:t},function(e){return{$x:function(){return e.divStrict(TensorOps.scalar(1).add(t.toFloat().square()))}}})},e.sinh=function(e){var t=convertToTensor(e,"x","sinh");return ENV.engine.runKernel(function(e){return e.sinh(t)},{$x:t},function(e){return{$x:function(){return t.toFloat().cosh().mulStrict(e)}}})},e.cosh=function(e){var t=convertToTensor(e,"x","cosh");return ENV.engine.runKernel(function(e){return e.cosh(t)},{$x:t},function(e){return{$x:function(){return t.toFloat().sinh().mulStrict(e)}}})},e.tanh=function(e){var t=convertToTensor(e,"x","tanh");return ENV.engine.runKernel(function(e,r){return r(e.tanh(t))},{$x:t},function(e,t){var r=t[0];return{$x:function(){return TensorOps.scalar(1).sub(r.square()).mulStrict(e)}}})},e.asinh=function(e){var t=convertToTensor(e,"x","asinh");return ENV.engine.runKernel(function(e){return e.asinh(t)},{$x:t},function(e){return{$x:function(){return e.divStrict(TensorOps.scalar(1).add(t.toFloat().square()).sqrt())}}})},e.acosh=function(e){var t=convertToTensor(e,"x","acosh");return ENV.engine.runKernel(function(e){return e.acosh(t)},{$x:t},function(e){return{$x:function(){return e.divStrict(t.toFloat().square().sub(TensorOps.scalar(1)).sqrt())}}})},e.atanh=function(e){var t=convertToTensor(e,"x","atanh");return ENV.engine.runKernel(function(e){return e.atanh(t)},{$x:t},function(e){return{$x:function(){return e.divStrict(TensorOps.scalar(1).sub(t.toFloat().square()))}}})},e.erf=function(e){var t=convertToTensor(e,"x","erf");return assert("int32"===t.dtype||"float32"===t.dtype,"Input dtype must be `int32` or `float32`."),"int32"===t.dtype&&(t=t.toFloat()),ENV.engine.runKernel(function(e){return e.erf(t)},{$x:t},function(e){return{$x:function(){return e.mulStrict(TensorOps.scalar(2/Math.sqrt(Math.PI)).mul(t.square().neg().exp()))}}})},e.step=function(e,t){void 0===t&&(t=0);var r=convertToTensor(e,"x","step");return ENV.engine.runKernel(function(e){return e.step(r,t)},{$x:r},function(e){return{$x:function(){return TensorOps.zerosLike(e)}}})},__decorate([doc({heading:"Operations",subheading:"Basic math"}),operation],e,"neg",null),__decorate([doc({heading:"Operations",subheading:"Basic math"}),operation],e,"ceil",null),__decorate([doc({heading:"Operations",subheading:"Basic math"}),operation],e,"floor",null),__decorate([doc({heading:"Operations",subheading:"Basic math"}),operation],e,"sign",null),__decorate([doc({heading:"Operations",subheading:"Basic math"}),operation],e,"round",null),__decorate([doc({heading:"Operations",subheading:"Basic math"}),operation],e,"exp",null),__decorate([doc({heading:"Operations",subheading:"Basic math"}),operation],e,"expm1",null),__decorate([doc({heading:"Operations",subheading:"Basic math"}),operation],e,"log",null),__decorate([doc({heading:"Operations",subheading:"Basic math"}),operation],e,"log1p",null),__decorate([doc({heading:"Operations",subheading:"Basic math"}),operation],e,"sqrt",null),__decorate([doc({heading:"Operations",subheading:"Basic math"}),operation],e,"rsqrt",null),__decorate([doc({heading:"Operations",subheading:"Basic math"}),operation],e,"square",null),__decorate([doc({heading:"Operations",subheading:"Basic math"}),operation],e,"reciprocal",null),__decorate([doc({heading:"Operations",subheading:"Basic math"}),operation],e,"abs",null),__decorate([doc({heading:"Operations",subheading:"Basic math"}),operation],e,"clipByValue",null),__decorate([doc({heading:"Operations",subheading:"Basic math"}),operation],e,"sigmoid",null),__decorate([doc({heading:"Operations",subheading:"Basic math"}),operation],e,"logSigmoid",null),__decorate([doc({heading:"Operations",subheading:"Basic math"}),operation],e,"softplus",null),__decorate([doc({heading:"Operations",subheading:"Basic math"}),operation],e,"sin",null),__decorate([doc({heading:"Operations",subheading:"Basic math"}),operation],e,"cos",null),__decorate([doc({heading:"Operations",subheading:"Basic math"}),operation],e,"tan",null),__decorate([doc({heading:"Operations",subheading:"Basic math"}),operation],e,"asin",null),__decorate([doc({heading:"Operations",subheading:"Basic math"}),operation],e,"acos",null),__decorate([doc({heading:"Operations",subheading:"Basic math"}),operation],e,"atan",null),__decorate([doc({heading:"Operations",subheading:"Basic math"}),operation],e,"sinh",null),__decorate([doc({heading:"Operations",subheading:"Basic math"}),operation],e,"cosh",null),__decorate([doc({heading:"Operations",subheading:"Basic math"}),operation],e,"tanh",null),__decorate([doc({heading:"Operations",subheading:"Basic math"}),operation],e,"asinh",null),__decorate([doc({heading:"Operations",subheading:"Basic math"}),operation],e,"acosh",null),__decorate([doc({heading:"Operations",subheading:"Basic math"}),operation],e,"atanh",null),__decorate([doc({heading:"Operations",subheading:"Basic math"}),operation],e,"erf",null),__decorate([doc({heading:"Operations",subheading:"Basic math"}),operation],e,"step",null),e}(),BatchNormOps=function(){function e(){}return e.batchNormalization2d=function(t,r,n,a,o,i){void 0===a&&(a=.001);var s,u,l=convertToTensor(t,"x","batchNormalization"),c=convertToTensor(r,"mean","batchNormalization"),p=convertToTensor(n,"variance","batchNormalization");return null!=o&&(s=convertToTensor(o,"scale","batchNormalization")),null!=i&&(u=convertToTensor(i,"offset","batchNormalization")),assert(2===l.rank,"Error in batchNormalization3D: x must be rank 3 but got rank "+l.rank+"."),assert(2===c.rank||1===c.rank,"Error in batchNormalization2D: mean must be rank 2 or rank 1 but got rank "+c.rank+"."),assert(2===p.rank||1===p.rank,"Error in batchNormalization2D: variance must be rank 2 or rank 1 but got rank "+p.rank+"."),null!=s&&assert(2===s.rank||1===s.rank,"Error in batchNormalization2D: scale must be rank 2 or rank 1 but got rank "+s.rank+"."),null!=u&&assert(2===u.rank||1===u.rank,"Error in batchNormalization2D: offset must be rank 2 or rank 1 but got rank "+u.rank+"."),e.batchNormalization(l,c,p,a,s,u)},e.batchNormalization3d=function(t,r,n,a,o,i){void 0===a&&(a=.001);var s,u,l=convertToTensor(t,"x","batchNormalization"),c=convertToTensor(r,"mean","batchNormalization"),p=convertToTensor(n,"variance","batchNormalization");return null!=o&&(s=convertToTensor(o,"scale","batchNormalization")),null!=i&&(u=convertToTensor(i,"offset","batchNormalization")),assert(3===l.rank,"Error in batchNormalization3D: x must be rank 3 but got rank "+l.rank+"."),assert(3===c.rank||1===c.rank,"Error in batchNormalization3D: mean must be rank 3 or rank 1 but got rank "+c.rank+"."),assert(3===p.rank||1===p.rank,"Error in batchNormalization3D: variance must be rank 3 or rank 1 but got rank "+p.rank+"."),null!=s&&assert(3===s.rank||1===s.rank,"Error in batchNormalization3D: scale must be rank 3 or rank 1 but got rank "+s.rank+"."),null!=u&&assert(3===u.rank||1===u.rank,"Error in batchNormalization3D: offset must be rank 3 or rank 1 but got rank "+u.rank+"."),e.batchNormalization(l,c,p,a,s,u)},e.batchNormalization4d=function(t,r,n,a,o,i){void 0===a&&(a=.001);var s,u,l=convertToTensor(t,"x","batchNormalization"),c=convertToTensor(r,"mean","batchNormalization"),p=convertToTensor(n,"variance","batchNormalization");return null!=o&&(s=convertToTensor(o,"scale","batchNormalization")),null!=i&&(u=convertToTensor(i,"offset","batchNormalization")),assert(4===l.rank,"Error in batchNormalization4D: x must be rank 4 but got rank "+l.rank+"."),assert(4===c.rank||1===c.rank,"Error in batchNormalization4D: mean must be rank 4 or rank 1 but got rank "+c.rank+"."),assert(4===p.rank||1===p.rank,"Error in batchNormalization4D: variance must be rank 4 or rank 1 but got rank "+p.rank+"."),null!=s&&assert(4===s.rank||1===s.rank,"Error in batchNormalization4D: scale must be rank 4 or rank 1 but got rank "+s.rank+"."),null!=u&&assert(4===u.rank||1===u.rank,"Error in batchNormalization4D: offset must be rank 4 or rank 1 but got rank "+u.rank+"."),e.batchNormalization(l,c,p,a,s,u)},e.batchNormalization=function(e,t,r,n,a,o){void 0===n&&(n=.001);var i,s,u,l=convertToTensor(e,"x","batchNormalization"),c=convertToTensor(t,"mean","batchNormalization"),p=convertToTensor(r,"variance","batchNormalization");return null!=a&&(i=convertToTensor(a,"scale","batchNormalization")),null!=o&&(s=convertToTensor(o,"offset","batchNormalization")),assert(c.rank===p.rank,"Batch normalization gradient requires mean and variance to have equal ranks."),assert(null==s||c.rank===s.rank,"Batch normalization gradient requires mean and offset to have equal ranks."),assert(null==i||c.rank===i.rank,"Batch normalization gradient requires mean and scale to have equal ranks."),u=0===l.rank||1===l.rank?l.as4D(1,1,1,l.size):2===l.rank?l.as4D(1,1,l.shape[0],l.shape[1]):3===l.rank?l.as4D(1,l.shape[0],l.shape[1],l.shape[2]):l,ENV.engine.runKernel(function(e){return e.batchNormalization(u,batchnormReshape4D(c),batchnormReshape4D(p),n,batchnormReshape4D(i),batchnormReshape4D(s))},{$x:l,$mean:c,$variance:p,$scale:i,$offset:s},function(e){var t=null==i?TensorOps.scalar(1):i,r=getReductionAxes(c.shape,u.shape),a=[];if(1===c.rank){for(var o=0;o0&&(t=t.sum(n)),t.reshape(r.shape)},$b:function(){var t=e,r=getReductionAxes(n.shape,a);return r.length>0&&(t=t.sum(r)),t.reshape(n.shape)}}})},e.addStrict=function(e,t){return assertShapesMatch(e.shape,t.shape,"Error in addStrict: "),e.add(t)},e.sub=function(e,t){var r=convertToTensor(e,"a","sub"),n=convertToTensor(t,"b","sub");assertTypesMatch(r,n);var a=assertAndGetBroadcastShape(r.shape,n.shape);return ENV.engine.runKernel(function(e){return e.subtract(r,n)},{$a:r,$b:n},function(e){return{$a:function(){var t=e,n=getReductionAxes(r.shape,a);return n.length>0&&(t=t.sum(n)),t.reshape(r.shape)},$b:function(){var t=e,r=getReductionAxes(n.shape,a);return r.length>0&&(t=t.sum(r)),t.neg().reshape(n.shape)}}})},e.subStrict=function(e,t){return assertShapesMatch(e.shape,t.shape,"Error in subStrict: "),e.sub(t)},e.pow=function(e,t){var r=convertToTensor(e,"base","pow"),n=convertToTensor(t,"exp","pow"),a=assertAndGetBroadcastShape(r.shape,n.shape);return e=r.cast(upcastType(r.dtype,n.dtype)),t=n.cast(upcastType(r.dtype,n.dtype)),ENV.engine.runKernel(function(e,t){return t(e.pow(r,n))},{$base:r,$exp:n},function(e,t){var o=t[0];return{$base:function(){var t=e.mul(n.toFloat().mul(o.div(r))),i=getReductionAxes(r.shape,a);return i.length>0&&(t=t.sum(i)),t.reshape(r.shape)},$exp:function(){var t=e.mul(o.mul(r.log()).toFloat()),i=getReductionAxes(n.shape,a);return i.length>0&&(t=t.sum(i)),t.reshape(n.shape)}}})},e.powStrict=function(e,t){return assertShapesMatch(e.shape,t.shape,"Error in powStrict: "),e.pow(t)},e.mul=function(e,t){var r=convertToTensor(e,"a","mul"),n=convertToTensor(t,"b","mul");assertTypesMatch(r,n);var a=assertAndGetBroadcastShape(r.shape,n.shape);return ENV.engine.runKernel(function(e){return e.multiply(r,n)},{$a:r,$b:n},function(e){return{$a:function(){var t=e.mul(n.toFloat()),o=getReductionAxes(r.shape,a);return o.length>0?t.sum(o).reshape(r.shape):t},$b:function(){var t=e.mul(r.toFloat()),o=getReductionAxes(n.shape,a);return o.length>0?t.sum(o).reshape(n.shape):t}}})},e.mulStrict=function(e,t){return assertShapesMatch(e.shape,t.shape,"Error in multiplyStrict: "),e.mul(t)},e.div=function(t,r){var n,a=convertToTensor(t,"a","div"),o=convertToTensor(r,"b","div");if(assertTypesMatch(a,o),"int32"===a.dtype&&"int32"===o.dtype)return e.floorDiv(a,o);n=function(e){return e.realDivide(a,o)};var i=assertAndGetBroadcastShape(a.shape,o.shape);return ENV.engine.runKernel(n,{$a:a,$b:o},function(e){return{$a:function(){var t=e.div(o.toFloat()),r=getReductionAxes(a.shape,i);return r.length>0?t.sum(r).reshape(a.shape):t},$b:function(){var t=e.mul(a.toFloat()),r=getReductionAxes(o.shape,i);r.length>0&&(t=t.sum(r).reshape(o.shape));var n=o.square();return t.div(n.toFloat()).neg()}}})},e.floorDiv=function(e,t){var r=convertToTensor(e,"a","floorDiv"),n=convertToTensor(t,"b","floorDiv");assertTypesMatch(r,n);var a=assertAndGetBroadcastShape(r.shape,n.shape);return ENV.engine.runKernel(function(e){return e.floorDiv(r,n)},{$a:r,$b:n},function(e){return{$a:function(){var t=e.div(n.toFloat()),o=getReductionAxes(r.shape,a);return o.length>0?t.sum(o).reshape(r.shape):t},$b:function(){var t=e.mul(r.toFloat()),o=getReductionAxes(n.shape,a);o.length>0&&(t=t.sum(o).reshape(n.shape));var i=n.square();return t.div(i.toFloat()).neg()}}})},e.divStrict=function(e,t){return assertShapesMatch(e.shape,t.shape,"Error in divideStrict: "),e.div(t)},e.mod=function(e,t){var r=convertToTensor(e,"a","mod"),n=convertToTensor(t,"b","mod");assertTypesMatch(r,n);var a=assertAndGetBroadcastShape(r.shape,n.shape);return ENV.engine.runKernel(function(e){return e.mod(r,n)},{$a:r,$b:n},function(e){return{$a:function(){var t=getReductionAxes(r.shape,a);return t.length>0?e.sum(t).reshape(r.shape):e},$b:function(){var t=e.mul(r.div(n).floor().neg()),o=getReductionAxes(n.shape,a);return o.length>0?t.sum(o).reshape(n.shape):t}}})},e.modStrict=function(e,t){return assertShapesMatch(e.shape,t.shape,"Error in modStrict: "),e.mod(t)},e.minimum=function(e,t){var r=convertToTensor(e,"a","minimum"),n=convertToTensor(t,"b","minimum");return assertTypesMatch(r,n),"bool"===r.dtype&&(r=r.toInt()),"bool"===n.dtype&&(n=n.toInt()),assertAndGetBroadcastShape(r.shape,n.shape),ENV.engine.runKernel(function(e){return e.minimum(r,n)},{$a:r,$b:n},function(e){return{$a:function(){return e.mul(r.lessEqual(n).toFloat())},$b:function(){return e.mul(r.greater(n).toFloat())}}})},e.minimumStrict=function(e,t){return assertShapesMatch(e.shape,t.shape,"Error in minimumStrict: "),e.minimum(t)},e.maximum=function(e,t){var r=convertToTensor(e,"a","maximum"),n=convertToTensor(t,"b","maximum");return assertTypesMatch(r,n),"bool"===r.dtype&&(r=r.toInt()),"bool"===n.dtype&&(n=n.toInt()),assertAndGetBroadcastShape(r.shape,n.shape),ENV.engine.runKernel(function(e){return e.maximum(r,n)},{$a:r,$b:n},function(e){return{$a:function(){return e.mul(r.greaterEqual(n).toFloat())},$b:function(){return e.mul(r.less(n).toFloat())}}})},e.maximumStrict=function(e,t){return assertShapesMatch(e.shape,t.shape,"Error in minimumStrict: "),e.maximum(t)},e.squaredDifference=function(e,t){var r=convertToTensor(e,"a","squaredDifference"),n=convertToTensor(t,"b","squaredDifference");return assertTypesMatch(r,n),assertAndGetBroadcastShape(r.shape,n.shape),ENV.engine.runKernel(function(e){return e.squaredDifference(r,n)},{$a:r,$b:n},function(e){var t=TensorOps.scalar(2);return{$a:function(){return e.mul(r.sub(n).mul(t))},$b:function(){return e.mul(n.sub(r).mul(t))}}})},e.squaredDifferenceStrict=function(e,t){return assertShapesMatch(e.shape,t.shape,"Error in squaredDifferenceStrict: "),e.squaredDifference(t)},e.atan2=function(t,r){var n=convertToTensor(t,"a","atan2"),a=convertToTensor(r,"b","atan2");assertTypesMatch(n,a);var o=assertAndGetBroadcastShape(n.shape,a.shape);return ENV.engine.runKernel(function(e){return e.atan2(n,a)},{$a:n,$b:a},function(t){return{$a:function(){var r=e.add(n.square(),a.square()),i=t.mul(a.div(r)),s=getReductionAxes(n.shape,o);return s.length>0&&(i=i.sum(s)),i.reshape(n.shape)},$b:function(){var r=e.add(n.square(),a.square()),i=UnaryOps.neg(t.mul(n.div(r))),s=getReductionAxes(a.shape,o);return s.length>0&&(i=i.sum(s)),i.reshape(a.shape)}}})},__decorate([doc({heading:"Operations",subheading:"Arithmetic"}),operation],e,"add",null),__decorate([operation],e,"addStrict",null),__decorate([doc({heading:"Operations",subheading:"Arithmetic"}),operation],e,"sub",null),__decorate([operation],e,"subStrict",null),__decorate([doc({heading:"Operations",subheading:"Arithmetic"}),operation],e,"pow",null),__decorate([operation],e,"powStrict",null),__decorate([doc({heading:"Operations",subheading:"Arithmetic"}),operation],e,"mul",null),__decorate([operation],e,"mulStrict",null),__decorate([doc({heading:"Operations",subheading:"Arithmetic"}),operation],e,"div",null),__decorate([doc({heading:"Operations",subheading:"Arithmetic"}),operation],e,"floorDiv",null),__decorate([operation],e,"divStrict",null),__decorate([doc({heading:"Operations",subheading:"Arithmetic"}),operation],e,"mod",null),__decorate([operation],e,"modStrict",null),__decorate([doc({heading:"Operations",subheading:"Arithmetic"}),operation],e,"minimum",null),__decorate([operation],e,"minimumStrict",null),__decorate([doc({heading:"Operations",subheading:"Arithmetic"}),operation],e,"maximum",null),__decorate([operation],e,"maximumStrict",null),__decorate([doc({heading:"Operations",subheading:"Arithmetic"}),operation],e,"squaredDifference",null),__decorate([operation],e,"squaredDifferenceStrict",null),__decorate([doc({heading:"Operations",subheading:"Basic math"}),operation],e,"atan2",null),e}(),CompareOps=function(){function e(){}return e.notEqual=function(e,t){var r=convertToTensor(e,"a","notEqual"),n=convertToTensor(t,"b","notEqual");return assertTypesMatch(r,n),assertAndGetBroadcastShape(r.shape,n.shape),ENV.engine.runKernel(function(e){return e.notEqual(r,n)},{$a:r,$b:n})},e.notEqualStrict=function(e,t){var r=convertToTensor(e,"a","notEqualStrict"),n=convertToTensor(t,"b","notEqualStrict");return assertShapesMatch(r.shape,n.shape,"Error in notEqualStrict: "),r.notEqual(n)},e.less=function(e,t){var r=convertToTensor(e,"a","less"),n=convertToTensor(t,"b","less");return assertTypesMatch(r,n),assertAndGetBroadcastShape(r.shape,n.shape),ENV.engine.runKernel(function(e){return e.less(r,n)},{$a:r,$b:n})},e.lessStrict=function(e,t){var r=convertToTensor(e,"a","lessStrict"),n=convertToTensor(t,"b","lessStrict");return assertShapesMatch(r.shape,n.shape,"Error in lessStrict: "),r.less(n)},e.equal=function(e,t){var r=convertToTensor(e,"a","equal"),n=convertToTensor(t,"b","equal");return assertTypesMatch(r,n),assertAndGetBroadcastShape(r.shape,n.shape),ENV.engine.runKernel(function(e){return e.equal(r,n)},{$a:r,$b:n})},e.equalStrict=function(e,t){var r=convertToTensor(e,"a","equalStrict"),n=convertToTensor(t,"b","equalStrict");return assertShapesMatch(r.shape,n.shape,"Error in equalStrict: "),r.equal(n)},e.lessEqual=function(e,t){var r=convertToTensor(e,"a","lessEqual"),n=convertToTensor(t,"b","lessEqual");return assertTypesMatch(r,n),assertAndGetBroadcastShape(r.shape,n.shape),ENV.engine.runKernel(function(e){return e.lessEqual(r,n)},{$a:r,$b:n})},e.lessEqualStrict=function(e,t){var r=convertToTensor(e,"a","lessEqualStrict"),n=convertToTensor(t,"b","lessEqualStrict");return assertShapesMatch(r.shape,n.shape,"Error in lessEqualStrict: "),r.lessEqual(n)},e.greater=function(e,t){var r=convertToTensor(e,"a","greater"),n=convertToTensor(t,"b","greater");return assertTypesMatch(r,n),assertAndGetBroadcastShape(r.shape,n.shape),ENV.engine.runKernel(function(e){return e.greater(r,n)},{$a:r,$b:n})},e.greaterStrict=function(e,t){var r=convertToTensor(e,"a","greaterStrict"),n=convertToTensor(t,"b","greaterStrict");return assertShapesMatch(r.shape,n.shape,"Error in greaterStrict: "),r.greater(n)},e.greaterEqual=function(e,t){var r=convertToTensor(e,"a","greaterEqual"),n=convertToTensor(t,"b","greaterEqual");return assertTypesMatch(r,n),assertAndGetBroadcastShape(r.shape,n.shape),ENV.engine.runKernel(function(e){return e.greaterEqual(r,n)},{$a:r,$b:n})},e.greaterEqualStrict=function(e,t){var r=convertToTensor(e,"a","greaterEqualStrict"),n=convertToTensor(t,"b","greaterEqualStrict");return assertShapesMatch(r.shape,n.shape,"Error in greaterEqualStrict: "),r.greaterEqual(n)},__decorate([doc({heading:"Operations",subheading:"Logical"}),operation],e,"notEqual",null),__decorate([operation],e,"notEqualStrict",null),__decorate([doc({heading:"Operations",subheading:"Logical"}),operation],e,"less",null),__decorate([operation],e,"lessStrict",null),__decorate([doc({heading:"Operations",subheading:"Logical"}),operation],e,"equal",null),__decorate([operation],e,"equalStrict",null),__decorate([doc({heading:"Operations",subheading:"Logical"}),operation],e,"lessEqual",null),__decorate([operation],e,"lessEqualStrict",null),__decorate([doc({heading:"Operations",subheading:"Logical"}),operation],e,"greater",null),__decorate([operation],e,"greaterStrict",null),__decorate([doc({heading:"Operations",subheading:"Logical"}),operation],e,"greaterEqual",null),__decorate([operation],e,"greaterEqualStrict",null),e}();function computePool2DInfo(e,t,r,n,a,o){void 0===o&&(o="channelsLast");var i,s=parseTupleParam(t),u=s[0],l=s[1];if("channelsLast"===o)i=[u,l,e[3],e[3]];else{if("channelsFirst"!==o)throw new Error("Unknown dataFormat "+o);i=[u,l,e[1],e[1]]}return computeConv2DInfo(e,i,r,1,n,a,!1,o)}function computeConv2DInfo(e,t,r,n,a,o,i,s){void 0===i&&(i=!1),void 0===s&&(s="channelsLast");var u=[-1,-1,-1,-1],l=u[0],c=u[1],p=u[2],d=u[3];if("channelsLast"===s)l=e[0],c=e[1],p=e[2],d=e[3];else{if("channelsFirst"!==s)throw new Error("Unknown dataFormat "+s);l=e[0],d=e[1],c=e[2],p=e[3]}var h,f=t[0],m=t[1],g=t[3],y=parseTupleParam(r),v=y[0],b=y[1],x=parseTupleParam(n),w=x[0],S=x[1],T=getPadAndOutInfo(a,c,p,v,b,getEffectiveFilterSize(f,w),getEffectiveFilterSize(m,S),o),N=T.padInfo,E=T.outHeight,_=T.outWidth,A=i?g*d:g;return"channelsFirst"===s?h=[l,A,E,_]:"channelsLast"===s&&(h=[l,E,_,A]),{batchSize:l,dataFormat:s,inHeight:c,inWidth:p,inChannels:d,outHeight:E,outWidth:_,outChannels:A,padInfo:N,strideHeight:v,strideWidth:b,filterHeight:f,filterWidth:m,dilationHeight:w,dilationWidth:S,inShape:e,outShape:h,filterShape:t}}function computeOutputShape3D(e,t,r,n,a,o){null==a&&(a=computeDefaultPad(e,t,n));var i=e[0],s=e[1],u=conditionalRound((i-t+2*a)/n+1,o);assert(isInt(u),"The output # of rows ("+u+") must be an integer. Change the stride and/or zero pad parameters");var l=conditionalRound((s-t+2*a)/n+1,o);return assert(isInt(l),"The output # of columns ("+l+") must be an integer. Change the stride and/or zero pad parameters"),[u,l,r]}function computeDefaultPad(e,t,r,n){void 0===n&&(n=1);var a=getEffectiveFilterSize(t,n);return Math.floor((e[0]*(r-1)-r+a)/2)}function parseTupleParam(e){return"number"==typeof e?[e,e]:e}function getEffectiveFilterSize(e,t){return t<=1?e:e+(e-1)*(t-1)}function getPadAndOutInfo(e,t,r,n,a,o,i,s){var u,l,c;if("number"==typeof e){u={top:e,bottom:e,left:e,right:e,type:0===e?"VALID":"NUMBER"};var p=computeOutputShape3D([t,r,1],o,1,n,e,s);l=p[0],c=p[1]}else if("same"===e){var d=((l=Math.ceil(t/n))-1)*n+o-t,h=((c=Math.ceil(r/a))-1)*a+i-r,f=Math.floor(d/2),m=d-f,g=Math.floor(h/2);u={top:f,bottom:m,left:g,right:h-g,type:"SAME"}}else{if("valid"!==e)throw Error("Unknown padding parameter: "+e);u={top:0,bottom:0,left:0,right:0,type:"VALID"},l=Math.ceil((t-o+1)/n),c=Math.ceil((r-i+1)/a)}return{padInfo:u,outHeight:l,outWidth:c}}function conditionalRound(e,t){if(!t)return 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)}}var ConvOps=function(){function e(){}return e.conv1d=function(t,r,n,a,o,i,s){void 0===o&&(o="NWC"),void 0===i&&(i=1);var u=convertToTensor(t,"x","conv1d"),l=convertToTensor(r,"filter","conv1d"),c=u,p=!1;2===u.rank&&(p=!0,c=u.as3D(1,u.shape[0],u.shape[1])),assert(3===c.rank,"Error in conv1d: input must be rank 3, but got rank "+c.rank+"."),assert(3===l.rank,"Error in conv1d: filter must be rank 3, but got rank "+l.rank+"."),null!=s&&assert(isInt(a),"Error in conv1d: pad must be an integer when using, dimRoundingMode "+s+" but got pad "+a+"."),assert(c.shape[2]===l.shape[1],"Error in conv1d: depth of input ("+c.shape[2]+") must match input depth for filter "+l.shape[1]+"."),assert(eitherStridesOrDilationsAreOne(n,i),"Error in conv1D: Either stride or dilation must be 1. Got stride "+n+" and dilation '"+i+"'"),assert("NWC"===o,"Error in conv1d: got dataFormat of "+o+" but only NWC is currently supported.");var d=l.as4D(1,l.shape[0],l.shape[1],l.shape[2]),h=c.as4D(c.shape[0],1,c.shape[1],c.shape[2]),f=[1,n],m=[1,i],g=e.conv2d(h,d,f,a,"NHWC",m,s);return p?g.as2D(g.shape[2],g.shape[3]):g.as3D(g.shape[0],g.shape[2],g.shape[3])},e.conv2d=function(t,r,n,a,o,i,s){void 0===o&&(o="NHWC"),void 0===i&&(i=[1,1]);var u=convertToTensor(t,"x","conv2d"),l=convertToTensor(r,"filter","conv2d"),c=u,p=!1;3===u.rank&&(p=!0,c=u.as4D(1,u.shape[0],u.shape[1],u.shape[2])),assert(4===c.rank,"Error in conv2d: input must be rank 4, but got rank "+c.rank+"."),assert(4===l.rank,"Error in conv2d: filter must be rank 4, but got rank "+l.rank+"."),null!=s&&assert(isInt(a),"Error in conv2d: pad must be an integer when using, dimRoundingMode "+s+" but got pad "+a+"."),assert(c.shape[3]===l.shape[2],"Error in conv2d: depth of input ("+c.shape[3]+") must match input depth for filter "+l.shape[2]+"."),assert(eitherStridesOrDilationsAreOne(n,i),"Error in conv2D: Either strides or dilations must be 1. Got strides "+n+" and dilations '"+i+"'"),assert("NHWC"===o,"Error in conv2d: got dataFormat of "+o+" but only NHWC is currently supported.");var d=computeConv2DInfo(c.shape,l.shape,n,i,a,s),h=ENV.engine.runKernel(function(e){return e.conv2d(c,l,d)},{x:c,$filter:l},function(t){return assert(tupleValuesAreOne(i),"Error in gradient of conv2D: dilation rates greater than 1 are notyet supported in gradients. Got dilations '"+i+"'"),{x:function(){return e.conv2dDerInput(c.shape,t,l,n,a)},$filter:function(){return e.conv2dDerFilter(c,t,l.shape,n,a)}}});return p?h.as3D(h.shape[1],h.shape[2],h.shape[3]):h},e.conv2dDerInput=function(e,t,r,n,a,o){assert(e.length===t.rank,"Length of inShape ("+e.length+") and rank of dy ("+t.rank+") must match");var i=e,s=t,u=!1;3===t.rank&&(u=!0,s=t.as4D(1,t.shape[0],t.shape[1],t.shape[2]),i=[1,e[0],e[1],e[2]]);var l=i[3],c=s.shape[3];assert(4===i.length,"Error in conv2dDerInput: inShape must be length 4, but got length "+i.length+"."),assert(4===s.rank,"Error in conv2dDerInput: dy must be rank 4, but got rank "+s.rank),assert(4===r.rank,"Error in conv2dDerInput: filter must be rank 4, but got rank "+r.rank),assert(l===r.shape[2],"Error in conv2dDerInput: depth of input ("+l+") must match input depth for filter "+r.shape[2]+"."),assert(c===r.shape[3],"Error in conv2dDerInput: depth of output ("+c+") must match output depth for filter "+r.shape[3]+"."),null!=o&&assert(isInt(a),"Error in conv2dDerInput: pad must be an integer when using, dimRoundingMode "+o+" but got pad "+a+".");var p=computeConv2DInfo(i,r.shape,n,1,a,o),d=ENV.engine.runKernel(function(e){return e.conv2dDerInput(s,r,p)},{dy4D:s});return u?d.as3D(d.shape[1],d.shape[2],d.shape[3]):d},e.conv2dDerFilter=function(e,t,r,n,a,o){var i=e;3===e.rank&&(i=e.as4D(1,e.shape[0],e.shape[1],e.shape[2]));var s=t;3===s.rank&&(s=t.as4D(1,t.shape[0],t.shape[1],t.shape[2])),assert(4===i.rank,"Error in conv2dDerFilter: input must be rank 4, but got shape "+i.shape+"."),assert(4===s.rank,"Error in conv2dDerFilter: dy must be rank 4, but got shape "+s.shape+"."),assert(4===r.length,"Error in conv2dDerFilter: filterShape must be length 4, but got "+r+"."),assert(i.shape[3]===r[2],"Error in conv2dDerFilter: depth of input "+i.shape[3]+") must match input depth in filter ("+r[2]+"."),assert(s.shape[3]===r[3],"Error in conv2dDerFilter: depth of dy ("+s.shape[3]+") must match output depth for filter ("+r[3]+")."),null!=o&&assert(isInt(a),"Error in conv2dDerFilter: pad must be an integer when using, dimRoundingMode "+o+" but got pad "+a+".");var u=computeConv2DInfo(i.shape,r,n,1,a,o);return ENV.engine.runKernel(function(e){return e.conv2dDerFilter(i,s,u)},{x4D:i,dy4D:s})},e.conv2dTranspose=function(t,r,n,a,o,i){var s=convertToTensor(t,"x","conv2dTranspose"),u=convertToTensor(r,"filter","conv2dTranspose");return e.conv2dDerInput(n,s,u,a,o,i)},e.depthwiseConv2d=function(e,t,r,n,a,o,i){void 0===a&&(a="NHWC"),void 0===o&&(o=[1,1]);var s=convertToTensor(e,"x","depthwiseConv2d"),u=convertToTensor(t,"filter","depthwiseConv2d"),l=s,c=!1;3===s.rank&&(c=!0,l=s.as4D(1,s.shape[0],s.shape[1],s.shape[2])),assert(4===l.rank,"Error in depthwiseConv2d: input must be rank 4, but got rank "+l.rank+"."),assert(4===u.rank,"Error in depthwiseConv2d: filter must be rank 4, but got rank "+u.rank+"."),assert(l.shape[3]===u.shape[2],"Error in depthwiseConv2d: number of input channels ("+l.shape[3]+") must match the inChannels dimension in filter "+u.shape[2]+"."),null==o&&(o=[1,1]),assert(eitherStridesOrDilationsAreOne(r,o),"Error in depthwiseConv2d: Either strides or dilations must be 1. Got strides "+r+" and dilations '"+o+"'"),null!=i&&assert(isInt(n),"Error in depthwiseConv2d: pad must be an integer when using, dimRoundingMode "+i+" but got pad "+n+".");var p=computeConv2DInfo(l.shape,u.shape,r,o,n,i,!0),d=ENV.engine.runKernel(function(e){return e.depthwiseConv2D(l,u,p)},{x:l,$filter:u},function(e){return assert(tupleValuesAreOne(o),"Error in gradient of depthwiseConv2d: dilation rates greater than 1 are not yet supported. Got dilations '"+o+"'"),{x:function(){return depthwiseConv2dDerInput(l.shape,e,u,p)},$filter:function(){return depthwiseConv2dDerFilter(l,e,u.shape,p)}}});return c?d.as3D(d.shape[1],d.shape[2],d.shape[3]):d},e.separableConv2d=function(t,r,n,a,o,i,s){void 0===i&&(i=[1,1]),void 0===s&&(s="NHWC");var u=convertToTensor(t,"x","separableConv2d"),l=convertToTensor(r,"depthwiseFilter","separableConv2d"),c=convertToTensor(n,"pointwiseFilter","separableConv2d"),p=u,d=!1;if(3===u.rank&&(d=!0,p=u.as4D(1,u.shape[0],u.shape[1],u.shape[2])),"NCHW"===s)throw new Error("separableConv2d currently does not support dataFormat NCHW; only NHWC is supported");assert(4===p.rank,"Error in separableConv2d: input must be rank 4, but got rank "+p.rank+"."),assert(4===l.rank,"Error in separableConv2d: depthwise filter must be rank 4, but got rank "+l.rank+"."),assert(4===c.rank,"Error in separableConv2d: pointwise filter must be rank 4, but got rank "+l.rank+"."),assert(1===c.shape[0],"Error in separableConv2d: the first dimension of pointwise filter must be 1, but got "+c.shape[0]+"."),assert(1===c.shape[1],"Error in separableConv2d: the second dimension of pointwise filter must be 1, but got "+c.shape[1]+".");var h=l.shape[2],f=l.shape[3];assert(c.shape[2]===h*f,"Error in separableConv2d: the third dimension of pointwise filter must be "+h*f+", but got "+c.shape[2]+".");var m=e.depthwiseConv2d(p,l,a,o,s,i),g=e.conv2d(m,c,1,"valid",s);return d?g.as3D(g.shape[1],g.shape[2],g.shape[3]):g},__decorate([doc({heading:"Operations",subheading:"Convolution"}),operation],e,"conv1d",null),__decorate([doc({heading:"Operations",subheading:"Convolution"}),operation],e,"conv2d",null),__decorate([operation],e,"conv2dDerInput",null),__decorate([operation],e,"conv2dDerFilter",null),__decorate([doc({heading:"Operations",subheading:"Convolution"}),operation],e,"conv2dTranspose",null),__decorate([doc({heading:"Operations",subheading:"Convolution"}),operation],e,"depthwiseConv2d",null),__decorate([doc({heading:"Operations",subheading:"Convolution"}),operation],e,"separableConv2d",null),e}();function parseTupleParam$1(e){return"number"==typeof e?[e,e]:e}function tupleValuesAreOne(e){var t=parseTupleParam$1(e),r=t[0],n=t[1];return 1===r&&1===n}function eitherStridesOrDilationsAreOne(e,t){return tupleValuesAreOne(e)||tupleValuesAreOne(t)}function depthwiseConv2dDerInput(e,t,r,n){var a=t,o=!1;3===t.rank&&(o=!0,a=t.as4D(1,t.shape[0],t.shape[1],t.shape[2]));var i=ENV.engine.runKernel(function(e){return e.depthwiseConv2DDerInput(a,r,n)},{dy4D:a});return o?i.as3D(i.shape[1],i.shape[2],i.shape[3]):i}function depthwiseConv2dDerFilter(e,t,r,n){var a=e;3===e.rank&&(a=e.as4D(1,e.shape[0],e.shape[1],e.shape[2]));var o=t;return 3===o.rank&&(o=t.as4D(1,t.shape[0],t.shape[1],t.shape[2])),ENV.engine.runKernel(function(e){return e.depthwiseConv2DDerFilter(a,o,n)},{x4D:a,dy4D:o})}var ImageOps=function(){function e(){}return e.resizeBilinear=function(e,t,r){void 0===r&&(r=!1);var n=convertToTensor(e,"images","resizeBilinear");assert(3===n.rank||4===n.rank,"Error in resizeBilinear: x must be rank 3 or 4, but got rank "+n.rank+"."),assert(2===t.length,"Error in resizeBilinear: new shape must 2D, but got shape "+t+".");var a=n,o=!1;3===n.rank&&(o=!0,a=n.as4D(1,n.shape[0],n.shape[1],n.shape[2]));var i=t[0],s=t[1],u=ENV.engine.runKernel(function(e,t){return e.resizeBilinear(a,i,s,r)},{batchImages:a},function(e,t){return{batchImages:function(){return ENV.engine.runKernel(function(t){return t.resizeBilinearBackprop(e,a,r)},{})}}});return o?u.as3D(u.shape[1],u.shape[2],u.shape[3]):u},e.resizeNearestNeighbor=function(e,t,r){void 0===r&&(r=!1);var n=convertToTensor(e,"images","resizeNearestNeighbor");assert(3===n.rank||4===n.rank,"Error in resizeNearestNeighbor: x must be rank 3 or 4, but got rank "+n.rank+"."),assert(2===t.length,"Error in resizeNearestNeighbor: new shape must 2D, but got shape "+t+"."),assert("float32"===n.dtype||"int32"===n.dtype,"`images` must have `int32` or `float32` as dtype");var a=n,o=!1;3===n.rank&&(o=!0,a=n.as4D(1,n.shape[0],n.shape[1],n.shape[2]));var i=t[0],s=t[1],u=ENV.engine.runKernel(function(e,t){return e.resizeNearestNeighbor(a,i,s,r)},{batchImages:a},function(e,t){return{batchImages:function(){return ENV.engine.runKernel(function(t){return t.resizeNearestNeighborBackprop(e,a,r)},{})}}});return o?u.as3D(u.shape[1],u.shape[2],u.shape[3]):u},__decorate([doc({heading:"Operations",subheading:"Images",namespace:"image"}),operation],e,"resizeBilinear",null),__decorate([doc({heading:"Operations",subheading:"Images",namespace:"image"}),operation],e,"resizeNearestNeighbor",null),e}(),Gradients=function(){function e(){}return e.gradScope=function(e,t){return ENV.engine.tidy(e,t,!0)},e.grad=function(e){return assert(isFunction(e),"The f passed in grad(f) must be a function"),function(t,r){return assert(t instanceof Tensor,"The x passed in grad(f)(x) must be a tensor"),assert(null==r||r instanceof Tensor,"The dy passed in grad(f)(x, dy) must be a tensor"),ENV.engine.tidy(function(){var n=ENV.engine.gradients(function(){return e(t)},[t],r),a=n.value,o=n.grads;return null!=r&&assertShapesMatch(a.shape,r.shape,"The shape of dy passed in grad(f)(x, dy) must match the shape returned by f(x)"),checkGrads(o),o[0]})}},e.grads=function(e){return assert(isFunction(e),"The f passed in grads(f) must be a function"),function(t,r){return assert(Array.isArray(t)&&t.every(function(e){return e instanceof Tensor}),"The args passed in grads(f)(args) must be an array of tensors"),assert(null==r||r instanceof Tensor,"The dy passed in grads(f)(args, dy) must be a tensor"),ENV.engine.tidy(function(){var n=ENV.engine.gradients(function(){return e.apply(void 0,t)},t,r),a=n.value,o=n.grads;return null!=r&&assertShapesMatch(a.shape,r.shape,"The shape of dy passed in grads(f)([x1,...], dy) must match the shape returned by f([x1,...])"),checkGrads(o),o})}},e.valueAndGrad=function(e){return assert(isFunction(e),"The f passed in valueAndGrad(f) must be a function"),function(t,r){assert(t instanceof Tensor,"The x passed in valueAndGrad(f)(x) must be a tensor"),assert(null==r||r instanceof Tensor,"The dy passed in valueAndGrad(f)(x, dy) must be a tensor");var n=ENV.engine.gradients(function(){return e(t)},[t],r),a=n.grads,o=n.value;return checkGrads(a),{grad:a[0],value:o}}},e.valueAndGrads=function(e){return assert(isFunction(e),"The f passed in valueAndGrads(f) must be a function"),function(t,r){assert(Array.isArray(t)&&t.every(function(e){return e instanceof Tensor}),"The args passed in valueAndGrads(f)(args) must be array of tensors"),assert(null==r||r instanceof Tensor,"The dy passed in valueAndGrads(f)(args, dy) must be a tensor");var n=ENV.engine.gradients(function(){return e.apply(void 0,t)},t,r);return null!=r&&assertShapesMatch(n.value.shape,r.shape,"The shape of dy passed in valueAndGrads(f)([x1,...], dy) must match the shape returned by f([x1,...])"),checkGrads(n.grads),n}},e.variableGrads=function(e,t){if(assert(isFunction(e),"The f passed in variableGrads(f) must be a function"),assert(null==t||Array.isArray(t)&&t.every(function(e){return e instanceof Variable}),"The varList passed in variableGrads(f, varList) must be an array of variables"),null==t)for(var r in t=[],ENV.engine.registeredVariables)t.push(ENV.engine.registeredVariables[r]);var n=t.length;assert((t=t.filter(function(e){return e.trainable})).length>0,"variableGrads() expects at least one of the input variables to be trainable, but none of the "+n+" variables is trainable.");var a=ENV.engine.gradients(e,t,null,!0),o=a.value,i=a.grads;assert(i.some(function(e){return null!=e}),"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()."),assert(0===o.rank,"The f passed in variableGrads(f) must return a scalar, but it returned a rank-"+o.rank+" tensor");var s={};return t.forEach(function(e,t){null!=i[t]&&(s[e.name]=i[t])}),{value:o,grads:s}},e.customGrad=function(e){return ENV.engine.customGrad(e)},__decorate([doc({heading:"Training",subheading:"Gradients"})],e,"grad",null),__decorate([doc({heading:"Training",subheading:"Gradients"})],e,"grads",null),__decorate([doc({heading:"Training",subheading:"Gradients"})],e,"valueAndGrad",null),__decorate([doc({heading:"Training",subheading:"Gradients"})],e,"valueAndGrads",null),__decorate([doc({heading:"Training",subheading:"Gradients"})],e,"variableGrads",null),__decorate([doc({heading:"Training",subheading:"Gradients"})],e,"customGrad",null),e}();function checkGrads(e){if(e.filter(function(e){return null==e}).length>0)throw new Error("Cannot compute gradient of y=f(x) with respect to x. Make sure that\n the f you passed encloses all operations that lead from x to y.")}var tidy=Environment.tidy,keep=Environment.keep,dispose=Environment.dispose,time=Environment.time,grad=Gradients.grad,valueAndGrad=Gradients.valueAndGrad,grads=Gradients.grads,valueAndGrads=Gradients.valueAndGrads,variableGrads=Gradients.variableGrads,customGrad=Gradients.customGrad,NormOps=function(){function e(){}return e.norm=function(e,t,r,n){void 0===t&&(t="euclidean"),void 0===r&&(r=null),void 0===n&&(n=!1);var a=normImpl(e=convertToTensor(e,"x","norm"),t,r),o=a.shape;if(n){var i=parseAxisParam(r,e.shape);o=expandShapeToKeepDim(a.shape,i)}return a.reshape(o)},__decorate([doc({heading:"Operations",subheading:"Matrices"}),operation],e,"norm",null),e}();function normImpl(e,t,r){if(void 0===r&&(r=null),0===e.rank)return e.abs();if(1!==e.rank&&null===r)return normImpl(e.reshape([-1]),t,r);if(1===e.rank||"number"==typeof r||r instanceof Array&&1===r.length){if(1===t)return e.abs().sum(r);if(t===1/0)return e.abs().max(r);if(t===-1/0)return e.abs().min(r);if("euclidean"===t||2===t)return e.abs().pow(TensorOps.scalar(2,"int32")).sum(r).sqrt();throw new Error("Error in norm: invalid ord value: "+t)}if(r instanceof Array&&2===r.length){if(1===t)return e.abs().sum(r[0]).max(r[1]-1);if(t===1/0)return e.abs().sum(r[1]).max(r[0]);if(t===-1/0)return e.abs().sum(r[1]).min(r[0]);if("fro"===t||"euclidean"===t)return e.square().sum(r).sqrt();throw new Error("Error in norm: invalid ord value: "+t)}throw new Error("Error in norm: invalid axis: "+r)}var ReductionOps=function(){function e(){}return e.logSumExp=function(e,t,r){void 0===t&&(t=null),void 0===r&&(r=!1);var n=convertToTensor(e,"x","logSumExp"),a=parseAxisParam(t,n.shape),o=n.max(a,!0),i=n.sub(o).exp().sum(a).log(),s=o.reshape(i.shape).add(i);if(r){var u=expandShapeToKeepDim(s.shape,a);return s.reshape(u)}return s},e.sum=function(e,t,r){void 0===t&&(t=null),void 0===r&&(r=!1);var n=convertToTensor(e,"x","sum");"bool"===n.dtype&&(n=n.toInt());var a=parseAxisParam(t,n.shape);return customGrad(function(e){var t=getAxesPermutation(a,e.rank),n=a,o=e;null!=t&&(o=e.transpose(t),n=getInnerMostAxes(n.length,e.rank));var i=ENV.engine.runKernel(function(e){return e.sum(o,n)},{permutedX:o});if(r){var s=expandShapeToKeepDim(i.shape,a);i=i.reshape(s)}return{value:i,gradFunc:function(t){var r=e.shape.slice();return a.forEach(function(e){r[e]=1}),t.reshape(r).mul(TensorOps.ones(e.shape,"float32"))}}})(n)},e.mean=function(e,t,r){void 0===t&&(t=null),void 0===r&&(r=!1);var n=convertToTensor(e,"x","mean"),a=parseAxisParam(t,n.shape),o=sizeFromShape(computeOutAndReduceShapes(n.shape,a)[1]);return customGrad(function(e){var n=TensorOps.scalar(o);return{value:(n.dtype===e.dtype?e:e.cast(n.dtype)).div(n).sum(t,r),gradFunc:function(t){var r=e.shape.slice();return a.forEach(function(e){r[e]=1}),t.reshape(r).mul(TensorOps.ones(e.shape,"float32")).div(n)}}})(n)},e.min=function(e,t,r){void 0===t&&(t=null),void 0===r&&(r=!1);var n=convertToTensor(e,"x","min"),a=parseAxisParam(t,n.shape),o=a,i=getAxesPermutation(o,n.rank);null!=i&&(n=n.transpose(i),o=getInnerMostAxes(o.length,n.rank));var s=ENV.engine.runKernel(function(e){return e.min(n,o)},{$x:n});if(r){var u=expandShapeToKeepDim(s.shape,a);return s.reshape(u)}return s},e.max=function(e,t,r){void 0===t&&(t=null),void 0===r&&(r=!1);var n=convertToTensor(e,"x","max"),a=parseAxisParam(t,n.shape),o=a,i=getAxesPermutation(o,n.rank);null!=i&&(n=n.transpose(i),o=getInnerMostAxes(o.length,n.rank));var s=ENV.engine.runKernel(function(e){return e.max(n,o)},{$x:n});if(r){var u=expandShapeToKeepDim(s.shape,a);return s.reshape(u)}return s},e.argMin=function(e,t){void 0===t&&(t=0);var r=convertToTensor(e,"x","argMin");null==t&&(t=0);var n=parseAxisParam(t,r.shape),a=getAxesPermutation(n,r.rank);return null!=a&&(r=r.transpose(a),n=getInnerMostAxes(n.length,r.rank)),ENV.engine.runKernel(function(e){return e.argMin(r,n[0])},{$x:r})},e.argMax=function(e,t){void 0===t&&(t=0);var r=convertToTensor(e,"x","argMax");null==t&&(t=0);var n=parseAxisParam(t,r.shape),a=getAxesPermutation(n,r.rank);return null!=a&&(r=r.transpose(a),n=getInnerMostAxes(n.length,r.rank)),ENV.engine.runKernel(function(e){return e.argMax(r,n[0])},{$x:r})},e.all=function(e,t,r){void 0===t&&(t=null),void 0===r&&(r=!1);var n=convertToTensor(e,"x","all","bool");assert("bool"===n.dtype,"Error Tensor must be of type bool. Got: "+n.dtype);var a=parseAxisParam(t,n.shape),o=a,i=getAxesPermutation(o,n.rank);null!=i&&(n=n.transpose(i),o=getInnerMostAxes(o.length,n.rank));var s=ENV.engine.runKernel(function(e){return e.all(n,o)},{$x:n});if(r){var u=expandShapeToKeepDim(s.shape,a);return s.reshape(u)}return s},e.any=function(e,t,r){void 0===t&&(t=null),void 0===r&&(r=!1);var n=convertToTensor(e,"x","any","bool");assert("bool"===n.dtype,"Error Tensor must be of type bool. Got: "+n.dtype);var a=parseAxisParam(t,n.shape),o=a,i=getAxesPermutation(o,n.rank);null!=i&&(n=n.transpose(i),o=getInnerMostAxes(o.length,n.rank));var s=ENV.engine.runKernel(function(e){return e.any(n,o)},{$x:n});if(r){var u=expandShapeToKeepDim(s.shape,a);return s.reshape(u)}return s},e.moments=function(e,t,r){void 0===t&&(t=null),void 0===r&&(r=!1);var n=parseAxisParam(t,(e=convertToTensor(e,"x","moments")).shape),a=e.mean(n,r),o=a.shape;return r||(o=expandShapeToKeepDim(a.shape,n)),{mean:a,variance:e.toFloat().sub(a.reshape(o)).square().mean(n,r)}},__decorate([doc({heading:"Operations",subheading:"Reduction"}),operation],e,"logSumExp",null),__decorate([doc({heading:"Operations",subheading:"Reduction"}),operation],e,"sum",null),__decorate([doc({heading:"Operations",subheading:"Reduction"}),operation],e,"mean",null),__decorate([doc({heading:"Operations",subheading:"Reduction"}),operation],e,"min",null),__decorate([doc({heading:"Operations",subheading:"Reduction"}),operation],e,"max",null),__decorate([doc({heading:"Operations",subheading:"Reduction"}),operation],e,"argMin",null),__decorate([doc({heading:"Operations",subheading:"Reduction"}),operation],e,"argMax",null),__decorate([doc({heading:"Operations",subheading:"Reduction"}),operation],e,"all",null),__decorate([doc({heading:"Operations",subheading:"Reduction"}),operation],e,"any",null),__decorate([doc({heading:"Operations",subheading:"Normalization"}),operation],e,"moments",null),e}(),LinalgOps=function(){function e(){}return e.gramSchmidt=function(e){var t;if(Array.isArray(e)){t=!1,assert(null!=e&&e.length>0,"Gram-Schmidt process: input must not be null, undefined, or empty");for(var r=e[0].shape[0],n=1;n0)for(var r=0;r= 2, but got rank "+e.rank);if(2===e.rank)return qr2d(e,t);var r=e.shape.slice(0,e.shape.length-2).reduce(function(e,t){return e*t}),n=[],a=[];return ArrayOps.unstack(e.reshape([r,e.shape[e.shape.length-2],e.shape[e.shape.length-1]]),0).forEach(function(e){var r=qr2d(e,t),o=r[0],i=r[1];n.push(o),a.push(i)}),[ArrayOps.stack(n,0).reshape(e.shape),ArrayOps.stack(a,0).reshape(e.shape)]},__decorate([doc({heading:"Operations",subheading:"Linear Algebra"}),operation],e,"gramSchmidt",null),__decorate([doc({heading:"Operations",subheading:"Linear Algebra"}),operation],e,"qr",null),e}();function qr2d(e,t){return void 0===t&&(t=!1),ENV.engine.tidy(function(){if(2!==e.shape.length)throw new Error("qr2d() requires a 2D Tensor, but got a "+e.shape.length+"D Tensor.");for(var r=e.shape[0],n=e.shape[1],a=ArrayOps.eye(r),o=e.clone(),i=TensorOps.tensor2d([[1]],[1,1]),s=i.clone(),u=r>=n?n:r,l=function(e){var t,u=o,l=s,c=a;t=ENV.engine.tidy(function(){var t=o.slice([e,e],[r-e,1]),u=t.norm(),l=o.slice([e,e],[1,1]),c=l.sign().neg(),p=l.sub(c.mul(u)),d=t.div(p);s=1===d.shape[0]?i.clone():i.concat(d.slice([1,0],[d.shape[0]-1,d.shape[1]]),0);var h=c.matMul(p).div(u).neg(),f=o.slice([e,0],[r-e,n]),m=h.mul(s);o=0===e?f.sub(m.matMul(s.transpose().matMul(f))):o.slice([0,0],[e,n]).concat(f.sub(m.matMul(s.transpose().matMul(f))),0);var g=a.slice([0,e],[r,a.shape[1]-e]);return a=0===e?g.sub(g.matMul(s).matMul(m.transpose())):a.slice([0,0],[r,e]).concat(g.sub(g.matMul(s).matMul(m.transpose())),1),[s,o,a]}),s=t[0],o=t[1],a=t[2],dispose([u,l,c])},c=0;cn&&(a=a.slice([0,0],[r,n]),o=o.slice([0,0],[n,n])),[a,o]})}var LogicalOps=function(){function e(){}return e.logicalNot=function(e){var t=convertToTensor(e,"x","logicalNot","bool");return assert("bool"===t.dtype,"Error Array must be of type bool."),ENV.engine.runKernel(function(e){return e.logicalNot(t)},{$x:t})},e.logicalAnd=function(e,t){var r=convertToTensor(e,"a","logicalAnd","bool"),n=convertToTensor(t,"b","logicalAnd","bool");return assert("bool"===r.dtype&&"bool"===n.dtype,"Error Array must be of type bool."),assertAndGetBroadcastShape(r.shape,n.shape),ENV.engine.runKernel(function(e){return e.logicalAnd(r,n)},{$a:r,$b:n})},e.logicalOr=function(e,t){var r=convertToTensor(e,"a","logicalOr","bool"),n=convertToTensor(t,"b","logicalOr","bool");return assert("bool"===r.dtype&&"bool"===n.dtype,"Error Array must be of type bool."),assertAndGetBroadcastShape(r.shape,n.shape),ENV.engine.runKernel(function(e){return e.logicalOr(r,n)},{$a:r,$b:n})},e.logicalXor=function(t,r){var n=convertToTensor(t,"a","logicalXor","bool"),a=convertToTensor(r,"b","logicalXor","bool");return assert("bool"===n.dtype&&"bool"===a.dtype,"Error Array must be of type bool."),assertAndGetBroadcastShape(n.shape,a.shape),e.logicalOr(t,r).logicalAnd(e.logicalAnd(t,r).logicalNot())},e.where=function(e,t,r){var n=convertToTensor(t,"a","where"),a=convertToTensor(r,"b","where"),o=convertToTensor(e,"condition","where","bool");assert("bool"===o.dtype,"Error Condition must be of type bool."),assertShapesMatch(n.shape,a.shape,"Error in where: "),1===o.rank?assert(o.shape[0]===n.shape[0],"The first dimension of `a` must match the size of `condition`."):assertShapesMatch(o.shape,a.shape,"Error in where: ");var i=upcastType(n.dtype,a.dtype);return ENV.engine.runKernel(function(e){return e.where(o,n,a,i)},{$condition:o,$a:n,$b:a},function(e){return{$condition:function(){return TensorOps.zerosLike(o)},$a:function(){return e.mul(o.cast(n.dtype))},$b:function(){return e.mul(o.logicalNot().cast(a.dtype))}}})},__decorate([doc({heading:"Operations",subheading:"Logical"}),operation],e,"logicalNot",null),__decorate([doc({heading:"Operations",subheading:"Logical"}),operation],e,"logicalAnd",null),__decorate([doc({heading:"Operations",subheading:"Logical"}),operation],e,"logicalOr",null),__decorate([doc({heading:"Operations",subheading:"Logical"}),operation],e,"logicalXor",null),__decorate([doc({heading:"Operations",subheading:"Logical"}),operation],e,"where",null),e}();!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"}(exports.Reduction||(exports.Reduction={}));var LossOps=function(){function e(){}return e.computeWeightedLoss=function(e,t,r){void 0===r&&(r=exports.Reduction.SUM_BY_NONZERO_WEIGHTS);var n=convertToTensor(e,"losses","computeWeightedLoss"),a=null;null!=t&&(a=convertToTensor(t,"weights","computeWeightedLoss"));var o=null==a?n:n.mul(a);if(r===exports.Reduction.NONE)return o;if(r===exports.Reduction.SUM)return o.sum();if(r===exports.Reduction.MEAN)return null==a?o.mean():o.sum().div(a.sum());if(r===exports.Reduction.SUM_BY_NONZERO_WEIGHTS){if(null==a)return o.sum().div(TensorOps.scalar(n.size));var i=a.mul(TensorOps.ones(n.shape)).notEqual(TensorOps.scalar(0)).sum().toFloat();return o.sum().div(i)}throw Error("Unknown reduction: "+r)},e.absoluteDifference=function(t,r,n,a){void 0===a&&(a=exports.Reduction.SUM_BY_NONZERO_WEIGHTS);var o=convertToTensor(t,"labels","absoluteDifference"),i=convertToTensor(r,"predictions","absoluteDifference"),s=null;null!=n&&(s=convertToTensor(n,"weights","absoluteDifference")),assertShapesMatch(o.shape,i.shape,"Error in absoluteDifference: ");var u=o.sub(i).abs();return e.computeWeightedLoss(u,s,a)},e.meanSquaredError=function(t,r,n,a){void 0===a&&(a=exports.Reduction.SUM_BY_NONZERO_WEIGHTS);var o=convertToTensor(t,"labels","meanSquaredError"),i=convertToTensor(r,"predictions","meanSquaredError"),s=null;null!=n&&(s=convertToTensor(n,"weights","meanSquaredError")),assertShapesMatch(o.shape,i.shape,"Error in meanSquaredError: ");var u=o.squaredDifference(i);return e.computeWeightedLoss(u,s,a)},e.cosineDistance=function(t,r,n,a,o){void 0===o&&(o=exports.Reduction.SUM_BY_NONZERO_WEIGHTS);var i=convertToTensor(t,"labels","cosineDistance"),s=convertToTensor(r,"predictions","cosineDistance"),u=null;null!=a&&(u=convertToTensor(a,"weights","cosineDistance")),assertShapesMatch(i.shape,s.shape,"Error in cosineDistance: ");var l=TensorOps.scalar(1).sub(i.mul(s).sum(n,!0));return e.computeWeightedLoss(l,u,o)},e.hingeLoss=function(t,r,n,a){void 0===a&&(a=exports.Reduction.SUM_BY_NONZERO_WEIGHTS);var o=convertToTensor(t,"labels","hingeLoss"),i=convertToTensor(r,"predictions","hingeLoss"),s=null;null!=n&&(s=convertToTensor(n,"weights","hingeLoss")),assertShapesMatch(o.shape,i.shape,"Error in hingeLoss: ");var u=TensorOps.scalar(1);o=TensorOps.scalar(2).mul(o).sub(u);var l=u.sub(o.mul(i)).relu();return e.computeWeightedLoss(l,s,a)},e.logLoss=function(t,r,n,a,o){void 0===a&&(a=1e-7),void 0===o&&(o=exports.Reduction.SUM_BY_NONZERO_WEIGHTS);var i=convertToTensor(t,"labels","logLoss"),s=convertToTensor(r,"predictions","logLoss"),u=null;null!=n&&(u=convertToTensor(n,"weights","logLoss")),assertShapesMatch(i.shape,s.shape,"Error in logLoss: ");var l=TensorOps.scalar(1),c=TensorOps.scalar(a),p=i.mul(s.add(c).log()).neg().sub(l.sub(i).mul(l.sub(s).add(c).log()));return e.computeWeightedLoss(p,u,o)},e.huberLoss=function(t,r,n,a,o){void 0===a&&(a=1),void 0===o&&(o=exports.Reduction.SUM_BY_NONZERO_WEIGHTS);var i=convertToTensor(t,"labels","huberLoss"),s=convertToTensor(r,"predictions","huberLoss"),u=null;null!=n&&(u=convertToTensor(n,"weights","huberLoss")),assertShapesMatch(i.shape,s.shape,"Error in huberLoss: ");var l=TensorOps.scalar(a),c=s.sub(i).abs(),p=BinaryOps.minimum(c,l),d=c.sub(p),h=TensorOps.scalar(.5).mul(p.square()).add(l.mul(d));return e.computeWeightedLoss(h,u,o)},__decorate([doc({heading:"Training",subheading:"Losses",namespace:"losses"}),operation],e,"computeWeightedLoss",null),__decorate([doc({heading:"Training",subheading:"Losses",namespace:"losses"}),operation],e,"absoluteDifference",null),__decorate([doc({heading:"Training",subheading:"Losses",namespace:"losses"}),operation],e,"meanSquaredError",null),__decorate([doc({heading:"Training",subheading:"Losses",namespace:"losses"}),operation],e,"cosineDistance",null),__decorate([doc({heading:"Training",subheading:"Losses",namespace:"losses"}),operation],e,"hingeLoss",null),__decorate([doc({heading:"Training",subheading:"Losses",namespace:"losses"}),operation],e,"logLoss",null),__decorate([doc({heading:"Training",subheading:"Losses",namespace:"losses"}),operation],e,"huberLoss",null),e}(),LRNOps=function(){function e(){}return e.localResponseNormalization=function(e,t,r,n,a){void 0===t&&(t=5),void 0===r&&(r=1),void 0===n&&(n=1),void 0===a&&(a=.5);var o=convertToTensor(e,"x","localResponseNormalization");assert(4===o.rank||3===o.rank,"Error in localResponseNormalization: x must be rank 3 or 4 but got\n rank "+o.rank+"."),assert(isInt(t),"Error in localResponseNormalization: depthRadius must be an integer\n but got depthRadius "+t+".");var i=o,s=!1;3===o.rank&&(s=!0,i=o.as4D(1,o.shape[0],o.shape[1],o.shape[2]));var u=ENV.engine.runKernel(function(e){return e.localResponseNormalization4D(i,t,r,n,a)},{x4D:i});return s?u.as3D(u.shape[1],u.shape[2],u.shape[3]):u},__decorate([doc({heading:"Operations",subheading:"Normalization"}),operation],e,"localResponseNormalization",null),e}(),LSTMOps=function(){function e(){}return e.multiRNNCell=function(e,t,r,n){for(var a=convertToTensor(t,"data","multiRNNCell"),o=convertToTensorArray(r,"c","multiRNNCell"),i=convertToTensorArray(n,"h","multiRNNCell"),s=a,u=[],l=0;l0?a>=s[t]:a<=s[t]);a+=n[t])r+=1;return r}),[i,l]}function startForAxis(e,t,r,n,a){var o=t[a];e&1<0?Number.MIN_SAFE_INTEGER:Number.MAX_SAFE_INTEGER);var i=n[a];return o<0&&(o+=i),clamp(0,o,i-1)}function stopForAxis(e,t,r,n,a){var o=t[a];e&1<0?Number.MAX_SAFE_INTEGER:Number.MIN_SAFE_INTEGER);var i=n[a];return o<0&&(o+=i),r[a]>0?clamp(0,o,i):clamp(-1,o,i-1)}var SliceOps=function(){function e(){}return e.slice1d=function(t,r,n){var a=convertToTensor(t,"x","slice1d");return assert(1===a.rank,"slice1d expects a rank-1 tensor, but got a rank-"+a.rank+" tensor"),e.slice(a,[r],[n])},e.slice2d=function(t,r,n){var a=convertToTensor(t,"x","slice2d");return assert(2===a.rank,"slice1d expects a rank-2 tensor, but got a rank-"+a.rank+" tensor"),e.slice(a,r,n)},e.slice3d=function(t,r,n){var a=convertToTensor(t,"x","slice3d");return assert(3===a.rank,"slice1d expects a rank-3 tensor, but got a rank-"+a.rank+" tensor"),e.slice(a,r,n)},e.slice4d=function(t,r,n){var a=convertToTensor(t,"x","slice4d");return assert(4===a.rank,"slice1d expects a rank-4 tensor, but got a rank-"+a.rank+" tensor"),e.slice(a,r,n)},e.slice=function(e,t,r){var n,a,o=convertToTensor(e,"x","slice");if(0===o.rank)throw new Error("Slicing scalar is not possible");n="number"==typeof t?[t].concat(new Array(o.rank-1).fill(0)):t.length=0?e:(assert(-1===e,"Bad value in size"),o.shape[t]-n[t])}),assertParamsValid(o,n,a);var i=o.shape;return ENV.engine.runKernel(function(e){return e.slice(o,n,a)},{$x:o},function(e){for(var t=[],r=0;r=0&&et||r===e){n=!0;break}r=nearestDivisor(e,r+1)}return r}function computeOutShape$1(e,t,r){for(var n=[],a=e.length,o=0;o":"<",u=r?"inOffset + i;":"round(getBestIndicesA(batch, inOffset + i));";this.userCode="\n void main() {\n ivec2 coords = getOutputCoords();\n int batch = coords[0];\n int outIdx = coords[1];\n int inOffset = outIdx * "+n+";\n\n int bestIndex = 0;\n float bestValue = getA(batch, inOffset);\n\n for (int i = 0; i < "+n+"; i++) {\n int inIdx = "+u+";\n float candidate = getA(batch, inIdx);\n if (candidate "+s+" bestValue) {\n bestValue = candidate;\n bestIndex = inIdx;\n }\n }\n setOutput(float(bestIndex));\n }\n "},AvgPool2DBackpropProgram=function(e){this.variableNames=["dy"],this.outputShape=e.inShape;var t=e.filterHeight,r=e.filterWidth,n=e.strideHeight,a=e.strideWidth,o=t-1-e.padInfo.top,i=r-1-e.padInfo.left,s=1/(t*r);this.userCode="\n const ivec2 pads = ivec2("+o+", "+i+");\n const float avgMultiplier = float("+s+");\n\n void main() {\n ivec4 coords = getOutputCoords();\n int b = coords[0];\n int d = coords[3];\n\n ivec2 dyRCCorner = coords.yz - pads;\n int dyRCorner = dyRCCorner.x;\n int dyCCorner = dyRCCorner.y;\n\n // Convolve dy(?, ?, d) with pos mask(:, :, d) to get dx(xR, xC, d).\n // ? = to be determined. : = across all values in that axis.\n float dotProd = 0.0;\n for (int wR = 0; wR < "+t+"; wR++) {\n float dyR = float(dyRCorner + wR) / "+n+".0;\n\n if (dyR < 0.0 || dyR >= "+e.outHeight+".0 || fract(dyR) > 0.0) {\n continue;\n }\n int idyR = int(dyR);\n\n for (int wC = 0; wC < "+r+"; wC++) {\n float dyC = float(dyCCorner + wC) / "+a+".0;\n\n if (dyC < 0.0 || dyC >= "+e.outWidth+".0 ||\n fract(dyC) > 0.0) {\n continue;\n }\n int idyC = int(dyC);\n\n float dyValue = getDy(b, idyR, idyC, d);\n\n dotProd += dyValue * avgMultiplier;\n }\n }\n setOutput(dotProd);\n }\n "},BatchNormProgram=function(e,t,r,n,a,o){this.outputShape=[],this.supportsBroadcasting=!0,this.variableNames=["x","mean","variance"],assertAndGetBroadcastShape(e,t),assertAndGetBroadcastShape(e,r);var i="0.0";null!=n&&(assertAndGetBroadcastShape(e,n),this.variableNames.push("offset"),i="getOffsetAtOutCoords()");var s="1.0";null!=a&&(assertAndGetBroadcastShape(e,a),this.variableNames.push("scale"),s="getScaleAtOutCoords()"),this.outputShape=e,this.userCode="\n void main() {\n float x = getXAtOutCoords();\n float mean = getMeanAtOutCoords();\n float variance = getVarianceAtOutCoords();\n float offset = "+i+";\n float scale = "+s+";\n float inv = scale * inversesqrt(variance + float("+o+"));\n setOutput((x - mean) * inv + offset);\n }\n "},CHECK_NAN_SNIPPET="\n if (isNaN(a)) return a;\n if (isNaN(b)) return b;\n",ADD="return a + b;",SUB="return a - b;",MUL="return a * b;",DIV="if (a == b) return 1.0;\n return a / b;",INT_DIV="\n float resultSign = sign(a) * sign(b);\n int ia = round(a);\n int ib = round(b);\n int result = ia / ib;\n int amodb = ia - ib * result;\n\n if (resultSign < 0.0 && amodb != 0) {\n result -= 1;\n }\n return float(result);\n",POW="\n return (round(mod(b, 2.0)) == 0 || round(mod(b, 2.0)) == 2) ?\n pow(abs(a), b) : sign(a) * pow(abs(a), b);\n",SQUARED_DIFFERENCE="return (a - b) * (a - b);",EQUAL="return float(a == b);",NOT_EQUAL="return float(a != b);",LESS="return float(a < b);",LESS_EQUAL="return float(a <= b);",GREATER="return float(a > b);",GREATER_EQUAL="return float(a >= b);",LOGICAL_AND="return float(a >= 1.0 && b >= 1.0);",LOGICAL_OR="return float(a >= 1.0 || b >= 1.0);",MAX=CHECK_NAN_SNIPPET+"\n return max(a, b);\n",MIN=CHECK_NAN_SNIPPET+"\n return min(a, b);\n",MOD="if (b == 0.0) return NAN;\n return mod(a, b);",ATAN2=CHECK_NAN_SNIPPET+"\n return atan(a, b);\n",ELU_DER="return (b >= 1.0) ? a : a * (b + 1.0);",BinaryOpProgram=function(){function e(e,t,r){this.variableNames=["A","B"],this.supportsBroadcasting=!0,this.outputShape=assertAndGetBroadcastShape(t,r),this.userCode="\n uniform float NAN;\n float binaryOperation(float a, float b) {\n "+e+"\n }\n\n void main() {\n float a = getAAtOutCoords();\n float b = getBAtOutCoords();\n setOutput(binaryOperation(a, b));\n }\n "}return e.prototype.getCustomSetupFunc=function(){var e=this;return function(t,r){null==e.startLoc&&(e.startLoc=t.getUniformLocationNoThrow(r,"NAN"),null==e.startLoc)||t.gl.uniform1f(e.startLoc,NaN)}},e}(),ClipProgram=function(e,t,r){this.variableNames=["A"],this.outputShape=e;var n=t.toFixed(20),a=r.toFixed(20);this.userCode="\n void main() {\n float value = getAAtOutCoords();\n if (isNaN(value)) {\n setOutput(value);\n return;\n }\n\n setOutput(clamp(value, "+n+", "+a+"));\n }\n "},ConcatProgram=function(e,t){this.variableNames=["A","B"],this.outputShape=[],this.outputShape=computeOutShape(e,t,1),this.userCode="\n void main() {\n ivec2 coords = getOutputCoords();\n int yR = coords.x;\n int yC = coords.y;\n\n float value = 0.0;\n if (yC < "+e[1]+") {\n value = getA(yR, yC);\n } else {\n yC -= "+e[1]+";\n value = getB(yR, yC);\n }\n\n setOutput(value);\n }\n "},Conv2DDerFilterProgram=function(e){this.variableNames=["x","dy"],this.outputShape=e.filterShape;var t=e.strideHeight,r=e.strideWidth,n=e.padInfo.top,a=e.padInfo.left;this.userCode="\n void main() {\n ivec4 coords = getOutputCoords();\n int wR = coords.x;\n int wC = coords.y;\n int d1 = coords.z;\n int d2 = coords.w;\n\n // Convolve x(?, ?, d1) with dy(:, :, d2) to get dw(wR, wC, d1, d2).\n // ? = to be determined. : = across all values in that axis.\n float dotProd = 0.0;\n\n for (int b = 0; b < "+e.batchSize+"; b++) {\n for (int yR = 0; yR < "+e.outHeight+"; yR++) {\n int xR = wR + yR * "+t+" - "+n+";\n\n if (xR < 0 || xR >= "+e.inHeight+") {\n continue;\n }\n\n for (int yC = 0; yC < "+e.outWidth+"; yC++) {\n int xC = wC + yC * "+r+" - "+a+";\n\n if (xC < 0 || xC >= "+e.inWidth+") {\n continue;\n }\n\n float dyValue = getDy(b, yR, yC, d2);\n float xValue = getX(b, xR, xC, d1);\n dotProd += (xValue * dyValue);\n }\n }\n }\n setOutput(dotProd);\n }\n "},Conv2DDerInputProgram=function(e){this.variableNames=["dy","W"],this.outputShape=e.inShape;var t=e.filterHeight,r=e.filterWidth,n=e.strideHeight,a=e.strideWidth,o=t-1-e.padInfo.top,i=r-1-e.padInfo.left;this.userCode="\n const ivec2 pads = ivec2("+o+", "+i+");\n\n void main() {\n ivec4 coords = getOutputCoords();\n int batch = coords[0];\n int d1 = coords[3];\n\n ivec2 dyCorner = coords.yz - pads;\n int dyRCorner = dyCorner.x;\n int dyCCorner = dyCorner.y;\n\n // Convolve dy(?, ?, d2) with w(:, :, d1, d2) to compute dx(xR, xC, d1).\n // ? = to be determined. : = across all values in that axis.\n float dotProd = 0.0;\n for (int wR = 0; wR < "+t+"; wR++) {\n float dyR = float(dyRCorner + wR) / "+n+".0;\n\n if (dyR < 0.0 || dyR >= "+e.outHeight+".0 || fract(dyR) > 0.0) {\n continue;\n }\n int idyR = int(dyR);\n\n int wRPerm = "+t+" - 1 - wR;\n\n for (int wC = 0; wC < "+r+"; wC++) {\n float dyC = float(dyCCorner + wC) / "+a+".0;\n\n if (dyC < 0.0 || dyC >= "+e.outWidth+".0 ||\n fract(dyC) > 0.0) {\n continue;\n }\n int idyC = int(dyC);\n\n int wCPerm = "+r+" - 1 - wC;\n\n for (int d2 = 0; d2 < "+e.outChannels+"; d2++) {\n float xValue = getDy(batch, idyR, idyC, d2);\n float wValue = getW(wRPerm, wCPerm, d1, d2);\n dotProd += xValue * wValue;\n }\n }\n }\n setOutput(dotProd);\n }\n "},DepthwiseConv2DDerFilterProgram=function(e){this.variableNames=["x","dy"],this.outputShape=e.filterShape;var t=e.strideHeight,r=e.strideWidth,n=e.padInfo.top,a=e.padInfo.left,o=e.outChannels/e.inChannels;this.userCode="\n void main() {\n ivec4 coords = getOutputCoords();\n int wR = coords.x;\n int wC = coords.y;\n int d1 = coords.z;\n int dm = coords.w;\n int d2 = d1 * "+o+" + dm;\n\n float dotProd = 0.0;\n\n // TODO: Vec4 over the batch size\n for (int b = 0; b < "+e.batchSize+"; b++) {\n for (int yR = 0; yR < "+e.outHeight+"; yR++) {\n int xR = wR + yR * "+t+" - "+n+";\n\n if (xR < 0 || xR >= "+e.inHeight+") {\n continue;\n }\n\n for (int yC = 0; yC < "+e.outWidth+"; yC++) {\n int xC = wC + yC * "+r+" - "+a+";\n\n if (xC < 0 || xC >= "+e.inWidth+") {\n continue;\n }\n\n float dyValue = getDy(b, yR, yC, d2);\n float xValue = getX(b, xR, xC, d1);\n dotProd += (xValue * dyValue);\n }\n }\n }\n setOutput(dotProd);\n }\n "},DepthwiseConv2DDerInputProgram=function(e){this.variableNames=["dy","W"],this.outputShape=e.inShape;var t=e.filterHeight,r=e.filterWidth,n=e.strideHeight,a=e.strideWidth,o=t-1-e.padInfo.top,i=r-1-e.padInfo.left,s=e.outChannels/e.inChannels;this.userCode="\n const ivec2 pads = ivec2("+o+", "+i+");\n\n void main() {\n ivec4 coords = getOutputCoords();\n int batch = coords[0];\n int d1 = coords[3];\n ivec2 dyCorner = coords.yz - pads;\n int dyRCorner = dyCorner.x;\n int dyCCorner = dyCorner.y;\n\n float dotProd = 0.0;\n\n for (int wR = 0; wR < "+t+"; wR++) {\n float dyR = float(dyRCorner + wR) / "+n+".0;\n\n if (dyR < 0.0 || dyR >= "+e.outHeight+".0 || fract(dyR) > 0.0) {\n continue;\n }\n int idyR = int(dyR);\n\n int wRPerm = "+t+" - 1 - wR;\n\n for (int wC = 0; wC < "+r+"; wC++) {\n float dyC = float(dyCCorner + wC) / "+a+".0;\n\n if (dyC < 0.0 || dyC >= "+e.outWidth+".0 ||\n fract(dyC) > 0.0) {\n continue;\n }\n int idyC = int(dyC);\n\n int wCPerm = "+r+" - 1 - wC;\n\n // TODO: Vec4 over the channelMul\n for (int dm = 0; dm < "+s+"; dm++) {\n int d2 = d1 * "+s+" + dm;\n float xValue = getDy(batch, idyR, idyC, d2);\n float wValue = getW(wRPerm, wCPerm, d1, dm);\n dotProd += xValue * wValue;\n }\n }\n }\n setOutput(dotProd);\n }\n "},Conv2DProgram=function(e){this.variableNames=["x","W"],this.outputShape=e.outShape;var t=e.padInfo.top,r=e.padInfo.left,n=e.strideHeight,a=e.strideWidth,o=e.dilationHeight,i=e.dilationWidth,s=e.filterHeight,u=e.filterWidth,l=4*Math.floor(e.inChannels/4),c=e.inChannels%4;this.userCode="\n const ivec2 strides = ivec2("+n+", "+a+");\n const ivec2 pads = ivec2("+t+", "+r+");\n\n void main() {\n ivec4 coords = getOutputCoords();\n int batch = coords[0];\n int d2 = coords[3];\n\n ivec2 xRCCorner = coords.yz * strides - pads;\n int xRCorner = xRCCorner.x;\n int xCCorner = xRCCorner.y;\n\n // Convolve x(?, ?, d1) with w(:, :, d1, d2) to get y(yR, yC, d2).\n // ? = to be determined. : = across all values in that axis.\n float dotProd = 0.0;\n for (int wR = 0; wR < "+s+"; wR++) {\n int xR = xRCorner + wR * "+o+";\n\n if (xR < 0 || xR >= "+e.inHeight+") {\n continue;\n }\n\n for (int wC = 0; wC < "+u+"; wC++) {\n int xC = xCCorner + wC * "+i+";\n\n if (xC < 0 || xC >= "+e.inWidth+") {\n continue;\n }\n\n for (int d1 = 0; d1 < "+l+"; d1 += 4) {\n vec4 xValues = vec4(\n getX(batch, xR, xC, d1),\n getX(batch, xR, xC, d1 + 1),\n getX(batch, xR, xC, d1 + 2),\n getX(batch, xR, xC, d1 + 3)\n );\n vec4 wValues = vec4(\n getW(wR, wC, d1, d2),\n getW(wR, wC, d1 + 1, d2),\n getW(wR, wC, d1 + 2, d2),\n getW(wR, wC, d1 + 3, d2)\n );\n\n dotProd += dot(xValues, wValues);\n }\n\n if ("+(1===c)+") {\n dotProd +=\n getX(batch, xR, xC, "+l+") *\n getW(wR, wC, "+l+", d2);\n } else if ("+(2===c)+") {\n vec2 xValues = vec2(\n getX(batch, xR, xC, "+l+"),\n getX(batch, xR, xC, "+l+" + 1)\n );\n vec2 wValues = vec2(\n getW(wR, wC, "+l+", d2),\n getW(wR, wC, "+l+" + 1, d2)\n );\n dotProd += dot(xValues, wValues);\n } else if ("+(3===c)+") {\n vec3 xValues = vec3(\n getX(batch, xR, xC, "+l+"),\n getX(batch, xR, xC, "+l+" + 1),\n getX(batch, xR, xC, "+l+" + 2)\n );\n vec3 wValues = vec3(\n getW(wR, wC, "+l+", d2),\n getW(wR, wC, "+l+" + 1, d2),\n getW(wR, wC, "+l+" + 2, d2)\n );\n dotProd += dot(xValues, wValues);\n }\n }\n }\n setOutput(dotProd);\n }\n "},DepthwiseConv2DProgram=function(e){this.variableNames=["x","W"],this.outputShape=e.outShape;var t=e.inHeight,r=e.inWidth,n=e.padInfo.top,a=e.padInfo.left,o=e.strideHeight,i=e.strideWidth,s=e.dilationHeight,u=e.dilationWidth,l=e.filterHeight,c=e.filterWidth,p=e.outChannels/e.inChannels;this.userCode="\n const ivec2 strides = ivec2("+o+", "+i+");\n const ivec2 pads = ivec2("+n+", "+a+");\n\n void main() {\n ivec4 coords = getOutputCoords();\n int batch = coords.x;\n ivec2 xRCCorner = coords.yz * strides - pads;\n int d2 = coords.w;\n int d1 = d2 / "+p+";\n int q = d2 - d1 * "+p+";\n\n int xRCorner = xRCCorner.x;\n int xCCorner = xRCCorner.y;\n\n // Convolve x(?, ?, d1) with w(:, :, d1, q) to get y(yR, yC, d2).\n // ? = to be determined. : = across all values in that axis.\n float dotProd = 0.0;\n // TODO(dsmilkov): Flatten the two for loops and vec4 the operations.\n for (int wR = 0; wR < "+l+"; wR++) {\n int xR = xRCorner + wR * "+s+";\n\n if (xR < 0 || xR >= "+t+") {\n continue;\n }\n\n for (int wC = 0; wC < "+c+"; wC++) {\n int xC = xCCorner + wC * "+u+";\n\n if (xC < 0 || xC >= "+r+") {\n continue;\n }\n\n float xVal = getX(batch, xR, xC, d1);\n float wVal = getW(wR, wC, d1, q);\n dotProd += xVal * wVal;\n }\n }\n setOutput(dotProd);\n }\n "};function makeShader(e,t,r,n){var a=e.map(function(e){var t=sizeFromShape(e.shapeInfo.logicalShape);return e.shapeInfo.isUniform?"uniform float "+e.name+(t>1?"["+t+"]":"")+";":"uniform sampler2D "+e.name+";"});a=a.join("\n");var o=e.map(function(e){return getInputSamplingSnippet(e,t,n)}).join("\n"),i=t.texShape,s=getOutputSamplingSnippet(t.logicalShape,i);return[SHADER_PREFIX,FLOAT_TEXTURE_SAMPLE_SNIPPET,FLOAT_TEXTURE_SETOUTPUT_SNIPPET,a,s,o,r].join("\n")}function getSamplerFromInInfo(e){var t=e.shapeInfo.logicalShape;switch(t.length){case 0:return getSamplerScalar(e);case 1:return getSampler1D(e);case 2:return getSampler2D(e);case 3:return getSampler3D(e);case 4:return getSampler4D(e);case 5:return getSampler5D(e);case 6:return getSampler6D(e);default:throw new Error(t.length+"-D input sampling is not yet supported")}}function getInputSamplingSnippet(e,t,r){var n=getSamplerFlat(e);return n+=getSamplerFromInInfo(e),(r||arraysEqual(e.shapeInfo.logicalShape,t.logicalShape))&&(n+=getSamplerAtOutputCoords(e,t,r)),n}function getOutputSamplingSnippet(e,t){switch(e.length){case 0:return getOutputScalarCoords();case 1:return getOutput1DCoords(e,t);case 2:return getOutput2DCoords(e,t);case 3:return getOutput3DCoords(e,t);case 4:return getOutput4DCoords(e,t);case 5:return getOutput5DCoords(e,t);case 6:return getOutput6DCoords(e,t);default:throw new Error(e.length+"-D output sampling is not yet supported")}}var SAMPLE_1D_SNIPPET="\nvec2 UVfrom1D(int texNumR, int texNumC, int index) {\n int texR = index / texNumC;\n int texC = index - texR * texNumC;\n return (vec2(texC, texR) + halfCR) / vec2(texNumC, texNumR);\n}\n",SAMPLE_2D_SNIPPET="\nvec2 UVfrom2D(int texNumR, int texNumC, int numC, int row, int col) {\n int index = row * numC + col;\n int texR = index / texNumC;\n int texC = index - texR * texNumC;\n return (vec2(texC, texR) + halfCR) / vec2(texNumC, texNumR);\n}\n",SAMPLE_3D_SNIPPET="\nvec2 UVfrom3D(int texNumR, int texNumC, int stride0,\n int stride1, int row, int col, int depth) {\n // Explicitly use integer operations as dot() only works on floats.\n int index = row * stride0 + col * stride1 + depth;\n int texR = index / texNumC;\n int texC = index - texR * texNumC;\n return (vec2(texC, texR) + halfCR) / vec2(texNumC, texNumR);\n}\n",SAMPLE_4D_SNIPPET="\nvec2 UVfrom4D(int texNumR, int texNumC, int stride0,\n int stride1, int stride2, int row, int col, int depth,\n int depth2) {\n // Explicitly use integer operations as dot() only works on floats.\n int index = row * stride0 + col * stride1 + depth * stride2 + depth2;\n int texR = index / texNumC;\n int texC = index - texR * texNumC;\n return (vec2(texC, texR) + halfCR) / vec2(texNumC, texNumR);\n}\n",SAMPLE_5D_SNIPPET="\nvec2 UVfrom5D(int texNumR, int texNumC, int stride0,\n int stride1, int stride2, int stride3, int row, int col, int depth,\n int depth2, int depth3) {\n // Explicitly use integer operations as dot() only works on floats.\n int index = row * stride0 + col * stride1 +\n depth * stride2 + depth2 * stride3 + depth3;\n int texR = index / texNumC;\n int texC = index - texR * texNumC;\n return (vec2(texC, texR) + halfCR) / vec2(texNumC, texNumR);\n}\n",SAMPLE_6D_SNIPPET="\nvec2 UVfrom6D(int texNumR, int texNumC, int stride0,\n int stride1, int stride2, int stride3, int stride4,\n int row, int col, int depth, int depth2, int depth3, int depth4) {\n // Explicitly use integer operations as dot() only works on floats.\n int index = row * stride0 + col * stride1 + depth * stride2 + depth2 *\n stride3 + depth3 * stride4 + depth4;\n int texR = index / texNumC;\n int texC = index - texR * texNumC;\n return (vec2(texC, texR) + halfCR) / vec2(texNumC, texNumR);\n}\n",FLOAT_TEXTURE_SAMPLE_SNIPPET="\n float sampleTexture(sampler2D textureSampler, vec2 uv) {\n return texture2D(textureSampler, uv).r;\n }\n",FLOAT_TEXTURE_SETOUTPUT_SNIPPET="\n void setOutput(float val) {\n gl_FragColor = vec4(val, 0, 0, 0);\n }\n",SHADER_PREFIX="\n precision highp float;\n precision highp int;\n varying vec2 resultUV;\n const vec2 halfCR = vec2(0.5, 0.5);\n\n struct ivec5\n {\n int x;\n int y;\n int z;\n int w;\n int u;\n };\n\n struct ivec6\n {\n int x;\n int y;\n int z;\n int w;\n int u;\n int v;\n };\n\n bool isNaN(float val) {\n return (val < 0.0 || 0.0 < val || val == 0.0) ? false : true;\n }\n\n bool hasNaN(vec4 values) {\n vec4 v1 = values * values;\n vec4 v2 = values * values;\n return any(notEqual(v1, v2));\n }\n\n float getNaN(vec4 values) {\n return dot(vec4(1), values);\n }\n\n int round(float value) {\n return int(floor(value + 0.5));\n }\n\n int imod(int x, int y) {\n return x - y * (x / y);\n }\n\n //Based on the work of Dave Hoskins\n //https://www.shadertoy.com/view/4djSRW\n #define HASHSCALE1 443.8975\n float random(float seed){\n vec2 p = resultUV * seed;\n vec3 p3 = fract(vec3(p.xyx) * HASHSCALE1);\n p3 += dot(p3, p3.yzx + 19.19);\n return fract((p3.x + p3.y) * p3.z);\n }\n\n "+SAMPLE_1D_SNIPPET+"\n "+SAMPLE_2D_SNIPPET+"\n "+SAMPLE_3D_SNIPPET+"\n "+SAMPLE_4D_SNIPPET+"\n "+SAMPLE_5D_SNIPPET+"\n "+SAMPLE_6D_SNIPPET+"\n";function getOutputScalarCoords(){return"\n int getOutputCoords() {\n return 0;\n }\n "}function getOutput1DCoords(e,t){return 1===t[0]?"\n int getOutputCoords() {\n return int(resultUV.x * "+t[1]+".0);\n }\n ":1===t[1]?"\n int getOutputCoords() {\n return int(resultUV.y * "+t[0]+".0);\n }\n ":"\n int getOutputCoords() {\n ivec2 resTexRC = ivec2(resultUV.yx *\n vec2("+t[0]+", "+t[1]+"));\n return resTexRC.x * "+t[1]+" + resTexRC.y;\n }\n "}function getOutput3DCoords(e,t){var r=e[1]*e[2],n=e[2];return"\n ivec3 getOutputCoords() {\n ivec2 resTexRC = ivec2(resultUV.yx *\n vec2("+t[0]+", "+t[1]+"));\n int index = resTexRC.x * "+t[1]+" + resTexRC.y;\n int r = index / "+r+";\n index -= r * "+r+";\n int c = index / "+n+";\n int d = index - c * "+n+";\n return ivec3(r, c, d);\n }\n "}function getOutput4DCoords(e,t){var r=e[3],n=e[2]*r,a=e[1]*n;return"\n ivec4 getOutputCoords() {\n ivec2 resTexRC = ivec2(resultUV.yx *\n vec2("+t[0]+", "+t[1]+"));\n int index = resTexRC.x * "+t[1]+" + resTexRC.y;\n\n int r = index / "+a+";\n index -= r * "+a+";\n\n int c = index / "+n+";\n index -= c * "+n+";\n\n int d = index / "+r+";\n int d2 = index - d * "+r+";\n\n return ivec4(r, c, d, d2);\n }\n "}function getOutput5DCoords(e,t){var r=e[4],n=e[3]*r,a=e[2]*n,o=e[1]*a;return"\n ivec5 getOutputCoords() {\n ivec2 resTexRC = ivec2(resultUV.yx * vec2("+t[0]+",\n "+t[1]+"));\n\n int index = resTexRC.x * "+t[1]+" + resTexRC.y;\n\n int r = index / "+o+";\n index -= r * "+o+";\n\n int c = index / "+a+";\n index -= c * "+a+";\n\n int d = index / "+n+";\n index -= d * "+n+";\n\n int d2 = index / "+r+";\n int d3 = index - d2 * "+r+";\n\n ivec5 outShape = ivec5(r, c, d, d2, d3);\n return outShape;\n }\n "}function getOutput6DCoords(e,t){var r=e[5],n=e[4]*r,a=e[3]*n,o=e[2]*a,i=e[1]*o;return"\n ivec6 getOutputCoords() {\n ivec2 resTexRC = ivec2(resultUV.yx *\n vec2("+t[0]+", "+t[1]+"));\n int index = resTexRC.x * "+t[1]+" + resTexRC.y;\n\n int r = index / "+i+";\n index -= r * "+i+";\n\n int c = index / "+o+";\n index -= c * "+o+";\n\n int d = index / "+a+";\n index -= d * "+a+";\n\n int d2 = index / "+n+";\n index -= d2 * "+n+";\n\n int d3 = index / "+r+";\n int d4 = index - d3 * "+r+";\n\n ivec6 result = ivec6(r, c, d, d2, d3, d4);\n return result;\n }\n "}function getOutput2DCoords(e,t){return arraysEqual(e,t)?"\n ivec2 getOutputCoords() {\n return ivec2(resultUV.yx * vec2("+t[0]+", "+t[1]+"));\n }\n ":1===e[1]?"\n ivec2 getOutputCoords() {\n ivec2 resTexRC = ivec2(resultUV.yx *\n vec2("+t[0]+", "+t[1]+"));\n int index = resTexRC.x * "+t[1]+" + resTexRC.y;\n return ivec2(index, 0);\n }\n ":1===e[0]?"\n ivec2 getOutputCoords() {\n ivec2 resTexRC = ivec2(resultUV.yx *\n vec2("+t[0]+", "+t[1]+"));\n int index = resTexRC.x * "+t[1]+" + resTexRC.y;\n return ivec2(0, index);\n }\n ":"\n ivec2 getOutputCoords() {\n ivec2 resTexRC = ivec2(resultUV.yx *\n vec2("+t[0]+", "+t[1]+"));\n int index = resTexRC.x * "+t[1]+" + resTexRC.y;\n int r = index / "+e[1]+";\n int c = index - r * "+e[1]+";\n return ivec2(r, c);\n }\n "}function getSamplerScalar(e){var t=e.name,r="get"+t.charAt(0).toUpperCase()+t.slice(1);return e.shapeInfo.isUniform?"float "+r+"() {return "+t+";}":"\n float "+r+"() {\n return sampleTexture("+t+", halfCR);\n }\n "}function getSampler1D(e){var t=e.name,r="get"+t.charAt(0).toUpperCase()+t.slice(1);return"\n float "+r+"(int index) {\n return "+r+"Flat(index);\n }\n "}function getSampler2D(e){var t=e.shapeInfo.logicalShape,r=e.name,n="get"+r.charAt(0).toUpperCase()+r.slice(1),a=e.shapeInfo.texShape;if(null!=a&&arraysEqual(t,a)){var o=a[0];return"\n float "+n+"(int row, int col) {\n vec2 uv = (vec2(col, row) + halfCR) / vec2("+a[1]+".0, "+o+".0);\n return sampleTexture("+r+", uv);\n }\n "}var i=squeezeShape(t),s=i.newShape,u=i.keptDims,l=s;if(l.length=1?"coords = 0;":s.map(function(e){return"coords["+(e+u)+"] = 0;"}).join("\n"))+"\n return get"+r+"("+(o<2&&a>0?"coords":e.shapeInfo.logicalShape.map(function(e,t){return"coords["+(t+u)+"]"}).join(", "))+");\n }\n "}function getSamplerAtOutputCoords(e,t,r){var n=e.name,a=n.charAt(0).toUpperCase()+n.slice(1),o="get"+a+"AtOutCoords",i=getBroadcastDims(e.shapeInfo.logicalShape,t.logicalShape),s=e.shapeInfo.logicalShape.length,u=t.logicalShape.length,l=r&&(u>s||i.length>0),c=broadcastDimsAreOuter(i),p=e.shapeInfo.isUniform;if(l&&!c)return getBroadcastOutputCoordsSampler(e,t,a,o);var d=sizeFromShape(e.shapeInfo.logicalShape),h="";l&&c&&(h="\n int mainPart = index / "+d+";\n index -= mainPart * "+d+";\n ");var f=t.texShape;if(p)return 1===d?"float "+o+"() {return "+n+";}":"\n float "+o+"() {\n ivec2 resTexRC = ivec2(resultUV.yx *\n vec2("+f[0]+", "+f[1]+"));\n int index = resTexRC.x * "+f[1]+" + resTexRC.y;\n "+h+"\n return get"+a+"Flat(index);\n }\n ";var m=e.shapeInfo.texShape;return arraysEqual(m,f)?"\n float "+o+"() {\n return sampleTexture("+n+", resultUV);\n }\n ":"\n float "+o+"() {\n ivec2 resTexRC = ivec2(resultUV.yx *\n vec2("+f[0]+", "+f[1]+"));\n int index = resTexRC.x * "+f[1]+" + resTexRC.y;\n "+h+"\n int texR = index / "+m[1]+";\n int texC = index - texR * "+m[1]+";\n vec2 uv = (vec2(texC, texR) + halfCR) /\n vec2("+m[1]+".0, "+m[0]+".0);\n\n return sampleTexture("+n+", uv);\n }\n "}function getCoordsDataType(e){if(e<=1)return"int";if(2===e)return"ivec2";if(3===e)return"ivec3";if(4===e)return"ivec4";if(5===e)return"ivec5";if(6===e)return"ivec6";throw Error("GPU for rank "+e+" is not yet supported")}function squeezeInputInfo(e,t){var r=JSON.parse(JSON.stringify(e));return r.shapeInfo.logicalShape=t,r}function getSqueezedParams(e,t){return t.map(function(t){return e[t]}).join(", ")}var CumSumProgram=function(e,t,r){this.variableNames=["x"],this.outputShape=e;var n=e.length,a=e[e.length-1],o=r?"<":">";this.userCode="\n int getIndex(int i) {\n "+(r?"return "+a+" -i - 1;":"return i;")+"\n }\n\n void main() {\n "+getCoordsDataType(n)+" coords = getOutputCoords();\n int end = "+getFinalCoord(n,"coords")+";\n float val = 0.0;\n for (int i = "+a+" - 1; i >= 0; i -= 1) {\n int idx = getIndex(i);\n if (idx "+o+" end) {\n continue;\n }\n if (idx == end && "+t+") {\n continue;\n }\n "+getFinalCoord(n,"coords")+" = idx;\n val += getX("+getCoords(n,"coords")+");\n }\n setOutput(val);\n }\n "};function getCoords(e,t){if(1===e)return""+t;if(2===e)return t+".x, "+t+".y";if(3===e)return t+".x, "+t+".y, "+t+".z";if(4===e)return t+".x, "+t+".y, "+t+".z, "+t+".w";throw Error("Cumulative sum for rank "+e+" is not yet supported")}function getFinalCoord(e,t){if(1===e)return""+t;if(2===e)return t+".y";if(3===e)return t+".z";if(4===e)return t+".w";throw Error("Cumulative sum for rank "+e+" is not yet supported")}var TextureUsage,PhysicalTextureType,EncodeFloatProgram=function(e){this.variableNames=["A"],this.outputShape=e,this.userCode="\n const float FLOAT_MAX = 1.70141184e38;\n const float FLOAT_MIN = 1.17549435e-38;\n\n lowp vec4 encode_float(highp float v) {\n if (isNaN(v)) {\n return vec4(255, 255, 255, 255);\n }\n\n highp float av = abs(v);\n\n if(av < FLOAT_MIN) {\n return vec4(0.0, 0.0, 0.0, 0.0);\n } else if(v > FLOAT_MAX) {\n return vec4(0.0, 0.0, 128.0, 127.0) / 255.0;\n } else if(v < -FLOAT_MAX) {\n return vec4(0.0, 0.0, 128.0, 255.0) / 255.0;\n }\n\n highp vec4 c = vec4(0,0,0,0);\n\n highp float e = floor(log2(av));\n highp float m = exp2(fract(log2(av))) - 1.0;\n\n c[2] = floor(128.0 * m);\n m -= c[2] / 128.0;\n c[1] = floor(32768.0 * m);\n m -= c[1] / 32768.0;\n c[0] = floor(8388608.0 * m);\n\n highp float ebias = e + 127.0;\n c[3] = floor(ebias / 2.0);\n ebias -= c[3] * 2.0;\n c[2] += floor(ebias) * 128.0;\n\n c[3] += 128.0 * step(0.0, -v);\n\n return c / 255.0;\n }\n\n void main() {\n float x = getAAtOutCoords();\n gl_FragColor = encode_float(x);\n }\n "},FromPixelsProgram=function(e){this.variableNames=["A"];var t=e[0],r=e[1];this.outputShape=e,this.userCode="\n void main() {\n ivec3 coords = getOutputCoords();\n int texR = coords[0];\n int texC = coords[1];\n int depth = coords[2];\n vec2 uv = (vec2(texC, texR) + halfCR) / vec2("+r+".0, "+t+".0);\n\n vec4 values = texture2D(A, uv);\n float value;\n if (depth == 0) {\n value = values.r;\n } else if (depth == 1) {\n value = values.g;\n } else if (depth == 2) {\n value = values.b;\n } else if (depth == 3) {\n value = values.a;\n }\n\n setOutput(floor(value * 255.0 + 0.5));\n }\n "},GatherProgram=function(e,t,r){this.variableNames=["A","indices"];var n=e.slice();n[r]=t,this.outputShape=n,this.rank=n.length;var a=getCoordsDataType(this.rank),o=getSourceCoords(e,r);this.userCode="\n void main() {\n "+a+" resRC = getOutputCoords();\n setOutput(getA("+o+"));\n }\n "};function getSourceCoords(e,t){var r=e.length;if(r>4)throw Error("Gather for rank "+r+" is not yet supported");if(1===r)return"int(getIndices(resRC))";for(var n=["resRC.x","resRC.y","resRC.z","resRC.w"],a=[],o=0;o= "+n);for(var a=0,o=0;o= "+n);for(var a=0,o=0;o= "+a);for(var o=getPackedMatrixTextureShapeWidthHeight(t,r),i=o[0],s=o[1],u=r%2==1,l=t%2==1,c=Math.floor(r/2),p=Math.floor(t/2),d=u?4:0,h=r,f=0,m=0;m= "+a);for(var o=r%2==1,i=t%2==1,s=Math.floor(r/2),u=Math.floor(t/2),l=getPackedMatrixTextureShapeWidthHeight(t,r),c=l[0],p=l[1],d=o?4:0,h=r+(o?1:0),f=0,m=0,g=r,y=0;yn||r>n)throw a="["+t+"x"+r+"]",new Error("Requested texture size "+a+" greater than WebGL maximum on this browser / GPU ["+n+"x"+n+"].")}function createFramebuffer(e){return throwIfNull(e,function(){return e.createFramebuffer()},"Unable to create WebGLFramebuffer.")}function bindVertexBufferToProgramAttribute(e,t,r,n,a,o,i){var s=e.getAttribLocation(t,r);return-1!==s&&(callAndCheck(e,function(){return e.bindBuffer(e.ARRAY_BUFFER,n)}),callAndCheck(e,function(){return e.vertexAttribPointer(s,a,e.FLOAT,!1,o,i)}),callAndCheck(e,function(){return e.enableVertexAttribArray(s)}),!0)}function bindTextureUnit(e,t,r){validateTextureUnit(e,r),callAndCheck(e,function(){return e.activeTexture(e.TEXTURE0+r)}),callAndCheck(e,function(){return e.bindTexture(e.TEXTURE_2D,t)})}function unbindTextureUnit(e,t){validateTextureUnit(e,t),callAndCheck(e,function(){return e.activeTexture(e.TEXTURE0+t)}),callAndCheck(e,function(){return e.bindTexture(e.TEXTURE_2D,null)})}function getProgramUniformLocationOrThrow(e,t,r){return throwIfNull(e,function(){return e.getUniformLocation(t,r)},'uniform "'+r+'" not present in program.')}function getProgramUniformLocation(e,t,r){return e.getUniformLocation(t,r)}function bindTextureToProgramUniformSampler(e,t,r,n,a){callAndCheck(e,function(){return bindTextureUnit(e,r,a)}),callAndCheck(e,function(){return e.uniform1i(n,a)})}function bindCanvasToFramebuffer(e){callAndCheck(e,function(){return e.bindFramebuffer(e.FRAMEBUFFER,null)}),callAndCheck(e,function(){return e.viewport(0,0,e.canvas.width,e.canvas.height)}),callAndCheck(e,function(){return e.scissor(0,0,e.canvas.width,e.canvas.height)})}function bindColorTextureToFramebuffer(e,t,r){callAndCheck(e,function(){return e.bindFramebuffer(e.FRAMEBUFFER,r)}),callAndCheck(e,function(){return e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,t,0)})}function unbindColorTextureFromFramebuffer(e,t){callAndCheck(e,function(){return e.bindFramebuffer(e.FRAMEBUFFER,t)}),callAndCheck(e,function(){return e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,null,0)})}function validateFramebuffer(e){var t=e.checkFramebufferStatus(e.FRAMEBUFFER);if(t!==e.FRAMEBUFFER_COMPLETE)throw new Error("Error binding framebuffer: "+getFramebufferErrorMessage(e,t))}function getFramebufferErrorMessage(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 throwIfNull(e,t,r){var n=callAndCheck(e,function(){return t()});if(null==n)throw new Error(r);return n}function validateTextureUnit(e,t){var r=e.MAX_COMBINED_TEXTURE_IMAGE_UNITS-1,n=t+e.TEXTURE0;if(nr)throw new Error("textureUnit must be in [gl.TEXTURE0, gl.TEXTURE"+r+"].")}function getTextureShapeFromLogicalShape(e,t){2!==t.length&&(t=squeezeShape(t).newShape);var r=queryMaxTextureSize(e),n=sizeFromShape(t);return t.length<=1&&n<=r?[n,1]:2===t.length&&t[0]<=r&&t[1]<=r?t:3===t.length&&t[0]<=r&&t[1]*t[2]<=r?[t[0],t[1]*t[2]]:4===t.length&&t[0]<=r&&t[1]*t[2]*t[3]<=r?[t[0],t[1]*t[2]*t[3]]:sizeToSquarishShape(n)}var webgl_util=Object.freeze({createWebGLRenderingContext:createWebGLRenderingContext,createWebGLRenderingContextFromCanvas:createWebGLRenderingContextFromCanvas,callAndCheck:callAndCheck,enableDebugWebGLErrorChecking:enableDebugWebGLErrorChecking,checkWebGLError:checkWebGLError,getWebGLErrorMessage:getWebGLErrorMessage,getExtensionOrThrow:getExtensionOrThrow,createVertexShader:createVertexShader,createFragmentShader:createFragmentShader,createProgram:createProgram,linkProgram:linkProgram,validateProgram:validateProgram,createStaticVertexBuffer:createStaticVertexBuffer,createStaticIndexBuffer:createStaticIndexBuffer,queryMaxTextureSize:queryMaxTextureSize,getNumChannels:getNumChannels,createTexture:createTexture,validateTextureSize:validateTextureSize,createFramebuffer:createFramebuffer,bindVertexBufferToProgramAttribute:bindVertexBufferToProgramAttribute,bindTextureUnit:bindTextureUnit,unbindTextureUnit:unbindTextureUnit,getProgramUniformLocationOrThrow:getProgramUniformLocationOrThrow,getProgramUniformLocation:getProgramUniformLocation,bindTextureToProgramUniformSampler:bindTextureToProgramUniformSampler,bindCanvasToFramebuffer:bindCanvasToFramebuffer,bindColorTextureToFramebuffer:bindColorTextureToFramebuffer,unbindColorTextureFromFramebuffer:unbindColorTextureFromFramebuffer,validateFramebuffer:validateFramebuffer,getFramebufferErrorMessage:getFramebufferErrorMessage,getTextureShapeFromLogicalShape:getTextureShapeFromLogicalShape});function getWebGLContextAttributes(){return{alpha:!1,antialias:!1,premultipliedAlpha:!1,preserveDrawingBuffer:!1,depth:!1,stencil:!1,failIfMajorPerformanceCaveat:!0}}function createWebGLContext(e){var t,r=getWebGLContextAttributes();return callAndCheck(t=null!=e?createWebGLRenderingContextFromCanvas(e,r):createWebGLRenderingContext(r),function(){return t.disable(t.DEPTH_TEST)}),callAndCheck(t,function(){return t.disable(t.STENCIL_TEST)}),callAndCheck(t,function(){return t.disable(t.BLEND)}),callAndCheck(t,function(){return t.disable(t.DITHER)}),callAndCheck(t,function(){return t.disable(t.POLYGON_OFFSET_FILL)}),callAndCheck(t,function(){return t.disable(t.SAMPLE_COVERAGE)}),callAndCheck(t,function(){return t.enable(t.SCISSOR_TEST)}),callAndCheck(t,function(){return t.enable(t.CULL_FACE)}),callAndCheck(t,function(){return t.cullFace(t.BACK)}),t}function createVertexShader$1(e){return createVertexShader(e,"\n precision highp float;\n attribute vec3 clipSpacePos;\n attribute vec2 uv;\n varying vec2 resultUV;\n\n void main() {\n gl_Position = vec4(clipSpacePos, 1);\n resultUV = uv;\n }")}function createVertexBuffer(e){return createStaticVertexBuffer(e,new Float32Array([-1,1,0,0,1,-1,-1,0,0,0,1,1,0,1,1,1,-1,0,1,0]))}function createIndexBuffer(e){return createStaticIndexBuffer(e,new Uint16Array([0,1,2,2,1,3]))}function getTextureConfig(e,t){var r,n,a,o,i,s,u,l=e;return 2===ENV.get("WEBGL_VERSION")?(r=l.R32F,n=l.R16F,a=l.RGBA32F,o=l.RED,i=4,s=1,u=l.HALF_FLOAT):(r=e.RGBA,n=e.RGBA,a=l.RGBA,o=e.RGBA,i=4,s=4,u=null!=t?t.HALF_FLOAT_OES:null),{internalFormatFloat:r,internalFormatHalfFloat:n,internalFormatPackedFloat:a,textureFormatFloat:o,downloadTextureFormat:e.RGBA,downloadUnpackNumChannels:i,defaultNumChannels:s,textureTypeHalfFloat:u}}function createAndConfigureTexture(e,t,r,n,a,o){validateTextureSize(e,t,r);var i=createTexture(e),s=e.TEXTURE_2D;return callAndCheck(e,function(){return e.bindTexture(s,i)}),callAndCheck(e,function(){return e.texParameteri(s,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE)}),callAndCheck(e,function(){return e.texParameteri(s,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE)}),callAndCheck(e,function(){return e.texParameteri(s,e.TEXTURE_MIN_FILTER,e.NEAREST)}),callAndCheck(e,function(){return e.texParameteri(s,e.TEXTURE_MAG_FILTER,e.NEAREST)}),callAndCheck(e,function(){return e.texImage2D(s,0,n,t,r,0,a,o,null)}),callAndCheck(e,function(){return e.bindTexture(e.TEXTURE_2D,null)}),i}function createFloat32MatrixTexture(e,t,r,n){var a=getUnpackedMatrixTextureShapeWidthHeight(t,r);return createAndConfigureTexture(e,a[0],a[1],n.internalFormatFloat,n.textureFormatFloat,e.FLOAT)}function createFloat16MatrixTexture(e,t,r,n){var a=getUnpackedMatrixTextureShapeWidthHeight(t,r);return createAndConfigureTexture(e,a[0],a[1],n.internalFormatFloat,n.textureFormatFloat,n.textureTypeHalfFloat)}function createUnsignedBytesMatrixTexture(e,t,r,n){var a=getUnpackedMatrixTextureShapeWidthHeight(t,r);return createAndConfigureTexture(e,a[0],a[1],e.RGBA,e.RGBA,e.UNSIGNED_BYTE)}function createPackedMatrixTexture(e,t,r,n){var a=getPackedMatrixTextureShapeWidthHeight(t,r);return createAndConfigureTexture(e,a[0],a[1],n.internalFormatPackedFloat,e.RGBA,e.FLOAT)}function bindVertexProgramAttributeStreams(e,t,r){return callAndCheck(e,function(){return e.bindBuffer(e.ARRAY_BUFFER,r)}),bindVertexBufferToProgramAttribute(e,t,"clipSpacePos",r,3,20,0)&&bindVertexBufferToProgramAttribute(e,t,"uv",r,2,20,12)}function uploadPixelDataToTexture(e,t,r){callAndCheck(e,function(){return e.bindTexture(e.TEXTURE_2D,t)}),callAndCheck(e,function(){return e.texImage2D(e.TEXTURE_2D,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,r)}),callAndCheck(e,function(){return e.bindTexture(e.TEXTURE_2D,null)})}function uploadDataToTexture(e,t,r,n,a,o){validateTextureSize(e,r,n),callAndCheck(e,function(){return e.bindTexture(e.TEXTURE_2D,t)}),callAndCheck(e,function(){return e.texSubImage2D(e.TEXTURE_2D,0,0,0,r,n,o,e.FLOAT,a)}),callAndCheck(e,function(){return e.bindTexture(e.TEXTURE_2D,null)})}function uploadMatrixToTexture(e,t,r,n,a,o,i){var s,u=getUnpackedMatrixTextureShapeWidthHeight(r,n),l=u[0],c=u[1];1===i.defaultNumChannels?s=a:encodeMatrixToUnpackedArray(a,s=new Float32Array(getUnpackedArraySizeFromMatrixSize(a.length,o)),o),uploadDataToTexture(e,t,l,c,s,i.textureFormatFloat)}function uploadMatrixToPackedTexture(e,t,r,n,a,o){var i=getPackedMatrixTextureShapeWidthHeight(r,n),s=i[0],u=i[1],l=new Float32Array(getPackedRGBAArraySizeFromMatrixShape(r,n));encodeMatrixToPackedRGBA(a,r,n,l),uploadDataToTexture(e,t,s,u,l,e.RGBA)}function downloadMatrixFromOutputTextureAsync(e,t,r,n,a){return __awaiter(this,void 0,void 0,function(){var o,i,s,u,l;return __generator(this,function(c){switch(c.label){case 0:return o=e,i=new Float32Array(getUnpackedArraySizeFromMatrixSize(r*n,a.downloadUnpackNumChannels)),s=i instanceof Float32Array?4*i.length:i,u=e.createBuffer(),callAndCheck(e,function(){return e.bindBuffer(o.PIXEL_PACK_BUFFER,u)}),callAndCheck(e,function(){return e.bufferData(o.PIXEL_PACK_BUFFER,s,e.STATIC_DRAW)}),callAndCheck(e,function(){return o.readPixels(0,0,n,r,e.RGBA,e.FLOAT,0)}),[4,t.getBufferSubDataAsync(o.PIXEL_PACK_BUFFER,0,i)];case 1:return c.sent(),l=new Float32Array(r*n),decodeMatrixFromUnpackedArray(i,l,a.downloadUnpackNumChannels),[2,l]}})})}function downloadFloat32MatrixFromOutputTexture(e,t,r,n){var a=getUnpackedMatrixTextureShapeWidthHeight(t,r),o=a[0],i=a[1],s=new Float32Array(getUnpackedArraySizeFromMatrixSize(t*r,n.downloadUnpackNumChannels));callAndCheck(e,function(){return e.readPixels(0,0,o,i,n.downloadTextureFormat,e.FLOAT,s)});var u=new Float32Array(t*r);return decodeMatrixFromUnpackedArray(s,u,n.downloadUnpackNumChannels),u}function downloadByteEncodedFloatMatrixFromOutputTexture(e,t,r,n){var a=getUnpackedMatrixTextureShapeWidthHeight(t,r),o=a[0],i=a[1],s=new Uint8Array(getUnpackedArraySizeFromMatrixSize(t*r,4));return callAndCheck(e,function(){return e.readPixels(0,0,o,i,n.downloadTextureFormat,e.UNSIGNED_BYTE,s)}),new Float32Array(s.buffer)}function downloadMatrixFromPackedOutputTexture(e,t,r,n){var a=getPackedMatrixTextureShapeWidthHeight(t,r),o=a[0],i=a[1],s=new Float32Array(getPackedRGBAArraySizeFromMatrixShape(t,r));callAndCheck(e,function(){return e.readPixels(0,0,o,i,e.RGBA,e.FLOAT,s)});var u=new Float32Array(t*r);return decodeMatrixFromPackedRGBA(s,t,r,u)}var gpgpu_util=Object.freeze({getWebGLContextAttributes:getWebGLContextAttributes,createWebGLContext:createWebGLContext,createVertexShader:createVertexShader$1,createVertexBuffer:createVertexBuffer,createIndexBuffer:createIndexBuffer,getTextureConfig:getTextureConfig,createFloat32MatrixTexture:createFloat32MatrixTexture,createFloat16MatrixTexture:createFloat16MatrixTexture,createUnsignedBytesMatrixTexture:createUnsignedBytesMatrixTexture,createPackedMatrixTexture:createPackedMatrixTexture,bindVertexProgramAttributeStreams:bindVertexProgramAttributeStreams,uploadPixelDataToTexture:uploadPixelDataToTexture,uploadMatrixToTexture:uploadMatrixToTexture,uploadMatrixToPackedTexture:uploadMatrixToPackedTexture,downloadMatrixFromOutputTextureAsync:downloadMatrixFromOutputTextureAsync,downloadFloat32MatrixFromOutputTexture:downloadFloat32MatrixFromOutputTexture,downloadByteEncodedFloatMatrixFromOutputTexture:downloadByteEncodedFloatMatrixFromOutputTexture,downloadMatrixFromPackedOutputTexture:downloadMatrixFromPackedOutputTexture}),GPGPUContext=function(){function e(e){this.outputTexture=null,this.program=null,this.disposed=!1,this.autoDebugValidate=!1,this.vertexAttrsAreBound=!1,this.itemsToPoll=[],this.gl=null!=e?e:createWebGLContext(),1===ENV.get("WEBGL_VERSION")?(this.textureFloatExtension=getExtensionOrThrow(this.gl,"OES_texture_float"),this.colorBufferFloatExtension=this.gl.getExtension("WEBGL_color_buffer_float"),ENV.get("WEBGL_RENDER_FLOAT32_ENABLED")||(this.textureHalfFloatExtension=getExtensionOrThrow(this.gl,"OES_texture_half_float"),this.colorBufferHalfFloatExtension=this.gl.getExtension("EXT_color_buffer_half_float"))):this.colorBufferFloatExtension=getExtensionOrThrow(this.gl,"EXT_color_buffer_float"),this.loseContextExtension=getExtensionOrThrow(this.gl,"WEBGL_lose_context"),ENV.get("WEBGL_GET_BUFFER_SUB_DATA_ASYNC_EXTENSION_ENABLED")&&(this.getBufferSubDataAsyncExtension=this.gl.getExtension("WEBGL_get_buffer_sub_data_async")),this.vertexBuffer=createVertexBuffer(this.gl),this.indexBuffer=createIndexBuffer(this.gl),this.framebuffer=createFramebuffer(this.gl),this.textureConfig=getTextureConfig(this.gl,this.textureHalfFloatExtension)}return e.prototype.dispose=function(){var e=this;if(!this.disposed){null!=this.program&&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."),null!=this.outputTexture&&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.");var t=this.gl;callAndCheck(t,function(){return t.finish()}),callAndCheck(t,function(){return t.bindFramebuffer(t.FRAMEBUFFER,null)}),callAndCheck(t,function(){return t.deleteFramebuffer(e.framebuffer)}),callAndCheck(t,function(){return t.bindBuffer(t.ARRAY_BUFFER,null)}),callAndCheck(t,function(){return t.deleteBuffer(e.vertexBuffer)}),callAndCheck(t,function(){return t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,null)}),callAndCheck(t,function(){return t.deleteBuffer(e.indexBuffer)}),this.loseContextExtension.loseContext(),this.disposed=!0}},e.prototype.enableAutomaticDebugValidation=function(e){this.autoDebugValidate=e,enableDebugWebGLErrorChecking(e)},e.prototype.createFloat32MatrixTexture=function(e,t){return this.throwIfDisposed(),createFloat32MatrixTexture(this.gl,e,t,this.textureConfig)},e.prototype.createFloat16MatrixTexture=function(e,t){return this.throwIfDisposed(),createFloat16MatrixTexture(this.gl,e,t,this.textureConfig)},e.prototype.createUnsignedBytesMatrixTexture=function(e,t){return this.throwIfDisposed(),createUnsignedBytesMatrixTexture(this.gl,e,t,this.textureConfig)},e.prototype.uploadPixelDataToTexture=function(e,t){this.throwIfDisposed(),uploadPixelDataToTexture(this.gl,e,t)},e.prototype.createPackedMatrixTexture=function(e,t){return this.throwIfDisposed(),createPackedMatrixTexture(this.gl,e,t,this.textureConfig)},e.prototype.deleteMatrixTexture=function(e){var t=this;this.throwIfDisposed(),this.outputTexture===e&&(unbindColorTextureFromFramebuffer(this.gl,this.framebuffer),this.outputTexture=null),callAndCheck(this.gl,function(){return t.gl.deleteTexture(e)})},e.prototype.uploadMatrixToTexture=function(e,t,r,n){this.throwIfDisposed();var a=getNumChannels();return uploadMatrixToTexture(this.gl,e,t,r,n,a,this.textureConfig)},e.prototype.uploadMatrixToPackedTexture=function(e,t,r,n){return this.throwIfDisposed(),uploadMatrixToPackedTexture(this.gl,e,t,r,n,this.textureConfig)},e.prototype.downloadFloat32MatrixFromOutputTexture=function(e,t,r){var n=this;return this.downloadMatrixDriver(e,function(){return downloadFloat32MatrixFromOutputTexture(n.gl,t,r,n.textureConfig)})},e.prototype.downloadByteEncodedFloatMatrixFromOutputTexture=function(e,t,r){var n=this;return this.downloadMatrixDriver(e,function(){return downloadByteEncodedFloatMatrixFromOutputTexture(n.gl,t,r,n.textureConfig)})},e.prototype.downloadMatrixFromTextureAsync=function(e,t,r){return __awaiter(this,void 0,void 0,function(){var n=this;return __generator(this,function(a){if(null==this.getBufferSubDataAsyncExtension)throw new Error("Cannot download matrix from output texture asynchronously, WEBGL_get_buffer_sub_data_async is not enabled.");return[2,this.downloadMatrixDriverAsync(e,function(){return downloadMatrixFromOutputTextureAsync(n.gl,n.getBufferSubDataAsyncExtension,t,r,n.textureConfig)})]})})},e.prototype.downloadMatrixFromPackedTexture=function(e,t,r){var n=this;return this.downloadMatrixDriver(e,function(){return downloadMatrixFromPackedOutputTexture(n.gl,t,r,n.textureConfig)})},e.prototype.createProgram=function(e){this.throwIfDisposed();var t=this.gl,r=createFragmentShader(t,e),n=createVertexShader$1(t),a=createProgram(t);return callAndCheck(t,function(){return t.attachShader(a,n)}),callAndCheck(t,function(){return t.attachShader(a,r)}),linkProgram(t,a),this.autoDebugValidate&&validateProgram(t,a),this.vertexAttrsAreBound||(this.setProgram(a),this.vertexAttrsAreBound=bindVertexProgramAttributeStreams(t,this.program,this.vertexBuffer)),a},e.prototype.deleteProgram=function(e){var t=this;this.throwIfDisposed(),e===this.program&&(this.program=null),null!=e&&callAndCheck(this.gl,function(){return t.gl.deleteProgram(e)})},e.prototype.setProgram=function(e){var t=this;this.throwIfDisposed(),this.program=e,null!=this.program&&this.autoDebugValidate&&validateProgram(this.gl,this.program),callAndCheck(this.gl,function(){return t.gl.useProgram(e)})},e.prototype.getUniformLocation=function(e,t,r){return void 0===r&&(r=!0),this.throwIfDisposed(),r?getProgramUniformLocationOrThrow(this.gl,e,t):getProgramUniformLocation(this.gl,e,t)},e.prototype.getAttributeLocation=function(e,t){var r=this;return this.throwIfDisposed(),callAndCheck(this.gl,function(){return r.gl.getAttribLocation(e,t)})},e.prototype.getUniformLocationNoThrow=function(e,t){return this.throwIfDisposed(),this.gl.getUniformLocation(e,t)},e.prototype.setInputMatrixTexture=function(e,t,r){this.throwIfDisposed(),this.throwIfNoProgram(),bindTextureToProgramUniformSampler(this.gl,this.program,e,t,r)},e.prototype.setOutputMatrixTexture=function(e,t,r){this.setOutputMatrixTextureDriver(e,r,t)},e.prototype.setOutputPackedMatrixTexture=function(e,t,r){this.throwIfDisposed();var n=getPackedMatrixTextureShapeWidthHeight(t,r),a=n[0],o=n[1];this.setOutputMatrixTextureDriver(e,a,o)},e.prototype.setOutputMatrixWriteRegion=function(e,t,r,n){this.setOutputMatrixWriteRegionDriver(r,e,n,t)},e.prototype.setOutputPackedMatrixWriteRegion=function(e,t,r,n){throw new Error("setOutputPackedMatrixWriteRegion not implemented.")},e.prototype.debugValidate=function(){null!=this.program&&validateProgram(this.gl,this.program),validateFramebuffer(this.gl)},e.prototype.executeProgram=function(){this.throwIfDisposed(),this.throwIfNoProgram();var e=this.gl;this.autoDebugValidate&&this.debugValidate(),callAndCheck(e,function(){return e.drawElements(e.TRIANGLES,6,e.UNSIGNED_SHORT,0)})},e.prototype.blockUntilAllProgramsCompleted=function(){var e=this;this.throwIfDisposed(),callAndCheck(this.gl,function(){return e.gl.finish()})},e.prototype.getQueryTimerExtension=function(){return null==this.disjointQueryTimerExtension&&(this.disjointQueryTimerExtension=getExtensionOrThrow(this.gl,2===ENV.get("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_VERSION")?"EXT_disjoint_timer_query_webgl2":"EXT_disjoint_timer_query")),this.disjointQueryTimerExtension},e.prototype.getQueryTimerExtensionWebGL2=function(){return this.getQueryTimerExtension()},e.prototype.getQueryTimerExtensionWebGL1=function(){return this.getQueryTimerExtension()},e.prototype.runQuery=function(e){var t=this.beginQuery();return e(),this.endQuery(),this.pollQueryTime(t)},e.prototype.beginQuery=function(){if(2===ENV.get("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_VERSION")){var e=this.gl,t=this.getQueryTimerExtensionWebGL2(),r=e.createQuery();return e.beginQuery(t.TIME_ELAPSED_EXT,r),r}var n=this.getQueryTimerExtensionWebGL1(),a=n.createQueryEXT();return n.beginQueryEXT(n.TIME_ELAPSED_EXT,a),a},e.prototype.endQuery=function(){if(2!==ENV.get("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_VERSION")){var e=this.getQueryTimerExtensionWebGL1();e.endQueryEXT(e.TIME_ELAPSED_EXT)}else{var t=this.gl,r=this.getQueryTimerExtensionWebGL2();t.endQuery(r.TIME_ELAPSED_EXT)}},e.prototype.isQueryAvailable=function(e,t){if(0===t)return!0;if(2===t){var r=this.gl,n=this.getQueryTimerExtensionWebGL2(),a=r.getQueryParameter(e,r.QUERY_RESULT_AVAILABLE);return null==this.disjoint&&(this.disjoint=this.gl.getParameter(n.GPU_DISJOINT_EXT)),a&&!this.disjoint}return a=(n=this.getQueryTimerExtensionWebGL1()).getQueryObjectEXT(e,n.QUERY_RESULT_AVAILABLE_EXT),null==this.disjoint&&(this.disjoint=this.gl.getParameter(n.GPU_DISJOINT_EXT)),a&&!this.disjoint},e.prototype.pollQueryTime=function(e){var t=this;return new Promise(function(r){var n=ENV.get("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_VERSION");t.addItemToPoll(function(){return t.isQueryAvailable(e,n)},function(){return r(t.getQueryTime(e,n))})})},e.prototype.pollItems=function(){for(var e=binSearchLastTrue(this.itemsToPoll.map(function(e){return e.isDoneFn})),t=0;t<=e;++t)(0,this.itemsToPoll[t].resolveFn)();this.itemsToPoll=this.itemsToPoll.slice(e+1)},e.prototype.addItemToPoll=function(e,t){var r=this;this.itemsToPoll.push({isDoneFn:e,resolveFn:t}),this.itemsToPoll.length>1||repeatedTry(function(){return r.pollItems(),0===r.itemsToPoll.length})},e.prototype.getQueryTime=function(e,t){if(0===t)return null;if(2===t){var r=this.gl;return r.getQueryParameter(e,r.QUERY_RESULT)/1e6}var n=this.getQueryTimerExtensionWebGL1();return n.getQueryObjectEXT(e,n.QUERY_RESULT_EXT)/1e6},e.prototype.downloadMatrixDriverSetup=function(e){this.throwIfDisposed(),bindColorTextureToFramebuffer(this.gl,e,this.framebuffer),this.autoDebugValidate&&validateFramebuffer(this.gl)},e.prototype.downloadMatrixDriverTeardown=function(){null!=this.outputTexture?(bindColorTextureToFramebuffer(this.gl,this.outputTexture,this.framebuffer),this.autoDebugValidate&&validateFramebuffer(this.gl)):unbindColorTextureFromFramebuffer(this.gl,this.framebuffer)},e.prototype.downloadMatrixDriver=function(e,t){this.downloadMatrixDriverSetup(e);var r=t();return this.downloadMatrixDriverTeardown(),r},e.prototype.downloadMatrixDriverAsync=function(e,t){return __awaiter(this,void 0,void 0,function(){var r;return __generator(this,function(n){switch(n.label){case 0:return this.downloadMatrixDriverSetup(e),[4,t()];case 1:return r=n.sent(),this.downloadMatrixDriverTeardown(),[2,r]}})})},e.prototype.setOutputMatrixTextureDriver=function(e,t,r){this.throwIfDisposed();var n=this.gl;bindColorTextureToFramebuffer(n,e,this.framebuffer),this.autoDebugValidate&&validateFramebuffer(n),this.outputTexture=e,callAndCheck(n,function(){return n.viewport(0,0,t,r)}),callAndCheck(n,function(){return n.scissor(0,0,t,r)})},e.prototype.setOutputMatrixWriteRegionDriver=function(e,t,r,n){var a=this;this.throwIfDisposed(),callAndCheck(this.gl,function(){return a.gl.scissor(e,t,r,n)})},e.prototype.throwIfDisposed=function(){if(this.disposed)throw new Error("Attempted to use disposed GPGPUContext.")},e.prototype.throwIfNoProgram=function(){if(null==this.program)throw new Error("No GPU program is currently set.")},e}();function binSearchLastTrue(e){for(var t=0,r=e.length-1,n=-1;t<=r;){var a=t+r>>1;e[a]()?(n=a,t=a+1):r=a-1}return n}function compileProgram(e,t,r,n){for(var a=t.userCode,o=r.map(function(e,r){var n={logicalShape:e.tensor.shape,texShape:e.isUniform?null:e.texData.texShape,isUniform:e.isUniform};return{name:t.variableNames[r],shapeInfo:n}}),i=o.map(function(e){return e.shapeInfo}),s={logicalShape:n.tensor.shape,texShape:n.texData.texShape,isUniform:!1},u=makeShader(o,s,a,!0===t.supportsBroadcasting),l=e.createProgram(u),c={},p=0;p4)throw Error("Where for rank "+r+" is not yet supported");if(1===r)a="resRC",n="resRC";else{for(var o=["resRC.x","resRC.y","resRC.z","resRC.w"],i=[],s=[],u=0;u= 1.0) {\n setOutput(getA("+a+"));\n } else {\n setOutput(getB("+a+"));\n }\n }\n "},LRNProgram=function(e,t,r,n,a){this.variableNames=["x"],this.outputShape=[];var o,i=t,s=e[3]-1;this.outputShape=e;var u="float("+r+") + float("+n+") * sum";o=.5===a?"inversesqrt("+u+")":1===a?"1.0/("+u+")":"exp(log("+u+") * float(-"+a+"));",this.userCode="\n void main() {\n ivec4 coords = getOutputCoords();\n int b = coords[0];\n int r = coords[1];\n int c = coords[2];\n int d = coords[3];\n float x = getX(b, r, c, d);\n float sum = 0.0;\n for (int j = -"+i+"; j <= "+i+"; j++) {\n int idx = d + j;\n if (idx >= 0 && idx <= "+s+") {\n float z = getX(b, r, c, idx);\n sum += z * z;\n }\n }\n float val = x * "+o+";\n setOutput(val);\n }\n "},MaxPool2DBackpropProgram=function(e){this.variableNames=["dy","maxPos"],this.outputShape=e.inShape;var t=e.filterHeight,r=e.filterWidth,n=e.strideHeight,a=e.strideWidth,o=t-1-e.padInfo.top,i=r-1-e.padInfo.left,s=t*r-1;this.userCode="\n const ivec2 pads = ivec2("+o+", "+i+");\n\n void main() {\n ivec4 coords = getOutputCoords();\n int b = coords[0];\n int d = coords[3];\n\n ivec2 dyRCCorner = coords.yz - pads;\n int dyRCorner = dyRCCorner.x;\n int dyCCorner = dyRCCorner.y;\n\n // Convolve dy(?, ?, d) with pos mask(:, :, d) to get dx(xR, xC, d).\n // ? = to be determined. : = across all values in that axis.\n float dotProd = 0.0;\n for (int wR = 0; wR < "+t+"; wR++) {\n float dyR = float(dyRCorner + wR) / "+n+".0;\n\n if (dyR < 0.0 || dyR >= "+e.outHeight+".0 || fract(dyR) > 0.0) {\n continue;\n }\n int idyR = int(dyR);\n\n for (int wC = 0; wC < "+r+"; wC++) {\n float dyC = float(dyCCorner + wC) / "+a+".0;\n\n if (dyC < 0.0 || dyC >= "+e.outWidth+".0 ||\n fract(dyC) > 0.0) {\n continue;\n }\n int idyC = int(dyC);\n\n float dyValue = getDy(b, idyR, idyC, d);\n int maxPosValue = "+s+" - int(getMaxPos(b, idyR, idyC, d));\n\n // Get the current value, check it against the value from the\n // position matrix.\n int curPosValue = wR * "+r+" + wC;\n float mask = float(maxPosValue == curPosValue ? 1.0 : 0.0);\n\n dotProd += dyValue * mask;\n }\n }\n setOutput(dotProd);\n }\n "},MatMulProgram=function(e,t,r,n){void 0===r&&(r=!1),void 0===n&&(n=!1),this.variableNames=["matrixA","matrixB"];var a=r?e[1]:e[0],o=n?t[0]:t[1],i=r?e[0]:e[1];this.outputShape=[a,o];var s=function(e,t){return r?t+" + "+e+", aRow":"aRow, "+t+" + "+e},u=function(e,t){return n?"bCol, "+t+" + "+e:t+" + "+e+", bCol"},l=4*Math.floor(i/4),c=i%4;this.userCode=" float dotARowBCol(int aRow, int bCol) {\n float result = 0.0;\n for (int i = 0; i < "+l+"; i += 4) {\n vec4 a = vec4(\n getMatrixA("+s(0,"i")+"),\n getMatrixA("+s(1,"i")+"),\n getMatrixA("+s(2,"i")+"),\n getMatrixA("+s(3,"i")+")\n );\n vec4 b = vec4(\n getMatrixB("+u(0,"i")+"),\n getMatrixB("+u(1,"i")+"),\n getMatrixB("+u(2,"i")+"),\n getMatrixB("+u(3,"i")+")\n );\n\n result += dot(a, b);\n }\n\n if ("+(1===c)+") {\n result += getMatrixA("+s(0,l)+") *\n getMatrixB("+u(0,l)+");\n } else if ("+(2===c)+") {\n vec2 a = vec2(\n getMatrixA("+s(0,l)+"),\n getMatrixA("+s(1,l)+")\n );\n vec2 b = vec2(\n getMatrixB("+u(0,l)+"),\n getMatrixB("+u(1,l)+")\n );\n result += dot(a, b);\n } else if ("+(3===c)+") {\n vec3 a = vec3(\n getMatrixA("+s(0,l)+"),\n getMatrixA("+s(1,l)+"),\n getMatrixA("+s(2,l)+")\n );\n vec3 b = vec3(\n getMatrixB("+u(0,l)+"),\n getMatrixB("+u(1,l)+"),\n getMatrixB("+u(2,l)+")\n );\n result += dot(a, b);\n }\n\n return result;\n }\n\n void main() {\n ivec2 resRC = getOutputCoords();\n setOutput(dotARowBCol(resRC.x, resRC.y));\n }\n "},MultinomialProgram=function(){function e(e,t,r){this.variableNames=["probs"],this.outputShape=[e,r],this.userCode="\n uniform float seed;\n\n void main() {\n ivec2 coords = getOutputCoords();\n int batch = coords[0];\n\n float r = random(seed);\n float cdf = 0.0;\n\n for (int i = 0; i < "+(t-1)+"; i++) {\n cdf += getProbs(batch, i);\n\n if (r < cdf) {\n setOutput(float(i));\n return;\n }\n }\n\n // If no other event happened, last event happened.\n setOutput(float("+(t-1)+"));\n }\n "}return e.prototype.getCustomSetupFunc=function(e){var t=this;return function(r,n){null==t.seedLoc&&(t.seedLoc=r.getUniformLocation(n,"seed")),r.gl.uniform1f(t.seedLoc,e)}},e}(),OneHotProgram=function(e,t,r,n){this.variableNames=["indices"],this.outputShape=[e,t],this.userCode="\n void main() {\n ivec2 coords = getOutputCoords();\n int index = round(getIndices(coords.x));\n setOutput(mix(float("+n+"), float("+r+"),\n float(index == coords.y)));\n }\n "},PadProgram=function(e,t,r){this.variableNames=["x"],this.outputShape=t.map(function(t,r){return t[0]+e[r]+t[1]});var n=e.length,a=getCoordsDataType(n),o=t.map(function(e){return e[0]}).join(","),i=t.map(function(t,r){return t[0]+e[r]}).join(","),s=["coords[0]","coords[1]","coords[2]","coords[3]"].slice(0,n);this.userCode=1!==n?"\n "+a+" start = "+a+"("+o+");\n "+a+" end = "+a+"("+i+");\n\n void main() {\n "+a+" outC = getOutputCoords();\n if (any(lessThan(outC, start)) || any(greaterThanEqual(outC, end))) {\n setOutput(float("+r+"));\n } else {\n "+a+" coords = outC - start;\n setOutput(getX("+s+"));\n }\n }\n ":"\n int start = "+o+";\n int end = "+i+";\n\n void main() {\n int outC = getOutputCoords();\n if (outC < start || outC >= end) {\n setOutput(float("+r+"));\n } else {\n setOutput(getX(outC - start));\n }\n }\n "},Pool2DProgram=function(e,t,r){if(this.variableNames=["x"],"avg"===t&&r)throw new Error("Cannot compute positions for average pool.");var n=e.filterHeight,a=e.filterWidth,o=e.strideHeight,i=e.strideWidth,s=e.padInfo.top,u=e.padInfo.left;this.outputShape=e.outShape;var l="avg"===t,c="0.0";if(l||(c="-1.0 / 0.0"),r)this.userCode="\n const ivec2 strides = ivec2("+o+", "+i+");\n const ivec2 pads = ivec2("+s+", "+u+");\n\n void main() {\n ivec4 coords = getOutputCoords();\n int batch = coords[0];\n int d = coords[3];\n\n ivec2 xRCCorner = coords.yz * strides - pads;\n int xRCorner = xRCCorner.x;\n int xCCorner = xRCCorner.y;\n\n // max/min x(?, ?, d) to get y(yR, yC, d).\n // ? = to be determined\n float minMaxValue = 0.0;\n float minMaxValueFound = 0.0;\n int minMaxPosition = 0;\n float avgValue = 0.0;\n\n for (int wR = 0; wR < "+n+"; wR++) {\n int xR = xRCorner + wR;\n\n if (xR < 0 || xR >= "+e.inHeight+") {\n continue;\n }\n\n for (int wC = 0; wC < "+a+"; wC++) {\n int xC = xCCorner + wC;\n\n if (xC < 0 || xC >= "+e.inWidth+") {\n continue;\n }\n\n float value = getX(batch, xR, xC, d);\n\n // If a min / max value has already been found, use it. If not,\n // use the current value.\n float currMinMaxValue = mix(\n value, minMaxValue, minMaxValueFound);\n if (value >= currMinMaxValue) {\n minMaxValue = value;\n minMaxValueFound = 1.0;\n minMaxPosition = wR * "+a+" + wC;\n }\n }\n }\n setOutput(float(minMaxPosition));\n }\n ";else{var p=t+"("+t+"("+t+"(minMaxValue[0], minMaxValue[1]), minMaxValue[2]), minMaxValue[3])";"avg"===t&&(p="avgValue / count");var d=4*Math.floor(a/4),h=a%4,f="\n if ("+l+") {\n avgValue += dot(values, ones);\n } else {\n minMaxValue = max(values, minMaxValue);\n }\n ";this.userCode="\n const ivec2 strides = ivec2("+o+", "+i+");\n const ivec2 pads = ivec2("+s+", "+u+");\n const float initializationValue = "+c+";\n const vec4 ones = vec4(1.0, 1.0, 1.0, 1.0);\n\n float count = 0.0;\n\n float getValue(int batch, int xR, int xC, int d) {\n if (xC < 0 || xC >= "+e.inWidth+") {\n return initializationValue;\n }\n count += 1.0;\n return getX(batch, xR, xC, d);\n }\n\n void main() {\n ivec4 coords = getOutputCoords();\n int batch = coords[0];\n int d = coords[3];\n\n ivec2 xRCCorner = coords.yz * strides - pads;\n int xRCorner = xRCCorner.x;\n int xCCorner = xRCCorner.y;\n\n // max/min x(?, ?, d) to get y(yR, yC, d).\n // ? = to be determined\n vec4 minMaxValue = vec4("+c+");\n float avgValue = 0.0;\n count = 0.0;\n\n for (int wR = 0; wR < "+n+"; wR++) {\n int xR = xRCorner + wR;\n\n if (xR < 0 || xR >= "+e.inHeight+") {\n continue;\n }\n\n for (int wC = 0; wC < "+d+"; wC += 4) {\n int xC = xCCorner + wC;\n\n vec4 values = vec4(\n getValue(batch, xR, xC, d),\n getValue(batch, xR, xC + 1, d),\n getValue(batch, xR, xC + 2, d),\n getValue(batch, xR, xC + 3, d)\n );\n\n "+f+"\n }\n\n int xC = xCCorner + "+d+";\n if ("+(1===h)+") {\n vec4 values = vec4(\n getValue(batch, xR, xC, d),\n initializationValue,\n initializationValue,\n initializationValue\n );\n\n "+f+"\n } else if ("+(2===h)+") {\n vec4 values = vec4(\n getValue(batch, xR, xC, d),\n getValue(batch, xR, xC + 1, d),\n initializationValue,\n initializationValue\n );\n\n "+f+"\n } else if ("+(3===h)+") {\n vec4 values = vec4(\n getValue(batch, xR, xC, d),\n getValue(batch, xR, xC + 1, d),\n getValue(batch, xR, xC + 2, d),\n initializationValue\n );\n\n "+f+"\n }\n }\n setOutput("+p+");\n }\n "}},ReduceProgram=function(e,t){this.variableNames=["x"];var r=e.windowSize,n=e.batchSize,a=e.inSize,o=Math.ceil(a/r);this.outputShape=[n,o];var i="0.0",s="";"min"===t?(i="1.0 / 0.0",s="min"):"max"===t&&(i="-1.0 / 0.0",s="max");var u=t+"("+t+"("+t+"(minMaxValue[0], minMaxValue[1]), minMaxValue[2]), minMaxValue[3])";"sum"===t?u="sumValue":"all"===t?u="allValue":"any"===t&&(u="anyValue");var l=4*Math.floor(r/4),c=r%4,p="\n if ("+("sum"===t)+") {\n sumValue += dot(values, ones);\n } else {\n minMaxValue = "+s+"(values, minMaxValue);\n }\n ",d="vec4";"all"===t?(i="1.0",p="\n bool reducedAllValue = all(values);\n float floatedReducedAllValue = float(reducedAllValue);\n allValue = float(allValue >= 1.0 && floatedReducedAllValue >= 1.0);\n ",d="bvec4"):"any"===t&&(i="0.0",p="\n bool reducedAnyValue = any(values);\n float floatedReducedAnyValue = float(reducedAnyValue);\n anyValue = float(anyValue >= 1.0 || floatedReducedAnyValue >= 1.0);\n ",d="bvec4");var h="";a%r>0&&(h="\n if (inIdx < 0 || inIdx >= "+a+") {\n return initializationValue;\n }\n "),this.userCode="\n const float initializationValue = "+i+";\n const vec4 ones = vec4(1.0, 1.0, 1.0, 1.0);\n\n float getValue(int batch, int inIdx) {\n "+h+"\n return getX(batch, inIdx);\n }\n\n void main() {\n ivec2 coords = getOutputCoords();\n int batch = coords[0];\n int outIdx = coords[1];\n int inOffset = outIdx * "+r+";\n\n vec4 minMaxValue = vec4("+i+");\n float sumValue = 0.0;\n float allValue = 1.0;\n float anyValue = 0.0;\n\n for (int i = 0; i < "+l+"; i += 4) {\n int inIdx = inOffset + i;\n "+d+" values = "+d+"(\n getValue(batch, inIdx),\n getValue(batch, inIdx + 1),\n getValue(batch, inIdx + 2),\n getValue(batch, inIdx + 3)\n );\n\n "+p+"\n }\n\n int inIdx = inOffset + "+l+";\n if ("+(1===c)+") {\n "+d+" values = "+d+"(\n getValue(batch, inIdx),\n initializationValue,\n initializationValue,\n initializationValue\n );\n\n "+p+"\n } else if ("+(2===c)+") {\n "+d+" values = "+d+"(\n getValue(batch, inIdx),\n getValue(batch, inIdx + 1),\n initializationValue,\n initializationValue\n );\n\n "+p+"\n } else if ("+(3===c)+") {\n "+d+" values = "+d+"(\n getValue(batch, inIdx),\n getValue(batch, inIdx + 1),\n getValue(batch, inIdx + 2),\n initializationValue\n );\n\n "+p+"\n }\n setOutput("+u+");\n }\n "},ResizeBilinearBackpropProgram=function(e,t,r){this.variableNames=["dy"],this.outputShape=[],this.outputShape=t.shape;var n=t.shape,a=n[1],o=n[2],i=e.shape,s=i[1],u=i[2],l=[r&&s>1?a-1:a,r&&u>1?o-1:o],c=[r&&s>1?s-1:s,r&&u>1?u-1:u],p=l[0]/c[0],d=l[1]/c[1],h=1/p,f=1/d,m=2*Math.ceil(h)+2,g=2*Math.ceil(f)+2;this.userCode="\n void main() {\n ivec4 coords = getOutputCoords();\n int b = coords[0];\n int d = coords[3];\n int r = coords[1];\n int c = coords[2];\n\n float accumulator = 0.0;\n\n const float heightScale = float("+p+");\n const float widthScale = float("+d+");\n\n const float invHeightScale = float("+h+");\n const float invWidthScale = float("+f+");\n\n const int winHeight = int("+m+");\n const int winWidth = int("+g+");\n\n // Compute bounds for where in dy we will look\n float startRLerp = floor(float(r) * invHeightScale);\n int startDyR = int(startRLerp - float(winHeight / 2));\n\n float startCLerp = floor(float(c) * invWidthScale);\n int startDyC = int(startCLerp - float(winWidth / 2));\n\n // Loop over dy\n for (int dyROffset = 0; dyROffset < winHeight; dyROffset++) {\n int dyR = dyROffset + startDyR;\n\n // Guard against the window exceeding the bounds of dy\n if (dyR < 0 || dyR >= "+s+") {\n continue;\n }\n\n for (int dyCOffset = 0; dyCOffset < winWidth; dyCOffset++) {\n int dyC = dyCOffset + startDyC;\n\n // Guard against the window exceeding the bounds of dy\n if (dyC < 0 || dyC >= "+u+") {\n continue;\n }\n\n float dxR = float(dyR) * heightScale;\n int topDxRIndex = int(floor(dxR));\n int bottomDxRIndex = int(min(ceil(dxR), "+(a-1)+".0));\n float dxRLerp = dxR - float(topDxRIndex);\n float inverseDxRLerp = 1.0 - dxRLerp;\n\n float dxC = float(dyC) * widthScale;\n int leftDxCIndex = int(floor(dxC));\n int rightDxCIndex = int(min(ceil(dxC), "+(o-1)+".0));\n float dxCLerp = dxC - float(leftDxCIndex);\n float inverseDxCLerp = 1.0 - dxCLerp;\n\n if (r == topDxRIndex && c == leftDxCIndex) {\n // topLeft\n accumulator +=\n getDy(b, dyR, dyC, d) * inverseDxRLerp * inverseDxCLerp;\n }\n\n if (r == topDxRIndex && c == rightDxCIndex) {\n // topRight\n accumulator += getDy(b, dyR, dyC, d) * inverseDxRLerp * dxCLerp;\n }\n\n if (r == bottomDxRIndex && c == leftDxCIndex) {\n // bottomLeft\n accumulator += getDy(b, dyR, dyC, d) * dxRLerp * inverseDxCLerp;\n }\n\n if (r == bottomDxRIndex && c == rightDxCIndex) {\n // bottomRight\n accumulator += getDy(b, dyR, dyC, d) * dxRLerp * dxCLerp;\n }\n }\n }\n // End loop over dy\n\n setOutput(accumulator);\n }\n "},ResizeBilinearProgram=function(e,t,r,n){this.variableNames=["A"],this.outputShape=[];var a=e[0],o=e[1],i=e[2],s=e[3];this.outputShape=[a,t,r,s];var u=[n&&t>1?o-1:o,n&&r>1?i-1:i],l=[n&&t>1?t-1:t,n&&r>1?r-1:r];this.userCode="\n const vec2 effectiveInputOverOutputRatioRC = vec2(\n "+u[0]/l[0]+",\n "+u[1]/l[1]+");\n const vec2 inputShapeRC = vec2("+o+".0, "+i+".0);\n\n void main() {\n ivec4 coords = getOutputCoords();\n int b = coords[0];\n int d = coords[3];\n ivec2 yRC = coords.yz;\n\n // Fractional source index.\n vec2 sourceFracIndexRC = vec2(yRC) * effectiveInputOverOutputRatioRC;\n\n // Compute the four integer indices.\n ivec2 sourceFloorRC = ivec2(sourceFracIndexRC);\n ivec2 sourceCeilRC = ivec2(\n min(inputShapeRC - 1.0, ceil(sourceFracIndexRC)));\n\n float topLeft = getA(b, sourceFloorRC.x, sourceFloorRC.y, d);\n float bottomLeft = getA(b, sourceCeilRC.x, sourceFloorRC.y, d);\n float topRight = getA(b, sourceFloorRC.x, sourceCeilRC.y, d);\n float bottomRight = getA(b, sourceCeilRC.x, sourceCeilRC.y, d);\n\n vec2 fracRC = sourceFracIndexRC - vec2(sourceFloorRC);\n\n float top = topLeft + (topRight - topLeft) * fracRC.y;\n float bottom = bottomLeft + (bottomRight - bottomLeft) * fracRC.y;\n float newValue = top + (bottom - top) * fracRC.x;\n\n setOutput(newValue);\n }\n "},ResizeNearestNeigborBackpropProgram=function(e,t,r){this.variableNames=["dy"],this.outputShape=[],this.outputShape=t.shape;var n=t.shape,a=n[1],o=n[2],i=e.shape,s=i[1],u=i[2],l=[r&&s>1?a-1:a,r&&u>1?o-1:o],c=[r&&s>1?s-1:s,r&&u>1?u-1:u],p=l[0]/c[0],d=l[1]/c[1],h=1/p,f=1/d,m=2*Math.ceil(h)+2,g=2*Math.ceil(f)+2;this.userCode="\n void main() {\n ivec4 coords = getOutputCoords();\n int b = coords[0];\n int d = coords[3];\n int r = coords[1];\n int c = coords[2];\n\n float accumulator = 0.0;\n\n const float heightScale = float("+p+");\n const float widthScale = float("+d+");\n\n const float invHeightScale = float("+h+");\n const float invWidthScale = float("+f+");\n\n const int winHeight = int("+m+");\n const int winWidth = int("+g+");\n\n // Compute bounds for where in dy we will look\n float startRLerp = floor(float(r) * invHeightScale);\n int startDyR = int(floor(startRLerp - float(winHeight / 2)));\n\n float startCLerp = floor(float(c) * invWidthScale);\n int startDyC = int(floor(startCLerp - float(winWidth / 2)));\n\n // Loop over dy\n for (int dyROffset = 0; dyROffset < winHeight; dyROffset++) {\n int dyR = dyROffset + startDyR;\n\n // Guard against the window exceeding the bounds of dy\n if (dyR < 0 || dyR >= "+s+") {\n continue;\n }\n\n for (int dyCOffset = 0; dyCOffset < winWidth; dyCOffset++) {\n int dyC = dyCOffset + startDyC;\n\n // Guard against the window exceeding the bounds of dy\n if (dyC < 0 || dyC >= "+u+") {\n continue;\n }\n\n float sourceFracRow =\n float("+l[0]+") *\n (float(dyR) / float("+c[0]+"));\n\n float sourceFracCol =\n float("+l[1]+") *\n (float(dyC) / float("+c[1]+"));\n\n int sourceNearestRow = int(min(\n float(int("+a+") - 1),\n "+r+" ? float(round(sourceFracRow)) :\n float(floor(sourceFracRow))));\n\n int sourceNearestCol = int(min(\n float(int("+o+") - 1),\n "+r+" ? float(round(sourceFracCol)) :\n float(floor(sourceFracCol))));\n\n if (r == sourceNearestRow && c == sourceNearestCol) {\n accumulator += getDy(b, dyR, dyC, d);\n }\n }\n }\n // End loop over dy\n\n setOutput(accumulator);\n }\n "},ResizeNearestNeighborProgram=function(e,t,r,n){this.variableNames=["A"],this.outputShape=[];var a=e[0],o=e[1],i=e[2],s=e[3];this.outputShape=[a,t,r,s];var u=[n&&t>1?o-1:o,n&&r>1?i-1:i],l=[n&&t>1?t-1:t,n&&r>1?r-1:r],c=n?"0.5":"0.0";this.userCode="\n const vec2 effectiveInputOverOutputRatioRC = vec2(\n "+u[0]/l[0]+",\n "+u[1]/l[1]+");\n const vec2 inputShapeRC = vec2("+o+".0, "+i+".0);\n\n void main() {\n ivec4 coords = getOutputCoords();\n int b = coords[0];\n int d = coords[3];\n ivec2 yRC = coords.yz;\n\n // Fractional source index.\n vec2 sourceFracIndexRC = vec2(yRC) * effectiveInputOverOutputRatioRC;\n\n // Compute the coordinators of nearest neighbor point.\n ivec2 sourceNearestRC = ivec2(\n min(inputShapeRC - 1.0, floor(sourceFracIndexRC + "+c+")));\n\n float newValue = getA(b, sourceNearestRC.x, sourceNearestRC.y, d);\n\n setOutput(newValue);\n }\n "},ReverseProgram=function(e,t){this.variableNames=["x"];var r=e.length;if(r>4)throw new Error("WebGL backend: Reverse of rank-"+r+" tensor is not yet supported");if(this.outputShape=e,1!==r){var n=e.map(function(r,n){return function(r){return-1!==t.indexOf(r)&&1!==e[r]?e[r]+" - coords["+r+"] - 1":"coords["+r+"]"}(n)}).join(","),a=getCoordsDataType(r);this.userCode="\n void main() {\n "+a+" coords = getOutputCoords();\n setOutput(getX("+n+"));\n }\n "}else this.userCode="\n void main() {\n int coord = getOutputCoords();\n setOutput(getX("+e[0]+" - coord - 1));\n }\n "},SegmentOpProgram=function(e,t){this.variableNames=["x","segmentIds"];var r=e.windowSize,n=e.batchSize,a=e.inSize,o=e.numSegments,i=o*Math.ceil(a/r);this.outputShape=[n,i];var s=4*Math.floor(r/4),u=r%4,l="\n sumValue += dot(values, filter);\n ",c="";a%r>0&&(c="\n if (inIdx < 0 || inIdx >= "+a+") {\n return initializationValue;\n }\n ");var p="";a%r>0&&(p="\n if (inIdx < 0 || inIdx >= "+a+") {\n return -1.0;\n }\n "),this.userCode="\n const float initializationValue = 0.0;\n\n float getValue(int batch, int inIdx) {\n "+c+"\n return getX(batch, inIdx);\n }\n\n float getSegmentIdAtIndex(int inIdx) {\n "+p+"\n return getSegmentIds(inIdx);\n }\n\n void main() {\n ivec2 coords = getOutputCoords();\n int batch = coords[0];\n int outIdx = coords[1];\n int inOffset = int(floor(float(outIdx) / float(\n "+o+")) * float("+r+"));\n int currentSeg = int(mod(float(outIdx), float("+o+")));\n\n float sumValue = 0.0;\n\n for (int i = 0; i < "+s+"; i += 4) {\n int inIdx = inOffset + i;\n vec4 values = vec4(\n getValue(batch, inIdx),\n getValue(batch, inIdx + 1),\n getValue(batch, inIdx + 2),\n getValue(batch, inIdx + 3)\n );\n\n vec4 filter = vec4(\n int(getSegmentIdAtIndex(inIdx)) == currentSeg ? 1 : 0,\n int(getSegmentIdAtIndex(inIdx + 1)) == currentSeg ? 1 : 0,\n int(getSegmentIdAtIndex(inIdx + 2)) == currentSeg ? 1 : 0,\n int(getSegmentIdAtIndex(inIdx + 3)) == currentSeg ? 1 : 0\n );\n\n "+l+"\n }\n\n int inIdx = inOffset + "+s+";\n if ("+(1===u)+") {\n vec4 values = vec4(\n getValue(batch, inIdx),\n initializationValue,\n initializationValue,\n initializationValue\n );\n\n int inIdxSeg = int(getSegmentIdAtIndex(inIdx));\n\n vec4 filter = vec4(\n int(getSegmentIdAtIndex(inIdx)) == currentSeg ? 1 : 0,\n 0,\n 0,\n 0\n );\n\n "+l+"\n } else if ("+(2===u)+") {\n vec4 values = vec4(\n getValue(batch, inIdx),\n getValue(batch, inIdx + 1),\n initializationValue,\n initializationValue\n );\n\n vec4 filter = vec4(\n int(getSegmentIdAtIndex(inIdx)) == currentSeg ? 1 : 0,\n int(getSegmentIdAtIndex(inIdx + 1)) == currentSeg ? 1 : 0,\n 0,\n 0\n );\n\n "+l+"\n } else if ("+(3===u)+") {\n vec4 values = vec4(\n getValue(batch, inIdx),\n getValue(batch, inIdx + 1),\n getValue(batch, inIdx + 2),\n initializationValue\n );\n\n vec4 filter = vec4(\n int(getSegmentIdAtIndex(inIdx)) == currentSeg ? 1 : 0,\n int(getSegmentIdAtIndex(inIdx + 1)) == currentSeg ? 1 : 0,\n int(getSegmentIdAtIndex(inIdx + 2)) == currentSeg ? 1 : 0,\n 0\n );\n\n "+l+"\n }\n setOutput(sumValue);\n }\n "},SliceProgram=function(){function e(e){this.variableNames=["source"],this.outputShape=e,this.rank=e.length;var t=getCoordsDataType(this.rank),r=getCoords$1(this.rank);this.userCode="\n uniform "+t+" start;\n\n void main() {\n "+t+" sourceLoc = start + getOutputCoords();\n setOutput(getSource("+r+"));\n }\n "}return e.prototype.getCustomSetupFunc=function(e){var t=this;if(e.length!==this.rank)throw Error("The rank ("+this.rank+") of the program must match the length of start ("+e.length+")");return function(r,n){if(null!=t.startLoc||(t.startLoc=r.getUniformLocationNoThrow(n,"start"),null!=t.startLoc))if(1===t.rank)r.gl.uniform1i(t.startLoc,e[0]);else if(2===t.rank)r.gl.uniform2i(t.startLoc,e[0],e[1]);else if(3===t.rank)r.gl.uniform3i(t.startLoc,e[0],e[1],e[2]);else{if(4!==t.rank)throw Error("Slicing for rank "+t.rank+" is not yet supported");r.gl.uniform4i(t.startLoc,e[0],e[1],e[2],e[3])}}},e}();function getCoords$1(e){if(1===e)return"sourceLoc";if(2===e)return"sourceLoc.x, sourceLoc.y";if(3===e)return"sourceLoc.x, sourceLoc.y, sourceLoc.z";if(4===e)return"sourceLoc.x, sourceLoc.y, sourceLoc.z, sourceLoc.w";throw Error("Slicing for rank "+e+" is not yet supported")}var StridedSliceProgram=function(e,t,r){this.variableNames=["x"],this.outputShape=r,this.rank=r.length;var n,a=getCoordsDataType(this.rank);n=1===this.rank?"coords * strides + begin":r.map(function(e,t){return"coords["+t+"] * strides["+t+"] + begin["+t+"]"}).join(","),this.userCode="\n "+a+" begin = "+a+"("+e+");\n "+a+" strides = "+a+"("+t+");\n\n void main() {\n "+a+" coords = getOutputCoords();\n setOutput(getX("+n+"));\n }\n "},TextureManager=function(){function e(e){this.gpgpu=e,this.numUsedTextures=0,this.numFreeTextures=0,this.freeTextures={},this.logEnabled=!1,this.usedTextures={}}return e.prototype.acquireTexture=function(e,t){var r,n=getPhysicalFromLogicalTextureType(t),a=getKeyFromTextureShape(e,n);if(a in this.freeTextures||(this.freeTextures[a]=[]),a in this.usedTextures||(this.usedTextures[a]=[]),this.freeTextures[a].length>0){this.numFreeTextures--,this.numUsedTextures++,this.log();var o=this.freeTextures[a].shift();return this.usedTextures[a].push(o),o}return this.numUsedTextures++,this.log(),n===PhysicalTextureType.FLOAT32?r=this.gpgpu.createFloat32MatrixTexture(e[0],e[1]):n===PhysicalTextureType.FLOAT16?r=this.gpgpu.createFloat16MatrixTexture(e[0],e[1]):n===PhysicalTextureType.UNSIGNED_BYTE&&(r=this.gpgpu.createUnsignedBytesMatrixTexture(e[0],e[1])),this.usedTextures[a].push(r),r},e.prototype.releaseTexture=function(e,t,r){var n=getKeyFromTextureShape(t,getPhysicalFromLogicalTextureType(r));n in this.freeTextures||(this.freeTextures[n]=[]),this.freeTextures[n].push(e),this.numFreeTextures++,this.numUsedTextures--;var a=this.usedTextures[n],o=a.indexOf(e);if(o<0)throw new Error("Cannot release a texture that was never provided by this texture manager");a.splice(o,1),this.log()},e.prototype.log=function(){if(this.logEnabled){var e=this.numFreeTextures+this.numUsedTextures;console.log("Free/Used",this.numFreeTextures+" / "+this.numUsedTextures,"("+e+")")}},e.prototype.getNumUsedTextures=function(){return this.numUsedTextures},e.prototype.getNumFreeTextures=function(){return this.numFreeTextures},e.prototype.dispose=function(){var e=this;if(null!=this.freeTextures){for(var t in this.freeTextures)this.freeTextures[t].forEach(function(t){e.gpgpu.deleteMatrixTexture(t)});for(var t in this.usedTextures)this.usedTextures[t].forEach(function(t){e.gpgpu.deleteMatrixTexture(t)});this.freeTextures=null,this.usedTextures=null,this.numUsedTextures=0,this.numFreeTextures=0}},e}();function getPhysicalFromLogicalTextureType(e){if(e===TextureUsage.DOWNLOAD||e===TextureUsage.PIXELS)return PhysicalTextureType.UNSIGNED_BYTE;if(e===TextureUsage.UPLOAD)return PhysicalTextureType.FLOAT32;if(e===TextureUsage.RENDER)return ENV.get("WEBGL_RENDER_FLOAT32_ENABLED")?PhysicalTextureType.FLOAT32:PhysicalTextureType.FLOAT16;throw new Error("Unknown logical texture type "+e)}function getKeyFromTextureShape(e,t){return e[0]+"_"+e[1]+"_"+t}var TileProgram=function(e,t){this.variableNames=["A"];for(var r=new Array(e.length),n=0;n5)throw Error("Tile for rank "+t+" is not yet supported");if(1===t)return"imod(resRC, "+e[0]+")";for(var r=["resRC.x","resRC.y","resRC.z","resRC.w","resRC.u"],n=[],a=0;a6)throw Error("Transpose for rank "+t+" is not yet supported");for(var r=["resRC.x","resRC.y","resRC.z","resRC.w","resRC.u","resRC.v"],n=new Array(t),a=0;a= 0.0) ? scale * x : scaleAlpha * (exp(x) - 1.0);\n";function STEP(e){return void 0===e&&(e=0),CHECK_NAN_SNIPPET$1+"\n return x > 0.0 ? 1.0 : float("+e+");\n "}var NEG="return -x;",CEIL="return ceil(x);",FLOOR="return floor(x);",SIGN="\n if (isNaN(x)) { return 0.0; }\n return sign(x);\n",ROUND="\n // OpenGL ES does not support round function.\n // The algorithm is based on banker's rounding.\n float base = floor(x);\n if ((x - base) < 0.5) {\n return floor(x);\n } else if ((x - base) > 0.5) {\n return ceil(x);\n } else {\n if (mod(base, 2.0) == 0.0) {\n return base;\n } else {\n return base + 1.0;\n }\n }\n",EXP="return exp(x);",EXPM1="return exp(x) - 1.0;",LOG="if (x < 0.0) return NAN;\n return log(x);",LOG1P="return log(1.0 + x);",SQRT="return sqrt(x);",RSQRT="return inversesqrt(x);",SIGMOID="return 1.0 / (1.0 + exp(-1.0 * x));",SOFTPLUS="\n float epsilon = 1.1920928955078125e-7;\n float threshold = log(epsilon) + 2.0;\n\n bool too_large = x > -threshold;\n bool too_small = x < threshold;\n\n float result;\n float exp_x = exp(x);\n\n if (too_large){\n result = x;\n }\n else if (too_small){\n result = exp_x;\n }\n else{\n result = log(exp_x + 1.0);\n }\n return result;\n",SIN=CHECK_NAN_SNIPPET$1+"\n return sin(x);\n",COS=CHECK_NAN_SNIPPET$1+"\n return cos(x);\n",TAN="return tan(x);",ASIN="return asin(x);",ACOS="return acos(x);",ATAN=CHECK_NAN_SNIPPET$1+"\n return atan(x);\n",SINH="\n float e2x = exp(x);\n return (e2x - 1.0 / e2x) / 2.0;\n",COSH="\n float e2x = exp(-x);\n return (e2x + 1.0 / e2x) / 2.0;\n",TANH="\n float e2x = exp(-2.0 * abs(x));\n return sign(x) * (1.0 - e2x) / (1.0 + e2x);\n",ASINH="return log(x + sqrt(x * x + 1.0));",ACOSH=CHECK_NAN_SNIPPET$1+"\n if (x < 1.0) return NAN;\n return log(x + sqrt(x * x - 1.0));",ATANH=CHECK_NAN_SNIPPET$1+"\n if ((x < -1.0) || (x > 1.0)) return NAN;\n return (log(1.0 + x) - log(1.0 - x)) / 2.0;",ERF='\n // Error function is calculated approximately with elementary function.\n // See "Handbook of Mathematical Functions with Formulas,\n // Graphs, and Mathematical Tables", Abramowitz and Stegun.\n float p = '+ERF_P+";\n float a1 = "+ERF_A1+";\n float a2 = "+ERF_A2+";\n float a3 = "+ERF_A3+";\n float a4 = "+ERF_A4+";\n float a5 = "+ERF_A5+";\n\n float t = 1.0 / (1.0 + p * x);\n return 1.0 - (((((a5*t + a4)*t) + a3)*t + a2)*t + a1)*t*exp(-x*x);\n",SQUARE="return x * x;",RECIPROCAL="return 1.0 / x;",LOGICAL_NOT="return float(!(x >= 1.0));",TO_INT="return float(int(x));",BEFORE_PAGING_CONSTANT=300,SIZE_UPLOAD_UNIFORM=32,MathBackendWebGL=function(){function e(e,t){if(void 0===t&&(t=!0),this.gpgpu=e,this.delayedStorage=t,this.texData=new WeakMap,this.pendingRead=new WeakMap,this.pendingDisposal=new WeakSet,this.lruDataGPU=[],this.numBytesInGPU=0,this.uploadWaitMs=0,this.downloadWaitMs=0,this.binaryCache={},this.disposed=!1,ENV.get("WEBGL_VERSION")<1)throw new Error("WebGL is not supported on this device");ENV.get("IS_BROWSER")&&(this.canvas=document.createElement("canvas")),null==e?(this.gpgpu=new GPGPUContext(createWebGLContext(this.canvas)),this.gpgpuCreatedLocally=!0):this.gpgpuCreatedLocally=!1,this.NUM_BYTES_BEFORE_PAGING=window.screen.height*window.screen.width*window.devicePixelRatio*BEFORE_PAGING_CONSTANT,this.textureManager=new TextureManager(this.gpgpu)}return e.prototype.register=function(e,t,r){if(this.texData.has(e))throw new Error("Data buffer is already registered");this.texData.set(e,{shape:t,dtype:r,values:null,texture:null,texShape:null,usage:TextureUsage.RENDER})},e.prototype.fromPixels=function(e,t){if(null==e)throw new Error("pixels passed to tf.fromPixels() can not be null");var r=[e.height,e.width],n=[e.height,e.width,t];if(!(e instanceof HTMLVideoElement||e instanceof HTMLImageElement||e instanceof HTMLCanvasElement||e instanceof ImageData))throw new Error("pixels passed to tf.fromPixels() must be either an HTMLVideoElement, HTMLImageElement, HTMLCanvasElement or ImageData, but was "+e.constructor.name);if(e instanceof HTMLVideoElement){if(null==this.fromPixelsCanvas){if(!ENV.get("IS_BROWSER"))throw new Error("Can't read pixels from HTMLImageElement outside the browser.");if("complete"!==document.readyState)throw new Error("The DOM is not ready yet. Please call tf.fromPixels() once the DOM is ready. One way to do that is to add an event listener for `DOMContentLoaded` on the document object");this.fromPixelsCanvas=document.createElement("canvas")}this.fromPixelsCanvas.width=e.width,this.fromPixelsCanvas.height=e.height,this.fromPixelsCanvas.getContext("2d").drawImage(e,0,0,e.width,e.height),e=this.fromPixelsCanvas}var a=Tensor.make(r,{},"int32");this.texData.get(a.dataId).usage=TextureUsage.PIXELS,this.gpgpu.uploadPixelDataToTexture(this.getTexture(a.dataId),e);var o=new FromPixelsProgram(n),i=this.compileAndRun(o,[a]);return a.dispose(),i},e.prototype.write=function(e,t){if(null==t)throw new Error("MathBackendWebGL.write(): values can not be null");this.throwIfNoData(e);var r=this.texData.get(e),n=r.texture,a=r.texShape,o=r.usage;null!=n&&(this.releaseTexture(e,n,a,o),r.texture=null,r.texShape=null),r.usage=TextureUsage.UPLOAD,r.values=t,this.delayedStorage||this.uploadToGPU(e)},e.prototype.readSync=function(e){this.throwIfNoData(e);var t=this.texData.get(e),r=t.shape,n=t.texture,a=t.values,o=t.texShape,i=t.dtype;if(null!=a)return this.cacheOnCPU(e),a;var s,u,l=null!=this.activeTimers;if(l&&(s=performance.now()),ENV.get("WEBGL_DOWNLOAD_FLOAT_ENABLED"))u=this.gpgpu.downloadFloat32MatrixFromOutputTexture(n,o[0],o[1]);else{var c=Tensor.make(r,{});this.texData.get(c.dataId).usage=TextureUsage.DOWNLOAD;var p=Tensor.make(r,{dataId:e},i),d=new EncodeFloatProgram(r),h=this.compileAndRun(d,[p],c),f=this.texData.get(c.dataId);u=this.gpgpu.downloadByteEncodedFloatMatrixFromOutputTexture(f.texture,f.texShape[0],f.texShape[1]),h.dispose(),p.dispose(),c.dispose()}return l&&(this.downloadWaitMs+=performance.now()-s),this.cacheOnCPU(e,u),t.values},e.prototype.read=function(e){return __awaiter(this,void 0,void 0,function(){var t,r,n,a,o,i,s,u;return __generator(this,function(l){switch(l.label){case 0:return this.pendingRead.has(e)?(t=this.pendingRead.get(e),[2,new Promise(function(e){return t.push(e)})]):(this.throwIfNoData(e),r=this.texData.get(e),n=r.texture,a=r.values,o=r.texShape,null!=a?(this.cacheOnCPU(e),[2,a]):ENV.get("WEBGL_GET_BUFFER_SUB_DATA_ASYNC_EXTENSION_ENABLED")?[4,this.gpgpu.downloadMatrixFromTextureAsync(n,o[0],o[1])]:[3,2]);case 1:return i=l.sent(),this.cacheOnCPU(e,i),[2,r.values];case 2:return 0===ENV.get("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_VERSION")?[2,this.readSync(e)]:(this.pendingRead.set(e,[]),[4,this.gpgpu.runQuery(function(){})]);case 3:return l.sent(),s=this.pendingRead.get(e),this.pendingRead.delete(e),u=this.readSync(e),s.forEach(function(e){return e(u)}),this.pendingDisposal.has(e)&&(this.pendingDisposal.delete(e),this.disposeData(e)),[2,u]}})})},e.prototype.time=function(e){return __awaiter(this,void 0,void 0,function(){var t,r,n,a,o,i;return __generator(this,function(s){switch(s.label){case 0:return t=this.activeTimers,r=[],n=!1,null==this.programTimersStack?(this.programTimersStack=r,n=!0):this.activeTimers.push(r),this.activeTimers=r,e(),a=flatten(this.activeTimers),this.activeTimers=t,n&&(this.programTimersStack=null),[4,Promise.all(a).then(function(e){var t=0;return e.forEach(function(e){return t+=e}),t})];case 1:return o=s.sent(),i={uploadWaitMs:this.uploadWaitMs,downloadWaitMs:this.downloadWaitMs,kernelMs:o,wallMs:null},this.uploadWaitMs=0,this.downloadWaitMs=0,[2,i]}})})},e.prototype.memory=function(){return{unreliable:!1,numBytesInGPU:this.numBytesInGPU}},e.prototype.startTimer=function(){return ENV.get("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_VERSION")>0?this.gpgpu.beginQuery():{startMs:performance.now(),endMs:null}},e.prototype.endTimer=function(e){return ENV.get("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_VERSION")>0?(this.gpgpu.endQuery(),e):(e.endMs=performance.now(),e)},e.prototype.getQueryTime=function(e){return __awaiter(this,void 0,void 0,function(){var t;return __generator(this,function(r){return ENV.get("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_VERSION")>0?[2,this.gpgpu.pollQueryTime(e)]:[2,(t=e).endMs-t.startMs]})})},e.prototype.disposeData=function(e){if(!this.pendingDisposal.has(e))if(this.pendingRead.has(e))this.pendingDisposal.add(e);else if(this.texData.has(e)){var t=this.texData.get(e),r=t.texture,n=t.texShape,a=t.usage;null!=r&&this.releaseTexture(e,r,n,a),this.texData.delete(e)}},e.prototype.getTexture=function(e){return this.uploadToGPU(e),this.texData.get(e).texture},e.prototype.getGPGPUContext=function(){return this.gpgpu},e.prototype.getCanvas=function(){return this.canvas},e.prototype.slice=function(e,t,r){var n=new SliceProgram(r),a=n.getCustomSetupFunc(t);return this.compileAndRun(n,[e],null,a)},e.prototype.stridedSlice=function(e,t,r,n,a,o){var i=getStridedSlicedInfo(e.shape,t,r,n,a,o),s=i[0],u=i[1];if(u.some(function(e){return 0===e}))return tensor([],u);var l=new StridedSliceProgram(s,n,u);return this.compileAndRun(l,[e])},e.prototype.reverse=function(e,t){var r=new ReverseProgram(e.shape,t);return this.compileAndRun(r,[e])},e.prototype.concat=function(e,t){var r=new ConcatProgram(e.shape,t.shape);return this.compileAndRun(r,[e,t])},e.prototype.neg=function(e){var t=new UnaryOpProgram(e.shape,NEG);return this.compileAndRun(t,[e])},e.prototype.matMul=function(e,t,r,n){var a=new MatMulProgram(e.shape,t.shape,r,n);return this.compileAndRun(a,[e,t])},e.prototype.multiply=function(e,t){var r=new BinaryOpProgram(MUL,e.shape,t.shape),n=this.makeOutputArray(r.outputShape,upcastType(e.dtype,t.dtype));return this.compileAndRun(r,[e,t],n)},e.prototype.batchNormalization=function(e,t,r,n,a,o){var i=[e,t,r],s=null;null!=o&&(s=o.shape,i.push(o));var u=null;null!=a&&(u=a.shape,i.push(a));var l=new BatchNormProgram(e.shape,t.shape,r.shape,s,u,n);return this.compileAndRun(l,i)},e.prototype.localResponseNormalization4D=function(e,t,r,n,a){var o=new LRNProgram(e.shape,t,r,n,a);return this.compileAndRun(o,[e])},e.prototype.tile=function(e,t){var r=new TileProgram(e.shape,t);return this.compileAndRun(r,[e])},e.prototype.pad=function(e,t,r){var n=new PadProgram(e.shape,t,r);return this.compileAndRun(n,[e])},e.prototype.transpose=function(e,t){var r=new TransposeProgram(e.shape,t);return this.compileAndRun(r,[e])},e.prototype.gather=function(e,t,r){var n=new GatherProgram(e.shape,t.size,r);return this.compileAndRun(n,[e,t])},e.prototype.reduce=function(e,t,r){var n=e.shape[0],a=e.shape[1],o=computeOptimalWindowSize(a),i=new ReduceProgram({windowSize:o,inSize:a,batchSize:n},t),s=i.outputShape,u=s[0],l=s[1],c=this.makeOutputArray([u,l],r);return this.compileAndRun(i,[e],c),1===c.shape[1]?c:this.reduce(c,t,r)},e.prototype.argReduce=function(e,t,r){void 0===r&&(r=null);var n=e.shape[0],a=e.shape[1];null!=r&&(n=r.shape[0],a=r.shape[1]);var o=computeOptimalWindowSize(a),i=new ArgMinMaxProgram({windowSize:o,inSize:a,batchSize:n},t,null==r),s=i.outputShape,u=s[0],l=s[1],c=this.makeOutputArray([u,l],"int32"),p=[e];return null!=r&&p.push(r),this.compileAndRun(i,p,c),1===c.shape[1]?c:this.argReduce(e,t,c)},e.prototype.sum=function(e,t){assertAxesAreInnerMostDims("sum",t,e.rank);var r=computeOutAndReduceShapes(e.shape,t),n=r[0],a=sizeFromShape(r[1]),o=e.as2D(-1,a),i=sumOutType(e.dtype);return this.reduce(o,"sum",i).reshape(n)},e.prototype.unsortedSegmentSum=function(e,t,r){var n=0,a=getAxesPermutation([n],e.rank),o=e;null!=a&&(o=e.transpose(a),n=getInnerMostAxes(1,e.rank)[0]);var i=computeOutShape$1(o.shape,n,r),s=sizeFromShape([o.shape[n]]),u=o.as2D(-1,s),l=sumOutType(e.dtype),c=this.segOpCompute(u,"unsortedSegmentSum",t,l,r).reshape(i);return null!=a&&(c=c.transpose(getUndoAxesPermutation(a))),c},e.prototype.segOpCompute=function(e,t,r,n,a){var o=e.shape[0],i=e.shape[1],s=segOpComputeOptimalWindowSize(i,a),u=new SegmentOpProgram({windowSize:s,inSize:i,batchSize:o,numSegments:a},t),l=u.outputShape,c=l[0],p=l[1],d=this.makeOutputArray([c,p],n);return this.compileAndRun(u,[e,r],d),d.shape[1]===a?d:(r=range(0,a).tile([i/s]),this.segOpCompute(d,t,r,n,a))},e.prototype.argMin=function(e,t){var r=[t];assertAxesAreInnerMostDims("argMin",r,e.rank);var n=computeOutAndReduceShapes(e.shape,r),a=n[0],o=sizeFromShape(n[1]),i=e.as2D(-1,o);return this.argReduce(i,"min").reshape(a)},e.prototype.argMax=function(e,t){var r=[t];assertAxesAreInnerMostDims("argMax",r,e.rank);var n=computeOutAndReduceShapes(e.shape,r),a=n[0],o=sizeFromShape(n[1]),i=e.as2D(-1,o);return this.argReduce(i,"max").reshape(a)},e.prototype.cumsum=function(e,t,r,n){if(t!==e.rank-1)throw new Error("WebGL cumsum shader expects an inner-most axis="+(e.rank-1)+" but got axis="+t);var a=new CumSumProgram(e.shape,r,n);return this.compileAndRun(a,[e])},e.prototype.equal=function(e,t){var r=new BinaryOpProgram(EQUAL,e.shape,t.shape),n=this.makeOutputArray(r.outputShape,"bool");return this.compileAndRun(r,[e,t],n)},e.prototype.notEqual=function(e,t){var r=new BinaryOpProgram(NOT_EQUAL,e.shape,t.shape),n=this.makeOutputArray(r.outputShape,"bool");return this.compileAndRun(r,[e,t],n)},e.prototype.less=function(e,t){var r=new BinaryOpProgram(LESS,e.shape,t.shape),n=this.makeOutputArray(r.outputShape,"bool");return this.compileAndRun(r,[e,t],n)},e.prototype.lessEqual=function(e,t){var r=new BinaryOpProgram(LESS_EQUAL,e.shape,t.shape),n=this.makeOutputArray(r.outputShape,"bool");return this.compileAndRun(r,[e,t],n)},e.prototype.greater=function(e,t){var r=new BinaryOpProgram(GREATER,e.shape,t.shape),n=this.makeOutputArray(r.outputShape,"bool");return this.compileAndRun(r,[e,t],n)},e.prototype.greaterEqual=function(e,t){var r=new BinaryOpProgram(GREATER_EQUAL,e.shape,t.shape),n=this.makeOutputArray(r.outputShape,"bool");return this.compileAndRun(r,[e,t],n)},e.prototype.logicalNot=function(e){var t=new UnaryOpProgram(e.shape,LOGICAL_NOT);return this.compileAndRun(t,[e])},e.prototype.logicalAnd=function(e,t){var r=new BinaryOpProgram(LOGICAL_AND,e.shape,t.shape),n=this.makeOutputArray(r.outputShape,"bool");return this.compileAndRun(r,[e,t],n)},e.prototype.logicalOr=function(e,t){var r=new BinaryOpProgram(LOGICAL_OR,e.shape,t.shape),n=this.makeOutputArray(r.outputShape,"bool");return this.compileAndRun(r,[e,t],n)},e.prototype.where=function(e,t,r,n){var a=new WhereProgram(e.rank,t.shape,t.rank),o=this.makeOutputArray(a.outputShape,n);return this.compileAndRun(a,[e,t,r],o)},e.prototype.topKValues=function(e,t){throw new Error("topKValues GPU not yet implemented!")},e.prototype.topKIndices=function(e,t){throw new Error("topKIndices GPU not yet implemented!")},e.prototype.min=function(e,t){assertAxesAreInnerMostDims("min",t,e.rank);var r=computeOutAndReduceShapes(e.shape,t),n=r[0],a=sizeFromShape(r[1]),o=e.as2D(-1,a);return this.reduce(o,"min",o.dtype).reshape(n)},e.prototype.minimum=function(e,t){var r=new BinaryOpProgram(MIN,e.shape,t.shape);return this.compileAndRun(r,[e,t])},e.prototype.mod=function(e,t){var r=new BinaryOpProgram(MOD,e.shape,t.shape),n=r.getCustomSetupFunc();return this.compileAndRun(r,[e,t],null,n)},e.prototype.max=function(e,t){assertAxesAreInnerMostDims("max",t,e.rank);var r=computeOutAndReduceShapes(e.shape,t),n=r[0],a=sizeFromShape(r[1]),o=e.as2D(-1,a);return this.reduce(o,"max",o.dtype).reshape(n)},e.prototype.maximum=function(e,t){var r=new BinaryOpProgram(MAX,e.shape,t.shape);return this.compileAndRun(r,[e,t])},e.prototype.all=function(e,t){assertAxesAreInnerMostDims("all",t,e.rank);var r=computeOutAndReduceShapes(e.shape,t),n=r[0],a=sizeFromShape(r[1]),o=e.as2D(-1,a);return this.reduce(o,"all",o.dtype).reshape(n)},e.prototype.any=function(e,t){assertAxesAreInnerMostDims("any",t,e.rank);var r=computeOutAndReduceShapes(e.shape,t),n=r[0],a=sizeFromShape(r[1]),o=e.as2D(-1,a);return this.reduce(o,"any",o.dtype).reshape(n)},e.prototype.squaredDifference=function(e,t){var r=new BinaryOpProgram(SQUARED_DIFFERENCE,e.shape,t.shape);return this.compileAndRun(r,[e,t])},e.prototype.realDivide=function(e,t){var r=new BinaryOpProgram(DIV,e.shape,t.shape),n=this.makeOutputArray(r.outputShape,"float32");return this.compileAndRun(r,[e,t],n)},e.prototype.floorDiv=function(e,t){var r=new BinaryOpProgram(INT_DIV,e.shape,t.shape),n=this.makeOutputArray(r.outputShape,"int32");return this.compileAndRun(r,[e,t],n)},e.prototype.add=function(e,t){var r=new BinaryOpProgram(ADD,e.shape,t.shape),n=this.makeOutputArray(r.outputShape,upcastType(e.dtype,t.dtype));return this.compileAndRun(r,[e,t],n)},e.prototype.subtract=function(e,t){var r=new BinaryOpProgram(SUB,e.shape,t.shape),n=this.makeOutputArray(r.outputShape,upcastType(e.dtype,t.dtype));return this.compileAndRun(r,[e,t],n)},e.prototype.pow=function(e,t){var r=new BinaryOpProgram(POW,e.shape,t.shape),n=this.makeOutputArray(r.outputShape,upcastType(e.dtype,t.dtype));return this.compileAndRun(r,[e,t],n)},e.prototype.ceil=function(e){var t=new UnaryOpProgram(e.shape,CEIL);return this.compileAndRun(t,[e])},e.prototype.floor=function(e){var t=new UnaryOpProgram(e.shape,FLOOR);return this.compileAndRun(t,[e])},e.prototype.sign=function(e){var t=new UnaryOpProgram(e.shape,SIGN);return this.compileAndRun(t,[e])},e.prototype.round=function(e){var t=new UnaryOpProgram(e.shape,ROUND);return this.compileAndRun(t,[e])},e.prototype.exp=function(e){var t=new UnaryOpProgram(e.shape,EXP);return this.compileAndRun(t,[e])},e.prototype.expm1=function(e){var t=new UnaryOpProgram(e.shape,EXPM1);return this.compileAndRun(t,[e])},e.prototype.log=function(e){var t=new UnaryOpProgram(e.shape,LOG),r=t.getCustomSetupFunc();return this.compileAndRun(t,[e],null,r)},e.prototype.log1p=function(e){var t=new UnaryOpProgram(e.shape,LOG1P);return this.compileAndRun(t,[e])},e.prototype.sqrt=function(e){var t=new UnaryOpProgram(e.shape,SQRT);return this.compileAndRun(t,[e])},e.prototype.rsqrt=function(e){var t=new UnaryOpProgram(e.shape,RSQRT);return this.compileAndRun(t,[e])},e.prototype.square=function(e){var t=new UnaryOpProgram(e.shape,SQUARE);return this.compileAndRun(t,[e])},e.prototype.reciprocal=function(e){var t=new UnaryOpProgram(e.shape,RECIPROCAL);return this.compileAndRun(t,[e])},e.prototype.relu=function(e){var t=new UnaryOpProgram(e.shape,RELU);return this.compileAndRun(t,[e])},e.prototype.elu=function(e){var t=new UnaryOpProgram(e.shape,ELU);return this.compileAndRun(t,[e])},e.prototype.eluDer=function(e,t){var r=new BinaryOpProgram(ELU_DER,e.shape,t.shape);return this.compileAndRun(r,[e,t])},e.prototype.selu=function(e){var t=new UnaryOpProgram(e.shape,SELU);return this.compileAndRun(t,[e])},e.prototype.int=function(e){var t=new UnaryOpProgram(e.shape,TO_INT),r=this.makeOutputArray(t.outputShape,"int32");return this.compileAndRun(t,[e],r)},e.prototype.clip=function(e,t,r){var n=new ClipProgram(e.shape,t,r);return this.compileAndRun(n,[e])},e.prototype.abs=function(e){var t=new UnaryOpProgram(e.shape,ABS);return this.compileAndRun(t,[e])},e.prototype.sigmoid=function(e){var t=new UnaryOpProgram(e.shape,SIGMOID);return this.compileAndRun(t,[e])},e.prototype.softplus=function(e){var t=new UnaryOpProgram(e.shape,SOFTPLUS);return this.compileAndRun(t,[e])},e.prototype.sin=function(e){var t=new UnaryOpProgram(e.shape,SIN);return this.compileAndRun(t,[e])},e.prototype.cos=function(e){var t=new UnaryOpProgram(e.shape,COS);return this.compileAndRun(t,[e])},e.prototype.tan=function(e){var t=new UnaryOpProgram(e.shape,TAN);return this.compileAndRun(t,[e])},e.prototype.asin=function(e){var t=new UnaryOpProgram(e.shape,ASIN);return this.compileAndRun(t,[e])},e.prototype.acos=function(e){var t=new UnaryOpProgram(e.shape,ACOS);return this.compileAndRun(t,[e])},e.prototype.atan=function(e){var t=new UnaryOpProgram(e.shape,ATAN);return this.compileAndRun(t,[e])},e.prototype.atan2=function(e,t){var r=new BinaryOpProgram(ATAN2,e.shape,t.shape);return this.compileAndRun(r,[e,t])},e.prototype.sinh=function(e){var t=new UnaryOpProgram(e.shape,SINH);return this.compileAndRun(t,[e])},e.prototype.cosh=function(e){var t=new UnaryOpProgram(e.shape,COSH);return this.compileAndRun(t,[e])},e.prototype.tanh=function(e){var t=new UnaryOpProgram(e.shape,TANH);return this.compileAndRun(t,[e])},e.prototype.asinh=function(e){var t=new UnaryOpProgram(e.shape,ASINH);return this.compileAndRun(t,[e])},e.prototype.acosh=function(e){var t=new UnaryOpProgram(e.shape,ACOSH),r=t.getCustomSetupFunc();return this.compileAndRun(t,[e],null,r)},e.prototype.atanh=function(e){var t=new UnaryOpProgram(e.shape,ATANH),r=t.getCustomSetupFunc();return this.compileAndRun(t,[e],null,r)},e.prototype.erf=function(e){var t=new UnaryOpProgram(e.shape,ERF);return this.compileAndRun(t,[e])},e.prototype.step=function(e,t){var r=new UnaryOpProgram(e.shape,STEP(t));return this.compileAndRun(r,[e])},e.prototype.conv2d=function(e,t,r){var n=new Conv2DProgram(r);return this.compileAndRun(n,[e,t])},e.prototype.conv2dDerInput=function(e,t,r){var n=new Conv2DDerInputProgram(r);return this.compileAndRun(n,[e,t])},e.prototype.conv2dDerFilter=function(e,t,r){var n=new Conv2DDerFilterProgram(r);return this.compileAndRun(n,[e,t])},e.prototype.depthwiseConv2D=function(e,t,r){var n=new DepthwiseConv2DProgram(r);return this.compileAndRun(n,[e,t])},e.prototype.depthwiseConv2DDerInput=function(e,t,r){var n=new DepthwiseConv2DDerInputProgram(r);return this.compileAndRun(n,[e,t])},e.prototype.depthwiseConv2DDerFilter=function(e,t,r){var n=new DepthwiseConv2DDerFilterProgram(r);return this.compileAndRun(n,[e,t])},e.prototype.maxPool=function(e,t){var r=new Pool2DProgram(t,"max",!1),n=this.makeOutputArray(r.outputShape,e.dtype);return this.compileAndRun(r,[e],n)},e.prototype.avgPool=function(e,t){var r=new Pool2DProgram(t,"avg",!1),n=this.makeOutputArray(r.outputShape,"float32");return this.compileAndRun(r,[e],n)},e.prototype.maxPoolBackprop=function(e,t,r,n){var a=new Pool2DProgram(n,"max",!0),o=this.compileAndRun(a,[t]),i=new MaxPool2DBackpropProgram(n),s=this.makeOutputArray(i.outputShape,t.dtype),u=this.compileAndRun(i,[e,o],s);return o.dispose(),u},e.prototype.avgPoolBackprop=function(e,t,r){var n=new AvgPool2DBackpropProgram(r),a=this.makeOutputArray(n.outputShape,t.dtype);return this.compileAndRun(n,[e],a)},e.prototype.cast=function(e,t){return castTensor(e,t,this)},e.prototype.reshape=function(e,t){return reshapeTensor(e,t)},e.prototype.resizeBilinear=function(e,t,r,n){var a=new ResizeBilinearProgram(e.shape,t,r,n);return this.compileAndRun(a,[e])},e.prototype.resizeBilinearBackprop=function(e,t,r){var n=new ResizeBilinearBackpropProgram(e,t,r);return this.compileAndRun(n,[e])},e.prototype.resizeNearestNeighbor=function(e,t,r,n){var a=new ResizeNearestNeighborProgram(e.shape,t,r,n);return this.compileAndRun(a,[e])},e.prototype.resizeNearestNeighborBackprop=function(e,t,r){var n=new ResizeNearestNeigborBackpropProgram(e,t,r);return this.compileAndRun(n,[e])},e.prototype.multinomial=function(e,t,r,n){var a=t?e:softmax(e),o=a.shape[0],i=a.shape[1],s=new MultinomialProgram(o,i,r),u=this.makeOutputArray(s.outputShape,"int32"),l=s.getCustomSetupFunc(n);return this.compileAndRun(s,[a],u,l)},e.prototype.oneHot=function(e,t,r,n){var a=new OneHotProgram(e.size,t,r,n);return this.compileAndRun(a,[e])},e.prototype.makeOutputArray=function(e,t){return Tensor.make(e,{},t)},e.prototype.compileAndRun=function(e,t,r,n){var a=this;null==r&&(r=this.makeOutputArray(e.outputShape,t[0].dtype));var o=t.map(function(e){var t=a.texData.get(e.dataId);return null==t.texture&&e.size<=SIZE_UPLOAD_UNIFORM?{tensor:e,texData:null,isUniform:!0}:(a.uploadToGPU(e.dataId),{tensor:e,texData:t,isUniform:!1})});this.uploadToGPU(r.dataId);var i,s={tensor:r,texData:this.texData.get(r.dataId),isUniform:!1},u=makeShaderKey(e,o,s),l=this.getAndSaveBinary(u,function(){return compileProgram(a.gpgpu,e,o,s)}),c=null!=this.activeTimers;if(c&&(i=this.startTimer()),runProgram(l,o,s,n),this.numBytesInGPU>this.NUM_BYTES_BEFORE_PAGING)for(var p=this.numBytesInGPU-this.NUM_BYTES_BEFORE_PAGING;p>0;){var d=this.lruDataGPU.shift(),h=this.texData.get(d),f=h.shape,m=h.dtype;p-=this.computeBytes(f,m),this.read(d)}return c&&(i=this.endTimer(i),this.activeTimers.push(this.getQueryTime(i))),r},e.prototype.getAndSaveBinary=function(e,t){return e in this.binaryCache||(this.binaryCache[e]=t()),this.binaryCache[e]},e.prototype.getTextureManager=function(){return this.textureManager},e.prototype.dispose=function(){if(!this.disposed){for(var e in this.binaryCache)this.gpgpu.deleteProgram(this.binaryCache[e].webGLProgram);this.textureManager.dispose(),this.canvas.remove(),null!=this.fromPixelsCanvas&&this.fromPixelsCanvas.remove(),this.gpgpuCreatedLocally&&this.gpgpu.dispose(),this.disposed=!0}},e.prototype.throwIfNoData=function(e){if(!this.texData.has(e))throw new Error("WebGL backend: No data found for this tensor. Did you change your backend in the middle of the program? New backends can't use Tensors created with previous backends")},e.prototype.uploadToGPU=function(e){this.throwIfNoData(e);var t=this.texData.get(e),r=t.shape,n=t.values,a=t.texture,o=t.dtype,i=t.usage;if(null!=a)return this.lruDataGPU.splice(this.lruDataGPU.indexOf(e),1),void this.lruDataGPU.push(e);var s,u=null!=this.activeTimers;u&&(s=performance.now());var l=getTextureShapeFromLogicalShape(this.gpgpu.gl,r);t.texShape=l;var c=this.acquireTexture(e,l,i);t.texture=c,null!=n&&(this.gpgpu.uploadMatrixToTexture(c,l[0],l[1],typedArrayToFloat32(n,o)),t.values=null,u&&(this.uploadWaitMs+=performance.now()-s))},e.prototype.cacheOnCPU=function(e,t){var r=this.delayedStorage,n=this.texData.get(e),a=n.texture,o=n.texShape,i=n.dtype,s=n.usage;r&&null!=a&&(this.releaseTexture(e,a,o,s),n.texture=null,n.texShape=null),null!=t&&(n.values=float32ToTypedArray(t,i))},e.prototype.releaseTexture=function(e,t,r,n){var a=this.texData.get(e),o=a.shape,i=a.dtype,s=this.lruDataGPU.indexOf(e);s>=0&&this.lruDataGPU.splice(s,1),this.numBytesInGPU-=this.computeBytes(o,i),this.textureManager.releaseTexture(t,r,n)},e.prototype.acquireTexture=function(e,t,r){var n=this.texData.get(e),a=n.shape,o=n.dtype;return this.lruDataGPU.push(e),this.numBytesInGPU+=this.computeBytes(a,o),this.textureManager.acquireTexture(t,r)},e.prototype.computeBytes=function(e,t){return sizeFromShape(e)*bytesPerElement(t)},e}();function float32ToTypedArray(e,t){if("float32"===t)return e;if("int32"===t||"bool"===t){for(var r="int32"===t?new Int32Array(e.length):new Uint8Array(e.length),n=0;nd&&(d=m,h=f)}u[c]=h}return i},e.prototype.cumsum=function(e,t,r,n){if(t!==e.rank-1)throw new Error("backend.cumsum in CPU expects an inner-most axis="+(e.rank-1)+" but got axis="+t);for(var a=upcastType(e.dtype,"int32"),o=zeros(e.shape,a),i=o.dataSync(),s=e.dataSync(),u=e.shape[e.rank-1],l=n?function(e,t){return e+u-t-1}:function(e,t){return e+t},c=0;ct?1:0})},e.prototype.greaterEqual=function(e,t){return this.broadcastedBinaryOp(e,t,"bool",function(e,t){return e>=t?1:0})},e.prototype.logicalNot=function(e){for(var t=e.dataSync(),r=new Int32Array(t.length),n=0;n1||1===t.rank?1:t.shape[1],p=0;p=0&&t>=0?r:(r+t)%t})},e.prototype.max=function(e,t){assertAxesAreInnerMostDims("max",t,e.rank);for(var r=computeOutAndReduceShapes(e.shape,t),n=r[0],a=r[1],o=zeros(n,e.dtype),i=sizeFromShape(a),s=o.dataSync(),u=e.dataSync(),l=0;lp&&(p=h)}s[l]=p}return o},e.prototype.maximum=function(e,t){return this.broadcastedBinaryOp(e,t,e.dtype,function(e,t){return Math.max(e,t)})},e.prototype.all=function(e,t){assertAxesAreInnerMostDims("all",t,e.rank);for(var r=computeOutAndReduceShapes(e.shape,t),n=r[0],a=r[1],o=zeros(n,e.dtype),i=sizeFromShape(a),s=o.dataSync(),u=e.dataSync(),l=0;l0?r[n]=1:r[n]=0;return Tensor.make(e.shape,{values:r})},e.prototype.round=function(e){for(var t=e.dataSync(),r=new Float32Array(t.length),n=0;n.5?r[n]=Math.ceil(t[n]):r[n]=a%2==0?a:a+1}return Tensor.make(e.shape,{values:r})},e.prototype.exp=function(e){for(var t=e.dataSync(),r=new Float32Array(t.length),n=0;n=0?a:Math.exp(a)-1}return Tensor.make(e.shape,{values:t})},e.prototype.eluDer=function(e,t){for(var r=new Float32Array(t.size),n=t.dataSync(),a=e.dataSync(),o=0;o=1?a[o]:a[o]*(i+1)}return Tensor.make(t.shape,{values:r})},e.prototype.selu=function(e){for(var t=SELU_SCALEALPHA,r=SELU_SCALE,n=new Float32Array(e.size),a=e.dataSync(),o=0;o=0?r*i:t*(Math.exp(i)-1)}return Tensor.make(e.shape,{values:n})},e.prototype.clip=function(e,t,r){for(var n=new Float32Array(e.size),a=e.dataSync(),o=0;o-t,s=n[a]0?1:t}return Tensor.make(e.shape,{values:r})},e.prototype.conv2d=function(e,t,r){for(var n=r.filterHeight,a=r.filterWidth,o=r.dilationHeight,i=r.dilationWidth,s=r.padInfo.left,u=r.padInfo.top,l=buffer(r.outShape,e.dtype),c=0;c=r.inHeight))for(var b=0;b=r.inWidth))for(var w=0;w=r.inHeight))for(var w=0;w=r.inWidth||(v+=e.get(p,x,S,d)*t.get(b,w,d,y))}}c.set(v,p,h,m,d*l+y)}return c.toTensor()},e.prototype.depthwiseConv2DDerInput=function(e,t,r){for(var n=buffer(r.inShape,"float32"),a=n.values,o=n.strides,i=o[0],s=o[1],u=o[2],l=e.dataSync(),c=e.strides,p=c[0],d=c[1],h=c[2],f=t.dataSync(),m=t.strides,g=m[0],y=m[1],v=m[2],b=r.batchSize,x=r.filterHeight,w=r.filterWidth,S=r.inChannels,T=r.inHeight,N=r.inWidth,E=r.outChannels,_=r.outHeight,A=r.outWidth,I=r.strideHeight,O=r.strideWidth,C=x-1-r.padInfo.top,P=w-1-r.padInfo.left,R=E/S,k=0;kx?x=E:"avg"===r&&(w+=E,S++)}if(isNaN(x))break}s.set("avg"===r?w/S:x,c,d,g,p)}return s.toTensor()},e.prototype.maxPool=function(e,t){return this.pool(e,t,"max")},e.prototype.maxPoolPositions=function(e,t){for(var r=buffer(t.outShape,"int32"),n=t.strideHeight,a=t.strideWidth,o=t.filterHeight,i=t.filterWidth,s=t.padInfo.top,u=t.padInfo.left,l=0;lb&&(b=E,x=S*i+N)}r.set(x,l,p,m,c)}return r.toTensor()},e.prototype.maxPoolBackprop=function(e,t,r,n){for(var a=this.maxPoolPositions(t,n),o=n.strideHeight,i=n.strideWidth,s=n.filterHeight,u=n.filterWidth,l=u-1-n.padInfo.left,c=s-1-n.padInfo.top,p=buffer(t.shape,"float32"),d=0;d=n.outHeight||Math.floor(x)!==x))for(var w=0;w=n.outWidth||Math.floor(S)!==S)){var T=s*u-1-a.get(d,x,S,h)===b*u+w?1:0;0!==T&&(v+=e.get(d,x,S,h)*T)}}}p.set(v,d,f,m,h)}return p.toTensor()},e.prototype.avgPoolBackprop=function(e,t,r){for(var n=r.strideHeight,a=r.strideWidth,o=r.filterHeight,i=r.filterWidth,s=i-1-r.padInfo.left,u=o-1-r.padInfo.top,l=buffer(t.shape,"float32"),c=1/(o*i),p=0;p=r.outHeight||Math.floor(b)!==b))for(var x=0;x=r.outWidth||Math.floor(w)!==w||(y+=e.get(p,b,w,d))}}l.set(y*c,p,h,f,d)}return l.toTensor()},e.prototype.cast=function(e,t){return castTensor(e,t,this)},e.prototype.reshape=function(e,t){return reshapeTensor(e,t)},e.prototype.avgPool=function(e,t){return this.pool(e,t,"avg").toFloat()},e.prototype.resizeBilinear=function(e,t,r,n){for(var a=e.shape,o=a[0],i=a[1],s=a[2],u=a[3],l=buffer([o,t,r,u],e.dtype),c=[n&&t>1?i-1:i,n&&r>1?s-1:s],p=[n&&t>1?t-1:t,n&&r>1?r-1:r],d=0;d1?o-1:o,r&&c>1?i-1:i],h=[r&&l>1?l-1:l,r&&c>1?c-1:c],f=d[0]/h[0],m=d[1]/h[1],g=0;g1?i-1:i,n&&r>1?s-1:s],p=[n&&t>1?t-1:t,n&&r>1?r-1:r],d=0;d1?o-1:o,r&&c>1?i-1:i],h=[r&&l>1?l-1:l,r&&c>1?c-1:c],f=1/(d[0]/h[0]),m=1/(d[1]/h[1]),g=2*Math.ceil(f)+2,y=2*Math.ceil(m)+2,v=0;v=l))for(var O=0;O=c)){var P=d[0]*(I/h[0]),R=d[1]*(C/h[1]),k=Math.min(o-1,r?Math.round(P):Math.floor(P)),D=Math.min(i-1,r?Math.round(R):Math.floor(R));b===k&&x===D&&(_+=e.get(v,I,C,E))}}}p.set(_,v,b,x,E)}return p.toTensor()},e.prototype.batchNormalization=function(e,t,r,n,a,o){for(var i=e.dataSync(),s=t.dataSync(),u=r.dataSync(),l=a?a.dataSync():new Float32Array([1]),c=o?o.dataSync():new Float32Array([0]),p=new Float32Array(i.length),d=0;d=0&&e.get(o)0,"scheme must not be an empty string.");var n=e.getInstance();assert(null==n.managers[t],"A model store manager is already registered for scheme '"+t+"'."),n.managers[t]=r},e.getManager=function(e){var t=this.getInstance().managers[e];if(null==t)throw new Error("Cannot find model manager for scheme '"+e+"'");return t},e.getSchemes=function(){return Object.keys(this.getInstance().managers)},e}();function parseURL(e){if(-1===e.indexOf(URL_SCHEME_SUFFIX))throw new Error("The url string provided does not contain a scheme. Supported schemes are: "+ModelStoreManagerRegistry.getSchemes().join(","));return{scheme:e.split(URL_SCHEME_SUFFIX)[0],path:e.split(URL_SCHEME_SUFFIX)[1]}}function cloneModelInternal(e,t,r){return void 0===r&&(r=!1),__awaiter(this,void 0,void 0,function(){var n,a,o,i,s,u,l,c,p;return __generator(this,function(d){switch(d.label){case 0:return assert(e!==t,"Old path and new path are the same: '"+e+"'"),assert((n=IORouterRegistry.getLoadHandlers(e)).length>0,"Copying failed because no load handler is found for source URL "+e+"."),assert(n.length<2,"Copying failed because more than one ("+n.length+") load handlers for source URL "+e+"."),a=n[0],assert((o=IORouterRegistry.getSaveHandlers(t)).length>0,"Copying failed because no save handler is found for destination URL "+t+"."),assert(o.length<2,"Copying failed because more than one ("+n.length+") save handlers for destination URL "+t+"."),i=o[0],s=parseURL(e).scheme,u=parseURL(e).path,l=s===parseURL(e).scheme,[4,a.load()];case 1:return c=d.sent(),r&&l?[4,ModelStoreManagerRegistry.getManager(s).removeModel(u)]:[3,3];case 2:d.sent(),d.label=3;case 3:return[4,i.save(c)];case 4:return p=d.sent(),!r||l?[3,6]:[4,ModelStoreManagerRegistry.getManager(s).removeModel(u)];case 5:d.sent(),d.label=6;case 6:return[2,p.modelArtifactsInfo]}})})}var ModelManagement=function(){function e(){}return e.listModels=function(){return __awaiter(this,void 0,void 0,function(){var e,t,r,n,a,o,i;return __generator(this,function(s){switch(s.label){case 0:e=ModelStoreManagerRegistry.getSchemes(),t={},r=0,n=e,s.label=1;case 1:return r0,"URL path for browserHTTPRequest must not be null, undefined or empty."),this.path=e,null!=t&&null!=t.body)throw new Error("requestInit is expected to have no pre-existing body, but has one.");this.requestInit=t||{}}return e.prototype.save=function(e){return __awaiter(this,void 0,void 0,function(){var t,r,n,a;return __generator(this,function(o){switch(o.label){case 0:if(e.modelTopology instanceof ArrayBuffer)throw new Error("BrowserHTTPRequest.save() does not support saving model topology in binary formats yet.");return(t=Object.assign({method:this.DEFAULT_METHOD},this.requestInit)).body=new FormData,r=[{paths:["./model.weights.bin"],weights:e.weightSpecs}],n={modelTopology:e.modelTopology,weightsManifest:r},t.body.append("model.json",new Blob([JSON.stringify(n)],{type:"application/json"}),"model.json"),null!=e.weightData&&t.body.append("model.weights.bin",new Blob([e.weightData],{type:"application/octet-stream"}),"model.weights.bin"),[4,fetch(this.path,t)];case 1:if(200===(a=o.sent()).status)return[2,{modelArtifactsInfo:getModelArtifactsInfoForJSON(e),responses:[a]}];throw new Error("BrowserHTTPRequest.save() failed due to HTTP response status "+a.status+".")}})})},e.prototype.load=function(){return __awaiter(this,void 0,void 0,function(){var e,t,r,n,a,o,i,s,u,l,c,p;return __generator(this,function(d){switch(d.label){case 0:return[4,fetch(this.path,this.requestInit)];case 1:return[4,d.sent().json()];case 2:if(e=d.sent(),t=e.modelTopology,r=e.weightsManifest,null==t&&null==r)throw new Error("The JSON from HTTP path "+this.path+" contains neither model topology or manifest for weights.");if(null==r)return[3,4];for(o=e.weightsManifest,n=[],i=0,s=o;ir)}function expectValuesInRange(e,t,r){var n;n=e instanceof Tensor?e.dataSync():e;for(var a=0;ar)throw new Error("Value out of range:"+n[a]+" low: "+t+", high: "+r)}function expectArrayBuffersEqual(e,t){expect(new Float32Array(e)).toEqual(new Float32Array(t))}var test_util=Object.freeze({WEBGL_ENVS:WEBGL_ENVS,CPU_ENVS:CPU_ENVS,CHROME_CPU_ENVS:CHROME_CPU_ENVS,NATIVE_ENV:NATIVE_ENV,BROWSER_ENVS:BROWSER_ENVS,ALL_ENVS:ALL_ENVS,expectArraysClose:expectArraysClose,expectPromiseToFail:expectPromiseToFail,expectArraysEqual:expectArraysEqual,expectNumbersClose:expectNumbersClose,expectValuesInRange:expectValuesInRange,expectArrayBuffersEqual:expectArrayBuffersEqual}),version="0.12.0",webgl=Object.freeze({gpgpu_util:gpgpu_util,webgl_util:webgl_util,MathBackendWebGL:MathBackendWebGL,GPGPUContext:GPGPUContext}),Optimizer=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return __extends(t,e),t.prototype.minimize=function(e,t,r){void 0===t&&(t=!1);var n=this.computeGradients(e,r),a=n.value,o=n.grads;return this.applyGradients(o),Object.keys(o).forEach(function(e){return o[e].dispose()}),t?a:(a.dispose(),null)},t.prototype.computeGradients=function(e,t){return variableGrads(e,t)},__decorate([doc({heading:"Training",subheading:"Optimizers"})],t.prototype,"minimize",null),__decorate([doc({heading:"Training",subheading:"Classes",namespace:"train"})],t)}(Serializable),DEFAULT_FLOAT32_EPSILON=1e-8,DEFAULT_FLOAT16_EPSILON=1e-4;function getOptimizerDefaultEpsilonValue(){return ENV.get("WEBGL_RENDER_FLOAT32_ENABLED")?DEFAULT_FLOAT32_EPSILON:DEFAULT_FLOAT16_EPSILON}var AdadeltaOptimizer=function(e){function t(t,r,n){void 0===n&&(n=null);var a=e.call(this)||this;return a.learningRate=t,a.rho=r,a.epsilon=n,a.accumulatedGrads={},a.accumulatedUpdates={},a.c=keep(scalar(-t)),a.rhoScalar=keep(scalar(r)),a.oneMinusRho=keep(scalar(1-r)),null===n&&(n=getOptimizerDefaultEpsilonValue()),a.epsilonScalar=keep(scalar(n)),a}return __extends(t,e),t.prototype.applyGradients=function(e){var t=this,r=function(r){var a=ENV.engine.registeredVariables[r];null==n.accumulatedGrads[r]&&tidy(function(){t.accumulatedGrads[r]=zerosLike(a).variable(!1)}),null==n.accumulatedUpdates[r]&&tidy(function(){t.accumulatedUpdates[r]=zerosLike(a).variable(!1)});var o=e[r],i=n.accumulatedGrads[r],s=n.accumulatedUpdates[r];tidy(function(){var e=t.rhoScalar.mul(i).add(t.oneMinusRho.mul(o.square())),n=s.add(t.epsilonScalar).sqrt().div(i.add(t.epsilonScalar).sqrt()).mul(o),u=t.rhoScalar.mul(s).add(t.oneMinusRho.mul(n.square()));t.accumulatedGrads[r].assign(e),t.accumulatedUpdates[r].assign(u);var l=t.c.mul(n).add(a);a.assign(l)})},n=this;for(var a in e)r(a)},t.prototype.dispose=function(){var e=this;this.c.dispose(),this.epsilonScalar.dispose(),this.rhoScalar.dispose(),this.oneMinusRho.dispose(),null!=this.accumulatedUpdates&&(Object.keys(this.accumulatedUpdates).forEach(function(t){return e.accumulatedUpdates[t].dispose()}),Object.keys(this.accumulatedGrads).forEach(function(t){return e.accumulatedGrads[t].dispose()}))},t.prototype.getConfig=function(){return{learningRate:this.learningRate,rho:this.rho,epsilon:this.epsilon}},t.fromConfig=function(e,t){return new e(t.learningRate,t.rho,t.epsilon)},t.className="AdadeltaOptimizer",t}(Optimizer);SerializationMap.register(AdadeltaOptimizer);var AdagradOptimizer=function(e){function t(t,r){void 0===r&&(r=.1);var n=e.call(this)||this;n.learningRate=t,n.initialAccumulatorValue=r,n.accumulatedGrads={},n.c=keep(scalar(-t));var a=getOptimizerDefaultEpsilonValue();return n.epsilon=keep(scalar(a)),n}return __extends(t,e),t.prototype.applyGradients=function(e){var t=this,r=function(r){var a=ENV.engine.registeredVariables[r];null==n.accumulatedGrads[r]&&tidy(function(){t.accumulatedGrads[r]=fill(a.shape,t.initialAccumulatorValue).variable(!1)});var o=e[r],i=n.accumulatedGrads[r];tidy(function(){var e=i.add(o.square());t.accumulatedGrads[r].assign(e);var n=t.c.mul(o.div(e.add(t.epsilon).sqrt())).add(a);a.assign(n)})},n=this;for(var a in e)r(a)},t.prototype.dispose=function(){var e=this;this.epsilon.dispose(),this.c.dispose(),null!=this.accumulatedGrads&&Object.keys(this.accumulatedGrads).forEach(function(t){return e.accumulatedGrads[t].dispose()})},t.prototype.getConfig=function(){return{learningRate:this.learningRate,initialAccumulatorValue:this.initialAccumulatorValue}},t.fromConfig=function(e,t){return new e(t.learningRate,t.initialAccumulatorValue)},t.className="AdagradOptimizer",t}(Optimizer);SerializationMap.register(AdagradOptimizer);var AdamOptimizer=function(e){function t(t,r,n,a){void 0===a&&(a=null);var o=e.call(this)||this;return o.learningRate=t,o.beta1=r,o.beta2=n,o.epsilon=a,o.accumulatedFirstMoment={},o.accumulatedSecondMoment={},o.c=keep(scalar(-t)),o.beta1Scalar=keep(scalar(r)),o.beta2Scalar=keep(scalar(n)),tidy(function(){o.accBeta1=scalar(r).variable(),o.accBeta2=scalar(n).variable()}),o.oneMinusBeta1=keep(scalar(1-r)),o.oneMinusBeta2=keep(scalar(1-n)),o.one=keep(scalar(1)),null===a&&(a=getOptimizerDefaultEpsilonValue()),o.epsScalar=keep(scalar(a)),o}return __extends(t,e),t.prototype.applyGradients=function(e){var t=this;tidy(function(){var r=t.one.sub(t.accBeta1),n=t.one.sub(t.accBeta2);for(var a in e){var o=ENV.engine.registeredVariables[a];if(null==t.accumulatedFirstMoment[a]){var i=!1;t.accumulatedFirstMoment[a]=zerosLike(o).variable(i)}null==t.accumulatedSecondMoment[a]&&(i=!1,t.accumulatedSecondMoment[a]=zerosLike(o).variable(i));var s=e[a],u=t.accumulatedFirstMoment[a],l=t.accumulatedSecondMoment[a],c=t.beta1Scalar.mul(u).add(t.oneMinusBeta1.mul(s)),p=t.beta2Scalar.mul(l).add(t.oneMinusBeta2.mul(s.square())),d=c.div(r),h=p.div(n);t.accumulatedFirstMoment[a].assign(c),t.accumulatedSecondMoment[a].assign(p);var f=t.c.mul(d.div(t.epsScalar.add(h.sqrt()))).add(o);o.assign(f)}t.accBeta1.assign(t.accBeta1.mul(t.beta1Scalar)),t.accBeta2.assign(t.accBeta2.mul(t.beta2Scalar))})},t.prototype.dispose=function(){var e=this;this.c.dispose(),this.epsScalar.dispose(),this.beta1Scalar.dispose(),this.beta2Scalar.dispose(),this.accBeta1.dispose(),this.accBeta2.dispose(),this.oneMinusBeta1.dispose(),this.oneMinusBeta2.dispose(),this.one.dispose(),null!=this.accumulatedFirstMoment&&Object.keys(this.accumulatedFirstMoment).forEach(function(t){return e.accumulatedFirstMoment[t].dispose()}),null!=this.accumulatedSecondMoment&&Object.keys(this.accumulatedSecondMoment).forEach(function(t){return e.accumulatedSecondMoment[t].dispose()})},t.prototype.getConfig=function(){return{learningRate:this.learningRate,beta1:this.beta1,beta2:this.beta2,epsilon:this.epsilon}},t.fromConfig=function(e,t){return new e(t.learningRate,t.beta1,t.beta2,t.epsilon)},t.className="AdamOptimizer",t}(Optimizer);SerializationMap.register(AdamOptimizer);var AdamaxOptimizer=function(e){function t(t,r,n,a,o){void 0===a&&(a=null),void 0===o&&(o=0);var i=e.call(this)||this;return i.learningRate=t,i.beta1=r,i.beta2=n,i.epsilon=a,i.decay=o,i.accumulatedFirstMoment={},i.accumulatedWeightedInfNorm={},i.c=keep(scalar(-t)),i.beta1Scalar=keep(scalar(r)),i.beta2Scalar=keep(scalar(n)),i.decayScalar=keep(scalar(o)),tidy(function(){i.iteration=scalar(0).variable(),i.accBeta1=scalar(r).variable()}),i.oneMinusBeta1=keep(scalar(1-r)),i.one=keep(scalar(1)),null===a&&(a=getOptimizerDefaultEpsilonValue()),i.epsScalar=keep(scalar(a)),i}return __extends(t,e),t.prototype.applyGradients=function(e){var t=this;tidy(function(){var r=t.one.sub(t.accBeta1),n=t.c.div(t.one.add(t.decayScalar.mul(t.iteration)));for(var a in e){var o=ENV.engine.registeredVariables[a];if(null==t.accumulatedFirstMoment[a]){var i=!1;t.accumulatedFirstMoment[a]=zerosLike(o).variable(i)}null==t.accumulatedWeightedInfNorm[a]&&(i=!1,t.accumulatedWeightedInfNorm[a]=zerosLike(o).variable(i));var s=e[a],u=t.accumulatedFirstMoment[a],l=t.accumulatedWeightedInfNorm[a],c=t.beta1Scalar.mul(u).add(t.oneMinusBeta1.mul(s)),p=t.beta2Scalar.mul(l),d=s.abs(),h=p.maximum(d);t.accumulatedFirstMoment[a].assign(c),t.accumulatedWeightedInfNorm[a].assign(h);var f=n.div(r).mul(c.div(t.epsScalar.add(h))).add(o);o.assign(f)}t.iteration.assign(t.iteration.add(t.one)),t.accBeta1.assign(t.accBeta1.mul(t.beta1Scalar))})},t.prototype.dispose=function(){var e=this;this.c.dispose(),this.epsScalar.dispose(),this.accBeta1.dispose(),this.beta1Scalar.dispose(),this.beta2Scalar.dispose(),this.oneMinusBeta1.dispose(),this.decayScalar.dispose(),this.iteration.dispose(),this.one.dispose(),null!=this.accumulatedFirstMoment&&Object.keys(this.accumulatedFirstMoment).forEach(function(t){return e.accumulatedFirstMoment[t].dispose()}),null!=this.accumulatedWeightedInfNorm&&Object.keys(this.accumulatedWeightedInfNorm).forEach(function(t){return e.accumulatedWeightedInfNorm[t].dispose()})},t.prototype.getConfig=function(){return{learningRate:this.learningRate,beta1:this.beta1,beta2:this.beta2,epsilon:this.epsilon,decay:this.decay}},t.fromConfig=function(e,t){return new e(t.learningRate,t.beta1,t.beta2,t.epsilon,t.decay)},t.className="AdamaxOptimizer",t}(Optimizer);SerializationMap.register(AdamaxOptimizer);var SGDOptimizer=function(e){function t(t){var r=e.call(this)||this;return r.learningRate=t,r.setLearningRate(t),r}return __extends(t,e),t.prototype.applyGradients=function(e){var t=this;Object.keys(e).forEach(function(r){var n=e[r],a=ENV.engine.registeredVariables[r];tidy(function(){var e=t.c.mul(n).add(a);a.assign(e)})})},t.prototype.setLearningRate=function(e){this.learningRate=e,null!=this.c&&this.c.dispose(),this.c=keep(scalar(-e))},t.prototype.dispose=function(){this.c.dispose()},t.prototype.getConfig=function(){return{learningRate:this.learningRate}},t.fromConfig=function(e,t){return new e(t.learningRate)},t.className="SGDOptimizer",t}(Optimizer);SerializationMap.register(SGDOptimizer);var MomentumOptimizer=function(e){function t(t,r,n){void 0===n&&(n=!1);var a=e.call(this,t)||this;return a.learningRate=t,a.momentum=r,a.useNesterov=n,a.m=scalar(a.momentum),a.accumulations={},a}return __extends(t,e),t.prototype.applyGradients=function(e){var t=this,r=function(r){var a=ENV.engine.registeredVariables[r];null==n.accumulations[r]&&tidy(function(){t.accumulations[r]=zerosLike(a).variable(!1)});var o=n.accumulations[r],i=e[r];tidy(function(){var e,n=t.m.mul(o).add(i);e=t.useNesterov?t.c.mul(i.add(n.mul(t.m))).add(a):t.c.mul(n).add(a),t.accumulations[r].assign(n),a.assign(e)})},n=this;for(var a in e)r(a)},t.prototype.dispose=function(){if(e.prototype.dispose.call(this),this.m.dispose(),null!=this.accumulations)for(var t in this.accumulations)this.accumulations[t].dispose()},t.prototype.setMomentum=function(e){this.momentum=e},t.prototype.getConfig=function(){return{learningRate:this.learningRate,momentum:this.momentum,useNesterov:this.useNesterov}},t.fromConfig=function(e,t){return new e(t.learningRate,t.momentum,t.useNesterov)},t.className="MomentumOptimizer",t}(SGDOptimizer);SerializationMap.register(MomentumOptimizer);var RMSPropOptimizer=function(e){function t(t,r,n,a,o){void 0===r&&(r=.9),void 0===n&&(n=0),void 0===a&&(a=null),void 0===o&&(o=!1);var i=e.call(this)||this;return i.learningRate=t,i.decay=r,i.momentum=n,i.epsilon=a,i.accumulatedMeanSquares={},i.accumulatedMeanGrads={},i.accumulatedMoments={},i.c=keep(scalar(t)),i.decayScalar=keep(scalar(r)),i.momentumScalar=keep(scalar(n)),i.oneMinusDecay=keep(scalar(1-r)),i.centered=o,null===a&&(a=getOptimizerDefaultEpsilonValue()),i.epsilonScalar=keep(scalar(a)),i}return __extends(t,e),t.prototype.applyGradients=function(e){var t=this,r=function(r){var a=ENV.engine.registeredVariables[r];null==n.accumulatedMeanSquares[r]&&tidy(function(){t.accumulatedMeanSquares[r]=zerosLike(a).variable(!1)}),null==n.accumulatedMeanGrads[r]&&n.centered&&tidy(function(){t.accumulatedMeanGrads[r]=zerosLike(a).variable(!1)}),null==n.accumulatedMoments[r]&&tidy(function(){t.accumulatedMoments[r]=zerosLike(a).variable(!1)});var o=n.accumulatedMeanSquares[r],i=n.accumulatedMeanGrads[r],s=n.accumulatedMoments[r],u=e[r];tidy(function(){var e=t.decayScalar.mul(o).add(t.oneMinusDecay.mul(u.square()));if(t.centered){var n=t.decayScalar.mul(i).add(t.oneMinusDecay.mul(u)),l=t.momentumScalar.mul(s).add(t.c.mul(u).div(e.sub(n.square().add(t.epsilonScalar)).sqrt()));t.accumulatedMeanSquares[r].assign(e),t.accumulatedMeanGrads[r].assign(n),t.accumulatedMoments[r].assign(l);var c=a.sub(l);a.assign(c)}else{var p=t.decayScalar.mul(o).add(t.oneMinusDecay.mul(u.square()));l=t.momentumScalar.mul(s).add(t.c.mul(u).div(p.add(t.epsilonScalar).sqrt())),t.accumulatedMeanSquares[r].assign(p),t.accumulatedMoments[r].assign(l),c=a.sub(l),a.assign(c)}})},n=this;for(var a in e)r(a)},t.prototype.dispose=function(){var e=this;this.c.dispose(),this.epsilonScalar.dispose(),this.decayScalar.dispose(),this.momentumScalar.dispose(),this.oneMinusDecay.dispose(),null!=this.accumulatedMeanSquares&&Object.keys(this.accumulatedMeanSquares).forEach(function(t){return e.accumulatedMeanSquares[t].dispose()}),null!=this.accumulatedMeanGrads&&this.centered&&Object.keys(this.accumulatedMeanGrads).forEach(function(t){return e.accumulatedMeanGrads[t].dispose()}),null!=this.accumulatedMoments&&Object.keys(this.accumulatedMoments).forEach(function(t){return e.accumulatedMoments[t].dispose()})},t.prototype.getConfig=function(){return{learningRate:this.learningRate,decay:this.decay,momentum:this.momentum,epsilon:this.epsilon,centered:this.centered}},t.fromConfig=function(e,t){return new e(t.learningRate,t.decay,t.momentum,t.epsilon,t.centered)},t.className="RMSPropOptimizer",t}(Optimizer);SerializationMap.register(RMSPropOptimizer);var OptimizerConstructors=function(){function e(){}return e.sgd=function(e){return new SGDOptimizer(e)},e.momentum=function(e,t,r){return void 0===r&&(r=!1),new MomentumOptimizer(e,t,r)},e.rmsprop=function(e,t,r,n,a){return void 0===t&&(t=.9),void 0===r&&(r=0),void 0===n&&(n=null),void 0===a&&(a=!1),new RMSPropOptimizer(e,t,r,n,a)},e.adam=function(e,t,r,n){return void 0===e&&(e=.001),void 0===t&&(t=.9),void 0===r&&(r=.999),void 0===n&&(n=null),new AdamOptimizer(e,t,r,n)},e.adadelta=function(e,t,r){return void 0===e&&(e=.001),void 0===t&&(t=.95),void 0===r&&(r=null),new AdadeltaOptimizer(e,t,r)},e.adamax=function(e,t,r,n,a){return void 0===e&&(e=.002),void 0===t&&(t=.9),void 0===r&&(r=.999),void 0===n&&(n=null),void 0===a&&(a=0),new AdamaxOptimizer(e,t,r,n,a)},e.adagrad=function(e,t){return void 0===t&&(t=.1),new AdagradOptimizer(e,t)},__decorate([doc({heading:"Training",subheading:"Optimizers",namespace:"train"})],e,"sgd",null),__decorate([doc({heading:"Training",subheading:"Optimizers",namespace:"train"})],e,"momentum",null),__decorate([doc({heading:"Training",subheading:"Optimizers",namespace:"train"})],e,"rmsprop",null),__decorate([doc({heading:"Training",subheading:"Optimizers",namespace:"train"})],e,"adam",null),__decorate([doc({heading:"Training",subheading:"Optimizers",namespace:"train"})],e,"adadelta",null),__decorate([doc({heading:"Training",subheading:"Optimizers",namespace:"train"})],e,"adamax",null),__decorate([doc({heading:"Training",subheading:"Optimizers",namespace:"train"})],e,"adagrad",null),e}(),train={sgd:OptimizerConstructors.sgd,momentum:OptimizerConstructors.momentum,adadelta:OptimizerConstructors.adadelta,adagrad:OptimizerConstructors.adagrad,rmsprop:OptimizerConstructors.rmsprop,adamax:OptimizerConstructors.adamax,adam:OptimizerConstructors.adam},setBackend=Environment.setBackend,getBackend=Environment.getBackend,disposeVariables=Environment.disposeVariables,memory=Environment.memory,nextFrame=BrowserUtil.nextFrame;setOpHandler(ops);var extendStatics$1=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])};function __extends$1(e,t){function r(){this.constructor=e}extendStatics$1(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}var __assign=Object.assign||function(e){for(var t,r=1,n=arguments.length;r=0;s--)(a=e[s])&&(i=(o<3?a(i):o>3?a(t,r,i):a(t,r))||i);return o>3&&i&&Object.defineProperty(t,r,i),i}function __awaiter$1(e,t,r,n){return new(r||(r=Promise))(function(a,o){function i(e){try{u(n.next(e))}catch(e){o(e)}}function s(e){try{u(n.throw(e))}catch(e){o(e)}}function u(e){e.done?a(e.value):new r(function(t){t(e.value)}).then(i,s)}u((n=n.apply(e,t||[])).next())})}function __generator$1(e,t){var r,n,a,o,i={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(r)throw new TypeError("Generator is already executing.");for(;i;)try{if(r=1,n&&(a=n[2&o[0]?"return":o[0]?"throw":"next"])&&!(a=a.call(n,o[1])).done)return a;switch(n=0,a&&(o=[0,a.value]),o[0]){case 0:case 1:a=o;break;case 4:return i.label++,{value:o[1],done:!1};case 5:i.label++,n=o[1],o=[0];continue;case 7:o=i.ops.pop(),i.trys.pop();continue;default:if(!(a=(a=i.trys).length>0&&a[a.length-1])&&(6===o[0]||2===o[0])){i=0;continue}if(3===o[0]&&(!a||o[1]>a[0]&&o[1]t?1:0}function reverseNumberCompare(e,t){return-1*numberCompare(e,t)}function stringToDType(e){switch(e){case"float32":return"float32";default:throw new ValueError("Invalid dtype: "+e)}}function unique(e){if(null==e)return e;for(var t=[],r=0,n=e;r=0),assert$1(n>=r),Array.isArray(e)&&e.length>=r&&e.length<=n&&e.every(function(e){return typeof e===t})}function calcL2Norms(e,t){return tidy(function(){return sqrt(sum(mulStrict(e,e),t,!0))})}var Constraint=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return __extends$1(t,e),t.prototype.getConfig=function(){return{}},__decorate$1([doc({heading:"Constraints",subheading:"Classes",namespace:"constraints"})],t)}(serialization.Serializable),MaxNorm=function(e){function t(t){var r=e.call(this)||this;return r.defaultMaxValue=2,r.defaultAxis=0,r.maxValue=null!=t.maxValue?t.maxValue:r.defaultMaxValue,r.axis=null!=t.axis?t.axis:r.defaultAxis,r}return __extends$1(t,e),t.prototype.apply=function(e){var t=this;return tidy(function(){var r=calcL2Norms(e,t.axis),n=clipByValue(r,0,t.maxValue);return mul(e,div(n,add(getScalar(epsilon()),r)))})},t.prototype.getConfig=function(){return{maxValue:this.maxValue,axis:this.axis}},t.className="MaxNorm",t}(Constraint);serialization.SerializationMap.register(MaxNorm);var UnitNorm=function(e){function t(t){var r=e.call(this)||this;return r.defaultAxis=0,r.axis=null!=t.axis?t.axis:r.defaultAxis,r}return __extends$1(t,e),t.prototype.apply=function(e){var t=this;return tidy(function(){return div(e,add(getScalar(epsilon()),calcL2Norms(e,t.axis)))})},t.prototype.getConfig=function(){return{axis:this.axis}},t.className="UnitNorm",t}(Constraint);serialization.SerializationMap.register(UnitNorm);var NonNeg=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return __extends$1(t,e),t.prototype.apply=function(e){return relu(e)},t.className="NonNeg",t}(Constraint);serialization.SerializationMap.register(NonNeg);var MinMaxNorm=function(e){function t(t){var r=e.call(this)||this;return r.defaultMinValue=0,r.defaultMaxValue=1,r.defaultRate=1,r.defaultAxis=0,r.minValue=null!=t.minValue?t.minValue:r.defaultMinValue,r.maxValue=null!=t.maxValue?t.maxValue:r.defaultMaxValue,r.rate=null!=t.rate?t.rate:r.defaultRate,r.axis=null!=t.axis?t.axis:r.defaultAxis,r}return __extends$1(t,e),t.prototype.apply=function(e){var t=this;return tidy(function(){var r=calcL2Norms(e,t.axis),n=add(mul(getScalar(t.rate),clipByValue(r,t.minValue,t.maxValue)),mul(getScalar(1-t.rate),r));return mul(e,div(n,add(getScalar(epsilon()),r)))})},t.prototype.getConfig=function(){return{minValue:this.minValue,maxValue:this.maxValue,rate:this.rate,axis:this.axis}},t.className="MinMaxNorm",t}(Constraint);serialization.SerializationMap.register(MinMaxNorm);var CONSTRAINT_IDENTIFIER_REGISTRY_SYMBOL_MAP={maxNorm:"MaxNorm",minMaxNorm:"MinMaxNorm",nonNeg:"NonNeg",unitNorm:"UnitNorm"};function serializeConstraint(e){return serializeKerasObject(e)}function deserializeConstraint(e,t){return void 0===t&&(t={}),deserializeKerasObject(e,serialization.SerializationMap.getMap().classNameMap,t,"constraint")}function getConstraint(e){return null==e?null:"string"==typeof e?deserializeConstraint({className:e in CONSTRAINT_IDENTIFIER_REGISTRY_SYMBOL_MAP?CONSTRAINT_IDENTIFIER_REGISTRY_SYMBOL_MAP[e]:e,config:{}}):e instanceof Constraint?e:deserializeConstraint(e)}var nameMap=new Map,VALID_DATA_FORMAT_VALUES=["channelsFirst","channelsLast"];function checkDataFormat(e){checkStringTypeUnionValue(VALID_DATA_FORMAT_VALUES,"DataFormat",e)}var VALID_PADDING_MODE_VALUES=["valid","same","causal"];function checkPaddingMode(e){checkStringTypeUnionValue(VALID_PADDING_MODE_VALUES,"PaddingMode",e)}var VALID_POOL_MODE_VALUES=["max","avg"];function checkPoolMode(e){checkStringTypeUnionValue(VALID_POOL_MODE_VALUES,"PoolMode",e)}var _nameScopeStack=[],_nameScopeDivider="/";function nameScope(e,t){_nameScopeStack.push(e);try{var r=t();return _nameScopeStack.pop(),r}catch(e){throw _nameScopeStack.pop(),e}}function currentNameScopePrefix(){return 0===_nameScopeStack.length?"":_nameScopeStack.join(_nameScopeDivider)+_nameScopeDivider}function getScopedTensorName(e){if(!isValidTensorName(e))throw new Error("Not a valid tensor name: '"+e+"'");return currentNameScopePrefix()+e}function getUniqueTensorName(e){if(!isValidTensorName(e))throw new Error("Not a valid tensor name: '"+e+"'");nameMap.has(e)||nameMap.set(e,0);var t=nameMap.get(e);if(nameMap.set(e,nameMap.get(e)+1),t>0){var r=e+"_"+t;return nameMap.set(r,1),r}return e}var tensorNameRegex=new RegExp(/^[A-Za-z][A-Za-z0-9\._\/]*$/);function isValidTensorName(e){return!!e.match(tensorNameRegex)}function deserialize(e,t){return void 0===t&&(t={}),deserializeKerasObject(e,serialization.SerializationMap.getMap().classNameMap,t,"layer")}function isArrayItemInputOrOutputName(e,t,r){return("inboundNodes"===e||"outputLayers"===e||"inputLayers"===e)&&0===t&&"string"==typeof r}function convertPythonicToTs(e,t){if(null===e)return null;if("string"==typeof e)return toCamelCase(e);if("number"==typeof e||"boolean"==typeof e)return e;if(e instanceof Array){for(var r=[],n=e.length,a=0;a1)throw new AttributeError("Layer "+this.name+' has multiple inbound nodes, hence the notion of "layer input" is ill-defined. Use `getInputAt(nodeIndex)` instead.');if(0===this.inboundNodes.length)throw new AttributeError("Layer "+this.name+" is not connected, no input to return.");return singletonOrArray(this.getNodeAtIndex(0,"input").inputTensors)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"output",{get:function(){if(0===this.inboundNodes.length)throw new AttributeError("Layer "+this.name+" has no inbound nodes.");if(this.inboundNodes.length>1)throw new AttributeError("Layer "+this.name+' has multiple inbound nodes, hence the notion of "layer output" is ill-defined. Use `getOutputAt(nodeIndex)` instead.');return singletonOrArray(this.getNodeAtIndex(0,"output").outputTensors)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"losses",{get:function(){return this._losses},enumerable:!0,configurable:!0}),t.prototype.calculateLosses=function(){return this.losses.map(function(e){return e()})},Object.defineProperty(t.prototype,"updates",{get:function(){return this._updates},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"built",{get:function(){return this._built},set:function(e){this._built=e},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"trainableWeights",{get:function(){return this.trainable?this._trainableWeights:[]},set:function(e){this._trainableWeights=e},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"nonTrainableWeights",{get:function(){return this.trainable?this._nonTrainableWeights:this._trainableWeights.concat(this._nonTrainableWeights)},set:function(e){this._nonTrainableWeights=e},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"weights",{get:function(){return this.trainableWeights.concat(this.nonTrainableWeights)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"stateful",{get:function(){return this._stateful},enumerable:!0,configurable:!0}),t.prototype.assertInputCompatibility=function(e){if(e=toList(e),null!=this.inputSpec&&0!==this.inputSpec.length){var t=toList(this.inputSpec);if(e.length!==t.length)throw new ValueError("Layer "+this.name+" expects "+t.length+" inputs, but it received "+e.length+" input tensors. Input received: "+e);for(var r=0;r=0?i[u]:i[i.length+u];if(null!=l&&-1===[l,null].indexOf(c))throw new ValueError("Input "+r+" is incompatible with layer "+this.name+": expected axis "+u+" of input shape to have value "+l+" but got shape "+i+".")}}if(null!=a.shape)for(var p=0;p0&&Array.isArray(f[0])?f.map(function(n,a){return new SymbolicTensor(g,n,r,toList(e),t,r.name,a)}):new SymbolicTensor(g,f,r,toList(e),t,r.name),r.addInboundNode(e,m,null,null,h,f,t),null!=r.activityRegularizer)throw new NotImplementedError("Layer invocation in the presence of activity regularizer(s) is not supported yet.");return m})},Object.defineProperty(t.prototype,"outputShape",{get:function(){if(null==this.inboundNodes||0===this.inboundNodes.length)throw new AttributeError("The layer "+this.name+" has never been called and thus has no defined output shape.");for(var e=[],t=0,r=this.inboundNodes;t1 nodes"),assert$1(0===l,"input layer has >1 tensors"),n.inputLayers.push(s),n.inputLayersNodeIndices.push(u),n.inputLayersTensorIndices.push(l);n.inputNames=[],n.outputNames=[],n.feedInputShapes=[],n.feedInputNames=[],n.feedOutputNames=[];for(var d=0;d=0;)a.splice(a.indexOf(u),1);x.push(u)}},S=[],T=[],N=0,E=n.outputs;Nn?1:0});for(var U=0,W=$;U0)throw new ValueError("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[];for(var e=[],t=0,r=this.layers;t1)for(var s=0,u=i;s0)){for(var h=[],f=0;f0&&e.apply(singletonOrArray(o),n)}function i(e){var n=e.name,o=deserialize(e,null!=t.customObjects?t.customObjects:{});r[n]=o;for(var i=0,s=e.inboundNodes;i0)&&(t=e.sourceLayer,r=e.nodeIndex),0===t.inboundNodes.length)return[e];var n=t.inboundNodes[r];if(0===n.inboundLayers.length)return n.inputTensors;for(var a=[],o=0;o0)throw new ValueError(p.length+" of "+n+" weights are not set: "+p);batchSetValue(l)}function loadWeightsFromJson(e,t,r){void 0===r&&(r=!1);for(var n=e.keras_version,a=e.backend,o=t.map(function(e){return e.name}),i={},s=0,u=t;s1||1===s.length&&s[0].inboundLayers.length>1){t=!1;break}n.push.apply(n,s)}if(t)for(var u=0,l=e.layers;u0&&(n=n.slice(0,n.length-1)+" "),n=(n+=e[a]).slice(0,t[a]),n+=" ".repeat(t[a]-n.length);r(n)}function printLayerSummary(e,t,r){var n;try{n=JSON.stringify(e.outputShape)}catch(e){n="multiple"}printRow([e.name+" ("+e.getClassName()+")",n,e.countParams().toString()],t,r)}function printLayerSummaryWithConnections(e,t,r,n){var a;try{a=JSON.stringify(e.outputShape)}catch(e){a="multiple"}for(var o=[],i=0,s=e.inboundNodes;i0&&-1===r.indexOf(u)))for(var l=0;l0)o=!0;else if(isDataDict(e)){for(var i in e)if(e.hasOwnProperty(i)){o=!0;break}}else o=!0;if(o)throw new ValueError("Error when checking model "+a+" expected no data, but got "+e)}return[]}if(null==e)return t.map(function(e){return null});var s;if(isDataDict(e)){e=e,s=[];for(var u=0,l=t;u1)throw new ValueError("The model "+a+" expects "+t.length+" Tensor(s), but only received one Tensor. Found: Tensor with shape "+e.shape);s=[e]}for(var p=0;p=0&&f!==m)throw new ValueError("Error when checking "+a+": expected "+t[p]+" to have shape ["+r[p]+"], but got array with shape ["+d.shape+"].")}}return s}function checkArrayLengths(e,t,r){var n=unique(e.map(function(e){return e.shape[0]}));n.sort();var a=unique(t.map(function(e){return e.shape[0]}));if(a.sort(),n.length>1)throw new ValueError("All input Tensors (x) should have the same number of samples. Got array shapes: "+JSON.stringify(e.map(function(e){return e.shape})));if(a.length>1)throw new ValueError("All target Tensors (y) should have the same number of samples. Got array shapes: "+JSON.stringify(t.map(function(e){return e.shape})));if(n.length>0&&a.length>0&&!util.arraysEqual(n,a))throw new ValueError("Input Tensors should have the same number of samples as target Tensors. Found "+n[0]+" input sample(s) and "+a[0]+" target sample(s).")}function checkLossAndTargetCompatibility(e,t,r){for(var n=[meanSquaredError,binaryCrossentropy,categoricalCrossentropy],a=0;a=e&&(a=e),r.push([n,a]),n=a;return r}function sliceArrays(e,t,r){return null==e?[null]:Array.isArray(e)?e.map(function(e){return sliceAlongFirstAxis(e,t,r-t)}):sliceAlongFirstAxis(e,t,r-t)}function sliceArraysByIndices(e,t){return tidy(function(){return null==e?null:Array.isArray(e)?e.map(function(e){return sliceArraysByIndices(e,t)}):gather$1(e,"int32"===t.dtype?t:t.toInt())})}function checkInputData(e,t,r,n,a){var o;if(void 0===n&&(n=!0),void 0===a&&(a=""),Array.isArray(e)){if(e.length!==t.length)throw new ValueError("Error when checking model "+a+": the Array of Tensors that you are passing to your model is not the size the the model expected. Expected to see "+t.length+" Tensor(s), but instead got "+e.length+" Tensors(s).");o=e}else{if(t.length>1)throw new ValueError("The model expects "+t.length+" "+a+" Tensors, but only received one Tensor. Found: array with shape "+JSON.stringify(e.shape)+".");o=[e]}if(null!=r)for(var i=0;i1&&(t.metricsTensors.push([r,e]),t.metricsNames.push(t.outputNames[e]+"_loss"))}});var p=collectMetrics(e.metrics,this.outputNames);nameScope("metric",function(){for(var e=function(e){if(-1!==c.indexOf(e))return"continue";!function(r){for(var n,a,o,i=function(r){if(-1!==["accuracy","acc","crossentropy","ce"].indexOf(r)){var i=t.internalOutputShapes[e];1===i[i.length-1]||t.lossFunctions[e]===binaryCrossentropy?-1!==["accuracy","acc"].indexOf(r)?a=binaryAccuracy:-1!==["crossentropy","ce"].indexOf(r)&&(a=binaryCrossentropy$1):t.lossFunctions[e]===sparseCategoricalCrossentropy?-1!==["accuracy","acc"].indexOf(r)?a=sparseCategoricalAccuracy:-1!==["crossentropy","ce"].indexOf(r)&&(a=sparseCategoricalCrossentropy$1):-1!==["accuracy","acc"].indexOf(r)?a=categoricalAccuracy:-1!==["crossentropy","ce"].indexOf(r)&&(a=categoricalCrossentropy$1);var s=void 0;-1!==["accuracy","acc"].indexOf(r)?s="acc":-1!==["crossentropy","ce"].indexOf(r)&&(s="ce"),o=a,n=""+s}else{var u=get$1(r);o=u,n=""+r}var l;nameScope(n,function(){l=o}),function(e,r,n){t.outputNames.length>1&&(r=t.outputNames[e]+"_"+r),t.metricsNames.push(r),t.metricsTensors.push([n,e])}(e,n,l)},s=0,u=p[e];s0){var c=[];throw t.forEach(function(t,r){null==t&&c.push(e[r])}),new ValueError("Cannot find SymbolicTensors for output name(s): "+JSON.stringify(c))}return t},t.prototype.predictLoop=function(e,t,r){var n=this;return void 0===t&&(t=32),void 0===r&&(r=!1),tidy(function(){var a=n.checkNumSamples(e);if(r)throw new NotImplementedError("Verbose predictLoop() is not implemented yet.");for(var o=makeBatches(a,t),i=[],s=function(t){var r=tidy(function(){var r=o[t][0],a=o[t][1],i=sliceArrays(e,r,a),s=[];if(Array.isArray(i))for(var u=0;u0&&e[0].shape[0]%n!=0)throw new ValueError("In a stateful network, you should only pass inputs with a number of samples that is divisible by the batch size "+n+". Found: "+e[0].shape[0]+" sample(s).");return[e,t,null]},t.prototype.fitLoop=function(e,t,r,n,a,o,i,s,u,l,c,p,d,h){return void 0===p&&(p=0),__awaiter$1(this,void 0,void 0,function(){var f,m,g,y,v,b,x,w=this;return __generator$1(this,function(S){switch(S.label){case 0:if(null==n&&(n=32),null==a&&(a=1),null==l&&(l=!0),null==p&&(p=0),f=!1,null!=s&&null!=u&&(f=!0),null!=h&&(f=!0,null==d))throw new ValueError("Can only use `validationSteps` when doing step-wise training, i.e., `stepsPerEpoch` must be set.");if(null!=(m=this.checkNumSamples(t,n,d,"steps_per_epoch"))&&(g=range$1(0,m)),this.history=new History,i=(i=null==i?[new BaseLogger]:[new BaseLogger].concat(i)).concat([this.history]),o>0)throw new NotImplementedError("Verbose mode is not implemented yet.");return(y=new CallbackList(i)).setModel(this),y.setParams({epochs:a,steps:d,verbose:o,doValidation:f,metrics:c}),[4,y.onTrainBegin()];case 1:S.sent(),this.stopTraining=!1,v=function(a){var o,i,c,p,h;return __generator$1(this,function(v){switch(v.label){case 0:return[4,y.onEpochBegin(a)];case 1:if(v.sent(),o={},null==d)return[3,2];throw new NotImplementedError("stepsPerEpoch mode is not implemented yet.");case 2:if("batch"===l)throw new NotImplementedError("batch shuffling is not implemneted yet");l&&util.shuffle(g),i=tensor1d(g),c=makeBatches(m,n),p=function(a){var l;return __generator$1(this,function(p){switch(p.label){case 0:return l={},[4,y.onBatchBegin(a,l)];case 1:return p.sent(),tidy(function(){var p=c[a][0],d=c[a][1],h=sliceAlongFirstAxis(i,p,d-p);l.batch=a,l.size=d-p;for(var m=sliceArraysByIndices(t,h),g=e(m),y=0;y1&&(a+="_"+count(e.slice(0,r),n)),t.push(a)}return t},t.prototype.makeTestFunction=function(){var e=this;this.testFunction=function(t){return tidy(function(){for(var r,n=[],a=t.slice(0,e.inputs.length),o=t.slice(e.inputs.length,e.inputs.length+e.outputs.length),i=[],s=0;s0){if(s=!0,2!==r.validationData.length)throw 3===r.validationData.length?new NotImplementedError("validationData including sample weights is not supported yet."):new ValueError("When passing validation data, it must contain 2 (valX, valY) or 3 (valX, valY, valSampleWeight) items; "+r.validationData+" is invalid.");u=r.validationData[0],l=r.validationData[1],d=this.standardizeUserData(u,l,!0,n),u=d[0],l=d[1],c=u.concat(l)}else null!=r.validationSplit&&r.validationSplit>0&&r.validationSplit<1?(s=!0,h=Math.floor(o[0].shape[0]*(1-r.validationSplit)),f=o[0].shape[0],u=sliceArrays(o,h,f),o=sliceArrays(o,0,h),l=sliceArrays(i,h,f),i=sliceArrays(i,0,h),p=!0,c=u.concat(l)):null!=r.validationSteps&&(s=!0);return m=o.concat(i),this.checkTrainableWeightsConsistency(),g=function(e){var t=e.slice(0,S.inputs.length),r=e.slice(S.inputs.length,S.inputs.length+S.outputs.length),n=[],a=S.collectedTrainableWeights.map(function(e){return e.read()});return[S.optimizer.minimize(function(){for(var e=[],a=0;a1)throw new ValueError("Found more than one ("+r.length+") save handlers for URL '"+e+"'");e=r[0]}if(null==e.save)throw new ValueError("Model.save() cannot proceed because the IOHandler provided does not have the `save` attribute defined.");return[4,io.encodeWeights(this.getNamedWeights(t))];case 1:return n=s.sent(),a=!1,o=null,i=this.toJSON(o,a),[2,e.save({modelTopology:i,weightData:n.data,weightSpecs:n.specs})]}})})},t.className="Model",__decorate$1([doc({heading:"Models",subheading:"Classes"})],t.prototype,"summary",null),__decorate$1([doc({heading:"Models",subheading:"Classes",configParamIndices:[0]})],t.prototype,"compile",null),__decorate$1([doc({heading:"Models",subheading:"Classes",configParamIndices:[2]})],t.prototype,"evaluate",null),__decorate$1([doc({heading:"Models",subheading:"Classes",configParamIndices:[1]})],t.prototype,"predict",null),__decorate$1([doc({heading:"Models",subheading:"Classes"})],t.prototype,"predictOnBatch",null),__decorate$1([doc({heading:"Models",subheading:"Classes",configParamIndices:[2]})],t.prototype,"fit",null),__decorate$1([doc({heading:"Models",subheading:"Classes",configParamIndices:[1]})],t.prototype,"save",null),__decorate$1([doc({heading:"Models",subheading:"Classes"})],t)}(Container);serialization.SerializationMap.register(Model);var VALID_FAN_MODE_VALUES=["fanIn","fanOut","fanAvg"];function checkFanMode(e){checkStringTypeUnionValue(VALID_FAN_MODE_VALUES,"FanMode",e)}var VALID_DISTRIBUTION_VALUES=["normal","uniform"];function checkDistribution(e){checkStringTypeUnionValue(VALID_DISTRIBUTION_VALUES,"Distribution",e)}var Initializer=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return __extends$1(t,e),t.prototype.fromConfigUsesCustomObjects=function(){return!1},t.prototype.getConfig=function(){return{}},__decorate$1([doc({heading:"Initializers",subheading:"Classes",namespace:"initializers"})],t)}(serialization.Serializable),Zeros=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return __extends$1(t,e),t.prototype.apply=function(e,t){return zeros(e,t)},t.className="Zeros",t}(Initializer);serialization.SerializationMap.register(Zeros);var Ones=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return __extends$1(t,e),t.prototype.apply=function(e,t){return ones(e,t)},t.className="Ones",t}(Initializer);serialization.SerializationMap.register(Ones);var Constant=function(e){function t(t){var r=e.call(this)||this;return r.value=t.value,r}return __extends$1(t,e),t.prototype.apply=function(e,t){var r=this;return tidy(function(){return mul(scalar(r.value),ones(e,t))})},t.prototype.getConfig=function(){return{value:this.value}},t.className="Constant",t}(Initializer);serialization.SerializationMap.register(Constant);var RandomUniform=function(e){function t(t){var r=e.call(this)||this;return r.DEFAULT_MINVAL=-.05,r.DEFAULT_MAXVAL=.05,r.minval=t.minval||r.DEFAULT_MINVAL,r.maxval=t.maxval||r.DEFAULT_MAXVAL,r.seed=t.seed,r}return __extends$1(t,e),t.prototype.apply=function(e,t){return randomUniform(e,this.minval,this.maxval,t)},t.prototype.getConfig=function(){return{minval:this.minval,maxval:this.maxval,seed:this.seed}},t.className="RandomUniform",t}(Initializer);serialization.SerializationMap.register(RandomUniform);var RandomNormal=function(e){function t(t){var r=e.call(this)||this;return r.DEFAULT_MEAN=0,r.DEFAULT_STDDEV=.05,r.mean=t.mean||r.DEFAULT_MEAN,r.stddev=t.stddev||r.DEFAULT_STDDEV,r.seed=t.seed,r}return __extends$1(t,e),t.prototype.apply=function(e,t){if("bool"===t)throw new NotImplementedError("randomNormal does not support dType bool.");return randomNormal$1(e,this.mean,this.stddev,t,this.seed)},t.prototype.getConfig=function(){return{mean:this.mean,stddev:this.stddev,seed:this.seed}},t.className="RandomNormal",t}(Initializer);serialization.SerializationMap.register(RandomNormal);var TruncatedNormal=function(e){function t(t){var r=e.call(this)||this;return r.DEFAULT_MEAN=0,r.DEFAULT_STDDEV=.05,r.mean=t.mean||r.DEFAULT_MEAN,r.stddev=t.stddev||r.DEFAULT_STDDEV,r.seed=t.seed,r}return __extends$1(t,e),t.prototype.apply=function(e,t){if("bool"===t)throw new NotImplementedError("truncatedNormal does not support dType bool.");return truncatedNormal(e,this.mean,this.stddev,t,this.seed)},t.prototype.getConfig=function(){return{mean:this.mean,stddev:this.stddev,seed:this.seed}},t.className="TruncatedNormal",t}(Initializer);serialization.SerializationMap.register(TruncatedNormal);var Identity=function(e){function t(t){var r=e.call(this)||this;return r.gain=null!=t.gain?scalar(t.gain):getScalar(1),r}return __extends$1(t,e),t.prototype.apply=function(e,t){var r=this;return tidy(function(){if(2!==e.length||e[0]!==e[1])throw new ValueError("Identity matrix initializer can only be used for 2D square matrices.");return mul(r.gain,eye(e[0]))})},t.prototype.getConfig=function(){return{gain:this.gain.get()}},t.className="Identity",t}(Initializer);function computeFans(e,t){var r,n;if(void 0===t&&(t="channelsLast"),checkDataFormat(t),2===e.length)r=e[0],n=e[1];else if(-1!==[3,4,5].indexOf(e.length))if("channelsFirst"===t){var a=arrayProd(e,2);r=e[1]*a,n=e[0]*a}else"channelsLast"===t&&(a=arrayProd(e,0,e.length-2),r=e[e.length-2]*a,n=e[e.length-1]*a);else{var o=arrayProd(e);r=Math.sqrt(o),n=Math.sqrt(o)}return[r,n]}serialization.SerializationMap.register(Identity);var VarianceScaling=function(e){function t(t){var r=e.call(this)||this;if(t.scale<0)throw new ValueError("scale must be a positive float. Got: "+t.scale);return r.scale=null==t.scale?1:t.scale,r.mode=t.mode,checkFanMode(r.mode),r.distribution=t.distribution,checkDistribution(r.distribution),r.seed=t.seed,r}return __extends$1(t,e),t.prototype.apply=function(e,t){var r=computeFans(e),n=r[0],a=r[1],o=this.scale;if("fanIn"===this.mode?o/=Math.max(1,n):"fanOut"===this.mode?o/=Math.max(1,a):o/=Math.max(1,(n+a)/2),"normal"===this.distribution){var i=Math.sqrt(o);if("bool"===t)throw new NotImplementedError(this.getClassName()+" does not support dType bool.");return truncatedNormal(e,0,i,t,this.seed)}var s=Math.sqrt(3*o);return randomUniform(e,-s,s,t)},t.prototype.getConfig=function(){return{scale:this.scale,mode:this.mode,distribution:this.distribution,seed:this.seed}},t.className="VarianceScaling",t}(Initializer);serialization.SerializationMap.register(VarianceScaling);var GlorotUniform=function(e){function t(t){return e.call(this,{scale:1,mode:"fanAvg",distribution:"uniform",seed:null==t?null:t.seed})||this}return __extends$1(t,e),t.prototype.getClassName=function(){return VarianceScaling.className},t}(VarianceScaling),GlorotNormal=function(e){function t(t){return e.call(this,{scale:1,mode:"fanAvg",distribution:"normal",seed:null==t?null:t.seed})||this}return __extends$1(t,e),t.prototype.getClassName=function(){return VarianceScaling.className},t}(VarianceScaling),HeNormal=function(e){function t(t){return e.call(this,{scale:2,mode:"fanIn",distribution:"normal",seed:null==t?null:t.seed})||this}return __extends$1(t,e),t.prototype.getClassName=function(){return VarianceScaling.className},t}(VarianceScaling),LeCunNormal=function(e){function t(t){return e.call(this,{scale:1,mode:"fanIn",distribution:"normal",seed:null==t?null:t.seed})||this}return __extends$1(t,e),t.prototype.getClassName=function(){return VarianceScaling.className},t}(VarianceScaling),Orthogonal=function(e){function t(t){var r=e.call(this)||this;if(r.DEFAULT_GAIN=1,r.gain=null==t.gain?r.DEFAULT_GAIN:t.gain,r.seed=t.seed,null!=r.seed)throw new NotImplementedError("Random seed is not implemented for Orthogonal Initializer yet.");return r}return __extends$1(t,e),t.prototype.apply=function(e,t){var r=this;return tidy(function(){if(2!==e.length)throw new NotImplementedError("The Orthogonal Initializer does not support non-2D shapes yet.");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.");var t=randomNormal$1(e[0]>e[1]?[e[1],e[0]]:e,0,1,"float32"),n=linalg.gramSchmidt(t);return e[0]>e[1]&&(n=n.transpose()),mul(getScalar(r.gain),n)})},t.prototype.getConfig=function(){return{gain:this.gain,seed:this.seed}},t.className="Orthogonal",t}(Initializer);serialization.SerializationMap.register(Orthogonal);var INITIALIZER_IDENTIFIER_REGISTRY_SYMBOL_MAP={constant:"Constant",glorotNormal:"GlorotNormal",glorotUniform:"GlorotUniform",heNormal:"HeNormal",identity:"Identity",leCunNormal:"LeCunNormal",ones:"Ones",orthogonal:"Orthogonal",randomNormal:"RandomNormal",randomUniform:"RandomUniform",truncatedNormal:"TruncatedNormal",varianceScaling:"VarianceScaling",zeros:"Zeros"};function deserializeInitializer(e,t){return void 0===t&&(t={}),deserializeKerasObject(e,serialization.SerializationMap.getMap().classNameMap,t,"initializer")}function serializeInitializer(e){return serializeKerasObject(e)}function getInitializer(e){if("string"==typeof e){var t=e in INITIALIZER_IDENTIFIER_REGISTRY_SYMBOL_MAP?INITIALIZER_IDENTIFIER_REGISTRY_SYMBOL_MAP[e]:e;return"GlorotUniform"===t?new GlorotUniform:"GlorotNormal"===t?new GlorotNormal:"HeNormal"===t?new HeNormal:"LeCunNormal"===t?new LeCunNormal:deserializeInitializer({className:t,config:{}})}return e instanceof Initializer?e:deserializeInitializer(e)}var Activation=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return __extends$1(t,e),t.prototype.getConfig=function(){return{}},t}(serialization.Serializable),Elu=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return __extends$1(t,e),t.prototype.apply=function(e,t){return void 0===t&&(t=1),elu$1(e,t)},t.className="elu",t}(Activation);serialization.SerializationMap.register(Elu);var Selu=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return __extends$1(t,e),t.prototype.apply=function(e){return selu(e)},t.className="selu",t}(Activation);serialization.SerializationMap.register(Selu);var Relu=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return __extends$1(t,e),t.prototype.apply=function(e){return relu(e)},t.className="relu",t}(Activation);serialization.SerializationMap.register(Relu);var Relu6=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return __extends$1(t,e),t.prototype.apply=function(e){return tidy(function(){return minimum(getScalar(6),relu(e))})},t.className="relu6",t}(Activation);serialization.SerializationMap.register(Relu6);var Linear=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return __extends$1(t,e),t.prototype.apply=function(e){return e},t.className="linear",t}(Activation);serialization.SerializationMap.register(Linear);var Sigmoid=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return __extends$1(t,e),t.prototype.apply=function(e){return sigmoid(e)},t.className="sigmoid",t}(Activation);serialization.SerializationMap.register(Sigmoid);var HardSigmoid=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return __extends$1(t,e),t.prototype.apply=function(e){return hardSigmoid(e)},t.className="hardSigmoid",t}(Activation);serialization.SerializationMap.register(HardSigmoid);var Softplus=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return __extends$1(t,e),t.prototype.apply=function(e){return softplus(e)},t.className="softplus",t}(Activation);serialization.SerializationMap.register(Softplus);var Softsign=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return __extends$1(t,e),t.prototype.apply=function(e){return softsign(e)},t.className="softsign",t}(Activation);serialization.SerializationMap.register(Softsign);var Tanh=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return __extends$1(t,e),t.prototype.apply=function(e){return tanh$1(e)},t.className="tanh",t}(Activation);serialization.SerializationMap.register(Tanh);var Softmax=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return __extends$1(t,e),t.prototype.apply=function(e,t){return void 0===t&&(t=-1),softmax(e,t)},t.className="softmax",t}(Activation);function serializeActivation(e){return e.getClassName()}function deserializeActivation(e,t){return void 0===t&&(t={}),deserializeKerasObject(e,serialization.SerializationMap.getMap().classNameMap,t,"activation")}function getActivation(e){return null==e?deserializeActivation({className:"linear",config:{}}):"string"==typeof e?deserializeActivation({className:e,config:{}}):e instanceof Activation?e:deserializeActivation(e)}serialization.SerializationMap.register(Softmax);var LeakyReLU=function(e){function t(t){var r=e.call(this,null==t?{}:t)||this;return r.DEFAULT_ALPHA=.3,null==t&&(t={}),r.alpha=null==t.alpha?r.DEFAULT_ALPHA:t.alpha,r}return __extends$1(t,e),t.prototype.call=function(e,t){var r=getExactlyOneTensor(e);return leakyRelu(r,this.alpha)},t.prototype.computeOutputShape=function(e){return e},t.prototype.getConfig=function(){var t={alpha:this.alpha},r=e.prototype.getConfig.call(this);return Object.assign(t,r),t},t.className="LeakyReLU",t}(Layer);serialization.SerializationMap.register(LeakyReLU);var ELU$1=function(e){function t(t){var r=e.call(this,null==t?{}:t)||this;if(r.DEFAULT_ALPHA=1,null==t&&(t={}),null!=t.alpha&&t.alpha!==r.DEFAULT_ALPHA)throw new NotImplementedError("Non-default alpha value ("+t.alpha+") is not supported by the ELU layer yet.");return r.alpha=null==t.alpha?r.DEFAULT_ALPHA:t.alpha,r}return __extends$1(t,e),t.prototype.call=function(e,t){var r=getExactlyOneTensor(e);return elu(r)},t.prototype.computeOutputShape=function(e){return e},t.prototype.getConfig=function(){var t={alpha:this.alpha},r=e.prototype.getConfig.call(this);return Object.assign(t,r),t},t.className="ELU",t}(Layer);serialization.SerializationMap.register(ELU$1);var ThresholdedReLU=function(e){function t(t){var r=e.call(this,null==t?{}:t)||this;return r.DEFAULT_THETA=1,null==t&&(t={}),r.theta=null==t.theta?r.DEFAULT_THETA:t.theta,r.thetaTensor=getScalar(r.theta),r}return __extends$1(t,e),t.prototype.call=function(e,t){var r=getExactlyOneTensor(e);return r.mul(cast$1(r.greater(this.thetaTensor),"float32"))},t.prototype.computeOutputShape=function(e){return e},t.prototype.getConfig=function(){var t={theta:this.theta},r=e.prototype.getConfig.call(this);return Object.assign(t,r),t},t.className="ThresholdedReLU",t}(Layer);serialization.SerializationMap.register(ThresholdedReLU);var Softmax$1=function(e){function t(t){var r=e.call(this,null==t?{}:t)||this;return r.DEFAULT_AXIS=1,null==t&&(t={}),r.softmax=(new Softmax).apply,r.axis=null==t.axis?r.DEFAULT_AXIS:t.axis,r}return __extends$1(t,e),t.prototype.call=function(e,t){var r=getExactlyOneTensor(e);return this.softmax(r,this.axis)},t.prototype.computeOutputShape=function(e){return e},t.prototype.getConfig=function(){var t={axis:this.axis},r=e.prototype.getConfig.call(this);return Object.assign(t,r),t},t.className="Softmax",t}(Layer);serialization.SerializationMap.register(Softmax$1);var Regularizer=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return __extends$1(t,e),t}(serialization.Serializable),L1L2=function(e){function t(t){var r=e.call(this)||this,n=null==t||null==t.l1?.01:t.l1,a=null==t||null==t.l2?.01:t.l2;return r.hasL1=0!==n,r.hasL2=0!==a,r.l1=getScalar(n),r.l2=getScalar(a),r}return __extends$1(t,e),t.prototype.apply=function(e){var t=this;return tidy(function(){var r=zeros([1]);return t.hasL1&&(r=add(r,sum(mul(t.l1,abs(e))))),t.hasL2&&(r=add(r,sum(mul(t.l2,square$1(e))))),r.asScalar()})},t.prototype.getConfig=function(){return{l1:this.l1.dataSync()[0],l2:this.l2.dataSync()[0]}},t.fromConfig=function(e,t){return new e({l1:t.l1,l2:t.l2})},t.className="L1L2",__decorate$1([doc({heading:"Regularizers",namespace:"regularizers"})],t)}(Regularizer);function l1(e){return new L1L2({l1:null!=e?e.l1:null,l2:0})}function l2(e){return new L1L2({l2:null!=e?e.l2:null,l1:0})}serialization.SerializationMap.register(L1L2);var REGULARIZER_IDENTIFIER_REGISTRY_SYMBOL_MAP={l1l2:"L1L2"};function serializeRegularizer(e){return serializeKerasObject(e)}function deserializeRegularizer(e,t){return void 0===t&&(t={}),deserializeKerasObject(e,serialization.SerializationMap.getMap().classNameMap,t,"regularizer")}function getRegularizer(e){return null==e?null:"string"==typeof e?deserializeRegularizer({className:e in REGULARIZER_IDENTIFIER_REGISTRY_SYMBOL_MAP?REGULARIZER_IDENTIFIER_REGISTRY_SYMBOL_MAP[e]:e,config:{}}):e instanceof Regularizer?e:deserializeRegularizer(e)}function normalizeArray(e,t,r){if("number"==typeof e)return pyListRepeat(e,t);if(e.length!==t)throw new ValueError("The "+r+" argument must be a tuple of "+t+" integers. Received: "+e.length+" elements.");for(var n=0;n 0 but got "+JSON.stringify(e.filters))},t}(BaseConv),Conv2D=function(e){function t(r){var n=e.call(this,2,r)||this;return t.verifyConfig(r),n}return __extends$1(t,e),t.prototype.getConfig=function(){var t=e.prototype.getConfig.call(this);return delete t.rank,t},t.verifyConfig=function(e){if("number"!=typeof e.kernelSize&&!checkArrayTypeAndLength(e.kernelSize,"number",1,2))throw new ValueError("Conv2D expects config.kernelSize to be number or number[] with length 1 or 2, but received "+JSON.stringify(e.kernelSize)+".")},t.className="Conv2D",t}(Conv);serialization.SerializationMap.register(Conv2D);var Conv2DTranspose=function(e){function t(t){var r=e.call(this,t)||this;if(r.inputSpec=[new InputSpec({ndim:4})],"same"!==r.padding&&"valid"!==r.padding)throw new ValueError("Conv2DTranspose currently supports only padding modes 'same' and 'valid', but received padding mode "+r.padding);return r}return __extends$1(t,e),t.prototype.build=function(e){if(4!==(e=getExactlyOneShape(e)).length)throw new ValueError("Input should have rank 4; Received input shape: "+JSON.stringify(e));var t="channelsFirst"===this.dataFormat?1:e.length-1;if(null==e[t])throw new ValueError("The channel dimension of the inputs should be defined. Found `None`.");var r,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 InputSpec({ndim:4,axes:(r={},r[t]=n,r)})],this.built=!0},t.prototype.call=function(e,t){var r=this;return tidy(function(){var t=getExactlyOneTensor(e);if(4!==t.shape.length)throw new ValueError("Conv2DTranspose.call() expects input tensor to be rank-4, but received a tensor of rank-"+t.shape.length);var n,a,o=t.shape,i=o[0];"channelsFirst"===r.dataFormat?(n=2,a=3):(n=1,a=2);var s=o[n],u=o[a],l=r.kernelSize[0],c=r.kernelSize[1],p=r.strides[0],d=r.strides[1],h=[i,deconvLength(s,p,l,r.padding),deconvLength(u,d,c,r.padding),r.filters];"channelsLast"!==r.dataFormat&&(t=transpose(t,[0,2,3,1]));var f=conv2dTranspose(t,r.kernel.read(),h,r.strides,r.padding);return"channelsLast"!==r.dataFormat&&(f=transpose(f,[0,3,1,2])),null!=r.bias&&(f=biasAdd(f,r.bias.read(),r.dataFormat)),null!=r.activation&&(f=r.activation.apply(f)),f})},t.prototype.computeOutputShape=function(e){var t,r,n,a=(e=getExactlyOneShape(e)).slice();"channelsFirst"===this.dataFormat?(t=1,r=2,n=3):(t=3,r=1,n=2);var o=this.kernelSize[0],i=this.kernelSize[1],s=this.strides[0],u=this.strides[1];return a[t]=this.filters,a[r]=deconvLength(a[r],s,o,this.padding),a[n]=deconvLength(a[n],u,i,this.padding),a},t.prototype.getConfig=function(){var t=e.prototype.getConfig.call(this);return delete t.dilationRate,t},t.className="Conv2DTranspose",t}(Conv2D);serialization.SerializationMap.register(Conv2DTranspose);var SeparableConv=function(e){function t(t,r){var n=e.call(this,t,r)||this;if(n.DEFAULT_DEPTHWISE_INITIALIZER="glorotUniform",n.DEFAULT_POINTWISE_INITIALIZER="glorotUniform",n.depthwiseKernel=null,n.pointwiseKernel=null,null==r.filters)throw new ValueError("The `filters` configuration field is required by SeparableConv, but is unspecified.");if(null!=r.kernelInitializer||null!=r.kernelRegularizer||null!=r.kernelConstraint)throw new ValueError("Fields kernelInitializer, kernelRegularizer and kernelConstraint are invalid for SeparableConv2D. Use depthwiseInitializer, depthwiseRegularizer, depthwiseConstraint, pointwiseInitializer, pointwiseRegularizer and pointwiseConstraint instead.");if(null!=r.padding&&"same"!==r.padding&&"valid"!==r.padding)throw new ValueError("SeparableConv"+n.rank+"D supports only padding modes: 'same' and 'valid', but received "+JSON.stringify(r.padding));return n.depthMultiplier=null==r.depthMultiplier?1:r.depthMultiplier,n.depthwiseInitializer=getInitializer(r.depthwiseInitializer||n.DEFAULT_DEPTHWISE_INITIALIZER),n.depthwiseRegularizer=getRegularizer(r.depthwiseRegularizer),n.depthwiseConstraint=getConstraint(r.depthwiseConstraint),n.pointwiseInitializer=getInitializer(r.depthwiseInitializer||n.DEFAULT_POINTWISE_INITIALIZER),n.pointwiseRegularizer=getRegularizer(r.pointwiseRegularizer),n.pointwiseConstraint=getConstraint(r.pointwiseConstraint),n}return __extends$1(t,e),t.prototype.build=function(e){if((e=getExactlyOneShape(e)).length1)throw new ValueError("Can not merge tensors with different batch sizes. Got tensors with shapes: "+JSON.stringify(e)+".");for(var a=null==e[0]?null:e[0].slice(1),o=1;o1){var y=range$1(1,s).concat([0]);t.push(transpose(d,y)),l=!0}else t.push(d)}var v=r.mergeFunction(t),b=v.rank;if(l)if(null==b){var x=v.shape;m=[f=x[x.length-1]].concat(x.slice(0,x.length-1)),v=transpose(v.reshape([-1,f]),[1,0]).reshape(m)}else b>1&&(y=[b-1].concat(range$1(0,b-1)),v=transpose(v,y));return v}return r.mergeFunction(e)})},t.prototype.computeOutputShape=function(e){var t;t=null==(e=e)[0]?null:e[0].slice(1);for(var r=1;r1)throw new ValueError("A `Concatenate` layer requires inputs with matching shapes except for the concat axis. Got input shapes: "+JSON.stringify(e))}},t.prototype.mergeFunction=function(e){var t=this;return tidy(function(){return concatenate(e,t.axis)})},t.prototype.computeOutputShape=function(e){if(!Array.isArray(e)||!Array.isArray(e[0]))throw new ValueError("A `Concatenate` layer should be called on a list of inputs.");for(var t=e,r=t[0].slice(),n=this.axis<0?r.length+this.axis:this.axis,a=0,o=t.slice(1);a=0?this.axis:this.axis+e.length,r=e[t];if(null==r)throw new ValueError("Axis "+t+" of input tensor should have a defined dimension but the layer received an input with shape "+JSON.stringify(e)+".");this.inputSpec=[new InputSpec({ndim:e.length,axes:(n={},n[t]=r,n)})];var n,a=[r];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},t.prototype.call=function(e,t){var r=this;return tidy(function(){var n=null!=t.training&&t.training,a=getExactlyOneTensor(e),o=a.shape,i=o.length,s=range$1(0,i),u=r.axis>=0?r.axis:r.axis+i;s.splice(u,1);var l=pyListRepeat(1,i);l[u]=o[u];var c=s.slice();c.sort();var p=!util.arraysEqual(c,range$1(0,i).slice(0,i-1));if(!n)return function(){if(p){var e=r.movingMean.read().reshape(l),t=r.movingVariance.read().reshape(l),n=r.center?r.beta.read().reshape(l):null,o=r.scale?r.gamma.read().reshape(l):null;return batchNormalization$1(a,e,t,n,o,r.epsilon)}return batchNormalization$1(a,r.movingMean.read(),r.movingVariance.read(),null==r.beta?null:r.beta.read(),null==r.gamma?null:r.gamma.read(),r.epsilon)}();var d=normalizeBatchInTraining(a,r.gamma.read(),r.beta.read(),s,r.epsilon),h=d[0],f=d[1],m=d[2],g=arrayProd(s.map(function(e){return a.shape[e]})),y=m.mul(getScalar(g/(g-(1+r.epsilon))));return function(){r.stepCount++;var e=movingAverage(r.movingMean.read(),f,r.momentum,r.stepCount);r.movingMean.write(e);var t=movingAverage(r.movingVariance.read(),y,r.momentum,r.stepCount);r.movingVariance.write(t)}(),h})},t.prototype.getConfig=function(){var t={axis:this.axis,momentum:this.momentum,epsilon:this.epsilon,center:this.center,scale:this.scale,betaInitializer:serializeInitializer(this.betaInitializer),gammaInitializer:serializeInitializer(this.gammaInitializer),movingMeanInitializer:serializeInitializer(this.movingMeanInitializer),movingVarianceInitializer:serializeInitializer(this.movingVarianceInitializer),betaRegularizer:serializeRegularizer(this.betaRegularizer),gammaRegularizer:serializeRegularizer(this.gammaRegularizer),betaConstraint:serializeConstraint(this.betaConstraint),gammaConstraint:serializeConstraint(this.gammaConstraint)},r=e.prototype.getConfig.call(this);return Object.assign(t,r),t},t.className="BatchNormalization",t}(Layer);function spatial2dPadding(e,t,r){return tidy(function(){if(4!==e.rank)throw new ValueError("temporalPadding expects input tensor to be 4-D, but received a "+e.rank+"-D tensor.");if(null==t&&(t=[[1,1],[1,1]]),2!==t.length||2!==t[0].length||2!==t[1].length)throw new ValueError("spatial2dPadding expects `padding` to be an Array of two Arrays, each of which is an Array of two integers.");if(null==r&&(r=imageDataFormat()),"channelsLast"!==r&&"channelsFirst"!==r)throw new ValueError("Unknown data format: "+r+". Supported data formats are 'channelsLast' and 'channelsFirst.");var n;return n="channelsFirst"===r?[[0,0],[0,0],t[0],t[1]]:[[0,0],t[0],t[1],[0,0]],pad(e,n)})}serialization.SerializationMap.register(BatchNormalization);var ZeroPadding2D=function(e){function t(t){var r=this;if(null==t&&(t={}),(r=e.call(this,t)||this).dataFormat=null==t.dataFormat?imageDataFormat():t.dataFormat,null==t.padding)r.padding=[[1,1],[1,1]];else if("number"==typeof t.padding)r.padding=[[t.padding,t.padding],[t.padding,t.padding]];else{if(t.padding=t.padding,2!==t.padding.length)throw new ValueError("ZeroPadding2D expects padding to be a length-2 array, but received a length-"+t.padding.length+" array.");var n=void 0,a=void 0;if("number"==typeof t.padding[0])n=[t.padding[0],t.padding[0]],a=[t.padding[1],t.padding[1]];else{if(t.padding=t.padding,2!==t.padding[0].length)throw new ValueError("ZeroPadding2D expects height padding to be a length-2 array, but received a length-"+t.padding[0].length+" array.");if(n=t.padding[0],2!==t.padding[1].length)throw new ValueError("ZeroPadding2D expects width padding to be a length-2 array, but received a length-"+t.padding[1].length+" array.");a=t.padding[1]}r.padding=[n,a]}return r.inputSpec=[new InputSpec({ndim:4})],r}return __extends$1(t,e),t.prototype.computeOutputShape=function(e){var t,r;return e=getExactlyOneShape(e),"channelsFirst"===this.dataFormat?(t=null!=e[2]&&e[2]>=0?e[2]+this.padding[0][0]+this.padding[0][1]:null,r=null!=e[3]&&e[3]>=0?e[3]+this.padding[1][0]+this.padding[1][1]:null,[e[0],e[1],t,r]):(t=null!=e[1]&&e[1]>=0?e[1]+this.padding[0][0]+this.padding[0][1]:null,r=null!=e[2]&&e[2]>=0?e[2]+this.padding[1][0]+this.padding[1][1]:null,[e[0],t,r,e[3]])},t.prototype.call=function(e,t){var r=this;return tidy(function(){return spatial2dPadding(getExactlyOneTensor(e),r.padding,r.dataFormat)})},t.prototype.getConfig=function(){var t={padding:this.padding,dataFormat:this.dataFormat},r=e.prototype.getConfig.call(this);return Object.assign(t,r),t},t.className="ZeroPadding2D",t}(Layer);function pool2d(e,t,r,n,a,o){return tidy(function(){var i;checkDataFormat(a),checkPoolMode(o),checkPaddingMode(n),null==r&&(r=[1,1]),null==n&&(n="valid"),null==a&&(a=imageDataFormat()),null==o&&(o="max"),e=preprocessConv2DInput(e,a);var s="same"===n?"same":"valid";return i="max"===o?maxPool(e,t,r,s):avgPool(e,t,r,s),"channelsFirst"===a&&(i=transpose(i,[0,3,1,2])),i})}serialization.SerializationMap.register(ZeroPadding2D);var Pooling1D=function(e){function t(t){var r=this;if(null==t.poolSize&&(t.poolSize=2),r=e.call(this,t)||this,"number"==typeof t.poolSize)r.poolSize=[t.poolSize];else{if(!Array.isArray(t.poolSize)||1!==t.poolSize.length||"number"!=typeof t.poolSize[0])throw new ValueError("poolSize for 1D convolutional layer must be a number or an Array of a single number, but received "+JSON.stringify(t.poolSize));r.poolSize=t.poolSize}if(null==t.strides)r.strides=r.poolSize;else if("number"==typeof t.strides)r.strides=[t.strides];else{if(!Array.isArray(t.strides)||1!==t.strides.length||"number"!=typeof t.strides[0])throw new ValueError("strides for 1D convolutional layer must be a number or an Array of a single number, but received "+JSON.stringify(t.strides));r.strides=t.strides}return r.padding=null==t.padding?"valid":t.padding,checkPaddingMode(r.padding),r.inputSpec=[new InputSpec({ndim:3})],r}return __extends$1(t,e),t.prototype.computeOutputShape=function(e){var t=convOutputLength((e=getExactlyOneShape(e))[1],this.poolSize[0],this.padding,this.strides[0]);return[e[0],t,e[2]]},t.prototype.call=function(e,t){var r=this;return tidy(function(){r.invokeCallHook(e,t),e=expandDims$1(getExactlyOneTensor(e),2);var n=r.poolingFunction(getExactlyOneTensor(e),[r.poolSize[0],1],[r.strides[0],1],r.padding,"channelsLast");return squeeze(n,[2])})},t.prototype.getConfig=function(){var t={poolSize:this.poolSize,padding:this.padding,strides:this.strides},r=e.prototype.getConfig.call(this);return Object.assign(t,r),t},t}(Layer),MaxPooling1D=function(e){function t(t){return e.call(this,t)||this}return __extends$1(t,e),t.prototype.poolingFunction=function(e,t,r,n,a){return checkDataFormat(a),checkPaddingMode(n),pool2d(e,t,r,n,a,"max")},t.className="MaxPooling1D",t}(Pooling1D);serialization.SerializationMap.register(MaxPooling1D);var AveragePooling1D=function(e){function t(t){return e.call(this,t)||this}return __extends$1(t,e),t.prototype.poolingFunction=function(e,t,r,n,a){return checkDataFormat(a),checkPaddingMode(n),pool2d(e,t,r,n,a,"avg")},t.className="AveragePooling1D",t}(Pooling1D);serialization.SerializationMap.register(AveragePooling1D);var Pooling2D=function(e){function t(t){var r=this;if(null==t.poolSize&&(t.poolSize=[2,2]),(r=e.call(this,t)||this).poolSize=Array.isArray(t.poolSize)?t.poolSize:[t.poolSize,t.poolSize],null==t.strides)r.strides=r.poolSize;else if(Array.isArray(t.strides)){if(2!==t.strides.length)throw new ValueError("If the strides property of a 2D pooling layer is an Array, it is expected to have a length of 2, but received length "+t.strides.length+".");r.strides=t.strides}else r.strides=[t.strides,t.strides];return r.padding=null==t.padding?"valid":t.padding,r.dataFormat=null==t.dataFormat?"channelsLast":t.dataFormat,checkDataFormat(r.dataFormat),checkPaddingMode(r.padding),r.inputSpec=[new InputSpec({ndim:4})],r}return __extends$1(t,e),t.prototype.computeOutputShape=function(e){e=getExactlyOneShape(e);var t="channelsFirst"===this.dataFormat?e[2]:e[1],r="channelsFirst"===this.dataFormat?e[3]:e[2];return t=convOutputLength(t,this.poolSize[0],this.padding,this.strides[0]),r=convOutputLength(r,this.poolSize[1],this.padding,this.strides[1]),"channelsFirst"===this.dataFormat?[e[0],e[1],t,r]:[e[0],t,r,e[3]]},t.prototype.call=function(e,t){var r=this;return tidy(function(){return r.invokeCallHook(e,t),r.poolingFunction(getExactlyOneTensor(e),r.poolSize,r.strides,r.padding,r.dataFormat)})},t.prototype.getConfig=function(){var t={poolSize:this.poolSize,padding:this.padding,strides:this.strides,dataFormat:this.dataFormat},r=e.prototype.getConfig.call(this);return Object.assign(t,r),t},t}(Layer),MaxPooling2D=function(e){function t(t){return e.call(this,t)||this}return __extends$1(t,e),t.prototype.poolingFunction=function(e,t,r,n,a){return checkDataFormat(a),checkPaddingMode(n),pool2d(e,t,r,n,a,"max")},t.className="MaxPooling2D",t}(Pooling2D);serialization.SerializationMap.register(MaxPooling2D);var AveragePooling2D=function(e){function t(t){return e.call(this,t)||this}return __extends$1(t,e),t.prototype.poolingFunction=function(e,t,r,n,a){return checkDataFormat(a),checkPaddingMode(n),pool2d(e,t,r,n,a,"avg")},t.className="AveragePooling2D",t}(Pooling2D);serialization.SerializationMap.register(AveragePooling2D);var GlobalPooling1D=function(e){function t(t){var r=e.call(this,t)||this;return r.inputSpec=[new InputSpec({ndim:3})],r}return __extends$1(t,e),t.prototype.computeOutputShape=function(e){return[e[0],e[2]]},t.prototype.call=function(e,t){throw new NotImplementedError},t}(Layer),GlobalAveragePooling1D=function(e){function t(t){return e.call(this,t)||this}return __extends$1(t,e),t.prototype.call=function(e,t){return tidy(function(){var t=getExactlyOneTensor(e);return mean(t,1)})},t.className="GlobalAveragePooling1D",t}(GlobalPooling1D);serialization.SerializationMap.register(GlobalAveragePooling1D);var GlobalMaxPooling1D=function(e){function t(t){return e.call(this,t)||this}return __extends$1(t,e),t.prototype.call=function(e,t){return tidy(function(){var t=getExactlyOneTensor(e);return max(t,1)})},t.className="GlobalMaxPooling1D",t}(GlobalPooling1D);serialization.SerializationMap.register(GlobalMaxPooling1D);var GlobalPooling2D=function(e){function t(t){var r=e.call(this,t)||this;return r.dataFormat=null==t.dataFormat?"channelsLast":t.dataFormat,checkDataFormat(r.dataFormat),r.inputSpec=[new InputSpec({ndim:4})],r}return __extends$1(t,e),t.prototype.computeOutputShape=function(e){return e=e,"channelsLast"===this.dataFormat?[e[0],e[3]]:[e[0],e[1]]},t.prototype.call=function(e,t){throw new NotImplementedError},t.prototype.getConfig=function(){var t={dataFormat:this.dataFormat},r=e.prototype.getConfig.call(this);return Object.assign(t,r),t},t}(Layer),GlobalAveragePooling2D=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return __extends$1(t,e),t.prototype.call=function(e,t){var r=this;return tidy(function(){var t=getExactlyOneTensor(e);return"channelsLast"===r.dataFormat?mean(t,[1,2]):mean(t,[2,3])})},t.className="GlobalAveragePooling2D",t}(GlobalPooling2D);serialization.SerializationMap.register(GlobalAveragePooling2D);var GlobalMaxPooling2D=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return __extends$1(t,e),t.prototype.call=function(e,t){var r=this;return tidy(function(){var t=getExactlyOneTensor(e);return"channelsLast"===r.dataFormat?max(t,[1,2]):max(t,[2,3])})},t.className="GlobalMaxPooling2D",t}(GlobalPooling2D);function rnn(e,t,r,n,a,o,i,s){void 0===n&&(n=!1),void 0===i&&(i=!1);var u=t.shape.length;if(u<3)throw new ValueError("Input should be at least 3D, but is "+u+"D.");var l,c,p=[1,0].concat(range$1(2,u));if(t=transpose(t,p),null!=a)throw new NotImplementedError("The rnn() function of the deeplearn.js backend does not support masking yet.");if(null!=o)throw new NotImplementedError("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."),n&&(t=reverse(t,0));for(var d=r,h=t.shape[0],f=0;f1&&(t=e.slice(1,e.length)),e=e[0]}function n(e){return null==e||Array.isArray(e)?e:[e]}return{inputs:e,initialState:t=n(t),constants:r=n(r)}},t.prototype.apply=function(t,r){var n=null==r?null:r.initialState,a=null==r?null:r.constants;null==r&&(r={});var o=this.standardizeArgs(t,n,a);t=o.inputs,n=o.initialState,a=o.constants;var i=[],s=[];if(null!=n){r.initialState=n,i=i.concat(n),this.stateSpec=[];for(var u=0,l=n;u1?tile$1(r,[1,e]):r}):t.cell.stateSize>1?[tile$1(r,[1,t.cell.stateSize])]:[r]})},Object.defineProperty(t.prototype,"trainableWeights",{get:function(){return this.trainable?this.cell.trainableWeights:[]},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"nonTrainableWeights",{get:function(){return this.trainable?this.cell.nonTrainableWeights:this.cell.weights},enumerable:!0,configurable:!0}),t.prototype.getConfig=function(){var t={returnSequences:this.returnSequences,returnState:this.returnState,goBackwards:this.goBackwards,stateful:this.stateful,unroll:this.unroll};null!=this.numConstants&&(t.numConstants=this.numConstants);var r=this.cell.getConfig();t.cell={className:this.cell.getClassName(),config:r};var n=e.prototype.getConfig.call(this);return Object.assign(t,n),t},t.className="RNN",t}(Layer);serialization.SerializationMap.register(RNN);var RNNCell=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return __extends$1(t,e),__decorate$1([doc({heading:"Layers",subheading:"Classes"})],t)}(Layer),SimpleRNNCell=function(e){function t(t){var r=e.call(this,t)||this;return r.DEFAULT_ACTIVATION="tanh",r.DEFAULT_KERNEL_INITIALIZER="glorotNormal",r.DEFAULT_RECURRENT_INITIALIZER="orthogonal",r.DEFAULT_BIAS_INITIALIZER="zeros",r.units=t.units,r.activation=getActivation(null==t.activation?r.DEFAULT_ACTIVATION:t.activation),r.useBias=null==t.useBias||t.useBias,r.kernelInitializer=getInitializer(t.kernelInitializer||r.DEFAULT_KERNEL_INITIALIZER),r.recurrentInitializer=getInitializer(t.recurrentInitializer||r.DEFAULT_RECURRENT_INITIALIZER),r.biasInitializer=getInitializer(t.biasInitializer||r.DEFAULT_BIAS_INITIALIZER),r.kernelRegularizer=getRegularizer(t.kernelRegularizer),r.recurrentRegularizer=getRegularizer(t.recurrentRegularizer),r.biasRegularizer=getRegularizer(t.biasRegularizer),r.kernelConstraint=getConstraint(t.kernelConstraint),r.recurrentConstraint=getConstraint(t.recurrentConstraint),r.biasConstraint=getConstraint(t.biasConstraint),r.dropout=min$1([1,max$1([0,null==t.dropout?0:t.dropout])]),r.recurrentDropout=min$1([1,max$1([0,null==t.recurrentDropout?0:t.recurrentDropout])]),r.stateSize=r.units,r}return __extends$1(t,e),t.prototype.build=function(e){e=getExactlyOneShape(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},t.prototype.call=function(e,t){var r=this;return tidy(function(){if(2!==(e=e).length)throw new ValueError("SimpleRNNCell expects 2 input Tensors, got "+e.length+".");var t=e[1];if(e=e[0],0!==r.dropout||0!==r.recurrentDropout)throw new NotImplementedError("Dropout is not implemented for SimpleRNNCell yet");var n=dot$1(e,r.kernel.read());null!=r.bias&&(n=biasAdd(n,r.bias.read()));var a=add(n,dot$1(t,r.recurrentKernel.read()));return null!=r.activation&&(a=r.activation.apply(a)),[a,a]})},t.prototype.getConfig=function(){var t={units:this.units,activation:serializeActivation(this.activation),useBias:this.useBias,kernelInitializer:serializeInitializer(this.kernelInitializer),recurrentInitializer:serializeInitializer(this.recurrentInitializer),biasInitializer:serializeInitializer(this.biasInitializer),kernelRegularizer:serializeRegularizer(this.kernelRegularizer),recurrentRegularizer:serializeRegularizer(this.recurrentRegularizer),biasRegularizer:serializeRegularizer(this.biasRegularizer),activityRegularizer:serializeRegularizer(this.activityRegularizer),kernelConstraint:serializeConstraint(this.kernelConstraint),recurrentConstraint:serializeConstraint(this.recurrentConstraint),biasConstraint:serializeConstraint(this.biasConstraint),dropout:this.dropout,recurrentDropout:this.recurrentDropout},r=e.prototype.getConfig.call(this);return Object.assign(t,r),t},t.className="SimpleRNNCell",t}(RNNCell);serialization.SerializationMap.register(SimpleRNNCell);var SimpleRNN=function(e){function t(t){return t.cell=new SimpleRNNCell(t),e.call(this,t)||this}return __extends$1(t,e),t.prototype.call=function(t,r){var n=this;return tidy(function(){var a=null==r?null:r.mask,o=null==r?null:r.training,i=null==r?null:r.initialState;return e.prototype.call.call(n,t,{mask:a,training:o,initialState:i})})},Object.defineProperty(t.prototype,"units",{get:function(){return this.cell.units},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"activation",{get:function(){return this.cell.activation},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"useBias",{get:function(){return this.cell.useBias},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"kernelInitializer",{get:function(){return this.cell.kernelInitializer},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"recurrentInitializer",{get:function(){return this.cell.recurrentInitializer},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"biasInitializer",{get:function(){return this.cell.biasInitializer},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"kernelRegularizer",{get:function(){return this.cell.kernelRegularizer},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"recurrentRegularizer",{get:function(){return this.cell.recurrentRegularizer},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"biasRegularizer",{get:function(){return this.cell.biasRegularizer},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"kernelConstraint",{get:function(){return this.cell.kernelConstraint},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"recurrentConstraint",{get:function(){return this.cell.recurrentConstraint},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"biasConstraint",{get:function(){return this.cell.biasConstraint},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"dropout",{get:function(){return this.cell.dropout},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"recurrentDropout",{get:function(){return this.cell.recurrentDropout},enumerable:!0,configurable:!0}),t.prototype.getConfig=function(){var t={units:this.units,activation:serializeActivation(this.activation),useBias:this.useBias,kernelInitializer:serializeInitializer(this.kernelInitializer),recurrentInitializer:serializeInitializer(this.recurrentInitializer),biasInitializer:serializeInitializer(this.biasInitializer),kernelRegularizer:serializeRegularizer(this.kernelRegularizer),recurrentRegularizer:serializeRegularizer(this.recurrentRegularizer),biasRegularizer:serializeRegularizer(this.biasRegularizer),activityRegularizer:serializeRegularizer(this.activityRegularizer),kernelConstraint:serializeConstraint(this.kernelConstraint),recurrentConstraint:serializeConstraint(this.recurrentConstraint),biasConstraint:serializeConstraint(this.biasConstraint),dropout:this.dropout,recurrentDropout:this.recurrentDropout},r=e.prototype.getConfig.call(this);return delete r.cell,Object.assign(t,r),t},t.className="SimpleRNN",t}(RNN);serialization.SerializationMap.register(SimpleRNN);var GRUCell=function(e){function t(t){var r=e.call(this,t)||this;return r.DEFAULT_ACTIVATION="tanh",r.DEFAULT_RECURRENT_ACTIVATION="hardSigmoid",r.DEFAULT_KERNEL_INITIALIZER="glorotNormal",r.DEFAULT_RECURRENT_INITIALIZER="orthogonal",r.DEFAULT_BIAS_INITIALIZER="zeros",r.units=t.units,r.activation=getActivation(void 0===t.activation?r.DEFAULT_ACTIVATION:t.activation),r.recurrentActivation=getActivation(void 0===t.recurrentActivation?r.DEFAULT_RECURRENT_ACTIVATION:t.recurrentActivation),r.useBias=null==t.useBias||t.useBias,r.kernelInitializer=getInitializer(t.kernelInitializer||r.DEFAULT_KERNEL_INITIALIZER),r.recurrentInitializer=getInitializer(t.recurrentInitializer||r.DEFAULT_RECURRENT_INITIALIZER),r.biasInitializer=getInitializer(t.biasInitializer||r.DEFAULT_BIAS_INITIALIZER),r.kernelRegularizer=getRegularizer(t.kernelRegularizer),r.recurrentRegularizer=getRegularizer(t.recurrentRegularizer),r.biasRegularizer=getRegularizer(t.biasRegularizer),r.kernelConstraint=getConstraint(t.kernelConstraint),r.recurrentConstraint=getConstraint(t.recurrentConstraint),r.biasConstraint=getConstraint(t.biasConstraint),r.dropout=min$1([1,max$1([0,null==t.dropout?0:t.dropout])]),r.recurrentDropout=min$1([1,max$1([0,null==t.recurrentDropout?0:t.recurrentDropout])]),r.implementation=t.implementation,r.stateSize=r.units,r}return __extends$1(t,e),t.prototype.build=function(e){var t=(e=getExactlyOneShape(e))[e.length-1];this.kernel=this.addWeight("kernel",[t,3*this.units],null,this.kernelInitializer,this.kernelRegularizer,!0,this.kernelConstraint),this.recurrentKernel=this.addWeight("recurrent_kernel",[this.units,3*this.units],null,this.recurrentInitializer,this.recurrentRegularizer,!0,this.recurrentConstraint),this.useBias?this.bias=this.addWeight("bias",[3*this.units],null,this.biasInitializer,this.biasRegularizer,!0,this.biasConstraint):this.bias=null,this.built=!0},t.prototype.call=function(e,t){var r=this;return tidy(function(){if(0!==r.dropout||0!==r.recurrentDropout)throw new NotImplementedError("Dropout is not implemented for GRUCell yet");if(2!==(e=e).length)throw new ValueError("GRUCell expects 2 input Tensors (inputs, h, c), got "+e.length+".");var t,n,a,o=e[1];if(e=e[0],1===r.implementation){var i=sliceAlongLastAxis(r.kernel.read(),0,r.units),s=sliceAlongLastAxis(r.kernel.read(),r.units,r.units),u=sliceAlongLastAxis(r.kernel.read(),2*r.units,r.units),l=sliceAlongLastAxis(r.recurrentKernel.read(),0,r.units),c=sliceAlongLastAxis(r.recurrentKernel.read(),r.units,r.units),p=sliceAlongLastAxis(r.recurrentKernel.read(),2*r.units,r.units),d=e,h=e,f=dot$1(e,i),m=dot$1(d,s),g=dot$1(h,u);if(r.useBias){var y=sliceAlongFirstAxis(r.bias.read(),0,r.units),v=sliceAlongFirstAxis(r.bias.read(),r.units,r.units),b=sliceAlongFirstAxis(r.bias.read(),2*r.units,r.units);f=biasAdd(f,y),m=biasAdd(m,v),g=biasAdd(g,b)}var x=o,w=o,S=o;t=r.recurrentActivation.apply(add(f,dot$1(x,l))),n=r.recurrentActivation.apply(add(m,dot$1(w,c))),a=r.activation.apply(add(g,dot$1(mul(n,S),p)))}else{var T=dot$1(e,r.kernel.read());r.useBias&&(T=biasAdd(T,r.bias.read()));var N=dot$1(o,sliceAlongLastAxis(r.recurrentKernel.read(),0,2*r.units)),E=(f=sliceAlongLastAxis(T,0,r.units),m=sliceAlongLastAxis(T,r.units,r.units),sliceAlongLastAxis(N,0,r.units)),_=sliceAlongLastAxis(N,r.units,r.units);t=r.recurrentActivation.apply(add(f,E)),n=r.recurrentActivation.apply(add(m,_)),g=sliceAlongLastAxis(T,2*r.units,r.units);var A=dot$1(mul(n,o),sliceAlongLastAxis(r.recurrentKernel.read(),2*r.units,r.units));a=r.activation.apply(add(g,A))}var I=add(mul(t,o),mul(add(getScalar(1),neg(t)),a));return[I,I]})},t.prototype.getConfig=function(){var t={units:this.units,activation:serializeActivation(this.activation),recurrentActivation:serializeActivation(this.recurrentActivation),useBias:this.useBias,kernelInitializer:serializeInitializer(this.kernelInitializer),recurrentInitializer:serializeInitializer(this.recurrentInitializer),biasInitializer:serializeInitializer(this.biasInitializer),kernelRegularizer:serializeRegularizer(this.kernelRegularizer),recurrentRegularizer:serializeRegularizer(this.recurrentRegularizer),biasRegularizer:serializeRegularizer(this.biasRegularizer),activityRegularizer:serializeRegularizer(this.activityRegularizer),kernelConstraint:serializeConstraint(this.kernelConstraint),recurrentConstraint:serializeConstraint(this.recurrentConstraint),biasConstraint:serializeConstraint(this.biasConstraint),dropout:this.dropout,recurrentDropout:this.recurrentDropout,implementation:this.implementation},r=e.prototype.getConfig.call(this);return Object.assign(t,r),t},t.className="GRUCell",t}(RNNCell);serialization.SerializationMap.register(GRUCell);var GRU=function(e){function t(t){return 0===t.implementation&&console.warn("`implementation=0` has been deprecated, and now defaults to `implementation=1`. Please update your layer call."),t.cell=new GRUCell(t),e.call(this,t)||this}return __extends$1(t,e),t.prototype.call=function(t,r){var n=this;return tidy(function(){var a=null==r?null:r.mask,o=null==r?null:r.training,i=null==r?null:r.initialState;return e.prototype.call.call(n,t,{mask:a,training:o,initialState:i})})},Object.defineProperty(t.prototype,"units",{get:function(){return this.cell.units},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"activation",{get:function(){return this.cell.activation},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"recurrentActivation",{get:function(){return this.cell.recurrentActivation},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"useBias",{get:function(){return this.cell.useBias},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"kernelInitializer",{get:function(){return this.cell.kernelInitializer},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"recurrentInitializer",{get:function(){return this.cell.recurrentInitializer},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"biasInitializer",{get:function(){return this.cell.biasInitializer},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"kernelRegularizer",{get:function(){return this.cell.kernelRegularizer},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"recurrentRegularizer",{get:function(){return this.cell.recurrentRegularizer},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"biasRegularizer",{get:function(){return this.cell.biasRegularizer},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"kernelConstraint",{get:function(){return this.cell.kernelConstraint},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"recurrentConstraint",{get:function(){return this.cell.recurrentConstraint},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"biasConstraint",{get:function(){return this.cell.biasConstraint},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"dropout",{get:function(){return this.cell.dropout},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"recurrentDropout",{get:function(){return this.cell.recurrentDropout},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"implementation",{get:function(){return this.cell.implementation},enumerable:!0,configurable:!0}),t.prototype.getConfig=function(){var t={units:this.units,activation:serializeActivation(this.activation),recurrentActivation:serializeActivation(this.recurrentActivation),useBias:this.useBias,kernelInitializer:serializeInitializer(this.kernelInitializer),recurrentInitializer:serializeInitializer(this.recurrentInitializer),biasInitializer:serializeInitializer(this.biasInitializer),kernelRegularizer:serializeRegularizer(this.kernelRegularizer),recurrentRegularizer:serializeRegularizer(this.recurrentRegularizer),biasRegularizer:serializeRegularizer(this.biasRegularizer),activityRegularizer:serializeRegularizer(this.activityRegularizer),kernelConstraint:serializeConstraint(this.kernelConstraint),recurrentConstraint:serializeConstraint(this.recurrentConstraint),biasConstraint:serializeConstraint(this.biasConstraint),dropout:this.dropout,recurrentDropout:this.recurrentDropout,implementation:this.implementation},r=e.prototype.getConfig.call(this);return delete r.cell,Object.assign(t,r),t},t.fromConfig=function(e,t){return 0===t.implmentation&&(t.implementation=1),new e(t)},t.className="GRU",t}(RNN);serialization.SerializationMap.register(GRU);var LSTMCell=function(e){function t(t){var r=e.call(this,t)||this;return r.DEFAULT_ACTIVATION="tanh",r.DEFAULT_RECURRENT_ACTIVATION="hardSigmoid",r.DEFAULT_KERNEL_INITIALIZER="glorotNormal",r.DEFAULT_RECURRENT_INITIALIZER="orthogonal",r.DEFAULT_BIAS_INITIALIZER="zeros",r.units=t.units,r.activation=getActivation(void 0===t.activation?r.DEFAULT_ACTIVATION:t.activation),r.recurrentActivation=getActivation(void 0===t.recurrentActivation?r.DEFAULT_RECURRENT_ACTIVATION:t.recurrentActivation),r.useBias=null==t.useBias||t.useBias,r.kernelInitializer=getInitializer(t.kernelInitializer||r.DEFAULT_KERNEL_INITIALIZER),r.recurrentInitializer=getInitializer(t.recurrentInitializer||r.DEFAULT_RECURRENT_INITIALIZER),r.biasInitializer=getInitializer(t.biasInitializer||r.DEFAULT_BIAS_INITIALIZER),r.unitForgetBias=t.unitForgetBias,r.kernelRegularizer=getRegularizer(t.kernelRegularizer),r.recurrentRegularizer=getRegularizer(t.recurrentRegularizer),r.biasRegularizer=getRegularizer(t.biasRegularizer),r.kernelConstraint=getConstraint(t.kernelConstraint),r.recurrentConstraint=getConstraint(t.recurrentConstraint),r.biasConstraint=getConstraint(t.biasConstraint),r.dropout=min$1([1,max$1([0,null==t.dropout?0:t.dropout])]),r.recurrentDropout=min$1([1,max$1([0,null==t.recurrentDropout?0:t.recurrentDropout])]),r.implementation=t.implementation,r.stateSize=[r.units,r.units],r}return __extends$1(t,e),t.prototype.build=function(e){var t,r,n=(e=getExactlyOneShape(e))[e.length-1];if(this.kernel=this.addWeight("kernel",[n,4*this.units],null,this.kernelInitializer,this.kernelRegularizer,!0,this.kernelConstraint),this.recurrentKernel=this.addWeight("recurrent_kernel",[this.units,4*this.units],null,this.recurrentInitializer,this.recurrentRegularizer,!0,this.recurrentConstraint),this.useBias){if(this.unitForgetBias){var a=this.biasInitializer,o=this.units;t=new((r=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return __extends$1(t,e),t.prototype.apply=function(e,t){var r=a.apply([o]),n=(new Ones).apply([o]),i=a.apply([2*o]);return concatAlongFirstAxis(concatAlongFirstAxis(r,n),i)},t}(Initializer)).className="CustomInit",r)}else t=this.biasInitializer;this.bias=this.addWeight("bias",[4*this.units],null,t,this.biasRegularizer,!0,this.biasConstraint)}else this.bias=null;this.built=!0},t.prototype.call=function(e,t){var r=this;return tidy(function(){if(0!==r.dropout||0!==r.recurrentDropout)throw new NotImplementedError("Dropout is not implemented for LSTMCell yet");if(3!==(e=e).length)throw new ValueError("LSTMCell expects 3 input Tensors (inputs, h, c), got "+e.length+".");var t,n,a,o,i=e[1],s=e[2];if(e=e[0],1===r.implementation){var u=sliceAlongLastAxis(r.kernel.read(),0,r.units),l=sliceAlongLastAxis(r.kernel.read(),r.units,r.units),c=sliceAlongLastAxis(r.kernel.read(),2*r.units,r.units),p=sliceAlongLastAxis(r.kernel.read(),3*r.units,r.units),d=sliceAlongLastAxis(r.recurrentKernel.read(),0,r.units),h=sliceAlongLastAxis(r.recurrentKernel.read(),r.units,r.units),f=sliceAlongLastAxis(r.recurrentKernel.read(),2*r.units,r.units),m=sliceAlongLastAxis(r.recurrentKernel.read(),3*r.units,r.units),g=e,y=e,v=e,b=dot$1(e,u),x=dot$1(g,l),w=dot$1(y,c),S=dot$1(v,p);if(r.useBias){var T=sliceAlongFirstAxis(r.bias.read(),0,r.units),N=sliceAlongFirstAxis(r.bias.read(),r.units,r.units),E=sliceAlongFirstAxis(r.bias.read(),2*r.units,r.units),_=sliceAlongFirstAxis(r.bias.read(),3*r.units,r.units);b=biasAdd(b,T),x=biasAdd(x,N),w=biasAdd(w,E),S=biasAdd(S,_)}var A=i,I=i,O=i,C=i;t=r.recurrentActivation.apply(add(b,dot$1(A,d))),n=r.recurrentActivation.apply(add(x,dot$1(I,h))),a=add(mul(n,s),mul(t,r.activation.apply(add(w,dot$1(O,f))))),o=r.recurrentActivation.apply(add(S,dot$1(C,m)))}else{var P=dot$1(e,r.kernel.read());P=add(P,dot$1(i,r.recurrentKernel.read())),r.useBias&&(P=biasAdd(P,r.bias.read()));var R=sliceAlongLastAxis(P,0,r.units),k=sliceAlongLastAxis(P,r.units,r.units),D=sliceAlongLastAxis(P,2*r.units,r.units),z=sliceAlongLastAxis(P,3*r.units,r.units);t=r.recurrentActivation.apply(R),n=r.recurrentActivation.apply(k),a=add(mul(n,s),mul(t,r.activation.apply(D))),o=r.recurrentActivation.apply(z)}var L=mul(o,r.activation.apply(a));return[L,L,a]})},t.prototype.getConfig=function(){var t={units:this.units,activation:serializeActivation(this.activation),recurrentActivation:serializeActivation(this.recurrentActivation),useBias:this.useBias,kernelInitializer:serializeInitializer(this.kernelInitializer),recurrentInitializer:serializeInitializer(this.recurrentInitializer),biasInitializer:serializeInitializer(this.biasInitializer),unitForgetBias:this.unitForgetBias,kernelRegularizer:serializeRegularizer(this.kernelRegularizer),recurrentRegularizer:serializeRegularizer(this.recurrentRegularizer),biasRegularizer:serializeRegularizer(this.biasRegularizer),activityRegularizer:serializeRegularizer(this.activityRegularizer),kernelConstraint:serializeConstraint(this.kernelConstraint),recurrentConstraint:serializeConstraint(this.recurrentConstraint),biasConstraint:serializeConstraint(this.biasConstraint),dropout:this.dropout,recurrentDropout:this.recurrentDropout,implementation:this.implementation},r=e.prototype.getConfig.call(this);return Object.assign(t,r),t},t.className="LSTMCell",t}(RNNCell);serialization.SerializationMap.register(LSTMCell);var LSTM=function(e){function t(t){return 0===t.implementation&&console.warn("`implementation=0` has been deprecated, and now defaults to `implementation=1`. Please update your layer call."),t.cell=new LSTMCell(t),e.call(this,t)||this}return __extends$1(t,e),t.prototype.call=function(t,r){var n=this;return tidy(function(){var a=null==r?null:r.mask,o=null==r?null:r.training,i=null==r?null:r.initialState;return e.prototype.call.call(n,t,{mask:a,training:o,initialState:i})})},Object.defineProperty(t.prototype,"units",{get:function(){return this.cell.units},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"activation",{get:function(){return this.cell.activation},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"recurrentActivation",{get:function(){return this.cell.recurrentActivation},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"useBias",{get:function(){return this.cell.useBias},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"kernelInitializer",{get:function(){return this.cell.kernelInitializer},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"recurrentInitializer",{get:function(){return this.cell.recurrentInitializer},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"biasInitializer",{get:function(){return this.cell.biasInitializer},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"unitForgetBias",{get:function(){return this.cell.unitForgetBias},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"kernelRegularizer",{get:function(){return this.cell.kernelRegularizer},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"recurrentRegularizer",{get:function(){return this.cell.recurrentRegularizer},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"biasRegularizer",{get:function(){return this.cell.biasRegularizer},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"kernelConstraint",{get:function(){return this.cell.kernelConstraint},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"recurrentConstraint",{get:function(){return this.cell.recurrentConstraint},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"biasConstraint",{get:function(){return this.cell.biasConstraint},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"dropout",{get:function(){return this.cell.dropout},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"recurrentDropout",{get:function(){return this.cell.recurrentDropout},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"implementation",{get:function(){return this.cell.implementation},enumerable:!0,configurable:!0}),t.prototype.getConfig=function(){var t={units:this.units,activation:serializeActivation(this.activation),recurrentActivation:serializeActivation(this.recurrentActivation),useBias:this.useBias,kernelInitializer:serializeInitializer(this.kernelInitializer),recurrentInitializer:serializeInitializer(this.recurrentInitializer),biasInitializer:serializeInitializer(this.biasInitializer),unitForgetBias:this.unitForgetBias,kernelRegularizer:serializeRegularizer(this.kernelRegularizer),recurrentRegularizer:serializeRegularizer(this.recurrentRegularizer),biasRegularizer:serializeRegularizer(this.biasRegularizer),activityRegularizer:serializeRegularizer(this.activityRegularizer),kernelConstraint:serializeConstraint(this.kernelConstraint),recurrentConstraint:serializeConstraint(this.recurrentConstraint),biasConstraint:serializeConstraint(this.biasConstraint),dropout:this.dropout,recurrentDropout:this.recurrentDropout,implementation:this.implementation},r=e.prototype.getConfig.call(this);return delete r.cell,Object.assign(t,r),t},t.fromConfig=function(e,t){return 0===t.implmentation&&(t.implementation=1),new e(t)},t.className="LSTM",t}(RNN);serialization.SerializationMap.register(LSTM);var StackedRNNCells=function(e){function t(t){var r=e.call(this,t)||this;return r.cells=t.cells,r}return __extends$1(t,e),Object.defineProperty(t.prototype,"stateSize",{get:function(){for(var e=[],t=0,r=this.cells.slice().reverse();t= 3D, but received input shape "+JSON.stringify(t));this.inputSpec=[{shape:t}];var r=[t[0]].concat(t.slice(2));this.layer.built||(this.layer.build(r),this.layer.built=!0),e.prototype.build.call(this,t)},t.prototype.computeOutputShape=function(e){var t=[(e=getExactlyOneShape(e))[0]].concat(e.slice(2)),r=this.layer.computeOutputShape(t),n=e[1];return[r[0],n].concat(r.slice(1))},t.prototype.call=function(e,t){var r=this;return tidy(function(){return rnn(function(e,n){return[r.layer.call(e,t),[]]},e=getExactlyOneTensor(e),[],!1,null,null,!1,e.shape[1])[1]})},t.className="TimeDistributed",t}(Wrapper);serialization.SerializationMap.register(TimeDistributed);var VALID_BIDIRECTIONAL_MERGE_MODES=["sum","mul","concat","ave"];function checkBidirectionalMergeMode(e){checkStringTypeUnionValue(VALID_BIDIRECTIONAL_MERGE_MODES,"BidirectionalMergeMode",e)}var Bidirectional=function(e){function t(t){var r=e.call(this,t)||this,n=t.layer.getConfig();if(r.forwardLayer=deserialize({className:t.layer.getClassName(),config:n}),n.goBackwards=!0!==n.goBackwards,r.backwardLayer=deserialize({className:t.layer.getClassName(),config:n}),r.forwardLayer.name="forward_"+r.forwardLayer.name,r.backwardLayer.name="backward_"+r.backwardLayer.name,checkBidirectionalMergeMode(t.mergeMode),r.mergeMode=t.mergeMode,t.weights)throw new NotImplementedError("weights support is not implemented for Bidirectional layer yet.");return r._stateful=t.layer.stateful,r.returnSequences=t.layer.returnSequences,r.returnState=t.layer.returnState,r.supportsMasking=!0,r._trainable=!0,r.inputSpec=t.layer.inputSpec,r}return __extends$1(t,e),Object.defineProperty(t.prototype,"trainable",{get:function(){return this._trainable},set:function(e){this._trainable=e,null!=this.forwardLayer&&(this.forwardLayer.trainable=e),null!=this.backwardLayer&&(this.backwardLayer.trainable=e)},enumerable:!0,configurable:!0}),t.prototype.getWeights=function(){return this.forwardLayer.getWeights().concat(this.backwardLayer.getWeights())},t.prototype.setWeights=function(e){var t=e.length,r=Math.floor(t/2);this.forwardLayer.setWeights(e.slice(0,r)),this.backwardLayer.setWeights(e.slice(r))},t.prototype.computeOutputShape=function(e){var t,r,n,a=this.forwardLayer.computeOutputShape(e);return Array.isArray(a)&&Array.isArray(a[0])||(a=[a]),a=a,this.returnState?(n=a.slice(1),t=a[0]):t=a[0],t=t,"concat"===this.mergeMode?(t[t.length-1]*=2,r=[t]):r=null==this.mergeMode?[t,t.slice()]:[t],this.returnState?null==this.mergeMode?r.concat(n).concat(n.slice()):[t].concat(n).concat(n.slice()):singletonOrArray(r)},t.prototype.apply=function(t,r){var n=null;if(null!=r&&(n=r.initialState),Array.isArray(t)&&(n=t.slice(1),t=t[0]),null==n||0===n.length)return e.prototype.apply.call(this,t,r);throw new NotImplementedError("The support for initial states is not implemented for Bidirectional layers yet.")},t.prototype.call=function(e,t){var r=this;return tidy(function(){if(null!=t.mask)throw new NotImplementedError("The support for masking is not implemented for Bidirectional layers yet.");if(null!=t.initialState)throw new NotImplementedError("The support for initial states is not implemented for Bidirectional layers yet.");var n,a,o=r.forwardLayer.call(e,t),i=r.backwardLayer.call(e,t);return r.returnState&&(Array.isArray(o)&&(n=o.slice(1).concat(i.slice(1))),o=o[0],i=i[0]),r.returnSequences&&(i=reverse(i,1)),"concat"===r.mergeMode?a=concatenate([o,i]):"sum"===r.mergeMode?a=add(o,i):"ave"===r.mergeMode?a=mul(getScalar(.5),add(o,i)):"mul"===r.mergeMode?a=mul(o,i):null==r.mergeMode&&(a=[o,i]),r.returnState?null==r.mergeMode?a.concat(n):[a].concat(n):a})},t.prototype.resetStates=function(e){this.forwardLayer.resetStates(),this.backwardLayer.resetStates()},t.prototype.build=function(e){var t=this;nameScope(this.forwardLayer.name,function(){t.forwardLayer.build(e)}),nameScope(this.backwardLayer.name,function(){t.backwardLayer.build(e)}),this.built=!0},Object.defineProperty(t.prototype,"trainableWeights",{get:function(){return this.forwardLayer.trainableWeights.concat(this.backwardLayer.trainableWeights)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"nonTrainableWeights",{get:function(){return this.forwardLayer.nonTrainableWeights.concat(this.backwardLayer.nonTrainableWeights)},enumerable:!0,configurable:!0}),t.prototype.getConfig=function(){var t={mergeMode:this.mergeMode},r=e.prototype.getConfig.call(this);return Object.assign(t,r),t},t.fromConfig=function(e,t){var r=deserialize(t.layer);if(delete t.layer,null!=t.numConstants)throw new NotImplementedError("Deserialization of a Bidirectional layer with numConstants present is not supported yet.");var n=t;return n.layer=r,new e(n)},t.className="Bidirectional",t}(Wrapper);function loadModelInternal(e){return __awaiter$1(this,void 0,void 0,function(){var t;return __generator$1(this,function(r){if("string"==typeof e){if(0===(t=io.getLoadHandlers(e)).length)t.push(io.browserHTTPRequest(e));else if(t.length>1)throw new ValueError("Found more than one ("+t.length+") load handlers for URL '"+e+"'");e=t[0]}return[2,loadModelFromIOHandler(e)]})})}function loadModelFromIOHandler(e,t){return __awaiter$1(this,void 0,void 0,function(){var r,n,a,o,i;return __generator$1(this,function(s){switch(s.label){case 0:if(null==e.load)throw new ValueError("Cannot proceed with model loading because the IOHandler provided does not have the `load` method implemented.");return[4,e.load()];case 1:if(r=s.sent(),null!=(n=r.modelTopology).model_config&&(n=n.model_config),a=deserialize(convertPythonicToTs(n),t),null!=r.weightData){if(null==r.weightSpecs)throw new ValueError("Model artifacts contains weight data, but not weight specs. Therefore loading of weights cannot proceed.");o=!1,i=!0,a.loadWeights(io.decodeWeights(r.weightData,r.weightSpecs),o,i)}return[2,a]}})})}serialization.SerializationMap.register(Bidirectional);var Sequential=function(e){function t(t){var r=e.call(this,{inputs:[],outputs:[]})||this;if(t=t||{},r.trainable=!0,r._updatable=!0,r.built=!1,r.name=null!=t.name?t.name:getUid("sequential_"),null!=t.layers)for(var n=0,a=t.layers;n= 0x80 (not a basic code point)","invalid-input":"Invalid input"},w=l-c,S=Math.floor,T=String.fromCharCode;function N(e){throw RangeError(x[e])}function E(e,t){for(var r=e.length,n=[];r--;)n[r]=t(e[r]);return n}function _(e,t){var r=e.split("@"),n="";return r.length>1&&(n=r[0]+"@",e=r[1]),n+E((e=e.replace(b,".")).split("."),t).join(".")}function A(e){for(var t,r,n=[],a=0,o=e.length;a=55296&&t<=56319&&a65535&&(t+=T((e-=65536)>>>10&1023|55296),e=56320|1023&e),t+=T(e)}).join("")}function O(e,t){return e+22+75*(e<26)-((0!=t)<<5)}function C(e,t,r){var n=0;for(e=r?S(e/h):e>>1,e+=S(e/t);e>w*p>>1;n+=l)e=S(e/w);return S(n+(w+1)*e/(e+d))}function P(e){var t,r,n,a,o,i,s,d,h,y,v,b=[],x=e.length,w=0,T=m,E=f;for((r=e.lastIndexOf(g))<0&&(r=0),n=0;n=128&&N("not-basic"),b.push(e.charCodeAt(n));for(a=r>0?r+1:0;a=x&&N("invalid-input"),((d=(v=e.charCodeAt(a++))-48<10?v-22:v-65<26?v-65:v-97<26?v-97:l)>=l||d>S((u-w)/i))&&N("overflow"),w+=d*i,!(d<(h=s<=E?c:s>=E+p?p:s-E));s+=l)i>S(u/(y=l-h))&&N("overflow"),i*=y;E=C(w-o,t=b.length+1,0==o),S(w/t)>u-T&&N("overflow"),T+=S(w/t),w%=t,b.splice(w++,0,T)}return I(b)}function R(e){var t,r,n,a,o,i,s,d,h,y,v,b,x,w,E,_=[];for(b=(e=A(e)).length,t=m,r=0,o=f,i=0;i=t&&vS((u-r)/(x=n+1))&&N("overflow"),r+=(s-t)*x,t=s,i=0;iu&&N("overflow"),v==t){for(d=r,h=l;!(d<(y=h<=o?c:h>=o+p?p:h-o));h+=l)E=d-y,w=l-y,_.push(T(O(y+E%w,0))),d=S(E/w);_.push(T(O(d,0))),o=C(r,x,n==a),r=0,++n}++r,++t}return _.join("")}if(i={version:"1.3.2",ucs2:{decode:A,encode:I},decode:P,encode:R,toASCII:function(e){return _(e,function(e){return v.test(e)?"xn--"+R(e):e})},toUnicode:function(e){return _(e,function(e){return y.test(e)?P(e.slice(4).toLowerCase()):e})}},n&&a)if(e.exports==n)a.exports=i;else for(s in i)i.hasOwnProperty(s)&&(n[s]=i[s]);else r.punycode=i}(commonjsGlobal$1)}),util$1={isString:function(e){return"string"==typeof e},isObject:function(e){return"object"==typeof e&&null!==e},isNull:function(e){return null===e},isNullOrUndefined:function(e){return null==e}};function hasOwnProperty(e,t){return Object.prototype.hasOwnProperty.call(e,t)}var decode=function(e,t,r,n){t=t||"&",r=r||"=";var a={};if("string"!=typeof e||0===e.length)return a;var o=/\+/g;e=e.split(t);var i=1e3;n&&"number"==typeof n.maxKeys&&(i=n.maxKeys);var s=e.length;i>0&&s>i&&(s=i);for(var u=0;u=0?(l=h.substr(0,f),c=h.substr(f+1)):(l=h,c=""),p=decodeURIComponent(l),d=decodeURIComponent(c),hasOwnProperty(a,p)?Array.isArray(a[p])?a[p].push(d):a[p]=[a[p],d]:a[p]=d}return a},stringifyPrimitive=function(e){switch(typeof e){case"string":return e;case"boolean":return e?"true":"false";case"number":return isFinite(e)?e:"";default:return""}},encode=function(e,t,r,n){return t=t||"&",r=r||"=",null===e&&(e=void 0),"object"==typeof e?Object.keys(e).map(function(n){var a=encodeURIComponent(stringifyPrimitive(n))+r;return Array.isArray(e[n])?e[n].map(function(e){return a+encodeURIComponent(stringifyPrimitive(e))}).join(t):a+encodeURIComponent(stringifyPrimitive(e[n]))}).join(t):n?encodeURIComponent(stringifyPrimitive(n))+r+encodeURIComponent(stringifyPrimitive(e)):""},querystring=createCommonjsModule$1(function(e,t){t.decode=t.parse=decode,t.encode=t.stringify=encode}),querystring_1=querystring.decode,querystring_2=querystring.parse,querystring_3=querystring.encode,querystring_4=querystring.stringify,parse=urlParse,format=urlFormat;function Url(){this.protocol=null,this.slashes=null,this.auth=null,this.host=null,this.port=null,this.hostname=null,this.hash=null,this.search=null,this.query=null,this.pathname=null,this.path=null,this.href=null}var protocolPattern=/^([a-z0-9.+-]+:)/i,portPattern=/:[0-9]*$/,simplePathPattern=/^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,delims=["<",">",'"',"`"," ","\r","\n","\t"],unwise=["{","}","|","\\","^","`"].concat(delims),autoEscape=["'"].concat(unwise),nonHostChars=["%","/","?",";","#"].concat(autoEscape),hostEndingChars=["/","?","#"],hostnameMaxLen=255,hostnamePartPattern=/^[+a-z0-9A-Z_-]{0,63}$/,hostnamePartStart=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,unsafeProtocol={javascript:!0,"javascript:":!0},hostlessProtocol={javascript:!0,"javascript:":!0},slashedProtocol={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0};function urlParse(e,t,r){if(e&&util$1.isObject(e)&&e instanceof Url)return e;var n=new Url;return n.parse(e,t,r),n}function urlFormat(e){return util$1.isString(e)&&(e=urlParse(e)),e instanceof Url?e.format():Url.prototype.format.call(e)}Url.prototype.parse=function(e,t,r){if(!util$1.isString(e))throw new TypeError("Parameter 'url' must be a string, not "+typeof e);var n=e.indexOf("?"),a=-1!==n&&n127?x+="x":x+=b[w];if(!x.match(hostnamePartPattern)){var T=y.slice(0,f),N=y.slice(f+1),E=b.match(hostnamePartStart);E&&(T.push(E[1]),N.unshift(E[2])),N.length&&(i="/"+N.join(".")+i),this.hostname=T.join(".");break}}}this.hostname.length>hostnameMaxLen?this.hostname="":this.hostname=this.hostname.toLowerCase(),g||(this.hostname=punycode.toASCII(this.hostname));var _=this.port?":"+this.port:"",A=this.hostname||"";this.host=A+_,this.href+=this.host,g&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),"/"!==i[0]&&(i="/"+i))}if(!unsafeProtocol[l])for(f=0,v=autoEscape.length;f0)&&r.host.split("@"))&&(r.auth=E.shift(),r.host=r.hostname=E.shift());return r.search=e.search,r.query=e.query,util$1.isNull(r.pathname)&&util$1.isNull(r.search)||(r.path=(r.pathname?r.pathname:"")+(r.search?r.search:"")),r.href=r.format(),r}if(!b.length)return r.pathname=null,r.search?r.path="/"+r.search:r.path=null,r.href=r.format(),r;for(var w=b.slice(-1)[0],S=(r.host||e.host||b.length>1)&&("."===w||".."===w)||""===w,T=0,N=b.length;N>=0;N--)"."===(w=b[N])?b.splice(N,1):".."===w?(b.splice(N,1),T++):T&&(b.splice(N,1),T--);if(!y&&!v)for(;T--;T)b.unshift("..");!y||""===b[0]||b[0]&&"/"===b[0].charAt(0)||b.unshift(""),S&&"/"!==b.join("/").substr(-1)&&b.push("");var E,_=""===b[0]||b[0]&&"/"===b[0].charAt(0);x&&(r.hostname=r.host=_?"":b.length?b.shift():"",(E=!!(r.host&&r.host.indexOf("@")>0)&&r.host.split("@"))&&(r.auth=E.shift(),r.host=r.hostname=E.shift()));return(y=y||r.host&&b.length)&&!_&&b.unshift(""),b.length?r.pathname=b.join("/"):(r.pathname=null,r.path=null),util$1.isNull(r.pathname)&&util$1.isNull(r.search)||(r.path=(r.pathname?r.pathname:"")+(r.search?r.search:"")),r.auth=e.auth||r.auth,r.slashes=r.slashes||e.slashes,r.href=r.format(),r},Url.prototype.parseHost=function(){var e=this.host,t=portPattern.exec(e);t&&(":"!==(t=t[0])&&(this.port=t.substr(1)),e=e.substr(0,e.length-t.length)),e&&(this.hostname=e)};var aspromise=asPromise;function asPromise(e,t){for(var r=new Array(arguments.length-1),n=0,a=2,o=!0;a1&&"="===e.charAt(t);)++r;return Math.ceil(3*e.length)/4-r};for(var n=new Array(64),a=new Array(123),o=0;o<64;)a[n[o]=o<26?o+65:o<52?o+71:o<62?o-4:o-59|43]=o++;r.encode=function(e,t,r){for(var a,o=null,i=[],s=0,u=0;t>2],a=(3&l)<<4,u=1;break;case 1:i[s++]=n[a|l>>4],a=(15&l)<<2,u=2;break;case 2:i[s++]=n[a|l>>6],i[s++]=n[63&l],u=0}s>8191&&((o||(o=[])).push(String.fromCharCode.apply(String,i)),s=0)}return u&&(i[s++]=n[a],i[s++]=61,1===u&&(i[s++]=61)),o?(s&&o.push(String.fromCharCode.apply(String,i.slice(0,s))),o.join("")):String.fromCharCode.apply(String,i.slice(0,s))};r.decode=function(e,t,r){for(var n,o=r,i=0,s=0;s1)break;if(void 0===(u=a[u]))throw Error("invalid encoding");switch(i){case 0:n=u,i=1;break;case 1:t[r++]=n<<2|(48&u)>>4,n=u,i=2;break;case 2:t[r++]=(15&n)<<4|(60&u)>>2,n=u,i=3;break;case 3:t[r++]=(3&n)<<6|u,i=0}}if(1===i)throw Error("invalid encoding");return r-o},r.test=function(e){return/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(e)}}),eventemitter=EventEmitter;function EventEmitter(){this._listeners={}}EventEmitter.prototype.on=function(e,t,r){return(this._listeners[e]||(this._listeners[e]=[])).push({fn:t,ctx:r||this}),this},EventEmitter.prototype.off=function(e,t){if(void 0===e)this._listeners={};else if(void 0===t)this._listeners[e]=[];else for(var r=this._listeners[e],n=0;n0?0:2147483648,r,n);else if(isNaN(t))e(2143289344,r,n);else if(t>3.4028234663852886e38)e((a<<31|2139095040)>>>0,r,n);else if(t<1.1754943508222875e-38)e((a<<31|Math.round(t/1.401298464324817e-45))>>>0,r,n);else{var o=Math.floor(Math.log(t)/Math.LN2);e((a<<31|o+127<<23|8388607&Math.round(t*Math.pow(2,-o)*8388608))>>>0,r,n)}}function r(e,t,r){var n=e(t,r),a=2*(n>>31)+1,o=n>>>23&255,i=8388607&n;return 255===o?i?NaN:a*(1/0):0===o?1.401298464324817e-45*a*i:a*Math.pow(2,o-150)*(i+8388608)}e.writeFloatLE=t.bind(null,writeUintLE),e.writeFloatBE=t.bind(null,writeUintBE),e.readFloatLE=r.bind(null,readUintLE),e.readFloatBE=r.bind(null,readUintBE)}(),"undefined"!=typeof Float64Array?function(){var t=new Float64Array([-0]),r=new Uint8Array(t.buffer),n=128===r[7];function a(e,n,a){t[0]=e,n[a]=r[0],n[a+1]=r[1],n[a+2]=r[2],n[a+3]=r[3],n[a+4]=r[4],n[a+5]=r[5],n[a+6]=r[6],n[a+7]=r[7]}function o(e,n,a){t[0]=e,n[a]=r[7],n[a+1]=r[6],n[a+2]=r[5],n[a+3]=r[4],n[a+4]=r[3],n[a+5]=r[2],n[a+6]=r[1],n[a+7]=r[0]}function i(e,n){return r[0]=e[n],r[1]=e[n+1],r[2]=e[n+2],r[3]=e[n+3],r[4]=e[n+4],r[5]=e[n+5],r[6]=e[n+6],r[7]=e[n+7],t[0]}function s(e,n){return r[7]=e[n],r[6]=e[n+1],r[5]=e[n+2],r[4]=e[n+3],r[3]=e[n+4],r[2]=e[n+5],r[1]=e[n+6],r[0]=e[n+7],t[0]}e.writeDoubleLE=n?a:o,e.writeDoubleBE=n?o:a,e.readDoubleLE=n?i:s,e.readDoubleBE=n?s:i}():function(){function t(e,t,r,n,a,o){var i=n<0?1:0;if(i&&(n=-n),0===n)e(0,a,o+t),e(1/n>0?0:2147483648,a,o+r);else if(isNaN(n))e(0,a,o+t),e(2146959360,a,o+r);else if(n>1.7976931348623157e308)e(0,a,o+t),e((i<<31|2146435072)>>>0,a,o+r);else{var s;if(n<2.2250738585072014e-308)e((s=n/5e-324)>>>0,a,o+t),e((i<<31|s/4294967296)>>>0,a,o+r);else{var u=Math.floor(Math.log(n)/Math.LN2);1024===u&&(u=1023),e(4503599627370496*(s=n*Math.pow(2,-u))>>>0,a,o+t),e((i<<31|u+1023<<20|1048576*s&1048575)>>>0,a,o+r)}}}function r(e,t,r,n,a){var o=e(n,a+t),i=e(n,a+r),s=2*(i>>31)+1,u=i>>>20&2047,l=4294967296*(1048575&i)+o;return 2047===u?l?NaN:s*(1/0):0===u?5e-324*s*l:s*Math.pow(2,u-1075)*(l+4503599627370496)}e.writeDoubleLE=t.bind(null,writeUintLE,0,4),e.writeDoubleBE=t.bind(null,writeUintBE,4,0),e.readDoubleLE=r.bind(null,readUintLE,0,4),e.readDoubleBE=r.bind(null,readUintBE,4,0)}(),e}function writeUintLE(e,t,r){t[r]=255&e,t[r+1]=e>>>8&255,t[r+2]=e>>>16&255,t[r+3]=e>>>24}function writeUintBE(e,t,r){t[r]=e>>>24,t[r+1]=e>>>16&255,t[r+2]=e>>>8&255,t[r+3]=255&e}function readUintLE(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24)>>>0}function readUintBE(e,t){return(e[t]<<24|e[t+1]<<16|e[t+2]<<8|e[t+3])>>>0}var inquire_1=inquire;function inquire(moduleName){try{var mod=eval("quire".replace(/^/,"re"))(moduleName);if(mod&&(mod.length||Object.keys(mod).length))return mod}catch(e){}return null}var utf8_1=createCommonjsModule$1(function(e,t){var r=t;r.length=function(e){for(var t=0,r=0,n=0;n191&&n<224?o[i++]=(31&n)<<6|63&e[t++]:n>239&&n<365?(n=((7&n)<<18|(63&e[t++])<<12|(63&e[t++])<<6|63&e[t++])-65536,o[i++]=55296+(n>>10),o[i++]=56320+(1023&n)):o[i++]=(15&n)<<12|(63&e[t++])<<6|63&e[t++],i>8191&&((a||(a=[])).push(String.fromCharCode.apply(String,o)),i=0);return a?(i&&a.push(String.fromCharCode.apply(String,o.slice(0,i))),a.join("")):String.fromCharCode.apply(String,o.slice(0,i))},r.write=function(e,t,r){for(var n,a,o=r,i=0;i>6|192,t[r++]=63&n|128):55296==(64512&n)&&56320==(64512&(a=e.charCodeAt(i+1)))?(n=65536+((1023&n)<<10)+(1023&a),++i,t[r++]=n>>18|240,t[r++]=n>>12&63|128,t[r++]=n>>6&63|128,t[r++]=63&n|128):(t[r++]=n>>12|224,t[r++]=n>>6&63|128,t[r++]=63&n|128);return r-o}}),pool_1=pool;function pool(e,t,r){var n=r||8192,a=n>>>1,o=null,i=n;return function(r){if(r<1||r>a)return e(r);i+r>n&&(o=e(n),i=0);var s=t.call(o,i,i+=r);return 7&i&&(i=1+(7|i)),s}}var longbits=LongBits;function LongBits(e,t){this.lo=e>>>0,this.hi=t>>>0}var zero=LongBits.zero=new LongBits(0,0);zero.toNumber=function(){return 0},zero.zzEncode=zero.zzDecode=function(){return this},zero.length=function(){return 1};var zeroHash=LongBits.zeroHash="\0\0\0\0\0\0\0\0";LongBits.fromNumber=function(e){if(0===e)return zero;var t=e<0;t&&(e=-e);var r=e>>>0,n=(e-r)/4294967296>>>0;return t&&(n=~n>>>0,r=~r>>>0,++r>4294967295&&(r=0,++n>4294967295&&(n=0))),new LongBits(r,n)},LongBits.from=function(e){if("number"==typeof e)return LongBits.fromNumber(e);if(minimal.isString(e)){if(!minimal.Long)return LongBits.fromNumber(parseInt(e,10));e=minimal.Long.fromString(e)}return e.low||e.high?new LongBits(e.low>>>0,e.high>>>0):zero},LongBits.prototype.toNumber=function(e){if(!e&&this.hi>>>31){var t=1+~this.lo>>>0,r=~this.hi>>>0;return t||(r=r+1>>>0),-(t+4294967296*r)}return this.lo+4294967296*this.hi},LongBits.prototype.toLong=function(e){return minimal.Long?new minimal.Long(0|this.lo,0|this.hi,Boolean(e)):{low:0|this.lo,high:0|this.hi,unsigned:Boolean(e)}};var charCodeAt=String.prototype.charCodeAt;LongBits.fromHash=function(e){return e===zeroHash?zero:new LongBits((charCodeAt.call(e,0)|charCodeAt.call(e,1)<<8|charCodeAt.call(e,2)<<16|charCodeAt.call(e,3)<<24)>>>0,(charCodeAt.call(e,4)|charCodeAt.call(e,5)<<8|charCodeAt.call(e,6)<<16|charCodeAt.call(e,7)<<24)>>>0)},LongBits.prototype.toHash=function(){return String.fromCharCode(255&this.lo,this.lo>>>8&255,this.lo>>>16&255,this.lo>>>24,255&this.hi,this.hi>>>8&255,this.hi>>>16&255,this.hi>>>24)},LongBits.prototype.zzEncode=function(){var e=this.hi>>31;return this.hi=((this.hi<<1|this.lo>>>31)^e)>>>0,this.lo=(this.lo<<1^e)>>>0,this},LongBits.prototype.zzDecode=function(){var e=-(1&this.lo);return this.lo=((this.lo>>>1|this.hi<<31)^e)>>>0,this.hi=(this.hi>>>1^e)>>>0,this},LongBits.prototype.length=function(){var e=this.lo,t=(this.lo>>>28|this.hi<<4)>>>0,r=this.hi>>>24;return 0===r?0===t?e<16384?e<128?1:2:e<2097152?3:4:t<16384?t<128?5:6:t<2097152?7:8:r<128?9:10};var minimal=createCommonjsModule$1(function(e,t){var r=t;function n(e,t,r){for(var n=Object.keys(t),a=0;a0)},r.Buffer=function(){try{var e=r.inquire("buffer").Buffer;return e.prototype.utf8Write?e:null}catch(e){return null}}(),r._Buffer_from=null,r._Buffer_allocUnsafe=null,r.newBuffer=function(e){return"number"==typeof e?r.Buffer?r._Buffer_allocUnsafe(e):new r.Array(e):r.Buffer?r._Buffer_from(e):"undefined"==typeof Uint8Array?e:new Uint8Array(e)},r.Array="undefined"!=typeof Uint8Array?Uint8Array:Array,r.Long=commonjsGlobal$1.dcodeIO&&commonjsGlobal$1.dcodeIO.Long||r.inquire("long"),r.key2Re=/^true|false|0|1$/,r.key32Re=/^-?(?:0|[1-9][0-9]*)$/,r.key64Re=/^(?:[\\x00-\\xff]{8}|-?(?:0|[1-9][0-9]*))$/,r.longToHash=function(e){return e?r.LongBits.from(e).toHash():r.LongBits.zeroHash},r.longFromHash=function(e,t){var n=r.LongBits.fromHash(e);return r.Long?r.Long.fromBits(n.lo,n.hi,t):n.toNumber(Boolean(t))},r.merge=n,r.lcFirst=function(e){return e.charAt(0).toLowerCase()+e.substring(1)},r.newError=a,r.ProtocolError=a("ProtocolError"),r.oneOfGetter=function(e){for(var t={},r=0;r-1;--r)if(1===t[e[r]]&&void 0!==this[e[r]]&&null!==this[e[r]])return e[r]}},r.oneOfSetter=function(e){return function(t){for(var r=0;r127;)t[r++]=127&e|128,e>>>=7;t[r]=e}function VarintOp(e,t){this.len=e,this.next=void 0,this.val=t}function writeVarint64(e,t,r){for(;e.hi;)t[r++]=127&e.lo|128,e.lo=(e.lo>>>7|e.hi<<25)>>>0,e.hi>>>=7;for(;e.lo>127;)t[r++]=127&e.lo|128,e.lo=e.lo>>>7;t[r++]=e.lo}function writeFixed32(e,t,r){t[r]=255&e,t[r+1]=e>>>8&255,t[r+2]=e>>>16&255,t[r+3]=e>>>24}Writer.create=minimal.Buffer?function(){return(Writer.create=function(){return new BufferWriter})()}:function(){return new Writer},Writer.alloc=function(e){return new minimal.Array(e)},minimal.Array!==Array&&(Writer.alloc=minimal.pool(Writer.alloc,minimal.Array.prototype.subarray)),Writer.prototype._push=function(e,t,r){return this.tail=this.tail.next=new Op(e,t,r),this.len+=t,this},VarintOp.prototype=Object.create(Op.prototype),VarintOp.prototype.fn=writeVarint32,Writer.prototype.uint32=function(e){return this.len+=(this.tail=this.tail.next=new VarintOp((e>>>=0)<128?1:e<16384?2:e<2097152?3:e<268435456?4:5,e)).len,this},Writer.prototype.int32=function(e){return e<0?this._push(writeVarint64,10,LongBits$1.fromNumber(e)):this.uint32(e)},Writer.prototype.sint32=function(e){return this.uint32((e<<1^e>>31)>>>0)},Writer.prototype.uint64=function(e){var t=LongBits$1.from(e);return this._push(writeVarint64,t.length(),t)},Writer.prototype.int64=Writer.prototype.uint64,Writer.prototype.sint64=function(e){var t=LongBits$1.from(e).zzEncode();return this._push(writeVarint64,t.length(),t)},Writer.prototype.bool=function(e){return this._push(writeByte,1,e?1:0)},Writer.prototype.fixed32=function(e){return this._push(writeFixed32,4,e>>>0)},Writer.prototype.sfixed32=Writer.prototype.fixed32,Writer.prototype.fixed64=function(e){var t=LongBits$1.from(e);return this._push(writeFixed32,4,t.lo)._push(writeFixed32,4,t.hi)},Writer.prototype.sfixed64=Writer.prototype.fixed64,Writer.prototype.float=function(e){return this._push(minimal.float.writeFloatLE,4,e)},Writer.prototype.double=function(e){return this._push(minimal.float.writeDoubleLE,8,e)};var writeBytes=minimal.Array.prototype.set?function(e,t,r){t.set(e,r)}:function(e,t,r){for(var n=0;n>>0;if(!t)return this._push(writeByte,1,0);if(minimal.isString(e)){var r=Writer.alloc(t=base64.length(e));base64.decode(e,r,0),e=r}return this.uint32(t)._push(writeBytes,t,e)},Writer.prototype.string=function(e){var t=utf8.length(e);return t?this.uint32(t)._push(utf8.write,t,e):this._push(writeByte,1,0)},Writer.prototype.fork=function(){return this.states=new State(this),this.head=this.tail=new Op(noop,0,0),this.len=0,this},Writer.prototype.reset=function(){return this.states?(this.head=this.states.head,this.tail=this.states.tail,this.len=this.states.len,this.states=this.states.next):(this.head=this.tail=new Op(noop,0,0),this.len=0),this},Writer.prototype.ldelim=function(){var e=this.head,t=this.tail,r=this.len;return this.reset().uint32(r),r&&(this.tail.next=e.next,this.tail=t,this.len+=r),this},Writer.prototype.finish=function(){for(var e=this.head.next,t=this.constructor.alloc(this.len),r=0;e;)e.fn(e.val,t,r),r+=e.len,e=e.next;return t},Writer._configure=function(e){BufferWriter=e};var writer_buffer=BufferWriter$1;(BufferWriter$1.prototype=Object.create(writer.prototype)).constructor=BufferWriter$1;var Buffer=minimal.Buffer;function BufferWriter$1(){writer.call(this)}BufferWriter$1.alloc=function(e){return(BufferWriter$1.alloc=minimal._Buffer_allocUnsafe)(e)};var writeBytesBuffer=Buffer&&Buffer.prototype instanceof Uint8Array&&"set"===Buffer.prototype.set.name?function(e,t,r){t.set(e,r)}:function(e,t,r){if(e.copy)e.copy(t,r,0,e.length);else for(var n=0;n>>0;return this.uint32(t),t&&this._push(writeBytesBuffer,t,e),this},BufferWriter$1.prototype.string=function(e){var t=Buffer.byteLength(e);return this.uint32(t),t&&this._push(writeStringBuffer,t,e),this};var reader=Reader,BufferReader,LongBits$2=minimal.LongBits,utf8$1=minimal.utf8;function indexOutOfRange(e,t){return RangeError("index out of range: "+e.pos+" + "+(t||1)+" > "+e.len)}function Reader(e){this.buf=e,this.pos=0,this.len=e.length}var create_array="undefined"!=typeof Uint8Array?function(e){if(e instanceof Uint8Array||Array.isArray(e))return new Reader(e);throw Error("illegal buffer")}:function(e){if(Array.isArray(e))return new Reader(e);throw Error("illegal buffer")},value;function readLongVarint(){var e=new LongBits$2(0,0),t=0;if(!(this.len-this.pos>4)){for(;t<3;++t){if(this.pos>=this.len)throw indexOutOfRange(this);if(e.lo=(e.lo|(127&this.buf[this.pos])<<7*t)>>>0,this.buf[this.pos++]<128)return e}return e.lo=(e.lo|(127&this.buf[this.pos++])<<7*t)>>>0,e}for(;t<4;++t)if(e.lo=(e.lo|(127&this.buf[this.pos])<<7*t)>>>0,this.buf[this.pos++]<128)return e;if(e.lo=(e.lo|(127&this.buf[this.pos])<<28)>>>0,e.hi=(e.hi|(127&this.buf[this.pos])>>4)>>>0,this.buf[this.pos++]<128)return e;if(t=0,this.len-this.pos>4){for(;t<5;++t)if(e.hi=(e.hi|(127&this.buf[this.pos])<<7*t+3)>>>0,this.buf[this.pos++]<128)return e}else for(;t<5;++t){if(this.pos>=this.len)throw indexOutOfRange(this);if(e.hi=(e.hi|(127&this.buf[this.pos])<<7*t+3)>>>0,this.buf[this.pos++]<128)return e}throw Error("invalid varint encoding")}function readFixed32_end(e,t){return(e[t-4]|e[t-3]<<8|e[t-2]<<16|e[t-1]<<24)>>>0}function readFixed64(){if(this.pos+8>this.len)throw indexOutOfRange(this,8);return new LongBits$2(readFixed32_end(this.buf,this.pos+=4),readFixed32_end(this.buf,this.pos+=4))}Reader.create=minimal.Buffer?function(e){return(Reader.create=function(e){return minimal.Buffer.isBuffer(e)?new BufferReader(e):create_array(e)})(e)}:create_array,Reader.prototype._slice=minimal.Array.prototype.subarray||minimal.Array.prototype.slice,Reader.prototype.uint32=(value=4294967295,function(){if(value=(127&this.buf[this.pos])>>>0,this.buf[this.pos++]<128)return value;if(value=(value|(127&this.buf[this.pos])<<7)>>>0,this.buf[this.pos++]<128)return value;if(value=(value|(127&this.buf[this.pos])<<14)>>>0,this.buf[this.pos++]<128)return value;if(value=(value|(127&this.buf[this.pos])<<21)>>>0,this.buf[this.pos++]<128)return value;if(value=(value|(15&this.buf[this.pos])<<28)>>>0,this.buf[this.pos++]<128)return value;if((this.pos+=5)>this.len)throw this.pos=this.len,indexOutOfRange(this,10);return value}),Reader.prototype.int32=function(){return 0|this.uint32()},Reader.prototype.sint32=function(){var e=this.uint32();return e>>>1^-(1&e)|0},Reader.prototype.bool=function(){return 0!==this.uint32()},Reader.prototype.fixed32=function(){if(this.pos+4>this.len)throw indexOutOfRange(this,4);return readFixed32_end(this.buf,this.pos+=4)},Reader.prototype.sfixed32=function(){if(this.pos+4>this.len)throw indexOutOfRange(this,4);return 0|readFixed32_end(this.buf,this.pos+=4)},Reader.prototype.float=function(){if(this.pos+4>this.len)throw indexOutOfRange(this,4);var e=minimal.float.readFloatLE(this.buf,this.pos);return this.pos+=4,e},Reader.prototype.double=function(){if(this.pos+8>this.len)throw indexOutOfRange(this,4);var e=minimal.float.readDoubleLE(this.buf,this.pos);return this.pos+=8,e},Reader.prototype.bytes=function(){var e=this.uint32(),t=this.pos,r=this.pos+e;if(r>this.len)throw indexOutOfRange(this,e);return this.pos+=e,Array.isArray(this.buf)?this.buf.slice(t,r):t===r?new this.buf.constructor(0):this._slice.call(this.buf,t,r)},Reader.prototype.string=function(){var e=this.bytes();return utf8$1.read(e,0,e.length)},Reader.prototype.skip=function(e){if("number"==typeof e){if(this.pos+e>this.len)throw indexOutOfRange(this,e);this.pos+=e}else do{if(this.pos>=this.len)throw indexOutOfRange(this)}while(128&this.buf[this.pos++]);return this},Reader.prototype.skipType=function(e){switch(e){case 0:this.skip();break;case 1:this.skip(8);break;case 2:this.skip(this.uint32());break;case 3:for(;;){if(4==(e=7&this.uint32()))break;this.skipType(e)}break;case 5:this.skip(4);break;default:throw Error("invalid wire type "+e+" at offset "+this.pos)}return this},Reader._configure=function(e){BufferReader=e;var t=minimal.Long?"toLong":"toNumber";minimal.merge(Reader.prototype,{int64:function(){return readLongVarint.call(this)[t](!1)},uint64:function(){return readLongVarint.call(this)[t](!0)},sint64:function(){return readLongVarint.call(this).zzDecode()[t](!1)},fixed64:function(){return readFixed64.call(this)[t](!0)},sfixed64:function(){return readFixed64.call(this)[t](!1)}})};var reader_buffer=BufferReader$1;function BufferReader$1(e){reader.call(this,e)}(BufferReader$1.prototype=Object.create(reader.prototype)).constructor=BufferReader$1,minimal.Buffer&&(BufferReader$1.prototype._slice=minimal.Buffer.prototype.slice),BufferReader$1.prototype.string=function(){var e=this.uint32();return this.buf.utf8Slice(this.pos,this.pos=Math.min(this.pos+e,this.len))};var service=Service;function Service(e,t,r){if("function"!=typeof e)throw TypeError("rpcImpl must be a function");minimal.EventEmitter.call(this),this.rpcImpl=e,this.requestDelimited=Boolean(t),this.responseDelimited=Boolean(r)}(Service.prototype=Object.create(minimal.EventEmitter.prototype)).constructor=Service,Service.prototype.rpcCall=function e(t,r,n,a,o){if(!a)throw TypeError("request must be specified");var i=this;if(!o)return minimal.asPromise(e,i,t,r,n,a);if(i.rpcImpl)try{return i.rpcImpl(t,r[i.requestDelimited?"encodeDelimited":"encode"](a).finish(),function(e,r){if(e)return i.emit("error",e,t),o(e);if(null!==r){if(!(r instanceof n))try{r=n[i.responseDelimited?"decodeDelimited":"decode"](r)}catch(e){return i.emit("error",e,t),o(e)}return i.emit("data",r,t),o(null,r)}i.end(!0)})}catch(e){return i.emit("error",e,t),void setTimeout(function(){o(e)},0)}else setTimeout(function(){o(Error("already ended"))},0)},Service.prototype.end=function(e){return this.rpcImpl&&(e||this.rpcImpl(null,null,null),this.rpcImpl=null,this.emit("end").off()),this};var rpc_1=createCommonjsModule$1(function(e,t){t.Service=service}),roots={},indexMinimal=createCommonjsModule$1(function(e,t){var r=t;function n(){r.Reader._configure(r.BufferReader),r.util._configure()}r.build="minimal",r.Writer=writer,r.BufferWriter=writer_buffer,r.Reader=reader,r.BufferReader=reader_buffer,r.util=minimal,r.rpc=rpc_1,r.roots=roots,r.configure=n,r.Writer._configure(r.BufferWriter),n()}),minimal$1=indexMinimal,minimal_1=minimal$1.roots,minimal_2=minimal$1.Reader,minimal_3=minimal$1.util;const $Reader=minimal_2,$util=minimal_3,$root=minimal_1.default||(minimal_1.default={}),tensorflow=$root.tensorflow=function(){const e={};return e.Any=function(){function e(e){if(e)for(var t=Object.keys(e),r=0;r>>3){case 1:n.typeUrl=e.string();break;case 2:n.value=e.bytes();break;default:e.skipType(7&a)}}return n},e}(),e.DataType=function(){const e={},t=Object.create(e);return t[e[0]="DT_INVALID"]=0,t[e[1]="DT_FLOAT"]=1,t[e[2]="DT_DOUBLE"]=2,t[e[3]="DT_INT32"]=3,t[e[4]="DT_UINT8"]=4,t[e[5]="DT_INT16"]=5,t[e[6]="DT_INT8"]=6,t[e[7]="DT_STRING"]=7,t[e[8]="DT_COMPLEX64"]=8,t[e[9]="DT_INT64"]=9,t[e[10]="DT_BOOL"]=10,t[e[11]="DT_QINT8"]=11,t[e[12]="DT_QUINT8"]=12,t[e[13]="DT_QINT32"]=13,t[e[14]="DT_BFLOAT16"]=14,t[e[101]="DT_FLOAT_REF"]=101,t[e[102]="DT_DOUBLE_REF"]=102,t[e[103]="DT_INT32_REF"]=103,t[e[104]="DT_UINT8_REF"]=104,t[e[105]="DT_INT16_REF"]=105,t[e[106]="DT_INT8_REF"]=106,t[e[107]="DT_STRING_REF"]=107,t[e[108]="DT_COMPLEX64_REF"]=108,t[e[109]="DT_INT64_REF"]=109,t[e[110]="DT_BOOL_REF"]=110,t[e[111]="DT_QINT8_REF"]=111,t[e[112]="DT_QUINT8_REF"]=112,t[e[113]="DT_QINT32_REF"]=113,t[e[114]="DT_BFLOAT16_REF"]=114,t}(),e.TensorShape=function(){function e(e){if(this.dim=[],e)for(var t=Object.keys(e),r=0;r>>3){case 2:n.dim&&n.dim.length||(n.dim=[]),n.dim.push($root.tensorflow.TensorShape.Dim.decode(e,e.uint32()));break;case 3:n.unknownRank=e.bool();break;default:e.skipType(7&a)}}return n},e.Dim=function(){function e(e){if(e)for(var t=Object.keys(e),r=0;r>>3){case 1:n.size=e.int64();break;case 2:n.name=e.string();break;default:e.skipType(7&a)}}return n},e}(),e}(),e.Tensor=function(){function e(e){if(this.floatVal=[],this.doubleVal=[],this.intVal=[],this.stringVal=[],this.scomplexVal=[],this.int64Val=[],this.boolVal=[],this.uint32Val=[],this.uint64Val=[],e)for(var t=Object.keys(e),r=0;r>>3){case 1:n.dtype=e.int32();break;case 2:n.tensorShape=$root.tensorflow.TensorShape.decode(e,e.uint32());break;case 3:n.versionNumber=e.int32();break;case 4:n.tensorContent=e.bytes();break;case 5:if(n.floatVal&&n.floatVal.length||(n.floatVal=[]),2==(7&a))for(var o=e.uint32()+e.pos;e.pos>>3){case 1:n.list=$root.tensorflow.AttrValue.ListValue.decode(e,e.uint32());break;case 2:n.s=e.bytes();break;case 3:n.i=e.int64();break;case 4:n.f=e.float();break;case 5:n.b=e.bool();break;case 6:n.type=e.int32();break;case 7:n.shape=$root.tensorflow.TensorShape.decode(e,e.uint32());break;case 8:n.tensor=$root.tensorflow.Tensor.decode(e,e.uint32());break;case 9:n.placeholder=e.string();break;case 10:n.func=$root.tensorflow.NameAttrList.decode(e,e.uint32());break;default:e.skipType(7&a)}}return n},e.ListValue=function(){function e(e){if(this.s=[],this.i=[],this.f=[],this.b=[],this.type=[],this.shape=[],this.tensor=[],this.func=[],e)for(var t=Object.keys(e),r=0;r>>3){case 2:n.s&&n.s.length||(n.s=[]),n.s.push(e.bytes());break;case 3:if(n.i&&n.i.length||(n.i=[]),2==(7&a))for(var o=e.uint32()+e.pos;e.pos>>3){case 1:a.name=e.string();break;case 2:e.skip().pos++,a.attr===$util.emptyObject&&(a.attr={}),r=e.string(),e.pos++,a.attr[r]=$root.tensorflow.AttrValue.decode(e,e.uint32());break;default:e.skipType(7&o)}}return a},e}(),e.NodeDef=function(){function e(e){if(this.input=[],this.attr={},e)for(var t=Object.keys(e),r=0;r>>3){case 1:a.name=e.string();break;case 2:a.op=e.string();break;case 3:a.input&&a.input.length||(a.input=[]),a.input.push(e.string());break;case 4:a.device=e.string();break;case 5:e.skip().pos++,a.attr===$util.emptyObject&&(a.attr={}),r=e.string(),e.pos++,a.attr[r]=$root.tensorflow.AttrValue.decode(e,e.uint32());break;default:e.skipType(7&o)}}return a},e}(),e.VersionDef=function(){function e(e){if(this.badConsumers=[],e)for(var t=Object.keys(e),r=0;r>>3){case 1:n.producer=e.int32();break;case 2:n.minConsumer=e.int32();break;case 3:if(n.badConsumers&&n.badConsumers.length||(n.badConsumers=[]),2==(7&a))for(var o=e.uint32()+e.pos;e.pos>>3){case 1:n.node&&n.node.length||(n.node=[]),n.node.push($root.tensorflow.NodeDef.decode(e,e.uint32()));break;case 4:n.versions=$root.tensorflow.VersionDef.decode(e,e.uint32());break;case 2:n.library=$root.tensorflow.FunctionDefLibrary.decode(e,e.uint32());break;default:e.skipType(7&a)}}return n},e}(),e.CollectionDef=function(){function e(e){if(e)for(var t=Object.keys(e),r=0;r>>3){case 1:n.nodeList=$root.tensorflow.CollectionDef.NodeList.decode(e,e.uint32());break;case 2:n.bytesList=$root.tensorflow.CollectionDef.BytesList.decode(e,e.uint32());break;case 3:n.int64List=$root.tensorflow.CollectionDef.Int64List.decode(e,e.uint32());break;case 4:n.floatList=$root.tensorflow.CollectionDef.FloatList.decode(e,e.uint32());break;case 5:n.anyList=$root.tensorflow.CollectionDef.AnyList.decode(e,e.uint32());break;default:e.skipType(7&a)}}return n},e.NodeList=function(){function e(e){if(this.value=[],e)for(var t=Object.keys(e),r=0;r>>3){case 1:n.value&&n.value.length||(n.value=[]),n.value.push(e.string());break;default:e.skipType(7&a)}}return n},e}(),e.BytesList=function(){function e(e){if(this.value=[],e)for(var t=Object.keys(e),r=0;r>>3){case 1:n.value&&n.value.length||(n.value=[]),n.value.push(e.bytes());break;default:e.skipType(7&a)}}return n},e}(),e.Int64List=function(){function e(e){if(this.value=[],e)for(var t=Object.keys(e),r=0;r>>3){case 1:if(n.value&&n.value.length||(n.value=[]),2==(7&a))for(var o=e.uint32()+e.pos;e.pos>>3){case 1:if(n.value&&n.value.length||(n.value=[]),2==(7&a))for(var o=e.uint32()+e.pos;e.pos>>3){case 1:n.value&&n.value.length||(n.value=[]),n.value.push($root.tensorflow.Any.decode(e,e.uint32()));break;default:e.skipType(7&a)}}return n},e}(),e}(),e.SaverDef=function(){function e(e){if(e)for(var t=Object.keys(e),r=0;r>>3){case 1:n.filenameTensorName=e.string();break;case 2:n.saveTensorName=e.string();break;case 3:n.restoreOpName=e.string();break;case 4:n.maxToKeep=e.int32();break;case 5:n.sharded=e.bool();break;case 6:n.keepCheckpointEveryNHours=e.float();break;case 7:n.version=e.int32();break;default:e.skipType(7&a)}}return n},e.CheckpointFormatVersion=function(){const e={},t=Object.create(e);return t[e[0]="LEGACY"]=0,t[e[1]="V1"]=1,t[e[2]="V2"]=2,t}(),e}(),e.TensorInfo=function(){function e(e){if(e)for(var t=Object.keys(e),r=0;r>>3){case 1:n.name=e.string();break;case 4:n.cooSparse=$root.tensorflow.TensorInfo.CooSparse.decode(e,e.uint32());break;case 2:n.dtype=e.int32();break;case 3:n.tensorShape=$root.tensorflow.TensorShape.decode(e,e.uint32());break;default:e.skipType(7&a)}}return n},e.CooSparse=function(){function e(e){if(e)for(var t=Object.keys(e),r=0;r>>3){case 1:n.valuesTensorName=e.string();break;case 2:n.indicesTensorName=e.string();break;case 3:n.denseShapeTensorName=e.string();break;default:e.skipType(7&a)}}return n},e}(),e}(),e.SignatureDef=function(){function e(e){if(this.inputs={},this.outputs={},e)for(var t=Object.keys(e),r=0;r>>3){case 1:e.skip().pos++,a.inputs===$util.emptyObject&&(a.inputs={}),r=e.string(),e.pos++,a.inputs[r]=$root.tensorflow.TensorInfo.decode(e,e.uint32());break;case 2:e.skip().pos++,a.outputs===$util.emptyObject&&(a.outputs={}),r=e.string(),e.pos++,a.outputs[r]=$root.tensorflow.TensorInfo.decode(e,e.uint32());break;case 3:a.methodName=e.string();break;default:e.skipType(7&o)}}return a},e}(),e.AssetFileDef=function(){function e(e){if(e)for(var t=Object.keys(e),r=0;r>>3){case 1:n.tensorInfo=$root.tensorflow.TensorInfo.decode(e,e.uint32());break;case 2:n.filename=e.string();break;default:e.skipType(7&a)}}return n},e}(),e.OpDef=function(){function e(e){if(this.inputArg=[],this.outputArg=[],this.attr=[],e)for(var t=Object.keys(e),r=0;r>>3){case 1:n.name=e.string();break;case 2:n.inputArg&&n.inputArg.length||(n.inputArg=[]),n.inputArg.push($root.tensorflow.OpDef.ArgDef.decode(e,e.uint32()));break;case 3:n.outputArg&&n.outputArg.length||(n.outputArg=[]),n.outputArg.push($root.tensorflow.OpDef.ArgDef.decode(e,e.uint32()));break;case 4:n.attr&&n.attr.length||(n.attr=[]),n.attr.push($root.tensorflow.OpDef.AttrDef.decode(e,e.uint32()));break;case 8:n.deprecation=$root.tensorflow.OpDef.OpDeprecation.decode(e,e.uint32());break;case 5:n.summary=e.string();break;case 6:n.description=e.string();break;case 18:n.isCommutative=e.bool();break;case 16:n.isAggregate=e.bool();break;case 17:n.isStateful=e.bool();break;case 19:n.allowsUninitializedInput=e.bool();break;default:e.skipType(7&a)}}return n},e.ArgDef=function(){function e(e){if(e)for(var t=Object.keys(e),r=0;r>>3){case 1:n.name=e.string();break;case 2:n.description=e.string();break;case 3:n.type=e.int32();break;case 4:n.typeAttr=e.string();break;case 5:n.numberAttr=e.string();break;case 6:n.typeListAttr=e.string();break;case 16:n.isRef=e.bool();break;default:e.skipType(7&a)}}return n},e}(),e.AttrDef=function(){function e(e){if(e)for(var t=Object.keys(e),r=0;r>>3){case 1:n.name=e.string();break;case 2:n.type=e.string();break;case 3:n.defaultValue=$root.tensorflow.AttrValue.decode(e,e.uint32());break;case 4:n.description=e.string();break;case 5:n.hasMinimum=e.bool();break;case 6:n.minimum=e.int64();break;case 7:n.allowedValues=$root.tensorflow.AttrValue.decode(e,e.uint32());break;default:e.skipType(7&a)}}return n},e}(),e.OpDeprecation=function(){function e(e){if(e)for(var t=Object.keys(e),r=0;r>>3){case 1:n.version=e.int32();break;case 2:n.explanation=e.string();break;default:e.skipType(7&a)}}return n},e}(),e}(),e.OpList=function(){function e(e){if(this.op=[],e)for(var t=Object.keys(e),r=0;r>>3){case 1:n.op&&n.op.length||(n.op=[]),n.op.push($root.tensorflow.OpDef.decode(e,e.uint32()));break;default:e.skipType(7&a)}}return n},e}(),e.MetaGraphDef=function(){function e(e){if(this.collectionDef={},this.signatureDef={},this.assetFileDef=[],e)for(var t=Object.keys(e),r=0;r>>3){case 1:a.metaInfoDef=$root.tensorflow.MetaGraphDef.MetaInfoDef.decode(e,e.uint32());break;case 2:a.graphDef=$root.tensorflow.GraphDef.decode(e,e.uint32());break;case 3:a.saverDef=$root.tensorflow.SaverDef.decode(e,e.uint32());break;case 4:e.skip().pos++,a.collectionDef===$util.emptyObject&&(a.collectionDef={}),r=e.string(),e.pos++,a.collectionDef[r]=$root.tensorflow.CollectionDef.decode(e,e.uint32());break;case 5:e.skip().pos++,a.signatureDef===$util.emptyObject&&(a.signatureDef={}),r=e.string(),e.pos++,a.signatureDef[r]=$root.tensorflow.SignatureDef.decode(e,e.uint32());break;case 6:a.assetFileDef&&a.assetFileDef.length||(a.assetFileDef=[]),a.assetFileDef.push($root.tensorflow.AssetFileDef.decode(e,e.uint32()));break;default:e.skipType(7&o)}}return a},e.MetaInfoDef=function(){function e(e){if(this.tags=[],e)for(var t=Object.keys(e),r=0;r>>3){case 1:n.metaGraphVersion=e.string();break;case 2:n.strippedOpList=$root.tensorflow.OpList.decode(e,e.uint32());break;case 3:n.anyInfo=$root.tensorflow.Any.decode(e,e.uint32());break;case 4:n.tags&&n.tags.length||(n.tags=[]),n.tags.push(e.string());break;case 5:n.tensorflowVersion=e.string();break;case 6:n.tensorflowGitVersion=e.string();break;default:e.skipType(7&a)}}return n},e}(),e}(),e.SavedModel=function(){function e(e){if(this.metaGraphs=[],e)for(var t=Object.keys(e),r=0;r>>3){case 1:n.savedModelSchemaVersion=e.int64();break;case 2:n.metaGraphs&&n.metaGraphs.length||(n.metaGraphs=[]),n.metaGraphs.push($root.tensorflow.MetaGraphDef.decode(e,e.uint32()));break;default:e.skipType(7&a)}}return n},e}(),e.FunctionDefLibrary=function(){function e(e){if(this.function=[],this.gradient=[],e)for(var t=Object.keys(e),r=0;r>>3){case 1:n.function&&n.function.length||(n.function=[]),n.function.push($root.tensorflow.FunctionDef.decode(e,e.uint32()));break;case 2:n.gradient&&n.gradient.length||(n.gradient=[]),n.gradient.push($root.tensorflow.GradientDef.decode(e,e.uint32()));break;default:e.skipType(7&a)}}return n},e}(),e.FunctionDef=function(){function e(e){if(this.attr={},this.nodeDef=[],this.ret={},e)for(var t=Object.keys(e),r=0;r>>3){case 1:a.signature=$root.tensorflow.OpDef.decode(e,e.uint32());break;case 5:e.skip().pos++,a.attr===$util.emptyObject&&(a.attr={}),r=e.string(),e.pos++,a.attr[r]=$root.tensorflow.AttrValue.decode(e,e.uint32());break;case 3:a.nodeDef&&a.nodeDef.length||(a.nodeDef=[]),a.nodeDef.push($root.tensorflow.NodeDef.decode(e,e.uint32()));break;case 4:e.skip().pos++,a.ret===$util.emptyObject&&(a.ret={}),r=e.string(),e.pos++,a.ret[r]=e.string();break;default:e.skipType(7&o)}}return a},e}(),e.GradientDef=function(){function e(e){if(e)for(var t=Object.keys(e),r=0;r>>3){case 1:n.functionName=e.string();break;case 2:n.gradientFunc=e.string();break;default:e.skipType(7&a)}}return n},e}(),e}();function getParamValue(e,t,r,n){var a=t.params[e];if(a&&void 0!==a.inputIndex){if("tensor"===a.type)return getTensor(t.inputNames[a.inputIndex],r,n);if("tensors"===a.type)return(0===a.inputIndex?0===a.inputParamLength?t.inputNames:t.inputNames.slice(a.inputIndex,-a.inputParamLength):t.inputNames.splice(a.inputIndex)).map(function(e){return getTensor(e,r,n)});var o=Array.prototype.slice.call(getTensor(t.inputNames.slice(a.inputIndex)[0],r,n).dataSync());return"number"===a.type?o[0]:o}return a&&a.value}function getTensor(e,t,r){var n=parseNodeName(e),a=n[0],o=n[1],i=r.currentContextIds.find(function(e){return!!t[getNodeNameWithContextId(a,e)]});return void 0!==i?t[getNodeNameWithContextId(a,i)][o]:void 0}function getNodeNameAndIndex(e,t){var r=parseNodeName(e),n=r[0],a=r[1];return[getNodeNameWithContextId(n,t&&t.currentContextId),a]}function getNodeNameWithContextId(e,t){return t?e+"-"+t:e}function parseNodeName(e){var t=e.lastIndexOf(":");return-1===t?[e,0]:[e.substring(0,t),Number(e.substring(t+1))]}function split$1(e,t){for(var r=[],n=0;n0&&a[a.length-1])&&(6===o[0]||2===o[0])){i=0;continue}if(3===o[0]&&(!a||o[1]>a[0]&&o[1]1))throw new Error("Cannot exit frame, the context is empty");this.contexts=this.contexts.slice(),this.contexts.splice(-1),this.currentContextIds.shift()},e.prototype.nextIteration=function(){if(!(this.contexts&&this.contexts.length>0))throw new Error("Cannot increase frame iteration, the context is empty");this.contexts=this.contexts.slice(),this.lastId++;var 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))},e.prototype.getWeight=function(e){return this.weightMap[e]},e}(),__assign$1=Object.assign||function(e){for(var t,r=1,n=arguments.length;r0&&a[a.length-1])&&(6===o[0]||2===o[0])){i=0;continue}if(3===o[0]&&(!a||o[1]>a[0]&&o[1]0;){var r=e.pop();t[r.name]=!0,this.compiledOrder.push(r),r.children.forEach(function(r){!t[r.name]&&r.inputNames.every(function(e){var r=getNodeNameAndIndex(e)[0];return t[r]})&&e.push(r)})}},e.prototype.execute=function(e,t){var r=this;return this.checkInput(e),this.checkInputShapeAndType(e),tidy(function(){var n=new ExecutionContext(r._weightMap),a=r.compiledOrder.reduce(function(e,t){return e[t.name]=executeOp$13(t,e,n),e},__assign$1({},r.weightMap,e));return r.findOutputs(a,n,t)})},e.prototype.executeAsync=function(e,t){return __awaiter$3(this,void 0,void 0,function(){var r,n,a,o,i,s,u=this;return __generator$3(this,function(l){switch(l.label){case 0:return this.checkInput(e),this.checkInputShapeAndType(e),r=new ExecutionContext(this._weightMap),[4,this.executeWithControlFlow(e,r)];case 1:return n=l.sent(),a=this.findOutputs(n,r,t),o=Object.keys(a).map(function(e){return a[e].id}),i=Object.keys(e).map(function(t){return e[t].map(function(e){return e.id})}),s=[].concat.apply([],i),Object.keys(n).forEach(function(e){n[e].forEach(function(e){e&&-1===o.indexOf(e.id)&&-1===s.indexOf(e.id)&&-1===u.weightIds.indexOf(e.id)&&e.dispose()})}),[2,a]}})})},e.prototype.executeWithControlFlow=function(e,t){return __awaiter$3(this,void 0,void 0,function(){var r,n,a,o,i,s,u,l;return __generator$3(this,function(c){switch(c.label){case 0:r=this.graph.inputs.map(function(e){return{node:e,contexts:t.currentContext}}),n=__assign$1({},this.weightMap,e),a={},c.label=1;case 1:return r.length>0?(o=r.pop(),t.currentContext=o.contexts,i=executeOp$13(o.node,n,t),s=getNodeNameAndIndex(o.node.name,t)[0],u=n,l=s,[4,i]):[3,3];case 2:return u[l]=c.sent(),o.node.children.forEach(function(e){var o=getNodeNameAndIndex(e.name,t)[0];a[o]||("merge"===e.op?e.inputNames.some(function(e){return!!getTensor(e,n,t)})&&(a[o]=!0,r.push({contexts:t.currentContext,node:e})):e.inputNames.every(function(e){return!!getTensor(e,n,t)})&&(a[o]=!0,r.push({contexts:t.currentContext,node:e})))}),[3,1];case 3:return[2,n]}})})},e.prototype.findOutputs=function(e,t,r){return!r||r instanceof Array||(r=[r]),(r||this.graph.outputs.map(function(e){return e.name})).reduce(function(r,n){return r[n]=getTensor(n,e,t),r},{})},e.prototype.dispose=function(){var e=this;Object.keys(this.weightMap).forEach(function(t){return e.weightMap[t].forEach(function(e){return e.dispose()})})},e.prototype.checkInputShapeAndType=function(e){this.placeholders.forEach(function(t){var r=e[t.name][0];if(t.params.shape&&t.params.shape.value){var n=t.params.shape.value,a=n.length===r.shape.length&&r.shape.every(function(e,t){return-1===n[t]||n[t]===e});util.assert(a,"The shape of dict['"+t.name+"'] provided in model.execute(dict) must be ["+n+"], but was ["+r.shape+"]")}t.params.dtype&&t.params.dtype.value&&util.assert(r.dtype===t.params.dtype.value,"The dtype of dict['"+t.name+"'] provided in model.execute(dict) must be "+t.params.dtype.value+", but was "+r.dtype)})},e.prototype.checkInput=function(e){var t=this,r=Object.keys(e),n=[],a=[];if(this.inputNodes.forEach(function(e){-1===r.indexOf(e)&&n.push(e)}),r.forEach(function(e){-1===t.inputNodes.indexOf(e)&&a.push(e)}),n.length>0)throw new Error("The dict provided in model.execute(dict) has the keys ["+r+"], but is missing the required keys: ["+n+"].");if(a.length>0)throw new Error("The dict provided in model.execute(dict) has unused keys: ["+a+"]. Please provide only the following keys: ["+this.inputNodes+"].")},e}(),__awaiter$4=function(e,t,r,n){return new(r||(r=Promise))(function(a,o){function i(e){try{u(n.next(e))}catch(e){o(e)}}function s(e){try{u(n.throw(e))}catch(e){o(e)}}function u(e){e.done?a(e.value):new r(function(t){t(e.value)}).then(i,s)}u((n=n.apply(e,t||[])).next())})},__generator$4=function(e,t){var r,n,a,o,i={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(r)throw new TypeError("Generator is already executing.");for(;i;)try{if(r=1,n&&(a=n[2&o[0]?"return":o[0]?"throw":"next"])&&!(a=a.call(n,o[1])).done)return a;switch(n=0,a&&(o=[0,a.value]),o[0]){case 0:case 1:a=o;break;case 4:return i.label++,{value:o[1],done:!1};case 5:i.label++,n=o[1],o=[0];continue;case 7:o=i.ops.pop(),i.trys.pop();continue;default:if(!(a=(a=i.trys).length>0&&a[a.length-1])&&(6===o[0]||2===o[0])){i=0;continue}if(3===o[0]&&(!a||o[1]>a[0]&&o[1]1?t.map(function(e){return r[e]}):r[n[0]]},e.prototype.executeAsync=function(e,t){return __awaiter$4(this,void 0,void 0,function(){var r,n;return __generator$4(this,function(a){switch(a.label){case 0:if(!this.executor.isControlFlowModel)throw new Error("The model does not contain control flow ops, please use execute method for better performance.");return t=t||this.outputNodes,(e instanceof Tensor||Array.isArray(e))&&(e=this.constructTensorMap(e)),[4,this.executor.executeAsync(this.convertTensorMapToTensorsMap(e),t)];case 1:return r=a.sent(),n=Object.keys(r),[2,Array.isArray(t)&&t.length>1?t.map(function(e){return r[e]}):r[n[0]]]}})})},e.prototype.convertTensorMapToTensorsMap=function(e){return Object.keys(e).reduce(function(t,r){return t[r]=[e[r]],t},{})},e.prototype.dispose=function(){this.executor.dispose()},e}();function loadFrozenModel(e,t,r){return __awaiter$4(this,void 0,void 0,function(){var n;return __generator$4(this,function(a){switch(a.label){case 0:return[4,(n=new FrozenModel(e,t,r)).load()];case 1:return a.sent(),[2,n]}})})}var version$2="0.5.0",version$3="0.12.0",version$4={"tfjs-core":version,"tfjs-layers":version$1,"tfjs-converter":version$2,tfjs:version$3};exports.version=version$4,exports.setBackend=setBackend,exports.getBackend=getBackend,exports.disposeVariables=disposeVariables,exports.memory=memory,exports.version_core=version,exports.nextFrame=nextFrame,exports.environment=environment,exports.io=io,exports.serialization=serialization,exports.test_util=test_util,exports.util=util,exports.webgl=webgl,exports.AdadeltaOptimizer=AdadeltaOptimizer,exports.AdagradOptimizer=AdagradOptimizer,exports.AdamOptimizer=AdamOptimizer,exports.AdamaxOptimizer=AdamaxOptimizer,exports.MomentumOptimizer=MomentumOptimizer,exports.Optimizer=Optimizer,exports.RMSPropOptimizer=RMSPropOptimizer,exports.SGDOptimizer=SGDOptimizer,exports.Tensor=Tensor,exports.TensorBuffer=TensorBuffer,exports.variable=variable,exports.Variable=Variable,exports.ENV=ENV,exports.Environment=Environment,exports.doc=doc,exports.batchNormalization=batchNormalization,exports.batchNormalization2d=batchNormalization2d,exports.batchNormalization3d=batchNormalization3d,exports.batchNormalization4d=batchNormalization4d,exports.concat=concat,exports.concat1d=concat1d,exports.concat2d=concat2d,exports.concat3d=concat3d,exports.concat4d=concat4d,exports.conv1d=conv1d,exports.conv2d=conv2d,exports.conv2dTranspose=conv2dTranspose,exports.depthwiseConv2d=depthwiseConv2d,exports.separableConv2d=separableConv2d,exports.matMul=matMul,exports.matrixTimesVector=matrixTimesVector,exports.outerProduct=outerProduct,exports.vectorTimesMatrix=vectorTimesMatrix,exports.dot=dot,exports.avgPool=avgPool,exports.maxPool=maxPool,exports.transpose=transpose,exports.reverse=reverse,exports.reverse1d=reverse1d,exports.reverse2d=reverse2d,exports.reverse3d=reverse3d,exports.reverse4d=reverse4d,exports.slice=slice,exports.slice1d=slice1d,exports.slice2d=slice2d,exports.slice3d=slice3d,exports.slice4d=slice4d,exports.stridedSlice=stridedSlice,exports.argMax=argMax,exports.argMin=argMin,exports.logSumExp=logSumExp,exports.max=max,exports.mean=mean,exports.min=min,exports.all=all,exports.any=any,exports.moments=moments,exports.sum=sum,exports.equal=equal,exports.equalStrict=equalStrict,exports.greater=greater,exports.greaterStrict=greaterStrict,exports.greaterEqual=greaterEqual,exports.greaterEqualStrict=greaterEqualStrict,exports.less=less,exports.lessStrict=lessStrict,exports.lessEqual=lessEqual,exports.lessEqualStrict=lessEqualStrict,exports.notEqual=notEqual,exports.notEqualStrict=notEqualStrict,exports.logicalNot=logicalNot,exports.logicalAnd=logicalAnd,exports.logicalOr=logicalOr,exports.logicalXor=logicalXor,exports.where=where,exports.abs=abs,exports.acos=acos,exports.acosh=acosh,exports.asin=asin,exports.asinh=asinh,exports.atan=atan,exports.atanh=atanh,exports.ceil=ceil,exports.clipByValue=clipByValue,exports.cos=cos,exports.cosh=cosh,exports.elu=elu,exports.exp=exp,exports.expm1=expm1,exports.floor=floor,exports.sign=sign,exports.leakyRelu=leakyRelu,exports.log=log,exports.log1p=log1p,exports.logSigmoid=logSigmoid,exports.neg=neg,exports.prelu=prelu,exports.relu=relu,exports.reciprocal=reciprocal,exports.round=round,exports.selu=selu,exports.sigmoid=sigmoid,exports.sin=sin,exports.sinh=sinh,exports.softplus=softplus,exports.sqrt=sqrt,exports.rsqrt=rsqrt,exports.square=square,exports.step=step,exports.tan=tan,exports.tanh=tanh$1,exports.erf=erf,exports.add=add,exports.addStrict=addStrict,exports.atan2=atan2,exports.div=div,exports.floorDiv=floorDiv,exports.divStrict=divStrict,exports.maximum=maximum,exports.maximumStrict=maximumStrict,exports.minimum=minimum,exports.minimumStrict=minimumStrict,exports.mod=mod,exports.modStrict=modStrict,exports.mul=mul,exports.mulStrict=mulStrict,exports.pow=pow,exports.powStrict=powStrict,exports.sub=sub,exports.subStrict=subStrict,exports.squaredDifference=squaredDifference,exports.squaredDifferenceStrict=squaredDifferenceStrict,exports.norm=norm,exports.cast=cast,exports.clone=clone,exports.fromPixels=fromPixels,exports.toPixels=toPixels,exports.ones=ones,exports.onesLike=onesLike,exports.zeros=zeros,exports.zerosLike=zerosLike,exports.eye=eye,exports.rand=rand,exports.randomNormal=randomNormal,exports.truncatedNormal=truncatedNormal,exports.randomUniform=randomUniform,exports.multinomial=multinomial,exports.reshape=reshape,exports.squeeze=squeeze,exports.tile=tile,exports.gather=gather,exports.oneHot=oneHot,exports.linspace=linspace,exports.range=range,exports.buffer=buffer,exports.fill=fill,exports.tensor=tensor,exports.scalar=scalar,exports.tensor1d=tensor1d,exports.tensor2d=tensor2d,exports.tensor3d=tensor3d,exports.tensor4d=tensor4d,exports.tensor5d=tensor5d,exports.tensor6d=tensor6d,exports.print=print,exports.expandDims=expandDims,exports.stack=stack,exports.unstack=unstack,exports.split=split,exports.cumsum=cumsum,exports.pad=pad,exports.pad1d=pad1d,exports.pad2d=pad2d,exports.pad3d=pad3d,exports.pad4d=pad4d,exports.unsortedSegmentSum=unsortedSegmentSum,exports.movingAverage=movingAverage,exports.basicLSTMCell=basicLSTMCell,exports.multiRNNCell=multiRNNCell,exports.softmax=softmax,exports.sigmoidCrossEntropyWithLogits=sigmoidCrossEntropyWithLogits,exports.localResponseNormalization=localResponseNormalization,exports.linalg=linalg,exports.losses=losses,exports.image=image,exports.operation=operation,exports.train=train,exports.tidy=tidy,exports.keep=keep,exports.dispose=dispose,exports.time=time,exports.grad=grad,exports.valueAndGrad=valueAndGrad,exports.grads=grads,exports.valueAndGrads=valueAndGrads,exports.variableGrads=variableGrads,exports.customGrad=customGrad,exports.model=model,exports.sequential=sequential,exports.loadModel=loadModel,exports.input=input,exports.layers=layers,exports.constraints=constraints,exports.initializers=initializers,exports.metrics=metrics,exports.regularizers=regularizers,exports.CallbackList=CallbackList,exports.CustomCallback=CustomCallback,exports.Callback=Callback,exports.SymbolicTensor=SymbolicTensor,exports.Model=Model,exports.RNN=RNN,exports.Sequential=Sequential,exports.version_layers=version$1,exports.FrozenModel=FrozenModel,exports.loadFrozenModel=loadFrozenModel,exports.version_converter=version$2,Object.defineProperty(exports,"__esModule",{value:!0})}); \ No newline at end of file diff --git a/local_modules/@ocogeclub/bme280/BME280.js b/local_modules/@ocogeclub/bme280/BME280.js index d74820b..47a3b2c 100644 --- a/local_modules/@ocogeclub/bme280/BME280.js +++ b/local_modules/@ocogeclub/bme280/BME280.js @@ -1,5 +1,6 @@ 'use strict'; +this.pig = null; this.pi = null; this.i2cBusNo = null; @@ -41,16 +42,24 @@ this.REGISTER_TEMP_DATA = 0xFA; this.REGISTER_HUMIDITY_DATA = 0xFD; exports.init = (options) => { - this.pi = require('@ocogeclub/lgpio'); + this.pig = require('@ocogeclub/pigpio') + // console.log('pig= ' + this.pig) + this.pi = this.pig._pigpio_start('', ''); + // console.log('pi= ' + this.pi) + // this.pi = require('@ocogeclub/lgpio'); this.i2cBusNo = (options && options.hasOwnProperty('i2cBusNo')) ? options.i2cBusNo : 1; this.i2cAddress = (options && options.hasOwnProperty('i2cAddress')) ? options.i2cAddress : this.BME280_DEFAULT_I2C_ADDRESS(); - this.i2cHand = this.pi._i2c_open(this.i2cBusNo, this.i2cAddress); + this.i2cHand = this.pig._i2c_open(this.pi, this.i2cBusNo, this.i2cAddress); + // console.log('i2cHand= ' + this.i2cHand) + // this.i2cHand = this.pi._i2c_open(this.i2cBusNo, this.i2cAddress); let r; - r = this.pi._i2c_write_byte_data(this.i2cHand, this.REGISTER_CHIPID, 0); + r = this.pig._i2c_write_byte_data(this.pi, this.i2cHand, this.REGISTER_CHIPID, 0); + // r = this.pi._i2c_write_byte_data(this.i2cHand, this.REGISTER_CHIPID, 0); if (r < 0) return r; - let chipId = this.pi._i2c_read_byte_data(this.i2cHand, this.REGISTER_CHIPID); + let chipId = this.pig._i2c_read_byte_data(this.pi, this.i2cHand, this.REGISTER_CHIPID); + // let chipId = this.pi._i2c_read_byte_data(this.i2cHand, this.REGISTER_CHIPID); if (chipId !== this.CHIP_ID_BME280() && chipId !== this.CHIP_ID1_BMP280() && chipId !== this.CHIP_ID2_BMP280() && @@ -64,11 +73,13 @@ exports.init = (options) => { } // Humidity 16x oversampling // - let r = this.pi._i2c_write_byte_data(this.i2cHand, this.REGISTER_CONTROL_HUM, 0b00000101); + let r = this.pig._i2c_write_byte_data(this.pi, this.i2cHand, this.REGISTER_CONTROL_HUM, 0b00000101); + // let r = this.pi._i2c_write_byte_data(this.i2cHand, this.REGISTER_CONTROL_HUM, 0b00000101); if (r < 0) return `Humidity 16x oversampling error: ${r}`; // Temperture/pressure 16x oversampling, normal mode // - r = this.pi._i2c_write_byte_data(this.i2cHand, this.REGISTER_CONTROL, 0b10110111); + r = this.pig._i2c_write_byte_data(this.pi, this.i2cHand, this.REGISTER_CONTROL, 0b10110111); + // r = this.pi._i2c_write_byte_data(this.i2cHand, this.REGISTER_CONTROL, 0b10110111); if (r < 0) return `Temperture/pressure 16x oversampling error: ${r}`; return 0; @@ -81,7 +92,8 @@ exports.init = (options) => { // exports.reset = () => { const POWER_ON_RESET_CMD = 0xB6; - let r = this.pi._i2c_write_byte_data(this.i2cHand, this.REGISTER_RESET, POWER_ON_RESET_CMD); + let r = this.pig._i2c_write_byte_data(this.pi, this.i2cHand, this.REGISTER_RESET, POWER_ON_RESET_CMD); + // let r = this.pi._i2c_write_byte_data(this.i2cHand, this.REGISTER_RESET, POWER_ON_RESET_CMD); if (r < 0) return `cannot power-on reset: ${r}`; else return 0; } @@ -92,8 +104,11 @@ exports.reset = () => { // exports.cancel = () => { if (this.i2cHand >= 0) { - this.pi._i2c_close(this.i2cHand); - this.i2cHand = 0; + this.pig._i2c_close(this.pi, this.i2cHand); + // this.pi._i2c_close(this.i2cHand); + this.i2cHand = null; + this.pig._pigpio_stop(this.pi); + this.pi = null; } } @@ -104,7 +119,8 @@ exports.readSensorData = () => { // Grab temperature, humidity, and pressure in a single read // - let buffer = this.pi._i2c_read_i2c_block_data(this.i2cHand, this.REGISTER_PRESSURE_DATA, 8); + let buffer = this.pig._i2c_read_i2c_block_data(this.pi, this.i2cHand, this.REGISTER_PRESSURE_DATA, 8); + // let buffer = this.pi._i2c_read_i2c_block_data(this.i2cHand, this.REGISTER_PRESSURE_DATA, 8); if (!buffer) return `couldn't grab data`; // Temperature (temperature first since we need t_fine for pressure and humidity) // @@ -156,16 +172,24 @@ exports.readSensorData = () => { } exports.loadCalibration = (callback) => { - let buffer = this.pi._i2c_read_i2c_block_data(this.i2cHand, this.REGISTER_DIG_T1, 24); + let buffer = this.pig._i2c_read_i2c_block_data(this.pi, this.i2cHand, this.REGISTER_DIG_T1, 24); + // let buffer = this.pi._i2c_read_i2c_block_data(this.i2cHand, this.REGISTER_DIG_T1, 24); // for (let i = 0; i < 24; i++) console.log(parseInt(buffer[i], 16)); if (buffer) { - let h1 = this.pi._i2c_read_byte_data(this.i2cHand, this.REGISTER_DIG_H1); - let h2 = this.pi._i2c_read_word_data(this.i2cHand, this.REGISTER_DIG_H2); - let h3 = this.pi._i2c_read_byte_data(this.i2cHand, this.REGISTER_DIG_H3); - let h4 = this.pi._i2c_read_byte_data(this.i2cHand, this.REGISTER_DIG_H4); - let h5 = this.pi._i2c_read_byte_data(this.i2cHand, this.REGISTER_DIG_H5); - let h5_1 = this.pi._i2c_read_byte_data(this.i2cHand, this.REGISTER_DIG_H5 + 1); - let h6 = this.pi._i2c_read_byte_data(this.i2cHand, this.REGISTER_DIG_H6); + let h1 = this.pig._i2c_read_byte_data(this.pi, this.i2cHand, this.REGISTER_DIG_H1); + let h2 = this.pig._i2c_read_word_data(this.pi, this.i2cHand, this.REGISTER_DIG_H2); + let h3 = this.pig._i2c_read_byte_data(this.pi, this.i2cHand, this.REGISTER_DIG_H3); + let h4 = this.pig._i2c_read_byte_data(this.pi, this.i2cHand, this.REGISTER_DIG_H4); + let h5 = this.pig._i2c_read_byte_data(this.pi, this.i2cHand, this.REGISTER_DIG_H5); + let h5_1 = this.pig._i2c_read_byte_data(this.pi, this.i2cHand, this.REGISTER_DIG_H5 + 1); + let h6 = this.pig._i2c_read_byte_data(this.pi, this.i2cHand, this.REGISTER_DIG_H6); + // let h1 = this.pi._i2c_read_byte_data(this.i2cHand, this.REGISTER_DIG_H1); + // let h2 = this.pi._i2c_read_word_data(this.i2cHand, this.REGISTER_DIG_H2); + // let h3 = this.pi._i2c_read_byte_data(this.i2cHand, this.REGISTER_DIG_H3); + // let h4 = this.pi._i2c_read_byte_data(this.i2cHand, this.REGISTER_DIG_H4); + // let h5 = this.pi._i2c_read_byte_data(this.i2cHand, this.REGISTER_DIG_H5); + // let h5_1 = this.pi._i2c_read_byte_data(this.i2cHand, this.REGISTER_DIG_H5 + 1); + // let h6 = this.pi._i2c_read_byte_data(this.i2cHand, this.REGISTER_DIG_H6); this.cal = { dig_T1: this.uint16(buffer[1], buffer[0]), diff --git a/local_modules/@ocogeclub/bme280/package.json b/local_modules/@ocogeclub/bme280/package.json index 879165b..b3780a4 100644 --- a/local_modules/@ocogeclub/bme280/package.json +++ b/local_modules/@ocogeclub/bme280/package.json @@ -5,6 +5,6 @@ "private": true, "license": "MIT", "dependencies": { - "@ocogeclub/lgpio": "file:../lgpio" + "@ocogeclub/pigpio": "file:../pigpio" } } \ No newline at end of file diff --git a/local_modules/@ocogeclub/pigpio/index.js b/local_modules/@ocogeclub/pigpio/index.js index d6732a9..0cae564 100644 --- a/local_modules/@ocogeclub/pigpio/index.js +++ b/local_modules/@ocogeclub/pigpio/index.js @@ -78,6 +78,9 @@ module.exports.i2c_write_byte_data = (reg, byte_val) => { module.exports.i2c_read_byte_data = reg => { if (i2c_hand >= 0) return module.exports._i2c_read_byte_data(pi, i2c_hand, reg); } +module.exports.i2c_write_i2c_block_data = (reg, data) => { + if (i2c_hand >= 0) return module.exports._i2c_write_i2c_block_data(pi, i2c_hand, reg, Buffer.from(data)); +} module.exports.i2c_read_device = count => { if (i2c_hand >= 0) return module.exports._i2c_read_device(pi, i2c_hand, count).toString('utf8'); } diff --git a/local_modules/@ocogeclub/pigpio/pigpio.cpp b/local_modules/@ocogeclub/pigpio/pigpio.cpp index 83beac9..4ac9ea7 100644 --- a/local_modules/@ocogeclub/pigpio/pigpio.cpp +++ b/local_modules/@ocogeclub/pigpio/pigpio.cpp @@ -25,7 +25,8 @@ Value _pigpioStart(const CallbackInfo &info) } std::string addrStr = info[0].As().Utf8Value(); std::string portStr = info[1].As().Utf8Value(); - return Number::New(env, pigpio_start(&addrStr[0], &portStr[0])); + return Number::New(env, pigpio_start(addrStr.c_str(), portStr.c_str())); + // return Number::New(env, pigpio_start(&addrStr[0], &portStr[0])); } // pigpio 後始末 @@ -389,7 +390,7 @@ Value _i2cClose(const CallbackInfo &info) return env.Null(); } int pi = info[0].As().Int32Value(); - unsigned int handle = info[0].As().Uint32Value(); + unsigned int handle = info[1].As().Uint32Value(); return Number::New(env, i2c_close(pi, handle)); @@ -455,9 +456,9 @@ Value _i2cWriteByteData(const CallbackInfo &info) return env.Null(); } int pi = info[0].As().Int32Value(); - unsigned int handle = info[0].As().Uint32Value(); - unsigned int i2c_reg = info[1].As().Uint32Value(); - unsigned int bVal = info[2].As().Uint32Value(); + unsigned int handle = info[1].As().Uint32Value(); + unsigned int i2c_reg = info[2].As().Uint32Value(); + unsigned int bVal = info[3].As().Uint32Value(); return Number::New(env, i2c_write_byte_data(pi, handle, i2c_reg, bVal)); @@ -486,6 +487,32 @@ Value _i2cReadByteData(const CallbackInfo &info) i2c_read_byte_data(pi, handle, i2c_reg)); } +// I2Cハンドルに関連付けられているデバイスの指定されたレジスタに最大32バイトのデータを書き込む。 +Value _i2cWriteI2cBlockData(const CallbackInfo &info) +{ + Env env = info.Env(); + if (info.Length() < 4) + { + TypeError::New(env, "Wrong number of arguments") + .ThrowAsJavaScriptException(); + return env.Null(); + } + if (!info[0].IsNumber() || !info[1].IsNumber() || !info[2].IsNumber() || !info[3].IsBuffer()) + { + TypeError::New(env, "Wrong arguments").ThrowAsJavaScriptException(); + return env.Null(); + } + int pi = info[0].As().Int32Value(); + unsigned int handle = info[1].As().Uint32Value(); + unsigned int i2c_reg = info[2].As().Uint32Value(); + auto buf = info[3].As>(); + + unsigned int count = buf.Length(); + + return Number::New(env, + i2c_write_i2c_block_data(pi, handle, i2c_reg, buf.Data(), count)); +} + // I2Cハンドルに関連付けられているデバイスの指定されたレジスタからcountバイトを読み込む。countは1~32。 Value _i2cReadI2cBlockData(const CallbackInfo &info) { @@ -612,6 +639,7 @@ Init(Env env, Object exports) exports.Set(String::New(env, "_i2c_read_byte"), Function::New(env, _i2cReadByte)); exports.Set(String::New(env, "_i2c_write_byte_data"), Function::New(env, _i2cWriteByteData)); exports.Set(String::New(env, "_i2c_read_byte_data"), Function::New(env, _i2cReadByteData)); + exports.Set(String::New(env, "_i2c_write_i2c_block_data"), Function::New(env, _i2cWriteI2cBlockData)); exports.Set(String::New(env, "_i2c_read_i2c_block_data"), Function::New(env, _i2cReadI2cBlockData)); exports.Set(String::New(env, "_i2c_read_word_data"), Function::New(env, _i2cReadWordData)); exports.Set(String::New(env, "_i2c_write_device"), Function::New(env, _i2cWriteDevice)); diff --git a/main.js b/main.js index b6d9ba7..c7427f0 100644 --- a/main.js +++ b/main.js @@ -124,7 +124,32 @@ app.whenReady().then(() => { accelerator: "CommandOrControl+Q" } ] - } + }, + { + label: "Settings", + submenu: [ + { + label: "i2c bus", + submenu: [ + { + label: "1", + click: (item, focusedWindow) => { + if (focusedWindow) + focusedWindow.webContents.executeJavaScript('elutil.setI2cbusNo("1")'); + } + }, + { + label: "6", + click: (item, focusedWindow) => { + if (focusedWindow) + focusedWindow.webContents.executeJavaScript('elutil.setI2cbusNo("6")'); + } + }, + + ] + } + ] + }, ] const menu = Menu.buildFromTemplate(template) Menu.setApplicationMenu(menu) diff --git a/package.json b/package.json index 217f857..6c226b2 100644 --- a/package.json +++ b/package.json @@ -30,4 +30,4 @@ "axios": "^0.21.1", "nodemailer": "^6.6.0" } -} \ No newline at end of file +} diff --git a/ugj_blocks.js b/ugj_blocks.js index 978f80e..bb4a238 100644 --- a/ugj_blocks.js +++ b/ugj_blocks.js @@ -399,16 +399,16 @@ var ugjGpioSetInputDefinition = { "name": "lflag", "options": [ [ - "プルアップ", - "pi.SET_PULL_UP" + "%{BKY_GPIO_SET_INPUT_PULLUP}", + "pi.PULL_UP" ], [ - "プルダウン", - "pi.SET_PULL_DOWN" + "%{BKY_GPIO_SET_INPUT_PULLDOWN}", + "pi.PULL_DOWN" ], [ - "プル無し", - "pi.SET_PULL_NONE" + "%{BKY_GPIO_SET_INPUT_PULLNONE}", + "pi.PULL_NONE" ] ] } @@ -664,7 +664,7 @@ Blockly.JavaScript['ugj_serial_open'] = function (block) { // var value_tty = Blockly.JavaScript.valueToCode(block, 'tty', Blockly.JavaScript.ORDER_ATOMIC); var dropdown_baud = block.getFieldValue('baud'); Blockly.JavaScript.provideFunction_( - 'require_oclg', [`const pi = require('@ocogeclub/lgpio');`] + 'require_gpio', [`const pi = require('@ocogeclub/` + elutil.gpio_backend + `');`] ); var code = `pi.serial_open('/dev/serial0', ${dropdown_baud});\n`; return code; @@ -804,9 +804,9 @@ Blockly.Blocks['ugj_i2c_open'] = { Blockly.JavaScript['ugj_i2c_open'] = function (block) { var value_i2c_address = Blockly.JavaScript.valueToCode(block, 'i2c_address', Blockly.JavaScript.ORDER_ATOMIC); Blockly.JavaScript.provideFunction_( - 'require_oclg', [`const pi = require('@ocogeclub/lgpio');`] + 'require_gpio', [`const pi = require('@ocogeclub/` + elutil.gpio_backend + `');`] ); - var code = `pi.i2c_open(3, ${value_i2c_address});\n`; + var code = `pi.i2c_open(${elutil.i2c_bus}, ${value_i2c_address});\n`; return code; }; Blockly.Python['ugj_i2c_open'] = function (block) { @@ -922,6 +922,47 @@ Blockly.Python['ugj_i2c_read_byte_data'] = function (block) { return [code, Blockly.Python.ORDER_ATOMIC]; }; +var ugjI2cWriteI2cBlockDataDefinition = { + "type": "ugj_i2c_write_i2c_block_data", + "message0": "%{BKY_I2C_WRITE_I2C_BLOCK_DATA_TITLE}", + "args0": [ + { + "type": "input_value", + "name": "reg", + "check": "Number" + }, + { + "type": "input_value", + "name": "data", + "check": "String" + } + ], + "inputsInline": true, + "previousStatement": null, + "nextStatement": null, + "tooltip": "%{BKY_I2C_WRITE_I2C_BLOCK_DATA_TOOLTIP}", + "helpUrl": "", + "style": "gpio_blocks" +}; +Blockly.Blocks['ugj_i2c_write_i2c_block_data'] = { + init: function () { + this.jsonInit(ugjI2cWriteI2cBlockDataDefinition); + } +}; +Blockly.JavaScript['ugj_i2c_write_i2c_block_data'] = function (block) { + var value_reg = Blockly.JavaScript.valueToCode(block, 'reg', Blockly.JavaScript.ORDER_ATOMIC); + var value_data = Blockly.JavaScript.valueToCode(block, 'data', Blockly.JavaScript.ORDER_ATOMIC); + var code = `pi.i2c_write_i2c_block_data (${value_reg}, ${value_data});`; + return code; +}; +Blockly.Python['ugj_i2c_write_i2c_block_data'] = function (block) { + var value_reg = Blockly.Python.valueToCode(block, 'reg', Blockly.Python.ORDER_ATOMIC); + var value_name = Blockly.Python.valueToCode(block, 'NAME', Blockly.Python.ORDER_ATOMIC); + // TODO: Assemble Python into code variable. + var code = '...\n'; + return code; +}; + /************************************************************************** */ /** Returns count bytes read from the raw device associated with handle. ** */ /************************************************************************** */ @@ -1043,7 +1084,7 @@ Blockly.JavaScript['ugj_bme280'] = function (block) { ); var code = [ `const options = {`, - ` i2cBusNo: 3,`, + ` i2cBusNo: ${elutil.i2c_bus},`, ` i2cAddress: ${value_address}`, `};`, `bme280.init(options);`, diff --git a/yarn.lock b/yarn.lock index a7400d3..dc02024 100644 --- a/yarn.lock +++ b/yarn.lock @@ -64,13 +64,7 @@ "@ocogeclub/bme280@file:local_modules/@ocogeclub/bme280": version "0.0.1" dependencies: - "@ocogeclub/lgpio" "file:../../.cache/yarn/v6/npm-@ocogeclub-bme280-0.0.1-a3a7781d-d04c-4890-9c31-c037b0309492-1633696738699/node_modules/@ocogeclub/lgpio" - -"@ocogeclub/lgpio@file:local_modules/@ocogeclub/lgpio": - version "0.0.1" - dependencies: - bindings "^1.5.0" - node-addon-api "^1.7.1" + "@ocogeclub/pigpio" "file:../../.cache/yarn/v6/npm-@ocogeclub-bme280-0.0.1-afe790ae-69ff-47f6-96b0-8796b0a559a8-1633832163228/node_modules/@ocogeclub/pigpio" "@ocogeclub/pigpio@file:local_modules/@ocogeclub/pigpio": version "0.0.1"