vendor: 4,272 bytes, line 1
1(self.webpackChunkappsheet_app=self.webpackChunkappsheet_app||[]).push([["vendors-node_modules_tensorflow_tfjs_dist_index_js"],{343720:e=>{e.exports=n;var t=null;try{t=new WebAssembly.Instance(new WebAssembly.Module(new Uint8Array([0,97,115,109,1,0,0,0,1,13,2,96,0,1,127,96,4,127,127,127,127,1,127,3,7,6,0,1,1,1,1,1,6,6,1,127,1,65,0,11,7,50,6,3,109,117,108,0,1,5,100,105,118,95,115,0,2,5,100,105,118,95,117,0,3,5,114,101,109,95,115,0,4,5,114,101,109,95,117,0,5,8,103,101,116,95,104,105,103,104,0,0,10,191,1,6,4,0,35,0,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,126,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,127,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,128,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,129,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,130,34,4,66,32,135,167,36,0,32,4,167,11])),{}).exports}catch(e){}function n(e,t,n){this.low=0|e,this.high=0|t,this.unsigned=!!n}function r(e){return!0===(e&&e.__isLong__)}n.prototype.__isLong__,Object.defineProperty(n.prototype,"__isLong__",{value:!0}),n.isLong=r;var a={},o={};function s(e,t){var n,r,s;return t?(s=0<=(e>>>=0)&&e<256)&&(r=o[e])?r:(n=c(e,(0|e)<0?-1:0,!0),s&&(o[e]=n),n):(s=-128<=(e|=0)&&e<128)&&(r=a[e])?r:(n=c(e,e<0?-1:0,!1),s&&(a[e]=n),n)}function i(e,t){if(isNaN(e))return t?y:g;if(t){if(e<0)return y;if(e>=h)return k}else{if(e<=-f)return _;if(e+1>=f)return w}return e<0?i(-e,t).neg():c(e%p|0,e/p|0,t)}function c(e,t,r){return new n(e,t,r)}n.fromInt=s,n.fromNumber=i,n.fromBits=c;var l=Math.pow;function u(e,t,n){if(0===e.length)throw Error("empty string");if("NaN"===e||"Infinity"===e||"+Infinity"===e||"-Infinity"===e)return g;if("number"==typeof t?(n=t,t=!1):t=!!t,(n=n||10)<2||36<n)throw RangeError("radix");var r;if((r=e.indexOf("-"))>0)throw Error("interior hyphen");if(0===r)return u(e.substring(1),t,n).neg();for(var a=i(l(n,8)),o=g,s=0;s<e.length;s+=8){var c=Math.min(8,e.length-s),d=parseInt(e.substring(s,s+c),n);if(c<8){var p=i(l(n,c));o=o.mul(p).add(i(d))}else o=(o=o.mul(a)).add(i(d))}return o.unsigned=t,o}function d(e,t){return"number"==typeof e?i(e,t):"string"==typeof e?u(e,t):c(e.low,e.high,"boolean"==typeof t?t:e.unsigned)}n.fromString=u,n.fromValue=d;var p=4294967296,h=p*p,f=h/2,m=s(1<<24),g=s(0);n.ZERO=g;var y=s(0,!0);n.UZERO=y;var v=s(1);n.ONE=v;var b=s(1,!0);n.UONE=b;var x=s(-1);n.NEG_ONE=x;var w=c(-1,2147483647,!1);n.MAX_VALUE=w;var k=c(-1,-1,!0);n.MAX_UNSIGNED_VALUE=k;var _=c(0,-2147483648,!1);n.MIN_VALUE=_;var C=n.prototype;C.toInt=function(){return this.unsigned?this.low>>>0:this.low},C.toNumber=function(){return this.unsigned?(this.high>>>0)*p+(this.low>>>0):this.high*p+(this.low>>>0)},C.toString=function(e){if((e=e||10)<2||36<e)throw RangeError("radix");if(this.isZero())return"0";if(this.isNegative()){if(this.eq(_)){var t=i(e),n=this.div(t),r=n.mul(t).sub(this);return n.toString(e)+r.toInt().toString(e)}return"-"+this.neg().toString(e)}for(var a=i(l(e,6),this.unsigned),o=this,s="";;){var c=o.div(a),u=(o.sub(c.mul(a)).toInt()>>>0).toString(e);if((o=c).isZero())return u+s;for(;u.length<6;)u="0"+u;s=""+u+s}},C.getHighBits=function(){return this.high},C.getHighBitsUnsigned=function(){return this.high>>>0},C.getLowBits=function(){return this.low},C.getLowBitsUnsigned=function(){return this.low>>>0},C.getNumBitsAbs=function(){if(this.isNegative())return this.eq(_)?64:this.neg().getNumBitsAbs();for(var e=0!=this.high?this.high:this.low,t=31;t>0&&!(e&1<<t);t--);return 0!=this.high?t+33:t+1},C.isZero=function(){return 0===this.high&&0===this.low},C.eqz=C.isZero,C.isNegative=function(){return!this.unsigned&&this.high<0},C.isPositive=function(){return this.unsigned||this.high>=0},C.isOdd=function(){return!(1&~this.low)},C.isEven=function(){return!(1&this.low)},C.equals=function(e){return r(e)||(e=d(e)),(this.unsigned===e.unsigned||this.high>>>31!=1||e.high>>>31!=1)&&(this.high===e.high&&this.low===e.low)},C.eq=C.equals,C.notEquals=function(e){return!this.eq(e)},C.neq=C.notEquals,C.ne=C.notEquals,C.lessThan=function(e){return this.comp(e)<0}
vendor: 4,860 bytes, line 1
1,C.lt=C.lessThan,C.lessThanOrEqual=function(e){return this.comp(e)<=0},C.lte=C.lessThanOrEqual,C.le=C.lessThanOrEqual,C.greaterThan=function(e){return this.comp(e)>0},C.gt=C.greaterThan,C.greaterThanOrEqual=function(e){return this.comp(e)>=0},C.gte=C.greaterThanOrEqual,C.ge=C.greaterThanOrEqual,C.compare=function(e){if(r(e)||(e=d(e)),this.eq(e))return 0;var t=this.isNegative(),n=e.isNegative();return t&&!n?-1:!t&&n?1:this.unsigned?e.high>>>0>this.high>>>0||e.high===this.high&&e.low>>>0>this.low>>>0?-1:1:this.sub(e).isNegative()?-1:1},C.comp=C.compare,C.negate=function(){return!this.unsigned&&this.eq(_)?_:this.not().add(v)},C.neg=C.negate,C.add=function(e){r(e)||(e=d(e));var t=this.high>>>16,n=65535&this.high,a=this.low>>>16,o=65535&this.low,s=e.high>>>16,i=65535&e.high,l=e.low>>>16,u=0,p=0,h=0,f=0;return h+=(f+=o+(65535&e.low))>>>16,p+=(h+=a+l)>>>16,u+=(p+=n+i)>>>16,u+=t+s,c((h&=65535)<<16|(f&=65535),(u&=65535)<<16|(p&=65535),this.unsigned)},C.subtract=function(e){return r(e)||(e=d(e)),this.add(e.neg())},C.sub=C.subtract,C.multiply=function(e){if(this.isZero())return g;if(r(e)||(e=d(e)),t)return c(t.mul(this.low,this.high,e.low,e.high),t.get_high(),this.unsigned);if(e.isZero())return g;if(this.eq(_))return e.isOdd()?_:g;if(e.eq(_))return this.isOdd()?_:g;if(this.isNegative())return e.isNegative()?this.neg().mul(e.neg()):this.neg().mul(e).neg();if(e.isNegative())return this.mul(e.neg()).neg();if(this.lt(m)&&e.lt(m))return i(this.toNumber()*e.toNumber(),this.unsigned);var n=this.high>>>16,a=65535&this.high,o=this.low>>>16,s=65535&this.low,l=e.high>>>16,u=65535&e.high,p=e.low>>>16,h=65535&e.low,f=0,y=0,v=0,b=0;return v+=(b+=s*h)>>>16,y+=(v+=o*h)>>>16,v&=65535,y+=(v+=s*p)>>>16,f+=(y+=a*h)>>>16,y&=65535,f+=(y+=o*p)>>>16,y&=65535,f+=(y+=s*u)>>>16,f+=n*h+a*p+o*u+s*l,c((v&=65535)<<16|(b&=65535),(f&=65535)<<16|(y&=65535),this.unsigned)},C.mul=C.multiply,C.divide=function(e){if(r(e)||(e=d(e)),e.isZero())throw Error("division by zero");var n,a,o;if(t)return this.unsigned||-2147483648!==this.high||-1!==e.low||-1!==e.high?c((this.unsigned?t.div_u:t.div_s)(this.low,this.high,e.low,e.high),t.get_high(),this.unsigned):this;if(this.isZero())return this.unsigned?y:g;if(this.unsigned){if(e.unsigned||(e=e.toUnsigned()),e.gt(this))return y;if(e.gt(this.shru(1)))return b;o=y}else{if(this.eq(_))return e.eq(v)||e.eq(x)?_:e.eq(_)?v:(n=this.shr(1).div(e).shl(1)).eq(g)?e.isNegative()?v:x:(a=this.sub(e.mul(n)),o=n.add(a.div(e)));if(e.eq(_))return this.unsigned?y:g;if(this.isNegative())return e.isNegative()?this.neg().div(e.neg()):this.neg().div(e).neg();if(e.isNegative())return this.div(e.neg()).neg();o=g}for(a=this;a.gte(e);){n=Math.max(1,Math.floor(a.toNumber()/e.toNumber()));for(var s=Math.ceil(Math.log(n)/Math.LN2),u=s<=48?1:l(2,s-48),p=i(n),h=p.mul(e);h.isNegative()||h.gt(a);)h=(p=i(n-=u,this.unsigned)).mul(e);p.isZero()&&(p=v),o=o.add(p),a=a.sub(h)}return o},C.div=C.divide,C.modulo=function(e){return r(e)||(e=d(e)),t?c((this.unsigned?t.rem_u:t.rem_s)(this.low,this.high,e.low,e.high),t.get_high(),this.unsigned):this.sub(this.div(e).mul(e))},C.mod=C.modulo,C.rem=C.modulo,C.not=function(){return c(~this.low,~this.high,this.unsigned)},C.and=function(e){return r(e)||(e=d(e)),c(this.low&e.low,this.high&e.high,this.unsigned)},C.or=function(e){return r(e)||(e=d(e)),c(this.low|e.low,this.high|e.high,this.unsigned)},C.xor=function(e){return r(e)||(e=d(e)),c(this.low^e.low,this.high^e.high,this.unsigned)},C.shiftLeft=function(e){return r(e)&&(e=e.toInt()),0==(e&=63)?this:e<32?c(this.low<<e,this.high<<e|this.low>>>32-e,this.unsigned):c(0,this.low<<e-32,this.unsigned)},C.shl=C.shiftLeft,C.shiftRight=function(e){return r(e)&&(e=e.toInt()),0==(e&=63)?this:e<32?c(this.low>>>e|this.high<<32-e,this.high>>e,this.unsigned):c(this.high>>e-32,this.high>=0?0:-1,this.unsigned)},C.shr=C.shiftRight,C.shiftRightUnsigned=function(e){if(r(e)&&(e=e.toInt()),0===(e&=63))return this;var t=this.high;return e<32?c(this.low>>>e|t<<32-e,t>>>e,this.unsigned):c(32===e?t:t>>>e-32,0,this.unsigned)},C.shru=C.shiftRightUnsigned,C.shr_u=C.shiftRightUnsigned,C.toSigned=function(){return this.unsigned?c(this.low,this.high,!1):this},C.toUnsigned=function(){return this.unsigned?this:c(this.low,this.high,!0)},C.toBytes=function(e){return e?this.toBytesLE():this.toBytesBE()},C.toBytesLE=function(){var e=this.high,t=this.low;return[255&t,t>>>8&255,t>>>16&255,t>>>24,255&e,e>>>8&255,e>>>16&255,e>>>24]},C.toBytesBE=function(){var e=this.high,t=this.low;return[e>>>24,e>>>16&255,e>>>8&255,255&e,t>>>24,t>>>16&255,t>>>8&255,255&t]},n.fromBytes=function(e,t,r){return r?n.fromBytesLE(e,t):n.fromBytesBE(e,t)},n.fromBytesLE=function(e,t){return new n(e[0]|e[1]<<8|e[2]<<16|e[3]<<24,e[4]|e[5]<<8|e[6]<<16|e[7]<<24,t)},n.fromBytesBE=function(e,t){return new n(e[4]<<24|e[5]<<16|e[6]<<8|e[7],e[0]<<24|e[1]<<16|e[2]<<8|e[3],t)}},358057:(e,t,n)=>{"use strict";
1Object.defineProperty(t,"__esModule",{value:!0}),t.MathBackendCPU=void 0;var r=n(735534),a=n(468462);const o=r.kernel_impls.whereImpl;class s extends r.KernelBackend{constructor(){super(),this.blockSize=48,this.firstUse=!0,this.data=new r.DataStorage(this,(0,r.engine)())}nextDataId(){return s.nextDataId++}write(e,t,n){this.firstUse&&(this.firstUse=!1,(0,r.env)().get("IS_NODE")&&r.backend_util.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============================"));const a={id:this.nextDataId()};return this.data.set(a,{values:e,dtype:n,refCount:1}),a}makeTensorInfo(e,t,n){let a;if("string"===t&&null!=n&&n.length>0&&r.util.isString(n[0])){const o=n.map((e=>r.util.encodeString(e)));a=this.write(o,e,t)}else a=this.write(n,e,t);return{dataId:a,shape:e,dtype:t}}refCount(e){if(this.data.has(e)){return this.data.get(e).refCount}return 0}incRef(e){this.data.get(e).refCount++}decRef(e){if(this.data.has(e)){this.data.get(e).refCount--}}move(e,t,n,r,a){this.data.set(e,{values:t,dtype:r,refCount:a})}numDataIds(){return this.data.numDataIds()}async read(e){return this.readSync(e)}readSync(e){const{dtype:t,complexTensorInfos:n}=this.data.get(e);if("complex64"===t){const e=this.readSync(n.real.dataId),t=this.readSync(n.imag.dataId);return r.backend_util.mergeRealAndImagArrays(e,t)}return this.data.get(e).values}bufferSync(e){const t=this.readSync(e.dataId);let n=t;if("string"===e.dtype)try{n=t.map((e=>r.util.decodeString(e)))}catch(e){throw new Error("Failed to decode encoded string bytes into utf-8")}return(0,r.buffer)(e.shape,e.dtype,n)}makeOutput(e,t,n){const a=this.write(e,t,n);return(0,r.engine)().makeTensorFromDataId(a,t,n,this)}disposeData(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(this.data.has(e)){if(this.data.get(e).refCount--,!t&&this.data.get(e).refCount>0)return!1;const{complexTensorInfos:n}=this.data.get(e);null!=n&&(this.disposeData(n.real.dataId,!0),this.disposeData(n.imag.dataId,!0)),this.data.delete(e)}return!0}disposeIntermediateTensorInfo(e){this.disposeData(e.dataId)}async time(e){const t=r.util.now();e();return{kernelMs:r.util.now()-t}}memory(){return{unreliable:!0,reasons:["The reported memory is an upper bound. Due to automatic garbage collection, the true allocated memory may be less."]}}where(e){(0,a.assertNotComplex)([e],"where");const t=this.readSync(e.dataId);return o(e.shape,t)}dispose(){}floatPrecision(){return 32}epsilon(){return super.epsilon()}}t.MathBackendCPU=s,s.nextDataId=0},209124:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"MathBackendCPU",{enumerable:!0,get:function(){return a.MathBackendCPU}}),t.shared=void 0,Object.defineProperty(t,"version_cpu",{enumerable:!0,get:function(){return s.version}});var r=n(735534),a=n(358057),o=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=i(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if("default"!==o&&{}.hasOwnProperty.call(e,o)){var s=a?Object.getOwnPropertyDescriptor(e,o):null;s&&(s.get||s.set)?Object.defineProperty(r,o,s):r[o]=e[o]}return r.default=e,n&&n.set(e,r),r}(n(717324));t.shared=o;var s=n(781944);function i(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(i=function(e){return e?n:t})(e)}(0,r.registerBackend)("cpu",(()=>new a.MathBackendCPU),1)},468462:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.assertNotComplex=function(e,t){Array.isArray(e)||(e=[e]);e.forEach((e=>{null!=e&&r.util.assert("complex64"!==e.dtype,(()=>"".concat(t," does not support complex64 tensors in the CPU backend.")))}))};var r=n(735534)},83381:(e,t,n)=>{"use strict";
1Object.defineProperty(t,"__esModule",{value:!0});var r=n(209124);Object.keys(r).forEach((function(e){"default"!==e&&"__esModule"!==e&&(e in t&&t[e]===r[e]||Object.defineProperty(t,e,{enumerable:!0,get:function(){return r[e]}}))})),n(503145)},577574:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.absConfig=t.abs=void 0,t.simpleAbsImpl=o;var r=n(735534),a=n(468462);function o(e){const t=new Float32Array(e.length);for(let n=0;n<e.length;++n)t[n]=Math.abs(e[n]);return t}const s=e=>{const{x:t}=e.inputs,n=e.backend;(0,a.assertNotComplex)(t,"abs");let s=new Float32Array(r.util.sizeFromShape(t.shape));return s=o(n.data.get(t.dataId).values),n.makeOutput(s,t.shape,t.dtype)};t.abs=s;t.absConfig={kernelName:r.Abs,backendName:"cpu",kernelFunc:s}},373406:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.acosConfig=t.acos=void 0;var r=n(735534),a=n(777226);const o=t.acos=(0,a.unaryKernelFunc)(r.Acos,(e=>Math.acos(e)));t.acosConfig={kernelName:r.Acos,backendName:"cpu",kernelFunc:o}},114635:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.acoshConfig=t.acosh=void 0;var r=n(735534),a=n(777226);const o=t.acosh=(0,a.unaryKernelFunc)(r.Acosh,(e=>Math.acosh(e)));t.acoshConfig={kernelName:r.Acosh,backendName:"cpu",kernelFunc:o}},772994:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.addImpl=t.addConfig=t.addComplexImpl=t.add=void 0;var r=n(735534),a=n(650179),o=n(3428);const s=t.addImpl=(0,a.createSimpleBinaryKernelImpl)(((e,t)=>e+t)),i=t.addComplexImpl=(0,o.createComplexBinaryKernelImpl)(((e,t,n,r)=>({real:e+n,imag:t+r}))),c=t.add=(0,o.binaryKernelFunc)(r.Add,s,i);t.addConfig={kernelName:r.Add,backendName:"cpu",kernelFunc:c}},171294:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.addN=o,t.addNConfig=void 0;var r=n(735534),a=n(468462);function o(e){const{inputs:t,backend:n}=e,o=t;(0,a.assertNotComplex)(t,"addN");const s=o.map((e=>n.data.get(e.dataId).values)),i=(0,r.buffer)(o[0].shape,o[0].dtype),c=i.values;for(let e=0;e<o.length;e++){const t=s[e];for(let e=0;e<c.length;e++)c[e]+=t[e]}return n.makeTensorInfo(i.shape,i.dtype,i.values)}t.addNConfig={kernelName:r.AddN,backendName:"cpu",kernelFunc:o}},6962:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.all=i,t.allConfig=void 0;var r=n(735534),a=n(468462),o=n(434731),s=n(437023);function i(e){const{inputs:t,backend:n,attrs:i}=e,{x:c}=t,{axis:l,keepDims:u}=i;(0,a.assertNotComplex)(c,"all");const d=r.util.parseAxisParam(l,c.shape);let p=d;const h=r.backend_util.getAxesPermutation(p,c.shape.length);let f=c;
1null!=h&&(f=(0,s.transpose)({inputs:{x:c},backend:n,attrs:{perm:h}}),p=r.backend_util.getInnerMostAxes(p.length,c.shape.length)),r.backend_util.assertAxesAreInnerMostDims("all",p,f.shape.length);const[m,g]=r.backend_util.computeOutAndReduceShapes(f.shape,p),y=r.util.sizeFromShape(g),v=r.util.makeZerosTypedArray(r.util.sizeFromShape(m),f.dtype),b=n.data.get(f.dataId).values;for(let e=0;e<v.length;++e){const t=e*y;let n=b[t];for(let e=0;e<y;++e){const r=b[t+e];n=n&&r}v[e]=n}null!=h&&n.disposeIntermediateTensorInfo(f);const x=n.makeTensorInfo(m,f.dtype,v);if(u){const e=r.backend_util.expandShapeToKeepDim(m,d),t=(0,o.reshape)({inputs:{x:x},backend:n,attrs:{shape:e}});return n.disposeIntermediateTensorInfo(x),t}return x}t.allConfig={kernelName:r.All,backendName:"cpu",kernelFunc:i}},549597:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.any=i,t.anyConfig=void 0;var r=n(735534),a=n(468462),o=n(434731),s=n(437023);function i(e){const{inputs:t,backend:n,attrs:i}=e,{x:c}=t,{axis:l,keepDims:u}=i;(0,a.assertNotComplex)(c,"any");const d=r.util.parseAxisParam(l,c.shape);let p=d;const h=r.backend_util.getAxesPermutation(p,c.shape.length);let f=c;
1null!=h&&(f=(0,s.transpose)({inputs:{x:c},backend:n,attrs:{perm:h}}),p=r.backend_util.getInnerMostAxes(p.length,c.shape.length)),r.backend_util.assertAxesAreInnerMostDims("any",p,f.shape.length);const[m,g]=r.backend_util.computeOutAndReduceShapes(f.shape,p),y=r.util.sizeFromShape(g),v=r.util.makeZerosTypedArray(r.util.sizeFromShape(m),f.dtype),b=n.data.get(f.dataId).values;for(let e=0;e<v.length;++e){const t=e*y;let n=b[t];for(let e=0;e<y;++e){const r=b[t+e];n=n||r}v[e]=n}null!=h&&n.disposeIntermediateTensorInfo(f);const x=n.makeTensorInfo(m,f.dtype,v);if(u){const e=r.backend_util.expandShapeToKeepDim(m,d),t=(0,o.reshape)({inputs:{x:x},backend:n,attrs:{shape:e}});return n.disposeIntermediateTensorInfo(x),t}return x}t.anyConfig={kernelName:r.Any,backendName:"cpu",kernelFunc:i}},202869:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.argMax=s,t.argMaxConfig=void 0;var r=n(735534),a=n(468462),o=n(437023);function s(e){const{inputs:t,backend:n,attrs:s}=e,{x:i}=t,{axis:c}=s;(0,a.assertNotComplex)(i,"argMax");let l=r.util.parseAxisParam(c,i.shape);const u=r.backend_util.getAxesPermutation(l,i.shape.length);let d=i;const p=[];
1null!=u&&(d=(0,o.transpose)({inputs:{x:i},backend:n,attrs:{perm:u}}),p.push(d),l=r.backend_util.getInnerMostAxes(l.length,d.shape.length)),l=[l[0]],r.backend_util.assertAxesAreInnerMostDims("argMax",l,d.shape.length);const[h,f]=r.backend_util.computeOutAndReduceShapes(d.shape,l),m=r.util.sizeFromShape(h),g=r.util.makeZerosTypedArray(m,"int32"),y=r.util.sizeFromShape(f),v=n.data.get(d.dataId).values;for(let e=0;e<g.length;++e){const t=e*y;let n=v[t],r=0;for(let e=0;e<y;++e){const a=v[t+e];a>n&&(n=a,r=e)}g[e]=r}return p.forEach((e=>n.disposeIntermediateTensorInfo(e))),n.makeTensorInfo(h,"int32",g)}t.argMaxConfig={kernelName:r.ArgMax,backendName:"cpu",kernelFunc:s}},945514:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.argMin=s,t.argMinConfig=void 0;var r=n(735534),a=n(468462),o=n(437023);function s(e){const{inputs:t,backend:n,attrs:s}=e,{x:i}=t,{axis:c}=s;(0,a.assertNotComplex)(i,"argMin");let l=r.util.parseAxisParam(c,i.shape);const u=r.backend_util.getAxesPermutation(l,i.shape.length);let d=i;const p=[];
1null!=u&&(d=(0,o.transpose)({inputs:{x:i},backend:n,attrs:{perm:u}}),p.push(d),l=r.backend_util.getInnerMostAxes(l.length,d.shape.length)),l=[l[0]],r.backend_util.assertAxesAreInnerMostDims("argMin",l,d.shape.length);const[h,f]=r.backend_util.computeOutAndReduceShapes(d.shape,l),m=r.util.sizeFromShape(h),g=r.util.makeZerosTypedArray(m,"int32"),y=r.util.sizeFromShape(f),v=n.data.get(d.dataId).values;for(let e=0;e<g.length;++e){const t=e*y;let n=v[t],r=0;for(let e=0;e<y;++e){const a=v[t+e];a<n&&(n=a,r=e)}g[e]=r}return p.forEach((e=>n.disposeIntermediateTensorInfo(e))),n.makeTensorInfo(h,"int32",g)}t.argMinConfig={kernelName:r.ArgMin,backendName:"cpu",kernelFunc:s}},275627:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.asinConfig=t.asin=void 0;var r=n(735534),a=n(777226);const o=t.asin=(0,a.unaryKernelFunc)(r.Asin,(e=>Math.asin(e)));t.asinConfig={kernelName:r.Asin,backendName:"cpu",kernelFunc:o}},574817:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.asinhConfig=t.asinh=void 0;var r=n(735534),a=n(777226);const o=t.asinh=(0,a.unaryKernelFunc)(r.Asinh,(e=>Math.asinh(e)));t.asinhConfig={kernelName:r.Asinh,backendName:"cpu",kernelFunc:o}},676621:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.atanConfig=t.atan=void 0;var r=n(735534),a=n(777226);const o=t.atan=(0,a.unaryKernelFunc)(r.Atan,(e=>Math.atan(e)));t.atanConfig={kernelName:r.Atan,backendName:"cpu",kernelFunc:o}},919050:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.atan2Impl=t.atan2Config=t.atan2=void 0;var r=n(735534),a=n(650179),o=n(3428);const s=t.atan2Impl=(0,a.createSimpleBinaryKernelImpl)(((e,t)=>Math.atan2(e,t))),i=t.atan2=(0,o.binaryKernelFunc)(r.Atan2,s);t.atan2Config={kernelName:r.Atan2,backendName:"cpu",kernelFunc:i}},995033:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.atanhConfig=t.atanh=void 0;var r=n(735534),a=n(777226);const o=t.atanh=(0,a.unaryKernelFunc)(r.Atanh,(e=>Math.atanh(e)));t.atanhConfig={kernelName:r.Atanh,backendName:"cpu",kernelFunc:o}},840189:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.avgPool=i,t.avgPoolConfig=void 0;var r=n(735534),a=n(468462),o=n(406829),s=n(848930);function i(e){const{inputs:t,backend:n,attrs:i}=e,{x:c}=t;(0,a.assertNotComplex)(c,"avgPool");const{filterSize:l,strides:u,pad:d,dimRoundingMode:p}=i;r.util.assert(r.backend_util.eitherStridesOrDilationsAreOne(u,1),(()=>"Error in avgPool: Either strides or dilations must be 1. "+"Got strides ".concat(u," and dilations '").concat(1,"'")));const h=r.backend_util.computePool2DInfo(c.shape,l,u,1,d,p);let f;if(1===h.filterWidth&&1===h.filterHeight&&r.util.arraysEqual(h.inShape,h.outShape))f=(0,s.identity)({inputs:{x:c},backend:n});else{const e=n.data.get(c.dataId).values,t=r.util.computeStrides(c.shape),a=(0,o.pool)(e,c.shape,c.dtype,t,h,"avg");f=n.makeTensorInfo(h.outShape,c.dtype,a.values)}return f}t.avgPoolConfig={kernelName:r.AvgPool,backendName:"cpu",kernelFunc:i}},788683:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.avgPool3D=s,t.avgPool3DConfig=void 0;var r=n(735534),a=n(468462),o=n(406829);function s(e){const{inputs:t,backend:n,attrs:s}=e,{x:i}=t,{filterSize:c,strides:l,pad:u,dimRoundingMode:d,dataFormat:p}=s;(0,a.assertNotComplex)(i,"avgPool3d");const h=r.backend_util.computePool3DInfo(i.shape,c,l,1,u,d,p),f=n.data.get(i.dataId).values,m=(0,o.pool3d)(f,i.shape,i.dtype,r.util.computeStrides(i.shape),h,"avg");return n.makeTensorInfo(m.shape,"float32",m.values)}t.avgPool3DConfig={kernelName:r.AvgPool3D,backendName:"cpu",kernelFunc:s}},339522:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.avgPool3DGrad=o,t.avgPool3DGradConfig=void 0;var r=n(735534),a=n(468462);function o(e){const{inputs:t,backend:n,attrs:o}=e,{dy:s,input:i}=t,{filterSize:c,strides:l,pad:u,dimRoundingMode:d}=o;(0,a.assertNotComplex)([s,i],"avgPool3DGrad");const p=r.backend_util.computePool3DInfo(i.shape,c,l,1,u,d),h=p.str
1ideDepth,f=p.strideHeight,m=p.strideWidth,g=p.filterDepth,y=p.filterHeight,v=p.filterWidth,b=p.dilationDepth,x=p.dilationHeight,w=p.dilationWidth,k=p.effectiveFilterDepth,_=p.effectiveFilterHeight,C=p.effectiveFilterWidth,P=k-1-p.padInfo.front,O=C-1-p.padInfo.left,N=_-1-p.padInfo.top,I=(0,r.buffer)(i.shape,"float32"),T=1/(g*y*v),S=n.bufferSync(s);for(let e=0;e<p.batchSize;++e)for(let t=0;t<p.inChannels;++t)for(let n=0;n<p.inDepth;++n)for(let r=0;r<p.inHeight;++r)for(let a=0;a<p.inWidth;++a){const o=n-P,s=r-N,i=a-O;let c=0;for(let n=0;n<k;n+=b){const r=(o+n)/h;if(!(r<0||r>=p.outDepth||Math.floor(r)!==r))for(let n=0;n<_;n+=x){const a=(s+n)/f;if(!(a<0||a>=p.outHeight||Math.floor(a)!==a))for(let n=0;n<C;n+=w){const o=(i+n)/m;if(o<0||o>=p.outWidth||Math.floor(o)!==o)continue;c+=S.get(e,r,a,o,t)}}}I.set(c*T,e,n,r,a,t)}return n.makeTensorInfo(I.shape,I.dtype,I.values)}t.avgPool3DGradConfig={kernelName:r.AvgPool3DGrad,backendName:"cpu",kernelFunc:o}},981593:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.avgPoolGrad=o,t.avgPoolGradConfig=void 0;var r=n(735534),a=n(468462);function o(e){const{inputs:t,backend:n,attrs:o}=e,{dy:s,input:i}=t,c=i;(0,a.assertNotComplex)([s,i],"avgPoolGrad");const{filterSize:l,strides:u,pad:d}=o,p=r.backend_util.computePool2DInfo(c.shape,l,u,1,d),h=p.strideHeight,f=p.strideWidth,m=p.filterHeight,g=p.filterWidth,y=p.dilationHeight,v=p.dilationWidth,b=p.effectiveFilterHeight,x=p.effectiveFilterWidth,w=x-1-p.padInfo.left,k=b-1-p.padInfo.top,_=(0,r.buffer)(c.shape,"float32"),C=1/(m*g),P=n.data.get(s.dataId).values,O=(0,r.buffer)(s.shape,"float32",P);for(let e=0;e<p.batchSize;++e)for(let t=0;t<p.inChannels;++t)for(let n=0;n<p.inHeight;++n)for(let r=0;r<p.inWidth;++r){const a=n-k,o=r-w;let s=0;for(let n=0;n<b;n+=y){const r=(a+n)/h;if(!(r<0||r>=p.outHeight||Math.floor(r)!==r))for(let n=0;n<x;n+=v){const a=(o+n)/f;if(a<0||a>=p.outWidth||Math.floor(a)!==a)continue;s+=O.get(e,r,a,t)}}_.set(s*C,e,n,r,t)}return n.makeTensorInfo(_.shape,_.dtype,_.values)}t.avgPoolGradConfig={kernelName:r.AvgPoolGrad,backendName:"cpu",kernelFunc:o}},418026:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.batchMatMul=s,t.batchMatMulConfig=void 0;var r=n(735534),a=n(468462),o=n(434731);function s(e){const{inputs:t,backend:n,attrs:s}=e,{a:i,b:c}=t,{transposeA:l,transposeB:u}=s;(0,a.assertNotComplex)([i,c],"matMul");const d=i.shape.length,p=c.shape.length,h=l?i.shape[d-2]:i.shape[d-1],f=u?c.shape[p-1]:c.shape[p-2],m=l?i.shape[d-1]:i.shape[d-2],g=u?c.shape[p-2]:c.shape[p-1],y=i.shape.slice(0,-2),v=c.shape.slice(0,-2),b=r.util.sizeFromShape(y),x=r.util.sizeFromShape(v),w=r.broadcast_util.assertAndGetBroadcastShape(i.shape.slice(0,-2),c.shape.slice(0,-2)).concat([m,g]);r.util.assert(h===f,(()=>"Error in matMul: inner shapes (".concat(h,") and (")+"".concat(f,") of Tensors with shapes ").concat(i.shape," and ")+"".concat(c.shape," and transposeA=").concat(l)+" and transposeB=".concat(u," must match.")));const k=l?[b,h,m]:[b,m,h],_=u?[x,g,f]:[x,f,g],C=(0,o.reshape)({inputs:{x:i},backend:n,attrs:{shape:k}}),P=(0,o.reshape)({inputs:{x:c},backend:n,attrs:{shape:_}}),O=l?C.shape[1]:C.shape[2],N=l?C.shape[2]:C.shape[1],I=u?P.shape[1]:P.shape[2],T=Math.max(b,x),S=n.data.get(C.dataId).values,E=n.data.get(P.dataId).values,M=r.util.computeStrides(C.shape),A=r.util.computeStrides(P.shape),[D,R,F]=l?[M[0],1,M[1]]:[M[0],M[1],1],[j,z,L]=u?[1,A[1],A[0]]:[A[1],1,A[0]],V=N*I,G=(0,r.buffer)([T,N,I],C.dtype),B=G.values,W=n.blockSize;for(let e=0;e<T;e++)for(let t=0;t<N;t+=W)for(let n=0;n<I;n+=W)for(let r=0;r<O;r+=W){const a=Math.min(t+W,N),o=Math.min(n+W,I),s=Math.min(r+W,O);for(let i=t;i<a;i++)for(let t=n;t<o;t++){let n=0;for(let a=r;a<s;a++){const r=Math.min(e,b-1)*D,o=Math.min(e,x-1)*L;n+=S[r+i*R+a*F]*E[a*j+t*z+o]}B[e*V+(i*I+t)]+=n}}return n.disposeIntermediateTensorInfo(C),n.disposeIntermediateTensorInfo(P),n.makeTensorInfo(w,G.dtype,G.values)}t.batchMatMulConfig={kernelName:r.BatchMatMul,backendName:"cpu",kernelFunc:s}},337306:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.batchNorm=o,t.batchNormConfig=void 0;var r=n(735534),a=n(468462);function o(e){const{inputs:t,backend:n,attrs:o}=e,{x:s,scale:i,offset:c,mean:l,variance:u}=t;r.util.assert(l.shape.length===u.shape.length,(()=>"Batch normalization gradient requires mean and variance to have equal ranks.")),r.util.assert(null==c||l.shape.length===c.shape.length,(()=>"Batch normalization gradient requires mean and offset to have equal ranks.")),r.util.assert(null==i||l.shape.length===i.shape.length,(()=>"Batch normalization gradient requires mean and scale to have equal ranks.")),(0,a.assertNotComplex)([s,l,u,i,c],"batchNorm");let{varianceEpsilon:d}=o;null==d&&(d=.001);const p=n.data.get(s.dataId).values,h=n.data.get(l.dataId).values,f=n.data.get(u.dataId).values,m=i?n.data.get(i.dataId).values:new Float32Array([1]),g=c?n.data.get(c.dataId).values:new Float32Array([0]),y=new Float32Array(p.length),v=g.length,b=m.length,x=f.length,w=h.length;let k=0,_=0,C=0,P=0;for(let e=0;e<p.length;++e)y[e]=g[k++]+(p[e]-h[_++])*m[C++]/Math.sqrt(f[P++]+d),k>=v&&(k=0),_>=w&&(_=0),C>=b&&(C=0),P>=x&&(P=0);return n.makeTensorInfo(s.shape,s.dtype,y)}t.batchNormConfig={kernelName:r.FusedBatchNorm,backendName:"cpu",kernelFunc:o}},239847:(e,t,n)=>{"use strict";
1Object.defineProperty(t,"__esModule",{value:!0}),t.batchToSpaceND=c,t.batchToSpaceNDConfig=void 0;var r=n(735534),a=n(468462),o=n(434731),s=n(910875),i=n(437023);function c(e){const{inputs:t,backend:n,attrs:c}=e,{x:l}=t,{blockShape:u,crops:d}=c;(0,a.assertNotComplex)([l],"batchToSpaceND");const p=u.reduce(((e,t)=>e*t)),h=r.backend_util.getReshaped(l.shape,u,p),f=r.backend_util.getPermuted(h.length,u.length),m=r.backend_util.getReshapedPermuted(l.shape,u,p),g=r.backend_util.getSliceBeginCoords(d,u.length),y=r.backend_util.getSliceSize(m,d,u.length),v=(0,o.reshape)({inputs:{x:l},backend:n,attrs:{shape:h}}),b=(0,i.transpose)({inputs:{x:v},backend:n,attrs:{perm:f}}),x=(0,o.reshape)({inputs:{x:b},backend:n,attrs:{shape:m}}),w=(0,s.slice)({inputs:{x:x},backend:n,attrs:{begin:g,size:y}});return n.disposeIntermediateTensorInfo(v),n.disposeIntermediateTensorInfo(b),n.disposeIntermediateTensorInfo(x),w}t.batchToSpaceNDConfig={kernelName:r.BatchToSpaceND,backendName:"cpu",kernelFunc:c}},254402:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.bincount=o,t.bincountConfig=void 0;var r=n(735534),a=n(938739);function o(e){const{inputs:t,backend:n,attrs:r}=e,{x:o,weights:s}=t,{size:i}=r,c=n.data.get(o.dataId).values,l=n.data.get(s.dataId).values,u=(0,a.bincountImpl)(c,l,s.dtype,s.shape,i);return n.makeTensorInfo([i],s.dtype,u)}t.bincountConfig={kernelName:r.Bincount,backendName:"cpu",kernelFunc:o}},938739:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.bincountImpl=function(e,t,n,a,o){const s=r.util.sizeFromShape(a),i=r.util.makeZerosTypedArray(o,n);for(let n=0;n<e.length;n++){const r=e[n];if(r<0)throw new Error("Input x must be non-negative!");r>=o||(i[r]+=s>0?t[n]:1)}return i},t.bincountReduceImpl=function(e,t,n){let a=arguments.length>3&&void 0!==arguments[3]&&arguments[3];const o=e.shape[0],s=e.shape[1],i=(0,r.buffer)([o,n],t.dtype);for(let r=0;r<o;r++)for(let o=0;o<s;o++){const s=e.get(r,o);if(s<0)throw new Error("Input x must be non-negative!");s>=n||(a?i.set(1,r,s):t.size>0?i.set(i.get(r,s)+t.get(r,o),r,s):i.set(i.get(r,s)+1,r,s))}return i};var r=n(735534)},640292:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.broadcastArgs=a,t.broadcastArgsConfig=void 0;var r=n(735534);function a(e){const{inputs:t,backend:n}=e,{s0:a,s1:o}=t,s=n.data.get(a.dataId).values,i=n.data.get(o.dataId).values,c=r.backend_util.assertAndGetBroadcastShape(Array.from(s),Array.from(i));return n.makeTensorInfo([c.length],"int32",Int32Array.from(c))}t.broadcastArgsConfig={kernelName:r.BroadcastArgs,backendName:"cpu",kernelFunc:a}},764979:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.cast=l,t.castConfig=void 0;var r=n(735534),a=n(650179),o=n(746509),s=n(795801),i=n(848930),c=n(357858);function l(e){const{inputs:t,backend:n,attrs:u}=e,{x:d}=t,{dtype:p}=u;if("complex64"===p){if("complex64"===d.dtype)return(0,i.identity)({inputs:{x:d},backend:n});const e=(0,o.zeros)(n,d.shape,d.dtype),t=l({inputs:{x:d},backend:n,attrs:{dtype:"float32"}}),r=(0,s.complex)({inputs:{real:t,imag:e},backend:n});return n.disposeIntermediateTensorInfo(e),n.disposeIntermediateTensorInfo(t),r}
1if("complex64"===d.dtype){const e=(0,c.real)({inputs:{input:d},backend:n}),t=l({inputs:{x:e},backend:n,attrs:{dtype:p}});return n.disposeIntermediateTensorInfo(e),t}if(!r.util.hasEncodingLoss(d.dtype,p)){const e=(0,i.identity)({inputs:{x:d},backend:n});return{dataId:e.dataId,shape:e.shape,dtype:p}}if("int32"===p){const e=n.data.get(d.dataId).values,t=Int32Array.from(e);return n.makeTensorInfo(d.shape,"int32",t)}if("bool"===p){const e=n.data.get(d.dataId).values,t=r.util.toTypedArray([0],d.dtype),[o,s]=(0,a.createSimpleBinaryKernelImpl)(((e,t)=>e!==t?1:0))(d.shape,[],e,t,"bool");return n.makeTensorInfo(s,"bool",o)}throw new Error("Error in Cast: failed to cast ".concat(d.dtype," to ").concat(p))}t.castConfig={kernelName:r.Cast,backendName:"cpu",kernelFunc:l}},551647:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ceilImpl=t.ceilConfig=t.ceil=void 0;var r=n(735534),a=n(816375),o=n(777226);const s=t.ceilImpl=(0,a.createSimpleUnaryImpl)((e=>Math.ceil(e))),i=t.ceil=(0,o.unaryKernelFuncFromImpl)(r.Ceil,s);t.ceilConfig={kernelName:r.Ceil,backendName:"cpu",kernelFunc:i}},672180:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.clipByValueConfig=t.clipByValue=void 0;var r=n(735534),a=n(777226);const o=t.clipByValue=(0,a.unaryKernelFunc)(r.ClipByValue,((e,t)=>{const n=t;return e>n.clipValueMax?n.clipValueMax:e<n.clipValueMin?n.clipValueMin:e}));t.clipByValueConfig={kernelName:r.ClipByValue,backendName:"cpu",kernelFunc:o}},795801:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.complex=a,t.complexConfig=void 0;var r=n(735534);function a(e){const{inputs:t,backend:n}=e,{real:r,imag:a}=t,o=n.data.get(r.dataId).values,s=n.data.get(a.dataId).values,i=n.makeTensorInfo(r.shape,"complex64");return n.data.get(i.dataId).complexTensorInfos={real:n.makeTensorInfo(r.shape,"float32",o),imag:n.makeTensorInfo(a.shape,"float32",s)},i}t.complexConfig={kernelName:r.Complex,backendName:"cpu",kernelFunc:a}},914171:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.complexAbsConfig=t.complexAbs=void 0;var r=n(735534);const a=e=>{const{x:t}=e.inputs,n=e.backend,a=new Float32Array(r.util.sizeFromShape(t.shape)),o=n.data.get(t.dataId),s=o.complexTensorInfos.real,i=o.complexTensorInfos.imag,c=n.data.get(s.dataId).values,l=n.data.get(i.dataId).values;for(let e=0;e<c.length;e++){const t=c[e],n=l[e];a[e]=Math.hypot(t,n)}return n.makeOutput(a,t.shape,"float32")};t.complexAbs=a;t.complexAbsConfig={kernelName:r.ComplexAbs,backendName:"cpu",kernelFunc:a}},432930:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.concat=u,t.concatConfig=void 0;var r=n(735534),a=n(795801),o=n(235464),s=n(848930),i=n(62202),c=n(357858),l=n(434731);function u(e){const{inputs:t,backend:n,attrs:d}=e,{axis:p}=d,h=r.util.parseAxisParam(p,t[0].shape)[0];let f=r.backend_util.computeOutShape(t.map((e=>e.shape)),h);if(0===r.util.sizeFromShape(f))return n.makeTensorInfo(f,t[0].dtype,[]);const m=t.filter((e=>r.util.sizeFromShape(e.shape)>0));if(1===m.length)return(0,s.identity)({inputs:{x:m[0]},backend:n});const g=m.map((e=>e.shape));if(r.backend_util.assertParamsConsistent(g,h),"complex64"===m[0].dtype){const e=m.map((e=>
1(0,c.real)({inputs:{input:e},backend:n}))),t=m.map((e=>(0,i.imag)({inputs:{input:e},backend:n}))),r=u({inputs:e,backend:n,attrs:{axis:h}}),o=u({inputs:t,backend:n,attrs:{axis:h}}),s=(0,a.complex)({inputs:{real:r,imag:o},backend:n});return e.forEach((e=>n.disposeIntermediateTensorInfo(e))),t.forEach((e=>n.disposeIntermediateTensorInfo(e))),n.disposeIntermediateTensorInfo(r),n.disposeIntermediateTensorInfo(o),s}const y=m.map((e=>{const t=[-1,r.util.sizeFromShape(e.shape.slice(h))];return(0,l.reshape)({inputs:{x:e},backend:n,attrs:{shape:t}})})),v=y.map((e=>({vals:n.data.get(e.dataId).values,shape:e.shape})));f=r.backend_util.computeOutShape(y.map((e=>e.shape)),1);const b=1===y[0].shape[0],x=(0,o.concatImpl)(v,f,t[0].dtype,b),w=r.backend_util.computeOutShape(m.map((e=>e.shape)),h),k=n.makeTensorInfo(w,t[0].dtype,x);return y.forEach((e=>n.disposeIntermediateTensorInfo(e))),k}t.concatConfig={kernelName:r.Concat,backendName:"cpu",kernelFunc:u}},235464:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.concatImpl=function(e,t,n,a){const o=r.util.getArrayFromDType(n,r.util.sizeFromShape(t));if(a&&"string"!==n){let t=0;e.forEach((e=>{const n=r.util.sizeFromShape(e.shape);o.set(e.vals,t),t+=n}))}else{let a=0;e.forEach((e=>{const s="string"===n?r.backend_util.fromUint8ToStringArray(e.vals):e.vals;let i=0;for(let n=0;n<e.shape[0];++n){const r=n*t[1]+a;for(let t=0;t<e.shape[1];++t)o[r+t]=s[i++]}a+=e.shape[1]}))}return o};var r=n(735534)},902119:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.conv2D=o,t.conv2DConfig=void 0;var r=n(735534),a=n(468462);function o(e){const{inputs:t,backend:n,attrs:o}=e,{x:s,filter:i}=t,{strides:c,pad:l,dataFormat:u,dilations:d,dimRoundingMode:p}=o;(0,a.assertNotComplex)([s,i],"conv2d");const h=r.backend_util.convertConv2DDataFormat(u),f=r.backend_util.computeConv2DInfo(s.shape,i.shape,c,d,l,p,!1,h),m=f.filterHeight,g=f.filterWidth,y=f.dilationHeight,v=f.dilationWidth,b=f.padInfo.left,x=f.padInfo.top,w="channelsLast"===f.dataFormat,k=new r.TensorBuffer(f.outShape,s.dtype),_=r.util.computeStrides(s.shape),C=r.util.computeStrides(i.shape),P=_[0],O=w?_[1]:_[2],N=w?_[2]:1,I=w?1:_[1],T=k.strides[0],S=w?k.strides[1]:k.strides[2],E=w?k.strides[2]:1,M=w?1:k.strides[1],A=n.data.get(s.dataId).values,D=n.data.get(i.dataId).values,R=k.values;for(let e=0;e<f.batchSize;++e){const t=e*P,n=e*T;for(let e=0;e<f.outHeight;++e){const r=n+e*S,a=e*f.strideHeight-x;for(let e=0;e<m;++e){const n=a+e*y;if(n<0||n>=f.inHeight)continue;const o=e*C[0],s=t+n*O;for(let e=0;e<f.outWidth;++e){const t=r+e*E,n=e*f.strideWidth-b;for(let e=0;e<g;++e){const r=n+e*v;if(r<0||r>=f.inWidth)continue;const a=s+r*N;let i=o+e*C[1];for(let e=0;e<f.inChannels;++e){const n=A[a+e*I];for(let e=0;e<f.outChannels;++e)R[t+e*M]+=n*D[i+e];i+=f.outChannels}}}}}}return n.makeTensorInfo(k.shape,k.dtype,R)}t.conv2DConfig={kernelName:r.Conv2D,backendName:"cpu",kernelFunc:o}},190778:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.conv2DBackpropFilter=o,t.conv2DBackpropFilterConfig=void 0;var r=n(735534),a=n(468462);function o(e){const{inputs:t,backend:n,attrs:o}=e,{x:s,dy:i}=t,{strides:c,pad:l,dataFormat:u,dimRoundingMode:d,filterShape:p}=o;(0,a.assertNotComplex)([s,i],"conv2dBackpropFilter");const h=r.backend_util.convertConv2DDataFormat(u),f=r.backend_util.computeConv2DInfo(s.shape,p,c,1,l,d,!1,h),{strideHeight:m,strideWidth:g,filterHeight:y,filterWidth:v}=f,b="channelsLast"===f.dataFormat,x=new r.TensorBuffer(f.filterShape,"float32"),w=f.padInfo.left,k=f.padInfo.top,_=n.data.get(s.dataId).values,C=n.data.get(i.dataId).values,P=new r.TensorBuffer(s.shape,s.dtype,_),O=new r.TensorBuffer(i.shape,i.dtype,C);for(let e=0;e<y;++e){const t=Math.max(0,Math.ceil((k-e)/m)),n=Math.min(f.outHeight,(f.inHeight+k-e)/m);for(let r=0;r<v;++r){const a=Math.max(0,Math.ceil((w-r)/g)),o=Math.min(f.outWidth,(f.inWidth+w-r)/g);for(let s=0;s<f.inChannels;++s)for(let i=0;i<f.outChannels;++i){let c=0;for(let l=0;l<f.batchSize;++l)for(let u=t;u<n;++u){const t=e+u*m-k;for(let e=a;e<o;++e){const n=r+e*g-w;c+=b?P.get(l,t,n,s)*O.get(l,u,e,i):P.get(l,s,t,n)*O.get(l,i,u,e)}}x.set(c,e,r,s,i)}}}return n.makeTensorInfo(x.shape,x.dtype,x.values)}t.conv2DBackpropFilterConfig={kernelName:r.Conv2DBackpropFilter,backendName:"cpu",kernelFunc:o}}
vendor: 4,607 bytes, line 1
1,616089:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.conv2DBackpropInput=o,t.conv2DBackpropInputConfig=void 0;var r=n(735534),a=n(468462);function o(e){const{inputs:t,backend:n,attrs:o}=e,{dy:s,filter:i}=t,{inputShape:c,strides:l,pad:u,dataFormat:d,dimRoundingMode:p}=o;(0,a.assertNotComplex)([s,i],"conv2dBackpropInput");const h=r.util.computeStrides(i.shape),f=r.util.computeStrides(s.shape);let m=r.backend_util.convertConv2DDataFormat(d);const g=r.backend_util.computeConv2DInfo(c,i.shape,l,1,u,p,!1,m),y=new r.TensorBuffer(g.inShape,"float32"),v=y.values,b=n.data.get(s.dataId).values,x=n.data.get(i.dataId).values,[w,k,_]=h,{batchSize:C,filterHeight:P,filterWidth:O,inChannels:N,inHeight:I,inWidth:T,outChannels:S,outHeight:E,outWidth:M,strideHeight:A,strideWidth:D}=g;m=g.dataFormat;const R=P-1-g.padInfo.top,F=O-1-g.padInfo.left,j="channelsLast"===m,z=y.strides[0],L=j?y.strides[1]:y.strides[2],V=j?y.strides[2]:1,G=j?1:y.strides[1],B=f[0],W=j?f[1]:f[2],U=j?f[2]:1,q=j?1:f[1];for(let e=0;e<C;++e)for(let t=0;t<N;++t)for(let n=0;n<I;++n){const r=n-R,a=Math.max(0,Math.ceil(r/A)),o=Math.min(E,(P+r)/A);for(let s=0;s<T;++s){const i=s-F,c=Math.max(0,Math.ceil(i/D)),l=Math.min(M,(O+i)/D);let u=0;for(let n=a;n<o;++n){const a=n*A-r;for(let r=c;r<l;++r){const o=B*e+W*n+U*r,s=w*(P-1-a)+k*(O-1-(r*D-i))+_*t;for(let e=0;e<S;++e){u+=b[o+q*e]*x[s+e]}}}v[z*e+L*n+V*s+G*t]=u}}return n.makeTensorInfo(y.shape,y.dtype,y.values)}t.conv2DBackpropInputConfig={kernelName:r.Conv2DBackpropInput,backendName:"cpu",kernelFunc:o}},479739:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.conv3D=o,t.conv3DConfig=void 0;var r=n(735534),a=n(468462);function o(e){const{inputs:t,backend:n,attrs:o}=e,{x:s,filter:i}=t,{strides:c,pad:l,dilations:u}=o;(0,a.assertNotComplex)([s,i],"conv3d");const d=r.backend_util.computeConv3DInfo(s.shape,i.shape,c,u,l),{filterDepth:p,filterHeight:h,filterWidth:f,dilationDepth:m,dilationHeight:g,dilationWidth:y,padInfo:v}=d,b=v.front,x=v.left,w=v.top,k=new r.TensorBuffer(d.outShape,s.dtype),_=n.data.get(s.dataId).values,C=n.data.get(i.dataId).values,P=k.values,O=r.util.computeStrides(s.shape),N=r.util.computeStrides(i.shape);for(let e=0;e<d.batchSize;++e){const t=e*O[0],n=e*k.strides[0];for(let e=0;e<d.outDepth;++e){const r=n+e*k.strides[1],a=e*d.strideDepth-b;for(let e=0;e<p;++e){const n=a+e*m;if(n<0||n>=d.inDepth)continue;const o=e*N[0],s=t+n*O[1];for(let e=0;e<d.outHeight;++e){const t=r+e*k.strides[2],n=e*d.strideHeight-w;for(let e=0;e<h;++e){const r=n+e*g;if(r<0||r>=d.inHeight)continue;const a=o+e*N[1],i=s+r*O[2];for(let e=0;e<d.outWidth;++e){const n=t+e*d.outChannels,r=e*d.strideWidth-x;for(let e=0;e<f;++e){const t=r+e*y;if(t<0||t>=d.inWidth)continue;const o=a+e*N[2],s=i+t*d.inChannels;let c=o;for(let e=0;e<d.inChannels;++e){const t=_[s+e];for(let e=0;e<d.outChannels;++e)P[n+e]+=t*C[c+e];c+=d.outChannels}}}}}}}}return n.makeTensorInfo(k.shape,k.dtype,k.values)}t.conv3DConfig={kernelName:r.Conv3D,backendName:"cpu",kernelFunc:o}},441177:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.conv3DBackpropFilterV2=o,t.conv3DBackpropFilterV2Config=void 0;var r=n(735534),a=n(468462);function o(e){const{inputs:t,backend:n,attrs:o}=e,{x:s,dy:i}=t,{strides:c,pad:l,filterShape:u}=o;(0,a.assertNotComplex)([s,i],"conv3dBackpropFilterV2");const d=r.util.computeStrides(s.shape),p=r.util.computeStrides(i.shape),h=r.backend_util.computeConv3DInfo(s.shape,u,c,1,l),f=h.strideDepth,m=h.strideHeight,g=h.strideWidth,y=h.filterDepth,v=h.filterHeight,b=h.filterWidth,x=new r.TensorBuffer(h.filterShape,"float32"),w=x.values,[k,_,C,P]=x.strides,O=n.data.get(i.dataId).values,[N,I,T,S]=p,E=n.data.get(s.dataId).values,[M,A,D,R]=d,F=h.padInfo.front,j=h.padInfo.left,z=h.padInfo.top;for(let e=0;e<y;++e){const t=Math.max(0,Math.ceil((F-e)/f)),n=Math.min(h.outDepth,(h.inDepth+F-e)/f),r=e*k;for(let a=0;a<v;++a){const o=Math.max(0,Math.ceil((z-a)/m)),s=Math.min(h.outHeight,(h.inHeight+z-a)/m),i=a*_+r;for(let r=0;r<b;++r){const c=Math.max(0,Math.ceil((j-r)/g)),l=Math.min(h.outWidth,(h.inWidth+j-r)/g),u=r*C+i;for(let i=0;i<h.inChannels;++i){const d=i*P+u;for(let u=0;u<h.outChannels;++u){let p=0;for(let d=0;d<h.batchSize;++d){const h=d*M,y=d*N;for(let d=t;d<n;++d){const t=(e+d*f-F)*A+h,n=d*I+y;for(let e=o;e<s;++e){const o=(a+e*m-z)*D+t,s=e*T+n;for(let e=c;e<l;++e){const t=e*S+s;p+=E[(r+e*g-j)*R+o+i]*O[t+u]}}}}w[d+u]=p}}}}}return n.makeTensorInfo(x.shape,x.dtype,x.values)}t.conv3DBackpropFilterV2Config={kernelName:r.Conv3DBackpropFilterV2,backendName:"cpu",kernelFunc:o}},501527:(e,t,n)=>{"use strict";
1Object.defineProperty(t,"__esModule",{value:!0}),t.conv3DBackpropInputV2=o,t.conv3DBackpropInputV2Config=void 0;var r=n(735534),a=n(468462);function o(e){const{inputs:t,backend:n,attrs:o}=e,{dy:s,filter:i}=t,{pad:c,strides:l,inputShape:u}=o;(0,a.assertNotComplex)([s],"conv3dBackpropInputV2");const d=r.util.computeStrides(s.shape),p=r.util.computeStrides(i.shape),h=r.backend_util.computeConv3DInfo(u,i.shape,l,1,c),f=new r.TensorBuffer(h.inShape,"float32"),m=f.values,[g,y,v,b]=f.strides,x=n.data.get(s.dataId).values,[w,k,_,C]=d,P=n.data.get(i.dataId).values,[O,N,I,T]=p,{batchSize:S,filterDepth:E,filterHeight:M,filterWidth:A,inChannels:D,inDepth:R,inHeight:F,inWidth:j,outChannels:z,outDepth:L,outHeight:V,outWidth:G,strideDepth:B,strideHeight:W,strideWidth:U}=h,q=E-1-h.padInfo.front,H=M-1-h.padInfo.top,K=A-1-h.padInfo.left;for(let e=0;e<S;++e)for(let t=0;t<D;++t)for(let n=0;n<R;++n){const r=n-q,a=Math.max(0,Math.ceil(r/B)),o=Math.min(L,(E+r)/B);for(let s=0;s<F;++s){const i=s-H,c=Math.max(0,Math.ceil(i/W)),l=Math.min(V,(M+i)/W);for(let u=0;u<j;++u){const d=u-K,p=Math.max(0,Math.ceil(d/U)),h=Math.min(G,(A+d)/U);let f=0;for(let n=a;n<o;++n){const a=n*B-r;for(let r=c;r<l;++r){const o=r*W-i;for(let s=p;s<h;++s){const i=w*e+k*n+_*r+C*s,c=O*(E-1-a)+N*(M-1-o)+I*(A-1-(s*U-d))+T*t;for(let e=0;e<z;++e){f+=x[i+e]*P[c+e]}}}}m[g*e+y*n+v*s+b*u+t]=f}}}return n.makeTensorInfo(f.shape,f.dtype,f.values)}t.conv3DBackpropInputV2Config={kernelName:r.Conv3DBackpropInputV2,backendName:"cpu",kernelFunc:o}},732164:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.cosConfig=t.cos=void 0;var r=n(735534),a=n(777226);const o=t.cos=(0,a.unaryKernelFunc)(r.Cos,(e=>Math.cos(e)));t.cosConfig={kernelName:r.Cos,backendName:"cpu",kernelFunc:o}},102041:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.coshConfig=t.cosh=void 0;var r=n(735534),a=n(777226);const o=t.cosh=(0,a.unaryKernelFunc)(r.Cosh,(e=>Math.cosh(e)));t.coshConfig={kernelName:r.Cosh,backendName:"cpu",kernelFunc:o}},745243:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.cropAndResize=a,t.cropAndResizeConfig=void 0;var r=n(735534);function a(e){const{inputs:t,backend:n,attrs:a}=e,{image:o,boxes:s,boxInd:i}=t,{cropSize:c,method:l,extrapolationValue:u}=a,[d,p,h,f]=o.shape,m=s.shape[0],[g,y]=c,v=(0,r.buffer)([m,g,y,f],"float32"),b=n.data.get(s.dataId).values,x=n.data.get(i.dataId).values,w=n.data.get(o.dataId).values,k=r.util.computeStrides(o.shape),_=r.util.computeStrides(v.shape);for(let e=0;e<m;e++){const t=4*e,n=b[t],r=b[t+1],a=b[t+2],o=b[t+3],s=x[e];if(s>=d)continue;const i=g>1?(a-n)*(p-1)/(g-1):0,c=y>1?(o-r)*(h-1)/(y-1):0;for(let t=0;t<g;t++){const d=g>1?n*(p-1)+t*i:.5*(n+a)*(p-1);if(d<0||d>p-1)for(let n=0;n<y;n++)for(let r=0;r<f;r++){const a=r+n*_[2]+t*_[1]+e*_[0];v.values[a]=u}else if("bilinear"===l){const n=Math.floor(d),a=Math.ceil(d),i=d-n;for(let l=0;l<y;l++){const d=y>1?r*(h-1)+l*c:.5*(r+o)*(h-1);if(d<0||d>h-1){for(let n=0;n<f;n++){const r=n+l*_[2]+t*_[1]+e*_[0];v.values[r]=u}continue}const p=Math.floor(d),m=Math.ceil(d),g=d-p;for(let r=0;r<f;r++){let o=r+p*k[2]+n*k[1]+s*k[0];const c=w[o];o=r+m*k[2]+n*k[1]+s*k[0];const u=w[o];o=r+p*k[2]+a*k[1]+s*k[0];const d=w[o];o=r+m*k[2]+a*k[1]+s*k[0];const h=c+(u-c)*g,f=d+(w[o]-d)*g;o=r+l*_[2]+t*_[1]+e*_[0],v.values[o]=h+(f-h)*i}}}else for(let n=0;n<y;++n){const a=y>1?r*(h-1)+n*c:.5*(r+o)*(h-1);if(a<0||a>h-1){for(let r=0;r<f;r++){const a=r+n*_[2]+t*_[1]+e*_[0];v.values[a]=u}continue}const i=Math.round(a),l=Math.round(d);for(let r=0;r<f;r++){const a=r+i*k[2]+l*k[1]+s*k[0],o=r+n*_[2]+t*_[1]+e*_[0];v.values[o]=w[a]}}}}return n.makeTensorInfo(v.shape,v.dtype,v.values)}t.cropAndResizeConfig={kernelName:r.CropAndResize,backendName:"cpu",kernelFunc:a}},666263:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.cumsum=s,t.cumsumConfig=void 0;var r=n(735534),a=n(468462),o=n(437023);function s(e){const{inputs:t,backend:n,attrs:s}=e,{x:i}=t,{axis:c,exclusive:l,reverse:u}=s;(0,a.assertNotComplex)(i,"cumsum");const d=r.backend_util.getAxesPermutation([c],i.shape.length);let p=i;
1null!=d&&(p=(0,o.transpose)({inputs:{x:i},backend:n,attrs:{perm:d}}));const h=r.backend_util.getInnerMostAxes(1,i.shape.length)[0];if(h!==p.shape.length-1)throw new Error("backend.cumsum in CPU expects an inner-most "+"axis=".concat(p.shape.length-1," but got axis=").concat(h));const f=(0,r.upcastType)(p.dtype,"int32"),m=r.util.makeZerosTypedArray(r.util.sizeFromShape(p.shape),f),g=n.data.get(p.dataId).values,y=p.shape[p.shape.length-1],v=u?(e,t)=>e+y-t-1:(e,t)=>e+t;for(let e=0;e<g.length;e+=y)for(let t=0;t<y;t++){const n=v(e,t);if(0===t)m[n]=l?0:g[n];else{const r=v(e,t-1);m[n]=l?g[r]+m[r]:g[n]+m[r]}}const b=n.makeTensorInfo(p.shape,f,m);if(null!=d){const e=r.backend_util.getUndoAxesPermutation(d),t=(0,o.transpose)({inputs:{x:b},backend:n,attrs:{perm:e}});return n.disposeIntermediateTensorInfo(b),n.disposeIntermediateTensorInfo(p),t}return b}t.cumsumConfig={kernelName:r.Cumsum,backendName:"cpu",kernelFunc:s}},120437:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.denseBincount=o,t.denseBincountConfig=void 0;var r=n(735534),a=n(938739);function o(e){const{inputs:t,backend:n,attrs:r}=e,{x:o,weights:s}=t,{size:i,binaryOutput:c}=r;if(1===o.shape.length){const e=n.data.get(o.dataId).values,t=n.data.get(s.dataId).values,r=(0,a.bincountImpl)(e,t,s.dtype,s.shape,i);return n.makeTensorInfo([i],s.dtype,r)}if(2===o.shape.length){const e=n.bufferSync(o),t=n.bufferSync(s),r=(0,a.bincountReduceImpl)(e,t,i,c);return n.makeTensorInfo(r.shape,s.dtype,r.values)}throw new Error("Error in denseBincount: input must be at most rank 2, but got rank"+"".concat(o.shape.length,"."))}t.denseBincountConfig={kernelName:r.DenseBincount,backendName:"cpu",kernelFunc:o}},536523:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.depthToSpace=a,t.depthToSpaceConfig=void 0;var r=n(735534);function a(e){const{inputs:t,backend:n,attrs:a}=e,{x:o}=t,{blockSize:s,dataFormat:i}=a;r.util.assert("NHWC"===i,(()=>"Only NHWC dataFormat supported on CPU for depthToSpace. Got ".concat(i)));const c=o.shape[0],l=o.shape[1],u=o.shape[2],d=o.shape[3],p=l*s,h=u*s,f=d/(s*s),m=n.data.get(o.dataId).values,g=new Float32Array(c*p*h*f);let y=0;for(let e=0;e<c;++e)for(let t=0;t<p;++t){const n=Math.floor(t/s),r=t%s;for(let t=0;t<h;++t){const a=Math.floor(t/s),o=(r*s+t%s)*f;for(let t=0;t<f;++t){const r=t+o+d*(a+u*(n+l*e));g[y++]=m[r]}}}return n.makeTensorInfo([c,p,h,f],o.dtype,g)}t.depthToSpaceConfig={kernelName:r.DepthToSpace,backendName:"cpu",kernelFunc:a}},801295:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.depthwiseConv2dNative=o,t.depthwiseConv2dNativeConfig=void 0;var r=n(735534),a=n(468462);function o(e){const{inputs:t,backend:n,attrs:o}=e,{x:s,filter:i}=t,{strides:c,pad:l,dilations:u,dimRoundingMode:d}=o;(0,a.assertNotComplex)([s,i],"depthwiseConv2DNative");const p=r.util.computeStrides(s.shape),h=r.util.computeStrides(i.shape);let f=u;null==f&&(f=[1,1]),r.util.assert(r.backend_util.eitherStridesOrDilationsAreOne(c,f),(()=>"Error in depthwiseConv2d: Either strides or dilations must be "+"1. Got strides ".concat(c," and dilations '").concat(f,"'")));const m=r.backend_util.computeConv2DInfo(s.shape,i.shape,c,f,l,d,!0),{filterHeight:g,filterWidth:y,dilationHeight:v,dilationWidth:b,padInfo:x}=m,w=x.left,k=x.top,_=m.outChannels/m.inChannels,C=new r.TensorBuffer(m.outShape,s.dtype),P=n.data.get(s.dataId).values,O=n.data.get(i.dataId).values,N=C.values;for(let e=0;e<m.batchSize;++e){const t=e*p[0],n=e*C.strides[0];for(let e=0;e<m.outHeight;++e){const r=n+e*C.strides[1],a=e*m.strideHeight-k;for(let e=0;e<g;++e){const n=a+e*v;if(n<0||n>=m.inHeight)continue;const o=e*h[0],s=t+n*p[1];for(let e=0;e<m.outWidth;++e){const t=r+e*C.strides[2],n=e*m.strideWidth-w;for(let e=0;e<y;++e){const r=n+e*b;if(r<0||r>=m.inWidth)continue;const a=o+e*h[1],i=s+r*m.inChannels;let c=t,l=a;for(let e=0;e<m.inChannels;++e){const t=P[i+e];for(let e=0;e<_;++e)N[c+e]+=t*O[l+e];c+=_,l+=_}}}}}}return n.makeTensorInfo(C.shape,C.dtype,C.values)}t.depthwiseConv2dNativeConfig={kernelName:r.DepthwiseConv2dNative,backendName:"cpu",kernelFunc:o}},469822:(e,t,n)=>{"use strict";
1Object.defineProperty(t,"__esModule",{value:!0}),t.depthwiseConv2dNativeBackpropFilter=o,t.depthwiseConv2dNativeBackpropFilterConfig=void 0;var r=n(735534),a=n(468462);function o(e){const{inputs:t,backend:n,attrs:o}=e,{x:s,dy:i}=t,{strides:c,dilations:l,pad:u,dimRoundingMode:d,filterShape:p}=o;(0,a.assertNotComplex)([s,i],"depthwiseConv2dNativeBackpropFilter");const h=r.backend_util.computeConv2DInfo(s.shape,p,c,l,u,d,!0),{strideHeight:f,strideWidth:m,filterHeight:g,filterWidth:y}=h,v=new r.TensorBuffer(h.filterShape,"float32"),b=h.padInfo.left,x=h.padInfo.top,w=h.outChannels/h.inChannels,k=n.data.get(s.dataId).values,_=new r.TensorBuffer(s.shape,s.dtype,k),C=n.data.get(i.dataId).values,P=new r.TensorBuffer(i.shape,i.dtype,C);for(let e=0;e<g;++e){const t=Math.max(0,Math.ceil((x-e)/f)),n=Math.min(h.outHeight,(h.inHeight+x-e)/f);for(let r=0;r<y;++r){const a=Math.max(0,Math.ceil((b-r)/m)),o=Math.min(h.outWidth,(h.inWidth+b-r)/m);for(let s=0;s<h.outChannels;++s){const i=Math.trunc(s/w),c=s%w;let l=0;for(let c=0;c<h.batchSize;++c)for(let u=t;u<n;++u){const t=e+u*f-x;for(let e=a;e<o;++e){const n=r+e*m-b;l+=_.get(c,t,n,i)*P.get(c,u,e,s)}}v.set(l,e,r,i,c)}}}return n.makeTensorInfo(v.shape,v.dtype,v.values)}t.depthwiseConv2dNativeBackpropFilterConfig={kernelName:r.DepthwiseConv2dNativeBackpropFilter,backendName:"cpu",kernelFunc:o}},837007:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.depthwiseConv2dNativeBackpropInput=o,t.depthwiseConv2dNativeBackpropInputConfig=void 0;var r=n(735534),a=n(468462);function o(e){const{inputs:t,backend:n,attrs:o}=e,{dy:s,filter:i}=t,{strides:c,dilations:l,pad:u,dimRoundingMode:d,inputShape:p}=o;(0,a.assertNotComplex)([s,i],"depthwiseConv2DNativeBackpropInput");const h=r.util.computeStrides(s.shape),f=r.util.computeStrides(i.shape),m=r.backend_util.computeConv2DInfo(p,i.shape,c,l,u,d,!0),g=new r.TensorBuffer(m.inShape,"float32"),y=g.values,[v,b,x]=g.strides,w=n.data.get(s.dataId).values,[k,_,C]=h,P=n.data.get(i.dataId).values,[O,N,I]=f,{batchSize:T,filterHeight:S,filterWidth:E,inChannels:M,inHeight:A,inWidth:D,outChannels:R,outHeight:F,outWidth:j,strideHeight:z,strideWidth:L}=m,V=S-1-m.padInfo.top,G=E-1-m.padInfo.left,B=R/M;for(let e=0;e<T;++e)for(let t=0;t<M;++t)for(let n=0;n<A;++n){const r=n-V,a=Math.max(0,Math.ceil(r/z)),o=Math.min(F,(S+r)/z);for(let s=0;s<D;++s){const i=s-G,c=Math.max(0,Math.ceil(i/L)),l=Math.min(j,(E+i)/L);let u=0;for(let n=a;n<o;++n){const a=n*z-r;
1for(let r=c;r<l;++r){const o=k*e+_*n+C*r,s=O*(S-1-a)+N*(E-1-(r*L-i))+I*t;for(let e=0;e<B;++e){u+=w[o+(t*B+e)]*P[s+e]}}}y[v*e+b*n+x*s+t]=u}}return n.makeTensorInfo(g.shape,g.dtype,g.values)}t.depthwiseConv2dNativeBackpropInputConfig={kernelName:r.DepthwiseConv2dNativeBackpropInput,backendName:"cpu",kernelFunc:o}},423795:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.diag=a,t.diagConfig=void 0;var r=n(735534);function a(e){const{inputs:t,backend:n}=e,{x:a}=t,o=r.util.sizeFromShape(a.shape),s=n.data.get(a.dataId).values,i=(0,r.buffer)([o,o],a.dtype),c=i.values;for(let e=0;e<s.length;e++)c[e*o+e]=s[e];const l=[...a.shape,...a.shape];return n.makeTensorInfo(l,i.dtype,i.values)}t.diagConfig={kernelName:r.Diag,backendName:"cpu",kernelFunc:a}},95523:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.dilation2DConfig=void 0;var r=n(735534);t.dilation2DConfig={kernelName:r.Dilation2D,backendName:"cpu",kernelFunc:e=>{let{inputs:t,backend:n,attrs:a}=e;const{x:o,filter:s}=t,{strides:i,pad:c,dilations:l}=a,u=n,d=u.data.get(o.dataId).values,p=o.shape.length,h=u.data.get(s.dataId).values,f=s.shape.length,{batchSize:m,inHeight:g,inWidth:y,inChannels:v,outHeight:b,outWidth:x,padInfo:w,strideHeight:k,strideWidth:_,filterHeight:C,filterWidth:P,dilationHeight:O,dilationWidth:N,outShape:I}=r.backend_util.computeDilation2DInfo(o.shape,s.shape,i,c,"NHWC",l),T=r.util.sizeFromShape(I),S=I.length,E=r.util.getArrayFromDType(o.dtype,T);for(let e=0;e<m;++e)for(let t=0;t<b;++t){const n=t*k-w.top;for(let a=0;a<x;++a){const i=a*_-w.left;for(let c=0;c<v;++c){let l=Number.MIN_SAFE_INTEGER;for(let t=0;t<C;++t){const a=n+t*O;if(a>=0&&a<g)for(let n=0;n<P;++n){const u=i+n*N;if(u>=0&&u<y){const i=r.util.locToIndex([e,a,u,c],p,r.util.computeStrides(o.shape)),m=r.util.locToIndex([t,n,c],f,r.util.computeStrides(s.shape)),g=d[i]+h[m];g>l&&(l=g)}}}E[r.util.locToIndex([e,t,a,c],S,r.util.computeStrides(I))]=l}}}return{dataId:u.write(r.util.toTypedArray(E,o.dtype),I,o.dtype),shape:I,dtype:o.dtype}}}},829349:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.dilation2DBackpropFilterConfig=void 0;var r=n(735534);t.dilation2DBackpropFilterConfig={kernelName:r.Dilation2DBackpropFilter,backendName:"cpu",kernelFunc:e=>{let{inputs:t,backend:n,attrs:a}=e;const{x:o,filter:s,dy:i}=t,{strides:c,pad:l,dilations:u}=a,d=n,p=r.util.toNestedArray(o.shape,d.data.get(o.dataId).values),h=r.util.toNestedArray(s.shape,d.data.get(s.dataId).values),{batchSize:f,inHeight:m,inWidth:g,inChannels:y,outHeight:v,outWidth:b,padInfo:x,strideHeight:w,strideWidth:k,filterHeight:_,filterWidth:C,dilationHeight:P,dilationWidth:O,outShape:N}=r.backend_util.computeDilation2DInfo(o.shape,s.shape,c,l,"NHWC",u);r.util.assert(i.rank===N.length,(()=>"Error in ".concat(r.Dilation2DBackpropFilter,", dy ")+"must have the same rank as output ".concat(N.length,", but got ")+"".concat(i.rank)));const I=r.util.toNestedArray(N,d.data.get(i.dataId).values),T=r.util.makeZerosNestedTypedArray(s.shape,s.dtype);for(let e=0;e<f;++e)for(let t=0;t<v;++t){const n=t*w-x.top;for(let r=0;r<b;++r){const a=r*k-x.left;for(let o=0;o<y;++o){let s=Number.MIN_SAFE_INTEGER,i=0,c=0;for(let t=0;t<_;++t){const r=n+t*P;if(r>=0&&r<m)for(let n=0;n<C;++n){const l=a+n*O;if(l>=0&&l<g){const a=p[e][r][l][o]+h[t][n][o];a>s&&(s=a,i=t,c=n)}}}T[i][c][o]+=I[e][t][r][o]}}}return{dataId:d.write(r.util.toTypedArray(T,o.dtype),s.shape,s.dtype),shape:s.shape,dtype:s.dtype}}}},215327:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.dilation2DBackpropInputConfig=void 0;var r=n(735534);t.dilation2DBackpropInputConfig={kernelName:r.Dilation2DBackpropInput,backendName:"cpu",kernelFunc:e=>{let{inputs:t,backend:n,attrs:a}=e;const{x:o,filter:s,dy:i}=t,{strides:c,pad:l,dilations:u}=a,d=n,p=r.util.toNestedArray(o.shape,d.data.get(o.dataId).values),h=r.util.toNestedArray(s.shape,d.data.get(s.dataId).values),{batchSize:f,inHeight:m,inWidth:g,inChannels:y,outHeight:v,outWidth:b,padInfo:x,strideHeight:w,strideWidth:k,filterHeight:_,filterWidth:C,dilationHeight:P,dilationWidth:O,outShape:N}=r.backend_util.computeDilation2DInfo(o.shape,s.shape,c,l,"NHWC",u);r.util.assert(i.rank===N.length,(()=>"Error in ".concat(r.Dilation2DBackpropInput,", dy ")+"must have the same rank as output ".concat(N.length,", but got ")+"".concat(i.rank)));const I=r.util.toNestedArray(N,d.data.get(i.dataId).values),T=r.util.makeZerosNestedTypedArray(o.shape,o.dtype);for(let e=0;e<f;++e)for(let t=0;t<v;++t){const n=t*w-x.top;for(let r=0;r<b;++r){const a=r*k-x.left;for(let o=0;o<y;++o){let s=Number.MIN_SAFE_INTEGER,i=n<0?0:n,c=a<0?0:a;for(let t=0;t<_;++t){const r=n+t*P;if(r>=0&&r<m)for(let n=0;n<C;++n){const l=a+n*O;if(l>=0&&l<g){const a=p[e][r][l][o]+h[t][n][o];a>s&&(s=a,i=r,c=l)}}}T[e][i][c][o]+=I[e][t][r][o]}}}return{dataId:d.write(r.util.toTypedArray(T,o.dtype),o.shape,o.dtype),shape:o.shape,dtype:
1o.dtype}}}},148465:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.einsum=c,t.einsumConfig=void 0;var r=n(735534),a=n(418852),o=n(434731),s=n(841964),i=n(437023);function c(e){const{inputs:t,backend:n,attrs:c}=e,{equation:l}=c,u=t,{allDims:d,summedDims:p,idDims:h}=r.backend_util.decodeEinsumEquation(l,u.length);r.backend_util.checkEinsumDimSizes(d.length,h,u);const{path:f,steps:m}=r.backend_util.getEinsumComputePath(p,h),g=m.length;let y=null,v=d.length;const b=[];for(let e=0;e<g;++e){for(const t of m[e]){const{permutationIndices:e,expandDims:s}=r.backend_util.getEinsumPermutation(v,h[t]);let c;r.backend_util.isIdentityPermutation(e)?c=u[t]:(c=(0,i.transpose)({inputs:{x:u[t]},backend:n,attrs:{perm:e}}),b.push(c));const l=c.shape.slice();for(let e=0;e<s.length;++e)l.splice(s[e],0,1);r.util.arraysEqual(c.shape,l)||(c=(0,o.reshape)({inputs:{x:c},backend:n,attrs:{shape:l}}),b.push(c)),null===y?y=c:(y=(0,a.multiply)({inputs:{a:c,b:y},backend:n}),b.push(y))}e<g-1&&(f[e]>=0&&(y=(0,s.sum)({inputs:{x:y},backend:n,attrs:{axis:f[e]-(d.length-v),keepDims:!1}}),b.push(y)),v--)}for(const e of b)e!==y&&n.disposeIntermediateTensorInfo(e);return y}t.einsumConfig={kernelName:r.Einsum,backendName:"cpu",kernelFunc:c}},312547:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.eluConfig=t.elu=void 0;var r=n(735534),a=n(777226);const o=t.elu=(0,a.unaryKernelFunc)(r.Elu,(e=>e>=0?e:Math.exp(e)-1));t.eluConfig={kernelName:r.Elu,backendName:"cpu",kernelFunc:o}},26762:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.eluGrad=o,t.eluGradConfig=void 0;var r=n(735534),a=n(468462);function o(e){const{inputs:t,backend:n}=e,{dy:o,y:s}=t;(0,a.assertNotComplex)([o,s],"eluGrad");const i=new Float32Array(r.util.sizeFromShape(s.shape)),c=n.data.get(s.dataId).values,l=n.data.get(o.dataId).values;for(let e=0;e<c.length;++e){const t=c[e];i[e]=t>=1?l[e]:l[e]*(t+1)}return n.makeTensorInfo(s.shape,"float32",i)}t.eluGradConfig={kernelName:r.EluGrad,backendName:"cpu",kernelFunc:o}},25138:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.equalImpl=t.equalConfig=t.equal=void 0;var r=n(735534),a=n(650179),o=n(3428);const s=t.equalImpl=(0,a.createSimpleBinaryKernelImpl)(((e,t)=>e===t?1:0)),i=t.equal=(0,o.binaryKernelFunc)(r.Equal,s,null,"bool");t.equalConfig={kernelName:r.Equal,backendName:"cpu",kernelFunc:i}},114471:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.erfConfig=t.erf=void 0;var r=n(735534),a=n(777226);const o=r.backend_util.ERF_P,s=r.backend_util.ERF_A1,i=r.backend_util.ERF_A2,c=r.backend_util.ERF_A3,l=r.backend_util.ERF_A4,u=r.backend_util.ERF_A5,d=t.erf=(0,a.unaryKernelFunc)(r.Erf,(e=>{const t=Math.sign(e),n=Math.abs(e),r=1/(1+o*n);return t*(1-((((u*r+l)*r+c)*r+i)*r+s)*r*Math.exp(-n*n))}));t.erfConfig={kernelName:r.Erf,backendName:"cpu",kernelFunc:d}},610260:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.expImpl=t.expConfig=t.exp=void 0;var r=n(735534),a=n(816375),o=n(777226);const s=t.expImpl=(0,a.createSimpleUnaryImpl)((e=>Math.exp(e))),i=t.exp=(0,o.unaryKernelFuncFromImpl)(r.Exp,s,"float32");t.expConfig={kernelName:r.Exp,backendName:"cpu",kernelFunc:i}},178845:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.expandDims=o,t.expandDimsConfig=void 0;var r=n(735534),a=n(434731);function o(e){const{inputs:t,backend:n,attrs:o}=e,{input:s}=t,{dim:i}=o,c=s.shape.length,l=s.shape.slice();let u=i;return i<0&&(r.util.assert(-(c+1)<=i,(()=>"Axis must be in the interval [".concat(-(c+1),", ").concat(c,"]"))),u=c+i+1),l.splice(u,0,1),(0,a.reshape)({inputs:{x:s},backend:n,attrs:{shape:l}})}t.expandDimsConfig={kernelName:r.ExpandDims,backendName:"cpu",kernelFunc:o}},694199:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.expm1Impl=t.expm1Config=t.expm1=void 0;var r=n(735534),a=n(816375),o=n(777226);const s=t.expm1Impl=(0,a.createSimpleUnaryImpl)((e=>Math.expm1(e))),i=t.expm1=(0,o.unaryKernelFuncFromImpl)(r.Expm1,s);t.expm1Config={kernelName:r.Expm1,backendName:"cpu",kernelFunc:i}},329935:(e,t,n)=>{"use strict";
1Object.defineProperty(t,"__esModule",{value:!0}),t.fft=s,t.fftConfig=void 0;var r=n(735534),a=n(327674),o=n(434731);function s(e){const{inputs:t,backend:n}=e,{input:s}=t,i=r.util.sizeFromShape(s.shape),c=s.shape[s.shape.length-1],l=i/c,u=(0,o.reshape)({inputs:{x:s},backend:n,attrs:{shape:[l,c]}}),d=(0,a.fftBatch)(u,!1,n),p=(0,o.reshape)({inputs:{x:d},backend:n,attrs:{shape:s.shape}});return n.disposeIntermediateTensorInfo(u),n.disposeIntermediateTensorInfo(d),p}t.fftConfig={kernelName:r.FFT,backendName:"cpu",kernelFunc:s}},465882:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.fill=a,t.fillConfig=void 0;var r=n(735534);function a(e){const{backend:t,attrs:n}=e,{shape:a,value:o,dtype:s}=n,i=s||r.util.inferDtype(o),c=r.util.getArrayFromDType(i,r.util.sizeFromShape(a));return function(e,t){e.fill(t)}(c,o),t.makeTensorInfo(a,i,c)}t.fillConfig={kernelName:r.Fill,backendName:"cpu",kernelFunc:a}},270499:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.flipLeftRightConfig=void 0;var r=n(735534);t.flipLeftRightConfig={kernelName:r.FlipLeftRight,backendName:"cpu",kernelFunc:e=>{let{inputs:t,attrs:n,backend:a}=e;const{image:o}=t,s=a,i=r.util.getTypedArrayFromDType(o.dtype,r.util.sizeFromShape(o.shape)),[c,l,u,d]=o.shape,p=s.data.get(o.dataId).values;for(let e=0;e<c;e++){const t=e*u*l*d;for(let e=0;e<l;e++){const n=e*(u*d);for(let e=0;e<u;e++){const r=e*d;for(let a=0;a<d;a++){const o=Math.round(u-e-1),s=t+n+r+a;let c=p[s];if(o>=0&&o<u){c=p[t+n+o*d+a]}i[s]=c}}}}return{dataId:s.write(i,o.shape,o.dtype),shape:o.shape,dtype:o.dtype}}}},48169:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.floorImpl=t.floorConfig=t.floor=void 0;var r=n(735534),a=n(816375),o=n(777226);const s=t.floorImpl=(0,a.createSimpleUnaryImpl)((e=>Math.floor(e))),i=t.floor=(0,o.unaryKernelFuncFromImpl)(r.Floor,s);t.floorConfig={kernelName:r.Floor,backendName:"cpu",kernelFunc:i}},262186:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.floorDivImpl=t.floorDivConfig=t.floorDiv=void 0;var r=n(735534),a=n(650179),o=n(3428);const s=t.floorDivImpl=(0,a.createSimpleBinaryKernelImpl)(((e,t)=>Math.floor(e/t))),i=t.floorDiv=(0,o.binaryKernelFunc)(r.FloorDiv,s,null,"int32");t.floorDivConfig={kernelName:r.FloorDiv,backendName:"cpu",kernelFunc:i}},393437:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.fusedConv2D=i,t.fusedConv2DConfig=void 0;var r=n(735534),a=n(238150),o=n(772994),s=n(902119);function i(e){const{inputs:t,backend:n,attrs:r}=e,{x:i,filter:c,bias:l,preluActivationWeights:u}=t,{strides:d,pad:p,dataFormat:h,dilations:f,dimRoundingMode:m,activation:g,leakyreluAlpha:y}=r;let v=(0,s.conv2D)({inputs:{x:i,filter:c},backend:n,attrs:{strides:d,pad:p,dataFormat:h,dilations:f,dimRoundingMode:m}});if(l){const e=v;v=(0,o.add)({inputs:{a:v,b:l},backend:n}),n.disposeIntermediateTensorInfo(e)}if(g){const e=v;v=(0,a.applyActivation)(n,v,g,u,y),n.disposeIntermediateTensorInfo(e)}return v}t.fusedConv2DConfig={kernelName:r.FusedConv2D,backendName:"cpu",kernelFunc:i}},282310:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.fusedDepthwiseConv2D=i,t.fusedDepthwiseConv2DConfig=void 0;var r=n(735534),a=n(238150),o=n(772994),s=n(801295);function i(e){const{inputs:t,backend:n,attrs:r}=e,{x:i,filter:c,bias:l,preluActivationWeights:u}=t,{strides:d,pad:p,dataFormat:h,dilations:f,dimRoundingMode:m,activation:g,leakyreluAlpha:y}=r;let v=(0,s.depthwiseConv2dNative)({inputs:{x:i,filter:c},backend:n,attrs:{strides:d,pad:p,dataFormat:h,dilations:f,dimRoundingMode:m}});if(l){const e=v;v=(0,o.add)({inputs:{a:v,b:l},backend:n}),n.disposeIntermediateTensorInfo(e)}if(g){const e=v;v=(0,a.applyActivation)(n,v,g,u,y),n.disposeIntermediateTensorInfo(e)}return v}t.fusedDepthwiseConv2DConfig={kernelName:r.FusedDepthwiseConv2D,backendName:"cpu",kernelFunc:i}},625505:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.gatherNd=o,t.gatherNdConfig=void 0;var r=n(735534),a=n(433820);function o(e){const{inputs:t,backend:n}=e,{params:o,indices:s}=t,i=r.util.sizeFromShape(o.shape),c=s.shape,l=c[c.length-1],[u,d,p,h]=r.backend_util.prepareAndValidate(o,s);if(0===d)return n.makeTensorInfo(u,o.dtype,[]);const f=n.data.get(s.dataId).values,m=n.bufferSync(o),g=(0,a.gatherNdImpl)(f,m,o.dtype,d,l,p,h,o.shape,i);return n.makeTensorInfo(u,o.dtype,g.values)}t.gatherNdConfig={kernelName:r.GatherNd,backendName:"cpu",kernelFunc:o}},433820:(e,t,n)=>{"use strict";
1Object.defineProperty(t,"__esModule",{value:!0}),t.gatherNdImpl=function(e,t,n,a,o,s,i,c,l){const u=(0,r.buffer)([a,s],n);for(let n=0;n<a;n++){const r=[];let a=0;for(let t=0;t<o;t++){const s=e[n*o+t];a+=s*i[t],r.push(s)}if(a<0||a>=l/s)throw new Error("Invalid indices: ".concat(r," does not index into ").concat(c));for(let e=0;e<s;e++)u.values[n*s+e]=t.get(...t.indexToLoc(a*s+e))}return u};var r=n(735534)},756140:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.gatherV2=i,t.gatherV2Config=void 0;var r=n(735534),a=n(468462),o=n(657985),s=n(434731);function i(e){const{inputs:t,backend:n,attrs:i}=e,{x:c,indices:l}=t,{axis:u,batchDims:d}=i;(0,a.assertNotComplex)([c,l],"gatherV2");const p=r.util.parseAxisParam(u,c.shape)[0],h=n.data.get(l.dataId).values,f=c.shape[p];for(let e=0;e<h.length;++e){const t=h[e];r.util.assert(t<=f-1&&t>=0,(()=>"GatherV2: the index value ".concat(t," is not in [0, ").concat(f-1,"]")))}let m=d;null==d&&(m=0);const g=r.util.sizeFromShape(l.shape),y=r.backend_util.segment_util.collectGatherOpShapeInfo(c,l,p,m),v=(0,s.reshape)({inputs:{x:c},backend:n,attrs:{shape:[y.batchSize,y.outerSize,y.dimSize,y.sliceSize]}}),b=(0,s.reshape)({inputs:{x:l},backend:n,attrs:{shape:[y.batchSize,g/y.batchSize]}}),x=[y.batchSize,y.outerSize,g/y.batchSize,y.sliceSize],w=n.bufferSync(b),k=n.bufferSync(v),_=(0,o.gatherV2Impl)(k,w,x);return n.disposeIntermediateTensorInfo(v),n.disposeIntermediateTensorInfo(b),n.makeTensorInfo(y.outputShape,_.dtype,_.values)}t.gatherV2Config={kernelName:r.GatherV2,backendName:"cpu",kernelFunc:i}},657985:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.gatherV2Impl=function(e,t,n){const a=(0,r.buffer)(n,e.dtype);for(let n=0;n<a.size;++n){const r=a.indexToLoc(n).slice(),o=r[0],s=r[2],i=t.locToIndex([o,s]);r[2]=t.values[i];const c=e.locToIndex(r);0<=c&&c<e.values.length&&(a.values[n]=e.values[c])}return a};var r=n(735534)},849761:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.greaterImpl=t.greaterConfig=t.greater=void 0;var r=n(735534),a=n(650179),o=n(3428);const s=t.greaterImpl=(0,a.createSimpleBinaryKernelImpl)(((e,t)=>e>t?1:0)),i=t.greater=(0,o.binaryKernelFunc)(r.Greater,s,null,"bool");t.greaterConfig={kernelName:r.Greater,backendName:"cpu",kernelFunc:i}},682002:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.greaterEqualImpl=t.greaterEqualConfig=t.greaterEqual=void 0;var r=n(735534),a=n(650179),o=n(3428);const s=t.greaterEqualImpl=(0,a.createSimpleBinaryKernelImpl)(((e,t)=>e>=t?1:0)),i=t.greaterEqual=(0,o.binaryKernelFunc)(r.GreaterEqual,s,null,"bool");t.greaterEqualConfig={kernelName:r.GreaterEqual,backendName:"cpu",kernelFunc:i}},338507:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ifft=s,t.ifftConfig=void 0;var r=n(735534),a=n(327674),o=n(434731);function s(e){const{inputs:t,backend:n}=e,{input:s}=t,i=r.util.sizeFromShape(s.shape),c=s.shape[s.shape.length-1],l=i/c,u=(0,o.reshape)({inputs:{x:s},backend:n,attrs:{shape:[l,c]}}),d=(0,a.fftBatch)(u,!0,n),p=(0,o.reshape)({inputs:{x:d},backend:n,attrs:{shape:s.shape}});return n.disposeIntermediateTensorInfo(u),n.disposeIntermediateTensorInfo(d),p}t.ifftConfig={kernelName:r.IFFT,backendName:"cpu",kernelFunc:s}},848930:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.identity=a,t.identityConfig=void 0;var r=n(735534);function a(e){const{inputs:t,backend:n}=e,{x:r}=t;return n.incRef(r.dataId),{dataId:r.dataId,shape:r.shape,dtype:r.dtype}}t.identityConfig={kernelName:r.Identity,backendName:"cpu",kernelFunc:a}},62202:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.imag=a,t.imagConfig=void 0;var r=n(735534);function a(e){const{inputs:t,backend:n}=e,{input:r}=t,a=n.data.get(r.dataId).complexTensorInfos.imag,o=n.data.get(a.dataId).values;return n.makeTensorInfo(a.shape,a.dtype,o)}t.imagConfig={kernelName:r.Imag,backendName:"cpu",kernelFunc:a}},616197:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.isFiniteConfig=t.isFinite=void 0;var r=n(735534),a=n(777226);const o=t.isFinite=(0,a.unaryKernelFunc)(r.IsFinite,(e=>Number.isFinite(e)?1:0),"bool");t.isFiniteConfig={kernelName:r.IsFinite,backendName:"cpu",kernelFunc:o}},395891:(e,t,n)=>{"use strict";
1Object.defineProperty(t,"__esModule",{value:!0}),t.isInfConfig=t.isInf=void 0;var r=n(735534),a=n(777226);const o=t.isInf=(0,a.unaryKernelFunc)(r.IsInf,(e=>Math.abs(e)===1/0?1:0),"bool");t.isInfConfig={kernelName:r.IsInf,backendName:"cpu",kernelFunc:o}},940800:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.isNaNConfig=t.isNaN=void 0;var r=n(735534),a=n(777226);const o=t.isNaN=(0,a.unaryKernelFunc)(r.IsNan,(e=>Number.isNaN(e)?1:0),"bool");t.isNaNConfig={kernelName:r.IsNan,backendName:"cpu",kernelFunc:o}},298880:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.LRNConfig=void 0,t.lRN=o;var r=n(735534),a=n(468462);function o(e){const{inputs:t,backend:n,attrs:o}=e,{x:s}=t,{depthRadius:i,bias:c,alpha:l,beta:u}=o;(0,a.assertNotComplex)(s,"LRN");const d=s.shape[3],p=d-1,h=n.data.get(s.dataId).values,f=r.util.sizeFromShape(s.shape),m=new Float32Array(f);function g(e){const t=e%d;let n=e-t+Math.max(0,t-i);const r=e-t+Math.min(t+i,p);let a=0;for(;n<=r;n++){const e=h[n];a+=e*e}return a}for(let e=0;e<f;e++){const t=g(e),n=h[e]*Math.pow(c+l*t,-u);m[e]=n}return n.makeTensorInfo(s.shape,s.dtype,m)}t.LRNConfig={kernelName:r.LRN,backendName:"cpu",kernelFunc:o}},492417:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.LRNGradConfig=void 0,t.lRNGrad=o;var r=n(735534),a=n(468462);function o(e){const{inputs:t,backend:n,attrs:o}=e,{x:s,y:i,dy:c}=t,{depthRadius:l,bias:u,alpha:d,beta:p}=o;(0,a.assertNotComplex)(c,"LRNGrad");const h=r.util.sizeFromShape(c.shape),f=c.shape[3],m=n.data.get(c.dataId).values,g=n.data.get(s.dataId).values,y=n.data.get(i.dataId).values,v=new Float32Array(h),b=h;for(let e=0;e<b;e++){const t=e%f,n=e-t+Math.max(0,t-l),r=e-t+Math.min(f,t+l+1);let a=0;for(let e=n;e<r;e++)a+=Math.pow(g[e],2);a=d*a+u;for(let t=n;t<r;t++){let n=-2*d*p*g[t]*y[e]/a;e===t&&(n+=Math.pow(a,-p)),n*=m[e],v[t]+=n}}return n.makeTensorInfo(c.shape,s.dtype,v)}t.LRNGradConfig={kernelName:r.LRNGrad,backendName:"cpu",kernelFunc:o}},207076:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.leakyRelu=o,t.leakyReluConfig=void 0;var r=n(735534),a=n(468462);function o(e){const{inputs:t,backend:n,attrs:o}=e,{x:s}=t,{alpha:i}=o;(0,a.assertNotComplex)([s],"leakyRelu");const c=r.util.sizeFromShape(s.shape),l=n.data.get(s.dataId).values,u=r.util.getTypedArrayFromDType("float32",c);for(let e=0;e<l.length;e++)u[e]=l[e]<0?i*l[e]:l[e];return n.makeTensorInfo(s.shape,"float32",u)}t.leakyReluConfig={kernelName:r.LeakyRelu,backendName:"cpu",kernelFunc:o}},299730:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.lessImpl=t.lessConfig=t.less=void 0;var r=n(735534),a=n(650179),o=n(3428);const s=t.lessImpl=(0,a.createSimpleBinaryKernelImpl)(((e,t)=>e<t?1:0)),i=t.less=(0,o.binaryKernelFunc)(r.Less,s,null,"bool");t.lessConfig={kernelName:r.Less,backendName:"cpu",kernelFunc:i}},490294:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.lessEqualImpl=t.lessEqualConfig=t.lessEqual=void 0;var r=n(735534),a=n(650179),o=n(3428);const s=t.lessEqualImpl=(0,a.createSimpleBinaryKernelImpl)(((e,t)=>e<=t?1:0)),i=t.lessEqual=(0,o.binaryKernelFunc)(r.LessEqual,s,null,"bool");t.lessEqualConfig={kernelName:r.LessEqual,backendName:"cpu",kernelFunc:i}},229978:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.linSpace=o,t.linSpaceConfig=void 0;var r=n(735534),a=n(580553);function o(e){const{backend:t,attrs:n}=e,{start:r,stop:o,num:s}=n,i=(0,a.linSpaceImpl)(r,o,s);return t.makeTensorInfo([i.length],"float32",i)}t.linSpaceConfig={kernelName:r.LinSpace,backendName:"cpu",kernelFunc:o}},580553:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.linSpaceImpl=function(e,t,n){const a=(t-e)/(n-1),o=r.util.makeZerosTypedArray(n,"float32");o[0]=e;for(let e=1;e<o.length;e++)o[e]=o[e-1]+a;return o};var r=n(735534)},865817:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.logImpl=t.logConfig=t.log=void 0;var r=n(735534),a=n(816375),o=n(777226);const s=t.logImpl=(0,a.createSimpleUnaryImpl)((e=>Math.log(e))),i=t.log=(0,o.unaryKernelFuncFromImpl)(r.Log,s);t.logConfig={kernelName:r.Log,backendName:"cpu",kernelFunc:i}},397107:(e,t,n)=>{"use strict";
1Object.defineProperty(t,"__esModule",{value:!0}),t.log1pConfig=t.log1p=void 0;var r=n(735534),a=n(777226);const o=t.log1p=(0,a.unaryKernelFunc)(r.Log1p,(e=>Math.log1p(e)));t.log1pConfig={kernelName:r.Log1p,backendName:"cpu",kernelFunc:o}},926188:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.logicalAndImpl=t.logicalAndConfig=t.logicalAnd=void 0;var r=n(735534),a=n(650179),o=n(3428);const s=t.logicalAndImpl=(0,a.createSimpleBinaryKernelImpl)(((e,t)=>e&&t)),i=t.logicalAnd=(0,o.binaryKernelFunc)(r.LogicalAnd,s,null,"bool");t.logicalAndConfig={kernelName:r.LogicalAnd,backendName:"cpu",kernelFunc:i}},389678:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.logicalNotConfig=t.logicalNot=void 0;var r=n(735534),a=n(777226);const o=t.logicalNot=(0,a.unaryKernelFunc)(r.LogicalNot,(e=>e?0:1),"bool");t.logicalNotConfig={kernelName:r.LogicalNot,backendName:"cpu",kernelFunc:o}},149823:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.logicalOrImpl=t.logicalOrConfig=t.logicalOr=void 0;var r=n(735534),a=n(650179),o=n(3428);const s=t.logicalOrImpl=(0,a.createSimpleBinaryKernelImpl)(((e,t)=>e||t)),i=t.logicalOr=(0,o.binaryKernelFunc)(r.LogicalOr,s,null,"bool");t.logicalOrConfig={kernelName:r.LogicalOr,backendName:"cpu",kernelFunc:i}},446806:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.max=i,t.maxConfig=void 0;var r=n(735534),a=n(468462),o=n(581944),s=n(823574);function i(e){const{inputs:t,backend:n,attrs:i}=e,{x:c}=t,{reductionIndices:l,keepDims:u}=i,d=n;let p=c.shape;const h=p.length,f=r.util.parseAxisParam(l,p);let m=f;const g=r.backend_util.getAxesPermutation(m,h);let y=d.data.get(c.dataId).values;if(null!=g){const e=new Array(h);for(let t=0;t<e.length;t++)e[t]=p[g[t]];y=(0,s.transposeImpl)(y,p,c.dtype,g,e),m=r.backend_util.getInnerMostAxes(m.length,h),p=e}(0,a.assertNotComplex)(c,"max"),r.backend_util.assertAxesAreInnerMostDims("max",m,h);const[v,b]=r.backend_util.computeOutAndReduceShapes(p,m),x=r.util.sizeFromShape(b),w=(0,o.maxImpl)(y,x,v,c.dtype),k=d.write(w,v,c.dtype);let _=v;if(u){_=r.backend_util.expandShapeToKeepDim(v,f)}return{dataId:k,shape:_,dtype:c.dtype}}t.maxConfig={kernelName:r.Max,backendName:"cpu",kernelFunc:i}},1299:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.maxPool=i,t.maxPoolConfig=void 0;var r=n(735534),a=n(468462),o=n(406829),s=n(848930);function i(e){const{inputs:t,backend:n,attrs:i}=e,{x:c}=t;(0,a.assertNotComplex)(c,"maxPool");const{filterSize:l,strides:u,pad:d,dimRoundingMode:p}=i;r.util.assert(r.backend_util.eitherStridesOrDilationsAreOne(u,1),(()=>"Error in maxPool: Either strides or dilations must be 1. "+"Got strides ".concat(u," and dilations '").concat(1,"'")));const h=r.backend_util.computePool2DInfo(c.shape,l,u,1,d,p);let f;if(1===h.filterWidth&&1===h.filterHeight&&r.util.arraysEqual(h.inShape,h.outShape))f=(0,s.identity)({inputs:{x:c},backend:n});else{const e=n.data.get(c.dataId).values,t=r.util.computeStrides(c.shape),a=(0,o.pool)(e,c.shape,c.dtype,t,h,"max");f=n.makeTensorInfo(h.outShape,c.dtype,a.values)}return f}t.maxPoolConfig={kernelName:r.MaxPool,backendName:"cpu",kernelFunc:i}},844078:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.maxPool3D=s,t.maxPool3DConfig=void 0;var r=n(735534),a=n(468462),o=n(406829);function s(e){const{inputs:t,backend:n,attrs:s}=e,{x:i}=t,{filterSize:c,strides:l,pad:u,dimRoundingMode:d,dataFormat:p}=s;(0,a.assertNotComplex)(i,"maxPool3d");const h=r.backend_util.computePool3DInfo(i.shape,c,l,1,u,d,p),f=n.data.get(i.dataId).values,m=(0,o.pool3d)(f,i.shape,i.dtype,r.util.computeStrides(i.shape),h,"max");return n.makeTensorInfo(m.shape,"float32",m.values)}t.maxPool3DConfig={kernelName:r.MaxPool3D,backendName:"cpu",kernelFunc:s}},528676:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.maxPool3DGrad=s,t.maxPool3DGradConfig=void 0;var r=n(735534),a=n(468462),o=n(406829);function s(e){const{inputs:t,backend:n,attrs:s}=e,{dy:i,input:c}=t,{filterSize:l,strides:u,pad:d,dimRoundingMode:p}=s;(0,a.assertNotComplex)([i,c],"maxPool3DGrad");const h=r.backend_util.computePool3DInfo(c.shape,l,u,1,d,p),f=n.bufferSync(c),m=(0,o.maxPool3dPositions)(f,h),g=h.strideDepth,y=h.strideHeight,v=h.strideWidth,b=h.dilationDepth,x=h.dilationHeight,w=h.dilationWidth,k=h.effectiveFilterDepth,_=h.effectiveFilterHeight,C=h.effectiveFilterWidth,P=k-1-h.padInfo.front,O=C-1-h.padInfo.left,N=_-1-h.padInfo.top,I=(0,r.buffer)(c.shape,"float32"),T=n.bufferSync(i);for(let e=0;e<h.batchSize;++e)for(let t=0;t<h.inChannels;++t)for(let n=0;n<h.inDepth;++n)for(let r=0;r<h.inHeight;++r)for(let a=0;a<h.inWidth;++a){const o=n-P,s=r-N,i=a-O;let c=0;for(let n=0;n<k;n+=b){const r=(o+n)/g;if(!(r<0||r>=h.outDepth||Math.floor(r)!==r))for(let a=0;a<_;a+=x){const o=(s+a)/y;if(!(o<0||o>=h.outHeight||Math.floor(o)!==o))for(let s=0;s<C;s+=w){const l=(i+s)/v;if(l<0||l>
1=h.outWidth||Math.floor(l)!==l)continue;const u=k*_*C-1-m.get(e,r,o,l,t)===n*_*C+a*C+s?1:0;if(0===u)continue;c+=T.get(e,r,o,l,t)*u}}}I.set(c,e,n,r,a,t)}return n.makeTensorInfo(I.shape,I.dtype,I.values)}t.maxPool3DGradConfig={kernelName:r.MaxPool3DGrad,backendName:"cpu",kernelFunc:s}},737133:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.maxPoolGrad=s,t.maxPoolGradConfig=void 0;var r=n(735534),a=n(468462),o=n(406829);function s(e){const{inputs:t,backend:n,attrs:s}=e,{dy:i,input:c,output:l}=t,u=c;(0,a.assertNotComplex)([c,l],"maxPoolGrad");const{filterSize:d,strides:p,pad:h,dimRoundingMode:f}=s,m=r.backend_util.computePool2DInfo(u.shape,d,p,1,h,f),g=n.data.get(u.dataId).values,y=(0,r.buffer)(m.outShape,u.dtype,(0,o.maxPoolPositions)(g,u.shape,u.dtype,m).values),v=m.strideHeight,b=m.strideWidth,x=m.dilationHeight,w=m.dilationWidth,k=m.effectiveFilterHeight,_=m.effectiveFilterWidth,C=_-1-m.padInfo.left,P=k-1-m.padInfo.top,O=(0,r.buffer)(u.shape,"float32"),N=n.data.get(i.dataId).values,I=(0,r.buffer)(i.shape,"float32",N);for(let e=0;e<m.batchSize;++e)for(let t=0;t<m.inChannels;++t)for(let n=0;n<m.inHeight;++n)for(let r=0;r<m.inWidth;++r){const a=n-P,o=r-C;let s=0;for(let n=0;n<k;n+=x){const r=(a+n)/v;if(!(r<0||r>=m.outHeight||Math.floor(r)!==r))for(let a=0;a<_;a+=w){const i=(o+a)/b;if(i<0||i>=m.outWidth||Math.floor(i)!==i)continue;const c=k*_-1-y.get(e,r,i,t)===n*_+a?1:0;if(0===c)continue;s+=I.get(e,r,i,t)*c}}O.set(s,e,n,r,t)}return n.makeTensorInfo(O.shape,O.dtype,O.values)}t.maxPoolGradConfig={kernelName:r.MaxPoolGrad,backendName:"cpu",kernelFunc:s}},51812:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.maxPoolWithArgmaxConfig=void 0;var r=n(735534),a=n(468462),o=n(867136);t.maxPoolWithArgmaxConfig={kernelName:r.MaxPoolWithArgmax,backendName:"cpu",kernelFunc:e=>{let{inputs:t,attrs:n,backend:s}=e;const{x:i}=t,{filterSize:c,strides:l,pad:u,includeBatchInIndex:d}=n,p=s;(0,a.assertNotComplex)(i,"MaxPoolWithArgmax");const h=p.data.get(i.dataId).values,f=r.backend_util.computePool2DInfo(i.shape,c,l,[1,1],u),[m,g]=(0,o.maxPoolWithArgmaxImpl)(h,i.shape,i.dtype,d,f),y=p.write(m,f.outShape,i.dtype),v=p.write(g,f.outShape,i.dtype);return[{dataId:y,shape:f.outShape,dtype:i.dtype},{dataId:v,shape:f.outShape,dtype:"int32"}]}}},867136:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.maxPoolWithArgmaxImpl=function(e,t,n,o,s){const i=r.util.computeStrides(t),c=(0,a.pool)(e,t,n,i,s,"max"),l=(0,a.maxPoolPositions)(e,t,n,s,!0,o);return[c.values,l.values]};var r=n(735534),a=n(406829)},581944:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.maxImpl=function(e,t,n,a){const o=r.util.getTypedArrayFromDType(a,r.util.sizeFromShape(n));for(let n=0;n<o.length;++n){const r=n*t;let a=e[r];for(let n=0;n<t;++n){const t=e[r+n];(Number.isNaN(t)||t>a)&&(a=t)}o[n]=a}return o};var r=n(735534)},513231:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.maximumImpl=t.maximumConfig=t.maximum=void 0;var r=n(735534),a=n(650179),o=n(3428);const s=t.maximumImpl=(0,a.createSimpleBinaryKernelImpl)(((e,t)=>Math.max(e,t))),i=t.maximum=(0,o.binaryKernelFunc)(r.Maximum,s);t.maximumConfig={kernelName:r.Maximum,backendName:"cpu",kernelFunc:i}},616187:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.mean=i,t.meanConfig=void 0;var r=n(735534),a=n(764979),o=n(966e3),s=n(841964);function i(e){const{inputs:t,backend:n,attrs:i}=e,{x:c}=t,{axis:l,keepDims:u}=i,d=r.util.parseAxisParam(l,c.shape),p=r.backend_util.computeOutAndReduceShapes(c.shape,d)[1],h=r.util.sizeFromShape(p),f=[],m=n.makeTensorInfo([],"float32",new Float32Array([h]));f.push(m);const g=(0,a.cast)({inputs:{x:c},backend:n,attrs:{dtype:"float32"}});f.push(g);const y=(0,o.div)({inputs:{a:g,b:m},backend:n});f.push(y);const v=(0,s.sum)({inputs:{x:y},backend:n,attrs:{axis:l,keepDims:u}});return f.forEach((e=>n.disposeIntermediateTensorInfo(e))),v}t.meanConfig={kernelName:r.Mean,backendName:"cpu",kernelFunc:i}},699610:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.min=i,t.minConfig=void 0;var r=n(735534),a=n(468462),o=n(434731),s=n(437023);function i(e){const{inputs:t,backend:n,attrs:i}=e,{x:c}=t,{axis:l,keepDims:u}=i;(0,a.assertNotComplex)(c,"min");const d=r.util.parseAxisParam(l,c.shape);let p=d;const h=r.backend_util.getAxesPermutation(p,c.shape.length);let f=c;
1null!=h&&(f=(0,s.transpose)({inputs:{x:c},backend:n,attrs:{perm:h}}),p=r.backend_util.getInnerMostAxes(p.length,c.shape.length)),r.backend_util.assertAxesAreInnerMostDims("min",p,f.shape.length);const[m,g]=r.backend_util.computeOutAndReduceShapes(f.shape,p),y=r.util.sizeFromShape(g),v=r.util.makeZerosTypedArray(r.util.sizeFromShape(m),f.dtype),b=n.data.get(f.dataId).values;for(let e=0;e<v.length;++e){const t=e*y;let n=b[t];for(let e=0;e<y;++e){const r=b[t+e];(Number.isNaN(r)||r<n)&&(n=r)}v[e]=n}null!=h&&n.disposeIntermediateTensorInfo(f);const x=n.makeTensorInfo(m,f.dtype,v);if(u){const e=r.backend_util.expandShapeToKeepDim(m,d),t=(0,o.reshape)({inputs:{x:x},backend:n,attrs:{shape:e}});return n.disposeIntermediateTensorInfo(x),t}return x}t.minConfig={kernelName:r.Min,backendName:"cpu",kernelFunc:i}},703348:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.minimumImpl=t.minimumConfig=t.minimum=void 0;var r=n(735534),a=n(650179),o=n(3428);const s=t.minimumImpl=(0,a.createSimpleBinaryKernelImpl)(((e,t)=>Math.min(e,t))),i=t.minimum=(0,o.binaryKernelFunc)(r.Minimum,s);t.minimumConfig={kernelName:r.Minimum,backendName:"cpu",kernelFunc:i}},13080:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.mirrorPad=o,t.mirrorPadConfig=void 0;var r=n(735534),a=n(468462);function o(e){const{inputs:t,backend:n,attrs:o}=e,{x:s}=t,{paddings:i,mode:c}=o;(0,a.assertNotComplex)(s,"mirrorPad");const l=i.map(((e,t)=>e[0]+s.shape[t]+e[1])),u=i.map((e=>e[0])),d=i.map(((e,t)=>e[0]+s.shape[t])),p="reflect"===c?0:1,h=n.data.get(s.dataId).values,f=s.shape.length,m=r.util.computeStrides(s.shape),g=r.util.sizeFromShape(l),y=l.length,v=r.util.computeStrides(l),b=r.util.getTypedArrayFromDType(s.dtype,g);for(let e=0;e<g;e++){let t=r.util.indexToLoc(e,y,v);for(let e=0;e<y;e++)t[e]<u[e]?t[e]=2*u[e]-t[e]-p:t[e]>=d[e]&&(t[e]=2*(d[e]-1)-t[e]+p);t=t.map(((e,t)=>e-u[t]));const n=r.util.locToIndex(t,f,m);b[e]=h[n]}return{dataId:n.write(b,l,s.dtype),shape:l,dtype:s.dtype}}t.mirrorPadConfig={kernelName:r.MirrorPad,backendName:"cpu",kernelFunc:o}},459648:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.modImpl=t.modConfig=t.mod=void 0;var r=n(735534),a=n(650179),o=n(3428);const s=t.modImpl=(0,a.createSimpleBinaryKernelImpl)(((e,t)=>{const n=e%t;return e<0&&t<0||e>=0&&t>=0?n:(n+t)%t})),i=t.mod=(0,o.binaryKernelFunc)(r.Mod,s);t.modConfig={kernelName:r.Mod,backendName:"cpu",kernelFunc:i}},242e3:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.multinomial=c,t.multinomialConfig=void 0;var r=n(735534),a=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=i(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if("default"!==o&&{}.hasOwnProperty.call(e,o)){var s=a?Object.getOwnPropertyDescriptor(e,o):null;s&&(s.get||s.set)?Object.defineProperty(r,o,s):r[o]=e[o]}return r.default=e,n&&n.set(e,r),r}(n(236377)),o=n(468462),s=n(333174);function i(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(i=function(e){return e?n:t})(e)}function c(e){const{inputs:t,backend:n,attrs:i}=e,{logits:c}=t,{numSamples:l,seed:u,normalized:d}=i;(0,o.assertNotComplex)(c,"multinomial");const p=d?c:(0,s.softmax)({inputs:{logits:c},backend:n,attrs:{dim:-1}}),h=p.shape[0],f=p.shape[1],m=n.data.get(p.dataId).values,g=[h,l],y=r.util.makeZerosTypedArray(r.util.sizeFromShape(g),"int32");for(let e=0;e<h;++e){const t=e*f,n=new Float32Array(f-1);n[0]=m[t];for(let e=1;e<n.length;++e)n[e]=n[e-1]+m[t+e];const r=a.alea(u.toString()),o=e*l;for(let e=0;e<l;++e){const t=r();y[o+e]=n.length;for(let r=0;r<n.length;r++)if(t<n[r]){y[o+e]=r;break}}}return d||n.disposeIntermediateTensorInfo(p),n.makeTensorInfo(g,"int32",y)}t.multinomialConfig={kernelName:r.Multinomial,backendName:"cpu",kernelFunc:c}},418852:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.multiplyImpl=t.multiplyConfig=t.multiplyComplexImpl=t.multiply=void 0;var r=n(735534),a=n(650179),o=n(3428);const s=t.multiplyImpl=(0,a.createSimpleBinaryKernelImpl)(((e,t)=>e*t)),i=t.multiplyComplexImpl=(0,o.createComplexBinaryKernelImpl)(((e,t,n,r)=>({real:e*n-t*r,imag:e*r+t*n}))),c=t.multiply=(0,o.binaryKernelFunc)(r.Multiply,s,i);t.multiplyConfig={kernelName:r.Multiply,backendName:"cpu",kernelFunc:c}},725965:(e,t,n)=>{"use strict";
1Object.defineProperty(t,"__esModule",{value:!0}),t.neg=i,t.negConfig=void 0,t.negImpl=s;var r=n(735534),a=n(468462),o=n(418852);function s(e,t,n){const a=r.util.createScalarValue(-1,n);return(0,o.multiplyImpl)([],t,a,e,n)}function i(e){const{inputs:t,backend:n}=e,{x:r}=t;(0,a.assertNotComplex)(r,"neg");const o=n.data.get(r.dataId).values,[i,c]=s(o,r.shape,r.dtype);return n.makeTensorInfo(c,r.dtype,i)}t.negConfig={kernelName:r.Neg,backendName:"cpu",kernelFunc:i}},654236:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.nonMaxSuppressionV3=s,t.nonMaxSuppressionV3Config=void 0;var r=n(735534),a=n(468462);const o=r.kernel_impls.nonMaxSuppressionV3Impl;function s(e){const{inputs:t,backend:n,attrs:r}=e,{boxes:s,scores:i}=t,{maxOutputSize:c,iouThreshold:l,scoreThreshold:u}=r;(0,a.assertNotComplex)(s,"NonMaxSuppression");const d=n.data.get(s.dataId).values,p=n.data.get(i.dataId).values,{selectedIndices:h}=o(d,p,c,l,u);return n.makeTensorInfo([h.length],"int32",new Int32Array(h))}t.nonMaxSuppressionV3Config={kernelName:r.NonMaxSuppressionV3,backendName:"cpu",kernelFunc:s}},174127:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.nonMaxSuppressionV4=s,t.nonMaxSuppressionV4Config=void 0;var r=n(735534),a=n(468462);const o=r.kernel_impls.nonMaxSuppressionV4Impl;function s(e){const{inputs:t,backend:n,attrs:r}=e,{boxes:s,scores:i}=t,{maxOutputSize:c,iouThreshold:l,scoreThreshold:u,padToMaxOutputSize:d}=r;(0,a.assertNotComplex)(s,"NonMaxSuppressionPadded");const p=n.data.get(s.dataId).values,h=n.data.get(i.dataId).values,{selectedIndices:f,validOutputs:m}=o(p,h,c,l,u,d);return[n.makeTensorInfo([f.length],"int32",new Int32Array(f)),n.makeTensorInfo([],"int32",new Int32Array([m]))]}t.nonMaxSuppressionV4Config={kernelName:r.NonMaxSuppressionV4,backendName:"cpu",kernelFunc:s}},66157:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.nonMaxSuppressionV5=s,t.nonMaxSuppressionV5Config=void 0;var r=n(735534),a=n(468462);const o=r.kernel_impls.nonMaxSuppressionV5Impl;function s(e){const{inputs:t,backend:n,attrs:r}=e,{boxes:s,scores:i}=t,{maxOutputSize:c,iouThreshold:l,scoreThreshold:u,softNmsSigma:d}=r;(0,a.assertNotComplex)(s,"NonMaxSuppressionWithScore");const p=n.data.get(s.dataId).values,h=n.data.get(i.dataId).values,f=c,m=l,g=u,y=d,{selectedIndices:v,selectedScores:b}=o(p,h,f,m,g,y);return[n.makeTensorInfo([v.length],"int32",new Int32Array(v)),n.makeTensorInfo([b.length],"float32",new Float32Array(b))]}t.nonMaxSuppressionV5Config={kernelName:r.NonMaxSuppressionV5,backendName:"cpu",kernelFunc:s}},69268:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.notEqualImpl=t.notEqualConfig=t.notEqual=void 0;var r=n(735534),a=n(650179),o=n(3428);const s=t.notEqualImpl=(0,a.createSimpleBinaryKernelImpl)(((e,t)=>e!==t?1:0)),i=t.notEqual=(0,o.binaryKernelFunc)(r.NotEqual,s,null,"bool");t.notEqualConfig={kernelName:r.NotEqual,backendName:"cpu",kernelFunc:i}},965707:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.oneHot=o,t.oneHotConfig=void 0;var r=n(735534),a=n(468462);function o(e){const{inputs:t,backend:n,attrs:o}=e,{indices:s}=t,{depth:i,onValue:c,offValue:l}=o;(0,a.assertNotComplex)(s,"oneHot");const u=r.util.sizeFromShape(s.shape),d=new Float32Array(u*i);d.fill(l);const p=n.data.get(s.dataId).values;for(let e=0;e<u;++e)p[e]>=0&&p[e]<i&&(d[e*i+p[e]]=c);return n.makeTensorInfo([...s.shape,i],"int32",d)}t.oneHotConfig={kernelName:r.OneHot,backendName:"cpu",kernelFunc:o}},993894:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.onesLike=l,t.onesLikeConfig=void 0;var r=n(735534),a=n(795801),o=n(465882),s=n(62202),i=n(357858),c=n(516756);function l(e){const{inputs:t,backend:n}=e,{x:r}=t;if("string"===r.dtype)throw new Error("onesLike is not supported for string tensors");
1if("complex64"===r.dtype){const e=(0,i.real)({inputs:{input:r},backend:n}),t=l({inputs:{x:e},backend:n}),o=(0,s.imag)({inputs:{input:r},backend:n}),u=(0,c.zerosLike)({inputs:{x:o},backend:n}),d=(0,a.complex)({inputs:{real:t,imag:u},backend:n});return n.disposeIntermediateTensorInfo(e),n.disposeIntermediateTensorInfo(t),n.disposeIntermediateTensorInfo(o),n.disposeIntermediateTensorInfo(u),d}return(0,o.fill)({backend:n,attrs:{shape:r.shape,value:1,dtype:r.dtype}})}t.onesLikeConfig={kernelName:r.OnesLike,backendName:"cpu",kernelFunc:l}},10759:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.pack=s,t.packConfig=void 0;var r=n(735534),a=n(432930),o=n(178845);function s(e){const{inputs:t,backend:n,attrs:s}=e,{axis:i}=s;if(1===t.length)return(0,o.expandDims)({inputs:{input:t[0]},backend:n,attrs:{dim:i}});const c=t[0].shape,l=t[0].dtype;t.forEach((e=>{r.util.assertShapesMatch(c,e.shape,"All tensors passed to stack must have matching shapes"),r.util.assert(l===e.dtype,(()=>"All tensors passed to stack must have matching dtypes"))}));const u=[],d=t.map((e=>{const t=(0,o.expandDims)({inputs:{input:e},backend:n,attrs:{dim:i}});return u.push(t),t})),p=(0,a.concat)({inputs:d,backend:n,attrs:{axis:i}});return u.forEach((e=>n.disposeIntermediateTensorInfo(e))),p}t.packConfig={kernelName:r.Pack,backendName:"cpu",kernelFunc:s}},795276:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.padV2=o,t.padV2Config=void 0;var r=n(735534),a=n(468462);function o(e){const{inputs:t,backend:n,attrs:o}=e,{x:s}=t,{paddings:i,constantValue:c}=o;(0,a.assertNotComplex)(s,"pad");const l=i.map(((e,t)=>e[0]+s.shape[t]+e[1])),u=i.map((e=>e[0])),d=n.data.get(s.dataId).values,p=r.util.sizeFromShape(s.shape),h=s.shape.length,f=r.util.computeStrides(s.shape),m=r.util.sizeFromShape(l),g=l.length,y=r.util.computeStrides(l),v=r.util.getTypedArrayFromDType(s.dtype,m);0!==c&&v.fill(c);for(let e=0;e<p;e++){const t=r.util.indexToLoc(e,h,f).map(((e,t)=>e+u[t]));v[r.util.locToIndex(t,g,y)]=d[e]}return{dataId:n.write(v,l,s.dtype),shape:l,dtype:s.dtype}}t.padV2Config={kernelName:r.PadV2,backendName:"cpu",kernelFunc:o}},90811:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.powImpl=t.powConfig=t.pow=void 0;var r=n(735534),a=n(650179),o=n(3428);const s=t.powImpl=(0,a.createSimpleBinaryKernelImpl)(((e,t)=>Math.pow(e,t))),i=t.pow=(0,o.binaryKernelFunc)(r.Pow,s);t.powConfig={kernelName:r.Pow,backendName:"cpu",kernelFunc:i}},248803:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.prelu=s,t.preluConfig=void 0;var r=n(735534),a=n(468462);const o=(0,n(650179).createSimpleBinaryKernelImpl)(((e,t)=>e<0?t*e:e));function s(e){const{inputs:t,backend:n}=e,{x:r,alpha:s}=t;(0,a.assertNotComplex)([r,s],"prelu");const i=n.data.get(r.dataId).values,c=n.data.get(s.dataId).values,[l,u]=o(r.shape,s.shape,i,c,"float32");return n.makeTensorInfo(u,"float32",l)}t.preluConfig={kernelName:r.Prelu,backendName:"cpu",kernelFunc:s}},533:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.prod=i,t.prodConfig=void 0,t.prodImpl=s;var r=n(735534),a=n(468462),o=n(437023);function s(e,t,n,a){const[o,s]=r.backend_util.computeOutAndReduceShapes(e,a),i=(0,r.upcastType)(t,"int32"),c=r.util.makeZerosTypedArray(r.util.sizeFromShape(o),i),l=r.util.sizeFromShape(s);for(let e=0;e<c.length;++e){const t=e*l;let r=1;for(let e=0;e<l;++e)r*=n[t+e];c[e]=r}return{outVals:c,outShape:o,outDtype:i}}function i(e){const{inputs:t,backend:n,attrs:i}=e,{x:c}=t,{axis:l,keepDims:u}=i;(0,a.assertNotComplex)(c,"prod");const d=c.shape.length,p=r.util.parseAxisParam(l,c.shape),h=r.backend_util.getAxesPermutation(p,d);let f=p,m=c;const g=[];
1null!=h&&(m=(0,o.transpose)({inputs:{x:c},backend:n,attrs:{perm:h}}),g.push(m),f=r.backend_util.getInnerMostAxes(f.length,d));const y=n.data.get(m.dataId).values,{outVals:v,outShape:b,outDtype:x}=s(m.shape,m.dtype,y,f);let w=b;return u&&(w=r.backend_util.expandShapeToKeepDim(b,p)),g.forEach((e=>n.disposeIntermediateTensorInfo(e))),n.makeTensorInfo(w,x,v)}t.prodConfig={kernelName:r.Prod,backendName:"cpu",kernelFunc:i}},221970:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.range=o,t.rangeConfig=void 0;var r=n(735534),a=n(387715);function o(e){const{backend:t,attrs:n}=e,{start:r,stop:o,dtype:s,step:i}=n,c=(0,a.rangeImpl)(r,o,i,s);return t.makeTensorInfo([c.length],s,c)}t.rangeConfig={kernelName:r.Range,backendName:"cpu",kernelFunc:o}},387715:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.rangeImpl=function(e,t,n,a){const o=e<t&&n<0,s=t<e&&n>1;if(e===t||o||s)return r.util.makeZerosTypedArray(0,a);const i=Math.abs(Math.ceil((t-e)/n)),c=r.util.makeZerosTypedArray(i,a);t<e&&1===n&&(n=-1);c[0]=e;for(let e=1;e<c.length;e++)c[e]=c[e-1]+n;return c};var r=n(735534)},357858:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.real=a,t.realConfig=void 0;var r=n(735534);function a(e){const{inputs:t,backend:n}=e,{input:r}=t,a=n.data.get(r.dataId).complexTensorInfos.real,o=n.data.get(a.dataId).values;return n.makeTensorInfo(a.shape,a.dtype,o)}t.realConfig={kernelName:r.Real,backendName:"cpu",kernelFunc:a}},966e3:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.realDivImpl=t.realDivConfig=t.div=void 0;var r=n(735534),a=n(650179),o=n(3428);const s=t.realDivImpl=(0,a.createSimpleBinaryKernelImpl)(((e,t)=>e/t)),i=t.div=(0,o.binaryKernelFunc)(r.RealDiv,s);t.realDivConfig={kernelName:r.RealDiv,backendName:"cpu",kernelFunc:i}},98728:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.reciprocalConfig=t.reciprocal=void 0;var r=n(735534),a=n(777226);const o=t.reciprocal=(0,a.unaryKernelFunc)(r.Reciprocal,(e=>1/e));t.reciprocalConfig={kernelName:r.Reciprocal,backendName:"cpu",kernelFunc:o}},3773:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.reluConfig=t.relu=void 0;var r=n(735534),a=n(777226);const o=t.relu=(0,a.unaryKernelFunc)(r.Relu,(e=>Math.max(0,e)));t.reluConfig={kernelName:r.Relu,backendName:"cpu",kernelFunc:o}},543707:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.relu6Config=t.relu6=void 0;var r=n(735534),a=n(777226);const o=t.relu6=(0,a.unaryKernelFunc)(r.Relu6,(e=>Math.min(Math.max(0,e),6)));t.relu6Config={kernelName:r.Relu6,backendName:"cpu",kernelFunc:o}},434731:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.reshape=a,t.reshapeConfig=void 0;var r=n(735534);function a(e){const{inputs:t,backend:n,attrs:a}=e,{x:o}=t,{shape:s}=a,i=r.util.sizeFromShape(o.shape),c=r.util.inferFromImplicitShape(s,i),l=r.util.sizeFromShape(c);r.util.assert(i===l,(()=>"The new shape (".concat(c,") has ").concat(l," elements and the old ")+"shape (".concat(o.shape,") has ").concat(i," elements. The new shape and old ")+"shape must have the same number of elements.")),n.incRef(o.dataId);const u=n.data.get(o.dataId);if(null!=u.complexTensorInfos){const e=u.complexTensorInfos.real,t=u.complexTensorInfos.imag;e.shape=c,t.shape=c}return{dataId:o.dataId,shape:c,dtype:o.dtype}}t.reshapeConfig={kernelName:r.Reshape,backendName:"cpu",kernelFunc:a}},402659:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.resizeBilinear=o,t.resizeBilinearConfig=void 0;var r=n(735534),a=n(468462);function o(e){const{inputs:t,backend:n,attrs:o}=e,{images:s}=t,{alignCorners:i,halfPixelCenters:c,size:l}=o;(0,a.assertNotComplex)(s,"resizeBilinear");const u=r.util.computeStrides(s.shape),[d,p]=l,[h,f,m,g]=s.shape,y=n.data.get(s.dataId).values,v=new Float32Array(r.util.sizeFromShape([h,d,p,g])),b=[i&&d>1?f-1:f,i&&p>1?m-1:m],x=[i&&d>1?d-1:d,i&&p>1?p-1:p];let w=0;const k=b[0]/x[0],_=b[1]/x[1];for(let e=0;e<h;e++)for(let t=0;t<d;t++){let n;n=c?k*(t+.5)-.5:k*t;const r=Math.max(0,Math.floor(n)),a=n-r,o=Math.min(f-1,Math.ceil(n)),s=e*u[0]+r*u[1],i=e*u[0]+o*u[1];for(let e=0;e<p;e++){let t;t=c?_*(e+.5)-.5:_*e;const n=Math.max(0,Math.floor(t)),r=t-n,o=Math.min(m-1,Math.ceil(t)),l=s+n*u[2],d=i+n*u[2],p=s+o*u[2],h=i+o*u[2];for(let e=0;e<g;e++){const t=y[l+e],n=y[d+e],o=t+(y[p+e]-t)*r,s=o+(n+(y[h+e]-n)*r-o)*a;v[w++]=s}}}return n.makeTensorInfo([h,d,p,g],"float32",v)}
1t.resizeBilinearConfig={kernelName:r.ResizeBilinear,backendName:"cpu",kernelFunc:o}},339309:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.resizeBilinearGrad=o,t.resizeBilinearGradConfig=void 0;var r=n(735534),a=n(468462);function o(e){const{inputs:t,backend:n,attrs:o}=e,{images:s,dy:i}=t,{alignCorners:c}=o;(0,a.assertNotComplex)([i,s],"resizeBilinearGrad");const l=r.util.computeStrides(s.shape),[u,d,p,h]=s.shape,[,f,m]=i.shape,g=new Float32Array(u*d*p*h),y=[c&&f>1?d-1:d,c&&m>1?p-1:p],v=[c&&f>1?f-1:f,c&&m>1?m-1:m],b=y[0]/v[0],x=y[1]/v[1],w=n.data.get(i.dataId).values;let k=0;for(let e=0;e<u;e++){const t=e*l[0];for(let e=0;e<f;e++){const n=e*b,r=Math.floor(n),a=Math.min(Math.ceil(n),d-1),o=t+r*l[1],s=t+a*l[1],i=n-r,c=1-i;for(let e=0;e<m;e++){const t=e*x,n=Math.floor(t),r=Math.min(Math.ceil(t),p-1),a=t-n,u=1-a,d=o+n*l[2],f=o+r*l[2],m=s+n*l[2],y=s+r*l[2],v=c*u,b=c*a,_=i*u,C=i*a;for(let e=0;e<h;e++){const t=w[k++];g[d+e]+=t*v,g[f+e]+=t*b,g[m+e]+=t*_,g[y+e]+=t*C}}}}return n.makeTensorInfo([u,p,d,h],"float32",g)}t.resizeBilinearGradConfig={kernelName:r.ResizeBilinearGrad,backendName:"cpu",kernelFunc:o}},731970:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.resizeNearestNeighbor=o,t.resizeNearestNeighborConfig=void 0;var r=n(735534),a=n(468462);function o(e){const{inputs:t,backend:n,attrs:o}=e,{images:s}=t,{alignCorners:i,halfPixelCenters:c,size:l}=o;(0,a.assertNotComplex)(s,"resizeNearestNeighbor");const u=r.util.computeStrides(s.shape),[d,p]=l,[h,f,m,g]=s.shape,y=n.data.get(s.dataId).values,v=new Float32Array(h*d*p*g),b=[i&&d>1?f-1:f,i&&p>1?m-1:m],x=[i&&d>1?d-1:d,i&&p>1?p-1:p],w=b[0]/x[0],k=b[1]/x[1];let _=0;for(let e=0;e<h;e++){const t=e*u[0];for(let e=0;e<d;e++){const n=c?w*(e+.5):w*e;let r=Math.min(f-1,i?Math.round(n):Math.floor(n));c&&(r=Math.max(0,r));const a=t+r*u[1];for(let e=0;e<p;e++){const t=c?k*(e+.5):k*e;let n=Math.min(m-1,i?Math.round(t):Math.floor(t));c&&(n=Math.max(0,n));const r=a+n*u[2];for(let e=0;e<g;e++){const t=y[r+e];v[_++]=t}}}}return n.makeTensorInfo([h,d,p,g],s.dtype,v)}t.resizeNearestNeighborConfig={kernelName:r.ResizeNearestNeighbor,backendName:"cpu",kernelFunc:o}},680198:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.resizeNearestNeighborGrad=o,t.resizeNearestNeighborGradConfig=void 0;var r=n(735534),a=n(468462);function o(e){const{inputs:t,backend:n,attrs:o}=e,{images:s,dy:i}=t,{alignCorners:c}=o;(0,a.assertNotComplex)([i,s],"resizeNearestNeighborGrad");const l=r.util.computeStrides(s.shape),u=r.util.computeStrides(i.shape),[d,p,h,f]=s.shape,[,m,g]=i.shape,y=new Float32Array(d*p*h*f),v=n.data.get(i.dataId).values,b=[c&&m>1?p-1:p,c&&g>1?h-1:h],x=[c&&m>1?m-1:m,c&&g>1?g-1:g],w=b[0]/x[0],k=b[1]/x[1],_=1/w,C=1/k,P=2*Math.ceil(_)+2,O=2*Math.ceil(C)+2;for(let e=0;e<d;e++){const t=e*l[0];for(let e=0;e<p;e++){const n=t+e*l[1],r=Math.floor(e*_),a=Math.floor(r-P/2);for(let r=0;r<h;r++){const o=n+r*l[2],s=Math.floor(r*C),i=Math.floor(s-O/2);for(let n=0;n<f;n++){let s=0;for(let o=0;o<P;o++){const l=o+a;if(l<0||l>=m)continue;const d=t+l*u[1],f=l*w;if(e===Math.min(p-1,c?Math.round(f):Math.floor(f)))for(let e=0;e<O;e++){const t=e+i;if(t<0||t>=g)continue;const a=d+t*u[2],o=t*k;r===Math.min(h-1,c?Math.round(o):Math.floor(o))&&(s+=v[a+n])}}y[o+n]=s}}}}return n.makeTensorInfo(s.shape,s.dtype,y)}t.resizeNearestNeighborGradConfig={kernelName:r.ResizeNearestNeighborGrad,backendName:"cpu",kernelFunc:o}},157143:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.reverse=s,t.reverseConfig=void 0;var r=n(735534),a=n(468462),o=n(848930);function s(e){const{inputs:t,backend:n,attrs:s}=e,{x:i}=t,{dims:c}=s;(0,a.assertNotComplex)(i,"reverse");const l=i.shape.length,u=r.util.parseAxisParam(c,i.shape);if(0===l)return(0,o.identity)({inputs:{x:i},backend:n});const d=new r.TensorBuffer(i.shape,i.dtype),p=n.bufferSync(i);for(let e=0;e<d.size;e++){const t=d.indexToLoc(e),n=t.slice();u.forEach((e=>n[e]=i.shape[e]-1-n[e])),d.set(p.get(...n),...t)}return n.makeTensorInfo(d.shape,d.dtype,d.values)}t.reverseConfig={kernelName:r.Reverse,backendName:"cpu",kernelFunc:s}}
1,489099:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.rotateWithOffsetConfig=void 0;var r=n(735534);t.rotateWithOffsetConfig={kernelName:r.RotateWithOffset,backendName:"cpu",kernelFunc:e=>{let{inputs:t,attrs:n,backend:a}=e;const{image:o}=t,{radians:s,fillValue:i,center:c}=n,l=a,u=r.util.getTypedArrayFromDType(o.dtype,r.util.sizeFromShape(o.shape)),[d,p,h,f]=o.shape,[m,g]=r.backend_util.getImageCenter(c,p,h),y=Math.sin(s),v=Math.cos(s),b=l.data.get(o.dataId).values;for(let e=0;e<d;e++){const t=e*h*p*f;for(let e=0;e<p;e++){const n=e*(h*f);for(let r=0;r<h;r++){const a=r*f;for(let o=0;o<f;o++){const s=[d,e,r,o],c=s[2],l=s[1];let x=(c-m)*v-(l-g)*y,w=(c-m)*y+(l-g)*v;x=Math.round(x+m),w=Math.round(w+g);let k=i;if("number"!=typeof i&&(k=3===o?255:i[o]),x>=0&&x<h&&w>=0&&w<p){k=b[t+w*(h*f)+x*f+o]}u[t+n+a+o]=k}}}}return{dataId:l.write(u,o.shape,o.dtype),shape:o.shape,dtype:o.dtype}}}},117549:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.roundConfig=t.round=void 0;var r=n(735534),a=n(777226);const o=t.round=(0,a.unaryKernelFunc)(r.Round,(e=>{const t=Math.floor(e);return e-t<.5?Math.floor(e):e-t>.5?Math.ceil(e):t%2==0?t:t+1}));t.roundConfig={kernelName:r.Round,backendName:"cpu",kernelFunc:o}},93847:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.rsqrtImpl=t.rsqrtConfig=t.rsqrt=void 0;var r=n(735534),a=n(816375),o=n(777226);const s=t.rsqrtImpl=(0,a.createSimpleUnaryImpl)((e=>1/Math.sqrt(e))),i=t.rsqrt=(0,o.unaryKernelFuncFromImpl)(r.Rsqrt,s);t.rsqrtConfig={kernelName:r.Rsqrt,backendName:"cpu",kernelFunc:i}},297714:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.scatterNd=o,t.scatterNdConfig=void 0;var r=n(735534),a=n(936239);function o(e){const{inputs:t,backend:n,attrs:o}=e,{indices:s,updates:i}=t,{shape:c}=o,{sliceRank:l,numUpdates:u,sliceSize:d,strides:p,outputSize:h}=r.backend_util.calculateShapes(i,s,c),f=n.bufferSync(s),m=n.bufferSync(i),g=(0,a.scatterImpl)(f,m,c,h,d,u,l,p,0,!0);return n.makeTensorInfo(c,g.dtype,g.values)}t.scatterNdConfig={kernelName:r.ScatterNd,backendName:"cpu",kernelFunc:o}},936239:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.scatterImpl=function(e,t,n,a,o,s,i,c,l,u){const d=[a/o,o],p=e.values,h=t.values;if(0===a)return(0,r.buffer)(n,t.dtype);const f=(0,r.buffer)(d,t.dtype);f.values.fill(l);for(let e=0;e<s;e++){const r=[];let s=0;for(let t=0;t<i;t++){const n=p[e*i+t];r.push(n),s+=n*c[t]}if(s<0||s>=a/o)throw new Error("Invalid indices: ".concat(r," does not index into ").concat(n));for(let n=0;n<o;n++)u?f.values[s*o+n]+=h[e*o+n]:f.values[s*o+n]=0===t.rank?h[0]:h[e*o+n]}return f};var r=n(735534)},274901:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.select=o,t.selectConfig=void 0;var r=n(735534),a=n(468462);function o(e){const{inputs:t,backend:n}=e,{condition:o,t:s,e:i}=t;(0,a.assertNotComplex)([o,s,i],"select");const c=o.shape.length,l=n.data.get(o.dataId).values,u=n.data.get(s.dataId).values,d=n.data.get(i.dataId).values,p=(0,r.upcastType)(s.dtype,i.dtype),h=r.util.makeZerosTypedArray(r.util.sizeFromShape(s.shape),p);let f=0;const m=0===c||c>1||1===s.shape.length?1:r.util.sizeFromShape(s.shape.slice(1));for(let e=0;e<l.length;e++)for(let t=0;t<m;t++)1===l[e]?h[f++]=u[e]:h[f++]=d[e];return n.makeTensorInfo(s.shape,p,h)}t.selectConfig={kernelName:r.Select,backendName:"cpu",kernelFunc:o}},247008:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.seluConfig=t.selu=void 0;var r=n(735534),a=n(777226);const o=r.backend_util.SELU_SCALEALPHA,s=r.backend_util.SELU_SCALE,i=t.selu=(0,a.unaryKernelFunc)(r.Selu,(e=>e>=0?s*e:o*(Math.exp(e)-1)));t.seluConfig={kernelName:r.Selu,backendName:"cpu",kernelFunc:i}},879468:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.sigmoidImpl=t.sigmoidConfig=t.sigmoid=void 0;var r=n(735534),a=n(816375),o=n(777226);t.sigmoidImpl=(0,a.createSimpleUnaryImpl)((e=>1/(1+Math.exp(-e))));const s=t.sigmoid=(0,o.unaryKernelFunc)(r.Sigmoid,(e=>1/(1+Math.exp(-e))));t.sigmoidConfig={kernelName:r.Sigmoid,backendName:"cpu",kernelFunc:s}},324896:(e,t,n)=>{"use strict";
1Object.defineProperty(t,"__esModule",{value:!0}),t.signConfig=t.sign=void 0;var r=n(735534),a=n(777226);const o=t.sign=(0,a.unaryKernelFunc)(r.Sign,(e=>e<0?-1:e>0?1:0));t.signConfig={kernelName:r.Sign,backendName:"cpu",kernelFunc:o}},822566:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.sinConfig=t.sin=void 0;var r=n(735534),a=n(777226);const o=t.sin=(0,a.unaryKernelFunc)(r.Sin,(e=>Math.sin(e)));t.sinConfig={kernelName:r.Sin,backendName:"cpu",kernelFunc:o}},487874:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.sinhConfig=t.sinh=void 0;var r=n(735534),a=n(777226);const o=t.sinh=(0,a.unaryKernelFunc)(r.Sinh,(e=>Math.sinh(e)));t.sinhConfig={kernelName:r.Sinh,backendName:"cpu",kernelFunc:o}},910875:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.slice=s,t.sliceConfig=void 0,t.sliceImpl=o;var r=n(735534),a=n(468462);function o(e,t,n,a,o){const s=r.slice_util.isSliceContinous(a,t,n),i=r.util.sizeFromShape(n),c=r.util.computeStrides(a);if(s){const n=r.slice_util.computeFlatOffset(t,c);return"string"===o?e.slice(n,n+i):e.subarray(n,n+i)}const l="string"===o?r.backend_util.fromUint8ToStringArray(e):e,u=(0,r.buffer)(a,o,l),d=(0,r.buffer)(n,o);for(let e=0;e<d.size;++e){const n=d.indexToLoc(e),r=n.map(((e,n)=>e+t[n]));d.set(u.get(...r),...n)}return"string"===o?r.backend_util.fromStringArrayToUint8(d.values):d.values}function s(e){const{inputs:t,backend:n,attrs:s}=e,{x:i}=t,{begin:c,size:l}=s;(0,a.assertNotComplex)(i,"slice");const[u,d]=r.slice_util.parseSliceParams(i,c,l);r.slice_util.assertParamsValid(i,u,d);const p=o(n.data.get(i.dataId).values,u,d,i.shape,i.dtype);return n.makeTensorInfo(d,i.dtype,p)}t.sliceConfig={kernelName:r.Slice,backendName:"cpu",kernelFunc:s}},333174:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.softmax=u,t.softmaxConfig=void 0;var r=n(735534),a=n(610260),o=n(446806),s=n(966e3),i=n(434731),c=n(471503),l=n(841964);function u(e){const{inputs:t,backend:n,attrs:u}=e,{logits:d}=t,{dim:p}=u,h=d.shape.length;let f=p;if(-1===f&&(f=h-1),f!==h-1)throw Error("Softmax along a non-last dimension is not yet supported. "+"Logits was rank ".concat(h," and dim was ").concat(f));const m=r.util.parseAxisParam([f],d.shape),g=(0,o.max)({inputs:{x:d},backend:n,attrs:{reductionIndices:m,keepDims:!1}}),y=r.backend_util.expandShapeToKeepDim(g.shape,m),v=(0,i.reshape)({inputs:{x:g},backend:n,attrs:{shape:y}}
1),b=(0,c.sub)({inputs:{a:d,b:v},backend:n}),x=(0,a.exp)({inputs:{x:b},backend:n}),w=(0,l.sum)({inputs:{x:x},backend:n,attrs:{axis:m,keepDims:!1}}),k=(0,i.reshape)({inputs:{x:w},backend:n,attrs:{shape:y}}),_=(0,s.div)({inputs:{a:x,b:k},backend:n});return n.disposeIntermediateTensorInfo(g),n.disposeIntermediateTensorInfo(v),n.disposeIntermediateTensorInfo(b),n.disposeIntermediateTensorInfo(x),n.disposeIntermediateTensorInfo(w),n.disposeIntermediateTensorInfo(k),_}t.softmaxConfig={kernelName:r.Softmax,backendName:"cpu",kernelFunc:u}},572416:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.softplusConfig=t.softplus=void 0;var r=n(735534),a=n(777226);const o=Math.log(1.1920928955078125e-7)+2,s=t.softplus=(0,a.unaryKernelFunc)(r.Softplus,(e=>{const t=e>-o,n=e<o,r=Math.exp(e);let a;return a=n?r:t?e:Math.log(1+r),a}));t.softplusConfig={kernelName:r.Softplus,backendName:"cpu",kernelFunc:s}},207426:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.spaceToBatchND=c,t.spaceToBatchNDConfig=void 0;var r=n(735534),a=n(468462),o=n(795276),s=n(434731),i=n(437023);function c(e){const{inputs:t,backend:n,attrs:c}=e,{x:l}=t,{blockShape:u,paddings:d}=c;(0,a.assertNotComplex)([l],"spaceToBatchND");const p=r.util.sizeFromShape(u),h=[[0,0]];h.push(...d);for(let e=1+u.length;e<l.shape.length;++e)h.push([0,0]);const f=o.padV2Config.kernelFunc({inputs:{x:l},backend:n,attrs:{paddings:h,constantValue:0}}),m=r.backend_util.getReshaped(f.shape,u,p,!1),g=r.backend_util.getPermuted(m.length,u.length,!1),y=r.backend_util.getReshapedPermuted(f.shape,u,p,!1),v={x:f},b={shape:m},x=(0,s.reshape)({inputs:v,backend:n,attrs:b}),w={x:x},k={perm:g}
1,_=(0,i.transpose)({inputs:w,backend:n,attrs:k}),C={x:_},P={shape:y},O=(0,s.reshape)({inputs:C,backend:n,attrs:P});return n.disposeIntermediateTensorInfo(f),n.disposeIntermediateTensorInfo(x),n.disposeIntermediateTensorInfo(_),O}t.spaceToBatchNDConfig={kernelName:r.SpaceToBatchND,backendName:"cpu",kernelFunc:c}},344105:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.sparseFillEmptyRows=o,t.sparseFillEmptyRowsConfig=void 0;var r=n(735534),a=n(166009);function o(e){const{inputs:t,backend:n}=e,{indices:r,values:o,denseShape:s,defaultValue:i}=t;if(1!==s.shape.length)throw new Error("Dense shape must be a vector, saw:\n ".concat(s.shape));if(2!==r.shape.length)throw new Error("Indices must be a matrix, saw:\n ".concat(r.shape));if(1!==o.shape.length)throw new Error("Values must be a vector, saw:\n ".concat(o.shape));if(0!==i.shape.length)throw new Error("Default value must be a scalar, saw:\n ".concat(i.shape));const c=n.data.get(r.dataId).values,l=n.data.get(o.dataId).values,u=n.data.get(s.dataId).values,d=n.data.get(i.dataId).values[0],[p,h,f,m,g]=(0,a.sparseFillEmptyRowsImpl)(c,r.shape,r.dtype,l,o.dtype,u,d);return[n.makeTensorInfo(h,r.dtype,p),n.makeTensorInfo([h[0]],o.dtype,f),n.makeTensorInfo([m.length],"bool",new Uint8Array(m.map((e=>Number(e))))),n.makeTensorInfo([g.length],r.dtype,new Int32Array(g))]}t.sparseFillEmptyRowsConfig={kernelName:r.SparseFillEmptyRows,backendName:"cpu",kernelFunc:o}},166009:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.sparseFillEmptyRowsImpl=function(e,t,n,a,o,s,i){const c=t[0],l=s[0],u=new Array(l),d=new Array(c),p=t[1];if(0===l){if(0!==c)throw new Error(r.backend_util.getSparseFillEmptyRowsIndicesDenseShapeMismatch(c));return[r.util.getArrayFromDType(n,0),[0,p],r.util.getArrayFromDType(o,0),u,d]}let h=!0,f=0;const m=new Array(l).fill(0);for(let t=0;t<c;++t){const n=e[t*p];if(n<0)throw new Error(r.backend_util.getSparseFillEmptyRowsNegativeIndexErrorMessage(t,n));if(n>=l)throw new Error(r.backend_util.getSparseFillEmptyRowsOutOfRangeIndexErrorMessage(t,n,l));++m[n],h=h&&n>=f,f=n}let g=!0;for(let e=0;e<l;++e){const t=0===m[e];u[e]=t,g=g&&!t,m[e]=Math.max(m[e],1),e>0&&(m[e]+=m[e-1])}if(g&&h){const t=e,n=a;for(let e=0;e<c;++e)d[e]=e;return[t,[c,p],n,u,d]}{const t=m[l-1],s=r.util.getArrayFromDType(n,t*p),h=r.util.getArrayFromDType(o,t),f=new Array(l).fill(0);for(let t=0;t<c;++t){const n=e[t*p],r=f[n],o=(0===n?0:m[n-1])+r;f[n]++;for(let n=0;n<p;++n)s[o*p+n]=e[t*p+n];h[o]=a[t],d[t]=o}for(let e=0;e<l;++e){if(0===f[e]){const t=0===e?0:m[e-1];s[t*p+0]=e;for(let e=1;e<p;++e)s[t*p+e]=0;h[t]=i}}return[s,[t,p],h,u,d]}};var r=n(735534)},496994:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.sparseReshape=o,t.sparseReshapeConfig=void 0;var r=n(735534),a=n(561885);function o(e){const{inputs:t,backend:n}=e,{inputIndices:r,inputShape:o,newShape:s}=t;if(2!==r.shape.length)throw new Error("Input indices should be a matrix but received shape\n ".concat(r.shape));if(1!==o.shape.length)throw new Error("Input shape should be a vector but received shape\n ".concat(o.shape));if(1!==s.shape.length)throw new Error("Target shape should be a vector but received shape ".concat(s.shape));const i=Array.from(n.data.get(o.dataId).values),c=n.data.get(r.dataId).values,l=Array.from(n.data.get(s.dataId).values),[u,d,p]=(0,a.sparseReshapeImpl)(c,r.shape,r.dtype,i,l);return[n.makeTensorInfo(d,r.dtype,u),n.makeTensorInfo([p.length],s.dtype,new Int32Array(p))]}t.sparseReshapeConfig={kernelName:r.SparseReshape,backendName:"cpu",kernelFunc:o}},561885:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.sparseReshapeImpl=function(e,t,n,a,o){const s=r.util.sizeFromShape(a),i=t[0],c=o.length,l=[];let u=1,d=-1;for(let e=0;e<c;++e){const t=o[e];if(-1===t){if(-1!==d)throw new Error(r.backend_util.getSparseReshapeMultipleNegativeOneOutputDimErrorMessage(d,e));d=e,l.push(1)}else{if(t<0)throw new Error(r.backend_util.getSparseReshapeNegativeOutputDimErrorMessage(e,t));u*=t,l.push(t)}}if(-1!==d){if(u<=0)throw new Error(r.backend_util.getSparseReshapeEmptyTensorZeroOutputDimErrorMessage());const e=Math.trunc(s/u);
1if(u*e!==s)throw new Error(r.backend_util.getSparseReshapeInputOutputMultipleErrorMessage(a,l));l[d]=e}if(r.util.sizeFromShape(l)!==s)throw new Error(r.backend_util.getSparseReshapeInputOutputMismatchErrorMessage(a,l));const p=a.length,h=[];if(p>0){h[p-1]=1;for(let e=p-2;e>=0;--e)h[e]=h[e+1]*a[e+1]}const f=[];if(c>0){f[c-1]=1;for(let e=c-2;e>=0;--e)f[e]=f[e+1]*l[e+1]}const m=r.util.getArrayFromDType(n,i*c);for(let t=0;t<i;++t){let n=0;for(let r=0;r<p;++r)n+=e[t*p+r]*h[r];for(let e=0;e<c;++e)m[t*c+e]=Math.trunc(n/f[e]),n%=f[e]}return[m,[i,c],l]};var r=n(735534)},939170:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.sparseSegmentMean=o,t.sparseSegmentMeanConfig=void 0;var r=n(735534),a=n(590618);function o(e){const{inputs:t,backend:n}=e,{data:r,indices:o,segmentIds:s}=t;if(r.shape.length<1)throw new Error("Data should be at least 1 dimensional but received scalar");if(1!==o.shape.length)throw new Error("Indices should be a vector but received shape\n ".concat(o.shape));if(1!==s.shape.length)throw new Error("Segment ids should be a vector but received shape\n ".concat(s.shape));if(o.shape[0]!==s.shape[0])throw new Error("segmentIds and indices should have same size.");const i=n.data.get(r.dataId).values,c=n.data.get(o.dataId).values,l=n.data.get(s.dataId).values,[u,d]=(0,a.sparseSegmentReductionImpl)(i,r.shape,r.dtype,c,l,!0);return n.makeTensorInfo(d,r.dtype,u)}t.sparseSegmentMeanConfig={kernelName:r.SparseSegmentMean,backendName:"cpu",kernelFunc:o}},590618:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.sparseSegmentReductionImpl=function(e,t,n,a,o){let s=arguments.length>5&&void 0!==arguments[5]&&arguments[5],i=arguments.length>6&&void 0!==arguments[6]?arguments[6]:0;const c=a.length,l=[t[0],e.length/t[0]],u=l[1],d=c>0?o[c-1]+1:0;if(d<0)throw new Error(r.backend_util.getSparseSegmentReductionNegativeSegmentIdsErrorMessage());const p=t.slice();p[0]=d;const h=p.reduce(((e,t)=>e*t),1),f=r.util.getArrayFromDType(n,h);if(0===c)return d>0&&f.fill(i),[f,p];if(d<=0)throw new Error(r.backend_util.getSparseSegmentReductionNegativeSegmentIdsErrorMessage());let m=0,g=1,y=0,v=o[m];for(;;){let t=0;if(g<c){if(t=o[g],v===t){++g;continue}if(v>=t)throw new Error(r.backend_util.getSparseSegmentReductionNonIncreasingSegmentIdsErrorMessage())}if(v<0||v>=d)throw new Error(r.backend_util.getSparseSegmentReductionSegmentIdOutOfRangeErrorMessage(v,d));v>y&&f.fill(i,y*u,v*u);for(let t=m;t<g;++t){const n=a[t];if(n<0||n>=l[0])throw new Error(r.backend_util.getSparseSegmentReductionIndicesOutOfRangeErrorMessage(t,a[t],l[0]));for(let t=0;t<u;t++)f[v*u+t]+=e[n*u+t]}if(s)for(let e=0;e<u;e++)f[v*u+e]/=g-m;if(m=g,++g,y=v+1,v=t,g>c)break}y<d&&f.fill(i,y*u,d*u);return[f,p]};var r=n(735534)},524995:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.sparseSegmentSum=o,t.sparseSegmentSumConfig=void 0;var r=n(735534),a=n(590618);function o(e){const{inputs:t,backend:n}=e,{data:r,indices:o,segmentIds:s}=t;if(r.shape.length<1)throw new Error("Data should be at least 1 dimensional but received scalar");if(1!==o.shape.length)throw new Error("Indices should be a vector but received shape\n ".concat(o.shape));if(1!==s.shape.length)throw new Error("Segment ids should be a vector but received shape\n ".concat(s.shape));if(o.shape[0]!==s.shape[0])throw new Error("segmentIds and indices should have same size.");const i=n.data.get(r.dataId).values,c=n.data.get(o.dataId).values,l=n.data.get(s.dataId).values,[u,d]=(0,a.sparseSegmentReductionImpl)(i,r.shape,r.dtype,c,l);return n.makeTensorInfo(d,r.dtype,u)}t.sparseSegmentSumConfig={kernelName:r.SparseSegmentSum,backendName:"cpu",kernelFunc:o}},553810:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.sparseToDense=o,t.sparseToDenseConfig=void 0;var r=n(735534),a=n(936239);function o(e){const{inputs:t,backend:n,attrs:o}=e,{sparseIndices:s,sparseValues:i,defaultValue:c}=t,{outputShape:l}=o,{sliceRank:u,numUpdates:d,sliceSize:p,strides:h,outputSize:f}=r.backend_util.calculateShapes(i,s,l),m=n.bufferSync(s),g=n.bufferSync(i),y=n.data.get(c.dataId).values[0],v=(0,a.scatterImpl)(m,g,l,f,p,d,u,h,y,!1);return n.makeTensorInfo(l,v.dtype,v.values)}t.sparseToDenseConfig={kernelName:r.SparseToDense,backendName:"cpu",kernelFunc:o}},501647:(e,t,n)=>{"use strict";
1Object.defineProperty(t,"__esModule",{value:!0}),t.splitV=o,t.splitVConfig=void 0;var r=n(735534),a=n(910875);function o(e){const{inputs:t,backend:n,attrs:o}=e,{x:s}=t,{numOrSizeSplits:i,axis:c}=o,l=r.util.parseAxisParam(c,s.shape)[0],u=r.backend_util.prepareSplitSize(s,i,l),d=new Array(s.shape.length).fill(0),p=s.shape.slice();return u.map((e=>{const t=[...p];t[l]=e;const r=(0,a.slice)({inputs:{x:s},backend:n,attrs:{begin:d,size:t}});return d[l]+=e,r}))}t.splitVConfig={kernelName:r.SplitV,backendName:"cpu",kernelFunc:o}},743006:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.sqrtImpl=t.sqrtConfig=t.sqrt=void 0;var r=n(735534),a=n(816375),o=n(777226);t.sqrtImpl=(0,a.createSimpleUnaryImpl)((e=>Math.sqrt(e)));const s=t.sqrt=(0,o.unaryKernelFunc)(r.Sqrt,(e=>Math.sqrt(e)));t.sqrtConfig={kernelName:r.Sqrt,backendName:"cpu",kernelFunc:s}},338935:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.squareConfig=void 0;var r=n(735534),a=n(468462);t.squareConfig={kernelName:r.Square,backendName:"cpu",kernelFunc:e=>{let{inputs:t,backend:n}=e;const{x:r}=t,o=n;(0,a.assertNotComplex)(r,"square");const s=o.data.get(r.dataId).values,i=new Float32Array(s.length);for(let e=0;e<s.length;++e){const t=s[e];i[e]=t*t}return{dataId:o.write(i,r.shape,r.dtype),shape:r.shape,dtype:r.dtype}}}},784494:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.squaredDifferenceImpl=t.squaredDifferenceConfig=t.squaredDifference=void 0;var r=n(735534),a=n(650179),o=n(3428);const s=t.squaredDifferenceImpl=(0,a.createSimpleBinaryKernelImpl)(((e,t)=>{const n=e-t;return n*n})),i=t.squaredDifference=(0,o.binaryKernelFunc)(r.SquaredDifference,s);t.squaredDifferenceConfig={kernelName:r.SquaredDifference,backendName:"cpu",kernelFunc:i}},405269:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.stepConfig=t.step=void 0;var r=n(735534),a=n(777226);const o=t.step=(0,a.unaryKernelFunc)(r.Step,((e,t)=>{const n=t;return isNaN(e)?NaN:e>0?1:n.alpha}));t.stepConfig={kernelName:r.Step,backendName:"cpu",kernelFunc:o}},795705:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.stridedSlice=c,t.stridedSliceConfig=void 0;var r=n(735534),a=n(468462),o=n(434731),s=n(910875),i=n(323548);function c(e){const{inputs:t,backend:n,attrs:c}=e,{x:l}=t,{begin:u,end:d,strides:p,beginMask:h,endMask:f,ellipsisMask:m,newAxisMask:g,shrinkAxisMask:y}=c;(0,a.assertNotComplex)(l,"stridedSlice");const{finalShapeSparse:v,finalShape:b,isIdentity:x,sliceDim0:w,isSimpleSlice:k,begin:_,end:C,strides:P}=r.slice_util.sliceInfo(l.shape,u,d,p,h,f,m,g,y);let O;if(x)O=(0,o.reshape)({inputs:{x:l},backend:n,attrs:{shape:b}});else if(w||k){r.util.assert(l.shape.length>=1,(()=>"Input must have rank at least 1, got: ".concat(l.shape.length)));const e=r.slice_util.computeOutShape(_,C,P),t=(0,s.slice)({inputs:{x:l},backend:n,attrs:{begin:_,size:e}});O=(0,o.reshape)({inputs:{x:t},backend:n,attrs:{shape:b}}),n.disposeIntermediateTensorInfo(t)}else{const e=n.bufferSync(l),t=(0,i.stridedSliceImpl)(v,e,P,_);O=n.makeTensorInfo(b,t.dtype,t.values)}return O}t.stridedSliceConfig={kernelName:r.StridedSlice,backendName:"cpu",kernelFunc:c}},323548:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.stridedSliceImpl=function(e,t,n,a){const o=(0,r.buffer)(e,t.dtype);for(let e=0;e<o.size;e++){const r=o.indexToLoc(e),s=new Array(r.length);for(let e=0;e<s.length;e++)s[e]=r[e]*n[e]+a[e];o.set(t.get(...s),...r)}return o};var r=n(735534)},290606:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.stringNGrams=o,t.stringNGramsConfig=void 0;var r=n(735534),a=n(913606);function o(e){const{inputs:t,backend:n,attrs:r}=e,{separator:o,nGramWidths:s,leftPad:i,rightPad:c,padWidth:l,preserveShortSequences:u}=r,{data:d,dataSplits:p}=t,h=n.data.get(d.dataId).values,f=n.data.get(p.dataId).values,[m,g]=(0,a.stringNGramsImpl)(h,f,o,s,i,c,l,u);return[n.makeTensorInfo([m.length],"string",m),n.makeTensorInfo(p.shape,"int32",g)]}t.stringNGramsConfig={kernelName:r.StringNGrams,backendName:"cpu",kernelFunc:o}},913606:(e,t,n)=>{"use strict";
1Object.defineProperty(t,"__esModule",{value:!0}),t.stringNGramsImpl=function(e,t,n,r,o,s,i,c){return new a(n,r,o,s,i,c).compute(e,t)};var r=n(735534);class a{constructor(e,t,n,a,o,s){this.separator=r.util.encodeString(e),this.nGramWidths=t,this.leftPad=r.util.encodeString(n),this.rightPad=r.util.encodeString(a),this.padWidth=o,this.preserveShort=s}getPadWidth(e){return Math.min(this.padWidth<0?e-1:this.padWidth,e-1)}getNumNGrams(e,t){const n=this.getPadWidth(t);return Math.max(0,e+2*n-t+1)}createNGrams(e,t,n,r,a,o){for(let s=0;s<a;++s){const i=this.getPadWidth(o),c=Math.max(0,i-s),l=Math.max(0,i-(a-(s+1))),u=o-(c+l),d=t+(c>0?0:s-i);let p=0;p+=c*this.leftPad.length;for(let t=0;t<u;++t)p+=e[d+t].length;p+=l*this.rightPad.length;p+=(c+l+u-1)*this.separator.length,n[r+s]=new Uint8Array(p);const h=n[r+s];let f=0;const m=e=>e.forEach((e=>h[f++]=e));for(let e=0;e<c;++e)m(this.leftPad),m(this.separator);for(let t=0;t<u-1;++t)m(e[d+t]),m(this.separator);if(u>0){m(e[d+u-1]);for(let e=0;e<l;++e)m(this.separator),m(this.rightPad)}else{for(let e=0;e<l-1;++e)m(this.rightPad),m(this.separator);m(this.rightPad)}}}compute(e,t){const n=e.length,a=t.length;if(a>0){let e=t[0];if(0!==e)throw new Error("First split value must be 0, got ".concat(e));for(let r=1;r<a;++r){let a=t[r]>=e;if(a=a&&t[r]<=n,!a)throw new Error("Invalid split value ".concat(t[r],", must be in [").concat(e,", ").concat(n,"]"));e=t[r]}if(e!==n)throw new Error("Last split value must be data size. Expected ".concat(n,", got ").concat(e))}const o=a-1,s=r.util.getArrayFromDType("int32",a);if(0===n||0===a){const e=new Array(n);for(let e=0;e<=o;++e)s[e]=0;return[e,s]}s[0]=0;for(let e=1;e<=o;++e){const n=t[e]-t[e-1];let r=0;this.nGramWidths.forEach((e=>{r+=this.getNumNGrams(n,e)})),this.preserveShort&&n>0&&0===r&&(r=1),s[e]=s[e-1]+r}const i=new Array(s[o]);for(let n=0;n<o;++n){const r=t[n];let a=s[n];if(this.nGramWidths.forEach((o=>{const s=t[n+1]-t[n],c=this.getNumNGrams(s,o);this.createNGrams(e,r,i,a,c,o),a+=c})),this.preserveShort&&a===s[n]){const o=t[n+1]-t[n];if(0===o)continue;const s=o+2*this.padWidth,c=1;this.createNGrams(e,r,i,a,c,s)}}return[i,s]}}},761957:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.stringSplit=o,t.stringSplitConfig=void 0;var r=n(735534),a=n(808043);function o(e){const{inputs:t,backend:n,attrs:r}=e,{skipEmpty:o}=r,{input:s,delimiter:i}=t;if("string"!==s.dtype)throw new Error("Input must be of datatype string");if(1!==s.shape.length)throw new Error("Input must be a vector, got shape: ".concat(s.shape));if(0!==i.shape.length)throw new Error("Delimiter must be a scalar, got shape: ".concat(i.shape));const c=n.data.get(s.dataId).values,l=n.data.get(i.dataId).values[0],[u,d,p]=(0,a.stringSplitImpl)(c,l,o),h=d.length;return[n.makeTensorInfo([h,2],"int32",u),n.makeTensorInfo([h],"string",d),n.makeTensorInfo([2],"int32",new Int32Array(p))]}t.stringSplitConfig={kernelName:r.StringSplit,backendName:"cpu",kernelFunc:o}},808043:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.stringSplitImpl=function(e,t,n){const o=e.length,s=[];let i=0,c=0;const l=new Array(o);for(let r=0;r<o;++r){const o=s.length;a(e[r],t,n,s);const u=s.length-o;l[r]=u,i+=u,c=Math.max(c,u)}const u=r.util.getArrayFromDType("int32",2*i),d=new Array(i),p=[o,c];let h=0;for(let e=0;e<o;++e)for(let t=0;t<l[e];++t)u[2*h]=e,u[2*h+1]=t,d[h]=s[h],++h;return[u,d,p]};var r=n(735534);function a(e,t,n,r){if(!e.length)return;if(0===t.length){for(let t=0;t<e.length;++t)r.push(e.subarray(t,t+1));return}if(1===t.length){const a=t[0];let o=e.indexOf(a);for(;-1!==o;){const t=e.subarray(0,o);n&&0===t.length||r.push(t),o=(e=e.subarray(o+1)).indexOf(a)}return void(n&&0===e.length||r.push(e))}let a=0;for(let o=0;o<e.length+1;o++)if(o===e.length||-1!==t.indexOf(e[o])){const t=e.subarray(a,o);n&&0===t.length||r.push(t),a=o+1}}},722130:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.stringToHashBucketFast=o,t.stringToHashBucketFastConfig=void 0;var r=n(735534),a=n(41773);function o(e){const{inputs:t,backend:n,attrs:r}=e,{numBuckets:o}=r,{input:s}=t;if("string"!==s.dtype)throw new Error("Input must be of datatype string");if(o<=0)throw new Error("Number of buckets must be at least 1");const i=n.data.get(s.dataId).values,c=(0,a.stringToHashBucketFastImpl)(i,o);return n.makeTensorInfo(s.shape,"int32",c)}t.stringToHashBucketFastConfig={kernelName:r.StringToHashBucketFast,backendName:"cpu",kernelFunc:o}},41773:(e,t,n)=>{"use strict";
1Object.defineProperty(t,"__esModule",{value:!0}),t.stringToHashBucketFastImpl=function(e,t){const n=r.util.getArrayFromDType("int32",e.length);for(let a=0;a<e.length;++a)n[a]=r.util.fingerPrint64(e[a]).modulo(t).getLowBitsUnsigned();return n};var r=n(735534)},471503:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.subImpl=t.subConfig=t.subComplexImpl=t.sub=void 0;var r=n(735534),a=n(650179),o=n(3428);const s=t.subImpl=(0,a.createSimpleBinaryKernelImpl)(((e,t)=>e-t)),i=t.subComplexImpl=(0,o.createComplexBinaryKernelImpl)(((e,t,n,r)=>({real:e-n,imag:t-r}))),c=t.sub=(0,o.binaryKernelFunc)(r.Sub,s,i);t.subConfig={kernelName:r.Sub,backendName:"cpu",kernelFunc:c}},841964:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.sum=u,t.sumConfig=void 0;var r=n(735534),a=n(468462),o=n(746509),s=n(764979),i=n(848930),c=n(434731),l=n(437023);function u(e){const{inputs:t,backend:n,attrs:u}=e,{x:d}=t,{axis:p,keepDims:h}=u;let f;(0,a.assertNotComplex)(d,"sum"),f="bool"===d.dtype?(0,s.cast)({inputs:{x:d},backend:n,attrs:{dtype:"int32"}}):(0,i.identity)({inputs:{x:d},backend:n});const m=f.shape.length,g=r.util.parseAxisParam(p,f.shape),y=r.backend_util.getAxesPermutation(g,m);let v=g,b=f;
1null!=y&&(b=(0,l.transpose)({inputs:{x:f},backend:n,attrs:{perm:y}}),v=r.backend_util.getInnerMostAxes(v.length,m)),r.backend_util.assertAxesAreInnerMostDims("sum",v,b.shape.length);const[x,w]=r.backend_util.computeOutAndReduceShapes(b.shape,v),k=r.backend_util.upcastType(b.dtype,"int32");let _=(0,o.zeros)(n,x,k);const C=r.util.sizeFromShape(w),P=n.data.get(_.dataId).values,O=n.data.get(b.dataId).values;for(let e=0;e<P.length;++e){const t=e*C;let n=0;for(let e=0;e<C;++e)n+=O[t+e];P[e]=n}if(h){const e=r.backend_util.expandShapeToKeepDim(_.shape,g),t=_;_=(0,c.reshape)({inputs:{x:_},backend:n,attrs:{shape:e}}),n.disposeIntermediateTensorInfo(t)}return n.disposeIntermediateTensorInfo(f),null!=y&&n.disposeIntermediateTensorInfo(b),_}t.sumConfig={kernelName:r.Sum,backendName:"cpu",kernelFunc:u}},230558:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.tanConfig=t.tan=void 0;var r=n(735534),a=n(777226);const o=t.tan=(0,a.unaryKernelFunc)(r.Tan,(e=>Math.tan(e)));t.tanConfig={kernelName:r.Tan,backendName:"cpu",kernelFunc:o}},49340:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.tanhConfig=t.tanh=void 0;var r=n(735534),a=n(777226);const o=t.tanh=(0,a.unaryKernelFunc)(r.Tanh,(e=>Math.tanh(e)));t.tanhConfig={kernelName:r.Tanh,backendName:"cpu",kernelFunc:o}},342776:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.tile=s,t.tileConfig=void 0;var r=n(735534),a=n(468462),o=n(393052);function s(e){const{inputs:t,backend:n,attrs:r}=e,{x:s}=t,{reps:i}=r;(0,a.assertNotComplex)(s,"tile");const c=(0,o.tileImpl)(n.bufferSync(s),i);return n.makeTensorInfo(c.shape,c.dtype,c.values)}t.tileConfig={kernelName:r.Tile,backendName:"cpu",kernelFunc:s}}
1,393052:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.tileImpl=function(e,t){const n=new Array(e.rank);for(let r=0;r<n.length;r++)n[r]=e.shape[r]*t[r];const a=(0,r.buffer)(n,e.dtype);for(let t=0;t<a.values.length;++t){const n=a.indexToLoc(t),r=new Array(e.rank);for(let t=0;t<r.length;t++)r[t]=n[t]%e.shape[t];const o=e.locToIndex(r);a.values[t]=e.values[o]}return a};var r=n(735534)},601627:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.topK=s,t.topKConfig=void 0;var r=n(735534),a=n(468462),o=n(76603);function s(e){const{inputs:t,backend:n,attrs:r}=e,{x:s}=t,{k:i,sorted:c}=r;(0,a.assertNotComplex)(s,"topk");const l=n.data.get(s.dataId).values,[u,d]=(0,o.topKImpl)(l,s.shape,s.dtype,i,c);return[n.makeTensorInfo(u.shape,u.dtype,u.values),n.makeTensorInfo(d.shape,d.dtype,d.values)]}t.topKConfig={kernelName:r.TopK,backendName:"cpu",kernelFunc:s}},76603:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.topKImpl=function(e,t,n,s,i){const c=t[t.length-1],[l,u]=[e.length/c,c],d=r.util.getTypedArrayFromDType(n,l*s),p=r.util.getTypedArrayFromDType("int32",l*s);for(let t=0;t<l;t++){const n=t*u,r=e.subarray(n,n+u);let c=new Array(r.length);r.forEach(((e,t)=>c[t]={value:e,index:t})),s<c.length&&(o(c,s),c=c.slice(0,s)),i&&c.sort(a);const l=t*s,h=d.subarray(l,l+s),f=p.subarray(l,l+s);for(let e=0;e<s;e++)h[e]=c[e].value,f[e]=c[e].index}const h=t.slice();return h[h.length-1]=s,[(0,r.buffer)(h,n,d),(0,r.buffer)(h,"int32",p)]};var r=n(735534);const a=(e,t)=>{const n=t.value-e.value;return 0===n?e.index-t.index:n};function o(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:e.length-1;for(;s>n;){if(s-n>600){const r=s-n+1,a=t-n+1,i=Math.log(r),c=.5*Math.exp(2*i/3),l=.5*Math.sqrt(i*c*(r-c)/r)*Math.sign(a-r/2);o(e,t,Math.max(n,Math.floor(t-a*c/r+l)),Math.min(s,Math.floor(t+(r-a)*c/r+l)))}const i=e[t];let c=n,l=s;for(r.util.swap(e,n,t),a(e[s],i)>0&&r.util.swap(e,n,s);c<l;){for(r.util.swap(e,c,l),c++,l--;a(e[c],i)<0;)c+=1;for(;a(e[l],i)>0;)l-=1}0===a(e[n],i)?r.util.swap(e,n,l):(l+=1,r.util.swap(e,l,s)),l<=t&&(n=l+1),t<=l&&(s=l-1)}}},403611:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.transform=a,t.transformConfig=void 0;var r=n(735534);function a(e){const{inputs:t,attrs:n,backend:a}=e,{image:s,transforms:l}=t,{interpolation:u,fillMode:d,fillValue:p,outputShape:h}=n,[f,m,g,y]=s.shape,[v,b]=null!=h?h:[m,g],x=[f,v,b,y],w=r.util.computeStrides(s.shape),k=w[0],_=w[1],C=w[2],P=r.util.getTypedArrayFromDType(s.dtype,r.util.sizeFromShape(x));P.fill(p);const O=a.data.get(s.dataId).values,N=a.data.get(l.dataId).values;for(let e=0;e<f;++e){const t=1===l.shape[0]?N:N.subarray(8*e,8*e+8);for(let n=0;n<v;++n)for(let r=0;r<b;++r)for(let a=0;a<y;++a){let s;const l=t[6]*r+t[7]*n+1;if(0===l)continue;const h=(t[0]*r+t[1]*n+t[2])/l,f=(t[3]*r+t[4]*n+t[5])/l,y=o(h,g,d),v=o(f,m,d);switch(u){case"nearest":s=i(O,m,g,k,_,C,e,v,y,a,p);break;case"bilinear":s=c(O,m,g,k,_,C,e,v,y,a,p);break;default:throw new Error("Error in Transform: Expect 'nearest' or "+"'bilinear', but got ".concat(u))}P[e*k+n*_+r*C+a]=s}return a.makeTensorInfo(x,s.dtype,P)}return{dataId:a.write(P,x,s.dtype),shape:s.shape,dtype:s.dtype}}t.transformConfig={kernelName:r.Transform,backendName:"cpu",kernelFunc:a};function o(e,t,n){switch(n){case"reflect":return function(e,t){let n=e;if(n<0)if(t<=1)n=0;else{const e=2*t;n<e&&(n=e*Math.trunc(-n/e)+n),n=n<-t?n+e:-n-1}else if(n>t-1)if(t<=1)n=0;else{const e=2*t;n-=e*Math.trunc(n/e),n>=t&&(n=e-n-1)}return r.util.clamp(0,n,t-1)}(e,t);case"wrap":return function(e,t){let n=e;if(n<0)if(t<=1)n=0;else{const e=t-1;n+=t*(Math.trunc(-n/e)+1)}else if(n>t-1)if(t<=1)n=0;else{const e=t-1;n-=t*Math.trunc(n/e)}return r.util.clamp(0,n,t-1)}(e,t);case"nearest":return function(e,t){return r.util.clamp(0,e,t-1)}(e,t);default:return function(e){return e}(e)}}function s(e,t,n,r,a,o,s,i,c,l,u){return 0<=i&&i<t&&0<=c&&c<n?e[s*r+i*a+c*o+l]:u}function i(e,t,n,r,a,o,i,c,l,u,d){return s(e,t,n,r,a,o,i,Math.round(c),Math.round(l),u,d)}function c(e,t,n,r,a,o,i,c,l,u,d){const p=Math.floor(c),h=Math.floor(l),f=p+1,m=h+1;return(f-c)*((m-l)*s(e,t,n,r,a,o,i,p,h,u,d)+(l-h)*s(e,t,n,r,a,o,i,p,m,u,d))+(c-p)*((m-l)*s(e,t,n,r,a,o,i,f,h,u,d)+(l-h)*s(e,t,n,r,a,o,i,f,m,u,d))}}
1,437023:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.transpose=s,t.transposeConfig=void 0;var r=n(735534),a=n(468462),o=n(823574);function s(e){const{inputs:t,attrs:n,backend:r}=e,{x:s}=t,{perm:i}=n;(0,a.assertNotComplex)(s,"transpose");const c=s.shape.length,l=new Array(c);for(let e=0;e<l.length;e++)l[e]=s.shape[i[e]];const u=r.data.get(s.dataId).values,d=(0,o.transposeImpl)(u,s.shape,s.dtype,i,l);return{dataId:r.write(d,l,s.dtype),shape:l,dtype:s.dtype}}t.transposeConfig={kernelName:r.Transpose,backendName:"cpu",kernelFunc:s}},823574:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.transposeImpl=function(e,t,n,a,o){const s=t.length,i=r.util.sizeFromShape(t),c=r.util.computeStrides(t),l=r.util.computeStrides(o),u=r.util.getTypedArrayFromDType(n,r.util.sizeFromShape(o));for(let t=0;t<i;++t){const n=r.util.indexToLoc(t,s,c),o=new Array(n.length);for(let e=0;e<o.length;e++)o[e]=n[a[e]];u[r.util.locToIndex(o,s,l)]=e[t]}return u};var r=n(735534)},156737:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.unique=s,t.uniqueConfig=void 0;var r=n(735534),a=n(468462),o=n(198788);function s(e){const{inputs:t,attrs:n,backend:r}=e,{axis:s}=n,{x:i}=t;(0,a.assertNotComplex)(i,"unique");const c=r.data.get(i.dataId).values,{outputValues:l,outputShape:u,indices:d}=(0,o.uniqueImpl)(c,s,i.shape,i.dtype);return[r.makeTensorInfo(u,i.dtype,l),r.makeTensorInfo([d.length],"int32",d)]}t.uniqueConfig={kernelName:r.Unique,backendName:"cpu",kernelFunc:s}},198788:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.uniqueImpl=function(e,t,n,a){const o=r.util.parseAxisParam(t,n)[0],s=[1,n[0],1];for(let e=0;e<o;e++)s[0]*=n[e];s[1]=n[o];for(let e=o+1;e<n.length;e++)s[2]*=n[e];const i={},c=new Int32Array(n[o]),l=new r.TensorBuffer(s,a,e),u=[],d=1===s[0]&&1===s[2];for(let t=0;t<n[o];t++){let n;if(d)n=e[t].toString();else{const e=[];for(let n=0;n<s[0];n++)for(let r=0;r<s[2];r++)e.push(l.get(n,t,r));n=e.join(",")}if(void 0!==i[n])c[t]=i[n];else{const e=Object.keys(i).length;i[n]=e,c[t]=e,u.push(t)}}const p=s.slice();p[1]=Object.keys(i).length;const h=new r.TensorBuffer(p,a);u.forEach(((e,t)=>{for(let n=0;n<s[0];n++)for(let r=0;r<s[2];r++)h.set(l.get(n,e,r),n,t,r)}));const f=n.slice();return f[o]=p[1],{outputValues:h.values,outputShape:f,indices:c}};var r=n(735534)},590112:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.unpack=s,t.unpackConfig=void 0;var r=n(735534),a=n(434731),o=n(910875);function s(e){const{inputs:t,backend:n,attrs:r}=e,{value:s}=t;let{axis:i}=r;i<0&&(i+=s.shape.length);const c=s.shape.length,l=s.shape[i],u=new Array(c-1);let d=0;for(let e=0;e<c;e++)e!==i&&(u[d++]=s.shape[e]);const p=new Array(c).fill(0),h=s.shape.slice();h[i]=1;const f=new Array(l);for(let e=0;e<f.length;e++){p[i]=e;const t=(0,o.slice)({inputs:{x:s},backend:n,attrs:{begin:p,size:h}});f[e]=(0,a.reshape)({inputs:{x:t},backend:n,attrs:{shape:u}}),n.disposeIntermediateTensorInfo(t)}return f}t.unpackConfig={kernelName:r.Unpack,backendName:"cpu",kernelFunc:s}},365554:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.unsortedSegmentSum=d,t.unsortedSegmentSumConfig=void 0;var r=n(735534),a=n(468462),o=n(764979),s=n(25138),i=n(178845),c=n(418852),l=n(10759),u=n(841964);function d(e){const{inputs:t,backend:n,attrs:d}=e,{x:p,segmentIds:h}=t,{numSegments:f}=d;(0,a.assertNotComplex)(p,"unsortedSegmentSum");const m=[],g=[],y=p.shape.length-h.shape.length;let v=h;for(let e=0;e<y;++e){const t=(0,i.expandDims)({inputs:{input:v},backend:n,attrs:{dim:e+1}});v=t,g.push(t)}for(let e=0;e<f;++e){const t=r.util.createScalarValue(e,"int32"),a=n.makeTensorInfo([],"int32",t),i=(0,s.equal)({inputs:{a:a,b:v},backend:n}),l=(0,o.cast)({inputs:{x:i},backend:n,attrs:{dtype:"float32"}}),d=(0,c.multiply)({inputs:{a:l,b:p},backend:n}),h=(0,u.sum)({inputs:{x:d},backend:n,attrs:{axis:0,keepDims:!1}});m.push(h),g.push(a),g.push(i),g.push(l),g.push(d),g.push(h)}const b=(0,l.pack)({inputs:m,backend:n,attrs:{axis:0}});return g.forEach((e=>n.disposeIntermediateTensorInfo(e))),b}t.unsortedSegmentSumConfig={kernelName:r.UnsortedSegmentSum,backendName:"cpu",kernelFunc:d}},516756:(e,t,n)=>{"use strict";
1Object.defineProperty(t,"__esModule",{value:!0}),t.zerosLike=c,t.zerosLikeConfig=void 0;var r=n(735534),a=n(795801),o=n(465882),s=n(62202),i=n(357858);function c(e){const{inputs:t,backend:n}=e,{x:r}=t;if("string"===r.dtype)throw new Error("zerosLike is not supported for string tensors");if("complex64"===r.dtype){const e=(0,i.real)({inputs:{input:r},backend:n}),t=c({inputs:{x:e},backend:n}),o=(0,s.imag)({inputs:{input:r},backend:n}),l=c({inputs:{x:o},backend:n}),u=(0,a.complex)({inputs:{real:t,imag:l},backend:n});return n.disposeIntermediateTensorInfo(e),n.disposeIntermediateTensorInfo(t),n.disposeIntermediateTensorInfo(o),n.disposeIntermediateTensorInfo(l),u}return(0,o.fill)({backend:n,attrs:{shape:r.shape,value:0,dtype:r.dtype}})}t.zerosLikeConfig={kernelName:r.ZerosLike,backendName:"cpu",kernelFunc:c}},452637:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t._fusedMatMul=i,t._fusedMatMulConfig=void 0;var r=n(735534),a=n(238150),o=n(772994),s=n(418026);function i(e){const{inputs:t,backend:n,attrs:r}=e,{a:i,b:c,bias:l,preluActivationWeights:u}=t,{transposeA:d,transposeB:p,activation:h,leakyreluAlpha:f}=r;let m,g,y;const v=[];m=(0,s.batchMatMul)({inputs:{a:i,b:c},attrs:{transposeA:d,transposeB:p},backend:n}),l&&(g=(0,o.add)({inputs:{a:m,b:l},backend:n}),v.push(m),m=g),h&&(y=(0,a.applyActivation)(n,m,h,u,f),v.push(m),m=y);for(const e of v)n.disposeIntermediateTensorInfo(e);return m}t._fusedMatMulConfig={kernelName:r._FusedMatMul,backendName:"cpu",kernelFunc:i}},503145:(e,t,n)=>{"use strict";var r=n(735534),a=n(452637),o=n(577574),s=n(373406),i=n(114635),c=n(772994),l=n(171294),u=n(6962),d=n(549597),p=n(202869),h=n(945514),f=n(275627),m=n(574817),g=n(676621),y=n(919050),v=n(995033),b=n(840189),x=n(788683),w=n(339522),k=n(981593),_=n(418026),C=n(337306),P=n(239847),O=n(254402),N=n(640292),I=n(764979),T=n(551647),S=n(672180),E=n(795801),M=n(914171),A=n(432930),D=n(902119),R=n(190778),F=n(616089),j=n(479739),z=n(441177),L=n(501527),V=n(732164),G=n(102041),B=n(745243),W=n(666263),U=n(120437),q=n(536523),H=n(801295),K=n(469822),X=n(837007),Y=n(423795),Z=n(95523),J=n(829349),Q=n(215327),$=n(148465),ee=n(312547),te=n(26762),ne=n(25138),re=n(114471),ae=n(610260),oe=n(178845),se=n(694199),ie=n(329935),ce=n(465882),le=n(270499),ue=n(48169),de=n(262186),pe=n(393437),he=n(282310),fe=n(625505),me=n(756140),ge=n(849761),ye=n(682002),ve=n(848930),be=n(338507),xe=n(62202),we=n(616197),ke=n(395891),_e=n(940800),Ce=n(207076),Pe=n(299730),Oe=n(490294),Ne=n(229978),Ie=n(865817),Te=n(397107),Se=n(926188),Ee=n(389678),Me=n(149823),Ae=n(298880),De=n(492417),Re=n(446806),Fe=n(513231),je=n(1299),ze=n(844078),Le=n(528676),Ve=n(737133),Ge=n(51812),Be=n(616187),We=n(699610),Ue=n(703348),qe=n(13080),He=n(459648),Ke=n(242e3),Xe=n(418852),Ye=n(725965),Ze=n(654236),Je=n(174127),Qe=n(66157),$e=n(69268),et=n(965707),tt=n(993894),nt=n(10759),rt=n(795276),at=n(90811),ot=n(248803),st=n(533),it=n(221970),ct=n(357858),lt=n(966e3),ut=n(98728),dt=n(3773),pt=n(543707),ht=n(434731),ft=n(402659),mt=n(339309),gt=n(731970),yt=n(680198),vt=n(157143),bt=n(489099),xt=n(117549),wt=n(93847),kt=n(297714),_t=n(274901),Ct=n(247008),Pt=n(879468),Ot=n(324896),Nt=n(822566),It=n(487874),Tt=n(910875),St=n(333174),Et=n(572416),Mt=n(207426),At=n(344105),Dt=n(496994),Rt=n(939170),Ft=n(524995),jt=n(553810),zt=n(501647),Lt=n(743006),Vt=n(338935),Gt=n(784494),Bt=n(405269),Wt=n(795705),Ut=n(290606),qt=n(761957),Ht=n(722130),Kt=n(471503),Xt=n(841964),Yt=n(230558),Zt=n(49340),Jt=n(342776),Qt=n(601627),$t=n(403611),en=n(437023),tn=n(156737),nn=n(590112),rn=n(365554),an=n(516756);const on=[a._fusedMatMulConfig,o.absConfig,s.acosConfig,i.acoshConfig,c.addConfig,l.addNConfig,u.allConfig,d.anyConfig,p.argMaxConfig,h.argMinConfig,f.asinConfig,m.asinhConfig,g.atanConfig,y.atan2Config,v.atanhConfig,b.avgPoolConfig,x.avgPool3DConfig,w.avgPool3DGradConfig,k.avgPoolGradConfig,_.batchMatMulConfig,C.batchNormConfig,P.batchToSpaceNDConfig,O.bincountConfig,N.broadcastArgsConfig,I.castConfig,T.ceilConfig,S.clipByValueConfig,E.complexConfig,M.complexAbsConfig,A.concatConfig,D.conv2DConfig,R.conv2DBackpropFilterConfig,F.conv2DBackpropInputConfig,j.conv3DConfig,z.conv3DBackpropFilterV2Config,L.conv3DBackpropInputV2Config,V.cosConfig,G.coshConfig,B.cropAndResizeConfig,W.cumsumConfig,U.denseBincountConfig,q.depthToSpaceConfig,H.depthwiseConv2dNativeConfig,K.depthwiseConv2dNativeBackpropFilterConfig,X.depthwiseConv2dNativeBackpropInputConfig,Y.diagConfig,Z.dilation2DConfig,J.dilation2DBackpropFilterConfig,Q.dilation2DBackpropInputConfig,$.einsumConfig,ee.eluConfig,te.eluGradConfig,ne.equalConfig,re.erfConfig,ae.expConfig,oe.expandDimsConfig,se.expm1Config,ie.fftConfig,ce.fillConfig,le.flipLeftRightConfig,ue.floorConfig,de.floorDivConfig,pe.fusedConv2DConfig,he.fusedDepthwiseConv2DConfig,fe.gatherNdConfig,me.gatherV2Config,ge.greaterConfig,ye.greaterEqualConfig,ve.identityConfig,be.ifftConfig,xe.imagConfig,we.isFiniteConfig,ke.isInfConfig,_e.isNaNConfig,Ce.leakyReluConfig,Pe.lessConfig,Oe.lessEqualConfig,Ne.linSpaceConfig,Ie.logConfig,Te.log1pConfig,Se.logicalAndConfig,Ee.logicalNotConfig,Me.logicalOrConfig,Ae.LRNConfig,De.LRNGradConfig,Re.maxConfig,Fe.maximumConfig,je.maxPoolConfig,ze.maxPool3DConfig,Le.maxPool3DGradConfig,Ve.maxPoolGradConfig,Ge.maxPoolWithArgmaxConfig,Be.meanConfig,We.minConfig,Ue.minimumConfig,qe.mirrorPadConfig,He.modConfig,Ke.multinomialConfig,Xe.multiplyConfig,Ye.negConfig,Ze.nonMaxSuppressionV3Config,Je.nonMaxSuppressionV4Config,Qe.nonMaxSuppressionV5Config,$e.notEqualConfig,et.oneHotConfig,tt.onesLikeConfig,nt.packConfig,rt.padV2Config,at.powConfig,ot.preluConfig,st.prodConfig,it.rangeConfig,ct.realConfig,lt.realDivConfig,ut.reciprocalConfig,dt.reluConfig,pt.relu6Config,ht.reshapeConfig,ft.resizeBilinearC
1onfig,mt.resizeBilinearGradConfig,gt.resizeNearestNeighborConfig,yt.resizeNearestNeighborGradConfig,vt.reverseConfig,bt.rotateWithOffsetConfig,xt.roundConfig,wt.rsqrtConfig,kt.scatterNdConfig,_t.selectConfig,Ct.seluConfig,Pt.sigmoidConfig,Ot.signConfig,Nt.sinConfig,It.sinhConfig,Tt.sliceConfig,St.softmaxConfig,Et.softplusConfig,Mt.spaceToBatchNDConfig,At.sparseFillEmptyRowsConfig,Dt.sparseReshapeConfig,Rt.sparseSegmentMeanConfig,Ft.sparseSegmentSumConfig,jt.sparseToDenseConfig,zt.splitVConfig,Lt.sqrtConfig,Vt.squareConfig,Gt.squaredDifferenceConfig,Bt.stepConfig,Wt.stridedSliceConfig,Ut.stringNGramsConfig,qt.stringSplitConfig,Ht.stringToHashBucketFastConfig,Kt.subConfig,Xt.sumConfig,Yt.tanConfig,Zt.tanhConfig,Jt.tileConfig,Qt.topKConfig,$t.transformConfig,en.transposeConfig,tn.uniqueConfig,nn.unpackConfig,rn.unsortedSegmentSumConfig,an.zerosLikeConfig];for(const e of on)(0,r.registerKernel)(e)},717324:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"addImpl",{enumerable:!0,get:function(){return a.addImpl}}),Object.defineProperty(t,"bincountImpl",{enumerable:!0,get:function(){return o.bincountImpl}}),Object.defineProperty(t,"bincountReduceImpl",{enumerable:!0,get:function(){return o.bincountReduceImpl}}),Object.defineProperty(t,"ceilImpl",{enumerable:!0,get:function(){return s.ceilImpl}}),Object.defineProperty(t,"concatImpl",{enumerable:!0,get:function(){return i.concatImpl}}),Object.defineProperty(t,"equalImpl",{enumerable:!0,get:function(){return c.equalImpl}}),Object.defineProperty(t,"expImpl",{enumerable:!0,get:function(){return l.expImpl}}),Object.defineProperty(t,"expm1Impl",{enumerable:!0,get:function(){return u.expm1Impl}}),Object.defineProperty(t,"floorImpl",{enumerable:!0,get:function(){return d.floorImpl}}),Object.defineProperty(t,"gatherNdImpl",{enumerable:!0,get:function(){return p.gatherNdImpl}}),Object.defineProperty(t,"gatherV2Impl",{enumerable:!0,get:function(){return h.gatherV2Impl}}),Object.defineProperty(t,"greaterEqualImpl",{enumerable:!0,get:function(){return m.greaterEqualImpl}}),Object.defineProperty(t,"greaterImpl",{enumerable:!0,get:function(){return f.greaterImpl}}),Object.defineProperty(t,"lessEqualImpl",{enumerable:!0,get:function(){return y.lessEqualImpl}}),Object.defineProperty(t,"lessImpl",{enumerable:!0,get:function(){return g.lessImpl}}),Object.defineProperty(t,"linSpaceImpl",{enumerable:!0,get:function(){return v.linSpaceImpl}}),Object.defineProperty(t,"logImpl",{enumerable:!0,get:function(){return b.logImpl}}),Object.defineProperty(t,"maxImpl",{enumerable:!0,get:function(){return x.maxImpl}}),Object.defineProperty(t,"maximumImpl",{enumerable:!0,get:function(){return w.maximumImpl}}),Object.defineProperty(t,"minimumImpl",{enumerable:!0,get:function(){return k.minimumImpl}}),Object.defineProperty(t,"multiplyImpl",{enumerable:!0,get:function(){return _.multiplyImpl}}),Object.defineProperty(t,"negImpl",{enumerable:!0,get:function(){return C.negImpl}}),Object.defineProperty(t,"notEqualImpl",{enumerable:!0,get:function(){return P.notEqualImpl}}),Object.defineProperty(t,"prodImpl",{enumerable:!0,get:function(){return O.prodImpl}}),Object.defineProperty(t,"rangeImpl",{enumerable:!0,get:function(){return N.rangeImpl}}),Object.defineProperty(t,"rsqrtImpl",{enumerable:!0,get:function(){return I.rsqrtImpl}}),Object.defineProperty(t,"sigmoidImpl",{enumerable:!0,get:function(){return T.sigmoidImpl}}),Object.defineProperty(t,"simpleAbsImpl",{enumerable:!0,get:function(){return r.simpleAbsImpl}}),Object.defineProperty(t,"sliceImpl",{enumerable:!0,get:function(){return S.sliceImpl}}),Object.defineProperty(t,"sparseFillEmptyRowsImpl",{enumerable:!0,get:function(){return E.sparseFillEmptyRowsImpl}}),Object.defineProperty(t,"sparseReshapeImpl",{enumerable:!0,get:function(){return M.sparseReshapeImpl}}),Object.defineProperty(t,"sparseSegmentReductionImpl",{enumerable:!0,get:function(){return A.sparseSegmentReductionImpl}}),Object.defineProperty(t,"sqrtImpl",{enumerable:!0,get:function(){return D.sqrtImpl}}),Object.defineProperty(t,"squaredDifferenceImpl",{enumerable:!0,get:function(){return R.squaredDifferenceImpl}}),Object.defineProperty(t,"stridedSliceImpl",{enumerable:!0,get:function(){return F.stridedSliceImpl}}),Object.defineProperty(t,"stringNGramsImpl",{enumerable:!0,get:function(){return j.stringNGramsImpl}}),Object.defineProperty(t,"stringSplitImpl",{enumerable:!0,get:function(){return z.stringSplitImpl}}),Object.defineProperty(t,"stringToHashBucketFastImpl",{enumerable:!0,get:function(){return L.stringToHashBucketFastImpl}}),Object.defineProperty(t,"subImpl",{enumerable:!0,get:function(){return V.subImpl}}),Object.defineProperty(t,"tileImpl",{enumerable:!0,get:function(){return G.tileImpl}}),Object.defineProperty(t,"topKImpl",{enumerable:!0,get:function(){return B.topKImpl}}),Object.defineProperty(t,"transposeImpl",{enumerable:!0,get:function(){return W.transposeImpl}}),Object.defineProperty(t,"uniqueImpl",{enumerable:!0,get:function(){return U.uniqueImpl}});var r=n(577574),a=n(772994),o=n(938739),s=n(551647),i=n(235464),c=n(25138),l=n(610260),u=n(694199),d=n(48169),p=n(433820),h=n(657985),f=n(849761),m=n(682002),g=n(299730),y=n(490294),v=n(580553),b=n(865817),x=n(581944),w=n(513231),k=n(703348),_=n(418852),C=n(725965),P=n(69268),O=n(533),N=n(387715),I=n(93847),T=n(879468),S=n(910875),E=n(166009),M=n(561885),A=n(590618),D=n(743006),R=n(784494),F=n(323548),j=n(913606),z=n(808043),L=n(41773),V=n(471503),G=n(393052),B=n(76603),W=n(823574),U=n(198788)},650179:(e,t,n)=>{"use strict";
1Object.defineProperty(t,"__esModule",{value:!0}),t.createSimpleBinaryKernelImpl=function(e){return(t,n,a,o,s)=>{const i=r.backend_util.assertAndGetBroadcastShape(t,n),c=i.length,l=r.util.computeStrides(i),u=r.util.sizeFromShape(i),d=r.util.getTypedArrayFromDType(s,u),p=t.length,h=n.length,f=r.util.computeStrides(t),m=r.util.computeStrides(n),g=r.backend_util.getBroadcastDims(t,i),y=r.backend_util.getBroadcastDims(n,i);if(g.length+y.length===0)for(let t=0;t<d.length;++t)d[t]=e(a[t%a.length],o[t%o.length]);else for(let t=0;t<d.length;++t){const n=r.util.indexToLoc(t,c,l),s=n.slice(-p);g.forEach((e=>s[e]=0));const i=r.util.locToIndex(s,p,f),u=n.slice(-h);y.forEach((e=>u[e]=0));const v=r.util.locToIndex(u,h,m);d[t]=e(a[i],o[v])}return[d,i]}};var r=n(735534)},3428:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.binaryKernelFunc=function(e,t,n,i){if(null==n)return n=>{let{inputs:o,backend:s}=n;const{a:c,b:l}=o,u=s;(0,a.assertNotComplex)([c,l],e);const d=u.data.get(c.dataId).values,p=u.data.get(l.dataId).values,h="string"===c.dtype?r.backend_util.fromUint8ToStringArray(d):d,f="string"===c.dtype?r.backend_util.fromUint8ToStringArray(p):p,m=i||c.dtype,[g,y]=t(c.shape,l.shape,h,f,m);return u.makeTensorInfo(y,m,g)};return e=>{let{inputs:r,backend:a}=e;const{a:c,b:l}=r,u=a;if("complex64"===c.dtype||"complex64"===l.dtype){const e=(0,o.cast)({inputs:{x:c},backend:u,attrs:{dtype:"complex64"}}),t=u.data.get(e.dataId),r=t.complexTensorInfos.real,a=t.complexTensorInfos.imag,i=u.data.get(r.dataId).values,d=u.data.get(a.dataId).values,p=(0,o.cast)({inputs:{x:l},backend:u,attrs:{dtype:"complex64"}}),h=u.data.get(p.dataId),f=h.complexTensorInfos.real,m=h.complexTensorInfos.imag,g=u.data.get(f.dataId).values,y=u.data.get(m.dataId).values,[v,b,x]=n(c.shape,l.shape,i,d,g,y),w=u.makeTensorInfo(x,"float32",v),k=u.makeTensorInfo(x,"float32",b),_=(0,s.complex)({inputs:{real:w,imag:k},backend:u});return u.disposeIntermediateTensorInfo(e),u.disposeIntermediateTensorInfo(p),u.disposeIntermediateTensorInfo(w),u.disposeIntermediateTensorInfo(k),_}{const e=u.data.get(c.dataId).values,n=u.data.get(l.dataId).values,r=i||c.dtype,[a,o]=t(c.shape,l.shape,e,n,r);return u.makeTensorInfo(o,r,a)}}},t.createComplexBinaryKernelImpl=function(e){return(t,n,a,o,s,i)=>{const c=r.backend_util.assertAndGetBroadcastShape(t,n),l=r.util.sizeFromShape(c),u=c.length,d=r.util.computeStrides(c),p=r.util.getTypedArrayFromDType("float32",l),h=r.util.getTypedArrayFromDType("float32",l),f=r.backend_util.getBroadcastDims(t,c),m=r.backend_util.getBroadcastDims(n,c),g=r.backend_util.mergeRealAndImagArrays(a,o),y=r.backend_util.mergeRealAndImagArrays(s,i),v=t.length,b=r.util.computeStrides(t),x=n.length,w=r.util.computeStrides(n);if(f.length+m.length===0)for(let t=0;t<p.length;t++){const n=t%g.length,r=t%y.length,a=e(g[2*n],g[2*n+1],y[2*r],y[2*r+1]);p[t]=a.real,h[t]=a.imag}else for(let t=0;t<p.length;t++){const n=r.util.indexToLoc(t,u,d),a=n.slice(-v);f.forEach((e=>a[e]=0));const o=r.util.locToIndex(a,v,b),s=n.slice(-x);m.forEach((e=>s[e]=0));const i=r.util.locToIndex(s,x,w),c=e(g[2*o],g[2*o+1],y[2*i],y[2*i+1]);p[t]=c.real,h[t]=c.imag}return[p,h,c]}};var r=n(735534),a=n(468462),o=n(764979),s=n(795801)},327674:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.fftBatch=function(e,t,n){const a=e.shape,s=a[0],i=a[1],c=n.data.get(e.dataId),l=c.complexTensorInfos.real,u=c.complexTensorInfos.imag,d=[s,i],h=r.util.sizeFromShape(d),m=r.util.getTypedArrayFromDType("float32",h),g=r.util.getTypedArrayFromDType("float32",h);for(let e=0;e<s;e++){const a=(0,p.slice)({inputs:{x:l},backend:n,attrs:{begin:[e,0],size:[1,i]}}),s=(0,p.slice)({inputs:{x:u},backend:n,attrs:{begin:[e,0],size:[1,i]}}),c=(0,o.complex)({inputs:{real:a,imag:s},backend:n}),{real:d,imag:h}=f(c,t,n),y=r.backend_util.mergeRealAndImagArrays(d,h);for(let t=0;t<i;t++){const n=r.backend_util.getComplexWithIndex(y,t);m[e*i+t]=n.real,g[e*i+t]=n.imag}n.disposeIntermediateTensorInfo(a),n.disposeIntermediateTensorInfo(s),n.disposeIntermediateTensorInfo(c)}const y=n.makeTensorInfo(d,"float32",m),v=n.makeTensorInfo(d,"float32",g),b=(0,o.complex)({inputs:{real:y,imag:v},backend:n});return n.disposeIntermediateTensorInfo(y),n.disposeIntermediateTensorInfo(v),b},t.fftImpl=f;var r=n(735534),a=n(772994),o=n(795801),s=n(432930),i=n(848930),c=n(62202),l=n(418852),u=n(357858),d=n(966e3),p=n(910875),h=n(471503);function f(e,t,n){const a=r.util.sizeFromShape(e.shape),o=n.data.get(e.dataId),s=n.data.get(o.complexTensorInfos.real.dataId).values,c=n.data.get(o.complexTensorInfos.imag.dataId).values;if((l=a)&l-1){const e=function(e,t,n){const a=new Float32Array(2*t);for(let o=0;o<t;o++){let s=0,i=0;for(let a=0;a<t;a++){const c=r.backend_util.exponent(o*a,t,n),l=r.backend_util.getComplexWithIndex(e,a);s+=l.real*c.real-l.imag*c.imag,i+=l.real*c.imag+l.imag*c.real}n&&(s/=t,i/=t),r.backend_util.assignToTypedArray(a,s,i,o)}return a}(r.backend_util.mergeRealAndImagArrays(s,c),a,t);return r.backend_util.splitRealAndImagArrays(e)}{const o=m(s,c,a,t,n),l=[e.shape[0],e.shape[1]];if(t){const e=n.makeTensorInfo(l,"float32",o.real),t=n.makeTensorInfo(l,"float32",o.imag),s=n.makeTensorInfo([],"float32",r.util.createScalarValue(a,"float32")),c=(0,i.identity)({inputs:{x:s},backend:n}
1),u=d.realDivConfig.kernelFunc({inputs:{a:e,b:s},backend:n}),p=d.realDivConfig.kernelFunc({inputs:{a:t,b:c},backend:n}),h=n.data.get(u.dataId).values,f=n.data.get(p.dataId).values;return n.disposeIntermediateTensorInfo(e),n.disposeIntermediateTensorInfo(t),n.disposeIntermediateTensorInfo(s),n.disposeIntermediateTensorInfo(c),n.disposeIntermediateTensorInfo(u),n.disposeIntermediateTensorInfo(p),{real:h,imag:f}}return o}var l}function m(e,t,n,i,d){if(1===n)return{real:e,imag:t};const p=r.backend_util.mergeRealAndImagArrays(e,t),f=n/2,g=r.backend_util.complexWithEvenIndex(p),y=g.real,v=g.imag,b=[y.length],x=d.makeTensorInfo(b,"float32",y),w=d.makeTensorInfo(b,"float32",v),k=(0,o.complex)({inputs:{real:x,imag:w},backend:d}),_=r.backend_util.complexWithOddIndex(p),C=_.real,P=_.imag,O=[C.length],N=d.makeTensorInfo(O,"float32",C),I=d.makeTensorInfo(O,"float32",P),T=(0,o.complex)({inputs:{real:N,imag:I},backend:d}),S=m(y,v,f,i,d),E=S.real,M=S.imag,A=[E.length],D=d.makeTensorInfo(A,"float32",E),R=d.makeTensorInfo(A,"float32",M),F=(0,o.complex)({inputs:{real:D,imag:R},backend:d}),j=m(C,P,f,i,d),z=j.real,L=j.imag,V=[z.length],G=d.makeTensorInfo(V,"float32",z),B=d.makeTensorInfo(V,"float32",L),W=(0,o.complex)({inputs:{real:G,imag:B},backend:d}),U=r.backend_util.exponents(n,i),q=[U.real.length],H=d.makeTensorInfo(q,"float32",U.real),K=d.makeTensorInfo(q,"float32",U.imag),X=(0,o.complex)({inputs:{real:H,imag:K},backend:d}),Y=(0,l.multiply)({inputs:{a:X,b:W},backend:d}),Z=(0,a.add)({inputs:{a:F,b:Y},backend:d}
1),J=(0,h.sub)({inputs:{a:F,b:Y},backend:d}),Q=(0,u.real)({inputs:{input:Z},backend:d}),$=(0,u.real)({inputs:{input:J},backend:d}),ee=(0,c.imag)({inputs:{input:Z},backend:d}),te=(0,c.imag)({inputs:{input:J},backend:d}),ne=(0,s.concat)({inputs:[Q,$],backend:d,attrs:{axis:0}}),re=(0,s.concat)({inputs:[ee,te],backend:d,attrs:{axis:0}}),ae=d.data.get(ne.dataId).values,oe=d.data.get(re.dataId).values;return d.disposeIntermediateTensorInfo(x),d.disposeIntermediateTensorInfo(w),d.disposeIntermediateTensorInfo(k),d.disposeIntermediateTensorInfo(N),d.disposeIntermediateTensorInfo(I),d.disposeIntermediateTensorInfo(T),d.disposeIntermediateTensorInfo(D),d.disposeIntermediateTensorInfo(R),d.disposeIntermediateTensorInfo(F),d.disposeIntermediateTensorInfo(G),d.disposeIntermediateTensorInfo(B),d.disposeIntermediateTensorInfo(W),d.disposeIntermediateTensorInfo(H),d.disposeIntermediateTensorInfo(K),d.disposeIntermediateTensorInfo(X),d.disposeIntermediateTensorInfo(Y),d.disposeIntermediateTensorInfo(Z),d.disposeIntermediateTensorInfo(J),d.disposeIntermediateTensorInfo(Q),d.disposeIntermediateTensorInfo(ee),d.disposeIntermediateTensorInfo($),d.disposeIntermediateTensorInfo(te),d.disposeIntermediateTensorInfo(ne),d.disposeIntermediateTensorInfo(re),{real:ae,imag:oe}}},238150:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.applyActivation=function(e,t,n,u,d){if("linear"===n)return(0,a.identity)({inputs:{x:t},backend:e});if("relu"===n)return(0,i.relu)({inputs:{x:t},backend:e});if("elu"===n)return(0,r.elu)({inputs:{x:t},backend:e});if("relu6"===n)return(0,c.relu6)({inputs:{x:t},backend:e});if("prelu"===n)return(0,s.prelu)({inputs:{x:t,alpha:u},backend:e});if("leakyrelu"===n)return(0,o.leakyRelu)({inputs:{x:t},backend:e,attrs:{alpha:d}});if("sigmoid"===n)return(0,l.sigmoid)({inputs:{x:t},backend:e});throw new Error("Activation ".concat(n," has not been implemented for the CPU backend."))};var r=n(312547),a=n(848930),o=n(207076),s=n(248803),i=n(3773),c=n(543707),l=n(879468)},406829:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.maxPool3dPositions=function(e,t){const n=(0,r.buffer)(t.outShape,"int32"),a=t.strideDepth,o=t.strideHeight,s=t.strideWidth,i=t.dilationDepth,c=t.dilationHeight,l=t.dilationWidth,u=t.effectiveFilterDepth,d=t.effectiveFilterHeight,p=t.effectiveFilterWidth,h=t.padInfo.front,f=t.padInfo.top,m=t.padInfo.left;for(let r=0;r<t.batchSize;++r)for(let g=0;g<t.inChannels;++g)for(let y=0;y<t.outDepth;++y){const v=y*a-h;let b=v;for(;b<0;)b+=i;const x=Math.min(t.inDepth,u+v);for(let a=0;a<t.outHeight;++a){const u=a*o-f;let h=u;for(;h<0;)h+=c;const w=Math.min(t.inHeight,d+u);for(let o=0;o<t.outWidth;++o){const f=o*s-m;let k=f;for(;k<0;)k+=l;const _=Math.min(t.inWidth,p+f);let C=Number.NEGATIVE_INFINITY,P=-1;for(let t=b;t<x;t+=i){const n=t-v;for(let a=h;a<w;a+=c){const o=a-u;for(let s=k;s<_;s+=l){const i=s-f,c=e.get(r,t,a,s,g);c>=C&&(C=c,P=n*d*p+o*d+i)}}}n.set(P,r,y,a,o,g)}}}return n},t.maxPoolPositions=function(e,t,n,a){let o=arguments.length>4&&void 0!==arguments[4]&&arguments[4],s=arguments.length>5&&void 0!==arguments[5]&&arguments[5];const i=(0,r.buffer)(a.outShape,"int32"),c=a.strideHeight,l=a.strideWidth,u=a.dilationHeight,d=a.dilationWidth,p=a.effectiveFilterHeight,h=a.effectiveFilterWidth,f=a.padInfo.top,m=a.padInfo.left,g=(0,r.buffer)(t,n,e);for(let e=0;e<a.batchSize;++e)for(let t=0;t<a.inChannels;++t)for(let n=0;n<a.outHeight;++n){const r=n*c-f;let y=r;for(;y<0;)y+=u;const v=Math.min(a.inHeight,p+r);for(let c=0;c<a.outWidth;++c){const p=c*l-m;let f=p;for(;f<0;)f+=d;const b=Math.min(a.inWidth,h+p);let x=Number.NEGATIVE_INFINITY,w=-1;for(let n=y;n<v;n+=u){const i=n-r;for(let r=f;r<b;r+=d){const c=r-p,l=g.get(e,n,r,t);l>x&&(x=l,w=o?s?((e*a.inHeight+n)*a.inWidth+r)*a.inChannels+t:(n*a.inWidth+r)*a.inChannels+t:i*h+c)}}i.set(w,e,n,c,t)}}return i},t.pool=function(e,t,n,a,o,s){const i=o.strideHeight,c=o.strideWidth,l=o.dilationHeight,u=o.dilationWidth,d=o.effectiveFilterHeight,p=o.effectiveFilterWidth,h=o.padInfo.top,f=o.padInfo.left,m="max"===s?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,g=(0,r.buffer)(o.outShape,n),y=g.values,v=o.outShape[1]*o.outShape[2]*o.outShape[3],b=o.outShape[2]*o.outShape[3],x=o.outShape[3];for(let t=0;t<o.batchSize;++t){const n=t*v,r=t*a[0];for(let t=0;t<o.inChannels;++t)for(let g=0;g<o.outHeight;++g){const v=g*i-h,w=Math.max(0,v),k=Math.min(o.inHeight,d+v),_=n+g*b;for(let n=0;n<o.outWidth;++n){const i=n*c-f,d=Math.max(0,i),h=Math.min(o.inWidth,p+i);let g=m,v=0,b=0;for(let n=w;n<k;n+=l){const o=r+n*a[1];for(let n=d;
1n<h;n+=u){const r=e[o+n*a[2]+t];"max"===s&&r>g?g=r:"avg"===s&&(v+=r,b++)}if(isNaN(g))break}y[_+n*x+t]="avg"===s?v/b:g}}}return g},t.pool3d=function(e,t,n,a,o,s){const i=o.strideDepth,c=o.strideHeight,l=o.strideWidth,u=o.dilationDepth,d=o.dilationHeight,p=o.dilationWidth,h=o.effectiveFilterDepth,f=o.effectiveFilterHeight,m=o.effectiveFilterWidth,g=o.padInfo.front,y=o.padInfo.top,v=o.padInfo.left,b="max"===s?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,x=(0,r.buffer)(o.outShape,n),w=x.values,k=o.outShape[1]*o.outShape[2]*o.outShape[3]*o.outShape[4],_=o.outShape[2]*o.outShape[3]*o.outShape[4],C=o.outShape[3]*o.outShape[4],P=o.outShape[4];for(let t=0;t<o.batchSize;++t){const n=t*k,r=t*a[0];for(let t=0;t<o.inChannels;++t)for(let x=0;x<o.outDepth;++x){const k=x*i-g;let O=k;for(;O<0;)O+=u;const N=Math.min(o.inDepth,h+k),I=n+x*_;for(let n=0;n<o.outHeight;++n){const i=n*c-y;let h=i;for(;h<0;)h+=d;const g=Math.min(o.inHeight,f+i),x=I+n*C;for(let n=0;n<o.outWidth;++n){const i=n*l-v;let c=i;for(;c<0;)c+=p;const f=Math.min(o.inWidth,m+i),y=x+n*P;let k=b,_=0,C=0;for(let n=O;n<N;n+=u){const o=r+n*a[1];for(let n=h;n<g;n+=d){const r=o+n*a[2];for(let n=c;n<f;n+=p){const o=e[r+n*a[3]+t];if("max"===s&&o>k?k=o:"avg"===s&&(_+=o,C++),isNaN(k))break}if(isNaN(k))break}if(isNaN(k))break}w[y+t]="avg"===s?_/C:k}}}}return x};var r=n(735534)},816375:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.createSimpleUnaryImpl=function(e){return(t,n,a)=>{const o=r.util.getTypedArrayFromDType(n,t.length);for(let n=0;n<t.length;++n)o[n]=e(t[n],a);return o}};var r=n(735534)},777226:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.unaryKernelFunc=function(e,t,n){return o=>{let{inputs:s,attrs:i,backend:c}=o;const{x:l}=s;if((0,a.assertNotComplex)(l,e),"string"===l.dtype||"string"===n)throw new Error("unaryKernelFunc does not support string input/output");const u=c,d=u.data.get(l.dataId).values,p=r.util.sizeFromShape(l.shape),h=n||l.dtype,f=r.util.getArrayFromDType(h,p);for(let e=0;e<p;++e)f[e]=t(d[e],i);return u.makeTensorInfo(l.shape,h,f)}},t.unaryKernelFuncFromImpl=function(e,t,n){return r=>{let{inputs:o,attrs:s,backend:i}=r;const{x:c}=o;if((0,a.assertNotComplex)(c,e),"string"===c.dtype||"string"===n)throw new Error("unaryKernelFunc does not support string input/output");const l=i,u=l.data.get(c.dataId).values,d=n||c.dtype,p=t(u,d,s);return l.makeTensorInfo(c.shape,d,p)}};var r=n(735534),a=n(468462)},746509:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.zeros=function e(t,n){let o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"float32";if("complex64"===o){const r=e(t,n,"float32"),o=e(t,n,"float32");return(0,a.complex)({inputs:{real:r,imag:o},backend:t})}const s=r.util.makeZerosTypedArray(r.util.sizeFromShape(n),o);return t.makeTensorInfo(n,o,s)};var r=n(735534),a=n(795801)},781944:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.version=void 0;t.version="3.14.0"},351629:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.AddNProgram=void 0;t.AddNProgram=class{constructor(e,t){this.outputShape=[],this.outputShape=e,this.variableNames=t.map(((e,t)=>"T".concat(t)));const n=[];this.variableNames.forEach((e=>{n.push("float v".concat(e," = get").concat(e,"AtOutCoords();"))}));const r=this.variableNames.map((e=>"v".concat(e))).join(" + ");this.userCode="\n void main() {\n ".concat(n.join("\n "),"\n\n float result = ").concat(r,";\n setOutput(result);\n }\n ")}}},166680:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.AddNPackedProgram=void 0;t.AddNPackedProgram=class{constructor(e,t){this.outputShape=[],this.packedInputs=!0,this.packedOutput=!0,this.outputShape=e,this.variableNames=t.map(((e,t)=>"T".concat(t)));const n=[];this.variableNames.forEach((e=>{n.push("vec4 v".concat(e," = get").concat(e,"AtOutCoords();"))}));const r=this.variableNames.map((e=>"v".concat(e))).join(" + ");this.userCode="\n void main() {\n ".concat(n.join("\n "),"\n\n vec4 result = ").concat(r,";\n setOutput(result);\n }\n ")}}},487062:(e,t)=>
1{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ArgMinMaxProgram=void 0;t.ArgMinMaxProgram=class{constructor(e,t,n){this.variableNames=["A"];const{windowSize:r,batchSize:a,outSize:o}=e;n||this.variableNames.push("bestIndicesA"),this.outputShape=[a,o];const s="max"===t?">":"<",i=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 * ".concat(r,";\n\n int bestIndex = inOffset;\n float bestValue = getA(batch, bestIndex);\n\n for (int i = 0; i < ").concat(r,"; i++) {\n int inIdx = ").concat(i,";\n float candidate = getA(batch, inIdx);\n if (candidate ").concat(s," bestValue) {\n bestValue = candidate;\n bestIndex = inIdx;\n }\n }\n setOutput(float(bestIndex));\n }\n ")}}},727311:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ArgMinMaxPackedProgram=void 0;var r=n(735534),a=n(530675),o=n(41990);t.ArgMinMaxPackedProgram=class{constructor(e,t,n,s){this.variableNames=["A"],this.packedInputs=!0,this.packedOutput=!0,r.util.assert(e.length>2,(()=>"Packed arg".concat(n.charAt(0).toUpperCase()+n.slice(1)," supports only inputs with rank above 2.")));const i=e[e.length-1],c=Math.ceil(i/t);this.outputShape=e.slice(0,-1),c>1&&this.outputShape.push(c),s||this.variableNames.push("bestIndicesA");const l=this.outputShape,u=l.length,d=(0,o.getCoordsDataType)(u),p=(0,a.getChannels)("coords",u);let h,f;if(1===c){f=u+1;const e=(0,o.getCoordsDataType)(f);h="\n ".concat(e," sourceLocR = ").concat(e,"(").concat(p.join(),", 0);\n ++").concat(p[u-1],";\n ").concat(e," sourceLocG = ").concat(e,"(").concat(p.join(),", 0);\n ++").concat(p[u-2],";\n ").concat(e," sourceLocA = ").concat(e,"(").concat(p.join(),", 0);\n --").concat(p[u-1],";\n ").concat(e," sourceLocB = ").concat(e,"(").concat(p.join(),", 0);\n --").concat(p[u-2],";")}else f=u,h="\n ".concat(d," sourceLocR = coords;\n ++").concat(p[u-1],";\n ").concat(d," sourceLocG = coords;\n ++").concat(p[u-2],";\n ").concat(d," sourceLocA = coords;\n --").concat(p[u-1],";\n ").concat(d," sourceLocB = coords;\n --").concat(p[u-2],";");const m=["x","y","z","w","u","v"].slice(0,f),g="."+m[f-1],y=m.map((e=>"int "+e)),v=(0,a.getChannels)("sourceLocR",f-1).concat("inIdx.r"),b=(0,a.getChannels)("sourceLocG",f-1).concat("inIdx.g"),x=(0,a.getChannels)("sourceLocB",f-1).concat("inIdx.b"),w=(0,a.getChannels)("sourceLocA",f-1).concat("inIdx.a"),k="max"===n?"greaterThan":"lessThan",_=s?"":"\n inIdx = round(vec4(getBestIndicesAChannel(".concat(v.join(),"),\n getBestIndicesAChannel(").concat(b.join(),"),\n getBestIndicesAChannel(").concat(x.join(),"),\n getBestIndicesAChannel(").concat(w.join(),")));"),C="vec4(\n getAChannel(".concat(v.join(),"),\n hasNextCol ? getAChannel(").concat(b.join(),") : 0.,\n hasNextRow ? getAChannel(").concat(x.join(),") : 0.,\n hasNextRow && hasNextCol ? getAChannel(").concat(w.join(),") : 0.)"),P=s?"":"\n float getBestIndicesAChannel(".concat(y.join(),") {\n return getChannel(getBestIndicesA(").concat(m.join(),"),\n vec2(").concat(m.slice(-2).join(),"));\n }");this.userCode="\n float getAChannel(".concat(y.join(),") {\n return getChannel(getA(").concat(m.join(),"),\n vec2(").concat(m.slice(-2).join(),"));\n }\n ").concat(P,"\n void main() {\n ").concat(d," coords = getOutputCoords();\n bool hasNextCol = ").concat(p[u-1]," < ").concat(l[u-1]-1,";\n bool hasNextRow = ").concat(p[u-2]," < ").concat(l[u-2]-1,";\n ").concat(h,"\n ivec4 srcIdx = ivec4(sourceLocR").concat(g,", sourceLocG").concat(g,",\n sourceLocB").concat(g,", sourceLocA").concat(g,") * ").concat(t,";\n ivec4 inIdx = srcIdx;\n vec4 bestIndex = vec4(inIdx);\n vec4 bestValue = ").concat(C,";\n\n for (int i = 0; i < ").concat(t,";
1 i++) {\n inIdx = srcIdx;\n ").concat(_,"\n vec4 candidate = ").concat(C,";\n bvec4 nan = isnan(candidate);\n bvec4 replace = bvec4(\n vec4(").concat(k,"(candidate, bestValue)) * (vec4(1.0) - vec4(nan)));\n\n bestValue = vec4(replace.x ? candidate.x : bestValue.x,\n replace.y ? candidate.y : bestValue.y,\n replace.z ? candidate.z : bestValue.z,\n replace.w ? candidate.w : bestValue.w);\n bestIndex = mix(bestIndex, vec4(inIdx), vec4(replace));\n srcIdx++;\n }\n setOutput(bestIndex);\n }\n ")}}},77764:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.AvgPool3DBackpropProgram=t.AvgPool2DBackpropProgram=void 0;t.AvgPool2DBackpropProgram=class{constructor(e){this.variableNames=["dy"],this.outputShape=e.inShape;const t=e.filterHeight,n=e.filterWidth,r=e.strideHeight,a=e.strideWidth,o=e.dilationHeight,s=e.dilationWidth,i=e.effectiveFilterHeight,c=e.effectiveFilterWidth,l=i-1-e.padInfo.top,u=c-1-e.padInfo.left,d=1/(t*n);this.userCode="\n const ivec2 pads = ivec2(".concat(l,", ").concat(u,");\n const float avgMultiplier = float(").concat(d,");\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 < ").concat(i,";\n wR += ").concat(o,") {\n float dyR = float(dyRCorner + wR) / ").concat(r,".0;\n\n if (dyR < 0.0 || dyR >= ").concat(e.outHeight,".0 || fract(dyR) > 0.0) {\n continue;\n }\n int idyR = int(dyR);\n\n for (int wC = 0; wC < ").concat(c,";\n wC+= ").concat(s,") {\n float dyC = float(dyCCorner + wC) / ").concat(a,".0;\n\n if (dyC < 0.0 || dyC >= ").concat(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 ")}};t.AvgPool3DBackpropProgram=class{constructor(e){this.variableNames=["dy"],this.outputShape=e.inShape;const t=e.filterDepth,n=e.filterHeight,r=e.filterWidth,a=e.strideDepth,o=e.strideHeight,s=e.strideWidth,i=e.dilationDepth,c=e.dilationHeight,l=e.dilationWidth,u=e.effectiveFilterDepth,d=e.effectiveFilterHeight,p=e.effectiveFilterWidth,h=u-1-e.padInfo.front,f=d-1-e.padInfo.top,m=p-1-e.padInfo.left,g=1/(t*n*r);this.userCode="\n const ivec3 pads = ivec3(".concat(h,", ").concat(f,", ").concat(m,");\n const float avgMultiplier = float(").concat(g,");\n\n void main() {\n ivec5 coords = getOutputCoords();\n int batch = coords.x;\n int ch = coords.u;\n\n ivec3 dyCorner = ivec3(coords.y, coords.z, coords.w) - pads;\n int dyDCorner = dyCorner.x;\n int dyRCorner = dyCorner.y;\n int dyCCorner = dyCorner.z;\n\n // Convolve dy(?, ?, ?, d) with pos mask(:, :, :, ch) to get\n // dx(xD, xR, xC, ch).\n // ? = to be determined. : = across all values in that axis.\n float dotProd = 0.0;\n\n for (int wD = 0; wD < ").concat(u,";\n wD += ").concat(i,") {\n float dyD = float(dyDCorner + wD) / ").concat(a,".0;\n\n if (dyD < 0.0 || dyD >= ").concat(e.outDepth,".0 || fract(dyD) > 0.0) {\n continue;\n }\n int idyD = int(dyD);\n\n for (int wR = 0; wR < ").concat(d,";\n wR += ").concat(c,") {\n float dyR = float(dyRCorner + wR) / ").concat(o,".0;\n\n if (dyR < 0.0 || dyR >= ").concat(e.outHeight,".0 ||\n fract(dyR) > 0.0) {\n continue;\n }\n int idyR = int(dyR);\n\n for (int wC = 0; wC < ").concat(p,";\n wC += ").concat(l,") {\n float dyC = float(dyCCorner + wC) / ").concat(s,".0;\n\n if (dyC < 0.0 || dyC >= ").concat(e.outWidth,".0 ||\n fract(dyC) > 0.0) {\n continue;\n }\n int idyC = int(dyC);\n\n float dyValue = getDy(batch, idyD, idyR, idyC, ch);\n\n dotProd += dyValue * avgMultiplier;\n }\n }\n }\n setOutput(dotProd);\n }\n ")}}}
1,473002:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.MathBackendWebGL=t.EPSILON_FLOAT32=t.EPSILON_FLOAT16=void 0,t.getBinaryCache=S,n(640571);var r=n(735534),a=n(821551),o=n(430729),s=n(258587),i=n(929414),c=n(567312),l=n(497365),u=n(769672),d=n(80567),p=P(n(965438)),h=n(509570),f=n(446060),m=n(769801),g=P(n(845772)),y=g,v=n(463574),b=P(n(934500)),x=b,w=n(721797),k=n(59579),_=P(n(519617));function C(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(C=function(e){return e?n:t})(e)}function P(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=C(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if("default"!==o&&{}.hasOwnProperty.call(e,o)){var s=a?Object.getOwnPropertyDescriptor(e,o):null;s&&(s.get||s.set)?Object.defineProperty(r,o,s):r[o]=e[o]}return r.default=e,n&&n.set(e,r),r}const O=r.kernel_impls.whereImpl,N=t.EPSILON_FLOAT32=1e-7,I=t.EPSILON_FLOAT16=1e-4,T={};function S(e){return e in T||(T[e]={}),T[e]}const E=(0,r.env)().getNumber("CPU_HANDOFF_SIZE_THRESHOLD");class M extends r.KernelBackend{constructor(e){if(super(),this.pendingRead=new WeakMap,this.pendingDisposal=new WeakSet,this.dataRefCount=new WeakMap,this.numBytesInGPU=0,this.uploadWaitMs=0,this.downloadWaitMs=0,this.lastGlFlushTime=0,this.warnedAboutMemory=!1,this.pendingDeletes=0,this.disposed=!1,!(0,r.env)().getBool("HAS_WEBGL"))throw new Error("WebGL is not supported on this device");let t;if(null!=e){if(e instanceof d.GPGPUContext)t=e;else{const n=(0,a.getWebGLContext)((0,r.env)().getNumber("WEBGL_VERSION"),e);t=new d.GPGPUContext(n)}this.binaryCache={},this.gpgpuCreatedLocally=!1}else{const e=(0,a.getWebGLContext)((0,r.env)().getNumber("WEBGL_VERSION"));t=new d.GPGPUContext(e),this.binaryCache=S((0,r.env)().getNumber("WEBGL_VERSION")),this.gpgpuCreatedLocally=!0}this.gpgpu=t,this.canvas=this.gpgpu.gl.canvas,this.textureManager=new v.TextureManager(this.gpgpu),this.numMBBeforeWarning=null==(0,r.env)().global.screen?1024:(0,r.env)().global.screen.height*(0,r.env)().global.screen.width*window.devicePixelRatio*600/1024/1024,this.texData=new r.DataStorage(this,(0,r.engine)())}nextDataId(){return M.nextDataId++}numDataIds(){return this.texData.numDataIds()-this.pendingDeletes}write(e,t,n){if(((0,r.env)().getBool("WEBGL_CHECK_NUMERICAL_PROBLEMS")||(0,r.env)().getBool("DEBUG"))&&this.checkNumericalProblems(e),"complex64"===n&&null!=e)throw new Error("Cannot write to a complex64 dtype. Please use tf.complex(real, imag).");const a={id:this.nextDataId()};return this.texData.set(a,{shape:t,dtype:n,values:e,usage:g.TextureUsage.UPLOAD,refCount:1}),a}refCount(e){if(this.texData.has(e)){return this.texData.get(e).refCount}return 0}incRef(e){this.texData.get(e).refCount++}decRef(e){if(this.texData.has(e)){this.texData.get(e).refCount--}}move(e,t,n,a,o){if((0,r.env)().getBool("DEBUG")&&this.checkNumericalProblems(t),"complex64"===a)throw new Error("Cannot write to a complex64 dtype. Please use tf.complex(real, imag).");this.texData.set(e,{shape:n,dtype:a,values:t,usage:g.TextureUsage.UPLOAD,refCount:o})}disposeIntermediateTensorInfo(e){this.disposeData(e.dataId)}readSync(e){const t=this.texData.get(e),{values:n,dtype:a,complexTensorInfos:o,slice:s,shape:i,isPacked:c}=t;if(null!=s){let t;t=c?new w.UnaryOpPackedProgram(i,x.CLONE):new b.UnaryOpProgram(i,x.CLONE);const n=this.runWebGLProgram(t,[{dataId:e,shape:i,dtype:a}],a),r=this.readSync(n.dataId);return this.disposeIntermediateTensorInfo(n),r}if(null!=n)return this.convertAndCacheOnCPU(e);if("string"===a)return n;const l=null!=this.activeTimers;let u,d;if(l&&(u=r.util.now()),"complex64"===a){const e=this.readSync(o.real.dataId),t=this.readSync(o.imag.dataId);d=r.backend_util.mergeRealAndImagArrays(e,t)}else d=this.getValuesFromTexture(e);return l&&(this.downloadWaitMs+=r.util.now()-u),this.convertAndCacheOnCPU(e,d)}async read(e){if(this.pendingRead.has(e)){const t=this.pendingRead.get(e);return new Promise((e=>t.push(e)))}const t=this.texData.get(e),{values:n,shape:a,slice:o,dtype:s,complexTensorInfos:i,isPacked:c}=t;if(null!=o){let t;t=c?new w.UnaryOpPackedProgram(a,x.CLONE):new b.UnaryOpProgram(a,x.CLONE);const n=this.runWebGLProgram(t,[{dataId:e,shape:a,dtype:s}],s),r=this.read(n.dataId);return this.disposeIntermediateTensorInfo(n),r}if(null!=n)return this.convertAndCacheOnCPU(e);if((0,r.env)().getBool("DEBUG")&&!(0,r.env)().getBool("WEBGL_DOWNLOAD_FLOAT_ENABLED")&&2===(0,r.env)().getNumber("WEBGL_VERSION"))throw new Error("tensor.data() with WEBGL_DOWNLOAD_FLOAT_ENABLED=false and WEBGL_VERSION=2 not yet supported.");let l,u,d=null;if("complex64"!==s&&(0,r.env)().get("WEBGL_BUFFER_SUPPORTED")){l=this.decode(e);const t=this.texData.get(l.dataId);d=this.gpgpu.createBufferFromTexture(t.texture.texture,...y.getDenseTexShape(a))}if(this.pendingRead.set(e,[]),"complex64"!==s&&await this.gpgpu.createAndWaitForFence(),"complex64"===s){const e=await Promise.all([this.read(i.real.dataId),this.read(i.imag.dataId)]),t=e[0],n=e[1];u=r.backend_util.mergeRealAndImagArrays(t,n)}else if(null==d)u=this.getValuesFromTexture(e);else{const e=r.util.sizeFromShape(a);u=this.gpgpu.downloadFloat32MatrixFromBuffer(d,e)}if(null!=l&&this.disposeIntermediateTensorInfo(l),null!=d){const e=this.gpgpu.gl;_.callAndCheck(e,(()=>e.deleteBuffer(d)))}const p=this.convertAndCacheOnCPU(e,u),h=this.pendingRead.get(e);return this.pendingRead.delete(e),h.forEach((e=>e(p))),this.pendingDisposal.has(e)&&(this.pendingDisposal.delete(e),this.disposeData(e)&&(0,r.engine)().removeDataId(e,this),this.pendingDeletes--),p}readToGPU(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const n=this.texData.get(e),{values:a,shape:o,slice:s,dtype:i,isPacked:c,texture:l}=n;if("complex64"===i)throw new Error("Does not support reading texture for complex64 dtype.");if(null!=s){let n;n=c?new w.UnaryOpPackedProgram(o,x.CLONE):new b.UnaryOpProgram(o,x.CLONE);const r=this.runWebGLProgram(n,[{dataId:e,shape:o,dtype:i}],i),a=this.readToGPU(r,t);return this.disposeIntermediateTensorInfo(r),a}if(null==l)throw null!=a?new Error("Data is not on GPU but on CPU."):new Error("There is no data on GPU or CPU.");const u=this.decode(e,t.customTexShape),d=(0,r.engine)().makeTensorFromDataId(u.dataId,u.shape,u.dtype),p=this.texData.get(u.dataId);return Object.assign({tensorRef:d},p.texture)}bufferSync(e){const t=this.readSync(e.dataId);let n=t;if("string"===e.dtype)try{n=t.map((e=>r.util.decodeString(e)))}catch(e){throw new Error("Failed to decode encoded string bytes into utf-8")}return(0,r.buffer)(e.shape,e.dtype,n)}checkNumericalProblems(e){if(null!=e)for(let t=0;t<e.length;t++){const n=e[t];if(!_.canBeRepresented(n)){if((0,r.env)().getBool("WEBGL_RENDER_FLOAT32_CAPABLE"))throw Error("The value ".concat(n," cannot be represented with your ")+"current settings. Consider enabling float32 rendering: 'tf.env().set('WEBGL_RENDER_FLOAT32_ENABLED', true);'");throw Error("The value ".concat(n," cannot be represented on this device."))}}}getValuesFromTexture(e){const{shape:t,dtype:n,isPacked:a}=this.texData.get(e),o=r.util.sizeFromShape(t);if((0,r.env)().getBool("WEBGL_DOWNLOAD_FLOAT_ENABLED")){const n=this.decode(e),r=this.texData.get(n.dataId),a=this.gpgpu.downloadMatrixFromPackedTexture(r.texture.texture,...y.getDenseTexShape(t)).subarray(0,o);return this.disposeIntermediateTensorInfo(n),a}const s=(0,r.env)().getBool("WEBGL_PACK")&&!0===a,l=s?_.getShapeAs3D(t):t,u=s?new c.EncodeFloatPackedProgram(l):new i.EncodeFloatProgram(l),d=this.runWebGLProgram(u,[{shape:l,dtype:n,dataId:e}],"float32"),p=this.texData.get(d.dataId),h=this.gpgpu.downloadByteEncodedFloatMatrixFromOutputTexture(p.texture.texture,p.texShape[0],p.texShape[1]).subarray(0,o);return this.disposeIntermediateTensorInfo(d),h}timerAvailable(){return(0,r.env)().getNumber("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_RELIABLE")>0}time(e){const t=this.activeTimers,n=[];let a=!1;null==this.programTimersStack?(this.programTimersStack=n,a=!0):this.activeTimers.push(n),this.activeTimers=n,e();const o=r.util.flatten(this.activeTimers.map((e=>e.query))).filter((e=>null!=e)),s=r.util.flatten(this.activeTimers.map((e=>e.name))).filter((e=>null!=e));this.activeTimers=t,a&&(this.programTimersStack=null);const i={uploadWaitMs:this.uploadWaitMs,downloadWaitMs:this.downloadWaitMs,kernelMs:null,wallMs:null};return(async()=>
1{if((0,r.env)().getNumber("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_RELIABLE")>0){const e=await Promise.all(o);i.kernelMs=r.util.sum(e),i.getExtraProfileInfo=()=>e.map(((e,t)=>({name:s[t],ms:e}))).map((e=>"".concat(e.name,": ").concat(e.ms))).join(", ")}else i.kernelMs={error:"WebGL query timers are not supported in this environment."};return this.uploadWaitMs=0,this.downloadWaitMs=0,i})()}memory(){return{unreliable:!1,numBytesInGPU:this.numBytesInGPU,numBytesInGPUAllocated:this.textureManager.numBytesAllocated,numBytesInGPUFree:this.textureManager.numBytesFree}}startTimer(){return(0,r.env)().getNumber("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_RELIABLE")>0?this.gpgpu.beginQuery():{startMs:r.util.now(),endMs:null}}endTimer(e){return(0,r.env)().getNumber("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_RELIABLE")>0?(this.gpgpu.endQuery(),e):(e.endMs=r.util.now(),e)}async getQueryTime(e){if((0,r.env)().getNumber("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_RELIABLE")>0)return this.gpgpu.waitForQueryAndGetTime(e);const t=e;return t.endMs-t.startMs}disposeData(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(this.pendingDisposal.has(e))return!1;if(!this.texData.has(e))return!0;if(t?this.texData.get(e).refCount=0:this.texData.get(e).refCount--,!t&&this.texData.get(e).refCount>0)return!1;if(this.pendingRead.has(e))return this.pendingDisposal.add(e),this.pendingDeletes++,!1;this.releaseGPUData(e);const{complexTensorInfos:n}=this.texData.get(e);return null!=n&&(this.disposeData(n.real.dataId,t),this.disposeData(n.imag.dataId,t)),this.texData.delete(e),!0}releaseGPUData(e){const{texture:t,dtype:n,texShape:r,usage:a,isPacked:o,slice:s}=this.texData.get(e),i=s&&s.origDataId||e,c=this.dataRefCount.get(i);c>1?this.dataRefCount.set(i,c-1):(this.dataRefCount.delete(i),null!=t&&(this.numBytesInGPU-=this.computeBytes(r,n),this.textureManager.releaseTexture(t,r,a,o)));const l=this.texData.get(e);l.texture=null,l.texShape=null,l.isPacked=!1,l.slice=null}getTexture(e){return this.uploadToGPU(e),this.texData.get(e).texture.texture}getDataInfo(e){return this.texData.get(e)}shouldExecuteOnCPU(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:E;return(0,r.env)().getBool("WEBGL_CPU_FORWARD")&&e.every((e=>null==this.texData.get(e.dataId).texture&&r.util.sizeFromShape(e.shape)<t))}getGPGPUContext(){return this.gpgpu}where(e){r.backend_util.warn("tf.where() in webgl locks the UI thread. Call tf.whereAsync() instead");const t=e.dataSync();return O(e.shape,t)}packedUnaryOp(e,t,n){const a=new w.UnaryOpPackedProgram(e.shape,t),o=this.compileAndRun(a,[e],n);return(0,r.engine)().makeTensorFromDataId(o.dataId,o.shape,o.dtype)}abs(e){if(this.shouldExecuteOnCPU([e])&&"complex64"!==e.dtype){const t=(0,h.simpleAbsImplCPU)(this.texData.get(e.dataId).values);return this.makeOutput(e.shape,e.dtype,t)}if((0,r.env)().getBool("WEBGL_PACK_UNARY_OPERATIONS"))return this.packedUnaryOp(e,x.ABS,e.dtype);const t=new b.UnaryOpProgram(e.shape,x.ABS),n=this.compileAndRun(t,[e]);return(0,r.engine)().makeTensorFromDataId(n.dataId,n.shape,n.dtype)}makeTensorInfo(e,t,n){let a;if("string"===t&&null!=n&&n.length>0&&r.util.isString(n[0])){const o=n.map((e=>r.util.encodeString(e)));a=this.write(o,e,t)}else a=this.write(n,e,t);return this.texData.get(a).usage=null,{dataId:a,shape:e,dtype:t}}makeOutput(e,t,n){const{dataId:a}=this.makeTensorInfo(e,t,n);return(0,r.engine)().makeTensorFromDataId(a,e,t,this)}unpackTensor(e){const t=new k.UnpackProgram(e.shape);return this.runWebGLProgram(t,[e],e.dtype)}packTensor(e){const t=new f.PackProgram(e.shape);return this.runWebGLProgram(t,[e],e.dtype,null,!0)}packedReshape(e,t){const n=[_.getBatchDim(e.shape),..._.getRowsCols(e.shape)],r={dtype:e.dtype,shape:n,dataId:e.dataId},a=[_.getBatchDim(t),..._.getRowsCols(t)],o=new m.ReshapePackedProgram(a,n),s=[n],i=this.runWebGLProgram(o,[r],e.dtype,s,!0);return{dataId:i.dataId,shape:t,dtype:i.dtype}}decode(e,t){const n=this.texData.get(e),{isPacked:a,shape:i,dtype:c}=n;if(null!=t){const e=r.util.sizeFromShape(i),n=t[0]*t[1]*4;r.util.assert(e<=n,(()=>"customTexShape is too small. Row * Column * 4 should be equal or larger than the size of the tensor data."))}const l=_.getShapeAs3D(i);let u;u=a?new s.DecodeMatrixPackedProgram(l):new o.DecodeMatrixProgram(l);const d=[null!=t?t:y.getDenseTexShape(l)];return{dtype:c,shape:i,dataId:this.runWebGLProgram(u,[{shape:l,dtype:c,dataId:e}],c,d,!0,t).dataId}}runWebGLProgram(e,t,n,a){let o=arguments.length>4&&void 0!==arguments[4]&&arguments[4],s=arguments.length>5?arguments[5]:void 0;const i=this.makeTensorInfo(e.outputShape,n),c=this.texData.get(i.dataId);if(e.packedOutput&&(c.isPacked=!0),e.outPackingScheme===y.PackingScheme.DENSE){const t=null!=s?s:y.getDenseTexShape(e.outputShape);c.texShape=t.map((e=>2*e))}if(null!=e.outTexUsage&&(c.usage=e.outTexUsage),0===r.util.sizeFromShape(i.shape))return c.values=r.util.getTypedArrayFromDType(i.dtype,0),i;const l=[],u=t.map((t=>{if("complex64"===t.dtype)throw new Error("GPGPUProgram does not support complex64 input. For complex64 dtypes, please separate the program into real and imaginary parts.");let n=this.texData.get(t.dataId);
1if(null==n.texture){if(!e.packedInputs&&r.util.sizeFromShape(t.shape)<=(0,r.env)().getNumber("WEBGL_SIZE_UPLOAD_UNIFORM"))return{shape:t.shape,texData:null,isUniform:!0,uniformValues:n.values};e.packedInputs&&(n.isPacked=!0,n.shape=t.shape)}if(this.uploadToGPU(t.dataId),!!n.isPacked!=!!e.packedInputs)t=n.isPacked?this.unpackTensor(t):this.packTensor(t),l.push(t),n=this.texData.get(t.dataId);else if(n.isPacked&&!_.isReshapeFree(n.shape,t.shape)){const e=t,r=t.shape;t.shape=n.shape,t=this.packedReshape(t,r),l.push(t),n=this.texData.get(t.dataId),e.shape=r}return{shape:t.shape,texData:n,isUniform:!1}}));this.uploadToGPU(i.dataId);const d={shape:i.shape,texData:c,isUniform:!1},h=p.makeShaderKey(e,u,d),f=this.getAndSaveBinary(h,(()=>p.compileProgram(this.gpgpu,e,u,d))),m=null!=this.activeTimers;let g;m&&(g=this.startTimer()),p.runProgram(this.gpgpu,f,u,d,a),l.forEach((e=>this.disposeIntermediateTensorInfo(e))),m&&(g=this.endTimer(g),this.activeTimers.push({name:e.constructor.name,query:this.getQueryTime(g)}));const v=(0,r.env)().get("WEBGL_FLUSH_THRESHOLD");if(v>0){const e=r.util.now();e-this.lastGlFlushTime>v&&(this.gpgpu.gl.flush(),this.lastGlFlushTime=e)}if(!(0,r.env)().getBool("WEBGL_LAZILY_UNPACK")&&c.isPacked&&!1===o){const e=this.unpackTensor(i);return this.disposeIntermediateTensorInfo(i),e}return i}compileAndRun(e,t,n,r){let a=arguments.length>4&&void 0!==arguments[4]&&arguments[4];n=n||t[0].dtype;return this.runWebGLProgram(e,t,n,r,a)}getAndSaveBinary(e,t){return e in this.binaryCache||(this.binaryCache[e]=t()),this.binaryCache[e]}getTextureManager(){return this.textureManager}dispose(){if(!this.disposed){if(!(0,r.env)().getBool("IS_TEST")){Object.keys(this.binaryCache).forEach((e=>{this.gpgpu.deleteProgram(this.binaryCache[e].webGLProgram),delete this.binaryCache[e]}))}this.textureManager.dispose(),null!=this.canvas&&"undefined"!=typeof HTMLCanvasElement&&this.canvas instanceof HTMLCanvasElement?this.canvas.remove():this.canvas=null,this.gpgpuCreatedLocally&&(this.gpgpu.program=null,this.gpgpu.dispose()),this.disposed=!0}}floatPrecision(){return null==this.floatPrecisionValue&&(this.floatPrecisionValue=(0,r.tidy)((()=>{if(!(0,r.env)().get("WEBGL_RENDER_FLOAT32_ENABLED")){const e=(0,r.env)().getBool("DEBUG");(0,r.env)().set("DEBUG",!1);const t=this.abs((0,r.scalar)(1e-8)).dataSync()[0];if((0,r.env)().set("DEBUG",e),t>0)return 32}return 16}))),this.floatPrecisionValue}epsilon(){return 32===this.floatPrecision()?N:I}uploadToGPU(e){const t=this.texData.get(e),{shape:n,dtype:a,values:o,texture:s,usage:i,isPacked:c}=t;if(null!=s)return;const d=null!=this.activeTimers;let p;d&&(p=r.util.now());let h=t.texShape;if(null==h&&(h=_.getTextureShapeFromLogicalShape(n,c),t.texShape=h),null!=o){const e=_.getShapeAs3D(n);let s,i=h[1],f=h[0];const m=o instanceof Uint8Array||o instanceof Uint8ClampedArray;!c&&m||([i,f]=y.getPackedMatrixTextureShapeWidthHeight(h[0],h[1])),s=c?new u.EncodeMatrixPackedProgram(e,m):new l.EncodeMatrixProgram(e,m);const v=m?[f,i]:h,b=this.makeTensorInfo(v,a),x=this.texData.get(b.dataId);x.usage=m?g.TextureUsage.PIXELS:g.TextureUsage.UPLOAD,x.texShape=v,this.gpgpu.uploadDenseMatrixToTexture(this.getTexture(b.dataId),i,f,o);const w=[[f,i]],k=!0,C=this.runWebGLProgram(s,[b],a,w,k),P=this.texData.get(C.dataId);t.texture=P.texture,t.texShape=P.texShape,t.isPacked=P.isPacked,t.usage=P.usage,this.disposeIntermediateTensorInfo(b),this.texData.delete(C.dataId),t.values=null,d&&(this.uploadWaitMs+=r.util.now()-p)}else{const e=this.acquireTexture(h,i,a,c);t.texture=e}}convertAndCacheOnCPU(e,t){const n=this.texData.get(e),{dtype:r}=n;return this.releaseGPUData(e),null!=t&&(n.values=function(e,t){if("float32"===t||"complex64"===t)return e;if("int32"===t||"bool"===t){const n="int32"===t?new Int32Array(e.length):new Uint8Array(e.length);for(let t=0;t<n.length;++t)n[t]=Math.round(e[t]);return n}throw new Error("Unknown dtype ".concat(t))}(t,r)),n.values}acquireTexture(e,t,n,r){if(this.numBytesInGPU+=this.computeBytes(e,n),!this.warnedAboutMemory&&this.numBytesInGPU>1024*this.numMBBeforeWarning*1024){const e=(this.numBytesInGPU/1024/1024).toFixed(2);this.warnedAboutMemory=!0,console.warn("High memory usage in GPU: ".concat(e," MB, ")+"most likely due to a memory leak")}return this.textureManager.acquireTexture(e,t,r)}computeBytes(e,t){return e[0]*e[1]*r.util.bytesPerElement(t)}}
1t.MathBackendWebGL=M,M.nextDataId=0},108244:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r={webgl:!0,version_webgl:!0};Object.defineProperty(t,"version_webgl",{enumerable:!0,get:function(){return s.version}}),t.webgl=void 0;var a=n(735534),o=n(473002),s=n(319902),i=n(929267);Object.keys(i).forEach((function(e){"default"!==e&&"__esModule"!==e&&(Object.prototype.hasOwnProperty.call(r,e)||e in t&&t[e]===i[e]||Object.defineProperty(t,e,{enumerable:!0,get:function(){return i[e]}}))})),a.device_util.isBrowser()&&(0,a.registerBackend)("webgl",(()=>new o.MathBackendWebGL),2);t.webgl={forceHalfFloat:i.forceHalfFloat}},716833:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.BatchNormProgram=void 0;var r=n(735534);t.BatchNormProgram=class{constructor(e,t,n,a,o,s){this.outputShape=[],this.variableNames=["x","mean","variance"],r.backend_util.assertAndGetBroadcastShape(e,t),r.backend_util.assertAndGetBroadcastShape(e,n);let i="0.0";null!=a&&(r.backend_util.assertAndGetBroadcastShape(e,a),this.variableNames.push("offset"),i="getOffsetAtOutCoords()");let c="1.0";null!=o&&(r.backend_util.assertAndGetBroadcastShape(e,o),this.variableNames.push("scale"),c="getScaleAtOutCoords()"),this.outputShape=e,this.userCode="\n void main() {\n float x = getXAtOutCoords();\n float mean = getMeanAtOutCoords();\n float variance = getVarianceAtOutCoords();\n float offset = ".concat(i,";\n float scale = ").concat(c,";\n float inv = scale * inversesqrt(variance + float(").concat(s,"));\n setOutput(dot(vec3(x, -mean, offset), vec3(inv, inv, 1)));\n }\n ")}}},577245:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.BatchNormPackedProgram=void 0;var r=n(735534);t.BatchNormPackedProgram=class{constructor(e,t,n,a,o,s){this.packedInputs=!0,this.packedOutput=!0,this.variableNames=["x","mean","variance"],r.backend_util.assertAndGetBroadcastShape(e,t),r.backend_util.assertAndGetBroadcastShape(e,n);let i="vec4(0.0)";null!=a&&(r.backend_util.assertAndGetBroadcastShape(e,a),this.variableNames.push("offset"),i="getOffsetAtOutCoords()");let c="vec4(1.0)";null!=o&&(r.backend_util.assertAndGetBroadcastShape(e,o),this.variableNames.push("scale"),c="getScaleAtOutCoords()"),this.outputShape=e,this.userCode="\n void main() {\n vec4 offset = ".concat(i,";\n vec4 scale = ").concat(c,";\n\n vec4 x = getXAtOutCoords();\n vec4 mean = getMeanAtOutCoords();\n vec4 variance = getVarianceAtOutCoords();\n\n vec4 inv = scale * inversesqrt(variance + vec4(").concat(s,"));\n\n setOutput((x - mean) * inv + offset);\n }\n ")}}},434595:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.COMPLEX_MULTIPLY=t.BinaryOpComplexProgram=void 0;var r=n(735534);t.COMPLEX_MULTIPLY={REAL:"return areal * breal - aimag * bimag;",IMAG:"return areal * bimag + aimag * breal;"};t.BinaryOpComplexProgram=class{constructor(e,t,n){this.variableNames=["AReal","AImag","BReal","BImag"],this.outputShape=r.backend_util.assertAndGetBroadcastShape(t,n),this.userCode="\n float binaryOpComplex(\n float areal, float aimag, float breal, float bimag) {\n ".concat(e,"\n }\n\n void main() {\n float areal = getARealAtOutCoords();\n float aimag = getAImagAtOutCoords();\n float breal = getBRealAtOutCoords();\n float bimag = getBImagAtOutCoords();\n setOutput(binaryOpComplex(areal, aimag, breal, bimag));\n }\n ")}}},386960:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.SQUARED_DIFFERENCE=t.CHECK_NAN_SNIPPET=t.BinaryOpProgram=void 0;var r=n(735534),a=n(965438);t.CHECK_NAN_SNIPPET="\n if (isnan(a)) return a;\n if (isnan(b)) return b;\n",t.SQUARED_DIFFERENCE="return (a - b) * (a - b);";t.BinaryOpProgram=class{constructor(e,t,n){this.variableNames=["A","B"],this.outputShape=r.backend_util.assertAndGetBroadcastShape(t,n),this.enableShapeUniforms=(0,a.useShapeUniforms)(this.outputShape.length),this.userCode="\n float binaryOperation(float a, float b) {\n ".concat(e,"\n }\n\n void main() {\n float a = getAAtOutCoords();\n float b = getBAtOutCoords();\n setOutput(binaryOperation(a, b));\n }\n ")}}}
1,215872:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.NOT_EQUAL=t.ELU_DER=t.CHECK_NAN_SNIPPET=t.BinaryOpPackedProgram=void 0;var r=n(735534),a=n(965438),o=n(530675),s=n(41990);t.CHECK_NAN_SNIPPET="\n result.r = isNaN.r > 0. ? NAN : result.r;\n result.g = isNaN.g > 0. ? NAN : result.g;\n result.b = isNaN.b > 0. ? NAN : result.b;\n result.a = isNaN.a > 0. ? NAN : result.a;\n",t.ELU_DER="\n vec4 bGTEZero = vec4(greaterThanEqual(b, vec4(0.)));\n return (bGTEZero * a) + ((vec4(1.0) - bGTEZero) * (a * (b + vec4(1.0))));\n",t.NOT_EQUAL="\n return vec4(notEqual(a, b));\n";t.BinaryOpPackedProgram=class{constructor(e,t,n){let i=arguments.length>3&&void 0!==arguments[3]&&arguments[3];this.variableNames=["A","B"],this.supportsBroadcasting=!0,this.packedInputs=!0,this.packedOutput=!0,this.outputShape=r.backend_util.assertAndGetBroadcastShape(t,n);const c=this.outputShape.length;this.enableShapeUniforms=(0,a.useShapeUniforms)(c);let l="";if(i)if(0===c||1===r.util.sizeFromShape(this.outputShape))l="\n result.y = 0.;\n result.z = 0.;\n result.w = 0.;\n ";else{const e=(0,s.getCoordsDataType)(c);if(l="\n ".concat(e," coords = getOutputCoords();\n "),1===c)this.enableShapeUniforms?l+="\n result.y = (coords + 1) >= outShape ? 0. : result.y;\n result.z = 0.;\n result.w = 0.;\n ":l+="\n result.y = (coords + 1) >= ".concat(this.outputShape[0]," ? 0. : result.y;\n result.z = 0.;\n result.w = 0.;\n ");else{const e=(0,o.getChannels)("coords",c);this.enableShapeUniforms?l+="\n bool nextRowOutOfBounds =\n (".concat(e[c-2]," + 1) >= outShape[").concat(c," - 2];\n bool nextColOutOfBounds =\n (").concat(e[c-1]," + 1) >= outShape[").concat(c," - 1];\n result.y = nextColOutOfBounds ? 0. : result.y;\n result.z = nextRowOutOfBounds ? 0. : result.z;\n result.w = nextColOutOfBounds || nextRowOutOfBounds ? 0. : result.w;\n "):l+="\n bool nextRowOutOfBounds =\n (".concat(e[c-2]," + 1) >= ").concat(this.outputShape[c-2],";\n bool nextColOutOfBounds =\n (").concat(e[c-1]," + 1) >= ").concat(this.outputShape[c-1],";\n result.y = nextColOutOfBounds ? 0. : result.y;\n result.z = nextRowOutOfBounds ? 0. : result.z;\n result.w = nextColOutOfBounds || nextRowOutOfBounds ? 0. : result.w;\n ")}}this.userCode="\n vec4 binaryOperation(vec4 a, vec4 b) {\n ".concat(e,"\n }\n\n void main() {\n vec4 a = getAAtOutCoords();\n vec4 b = getBAtOutCoords();\n\n vec4 result = binaryOperation(a, b);\n ").concat(l,"\n\n setOutput(result);\n }\n ")}}},821551:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.clearWebGLContext=function(e){delete n[e]},t.getWebGLContext=function e(t,a){if(!(t in n)||null!=a){const e=function(e,t){if(1!==e&&2!==e)throw new Error("Cannot get WebGL rendering context, WebGL is disabled.");const a=null==t?function(e){if("undefined"!=typeof OffscreenCanvas&&2===e)return new OffscreenCanvas(300,150);if("undefined"!=typeof document)return document.createElement("canvas");throw new Error("Cannot create a canvas in this context")}(e):t;if(a.addEventListener("webglcontextlost",(t=>{t.preventDefault(),delete n[e]}),!1),1===e)return a.getContext("webgl",r)||a.getContext("experimental-webgl",r);return a.getContext("webgl2",r)}(t,a);if(null===e)return console.log("Could not get context for WebGL version",t),null;n[t]=e}const o=n[t];if(null==o||o.isContextLost())return delete n[t],e(t);return o.disable(o.DEPTH_TEST),o.disable(o.STENCIL_TEST),o.disable(o.BLEND),o.disable(o.DITHER),o.disable(o.POLYGON_OFFSET_FILL),o.disable(o.SAMPLE_COVERAGE),o.enable(o.SCISSOR_TEST),o.enable(o.CULL_FACE),o.cullFace(o.BACK),n[t]},t.setWebGLContext=function(e,t){n[e]=t};const n={},r={alpha:!1,antialias:!1,premultipliedAlpha:!1,preserveDrawingBuffer:!1,depth:!1,stencil:!1,failIfMajorPerformanceCaveat:!0}},945460:(e,t)=>{"use strict";
1Object.defineProperty(t,"__esModule",{value:!0}),t.ClipProgram=void 0;t.ClipProgram=class{constructor(e){this.variableNames=["A"],this.customUniforms=[{name:"minVal",type:"float"},{name:"maxVal",type:"float"}],this.outputShape=e,this.userCode="\n\n void main() {\n float value = getAAtOutCoords();\n if (isnan(value)) {\n setOutput(value);\n return;\n }\n\n setOutput(clamp(value, minVal, maxVal));\n }\n "}}},381411:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ClipPackedProgram=void 0;t.ClipPackedProgram=class{constructor(e){this.variableNames=["A"],this.packedInputs=!0,this.packedOutput=!0,this.customUniforms=[{name:"minVal",type:"float"},{name:"maxVal",type:"float"}],this.outputShape=e,this.userCode="\n void main() {\n vec4 value = getAAtOutCoords();\n\n if (any(isnan(value))) {\n setOutput(value);\n return;\n }\n\n setOutput(clamp(value, vec4(minVal), vec4(maxVal)));\n }\n "}}},925793:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ComplexAbsProgram=void 0;t.ComplexAbsProgram=class{constructor(e){this.variableNames=["real","imag"],this.outputShape=e,this.userCode="\n void main() {\n float re = abs(getRealAtOutCoords());\n float im = abs(getImagAtOutCoords());\n float mx = max(re, im);\n\n // sadly the length function in glsl is not underflow-safe\n // (at least not on Intel GPUs). So the safe solution is\n // to ensure underflow-safety in all cases.\n setOutput(\n mx == 0.0 ? 0.0 : mx * length(vec2(1, min(re, im)/mx))\n );\n }\n "}}},805371:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ConcatProgram=void 0;var r=n(735534);t.ConcatProgram=class{constructor(e){this.outputShape=[],this.outputShape=r.backend_util.computeOutShape(e,1),this.variableNames=e.map(((e,t)=>"T".concat(t)));const t=new Array(e.length-1);t[0]=e[0][1];for(let n=1;n<t.length;n++)t[n]=t[n-1]+e[n][1];const n=["if (yC < ".concat(t[0],") setOutput(getT0(yR, yC));")];for(let e=1;e<t.length;e++){const r=t[e-1];n.push("else if (yC < ".concat(t[e],") ")+"setOutput(getT".concat(e,"(yR, yC-").concat(r,"));"))}const a=t.length,o=t[t.length-1];n.push("else setOutput(getT".concat(a,"(yR, yC-").concat(o,"));")),this.userCode="\n void main() {\n ivec2 coords = getOutputCoords();\n int yR = coords.x;\n int yC = coords.y;\n\n ".concat(n.join("\n "),"\n }\n ")}}},455654:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ConcatPackedProgram=void 0;var r=n(735534),a=n(530675),o=n(41990);function s(e,t,n){const r=e.indexOf(t);return e.map(((e,t)=>t===r?"".concat(e," - ").concat(n):e)).join()}t.ConcatPackedProgram=class{constructor(e,t){this.packedInputs=!0,this.packedOutput=!0,this.outputShape=[],this.outputShape=r.backend_util.computeOutShape(e,t);const n=this.outputShape,i=n.length,c=(0,o.getCoordsDataType)(i),l=(0,a.getChannels)("coords",i),u=["x","y","z","w","u","v"].slice(0,i);this.variableNames=e.map(((e,t)=>"T".concat(t)));const d=new Array(e.length-1);d[0]=e[0][t];for(let n=1;n<d.length;n++)d[n]=d[n-1]+e[n][t];const p=u[t],h=u.slice(-2),f=u.join();let m="if (".concat(p," < ").concat(d[0],") {\n return getChannel(\n getT0(").concat(f,"), vec2(").concat(h.join(),"));\n }");for(let e=1;e<d.length;e++){const t=d[e-1];m+="\n if (".concat(p," < ").concat(d[e]," && ").concat(p," >= ").concat(d[e-1],") {\n return getChannel(\n getT").concat(e,"(").concat(s(u,p,t),"),\n vec2(").concat(s(h,p,t),"));\n }")}const g=d.length,y=d[d.length-1];m+="\n return getChannel(\n getT".concat(g,"(").concat(s(u,p,y),"),\n vec2(").concat(s(h,p,y),"));"),this.userCode="\n float getValue(".concat(u.map((e=>"int "+e)),") {\n ").concat(m,"\n }\n\n void main() {\n ").concat(c," coords = getOutputCoords();\n vec4 result = vec4(getValue(").concat(l,"), 0., 0., 0.);\n\n ").concat(l[i-1]," = ").concat(l[i-1]," + 1;\n if (").concat(l[i-1]," < ").concat(n[i-1],") {\n result.g = getValue(").concat(l,");\n }\n\n ").concat(l[i-2]," = ").concat(l[i-2]," + 1;\n if (").concat(l[i-2]," < ").concat(n[i-2],") {\n result.a = getValue(").concat(l,");\n }\n\n ").concat(l[i-1]," = ").concat(l[i-1]," - 1;\n if (").concat(l[i-2]," < ").concat(n[i-2]," &&\n ").concat(l[i-1]," < ").concat(n[i-1],") {\n result.b = getValue(").concat(l,");\n }\n setOutput(result);\n }\n ")}}},811800:(e,t)=>{"use strict";
1Object.defineProperty(t,"__esModule",{value:!0}),t.Conv3DDerInputProgram=t.Conv3DDerFilterProgram=t.Conv2DDerInputProgram=t.Conv2DDerFilterProgram=void 0;t.Conv2DDerFilterProgram=class{constructor(e){this.variableNames=["x","dy"],this.outputShape=e.filterShape;const t=e.strideHeight,n=e.strideWidth,r=e.padInfo.top,a=e.padInfo.left,o="channelsLast"===e.dataFormat;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 < ".concat(e.batchSize,"; b++) {\n for (int yR = 0; yR < ").concat(e.outHeight,"; yR++) {\n int xR = wR + yR * ").concat(t," - ").concat(r,";\n\n if (xR < 0 || xR >= ").concat(e.inHeight,") {\n continue;\n }\n\n for (int yC = 0; yC < ").concat(e.outWidth,"; yC++) {\n int xC = wC + yC * ").concat(n," - ").concat(a,";\n\n if (xC < 0 || xC >= ").concat(e.inWidth,") {\n continue;\n }\n\n if (").concat(o,") {\n float dyValue = getDy(b, yR, yC, d2);\n float xValue = getX(b, xR, xC, d1);\n dotProd += (xValue * dyValue);\n } else {\n float dyValue = getDy(b, d2, yR, yC);\n float xValue = getX(b, d1, xR, xC);\n dotProd += (xValue * dyValue);\n }\n\n }\n }\n }\n setOutput(dotProd);\n }\n ")}};t.Conv2DDerInputProgram=class{constructor(e){this.variableNames=["dy","W"],this.outputShape=e.inShape;const t=e.filterHeight,n=e.filterWidth,r=e.strideHeight,a=e.strideWidth,o="channelsLast"===e.dataFormat,s=t-1-e.padInfo.top,i=n-1-e.padInfo.left,c=o?1:2,l=o?2:3,u=o?3:1;this.userCode="\n const ivec2 pads = ivec2(".concat(s,", ").concat(i,");\n\n void main() {\n ivec4 coords = getOutputCoords();\n int batch = coords[0];\n int d1 = coords[").concat(u,"];\n\n ivec2 dyCorner = ivec2(coords[").concat(c,"], coords[").concat(l,"]) - 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 < ").concat(t,"; wR++) {\n float dyR = float(dyRCorner + wR) / ").concat(r,".0;\n\n if (dyR < 0.0 || dyR >= ").concat(e.outHeight,".0 || fract(dyR) > 0.0) {\n continue;\n }\n int idyR = int(dyR);\n\n int wRPerm = ").concat(t," - 1 - wR;\n\n for (int wC = 0; wC < ").concat(n,"; wC++) {\n float dyC = float(dyCCorner + wC) / ").concat(a,".0;\n\n if (dyC < 0.0 || dyC >= ").concat(e.outWidth,".0 ||\n fract(dyC) > 0.0) {\n continue;\n }\n int idyC = int(dyC);\n\n int wCPerm = ").concat(n," - 1 - wC;\n\n for (int d2 = 0; d2 < ").concat(e.outChannels,"; d2++) {\n\n if (").concat(o,") {\n float xValue = getDy(batch, idyR, idyC, d2);\n float wValue = getW(wRPerm, wCPerm, d1, d2);\n dotProd += xValue * wValue;\n } else {\n float xValue = getDy(batch, d2, idyR, idyC);\n float wValue = getW(wRPerm, wCPerm, d1, d2);\n dotProd += xValue * wValue;\n }\n\n }\n }\n }\n setOutput(dotProd);\n }\n ")}};t.Conv3DDerFilterProgram=class{constructor(e){this.variableNames=["x","dy"],this.outputShape=e.filterShape;const t=e.strideDepth,n=e.strideHeight,r=e.strideWidth,a=e.padInfo.front,o=e.padInfo.top,s=e.padInfo.left;this.userCode="\n void main() {\n ivec5 coords = getOutputCoords();\n int wF = coords.x;\n int wR = coords.y;\n int wC = coords.z;\n int d1 = coords.w;\n int d2 = coords.u;\n\n float dotProd = 0.0;\n\n for (int b = 0; b < ".concat(e.batchSize,"; b++) {\n for (int yF = 0; yF < ").concat(e.outDepth,";
1 yF++) {\n int xF = wF + yF * ").concat(t," - ").concat(a,";\n\n if (xF < 0 || xF >= ").concat(e.inDepth,") {\n continue;\n }\n\n for (int yR = 0; yR < ").concat(e.outHeight,"; yR++) {\n int xR = wR + yR * ").concat(n," - ").concat(o,";\n\n if (xR < 0 || xR >= ").concat(e.inHeight,") {\n continue;\n }\n\n for (int yC = 0; yC < ").concat(e.outWidth,"; yC++) {\n int xC = wC + yC * ").concat(r," - ").concat(s,";\n\n if (xC < 0 || xC >= ").concat(e.inWidth,") {\n continue;\n }\n\n float dyValue = getDy(b, yF, yR, yC, d2);\n float xValue = getX(b, xF, xR, xC, d1);\n dotProd += (xValue * dyValue);\n }\n }\n }\n }\n setOutput(dotProd);\n }\n ")}};t.Conv3DDerInputProgram=class{constructor(e){this.variableNames=["dy","W"],this.outputShape=e.inShape;const t=e.filterDepth,n=e.filterHeight,r=e.filterWidth,a=e.strideDepth,o=e.strideHeight,s=e.strideWidth,i=t-1-e.padInfo.front,c=n-1-e.padInfo.top,l=r-1-e.padInfo.left;this.userCode="\n const ivec3 pads = ivec3(".concat(i,", ").concat(c,", ").concat(l,");\n\n void main() {\n ivec5 coords = getOutputCoords();\n int batch = coords.x;\n int d1 = coords.u;\n\n\n ivec3 dyCorner = ivec3(coords.y, coords.z, coords.w) - pads;\n int dyFCorner = dyCorner.x;\n int dyRCorner = dyCorner.y;\n int dyCCorner = dyCorner.z;\n\n float dotProd = 0.0;\n for (int wF = 0; wF < ").concat(t,"; wF++) {\n float dyF = float(dyFCorner + wF) / ").concat(a,".0;\n\n if (dyF < 0.0 || dyF >= ").concat(e.outDepth,".0 || fract(dyF) > 0.0) {\n continue;\n }\n int idyF = int(dyF);\n\n int wFPerm = ").concat(t," - 1 - wF;\n\n for (int wR = 0; wR < ").concat(n,"; wR++) {\n float dyR = float(dyRCorner + wR) / ").concat(o,".0;\n\n if (dyR < 0.0 || dyR >= ").concat(e.outHeight,".0 ||\n fract(dyR) > 0.0) {\n continue;\n }\n int idyR = int(dyR);\n\n int wRPerm = ").concat(n," - 1 - wR;\n\n for (int wC = 0; wC < ").concat(r,"; wC++) {\n float dyC = float(dyCCorner + wC) / ").concat(s,".0;\n\n if (dyC < 0.0 || dyC >= ").concat(e.outWidth,".0 ||\n fract(dyC) > 0.0) {\n continue;\n }\n int idyC = int(dyC);\n\n int wCPerm = ").concat(r," - 1 - wC;\n\n for (int d2 = 0; d2 < ").concat(e.outChannels,"; d2++) {\n float xValue = getDy(batch, idyF, idyR, idyC, d2);\n float wValue = getW(wFPerm, wRPerm, wCPerm, d1, d2);\n dotProd += xValue * wValue;\n }\n }\n }\n }\n setOutput(dotProd);\n }\n ")}}},804605:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.DepthwiseConv2DDerInputProgram=t.DepthwiseConv2DDerFilterProgram=void 0;t.DepthwiseConv2DDerFilterProgram=class{constructor(e){this.variableNames=["x","dy"],this.outputShape=e.filterShape;const t=e.strideHeight,n=e.strideWidth,r=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 * ".concat(o," + dm;\n\n float dotProd = 0.0;\n\n // TO DO: Vec4 over the batch size\n for (int b = 0; b < ").concat(e.batchSize,"; b++) {\n for (int yR = 0; yR < ").concat(e.outHeight,"; yR++) {\n int xR = wR + yR * ").concat(t," - ").concat(r,";\n\n if (xR < 0 || xR >= ").concat(e.inHeight,") {\n continue;\n }\n\n for (int yC = 0; yC < ").concat(e.outWidth,"; yC++) {\n int xC = wC + yC * ").concat(n," - ").concat(a,";\n\n if (xC < 0 || xC >= ").concat(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 ")}};t.DepthwiseConv2DDerInputProgram=class{constructor(e){this.variableNames=["dy","W"],this.outputShape=e.inShape;const t=e.filterHeight,n=e.filterWidth,r=e.strideHeight,a=e.strideWidth,o=t-1-e.padInfo.top,s=n-1-e.padInfo.left,i=e.outChannels/e.inChannels;this.userCode="\n const ivec2 pads = ivec2(".concat(o,", ").concat(s,");\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 < ").concat(t,"; wR++) {\n float dyR = float(dyRCorner + wR) / ").concat(r,".0;\n\n if (dyR < 0.0 || dyR >= ").concat(e.outHeight,".0 || fract(dyR) > 0.0) {\n continue;\n }\n int idyR = int(dyR);\n\n int wRPerm = ").concat(t," - 1 - wR;\n\n for (int wC = 0; wC < ").concat(n,"; wC++) {\n float dyC = float(dyCCorner + wC) / ").concat(a,".0;\n\n if (dyC < 0.0 || dyC >= ").concat(e.outWidth,".0 ||\n fract(dyC) > 0.0) {\n continue;\n }\n int idyC = int(dyC);\n\n int wCPerm = ").concat(n," - 1 - wC;\n\n // TO DO: Vec4 over the channelMul\n for (int dm = 0; dm < ").concat(i,"; dm++) {\n int d2 = d1 * ").concat(i," + 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 ")}}},811213:(e,t)=>{"use strict";
1Object.defineProperty(t,"__esModule",{value:!0}),t.Conv3DProgram=t.Conv2DProgram=void 0;t.Conv2DProgram=class{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,r=arguments.length>3&&void 0!==arguments[3]&&arguments[3],a=arguments.length>4&&void 0!==arguments[4]&&arguments[4];this.variableNames=["x","W"],this.outputShape=e.outShape;const o=e.padInfo.top,s=e.padInfo.left,i=e.strideHeight,c=e.strideWidth,l=e.dilationHeight,u=e.dilationWidth,d=e.filterHeight,p=e.filterWidth,h=4*Math.floor(e.inChannels/4),f=e.inChannels%4,m="channelsLast"===e.dataFormat,g=m?1:2,y=m?2:3,v=m?3:1;let b="",x="";n&&(b=r?"float activation(float a) {\n float b = getPreluActivationWeightsAtOutCoords();\n ".concat(n,"\n }"):a?"float activation(float a) {\n float b = getLeakyreluAlphaAtOutCoords();\n ".concat(n,"\n }"):"\n float activation(float x) {\n ".concat(n,"\n }\n "),x="result = activation(result);");const w=t?"result += getBiasAtOutCoords();":"";t&&this.variableNames.push("bias"),r&&this.variableNames.push("preluActivationWeights"),a&&this.variableNames.push("leakyreluAlpha"),this.userCode="\n ".concat(b,"\n\n const ivec2 strides = ivec2(").concat(i,", ").concat(c,");\n const ivec2 pads = ivec2(").concat(o,", ").concat(s,");\n\n void main() {\n ivec4 coords = getOutputCoords();\n int batch = coords[0];\n int d2 = coords[").concat(v,"];\n\n ivec2 xRCCorner =\n ivec2(coords[").concat(g,"], coords[").concat(y,"]) * 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 < ").concat(d,"; wR++) {\n int xR = xRCorner + wR * ").concat(l,";\n\n if (xR < 0 || xR >= ").concat(e.inHeight,") {\n continue;\n }\n\n for (int wC = 0; wC < ").concat(p,"; wC++) {\n int xC = xCCorner + wC * ").concat(u,";\n\n if (xC < 0 || xC >= ").concat(e.inWidth,") {\n continue;\n }\n\n for (int d1 = 0; d1 < ").concat(h,"; d1 += 4) {\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 if (").concat(m,") {\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 dotProd += dot(xValues, wValues);\n } else {\n vec4 xValues = vec4(\n getX(batch, d1, xR, xC),\n getX(batch, d1 + 1, xR, xC),\n getX(batch, d1 + 2, xR, xC),\n getX(batch, d1 + 3, xR, xC)\n );\n dotProd += dot(xValues, wValues);\n }\n }\n\n if (").concat(1===f,") {\n\n if (").concat(m,") {\n dotProd +=\n getX(batch, xR, xC, ").concat(h,") *\n getW(wR, wC, ").concat(h,", d2);\n } else {\n dotProd +=\n getX(batch, ").concat(h,", xR, xC) *\n getW(wR, wC, ").concat(h,", d2);\n }\n\n } else if (").concat(2===f,") {\n vec2 wValues = vec2(\n getW(wR, wC, ").concat(h,", d2),\n getW(wR, wC, ").concat(h," + 1, d2)\n );\n\n if (").concat(m,") {\n vec2 xValues = vec2(\n getX(batch, xR, xC, ").concat(h,"),\n getX(batch, xR, xC, ").concat(h," + 1)\n );\n dotProd += dot(xValues, wValues);\n } else {\n vec2 xValues = vec2(\n getX(batch, ").concat(h,", xR, xC),\n getX(batch, ").concat(h," + 1, xR, xC)\n );\n dotProd += dot(xValues, wValues);\n }\n\n } else if (").concat(3===f,") {\n vec3 wValues = vec3(\n getW(wR, wC, ").concat(h,", d2),\n getW(wR, wC, ").concat(h," + 1, d2),\n getW(wR, wC, ").concat(h," + 2, d2)\n );\n\n if (").concat(m,") {\n vec3 xValues = vec3(\n getX(batch, xR, xC, ").
1concat(h,"),\n getX(batch, xR, xC, ").concat(h," + 1),\n getX(batch, xR, xC, ").concat(h," + 2)\n );\n dotProd += dot(xValues, wValues);\n } else {\n vec3 xValues = vec3(\n getX(batch, ").concat(h,", xR, xC),\n getX(batch, ").concat(h," + 1, xR, xC),\n getX(batch, ").concat(h," + 2, xR, xC)\n );\n dotProd += dot(xValues, wValues);\n }\n\n }\n }\n }\n\n float result = dotProd;\n ").concat(w,"\n ").concat(x,"\n setOutput(result);\n }\n ")}};t.Conv3DProgram=class{constructor(e){this.variableNames=["x","W"],this.outputShape=e.outShape;const t=e.padInfo.front,n=e.padInfo.top,r=e.padInfo.left,a=e.strideDepth,o=e.strideHeight,s=e.strideWidth,i=e.dilationDepth,c=e.dilationHeight,l=e.dilationWidth,u=e.filterDepth,d=e.filterHeight,p=e.filterWidth,h=4*Math.floor(e.inChannels/4),f=e.inChannels%4;this.userCode="\n const ivec3 strides = ivec3(".concat(a,", ").concat(o,", ").concat(s,");\n const ivec3 pads = ivec3(").concat(t,", ").concat(n,", ").concat(r,");\n\n void main() {\n ivec5 coords = getOutputCoords();\n int batch = coords.x;\n int d2 = coords.u;\n\n ivec3 xFRCCorner = ivec3(coords.y, coords.z, coords.w) * strides - pads;\n int xFCorner = xFRCCorner.x;\n int xRCorner = xFRCCorner.y;\n int xCCorner = xFRCCorner.z;\n\n // Convolve x(?, ?, ?, d1) with w(:, :, :, d1, d2) to get\n // y(yF, yR, yC, d2). ? = to be determined. : = across all\n // values in that axis.\n float dotProd = 0.0;\n for (int wF = 0; wF < ").concat(u,"; wF++) {\n int xF = xFCorner + wF * ").concat(i,";\n\n if (xF < 0 || xF >= ").concat(e.inDepth,") {\n continue;\n }\n\n for (int wR = 0; wR < ").concat(d,"; wR++) {\n int xR = xRCorner + wR * ").concat(c,";\n\n if (xR < 0 || xR >= ").concat(e.inHeight,") {\n continue;\n }\n\n for (int wC = 0; wC < ").concat(p,"; wC++) {\n int xC = xCCorner + wC * ").concat(l,";\n\n if (xC < 0 || xC >= ").concat(e.inWidth,") {\n continue;\n }\n\n for (int d1 = 0; d1 < ").concat(h,"; d1 += 4) {\n vec4 xValues = vec4(\n getX(batch, xF, xR, xC, d1),\n getX(batch, xF, xR, xC, d1 + 1),\n getX(batch, xF, xR, xC, d1 + 2),\n getX(batch, xF, xR, xC, d1 + 3)\n );\n vec4 wValues = vec4(\n getW(wF, wR, wC, d1, d2),\n getW(wF, wR, wC, d1 + 1, d2),\n getW(wF, wR, wC, d1 + 2, d2),\n getW(wF, wR, wC, d1 + 3, d2)\n );\n\n dotProd += dot(xValues, wValues);\n }\n\n if (").concat(1===f,") {\n dotProd +=\n getX(batch, xF, xR, xC, ").concat(h,") *\n getW(wF, wR, wC, ").concat(h,", d2);\n } else if (").concat(2===f,") {\n vec2 xValues = vec2(\n getX(batch, xF, xR, xC, ").concat(h,"),\n getX(batch, xF, xR, xC, ").concat(h," + 1)\n );\n vec2 wValues = vec2(\n getW(wF, wR, wC, ").concat(h,", d2),\n getW(wF, wR, wC, ").concat(h," + 1, d2)\n );\n dotProd += dot(xValues, wValues);\n } else if (").concat(3===f,") {\n vec3 xValues = vec3(\n getX(batch, xF, xR, xC, ").concat(h,"),\n getX(batch, xF, xR, xC, ").concat(h," + 1),\n getX(batch, xF, xR, xC, ").concat(h," + 2)\n );\n vec3 wValues = vec3(\n getW(wF, wR, wC, ").concat(h,", d2),\n getW(wF, wR, wC, ").concat(h," + 1, d2),\n getW(wF, wR, wC, ").concat(h," + 2, d2)\n );\n dotProd += dot(xValues, wValues);\n }\n }\n }\n }\n setOutput(dotProd);\n }\n ")}}},73168:(e,t,n)=>{"use strict";
1Object.defineProperty(t,"__esModule",{value:!0}),t.DepthwiseConv2DProgram=void 0;var r=n(965438);t.DepthwiseConv2DProgram=class{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,a=arguments.length>3&&void 0!==arguments[3]&&arguments[3],o=arguments.length>4&&void 0!==arguments[4]&&arguments[4];this.variableNames=["x","W"],this.customUniforms=[{name:"pads",type:"ivec2"},{name:"strides",type:"ivec2"},{name:"dilations",type:"ivec2"},{name:"inDims",type:"ivec2"}],this.outputShape=e.outShape,this.enableShapeUniforms=(0,r.useShapeUniforms)(this.outputShape.length);const s=e.filterHeight,i=e.filterWidth,c=e.outChannels/e.inChannels;let l="",u="";n&&(l=a?"float activation(float a) {\n float b = getPreluActivationWeightsAtOutCoords();\n ".concat(n,"\n }"):o?"float activation(float a) {\n float b = getLeakyreluAlphaAtOutCoords();\n ".concat(n,"\n }"):"\n float activation(float x) {\n ".concat(n,"\n }\n "),u="result = activation(result);");const d=t?"result += getBiasAtOutCoords();":"";t&&this.variableNames.push("bias"),a&&this.variableNames.push("preluActivationWeights"),o&&this.variableNames.push("leakyreluAlpha"),this.userCode="\n ".concat(l,"\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 / ").concat(c,";\n int q = d2 - d1 * ").concat(c,";\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 // TO DO(dsmilkov): Flatten the two for loops and vec4 the operations.\n for (int wR = 0; wR < ").concat(s,"; wR++) {\n int xR = xRCorner + wR * dilations[0];\n\n if (xR < 0 || xR >= inDims[0]) {\n continue;\n }\n\n for (int wC = 0; wC < ").concat(i,"; wC++) {\n int xC = xCCorner + wC * dilations[1];\n\n if (xC < 0 || xC >= inDims[1]) {\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\n float result = dotProd;\n ").concat(d,"\n ").concat(u,"\n setOutput(result);\n }\n ")}}},318263:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.DepthwiseConvPacked2DProgram=void 0;var r=n(735534),a=n(965438);t.DepthwiseConvPacked2DProgram=class{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,o=arguments.length>3&&void 0!==arguments[3]&&arguments[3],s=arguments.length>4&&void 0!==arguments[4]&&arguments[4];this.variableNames=["x","W"],this.packedInputs=!0,this.packedOutput=!0,this.customUniforms=[{name:"pads",type:"ivec2"},{name:"strides",type:"ivec2"},{name:"dilations",type:"ivec2"},{name:"inDims",type:"ivec2"}],this.outputShape=e.outShape,this.enableShapeUniforms=(0,a.useShapeUniforms)(this.outputShape.length);const i=e.outChannels/e.inChannels,c=e.padInfo.left,l=e.strideWidth,u=e.dilationWidth,d=e.filterHeight,p=e.filterWidth,h=p;let f="\n int xR; int xC; int xCOffset;\n vec4 wTexel; vec4 previous; vec4 final;";for(let e=0;e<p;e++)f+="\n vec4 xTexelC".concat(2*e,";\n int xTexelC").concat(2*e,"Ready;\n vec4 xTexelC").concat(2*e+1,";\n int xTexelC").concat(2*e+1,"Ready;\n vec4 xC").concat(e,";");f+="\n for (int r = 0; r < ".concat(d,"; r++) {\n ");for(let e=0;e<p;e++)f+="\n xTexelC".concat(2*e," = vec4(0.0);\n xTexelC").concat(2*e,"Ready = 0;\n xTexelC").concat(2*e+1," = vec4(0.0);\n xTexelC").concat(2*e+1,"Ready = 0;\n xC").concat(e," = vec4(0.0);");f+="\n xR = xRCorner + r * dilations[0];\n if (xR >=0 && xR < inDims[0]) {\n ";for(let e=0;e<(h+1)/2;e++){const t=2*e;if(f+="\n xC = xCCorner + ".concat(t*u,";\n "),1===l){if(t<p&&(c%2==1?(f+="\n xCOffset = xC + 1;\n if (xCOffset >= 0 && xCOffset < inDims[1] && xTexelC".concat(t,"Ready == 0) {\n xTexelC").concat(t," = getX(batch, xR, xCOffset, d1);\n\n // Need to manually clear unused channels in case\n // we're reading from recycled texture.\n if (xCOffset + 1 >= inDims[1]) {\n xTexelC").concat(t,".zw = vec2(0.0);\n }\n xTexelC").concat(t,"Ready = 1;\n }\n "),f+=1===u&&t>0?"\n xC".concat(t," = vec4(xTexelC").concat(t-2,".zw, xTexelC").concat(t,".xy);\n "):"\n xCOffset = xC + 1 - 2;\n\n if (xCOffset >= 0 && xCOffset < inDims[1]) {\n previous = getX(batch, xR, xCOffset, d1);\n\n // Need to manually clear unused channels in case\n // we're reading from recycled texture.\n if (xCOffset + 1 >= inDims[1]) {\n previous.zw = vec2(0.0);\n }\n\n xC".concat(t," = vec4(previous.zw, xTexelC").concat(t,".xy);\n } else {\n xC").concat(t," = vec4(0.0, 0.0, xTexelC").concat(t,".xy);\n }\n ")):f+="\n if (xC >= 0 && xC < inDims[1] && xTexelC".concat(t,"Ready == 0) {\n xTexelC").concat(t," = getX(batch, xR, xC, d1);\n if (xC + 1 >= inDims[1]) {\n xTexelC").concat(t,".zw = vec2(0.0);\n }\n xTexelC").concat(t,"Ready = 1;\n }\n\n xC").concat(t," = xTexelC").concat(t,";\n "),t+1<p)){const e=c%2==0?r.util.nearestLargerEven(u):u;u%2==0&&c%2==1||u%2!=0&&c%2!=1?(f+="\n xCOffset = xC + imod(pads[1], 2) + ".concat(e,";\n\n if (xCOffset >= 0 && xCOffset < inDims[1] && xTexelC").concat(t+1,"Ready == 0) {\n xTexelC").concat(t+1," = getX(batch, xR, xCOffset, d1);\n\n // Need to manually clear unused channels in case\n // we're reading from recycled texture.\n if (xCOffset + 1 >= inDims[1]) {\n xTexelC").concat(t+1,".zw = vec2(0.0);\n }\n xTexelC").concat(t+1,"Ready = 1;\n }\n "),u>1&&(f+="\n xCOffset -= 2;\n if (xCOffset >= 0 && xCOffset < inDims[1] && xTexelC".concat(t,"Ready == 0) {\n xTexelC").concat(t," = getX(batch, xR, xCOffset, d1);\n xTexelC").concat(t,"Ready = 1;\n }\n ")),f+="\n xC".concat(t+1," = vec4(xTexelC").concat(t,".zw, xTexelC").concat(t+1,".xy);\n ")):f+=1===e?"\n xC".concat(t+1," = xTexelC").concat(t,";\n "):"\n xCOffset = xC + ".concat(e,";\n\n if (xCOffset >= 0 && xCOffset < inDims[1] && xTexelC").concat(t+1,"Ready == 0) {\n xTexelC").concat(t+1," = getX(batch, xR, xCOffset, d1);\n if (xCOffset + 1 >= inDims[1]) {\n xTexelC").concat(t+1,".zw = vec2(0.0);\n }\n xTexelC").concat(t+1,"Ready = 1;\n }\n\n xC").concat(t+1," = xTexelC").concat(t+1,";\n ")}}else t<p&&(c%2==1?(f+="\n xCOffset = xC + 1 - strides[1];\n if(xCOffset >= 0 && xCOffset < inDims[1] && xTexelC".concat(t,"Ready == 0) {\n xTexelC").concat(t," = getX(batch, xR, xCOffset, d1);\n // Need to manually clear unused channels in case\n // we're reading from recycled texture.\n if (xCOffset + 1 >= inDims[1]) {\n xTexelC").concat(t,".zw = vec2(0.0);\n }\n xTexelC").concat(t,"Ready = 1;\n }\n\n if(xC + 1 >= 0 && xC + 1 < inDims[1] && xTexelC").concat(t+1,"Ready == 0) {\n xTexelC").concat(t+1," = getX(batch, xR, xC + 1, d1);\n // Need to manually clear unused channels in case\n // we're reading from recycled texture.\n if (xC + 2 >= inDims[1]) {\n xTexelC").concat(t+1,".zw = vec2(0.0);\n }\n xTexelC").concat(t+1,"Ready = 1;\n }\n\n xC").concat(t," = vec4(xTexelC").concat(t,".zw, xTexelC").concat(t+1,".zw);\n "),t+1<p&&(f+="\n final = vec4(0.0);\n xCOffset = xC + 1 + strides[1];\n if(xCOffset >= 0 && xCOffset < inDims[1]) {\n final = getX(batch, xR, xCOffset, d1);\n }\n xC".concat(t+1," = vec4(xTexelC").concat(t+1,".xy, final.xy);\n "))):(f+="\n if(xC >= 0 && xC < inDims[1] && xTexelC".concat(t,"Ready == 0) {\n xTexelC").concat(t," = getX(batch, xR, xC, d1);\n if (xC + 1 >= inDims[1]) {\n xTexelC").concat(t,".zw = vec2(0.0);\n }\n xTexelC").concat(t,"Ready = 1;\n }\n\n xCOffset = xC + strides[1];\n if(xCOffset >= 0 && xCOffset < inDims[1] && xTexelC").concat(t+1,"Ready == 0) {\n xTexelC").concat(t+1," = getX(batch, xR, xCOffset, d1);\n if (xCOffset + 1 >= inDims[1]) {\n xTexelC").concat(t+1,".zw = vec2(0.);\n }\n xTexelC").concat(t+1,"Ready = 1;\n }\n\n xC").concat(t," = vec4(\n xTexelC").concat(t,".xy, xTexelC").concat(t+1,".xy);\n "),t+1<p&&(f+="\n xC".concat(t+1," = vec4(xTexelC").concat(t,".zw, xTexelC").concat(t+1,".zw);\n "))));t<p&&(f+="\n wTexel = getW(r, ".concat(t,", d1, q);\n dotProd += xC").concat(t," * vec4(wTexel.xz, wTexel.xz);\n "),t+1<p&&(f+="\n wTexel = getW(r, ".concat(t+1,", d1, q);\n dotProd += xC").concat(t+1," * vec4(wTexel.xz, wTexel.xz);\n ")))}f+="\n }\n ",f+="\n }\n ";let m="",g="";n&&(m=o?"vec4 activation(vec4 a) {\n vec4 b = getPreluActivationWeightsAtOutCoords();\n ".concat(n,"\n }"):s?"vec4 activation(vec4 a) {\n vec4 b = getLeakyreluAlphaAtOutCoords();\n ".concat(n,"\n }
1"):"vec4 activation(vec4 x) {\n ".concat(n,"\n }"),g="result = activation(result);");const y=t?"result += getBiasAtOutCoords();":"";t&&this.variableNames.push("bias"),o&&this.variableNames.push("preluActivationWeights"),s&&this.variableNames.push("leakyreluAlpha"),this.userCode="\n ".concat(m,"\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 / ").concat(i,";\n int q = d2 - d1 * ").concat(i,";\n int xRCorner = xRCCorner.x;\n int xCCorner = xRCCorner.y;\n\n //intialize dotProd with a small epsilon seems to reduce GPU accuracy loss.\n vec4 dotProd = vec4(0.000000000000001);\n\n ").concat(f,"\n\n vec4 result = dotProd - vec4(0.000000000000001);\n ").concat(y,"\n ").concat(g,"\n setOutput(result);\n }\n ")}}},19300:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.CropAndResizeProgram=void 0;t.CropAndResizeProgram=class{constructor(e,t,n,r,a){this.variableNames=["Image","Boxes","BoxInd"],this.outputShape=[];const[o,s,i,c]=e,[l]=t,[u,d]=n;this.outputShape=[l,u,d,c];const p="bilinear"===r?1:0,[h,f]=["".concat(s-1,".0"),"".concat(i-1,".0")],[m,g,y]=u>1?["".concat((s-1)/(u-1)),"(y2-y1) * height_ratio","y1*".concat(h," + float(y)*(height_scale)")]:["0.0","0.0","0.5 * (y1+y2) * ".concat(h)],[v,b,x]=d>1?["".concat((i-1)/(d-1)),"(x2-x1) * width_ratio","x1*".concat(f," + float(x)*(width_scale)")]:["0.0","0.0","0.5 * (x1+x2) * ".concat(f)];this.userCode="\n const float height_ratio = float(".concat(m,");\n const float width_ratio = float(").concat(v,");\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 >= ").concat(o,") {\n return;\n }\n\n float height_scale = ").concat(g,";\n float width_scale = ").concat(b,";\n\n float in_y = ").concat(y,";\n if( in_y < 0.0 || in_y > ").concat(h," ) {\n setOutput(float(").concat(a,"));\n return;\n }\n float in_x = ").concat(x,";\n if( in_x < 0.0 || in_x > ").concat(f," ) {\n setOutput(float(").concat(a,"));\n return;\n }\n\n vec2 sourceFracIndexCR = vec2(in_x,in_y);\n if(").concat(p," == 1) {\n // Compute the four integer indices.\n ivec2 sourceFloorCR = ivec2(sourceFracIndexCR);\n ivec2 sourceCeilCR = ivec2(ceil(sourceFracIndexCR));\n\n float topLeft = getImage(b, sourceFloorCR.y, sourceFloorCR.x, d);\n float bottomLeft = getImage(b, sourceCeilCR.y, sourceFloorCR.x, d);\n float topRight = getImage(b, sourceFloorCR.y, sourceCeilCR.x, d);\n float bottomRight = getImage(b, sourceCeilCR.y, sourceCeilCR.x, d);\n\n vec2 fracCR = sourceFracIndexCR - vec2(sourceFloorCR);\n\n float top = topLeft + (topRight - topLeft) * fracCR.x;\n float bottom = bottomLeft + (bottomRight - bottomLeft) * fracCR.x;\n float newValue = top + (bottom - top) * fracCR.y;\n setOutput(newValue);\n } else {\n // Compute the coordinators of nearest neighbor point.\n ivec2 sourceNearestCR = ivec2(floor(\n sourceFracIndexCR + vec2(0.5,0.5)));\n float newValue = getImage(b, sourceNearestCR.y, sourceNearestCR.x, d);\n setOutput(newValue);\n }\n }\n ")}}},997330:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.CumSumProgram=void 0;var r=n(41990);function a(e,t){if(1===e)return"".concat(t);if(2===e)return"".concat(t,".x, ").concat(t,".y");if(3===e)return"".concat(t,".x, ").concat(t,".y, ").concat(t,".z");if(4===e)return"".concat(t,".x, ").concat(t,".y, ").concat(t,".z, ").concat(t,".w");throw Error("Cumulative sum for rank ".concat(e," is not yet supported"))}function o(e,t){if(1===e)return"".concat(t);if(2===e)return"".concat(t,".y");if(3===e)return"".concat(t,".z");if(4===e)return"".concat(t,".w");throw Error("Cumulative sum for rank ".concat(e," is not yet supported"))}t.CumSumProgram=class{constructor(e,t,n){this.variableNames=["x"],this.customUniforms=[{name:"index",type:"float"}],this.outputShape=e;const s=e.length,i=t?"0.0":"getX(".concat(a(s,"coords"),")"),c=e[e.length-1];let l="",u="";t?(l=n?"end != ".concat(c-1):"end != 0",u=n?"end + 1":"end - 1"):(l=n?"end + pow2 < ".concat(c):"end >= pow2",u=n?"end + pow2":"end - pow2"),this.userCode="\n void main() {\n ".concat((0,r.getCoordsDataType)(s)," coords = getOutputCoords();\n int end = ").concat(o(s,"coords"),";\n float val = ").concat(i,";\n int pow2 = int(pow(2.0, index));\n if (").concat(l,") {\n int idx = ").concat(u,";\n ").concat(o(s,"coords")," = idx;\n val += getX(").concat(a(s,"coords"),");\n }\n setOutput(val);\n }\n ")}}}
1,430729:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.DecodeMatrixProgram=void 0;var r=n(540236),a=n(965438),o=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=i(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if("default"!==o&&{}.hasOwnProperty.call(e,o)){var s=a?Object.getOwnPropertyDescriptor(e,o):null;s&&(s.get||s.set)?Object.defineProperty(r,o,s):r[o]=e[o]}return r.default=e,n&&n.set(e,r),r}(n(270327)),s=n(845772);function i(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(i=function(e){return e?n:t})(e)}t.DecodeMatrixProgram=class{constructor(e){this.variableNames=["A"],this.packedInputs=!1,this.packedOutput=!0,this.outPackingScheme=s.PackingScheme.DENSE,this.customUniforms=[{name:"texShape",type:"ivec2"}];const t=(0,r.getGlslDifferences)();this.outputShape=e,this.enableShapeUniforms=(0,a.useShapeUniforms)(this.outputShape.length),this.userCode="\n ivec3 outCoordsFromFlatIndex(int index) {\n ".concat(this.enableShapeUniforms?o.getOutputLogicalCoordinatesFromFlatIndexByUniform(["r","c","d"],e):o.getLogicalCoordinatesFromFlatIndex(["r","c","d"],e),"\n return ivec3(r, c, d);\n }\n\n void main() {\n ivec2 resTexRC = ivec2(resultUV.yx * vec2(texShape[0], texShape[1]));\n int index = 4 * (resTexRC.x * texShape[1] + resTexRC.y);\n\n vec4 result = vec4(0.);\n\n for (int i=0; i<4; i++) {\n int flatIndex = index + i;\n ivec3 rc = outCoordsFromFlatIndex(flatIndex);\n result[i] = getA(rc.x, rc.y, rc.z);\n }\n\n ").concat(t.output," = result;\n }\n ")}}},258587:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.DecodeMatrixPackedProgram=void 0;var r=n(540236),a=n(965438),o=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=i(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if("default"!==o&&{}.hasOwnProperty.call(e,o)){var s=a?Object.getOwnPropertyDescriptor(e,o):null;s&&(s.get||s.set)?Object.defineProperty(r,o,s):r[o]=e[o]}return r.default=e,n&&n.set(e,r),r}(n(270327)),s=n(845772);function i(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(i=function(e){return e?n:t})(e)}t.DecodeMatrixPackedProgram=class{constructor(e){this.variableNames=["A"],this.packedInputs=!0,this.packedOutput=!0,this.outPackingScheme=s.PackingScheme.DENSE,this.customUniforms=[{name:"texShape",type:"ivec2"}];const t=(0,r.getGlslDifferences)();this.outputShape=e,this.enableShapeUniforms=(0,a.useShapeUniforms)(this.outputShape.length),this.userCode="\n ivec3 outCoordsFromFlatIndex(int index) {\n ".concat(this.enableShapeUniforms?o.getOutputLogicalCoordinatesFromFlatIndexByUniform(["r","c","d"],e):o.getLogicalCoordinatesFromFlatIndex(["r","c","d"],e),"\n return ivec3(r, c, d);\n }\n\n void main() {\n ivec2 resTexRC = ivec2(resultUV.yx * vec2(texShape[0], texShape[1]));\n int index = 4 * (resTexRC.x * texShape[1] + resTexRC.y);\n\n vec4 result = vec4(0.);\n\n for (int i=0; i<4; i++) {\n int flatIndex = index + i;\n ivec3 rc = outCoordsFromFlatIndex(flatIndex);\n result[i] = getChannel(getA(rc.x, rc.y, rc.z), vec2(rc.y, rc.z));\n }\n\n ").concat(t.output," = result;\n }\n ")}}},659140:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.DepthToSpaceProgram=void 0;t.DepthToSpaceProgram=class{constructor(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 = ".concat(this.getHeightCoordString(),";\n int w = ").concat(this.getWidthCoordString(),";\n int d = ").concat(this.getDepthCoordString(),";\n\n int in_h = h / ").concat(t,";\n int offset_h = imod(h, ").concat(t,");\n int in_w = w / ").concat(t,";\n int offset_w = imod(w, ").concat(t,");\n int offset_d = (offset_h * ").concat(t," + offset_w) *\n ").concat(this.getOutputDepthSize(),";\n int in_d = d + offset_d;\n\n float result = ").concat(this.getInputSamplingString(),";\n setOutput(result);\n }\n ")}
1getHeightCoordString(){return"NHWC"===this.dataFormat?"coords[1]":"coords[2]"}getWidthCoordString(){return"NHWC"===this.dataFormat?"coords[2]":"coords[3]"}getDepthCoordString(){return"NHWC"===this.dataFormat?"coords[3]":"coords[1]"}getOutputDepthSize(){return"NHWC"===this.dataFormat?this.outputShape[3]:this.outputShape[1]}getInputSamplingString(){return"NHWC"===this.dataFormat?"getX(b, in_h, in_w, in_d)":"getX(b, in_d, in_h, in_w)"}}},903131:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.DiagProgram=void 0;t.DiagProgram=class{constructor(e){this.variableNames=["X"],this.outputShape=[e,e],this.userCode="\n void main() {\n ivec2 coords = getOutputCoords();\n float val = coords[0] == coords[1] ? getX(coords[0]) : 0.0;\n setOutput(val);\n }\n "}}},506644:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Dilation2DProgram=void 0;t.Dilation2DProgram=class{constructor(e){this.variableNames=["x","W"],this.outputShape=e.outShape;const{inHeight:t,inWidth:n,padInfo:r,strideHeight:a,strideWidth:o,filterHeight:s,filterWidth:i,dilationHeight:c,dilationWidth:l}=e,{top:u,left:d}=r;this.userCode="\n const ivec2 strides = ivec2(".concat(a,", ").concat(o,");\n const ivec2 pads = ivec2(").concat(u,", ").concat(d,");\n const float neg_infinity = -3.4e38;\n\n void main() {\n ivec4 coords = getOutputCoords();\n int batch = coords.x;\n int d1 = coords.w;\n ivec2 outTopLeftCorner =\n coords.yz * strides - pads;\n int hBeg = outTopLeftCorner.x;\n int wBeg = outTopLeftCorner.y;\n\n float curVal = neg_infinity;\n for (int h = 0; h < ").concat(s,"; h++) {\n int hIn = hBeg + h * ").concat(c,";\n\n if (hIn >= 0 && hIn < ").concat(t,") {\n for (int w = 0; w < ").concat(i,"; w++) {\n int wIn = wBeg + w * ").concat(l,";\n\n if (wIn >= 0 && wIn < ").concat(n,") {\n float xVal = getX(batch, hIn, wIn, d1);\n float wVal = getW(h, w, d1);\n\n float val = xVal + wVal;\n if (val > curVal) {\n curVal = val;\n }\n }\n }\n }\n }\n\n float result = curVal;\n setOutput(result);\n }\n ")}}},929414:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.EncodeFloatProgram=void 0;var r=n(540236),a=n(270327),o=n(845772);t.EncodeFloatProgram=class{constructor(e){this.variableNames=["A"],this.outTexUsage=o.TextureUsage.DOWNLOAD;const t=(0,r.getGlslDifferences)();this.outputShape=e,this.userCode="\n ".concat(a.ENCODE_FLOAT_SNIPPET,"\n\n void main() {\n float x = getAAtOutCoords();\n ").concat(t.output," = encode_float(x);\n }\n ")}}},567312:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.EncodeFloatPackedProgram=void 0;var r=n(540236),a=n(270327),o=n(845772);t.EncodeFloatPackedProgram=class{constructor(e){this.variableNames=["A"],this.packedInputs=!0,this.packedOutput=!1,this.outTexUsage=o.TextureUsage.DOWNLOAD;const t=(0,r.getGlslDifferences)();this.outputShape=e,this.userCode="\n ".concat(a.ENCODE_FLOAT_SNIPPET,"\n\n void main() {\n ivec3 coords = getOutputCoords();\n float x = getChannel(getAAtOutCoords(), vec2(coords.y, coords.z));\n ").concat(t.output," = encode_float(x);\n }\n ")}}},497365:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.EncodeMatrixProgram=void 0;var r=n(540236),a=n(965438),o=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=s(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if("default"!==o&&{}.hasOwnProperty.call(e,o)){var i=a?Object.getOwnPropertyDescriptor(e,o):null;i&&(i.get||i.set)?Object.defineProperty(r,o,i):r[o]=e[o]}return r.default=e,n&&n.set(e,r),r}(n(270327));function s(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(s=function(e){return e?n:t})(e)}t.EncodeMatrixProgram=class{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];this.variableNames=["A"],this.customUniforms=[{name:"texShape",type:"ivec2"}];const n=(0,r.getGlslDifferences)();this.outputShape=e,this.enableShapeUniforms=(0,a.useShapeUniforms)(this.outputShape.length);let s="result";t&&(s="floor(result * 255. + 0.5)"),this.userCode="\n ".concat(this.enableShapeUniforms?o.getFlatIndexFrom3DOutput():o.getFlatIndexFrom3D(e),"\n\n void main() {\n ivec3 coords = getOutputCoords();\n\n int flatIndex = getFlatIndex(coords);\n int offset = imod(flatIndex, 4);\n\n flatIndex = idiv(flatIndex, 4, 1.);\n\n int r = flatIndex / texShape[1];\n int c = imod(flatIndex, texShape[1]);\n vec2 uv = (vec2(c, r) + halfCR) / vec2(texShape[1], texShape[0]);\n vec4 values = ").concat(n.texture2D,"(A, uv);\n\n float result;\n\n if(offset == 0) {\n result = values[0];\n } else if(offset == 1) {\n result = values[1];\n } else if(offset == 2) {\n result = values[2];\n } else {\n result = values[3];\n }\n\n ").concat(n.output," = vec4(").concat(s,", 0., 0., 0.);\n }\n ")}}}
1,769672:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.EncodeMatrixPackedProgram=void 0;var r=n(540236),a=n(965438),o=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=s(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if("default"!==o&&{}.hasOwnProperty.call(e,o)){var i=a?Object.getOwnPropertyDescriptor(e,o):null;i&&(i.get||i.set)?Object.defineProperty(r,o,i):r[o]=e[o]}return r.default=e,n&&n.set(e,r),r}(n(270327));function s(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(s=function(e){return e?n:t})(e)}t.EncodeMatrixPackedProgram=class{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];this.variableNames=["A"],this.packedInputs=!1,this.packedOutput=!0,this.customUniforms=[{name:"texShape",type:"ivec2"}];const n=(0,r.getGlslDifferences)();this.outputShape=e,this.enableShapeUniforms=(0,a.useShapeUniforms)(this.outputShape.length);let s="",i="result";t&&(i="floor(result * 255. + 0.5)");for(let t=0;t<=1;t++)for(let r=0;r<=1;r++){const a=2*t+r;s+="\n localCoords = coords;\n if(localCoords[2] + ".concat(r," < ").concat(this.enableShapeUniforms?"outShape[2]":"".concat(e[2]),") {\n localCoords[2] += ").concat(r,";\n if (localCoords[1] + ").concat(t," < ").concat(this.enableShapeUniforms?"outShape[1]":"".concat(e[1]),") {\n localCoords[1] += ").concat(t,";\n\n flatIndex = getFlatIndex(localCoords);\n offset = imod(flatIndex, 4);\n\n flatIndex = idiv(flatIndex, 4, 1.);\n\n int r = flatIndex / texShape[1];\n int c = imod(flatIndex, texShape[1]);\n vec2 uv = (vec2(c, r) + halfCR) / vec2(texShape[1], texShape[0]);\n values = ").concat(n.texture2D,"(A, uv);\n\n if (offset == 0) {\n result[").concat(a,"] = values[0];\n } else if (offset == 1) {\n result[").concat(a,"] = values[1];\n } else if (offset == 2) {\n result[").concat(a,"] = values[2];\n } else {\n result[").concat(a,"] = values[3];\n }\n }\n }\n ")}this.userCode="\n ".concat(this.enableShapeUniforms?o.getFlatIndexFrom3DOutput():o.getFlatIndexFrom3D(e),"\n\n void main() {\n ivec3 coords = getOutputCoords();\n\n vec4 result = vec4(0.);\n int flatIndex, r, c, offset;\n ivec3 localCoords;\n vec2 uv;\n vec4 values;\n\n ").concat(s,"\n\n ").concat(n.output," = ").concat(i,";\n }\n ")}}},304876:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.FFTProgram=void 0;t.FFTProgram=class{constructor(e,t,n){this.variableNames=["real","imag"];const r=t[1];this.outputShape=t;const a=n?"2.0 * ".concat(Math.PI):"-2.0 * ".concat(Math.PI),o=n?"".concat(r,".0"):"1.0";let s;if("real"===e)s="return real * expR - imag * expI;";else{if("imag"!==e)throw new Error('FFT component must be either "real" or "imag", got '.concat(e,"."));s="return real * expI + imag * expR;"}this.userCode="\n const float exponentMultiplier = ".concat(a,";\n\n float unaryOpComplex(float real, float expR, float imag, float expI) {\n ").concat(s,"\n }\n\n float mulMatDFT(int batch, int index) {\n float indexRatio = float(index) / float(").concat(r,");\n float exponentMultiplierTimesIndexRatio =\n exponentMultiplier * indexRatio;\n\n float result = 0.0;\n\n for (int i = 0; i < ").concat(r,";
1 i++) {\n // x = (-2|2 * PI / N) * index * i;\n float x = exponentMultiplierTimesIndexRatio * float(i);\n float expR = cos(x);\n float expI = sin(x);\n float real = getReal(batch, i);\n float imag = getImag(batch, i);\n\n result +=\n unaryOpComplex(real, expR, imag, expI) / ").concat(o,";\n }\n\n return result;\n }\n\n void main() {\n ivec2 coords = getOutputCoords();\n setOutput(mulMatDFT(coords[0], coords[1]));\n }\n ")}}},88743:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.FillProgram=void 0;t.FillProgram=class{constructor(e,t){this.outputShape=[],this.customUniforms=[{name:"value",type:"float"}],this.variableNames=["x"],this.outputShape=e,this.userCode="\n void main() {\n // Input can be obtained from uniform value.\n setOutput(value);\n }\n "}}},640571:(e,t,n)=>{"use strict";var r=n(735534),a=n(519617);const o=(0,r.env)();o.registerFlag("HAS_WEBGL",(()=>o.getNumber("WEBGL_VERSION")>0)),o.registerFlag("WEBGL_VERSION",(()=>(0,a.isWebGLVersionEnabled)(2)?2:(0,a.isWebGLVersionEnabled)(1)?1:0)),o.registerFlag("WEBGL_CHECK_NUMERICAL_PROBLEMS",(()=>!1)),o.registerFlag("WEBGL_BUFFER_SUPPORTED",(()=>2===o.get("WEBGL_VERSION"))),o.registerFlag("WEBGL_CPU_FORWARD",(()=>!0)),o.registerFlag("WEBGL_FORCE_F16_TEXTURES",(()=>!1)),o.registerFlag("WEBGL_PACK",(()=>o.getBool("HAS_WEBGL"))),o.registerFlag("WEBGL_PACK_NORMALIZATION",(()=>o.getBool("WEBGL_PACK"))),o.registerFlag("WEBGL_PACK_CLIP",(()=>o.getBool("WEBGL_PACK"))),o.registerFlag("WEBGL_PACK_DEPTHWISECONV",(()=>o.getBool("WEBGL_PACK"))),o.registerFlag("WEBGL_PACK_BINARY_OPERATIONS",(()=>o.getBool("WEBGL_PACK"))),o.registerFlag("WEBGL_PACK_UNARY_OPERATIONS",(()=>o.getBool("WEBGL_PACK"))),o.registerFlag("WEBGL_PACK_ARRAY_OPERATIONS",(()=>o.getBool("WEBGL_PACK"))),o.registerFlag("WEBGL_PACK_IMAGE_OPERATIONS",(()=>o.getBool("WEBGL_PACK"))),o.registerFlag("WEBGL_PACK_REDUCE",(()=>o.getBool("WEBGL_PACK"))),o.registerFlag("WEBGL_LAZILY_UNPACK",(()=>o.getBool("WEBGL_PACK"))),o.registerFlag("WEBGL_CONV_IM2COL",(()=>o.getBool("WEBGL_PACK"))),o.registerFlag("WEBGL_MAX_TEXTURE_SIZE",(()=>(0,a.getWebGLMaxTextureSize)(o.getNumber("WEBGL_VERSION")))),o.registerFlag("WEBGL_MAX_TEXTURES_IN_SHADER",(()=>(0,a.getMaxTexturesInShader)(o.getNumber("WEBGL_VERSION")))),o.registerFlag("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_VERSION",(()=>{const e=o.getNumber("WEBGL_VERSION");return 0===e?0:(0,a.getWebGLDisjointQueryTimerVersion)(e)})),o.registerFlag("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_RELIABLE",(()=>o.getNumber("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_VERSION")>0&&!r.device_util.isMobile())),o.registerFlag("WEBGL_RENDER_FLOAT32_CAPABLE",(()=>(0,a.isCapableOfRenderingToFloatTexture)(o.getNumber("WEBGL_VERSION")))),o.registerFlag("WEBGL_RENDER_FLOAT32_ENABLED",(()=>!o.getBool("WEBGL_FORCE_F16_TEXTURES")&&o.getBool("WEBGL_RENDER_FLOAT32_CAPABLE"))),o.registerFlag("WEBGL_DOWNLOAD_FLOAT_ENABLED",(()=>(0,a.isDownloadFloatTextureEnabled)(o.getNumber("WEBGL_VERSION")))),o.registerFlag("WEBGL_FENCE_API_ENABLED",(()=>(0,a.isWebGLFenceEnabled)(o.getNumber("WEBGL_VERSION")))),o.registerFlag("WEBGL_SIZE_UPLOAD_UNIFORM",(()=>o.getBool("WEBGL_RENDER_FLOAT32_ENABLED")?4:0)),o.registerFlag("WEBGL_DELETE_TEXTURE_THRESHOLD",(()=>-1),(e=>{if(e<0&&-1!==e)throw new Error("WEBGL_DELETE_TEXTURE_THRESHOLD must be -1 (indicating never "+"delete) or at least 0, but got ".concat(e,"."))})),o.registerFlag("WEBGL_FLUSH_THRESHOLD",(()=>r.device_util.isMobile()?1:-1),(e=>{if(e<0&&-1!==e)throw new Error("WEBGL_FLUSH_THRESHOLD must be -1 (indicating never "+"manual flush) or at least 0, but got ".concat(e,"."))})),o.registerFlag("CPU_HANDOFF_SIZE_THRESHOLD",(()=>128)),o.registerFlag("WEBGL_USE_SHAPES_UNIFORMS",(()=>!1)),o.registerFlag("TOPK_LAST_DIM_CPU_HANDOFF_SIZE_THRESHOLD",(()=>1e5)),o.registerFlag("TOPK_K_CPU_HANDOFF_THRESHOLD",(()=>128))},606319:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.FlipLeftRightProgram=void 0;t.FlipLeftRightProgram=class{constructor(e){this.variableNames=["Image"],this.outputShape=[];const t=e[2];this.outputShape=e,this.userCode="\n void main() {\n ivec4 coords = getOutputCoords();\n int x = coords[2];\n\n int coordX = ".concat(t," - x - 1;\n float outputValue;\n if(coordX >= 0 && coordX < ").concat(t,") {\n outputValue = getImage(coords[0], coords[1], coordX, coords[3]);\n } else {\n outputValue = getImage(coords[0], coords[1], coords[2], coords[3]);\n }\n setOutput(outputValue);\n }\n ")}}},627230:(e,t,n)=>{"use strict";
1Object.defineProperty(t,"__esModule",{value:!0}),t.GatherProgram=void 0;var r=n(41990);t.GatherProgram=class{constructor(e,t){this.variableNames=["A","indices"],this.outputShape=t,this.rank=t.length;const n=(0,r.getCoordsDataType)(this.rank),a=function(e){const t=["resRC.x","resRC.y","resRC.z","resRC.w"],n=[];for(let r=0;r<e.length;r++)2===r?n.push("index"):n.push("".concat(t[r]));return n.join()}(e);this.userCode="\n void main() {\n ".concat(n," resRC = getOutputCoords();\n int index = int(getIndices(resRC.x, resRC.z));\n float inBounds = (index >= 0) && (index < ").concat(e[2],") ? 1.0 : 0.0;\n setOutput(inBounds * getA(").concat(a,"));\n }\n ")}}},940334:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.GatherNDProgram=void 0;var r=n(41990);t.GatherNDProgram=class{constructor(e,t,n){this.sliceDim=e,this.strides=t,this.variableNames=["x","indices"],this.outputShape=n;const a=(0,r.getCoordsDataType)(t.length),o=(0,r.getCoordsDataType)(n.length),s=this.sliceDim>1?"strides[j]":"strides";this.userCode="\n ".concat(a," strides = ").concat(a,"(").concat(this.strides,");\n void main() {\n ").concat(o," coords = getOutputCoords();\n int flattenIndex = 0;\n for (int j = 0; j < ").concat(this.sliceDim,"; j++) {\n int index = round(getIndices(coords[0], j));\n flattenIndex += index * ").concat(s,";\n }\n setOutput(getX(flattenIndex, coords[1]));\n }\n ")}}},540236:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getGlslDifferences=function(){let e,t,n,a,o,s,i,c,l,u;2===(0,r.env)().getNumber("WEBGL_VERSION")?(e="#version 300 es",t="in",n="out",a="in",o="texture",s="outputColor",i="out vec4 outputColor;",c="\n bool isnan_custom(float val) {\n uint floatToUint = floatBitsToUint(val);\n return (floatToUint & 0x7fffffffu) > 0x7f800000u;\n }\n\n bvec4 isnan_custom(vec4 val) {\n return bvec4(isnan_custom(val.x),\n isnan_custom(val.y), isnan_custom(val.z), isnan_custom(val.w));\n }\n\n #define isnan(value) isnan_custom(value)\n ",l="",u="\n #define round(value) newRound(value)\n int newRound(float value) {\n return int(floor(value + 0.5));\n }\n\n ivec4 newRound(vec4 value) {\n return ivec4(floor(value + vec4(0.5)));\n }\n "):(e="",t="attribute",n="varying",a="varying",o="texture2D",s="gl_FragColor",i="",c="\n #define isnan(value) isnan_custom(value)\n bool isnan_custom(float val) {\n return (val > 0. || val < 1. || val == 0.) ? false : true;\n }\n bvec4 isnan_custom(vec4 val) {\n return bvec4(isnan(val.x), isnan(val.y), isnan(val.z), isnan(val.w));\n }\n ",l="\n uniform float INFINITY;\n\n bool isinf(float val) {\n return abs(val) == INFINITY;\n }\n bvec4 isinf(vec4 val) {\n return equal(abs(val), vec4(INFINITY));\n }\n ",u="\n int round(float value) {\n return int(floor(value + 0.5));\n }\n\n ivec4 round(vec4 value) {\n return ivec4(floor(value + vec4(0.5)));\n }\n ");return{version:e,attribute:t,varyingVs:n,varyingFs:a,texture2D:o,output:s,defineOutput:i,defineSpecialNaN:c,defineSpecialInf:l,defineRound:u}};var r=n(735534)},80567:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.GPGPUContext=void 0,t.linearSearchLastTrue=u;var r=n(735534),a=n(821551),o=l(n(665163)),s=l(n(845772)),i=l(n(519617));function c(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(c=function(e){return e?n:t})(e)}function l(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=c(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if("default"!==o&&{}.hasOwnProperty.call(e,o)){var s=a?Object.getOwnPropertyDescriptor(e,o):null;s&&(s.get||s.set)?Object.defineProperty(r,o,s):r[o]=e[o]}return r.default=e,n&&n.set(e,r),r}function u(e){let t=0;for(;t<e.length;++t){if(!e[t]())break}return t-1}t.GPGPUContext=class{constructor(e){this.outputTexture=null,this.program=null,this.disposed=!1,this.vertexAttrsAreBound=!1,this.itemsToPoll=[];const t=(0,r.env)().getNumber("WEBGL_VERSION");null!=e?(this.gl=e,(0,a.setWebGLContext)(t,e)):this.gl=(0,a.getWebGLContext)(t);let n="WEBGL_color_buffer_float";const c="EXT_color_buffer_half_float";if(1===(0,r.env)().getNumber("WEBGL_VERSION")){const e="OES_texture_float",t="OES_texture_half_float";if(this.textureFloatExtension=i.getExtensionOrThrow(this.gl,e),i.hasExtension(this.gl,t))this.textureHalfFloatExtension=i.getExtensionOrThrow(this.gl,t);else if((0,r.env)().get("WEBGL_FORCE_F16_TEXTURES"))throw new Error("GL context does not support half float textures, yet the environment flag WEBGL_FORCE_F16_TEXTURES is set to true.");if(this.colorBufferFloatExtension=this.gl.getExtension(n),i.hasExtension(this.gl,c))this.colorBufferHalfFloatExtension=i.getExtensionOrThrow(this.gl,c);else if((0,r.env)().get("WEBGL_FORCE_F16_TEXTURES"))throw new Error("GL context does not support color renderable half floats, yet the environment flag WEBGL_FORCE_F16_TEXTURES is set to true.")}else if(n="EXT_color_buffer_float",i.hasExtension(this.gl,n))this.colorBufferFloatExtension=this.gl.getExtension(n);else{if(!i.hasExtension(this.gl,c))throw new Error("GL context does not support color renderable floats");this.colorBufferHalfFloatExtension=this.gl.getExtension(c)}this.vertexBuffer=o.createVertexBuffer(this.gl),this.indexBuffer=o.createIndexBuffer(this.gl),this.framebuffer=i.createFramebuffer(this.gl),this.textureConfig=s.getTextureConfig(this.gl,this.textureHalfFloatExtension)}get debug(){return(0,r.env)().getBool("DEBUG")}dispose(){if(this.disposed)return;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.");const e=this.gl;i.callAndCheck(e,(()=>e.finish())),i.callAndCheck(e,(()=>e.bindFramebuffer(e.FRAMEBUFFER,null))),i.callAndCheck(e,(()=>e.deleteFramebuffer(this.framebuffer))),i.callAndCheck(e,(()=>e.bindBuffer(e.ARRAY_BUFFER,null))),i.callAndCheck(e,(()=>e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,null))),i.callAndCheck(e,(()=>e.deleteBuffer(this.indexBuffer))),this.disposed=!0}createFloat32MatrixTexture(e,t){return this.throwIfDisposed(),o.createFloat32MatrixTexture(this.gl,e,t,this.textureConfig)}createFloat16MatrixTexture(e,t){return this.throwIfDisposed(),o.createFloat16MatrixTexture(this.gl,e,t,this.textureConfig)}createUnsignedBytesMatrixTexture(e,t){return this.throwIfDisposed(),o.createUnsignedBytesMatrixTexture(this.gl,e,t,this.textureConfig)}uploadPixelDataToTexture(e,t){this.throwIfDisposed(),o.uploadPixelDataToTexture(this.gl,e,t)}uploadDenseMatrixToTexture(e,t,n,r){this.throwIfDisposed(),o.uploadDenseMatrixToTexture(this.gl,e,t,n,r,this.textureConfig)}createFloat16PackedMatrixTexture(e,t){return this.throwIfDisposed(),o.createFloat16PackedMatrixTexture(this.gl,e,t,this.textureConfig)}createPackedMatrixTexture(e,t){return this.throwIfDisposed(),o.createPackedMatrixTexture(this.gl,e,t,this.textureConfig)}deleteMatrixTexture(e){this.throwIfDisposed(),this.outputTexture===e&&(i.unbindColorTextureFromFramebuffer(this.gl,this.framebuffer),this.outputTexture=null),i.callAndCheck(this.gl,(()=>this.gl.deleteTexture(e)))}downloadByteEncodedFloatMatrixFromOutputTexture(e,t,n){return this.downloadMatrixDriver(e,(()=>o.downloadByteEncodedFloatMatrixFromOutputTexture(this.gl,t,n,this.textureConfig)))}downloadPackedMatrixFromBuffer(e,t,n,r,a,s){return o.downloadPackedMatrixFromBuffer(this.gl,e,t,n,r,a,s,this.textureConfig)}downloadFloat32MatrixFromBuffer(e,t){return o.downloadFloat32MatrixFromBuffer(this.gl,e,t)}createBufferFromTexture(e,t,n){this.bindTextureToFrameBuffer(e);const r=o.createBufferFromOutputTexture(this.gl,t,n,this.textureConfig);return this.unbindTextureToFrameBuffer(),r}createAndWaitForFence(){const e=this.createFence(this.gl);
1return this.pollFence(e)}createFence(e){let t,n;if((0,r.env)().getBool("WEBGL_FENCE_API_ENABLED")){const r=e,a=r.fenceSync(r.SYNC_GPU_COMMANDS_COMPLETE,0);e.flush(),n=()=>{const e=r.clientWaitSync(a,0,0);return e===r.ALREADY_SIGNALED||e===r.CONDITION_SATISFIED},t=a}else(0,r.env)().getNumber("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_VERSION")>0?(t=this.beginQuery(),this.endQuery(),n=()=>this.isQueryAvailable(t,(0,r.env)().getNumber("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_VERSION"))):n=()=>!0;return{query:t,isFencePassed:n}}downloadMatrixFromPackedTexture(e,t,n){return this.downloadMatrixDriver(e,(()=>o.downloadMatrixFromPackedOutputTexture(this.gl,t,n)))}createProgram(e){this.throwIfDisposed();const t=this.gl;null==this.vertexShader&&(this.vertexShader=o.createVertexShader(t));const n=i.createProgram(t);return i.callAndCheck(t,(()=>t.attachShader(n,this.vertexShader))),i.callAndCheck(t,(()=>t.attachShader(n,e))),i.linkProgram(t,n),this.debug&&i.validateProgram(t,n),this.vertexAttrsAreBound||(this.setProgram(n),this.vertexAttrsAreBound=o.bindVertexProgramAttributeStreams(t,this.program,this.vertexBuffer)),n}deleteProgram(e){this.throwIfDisposed(),e===this.program&&(this.program=null),null!=e&&i.callAndCheck(this.gl,(()=>this.gl.deleteProgram(e)))}setProgram(e){this.throwIfDisposed(),this.program=e,null!=this.program&&this.debug&&i.validateProgram(this.gl,this.program),i.callAndCheck(this.gl,(()=>this.gl.useProgram(e)))}getUniformLocation(e,t){let n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];return this.throwIfDisposed(),n?i.getProgramUniformLocationOrThrow(this.gl,e,t):i.getProgramUniformLocation(this.gl,e,t)}getAttributeLocation(e,t){return this.throwIfDisposed(),i.callAndCheck(this.gl,(()=>this.gl.getAttribLocation(e,t)))}getUniformLocationNoThrow(e,t){return this.throwIfDisposed(),this.gl.getUniformLocation(e,t)}setInputMatrixTexture(e,t,n){this.throwIfDisposed(),this.throwIfNoProgram(),i.bindTextureToProgramUniformSampler(this.gl,e,t,n)}setOutputMatrixTexture(e,t,n){this.setOutputMatrixTextureDriver(e,n,t)}setOutputPackedMatrixTexture(e,t,n){this.throwIfDisposed();const[r,a]=s.getPackedMatrixTextureShapeWidthHeight(t,n);this.setOutputMatrixTextureDriver(e,r,a)}setOutputMatrixWriteRegion(e,t,n,r){this.setOutputMatrixWriteRegionDriver(n,e,r,t)}setOutputPackedMatrixWriteRegion(e,t,n,r){throw new Error("setOutputPackedMatrixWriteRegion not implemented.")}debugValidate(){null!=this.program&&i.validateProgram(this.gl,this.program),i.validateFramebuffer(this.gl)}executeProgram(){this.throwIfDisposed(),this.throwIfNoProgram();const e=this.gl;this.debug&&this.debugValidate(),i.callAndCheck(e,(()=>e.drawElements(e.TRIANGLES,6,e.UNSIGNED_SHORT,0)))}blockUntilAllProgramsCompleted(){this.throwIfDisposed(),i.callAndCheck(this.gl,(()=>this.gl.finish()))}getQueryTimerExtension(){return null==this.disjointQueryTimerExtension&&(this.disjointQueryTimerExtension=i.getExtensionOrThrow(this.gl,2===(0,r.env)().getNumber("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_VERSION")?"EXT_disjoint_timer_query_webgl2":"EXT_disjoint_timer_query")),this.disjointQueryTimerExtension}getQueryTimerExtensionWebGL2(){return this.getQueryTimerExtension()}getQueryTimerExtensionWebGL1(){return this.getQueryTimerExtension()}beginQuery(){if(2===(0,r.env)().getNumber("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_VERSION")){const e=this.gl,t=this.getQueryTimerExtensionWebGL2(),n=e.createQuery();return e.beginQuery(t.TIME_ELAPSED_EXT,n),n}const e=this.getQueryTimerExtensionWebGL1(),t=e.createQueryEXT();return e.beginQueryEXT(e.TIME_ELAPSED_EXT,t),t}endQuery(){if(2===(0,r.env)().getNumber("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_VERSION")){const e=this.gl,t=this.getQueryTimerExtensionWebGL2();return void e.endQuery(t.TIME_ELAPSED_EXT)}const e=this.getQueryTimerExtensionWebGL1();e.endQueryEXT(e.TIME_ELAPSED_EXT)}async waitForQueryAndGetTime(e){return await r.util.repeatedTry((()=>this.disposed||this.isQueryAvailable(e,(0,r.env)().getNumber("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_VERSION")))),this.getQueryTime(e,(0,r.env)().getNumber("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_VERSION"))}getQueryTime(e,t){if(0===t)return null;if(2===t){const t=this.gl;return t.getQueryParameter(e,t.QUERY_RESULT)/1e6}{const t=this.getQueryTimerExtensionWebGL1();return t.getQueryObjectEXT(e,t.QUERY_RESULT_EXT)/1e6}}isQueryAvailable(e,t){if(0===t)return!0;
1if(2===t){const t=this.gl,n=this.getQueryTimerExtensionWebGL2(),r=t.getQueryParameter(e,t.QUERY_RESULT_AVAILABLE);return null==this.disjoint&&(this.disjoint=this.gl.getParameter(n.GPU_DISJOINT_EXT)),r&&!this.disjoint}{const t=this.getQueryTimerExtensionWebGL1(),n=t.getQueryObjectEXT(e,t.QUERY_RESULT_AVAILABLE_EXT);return null==this.disjoint&&(this.disjoint=this.gl.getParameter(t.GPU_DISJOINT_EXT)),n&&!this.disjoint}}pollFence(e){return new Promise((t=>{this.addItemToPoll((()=>e.isFencePassed()),(()=>t()))}))}pollItems(){const e=u(this.itemsToPoll.map((e=>e.isDoneFn)));for(let t=0;t<=e;++t){const{resolveFn:e}=this.itemsToPoll[t];e()}this.itemsToPoll=this.itemsToPoll.slice(e+1)}addItemToPoll(e,t){this.itemsToPoll.push({isDoneFn:e,resolveFn:t}),this.itemsToPoll.length>1||r.util.repeatedTry((()=>(this.pollItems(),0===this.itemsToPoll.length)))}bindTextureToFrameBuffer(e){this.throwIfDisposed(),i.bindColorTextureToFramebuffer(this.gl,e,this.framebuffer),this.debug&&i.validateFramebuffer(this.gl)}unbindTextureToFrameBuffer(){null!=this.outputTexture?(i.bindColorTextureToFramebuffer(this.gl,this.outputTexture,this.framebuffer),this.debug&&i.validateFramebuffer(this.gl)):i.unbindColorTextureFromFramebuffer(this.gl,this.framebuffer)}downloadMatrixDriver(e,t){this.bindTextureToFrameBuffer(e);const n=t();return this.unbindTextureToFrameBuffer(),n}setOutputMatrixTextureDriver(e,t,n){this.throwIfDisposed();const r=this.gl;i.bindColorTextureToFramebuffer(r,e,this.framebuffer),this.debug&&i.validateFramebuffer(r),this.outputTexture=e,i.callAndCheck(r,(()=>r.viewport(0,0,t,n))),i.callAndCheck(r,(()=>r.scissor(0,0,t,n)))}setOutputMatrixWriteRegionDriver(e,t,n,r){this.throwIfDisposed(),i.callAndCheck(this.gl,(()=>this.gl.scissor(e,t,n,r)))}throwIfDisposed(){if(this.disposed)throw new Error("Attempted to use disposed GPGPUContext.")}throwIfNoProgram(){if(null==this.program)throw new Error("No GPU program is currently set.")}}},965438:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.compileProgram=function(e,t,n,s){const i=n.map(((e,n)=>{const r={logicalShape:e.shape,texShape:e.isUniform?null:e.texData.texShape,isUniform:e.isUniform,isPacked:!e.isUniform&&e.texData.isPacked,flatOffset:null};return null!=e.texData&&null!=e.texData.slice&&e.texData.slice.flatOffset>0&&(r.flatOffset=e.texData.slice.flatOffset),{name:t.variableNames[n],shapeInfo:r}})),c=i.map((e=>e.shapeInfo)),l={logicalShape:s.shape,texShape:s.texData.texShape,isUniform:!1,isPacked:s.texData.isPacked,flatOffset:null},u=a.makeShader(i,l,t),d=(0,o.createFragmentShader)(e.gl,u),p=e.createProgram(d);let h=null;const f=e.getUniformLocation(p,"NAN",!1);1===(0,r.env)().getNumber("WEBGL_VERSION")&&(h=e.getUniformLocation(p,"INFINITY",!1));const m=!1,g={},y={},v={};for(let n=0;n<t.variableNames.length;n++){const r=t.variableNames[n];g[r]=e.getUniformLocation(p,r,m),g["offset".concat(r)]=e.getUniformLocation(p,"offset".concat(r),m),t.enableShapeUniforms&&(y["".concat(r,"Shape")]=e.getUniformLocation(p,"".concat(r,"Shape"),m),v["".concat(r,"TexShape")]=e.getUniformLocation(p,"".concat(r,"TexShape"),m))}let b,x,w;t.enableShapeUniforms&&(b=e.getUniformLocation(p,"outShape",m),w=e.getUniformLocation(p,"outShapeStrides",m),x=e.getUniformLocation(p,"outTexShape",m));const k=[];
1t.customUniforms&&t.customUniforms.forEach(((t,n)=>{k[n]=e.getUniformLocation(p,t.name,m)}));return{program:t,fragmentShader:d,source:u,webGLProgram:p,uniformLocations:g,customUniformLocations:k,inShapeInfos:c,outShapeInfo:l,infLoc:h,nanLoc:f,inShapesLocations:y,inTexShapesLocations:v,outShapeLocation:b,outShapeStridesLocation:w,outTexShapeLocation:x}},t.makeShaderKey=function(e,t,n){let o="";t.concat(n).forEach((t=>{const s=null!=t.texData&&null!=t.texData.slice&&t.texData.slice.flatOffset>0;if(e.enableShapeUniforms&&!t.isUniform){const i=t.texData.texShape,{useSqueezeShape:c,uniformShape:l,keptDims:u}=a.getUniformInfoFromShape(e.packedInputs,t.shape,i);let d="",p="",h="";if(1===l.length&&e.packedInputs){const e=[Math.ceil(i[0]/2),Math.ceil(i[1]/2)];d="".concat(e[0]>1,"_").concat(e[1]>1)}else if(2!==l.length||e.packedInputs){if(l.length>2&&!e.packedInputs){const e=r.util.computeStrides(l);h="".concat(e[0]===i[1],"_").concat(e[e.length-1]===i[1])}}else p="".concat(l[0]>1,"_").concat(l[1]>1);const f=t.shape.length,m=2===l.length&&r.util.arraysEqual(t.shape,i),g=1===r.util.sizeFromShape(t.shape),y=r.backend_util.getBroadcastDims(t.shape,n.shape),v=!e.packedInputs&&f===n.shape.length&&r.util.arraysEqual(i,n.texData.texShape),b=e.packedInputs||l.length>2?"":"".concat(i[0]>1,"_").concat(i[1]>1);o+="".concat(f,"_").concat(v,"_").concat(c?u:"","_").concat(l.length,"_").concat(g,"_").concat(y,"_").concat(m,"_").concat(d,"_").concat(p,"_").concat(h,"_").concat(b,"_").concat(s)}else{const e=t.isUniform?"uniform":t.texData.texShape;o+="".concat(t.shape,"_").concat(e,"_").concat(s)}}));const s=e.userCode;let i=e.constructor.name;return i+="_"+o+"_"+s+"".concat((0,r.env)().getNumber("WEBGL_VERSION")),i},t.runProgram=function(e,t,n,o,s){t.program.enableShapeUniforms||(i(t.inShapeInfos,n),i([t.outShapeInfo],[o]));const c=o.texData.texture,l=o.texData.texShape;o.texData.isPacked?e.setOutputPackedMatrixTexture(c.texture,l[0],l[1]):e.setOutputMatrixTexture(c.texture,l[0],l[1]);e.setProgram(t.webGLProgram),1===(0,r.env)().getNumber("WEBGL_VERSION")&&null!==t.infLoc&&e.gl.uniform1f(t.infLoc,1/0);null!==t.nanLoc&&e.gl.uniform1f(t.nanLoc,NaN);n.forEach(((n,o)=>{const s=t.program.variableNames[o],i=t.uniformLocations[s],c=t.uniformLocations["offset".concat(s)],l=t.inShapesLocations["".concat(s,"Shape")],u=t.inTexShapesLocations["".concat(s,"TexShape")];if(l){const{uniformShape:r}=a.getUniformInfoFromShape(t.program.packedInputs,n.shape,n.texData.texShape);switch(r.length){case 1:e.gl.uniform1iv(l,new Int32Array(r));break;case 2:e.gl.uniform2iv(l,new Int32Array(r));break;case 3:e.gl.uniform3iv(l,new Int32Array(r));break;case 4:e.gl.uniform4iv(l,new Int32Array(r))}}if(u&&e.gl.uniform2i(u,n.texData.texShape[0],n.texData.texShape[1]),null!=i)if(n.isUniform)if(r.util.sizeFromShape(n.shape)<2)e.gl.uniform1f(i,n.uniformValues[0]);else{let t=n.uniformValues;t instanceof Float32Array||(t=new Float32Array(t)),e.gl.uniform1fv(i,t)}else null!=n.texData.slice&&null!=c&&e.gl.uniform1i(c,n.texData.slice.flatOffset),e.setInputMatrixTexture(n.texData.texture.texture,i,o)}));const u=t.outShapeLocation;if(u)switch(o.shape.length){case 1:e.gl.uniform1iv(u,new Int32Array(o.shape));break;case 2:e.gl.uniform2iv(u,new Int32Array(o.shape));break;case 3:e.gl.uniform3iv(u,new Int32Array(o.shape));break;case 4:e.gl.uniform4iv(u,new Int32Array(o.shape))}if(t.outShapeStridesLocation){const n=r.util.computeStrides(o.shape);switch(o.shape.length){case 2:e.gl.uniform1iv(t.outShapeStridesLocation,new Int32Array(n));break;case 3:e.gl.uniform2iv(t.outShapeStridesLocation,new Int32Array(n));break;case 4:e.gl.uniform3iv(t.outShapeStridesLocation,new Int32Array(n))}}t.outTexShapeLocation&&e.gl.uniform2i(t.outTexShapeLocation,o.texData.texShape[0],o.texData.texShape[1]);
1t.program.customUniforms&&s&&t.program.customUniforms.forEach(((n,r)=>{const a=t.customUniformLocations[r],o=s[r];if("float"===n.type)e.gl.uniform1fv(a,o);else if("vec2"===n.type)e.gl.uniform2fv(a,o);else if("vec3"===n.type)e.gl.uniform3fv(a,o);else if("vec4"===n.type)e.gl.uniform4fv(a,o);else if("int"===n.type)e.gl.uniform1iv(a,o);else if("ivec2"===n.type)e.gl.uniform2iv(a,o);else if("ivec3"===n.type)e.gl.uniform3iv(a,o);else{if("ivec4"!==n.type)throw Error("uniform type ".concat(n.type," is not supported yet."));e.gl.uniform4iv(a,o)}}));e.executeProgram()},t.useShapeUniforms=function(e){return(0,r.env)().getBool("WEBGL_USE_SHAPES_UNIFORMS")&&e<=4};var r=n(735534),a=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=s(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if("default"!==o&&{}.hasOwnProperty.call(e,o)){var i=a?Object.getOwnPropertyDescriptor(e,o):null;i&&(i.get||i.set)?Object.defineProperty(r,o,i):r[o]=e[o]}return r.default=e,n&&n.set(e,r),r}(n(41990)),o=n(519617);function s(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(s=function(e){return e?n:t})(e)}function i(e,t){if(e.length!==t.length)throw Error("Binary was compiled with ".concat(e.length," inputs, but ")+"was executed with ".concat(t.length," inputs"));e.forEach(((e,n)=>{const a=e.logicalShape,o=t[n],s=o.shape;if(!r.util.arraysEqual(a,s))throw Error("Binary was compiled with different shapes than "+"the current args. Shapes ".concat(a," and ").concat(s," must match"));if(e.isUniform&&o.isUniform)return;const i=e.texShape,c=o.isUniform?null:o.texData.texShape;if(!r.util.arraysEqual(i,c))throw Error("Binary was compiled with different texture shapes than the"+" current args. Shape ".concat(i," and ").concat(c," must match"))}))}},665163:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.bindVertexProgramAttributeStreams=function(e,t,n){s.callAndCheck(e,(()=>e.bindBuffer(e.ARRAY_BUFFER,n)));return s.bindVertexBufferToProgramAttribute(e,t,"clipSpacePos",n,3,20,0)&&s.bindVertexBufferToProgramAttribute(e,t,"uv",n,2,20,12)},t.createBufferFromOutputTexture=function(e,t,n,r){const a=e.createBuffer();s.callAndCheck(e,(()=>e.bindBuffer(e.PIXEL_PACK_BUFFER,a)));const o=16*t*n;return s.callAndCheck(e,(()=>e.bufferData(e.PIXEL_PACK_BUFFER,o,e.STREAM_READ))),s.callAndCheck(e,(()=>e.readPixels(0,0,n,t,e.RGBA,e.FLOAT,0))),s.callAndCheck(e,(()=>e.bindBuffer(e.PIXEL_PACK_BUFFER,null))),a},t.createFloat16MatrixTexture=function(e,t,n,r){const[a,s]=o.getUnpackedMatrixTextureShapeWidthHeight(t,n);return l(e,a,s,d(r),r.textureFormatFloat,r.textureTypeHalfFloat)},t.createFloat16PackedMatrixTexture=function(e,t,n,r){const[a,s]=o.getPackedMatrixTextureShapeWidthHeight(t,n);return l(e,a,s,f(r),e.RGBA,r.textureTypeHalfFloat)},t.createFloat32MatrixTexture=function(e,t,n,r){const[a,s]=o.getUnpackedMatrixTextureShapeWidthHeight(t,n);return l(e,a,s,u(r),r.textureFormatFloat,e.FLOAT)},t.createIndexBuffer=function(e){const t=new Uint16Array([0,1,2,2,1,3]);return s.createStaticIndexBuffer(e,t)},t.createPackedMatrixTexture=function(e,t,n,r){const[a,s]=o.getPackedMatrixTextureShapeWidthHeight(t,n);return l(e,a,s,h(r),e.RGBA,e.FLOAT)},t.createUnsignedBytesMatrixTexture=function(e,t,n,r){const[a,s]=o.getUnpackedMatrixTextureShapeWidthHeight(t,n);return l(e,a,s,p(r),e.RGBA,e.UNSIGNED_BYTE)},t.createVertexBuffer=function(e){const t=new Float32Array([-1,1,0,0,1,-1,-1,0,0,0,1,1,0,1,1,1,-1,0,1,0]);return s.createStaticVertexBuffer(e,t)},t.createVertexShader=function(e){const t=(0,a.getGlslDifferences)(),n="".concat(t.version,"\n precision highp float;\n ").concat(t.attribute," vec3 clipSpacePos;\n ").concat(t.attribute," vec2 uv;\n ").concat(t.varyingVs," vec2 resultUV;\n\n void main() {\n gl_Position = vec4(clipSpacePos, 1);\n resultUV = uv;\n }");return s.createVertexShader(e,n)},t.downloadByteEncodedFloatMatrixFromOutputTexture=function(e,t,n,r){const[a,i]=o.getUnpackedMatrixTextureShapeWidthHeight(t,n),c=new Uint8Array(o.getUnpackedArraySizeFromMatrixSize(t*n,4));return s.callAndCheck(e,(()=>
1e.readPixels(0,0,a,i,r.downloadTextureFormat,e.UNSIGNED_BYTE,c))),new Float32Array(c.buffer)},t.downloadFloat32MatrixFromBuffer=function(e,t,n){const r=e,a=new Float32Array(n);return r.bindBuffer(r.PIXEL_PACK_BUFFER,t),r.getBufferSubData(r.PIXEL_PACK_BUFFER,0,a),r.bindBuffer(r.PIXEL_PACK_BUFFER,null),a},t.downloadMatrixFromPackedOutputTexture=function(e,t,n){const r=new Float32Array(t*n*4);return s.callAndCheck(e,(()=>e.readPixels(0,0,n,t,e.RGBA,e.FLOAT,r))),r},t.downloadPackedMatrixFromBuffer=function(e,t,n,r,a,s,i,c){const l=e,u=new Float32Array(o.getPackedRGBAArraySizeFromMatrixShape(s,i));return l.bindBuffer(l.PIXEL_PACK_BUFFER,t),l.getBufferSubData(l.PIXEL_PACK_BUFFER,0,u),l.bindBuffer(l.PIXEL_PACK_BUFFER,null),u},t.getInternalFormatForFloat16MatrixTexture=d,t.getInternalFormatForFloat16PackedMatrixTexture=f,t.getInternalFormatForFloat32MatrixTexture=u,t.getInternalFormatForPackedMatrixTexture=h,t.getInternalFormatForUnsignedBytesMatrixTexture=p,t.uploadDenseMatrixToTexture=function(e,t,n,a,o,i){let c,l,u;s.callAndCheck(e,(()=>e.bindTexture(e.TEXTURE_2D,t))),o instanceof Uint8Array?(c=new Uint8Array(n*a*4),l=e.UNSIGNED_BYTE,u=e.RGBA):(c=new Float32Array(n*a*4),l=e.FLOAT,u=i.internalFormatPackedFloat);c.set(o),2===(0,r.env)().getNumber("WEBGL_VERSION")?s.callAndCheck(e,(()=>e.texSubImage2D(e.TEXTURE_2D,0,0,0,n,a,e.RGBA,l,c))):s.callAndCheck(e,(()=>e.texImage2D(e.TEXTURE_2D,0,u,n,a,0,e.RGBA,l,c)));s.callAndCheck(e,(()=>e.bindTexture(e.TEXTURE_2D,null)))},t.uploadPixelDataToTexture=function(e,t,n){s.callAndCheck(e,(()=>e.bindTexture(e.TEXTURE_2D,t))),n.data instanceof Uint8Array?2===(0,r.env)().getNumber("WEBGL_VERSION")?s.callAndCheck(e,(()=>e.texSubImage2D(e.TEXTURE_2D,0,0,0,n.width,n.height,e.RGBA,e.UNSIGNED_BYTE,n.data))):s.callAndCheck(e,(()=>e.texImage2D(e.TEXTURE_2D,0,e.RGBA,n.width,n.height,0,e.RGBA,e.UNSIGNED_BYTE,n.data))):2===(0,r.env)().getNumber("WEBGL_VERSION")?s.callAndCheck(e,(()=>e.texSubImage2D(e.TEXTURE_2D,0,0,0,e.RGBA,e.UNSIGNED_BYTE,n))):s.callAndCheck(e,(()=>e.texImage2D(e.TEXTURE_2D,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,n)));s.callAndCheck(e,(()=>e.bindTexture(e.TEXTURE_2D,null)))};var r=n(735534),a=n(540236),o=c(n(845772)),s=c(n(519617));function i(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(i=function(e){return e?n:t})(e)}function c(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=i(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if("default"!==o&&{}.hasOwnProperty.call(e,o)){var s=a?Object.getOwnPropertyDescriptor(e,o):null;s&&(s.get||s.set)?Object.defineProperty(r,o,s):r[o]=e[o]}return r.default=e,n&&n.set(e,r),r}function l(e,t,n,a,o,i){s.validateTextureSize(t,n);const c=s.createTexture(e),l=e.TEXTURE_2D;return s.callAndCheck(e,(()=>e.bindTexture(l,c))),s.callAndCheck(e,(()=>e.texParameteri(l,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE))),s.callAndCheck(e,(()=>e.texParameteri(l,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE))),s.callAndCheck(e,(()=>e.texParameteri(l,e.TEXTURE_MIN_FILTER,e.NEAREST))),s.callAndCheck(e,(()=>e.texParameteri(l,e.TEXTURE_MAG_FILTER,e.NEAREST))),1===(0,r.env)().getNumber("WEBGL_VERSION")?s.callAndCheck(e,(()=>e.texImage2D(l,0,a,t,n,0,o,i,null))):s.callAndCheck(e,(()=>e.texStorage2D(l,1,a,t,n))),s.callAndCheck(e,(()=>e.bindTexture(e.TEXTURE_2D,null))),{texture:c,texShape:[n,t]}}function u(e){return e.internalFormatFloat}function d(e){return e.internalFormatHalfFloat}function p(e){return e.downloadTextureFormat}function h(e){return e.internalFormatPackedFloat}function f(e){return e.internalFormatPackedHalfFloat}},27582:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Im2ColPackedProgram=void 0;var r=n(540236),a=n(965438);t.Im2ColPackedProgram=class{constructor(e,t){this.variableNames=["A"],this.packedInputs=!0,this.packedOutput=!0,this.customUniforms=[{name:"inputShape",type:"ivec3"},{name:"pad",type:"ivec2"},{name:"stride",type:"ivec2"},{name:"dilation",type:"ivec2"},{name:"inChannels",type:"int"},{name:"itemsPerBlockRow",type:"int"},{name:"outWidth",type:"int"}],this.outputShape=e,this.enableShapeUniforms=(0,a.useShapeUniforms)(this.outputShape.length);const{dataFormat:n}=t,o=(0,r.getGlslDifferences)(),s="channelsLast"===n,i=s?0:1,c=s?1:2,l=this.enableShapeUniforms?"if(blockIndex < outShape[1] && pos < outShape[0]) {":"if(blockIndex < ".concat(e[1]," && pos < ").concat(e[0],") {");let u="";for(let e=0;e<=1;e++)for(let t=0;t<=1;t++)u+="\n blockIndex = rc.y + ".concat(t,";\n pos = rc.x + ").concat(e,";\n\n ").concat(l,"\n offsetY = int(blockIndex / outWidth) * stride[0] - pad[0];\n d0 = offsetY + dilation[0] * (pos / itemsPerBlockRow);\n\n if(d0 < inputShape[").concat(i,"] && d0 >= 0) {\n // Use custom imod instead mod. On Intel GPU, mod may generate\n // unexpected value.\n // https://github.com/tensorflow/tfjs/issues/5447\n offsetX = imod(blockIndex, outWidth) * stride[1] - pad[
11];\n d1 = offsetX + dilation[1] * (imod(pos, itemsPerBlockRow) /\n inChannels);\n\n if(d1 < inputShape[").concat(c,"] && d1 >= 0) {\n\n ch = imod(pos, inChannels);\n\n if (").concat(s,") {\n innerDims = vec2(d1, ch);\n result[").concat(2*e+t,"] = getChannel(\n getA(d0, int(innerDims.x),\n int(innerDims.y)), innerDims);\n } else {\n innerDims = vec2(d0, d1);\n result[").concat(2*e+t,"] = getChannel(\n getA(ch, int(innerDims.x),\n int(innerDims.y)), innerDims);\n }\n }\n }\n }\n ");this.userCode="\n void main() {\n ivec2 rc = getOutputCoords();\n\n vec4 result = vec4(0);\n\n int blockIndex, pos, offsetY, d0, offsetX, d1, ch;\n vec2 innerDims;\n\n ".concat(u,"\n\n ").concat(o.output," = result;\n }\n ")}}}
1,346999:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(108244);Object.keys(r).forEach((function(e){"default"!==e&&"__esModule"!==e&&(e in t&&t[e]===r[e]||Object.defineProperty(t,e,{enumerable:!0,get:function(){return r[e]}}))})),n(461396)},36007:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.argMinMaxReduce=function(e,t,n,a){const o=[n];if(r.backend_util.assertAxesAreInnerMostDims("arg"+a.charAt(0).toUpperCase()+a.slice(1),o,t.shape.length),!(0,r.env)().getBool("WEBGL_PACK_REDUCE")||t.shape.length<=2){const n=[],c=e.texData.get(t.dataId);let l=t;null!==c&&c.isPacked&&(l=e.unpackTensor(t),n.push(l));const[u,d]=r.backend_util.computeOutAndReduceShapes(l.shape,o),p=r.util.sizeFromShape(d),h=(0,s.reshape)({inputs:{x:l},backend:e,attrs:{shape:[-1,p]}});n.push(h);const f=i(e,h,a);n.push(f);const m=(0,s.reshape)({inputs:{x:f},backend:e,attrs:{shape:u}});return n.forEach((t=>e.disposeIntermediateTensorInfo(t))),m}return c(e,t,a)};var r=n(735534),a=n(487062),o=n(727311),s=n(144638);function i(e,t,n){let o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,s=t.shape[0],c=t.shape[1];null!=o&&(s=o.shape[0],c=o.shape[1]);const l=r.backend_util.computeOptimalWindowSize(c),u={windowSize:l,inSize:c,batchSize:s,outSize:Math.ceil(c/l)},d=new a.ArgMinMaxProgram(u,n,null==o),p=[t];null!=o&&p.push(o);const h=e.runWebGLProgram(d,p,"int32");if(1===h.shape[1])return h;const f=i(e,t,n,h);return e.disposeIntermediateTensorInfo(h),f}function c(e,t,n){let a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;const s=null!=a?a.shape:t.shape,i=s[s.length-1],l=r.backend_util.computeOptimalWindowSize(i),u=new o.ArgMinMaxPackedProgram(s,l,n,null==a),d=null==a?[t]:[t,a],p=e.runWebGLProgram(u,d,"int32");if(p.shape.length===t.shape.length){const r=c(e,t,n,p);return e.disposeIntermediateTensorInfo(p),r}return p}},880533:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.int=function(e,t){const n=new r.UnaryOpProgram(e.shape,a),o=t.runWebGLProgram(n,[e],"int32");return{dataId:o.dataId,shape:o.shape,dtype:o.dtype}};var r=n(934500);const a="return float(int(x));"},537925:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.CHECK_NAN_SNIPPET_UNARY=t.CHECK_NAN_SNIPPET_BINARY_PACKED=t.CHECK_NAN_SNIPPET_BINARY=void 0,t.binaryKernelFunc=function(e){let{opSnippet:t,packedOpSnippet:n,checkOutOfBounds:i=!1,supportsComplex:c=!1,cpuKernelImpl:l,dtype:u}=e;return e=>{let{inputs:d,backend:p}=e;const{a:h,b:f}=d,m=p;if(c&&"complex64"===h.dtype){const e=m.texData.get(h.dataId),n=m.texData.get(f.dataId),[o,i]=[[e.complexTensorInfos.real,n.complexTensorInfos.real],[e.complexTensorInfos.imag,n.complexTensorInfos.imag]].map((e=>{const[n,o]=e,s={dataId:n.dataId,dtype:n.dtype,shape:h.shape},i={dataId:o.dataId,dtype:o.dtype,shape:f.shape},c=new a.BinaryOpProgram(t,h.shape,f.shape);return m.runWebGLProgram(c,[s,i],(0,r.upcastType)(n.dtype,o.dtype))})),c=(0,s.complex)({inputs:{real:o,imag:i},backend:m});return m.disposeIntermediateTensorInfo(o),m.disposeIntermediateTensorInfo(i),c}const g=u||(0,r.upcastType)(h.dtype,f.dtype);if(("string"===h.dtype||"string"===f.dtype||m.shouldExecuteOnCPU([h,f]))&&null!=l){const e=m.texData.get(h.dataId).values,t=m.texData.get(f.dataId).values,n="string"===h.dtype?r.backend_util.fromUint8ToStringArray(e):e,a="string"===h.dtype?r.backend_util.fromUint8ToStringArray(t):t,[o,s]=l(h.shape,f.shape,n,a,g),i=m.makeTensorInfo(s,g);return m.texData.get(i.dataId).values=o,i}let y;return y=(0,r.env)().getBool("WEBGL_PACK_BINARY_OPERATIONS")&&null!=n?new o.BinaryOpPackedProgram(n,h.shape,f.shape,i):new a.BinaryOpProgram(t,h.shape,f.shape),m.runWebGLProgram(y,[h,f],g)}},t.mapActivationToShaderProgram=function(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if("linear"===e)return t?p.LINEAR:u.LINEAR;if("relu"===e)return t?p.RELU:u.RELU;if("elu"===e)return t?p.ELU:u.ELU;if("relu6"===e)return t?p.RELU6:u.RELU6;
1if("prelu"===e)return t?c.PRELU_PACKED:c.PRELU;if("leakyrelu"===e)return t?i.LEAKYRELU_PACKED:i.LEAKYRELU;if("sigmoid"===e)return t?p.SIGMOID:u.SIGMOID;throw new Error("Activation ".concat(e," has not been implemented for the WebGL backend."))},t.unaryKernelFunc=function(e){let{opSnippet:t,packedOpSnippet:n,cpuKernelImpl:a,dtype:o}=e;return e=>{let{inputs:s,backend:i}=e;const{x:c}=s,u=i,p=o||c.dtype;if(u.shouldExecuteOnCPU([c])&&null!=a){const e=u.texData.get(c.dataId),t=a(e.values,p);return u.makeTensorInfo(c.shape,p,t)}let h;return h=(0,r.env)().getBool("WEBGL_PACK_UNARY_OPERATIONS")&&null!=n?new d.UnaryOpPackedProgram(c.shape,n):new l.UnaryOpProgram(c.shape,t),u.runWebGLProgram(h,[c],p)}};var r=n(735534),a=n(386960),o=n(215872),s=n(63255),i=n(410636),c=n(750888),l=f(n(934500)),u=l,d=f(n(721797)),p=d;function h(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(h=function(e){return e?n:t})(e)}function f(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=h(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if("default"!==o&&{}.hasOwnProperty.call(e,o)){var s=a?Object.getOwnPropertyDescriptor(e,o):null;s&&(s.get||s.set)?Object.defineProperty(r,o,s):r[o]=e[o]}return r.default=e,n&&n.set(e,r),r}t.CHECK_NAN_SNIPPET_UNARY="if (isnan(x)) return x;",t.CHECK_NAN_SNIPPET_BINARY="\n if (isnan(a)) return a;\n if (isnan(b)) return b;\n",t.CHECK_NAN_SNIPPET_BINARY_PACKED="\n result.r = isNaN.r > 0. ? NAN : result.r;\n result.g = isNaN.g > 0. ? NAN : result.g;\n result.b = isNaN.b > 0. ? NAN : result.b;\n result.a = isNaN.a > 0. ? NAN : result.a;\n"},531305:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.reduce=function(e,t,n,s){const i=function(e){const t=[];for(;0===t.length||1!==t[t.length-1].outSize;){const n=t.length?t[t.length-1].outSize:e[1],a=r.backend_util.computeOptimalWindowSize(n);t.push({inSize:n,windowSize:a,outSize:Math.ceil(n/a)})}return t}(e.shape);let c=e;for(let r=0;r<i.length;r++){const{inSize:l,windowSize:u,outSize:d}=i[r];let p,h;p="mean"===n?0===r?new a.MeanProgram({windowSize:u,inSize:l,batchSize:e.shape[0],outSize:d},l):new a.MeanProgram({windowSize:u,inSize:l,batchSize:e.shape[0],outSize:d}):new o.ReduceProgram({windowSize:u,inSize:l,batchSize:e.shape[0],outSize:d},n),h=c,c=s.runWebGLProgram(p,[c],t),h.dataId!==e.dataId&&s.disposeIntermediateTensorInfo(h)}return c};var r=n(735534),a=n(796183),o=n(316187)},437287:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.packedReshape=function(e,t,n){const o=[(0,a.getBatchDim)(e.shape),...(0,a.getRowsCols)(e.shape)],s={dtype:e.dtype,shape:o,dataId:e.dataId},i=[(0,a.getBatchDim)(t),...(0,a.getRowsCols)(t)],c=new r.ReshapePackedProgram(i,o),l=[o],u=n.runWebGLProgram(c,[s],e.dtype,l,!0);return{dataId:u.dataId,shape:t,dtype:u.dtype}};var r=n(769801),a=n(519617)},509570:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.uniqueImplCPU=t.transposeImplCPU=t.topKImplCPU=t.tileImplCPU=t.subImplCPU=t.stringToHashBucketFastImplCPU=t.stringSplitImplCPU=t.stringNGramsImplCPU=t.stridedSliceImplCPU=t.sqrtImplCPU=t.sparseSegmentReductionImplCPU=t.sparseReshapeImplCPU=t.sparseFillEmptyRowsImplCPU=t.sliceImplCPU=t.simpleAbsImplCPU=t.sigmoidImplCPU=t.rsqrtImplCPU=t.rangeImplCPU=t.prodImplCPU=t.notEqualImplCPU=t.negImplCPU=t.multiplyImplCPU=t.minimumImplCPU=t.maximumImplCPU=t.maxImplCPU=t.logImplCPU=t.linSpaceImplCPU=t.lessImplCPU=t.lessEqualImplCPU=t.greaterImplCPU=t.greaterEqualImplCPU=t.gatherV2ImplCPU=t.gatherNdImplCPU=t.floorImplCPU=t.expm1ImplCPU=t.expImplCPU=t.equalImplCPU=t.concatImplCPU=t.ceilImplCPU=t.bincountReduceImplCPU=t.bincountImplCPU=t.addImplCPU=void 0;var r=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=a(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var s in e)if("default"!==s&&{}.hasOwnProperty.call(e,s)){var i=o?Object.getOwnPropertyDescriptor(e,s):null;i&&(i.get||i.set)?Object.defineProperty(r,s,i):r[s]=e[s]}return r.default=e,n&&n.set(e,r),r}(n(717324));function a(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(a=function(e){return e?n:t})(e)}const{addImpl:o,bincountImpl:s,bincountReduceImpl:i,ceilImpl:c,concatImpl:l,equalImpl:u,expImpl:d,expm1Impl:p,floorImpl:h,gatherNdImpl:f,gatherV2Impl:m,greaterImpl:g,greaterEqualImpl:y,lessImpl:v,lessEqualImpl:b,linSpaceImpl:x,logImpl:w,maxImpl:k,maximumImpl:_,minimumImpl:C,multiplyImpl:P,negImpl:O,notEqualImpl:N,prodImpl:I,rangeImpl:T,rsqrtImpl:S,sigmoidImpl:E,simpleAbsImpl:M,sliceImpl:A,sparseFillEmptyRowsImpl:D,sparseReshapeImpl:R,sparseSegmentReductionImpl:F,sqrtImpl:j,stridedSliceImpl:z,stringNGramsImpl:L,stringSplitImpl:V,stringToHashBucketFastImpl:G,subImpl:B,tileImpl:W,topKImpl:U,transposeImpl:q,uniqueImpl:H}=r;t.uniqueImplCPU=H,t.transposeImplCPU=q,t.topKImplCPU=U,t.tileImplCPU=W,t.subImplCPU=B,t.stringToHashBucketFastImplCPU=G,t.stringSplitImplCPU=V,t.stringNGramsImplCPU=L,t.stridedSliceImplCPU=z,t.sqrtImplCPU=j,t.sparseSegmentReductionImplCPU=F,t.sparseReshapeImplCPU=R,t.sparseFillEmptyRowsImplCPU=D,t.sliceImplCPU=A,t.simpleAbsImplCPU=M,t.sigmoid
1ImplCPU=E,t.rsqrtImplCPU=S,t.rangeImplCPU=T,t.prodImplCPU=I,t.notEqualImplCPU=N,t.negImplCPU=O,t.multiplyImplCPU=P,t.minimumImplCPU=C,t.maximumImplCPU=_,t.maxImplCPU=k,t.logImplCPU=w,t.linSpaceImplCPU=x,t.lessEqualImplCPU=b,t.lessImplCPU=v,t.greaterEqualImplCPU=y,t.greaterImplCPU=g,t.gatherV2ImplCPU=m,t.gatherNdImplCPU=f,t.floorImplCPU=h,t.expm1ImplCPU=p,t.expImplCPU=d,t.equalImplCPU=u,t.concatImplCPU=l,t.ceilImplCPU=c,t.bincountReduceImplCPU=i,t.bincountImplCPU=s,t.addImplCPU=o},354418:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.abs=c,t.absConfig=void 0;var r=n(735534),a=n(509570),o=n(934500),s=n(721797);const i="return abs(x);";function c(e){const{inputs:t,backend:n}=e,{x:c}=t;if(n.shouldExecuteOnCPU([c])&&"complex64"!==c.dtype){const e=n.texData.get(c.dataId),t=(0,a.simpleAbsImplCPU)(e.values);return n.makeTensorInfo(c.shape,c.dtype,t)}let l;return l=(0,r.env)().getBool("WEBGL_PACK_UNARY_OPERATIONS")?new s.UnaryOpPackedProgram(c.shape,i):new o.UnaryOpProgram(c.shape,i),n.runWebGLProgram(l,[c],c.dtype)}t.absConfig={kernelName:r.Abs,backendName:"webgl",kernelFunc:c}},243635:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.acosConfig=t.acos=void 0;var r=n(735534),a=n(537925);const o=n(934500).CHECK_NAN_SNIPPET+"\n if (abs(x) > 1.) {\n return NAN;\n }\n return acos(x);\n",s=t.acos=(0,a.unaryKernelFunc)({opSnippet:o});t.acosConfig={kernelName:r.Acos,backendName:"webgl",kernelFunc:s}},901347:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.acoshConfig=t.acosh=void 0;var r=n(735534),a=n(537925);const o=n(934500).CHECK_NAN_SNIPPET+"\n if (x < 1.0) return NAN;\nreturn log(x + sqrt(x * x - 1.0));",s=t.acosh=(0,a.unaryKernelFunc)({opSnippet:o});t.acoshConfig={kernelName:r.Acosh,backendName:"webgl",kernelFunc:s}},281243:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.addKernelFunc=t.addConfig=void 0;var r=n(735534),a=n(537925),o=n(509570);const s="return a + b;",i=t.addKernelFunc=(0,a.binaryKernelFunc)({opSnippet:s,packedOpSnippet:s,supportsComplex:!0,cpuKernelImpl:o.addImplCPU});t.addConfig={kernelName:r.Add,backendName:"webgl",kernelFunc:i}},963064:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.addN=i,t.addNConfig=void 0;var r=n(735534),a=n(351629),o=n(166680),s=n(750257);function i(e){const{inputs:t,backend:n}=e,c=t;if(1===c.length)return(0,s.identity)({inputs:{x:c[0]},backend:n});if(c.length>(0,r.env)().get("WEBGL_MAX_TEXTURES_IN_SHADER")){const e=Math.floor(c.length/2),t=i({inputs:c.slice(0,e),backend:n}),r=i({inputs:c.slice(e),backend:n});return i({inputs:[t,r],backend:n})}const l=c.map((e=>e.dtype)).reduce(((e,t)=>(0,r.upcastType)(e,t))),u=c.map((e=>e.shape)),d=(0,r.env)().getBool("WEBGL_PACK")?new o.AddNPackedProgram(c[0].shape,u):new a.AddNProgram(c[0].shape,u);return n.runWebGLProgram(d,c,l)}t.addNConfig={kernelName:r.AddN,backendName:"webgl",kernelFunc:i}},258469:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.all=i,t.allConfig=void 0;var r=n(735534),a=n(531305),o=n(144638),s=n(291146);function i(e){const{inputs:t,backend:n,attrs:i}=e,{x:c}=t,{axis:l,keepDims:u}=i,d=c.shape.length,p=r.util.parseAxisParam(l,c.shape);let h=p;const f=r.backend_util.getAxesPermutation(h,d);let m=c;
1null!=f&&(m=(0,s.transpose)({inputs:{x:c},backend:n,attrs:{perm:f}}),h=r.backend_util.getInnerMostAxes(h.length,d)),r.backend_util.assertAxesAreInnerMostDims("all",h,d);const[g,y]=r.backend_util.computeOutAndReduceShapes(m.shape,h),v=r.util.sizeFromShape(y),b=(0,o.reshape)({inputs:{x:m},backend:n,attrs:{shape:[-1,v]}}),x=(0,a.reduce)(b,b.dtype,"all",n);let w;if(u){const e=r.backend_util.expandShapeToKeepDim(g,p);w=(0,o.reshape)({inputs:{x:x},backend:n,attrs:{shape:e}})}else w=(0,o.reshape)({inputs:{x:x},backend:n,attrs:{shape:g}});return n.disposeIntermediateTensorInfo(b),n.disposeIntermediateTensorInfo(x),null!=f&&n.disposeIntermediateTensorInfo(m),w}t.allConfig={kernelName:r.All,backendName:"webgl",kernelFunc:i}},459182:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.any=i,t.anyConfig=void 0;var r=n(735534),a=n(531305),o=n(144638),s=n(291146);function i(e){const{inputs:t,backend:n,attrs:i}=e,{x:c}=t,{axis:l,keepDims:u}=i,d=c.shape.length,p=r.util.parseAxisParam(l,c.shape);let h=p;const f=r.backend_util.getAxesPermutation(h,d);let m=c;
1null!=f&&(m=(0,s.transpose)({inputs:{x:c},backend:n,attrs:{perm:f}}),h=r.backend_util.getInnerMostAxes(h.length,d)),r.backend_util.assertAxesAreInnerMostDims("any",h,d);const[g,y]=r.backend_util.computeOutAndReduceShapes(m.shape,h),v=r.util.sizeFromShape(y),b=(0,o.reshape)({inputs:{x:m},backend:n,attrs:{shape:[-1,v]}}),x=(0,a.reduce)(b,b.dtype,"any",n);let w;if(u){const e=r.backend_util.expandShapeToKeepDim(g,p);w=(0,o.reshape)({inputs:{x:x},backend:n,attrs:{shape:e}})}else w=(0,o.reshape)({inputs:{x:x},backend:n,attrs:{shape:g}});return n.disposeIntermediateTensorInfo(b),n.disposeIntermediateTensorInfo(x),null!=f&&n.disposeIntermediateTensorInfo(m),w}t.anyConfig={kernelName:r.Any,backendName:"webgl",kernelFunc:i}},100747:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.argMax=s,t.argMaxConfig=void 0;var r=n(735534),a=n(36007),o=n(291146);function s(e){const{inputs:t,backend:n,attrs:s}=e,{x:i}=t,{axis:c}=s;let l=r.util.parseAxisParam(c,i.shape);const u=r.backend_util.getAxesPermutation(l,i.shape.length);let d=i;const p=[];
1null!=u&&(d=(0,o.transpose)({inputs:{x:i},backend:n,attrs:{perm:u}}),p.push(d),l=r.backend_util.getInnerMostAxes(l.length,d.shape.length)),r.backend_util.assertAxesAreInnerMostDims("argMax",[l[0]],d.shape.length);const h=(0,a.argMinMaxReduce)(n,d,l[0],"max");return p.forEach((e=>n.disposeIntermediateTensorInfo(e))),h}t.argMaxConfig={kernelName:r.ArgMax,backendName:"webgl",kernelFunc:s}},706479:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.argMin=s,t.argMinConfig=void 0;var r=n(735534),a=n(36007),o=n(291146);function s(e){const{inputs:t,backend:n,attrs:s}=e,{x:i}=t,{axis:c}=s;let l=r.util.parseAxisParam(c,i.shape);const u=r.backend_util.getAxesPermutation(l,i.shape.length);let d=i;const p=[];null!=u&&(d=(0,o.transpose)({inputs:{x:i},backend:n,attrs:{perm:u}}),p.push(d),l=r.backend_util.getInnerMostAxes(l.length,d.shape.length)),r.backend_util.assertAxesAreInnerMostDims("argMin",[l[0]],d.shape.length);const h=(0,a.argMinMaxReduce)(n,d,l[0],"min");return p.forEach((e=>n.disposeIntermediateTensorInfo(e))),h}t.argMinConfig={kernelName:r.ArgMin,backendName:"webgl",kernelFunc:s}},21068:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.asinConfig=t.asin=void 0;var r=n(735534),a=n(537925);const o=n(934500).CHECK_NAN_SNIPPET+"\n if (abs(x) > 1.) {\n return NAN;\n }\n return asin(x);\n",s=t.asin=(0,a.unaryKernelFunc)({opSnippet:o});t.asinConfig={kernelName:r.Asin,backendName:"webgl",kernelFunc:s}},969205:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.asinhConfig=t.asinh=void 0;var r=n(735534),a=n(537925);const o=n(934500).CHECK_NAN_SNIPPET+"return log(x + sqrt(x * x + 1.0));",s=t.asinh=(0,a.unaryKernelFunc)({opSnippet:o});t.asinhConfig={kernelName:r.Asinh,backendName:"webgl",kernelFunc:s}},764110:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.atanConfig=t.atan=void 0;var r=n(735534),a=n(537925);const o=n(934500).CHECK_NAN_SNIPPET+"\n return atan(x);\n",s=t.atan=(0,a.unaryKernelFunc)({opSnippet:o});t.atanConfig={kernelName:r.Atan,backendName:"webgl",kernelFunc:s}}
1,451439:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.atan2Config=t.atan2=void 0;var r=n(735534),a=n(537925);const o=a.CHECK_NAN_SNIPPET_BINARY+"\n return atan(a, b);\n",s="\n vec4 result = atan(a, b);\n vec4 isNaN = min(vec4(isnan(a)) + vec4(isnan(b)), vec4(1.0));\n "+a.CHECK_NAN_SNIPPET_BINARY_PACKED+"\n return result;\n",i=t.atan2=(0,a.binaryKernelFunc)({opSnippet:o,packedOpSnippet:s});t.atan2Config={kernelName:r.Atan2,backendName:"webgl",kernelFunc:i}},476755:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.atanhConfig=t.atanh=void 0;var r=n(735534),a=n(537925);const o=n(934500).CHECK_NAN_SNIPPET+"\n if ((x < -1.0) || (x > 1.0)) return NAN;\nreturn (log(1.0 + x) - log(1.0 - x)) / 2.0;",s=t.atanh=(0,a.unaryKernelFunc)({opSnippet:o});t.atanhConfig={kernelName:r.Atanh,backendName:"webgl",kernelFunc:s}},244728:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.avgPool=i,t.avgPoolConfig=void 0;var r=n(735534),a=n(19718),o=n(519617),s=n(750257);function i(e){const{inputs:t,backend:n,attrs:i}=e,{x:c}=t;(0,o.assertNotComplex)(c,"avgPool");const{filterSize:l,strides:u,pad:d,dimRoundingMode:p}=i;r.util.assert(r.backend_util.eitherStridesOrDilationsAreOne(u,1),(()=>"Error in avgPool: Either strides or dilations must be 1. "+"Got strides ".concat(u," and dilations '").concat(1,"'")));const h=r.backend_util.computePool2DInfo(c.shape,l,u,1,d,p);if(1===h.filterWidth&&1===h.filterHeight&&r.util.arraysEqual(h.inShape,h.outShape))return(0,s.identity)({inputs:{x:c},backend:n});const f=new a.Pool2DProgram(h,"avg",!1);return n.runWebGLProgram(f,[c],"float32")}t.avgPoolConfig={kernelName:r.AvgPool,backendName:"webgl",kernelFunc:i}},902565:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.avgPool3D=o,t.avgPool3DConfig=void 0;var r=n(735534),a=n(19718);function o(e){const{inputs:t,backend:n,attrs:o}=e,{x:s}=t,{filterSize:i,strides:c,pad:l,dimRoundingMode:u,dataFormat:d}=o,p=r.backend_util.computePool3DInfo(s.shape,i,c,[1,1,1],l,u,d),h=new a.Pool3DProgram(p,"avg",!1);return n.runWebGLProgram(h,[s],"float32")}t.avgPool3DConfig={kernelName:r.AvgPool3D,backendName:"webgl",kernelFunc:o}},976689:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.avgPool3DGrad=o,t.avgPool3DGradConfig=void 0;var r=n(735534),a=n(77764);function o(e){const{inputs:t,backend:n,attrs:o}=e,{dy:s,input:i}=t,c=i,{filterSize:l,strides:u,pad:d,dimRoundingMode:p}=o,h=r.backend_util.computePool3DInfo(c.shape,l,u,[1,1,1],d,p),f=new a.AvgPool3DBackpropProgram(h);return n.runWebGLProgram(f,[s],c.dtype)}t.avgPool3DGradConfig={kernelName:r.AvgPool3DGrad,backendName:"webgl",kernelFunc:o}},593372:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.avgPoolGrad=s,t.avgPoolGradConfig=void 0;var r=n(735534),a=n(77764),o=n(519617);function s(e){const{inputs:t,backend:n,attrs:s}=e,{dy:i,input:c}=t,l=c;(0,o.assertNotComplex)([i,c],"avgPoolGrad");const{filterSize:u,strides:d,pad:p}=s,h=r.backend_util.computePool2DInfo(l.shape,u,d,1,p),f=new a.AvgPool2DBackpropProgram(h);return n.runWebGLProgram(f,[i],l.dtype)}t.avgPoolGradConfig={kernelName:r.AvgPoolGrad,backendName:"webgl",kernelFunc:s}},795397:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.batchMatMul=o,t.batchMatMulConfig=void 0;var r=n(735534),a=n(625358);function o(e){const{inputs:t,backend:n,attrs:r}=e,{a:o,b:s}=t,{transposeA:i,transposeB:c}=r;return(0,a.batchMatMulImpl)({a:o,b:s,transposeA:i,transposeB:c,backend:n})}t.batchMatMulConfig={kernelName:r.BatchMatMul,backendName:"webgl",kernelFunc:o}},625358:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.MATMUL_SHARED_DIM_THRESHOLD=void 0,t.batchMatMulImpl=function(e){let{a:t,b:n,transposeA:d,transposeB:p,backend:h,bias:f=null,preluActivationWeights:m=null,leakyreluAlpha:g=0,activation:y=null}=e;const v=t.shape.length,b=n.shape.length,x=d?t.shape[v-2]:t.shape[v-1],w=p?n.shape[b-1]:n.shape[b-2],k=d?t.shape[v-1]:t.shape[v-2],_=p?n.shape[b-2]:n.shape[b-1],C=t.shape.slice(0,-2),P=n.shape.slice(0,-2),O=r.util.sizeFromShape(C),N=r.util.sizeFromShape(P),I=r.broadcast_util.assertAndGetBroadcastShape(t.
1shape.slice(0,-2),n.shape.slice(0,-2)).concat([k,_]);r.util.assert(x===w,(()=>"Error in matMul: inner shapes (".concat(x,") and (")+"".concat(w,") of Tensors with shapes ").concat(t.shape," and ")+"".concat(n.shape," and transposeA=").concat(d)+" and transposeB=".concat(p," must match.")));const T=d?[O,x,k]:[O,k,x],S=p?[N,_,w]:[N,w,_],E=(0,i.reshape)({inputs:{x:t},backend:h,attrs:{shape:T}}),M=(0,i.reshape)({inputs:{x:n},backend:h,attrs:{shape:S}}),A=[E,M],D=Math.max(O,N),R=d?E.shape[1]:E.shape[2],F=null!=f,j=null!=m,z="leakyrelu"===y,L=null!=y?(0,a.mapActivationToShaderProgram)(y,!0):null,V=F||j||z||null!=L;let G;if((1===k||1===_)&&R>u&&!1===V){let e=E,t=M;d&&(e=(0,l.transpose)({inputs:{x:E},backend:h,attrs:{perm:[0,2,1]}}),A.push(e)),p&&(t=(0,l.transpose)({inputs:{x:M},backend:h,attrs:{perm:[0,2,1]}}),A.push(t));const n=1===_;let r=e;1!==_&&(r=(0,i.reshape)({inputs:{x:e},backend:h,attrs:{shape:[D,R,1]}}),A.push(r));const a=1===_?2:1;let o=t;n&&(o=(0,i.reshape)({inputs:{x:t},backend:h,attrs:{shape:[D,1,R]}}),A.push(o));const u=(0,s.multiply)({inputs:{a:r,b:o},backend:h});G=(0,c.sum)({inputs:{x:u},backend:h,attrs:{axis:a,keepDims:!0}}),A.push(u)}else{const e=(0,r.upcastType)(t.dtype,n.dtype),a=new o.MatMulPackedProgram(T,S,[D,k,_],d,p,F,L,j,z),s=[E,M];if(null!=f&&s.push(f),j&&s.push(m),z){const e=h.makeTensorInfo([],"float32",r.util.createScalarValue(g,"float32"));s.push(e),A.push(e)}G=h.runWebGLProgram(a,s,e)}const B=(0,i.reshape)({inputs:{x:G},backend:h,attrs:{shape:I}});A.push(G);for(const e of A)h.disposeIntermediateTensorInfo(e);return B};var r=n(735534),a=n(537925),o=n(868472),s=n(810077),i=n(144638),c=n(926749),l=n(291146);const u=t.MATMUL_SHARED_DIM_THRESHOLD=1e3},188244:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.batchNormConfig=t.batchNorm=void 0;var r=n(735534),a=n(716833),o=n(577245);const s=e=>{let{inputs:t,backend:n,attrs:s}=e;const{x:i,mean:c,variance:l,offset:u,scale:d}=t;r.util.assert(c.shape.length===l.shape.length,(()=>"Batch normalization gradient requires mean and variance to have equal ranks.")),r.util.assert(null==u||c.shape.length===u.shape.length,(()=>"Batch normalization gradient requires mean and offset to have equal ranks.")),r.util.assert(null==d||c.shape.length===d.shape.length,(()=>"Batch normalization gradient requires mean and scale to have equal ranks."));let{varianceEpsilon:p}=s;null==p&&(p=.001);const h=[i,c,l];let f=null;null!=u&&(f=u.shape,h.push(u));let m=null;null!=d&&(m=d.shape,h.push(d));const g=(0,r.env)().getBool("WEBGL_PACK_NORMALIZATION")?new o.BatchNormPackedProgram(i.shape,c.shape,l.shape,f,m,p):new a.BatchNormProgram(i.shape,c.shape,l.shape,f,m,p);return n.runWebGLProgram(g,h,h[0].dtype)};t.batchNorm=s;t.batchNormConfig={kernelName:r.FusedBatchNorm,backendName:"webgl",kernelFunc:s}},816749:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.batchToSpaceNDConfig=t.batchToSpaceND=void 0;var r=n(735534),a=n(144638),o=n(336963),s=n(291146);const i=e=>{const{inputs:t,backend:n,attrs:i}=e,{x:c}=t,{blockShape:l,crops:u}=i;r.util.assert(c.shape.length<=4,(()=>"batchToSpaceND for rank > 4 with a WebGL backend not implemented yet"));const d=l.reduce(((e,t)=>e*t)),p=r.backend_util.getReshaped(c.shape,l,d),h=r.backend_util.getPermuted(p.length,l.length),f=r.backend_util.getReshapedPermuted(c.shape,l,d),m=r.backend_util.getSliceBeginCoords(u,l.length),g=r.backend_util.getSliceSize(f,u,l.length),y=[],v=(0,a.reshape)({inputs:{x:c},backend:n,attrs:{shape:p}}
1),b=(0,s.transpose)({inputs:{x:v},backend:n,attrs:{perm:h}}),x=(0,a.reshape)({inputs:{x:b},backend:n,attrs:{shape:f}}),w=(0,o.slice)({inputs:{x:x},backend:n,attrs:{begin:m,size:g}});return y.push(v),y.push(b),y.push(x),y.forEach((e=>n.disposeIntermediateTensorInfo(e))),w};t.batchToSpaceND=i;t.batchToSpaceNDConfig={kernelName:r.BatchToSpaceND,backendName:"webgl",kernelFunc:i}},18827:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.bincount=o,t.bincountConfig=void 0;var r=n(735534),a=n(509570);function o(e){const{inputs:t,backend:n,attrs:r}=e,{x:o,weights:s}=t,{size:i}=r,c=n.readSync(o.dataId),l=n.readSync(s.dataId),u=(0,a.bincountImplCPU)(c,l,s.dtype,s.shape,i);return n.makeTensorInfo([i],s.dtype,u)}t.bincountConfig={kernelName:r.Bincount,backendName:"webgl",kernelFunc:o}},846504:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.broadcastArgs=a,t.broadcastArgsConfig=void 0;var r=n(735534);function a(e){const{inputs:t,backend:n}=e,{s0:a,s1:o}=t,s=n.readSync(a.dataId),i=n.readSync(o.dataId),c=r.backend_util.assertAndGetBroadcastShape(Array.from(s),Array.from(i));return n.makeTensorInfo([c.length],"int32",Int32Array.from(c))}t.broadcastArgsConfig={kernelName:r.BroadcastArgs,backendName:"webgl",kernelFunc:a}},682879:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.cast=d,t.castConfig=void 0;var r=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=u(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if("default"!==o&&{}.hasOwnProperty.call(e,o)){var s=a?Object.getOwnPropertyDescriptor(e,o):null;s&&(s.get||s.set)?Object.defineProperty(r,o,s):r[o]=e[o]}return r.default=e,n&&n.set(e,r),r}(n(735534)),a=r,o=n(63255),s=n(750257),i=n(731579),c=n(723295),l=n(880533);function u(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(u=function(e){return e?n:t})(e)}function d(e){const{inputs:t,backend:n,attrs:u}=e,{x:p}=t,{dtype:h}=u;if("complex64"===h){if("complex64"===p.dtype)return(0,s.identity)({inputs:{x:p},backend:n});const e=a.zeros(p.shape),t=d({inputs:{x:p},backend:n,attrs:{dtype:"float32"}}),r=(0,o.complex)({inputs:{real:t,imag:e},backend:n});return e.dispose(),n.disposeIntermediateTensorInfo(t),r}
1if("complex64"===p.dtype){const e=(0,c.real)({inputs:{input:p},backend:n}),t=d({inputs:{x:e},backend:n,attrs:{dtype:h}});return n.disposeIntermediateTensorInfo(e),t}if(!r.util.hasEncodingLoss(p.dtype,h)){const e=(0,s.identity)({inputs:{x:p},backend:n});return{dataId:e.dataId,shape:e.shape,dtype:h}}if("int32"===h)return(0,l.int)(p,n);if("bool"===h){const e=n.makeTensorInfo([],"bool",r.util.getTypedArrayFromDType("bool",1)),t={a:p,b:e},a=(0,i.notEqual)({inputs:t,backend:n});return n.disposeIntermediateTensorInfo(e),a}throw new Error("Error in Cast: failed to cast ".concat(p.dtype," to ").concat(h))}t.castConfig={kernelName:r.Cast,backendName:"webgl",kernelFunc:d}},733326:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ceilConfig=t.ceil=void 0;var r=n(735534),a=n(537925),o=n(509570);const s="return ceil(x);",i=t.ceil=(0,a.unaryKernelFunc)({opSnippet:s,packedOpSnippet:s,cpuKernelImpl:o.ceilImplCPU});t.ceilConfig={kernelName:r.Ceil,backendName:"webgl",kernelFunc:i}},680518:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.clipByValue=s,t.clipByValueConfig=void 0;var r=n(735534),a=n(945460),o=n(381411);function s(e){const{inputs:t,backend:n,attrs:s}=e,{x:i}=t,{clipValueMin:c,clipValueMax:l}=s;let u;u=(0,r.env)().getBool("WEBGL_PACK_CLIP")?new o.ClipPackedProgram(i.shape):new a.ClipProgram(i.shape);const d=[[c],[l]];return n.runWebGLProgram(u,[i],i.dtype,d)}t.clipByValueConfig={kernelName:r.ClipByValue,backendName:"webgl",kernelFunc:s}},63255:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.complex=o,t.complexConfig=void 0;var r=n(735534),a=n(750257);function o(e){const{inputs:t,backend:n}=e,{real:r,imag:o}=t,s=n.makeTensorInfo(r.shape,"complex64"),i=n.texData.get(s.dataId),c=(0,a.identity)({inputs:{x:r},backend:n}),l=(0,a.identity)({inputs:{x:o},backend:n});return i.complexTensorInfos={real:c,imag:l},s}t.complexConfig={kernelName:r.Complex,backendName:"webgl",kernelFunc:o}},10266:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.complexAbs=s,t.complexAbsConfig=void 0;var r=n(735534),a=n(925793);function o(e,t){return{dataId:t.dataId,dtype:t.dtype,shape:e.shape}}function s(e){const{inputs:t,backend:n}=e,{x:r}=t,s=n.texData.get(r.dataId),i=new a.ComplexAbsProgram(r.shape),c=[o(r,s.complexTensorInfos.real),o(r,s.complexTensorInfos.imag)];return n.runWebGLProgram(i,c,c[0].dtype)}t.complexAbsConfig={kernelName:r.ComplexAbs,backendName:"webgl",kernelFunc:s}},555022:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.concat=s,t.concatConfig=void 0;var r=n(735534),a=n(350976),o=n(750257);function s(e){const{inputs:t,backend:n,attrs:s}=e,{axis:i}=s,c=r.util.parseAxisParam(i,t[0].shape)[0],l=r.backend_util.computeOutShape(t.map((e=>e.shape)),c);if(0===r.util.sizeFromShape(l))return n.makeTensorInfo(l,t[0].dtype,[]);const u=t.filter((e=>r.util.sizeFromShape(e.shape)>0));if(1===u.length)return(0,o.identity)({inputs:{x:u[0]},backend:n});const d=u.map((e=>e.shape));return r.backend_util.assertParamsConsistent(d,c),(0,a.concatImpl)(u,c,n)}t.concatConfig={kernelName:r.Concat,backendName:"webgl",kernelFunc:s}},350976:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.concatImpl=function e(t,n,d){const p=t[0].dtype;if("complex64"===p){const r=t.map((e=>
1(0,l.real)({inputs:{input:e},backend:d}))),a=t.map((e=>(0,c.imag)({inputs:{input:e},backend:d}))),o=e(r,n,d),s=e(a,n,d),u=(0,i.complex)({inputs:{real:o,imag:s},backend:d});return r.forEach((e=>d.disposeIntermediateTensorInfo(e))),a.forEach((e=>d.disposeIntermediateTensorInfo(e))),d.disposeIntermediateTensorInfo(o),d.disposeIntermediateTensorInfo(s),u}let h=d.shouldExecuteOnCPU(t);"string"===p&&(h=!0);if(h){const e=t.map((e=>{const t=[-1,r.util.sizeFromShape(e.shape.slice(n))];return(0,u.reshape)({inputs:{x:e},backend:d,attrs:{shape:t}})})),a=e.map((e=>({vals:d.readSync(e.dataId),shape:e.shape}))),o=r.backend_util.computeOutShape(e.map((e=>e.shape)),1),i=1===e[0].shape[0],c=(0,s.concatImplCPU)(a,o,p,i),l=r.backend_util.computeOutShape(t.map((e=>e.shape)),n),h=d.makeTensorInfo(l,p,c);return e.forEach((e=>d.disposeIntermediateTensorInfo(e))),h}if(t.length>(0,r.env)().getNumber("WEBGL_MAX_TEXTURES_IN_SHADER")){const r=Math.floor(t.length/2),a=e(t.slice(0,r),n,d),o=e(t.slice(r),n,d),s=e([a,o],n,d);return d.disposeIntermediateTensorInfo(a),d.disposeIntermediateTensorInfo(o),s}if((0,r.env)().getBool("WEBGL_PACK_ARRAY_OPERATIONS")&&t[0].shape.length>1){const e=new o.ConcatPackedProgram(t.map((e=>e.shape)),n);return d.runWebGLProgram(e,t,p)}const{tensors2D:f,outShape:m}=function(e,t,n){const a=r.backend_util.computeOutShape(e.map((e=>e.shape)),t),o=e.map((e=>(0,u.reshape)({inputs:{x:e},attrs:{shape:[-1,r.util.sizeFromShape(e.shape.slice(t))]},backend:n})));return{tensors2D:o,outShape:a}}(t,n,d),g=new a.ConcatProgram(f.map((e=>e.shape))),y=d.runWebGLProgram(g,f,p);f.forEach((e=>d.disposeIntermediateTensorInfo(e)));const v=(0,u.reshape)({inputs:{x:y},attrs:{shape:m},backend:d});return d.disposeIntermediateTensorInfo(y),v};var r=n(735534),a=n(805371),o=n(455654),s=n(509570),i=n(63255),c=n(859559),l=n(723295),u=n(144638)},505759:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.conv2DConfig=void 0,t.conv2d=i;var r=n(735534),a=n(811213),o=n(803437),s=n(144638);function i(e){const{inputs:t,backend:n,attrs:i}=e,{x:c,filter:l}
1=t,{strides:u,pad:d,dataFormat:p,dilations:h,dimRoundingMode:f}=i,m=r.backend_util.convertConv2DDataFormat(p),g=r.backend_util.computeConv2DInfo(c.shape,l.shape,u,h,d,f,!1,m);let y;if(1!==g.filterHeight||1!==g.filterWidth||1!==g.dilationHeight||1!==g.dilationWidth||1!==g.strideHeight||1!==g.strideWidth||"SAME"!==g.padInfo.type&&"VALID"!==g.padInfo.type)if((0,r.env)().getBool("WEBGL_CONV_IM2COL")&&1===c.shape[0])y=(0,o.conv2dWithIm2Row)({x:c,filter:l,convInfo:g,backend:n});else{const e=new a.Conv2DProgram(g);y=n.runWebGLProgram(e,[c,l],"float32")}else y=(0,o.conv2dByMatMul)({x:c,filter:l,convInfo:g,backend:n});const v=(0,s.reshape)({inputs:{x:y},backend:n,attrs:{shape:g.outShape}});return n.disposeIntermediateTensorInfo(y),v}t.conv2DConfig={kernelName:r.Conv2D,backendName:"webgl",kernelFunc:i}},67774:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.conv2DBackpropFilter=o,t.conv2DBackpropFilterConfig=void 0;var r=n(735534),a=n(811800);function o(e){const{inputs:t,backend:n,attrs:o}=e,{x:s,dy:i}=t,{strides:c,pad:l,dataFormat:u,dimRoundingMode:d,filterShape:p}=o,h=r.backend_util.convertConv2DDataFormat(u),f=r.backend_util.computeConv2DInfo(s.shape,p,c,1,l,d,!1,h),m=new a.Conv2DDerFilterProgram(f);return n.runWebGLProgram(m,[s,i],"float32")}t.conv2DBackpropFilterConfig={kernelName:r.Conv2DBackpropFilter,backendName:"webgl",kernelFunc:o}},96365:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.conv2DBackpropInput=o,t.conv2DBackpropInputConfig=void 0;var r=n(735534),a=n(811800);function o(e){const{inputs:t,backend:n,attrs:o}=e,{dy:s,filter:i}=t,{inputShape:c,strides:l,pad:u,dataFormat:d,dimRoundingMode:p}=o,h=r.backend_util.convertConv2DDataFormat(d),f=r.backend_util.computeConv2DInfo(c,i.shape,l,1,u,p,!1,h),m=new a.Conv2DDerInputProgram(f);return n.runWebGLProgram(m,[s,i],"float32")}t.conv2DBackpropInputConfig={kernelName:r.Conv2DBackpropInput,backendName:"webgl",kernelFunc:o}},803437:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.conv2dByMatMul=function(e){let{x:t,filter:n,convInfo:a,backend:o,bias:s=null,preluActivationWeights:d=null,leakyreluAlpha:p=0,activation:h=null}=e;const f=t.shape,m=o.texData.get(t.dataId),g=a.inChannels,y=f[0]*f[1]*f[2],v=a.outChannels,b="channelsLast"===a.dataFormat,x=!1,w=!1;let k;const _=[],C=(1===y||1===v)&&g>c.MATMUL_SHARED_DIM_THRESHOLD;if(!C&&m.isPacked&&b&&null!=m.texture&&f[2]%2!=0&&r.util.arraysEqual(m.shape.slice(-3),f.slice(-3))){const e=f[0]*f[1]*(f[2]+1),g={dataId:t.dataId,shape:[1,e,a.inChannels],dtype:t.dtype},y=m.shape;m.shape=m.shape.slice(),m.shape[m.shape.length-2]++,r.util.assert(i.isReshapeFree(m.shape,g.shape),(()=>"packed reshape ".concat(m.shape," to ").concat(g.shape," isn't free")));const v=(0,u.reshape)({inputs:{x:n},backend:o,attrs:{shape:[1,a.inChannels,a.outChannels]}});_.push(v);const b=(0,c.batchMatMulImpl)({a:g,b:v,backend:o,transposeA:x,transposeB:w,bias:s,activation:h,preluActivationWeights:d,leakyreluAlpha:p}),C=o.texData.get(b.dataId);r.util.assert(C.isPacked,(()=>"batchMatMul result is expected to be packed")),m.shape=y,C.shape=a.outShape,k=(0,l.identity)({inputs:{x:b},backend:o}),k.shape=a.outShape,_.push(b)}else{const e=b?f[0]*f[1]*f[2]:f[0]*f[2]*f[3],r=(0,u.reshape)({inputs:{x:t},backend:o,attrs:{shape:[1,e,a.inChannels]}}),i=(0,u.reshape)({inputs:{x:n},backend:o,attrs:{shape:[1,a.inChannels,a.outChannels]}}),l=(0,c.batchMatMulImpl)({a:r,b:i,transposeA:x,transposeB:w,backend:o,bias:s,activation:h,preluActivationWeights:d,leakyreluAlpha:p});k=(0,u.reshape)({inputs:{x:l},backend:o,attrs:{shape:a.outShape}}),_.push(r),_.push(i),_.push(l)}for(const e of _)o.disposeIntermediateTensorInfo(e);return k},t.conv2dWithIm2Row=function(e){let{x:t,filter:n,convInfo:i,backend:c,bias:l=null,preluActivationWeights:d=null,leakyreluAlpha:p=0,activation:h=null}=e;const{filterWidth:f,filterHeight:m,inChannels:g,outWidth:y,outHeight:v,dataFormat:b}=i,x="channelsLast"===b,w=f*m*g,k=v*y,_=[w,k],C=[],P=(0,u.reshape)({inputs:{x:t},backend:c,attrs:{shape:t.shape.slice(1)}}),O=(0,u.reshape)({inputs:{x:n},backend:c,attrs:{shape:[1,w,r.util.sizeFromShape(n.shape)/w]}});C.push(P),C.push(O);
1const N=new a.Im2ColPackedProgram(_,i),I=[P.shape,[i.padInfo.top,i.padInfo.left],[i.strideHeight,i.strideWidth],[i.dilationHeight,i.dilationWidth],[i.inChannels],[i.filterWidth*i.inChannels],[i.outWidth]],T=c.runWebGLProgram(N,[P],"float32",I),S=(0,u.reshape)({inputs:{x:T},backend:c,attrs:{shape:[1,_[0],_[1]]}});C.push(T),C.push(S);const E=null!=l,M=null!=d,A="leakyrelu"===h,D=h?(0,o.mapActivationToShaderProgram)(h,!0):null,R=new s.MatMulPackedProgram(S.shape,O.shape,[1,k,i.outChannels],!0,!1,E,D,M,A),F=[S,O];l&&F.push(l);M&&F.push(d);if(A){const e=c.makeTensorInfo([],"float32",r.util.createScalarValue(p,"float32"));F.push(e),C.push(e)}const j=c.runWebGLProgram(R,F,"float32"),z=x?[1,v,y,i.outChannels]:[1,i.outChannels,v,y],L=(0,u.reshape)({inputs:{x:j},backend:c,attrs:{shape:z}});C.push(j);for(const e of C)c.disposeIntermediateTensorInfo(e);return L};var r=n(735534),a=n(27582),o=n(537925),s=n(868472),i=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=d(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if("default"!==o&&{}.hasOwnProperty.call(e,o)){var s=a?Object.getOwnPropertyDescriptor(e,o):null;s&&(s.get||s.set)?Object.defineProperty(r,o,s):r[o]=e[o]}return r.default=e,n&&n.set(e,r),r}(n(519617)),c=n(625358),l=n(750257),u=n(144638);function d(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(d=function(e){return e?n:t})(e)}},932997:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.conv3D=o,t.conv3DConfig=void 0;var r=n(735534),a=n(811213);function o(e){const{inputs:t,backend:n,attrs:o}=e,{x:s,filter:i}=t,{strides:c,pad:l,dilations:u}=o,d=r.backend_util.computeConv3DInfo(s.shape,i.shape,c,u,l),p=new a.Conv3DProgram(d);return n.runWebGLProgram(p,[s,i],"float32")}t.conv3DConfig={kernelName:r.Conv3D,backendName:"webgl",kernelFunc:o}},605516:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.conv3DBackpropFilterV2=o,t.conv3DBackpropFilterV2Config=void 0;var r=n(735534),a=n(811800);function o(e){const{inputs:t,backend:n,attrs:o}=e,{x:s,dy:i}=t,{strides:c,pad:l,filterShape:u}=o,d=r.backend_util.computeConv3DInfo(s.shape,u,c,1,l),p=new a.Conv3DDerFilterProgram(d);return n.runWebGLProgram(p,[s,i],"float32")}t.conv3DBackpropFilterV2Config={kernelName:r.Conv3DBackpropFilterV2,backendName:"webgl",kernelFunc:o}},690426:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.conv3DBackpropInput=o,t.conv3DBackpropInputConfig=void 0;var r=n(735534),a=n(811800);function o(e){const{inputs:t,backend:n,attrs:o}=e,{dy:s,filter:i}=t,{pad:c,strides:l,inputShape:u}=o,d=r.backend_util.computeConv3DInfo(u,i.shape,l,1,c),p=new a.Conv3DDerInputProgram(d);return n.runWebGLProgram(p,[s,i],"float32")}t.conv3DBackpropInputConfig={kernelName:r.Conv3DBackpropInputV2,backendName:"webgl",kernelFunc:o}},373619:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.cosConfig=t.cos=void 0;var r=n(735534),a=n(537925);const o=a.CHECK_NAN_SNIPPET_UNARY+"\n return cos(x);\n",s=t.cos=(0,a.unaryKernelFunc)({opSnippet:o});t.cosConfig={kernelName:r.Cos,backendName:"webgl",kernelFunc:s}},592334:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.coshConfig=t.cosh=void 0;var r=n(735534),a=n(537925);const o=t.cosh=(0,a.unaryKernelFunc)({opSnippet:"\n float e2x = exp(-x);\n return (e2x + 1.0 / e2x) / 2.0;\n"});t.coshConfig={kernelName:r.Cosh,backendName:"webgl",kernelFunc:o}},250714:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.cropAndResizeConfig=t.cropAndResize=void 0;var r=n(735534),a=n(19300);const o=e=>{const{inputs:t,backend:n,attrs:r}=e,{image:o,boxes:s,boxInd:i}=t,{cropSize:c,method:l,extrapolationValue:u}=r,d=new a.CropAndResizeProgram(o.shape,s.shape,c,l,u);return n.runWebGLProgram(d,[o,s,i],"float32")};t.cropAndResize=o;t.cropAndResizeConfig={kernelName:r.CropAndResize,backendName:"webgl",kernelFunc:o}},796260:(e,t,n)=>{"use strict";
1Object.defineProperty(t,"__esModule",{value:!0}),t.cumsum=i,t.cumsumConfig=void 0;var r=n(735534),a=n(997330),o=n(750257),s=n(291146);function i(e){const{inputs:t,backend:n,attrs:i}=e,{x:c}=t,{axis:l,exclusive:u,reverse:d}=i,p=c.shape.length,h=r.backend_util.getAxesPermutation([l],p);let f=c;null!=h&&(f=(0,s.transpose)({inputs:{x:c},backend:n,attrs:{perm:h}}));const m=r.backend_util.getInnerMostAxes(1,p)[0];if(m!==p-1)throw new Error("WebGL cumsum shader expects an inner-most axis=".concat(c.shape.length-1," ")+"but got axis=".concat(l));const g=f.shape[m];let y=(0,o.identity)({inputs:{x:f},backend:n});for(let e=0;e<=Math.ceil(Math.log2(g))-1;e++){const t=new a.CumSumProgram(f.shape,!1,d),r=[[e]],o=y;y=n.runWebGLProgram(t,[y],y.dtype,r),n.disposeIntermediateTensorInfo(o)}if(u){const e=new a.CumSumProgram(f.shape,u,d),t=y;y=n.runWebGLProgram(e,[y],y.dtype),n.disposeIntermediateTensorInfo(t)}if(null!=h){const e=r.backend_util.getUndoAxesPermutation(h),t=(0,s.transpose)({inputs:{x:y},backend:n,attrs:{perm:e}});return n.disposeIntermediateTensorInfo(y),n.disposeIntermediateTensorInfo(f),t}return y}t.cumsumConfig={kernelName:r.Cumsum,backendName:"webgl",kernelFunc:i}},975169:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.denseBincount=o,t.denseBincountConfig=void 0;var r=n(735534),a=n(509570);function o(e){const{inputs:t,backend:n,attrs:r}=e,{x:o,weights:s}=t,{size:i,binaryOutput:c}=r;if(1===o.shape.length){const e=n.readSync(o.dataId),t=n.readSync(s.dataId),r=(0,a.bincountImplCPU)(e,t,s.dtype,s.shape,i);return n.makeTensorInfo([i],s.dtype,r)}if(2===o.shape.length){const e=n.bufferSync(o),t=n.bufferSync(s),r=(0,a.bincountReduceImplCPU)(e,t,i,c);return n.makeTensorInfo(r.shape,s.dtype,r.values)}throw new Error("Error in denseBincount: input must be at most rank 2, but got rank"+"".concat(o.shape.length,"."))}t.denseBincountConfig={kernelName:r.DenseBincount,backendName:"webgl",kernelFunc:o}},312887:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.depthToSpace=o,t.depthToSpaceConfig=void 0;var r=n(735534),a=n(659140);function o(e){const{inputs:t,backend:n,attrs:r}=e,{x:o}=t,{blockSize:s,dataFormat:i}=r,c=o.shape[0],l=("NHWC"===i?o.shape[1]:o.shape[2])*s,u=("NHWC"===i?o.shape[2]:o.shape[3])*s,d=("NHWC"===i?o.shape[3]:o.shape[1])/(s*s),p="NHWC"===i?[c,l,u,d]:[c,d,l,u],h=new a.DepthToSpaceProgram(p,s,i);return n.runWebGLProgram(h,[o],o.dtype)}t.depthToSpaceConfig={kernelName:r.DepthToSpace,backendName:"webgl",kernelFunc:o}},947041:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.depthwiseConv2dNative=s,t.depthwiseConv2dNativeConfig=void 0;var r=n(735534),a=n(73168),o=n(318263);function s(e){const{inputs:t,backend:n,attrs:s}=e,{x:i,filter:c}=t,{strides:l,pad:u,dilations:d,dimRoundingMode:p}=s;let h=d;null==h&&(h=[1,1]),r.util.assert(r.backend_util.eitherStridesOrDilationsAreOne(l,h),(()=>"Error in depthwiseConv2d: Either strides or dilations must be "+"1. Got strides ".concat(l," and dilations '").concat(h,"'")));const f=r.backend_util.computeConv2DInfo(i.shape,c.shape,l,h,u,p,!0);let m;m=(0,r.env)().getBool("WEBGL_PACK_DEPTHWISECONV")&&f.strideWidth<=2&&f.outChannels/f.inChannels==1?new o.DepthwiseConvPacked2DProgram(f):new a.DepthwiseConv2DProgram(f);const g=[[f.padInfo.top,f.padInfo.left],[f.strideHeight,f.strideWidth],[f.dilationHeight,f.dilationWidth],[f.inHeight,f.inWidth]];return n.runWebGLProgram(m,[i,c],"float32",g)}t.depthwiseConv2dNativeConfig={kernelName:r.DepthwiseConv2dNative,backendName:"webgl",kernelFunc:s}},914173:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.depthwiseConv2dNativeBackpropFilter=o,t.depthwiseConv2dNativeBackpropFilterConfig=void 0;var r=n(735534),a=n(804605);function o(e){const{inputs:t,backend:n,attrs:o}=e,{x:s,dy:i}=t,{strides:c,dilations:l,pad:u,dimRoundingMode:d,filterShape:p}=o,h=r.backend_util.computeConv2DInfo(s.shape,p,c,l,u,d,!0),f=new a.DepthwiseConv2DDerFilterProgram(h);return n.runWebGLProgram(f,[s,i],"float32")}t.depthwiseConv2dNativeBackpropFilterConfig={kernelName:r.DepthwiseConv2dNativeBackpropFilter,backendName:"webgl",kernelFunc:o}},612330:(e,t,n)=>{"use strict";
1Object.defineProperty(t,"__esModule",{value:!0}),t.depthwiseConv2dNativeBackpropInput=o,t.depthwiseConv2dNativeBackpropInputConfig=void 0;var r=n(735534),a=n(804605);function o(e){const{inputs:t,backend:n,attrs:o}=e,{dy:s,filter:i}=t,{strides:c,dilations:l,pad:u,dimRoundingMode:d,inputShape:p}=o,h=r.backend_util.computeConv2DInfo(p,i.shape,c,l,u,d,!0),f=new a.DepthwiseConv2DDerInputProgram(h);return n.runWebGLProgram(f,[s,i],"float32")}t.depthwiseConv2dNativeBackpropInputConfig={kernelName:r.DepthwiseConv2dNativeBackpropInput,backendName:"webgl",kernelFunc:o}},308838:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.diag=s,t.diagConfig=void 0;var r=n(735534),a=n(903131),o=n(144638);function s(e){const{inputs:t,backend:n}=e,{x:s}=t,i=[...s.shape,...s.shape],c=r.util.sizeFromShape(s.shape),l=(0,o.reshape)({inputs:{x:s},backend:n,attrs:{shape:[c]}}),u=new a.DiagProgram(c),d=n.runWebGLProgram(u,[l],l.dtype),p=(0,o.reshape)({inputs:{x:d},backend:n,attrs:{shape:i}});return n.disposeIntermediateTensorInfo(l),n.disposeIntermediateTensorInfo(d),p}t.diagConfig={kernelName:r.Diag,backendName:"webgl",kernelFunc:s}},426273:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.dilation2D=s,t.dilation2DConfig=void 0;var r=n(735534),a=n(506644),o=n(144638);function s(e){const{inputs:t,backend:n,attrs:s}=e,{x:i,filter:c}=t,{strides:l,pad:u,dilations:d}=s,p=r.backend_util.computeDilation2DInfo(i.shape,c.shape,l,u,"NHWC",d);let h;const f=new a.Dilation2DProgram(p);h=n.runWebGLProgram(f,[i,c],"float32");const m=(0,o.reshape)({inputs:{x:h},backend:n,attrs:{shape:p.outShape}});return n.disposeIntermediateTensorInfo(h),m}t.dilation2DConfig={kernelName:r.Dilation2D,backendName:"webgl",kernelFunc:s}},278663:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.einsum=c,t.einsumConfig=void 0;var r=n(735534),a=n(810077),o=n(144638),s=n(926749),i=n(291146);function c(e){const{inputs:t,backend:n,attrs:c}=e,{equation:l}=c,u=t,{allDims:d,summedDims:p,idDims:h}=r.backend_util.decodeEinsumEquation(l,u.length);r.backend_util.checkEinsumDimSizes(d.length,h,u);const{path:f,steps:m}=r.backend_util.getEinsumComputePath(p,h),g=m.length;let y=null,v=d.length;const b=[];for(let e=0;e<g;++e){for(const t of m[e]){const{permutationIndices:e,expandDims:s}=r.backend_util.getEinsumPermutation(v,h[t]);let c;r.backend_util.isIdentityPermutation(e)?c=u[t]:(c=(0,i.transpose)({input
1s:{x:u[t]},backend:n,attrs:{perm:e}}),b.push(c));const l=c.shape.slice();for(let e=0;e<s.length;++e)l.splice(s[e],0,1);r.util.arraysEqual(c.shape,l)||(c=(0,o.reshape)({inputs:{x:c},backend:n,attrs:{shape:l}}),b.push(c)),null===y?y=c:(y=(0,a.multiply)({inputs:{a:c,b:y},backend:n}),b.push(y))}e<g-1&&(f[e]>=0&&(y=(0,s.sum)({inputs:{x:y},backend:n,attrs:{axis:f[e]-(d.length-v),keepDims:!1}}),b.push(y)),v--)}for(const e of b)e!==y&&n.disposeIntermediateTensorInfo(e);return y}t.einsumConfig={kernelName:r.Einsum,backendName:"webgl",kernelFunc:c}},212138:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.eluConfig=void 0;var r=n(735534);const a=(0,n(537925).unaryKernelFunc)({opSnippet:"return (x >= 0.0) ? x : (exp(x) - 1.0);",packedOpSnippet:"\n vec4 result;\n\n result.r = (x.r >= 0.0) ? x.r : (exp(x.r) - 1.0);\n result.g = (x.g >= 0.0) ? x.g : (exp(x.g) - 1.0);\n result.b = (x.b >= 0.0) ? x.b : (exp(x.b) - 1.0);\n result.a = (x.a >= 0.0) ? x.a : (exp(x.a) - 1.0);\n\n return result;\n"});t.eluConfig={kernelName:r.Elu,backendName:"webgl",kernelFunc:a}},158489:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.eluGradConfig=t.eluGrad=void 0;var r=n(735534),a=n(386960),o=n(215872);const s=e=>{const{inputs:t,backend:n}=e,{dy:s,y:i}=t,c=(0,r.env)().getBool("WEBGL_PACK_BINARY_OPERATIONS")?new o.BinaryOpPackedProgram("\n vec4 bGTEZero = vec4(greaterThanEqual(b, vec4(0.)));
1\n return (bGTEZero * a) + ((vec4(1.0) - bGTEZero) * (a * (b + vec4(1.0))));\n",s.shape,i.shape):new a.BinaryOpProgram("return (b >= 1.0) ? a : a * (b + 1.0);",s.shape,i.shape);return n.runWebGLProgram(c,[s,i],s.dtype)};t.eluGrad=s;t.eluGradConfig={kernelName:r.EluGrad,backendName:"webgl",kernelFunc:s}},498948:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.equalConfig=t.equal=void 0;var r=n(735534),a=n(537925),o=n(509570);const s=t.equal=(0,a.binaryKernelFunc)({opSnippet:"return float(a == b);",packedOpSnippet:"\n return vec4(equal(a, b));\n",dtype:"bool",cpuKernelImpl:o.equalImplCPU});t.equalConfig={kernelName:r.Equal,backendName:"webgl",kernelFunc:s}},319903:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.erfConfig=t.erf=void 0;var r=n(735534),a=n(537925);const o='\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 = '.concat(r.backend_util.ERF_P,";\n float a1 = ").concat(r.backend_util.ERF_A1,";\n float a2 = ").concat(r.backend_util.ERF_A2,";\n float a3 = ").concat(r.backend_util.ERF_A3,";\n float a4 = ").concat(r.backend_util.ERF_A4,";\n float a5 = ").concat(r.backend_util.ERF_A5,";\n\n float sign = sign(x);\n x = abs(x);\n float t = 1.0 / (1.0 + p * x);\n return sign * (1.0 - (((((a5*t + a4)*t) + a3)*t + a2)*t + a1)*t*exp(-x*x));\n"),s=t.erf=(0,a.unaryKernelFunc)({opSnippet:o});t.erfConfig={kernelName:r.Erf,backendName:"webgl",kernelFunc:s}},538596:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.expConfig=t.exp=t.EXP=void 0;var r=n(735534),a=n(537925),o=n(509570);const s=t.EXP=a.CHECK_NAN_SNIPPET_UNARY+"\n return exp(x);\n",i=t.exp=(0,a.unaryKernelFunc)({opSnippet:s,packedOpSnippet:"\n vec4 result = exp(x);\n bvec4 isNaN = isnan(x);\n result.r = isNaN.r ? x.r : result.r;\n result.g = isNaN.g ? x.g : result.g;\n result.b = isNaN.b ? x.b : result.b;\n result.a = isNaN.a ? x.a : result.a;\n\n return result;\n",cpuKernelImpl:o.expImplCPU,dtype:"float32"});t.expConfig={kernelName:r.Exp,backendName:"webgl",kernelFunc:i}},802175:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.expandDims=o,t.expandDimsConfig=void 0;var r=n(735534),a=n(144638);function o(e){const{inputs:t,attrs:n,backend:o}=e,{dim:s}=n,{input:i}=t,c=i.shape.length,l=i.shape.slice();let u=s;return s<0&&(r.util.assert(-(c+1)<=s,(()=>"Axis must be in the interval [".concat(-(c+1),", ").concat(c,"]"))),u=c+s+1),l.splice(u,0,1),(0,a.reshape)({inputs:{x:i},backend:o,attrs:{shape:l}})}t.expandDimsConfig={kernelName:r.ExpandDims,backendName:"webgl",kernelFunc:o}},949315:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.expm1Config=t.expm1=void 0;var r=n(735534),a=n(537925),o=n(509570);const s="return exp(x) - 1.0;",i=t.expm1=(0,a.unaryKernelFunc)({opSnippet:s,packedOpSnippet:s,cpuKernelImpl:o.expm1ImplCPU});t.expm1Config={kernelName:r.Expm1,backendName:"webgl",kernelFunc:i}},395779:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.fft=o,t.fftConfig=void 0;var r=n(735534),a=n(679835);function o(e){const{inputs:t,backend:n}=e,{input:r}=t;return(0,a.fftImpl)(r,!1,n)}t.fftConfig={kernelName:r.FFT,backendName:"webgl",kernelFunc:o}},679835:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.fftImpl=function(e,t,n){const i=n.texData.get(e.dataId),c=r.util.sizeFromShape(e.shape),l=e.shape[e.shape.length-1],u=c/l,d=(0,s.reshape)({inputs:{x:e},backend:n,attrs:{shape:[u,l]}}),p=d.shape,h=new a.FFTProgram("real",p,t),f=new a.FFTProgram("imag",p,t),m=[{dataId:i.complexTensorInfos.real.dataId,dtype:i.complexTensorInfos.real.dtype,shape:p},{dataId:i.complexTensorInfos.imag.dataId,dtype:i.complexTensorInfos.imag.dtype,shape:p}],g=n.runWebGLProgram(h,m,"float32"),y=n.runWebGLProgram(f,m,"float32"),v=(0,o.complex)({inputs:{real:g,imag:y},backend:n});n.disposeIntermediateTensorInfo(g),n.disposeIntermediateTensorInfo(y);
1const b=(0,s.reshape)({inputs:{x:v},backend:n,attrs:{shape:e.shape}});return n.disposeIntermediateTensorInfo(d),n.disposeIntermediateTensorInfo(v),b};var r=n(735534),a=n(304876),o=n(63255),s=n(144638)},531075:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.fill=o,t.fillConfig=void 0;var r=n(735534),a=n(88743);function o(e){const{backend:t,attrs:n}=e,{shape:o,value:s}=n;let{dtype:i}=n;if(i=i||r.util.inferDtype(s),"string"===i){const e=r.util.getArrayFromDType(i,r.util.sizeFromShape(o));return e.fill(s),t.makeTensorInfo(o,i,e)}{const e=new a.FillProgram(o,s),n=[[s]];return t.runWebGLProgram(e,[],i,n)}}t.fillConfig={kernelName:r.Fill,backendName:"webgl",kernelFunc:o}},684087:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.flipLeftRightConfig=void 0;var r=n(735534),a=n(606319);t.flipLeftRightConfig={kernelName:r.FlipLeftRight,backendName:"webgl",kernelFunc:e=>{let{inputs:t,backend:n}=e;const{image:r}=t,o=n,s=new a.FlipLeftRightProgram(r.shape);return o.runWebGLProgram(s,[r],r.dtype)}}},754224:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.floorConfig=t.floor=void 0;var r=n(735534),a=n(537925),o=n(509570);const s="return floor(x);",i=t.floor=(0,a.unaryKernelFunc)({opSnippet:s,packedOpSnippet:s,cpuKernelImpl:o.floorImplCPU});t.floorConfig={kernelName:r.Floor,backendName:"webgl",kernelFunc:i}},694524:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.floorDivConfig=t.floorDiv=void 0;var r=n(735534),a=n(537925);const o=t.floorDiv=(0,a.binaryKernelFunc)({opSnippet:"\n float s = sign(a) * sign(b);\n int ia = round(a);\n int ib = round(b);\n if (ib != 0) {\n // Windows (D3D) wants guaranteed non-zero int division at compile-time.\n return float(idiv(ia, ib, s));\n } else {\n return NAN;\n }\n",packedOpSnippet:"\n ivec4 ia = round(a);\n ivec4 ib = round(b);\n bvec4 cond = notEqual(ib, ivec4(0));\n ivec4 result = ivec4(0);\n vec4 s = sign(a) * sign(b);\n\n // Windows (D3D) wants guaranteed non-zero int division at compile-time.\n if (cond[0]) {\n result[0] = idiv(ia[0], ib[0], s[0]);\n }\n if (cond[1]) {\n result[1] = idiv(ia[1], ib[1], s[1]);\n }\n if (cond[2]) {\n result[2] = idiv(ia[2], ib[2], s[2]);\n }\n if (cond[3]) {\n result[3] = idiv(ia[3], ib[3], s[3]);\n }\n return vec4(result);\n",dtype:"int32"});t.floorDivConfig={kernelName:r.FloorDiv,backendName:"webgl",kernelFunc:o}},938357:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.fromPixelsConfig=void 0;var r=n(735534),a=n(845772),o=n(789120),s=n(381854);t.fromPixelsConfig={kernelName:r.FromPixels,backendName:"webgl",kernelFunc:function(e){const{inputs:t,backend:n,attrs:c}=e;let{pixels:l}=t;const{numChannels:u}=c,d="undefined"!=typeof HTMLVideoElement&&l instanceof HTMLVideoElement,p="undefined"!=typeof HTMLImageElement&&l instanceof HTMLImageElement,[h,f]=d?[l.videoWidth,l.videoHeight]:[l.width,l.height],m=[f,h],g=[f,h,u];(p||d)&&(null==i&&(i=document.createElement("canvas").getContext("2d")),i.canvas.width=h,i.canvas.height=f,i.drawImage(l,0,0,h,f),l=i.canvas);const y=n.makeTensorInfo(m,"int32");n.texData.get(y.dataId).usage=a.TextureUsage.PIXELS,n.gpgpu.uploadPixelDataToTexture(n.getTexture(y.dataId),l);const v=(0,r.env)().getBool("WEBGL_PACK")?new s.FromPixelsPackedProgram(g):new o.FromPixelsProgram(g),b=n.runWebGLProgram(v,[y],"int32");return n.disposeData(y.dataId),b}};let i},789120:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.FromPixelsProgram=void 0;var r=n(540236);t.FromPixelsProgram=class{constructor(e){this.variableNames=["A"];const t=(0,r.getGlslDifferences)(),[n,a]=e;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(".concat(a,".0, ").concat(n,".0);\n\n vec4 values = ").concat(t.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 ")}}}
1,381854:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.FromPixelsPackedProgram=void 0;var r=n(540236);t.FromPixelsPackedProgram=class{constructor(e){this.variableNames=["A"],this.packedInputs=!1,this.packedOutput=!0;const t=(0,r.getGlslDifferences)(),[n,a]=e;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\n vec4 result = vec4(0.);\n\n for(int row=0; row<=1; row++) {\n for(int col=0; col<=1; col++) {\n texC = coords[1] + row;\n depth = coords[2] + col;\n\n vec2 uv = (vec2(texC, texR) + halfCR) /\n vec2(".concat(a,".0, ").concat(n,".0);\n vec4 values = ").concat(t.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 result[row * 2 + col] = floor(value * 255.0 + 0.5);\n }\n }\n\n ").concat(t.output," = result;\n }\n ")}}},116222:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.fusedConv2DConfig=void 0,t.fusedConv2d=c;var r=n(735534),a=n(811213),o=n(537925),s=n(803437),i=n(144638);function c(e){const{inputs:t,backend:n,attrs:c}=e,{x:l,filter:u,bias:d,preluActivationWeights:p}=t,{strides:h,pad:f,dataFormat:m,dilations:g,dimRoundingMode:y,activation:v,leakyreluAlpha:b}=c,x=r.backend_util.convertConv2DDataFormat(m),w=r.backend_util.computeConv2DInfo(l.shape,u.shape,h,g,f,y,!1,x);let k;const _=[];if(1!==w.filterHeight||1!==w.filterWidth||1!==w.dilationHeight||1!==w.dilationWidth||1!==w.strideHeight||1!==w.strideWidth||"SAME"!==w.padInfo.type&&"VALID"!==w.padInfo.type)if((0,r.env)().getBool("WEBGL_CONV_IM2COL")&&1===l.shape[0])k=(0,s.conv2dWithIm2Row)({x:l,filter:u,convInfo:w,backend:n,bias:d,activation:v,preluActivationWeights:p,leakyreluAlpha:b});else{const e=null!=d,t=null!=p,s="leakyrelu"===v,i=v?(0,o.mapActivationToShaderProgram)(v,!1):null,c=new a.Conv2DProgram(w,e,i,t,s),h=[l,u];if(d&&h.push(d),p&&h.push(p),s){const e=n.makeTensorInfo([],"float32",r.util.createScalarValue(b,"float32"));h.push(e),_.push(e)}k=n.runWebGLProgram(c,h,"float32")}else k=(0,s.conv2dByMatMul)({x:l,filter:u,convInfo:w,backend:n,bias:d,activation:v,preluActivationWeights:p,leakyreluAlpha:b});const C=(0,i.reshape)({inputs:{x:k},backend:n,attrs:{shape:w.outShape}});return _.push(k),_.forEach((e=>n.disposeIntermediateTensorInfo(e))),C}t.fusedConv2DConfig={kernelName:r.FusedConv2D,backendName:"webgl",kernelFunc:c}},990931:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.fusedDepthwiseConv2D=i,t.fusedDepthwiseConv2DConfig=void 0;var r=n(735534),a=n(73168),o=n(318263),s=n(537925);function i(e){const{inputs:t,backend:n,attrs:i}=e,{x:c,filter:l,bias:u,preluActivationWeights:d}=t,{strides:p,pad:h,dilations:f,dimRoundingMode:m,activation:g,leakyreluAlpha:y}=i,v=[];let b=f;null==b&&(b=[1,1]),r.util.assert(r.backend_util.eitherStridesOrDilationsAreOne(p,b),(()=>"Error in depthwiseConv2d: Either strides or dilations must be "+"1. Got strides ".concat(p," and dilations '").concat(b,"'")));const x=r.backend_util.computeConv2DInfo(c.shape,l.shape,p,b,h,m,!0),w=(0,r.env)().getBool("WEBGL_PACK_DEPTHWISECONV")&&x.strideWidth<=2&&x.outChannels/x.inChannels==1,k=g?(0,s.mapActivationToShaderProgram)(g,w):null,_=[c,l],C=null!=u,P=null!=d,O="leakyrelu"===g;if(C&&_.push(u),P&&_.push(d),O){const e=n.makeTensorInfo([],"float32",r.util.createScalarValue(y,"float32"));_.push(e),v.push(e)}let N;N=w?new o.DepthwiseConvPacked2DProgram(x,C,k,P,O):new a.DepthwiseConv2DProgram(x,C,k,P,O);const I=[[x.padInfo.top,x.padInfo.left],[x.strideHeight,x.strideWidth],[x.dilationHeight,x.dilationWidth],[x.inHeight,x.inWidth]],T=n.runWebGLProgram(N,_,"float32",I);return v.forEach((e=>n.disposeIntermediateTensorInfo(e))),T}t.fusedDepthwiseConv2DConfig={kernelName:r.FusedDepthwiseConv2D,backendName:"webgl",kernelFunc:i}},444678:(e,t,n)=>{"use strict";
1Object.defineProperty(t,"__esModule",{value:!0}),t.gatherNd=i,t.gatherNdConfig=void 0;var r=n(735534),a=n(940334),o=n(509570),s=n(144638);function i(e){const{inputs:t,backend:n}=e,{params:i,indices:c}=t,l=c.shape,u=l[l.length-1],d=r.util.sizeFromShape(i.shape),[p,h,f,m]=r.backend_util.prepareAndValidate(i,c),g=(0,s.reshape)({inputs:{x:c},backend:n,attrs:{shape:[h,u]}}),y=(0,s.reshape)({inputs:{x:i},backend:n,attrs:{shape:[r.util.sizeFromShape(i.shape)/f,f]}});if(n.shouldExecuteOnCPU([i,c])||"string"===i.dtype){const e=n.readSync(c.dataId),t=n.bufferSync(i),r=(0,o.gatherNdImplCPU)(e,t,i.dtype,h,u,f,m,i.shape,d);return n.makeTensorInfo(p,i.dtype,r.values)}const v=new a.GatherNDProgram(u,m,[h,f]),b=n.runWebGLProgram(v,[y,g],y.dtype),x=(0,s.reshape)({inputs:{x:b},backend:n,attrs:{shape:p}});return n.disposeIntermediateTensorInfo(g),n.disposeIntermediateTensorInfo(y),n.disposeIntermediateTensorInfo(b),x}t.gatherNdConfig={kernelName:r.GatherNd,backendName:"webgl",kernelFunc:i}},752555:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.gatherV2=i,t.gatherV2Config=void 0;var r=n(735534),a=n(627230),o=n(509570),s=n(144638);function i(e){const{inputs:t,backend:n,attrs:i}=e,{x:c,indices:l}=t,{axis:u,batchDims:d}=i,p=r.util.parseAxisParam(u,c.shape)[0];if((0,r.env)().get("DEBUG")){const e=n.readSync(l.dataId),t=c.shape[p];for(let n=0;n<e.length;++n){const a=e[n];r.util.assert(a<=t-1&&a>=0,(()=>"GatherV2: the index value ".concat(a," is not in [0, ").concat(t-1,"]")))}}const h=r.backend_util.segment_util.collectGatherOpShapeInfo(c,l,p,d),f=r.util.sizeFromShape(l.shape),m=[],g=(0,s.reshape)({inputs:{x:c},backend:n,attrs:{shape:[h.batchSize,h.outerSize,h.dimSize,h.sliceSize]}}),y=(0,s.reshape)({inputs:{x:l},backend:n,attrs:{shape:[h.batchSize,f/h.batchSize]}});m.push(g),m.push(y);const v=[h.batchSize,h.outerSize,f/h.batchSize,h.sliceSize];if(n.shouldExecuteOnCPU([c,l])||"string"===c.dtype){const e=n.bufferSync(y),t=n.bufferSync(g),r=(0,o.gatherV2ImplCPU)(t,e,v);return m.forEach((e=>n.disposeIntermediateTensorInfo(e))),n.makeTensorInfo(h.outputShape,r.dtype,r.values)}const b=new a.GatherProgram(g.shape,v),x=n.runWebGLProgram(b,[g,y],g.dtype);m.push(x);const w=(0,s.reshape)({inputs:{x:x},backend:n,attrs:{shape:h.outputShape}});return m.forEach((e=>n.disposeIntermediateTensorInfo(e))),w}t.gatherV2Config={kernelName:r.GatherV2,backendName:"webgl",kernelFunc:i}},885909:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.greaterConfig=t.greater=void 0;var r=n(735534),a=n(537925),o=n(509570);const s=t.greater=(0,a.binaryKernelFunc)({opSnippet:"return float(a > b);",packedOpSnippet:"\n return vec4(greaterThan(a, b));\n",cpuKernelImpl:o.greaterImplCPU,dtype:"bool"});t.greaterConfig={kernelName:r.Greater,backendName:"webgl",kernelFunc:s}},927043:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.greaterEqualConfig=t.greaterEqual=void 0;var r=n(735534),a=n(537925),o=n(509570);const s=t.greaterEqual=(0,a.binaryKernelFunc)({opSnippet:"return float(a >= b);",packedOpSnippet:"\n return vec4(greaterThanEqual(a, b));\n",dtype:"bool",cpuKernelImpl:o.greaterEqualImplCPU});t.greaterEqualConfig={kernelName:r.GreaterEqual,backendName:"webgl",kernelFunc:s}},944951:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ifft=o,t.ifftConfig=void 0;var r=n(735534),a=n(679835);function o(e){const{inputs:t,backend:n}=e,{input:r}=t;return(0,a.fftImpl)(r,!0,n)}t.ifftConfig={kernelName:r.IFFT,backendName:"webgl",kernelFunc:o}},750257:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.identity=a,t.identityConfig=void 0;var r=n(735534);function a(e){const{inputs:t,backend:n}=e,{x:r}=t;return n.incRef(r.dataId),{dataId:r.dataId,shape:r.shape,dtype:r.dtype}}t.identityConfig={kernelName:r.Identity,backendName:"webgl",kernelFunc:a}},859559:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.imag=o,t.imagConfig=void 0;var r=n(735534),a=n(750257);function o(e){const{inputs:t,backend:n}=e,{input:r}=t,o=n.texData.get(r.dataId);return(0,a.identity)({inputs:{x:o.complexTensorInfos.imag},backend:n})}t.imagConfig={kernelName:r.Imag,backendName:"webgl",kernelFunc:o}},506418:(e,t,n)=>{"use strict";
1Object.defineProperty(t,"__esModule",{value:!0}),t.isFiniteConfig=t.isFinite=void 0;var r=n(735534),a=n(537925);const o=t.isFinite=(0,a.unaryKernelFunc)({opSnippet:"return float(!isnan(x) && !isinf(x));",dtype:"bool"});t.isFiniteConfig={kernelName:r.IsFinite,backendName:"webgl",kernelFunc:o}},728223:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.isInfConfig=t.isInf=void 0;var r=n(735534),a=n(537925);const o=t.isInf=(0,a.unaryKernelFunc)({opSnippet:"return float(isinf(x));",dtype:"bool"});t.isInfConfig={kernelName:r.IsInf,backendName:"webgl",kernelFunc:o}},934104:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.isNaNConfig=t.isNaN=void 0;var r=n(735534),a=n(537925);const o=t.isNaN=(0,a.unaryKernelFunc)({opSnippet:"return float(isnan(x));",dtype:"bool"});t.isNaNConfig={kernelName:r.IsNan,backendName:"webgl",kernelFunc:o}},619366:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.lrn=t.LRNConfig=void 0;var r=n(735534),a=n(362114),o=n(525504);const s=e=>{const{inputs:t,backend:n,attrs:s}=e,{x:i}=t,{depthRadius:c,bias:l,alpha:u,beta:d}=s,p=(0,r.env)().getBool("WEBGL_PACK_NORMALIZATION")?new o.LRNPackedProgram(i.shape,c,l,u,d):new a.LRNProgram(i.shape,c,l,u,d);return n.runWebGLProgram(p,[i],i.dtype)};t.lrn=s;t.LRNConfig={kernelName:r.LRN,backendName:"webgl",kernelFunc:s}},870728:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.lrnGrad=t.LRNGradConfig=void 0;var r=n(735534),a=n(111759);const o=e=>{const{inputs:t,backend:n,attrs:r}=e,{x:o,y:s,dy:i}=t,{depthRadius:c,bias:l,alpha:u,beta:d}=r,p=new a.LRNGradProgram(o.shape,c,l,u,d);return n.runWebGLProgram(p,[o,s,i],o.dtype)};t.lrnGrad=o;t.LRNGradConfig={kernelName:r.LRNGrad,backendName:"webgl",kernelFunc:o}},410636:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.LEAKYRELU_PACKED=t.LEAKYRELU=void 0,t.leakyRelu=c,t.leakyReluConfig=void 0;var r=n(735534),a=n(386960),o=n(215872);const s=t.LEAKYRELU="return (a < 0.) ? b * a : a;",i=t.LEAKYRELU_PACKED="\n vec4 aLessThanZero = vec4(lessThan(a, vec4(0.)));
1\n return (aLessThanZero * (b * a)) + ((vec4(1.0) - aLessThanZero) * a);\n";function c(e){const{inputs:t,backend:n,attrs:c}=e,{x:l}=t,{alpha:u}=c,d=n.makeTensorInfo([],"float32",r.util.createScalarValue(u,"float32")),p=(0,r.env)().getBool("WEBGL_PACK_BINARY_OPERATIONS")?new o.BinaryOpPackedProgram(i,l.shape,d.shape):new a.BinaryOpProgram(s,l.shape,d.shape),h=n.runWebGLProgram(p,[l,d],"float32");return n.disposeIntermediateTensorInfo(d),h}t.leakyReluConfig={kernelName:r.LeakyRelu,backendName:"webgl",kernelFunc:c}},417271:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.lessConfig=t.less=void 0;var r=n(735534),a=n(537925),o=n(509570);const s=t.less=(0,a.binaryKernelFunc)({opSnippet:"return float(a < b);",packedOpSnippet:"\n return vec4(lessThan(a, b));\n",cpuKernelImpl:o.lessImplCPU,dtype:"bool"});t.lessConfig={kernelName:r.Less,backendName:"webgl",kernelFunc:s}},23909:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.lessEqualConfig=t.lessEqual=t.LESS_EQUAL_PACKED=t.LESS_EQUAL=void 0;var r=n(735534),a=n(537925),o=n(509570);const s=t.LESS_EQUAL="return float(a <= b);",i=t.LESS_EQUAL_PACKED="\n return vec4(lessThanEqual(a, b));\n",c=t.lessEqual=(0,a.binaryKernelFunc)({opSnippet:s,packedOpSnippet:i,cpuKernelImpl:o.lessEqualImplCPU,dtype:"bool"});t.lessEqualConfig={kernelName:r.LessEqual,backendName:"webgl",kernelFunc:c}},763052:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.linSpace=o,t.linSpaceConfig=void 0;var r=n(735534),a=n(509570);function o(e){const{backend:t,attrs:n}=e,{start:r,stop:o,num:s}=n,i=(0,a.linSpaceImplCPU)(r,o,s);return t.makeTensorInfo([i.length],"float32",i)}t.linSpaceConfig={kernelName:r.LinSpace,backendName:"webgl",kernelFunc:o}}
1,906064:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.logConfig=t.log=void 0;var r=n(735534),a=n(537925),o=n(509570);const s=a.CHECK_NAN_SNIPPET_UNARY+"\n return x < 0.0 ? 0./0. : log(x);\n",i=t.log=(0,a.unaryKernelFunc)({opSnippet:s,packedOpSnippet:"\n vec4 result = log(x);\n bvec4 isNaN = isnan(x);\n result.r = isNaN.r ? x.r : (x.r < 0.0 ? 0./0. : result.r);\n result.g = isNaN.g ? x.g : (x.g < 0.0 ? 0./0. : result.g);\n result.b = isNaN.b ? x.b : (x.b < 0.0 ? 0./0. : result.b);\n result.a = isNaN.a ? x.a : (x.a < 0.0 ? 0./0. : result.a);\n return result;\n",cpuKernelImpl:o.logImplCPU});t.logConfig={kernelName:r.Log,backendName:"webgl",kernelFunc:i}},681681:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.log1pConfig=t.log1p=void 0;var r=n(735534),a=n(537925);const o=a.CHECK_NAN_SNIPPET_UNARY+"\n return log(1.0 + x);\n",s=t.log1p=(0,a.unaryKernelFunc)({opSnippet:o});t.log1pConfig={kernelName:r.Log1p,backendName:"webgl",kernelFunc:s}},936422:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.logicalAndConfig=t.logicalAnd=void 0;var r=n(735534),a=n(537925);const o=t.logicalAnd=(0,a.binaryKernelFunc)({opSnippet:"return float(a >= 1.0 && b >= 1.0);",packedOpSnippet:"\n return vec4(\n vec4(greaterThanEqual(a, vec4(1.0))) *\n vec4(greaterThanEqual(b, vec4(1.0))));\n",dtype:"bool"});t.logicalAndConfig={kernelName:r.LogicalAnd,backendName:"webgl",kernelFunc:o}},682055:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.logicalNotConfig=t.logicalNot=void 0;var r=n(735534),a=n(537925);const o=t.logicalNot=(0,a.unaryKernelFunc)({opSnippet:"return float(!(x >= 1.0));"});t.logicalNotConfig={kernelName:r.LogicalNot,backendName:"webgl",kernelFunc:o}},190033:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.logicalOrConfig=t.logicalOr=void 0;var r=n(735534),a=n(537925);const o=t.logicalOr=(0,a.binaryKernelFunc)({opSnippet:"return float(a >= 1.0 || b >= 1.0);",packedOpSnippet:"\n return min(\n vec4(greaterThanEqual(a, vec4(1.0))) +\n vec4(greaterThanEqual(b, vec4(1.0))),\n vec4(1.0));\n",dtype:"bool"});t.logicalOrConfig={kernelName:r.LogicalOr,backendName:"webgl",kernelFunc:o}},197339:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.max=i,t.maxConfig=void 0;var r=n(735534),a=n(509570),o=n(788990),s=n(950760);function i(e){const{inputs:t,backend:n,attrs:i}=e,{x:c}=t,{reductionIndices:l,keepDims:u}=i,d=c.shape.length,p=r.util.parseAxisParam(l,c.shape);let h=p;const f=r.backend_util.getAxesPermutation(h,d),m=null!=f,g=n.shouldExecuteOnCPU([c]);let y=c;if(m){if(g){const e=n.texData.get(y.dataId).values,t=new Array(d);for(let e=0;e<t.length;e++)t[e]=c.shape[f[e]];const r=(0,s.transposeImplCPU)(e,c.shape,c.dtype,f,t);y=n.makeTensorInfo(t,c.dtype);n.texData.get(y.dataId).values=r}else y=(0,s.transposeImpl)(c,f,n);h=r.backend_util.getInnerMostAxes(h.length,d)}r.backend_util.assertAxesAreInnerMostDims("max",h,d);const[v,b]=r.backend_util.computeOutAndReduceShapes(y.shape,h);let x,w=v;if(u&&(w=r.backend_util.expandShapeToKeepDim(v,p)),g){const e=n.texData.get(y.dataId).values,t=(0,a.maxImplCPU)(e,r.util.sizeFromShape(b),w,c.dtype);x=n.makeTensorInfo(w,c.dtype);n.texData.get(x.dataId).values=t}else x=(0,o.maxImpl)(y,b,w,n);return m&&n.disposeIntermediateTensorInfo(y),x}t.maxConfig={kernelName:r.Max,backendName:"webgl",kernelFunc:i}},752485:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.maxPool=i,t.maxPoolConfig=void 0;var r=n(735534),a=n(19718),o=n(519617),s=n(750257);function i(e){const{inputs:t,backend:n,attrs:i}=e,{x:c}=t;(0,o.assertNotComplex)(c,"maxPool");const{filterSize:l,strides:u,pad:d,dimRoundingMode:p}=i;r.util.assert(r.backend_util.eitherStridesOrDilationsAreOne(u,1),(()=>"Error in maxPool: Either strides or dilations must be 1. "+"Got strides ".concat(u," and dilations '").concat(1,"'")));const h=r.backend_util.computePool2DInfo(c.shape,l,u,1,d,p);if(1===h.filterWidth&&1===h.filterHeight&&r.util.arraysEqual(h.inShape,h.outShape))return(0,s.identity)({inputs:{x:c},backend:n});const f=new a.Pool2DProgram(h,"max",!1);return n.runWebGLProgram(f,[c],c.dtype)}t.maxPoolConfig={kernelName:r.MaxPool,backendName:"webgl",kernelFunc:i}}
1,105474:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.maxPool3DConfig=void 0,t.maxPool3d=o;var r=n(735534),a=n(19718);function o(e){const{inputs:t,backend:n,attrs:o}=e,{x:s}=t,{filterSize:i,strides:c,pad:l,dataFormat:u,dimRoundingMode:d}=o,p=r.backend_util.computePool3DInfo(s.shape,i,c,[1,1,1],l,d,u),h=new a.Pool3DProgram(p,"max",!1);return n.runWebGLProgram(h,[s],s.dtype)}t.maxPool3DConfig={kernelName:r.MaxPool3D,backendName:"webgl",kernelFunc:o}},921460:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.maxPool3DGrad=s,t.maxPool3DGradConfig=void 0;var r=n(735534),a=n(862242),o=n(19718);function s(e){const{inputs:t,backend:n,attrs:s}=e,{dy:i,input:c}=t,l=c,{filterSize:u,strides:d,pad:p,dimRoundingMode:h}=s,f=r.backend_util.computePool3DInfo(l.shape,u,d,[1,1,1],p,h),m=new o.Pool3DProgram(f,"max",!0),g=n.runWebGLProgram(m,[l],l.dtype),y=new a.MaxPool3DBackpropProgram(f),v=n.runWebGLProgram(y,[i,g],l.dtype);return n.disposeIntermediateTensorInfo(g),v}t.maxPool3DGradConfig={kernelName:r.MaxPool3DGrad,backendName:"webgl",kernelFunc:s}},738768:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.maxPoolGrad=i,t.maxPoolGradConfig=void 0;var r=n(735534),a=n(862242),o=n(19718),s=n(519617);function i(e){const{inputs:t,backend:n,attrs:i}=e,{dy:c,input:l,output:u}=t,d=l;(0,s.assertNotComplex)([l,u],"maxPoolGrad");const{filterSize:p,strides:h,pad:f,dimRoundingMode:m}=i,g=r.backend_util.computePool2DInfo(d.shape,p,h,1,f,m),y=new o.Pool2DProgram(g,"max",!0),v=n.runWebGLProgram(y,[d],d.dtype),b=new a.MaxPool2DBackpropProgram(g),x=n.runWebGLProgram(b,[c,v],d.dtype);return n.disposeIntermediateTensorInfo(v),x}t.maxPoolGradConfig={kernelName:r.MaxPoolGrad,backendName:"webgl",kernelFunc:i}},605051:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.maxPoolWithArgmaxConfig=void 0;var r=n(735534),a=n(530440);t.maxPoolWithArgmaxConfig={kernelName:r.MaxPoolWithArgmax,backendName:"webgl",kernelFunc:e=>{let{inputs:t,attrs:n,backend:o}=e;const{x:s}=t,{filterSize:i,strides:c,pad:l,includeBatchInIndex:u}=n,d=o;r.util.assert(4===s.shape.length,(()=>"Error in maxPool: input must be rank 4 but got rank ".concat(s.shape.length,".")));const p=[1,1];r.util.assert(r.backend_util.eitherStridesOrDilationsAreOne(c,p),(()=>"Error in maxPool: Either strides or dilations must be 1. "+"Got strides ".concat(c," and dilations '").concat(p,"'")));const h=r.backend_util.computePool2DInfo(s.shape,i,c,p,l),[f,m]=(0,a.maxPoolWithArgmaxImpl)(s,u,h,d);return[f,m]}}},530440:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.maxPoolWithArgmaxImpl=function(e,t,n,a){let o=new r.Pool2DProgram(n,"max",!1);const s=a.runWebGLProgram(o,[e],"float32");o=new r.Pool2DProgram(n,"max",!0,!0,t);const i=a.runWebGLProgram(o,[e],"float32");return[s,i]};var r=n(19718)},788990:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.maxImpl=function(e,t,n,s){const i=r.util.sizeFromShape(t),c=r.util.sizeFromShape(e.shape)/i,l=(0,o.reshape)({inputs:{x:e},attrs:{shape:[c,i]},backend:s}),u=(0,a.reduce)(l,e.dtype,"max",s),d=(0,o.reshape)({inputs:{x:u},attrs:{shape:n},backend:s});return s.disposeIntermediateTensorInfo(l),s.disposeIntermediateTensorInfo(u),d};var r=n(735534),a=n(531305),o=n(144638)},442304:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.maximumConfig=t.maximum=void 0;var r=n(735534),a=n(386960),o=n(215872),s=n(537925),i=n(509570);const c=a.CHECK_NAN_SNIPPET+"\n return max(a, b);\n",l="\n vec4 result = vec4(max(a, b));\n vec4 isNaN = min(vec4(isnan(a)) + vec4(isnan(b)), vec4(1.0));\n "+o.CHECK_NAN_SNIPPET+"\n return result;\n",u=t.maximum=(0,s.binaryKernelFunc)({opSnippet:c,packedOpSnippet:l,cpuKernelImpl:i.maximumImplCPU});t.maximumConfig={kernelName:r.Maximum,backendName:"webgl",kernelFunc:u}},724776:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.meanConfig=void 0;var r=n(735534),a=n(872063),o=n(950760);t.meanConfig={kernelName:r.Mean,backendName:"webgl",kernelFunc:e=>{let{inputs:t,attrs:n,backend:s}=e;const{x:i}=t,{keepDims:c,axis:l}=n,u=s,d=i.shape.length,p=r.util.parseAxisParam(l,i.shape);let h=p;const f=r.backend_util.getAxesPermutation(h,d),m=null!=f,g=u.shouldExecuteOnCPU([i]),y=[];let v=i;if(m){if(g){const e=u.texData.get(v.dataId).values,t=new Array(d);for(let e=0;e<t.length;e++)t[e]=i.shape[f[e]];const n=(0,o.transposeImplCPU)(e,i.shape,i.dtype,f,t);v=u.makeTensorInfo(t,i.dtype);u.texData.get(v.dataId).values=n}else v=(0,o.transposeImpl)(i,f,u);y.push(v),h=r.backend_util.getInnerMostAxes(h.length,d)}r.backend_util.assertAxesAreInnerMostDims("sum",h,d);const[b,x]=r.backend_util.computeOutAndReduceShapes(v.shape,h);let w=b;c&&(w=r.backend_util.expandShapeToKeepDim(b,p));const k=(0,a.meanImpl)(v,x,w,u);for(const e of y)u.disposeIntermediateTensorInfo(e);return k}}},872063:(e,t,n)=>{"use strict";
1Object.defineProperty(t,"__esModule",{value:!0}),t.meanImpl=function(e,t,n,s){const i=r.util.sizeFromShape(t),c=r.util.sizeFromShape(e.shape)/i,l=(0,o.reshape)({inputs:{x:e},attrs:{shape:[c,i]},backend:s}),u=(0,a.reduce)(l,"float32","mean",s),d=(0,o.reshape)({inputs:{x:u},attrs:{shape:n},backend:s});return s.disposeIntermediateTensorInfo(l),s.disposeIntermediateTensorInfo(u),d};var r=n(735534),a=n(531305),o=n(144638)},293696:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.min=i,t.minConfig=void 0;var r=n(735534),a=n(531305),o=n(144638),s=n(291146);function i(e){const{inputs:t,backend:n,attrs:i}=e,{x:c}=t,{axis:l,keepDims:u}=i,d=c.shape.length,p=r.util.parseAxisParam(l,c.shape);let h=p;const f=r.backend_util.getAxesPermutation(h,d);let m=c;null!=f&&(m=(0,s.transpose)({inputs:{x:c},backend:n,attrs:{perm:f}}),h=r.backend_util.getInnerMostAxes(h.length,c.shape.length)),r.backend_util.assertAxesAreInnerMostDims("min",h,d);const[g,y]=r.backend_util.computeOutAndReduceShapes(m.shape,h),v=r.util.sizeFromShape(y),b=(0,o.reshape)({inputs:{x:m},backend:n,attrs:{shape:[-1,v]}}),x=(0,a.reduce)(b,b.dtype,"min",n);let w;if(u){const e=r.backend_util.expandShapeToKeepDim(g,p);w=(0,o.reshape)({inputs:{x:x},backend:n,attrs:{shape:e}})}else w=(0,o.reshape)({inputs:{x:x},backend:n,attrs:{shape:g}});return n.disposeIntermediateTensorInfo(b),n.disposeIntermediateTensorInfo(x),null!=f&&n.disposeIntermediateTensorInfo(m),w}t.minConfig={kernelName:r.Min,backendName:"webgl",kernelFunc:i}},462585:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.minimumConfig=t.minimum=void 0;var r=n(735534),a=n(386960),o=n(215872),s=n(537925),i=n(509570);const c=a.CHECK_NAN_SNIPPET+"\n return min(a, b);\n",l="\n vec4 result = vec4(min(a, b));\n vec4 isNaN = min(vec4(isnan(a)) + vec4(isnan(b)), vec4(1.0));\n "+o.CHECK_NAN_SNIPPET+"\n return result;\n",u=t.minimum=(0,s.binaryKernelFunc)({opSnippet:c,packedOpSnippet:l,cpuKernelImpl:i.minimumImplCPU});t.minimumConfig={kernelName:r.Minimum,backendName:"webgl",kernelFunc:u}},640261:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.mirrorPadKernelFunc=t.mirrorPadConfig=void 0;var r=n(735534),a=n(528893),o=n(878805);const s=e=>{let{inputs:t,backend:n,attrs:s}=e;const{x:i}=t,{paddings:c,mode:l}=s,u=(0,r.env)().getBool("WEBGL_PACK_ARRAY_OPERATIONS")?new o.MirrorPadPackedProgram(i.shape,c,l):new a.MirrorPadProgram(i.shape,c,l);return n.runWebGLProgram(u,[i],i.dtype)};t.mirrorPadKernelFunc=s;t.mirrorPadConfig={kernelName:r.MirrorPad,backendName:"webgl",kernelFunc:s}},620241:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.modConfig=t.mod=void 0;var r=n(735534),a=n(215872),o=n(537925);const s="\n vec4 result = mod(a, b);\n vec4 isNaN = vec4(equal(b, vec4(0.0)));\n "+a.CHECK_NAN_SNIPPET+"\n return result;\n",i=t.mod=(0,o.binaryKernelFunc)({opSnippet:"if (b == 0.0) return NAN;\n return mod(a, b);",packedOpSnippet:s});t.modConfig={kernelName:r.Mod,backendName:"webgl",kernelFunc:i}},466426:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.multinomial=s,t.multinomialConfig=void 0;var r=n(735534),a=n(547840),o=n(789276);function s(e){const{inputs:t,backend:n,attrs:r}=e,{logits:s}=t,{numSamples:i,seed:c,normalized:l}=r,u=l?s:(0,o.softmax)({inputs:{logits:s},backend:n,attrs:{dim:s.shape.length-1}}),d=u.shape[0],p=u.shape[1],h=new a.MultinomialProgram(d,p,i),f=[[c]],m=n.runWebGLProgram(h,[u],"int32",f);return l||n.disposeIntermediateTensorInfo(u),m}t.multinomialConfig={kernelName:r.Multinomial,backendName:"webgl",kernelFunc:s}},810077:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.multiply=p,t.multiplyConfig=void 0;var r=n(735534),a=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=u(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if("default"!==o&&{}.hasOwnProperty.call(e,o)){var s=a?Object.getOwnPropertyDescriptor(e,o):null;s&&(s.get||s.set)?Object.defineProperty(r,o,s):r[o]=e[o]}return r.default=e,n&&n.set(e,r),r}(n(434595)),o=a,s=n(386960),i=n(215872),c=n(509570),l=n(63255);function u(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(u=function(e){return e?n:t})(e)}const d="return a * b;";function p(e){const{inputs:t,backend:n}=e,{a:u,b:p}=t,h=r.backend_util.upcastType(u.dtype,p.dtype);if("complex64"===u.dtype){const e=n.texData.get(u.dataId),t=n.texData.get(p.dataId),r=new a.BinaryOpComplexProgram(o.COMPLEX_MULTIPLY.REAL,u.shape,p.shape),s=new a.BinaryOpComplexProgram(o.COMPLEX_MULTIPLY.IMAG,u.shape,p.shape),i=[{dataId:e.complexTensorInfos.real.dataId,dtype:e.complexTensorInfos.real.dtype,shape:u.shape},{dataId:e.complexTensorInfos.imag.dataId,dtype:e.complexTensorInfos.imag.dtype,shape:u.shape},{dataId:t.complexTensorInfos.real.dataId,dtype:t.complexTensorInfos.real.dtype,shape:p.shape},{dataId:t.complexTensorInfos.imag.dataId,dtype:t.complexTensorInfos.imag.dtype,shape:p.shape}],c=n.runWebGLProgram(r,i,"float32"),d=n.runWebGLProgram(s,i,"float32"),h=(0,l.complex)({inputs:{real:c,imag:d},backend:n});return n.disposeIntermediateTensorInfo(c),n.disposeIntermediateTensorInfo(d),h}if(n.shouldExecuteOnCPU([u,p])){const e=n.texData.get(u.dataId),t=n.texData.get(p.dataId),[r,a]=(0,c.multiplyImplCPU)(u.shape,p.shape,e.values,t.values,h),o=n.makeTensorInfo(a,h);return n.texData.get(o.dataId).values=r,o}let f;return f=(0,r.env)().getBool("WEBGL_PACK_BINARY_OPERATIONS")?new i.BinaryOpPackedProgram(d,u.shape,p.shape):new s.BinaryOpProgram(d,u.shape,p.shape),n.runWebGLProgram(f,[u,p],h)}t.multiplyConfig={kernelName:r.Multiply,backendName:"webgl",kernelFunc:p}},258832:(e,t,n)=>{"use strict";
1Object.defineProperty(t,"__esModule",{value:!0}),t.neg=l,t.negConfig=void 0;var r=n(735534),a=n(509570),o=n(934500),s=n(721797);const i=o.CHECK_NAN_SNIPPET+"\n return -x;\n",c="\n vec4 result = -x;\n bvec4 isNaN = isnan(x);\n\n result.r = isNaN.r ? x.r : result.r;\n result.g = isNaN.g ? x.g : result.g;\n result.b = isNaN.b ? x.b : result.b;\n result.a = isNaN.a ? x.a : result.a;\n\n return result;\n";function l(e){const{inputs:t,backend:n}=e,{x:l}=t;if(n.shouldExecuteOnCPU([l])){const e=n.texData.get(l.dataId),[t,r]=(0,a.negImplCPU)(e.values,l.shape,l.dtype);return n.makeTensorInfo(r,l.dtype,t)}let u;return u=(0,r.env)().getBool("WEBGL_PACK_UNARY_OPERATIONS")?new s.UnaryOpPackedProgram(l.shape,c):new o.UnaryOpProgram(l.shape,i),n.runWebGLProgram(u,[l],l.dtype)}t.negConfig={kernelName:r.Neg,backendName:"webgl",kernelFunc:l}},964426:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.nonMaxSuppressionV3=o,t.nonMaxSuppressionV3Config=void 0;var r=n(735534);const a=r.kernel_impls.nonMaxSuppressionV3Impl;function o(e){r.backend_util.warn("tf.nonMaxSuppression() in webgl locks the UI thread. Call tf.nonMaxSuppressionAsync() instead");const{inputs:t,backend:n,attrs:o}=e,{boxes:s,scores:i}=t,{maxOutputSize:c,iouThreshold:l,scoreThreshold:u}=o,d=n.readSync(s.dataId),p=n.readSync(i.dataId),{selectedIndices:h}=a(d,p,c,l,u);return n.makeTensorInfo([h.length],"int32",new Int32Array(h))}t.nonMaxSuppressionV3Config={kernelName:r.NonMaxSuppressionV3,backendName:"webgl",kernelFunc:o}},42529:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.nonMaxSuppressionV4=o,t.nonMaxSuppressionV4Config=void 0;var r=n(735534);const a=r.kernel_impls.nonMaxSuppressionV4Impl;function o(e){r.backend_util.warn("tf.nonMaxSuppression() in webgl locks the UI thread. Call tf.nonMaxSuppressionAsync() instead");const{inputs:t,backend:n,attrs:o}=e,{boxes:s,scores:i}=t,{maxOutputSize:c,iouThreshold:l,scoreThreshold:u,padToMaxOutputSize:d}=o,p=n.readSync(s.dataId),h=n.readSync(i.dataId),{selectedIndices:f,validOutputs:m}=a(p,h,c,l,u,d);return[n.makeTensorInfo([f.length],"int32",new Int32Array(f)),n.makeTensorInfo([],"int32",new Int32Array([m]))]}t.nonMaxSuppressionV4Config={kernelName:r.NonMaxSuppressionV4,backendName:"webgl",kernelFunc:o}},157649:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.nonMaxSuppressionV5=o,t.nonMaxSuppressionV5Config=void 0;var r=n(735534);const a=r.kernel_impls.nonMaxSuppressionV5Impl;function o(e){r.backend_util.warn("tf.nonMaxSuppression() in webgl locks the UI thread. Call tf.nonMaxSuppressionAsync() instead");const{inputs:t,backend:n,attrs:o}=e,{boxes:s,scores:i}=t,{maxOutputSize:c,iouThreshold:l,scoreThreshold:u,softNmsSigma:d}=o,p=n.readSync(s.dataId),h=n.readSync(i.dataId),f=c,m=l,g=u,y=d,{selectedIndices:v,selectedScores:b}=a(p,h,f,m,g,y);return[n.makeTensorInfo([v.length],"int32",new Int32Array(v)),n.makeTensorInfo([b.length],"float32",new Float32Array(b))]}t.nonMaxSuppressionV5Config={kernelName:r.NonMaxSuppressionV5,backendName:"webgl",kernelFunc:o}},731579:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.notEqualConfig=t.notEqual=void 0;var r=n(735534),a=n(537925),o=n(509570);const s=t.notEqual=(0,a.binaryKernelFunc)({opSnippet:"return float(a != b);",cpuKernelImpl:o.notEqualImplCPU,dtype:"bool"});t.notEqualConfig={kernelName:r.NotEqual,backendName:"webgl",kernelFunc:s}},880024:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.oneHotConfig=t.oneHot=void 0;var r=n(735534),a=n(890552),o=n(144638);const s=e=>{const{inputs:t,backend:n,attrs:s}=e,{indices:i}=t,{depth:c,onValue:l,offValue:u}=s,d=r.util.sizeFromShape(i.shape),p=new a.OneHotProgram(d,c,l,u),h=(0,o.reshape)({inputs:{x:i},backend:n,attrs:{shape:[d]}}),f=n.runWebGLProgram(p,[h],i.dtype);n.disposeIntermediateTensorInfo(h);const m=[...i.shape,c],g=(0,o.reshape)({inputs:{x:f},backend:n,attrs:{shape:m}});return n.disposeIntermediateTensorInfo(f),g};t.oneHot=s;t.oneHotConfig={kernelName:r.OneHot,backendName:"webgl",kernelFunc:s}},519925:(e,t,n)=>{"use strict";
1Object.defineProperty(t,"__esModule",{value:!0}),t.onesLike=l,t.onesLikeConfig=void 0;var r=n(735534),a=n(63255),o=n(531075),s=n(859559),i=n(723295),c=n(407163);function l(e){const{inputs:t,backend:n}=e,{x:r}=t;if("string"===r.dtype)throw new Error("onesLike is not supported under string dtype");if("complex64"===r.dtype){const e=(0,i.real)({inputs:{input:r},backend:n}),t=l({inputs:{x:e},backend:n}),o=(0,s.imag)({inputs:{input:r},backend:n}),u=(0,c.zerosLike)({inputs:{x:o},backend:n}),d=(0,a.complex)({inputs:{real:t,imag:u},backend:n});return n.disposeIntermediateTensorInfo(e),n.disposeIntermediateTensorInfo(t),n.disposeIntermediateTensorInfo(o),n.disposeIntermediateTensorInfo(u),d}return(0,o.fill)({attrs:{shape:r.shape,dtype:r.dtype,value:1},backend:n})}t.onesLikeConfig={kernelName:r.OnesLike,backendName:"webgl",kernelFunc:l}},441488:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.pack=s,t.packConfig=void 0;var r=n(735534),a=n(555022),o=n(802175);function s(e){const{inputs:t,backend:n,attrs:s}=e,{axis:i}=s;if(1===t.length)return(0,o.expandDims)({inputs:{input:t[0]},backend:n,attrs:{dim:i}});const c=t[0].shape,l=t[0].dtype;t.forEach((e=>{r.util.assertShapesMatch(c,e.shape,"All tensors passed to stack must have matching shapes"),r.util.assert(l===e.dtype,(()=>"All tensors passed to stack must have matching dtypes"))}));const u=[],d=t.map((e=>{const t=(0,o.expandDims)({inputs:{input:e},backend:n,attrs:{dim:i}});return u.push(t),t})),p=(0,a.concat)({inputs:d,backend:n,attrs:{axis:i}});return u.forEach((e=>n.disposeIntermediateTensorInfo(e))),p}t.packConfig={kernelName:r.Pack,backendName:"webgl",kernelFunc:s}},554300:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.padV2Config=t.padV2=void 0;var r=n(735534),a=n(447851),o=n(235023),s=n(531075);const i=e=>{const{inputs:t,backend:n,attrs:i}=e,{x:c}=t,{paddings:l,constantValue:u}=i;if(0===r.util.sizeFromShape(c.shape)){const e=l.map(((e,t)=>e[0]+c.shape[t]+e[1]));return(0,s.fill)({backend:n,attrs:{shape:e,value:u,dtype:c.dtype}})}const d=(0,r.env)().getBool("WEBGL_PACK_ARRAY_OPERATIONS")?new o.PadPackedProgram(c.shape,l,u):new a.PadProgram(c.shape,l,u),p=[[u]];return n.runWebGLProgram(d,[c],c.dtype,p)};t.padV2=i;t.padV2Config={kernelName:r.PadV2,backendName:"webgl",kernelFunc:i}},641596:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.powConfig=t.pow=void 0;var r=n(735534),a=n(215872),o=n(537925);const s="\n // isModRound1 has 1 for components with round(mod(b, 2.0)) == 1, 0 otherwise.\n vec4 isModRound1 = vec4(equal(round(mod(b, 2.0)), ivec4(1)));\n vec4 multiplier = sign(a) * isModRound1 + (vec4(1.0) - isModRound1);\n vec4 result = multiplier * pow(abs(a), b);\n\n // Ensure that a^0 = 1, including 0^0 = 1 as this correspond to TF and JS\n bvec4 isExpZero = equal(b, vec4(0.0));\n result.r = isExpZero.r ? 1.0 : result.r;\n result.g = isExpZero.g ? 1.0 : result.g;\n result.b = isExpZero.b ? 1.0 : result.b;\n result.a = isExpZero.a ? 1.0 : result.a;\n\n vec4 isNaN = vec4(lessThan(a, vec4(0.0))) * vec4(lessThan(floor(b), b));\n "+a.CHECK_NAN_SNIPPET+"\n return result;\n",i=t.pow=(0,o.binaryKernelFunc)({opSnippet:"\n if(a < 0.0 && floor(b) < b){\n return NAN;\n }\n if (b == 0.0) {\n return 1.0;\n }\n return (round(mod(b, 2.0)) != 1) ?\n pow(abs(a), b) : sign(a) * pow(abs(a), b);\n",packedOpSnippet:s});t.powConfig={kernelName:r.Pow,backendName:"webgl",kernelFunc:i}},750888:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.PRELU_PACKED=t.PRELU=void 0,t.prelu=c,t.preluConfig=void 0;var r=n(735534),a=n(386960),o=n(215872);const s=t.PRELU="return (a < 0.) ? b * a : a;",i=t.PRELU_PACKED="\n vec4 aLessThanZero = vec4(lessThan(a, vec4(0.)));
1\n return (aLessThanZero * (b * a)) + ((vec4(1.0) - aLessThanZero) * a);\n";function c(e){const{inputs:t,backend:n}=e,{x:c,alpha:l}=t,u=(0,r.env)().getBool("WEBGL_PACK_BINARY_OPERATIONS")?new o.BinaryOpPackedProgram(i,c.shape,l.shape):new a.BinaryOpProgram(s,c.shape,l.shape);return n.runWebGLProgram(u,[c,l],"float32")}t.preluConfig={kernelName:r.Prelu,backendName:"webgl",kernelFunc:c}},104492:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.prod=c,t.prodConfig=void 0;var r=n(735534),a=n(531305),o=n(509570),s=n(144638),i=n(291146);function c(e){const{inputs:t,backend:n,attrs:c}=e,{x:l}=t,{axis:u,keepDims:d}=c,p=l.shape.length,h=[],f=r.util.parseAxisParam(u,l.shape);let m=f;const g=r.backend_util.getAxesPermutation(m,p);let y,v=l;if(null!=g&&(v=(0,i.transpose)({inputs:{x:l},backend:n,attrs:{perm:g}}),m=r.backend_util.getInnerMostAxes(m.length,p),h.push(v)),r.backend_util.assertAxesAreInnerMostDims("prod",m,p),n.shouldExecuteOnCPU([v])){const e=n.texData.get(v.dataId).values,{outVals:t,outShape:r,outDtype:a}=(0,o.prodImplCPU)(v.shape,v.dtype,e,m);y=n.makeTensorInfo(r,a,t)}else{const[e,t]=r.backend_util.computeOutAndReduceShapes(v.shape,m),o=r.util.sizeFromShape(t),i=(0,s.reshape)({inputs:{x:v},backend:n,attrs:{shape:[-1,o]}}),c=(0,r.sumOutType)(l.dtype),u=(0,a.reduce)(i,c,"prod",n);y=(0,s.reshape)({inputs:{x:u},backend:n,attrs:{shape:e}}),h.push(i),h.push(u)}if(d){h.push(y);const e=r.backend_util.expandShapeToKeepDim(y.shape,f);y=(0,s.reshape)({inputs:{x:y},backend:n,attrs:{shape:e}})}return h.forEach((e=>n.disposeIntermediateTensorInfo(e))),y}t.prodConfig={kernelName:r.Prod,backendName:"webgl",kernelFunc:c}},526560:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.rangeConfig=t.range=void 0;var r=n(735534),a=n(509570);const o=e=>{const{backend:t,attrs:n}=e,{start:r,stop:o,step:s,dtype:i}=n,c=(0,a.rangeImplCPU)(r,o,s,i);return t.makeTensorInfo([c.length],i,c)};t.range=o;t.rangeConfig={kernelName:r.Range,backendName:"webgl",kernelFunc:o}},723295:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.real=o,t.realConfig=void 0;var r=n(735534),a=n(750257);function o(e){const{inputs:t,backend:n}=e,{input:r}=t,o=n.texData.get(r.dataId);return(0,a.identity)({inputs:{x:o.complexTensorInfos.real},backend:n})}t.realConfig={kernelName:r.Real,backendName:"webgl",kernelFunc:o}},2883:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.realDivConfig=t.realDiv=void 0;var r=n(735534),a=n(537925);const o=t.realDiv=(0,a.binaryKernelFunc)({opSnippet:"\nif (a == b) {\n return 1.0;\n};\nreturn a / b;",packedOpSnippet:"\n // vec4 one = vec4(equal(a, b));\n // return one + (vec4(1.0) - one) * a / b;\n vec4 result = a / b;\n if(a.x == b.x) {\n result.x = 1.;\n }\n if(a.y == b.y) {\n result.y = 1.;\n }\n if(a.z == b.z) {\n result.z = 1.;\n }\n if(a.w == b.w) {\n result.w = 1.;\n }\n\n return result;\n",checkOutOfBounds:!0});t.realDivConfig={kernelName:r.RealDiv,backendName:"webgl",kernelFunc:o}},580983:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.reciprocalConfig=t.reciprocal=void 0;var r=n(735534),a=n(537925);const o=t.reciprocal=(0,a.unaryKernelFunc)({opSnippet:"return 1.0 / x;"});t.reciprocalConfig={kernelName:r.Reciprocal,backendName:"webgl",kernelFunc:o}},489291:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.reluConfig=t.relu=void 0;var r=n(735534),a=n(537925);const o=n(934500).CHECK_NAN_SNIPPET+"\n return (x < 0.0) ? 0.0 : x;\n",s=t.relu=(0,a.unaryKernelFunc)({opSnippet:o,packedOpSnippet:"\n vec4 result = x * vec4(greaterThanEqual(x, vec4(0.0)));\n bvec4 isNaN = isnan(x);\n\n result.r = isNaN.r ? x.r : result.r;\n result.g = isNaN.g ? x.g : result.g;\n result.b = isNaN.b ? x.b : result.b;\n result.a = isNaN.a ? x.a : result.a;\n\n return result;\n"});t.reluConfig={kernelName:r.Relu,backendName:"webgl",kernelFunc:s}},589283:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.relu6Config=t.relu6=void 0;var r=n(735534),a=n(537925);const o=n(934500).CHECK_NAN_SNIPPET+"\n return (x < 0.0) ? 0.0 : min(6.0, x);
1\n",s=t.relu6=(0,a.unaryKernelFunc)({opSnippet:o,packedOpSnippet:"\n vec4 result = min(x, vec4(6.)) * vec4(greaterThanEqual(x, vec4(0.0)));\n bvec4 isNaN = isnan(x);\n\n result.r = isNaN.r ? x.r : result.r;\n result.g = isNaN.g ? x.g : result.g;\n result.b = isNaN.b ? x.b : result.b;\n result.a = isNaN.a ? x.a : result.a;\n\n return result;\n"});t.relu6Config={kernelName:r.Relu6,backendName:"webgl",kernelFunc:s}},144638:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.reshape=s,t.reshapeConfig=void 0;var r=n(735534),a=n(437287),o=n(519617);function s(e){const{inputs:t,backend:n,attrs:s}=e,{x:i}=t,{shape:c}=s,l=n,u=r.util.sizeFromShape(i.shape),d=r.util.inferFromImplicitShape(c,u),p=r.util.sizeFromShape(d);r.util.assert(u===p,(()=>"The new shape (".concat(d,") has ").concat(p," elements and the old ")+"shape (".concat(i.shape,") has ").concat(u," elements. The new shape and old ")+"shape must have the same number of elements."));const h=l.texData.get(i.dataId);return!h.isPacked||(0,o.isReshapeFree)(i.shape,d)||null!==h.texture&&(0,o.isReshapeFree)(h.shape,d)?(l.incRef(i.dataId),{dataId:i.dataId,shape:d,dtype:i.dtype}):(0,a.packedReshape)(i,d,l)}t.reshapeConfig={kernelName:r.Reshape,backendName:"webgl",kernelFunc:s}},989210:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.resizeBilinear=s,t.resizeBilinearConfig=void 0;var r=n(735534),a=n(881898),o=n(425419);function s(e){const{inputs:t,backend:n,attrs:s}=e,{images:i}=t,{alignCorners:c,halfPixelCenters:l,size:u}=s,[d,p]=u,h=(0,r.env)().getBool("WEBGL_PACK_IMAGE_OPERATIONS")?new o.ResizeBilinearPackedProgram(i.shape,d,p,c,l):new a.ResizeBilinearProgram(i.shape,d,p,c,l);return n.runWebGLProgram(h,[i],"float32")}t.resizeBilinearConfig={kernelName:r.ResizeBilinear,backendName:"webgl",kernelFunc:s}},236758:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.resizeBilinearGrad=o,t.resizeBilinearGradConfig=void 0;var r=n(735534),a=n(63622);function o(e){const{inputs:t,backend:n,attrs:r}=e,{images:o,dy:s}=t,{alignCorners:i}=r,c=new a.ResizeBilinearBackpropProgram(s.shape,o.shape,i);return n.runWebGLProgram(c,[s],s.dtype)}t.resizeBilinearGradConfig={kernelName:r.ResizeBilinearGrad,backendName:"webgl",kernelFunc:o}},778450:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.resizeNearestNeighbor=s,t.resizeNearestNeighborConfig=void 0;var r=n(735534),a=n(583929),o=n(210949);function s(e){const{inputs:t,backend:n,attrs:s}=e,{images:i}=t,{alignCorners:c,halfPixelCenters:l,size:u}=s,[d,p]=u,h=(0,r.env)().getBool("WEBGL_PACK_IMAGE_OPERATIONS")?new o.ResizeNearestNeighborPackedProgram(i.shape,d,p,c,l):new a.ResizeNearestNeighborProgram(i.shape,d,p,c,l);return n.runWebGLProgram(h,[i],i.dtype)}t.resizeNearestNeighborConfig={kernelName:r.ResizeNearestNeighbor,backendName:"webgl",kernelFunc:s}},997608:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.resizeNearestNeighborGrad=o,t.resizeNearestNeighborGradConfig=void 0;var r=n(735534),a=n(174583);function o(e){const{inputs:t,backend:n,attrs:r}=e,{images:o,dy:s}=t,{alignCorners:i}=r,c=new a.ResizeNearestNeigborBackpropProgram(s.shape,o.shape,i);return n.runWebGLProgram(c,[s],s.dtype)}t.resizeNearestNeighborGradConfig={kernelName:r.ResizeNearestNeighborGrad,backendName:"webgl",kernelFunc:o}},966369:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.reverse=i,t.reverseConfig=void 0;var r=n(735534),a=n(241467),o=n(941661),s=n(750257);function i(e){const{inputs:t,backend:n,attrs:i}=e,{x:c}=t,{dims:l}=i,u=c.shape.length,d=r.util.parseAxisParam(l,c.shape);if(0===u)return(0,s.identity)({inputs:{x:c},backend:n});const p=(0,r.env)().getBool("WEBGL_PACK_ARRAY_OPERATIONS")?new o.ReversePackedProgram(c.shape,d):new a.ReverseProgram(c.shape,d);return n.runWebGLProgram(p,[c],c.dtype)}t.reverseConfig={kernelName:r.Reverse,backendName:"webgl",kernelFunc:i}},726602:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.rotateWithOffsetConfig=void 0;var r=n(735534),a=n(601928);t.rotateWithOffsetConfig={kernelName:r.RotateWithOffset,backendName:"webgl",kernelFunc:e=>{let{inputs:t,attrs:n,backend:o}=e;const{image:s}=t,{radians:i,fillValue:c,center:l}=n,u=o,d=new a.RotateProgram(s.shape,c),[p,h]=r.backend_util.getImageCenter(l,s.shape[1],s.shape[2]),f=[[p,h,Math.sin(i),Math.cos(i)]];return u.runWebGLProgram(d,[s],s.dtype,f)}}}
1,316428:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.roundConfig=t.round=void 0;var r=n(735534),a=n(537925);const o=t.round=(0,a.unaryKernelFunc)({opSnippet:"\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"});t.roundConfig={kernelName:r.Round,backendName:"webgl",kernelFunc:o}},23778:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.rsqrtConfig=t.rsqrt=void 0;var r=n(735534),a=n(537925),o=n(509570);const s=t.rsqrt=(0,a.unaryKernelFunc)({opSnippet:"return inversesqrt(x);",cpuKernelImpl:o.rsqrtImplCPU});t.rsqrtConfig={kernelName:r.Rsqrt,backendName:"webgl",kernelFunc:s}},322919:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.scatterNd=s,t.scatterNdConfig=void 0;var r=n(735534),a=n(650638),o=n(144638);function s(e){const{inputs:t,backend:n,attrs:s}=e,{indices:i,updates:c}=t,{shape:l}=s,{sliceRank:u,numUpdates:d,sliceSize:p,strides:h,outputSize:f}=r.backend_util.calculateShapes(c,i,l),m=[f/p,p];if(0===f)return n.makeTensorInfo(l,i.dtype);const g=(0,o.reshape)({inputs:{x:i},backend:n,attrs:{shape:[d,u]}}),y=(0,o.reshape)({inputs:{x:c},backend:n,attrs:{shape:[d,p]}}),v=n.makeTensorInfo([],"float32",new Float32Array([0])),b=new a.ScatterProgram(d,u,g.shape.length,y.shape.length,h,m),x=n.runWebGLProgram(b,[y,g,v],y.dtype),w=(0,o.reshape)({inputs:{x:x},backend:n,attrs:{shape:l}});return n.disposeIntermediateTensorInfo(g),n.disposeIntermediateTensorInfo(y),n.disposeIntermediateTensorInfo(x),n.disposeIntermediateTensorInfo(v),w}t.scatterNdConfig={kernelName:r.ScatterNd,backendName:"webgl",kernelFunc:s}},167112:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.select=o,t.selectConfig=void 0;var r=n(735534),a=n(338912);function o(e){const{inputs:t,backend:n}=e,{condition:o,t:s,e:i}=t,c=new a.SelectProgram(o.shape.length,s.shape,s.shape.length);return n.runWebGLProgram(c,[o,s,i],(0,r.upcastType)(s.dtype,i.dtype))}t.selectConfig={kernelName:r.Select,backendName:"webgl",kernelFunc:o}},860890:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.seluConfig=t.selu=void 0;var r=n(735534),a=n(537925);const o="\n // Stable and Attracting Fixed Point (0, 1) for Normalized Weights.\
1n // see: https://arxiv.org/abs/1706.02515\n float scaleAlpha = ".concat(r.backend_util.SELU_SCALEALPHA,";\n float scale = ").concat(r.backend_util.SELU_SCALE,";\n return (x >= 0.0) ? scale * x : scaleAlpha * (exp(x) - 1.0);\n"),s=t.selu=(0,a.unaryKernelFunc)({opSnippet:o});t.seluConfig={kernelName:r.Selu,backendName:"webgl",kernelFunc:s}},923574:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.sigmoidConfig=t.sigmoid=void 0;var r=n(735534),a=n(537925),o=n(509570);const s=a.CHECK_NAN_SNIPPET_UNARY+"\n return 1.0 / (1.0 + exp(-1.0 * x));\n",i=t.sigmoid=(0,a.unaryKernelFunc)({opSnippet:s,packedOpSnippet:"\n vec4 result = 1.0 / (1.0 + exp(-1.0 * x));\n bvec4 isNaN = isnan(x);\n\n result.r = isNaN.r ? x.r : result.r;\n result.g = isNaN.g ? x.g : result.g;\n result.b = isNaN.b ? x.b : result.b;\n result.a = isNaN.a ? x.a : result.a;\n\n return result;\n",cpuKernelImpl:o.sigmoidImplCPU});t.sigmoidConfig={kernelName:r.Sigmoid,backendName:"webgl",kernelFunc:i}},777660:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.signConfig=t.sign=void 0;var r=n(735534),a=n(537925);const o=t.sign=(0,a.unaryKernelFunc)({opSnippet:"\n if (isnan(x)) { return 0.0; }\n return sign(x);\n"});t.signConfig={kernelName:r.Sign,backendName:"webgl",kernelFunc:o}},804156:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.sinConfig=t.sin=void 0;var r=n(735534),a=n(537925);const o=a.CHECK_NAN_SNIPPET_UNARY+"\n return sin(x);\n",s=t.sin=(0,a.unaryKernelFunc)({opSnippet:o});t.sinConfig={kernelName:r.Sin,backendName:"webgl",kernelFunc:s}},819636:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.sinhConfig=t.sinh=void 0;var r=n(735534),a=n(537925);const o=t.sinh=(0,a.unaryKernelFunc)({opSnippet:"\n float e2x = exp(x);\n return (e2x - 1.0 / e2x) / 2.0;\n"});t.sinhConfig={kernelName:r.Sinh,backendName:"webgl",kernelFunc:o}},336963:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.slice=i,t.sliceConfig=void 0;var r=n(735534),a=n(509570),o=n(853877),s=n(611325);function i(e){const{inputs:t,backend:n,attrs:i}=e,{x:c}=t,{begin:l,size:u}=i,[d,p]=r.slice_util.parseSliceParams(c,l,u);if(r.slice_util.assertParamsValid(c,d,p),0===r.util.sizeFromShape(p))return n.makeTensorInfo(p,c.dtype,[]);if(n.shouldExecuteOnCPU([c])||"string"===c.dtype){const e=n.texData.get(c.dataId),t=(0,a.sliceImplCPU)(e.values,d,p,c.shape,c.dtype);return n.makeTensorInfo(p,c.dtype,t)}const{isPacked:h}=n.texData.get(c.dataId),f=r.slice_util.isSliceContinous(c.shape,d,p);if(h||!f){const e=(0,r.env)().getBool("WEBGL_PACK_ARRAY_OPERATIONS")?new s.SlicePackedProgram(p):new o.SliceProgram(p),t=[d];return n.runWebGLProgram(e,[c],c.dtype,t)}return n.uploadToGPU(c.dataId),function(e,t,n,a){const o=a.texData.get(e.dataId),s=a.makeTensorInfo(n,e.dtype),i=a.texData.get(s.dataId);Object.assign(i,o),i.refCount=1,i.shape=n,i.dtype=e.dtype;let c=r.slice_util.computeFlatOffset(t,r.util.computeStrides(e.shape));o.slice&&(c+=o.slice.flatOffset),i.slice={flatOffset:c,origDataId:o.slice&&o.slice.origDataId||e.dataId};const l=a.dataRefCount.get(i.slice.origDataId)||1;return a.dataRefCount.set(i.slice.origDataId,l+1),s}(c,d,p,n)}t.sliceConfig={kernelName:r.Slice,backendName:"webgl",kernelFunc:i}},789276:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.softmax=u,t.softmaxConfig=void 0;var r=n(735534),a=n(538596),o=n(197339),s=n(2883),i=n(144638),c=n(571784),l=n(926749);function u(e){const{inputs:t,backend:n,attrs:u}=e,{logits:d}=t,{dim:p}=u,h=r.util.parseAxisParam([p],d.shape),f=(0,o.max)({inputs:{x:d},backend:n,attrs:{reductionIndices:h,keepDims:!1}}),m=r.backend_util.expandShapeToKeepDim(f.shape,h),g=(0,i.reshape)({inputs:{x:f},backend:n,attrs:{shape:m}}
1),y=(0,c.sub)({inputs:{a:d,b:g},backend:n}),v=(0,a.exp)({inputs:{x:y},backend:n}),b=(0,l.sum)({inputs:{x:v},backend:n,attrs:{axis:h,keepDims:!1}}),x=(0,i.reshape)({inputs:{x:b},backend:n,attrs:{shape:m}}),w=(0,s.realDiv)({inputs:{a:v,b:x},backend:n});return n.disposeIntermediateTensorInfo(f),n.disposeIntermediateTensorInfo(g),n.disposeIntermediateTensorInfo(y),n.disposeIntermediateTensorInfo(v),n.disposeIntermediateTensorInfo(b),n.disposeIntermediateTensorInfo(x),w}t.softmaxConfig={kernelName:r.Softmax,backendName:"webgl",kernelFunc:u}},607665:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.softplusConfig=t.softplus=void 0;var r=n(735534),a=n(537925);const o=t.softplus=(0,a.unaryKernelFunc)({opSnippet:"\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"});t.softplusConfig={kernelName:r.Softplus,backendName:"webgl",kernelFunc:o}},866168:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.spaceToBatchNDConfig=t.spaceToBatchND=void 0;var r=n(735534),a=n(554300),o=n(144638),s=n(291146);const i=e=>{const{inputs:t,backend:n,attrs:i}=e,{x:c}=t,{blockShape:l,paddings:u}=i;r.util.assert(c.shape.length<=4,(()=>"spaceToBatchND for rank > 4 with a WebGL backend not implemented yet"));const d=l.reduce(((e,t)=>e*t)),p=[[0,0]];p.push(...u);for(let e=1+l.length;e<c.shape.length;++e)p.push([0,0]);const h=[],f=(0,a.padV2)({inputs:{x:c},backend:n,attrs:{paddings:p,constantValue:0}}),m=r.backend_util.getReshaped(f.shape,l,d,!1),g=r.backend_util.getPermuted(m.length,l.length,!1),y=r.backend_util.getReshapedPermuted(f.shape,l,d,!1),v=(0,o.reshape)({inputs:{x:f},backend:n,attrs:{shape:m}}
1),b=(0,s.transpose)({inputs:{x:v},backend:n,attrs:{perm:g}}),x=(0,o.reshape)({inputs:{x:b},backend:n,attrs:{shape:y}});return h.push(f),h.push(v),h.push(b),h.forEach((e=>n.disposeIntermediateTensorInfo(e))),x};t.spaceToBatchND=i;t.spaceToBatchNDConfig={kernelName:r.SpaceToBatchND,backendName:"webgl",kernelFunc:i}},964298:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.sparseFillEmptyRows=o,t.sparseFillEmptyRowsConfig=void 0;var r=n(735534),a=n(509570);function o(e){const{inputs:t,backend:n}=e,{indices:r,values:o,denseShape:s,defaultValue:i}=t;if(1!==s.shape.length)throw new Error("Dense shape must be a vector, saw:\n ".concat(s.shape));if(2!==r.shape.length)throw new Error("Indices must be a matrix, saw:\n ".concat(r.shape));if(1!==o.shape.length)throw new Error("Values must be a vector, saw:\n ".concat(o.shape));if(0!==i.shape.length)throw new Error("Default value must be a scalar, saw:\n ".concat(i.shape));const c=n.readSync(r.dataId),l=n.readSync(o.dataId),u=n.readSync(s.dataId),d=n.readSync(i.dataId)[0],[p,h,f,m,g]=(0,a.sparseFillEmptyRowsImplCPU)(c,r.shape,r.dtype,l,o.dtype,u,d);return[n.makeTensorInfo(h,r.dtype,p),n.makeTensorInfo([h[0]],o.dtype,f),n.makeTensorInfo([m.length],"bool",new Uint8Array(m.map((e=>Number(e))))),n.makeTensorInfo([g.length],r.dtype,new Int32Array(g))]}t.sparseFillEmptyRowsConfig={kernelName:r.SparseFillEmptyRows,backendName:"webgl",kernelFunc:o}},543760:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.sparseReshape=o,t.sparseReshapeConfig=void 0;var r=n(735534),a=n(509570);function o(e){const{inputs:t,backend:n}=e,{inputIndices:r,inputShape:o,newShape:s}=t;if(2!==r.shape.length)throw new Error("Input indices should be a matrix but received shape ".concat(r.shape));if(1!==o.shape.length)throw new Error("Input shape should be a vector but received shape ".concat(o.shape));if(1!==s.shape.length)throw new Error("Target shape should be a vector but received shape ".concat(s.shape));const i=Array.from(n.readSync(o.dataId)),c=n.readSync(r.dataId),l=Array.from(n.readSync(s.dataId)),[u,d,p]=(0,a.sparseReshapeImplCPU)(c,r.shape,r.dtype,i,l);return[n.makeTensorInfo(d,r.dtype,u),n.makeTensorInfo([p.length],s.dtype,new Int32Array(p))]}t.sparseReshapeConfig={kernelName:r.SparseReshape,backendName:"webgl",kernelFunc:o}},67020:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.sparseSegmentMean=o,t.sparseSegmentMeanConfig=void 0;var r=n(735534),a=n(509570);function o(e){const{inputs:t,backend:n}=e,{data:r,indices:o,segmentIds:s}=t;if(r.shape.length<1)throw new Error("Data should be at least 1 dimensional but received scalar");if(1!==o.shape.length)throw new Error("Indices should be a vector but received shape\n ".concat(o.shape));if(1!==s.shape.length)throw new Error("Segment ids should be a vector but received shape\n ".concat(s.shape));const i=n.readSync(r.dataId),c=n.readSync(o.dataId),l=n.readSync(s.dataId),[u,d]=(0,a.sparseSegmentReductionImplCPU)(i,r.shape,r.dtype,c,l,!0);return n.makeTensorInfo(d,r.dtype,u)}t.sparseSegmentMeanConfig={kernelName:r.SparseSegmentMean,backendName:"webgl",kernelFunc:o}},939131:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.sparseSegmentSum=o,t.sparseSegmentSumConfig=void 0;var r=n(735534),a=n(509570);function o(e){const{inputs:t,backend:n}=e,{data:r,indices:o,segmentIds:s}=t;if(r.shape.length<1)throw new Error("Data should be at least 1 dimensional but received scalar");if(1!==o.shape.length)throw new Error("Indices should be a vector but received shape\n ".concat(o.shape));if(1!==s.shape.length)throw new Error("Segment ids should be a vector but received shape\n ".concat(s.shape));const i=n.readSync(r.dataId),c=n.readSync(o.dataId),l=n.readSync(s.dataId),[u,d]=(0,a.sparseSegmentReductionImplCPU)(i,r.shape,r.dtype,c,l);return n.makeTensorInfo(d,r.dtype,u)}t.sparseSegmentSumConfig={kernelName:r.SparseSegmentSum,backendName:"webgl",kernelFunc:o}},24347:(e,t,n)=>{"use strict";
1Object.defineProperty(t,"__esModule",{value:!0}),t.sparseToDense=s,t.sparseToDenseConfig=void 0;var r=n(735534),a=n(650638),o=n(144638);function s(e){const{inputs:t,backend:n,attrs:s}=e,{sparseIndices:i,sparseValues:c,defaultValue:l}=t,{outputShape:u}=s,{sliceRank:d,numUpdates:p,strides:h,outputSize:f}=r.backend_util.calculateShapes(c,i,u),m=new a.ScatterProgram(p,d,i.shape.length,c.shape.length,h,[f,1],!1),g=n.runWebGLProgram(m,[c,i,l],c.dtype),y=(0,o.reshape)({inputs:{x:g},backend:n,attrs:{shape:u}});return n.disposeIntermediateTensorInfo(g),y}t.sparseToDenseConfig={kernelName:r.SparseToDense,backendName:"webgl",kernelFunc:s}},496301:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.splitV=o,t.splitVConfig=void 0;var r=n(735534),a=n(336963);function o(e){const{inputs:t,backend:n,attrs:o}=e,{x:s}=t,{numOrSizeSplits:i,axis:c}=o,l=r.util.parseAxisParam(c,s.shape)[0],u=r.backend_util.prepareSplitSize(s,i,l),d=s.shape.length,p=new Array(d).fill(0),h=s.shape.slice();return u.map((e=>{const t=[...h];t[l]=e;const r=(0,a.slice)({inputs:{x:s},backend:n,attrs:{begin:p,size:t}});return p[l]+=e,r}))}t.splitVConfig={kernelName:r.SplitV,backendName:"webgl",kernelFunc:o}},58527:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.sqrtConfig=t.sqrt=void 0;var r=n(735534),a=n(537925),o=n(509570);const s="return sqrt(x);",i=t.sqrt=(0,a.unaryKernelFunc)({opSnippet:s,packedOpSnippet:s,cpuKernelImpl:o.sqrtImplCPU});t.sqrtConfig={kernelName:r.Sqrt,backendName:"webgl",kernelFunc:i}},152730:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.squareConfig=t.square=void 0;var r=n(735534),a=n(537925);const o=t.square=(0,a.unaryKernelFunc)({opSnippet:"return x * x;"});t.squareConfig={kernelName:r.Square,backendName:"webgl",kernelFunc:o}},195801:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.squaredDifferenceConfig=t.squaredDifference=void 0;var r=n(735534),a=n(537925);const o="return (a - b) * (a - b);",s=t.squaredDifference=(0,a.binaryKernelFunc)({opSnippet:o,packedOpSnippet:o});t.squaredDifferenceConfig={kernelName:r.SquaredDifference,backendName:"webgl",kernelFunc:s}},933154:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.step=o,t.stepConfig=void 0;var r=n(735534),a=n(934500);function o(e){let{inputs:t,attrs:n,backend:r}=e;const{x:o}=t,s=a.CHECK_NAN_SNIPPET+"\n return x > 0.0 ? 1.0 : float(".concat(n.alpha,");\n "),i=new a.UnaryOpProgram(o.shape,s);return r.runWebGLProgram(i,[o],o.dtype)}t.stepConfig={kernelName:r.Step,backendName:"webgl",kernelFunc:o}},831058:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.stridedSlice=c,t.stridedSliceConfig=void 0;var r=n(735534),a=n(509570),o=n(143680),s=n(144638),i=n(336963);function c(e){const{inputs:t,backend:n,attrs:c}=e,{x:l}=t,{begin:u,end:d,strides:p,beginMask:h,endMask:f,ellipsisMask:m,newAxisMask:g,shrinkAxisMask:y}=c,{finalShapeSparse:v,finalShape:b,isIdentity:x,sliceDim0:w,isSimpleSlice:k,begin:_,end:C,strides:P}=r.slice_util.sliceInfo(l.shape,u,d,p,h,f,m,g,y);let O;if(x)O=(0,s.reshape)({inputs:{x:l},backend:n,attrs:{shape:b}});else if(w||k){r.util.assert(l.shape.length>=1,(()=>"Input must have rank at least 1, got: ".concat(l.shape.length)));const e=r.slice_util.computeOutShape(_,C,P),t=(0,i.slice)({inputs:{x:l},backend:n,attrs:{begin:_,size:e}});O=(0,s.reshape)({inputs:{x:t},backend:n,attrs:{shape:b}}),n.disposeIntermediateTensorInfo(t)}else{if(n.shouldExecuteOnCPU([l])){const e=n.readSync(l.dataId),t=(0,r.buffer)(l.shape,l.dtype,e),o=(0,a.stridedSliceImplCPU)(v,t,P,_);O=n.makeTensorInfo(b,l.dtype,o.values)}else{const e=new o.StridedSliceProgram(_,P,v);O=n.runWebGLProgram(e,[l],l.dtype)}}const N=(0,s.reshape)({inputs:{x:O},backend:n,attrs:{shape:b}});return n.disposeIntermediateTensorInfo(O),N}t.stridedSliceConfig={kernelName:r.StridedSlice,backendName:"webgl",kernelFunc:c}},147967:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.stringNGrams=o,t.stringNGramsConfig=void 0;var r=n(735534),a=n(509570);function o(e){const{inputs:t,backend:n,attrs:r}
1=e,{separator:o,nGramWidths:s,leftPad:i,rightPad:c,padWidth:l,preserveShortSequences:u}=r,{data:d,dataSplits:p}=t,h=n.readSync(d.dataId),f=n.readSync(p.dataId),[m,g]=(0,a.stringNGramsImplCPU)(h,f,o,s,i,c,l,u);return[n.makeTensorInfo([m.length],"string",m),n.makeTensorInfo(p.shape,"int32",g)]}t.stringNGramsConfig={kernelName:r.StringNGrams,backendName:"webgl",kernelFunc:o}},528643:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.stringSplit=o,t.stringSplitConfig=void 0;var r=n(735534),a=n(509570);function o(e){const{inputs:t,backend:n,attrs:r}=e,{skipEmpty:o}=r,{input:s,delimiter:i}=t;if("string"!==s.dtype)throw new Error("Input must be of datatype string");if(1!==s.shape.length)throw new Error("Input must be a vector, got shape: ".concat(s.shape));if(0!==i.shape.length)throw new Error("Delimiter must be a scalar, got shape: ".concat(i.shape));const c=n.readSync(s.dataId),l=n.readSync(i.dataId)[0],[u,d,p]=(0,a.stringSplitImplCPU)(c,l,o),h=d.length;return[n.makeTensorInfo([h,2],"int32",u),n.makeTensorInfo([h],"string",d),n.makeTensorInfo([2],"int32",new Int32Array(p))]}t.stringSplitConfig={kernelName:r.StringSplit,backendName:"webgl",kernelFunc:o}},727168:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.stringToHashBucketFast=o,t.stringToHashBucketFastConfig=void 0;var r=n(735534),a=n(509570);function o(e){const{inputs:t,backend:n,attrs:r}=e,{numBuckets:o}=r,{input:s}=t;if("string"!==s.dtype)throw new Error("Input must be of datatype string");if(o<=0)throw new Error("Number of buckets must be at least 1");const i=n.readSync(s.dataId),c=(0,a.stringToHashBucketFastImplCPU)(i,o);return n.makeTensorInfo(s.shape,"int32",c)}t.stringToHashBucketFastConfig={kernelName:r.StringToHashBucketFast,backendName:"webgl",kernelFunc:o}},571784:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.subConfig=t.sub=void 0;var r=n(735534),a=n(537925),o=n(509570);const s="return a - b;",i=t.sub=(0,a.binaryKernelFunc)({opSnippet:s,packedOpSnippet:s,supportsComplex:!0,cpuKernelImpl:o.subImplCPU});t.subConfig={kernelName:r.Sub,backendName:"webgl",kernelFunc:i}}
1,926749:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.sum=o,t.sumConfig=void 0;var r=n(735534),a=n(400385);function o(e){const{inputs:t,backend:n,attrs:r}=e,{x:o}=t,{axis:s,keepDims:i}=r;return(0,a.sumImpl)(o,s,i,n)}t.sumConfig={kernelName:r.Sum,backendName:"webgl",kernelFunc:o}},400385:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.sumImpl=function(e,t,n,i){const c=t,l=e.shape.length,u=r.util.parseAxisParam(c,e.shape);let d=u;const p=r.backend_util.getAxesPermutation(d,l),h=null!=p;let f=e;h&&(f=(0,s.transposeImpl)(e,p,i),d=r.backend_util.getInnerMostAxes(d.length,l));r.backend_util.assertAxesAreInnerMostDims("sum",d,l);const[m,g]=r.backend_util.computeOutAndReduceShapes(f.shape,d);let y=m;n&&(y=r.backend_util.expandShapeToKeepDim(m,u));const v=r.util.sizeFromShape(g),b=r.util.sizeFromShape(e.shape)/v,x=(0,o.reshape)({inputs:{x:f},attrs:{shape:[b,v]},backend:i}),w=(0,r.sumOutType)(e.dtype),k=(0,a.reduce)(x,w,"sum",i),_=(0,o.reshape)({inputs:{x:k},attrs:{shape:y},backend:i});i.disposeIntermediateTensorInfo(x),i.disposeIntermediateTensorInfo(k),h&&i.disposeIntermediateTensorInfo(f);return _};var r=n(735534),a=n(531305),o=n(144638),s=n(950760)},838768:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.tanConfig=t.tan=void 0;var r=n(735534),a=n(537925);const o=t.tan=(0,a.unaryKernelFunc)({opSnippet:"return tan(x);"});t.tanConfig={kernelName:r.Tan,backendName:"webgl",kernelFunc:o}},101291:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.tanhConfig=t.tanh=void 0;var r=n(735534),a=n(537925);const o=t.tanh=(0,a.unaryKernelFunc)({opSnippet:"\n float e2x = exp(-2.0 * abs(x));\n return sign(x) * (1.0 - e2x) / (1.0 + e2x);\n"});t.tanhConfig={kernelName:r.Tanh,backendName:"webgl",kernelFunc:o}},518998:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.tile=s,t.tileConfig=void 0;var r=n(735534),a=n(509570),o=n(395954);function s(e){const{inputs:t,backend:n,attrs:s}=e,{x:i}=t,{reps:c}=s;if("string"===i.dtype||i.shape.length>5){const e=n.readSync(i.dataId),t="string"===i.dtype?e.map((e=>r.util.decodeString(e))):e,o=(0,r.buffer)(i.shape,i.dtype,t),s=(0,a.tileImplCPU)(o,c);return n.makeTensorInfo(s.shape,s.dtype,s.values)}const l=new o.TileProgram(i.shape,c);return n.runWebGLProgram(l,[i],i.dtype)}t.tileConfig={kernelName:r.Tile,backendName:"webgl",kernelFunc:s}},433744:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.topK=p,t.topKConfig=void 0;var r=n(735534),a=n(509570),o=n(128603),s=n(531075),i=n(752555),c=n(144638),l=n(336963);function u(e,t){null!==t&&e.disposeIntermediateTensorInfo(t)}function d(e){let t=1;for(;t<e;)t*=2;return t}function p(e){const{inputs:t,backend:n,attrs:p}=e,{x:h}=t,{k:f,sorted:m}=p,g=(0,r.env)().getNumber("TOPK_LAST_DIM_CPU_HANDOFF_SIZE_THRESHOLD"),y=(0,r.env)().getNumber("TOPK_K_CPU_HANDOFF_THRESHOLD"),v=h.shape,b=v[v.length-1];if(n.shouldExecuteOnCPU([h])||b<g||f>y){const e=n.readSync(h.dataId),[t,r]=(0,a.topKImplCPU)(e,v,h.dtype,f,m);return[n.makeTensorInfo(t.shape,t.dtype,t.values),n.makeTensorInfo(r.shape,r.dtype,r.values)]}if(0===f)return v[v.length-1]=0,[n.makeTensorInfo(v,h.dtype,[]),n.makeTensorInfo(v,"int32",[])];if(1===b)return[h,(0,s.fill)({attrs:{shape:v,dtype:"int32",value:0},backend:n})];const x=n.texData.get(h.dataId),w=null!==x&&x.isPacked,k=w?n.unpackTensor(h):h,_=r.util.sizeFromShape(v)/b,C=(0,c.reshape)({inputs:{x:k},attrs:{shape:[_,b]},backend:n});w&&u(n,k);const P=d(f),O=d(b);let N=null;const I=()=>null===N?[C,C]:[C,N],T=(e,t,r)=>{const a=I(),s=new o.SwapProgram(r),i=[[b],[null===N?1:0],[Number.NEGATIVE_INFINITY],[e],[t]],c=N;N=n.runWebGLProgram(s,a,"int32",i),u(n,c)};for(let e=1;e<P;e*=2){const t=2*e;for(let n=e;n>=1;n/=2)T(t,n,[_,O])}for(let e=O;e>P;e/=2){const t=I(),r=new o.MergeProgram([_,e/2]),a=[[b],[null===N?1:0],[P]],s=N;N=n.runWebGLProgram(r,t,"int32",a),u(n,s);const i=P/2,c=2*i;for(let e=i;e>=1;e/=2)T(c,e,N.shape)}let S=N;N=(0,l.slice)({inputs:{x:N},backend:n,attrs:{begin:0,size:[_,f]}}),u(n,S);let E=(0,i.gatherV2)({inputs:{x:C,indices:N},backend:n,attrs:{axis:1,batchDims:1}});u(n,C);const M=v.slice(0,-1);
1M.push(f),S=N,N=(0,c.reshape)({inputs:{x:N},attrs:{shape:M},backend:n}),u(n,S);const A=E;return E=(0,c.reshape)({inputs:{x:E},attrs:{shape:M},backend:n}),u(n,A),[E,N]}t.topKConfig={kernelName:r.TopK,backendName:"webgl",kernelFunc:p}},504955:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.transform=o,t.transformConfig=void 0;var r=n(735534),a=n(508334);function o(e){const{inputs:t,backend:n,attrs:r}=e,{image:o,transforms:s}=t,{interpolation:i,fillMode:c,fillValue:l,outputShape:u}=r,[d,p,h,f]=o.shape,[m,g]=null!=u?u:[p,h],y=[d,m,g,f],v=new a.TransformProgram(p,h,i,c,l,y);return n.runWebGLProgram(v,[o,s],"float32")}t.transformConfig={kernelName:r.Transform,backendName:"webgl",kernelFunc:o}},291146:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.transpose=o,t.transposeConfig=void 0;var r=n(735534),a=n(950760);function o(e){const{inputs:t,backend:n,attrs:r}=e,{x:o}=t,{perm:s}=r,i=n,c=o.shape.length,l=new Array(c);for(let e=0;e<l.length;e++)l[e]=o.shape[s[e]];let u;if(i.shouldExecuteOnCPU([o])){const e=i.texData.get(o.dataId).values,t=(0,a.transposeImplCPU)(e,o.shape,o.dtype,s,l);u=i.makeTensorInfo(l,o.dtype);i.texData.get(u.dataId).values=t}else u=(0,a.transposeImpl)(o,s,i);return u}t.transposeConfig={kernelName:r.Transpose,backendName:"webgl",kernelFunc:o}},950760:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.transposeImpl=function(e,t,n){const a=(0,r.env)().getBool("WEBGL_PACK_ARRAY_OPERATIONS")?new s.TransposePackedProgram(e.shape,t):new o.TransposeProgram(e.shape,t);return n.runWebGLProgram(a,[e],e.dtype)},Object.defineProperty(t,"transposeImplCPU",{enumerable:!0,get:function(){return a.transposeImplCPU}});var r=n(735534),a=n(509570),o=n(674678),s=n(480750)},612757:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.unique=s,t.uniqueConfig=void 0;var r=n(735534),a=n(509570),o=n(519617);function s(e){const{inputs:t,attrs:n,backend:r}=e,{axis:s}=n,{x:i}=t;(0,o.assertNotComplex)(i,"unique"),console.warn("WARNING: ","UI might be locked temporarily as data is being downloaded");const c=r.readSync(i.dataId),{outputValues:l,outputShape:u,indices:d}=(0,a.uniqueImplCPU)(c,s,i.shape,i.dtype);return[r.makeTensorInfo(u,i.dtype,l),r.makeTensorInfo([d.length],"int32",d)]}t.uniqueConfig={kernelName:r.Unique,backendName:"webgl",kernelFunc:s}},279898:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.unpack=s,t.unpackConfig=void 0;var r=n(735534),a=n(144638),o=n(336963);function s(e){const{inputs:t,backend:n,attrs:r}=e,{value:s}=t;let{axis:i}=r;i<0&&(i+=s.shape.length);const c=s,l=c.shape.length,u=s.shape[i],d=new Array(l-1);let p=0;for(let e=0;e<l;e++)e!==i&&(d[p++]=c.shape[e]);const h=[],f=new Array(l).fill(0),m=c.shape.slice();m[i]=1;const g=new Array(u);for(let e=0;e<g.length;e++){f[i]=e;const t=(0,o.slice)({inputs:{x:c},backend:n,attrs:{begin:f,size:m}}),r=(0,a.reshape)({inputs:{x:t},backend:n,attrs:{shape:d}});g[e]=r,h.push(t)}return h.forEach((e=>n.disposeIntermediateTensorInfo(e))),g}t.unpackConfig={kernelName:r.Unpack,backendName:"webgl",kernelFunc:s}},662044:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.unsortedSegmentSum=l,t.unsortedSegmentSumConfig=void 0;var r=n(735534),a=n(2130),o=n(526560),s=n(144638),i=n(518998),c=n(291146);function l(e){const{inputs:t,backend:n,attrs:l}=e,{x:u,segmentIds:d}=t,{numSegments:p}=l,h=u.shape.length,f=[];let m=0;const g=r.backend_util.getAxesPermutation([m],h);let y=u;
1null!=g&&(y=(0,c.transpose)({inputs:{x:u},backend:n,attrs:{perm:g}}),f.push(y),m=r.backend_util.getInnerMostAxes(1,h)[0]);const v=r.backend_util.segment_util.computeOutShape(y.shape,m,p),b=r.util.sizeFromShape([y.shape[m]]),x=(0,s.reshape)({inputs:{x:y},backend:n,attrs:{shape:[-1,b]}});f.push(x);const w=(0,r.sumOutType)(u.dtype),k=(e,t,s,c,l)=>{const u=e.shape[0],d=e.shape[1],p=r.backend_util.segment_util.segOpComputeOptimalWindowSize(d,l),h={windowSize:p,inSize:d,batchSize:u,numSegments:l},m=new a.SegmentOpProgram(h,t),g=n.compileAndRun(m,[e,s],c);if(f.push(g),g.shape[1]===l)return g;const y=(0,o.range)({backend:n,attrs:{start:0,stop:l,step:1,dtype:"float32"}}),v=(0,i.tile)({inputs:{x:y},backend:n,attrs:{reps:[d/p]}});f.push(y),f.push(v);return k(g,t,v,c,l)},_=k(x,"unsortedSegmentSum",d,w,p),C=(0,s.reshape)({inputs:{x:_},backend:n,attrs:{shape:v}});let P=C;if(null!=g){f.push(C);const e=r.backend_util.getUndoAxesPermutation(g);P=(0,c.transpose)({inputs:{x:P},backend:n,attrs:{perm:e}})}return f.forEach((e=>n.disposeIntermediateTensorInfo(e))),P}t.unsortedSegmentSumConfig={kernelName:r.UnsortedSegmentSum,backendName:"webgl",kernelFunc:l}},407163:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.zerosLike=c,t.zerosLikeConfig=void 0;var r=n(735534),a=n(63255),o=n(531075),s=n(859559),i=n(723295);function c(e){const{inputs:t,backend:n}=e,{x:r}=t;
1if("complex64"===r.dtype){const e=(0,i.real)({inputs:{input:r},backend:n}),t=c({inputs:{x:e},backend:n}),o=(0,s.imag)({inputs:{input:r},backend:n}),l=c({inputs:{x:o},backend:n}),u=(0,a.complex)({inputs:{real:t,imag:l},backend:n});return n.disposeIntermediateTensorInfo(e),n.disposeIntermediateTensorInfo(t),n.disposeIntermediateTensorInfo(o),n.disposeIntermediateTensorInfo(l),u}return(0,o.fill)({attrs:{shape:r.shape,dtype:r.dtype,value:"string"===r.dtype?"":0},backend:n})}t.zerosLikeConfig={kernelName:r.ZerosLike,backendName:"webgl",kernelFunc:c}},843625:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t._fusedMatMul=o,t._fusedMatMulConfig=void 0;var r=n(735534),a=n(625358);function o(e){const{inputs:t,backend:n,attrs:r}=e,{a:o,b:s,bias:i,preluActivationWeights:c}=t,{transposeA:l,transposeB:u,activation:d,leakyreluAlpha:p}=r;return(0,a.batchMatMulImpl)({a:o,b:s,transposeA:l,transposeB:u,backend:n,bias:i,preluActivationWeights:c,leakyreluAlpha:p,activation:d})}t._fusedMatMulConfig={kernelName:r._FusedMatMul,backendName:"webgl",kernelFunc:o}}
1,362114:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.LRNProgram=void 0;t.LRNProgram=class{constructor(e,t,n,r,a){this.variableNames=["x"],this.outputShape=[];const o=t,s=e[3]-1;let i;this.outputShape=e;const c="float(".concat(n,") + float(").concat(r,") * sum");i=.5===a?"inversesqrt(".concat(c,")"):1===a?"1.0/(".concat(c,")"):"exp(log(".concat(c,") * float(-").concat(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 = -".concat(o,"; j <= ").concat(o,"; j++) {\n int idx = d + j;\n if (idx >= 0 && idx <= ").concat(s,") {\n float z = getX(b, r, c, idx);\n sum += z * z;\n }\n }\n float val = x * ").concat(i,";\n setOutput(val);\n }\n ")}}},111759:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.LRNGradProgram=void 0;t.LRNGradProgram=class{constructor(e,t,n,r,a){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=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\n float result = 0.0;\n for (int d = 0; d < ".concat(this.depth,"; ++d) {\n int depthBegin = int(max(0.0, float(d - ").concat(t,")));\n int depthEnd = int(min(float(").concat(this.depth,"),\n float(d + ").concat(t," + 1)));\n\n const int MIN_DEPTH_BEGIN = 0;\n const int MAX_DEPTH_END = ").concat(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(").concat(r,") * norm + float(").concat(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(").concat(r,")\n * float(").concat(a,")\n * getInputImage(b ,r ,c, k) * getOutputImage(b, r, c, d)\n / norm;\n if (k == d) {\n dyi += pow(norm, -1.0 * ").concat(a,");\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 ")}}},525504:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.LRNPackedProgram=void 0;t.LRNPackedProgram=class{constructor(e,t,n,r,a){this.variableNames=["x"],this.outputShape=[],this.packedInputs=!0,this.packedOutput=!0;const o=t,s=e[3]-1;let i;this.outputShape=e;const c="float(".concat(n,") + float(").concat(r,") * sum");i=.5===a?"inversesqrt(".concat(c,")"):1===a?"1.0/(".concat(c,")"):"exp(log(".concat(c,") * float(-").concat(a,"));"),this.userCode="\n void main() {\n ivec4 coords = getOutputCoords();\n int b = coords.x;\n int r = coords.y;\n int c = coords.z;\n int d = coords.w;\n\n bool hasNextCol = d < ".concat(this.outputShape[3],";\n bool hasNextRow = c < ").concat(this.outputShape[2],";\n\n vec4 sum = vec4(0.);\n vec4 xFragAtOutputCoords = getX(b, r, c, d);\n\n vec4 xAtOutputCoords = vec4(\n getChannel(xFragAtOutputCoords, vec2(c, d)),\n hasNextCol ?\n getChannel(xFragAtOutputCoords, vec2(c, d + 1)) : 0.0,\n hasNextRow ?\n getChannel(xFragAtOutputCoords , vec2(c + 1, d)) : 0.0,\n (hasNextRow && hasNextCol) ?\n getChannel(xFragAtOutputCoords, vec2(c + 1, d + 1)) : 0.0\n );\n\n int firstChannel = d - ").concat(o,";\n vec2 cache = vec2(0.);\n if(firstChannel >= 0){\n vec4 firstChannelFrag = getX(b, r, c, firstChannel);\n cache.x = getChannel(firstChannelFrag, vec2(c, firstChannel));\n if(hasNextRow){\n cache.y = getChannel(firstChannelFrag, vec2(c + 1, firstChannel));\n }\n }
1\n\n ivec2 depth = ivec2(d, d + 1);\n for (int j = - ").concat(o,"; j <= ").concat(o,"; j++) {\n ivec2 idx = depth + j;\n bvec2 aboveLowerBound = greaterThanEqual(idx, ivec2(0));\n bvec2 belowUpperBound = lessThanEqual(idx, ivec2(").concat(s,"));\n\n bool depthInRange = aboveLowerBound.x && belowUpperBound.x;\n bool depthPlusOneInRange = aboveLowerBound.y && belowUpperBound.y;\n\n if(depthInRange || depthPlusOneInRange){\n vec4 z = vec4(0.);\n vec4 xFragAtCurrentDepth;\n z.xz = cache.xy;\n if(depthPlusOneInRange && hasNextCol){\n xFragAtCurrentDepth = idx.y != d ?\n getX(b, r, c, idx.y) : xFragAtOutputCoords;\n z.y = getChannel(xFragAtCurrentDepth, vec2(c, idx.y));\n if(hasNextRow){\n z.w = getChannel(xFragAtCurrentDepth, vec2(c + 1, idx.y));\n }\n }\n cache.xy = z.yw;\n sum += z * z;\n }\n }\n vec4 result = xAtOutputCoords * ").concat(i,";\n setOutput(result);\n }\n ")}}},862242:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.MaxPool3DBackpropProgram=t.MaxPool2DBackpropProgram=void 0;t.MaxPool2DBackpropProgram=class{constructor(e){this.variableNames=["dy","maxPos"],this.outputShape=e.inShape;const t=e.strideHeight,n=e.strideWidth,r=e.dilationHeight,a=e.effectiveFilterHeight,o=e.effectiveFilterWidth,s=a-1-e.padInfo.top,i=o-1-e.padInfo.left,c=a*o-1;this.userCode="\n const ivec2 pads = ivec2(".concat(s,", ").concat(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 < ").concat(a,";\n wR += ").concat(r,") {\n float dyR = float(dyRCorner + wR) / ").concat(t,".0;\n\n if (dyR < 0.0 || dyR >= ").concat(e.outHeight,".0 || fract(dyR) > 0.0) {\n continue;\n }\n int idyR = int(dyR);\n\n for (int wC = 0; wC < ").concat(o,"; wC++) {\n float dyC = float(dyCCorner + wC) / ").concat(n,".0;\n\n if (dyC < 0.0 || dyC >= ").concat(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 = ").concat(c," - 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 * ").concat(o," + wC;\n float mask = float(maxPosValue == curPosValue ? 1.0 : 0.0);\n\n dotProd += dyValue * mask;\n }\n }\n setOutput(dotProd);\n }\n ")}};t.MaxPool3DBackpropProgram=class{constructor(e){this.variableNames=["dy","maxPos"],this.outputShape=e.inShape;const t=e.strideDepth,n=e.strideHeight,r=e.strideWidth,a=e.dilationDepth,o=e.dilationHeight,s=e.dilationWidth,i=e.effectiveFilterDepth,c=e.effectiveFilterHeight,l=e.effectiveFilterWidth,u=i-1-e.padInfo.front,d=c-1-e.padInfo.top,p=l-1-e.padInfo.left,h=i*c*l-1;this.userCode="\n const ivec3 pads = ivec3(".concat(u,", ").concat(d,", ").concat(p,");\n\n void main() {\n ivec5 coords = getOutputCoords();\n int batch = coords.x;\n int ch = coords.u;\n\n ivec3 dyCorner = ivec3(coords.y, coords.z, coords.w) - pads;\n int dyDCorner = dyCorner.x;\n int dyRCorner = dyCorner.y;\n int dyCCorner = dyCorner.z;\n\n // Convolve dy(?, ?, ?, ch) with pos mask(:, :, :, d) to get\n // dx(xD, xR, xC, ch).\n // ? = to be determined. : = across all values in that axis.\n float dotProd = 0.0;\n\n for (int wD = 0; wD < ").concat(i,";\n wD += ").concat(a,") {\n float dyD = float(dyDCorner + wD) / ").concat(t,".0;\n\n if (dyD < 0.0 || dyD >= ").concat(e.outDepth,".0 || fract(dyD) > 0.0) {\n continue;\n }\n int idyD = int(dyD);\n\n for (int wR = 0; wR < ").concat(c,";\n wR += ").concat(o,") {\n float dyR = float(dyRCorner + wR) / ").concat(n,".0;\n\n if (dyR < 0.0 || dyR >= ").concat(e.outHeight,".0 ||\n fract(dyR) > 0.0) {\n continue;\n }\n int idyR = int(dyR);\n\n for (int wC = 0; wC < ").concat(l,";\n wC += ").concat(s,") {\n float dyC = float(dyCCorner + wC) / ").concat(r,".0;\n\n if (dyC < 0.0 || dyC >= ").concat(e.outWidth,".0 ||\n fract(dyC) > 0.0) {\n continue;\n }\n int idyC = int(dyC);\n\n float dyValue = getDy(batch, idyD, idyR, idyC, ch);\n int maxPosValue = ").concat(h," -\n int(getMaxPos(batch, idyD, idyR, idyC, ch));\n\n // Get the current value, check it against the value from the\n // position matrix.\n int curPosValue =\n wD * ").concat(c," * ").concat(l," +\n wR * ").concat(l," + wC;\n float mask = float(maxPosValue == curPosValue ? 1.0 : 0.0);\n\n dotProd += dyValue * mask;\n }\n }\n }\n setOutput(dotProd);\n }\n ")}}}
1,796183:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.MeanProgram=void 0;var r=n(735534);t.MeanProgram=class{constructor(e,t){this.variableNames=["x"];const{windowSize:n,batchSize:a,inSize:o,outSize:s}=e;this.outputShape=[a,s];const i=4*Math.floor(n/4),c=n%4;let l="sumValue += dot(values, ones);";if(null!=t){const e=1/t;l="sumValue += dot(values * ".concat(r.util.isInt(e)?e.toPrecision(2):e,", ones);")}let u="";o%n>0&&(u="\n if (inIdx < 0 || inIdx >= ".concat(o,") {\n return 0.0;\n }\n ")),this.userCode="\n const vec4 ones = vec4(1.0, 1.0, 1.0, 1.0);\n\n float getValue(int batch, int inIdx) {\n ".concat(u,"\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 * ").concat(n,";\n\n float sumValue = 0.0;\n\n for (int i = 0; i < ").concat(i,"; 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 ").concat(l,"\n }\n\n int inIdx = inOffset + ").concat(i,";\n if (").concat(1===c,") {\n vec4 values = vec4(getValue(batch, inIdx), 0.0, 0.0, 0.0);\n\n ").concat(l,"\n } else if (").concat(2===c,") {\n vec4 values = vec4(\n getValue(batch, inIdx),\n getValue(batch, inIdx + 1), 0.0, 0.0);\n\n ").concat(l,"\n } else if (").concat(3===c,") {\n vec4 values = vec4(\n getValue(batch, inIdx),\n getValue(batch, inIdx + 1),\n getValue(batch, inIdx + 2), 0.0);\n\n ").concat(l,"\n }\n setOutput(sumValue);\n }\n ")}}},528893:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.MirrorPadProgram=void 0;var r=n(41990);t.MirrorPadProgram=class{constructor(e,t,n){this.variableNames=["x"],this.outputShape=t.map(((t,n)=>t[0]+e[n]+t[1]));const a=e.length,o=(0,r.getCoordsDataType)(a),s=t.map((e=>e[0])).join(","),i=t.map(((t,n)=>t[0]+e[n])).join(","),c=["coords[0]","coords[1]","coords[2]","coords[3]"].slice(0,a),l="reflect"===n?0:1;this.userCode=1!==a?"\n ".concat(o," start = ").concat(o,"(").concat(s,");\n ").concat(o," end = ").concat(o,"(").concat(i,");\n\n void main() {\n ").concat(o," outC = getOutputCoords();\n for (int i = 0; i < ").concat(a,"; i++) {\n if (outC[i] < start[i]) {\n outC[i] = start[i] * 2 - outC[i] - ").concat(l,";\n } else if(outC[i] >= end[i]) {\n outC[i] = (end[i] - 1) * 2 - outC[i] + ").concat(l,";\n }\n }\n ").concat(o," coords = outC - start;\n setOutput(getX(").concat(c,"));\n }\n "):"\n int start = ".concat(s,";\n int end = ").concat(i,";\n\n void main() {\n int outC = getOutputCoords();\n if (outC < start) {\n outC = start * 2 - outC - ").concat(l,";\n } else if(outC >= end) {\n outC = (end - 1) * 2 - outC + ").concat(l,";\n }\n setOutput(getX(outC - start));\n }\n ")}}},878805:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.MirrorPadPackedProgram=void 0;var r=n(530675),a=n(41990);t.MirrorPadPackedProgram=class{constructor(e,t,n){this.variableNames=["x"],this.packedInputs=!0,this.packedOutput=!0,this.outputShape=t.map(((t,n)=>t[0]+e[n]+t[1]));const o=e.length,s=(0,a.getCoordsDataType)(o),i=t.map((e=>e[0])).join(","),c=t.map(((t,n)=>t[0]+e[n])).join(","),l=(0,r.getChannels)("rc",o),u=(0,r.getChannels)("source",o),d="".concat(l[o-1]," < ").concat(this.outputShape[o-1]),p=1===o?"source":"vec2(".concat(u.slice(-2).join(),")"),h="reflect"===n?0:1;let f="";if(1===o){const e="\n ".concat(s," source = rc;\n if (source < start) {\n source = start * 2 - source - ").concat(h,";\n } else if (source >
1= end) {\n source = (end - 1) * 2 - source + ").concat(h,";\n }\n source -= start;\n ");f="\n ".concat(s," rc = outputLoc;\n ").concat(e,"\n result[0] = getChannel(getX(").concat(u.join(),"), ").concat(p,");\n ").concat(l[o-1]," += 1;\n if(").concat(d,") {\n ").concat(e,"\n result[1] = getChannel(getX(").concat(u.join(),"), ").concat(p,");\n }\n ")}else{const e="\n ".concat(s," source = rc;\n ").concat(s," lt = ").concat(s,"(lessThan(source, start));\n ").concat(s," gte = ").concat(s,"(greaterThanEqual(source, end));\n ").concat(s," orig = 1 - (lt + gte);\n source = orig * source +\n lt * (start * 2 - source - ").concat(h,") +\n gte * ((end - 1) * 2 - source + ").concat(h,");\n source -= start;\n ");f="\n ".concat(s," rc = outputLoc;\n ").concat(e,"\n result[0] = getChannel(getX(").concat(u.join(),"), ").concat(p,");\n ").concat(l[o-1]," += 1;\n if(").concat(d,") {\n ").concat(e,"\n result[1] = getChannel(getX(").concat(u.join(),"), ").concat(p,");\n }\n rc = outputLoc;\n ").concat(l[o-2]," += 1;\n if(").concat(l[o-2]," < ").concat(this.outputShape[o-2],") {\n ").concat(e,"\n result[2] = getChannel(getX(").concat(u.join(),"), ").concat(p,");\n ").concat(l[o-1]," += 1;\n if(").concat(d,") {\n ").concat(e,"\n result[3] = getChannel(getX(").concat(u.join(),"), ").concat(p,");\n }\n }\n ")}this.userCode="\n const ".concat(s," start = ").concat(s,"(").concat(i,");\n const ").concat(s," end = ").concat(s,"(").concat(c,");\n\n void main() {\n ").concat(s," outputLoc = getOutputCoords();\n vec4 result = vec4(0.);\n ").concat(f,"\n setOutput(result);\n }\n ")}}},868472:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.MatMulPackedProgram=void 0;var r=n(965438);t.MatMulPackedProgram=class{constructor(e,t,n){let a=arguments.length>3&&void 0!==arguments[3]&&arguments[3],o=arguments.length>4&&void 0!==arguments[4]&&arguments[4],s=arguments.length>5&&void 0!==arguments[5]&&arguments[5],i=arguments.length>6&&void 0!==arguments[6]?arguments[6]:null,c=arguments.length>7&&void 0!==arguments[7]&&arguments[7],l=arguments.length>8&&void 0!==arguments[8]&&arguments[8];this.variableNames=["matrixA","matrixB"],this.packedInputs=!0,this.packedOutput=!0,this.outputShape=n,this.enableShapeUniforms=(0,r.useShapeUniforms)(this.outputShape.length);const u=a?e[1]:e[2],d=Math.ceil(u/2),p=a?"i * 2, rc.y":"rc.y, i * 2",h=o?"rc.z, i * 2":"i * 2, rc.z",f=a?["a.xxyy","a.zzww"]:["a.xxzz","a.yyww"],m=o?["b.xzxz","b.ywyw"]:["b.xyxy","b.zwzw"];let g="",y="";i&&(g=c?"vec4 activation(vec4 a) {\n vec4 b = getPreluActivationWeightsAtOutCoords();\n ".concat(i,"\n }"):l?"vec4 activation(vec4 a) {\n vec4 b = getLeakyreluAlphaAtOutCoords();\n ".concat(i,"\n }"):"vec4 activation(vec4 x) {\n ".concat(i,"\n }"),y="result = activation(result);");const v=s?"result += getBiasAtOutCoords();":"";s&&this.variableNames.push("bias"),c&&this.variableNames.push("preluActivationWeights"),l&&this.variableNames.push("leakyreluAlpha");let b="rc.x",x="rc.x";e[0]<t[0]?b="int(min(float(rc.x), ".concat(e[0]-1,".))"):t[0]<e[0]&&(x="int(min(float(rc.x), ".concat(t[0]-1,".))")),this.userCode="\n ".concat(g,"\n // Don't use uniform for sharedDimensionPacked for performance.\n const float sharedDimension = ").concat(d,".0;\n\n vec4 dot2x2ARowBCol(ivec3 rc) {\n vec4 result = vec4(0);\n for (int i = 0; i < ").concat(d,"; i++) {\n int batchA = ").concat(b,";\n int batchB = ").concat(x,";\n vec4 a = getMatrixA(batchA, ").concat(p,");\n vec4 b = getMatrixB(batchB, ").concat(h,");\n\n // These swizzled products need to be separately added.\n // See: https://github.com/tensorflow/tfjs/issues/1735\n result += (").concat(f[0]," * ").concat(m[0],");\n result += (").concat(f[1]," * ").concat(m[1],");\n }\n return result;\n }\n\n void main() {\n ivec3 rc = getOutputCoords();
1\n vec4 result = dot2x2ARowBCol(rc);\n\n ").concat(v,"\n\n ").concat(y,"\n\n setOutput(result);\n }\n ")}}},547840:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.MultinomialProgram=void 0;t.MultinomialProgram=class{constructor(e,t,n){this.variableNames=["probs"],this.customUniforms=[{name:"seed",type:"float"}],this.outputShape=[e,n],this.userCode="\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 < ".concat(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(").concat(t-1,"));\n }\n ")}}},890552:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.OneHotProgram=void 0;t.OneHotProgram=class{constructor(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(".concat(r,"), float(").concat(n,"),\n float(index == coords.y)));\n }\n ")}}},446060:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.PackProgram=void 0;var r=n(965438),a=n(530675),o=n(41990);t.PackProgram=class{constructor(e){if(this.variableNames=["A"],this.packedInputs=!1,this.packedOutput=!0,this.outputShape=e,this.rank=e.length,this.enableShapeUniforms=(0,r.useShapeUniforms)(this.outputShape.length),0===this.rank)this.userCode="\n void main() {\n setOutput(vec4(getA(), 0., 0., 0.));\n }\n ";else{const e=(0,a.getChannels)("rc",this.rank),t=(0,o.getCoordsDataType)(this.rank),n=this.getOutOfBoundsCondition(e),r=this.getSetup(e),s=this.getOutput(e);this.userCode="\n void main() {\n ".concat(t," rc = getOutputCoords();\n\n if(").concat(n,") {\n setOutput(vec4(0));\n } else {\n ").concat(r,"\n\n setOutput(vec4(").concat(s,"));\n }\n }\n ")}}getSourceCoordsArr(e){const t=[];for(let n=0;n<=1;n++)for(let r=0;r<=1;r++){let a="".concat(0===n?"r":"rp1",", ").concat(0===r?"c":"cp1");for(let t=2;t<this.rank;t++)a="".concat(e[e.length-1-t],",")+a;t.push(a)}return t}getOutOfBoundsCondition(e){if(1===this.rank)return"rc > ".concat(this.enableShapeUniforms?"outShape":this.outputShape[0]);let t="";for(let n=this.rank-2;n<this.rank;n++)t+="".concat(e[n]," >= ").concat(this.enableShapeUniforms?"outShape[".concat(n,"]"):this.outputShape[n]),n<this.rank-1&&(t+="||");return t}getSetup(e){if(1===this.rank)return"";const t=e.slice(-2),n=this.enableShapeUniforms?"outShape[".concat(this.rank," - 1]"):this.outputShape[this.rank-1],r=this.enableShapeUniforms?"outShape[".concat(this.rank," - 2]"):this.outputShape[this.rank-2];return"\n int r = ".concat(t[0],";\n int c = ").concat(t[1],";\n int rp1 = r + 1;\n int cp1 = c + 1;\n\n bool cEdge = cp1 >= ").concat(n,";\n bool rEdge = rp1 >= ").concat(r,";\n ")}getOutput(e){const t=this.getSourceCoordsArr(e);if(1===this.rank){const e=this.enableShapeUniforms?"outShape":this.outputShape[0];return"getA(rc), (rc + 1 >= ".concat(e," ? 0. : getA(rc + 1)), 0, 0")}return"getA(".concat(t[0],"),\n cEdge ? 0. : getA(").concat(t[1],"),\n rEdge ? 0. : getA(").concat(t[2],"),\n rEdge || cEdge ? 0. : getA(").concat(t[3],")")}}},530675:(e,t)=>{"use strict";function n(e,t){return["x","y","z","w","u","v"].slice(0,t).map((t=>"".concat(e,".").concat(t)))}Object.defineProperty(t,"__esModule",{value:!0}),t.getChannels=function(e,t){if(1===t)return[e];return n(e,t)},t.getSourceCoords=function(e,t){if(1===e)return"rc";let n="";for(let r=0;r<e;r++)n+=t[r],r<e-1&&(n+=",");return n},t.getVecChannels=n},447851:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.PadProgram=void 0;var r=n(41990);t.PadProgram=class{constructor(e,t,n){this.variableNames=["x"],this.customUniforms=[{name:"value",type:"float"}],this.outputShape=t.map(((t,n)=>t[0]+e[n]+t[1]));const a=e.length,o=(0,r.getCoordsDataType)(a),s=t.map((e=>e[0])).join(","),i=t.map(((t,n)=>t[0]+e[n])).join(","),c=["coords[0]","coords[1]","coords[2]","coords[3]"].slice(0,a);this.userCode=1!==a?"\n ".concat(o," start = ").concat(o,"(").concat(s,");\n ").concat(o," end = ").concat(o,"(").concat(i,");\n\n void main() {\n ").concat(o," outC = getOutputCoords();\n if (any(lessThan(outC, start)) || any(greaterThanEqual(outC, end))) {\n setOutput(value);\n } else {\n ").concat(o," coords = outC - start;\n setOutput(getX(").concat(c,"));\n }\n }\n "):"\n int start = ".concat(s,";\n int end = ").concat(i,";\n\n void main() {\n int outC = getOutputCoords();\n if (outC < start || outC >= end) {\n setOutput(value);\n } else {\n setOutput(getX(outC - start));\n }\n }\n ")}}}
1,235023:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.PadPackedProgram=void 0;var r=n(530675),a=n(41990);t.PadPackedProgram=class{constructor(e,t,n){this.variableNames=["x"],this.packedInputs=!0,this.packedOutput=!0,this.customUniforms=[{name:"value",type:"float"}],this.outputShape=t.map(((t,n)=>t[0]+e[n]+t[1]));const o=e.length,s=(0,a.getCoordsDataType)(o),i=t.map((e=>e[0])).join(","),c=t.map(((t,n)=>t[0]+e[n])).join(","),l=(0,r.getChannels)("rc",o),u=(0,r.getChannels)("source",o),d="".concat(l[o-1]," < ").concat(this.outputShape[o-1]),p=1===o?"source":"vec2(".concat(u.slice(-2).join(),")"),h=["".concat(s," rc = outputLoc;"),"".concat(l[o-1]," += 1;\n if(").concat(d,") {\n "),1===o?"":"}\n rc = outputLoc;\n ".concat(l[o-2]," += 1;\n if(").concat(l[o-2]," < ").concat(this.outputShape[o-2],") {"),1===o?"":" ".concat(l[o-1]," += 1;\n if(").concat(d,") {")],f=1===o?"rc < start || rc >= end":"any(lessThan(rc, start)) || any(greaterThanEqual(rc, end))";let m="";for(let e=0,t=1===o?2:4;e<t;e++)m+="\n ".concat(h[e],"\n if (").concat(f,") {\n result[").concat(e,"] = float(value);\n } else {\n ").concat(s," source = rc - start;\n result[").concat(e,"] = getChannel(getX(").concat(u.join(),"), ").concat(p,");\n }\n ");m+=1===o?"} ":"}}",this.userCode="\n const ".concat(s," start = ").concat(s,"(").concat(i,");\n const ").concat(s," end = ").concat(s,"(").concat(c,");\n\n void main() {\n ").concat(s," outputLoc = getOutputCoords();\n vec4 result = vec4(0.);\n ").concat(m,"\n setOutput(result);\n }\n ")}}},19718:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Pool3DProgram=t.Pool2DProgram=void 0;t.Pool2DProgram=class{constructor(e,t,n){let r=arguments.length>3&&void 0!==arguments[3]&&arguments[3],a=arguments.length>4&&void 0!==arguments[4]&&arguments[4];if(this.variableNames=["x"],"avg"===t&&n)throw new Error("Cannot compute positions for average pool.");const o=e.filterWidth,s=e.strideHeight,i=e.strideWidth,c=e.dilationHeight,l=e.dilationWidth,u=e.effectiveFilterHeight,d=e.effectiveFilterWidth,p=e.padInfo.top,h=e.padInfo.left;this.outputShape=e.outShape;const f="avg"===t,m="((batch * ".concat(e.inHeight," + xR) * ").concat(e.inWidth," + xC) * ").concat(e.inChannels," + d"),g="(xR * ".concat(e.inWidth," + xC) * ").concat(e.inChannels," + d");let y="0.0";if(f||(y="-1.0 / 1e-20"),n){const t=">=";return void(this.userCode="\n const ivec2 strides = ivec2(".concat(s,", ").concat(i,");\n const ivec2 pads = ivec2(").concat(p,", ").concat(h,");\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 < ").concat(u,";\n wR += ").concat(c,") {\n int xR = xRCorner + wR;\n\n if (xR < 0 || xR >= ").concat(e.inHeight,") {\n continue;\n }\n\n for (int wC = 0; wC < ").concat(d,";\n wC += ").concat(l,") {\n int xC = xCCorner + wC;\n\n if (xC < 0 || xC >= ").concat(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 ").concat(t," currMinMaxValue) {\n minMaxValue = value;\n minMaxValueFound = 1.0;\n minMaxPosition = ").concat(r?a?m:g:"wR * ".concat(d," + wC"),";\n }\n }\n }\n setOutput(float(minMaxPosition));\n }\n "))}let v="".concat(t,"(").concat(t,"(").concat(t,"(")+"minMaxValue[0], minMaxValue[1]), minMaxValue[2]), minMaxValue[3])";"avg"===t&&(v="avgValue / count");const b=4*Math.floor(o/4),x=o%4,w="\n if (".concat(f,") {\n avgValue += dot(values, ones);\n } else {\n minMaxValue = ").concat("max","(values, minMaxValue);\n }\n ");this.userCode="\n const ivec2 strides = ivec2(".concat(s,", ").concat(i,");\n const ivec2 pads = ivec2(").concat(p,", ").concat(h,");\n const float initializationValue = ").concat(y,";\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 >= ").concat(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(").concat(y,");\n float avgValue = 0.0;\n count = 0.0;\n\n for (int wR = 0; wR < ").concat(u,";\n wR += ").concat(c,") {\n int xR = xRCorner + wR;\n\n if (xR < 0 || xR >= ").concat(e.inHeight,") {\n continue;\n }\n\n for (int wC = 0; wC < ").concat(b,"; wC += 4) {\n int xC = xCCorner + wC * ").concat(l,";\n\n vec4 values = vec4(\n getValue(batch, xR, xC, d),\n getValue(batch, xR, xC + ").concat(l,", d),\n getValue(batch, xR, xC + 2 * ").concat(l,", d),\n getValue(batch, xR, xC + 3 * ").concat(l,", d)\n );\n\n ").concat(w,"\n }\n\n int xC = xCCorner + ").concat(b,";\n if (").concat(1===x,") {\n vec4 values = vec4(\n getValue(batch, xR, xC, d),\n initializationValue,\n initializationValue,\n initializationValue\n );\n\n ").concat(w,"\n } else if (").concat(2===x,") {\n vec4 values = vec4(\n getValue(batch, xR, xC, d),\n getValue(batch, xR, xC + ").concat(l,", d),\n initializationValue,\n initializationValue\n );\n\n ").concat(w,"\n } else if (").concat(3===x,") {\n vec4 values = vec4(\n getValue(batch, xR, xC, d),\n getValue(batch, xR, xC + ").concat(l,", d),\n getValue(batch, xR, xC + 2 * ").concat(l,", d),\n initializationValue\n );\n\n ").concat(w,"\n }\n }\n setOutput(").concat(v,");\n }\n ")}};t.Pool3DProgram=class{constructor(e,t,n){let r=arguments.length>3&&void 0!==arguments[3]&&arguments[3],a=arguments.length>4&&void 0!==arguments[4]&&arguments[4];if(this.variableNames=["x"],"avg"===t&&n)throw new Error("Cannot compute positions for average pool.");const o=e.filterWidth,s=e.strideDepth,i=e.strideHeight,c=e.strideWidth,l=e.dilationDepth,u=e.dilationHeight,d=e.dilationWidth,p=e.effectiveFilterDepth,h=e.effectiveFilterHeight,f=e.effectiveFilterWidth,m=e.padInfo.front,g=e.padInfo.top,y=e.padInfo.left;this.outputShape=e.outShape;const v="avg"===t;let b="0.0";if(v||(b="-1.0 / 1e-20"),n){const t=">=";return void(this.userCode="\n const ivec3 strides =\n ivec3(".concat(s,", ").concat(i,", ").concat(c,");\n const ivec3 pads = ivec3(").concat(m,", ").concat(g,", ").concat(y,");\n\n void main() {\n ivec5 coords = getOutputCoords();\n int batch = coords.x;\n int ch = coords.u;\n\n ivec3 xCorner = ivec3(coords.y, coords.z, coords.w) * strides - pads;\n int xDCorner = xCorner.x;\n int xRCorner = xCorner.y;\n int xCCorner = xCorner.z;\n\n // max/min x(?, ?, ?, ch) to get y(yD, yR, yC, ch).\n // ? = to be determined\n float minMaxValue = 0.0;\n float minMaxValueFound = 0.0;\n int minMaxPosition = 0;\n\n for (int wD = 0; wD < ").concat(p,";\n wD += ").concat(l,") {\n int xD = xDCorner + wD;\n\n if (xD < 0 || xD >= ").concat(e.inDepth,") {\n continue;\n }\n\n for (int wR = 0; wR < ").concat(h,";\n wR += ").concat(u,") {\n int xR = xRCorner + wR;\n\n if (xR < 0 || xR >= ").concat(e.inHeight,") {\n continue;\n }\n\n for (int wC = 0; wC < ").concat(f,";\n wC += ").concat(d,") {\n int xC = xCCorner + wC;\n\n if (xC < 0 || xC >= ").concat(e.inWidth,") {\n continue;\n }\n\n float value = getX(batch, xD, xR, xC, ch);\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 ").concat(t," currMinMaxValue) {\n minMaxValue = value;\n minMaxValueFound = 1.0;\n minMaxPosition = ").concat(r?a?"(((batch * ".concat(e.inDepth," + xD) * ").concat(e.inHeight," + xR) * ").concat(e.inWidth," + xC) * ").concat(e.inChannels," + ch"):"((xD * ".concat(e.inHeight," + xR) * ").concat(e.inWidth," + xC) * ").concat(e.inChannels," + ch"):"wD * ".concat(h," * ").concat(f," +\n wR * ").concat(f," + wC"),";\n }\n }\n }\n }\n setOutput(float(minMaxPosition));\n }\n "))}let x="".concat(t,"(").concat(t,"(").concat(t,"(")+"minMaxValue[0], minMaxValue[1]), minMaxValue[2]), minMaxValue[3])";"avg"===t&&(x="avgValue / count");const w=4*Math.floor(o/4),k=o%4,_="\n if (".concat(v,") {\n avgValue += dot(values, ones);\n } else {\n minMaxValue = ").concat("max","(values, minMaxValue);\n }\n ");this.userCode="\n const ivec3 strides =\n ivec3(".concat(s,", ").concat(i,", ").concat(c,");\n const ivec3 pads = ivec3(").concat(m,", ").concat(g,", ").concat(y,");\n const float initializationValue = ").concat(b,";\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 xD, int xR, int xC, int ch) {\n if (xC < 0 || xC >= ").concat(e.inWidth,") {\n return initializationValue;\n }\n count += 1.0;\n return getX(batch, xD, xR, xC, ch);\n }\n\n void main() {\n ivec5 coords = getOutputCoords();\n int batch = coords.x;\n int ch = coords.u;\n\n ivec3 xCorner = ivec3(coords.y, coords.z, coords.w) * strides - pads;\n int xDCorner = xCorner.x;\n int xRCorner = xCorner.y;\n int xCCorner = xCorner.z;\n\n // max/min x(?, ?, ?, d) to get y(yD, yR, yC, ch).\n // ? = to be determined\n vec4 minMaxValue = vec4(").concat(b,");\n float avgValue = 0.0;\n count = 0.0;\n\n for (int wD = 0; wD < ").concat(p,";\n wD += ").concat(l,") {\n int xD = xDCorner + wD;\n\n if (xD < 0 || xD >= ").concat(e.inDepth,") {\n continue;\n }\n\n for (int wR = 0; wR < ").concat(h,";\n wR += ").concat(u,") {\n int xR = xRCorner + wR;\n\n if (xR < 0 || xR >= ").concat(e.inHeight,") {\n continue;\n }\n\n for (int wC = 0; wC < ").concat(w,"; wC += 4) {\n int xC = xCCorner + wC * ").concat(d,";\n\n vec4 values = vec4(\n getValue(batch, xD, xR, xC, ch),\n getValue(batch, xD, xR, xC + ").concat(d,", ch),\n getValue(batch, xD, xR, xC + 2 * ").concat(d,", ch),\n getValue(batch, xD, xR, xC + 3 * ").concat(d,", ch)\n );\n\n ").concat(_,"\n }\n\n int xC = xCCorner + ").concat(w,";\n if (").concat(1===k,") {\n vec4 values = vec4(\n getValue(batch, xD, xR, xC, ch),\n initializationValue,\n initializationValue,\n initializationValue\n );\n\n ").concat(_,"\n } else if (").concat(2===k,") {\n vec4 values = vec4(\n getValue(batch, xD, xR, xC, ch),\n getValue(batch, xD, xR, xC + ").concat(d,", ch),\n initializationValue,\n initializationValue\n );\n\n ").concat(_,"\n } else if (").concat(3===k,") {\n vec4 values = vec4(\n getValue(batch, xD, xR, xC, ch),\n getValue(batch, xD, xR, xC + ").concat(d,", ch),\n getValue(batch, xD, xR, xC + 2 * ").concat(d,", ch),\n initializationValue\n );\n\n ").concat(_,"\n }\n }\n setOutput(").concat(x,");\n }\n }\n ")}}},316187:(e,t)=>{"use strict";
1Object.defineProperty(t,"__esModule",{value:!0}),t.ReduceProgram=void 0;t.ReduceProgram=class{constructor(e,t){this.variableNames=["x"];const{windowSize:n,batchSize:r,inSize:a,outSize:o}=e;this.outputShape=[r,o];let s="0.0",i="";"prod"===t?s="1.0":"min"===t?(s="1.0 / 1e-20",i="min"):"max"===t&&(s="-1.0 / 1e-20",i="max");let c="".concat(t,"(").concat(t,"(").concat(t,"(")+"minMaxValue[0], minMaxValue[1]), minMaxValue[2]), minMaxValue[3])";"sum"===t?c="sumValue":"prod"===t?c="prodValue":"all"===t?c="allValue":"any"===t&&(c="anyValue");const l=4*Math.floor(n/4),u=n%4;let d="\n if (".concat("sum"===t,") {\n sumValue += dot(values, ones);\n } else if (").concat("prod"===t,") {\n vec2 tmp = vec2(values[0], values[1]) * vec2(values[2], values[3]);\n prodValue *= tmp[0] * tmp[1];\n } else {\n minMaxValue = ").concat(i,"(values, minMaxValue);\n if (").concat("min"===t," || ").concat("max"===t,") {\n minMaxValue = ").concat(i,"(values, minMaxValue);\n bvec4 isNaN = isnan(values);\n if (isNaN.r || isNaN.g || isNaN.b || isNaN.a) {\n minMaxValue = vec4(NAN);\n }\n }\n }\n "),p="vec4";"all"===t?(s="1.0",d="\n bool reducedAllValue = all(values);\n float floatedReducedAllValue = float(reducedAllValue);\n allValue = float(allValue >= 1.0 && floatedReducedAllValue >= 1.0);\n ",p="bvec4"):"any"===t&&(s="0.0",d="\n bool reducedAnyValue = any(values);\n float floatedReducedAnyValue = float(reducedAnyValue);\n anyValue = float(anyValue >= 1.0 || floatedReducedAnyValue >= 1.0);\n ",p="bvec4");let h="";a%n>0&&(h="\n if (inIdx < 0 || inIdx >= ".concat(a,") {\n return initializationValue;\n }\n ")),this.userCode="\n const float initializationValue = ".concat(s,";\n const vec4 ones = vec4(1.0, 1.0, 1.0, 1.0);\n\n float getValue(int batch, int inIdx) {\n ").concat(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 * ").concat(n,";\n\n vec4 minMaxValue = vec4(").concat(s,");\n float prodValue = 1.0;\n float sumValue = 0.0;\n float allValue = 1.0;\n float anyValue = 0.0;\n\n for (int i = 0; i < ").concat(l,"; i += 4) {\n int inIdx = inOffset + i;\n ").concat(p," values = ").concat(p,"(\n getValue(batch, inIdx),\n getValue(batch, inIdx + 1),\n getValue(batch, inIdx + 2),\n getValue(batch, inIdx + 3)\n );\n\n ").concat(d,"\n }\n\n int inIdx = inOffset + ").concat(l,";\n if (").concat(1===u,") {\n ").concat(p," values = ").concat(p,"(\n getValue(batch, inIdx),\n initializationValue,\n initializationValue,\n initializationValue\n );\n\n ").concat(d,"\n } else if (").concat(2===u,") {\n ").concat(p," values = ").concat(p,"(\n getValue(batch, inIdx),\n getValue(batch, inIdx + 1),\n initializationValue,\n initializationValue\n );\n\n ").concat(d,"\n } else if (").concat(3===u,") {\n ").concat(p," values = ").concat(p,"(\n getValue(batch, inIdx),\n getValue(batch, inIdx + 1),\n getValue(batch, inIdx + 2),\n initializationValue\n );\n\n ").concat(d,"\n }\n setOutput(").concat(c,");\n }\n ")}}},461396:(e,t,n)=>{"use strict";var r=n(735534),a=n(843625),o=n(354418),s=n(243635),i=n(901347),c=n(281243),l=n(963064),u=n(258469),d=n(459182),p=n(100747),h=n(706479),f=n(21068),m=n(969205),g=n(764110),y=n(451439),v=n(476755),b=n(244728),x=n(902565),w=n(976689),k=n(593372),_=n(795397),C=n(188244),P=n(816749),O=n(18827),N=n(846504),I=n(682879),T=n(733326),S=n(680518),E=n(63255),M=n(10266),A=n(555022),D=n(505759),R=n(67774),F=n(96365),j=n(932997),z=n(605516),L=n(690426),V=n(373619),G=n(592334),B=n(250714),W=n(796260),U=n(975169),q=n(312887),H=n(947041),K=n(914173),X=n(612330),Y=n(308838),Z=n(426273),J=n(278663),Q=n(212138),$=n(158489),ee=n(498948),te=n(319903),ne=n(538596),re=n(802175),ae=n(949315),oe=n(395779),se=n(531075),ie=n(684087),ce=n(754224),le=n(694524),ue=n(938357),de=n(116222),pe=n(990931),he=n(444678),fe=n(752555),me=n(885909),ge=n(927043),ye=n(750257),ve=n(944951),be=n(859559),xe=n(506418),we=n(728223),ke=n(934104),_e=n(410636),Ce=n(417271),Pe=n(23909),Oe=n(763052),Ne=n(906064),Ie=n(681681),Te=n(936422),Se=n(682055),Ee=n(190033),Me=n(619366),Ae=n(870728),De=n(197339),Re=n(442304),Fe=n(752485),je=n(105474),ze=n(921460),Le=n(738768),Ve=n(605051),Ge=n(724776),Be=n(293696),We=n(462585),Ue=n(640261),qe=n(620241),He=n(466426),Ke=n(810077),Xe=n(258832),Ye=n(964426),Ze=n(42529),Je=n(157649),Qe=n(731579),$e=n(880024),et=n(519925),tt=n(441488),nt=n(554300),rt=n(641596),at=n(750888),ot=n(104492),st=n(526560),it=n(723295),ct=n(2883),lt=n(580983),ut=n(489291),dt=n(589283),pt=n(144638),ht=n(989210),ft=n(236758),mt=n(778450),gt=n(997608),yt=n(966369),vt=n(726602),bt=n(316428),xt=n(23778),wt=n(322919),kt=n(167112),_t=n(860890),Ct=n(923574),Pt=n(777660),Ot=n(804156),Nt=n(819636),It=n(336963),Tt=n(789276),St=n(607665),Et=n(866168),Mt=n(964298),At=n(543760),Dt=n(67020),Rt=n(939131),Ft=n(24347),jt=n(496301),zt=n(58527),Lt=n(152730),Vt=n(195801),Gt=n(933154),Bt=n(831058),Wt=n(147967),Ut=n(528643),qt=n(727168),Ht=n(571784),Kt=n(926749),
1Xt=n(838768),Yt=n(101291),Zt=n(518998),Jt=n(433744),Qt=n(504955),$t=n(291146),en=n(612757),tn=n(279898),nn=n(662044),rn=n(407163);const an=[a._fusedMatMulConfig,o.absConfig,s.acosConfig,i.acoshConfig,c.addConfig,l.addNConfig,u.allConfig,d.anyConfig,p.argMaxConfig,h.argMinConfig,f.asinConfig,m.asinhConfig,g.atanConfig,y.atan2Config,v.atanhConfig,b.avgPoolConfig,x.avgPool3DConfig,w.avgPool3DGradConfig,k.avgPoolGradConfig,_.batchMatMulConfig,C.batchNormConfig,P.batchToSpaceNDConfig,O.bincountConfig,N.broadcastArgsConfig,I.castConfig,T.ceilConfig,S.clipByValueConfig,E.complexConfig,M.complexAbsConfig,A.concatConfig,D.conv2DConfig,R.conv2DBackpropFilterConfig,F.conv2DBackpropInputConfig,j.conv3DConfig,z.conv3DBackpropFilterV2Config,L.conv3DBackpropInputConfig,V.cosConfig,G.coshConfig,B.cropAndResizeConfig,W.cumsumConfig,U.denseBincountConfig,q.depthToSpaceConfig,H.depthwiseConv2dNativeConfig,K.depthwiseConv2dNativeBackpropFilterConfig,X.depthwiseConv2dNativeBackpropInputConfig,Y.diagConfig,Z.dilation2DConfig,J.einsumConfig,Q.eluConfig,$.eluGradConfig,ee.equalConfig,te.erfConfig,ne.expConfig,re.expandDimsConfig,ae.expm1Config,oe.fftConfig,se.fillConfig,ie.flipLeftRightConfig,ce.floorConfig,le.floorDivConfig,ue.fromPixelsConfig,de.fusedConv2DConfig,pe.fusedDepthwiseConv2DConfig,he.gatherNdConfig,fe.gatherV2Config,me.greaterConfig,ge.greaterEqualConfig,ye.identityConfig,ve.ifftConfig,be.imagConfig,xe.isFiniteConfig,we.isInfConfig,ke.isNaNConfig,_e.leakyReluConfig,Ce.lessConfig,Pe.lessEqualConfig,Oe.linSpaceConfig,Ne.logConfig,Ie.log1pConfig,Te.logicalAndConfig,Se.logicalNotConfig,Ee.logicalOrConfig,Me.LRNConfig,Ae.LRNGradConfig,De.maxConfig,Re.maximumConfig,Fe.maxPoolConfig,je.maxPool3DConfig,ze.maxPool3DGradConfig,Le.maxPoolGradConfig,Ve.maxPoolWithArgmaxConfig,Ge.meanConfig,Be.minConfig,We.minimumConfig,Ue.mirrorPadConfig,qe.modConfig,He.multinomialConfig,Ke.multiplyConfig,Xe.negConfig,Ye.nonMaxSuppressionV3Config,Ze.nonMaxSuppressionV4Config,Je.nonMaxSuppressionV5Config,Qe.notEqualConfig,$e.oneHotConfig,et.onesLikeConfig,tt.packConfig,nt.padV2Config,rt.powConfig,at.preluConfig,ot.prodConfig,st.rangeConfig,it.realConfig,ct.realDivConfig,lt.reciprocalConfig,ut.reluConfig,dt.relu6Config,pt.reshapeConfig,ht.resizeBilinearConfig,ft.resizeBilinearGradConfig,mt.resizeNearestNeighborConfig,gt.resizeNearestNeighborGradConfig,yt.reverseConfig,vt.rotateWithOffsetConfig,bt.roundConfig,xt.rsqrtConfig,wt.scatterNdConfig,kt.selectConfig,_t.seluConfig,Ct.sigmoidConfig,Pt.signConfig,Ot.sinConfig,Nt.sinhConfig,It.sliceConfig,Tt.softmaxConfig,St.softplusConfig,Et.spaceToBatchNDConfig,Mt.sparseFillEmptyRowsConfig,At.sparseReshapeConfig,Dt.sparseSegmentMeanConfig,Rt.sparseSegmentSumConfig,Ft.sparseToDenseConfig,jt.splitVConfig,zt.sqrtConfig,Lt.squareConfig,Vt.squaredDifferenceConfig,Gt.stepConfig,Bt.stridedSliceConfig,Wt.stringNGramsConfig,Ut.stringSplitConfig,qt.stringToHashBucketFastConfig,Ht.subConfig,Kt.sumConfig,Xt.tanConfig,Yt.tanhConfig,Zt.tileConfig,Jt.topKConfig,Qt.transformConfig,$t.transposeConfig,en.uniqueConfig,tn.unpackConfig,nn.unsortedSegmentSumConfig,rn.zerosLikeConfig];for(const e of an)(0,r.registerKernel)(e)},769801:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ReshapePackedProgram=void 0;var r=n(965438),a=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=o(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var s in e)if("default"!==s&&{}.hasOwnProperty.call(e,s)){var i=a?Object.getOwnPropertyDescriptor(e,s):null;i&&(i.get||i.set)?Object.defineProperty(r,s,i):r[s]=e[s]}return r.default=e,n&&n.set(e,r),r}(n(270327));function o(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(o=function(e){return e?n:t})(e)}t.ReshapePackedProgram=class{constructor(e,t){this.variableNames=["A"],this.packedInputs=!0,this.packedOutput=!0,this.customUniforms=[{name:"inputShape",type:"ivec3"}],this.outputShape=e,this.enableShapeUniforms=(0,r.useShapeUniforms)(this.outputShape.length);let n="";for(let e=0;e<4;e++){let t="thisRC = rc;";e%2==1&&(t+="thisRC.z += 1;"),e>1&&(t+="thisRC.y += 1;"),n+="\n ".concat(t,"\n ").concat(e>
10?"if(thisRC.y < rows && thisRC.z < cols){":"","\n int flatIndex = getFlatIndex(thisRC);\n\n ivec3 inputRC = inputCoordsFromReshapedOutCoords(flatIndex);\n vec2 inputRCInnerDims = vec2(float(inputRC.y),float(inputRC.z));\n\n result[").concat(e,"] =\n getChannel(getA(inputRC.x, inputRC.y, inputRC.z), inputRCInnerDims);\n ").concat(e>0?"}":"","\n ")}this.userCode="\n ".concat(function(e,t){const n=t?a.getLogicalCoordinatesFromFlatIndexByUniform(["r","c","d"],"inputShape"):a.getLogicalCoordinatesFromFlatIndex(["r","c","d"],e);return"\n ivec3 inputCoordsFromReshapedOutCoords(int index) {\n ".concat(n,"\n return ivec3(r, c, d);\n }\n ")}(t,this.enableShapeUniforms),"\n ").concat(this.enableShapeUniforms?a.getFlatIndexFrom3DOutput():a.getFlatIndexFrom3D(e),"\n\n void main() {\n ivec3 rc = getOutputCoords();\n\n vec4 result = vec4(0.);\n\n ivec3 thisRC;\n int rows = ").concat(this.enableShapeUniforms?"outShape[1]":e[1],";\n int cols = ").concat(this.enableShapeUniforms?"outShape[2]":e[2],";\n\n ").concat(n,"\n\n setOutput(result);\n }\n ")}}},63622:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ResizeBilinearBackpropProgram=void 0;t.ResizeBilinearBackpropProgram=class{constructor(e,t,n){this.variableNames=["dy"],this.outputShape=[],this.outputShape=t;const[,r,a]=t,[,o,s]=e,i=[n&&o>1?r-1:r,n&&s>1?a-1:a],c=[n&&o>1?o-1:o,n&&s>1?s-1:s],l=i[0]/c[0],u=i[1]/c[1],d=1/l,p=1/u,h=2*Math.ceil(d)+2,f=2*Math.ceil(p)+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(".concat(l,");\n const float widthScale = float(").concat(u,");\n\n const float invHeightScale = float(").concat(d,");\n const float invWidthScale = float(").concat(p,");\n\n const int winHeight = int(").concat(h,");\n const int winWidth = int(").concat(f,");\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 >= ").concat(o,") {\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 >= ").concat(s,") {\n continue;\n }\n\n float dxR = float(dyR) * heightScale;\n int topDxRIndex = int(floor(dxR));\n int bottomDxRIndex = int(min(ceil(dxR), ").concat(r-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), ").concat(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 ")}}},881898:(e,t)=>
1{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ResizeBilinearProgram=void 0;t.ResizeBilinearProgram=class{constructor(e,t,n,r,a){this.variableNames=["A"],this.outputShape=[];const[o,s,i,c]=e;this.outputShape=[o,t,n,c];const l=[r&&t>1?s-1:s,r&&n>1?i-1:i],u=[r&&t>1?t-1:t,r&&n>1?n-1:n];let d;d=a?"(vec2(yRC) + vec2(0.5)) * effectiveInputOverOutputRatioRC - vec2(0.5)":"vec2(yRC) * effectiveInputOverOutputRatioRC",this.userCode="\n const vec2 effectiveInputOverOutputRatioRC = vec2(\n ".concat(l[0]/u[0],",\n ").concat(l[1]/u[1],");\n const vec2 inputShapeRC = vec2(").concat(s,".0, ").concat(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 = ").concat(d,";\n\n // Compute the four integer indices.\n ivec2 sourceFloorRC = ivec2(max(sourceFracIndexRC, vec2(0.0)));\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 ")}}},425419:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ResizeBilinearPackedProgram=void 0;t.ResizeBilinearPackedProgram=class{constructor(e,t,n,r,a){this.variableNames=["A"],this.packedInputs=!0,this.packedOutput=!0,this.outputShape=[];const[o,s,i,c]=e;this.outputShape=[o,t,n,c];const l=[r&&t>1?s-1:s,r&&n>1?i-1:i],u=[r&&t>1?t-1:t,r&&n>1?n-1:n];let d;d=a?"(vec3(yRC) + vec3(0.5)) * effectiveInputOverOutputRatioRC - vec3(0.5)":"vec3(yRC) * effectiveInputOverOutputRatioRC",this.userCode="\n const vec3 effectiveInputOverOutputRatioRC = vec3(\n ".concat(l[0]/u[0],",\n ").concat(l[1]/u[1],",\n ").concat(l[1]/u[1],");\n const vec3 inputShapeRC = vec3(").concat(s,".0, ").concat(i,".0,\n ").concat(i,".0);\n\n float getAValue(int b, int r, int c, int d) {\n return getChannel(getA(b, r, c, d), vec2(c, d));\n }\n\n void main() {\n ivec4 coords = getOutputCoords();\n int b = coords[0];\n int d = coords[3];\n // Calculate values for next column in yRC.z.\n ivec3 yRC = coords.yzz + ivec3(0, 0, 1);\n\n // Fractional source index.\n vec3 sourceFracIndexRC = ").concat(d,";\n\n // Compute the four integer indices.\n ivec3 sourceFloorRC = ivec3(max(sourceFracIndexRC, vec3(0.0)));\n ivec3 sourceCeilRC = ivec3(\n min(inputShapeRC - 1.0, ceil(sourceFracIndexRC)));\n\n // Should we calculate next column and row elements in 2x2 packed cell.\n bool hasNextCol = d < ").concat(c-1,";\n bool hasNextRow = coords.z < ").concat(n-1,";\n\n // In parallel, construct four corners for all four components in\n // packed 2x2 cell.\n vec4 topLeft = vec4(\n getAValue(b, sourceFloorRC.x, sourceFloorRC.y, d),\n hasNextCol ? getAValue(b, sourceFloorRC.x, sourceFloorRC.y, d + 1)\n : 0.0,\n hasNextRow ? getAValue(b, sourceFloorRC.x, sourceFloorRC.z, d)\n : 0.0,\n (hasNextRow && hasNextCol) ?\n getAValue(b, sourceFloorRC.x, sourceFloorRC.z, d + 1) : 0.0);\n\n vec4 bottomLeft = vec4(\n getAValue(b, sourceCeilRC.x, sourceFloorRC.y, d),\n hasNextCol ? getAValue(b, sourceCeilRC.x, sourceFloorRC.y, d + 1)\n : 0.0,\n hasNextRow ? getAValue(b, sourceCeilRC.x, sourceFloorRC.z, d)\n : 0.0,\n (hasNextRow && hasNextCol) ?\n getA
1Value(b, sourceCeilRC.x, sourceFloorRC.z, d + 1) : 0.0);\n\n vec4 topRight = vec4(\n getAValue(b, sourceFloorRC.x, sourceCeilRC.y, d),\n hasNextCol ? getAValue(b, sourceFloorRC.x, sourceCeilRC.y, d + 1)\n : 0.0,\n hasNextRow ? getAValue(b, sourceFloorRC.x, sourceCeilRC.z, d)\n : 0.0,\n (hasNextRow && hasNextCol) ?\n getAValue(b, sourceFloorRC.x, sourceCeilRC.z, d + 1) : 0.0);\n\n vec4 bottomRight = vec4(\n getAValue(b, sourceCeilRC.x, sourceCeilRC.y, d),\n hasNextCol ? getAValue(b, sourceCeilRC.x, sourceCeilRC.y, d + 1)\n : 0.0,\n hasNextRow ? getAValue(b, sourceCeilRC.x, sourceCeilRC.z, d)\n : 0.0,\n (hasNextRow && hasNextCol) ?\n getAValue(b, sourceCeilRC.x, sourceCeilRC.z, d + 1) : 0.0);\n\n vec3 fracRC = sourceFracIndexRC - vec3(sourceFloorRC);\n\n vec4 top = mix(topLeft, topRight, fracRC.yyzz);\n vec4 bottom = mix(bottomLeft, bottomRight, fracRC.yyzz);\n vec4 newValue = mix(top, bottom, fracRC.x);\n\n setOutput(newValue);\n }\n ")}}},174583:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ResizeNearestNeigborBackpropProgram=void 0;t.ResizeNearestNeigborBackpropProgram=class{constructor(e,t,n){this.variableNames=["dy"],this.outputShape=[],this.outputShape=t;const[,r,a]=t,[,o,s]=e,i=[n&&o>1?r-1:r,n&&s>1?a-1:a],c=[n&&o>1?o-1:o,n&&s>1?s-1:s],l=i[0]/c[0],u=i[1]/c[1],d=1/l,p=1/u,h=2*Math.ceil(d)+2,f=2*Math.ceil(p)+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(".concat(l,");\n const float widthScale = float(").concat(u,");\n\n const float invHeightScale = float(").concat(d,");\n const float invWidthScale = float(").concat(p,");\n\n const int winHeight = int(").concat(h,");\n const int winWidth = int(").concat(f,");\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 >= ").concat(o,") {\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 >= ").concat(s,") {\n continue;\n }\n\n float sourceFracRow =\n float(").concat(i[0],") *\n (float(dyR) / float(").concat(c[0],"));\n\n float sourceFracCol =\n float(").concat(i[1],") *\n (float(dyC) / float(").concat(c[1],"));\n\n int sourceNearestRow = int(min(\n float(int(").concat(r,") - 1),\n ").concat(n," ? float(round(sourceFracRow)) :\n float(floor(sourceFracRow))));\n\n int sourceNearestCol = int(min(\n float(int(").concat(a,") - 1),\n ").concat(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 ")}}},583929:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ResizeNearestNeighborProgram=void 0;t.ResizeNearestNeighborProgram=class{constructor(e,t,n,r,a){this.variableNames=["A"],this.outputShape=[];const[o,s,i,c]=e;this.outputShape=[o,t,n,c];const l=[r&&t>1?s-1:s,r&&n>1?i-1:i],u=[r&&t>1?t-1:t,r&&n>1?n-1:n],d=r?"0.5":"0.0";let p;p=a?"max((vec2(yRC) + vec2(0.5)) * effectiveInputOverOutputRatioRC, vec2(0.0))":"vec2(yRC) * effectiveInputOverOutputRatioRC",this.userCode="\n const vec2 effectiveInputOverOutputRatioRC = vec2(\n ".concat(l[0]/u[0],",\n ").concat(l[1]/u[1],");\n const vec2 inputShapeRC = vec2(").concat(s,".0, ").concat(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 = ").concat(p,";\n\n // Compute the coordinators of nearest neighbor point.\n ivec2 sourceNearestRC = ivec2(\n min(inputShapeRC - 1.0, floor(sourceFracIndexRC + ").concat(d,")));\n float newValue = getA(b, sourceNearestRC.x, sourceNearestRC.y, d);\n\n setOutput(newValue);\n }\n ")}}},210949:(e,t)=>
1{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ResizeNearestNeighborPackedProgram=void 0;t.ResizeNearestNeighborPackedProgram=class{constructor(e,t,n,r,a){this.variableNames=["A"],this.packedInputs=!0,this.packedOutput=!0,this.outputShape=[];const[o,s,i,c]=e;this.outputShape=[o,t,n,c];const l=[r&&t>1?s-1:s,r&&n>1?i-1:i],u=[r&&t>1?t-1:t,r&&n>1?n-1:n],d=r?"0.5":"0.0";let p;p=a?"max((vec3(yRC) + vec3(0.5)) * effectiveInputOverOutputRatioRC, vec3(0.0))":"vec3(yRC) * effectiveInputOverOutputRatioRC",this.userCode="\n const vec3 effectiveInputOverOutputRatioRC = vec3(\n ".concat(l[0]/u[0],",\n ").concat(l[1]/u[1],",\n ").concat(l[1]/u[1],");\n const vec3 inputShapeRC = vec3(").concat(s,".0, ").concat(i,".0,\n ").concat(i,".0);\n\n float getAValue(int b, int r, int c, int d) {\n return getChannel(getA(b, r, c, d), vec2(c, d));\n }\n\n void main() {\n ivec4 coords = getOutputCoords();\n int b = coords[0];\n int d = coords[3];\n // Calculate values for next column in yRC.z.\n ivec3 yRC = coords.yzz + ivec3(0, 0, 1);\n\n // Fractional source index.\n vec3 sourceFracIndexRC = ").concat(p,";\n\n // Compute the coordinators of nearest neighbor point.\n ivec3 sourceNearestRC = ivec3(\n min(inputShapeRC - 1.0, floor(sourceFracIndexRC + ").concat(d,")));\n\n // Should we calculate next column and row elements in 2x2 packed cell.\n bool hasNextCol = d < ").concat(c-1,";\n bool hasNextRow = coords.z < ").concat(n-1,";\n\n vec4 newValue = vec4(\n getAValue(b, sourceNearestRC.x, sourceNearestRC.y, d),\n hasNextCol ? getAValue(b, sourceNearestRC.x, sourceNearestRC.y, d + 1)\n : 0.0,\n hasNextRow ? getAValue(b, sourceNearestRC.x, sourceNearestRC.z, d)\n : 0.0,\n (hasNextRow && hasNextCol) ?\n getAValue(b, sourceNearestRC.x, sourceNearestRC.z, d + 1) : 0.0);\n\n setOutput(newValue);\n }\n ")}}},241467:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ReverseProgram=void 0;var r=n(41990);t.ReverseProgram=class{constructor(e,t){this.variableNames=["x"];const n=e.length;if(n>4)throw new Error("WebGL backend: Reverse of rank-".concat(n," tensor is not yet supported"));if(this.outputShape=e,1===n)return void(this.userCode="\n void main() {\n int coord = getOutputCoords();\n setOutput(getX(".concat(e[0]," - coord - 1));\n }\n "));const a=e.map(((n,r)=>(n=>-1!==t.indexOf(n)&&1!==e[n]?"".concat(e[n]," - coords[").concat(n,"] - 1"):"coords[".concat(n,"]"))(r))).join(","),o=(0,r.getCoordsDataType)(n);this.userCode="\n void main() {\n ".concat(o," coords = getOutputCoords();\n setOutput(getX(").concat(a,"));\n }\n ")}}},941661:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ReversePackedProgram=void 0;var r=n(530675),a=n(41990);t.ReversePackedProgram=class{constructor(e,t){this.variableNames=["x"],this.packedInputs=!0,this.packedOutput=!0;const n=e.length;if(n>4)throw new Error("WebGL backend: Reverse of rank-".concat(n," tensor is not yet supported"));this.outputShape=e;const o=(0,r.getChannels)("rc",n),s="".concat(o[n-1]," + 1 < ").concat(this.outputShape[n-1]),i="".concat(o[n-2]," + 1 < ").concat(this.outputShape[n-2]),c=(0,a.getCoordsDataType)(n);function l(n){const r=e.map(((r,a)=>function(n,r){return-1!==t.indexOf(n)&&1!==e[n]?"".concat(e[n]," - ").concat(r[n]," - 1"):"".concat(r[n])}(a,n))),a=r.join(","),o=r.slice(-2).join(",");return"getChannel(getX(".concat(a,"), vec2(").concat(o,"))")}this.userCode=1===n?"\n void main(){\n int rc = getOutputCoords();\n vec4 result = vec4(0.);\n result.r = getChannel(getX(".concat(e[0]," - rc - 1),\n ").concat(e[0]," - rc - 1);\n if(").concat(s,"){\n result.g = getChannel(getX(").concat(e[0]," - (rc + 1) - 1),\n ").concat(e[0]," - (rc + 1) - 1);\n }\n setOutput(result);\n }\n "):"\n void main() {\n ".concat(c," rc = getOutputCoords();\n vec4 result = vec4(0.);\n result.r = ").concat(function(e){return l(e)}(o.slice()),";\n if(").concat(s,"){\n result.g = ").concat(function(e){return e[n-1]="("+e[n-1]+" + 1)",l(e)}(o.slice()),";\n }\n if(").concat(i,") {\n result.b = ").concat(function(e){return e[n-2]="("+e[n-2]+" + 1)",l(e)}(o.slice()),";\n if(").concat(s,") {\n result.a = ").concat(function(e){return e[n-1]="("+e[n-1]+" + 1)",e[n-2]="("+e[n-2]+" + 1)",l(e)}(o.slice()),";\n }\n }\n setOutput(result);\n }\n ")}}},601928:(e,t)=>
1{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.RotateProgram=void 0;t.RotateProgram=class{constructor(e,t){this.variableNames=["Image"],this.outputShape=[],this.customUniforms=[{name:"params",type:"vec4"}];const n=e[1],r=e[2];this.outputShape=e;let a="";a="number"==typeof t?"float outputValue = ".concat(t.toFixed(2),";"):"\n vec3 fill = vec3(".concat(t.join(","),");\n float outputValue = fill[coords[3]];"),this.userCode="\n void main() {\n ivec4 coords = getOutputCoords();\n int x = coords[2];\n int y = coords[1];\n float coordXFloat = (float(x) - params[0]) * params[3] -\n (float(y) - params[1]) * params[2];\n float coordYFloat = (float(x) - params[0]) * params[2] +\n (float(y) - params[1]) * params[3];\n int coordX = int(round(coordXFloat + params[0]));\n int coordY = int(round(coordYFloat + params[1]));\n ".concat(a,"\n if(coordX >= 0 && coordX < ").concat(r," && coordY >= 0 && coordY < ").concat(n,") {\n outputValue = getImage(coords[0], coordY, coordX, coords[3]);\n }\n setOutput(outputValue);\n }\n ")}}},650638:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ScatterProgram=void 0;var r=n(41990);t.ScatterProgram=class{constructor(e,t,n,a,o,s){this.variableNames=["updates","indices","defaultValue"],this.outputShape=s;const i=(0,r.getCoordsDataType)(o.length),c=(0,r.getCoordsDataType)(s.length);let l="";1===n?l="i":2===n&&(l="i, j");const u="getIndices(".concat(l,")");let d="";1===a?d="i":2===a&&(d="i, coords[1]");const p="getUpdates(".concat(d,")"),h=t>1?"strides[j]":"strides";this.userCode="\n ".concat(i," strides = ").concat(i,"(").concat(o,");\n\n void main() {\n ").concat(c," coords = getOutputCoords();\n float sum = 0.0;\n bool found = false;\n for (int i = 0; i < ").concat(e,"; i++) {\n int flattenedIndex = 0;\n for (int j = 0; j < ").concat(t,"; j++) {\n int index = round(").concat(u,");\n flattenedIndex += index * ").concat(h,";\n }\n if (flattenedIndex == coords[0]) {\n sum += ").concat(p,";\n found = true;\n }\n }\n setOutput(mix(getDefaultValue(), sum, float(found)));\n }\n ")}}},2130:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.SegmentOpProgram=void 0;t.SegmentOpProgram=class{constructor(e,t){this.variableNames=["x","segmentIds"];const n=e.windowSize,r=e.batchSize,a=e.inSize,o=e.numSegments,s=o*Math.ceil(a/n);this.outputShape=[r,s];const i=4*Math.floor(n/4),c=n%4,l="\n sumValue += dot(values, segFilter);\n ";let u="";a%n>0&&(u="\n if (inIdx < 0 || inIdx >= ".concat(a,") {\n return initializationValue;\n }\n "));let d="";a%n>0&&(d="\n if (inIdx < 0 || inIdx >= ".concat(a,") {\n return -1.0;\n }\n ")),this.userCode="\n const float initializationValue = ".concat("0.0",";\n\n float getValue(int batch, int inIdx) {\n ").concat(u,"\n return getX(batch, inIdx);\n }\n\n float getSegmentIdAtIndex(int inIdx) {\n ").concat(d,"\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 ").concat(o,")) * float(").concat(n,"));\n int currentSeg = int(mod(float(outIdx), float(").concat(o,")));\n\n float sumValue = 0.0;\n\n for (int i = 0; i < ").concat(i,"; 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 segFilter = 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 ").concat(l,"\n }\n\n int inIdx = inOffset + ").concat(i,";\n if (").concat(1===c,") {\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 segFilter = vec4(\n int(getSegmentIdAtIndex(inIdx)) == currentSeg ? 1 : 0,\n 0,\n 0,\n 0\n );\n\n ").concat(l,"\n } else if (").concat(2===c,") {\n vec4 values = vec4(\n getValue(batch, inIdx),\n getValue(batch, inIdx + 1),\n initializationValue,\n initializationValue\n );\n\n vec4 segFilter = vec4(\n int(getSegmentIdAtIndex(inIdx)) == currentSeg ? 1 : 0,\n int(getSegmentIdAtIndex(inIdx + 1)) == currentSeg ? 1 : 0,\n 0,\n 0\n );\n\n ").concat(l,"\n } else if (").concat(3===c,") {\n vec4 values = vec4(\n getValue(batch, inIdx),\n getValue(batch, inIdx + 1),\n getValue(batch, inIdx + 2),\n initializationValue\n );\n\n vec4 segFilter = 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 ").concat(l,"\n }\n setOutput(").concat("sumValue",");\n }\n ")}}}
1,338912:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.SelectProgram=void 0;var r=n(41990);t.SelectProgram=class{constructor(e,t,n){let a,o;if(this.variableNames=["c","a","b"],this.outputShape=t,n>4)throw Error("Where for rank ".concat(n," is not yet supported"));if(1===n)o="resRC",a="resRC";else{const n=["resRC.x","resRC.y","resRC.z","resRC.w"],r=[],s=[];for(let a=0;a<t.length;a++)s.push("".concat(n[a])),a<e&&r.push("".concat(n[a]));a=r.join(),o=s.join()}const s=(0,r.getCoordsDataType)(n);this.userCode="\n void main() {\n ".concat(s," resRC = getOutputCoords();\n float cVal = getC(").concat(a,");\n if (cVal >= 1.0) {\n setOutput(getA(").concat(o,"));\n } else {\n setOutput(getB(").concat(o,"));\n }\n }\n ")}}},41990:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getCoordsDataType=g,t.getUniformInfoFromShape=y,t.makeShader=function(e,t,n){const s=[];if(e.forEach((e=>{const t=r.util.sizeFromShape(e.shapeInfo.logicalShape);if(e.shapeInfo.isUniform?s.push("uniform float ".concat(e.name).concat(t>1?"[".concat(t,"]"):"",";")):(s.push("uniform sampler2D ".concat(e.name,";")),s.push("uniform int offset".concat(e.name,";"))),n.enableShapeUniforms){const{uniformShape:t}=y(n.packedInputs,e.shapeInfo.logicalShape,e.shapeInfo.texShape);switch(t.length){case 1:s.push("uniform int ".concat(e.name,"Shape;"));break;case 2:s.push("uniform ivec2 ".concat(e.name,"Shape;"));break;case 3:s.push("uniform ivec3 ".concat(e.name,"Shape;"));break;case 4:s.push("uniform ivec4 ".concat(e.name,"Shape;"))}s.push("uniform ivec2 ".concat(e.name,"TexShape;"))}})),n.enableShapeUniforms){switch(t.logicalShape.length){case 1:s.push("uniform int outShape;");break;case 2:s.push("uniform ivec2 outShape;"),s.push("uniform int outShapeStrides;");break;case 3:s.push("uniform ivec3 outShape;"),s.push("uniform ivec2 outShapeStrides;");break;case 4:s.push("uniform ivec4 outShape;"),s.push("uniform ivec3 outShapeStrides;")}s.push("uniform ivec2 outTexShape;")}
1n.customUniforms&&n.customUniforms.forEach((e=>{s.push("uniform ".concat(e.type," ").concat(e.name).concat(e.arrayIndex?"[".concat(e.arrayIndex,"]"):"",";"))}));const f=s.join("\n"),m=e.map((e=>function(e,t){let n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],a=arguments.length>3?arguments[3]:void 0,o="";o+=n?l(e,a):c(e,a);const s=e.shapeInfo.logicalShape,u=t.logicalShape;s.length<=u.length&&(o+=n?function(e,t){const n=e.name,a=n.charAt(0).toUpperCase()+n.slice(1),o="get"+a+"AtOutCoords",s=e.shapeInfo.logicalShape.length,c=t.logicalShape.length,l=i(e.shapeInfo.logicalShape,t.logicalShape),u=g(c),d=c-s;let p;const h=["x","y","z","w","u","v"];p=0===s?"":c<2&&l.length>=1?"coords = 0;":l.map((e=>"coords.".concat(h[e+d]," = 0;"))).join("\n");let f="";f=c<2&&s>0?"coords":e.shapeInfo.logicalShape.map(((e,t)=>"coords.".concat(h[t+d]))).join(", ");let m="return outputValue;";const y=1===r.util.sizeFromShape(e.shapeInfo.logicalShape),v=r.util.sizeFromShape(t.logicalShape),b=1===v;if(1!==s||y||b){if(y&&!b)m=1===c?"\n return vec4(outputValue.x, outputValue.x, 0., 0.);\n ":"\n return vec4(outputValue.x);\n ";else if(l.length){const e=s-2,t=s-1;l.indexOf(e)>-1&&l.indexOf(t)>-1?m="return vec4(outputValue.x);":l.indexOf(e)>-1?m="return vec4(outputValue.x, outputValue.y, outputValue.x, outputValue.y);":l.indexOf(t)>-1&&(m="return vec4(outputValue.xx, outputValue.zz);")}}else m="\n return vec4(outputValue.xy, outputValue.xy);\n ";return"\n vec4 ".concat(o,"() {\n ").concat(u," coords = getOutputCoords();\n ").concat(p,"\n vec4 outputValue = get").concat(a,"(").concat(f,");\n ").concat(m,"\n }\n ")}(e,t):function(e,t){const n=e.name,a=n.charAt(0).toUpperCase()+n.slice(1),o="get"+a+"AtOutCoords",s=t.texShape,c=e.shapeInfo.texShape,l=e.shapeInfo.logicalShape.length,u=t.logicalShape.length;if(!e.shapeInfo.isUniform&&l===u&&null==e.shapeInfo.flatOffset&&r.util.arraysEqual(c,s))return"\n float ".concat(o,"() {\n return sampleTexture(").concat(n,", resultUV);\n }\n ");const d=g(u),p=i(e.shapeInfo.logicalShape,t.logicalShape),h=u-l;let f;const m=["x","y","z","w","u","v"];f=0===l?"":u<2&&p.length>=1?"coords = 0;":p.map((e=>"coords.".concat(m[e+h]," = 0;"))).join("\n");let y="";y=u<2&&l>0?"coords":e.shapeInfo.logicalShape.map(((e,t)=>"coords.".concat(m[t+h]))).join(", ");return"\n float ".concat(o,"() {\n ").concat(d," coords = getOutputCoords();\n ").concat(f,"\n return get").concat(a,"(").concat(y,");\n }\n ")}(e,t));return o}(e,t,n.packedInputs,n.enableShapeUniforms))).join("\n"),v=t.texShape,b=(0,a.getGlslDifferences)(),x=function(e){return"\n float sampleTexture(sampler2D textureSampler, vec2 uv) {\n return ".concat(e.texture2D,"(textureSampler, uv).r;\n }\n ")}(b);let w,k,_=function(e){const t="".concat(e.version,"\n precision highp float;\n precision highp int;\n precision highp sampler2D;\n ").concat(e.varyingFs," vec2 resultUV;\n ").concat(e.defineOutput,"\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 uniform float NAN;\n ").concat(e.defineSpecialNaN,"\n ").concat(e.defineSpecialInf,"\n ").concat(e.defineRound,"\n\n int imod(int x, int y) {\n return x - y * (x / y);\n }\n\n int idiv(int a, int b, float sign) {\n int res = a / b;\n int mod = imod(a, b);\n if (sign < 0. && mod != 0) {\n res -= 1;\n }\n return res;\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 ").concat(u,"\n ").concat(d,"\n ").concat(p,"\n ");return t}(b);t.isPacked?(w=function(e,t,n){switch(e.length){case 0:return"\n int getOutputCoords() {\n return 0;\n }\n ";case 1:return function(e,t,n){const r=[Math.ceil(t[0]/2),Math.ceil(t[1]/2)];if(1===r[0])return n?"\n int getOutputCoords() {\n return 2 * int(resultUV.x * ceil(float(outTexShape[1]) / 2.0));\n }\n ":"\n int getOutputCoords() {\n return 2 * int(resultUV.x * ".concat(r[1],".0);\n }\n ");if(1===r[1])return n?"\n int getOutputCoords() {\n return 2 * int(resultUV.y * ceil(float(outTexShape[0]) / 2.0));\n }\n ":"\n int getOutputCoords() {\n return 2 * int(resultUV.y * ".concat(r[0],".0);\n }\n ");if(n)return"\n int getOutputCoords() {\n ivec2 packedTexShape = ivec2(ceil(float(outTexShape[0]) / 2.0), ceil(float(outTexShape[1]) / 2.0));
1\n ivec2 resTexRC = ivec2(resultUV.yx *\n vec2(packedTexShape[0], packedTexShape[1]));\n return 2 * (resTexRC.x * packedTexShape[1] + resTexRC.y);\n }\n ";return"\n int getOutputCoords() {\n ivec2 resTexRC = ivec2(resultUV.yx *\n vec2(".concat(r[0],", ").concat(r[1],"));\n return 2 * (resTexRC.x * ").concat(r[1]," + resTexRC.y);\n }\n ")}(0,t,n);case 2:return function(e,t,n){const a=[Math.ceil(t[0]/2),Math.ceil(t[1]/2)];if(r.util.arraysEqual(e,t))return n?"\n ivec2 getOutputCoords() {\n ivec2 packedTexShape = ivec2(ceil(float(outTexShape[0]) / 2.0), ceil(float(outTexShape[1]) / 2.0));\n return 2 * ivec2(resultUV.yx * vec2(packedTexShape[0], packedTexShape[1]));\n }\n ":"\n ivec2 getOutputCoords() {\n return 2 * ivec2(resultUV.yx * vec2(".concat(a[0],", ").concat(a[1],"));\n }\n ");const o=Math.ceil(e[1]/2);if(n)return"\n ivec2 getOutputCoords() {\n ivec2 packedTexShape = ivec2(ceil(float(outTexShape[0]) / 2.0), ceil(float(outTexShape[1]) / 2.0));\n int texelsInLogicalRow = int(ceil(float(outShape[1]) / 2.0));\n ivec2 resTexRC = ivec2(resultUV.yx *\n vec2(packedTexShape[0], packedTexShape[1]));\n\n int index = resTexRC.x * packedTexShape[1] + resTexRC.y;\n int r = 2 * (index / texelsInLogicalRow);\n int c = imod(index, texelsInLogicalRow) * 2;\n\n return ivec2(r, c);\n }\n ";return"\n ivec2 getOutputCoords() {\n ivec2 resTexRC = ivec2(resultUV.yx *\n vec2(".concat(a[0],", ").concat(a[1],"));\n\n int index = resTexRC.x * ").concat(a[1]," + resTexRC.y;\n int r = 2 * (index / ").concat(o,");\n int c = imod(index, ").concat(o,") * 2;\n\n return ivec2(r, c);\n }\n ")}(e,t,n);case 3:return function(e,t,n){if(n)return"\n ivec3 getOutputCoords() {\n ivec2 packedTexShape = ivec2(ceil(float(outTexShape[0]) / 2.0), ceil(float(outTexShape[1]) / 2.0));\n int texelsInLogicalRow = int(ceil(float(outShape[2]) / 2.0));\n int texelsInBatch = texelsInLogicalRow * int(ceil(float(outShape[1]) / 2.0));\n ivec2 resTexRC = ivec2(resultUV.yx *\n vec2(packedTexShape[0], packedTexShape[1]));\n int index = resTexRC.x * packedTexShape[1] + resTexRC.y;\n\n int b = index / texelsInBatch;\n index -= b * texelsInBatch;\n\n int r = 2 * (index / texelsInLogicalRow);\n int c = imod(index, texelsInLogicalRow) * 2;\n\n return ivec3(b, r, c);\n }\n ";const r=[Math.ceil(t[0]/2),Math.ceil(t[1]/2)],a=Math.ceil(e[2]/2),o=a*Math.ceil(e[1]/2);return"\n ivec3 getOutputCoords() {\n ivec2 resTexRC = ivec2(resultUV.yx *\n vec2(".concat(r[0],", ").concat(r[1],"));\n int index = resTexRC.x * ").concat(r[1]," + resTexRC.y;\n\n int b = index / ").concat(o,";\n index -= b * ").concat(o,";\n\n int r = 2 * (index / ").concat(a,");\n int c = imod(index, ").concat(a,") * 2;\n\n return ivec3(b, r, c);\n }\n ")}(e,t,n);default:return function(e,t,n){if(n)return"\n ivec4 getOutputCoords() {\n ivec2 packedTexShape = ivec2(ceil(float(outTexShape[0]) / 2.0), ceil(float(outTexShape[1]) / 2.0));\n ivec2 resTexRC = ivec2(resultUV.yx *\n vec2(packedTexShape[0], packedTexShape[1]));\n int index = resTexRC.x * packedTexShape[1] + resTexRC.y;\n\n int texelsInLogicalRow = int(ceil(float(outShape[3]) / 2.0));\n int texelsInBatch = texelsInLogicalRow * int(ceil(float(outShape[2]) / 2.0));\n int texelsInBatchN = texelsInBatch * outShape[1];\n\n int b2 = index / texelsInBatchN;\n index -= b2 * texelsInBatchN;\n\n int b = index / texelsInBatch;\n index -= b * texelsInBatch;\n\n int r = 2 * (index / texelsInLogicalRow);\n int c = imod(index, texelsInLogicalRow) * 2;\n\n return ivec4(b2, b, r, c);\n }\n ";const r=[Math.ceil(t[0]/2),Math.ceil(t[1]/2)],a=Math.ceil(e[e.length-1]/2),o=a*Math.ceil(e[e.length-2]/2);let s=o,i="",c="b, r, c";for(let t=2;t<e.length-1;t++)s*=e[e.length-t-1],i="\n int b".concat(t," = index / ").concat(s,";\n index -= b").concat(t," * ").concat(s,";\n ")+i,c="b".concat(t,", ")+c;return"\n ivec".concat(e.length," getOutputCoords() {\n ivec2 resTexRC = ive
1c2(resultUV.yx *\n vec2(").concat(r[0],", ").concat(r[1],"));\n int index = resTexRC.x * ").concat(r[1]," + resTexRC.y;\n\n ").concat(i,"\n\n int b = index / ").concat(o,";\n index -= b * ").concat(o,";\n\n int r = 2 * (index / ").concat(a,");\n int c = imod(index, ").concat(a,") * 2;\n\n return ivec").concat(e.length,"(").concat(c,");\n }\n ")}(e,t,n)}}(t.logicalShape,v,n.enableShapeUniforms),k=function(e){return"\n void setOutput(vec4 val) {\n ".concat(e.output," = val;\n }\n ")}(b)):(w=function(e,t,n){switch(e.length){case 0:return"\n int getOutputCoords() {\n return 0;\n }\n ";case 1:return function(e,t,n){if(1===t[0])return n?"\n int getOutputCoords() {\n return int(resultUV.x * float(outTexShape[1]));\n }\n ":"\n int getOutputCoords() {\n return int(resultUV.x * ".concat(t[1],".0);\n }\n ");if(1===t[1])return n?"\n int getOutputCoords() {\n return int(resultUV.y * float(outTexShape[0]));\n }\n ":"\n int getOutputCoords() {\n return int(resultUV.y * ".concat(t[0],".0);\n }\n ");if(n)return"\n int getOutputCoords() {\n ivec2 resTexRC = ivec2(resultUV.yx *\n vec2(outTexShape[0], outTexShape[1]));\n return resTexRC.x * outTexShape[1] + resTexRC.y;\n }\n ";return"\n int getOutputCoords() {\n ivec2 resTexRC = ivec2(resultUV.yx *\n vec2(".concat(t[0],", ").concat(t[1],"));\n return resTexRC.x * ").concat(t[1]," + resTexRC.y;\n }\n ")}(0,t,n);case 2:return function(e,t,n){if(r.util.arraysEqual(e,t))return n?"\n ivec2 getOutputCoords() {\n return ivec2(resultUV.yx * vec2(outTexShape[0], outTexShape[1]));\n }\n ":"\n ivec2 getOutputCoords() {\n return ivec2(resultUV.yx * vec2(".concat(t[0],", ").concat(t[1],"));\n }\n ");if(1===e[1])return n?"\n ivec2 getOutputCoords() {\n ivec2 resTexRC = ivec2(resultUV.yx *\n vec2(outTexShape[0], outTexShape[1]));\n int index = resTexRC.x * outTexShape[1] + resTexRC.y;\n return ivec2(index, 0);\n }\n ":"\n ivec2 getOutputCoords() {\n ivec2 resTexRC = ivec2(resultUV.yx *\n vec2(".concat(t[0],", ").concat(t[1],"));\n int index = resTexRC.x * ").concat(t[1]," + resTexRC.y;\n return ivec2(index, 0);\n }\n ");if(1===e[0])return n?"\n ivec2 getOutputCoords() {\n ivec2 resTexRC = ivec2(resultUV.yx *\n vec2(outTexShape[0], outTexShape[1]));\n int index = resTexRC.x * outTexShape[1] + resTexRC.y;\n return ivec2(0, index);\n }\n ":"\n ivec2 getOutputCoords() {\n ivec2 resTexRC = ivec2(resultUV.yx *\n vec2(".concat(t[0],", ").concat(t[1],"));\n int index = resTexRC.x * ").concat(t[1]," + resTexRC.y;\n return ivec2(0, index);\n }\n ");if(n)return"\n ivec2 getOutputCoords() {\n ivec2 resTexRC = ivec2(resultUV.yx *\n vec2(outTexShape[0], outTexShape[1]));\n int index = resTexRC.x * outTexShape[1] + resTexRC.y;\n int r = index / outShape[1];\n int c = index - r * outShape[1];\n return ivec2(r, c);\n }\n ";return"\n ivec2 getOutputCoords() {\n ivec2 resTexRC = ivec2(resultUV.yx *\n vec2(".concat(t[0],", ").concat(t[1],"));\n int index = resTexRC.x * ").concat(t[1]," + resTexRC.y;\n int r = index / ").concat(e[1],";\n int c = index - r * ").concat(e[1],";\n return ivec2(r, c);\n }\n ")}(e,t,n);case 3:return function(e,t,n){if(n){const t=o.getOutputLogicalCoordinatesFromFlatIndexByUniform(["r","c","d"],e);return"\n ivec3 getOutputCoords() {\n ivec2 resTexRC = ivec2(resultUV.yx *\n vec2(outTexShape[0], outTexShape[1]));\n int index = resTexRC.x * outTexShape[1] + resTexRC.y;\n ".concat(t,"\n return ivec3(r, c, d);\n }\n")}const r=o.getLogicalCoordinatesFromFlatIndex(["r","c","d"],e);return"\n ivec3 getOutputCoords() {\n ivec2 resTexRC = ive
1c2(resultUV.yx *\n vec2(".concat(t[0],", ").concat(t[1],"));\n int index = resTexRC.x * ").concat(t[1]," + resTexRC.y;\n ").concat(r,"\n return ivec3(r, c, d);\n }\n ")}(e,t,n);case 4:return function(e,t,n){if(n){const t=o.getOutputLogicalCoordinatesFromFlatIndexByUniform(["r","c","d","d2"],e);return"\n ivec4 getOutputCoords() {\n ivec2 resTexRC = ivec2(resultUV.yx *\n vec2(outTexShape[0], outTexShape[1]));\n int index = resTexRC.x * outTexShape[1] + resTexRC.y;\n ".concat(t,"\n return ivec4(r, c, d, d2);\n }\n ")}const r=o.getLogicalCoordinatesFromFlatIndex(["r","c","d","d2"],e);return"\n ivec4 getOutputCoords() {\n ivec2 resTexRC = ivec2(resultUV.yx *\n vec2(".concat(t[0],", ").concat(t[1],"));\n int index = resTexRC.x * ").concat(t[1]," + resTexRC.y;\n ").concat(r,"\n return ivec4(r, c, d, d2);\n }\n ")}(e,t,n);case 5:return function(e,t){const n=o.getLogicalCoordinatesFromFlatIndex(["r","c","d","d2","d3"],e);return"\n ivec5 getOutputCoords() {\n ivec2 resTexRC = ivec2(resultUV.yx * vec2(".concat(t[0],",\n ").concat(t[1],"));\n\n int index = resTexRC.x * ").concat(t[1]," + resTexRC.y;\n\n ").concat(n,"\n\n ivec5 outShape = ivec5(r, c, d, d2, d3);\n return outShape;\n }\n ")}(e,t);case 6:return function(e,t){const n=o.getLogicalCoordinatesFromFlatIndex(["r","c","d","d2","d3","d4"],e);return"\n ivec6 getOutputCoords() {\n ivec2 resTexRC = ivec2(resultUV.yx *\n vec2(".concat(t[0],", ").concat(t[1],"));\n int index = resTexRC.x * ").concat(t[1]," + resTexRC.y;\n\n ").concat(n,"\n\n ivec6 result = ivec6(r, c, d, d2, d3, d4);\n return result;\n }\n ")}(e,t);default:throw new Error("".concat(e.length,"-D output sampling is not yet supported"))}}(t.logicalShape,v,n.enableShapeUniforms),k=function(e){return"\n void setOutput(float val) {\n ".concat(e.output," = vec4(val, 0, 0, 0);\n }\n ")}(b));n.packedInputs&&(_+=h);return[_,x,k,f,w,m,n.userCode].join("\n")},t.squeezeInputInfo=v;var r=n(735534),a=n(540236),o=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=s(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if("default"!==o&&{}.hasOwnProperty.call(e,o)){var i=a?Object.getOwnPropertyDescriptor(e,o):null;i&&(i.get||i.set)?Object.defineProperty(r,o,i):r[o]=e[o]}return r.default=e,n&&n.set(e,r),r}(n(270327));function s(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(s=function(e){return e?n:t})(e)}const{getBroadcastDims:i}=r.backend_util;function c(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const n=e.shapeInfo.logicalShape;switch(n.length){case 0:return function(e,t){const n=e.name,r="get"+n.charAt(0).toUpperCase()+n.slice(1);if(e.shapeInfo.isUniform)return"float ".concat(r,"() {return ").concat(n,";}");const[a,o]=e.shapeInfo.texShape;if(1===a&&1===o)return"\n float ".concat(r,"() {\n return sampleTexture(").concat(n,", halfCR);\n }\n ");const s=f(n);if(t)return"\n float ".concat(r,"() {\n vec2 uv = uvFromFlat(").concat(n,"TexShape[0], ").concat(n,"TexShape[1], ").concat(s,");\n return sampleTexture(").concat(n,", uv);\n }\n ");const[i,c]=e.shapeInfo.texShape;return"\n float ".concat(r,"() {\n vec2 uv = uvFromFlat(").concat(i,", ").concat(c,", ").concat(s,");\n return sampleTexture(").concat(n,", uv);\n }\n ")}(e,t);case 1:return function(e,t){const n=e.name,r="get"+n.charAt(0).toUpperCase()+n.slice(1);if(e.shapeInfo.isUniform)return"\n float ".concat(r,"(int index) {\n ").concat(m(e),"\n }\n ");const a=e.shapeInfo.texShape,o=a[0],s=a[1];if(1===s&&1===o)return"\n float ".concat(r,"(int index) {\n return sampleTexture(").concat(n,", halfCR);\n }\n ");const i=f(n);if(1===s)return t?"\n float ".concat(r,"(int index) {\n vec2 uv = vec2(0.5, (float(index + ").concat(i,") + 0.5) / float(").concat(n,"TexShape[0]));\n return sampleTexture(").concat(n,", uv);\n }\n "):"\n float ".concat(r,"(int index) {\n vec2 uv = vec2(0.5, (float(index + ").concat(i,") + 0.5) / ").concat(o,".0);\n return sampleTexture(").concat(n,", uv);\n }\n ");if(1===o)return t?"\n float ".concat(r,"(int index) {\n vec2 uv = vec2((float(index + ").concat(i,") + 0.5) / float(").concat(n,"TexShape[1]), 0.5);\n return sampleTexture(").concat(n,", uv);\n }\n "):"\n float ".concat(r,"(int index) {\n vec2 uv = vec2((float(index + ").concat(i,") + 0.5) / ").concat(s,".0, 0.5);\n return sampleTexture(").concat(n,", uv);\n }\n ");if(t)return"\n float ".concat(r,"(int index) {\n vec2 uv = uvFromFlat(").concat(n,"TexShape[0], ").concat(n,"TexShape[1], index + ").concat(i,");\n return sampleTexture(").concat(n,", uv);\n }\n ");return"\n float ".concat(r,"(int index) {\n vec2 uv = uvFromFlat(").concat(o,", ").concat(s,", index + ").concat(i,");\n return sampleTexture(").concat(n,", uv);\n }\n ")}(e,t);case 2:return function(e,t){const n=e.shapeInfo.logicalShape,a=e.name,o="get"+a.charAt(0).toUpperCase()+a.slice(1),s=e.shapeInfo.texShape;if(null!=s&&r.util.arraysEqual(n,s)){if(t)return"\n float ".concat(o,"(int row, int col) {\n vec2 uv = (vec2(col, row) + halfCR) / vec2(").concat(a,"TexShape[1], ").concat(a,"TexShape[0]);\n return sampleTexture(").concat(a,", uv);\n }\n ");const e=s[0],n=s[1];return"\n float ".concat(o,"(int row, int col) {\n vec2 uv = (vec2(col, row) + halfCR) / vec2(").concat(n,".0, ").concat(e,".0);\n return sampleTexture(").concat(a,", uv);\n }\n ")}const{newShape:i,keptDims:l}=r.util.squeezeShape(n),u=i;if(u.length<n.length){const n=v(e,u),r=["row","col"];return"\n ".concat(c(n,t),"\n float ").concat(o,"(int row, int col) {\n return ").concat(o,"(").concat(b(r,l),");\n }\n ")}if(e.shapeInfo.isUniform)return"\n float ".concat(o,"(int row, int col) {\n int index = round(dot(vec2(row, col), vec2(").concat(n[1],", 1)));\n ").concat(m(e),"\n }\n ");const d=s[0],p=s[1],h=f(a);if(1===p)return t?"\n float ".concat(o,"(int row, int col) {\n float index = dot(vec3(row, col, ").concat(h,"), vec3(").concat(a,"Shape[1], 1, 1));\n vec2 uv = vec2(0.5, (index + 0.5) / float(").concat(a,"TexShape[0]));\n return sampleTexture(").concat(a,", uv);\n }\n "):"\n float ".concat(o,"(int row, int col) {\n float index = dot(vec3(row, col, ").concat(h,"), vec3(").concat(n[1],", 1, 1));\n vec2 uv = vec2(0.5, (index + 0.5) / ").concat(d,".0);\n return sampleTexture(").concat(a,", uv);\n }\n ");if(1===d)return t?"\n float ".concat(o,"(int row, int col) {\n float index = dot(vec3(row, col, ").concat(h,"), vec3(").concat(a,"Shape[1], 1, 1));\n vec2 uv = vec2((index + 0.5) / float(").concat(a,"TexShape[1]), 0.5);\n return sampleTexture(").concat(a,", uv);\n }\n "):"\n float ".concat(o,"(int row, int col) {\n float index = dot(vec3(row, col, ").concat(h,"), vec3(").concat(n[1],", 1, 1));\n vec2 uv = vec2((index + 0.5) / ").concat(p,".0, 0.5);\n return sampleTexture(").concat(a,", uv);\n }\n ");if(t)return"\n float ".concat(o,"(int row, int col) {\n // Explicitly use integer operations as dot() only w
1orks on floats.\n int index = row * ").concat(a,"Shape[1] + col + ").concat(h,";\n vec2 uv = uvFromFlat(").concat(a,"TexShape[0], ").concat(a,"TexShape[1], index);\n return sampleTexture(").concat(a,", uv);\n }\n ");return"\n float ".concat(o,"(int row, int col) {\n // Explicitly use integer operations as dot() only works on floats.\n int index = row * ").concat(n[1]," + col + ").concat(h,";\n vec2 uv = uvFromFlat(").concat(d,", ").concat(p,", index);\n return sampleTexture(").concat(a,", uv);\n }\n")}(e,t);case 3:return function(e,t){const n=e.shapeInfo.logicalShape,a=e.name,o="get"+a.charAt(0).toUpperCase()+a.slice(1),s=n[1]*n[2],i=n[2],{newShape:l,keptDims:u}=r.util.squeezeShape(n),d=l;if(d.length<n.length){const n=v(e,d),r=["row","col","depth"];return"\n ".concat(c(n,t),"\n float ").concat(o,"(int row, int col, int depth) {\n return ").concat(o,"(").concat(b(r,u),");\n }\n ")}if(e.shapeInfo.isUniform)return"\n float ".concat(o,"(int row, int col, int depth) {\n int index = round(dot(vec3(row, col, depth),\n vec3(").concat(s,", ").concat(i,", 1)));\n ").concat(m(e),"\n }\n ");const p=e.shapeInfo.texShape,h=p[0],g=p[1],y=e.shapeInfo.flatOffset;if(g===s&&null==y)return t?"\n float ".concat(o,"(int row, int col, int depth) {\n int stride1 = ").concat(a,"Shape[2];\n float texR = float(row);\n float texC = dot(vec2(col, depth), vec2(stride1, 1));\n vec2 uv = (vec2(texC, texR) + halfCR) /\n vec2(").concat(a,"TexShape[1], ").concat(a,"TexShape[0]);\n return sampleTexture(").concat(a,", uv);\n }\n "):"\n float ".concat(o,"(int row, int col, int depth) {\n float texR = float(row);\n float texC = dot(vec2(col, depth), vec2(").concat(i,", 1));\n vec2 uv = (vec2(texC, texR) + halfCR) /\n vec2(").concat(g,".0, ").concat(h,".0);\n return sampleTexture(").concat(a,", uv);\n }\n ");if(g===i&&null==y)return t?"\n float ".concat(o,"(int row, int col, int depth) {\n float texR = dot(vec2(row, col), vec2(").concat(a,"Shape[1], 1));\n float texC = float(depth);\n vec2 uv = (vec2(texC, texR) + halfCR) / vec2(").concat(a,"TexShape[1], ").concat(a,"TexShape[0]);\n return sampleTexture(").concat(a,", uv);\n }\n "):"\n float ".concat(o,"(int row, int col, int depth) {\n float texR = dot(vec2(row, col), vec2(").concat(n[1],", 1));\n float texC = float(depth);\n vec2 uv = (vec2(texC, texR) + halfCR) / vec2(").concat(g,".0, ").concat(h,".0);\n return sampleTexture(").concat(a,", uv);\n }\n ");const x=f(a);if(t)return"\n float ".concat(o,"(int row, int col, int depth) {\n // Explicitly use integer operations as dot() only works on floats.\n int stride0 = ").concat(a,"Shape[1] * ").concat(a,"Shape[2];\n int stride1 = ").concat(a,"Shape[2];\n int index = row * ").concat(s," + col * ").concat(i," + depth + ").concat(x,";\n vec2 uv = uvFromFlat(").concat(a,"TexShape[0], ").concat(a,"TexShape[1], index);\n return sampleTexture(").concat(a,", uv);\n }\n ");return"\n float ".concat(o,"(int row, int col, int depth) {\n // Explicitly use integer operations as dot() only works on floats.\n int index = row * ").concat(s," + col * ").concat(i," + depth + ").concat(x,";\n vec2 uv = uvFromFlat(").concat(h,", ").concat(g,", index);\n return sampleTexture(").concat(a,", uv);\n }\n ")}(e,t);case 4:return function(e,t){const n=e.shapeInfo.logicalShape,a=e.name,o="get"+a.charAt(0).toUpperCase()+a.slice(1),s=n[3],i=n[2]*s,l=n[1]*i,{newShape:u,keptDims:d}=r.util.squeezeShape(n);if(u.length<n.length){const n=v(e,u),r=["row","col","depth","depth2"];return"\n ".concat(c(n,t),"\n float ").concat(o,"(int row, int col, int depth, int depth2) {\n return ").concat(o,"(").concat(b(r,d),");\n }\n ")}if(e.shapeInfo.isUniform)return"\n float ".concat(o,"(int row, int col, int depth, int depth2) {\n int index = round(dot(vec4(row, col, depth, depth2),\n vec4(").concat(l,", ").concat(i,", ").concat(s,", 1)));\n ").concat(m(e),"\n }\n ");const p=e.shapeInfo.flatOffset,h=e.shapeInfo.texShape,g=h[0],y=h[1],x="int str
1ide2 = ".concat(a,"Shape[3];"),w="int stride1 = ".concat(a,"Shape[2] * stride2;"),k="int stride0 = ".concat(a,"Shape[1] * stride1;");if(y===l&&null==p)return t?"\n float ".concat(o,"(int row, int col, int depth, int depth2) {\n ").concat(x,"\n ").concat(w,"\n float texR = float(row);\n float texC =\n dot(vec3(col, depth, depth2),\n vec3(stride1, stride2, 1));\n vec2 uv = (vec2(texC, texR) + halfCR) /\n vec2(").concat(a,"TexShape[1], ").concat(a,"TexShape[0]);\n return sampleTexture(").concat(a,", uv);\n }\n "):"\n float ".concat(o,"(int row, int col, int depth, int depth2) {\n float texR = float(row);\n float texC =\n dot(vec3(col, depth, depth2),\n vec3(").concat(i,", ").concat(s,", 1));\n vec2 uv = (vec2(texC, texR) + halfCR) /\n vec2(").concat(y,".0, ").concat(g,".0);\n return sampleTexture(").concat(a,", uv);\n }\n ");if(y===s&&null==p)return t?"\n float ".concat(o,"(int row, int col, int depth, int depth2) {\n float texR = dot(vec3(row, col, depth),\n vec3(").concat(a,"Shape[1] * ").concat(a,"Shape[2], ").concat(a,"Shape[2], 1));\n float texC = float(depth2);\n vec2 uv = (vec2(texC, texR) + halfCR) /\n vec2(").concat(a,"TexShape[1], ").concat(a,"TexShape[0]);\n return sampleTexture(").concat(a,", uv);\n }\n "):"\n float ".concat(o,"(int row, int col, int depth, int depth2) {\n float texR = dot(vec3(row, col, depth),\n vec3(").concat(n[1]*n[2],", ").concat(n[2],", 1));\n float texC = float(depth2);\n vec2 uv = (vec2(texC, texR) + halfCR) /\n vec2(").concat(y,".0, ").concat(g,".0);\n return sampleTexture(").concat(a,", uv);\n }\n ");const _=f(a);if(t)return"\n float ".concat(o,"(int row, int col, int depth, int depth2) {\n // Explicitly use integer operations as dot() only works on floats.\n ").concat(x,"\n ").concat(w,"\n ").concat(k,"\n int index = row * stride0 + col * stride1 +\n depth * stride2 + depth2;\n vec2 uv = uvFromFlat(").concat(a,"TexShape[0], ").concat(a,"TexShape[1], index + ").concat(_,");\n return sampleTexture(").concat(a,", uv);\n }\n ");return"\n float ".concat(o,"(int row, int col, int depth, int depth2) {\n // Explicitly use integer operations as dot() only works on floats.\n int index = row * ").concat(l," + col * ").concat(i," +\n depth * ").concat(s," + depth2;\n vec2 uv = uvFromFlat(").concat(g,", ").concat(y,", index + ").concat(_,");\n return sampleTexture(").concat(a,", uv);\n }\n ")}(e,t);case 5:return function(e){const t=e.shapeInfo.logicalShape,n=e.name,a="get"+n.charAt(0).toUpperCase()+n.slice(1),o=t[4],s=t[3]*o,i=t[2]*s,l=t[1]*i,{newShape:u,keptDims:d}=r.util.squeezeShape(t);if(u.length<t.length){const t=v(e,u),n=["row","col","depth","depth2","depth3"];return"\n ".concat(c(t),"\n float ").concat(a,"(int row, int col, int depth, int depth2, int depth3) {\n return ").concat(a,"(").concat(b(n,d),");\n }\n ")}if(e.shapeInfo.isUniform)return"\n float ".concat(a,"(int row, int col, int depth, int depth2, int depth3) {\n float index = dot(\n vec4(row, col, depth, depth2),\n vec4(").concat(l,", ").concat(i,", ").concat(s,", ").concat(o,")) +\n depth3;\n ").concat(m(e),"\n }\n ");const p=e.shapeInfo.flatOffset,h=e.shapeInfo.texShape,g=h[0],y=h[1];if(y===l&&null==p)return"\n float ".concat(a,"(int row, int col, int depth, int depth2, int depth3) {\n int texR = row;\n float texC = dot(vec4(col, depth, depth2, depth3),\n vec4(").concat(i,", ").concat(s,", ").concat(o,", 1));\n vec2 uv = (vec2(texC, texR) + halfCR) /\n vec2(").concat(y,".0, ").concat(g,".0);\n return sampleTexture(").concat(n,", uv);\n }\n ");if(y===o&&null==p)return"\n float ".concat(a,"(int row, int col, int depth, int depth2, int depth3) {\n float texR = dot
1(\n vec4(row, col, depth, depth2),\n vec4(").concat(t[1]*t[2]*t[3],",\n ").concat(t[2]*t[3],", ").concat(t[3],", 1));\n int texC = depth3;\n vec2 uv = (vec2(texC, texR) + halfCR) /\n vec2(").concat(y,".0, ").concat(g,".0);\n return sampleTexture(").concat(n,", uv);\n }\n ");const x=f(n);return"\n float ".concat(a,"(int row, int col, int depth, int depth2, int depth3) {\n // Explicitly use integer operations as dot() only works on floats.\n int index = row * ").concat(l," + col * ").concat(i," + depth * ").concat(s," +\n depth2 * ").concat(o," + depth3 + ").concat(x,";\n vec2 uv = uvFromFlat(").concat(g,", ").concat(y,", index);\n return sampleTexture(").concat(n,", uv);\n }\n ")}(e);case 6:return function(e){const t=e.shapeInfo.logicalShape,n=e.name,a="get"+n.charAt(0).toUpperCase()+n.slice(1),{newShape:o,keptDims:s}=r.util.squeezeShape(t);if(o.length<t.length){const t=v(e,o),n=["row","col","depth","depth2","depth3","depth4"];return"\n ".concat(c(t),"\n float ").concat(a,"(int row, int col, int depth,\n int depth2, int depth3, int depth4) {\n return ").concat(a,"(").concat(b(n,s),");\n }\n ")}const i=t[5],l=t[4]*i,u=t[3]*l,d=t[2]*u,p=t[1]*d;if(e.shapeInfo.isUniform)return"\n float ".concat(a,"(int row, int col, int depth,\n int depth2, int depth3, int depth4) {\n int index = round(dot(\n vec4(row, col, depth, depth2),\n vec4(").concat(p,", ").concat(d,", ").concat(u,", ").concat(l,")) +\n dot(\n vec2(depth3, depth4),\n vec2(").concat(i,", 1)));\n ").concat(m(e),"\n }\n ");const h=e.shapeInfo.flatOffset,g=e.shapeInfo.texShape,y=g[0],x=g[1];if(x===p&&null==h)return"\n float ".concat(a,"(int row, int col, int depth,\n int depth2, int depth3, int depth4) {\n int texR = row;\n float texC = dot(vec4(col, depth, depth2, depth3),\n vec4(").concat(d,", ").concat(u,", ").concat(l,", ").concat(i,")) +\n float(depth4);\n vec2 uv = (vec2(texC, texR) + halfCR) /\n vec2(").concat(x,".0, ").concat(y,".0);\n return sampleTexture(").concat(n,", uv);\n }\n ");if(x===i&&null==h)return"\n float ".concat(a,"(int row, int col, int depth,\n int depth2, int depth3, int depth4) {\n float texR = dot(vec4(row, col, depth, depth2),\n vec4(").concat(t[1]*t[2]*t[3]*t[4],",\n ").concat(t[2]*t[3]*t[4],",\n ").concat(t[3]*t[4],",\n ").concat(t[4],")) + float(depth3);\n int texC = depth4;\n vec2 uv = (vec2(texC, texR) + halfCR) /\n vec2(").concat(x,".0, ").concat(y,".0);\n return sampleTexture(").concat(n,", uv);\n }\n ");const w=f(n);return"\n float ".concat(a,"(int row, int col, int depth,\n int depth2, int depth3, int depth4) {\n // Explicitly use integer operations as dot() only works on floats.\n int index = row * ").concat(p," + col * ").concat(d," + depth * ").concat(u," +\n depth2 * ").concat(l," + depth3 * ").concat(i," + depth4 + ").concat(w,";\n vec2 uv = uvFromFlat(").concat(y,", ").concat(x,", index);\n return sampleTexture(").concat(n,", uv);\n }\n ")}(e);default:throw new Error("".concat(n.length,"-D input sampling")+" is not yet supported")}}function l(e,t){switch(e.shapeInfo.logicalShape.length){case 0:return function(e){const t=e.name,n="get"+t.charAt(0).toUpperCase()+t.slice(1),r=(0,a.getGlslDifferences)();return"\n vec4 ".concat(n,"() {\n return ").concat(r.texture2D,"(").concat(t,", halfCR);\n }\n ")}(e);case 1:return function(e,t){const n=e.name,r="get"+n.charAt(0).toUpperCase()+n.slice(1),o=e.shapeInfo.texShape,s=(0,a.getGlslDifferences)();if(t)return"\n vec4 ".concat(r,"(int index) {\n ivec2 packedTexShape = ivec2(ceil(float(").concat(n,"TexShape[0]) / 2.0), ceil(float(").concat(n,"TexShape[1]) / 2.0));\n vec2 uv = packedUVfrom1D(\n packedTexShape[0], packedTexShape[1], index);\n return ").concat(s.texture2D,"(").concat(n,", uv);\n }\n ");const i=[Math.ceil(o[0]/2),Math.ceil(o[1]/2)];return"\n vec4 ".concat(r,"(int index) {\n vec2 uv = packedUVfrom1D(\n ").concat(i[0],", ").concat(i[1],", index);\n return ").concat(s.texture2D,"(").concat(n,", uv);\n }\n ")}(e,t);case 2:return function(e,t){const n=e.shapeInfo.logicalShape,o=e.name,s="get"+o.charAt(0).toUpperCase()+o.slice(1),i=e.shapeInfo.texShape,c=i[0],l=i[1],u=(0,a.getGlslDifferences)();if(null!=i&&r.util.arraysEqual(n,i))return t?"\n vec4 ".concat(s,"(int row, int col) {\n vec2 uv = (vec2(col, row) + halfCR) / vec2(").concat(o,"TexShape[1], ").concat(o,"TexShape[0]);\n\n return ").concat(u.texture2D,"(").concat(o,", uv);\n }\n "):"\n vec4 ".concat(s,"(int row, int col) {\n vec2 uv = (vec2(col, row) + halfCR) / vec2(").concat(l,".0, ").concat(c,".0);\n\n return ").concat(u.texture2D,"(").concat(o,", uv);\n }\n ");if(t)return"\n vec4 ".concat(s,"(int row, int col) {\n ivec2 packedTexShape = ivec2(ceil(float(").concat(o,"TexShape[0]) / 2.0), ceil(float(").concat(o,"TexShape[1]) / 2.0));\n int valuesPerRow = int(ceil(float(").concat(o,"Shape[1]) / 2.0));\n vec2 uv = packedUVfrom2D(valuesPerRow, packedTexShape[0], packedTexShape[1], row, c
1ol);\n return ").concat(u.texture2D,"(").concat(o,", uv);\n }\n ");const d=[Math.ceil(i[0]/2),Math.ceil(i[1]/2)],p=Math.ceil(n[1]/2);return"\n vec4 ".concat(s,"(int row, int col) {\n vec2 uv = packedUVfrom2D(").concat(p,", ").concat(d[0],", ").concat(d[1],", row, col);\n return ").concat(u.texture2D,"(").concat(o,", uv);\n }\n ")}(e,t);case 3:return function(e,t){const n=e.shapeInfo.logicalShape,r=e.name,o="get"+r.charAt(0).toUpperCase()+r.slice(1),s=e.shapeInfo.texShape,i=[Math.ceil(s[0]/2),Math.ceil(s[1]/2)];if(1===n[0]){const r=[1,2],a=v(e,n.slice(1)),s=["b","row","col"];return"\n ".concat(l(a,t),"\n vec4 ").concat(o,"(int b, int row, int col) {\n return ").concat(o,"(").concat(b(s,r),");\n }\n ")}const c=(0,a.getGlslDifferences)();if(t)return"\n vec4 ".concat(o,"(int b, int row, int col) {\n ivec2 packedTexShape = ivec2(ceil(float(").concat(r,"TexShape[0]) / 2.0), ceil(float(").concat(r,"TexShape[1]) / 2.0));\n int valuesPerRow = int(ceil(float(").concat(r,"Shape[2]) / 2.0));\n int texelsInBatch = valuesPerRow * int(ceil(float(").concat(r,"Shape[1]) / 2.0));\n vec2 uv = packedUVfrom3D(\n packedTexShape[0], packedTexShape[1], texelsInBatch, valuesPerRow, b, row, col);\n return ").concat(c.texture2D,"(").concat(r,", uv);\n }\n ");const u=i[0],d=i[1],p=Math.ceil(n[2]/2),h=p*Math.ceil(n[1]/2);return"\n vec4 ".concat(o,"(int b, int row, int col) {\n vec2 uv = packedUVfrom3D(\n ").concat(u,", ").concat(d,", ").concat(h,", ").concat(p,", b, row, col);\n return ").concat(c.texture2D,"(").concat(r,", uv);\n }\n ")}(e,t);default:return function(e,t){const n=e.name,r="get"+n.charAt(0).toUpperCase()+n.slice(1),o=(0,a.getGlslDifferences)();if(t)return"\n vec4 ".concat(r,"(int b2, int b, int row, int col) {\n int valuesPerRow = int(ceil(float(").concat(n,"Shape[3]) / 2.0));\n int texelsInBatch = valuesPerRow * int(ceil(float(").concat(n,"Shape[2]) / 2.0));\n int index = b * texelsInBatch + (row / 2) * valuesPerRow + (col / 2);\n texelsInBatch *= ").concat(n,"Shape[1];\n index = b2 * texelsInBatch + index;\n ivec2 packedTexShape = ivec2(ceil(float(").concat(n,"TexShape[0]) / 2.0), ceil(float(").concat(n,"TexShape[1]) / 2.0));\n int texR = index / packedTexShape[1];\n int texC = index - texR * packedTexShape[1];\n vec2 uv = (vec2(texC, texR) + halfCR) / vec2(packedTexShape[1], packedTexShape[0]); return ").concat(o.texture2D,"(").concat(n,", uv);\n }\n ");const s=e.shapeInfo.logicalShape,i=s.length,c=e.shapeInfo.texShape,l=[Math.ceil(c[0]/2),Math.ceil(c[1]/2)],u=l[0],d=l[1],p=Math.ceil(s[i-1]/2);let h=p*Math.ceil(s[i-2]/2),f="int b, int row, int col",m="b * ".concat(h," + (row / 2) * ").concat(p," + (col / 2)");for(let e=2;e<i-1;e++)f="int b".concat(e,", ")+f,h*=s[i-e-1],m="b".concat(e," * ").concat(h," + ")+m;return"\n vec4 ".concat(r,"(").concat(f,") {\n int index = ").concat(m,";\n int texR = index / ").concat(d,";\n int texC = index - texR * ").concat(d,";\n vec2 uv = (vec2(texC, texR) + halfCR) / vec2(").concat(d,", ").concat(u,");\n return ").concat(o.texture2D,"(").concat(n,", uv);\n }\n ")}(e,t)}}const u="\nvec2 uvFromFlat(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}\nvec2 packedUVfrom1D(int texNumR, int texNumC, int index) {\n int texelIndex = index / 2;\n int texR = texelIndex / texNumC;\n int texC = texelIndex - texR * texNumC;\n return (vec2(texC, texR) + halfCR) / vec2(texNumC, texNumR);\n}\n",d="\nvec2 packedUVfrom2D(int texelsInLogicalRow, int texNumR,\n int texNumC, int row, int col) {\n int texelIndex = (row / 2) * texelsInLogicalRow + (col / 2);\n int texR = texelIndex / texNumC;\n int texC = texelIndex - texR * texNumC;\n return (vec2(texC, texR) + halfCR) / vec2(texNumC, texNumR);\n}\n",p="\nvec2 packedUVfrom3D(int texNumR, int texNumC,\n int texelsInBatch, int texelsInLogicalRow, int b,\n int row, int col) {\n int index = b * texelsInBatch + (row / 2) * texelsInLogicalRow + (col / 2);\n int texR = index / texNumC;\n int texC = index - texR * texNumC;\n return (vec2(texC, texR) + halfCR) / vec2(texNumC, texNumR);\n}\n",h="\n float getChannel(vec4 frag, vec2 innerDims) {\n vec2 modCoord = mod(innerDims, 2.);\n return modCoord.x == 0. ?\n (modCoord.y == 0. ? frag.r : frag.g) :\n (modCoord.y == 0. ? frag.b : frag.a);\n }\n float getChannel(vec4 frag, int dim) {\n float modCoord = mod(float(dim), 2.);\n return modCoord == 0. ? frag.r : frag.g;\n }\n";function f(e){return"offset".concat(e)}function m(e){const t=e.name,n=r.util.sizeFromShape(e.shapeInfo.logicalShape);return n<2?"return ".concat(t,";"):"\n for (int i = 0; i < ".concat(n,";
1 i++) {\n if (i == index) {\n return ").concat(t,"[i];\n }\n }\n ")}function g(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 ".concat(e," is not yet supported"))}function y(e,t,n){const{newShape:a,keptDims:o}=r.util.squeezeShape(t),s=t.length,i=e&&3===s&&1===t[0],c=i?t.slice(1):a,l=!e&&s>1&&!r.util.arraysEqual(t,n)&&a.length<s||i;return{useSqueezeShape:l,uniformShape:l?c:t,keptDims:o}}function v(e,t){const n=JSON.parse(JSON.stringify(e));return n.shapeInfo.logicalShape=t,n}function b(e,t){return t.map((t=>e[t])).join(", ")}},270327:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ENCODE_FLOAT_SNIPPET=void 0,t.dotify=function(e,t){if(e.length!==t.length)throw new Error("Vectors to be dotted must be of the same length -"+"got ".concat(e.length," and ").concat(t.length));const n=[],r=Math.floor(e.length/4),o=e.length%4;for(let o=0;o<r;o++){const r=e.slice(4*o,4*o+4),s=t.slice(4*o,4*o+4);n.push("".concat(a(r),", ").concat(a(s)))}if(0!==o){let o=e.slice(4*r),s=t.slice(4*r);1===o.length&&(o=o.map((e=>"float(".concat(e,")"))),s=s.map((e=>"float(".concat(e,")")))),n.push("".concat(a(o),", ").concat(a(s)))}return n.map(((e,t)=>"dot(".concat(e,")"))).join("+")},t.getFlatIndexFrom3D=function(e){const t=r.util.computeStrides(e).map((e=>e.toString()));return"\n int getFlatIndex(ivec3 coords) {\n return coords.x * ".concat(t[0]," + coords.y * ").concat(t[1]," + coords.z;\n }\n")},t.getFlatIndexFrom3DOutput=function(){return"\n int getFlatIndex(ivec3 coords) {\n return coords.x * outShapeStrides[0] + coords.y * outShapeStrides[1] + coords.z;\n }\n"},t.getLogicalCoordinatesFromFlatIndex=function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"index";const a=r.util.computeStrides(t);return a.map(((t,r)=>{const o="int ".concat(e[r]," = ").concat(n," / ").concat(t),s=r===a.length-1?"int ".concat(e[r+1]," = ").concat(n," - ").concat(e[r]," * ").concat(t):"index -= ".concat(e[r]," * ").concat(t);return"".concat(o,"; ").concat(s,";")})).join("")},t.getLogicalCoordinatesFromFlatIndexByUniform=function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"index";const r=function(e,t){const n=e.length,r=e.map((e=>"".concat(t,"[").concat(e,"]"))),a=new Array(n-1);a[n-2]=r[n-1];for(let e=n-3;e>=0;--e)a[e]="(".concat(a[e+1]," * ").concat(r[e+1],")");return a}(e.map(((e,t)=>t)),t);return r.map(((t,a)=>{const o="int ".concat(e[a]," = ").concat(n," / ").concat(r[a]),s=a===r.length-1?"int ".concat(e[a+1]," = ").concat(n," - ").concat(e[a]," * ").concat(r[a]):"index -= ".concat(e[a]," * ").concat(r[a]);return"".concat(o,"; ").concat(s,";")})).join("")},t.getOutputLogicalCoordinatesFromFlatIndexByUniform=function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"index";const a=r.util.computeStrides(t);return a.map(((t,r)=>{const o="int ".concat(e[r]," = ").concat(n," / outShapeStrides[").concat(r,"]"),s=r===a.length-1?"int ".concat(e[r+1]," = ").concat(n," - ").concat(e[r]," * outShapeStrides[").concat(r,"]"):"index -= ".concat(e[r]," * outShapeStrides[").concat(r,"]");return"".concat(o,"; ").concat(s,";")})).join("")};var r=n(735534);function a(e){return 1===e.length?"".concat(e[0]):"vec".concat(e.length,"(").concat(e.join(","),")")}t.ENCODE_FLOAT_SNIPPET="\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"},853877:(e,t,n)=>{"use strict";
1Object.defineProperty(t,"__esModule",{value:!0}),t.SliceProgram=void 0;var r=n(41990);t.SliceProgram=class{constructor(e){this.variableNames=["source"],this.outputShape=e,this.rank=e.length;const t=(0,r.getCoordsDataType)(this.rank);this.customUniforms=[{name:"start",arrayIndex:this.rank,type:"int"}];const n=function(e){if(1===e)return"sourceLoc";if(e<=6)return a.slice(0,e).map((e=>"sourceLoc."+e)).join(",");throw Error("Slicing for rank ".concat(e," is not yet supported"))}(this.rank);let o;const s=e.map(((e,t)=>"sourceLoc.".concat(a[t]," = start[").concat(t,"] + coords.").concat(a[t],";")));o="\n ".concat(t," sourceLoc;\n ").concat(t," coords = getOutputCoords();\n ").concat(s.join("\n"),"\n "),this.userCode="\n void main() {\n ".concat(o,"\n setOutput(getSource(").concat(n,"));\n }\n ")}};const a=["x","y","z","w","u","v"]},611325:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.SlicePackedProgram=void 0;var r=n(530675),a=n(41990);t.SlicePackedProgram=class{constructor(e){this.variableNames=["source"],this.packedInputs=!0,this.packedOutput=!0,this.outputShape=e,this.rank=e.length,this.customUniforms=[{name:"start",arrayIndex:this.rank,type:"int"}];const t=(0,a.getCoordsDataType)(this.rank),n=(0,r.getChannels)("coords",this.rank),o=(0,r.getChannels)("sourceLoc",this.rank),s=1===this.rank?"sourceLoc":"vec2(".concat(o.slice(-2).join(),")"),i="getChannel(getSource(".concat(o.join(),"), ").concat(s,")"),c="\n result.x = ".concat(i,";\n if (++").concat(n[this.rank-1]," < ").concat(e[this.rank-1],") {\n ++").concat(o[this.rank-1],";\n result.y = ").concat(i,";\n --").concat(o[this.rank-1],";\n }\n "),l=1===this.rank?"":"\n --".concat(n[this.rank-1],";\n if (++").concat(n[this.rank-2]," < ").concat(e[this.rank-2],") {\n ++").concat(o[this.rank-2],";\n result.z = ").concat(i,";\n if (++").concat(n[this.rank-1]," < ").concat(e[this.rank-1],") {\n ++").concat(o[this.rank-1],";\n result.w = ").concat(i,";\n }\n }\n "),u=this.rank<=4?"sourceLoc = coords +\n ".concat(t,"(").concat(e.map(((e,t)=>"start[".concat(t,"]"))).join(),");"):e.map(((e,t)=>"".concat(o[t]," = ").concat(n[t]," + start[").concat(t,"];"))).join("\n");this.userCode="\n void main() {\n ".concat(t," coords = getOutputCoords();\n ").concat(t," sourceLoc;\n ").concat(u,"\n vec4 result = vec4(0.);\n ").concat(c,"\n ").concat(l,"\n setOutput(result);\n }\n ")}}},143680:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.StridedSliceProgram=void 0;var r=n(41990);t.StridedSliceProgram=class{constructor(e,t,n){this.variableNames=["x"],this.outputShape=n;const a=n.length,o=(0,r.getCoordsDataType)(n.length),s=(0,r.getCoordsDataType)(n.length);let i="";if(1===a)i="coords * strides + begin";else{let e=0;i=n.map(((t,r)=>(e++,1===n.length?"coords * strides[".concat(r,"] + begin[").concat(r,"]"):"coords[".concat(e-1,"] * strides[").concat(r,"] + begin[").concat(r,"]")))).join(",")}this.userCode="\n ".concat(o," begin = ").concat(o,"(").concat(e,");\n ").concat(o," strides = ").concat(o,"(").concat(t,");\n\n void main() {\n ").concat(s," coords = getOutputCoords();\n setOutput(getX(").concat(i,"));\n }\n ")}}},845772:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.TextureUsage=t.PhysicalTextureType=t.PackingScheme=void 0,t.decodeMatrixFromUnpackedColorRGBAArray=function(e,t,n){const r=e.length*n/4;if(t.length<r)throw new Error("matrix length (".concat(t.length,") must be >= ").concat(r));let a=0;for(let r=0;r<e.length;r+=4)for(let o=0;o<n;o++)t[a++]=e[r+o]},t.getColorMatrixTextureShapeWidthHeight=function(e,t){return[4*t,e]},t.getDenseTexShape=function(e){const t=s.util.sizeFromShape(e),n=Math.ceil(t/4);return s.util.sizeToSquarishShape(n)},t.getMatrixSizeFromUnpackedArraySize=function(e,t){if(e%t!=0)throw new Error("unpackedSize (".concat(e,") must be a multiple of ")+"".concat(t));return e/t},t.getPackedMatrixTextureShapeWidthHeight=i,t.getPackedRGBAArraySizeFromMatrixShape=function(e,t){const[n,r]=i(e,t);return n*r*4},t.getTextureConfig=function(e,t){const n=e;let r,a,o,i,c,l,u,d,p,h;2===(0,s.env)().getNumber("WEBGL_VERSION")?(r=n.R32F,a=n.R16F,o=n.RGBA16F,i=n.RGBA32F,c=n.RED,u=4,d=1,p=n.HALF_FLOAT,h=n.FLOAT,l=n.RGBA8):(r=e.RGBA,a=e.RGBA,o=e.RGBA,i=n.RGBA,c=e.RGBA,u=4,d=4,p=null!=t?t.HALF_FLOAT_OES:null,h=e.FLOAT,l=e.RGBA);return{internalFormatFloat:r,internalFormatHalfFloat:a,internalFormatPackedHalfFloat:o,internalFormatPackedFloat:i,textureFormatFloat:c,downloadTextureFormat:l,downloadUnpackNumChannels:u,defaultNumChannels:d,textureTypeHalfFloat:p,textureTypeFloat:h}},t.getUnpackedArraySizeFromMatrixSize=function(e,t){return e*t},t.getUnpackedMatrixTextureShapeWidthHeight=function(e,t){return[t,e]};var r,a,o,s=n(735534);function i(e,t){return[Math.max(1,Math.ceil(t/2)),Math.max(1,Math.ceil(e/2))]}!function(e){e[e.DENSE=0]="DENSE",e[e.SHARED_BATCH=1]="SHARED_BATCH"}(r||(t.PackingScheme=r={})),function(e){e[e.RENDER=0]="RENDER",e[e.UPLOAD=1]="UPLOAD",e[e.PIXELS=2]="PIXELS",e[e.DOWNLOAD=3]="DOWNLOAD"}(a||(t.TextureUsage=a={})),function(e){e[e.UNPACKED_FLOAT16=0]="UNPACKED_FLOAT16",e[e.UNPACKED_FLOAT32=1]="UNPACKED_FLOAT32",e[e.PACKED_4X1_UNSIGNED_BYTE=2]="PACKED_4X1_UNSIGNED_BYTE",e[e.PACKED_2X2_FLOAT32=3]="PACKED_2X2_FLOAT32",e[e.PACKED_2X2_FLOAT16=4]="PACKED_2X2_FLOAT16"}
1(o||(t.PhysicalTextureType=o={}))},463574:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.TextureManager=void 0,t.computeBytes=s;var r=n(735534),a=n(665163),o=n(845772);function s(e,t,n,r,s){const i=function(e,t){switch(e){case o.PhysicalTextureType.PACKED_2X2_FLOAT32:return(0,a.getInternalFormatForPackedMatrixTexture)(t);case o.PhysicalTextureType.PACKED_2X2_FLOAT16:return(0,a.getInternalFormatForFloat16PackedMatrixTexture)(t);case o.PhysicalTextureType.UNPACKED_FLOAT32:return(0,a.getInternalFormatForFloat32MatrixTexture)(t);case o.PhysicalTextureType.UNPACKED_FLOAT16:return(0,a.getInternalFormatForFloat16MatrixTexture)(t);case o.PhysicalTextureType.PACKED_4X1_UNSIGNED_BYTE:return(0,a.getInternalFormatForUnsignedBytesMatrixTexture)(t);default:throw new Error("Unknown physical texture type ".concat(e))}}(t,r);let c;if(s){const[t,n]=(0,o.getPackedMatrixTextureShapeWidthHeight)(e[0],e[1]);c=t*n}else{const[t,n]=(0,o.getUnpackedMatrixTextureShapeWidthHeight)(e[0],e[1]);c=t*n}const l=function(e,t){const n=e;if(t===n.R32F)return 4;if(t===n.R16F)return 2;if(t===n.RGBA32F)return 16;if(t===e.RGBA)return 16;if(t===n.RGBA16F)return 8;if(t===n.RGBA8)return 4;throw new Error("Unknown internal format ".concat(t))}(n,i);return c*l}function i(e,t){if(e===o.TextureUsage.UPLOAD)return o.PhysicalTextureType.PACKED_2X2_FLOAT32;if(e===o.TextureUsage.RENDER||null==e)return function(e){return(0,r.env)().getBool("WEBGL_RENDER_FLOAT32_ENABLED")?e?o.PhysicalTextureType.PACKED_2X2_FLOAT32:o.PhysicalTextureType.UNPACKED_FLOAT32:e?o.PhysicalTextureType.PACKED_2X2_FLOAT16:o.PhysicalTextureType.UNPACKED_FLOAT16}(t);if(e===o.TextureUsage.DOWNLOAD||e===o.TextureUsage.PIXELS)return o.PhysicalTextureType.PACKED_4X1_UNSIGNED_BYTE;throw new Error("Unknown logical texture type ".concat(e))}function c(e,t,n){return"".concat(e[0],"_").concat(e[1],"_").concat(t,"_").concat(n)}t.TextureManager=class{constructor(e){this.gpgpu=e,this.numUsedTextures=0,this.numFreeTextures=0,this._numBytesAllocated=0,this._numBytesFree=0,this.freeTextures={},this.logEnabled=!1,this.usedTextures={}}acquireTexture(e,t,n){const r=i(t,n),a=c(e,r,n);a in this.freeTextures||(this.freeTextures[a]=[]),a in this.usedTextures||(this.usedTextures[a]=[]);const l=s(e,r,this.gpgpu.gl,this.gpgpu.textureConfig,n);if(this.freeTextures[a].length>0){this.numFreeTextures--,this.numUsedTextures++,this._numBytesFree-=l,this.log(
1);const e=this.freeTextures[a].shift();return this.usedTextures[a].push(e),e}let u;return r===o.PhysicalTextureType.PACKED_2X2_FLOAT32?u=this.gpgpu.createPackedMatrixTexture(e[0],e[1]):r===o.PhysicalTextureType.PACKED_2X2_FLOAT16?u=this.gpgpu.createFloat16PackedMatrixTexture(e[0],e[1]):r===o.PhysicalTextureType.UNPACKED_FLOAT32?u=this.gpgpu.createFloat32MatrixTexture(e[0],e[1]):r===o.PhysicalTextureType.UNPACKED_FLOAT16?u=this.gpgpu.createFloat16MatrixTexture(e[0],e[1]):r===o.PhysicalTextureType.PACKED_4X1_UNSIGNED_BYTE&&(u=this.gpgpu.createUnsignedBytesMatrixTexture(e[0],e[1])),this.usedTextures[a].push(u),this.numUsedTextures++,this._numBytesAllocated+=l,this.log(),u}releaseTexture(e,t,n,a){if(null==this.freeTextures)return;const o=i(n,a),l=c(t,o,a);l in this.freeTextures||(this.freeTextures[l]=[]);const u=s(t,o,this.gpgpu.gl,this.gpgpu.textureConfig,a),d=(0,r.env)().get("WEBGL_DELETE_TEXTURE_THRESHOLD");-1!==d&&this._numBytesAllocated>d?(this.gpgpu.deleteMatrixTexture(e.texture),this._numBytesAllocated-=u):(this.freeTextures[l].push(e),this.numFreeTextures++,this._numBytesFree+=u),this.numUsedTextures--;const p=this.usedTextures[l],h=p.indexOf(e);if(h<0)throw new Error("Cannot release a texture that was never provided by this texture manager");p.splice(h,1),this.log()}log(){if(!this.logEnabled)return;const e=this.numFreeTextures+this.numUsedTextures;console.log("Free/Used","".concat(this.numFreeTextures," / ").concat(this.numUsedTextures),"(".concat(e,")"));const t=this._numBytesFree/this._numBytesAllocated;console.log("Bytes allocated: ".concat(this._numBytesAllocated)),console.log("Bytes unused: ".concat(this._numBytesFree," (").concat(Math.round(100*t),"%)"))}get numBytesAllocated(){return this._numBytesAllocated}get numBytesFree(){return this._numBytesFree}getNumUsedTextures(){return this.numUsedTextures}getNumFreeTextures(){return this.numFreeTextures}dispose(){if(null!=this.freeTextures){for(const e in this.freeTextures)this.freeTextures[e].forEach((e=>{this.gpgpu.deleteMatrixTexture(e.texture)}));for(const e in this.usedTextures)this.usedTextures[e].forEach((e=>{this.gpgpu.deleteMatrixTexture(e.texture)}));this.freeTextures=null,this.usedTextures=null,this.numUsedTextures=0,this.numFreeTextures=0,this._numBytesAllocated=0,this._numBytesFree=0}}}}
1,395954:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.TileProgram=void 0;var r=n(41990);t.TileProgram=class{constructor(e,t){this.variableNames=["A"];const n=new Array(e.length);for(let r=0;r<n.length;r++)n[r]=e[r]*t[r];this.outputShape=n,this.rank=n.length;const a=(0,r.getCoordsDataType)(this.rank),o=function(e){const t=e.length;if(t>5)throw Error("Tile for rank ".concat(t," is not yet supported"));if(1===t)return"imod(resRC, ".concat(e[0],")");const n=["resRC.x","resRC.y","resRC.z","resRC.w","resRC.u"],r=[];for(let t=0;t<e.length;t++)r.push("imod(".concat(n[t],", ").concat(e[t],")"));return r.join()}(e);this.userCode="\n void main() {\n ".concat(a," resRC = getOutputCoords();\n setOutput(getA(").concat(o,"));\n }\n ")}}},128603:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.SwapProgram=t.MergeProgram=void 0;t.SwapProgram=class{constructor(e){this.variableNames=["x","indices"],this.customUniforms=[{name:"n",type:"int"},{name:"firstPass",type:"int"},{name:"negativeInf",type:"float"},{name:"dir",type:"int"},{name:"inc",type:"int"}],this.outputShape=e,this.userCode="\n void main() {\n ivec2 coords = getOutputCoords();\n int batch = coords[0];\n int elemIdx = coords[1];\n\n // We compare elements pair-wise within a group of size 2 * inc.\n // The comparing rule for each group alternates between ascending\n // and descending. Within each group, we compare each pair at\n // positions i and i+inc. To decide whether an element at position i\n // is x0 or x1, we mod it by 2 * inc, if the result is smaller than\n // inc, it is in the first half of the group, we denote it as x0,\n // otherwise we denote it as x1.\n // For example, as shown in the Bitonic top K paper referenced above,\n // Figure5(a) shows that element[1] is in the\n // second half of the group when group size is 2, but it is in the\n // first half of the group when group size is 4.\n\n bool isFirstInPair = imod(elemIdx, 2 * inc) < inc;\n int i = isFirstInPair ? elemIdx : elemIdx - inc;\n\n int i0 = firstPass == 1 ? i : int(getIndices(batch, i));\n int i1 = firstPass == 1 ? i + inc : int(getIndices(batch, i + inc));\n float x0 = i0 < n ? getX(batch, i0) : negativeInf;\n float x1 = i1 < n ? getX(batch, i1) : negativeInf;\n\n // Denotes which direction indices are in (ascending or descending).\n bool reverse = imod(elemIdx, 2 * dir) >= dir;\n bool isGreater = x0 > x1 || (x0 == x1 && i1 > i0);\n if (reverse == isGreater) { // Elements in opposite order of direction\n int iTemp = i0;\n i0 = i1;\n i1 = iTemp;\n }\n if (isFirstInPair) {\n setOutput(float(i0));\n } else {\n setOutput(float(i1));\n }\n }\n "}};t.MergeProgram=class{constructor(e){this.variableNames=["x","indices"],this.customUniforms=[{name:"n",type:"int"},{name:"firstPass",type:"int"},{name:"k",type:"int"}],this.outputShape=e,this.userCode="\n void main() {\n // Takes max of indices (0, k), (1, k + 1), (2, k + 2) ...\n ivec2 coords = getOutputCoords();\n int batch = coords[0];\n int elemIdx = coords[1];\n\n // The output size is half of the previous size.\n // If the previous sequence is | | | | _ _ _ _ | | | | _ _ _ _ (k=4),\n // we only need to output the indices at positions |, the indices at\n // positions _ can be thrown away, see Figure5(b) After Phase 2\n // (Merge phase) in the Bitonic Top K paper referenced above.\n // For example, the paper shows we only need to output the orange bars.\n // The output sequence should look like this | | | | | | | |.\n // Because the sequence is halved, to map the output index back\n // to the previous sequence to find the corresponding value,\n // we need to double the index. When we double the index,\n // we basically interpolate a position, so 2i looks like\n // | _ | _ | _ | _ | _ | _ | _. We move the | to the first k position\n // of each 2k positions by - elemIdx % k. E.g. for output at\n // index 4,5,6,7, we want to get the corresponding element at\n // original index 8,9,10,11, for output at index 8,9,10,11,\n // we want to get the corresponding element at original index\n // 16,17,18,19, so on and so forth.\n\n int i = elemIdx < k ? elemIdx : (elemIdx * 2 - imod(elemIdx, k));\n int i0 = firstPass == 1 ? i : int(getIndices(batch, i));\n int i1 = firstPass == 1 ? i + k : int(getIndices(batch, i + k));\n\n float x0 = getX(batch, i0);\n float x1 = i1 < n ? getX(batch, i1) : x0;\n\n setOutput(x0 >= x1 ? float(i0) : float(i1));\n }\n "}}},508334:(e,t)=>{"use strict";
1Object.defineProperty(t,"__esModule",{value:!0}),t.TransformProgram=void 0;t.TransformProgram=class{constructor(e,t,n,r,a,o){this.variableNames=["Image","Transforms"],this.outputShape=o;const s="nearest"===n?1:2;let i;switch(r){case"constant":default:i=1;break;case"reflect":i=2;break;case"wrap":i=3;break;case"nearest":i=4}this.userCode="\n float mapCoord(float outCoord, float len) {\n float inCoord = outCoord;\n if(".concat(i," == 2) {\n if (inCoord < 0.0) {\n if (len <= 1.0) {\n inCoord = 0.0;\n } else {\n float sz2 = 2.0 * len;\n if (inCoord < sz2) {\n inCoord = sz2 * float(int(float(-inCoord / sz2))) +\n inCoord;\n }\n inCoord = inCoord < -len ? inCoord + sz2 : -inCoord - 1.0;\n }\n } else if (inCoord > len - 1.0) {\n if (len <= 1.0) {\n inCoord = 0.0;\n } else {\n float sz2 = 2.0 * len;\n inCoord -= sz2 * float(int(float(inCoord / sz2)));\n if (inCoord >= len) {\n inCoord = sz2 - inCoord - 1.0;\n }\n }\n }\n return clamp(inCoord, 0.0, len - 1.0);\n } else if (").concat(i," == 3) {\n if (inCoord < 0.0) {\n if (len <= 1.0) {\n inCoord = 0.0;\n } else {\n float sz = len - 1.0;\n inCoord += len * (float(int(float(-inCoord / sz))) + 1.0);\n }\n } else if (inCoord > len - 1.0) {\n if (len <= 1.0) {\n inCoord = 0.0;\n } else {\n float sz = len - 1.0;\n inCoord -= len * float(int(float(inCoord / sz)));\n }\n }\n return clamp(inCoord, 0.0, len - 1.0);\n } else if (").concat(i," == 4) {\n return clamp(outCoord, 0.0, len - 1.0);\n } else {\n return outCoord;\n }\n }\n\n float readWithFillValue(int batch, int coordY, int coordX,\n int channel) {\n float outputValue;\n if (0 <= coordY && coordY < ").concat(e," && 0 <= coordX && coordX < ").concat(t,") {\n outputValue = getImage(batch, coordY, coordX, channel);\n } else {\n outputValue = float(").concat(a,");\n }\n return outputValue;\n }\n\n void main() {\n ivec4 coords = getOutputCoords();\n float outputValue;\n int batch = coords[0];\n int x = coords[2];\n int y = coords[1];\n int channel = coords[3];\n float xf = float(x);\n float yf = float(y);\n float a1 = getTransforms(batch, 0);\n float a2 = getTransforms(batch, 1);\n float a3 = getTransforms(batch, 2);\n float b1 = getTransforms(batch, 3);\n float b2 = getTransforms(batch, 4);\n float b3 = getTransforms(batch, 5);\n float c1 = getTransforms(batch, 6);\n float c2 = getTransforms(batch, 7);\n float projection = c1 * xf + c2 * yf + 1.0;\n if (projection == 0.0) {\n outputValue = float(").concat(a,");\n } else {\n float inX = (a1 * xf + a2 * yf + a3) / projection;\n float inY = (b1 * xf + b2 * yf + b3) / projection;\n float mapX = mapCoord(inX, float(").concat(t,"));\n float mapY = mapCoord(inY, float(").concat(e,"));\n\n if (").concat(s," == 1) {\n int coordY = int(round(mapY));
1\n int coordX = int(round(mapX));\n outputValue = readWithFillValue(batch, coordY, coordX,\n channel);\n } else {\n float yFloor = floor(mapY);\n float xFloor = floor(mapX);\n float yCeil = yFloor + 1.0;\n float xCeil = xFloor + 1.0;\n float valueYFloor = (xCeil - mapX) *\n readWithFillValue(batch, int(yFloor), int(xFloor), channel) +\n (mapX - xFloor) *\n readWithFillValue(batch, int(yFloor), int(xCeil), channel);\n float valueYCeil = (xCeil - mapX) *\n readWithFillValue(batch, int(yCeil), int(xFloor), channel) +\n (mapX - xFloor) *\n readWithFillValue(batch, int(yCeil), int(xCeil), channel);\n outputValue = (yCeil - mapY) * valueYFloor +\n (mapY - yFloor) * valueYCeil;\n }\n }\n setOutput(outputValue);\n }\n ")}}},674678:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.TransposeProgram=void 0;var r=n(41990);t.TransposeProgram=class{constructor(e,t){this.variableNames=["A"];const n=new Array(e.length);for(let r=0;r<n.length;r++)n[r]=e[t[r]];this.outputShape=n,this.rank=n.length;const a=(0,r.getCoordsDataType)(this.rank),o=function(e){const t=e.length;if(t>6)throw Error("Transpose for rank ".concat(t," is not yet supported"));const n=["resRC.x","resRC.y","resRC.z","resRC.w","resRC.u","resRC.v"],r=new Array(t);for(let t=0;t<e.length;t++)r[e[t]]=n[t];return r.join()}(t);this.userCode="\n void main() {\n ".concat(a," resRC = getOutputCoords();\n setOutput(getA(").concat(o,"));\n }\n ")}}},480750:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.TransposePackedProgram=void 0;var r=n(530675),a=n(41990);t.TransposePackedProgram=class{constructor(e,t){this.variableNames=["A"],this.packedInputs=!0,this.packedOutput=!0;const n=new Array(e.length);for(let r=0;r<n.length;r++)n[r]=e[t[r]];if(this.outputShape=n,this.rank=n.length,this.rank>6)throw Error("Packed transpose for rank ".concat(this.rank," is not yet supported."));const o=(0,a.getCoordsDataType)(this.rank),s=(0,r.getVecChannels)("rc",this.rank),i=new Array(this.rank);for(let e=0;e<t.length;e++)i[t[e]]=s[e];const c="vec2(".concat(i.slice(-2).join(),")"),l="++".concat(s[this.rank-1]," < ").concat(n[this.rank-1]),u="getChannel(getA(".concat(i.join(),"), ").concat(c,")");this.userCode="\n void main() {\n ".concat(o," rc = getOutputCoords();\n vec4 result = vec4(0.);\n result[0] = ").concat(u,";\n if(").concat(l,") {\n result[1] = ").concat(u,";\n }\n --").concat(s[this.rank-1],";\n if(++").concat(s[this.rank-2]," < ").concat(n[this.rank-2],") {\n result[2] = ").concat(u,";\n if(").concat(l,") {\n result[3] = ").concat(u,";\n }\n }\n setOutput(result);\n }\n ")}}},934500:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.SIGMOID=t.RELU6=t.RELU=t.LINEAR=t.ELU=t.CLONE=t.CHECK_NAN_SNIPPET=t.ABS=void 0,t.STEP=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return a+"\n return x > 0.0 ? 1.0 : float(".concat(e,");\n ")},t.UnaryOpProgram=void 0;var r=n(965438);t.UnaryOpProgram=class{constructor(e,t){this.variableNames=["A"],this.outputShape=e,this.enableShapeUniforms=(0,r.useShapeUniforms)(this.outputShape.length),this.userCode="\n float unaryOperation(float x) {\n ".concat(t,"\n }\n\n void main() {\n float x = getAAtOutCoords();\n float y = unaryOperation(x);\n\n setOutput(y);\n }\n ")}};const a=t.CHECK_NAN_SNIPPET="if (isnan(x)) return x;";t.LINEAR="return x;",t.ABS="return abs(x);";t.ELU="return (x >= 0.0) ? x : (exp(x) - 1.0);",t.RELU=a+"\n return (x < 0.0) ? 0.0 : x;\n",t.RELU6=a+"\n return (x < 0.0) ? 0.0 : min(6.0, x);\n",t.CLONE="return x;",t.SIGMOID="return 1.0 / (1.0 + exp(-1.0 * x));"},721797:(e,t,n)=>{"use strict";
1Object.defineProperty(t,"__esModule",{value:!0}),t.UnaryOpPackedProgram=t.SIGMOID=t.RELU6=t.RELU=t.LINEAR=t.ELU=void 0;var r=n(965438);t.LINEAR="return x;",t.ELU="\n vec4 result;\n\n result.r = (x.r >= 0.0) ? x.r : (exp(x.r) - 1.0);\n result.g = (x.g >= 0.0) ? x.g : (exp(x.g) - 1.0);\n result.b = (x.b >= 0.0) ? x.b : (exp(x.b) - 1.0);\n result.a = (x.a >= 0.0) ? x.a : (exp(x.a) - 1.0);\n\n return result;\n",t.RELU="\n vec4 result = x * vec4(greaterThanEqual(x, vec4(0.0)));\n bvec4 isNaN = isnan(x);\n\n result.r = isNaN.r ? x.r : result.r;\n result.g = isNaN.g ? x.g : result.g;\n result.b = isNaN.b ? x.b : result.b;\n result.a = isNaN.a ? x.a : result.a;\n\n return result;\n",t.RELU6="\n vec4 result = min(x, vec4(6.)) * vec4(greaterThanEqual(x, vec4(0.0)));\n bvec4 isNaN = isnan(x);\n\n result.r = isNaN.r ? x.r : result.r;\n result.g = isNaN.g ? x.g : result.g;\n result.b = isNaN.b ? x.b : result.b;\n result.a = isNaN.a ? x.a : result.a;\n\n return result;\n",t.SIGMOID="return 1.0 / (1.0 + exp(-1.0 * x));";t.UnaryOpPackedProgram=class{constructor(e,t){this.variableNames=["A"],this.packedInputs=!0,this.packedOutput=!0,this.outputShape=e,this.enableShapeUniforms=(0,r.useShapeUniforms)(this.outputShape.length),this.userCode="\n vec4 unaryOperation(vec4 x) {\n ".concat(t,"\n }\n\n void main() {\n vec4 x = getAAtOutCoords();\n vec4 y = unaryOperation(x);\n\n setOutput(y);\n }\n ")}}},59579:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.UnpackProgram=void 0;var r=n(965438),a=n(530675),o=n(41990);t.UnpackProgram=class{constructor(e){this.variableNames=["A"],this.packedInputs=!0,this.packedOutput=!1,this.outputShape=e,this.enableShapeUniforms=(0,r.useShapeUniforms)(this.outputShape.length);const t=e.length,n=(0,a.getChannels)("rc",t),s=(0,o.getCoordsDataType)(t),i=(0,a.getSourceCoords)(t,n),c=n.slice(-2),l=t<=1?"rc":"vec2(".concat(c.join(","),")");this.userCode="\n void main() {\n ".concat(s," rc = getOutputCoords();\n vec4 packedInput = getA(").concat(i,");\n\n setOutput(getChannel(packedInput, ").concat(l,"));\n }\n ")}}},319902:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.version=void 0;t.version="3.14.0"},929267:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"GPGPUContext",{enumerable:!0,get:function(){return c.GPGPUContext}}),Object.defineProperty(t,"MathBackendWebGL",{enumerable:!0,get:function(){return s.MathBackendWebGL}}),t.forceHalfFloat=function(){(0,r.env)().set("WEBGL_FORCE_F16_TEXTURES",!0)},t.gpgpu_util=void 0,Object.defineProperty(t,"setWebGLContext",{enumerable:!0,get:function(){return i.setWebGLContext}}),t.webgl_util=void 0;var r=n(735534),a=u(n(665163));t.gpgpu_util=a;var o=u(n(519617));t.webgl_util=o;var s=n(473002),i=n(821551),c=n(80567);function l(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(l=function(e){return e?n:t})(e)}function u(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=l(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if("default"!==o&&{}.hasOwnProperty.call(e,o)){var s=a?Object.getOwnPropertyDescriptor(e,o):null;s&&(s.get||s.set)?Object.defineProperty(r,o,s):r[o]=e[o]}return r.default=e,n&&n.set(e,r),r}},519617:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.assertNotComplex=function(e,t){Array.isArray(e)||(e=[e]);e.forEach((e=>{null!=e&&r.util.assert("complex64"!==e.dtype,(()=>"".concat(t," does not support complex64 tensors ")+"in the WebGL backend."))}))},t.bindCanvasToFramebuffer=function(e){s(e,(()=>e.bindFramebuffer(e.FRAMEBUFFER,null))),s(e,(()=>e.viewport(0,0,e.canvas.width,e.canvas.height))),s(e,(()=>e.scissor(0,0,e.canvas.width,e.canvas.height)))},t.bindColorTextureToFramebuffer=function(e,t,n){s(e,(()=>e.bindFramebuffer(e.FRAMEBUFFER,n))),s(e,(()=>e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,t,0)))},t.bindTextureToProgramUniformSampler=function(e,t,n,r){s(e,(()=>d(e,t,r))),s(e,(()=>e.uniform1i(n,r)))},t.bindTextureUnit=d,t.bindVertexBufferToProgramAttribute=function(e,t,n,r,a,o,i){const c=e.getAttribLocation(t,n);if(-1===c)return!1;return s(e,(()=>e.bindBuffer(e.ARRAY_BUFFER,r))),s(e,(()=>e.vertexAttribPointer(c,a,e.FLOAT,!1,o,i))),s(e,(()=>e.enableVertexAttribArray(c))),!0},t.callAndCheck=s,t.canBeRepresented=function(e){if((0,r.env)().getBool("WEBGL_RENDER_FLOAT32_ENABLED")||0===e||i<Math.abs(e)&&Math.abs(e)<c)return!0;return!1},t.createFragmentShader=function(e,t){const n=h(e,(()=>e.createShader(e.FRAGMENT_SHADER)),"Unable to create fragment WebGLShader.");if(s(e,(()=>e.shaderSource(n,t))),s(e,(()=>e.compileShader(n))),!1===e.getShaderParameter(n,e.COMPILE_STATUS))throw function(e,t){const n=u.exec(t);if(null==n)return console.log("Couldn't parse line number in error: ".concat(t)),void console.log(e);const a=+n[1],o=e.split("\n"),s=o.length.toString().length+2,i=o.map(((e,t)=>r.util.rightPad((t+1).toString(),s)+e));let c=0;for(let e=0;e<i.length;e++)c=Math.max(i[e].length,c);const l=i.slice(0,a-1),d=i.slice(a-1,a),p=i.slice(a);console.log(l.join("\n")),console.log(t.split("\n")[0]),console.log("%c ".concat(r.util.rightPad(d[0],c)),"border:1px solid red; background-color:#e3d2d2; color:#a61717"),console.log(p.join("\n"))}(t,e.getShaderInfoLog(n)),new Error("Failed to compile fragment shader.");return n},t.createFramebuffer=function(e){return h(e,(()=>e.createFramebuffer()),"Unable to create WebGLFramebuffer.")},t.createProgram=function(e){return h(e,(()=>e.createProgram()),"Unable to create WebGLProgram.")},t.createStaticIndexBuffer=function(e,t){const n=h(e,(()=>e.createBuffer()),"Unable to create WebGLBuffer");return s(e,(()=>e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,n))),s(e,(()=>e.bufferData(e.ELEMENT_ARRAY_BUFFER,t,e.STATIC_DRAW))),n},t.createStaticVertexBuffer=function(e,t){const n=h(e,(()=>e.createBuffer()),"Unable to create WebGLBuffer");return s(e,(()=>e.bindBuffer(e.ARRAY_BUFFER,n))),s(e,(()=>e.bufferData(e.ARRAY_BUFFER,t,e.STATIC_DRAW))),n},t.createTexture=function(e){return h(e,(()=>e.createTexture()),"Unable to create WebGLTexture.")},t.createVertexShader=function(e,t){const n=h(e,(()=>e.createShader(e.VERTEX_SHADER)),"Unable to create vertex WebGLShader.");if(s(e,(()=>e.shaderSource(n,t))),s(e,(()=>e.compileShader(n))),!1===e.getShaderParameter(n,e.COMPILE_STATUS))throw console.log(e.getShaderInfoLog(n)),new Error("Failed to compile vertex shader.");return n},t.getBatchDim=m,t.getExtensionOrThrow=function(e,t){return h(e,(()=>e.getExtension(t)),'Extension "'+t+'" not supported on this browser.')},t.getFramebufferErrorMessage=p,t.getMaxTexturesInShader=function(e){if(null==b){const t=(0,a.getWebGLContext)(e);b=t.getParameter(t.MAX_TEXTURE_IMAGE_UNITS)}return Math.min(16,b)},t.getNumChannels=function(){if(2===(0,r.env)().getNumber("WEBGL_VERSION"))return 1;return 4},t.getProgramUniformLocation=function(e,t,n){return e.getUniformLocation(t,n)},t.getProgramUniformLocationOrThrow=function(e,t,n){return h(e,(()=>e.getUniformLocation(t,n)),'uniform "'+n+'" not present in program.')},t.getRowsCols=g,t.getShapeAs3D=function(e){let t=[1,1,1];0===e.length||1===e.length&&1===e[0]||(t=[m(e),...g(e)]);return t}
1,t.getTextureShapeFromLogicalShape=function(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=(0,r.env)().getNumber("WEBGL_MAX_TEXTURE_SIZE");t&&(n*=2,1===(e=e.map(((t,n)=>n>=e.length-2?r.util.nearestLargerEven(e[n]):e[n]))).length&&(e=[2,e[0]]));if(2!==e.length){const t=r.util.squeezeShape(e);e=t.newShape}let a=r.util.sizeFromShape(e);if(e.length<=1&&a<=n)return[1,a];if(2===e.length&&e[0]<=n&&e[1]<=n)return e;if(3===e.length&&e[0]*e[1]<=n&&e[2]<=n)return[e[0]*e[1],e[2]];if(3===e.length&&e[0]<=n&&e[1]*e[2]<=n)return[e[0],e[1]*e[2]];if(4===e.length&&e[0]*e[1]*e[2]<=n&&e[3]<=n)return[e[0]*e[1]*e[2],e[3]];if(4===e.length&&e[0]<=n&&e[1]*e[2]*e[3]<=n)return[e[0],e[1]*e[2]*e[3]];if(t){const t=m(e);let n=2,o=2;return e.length&&([n,o]=g(e)),a=t*(n/2)*(o/2),r.util.sizeToSquarishShape(a).map((e=>2*e))}return r.util.sizeToSquarishShape(a)},t.getWebGLDisjointQueryTimerVersion=function(e){if(0===e)return 0;let t;const n=(0,a.getWebGLContext)(e);t=x(n,"EXT_disjoint_timer_query_webgl2")&&2===e?2:x(n,"EXT_disjoint_timer_query")?1:0;return t},t.getWebGLErrorMessage=l,t.getWebGLMaxTextureSize=function(e){if(null==v){const t=(0,a.getWebGLContext)(e);v=t.getParameter(t.MAX_TEXTURE_SIZE)}return v},t.hasExtension=x,t.isCapableOfRenderingToFloatTexture=function(e){if(0===e)return!1;const t=(0,a.getWebGLContext)(e);if(1===e){if(!x(t,"OES_texture_float"))return!1}else if(!x(t,"EXT_color_buffer_float"))return!1;return w(t)},t.isDownloadFloatTextureEnabled=function(e){if(0===e)return!1;const t=(0,a.getWebGLContext)(e);if(1!==e){if(x(t,"EXT_color_buffer_float"))return w(t);const e="EXT_color_buffer_half_float";if(x(t,e)){const n=t.getExtension(e);return function(e,t){const n=(0,o.getTextureConfig)(e,t),r=e.createTexture();e.bindTexture(e.TEXTURE_2D,r);const a=1,s=1;e.texImage2D(e.TEXTURE_2D,0,n.internalFormatHalfFloat,a,s,0,n.textureFormatFloat,n.textureTypeHalfFloat,null);const i=e.createFramebuffer();e.bindFramebuffer(e.FRAMEBUFFER,i),e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,r,0);const c=e.checkFramebufferStatus(e.FRAMEBUFFER)===e.FRAMEBUFFER_COMPLETE;return e.bindTexture(e.TEXTURE_2D,null),e.bindFramebuffer(e.FRAMEBUFFER,null),e.deleteTexture(r),e.deleteFramebuffer(i),c}(t,n)}return!1}if(!x(t,"OES_texture_float"))return!1;if(!x(t,"WEBGL_color_buffer_float"))return!1;return w(t)},t.isReshapeFree=function(e,t){if(e=e.slice(-2),t=t.slice(-2),r.util.arraysEqual(e,t))return!0;if(!e.length||!t.length)return!0;if(0===e[0]||0===e[1]||0===t[0]||0===t[1])return!0;if(e.length!==t.length){const n=e.slice(-1)[0],r=t.slice(-1)[0];if(n===r)return!0;if(y(n)&&y(r)&&(1===e[0]||1===t[0]))return!0}return e[1]===t[1]&&y(e[0])&&y(t[0])},t.isWebGLFenceEnabled=function(e){if(2!==e)return!1;const t=(0,a.getWebGLContext)(e);return null!=t.fenceSync},t.isWebGLVersionEnabled=function(e){try{if(null!=(0,a.getWebGLContext)(e))return!0}catch(e){return console.log("Error when getting WebGL context: ",e),!1}return!1},t.linkProgram=function(e,t){if(s(e,(()=>e.linkProgram(t))),!1===e.getProgramParameter(t,e.LINK_STATUS))throw console.log(e.getProgramInfoLog(t)),new Error("Failed to link vertex and fragment shaders.")},t.resetMaxTextureSize=function(){v=null},t.resetMaxTexturesInShader=function(){b=null},t.unbindColorTextureFromFramebuffer=function(e,t){s(e,(()=>e.bindFramebuffer(e.FRAMEBUFFER,t))),s(e,(()=>e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,null,0)))},t.unbindTextureUnit=function(e,t){f(e,t),s(e,(()=>e.activeTexture(e.TEXTURE0+t))),s(e,(()=>e.bindTexture(e.TEXTURE_2D,null)))},t.validateFramebuffer=function(e){const t=e.checkFramebufferStatus(e.FRAMEBUFFER);if(t!==e.FRAMEBUFFER_COMPLETE)throw new Error("Error binding framebuffer: "+p(e,t))},t.validateProgram=function(e,t){if(s(e,(()=>e.validateProgram(t))),!1===e.getProgramParameter(t,e.VALIDATE_STATUS))throw console.log(e.getProgramInfoLog(t)),new Error("Shader program validation failed.")},t.validateTextureSize=function(e,t){const n=(0,r.env)().getNumber("WEBGL_MAX_TEXTURE_SIZE");if(e<=0||t<=0){const n="[".concat(e,"x").concat(t,"]");
1throw new Error("Requested texture size "+n+" is invalid.")}if(e>n||t>n){const r="[".concat(e,"x").concat(t,"]"),a="[".concat(n,"x").concat(n,"]");throw new Error("Requested texture size "+r+" greater than WebGL maximum on this browser / GPU "+a+".")}};var r=n(735534),a=n(821551),o=n(845772);function s(e,t){const n=t();return(0,r.env)().getBool("DEBUG")&&function(e){const t=e.getError();if(t!==e.NO_ERROR)throw new Error("WebGL Error: "+l(e,t))}(e),n}const i=5.96e-8,c=65504;function l(e,t){switch(t){case e.NO_ERROR:return"NO_ERROR";case e.INVALID_ENUM:return"INVALID_ENUM";case e.INVALID_VALUE:return"INVALID_VALUE";case e.INVALID_OPERATION:return"INVALID_OPERATION";case e.INVALID_FRAMEBUFFER_OPERATION:return"INVALID_FRAMEBUFFER_OPERATION";case e.OUT_OF_MEMORY:return"OUT_OF_MEMORY";case e.CONTEXT_LOST_WEBGL:return"CONTEXT_LOST_WEBGL";default:return"Unknown error code ".concat(t)}}const u=/ERROR: [0-9]+:([0-9]+):/g;function d(e,t,n){f(e,n),s(e,(()=>e.activeTexture(e.TEXTURE0+n))),s(e,(()=>e.bindTexture(e.TEXTURE_2D,t)))}function p(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 ".concat(t)}}function h(e,t,n){const r=s(e,(()=>t()));if(null==r)throw new Error(n);return r}function f(e,t){const n=e.MAX_COMBINED_TEXTURE_IMAGE_UNITS-1,r=t+e.TEXTURE0;if(r<e.TEXTURE0||r>n){const e="[gl.TEXTURE0, gl.TEXTURE".concat(n,"]");throw new Error("textureUnit must be in ".concat(e,"."))}}function m(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:2;return r.util.sizeFromShape(e.slice(0,e.length-t))}function g(e){if(0===e.length)throw Error("Cannot get rows and columns of an empty shape array.");return[e.length>1?e[e.length-2]:1,e[e.length-1]]}function y(e){return e%2==0}let v,b;function x(e,t){return null!=e.getExtension(t)}function w(e){const t=(0,o.getTextureConfig)(e),n=e.createTexture();e.bindTexture(e.TEXTURE_2D,n);e.texImage2D(e.TEXTURE_2D,0,t.internalFormatFloat,1,1,0,t.textureFormatFloat,t.textureTypeFloat,null);const r=e.createFramebuffer();e.bindFramebuffer(e.FRAMEBUFFER,r),e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,n,0);const a=e.checkFramebufferStatus(e.FRAMEBUFFER)===e.FRAMEBUFFER_COMPLETE;return e.bindTexture(e.TEXTURE_2D,null),e.bindFramebuffer(e.FRAMEBUFFER,null),e.deleteTexture(n),e.deleteFramebuffer(r),a}},488665:(e,t)=>{"use strict";var n,r;Object.defineProperty(t,"__esModule",{value:!0}),t.SaverDef=t.DataType=void 0,function(e){e[e.DT_INVALID=0]="DT_INVALID",e[e.DT_FLOAT=1]="DT_FLOAT",e[e.DT_DOUBLE=2]="DT_DOUBLE",e[e.DT_INT32=3]="DT_INT32",e[e.DT_UINT8=4]="DT_UINT8",e[e.DT_INT16=5]="DT_INT16",e[e.DT_INT8=6]="DT_INT8",e[e.DT_STRING=7]="DT_STRING",e[e.DT_COMPLEX64=8]="DT_COMPLEX64",e[e.DT_INT64=9]="DT_INT64",e[e.DT_BOOL=10]="DT_BOOL",e[e.DT_QINT8=11]="DT_QINT8",e[e.DT_QUINT8=12]="DT_QUINT8",e[e.DT_QINT32=13]="DT_QINT32",e[e.DT_BFLOAT16=14]="DT_BFLOAT16",e[e.DT_QINT16=15]="DT_QINT16",e[e.DT_QUINT16=16]="DT_QUINT16",e[e.DT_UINT16=17]="DT_UINT16",e[e.DT_COMPLEX128=18]="DT_COMPLEX128",e[e.DT_HALF=19]="DT_HALF",e[e.DT_RESOURCE=20]="DT_RESOURCE",e[e.DT_VARIANT=21]="DT_VARIANT",e[e.DT_UINT32=22]="DT_UINT32",e[e.DT_UINT64=23]="DT_UINT64",e[e.DT_FLOAT_REF=101]="DT_FLOAT_REF",e[e.DT_DOUBLE_REF=102]="DT_DOUBLE_REF",e[e.DT_INT32_REF=103]="DT_INT32_REF",e[e.DT_UINT8_REF=104]="DT_UINT8_REF",e[e.DT_INT16_REF=105]="DT_INT16_REF",e[e.DT_INT8_REF=106]="DT_INT8_REF",e[e.DT_STRING_REF=107]="DT_STRING_REF",e[e.DT_COMPLEX64_REF=108]="DT_COMPLEX64_REF",e[e.DT_INT64_REF=109]="DT_INT64_REF",e[e.DT_BOOL_REF=110]="DT_BOOL_REF",e[e.DT_QINT8_REF=111]="DT_QINT8_REF",e[e.DT_QUINT8_REF=112]="DT_QUINT8_REF",e[e.DT_QINT32_REF=113]="DT_QINT32_REF",e[e.DT_BFLOAT16_REF=114]="DT_BFLOAT16_REF",e[e.DT_QINT16_REF=115]="DT_QINT16_REF",e[e.DT_QUINT16_REF=116]="DT_QUINT16_REF",e[e.DT_UINT16_REF=117]="DT_UINT16_REF",e[e.DT_COMPLEX128_REF=118]="DT_COMPLEX128_REF",e[e.DT_HALF_REF=119]="DT_HALF_REF",e[e.DT_RESOURCE_REF=120]="DT_RESOURCE_REF",e[e.DT_VARIANT_REF=121]="DT_VARIANT_REF",e[e.DT_UINT32_REF=122]="DT_UINT32_REF",e[e.DT_UINT64_REF=123]="DT_UINT64_REF"}(n||(t.DataType=n={})),function(e){let t;!function(e){e[e.LEGACY=0]="LEGACY",e[e.V1=1]="V1",e[e.V2=2]="V2"}(t=e.CheckpointFormatVersion||(e.CheckpointFormatVersion={}))}(r||(t.SaverDef=r={}))},658558:(e,t)=>{"use strict";
1Object.defineProperty(t,"__esModule",{value:!0}),t.ExecutionContext=void 0;t.ExecutionContext=class{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};this.weightMap=e,this.tensorArrayMap=t,this.tensorListMap=n,this.functionMap=r,this.rootContext={id:0,frameName:"",iterationId:0},this.contexts=[this.rootContext],this.lastId=0,this.generateCurrentContextIds()}newFrame(e,t){return{id:e,frameName:t,iterationId:0}}set currentContext(e){this.contexts!==e&&(this.contexts=e,this.generateCurrentContextIds())}get currentContext(){return this.contexts}get currentContextId(){return this._currentContextIds[0]}get currentContextIds(){return this._currentContextIds}generateCurrentContextIds(){const e=[];for(let t=0;t<this.contexts.length-1;t++){const n=this.contexts.slice(0,this.contexts.length-t);e.push(this.contextIdforContexts(n))}e.push(""),this._currentContextIds=e}contextIdforContexts(e){return e?e.map((e=>0===e.id&&0===e.iterationId?"":"".concat(e.frameName,"-").concat(e.iterationId))).join("/"):""}enterFrame(e){this.contexts&&(this.lastId++,this.contexts=this.contexts.slice(),this.contexts.push(this.newFrame(this.lastId,e)),this._currentContextIds.unshift(this.contextIdforContexts(this.contexts)))}exitFrame(){if(!(this.contexts&&this.contexts.length>1))throw new Error("Cannot exit frame, the context is empty");this.contexts=this.contexts.slice(),this.contexts.splice(-1),this.currentContextIds.shift()}nextIteration(){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++;const 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))}}getWeight(e){return this.weightMap[e]}addTensorArray(e){this.tensorArrayMap[e.id]=e}getTensorArray(e){return this.tensorArrayMap[e]}addTensorList(e){this.tensorListMap[e.id]=e}getTensorList(e){return this.tensorListMap[e]}dispose(e){for(const t in this.tensorArrayMap)this.tensorArrayMap[t].clearAndClose(e);for(const t in this.tensorListMap)this.tensorListMap[t].clearAndClose(e)}}},897628:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.GraphExecutor=void 0;var r=n(735534),a=n(598453),o=n(347750),s=n(658558),i=n(530539);class c{constructor(e,t){this.graph=e,this.parent=t,this.compiledMap=new Map,this._weightMap={},this.SEPERATOR=",",this._functions={},this._functionExecutorMap={},this.intermediateTensors={},this.keepTensorForDebug=!1,this._outputs=e.outputs,this._inputs=e.inputs,this._initNodes=e.initNodes,this._signature=e.signature,this._functions=e.functions,null!=e.functions&&Object.keys(e.functions).forEach((t=>{this._functionExecutorMap[t]=new c(e.functions[t],this)}))}get weightIds(){return this.parent?this.parent.weightIds:this._weightIds}get functionExecutorMap(){return this.parent?this.parent.functionExecutorMap:this._functionExecutorMap}get weightMap(){return this.parent?this.parent.weightMap:this._weightMap}set weightMap(e){const t=Object.keys(e).map((t=>e[t].map((e=>e.id))));this._weightIds=[].concat(...t),this._weightMap=e}set resourceManager(e){this._resourceManager=e}get inputs(){return this._inputs.map((e=>({name:e.name,shape:e.attrParams.shape?e.attrParams.shape.value:void 0,dtype:e.attrParams.dtype?e.attrParams.dtype.value:void 0})))}get outputs(){return this._outputs.map((e=>({name:e.name,shape:e.attrParams.shape?e.attrParams.shape.value:void 0,dtype:e.attrParams.dtype?e.attrParams.dtype.value:void 0})))}get inputNodes(){return this._inputs.map((e=>e.signatureKey||e.name))}get outputNodes(){return this._outputs.map((e=>{const t=e.signatureKey||e.name;return e.defaultOutput?"".concat(t,":").concat(e.defaultOutput):t}))}get functions(){return Object.keys(this._functions).reduce(((e,t)=>(e[t]=this._functions[t].signature,e)),{})}getCompilationKey(e,t){const n=e.map((e=>e.name)).sort(),r=t.map((e=>e.name)).sort();return n.join(this.SEPERATOR)+"--"+r.join(this.SEPERATOR)}compile(e,t){const n=(0,i.getExecutionSubgraph)(e,t,this.weightMap,this._initNodes),{missingInputs:r,dynamicNode:a,syncInputs:o}=n;if(null!=a)throw new Error("This execution contains the node '".concat(a.name,"', which has ")+"the dynamic op '".concat(a.op,"'. Please use ")+"model.executeAsync() instead. Alternatively, to avoid the "+"dynamic ops, specify the inputs [".concat(o,"]"));if(r.length>0){const n=t.map((e=>e.name)),a=Object.keys(e);throw new Error("Cannot compute the outputs [".concat(n,"] from the provided inputs ")+"[".concat(a,"]. Missing the following inputs: [").concat(r,"]"))}return(0,i.getNodesInTopologicalOrder)(this.graph,this.weightMap,n)}
1execute(e,t){e=this.mapInputs(e);const n=Object.keys(e).sort();this.checkInputs(e),this.checkInputShapeAndType(e),t=this.mapOutputs(t),this.checkOutputs(t);const i=n.map((e=>this.graph.nodes[(0,a.parseNodeName)(e)[0]])),c=t.map((e=>(0,a.parseNodeName)(e)[0]));let l=c.map((e=>this.graph.nodes[e]));this.resetIntermediateTensors(),0===l.length&&(l=this._outputs);const u=this.getCompilationKey(i,l);let d=this.compiledMap.get(u);null==d&&(d=this.compile(e,l),this.compiledMap.set(u,d));const p={},h={};return(0,r.tidy)((()=>{const n=new s.ExecutionContext(this.weightMap,p,h,this.functionExecutorMap),i=Object.assign({},this.weightMap);Object.keys(e).forEach((t=>{const[n,r]=(0,a.parseNodeName)(t),o=[];o[r]=e[t],i[n]=o}));const l=this.getFrozenTensorIds(i),u={};for(let e=0;e<d.length;e++){const t=d[e];if(!i[t.name]){const e=(0,o.executeOp)(t,i,n,this._resourceManager);if(r.util.isPromise(e))throw new Error("The execution of the op '".concat(t.op,"' returned a promise. ")+"Please use model.executeAsync() instead.");i[t.name]=e,this.checkTensorForDisposal(t.name,t,i,n,l,c,u)}}return null==this.parent&&n.dispose(l),t.map((e=>(0,a.getTensor)(e,i,n)))}))}getFrozenTensorIds(e){const t=[].concat.apply([],Object.keys(e).map((t=>e[t])).map((e=>e.map((e=>e.id)))));return new Set(t)}checkTensorForDisposal(e,t,n,r,o,s,i){"control"!==t.category&&-1===s.indexOf(e)&&(n[e].forEach((e=>{null!=e&&(i[e.id]=(i[e.id]||0)+t.children.length)})),t.inputs.forEach((e=>{if("control"!==e.category){const s=(0,a.getTensorsForCurrentContenxt)(e.name,n,r);null!=s&&s.forEach((e=>{if(e&&!e.kept&&!o.has(e.id)){const n=i[e.id];if(1===n){if(this.keepTensorForDebug){const[n,o]=(0,a.getNodeNameAndIndex)(t.name,r);this.intermediateTensors[n]||(this.intermediateTensors[n]=[]),this.intermediateTensors[n][o]=e}else e.dispose();delete i[e.id]}else null!=n&&i[e.id]--}}))}})))}async executeAsync(e,t){return this._executeAsync(e,t)}disposeIntermediateTensors(){this.intermediateTensors&&(Object.keys(this.intermediateTensors).forEach((e=>this.intermediateTensors[e].forEach((e=>e.dispose())))),this.disposeTensorsMap())}disposeTensorsMap(){this.tensorsMap&&Object.keys(this.tensorsMap).forEach((e=>{this.tensorsMap[e].forEach((e=>{!e||e.kept||e.isDisposed||this.keepIds.has(e.id)||e.dispose()}))}))}getIntermediateTensors(){return this.tensorsMap}resetIntermediateTensors(){for(const e in this.intermediateTensors)this.intermediateTensors[e].forEach((e=>e.dispose())),delete this.intermediateTensors[e]}async _executeAsync(e,t){let n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{};n||(e=this.mapInputs(e),this.checkInputs(e),this.checkInputShapeAndType(e),t=this.mapOutputs(t),this.checkOutputs(t));try{this.keepTensorForDebug=(0,r.env)().getBool("KEEP_INTERMEDIATE_TENSORS")}catch(e){console.warn(e.message)}this.resetIntermediateTensors();const c=new s.ExecutionContext(this.weightMap,o,i,this.functionExecutorMap);this.tensorsMap=await this.executeWithControlFlow(e,c,t,n);const l=t.map((e=>(0,a.getTensor)(e,this.tensorsMap,c))),u=l.map((e=>e.id)),d=Object.keys(e).map((t=>e[t].id));return this.keepIds=new Set([...u,...d,...this.weightIds]),this.keepTensorForDebug||this.disposeTensorsMap(),null==this.parent&&c.dispose(this.keepIds),l}async executeFunctionAsync(e,t,n){const r=e.reduce(((e,t,n)=>(e[this.inputs[n].name]=t,e)),{});return this._executeAsync(r,this.outputNodes,!0,t,n)}async executeWithControlFlow(e,t,n,r){const o=Object.keys(e),s=o.map((e=>this.graph.nodes[(0,a.parseNodeName)(e)[0]])),c=n.map((e=>(0,a.parseNodeName)(e)[0]));let l=c.map((e=>this.graph.nodes[e]));0===l.length&&(l=this._outputs);const{usedNodes:u,missingInputs:d,dynamicNode:p,syncInputs:h}=(0,i.getExecutionSubgraph)(e,l,this.weightMap,this._initNodes),f=[...s,...this.graph.weights,...this._initNodes||[]].map((e=>({node:e,contexts:t.currentContext}))),m=Object.assign({},this.weightMap);Object.keys(e).forEach((t=>{const[n,r]=(0,a.parseNodeName)(t),o=[];o[r]=e[t],m[n]=o}));const g={},y=this.getFrozenTensorIds(m),v={};for(;f.length>0;){const e=this.processStack(s,f,t,m,v,y,c,g,u);await Promise.all(e)}null!=p||r||console.warn("This model execution did not contain any no
1des with control flow or dynamic output shapes. You can use model.execute() instead.");const b=l.filter((e=>!(0,i.isControlFlow)(e)&&!(0,a.getTensor)(e.name,m,t))).map((e=>e.name));if(b.length>0){let e="";throw null!=p&&(e="Alternatively, to avoid the dynamic ops, use model.execute() "+"and specify the inputs [".concat(h,"]")),new Error("Cannot compute the outputs [".concat(b,"] from the provided ")+"inputs [".concat(o,"]. Consider providing the following inputs: ")+"[".concat(d,"]. ").concat(e))}return m}processStack(e,t,n,s,i,c,l,u,d){const p=[];for(;t.length>0;){const e=t.pop();n.currentContext=e.contexts;let h="";if("Enter"===e.node.op&&(0,a.getParamValue)("isConstant",e.node,s,n)&&([h]=(0,a.getNodeNameAndIndex)(e.node.name,n)),null==s[e.node.name]){const f=(0,o.executeOp)(e.node,s,n,this._resourceManager);h||([h]=(0,a.getNodeNameAndIndex)(e.node.name,n));const m=n.currentContext;r.util.isPromise(f)?p.push(f.then((r=>(s[h]=r,n.currentContext=m,this.checkTensorForDisposal(h,e.node,s,n,c,l,u),this.processChildNodes(e.node,t,n,s,i,d),r)))):(s[h]=f,this.checkTensorForDisposal(h,e.node,s,n,c,l,u),this.processChildNodes(e.node,t,n,s,i,d))}else this.processChildNodes(e.node,t,n,s,i,d)}return p}processChildNodes(e,t,n,r,o,s){e.children.forEach((e=>{const[i]=(0,a.getNodeNameAndIndex)(e.name,n);!o[i]&&s.has(e.name)&&("Merge"===e.op?e.inputNames.some((e=>!!(0,a.getTensor)(e,r,n)))&&(o[i]=!0,t.push({contexts:n.currentContext,node:e})):e.inputNames.every((e=>!!(0,a.getTensor)(e,r,n)))&&(o[i]=!0,t.push({contexts:n.currentContext,node:e})))}))}dispose(){Object.keys(this.weightMap).forEach((e=>this.weightMap[e].forEach((e=>e.dispose()))))}checkInputShapeAndType(e){Object.keys(e).forEach((t=>{const n=e[t],[o]=(0,a.parseNodeName)(t),s=this.graph.nodes[o];if(s.attrParams.shape&&s.attrParams.shape.value){const e=s.attrParams.shape.value,t=e.length===n.shape.length&&n.shape.every(((t,n)=>-1===e[n]||e[n]===t));r.util.assert(t,(()=>"The shape of dict['".concat(s.name,"'] provided in ")+"model.execute(dict) must be [".concat(e,"], but was ")+"[".concat(n.shape,"]")))}s.attrParams.dtype&&s.attrParams.dtype.value&&r.util.assert(n.dtype===s.attrParams.dtype.value,(()=>"The dtype of dict['".concat(s.name,"'] provided in ")+"model.execute(dict) must be "+"".concat(s.attrParams.dtype.value,", but was ").concat(n.dtype)))}))}mapInputs(e){const t={};for(const n in e)if(null!=this._signature&&null!=this._signature.inputs&&null!=this._signature.inputs[n]){t[this._signature.inputs[n].name]=e[n]}else t[n]=e[n];return t}checkInputs(e){const t=Object.keys(e).filter((e=>{const[t]=(0,a.parseNodeName)(e);return null==this.graph.nodes[t]}));if(t.length>0)throw new Error("The dict provided in model.execute(dict) has "+"keys: [".concat(t,"] that are not part of graph"))}mapOutputs(e){return e.map((e=>{if(null!=this._signature&&null!=this._signature.outputs&&null!=this._signature.outputs[e]){return this._signature.outputs[e].name}return e}),{})}checkOutputs(e){e.forEach((e=>{const[t]=(0,a.parseNodeName)(e);if(!this.graph.nodes[t])throw new Error("The output '".concat(e,"' is not found in the graph"))}))}}t.GraphExecutor=c},75342:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.TFHUB_SEARCH_PARAM=t.GraphModel=t.DEFAULT_MODEL_NAME=void 0,t.loadGraphModel=async function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(null==e)throw new Error("modelUrl in loadGraphModel() cannot be null. Please provide a url or an IOHandler that loads the model");null==t&&(t={});t.fromTFHub&&null==e.load&&(e.endsWith("/")||(e+="/"),e="".concat(e).concat(c).concat(i));const n=new l(e,t);return await n.load(),n};var r=n(735534),a=n(691966),o=n(897628),s=n(624976);const i=t.TFHUB_SEARCH_PARAM="?tfjs-format=file",c=t.DEFAULT_MODEL_NAME="model.json";class l{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.modelUrl=e,this.loadOptions=t,this.version="n/a",null==t&&(this.loadOptions={}),this.resourceManager=new s.ResourceManager}get modelVersion(){return this.version}get inputNodes(){return this.executor.inputNodes}get outputNodes(){return this.executor.outputNodes}get inputs(){return this.executor.inputs}get outputs(){return this.executor.outputs}get weights(){return this.executor.weightMap}get metadata(){return this.artifacts.userDefinedMetadata}get modelSignature(){return this.signature}findIOHandler(){const e=this.modelUrl;if(null!=e.load)this.handler=e;else if(null!=this.loadOptions.requestInit)this.handler=r.io.browserHTTPRequest
1(e,this.loadOptions);else{const t=r.io.getLoadHandlers(e,this.loadOptions);if(0===t.length)t.push(r.io.browserHTTPRequest(e,this.loadOptions));else if(t.length>1)throw new Error("Found more than one (".concat(t.length,") load handlers for ")+"URL '".concat([e],"'"));this.handler=t[0]}}async load(){if(this.findIOHandler(),null==this.handler.load)throw new Error("Cannot proceed with model loading because the IOHandler provided does not have the `load` method implemented.");const e=await this.handler.load();return this.loadSync(e)}loadSync(e){this.artifacts=e;const t=this.artifacts.modelTopology;let n;n=null!=this.artifacts.userDefinedMetadata&&null!=this.artifacts.userDefinedMetadata.signature?this.artifacts.userDefinedMetadata.signature:this.artifacts.signature,this.signature=n,this.version="".concat(t.versions.producer,".").concat(t.versions.minConsumer);const s=r.io.decodeWeights(this.artifacts.weightData,this.artifacts.weightSpecs);if(this.executor=new o.GraphExecutor(a.OperationMapper.Instance.transformGraph(t,this.signature)),this.executor.weightMap=this.convertTensorMapToTensorsMap(s),this.executor.resourceManager=this.resourceManager,null!=e.modelInitializer&&null!=e.modelInitializer.node){const t=a.OperationMapper.Instance.transformGraph(e.modelInitializer);this.initializer=new o.GraphExecutor(t),this.initializer.weightMap=this.executor.weightMap,this.initializer.resourceManager=this.resourceManager,this.initializer.executeAsync({},[])}return!0}async save(e,t){if("string"==typeof e){const t=r.io.getSaveHandlers(e);if(0===t.length)throw new Error("Cannot find any save handlers for URL '".concat(e,"'"));if(t.length>1)throw new Error("Found more than one (".concat(t.length,") save handlers for ")+"URL '".concat(e,"'"));e=t[0]}if(null==e.save)throw new Error("GraphModel.save() cannot proceed because the IOHandler provided does not have the `save` attribute defined.");return e.save(this.artifacts)}predict(e,t){return this.execute(e,this.outputNodes)}normalizeInputs(e){if(!(e instanceof r.Tensor||Array.isArray(e)))return e;if((e=Array.isArray(e)?e:[e]).length!==this.inputNodes.length)throw new Error("Input tensor count mismatch,"+"the graph model has ".concat(this.inputNodes.length," placeholders, ")+"while there are ".concat(e.length," input tensors."));return this.inputNodes.reduce(((t,n,r)=>(t[n]=e[r],t)),{})}normalizeOutputs(e){return e=e||this.outputNodes,Array.isArray(e)?e:[e]}execute(e,t){e=this.normalizeInputs(e),t=this.normalizeOutputs(t);const n=this.executor.execute(e,t);return n.length>1?n:n[0]}async executeAsync(e,t){e=this.normalizeInputs(e),t=this.normalizeOutputs(t);const n=await this.executor.executeAsync(e,t);return n.length>1?n:n[0]}getIntermediateTensors(){return this.executor.getIntermediateTensors()}disposeIntermediateTensors(){this.executor.disposeIntermediateTensors()}convertTensorMapToTensorsMap(e){return Object.keys(e).reduce(((t,n)=>(t[n]=[e[n]],t)),{})}dispose(){this.executor.dispose(),this.initializer&&this.initializer.dispose(),this.resourceManager.dispose()}}t.GraphModel=l}
1,960874:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.HashTable=void 0;var r=n(735534),a=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=o(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var s in e)if("default"!==s&&{}.hasOwnProperty.call(e,s)){var i=a?Object.getOwnPropertyDescriptor(e,s):null;i&&(i.get||i.set)?Object.defineProperty(r,s,i):r[s]=e[s]}return r.default=e,n&&n.set(e,r),r}(n(763213));function o(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(o=function(e){return e?n:t})(e)}t.HashTable=class{constructor(e,t){this.keyDType=e,this.valueDType=t,this.handle=(0,r.scalar)(0),this.tensorMap=new Map,(0,r.keep)(this.handle)}get id(){return this.handle.id}clearAndClose(){this.tensorMap.forEach((e=>e.dispose())),this.tensorMap.clear(),this.handle.dispose()}size(){return this.tensorMap.size}tensorSize(){return a.scalar(this.size(),"int32")}async import(e,t){this.checkKeyAndValueTensor(e,t);const n=await e.data();return this.tensorMap.forEach((e=>e.dispose())),this.tensorMap.clear(),(0,r.tidy)((()=>{const e=(0,r.unstack)(t),a=n.length,o=e.length;r.util.assert(a===o,(()=>"The number of elements doesn't match, keys has "+"".concat(a," elements, the values has ").concat(o," ")+"elements."));for(let t=0;t<a;t++){const a=n[t],o=e[t];(0,r.keep)(o),this.tensorMap.set(a,o)}return this.handle}))}async find(e,t){this.checkKeyAndValueTensor(e,t);const n=await e.data();return(0,r.tidy)((()=>{const e=[];for(let r=0;r<n.length;r++){const a=n[r],o=this.findWithDefault(a,t);e.push(o)}return(0,r.stack)(e)}))}findWithDefault(e,t){const n=this.tensorMap.get(e);return null!=n?n:t}checkKeyAndValueTensor(e,t){if(e.dtype!==this.keyDType)throw new Error("Expect key dtype ".concat(this.keyDType,", but got ")+"".concat(e.dtype));if(t.dtype!==this.valueDType)throw new Error("Expect value dtype ".concat(this.valueDType,", but got ")+"".concat(t.dtype))}}},530539:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getExecutionSubgraph=function(e,t,n,a){const o=new Set,s=[];let u=null,d=null;const p=new Set,h=Object.keys(e).map((e=>(0,r.parseNodeName)(e)[0]));let f=[];null!=a&&(f=a.map((e=>(0,r.parseNodeName)(e.name)[0])));const m=[...t];for(;m.length>0;){const e=m.pop();(i(e)||c(e)||l(e))&&null==u&&(u=e,d=u.children.map((e=>e.name)).filter((e=>o.has(e)))),o.add(e.name),null==n[e.name]&&(-1===h.indexOf(e.name)&&-1===f.indexOf(e.name)&&(0!==e.inputs.length?e.inputs.forEach((e=>{p.has(e.name)||(p.add(e.name),m.push(e))})):s.push(e.name)))}return{inputs:e,outputs:t,usedNodes:o,missingInputs:s,dynamicNode:u,syncInputs:d}},t.getNodesInTopologicalOrder=function(e,t,n){const{usedNodes:a,inputs:o}=n,s=[],i=Object.keys(o).map((e=>(0,r.parseNodeName)(e)[0])).map((t=>e.nodes[t])),c=e.initNodes;i.forEach((e=>{a.has(e.name)&&s.push(e)})),e.weights.forEach((e=>{a.has(e.name)&&s.push(e)})),null!=c&&c.forEach((e=>{a.has(e.name)&&s.push(e)}));const l=new Set,u=[];for(;s.length>0;){const e=s.pop();l.add(e.name),t[e.name]||u.push(e),e.children.forEach((e=>{!l.has(e.name)&&a.has(e.name)&&e.inputs.every((e=>l.has(e.name)))&&s.push(e)}))}return u},t.isControlFlow=i,t.isDynamicShape=c,t.isHashTable=l;var r=n(598453);const a=["Switch","Merge","Enter","Exit","NextIteration","StatelessIf","StatelessWhile","if","While"],o=["NonMaxSuppressionV2","NonMaxSuppressionV3","NonMaxSuppressionV5","Where"],s=["HashTable","HashTableV2","LookupTableImport","LookupTableImportV2","LookupTableFind","LookupTableFindV2","LookupTableSize","LookupTableSizeV2"];function i(e){return a.indexOf(e.op)>=0}function c(e){return o.indexOf(e.op)>=0}function l(e){return s.indexOf(e.op)>=0}},624976:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ResourceManager=void 0;t.ResourceManager=class{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.hashTableNameToHandle=e,this.hashTableMap=t}addHashTable(e,t){this.hashTableNameToHandle[e]=t.handle,this.hashTableMap[t.id]=t}getHashTableHandleByName(e){return this.hashTableNameToHandle[e]}getHashTableById(e){return this.hashTableMap[e]}dispose(){for(const e in this.hashTableMap)this.hashTableMap[e].clearAndClose(),delete this.hashTableMap[e];for(const e in this.hashTableNameToHandle)this.hashTableNameToHandle[e].dispose(),delete this.hashTableNameToHandle[e]}}},738926:(e,t,n)=>{"use strict";
1Object.defineProperty(t,"__esModule",{value:!0}),t.TensorArray=void 0;var r=n(735534),a=n(619701);t.TensorArray=class{constructor(e,t,n,a,o,s,i){this.name=e,this.dtype=t,this.maxSize=n,this.elementShape=a,this.identicalElementShapes=o,this.dynamicSize=s,this.clearAfterRead=i,this.tensors=[],this.closed_=!1,this.idTensor=(0,r.scalar)(0),(0,r.keep)(this.idTensor)}get id(){return this.idTensor.id}get closed(){return this.closed_}clearAndClose(e){this.tensors.forEach((t=>{null!=e&&e.has(t.tensor.id)||t.tensor.dispose()})),this.tensors=[],this.closed_=!0,this.idTensor.dispose()}size(){return this.tensors.length}read(e){if(this.closed_)throw new Error("TensorArray ".concat(this.name," has already been closed."));if(e<0||e>=this.size())throw new Error("Tried to read from index ".concat(e,", but array size is: ").concat(this.size()));const t=this.tensors[e];if(t.cleared)throw new Error("TensorArray ".concat(this.name,": Could not read index ").concat(e," twice because it was cleared after a previous read ")+"(perhaps try setting clear_after_read = false?).");return this.clearAfterRead&&(t.cleared=!0),t.read=!0,t.tensor}readMany(e){return e.map((e=>this.read(e)))}write(e,t){if(this.closed_)throw new Error("TensorArray ".concat(this.name," has already been closed."));if(e<0||!this.dynamicSize&&e>=this.maxSize)throw new Error("Tried to write to index ".concat(e,", but array is not resizeable and size is: ").concat(this.maxSize));const n=this.tensors[e]||{};if(t.dtype!==this.dtype)throw new Error("TensorArray ".concat(this.name,": Could not write to TensorArray index ").concat(e,",\n because the value dtype is ").concat(t.dtype,", but TensorArray dtype is ").concat(this.dtype,"."));if(0!==this.size()||null!=this.elementShape&&0!==this.elementShape.length||(this.elementShape=t.shape),(0,a.assertShapesMatchAllowUndefinedSize)(this.elementShape,t.shape,"TensorArray ".concat(this.name,": Could not write to TensorArray index ").concat(e,".")),n.read)throw new Error("TensorArray ".concat(this.name,": Could not write to TensorArray index ").concat(e,", because it has already been read."));if(n.written)throw new Error("TensorArray ".concat(this.name,": Could not write to TensorArray index ").concat(e,", because it has already been written."));n.tensor=t,(0,r.keep)(t),n.written=!0,this.tensors[e]=n}writeMany(e,t){if(e.length!==t.length)throw new Error("TensorArray ".concat(this.name,": could not write multiple tensors,")+"because the index size: ".concat(e.length," is not the same as tensors size: ").concat(t.length,"."));e.forEach(((e,n)=>this.write(e,t[n])))}gather(e,t){if(t&&t!==this.dtype)throw new Error("TensorArray dtype is ".concat(this.dtype," but gather requested dtype ").concat(t));if(e)e=e.slice(0,this.size());else{e=[];for(let t=0;t<this.size();t++)e.push(t)}if(0===e.length)return(0,r.tensor)([],[0].concat(this.elementShape));const n=this.readMany(e);return(0,a.assertShapesMatchAllowUndefinedSize)(this.elementShape,n[0].shape,"TensorArray shape mismatch: "),(0,r.stack)(n,0)}concat(e){if(e&&e!==this.dtype)throw new Error("TensorArray dtype is ".concat(this.dtype," but concat requested dtype ").concat(e));if(0===this.size())return(0,r.tensor)([],[0].concat(this.elementShape));const t=[];for(let e=0;e<this.size();e++)t.push(e);const n=this.readMany(t);return(0,a.assertShapesMatchAllowUndefinedSize)(this.elementShape,n[0].shape,"TensorArray shape mismatch: tensor array shape (".concat(this.elementShape,") vs first tensor shape (").concat(n[0].shape,")")),(0,r.concat)(n,0)}scatter(e,t){if(t.dtype!==this.dtype)throw new Error("TensorArray dtype is ".concat(this.dtype," but tensor has dtype ").concat(t.dtype));if(e.length!==t.shape[0])throw new Error("Expected len(indices) == tensor.shape[0], but saw: ".concat(e.length," vs. ").concat(t.shape[0]));const n=Math.max(...e);if(!this.dynamicSize&&n>=this.maxSize)throw new Error("Max index must be < array size (".concat(n," vs. ").concat(this.maxSize,")"));this.writeMany(e,(0,r.unstack)(t,0))}split(e,t){if(t.dtype!==this.dtype)throw new Error("TensorArray dtype is ".concat(this.dtype," but tensor has dtype ").concat(t.dtype));let n=0;const a=e.map((e=>(n+=e,n)));if(n!==t.shape[0])throw new Error("Expected sum of lengths to be equal to\n tensor.shape[0], but sum of lengths is\n ".concat(n,", and tensor's shape is: ").concat(t.shape));if(!this.dynamicSize&&e.length!==this.maxSize)throw new Error("TensorArray's size is not equal to the size of lengths (".concat(this.maxSize," vs. ").concat(e.length,"), ")+"and the TensorArray is not marked as dynamically resizeable");const o=0===n?0:t.size/n,s=[];
1(0,r.tidy)((()=>{t=(0,r.reshape)(t,[1,n,o]);for(let n=0;n<e.length;++n){const i=[0,0===n?0:a[n-1],0],c=[1,e[n],o];s[n]=(0,r.reshape)((0,r.slice)(t,i,c),this.elementShape)}return s}));const i=[];for(let t=0;t<e.length;t++)i[t]=t;this.writeMany(i,s)}}},749804:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.TensorList=void 0,t.fromTensor=function(e,t,n){const s=e.dtype;if(e.shape.length<1)throw new Error("Tensor must be at least a vector, but saw shape: ".concat(e.shape));if(e.dtype!==n)throw new Error("Invalid data types; op elements ".concat(e.dtype,", but list elements ").concat(n));const i=e.shape.slice(1);(0,a.assertShapesMatchAllowUndefinedSize)(i,t,"TensorList shape mismatch: ");const c=(0,r.unstack)(e);return new o(c,t,s)},t.reserve=function(e,t,n){return new o([],e,t,n)},t.scatter=function(e,t,n,a){if(t.length!==e.shape[0])throw new Error("Expected len(indices) == tensor.shape[0], but saw: ".concat(t.length," vs. ").concat(e.shape[0]));const s=Math.max(...t);if(null!=a&&-1!==a&&s>=a)throw new Error("Max index must be < array size (".concat(s," vs. ").concat(a,")"));const i=new o([],n,e.dtype,a),c=(0,r.unstack)(e,0);return t.forEach(((e,t)=>{i.setItem(e,c[t])})),i},t.split=function(e,t,n){let s=0;const i=t.map((e=>(s+=e,s)));if(s!==e.shape[0])throw new Error("Expected sum of lengths to be equal to\n tensor.shape[0], but sum of lengths is\n ".concat(s,", and tensor's shape is: ").concat(e.shape));const c=e.shape.slice(1),l=(0,a.mergeElementShape)(c,n),u=0===s?0:e.size/s,d=(0,r.tidy)((()=>{const n=[];e=(0,r.reshape)(e,[1,s,u]);for(let a=0;a<t.length;++a){const o=[0,0===a?0:i[a-1],0],s=[1,t[a],u];n[a]=(0,r.reshape)((0,r.slice)(e,o,s),l)}return e.dispose(),n})),p=new o([],n,e.dtype,t.length);for(let e=0;e<d.length;e++)p.setItem(e,d[e]);return p};var r=n(735534),a=n(619701);class o{constructor(e,t,n){let o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:-1;this.tensors=e,this.elementShape=t,this.elementDtype=n,null!=e&&e.forEach((e=>{if(n!==e.dtype)throw new Error("Invalid data types; op elements ".concat(n,", but list elements ").concat(e.dtype));(0,a.assertShapesMatchAllowUndefinedSize)(t,e.shape,"TensorList shape mismatch: "),(0,r.keep)(e)})),this.idTensor=(0,r.scalar)(0),this.maxNumElements=o,(0,r.keep)(this.idTensor)}get id(){return this.idTensor.id}copy(){return new o([...this.tensors],this.elementShape,this.elementDtype)}clearAndClose(e){this.tensors.forEach((t=>{null!=e&&e.has(t.id)||t.dispose()})),this.tensors.length=0,this.idTensor.dispose()}size(){return this.tensors.length}stack(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:-1;if(t!==this.elementDtype)throw new Error("Invalid data types; op elements ".concat(t,", but list elements ").concat(this.elementDtype));if(-1!==n&&this.tensors.length!==n)throw new Error("Operation expected a list with ".concat(n," elements but got a list with ").concat(this.tensors.length," elements."));(0,a.assertShapesMatchAllowUndefinedSize)(e,this.elementShape,"TensorList shape mismatch: ");const o=(0,a.inferElementShape)(this.elementShape,this.tensors,e);return(0,r.tidy)((()=>{const e=this.tensors.map((e=>(0,r.reshape)(e,o)));return(0,r.stack)(e,0)}))}popBack(e,t){if(t!==this.elementDtype)throw new Error("Invalid data types; op elements ".concat(t,", but list elements ").concat(this.elementDtype));if(0===this.size())throw new Error("Trying to pop from an empty list.");const n=(0,a.inferElementShape)(this.elementShape,this.tensors,e),o=this.tensors.pop();return(0,a.assertShapesMatchAllowUndefinedSize)(o.shape,e,"TensorList shape mismatch: "),(0,r.reshape)(o,n)}pushBack(e){if(e.dtype!==this.elementDtype)throw new Error("Invalid data types; op elements ".concat(e.dtype,", but list elements ").concat(this.elementDtype));if((0,a.assertShapesMatchAllowUndefinedSize)(e.shape,this.elementShape,"TensorList shape mismatch: "),this.maxNumElements===this.size())throw new Error("Trying to push element into a full list.");(0,r.keep)(e),this.tensors.push(e)}resize(e){if(e<0)throw new Error("TensorListResize expects size to be non-negative. Got: ".concat(e));if(-1!==this.maxNumElements&&e>this.maxNumElements)throw new Error("TensorListResize input size ".concat(e," is greater maxNumElement ").concat(this.maxNumElements,"."));this.tensors.length=e}getItem(e,t,n){if(n!==this.elementDtype)throw new Error("Invalid data types; op elements ".concat(n,", but list elements ").concat(this.elementDtype));if(e<0||e>this.tensors.length)throw new Error("Trying to access element ".concat(e," in a list with ").concat(this.tensors.length," elements."));if(null==this.tensors[e])throw new Error("element at index ".concat(e," is null."));(0,a.assertShapesMatchAllowUndefinedSize)(this.tensors[e].shape,t,"TensorList shape mismatch: ");const o=(0,a.inferElementShape)(this.elementShape,this.tensors,t);return(0,r.reshape)(this.tensors[e],o)}setItem(e,t){if(t.dtype!==this.elementDtype)throw new Error("Invalid data types; op elements ".concat(t.dtype,", but list elements ").concat(this.elementDtype));if(e<0||-1!==this.maxNumElements&&e>=this.maxNumElements)throw new Error("Trying to set element ".concat(e," in a list with max ").concat(this.maxNumElements," elements."));(0,a.assertShapesMatchAllowUndefinedSize)(this.elementShape,t.shape,"TensorList shape mismatch: "),(0,r.keep)(t),this.tensors[e]=t}gather(e,t,n){if(t!==this.elementDtype)throw new Error("Invalid data types; op elements ".concat(t,", but list elements ").concat(this.elementDtype));(0,a.assertShapesMatchAllowUndefinedSize)(this.elementShape,n,"TensorList shape mismatch: "),e=e.slice(0,this.size());const o=(0,a.inferElementShape)(this.elementShape,this.tensors,n);return 0===e.length?(0,r.tensor)([],[0].concat(o)):(0,r.tidy)((()=>{const t=e.map((e=>(0,r.reshape)(this.tensors[e],o)));return(0,r.stack)(t,0)}))}concat(e,t){if(e&&e!==this.elementDtype)throw new Error("TensorList dtype is ".concat(this.elementDtype," but concat requested dtype ").concat(e));(0,a.assertShapesMatchAllowUndefinedSize)(this.elementShape,t,"TensorList shape mismatch: ");const n=(0,a.inferElementShape)(this.elementShape,this.tensors,t);return 0===this.size()?(0,r.tensor)([],[0].concat(n)):(0,r.tidy)((()=>{const e=this.tensors.map((e=>(0,r.reshape)(e,n)));return(0,r.concat)(e,0)}))}}t.TensorList=o},619701:(e,t,n)=>{"use strict";
1Object.defineProperty(t,"__esModule",{value:!0}),t.assertShapesMatchAllowUndefinedSize=function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";if("number"==typeof e||"number"==typeof t)return;r.util.assert(e.length===t.length,(()=>n+" Shapes ".concat(e," and ").concat(t," must match")));for(let a=0;a<e.length;a++){const o=e[a],s=t[a];r.util.assert(o<0||s<0||o===s,(()=>n+" Shapes ".concat(e," and ").concat(t," must match")))}},t.fullDefinedShape=a,t.inferElementShape=function(e,t,n){let r=o(e,n);const s=!a(r);if(s&&0===t.length)throw new Error("Tried to calculate elements of an empty list"+" with non-fully-defined elementShape: ".concat(r));s&&t.forEach((e=>{r=o(e.shape,r)}));if(!a(r))throw new Error("Non-fully-defined elementShape: ".concat(r));return r},t.mergeElementShape=o;var r=n(735534);function a(e){return"number"!=typeof e&&!e.some((e=>e<0))}function o(e,t){if("number"==typeof e)return t;if("number"==typeof t)return e;if(e.length!==t.length)throw new Error("Incompatible ranks during merge: ".concat(e," vs. ").concat(t));const n=[];for(let r=0;r<e.length;++r){const a=e[r],o=t[r];if(a>=0&&o>=0&&a!==o)throw new Error("Incompatible shape during merge: ".concat(e," vs. ").concat(t));n[r]=a>=0?a:o}return n}},535073:(e,t,n)=>{"use strict";(0,n(735534).env)().registerFlag("KEEP_INTERMEDIATE_TENSORS",(()=>!1),(e=>{e&&console.warn("Keep intermediate tensors is ON. This will print the values of all intermediate tensors during model inference. Not all models support this mode. For details, check e2e/benchmarks/ model_config.js. This significantly impacts performance.")}))},431894:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"GraphModel",{enumerable:!0,get:function(){return r.GraphModel}}),Object.defineProperty(t,"deregisterOp",{enumerable:!0,get:function(){return a.deregisterOp}}),Object.defineProperty(t,"loadGraphModel",{enumerable:!0,get:function(){return r.loadGraphModel}}),Object.defineProperty(t,"registerOp",{enumerable:!0,get:function(){return a.registerOp}}),Object.defineProperty(t,"version_converter",{enumerable:!0,get:function(){return o.version}}),n(535073);var r=n(75342),a=n(726624),o=n(23237)},108122:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.NodeValueImpl=void 0;var r=n(598453),a=n(691966);t.NodeValueImpl=class{constructor(e,t,n){this.node=e,this.tensorMap=t,this.context=n,this.inputs=[],this.attrs={},this.inputs=e.inputNames.map((e=>this.getInput(e))),null!=e.rawAttrs&&(this.attrs=Object.keys(e.rawAttrs).reduce(((e,t)=>(e[t]=this.getAttr(t),e)),{}))}getInput(e){return(0,r.getTensor)(e,this.tensorMap,this.context)}getAttr(e,t){const n=this.node.rawAttrs[e];if(null!=n.tensor)return(0,r.getTensor)(e,this.tensorMap,this.context);if(null!=n.i||null!=n.f)return(0,a.getNumberParam)(this.node.rawAttrs,e,t);if(null!=n.s)return(0,a.getStringParam)(this.node.rawAttrs,e,t);if(null!=n.b)return(0,a.getBoolParam)(this.node.rawAttrs,e,t);if(null!=n.shape)return(0,a.getTensorShapeParam)(this.node.rawAttrs,e,t);if(null!=n.type)return(0,a.getDtypeParam)(this.node.rawAttrs,e,t);if(null!=n.list){if(null!=n.list.i||null!=n.list.f)return(0,a.getNumericArrayParam)(this.node.rawAttrs,e,t);if(null!=n.list.s)return(0,a.getStringArrayParam)(this.node.rawAttrs,e,t);if(null!=n.list.shape)return(0,a.getTensorShapeArrayParam)(this.node.rawAttrs,e,t);if(null!=n.list.b)return(0,a.getBoolArrayParam)(this.node.rawAttrs,e,t);if(null!=n.list.type)return(0,a.getDtypeArrayParam)(this.node.rawAttrs,e,t)}return t}}},726624:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.deregisterOp=function(e){delete n[e]},t.getRegisteredOp=function(e){return n[e]},t.registerOp=function(e,t){const r={tfOpName:e,category:"custom",inputs:[],attrs:[],customExecutor:t};n[e]=r};const n={}},996861:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.executeOp=t.CATEGORY=void 0;var r=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=o(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var s in e)if("default"!==s&&{}.hasOwnProperty.call(e,s)){var i=a?Object.getOwnPropertyDescriptor(e,s):null;i&&(i.get||i.set)?Object.defineProperty(r,s,i):r[s]=e[s]}return r.default=e,n&&n.set(e,r),r}(n(763213)),a=n(598453);function o(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(o=function(e){return e?n:t})(e)}t.executeOp=(e,t,n)=>{switch(e.op){case"BiasAdd":case"AddV2":case"Add":return[r.add((0,a.getParamValue)("a",e,t,n),(0,a.getParamValue)("b",e,t,n))];case"AddN":return[r.addN((0,a.getParamValue)("tensors",e,t,n))];case"FloorMod":case"Mod":return[r.mod((0,a.getParamValue)("a",e,t,n),(0,a.getParamValue)("b",e,t,n))];case"Mul":return[r.mul((0,a.getParamValue)("a",e,t,n),(0,a.getParamValue)("b",e,t,n))];
1case"RealDiv":case"Div":return[r.div((0,a.getParamValue)("a",e,t,n),(0,a.getParamValue)("b",e,t,n))];case"DivNoNan":return[r.divNoNan((0,a.getParamValue)("a",e,t,n),(0,a.getParamValue)("b",e,t,n))];case"FloorDiv":return[r.floorDiv((0,a.getParamValue)("a",e,t,n),(0,a.getParamValue)("b",e,t,n))];case"Sub":return[r.sub((0,a.getParamValue)("a",e,t,n),(0,a.getParamValue)("b",e,t,n))];case"Minimum":return[r.minimum((0,a.getParamValue)("a",e,t,n),(0,a.getParamValue)("b",e,t,n))];case"Maximum":return[r.maximum((0,a.getParamValue)("a",e,t,n),(0,a.getParamValue)("b",e,t,n))];case"Pow":return[r.pow((0,a.getParamValue)("a",e,t,n),(0,a.getParamValue)("b",e,t,n))];case"SquaredDifference":return[r.squaredDifference((0,a.getParamValue)("a",e,t,n),(0,a.getParamValue)("b",e,t,n))];default:throw TypeError("Node type ".concat(e.op," is not implemented"))}};t.CATEGORY="arithmetic"},503664:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.executeOp=t.CATEGORY=void 0;var r=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=o(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var s in e)if("default"!==s&&{}.hasOwnProperty.call(e,s)){var i=a?Object.getOwnPropertyDescriptor(e,s):null;i&&(i.get||i.set)?Object.defineProperty(r,s,i):r[s]=e[s]}return r.default=e,n&&n.set(e,r),r}(n(763213)),a=n(598453);function o(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(o=function(e){return e?n:t})(e)}t.executeOp=(e,t,n)=>{switch(e.op){case"Abs":case"ComplexAbs":return[r.abs((0,a.getParamValue)("x",e,t,n))];case"Acos":return[r.acos((0,a.getParamValue)("x",e,t,n))];case"Acosh":return[r.acosh((0,a.getParamValue)("x",e,t,n))];case"Asin":return[r.asin((0,a.getParamValue)("x",e,t,n))];case"Asinh":return[r.asinh((0,a.getParamValue)("x",e,t,n))];case"Atan":return[r.atan((0,a.getParamValue)("x",e,t,n))];case"Atan2":return[r.atan2((0,a.getParamValue)("x",e,t,n),(0,a.getParamValue)("y",e,t,n))];case"Atanh":return[r.atanh((0,a.getParamValue)("x",e,t,n))];case"Ceil":return[r.ceil((0,a.getParamValue)("x",e,t,n))];case"Complex":return[r.complex((0,a.getParamValue)("real",e,t,n),(0,a.getParamValue)("imag",e,t,n))];case"Cos":return[r.cos((0,a.getParamValue)("x",e,t,n))];case"Cosh":return[r.cosh((0,a.getParamValue)("x",e,t,n))];case"Elu":return[r.elu((0,a.getParamValue)("x",e,t,n))];case"Erf":return[r.erf((0,a.getParamValue)("x",e,t,n))];case"Exp":return[r.exp((0,a.getParamValue)("x",e,t,n))];case"Expm1":return[r.expm1((0,a.getParamValue)("x",e,t,n))];case"Floor":return[r.floor((0,a.getParamValue)("x",e,t,n))];case"Log":return[r.log((0,a.getParamValue)("x",e,t,n))];case"Log1p":return[r.log1p((0,a.getParamValue)("x",e,t,n))];case"Imag":return[r.imag((0,a.getParamValue)("x",e,t,n))];case"Neg":return[r.neg((0,a.getParamValue)("x",e,t,n))];case"Reciprocal":return[r.reciprocal((0,a.getParamValue)("x",e,t,n))];case"Real":return[r.real((0,a.getParamValue)("x",e,t,n))];case"Relu":return[r.relu((0,a.getParamValue)("x",e,t,n))];case"Round":return[r.round((0,a.getParamValue)("x",e,t,n))];case"Selu":return[r.selu((0,a.getParamValue)("x",e,t,n))];case"Sigmoid":return[r.sigmoid((0,a.getParamValue)("x",e,t,n))];case"Sin":return[r.sin((0,a.getParamValue)("x",e,t,n))];case"Sign":return[r.sign((0,a.getParamValue)("x",e,t,n))];case"Sinh":return[r.sinh((0,a.getParamValue)("x",e,t,n))];case"Softplus":return[r.softplus((0,a.getParamValue)("x",e,t,n))];case"Sqrt":return[r.sqrt((0,a.getParamValue)("x",e,t,n))];case"Square":return[r.square((0,a.getParamValue)("x",e,t,n))];case"Tanh":return[r.tanh((0,a.getParamValue)("x",e,t,n))];case"Tan":return[r.tan((0,a.getParamValue)("x",e,t,n))];case"ClipByValue":return[r.clipByValue((0,a.getParamValue)("x",e,t,n),(0,a.getParamValue)("clipValueMin",e,t,n),(0,a.getParamValue)("clipValueMax",e,t,n))];case"Relu6":return[r.relu6((0,a.getParamValue)("x",e,t,n))];case"Rsqrt":return[r.rsqrt((0,a.getTensor)(e.inputNames[0],t,n))];case"Prod":return[r.prod((0,a.getParamValue)("x",e,t,n),(0,a.getParamValue)("axes",e,t,n))];case"LeakyRelu":return[r.leakyRelu((0,a.getParamValue)("x",e,t,n),(0,a.getParamValue)("alpha",e,t,n))];case"Prelu":return[r.prelu((0,a.getParamValue)("x",e,t,n),(0,a.getParamValue)("alpha",e,t,n))];case"IsNan":return[r.isNaN((0,a.getTensor)(e.inputNames[0],t,n))];default:throw TypeError("Node type ".concat(e.op," is not implemented"))}};t.CATEGORY="basic_math"},464144:(e,t,n)=>{"use strict";
1Object.defineProperty(t,"__esModule",{value:!0}),t.executeOp=t.CATEGORY=void 0;var r=n(735534),a=n(738926),o=n(749804),s=n(598453);t.executeOp=async(e,t,n)=>{switch(e.op){case"If":case"StatelessIf":{const r=(0,s.getParamValue)("thenBranch",e,t,n),a=(0,s.getParamValue)("elseBranch",e,t,n),o=(0,s.getParamValue)("cond",e,t,n),i=(0,s.getParamValue)("args",e,t,n);return(await o.data())[0]?n.functionMap[r].executeFunctionAsync(i,n.tensorArrayMap,n.tensorListMap):n.functionMap[a].executeFunctionAsync(i,n.tensorArrayMap,n.tensorListMap)}case"While":case"StatelessWhile":{const r=(0,s.getParamValue)("body",e,t,n),a=(0,s.getParamValue)("cond",e,t,n),o=(0,s.getParamValue)("args",e,t,n),i=await n.functionMap[a].executeFunctionAsync(o,n.tensorArrayMap,n.tensorListMap),c=o.map((e=>e.id));let l=await i[0].data();i.forEach((e=>{e.kept||-1!==c.indexOf(e.id)||e.dispose()}));let u=o;for(;l[0];){const e=u;u=await n.functionMap[r].executeFunctionAsync(u,n.tensorArrayMap,n.tensorListMap);const t=u.map((e=>e.id));e.forEach((e=>{e.kept||-1!==c.indexOf(e.id)||-1!==t.indexOf(e.id)||e.dispose()}));const o=await n.functionMap[a].executeFunctionAsync(u,n.tensorArrayMap,n.tensorListMap);l=await o[0].data(),o.forEach((e=>{e.kept||-1!==c.indexOf(e.id)||-1!==t.indexOf(e.id)||e.dispose()}))}return u}case"LoopCond":{const r=(0,s.getParamValue)("pred",e,t,n);return[(0,s.cloneTensor)(r)]}case"Switch":{const r=(0,s.getParamValue)("pred",e,t,n);let a=(0,s.getParamValue)("data",e,t,n);return a.kept||(a=(0,s.cloneTensor)(a)),(await r.data())[0]?[void 0,a]:[a,void 0]}case"Merge":{const r=e.inputNames.find((e=>void 0!==(0,s.getTensor)(e,t,n)));if(r){const e=(0,s.getTensor)(r,t,n);return[(0,s.cloneTensor)(e)]}return}case"Enter":{const r=(0,s.getParamValue)("frameName",e,t,n),a=(0,s.getParamValue)("tensor",e,t,n);return n.enterFrame(r),[(0,s.cloneTensor)(a)]}case"Exit":{const r=(0,s.getParamValue)("tensor",e,t,n);return n.exitFrame(),[(0,s.cloneTensor)(r)]}case"NextIteration":{const r=(0,s.getParamValue)("tensor",e,t,n);return n.nextIteration(),[(0,s.cloneTensor)(r)]}case"TensorArrayV3":{const o=(0,s.getParamValue)("size",e,t,n),i=(0,s.getParamValue)("dtype",e,t,n),c=(0,s.getParamValue)("elementShape",e,t,n),l=(0,s.getParamValue)("dynamicSize",e,t,n),u=(0,s.getParamValue)("clearAfterRead",e,t,n),d=(0,s.getParamValue)("identicalElementShapes",e,t,n),p=(0,s.getParamValue)("name",e,t,n),h=new a.TensorArray(p,i,o,c,d,l,u);return n.addTensorArray(h),[h.idTensor,(0,r.scalar)(1)]}case"TensorArrayWriteV3":{const r=(0,s.getParamValue)("tensorArrayId",e,t,n),a=(0,s.getParamValue)("index",e,t,n),o=(0,s.getParamValue)("tensor",e,t,n),i=n.getTensorArray(r.id);return i.write(a,o),[i.idTensor]}case"TensorArrayReadV3":{const r=(0,s.getParamValue)("tensorArrayId",e,t,n),a=(0,s.getParamValue)("index",e,t,n);return[n.getTensorArray(r.id).read(a)]}case"TensorArrayGatherV3":{const r=(0,s.getParamValue)("tensorArrayId",e,t,n),a=(0,s.getParamValue)("indices",e,t,n),o=(0,s.getParamValue)("dtype",e,t,n);return[n.getTensorArray(r.id).gather(a,o)]}case"TensorArrayScatterV3":{const r=(0,s.getParamValue)("tensorArrayId",e,t,n),a=(0,s.getParamValue)("indices",e,t,n),o=(0,s.getParamValue)("tensor",e,t,n),i=n.getTensorArray(r.id);return i.scatter(a,o),[i.idTensor]}case"TensorArrayConcatV3":{const r=(0,s.getParamValue)("tensorArrayId",e,t,n),a=n.getTensorArray(r.id),o=(0,s.getParamValue)("dtype",e,t,n);return[a.concat(o)]}case"TensorArraySplitV3":{const r=(0,s.getParamValue)("tensorArrayId",e,t,n),a=(0,s.getParamValue)("tensor",e,t,n),o=(0,s.getParamValue)("lengths",e,t,n),i=n.getTensorArray(r.id);return i.split(o,a),[i.idTensor]}case"TensorArraySizeV3":{const a=(0,s.getParamValue)("tensorArrayId",e,t,n),o=n.getTensorArray(a.id);return[(0,r.scalar)(o.size(),"int32")]}case"TensorArrayCloseV3":{const r=(0,s.getParamValue)("tensorArrayId",e,t,n),a=n.getTensorArray(r.id);return a.clearAndClose(),[a.idTensor]}case"TensorListSetItem":{const r=(0,s.getParamValue)("tensorListId",e,t,n),a=(0,s.getParamValue)("index",e,t,n),o=(0,s.getParamValue)("tensor",e,t,n),i=n.getTensorList(r.id);return i.setItem(a,o),[i.idTensor]}case"TensorListGetItem":{const r=(0,s.getParamValue)("tensorListId",e,t,n),a=(0,s.getParamValue)("index",e,t,n),o=(0,s.getParamValue)("elementShape",e,t,n),i=(0,s.getParamValue)("elementDType",e,t,n);return[n.getTensorList(r.id).getItem(a,o,i)]}case"TensorListScatterV2":case"TensorListScatter":{const r=(0,s.getParamValue)("indices",e,t,n),a=(0,s.getParamValue)("tensor",e,t,n),i=(0,s.getParamValue)("elementShape",e,t,n),c=(0,s.getParamValue)("numElements",e,t,n),l=(0,o.scatter)(a,r,i,c);return n.addTensorList(l),[l.idTensor]}case"TensorListReserve":case"EmptyTensorList":{const r=(0,s.getParamValue)("elementShape",e,t,n),a=(0,s.getParamValue)("elementDType",e,t,n);let i;i="TensorListReserve"===e.op?"numElements":"maxNumElements";const c=(0,s.getParamValue)(i,e,t,n),l=(0,o.reserve)(r,a,c);return n.addTensorList(l),[l.idTensor]}case"TensorListGather":{const r=(0,s.getParamValue)("tensorListId",e,t,n),a=(0,s.getParamValue)("indices",e,t,n),o=(0,s.getParamValue)("elementShape",e,t,n),i=(0,s.getParamValue)("elementDType",e,t,n);return[n.getTensorList(r.id).gather(a,i,o)]}case"TensorListStack":{const r=(0,s.getParamValue)("tensorListId",e,t,n),a=(0,s.getParamValue)("elementShape",e,t,n),o=(0,s.getParamValue)("elementDType",e,t,n),i=(0,s.getParamValue)("numElements",e,t,n);return[n.getTensorList(r.id).stack(a,o,i)]}case"TensorListFromTensor":{const r=(0,s.getParamValue)("tensor",e,t,n),a=(0,s.getParamValue)("elementShape",e,t,n),i=(0,s.getParamValue)("elementDType",e,t,n),c=(0,o.fromTensor)(r,a,i);return n.addTensorList(c),[c.idTensor]}case"TensorListConcat":{const r=(0,s.getParamValue)("tensorListId",e,t,n),a=n.getTensorList(r.id),o=(0,s.getParamValue)("dtype",e,t,n),i=(0,s.getParamValue)("elementShape",e,t,n);return[a.concat(o,i)]}case"TensorListPushBack":{const r=(0,s.getParamValue)("tensorListId",e,t,n),a=(0,s.getParamValue)("tensor",e,t,n),o=n.getTensorList(r.id);return o.pushBack(a),[o.idTensor]}case"TensorListPopBack":{const r=(0,s.getParamValue)("tensorListId",e,t,n),a=(0,s.getParamValue)("elementShape",e,t,n),o=(0,s.getParamValue)("elementDType",e,t,n);return[n.getTensorList(r.id).popBack(a,o)]}case"TensorListSplit":{const r=(0,s.getParamValue)("tensor",e,t,n),a=(0,s.getParamValue)("elementShape",e,t,n),i=(0,s.getParamValue)("lengths",e,t,n),c=(0,o.split)(r,i,a);return n.addTensorList(c),[c.idTensor]}default:throw TypeError("Node type ".concat(e.op," is not implemented"))}};t.CATEGORY="control"},256916:(e,t,n)=>{"use strict";
1Object.defineProperty(t,"__esModule",{value:!0}),t.executeOp=t.CATEGORY=void 0;var r=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=o(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var s in e)if("default"!==s&&{}.hasOwnProperty.call(e,s)){var i=a?Object.getOwnPropertyDescriptor(e,s):null;i&&(i.get||i.set)?Object.defineProperty(r,s,i):r[s]=e[s]}return r.default=e,n&&n.set(e,r),r}(n(763213)),a=n(598453);function o(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(o=function(e){return e?n:t})(e)}function s(e,t,n){const[r,o]=(0,a.getParamValue)("fusedOps",e,t,n),s="biasadd"===r,i=!s,c="prelu"===o,l="fusedbatchnorm"===r,u=(0,a.getParamValue)("numArgs",e,t,n);if(s){if(c&&2!==u)throw new Error("FusedConv2d and DepthwiseConv2d with BiasAdd and Prelu must have two extra arguments: bias and alpha.");if(!c&&s&&1!==u)throw new Error("FusedConv2d and DepthwiseConv2d with BiasAdd must have one extra argument: bias.")}if(l)throw new Error("FusedConv2d and DepthwiseConv2d with FusedBatchNorm is not supported");const d=(0,a.getParamValue)("strides",e,t,n),p=(0,a.getPadding)(e,t,n),h=(0,a.getParamValue)("dataFormat",e,t,n).toUpperCase(),f=(0,a.getParamValue)("dilations",e,t,n);let[m,g]=(0,a.getParamValue)("args",e,t,n);i&&(g=m,m=void 0);return{stride:d,pad:p,dataFormat:h,dilations:f,biasArg:m,preluArg:g,activationFunc:o,leakyreluAlpha:(0,a.getParamValue)("leakyreluAlpha",e,t,n)}}t.executeOp=(e,t,n)=>{switch(e.op){case"Conv1D":{const o=(0,a.getParamValue)("stride",e,t,n),s=(0,a.getParamValue)("pad",e,t,n),i=(0,a.getParamValue)("dataFormat",e,t,n).toUpperCase(),c=(0,a.getParamValue)("dilation",e,t,n);return[r.conv1d((0,a.getParamValue)("x",e,t,n),(0,a.getParamValue)("filter",e,t,n),o,s,i,c)]}case"Conv2D":{const o=(0,a.getParamValue)("strides",e,t,n),s=(0,a.getPadding)(e,t,n),i=(0,a.getParamValue)("dataFormat",e,t,n).toUpperCase(),c=(0,a.getParamValue)("dilations",e,t,n);return[r.conv2d((0,a.getParamValue)("x",e,t,n),(0,a.getParamValue)("filter",e,t,n),[o[1],o[2]],s,i,[c[1],c[2]])]}case"_FusedConv2D":{const{stride:o,pad:i,dataFormat:c,dilations:l,biasArg:u,preluArg:d,activationFunc:p,leakyreluAlpha:h}=s(e,t,n);return[r.fused.conv2d({x:(0,a.getParamValue)("x",e,t,n),filter:(0,a.getParamValue)("filter",e,t,n),strides:[o[1],o[2]],pad:i,dataFormat:c,dilations:[l[1],l[2]],bias:u,activation:p,preluActivationWeights:d,leakyreluAlpha:h})]}case"FusedDepthwiseConv2dNative":{const{stride:o,pad:i,dataFormat:c,dilations:l,biasArg:u,preluArg:d,activationFunc:p,leakyreluAlpha:h}=s(e,t,n);return[r.fused.depthwiseConv2d({x:(0,a.getParamValue)("x",e,t,n),filter:(0,a.getParamValue)("filter",e,t,n),strides:[o[1],o[2]],pad:i,dataFormat:c,dilations:[l[1],l[2]],bias:u,activation:p,preluActivationWeights:d,leakyreluAlpha:h})]}case"Conv2DBackpropInput":case"Conv2dTranspose":{const o=(0,a.getParamValue)("outputShape",e,t,n),s=(0,a.getParamValue)("strides",e,t,n),i=(0,a.getPadding)(e,t,n);return[r.conv2dTranspose((0,a.getParamValue)("x",e,t,n),(0,a.getParamValue)("filter",e,t,n),o,[s[1],s[2]],i)]}case"DepthwiseConv2dNative":case"DepthwiseConv2d":{const o=(0,a.getParamValue)("strides",e,t,n),s=(0,a.getPadding)(e,t,n),i=(0,a.getParamValue)("dilations",e,t,n),c=(0,a.getParamValue)("dataFormat",e,t,n).toUpperCase();return[r.depthwiseConv2d((0,a.getParamValue)("input",e,t,n),(0,a.getParamValue)("filter",e,t,n),[o[1],o[2]],s,c,[i[1],i[2]])]}case"Conv3D":{const o=(0,a.getParamValue)("strides",e,t,n),s=(0,a.getParamValue)("pad",e,t,n),i=(0,a.getParamValue)("dataFormat",e,t,n).toUpperCase(),c=(0,a.getParamValue)("dilations",e,t,n);return[r.conv3d((0,a.getParamValue)("x",e,t,n),(0,a.getParamValue)("filter",e,t,n),[o[1],o[2],o[3]],s,i,[c[1],c[2],c[3]])]}case"AvgPool":{const o=(0,a.getParamValue)("strides",e,t,n),s=(0,a.getParamValue)("pad",e,t,n),i=(0,a.getParamValue)("kernelSize",e,t,n);return[r.avgPool((0,a.getParamValue)("x",e,t,n),[i[1],i[2]],[o[1],o[2]],s)]}case"MaxPool":{const o=(0,a.getParamValue)("strides",e,t,n),s=(0,a.getParamValue)("pad",e,t,n),i=(0,a.getParamValue)("kernelSize",e,t,n);return[r.maxPool((0,a.getParamValue)("x",e,t,n),[i[1],i[2]],[o[1],o[2]],s)]}case"MaxPoolWithArgmax":{const o=(0,a.getParamValue)("strides",e,t,n),s=(0,a.getParamValue)("pad",e,t,n),i=(0,a.getParamValue)("kernelSize",e,t,n),c=(0,a.getParamValue)("includeBatchInIndex",e,t,n),{result:l,indexes:u}=r.maxPoolWithArgmax((0,a.getParamValue)("x",e,t,n),[i[1],i[2]],[o[1],o[2]],s,c);return[l,u]}case"AvgPool3D":{const o=(0,a.getParamValue)("strides",e,t,n),s=(0,a.getParamValue)("pad",e,t,n),i=(0,a.getParamValue)("kernelSize",e,t,n);return[r.avgPool3d((0,a.getParamValue)("x",e,t,n),[i[1],i[2],i[3]],[o[1],o[2],o[3]],s)]}case"MaxPool3D":{const o=(0,a.getParamValue)("strides",e,t,n),s=(0,a.getParamValue)("pad",e,t,n),i=(0,a.getParamValue)("kernelSize",e,t,n);return[r.maxPool3d((0,a.getParamValue)("x",e,t,n),[i[1],i[2],i[3]],[o[1],o[2],o[3]],s)]}case"Dilation2D":{const o=(0,a.getParamValue)("strides",e,t,n),s=(0,a.getParamValue)("pad",e,t,n),i=(0,a.getParamValue)("dilations",e,t,n),c=o[1],l=o[2],u=i[1],d=i[2];return[r.dilation2d((0,a.getParamValue)("x",e,t,n),(0,a.getParamValue)("filter",e,t,n),[c,l],s,[u,d],"NHWC")]}default:throw TypeError("Node type ".concat(e.op," is not implemented"))}};t.CATEGORY="convolution"},39717:(e,t,n)=>{"use strict";
1Object.defineProperty(t,"__esModule",{value:!0}),t.executeOp=t.CATEGORY=void 0;var r=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=o(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var s in e)if("default"!==s&&{}.hasOwnProperty.call(e,s)){var i=a?Object.getOwnPropertyDescriptor(e,s):null;i&&(i.get||i.set)?Object.defineProperty(r,s,i):r[s]=e[s]}return r.default=e,n&&n.set(e,r),r}(n(763213)),a=n(598453);function o(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(o=function(e){return e?n:t})(e)}t.executeOp=(e,t,n)=>{switch(e.op){case"Fill":{const o=(0,a.getParamValue)("shape",e,t,n),s=(0,a.getParamValue)("dtype",e,t,n),i=(0,a.getParamValue)("value",e,t,n);return[r.fill(o,i,s)]}case"LinSpace":{const o=(0,a.getParamValue)("start",e,t,n),s=(0,a.getParamValue)("stop",e,t,n),i=(0,a.getParamValue)("num",e,t,n);return[r.linspace(o,s,i)]}case"Multinomial":{const o=(0,a.getParamValue)("logits",e,t,n),s=(0,a.getParamValue)("numSamples",e,t,n),i=(0,a.getParamValue)("seed",e,t,n);return[r.multinomial(o,s,i)]}case"OneHot":{const o=(0,a.getParamValue)("indices",e,t,n),s=(0,a.getParamValue)("depth",e,t,n),i=(0,a.getParamValue)("onValue",e,t,n),c=(0,a.getParamValue)("offValue",e,t,n);return[r.oneHot(o,s,i,c)]}case"Ones":return[r.ones((0,a.getParamValue)("shape",e,t,n),(0,a.getParamValue)("dtype",e,t,n))];case"OnesLike":return[r.onesLike((0,a.getParamValue)("x",e,t,n))];case"RandomUniform":return[r.randomUniform((0,a.getParamValue)("shape",e,t,n),(0,a.getParamValue)("minval",e,t,n),(0,a.getParamValue)("maxval",e,t,n),(0,a.getParamValue)("dtype",e,t,n))];case"Range":{const o=(0,a.getParamValue)("start",e,t,n),s=(0,a.getParamValue)("stop",e,t,n),i=(0,a.getParamValue)("step",e,t,n);return[r.range(o,s,i,(0,a.getParamValue)("dtype",e,t,n))]}case"TruncatedNormal":{const o=(0,a.getParamValue)("shape",e,t,n),s=(0,a.getParamValue)("mean",e,t,n),i=(0,a.getParamValue)("stdDev",e,t,n),c=(0,a.getParamValue)("seed",e,t,n);return[r.truncatedNormal(o,s,i,(0,a.getParamValue)("dtype",e,t,n),c)]}case"Zeros":return[r.zeros((0,a.getParamValue)("shape",e,t,n),(0,a.getParamValue)("dtype",e,t,n))];case"ZerosLike":return[r.zerosLike((0,a.getParamValue)("x",e,t,n))];default:throw TypeError("Node type ".concat(e.op," is not implemented"))}};t.CATEGORY="creation"},253752:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.executeOp=t.CATEGORY=void 0;var r=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=o(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var s in e)if("default"!==s&&{}.hasOwnProperty.call(e,s)){var i=a?Object.getOwnPropertyDescriptor(e,s):null;i&&(i.get||i.set)?Object.defineProperty(r,s,i):r[s]=e[s]}return r.default=e,n&&n.set(e,r),r}(n(763213)),a=n(598453);function o(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(o=function(e){return e?n:t})(e)}function s(e,t,n){return{boxes:(0,a.getParamValue)("boxes",e,t,n),scores:(0,a.getParamValue)("scores",e,t,n),maxOutputSize:(0,a.getParamValue)("maxOutputSize",e,t,n),iouThreshold:(0,a.getParamValue)("iouThreshold",e,t,n),scoreThreshold:(0,a.getParamValue)("scoreThreshold",e,t,n),softNmsSigma:(0,a.getParamValue)("softNmsSigma",e,t,n)}}t.executeOp=async(e,t,n)=>{switch(e.op){case"NonMaxSuppressionV5":{const{boxes:a,scores:o,maxOutputSize:i,iouThreshold:c,scoreThreshold:l,softNmsSigma:u}=s(e,t,n),d=await r.image.nonMaxSuppressionWithScoreAsync(a,o,i,c,l,u);return[d.selectedIndices,d.selectedScores]}case"NonMaxSuppressionV4":{const{boxes:o,scores:i,maxOutputSize:c,iouThreshold:l,scoreThreshold:u}=s(e,t,n),d=(0,a.getParamValue)("padToMaxOutputSize",e,t,n),p=await r.image.nonMaxSuppressionPaddedAsync(o,i,c,l,u,d);return[p.selectedIndices,p.validOutputs]}case"NonMaxSuppressionV3":case"NonMaxSuppressionV2":{const{boxes:a,scores:o,maxOutputSize:i,iouThreshold:c,scoreThreshold:l}=s(e,t,n);return[await r.image.nonMaxSuppressionAsync(a,o,i,c,l)]}case"Where":{const o=r.cast((0,a.getParamValue)("condition",e,t,n),"bool"),s=[await r.whereAsync(o)];return o.dispose(),s}case"ListDiff":return r.setdiff1dAsync((0,a.getParamValue)("x",e,t,n),(0,a.getParamValue)("y",e,t,n));default:throw TypeError("Node type ".concat(e.op," is not implemented"))}};t.CATEGORY="dynamic"}
1,897998:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.executeOp=t.CATEGORY=void 0;var r=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=o(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var s in e)if("default"!==s&&{}.hasOwnProperty.call(e,s)){var i=a?Object.getOwnPropertyDescriptor(e,s):null;i&&(i.get||i.set)?Object.defineProperty(r,s,i):r[s]=e[s]}return r.default=e,n&&n.set(e,r),r}(n(763213)),a=n(598453);function o(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(o=function(e){return e?n:t})(e)}t.executeOp=(e,t,n)=>{switch(e.op){case"TopKV2":{const o=(0,a.getParamValue)("x",e,t,n),s=(0,a.getParamValue)("k",e,t,n),i=(0,a.getParamValue)("sorted",e,t,n),c=r.topk(o,s,i);return[c.values,c.indices]}case"Unique":{const o=(0,a.getParamValue)("x",e,t,n),s=r.unique(o);return[s.values,s.indices]}case"UniqueV2":{const o=(0,a.getParamValue)("x",e,t,n),s=(0,a.getParamValue)("axis",e,t,n),i=r.unique(o,s);return[i.values,i.indices]}default:throw TypeError("Node type ".concat(e.op," is not implemented"))}};t.CATEGORY="evaluation"},908003:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.executeOp=t.CATEGORY=void 0;var r=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=o(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var s in e)if("default"!==s&&{}.hasOwnProperty.call(e,s)){var i=a?Object.getOwnPropertyDescriptor(e,s):null;i&&(i.get||i.set)?Object.defineProperty(r,s,i):r[s]=e[s]}return r.default=e,n&&n.set(e,r),r}(n(763213)),a=n(598453);function o(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(o=function(e){return e?n:t})(e)}t.executeOp=(e,t,n)=>{switch(e.op){case"Const":return t[e.name];case"PlaceholderWithDefault":const o=(0,a.getParamValue)("default",e,t,n);return[(0,a.getTensor)(e.name,t,n)||o];case"Placeholder":return[(0,a.getTensor)(e.name,t,n)];case"Identity":case"StopGradient":case"FakeQuantWithMinMaxVars":{const r=(0,a.getParamValue)("x",e,t,n);return[(0,a.cloneTensor)(r)]}case"IdentityN":return(0,a.getParamValue)("x",e,t,n).map((e=>(0,a.cloneTensor)(e)));case"Snapshot":const s=(0,a.getParamValue)("x",e,t,n);return[(0,a.cloneTensor)(s)];case"Shape":return[r.tensor1d((0,a.getParamValue)("x",e,t,n).shape,"int32")];case"ShapeN":return(0,a.getParamValue)("x",e,t,n).map((e=>r.tensor1d(e.shape)));case"Size":return[r.scalar((0,a.getParamValue)("x",e,t,n).size,"int32")];case"Rank":return[r.scalar((0,a.getParamValue)("x",e,t,n).rank,"int32")];case"NoOp":return[r.scalar(1)];case"Print":const i=(0,a.getParamValue)("x",e,t,n),c=(0,a.getParamValue)("data",e,t,n),l=(0,a.getParamValue)("message",e,t,n),u=(0,a.getParamValue)("summarize",e,t,n);console.warn("The graph has a tf.print() operation,usually used for debugging, which slows down performance."),console.log(l);for(let e=0;e<c.length;e++)console.log(Array.prototype.slice.call(c[e].dataSync()).slice(0,u));return[i];default:throw TypeError("Node type ".concat(e.op," is not implemented"))}};t.CATEGORY="graph"},326568:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.executeOp=t.CATEGORY=void 0;var r=n(960874),a=n(598453);t.executeOp=async(e,t,n,o)=>{switch(e.op){case"HashTable":case"HashTableV2":{const s=(0,a.getParamValue)("keyDType",e,t,n),i=(0,a.getParamValue)("valueDType",e,t,n),c=new r.HashTable(s,i);return o.addHashTable(e.name,c),[c.handle]}case"LookupTableImport":case"LookupTableImportV2":{const r=(0,a.getParamValue)("tableHandle",e,t,n,o),s=(0,a.getParamValue)("keys",e,t,n),i=(0,a.getParamValue)("values",e,t,n),c=o.getHashTableById(r.id);return[await c.import(s,i)]}case"LookupTableFind":case"LookupTableFindV2":{const r=(0,a.getParamValue)("tableHandle",e,t,n,o),s=(0,a.getParamValue)("keys",e,t,n),i=(0,a.getParamValue)("defaultValue",e,t,n),c=o.getHashTableById(r.id);return[await c.find(s,i)]}case"LookupTableSize":case"LookupTableSizeV2":{const r=(0,a.getParamValue)("tableHandle",e,t,n,o);return[o.getHashTableById(r.id).tensorSize()]}default:throw TypeError("Node type ".concat(e.op," is not implemented"))}};t.CATEGORY="hash_table"},438017:(e,t,n)=>{"use strict";
1Object.defineProperty(t,"__esModule",{value:!0}),t.executeOp=t.CATEGORY=void 0;var r=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=o(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var s in e)if("default"!==s&&{}.hasOwnProperty.call(e,s)){var i=a?Object.getOwnPropertyDescriptor(e,s):null;i&&(i.get||i.set)?Object.defineProperty(r,s,i):r[s]=e[s]}return r.default=e,n&&n.set(e,r),r}(n(763213)),a=n(598453);function o(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(o=function(e){return e?n:t})(e)}t.executeOp=(e,t,n)=>{switch(e.op){case"ResizeBilinear":{const o=(0,a.getParamValue)("images",e,t,n),s=(0,a.getParamValue)("size",e,t,n),i=(0,a.getParamValue)("alignCorners",e,t,n),c=(0,a.getParamValue)("halfPixelCenters",e,t,n);return[r.image.resizeBilinear(o,[s[0],s[1]],i,c)]}case"ResizeNearestNeighbor":{const o=(0,a.getParamValue)("images",e,t,n),s=(0,a.getParamValue)("size",e,t,n),i=(0,a.getParamValue)("alignCorners",e,t,n),c=(0,a.getParamValue)("halfPixelCenters",e,t,n);return[r.image.resizeNearestNeighbor(o,[s[0],s[1]],i,c)]}case"CropAndResize":{const o=(0,a.getParamValue)("image",e,t,n),s=(0,a.getParamValue)("boxes",e,t,n),i=(0,a.getParamValue)("boxInd",e,t,n),c=(0,a.getParamValue)("cropSize",e,t,n),l=(0,a.getParamValue)("method",e,t,n),u=(0,a.getParamValue)("extrapolationValue",e,t,n);return[r.image.cropAndResize(o,s,i,c,l,u)]}default:throw TypeError("Node type ".concat(e.op," is not implemented"))}};t.CATEGORY="image"},855240:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.executeOp=t.CATEGORY=void 0;var r=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=o(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var s in e)if("default"!==s&&{}.hasOwnProperty.call(e,s)){var i=a?Object.getOwnPropertyDescriptor(e,s):null;i&&(i.get||i.set)?Object.defineProperty(r,s,i):r[s]=e[s]}return r.default=e,n&&n.set(e,r),r}(n(763213)),a=n(598453);function o(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(o=function(e){return e?n:t})(e)}t.executeOp=(e,t,n)=>{switch(e.op){case"Equal":return[r.equal((0,a.getParamValue)("a",e,t,n),(0,a.getParamValue)("b",e,t,n))];case"NotEqual":return[r.notEqual((0,a.getParamValue)("a",e,t,n),(0,a.getParamValue)("b",e,t,n))];case"Greater":return[r.greater((0,a.getParamValue)("a",e,t,n),(0,a.getParamValue)("b",e,t,n))];case"GreaterEqual":return[r.greaterEqual((0,a.getParamValue)("a",e,t,n),(0,a.getParamValue)("b",e,t,n))];case"Less":return[r.less((0,a.getParamValue)("a",e,t,n),(0,a.getParamValue)("b",e,t,n))];case"LessEqual":return[r.lessEqual((0,a.getParamValue)("a",e,t,n),(0,a.getParamValue)("b",e,t,n))];case"LogicalAnd":return[r.logicalAnd((0,a.getParamValue)("a",e,t,n),(0,a.getParamValue)("b",e,t,n))];case"LogicalNot":return[r.logicalNot((0,a.getParamValue)("a",e,t,n))];case"LogicalOr":return[r.logicalOr((0,a.getParamValue)("a",e,t,n),(0,a.getParamValue)("b",e,t,n))];case"Select":case"SelectV2":return[r.where((0,a.getParamValue)("condition",e,t,n),(0,a.getParamValue)("a",e,t,n),(0,a.getParamValue)("b",e,t,n))];default:throw TypeError("Node type ".concat(e.op," is not implemented"))}};t.CATEGORY="logical"},45632:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.executeOp=t.CATEGORY=void 0;var r=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=o(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var s in e)if("default"!==s&&{}.hasOwnProperty.call(e,s)){var i=a?Object.getOwnPropertyDescriptor(e,s):null;i&&(i.get||i.set)?Object.defineProperty(r,s,i):r[s]=e[s]}return r.default=e,n&&n.set(e,r),r}(n(763213)),a=n(598453);function o(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(o=function(e){return e?n:t})(e)}t.executeOp=(e,t,n)=>{switch(e.op){case"BatchMatMul":case"BatchMatMulV2":case"MatMul":return[r.matMul((0,a.getParamValue)("a",e,t,n),(0,a.getParamValue)("b",e,t,n),(0,a.getParamValue)("transposeA",e,t,n),(0,a.getParamValue)("transposeB",e,t,n))];case"Einsum":return[r.einsum((0,a.getParamValue)("equation",e,t,n),...(0,a.getParamValue)("tensors",e,t,n))];case"Transpose":return[r.transpose((0,a.getParamValue)("x",e,t,n),(0,a.getParamValue)("perm",e,t,n))];case"_FusedMatMul":const[o,s]=(0,a.getParamValue)("fusedOps",e,t,n),i="biasadd"===o,c="prelu"===s,l=(0,a.getParamValue)("numArgs",e,t,n),u=(0,a.getParamValue)("leakyreluAlpha",e,t,n);if(i){if(c&&2!==l)throw new Error("Fused MatMul with BiasAdd and Prelu must have two extra arguments: bias and alpha.");if(!c&&1!==l)throw new Error("Fused MatMul with BiasAdd must have one extra argument: bias.")}const[d,p]=(0,a.getParamValue)("args",e,t,n);return[r.fused.matMul({a:(0,a.getParamValue)("a",e,t,n),b:(0,a.getParamValue)("b",e,t,n),transposeA:(0,a.getParamValue)("transposeA",e,t,n),transposeB:(0,a.getParamValue)("transposeB",e,t,n),bias:d,activation:s,preluActivationWeights:p,leakyreluAlpha:u})];default:throw TypeError("Node type ".concat(e.op," is not implemented"))}};t.CATEGORY="matrices"}
1,982804:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.executeOp=t.CATEGORY=void 0;var r=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=o(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var s in e)if("default"!==s&&{}.hasOwnProperty.call(e,s)){var i=a?Object.getOwnPropertyDescriptor(e,s):null;i&&(i.get||i.set)?Object.defineProperty(r,s,i):r[s]=e[s]}return r.default=e,n&&n.set(e,r),r}(n(763213)),a=n(598453);function o(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(o=function(e){return e?n:t})(e)}t.executeOp=(e,t,n)=>{switch(e.op){case"FusedBatchNorm":case"FusedBatchNormV2":case"FusedBatchNormV3":return[r.batchNorm((0,a.getParamValue)("x",e,t,n),(0,a.getParamValue)("mean",e,t,n),(0,a.getParamValue)("variance",e,t,n),(0,a.getParamValue)("offset",e,t,n),(0,a.getParamValue)("scale",e,t,n),(0,a.getParamValue)("epsilon",e,t,n))];case"LRN":return[r.localResponseNormalization((0,a.getParamValue)("x",e,t,n),(0,a.getParamValue)("radius",e,t,n),(0,a.getParamValue)("bias",e,t,n),(0,a.getParamValue)("alpha",e,t,n),(0,a.getParamValue)("beta",e,t,n))];case"Softmax":return[r.softmax((0,a.getParamValue)("x",e,t,n))];case"LogSoftmax":return[r.logSoftmax((0,a.getParamValue)("x",e,t,n))];case"SparseToDense":return[r.sparseToDense((0,a.getParamValue)("sparseIndices",e,t,n),(0,a.getParamValue)("outputShape",e,t,n),(0,a.getParamValue)("sparseValues",e,t,n),(0,a.getParamValue)("defaultValue",e,t,n))];default:throw TypeError("Node type ".concat(e.op," is not implemented"))}};t.CATEGORY="normalization"},38138:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.executeOp=t.CATEGORY=void 0;var r=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=o(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var s in e)if("default"!==s&&{}.hasOwnProperty.call(e,s)){var i=a?Object.getOwnPropertyDescriptor(e,s):null;i&&(i.get||i.set)?Object.defineProperty(r,s,i):r[s]=e[s]}return r.default=e,n&&n.set(e,r),r}(n(763213)),a=n(598453);function o(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(o=function(e){return e?n:t})(e)}t.executeOp=(e,t,n)=>{switch(e.op){case"Max":{const o=(0,a.getParamValue)("axis",e,t,n),s=(0,a.getParamValue)("keepDims",e,t,n);return[r.max((0,a.getParamValue)("x",e,t,n),o,s)]}case"Mean":{const o=(0,a.getParamValue)("axis",e,t,n),s=(0,a.getParamValue)("keepDims",e,t,n);return[r.mean((0,a.getParamValue)("x",e,t,n),o,s)]}case"Min":{const o=(0,a.getParamValue)("axis",e,t,n),s=(0,a.getParamValue)("keepDims",e,t,n);return[r.min((0,a.getParamValue)("x",e,t,n),o,s)]}case"Sum":{const o=(0,a.getParamValue)("axis",e,t,n),s=(0,a.getParamValue)("keepDims",e,t,n);return[r.sum((0,a.getParamValue)("x",e,t,n),o,s)]}case"All":{const o=(0,a.getParamValue)("axis",e,t,n),s=(0,a.getParamValue)("keepDims",e,t,n);return[r.all((0,a.getParamValue)("x",e,t,n),o,s)]}case"Any":{const o=(0,a.getParamValue)("axis",e,t,n),s=(0,a.getParamValue)("keepDims",e,t,n);return[r.any((0,a.getParamValue)("x",e,t,n),o,s)]}case"ArgMax":{const o=(0,a.getParamValue)("axis",e,t,n);return[r.argMax((0,a.getParamValue)("x",e,t,n),o)]}case"ArgMin":{const o=(0,a.getParamValue)("axis",e,t,n);return[r.argMin((0,a.getParamValue)("x",e,t,n),o)]}case"Prod":{const o=(0,a.getParamValue)("axis",e,t,n),s=(0,a.getParamValue)("keepDims",e,t,n);return[r.prod((0,a.getParamValue)("x",e,t,n),o,s)]}case"Cumsum":{const o=(0,a.getParamValue)("axis",e,t,n),s=(0,a.getParamValue)("exclusive",e,t,n),i=(0,a.getParamValue)("reverse",e,t,n);return[r.cumsum((0,a.getParamValue)("x",e,t,n),o,s,i)]}case"Bincount":const o=(0,a.getParamValue)("x",e,t,n),s=(0,a.getParamValue)("weights",e,t,n),i=(0,a.getParamValue)("size",e,t,n);return[r.bincount(o,s,i)];case"DenseBincount":{const o=(0,a.getParamValue)("x",e,t,n),s=(0,a.getParamValue)("weights",e,t,n),i=(0,a.getParamValue)("size",e,t,n),c=(0,a.getParamValue)("binaryOutput",e,t,n);return[r.denseBincount(o,s,i,c)]}default:throw TypeError("Node type ".concat(e.op," is not implemented"))}};t.CATEGORY="reduction"},487457:(e,t,n)=>{"use strict";
1Object.defineProperty(t,"__esModule",{value:!0}),t.executeOp=t.CATEGORY=void 0;var r=n(735534),a=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=s(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if("default"!==o&&{}.hasOwnProperty.call(e,o)){var i=a?Object.getOwnPropertyDescriptor(e,o):null;i&&(i.get||i.set)?Object.defineProperty(r,o,i):r[o]=e[o]}return r.default=e,n&&n.set(e,r),r}(n(763213)),o=n(598453);function s(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(s=function(e){return e?n:t})(e)}t.executeOp=(e,t,n)=>{switch(e.op){case"ConcatV2":case"Concat":{const r=(0,o.getParamValue)("n",e,t,n),s=(0,o.getParamValue)("axis",e,t,n);let i=(0,o.getParamValue)("tensors",e,t,n);return i=i.slice(0,r),[a.concat(i,s)]}case"Gather":{const r=(0,o.getParamValue)("x",e,t,n),s=(0,o.getParamValue)("indices",e,t,n);return[a.gather(r,a.cast(s,"int32"),0)]}case"GatherV2":{const r=(0,o.getParamValue)("axis",e,t,n),s=(0,o.getParamValue)("batchDims",e,t,n),i=(0,o.getParamValue)("x",e,t,n),c=(0,o.getParamValue)("indices",e,t,n);return[a.gather(i,a.cast(c,"int32"),r,s)]}case"Reverse":{const r=(0,o.getParamValue)("dims",e,t,n),s=[];for(let e=0;e<r.length;e++)r[e]&&s.push(e);const i=(0,o.getParamValue)("x",e,t,n);return[a.reverse(i,s)]}case"ReverseV2":{const r=(0,o.getParamValue)("axis",e,t,n),s=(0,o.getParamValue)("x",e,t,n);return[a.reverse(s,r)]}case"Slice":{const r=(0,o.getParamValue)("begin",e,t,n),s=(0,o.getParamValue)("size",e,t,n);return[a.slice((0,o.getParamValue)("x",e,t,n),r,s)]}case"StridedSlice":{const r=(0,o.getParamValue)("begin",e,t,n),s=(0,o.getParamValue)("end",e,t,n),i=(0,o.getParamValue)("strides",e,t,n),c=(0,o.getParamValue)("beginMask",e,t,n),l=(0,o.getParamValue)("endMask",e,t,n),u=(0,o.getParamValue)("ellipsisMask",e,t,n),d=(0,o.getParamValue)("newAxisMask",e,t,n),p=(0,o.getParamValue)("shrinkAxisMask",e,t,n),h=(0,o.getParamValue)("x",e,t,n);return[a.stridedSlice(h,r,s,i,c,l,u,d,p)]}case"Pack":return(0,r.tidy)((()=>{const s=(0,o.getParamValue)("axis",e,t,n),i=(0,o.getParamValue)("tensors",e,t,n),c=i[0].shape,l=a.squeeze(i[0]).shape,u=i.map((e=>{const t=r.util.arraysEqual(e.shape,c);if(!t&&!r.util.arraysEqual(a.squeeze(e).shape,l))throw new Error("the input tensors shape does not match");return t?e:a.reshape(e,c)}));return[a.stack(u,s)]}));case"Unpack":{const r=(0,o.getParamValue)("axis",e,t,n),s=(0,o.getParamValue)("tensor",e,t,n);return a.unstack(s,r)}case"Tile":{const r=(0,o.getParamValue)("reps",e,t,n);return[a.tile((0,o.getParamValue)("x",e,t,n),r)]}case"Split":case"SplitV":{const r=(0,o.getParamValue)("axis",e,t,n),s=(0,o.getParamValue)("numOrSizeSplits",e,t,n),i=(0,o.getParamValue)("x",e,t,n);return a.split(i,s,r)}case"ScatterNd":{const r=(0,o.getParamValue)("indices",e,t,n),s=(0,o.getParamValue)("values",e,t,n),i=(0,o.getParamValue)("shape",e,t,n);return[a.scatterND(r,s,i)]}case"GatherNd":{const r=(0,o.getParamValue)("x",e,t,n),s=(0,o.getParamValue)("indices",e,t,n);return[a.gatherND(r,s)]}case"SparseToDense":{const r=(0,o.getParamValue)("sparseIndices",e,t,n),s=(0,o.getParamValue)("outputShape",e,t,n),i=(0,o.getParamValue)("sparseValues",e,t,n),c=(0,o.getParamValue)("defaultValue",e,t,n);return[a.sparseToDense(r,i,s,i.dtype===c.dtype?c:a.cast(c,i.dtype))]}default:throw TypeError("Node type ".concat(e.op," is not implemented"))}};t.CATEGORY="slice_join"},446923:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.executeOp=t.CATEGORY=void 0;var r=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=o(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var s in e)if("default"!==s&&{}.hasOwnProperty.call(e,s)){var i=a?Object.getOwnPropertyDescriptor(e,s):null;i&&(i.get||i.set)?Object.defineProperty(r,s,i):r[s]=e[s]}return r.default=e,n&&n.set(e,r),r}(n(763213)),a=n(598453);function o(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(o=function(e){return e?n:t})(e)}t.executeOp=(e,t,n)=>{switch(e.op){case"SparseFillEmptyRows":{const{outputIndices:o,outputValues:s,emptyRowIndicator:i,reverseIndexMap:c}=r.sparse.sparseFillEmptyRows((0,a.getParamValue)("indices",e,t,n),(0,a.getParamValue)("values",e,t,n),(0,a.getParamValue)("denseShape",e,t,n),(0,a.getParamValue)("defaultValue",e,t,n));return[o,s,i,c]}case"SparseReshape":{const{outputIndices:o,outputShape:s}=r.sparse.sparseReshape((0,a.getParamValue)("inputIndices",e,t,n),(0,a.getParamValue)("inputShape",e,t,n),(0,a.getParamValue)("newShape",e,t,n));return[o,s]}case"SparseSegmentMean":return[r.sparse.sparseSegmentMean((0,a.getParamValue)("data",e,t,n),(0,a.getParamValue)("indices",e,t,n),(0,a.getParamValue)("segmentIds",e,t,n))];case"SparseSegmentSum":return[r.sparse.sparseSegmentSum((0,a.getParamValue)("data",e,t,n),(0,a.getParamValue)("indices",e,t,n),(0,a.getParamValue)("segmentIds",e,t,n))];default:throw TypeError("Node type ".concat(e.op," is not implemented"))}};t.CATEGORY="sparse"},64679:(e,t,n)=>{"use strict";
1Object.defineProperty(t,"__esModule",{value:!0}),t.executeOp=t.CATEGORY=void 0;var r=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=o(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var s in e)if("default"!==s&&{}.hasOwnProperty.call(e,s)){var i=a?Object.getOwnPropertyDescriptor(e,s):null;i&&(i.get||i.set)?Object.defineProperty(r,s,i):r[s]=e[s]}return r.default=e,n&&n.set(e,r),r}(n(763213)),a=n(598453);function o(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(o=function(e){return e?n:t})(e)}t.executeOp=(e,t,n)=>{switch(e.op){case"FFT":return[r.fft((0,a.getParamValue)("x",e,t,n))];case"IFFT":return[r.ifft((0,a.getParamValue)("x",e,t,n))];case"RFFT":return[r.rfft((0,a.getParamValue)("x",e,t,n))];case"IRFFT":return[r.irfft((0,a.getParamValue)("x",e,t,n))];default:throw TypeError("Node type ".concat(e.op," is not implemented"))}};t.CATEGORY="spectral"},713017:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.executeOp=t.CATEGORY=void 0;var r=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=o(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var s in e)if("default"!==s&&{}.hasOwnProperty.call(e,s)){var i=a?Object.getOwnPropertyDescriptor(e,s):null;i&&(i.get||i.set)?Object.defineProperty(r,s,i):r[s]=e[s]}return r.default=e,n&&n.set(e,r),r}(n(763213)),a=n(598453);function o(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(o=function(e){return e?n:t})(e)}t.executeOp=(e,t,n)=>{switch(e.op){case"StringNGrams":{const{nGrams:o,nGramsSplits:s}=r.string.stringNGrams((0,a.getParamValue)("data",e,t,n),(0,a.getParamValue)("dataSplits",e,t,n),(0,a.getParamValue)("separator",e,t,n),(0,a.getParamValue)("nGramWidths",e,t,n),(0,a.getParamValue)("leftPad",e,t,n),(0,a.getParamValue)("rightPad",e,t,n),(0,a.getParamValue)("padWidth",e,t,n),(0,a.getParamValue)("preserveShortSequences",e,t,n));return[o,s]}case"StringSplit":{const{indices:o,values:s,shape:i}=r.string.stringSplit((0,a.getParamValue)("input",e,t,n),(0,a.getParamValue)("delimiter",e,t,n),(0,a.getParamValue)("skipEmpty",e,t,n));return[o,s,i]}case"StringToHashBucketFast":return[r.string.stringToHashBucketFast((0,a.getParamValue)("input",e,t,n),(0,a.getParamValue)("numBuckets",e,t,n))];default:throw TypeError("Node type ".concat(e.op," is not implemented"))}};t.CATEGORY="string"},870634:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.executeOp=t.CATEGORY=void 0;var r=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=o(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var s in e)if("default"!==s&&{}.hasOwnProperty.call(e,s)){var i=a?Object.getOwnPropertyDescriptor(e,s):null;i&&(i.get||i.set)?Object.defineProperty(r,s,i):r[s]=e[s]}return r.default=e,n&&n.set(e,r),r}(n(763213)),a=n(598453);function o(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(o=function(e){return e?n:t})(e)}t.executeOp=(e,t,n)=>{switch(e.op){case"Cast":return[r.cast((0,a.getParamValue)("x",e,t,n),(0,a.getParamValue)("dtype",e,t,n))];case"ExpandDims":{const o=(0,a.getParamValue)("axis",e,t,n);return[r.expandDims((0,a.getParamValue)("x",e,t,n),o)]}case"Squeeze":{const o=(0,a.getParamValue)("axis",e,t,n);return[r.squeeze((0,a.getParamValue)("x",e,t,n),o)]}case"Reshape":return[r.reshape((0,a.getParamValue)("x",e,t,n),(0,a.getParamValue)("shape",e,t,n))];case"MirrorPad":return[r.mirrorPad((0,a.getParamValue)("x",e,t,n),(0,a.getParamValue)("padding",e,t,n),(0,a.getParamValue)("mode",e,t,n))];case"PadV2":case"Pad":return[r.pad((0,a.getParamValue)("x",e,t,n),(0,a.getParamValue)("padding",e,t,n),(0,a.getParamValue)("constantValue",e,t,n))];
1case"SpaceToBatchND":{const o=(0,a.getParamValue)("blockShape",e,t,n),s=(0,a.getParamValue)("paddings",e,t,n);return[r.spaceToBatchND((0,a.getParamValue)("x",e,t,n),o,s)]}case"BatchToSpaceND":{const o=(0,a.getParamValue)("blockShape",e,t,n),s=(0,a.getParamValue)("crops",e,t,n);return[r.batchToSpaceND((0,a.getParamValue)("x",e,t,n),o,s)]}case"DepthToSpace":{const o=(0,a.getParamValue)("blockSize",e,t,n),s=(0,a.getParamValue)("dataFormat",e,t,n).toUpperCase();return[r.depthToSpace((0,a.getParamValue)("x",e,t,n),o,s)]}case"BroadcastTo":return[r.broadcastTo((0,a.getParamValue)("x",e,t,n),(0,a.getParamValue)("shape",e,t,n))];case"BroadcastArgs":return[r.broadcastArgs((0,a.getParamValue)("s0",e,t,n),(0,a.getParamValue)("s1",e,t,n))];default:throw TypeError("Node type ".concat(e.op," is not implemented"))}};t.CATEGORY="transformation"},598453:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.cloneTensor=function(e){return e.kept?e:(0,r.clone)(e)},t.getNodeNameAndIndex=function(e,t){const[n,r,a]=i(e);return[s(n,t&&t.currentContextId),r,a]},t.getPadding=function(e,t,n){let r=a("pad",e,t,n);if("explicit"===r){r=a("explicitPaddings",e,t,n);const o=[[0,0],[0,0],[0,0],[0,0]];for(let e=0;e<4;e++)o[e][0]=r[2*e],o[e][1]=r[2*e+1];return o}return r},t.getParamValue=a,t.getTensor=o,t.getTensorsForCurrentContenxt=function(e,t,n){return t[s(e,n.currentContextId)]},t.parseNodeName=i,t.split=function(e,t){const n=[];for(let r=0;r<e.length;r+=t)n.push(e.slice(r,r+t));return n};var r=n(735534);function a(e,t,n,a,s){const i=t.inputParams[e];if(i&&void 0!==i.inputIndexStart){const e=i.inputIndexStart,c=0===i.inputIndexEnd?void 0:void 0===i.inputIndexEnd?e+1:i.inputIndexEnd;if("tensor"===i.type)return o(t.inputNames[i.inputIndexStart],n,a,s);if("tensors"===i.type){return t.inputNames.slice(e,c).map((e=>o(e,n,a,s)))}const l=o(t.inputNames.slice(e)[0],n,a,s),u=l.dataSync();return"number"===i.type?u[0]:r.util.toNestedArray(l.shape,u)}const c=t.attrParams[e];return c&&c.value}function o(e,t,n,r){const[a,o]=i(e);if(null!=r){const e=r.getHashTableHandleByName(a);if(null!=e)return e}const c=n.currentContextIds.find((e=>!!t[s(a,e)]));return void 0!==c?t[s(a,c)][o]:void 0}function s(e,t){return t?"".concat(e,"-").concat(t):e}function i(e){const t=e.split(":");if(1===t.length)return[e,0,void 0];const n=t[0],r=3===t.length?t[1]:void 0;return[n,Number(t[t.length-1]),r]}},205015:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.json=void 0;t.json=[{tfOpName:"Add",category:"arithmetic",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"AddV2",category:"arithmetic",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"AddN",category:"arithmetic",inputs:[{start:0,end:0,name:"tensors",type:"tensors"}]},{tfOpName:"BiasAdd",category:"arithmetic",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0},{tfName:"data_format",name:"dataFormat",type:"string",notSupported:!0}]},{tfOpName:"Sub",category:"arithmetic",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"RealDiv",category:"arithmetic",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Div",category:"arithmetic",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"DivNoNan",category:"arithmetic",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"FloorDiv",category:"arithmetic",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Mul",category:"arithmetic",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}
1]},{tfOpName:"Maximum",category:"arithmetic",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Minimum",category:"arithmetic",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Pow",category:"arithmetic",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"SquaredDifference",category:"arithmetic",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Mod",category:"arithmetic",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"FloorMod",category:"arithmetic",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]}]},125023:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.json=void 0;t.json=[{tfOpName:"Abs",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Acos",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Asin",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Atan",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Atan2",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"y",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Ceil",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"ClipByValue",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"clipValueMin",type:"number"},{start:2,name:"clipValueMax",type:"number"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Complex",category:"basic_math",inputs:[{start:0,name:"real",type:"tensor"},{start:1,name:"imag",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"ComplexAbs",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Cos",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Cosh",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Elu",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Exp",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Floor",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Log",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Imag",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0},{tfName:"Tout",name:"outputType",type:"dtype",notSupported:!0}]},{tfOpName:"Neg",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Real",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0},{tfName:"Tout",name:"outputType",type:"dtype",notSupported:!0}
1]},{tfOpName:"Prelu",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"alpha",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Relu",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Relu6",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Selu",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Sigmoid",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Sin",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Sinh",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Sqrt",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Rsqrt",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Square",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Tan",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Tanh",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Sign",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Round",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Expm1",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Log1p",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Reciprocal",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Softplus",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Asinh",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Acosh",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Atanh",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Erf",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Prod",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"axes",type:"number[]"}],attrs:[{tfName:"keep_dims",name:"keepDims",type:"bool",notSupported:!0},{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"LeakyRelu",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"alpha",name:"alpha",type:"number",defaultValue:.2},{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"IsNan",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]}]},743194:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.json=void 0;t.json=[{tfOpName:"EmptyTensorList",category:"control",inputs:[{start:0,name:"elementShape",type:"shape"},{start:1,name:"maxNumElements",type:"number"}],attrs:[{tfName:"element_dtype",name:"elementDType",type:"dtype"}]}
1,{tfOpName:"LoopCond",category:"control",inputs:[{start:0,name:"pred",type:"tensor"}]},{tfOpName:"Switch",category:"control",inputs:[{start:0,name:"data",type:"tensor"},{start:1,name:"pred",type:"tensor"}]},{tfOpName:"Merge",category:"control",inputs:[{start:0,end:0,name:"tensors",type:"tensors"}]},{tfOpName:"Enter",category:"control",inputs:[{start:0,name:"tensor",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0},{tfName:"frame_name",name:"frameName",type:"string"},{tfName:"is_constant",name:"isConstant",type:"bool"}]},{tfOpName:"Exit",category:"control",inputs:[{start:0,name:"tensor",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"NextIteration",category:"control",inputs:[{start:0,name:"tensor",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"TensorArrayV3",category:"control",inputs:[{start:0,name:"size",type:"number"}],attrs:[{tfName:"dtype",name:"dtype",type:"dtype"},{tfName:"element_shape",name:"elementShape",type:"shape"},{tfName:"dynamic_size",name:"dynamicSize",type:"bool"},{tfName:"clear_after_read",name:"clearAfterRead",type:"bool"},{tfName:"identical_element_shapes",name:"identicalElementShapes",type:"bool"},{tfName:"tensor_array_name",name:"name",type:"string"}]},{tfOpName:"TensorArrayWriteV3",category:"control",inputs:[{start:0,name:"tensorArrayId",type:"tensor"},{start:1,name:"index",type:"number"},{start:2,name:"tensor",type:"tensor"},{start:3,name:"flowIn",type:"number"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"TensorArrayReadV3",category:"control",inputs:[{start:0,name:"tensorArrayId",type:"tensor"},{start:1,name:"index",type:"number"},{start:2,name:"flowIn",type:"number"}],attrs:[{tfName:"dtype",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"TensorArrayGatherV3",category:"control",inputs:[{start:0,name:"tensorArrayId",type:"tensor"},{start:1,name:"indices",type:"number[]"},{start:2,name:"flowIn",type:"number"}],attrs:[{tfName:"dtype",name:"dtype",type:"dtype"},{tfName:"element_shape",name:"elementShape",type:"shape"}]},{tfOpName:"TensorArrayScatterV3",category:"control",inputs:[{start:0,name:"tensorArrayId",type:"tensor"},{start:1,name:"indices",type:"number[]"},{start:2,name:"tensor",type:"tensor"},{start:3,name:"flowIn",type:"number"}],attrs:[{tfName:"T",name:"dtype",type:"dtype"}]},{tfOpName:"TensorArrayConcatV3",category:"control",inputs:[{start:0,name:"tensorArrayId",type:"tensor"},{start:1,name:"flowIn",type:"number"}],attrs:[{tfName:"dtype",name:"dtype",type:"dtype"},{tfName:"element_shape_except0",name:"elementShapeExcept0",type:"shape",notSupported:!0}]},{tfOpName:"TensorArraySplitV3",category:"control",inputs:[{start:0,name:"tensorArrayId",type:"tensor"},{start:1,name:"tensor",type:"tensor"},{start:2,name:"lengths",type:"number[]"},{start:3,name:"flowIn",type:"number"}],attrs:[{tfName:"T",name:"dtype",type:"dtype"}]},{tfOpName:"TensorArraySizeV3",category:"control",inputs:[{start:0,name:"tensorArrayId",type:"tensor"},{start:1,name:"flowIn",type:"number"}]},{tfOpName:"TensorArrayCloseV3",category:"control",inputs:[{start:0,name:"tensorArrayId",type:"tensor"}]},{tfOpName:"StatelessIf",category:"control",inputs:[{start:0,name:"cond",type:"tensor"},{start:1,end:0,name:"args",type:"tensors"}],attrs:[{tfName:"then_branch",name:"thenBranch",type:"func"},{tfName:"else_branch",name:"elseBranch",type:"func"}]},{tfOpName:"If",category:"control",inputs:[{start:0,name:"cond",type:"tensor"},{start:1,end:0,name:"args",type:"tensors"}],attrs:[{tfName:"then_branch",name:"thenBranch",type:"func"},{tfName:"else_branch",name:"elseBranch",type:"func"}]},{tfOpName:"StatelessWhile",category:"control",inputs:[{start:0,end:0,name:"args",type:"tensors"}],attrs:[{tfName:"cond",name:"cond",type:"func"},{tfName:"body",name:"body",type:"func"}]},{tfOpName:"While",category:"control",inputs:[{start:0,end:0,name:"args",type:"tensors"}],attrs:[{tfName:"cond",name:"cond",type:"func"},{tfName:"body",name:"body",type:"func"}]}
1,{tfOpName:"TensorListScatter",category:"control",inputs:[{start:0,name:"tensor",type:"tensor"},{start:1,name:"indices",type:"number[]"},{start:2,name:"elementShape",type:"shape"}],attrs:[{tfName:"element_dtype",name:"elementDType",type:"dtype"}]},{tfOpName:"TensorListScatterV2",category:"control",inputs:[{start:0,name:"tensor",type:"tensor"},{start:1,name:"indices",type:"number[]"},{start:2,name:"elementShape",type:"shape"},{start:3,name:"numElements",type:"number"}],attrs:[{tfName:"element_dtype",name:"elementDType",type:"dtype"}]},{tfOpName:"TensorListGather",category:"control",inputs:[{start:0,name:"tensorListId",type:"tensor"},{start:1,name:"indices",type:"number[]"},{start:2,name:"elementShape",type:"shape"}],attrs:[{tfName:"element_dtype",name:"elementDType",type:"dtype"}]},{tfOpName:"TensorListGetItem",category:"control",inputs:[{start:0,name:"tensorListId",type:"tensor"},{start:1,name:"index",type:"number"},{start:2,name:"elementShape",type:"shape"}],attrs:[{tfName:"element_dtype",name:"elementDType",type:"dtype"}]},{tfOpName:"TensorListSetItem",category:"control",inputs:[{start:0,name:"tensorListId",type:"tensor"},{start:1,name:"index",type:"number"},{start:2,name:"tensor",type:"tensor"}],attrs:[{tfName:"element_dtype",name:"elementDType",type:"dtype"}]},{tfOpName:"TensorListReserve",category:"control",inputs:[{start:0,name:"elementShape",type:"shape"},{start:1,name:"numElements",type:"number"}],attrs:[{tfName:"element_dtype",name:"elementDType",type:"dtype"}]},{tfOpName:"TensorListFromTensor",category:"control",inputs:[{start:0,name:"tensor",type:"tensor"},{start:1,name:"elementShape",type:"shape"}],attrs:[{tfName:"element_dtype",name:"elementDType",type:"dtype"}]},{tfOpName:"TensorListStack",category:"control",inputs:[{start:0,name:"tensorListId",type:"tensor"},{start:1,name:"elementShape",type:"shape"}],attrs:[{tfName:"element_dtype",name:"elementDType",type:"dtype"},{tfName:"num_elements",name:"numElements",type:"dtype"}]},{tfOpName:"TensorListSplit",category:"control",inputs:[{start:0,name:"tensor",type:"tensor"},{start:1,name:"elementShape",type:"shape"},{start:2,name:"lengths",type:"number[]"}],attrs:[{tfName:"element_dtype",name:"elementDType",type:"dtype"}]},{tfOpName:"TensorListConcat",category:"control",inputs:[{start:0,name:"tensorListId",type:"tensor"}],attrs:[{tfName:"element_shape",name:"elementShape",type:"shape"},{tfName:"element_dtype",name:"elementDType",type:"dtype"}]},{tfOpName:"TensorListPopBack",category:"control",inputs:[{start:0,name:"tensorListId",type:"tensor"},{start:1,name:"elementShape",type:"shape"}],attrs:[{tfName:"element_dtype",name:"elementDType",type:"dtype"}]},{tfOpName:"TensorListPushBack",category:"control",inputs:[{start:0,name:"tensorListId",type:"tensor"},{start:1,name:"tensor",type:"tensor"}],attrs:[{tfName:"element_dtype",name:"elementDType",type:"dtype"}]}]},203166:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.json=void 0;t.json=[{tfOpName:"AvgPool",category:"convolution",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"strides",name:"strides",type:"number[]"},{tfName:"padding",name:"pad",type:"string"},{tfName:"data_format",name:"dataFormat",type:"string",notSupported:!0},{tfName:"ksize",name:"kernelSize",type:"number[]"},{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"MaxPool",category:"convolution",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"strides",name:"strides",type:"number[]"},{tfName:"padding",name:"pad",type:"string"},{tfName:"data_format",name:"dataFormat",type:"string",notSupported:!0},{tfName:"ksize",name:"kernelSize",type:"number[]"},{tfName:"explicit_paddings",name:"explicitPaddings",type:"number[]",defaultValue:[],notSupported:!0},{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"MaxPoolWithArgmax",category:"convolution",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"strides",name:"strides",type:"number[]"},{tfName:"padding",name:"pad",type:"string"},{tfName:"ksize",name:"kernelSize",type:"number[]"},{tfName:"include_batch_in_index",name:"includeBatchInIndex",type:"bool"},{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}
vendor: 4,308 bytes, line 1
1]},{tfOpName:"AvgPool3D",category:"convolution",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"strides",name:"strides",type:"number[]"},{tfName:"padding",name:"pad",type:"string"},{tfName:"data_format",name:"dataFormat",type:"string",notSupported:!0},{tfName:"ksize",name:"kernelSize",type:"number[]"},{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"MaxPool3D",category:"convolution",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"strides",name:"strides",type:"number[]"},{tfName:"padding",name:"pad",type:"string"},{tfName:"data_format",name:"dataFormat",type:"string",notSupported:!0},{tfName:"ksize",name:"kernelSize",type:"number[]"},{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Conv1D",category:"convolution",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"filter",type:"tensor"}],attrs:[{tfName:"stride",name:"stride",type:"number"},{tfName:"padding",name:"pad",type:"string"},{tfName:"data_format",name:"dataFormat",type:"string",defaultValue:"NWC"},{tfName:"T",name:"dtype",type:"dtype",notSupported:!0},{tfName:"dilation",name:"dilation",type:"number",defaultValue:1}]},{tfOpName:"Conv2D",category:"convolution",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"filter",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0},{tfName:"strides",name:"strides",type:"number[]"},{tfName:"padding",name:"pad",type:"string"},{tfName:"useCudnnOnGpu",name:"useCudnnOnGpu",type:"bool"},{tfName:"data_format",name:"dataFormat",type:"string",defaultValue:"NHWC"},{tfName:"explicit_paddings",name:"explicitPaddings",type:"number[]",defaultValue:[]},{tfName:"dilations",name:"dilations",type:"number[]"}]},{tfOpName:"_FusedConv2D",category:"convolution",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"filter",type:"tensor"},{start:2,end:0,name:"args",type:"tensors"}],attrs:[{tfName:"num_args",name:"numArgs",type:"number"},{tfName:"T",name:"dtype",type:"dtype",notSupported:!0},{tfName:"strides",name:"strides",type:"number[]"},{tfName:"padding",name:"pad",type:"string"},{tfName:"explicit_paddings",name:"explicitPaddings",type:"number[]",defaultValue:[]},{tfName:"use_cudnn_on_gpu",name:"useCudnnOnGpu",type:"bool",defaultValue:!0},{tfName:"data_format",name:"dataFormat",type:"string",defaultValue:"NHWC"},{tfName:"dilations",name:"dilations",type:"number[]",defaultValue:[1,1,1,1]},{tfName:"fused_ops",name:"fusedOps",type:"string[]",defaultValue:[]},{tfName:"epsilon",name:"epsilon",type:"number",defaultValue:1e-4},{tfName:"leakyrelu_alpha",name:"leakyreluAlpha",type:"number"}]},{tfOpName:"Conv2DBackpropInput",category:"convolution",inputs:[{start:2,name:"x",type:"tensor"},{start:1,name:"filter",type:"tensor"},{start:0,name:"outputShape",type:"number[]"}],attrs:[{tfName:"strides",name:"strides",type:"number[]"},{tfName:"padding",name:"pad",type:"string"},{tfName:"data_format",name:"dataFormat",type:"string",notSupported:!0},{tfName:"explicit_paddings",name:"explicitPaddings",type:"number[]",defaultValue:[]},{tfName:"dilations",name:"dilations",type:"number[]",notSupported:!0}]},{tfOpName:"DepthwiseConv2d",category:"convolution",inputs:[{start:0,name:"input",type:"tensor"},{start:1,name:"filter",type:"tensor"}],attrs:[{tfName:"strides",name:"strides",type:"number[]"},{tfName:"padding",name:"pad",type:"string"},{tfName:"data_format",name:"dataFormat",type:"string",defaultValue:"NHWC"},{tfName:"explicit_paddings",name:"explicitPaddings",type:"number[]",defaultValue:[]},{tfName:"dilations",name:"dilations",type:"number[]"}]},{tfOpName:"DepthwiseConv2dNative",category:"convolution",inputs:[{start:0,name:"input",type:"tensor"},{start:1,name:"filter",type:"tensor"}],attrs:[{tfName:"strides",name:"strides",type:"number[]"},{tfName:"padding",name:"pad",type:"string"},{tfName:"data_format",name:"dataFormat",type:"string",defaultValue:"NHWC"},{tfName:"explicit_paddings",name:"explicitPaddings",type:"number[]",defaultValue:[]},{tfName:"dilations",name:"dilations",type:"number[]"}]},{tfOpName:"FusedDepthwiseConv2dNative",category:"convolution",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"filter",type:"tensor"},{start:2,end:0,name:"args",type:"tensors"}],attrs:[{tfName:"num_args",name:"numArgs",type:"number"},{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}
1,{tfName:"strides",name:"strides",type:"number[]"},{tfName:"padding",name:"pad",type:"string"},{tfName:"data_format",name:"dataFormat",type:"string",defaultValue:"NHWC"},{tfName:"dilations",name:"dilations",type:"number[]",defaultValue:[1,1,1,1]},{tfName:"fused_ops",name:"fusedOps",type:"string[]",defaultValue:[]},{tfName:"explicit_paddings",name:"explicitPaddings",type:"number[]",defaultValue:[]}]},{tfOpName:"Conv3D",category:"convolution",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"filter",type:"tensor"}],attrs:[{tfName:"strides",name:"strides",type:"number[]"},{tfName:"padding",name:"pad",type:"string"},{tfName:"data_format",name:"dataFormat",type:"string",defaultValue:"NHWC"},{tfName:"dilations",name:"dilations",type:"number[]"}]},{tfOpName:"Dilation2D",category:"convolution",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"filter",type:"tensor"}],attrs:[{tfName:"strides",name:"strides",type:"number[]"},{tfName:"rates",name:"dilations",type:"number[]"},{tfName:"padding",name:"pad",type:"string"}]}]},109625:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.json=void 0;t.json=[{tfOpName:"Fill",category:"creation",inputs:[{start:0,name:"shape",type:"number[]"},{start:1,name:"value",type:"number"}],attrs:[{tfName:"T",name:"dtype",type:"dtype"}]},{tfOpName:"LinSpace",category:"creation",inputs:[{start:0,name:"start",type:"number"},{start:1,name:"stop",type:"number"},{start:2,name:"num",type:"number"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"OneHot",category:"creation",inputs:[{start:0,name:"indices",type:"tensor"},{start:1,name:"depth",type:"number"},{start:2,name:"onValue",type:"number",defaultValue:1},{start:3,name:"offValue",type:"number",defaultValue:0}],attrs:[{tfName:"axis",name:"axis",type:"number",notSupported:!0},{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Ones",category:"creation",inputs:[{start:0,name:"shape",type:"number[]"}],attrs:[{tfName:"T",name:"dtype",type:"dtype"}]},{tfOpName:"OnesLike",category:"creation",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"dtype",name:"dtype",type:"dtype"}]},{tfOpName:"RandomUniform",category:"creation",inputs:[{start:0,name:"shape",type:"number[]"}],attrs:[{tfName:"minval",name:"minval",type:"number",defaultValue:0},{tfName:"maxval",name:"maxval",type:"number",defaultValue:1},{tfName:"dtype",name:"dtype",type:"dtype"},{tfName:"seed",name:"seed",type:"number",defaultValue:0},{tfName:"seed2",name:"seed2",type:"number",defaultValue:0,notSupported:!0},{tfName:"T",name:"T",type:"number",notSupported:!0}]},{tfOpName:"Range",category:"creation",inputs:[{start:0,name:"start",type:"number"},{start:1,name:"stop",type:"number"},{start:2,name:"step",type:"number",defaultValue:0}],attrs:[{tfName:"Tidx",name:"dtype",type:"dtype"}]},{tfOpName:"TruncatedNormal",category:"creation",inputs:[{start:0,name:"shape",type:"number[]"}],attrs:[{tfName:"means",name:"mean",type:"number",defaultValue:0},{tfName:"stddev",name:"stdDev",type:"number",defaultValue:1},{tfName:"seed",name:"seed",type:"number"},{tfName:"seed2",name:"seed2",type:"number",defaultValue:0,notSupported:!0},{tfName:"dtype",name:"dtype",type:"dtype"},{tfName:"T",name:"T",type:"number",notSupported:!0}]},{tfOpName:"Zeros",category:"creation",inputs:[{start:0,name:"shape",type:"number[]"}],attrs:[{tfName:"T",name:"dtype",type:"dtype"}]},{tfOpName:"ZerosLike",category:"creation",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype"}]},{tfOpName:"Multinomial",category:"creation",inputs:[{start:0,name:"logits",type:"tensor"},{start:1,name:"numSamples",type:"number"}],attrs:[{tfName:"seed",name:"seed",type:"number"},{tfName:"seed2",name:"seed2",type:"number"},{tfName:"T",name:"dtype",type:"dtype"},{tfName:"output_dtype",name:"output_dtype",type:"dtype"}]}]},588536:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.json=void 0;t.json=[{tfOpName:"NonMaxSuppressionV2",category:"dynamic",inputs:[{start:0,name:"boxes",type:"tensor"},{start:1,name:"scores",type:"tensor"},{start:2,name:"maxOutputSize",type:"number"},{start:3,name:"iouThreshold",type:"number"}]},{tfOpName:"NonMaxSuppressionV3",category:"dynamic",inputs:[{start:0,name:"boxes",type:"tensor"},{start:1,name:"scores",type:"tensor"},{start:2,name:"maxOutputSize",type:"number"},{start:3,name:"iouThreshold",type:"number"},{start:4,name:"scoreThreshold",type:"number"}]},{tfOpName:"NonMaxSuppressionV4",category:"dynamic",inputs:[{start:0,name:"boxes",type:"tensor"},{start:1,name:"scores",type:"tensor"},{start:2,name:"maxOutputSize",type:"number"},{start:3,name:"iouThreshold",type:"number"},{start:4,name:"scoreThreshold",type:"number"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}
1,{tfName:"T_threshold",name:"threshold",type:"dtype",notSupported:!0},{tfName:"pad_to_max_output_size",name:"padToMaxOutputSize",type:"bool"}]},{tfOpName:"NonMaxSuppressionV5",category:"dynamic",inputs:[{start:0,name:"boxes",type:"tensor"},{start:1,name:"scores",type:"tensor"},{start:2,name:"maxOutputSize",type:"number"},{start:3,name:"iouThreshold",type:"number"},{start:4,name:"scoreThreshold",type:"number"},{start:5,name:"softNmsSigma",type:"number"}]},{tfOpName:"Where",category:"dynamic",inputs:[{start:0,name:"condition",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"ListDiff",category:"dynamic",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"y",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]}]},850989:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.json=void 0;t.json=[{tfOpName:"TopKV2",category:"evaluation",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"k",type:"number"}],attrs:[{tfName:"sorted",name:"sorted",type:"bool"}]},{tfOpName:"Unique",category:"evaluation",inputs:[{start:0,name:"x",type:"tensor"}]},{tfOpName:"UniqueV2",category:"evaluation",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"axis",type:"number"}]}]},356256:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.json=void 0;t.json=[{tfOpName:"PlaceholderWithDefault",category:"graph",inputs:[{start:0,name:"default",type:"tensor"}],attrs:[{tfName:"shape",name:"shape",type:"shape"},{tfName:"dtype",name:"dtype",type:"dtype"}]},{tfOpName:"Placeholder",category:"graph",attrs:[{tfName:"shape",name:"shape",type:"shape"},{tfName:"dtype",name:"dtype",type:"dtype"}]},{tfOpName:"Const",category:"graph"},{tfOpName:"Identity",category:"graph",inputs:[{start:0,name:"x",type:"tensor"}]},{tfOpName:"IdentityN",category:"graph",inputs:[{start:0,end:0,name:"x",type:"tensors"}]},{tfOpName:"Snapshot",category:"graph",inputs:[{start:0,name:"x",type:"tensor"}]},{tfOpName:"Rank",category:"graph",inputs:[{start:0,name:"x",type:"tensor"}]},{tfOpName:"Size",category:"graph",inputs:[{start:0,name:"x",type:"tensor"}]},{tfOpName:"Shape",category:"graph",inputs:[{start:0,name:"x",type:"tensor"}]},{tfOpName:"ShapeN",category:"graph",inputs:[{start:0,end:0,name:"x",type:"tensors"}]},{tfOpName:"Print",category:"graph",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"data",type:"tensors"}],attrs:[{tfName:"message",name:"message",type:"string"},{tfName:"first_n",name:"firstN",type:"number",notSupported:!0},{tfName:"summarize",name:"summarize",type:"number",defaultValue:3}]},{tfOpName:"NoOp",category:"graph",inputs:[]},{tfOpName:"StopGradient",category:"graph",inputs:[{start:0,name:"x",type:"tensor"}]},{tfOpName:"FakeQuantWithMinMaxVars",category:"graph",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"min",name:"min",type:"number"},{tfName:"max",name:"max",type:"number"}]}]},872950:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.json=void 0;t.json=[{tfOpName:"HashTable",category:"hash_table",inputs:[],attrs:[{tfName:"shared_name",name:"sharedName",type:"string"},{tfName:"use_node_name_sharing",name:"useNodeNameSharing",type:"bool"},{tfName:"key_dtype",name:"keyDType",type:"dtype"},{tfName:"value_dtype",name:"valueDType",type:"dtype"}]},{tfOpName:"HashTableV2",category:"hash_table",inputs:[],attrs:[{tfName:"shared_name",name:"sharedName",type:"string"},{tfName:"use_node_name_sharing",name:"useNodeNameSharing",type:"bool"},{tfName:"key_dtype",name:"keyDType",type:"dtype"},{tfName:"value_dtype",name:"valueDType",type:"dtype"}]},{tfOpName:"LookupTableImport",category:"hash_table",inputs:[{start:0,name:"tableHandle",type:"tensor"},{start:1,name:"keys",type:"tensor"},{start:2,name:"values",type:"tensor"}],attrs:[{tfName:"Tin",name:"tIn",type:"dtype",notSupported:!0},{tfName:"Tout",name:"tOut",type:"dtype",notSupported:!0}]},{tfOpName:"LookupTableImportV2",category:"hash_table",inputs:[{start:0,name:"tableHandle",type:"tensor"},{start:1,name:"keys",type:"tensor"},{start:2,name:"values",type:"tensor"}
1],attrs:[{tfName:"Tin",name:"tIn",type:"dtype",notSupported:!0},{tfName:"Tout",name:"tOut",type:"dtype",notSupported:!0}]},{tfOpName:"LookupTableFind",category:"hash_table",inputs:[{start:0,name:"tableHandle",type:"tensor"},{start:1,name:"keys",type:"tensor"},{start:2,name:"defaultValue",type:"tensor"}],attrs:[{tfName:"Tin",name:"tIn",type:"dtype",notSupported:!0},{tfName:"Tout",name:"tOut",type:"dtype",notSupported:!0}]},{tfOpName:"LookupTableFindV2",category:"hash_table",inputs:[{start:0,name:"tableHandle",type:"tensor"},{start:1,name:"keys",type:"tensor"},{start:2,name:"defaultValue",type:"tensor"}],attrs:[{tfName:"Tin",name:"tIn",type:"dtype",notSupported:!0},{tfName:"Tout",name:"tOut",type:"dtype",notSupported:!0}]},{tfOpName:"LookupTableSize",category:"hash_table",inputs:[{start:0,name:"tableHandle",type:"tensor"}]},{tfOpName:"LookupTableSizeV2",category:"hash_table",inputs:[{start:0,name:"tableHandle",type:"tensor"}]}]},515166:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.json=void 0;t.json=[{tfOpName:"ResizeBilinear",category:"image",inputs:[{start:0,name:"images",type:"tensor"},{start:1,name:"size",type:"number[]"}],attrs:[{tfName:"align_corners",name:"alignCorners",type:"bool"},{tfName:"half_pixel_centers",name:"halfPixelCenters",type:"bool"},{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"ResizeNearestNeighbor",category:"image",inputs:[{start:0,name:"images",type:"tensor"},{start:1,name:"size",type:"number[]"}],attrs:[{tfName:"align_corners",name:"alignCorners",type:"bool"},{tfName:"half_pixel_centers",name:"halfPixelCenters",type:"bool"},{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"CropAndResize",category:"image",inputs:[{start:0,name:"image",type:"tensor"},{start:1,name:"boxes",type:"tensor"},{start:2,name:"boxInd",type:"tensor"},{start:3,name:"cropSize",type:"number[]"}],attrs:[{tfName:"method",name:"method",type:"string"},{tfName:"extrapolation_value",name:"extrapolationValue",type:"number"}]}]},947022:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.json=void 0;t.json=[{tfOpName:"Equal",category:"logical",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"NotEqual",category:"logical",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Greater",category:"logical",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"GreaterEqual",category:"logical",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Less",category:"logical",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"LessEqual",category:"logical",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"LogicalAnd",category:"logical",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"LogicalNot",category:"logical",inputs:[{start:0,name:"a",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"LogicalOr",category:"logical",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Select",category:"logical",inputs:[{start:0,name:"condition",type:"tensor"},{start:1,name:"a",type:"tensor"},{start:2,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"SelectV2",category:"logical",inputs:[{start:0,name:"condition",type:"tensor"},{start:1,name:"a",type:"tensor"},{start:2,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}
1]}]},490134:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.json=void 0;t.json=[{tfOpName:"_FusedMatMul",category:"matrices",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"},{start:2,end:0,name:"args",type:"tensors"}],attrs:[{tfName:"num_args",name:"numArgs",type:"number"},{tfName:"fused_ops",name:"fusedOps",type:"string[]",defaultValue:[]},{tfName:"epsilon",name:"epsilon",type:"number",defaultValue:1e-4},{tfName:"transpose_a",name:"transposeA",type:"bool",defaultValue:!1},{tfName:"transpose_b",name:"transposeB",type:"bool",defaultValue:!1},{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"MatMul",category:"matrices",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"transpose_a",name:"transposeA",type:"bool",defaultValue:!1},{tfName:"transpose_b",name:"transposeB",type:"bool",defaultValue:!1},{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"BatchMatMul",category:"matrices",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"adj_x",name:"transposeA",type:"bool",defaultValue:!1},{tfName:"adj_y",name:"transposeB",type:"bool",defaultValue:!1},{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"BatchMatMulV2",category:"matrices",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"adj_x",name:"transposeA",type:"bool",defaultValue:!1},{tfName:"adj_y",name:"transposeB",type:"bool",defaultValue:!1},{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Transpose",category:"matrices",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"perm",type:"number[]"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Einsum",category:"matrices",inputs:[{start:0,end:0,name:"tensors",type:"tensors"}],attrs:[{tfName:"equation",name:"equation",type:"string"},{tfName:"N",name:"n",type:"number",defaultValue:2},{tfName:"T",name:"dtype",type:"dtype"}]}]},280066:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.json=void 0;t.json=[{tfOpName:"FusedBatchNorm",category:"normalization",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"scale",type:"tensor"},{start:2,name:"offset",type:"tensor"},{start:3,name:"mean",type:"tensor"},{start:4,name:"variance",type:"tensor"}],attrs:[{tfName:"epsilon",name:"epsilon",type:"number",defaultValue:.001},{tfName:"data_format",name:"dataFormat",type:"string",notSupported:!0}]},{tfOpName:"FusedBatchNormV2",category:"normalization",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"scale",type:"tensor"},{start:2,name:"offset",type:"tensor"},{start:3,name:"mean",type:"tensor"},{start:4,name:"variance",type:"tensor"}],attrs:[{tfName:"epsilon",name:"epsilon",type:"number",defaultValue:.001},{tfName:"data_format",name:"dataFormat",type:"string",notSupported:!0}]},{tfOpName:"FusedBatchNormV3",category:"normalization",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"scale",type:"tensor"},{start:2,name:"offset",type:"tensor"},{start:3,name:"mean",type:"tensor"},{start:4,name:"variance",type:"tensor"}],attrs:[{tfName:"epsilon",name:"epsilon",type:"number",defaultValue:.001},{tfName:"data_format",name:"dataFormat",type:"string",notSupported:!0}]},{tfOpName:"LRN",category:"normalization",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"depth_radius",name:"radius",type:"number",defaultValue:5},{tfName:"bias",name:"bias",type:"number",defaultValue:1},{tfName:"alpha",name:"alpha",type:"number",defaultValue:1},{tfName:"beta",name:"beta",type:"number",defaultValue:.5}]},{tfOpName:"Softmax",category:"normalization",inputs:[{start:0,name:"x",type:"tensor"}]},{tfOpName:"LogSoftmax",category:"normalization",inputs:[{start:0,name:"x",type:"tensor"}]},{tfOpName:"SparseToDense",category:"normalization",inputs:[{start:0,name:"sparseIndices",type:"tensor"},{start:1,name:"outputShape",type:"number[]"},{start:2,name:"sparseValues",type:"tensor"},{start:3,name:"defaultValue",type:"tensor"}],attrs:[{tfName:"validate_indices",name:"validateIndices",type:"bool",defaultValue:!0,notSupported:!0}
1]}]},71142:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.json=void 0;t.json=[{tfOpName:"Bincount",category:"reduction",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"size",type:"number"},{start:2,name:"weights",type:"tensor"}]},{tfOpName:"DenseBincount",category:"reduction",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"size",type:"number"},{start:2,name:"weights",type:"tensor"}],attrs:[{tfName:"binary_output",name:"binaryOutput",type:"bool"}]},{tfOpName:"Max",category:"reduction",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"axis",type:"number[]"}],attrs:[{tfName:"keep_dims",name:"keepDims",type:"bool"}]},{tfOpName:"Mean",category:"reduction",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"axis",type:"number[]"}],attrs:[{tfName:"keep_dims",name:"keepDims",type:"bool"}]},{tfOpName:"Min",category:"reduction",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"axis",type:"number[]"}],attrs:[{tfName:"keep_dims",name:"keepDims",type:"bool"}]},{tfOpName:"Sum",category:"reduction",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"axis",type:"number[]"}],attrs:[{tfName:"keep_dims",name:"keepDims",type:"bool"}]},{tfOpName:"All",category:"reduction",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"axis",type:"number[]"}],attrs:[{tfName:"keep_dims",name:"keepDims",type:"bool"}]},{tfOpName:"Any",category:"reduction",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"axis",type:"number[]"}],attrs:[{tfName:"keep_dims",name:"keepDims",type:"bool"}]},{tfOpName:"ArgMax",category:"reduction",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"axis",type:"number"}]},{tfOpName:"ArgMin",category:"reduction",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"axis",type:"number"}]},{tfOpName:"Prod",category:"reduction",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"axis",type:"number[]"}],attrs:[{tfName:"keep_dims",name:"keepDims",type:"bool"}]},{tfOpName:"Cumsum",category:"reduction",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"axis",type:"number"}],attrs:[{tfName:"exclusive",name:"exclusive",type:"bool"},{tfName:"reverse",name:"reverse",type:"bool"}]}]},780382:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.json=void 0;t.json=[{tfOpName:"ConcatV2",category:"slice_join",inputs:[{start:0,end:-1,name:"tensors",type:"tensors"},{start:-1,name:"axis",type:"number"}],attrs:[{tfName:"N",name:"n",type:"number",defaultValue:2}]},{tfOpName:"Concat",category:"slice_join",inputs:[{start:1,end:0,name:"tensors",type:"tensors"},{start:0,name:"axis",type:"number"}],attrs:[{tfName:"N",name:"n",type:"number",defaultValue:2}]},{tfOpName:"GatherV2",category:"slice_join",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"indices",type:"tensor"},{start:2,name:"axis",type:"number",defaultValue:0}],attrs:[{tfName:"batch_dims",name:"batchDims",type:"number",defaultValue:0}]},{tfOpName:"Gather",category:"slice_join",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"indices",type:"tensor"}],attrs:[{tfName:"validate_indices",name:"validateIndices",type:"bool",notSupported:!0}]},{tfOpName:"Reverse",category:"slice_join",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"dims",type:"bool[]"}]},{tfOpName:"ReverseV2",category:"slice_join",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"axis",type:"number[]"}]},{tfOpName:"Slice",category:"slice_join",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"begin",type:"number[]"},{start:2,name:"size",type:"number[]"}]},{tfOpName:"StridedSlice",category:"slice_join",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"begin",type:"number[]"},{start:2,name:"end",type:"number[]"},{start:3,name:"strides",type:"number[]"}],attrs:[{tfName:"begin_mask",name:"beginMask",type:"number",defaultValue:0},{tfName:"end_mask",name:"endMask",type:"number",defaultValue:0},{tfName:"new_axis_mask",name:"newAxisMask",type:"number",defaultValue:0},{tfName:"ellipsis_mask",name:"ellipsisMask",type:"number",defaultValue:0},{tfName:"shrink_axis_mask",name:"shrinkAxisMask",type:"number",defaultValue:0}]},{tfOpName:"Pack",category:"slice_join",inputs:[{start:0,end:0,name:"tensors",type:"tensors"}],attrs:[{tfName:"axis",name:"axis",type:"number",defaultValue:0}]},{tfOpName:"Unpack",category:"slice_join",inputs:[{start:0,name:"tensor",type:"tensor"}],attrs:[{tfName:"axis",name:"axis",type:"number",defaultValue:0},{tfName:"num",name:"num",type:"number",defaultValue:0,notSupported:!0}
1]},{tfOpName:"Tile",category:"slice_join",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"reps",type:"number[]"}]},{tfOpName:"Split",category:"slice_join",inputs:[{start:0,name:"axis",type:"number",defaultValue:0},{start:1,name:"x",type:"tensor"}],attrs:[{tfName:"num_split",name:"numOrSizeSplits",type:"number",defaultValue:1}]},{tfOpName:"SplitV",category:"slice_join",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"numOrSizeSplits",type:"number[]"},{start:2,name:"axis",type:"number",defaultValue:0}]},{tfOpName:"ScatterNd",category:"slice_join",inputs:[{start:0,name:"indices",type:"tensor"},{start:1,name:"values",type:"tensor"},{start:2,name:"shape",type:"number[]"}]},{tfOpName:"GatherNd",category:"slice_join",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"indices",type:"tensor"}]},{tfOpName:"SparseToDense",category:"slice_join",inputs:[{start:0,name:"sparseIndices",type:"tensor"},{start:1,name:"outputShape",type:"number[]"},{start:2,name:"sparseValues",type:"tensor"},{start:3,name:"defaultValue",type:"tensor"}],attrs:[{tfName:"validate_indices",name:"validateIndices",type:"bool",defaultValue:!1,notSupported:!0}]}]},924554:(e,t)=>
1{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.json=void 0;t.json=[{tfOpName:"SparseFillEmptyRows",category:"sparse",inputs:[{start:0,name:"indices",type:"tensor"},{start:1,name:"values",type:"tensor"},{start:2,name:"denseShape",type:"tensor"},{start:3,name:"defaultValue",type:"tensor"}]},{tfOpName:"SparseReshape",category:"sparse",inputs:[{start:0,name:"inputIndices",type:"tensor"},{start:1,name:"inputShape",type:"tensor"},{start:2,name:"newShape",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"SparseSegmentMean",category:"sparse",inputs:[{start:0,name:"data",type:"tensor"},{start:1,name:"indices",type:"tensor"},{start:2,name:"segmentIds",type:"tensor"}]},{tfOpName:"SparseSegmentSum",category:"sparse",inputs:[{start:0,name:"data",type:"tensor"},{start:1,name:"indices",type:"tensor"},{start:2,name:"segmentIds",type:"tensor"}]}]},272667:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.json=void 0;t.json=[{tfOpName:"FFT",category:"spectral",inputs:[{start:0,name:"x",type:"tensor"}]},{tfOpName:"IFFT",category:"spectral",inputs:[{start:0,name:"x",type:"tensor"}]},{tfOpName:"RFFT",category:"spectral",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"fft_length",type:"number",notSupported:!0}]},{tfOpName:"IRFFT",category:"spectral",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"fft_length",type:"number",notSupported:!0}]}]},135864:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.json=void 0;t.json=[{tfOpName:"StringNGrams",category:"string",inputs:[{start:0,name:"data",type:"tensor"},{start:1,name:"dataSplits",type:"tensor"}],attrs:[{tfName:"separator",name:"separator",type:"string"},{tfName:"ngram_widths",name:"nGramWidths",type:"number[]"},{tfName:"left_pad",name:"leftPad",type:"string"},{tfName:"right_pad",name:"rightPad",type:"string"},{tfName:"pad_width",name:"padWidth",type:"number"},{tfName:"preserve_short_sequences",name:"preserveShortSequences",type:"bool"}],outputs:["ngrams","ngrams_splits"]},{tfOpName:"StringSplit",category:"string",inputs:[{start:0,name:"input",type:"tensor"},{start:1,name:"delimiter",type:"tensor"}],attrs:[{tfName:"skip_empty",name:"skipEmpty",type:"bool"}],outputs:["indices","values","shape"]},{tfOpName:"StringToHashBucketFast",category:"string",inputs:[{start:0,name:"input",type:"tensor"}],attrs:[{tfName:"num_buckets",name:"numBuckets",type:"number"}]}]},656500:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.json=void 0;t.json=[{tfOpName:"Cast",category:"transformation",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"SrcT",name:"sdtype",type:"dtype",notSupported:!0},{tfName:"DstT",name:"dtype",type:"dtype"}]},{tfOpName:"ExpandDims",category:"transformation",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"axis",type:"number"}]},{tfOpName:"MirrorPad",category:"transformation",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"padding",type:"number[]"}],attrs:[{tfName:"mode",name:"mode",type:"string"}]},{tfOpName:"Pad",category:"transformation",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"padding",type:"number[]"}],attrs:[{tfName:"constant_value",name:"constantValue",type:"number",defaultValue:0}]},{tfOpName:"PadV2",category:"transformation",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"padding",type:"number[]"},{start:2,name:"constantValue",type:"number",defaultValue:0}]},{tfOpName:"Reshape",category:"transformation",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"shape",type:"number[]"}]},{tfOpName:"Squeeze",category:"transformation",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"axis",tfDeprecatedName:"squeeze_dims",name:"axis",type:"number[]"}]},{tfOpName:"SpaceToBatchND",category:"transformation",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"blockShape",type:"number[]"},{start:2,name:"paddings",type:"number[]"}]},{tfOpName:"BatchToSpaceND",category:"transformation",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"blockShape",type:"number[]"},{start:2,name:"crops",type:"number[]"}]},{tfOpName:"DepthToSpace",category:"transformation",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"block_size",name:"blockSize",type:"number"},{tfName:"data_format",name:"dataFormat",type:"string"}]},{tfOpName:"BroadcastTo",category:"transformation",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"shape",type:"number[]"}],attrs:[]},{tfOpName:"BroadcastArgs",category:"transformation",inputs:[{start:0,name:"s0",type:"tensor"},{start:1,name:"s1",type:"tensor"}],attrs:[]}]},347750:(e,t,n)=>{"use strict";
1Object.defineProperty(t,"__esModule",{value:!0}),t.executeOp=function(e,t,n,P){const O=((e,t,n)=>{switch(e.category){case"arithmetic":return r.tidy((()=>s.executeOp(e,t,n)));case"basic_math":return r.tidy((()=>i.executeOp(e,t,n)));case"control":return c.executeOp(e,t,n);case"convolution":return r.tidy((()=>l.executeOp(e,t,n)));case"creation":return r.tidy((()=>u.executeOp(e,t,n)));case"dynamic":return d.executeOp(e,t,n);case"evaluation":return r.tidy((()=>p.executeOp(e,t,n)));case"image":return r.tidy((()=>m.executeOp(e,t,n)));case"graph":return r.tidy((()=>h.executeOp(e,t,n)));case"logical":return r.tidy((()=>g.executeOp(e,t,n)));case"matrices":return r.tidy((()=>y.executeOp(e,t,n)));case"normalization":return r.tidy((()=>v.executeOp(e,t,n)));case"reduction":return r.tidy((()=>b.executeOp(e,t,n)));case"slice_join":return r.tidy((()=>x.executeOp(e,t,n)));case"sparse":return r.tidy((()=>w.executeOp(e,t,n)));case"spectral":return r.tidy((()=>k.executeOp(e,t,n)));case"string":return r.tidy((()=>_.executeOp(e,t,n)));case"transformation":return r.tidy((()=>C.executeOp(e,t,n)));case"hash_table":return f.executeOp(e,t,n,P);case"custom":const O=(0,o.getRegisteredOp)(e.op);if(O&&O.customExecutor)return O.customExecutor(new a.NodeValueImpl(e,t,n));throw TypeError("Custom op ".concat(e.op," is not registered."));default:throw TypeError("Unknown op '".concat(e.op,"'. File an issue at ")+"https://github.com/tensorflow/tfjs/issues so we can add it, or register a custom execution with tf.registerOp()")}})(e,t,n);if(r.util.isPromise(O))return O.then((e=>[].concat(e)));return[].concat(O)};var r=O(n(735534)),a=n(108122),o=n(726624),s=O(n(996861)),i=O(n(503664)),c=O(n(464144)),l=O(n(256916)),u=O(n(39717)),d=O(n(253752)),p=O(n(897998)),h=O(n(908003)),f=O(n(326568)),m=O(n(438017)),g=O(n(855240)),y=O(n(45632)),v=O(n(982804)),b=O(n(38138)),x=O(n(487457)),w=O(n(446923)),k=O(n(64679)),_=O(n(713017)),C=O(n(870634));function P(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(P=function(e){return e?n:t})(e)}function O(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=P(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if("default"!==o&&{}.hasOwnProperty.call(e,o)){var s=a?Object.getOwnPropertyDescriptor(e,o):null;s&&(s.get||s.set)?Object.defineProperty(r,o,s):r[o]=e[o]}return r.default=e,n&&n.set(e,r),r}},691966:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.OperationMapper=void 0,t.decodeBase64=I,t.getBoolArrayParam=B,t.getBoolParam=E,t.getDtypeArrayParam=F,t.getDtypeParam=R,t.getFuncParam=D,t.getNumberParam=M,t.getNumericArrayParam=L,t.getStringArrayParam=V,t.getStringParam=S,t.getTensorShapeArrayParam=G,t.getTensorShapeParam=z,t.parseDtypeParam=A,t.parseStringParam=T,t.parseTensorShapeParam=j;var r=n(735534),a=N(n(488665)),o=n(726624),s=n(598453),i=N(n(205015)),c=N(n(125023)),l=N(n(743194)),u=N(n(203166)),d=N(n(109625)),p=N(n(588536)),h=N(n(850989)),f=N(n(356256)),m=N(n(872950)),g=N(n(515166)),y=N(n(947022)),v=N(n(490134)),b=N(n(280066)),x=N(n(71142)),w=N(n(780382)),k=N(n(924554)),_=N(n(272667)),C=N(n(135864)),P=N(n(656500));function O(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(O=function(e){return e?n:t})(e)}function N(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=O(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if("default"!==o&&{}.hasOwnProperty.call(e,o)){var s=a?Object.getOwnPropertyDescriptor(e,o):null;s&&(s.get||s.set)?Object.defineProperty(r,o,s):r[o]=e[o]}return r.default=e,n&&n.set(e,r),r}function I(e){const t=(0,r.env)().global;if(void 0!==t.atob)return t.atob(e);if("undefined"!=typeof Buffer)return new Buffer(e,"base64").toString();throw new Error("Unable to decode base64 in this environment. Missing built-in atob() or Buffer()")}function T(e,t){const n=Array.isArray(e)?String.fromCharCode.apply(null,e):I(e);return t?n:n.toLowerCase()}function S(e,t,n){let r=arguments.length>3&&void 0!==arguments[3]&&arguments[3];const a=e[t];return null!=a?T(a.s,r):n}function E(e,t,n){const r=e[t];return r?r.b:n}function M(e,t,n){const r=e[t]||{},a=null!=r.i?r.i:null!=r.f?r.f:n;return"number"==typeof a?a:parseInt(a,10)}function A(e){switch("string"==typeof e&&(e=a.DataType[e]),e){case a.DataType.DT_FLOAT:case a.DataType.DT_HALF:return"float32";case a.DataType.DT_INT32:case a.DataType.DT_INT64:case a.DataType.DT_INT8:case a.DataType.DT_UINT8:return"int32";case a.DataType.DT_BOOL:return"bool";case a.DataType.DT_DOUBLE:return"float32";case a.DataType.DT_STRING:return"string";default:return null}}function D(e,t,n){const r=e[t];return r&&r.func?r.func.name:n}function R(e,t,n){const r=e[t];return r&&r.type?A(r.type):n}function F(e,t,n){const r=e[t];return r&&r.list&&r.list.type?r.list.type.map((e=>A(e))):n}function j(e){if(!e.unknownRank)return null!=e.dim?e.dim.map((e=>"number"==typeof e.size?e.size:parseInt(e.size,10))):[]}function z(e,t,n){const r=e[t];return r&&r.shape?j(r.shape):n}function L(e,t,n){const r=e[t];return r?((r.list.f&&r.list.f.length?r.list.f:r.list.i)||[]).map((e=>"number"==typeof e?e:parseInt(e,10))):n}
1function V(e,t,n){let r=arguments.length>3&&void 0!==arguments[3]&&arguments[3];const a=e[t];return a&&a.list&&a.list.s?a.list.s.map((e=>T(e,r))):n}function G(e,t,n){const r=e[t];return r&&r.list&&r.list.shape?r.list.shape.map((e=>j(e))):n}function B(e,t,n){const r=e[t];return r&&r.list&&r.list.b?r.list.b:n}t.OperationMapper=class{static get Instance(){return this._instance||(this._instance=new this)}constructor(){const e=[].concat(...[i,c,l,u,d,p,h,f,m,g,y,v,b,x,w,k,_,C,P].map((e=>e.json)));this.opMappers=e.reduce(((e,t)=>(e[t.tfOpName]=t,e)),{})}transformGraph(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const n=e.node,r=[],a=[],o=[],i=n.reduce(((e,t)=>(e[t.name]=this.mapNode(t),t.op.startsWith("Placeholder")?r.push(e[t.name]):"Const"===t.op?a.push(e[t.name]):null!=t.input&&0!==t.input.length||o.push(e[t.name]),e)),{});let c=[];const l=[];let u={},d={};null!=t&&(u=this.mapSignatureEntries(t.inputs),d=this.mapSignatureEntries(t.outputs));const p=Object.keys(i);p.forEach((e=>{const t=i[e];t.inputNames.forEach(((e,n)=>{const[r,,a]=(0,s.getNodeNameAndIndex)(e),o=i[r];if(null!=o.outputs){const e=o.outputs.indexOf(a);if(-1!==e){const a="".concat(r,":").concat(e);t.inputNames[n]=a}}t.inputs.push(o),o.children.push(t)}))})),0===Object.keys(d).length?p.forEach((e=>{const t=i[e];0===t.children.length&&l.push(t)})):Object.keys(d).forEach((e=>{const[t]=(0,s.getNodeNameAndIndex)(e),n=i[t];null!=n&&(n.signatureKey=d[e],l.push(n))})),Object.keys(u).length>0?Object.keys(u).forEach((e=>{const[t]=(0,s.getNodeNameAndIndex)(e),n=i[t];n&&(n.signatureKey=u[e],c.push(n))})):c=r;let h={};null!=e.library&&null!=e.library.function&&(h=e.library.function.reduce(((e,t)=>(e[t.signature.name]=this.mapFunction(t),e)),{}));const f={nodes:i,inputs:c,outputs:l,weights:a,placeholders:r,signature:t,functions:h};return o.length>0&&(f.initNodes=o),f}mapSignatureEntries(e){return Object.keys(e||{}).reduce(((t,n)=>(t[e[n].name]=n,t)),{})}mapNode(e){const t=(0,o.getRegisteredOp)(e.op)||this.opMappers[e.op]||{};null==e.attr&&(e.attr={});const n={name:e.name,op:e.op,category:t.category,inputNames:(e.input||[]).map((e=>e.startsWith("^")?e.substr(1):e)),inputs:[],children:[],inputParams:{},attrParams:{},rawAttrs:e.attr,outputs:t.outputs};return null!=t.inputs&&(n.inputParams=t.inputs.reduce(((e,t)=>(e[t.name]={type:t.type,inputIndexStart:t.start,inputIndexEnd:t.end},e)),{})),null!=t.attrs&&(n.attrParams=t.attrs.reduce(((t,n)=>{const r=n.type;let a;switch(n.type){case"string":a=S(e.attr,n.tfName,n.defaultValue),void 0===a&&n.tfDeprecatedName&&(a=S(e.attr,n.tfDeprecatedName,n.defaultValue));break;case"string[]":a=V(e.attr,n.tfName,n.defaultValue),void 0===a&&n.tfDeprecatedName&&(a=V(e.attr,n.tfDeprecatedName,n.defaultValue));break;case"number":a=M(e.attr,n.tfName,n.defaultValue||0),void 0===a&&n.tfDeprecatedName&&(a=M(e.attr,n.tfDeprecatedName,n.defaultValue));break;case"number[]":a=L(e.attr,n.tfName,n.defaultValue),void 0===a&&n.tfDeprecatedName&&(a=L(e.attr,n.tfDeprecatedName,n.defaultValue));break;case"bool":a=E(e.attr,n.tfName,n.defaultValue),void 0===a&&n.tfDeprecatedName&&(a=E(e.attr,n.tfDeprecatedName,n.defaultValue));break;case"bool[]":a=B(e.attr,n.tfName,n.defaultValue),void 0===a&&n.tfDeprecatedName&&(a=B(e.attr,n.tfDeprecatedName,n.defaultValue));break;case"shape":a=z(e.attr,n.tfName,n.defaultValue),void 0===a&&n.tfDeprecatedName&&(a=z(e.attr,n.tfDeprecatedName,n.defaultValue));break;case"shape[]":a=G(e.attr,n.tfName,n.defaultValue),void 0===a&&n.tfDeprecatedName&&(a=G(e.attr,n.tfDeprecatedName,n.defaultValue));break;case"dtype":a=R(e.attr,n.tfName,n.defaultValue),void 0===a&&n.tfDeprecatedName&&(a=R(e.attr,n.tfDeprecatedName,n.defaultValue));break;case"dtype[]":a=F(e.attr,n.tfName,n.defaultValue),void 0===a&&n.tfDeprecatedName&&(a=F(e.attr,n.tfDeprecatedName,n.defaultValue));break;case"func":a=D(e.attr,n.tfName,n.defaultValue),void 0===a&&n.tfDeprecatedName&&(a=D(e.attr,n.tfDeprecatedName,n.defaultValue));break;case"tensor":case"tensors":break;default:throw new Error("Unsupported param type: ".concat(n.type," for op: ").concat(e.op))}return t[n.name]={value:a,type:r},t}),{})),n}mapFunction(e){const t=e.nodeDef,n=[];let r={};null!=t&&(r=t.reduce(((e,t)=>(e[t.name]=this.mapNode(t),"Const"===t.op&&n.push(e[t.name]),e)),{}));const a=[],o=[];e.signature.inputArg.forEach((e=>{const[t]=(0,s.getNodeNameAndIndex)(e.name),n={name:t,op:"Placeholder",input
1s:[],inputNames:[],category:"graph",inputParams:{},attrParams:{dtype:{value:A(e.type),type:"dtype"}},children:[]};n.signatureKey=e.name,a.push(n),r[t]=n}));Object.keys(r).forEach((e=>{const t=r[e];t.inputNames.forEach(((e,n)=>{const[a,,o]=(0,s.getNodeNameAndIndex)(e),i=r[a];if(null!=i.outputs){const e=i.outputs.indexOf(o);if(-1!==e){const r="".concat(a,":").concat(e);t.inputNames[n]=r}}t.inputs.push(i),i.children.push(t)}))}));const i=e.ret;e.signature.outputArg.forEach((e=>{const[t,n]=(0,s.getNodeNameAndIndex)(i[e.name]),a=r[t];null!=a&&(a.defaultOutput=n,o.push(a))}));const c=this.mapArgsToSignature(e);return{nodes:r,inputs:a,outputs:o,weights:n,placeholders:[],signature:c}}mapArgsToSignature(e){return{methodName:e.signature.name,inputs:e.signature.inputArg.reduce(((e,t)=>(e[t.name]=this.mapArgToTensorInfo(t),e)),{}),outputs:e.signature.outputArg.reduce(((t,n)=>(t[n.name]=this.mapArgToTensorInfo(n,e.ret),t)),{})}}mapArgToTensorInfo(e,t){let n=e.name;return null!=t&&(n=t[n]),{name:n,dtype:e.type}}}},23237:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.version=void 0;t.version="3.14.0"},47754:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.KernelBackend=t.EPSILON_FLOAT32=t.EPSILON_FLOAT16=t.DataStorage=void 0;const n=t.EPSILON_FLOAT32=1e-7,r=t.EPSILON_FLOAT16=1e-4;t.DataStorage=class{constructor(e,t){this.backend=e,this.dataMover=t,this.data=new WeakMap,this.dataIdsCount=0}get(e){return this.data.has(e)||this.dataMover.moveData(this.backend,e),this.data.get(e)}set(e,t){this.dataIdsCount++,this.data.set(e,t)}has(e){return this.data.has(e)}delete(e){return this.dataIdsCount--,this.data.delete(e)}numDataIds(){return this.dataIdsCount}};function a(e){throw new Error("'".concat(e,"' not yet implemented or not found in the registry. ")+"This kernel may not be supported by the tfjs backend you have chosen")}t.KernelBackend=class{refCount(e){return a("refCount")}incRef(e){return a("incRef")}timerAvailable(){return!0}time(e){return a("time")}read(e){return a("read")}readSync(e){return a("readSync")}readToGPU(e,t){return a("readToGPU")}numDataIds(){return a("numDataIds")}disposeData(e,t){return a("disposeData")}write(e,t,n){return a("write")}move(e,t,n,r,o){return a("move")}memory(){return a("memory")}floatPrecision(){return a("floatPrecision")}epsilon(){return 32===this.floatPrecision()?n:r}dispose(){return a("dispose")}}},186443:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r={fromUint8ToStringArray:!0,fromStringArrayToUint8:!0,slice_util:!0,upcastType:!0,segment_util:!0};t.fromStringArrayToUint8=function(e){return e.map((e=>(0,a.encodeString)(e)))},t.fromUint8ToStringArray=function(e){try{return e.map((e=>(0,a.decodeString)(e)))}catch(e){throw new Error("Failed to decode encoded string bytes into utf-8, error: ".concat(e))}},t.slice_util=t.segment_util=void 0,Object.defineProperty(t,"upcastType",{enumerable:!0,get:function(){return p.upcastType}});var a=n(904737),o=n(247731);Object.keys(o).forEach((function(e){"default"!==e&&"__esModule"!==e&&(Object.prototype.hasOwnProperty.call(r,e)||e in t&&t[e]===o[e]||Object.defineProperty(t,e,{enumerable:!0,get:function(){return o[e]}}))}));var s=n(534779);Object.keys(s).forEach((function(e){"default"!==e&&"__esModule"!==e&&(Object.prototype.hasOwnProperty.call(r,e)||e in t&&t[e]===s[e]||Object.defineProperty(t,e,{enumerable:!0,get:function(){return s[e]}}))}));var i=n(534290);
1Object.keys(i).forEach((function(e){"default"!==e&&"__esModule"!==e&&(Object.prototype.hasOwnProperty.call(r,e)||e in t&&t[e]===i[e]||Object.defineProperty(t,e,{enumerable:!0,get:function(){return i[e]}}))}));var c=n(812682);Object.keys(c).forEach((function(e){"default"!==e&&"__esModule"!==e&&(Object.prototype.hasOwnProperty.call(r,e)||e in t&&t[e]===c[e]||Object.defineProperty(t,e,{enumerable:!0,get:function(){return c[e]}}))}));var l=n(842772);Object.keys(l).forEach((function(e){"default"!==e&&"__esModule"!==e&&(Object.prototype.hasOwnProperty.call(r,e)||e in t&&t[e]===l[e]||Object.defineProperty(t,e,{enumerable:!0,get:function(){return l[e]}}))}));var u=n(44285);Object.keys(u).forEach((function(e){"default"!==e&&"__esModule"!==e&&(Object.prototype.hasOwnProperty.call(r,e)||e in t&&t[e]===u[e]||Object.defineProperty(t,e,{enumerable:!0,get:function(){return u[e]}}))}));var d=I(n(328113));t.slice_util=d;var p=n(649781),h=n(652250);Object.keys(h).forEach((function(e){"default"!==e&&"__esModule"!==e&&(Object.prototype.hasOwnProperty.call(r,e)||e in t&&t[e]===h[e]||Object.defineProperty(t,e,{enumerable:!0,get:function(){return h[e]}}))}));var f=n(739042);Object.keys(f).forEach((function(e){"default"!==e&&"__esModule"!==e&&(Object.prototype.hasOwnProperty.call(r,e)||e in t&&t[e]===f[e]||Object.defineProperty(t,e,{enumerable:!0,get:function(){return f[e]}}))}));var m=n(207837);Object.keys(m).forEach((function(e){"default"!==e&&"__esModule"!==e&&(Object.prototype.hasOwnProperty.call(r,e)||e in t&&t[e]===m[e]||Object.defineProperty(t,e,{enumerable:!0,get:function(){return m[e]}}))}));var g=n(426955);Object.keys(g).forEach((function(e){"default"!==e&&"__esModule"!==e&&(Object.prototype.hasOwnProperty.call(r,e)||e in t&&t[e]===g[e]||Object.defineProperty(t,e,{enumerable:!0,get:function(){return g[e]}}))}));var y=n(755469);Object.keys(y).forEach((function(e){"default"!==e&&"__esModule"!==e&&(Object.prototype.hasOwnProperty.call(r,e)||e in t&&t[e]===y[e]||Object.defineProperty(t,e,{enumerable:!0,get:function(){return y[e]}}))}));var v=n(372582);Object.keys(v).forEach((function(e){"default"!==e&&"__esModule"!==e&&(Object.prototype.hasOwnProperty.call(r,e)||e in t&&t[e]===v[e]||Object.defineProperty(t,e,{enumerable:!0,get:function(){return v[e]}}))}));var b=n(414429);Object.keys(b).forEach((function(e){"default"!==e&&"__esModule"!==e&&(Object.prototype.hasOwnProperty.call(r,e)||e in t&&t[e]===b[e]||Object.defineProperty(t,e,{enumerable:!0,get:function(){return b[e]}}))}));var x=n(916283);Object.keys(x).forEach((function(e){"default"!==e&&"__esModule"!==e&&(Object.prototype.hasOwnProperty.call(r,e)||e in t&&t[e]===x[e]||Object.defineProperty(t,e,{enumerable:!0,get:function(){return x[e]}}))}));var w=n(920887);
1Object.keys(w).forEach((function(e){"default"!==e&&"__esModule"!==e&&(Object.prototype.hasOwnProperty.call(r,e)||e in t&&t[e]===w[e]||Object.defineProperty(t,e,{enumerable:!0,get:function(){return w[e]}}))}));var k=n(746225);Object.keys(k).forEach((function(e){"default"!==e&&"__esModule"!==e&&(Object.prototype.hasOwnProperty.call(r,e)||e in t&&t[e]===k[e]||Object.defineProperty(t,e,{enumerable:!0,get:function(){return k[e]}}))}));var _=n(8263);Object.keys(_).forEach((function(e){"default"!==e&&"__esModule"!==e&&(Object.prototype.hasOwnProperty.call(r,e)||e in t&&t[e]===_[e]||Object.defineProperty(t,e,{enumerable:!0,get:function(){return _[e]}}))}));var C=n(965209);Object.keys(C).forEach((function(e){"default"!==e&&"__esModule"!==e&&(Object.prototype.hasOwnProperty.call(r,e)||e in t&&t[e]===C[e]||Object.defineProperty(t,e,{enumerable:!0,get:function(){return C[e]}}))}));var P=n(206762);Object.keys(P).forEach((function(e){"default"!==e&&"__esModule"!==e&&(Object.prototype.hasOwnProperty.call(r,e)||e in t&&t[e]===P[e]||Object.defineProperty(t,e,{enumerable:!0,get:function(){return P[e]}}))}));var O=I(n(23526));function N(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(N=function(e){return e?n:t})(e)}function I(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=N(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if("default"!==o&&{}.hasOwnProperty.call(e,o)){var s=a?Object.getOwnPropertyDescriptor(e,o):null;s&&(s.get||s.set)?Object.defineProperty(r,o,s):r[o]=e[o]}return r.default=e,n&&n.set(e,r),r}t.segment_util=O},916283:(e,t)=>
1{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.assignToTypedArray=function(e,t,n,r){e[2*r]=t,e[2*r+1]=n},t.complexWithEvenIndex=function(e){const t=Math.ceil(e.length/4),n=new Float32Array(t),r=new Float32Array(t);for(let t=0;t<e.length;t+=4)n[Math.floor(t/4)]=e[t],r[Math.floor(t/4)]=e[t+1];return{real:n,imag:r}},t.complexWithOddIndex=function(e){const t=Math.floor(e.length/4),n=new Float32Array(t),r=new Float32Array(t);for(let t=2;t<e.length;t+=4)n[Math.floor(t/4)]=e[t],r[Math.floor(t/4)]=e[t+1];return{real:n,imag:r}},t.exponent=function(e,t,n){const r=(n?2:-2)*Math.PI*(e/t),a=Math.cos(r),o=Math.sin(r);return{real:a,imag:o}},t.exponents=function(e,t){const n=new Float32Array(e/2),r=new Float32Array(e/2);for(let a=0;a<Math.ceil(e/2);a++){const o=(t?2:-2)*Math.PI*(a/e);n[a]=Math.cos(o),r[a]=Math.sin(o)}return{real:n,imag:r}},t.getComplexWithIndex=function(e,t){const n=e[2*t],r=e[2*t+1];return{real:n,imag:r}},t.mergeRealAndImagArrays=function(e,t){if(e.length!==t.length)throw new Error("Cannot merge real and imag arrays of different lengths. real:"+"".concat(e.length,", imag: ").concat(t.length,"."));const n=new Float32Array(2*e.length);for(let r=0;r<n.length;r+=2)n[r]=e[r/2],n[r+1]=t[r/2];return n},t.splitRealAndImagArrays=function(e){const t=new Float32Array(e.length/2),n=new Float32Array(e.length/2);for(let r=0;r<e.length;r+=2)t[r/2]=e[r],n[r/2]=e[r+1];return{real:t,imag:n}}},920887:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.checkEinsumDimSizes=function(e,t,n){const a=new Array(e);for(let e=0;e<n.length;++e){const o=n[e].shape;for(let n=0;n<t[e].length;++n)void 0===a[t[e][n]]?a[t[e][n]]=o[n]:(0,r.assert)(a[t[e][n]]===o[n],(()=>"Expected dimension ".concat(a[t[e][n]]," at axis ").concat(n," ")+"of input shaped ".concat(JSON.stringify(o),", ")+"but got dimension ".concat(o[n])))}},t.decodeEinsumEquation=function(e,t){const n=((e=e.replace(/\s/g,"")).length-e.replace(o,"").length)/a.length;if(n<1)throw new Error("Equations without an arrow are not supported.");if(n>1)throw new Error('Equation must contain exactly one arrow ("'.concat(a,'").'));const[c,l]=e.split(a);(0,r.assert)(-1===c.indexOf(i),(()=>'The ellipsis notation ("'.concat(i,'") is not supported yet.')));const u=c.split(s),d=u.length;if(t!==d)throw new Error("Expected ".concat(d," input tensors, received ").concat(t));if(d>2)throw new Error("Support for more than 2 input tensors is not implemented yet.");const p=[];for(let e=0;e<l.length;++e){const t=l[e];if(!u.some((e=>-1!==e.indexOf(t))))throw new Error("Output subscripts contain the label ".concat(t," ")+"not present in the input subscripts.");-1===p.indexOf(t)&&p.push(t)}for(let e=0;e<c.length;++e){const t=c[e];-1===p.indexOf(t)&&t!==s&&p.push(t)}const h=new Array(u.length);for(let e=0;e<d;++e){if(new Set(u[e].split("")).size!==u[e].length)throw new Error("Found duplicate axes in input component ".concat(u[e],". ")+"Support for duplicate axes in input is not implemented yet.");h[e]=[];for(let t=0;t<u[e].length;++t)h[e].push(p.indexOf(u[e][t]))}const f=p.length,m=l.length,g=[];for(let e=m;e<f;++e)g.push(e);return{allDims:p,summedDims:g,idDims:h}},t.getEinsumComputePath=function(e,t){const n=e,r=[];let a=0;0===e.length&&n.push(-1);a=e.length+1;for(let e=0;e<a;++e)r.push([]);const o=[];for(let e=0;e<n.length;++e){const a=c(t,n[e]);for(const t of a)-1===o.indexOf(t)&&(r[e].push(t),o.push(t))}return{path:n,steps:r}},t.getEinsumPermutation=function(e,t){let n=new Array(e);n.fill(-1);for(let e=0;e<t.length;++e)n[t[e]]=e;const r=[];for(let t=0;t<e;++t)-1===n[t]&&r.push(t);return n=n.filter((e=>-1!==e)),{permutationIndices:n,expandDims:r}},t.isIdentityPermutation=function(e){return e.every(((e,t)=>e===t))};var r=n(542393);const a="->",o=/->/g,s=",",i="...";function c(e,t){const n=[];for(let r=0;r<e.length;++r)0!==e[r].length&&-1===e[r].indexOf(t)&&-1!==t||n.push(r);return n}},557771:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"nonMaxSuppressionV3Impl",{enumerable:!0,get:function(){return r.nonMaxSuppressionV3Impl}}),Object.defineProperty(t,"nonMaxSuppressionV4Impl",{enumerable:!0,get:function(){return r.nonMaxSuppressionV4Impl}}),Object.defineProperty(t,"nonMaxSuppressionV5Impl",{enumerable:!0,get:function(){return r.nonMaxSuppressionV5Impl}}),Object.defineProperty(t,"whereImpl",{enumerable:!0,get:function(){return a.whereImpl}});var r=n(570968),a=n(6764)},570968:(e,t,n)=>{"use strict";
1Object.defineProperty(t,"__esModule",{value:!0}),t.nonMaxSuppressionV3Impl=function(e,t,n,r,o){return a(e,t,n,r,o,0)},t.nonMaxSuppressionV4Impl=function(e,t,n,r,o,s){return a(e,t,n,r,o,0,!1,s,!0)},t.nonMaxSuppressionV5Impl=function(e,t,n,r,o,s){return a(e,t,n,r,o,s,!0)};var r=n(619624);function a(e,t,n,a,c,l){let u=arguments.length>6&&void 0!==arguments[6]&&arguments[6],d=arguments.length>7&&void 0!==arguments[7]&&arguments[7],p=arguments.length>8&&void 0!==arguments[8]&&arguments[8];const h=[];for(let e=0;e<t.length;e++)t[e]>c&&h.push({score:t[e],boxIndex:e,suppressBeginIndex:0});h.sort(i);const f=l>0?-.5/l:0,m=[],g=[];for(;m.length<n&&h.length>0;){const t=h.pop(),{score:n,boxIndex:l,suppressBeginIndex:u}=t;if(n<c)break;let d=!1;for(let n=m.length-1;n>=u;--n){const r=o(e,l,m[n]);if(r>=a){d=!0;break}if(t.score=t.score*s(a,f,r),t.score<=c)break}t.suppressBeginIndex=m.length,d||(t.score===n?(m.push(l),g.push(t.score)):t.score>c&&(0,r.binaryInsert)(h,t,i))}const y=m.length,v=n-y;d&&v>0&&(m.push(...new Array(v).fill(0)),g.push(...new Array(v).fill(0)));const b={selectedIndices:m};return u&&(b.selectedScores=g),p&&(b.validOutputs=y),b}function o(e,t,n){const r=e.subarray(4*t,4*t+4),a=e.subarray(4*n,4*n+4),o=Math.min(r[0],r[2]),s=Math.min(r[1],r[3]),i=Math.max(r[0],r[2]),c=Math.max(r[1],r[3]),l=Math.min(a[0],a[2]),u=Math.min(a[1],a[3]),d=Math.max(a[0],a[2]),p=Math.max(a[1],a[3]),h=(i-o)*(c-s),f=(d-l)*(p-u);if(h<=0||f<=0)return 0;const m=Math.max(o,l),g=Math.max(s,u),y=Math.min(i,d),v=Math.min(c,p),b=Math.max(y-m,0)*Math.max(v-g,0);return b/(h+f-b)}function s(e,t,n){const r=Math.exp(t*n*n);return n<=e?r:0}function i(e,t){return e.score-t.score||e.score===t.score&&t.boxIndex-e.boxIndex}},619624:(e,t)=>{"use strict";function n(e,t,n){return function(e,t,n){let r=0,a=e.length,o=0,s=!1;for(;r<a;){o=r+(a-r>>>1);const i=n(t,e[o]);i>0?r=o+1:(a=o,s=!i)}return s?r:-r-1}(e,t,n||r)}function r(e,t){return e>t?1:e<t?-1:0}Object.defineProperty(t,"__esModule",{value:!0}),t.binaryInsert=function(e,t,r){const a=n(e,t,r),o=a<0?-(a+1):a;e.splice(o,0,t)},t.binarySearch=n},6764:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.whereImpl=function(e,t){const n=[];for(let e=0;e<t.length;e++)t[e]&&n.push(e);const a=(0,r.buffer)(e,"int32"),o=(0,r.buffer)([n.length,e.length],"int32");for(let t=0;t<n.length;t++){const r=a.indexToLoc(n[t]),s=t*e.length;o.values.set(r,s)}return o.toTensor()};var r=n(60249)},928608:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r={io:!0,math:!0,broadcast_util:!0,browser:!0,gather_util:!0,scatter_util:!0,slice_util:!0,serialization:!0,tensor_util:!0,test_util:!0,util:!0,version_core:!0,AdadeltaOptimizer:!0,AdagradOptimizer:!0,AdamOptimizer:!0,AdamaxOptimizer:!0,MomentumOptimizer:!0,Optimizer:!0,OptimizerConstructors:!0,RMSPropOptimizer:!0,SGDOptimizer:!0,Tensor:!0,TensorBuffer:!0,Variable:!0,Rank:!0,sumOutType:!0,upcastType:!0,Reduction:!0,customGrad:!0,grad:!0,grads:!0,valueAndGrad:!0,valueAndGrads:!0,variableGrads:!0,Environment:!0,env:!0,ENV:!0,nextFrame:!0,backend_util:!0,device_util:!0,kernel_impls:!0,KernelBackend:!0,DataStorage:!0};Object.defineProperty(t,"AdadeltaOptimizer",{enumerable:!0,get:function(){return g.AdadeltaOptimizer}}),Object.defineProperty(t,"AdagradOptimizer",{enumerable:!0,get:function(){return y.AdagradOptimizer}}),Object.defineProperty(t,"AdamOptimizer",{enumerable:!0,get:function(){return v.AdamOptimizer}}),Object.defineProperty(t,"AdamaxOptimizer",{enumerable:!0,get:function(){return b.AdamaxOptimizer}}),Object.defineProperty(t,"DataStorage",{enumerable:!0,get:function(){return z.DataStorage}}),Object.defineProperty(t,"ENV",{enumerable:!0,get:function(){return A.ENV}}),Object.defineProperty(t,"Environment",{enumerable:!0,get:function(){return A.Environment}}),Object.defineProperty(t,"KernelBackend",{enumerable:!0,get:function(){return z.KernelBackend}}),Object.defineProperty(t,"MomentumOptimizer",{enumerable:!0,get:function(){return x.MomentumOptimizer}}),Object.defineProperty(t,"Optimizer",{enumerable:!0,get:function(){return w.Optimizer}}),Object.defineProperty(t,"OptimizerConstructors",{enumerable:!0,get:function(){return k.OptimizerConstructors}}),Object.defineProperty(t,"RMSPropOptimizer",{enumerable:!0,get:function(){return _.RMSPropOptimizer}}),Object.defineProperty(t,"Rank",{enumerable:!0,get:function(){return O.Rank}}),Object.defineProperty(t,"Reduction",{enumerable:!0,get:function(){return I.Reduction}}),Object.defineProperty(t,"SGDOptimizer",{enumerable:!0,get:function(){return C.SGDOptimizer}}),Object.defineProperty(t,"Tensor",{enumerable:!0,get:function(){return P.Tensor}}),Object.defineProperty(t,"TensorBuffer",{enumerable:!0,get:function(){return P.TensorBuffer}}),Object.defineProperty(t,"Variable",{enumerable:!0,get:function(){return P.Variable}}),t.browser=t.broadcast_util=t.backend_util=void 0,Object.defineProperty(t,"customGrad",{enumerable:!0,get:function(){return M.customGrad}}),t.device_util=void 0,Object.defineProperty(t,"env",{enumerable:!0,get:function(){return A.env}}),t.gather_util=void 0,Object.defineProperty(t,"grad",{enumerable:!0,get:function(){return M.grad}}),Object.defineProperty(t,"grads",{enumerable:!0,get:function(){return M.grads}}),t.math=t.kernel_impls=t.io=void 0,Object.defineProperty(t,"nextFrame",{enumerable:!0,get:function(){return D.nextFrame}}),t.slice_util=t.serialization=t.scatter_util=void 0,Object.defineProperty(t,"sumOutType",{enumerable:!0,get:function(){return O.sumOutType}}),t.test_util=t.tensor_util=void 0,Object.defineProperty(t,"upcastType",{enumerable:!0,get:function(){return O.upcastType}}),t.util=void 0,Object.defineProperty(t,"valueAndGrad",{enumerable:!0,get:function(){return M.valueAndGrad}}),Object.defineProperty(t,"valueAndGrads",{enumerable:!0,get:function(){return M.valueAndGrads}}),Object.defineProperty(t,"variableGrads",{enumerable:!0,get:function(){return M.variableGrads}}),Object.defineProperty(t,"version_core",{enumerable:!0,get:function(){return m.version}});var a=G(n(393449));t.io=a;var o=G(n(853744));t.math=o;var s=G(n(534779));t.broadcast_util=s;var i=G(n(779212));t.browser=i;var c=G(n(207837));t.gather_util=c;var l=G(n(426955));t.scatter_util=l;var u=G(n(328113));t.slice_util=u;var d=G(n(39037));t.serialization=d;var p=G(n(390771));t.tensor_util=p;var h=G(n(248849));t.test_util=h;var f=G(n(904737));t.util=f;var m=n(102691),g=n(538885),y=n(499678),v=n(947007),b=n(119673),x=n(81424),w=n(524823),k=n(472732),_=n(452951),C=n(475231),P=n(659795),O=n(649781),N=n(899090);
1Object.keys(N).forEach((function(e){"default"!==e&&"__esModule"!==e&&(Object.prototype.hasOwnProperty.call(r,e)||e in t&&t[e]===N[e]||Object.defineProperty(t,e,{enumerable:!0,get:function(){return N[e]}}))}));var I=n(264907),T=n(70343);Object.keys(T).forEach((function(e){"default"!==e&&"__esModule"!==e&&(Object.prototype.hasOwnProperty.call(r,e)||e in t&&t[e]===T[e]||Object.defineProperty(t,e,{enumerable:!0,get:function(){return T[e]}}))}));var S=n(271725);Object.keys(S).forEach((function(e){"default"!==e&&"__esModule"!==e&&(Object.prototype.hasOwnProperty.call(r,e)||e in t&&t[e]===S[e]||Object.defineProperty(t,e,{enumerable:!0,get:function(){return S[e]}}))}));var E=n(115354);Object.keys(E).forEach((function(e){"default"!==e&&"__esModule"!==e&&(Object.prototype.hasOwnProperty.call(r,e)||e in t&&t[e]===E[e]||Object.defineProperty(t,e,{enumerable:!0,get:function(){return E[e]}}))}));var M=n(931564),A=n(598257),D=n(181912),R=G(n(186443));t.backend_util=R;var F=G(n(160864));t.device_util=F;var j=G(n(557771));t.kernel_impls=j;var z=n(47754),L=n(536217);function V(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(V=function(e){return e?n:t})(e)}function G(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=V(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if("default"!==o&&{}.hasOwnProperty.call(e,o)){var s=a?Object.getOwnPropertyDescriptor(e,o):null;s&&(s.get||s.set)?Object.defineProperty(r,o,s):r[o]=e[o]}return r.default=e,n&&n.set(e,r),r}Object.keys(L).forEach((function(e){"default"!==e&&"__esModule"!==e&&(Object.prototype.hasOwnProperty.call(r,e)||e in t&&t[e]===L[e]||Object.defineProperty(t,e,{enumerable:!0,get:function(){return L[e]}}))}))},150889:(e,t,n)=>{"use strict";var r=n(90337);n(19445),n(353398),n(799219);var a=n(60249),o=n(386565),s=n(971976),i=n(275438),c=n(659795);(0,r.getOrMakeEngine)();const l={buffer:a.buffer,cast:o.cast,clone:s.clone,print:i.print};(0,c.setOpHandler)(l)},181912:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.nextFrame=function(){return new Promise((e=>n((()=>e()))))};const n="undefined"!=typeof requestAnimationFrame?requestAnimationFrame:"undefined"!=typeof setImmediate?setImmediate:e=>e()},160864:(e,t)=>{"use strict";let n;Object.defineProperty(t,"__esModule",{value:!0}),t.isBrowser=function(){return"undefined"!=typeof window&&null!=window.document||"undefined"!=typeof WorkerGlobalScope},t.isMobile=function(e){if(void 0!==n)return n;if(e||"undefined"!=typeof navigator&&null!=navigator){if(e||(e=navigator),"ReactNative"===e.product)return!0;const t=e.userAgent||e.vendor||("undefined"!=typeof window?window.opera:"");if(!t){const t=e;return t.userAgentData&&t.userAgentData.mobile}return/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(t)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|
1sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(t.substr(0,4))}return!1},t.mockIsMobile=function(e){n=e}},90337:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Engine=t.ENGINE=void 0,t.add=k,t.getOrMakeEngine=x;var r=n(47754),a=n(598257),o=n(923788),s=n(536217),i=n(115354),c=g(n(414429)),l=n(262886),u=n(397669),d=n(659795),p=n(390771),h=g(n(904737)),f=h;function m(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(m=function(e){return e?n:t})(e)}function g(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=m(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if("default"!==o&&{}.hasOwnProperty.call(e,o)){var s=a?Object.getOwnPropertyDescriptor(e,o):null;s&&(s.get||s.set)?Object.defineProperty(r,o,s):r[o]=e[o]}return r.default=e,n&&n.set(e,r),r}function y(e){return null!=e.kernelName}class v{constructor(){this.registeredVariables={},this.nextTapeNodeId=0,this.numBytes=0,this.numTensors=0,this.numStringTensors=0,this.numDataBuffers=0,this.gradientDepth=0,this.kernelDepth=0,this.scopeStack=[],this.numDataMovesStack=[],this.nextScopeId=0,this.tensorInfo=new WeakMap,this.profiling=!1,this.activeProfile={newBytes:0,newTensors:0,peakBytes:0,kernels:[],result:null,get kernelNames(){return Array.from(new Set(this.kernels.map((e=>e.name))))}}}dispose(){for(const e in this.registeredVariables)this.registeredVariables[e].dispose()}}class b{constructor(e){this.ENV=e,this.registry={},this.registryFactory={},this.pendingBackendInitId=0,this.state=new v}async ready(){if(null!=this.pendingBackendInit)return this.pendingBackendInit.then((()=>{}));if(null!=this.backendInstance)return;const e=this.getSortedBackends();for(let t=0;t<e.length;t++){const n=e[t];if(await this.initializeBackend(n).success)return void await this.setBackend(n)}throw new Error("Could not initialize any backends, all backend initializations failed.")}get backend(){if(null!=this.pendingBackendInit)throw new Error("Backend '".concat(this.backendName,"' has not yet been initialized. Make ")+"sure to await tf.ready() or await tf.setBackend() before calling other methods");if(null==this.backendInstance){const{name:e,asyncInit:t}=this.initializeBackendsAndReturnBest();if(t)throw new Error("The highest priority backend '".concat(e,"' has not yet been ")+"initialized. Make sure to await tf.ready() or await tf.setBackend() before calling other methods");this.setBackend(e)}return this.backendInstance}backendNames(){return Object.keys(this.registryFactory)}findBackend(e){if(!(e in this.registry)){if(!(e in this.registryFactory))return null;{const{asyncInit:t}=this.initializeBackend(e);if(t)return null}}return this.registry[e]}findBackendFactory(e){return e in this.registryFactory?this.registryFactory[e].factory:null}registerBackend(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;return e in this.registryFactory?(c.warn("".concat(e," backend was already registered. ")+"Reusing existing backend factory."),!1):(this.registryFactory[e]={factory:t,priority:n},!0)}async setBackend(e){if(null==this.registryFactory[e])throw new Error("Backend name '".concat(e,"' not found in registry"));if(this.backendName=e,null==this.registry[e]){this.backendInstance=null;const{success:t,asyncInit:n}=this.initializeBackend(e);if(!(n?await t:t))return!1}return this.backendInstance=this.registry[e],this.setupRegisteredKernels(),this.profiler=new l.Profiler(this.backendInstance),!0}setupRegisteredKernels(){(0,i.getKernelsForBackend)(this.backendName).forEach((e=>{null!=e.setupFunc&&e.setupFunc(this.backendInstance)}))}disposeRegisteredKernels(e){(0,i.getKernelsForBackend)(e).forEach((t=>{null!=t.disposeFunc&&t.disposeFunc(this.registry[e])}))}initializeBackend(e){const t=this.registryFactory[e];if(null==t)throw new Error("Cannot initialize backend ".concat(e,", no registration found."));try{const n=t.factory();if(!n||n instanceof r.KernelBackend||"function"!=typeof n.then)return this.registry[e]=n,{success:!0,asyncInit:!1};{const t=++this.pendingBackendInitId,r=n.then((n=>!(t<this.pendingBackendInitId)&&(this.registry[e]=n,this.pendingBackendInit=null,!0))).catch((n=>(t<this.pendingBackendInitId||(this.pendingBackendInit=null,c.warn("Initialization of backend ".concat(e," failed")),c.warn(n.stack||n.message)),!1)));return this.pendingBackendInit=r,{success:r,asyncInit:!0}}}catch(t){return c.warn("Initialization of backend ".concat(e," failed")),c.warn(t.stack||t.message),{success:!1,asyncInit:!1}}}removeBackend(e){if(!(e in this.registryFactory))throw new Error("".concat(e," backend not found in registry"));this.backendName===e&&null!=this.pendingBackendInit&&this.pendingBackendInitId++,e in this.registry&&(this.disposeRegisteredKernels(e),this.registry[e].dispose(),delete this.registry[e]),delete this.registryFactory[e],this.backendName===e&&(this.pendingBackendInit=null,this.backendName=null,this.backendInstance=null)}getSortedBackends(){if(0===Object.keys(this.registryFactory).length)throw new Error("No backend found in registry.");return Object.keys(this.registryFactory).sort(((e,t)=>this.registryFactory[t].priority-this.registryFactory[e].priority))}initializeBackendsAndReturnBest(){const e=this.getSortedBackends();for(let t=0;t<e.length;t++){const n=e[t],{success:r,asyncInit:a}=this.initializeBackend(n);if(a||r)return{name:n,asyncInit:a}}throw new Error("Could not initialize any backends, all backend initializations failed.")}moveData(e,t){const n=this.state.tensorInfo.get(t),r=n.backend,a=this.readSync(t),o=r.refCount(t);r.disposeData(t,!0),n.backend=e,e.move(t,a,n.shape,n.dtype,o),this.shouldCheckForMemLeaks()&&this.state.numDataMovesStack[this.state.numDataMovesStack.length-1]++}tidy(e,t){let n,r=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");r=e}return this.scopedRun((()=>this.startScope(r)),(()=>this.endScope(n)),(()=>(n=t(),n instanceof Promise&&console.error("Cannot return a Promise inside of tidy."),n)))}scopedRun(e,t,n){e();try{const e=n();return t(),e}catch(e){throw t(),e}}nextTensorId(){return b.nextTensorId++}nextVariableId(){return b.nextVariableId++}clone(e){const t=w.runKernel(s.Identity,{x:e}),n={x:e};return this.addTapeNode(this.state.activeScope.name,n,[t],(e=>({x:()=>{const t={x:e},n={dtype:"float32"};return w.runKernel(s.Cast,t,n)}})),[],{}),t}runKernel(e,t,n){null==this.backendName&&this.backend;if(!(null!=(0,i.getKernel)(e,this.backendName)))throw new Error("Kernel '".concat(e,"' not registered for backend '").concat(this.backendName,"'"));return this.runKernelFunc({kernelName:e,inputs:t,attrs:n})}
1shouldCheckForMemLeaks(){return this.ENV.getBool("IS_TEST")}checkKernelForMemLeak(e,t,n){const r=this.backend.numDataIds();let a=0;n.forEach((e=>{a+="complex64"===e.dtype?3:1}));const o=this.state.numDataMovesStack[this.state.numDataMovesStack.length-1],s=r-t-a-o;if(s>0)throw new Error("Backend '".concat(this.backendName,"' has an internal memory leak ")+"(".concat(s," data ids) after running '").concat(e,"'"))}runKernelFunc(e){let t,n=[];const r=this.isTapeOn(),a=this.state.numBytes,o=this.state.numTensors;let s,c;this.shouldCheckForMemLeaks()&&this.state.numDataMovesStack.push(0),null==this.backendName&&this.backend;const l=y(e)?e.kernelName:null!=this.state.activeScope?this.state.activeScope.name:"";if(y(e)){const{kernelName:t,inputs:a,attrs:o}=e;null==this.backendName&&this.backend;const l=(0,i.getKernel)(t,this.backendName);f.assert(null!=l,(()=>"Cannot find registered kernel '".concat(t,"' for backend '").concat(this.backendName,"'"))),s=()=>{const e=this.backend.numDataIds();c=l.kernelFunc({inputs:a,attrs:o,backend:this.backend});const s=Array.isArray(c)?c:[c];this.shouldCheckForMemLeaks()&&this.checkKernelForMemLeak(t,e,s);const i=s.map((e=>{if(null!=e.rank)return e;const{dataId:t,shape:n,dtype:r}=e;return this.makeTensorFromDataId(t,n,r)}));if(r){const e=this.getTensorsForGradient(t,a,i);n=this.saveTensorsForBackwardMode(e)}return i}}else{const{forwardFunc:t}=e,a=e=>{r&&(n=e.map((e=>this.keep(this.clone(e)))))};s=()=>{const e=this.backend.numDataIds();c=this.tidy((()=>t(this.backend,a)));const n=Array.isArray(c)?c:[c];return this.shouldCheckForMemLeaks()&&this.checkKernelForMemLeak(l,e,n),n}}const{inputs:u,attrs:d}=e,p=y(e)?null:e.backwardsFunc;let h;return this.scopedRun((()=>this.state.kernelDepth++),(()=>this.state.kernelDepth--),(()=>{this.ENV.getBool("DEBUG")||this.state.profiling?(h=this.profiler.profileKernel(l,u,(()=>s())),this.ENV.getBool("DEBUG")&&this.profiler.logKernelProfile(h),t=h.outputs):t=s()})),r&&this.addTapeNode(l,u,t,p,n,d),this.state.profiling&&this.state.activeProfile.kernels.push({name:l,bytesAdded:this.state.numBytes-a,totalBytesSnapshot:this.state.numBytes,tensorsAdded:this.state.numTensors-o,totalTensorsSnapshot:this.state.numTensors,inputShapes:Object.keys(u).map((e=>null!=u[e]?u[e].shape:null)),outputShapes:t.map((e=>e.shape)),kernelTimeMs:h.timeMs,extraInfo:h.extraInfo}),Array.isArray(c)?t:t[0]}saveTensorsForBackwardMode(e){return e.map((e=>this.keep(this.clone(e))))}getTensorsForGradient(e,t,n){const r=(0,i.getGradient)(e);if(null!=r){const e=r.inputsToSave||[],a=r.outputsToSave||[];let o;r.saveAllInputs?(f.assert(Array.isArray(t),(()=>"saveAllInputs is true, expected inputs to be an array.")),o=Object.keys(t).map((e=>t[e]))):o=e.map((e=>t[e]));const s=n.filter(((e,t)=>a[t]));return o.concat(s)}return[]}makeTensor(e,t,n,r){if(null==e)throw new Error("Values passed to engine.makeTensor() are null");n=n||"float32",r=r||this.backend;let a=e;"string"===n&&f.isString(e[0])&&(a=e.map((e=>f.encodeString(e))));const o=r.write(a,t,n),s=new d.Tensor(t,n,o,this.nextTensorId());if(this.trackTensor(s,r),"string"===n){const e=this.state.tensorInfo.get(o),t=(0,h.bytesFromStringArray)(a);this.state.numBytes+=t-e.bytes,e.bytes=t}return s}makeTensorFromDataId(e,t,n,r){n=n||"float32";const a=new d.Tensor(t,n,e,this.nextTensorId());return this.trackTensor(a,r),a}makeVariable(e){let t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n=arguments.length>2?arguments[2]:void 0,r=arguments.length>3?arguments[3]:void 0;n=n||this.nextVariableId().toString(),null!=r&&r!==e.dtype&&(e=e.cast(r));const a=new d.Variable(e,t,n,this.nextTensorId());if(null!=this.state.registeredVariables[a.name])throw new Error("Variable with name ".concat(a.name," was already registered"));return this.state.registeredVariables[a.name]=a,this.incRef(a,this.backend),a}trackTensor(e,t){this.state.numTensors++,"string"===e.dtype&&this.state.numStringTensors++;let n=0;"complex64"!==e.dtype&&"string"!==e.dtype&&(n=e.size*f.bytesPerElement(e.dtype)),this.state.numBytes+=n,this.state.tensorInfo.has(e.dataId)||(this.state.numDataBuffers++,this.state.tensorInfo.set(e.dataId,{backend:t||this.backend,dtype:e.dtype,shape:e.shape,bytes:n})),e instanceof d.Variable||this.track(e)}incRef(e,t){this.trackTensor(e,t),this.backend.incRef(e.dataId)}removeDataId(e,t){this.state.tensorInfo.has(e)&&this.state.tensorInfo.get(e).backend===t&&(this.state.tensorInfo.delete(e),this.state.numDataBuffers--)}disposeTensor(e){if(!this.state.tensorInfo.has(e.dataId))return;const t=this.state.tensorInfo.get(e.dataId);if(this.state.numTensors--,"string"===e.dtype&&(this.state.numStringTensors--,this.state.numBytes-=t.bytes),"complex64"!==e.dtype&&"string"!==e.dtype){const t=e.size*f.bytesPerElement
vendor: 1,358 bytes, line 1
1(e.dtype);this.state.numBytes-=t}t.backend.disposeData(e.dataId)&&this.removeDataId(e.dataId,t.backend)}disposeVariables(){for(const e in this.state.registeredVariables){const t=this.state.registeredVariables[e];this.disposeVariable(t)}}disposeVariable(e){this.disposeTensor(e),null!=this.state.registeredVariables[e.name]&&delete this.state.registeredVariables[e.name]}memory(){const e=this.backend.memory();return e.numTensors=this.state.numTensors,e.numDataBuffers=this.state.numDataBuffers,e.numBytes=this.state.numBytes,this.state.numStringTensors>0&&(e.unreliable=!0,null==e.reasons&&(e.reasons=[]),e.reasons.push("Memory usage by string tensors is approximate (2 bytes per character)")),e}async profile(e){this.state.profiling=!0;const t=this.state.numBytes,n=this.state.numTensors;this.state.activeProfile.kernels=[],this.state.activeProfile.result=await e(),this.state.profiling=!1,this.state.activeProfile.peakBytes=Math.max(...this.state.activeProfile.kernels.map((e=>e.totalBytesSnapshot))),this.state.activeProfile.newBytes=this.state.numBytes-t,this.state.activeProfile.newTensors=this.state.numTensors-n;for(const e of this.state.activeProfile.kernels)e.kernelTimeMs=await e.kernelTimeMs,e.extraInfo=await e.extraInfo;return this.state.activeProfile}isTapeOn(){return this.state.gradientDepth>0&&0===this.state.kernelDepth}addTapeNode(e,t,n,r,
1a,o){const s={id:this.state.nextTapeNodeId++,kernelName:e,inputs:t,outputs:n,saved:a},c=(0,i.getGradient)(e);null!=c&&(r=c.gradFunc),null!=r&&(s.gradient=e=>(e=e.map(((e,t)=>{if(null==e){const e=n[t],r=f.makeZerosTypedArray(e.size,e.dtype);return this.makeTensor(r,e.shape,e.dtype)}return e})),r(e.length>1?e:e[0],a,o))),this.state.activeTape.push(s)}keep(e){return e.kept=!0,e}startTape(){0===this.state.gradientDepth&&(this.state.activeTape=[]),this.state.gradientDepth++}endTape(){this.state.gradientDepth--}startScope(e){const t={track:[],name:"unnamed scope",id:this.state.nextScopeId++};e&&(t.name=e),this.state.scopeStack.push(t),this.state.activeScope=t}endScope(e){const t=(0,p.getTensorsInContainer)(e),n=new Set(t.map((e=>e.id)));for(let e=0;e<this.state.activeScope.track.length;e++){const t=this.state.activeScope.track[e];t.kept||n.has(t.id)||t.dispose()}const r=this.state.scopeStack.pop();this.state.activeScope=0===this.state.scopeStack.length?null:this.state.scopeStack[this.state.scopeStack.length-1],t.forEach((e=>{e.kept||e.scopeId!==r.id||this.track(e)}))}gradients(e,t,n){let r=arguments.length>3&&void 0!==arguments[3]&&arguments[3];if(f.assert(t.length>0,(()=>"gradients() received an empty list of xs.")),null!=n&&"float32"!==n.dtype)throw new Error("dy must have 'float32' dtype, but has '".concat(n.dtype,"'"));const a=this.scopedRun((()=>this.startTape()),(()=>this.endTape()),(()=>this.tidy("forward",e)));f.assert(a instanceof d.Tensor,(()=>"The result y returned by f() must be a tensor."));const o=(0,u.getFilteredNodesXToY)(this.state.activeTape,t,a);if(!r&&0===o.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.");return this.tidy("backward",(()=>{const e={};e[a.id]=null==n?function(e){const t=(0,h.makeOnesTypedArray)((0,h.sizeFromShape)(e),"float32");return w.makeTensor(t,e,"float32")}(a.shape):n,(0,u.backpropagateGradients)(e,o,(e=>this.tidy(e)),k);const r=t.map((t=>e[t.id]));return 0===this.state.gradientDepth&&(this.state.activeTape.forEach((e=>{for(const t of e.saved)t.dispose()})),this.state.activeTape=null),{value:a,grads:r}}))}customGrad(e){var t=this;return f.assert(f.isFunction(e),(()=>"The f passed in customGrad(f) must be a function.")),function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];let o;f.assert(r.every((e=>e instanceof d.Tensor)),(()=>"The args passed in customGrad(f)(x1, x2,...) must all be tensors"));const s={};r.forEach(((e,t)=>{s[t]=e}));return t.runKernelFunc({forwardFunc:(t,n)=>(o=e(...r,n),f.assert(o.value instanceof d.Tensor,(()=>"The function f passed in customGrad(f) must return an object where `obj.value` is a tensor")),f.assert(f.isFunction(o.gradFunc),(()=>"The function f passed in customGrad(f) must return an object where `obj.gradFunc` is a function.")),o.value),backwardsFunc:(e,t)=>{const n=o.gradFunc(e,t),a=Array.isArray(n)?n:[n];f.assert(a.length===r.length,(()=>"The function f passed in customGrad(f) must return an object where `obj.gradFunc` is a function that returns the same number of tensors as inputs passed to f(...).")),f.assert(a.every((e=>e instanceof d.Tensor)),(()=>"The function f passed in customGrad(f) must return an object where `obj.gradFunc` is a function that returns a list of only tensors."));const s={};return a.forEach(((e,t)=>{s[t]=()=>e})),s},inputs:s})}}readSync(e){return this.state.tensorInfo.get(e).backend.readSync(e)}read(e){return this.state.tensorInfo.get(e).backend.read(e)}readToGPU(e,t){return this.state.tensorInfo.get(e).backend.readToGPU(e,t)}async time(e){const t=(0,h.now)(),n=await this.backend.time(e);return n.wallMs=(0,h.now)()-t,n}track(e){return null!=this.state.activeScope&&(e.scopeId=this.state.activeScope.id,this.state.activeScope.track.push(e)),e}get registeredVariables(){return this.state.registeredVariables}reset(){this.pendingBackendInitId++,this.state.dispose(),this.ENV.reset(),this.state=new v;for(const e in this.registry)this.disposeRegisteredKernels(e),this.registry[e].dispose(),delete this.registry[e];this.backendName=null,this.backendInstance=null,this.pendingBackendInit=null}}function x(){const e=(0,o.getGlobalNamespace)();if(null==e._tfengine){const t=new a.Environment(e);e._tfengine=new b(t)}return(0,a.setEnvironmentGlobal)(e._tfengine.ENV),(0,d.setTensorTracker)((()=>e._tfengine)),e._tfengine}t.Engine=b,b.nextTensorId=0,b.nextVariableId=0;const w=t.ENGINE=x();function k(e,t){const n={a:e,b:t};return w.runKernel(s.Add,n)}},598257:(e,t,n)=>{"use strict";
1Object.defineProperty(t,"__esModule",{value:!0}),t.Environment=t.ENV=void 0,t.env=s,t.getQueryParams=o,t.setEnvironmentGlobal=function(e){t.ENV=i=e};var r=n(542393);const a="tfjsflags";function o(e){const t={};return e.replace(/[?&]([^=?&]+)(?:=([^&]*))?/g,(function(e){for(var n=arguments.length,r=new Array(n>1?n-1:0),a=1;a<n;a++)r[a-1]=arguments[a];return function(e,t,n){e[decodeURIComponent(t)]=decodeURIComponent(n||"")}(t,r[0],r[1]),r.join("=")})),t}function s(){return i}t.Environment=class{constructor(e){this.global=e,this.flags={},this.flagRegistry={},this.urlFlags={},this.getQueryParams=o,this.populateURLFlags()}setPlatform(e,t){null!=this.platform&&(s().getBool("IS_TEST")||s().getBool("PROD")||console.warn("Platform ".concat(this.platformName," has already been set. ")+"Overwriting the platform with ".concat(e,"."))),this.platformName=e,this.platform=t}registerFlag(e,t,n){if(this.flagRegistry[e]={evaluationFn:t,setHook:n},null!=this.urlFlags[e]){const t=this.urlFlags[e];s().getBool("IS_TEST")||s().getBool("PROD")||console.warn("Setting feature override from URL ".concat(e,": ").concat(t,".")),this.set(e,t)}}async getAsync(e){return e in this.flags||(this.flags[e]=await this.evaluateFlag(e)),this.flags[e]}get(e){if(e in this.flags)return this.flags[e];const t=this.evaluateFlag(e);if((0,r.isPromise)(t))throw new Error("Flag ".concat(e," cannot be synchronously evaluated. ")+"Please use getAsync() instead.");return this.flags[e]=t,this.flags[e]}getNumber(e){return this.get(e)}getBool(e){return this.get(e)}getFlags(){return this.flags}get features(){return this.flags}set(e,t){if(null==this.flagRegistry[e])throw new Error("Cannot set flag ".concat(e," as it has not been registered."));this.flags[e]=t,null!=this.flagRegistry[e].setHook&&this.flagRegistry[e].setHook(t)}evaluateFlag(e){if(null==this.flagRegistry[e])throw new Error("Cannot evaluate flag '".concat(e,"': no evaluation function found."));return this.flagRegistry[e].evaluationFn()}setFlags(e){this.flags=Object.assign({},e)}reset(){this.flags={},this.urlFlags={},this.populateURLFlags()}populateURLFlags(){if(void 0===this.global||void 0===this.global.location||void 0===this.global.location.search)return;const e=this.getQueryParams(this.global.location.search);if(a in e){e[a].split(",").forEach((e=>{const[t,n]=e.split(":");this.urlFlags[t]=function(e,t){if("true"===(t=t.toLowerCase())||"false"===t)return"true"===t;if("".concat(+t)===t)return+t;throw new Error("Could not parse value flag value ".concat(t," for flag ").concat(e,"."))}(t,n)}))}}};let i=t.ENV=null},19445:(e,t,n)=>{"use strict";var r=n(734155);n(90337);var a=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=o(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var s in e)if("default"!==s&&{}.hasOwnProperty.call(e,s)){var i=a?Object.getOwnPropertyDescriptor(e,s):null;i&&(i.get||i.set)?Object.defineProperty(r,s,i):r[s]=e[s]}return r.default=e,n&&n.set(e,r),r}(n(160864));function o(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(o=function(e){return e?n:t})(e)}const s=(0,n(598257).env)();s.registerFlag("DEBUG",(()=>!1),(e=>{e&&console.warn("Debugging mode is ON. The output of every math call will be downloaded to CPU and checked for NaNs. This significantly impacts performance.")})),s.registerFlag("IS_BROWSER",(()=>a.isBrowser())),s.registerFlag("IS_NODE",(()=>void 0!==r&&void 0!==r.versions&&void 0!==r.versions.node)),s.registerFlag("IS_CHROME",(()=>"undefined"!=typeof navigator&&null!=navigator&&null!=navigator.userAgent&&/Chrome/.test(navigator.userAgent)&&/Google Inc/.test(navigator.vendor))),s.registerFlag("PROD",(()=>!1)),s.registerFlag("TENSORLIKE_CHECK_SHAPE_CONSISTENCY",(()=>s.getBool("DEBUG"))),s.registerFlag("DEPRECATION_WARNINGS_ENABLED",(()=>!0)),s.registerFlag("IS_TEST",(()=>!1)),s.registerFlag("CHECK_COMPUTATION_FOR_ERRORS",(()=>!0)),s.registerFlag("WRAP_TO_IMAGEBITMAP",(()=>!1))},923788:(e,t,n)=>{"use strict";var r=n(734155);let a;function o(){if(null==a){let e;if("undefined"!=typeof window)e=window;else if(void 0!==n.g)e=n.g;else if(void 0!==r)e=r;else{if("undefined"==typeof self)throw new Error("Could not find a global object");e=self}a=e}return a}
1Object.defineProperty(t,"__esModule",{value:!0}),t.getGlobal=function(e,t){const n=function(){const e=o();null==e._tfGlobals&&(e._tfGlobals=new Map);return e._tfGlobals}();if(n.has(e))return n.get(e);{const r=t();return n.set(e,r),n.get(e)}},t.getGlobalNamespace=o},271725:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.backend=function(){return r.ENGINE.backend},t.deprecationWarn=i,t.disableDeprecationWarnings=function(){(0,a.env)().set("DEPRECATION_WARNINGS_ENABLED",!1),console.warn("TensorFlow.js deprecation warnings have been disabled.")},t.dispose=function(e){(0,s.getTensorsInContainer)(e).forEach((e=>e.dispose()))},t.disposeVariables=function(){r.ENGINE.disposeVariables()},t.enableDebugMode=function(){(0,a.env)().set("DEBUG",!0)},t.enableProdMode=function(){(0,a.env)().set("PROD",!0)},t.engine=function(){return r.ENGINE},t.findBackend=function(e){return r.ENGINE.findBackend(e)},t.findBackendFactory=function(e){return r.ENGINE.findBackendFactory(e)},t.getBackend=function(){return r.ENGINE.backendName},t.keep=function(e){return r.ENGINE.keep(e)},t.memory=function(){return r.ENGINE.memory()},t.profile=function(e){return r.ENGINE.profile(e)},t.ready=function(){return r.ENGINE.ready()},t.registerBackend=function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;return r.ENGINE.registerBackend(e,t,n)},t.removeBackend=function(e){r.ENGINE.removeBackend(e)},t.setBackend=function(e){return r.ENGINE.setBackend(e)},t.setPlatform=function(e,t){(0,a.env)().setPlatform(e,t)},t.tidy=function(e,t){return r.ENGINE.tidy(e,t)},t.time=function(e){return r.ENGINE.time(e)};var r=n(90337),a=n(598257),o=n(659795),s=n(390771);function i(e){(0,a.env)().getBool("DEPRECATION_WARNINGS_ENABLED")&&console.warn(e+" You can disable deprecation warnings with tf.disableDeprecationWarnings().")}(0,o.setDeprecationWarningFn)(i)},931564:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.customGrad=function(e){return r.ENGINE.customGrad(e)},t.grad=function(e){return s.assert(s.isFunction(e),(()=>"The f passed in grad(f) must be a function")),(t,n)=>{const a=(0,o.convertToTensor)(t,"x","tf.grad","string_or_numeric"),i=null!=n?(0,o.convertToTensor)(n,"dy","tf.grad"):null;return r.ENGINE.tidy((()=>{const{value:t,grads:n}=r.ENGINE.gradients((()=>e(a)),[a],i);return null!=i&&s.assertShapesMatch(t.shape,i.shape,"The shape of dy passed in grad(f)(x, dy) must match the shape returned by f(x)"),c(n),n[0]}))}},t.grads=function(e){return s.assert(s.isFunction(e),(()=>"The f passed in grads(f) must be a function")),(t,n)=>{s.assert(Array.isArray(t),(()=>"The args passed in grads(f)(args) must be an array of `Tensor`s or `TensorLike`s"));const a=(0,o.convertToTensorArray)(t,"args","tf.grads","string_or_numeric"),i=null!=n?(0,o.convertToTensor)(n,"dy","tf.grads"):null;return r.ENGINE.tidy((()=>{const{value:t,grads:n}=r.ENGINE.gradients((()=>e(...a)),a,i);return null!=i&&s.assertShapesMatch(t.shape,i.shape,"The shape of dy passed in grads(f)([x1,...], dy) must match the shape returned by f([x1,...])"),c(n),n}))}},t.valueAndGrad=function(e){return s.assert(s.isFunction(e),(()=>"The f passed in valueAndGrad(f) must be a function")),(t,n)=>{s.assert(t instanceof a.Tensor,(()=>"The x passed in valueAndGrad(f)(x) must be a tensor")),s.assert(null==n||n instanceof a.Tensor,(()=>"The dy passed in valueAndGrad(f)(x, dy) must be a tensor"));const{grads:o,value:i}=r.ENGINE.gradients((()=>e(t)),[t],n);return c(o),{grad:o[0],value:i}}},t.valueAndGrads=function(e){return s.assert(s.isFunction(e),(()=>"The f passed in valueAndGrads(f) must be a function")),(t,n)=>{s.assert(Array.isArray(t)&&t.every((e=>e instanceof a.Tensor)),(()=>"The args passed in valueAndGrads(f)(args) must be array of tensors")),s.assert(null==n||n instanceof a.Tensor,(()=>"The dy passed in valueAndGrads(f)(args, dy) must be a tensor"));const o=r.ENGINE.gradients((()=>e(...t)),t,n);return null!=n&&s.assertShapesMatch(o.value.shape,n.shape,"The shape of dy passed in valueAndGrads(f)([x1,...], dy) must match the shape returned by f([x1,...])"),c(o.grads),o}},t.variableGrads=function(e,t){s.assert(s.isFunction(e),(()=>"The f passed in variableGrads(f) must be a function")),s.assert(null==t||Array.isArray(t)&&t.every((e=>e instanceof a.Variable)),(()=>"The varList passed in variableGrads(f, varList) must be an array of variables"));const n=null!=t;if(!n){t=[];for(const e in r.ENGINE.registeredVariables)t.push(r.ENGINE.registeredVariables[e])}const o=n?t.filter((e=>!e.trainable)):null,i=t.length;t=t.filter((e=>e.trainable)),s.assert(t.length>0,(()=>"variableGrads() expects at least one of the input variables to "+"be trainable, but none of the ".concat(i," variables is ")+"trainable."));const{value:c,grads:l}=r.ENGINE.gradients(e,t,null,!0);s.assert(l.some((e=>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().")),s.assert(0===c.rank,(()=>"The f passed in variableGrads(f) must return a scalar, but it "+"returned a rank-".concat(c.rank," tensor")));const u={};t.forEach(((e,t)=>{null!=l[t]&&(u[e.name]=l[t])})),null!=o&&o.forEach((e=>u[e.name]=null));return{value:c,grads:u}};var r=n(90337),a=n(659795),o=n(188695),s=function(e,t){if(!t&&e&&e.__esMo
1dule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=i(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if("default"!==o&&{}.hasOwnProperty.call(e,o)){var s=a?Object.getOwnPropertyDescriptor(e,o):null;s&&(s.get||s.set)?Object.defineProperty(r,o,s):r[o]=e[o]}return r.default=e,n&&n.set(e,r),r}(n(904737));function i(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(i=function(e){return e?n:t})(e)}function c(e){if(e.filter((e=>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.")}},329603:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.absGradConfig=void 0;var r=n(536217),a=n(386565),o=n(295702),s=n(622741);t.absGradConfig={kernelName:r.Abs,inputsToSave:["x"],gradFunc:(e,t)=>{const[n]=t;return{x:()=>(0,o.mul)(e,(0,s.step)((0,a.cast)(n,"float32"),-1))}}}},475269:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.acosGradConfig=void 0;var r=n(536217),a=n(386565),o=n(67282),s=n(193617),i=n(454179),c=n(435438),l=n(985987),u=n(702222);t.acosGradConfig={kernelName:r.Acos,inputsToSave:["x"],gradFunc:(e,t)=>{const[n]=t;return{x:()=>{const t=(0,l.square)((0,a.cast)(n,"float32")),r=(0,c.sqrt)((0,u.sub)((0,i.scalar)(1),t));return(0,s.neg)((0,o.div)(e,r))}}}}}
1,751812:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.acoshGradConfig=void 0;var r=n(536217),a=n(386565),o=n(67282),s=n(435438),i=n(985987),c=n(702222);t.acoshGradConfig={kernelName:r.Acosh,inputsToSave:["x"],gradFunc:(e,t)=>{const[n]=t;return{x:()=>{const t=(0,s.sqrt)((0,c.sub)((0,i.square)((0,a.cast)(n,"float32")),1));return(0,o.div)(e,t)}}}}},239647:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.addNGradConfig=void 0;var r=n(536217);t.addNGradConfig={kernelName:r.AddN,saveAllInputs:!0,gradFunc:(e,t)=>{const n={};return t.forEach(((t,r)=>{n[r]=()=>e.clone()})),n}}},10939:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.addGradConfig=void 0;var r=n(536217),a=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=i(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if("default"!==o&&{}.hasOwnProperty.call(e,o)){var s=a?Object.getOwnPropertyDescriptor(e,o):null;s&&(s.get||s.set)?Object.defineProperty(r,o,s):r[o]=e[o]}return r.default=e,n&&n.set(e,r),r}(n(534779)),o=n(195476),s=n(450126);function i(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(i=function(e){return e?n:t})(e)}t.addGradConfig={kernelName:r.Add,inputsToSave:["a","b"],gradFunc:(e,t)=>{const[n,r]=t,i=a.assertAndGetBroadcastShape(n.shape,r.shape);return{a:()=>{let t=e;const r=a.getReductionAxes(n.shape,i);return r.length>0&&(t=(0,s.sum)(t,r)),(0,o.reshape)(t,n.shape)},b:()=>{let t=e;const n=a.getReductionAxes(r.shape,i);return n.length>0&&(t=(0,s.sum)(t,n)),(0,o.reshape)(t,r.shape)}}}}},845702:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.argMaxGradConfig=void 0;var r=n(536217),a=n(166119);t.argMaxGradConfig={kernelName:r.ArgMax,inputsToSave:["x"],gradFunc:(e,t)=>{const[n]=t;return{x:()=>(0,a.zerosLike)(n)}}}},152426:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.argMinGradConfig=void 0;var r=n(536217),a=n(166119);t.argMinGradConfig={kernelName:r.ArgMin,inputsToSave:["x"],gradFunc:(e,t)=>{const[n]=t;return{x:()=>(0,a.zerosLike)(n)}}}},431980:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.asinGradConfig=void 0;var r=n(536217),a=n(386565),o=n(67282),s=n(454179),i=n(435438),c=n(985987),l=n(702222);t.asinGradConfig={kernelName:r.Asin,inputsToSave:["x"],gradFunc:(e,t)=>{const[n]=t;return{x:()=>(0,o.div)(e,(0,i.sqrt)((0,l.sub)((0,s.scalar)(1),(0,c.square)((0,a.cast)(n,"float32")))))}}}},193482:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.asinhGradConfig=void 0;var r=n(536217),a=n(353632),o=n(386565),s=n(67282),i=n(454179),c=n(435438),l=n(985987);t.asinhGradConfig={kernelName:r.Asinh,inputsToSave:["x"],gradFunc:(e,t)=>{const[n]=t;return{x:()=>{const t=(0,c.sqrt)((0,a.add)((0,i.scalar)(1),(0,l.square)((0,o.cast)(n,"float32"))));return(0,s.div)(e,t)}}}}},825051:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.atan2GradConfig=void 0;var r=n(536217),a=n(353632),o=n(534779),s=n(67282),i=n(295702),c=n(193617),l=n(195476),u=n(985987),d=n(450126);t.atan2GradConfig={kernelName:r.Atan2,inputsToSave:["a","b"],gradFunc:(e,t)=>{const[n,r]=t,p=(0,o.assertAndGetBroadcastShape)(n.shape,r.shape);return{a:()=>{const t=(0,a.add)((0,u.square)(n),(0,u.square)(r));let c=(0,i.mul)(e,(0,s.div)(r,t));const h=(0,o.getReductionAxes)(n.shape,p);return h.length>0&&(c=(0,d.sum)(c,h)),(0,l.reshape)(c,n.shape)},b:()=>{const t=(0,a.add)((0,u.square)(n),(0,u.square)(r));let h=(0,c.neg)((0,i.mul)(e,(0,s.div)(n,t)));const f=(0,o.getReductionAxes)(r.shape,p);return f.length>0&&(h=(0,d.sum)(h,f)),(0,l.reshape)(h,r.shape)}}}}},526391:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.atanGradConfig=void 0;var r=n(536217),a=n(353632),o=n(386565),s=n(67282),i=n(985987);t.atanGradConfig={kernelName:r.Atan,inputsToSave:["x"],gradFunc:(e,t)=>{const[n]=t;return{x:()=>(0,s.div)(e,(0,a.add)((0,i.square)((0,o.cast)(n,"float32")),1))}}}},415553:(e,t,n)=>{"use strict";
1Object.defineProperty(t,"__esModule",{value:!0}),t.atanhGradConfig=void 0;var r=n(536217),a=n(386565),o=n(67282),s=n(985987),i=n(702222),c=n(454179);t.atanhGradConfig={kernelName:r.Atanh,inputsToSave:["x"],gradFunc:(e,t)=>{const[n]=t;return{x:()=>(0,o.div)(e,(0,i.sub)((0,c.scalar)(1),(0,s.square)((0,a.cast)(n,"float32"))))}}}},137461:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.avgPool3DGradConfig=void 0;var r=n(536217),a=n(678948);t.avgPool3DGradConfig={kernelName:r.AvgPool3D,inputsToSave:["x"],gradFunc:(e,t,n)=>{const[r]=t,{filterSize:o,strides:s,pad:i,dimRoundingMode:c}=n;return{x:()=>(0,a.avgPool3dGrad)(e,r,o,s,i,c)}}}},693700:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.avgPoolGradConfig=void 0;var r=n(536217),a=n(576062);t.avgPoolGradConfig={kernelName:r.AvgPool,inputsToSave:["x"],gradFunc:(e,t,n)=>{const[r]=t,{filterSize:o,strides:s,pad:i}=n;return{x:()=>(0,a.avgPoolGrad)(e,r,o,s,i)}}}},671533:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.batchMatMulGradConfig=void 0;var r=n(536217),a=n(986588);t.batchMatMulGradConfig={kernelName:r.BatchMatMul,inputsToSave:["a","b"],gradFunc:(e,t,n)=>{const[r,o]=t,{transposeA:s,transposeB:i}=n;return s||i?!s&&i?{a:()=>(0,a.matMul)(e,o,!1,!1),b:()=>(0,a.matMul)(e,r,!0,!1)}:s&&!i?{a:()=>(0,a.matMul)(o,e,!1,!0),b:()=>(0,a.matMul)(r,e,!1,!1)}:{a:()=>(0,a.matMul)(o,e,!0,!0),b:()=>(0,a.matMul)(e,r,!0,!0)}:{a:()=>(0,a.matMul)(e,o,!1,!0),b:()=>(0,a.matMul)(r,e,!0,!1)}}}},755898:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.batchToSpaceNDGradConfig=void 0;var r=n(536217),a=n(244851);t.batchToSpaceNDGradConfig={kernelName:r.BatchToSpaceND,gradFunc:(e,t,n)=>{const{blockShape:r,crops:o}=n;return{x:()=>(0,a.spaceToBatchND)(e,r,o)}}}},456660:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.broadcastToGradConfig=void 0;var r=n(536217),a=n(450126);t.broadcastToGradConfig={kernelName:r.BroadcastTo,gradFunc:(e,t,n)=>{const r=n,o=r.inputShape,s=r.shape,i=Array.from(s);for(let e=o.length-1;e>=0;e--)if(o[e]===s[e])i[e]=1;else if(1!==o[e])throw new Error("broadcastTo(): [".concat(o,"] cannot be broadcast to [").concat(s,"]."));const c=[];for(let e=0;e<i.length;e++)i[e]>1&&c.push(e);return{x:()=>(0,a.sum)(e,c,!0)}}}},773650:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.castGradConfig=void 0;var r=n(536217);
1t.castGradConfig={kernelName:r.Cast,gradFunc:e=>({x:()=>e.clone()})}},3191:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ceilGradConfig=void 0;var r=n(536217),a=n(166119);t.ceilGradConfig={kernelName:r.Ceil,gradFunc:e=>({x:()=>(0,a.zerosLike)(e)})}},400735:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.clipByValueGradConfig=void 0;var r=n(536217),a=n(955497),o=n(756172),s=n(586386),i=n(376131),c=n(166119);t.clipByValueGradConfig={kernelName:r.ClipByValue,inputsToSave:["x"],gradFunc:(e,t,n)=>{const[r]=t,{clipValueMin:l,clipValueMax:u}=n;return{x:()=>(0,i.where)((0,s.logicalAnd)((0,a.greaterEqual)(r,l),(0,o.lessEqual)(r,u)),e,(0,c.zerosLike)(e))}}}},87051:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.complexAbsGradConfig=void 0;var r=n(536217),a=n(329603);t.complexAbsGradConfig={kernelName:r.ComplexAbs,inputsToSave:["x"],gradFunc:a.absGradConfig.gradFunc}},343182:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.concatGradConfig=void 0;var r=n(536217),a=n(422194),o=n(904737);t.concatGradConfig={kernelName:r.Concat,saveAllInputs:!0,gradFunc:(e,t,n)=>{const r=t.map((e=>e.shape)),{axis:s}=n,i=(0,o.parseAxisParam)(s,t[0].shape)[0],c=r.map((e=>e[i]));return(0,a.split)(e,c,i).map((e=>()=>e))}}},530415:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.conv2DBackpropInputGradConfig=void 0;var r=n(536217),a=n(797476),o=n(948519);t.conv2DBackpropInputGradConfig={kernelName:r.Conv2DBackpropInput,inputsToSave:["dy","filter"],gradFunc:(e,t,n)=>{const[r,s]=t,{strides:i,pad:c,dataFormat:l,dimRoundingMode:u}=n;return{dy:()=>(0,a.conv2d)(e,s,i,c,l,1,u),filter:()=>(0,o.conv2DBackpropFilter)(e,r,s.shape,i,c,l,u)}}}},895280:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.conv2DGradConfig=void 0;var r=n(536217),a=n(948519),o=n(713310),s=l(n(812682)),i=l(n(904737));function c(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(c=function(e){return e?n:t})(e)}function l(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=c(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if("default"!==o&&{}.hasOwnProperty.call(e,o)){var s=a?Object.getOwnPropertyDescriptor(e,o):null;s&&(s.get||s.set)?Object.defineProperty(r,o,s):r[o]=e[o]}return r.default=e,n&&n.set(e,r),r}t.conv2DGradConfig={kernelName:r.Conv2D,inputsToSave:["x","filter"],gradFunc:(e,t,n)=>{const[r,c]=t,{dilations:l,strides:u,pad:d,dataFormat:p}=n;return i.assert(s.tupleValuesAreOne(l),(()=>"Error in gradient of conv2D: dilation rates greater than 1 "+"are not yet supported in gradients. Got dilations '".concat(l,"'"))),{x:()=>(0,o.conv2DBackpropInput)(r.shape,e,c,u,d,p),filter:()=>(0,a.conv2DBackpropFilter)(r,e,c.shape,u,d,p)}}}},674345:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.conv3DGradConfig=void 0;var r=n(536217),a=n(209168),o=n(775646),s=n(812682),i=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=c(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if("default"!==o&&{}.hasOwnProperty.call(e,o)){var s=a?Object.getOwnPropertyDescriptor(e,o):null;s&&(s.get||s.set)?Object.defineProperty(r,o,s):r[o]=e[o]}return r.default=e,n&&n.set(e,r),r}(n(904737));function c(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(c=function(e){return e?n:t})(e)}t.conv3DGradConfig={kernelName:r.Conv3D,inputsToSave:["x","filter"],gradFunc:(e,t,n)=>{const{dilations:r,strides:c,pad:l}=n;i.assert((0,s.tupleValuesAreOne)(r),(()=>"Error in gradient of conv3D: dilation rates greater than 1 are "+"not yet supported in gradients. Got dilations '".concat(r,"'")));const[u,d]=t;return{x:()=>(0,o.conv3DBackpropInput)(u.shape,e,d,c,l),filter:()=>(0,a.conv3DBackpropFilter)(u,e,d.shape,c,l)}}}},456481:(e,t,n)=>{"use strict";
1Object.defineProperty(t,"__esModule",{value:!0}),t.cosGradConfig=void 0;var r=n(536217),a=n(386565),o=n(295702),s=n(193617),i=n(762006);t.cosGradConfig={kernelName:r.Cos,inputsToSave:["x"],gradFunc:(e,t)=>{const[n]=t;return{x:()=>(0,o.mul)((0,s.neg)((0,i.sin)((0,a.cast)(n,"float32"))),e)}}}},751835:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.coshGradConfig=void 0;var r=n(536217),a=n(386565),o=n(295702),s=n(249118);t.coshGradConfig={kernelName:r.Cosh,inputsToSave:["x"],gradFunc:(e,t)=>{const[n]=t;return{x:()=>(0,o.mul)((0,s.sinh)((0,a.cast)(n,"float32")),e)}}}},710410:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.cumsumGradConfig=void 0;var r=n(536217),a=n(247731),o=n(110727),s=n(688129);t.cumsumGradConfig={kernelName:r.Cumsum,inputsToSave:["x"],gradFunc:(e,t,n)=>{const[r]=t,{axis:i,exclusive:c,reverse:l}=n;return{x:()=>{const t=(0,a.getAxesPermutation)([i],r.rank);let n=(0,o.cumsum)(e,i,c,!l);return null!=t&&(n=(0,s.transpose)(n,t)),n}}}}},692286:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.depthwiseConv2dNativeGradConfig=void 0;var r=n(536217),a=l(n(812682)),o=n(114827),s=n(749273),i=l(n(904737));function c(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(c=function(e){return e?n:t})(e)}function l(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=c(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if("default"!==o&&{}.hasOwnProperty.call(e,o)){var s=a?Object.getOwnPropertyDescriptor(e,o):null;s&&(s.get||s.set)?Object.defineProperty(r,o,s):r[o]=e[o]}return r.default=e,n&&n.set(e,r),r}t.depthwiseConv2dNativeGradConfig={kernelName:r.DepthwiseConv2dNative,inputsToSave:["x","filter"],gradFunc:(e,t,n)=>{const{dilations:r,strides:c,pad:l,dimRoundingMode:u}=n,d=null==r?[1,1]:r;i.assert(a.tupleValuesAreOne(d),(()=>"Error in gradient of depthwiseConv2dNative: dilation rates greater than 1 are not yet supported. Got dilations "+"'".concat(d,"'")));const[p,h]=t;return i.assert(4===p.rank,(()=>"Error in gradient of depthwiseConv2dNative: input must be "+"rank 4, but got rank ".concat(p.rank,"."))),i.assert(4===h.rank,(()=>"Error in gradient of depthwiseConv2dNative: filter must be "+"rank 4, but got rank ".concat(h.rank,"."))),i.assert(p.shape[3]===h.shape[2],(()=>"Error in gradient of depthwiseConv2d: number of input "+"channels (".concat(p.shape[3],") must match the inChannels dimension ")+"in filter ".concat(h.shape[2],"."))),i.assert(a.eitherStridesOrDilationsAreOne(c,d),(()=>"Error in gradient of depthwiseConv2d: Either strides or "+"dilations must be 1. Got strides ".concat(c," and dilations ")+"'".concat(d,"'."))),a.checkPadOnDimRoundingMode("depthwiseConv2d",l,u),{x:()=>(0,s.depthwiseConv2dNativeBackpropInput)(p.shape,e,h,c,l,d,u),filter:()=>(0,o.depthwiseConv2dNativeBackpropFilter)(p,e,h.shape,c,l,d,u)}}}},469161:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.dilation2dGradConfig=void 0;var r=n(90337),a=n(536217);t.dilation2dGradConfig={kernelName:a.Dilation2D,inputsToSave:["x","filter"],gradFunc:(e,t,n)=>{const[o,s]=t,i={x:o,filter:s,dy:e},c={x:o,filter:s,dy:e};return{x:()=>r.ENGINE.runKernel(a.Dilation2DBackpropInput,i,n),filter:()=>r.ENGINE.runKernel(a.Dilation2DBackpropFilter,c,n)}}}},305916:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.eluGradConfig=void 0;var r=n(90337),a=n(536217);t.eluGradConfig={kernelName:a.Elu,outputsToSave:[!0],gradFunc:(e,t)=>{const[n]=t,o={dy:e,y:n};return{x:()=>r.ENGINE.runKernel(a.EluGrad,o)}}}},909222:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.erfGradConfig=void 0;var r=n(536217),a=n(99815),o=n(295702),s=n(193617),i=n(985987);t.erfGradConfig={kernelName:r.Erf,inputsToSave:["x"],gradFunc:(e,t)=>{const[n]=t,r=(0,o.mul)((0,a.exp)((0,s.neg)((0,i.square)(n))),2/Math.sqrt(Math.PI));return{x:()=>(0,o.mul)(e,r)}}}},500799:(e,t,n)=>{"use strict";
1Object.defineProperty(t,"__esModule",{value:!0}),t.expGradConfig=void 0;var r=n(536217),a=n(295702);t.expGradConfig={kernelName:r.Exp,outputsToSave:[!0],gradFunc:(e,t)=>{const[n]=t;return{x:()=>(0,a.mul)(e,n)}}}},544049:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.expandDimsGradConfig=void 0;var r=n(536217),a=n(195476);t.expandDimsGradConfig={kernelName:r.ExpandDims,inputsToSave:["input"],gradFunc:(e,t)=>{const[n]=t;return{input:()=>(0,a.reshape)(e,n.shape)}}}},302347:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.expm1GradConfig=void 0;var r=n(536217),a=n(99815),o=n(295702);t.expm1GradConfig={kernelName:r.Expm1,inputsToSave:["x"],gradFunc:(e,t)=>{const[n]=t;return{x:()=>(0,o.mul)(e,(0,a.exp)(n))}}}},864172:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.floorDivGradConfig=void 0;var r=n(536217),a=n(534779),o=n(386565),s=n(67282),i=n(295702),c=n(193617),l=n(195476),u=n(985987),d=n(450126);t.floorDivGradConfig={kernelName:r.FloorDiv,inputsToSave:["a","b"],gradFunc:(e,t)=>{const[n,r]=t,p=(0,a.assertAndGetBroadcastShape)(n.shape,r.shape);return{a:()=>{const t=(0,s.div)(e,(0,o.cast)(r,"float32")),i=(0,a.getReductionAxes)(n.shape,p);return i.length>0?(0,l.reshape)((0,d.sum)(t,i),n.shape):t},b:()=>{let t=(0,i.mul)(e,(0,o.cast)(n,"float32"));const h=(0,a.getReductionAxes)(r.shape,p);h.length>0&&(t=(0,l.reshape)((0,d.sum)(t,h),r.shape));const f=(0,u.square)(r);return(0,c.neg)((0,s.div)(t,(0,o.cast)(f,"float32")))}}}}},555780:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.floorGradConfig=void 0;var r=n(536217),a=n(166119);
1t.floorGradConfig={kernelName:r.Floor,gradFunc:e=>({x:()=>(0,a.zerosLike)(e)})}},282934:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.fusedBatchNormGradConfig=void 0;var r=n(536217),a=n(353632),o=n(534779),s=n(295702),i=n(195476),c=n(652590),l=n(454179),u=n(702222),d=n(450126),p=n(134987);t.fusedBatchNormGradConfig={kernelName:r.FusedBatchNorm,inputsToSave:["x","mean","variance","scale"],gradFunc:(e,t,n)=>{const{varianceEpsilon:r}=n,[h,f,m,g]=t,y=null==g?(0,l.scalar)(1):g,v=(0,o.getReductionAxes)(f.shape,h.shape),b=[];if(1===f.rank){for(let e=0;e<h.shape.length-1;++e)b.push(h.shape[e]);b.push(1)}const x=(0,u.sub)(h,f),w=(0,s.mul)(e,y),k=(0,c.rsqrt)((0,a.add)(m,(0,l.scalar)(r))),_=(0,s.mul)((0,s.mul)((0,s.mul)(k,k),k),(0,l.scalar)(-.5));return{x:()=>1===f.rank?(0,i.reshape)((0,s.mul)((0,s.mul)(e,(0,p.tile)((0,i.reshape)(k,[1,1,1,f.shape[0]]),b)),y),h.shape):(0,i.reshape)((0,s.mul)((0,s.mul)(e,k),y),h.shape),mean:()=>{let e=(0,s.mul)((0,s.mul)(k,(0,l.scalar)(-1)),w);return 1===f.rank&&(e=(0,d.sum)(e,v)),(0,i.reshape)(e,f.shape)},variance:()=>{let e=(0,s.mul)((0,s.mul)(_,x),w);return 1===f.rank&&(e=(0,d.sum)(e,v)),(0,i.reshape)(e,f.shape)},scale:()=>{const t=(0,s.mul)(x,k);let n=(0,s.mul)(e,t);return 1===f.rank&&(n=(0,d.sum)(n,v)),(0,i.reshape)(n,f.shape)},offset:()=>{let t=e;return 1===f.rank&&(t=(0,d.sum)(t,v)),(0,i.reshape)(t,f.shape)}}}}},629736:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.gatherGradConfig=void 0;var r=n(536217),a=n(247731),o=n(195476),s=n(688129),i=n(421418),c=n(904737);t.gatherGradConfig={kernelName:r.GatherV2,inputsToSave:["x","indices"],gradFunc:(e,t,n)=>{const[r,d]=t,{axis:p}=n,h=(0,c.parseAxisParam)(p,r.shape)[0];return{x:()=>{const t=r.shape,n=d.size,c=t.slice(0,h),f=c.length,m=t.slice(p,t.length).slice(1),g=m.length,y=l(0,f),v=l(f+1,f+1+g),b=u([c,[n],m]),x=(0,o.reshape)(e,b),w=(0,o.reshape)(d,[n]),k=u([[f],y,v]),_=(0,s.transpose)(x,k);let C=(0,i.unsortedSegmentSum)(_,w,r.shape[h]);const P=(0,a.getUndoAxesPermutation)(k);return C=(0,s.transpose)(C,P),C},indices:()=>d}}};function l(e,t){const n=[];for(let r=e;r<t;++r)n.push(r);return n}function u(e){const t=[];for(let n=0;n<e.length;++n)for(let r=0;r<e[n].length;++r)t.push(e[n][r]);return t}},551393:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.greaterEqualGradConfig=void 0;var r=n(536217),a=n(166119);t.greaterEqualGradConfig={kernelName:r.GreaterEqual,inputsToSave:["a","b"],gradFunc:(e,t)=>{const[n,r]=t;return{a:()=>(0,a.zerosLike)(n),b:()=>(0,a.zerosLike)(r)}}}},123798:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.identityGradConfig=void 0;var r=n(536217),a=n(386565);t.identityGradConfig={kernelName:r.Identity,gradFunc:e=>({x:()=>(0,a.cast)(e,"float32")})}},548672:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.isFiniteGradConfig=void 0;var r=n(536217),a=n(166119);
1t.isFiniteGradConfig={kernelName:r.IsFinite,gradFunc:e=>({x:()=>(0,a.zerosLike)(e)})}},666834:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.isInfGradConfig=void 0;var r=n(536217),a=n(166119);t.isInfGradConfig={kernelName:r.IsInf,gradFunc:e=>({x:()=>(0,a.zerosLike)(e)})}},361043:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.isNanGradConfig=void 0;var r=n(536217),a=n(166119);t.isNanGradConfig={kernelName:r.IsNan,gradFunc:e=>({x:()=>(0,a.zerosLike)(e)})}},890927:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.lrnGradConfig=void 0;var r=n(536217),a=n(51682);t.lrnGradConfig={kernelName:r.LRN,inputsToSave:["x"],outputsToSave:[!0],gradFunc:(e,t,n)=>{const[r,o]=t,{depthRadius:s,bias:i,alpha:c,beta:l}=n;return{x:()=>(0,a.localResponseNormalizationBackprop)(r,o,e,s,i,c,l)}}}},129449:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.leakyReluGradConfig=void 0;var r=n(536217),a=n(755964),o=n(295702),s=n(376131);t.leakyReluGradConfig={kernelName:r.LeakyRelu,inputsToSave:["x"],gradFunc:(e,t,n)=>{const[r]=t,{alpha:i}=n,c=(0,a.greater)(r,0);return{x:()=>(0,s.where)(c,e,(0,o.mul)(e,i))}}}},527927:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.log1pGradConfig=void 0;var r=n(536217),a=n(353632),o=n(67282);t.log1pGradConfig={kernelName:r.Log1p,inputsToSave:["x"],gradFunc:(e,t)=>{const[n]=t;return{x:()=>(0,o.div)(e,(0,a.add)(n,1))}}}},488982:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.logSoftmaxGradConfig=void 0;var r=n(536217),a=n(99815),o=n(295702),s=n(702222),i=n(450126);t.logSoftmaxGradConfig={kernelName:r.LogSoftmax,inputsToSave:[],outputsToSave:[!0],gradFunc:(e,t,n)=>{const[r]=t,{axis:c}=n;return{logits:()=>{const t=(0,a.exp)(r);return(0,s.sub)(e,(0,o.mul)((0,i.sum)(e,c,!0),t))}}}}},482275:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.logGradConfig=void 0;var r=n(536217),a=n(386565),o=n(67282);t.logGradConfig={kernelName:r.Log,inputsToSave:["x"],gradFunc:(e,t)=>{const[n]=t;return{x:()=>(0,o.div)(e,(0,a.cast)(n,"float32"))}}}},507833:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.maxPool3DGradConfig=void 0;var r=n(536217),a=n(69975);t.maxPool3DGradConfig={kernelName:r.MaxPool3D,inputsToSave:["x"],outputsToSave:[!0],gradFunc:(e,t,n)=>{const[r,o]=t,{filterSize:s,strides:i,pad:c,dimRoundingMode:l}=n;return{x:()=>(0,a.maxPool3dGrad)(e,r,o,s,i,c,l)}}}},162830:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.maxPoolGradConfig=void 0;var r=n(536217),a=n(400404);t.maxPoolGradConfig={kernelName:r.MaxPool,inputsToSave:["x"],outputsToSave:[!0],gradFunc:(e,t,n)=>{const[r,o]=t,{filterSize:s,strides:i,pad:c}=n;return{x:()=>(0,a.maxPoolGrad)(e,r,o,s,i,c)}}}},434407:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.maxGradConfig=void 0;var r=n(536217),a=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=s(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if("default"!==o&&{}.hasOwnProperty.call(e,o)){var i=a?Object.getOwnPropertyDescriptor(e,o):null;i&&(i.get||i.set)?Object.defineProperty(r,o,i):r[o]=e[o]}return r.default=e,n&&n.set(e,r),r}(n(904737)),o=n(963485);function s(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(s=function(e){return e?n:t})(e)}t.maxGradConfig={kernelName:r.Max,inputsToSave:["x"],outputsToSave:[!0],gradFunc:(e,t,n)=>{const r=n,{reductionIndices:s}=r,i=t[0],c=t[1],l=a.parseAxisParam(s,i.shape),u=(0,o.gradForMinAndMax)(e,c,i,l);return{x:()=>u.x()}}}},498125:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.maximumGradConfig=void 0;var r=n(536217),a=n(386565),o=n(955497),s=n(881597),i=n(295702);t.maximumGradConfig={kernelName:r.Maximum,inputsToSave:["a","b"],gradFunc:(e,t)=>{const[n,r]=t;return{a:()=>(0,i.mul)(e,(0,a.cast)((0,o.greaterEqual)(n,r),"float32")),b:()=>(0,i.mul)(e,(0,a.cast)((0,s.less)(n,r),"float32"))}}}},728968:(e,t,n)=>{"use strict";
1Object.defineProperty(t,"__esModule",{value:!0}),t.meanGradConfig=void 0;var r=n(536217),a=n(247731),o=n(67282),s=n(295702),i=n(678281),c=n(195476),l=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=u(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if("default"!==o&&{}.hasOwnProperty.call(e,o)){var s=a?Object.getOwnPropertyDescriptor(e,o):null;s&&(s.get||s.set)?Object.defineProperty(r,o,s):r[o]=e[o]}return r.default=e,n&&n.set(e,r),r}(n(904737));function u(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(u=function(e){return e?n:t})(e)}t.meanGradConfig={kernelName:r.Mean,inputsToSave:["x"],gradFunc:(e,t,n)=>{const[r]=t,{axis:u}=n,d=l.parseAxisParam(u,r.shape),p=(0,a.computeOutAndReduceShapes)(r.shape,d)[1],h=l.sizeFromShape(p);return{x:()=>{const t=r.shape.slice();d.forEach((e=>{t[e]=1}));const n=(0,c.reshape)(e,t);return(0,o.div)((0,s.mul)(n,(0,i.ones)(r.shape,"float32")),h)}}}}},8650:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.minGradConfig=void 0;var r=n(536217),a=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=s(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if("default"!==o&&{}.hasOwnProperty.call(e,o)){var i=a?Object.getOwnPropertyDescriptor(e,o):null;i&&(i.get||i.set)?Object.defineProperty(r,o,i):r[o]=e[o]}return r.default=e,n&&n.set(e,r),r}(n(904737)),o=n(963485);function s(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(s=function(e){return e?n:t})(e)}t.minGradConfig={kernelName:r.Min,inputsToSave:["x"],outputsToSave:[!0],gradFunc:(e,t,n)=>{const r=n,{axis:s}=r,[i,c]=t,l=a.parseAxisParam(s,i.shape),u=(0,o.gradForMinAndMax)(e,c,i,l);return{x:()=>u.x()}}}},278329:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.minimumGradConfig=void 0;var r=n(536217),a=n(386565),o=n(755964),s=n(756172),i=n(295702);t.minimumGradConfig={kernelName:r.Minimum,inputsToSave:["a","b"],gradFunc:(e,t)=>{const[n,r]=t;return{a:()=>(0,i.mul)(e,(0,a.cast)((0,s.lessEqual)(n,r),"float32")),b:()=>(0,i.mul)(e,(0,a.cast)((0,o.greater)(n,r),"float32"))}}}},396329:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.mirrorPadGradConfig=void 0;var r=n(536217),a=n(247565);t.mirrorPadGradConfig={kernelName:r.MirrorPad,inputsToSave:["x"],gradFunc:(e,t,n)=>{const r=t[0],{paddings:o}=n,s=o.map((e=>e[0]));return{x:()=>(0,a.slice)(e,s,r.shape)}}}},189631:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.modGradConfig=void 0;var r=n(536217),a=n(534779),o=n(67282),s=n(450879),i=n(295702),c=n(193617),l=n(195476),u=n(450126);t.modGradConfig={kernelName:r.Mod,inputsToSave:["a","b"],gradFunc:(e,t)=>{const[n,r]=t,d=(0,a.assertAndGetBroadcastShape)(n.shape,r.shape);return{a:()=>{const t=(0,a.getReductionAxes)(n.shape,d);return t.length>0?(0,l.reshape)((0,u.sum)(e,t),n.shape):e},b:()=>{const t=(0,i.mul)(e,(0,c.neg)((0,s.floor)((0,o.div)(n,r)))),p=(0,a.getReductionAxes)(r.shape,d);return p.length>0?(0,l.reshape)((0,u.sum)(t,p),r.shape):t}}}}},318185:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.multiplyGradConfig=void 0;var r=n(536217),a=n(534779),o=n(386565),s=n(295702),i=n(195476),c=n(450126);t.multiplyGradConfig={kernelName:r.Multiply,inputsToSave:["a","b"],gradFunc:(e,t)=>{const[n,r]=t,l=(0,a.assertAndGetBroadcastShape)(n.shape,r.shape);return{a:()=>{const t=(0,s.mul)(e,(0,o.cast)(r,"float32")),u=(0,a.getReductionAxes)(n.shape,l);return u.length>0?(0,i.reshape)((0,c.sum)(t,u),n.shape):t},b:()=>{const t=(0,s.mul)(e,(0,o.cast)(n,"float32")),u=(0,a.getReductionAxes)(r.shape,l);return u.length>0?(0,i.reshape)((0,c.sum)(t,u),r.shape):t}}}}},250656:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.negGradConfig=void 0;var r=n(536217),a=n(193617);
1t.negGradConfig={kernelName:r.Neg,gradFunc:e=>({x:()=>(0,a.neg)(e)})}},434104:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.oneHotGradConfig=void 0;var r=n(536217),a=n(627896);t.oneHotGradConfig={kernelName:r.OneHot,inputsToSave:["indices"],gradFunc:(e,t)=>{const n=t[0];return{indices:()=>(0,a.zeros)(n.shape,"float32")}}}},921968:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.onesLikeGradConfig=void 0;var r=n(536217),a=n(166119);t.onesLikeGradConfig={kernelName:r.OnesLike,gradFunc:e=>({x:()=>(0,a.zerosLike)(e)})}},806828:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.packGradConfig=void 0;var r=n(536217),a=n(922064);t.packGradConfig={kernelName:r.Pack,saveAllInputs:!0,gradFunc:(e,t,n)=>{const{axis:r}=n;return(0,a.unstack)(e,r).map((e=>()=>e))}}},265506:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.padV2GradConfig=void 0;var r=n(536217),a=n(247565);t.padV2GradConfig={kernelName:r.PadV2,inputsToSave:["x"],gradFunc:(e,t,n)=>{const r=t[0],{paddings:o}=n,s=o.map((e=>e[0]));return{x:()=>(0,a.slice)(e,s,r.shape)}}}},318527:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.powGradConfig=void 0;var r=n(536217),a=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=g(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if("default"!==o&&{}.hasOwnProperty.call(e,o)){var s=a?Object.getOwnPropertyDescriptor(e,o):null;s&&(s.get||s.set)?Object.defineProperty(r,o,s):r[o]=e[o]}return r.default=e,n&&n.set(e,r),r}(n(534779)),o=n(386565),s=n(755964),i=n(164532),c=n(295702),l=n(216556),u=n(195476),d=n(454179),p=n(702222),h=n(450126),f=n(376131),m=n(166119);function g(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(g=function(e){return e?n:t})(e)}t.powGradConfig={kernelName:r.Pow,inputsToSave:["a","b"],outputsToSave:[!0],gradFunc:(e,t)=>{const[n,r,g]=t,y=n,v=r,b=a.assertAndGetBroadcastShape(y.shape,v.shape);return{a:()=>{const t=(0,o.cast)(v,"float32");let n=(0,c.mul)(e,(0,c.mul)(t,(0,l.pow)(y,(0,p.sub)(t,(0,d.scalar)(1)))));const r=a.getReductionAxes(y.shape,b);return r.length>0&&(n=(0,h.sum)(n,r)),(0,u.reshape)(n,y.shape)},b:()=>{const t=(0,s.greater)(y,0),n=(0,f.where)(t,(0,i.log)(y),(0,m.zerosLike)(y));let r=(0,c.mul)(e,(0,c.mul)(g,n));const o=a.getReductionAxes(v.shape,b);return o.length>
10&&(r=(0,h.sum)(r,o)),(0,u.reshape)(r,v.shape)}}}}},453368:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.preluGradConfig=void 0;var r=n(536217),a=n(534779),o=n(755964),s=n(295702),i=n(195476),c=n(450126),l=n(376131),u=n(166119);t.preluGradConfig={kernelName:r.Prelu,inputsToSave:["x","alpha"],gradFunc:(e,t)=>{const[n,r]=t,d=(0,o.greater)(n,0);return{x:()=>(0,l.where)(d,e,(0,s.mul)(e,r)),alpha:()=>{let t=(0,l.where)(d,(0,u.zerosLike)(e),(0,s.mul)(e,n));const o=(0,a.getReductionAxes)(r.shape,e.shape);return o.length>0&&(t=(0,c.sum)(t,o)),(0,i.reshape)(t,r.shape)}}}}},814327:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.divGradConfig=void 0;var r=n(536217),a=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=p(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if("default"!==o&&{}.hasOwnProperty.call(e,o)){var s=a?Object.getOwnPropertyDescriptor(e,o):null;s&&(s.get||s.set)?Object.defineProperty(r,o,s):r[o]=e[o]}return r.default=e,n&&n.set(e,r),r}(n(534779)),o=n(386565),s=n(67282),i=n(295702),c=n(193617),l=n(195476),u=n(985987),d=n(450126);function p(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(p=function(e){return e?n:t})(e)}t.divGradConfig={kernelName:r.RealDiv,inputsToSave:["a","b"],gradFunc:(e,t)=>{const[n,r]=t,p=a.assertAndGetBroadcastShape(n.shape,r.shape);return{a:()=>{const t=(0,s.div)(e,(0,o.cast)(r,"float32")),i=a.getReductionAxes(n.shape,p);return i.length>0?(0,l.reshape)((0,d.sum)(t,i),n.shape):t},b:()=>{let t=(0,i.mul)(e,(0,o.cast)(n,"float32"));const h=a.getReductionAxes(r.shape,p);h.length>0&&(t=(0,l.reshape)((0,d.sum)(t,h),r.shape));const f=(0,u.square)(r);return(0,c.neg)((0,s.div)(t,(0,o.cast)(f,"float32")))}}}}},47262:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.reciprocalGradConfig=void 0;var r=n(536217),a=n(67282),o=n(193617),s=n(985987);t.reciprocalGradConfig={kernelName:r.Reciprocal,inputsToSave:["x"],gradFunc:(e,t)=>{const[n]=t;return{x:()=>(0,a.div)(e,(0,o.neg)((0,s.square)(n)))}}}},747401:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.relu6GradConfig=void 0;var r=n(536217),a=n(386565),o=n(756172),s=n(295702),i=n(622741);t.relu6GradConfig={kernelName:r.Relu6,inputsToSave:["x"],gradFunc:(e,t)=>{const[n]=t,r=(0,s.mul)((0,o.lessEqual)(n,6),(0,i.step)(n));return{x:()=>(0,s.mul)(e,(0,a.cast)(r,"float32"))}}}},4849:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.reluGradConfig=void 0;var r=n(536217),a=n(386565),o=n(295702),s=n(622741);t.reluGradConfig={kernelName:r.Relu,inputsToSave:["x"],gradFunc:(e,t)=>{const[n]=t;return{x:()=>(0,o.mul)(e,(0,a.cast)((0,s.step)(n),"float32"))}}}},808556:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.reshapeGradConfig=void 0;var r=n(536217),a=n(195476);t.reshapeGradConfig={kernelName:r.Reshape,inputsToSave:["x"],gradFunc:(e,t)=>{const[n]=t;return{x:()=>(0,a.reshape)(e,n.shape)}}}},620590:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.resizeBilinearGradConfig=void 0;var r=n(90337),a=n(536217);t.resizeBilinearGradConfig={kernelName:a.ResizeBilinear,inputsToSave:["images"],gradFunc:(e,t,n)=>{const[o]=t,s={dy:e,images:o};return{images:()=>r.ENGINE.runKernel(a.ResizeBilinearGrad,s,n)}}}},362021:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.resizeNearestNeighborGradConfig=void 0;var r=n(90337),a=n(536217);t.resizeNearestNeighborGradConfig={kernelName:a.ResizeNearestNeighbor,inputsToSave:["images"],gradFunc:(e,t,n)=>{const[o]=t,s={dy:e,images:o};return{images:()=>r.ENGINE.runKernel(a.ResizeNearestNeighborGrad,s,n)}}}},202164:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.reverseGradConfig=void 0;var r=n(536217),a=n(790767),o=n(904737);t.reverseGradConfig={kernelName:r.Reverse,gradFunc:(e,t,n)=>{const{dims:r}=n,s=(0,o.parseAxisParam)(r,e.shape);return{x:()=>(0,a.reverse)(e,s)}}}}
1,440404:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.roundGradConfig=void 0;var r=n(536217),a=n(166119);t.roundGradConfig={kernelName:r.Round,gradFunc:e=>({x:()=>(0,a.zerosLike)(e)})}},845099:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.rsqrtGradConfig=void 0;var r=n(536217),a=n(67282),o=n(295702),s=n(193617),i=n(216556);t.rsqrtGradConfig={kernelName:r.Rsqrt,inputsToSave:["x"],gradFunc:(e,t)=>{const[n]=t;return{x:()=>(0,s.neg)((0,a.div)(e,(0,o.mul)((0,i.pow)(n,1.5),2)))}}}},439504:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.selectGradConfig=void 0;var r=n(536217),a=n(386565),o=n(887101),s=n(295702),i=n(166119);t.selectGradConfig={kernelName:r.Select,inputsToSave:["condition"],gradFunc:(e,t)=>{const[n]=t;return{condition:()=>(0,a.cast)((0,i.zerosLike)(n),"float32"),t:()=>(0,s.mul)(e,(0,a.cast)(n,e.dtype)),e:()=>(0,s.mul)(e,(0,a.cast)((0,o.logicalNot)(n),e.dtype))}}}},97527:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.seluGradConfig=void 0;var r=n(536217),a=n(386565),o=n(99815),s=n(755964),i=n(295702),c=n(454179),l=n(755469),u=n(376131);t.seluGradConfig={kernelName:r.Selu,inputsToSave:["x"],gradFunc:(e,t)=>{const[n]=t;return{x:()=>{const t=(0,s.greater)(n,(0,c.scalar)(0)),r=(0,c.scalar)(l.SELU_SCALEALPHA),d=(0,c.scalar)(l.SELU_SCALE),p=(0,i.mul)(e,d),h=(0,i.mul)((0,i.mul)(e,r),(0,o.exp)((0,a.cast)(n,"float32")));return(0,u.where)(t,p,h)}}}}},761400:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.sigmoidGradConfig=void 0;var r=n(536217),a=n(295702),o=n(454179),s=n(702222);t.sigmoidGradConfig={kernelName:r.Sigmoid,outputsToSave:[!0],gradFunc:(e,t)=>{const[n]=t;return{x:()=>(0,a.mul)(e,(0,a.mul)(n,(0,s.sub)((0,o.scalar)(1),n)))}}}},655358:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.signGradConfig=void 0;var r=n(536217),a=n(166119);t.signGradConfig={kernelName:r.Sign,gradFunc:e=>({x:()=>(0,a.zerosLike)(e)})}},153813:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.sinGradConfig=void 0;var r=n(536217),a=n(386565),o=n(317321),s=n(295702);t.sinGradConfig={kernelName:r.Sin,inputsToSave:["x"],gradFunc:(e,t)=>{const[n]=t;return{x:()=>(0,s.mul)((0,o.cos)((0,a.cast)(n,"float32")),e)}}}},608890:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.sinhGradConfig=void 0;var r=n(536217),a=n(386565),o=n(66008),s=n(295702);t.sinhGradConfig={kernelName:r.Sinh,inputsToSave:["x"],gradFunc:(e,t)=>{const[n]=t;return{x:()=>(0,s.mul)((0,o.cosh)((0,a.cast)(n,"float32")),e)}}}},956373:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.sliceGradConfig=void 0;var r=n(536217),a=n(813636),o=n(328113);t.sliceGradConfig={kernelName:r.Slice,inputsToSave:["x"],gradFunc:(e,t,n)=>{const[r]=t,{begin:s,size:i}=n,c=r.shape,[l,u]=(0,o.parseSliceParams)(r,s,i),d=[];for(let t=0;t<e.rank;t++)d.push([l[t],c[t]-l[t]-u[t]]);return{x:()=>(0,a.pad)(e,d)}}}},664417:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.softmaxGradConfig=void 0;var r=n(536217),a=n(295702),o=n(702222),s=n(450126);t.softmaxGradConfig={kernelName:r.Softmax,outputsToSave:[!0],gradFunc:(e,t,n)=>{const[r]=t,{dim:i}=n,c=(0,a.mul)(e,r);return{logits:()=>(0,o.sub)(c,(0,a.mul)((0,s.sum)(c,[i],true),r))}}}},983560:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.softplusGradConfig=void 0;var r=n(536217),a=n(295702),o=n(789520);t.softplusGradConfig={kernelName:r.Softplus,inputsToSave:["x"],gradFunc:(e,t)=>{const[n]=t;return{x:()=>(0,a.mul)(e,(0,o.sigmoid)(n))}}}},579817:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.spaceToBatchNDGradConfig=void 0;var r=n(536217),a=n(47326);t.spaceToBatchNDGradConfig={kernelName:r.SpaceToBatchND,gradFunc:(e,t,n)=>{const{blockShape:r,paddings:o}=n;return{x:()=>(0,a.batchToSpaceND)(e,r,o)}}}},472210:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.splitVGradConfig=void 0;var r=n(536217),a=n(55108);t.splitVGradConfig={kernelName:r.SplitV,gradFunc:(e,t,n)=>{const{axis:r}=n;return{x:()=>(0,a.concat)(e,r)}}}},28325:(e,t,n)=>{"use strict";
1Object.defineProperty(t,"__esModule",{value:!0}),t.sqrtGradConfig=void 0;var r=n(536217),a=n(386565),o=n(67282),s=n(295702),i=n(435438);t.sqrtGradConfig={kernelName:r.Sqrt,inputsToSave:["x"],gradFunc:(e,t)=>{const[n]=t;return{x:()=>(0,o.div)(e,(0,s.mul)((0,i.sqrt)((0,a.cast)(n,"float32")),2))}}}},496729:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.squareGradConfig=void 0;var r=n(536217),a=n(386565),o=n(295702);t.squareGradConfig={kernelName:r.Square,inputsToSave:["x"],gradFunc:(e,t)=>{const[n]=t;return{x:()=>(0,o.mul)(e,(0,o.mul)((0,a.cast)(n,"float32"),2))}}}},639:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.squaredDifferenceGradConfig=void 0;var r=n(536217),a=n(295702),o=n(454179),s=n(702222);t.squaredDifferenceGradConfig={kernelName:r.SquaredDifference,inputsToSave:["a","b"],gradFunc:(e,t)=>{const[n,r]=t,i=(0,o.scalar)(2);return{a:()=>(0,a.mul)(e,(0,a.mul)(i,(0,s.sub)(n,r))),b:()=>(0,a.mul)(e,(0,a.mul)(i,(0,s.sub)(r,n)))}}}},865669:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.stepGradConfig=void 0;var r=n(536217),a=n(166119);t.stepGradConfig={kernelName:r.Step,gradFunc:e=>({x:()=>(0,a.zerosLike)(e)})}}
1,710133:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.subGradConfig=void 0;var r=n(536217),a=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=c(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if("default"!==o&&{}.hasOwnProperty.call(e,o)){var s=a?Object.getOwnPropertyDescriptor(e,o):null;s&&(s.get||s.set)?Object.defineProperty(r,o,s):r[o]=e[o]}return r.default=e,n&&n.set(e,r),r}(n(534779)),o=n(193617),s=n(195476),i=n(450126);function c(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(c=function(e){return e?n:t})(e)}t.subGradConfig={kernelName:r.Sub,inputsToSave:["a","b"],gradFunc:(e,t)=>{const[n,r]=t,c=a.assertAndGetBroadcastShape(n.shape,r.shape);return{a:()=>{let t=e;const r=a.getReductionAxes(n.shape,c);return r.length>0&&(t=(0,i.sum)(t,r)),(0,s.reshape)(t,n.shape)},b:()=>{let t=e;const n=a.getReductionAxes(r.shape,c);return n.length>0&&(t=(0,i.sum)(t,n)),(0,s.reshape)((0,o.neg)(t),r.shape)}}}}},939660:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.sumGradConfig=void 0;var r=n(536217),a=n(295702),o=n(678281),s=n(195476),i=n(904737);t.sumGradConfig={kernelName:r.Sum,inputsToSave:["x"],gradFunc:(e,t,n)=>{const[r]=t,c=r.shape.slice(),{axis:l}=n;(0,i.parseAxisParam)(l,r.shape).forEach((e=>{c[e]=1}));const u=(0,s.reshape)(e,c),d=(0,a.mul)(u,(0,o.ones)(r.shape,"float32"));return{x:()=>d}}}},497690:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.tanGradConfig=void 0;var r=n(536217),a=n(317321),o=n(67282),s=n(985987);t.tanGradConfig={kernelName:r.Tan,inputsToSave:["x"],gradFunc:(e,t)=>{const[n]=t;return{x:()=>(0,o.div)(e,(0,s.square)((0,a.cos)(n)))}}}},273:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.tanhGradConfig=void 0;var r=n(536217),a=n(295702),o=n(454179),s=n(985987),i=n(702222);t.tanhGradConfig={kernelName:r.Tanh,outputsToSave:[!0],gradFunc:(e,t)=>{const[n]=t;return{x:()=>(0,a.mul)((0,i.sub)((0,o.scalar)(1),(0,s.square)(n)),e)}}}},116932:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.tileGradConfig=void 0;var r=n(536217),a=n(353632),o=n(247565),s=n(166119);t.tileGradConfig={kernelName:r.Tile,inputsToSave:["x"],gradFunc:(e,t,n)=>{const[r]=t,{reps:i}=n;return{x:()=>{let t=(0,s.zerosLike)(r);if(1===r.rank)for(let n=0;n<i[0];++n)t=(0,a.add)(t,(0,o.slice)(e,[n*r.shape[0]],[r.shape[0]]));else if(2===r.rank)for(let n=0;n<i[0];++n)for(let s=0;s<i[1];++s)t=(0,a.add)(t,(0,o.slice)(e,[n*r.shape[0],s*r.shape[1]],[r.shape[0],r.shape[1]]));else if(3===r.rank)for(let n=0;n<i[0];++n)for(let s=0;s<i[1];++s)for(let c=0;c<i[2];++c)t=(0,a.add)(t,(0,o.slice)(e,[n*r.shape[0],s*r.shape[1],c*r.shape[2]],[r.shape[0],r.shape[1],r.shape[2]]));else{if(4!==r.rank)throw new Error("Gradient for tile operation is not implemented for rank-"+"".concat(r.rank," tensors yet."));for(let n=0;n<i[0];++n)for(let s=0;s<i[1];++s)for(let c=0;c<i[2];++c)for(let l=0;l<i[3];++l)t=(0,a.add)(t,(0,o.slice)(e,[n*r.shape[0],s*r.shape[1],c*r.shape[2],l*r.shape[3]],[r.shape[0],r.shape[1],r.shape[2],r.shape[3]]))}return t}}}}},980795:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.transposeGradConfig=void 0;var r=n(536217),a=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=s(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if("default"!==o&&{}.hasOwnProperty.call(e,o)){var i=a?Object.getOwnPropertyDescriptor(e,o):null;i&&(i.get||i.set)?Object.defineProperty(r,o,i):r[o]=e[o]}return r.default=e,n&&n.set(e,r),r}(n(247731)),o=n(688129);function s(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(s=function(e){return e?n:t})(e)}t.transposeGradConfig={kernelName:r.Transpose,gradFunc:(e,t,n)=>{const r=n,{perm:s}=r,i=a.getUndoAxesPermutation(s);return{x:()=>(0,o.transpose)(e,i)}}}},401850:(e,t,n)=>{"use strict";
1Object.defineProperty(t,"__esModule",{value:!0}),t.unpackGradConfig=void 0;var r=n(536217),a=n(421637);t.unpackGradConfig={kernelName:r.Unpack,gradFunc:(e,t,n)=>{const r=n,{axis:o}=r;return{value:()=>(0,a.stack)(e,o)}}}},932871:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.unsortedSegmentSumGradConfig=void 0;var r=n(536217),a=n(621724),o=n(589205),s=n(955497),i=n(586386),c=n(720036),l=n(678281),u=n(454179),d=n(376131),p=n(166119);t.unsortedSegmentSumGradConfig={kernelName:r.UnsortedSegmentSum,inputsToSave:["segmentIds"],gradFunc:(e,t)=>{const[n]=t;return{x:()=>function(e,t){const n=(0,c.maximum)(t,(0,p.zerosLike)(t)),r=(0,o.gather)(e,n);let h=(0,s.greaterEqual)(t,(0,u.scalar)(0,"int32"));const f=r.rank-h.rank;for(let e=0;e<f;++e)h=(0,a.expandDims)(h,e+1);h=(0,i.logicalAnd)(h,(0,l.ones)(r.shape,"bool"));const m=(0,p.zerosLike)(r);return(0,d.where)(h,r,m)}(e,n)}}}},55858:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.zerosLikeGradConfig=void 0;var r=n(536217),a=n(166119);t.zerosLikeGradConfig={kernelName:r.ZerosLike,gradFunc:e=>({x:()=>(0,a.zerosLike)(e)})}},963485:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.gradForMinAndMax=function(e,t,n,c){t.rank<n.rank&&(t=(0,i.reshape)(t,r.expandShapeToKeepDim(t.shape,c)));e.rank<n.rank&&(e=(0,i.reshape)(e,r.expandShapeToKeepDim(e.shape,c)));return{x:()=>(0,s.mul)(e,(0,a.cast)((0,o.equal)(n,t),e.dtype))}};var r=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=c(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if("default"!==o&&{}.hasOwnProperty.call(e,o)){var s=a?Object.getOwnPropertyDescriptor(e,o):null;s&&(s.get||s.set)?Object.defineProperty(r,o,s):r[o]=e[o]}return r.default=e,n&&n.set(e,r),r}(n(247731)),a=n(386565),o=n(674655),s=n(295702),i=n(195476);function c(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(c=function(e){return e?n:t})(e)}},474757:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.fingerPrint64=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:e.length;const n=o.fromNumber(81,!0);if(t<=32)return t<=16?function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:e.length;if(t>=8){const n=l.add(2*t),r=p(e,0).add(l),a=p(e,t-8);return m(f(a,37).mul(n).add(r),f(r,25).add(a).mul(n),n)}if(t>=4){const n=l.add(2*t);return m(h(e,0).shl(3).add(t),h(e,t-4),n)}if(t>0){const n=e[0]+(e[t>>1]<<8),r=t+(e[t-1]<<2);return u(l.mul(n).xor(i.mul(r))).mul(l)}return l}(e,t):function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:e.length;const n=l.add(2*t),r=p(e,0).mul(c),a=p(e,8),o=p(e,t-8).mul(n),s=p(e,t-16).mul(l);return m(f(r.add(a),43).add(f(o,30)).add(s),r.add(f(a.add(l),18)).add(o),n)}(e,t);if(t<=64)return function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:e.length;const n=l.add(2*t),r=p(e,0).mul(l),a=p(e,8),o=p(e,t-8).mul(n),s=p(e,t-16).mul(l),i=f(r.add(a),43).add(f(o,30)).add(s),c=m(i,r.add(f(a.add(l),18)).add(o),n),u=p(e,16).mul(n),d=p(e,24),h=i.add(p(e,t-32)).mul(n),g=c.add(p(e,t-24)).mul(n);return m(f(u.add(d),43).add(f(h,30)).add(g),u.add(f(d.add(r),18)).add(h),n)}(e,t);let r=n,a=n.mul(c).add(113),s=u(a.mul(l).add(113)).mul(l),d=[o.UZERO,o.UZERO],y=[o.UZERO,o.UZERO];r=r.mul(l).add(p(e,0));let v=0;const b=64*(t-1>>6),x=b+(t-1&63)-63;do{r=f(r.add(a).add(d[0]).add(p(e,v+8)),37).mul(c),a=f(a.add(d[1]).add(p(e,v+48)),42).mul(c),r=r.xor(y[1]),a=a.add(d[0]).add(p(e,v+40)),s=f(s.add(y[0]),33).mul(c),d=g(e,v,d[1].mul(c),r.add(y[0])),y=g(e,v+32,s.add(y[1]),a.add(p(e,v+16))),[s,r]=[r,s],v+=64}while(v!==b);const w=c.add(s.and(255).shl(1));return v=x,y[0]=y[0].add(t-1&63),d[0]=d[0].add(y[0]),y[0]=y[0].add(d[0]),r=f(r.add(a).add(d[0]).add(p(e,v+8)),37).mul(w),a=f(a.add(d[1]).add(p(e,v+48)),42).mul(w),r=r.xor(y[1].mul(9)),a=a.add(d[0].mul(9).add(p(e,v+40))),s=f(s.add(y[0]),33).mul(w),d=g(e,v,d[1].mul(w),r.add(y[0])),y=g(e,v+32,s.add(y[1]),a.add(p(e,v+16))),[s,r]=[r,s],m(m(d[0],y[0],w).add(u(a).mul(i)).add(s),m(d[1],y[1],w).add(r),w)},t.hexToLong=s;
1var r=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=a(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var s in e)if("default"!==s&&{}.hasOwnProperty.call(e,s)){var i=o?Object.getOwnPropertyDescriptor(e,s):null;i&&(i.get||i.set)?Object.defineProperty(r,s,i):r[s]=e[s]}return r.default=e,n&&n.set(e,r),r}(n(343720));function a(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(a=function(e){return e?n:t})(e)}const o=r.default||r;function s(e){return o.fromString(e,!0,16)}const i=s("c3a5c85c97cb3127"),c=s("b492b66fbe98f273"),l=s("9ae16a3b2f90404f");function u(e){return e.xor(e.shru(47))}function d(e,t,n){const r=e.slice(t,t+n);return o.fromBytes(Array.from(r),!0,!0)}function p(e,t){return d(e,t,8)}function h(e,t){return d(e,t,4)}function f(e,t){return 0===t?e:e.shru(t).or(e.shl(64-t))}function m(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:s("9ddfea08eb382d69"),r=e.xor(t).mul(n);r=r.xor(r.shru(47));let a=t.xor(r).mul(n);return a=a.xor(a.shru(47)),a=a.mul(n),a}function g(e,t,n,r){return function(e,t,n,r,a,o){a=a.add(e),o=f(o.add(a).add(r),21);const s=a;return a=(a=a.add(t)).add(n),o=o.add(f(a,44)),[a.add(r),o.add(s)]}(p(e,t),p(e,t+8),p(e,t+16),p(e,t+24),n,r)}},735534:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),n(150889);var r=n(928608);Object.keys(r).forEach((function(e){"default"!==e&&"__esModule"!==e&&(e in t&&t[e]===r[e]||Object.defineProperty(t,e,{enumerable:!0,get:function(){return r[e]}}))}))},792248:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.BrowserDownloads=void 0,t.browserDownloads=u,t.browserDownloadsRouter=void 0,t.browserFiles=function(e){return new c(e)},n(19445);var r=n(598257),a=n(259426),o=n(668857);function s(e){return new Promise((e=>setTimeout(e))).then(e)}class i{constructor(e){if(!(0,r.env)().getBool("IS_BROWSER"))throw new Error("browserDownloads() cannot proceed because the current environment is not a browser.");e.startsWith(i.URL_SCHEME)&&(e=e.slice(i.URL_SCHEME.length)),null!=e&&0!==e.length||(e="model"),this.modelJsonFileName=e+".json",this.weightDataFileName=e+".weights.bin"}async save(e){if("undefined"==typeof document)throw new Error("Browser downloads are not supported in this environment since `document` is not present");const t=window.URL.createObjectURL(new Blob([e.weightData],{type:"application/octet-stream"}));if(e.modelTopology instanceof ArrayBuffer)throw new Error("BrowserDownloads.save() does not support saving model topology in binary formats yet.");{const n=[{paths:["./"+this.weightDataFileName],weights:e.weightSpecs}],r=(0,a.getModelJSONForModelArtifacts)(e,n),o=window.URL.createObjectURL(new Blob([JSON.stringify(r)],{type:"application/json"})),i=null==this.modelJsonAnchor?document.createElement("a"):this.modelJsonAnchor;if(i.download=this.modelJsonFileName,i.href=o,await s((()=>i.dispatchEvent(new MouseEvent("click")))),null!=e.weightData){const e=null==this.weightDataAnchor?document.createElement("a"):this.weightDataAnchor;e.download=this.weightDataFileName,e.href=t,await s((()=>e.dispatchEvent(new MouseEvent("click"))))}return{modelArtifactsInfo:(0,a.getModelArtifactsInfoForJSON)(e)}}}}t.BrowserDownloads=i,i.URL_SCHEME="downloads://";class c{constructor(e){if(null==e||e.length<1)throw new Error("When calling browserFiles, at least 1 file is required, "+"but received ".concat(e));this.jsonFile=e[0],this.weightsFiles=e.slice(1)}async load(){return new Promise(((e,t)=>{const n=new FileReader;n.onload=n=>{const r=JSON.parse(n.target.result),o=r.modelTopology;if(null==o)return void t(new Error("modelTopology field is missing from file ".concat(this.jsonFile.name)));if(null==r.weightsManifest)return void t(new Error("weightManifest field is missing from file ".concat(this.jsonFile.name)));if(0===this.weightsFiles.length)return void e({modelTopology:o});const s=(0,a.getModelArtifactsForJSON)(r,(e=>this.loadWeights(e)));e(s)},n.onerror=e=>t("Failed to read model topology and weights manifest JSON "+"from file '".concat(this.jsonFile.name,"'. BrowserFiles supports loading ")+"Keras-style tf.Model artifacts only."),n.readAsText(this.jsonFile)}))}loadWeights(e){const t=[],n=[];for(const r of e)t.push(...r.weights),n.push(...r.paths);const r=this.checkManifestAndWeightFiles(e),o=n.map((e=>
1this.loadWeightsFile(e,r[e])));return Promise.all(o).then((e=>[t,(0,a.concatenateArrayBuffers)(e)]))}loadWeightsFile(e,t){return new Promise(((n,r)=>{const a=new FileReader;a.onload=e=>{const t=e.target.result;n(t)},a.onerror=t=>r("Failed to weights data from file of path '".concat(e,"'.")),a.readAsArrayBuffer(t)}))}checkManifestAndWeightFiles(e){const t=[],n=this.weightsFiles.map((e=>(0,a.basename)(e.name))),r={};for(const o of e)o.paths.forEach((e=>{const o=(0,a.basename)(e);if(-1!==t.indexOf(o))throw new Error("Duplicate file basename found in weights manifest: "+"'".concat(o,"'"));if(t.push(o),-1===n.indexOf(o))throw new Error("Weight file with basename '".concat(o,"' is not provided."));r[e]=this.weightsFiles[n.indexOf(o)]}));if(t.length!==this.weightsFiles.length)throw new Error("Mismatch in the number of files in weights manifest "+"(".concat(t.length,") and the number of weight files provided ")+"(".concat(this.weightsFiles.length,")."));return r}}const l=e=>(0,r.env)().getBool("IS_BROWSER")&&!Array.isArray(e)&&e.startsWith(i.URL_SCHEME)?u(e.slice(i.URL_SCHEME.length)):null;function u(){return new i(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"model")}t.browserDownloadsRouter=l,o.IORouterRegistry.registerSaveRouter(l)},894509:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.HTTPRequest=void 0,t.browserHTTPRequest=function(e,t){return p(e,t)},t.http=p,t.httpRouter=void 0,t.isHTTPScheme=u,t.parseUrl=l;var r=n(598257),a=n(904737),o=n(259426),s=n(668857),i=n(805862);class c{constructor(e,t){if(this.DEFAULT_METHOD="POST",null==t&&(t={}),this.weightPathPrefix=t.weightPathPrefix,this.onProgress=t.onProgress,this.weightUrlConverter=t.weightUrlConverter,null!=t.fetchFunc?((0,a.assert)("function"==typeof t.fetchFunc,(()=>"Must pass a function that matches the signature of `fetch` (see https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API)")),this.fetch=t.fetchFunc):this.fetch=(0,r.env)().platform.fetch,(0,a.assert)(null!=e&&e.length>0,(()=>"URL path for http must not be null, undefined or empty.")),Array.isArray(e)&&(0,a.assert)(2===e.length,(()=>"URL paths for http must have a length of 2, "+"(actual length is ".concat(e.length,")."))),this.path=e,null!=t.requestInit&&null!=t.requestInit.body)throw new Error("requestInit is expected to have no pre-existing body, but has one.");this.requestInit=t.requestInit||{}}async save(e){if(e.modelTopology instanceof ArrayBuffer)throw new Error("BrowserHTTPRequest.save() does not support saving model topology in binary formats yet.");const t=Object.assign({method:this.DEFAULT_METHOD},this.requestInit);t.body=new FormData;const n=[{paths:["./model.weights.bin"],weights:e.weightSpecs}],r=(0,o.getModelJSONForModelArtifacts)(e,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");const a=await this.fetch(this.path,t);if(a.ok)return{modelArtifactsInfo:(0,o.getModelArtifactsInfoForJSON)(e),responses:[a]};throw new Error("BrowserHTTPRequest.save() failed due to HTTP response status "+"".concat(a.status,"."))}async load(){const e=await this.fetch(this.path,this.requestInit);if(!e.ok)throw new Error("Request to ".concat(this.path," failed with status code ")+"".concat(e.status,". Please verify this URL points to ")+"the model JSON of the model to load.");let t;try{t=await e.json()}catch(e){let t="Failed to parse model JSON of response from ".concat(this.path,".");throw this.path.endsWith(".pb")?t+=" Your path contains a .pb file extension. Support for .pb models have been removed in TensorFlow.js 1.0 in favor of .json models. You can re-convert your Python TensorFlow model using the TensorFlow.js 1.0 conversion scripts or you can convert your.pb models with the 'pb2json'NPM script in the tensorflow/tfjs-converter repository.":t+=" Please make sure the server is serving valid JSON for this request.",new Error(t)}const n=t.modelTopology,r=t.weightsManifest;if(null==n&&null==r)throw new Error("The JSON from HTTP path ".concat(this.path,"
1contains neither model ")+"topology or manifest for weights.");return(0,o.getModelArtifactsForJSON)(t,(e=>this.loadWeights(e)))}async loadWeights(e){const t=Array.isArray(this.path)?this.path[1]:this.path,[n,r]=l(t),a=this.weightPathPrefix||n,s=[];for(const t of e)s.push(...t.weights);const c=[],u=[];for(const t of e)for(const e of t.paths)null!=this.weightUrlConverter?u.push(this.weightUrlConverter(e)):c.push(a+e+r);this.weightUrlConverter&&c.push(...await Promise.all(u));const d=await(0,i.loadWeightsAsArrayBuffer)(c,{requestInit:this.requestInit,fetchFunc:this.fetch,onProgress:this.onProgress});return[s,(0,o.concatenateArrayBuffers)(d)]}}function l(e){const t=e.lastIndexOf("/"),n=e.lastIndexOf("?");return[e.substring(0,t)+"/",n>t?e.substring(n):""]}function u(e){return null!=e.match(c.URL_SCHEME_REGEX)}t.HTTPRequest=c,c.URL_SCHEME_REGEX=/^https?:\/\//;const d=(e,t)=>{if("undefined"==typeof fetch&&(null==t||null==t.fetchFunc))return null;{let n=!0;if(n=Array.isArray(e)?e.every((e=>u(e))):u(e),n)return p(e,t)}return null};function p(e,t){return new c(e,t)}t.httpRouter=d,s.IORouterRegistry.registerSaveRouter(d),s.IORouterRegistry.registerLoadRouter(d)},113829:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.BrowserIndexedDBManager=t.BrowserIndexedDB=void 0,t.browserIndexedDB=h,t.deleteDatabase=async function(){const e=l();return new Promise(((t,n)=>{const r=e.deleteDatabase(s);r.onsuccess=()=>t(),r.onerror=e=>n(e)}))},t.indexedDBRouter=void 0,n(19445);var r=n(598257),a=n(259426),o=n(668857);const s="tensorflowjs",i="models_store",c="model_info_store";function l(){if(!(0,r.env)().getBool("IS_BROWSER"))throw new Error("Failed to obtain IndexedDB factory because the current environmentis not a web browser.");const e="undefined"==typeof window?self:window,t=e.indexedDB||e.mozIndexedDB||e.webkitIndexedDB||e.msIndexedDB||e.shimIndexedDB;if(null==t)throw new Error("The current browser does not appear to support IndexedDB.");return t}function u(e){const t=e.result;t.createObjectStore(i,{keyPath:"modelPath"}),t.createObjectStore(c,{keyPath:"modelPath"})}class d{constructor(e){if(this.indexedDB=l(),null==e||!e)throw new Error("For IndexedDB, modelPath must not be null, undefined or empty.");this.modelPath=e}async save(e){if(e.modelTopology instanceof ArrayBuffer)throw new Error("BrowserLocalStorage.save() does not support saving model topology in binary formats yet.");return this.databaseAction(this.modelPath,e)}async load(){return this.databaseAction(this.modelPath)}databaseAction(e,t){return new Promise(((e,n)=>{const r=this.indexedDB.open(s,1);r.onupgradeneeded=()=>u(r),r.onsuccess=()=>{const o=r.result;if(null==t){const t=o.transaction(i,"readonly"),r=t.objectStore(i).get(this.modelPath);r.onsuccess=()=>{if(null==r.result)return o.close(),n(new Error("Cannot find model with path '".concat(this.modelPath,"' ")+"in IndexedDB."));e(r.result.modelArtifacts)},r.onerror=e=>(o.close(),n(r.error)),t.oncomplete=()=>o.close()}else{const r=(0,a.getModelArtifactsInfoForJSON)(t),s=o.transaction(c,"readwrite");let l=s.objectStore(c);const u=l.put({modelPath:this.modelPath,modelArtifactsInfo:r});let d;u.onsuccess=()=>{d=o.transaction(i,"readwrite");const a=d.objectStore(i).put({modelPath:this.modelPath,modelArtifacts:t,modelArtifactsInfo:r});a.onsuccess=()=>e({modelArtifactsInfo:r}),a.onerror=e=>{l=s.objectStore(c);const t=l.delete(this.modelPath);t.onsuccess=()=>(o.close(),n(a.error)),t.onerror=e=>(o.close(),n(a.error))}},u.onerror=e=>(o.close(),n(u.error)),s.oncomplete=()=>{null==d?o.close():d.oncomplete=()=>o.close()}}},r.onerror=e=>n(r.error)}))}}t.BrowserIndexedDB=d,d.URL_SCHEME="indexeddb://";const p=e=>(0,r.env)().getBool("IS_BROWSER")&&!Array.isArray(e)&&e.startsWith(d.URL_SCHEME)?h(e.slice(d.URL_SCHEME.length)):null;function h(e){return new d(e)}t.indexedDBRouter=p,o.IORouterRegistry.registerSaveRouter(p),o.IORouterRegistry.registerLoadRouter(p);t.BrowserIndexedDBManager=class{constructor(){this.indexedDB=l()}async listModels(){return new Promise(((e,t)=>{const n=this.indexedDB.open(s,1);n.onupgradeneeded=()=>u(n),n.onsuccess=()=>{const r=n.result,a=r.transaction(c,"readonly"),o=a.objectStore(c).getAll();o.onsuccess=()=>{const t={};for(const e of o.result)t[e.modelPath]=e.modelArtifactsInfo;e(t)},o.onerror=e=>(r.close(),t(o.error)),a.oncomplete=()=>r.close()},n.onerror=e=>t(n.error)}))}async removeModel(e){var t;return e=(t=e).startsWith(d.URL_SCHEME)?t.slice(d.URL_SCHEME.length):t,new Promise(((t,n)=>{const r=this.indexedDB.open(s,1);r.onupgradeneeded=()=>u(r),r.onsuccess=()=>{const a=r.result,o=a.transaction(c,"readwrite"),s=o.objectStore(c),l=s.get(e);let u;l.onsuccess=()=>
1{if(null==l.result)return a.close(),n(new Error("Cannot find model with path '".concat(e,"' ")+"in IndexedDB."));{const r=s.delete(e),o=()=>{u=a.transaction(i,"readwrite");const r=u.objectStore(i).delete(e);r.onsuccess=()=>t(l.result.modelArtifactsInfo),r.onerror=e=>n(l.error)};r.onsuccess=o,r.onerror=e=>(o(),a.close(),n(l.error))}},l.onerror=e=>(a.close(),n(l.error)),o.oncomplete=()=>{null==u?a.close():u.oncomplete=()=>a.close()}},r.onerror=e=>n(r.error)}))}}},393449:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"browserFiles",{enumerable:!0,get:function(){return r.browserFiles}}),Object.defineProperty(t,"browserHTTPRequest",{enumerable:!0,get:function(){return a.browserHTTPRequest}}),Object.defineProperty(t,"concatenateArrayBuffers",{enumerable:!0,get:function(){return o.concatenateArrayBuffers}}),Object.defineProperty(t,"copyModel",{enumerable:!0,get:function(){return l.copyModel}}),Object.defineProperty(t,"decodeWeights",{enumerable:!0,get:function(){return o.decodeWeights}}),Object.defineProperty(t,"encodeWeights",{enumerable:!0,get:function(){return o.encodeWeights}}),Object.defineProperty(t,"fromMemory",{enumerable:!0,get:function(){return s.fromMemory}}),Object.defineProperty(t,"getLoadHandlers",{enumerable:!0,get:function(){return i.getLoadHandlers}}),Object.defineProperty(t,"getModelArtifactsForJSON",{enumerable:!0,get:function(){return o.getModelArtifactsForJSON}}),Object.defineProperty(t,"getModelArtifactsInfoForJSON",{enumerable:!0,get:function(){return o.getModelArtifactsInfoForJSON}}),Object.defineProperty(t,"getSaveHandlers",{enumerable:!0,get:function(){return i.getSaveHandlers}}),Object.defineProperty(t,"http",{enumerable:!0,get:function(){return a.http}}),Object.defineProperty(t,"isHTTPScheme",{enumerable:!0,get:function(){return a.isHTTPScheme}}),Object.defineProperty(t,"listModels",{enumerable:!0,get:function(){return l.listModels}}),Object.defineProperty(t,"loadWeights",{enumerable:!0,get:function(){return c.loadWeights}}),Object.defineProperty(t,"moveModel",{enumerable:!0,get:function(){return l.moveModel}}),Object.defineProperty(t,"registerLoadRouter",{enumerable:!0,get:function(){return i.registerLoadRouter}}),Object.defineProperty(t,"registerSaveRouter",{enumerable:!0,get:function(){return i.registerSaveRouter}}),Object.defineProperty(t,"removeModel",{enumerable:!0,get:function(){return l.removeModel}}),Object.defineProperty(t,"weightsLoaderFactory",{enumerable:!0,get:function(){return c.weightsLoaderFactory}}),Object.defineProperty(t,"withSaveHandler",{enumerable:!0,get:function(){return s.withSaveHandler}}),n(113829),n(620530);var r=n(792248),a=n(894509),o=n(259426),s=n(423787),i=n(668857),c=n(805862),l=n(175827)},259426:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.arrayBufferToBase64String=function(e){if(l)return Buffer.from(e).toString("base64");const t=new Uint8Array(e);let n="";for(let e=0,r=t.length;e<r;e++)n+=String.fromCharCode(t[e]);return btoa(n)},t.base64StringToArrayBuffer=function(e){if(l){const t=Buffer.from(e,"base64");return t.buffer.slice(t.byteOffset,t.byteOffset+t.byteLength)}const t=atob(e),n=new Uint8Array(t.length);for(let e=0;e<t.length;++e)n.set([t.charCodeAt(e)],e);return n.buffer},t.basename=function(e){e=e.trim();for(;e.endsWith("/");)e=e.slice(0,e.length-1);const t=e.split("/");return t[t.length-1]},t.concatenateArrayBuffers=function(e){if(1===e.length)return e[0];let t=0;e.forEach((e=>{t+=e.byteLength}));const n=new Uint8Array(t);let r=0;return e.forEach((e=>{n.set(new Uint8Array(e),r),r+=e.byteLength})),n.buffer},t.concatenateTypedArrays=c,t.decodeWeights=function(e,t){const n={};let c,l=0;for(const u of t){const t=u.name,p=u.dtype,h=u.shape,f=(0,o.sizeFromShape)(h);let m;if("quantization"in u){const n=u.quantization;if("uint8"===n.dtype||"uint16"===n.dtype){if(!("min"in n)||!("scale"in n))throw new Error("Weight ".concat(u.name," with quantization ").concat(n.dtype," ")+"doesn't have corresponding metadata min and scale.")}else{if("float16"!==n.dtype)throw new Error("Weight ".concat(u.name," has unknown ")+"quantization dtype ".concat(n.dtype,". ")+"Supported quantization dtypes are: 'uint8', 'uint16', and 'float16'.");if("float32"!==p)throw new Error("Weight ".concat(u.name," is quantized with ").concat(n.dtype," ")+"which only supports weights of type float32 not ".concat(p,"."))}const r=s.DTYPE_VALUE_SIZE_MAP[n.dtype],a=e.slice(l,l+f*r),o="uint8"===n.dtype?new Uint8Array(a):new Uint16Array(a);
1if("float32"===p)if("uint8"===n.dtype||"uint16"===n.dtype){m=new Float32Array(o.length);for(let e=0;e<o.length;e++){const t=o[e];m[e]=t*n.scale+n.min}}else{if("float16"!==n.dtype)throw new Error("Unsupported quantization type ".concat(n.dtype," ")+"for weight type float32.");void 0===c&&(c=d()),m=c(o)}else{if("int32"!==p)throw new Error("Unsupported dtype in weight '".concat(t,"': ").concat(p));if("uint8"!==n.dtype&&"uint16"!==n.dtype)throw new Error("Unsupported quantization type ".concat(n.dtype," ")+"for weight type int32.");m=new Int32Array(o.length);for(let e=0;e<o.length;e++){const t=o[e];m[e]=Math.round(t*n.scale+n.min)}}l+=f*r}else if("string"===p){const t=(0,o.sizeFromShape)(u.shape);m=[];for(let n=0;n<t;n++){const t=new Uint32Array(e.slice(l,l+i))[0];l+=i;const n=new Uint8Array(e.slice(l,l+t));m.push(n),l+=t}}else{const o=s.DTYPE_VALUE_SIZE_MAP[p],i=e.slice(l,l+f*o);if("float32"===p)m=new Float32Array(i);else if("int32"===p)m=new Int32Array(i);else if("bool"===p)m=new Uint8Array(i);else{if("complex64"!==p)throw new Error("Unsupported dtype in weight '".concat(t,"': ").concat(p));{m=new Float32Array(i);const e=new Float32Array(m.length/2),o=new Float32Array(m.length/2);for(let t=0;t<e.length;t++)e[t]=m[2*t],o[t]=m[2*t+1];const s=(0,a.tensor)(e,h,"float32"),c=(0,a.tensor)(o,h,"float32");n[t]=(0,r.complex)(s,c),s.dispose(),c.dispose()}}l+=f*o}"complex64"!==p&&(n[t]=(0,a.tensor)(m,h,p))}return n},t.encodeWeights=async function(e,t){const n=[],r=[],a=Array.isArray(e)?e.map((e=>e.name)):Object.keys(e);for(let o=0;o<a.length;++o){const s=a[o],c=Array.isArray(e)?e[o].tensor:e[s];if("float32"!==c.dtype&&"int32"!==c.dtype&&"bool"!==c.dtype&&"string"!==c.dtype&&"complex64"!==c.dtype)throw new Error("Unsupported dtype in weight '".concat(s,"': ").concat(c.dtype));const l={name:s,shape:c.shape,dtype:c.dtype};if("string"===c.dtype){const e=new Promise((async e=>{const t=await c.bytes(),n=t.reduce(((e,t)=>e+t.length),0)+i*t.length,r=new Uint8Array(n);let a=0;for(let e=0;e<t.length;e++){const n=t[e],o=new Uint8Array(new Uint32Array([n.length]).buffer);r.set(o,a),a+=i,r.set(n,a),a+=n.length}e(r)}));r.push(e)}else r.push(c.data());null!=t&&(l.group=t),n.push(l)}return{data:c(await Promise.all(r)),specs:n}},t.getFloat16Decoder=d,t.getModelArtifactsForJSON=async function(e,t){const n={modelTopology:e.modelTopology,format:e.format,generatedBy:e.generatedBy,convertedBy:e.convertedBy};null!=e.trainingConfig&&(n.trainingConfig=e.trainingConfig);if(null!=e.weightsManifest){const[r,a]=await t(e.weightsManifest);n.weightSpecs=r,n.weightData=a}null!=e.signature&&(n.signature=e.signature);null!=e.userDefinedMetadata&&(n.userDefinedMetadata=e.userDefinedMetadata);null!=e.modelInitializer&&(n.modelInitializer=e.modelInitializer);return n},t.getModelArtifactsInfoForJSON=function(e){if(e.modelTopology instanceof ArrayBuffer)throw new Error("Expected JSON model topology, received ArrayBuffer.");return{dateSaved:new Date,modelTopologyType:"JSON",modelTopologyBytes:null==e.modelTopology?0:u(JSON.stringify(e.modelTopology)),weightSpecsBytes:null==e.weightSpecs?0:u(JSON.stringify(e.weightSpecs)),weightDataBytes:null==e.weightData?0:e.weightData.byteLength}},t.getModelJSONForModelArtifacts=function(e,t){const n={modelTopology:e.modelTopology,format:e.format,generatedBy:e.generatedBy,convertedBy:e.convertedBy,weightsManifest:t};null!=e.signature&&(n.signature=e.signature);null!=e.userDefinedMetadata&&(n.userDefinedMetadata=e.userDefinedMetadata);null!=e.modelInitializer&&(n.modelInitializer=e.modelInitializer);null!=e.trainingConfig&&(n.trainingConfig=e.trainingConfig);return n},t.stringByteLength=u;var r=n(291158),a=n(995448),o=n(904737),s=n(746963);const i=4;function c(e){if(null===e)throw new Error("Invalid input value: ".concat(JSON.stringify(e)));let t=0;const n=[];e.forEach((e=>{if(t+=e.byteLength,n.push(e.byteLength===e.buffer.byteLength?e:new e.constructor(e)),!(e instanceof Float32Array||e instanceof Int32Array||e instanceof Uint8Array))throw new Error("Unsupported TypedArray subtype: ".concat(e.constructor.name))}));const r=new Uint8Array(t);let a=0;
1return n.forEach((e=>{r.set(new Uint8Array(e.buffer),a),a+=e.byteLength})),r.buffer}const l="undefined"!=typeof Buffer&&("undefined"==typeof Blob||"undefined"==typeof atob||"undefined"==typeof btoa);function u(e){return l?Buffer.byteLength(e):new Blob([e]).size}function d(){const e=function(){const e=e=>{let t=e<<13,n=0;for(;!(8388608&t);)n-=8388608,t<<=1;return t&=-8388609,n+=947912704,t|n},t=new Uint32Array(2048);t[0]=0;for(let n=1;n<1024;n++)t[n]=e(n);for(let e=1024;e<2048;e++)t[e]=939524096+(e-1024<<13);return t}(),t=function(){const e=new Uint32Array(64);e[0]=0,e[31]=1199570944,e[32]=2147483648,e[63]=3347054592;for(let t=1;t<31;t++)e[t]=t<<23;for(let t=33;t<63;t++)e[t]=2147483648+(t-32<<23);return e}(),n=function(){const e=new Uint32Array(64);for(let t=0;t<64;t++)e[t]=1024;return e[0]=e[32]=0,e}();return r=>{const a=new ArrayBuffer(4*r.length),o=new Uint32Array(a);for(let a=0;a<r.length;a++){const s=r[a],i=e[n[s>>10]+(1023&s)]+t[s>>10];o[a]=i}return new Float32Array(a)}}},620530:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.BrowserLocalStorageManager=t.BrowserLocalStorage=void 0,t.browserLocalStorage=b,t.localStorageRouter=void 0,t.purgeLocalStorageArtifacts=function(){if(!(0,r.env)().getBool("IS_BROWSER")||"undefined"==typeof window||void 0===window.localStorage)throw new Error("purgeLocalStorageModels() cannot proceed because local storage is unavailable in the current environment.");const e=window.localStorage,t=[];for(let n=0;n<e.length;++n){const r=e.key(n),a=c+i;if(r.startsWith(a)&&r.length>a.length){e.removeItem(r);const n=g(r);-1===t.indexOf(n)&&t.push(n)}}return t},n(19445);var r=n(598257),a=n(904737),o=n(259426),s=n(668857);const i="/",c="tensorflowjs_models",l="info",u="model_topology",d="weight_specs",p="weight_data",h="model_metadata";function f(e){return{info:[c,e,l].join(i),topology:[c,e,u].join(i),weightSpecs:[c,e,d].join(i),weightData:[c,e,p].join(i),modelMetadata:[c,e,h].join(i)}}function m(e){for(const t of Object.values(e))window.localStorage.removeItem(t)}function g(e){const t=e.split(i);if(t.length<3)throw new Error("Invalid key format: ".concat(e));return t.slice(1,t.length-1).join(i)}class y{constructor(e){if(!(0,r.env)().getBool("IS_BROWSER")||"undefined"==typeof window||void 0===window.localStorage)throw new Error("The current environment does not support local storage.");if(this.LS=window.localStorage,null==e||!e)throw new Error("For local storage, modelPath must not be null, undefined or empty.");this.modelPath=e,this.keys=f(this.modelPath)}async save(e){if(e.modelTopology instanceof ArrayBuffer)throw new Error("BrowserLocalStorage.save() does not support saving model topology in binary formats yet.");{const t=JSON.stringify(e.modelTopology),n=JSON.stringify(e.weightSpecs),r=(0,o.getModelArtifactsInfoForJSON)(e);try{this.LS.setItem(this.keys.info,JSON.stringify(r)),this.LS.setItem(this.keys.topology,t),this.LS.setItem(this.keys.weightSpecs,n),this.LS.setItem(this.keys.weightData,(0,o.arrayBufferToBase64String)(e.weightData));const a={format:e.format,generatedBy:e.generatedBy,convertedBy:e.convertedBy,signature:null!=e.signature?e.signature:void 0,userDefinedMetadata:null!=e.userDefinedMetadata?e.userDefinedMetadata:void 0,modelInitializer:null!=e.modelInitializer?e.modelInitializer:void 0,trainingConfig:null!=e.trainingConfig?e.trainingConfig:void 0};return this.LS.setItem(this.keys.modelMetadata,JSON.stringify(a)),{modelArtifactsInfo:r}}catch(e){throw m(this.keys),new Error("Failed to save model '".concat(this.modelPath,"' to local storage: ")+"size quota being exceeded is a possible cause of this failure: "+"modelTopologyBytes=".concat(r.modelTopologyBytes,", ")+"weightSpecsBytes=".concat(r.weightSpecsBytes,", ")+"weightDataBytes=".concat(r.weightDataBytes,"."))}}}async load(){const e=JSON.parse(this.LS.getItem(this.keys.info));if(null==e)throw new Error("In local storage, there is no model with name '".concat(this.modelPath,"'"));if("JSON"!==e.modelTopologyType)throw new Error("BrowserLocalStorage does not support loading non-JSON model topology yet.");const t={},n=JSON.parse(this.LS.getItem(this.keys.topology));if(null==n)throw new Error("In local storage, the topology of model '".concat(this.modelPath,"' ")+"is missing.");t.modelTopology=n;const r=JSON.parse(this.LS.getItem(this.keys.weightSpecs));if(null==r)throw new Error("In local storage, the weight specs of model '".concat(this.modelPath,"' ")+"are missing.");t.weightSpecs=r;const a=this.LS.getItem(this.keys.modelMetadata);if(null!=a){const e=JSON.parse(a);t.format=e.format,t.generatedBy=e.generatedBy,t.convertedBy=e.convertedBy,null!=e.signature&&(t.signature=e.signature),null!=e.userDefinedMetadata&&(t.userDefinedMetadata=e.userDefinedMetadata),null!=e.modelInitializer&&(t.modelInitializer=e.modelInitializer),null!=e.trainingConfig&&(t.trainingConfig=e.trainingConfig)}const s=this.LS.getItem(this.keys.weightData);if(null==s)throw new Error("In local storage, the binary weight values of model "+"'".concat(this.modelPath,"' are missing."));return t.weightData=(0,o.base64StringToArrayBuffer)(s),t}}t.BrowserLocalStorage=y,y.URL_SCHEME="localstorage://";const v=e=>
1(0,r.env)().getBool("IS_BROWSER")&&!Array.isArray(e)&&e.startsWith(y.URL_SCHEME)?b(e.slice(y.URL_SCHEME.length)):null;function b(e){return new y(e)}t.localStorageRouter=v,s.IORouterRegistry.registerSaveRouter(v),s.IORouterRegistry.registerLoadRouter(v);t.BrowserLocalStorageManager=class{constructor(){(0,a.assert)((0,r.env)().getBool("IS_BROWSER"),(()=>"Current environment is not a web browser")),(0,a.assert)("undefined"==typeof window||void 0!==window.localStorage,(()=>"Current browser does not appear to support localStorage")),this.LS=window.localStorage}async listModels(){const e={},t=c+i,n=i+l;for(let r=0;r<this.LS.length;++r){const a=this.LS.key(r);if(a.startsWith(t)&&a.endsWith(n)){e[g(a)]=JSON.parse(this.LS.getItem(a))}}return e}async removeModel(e){var t;const n=f(e=(t=e).startsWith(y.URL_SCHEME)?t.slice(y.URL_SCHEME.length):t);if(null==this.LS.getItem(n.info))throw new Error("Cannot find model at path '".concat(e,"'"));const r=JSON.parse(this.LS.getItem(n.info));return m(n),r}}},175827:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ModelStoreManagerRegistry=void 0,t.copyModel=async function(e,t){return c(e,t,!1)},t.listModels=async function(){const e=s.getSchemes(),t={};for(const n of e){const e=await s.getManager(n).listModels();for(const r in e){t[n+o+r]=e[r]}}return t},t.moveModel=async function(e,t){return c(e,t,!0)},t.removeModel=async function(e){const t=i(e);return s.getManager(t.scheme).removeModel(t.path)};var r=n(904737),a=n(668857);const o="://";class s{constructor(){this.managers={}}static getInstance(){return null==s.instance&&(s.instance=new s),s.instance}static registerManager(e,t){(0,r.assert)(null!=e,(()=>"scheme must not be undefined or null.")),e.endsWith(o)&&(e=e.slice(0,e.indexOf(o))),(0,r.assert)(e.length>0,(()=>"scheme must not be an empty string."));const n=s.getInstance();(0,r.assert)(null==n.managers[e],(()=>"A model store manager is already registered for scheme '".concat(e,"'."))),n.managers[e]=t}static getManager(e){const t=this.getInstance().managers[e];if(null==t)throw new Error("Cannot find model manager for scheme '".concat(e,"'"));return t}static getSchemes(){return Object.keys(this.getInstance().managers)}}function i(e){if(-1===e.indexOf(o))throw new Error("The url string provided does not contain a scheme. Supported schemes are: "+"".concat(s.getSchemes().join(",")));return{scheme:e.split(o)[0],path:e.split(o)[1]}}async function c(e,t){let n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];(0,r.assert)(e!==t,(()=>"Old path and new path are the same: '".concat(e,"'")));const o=a.IORouterRegistry.getLoadHandlers(e);(0,r.assert)(o.length>0,(()=>"Copying failed because no load handler is found for source URL ".concat(e,"."))),(0,r.assert)(o.length<2,(()=>"Copying failed because more than one (".concat(o.length,") ")+"load handlers for source URL ".concat(e,".")));const c=o[0],l=a.IORouterRegistry.getSaveHandlers(t);(0,r.assert)(l.length>0,(()=>"Copying failed because no save handler is found for destination "+"URL ".concat(t,"."))),(0,r.assert)(l.length<2,(()=>"Copying failed because more than one (".concat(o.length,") ")+"save handlers for destination URL ".concat(t,".")));const u=l[0],d=i(e).scheme,p=i(e).path,h=d===i(e).scheme,f=await c.load();n&&h&&await s.getManager(d).removeModel(p);const m=await u.save(f);return n&&!h&&await s.getManager(d).removeModel(p),m.modelArtifactsInfo}t.ModelStoreManagerRegistry=s},423787:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.fromMemory=function(e,t,r,a){if(1===arguments.length){return null!=e.modelTopology||null!=e.weightSpecs?new n(e):(console.warn("Please call tf.io.fromMemory() with only one argument. The argument should be of type ModelArtifacts. The multi-argument signature of tf.io.fromMemory() has been deprecated and will be removed in a future release."),new n({modelTopology:e}))}return console.warn("Please call tf.io.fromMemory() with only one argument. The argument should be of type ModelArtifacts. The multi-argument signature of tf.io.fromMemory() has been deprecated and will be removed in a future release."),new n({modelTopology:e,weightSpecs:t,weightData:r,trainingConfig:a})},t.withSaveHandler=function(e){return new r(e)};
1class n{constructor(e){this.modelArtifacts=e}async load(){return this.modelArtifacts}}class r{constructor(e){this.saveHandler=e}async save(e){return this.saveHandler(e)}}},366036:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.monitorPromisesProgress=function(e,t,n,a){(function(e){(0,r.assert)(null!=e&&Array.isArray(e)&&e.length>0,(()=>"promises must be a none empty array"))})(e),function(e,t){(0,r.assert)(e>=0&&e<=1,(()=>"Progress fraction must be in range [0, 1], but "+"got startFraction ".concat(e))),(0,r.assert)(t>=0&&t<=1,(()=>"Progress fraction must be in range [0, 1], but "+"got endFraction ".concat(t))),(0,r.assert)(t>=e,(()=>"startFraction must be no more than endFraction, but "+"got startFraction ".concat(e," and endFraction ")+"".concat(t)))}(n=null==n?0:n,a=null==a?1:a);let o=0;return Promise.all(e.map((r=>(r.then((r=>{const s=n+ ++o/e.length*(a-n);return t(s),r})),r))))};var r=n(904737)},668857:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.registerSaveRouter=t.registerLoadRouter=t.getSaveHandlers=t.getLoadHandlers=t.IORouterRegistry=void 0;class n{constructor(){this.saveRouters=[],this.loadRouters=[]}static getInstance(){return null==n.instance&&(n.instance=new n),n.instance}static registerSaveRouter(e){n.getInstance().saveRouters.push(e)}static registerLoadRouter(e){n.getInstance().loadRouters.push(e)}static getSaveHandlers(e){return n.getHandlers(e,"save")}static getLoadHandlers(e,t){return n.getHandlers(e,"load",t)}static getHandlers(e,t,r){const a=[];return("load"===t?n.getInstance().loadRouters:n.getInstance().saveRouters).forEach((t=>{const n=t(e,r);null!==n&&a.push(n)})),a}}t.IORouterRegistry=n;t.registerSaveRouter=e=>n.registerSaveRouter(e);t.registerLoadRouter=e=>n.registerLoadRouter(e);t.getSaveHandlers=e=>n.getSaveHandlers(e);t.getLoadHandlers=(e,t)=>n.getLoadHandlers(e,t)},746963:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.DTYPE_VALUE_SIZE_MAP=void 0;t.DTYPE_VALUE_SIZE_MAP={float32:4,float16:2,int32:4,uint16:2,uint8:1,bool:1,complex64:8}},805862:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.loadWeights=async function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",n=arguments.length>2?arguments[2]:void 0,r=arguments.length>3?arguments[3]:void 0;const a=u((e=>l(e,{requestInit:r})));return a(e,t,n)},t.loadWeightsAsArrayBuffer=l,t.weightsLoaderFactory=u;var r=n(598257),a=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=c(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if("default"!==o&&{}.hasOwnProperty.call(e,o)){var s=a?Object.getOwnPropertyDescriptor(e,o):null;s&&(s.get||s.set)?Object.defineProperty(r,o,s):r[o]=e[o]}return r.default=e,n&&n.set(e,r),r}(n(904737)),o=n(259426),s=n(366036),i=n(746963);function c(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(c=function(e){return e?n:t})(e)}async function l(e,t){null==t&&(t={});const n=null==t.fetchFunc?(0,r.env)().platform.fetch:t.fetchFunc,a=e.map((e=>n(e,t.requestInit,{isBinary:!0}))),o=(null==t.onProgress?await Promise.all(a):await(0,s.monitorPromisesProgress)(a,t.onProgress,0,.5)).map((e=>e.arrayBuffer()));return null==t.onProgress?await Promise.all(o):await(0,s.monitorPromisesProgress)(o,t.onProgress,.5,1)}function u(e){return async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",r=arguments.length>2?arguments[2]:void 0;const s=t.map((()=>!1)),c={},l=null!=r?r.map((()=>!1)):[],u=[];if(t.forEach(((e,t)=>{let n=0;e.weights.forEach((e=>{const o="quantization"in e?e.quantization.dtype:e.dtype,d=i.DTYPE_VALUE_SIZE_MAP[o]*a.sizeFromShape(e.shape),p=()=>{s[t]=!0,null==c[t]&&(c[t]=[]),c[t].push({manifestEntry:e,groupOffset:n,sizeBytes:d})};null!=r?r.forEach(((t,n)=>{t===e.name&&(p(),l[n]=!0)})):p(),u.push(e.name),n+=d}))})),!l.every((e=>e))){const e=r.filter(((e,t)=>!l[t]));throw new Error("Could not find weights in manifest with names: "+"".concat(e.join(", "),". \n")+"Manifest JSON has weights with names: "+"".concat(u.join(", "),"."))}const d=s.reduce(((e,t,n)=>(t&&e.push(n),e)),[]),p=[];d.forEach((e=>{t[e].paths.forEach((e=>{const t=n+(n.endsWith("/")?"":"/")+e;p.push(t)}))}));const h=await e(p),f={};let m=0;return d.forEach((e=>{const n=t[e].paths.length;let r=0;for(let e=0;e<n;e++)r+=h[m+e].byteLength;const a=new ArrayBuffer(r),s=new Uint8Array(a);let i=0;for(let e=0;e<n;e++){const t=new Uint8Array(h[m+e]);s.set(t,i),i+=t.byteLength}c[e].forEach((e=>{const t=a.slice(e.groupOffset,e.groupOffset+e.sizeBytes),n=(0,o.decodeWeights)(t,[e.manifestEntry]);for(const e in n)f[e]=n[e]})),m+=n})),f}}},536217:(e,t)=>{"use strict";
1Object.defineProperty(t,"__esModule",{value:!0}),t.Multinomial=t.Mod=t.MirrorPad=t.Minimum=t.Min=t.Mean=t.Maximum=t.MaxPoolWithArgmax=t.MaxPoolGrad=t.MaxPool3DGrad=t.MaxPool3D=t.MaxPool=t.Max=t.LogicalOr=t.LogicalNot=t.LogicalAnd=t.LogSoftmax=t.Log1p=t.Log=t.LinSpace=t.LessEqual=t.Less=t.LeakyRelu=t.LRNGrad=t.LRN=t.IsNan=t.IsInf=t.IsFinite=t.Imag=t.Identity=t.IFFT=t.GreaterEqual=t.Greater=t.GatherV2=t.GatherNd=t.FusedDepthwiseConv2D=t.FusedConv2D=t.FusedBatchNorm=t.FromPixels=t.FloorDiv=t.Floor=t.FlipLeftRight=t.Fill=t.FFT=t.Expm1=t.ExpandDims=t.Exp=t.Erf=t.Equal=t.EluGrad=t.Elu=t.Einsum=t.Dilation2DBackpropInput=t.Dilation2DBackpropFilter=t.Dilation2D=t.Diag=t.DepthwiseConv2dNativeBackpropInput=t.DepthwiseConv2dNativeBackpropFilter=t.DepthwiseConv2dNative=t.DepthToSpace=t.DenseBincount=t.Cumsum=t.CropAndResize=t.Cosh=t.Cos=t.Conv3DBackpropInputV2=t.Conv3DBackpropFilterV2=t.Conv3D=t.Conv2DBackpropInput=t.Conv2DBackpropFilter=t.Conv2D=t.Concat=t.ComplexAbs=t.Complex=t.ClipByValue=t.Ceil=t.Cast=t.BroadcastTo=t.BroadcastArgs=t.Bincount=t.BatchToSpaceND=t.BatchMatMul=t.AvgPoolGrad=t.AvgPool3DGrad=t.AvgPool3D=t.AvgPool=t.Atanh=t.Atan2=t.Atan=t.Asinh=t.Asin=t.ArgMin=t.ArgMax=t.Any=t.All=t.AddN=t.Add=t.Acosh=t.Acos=t.Abs=void 0,t._FusedMatMul=t.ZerosLike=t.UnsortedSegmentSum=t.Unpack=t.Unique=t.Transpose=t.Transform=t.TopK=t.Tile=t.Tanh=t.Tan=t.Sum=t.Sub=t.StringToHashBucketFast=t.StringSplit=t.StringNGrams=t.StridedSlice=t.Step=t.SquaredDifference=t.Square=t.Sqrt=t.SplitV=t.SparseToDense=t.SparseSegmentSum=t.SparseSegmentMean=t.SparseReshape=t.SparseFillEmptyRows=t.SpaceToBatchND=t.Softplus=t.Softmax=t.Slice=t.Sinh=t.Sin=t.Sign=t.Sigmoid=t.Selu=t.Select=t.ScatterNd=t.Rsqrt=t.Round=t.RotateWithOffset=t.Reverse=t.ResizeNearestNeighborGrad=t.ResizeNearestNeighbor=t.ResizeBilinearGrad=t.ResizeBilinear=t.Reshape=t.Relu6=t.Relu=t.Reciprocal=t.RealDiv=t.Real=t.Range=t.Prod=t.Prelu=t.Pow=t.Pool=t.PadV2=t.Pack=t.OnesLike=t.OneHot=t.NotEqual=t.NonMaxSuppressionV5=t.NonMaxSuppressionV4=t.NonMaxSuppressionV3=t.Neg=t.Multiply=void 0;t.Abs="Abs",t.Acos="Acos",t.Acosh="Acosh",t.Add="Add",t.AddN="AddN",t.All="All",t.Any="Any",t.ArgMax="ArgMax",t.ArgMin="ArgMin",t.Asin="Asin",t.Asinh="Asinh",t.Atan="Atan",t.Atanh="Atanh",t.Atan2="Atan2",t.AvgPool="AvgPool",t.AvgPoolGrad="AvgPoolGrad",t.AvgPool3D="AvgPool3D",t.AvgPool3DGrad="AvgPool3DGrad",t.BatchMatMul="BatchMatMul",t.BatchToSpaceND="BatchToSpaceND",t.Bincount="Bincount",t.BroadcastTo="BroadcastTo",t.BroadcastArgs="BroadcastArgs",t.Cast="Cast",t.Ceil="Ceil",t.ClipByValue="ClipByValue",t.Complex="Complex",t.ComplexAbs="ComplexAbs",t.Concat="Concat",t.Conv2D="Conv2D",t.Conv2DBackpropFilter="Conv2DBackpropFilter",t.Conv2DBackpropInput="Conv2DBackpropInput",t.Conv3D="Conv3D",t.Conv3DBackpropFilterV2="Conv3DBackpropFilterV2",t.Conv3DBackpropInputV2="Conv3DBackpropInputV2",t.Cos="Cos",t.Cosh="Cosh",t.Cumsum="Cumsum",t.CropAndResize="CropAndResize",t.DenseBincount="DenseBincount",t.DepthToSpace="DepthToSpace",t.DepthwiseConv2dNative="DepthwiseConv2dNative",t.DepthwiseConv2dNativeBackpropFilter="DepthwiseConv2dNativeBackpropFilter",t.DepthwiseConv2dNativeBackpropInput="DepthwiseConv2dNativeBackpropInput",t.Diag="Diag",t.Dilation2D="Dilation2D",t.Dilation2DBackpropInput="Dilation2DBackpropInput",t.Dilation2DBackpropFilter="Dilation2DBackpropFilter",t.RealDiv="RealDiv",t.Einsum="Einsum",t.Elu="Elu",t.EluGrad="EluGrad",t.Erf="Erf",t.Equal="Equal",t.Exp="Exp",t.ExpandDims="ExpandDims",t.Expm1="Expm1",t.FFT="FFT",t.Fill="Fill",t.FlipLeftRight="FlipLeftRight",t.Floor="Floor",t.FloorDiv="FloorDiv",t.FusedBatchNorm="FusedBatchNorm",t.GatherV2="GatherV2",t.GatherNd="GatherNd",t.Greater="Greater",t.GreaterEqual="GreaterEqual",t.Identity="Identity",t.IFFT="IFFT",t.Imag="Imag",t.IsFinite="IsFinite",t.IsInf="IsInf",t.IsNan="IsNan",t.LeakyRelu="LeakyRelu",t.Less="Less",t.LessEqual="LessEqual",t.LinSpace="LinSpace",t.Log="Log",t.Log1p="Log1p",t.LogicalAnd="LogicalAnd",t.LogicalNot="LogicalNot",t.LogicalOr="LogicalOr",t.LogSoftmax="LogSoftmax",t.LRN="LRN",t.LRNGrad="LRNGrad",t.Max="Max",t.Maximum="Maximum",t.MaxPool="MaxPool",t.MaxPoolGrad="MaxPoolGrad",t.MaxPool3D="MaxPool3D",t.MaxPool3DGrad="MaxPool3DGrad",t.MaxPoolWithArgmax="MaxPoolWithArgmax",t.Mean="Mean",t.Min="Min",t.Minimum="Minimum",t.MirrorPad="MirrorPad",t.Mod="Mod",t.Multinomial="Multinomial",t.Multiply="Multiply",t.Neg="Neg",t.NotEqual="NotEqual",t.NonMaxSuppressionV3="NonMaxSuppressionV3",t.NonMaxSuppressionV4="NonMaxSuppressionV4",t.NonMaxSuppressionV5="NonMaxSuppressionV5",t.OnesLike="OnesLike",t.OneHot="OneHot",t.Pack="Pack",t.PadV2="PadV2",t.Pool="Pool",t.Pow="Pow",t.Prelu="Prelu",t.Prod="Prod",t.Range="Range",t.Real="Real",t.Reciprocal="Reciprocal",t.Relu="Relu",t.Reshape="Reshape",t.ResizeNearestNeighbor="ResizeNearestNeighbor",t.ResizeNearestNeighborGrad="ResizeNearestNeighborGrad",t.ResizeBilinear="ResizeBilinear",t.ResizeBilinearGrad="ResizeBilinearGrad",t.Relu6="Relu6",t.Reverse="Reverse",t.Round="Round",t.Rsqrt="Rsqrt",t.ScatterNd="ScatterNd",t.Select="Select",t.Selu="Selu",t.Slice="Slice",t.Sin="Sin",t.Sinh="Sinh",t.Sign="Sign",t.Sigmoid="Sigmoid",t.Softplus="Softplus",t.Sqrt="Sqrt",t.Sum="Sum",t.SpaceToBatchND="SpaceToBatchND",t.SplitV="SplitV",t.Softmax="Softmax",t.SparseFillEmptyRows="SparseFillEmptyRows",t.SparseReshape="SparseReshape",t.SparseSegmentMean="SparseSegmentMean",t.SparseSegmentSum="SparseSegmentSum",t.SparseToDense="SparseToDense",t.SquaredDifference="SquaredDifference",t.Square="Square",t.StridedSlice="StridedSlice",t.StringNGrams="StringNGrams",t.StringSplit="StringSplit",t.StringToHashBucketFast="Str
1ingToHashBucketFast",t.Sub="Sub",t.Tan="Tan",t.Tanh="Tanh",t.Tile="Tile",t.TopK="TopK",t.Transform="Transform",t.Transpose="Transpose",t.Unique="Unique",t.Unpack="Unpack",t.UnsortedSegmentSum="UnsortedSegmentSum",t.ZerosLike="ZerosLike",t.Step="Step",t.FromPixels="FromPixels",t.RotateWithOffset="RotateWithOffset",t._FusedMatMul="_FusedMatMul",t.FusedConv2D="FusedConv2D",t.FusedDepthwiseConv2D="FusedDepthwiseConv2D"},115354:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.copyRegisteredKernels=function(e,t){l(e).forEach((e=>{u(Object.assign({},e,{backendName:t}))}))},t.getGradient=function(e){return c.get(e)},t.getKernel=function(e,t){const n=d(e,t);return i.get(n)},t.getKernelsForBackend=l,t.registerGradient=function(e){const{kernelName:t}=e;c.has(t)&&(0,r.env)().getBool("DEBUG")&&o.warn("Overriding the gradient for '".concat(t,"'"));c.set(t,e)},t.registerKernel=u,t.unregisterGradient=function(e){if(!c.has(e))throw new Error("The gradient '".concat(e,"' for backend is not registered"));c.delete(e)},t.unregisterKernel=function(e,t){const n=d(e,t);if(!i.has(n))throw new Error("The kernel '".concat(e,"' for backend ")+"'".concat(t,"' is not registered"));i.delete(n)};var r=n(598257),a=n(923788),o=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=s(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if("default"!==o&&{}.hasOwnProperty.call(e,o)){var i=a?Object.getOwnPropertyDescriptor(e,o):null;i&&(i.get||i.set)?Object.defineProperty(r,o,i):r[o]=e[o]}return r.default=e,n&&n.set(e,r),r}(n(414429));function s(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(s=function(e){return e?n:t})(e)}const i=(0,a.getGlobal)("kernelRegistry",(()=>new Map)),c=(0,a.getGlobal)("gradRegistry",(()=>new Map));function l(e){const t=i.entries(),n=[];for(;;){const{done:r,value:a}=t.next();if(r)break;const[o,s]=a,[i]=o.split("_");i===e&&n.push(s)}return n}function u(e){const{kernelName:t,backendName:n}=e,r=d(t,n);i.has(r)&&o.warn("The kernel '".concat(t,"' for backend ")+"'".concat(n,"' is already registered")),i.set(r,e)}function d(e,t){return"".concat(t,"_").concat(e)}},414429:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.log=function(){(0,r.env)().getBool("IS_TEST")||(0,r.env)().getBool("PROD")||console.log(...arguments)},t.warn=function(){(0,r.env)().getBool("IS_TEST")||(0,r.env)().getBool("PROD")||console.warn(...arguments)};var r=n(598257)},853744:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"confusionMatrix",{enumerable:!0,get:function(){return r.confusionMatrix}});var r=n(257979)},438415:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.abs=void 0;var r=n(90337),a=n(536217),o=n(188695),s=n(930684);t.abs=(0,s.op)({abs_:function(e){const t=(0,o.convertToTensor)(e,"x","abs");if("complex64"===t.dtype){const e={x:t};return r.ENGINE.runKernel(a.ComplexAbs,e)}{const e={x:t};return r.ENGINE.runKernel(a.Abs,e)}}})},799405:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.acos=void 0;var r=n(90337),a=n(536217),o=n(188695),s=n(930684);t.acos=(0,s.op)({acos_:function(e){const t={x:(0,o.convertToTensor)(e,"x","acos")};return r.ENGINE.runKernel(a.Acos,t)}})},282356:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.acosh=void 0;var r=n(90337),a=n(536217),o=n(188695),s=n(930684);t.acosh=(0,s.op)({acosh_:function(e){const t={x:(0,o.convertToTensor)(e,"x","acosh")};return r.ENGINE.runKernel(a.Acosh,t)}})},353632:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.add=void 0;var r=n(90337),a=n(536217),o=n(390771),s=n(188695),i=n(930684);t.add=(0,i.op)({add_:function(e,t){let n=(0,s.convertToTensor)(e,"a","add"),i=(0,s.convertToTensor)(t,"b","add");[n,i]=(0,o.makeTypesMatch)(n,i);const c={a:n,b:i};return r.ENGINE.runKernel(a.Add,c)}})},635205:(e,t,n)=>{"use strict";
1Object.defineProperty(t,"__esModule",{value:!0}),t.addN=void 0;var r=n(90337),a=n(536217),o=n(188695),s=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=c(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if("default"!==o&&{}.hasOwnProperty.call(e,o)){var s=a?Object.getOwnPropertyDescriptor(e,o):null;s&&(s.get||s.set)?Object.defineProperty(r,o,s):r[o]=e[o]}return r.default=e,n&&n.set(e,r),r}(n(904737)),i=n(930684);function c(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(c=function(e){return e?n:t})(e)}t.addN=(0,i.op)({addN_:function(e){s.assert(Array.isArray(e),(()=>"The argument passed to tf.addN() must be a list of tensors")),s.assert(e.length>=1,(()=>"Must pass at least one tensor to tf.addN(), but got "+"".concat(e.length)));const t=e.map(((e,t)=>(0,o.convertToTensor)(e,"tensors".concat(t),"addN"))),n=t[0];t.forEach((e=>{if(e.dtype!==n.dtype)throw new Error("All tensors passed to tf.addN() must have the same dtype")})),t.forEach((e=>{if(!s.arraysEqual(e.shape,n.shape))throw new Error("All tensors passed to tf.addN() must have the same shape")}));const i=t;return r.ENGINE.runKernel(a.AddN,i)}})},143805:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.all=void 0;var r=n(90337),a=n(536217),o=n(188695),s=n(930684);t.all=(0,s.op)({all_:function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];const s={x:(0,o.convertToTensor)(e,"x","all","bool")},i={axis:t,keepDims:n};return r.ENGINE.runKernel(a.All,s,i)}})},695913:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.any=void 0;var r=n(90337),a=n(536217),o=n(188695),s=n(930684);t.any=(0,s.op)({any_:function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];const s={x:(0,o.convertToTensor)(e,"x","any","bool")},i={axis:t,keepDims:n};return r.ENGINE.runKernel(a.Any,s,i)}})},508147:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.argMax=void 0;var r=n(90337),a=n(536217),o=n(188695),s=n(930684);t.argMax=(0,s.op)({argMax_:function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;const n={x:(0,o.convertToTensor)(e,"x","argMax")},s={axis:t};return r.ENGINE.runKernel(a.ArgMax,n,s)}})},448740:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.argMin=void 0;var r=n(90337),a=n(536217),o=n(188695),s=n(930684);t.argMin=(0,s.op)({argMin_:function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;const n={x:(0,o.convertToTensor)(e,"x","argMin")},s={axis:t};return r.ENGINE.runKernel(a.ArgMin,n,s)}})},739042:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getPermuted=function(e,t){let n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];const r=[];if(n){r.push(t);for(let n=t+1;n<e;++n)n<=2*t?(r.push(n),r.push(n-(t+1))):r.push(n)}else{const n=[],a=[];for(let r=1;r<e;++r)r>=2*t+1||r%2==1?a.push(r):n.push(r);r.push(...n),r.push(0),r.push(...a)}return r},t.getReshaped=function(e,t,n){let r=!(arguments.length>3&&void 0!==arguments[3])||arguments[3],a=[];if(r)a=a.concat(t.slice(0)),a.push(e[0]/n),a=a.concat(e.slice(1));else{a=a.concat(e[0]);const n=t.length;for(let r=0;r<n;++r)a=a.concat([e[r+1]/t[r],t[r]]);a=a.concat(e.slice(n+1))}return a},t.getReshapedPermuted=function(e,t,n){let r=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];const a=[];r?a.push(e[0]/n):a.push(e[0]*n);for(let n=1;n<e.length;++n)n<=t.length?r?a.push(t[n-1]*e[n]):a.push(e[n]/t[n-1]):a.push(e[n]);return a},t.getSliceBeginCoords=function(e,t){const n=[0];for(let r=0;r<t;++r)n.push(e[r][0]);return n},t.getSliceSize=function(e,t,n){const r=e.slice(0,1);for(let a=0;a<n;++a)r.push(e[a+1]-t[a][0]-t[a][1]);return r}},220159:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.asin=void 0;var r=n(90337),a=n(536217),o=n(188695),s=n(930684);t.asin=(0,s.op)({asin_:function(e){const t={x:(0,o.convertToTensor)(e,"x","asin")};return r.ENGINE.runKernel(a.Asin,t)}})},148753:(e,t,n)=>{"use strict";
1Object.defineProperty(t,"__esModule",{value:!0}),t.asinh=void 0;var r=n(90337),a=n(536217),o=n(188695),s=n(930684);t.asinh=(0,s.op)({asinh_:function(e){const t={x:(0,o.convertToTensor)(e,"x","asinh")};return r.ENGINE.runKernel(a.Asinh,t)}})},9727:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.atan=void 0;var r=n(90337),a=n(536217),o=n(188695),s=n(930684);t.atan=(0,s.op)({atan_:function(e){const t={x:(0,o.convertToTensor)(e,"x","atan")};return r.ENGINE.runKernel(a.Atan,t)}})},395307:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.atan2=void 0;var r=n(90337),a=n(536217),o=n(390771),s=n(188695),i=n(930684);t.atan2=(0,i.op)({atan2_:function(e,t){let n=(0,s.convertToTensor)(e,"a","atan2"),i=(0,s.convertToTensor)(t,"b","atan2");[n,i]=(0,o.makeTypesMatch)(n,i);const c={a:n,b:i};return r.ENGINE.runKernel(a.Atan2,c)}})},820035:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.atanh=void 0;var r=n(90337),a=n(536217),o=n(188695),s=n(930684);t.atanh=(0,s.op)({atanh_:function(e){const t={x:(0,o.convertToTensor)(e,"x","atanh")};return r.ENGINE.runKernel(a.Atanh,t)}})},926677:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.avgPool=void 0;var r=n(90337),a=n(536217),o=n(188695),s=p(n(904737)),i=n(386565),c=p(n(812682)),l=n(930684),u=n(195476);function d(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(d=function(e){return e?n:t})(e)}function p(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=d(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if("default"!==o&&{}.hasOwnProperty.call(e,o)){var s=a?Object.getOwnPropertyDescriptor(e,o):null;s&&(s.get||s.set)?Object.defineProperty(r,o,s):r[o]=e[o]}return r.default=e,n&&n.set(e,r),r}t.avgPool=(0,l.op)({avgPool_:function(e,t,n,l,d){const p=(0,o.convertToTensor)(e,"x","avgPool","float32");s.assert(c.eitherStridesOrDilationsAreOne(n,1),(()=>"Error in avgPool: Either strides or dilations must be 1. "+"Got strides ".concat(n," and dilations '").concat(1,"'")));let h=p,f=!1;3===p.rank&&(f=!0,h=(0,u.reshape)(p,[1,p.shape[0],p.shape[1],p.shape[2]])),s.assert(4===h.rank,(()=>"Error in avgPool: x must be rank 4 but got rank ".concat(h.rank,"."))),c.checkPadOnDimRoundingMode("avgPool",l,d);const m={x:h},g={filterSize:t,strides:n,pad:l,dimRoundingMode:d};let y=r.ENGINE.runKernel(a.AvgPool,m,g);return y=(0,i.cast)(y,p.dtype),f?(0,u.reshape)(y,[y.shape[1],y.shape[2],y.shape[3]]):y}})},878001:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.avgPool3d=void 0;var r=n(90337),a=n(536217),o=n(188695),s=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=d(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if("default"!==o&&{}.hasOwnProperty.call(e,o)){var s=a?Object.getOwnPropertyDescriptor(e,o):null;s&&(s.get||s.set)?Object.defineProperty(r,o,s):r[o]=e[o]}return r.default=e,n&&n.set(e,r),r}(n(904737)),i=n(812682),c=n(386565),l=n(930684),u=n(195476);function d(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(d=function(e){return e?n:t})(e)}t.avgPool3d=(0,l.op)({avgPool3d_:function(e,t,n,l,d){let p=arguments.length>5&&void 0!==arguments[5]?arguments[5]:"NDHWC";const h=(0,o.convertToTensor)(e,"x","avgPool3d","float32");let f=h,m=!1;4===h.rank&&(m=!0,f=(0,u.reshape)(h,[1,h.shape[0],h.shape[1],h.shape[2],h.shape[3]])),s.assert(5===f.rank,(()=>"Error in avgPool3d: x must be rank 5 but got rank ".concat(f.rank,"."))),s.assert("NDHWC"===p,(()=>"Error in avgPool3d: Only NDHWC is currently supported, "+"but got dataFormat of ".concat(p))),(0,i.checkPadOnDimRoundingMode)("avgPool3d",l,d);const g={x:f},y={filterSize:t,strides:n,pad:l,dimRoundingMode:d,dataFormat:p};let v=r.ENGINE.runKernel(a.AvgPool3D,g,y);return v=(0,c.cast)(v,f.dtype),m?(0,u.reshape)(v,[v.shape[1],v.shape[2],v.shape[3],v.shape[4]]):v}})}
1,678948:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.avgPool3dGrad=void 0;var r=n(90337),a=n(536217),o=n(188695),s=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=u(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if("default"!==o&&{}.hasOwnProperty.call(e,o)){var s=a?Object.getOwnPropertyDescriptor(e,o):null;s&&(s.get||s.set)?Object.defineProperty(r,o,s):r[o]=e[o]}return r.default=e,n&&n.set(e,r),r}(n(904737)),i=n(812682),c=n(930684),l=n(195476);function u(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(u=function(e){return e?n:t})(e)}t.avgPool3dGrad=(0,c.op)({avgPool3dGrad_:function(e,t,n,c,u,d){const p=(0,o.convertToTensor)(e,"dy","avgPool3dGrad"),h=(0,o.convertToTensor)(t,"input","avgPool3dGrad");let f=p,m=h,g=!1;4===h.rank&&(g=!0,f=(0,l.reshape)(p,[1,p.shape[0],p.shape[1],p.shape[2],p.shape[3]]),m=(0,l.reshape)(h,[1,h.shape[0],h.shape[1],h.shape[2],h.shape[3]])),s.assert(5===f.rank,(()=>"Error in avgPool3dGrad: dy must be rank 5 but got rank "+"".concat(f.rank,"."))),s.assert(5===m.rank,(()=>"Error in avgPool3dGrad: input must be rank 5 but got rank "+"".concat(m.rank,"."))),(0,i.checkPadOnDimRoundingMode)("avgPool3dGrad",u,d);const y={dy:f,input:m},v={filterSize:n,strides:c,pad:u,dimRoundingMode:d},b=r.ENGINE.runKernel(a.AvgPool3DGrad,y,v);return g?(0,l.reshape)(b,[b.shape[1],b.shape[2],b.shape[3],b.shape[4]]):b}})},576062:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.avgPoolGrad=void 0;var r=n(90337),a=n(536217),o=n(188695),s=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=l(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if("default"!==o&&{}.hasOwnProperty.call(e,o)){var s=a?Object.getOwnPropertyDescriptor(e,o):null;s&&(s.get||s.set)?Object.defineProperty(r,o,s):r[o]=e[o]}return r.default=e,n&&n.set(e,r),r}(n(904737)),i=n(930684),c=n(195476);function l(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(l=function(e){return e?n:t})(e)}t.avgPoolGrad=(0,i.op)({avgPoolGrad_:function(e,t,n,i,l){const u=(0,o.convertToTensor)(e,"dy","avgPoolGrad"),d=(0,o.convertToTensor)(t,"input","avgPoolGrad");s.assert(d.rank===u.rank,(()=>"Rank of input (".concat(d.rank,") does not match rank of dy (").concat(u.rank,")")));let p=d,h=u,f=!1;3===d.rank&&(f=!0,p=(0,c.reshape)(d,[1,d.shape[0],d.shape[1],d.shape[2]]),h=(0,c.reshape)(u,[1,u.shape[0],u.shape[1],u.shape[2]])),s.assert(4===h.rank,(()=>"Error in avgPoolGrad: dy must be rank 4 but got rank "+"".concat(h.rank,"."))),s.assert(4===p.rank,(()=>"Error in avgPoolGrad: input must be rank 4 but got rank "+"".concat(p.rank,".")));const m={dy:h,input:p},g={filterSize:n,strides:i,pad:l},y=r.ENGINE.runKernel(a.AvgPoolGrad,m,g);return f?(0,c.reshape)(y,[y.shape[1],y.shape[2],y.shape[3]]):y}})},247731:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.assertAxesAreInnerMostDims=function(e,t,n){r.assert(o(t,n),(()=>"".concat(e," supports only inner-most axes for now. ")+"Got axes ".concat(t," and rank-").concat(n," input.")))},t.axesAreInnerMostDims=o,t.combineLocations=s,t.computeOutAndReduceShapes=function(e,t){const n=[],r=e.length;for(let a=0;a<r;a++)-1===t.indexOf(a)&&n.push(e[a]);const a=t.map((t=>e[t]));return[n,a]},t.expandShapeToKeepDim=function(e,t){const n=t.map((e=>1));return s(e,n,t)},t.getAxesPermutation=function(e,t){if(o(e,t))return null;const n=[];for(let r=0;r<t;++r)-1===e.indexOf(r)&&n.push(r);return e.forEach((e=>n.push(e))),n},t.getInnerMostAxes=function(e,t){const n=[];for(let r=t-e;r<t;++r)n.push(r);return n},t.getUndoAxesPermutation=function(e){return e.map(((e,t)=>[t,e])).sort(((e,t)=>e[1]-t[1])).map((e=>e[0]))};var r=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=a(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var s in e)if("default"!==s&&{}.hasOwnProperty.call(e,s)){var i=o?Object.getOwnPropertyDescriptor(e,s):null;i&&(i.get||i.set)?Object.defineProperty(r,s,i):r[s]=e[s]}return r.default=e,n&&n.set(e,r),r}(n(904737));function a(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(a=function(e){return e?n:t})(e)}function o(e,t){for(let n=0;n<e.length;++n)if(e[e.length-n-1]!==t-1-n)return!1;return!0}function s(e,t,n){const r=e.length+t.length,a=[];let o=0,s=0;for(let i=0;i<r;i++)-1===n.indexOf(i)?a.push(e[o++]):a.push(t[s++]);return a}},920676:(e,t,n)=>{"use strict";
1Object.defineProperty(t,"__esModule",{value:!0}),t.basicLSTMCell=void 0;var r=n(188695),a=n(353632),o=n(55108),s=n(986588),i=n(295702),c=n(930684),l=n(789520),u=n(247565),d=n(200178);t.basicLSTMCell=(0,c.op)({basicLSTMCell_:function(e,t,n,c,p,h){const f=(0,r.convertToTensor)(e,"forgetBias","basicLSTMCell"),m=(0,r.convertToTensor)(t,"lstmKernel","basicLSTMCell"),g=(0,r.convertToTensor)(n,"lstmBias","basicLSTMCell"),y=(0,r.convertToTensor)(c,"data","basicLSTMCell"),v=(0,r.convertToTensor)(p,"c","basicLSTMCell"),b=(0,r.convertToTensor)(h,"h","basicLSTMCell"),x=(0,o.concat)([y,b],1),w=(0,s.matMul)(x,m),k=(0,a.add)(w,g),_=k.shape[0],C=k.shape[1]/4,P=[_,C],O=(0,u.slice)(k,[0,0],P),N=(0,u.slice)(k,[0,C],P),I=(0,u.slice)(k,[0,2*C],P),T=(0,u.slice)(k,[0,3*C],P),S=(0,a.add)((0,i.mul)((0,l.sigmoid)(O),(0,d.tanh)(N)),(0,i.mul)(v,(0,l.sigmoid)((0,a.add)(f,I))));return[S,(0,i.mul)((0,d.tanh)(S),(0,l.sigmoid)(T))]}})},47326:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.batchToSpaceND=void 0;var r=n(90337),a=n(536217),o=n(188695),s=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=c(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if("default"!==o&&{}.hasOwnProperty.call(e,o)){var s=a?Object.getOwnPropertyDescriptor(e,o):null;s&&(s.get||s.set)?Object.defineProperty(r,o,s):r[o]=e[o]}return r.default=e,n&&n.set(e,r),r}(n(904737)),i=n(930684);function c(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(c=function(e){return e?n:t})(e)}t.batchToSpaceND=(0,i.op)({batchToSpaceND_:function(e,t,n){const i=(0,o.convertToTensor)(e,"x","batchToSpaceND"),c=t.reduce(((e,t)=>e*t));s.assert(i.rank>=1+t.length,(()=>"input rank is ".concat(i.rank," but should be > than blockShape.length ").concat(t.length))),s.assert(n.length===t.length,(()=>"crops.length is ".concat(n.length," but should be equal to blockShape.length ").concat(t.length))),s.assert(i.shape[0]%c==0,(()=>"input tensor batch is ".concat(i.shape[0]," but is not divisible by the product of ")+"the elements of blockShape ".concat(t.join(" * ")," === ").concat(c)));const l={x:i},u={blockShape:t,crops:n};return r.ENGINE.runKernel(a.BatchToSpaceND,l,u)}})},739914:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.batchNorm=void 0;var r=n(90337),a=n(536217),o=n(188695),s=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=u(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if("default"!==o&&{}.hasOwnProperty.call(e,o)){var s=a?Object.getOwnPropertyDescriptor(e,o):null;s&&(s.get||s.set)?Object.defineProperty(r,o,s):r[o]=e[o]}return r.default=e,n&&n.set(e,r),r}(n(904737)),i=n(245273),c=n(930684),l=n(195476);function u(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(u=function(e){return e?n:t})(e)}t.batchNorm=(0,c.op)({batchNorm_:function(e,t,n,c,u,d){null==d&&(d=.001);const p=(0,o.convertToTensor)(e,"x","batchNorm"),h=(0,o.convertToTensor)(t,"mean","batchNorm"),f=(0,o.convertToTensor)(n,"variance","batchNorm");let m,g;null!=u&&(m=(0,o.convertToTensor)(u,"scale","batchNorm")),null!=c&&(g=(0,o.convertToTensor)(c,"offset","batchNorm")),s.assert(h.rank===f.rank,(()=>"Batch normalization gradient requires mean and variance to have equal ranks.")),s.assert(null==g||h.rank===g.rank,(()=>"Batch normalization gradient requires mean and offset to have equal ranks.")),s.assert(null==m||h.rank===m.rank,(()=>"Batch normalization gradient requires mean and scale to have equal ranks."));const y={x:(0,i.xAs4D)(p),scale:m,offset:g,mean:h,variance:f},v={varianceEpsilon:d},b=r.ENGINE.runKernel(a.FusedBatchNorm,y,v);return(0,l.reshape)(b,p.shape)}})},437256:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.batchNorm2d=void 0;var r=n(188695),a=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=i(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if("default"!==o&&{}.hasOwnProperty.call(e,o)){var s=a?Object.getOwnPropertyDescriptor(e,o):null;s&&(s.get||s.set)?Object.defineProperty(r,o,s):r[o]=e[o]}return r.default=e,n&&n.set(e,r),r}(n(904737)),o=n(739914),s=n(930684);function i(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(i=function(e){return e?n:t})(e)}t.batchNorm2d=(0,s.op)({batchNorm2d_:function(e,t,n,s,i,c){const l=(0,r.convertToTensor)(e,"x","batchNorm"),u=(0,r.convertToTensor)(t,"mean","batchNorm"),d=(0,r.convertToTensor)(n,"variance","batchNorm");let p,h;return null!=i&&(p=(0,r.convertToTensor)(i,"scale","batchNorm")),null!=s&&(h=(0,r.convertToTensor)(s,"offset","batchNorm")),a.assert(2===l.rank,(()=>"Error in batchNorm2D: x must be rank 2 but got rank "+"".concat(l.rank,"."))),a.assert(2===u.rank||1===u.rank,(()=>"Error in batchNorm2D: mean must be rank 2 or rank 1 but "+"got rank ".concat(u.rank,"."))),a.assert(2===d.rank||1===d.rank,(()=>"Error in batchNorm2D: variance must be rank 2 or rank 1 "+"but got rank ".concat(d.rank,"."))),null!=p&&a.assert(2===p.rank||1===p.rank,(()=>"Error in batchNorm2D: scale must be rank 2 or rank 1 "+"but got rank ".concat(p.rank,"."))),null!=h&&a.assert(2===h.rank||1===h.rank,(()=>"Error in batchNorm2D: offset must be rank 2 or rank 1 "+"but got rank ".concat(h.rank,"."))),(0,o.batchNorm)(l,u,d,h,p,c)}})},676842:(e,t,n)=>{"use strict";
1Object.defineProperty(t,"__esModule",{value:!0}),t.batchNorm3d=void 0;var r=n(188695),a=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=i(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if("default"!==o&&{}.hasOwnProperty.call(e,o)){var s=a?Object.getOwnPropertyDescriptor(e,o):null;s&&(s.get||s.set)?Object.defineProperty(r,o,s):r[o]=e[o]}return r.default=e,n&&n.set(e,r),r}(n(904737)),o=n(739914),s=n(930684);function i(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(i=function(e){return e?n:t})(e)}t.batchNorm3d=(0,s.op)({batchNorm3d_:function(e,t,n,s,i,c){const l=(0,r.convertToTensor)(e,"x","batchNorm"),u=(0,r.convertToTensor)(t,"mean","batchNorm"),d=(0,r.convertToTensor)(n,"variance","batchNorm");let p,h;return null!=i&&(p=(0,r.convertToTensor)(i,"scale","batchNorm")),null!=s&&(h=(0,r.convertToTensor)(s,"offset","batchNorm")),a.assert(3===l.rank,(()=>"Error in batchNorm3D: x must be rank 3 but got rank "+"".concat(l.rank,"."))),a.assert(3===u.rank||1===u.rank,(()=>"Error in batchNorm3D: mean must be rank 3 or rank 1 but "+"got rank ".concat(u.rank,"."))),a.assert(3===d.rank||1===d.rank,(()=>"Error in batchNorm3D: variance must be rank 3 or rank 1 "+"but got rank ".concat(d.rank,"."))),null!=p&&a.assert(3===p.rank||1===p.rank,(()=>"Error in batchNorm3D: scale must be rank 3 or rank 1 "+"but got rank ".concat(p.rank,"."))),null!=h&&a.assert(3===h.rank||1===h.rank,(()=>"Error in batchNorm3D: offset must be rank 3 or rank 1 "+"but got rank ".concat(h.rank,"."))),(0,o.batchNorm)(l,u,d,h,p,c)}})},255014:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.batchNorm4d=void 0;var r=n(188695),a=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=i(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if("default"!==o&&{}.hasOwnProperty.call(e,o)){var s=a?Object.getOwnPropertyDescriptor(e,o):null;s&&(s.get||s.set)?Object.defineProperty(r,o,s):r[o]=e[o]}return r.default=e,n&&n.set(e,r),r}(n(904737)),o=n(739914),s=n(930684);function i(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(i=function(e){return e?n:t})(e)}t.batchNorm4d=(0,s.op)({batchNorm4d_:function(e,t,n,s,i,c){const l=(0,r.convertToTensor)(e,"x","batchNorm"),u=(0,r.convertToTensor)(t,"mean","batchNorm"),d=(0,r.convertToTensor)(n,"variance","batchNorm");let p,h;return null!=i&&(p=(0,r.convertToTensor)(i,"scale","batchNorm")),null!=s&&(h=(0,r.convertToTensor)(s,"offset","batchNorm")),a.assert(4===l.rank,(()=>"Error in batchNorm4D: x must be rank 4 but got rank "+"".concat(l.rank,"."))),a.assert(4===u.rank||1===u.rank,(()=>"Error in batchNorm4D: mean must be rank 4 or rank 1 but "+"got rank ".concat(u.rank,"."))),a.assert(4===d.rank||1===d.rank,(()=>"Error in batchNorm4D: variance must be rank 4 or rank 1 "+"but got rank ".concat(d.rank,"."))),null!=p&&a.assert(4===p.rank||1===p.rank,(()=>"Error in batchNorm4D: scale must be rank 4 or rank 1 "+"but got rank ".concat(p.rank,"."))),null!=h&&a.assert(4===h.rank||1===h.rank,(()=>"Error in batchNorm4D: offset must be rank 4 or rank 1 "+"but got rank ".concat(h.rank,"."))),(0,o.batchNorm)(l,u,d,h,p,c)}})},245273:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.xAs4D=function(e){let t;t=0===e.rank||1===e.rank?(0,r.reshape)(e,[1,1,1,e.size]):2===e.rank?(0,r.reshape)(e,[1,1,e.shape[0],e.shape[1]]):3===e.rank?(0,r.reshape)(e,[1,e.shape[0],e.shape[1],e.shape[2]]):e;return t};var r=n(195476)},27880:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.bincount=void 0;var r=n(90337),a=n(536217),o=n(188695),s=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=c(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if("default"!==o&&{}.hasOwnProperty.call(e,o)){var s=a?Object.getOwnPropertyDescriptor(e,o):null;s&&(s.get||s.set)?Object.defineProperty(r,o,s):r[o]=e[o]}return r.default=e,n&&n.set(e,r),r}(n(904737)),i=n(930684);function c(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(c=function(e){return e?n:t})(e)}t.bincount=(0,i.op)({bincount_:function(e,t,n){const i=(0,o.convertToTensor)(e,"x","bincount"),c=(0,o.convertToTensor)(t,"weights","bincount");s.assert("int32"===i.dtype,(()=>"Error in bincount: input "+"dtype must be int32, but got ".concat(i.dtype))),s.assert(n>=0,(()=>"size must be non-negative, but got ".concat(n,"."))),s.assert(c.size===i.size||0===c.size,(()=>"Error in bincount: weights must have the same size as input or"+"0-length, but got input shape: ".concat(i.shape,", weights shape: ")+"".concat(c.shape,".")));const l={x:i,weights:c},u={size:n};return r.ENGINE.runKernel(a.Bincount,l,u)}})},663947:(e,t,n)=>{"use strict";
1Object.defineProperty(t,"__esModule",{value:!0}),t.booleanMaskAsync=void 0;var r=n(188695),a=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=l(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if("default"!==o&&{}.hasOwnProperty.call(e,o)){var s=a?Object.getOwnPropertyDescriptor(e,o):null;s&&(s.get||s.set)?Object.defineProperty(r,o,s):r[o]=e[o]}return r.default=e,n&&n.set(e,r),r}(n(904737)),o=n(589205),s=n(195476),i=n(714313),c=n(16814);function l(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(l=function(e){return e?n:t})(e)}t.booleanMaskAsync=async function(e,t,n){const l=(0,r.convertToTensor)(e,"tensor","boolMask"),u=(0,r.convertToTensor)(t,"mask","boolMask","bool"),d=null==n?0:n,p=u.rank,h=l.shape;a.assert(p>0,(()=>"mask cannot be scalar")),a.assertShapesMatch(h.slice(d,d+p),u.shape,"mask's shape must match the first K dimensions of tensor's shape,");let f=1;for(let e=d;e<d+p;e++)f*=h[e];const m=h.slice(0,d).concat([f],h.slice(d+p)),g=(0,s.reshape)(l,m),y=(0,s.reshape)(u,[-1]),v=await(0,c.whereAsync)(y),b=(0,i.squeeze)(v,[1]),x=(0,o.gather)(g,b,d);return e!==l&&l.dispose(),t!==u&&u.dispose(),b.dispose(),g.dispose(),y.dispose(),v.dispose(),x}},239938:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.broadcastArgs=void 0;var r=n(90337),a=n(536217),o=n(188695),s=n(930684);t.broadcastArgs=(0,s.op)({broadcastArgs_:function(e,t){const n=(0,o.convertToTensor)(e,"s0","broadcastArgs","int32"),s=(0,o.convertToTensor)(t,"s1","broadcastArgs","int32");if(1!==n.rank)throw new Error("broadcastArgs(): first input must be a vector (rank=1). "+"Has rank ".concat(n.rank));if(1!==s.rank)throw new Error("broadcastArgs(): second input must be a vector (rank=1). "+"Has rank ".concat(s.rank));const i={s0:n,s1:s};return r.ENGINE.runKernel(a.BroadcastArgs,i)}})},465581:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.broadcastTo=void 0;var r=n(90337),a=n(536217),o=n(188695),s=n(971976),i=n(930684),c=n(195476);t.broadcastTo=(0,i.op)({broadcastTo_:function(e,t){let n=(0,o.convertToTensor)(e,"broadcastTo","x");const i=n.shape;if(t.some((e=>!(e>0)||e%1!=0)))throw new Error("broadcastTo(): Invalid broadcast shape [".concat(t,"]."));if(t.length<n.rank)throw new Error("broadcastTo(): shape.length=".concat(t.length," < input.rank=").concat(n.rank,"."));if(t.length>n.rank){const e=n.shape.slice();for(;e.length<t.length;)e.unshift(1);n=(0,c.reshape)(n,e)}const l=n.shape,u=Array.from(t);for(let e=t.length-1;e>=0;e--)if(l[e]===t[e])u[e]=1;else if(1!==n.shape[e])throw new Error("broadcastTo(): [".concat(i,"] cannot be broadcast to [").concat(t,"]."));if(0===u.map(((e,t)=>e>1?t:-1)).filter((e=>e>=0)).length)return(0,s.clone)(n);const d={x:n},p={reps:u};return r.ENGINE.runKernel(a.Tile,d,p)}})},534779:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.assertAndGetBroadcastShape=function(e,t){const n=[],r=Math.max(e.length,t.length);for(let a=0;a<r;a++){let r=e[e.length-a-1];null==r&&(r=1);let o=t[t.length-a-1];if(null==o&&(o=1),1===r)n.unshift(o);else if(1===o)n.unshift(r);else{if(r!==o){const n="Operands could not be broadcast together with shapes "+"".concat(e," and ").concat(t,".");throw Error(n)}n.unshift(r)}}return n},t.getBroadcastDims=function(e,t){const n=e.length,r=[];for(let a=0;a<n;a++){const o=n-1-a,s=e[o]||1;(t[t.length-1-a]||1)>1&&1===s&&r.unshift(o)}return r},t.getReductionAxes=function(e,t){const n=[];for(let r=0;r<t.length;r++){const a=e[e.length-r-1],o=t.length-r-1,s=t[o];(null==a||1===a&&s>1)&&n.unshift(o)}return n}}
1,779212:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.fromPixels=void 0,t.fromPixelsAsync=async function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:3,n=null;if((0,a.env)().getBool("WRAP_TO_IMAGEBITMAP")&&function(e){return"undefined"!=typeof window&&"undefined"!=typeof ImageBitmap&&window.hasOwnProperty("createImageBitmap")&&!(e instanceof ImageBitmap)&&function(e){return null!=e&&0!==e.width&&0!==e.height}(e)&&!function(e){return null!=e&&e.data instanceof Uint8Array}(e)}(e)){let t;try{t=await createImageBitmap(e,{premultiplyAlpha:"none"})}catch(e){t=null}n=null!=t&&t.width===e.width&&t.height===e.height?t:e}else n=e;return h(n,t)},t.toPixels=async function(e,t){let n=(0,c.convertToTensor)(e,"img","toPixels");if(!(e instanceof i.Tensor)){const e=n;n=(0,l.cast)(e,"int32"),e.dispose()}if(2!==n.rank&&3!==n.rank)throw new Error("toPixels only supports rank 2 or 3 tensors, got rank ".concat(n.rank,"."));const[r,a]=n.shape.slice(0,2),o=2===n.rank?1:n.shape[2];if(o>4||2===o)throw new Error("toPixels only supports depth of size "+"1, 3 or 4 but got ".concat(o));if("float32"!==n.dtype&&"int32"!==n.dtype)throw new Error("Unsupported type for toPixels: ".concat(n.dtype,".")+" Please use float32 or int32 tensors.");const s=await n.data(),u="float32"===n.dtype?255:1,d=new Uint8ClampedArray(a*r*4);for(let e=0;e<r*a;++e){const t=[0,0,0,255];for(let r=0;r<o;r++){const a=s[e*o+r];if("float32"===n.dtype){if(a<0||a>1)throw new Error("Tensor values for a float32 Tensor must be in the "+"range [0 - 1] but encountered ".concat(a,"."))}else if("int32"===n.dtype&&(a<0||a>255))throw new Error("Tensor values for a int32 Tensor must be in the "+"range [0 - 255] but encountered ".concat(a,"."));1===o?(t[0]=a*u,t[1]=a*u,t[2]=a*u):t[r]=a*u}const r=4*e;d[r+0]=Math.round(t[0]),d[r+1]=Math.round(t[1]),d[r+2]=Math.round(t[2]),d[r+3]=Math.round(t[3])}if(null!=t){t.width=a,t.height=r;const e=t.getContext("2d"),n=new ImageData(d,a,r);e.putImageData(n,0,0)}n!==e&&n.dispose();return d};var r=n(90337),a=n(598257),o=n(536217),s=n(115354),i=n(659795),c=n(188695),l=n(386565),u=n(930684),d=n(459447);let p;function h(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:3;if(t>4)throw new Error("Cannot construct Tensor with more than 4 channels from pixels.");if(null==e)throw new Error("pixels passed to tf.browser.fromPixels() can not be null");let n=!1,a=!1,i=!1,c=!1,l=!1,u=!1;if(e.data instanceof Uint8Array)n=!0;else if("undefined"!=typeof ImageData&&e instanceof ImageData)a=!0;else if("undefined"!=typeof HTMLVideoElement&&e instanceof HTMLVideoElement)i=!0;else if("undefined"!=typeof HTMLImageElement&&e instanceof HTMLImageElement)c=!0;else if(null!=e.getContext)l=!0;else{if(!("undefined"!=typeof ImageBitmap&&e instanceof ImageBitmap))throw new Error("pixels passed to tf.browser.fromPixels() must be either an HTMLVideoElement, HTMLImageElement, HTMLCanvasElement, ImageData in browser, or OffscreenCanvas, ImageData in webworker or {data: Uint32Array, width: number, height: number}, "+"but was ".concat(e.constructor.name));u=!0}if(i){const t=2;if(i&&e.readyState<t)throw new Error("The video element has not loaded data yet. Please wait for `loadeddata` event on the <video> element.")}if(null!=(0,s.getKernel)(o.FromPixels,r.ENGINE.backendName)){const n={pixels:e},a={numChannels:t};return r.ENGINE.runKernel(o.FromPixels,n,a)}const[h,f]=i?[e.videoWidth,e.videoHeight]:[e.width,e.height];let m,g;if(l)m=e.getContext("2d").getImageData(0,0,h,f).data;else if(a||n)m=e.data;else if(c||i||u){if(null==p)if("undefined"==typeof document){if("undefined"==typeof OffscreenCanvas||"undefined"==typeof OffscreenCanvasRenderingContext2D)throw new Error("Cannot parse input in current context. Reason: OffscreenCanvas Context2D rendering is not supported.");p=new OffscreenCanvas(1,1).getContext("2d")}else p=document.createElement("canvas").getContext("2d");p.canvas.width=h,p.canvas.height=f,p.drawImage(e,0,0,h,f),m=p.getImageData(0,0,h,f).data}if(4===t)g=new Int32Array(m);else{const e=h*f;g=new Int32Array(e*t);for(let n=0;n<e;n++)for(let e=0;e<t;++e)g[n*t+e]=m[4*n+e]}
1const y=[f,h,t];return(0,d.tensor3d)(g,y,"int32")}t.fromPixels=(0,u.op)({fromPixels_:h})},60249:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.buffer=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"float32",n=arguments.length>2?arguments[2]:void 0;return t=t||"float32",a.assertNonNegativeIntegerDimensions(e),new r.TensorBuffer(e,t,n)};var r=n(659795),a=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=o(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var s in e)if("default"!==s&&{}.hasOwnProperty.call(e,s)){var i=a?Object.getOwnPropertyDescriptor(e,s):null;i&&(i.get||i.set)?Object.defineProperty(r,s,i):r[s]=e[s]}return r.default=e,n&&n.set(e,r),r}(n(904737));function o(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(o=function(e){return e?n:t})(e)}},386565:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.cast=void 0;var r=n(90337),a=n(536217),o=n(188695),s=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=c(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if("default"!==o&&{}.hasOwnProperty.call(e,o)){var s=a?Object.getOwnPropertyDescriptor(e,o):null;s&&(s.get||s.set)?Object.defineProperty(r,o,s):r[o]=e[o]}return r.default=e,n&&n.set(e,r),r}(n(904737)),i=n(930684);function c(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(c=function(e){return e?n:t})(e)}t.cast=(0,i.op)({cast_:function(e,t){const n=(0,o.convertToTensor)(e,"x","cast");if(!s.isValidDtype(t))throw new Error("Failed to cast to unknown dtype ".concat(t));if("string"===t&&"string"!==n.dtype||"string"!==t&&"string"===n.dtype)throw new Error("Only strings can be casted to strings");const i={x:n},c={dtype:t};return r.ENGINE.runKernel(a.Cast,i,c)}})},71306:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ceil=void 0;var r=n(90337),a=n(536217),o=n(188695),s=n(930684);t.ceil=(0,s.op)({ceil_:function(e){const t={x:(0,o.convertToTensor)(e,"x","ceil","float32")};return r.ENGINE.runKernel(a.Ceil,t)}})},635967:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.clipByValue=void 0;var r=n(90337),a=n(536217),o=n(188695),s=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=c(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if("default"!==o&&{}.hasOwnProperty.call(e,o)){var s=a?Object.getOwnPropertyDescriptor(e,o):null;s&&(s.get||s.set)?Object.defineProperty(r,o,s):r[o]=e[o]}return r.default=e,n&&n.set(e,r),r}(n(904737)),i=n(930684);function c(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(c=function(e){return e?n:t})(e)}t.clipByValue=(0,i.op)({clipByValue_:function(e,t,n){const i=(0,o.convertToTensor)(e,"x","clipByValue");s.assert(t<=n,(()=>"Error in clip: min (".concat(t,") must be ")+"less than or equal to max (".concat(n,").")));const c={x:i},l={clipValueMin:t,clipValueMax:n};return r.ENGINE.runKernel(a.ClipByValue,c,l)}})},971976:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.clone=void 0;var r=n(90337),a=n(536217),o=n(188695),s=n(930684);t.clone=(0,s.op)({clone_:function(e){const t={x:(0,o.convertToTensor)(e,"x","clone","string_or_numeric")};return r.ENGINE.runKernel(a.Identity,t)}})},291158:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.complex=void 0;var r=n(90337),a=n(536217),o=n(188695),s=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=c(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if("default"!==o&&{}.hasOwnProperty.call(e,o)){var s=a?Object.getOwnPropertyDescriptor(e,o):null;s&&(s.get||s.set)?Object.defineProperty(r,o,s):r[o]=e[o]}return r.default=e,n&&n.set(e,r),r}(n(904737)),i=n(930684);function c(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(c=function(e){return e?n:t})(e)}t.complex=(0,i.op)({complex_:function(e,t){const n=(0,o.convertToTensor)(e,"real","complex"),i=(0,o.convertToTensor)(t,"imag","complex");s.assertShapesMatch(n.shape,i.shape,"real and imag shapes, ".concat(n.shape," and ").concat(i.shape,", ")+"must match in call to tf.complex().");const c={real:n,imag:i};return r.ENGINE.runKernel(a.Complex,c)}})},55108:(e,t,n)=>{"use strict";
1Object.defineProperty(t,"__esModule",{value:!0}),t.concat=void 0;var r=n(90337),a=n(536217),o=n(188695),s=n(904737),i=n(971976),c=n(930684);t.concat=(0,c.op)({concat_:function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;(0,s.assert)(e.length>=1,(()=>"Pass at least one tensor to concat"));const n=(0,o.convertToTensorArray)(e,"tensors","concat","string_or_numeric");if("complex64"===n[0].dtype&&n.forEach((e=>{if("complex64"!==e.dtype)throw new Error("Cannot concatenate complex64 tensors with a tensor\n with dtype ".concat(e.dtype,". "))})),1===n.length)return(0,i.clone)(n[0]);const c=n,l={axis:t};return r.ENGINE.runKernel(a.Concat,c,l)}})},924428:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.concat1d=void 0;var r=n(55108),a=n(930684);t.concat1d=(0,a.op)({concat1d_:function(e){return(0,r.concat)(e,0)}})},708183:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.concat2d=void 0;var r=n(55108),a=n(930684);t.concat2d=(0,a.op)({concat2d_:function(e,t){return(0,r.concat)(e,t)}})},787928:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.concat3d=void 0;var r=n(55108),a=n(930684);t.concat3d=(0,a.op)({concat3d_:function(e,t){return(0,r.concat)(e,t)}})},351781:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.concat4d=void 0;var r=n(55108),a=n(930684);t.concat4d=(0,a.op)({concat4d_:function(e,t){return(0,r.concat)(e,t)}})},534290:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.assertParamsConsistent=function(e,t){const n=e[0].length;e.forEach(((e,t)=>{r.assert(e.length===n,(()=>"Error in concat".concat(n,"D: rank of tensors[").concat(t,"] must be the same ")+"as the rank of the rest (".concat(n,")")))})),r.assert(t>=0&&t<n,(()=>"Error in concat".concat(n,"D: axis must be between 0 and ").concat(n-1,".")));const a=e[0];e.forEach(((e,o)=>{for(let s=0;s<n;s++)r.assert(s===t||e[s]===a[s],(()=>"Error in concat".concat(n,"D: Shape of tensors[").concat(o,"] (").concat(e,") ")+"does not match the shape of the rest (".concat(a,") ")+"along the non-concatenated axis ".concat(o,".")))}))},t.computeOutShape=function(e,t){const n=e[0].slice();for(let r=1;r<e.length;r++)n[t]+=e[r][t];return n};var r=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=a(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var s in e)if("default"!==s&&{}.hasOwnProperty.call(e,s)){var i=o?Object.getOwnPropertyDescriptor(e,s):null;i&&(i.get||i.set)?Object.defineProperty(r,s,i):r[s]=e[s]}return r.default=e,n&&n.set(e,r),r}(n(904737));function a(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(a=function(e){return e?n:t})(e)}},257979:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.confusionMatrix=void 0,t.confusionMatrix_=d;var r=n(188695),a=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=u(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if("default"!==o&&{}.hasOwnProperty.call(e,o)){var s=a?Object.getOwnPropertyDescriptor(e,o):null;s&&(s.get||s.set)?Object.defineProperty(r,o,s):r[o]=e[o]}return r.default=e,n&&n.set(e,r),r}(n(904737)),o=n(386565),s=n(986588),i=n(597664),c=n(930684),l=n(688129);function u(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(u=function(e){return e?n:t})(e)}function d(e,t,n){const c=(0,r.convertToTensor)(e,"labels","confusionMatrix"),u=(0,r.convertToTensor)(t,"predictions","confusionMatrix");a.assert(null==n||n>0&&Number.isInteger(n),(()=>"If provided, numClasses must be a positive integer, "+"but got ".concat(n))),a.assert(1===c.rank,(()=>"Expected the rank of labels to be 1, but got ".concat(c.rank))),a.assert(1===u.rank,(()=>"Expected the rank of predictions to be 1, "+"but got ".concat(u.rank))),a.assert(c.shape[0]===u.shape[0],(()=>"Mismatch in the number of examples: "+"".concat(c.shape[0]," vs. ").concat(u.shape[0],". ")+"Labels and predictions should have the same number of elements.")),a.assert(n>0&&Number.isInteger(n),(()=>"numClasses is required to be a positive integer, but got "+"".concat(n)));const d=(0,i.oneHot)((0,o.cast)(c,"int32"),n),p=(0,i.oneHot)((0,o.cast)(u,"int32"),n),h=(0,l.transpose)(d),f=(0,s.matMul)(h,p);return(0,o.cast)(f,"int32")}t.confusionMatrix=(0,c.op)({confusionMatrix_:d})},394576:(e,t,n)=>{"use strict";
1Object.defineProperty(t,"__esModule",{value:!0}),t.conv1d=void 0;var r=n(188695),a=u(n(904737)),o=n(797476),s=u(n(812682)),i=n(930684),c=n(195476);function l(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(l=function(e){return e?n:t})(e)}function u(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=l(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if("default"!==o&&{}.hasOwnProperty.call(e,o)){var s=a?Object.getOwnPropertyDescriptor(e,o):null;s&&(s.get||s.set)?Object.defineProperty(r,o,s):r[o]=e[o]}return r.default=e,n&&n.set(e,r),r}t.conv1d=(0,i.op)({conv1d_:function(e,t,n,i){let l=arguments.length>4&&void 0!==arguments[4]?arguments[4]:"NWC",u=arguments.length>5&&void 0!==arguments[5]?arguments[5]:1,d=arguments.length>6?arguments[6]:void 0;const p=(0,r.convertToTensor)(e,"x","conv1d"),h=(0,r.convertToTensor)(t,"filter","conv1d");let f=p,m=!1;2===p.rank&&(m=!0,f=(0,c.reshape)(p,[1,p.shape[0],p.shape[1]])),a.assert(3===f.rank,(()=>"Error in conv1d: input must be rank 3, but got rank ".concat(f.rank,"."))),a.assert(3===h.rank,(()=>"Error in conv1d: filter must be rank 3, but got rank "+"".concat(h.rank,"."))),s.checkPadOnDimRoundingMode("conv1d",i,d),a.assert(f.shape[2]===h.shape[1],(()=>"Error in conv1d: depth of input (".concat(f.shape[2],") must match ")+"input depth for filter ".concat(h.shape[1],"."))),a.assert(s.eitherStridesOrDilationsAreOne(n,u),(()=>"Error in conv1D: Either stride or dilation must be 1. "+"Got stride ".concat(n," and dilation '").concat(u,"'"))),a.assert("NWC"===l,(()=>"Error in conv1d: got dataFormat of ".concat(l," but only NWC is currently supported.")));const g=(0,c.reshape)(h,[1,h.shape[0],h.shape[1],h.shape[2]]),y=(0,c.reshape)(f,[f.shape[0],1,f.shape[1],f.shape[2]]),v=[1,n],b=[1,u],x=(0,o.conv2d)(y,g,v,i,"NHWC",b,d);return m?(0,c.reshape)(x,[x.shape[2],x.shape[3]]):(0,c.reshape)(x,[x.shape[0],x.shape[2],x.shape[3]])}})},797476:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.conv2d=void 0;var r=n(90337),a=n(536217),o=n(188695),s=d(n(904737)),i=d(n(812682)),c=n(930684),l=n(195476);function u(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(u=function(e){return e?n:t})(e)}function d(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=u(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if("default"!==o&&{}.hasOwnProperty.call(e,o)){var s=a?Object.getOwnPropertyDescriptor(e,o):null;s&&(s.get||s.set)?Object.defineProperty(r,o,s):r[o]=e[o]}return r.default=e,n&&n.set(e,r),r}t.conv2d=(0,c.op)({conv2d_:function(e,t,n,c){let u=arguments.length>4&&void 0!==arguments[4]?arguments[4]:"NHWC",d=arguments.length>5&&void 0!==arguments[5]?arguments[5]:[1,1],p=arguments.length>6?arguments[6]:void 0;const h=(0,o.convertToTensor)(e,"x","conv2d","float32"),f=(0,o.convertToTensor)(t,"filter","conv2d","float32");let m=h,g=!1;3===h.rank&&(g=!0,m=(0,l.reshape)(h,[1,h.shape[0],h.shape[1],h.shape[2]])),s.assert(4===m.rank,(()=>"Error in conv2d: input must be rank 4, but got rank ".concat(m.rank,"."))),s.assert(4===f.rank,(()=>"Error in conv2d: filter must be rank 4, but got rank "+"".concat(f.rank,"."))),i.checkPadOnDimRoundingMode("conv2d",c,p);const y="NHWC"===u?m.shape[3]:m.shape[1];s.assert(y===f.shape[2],(()=>"Error in conv2d: depth of input (".concat(y,") must match ")+"input depth for filter ".concat(f.shape[2],"."))),s.assert(i.eitherStridesOrDilationsAreOne(n,d),(()=>"Error in conv2D: Either strides or dilations must be 1. "+"Got strides ".concat(n," and dilations '").concat(d,"'")));const v={x:m,filter:f},b={strides:n,pad:c,dataFormat:u,dilations:d,dimRoundingMode:p},x=r.ENGINE.runKernel(a.Conv2D,v,b);return g?(0,l.reshape)(x,[x.shape[1],x.shape[2],x.shape[3]]):x}})},948519:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.conv2DBackpropFilter=void 0;var r=n(90337),a=n(536217),o=u(n(904737)),s=u(n(812682)),i=n(930684),c=n(195476);function l(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(l=function(e){return e?n:t})(e)}
1function u(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=l(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if("default"!==o&&{}.hasOwnProperty.call(e,o)){var s=a?Object.getOwnPropertyDescriptor(e,o):null;s&&(s.get||s.set)?Object.defineProperty(r,o,s):r[o]=e[o]}return r.default=e,n&&n.set(e,r),r}t.conv2DBackpropFilter=(0,i.op)({conv2DBackpropFilter_:function(e,t,n,i,l){let u=arguments.length>5&&void 0!==arguments[5]?arguments[5]:"NHWC",d=arguments.length>6?arguments[6]:void 0,p=e;3===e.rank&&(p=(0,c.reshape)(e,[1,e.shape[0],e.shape[1],e.shape[2]]));let h=t;3===h.rank&&(h=(0,c.reshape)(t,[1,t.shape[0],t.shape[1],t.shape[2]])),o.assert(4===p.rank,(()=>"Error in conv2dDerFilter: input must be rank 4, but got shape "+"".concat(p.shape,"."))),o.assert(4===h.rank,(()=>"Error in conv2dDerFilter: dy must be rank 4, but got shape "+"".concat(h.shape,"."))),o.assert(4===n.length,(()=>"Error in conv2dDerFilter: filterShape must be length 4, but got "+"".concat(n,".")));const f="NHWC"===u?p.shape[3]:p.shape[1],m="NHWC"===u?h.shape[3]:h.shape[1];o.assert(f===n[2],(()=>"Error in conv2dDerFilter: depth of input ".concat(f,") must ")+"match input depth in filter (".concat(n[2],"."))),o.assert(m===n[3],(()=>"Error in conv2dDerFilter: depth of dy (".concat(m,") must ")+"match output depth for filter (".concat(n[3],")."))),s.checkPadOnDimRoundingMode("conv2dDerFilter",l,d);const g={x:p,dy:h},y={strides:i,pad:l,dataFormat:u,dimRoundingMode:d,filterShape:n};return r.ENGINE.runKernel(a.Conv2DBackpropFilter,g,y)}})},713310:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.conv2DBackpropInput=void 0;var r=n(90337),a=n(536217),o=u(n(904737)),s=u(n(812682)),i=n(930684),c=n(195476);function l(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(l=function(e){return e?n:t})(e)}function u(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=l(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if("default"!==o&&{}.hasOwnProperty.call(e,o)){var s=a?Object.getOwnPropertyDescriptor(e,o):null;s&&(s.get||s.set)?Object.defineProperty(r,o,s):r[o]=e[o]}return r.default=e,n&&n.set(e,r),r}t.conv2DBackpropInput=(0,i.op)({conv2DBackpropInput_:function(e,t,n,i,l){let u=arguments.length>5&&void 0!==arguments[5]?arguments[5]:"NHWC",d=arguments.length>6?arguments[6]:void 0;o.assert(e.length===t.rank,(()=>"Length of inShape "+"(".concat(e.length,") and rank of dy (").concat(t.rank,") must match")));let p=e,h=t,f=!1;3===t.rank&&(f=!0,h=(0,c.reshape)(t,[1,t.shape[0],t.shape[1],t.shape[2]]),p=[1,e[0],e[1],e[2]]),o.assert(4===p.length,(()=>"Error in conv2dDerInput: inShape must be length 4, but got length "+"".concat(p.length,"."))),o.assert(4===h.rank,(()=>"Error in conv2dDerInput: dy must be rank 4, but got "+"rank ".concat(h.rank))),o.assert(4===n.rank,(()=>"Error in conv2dDerInput: filter must be rank 4, but got "+"rank ".concat(n.rank)));const m="NHWC"===u?p[3]:p[1],g="NHWC"===u?h.shape[3]:h.shape[1];o.assert(m===n.shape[2],(()=>"Error in conv2dDerInput: depth of input (".concat(m,") must ")+"match input depth for filter ".concat(n.shape[2],"."))),o.assert(g===n.shape[3],(()=>"Error in conv2dDerInput: depth of output (".concat(g,") must ")+"match output depth for filter ".concat(n.shape[3],"."))),s.checkPadOnDimRoundingMode("conv2dDerInput",l,d);const y={dy:h,filter:n},v={strides:i,pad:l,dataFormat:u,dimRoundingMode:d,inputShape:p},b=r.ENGINE.runKernel(a.Conv2DBackpropInput,y,v);return f?(0,c.reshape)(b,[b.shape[1],b.shape[2],b.shape[3]]):b}})},492617:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.conv2dTranspose=void 0;var r=n(188695),a=n(713310),o=n(930684);t.conv2dTranspose=(0,o.op)({conv2dTranspose_:function(e,t,n,o,s,i){const c=(0,r.convertToTensor)(e,"x","conv2dTranspose"),l=(0,r.convertToTensor)(t,"filter","conv2dTranspose");return(0,a.conv2DBackpropInput)(n,c,l,o,s,"NHWC",i)}})}
1,26728:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.conv3d=void 0;var r=n(90337),a=n(536217),o=n(188695),s=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=u(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if("default"!==o&&{}.hasOwnProperty.call(e,o)){var s=a?Object.getOwnPropertyDescriptor(e,o):null;s&&(s.get||s.set)?Object.defineProperty(r,o,s):r[o]=e[o]}return r.default=e,n&&n.set(e,r),r}(n(904737)),i=n(812682),c=n(930684),l=n(195476);function u(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(u=function(e){return e?n:t})(e)}t.conv3d=(0,c.op)({conv3d_:function(e,t,n,c){let u=arguments.length>4&&void 0!==arguments[4]?arguments[4]:"NDHWC",d=arguments.length>5&&void 0!==arguments[5]?arguments[5]:[1,1,1];const p=(0,o.convertToTensor)(e,"x","conv3d"),h=(0,o.convertToTensor)(t,"filter","conv3d");let f=p,m=!1;4===p.rank&&(m=!0,f=(0,l.reshape)(p,[1,p.shape[0],p.shape[1],p.shape[2],p.shape[3]])),s.assert(5===f.rank,(()=>"Error in conv3d: input must be rank 5, but got rank ".concat(f.rank,"."))),s.assert(5===h.rank,(()=>"Error in conv3d: filter must be rank 5, but got rank "+"".concat(h.rank,"."))),s.assert(f.shape[4]===h.shape[3],(()=>"Error in conv3d: depth of input (".concat(f.shape[4],") must match ")+"input depth for filter ".concat(h.shape[3],"."))),s.assert((0,i.eitherStridesOrDilationsAreOne)(n,d),(()=>"Error in conv3D: Either strides or dilations must be 1. "+"Got strides ".concat(n," and dilations '").concat(d,"'"))),s.assert("NDHWC"===u,(()=>"Error in conv3d: got dataFormat of ".concat(u," but only NDHWC is currently supported.")));const g={x:f,filter:h},y={strides:n,pad:c,dataFormat:u,dilations:d},v=r.ENGINE.runKernel(a.Conv3D,g,y);return m?(0,l.reshape)(v,[v.shape[1],v.shape[2],v.shape[3],v.shape[4]]):v}})},209168:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.conv3DBackpropFilter=void 0;var r=n(90337),a=n(536217),o=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=c(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if("default"!==o&&{}.hasOwnProperty.call(e,o)){var s=a?Object.getOwnPropertyDescriptor(e,o):null;s&&(s.get||s.set)?Object.defineProperty(r,o,s):r[o]=e[o]}return r.default=e,n&&n.set(e,r),r}(n(904737)),s=n(930684),i=n(195476);function c(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(c=function(e){return e?n:t})(e)}t.conv3DBackpropFilter=(0,s.op)({conv3DBackpropFilter_:function(e,t,n,s,c){let l=e;4===e.rank&&(l=(0,i.reshape)(e,[1,e.shape[0],e.shape[1],e.shape[2],e.shape[3]]));let u=t;4===u.rank&&(u=(0,i.reshape)(t,[1,t.shape[0],t.shape[1],t.shape[2],t.shape[3]])),o.assert(5===l.rank,(()=>"Error in conv3dDerFilter: input must be rank 5, but got shape "+"".concat(l.shape,"."))),o.assert(5===u.rank,(()=>"Error in conv3dDerFilter: dy must be rank 5, but got shape "+"".concat(u.shape,"."))),o.assert(5===n.length,(()=>"Error in conv3dDerFilter: filterShape must be length 5, but got "+"".concat(n,"."))),o.assert(l.shape[4]===n[3],(()=>"Error in conv3dDerFilter: depth of input ".concat(l.shape[4],") must ")+"match input depth in filter (".concat(n[3],"."))),o.assert(u.shape[4]===n[4],(()=>"Error in conv3dDerFilter: depth of dy (".concat(u.shape[4],") must ")+"match output depth for filter (".concat(n[4],").")));const d={x:l,dy:u},p={strides:s,pad:c,filterShape:n};return r.ENGINE.runKernel(a.Conv3DBackpropFilterV2,d,p)}})},775646:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.conv3DBackpropInput=void 0;var r=n(90337),a=n(536217),o=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=c(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if("default"!==o&&{}.hasOwnProperty.call(e,o)){var s=a?Object.getOwnPropertyDescriptor(e,o):null;s&&(s.get||s.set)?Object.defineProperty(r,o,s):r[o]=e[o]}return r.default=e,n&&n.set(e,r),r}(n(904737)),s=n(930684),i=n(195476);function c(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(c=function(e){return e?n:t})(e)}t.conv3DBackpropInput=(0,s.op)({conv3DBackpropInput_:function(e,t,n,s,c){o.assert(e.length===t.rank,(()=>"Length of inShape "+"(".concat(e.length,") and rank of dy (").concat(t.rank,") must match")));let l=e,u=t,d=!1;4===t.rank&&(d=!0,u=(0,i.reshape)(t,[1,t.shape[0],t.shape[1],t.shape[2],t.shape[3]]),l=[1,e[0],e[1],e[2],e[3]]);const p=l[4],h=u.shape[4];o.assert(5===l.length,(()=>"Error in conv3dDerInput: inShape must be length 5, but got length "+"".concat(l.length,"."))),o.assert(5===u.rank,(()=>"Error in conv3dDerInput: dy must be rank 5, but got "+"rank ".concat(u.rank))),o.assert(5===n.rank,(()=>"Error in conv3dDerInput: filter must be rank 5, but got "+"rank ".concat(n.rank))),o.assert(p===n.shape[3],(()=>"Error in conv3dDerInput: depth of input (".concat(p,") must ")+"match input depth for filter ".concat(n.shape[3],"."))),o.assert(h===n.shape[4],(()=>"Error in conv3dDerInput: depth of output (".concat(h,") must ")+"match output depth for filter ".concat(n.shape[4],".")));const f={dy:u,filter:n},m={pad:c,strides:s,inputShape:l},g=r.ENGINE.runKernel(a.Conv3DBackpropInputV2,f,m);return d?(0,i.reshape)(g,[g.shape[1],g.shape[2],g.shape[3],g.shape[4]]):g}})}
1,276048:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.conv3dTranspose=void 0;var r=n(188695),a=n(775646),o=n(930684);t.conv3dTranspose=(0,o.op)({conv3dTranspose_:function(e,t,n,o,s){const i=(0,r.convertToTensor)(e,"x","conv3dTranspose"),c=(0,r.convertToTensor)(t,"filter","conv3dTranspose");return(0,a.conv3DBackpropInput)(n,i,c,o,s)}})},812682:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.checkPadOnDimRoundingMode=function(e,t,n){if(null!=n){if("string"==typeof t)throw Error("Error in ".concat(e,": pad must be an integer when using ")+"dimRoundingMode ".concat(n," but got pad ").concat(t,"."));if("number"==typeof t)r.assert(r.isInt(t),(()=>"Error in ".concat(e,": pad must be an integer when using ")+"dimRoundingMode ".concat(n," but got pad ").concat(t,".")));else{if("object"!=typeof t)throw Error("Error in ".concat(e,": Unknown padding parameter: ").concat(t));t.forEach((t=>{t.forEach((t=>{r.assert(r.isInt(t),(()=>"Error in ".concat(e,": pad must be an integer when using ")+"dimRoundingMode ".concat(n," but got pad ").concat(t,".")))}))}))}}},t.computeConv2DInfo=o,t.computeConv3DInfo=s,t.computeDefaultPad=i,t.computeDilation2DInfo=function(e,t,n,r){let a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:"NHWC",s=arguments.length>5?arguments[5]:void 0;const i=e[3],c=[...t,i],l=h(a);return o(e,c,n,s,r,null,null,l)},t.computePool2DInfo=function(e,t,n,r,a,s){let i=arguments.length>6&&void 0!==arguments[6]?arguments[6]:"channelsLast";const[l,u]=c(t);let d;if("channelsLast"===i)d=[l,u,e[3],e[3]];else{if("channelsFirst"!==i)throw new Error("Unknown dataFormat ".concat(i));d=[l,u,e[1],e[1]]}return o(e,d,n,r,a,s,!1,i)},t.computePool3DInfo=function(e,t,n,r,a,o){let i=arguments.length>6&&void 0!==arguments[6]?arguments[6]:"NDHWC";const[c,u,d]=l(t);let p,h;if("NDHWC"===i)h="channelsLast",p=[c,u,d,e[4],e[4]];else{if("NCDHW"!==i)throw new Error("Unknown dataFormat ".concat(i));h="channelsFirst",p=[c,u,d,e[1],e[1]]}return s(e,p,n,r,a,!1,h,o)},t.convertConv2DDataFormat=h,t.eitherStridesOrDilationsAreOne=function(e,t){return p(e)||p(t)},t.tupleValuesAreOne=p;var r=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=a(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var s in e)if("default"!==s&&{}.hasOwnProperty.call(e,s)){var i=o?Object.getOwnPropertyDescriptor(e,s):null;i&&(i.get||i.set)?Object.defineProperty(r,s,i):r[s]=e[s]}return r.default=e,n&&n.set(e,r),r}(n(904737));function a(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(a=function(e){return e?n:t})(e)}function o(e,t,n,r,a,o){let s=arguments.length>6&&void 0!==arguments[6]&&arguments[6],l=arguments.length>7&&void 0!==arguments[7]?arguments[7]:"channelsLast",[p,h,f,m]=[-1,-1,-1,-1];if("channelsLast"===l)[p,h,f,m]=e;else{if("channelsFirst"!==l)throw new Error("Unknown dataFormat ".concat(l));[p,m,h,f]=e}const[g,y,,v]=t,[b,x]=c(n),[w,k]=c(r),_=u(g,w),C=u(y,k),{padInfo:P,outHeight:O,outWidth:N}=function(e,t,n,r,a,o,s,c,l){let u,p,h;
1if("number"==typeof e){u={top:e,bottom:e,left:e,right:e,type:0===e?"VALID":"NUMBER"};const a=function(e,t,n,r,a){null==r&&(r=i(e,t,n));const o=e[0],s=e[1],c=d((o-t+2*r)/n+1,a),l=d((s-t+2*r)/n+1,a);return[c,l]}([t,n],o,r,e,c);p=a[0],h=a[1]}else if("same"===e){p=Math.ceil(t/r),h=Math.ceil(n/a);const e=Math.max(0,(p-1)*r+o-t),i=Math.max(0,(h-1)*a+s-n),c=Math.floor(e/2),l=e-c,d=Math.floor(i/2);u={top:c,bottom:l,left:d,right:i-d,type:"SAME"}}else if("valid"===e)u={top:0,bottom:0,left:0,right:0,type:"VALID"},p=Math.ceil((t-o+1)/r),h=Math.ceil((n-s+1)/a);else{if("object"!=typeof e)throw Error("Unknown padding parameter: ".concat(e));{const i="channelsLast"===l?e[1][0]:e[2][0],f="channelsLast"===l?e[1][1]:e[2][1],m="channelsLast"===l?e[2][0]:e[3][0],g="channelsLast"===l?e[2][1]:e[3][1];u={top:i,bottom:f,left:m,right:g,type:0===i&&0===f&&0===m&&0===g?"VALID":"EXPLICIT"},p=d((t-o+i+f)/r+1,c),h=d((n-s+m+g)/a+1,c)}}return{padInfo:u,outHeight:p,outWidth:h}}(a,h,f,b,x,_,C,o,l),I=s?v*m:v;let T;return"channelsFirst"===l?T=[p,I,O,N]:"channelsLast"===l&&(T=[p,O,N,I]),{batchSize:p,dataFormat:l,inHeight:h,inWidth:f,inChannels:m,outHeight:O,outWidth:N,outChannels:I,padInfo:P,strideHeight:b,strideWidth:x,filterHeight:g,filterWidth:y,effectiveFilterHeight:_,effectiveFilterWidth:C,dilationHeight:w,dilationWidth:k,inShape:e,outShape:T,filterShape:t}}function s(e,t,n,r,a){let o=arguments.length>5&&void 0!==arguments[5]&&arguments[5],s=arguments.length>6&&void 0!==arguments[6]?arguments[6]:"channelsLast",c=arguments.length>7?arguments[7]:void 0,[p,h,f,m,g]=[-1,-1,-1,-1,-1];if("channelsLast"===s)[p,h,f,m,g]=e;else{if("channelsFirst"!==s)throw new Error("Unknown dataFormat ".concat(s));[p,g,h,f,m]=e}const[y,v,b,,x]=t,[w,k,_]=l(n),[C,P,O]=l(r),N=u(y,C),I=u(v,P),T=u(b,O),{padInfo:S,outDepth:E,outHeight:M,outWidth:A}=function(e,t,n,r,a,o,s,c,l,u,p){let h,f,m,g;if("number"==typeof e){h={top:e,bottom:e,left:e,right:e,front:e,back:e,type:0===e?"VALID":"NUMBER"};const o=function(e,t,n,r,a,o){null==a&&(a=i(e,t,r));const s=e[0],c=e[1],l=e[2],u=d((s-t+2*a)/r+1,o),p=d((c-t+2*a)/r+1,o),h=d((l-t+2*a)/r+1,o);return[u,p,h,n]}([t,n,r,1],c,1,a,e,p);f=o[0],m=o[1],g=o[2]}else if("same"===e){f=Math.ceil(t/a),m=Math.ceil(n/o),g=Math.ceil(r/s);const e=(f-1)*a+c-t,i=(m-1)*o+l-n,d=(g-1)*s+u-r,p=Math.floor(e/2),y=e-p,v=Math.floor(i/2),b=i-v,x=Math.floor(d/2);h={top:v,bottom:b,left:x,right:d-x,front:p,back:y,type:"SAME"}}else{if("valid"!==e)throw Error("Unknown padding parameter: ".concat(e));h={top:0,bottom:0,left:0,right:0,front:0,back:0,type:"VALID"},f=Math.ceil((t-c+1)/a),m=Math.ceil((n-l+1)/o),g=Math.ceil((r-u+1)/s)}return{padInfo:h,outDepth:f,outHeight:m,outWidth:g}}(a,h,f,m,w,k,_,N,I,T,c),D=o?x*g:x;let R;return"channelsFirst"===s?R=[p,D,E,M,A]:"channelsLast"===s&&(R=[p,E,M,A,D]),{batchSize:p,dataFormat:s,inDepth:h,inHeight:f,inWidth:m,inChannels:g,outDepth:E,outHeight:M,outWidth:A,outChannels:D,padInfo:S,strideDepth:w,strideHeight:k,strideWidth:_,filterDepth:y,filterHeight:v,filterWidth:b,effectiveFilterDepth:N,effectiveFilterHeight:I,effectiveFilterWidth:T,dilationDepth:C,dilationHeight:P,dilationWidth:O,inShape:e,outShape:R,filterShape:t}}function i(e,t,n){const r=u(t,arguments.length>3&&void 0!==arguments[3]?arguments[3]:1);return Math.floor((e[0]*(n-1)-n+r)/2)}function c(e){return"number"==typeof e?[e,e,e]:2===e.length?[e[0],e[1],1]:e}function l(e){return"number"==typeof e?[e,e,e]:e}function u(e,t){return t<=1?e:e+(e-1)*(t-1)}function d(e,t){if(!t)return Math.trunc(e);switch(t){case"round":return Math.round(e);case"ceil":return Math.ceil(e);case"floor":return Math.floor(e);default:throw new Error("Unknown roundingMode ".concat(t))}}function p(e){const[t,n,r]=c(e);return 1===t&&1===n&&1===r}function h(e){if("NHWC"===e)return"channelsLast";if("NCHW"===e)return"channelsFirst";throw new Error("Unknown dataFormat ".concat(e))}},317321:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.cos=void 0;var r=n(90337),a=n(536217),o=n(188695),s=n(930684);t.cos=(0,s.op)({cos_:function(e){const t={x:(0,o.convertToTensor)(e,"x","cos","float32")};return r.ENGINE.runKernel(a.Cos,t)}})},66008:(e,t,n)=>{"use strict";
1Object.defineProperty(t,"__esModule",{value:!0}),t.cosh=void 0;var r=n(90337),a=n(536217),o=n(188695),s=n(930684);t.cosh=(0,s.op)({cosh_:function(e){const t={x:(0,o.convertToTensor)(e,"x","cosh","float32")};return r.ENGINE.runKernel(a.Cosh,t)}})},110727:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.cumsum=void 0;var r=n(90337),a=n(536217),o=n(188695),s=n(930684);t.cumsum=(0,s.op)({cumsum_:function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],s=arguments.length>3&&void 0!==arguments[3]&&arguments[3];const i={x:(0,o.convertToTensor)(e,"x","cumsum")},c={axis:t,exclusive:n,reverse:s};return r.ENGINE.runKernel(a.Cumsum,i,c)}})},248410:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.denseBincount=void 0;var r=n(90337),a=n(536217),o=n(188695),s=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=c(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if("default"!==o&&{}.hasOwnProperty.call(e,o)){var s=a?Object.getOwnPropertyDescriptor(e,o):null;s&&(s.get||s.set)?Object.defineProperty(r,o,s):r[o]=e[o]}return r.default=e,n&&n.set(e,r),r}(n(904737)),i=n(930684);function c(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(c=function(e){return e?n:t})(e)}t.denseBincount=(0,i.op)({denseBincount_:function(e,t,n){let i=arguments.length>3&&void 0!==arguments[3]&&arguments[3];const c=(0,o.convertToTensor)(e,"x","denseBincount"),l=(0,o.convertToTensor)(t,"weights","denseBincount");s.assert("int32"===c.dtype,(()=>"Error in denseBincount: input "+"dtype must be int32, but got ".concat(c.dtype))),s.assert(c.rank<=2,(()=>"Error in denseBincount: input must be at most rank 2, but got "+"rank ".concat(c.rank,"."))),s.assert(n>=0,(()=>"size must be non-negative, but got ".concat(n,"."))),s.assert(l.size===c.size||0===l.size,(()=>"Error in denseBincount: weights must have the same shape as x or "+"0-length, but got x shape: ".concat(c.shape,", weights shape: ")+"".concat(l.shape,".")));const u={x:c,weights:l},d={size:n,binaryOutput:i};return r.ENGINE.runKernel(a.DenseBincount,u,d)}})},646051:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.depthToSpace=void 0;var r=n(90337),a=n(536217),o=n(188695),s=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=c(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if("default"!==o&&{}.hasOwnProperty.call(e,o)){var s=a?Object.getOwnPropertyDescriptor(e,o):null;s&&(s.get||s.set)?Object.defineProperty(r,o,s):r[o]=e[o]}return r.default=e,n&&n.set(e,r),r}(n(904737)),i=n(930684);function c(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(c=function(e){return e?n:t})(e)}t.depthToSpace=(0,i.op)({depthToSpace_:function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"NHWC";const i=(0,o.convertToTensor)(e,"x","depthToSpace","float32"),c="NHWC"===n?i.shape[1]:i.shape[2],l="NHWC"===n?i.shape[2]:i.shape[3],u="NHWC"===n?i.shape[3]:i.shape[1];s.assert(t>1,(()=>"blockSize should be > 1 for depthToSpace, but was: ".concat(t))),s.assert(c*t>=0,(()=>"Negative dimension size caused by overflow when multiplying\n ".concat(c," and ").concat(t," for depthToSpace with input shape\n ").concat(i.shape))),s.assert(l*t>=0,(()=>"Negative dimension size caused by overflow when multiplying\n ".concat(l," and ").concat(t," for depthToSpace with input shape\n ").concat(i.shape))),s.assert(u%(t*t)==0,(()=>"Dimension size must be evenly divisible by ".concat(t*t," but is ").concat(u," for depthToSpace with input shape ").concat(i.shape)));const d={x:i},p={blockSize:t,dataFormat:n};return r.ENGINE.runKernel(a.DepthToSpace,d,p)}})},599081:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.depthwiseConv2d=void 0;var r=n(90337),a=n(536217),o=n(188695),s=d(n(904737)),i=d(n(812682)),c=n(930684),l=n(195476);function u(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(u=function(e){return e?n:t})(e)}
1function d(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=u(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if("default"!==o&&{}.hasOwnProperty.call(e,o)){var s=a?Object.getOwnPropertyDescriptor(e,o):null;s&&(s.get||s.set)?Object.defineProperty(r,o,s):r[o]=e[o]}return r.default=e,n&&n.set(e,r),r}t.depthwiseConv2d=(0,c.op)({depthwiseConv2d_:function(e,t,n,c){let u=arguments.length>4&&void 0!==arguments[4]?arguments[4]:"NHWC",d=arguments.length>5&&void 0!==arguments[5]?arguments[5]:[1,1],p=arguments.length>6?arguments[6]:void 0;const h=(0,o.convertToTensor)(e,"x","depthwiseConv2d","float32"),f=(0,o.convertToTensor)(t,"filter","depthwiseConv2d","float32");let m=h,g=!1;3===h.rank&&(g=!0,m=(0,l.reshape)(h,[1,h.shape[0],h.shape[1],h.shape[2]])),s.assert(4===m.rank,(()=>"Error in depthwiseConv2d: input must be rank 4, but got "+"rank ".concat(m.rank,"."))),s.assert(4===f.rank,(()=>"Error in depthwiseConv2d: filter must be rank 4, but got rank "+"".concat(f.rank,"."))),s.assert(m.shape[3]===f.shape[2],(()=>"Error in depthwiseConv2d: number of input channels "+"(".concat(m.shape[3],") must match the inChannels dimension in ")+"filter ".concat(f.shape[2],"."))),i.checkPadOnDimRoundingMode("depthwiseConv2d",c,p);const y={x:m,filter:f},v={strides:n,pad:c,dataFormat:u,dilations:d,dimRoundingMode:p},b=r.ENGINE.runKernel(a.DepthwiseConv2dNative,y,v);return g?(0,l.reshape)(b,[b.shape[1],b.shape[2],b.shape[3]]):b}})},114827:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.depthwiseConv2dNativeBackpropFilter=void 0;var r=n(90337),a=n(536217),o=n(930684),s=n(195476);t.depthwiseConv2dNativeBackpropFilter=(0,o.op)({depthwiseConv2dNativeBackpropFilter_:function(e,t,n,o,i){let c=arguments.length>5&&void 0!==arguments[5]?arguments[5]:[1,1],l=arguments.length>6?arguments[6]:void 0,u=e;3===e.rank&&(u=(0,s.reshape)(e,[1,e.shape[0],e.shape[1],e.shape[2]]));let d=t;3===d.rank&&(d=(0,s.reshape)(t,[1,t.shape[0],t.shape[1],t.shape[2]]));const p={x:u,dy:d},h={strides:o,pad:i,dimRoundingMode:l,dilations:c,filterShape:n};return r.ENGINE.runKernel(a.DepthwiseConv2dNativeBackpropFilter,p,h)}})},749273:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.depthwiseConv2dNativeBackpropInput=void 0;var r=n(90337),a=n(536217),o=n(930684),s=n(195476);t.depthwiseConv2dNativeBackpropInput=(0,o.op)({depthwiseConv2dNativeBackpropInput_:function(e,t,n,o,i){let c=arguments.length>5&&void 0!==arguments[5]?arguments[5]:[1,1],l=arguments.length>6?arguments[6]:void 0,u=t,d=!1;3===t.rank&&(d=!0,u=(0,s.reshape)(t,[1,t.shape[0],t.shape[1],t.shape[2]]));const p={dy:u,filter:n},h={strides:o,pad:i,dimRoundingMode:l,dilations:c,inputShape:e},f=r.ENGINE.runKernel(a.DepthwiseConv2dNativeBackpropInput,p,h);return d?(0,s.reshape)(f,[f.shape[1],f.shape[2],f.shape[3]]):f}})},232491:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.diag=void 0;var r=n(90337),a=n(536217),o=n(188695),s=n(930684);t.diag=(0,s.op)({diag_:function(e){const t={x:(0,o.convertToTensor)(e,"x","diag")};return r.ENGINE.runKernel(a.Diag,t)}})},77495:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.dilation2d=void 0;var r=n(90337),a=n(536217),o=n(188695),s=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=l(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if("default"!==o&&{}.hasOwnProperty.call(e,o)){var s=a?Object.getOwnPropertyDescriptor(e,o):null;s&&(s.get||s.set)?Object.defineProperty(r,o,s):r[o]=e[o]}return r.default=e,n&&n.set(e,r),r}(n(904737)),i=n(930684),c=n(195476);function l(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(l=function(e){return e?n:t})(e)}t.dilation2d=(0,i.op)({dilation2d_:function(e,t,n,i){let l=arguments.length>4&&void 0!==arguments[4]?arguments[4]:[1,1],u=arguments.length>5&&void 0!==arguments[5]?arguments[5]:"NHWC";
1const d=(0,o.convertToTensor)(e,"x","dilation2d"),p=(0,o.convertToTensor)(t,"filter","dilation2d");s.assert(3===d.rank||4===d.rank,(()=>"Error in dilation2d: input must be rank 3 or 4, but got rank "+"".concat(d.rank,"."))),s.assert(3===p.rank,(()=>"Error in dilation2d: filter must be rank 3, but got rank "+"".concat(p.rank,"."))),s.assert("NHWC"===u,(()=>"Error in dilation2d: Only NHWC is currently supported, "+"but got dataFormat of ".concat(u)));let h=d,f=!1;3===d.rank&&(h=(0,c.reshape)(d,[1,d.shape[0],d.shape[1],d.shape[2]]),f=!0);const m={x:h,filter:p},g={strides:n,pad:i,dilations:l},y=r.ENGINE.runKernel(a.Dilation2D,m,g);return f?(0,c.reshape)(y,[y.shape[1],y.shape[2],y.shape[3]]):y}})},67282:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.div=void 0;var r=n(90337),a=n(536217),o=n(390771),s=n(188695),i=n(25485),c=n(930684);t.div=(0,c.op)({div_:function(e,t){let n=(0,s.convertToTensor)(e,"a","div"),c=(0,s.convertToTensor)(t,"b","div");if([n,c]=(0,o.makeTypesMatch)(n,c),"int32"===n.dtype&&"int32"===c.dtype)return(0,i.floorDiv)(n,c);const l={a:n,b:c};return r.ENGINE.runKernel(a.RealDiv,l,{})}})},998342:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.divNoNan=void 0;var r=n(390771),a=n(188695),o=n(67282),s=n(674655),i=n(930684),c=n(376131),l=n(166119);t.divNoNan=(0,i.op)({divNoNan_:function(e,t){let n=(0,a.convertToTensor)(e,"a","div"),i=(0,a.convertToTensor)(t,"b","div");[n,i]=(0,r.makeTypesMatch)(n,i);const u=(0,o.div)(n,i),d=(0,l.zerosLike)(u),p=(0,s.equal)(i,d);return(0,c.where)(p,d,u)}})},379895:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.dot=void 0;var r=n(188695),a=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=c(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if("default"!==o&&{}.hasOwnProperty.call(e,o)){var s=a?Object.getOwnPropertyDescriptor(e,o):null;s&&(s.get||s.set)?Object.defineProperty(r,o,s):r[o]=e[o]}return r.default=e,n&&n.set(e,r),r}(n(904737)),o=n(986588),s=n(930684),i=n(195476);function c(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(c=function(e){return e?n:t})(e)}t.dot=(0,s.op)({dot_:function(e,t){const n=(0,r.convertToTensor)(e,"t1","dot"),s=(0,r.convertToTensor)(t,"t2","dot");a.assert(!(1!==n.rank&&2!==n.rank||1!==s.rank&&2!==s.rank),(()=>"Error in dot: inputs must all be rank 1 or 2, but got ranks "+"".concat(n.rank," and ").concat(s.rank,".")));const c=1===n.rank?n.size:n.shape[1],l=1===s.rank?s.size:s.shape[0];if(a.assert(c===l,(()=>"Error in dot: inner dimensions of inputs must match, but got "+"".concat(c," and ").concat(l,"."))),1===n.rank&&1===s.rank){const e=(0,i.reshape)(n,[1,-1]),t=(0,i.reshape)(s,[-1,1]),r=(0,o.matMul)(e,t);return(0,i.reshape)(r,[])}if(1===n.rank&&2===s.rank){const e=(0,i.reshape)(n,[1,-1]),t=(0,i.reshape)(s,[s.shape[0],s.shape[1]]),r=(0,o.matMul)(e,t);return(0,i.reshape)(r,[r.size])}if(2===n.rank&&1===s.rank){const e=(0,i.reshape)(s,[-1,1]),t=(0,o.matMul)(n,e);return(0,i.reshape)(t,[t.size])}{const e=(0,i.reshape)(s,[s.shape[0],s.shape[1]]);return(0,o.matMul)(n,e)}}})},179433:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.dropout=void 0;var r=n(659795),a=n(188695),o=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=h(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if("default"!==o&&{}.hasOwnProperty.call(e,o)){var s=a?Object.getOwnPropertyDescriptor(e,o):null;s&&(s.get||s.set)?Object.defineProperty(r,o,s):r[o]=e[o]}return r.default=e,n&&n.set(e,r),r}(n(904737)),s=n(353632),i=n(67282),c=n(131282),l=n(450879),u=n(295702),d=n(930684),p=n(324852);function h(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(h=function(e){return e?n:t})(e)}t.dropout=(0,d.op)({dropout_:function(e,t,n,d){const h=(0,a.convertToTensor)(e,"x","dropout");if(o.assert("float32"===h.dtype,(()=>"x has to be a floating point tensor since it's going to be "+"scaled, but got a ".concat(h.dtype," tensor instead."))),o.assert(t>=0&&t<1,(()=>"rate must be a float in the range [0, 1), but got ".concat(t,"."))),0===t)return e instanceof r.Tensor?h.clone():h;
1const f=(0,c.getNoiseShape)(h,n),m=1-t,g=(0,i.div)((0,l.floor)((0,s.add)((0,p.randomUniform)(f,0,1,"float32",d),m)),m);return(0,u.mul)(h,g)}})},131282:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getNoiseShape=function(e,t){if(null==t)return e.shape.slice();if(r.arraysEqual(e.shape,t))return t;if(e.shape.length===t.length){const n=[];for(let r=0;r<e.shape.length;r++)null==t[r]&&null!=e.shape[r]?n.push(e.shape[r]):n.push(t[r]);return n}return t};var r=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=a(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var s in e)if("default"!==s&&{}.hasOwnProperty.call(e,s)){var i=o?Object.getOwnPropertyDescriptor(e,s):null;i&&(i.get||i.set)?Object.defineProperty(r,s,i):r[s]=e[s]}return r.default=e,n&&n.set(e,r),r}(n(904737));function a(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(a=function(e){return e?n:t})(e)}},649439:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.einsum=void 0,t.einsum_=i;var r=n(90337),a=n(536217),o=n(188695),s=n(930684);function i(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),s=1;s<t;s++)n[s-1]=arguments[s];const i=n.map(((e,t)=>(0,o.convertToTensor)(e,"tensors".concat(t),"einsum"))),c={equation:e};return r.ENGINE.runKernel(a.Einsum,i,c)}t.einsum=(0,s.op)({einsum_:i})},675403:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.elu=void 0;var r=n(90337),a=n(536217),o=n(188695),s=n(930684);t.elu=(0,s.op)({elu_:function(e){const t={x:(0,o.convertToTensor)(e,"x","elu","float32")};return r.ENGINE.runKernel(a.Elu,t)}})},674655:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.equal=void 0;var r=n(90337),a=n(536217),o=n(390771),s=n(188695),i=n(534779),c=n(930684);t.equal=(0,c.op)({equal_:function(e,t){let n=(0,s.convertToTensor)(e,"a","equal","string_or_numeric"),c=(0,s.convertToTensor)(t,"b","equal","string_or_numeric");[n,c]=(0,o.makeTypesMatch)(n,c),(0,i.assertAndGetBroadcastShape)(n.shape,c.shape);const l={a:n,b:c};return r.ENGINE.runKernel(a.Equal,l)}})},933414:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.erf=void 0;var r=n(90337),a=n(536217),o=n(188695),s=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=l(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if("default"!==o&&{}.hasOwnProperty.call(e,o)){var s=a?Object.getOwnPropertyDescriptor(e,o):null;s&&(s.get||s.set)?Object.defineProperty(r,o,s):r[o]=e[o]}return r.default=e,n&&n.set(e,r),r}(n(904737)),i=n(386565),c=n(930684);function l(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(l=function(e){return e?n:t})(e)}t.erf=(0,c.op)({erf_:function(e){let t=(0,o.convertToTensor)(e,"x","erf");s.assert("int32"===t.dtype||"float32"===t.dtype,(()=>"Input dtype must be `int32` or `float32`.")),"int32"===t.dtype&&(t=(0,i.cast)(t,"float32"));const n={x:t};return r.ENGINE.runKernel(a.Erf,n)}})},372582:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ERF_P=t.ERF_A5=t.ERF_A4=t.ERF_A3=t.ERF_A2=t.ERF_A1=void 0;t.ERF_P=.3275911,t.ERF_A1=.254829592,t.ERF_A2=-.284496736,t.ERF_A3=1.421413741,t.ERF_A4=-1.453152027,t.ERF_A5=1.061405429},99815:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.exp=void 0;var r=n(90337),a=n(536217),o=n(188695),s=n(930684);t.exp=(0,s.op)({exp_:function(e){const t={x:(0,o.convertToTensor)(e,"x","exp")};return r.ENGINE.runKernel(a.Exp,t)}})},621724:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.expandDims=void 0;var r=n(90337),a=n(536217),o=n(188695),s=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=c(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if("default"!==o&&{}.hasOwnProperty.call(e,o)){var s=a?Object.getOwnPropertyDescriptor(e,o):null;s&&(s.get||s.set)?Object.defineProperty(r,o,s):r[o]=e[o]}return r.default=e,n&&n.set(e,r),r}(n(904737)),i=n(930684);function c(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(c=function(e){return e?n:t})(e)}t.expandDims=(0,i.op)({expandDims_:function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;const n=(0,o.convertToTensor)(e,"x","expandDims","string_or_numeric");s.assert(t<=n.rank,(()=>"Axis must be <= rank of the tensor"));const i={input:n},c={dim:t};return r.ENGINE.runKernel(a.ExpandDims,i,c)}})},564386:(e,t,n)=>{"use strict";
1Object.defineProperty(t,"__esModule",{value:!0}),t.expm1=void 0;var r=n(90337),a=n(536217),o=n(188695),s=n(930684);t.expm1=(0,s.op)({expm1_:function(e){const t={x:(0,o.convertToTensor)(e,"x","expm1")};return r.ENGINE.runKernel(a.Expm1,t)}})},736974:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.eye=void 0;var r=n(60249),a=n(621724),o=n(930684),s=n(195476),i=n(134987);t.eye=(0,o.op)({eye_:function(e,t,n){let o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"float32";null==t&&(t=e);const c=(0,r.buffer)([e,t],o),l=e<=t?e:t;for(let e=0;e<l;++e)c.set(1,e,e);const u=(0,s.reshape)(c.toTensor(),[e,t]);if(null==n)return u;if(1===n.length)return(0,i.tile)((0,a.expandDims)(u,0),[n[0],1,1]);if(2===n.length)return(0,i.tile)((0,a.expandDims)((0,a.expandDims)(u,0),0),[n[0],n[1],1,1]);if(3===n.length)return(0,i.tile)((0,a.expandDims)((0,a.expandDims)((0,a.expandDims)(u,0),0),0),[n[0],n[1],n[2],1,1]);throw new Error("eye() currently supports only 1D and 2D "+"batchShapes, but received ".concat(n.length,"D."))}})},970061:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.fill=function(e,t,n){const o={shape:e,value:t,dtype:n};return r.ENGINE.runKernel(a.Fill,{},o)};var r=n(90337),a=n(536217)},450879:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.floor=void 0;var r=n(90337),a=n(536217),o=n(188695),s=n(930684);t.floor=(0,s.op)({floor_:function(e){const t={x:(0,o.convertToTensor)(e,"x","floor","float32")};return r.ENGINE.runKernel(a.Floor,t)}})},25485:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.floorDiv=void 0;var r=n(90337),a=n(536217),o=n(390771),s=n(188695),i=n(930684);t.floorDiv=(0,i.op)({floorDiv_:function(e,t){let n=(0,s.convertToTensor)(e,"a","floorDiv"),i=(0,s.convertToTensor)(t,"b","floorDiv");[n,i]=(0,o.makeTypesMatch)(n,i);const c={a:n,b:i};return r.ENGINE.runKernel(a.FloorDiv,c)}})},76387:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.conv2d=void 0;var r=n(90337),a=n(931564),o=n(536217),s=n(390771),i=n(188695),c=b(n(904737)),l=n(353632),u=b(n(534779)),d=n(797476),p=n(948519),h=n(713310),f=b(n(812682)),m=n(842772),g=n(930684),y=n(195476);function v(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(v=function(e){return e?n:t})(e)}function b(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=v(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if("default"!==o&&{}.hasOwnProperty.call(e,o)){var s=a?Object.getOwnPropertyDescriptor(e,o):null;s&&(s.get||s.set)?Object.defineProperty(r,o,s):r[o]=e[o]}return r.default=e,n&&n.set(e,r),r}t.conv2d=(0,g.op)({fusedConv2d_:function(e){let{x:t,filter:n,strides:g,pad:v,dataFormat:b="NHWC",dilations:x=[1,1],dimRoundingMode:w,bias:k,activation:_="linear",preluActivationWeights:C,leakyreluAlpha:P}=e;if(_=_||"linear",!1===(0,m.shouldFuse)(r.ENGINE.state.gradientDepth,_)){let e=(0,d.conv2d)(t,n,g,v,b,x,w);return null!=k&&(e=(0,l.add)(e,k)),(0,m.applyActivation)(e,_,C,P)}const O=(0,i.convertToTensor)(t,"x","conv2d","float32"),N=(0,i.convertToTensor)(n,"filter","conv2d","float32");let I=O,T=!1;3===O.rank&&(T=!0,I=(0,y.reshape)(O,[1,O.shape[0],O.shape[1],O.shape[2]])),c.assert(4===I.rank,(()=>"Error in fused conv2d: input must be rank 4, but got rank "+"".concat(I.rank,"."))),c.assert(4===N.rank,(()=>"Error in fused conv2d: filter must be rank 4, but got rank "+"".concat(N.rank,"."))),f.checkPadOnDimRoundingMode("fused conv2d",v,w),c.assert(I.shape[3]===N.shape[2],(()=>"Error in conv2d: depth of input (".concat(I.shape[3],") must match ")+"input depth for filter ".concat(N.shape[2],"."))),c.assert(f.eitherStridesOrDilationsAreOne(g,x),(()=>"Error in conv2D: Either strides or dilations must be 1. "+"Got strides ".concat(g," and dilations '").concat(x,"'"))),c.assert("NHWC"===b,(()=>"Error in conv2d: got dataFormat of ".concat(b," but only NHWC is currently supported.")));const S=f.computeConv2DInfo(I.shape,N.shape,g,x,v,w);let E,M;null!=k&&(E=(0,i.convertToTensor)(k,"bias","fused conv2d"),[E]=(0,s.makeTypesMatch)(E,O),u.assertAndGetBroadcastShape(S.outShape,E.shape)),null!=C&&(M=(0,i.convertToTensor)(C,"prelu weights","fused conv2d"));const A=(e,t)=>
1{const[n,r,a,o]=t,s=(0,m.getFusedDyActivation)(e,a,_);c.assert(f.tupleValuesAreOne(x),(()=>"Error in gradient of fused conv2D: dilation rates greater than 1 "+"are not yet supported in gradients. Got dilations '".concat(x,"'")));const i=[(0,h.conv2DBackpropInput)(r.shape,s,n,g,v),(0,p.conv2DBackpropFilter)(r,s,n.shape,g,v)];if(null!=o){const e=(0,m.getFusedBiasGradient)(o,s);i.push(e)}return i},D={x:I,filter:N,bias:E,preluActivationWeights:M},R={strides:g,pad:v,dataFormat:b,dilations:x,dimRoundingMode:w,activation:_,leakyreluAlpha:P};if(null==k){const e=(0,a.customGrad)(((e,t,n)=>{let a=r.ENGINE.runKernel(o.FusedConv2D,D,R);return n([t,e,a]),T&&(a=(0,y.reshape)(a,[a.shape[1],a.shape[2],a.shape[3]])),{value:a,gradFunc:A}}));return e(I,N)}{const e=(0,a.customGrad)(((e,t,n,a)=>{let s=r.ENGINE.runKernel(o.FusedConv2D,D,R);return a([t,e,s,n]),T&&(s=(0,y.reshape)(s,[s.shape[1],s.shape[2],s.shape[3]])),{value:s,gradFunc:A}}));return e(I,N,E)}}})},222541:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.depthwiseConv2d=void 0;var r=n(90337),a=n(931564),o=n(536217),s=n(390771),i=n(188695),c=b(n(904737)),l=n(353632),u=b(n(534779)),d=b(n(812682)),p=n(599081),h=n(114827),f=n(749273),m=n(842772),g=n(930684),y=n(195476);function v(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(v=function(e){return e?n:t})(e)}function b(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=v(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if("default"!==o&&{}.hasOwnProperty.call(e,o)){var s=a?Object.getOwnPropertyDescriptor(e,o):null;s&&(s.get||s.set)?Object.defineProperty(r,o,s):r[o]=e[o]}return r.default=e,n&&n.set(e,r),r}t.depthwiseConv2d=(0,g.op)({fusedDepthwiseConv2d_:function(e){let{x:t,filter:n,strides:g,pad:v,dataFormat:b="NHWC",dilations:x=[1,1],dimRoundingMode:w,bias:k,activation:_="linear",preluActivationWeights:C,leakyreluAlpha:P}=e;if(!1===(0,m.shouldFuse)(r.ENGINE.state.gradientDepth,_)){let e=(0,p.depthwiseConv2d)(t,n,g,v,b,x,w);return null!=k&&(e=(0,l.add)(e,k)),(0,m.applyActivation)(e,_,C,P)}const O=(0,i.convertToTensor)(t,"x","depthwiseConv2d","float32"),N=(0,i.convertToTensor)(n,"filter","depthwiseConv2d","float32");let I=O,T=!1;3===O.rank&&(T=!0,I=(0,y.reshape)(O,[1,O.shape[0],O.shape[1],O.shape[2]])),c.assert(4===I.rank,(()=>"Error in fused depthwiseConv2d: input must be rank 4, but got "+"rank ".concat(I.rank,"."))),c.assert(4===N.rank,(()=>"Error in fused depthwiseConv2d: filter must be rank 4, "+"but got rank ".concat(N.rank,"."))),c.assert(I.shape[3]===N.shape[2],(()=>"Error in fused depthwiseConv2d: number of input channels "+"(".concat(I.shape[3],") must match the inChannels dimension in ")+"filter ".concat(N.shape[2],"."))),null==x&&(x=[1,1]),c.assert(d.eitherStridesOrDilationsAreOne(g,x),(()=>"Error in fused depthwiseConv2d: Either strides or dilations must "+"be 1. Got strides ".concat(g," and dilations '").concat(x,"'"))),d.checkPadOnDimRoundingMode("fused depthwiseConv2d",v,w);const S=d.computeConv2DInfo(I.shape,N.shape,g,x,v,w,!0);let E,M;null!=k&&(E=(0,i.convertToTensor)(k,"bias","fused conv2d"),[E]=(0,s.makeTypesMatch)(E,O),u.assertAndGetBroadcastShape(S.outShape,E.shape)),null!=C&&(M=(0,i.convertToTensor)(C,"prelu weights","fused depthwiseConv2d"));const A=(e,t)=>{c.assert(d.tupleValuesAreOne(x),(()=>"Error in gradient of fused depthwiseConv2d: dilation rates greater than 1 are not yet supported. Got dilations "+"'".concat(x,"'")));const[n,r,a,o]=t,s=(0,m.getFusedDyActivation)(e,a,_),i=(0,f.depthwiseConv2dNativeBackpropInput)(r.shape,s,n,g,v,x,w),l=(0,h.depthwiseConv2dNativeBackpropFilter)(r,s,n.shape,g,v,x,w);if(null!=o){return[i,l,(0,m.getFusedBiasGradient)(E,s)]}return[i,l]},D={x:I,filter:N,bias:E,preluActivationWeights:M},R={strides:g,pad:v,dataFormat:b,dilations:x,dimRoundingMode:w,activation:_,leakyreluAlpha:P};if(null==k){const e=(0,a.customGrad)(((e,t,n)=>{let a=r.ENGINE.runKernel(o.FusedDepthwiseConv2D,D,R);return n([t,e,a]),T&&(a=(0,y.reshape)(a,[a.shape[1],a.shape[2],a.shape[3]])),{value:a,gradFunc:A}}));return e(I,N)}{const e=(0,a.customGrad)(((e,t,n,a)=>{let s=r.ENGINE.runKernel(o.FusedDepthwiseConv2D,D,R);return a([t,e,s,n]),T&&(s=(0,y.reshape)(s,[s.shape[1],s.shape[2],s.shape[3]])),{value:s,gradFunc:A}}));return e(I,N,E)}}})},722150:(e,t,n)=>{"use strict";
1Object.defineProperty(t,"__esModule",{value:!0}),t.matMul=void 0;var r=n(90337),a=n(931564),o=n(536217),s=n(390771),i=n(188695),c=g(n(904737)),l=n(353632),u=g(n(534779)),d=n(842772),p=n(986588),h=n(930684),f=n(195476);function m(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(m=function(e){return e?n:t})(e)}function g(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=m(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if("default"!==o&&{}.hasOwnProperty.call(e,o)){var s=a?Object.getOwnPropertyDescriptor(e,o):null;s&&(s.get||s.set)?Object.defineProperty(r,o,s):r[o]=e[o]}return r.default=e,n&&n.set(e,r),r}t.matMul=(0,h.op)({fusedMatMul_:function(e){let{a:t,b:n,transposeA:h=!1,transposeB:m=!1,bias:g,activation:y="linear",preluActivationWeights:v,leakyreluAlpha:b}=e;if(!1===(0,d.shouldFuse)(r.ENGINE.state.gradientDepth,y)){let e=(0,p.matMul)(t,n,h,m);return null!=g&&(e=(0,l.add)(e,g)),(0,d.applyActivation)(e,y,v,b)}let x=(0,i.convertToTensor)(t,"a","fused matMul"),w=(0,i.convertToTensor)(n,"b","fused matMul");[x,w]=(0,s.makeTypesMatch)(x,w);const k=h?x.shape[x.rank-2]:x.shape[x.rank-1],_=m?w.shape[w.rank-1]:w.shape[w.rank-2],C=h?x.shape[x.rank-1]:x.shape[x.rank-2],P=m?w.shape[w.rank-2]:w.shape[w.rank-1],O=x.shape.slice(0,-2),N=w.shape.slice(0,-2),I=c.sizeFromShape(O),T=c.sizeFromShape(N);c.assert(k===_,(()=>"Error in fused matMul: inner shapes (".concat(k,") and (")+"".concat(_,") of Tensors with shapes ").concat(x.shape," and ")+"".concat(w.shape," and transposeA=").concat(h)+" and transposeB=".concat(m," must match.")));const S=u.assertAndGetBroadcastShape(x.shape.slice(0,-2),w.shape.slice(0,-2)).concat([C,P]),E=h?(0,f.reshape)(x,[I,k,C]):(0,f.reshape)(x,[I,C,k]),M=m?(0,f.reshape)(w,[T,P,_]):(0,f.reshape)(w,[T,_,P]);let A,D;null!=g&&(A=(0,i.convertToTensor)(g,"bias","fused matMul"),[A]=(0,s.makeTypesMatch)(A,x),u.assertAndGetBroadcastShape(S,A.shape)),null!=v&&(D=(0,i.convertToTensor)(v,"prelu weights","fused matMul"));const R=(e,t)=>{const[n,r,a,o]=t,s=(0,d.getFusedDyActivation)((0,f.reshape)(e,a.shape),a,y);let i,c;if(h||m?!h&&m?(i=(0,p.matMul)(s,r,!1,!1),c=(0,p.matMul)(s,n,!0,!1)):h&&!m?(i=(0,p.matMul)(r,s,!1,!0),c=(0,p.matMul)(n,s,!1,!1)):(i=(0,p.matMul)(r,s,!0,!0),c=(0,p.matMul)(s,n,!0,!0)):(i=(0,p.matMul)(s,r,!1,!0),c=(0,p.matMul)(n,s,!0,!1)),null!=g){return[i,c,(0,d.getFusedBiasGradient)(o,s)]}return[i,c]},F={a:E,b:M,bias:A,preluActivationWeights:D},j={transposeA:h,transposeB:m,activation:y,leakyreluAlpha:b};if(null==g){const e=(0,a.customGrad)(((e,t,n)=>{const a=r.ENGINE.runKernel(o._FusedMatMul,F,j);return n([e,t,a]),{value:(0,f.reshape)(a,S),gradFunc:R}}));return e(E,M)}{const e=(0,a.customGrad)(((e,t,n,a)=>{const s=r.ENGINE.runKernel(o._FusedMatMul,F,j);return a([e,t,s,n]),{value:(0,f.reshape)(s,S),gradFunc:R}}));return e(E,M,A)}}})},449467:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"conv2d",{enumerable:!0,get:function(){return r.conv2d}}),Object.defineProperty(t,"depthwiseConv2d",{enumerable:!0,get:function(){return a.depthwiseConv2d}}),Object.defineProperty(t,"matMul",{enumerable:!0,get:function(){return o.matMul}});var r=n(76387),a=n(222541),o=n(722150)},842772:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.applyActivation=function(e,t,n,r){if("linear"===t)return e;if("relu"===t)return(0,c.relu)(e);if("elu"===t)return(0,a.elu)(e);if("relu6"===t)return(0,l.relu6)(e);if("prelu"===t)return(0,i.prelu)(e,n);if("leakyrelu"===t)return(0,o.leakyRelu)(e,r);if("sigmoid"===t)return(0,d.sigmoid)(e);throw new Error("Unknown fused activation ".concat(t,"."))},t.getFusedBiasGradient=function(e,t){let n=t;const a=r.getReductionAxes(e.shape,t.shape);a.length>0&&(n=(0,h.sum)(n,a));return(0,u.reshape)(n,e.shape)},t.getFusedDyActivation=function(e,t,n){if(null==n||"linear"===n)return e;if("relu"===n)return(0,s.mul)(e,(0,p.step)(t));throw new Error("Cannot compute gradient for fused activation ".concat(n,"."))},t.shouldFuse=void 0;
1var r=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=f(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if("default"!==o&&{}.hasOwnProperty.call(e,o)){var s=a?Object.getOwnPropertyDescriptor(e,o):null;s&&(s.get||s.set)?Object.defineProperty(r,o,s):r[o]=e[o]}return r.default=e,n&&n.set(e,r),r}(n(534779)),a=n(675403),o=n(999017),s=n(295702),i=n(993804),c=n(259849),l=n(783295),u=n(195476),d=n(789520),p=n(622741),h=n(450126);function f(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(f=function(e){return e?n:t})(e)}t.shouldFuse=(e,t)=>!(e>0)||"linear"===t},589205:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.gather=void 0;var r=n(90337),a=n(536217),o=n(188695),s=n(930684);t.gather=(0,s.op)({gather_:function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;const i={x:(0,o.convertToTensor)(e,"x","gather"),indices:(0,o.convertToTensor)(t,"indices","gather","int32")},c={axis:n,batchDims:s};return r.ENGINE.runKernel(a.GatherV2,i,c)}})},840345:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.gatherND=void 0;var r=n(90337),a=n(536217),o=n(188695),s=n(930684);t.gatherND=(0,s.op)({gatherND_:function(e,t){const n=(0,o.convertToTensor)(t,"indices","gatherND","int32"),s={params:(0,o.convertToTensor)(e,"x","gatherND","string_or_numeric"),indices:n};return r.ENGINE.runKernel(a.GatherNd,s)}})},207837:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.prepareAndValidate=function(e,t){const n=e.shape.length,a=t.shape.length;if(n<1)throw new Error("tf.gatherND() expects the input to be rank 1 or higher,"+" but the rank was ".concat(n,"."));if(a<1)throw new Error("tf.gatherND() expects the indices to be rank 1 or higher,"+" but the rank was ".concat(a,"."));if("int32"!==t.dtype)throw new Error("tf.gatherND() expects the indices to be int32 type,"+" but the dtype was ".concat(t.dtype,"."));if(t.shape[a-1]>n)throw new Error("index innermost dimension length must be <= tensor rank; saw: "+"".concat(t.shape[a-1]," vs. ").concat(n));if(0===(0,r.sizeFromShape)(e.shape))throw new Error("Requested more than 0 entries, but input is empty."+" Input shape: ".concat(e.shape,"."));const o=t.shape,s=o[o.length-1];let i=1;for(let e=0;e<o.length-1;++e)i*=o[e];const c=e.shape,l=o.slice();l.pop();let u=1;for(let e=s;e<n;++e)u*=c[e],l.push(c[e]);const d=[...(0,r.computeStrides)(e.shape).map((e=>e/u)),1].slice(0,s);return[l,i,u,d]};var r=n(904737)},755964:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.greater=void 0;var r=n(90337),a=n(536217),o=n(390771),s=n(188695),i=n(534779),c=n(930684);t.greater=(0,c.op)({greater_:function(e,t){let n=(0,s.convertToTensor)(e,"a","greater","string_or_numeric"),c=(0,s.convertToTensor)(t,"b","greater","string_or_numeric");[n,c]=(0,o.makeTypesMatch)(n,c),(0,i.assertAndGetBroadcastShape)(n.shape,c.shape);const l={a:n,b:c};return r.ENGINE.runKernel(a.Greater,l)}})},955497:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.greaterEqual=void 0;var r=n(90337),a=n(536217),o=n(390771),s=n(188695),i=n(534779),c=n(930684);t.greaterEqual=(0,c.op)({greaterEqual_:function(e,t){let n=(0,s.convertToTensor)(e,"a","greaterEqual","string_or_numeric"),c=(0,s.convertToTensor)(t,"b","greaterEqual","string_or_numeric");[n,c]=(0,o.makeTypesMatch)(n,c),(0,i.assertAndGetBroadcastShape)(n.shape,c.shape);const l={a:n,b:c};return r.ENGINE.runKernel(a.GreaterEqual,l)}})},687356:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.imag=void 0;var r=n(90337),a=n(536217),o=n(188695),s=n(930684);t.imag=(0,s.op)({imag_:function(e){const t={input:(0,o.convertToTensor)(e,"input","imag")};return r.ENGINE.runKernel(a.Imag,t)}})},400082:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.cropAndResize=void 0;var r=n(90337),a=n(536217),o=n(188695),s=function(e,t){if(!t&&e&&e.__esMo
1dule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=c(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if("default"!==o&&{}.hasOwnProperty.call(e,o)){var s=a?Object.getOwnPropertyDescriptor(e,o):null;s&&(s.get||s.set)?Object.defineProperty(r,o,s):r[o]=e[o]}return r.default=e,n&&n.set(e,r),r}(n(904737)),i=n(930684);function c(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(c=function(e){return e?n:t})(e)}t.cropAndResize=(0,i.op)({cropAndResize_:function(e,t,n,i){let c=arguments.length>4&&void 0!==arguments[4]?arguments[4]:"bilinear",l=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0;const u=(0,o.convertToTensor)(e,"image","cropAndResize"),d=(0,o.convertToTensor)(t,"boxes","cropAndResize","float32"),p=(0,o.convertToTensor)(n,"boxInd","cropAndResize","int32"),h=d.shape[0];s.assert(4===u.rank,(()=>"Error in cropAndResize: image must be rank 4,"+"but got rank ".concat(u.rank,"."))),s.assert(2===d.rank&&4===d.shape[1],(()=>"Error in cropAndResize: boxes must be have size [".concat(h,",4] ")+"but had shape ".concat(d.shape,"."))),s.assert(1===p.rank&&p.shape[0]===h,(()=>"Error in cropAndResize: boxInd must be have size [".concat(h,"] ")+"but had shape ".concat(d.shape,"."))),s.assert(2===i.length,(()=>"Error in cropAndResize: cropSize must be of length 2, but got "+"length ".concat(i.length,"."))),s.assert(i[0]>=1&&i[1]>=1,(()=>"cropSize must be atleast [1,1], but was ".concat(i))),s.assert("bilinear"===c||"nearest"===c,(()=>"method must be bilinear or nearest, but was ".concat(c)));const f={image:u,boxes:d,boxInd:p},m={method:c,extrapolationValue:l,cropSize:i};return r.ENGINE.runKernel(a.CropAndResize,f,m)}})},981529:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.flipLeftRight=void 0;var r=n(90337),a=n(536217),o=n(188695),s=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=c(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if("default"!==o&&{}.hasOwnProperty.call(e,o)){var s=a?Object.getOwnPropertyDescriptor(e,o):null;s&&(s.get||s.set)?Object.defineProperty(r,o,s):r[o]=e[o]}return r.default=e,n&&n.set(e,r),r}(n(904737)),i=n(930684);function c(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(c=function(e){return e?n:t})(e)}t.flipLeftRight=(0,i.op)({flipLeftRight_:function(e){const t=(0,o.convertToTensor)(e,"image","flipLeftRight","float32");s.assert(4===t.rank,(()=>"Error in flipLeftRight: image must be rank 4,"+"but got rank ".concat(t.rank,".")));const n={image:t};return r.ENGINE.runKernel(a.FlipLeftRight,n,{})}})},268640:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.grayscaleToRGB=void 0;var r=n(188695),a=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=i(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if("default"!==o&&{}.hasOwnProperty.call(e,o)){var s=a?Object.getOwnPropertyDescriptor(e,o):null;s&&(s.get||s.set)?Object.defineProperty(r,o,s):r[o]=e[o]}return r.default=e,n&&n.set(e,r),r}(n(904737)),o=n(930684),s=n(134987);function i(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(i=function(e){return e?n:t})(e)}t.grayscaleToRGB=(0,o.op)({grayscaleToRGB_:function(e){const t=(0,r.convertToTensor)(e,"image","grayscaleToRGB"),n=t.rank-1,o=t.shape[n];a.assert(t.rank>=2,(()=>"Error in grayscaleToRGB: images must be at least rank 2, "+"but got rank ".concat(t.rank,"."))),a.assert(1===o,(()=>"Error in grayscaleToRGB: last dimension of a grayscale image "+"should be size 1, but got size ".concat(o,".")));const i=new Array(t.rank);return i.fill(1,0,n),i[n]=3,(0,s.tile)(t,i)}})},527434:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.nonMaxSuppression=void 0;var r=n(90337),a=n(536217),o=n(188695),s=n(926527),i=n(930684);t.nonMaxSuppression=(0,i.op)({nonMaxSuppression_:function(e,t,n){let i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:.5,c=arguments.length>4&&void 0!==arguments[4]?arguments[4]:Number.NEGATIVE_INFINITY;const l=(0,o.convertToTensor)(e,"boxes","nonMaxSuppression","float32"),u=(0,o.convertToTensor)(t,"scores","nonMaxSuppression","float32"),d=(0,s.nonMaxSuppSanityCheck)(l,u,n,i,c);n=d.maxOutputSize,i=d.iouThreshold,c=d.scoreThreshold;const p={maxOutputSize:n,iouThreshold:i,scoreThreshold:c};return r.ENGINE.runKernel(a.NonMaxSuppressionV3,{boxes:l,scores:u},p)}})},220673:(e,t,n)=>{"use strict";
1Object.defineProperty(t,"__esModule",{value:!0}),t.nonMaxSuppressionAsync=void 0;var r=n(570968),a=n(188695),o=n(926527),s=n(724546);t.nonMaxSuppressionAsync=async function(e,t,n){let i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:.5,c=arguments.length>4&&void 0!==arguments[4]?arguments[4]:Number.NEGATIVE_INFINITY;const l=(0,a.convertToTensor)(e,"boxes","nonMaxSuppressionAsync"),u=(0,a.convertToTensor)(t,"scores","nonMaxSuppressionAsync"),d=(0,o.nonMaxSuppSanityCheck)(l,u,n,i,c);n=d.maxOutputSize,i=d.iouThreshold,c=d.scoreThreshold;const p=await Promise.all([l.data(),u.data()]),h=p[0],f=p[1],{selectedIndices:m}=(0,r.nonMaxSuppressionV3Impl)(h,f,n,i,c);return l!==e&&l.dispose(),u!==t&&u.dispose(),(0,s.tensor1d)(m,"int32")}},201827:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.nonMaxSuppressionPadded=void 0;var r=n(90337),a=n(536217),o=n(188695),s=n(926527),i=n(930684);t.nonMaxSuppressionPadded=(0,i.op)({nonMaxSuppressionPadded_:function(e,t,n){let i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:.5,c=arguments.length>4&&void 0!==arguments[4]?arguments[4]:Number.NEGATIVE_INFINITY,l=arguments.length>5&&void 0!==arguments[5]&&arguments[5];const u=(0,o.convertToTensor)(e,"boxes","nonMaxSuppression"),d=(0,o.convertToTensor)(t,"scores","nonMaxSuppression"),p=(0,s.nonMaxSuppSanityCheck)(u,d,n,i,c,null),h={boxes:u,scores:d},f={maxOutputSize:p.maxOutputSize,iouThreshold:p.iouThreshold,scoreThreshold:p.scoreThreshold,padToMaxOutputSize:l},m=r.ENGINE.runKernel(a.NonMaxSuppressionV4,h,f);return{selectedIndices:m[0],validOutputs:m[1]}}})},512119:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.nonMaxSuppressionPaddedAsync=void 0;var r=n(570968),a=n(188695),o=n(926527),s=n(454179),i=n(724546);t.nonMaxSuppressionPaddedAsync=async function(e,t,n){let c=arguments.length>3&&void 0!==arguments[3]?arguments[3]:.5,l=arguments.length>4&&void 0!==arguments[4]?arguments[4]:Number.NEGATIVE_INFINITY,u=arguments.length>5&&void 0!==arguments[5]&&arguments[5];const d=(0,a.convertToTensor)(e,"boxes","nonMaxSuppressionAsync"),p=(0,a.convertToTensor)(t,"scores","nonMaxSuppressionAsync"),h=(0,o.nonMaxSuppSanityCheck)(d,p,n,c,l,null),f=h.maxOutputSize,m=h.iouThreshold,g=h.scoreThreshold,[y,v]=await Promise.all([d.data(),p.data()]),{selectedIndices:b,validOutputs:x}=(0,r.nonMaxSuppressionV4Impl)(y,v,f,m,g,u);return d!==e&&d.dispose(),p!==t&&p.dispose(),{selectedIndices:(0,i.tensor1d)(b,"int32"),validOutputs:(0,s.scalar)(x,"int32")}}},755969:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.nonMaxSuppressionWithScore=void 0;var r=n(90337),a=n(536217),o=n(188695),s=n(926527),i=n(930684);t.nonMaxSuppressionWithScore=(0,i.op)({nonMaxSuppressionWithScore_:function(e,t,n){let i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:.5,c=arguments.length>4&&void 0!==arguments[4]?arguments[4]:Number.NEGATIVE_INFINITY,l=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0;const u=(0,o.convertToTensor)(e,"boxes","nonMaxSuppression"),d=(0,o.convertToTensor)(t,"scores","nonMaxSuppression"),p=(0,s.nonMaxSuppSanityCheck)(u,d,n,i,c,l);n=p.maxOutputSize,i=p.iouThreshold,c=p.scoreThreshold,l=p.softNmsSigma;const h={boxes:u,scores:d},f={maxOutputSize:n,iouThreshold:i,scoreThreshold:c,softNmsSigma:l},m=r.ENGINE.runKernel(a.NonMaxSuppressionV5,h,f);return{selectedIndices:m[0],selectedScores:m[1]}}})},928284:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.nonMaxSuppressionWithScoreAsync=void 0;var r=n(570968),a=n(188695),o=n(926527),s=n(724546);t.nonMaxSuppressionWithScoreAsync=async function(e,t,n){let i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:.5,c=arguments.length>4&&void 0!==arguments[4]?arguments[4]:Number.NEGATIVE_INFINITY,l=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0;const u=(0,a.convertToTensor)(e,"boxes","nonMaxSuppressionAsync"),d=(0,a.convertToTensor)(t,"scores","nonMaxSuppressionAsync"),p=(0,o.nonMaxSuppSanityCheck)(u,d,n,i,c,l);n=p.maxOutputSize,i=p.iouThreshold,c=p.scoreThreshold,l=p.softNmsSigma;const h=await Promise.all([u.data(),d.data()]),f=h[0],m=h[1],{selectedIndices:g,selectedScores:y}=(0,r.nonMaxSuppressionV5Impl)(f,m,n,i,c,l);return u!==e&&u.dispose(),d!==t&&d.dispose(),{selectedIndices:(0,s.tensor1d)(g,"int32"),selectedScores:(0,s.tensor1d)(y)}}},772967:(e,t,n)=>{"use strict";
1Object.defineProperty(t,"__esModule",{value:!0}),t.resizeBilinear=void 0;var r=n(90337),a=n(536217),o=n(188695),s=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=l(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if("default"!==o&&{}.hasOwnProperty.call(e,o)){var s=a?Object.getOwnPropertyDescriptor(e,o):null;s&&(s.get||s.set)?Object.defineProperty(r,o,s):r[o]=e[o]}return r.default=e,n&&n.set(e,r),r}(n(904737)),i=n(930684),c=n(195476);function l(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(l=function(e){return e?n:t})(e)}t.resizeBilinear=(0,i.op)({resizeBilinear_:function(e,t){let n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],i=arguments.length>3&&void 0!==arguments[3]&&arguments[3];const l=(0,o.convertToTensor)(e,"images","resizeBilinear");s.assert(3===l.rank||4===l.rank,(()=>"Error in resizeBilinear: x must be rank 3 or 4, but got "+"rank ".concat(l.rank,"."))),s.assert(2===t.length,(()=>"Error in resizeBilinear: new shape must 2D, but got shape "+"".concat(t,"."))),s.assert(!1===i||!1===n,(()=>"Error in resizeBilinear: If halfPixelCenters is true, alignCorners must be false."));let u=l,d=!1;3===l.rank&&(d=!0,u=(0,c.reshape)(l,[1,l.shape[0],l.shape[1],l.shape[2]]));const[]=t,p={images:u},h={alignCorners:n,halfPixelCenters:i,size:t},f=r.ENGINE.runKernel(a.ResizeBilinear,p,h);return d?(0,c.reshape)(f,[f.shape[1],f.shape[2],f.shape[3]]):f}})},335974:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.resizeNearestNeighbor=void 0;var r=n(90337),a=n(536217),o=n(188695),s=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=l(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if("default"!==o&&{}.hasOwnProperty.call(e,o)){var s=a?Object.getOwnPropertyDescriptor(e,o):null;s&&(s.get||s.set)?Object.defineProperty(r,o,s):r[o]=e[o]}return r.default=e,n&&n.set(e,r),r}(n(904737)),i=n(930684),c=n(195476);function l(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(l=function(e){return e?n:t})(e)}t.resizeNearestNeighbor=(0,i.op)({resizeNearestNeighbor_:function(e,t){let n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],i=arguments.length>3&&void 0!==arguments[3]&&arguments[3];const l=(0,o.convertToTensor)(e,"images","resizeNearestNeighbor");s.assert(3===l.rank||4===l.rank,(()=>"Error in resizeNearestNeighbor: x must be rank 3 or 4, but got "+"rank ".concat(l.rank,"."))),s.assert(2===t.length,(()=>"Error in resizeNearestNeighbor: new shape must 2D, but got shape "+"".concat(t,"."))),s.assert("float32"===l.dtype||"int32"===l.dtype,(()=>"`images` must have `int32` or `float32` as dtype")),s.assert(!1===i||!1===n,(()=>"Error in resizeNearestNeighbor: If halfPixelCenters is true, alignCorners must be false."));let u=l,d=!1;3===l.rank&&(d=!0,u=(0,c.reshape)(l,[1,l.shape[0],l.shape[1],l.shape[2]]));const[]=t,p={images:u},h={alignCorners:n,halfPixelCenters:i,size:t},f=r.ENGINE.runKernel(a.ResizeNearestNeighbor,p,h);return d?(0,c.reshape)(f,[f.shape[1],f.shape[2],f.shape[3]]):f}})},111671:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.rotateWithOffset=void 0;var r=n(90337),a=n(536217),o=n(188695),s=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=c(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if("default"!==o&&{}.hasOwnProperty.call(e,o)){var s=a?Object.getOwnPropertyDescriptor(e,o):null;s&&(s.get||s.set)?Object.defineProperty(r,o,s):r[o]=e[o]}return r.default=e,n&&n.set(e,r),r}(n(904737)),i=n(930684);function c(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(c=function(e){return e?n:t})(e)}t.rotateWithOffset=(0,i.op)({rotateWithOffset_:function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:.5;const c=(0,o.convertToTensor)(e,"image","rotateWithOffset","float32");s.assert(4===c.rank,(()=>"Error in rotateWithOffset: image must be rank 4,"+"but got rank ".concat(c.rank,".")));const l={image:c},u={radians:t,fillValue:n,center:i};return r.ENGINE.runKernel(a.RotateWithOffset,l,u)}
1})},480272:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.threshold=void 0;var r=n(724546),a=n(930684),o=n(386565),s=n(422194),i=n(27880),c=n(756172),l=n(755964),u=n(450126),d=n(353632),p=n(295702),h=n(67282),f=n(702222),m=n(473947),g=n(376131),y=n(970061),v=n(247565),b=n(796631),x=n(995448),w=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=_(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if("default"!==o&&{}.hasOwnProperty.call(e,o)){var s=a?Object.getOwnPropertyDescriptor(e,o):null;s&&(s.get||s.set)?Object.defineProperty(r,o,s):r[o]=e[o]}return r.default=e,n&&n.set(e,r),r}(n(904737)),k=n(188695);function _(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(_=function(e){return e?n:t})(e)}t.threshold=(0,a.op)({threshold_:function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"binary",n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:.5;const _=(0,k.convertToTensor)(e,"image","threshold"),C=_.shape[0]*_.shape[1];let P,O,N,I,T=(0,p.mul)((0,r.tensor1d)([a]),255);if(w.assert(3===_.rank,(()=>"Error in threshold: image must be rank 3,"+"but got rank ".concat(_.rank,"."))),w.assert(3===_.shape[2]||1===_.shape[2],(()=>"Error in threshold: image color channel must be equal to 3 or 1"+"but got ".concat(_.shape[2],"."))),w.assert("int32"===_.dtype||"float32"===_.dtype,(()=>"Error in dtype: image dtype must be int32 or float32,"+"but got dtype ".concat(_.dtype,"."))),w.assert("otsu"===t||"binary"===t,(()=>"Method must be binary or otsu, but was ".concat(t))),3===_.shape[2]){[P,O,N]=(0,s.split)(_,[1,1,1],-1);const e=(0,p.mul)(P,.2989),t=(0,p.mul)(O,.587),n=(0,p.mul)(N,.114);I=(0,d.add)((0,d.add)(e,t),n)}else I=e;if("otsu"===t){T=function(e,t){let n,a,o,s,i,c,m=(0,r.tensor1d)([-1]),x=(0,r.tensor1d)([0]),w=(0,r.tensor1d)([0]);for(let k=0;k<e.size-1;k++){n=(0,v.slice)(e,0,k+1),a=(0,v.slice)(e,k+1),i=(0,h.div)((0,u.sum)(n),t),c=(0,h.div)((0,u.sum)(a),t);const _=(0,u.sum)((0,p.mul)(n,(0,b.range)(0,n.size)));o=(0,h.div)(_,(0,u.sum)(n));const C=(0,y.fill)(a.shape,n.size),P=(0,d.add)((0,b.range)(0,a.size),C),O=(0,p.mul)(a,P);s=(0,h.div)((0,u.sum)(O),(0,u.sum)(a));const N=(0,f.sub)(o,s),I=(0,f.sub)(o,s),T=(0,p.mul)(i,c);w=(0,p.mul)((0,p.mul)(T,N),I);const S=(0,l.greater)(w,x);x=(0,g.where)(S,w,x),m=(0,g.where)(S,(0,r.tensor1d)([k]),m)}return m}((0,i.bincount)((0,o.cast)((0,m.round)(I),"int32"),(0,x.tensor)([]),256),C)}const S=n?(0,c.lessEqual)(I,T):(0,l.greater)(I,T);return(0,o.cast)((0,p.mul)(S,255),"int32")}})},640240:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.transform=void 0;var r=n(90337),a=n(536217),o=n(188695),s=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=c(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if("default"!==o&&{}.hasOwnProperty.call(e,o)){var s=a?Object.getOwnPropertyDescriptor(e,o):null;s&&(s.get||s.set)?Object.defineProperty(r,o,s):r[o]=e[o]}return r.default=e,n&&n.set(e,r),r}(n(904737)),i=n(930684);function c(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(c=function(e){return e?n:t})(e)}t.transform=(0,i.op)({transform_:function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"nearest",i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"constant",c=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0,l=arguments.length>5?arguments[5]:void 0;const u=(0,o.convertToTensor)(e,"image","transform","float32"),d=(0,o.convertToTensor)(t,"transforms","transform","float32");s.assert(4===u.rank,(()=>"Error in transform: image must be rank 4,"+"but got rank ".concat(u.rank,"."))),s.assert(2===d.rank&&(d.shape[0]===u.shape[0]||1===d.shape[0])&&8===d.shape[1],(()=>"Error in transform: Input transform should be batch x 8 or 1 x 8")),s.assert(null==l||2===l.length,(()=>"Error in transform: outputShape must be [height, width] or null, "+"but got ".concat(l,".")));const p={image:u,transforms:d},h={interpolation:n,fillMode:i,fillValue:c,outputShape:l};return r.ENGINE.runKernel(a.Transform,p,h)}})},716953:(e,t,n)=>{"use strict";
1Object.defineProperty(t,"__esModule",{value:!0}),t.inTopKAsync=void 0;var r=n(188695),a=n(904737),o=n(995448);t.inTopKAsync=async function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;const s=(0,r.convertToTensor)(e,"predictions","inTopK"),i=(0,r.convertToTensor)(t,"targets","inTopK");(0,a.assert)(s.rank>1,(()=>"inTopK() expects the predictions to be of rank 2 or higher, "+"but got ".concat(s.rank))),(0,a.assert)(s.rank-1===i.rank,(()=>"predictions rank should be 1 larger than targets rank, but got predictions rank "+"".concat(s.rank," and targets rank ").concat(i.rank))),(0,a.assertShapesMatch)(s.shape.slice(0,s.shape.length-1),i.shape,"predictions's shape should be align with the targets' shape, except the last dimension.");const c=s.shape[s.shape.length-1];(0,a.assert)(n>0&&n<=c,(()=>"'k' passed to inTopK() must be > 0 && <= the predictions last "+"dimension (".concat(c,"), but got ").concat(n)));const l=await s.data(),u=await i.data(),[d,p]=[l.length/c,c],h=(0,a.getTypedArrayFromDType)("bool",d);for(let e=0;e<d;e++){const t=e*p,r=l.subarray(t,t+p),a=[];for(let e=0;e<r.length;e++)a.push({value:r[e],index:e});a.sort(((e,t)=>t.value-e.value)),h[e]=0;for(let t=0;t<n;t++)if(a[t].index===u[e]){h[e]=1;break}}return e!==s&&s.dispose(),t!==i&&i.dispose(),(0,o.tensor)(h,i.shape,"bool")}},224628:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.isFinite=void 0;var r=n(90337),a=n(536217),o=n(188695),s=n(930684);t.isFinite=(0,s.op)({isFinite_:function(e){const t={x:(0,o.convertToTensor)(e,"x","isFinite")};return r.ENGINE.runKernel(a.IsFinite,t)}})},955578:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.isInf=void 0;var r=n(90337),a=n(536217),o=n(188695),s=n(930684);t.isInf=(0,s.op)({isInf_:function(e){const t={x:(0,o.convertToTensor)(e,"x","isInf")};return r.ENGINE.runKernel(a.IsInf,t)}})},392595:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.isNaN=void 0;var r=n(90337),a=n(536217),o=n(188695),s=n(930684);t.isNaN=(0,s.op)({isNaN_:function(e){const t={x:(0,o.convertToTensor)(e,"x","isNaN")};return r.ENGINE.runKernel(a.IsNan,t)}})},999017:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.leakyRelu=void 0;var r=n(90337),a=n(536217),o=n(188695),s=n(930684);t.leakyRelu=(0,s.op)({leakyRelu_:function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:.2;const n={x:(0,o.convertToTensor)(e,"x","leakyRelu")},s={alpha:t};return r.ENGINE.runKernel(a.LeakyRelu,n,s)}})},881597:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.less=void 0;var r=n(90337),a=n(536217),o=n(390771),s=n(188695),i=n(534779),c=n(930684);t.less=(0,c.op)({less_:function(e,t){let n=(0,s.convertToTensor)(e,"a","less","string_or_numeric"),c=(0,s.convertToTensor)(t,"b","less","string_or_numeric");[n,c]=(0,o.makeTypesMatch)(n,c),(0,i.assertAndGetBroadcastShape)(n.shape,c.shape);const l={a:n,b:c};return r.ENGINE.runKernel(a.Less,l)}})},756172:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.lessEqual=void 0;var r=n(90337),a=n(536217),o=n(390771),s=n(188695),i=n(534779),c=n(930684);t.lessEqual=(0,c.op)({lessEqual_:function(e,t){let n=(0,s.convertToTensor)(e,"a","lessEqual","string_or_numeric"),c=(0,s.convertToTensor)(t,"b","lessEqual","string_or_numeric");[n,c]=(0,o.makeTypesMatch)(n,c),(0,i.assertAndGetBroadcastShape)(n.shape,c.shape);const l={a:n,b:c};return r.ENGINE.runKernel(a.LessEqual,l)}})},287612:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.bandPart=void 0;var r=n(188695),a=n(904737),o=n(955497),s=n(756172),i=n(586386),c=n(930684),l=n(796631),u=n(195476),d=n(454179),p=n(421637),h=n(702222),f=n(922064),m=n(376131),g=n(627896);t.bandPart=(0,c.op)({bandPart_:function(e,t,n){(0,a.assert)(t%1==0,(()=>"bandPart(): numLower must be an integer, got ".concat(t,"."))),(0,a.assert)(n%1==0,(()=>"bandPart(): numUpper must be an integer, got ".concat(n,".")));const c=(0,r.convertToTensor)(e,"a","bandPart");(0,a.assert)(c.rank>=2,(()=>"bandPart(): Rank must be at least 2, got ".concat(c.rank,".")));const y=c.shape,[v,b]=c.shape.slice(-2);if(!(t<=v))throw new Error("bandPart(): numLower (".concat(t,")")+" must not be greater than the number of rows (".concat(v,")."));if(!(n<=b))throw new Error("bandPart(): numUpper (".concat(n,")")+" must not be greater than the number of columns (".concat(b,")."));t<0&&(t=v),n<0&&(n=b);const x=(0,u.reshape)((0,l.range)(0,v,1,"int32"),[-1,1]),w=(0,l.range)(0,b,1,"int32"),k=(0,h.sub)(x,w),_=(0,i.logicalAnd)((0,s.lessEqual)(k,(0,d.scalar)(+t,"int32")),(0,o.greaterEqual)(k,(0,d.scalar)(-n,"int32"))),C=(0,g.zeros)([v,b],c.dtype);return(0,u.reshape)((0,p.stack)((0,f.unstack)((0,u.reshape)(c,[-1,v,b])).map((e=>(0,m.where)(_,e,C)))),y)}})},890290:(e,t,n)=>{"use strict";
1Object.defineProperty(t,"__esModule",{value:!0}),t.gramSchmidt=void 0;var r=n(90337),a=n(904737),o=n(67282),s=n(295702),i=n(633357),c=n(930684),l=n(422194),u=n(714313),d=n(421637),p=n(702222),h=n(450126);t.gramSchmidt=(0,c.op)({gramSchmidt_:function(e){let t;if(Array.isArray(e)){t=!1,(0,a.assert)(null!=e&&e.length>0,(()=>"Gram-Schmidt process: input must not be null, undefined, or empty"));const n=e[0].shape[0];for(let t=1;t<e.length;++t)(0,a.assert)(e[t].shape[0]===n,(()=>"Gram-Schmidt: Non-unique lengths found in the input vectors: "+"(".concat(e[t].shape[0]," vs. ").concat(n,")")))}else t=!0,e=(0,l.split)(e,e.shape[0],0).map((e=>(0,u.squeeze)(e,[0])));(0,a.assert)(e.length<=e[0].shape[0],(()=>"Gram-Schmidt: Number of vectors (".concat(e.length,") exceeds ")+"number of dimensions (".concat(e[0].shape[0],").")));const n=[],c=e;for(let t=0;t<e.length;++t)n.push(r.ENGINE.tidy((()=>{let e=c[t];if(t>0)for(let r=0;r<t;++r){const t=(0,s.mul)((0,h.sum)((0,s.mul)(n[r],e)),n[r]);e=(0,p.sub)(e,t)}return(0,o.div)(e,(0,i.norm)(e,"euclidean"))})));return t?(0,d.stack)(n,0):n}})},706121:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.qr=void 0;var r=n(90337),a=n(271725),o=n(904737),s=n(971976),i=n(55108),c=n(67282),l=n(736974),u=n(755964),d=n(986588),p=n(295702),h=n(193617),f=n(633357),m=n(93
10684),g=n(195476),y=n(247565),v=n(421637),b=n(702222),x=n(716914),w=n(688129),k=n(922064),_=n(376131);function C(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return r.ENGINE.tidy((()=>{(0,o.assert)(2===e.shape.length,(()=>"qr2d() requires a 2D Tensor, but got a ".concat(e.shape.length,"D Tensor.")));const n=e.shape[0],m=e.shape[1];let g=(0,l.eye)(n),v=(0,s.clone)(e);const k=(0,x.tensor2d)([[1]],[1,1]);let C=(0,s.clone)(k);const P=n>=m?m:n;for(let e=0;e<P;++e){const t=v,o=C,l=g;[C,v,g]=r.ENGINE.tidy((()=>{const t=(0,y.slice)(v,[e,e],[n-e,1]),r=(0,f.norm)(t),a=(0,y.slice)(v,[e,e],[1,1]),o=(0,_.where)((0,u.greater)(a,0),(0,x.tensor2d)([[-1]]),(0,x.tensor2d)([[1]])),l=(0,b.sub)(a,(0,p.mul)(o,r)),P=(0,c.div)(t,l);C=1===P.shape[0]?(0,s.clone)(k):(0,i.concat)([k,(0,y.slice)(P,[1,0],[P.shape[0]-1,P.shape[1]])],0);const O=(0,h.neg)((0,c.div)((0,d.matMul)(o,l),r)),N=(0,y.slice)(v,[e,0],[n-e,m]),I=(0,p.mul)(O,C),T=(0,w.transpose)(C);if(0===e)v=(0,b.sub)(N,(0,d.matMul)(I,(0,d.matMul)(T,N)));else{const t=(0,b.sub)(N,(0,d.matMul)(I,(0,d.matMul)(T,N)));v=(0,i.concat)([(0,y.slice)(v,[0,0],[e,m]),t],0)}const S=(0,w.transpose)(I),E=(0,y.slice)(g,[0,e],[n,g.shape[1]-e]);if(0===e)g=(0,b.sub)(E,(0,d.matMul)((0,d.matMul)(E,C),S));else{const t=(0,b.sub)(E,(0,d.matMul)((0,d.matMul)(E,C),S));g=(0,i.concat)([(0,y.slice)(g,[0,0],[n,e]),t],1)}return[C,v,g]})),(0,a.dispose)([t,o,l])}return!t&&n>m&&(g=(0,y.slice)(g,[0,0],[n,m]),v=(0,y.slice)(v,[0,0],[m,m])),[g,v]}))}t.qr=(0,m.op)({qr_:function(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if((0,o.assert)(e.rank>=2,(()=>"qr() requires input tensor to have a rank >= 2, but got rank ".concat(e.rank))),2===e.rank)return C(e,t);{const n=e.shape.slice(0,e.shape.length-2).reduce(((e,t)=>e*t)),r=(0,k.unstack)((0,g.reshape)(e,[n,e.shape[e.shape.length-2],e.shape[e.shape.length-1]]),0),a=[],o=[];r.forEach((e=>{const[n,r]=C(e,t);a.push(n),o.push(r)}));return[(0,g.reshape)((0,v.stack)(a,0),e.shape),(0,g.reshape)((0,v.stack)(o,0),e.shape)]}}})},409898:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.linspace=function(e,t,n){if(n<=0)throw new Error("The number of values should be positive.");const o={start:e,stop:t,num:n};return r.ENGINE.runKernel(a.LinSpace,{},o)};var r=n(90337),a=n(536217)},776576:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.localResponseNormalization=void 0;var r=n(90337),a=n(536217),o=n(188695),s=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=l(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if("default"!==o&&{}.hasOwnProperty.call(e,o)){var s=a?Object.getOwnPropertyDescriptor(e,o):null;s&&(s.get||s.set)?Object.defineProperty(r,o,s):r[o]=e[o]}return r.default=e,n&&n.set(e,r),r}(n(904737)),i=n(930684),c=n(195476);function l(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(l=function(e){return e?n:t})(e)}t.localResponseNormalization=(0,i.op)({localResponseNormalization_:function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:5,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1,l=arguments.length>4&&void 0!==arguments[4]?arguments[4]:.5;const u=(0,o.convertToTensor)(e,"x","localResponseNormalization");s.assert(4===u.rank||3===u.rank,(()=>"Error in localResponseNormalization: x must be rank 3 or 4 but got\n rank ".concat(u.rank,"."))),s.assert(s.isInt(t),(()=>"Error in localResponseNormalization: depthRadius must be an "+"integer but got depthRadius ".concat(t,".")));let d=u,p=!1;3===u.rank&&(p=!0,d=(0,c.reshape)(u,[1,u.shape[0],u.shape[1],u.shape[2]]));const h={x:d},f={depthRadius:t,bias:n,alpha:i,beta:l},m=r.ENGINE.runKernel(a.LRN,h,f);return p?(0,c.reshape)(m,[m.shape[1],m.shape[2],m.shape[3]]):m}})},51682:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.localResponseNormalizationBackprop=void 0;var r=n(90337),a=n(536217),o=n(930684);t.localResponseNormalizationBackprop=(0,o.op)({localResponseNormalizationBackprop_:function(e,t,n){const o={x:e,y:t,dy:n},s={depthRadius:arguments.length>3&&void 0!==arguments[3]?arguments[3]:5,bias:arguments.length>4&&void 0!==arguments[4]?arguments[4]:1,alpha:arguments.length>5&&void 0!==arguments[5]?arguments[5]:1,beta:arguments.length>6&&void 0!==arguments[6]?arguments[6]:.5};return r.ENGINE.runKernel(a.LRNGrad,o,s)}})},164532:(e,t,n)=>{"use strict";
1Object.defineProperty(t,"__esModule",{value:!0}),t.log=void 0;var r=n(90337),a=n(536217),o=n(188695),s=n(930684);t.log=(0,s.op)({log_:function(e){const t={x:(0,o.convertToTensor)(e,"x","log","float32")};return r.ENGINE.runKernel(a.Log,t)}})},260107:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.log1p=void 0;var r=n(90337),a=n(536217),o=n(188695),s=n(930684);t.log1p=(0,s.op)({log1p_:function(e){const t={x:(0,o.convertToTensor)(e,"x","log1p")};return r.ENGINE.runKernel(a.Log1p,t)}})},80046:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.logSigmoid=void 0;var r=n(931564),a=n(188695),o=n(295702),s=n(193617),i=n(930684),c=n(789520),l=n(968924);t.logSigmoid=(0,i.op)({logSigmoid_:function(e){const t=(0,a.convertToTensor)(e,"x","logSigmoid");return(0,r.customGrad)((e=>({value:(0,s.neg)((0,l.softplus)((0,s.neg)(e))),gradFunc:t=>(0,o.mul)(t,(0,c.sigmoid)((0,s.neg)(e)))})))(t)}})},911389:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.logSoftmax=void 0;var r=n(931564),a=n(188695),o=n(386565),s=n(99815),i=n(164532),c=n(882465),l=n(295702),u=n(930684),d=n(702222),p=n(450126);t.logSoftmax=(0,u.op)({logSoftmax_:function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:-1;const n=(0,a.convertToTensor)(e,"logits","logSoftmax");if(-1===t&&(t=n.rank-1),t!==n.rank-1)throw Error("Log Softmax along a non-last dimension is not yet supported. "+"Logits was rank ".concat(n.rank," and axis was ").concat(t));return(0,r.customGrad)(((e,n)=>{const r=(0,c.max)(e,t,!0),a=(0,d.sub)(e,r),u=(0,d.sub)((0,o.cast)(a,"float32"),(0,i.log)((0,p.sum)((0,s.exp)(a),t,!0)));n([u]);return{value:u,gradFunc:(e,n)=>{const[r]=n,a=(0,s.exp)(r);return(0,d.sub)(e,(0,l.mul)((0,p.sum)(e,t,!0),a))}}}))(n)}})},699827:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.logSumExp=void 0;var r=n(188695),a=n(904737),o=n(353632),s=n(247731),i=n(99815),c=n(164532),l=n(882465),u=n(930684),d=n(195476),p=n(702222),h=n(450126);t.logSumExp=(0,u.op)({logSumExp_:function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];const u=(0,r.convertToTensor)(e,"x","logSumExp"),f=(0,a.parseAxisParam)(t,u.shape),m=(0,l.max)(u,f,!0),g=(0,p.sub)(u,m),y=(0,i.exp)(g),v=(0,h.sum)(y,f),b=(0,c.log)(v),x=(0,o.add)((0,d.reshape)(m,b.shape),b);if(n){const e=(0,s.expandShapeToKeepDim)(x.shape,f);return(0,d.reshape)(x,e)}return x}})},586386:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.logicalAnd=void 0;var r=n(90337),a=n(536217),o=n(188695),s=n(534779),i=n(930684);t.logicalAnd=(0,i.op)({logicalAnd_:function(e,t){const n=(0,o.convertToTensor)(e,"a","logicalAnd","bool"),i=(0,o.convertToTensor)(t,"b","logicalAnd","bool");(0,s.assertAndGetBroadcastShape)(n.shape,i.shape);const c={a:n,b:i};return r.ENGINE.runKernel(a.LogicalAnd,c)}})},887101:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.logicalNot=void 0;var r=n(90337),a=n(536217),o=n(188695),s=n(930684);t.logicalNot=(0,s.op)({logicalNot_:function(e){const t={x:(0,o.convertToTensor)(e,"x","logicalNot","bool")};return r.ENGINE.runKernel(a.LogicalNot,t)}})},609677:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.logicalOr=void 0;var r=n(90337),a=n(536217),o=n(188695),s=n(534779),i=n(930684);t.logicalOr=(0,i.op)({logicalOr_:function(e,t){const n=(0,o.convertToTensor)(e,"a","logicalOr","bool"),i=(0,o.convertToTensor)(t,"b","logicalOr","bool");(0,s.assertAndGetBroadcastShape)(n.shape,i.shape);const c={a:n,b:i};return r.ENGINE.runKernel(a.LogicalOr,c)}})},841770:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.logicalXor=void 0;var r=n(188695),a=n(534779),o=n(586386),s=n(887101),i=n(609677),c=n(930684);t.logicalXor=(0,c.op)({logicalXor_:function(e,t){const n=(0,r.convertToTensor)(e,"a","logicalXor","bool"),c=(0,r.convertToTensor)(t,"b","logicalXor","bool");return(0,a.assertAndGetBroadcastShape)(n.shape,c.shape),(0,o.logicalAnd)((0,i.logicalOr)(e,t),(0,s.logicalNot)((0,o.logicalAnd)(e,t)))}})},264907:(e,t)=>{"use strict";var n;
1Object.defineProperty(t,"__esModule",{value:!0}),t.Reduction=void 0,function(e){e[e.NONE=0]="NONE",e[e.MEAN=1]="MEAN",e[e.SUM=2]="SUM",e[e.SUM_BY_NONZERO_WEIGHTS=3]="SUM_BY_NONZERO_WEIGHTS"}(n||(t.Reduction=n={}))},867772:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.absoluteDifference=void 0;var r=n(188695),a=n(904737),o=n(438415),s=n(264907),i=n(930684),c=n(702222),l=n(39860);t.absoluteDifference=(0,i.op)({absoluteDifference_:function(e,t,n){let i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:s.Reduction.SUM_BY_NONZERO_WEIGHTS;const u=(0,r.convertToTensor)(e,"labels","absoluteDifference"),d=(0,r.convertToTensor)(t,"predictions","absoluteDifference");let p=null;null!=n&&(p=(0,r.convertToTensor)(n,"weights","absoluteDifference")),(0,a.assertShapesMatch)(u.shape,d.shape,"Error in absoluteDifference: ");const h=(0,o.abs)((0,c.sub)(u,d));return(0,l.computeWeightedLoss)(h,p,i)}})},39860:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.computeWeightedLoss=void 0;var r=n(188695),a=n(386565),o=n(67282),s=n(264907),i=n(187651),c=n(295702),l=n(737915),u=n(678281),d=n(930684),p=n(454179),h=n(450126);t.computeWeightedLoss=(0,d.op)({computeWeightedLoss_:function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:s.Reduction.SUM_BY_NONZERO_WEIGHTS;const d=(0,r.convertToTensor)(e,"losses","computeWeightedLoss");let f=null;null!=t&&(f=(0,r.convertToTensor)(t,"weights","computeWeightedLoss"));const m=null==f?d:(0,c.mul)(d,f);if(n===s.Reduction.NONE)return m;if(n===s.Reduction.SUM)return(0,h.sum)(m);if(n===s.Reduction.MEAN){if(null==f)return(0,i.mean)(m);{const e=d.size/f.size,t=(0,o.div)((0,h.sum)(m),(0,h.sum)(f));return e>1?(0,o.div)(t,(0,p.scalar)(e)):t}}if(n===s.Reduction.SUM_BY_NONZERO_WEIGHTS){if(null==f)return(0,o.div)((0,h.sum)(m),(0,p.scalar)(d.size));{const e=(0,c.mul)(f,(0,u.ones)(d.shape)),t=(0,a.cast)((0,h.sum)((0,l.notEqual)(e,(0,p.scalar)(0))),"float32");return(0,o.div)((0,h.sum)(m),t)}}throw Error("Unknown reduction: ".concat(n))}})},384970:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.cosineDistance=void 0;var r=n(188695),a=n(904737),o=n(264907),s=n(295702),i=n(930684),c=n(454179),l=n(702222),u=n(450126),d=n(39860);t.cosineDistance=(0,i.op)({cosineDistance_:function(e,t,n,i){let p=arguments.length>4&&void 0!==arguments[4]?arguments[4]:o.Reduction.SUM_BY_NONZERO_WEIGHTS;const h=(0,r.convertToTensor)(e,"labels","cosineDistance"),f=(0,r.convertToTensor)(t,"predictions","cosineDistance");let m=null;null!=i&&(m=(0,r.convertToTensor)(i,"weights","cosineDistance")),(0,a.assertShapesMatch)(h.shape,f.shape,"Error in cosineDistance: ");const g=(0,c.scalar)(1),y=(0,l.sub)(g,(0,u.sum)((0,s.mul)(h,f),n,!0));return(0,d.computeWeightedLoss)(y,m,p)}})},964303:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.hingeLoss=void 0;var r=n(188695),a=n(904737),o=n(264907),s=n(295702),i=n(930684),c=n(259849),l=n(454179),u=n(702222),d=n(39860);t.hingeLoss=(0,i.op)({hingeLoss_:function(e,t,n){let i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:o.Reduction.SUM_BY_NONZERO_WEIGHTS,p=(0,r.convertToTensor)(e,"labels","hingeLoss");const h=(0,r.convertToTensor)(t,"predictions","hingeLoss");let f=null;null!=n&&(f=(0,r.convertToTensor)(n,"weights","hingeLoss")),(0,a.assertShapesMatch)(p.shape,h.shape,"Error in hingeLoss: ");const m=(0,l.scalar)(1);p=(0,u.sub)((0,s.mul)((0,l.scalar)(2),p),m);const g=(0,c.relu)((0,u.sub)(m,(0,s.mul)(p,h)));return(0,d.computeWeightedLoss)(g,f,i)}})},815399:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.huberLoss=void 0;var r=n(188695),a=n(904737),o=n(438415),s=n(353632),i=n(264907),c=n(716940),l=n(295702),u=n(930684),d=n(454179),p=n(985987),h=n(702222),f=n(39860);t.huberLoss=(0,u.op)({huberLoss_:function(e,t,n){let u=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1,m=arguments.length>4&&void 0!==arguments[4]?arguments[4]:i.Reduction.SUM_BY_NONZERO_WEIGHTS;const g=(0,r.convertToTensor)(e,"labels","huberLoss"),y=(0,r.convertToTensor)(t,"predictions","huberLoss");let v=null;null!=n&&(v=(0,r.convertToTensor)(n,"weights","huberLoss")),(0,a.assertShapesMatch)(g.shape,y.shape,"Error in huberLoss: ");const b=(0,d.scalar)(u),x=(0,o.abs)((0,h.sub)(y,g)),w=(0,c.minimum)(x,b),k=(0,h.sub)(x,w),_=(0,s.add)((0,l.mul)((0,d.scalar)(.5),(0,p.square)(w)),(0,l.mul)(b,k));return(0,f.computeWeightedLoss)(_,v,m)}})},485445:(e,t,n)=>{"use strict";
1Object.defineProperty(t,"__esModule",{value:!0}),t.logLoss=void 0;var r=n(188695),a=n(904737),o=n(353632),s=n(164532),i=n(264907),c=n(295702),l=n(193617),u=n(930684),d=n(454179),p=n(702222),h=n(39860);t.logLoss=(0,u.op)({logLoss_:function(e,t,n){let u=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1e-7,f=arguments.length>4&&void 0!==arguments[4]?arguments[4]:i.Reduction.SUM_BY_NONZERO_WEIGHTS;const m=(0,r.convertToTensor)(e,"labels","logLoss"),g=(0,r.convertToTensor)(t,"predictions","logLoss");let y=null;null!=n&&(y=(0,r.convertToTensor)(n,"weights","logLoss")),(0,a.assertShapesMatch)(m.shape,g.shape,"Error in logLoss: ");const v=(0,d.scalar)(1),b=(0,d.scalar)(u),x=(0,l.neg)((0,c.mul)(m,(0,s.log)((0,o.add)(g,b)))),w=(0,c.mul)((0,p.sub)(v,m),(0,s.log)((0,o.add)((0,p.sub)(v,g),b))),k=(0,p.sub)(x,w);return(0,h.computeWeightedLoss)(k,y,f)}})},984076:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.meanSquaredError=void 0;var r=n(188695),a=n(904737),o=n(264907),s=n(930684),i=n(555593),c=n(39860);t.meanSquaredError=(0,s.op)({meanSquaredError_:function(e,t,n){let s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:o.Reduction.SUM_BY_NONZERO_WEIGHTS;const l=(0,r.convertToTensor)(e,"labels","meanSquaredError"),u=(0,r.convertToTensor)(t,"predictions","meanSquaredError");let d=null;null!=n&&(d=(0,r.convertToTensor)(n,"weights","meanSquaredError")),(0,a.assertShapesMatch)(l.shape,u.shape,"Error in meanSquaredError: ");const p=(0,i.squaredDifference)(l,u);return(0,c.computeWeightedLoss)(p,d,s)}})},144973:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.sigmoidCrossEntropy=void 0;var r=n(188695),a=n(904737),o=n(438415),s=n(353632),i=n(99815),c=n(260107),l=n(264907),u=n(295702),d=n(193617),p=n(930684),h=n(259849),f=n(454179),m=n(702222),g=n(39860);t.sigmoidCrossEntropy=(0,p.op)({sigmoidCrossEntropy_:function(e,t,n){let p=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,y=arguments.length>4&&void 0!==arguments[4]?arguments[4]:l.Reduction.SUM_BY_NONZERO_WEIGHTS,v=(0,r.convertToTensor)(e,"multiClassLabels","sigmoidCrossEntropy");const b=(0,r.convertToTensor)(t,"logits","sigmoidCrossEntropy");let x=null;if(null!=n&&(x=(0,r.convertToTensor)(n,"weights","sigmoidCrossEntropy")),(0,a.assertShapesMatch)(v.shape,b.shape,"Error in sigmoidCrossEntropy: "),p>0){const e=(0,f.scalar)(p),t=(0,f.scalar)(1),n=(0,f.scalar)(.5);v=(0,s.add)((0,u.mul)(v,(0,m.sub)(t,e)),(0,u.mul)(n,e))}const w=function(e,t){const n=(0,r.convertToTensor)(e,"labels","sigmoidCrossEntropyWithLogits"),l=(0,r.convertToTensor)(t,"logits","sigmoidCrossEntropyWithLogits");(0,a.assertShapesMatch)(n.shape,l.shape,"Error in sigmoidCrossEntropyWithLogits: ");const p=(0,h.relu)(l),f=(0,u.mul)(l,n),g=(0,c.log1p)((0,i.exp)((0,d.neg)((0,o.abs)(l))));return(0,s.add)((0,m.sub)(p,f),g)}(v,b);return(0,g.computeWeightedLoss)(w,x,y)}})},395359:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.softmaxCrossEntropy=void 0;var r=n(931564),a=n(188695),o=n(904737),s=n(353632),i=n(247731),c=n(386565),l=n(67282),u=n(99815),d=n(699827),p=n(264907),h=n(295702),f=n(193617),m=n(930684),g=n(195476),y=n(454179),v=n(702222),b=n(450126),x=n(39860);t.softmaxCrossEntropy=(0,m.op)({softmaxCrossEntropy_:function(e,t,n){let m=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,w=arguments.length>4&&void 0!==arguments[4]?arguments[4]:p.Reduction.SUM_BY_NONZERO_WEIGHTS,k=(0,a.convertToTensor)(e,"onehotLabels","softmaxCrossEntropy");const _=(0,a.convertToTensor)(t,"logits","softmaxCrossEntropy");let C=null;if(null!=n&&(C=(0,a.convertToTensor)(n,"weights","softmaxCrossEntropy")),(0,o.assertShapesMatch)(k.shape,_.shape,"Error in softmaxCrossEntropy: "),m>0){const e=(0,y.scalar)(m),t=(0,y.scalar)(1),n=(0,y.scalar)(k.shape[1]);k=(0,s.add)((0,h.mul)(k,(0,v.sub)(t,e)),(0,l.div)(e,n))}const P=function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:-1;if(-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 ".concat(t.rank," ")+"and dim was ".concat(n));const a=(0,r.customGrad)(((e,t,r)=>{const a=(0,d.logSumExp)(t,[n],!0),o=(0,v.sub)((0,c.cast)(t,"float32"),a);r([e,o]);const s=(0,f.neg)((0,h.mul)(o,e));return{value:(0,b.sum)(s,[n]),gradFunc:(e,t)=>{const[r,a]=t,o=(0,i.expandShapeToKeepDim)(e.shape,[n]);return[(0,h.mul)((0,g.reshape)(e,o),(0,v.sub)((0,c.cast)(r,"float32"),(0,u.exp)(a))),(0,h.mul)((0,g.reshape)(e,o),(0,v.sub)((0,u.exp)(a),(0,c.c
1ast)(r,"float32")))]}}}));return a(e,t)}(k,_);return(0,x.computeWeightedLoss)(P,C,w)}})},986588:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.matMul=void 0;var r=n(90337),a=n(536217),o=n(390771),s=n(188695),i=n(930684);t.matMul=(0,i.op)({matMul_:function(e,t){let n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],i=arguments.length>3&&void 0!==arguments[3]&&arguments[3],c=(0,s.convertToTensor)(e,"a","matMul"),l=(0,s.convertToTensor)(t,"b","matMul");[c,l]=(0,o.makeTypesMatch)(c,l);const u={a:c,b:l},d={transposeA:n,transposeB:i};return r.ENGINE.runKernel(a.BatchMatMul,u,d)}})},882465:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.max=void 0;var r=n(90337),a=n(536217),o=n(188695),s=n(930684);t.max=(0,s.op)({max_:function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];const s={x:(0,o.convertToTensor)(e,"x","max")},i={reductionIndices:t,keepDims:n};return r.ENGINE.runKernel(a.Max,s,i)}})},31112:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.maxPool=void 0;var r=n(90337),a=n(536217),o=n(188695),s=d(n(904737)),i=d(n(812682)),c=n(930684),l=n(195476);function u(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(u=function(e){return e?n:t})(e)}function d(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=u(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if("default"!==o&&{}.hasOwnProperty.call(e,o)){var s=a?Object.getOwnPropertyDescriptor(e,o):null;s&&(s.get||s.set)?Object.defineProperty(r,o,s):r[o]=e[o]}return r.default=e,n&&n.set(e,r),r}t.maxPool=(0,c.op)({maxPool_:function(e,t,n,c,u){const d=(0,o.convertToTensor)(e,"x","maxPool");let p=d,h=!1;3===d.rank&&(h=!0,p=(0,l.reshape)(d,[1,d.shape[0],d.shape[1],d.shape[2]])),s.assert(4===p.rank,(()=>"Error in maxPool: input must be rank 4 but got rank ".concat(p.rank,"."))),s.assert(i.eitherStridesOrDilationsAreOne(n,1),(()=>"Error in maxPool: Either strides or dilations must be 1. "+"Got strides ".concat(n," and dilations '").concat(1,"'"))),i.checkPadOnDimRoundingMode("maxPool",c,u);const f={x:p},m={filterSize:t,strides:n,pad:c,dimRoundingMode:u},g=r.ENGINE.runKernel(a.MaxPool,f,m);return h?(0,l.reshape)(g,[g.shape[1],g.shape[2],g.shape[3]]):g}})},789389:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.maxPool3d=void 0;var r=n(90337),a=n(536217),o=n(188695),s=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=u(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if("default"!==o&&{}.hasOwnProperty.call(e,o)){var s=a?Object.getOwnPropertyDescriptor(e,o):null;s&&(s.get||s.set)?Object.defineProperty(r,o,s):r[o]=e[o]}return r.default=e,n&&n.set(e,r),r}(n(904737)),i=n(812682),c=n(930684),l=n(195476);function u(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(u=function(e){return e?n:t})(e)}t.maxPool3d=(0,c.op)({maxPool3d_:function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[1,1,1],n=arguments.length>2?arguments[2]:void 0,c=arguments.length>3?arguments[3]:void 0,u=arguments.length>4?arguments[4]:void 0,d=arguments.length>5&&void 0!==arguments[5]?arguments[5]:"NDHWC";const p=(0,o.convertToTensor)(e,"x","maxPool3d");let h=p,f=!1;4===p.rank&&(f=!0,h=(0,l.reshape)(p,[1,p.shape[0],p.shape[1],p.shape[2],p.shape[3]])),s.assert(5===h.rank,(()=>"Error in maxPool3d: x must be rank 5 but got rank ".concat(h.rank,"."))),s.assert("NDHWC"===d,(()=>"Error in maxPool3d: Only NDHWC is currently supported, "+"but got dataFormat of ".concat(d))),(0,i.checkPadOnDimRoundingMode)("maxPool3d",c,u);const m={x:h},g={filterSize:t,strides:n,pad:c,dimRoundingMode:u,dataFormat:d},y=r.ENGINE.runKernel(a.MaxPool3D,m,g);return f?(0,l.reshape)(y,[y.shape[1],y.shape[2],y.shape[3],y.shape[4]]):y}})},69975:(e,t,n)=>{"use strict";
1Object.defineProperty(t,"__esModule",{value:!0}),t.maxPool3dGrad=void 0;var r=n(90337),a=n(536217),o=n(188695),s=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=u(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if("default"!==o&&{}.hasOwnProperty.call(e,o)){var s=a?Object.getOwnPropertyDescriptor(e,o):null;s&&(s.get||s.set)?Object.defineProperty(r,o,s):r[o]=e[o]}return r.default=e,n&&n.set(e,r),r}(n(904737)),i=n(812682),c=n(930684),l=n(195476);function u(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(u=function(e){return e?n:t})(e)}t.maxPool3dGrad=(0,c.op)({maxPool3dGrad_:function(e,t,n,c,u,d,p){const h=(0,o.convertToTensor)(e,"dy","maxPool3dGrad"),f=(0,o.convertToTensor)(t,"input","maxPool3dGrad"),m=(0,o.convertToTensor)(n,"output","maxPool3dGrad");let g=h,y=f,v=m,b=!1;4===f.rank&&(b=!0,g=(0,l.reshape)(h,[1,h.shape[0],h.shape[1],h.shape[2],h.shape[3]]),y=(0,l.reshape)(f,[1,f.shape[0],f.shape[1],f.shape[2],f.shape[3]]),v=(0,l.reshape)(m,[1,m.shape[0],m.shape[1],m.shape[2],m.shape[3]])),s.assert(5===g.rank,(()=>"Error in maxPool3dGrad: dy must be rank 5 but got rank "+"".concat(g.rank,"."))),s.assert(5===y.rank,(()=>"Error in maxPool3dGrad: input must be rank 5 but got rank "+"".concat(y.rank,"."))),s.assert(5===v.rank,(()=>"Error in maxPool3dGrad: output must be rank 5 but got rank "+"".concat(v.rank,"."))),(0,i.checkPadOnDimRoundingMode)("maxPool3dGrad",d,p);const x={dy:g,input:y,output:v},w={filterSize:c,strides:u,pad:d,dimRoundingMode:p},k=r.ENGINE.runKernel(a.MaxPool3DGrad,x,w);return b?(0,l.reshape)(k,[k.shape[1],k.shape[2],k.shape[3],k.shape[4]]):k}})},400404:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.maxPoolGrad=void 0;var r=n(90337),a=n(536217),o=n(188695),s=u(n(904737)),i=u(n(812682)),c=n(930684);function l(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(l=function(e){return e?n:t})(e)}function u(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=l(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if("default"!==o&&{}.hasOwnProperty.call(e,o)){var s=a?Object.getOwnPropertyDescriptor(e,o):null;s&&(s.get||s.set)?Object.defineProperty(r,o,s):r[o]=e[o]}return r.default=e,n&&n.set(e,r),r}t.maxPoolGrad=(0,c.op)({maxPoolGrad_:function(e,t,n,c,l,u,d){const p=(0,o.convertToTensor)(e,"dy","maxPoolGrad"),h=(0,o.convertToTensor)(t,"input","maxPoolGrad"),f=(0,o.convertToTensor)(n,"output","maxPoolGrad");s.assert(h.rank===p.rank,(()=>"Rank of input (".concat(h.rank,") does not match rank of dy ")+"(".concat(p.rank,")"))),s.assert(4===p.rank,(()=>"Error in maxPoolGrad: dy must be rank 4 but got rank "+"".concat(p.rank,"."))),s.assert(4===h.rank,(()=>"Error in maxPoolGrad: input must be rank 4 but got rank "+"".concat(h.rank,"."))),i.checkPadOnDimRoundingMode("maxPoolGrad",u,d);const m={dy:p,input:h,output:f},g={filterSize:c,strides:l,pad:u,dimRoundingMode:d};return r.ENGINE.runKernel(a.MaxPoolGrad,m,g)}})},961160:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.maxPoolWithArgmax=void 0;var r=n(90337),a=n(536217),o=n(188695),s=n(930684);t.maxPoolWithArgmax=(0,s.op)({maxPoolWithArgmax_:function(e,t,n,s){let i=arguments.length>4&&void 0!==arguments[4]&&arguments[4];const c={x:(0,o.convertToTensor)(e,"x","maxPoolWithArgmax")},l={filterSize:t,strides:n,pad:s,includeBatchInIndex:i},u=r.ENGINE.runKernel(a.MaxPoolWithArgmax,c,l);return{result:u[0],indexes:u[1]}}})},720036:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.maximum=void 0;var r=n(90337),a=n(536217),o=n(390771),s=n(188695),i=n(534779),c=n(386565),l=n(930684);t.maximum=(0,l.op)({maximum_:function(e,t){let n=(0,s.convertToTensor)(e,"a","maximum"),l=(0,s.convertToTensor)(t,"b","maximum");[n,l]=(0,o.makeTypesMatch)(n,l),"bool"===n.dtype&&(n=(0,c.cast)(n,"int32"),l=(0,c.cast)(l,"int32")),(0,i.assertAndGetBroadcastShape)(n.shape,l.shape);const u={a:n,b:l};return r.ENGINE.runKernel(a.Maximum,u)}})},187651:(e,t,n)=>{"use strict";
1Object.defineProperty(t,"__esModule",{value:!0}),t.mean=void 0;var r=n(90337),a=n(536217),o=n(188695),s=n(930684);t.mean=(0,s.op)({mean_:function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];const s={x:(0,o.convertToTensor)(e,"x","mean")},i={axis:t,keepDims:n};return r.ENGINE.runKernel(a.Mean,s,i)}})},249838:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.meshgrid=function(e,t){let{indexing:n="xy"}=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if("xy"!==n&&"ij"!==n)throw new TypeError("".concat(n," is not a valid third argument to meshgrid"));if(void 0===e)return[];let l=(0,i.convertToTensor)(e,"x","meshgrid",e instanceof s.Tensor?e.dtype:"float32");if(void 0===t)return[l];let u=(0,i.convertToTensor)(t,"y","meshgrid",t instanceof s.Tensor?t.dtype:"float32");const d=(0,c.sizeFromShape)(l.shape),p=(0,c.sizeFromShape)(u.shape);if("xy"===n)return l=(0,o.reshape)(l,[1,-1]),u=(0,o.reshape)(u,[-1,1]),[(0,r.matMul)((0,a.ones)([p,1],l.dtype),l),(0,r.matMul)(u,(0,a.ones)([1,d],u.dtype))];return l=(0,o.reshape)(l,[-1,1]),u=(0,o.reshape)(u,[1,-1]),[(0,r.matMul)(l,(0,a.ones)([1,p],l.dtype)),(0,r.matMul)((0,a.ones)([d,1],u.dtype),u)]};var r=n(986588),a=n(678281),o=n(195476),s=n(659795),i=n(188695),c=n(542393)},914828:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.min=void 0;var r=n(90337),a=n(536217),o=n(188695),s=n(930684);t.min=(0,s.op)({min_:function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];const s={x:(0,o.convertToTensor)(e,"x","min")},i={axis:t,keepDims:n};return r.ENGINE.runKernel(a.Min,s,i)}})},716940:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.minimum=void 0;var r=n(90337),a=n(536217),o=n(390771),s=n(188695),i=n(534779),c=n(386565),l=n(930684);t.minimum=(0,l.op)({minimum_:function(e,t){let n=(0,s.convertToTensor)(e,"a","minimum"),l=(0,s.convertToTensor)(t,"b","minimum");[n,l]=(0,o.makeTypesMatch)(n,l),"bool"===n.dtype&&(n=(0,c.cast)(n,"int32"),l=(0,c.cast)(l,"int32")),(0,i.assertAndGetBroadcastShape)(n.shape,l.shape);const u={a:n,b:l};return r.ENGINE.runKernel(a.Minimum,u)}})},208026:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.mirrorPad=void 0;var r=n(90337),a=n(536217),o=n(188695),s=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=c(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if("default"!==o&&{}.hasOwnProperty.call(e,o)){var s=a?Object.getOwnPropertyDescriptor(e,o):null;s&&(s.get||s.set)?Object.defineProperty(r,o,s):r[o]=e[o]}return r.default=e,n&&n.set(e,r),r}(n(904737)),i=n(930684);function c(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(c=function(e){return e?n:t})(e)}t.mirrorPad=(0,i.op)({mirrorPad_:function(e,t,n){s.assert("reflect"===n||"symmetric"===n,(()=>"Invalid mode. Mode must be either reflect or symmetric. "+"Got ".concat(n,".")));const i=(0,o.convertToTensor)(e,"x","mirrorPad");if(0===i.rank)throw new Error("mirrorPad(scalar) is not defined. Pass non-scalar to mirrorPad");s.assert(t.length===i.rank,(()=>"Padding doesn't match input. Must be ".concat(i.rank,". ")+"Got ".concat(t.length,".")));const c="reflect"===n?1:0;for(let e=0;e<i.rank;e++)s.assert(2===t[e].length,(()=>"Invalid number of paddings. Must be length of 2 each.")),s.assert(t[e][0]>=0&&t[e][0]<=i.shape[e]-c&&t[e][1]>=0&&t[e][1]<=i.shape[e]-c,(()=>"Padding in dimension ".concat(e," cannot be greater than or equal ")+"to ".concat(i.shape[e]-c," or less than 0 for input of ")+"shape ".concat(i.shape)));const l={paddings:t,mode:n},u={x:i};return r.ENGINE.runKernel(a.MirrorPad,u,l)}})},820891:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.mod=void 0;var r=n(90337),a=n(536217),o=n(390771),s=n(188695),i=n(930684);t.mod=(0,i.op)({mod_:function(e,t){let n=(0,s.convertToTensor)(e,"a","mod"),i=(0,s.convertToTensor)(t,"b","mod");[n,i]=(0,o.makeTypesMatch)(n,i);const c={a:n,b:i};return r.ENGINE.runKernel(a.Mod,c)}})}
1,344833:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.moments=void 0;var r=n(188695),a=n(904737),o=n(247731),s=n(386565),i=n(187651),c=n(930684),l=n(195476),u=n(985987),d=n(702222);t.moments=(0,c.op)({moments_:function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];e=(0,r.convertToTensor)(e,"x","moments");const c=(0,a.parseAxisParam)(t,e.shape),p=(0,i.mean)(e,c,n);let h=p.shape;n||(h=(0,o.expandShapeToKeepDim)(p.shape,c));const f=(0,u.square)((0,d.sub)((0,s.cast)(e,"float32"),(0,l.reshape)(p,h)));return{mean:p,variance:(0,i.mean)(f,c,n)}}})},715212:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.movingAverage=void 0;var r=n(390771),a=n(188695),o=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=h(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if("default"!==o&&{}.hasOwnProperty.call(e,o)){var s=a?Object.getOwnPropertyDescriptor(e,o):null;s&&(s.get||s.set)?Object.defineProperty(r,o,s):r[o]=e[o]}return r.default=e,n&&n.set(e,r),r}(n(904737)),s=n(353632),i=n(67282),c=n(295702),l=n(930684),u=n(216556),d=n(454179),p=n(702222);function h(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(h=function(e){return e?n:t})(e)}t.movingAverage=(0,l.op)({movingAverage_:function(e,t,n,l){let h=!(arguments.length>4&&void 0!==arguments[4])||arguments[4];const f=(0,a.convertToTensor)(e,"v","movingAverage"),m=(0,a.convertToTensor)(t,"x","movingAverage"),g=(0,a.convertToTensor)(n,"decay","movingAverage");(0,r.assertTypesMatch)(f,m),o.assert(o.arraysEqual(f.shape,m.shape),(()=>"Shape mismatch in v and x"));const y=(0,d.scalar)(1),v=(0,p.sub)(y,g);let b=(0,c.mul)((0,p.sub)(m,f),v);if(h){o.assert(null!=l,(()=>"When using zeroDebias: true, step is required."));const e=(0,a.convertToTensor)(l,"step","movingAverage");b=(0,i.div)(b,(0,p.sub)(y,(0,u.pow)(g,e)))}return(0,s.add)(f,b)}})},295702:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.mul=void 0;var r=n(90337),a=n(536217),o=n(390771),s=n(188695),i=n(930684);t.mul=(0,i.op)({mul_:function(e,t){let n=(0,s.convertToTensor)(e,"a","mul"),i=(0,s.convertToTensor)(t,"b","mul");[n,i]=(0,o.makeTypesMatch)(n,i);const c={a:n,b:i};return r.ENGINE.runKernel(a.Multiply,c)}})},590283:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.multiRNNCell=void 0;var r=n(188695),a=n(930684);t.multiRNNCell=(0,a.op)({multiRNNCell_:function(e,t,n,a){const o=(0,r.convertToTensor)(t,"data","multiRNNCell"),s=(0,r.convertToTensorArray)(n,"c","multiRNNCell"),i=(0,r.convertToTensorArray)(a,"h","multiRNNCell");let c=o;const l=[];for(let t=0;t<e.length;t++){const n=e[t](c,s[t],i[t]);l.push(n[0]),l.push(n[1]),c=n[1]}const u=[],d=[];for(let e=0;e<l.length;e+=2)u.push(l[e]),d.push(l[e+1]);return[u,d]}})},725915:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.multinomial=void 0;var r=n(90337),a=n(536217),o=n(188695),s=n(930684),i=n(195476);t.multinomial=(0,s.op)({multinomial_:function(e,t,n){let s=arguments.length>3&&void 0!==arguments[3]&&arguments[3];const c=(0,o.convertToTensor)(e,"logits","multinomial"),l=c.size,u=c.rank;if(l<2)throw new Error("Error in multinomial: you need at least 2 outcomes, but got "+"".concat(l,"."));if(u>2)throw new Error("Rank of probabilities must be 1 or 2, but is ".concat(u));n=n||Math.random();const d={logits:1===u?(0,i.reshape)(c,[1,-1]):c},p={numSamples:t,seed:n,normalized:s},h=r.ENGINE.runKernel(a.Multinomial,d,p);return 1===u?(0,i.reshape)(h,[h.size]):h}})},193617:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.neg=void 0;var r=n(90337),a=n(536217),o=n(188695),s=n(930684);t.neg=(0,s.op)({neg_:function(e){const t={x:(0,o.convertToTensor)(e,"x","neg")};return r.ENGINE.runKernel(a.Neg,t)}})},926527:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.nonMaxSuppSanityCheck=function(e,t,n,a,o,s){null==a&&(a=.5);null==o&&(o=Number.NEGATIVE_INFINITY);null==s&&(s=0);const i=e.shape[0];return n=Math.min(n,i),r.assert(0<=a&&a<=1,(()=>"iouThreshold must be in [0, 1], but was '".concat(a,"'"))),r.assert(2===e.rank,(()=>"boxes must be a 2D tensor, but was of rank '".concat(e.rank,"'"))),r.assert(4===e.shape[1],(()=>"boxes must have 4 columns, but 2nd dimension was ".concat(e.shape[1]))),r.assert(1===t.rank,(()=>"scores must be a 1D tensor")),r.assert(t.shape[0]===i,(()=>"scores has incompatible shape with boxes. Expected ".concat(i,", ")+"but was ".concat(t.shape[0]))),r.assert(0<=s&&s<=1,(()=>"softNmsSigma must be in [0, 1], but was '".concat(s,"'"))),{maxOutputSize:n,iouThreshold:a,scoreThreshold:o,softNmsSigma:s}};
1var r=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=a(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var s in e)if("default"!==s&&{}.hasOwnProperty.call(e,s)){var i=o?Object.getOwnPropertyDescriptor(e,s):null;i&&(i.get||i.set)?Object.defineProperty(r,s,i):r[s]=e[s]}return r.default=e,n&&n.set(e,r),r}(n(904737));function a(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(a=function(e){return e?n:t})(e)}},633357:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.norm=void 0;var r=n(188695),a=n(904737),o=n(438415),s=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=g(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if("default"!==o&&{}.hasOwnProperty.call(e,o)){var s=a?Object.getOwnPropertyDescriptor(e,o):null;s&&(s.get||s.set)?Object.defineProperty(r,o,s):r[o]=e[o]}return r.default=e,n&&n.set(e,r),r}(n(247731)),i=n(882465),c=n(914828),l=n(930684),u=n(216556),d=n(195476),p=n(454179),h=n(435438),f=n(985987),m=n(450126);function g(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(g=function(e){return e?n:t})(e)}function y(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;if(0===e.rank)return(0,o.abs)(e);if(1!==e.rank&&null===n)return y((0,d.reshape)(e,[-1]),t,n);if(1===e.rank||"number"==typeof n||Array.isArray(n)&&1===n.length){if(1===t)return(0,m.sum)((0,o.abs)(e),n);if(t===1/0)return(0,i.max)((0,o.abs)(e),n);if(t===-1/0)return(0,c.min)((0,o.abs)(e),n);if("euclidean"===t||2===t)return(0,h.sqrt)((0,m.sum)((0,u.pow)((0,o.abs)(e),(0,p.scalar)(2,"int32")),n));throw new Error("Error in norm: invalid ord value: ".concat(t))}if(Array.isArray(n)&&2===n.length){if(1===t)return(0,i.max)((0,m.sum)((0,o.abs)(e),n[0]),n[1]-1);if(t===1/0)return(0,i.max)((0,m.sum)((0,o.abs)(e),n[1]),n[0]);if(t===-1/0)return(0,c.min)((0,m.sum)((0,o.abs)(e),n[1]),n[0]);if("fro"===t||"euclidean"===t)return(0,h.sqrt)((0,m.sum)((0,f.square)(e),n));throw new Error("Error in norm: invalid ord value: ".concat(t))}throw new Error("Error in norm: invalid axis: ".concat(n))}t.norm=(0,l.op)({norm_:function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"euclidean",n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,o=arguments.length>3&&void 0!==arguments[3]&&arguments[3];const i=y(e=(0,r.convertToTensor)(e,"x","norm"),t,n);let c=i.shape;if(o){const t=(0,a.parseAxisParam)(n,e.shape);c=s.expandShapeToKeepDim(i.shape,t)}return(0,d.reshape)(i,c)}})},737915:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.notEqual=void 0;var r=n(90337),a=n(536217),o=n(390771),s=n(188695),i=n(534779),c=n(930684);t.notEqual=(0,c.op)({notEqual_:function(e,t){let n=(0,s.convertToTensor)(e,"a","notEqual","string_or_numeric"),c=(0,s.convertToTensor)(t,"b","notEqual","string_or_numeric");[n,c]=(0,o.makeTypesMatch)(n,c),(0,i.assertAndGetBroadcastShape)(n.shape,c.shape);const l={a:n,b:c};return r.ENGINE.runKernel(a.NotEqual,l)}})},597664:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.oneHot=void 0;var r=n(90337),a=n(536217),o=n(188695),s=n(930684);t.oneHot=(0,s.op)({oneHot_:function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;
1if(t<2)throw new Error("Error in oneHot: depth must be >=2, but it is ".concat(t));const i={indices:(0,o.convertToTensor)(e,"indices","oneHot","int32")},c={depth:t,onValue:n,offValue:s};return r.ENGINE.runKernel(a.OneHot,i,c)}})},678281:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ones=function e(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"float32";if("complex64"===n){const n=e(t,"float32"),r=(0,s.zeros)(t,"float32");return(0,o.complex)(n,r)}const i=(0,a.makeOnesTypedArray)((0,a.sizeFromShape)(t),n);return r.ENGINE.makeTensor(i,t,n)};var r=n(90337),a=n(904737),o=n(291158),s=n(627896)},896723:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.onesLike=void 0;var r=n(90337),a=n(536217),o=n(188695),s=n(930684);t.onesLike=(0,s.op)({onesLike_:function(e){const t={x:(0,o.convertToTensor)(e,"x","onesLike")};return r.ENGINE.runKernel(a.OnesLike,t)}})},930684:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.OP_SCOPE_SUFFIX=void 0,t.op=function(e){const 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 "+"".concat(t.length," keys."));let n=t[0];const s=e[n];n.endsWith("_")&&(n=n.substring(0,n.length-1));n+=o;const i=function(){r.ENGINE.startScope(n);try{const e=s(...arguments);return(0,a.isPromise)(e)&&console.error("Cannot return a Promise inside of tidy."),r.ENGINE.endScope(e),e}catch(e){throw r.ENGINE.endScope(null),e}};return Object.defineProperty(i,"name",{value:n,configurable:!0}),i};var r=n(90337),a=n(904737);const o=t.OP_SCOPE_SUFFIX="__op"},899090:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r={image:!0,linalg:!0,losses:!0,spectral:!0,signal:!0,sparse:!0,string:!0,abs:!0,acos:!0,acosh:!0,add:!0,addN:!0,all:!0,any:!0,argMax:!0,argMin:!0,asin:!0,asinh:!0,atan:!0,atan2:!0,atanh:!0,avgPool:!0,avgPool3d:!0,basicLSTMCell:!0,batchToSpaceND:!0,batchNorm:!0,batchNorm2d:!0,batchNorm3d:!0,batchNorm4d:!0,bincount:!0,broadcastArgs:!0,broadcastTo:!0,buffer:!0,cast:!0,ceil:!0,clipByValue:!0,clone:!0,complex:!0,concat:!0,concat1d:!0,concat2d:!0,concat3d:!0,concat4d:!0,conv1d:!0,conv2d:!0,conv2dTranspose:!0,conv3d:!0,conv3dTranspose:!0,cos:!0,cosh:!0,cumsum:!0,denseBincount:!0,depthToSpace:!0,depthwiseConv2d:!0,diag:!0,dilation2d:!0,div:!0,divNoNan:!0,dot:!0,einsum:!0,elu:!0,equal:!0,erf:!0,exp:!0,expandDims:!0,expm1:!0,eye:!0,fill:!0,floor:!0,floorDiv:!0,gather:!0,greater:!0,greaterEqual:!0,imag:!0,isFinite:!0,isInf:!0,isNaN:!0,leakyRelu:!0,less:!0,lessEqual:!0,linspace:!0,localResponseNormalization:!0,log:!0,log1p:!0,logSigmoid:!0,logSoftmax:!0,logSumExp:!0,logicalAnd:!0,logicalNot:!0,logicalOr:!0,logicalXor:!0,matMul:!0,max:!0,maxPool:!0,maxPool3d:!0,maxPoolWithArgmax:!0,maximum:!0,mean:!0,meshgrid:!0,min:!0,minimum:!0,mirrorPad:!0,mod:!0,moments:!0,mul:!0,multiRNNCell:!0,multinomial:!0,neg:!0,notEqual:!0,oneHot:!0,ones:!0,onesLike:!0,outerProduct:!0,pad:!0,pad1d:!0,pad2d:!0,pad3d:!0,pad4d:!0,pool:!0,pow:!0,prelu:!0,print:!0,prod:!0,rand:!0,randomGamma:!0,randomNormal:!0,randomUniform:!0,range:!0,real:!0,reciprocal:!0,relu:!0,relu6:!0,reshape:!0,reverse:!0,reverse1d:!0,reverse2d:!0,reverse3d:!0,reverse4d:!0,round:!0,rsqrt:!0,scalar:!0,selu:!0,separableConv2d:!0,setdiff1dAsync:!0,sigmoid:!0,sign:!0,sin:!0,sinh:!0,slice:!0,slice1d:!0,slice2d:!0,slice3d:!0,slice4d:!0,softmax:!0,softplus:!0,spaceToBatchND:!0,fft:!0,ifft:!0,irfft:!0,rfft:!0,split:!0,sqrt:!0,square:!0,squaredDifference:!0,squeeze:!0,stack:!0,step:!0,stridedSlice:!0,sub:!0,sum:!0,tan:!0,tanh:!0,tensor:!0,tensor1d:!0,tensor2d:!0,tensor3d:!0,tensor4d:!0,tensor5d:!0,tensor6d:!0,tile:!0,topk:!0,truncatedNormal:!0,unique:!0,unsortedSegmentSum:!0,unstack:!0,variable:!0,where:!0,whereAsync:!0,zeros:!0,zerosLike:!0,op:!0,OP_SCOPE_SUFFIX:!0,fused:!0};Object.defineProperty(t,"OP_SCOPE_SUFFIX",{enumerable:!0,get:function(){return Fn.OP_SCOPE_SUFFIX}}),Object.defineProperty(t,"abs",{enumerable:!0,get:function(){return a.abs}}),Object.defineProperty(t,"acos",{enumerable:!0,get:function(){return o.acos}}),Object.defineProperty(t,"acosh",{enumerable:!0,get:function(){return s.acosh}}),Object.defineProperty(t,"add",{enumerable:!0,get:function(){return i.add}}),Object.defineProperty(t,"addN",{enumerable:!0,get:function(){return c.addN}}),Object.defineProperty(t,"all",{enumerable:!0,get:function(){return l.all}}),Object.defineProperty(t,"any",{enumerable:!0,get:function(){return u.any}}),Object.defineProperty(t,"argMax",{enumerable:!0,get:function(){return d.argMax}}),Object.defineProperty(t,"argMin",{enumerable:!0,get:function(){return p.argMin}}),Object.defineProperty(t,"asin",{enumerable:!0,get:function(){return h.asin}}),Object.defineProperty(t,"asinh",{enumerable:!0,get:function(){return f.asinh}}),Object.defineProperty(t,"atan",{enumerable:!0,get:function(){return m.atan}}),Object.defineProperty(t,"atan2",{enumerable:!0,get:function(){return g.atan2}}),Object.defineProperty(t,"atanh",{enumerable:!0,get:function(){return y.atanh}}),Object.defineProperty(t,"avgPool",{enumerable:!0,get:function(){return v.avgPool}}),Object.defineProperty(t,"avgPool3d",{enumerable:!0,get:function(){return b.avgPool3d}}),Object.defineProperty(t,"basicLSTMCell",{enumerable:!0,get:function(){return x.basicLSTMCell}}),Object.defineProperty(t,"batchNorm",{enumerable:!0,get:function(){return k.batchNorm}}),Object.defineProperty(t,"batchNorm2d",{enumerable:!0,get:function(){return _.batchNorm2d}}),Object.defineProperty(t,"batchNorm3d",{enumerable:!0,get:function(){return C.batchNorm3d}}),Object.defineProperty(t,"batchNorm4d",{enumerable:!0,get:function(){return P.batchNorm4d}}),Object.defineProperty(t,"batchToSpaceND",{enumerable:!0,get:function(){return w.batchToSpaceND}}),Object.defineProperty(t,"bincount",{enumerable:!0,get:function(){return O.bincount}}),Object.defineProperty(t,"broadcastArgs",{enumerable:!0,get:function(){return N.broadcastArgs}}),Object.defineProperty(t,"broadcastTo",{enumerable:!0,get:function(){return I.broadcastTo}}),Object.defineProperty(t,"buffer",{enumerable:!0,get:function(){return T.buffer}}),Object.defineProperty(t,"cast",{enumerable:!0,get:function(){return S.cast}}),Object.defineProperty(t,"ceil",{enumerable:!0,get:function(){return E.ceil}}),Object.defineProperty(t,"clipByValue",{enumerable:!0,get:function(){return M.clipByValue}}),Object.defineProperty(t,"clone",{enumerable:!0,get:function(){return A.clone}}),Object.defineProperty(t,"complex",{enumerable:!0,get:function(){return D.complex}}),Object.defineProperty(t,"concat",{enumerable:!0,get:function(){return R.concat}}),Object.defineProperty(t,"concat1d",{enumerable:!0,get:function(){return F.concat1d}}),Object.defineProperty(t,"concat2d",{enumerable:!0,get:function(){return j.concat2d}}),Object.defineProperty(t,"concat3d",{enumerable:!0,get:function(){return z.concat3d}}),Object.defineProperty(t,"concat4d",{enumerable:!0,get:function(){return L.concat4d}}),Object.defineProperty(t,"conv1d",{enumerable:!0,get:function(){return V.conv1d}}),Object.defineProperty(t,"conv2d",{enumerable:!0,get:function(){return G.conv2d}}),Object.defineProperty(t,"conv2dTranspose",{enumerable:!0,get:function(){return B.conv2dTranspose}}),Object.defineProperty(t,"conv3d",{enumerable:!0,get:function(){return W.conv3d}}),Object.defineProperty(t,"conv3dTranspose",{enumerable:!0,get:function(){return U.conv3dTranspose}}),Object.defineProperty(t,"cos",{enumerable:!0,get:function(){return q.cos}}),Object.defineProperty(t,"cosh",{enumerable:!0,get:function(){return H.cosh}}),Object.defineProperty(t,"cumsum",{enumerable:!0,get:function(){return K.cumsum}}),Object.defineProperty(t,"denseBincount",{enumerable:!0,get:function(){return X.denseBincount}}),Object.defineProperty(t,"depthToSpace",{enumerable:!0,get:function(){return Y.depthToSpace}}),Object.defineProperty(t,"depthwiseConv2d",{enumerable:!0,get:function(){return Z.depthwiseConv2d}}),Object.defineProperty(t,"diag",{enumerable:!0,get:function(){return J.diag}}),Object.defineProperty(t,"dilation2d",{enumerable:!0,get:function(){return Q.dilation2d}}),Object.defineProperty(t,"div",{enumerable:!0,get:function(){return $.div}}),Object.defineProperty(t,"divNoNan",{enumerable:!0,get:function(){return ee.divNoNan}}),Object.defineProperty(t,"dot",{enumerable:!0,get:function(){return te.dot}}),Object.defineProperty(t,"einsum",{enumerable:!0,get:function(){return ne.einsum}}),Object.defineProperty(t,"elu",{enumerable:!0,get:function(){return re.elu}}),Object.defineProperty(t,"equal",{enumerable:!0,get:function(){return ae.equal}}),Object.defineProperty(t,"erf",{enumerable:!0,get:function(){return oe.erf}}),Object.defineProperty(t,"exp",{enumerable:!0,get:function(){return se.exp}}),Object.defineProperty(t,"expandDims",{enumerable:!0,get:function(){return ie.expandDims}}),Object.defineProperty(t,"expm1",{enumerable:!0,get:function(){return ce.expm1}}),Object.defineProperty(t,"eye",{enumerable:!0,get:function(){return le.eye}}),Object.defineProperty(t,"fft",{enumerable:!0,get:function(){return qt.fft}}),Object.defineProperty(t,"fill",{enumerable:!0,get:function(){return ue.fill}}),Object.defineProperty(t,"floor",{enumerable:!0,get:function(){return de.floor}}),Object.defineProperty(t,"floorDiv",{enumerable:!0,get:function(){return pe.floorDiv}}),t.fused=void 0,Object.defineProperty(t,"gather",{enumerable:!0,get:function(){return he.gather}}
1),Object.defineProperty(t,"greater",{enumerable:!0,get:function(){return fe.greater}}),Object.defineProperty(t,"greaterEqual",{enumerable:!0,get:function(){return me.greaterEqual}}),Object.defineProperty(t,"ifft",{enumerable:!0,get:function(){return Ht.ifft}}),Object.defineProperty(t,"imag",{enumerable:!0,get:function(){return ge.imag}}),t.image=void 0,Object.defineProperty(t,"irfft",{enumerable:!0,get:function(){return Kt.irfft}}),Object.defineProperty(t,"isFinite",{enumerable:!0,get:function(){return ye.isFinite}}),Object.defineProperty(t,"isInf",{enumerable:!0,get:function(){return ve.isInf}}),Object.defineProperty(t,"isNaN",{enumerable:!0,get:function(){return be.isNaN}}),Object.defineProperty(t,"leakyRelu",{enumerable:!0,get:function(){return xe.leakyRelu}}),Object.defineProperty(t,"less",{enumerable:!0,get:function(){return we.less}}),Object.defineProperty(t,"lessEqual",{enumerable:!0,get:function(){return ke.lessEqual}}),t.linalg=void 0,Object.defineProperty(t,"linspace",{enumerable:!0,get:function(){return _e.linspace}}),Object.defineProperty(t,"localResponseNormalization",{enumerable:!0,get:function(){return Ce.localResponseNormalization}}),Object.defineProperty(t,"log",{enumerable:!0,get:function(){return Pe.log}}),Object.defineProperty(t,"log1p",{enumerable:!0,get:function(){return Oe.log1p}}),Object.defineProperty(t,"logSigmoid",{enumerable:!0,get:function(){return Ne.logSigmoid}}),Object.defineProperty(t,"logSoftmax",{enumerable:!0,get:function(){return Ie.logSoftmax}}),Object.defineProperty(t,"logSumExp",{enumerable:!0,get:function(){return Te.logSumExp}}),Object.defineProperty(t,"logicalAnd",{enumerable:!0,get:function(){return Se.logicalAnd}}),Object.defineProperty(t,"logicalNot",{enumerable:!0,get:function(){return Ee.logicalNot}}),Object.defineProperty(t,"logicalOr",{enumerable:!0,get:function(){return Me.logicalOr}}),Object.defineProperty(t,"logicalXor",{enumerable:!0,get:function(){return Ae.logicalXor}}),t.losses=void 0,Object.defineProperty(t,"matMul",{enumerable:!0,get:function(){return De.matMul}}),Object.defineProperty(t,"max",{enumerable:!0,get:function(){return Re.max}}),Object.defineProperty(t,"maxPool",{enumerable:!0,get:function(){return Fe.maxPool}}),Object.defineProperty(t,"maxPool3d",{enumerable:!0,get:function(){return je.maxPool3d}}),Object.defineProperty(t,"maxPoolWithArgmax",{enumerable:!0,get:function(){return ze.maxPoolWithArgmax}}),Object.defineProperty(t,"maximum",{enumerable:!0,get:function(){return Le.maximum}}),Object.defineProperty(t,"mean",{enumerable:!0,get:function(){return Ve.mean}}),Object.defineProperty(t,"meshgrid",{enumerable:!0,get:function(){return Ge.meshgrid}}),Object.defineProperty(t,"min",{enumerable:!0,get:function(){return Be.min}}),Object.defineProperty(t,"minimum",{enumerable:!0,get:function(){return We.minimum}}),Object.defineProperty(t,"mirrorPad",{enumerable:!0,get:function(){return Ue.mirrorPad}}),Object.defineProperty(t,"mod",{enumerable:!0,get:function(){return qe.mod}}),Object.defineProperty(t,"moments",{enumerable:!0,get:function(){return He.moments}}),Object.defineProperty(t,"mul",{enumerable:!0,get:function(){return Ke.mul}}),Object.defineProperty(t,"multiRNNCell",{enumerable:!0,get:function(){return Xe.multiRNNCell}}),Object.defineProperty(t,"multinomial",{enumerable:!0,get:function(){return Ye.multinomial}}),Object.defineProperty(t,"neg",{enumerable:!0,get:function(){return Ze.neg}}),Object.defineProperty(t,"notEqual",{enumerable:!0,get:function(){return Je.notEqual}}),Object.defineProperty(t,"oneHot",{enumerable:!0,get:function(){return Qe.oneHot}}),Object.defineProperty(t,"ones",{enumerable:!0,get:function(){return $e.ones}}),Object.defineProperty(t,"onesLike",{enumerable:!0,get:function(){return et.onesLike}}),Object.defineProperty(t,"op",{enumerable:!0,get:function(){return Fn.op}}),Object.defineProperty(t,"outerProduct",{enumerable:!0,get:function(){return tt.outerProduct}}),Object.defineProperty(t,"pad",{enumerable:!0,get:function(){return nt.pad}}),Object.defineProperty(t,"pad1d",{enumerable:!0,get:function(){return rt.pad1d}}),Object.defineProperty(t,"pad2d",{enumerable:!0,get:function(){return at.pad2d}}),Object.defineProperty(t,"pad3d",{enumerable:!0,get:function(){return ot.pad3d}}),Object.defineProperty(t,"pad4d",{enumerable:!0,get:function(){return st.pad4d}}),Object.defineProperty(t,"pool",{enumerable:!0,get:function(){return it.pool}}),Object.defineProperty(t,"pow",{enumerable:!0,get:function(){return ct.pow}}),Object.defineProperty(t,"prelu",{enumerable:!0,get:function(){return lt.prelu}}),Object.defineProperty(t,"print",{enumerable:!0,get:function(){return ut.print}}),Object.defineProperty(t,"prod",{enumerable:!0,get:function(){return dt.prod}}),Object.defineProperty(t,"rand",{enumerable:!0,get:function(){return pt.rand}}),Object.defineProperty(t,"randomGamma",{enumerable:!0,get:function(){return ht.randomGamma}}),Object.defineProperty(t,"randomNormal",{enumerable:!0,get:function(){return ft.randomNormal}}),Object.defineProperty(t,"randomUniform",{enumerable:!0,get:function(){return mt.randomUniform}}),Object.defineProperty(t,"range",{enumerable:!0,get:function(){return gt.range}}),Object.defineProperty(t,"real",{enumerable:!0,get:function(){return yt.real}}),Object.defineProperty(t,"reciprocal",{enumerable:!0,get:function(){return vt.reciprocal}}),Object.defineProperty(t,"relu",{enumerable:!0,get:function(){return bt.relu}}),Object.defineProperty(t,"relu6",{enumerable:!0,get:function(){return xt.relu6}}),Object.defineProperty(t,"reshape",{enumerable:!0,get:function(){return wt.reshape}}),Object.defineProperty(t,"reverse",{enumerable:!0,get:function(){return kt.reverse}}),Object.defineProperty(t,"reverse1d",{enumerable:!0,get:function(){return _t.reverse1d}}),Object.defineProperty(t,"reverse2d",{enumerable:!0,get:function(){return Ct.reverse2d}}),Object.defineProperty(t,"reverse3d",{enumerable:!0,get:function(){return Pt.reverse3d}}),Object.defineProperty(t,"reverse4d",{enumerable:!0,get:function(){return Ot.reverse4d}}),Object.defineProperty(t,"rfft",{enumerable:!0,get:function(){return Xt.rfft}}),Object.defineProperty(t,"round",{enumerable:!0,get:function(){return Nt.round}}),Object.defineProperty(t,"rsqrt",{enumerable:!0,get:function(){return It.rsqrt}}),Object.defineProperty(t,"scalar",{enumerable:!0,get:function(){return Tt.scalar}}),Object.defineProperty(t,"selu",{enumerable:!0,get:function(){return St.selu}}),Object.defineProperty(t,"separableConv2d",{enumerable:!0,get:function(){return Et.separableConv2d}}),Object.defineProperty(t,"setdiff1dAsync",{enumerable:!0,get:function(){return Mt.setdiff1dAsync}}),Object.defineProperty(t,"sigmoid",{enumerable:!0,get:function(){return At.sigmoid}}),Object.defineProperty(t,"sign",{enumerable:!0,get:function(){return Dt.sign}}),t.signal=void 0,Object.defineProperty(t,"sin",{enumerable:!0,get:function(){return Rt.sin}}),Object.defineProperty(t,"sinh",{enumerable:!0,get:function(){return Ft.sinh}}),Object.defineProperty(t,"slice",{enumerable:!0,get:function(){return jt.slice}}),Object.defineProperty(t,"slice1d",{enumerable:!0,get:function(){return zt.slice1d}}),Object.defineProperty(t,"slice2d",{enumerable:!0,get:function(){return Lt.slice2d}}),Object.defineProperty(t,"slice3d",{enumerable:!0,get:function(){return Vt.slice3d}}),Object.defineProperty(t,"slice4d",{enumerable:!0,get:function(){return Gt.slice4d}}),Object.defineProperty(t,"softmax",{enumerable:!0,get:function(){return Bt.softmax}}),Object.defineProperty(t,"softplus",{enumerable:!0,get:function(){return Wt.softplus}}),Object.defineProperty(t,"spaceToBatchND",{enumerable:!0,get:function(){return Ut.spaceToBatchND}}),t.spectral=t.sparse=void 0,Object.defineProperty(t,"split",{enumerable:!0,get:function(){return Yt.split}}),Object.defineProperty(t,"sqrt",{enumerable:!0,get:function(){return Zt.sqrt}}),Object.defineProperty(t,"square",{enumerable:!0,get:function(){return Jt.square}}),Object.defineProperty(t,"squaredDifference",{enumerable:!0,get:function(){return Qt.squaredDifference}}),Object.defineProperty(t,"squeeze",{enumerable:!0,get:function(){return $t.squeeze}}),Object.defineProperty(t,"stack",{enumerable:!0,get:function(){return en.stack}}),Object.defineProperty(t,"step",{enumerable:!0,get:function(){return tn.step}}),Object.defineProperty(t,"stridedSlice",{enumerable:!0,get:function(){return nn.stridedSlice}}),t.string=void 0,Object.defineProperty(t,"sub",{enumerable:!0,get:function(){return rn.sub}}),Object.defineProperty(t,"sum",{enumerable:!0,get:function(){return an.sum}}),Object.defineProperty(t,"tan",{enumerable:!0,get:function(){return on.tan}}),Object.defineProperty(t,"tanh",{enumerable:!0,get:function(){return sn.tanh}}),Object.defineProperty(t,"tensor",{enumerable:!0,get:function(){return cn.tensor}}),Object.defineProperty(t,"tensor1d",{enumerable:!0,get:function(){return ln.tensor1d}}),Object.defineProperty(t,"tensor2d",{enumerable:!0,get:function(){return un.tensor2d}}),Object.defineProperty(t,"tensor3d",{enumerable:!0,get:function(){return dn.tensor3d}}),Object.defineProperty(t,"tensor4d",{enumerable:!0,get:function(){return pn.tensor4d}}),Object.defineProperty(t,"tensor5d",{enumerable:!0,get:function(){return hn.tensor5d}}),Object.defineProperty(t,"tensor6d",{enumerable:!0,get:function(){return fn.tensor6d}}),Object.defineProperty(t,"tile",{enumerable:!0,get:function(){return mn.tile}}),Object.defineProperty(t,"topk",{enumerable:!0,get:function(){return gn.topk}}),Object.defineProperty(t,"truncatedNormal",{enumerable:!0,get:function(){return yn.truncatedNormal}}),Object.defineProperty(t,"unique",{enumerable:!0,get:function(){return vn.unique}}),Object.defineProperty(t,"unsortedSegmentSum",{enumerable:!0,get:function(){return bn.unsortedSegmentSum}}),Object.defineProperty(t,"unstack",{enumerable:!0,get:function(){return xn.unstack}}),Object.defineProperty(t,"variable",{enumerable:!0,get:function(){return wn.variable}}),Object.defineProperty(t,"where",{enumerable:!0,get:function(){return kn.where}}),Object.defineProperty(t,"whereAsync",{enumerable:!0,get:function(){return _n.whereAsync}}),Object.defineProperty(t,"zeros",{enumerable:!0,get:function(){return Cn.zeros}}),Object.defineProperty(t,"zerosLike",{enumerable:!0,get:function(){return Pn.zerosLike}});var a=n(438415),o=n(799405),s=n(282356),i=n(353632),c=n(635205),l=n(143805),u=n(695913),d=n(508147),p=n(448740),h=n(220159),f=n(148753),m=n(9727),g=n(395307),y=n(820035),v=n(926677),b=n(878001),x=n(920676),w=n(47326),k=n(739914),_=n(437256),C=n(676842),P=n(255014),O=n(27880),N=n(239938),I=n(465581),T=n(60249),S=n(386565),E=n(71306),M=n(635967),A=n(971976),D=n(291158),R=n(55108),F=n(924428),j=n(708183),z=n(787928),L=n(351781),V=n(394576),G=n(797476),B=n(492617),W=n(26728),U=n(276048),q=n(317321),H=n(66008),K=n(110727),X=n(248410),Y=n(646051),Z=n(599081),J=n(232491),Q=n(77495),$=n(67282),ee=n(998342),te=n(379895),ne=n(649439),re=n(675403),ae=n(674655),oe=n(933414),se=n(99815),ie=n(621724),ce=n(564386),le=n(736974),ue=n(970061),de=n(450879),pe=n(25485),he=n(589205),fe=n(755964),me=n(955497),ge=n(687356),ye=n(224628),ve=n(955578),be=n(392595),xe=n(999017),we=n(881597),ke=n(756172),_e=n(409898),Ce=n(776576),Pe=n(164532),Oe=n(260107),Ne=n(80046),Ie=n(911389),Te=n(699827),Se=n(586386),Ee=n(887101),Me=n(609677),Ae=n(841770),De=n(986588),Re=n(882465),Fe=n(31112),je=n(789389),ze=n(961160),Le=n(720036),Ve=n(187651),Ge=n(249838),Be=n(914828),We=n(716940),Ue=n(208026),qe=n(820891),He=n(344833),Ke=n(295702),Xe=n(590283),Ye=n(725915),Ze=n(193617),Je=n(737915),Qe=n(597664),$e=n(678281),et=n(896723),tt=n(935519),nt=n(813636),rt=n(431259),at=n(759704),ot=n(511737),st=n(879721),it=n(864210),ct=n(216556),lt=n(993804),ut=n(275438),dt=n(278026),pt=n(431650),ht=n(439741),ft=n(516588),mt=n(324852),gt=n(796631),yt=n(562651),vt=n(191833),bt=n(259849),xt=n(783295),wt=n(195476),kt=n(790767),_t=n(816889),Ct=n(170280),Pt=n(710853),Ot=n(495181),Nt=n(473947),It=n(652590),Tt=n(454179),St=n(731754),Et=n(843757),Mt=n(34875),At=n(789520),Dt=n(244993),Rt=n(762006),Ft=n(249118),jt=n(247565),zt=n(716682),Lt=n(46228),Vt=n(550219),Gt=n(422120),Bt=n(697775),Wt=n(968924),Ut=n(244851),qt=n(427645),Ht=n(286674),Kt=n(966381),Xt=n(269663),Yt=n(422194),Zt=n(435438),Jt=n(985987),Qt=n(555593),$t=n(714313),en=n(421637),tn=n(622741),nn=n(548749),rn=n(702222),an=n(450126),on=n(452157),sn=n(200178),cn=n(995448),ln=n(724546),un=n(716914),dn=n(459447),pn=n(132639),hn=n(679316),fn=n(295546),mn=n(134987),gn=n(833426),yn=n(992684),vn=n(657797),bn=n(421418),xn=n(922064),wn=n(259976),kn=n(376131),_n=n(16814),Cn=n(627896),Pn=n(166119),On=n(663947);
1Object.keys(On).forEach((function(e){"default"!==e&&"__esModule"!==e&&(Object.prototype.hasOwnProperty.call(r,e)||e in t&&t[e]===On[e]||Object.defineProperty(t,e,{enumerable:!0,get:function(){return On[e]}}))}));var Nn=n(688129);Object.keys(Nn).forEach((function(e){"default"!==e&&"__esModule"!==e&&(Object.prototype.hasOwnProperty.call(r,e)||e in t&&t[e]===Nn[e]||Object.defineProperty(t,e,{enumerable:!0,get:function(){return Nn[e]}}))}));var In=n(633357);Object.keys(In).forEach((function(e){"default"!==e&&"__esModule"!==e&&(Object.prototype.hasOwnProperty.call(r,e)||e in t&&t[e]===In[e]||Object.defineProperty(t,e,{enumerable:!0,get:function(){return In[e]}}))}));var Tn=n(715212);Object.keys(Tn).forEach((function(e){"default"!==e&&"__esModule"!==e&&(Object.prototype.hasOwnProperty.call(r,e)||e in t&&t[e]===Tn[e]||Object.defineProperty(t,e,{enumerable:!0,get:function(){return Tn[e]}}))}));var Sn=n(982282);Object.keys(Sn).forEach((function(e){"default"!==e&&"__esModule"!==e&&(Object.prototype.hasOwnProperty.call(r,e)||e in t&&t[e]===Sn[e]||Object.defineProperty(t,e,{enumerable:!0,get:function(){return Sn[e]}}))}));var En=n(270332);Object.keys(En).forEach((function(e){"default"!==e&&"__esModule"!==e&&(Object.prototype.hasOwnProperty.call(r,e)||e in t&&t[e]===En[e]||Object.defineProperty(t,e,{enumerable:!0,get:function(){return En[e]}}))}));var Mn=n(840345);Object.keys(Mn).forEach((function(e){"default"!==e&&"__esModule"!==e&&(Object.prototype.hasOwnProperty.call(r,e)||e in t&&t[e]===Mn[e]||Object.defineProperty(t,e,{enumerable:!0,get:function(){return Mn[e]}}))}));var An=n(179433);Object.keys(An).forEach((function(e){"default"!==e&&"__esModule"!==e&&(Object.prototype.hasOwnProperty.call(r,e)||e in t&&t[e]===An[e]||Object.defineProperty(t,e,{enumerable:!0,get:function(){return An[e]}}))}));var Dn=n(80870);Object.keys(Dn).forEach((function(e){"default"!==e&&"__esModule"!==e&&(Object.prototype.hasOwnProperty.call(r,e)||e in t&&t[e]===Dn[e]||Object.defineProperty(t,e,{enumerable:!0,get:function(){return Dn[e]}}))}));var Rn=n(716953);Object.keys(Rn).forEach((function(e){"default"!==e&&"__esModule"!==e&&(Object.prototype.hasOwnProperty.call(r,e)||e in t&&t[e]===Rn[e]||Object.defineProperty(t,e,{enumerable:!0,get:function(){return Rn[e]}}))}));var Fn=n(930684),jn=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=wr(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if("default"!==o&&{}.hasOwnProperty.call(e,o)){var s=a?Object.getOwnPropertyDescriptor(e,o):null;s&&(s.get||s.set)?Object.defineProperty(r,o,s):r[o]=e[o]}return r.default=e,n&&n.set(e,r),r}(n(449467));t.fused=jn;var zn=n(557989),Ln=n(993557),Vn=n(56323),Gn=n(829028),Bn=n(400082),Wn=n(981529),Un=n(268640),qn=n(111671),Hn=n(527434),Kn=n(220673),Xn=n(755969),Yn=n(928284),Zn=n(201827),Jn=n(512119),Qn=n(772967),$n=n(335974),er=n(480272),tr=n(640240),nr=n(287612),rr=n(890290),ar=n(706121),or=n(867772),sr=n(39860),ir=n(384970),cr=n(964303),lr=n(815399),ur=n(485445),dr=n(984076),pr=n(144973),hr=n(395359),fr=n(383366),mr=n(84025),gr=n(494788),yr=n(979439),vr=n(527032),br=n(493794),xr=n(279490);function wr(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(wr=function(e){return e?n:t})(e)}t.spectral={fft:qt.fft,ifft:Ht.ifft,rfft:Xt.rfft,irfft:Kt.irfft},t.signal={hammingWindow:zn.hammingWindow,hannWindow:Ln.hannWindow,frame:Vn.frame,stft:Gn.stft},t.image={flipLeftRight:Wn.flipLeftRight,grayscaleToRGB:Un.grayscaleToRGB,resizeNearestNeighbor:$n.resizeNearestNeighbor,resizeBilinear:Qn.resizeBilinear,rotateWithOffset:qn.rotateWithOffset,cropAndResize:Bn.cropAndResize,nonMaxSuppression:Hn.nonMaxSuppression,nonMaxSuppressionAsync:Kn.nonMaxSuppressionAsync,nonMaxSuppressionWithScore:Xn.nonMaxSuppressionWithScore,nonMaxSuppressionWithScoreAsync:Yn.nonMaxSuppressionWithScoreAsync,nonMaxSuppressionPadded:Zn.nonMaxSuppressionPadded,nonMaxSuppressionPaddedAsync:Jn.nonMaxSuppressionPaddedAsync,threshold:er.threshold,transform:tr.transform},t.linalg={bandPart:nr.bandPart,gramSchmidt:rr.gramSchmidt,qr:ar.qr},t.losses={absoluteDifference:or.absoluteDifference,computeWeightedLoss:sr.computeWeightedLoss,cosineDistance:ir.cosineDistance,hingeLoss:cr.hingeLoss,huberLoss:lr.huberLoss,logLoss:ur.logLoss,meanSquaredError:dr.meanSquaredError,sigmoidCrossEntropy:pr.sigmoidCrossEntropy,softmaxCrossEntropy:hr.softmaxCrossEntropy},t.sparse={sparseFillEmptyRows:fr.sparseFillEmptyRows,sparseReshape:mr.sparseReshape,sparseSegmentMean:gr.sparseSegmentMean,sparseSegmentSum:yr.sparseSegmentSum},t.string={stringNGrams:vr.stringNGrams,stringSplit:br.stringSplit,stringToHashBucketFast:xr.stringToHashBucketFast}},763213:(e,t,n)=>{"use strict";
1Object.defineProperty(t,"__esModule",{value:!0});var r=n(899090);Object.keys(r).forEach((function(e){"default"!==e&&"__esModule"!==e&&(e in t&&t[e]===r[e]||Object.defineProperty(t,e,{enumerable:!0,get:function(){return r[e]}}))}))},935519:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.outerProduct=void 0;var r=n(188695),a=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=c(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if("default"!==o&&{}.hasOwnProperty.call(e,o)){var s=a?Object.getOwnPropertyDescriptor(e,o):null;s&&(s.get||s.set)?Object.defineProperty(r,o,s):r[o]=e[o]}return r.default=e,n&&n.set(e,r),r}(n(904737)),o=n(986588),s=n(930684),i=n(195476);function c(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(c=function(e){return e?n:t})(e)}t.outerProduct=(0,s.op)({outerProduct_:function(e,t){const n=(0,r.convertToTensor)(e,"v1","outerProduct"),s=(0,r.convertToTensor)(t,"v2","outerProduct");a.assert(1===n.rank&&1===s.rank,(()=>"Error in outerProduct: inputs must be rank 1, but got ranks "+"".concat(n.rank," and ").concat(s.rank,".")));const c=(0,i.reshape)(n,[-1,1]),l=(0,i.reshape)(s,[1,-1]);return(0,o.matMul)(c,l)}})},813636:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.pad=void 0;var r=n(90337),a=n(536217),o=n(188695),s=n(930684);t.pad=(0,s.op)({pad_:function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;const s=(0,o.convertToTensor)(e,"x","pad");if(0===s.rank)throw new Error("pad(scalar) is not defined. Pass non-scalar to pad");const i={paddings:t,constantValue:n},c={x:s};return r.ENGINE.runKernel(a.PadV2,c,i)}})},431259:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.pad1d=void 0;var r=n(904737),a=n(930684),o=n(813636);t.pad1d=(0,a.op)({pad1d_:function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return(0,r.assert)(2===t.length,(()=>"Invalid number of paddings. Must be length of 2.")),(0,o.pad)(e,[t],n)}})}
1,759704:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.pad2d=void 0;var r=n(904737),a=n(930684),o=n(813636);t.pad2d=(0,a.op)({pad2d_:function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return(0,r.assert)(2===t.length&&2===t[0].length&&2===t[1].length,(()=>"Invalid number of paddings. Must be length of 2 each.")),(0,o.pad)(e,t,n)}})},511737:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.pad3d=void 0;var r=n(904737),a=n(930684),o=n(813636);t.pad3d=(0,a.op)({pad3d_:function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return(0,r.assert)(3===t.length&&2===t[0].length&&2===t[1].length&&2===t[2].length,(()=>"Invalid number of paddings. Must be length of 2 each.")),(0,o.pad)(e,t,n)}})},879721:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.pad4d=void 0;var r=n(904737),a=n(930684),o=n(813636);t.pad4d=(0,a.op)({pad4d_:function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return(0,r.assert)(4===t.length&&2===t[0].length&&2===t[1].length&&2===t[2].length&&2===t[3].length,(()=>"Invalid number of paddings. Must be length of 2 each.")),(0,o.pad)(e,t,n)}})},864210:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.pool=void 0;var r=n(188695),a=h(n(904737)),o=n(926677),s=n(47326),i=h(n(812682)),c=n(31112),l=n(930684),u=n(195476),d=n(244851);function p(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(p=function(e){return e?n:t})(e)}function h(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=p(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if("default"!==o&&{}.hasOwnProperty.call(e,o)){var s=a?Object.getOwnPropertyDescriptor(e,o):null;s&&(s.get||s.set)?Object.defineProperty(r,o,s):r[o]=e[o]}return r.default=e,n&&n.set(e,r),r}t.pool=(0,l.op)({pool_:function(e,t,n,l,p,h,f){null==p&&(p=[1,1]),null==h&&(h=1),0===l&&(l="valid");const m=(0,r.convertToTensor)(e,"x","maxPool");let g=m,y=!1;3===m.rank&&(y=!0,g=(0,u.reshape)(m,[1,m.shape[0],m.shape[1],m.shape[2]])),a.assert(i.eitherStridesOrDilationsAreOne(h,p),(()=>"Error in pool: Either strides or dilations must be 1. "+"Got strides ".concat(h," and dilations '").concat(p,"'")));const v=i.computePool2DInfo(g.shape,t,h,p,l),b=[v.dilationHeight,v.dilationWidth];let x;x="same"===l?function(e,t){const n=e.map(((e,n)=>e+(e-1)*(t[n]-1))),r=n.map((e=>e-1)),a=r.map((e=>Math.floor(e/2))),o=r.map(((e,t)=>e-a[t]));return r.map(((e,t)=>[a[t],o[t]]))}([v.filterHeight,v.filterWidth],b):[[0,0],[0,0]];const w=1===b[0]&&1===b[1],[k,_]=function(e,t,n){const r=n.map((e=>e[0])),a=n.map((e=>e[1])),o=e.concat(r,a),s=t.map(((e,t)=>(e-o[t]%e)%e)),i=a.map(((e,t)=>e+s[t])),c=t.map(((e,t)=>[r[t],i[t]])),l=t.map(((e,t)=>[0,s[t]]));return[c,l]}([v.inHeight,v.inWidth],b,x),C=w?l:"valid",P=w?g:(0,d.spaceToBatchND)(g,b,k),O=("avg"===n?()=>(0,o.avgPool)(P,t,h,C,f):()=>(0,c.maxPool)(P,t,h,C,f))(),N=w?O:(0,s.batchToSpaceND)(O,b,_);return y?(0,u.reshape)(N,[N.shape[1],N.shape[2],N.shape[3]]):N}})},216556:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.pow=void 0;var r=n(90337),a=n(536217),o=n(390771),s=n(188695),i=n(930684);t.pow=(0,i.op)({pow_:function(e,t){let n=(0,s.convertToTensor)(e,"base","pow"),i=(0,s.convertToTensor)(t,"exp","pow");[n,i]=(0,o.makeTypesMatch)(n,i);const c={a:n,b:i};return r.ENGINE.runKernel(a.Pow,c)}})},993804:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.prelu=void 0;var r=n(90337),a=n(536217),o=n(188695),s=n(930684);t.prelu=(0,s.op)({prelu_:function(e,t){const n={x:(0,o.convertToTensor)(e,"x","prelu"),alpha:(0,o.convertToTensor)(t,"alpha","prelu")};return r.ENGINE.runKernel(a.Prelu,n)}})},275438:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.print=function(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];console.log(e.toString(t))}},278026:(e,t,n)=>{"use strict";
1Object.defineProperty(t,"__esModule",{value:!0}),t.prod=void 0;var r=n(90337),a=n(536217),o=n(188695),s=n(386565),i=n(930684);t.prod=(0,i.op)({prod_:function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],i=(0,o.convertToTensor)(e,"x","prod");"bool"===i.dtype&&(i=(0,s.cast)(i,"int32"));const c={x:i},l={axis:t,keepDims:n};return r.ENGINE.runKernel(a.Prod,c,l)}})},431650:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.rand=void 0;var r=n(90337),a=n(904737),o=n(930684);t.rand=(0,o.op)({rand_:function(e,t,n){const o=(0,a.sizeFromShape)(e);let s=null;if(null==n||"float32"===n)s=new Float32Array(o);else if("int32"===n)s=new Int32Array(o);else{if("bool"!==n)throw new Error("Unknown data type ".concat(n));s=new Uint8Array(o)}for(let e=0;e<o;e++)s[e]=t();return r.ENGINE.makeTensor(s,e,n)}})},937827:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.UniformRandom=t.RandGamma=t.MPRandGauss=void 0,t.expectArrayInMeanStdRange=function(e,t,n,r){null==r&&(r=(0,a.testEpsilon)());const o=i(e);(0,a.expectNumbersClose)(o,t,r),(0,a.expectNumbersClose)(function(e,t){let n=0;for(let r=0;r<e.length;r++){const a=e[r]-t;n+=a*a}return Math.sqrt(n/e.length)}(e,o),n,r)},t.jarqueBeraNormalityTest=function(e){const t=e.length,n=function(e){const t=i(e),n=e.length;let r=0,a=0;for(let o=0;o<n;o++){const n=e[o]-t;r+=Math.pow(n,2),a+=Math.pow(n,3)}return 1/n*a/Math.pow(1/(n-1)*r,1.5)}(e),r=function(e){const t=i(e),n=e.length;let r=0,a=0;for(let o=0;o<n;o++){const n=e[o]-t;r+=Math.pow(n,2),a+=Math.pow(n,4)}return 1/n*a/Math.pow(1/n*r,2)}(e),a=t/6*(Math.pow(n,2)+.25*Math.pow(r-3,2));if(a>5.991)throw new Error("Invalid p-value for JB: ".concat(a))};var r=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=o(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var s in e)if("default"!==s&&{}.hasOwnProperty.call(e,s)){var i=a?Object.getOwnPropertyDescriptor(e,s):null;i&&(i.get||i.set)?Object.defineProperty(r,s,i):r[s]=e[s]}return r.default=e,n&&n.set(e,r),r}(n(236377)),a=n(248849);function o(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(o=function(e){return e?n:t})(e)}class s{constructor(e,t,n,a,o){this.mean=e,this.stdDev=t,this.dtype=n,this.nextVal=NaN,this.truncated=a,this.truncated&&(this.upper=this.mean+2*this.stdDev,this.lower=this.mean-2*this.stdDev);const s=o||Math.random();this.random=r.alea(s.toString())}nextValue(){if(!isNaN(this.nextVal)){const e=this.nextVal;return this.nextVal=NaN,e}let e,t,n=!1;for(;!n;){let r,a,o;do{r=2*this.random()-1,a=2*this.random()-1,o=r*r+a*a}while(o>=1||0===o);const s=Math.sqrt(-2*Math.log(o)/o);e=this.mean+this.stdDev*r*s,t=this.mean+this.stdDev*a*s,this.truncated&&!this.isValidTruncated(e)||(n=!0)}return this.truncated&&!this.isValidTruncated(t)||(this.nextVal=this.convertValue(t)),this.convertValue(e)}convertValue(e){return null==this.dtype||"float32"===this.dtype?e:Math.round(e)}isValidTruncated(e){return e<=this.upper&&e>=this.lower}}t.MPRandGauss=s;t.RandGamma=class{constructor(e,t,n,a){this.alpha=e,this.beta=1/t,this.dtype=n;const o=a||Math.random();this.randu=r.alea(o.toString()),this.randn=new s(0,1,n,!1,this.randu()),this.d=e<1?e+2/3:e-1/3,this.c=1/Math.sqrt(9*this.d)}nextValue(){let e,t,n,r,a,o;for(;;){do{r=this.randn.nextValue(),o=1+this.c*r}while(o<=0);if(o*=o*o,e=r*r,t=1-.331*e*e,n=.5*e+this.d*(1-o+Math.log(o)),a=this.randu(),a<t||Math.log(a)<n)break}return o=1/this.beta*this.d*o,this.alpha<1&&(o*=Math.pow(this.randu(),1/this.alpha)),this.convertValue(o)}convertValue(e){return"float32"===this.dtype?e:Math.round(e)}};function i(e){let t=0;for(let n=0;n<e.length;n++)t+=e[n];return t/e.length}t.UniformRandom=class{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,n=arguments.length>2?arguments[2]:void 0,a=arguments.length>3?arguments[3]:void 0;if(this.canReturnFloat=()=>null==this.dtype||"float32"===this.dtype,this.min=e,this.range=t-e,this.dtype=n,null==a&&(a=Math.random()),"number"==typeof a&&(a=a.toString()),!this.canReturnFloat()&&this.range<=1)throw new Error("The difference between ".concat(e," - ").concat(t," <= 1 and dtype is not float"));this.random=r.alea(a)}convertValue(e){return this.canReturnFloat()?e:Math.round(e)}
1nextValue(){return this.convertValue(this.min+this.range*this.random())}}},439741:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.randomGamma=void 0;var r=n(60249),a=n(930684),o=n(937827);t.randomGamma=(0,a.op)({randomGamma_:function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"float32",s=arguments.length>4?arguments[4]:void 0;if(null==n&&(n=1),null==a&&(a="float32"),"float32"!==a&&"int32"!==a)throw new Error("Unsupported data type ".concat(a));const i=new o.RandGamma(t,n,a,s),c=(0,r.buffer)(e,a);for(let e=0;e<c.values.length;e++)c.values[e]=i.nextValue();return c.toTensor()}})},516588:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.randomNormal=void 0;var r=n(60249),a=n(930684),o=n(937827);t.randomNormal=(0,a.op)({randomNormal_:function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,a=arguments.length>3?arguments[3]:void 0,s=arguments.length>4?arguments[4]:void 0;if(null!=a&&"bool"===a)throw new Error("Unsupported data type ".concat(a));const i=new o.MPRandGauss(t,n,a,!1,s),c=(0,r.buffer)(e,a);for(let e=0;e<c.values.length;e++)c.values[e]=i.nextValue();return c.toTensor()}})},324852:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.randomUniform=void 0;var r=n(60249),a=n(930684),o=n(937827);t.randomUniform=(0,a.op)({randomUniform_:function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"float32",s=arguments.length>4?arguments[4]:void 0;const i=(0,r.buffer)(e,a),c=new o.UniformRandom(t,n,null,s);for(let e=0;e<i.values.length;e++)i.values[e]=c.nextValue();return i.toTensor()}})},796631:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.range=function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"float32";if(0===n)throw new Error("Cannot have a step of zero");const s={start:e,stop:t,step:n,dtype:o};return r.ENGINE.runKernel(a.Range,{},s)};var r=n(90337),a=n(536217)},562651:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.real=void 0;var r=n(90337),a=n(536217),o=n(188695),s=n(930684);t.real=(0,s.op)({real_:function(e){const t={input:(0,o.convertToTensor)(e,"input","real")};return r.ENGINE.runKernel(a.Real,t)}})},191833:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.reciprocal=void 0;var r=n(90337),a=n(536217),o=n(188695),s=n(930684);t.reciprocal=(0,s.op)({reciprocal_:function(e){const t={x:(0,o.convertToTensor)(e,"x","reciprocal")};return r.ENGINE.runKernel(a.Reciprocal,t)}})},44285:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.PARALLELIZE_THRESHOLD=void 0,t.computeOptimalWindowSize=function(e){if(e<=a)return e;return(0,r.nearestDivisor)(e,Math.floor(Math.sqrt(e)))};var r=n(904737);const a=t.PARALLELIZE_THRESHOLD=30},259849:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.relu=void 0;var r=n(90337),a=n(536217),o=n(188695),s=n(930684);t.relu=(0,s.op)({relu_:function(e){const t={x:(0,o.convertToTensor)(e,"x","relu")};return r.ENGINE.runKernel(a.Relu,t)}})},783295:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.relu6=void 0;var r=n(90337),a=n(536217),o=n(188695),s=n(930684);t.relu6=(0,s.op)({relu6_:function(e){const t={x:(0,o.convertToTensor)(e,"x","relu6")};return r.ENGINE.runKernel(a.Relu6,t)}})},195476:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.reshape=void 0;var r=n(90337),a=n(536217),o=n(188695),s=n(930684);t.reshape=(0,s.op)({reshape_:function(e,t){const n={x:(0,o.convertToTensor)(e,"x","reshape","string_or_numeric")},s={shape:t};return r.ENGINE.runKernel(a.Reshape,n,s)}})},790767:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.reverse=void 0;var r=n(90337),a=n(536217),o=n(188695),s=n(930684);t.reverse=(0,s.op)({reverse_:function(e,t){const n={x:(0,o.convertToTensor)(e,"x","reverse")},s={dims:t};return r.ENGINE.runKernel(a.Reverse,n,s)}})}
1,816889:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.reverse1d=void 0;var r=n(188695),a=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=i(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if("default"!==o&&{}.hasOwnProperty.call(e,o)){var s=a?Object.getOwnPropertyDescriptor(e,o):null;s&&(s.get||s.set)?Object.defineProperty(r,o,s):r[o]=e[o]}return r.default=e,n&&n.set(e,r),r}(n(904737)),o=n(930684),s=n(790767);function i(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(i=function(e){return e?n:t})(e)}t.reverse1d=(0,o.op)({reverse1d_:function(e){const t=(0,r.convertToTensor)(e,"x","reverse");return a.assert(1===t.rank,(()=>"Error in reverse1D: x must be rank 1 but got rank ".concat(t.rank,"."))),(0,s.reverse)(t,0)}})},170280:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.reverse2d=void 0;var r=n(188695),a=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=i(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if("default"!==o&&{}.hasOwnProperty.call(e,o)){var s=a?Object.getOwnPropertyDescriptor(e,o):null;s&&(s.get||s.set)?Object.defineProperty(r,o,s):r[o]=e[o]}return r.default=e,n&&n.set(e,r),r}(n(904737)),o=n(930684),s=n(790767);function i(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(i=function(e){return e?n:t})(e)}t.reverse2d=(0,o.op)({reverse2d_:function(e,t){const n=(0,r.convertToTensor)(e,"x","reverse");return a.assert(2===n.rank,(()=>"Error in reverse2D: x must be rank 2 but got rank ".concat(n.rank,"."))),(0,s.reverse)(n,t)}})},710853:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.reverse3d=void 0;var r=n(188695),a=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=i(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if("default"!==o&&{}.hasOwnProperty.call(e,o)){var s=a?Object.getOwnPropertyDescriptor(e,o):null;s&&(s.get||s.set)?Object.defineProperty(r,o,s):r[o]=e[o]}return r.default=e,n&&n.set(e,r),r}(n(904737)),o=n(930684),s=n(790767);function i(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(i=function(e){return e?n:t})(e)}t.reverse3d=(0,o.op)({reverse3d_:function(e,t){const n=(0,r.convertToTensor)(e,"x","reverse");return a.assert(3===n.rank,(()=>"Error in reverse3D: x must be rank 3 but got rank ".concat(n.rank,"."))),(0,s.reverse)(n,t)}})},495181:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.reverse4d=void 0;var r=n(188695),a=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=i(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if("default"!==o&&{}.hasOwnProperty.call(e,o)){var s=a?Object.getOwnPropertyDescriptor(e,o):null;s&&(s.get||s.set)?Object.defineProperty(r,o,s):r[o]=e[o]}return r.default=e,n&&n.set(e,r),r}(n(904737)),o=n(930684),s=n(790767);function i(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(i=function(e){return e?n:t})(e)}t.reverse4d=(0,o.op)({reverse4d_:function(e,t){const n=(0,r.convertToTensor)(e,"x","reverse");return a.assert(4===n.rank,(()=>"Error in reverse4D: x must be rank 4 but got rank ".concat(n.rank,"."))),(0,s.reverse)(n,t)}})},652250:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getImageCenter=function(e,t,n){const r=n*("number"==typeof e?e:e[0]),a=t*("number"==typeof e?e:e[1]);return[r,a]}},473947:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.round=void 0;var r=n(90337),a=n(536217),o=n(188695),s=n(930684);t.round=(0,s.op)({round_:function(e){const t={x:(0,o.convertToTensor)(e,"x","round")};return r.ENGINE.runKernel(a.Round,t)}})},652590:(e,t,n)=>{"use strict";
1Object.defineProperty(t,"__esModule",{value:!0}),t.rsqrt=void 0;var r=n(90337),a=n(536217),o=n(188695),s=n(930684);t.rsqrt=(0,s.op)({rsqrt_:function(e){const t={x:(0,o.convertToTensor)(e,"x","rsqrt","float32")};return r.ENGINE.runKernel(a.Rsqrt,t)}})},454179:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.scalar=function(e,t){if(((0,r.isTypedArray)(e)&&"string"!==t||Array.isArray(e))&&"complex64"!==t)throw new Error("Error creating a new Scalar: value must be a primitive (number|boolean|string)");if("string"===t&&(0,r.isTypedArray)(e)&&!(e instanceof Uint8Array))throw new Error("When making a scalar from encoded string, the value must be `Uint8Array`.");return(0,a.makeTensor)(e,[],[],t)};var r=n(904737),a=n(737816)},982282:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.scatterND=void 0;var r=n(90337),a=n(536217),o=n(188695),s=n(930684),i=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=c(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if("default"!==o&&{}.hasOwnProperty.call(e,o)){var s=a?Object.getOwnPropertyDescriptor(e,o):null;s&&(s.get||s.set)?Object.defineProperty(r,o,s):r[o]=e[o]}return r.default=e,n&&n.set(e,r),r}(n(426955));function c(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(c=function(e){return e?n:t})(e)}t.scatterND=(0,s.op)({scatterND_:function(e,t,n){const s=(0,o.convertToTensor)(e,"indices","scatterND","int32"),c=(0,o.convertToTensor)(t,"updates","scatterND");i.validateInput(c,s,n);const l={indices:s,updates:c},u={shape:n};return r.ENGINE.runKernel(a.ScatterNd,l,u)}})},426955:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.calculateShapes=function(e,t,n){const a=t.shape.length,o=a>1?t.shape[a-1]:1,s=n.length;let i=1;for(let e=o;e<s;++e)i*=n[e];const c=o<1?1:o,l=(0,r.sizeFromShape)(t.shape)/c,u=[...(0,r.computeStrides)(n.slice(0,o)),1],d=(0,r.sizeFromShape)(n);return{sliceRank:o,numUpdates:l,sliceSize:i,strides:u,outputSize:d}},t.validateInput=function(e,t,n){if(t.rank<1)throw new Error("tf.scatterND() expects the indices to be rank 1 or higher,"+" but the rank was ".concat(t.rank,"."));if(e.rank<1)throw new Error("tf.scatterND() expects the updates to be rank 1 or higher,"+" but the rank was ".concat(e.rank,"."));if("int32"!==t.dtype)throw new Error("The dtype of 'indices' should be int32, but got dtype: ".concat(t.dtype));if(n.length<1)throw new Error("Output rank must be greater or equal to 1, but got shape: ".concat(n));if(0===n.length){if(0===t.size)throw new Error("Indices specified for empty output. indices shape: ".concat(t.shape));if(0===e.size)throw new Error("Updates specified for empty output. updates shape: ".concat(e.shape))}a(n,t,e)},t.validateUpdateShape=a;var r=n(904737);function a(e,t,n){const r=t.rank>1?t.shape[t.rank-1]:1,a=t.rank>1?t.rank-1:1,o="Must have updates.shape = indices.shape[:batchDim] + "+"shape[sliceDim:], got updates.shape: ".concat(n.shape)+", indices.shape: ".concat(t.shape,", shape: ").concat(e)+", sliceDim: ".concat(r,", and batchDim: ").concat(a,".");if(n.rank<a)throw new Error(o+" update.rank < ".concat(a,". "));if(e.length<r+(n.rank-a))throw new Error(o+" Output shape length < ".concat(r+(n.rank-a)));if(n.rank!==a+e.length-r)throw new Error(o+" update.rank != ".concat(a+e.length-r));for(let e=0;e<a;++e)if(n.shape[e]!==t.shape[e])throw new Error(o+" updates.shape[".concat(e,"] (").concat(n.shape[e],") != indices.shape[").concat(e,"] (").concat(t.shape[e],")."));for(let t=0;t<n.rank-a;++t)if(n.shape[t+a]!==e[t+r])throw new Error(o+" updates.shape[".concat(t+a,"] (").concat(n.shape[t+a],") != shape[").concat(t+a,"] (").concat(e[t+a],")"))}},23526:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.collectGatherOpShapeInfo=function(e,t,n,r){const a=t.shape.length,o=e.shape.length;if(0!==r&&(r<-a||r>a))throw new Error("Expect batchDims in the range of [-".concat(a,", ").concat(a,"], but got ").concat(r));r<0&&(r+=a);if(r>o)throw new Error("batchDims (".concat(r,") must be less than rank(x) (\n ").concat(o,")."));if(n<r)throw new Error("batchDims (".concat(r,") must be less than or equal to axis (").concat(n,")."));for(let n=0;n<r;++n)if(e.shape[n]!==t.shape[n])throw new Error("x.shape[".concat(n,"]: ").concat(e.shape[n]," should be equal to indices.shape[").concat(n,"]: ").concat(t.shape[n],"."));const s=e.shape[n],i=[];let c=1,l=1,u=1;for(let t=0;t<r;++t)i.push(e.shape[t]),c*=e.shape[t];for(let t=r;t<n;t++)i.push(e.shape[t]),l*=e.shape[t];for(let e=r;
1e<a;e++)i.push(t.shape[e]);for(let t=n+1;t<o;t++)i.push(e.shape[t]),u*=e.shape[t];return{batchSize:c,sliceSize:u,outerSize:l,dimSize:s,outputShape:i}},t.computeOutShape=function(e,t,n){const r=[],a=e.length;for(let o=0;o<a;o++)o!==t?r.push(e[o]):r.push(n);return r},t.segOpComputeOptimalWindowSize=function(e,t){let n,o=!1;e<=a.PARALLELIZE_THRESHOLD?(n=e,o=!0):n=(0,r.nearestDivisor)(e,Math.floor(Math.sqrt(e)));for(;!o;)n>t||n===e?o=!0:n=(0,r.nearestDivisor)(e,n+1);return n};var r=n(904737),a=n(44285)},731754:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.selu=void 0;var r=n(90337),a=n(536217),o=n(188695),s=n(930684);t.selu=(0,s.op)({selu_:function(e){const t={x:(0,o.convertToTensor)(e,"x","selu")};return r.ENGINE.runKernel(a.Selu,t)}})},755469:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.SELU_SCALEALPHA=t.SELU_SCALE=void 0;t.SELU_SCALEALPHA=1.7580993408473768,t.SELU_SCALE=1.0507009873554805},843757:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.separableConv2d=void 0;var r=n(188695),a=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=l(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if("default"!==o&&{}.hasOwnProperty.call(e,o)){var s=a?Object.getOwnPropertyDescriptor(e,o):null;s&&(s.get||s.set)?Object.defineProperty(r,o,s):r[o]=e[o]}return r.default=e,n&&n.set(e,r),r}(n(904737)),o=n(797476),s=n(599081),i=n(930684),c=n(195476);function l(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(l=function(e){return e?n:t})(e)}t.separableConv2d=(0,i.op)({separableConv2d_:function(e,t,n,i,l){let u=arguments.length>5&&void 0!==arguments[5]?arguments[5]:[1,1],d=arguments.length>6&&void 0!==arguments[6]?arguments[6]:"NHWC";const p=(0,r.convertToTensor)(e,"x","separableConv2d"),h=(0,r.convertToTensor)(t,"depthwiseFilter","separableConv2d"),f=(0,r.convertToTensor)(n,"pointwiseFilter","separableConv2d");let m=p,g=!1;if(3===p.rank&&(g=!0,m=(0,c.reshape)(p,[1,p.shape[0],p.shape[1],p.shape[2]])),"NCHW"===d)throw new Error("separableConv2d currently does not support dataFormat NCHW; only NHWC is supported");a.assert(4===m.rank,(()=>"Error in separableConv2d: input must be rank 4, but got "+"rank ".concat(m.rank,"."))),a.assert(4===h.rank,(()=>"Error in separableConv2d: depthwise filter must be rank 4, but "+"got rank ".concat(h.rank,"."))),a.assert(4===f.rank,(()=>"Error in separableConv2d: pointwise filter must be rank 4, but "+"got rank ".concat(h.rank,"."))),a.assert(1===f.shape[0],(()=>"Error in separableConv2d: the first dimension of pointwise filter "+" must be 1, but got ".concat(f.shape[0],"."))),a.assert(1===f.shape[1],(()=>"Error in separableConv2d: the second dimension of pointwise "+"filter must be 1, but got ".concat(f.shape[1],".")));const y=h.shape[2],v=h.shape[3];a.assert(f.shape[2]===y*v,(()=>"Error in separableConv2d: the third dimension of pointwise filter "+"must be ".concat(y*v,", ")+"but got ".concat(f.shape[2],".")));const b=(0,s.depthwiseConv2d)(m,h,i,l,d,u),x=(0,o.conv2d)(b,f,1,"valid",d);return g?(0,c.reshape)(x,[x.shape[1],x.shape[2],x.shape[3]]):x}})},34875:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.setdiff1dAsync=void 0;var r=n(659795),a=n(188695),o=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=s(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if("default"!==o&&{}.hasOwnProperty.call(e,o)){var i=a?Object.getOwnPropertyDescriptor(e,o):null;i&&(i.get||i.set)?Object.defineProperty(r,o,i):r[o]=e[o]}return r.default=e,n&&n.set(e,r),r}(n(904737));function s(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(s=function(e){return e?n:t})(e)}t.setdiff1dAsync=async function(e,t){const n=(0,a.convertToTensor)(e,"x","setdiff1d"),s=(0,a.convertToTensor)(t,"y","setdiff1d");o.assert(n.dtype===s.dtype,(()=>"x and y should have the same dtype, but got x (".concat(n.dtype,") and y (").concat(s.dtype,")."))),o.assert(1===n.rank,(()=>"x should be 1D tensor, but got x (".concat(n.shape,")."))),o.assert(1===s.rank,(()=>"y should be 1D tensor, but got y (".concat(s.shape,").")));const i=await n.data(),c=await s.data(),l=new Set(c);let u=0;for(let e=0;e<i.length;e++)l.has(i[e])||u++;const d=new r.TensorBuffer([u],n.dtype),p=new r.TensorBuffer([u],"int32");for(let e=0,t=0;e<i.length;e++)l.has(i[e])||(d.values[t]=i[e],p.values[t]=e,t++);return[d.toTensor(),p.toTensor()]}},789520:(e,t,n)=>{"use strict";
1Object.defineProperty(t,"__esModule",{value:!0}),t.sigmoid=void 0;var r=n(90337),a=n(536217),o=n(188695),s=n(930684);t.sigmoid=(0,s.op)({sigmoid_:function(e){const t={x:(0,o.convertToTensor)(e,"x","sigmoid","float32")};return r.ENGINE.runKernel(a.Sigmoid,t)}})},244993:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.sign=void 0;var r=n(90337),a=n(536217),o=n(188695),s=n(930684);t.sign=(0,s.op)({sign_:function(e){const t={x:(0,o.convertToTensor)(e,"x","sign")};return r.ENGINE.runKernel(a.Sign,t)}})},56323:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.frame=void 0;var r=n(55108),a=n(970061),o=n(930684),s=n(195476),i=n(247565),c=n(716914);t.frame=(0,o.op)({frame_:function(e,t,n){let o=arguments.length>3&&void 0!==arguments[3]&&arguments[3],l=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0,u=0;const d=[];for(;u+t<=e.size;)d.push((0,i.slice)(e,u,t)),u+=n;if(o)for(;u<e.size;){const o=u+t-e.size,s=(0,r.concat)([(0,i.slice)(e,u,t-o),(0,a.fill)([o],l)]);d.push(s),u+=n}return 0===d.length?(0,c.tensor2d)([],[0,t]):(0,s.reshape)((0,r.concat)(d),[d.length,t])}})},557989:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.hammingWindow=void 0;var r=n(930684),a=n(80870);t.hammingWindow=(0,r.op)({hammingWindow_:function(e){return(0,a.cosineWindow)(e,.54,.46)}})},993557:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.hannWindow=void 0;var r=n(930684),a=n(80870);t.hannWindow=(0,r.op)({hannWindow_:function(e){return(0,a.cosineWindow)(e,.5,.5)}})},829028:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.stft=void 0;var r=n(295702),a=n(930684),o=n(80870),s=n(269663),i=n(56323),c=n(993557);t.stft=(0,a.op)({stft_:function(e,t,n,a){let l=arguments.length>4&&void 0!==arguments[4]?arguments[4]:c.hannWindow;null==a&&(a=(0,o.enclosingPowerOfTwo)(t));const u=(0,i.frame)(e,t,n),d=(0,r.mul)(u,l(t));return(0,s.rfft)(d,a)}})},80870:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.cosineWindow=function(e,t,n){const a=1-e%2,o=new Float32Array(e);for(let r=0;r<e;++r){const s=2*Math.PI*r/(e+a-1);o[r]=t-n*Math.cos(s)}return(0,r.tensor1d)(o,"float32")},t.enclosingPowerOfTwo=function(e){return Math.floor(Math.pow(2,Math.ceil(Math.log(e)/Math.log(2))))};var r=n(724546)},762006:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.sin=void 0;var r=n(90337),a=n(536217),o=n(188695),s=n(930684);t.sin=(0,s.op)({sin_:function(e){const t={x:(0,o.convertToTensor)(e,"x","sin","float32")};return r.ENGINE.runKernel(a.Sin,t)}})},249118:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.sinh=void 0;var r=n(90337),a=n(536217),o=n(188695),s=n(930684);t.sinh=(0,s.op)({sinh_:function(e){const t={x:(0,o.convertToTensor)(e,"x","sinh")};return r.ENGINE.runKernel(a.Sinh,t)}})},247565:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.slice=void 0;var r=n(90337),a=n(536217),o=n(188695),s=n(930684);t.slice=(0,s.op)({slice_:function(e,t,n){const s=(0,o.convertToTensor)(e,"x","slice","string_or_numeric");if(0===s.rank)throw new Error("Slicing scalar is not possible");const i={x:s},c={begin:t,size:n};return r.ENGINE.runKernel(a.Slice,i,c)}})},716682:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.slice1d=void 0;var r=n(188695),a=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=i(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if("default"!==o&&{}.hasOwnProperty.call(e,o)){var s=a?Object.getOwnPropertyDescriptor(e,o):null;s&&(s.get||s.set)?Object.defineProperty(r,o,s):r[o]=e[o]}return r.default=e,n&&n.set(e,r),r}(n(904737)),o=n(930684),s=n(247565);function i(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(i=function(e){return e?n:t})(e)}t.slice1d=(0,o.op)({slice1d_:function(e,t,n){const o=(0,r.convertToTensor)(e,"x","slice1d");return a.assert(1===o.rank,(()=>"slice1d expects a rank-1 tensor, but got a rank-".concat(o.rank," tensor"))),(0,s.slice)(o,[t],[n])}})}
1,46228:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.slice2d=void 0;var r=n(188695),a=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=i(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if("default"!==o&&{}.hasOwnProperty.call(e,o)){var s=a?Object.getOwnPropertyDescriptor(e,o):null;s&&(s.get||s.set)?Object.defineProperty(r,o,s):r[o]=e[o]}return r.default=e,n&&n.set(e,r),r}(n(904737)),o=n(930684),s=n(247565);function i(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(i=function(e){return e?n:t})(e)}t.slice2d=(0,o.op)({slice2d_:function(e,t,n){const o=(0,r.convertToTensor)(e,"x","slice2d");return a.assert(2===o.rank,(()=>"slice2d expects a rank-2 tensor, but got a rank-".concat(o.rank," tensor"))),(0,s.slice)(o,t,n)}})},550219:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.slice3d=void 0;var r=n(188695),a=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=i(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if("default"!==o&&{}.hasOwnProperty.call(e,o)){var s=a?Object.getOwnPropertyDescriptor(e,o):null;s&&(s.get||s.set)?Object.defineProperty(r,o,s):r[o]=e[o]}return r.default=e,n&&n.set(e,r),r}(n(904737)),o=n(930684),s=n(247565);function i(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(i=function(e){return e?n:t})(e)}t.slice3d=(0,o.op)({slice3d_:function(e,t,n){const o=(0,r.convertToTensor)(e,"x","slice3d");return a.assert(3===o.rank,(()=>"slice3d expects a rank-3 tensor, but got a rank-".concat(o.rank," tensor"))),(0,s.slice)(o,t,n)}})},422120:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.slice4d=void 0;var r=n(188695),a=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=i(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if("default"!==o&&{}.hasOwnProperty.call(e,o)){var s=a?Object.getOwnPropertyDescriptor(e,o):null;s&&(s.get||s.set)?Object.defineProperty(r,o,s):r[o]=e[o]}return r.default=e,n&&n.set(e,r),r}(n(904737)),o=n(930684),s=n(247565);function i(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(i=function(e){return e?n:t})(e)}t.slice4d=(0,o.op)({slice4d_:function(e,t,n){const o=(0,r.convertToTensor)(e,"x","slice4d");return a.assert(4===o.rank,(()=>"slice4d expects a rank-4 tensor, but got a rank-".concat(o.rank," tensor"))),(0,s.slice)(o,t,n)}})},328113:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.assertParamsValid=function(e,t,n){const a=e.shape.length;r.assert(a===t.length,(()=>"Error in slice".concat(a,"D: Length of begin ").concat(t," must ")+"match the rank of the array (".concat(a,")."))),r.assert(a===n.length,(()=>"Error in slice".concat(a,"D: Length of size ").concat(n," must ")+"match the rank of the array (".concat(a,").")));for(let o=0;o<a;++o)r.assert(t[o]+n[o]<=e.shape[o],(()=>"Error in slice".concat(a,"D: begin[").concat(o,"] + size[").concat(o,"] ")+"(".concat(t[o]+n[o],") would overflow input.shape[").concat(o,"] (").concat(e.shape[o],")")))},t.computeFlatOffset=function(e,t){let n=e.length>0?e[e.length-1]:1;for(let r=0;r<e.length-1;r++)n+=e[r]*t[r];return n},t.computeOutShape=function(e,t,n){const r=[];for(let a=0;a<e.length;a++)r[a]=Math.ceil((t[a]-e[a])/n[a]);return r},t.getNormalizedAxes=function(e,t,n,r,a,o,s,c,l){const m=e.length;let g=new Array(m),y=new Array(m),v=new Array(m);if(t.length&&n>0){const l=t[0],p=n+1;g=u(s,l,p,r,e),y=d(c,l,p,a,e),v=i(o,l,p,e)}else for(let t=0;t<m;t++)g[t]=h(s,r,o,e,t,l),y[t]=f(c,a,o,e,t,l),v[t]=p(o,t,l);return{begin:g,end:y,strides:v}},t.isSliceContinous=function(e,t,n){let r=n.length;for(let e=0;e<n.length;e++)if(n[e]>1){r=e;break}for(let a=r+1;a<n.length;a++)if(t[a]>0||n[a]!==e[a])return!1;return!0},t.maskToAxes=function(e){const t=[];let n=0;for(;e>0;)1&e&&t.push(n),e/=2,n++;return t},t.parseSliceParams=function(e,t,n){let a;const o=e.shape.length;a="number"==typeof t?[t,...new Array(o-1).fill(0)]:t.length<o?t.concat(new Array(o-t.length).fill(0)):t.slice();let s;a.forEach((e=>{r.assert(-1!==e,(()=>"slice() does not support negative begin indexing."))})),s=null==n?new Array(o).fill(-1):"number"==typeof n?[n,...new Array(o-1).fill(-1)]:n.length<o?n.concat(new Array(o-n.length).fill(-1)):n;return s=s.map(((t,n)=>t>=0?t:(r.assert(-1===t,(()=>"Negative size values should be exactly -1 but got "+"".concat(t," for the slice() size at index ").concat(n,"."))),e.shape[n]-a[n]))),[a,s]},t.sliceInfo=function(e,t,n,r,a,i,c,l,u){let d;null==r?(d=new Array(t.length),d.fill(1)):d=r;if(null!=c&&c&c-1)throw new Error("Multiple ellipses in slice is not allowed.");let p=!1;const h={dims:d.length,numAddAxisAfterEllipsis:0,begin:t.slice(),end:n.slice(),strides:d.slice(),beginMask:a,endMask:i,ellipsisMask:c,newAxisMask:l,shrinkAxisMask:u};for(let e=0;e<h.dims;
1e++)p&&1<<e&l&&h.numAddAxisAfterEllipsis++,1<<e&c&&(p=!0);p||(h.ellipsisMask|=1<<h.dims,h.dims++);const f={dims:e.length,beginMask:0,endMask:0,beginValid:!1,endValid:!1};!function(e,t){t.beginMask=0,t.endMask=0,t.shrinkAxisMask=0;let n=0;t.beginValid=null!=e.begin,t.endValid=null!=e.end,t.begin=new Array(t.dims),t.end=new Array(t.dims),t.strides=new Array(t.dims),t.finalShapeGatherIndices=[],t.finalShapeGatherIndicesSparse=[],t.inputShapeGatherIndicesSparse=new Array(t.dims);for(let r=0;r<e.dims;r++)if(1<<r&e.ellipsisMask){const a=Math.min(t.dims-(e.dims-r)+1+e.numAddAxisAfterEllipsis,t.dims);for(;n<a;n++)t.begin[n]=0,t.end[n]=0,t.strides[n]=1,t.beginMask|=1<<n,t.endMask|=1<<n,t.finalShapeGatherIndices.push(n),t.finalShapeGatherIndicesSparse.push(-1),t.inputShapeGatherIndicesSparse[n]=r}else if(1<<r&e.newAxisMask)t.finalShapeGatherIndices.push(o),t.finalShapeGatherIndicesSparse.push(-1);else{if(n===t.begin.length)throw Error("Index out of range using input dim ".concat(n,"; input ")+"has only ".concat(t.dims," dims, ").concat(t.begin.length,"."));null!=e.begin&&(t.begin[n]=e.begin[r]),null!=e.end&&(t.end[n]=e.end[r]),t.strides[n]=e.strides[r],e.beginMask&1<<r&&(t.beginMask|=1<<n),e.endMask&1<<r&&(t.endMask|=1<<n),e.shrinkAxisMask&1<<r?(t.finalShapeGatherIndices.push(s),t.finalShapeGatherIndicesSparse.push(-1),t.shrinkAxisMask|=1<<n):(t.finalShapeGatherIndices.push(n),t.finalShapeGatherIndicesSparse.push(r)),t.inputShapeGatherIndicesSparse[n]=r,n++}}(h,f);let g=!0,y=!0,v=!0;const b=[],x=[];for(let t=0;t<e.length;++t){if(0===f.strides[t])throw Error("strides[".concat(t,"] must be non-zero"));const n=!!(f.shrinkAxisMask&1<<t),r=e[t];if(-1===r){b.push(n?1:-1);continue}const a=[f.beginMask&1<<t,f.endMask&1<<t],o=[f.strides[t]>0?0:-1,f.strides[t]>0?r:r-1];if(n&&f.strides[t]<=0)throw Error("only stride 1 allowed on non-range indexing.");v=v&&1===f.strides[t];const s=!!(f.beginMask&1<<t&&f.endMask&1<<t);if(f.beginValid&&f.endValid){if(n){const e=f.begin[t]<0?r+f.begin[t]:f.begin[t];if(f.begin[t]=e,f.end[t]=f.begin[t]+1,e<0||e>=r)throw Error("slice index ".concat(f.begin[t]," of dimension ").concat(t," out of bounds."))}else f.begin[t]=m(f.begin[t],0,f.strides[t],r,a,o),f.end[t]=m(f.end[t],1,f.strides[t],r,a,o);const e=1===f.strides[t]&&0===f.begin[t]&&f.end[t]===r;g=g&&e,y=y&&(0===t&&1===f.strides[t]||e)}else g=g&&1===f.strides[t]&&s,y=y&&(0===t&&1===f.strides[t]||s);let i,c=!1;if(f.beginValid&&f.endValid?(i=f.end[t]-f.begin[t],c=!0):n?(i=1,c=!0):s&&r>=0&&(i=f.strides[t]<0?-r:r,c=!0),c){let e;e=0===i||i<0!=f.strides[t]<0?0:Math.trunc(i/f.strides[t])+(i%f.strides[t]!=0?1:0),b.push(e)}else b.push(-1)}for(let e=0;e<f.finalShapeGatherIndices.length;++e){const t=f.finalShapeGatherIndices[e];t>=0?x.push(b[t]):t===o&&x.push(1)}return{finalShapeSparse:x.filter(((e,t)=>f.finalShapeGatherIndices[t]!==o)),finalShape:x,isIdentity:g,sliceDim0:y,isSimpleSlice:v,begin:f.begin,end:f.end,strides:f.strides}},t.startForAxis=h,t.startIndicesWithElidedDims=u,t.stopForAxis=f,t.stopIndicesWithElidedDims=d,t.stridesForAxis=p,t.stridesWithElidedDims=i;var r=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=a(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var s in e)if("default"!==s&&{}.hasOwnProperty.call(e,s)){var i=o?Object.getOwnPropertyDescriptor(e,s):null;i&&(i.get||i.set)?Object.defineProperty(r,s,i):r[s]=e[s]}return r.default=e,n&&n.set(e,r),r}(n(904737));function a(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(a=function(e){return e?n:t})(e)}const o=-2,s=-1;function i(e,t,n,r){const a=[...e];for(let e=a.length;e<r.length;e++)a.push(1);for(let e=0;e<n;e++)0===e?a[t]=1:(a.splice(t,0,1),a.pop());return a}function c(e,t,n){return n<=e?n:n-(t-1)}function l(e,t){const n=[];for(let r=0;r<e;r++)n.push(t+r);return n}function u(e,t,n,r,a){const o=[...a],s=l(n,t);for(let a=0;a<o.length;a++)if(s.indexOf(a)>-1)o[a]=0;else{const s=c(t,n,a);let i=r[s];e&1<<s&&(i=0),o[a]=i}return o}function d(e,t,n,a,o){const s=[...o],i=l(n,t);for(let r=0;r<s.length;r++)if(i.indexOf(r)>-1)s[r]=Number.MAX_SAFE_INTEGER;else{const o=c(t,n,r);let i=a[o];e&1<<o&&(i=Number.MAX_SAFE_INTEGER),s[r]=i}for(let e=0;e<s.length;e++){const t=o[e];s[e]<0&&(s[e]+=t),s[e]=r.clamp(0,s[e],o[e])}return s}function p(e,t,n){let r=e[t];return(n&1<<t||null==r)&&(r=1),r}function h(e,t,n,a,o,s){let i=t[o];const c=n[o]||1;(e&1<<o||s&1<<o||null==i)&&(i=c>0?Number.MIN_SAFE_INTEGER:Number.MAX_SAFE_INTEGER);const l=a[o];return i<0&&(i+=l),i=r.clamp(0,i,l-1),i}function f(e,t,n,a,o,s){let i=t[o];const c=n[o]||1;(e&1<<o||s&1<<o||null==i)&&(i=c>0?Number.MAX_SAFE_INTEGER:Number.MIN_SAFE_INTEGER);const l=a[o];return i<0&&(i+=l),i=c>0?r.clamp(0,i,l):r.clamp(-1,i,l-1),i}function m(e,t,n,r,a,o){if(a[t])return n>0?o[t]:o[t+1&1];{const t=e<0?r+e:e;return t<o[0]?o[0]:t>o[1]?o[1]:t}}},697775:(e,t,n)=>{"use strict";
1Object.defineProperty(t,"__esModule",{value:!0}),t.softmax=void 0;var r=n(90337),a=n(536217),o=n(188695),s=n(930684);t.softmax=(0,s.op)({softmax_:function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:-1;const n=(0,o.convertToTensor)(e,"logits","softmax","float32");if(-1===t&&(t=n.rank-1),t!==n.rank-1)throw Error("Softmax along a non-last dimension is not yet supported. "+"Logits was rank ".concat(n.rank," and dim was ").concat(t));const s={logits:n},i={dim:t};return r.ENGINE.runKernel(a.Softmax,s,i)}})},968924:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.softplus=void 0;var r=n(90337),a=n(536217),o=n(188695),s=n(930684);t.softplus=(0,s.op)({softplus_:function(e){const t={x:(0,o.convertToTensor)(e,"x","softplus")};return r.ENGINE.runKernel(a.Softplus,t)}})},244851:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.spaceToBatchND=void 0;var r=n(90337),a=n(536217),o=n(188695),s=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=c(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if("default"!==o&&{}.hasOwnProperty.call(e,o)){var s=a?Object.getOwnPropertyDescriptor(e,o):null;s&&(s.get||s.set)?Object.defineProperty(r,o,s):r[o]=e[o]}return r.default=e,n&&n.set(e,r),r}(n(904737)),i=n(930684);function c(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(c=function(e){return e?n:t})(e)}t.spaceToBatchND=(0,i.op)({spaceToBatchND_:function(e,t,n){const i=(0,o.convertToTensor)(e,"x","spaceToBatchND");s.assert(i.rank>=1+t.length,(()=>"input rank ".concat(i.rank," should be > than [blockShape] ").concat(t.length))),s.assert(n.length===t.length,(()=>"paddings.shape[0] ".concat(n.length," must be equal to [blockShape] ").concat(t.length))),s.assert(i.shape.reduce(((e,r,a)=>a>0&&a<=t.length?e&&(r+n[a-1][0]+n[a-1][1])%t[a-1]==0:e),!0),(()=>"input spatial dimensions ".concat(i.shape.slice(1)," with paddings ").concat(n.toString()," must be divisible by blockShapes ").concat(t.toString())));const c={x:i},l={blockShape:t,paddings:n};return r.ENGINE.runKernel(a.SpaceToBatchND,c,l)}})},383366:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.sparseFillEmptyRows=void 0;var r=n(90337),a=n(536217),o=n(188695),s=n(930684);t.sparseFillEmptyRows=(0,s.op)({sparseFillEmptyRows_:function(e,t,n,s){const i=(0,o.convertToTensor)(e,"indices","sparseFillEmptyRows","int32"),c=(0,o.convertToTensor)(t,"values","sparseFillEmptyRows"),l=(0,o.convertToTensor)(n,"denseShape","sparseFillEmptyRows","int32"),u=(0,o.convertToTensor)(s,"defaultValue","sparseFillEmptyRows",c.dtype);if(2!==i.rank)throw new Error("Indices should be Tensor2D but received shape\n ".concat(i.shape));if(1!==c.rank)throw new Error("Values should be Tensor1D but received shape ".concat(c.shape));if(1!==l.rank)throw new Error("Dense shape should be Tensor1D but received shape ".concat(l.shape));if(0!==u.rank)throw new Error("Default value should be a scalar but received shape ".concat(u.shape));const d={indices:i,values:c,denseShape:l,defaultValue:u},p=r.ENGINE.runKernel(a.SparseFillEmptyRows,d);return{outputIndices:p[0],outputValues:p[1],emptyRowIndicator:p[2],reverseIndexMap:p[3]}}})},8263:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getSparseFillEmptyRowsIndicesDenseShapeMismatch=function(e){return"Received SparseTensor with denseShape[0] = 0 but\n indices.shape[0] = ".concat(e)},t.getSparseFillEmptyRowsNegativeIndexErrorMessage=function(e,t){return"indices(".concat(e,", 0) is invalid: ").concat(t," < 0")},t.getSparseFillEmptyRowsOutOfRangeIndexErrorMessage=function(e,t,n){return"indices(".concat(e,", 0) is invalid: ").concat(t," >= ").concat(n)}},84025:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.sparseReshape=void 0;var r=n(90337),a=n(536217),o=n(188695),s=n(930684);t.sparseReshape=(0,s.op)({sparseReshape_:function(e,t,n){const s=(0,o.convertToTensor)(e,"inputIndices","sparseReshape","int32"),i=(0,o.convertToTensor)(t,"inputShape","sparseReshape","int32"),c=(0,o.convertToTensor)(n,"newShape","sparseReshape","int32");if(2!==s.rank)throw new Error("Input indices should be Tensor2D but received shape\n ".concat(s.shape));if(1!==i.rank)throw new Error("Input shape should be Tensor1D but received shape ".concat(i.shape));if(1!==c.rank)throw new Error("New shape should be Tensor1D but received shape ".concat(c.shape));const l={inputIndices:s,inputShape:i,newShape:c},u=r.ENGINE.runKernel(a.SparseReshape,l);return{outputIndices:u[0],outputShape:u[1]}}})},965209:(e,t,n)=>{"use strict";
1Object.defineProperty(t,"__esModule",{value:!0}),t.getSparseReshapeEmptyTensorZeroOutputDimErrorMessage=function(){return"reshape cannot infer the missing input size for an empty tensor unless all specified input sizes are non-zero"},t.getSparseReshapeInputOutputMismatchErrorMessage=function(e,t){const n=(0,r.sizeFromShape)(e),a=(0,r.sizeFromShape)(t);return"Input to reshape is a tensor with ".concat(n," dense values, but the requested shape has ").concat(a,". inputShape=").concat(e," outputShape=").concat(t)},t.getSparseReshapeInputOutputMultipleErrorMessage=function(e,t){const n=(0,r.sizeFromShape)(e),a=(0,r.sizeFromShape)(t);return"Input to reshape is a SparseTensor with ".concat(n,"\n dense values, but the requested shape requires a multiple of ").concat(a,". inputShape=").concat(e," outputShape= ").concat(t)},t.getSparseReshapeMultipleNegativeOneOutputDimErrorMessage=function(e,t){return"only one output dimension may be -1, not both ".concat(e," and ").concat(t)},t.getSparseReshapeNegativeOutputDimErrorMessage=function(e,t){return"size ".concat(e," must be non-negative, not ").concat(t)};var r=n(904737)},494788:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.sparseSegmentMean=void 0;var r=n(90337),a=n(536217),o=n(188695),s=n(930684);t.sparseSegmentMean=(0,s.op)({sparseSegmentMean_:function(e,t,n){const s=(0,o.convertToTensor)(e,"data","sparseSegmentMean"),i=(0,o.convertToTensor)(t,"indices","sparseSegmentMean","int32"),c=(0,o.convertToTensor)(n,"segmentIds","sparseSegmentMean","int32");if(s.rank<1)throw new Error("Data should be at least 1 dimensional but received scalar");if(1!==i.rank)throw new Error("Indices should be Tensor1D but received shape\n ".concat(i.shape));if(1!==c.rank)throw new Error("Segment ids should be Tensor1D but received shape\n ".concat(c.shape));const l={data:s,indices:i,segmentIds:c};return r.ENGINE.runKernel(a.SparseSegmentMean,l)}})},206762:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getSparseSegmentReductionIndicesOutOfRangeErrorMessage=function(e,t,n){return"Bad: indices[".concat(e,"] == ").concat(t," out of range [0, ").concat(n,")")},t.getSparseSegmentReductionNegativeSegmentIdsErrorMessage=function(){return"segment ids must be >= 0"},t.getSparseSegmentReductionNonIncreasingSegmentIdsErrorMessage=function(){return"segment ids are not increasing"},t.getSparseSegmentReductionSegmentIdOutOfRangeErrorMessage=function(e,t){return"Segment id ".concat(e," out of range [0, ").concat(t,"), possibly because segmentIds input is not sorted.")}},979439:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.sparseSegmentSum=void 0;var r=n(90337),a=n(536217),o=n(188695),s=n(930684);t.sparseSegmentSum=(0,s.op)({sparseSegmentSum_:function(e,t,n){const s=(0,o.convertToTensor)(e,"data","sparseSegmentSum"),i=(0,o.convertToTensor)(t,"indices","sparseSegmentSum","int32"),c=(0,o.convertToTensor)(n,"segmentIds","sparseSegmentSum","int32");if(s.rank<1)throw new Error("Data should be at least 1 dimensional but received scalar");if(1!==i.rank)throw new Error("Indices should be Tensor1D but received shape\n ".concat(i.shape));if(1!==c.rank)throw new Error("Segment ids should be Tensor1D but received shape\n ".concat(c.shape));const l={data:s,indices:i,segmentIds:c};return r.ENGINE.runKernel(a.SparseSegmentSum,l)}})},270332:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.sparseToDense=void 0;var r=n(90337),a=n(536217),o=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=c(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if("default"!==o&&{}.hasOwnProperty.call(e,o)){var s=a?Object.getOwnPropertyDescriptor(e,o):null;s&&(s.get||s.set)?Object.defineProperty(r,o,s):r[o]=e[o]}return r.default=e,n&&n.set(e,r),r}(n(921913)),s=n(188695),i=n(930684);function c(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(c=function(e){return e?n:t})(e)}t.sparseToDense=(0,i.op)({sparseToDense_:function(e,t,n){let i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;const c=(0,s.convertToTensor)(e,"sparseIndices","sparseToDense","int32"),l=(0,s.c
1onvertToTensor)(t,"sparseValues","sparseToDense"),u=(0,s.convertToTensor)(i,"defaultValue","sparseToDense",l.dtype);o.validateInput(c,l,n,u);const d={sparseIndices:c,sparseValues:l,defaultValue:u},p={outputShape:n};return r.ENGINE.runKernel(a.SparseToDense,d,p)}})},921913:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.validateInput=function(e,t,n,r){if("int32"!==e.dtype)throw new Error("tf.sparseToDense() expects the indices to be int32 type,"+" but the dtype was ".concat(e.dtype,"."));if(e.rank>2)throw new Error("sparseIndices should be a scalar, vector, or matrix,"+" but got shape ".concat(e.shape,"."));const a=e.rank>0?e.shape[0]:1,o=e.rank>1?e.shape[1]:1;if(n.length!==o)throw new Error("outputShape has incorrect number of elements:,"+" ".concat(n.length,", should be: ").concat(o,"."));const s=t.size;if(0!==t.rank&&(1!==t.rank||s!==a))throw new Error("sparseValues has incorrect shape "+"".concat(t.shape,", should be [] or [").concat(a,"]"));if(t.dtype!==r.dtype)throw new Error("sparseValues.dtype must match defaultValues.dtype")}},427645:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.fft=void 0;var r=n(90337),a=n(536217),o=n(904737),s=n(930684);t.fft=(0,s.op)({fft_:function(e){(0,o.assert)("complex64"===e.dtype,(()=>"The dtype for tf.spectral.fft() must be complex64 "+"but got ".concat(e.dtype,".")));const t={input:e};return r.ENGINE.runKernel(a.FFT,t)}})},286674:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ifft=void 0;var r=n(90337),a=n(536217),o=n(904737),s=n(930684);t.ifft=(0,s.op)({ifft_:function(e){(0,o.assert)("complex64"===e.dtype,(()=>"The dtype for tf.spectral.ifft() must be complex64 "+"but got ".concat(e.dtype,".")));const t={input:e};return r.ENGINE.runKernel(a.IFFT,t)}})},966381:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.irfft=void 0;var r=n(291158),a=n(55108),o=n(687356),s=n(295702),i=n(930684),c=n(562651),l=n(195476),u=n(790767),d=n(454179),p=n(247565),h=n(286674);t.irfft=(0,i.op)({irfft_:function(e){const t=e.shape[e.shape.length-1],n=e.size/t;let i;if(t<=2){const r=(0,l.reshape)(e,[n,t]);i=(0,h.ifft)(r)}else{const f=[n,2*(t-1)],m=(0,l.reshape)((0,c.real)(e),[n,t]),g=(0,l.reshape)((0,o.imag)(e),[n,t]),y=(0,u.reverse)((0,p.slice)(m,[0,1],[n,t-2]),1),v=(0,s.mul)((0,u.reverse)((0,p.slice)(g,[0,1],[n,t-2]),1),(0,d.scalar)(-1)),b=(0,a.concat)([m,y],1),x=(0,a.concat)([g,v],1),w=(0,l.reshape)((0,r.complex)(b,x),[f[0],f[1]]);i=(0,h.ifft)(w)}if(i=(0,c.real)(i),3===e.rank&&0!==e.shape[0]){const t=i,n=e.shape[0];i=(0,l.reshape)(i,[n,i.shape[0]/n,i.shape[1]]),t.dispose()}return i}})},269663:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.rfft=void 0;var r=n(904737),a=n(291158),o=n(55108),s=n(687356),i=n(930684),c=n(562651),l=n(195476),u=n(247565),d=n(422194),p=n(627896),h=n(166119),f=n(427645);t.rfft=(0,i.op)({rfft_:function(e,t){(0,r.assert)("float32"===e.dtype,(()=>"The dtype for rfft() must be real value but got ".concat(e.dtype)));let n=e.shape[e.shape.length-1];const i=e.size/n;let m;if(null!=t&&t<n){const r=e.shape.map((e=>0)),a=e.shape.map((e=>e));a[e.shape.length-1]=t,m=(0,u.slice)(e,r,a),n=t}else if(null!=t&&t>n){const r=e.shape.map((e=>e));r[e.shape.length-1]=t-n,m=(0,o.concat)([e,(0,p.zeros)(r)],e.shape.length-1),n=t}else m=e;const g=(0,h.zerosLike)(m),y=(0,l.reshape)((0,a.complex)(m,g),[i,n]),v=(0,f.fft)(y),b=Math.floor(n/2)+1,x=(0,c.real)(v),w=(0,s.imag)(v),k=(0,d.split)(x,[b,n-b],x.shape.length-1),_=(0,d.split)(w,[b,n-b],w.shape.length-1),C=m.shape.slice();return C[m.shape.length-1]=b,(0,l.reshape)((0,a.complex)(k[0],_[0]),C)}})},422194:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.split=void 0;var r=n(90337),a=n(536217),o=n(188695),s=n(930684);t.split=(0,s.op)({split_:function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;const s={x:(0,o.convertToTensor)(e,"x","split")},i={numOrSizeSplits:t,axis:n};return r.ENGINE.runKernel(a.SplitV,s,i)}})},746225:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.prepareSplitSize=function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,a=[];if("number"==typeof t)(0,r.assert)(e.shape[n]%t==0,(()=>"Number of splits must evenly divide the axis.")),a=new Array(t).fill(e.shape[n]/t);else{const o=t.reduce(((e,t)=>(-1===t&&(e+=1),e)),0);(0,r.assert)(o<=1,(()=>"There should be only one negative value in split array."));const s=t.indexOf(-1);if(-1!==s){const r=t.reduce(((e,t)=>t>0?e+t:e));t[s]=e.shape[n]-r}(0,r.assert)(e.shape[n]===t.reduce(((e,t)=>e+t)),(()=>"The sum of sizes must match the size of the axis dimension.")),a=t}return a};var r=n(904737)}
1,435438:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.sqrt=void 0;var r=n(90337),a=n(536217),o=n(188695),s=n(930684);t.sqrt=(0,s.op)({sqrt_:function(e){const t={x:(0,o.convertToTensor)(e,"x","sqrt","float32")};return r.ENGINE.runKernel(a.Sqrt,t)}})},985987:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.square=void 0;var r=n(90337),a=n(188695),o=n(930684);t.square=(0,o.op)({square_:function(e){const t=(0,a.convertToTensor)(e,"x","square");return r.ENGINE.runKernel("Square",{x:t},{})}})},555593:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.squaredDifference=void 0;var r=n(90337),a=n(536217),o=n(390771),s=n(188695),i=n(534779),c=n(930684);t.squaredDifference=(0,c.op)({squaredDifference_:function(e,t){let n=(0,s.convertToTensor)(e,"a","squaredDifference"),c=(0,s.convertToTensor)(t,"b","squaredDifference");[n,c]=(0,o.makeTypesMatch)(n,c),(0,i.assertAndGetBroadcastShape)(n.shape,c.shape);const l={a:n,b:c};return r.ENGINE.runKernel(a.SquaredDifference,l,{})}})},714313:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.squeeze=void 0;var r=n(188695),a=n(904737),o=n(930684),s=n(195476);t.squeeze=(0,o.op)({squeeze_:function(e,t){const n=(0,r.convertToTensor)(e,"x","squeeze");return(0,s.reshape)(n,(0,a.squeezeShape)(n.shape,t).newShape)}})},421637:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.stack=void 0;var r=n(90337),a=n(536217),o=n(188695),s=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=c(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if("default"!==o&&{}.hasOwnProperty.call(e,o)){var s=a?Object.getOwnPropertyDescriptor(e,o):null;s&&(s.get||s.set)?Object.defineProperty(r,o,s):r[o]=e[o]}return r.default=e,n&&n.set(e,r),r}(n(904737)),i=n(930684);function c(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(c=function(e){return e?n:t})(e)}t.stack=(0,i.op)({stack_:function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;const n=(0,o.convertToTensorArray)(e,"tensors","stack","string_or_numeric");s.assert(n.length>=1,(()=>"Pass at least one tensor to tf.stack")),n.length>0&&s.assert(t<=n[0].rank,(()=>"Axis must be <= rank of the tensor"));const i=n,c={axis:t};return r.ENGINE.runKernel(a.Pack,i,c)}})},622741:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.step=void 0;var r=n(90337),a=n(536217),o=n(188695),s=n(930684);t.step=(0,s.op)({step_:function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;const n={x:(0,o.convertToTensor)(e,"x","step")},s={alpha:t};return r.ENGINE.runKernel(a.Step,n,s)}})},548749:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.stridedSlice=void 0;var r=n(90337),a=n(536217),o=n(188695),s=n(930684);t.stridedSlice=(0,s.op)({stridedSlice_:function(e,t,n,s){let i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0,c=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,l=arguments.length>6&&void 0!==arguments[6]?arguments[6]:0,u=arguments.length>7&&void 0!==arguments[7]?arguments[7]:0,d=arguments.length>8&&void 0!==arguments[8]?arguments[8]:0;const p={x:(0,o.convertToTensor)(e,"x","stridedSlice","string_or_numeric")},h={begin:t,end:n,strides:s,beginMask:i,endMask:c,ellipsisMask:l,newAxisMask:u,shrinkAxisMask:d};return r.ENGINE.runKernel(a.StridedSlice,p,h)}})},527032:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.stringNGrams=void 0;var r=n(90337),a=n(536217),o=n(188695),s=n(930684);t.stringNGrams=(0,s.op)({stringNGrams_:function(e,t,n,s,i,c,l,u){const d=(0,o.convertToTensor)(e,"data","stringNGrams","string");if("string"!==d.dtype)throw new Error("Data must be of datatype string");if(1!==d.shape.length)throw new Error("Data must be a vector, saw: ".concat(d.shape));const p=(0,o.convertToTensor)(t,"dataSplits","stringNGrams");if("int32"!==p.dtype)throw new Error("Data splits must be of datatype int32");
1const h={separator:n,nGramWidths:s,leftPad:i,rightPad:c,padWidth:l,preserveShortSequences:u},f={data:d,dataSplits:p},m=r.ENGINE.runKernel(a.StringNGrams,f,h);return{nGrams:m[0],nGramsSplits:m[1]}}})},493794:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.stringSplit=void 0;var r=n(90337),a=n(536217),o=n(188695),s=n(930684);t.stringSplit=(0,s.op)({stringSplit_:function(e,t){let n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];const s=(0,o.convertToTensor)(e,"input","stringSplit","string"),i=(0,o.convertToTensor)(t,"delimiter","stringSplit","string");if(1!==s.rank)throw new Error("Input should be Tensor1D but received shape ".concat(s.shape));if(0!==i.rank)throw new Error("Delimiter should be a scalar but received shape ".concat(i.shape));const c={skipEmpty:n},l={input:s,delimiter:i},u=r.ENGINE.runKernel(a.StringSplit,l,c);return{indices:u[0],values:u[1],shape:u[2]}}})},279490:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.stringToHashBucketFast=void 0;var r=n(90337),a=n(536217),o=n(188695),s=n(930684);t.stringToHashBucketFast=(0,s.op)({stringToHashBucketFast_:function(e,t){const n=(0,o.convertToTensor)(e,"input","stringToHashBucketFast","string"),s={numBuckets:t};if(t<=0)throw new Error("Number of buckets must be at least 1");const i={input:n};return r.ENGINE.runKernel(a.StringToHashBucketFast,i,s)}})},702222:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.sub=void 0;var r=n(90337),a=n(536217),o=n(390771),s=n(188695),i=n(930684);t.sub=(0,i.op)({sub_:function(e,t){let n=(0,s.convertToTensor)(e,"a","sub"),i=(0,s.convertToTensor)(t,"b","sub");[n,i]=(0,o.makeTypesMatch)(n,i);const c={a:n,b:i};return r.ENGINE.runKernel(a.Sub,c)}})},450126:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.sum=void 0;var r=n(90337),a=n(536217),o=n(188695),s=n(386565),i=n(930684);t.sum=(0,i.op)({sum_:function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],i=(0,o.convertToTensor)(e,"x","sum");"bool"===i.dtype&&(i=(0,s.cast)(i,"int32"));const c={x:i},l={axis:t,keepDims:n};return r.ENGINE.runKernel(a.Sum,c,l)}})},452157:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.tan=void 0;var r=n(90337),a=n(536217),o=n(188695),s=n(930684);t.tan=(0,s.op)({tan_:function(e){const t={x:(0,o.convertToTensor)(e,"x","tan","float32")};return r.ENGINE.runKernel(a.Tan,t)}})},200178:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.tanh=void 0;var r=n(90337),a=n(536217),o=n(188695),s=n(930684);t.tanh=(0,s.op)({tanh_:function(e){const t={x:(0,o.convertToTensor)(e,"x","tanh","float32")};return r.ENGINE.runKernel(a.Tanh,t)}})},995448:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.tensor=function(e,t,n){const o=(0,r.inferShape)(e,n);return(0,a.makeTensor)(e,t,o,n)};var r=n(188695),a=n(737816)},724546:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.tensor1d=function(e,t){(0,a.assertNonNull)(e);const n=(0,r.inferShape)(e,t);if(1!==n.length)throw new Error("tensor1d() requires values to be a flat/TypedArray");return(0,o.makeTensor)(e,null,n,t)};var r=n(188695),a=n(904737),o=n(737816)},716914:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.tensor2d=function(e,t,n){if((0,a.assertNonNull)(e),null!=t&&2!==t.length)throw new Error("tensor2d() requires shape to have two numbers");const s=(0,r.inferShape)(e,n);if(2!==s.length&&1!==s.length)throw new Error("tensor2d() requires values to be number[][] or flat/TypedArray");if(1===s.length&&null==t)throw new Error("tensor2d() requires shape to be provided when `values` are a flat/TypedArray");return(0,o.makeTensor)(e,t,s,n)};var r=n(188695),a=n(904737),o=n(737816)},459447:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.tensor3d=function(e,t,n){if((0,a.assertNonNull)(e),null!=t&&3!==t.length)throw new Error("tensor3d() requires shape to have three numbers");const s=(0,r.inferShape)(e,n);if(3!==s.length&&1!==s.length)throw new Error("tensor3d() requires values to be number[][][] or flat/TypedArray");if(1===s.length&&null==t)throw new Error("tensor3d() requires shape to be provided when `values` are a flat array");return(0,o.makeTensor)(e,t,s,n)};var r=n(188695),a=n(904737),o=n(737816)}
1,132639:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.tensor4d=function(e,t,n){if((0,a.assertNonNull)(e),null!=t&&4!==t.length)throw new Error("tensor4d() requires shape to have four numbers");const s=(0,r.inferShape)(e,n);if(4!==s.length&&1!==s.length)throw new Error("tensor4d() requires values to be number[][][][] or flat/TypedArray");if(1===s.length&&null==t)throw new Error("tensor4d() requires shape to be provided when `values` are a flat array");return(0,o.makeTensor)(e,t,s,n)};var r=n(188695),a=n(904737),o=n(737816)},679316:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.tensor5d=function(e,t,n){if((0,a.assertNonNull)(e),null!=t&&5!==t.length)throw new Error("tensor5d() requires shape to have five numbers");const s=(0,r.inferShape)(e,n);if(5!==s.length&&1!==s.length)throw new Error("tensor5d() requires values to be number[][][][][] or flat/TypedArray");if(1===s.length&&null==t)throw new Error("tensor5d() requires shape to be provided when `values` are a flat array");return(0,o.makeTensor)(e,t,s,n)};var r=n(188695),a=n(904737),o=n(737816)},295546:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.tensor6d=function(e,t,n){if((0,a.assertNonNull)(e),null!=t&&6!==t.length)throw new Error("tensor6d() requires shape to have six numbers");const s=(0,r.inferShape)(e,n);if(6!==s.length&&1!==s.length)throw new Error("tensor6d() requires values to be number[][][][][][] or flat/TypedArray");if(1===s.length&&null==t)throw new Error("tensor6d() requires shape to be provided when `values` are a flat array");return t=t||s,(0,o.makeTensor)(e,t,s,n)};var r=n(188695),a=n(904737),o=n(737816)},737816:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.makeTensor=function(e,t,n,o){null==o&&(o=(0,a.inferDtype)(e));if("complex64"===o)throw new Error("Cannot construct a complex64 tensor directly. Please use tf.complex(real, imag).");if(!(0,a.isTypedArray)(e)&&!Array.isArray(e)&&"number"!=typeof e&&"boolean"!=typeof e&&"string"!=typeof e)throw new Error("values passed to tensor(values) must be a number/boolean/string or an array of numbers/booleans/strings, or a TypedArray");if(null!=t){(0,a.assertNonNegativeIntegerDimensions)(t);const e=(0,a.sizeFromShape)(t),r=(0,a.sizeFromShape)(n);(0,a.assert)(e===r,(()=>"Based on the provided shape, [".concat(t,"], the tensor should have ")+"".concat(e," values but has ").concat(r)));for(let e=0;e<n.length;++e){const r=n[e],o=e!==n.length-1||r!==(0,a.sizeFromShape)(t.slice(e));(0,a.assert)(n[e]===t[e]||!o,(()=>"Error creating a new Tensor. Inferred shape "+"(".concat(n,") does not match the provided ")+"shape (".concat(t,"). ")))}}(0,a.isTypedArray)(e)||Array.isArray(e)||(e=[e]);return t=t||n,e="string"!==o?(0,a.toTypedArray)(e,o):(0,a.flatten)(e,[],!0),r.ENGINE.makeTensor(e,t,o)};var r=n(90337),a=n(904737)},134987:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.tile=void 0;var r=n(90337),a=n(536217),o=n(188695),s=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=c(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if("default"!==o&&{}.hasOwnProperty.call(e,o)){var s=a?Object.getOwnPropertyDescriptor(e,o):null;s&&(s.get||s.set)?Object.defineProperty(r,o,s):r[o]=e[o]}return r.default=e,n&&n.set(e,r),r}(n(904737)),i=n(930684);function c(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(c=function(e){return e?n:t})(e)}t.tile=(0,i.op)({tile_:function(e,t){const n=(0,o.convertToTensor)(e,"x","tile","string_or_numeric");s.assert(n.rank===t.length,(()=>"Error in transpose: rank of input ".concat(n.rank," ")+"must match length of reps ".concat(t,".")));const i={x:n},c={reps:t};return r.ENGINE.runKernel(a.Tile,i,c)}})},833426:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.topk=void 0;var r=n(90337),a=n(536217),o=n(188695),s=n(930684);t.topk=(0,s.op)({topk_:function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];const s=(0,o.convertToTensor)(e,"x","topk");
1if(0===s.rank)throw new Error("topk() expects the input to be of rank 1 or higher");const i=s.shape[s.shape.length-1];if(t<0)throw new Error("'k' passed to topk() must be >= 0 but got ".concat(t));if(t>i)throw new Error("'k' passed to topk() must be <= the last dimension (".concat(i,") ")+"but got ".concat(t));const c={x:s},l={k:t,sorted:n},[u,d]=r.ENGINE.runKernel(a.TopK,c,l);return{values:u,indices:d}}})},688129:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.transpose=void 0;var r=n(90337),a=n(536217),o=n(188695),s=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=c(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if("default"!==o&&{}.hasOwnProperty.call(e,o)){var s=a?Object.getOwnPropertyDescriptor(e,o):null;s&&(s.get||s.set)?Object.defineProperty(r,o,s):r[o]=e[o]}return r.default=e,n&&n.set(e,r),r}(n(904737)),i=n(930684);function c(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(c=function(e){return e?n:t})(e)}t.transpose=(0,i.op)({transpose_:function(e,t){const n=(0,o.convertToTensor)(e,"x","transpose");if(null==t&&(t=n.shape.map(((e,t)=>t)).reverse()),s.assert(n.rank===t.length,(()=>"Error in transpose: rank of input ".concat(n.rank," ")+"must match length of perm ".concat(t,"."))),t.forEach((e=>{s.assert(e>=0&&e<n.rank,(()=>"All entries in 'perm' must be between 0 and ".concat(n.rank-1)+" but got ".concat(t)))})),n.rank<=1)return n.clone();const i={x:n},c={perm:t};return r.ENGINE.runKernel(a.Transpose,i,c)}})},992684:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.truncatedNormal=void 0;var r=n(60249),a=n(930684),o=n(937827);t.truncatedNormal=(0,a.op)({truncatedNormal_:function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,a=arguments.length>3?arguments[3]:void 0,s=arguments.length>4?arguments[4]:void 0;if(null!=a&&"bool"===a)throw new Error("Unsupported data type $ { dtype }");const i=new o.MPRandGauss(t,n,a,!0,s),c=(0,r.buffer)(e,a);for(let e=0;e<c.values.length;e++)c.values[e]=i.nextValue();return c.toTensor()}})},657797:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.unique=void 0;var r=n(90337),a=n(536217),o=n(188695),s=n(904737),i=n(930684);t.unique=(0,i.op)({unique_:function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;const n=(0,o.convertToTensor)(e,"x","unique","string_or_numeric");(0,s.assert)(n.rank>0,(()=>"The input tensor must be at least 1D"));const i={x:n},c={axis:t},[l,u]=r.ENGINE.runKernel(a.Unique,i,c);return{values:l,indices:u}}})},421418:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.unsortedSegmentSum=void 0;var r=n(90337),a=n(536217),o=n(188695),s=n(904737),i=n(930684);t.unsortedSegmentSum=(0,i.op)({unsortedSegmentSum_:function(e,t,n){const i=(0,o.convertToTensor)(e,"x","unsortedSegmentSum"),c=(0,o.convertToTensor)(t,"segmentIds","unsortedSegmentSum","int32");(0,s.assert)((0,s.isInt)(n),(()=>"numSegments must be of dtype int"));const l={x:i,segmentIds:c},u={numSegments:n};return r.ENGINE.runKernel(a.UnsortedSegmentSum,l,u)}})},922064:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.unstack=void 0;var r=n(90337),a=n(536217),o=n(188695),s=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=c(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if("default"!==o&&{}.hasOwnProperty.call(e,o)){var s=a?Object.getOwnPropertyDescriptor(e,o):null;s&&(s.get||s.set)?Object.defineProperty(r,o,s):r[o]=e[o]}return r.default=e,n&&n.set(e,r),r}(n(904737)),i=n(930684);function c(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(c=function(e){return e?n:t})(e)}t.unstack=(0,i.op)({unstack_:function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;const n=(0,o.convertToTensor)(e,"x","unstack","string_or_numeric");s.assert(t>=-n.shape.length&&t<n.shape.length,(()=>"Axis = ".concat(t," is not in [-").concat(n.shape.length,", ").concat(n.shape.length,")")));const i={value:n},c={axis:t};return r.ENGINE.runKernel(a.Unpack,i,c)}})},259976:(e,t,n)=>{"use strict";
1Object.defineProperty(t,"__esModule",{value:!0}),t.variable=function(e){let t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n=arguments.length>2?arguments[2]:void 0,a=arguments.length>3?arguments[3]:void 0;return r.ENGINE.makeVariable(e,t,n,a)};var r=n(90337)},376131:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.where=void 0;var r=n(90337),a=n(536217),o=n(188695),s=n(465581),i=n(534779),c=n(930684);t.where=(0,c.op)({where_:function(e,t,n){const c=(0,o.convertToTensor)(t,"a","where"),l=(0,o.convertToTensor)(n,"b","where"),u=(0,o.convertToTensor)(e,"condition","where","bool"),d=(0,i.assertAndGetBroadcastShape)((0,i.assertAndGetBroadcastShape)(u.shape,c.shape),l.shape),p={condition:(0,s.broadcastTo)(u,d),t:(0,s.broadcastTo)(c,d),e:(0,s.broadcastTo)(l,d)};return r.ENGINE.runKernel(a.Select,p)}})},16814:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.whereAsync=void 0;var r=n(6764),a=n(188695);t.whereAsync=async function(e){const t=(0,a.convertToTensor)(e,"condition","whereAsync","bool"),n=await t.data(),o=(0,r.whereImpl)(t.shape,n);
1return e!==t&&t.dispose(),o}},627896:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.zeros=function e(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"float32";if("complex64"===n){const n=e(t,"float32"),r=e(t,"float32");return(0,o.complex)(n,r)}const s=(0,a.makeZerosTypedArray)((0,a.sizeFromShape)(t),n);return r.ENGINE.makeTensor(s,t,n)};var r=n(90337),a=n(904737),o=n(291158)},166119:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.zerosLike=void 0;var r=n(90337),a=n(536217),o=n(188695),s=n(930684);t.zerosLike=(0,s.op)({zerosLike_:function(e){const t={x:(0,o.convertToTensor)(e,"x","zerosLike")};return r.ENGINE.runKernel(a.ZerosLike,t)}})},538885:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.AdadeltaOptimizer=void 0;var r=n(90337),a=n(271725),o=n(353632),s=n(67282),i=n(295702),c=n(899090),l=n(985987),u=n(166119),d=n(39037),p=n(524823);class h extends p.Optimizer{constructor(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;super(),this.learningRate=e,this.rho=t,this.epsilon=n,this.accumulatedGrads=[],this.accumulatedUpdates=[],null==n&&(this.epsilon=r.ENGINE.backend.epsilon())}applyGradients(e){(Array.isArray(e)?e.map((e=>e.name)):Object.keys(e)).forEach(((t,n)=>{const d=r.ENGINE.registeredVariables[t],p=!1;null==this.accumulatedGrads[n]&&(this.accumulatedGrads[n]={originalName:"".concat(t,"/accum_grad"),variable:(0,a.tidy)((()=>(0,u.zerosLike)(d).variable(p)))}),null==this.accumulatedUpdates[n]&&(this.accumulatedUpdates[n]={originalName:"".concat(t,"/accum_var"),variable:(0,a.tidy)((()=>(0,u.zerosLike)(d).variable(p)))});const h=Array.isArray(e)?e[n].tensor:e[t];if(null==h)return;const f=this.accumulatedGrads[n].variable,m=this.accumulatedUpdates[n].variable;(0,a.tidy)((()=>{const e=(0,o.add)((0,i.mul)(f,this.rho),(0,i.mul)((0,l.square)(h),1-this.rho)),t=(0,i.mul)((0,s.div)((0,c.sqrt)((0,o.add)(m,this.epsilon)),(0,c.sqrt)((0,o.add)(f,this.epsilon))),h),n=(0,o.add)((0,i.mul)(m,this.rho),(0,i.mul)((0,l.square)(t),1-this.rho));f.assign(e),m.assign(n);const r=(0,o.add)((0,i.mul)(t,-this.learningRate),d);d.assign(r)}))})),this.incrementIterations()}dispose(){null!=this.accumulatedUpdates&&((0,a.dispose)(this.accumulatedGrads.map((e=>e.variable))),(0,a.dispose)(this.accumulatedUpdates.map((e=>e.variable))))}async getWeights(){const e=[...this.accumulatedGrads,...this.accumulatedUpdates];return[await this.saveIterations()].concat(e.map((e=>({name:e.originalName,tensor:e.variable}))))}async setWeights(e){const t=(e=await this.extractIterations(e)).length/2,n=!1;this.accumulatedGrads=e.slice(0,t).map((e=>({originalName:e.name,variable:e.tensor.variable(n)}))),this.accumulatedUpdates=e.slice(t,2*t).map((e=>({originalName:e.name,variable:e.tensor.variable(n)})))}getConfig(){return{learningRate:this.learningRate,rho:this.rho,epsilon:this.epsilon}}static fromConfig(e,t){return new e(t.learningRate,t.rho,t.epsilon)}}t.AdadeltaOptimizer=h,h.className="Adadelta",(0,d.registerClass)(h)},499678:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.AdagradOptimizer=void 0;var r=n(90337),a=n(271725),o=n(353632),s=n(67282),i=n(970061),c=n(295702),l=n(435438),u=n(985987),d=n(39037),p=n(524823);class h extends p.Optimizer{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:.1;super(),this.learningRate=e,this.initialAccumulatorValue=t,this.accumulatedGrads=[]}applyGradients(e){(Array.isArray(e)?e.map((e=>e.name)):Object.keys(e)).forEach(((t,n)=>{const d=r.ENGINE.registeredVariables[t];if(null==this.accumulatedGrads[n]){const e=!1;this.accumulatedGrads[n]={originalName:"".concat(t,"/accumulator"),variable:(0,a.tidy)((()=>(0,i.fill)(d.shape,this.initialAccumulatorValue).variable(e)))}}const p=Array.isArray(e)?e[n].tensor:e[t];if(null==p)return;const h=this.accumulatedGrads[n].variable;(0,a.tidy)((()=>{const e=(0,o.add)(h,(0,u.square)(p));h.assign(e);const t=(0,o.add)((0,c.mul)((0,s.div)(p,(0,l.sqrt)((0,o.add)(e,r.ENGINE.backend.epsilon()))),-this.learningRate),d);d.assign(t)}))})),this.incrementIterations()}dispose(){null!=this.accumulatedGrads&&(0,a.dispose)(this.accumulatedGrads.map((e=>e.variable)))}async getWeights(){return[await this.saveIterations()].concat(this.accumulatedGrads.map((e=>({name:e.originalName,tensor:e.variable}
1))))}async setWeights(e){e=await this.extractIterations(e);this.accumulatedGrads=e.map((e=>({originalName:e.name,variable:e.tensor.variable(false)})))}getConfig(){return{learningRate:this.learningRate,initialAccumulatorValue:this.initialAccumulatorValue}}static fromConfig(e,t){return new e(t.learningRate,t.initialAccumulatorValue)}}t.AdagradOptimizer=h,h.className="Adagrad",(0,d.registerClass)(h)},947007:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.AdamOptimizer=void 0;var r=n(90337),a=n(271725),o=n(353632),s=n(67282),i=n(295702),c=n(216556),l=n(454179),u=n(435438),d=n(985987),p=n(702222),h=n(166119),f=n(39037),m=n(524823);class g extends m.Optimizer{constructor(e,t,n){let o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;super(),this.learningRate=e,this.beta1=t,this.beta2=n,this.epsilon=o,this.accumulatedFirstMoment=[],this.accumulatedSecondMoment=[],(0,a.tidy)((()=>{this.accBeta1=(0,l.scalar)(t).variable(),this.accBeta2=(0,l.scalar)(n).variable()})),null==o&&(this.epsilon=r.ENGINE.backend.epsilon())}applyGradients(e){const t=Array.isArray(e)?e.map((e=>e.name)):Object.keys(e);(0,a.tidy)((()=>{const n=(0,p.sub)(1,this.accBeta1),c=(0,p.sub)(1,this.accBeta2);t.forEach(((t,l)=>{const p=r.ENGINE.registeredVariables[t],f=!1;null==this.accumulatedFirstMoment[l]&&(this.accumulatedFirstMoment[l]={originalName:"".concat(t,"/m"),variable:(0,a.tidy)((()=>(0,h.zerosLike)(p).variable(f)))}),null==this.accumulatedSecondMoment[l]&&(this.accumulatedSecondMoment[l]={originalName:"".concat(t,"/v"),variable:(0,a.tidy)((()=>(0,h.zerosLike)(p).variable(f)))});const m=Array.isArray(e)?e[l].tensor:e[t];if(null==m)return;const g=this.accumulatedFirstMoment[l].variable,y=this.accumulatedSecondMoment[l].variable,v=(0,o.add)((0,i.mul)(g,this.beta1),(0,i.mul)(m,1-this.beta1)),b=(0,o.add)((0,i.mul)(y,this.beta2),(0,i.mul)((0,d.square)(m),1-this.beta2)),x=(0,s.div)(v,n),w=(0,s.div)(b,c);g.assign(v),y.assign(b);const k=(0,o.add)((0,i.mul)((0,s.div)(x,(0,o.add)((0,u.sqrt)(w),this.epsilon)),-this.learningRate),p);p.assign(k)})),this.accBeta1.assign((0,i.mul)(this.accBeta1,this.beta1)),this.accBeta2.assign((0,i.mul)(this.accBeta2,this.beta2))})),this.incrementIterations()}dispose(){this.accBeta1.dispose(),this.accBeta2.dispose(),null!=this.accumulatedFirstMoment&&(0,a.dispose)(this.accumulatedFirstMoment.map((e=>e.variable))),null!=this.accumulatedSecondMoment&&(0,a.dispose)(this.accumulatedSecondMoment.map((e=>e.variable)))}async getWeights(){const e=[...this.accumulatedFirstMoment,...this.accumulatedSecondMoment];return[await this.saveIterations()].concat(e.map((e=>({name:e.originalName,tensor:e.variable}))))}async setWeights(e){e=await this.extractIterations(e),(0,a.tidy)((()=>{this.accBeta1.assign((0,c.pow)(this.beta1,this.iterations_+1)),this.accBeta2.assign((0,c.pow)(this.beta2,this.iterations_+1))}));const t=e.length/2,n=!1;this.accumulatedFirstMoment=e.slice(0,t).map((e=>({originalName:e.name,variable:e.tensor.variable(n)}))),this.accumulatedSecondMoment=e.slice(t,2*t).map((e=>({originalName:e.name,variable:e.tensor.variable(n)})))}getConfig(){return{learningRate:this.learningRate,beta1:this.beta1,beta2:this.beta2,epsilon:this.epsilon}}static fromConfig(e,t){return new e(t.learningRate,t.beta1,t.beta2,t.epsilon)}}t.AdamOptimizer=g,g.className="Adam",(0,f.registerClass)(g)},119673:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.AdamaxOptimizer=void 0;var r=n(90337),a=n(271725),o=n(438415),s=n(353632),i=n(67282),c=n(720036),l=n(295702),u=n(454179),d=n(702222),p=n(166119),h=n(39037),f=n(524823);class m extends f.Optimizer{constructor(e,t,n){let o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;super(),this.learningRate=e,this.beta1=t,this.beta2=n,this.epsilon=o,this.decay=s,this.accumulatedFirstMoment=[],this.accumulatedWeightedInfNorm=[],(0,a.tidy)((()=>{this.iteration=(0,u.scalar)(0).variable(),this.accBeta1=(0,u.scalar)(t).variable()})),null==o&&(this.epsilon=r.ENGINE.backend.epsilon())}applyGradients(e){const t=Array.isArray(e)?e.map((e=>e.name)):Object.keys(e);(0,a.tidy)((()=>{const n=(0,d.sub)(1,this.accBeta1),a=(0,i.div)(-this.learningRate,(0,s.add)((0,l.mul)(this.iteration,this.decay),1));t.forEach(((t,u)=>{const d=r.ENGINE.registeredVariables[t],h=!1;null==this.accumulatedFirstMoment[u]&&(this.accumulatedFirstMoment[u]={originalName:"".concat(t,"/m"),variable:(0,p.zerosLike)(d).variable(h)}),null==this.accumulatedWeightedInfNorm[u]&&(this.accumulatedWeightedInfNorm[u]={originalName:"".concat(t,"/v"),variable:(0,p.zerosLike)(d).variable(h)});const f=Array.isArray(e)?e[u].tensor:e[t];if(null==f)return;const m=this.accumulatedFirstMoment[u].variable,g=this.accumulatedWeightedInfNorm[u].variable,y=(0,s.add)((0,l.mul)(m,this.beta1),(0,l.mul)(f,1-this.beta1)),v=(0,l.mul)(g,this.beta2),b=(0,o.abs)(f),x=(0,c.maximum)(v,b);m.assign(y),g.assign(x);const w=(0,s.add)((0,l.mul)((0,i.div)(a,n),(0,i.div)(y,(0,s.add)(x,this.epsilon))),d);d.assign(w)})),this.iteration.assign((0,s.add)(this.iteration,1)),this.accBeta1.assign((0,l.mul)(this.accBeta1,this.beta1))})),this.incrementIterations()}dispose(){this.accBeta1.dispose(),this.iteration.dispose(),null!=this.accumulatedFirstMoment&&(0,a.dispose)(this.accumulatedFirstMoment.map((e=>e.variable))),null!=this.accumulatedWeightedInfNorm&&(0,a.dispose)(this.accumulatedWeightedInfNorm.map((e=>e.variable)))}async getWeights(){throw new Error("getWeights() is not implemented for Adamax yet.")}async setWeights(e){throw new Error("setWeights() is not implemented for Adamax yet.")}getConfig(){return{learningRate:this.learningRate,beta1:this.beta1,beta2:this.beta2,epsilon:this.epsilon,decay:this.decay}}static fromConfig(e,t){return new e(t.learningRate,t.beta1,t.beta2,t.epsilon,t.decay)}}t.AdamaxOptimizer=m,m.className="Adamax",(0,h.registerClass)(m)},81424:(e,t,n)=>{"use strict";
1Object.defineProperty(t,"__esModule",{value:!0}),t.MomentumOptimizer=void 0;var r=n(90337),a=n(271725),o=n(353632),s=n(295702),i=n(454179),c=n(166119),l=n(39037),u=n(475231);class d extends u.SGDOptimizer{constructor(e,t){let n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];super(e),this.learningRate=e,this.momentum=t,this.useNesterov=n,this.accumulations=[],this.m=(0,i.scalar)(this.momentum)}applyGradients(e){(Array.isArray(e)?e.map((e=>e.name)):Object.keys(e)).forEach(((t,n)=>{const i=r.ENGINE.registeredVariables[t];if(null==this.accumulations[n]){const e=!1;this.accumulations[n]={originalName:"".concat(t,"/momentum"),variable:(0,a.tidy)((()=>(0,c.zerosLike)(i).variable(e)))}}const l=this.accumulations[n].variable,u=Array.isArray(e)?e[n].tensor:e[t];null!=u&&(0,a.tidy)((()=>{let e;const t=(0,o.add)((0,s.mul)(this.m,l),u);e=this.useNesterov?(0,o.add)((0,s.mul)(this.c,(0,o.add)(u,(0,s.mul)(t,this.m))),i):(0,o.add)((0,s.mul)(this.c,t),i),l.assign(t),i.assign(e)}))})),this.incrementIterations()}dispose(){this.m.dispose(),null!=this.accumulations&&(0,a.dispose)(this.accumulations.map((e=>e.variable)))}setMomentum(e){this.momentum=e}async getWeights(){return[await this.saveIterations()].concat(this.accumulations.map((e=>({name:e.originalName,tensor:e.variable}))))}async setWeights(e){e=await this.extractIterations(e);this.accumulations=e.map((e=>({originalName:e.name,variable:e.tensor.variable(false)})))}getConfig(){return{learningRate:this.learningRate,momentum:this.momentum,useNesterov:this.useNesterov}}static fromConfig(e,t){return new e(t.learningRate,t.momentum,t.useNesterov)}}t.MomentumOptimizer=d,d.className="Momentum",(0,l.registerClass)(d)},524823:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Optimizer=void 0;var r=n(271725),a=n(931564),o=n(899090),s=n(39037);class i extends s.Serializable{minimize(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=arguments.length>2?arguments[2]:void 0;const{value:a,grads:o}=this.computeGradients(e,n);if(null!=n){const e=n.map((e=>({name:e.name,tensor:o[e.name]})));this.applyGradients(e)}else this.applyGradients(o);return(0,r.dispose)(o),t?a:(a.dispose(),null)}get iterations(){return null==this.iterations_&&(this.iterations_=0),this.iterations_}incrementIterations(){this.iterations_=this.iterations+1}computeGradients(e,t){return(0,a.variableGrads)(e,t)}dispose(){null!=this.iterations_&&(0,r.dispose)(this.iterations_)}async saveIterations(){return null==this.iterations_&&(this.iterations_=0),{name:"iter",tensor:(0,o.scalar)(this.iterations_,"int32")}}async getWeights(){throw new Error("getWeights() is not implemented for this optimizer yet.")}async setWeights(e){throw new Error("setWeights() is not implemented for this optimizer class "+"".concat(this.getClassName()))}async extractIterations(e){return this.iterations_=(await e[0].tensor.data())[0],e.slice(1)}}t.Optimizer=i,Object.defineProperty(i,Symbol.hasInstance,{value:e=>null!=e.minimize&&null!=e.computeGradients&&null!=e.applyGradients})},472732:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.OptimizerConstructors=void 0;var r=n(538885),a=n(499678),o=n(947007),s=n(119673),i=n(81424),c=n(452951),l=n(475231);t.OptimizerConstructors=class{static sgd(e){return new l.SGDOptimizer(e)}static momentum(e,t){let n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return new i.MomentumOptimizer(e,t,n)}static rmsprop(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:.9,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,a=arguments.length>4&&void 0!==arguments[4]&&arguments[4];return new c.RMSPropOptimizer(e,t,n,r,a)}static adam(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:.001,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:.9,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:.999,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;return new o.AdamOptimizer(e,t,n,r)}static adadelta(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:.001,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:.95,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;return new r.AdadeltaOptimizer(e,t,n)}static adamax(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:.002,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:.9,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:.999,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;return new s.AdamaxOptimizer(e,t,n,r,a)}static adagrad(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:.1;return new a.AdagradOptimizer(e,t)}}},452951:(e,t,n)=>{"use strict";
1Object.defineProperty(t,"__esModule",{value:!0}),t.RMSPropOptimizer=void 0;var r=n(90337),a=n(271725),o=n(353632),s=n(67282),i=n(295702),c=n(435438),l=n(985987),u=n(702222),d=n(166119),p=n(39037),h=n(524823);class f extends h.Optimizer{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:.9,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,o=arguments.length>4&&void 0!==arguments[4]&&arguments[4];if(super(),this.learningRate=e,this.decay=t,this.momentum=n,this.epsilon=a,this.accumulatedMeanSquares=[],this.accumulatedMoments=[],this.accumulatedMeanGrads=[],this.centered=o,null==a&&(this.epsilon=r.ENGINE.backend.epsilon()),null==e)throw new Error("learningRate for RMSPropOptimizer must be defined.")}applyGradients(e){(Array.isArray(e)?e.map((e=>e.name)):Object.keys(e)).forEach(((t,n)=>{const p=r.ENGINE.registeredVariables[t],h=!1;null==this.accumulatedMeanSquares[n]&&(this.accumulatedMeanSquares[n]={originalName:"".concat(t,"/rms"),variable:(0,a.tidy)((()=>(0,d.zerosLike)(p).variable(h)))}),null==this.accumulatedMoments[n]&&(this.accumulatedMoments[n]={originalName:"".concat(t,"/momentum"),variable:(0,a.tidy)((()=>(0,d.zerosLike)(p).variable(h)))}),null==this.accumulatedMeanGrads[n]&&this.centered&&(this.accumulatedMeanGrads[n]={originalName:"".concat(t,"/mg"),variable:(0,a.tidy)((()=>(0,d.zerosLike)(p).variable(h)))});const f=Array.isArray(e)?e[n].tensor:e[t];if(null==f)return;const m=this.accumulatedMeanSquares[n].variable,g=this.accumulatedMoments[n].variable;(0,a.tidy)((()=>{const e=(0,o.add)((0,i.mul)(m,this.decay),(0,i.mul)((0,l.square)(f),1-this.decay));if(this.centered){const t=this.accumulatedMeanGrads[n].variable,r=(0,o.add)((0,i.mul)(t,this.decay),(0,i.mul)(f,1-this.decay)),a=(0,s.div)((0,i.mul)(f,this.learningRate),(0,c.sqrt)((0,u.sub)(e,(0,o.add)((0,l.square)(r),this.epsilon)))),d=(0,o.add)((0,i.mul)(g,this.momentum),a);m.assign(e),t.assign(r),g.assign(d);const h=(0,u.sub)(p,d);p.assign(h)}else{const e=(0,o.add)((0,i.mul)(m,this.decay),(0,i.mul)((0,l.square)(f),1-this.decay)),t=(0,o.add)((0,i.mul)(g,this.momentum),(0,s.div)((0,i.mul)(f,this.learningRate),(0,c.sqrt)((0,o.add)(e,this.epsilon))));m.assign(e),g.assign(t);const n=(0,u.sub)(p,t);p.assign(n)}}))})),this.incrementIterations()}dispose(){null!=this.accumulatedMeanSquares&&(0,a.dispose)(this.accumulatedMeanSquares.map((e=>e.variable))),null!=this.accumulatedMeanGrads&&this.centered&&(0,a.dispose)(this.accumulatedMeanGrads.map((e=>e.variable))),null!=this.accumulatedMoments&&(0,a.dispose)(this.accumulatedMoments.map((e=>e.variable)))}async getWeights(){const e=[...this.accumulatedMeanSquares,...this.accumulatedMoments];return this.centered&&e.push(...this.accumulatedMeanGrads),[await this.saveIterations()].concat(e.map((e=>({name:e.originalName,tensor:e.variable}))))}async setWeights(e){e=await this.extractIterations(e);const t=this.centered?e.length/3:e.length/2,n=!1;this.accumulatedMeanSquares=e.slice(0,t).map((e=>({originalName:e.name,variable:e.tensor.variable(n)}))),this.accumulatedMoments=e.slice(t,2*t).map((e=>({originalName:e.name,variable:e.tensor.variable(n)}))),this.centered&&(this.accumulatedMeanGrads=e.slice(2*t,3*t).map((e=>({originalName:e.name,variable:e.tensor.variable(n)}))))}getConfig(){return{learningRate:this.learningRate,decay:this.decay,momentum:this.momentum,epsilon:this.epsilon,centered:this.centered}}static fromConfig(e,t){return new e(t.learningRate,t.decay,t.momentum,t.epsilon,t.centered)}}t.RMSPropOptimizer=f,f.className="RMSProp",(0,p.registerClass)(f)},475231:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.SGDOptimizer=void 0;var r=n(90337),a=n(271725),o=n(353632),s=n(295702),i=n(454179),c=n(39037),l=n(524823);class u extends l.Optimizer{constructor(e){super(),this.learningRate=e,this.setLearningRate(e)}applyGradients(e){(Array.isArray(e)?e.map((e=>e.name)):Object.keys(e)).forEach(((t,n)=>{const i=Array.isArray(e)?e[n].tensor:e[t];if(null==i)return;const c=r.ENGINE.registeredVariables[t];(0,a.tidy)((()=>{const e=(0,o.add)((0,s.mul)(this.c,i),c);c.assign(e)}))})),this.incrementIterations()}setLearningRate(e){this.learningRate=e,null!=this.c&&this.c.dispose(),this.c=(0,a.keep)((0,i.scalar)(-e))}dispose(){this.c.dispose()}async getWeights(){return[await this.saveIterations()]}async setWeights(e){if(0!==(e=await this.extractIterations(e)).length)throw new Error("SGD optimizer does not have settable weights.")}getConfig(){return{learningRate:this.learningRate}}static fromConfig(e,t){return new e(t.learningRate)}}t.SGDOptimizer=u,u.className="SGD",(0,c.registerClass)(u)}
1,353398:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.PlatformBrowser=void 0,n(19445);var r=n(598257),a=n(113829),o=n(620530),s=n(175827);class i{fetch(e,t){return fetch(e,t)}now(){return performance.now()}encode(e,t){if("utf-8"!==t&&"utf8"!==t)throw new Error("Browser's encoder only supports utf-8, but got ".concat(t));return null==this.textEncoder&&(this.textEncoder=new TextEncoder),this.textEncoder.encode(e)}decode(e,t){return new TextDecoder(t).decode(e)}}if(t.PlatformBrowser=i,(0,r.env)().get("IS_BROWSER")){(0,r.env)().setPlatform("browser",new i);try{s.ModelStoreManagerRegistry.registerManager(o.BrowserLocalStorage.URL_SCHEME,new o.BrowserLocalStorageManager)}catch(e){}try{s.ModelStoreManagerRegistry.registerManager(a.BrowserIndexedDB.URL_SCHEME,new a.BrowserIndexedDBManager)}catch(e){}}},799219:(e,t,n)=>{"use strict";var r=n(734155);Object.defineProperty(t,"__esModule",{value:!0}),t.getNodeFetch=t.PlatformNode=void 0,t.getSystemFetch=function(){return s},t.resetSystemFetch=function(){s=null},t.setSystemFetch=function(e){s=e};var a=n(598257);const o=t.getNodeFetch={importFetch:()=>n(675410)};let s;class i{constructor(){this.util=n(548628),this.textEncoder=new this.util.TextEncoder}fetch(e,t){return null!=(0,a.env)().global.fetch?(0,a.env)().global.fetch(e,t):(null==s&&(s=o.importFetch()),s(e,t))}now(){const e=r.hrtime();return 1e3*e[0]+e[1]/1e6}encode(e,t){if("utf-8"!==t&&"utf8"!==t)throw new Error("Node built-in encoder only supports utf-8, but got ".concat(t));return this.textEncoder.encode(e)}decode(e,t){return 0===e.length?"":new this.util.TextDecoder(t).decode(e)}}t.PlatformNode=i,(0,a.env)().get("IS_NODE")&&!(0,a.env)().get("IS_BROWSER")&&(0,a.env)().setPlatform("node",new i)},262886:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Profiler=t.Logger=void 0,t.checkComputationForErrors=s;var r=n(598257),a=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=o(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var s in e)if("default"!==s&&{}.hasOwnProperty.call(e,s)){var i=a?Object.getOwnPropertyDescriptor(e,s):null;i&&(i.get||i.set)?Object.defineProperty(r,s,i):r[s]=e[s]}return r.default=e,n&&n.set(e,r),r}(n(904737));function o(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(o=function(e){return e?n:t})(e)}function s(e,t,n){if("float32"!==t)return!1;for(let t=0;t<e.length;t++){const r=e[t];if(isNaN(r)||!isFinite(r))return console.warn("Found ".concat(r," in the result of '").concat(n,"'")),!0}return!1}t.Profiler=class{constructor(e,t){this.backendTimer=e,this.logger=t,null==t&&(this.logger=new i)}profileKernel(e,t,n){let o;const i=()=>{o=n()};let c;const l=a.now();if(this.backendTimer.timerAvailable())c=this.backendTimer.time(i);else{i();for(const e of o)e.dataSync();c=Promise.resolve({kernelMs:a.now()-l})}if((0,r.env)().getBool("CHECK_COMPUTATION_FOR_ERRORS"))for(let t=0;t<o.length;t++){const n=o[t];n.data().then((t=>{s(t,n.dtype,e)}))}return{kernelName:e,outputs:o,inputs:t,timeMs:c.then((e=>e.kernelMs)),extraInfo:c.then((e=>null!=e.getExtraProfileInfo?e.getExtraProfileInfo():""))}}logKernelProfile(e){const{kernelName:t,outputs:n,timeMs:r,inputs:a,extraInfo:o}=e;n.forEach((e=>{Promise.all([e.data(),r,o]).then((n=>{this.logger.logKernelProfile(t,e,n[0],n[1],a,n[2])}))}))}};class i{logKernelProfile(e,t,n,r,o,s){const i="number"==typeof r?a.rightPad("".concat(r,"ms"),9):r.error,c=a.rightPad(e,25),l=t.rank,u=t.size,d=a.rightPad(t.shape.toString(),14);let p="";for(const e in o){const n=o[e];if(null!=n){const r=n.shape||t.shape,a=r.length;p+="".concat(e,": ").concat(a,"D ").concat(a>0?r:""," ")}}console.log("%c".concat(c,"\t%c").concat(i,"\t%c").concat(l,"D ").concat(d,"\t%c").concat(u,"\t%c").concat(p,"\t%c").concat(s),"font-weight:bold","color:red","color:blue","color: orange","color: green","color: steelblue")}}t.Logger=i},679353:(e,t,n)=>{"use strict";var r=n(899090);(0,n(659795).getGlobalTensorClass)().prototype.abs=function(){return this.throwIfDisposed(),(0,r.abs)(this)}},959115:(e,t,n)=>{"use strict";var r=n(899090);(0,n(659795).getGlobalTensorClass)().prototype.acos=function(){return this.throwIfDisposed(),(0,r.acos)(this)}},986161:(e,t,n)=>{"use strict";var r=n(899090);(0,n(659795).getGlobalTensorClass)().prototype.acosh=function(){return this.throwIfDisposed(),(0,r.acosh)(this)}}
1,539998:(e,t,n)=>{"use strict";var r=n(353632);(0,n(659795).getGlobalTensorClass)().prototype.add=function(e){return this.throwIfDisposed(),(0,r.add)(this,e)}},738560:(e,t,n)=>{"use strict";var r=n(143805);(0,n(659795).getGlobalTensorClass)().prototype.all=function(e,t){return this.throwIfDisposed(),(0,r.all)(this,e,t)}},841043:(e,t,n)=>{"use strict";var r=n(695913);(0,n(659795).getGlobalTensorClass)().prototype.any=function(e,t){return this.throwIfDisposed(),(0,r.any)(this,e,t)}},311279:(e,t,n)=>{"use strict";var r=n(508147);(0,n(659795).getGlobalTensorClass)().prototype.argMax=function(e){return this.throwIfDisposed(),(0,r.argMax)(this,e)}},881610:(e,t,n)=>{"use strict";var r=n(448740);(0,n(659795).getGlobalTensorClass)().prototype.argMin=function(e){return this.throwIfDisposed(),(0,r.argMin)(this,e)}},506680:(e,t,n)=>{"use strict";var r=n(195476);(0,n(659795).getGlobalTensorClass)().prototype.as1D=function(){return this.throwIfDisposed(),(0,r.reshape)(this,[this.size])}},427377:(e,t,n)=>{"use strict";var r=n(195476);(0,n(659795).getGlobalTensorClass)().prototype.as2D=function(e,t){return this.throwIfDisposed(),(0,r.reshape)(this,[e,t])}},30724:(e,t,n)=>{"use strict";var r=n(195476);(0,n(659795).getGlobalTensorClass)().prototype.as3D=function(e,t,n){return this.throwIfDisposed(),(0,r.reshape)(this,[e,t,n])}},233232:(e,t,n)=>{"use strict";var r=n(195476);(0,n(659795).getGlobalTensorClass)().prototype.as4D=function(e,t,n,a){return this.throwIfDisposed(),(0,r.reshape)(this,[e,t,n,a])}},280178:(e,t,n)=>{"use strict";var r=n(195476);(0,n(659795).getGlobalTensorClass)().prototype.as5D=function(e,t,n,a,o){return this.throwIfDisposed(),(0,r.reshape)(this,[e,t,n,a,o])}},643358:(e,t,n)=>{"use strict";var r=n(195476),a=n(659795),o=n(904737);(0,a.getGlobalTensorClass)().prototype.asScalar=function(){return this.throwIfDisposed(),(0,o.assert)(1===this.size,(()=>"The array must have only 1 element.")),(0,r.reshape)(this,[])}},245482:(e,t,n)=>{"use strict";var r=n(899090);(0,n(659795).getGlobalTensorClass)().prototype.asType=function(e){return this.throwIfDisposed(),(0,r.cast)(this,e)}},257287:(e,t,n)=>{"use strict";var r=n(899090);(0,n(659795).getGlobalTensorClass)().prototype.asin=function(){return this.throwIfDisposed(),(0,r.asin)(this)}},131604:(e,t,n)=>{"use strict";var r=n(899090);(0,n(659795).getGlobalTensorClass)().prototype.asinh=function(){return this.throwIfDisposed(),(0,r.asinh)(this)}},216960:(e,t,n)=>{"use strict";var r=n(899090);(0,n(659795).getGlobalTensorClass)().prototype.atan=function(){return this.throwIfDisposed(),(0,r.atan)(this)}},969902:(e,t,n)=>{"use strict";var r=n(395307);(0,n(659795).getGlobalTensorClass)().prototype.atan2=function(e){return this.throwIfDisposed(),(0,r.atan2)(this,e)}},822276:(e,t,n)=>{"use strict";var r=n(899090);(0,n(659795).getGlobalTensorClass)().prototype.atanh=function(){return this.throwIfDisposed(),(0,r.atanh)(this)}},920742:(e,t,n)=>{"use strict";var r=n(926677);(0,n(659795).getGlobalTensorClass)().prototype.avgPool=function(e,t,n,a){return this.throwIfDisposed(),(0,r.avgPool)(this,e,t,n,a)}},753836:(e,t,n)=>{"use strict";var r=n(47326);(0,n(659795).getGlobalTensorClass)().prototype.batchToSpaceND=function(e,t){return this.throwIfDisposed(),(0,r.batchToSpaceND)(this,e,t)}},323111:(e,t,n)=>{"use strict";var r=n(739914);(0,n(659795).getGlobalTensorClass)().prototype.batchNorm=function(e,t,n,a,o){return this.throwIfDisposed(),(0,r.batchNorm)(this,e,t,n,a,o)}},205954:(e,t,n)=>{"use strict";var r=n(465581);(0,n(659795).getGlobalTensorClass)().prototype.broadcastTo=function(e){return this.throwIfDisposed(),(0,r.broadcastTo)(this,e)}},185301:(e,t,n)=>{"use strict";var r=n(899090);(0,n(659795).getGlobalTensorClass)().prototype.cast=function(e){return this.throwIfDisposed(),(0,r.cast)(this,e)}},76652:(e,t,n)=>{"use strict";var r=n(899090);(0,n(659795).getGlobalTensorClass)().prototype.ceil=function(){return this.throwIfDisposed(),(0,r.ceil)(this)}},474030:(e,t,n)=>{"use strict";var r=n(899090);(0,n(659795).getGlobalTensorClass)().prototype.clipByValue=function(e,t){return this.throwIfDisposed(),(0,r.clipByValue)(this,e,t)}},314876:(e,t,n)=>{"use strict";var r=n(55108),a=n(659795);(0,a.getGlobalTensorClass)().prototype.concat=function(e,t){return this.throwIfDisposed(),e instanceof a.Tensor&&(e=[e]),(0,r.concat)([this,...e],t)}},83180:(e,t,n)=>{"use strict";var r=n(394576);(0,n(659795).getGlobalTensorClass)().prototype.conv1d=function(e,t,n,a,o,s){return this.throwIfDisposed(),(0,r.conv1d)(this,e,t,n,a,o,s)}},855101:(e,t,n)=>{"use strict";var r=n(797476);(0,n(659795).getGlobalTensorClass)().prototype.conv2d=function(e,t,n,a,o,s){return this.throwIfDisposed(),(0,r.conv2d)(this,e,t,n,a,o,s)}}
1,441562:(e,t,n)=>{"use strict";var r=n(492617);(0,n(659795).getGlobalTensorClass)().prototype.conv2dTranspose=function(e,t,n,a,o){return this.throwIfDisposed(),(0,r.conv2dTranspose)(this,e,t,n,a,o)}},362933:(e,t,n)=>{"use strict";var r=n(899090);(0,n(659795).getGlobalTensorClass)().prototype.cos=function(){return this.throwIfDisposed(),(0,r.cos)(this)}},409864:(e,t,n)=>{"use strict";var r=n(899090);(0,n(659795).getGlobalTensorClass)().prototype.cosh=function(){return this.throwIfDisposed(),(0,r.cosh)(this)}},326814:(e,t,n)=>{"use strict";var r=n(110727);(0,n(659795).getGlobalTensorClass)().prototype.cumsum=function(e,t,n){return this.throwIfDisposed(),(0,r.cumsum)(this,e,t,n)}},452607:(e,t,n)=>{"use strict";var r=n(646051);(0,n(659795).getGlobalTensorClass)().prototype.depthToSpace=function(e,t){return this.throwIfDisposed(),(0,r.depthToSpace)(this,e,t)}},258006:(e,t,n)=>{"use strict";var r=n(599081);(0,n(659795).getGlobalTensorClass)().prototype.depthwiseConv2d=function(e,t,n,a,o,s){return this.throwIfDisposed(),(0,r.depthwiseConv2d)(this,e,t,n,a,o,s)}},68108:(e,t,n)=>{"use strict";var r=n(77495);(0,n(659795).getGlobalTensorClass)().prototype.dilation2d=function(e,t,n,a,o){return this.throwIfDisposed(),(0,r.dilation2d)(this,e,t,n,a,o)}},386948:(e,t,n)=>{"use strict";var r=n(67282);(0,n(659795).getGlobalTensorClass)().prototype.div=function(e){return this.throwIfDisposed(),(0,r.div)(this,e)}},702796:(e,t,n)=>{"use strict";var r=n(998342);(0,n(659795).getGlobalTensorClass)().prototype.divNoNan=function(e){return this.throwIfDisposed(),(0,r.divNoNan)(this,e)}},986511:(e,t,n)=>{"use strict";var r=n(379895);(0,n(659795).getGlobalTensorClass)().prototype.dot=function(e){return this.throwIfDisposed(),(0,r.dot)(this,e)}},779557:(e,t,n)=>{"use strict";var r=n(675403);(0,n(659795).getGlobalTensorClass)().prototype.elu=function(){return this.throwIfDisposed(),(0,r.elu)(this)}},428884:(e,t,n)=>{"use strict";var r=n(674655);(0,n(659795).getGlobalTensorClass)().prototype.equal=function(e){return this.throwIfDisposed(),(0,r.equal)(this,e)}},564273:(e,t,n)=>{"use strict";var r=n(899090);(0,n(659795).getGlobalTensorClass)().prototype.erf=function(){return this.throwIfDisposed(),(0,r.erf)(this)}},773592:(e,t,n)=>{"use strict";var r=n(899090);(0,n(659795).getGlobalTensorClass)().prototype.exp=function(){return this.throwIfDisposed(),(0,r.exp)(this)}},165320:(e,t,n)=>{"use strict";var r=n(621724);(0,n(659795).getGlobalTensorClass)().prototype.expandDims=function(e){return this.throwIfDisposed(),(0,r.expandDims)(this,e)}},996267:(e,t,n)=>{"use strict";var r=n(899090);(0,n(659795).getGlobalTensorClass)().prototype.expm1=function(){return this.throwIfDisposed(),(0,r.expm1)(this)}},422286:(e,t,n)=>{"use strict";var r=n(899090);(0,n(659795).getGlobalTensorClass)().prototype.fft=function(){return this.throwIfDisposed(),(0,r.fft)(this)}},618913:(e,t,n)=>{"use strict";var r=n(195476);(0,n(659795).getGlobalTensorClass)().prototype.flatten=function(){return this.throwIfDisposed(),(0,r.reshape)(this,[this.size])}},386474:(e,t,n)=>{"use strict";var r=n(899090);(0,n(659795).getGlobalTensorClass)().prototype.floor=function(){return this.throwIfDisposed(),(0,r.floor)(this)}},988277:(e,t,n)=>{"use strict";var r=n(25485);(0,n(659795).getGlobalTensorClass)().prototype.floorDiv=function(e){return this.throwIfDisposed(),(0,r.floorDiv)(this,e)}},809387:(e,t,n)=>{"use strict";var r=n(589205);(0,n(659795).getGlobalTensorClass)().prototype.gather=function(e,t){return this.throwIfDisposed(),(0,r.gather)(this,e,t)}},197156:(e,t,n)=>{"use strict";var r=n(755964);(0,n(659795).getGlobalTensorClass)().prototype.greater=function(e){return this.throwIfDisposed(),(0,r.greater)(this,e)}},919546:(e,t,n)=>{"use strict";var r=n(955497);(0,n(659795).getGlobalTensorClass)().prototype.greaterEqual=function(e){return this.throwIfDisposed(),(0,r.greaterEqual)(this,e)}},604670:(e,t,n)=>{"use strict";var r=n(899090);(0,n(659795).getGlobalTensorClass)().prototype.ifft=function(){return this.throwIfDisposed(),(0,r.ifft)(this)}},331543:(e,t,n)=>{"use strict";var r=n(899090);(0,n(659795).getGlobalTensorClass)().prototype.irfft=function(){return this.throwIfDisposed(),(0,r.irfft)(this)}},387241:(e,t,n)=>{"use strict";var r=n(899090);(0,n(659795).getGlobalTensorClass)().prototype.isFinite=function(){return this.throwIfDisposed(),(0,r.isFinite)(this)}},109081:(e,t,n)=>{"use strict";var r=n(899090);(0,n(659795).getGlobalTensorClass)().prototype.isInf=function(){return this.throwIfDisposed(),(0,r.isInf)(this)}},255136:(e,t,n)=>{"use strict";var r=n(899090);(0,n(659795).getGlobalTensorClass)().prototype.isNaN=function(){return this.throwIfDisposed(),(0,r.isNaN)(this)}}
1,985064:(e,t,n)=>{"use strict";var r=n(999017);(0,n(659795).getGlobalTensorClass)().prototype.leakyRelu=function(e){return this.throwIfDisposed(),(0,r.leakyRelu)(this,e)}},64321:(e,t,n)=>{"use strict";var r=n(881597);(0,n(659795).getGlobalTensorClass)().prototype.less=function(e){return this.throwIfDisposed(),(0,r.less)(this,e)}},155213:(e,t,n)=>{"use strict";var r=n(756172);(0,n(659795).getGlobalTensorClass)().prototype.lessEqual=function(e){return this.throwIfDisposed(),(0,r.lessEqual)(this,e)}},253597:(e,t,n)=>{"use strict";var r=n(776576);(0,n(659795).getGlobalTensorClass)().prototype.localResponseNormalization=function(e,t,n,a){return this.throwIfDisposed(),(0,r.localResponseNormalization)(this,e,t,n,a)}},76081:(e,t,n)=>{"use strict";var r=n(899090);(0,n(659795).getGlobalTensorClass)().prototype.log=function(){return this.throwIfDisposed(),(0,r.log)(this)}},235261:(e,t,n)=>{"use strict";var r=n(899090);(0,n(659795).getGlobalTensorClass)().prototype.log1p=function(){return this.throwIfDisposed(),(0,r.log1p)(this)}},32119:(e,t,n)=>{"use strict";var r=n(899090);(0,n(659795).getGlobalTensorClass)().prototype.logSigmoid=function(){return this.throwIfDisposed(),(0,r.logSigmoid)(this)}},385170:(e,t,n)=>{"use strict";var r=n(899090);(0,n(659795).getGlobalTensorClass)().prototype.logSoftmax=function(e){return this.throwIfDisposed(),(0,r.logSoftmax)(this,e)}},415933:(e,t,n)=>{"use strict";var r=n(699827);(0,n(659795).getGlobalTensorClass)().prototype.logSumExp=function(e,t){return this.throwIfDisposed(),(0,r.logSumExp)(this,e,t)}},736811:(e,t,n)=>{"use strict";var r=n(586386);(0,n(659795).getGlobalTensorClass)().prototype.logicalAnd=function(e){return this.throwIfDisposed(),(0,r.logicalAnd)(this,e)}},552128:(e,t,n)=>{"use strict";var r=n(887101);(0,n(659795).getGlobalTensorClass)().prototype.logicalNot=function(){return this.throwIfDisposed(),(0,r.logicalNot)(this)}},54411:(e,t,n)=>{"use strict";var r=n(609677);(0,n(659795).getGlobalTensorClass)().prototype.logicalOr=function(e){return this.throwIfDisposed(),(0,r.logicalOr)(this,e)}},84400:(e,t,n)=>{"use strict";var r=n(841770);(0,n(659795).getGlobalTensorClass)().prototype.logicalXor=function(e){return this.throwIfDisposed(),(0,r.logicalXor)(this,e)}},452003:(e,t,n)=>{"use strict";var r=n(986588);(0,n(659795).getGlobalTensorClass)().prototype.matMul=function(e,t,n){return this.throwIfDisposed(),(0,r.matMul)(this,e,t,n)}},287460:(e,t,n)=>{"use strict";var r=n(882465);(0,n(659795).getGlobalTensorClass)().prototype.max=function(e,t){return this.throwIfDisposed(),(0,r.max)(this,e,t)}},577810:(e,t,n)=>{"use strict";var r=n(31112);(0,n(659795).getGlobalTensorClass)().prototype.maxPool=function(e,t,n,a){return this.throwIfDisposed(),(0,r.maxPool)(this,e,t,n,a)}},452322:(e,t,n)=>{"use strict";var r=n(720036);(0,n(659795).getGlobalTensorClass)().prototype.maximum=function(e){return this.throwIfDisposed(),(0,r.maximum)(this,e)}},473354:(e,t,n)=>{"use strict";var r=n(187651);(0,n(659795).getGlobalTensorClass)().prototype.mean=function(e,t){return this.throwIfDisposed(),(0,r.mean)(this,e,t)}},588162:(e,t,n)=>{"use strict";var r=n(914828);(0,n(659795).getGlobalTensorClass)().prototype.min=function(e,t){return this.throwIfDisposed(),(0,r.min)(this,e,t)}},663656:(e,t,n)=>{"use strict";var r=n(716940);(0,n(659795).getGlobalTensorClass)().prototype.minimum=function(e){return this.throwIfDisposed(),(0,r.minimum)(this,e)}},15379:(e,t,n)=>{"use strict";var r=n(208026);(0,n(659795).getGlobalTensorClass)().prototype.mirrorPad=function(e,t){return this.throwIfDisposed(),(0,r.mirrorPad)(this,e,t)}},377684:(e,t,n)=>{"use strict";var r=n(820891);(0,n(659795).getGlobalTensorClass)().prototype.mod=function(e){return this.throwIfDisposed(),(0,r.mod)(this,e)}},524986:(e,t,n)=>{"use strict";var r=n(295702);(0,n(659795).getGlobalTensorClass)().prototype.mul=function(e){return this.throwIfDisposed(),(0,r.mul)(this,e)}},511036:(e,t,n)=>{"use strict";var r=n(899090);(0,n(659795).getGlobalTensorClass)().prototype.neg=function(){return this.throwIfDisposed(),(0,r.neg)(this)}},270825:(e,t,n)=>{"use strict";var r=n(899090);(0,n(659795).getGlobalTensorClass)().prototype.norm=function(e,t,n){return this.throwIfDisposed(),(0,r.norm)(this,e,t,n)}}
1,223762:(e,t,n)=>{"use strict";var r=n(737915);(0,n(659795).getGlobalTensorClass)().prototype.notEqual=function(e){return this.throwIfDisposed(),(0,r.notEqual)(this,e)}},483577:(e,t,n)=>{"use strict";var r=n(597664);(0,n(659795).getGlobalTensorClass)().prototype.oneHot=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return this.throwIfDisposed(),(0,r.oneHot)(this,e,t,n)}},785581:(e,t,n)=>{"use strict";var r=n(899090);(0,n(659795).getGlobalTensorClass)().prototype.onesLike=function(){return this.throwIfDisposed(),(0,r.onesLike)(this)}},770943:(e,t,n)=>{"use strict";var r=n(813636);(0,n(659795).getGlobalTensorClass)().prototype.pad=function(e,t){return this.throwIfDisposed(),(0,r.pad)(this,e,t)}},651071:(e,t,n)=>{"use strict";var r=n(864210);(0,n(659795).getGlobalTensorClass)().prototype.pool=function(e,t,n,a,o,s){return this.throwIfDisposed(),(0,r.pool)(this,e,t,n,a,o,s)}},185182:(e,t,n)=>{"use strict";var r=n(216556);(0,n(659795).getGlobalTensorClass)().prototype.pow=function(e){return this.throwIfDisposed(),(0,r.pow)(this,e)}},359190:(e,t,n)=>{"use strict";var r=n(993804);(0,n(659795).getGlobalTensorClass)().prototype.prelu=function(e){return this.throwIfDisposed(),(0,r.prelu)(this,e)}},152032:(e,t,n)=>{"use strict";var r=n(278026);(0,n(659795).getGlobalTensorClass)().prototype.prod=function(e,t){return this.throwIfDisposed(),(0,r.prod)(this,e,t)}},717175:(e,t,n)=>{"use strict";var r=n(899090);(0,n(659795).getGlobalTensorClass)().prototype.reciprocal=function(){return this.throwIfDisposed(),(0,r.reciprocal)(this)}},251251:(e,t,n)=>{"use strict";n(679353),n(959115),n(986161),n(539998),n(738560),n(841043),n(311279),n(881610),n(643358),n(245482),n(506680),n(427377),n(30724),n(233232),n(280178),n(257287),n(131604),n(216960),n(969902),n(822276),n(920742),n(753836),n(323111),n(205954),n(185301),n(76652),n(474030),n(314876),n(83180),n(441562),n(855101),n(362933),n(409864),n(326814),n(452607),n(258006),n(68108),n(702796),n(386948),n(986511),n(779557),n(428884),n(564273),n(773592),n(165320),n(996267),n(422286),n(618913),n(386474),n(988277),n(809387),n(919546),n(197156),n(604670),n(331543),n(387241),n(109081),n(255136),n(985064),n(155213),n(64321),n(253597),n(32119),n(385170),n(415933),n(76081),n(235261),n(736811),n(552128),n(54411),n(84400),n(452003),n(577810),n(287460),n(452322),n(473354),n(588162),n(663656),n(15379),n(377684),n(524986),n(511036),n(270825),n(223762),n(483577),n(785581),n(770943),n(651071),n(185182),n(359190),n(152032),n(717175),n(90382),n(770307),n(517436),n(530022),n(897254),n(662585),n(725017),n(227584),n(588253),n(300019),n(501040),n(681639),n(321780),n(21213),n(378968),n(869589),n(26010),n(503566),n(217906),n(157390),n(315289),n(265671),n(455390),n(234161),n(157955),n(509423),n(83805),n(810968),n(304306),n(626371),n(416417),n(422284),n(486686),n(696079),n(264225),n(225068),n(967391),n(405849),n(855972),n(927062),n(485447),n(174118),n(395631)},90382:(e,t,n)=>{"use strict";var r=n(259849);(0,n(659795).getGlobalTensorClass)().prototype.relu=function(){return this.throwIfDisposed(),(0,r.relu)(this)}},770307:(e,t,n)=>{"use strict";var r=n(783295);(0,n(659795).getGlobalTensorClass)().prototype.relu6=function(){return this.throwIfDisposed(),(0,r.relu6)(this)}},530022:(e,t,n)=>{"use strict";var r=n(195476);(0,n(659795).getGlobalTensorClass)().prototype.reshape=function(e){return this.throwIfDisposed(),(0,r.reshape)(this,e)}},517436:(e,t,n)=>{"use strict";var r=n(195476);(0,n(659795).getGlobalTensorClass)().prototype.reshapeAs=function(e){return this.throwIfDisposed(),(0,r.reshape)(this,e.shape)}},897254:(e,t,n)=>{"use strict";var r=n(772967);(0,n(659795).getGlobalTensorClass)().prototype.resizeBilinear=function(e,t,n){return this.throwIfDisposed(),(0,r.resizeBilinear)(this,e,t,n)}},662585:(e,t,n)=>{"use strict";var r=n(335974);(0,n(659795).getGlobalTensorClass)().prototype.resizeNearestNeighbor=function(e,t,n){return this.throwIfDisposed(),(0,r.resizeNearestNeighbor)(this,e,t,n)}},725017:(e,t,n)=>{"use strict";var r=n(790767);(0,n(659795).getGlobalTensorClass)().prototype.reverse=function(e){return this.throwIfDisposed(),(0,r.reverse)(this,e)}},227584:(e,t,n)=>{"use strict";var r=n(899090);(0,n(659795).getGlobalTensorClass)().prototype.rfft=function(){return this.throwIfDisposed(),(0,r.rfft)(this)}},588253:(e,t,n)=>{"use strict";var r=n(899090);(0,n(659795).getGlobalTensorClass)().prototype.round=function(){return this.throwIfDisposed(),(0,r.round)(this)}},300019:(e,t,n)=>{"use strict";var r=n(899090);(0,n(659795).getGlobalTensorClass)().prototype.rsqrt=function(){return this.throwIfDisposed(),(0,r.rsqrt)(this)}},501040:(e,t,n)=>{"use strict";var r=n(731754);(0,n(659795).getGlobalTensorClass)().prototype.selu=function(){return this.throwIfDisposed(),(0,r.selu)(this)}}
1,681639:(e,t,n)=>{"use strict";var r=n(843757);(0,n(659795).getGlobalTensorClass)().prototype.separableConv2d=function(e,t,n,a,o,s){return this.throwIfDisposed(),(0,r.separableConv2d)(this,e,t,n,a,o,s)}},321780:(e,t,n)=>{"use strict";var r=n(899090);(0,n(659795).getGlobalTensorClass)().prototype.sigmoid=function(){return this.throwIfDisposed(),(0,r.sigmoid)(this)}},21213:(e,t,n)=>{"use strict";var r=n(899090);(0,n(659795).getGlobalTensorClass)().prototype.sign=function(){return this.throwIfDisposed(),(0,r.sign)(this)}},378968:(e,t,n)=>{"use strict";var r=n(899090);(0,n(659795).getGlobalTensorClass)().prototype.sin=function(){return this.throwIfDisposed(),(0,r.sin)(this)}},869589:(e,t,n)=>{"use strict";var r=n(899090);(0,n(659795).getGlobalTensorClass)().prototype.sinh=function(){return this.throwIfDisposed(),(0,r.sinh)(this)}},26010:(e,t,n)=>{"use strict";var r=n(899090);(0,n(659795).getGlobalTensorClass)().prototype.slice=function(e,t){return this.throwIfDisposed(),(0,r.slice)(this,e,t)}},503566:(e,t,n)=>{"use strict";var r=n(899090);(0,n(659795).getGlobalTensorClass)().prototype.softmax=function(e){return this.throwIfDisposed(),(0,r.softmax)(this,e)}},217906:(e,t,n)=>{"use strict";var r=n(899090);(0,n(659795).getGlobalTensorClass)().prototype.softplus=function(){return this.throwIfDisposed(),(0,r.softplus)(this)}},157390:(e,t,n)=>{"use strict";var r=n(244851);(0,n(659795).getGlobalTensorClass)().prototype.spaceToBatchND=function(e,t){return this.throwIfDisposed(),(0,r.spaceToBatchND)(this,e,t)}},315289:(e,t,n)=>{"use strict";var r=n(422194);(0,n(659795).getGlobalTensorClass)().prototype.split=function(e,t){return this.throwIfDisposed(),(0,r.split)(this,e,t)}},265671:(e,t,n)=>{"use strict";var r=n(899090);(0,n(659795).getGlobalTensorClass)().prototype.sqrt=function(){return this.throwIfDisposed(),(0,r.sqrt)(this)}},455390:(e,t,n)=>{"use strict";var r=n(899090);(0,n(659795).getGlobalTensorClass)().prototype.square=function(){return this.throwIfDisposed(),(0,r.square)(this)}},234161:(e,t,n)=>{"use strict";var r=n(555593);(0,n(659795).getGlobalTensorClass)().prototype.squaredDifference=function(e){return this.throwIfDisposed(),(0,r.squaredDifference)(this,e)}},157955:(e,t,n)=>{"use strict";var r=n(714313);(0,n(659795).getGlobalTensorClass)().prototype.squeeze=function(e){return this.throwIfDisposed(),(0,r.squeeze)(this,e)}},509423:(e,t,n)=>{"use strict";var r=n(421637),a=n(659795);(0,a.getGlobalTensorClass)().prototype.stack=function(e,t){this.throwIfDisposed();const n=e instanceof a.Tensor?[this,e]:[this,...e];return(0,r.stack)(n,t)}},83805:(e,t,n)=>{"use strict";var r=n(899090);(0,n(659795).getGlobalTensorClass)().prototype.step=function(e){return this.throwIfDisposed(),(0,r.step)(this,e)}},810968:(e,t,n)=>{"use strict";var r=n(899090);(0,n(659795).getGlobalTensorClass)().prototype.stridedSlice=function(e,t,n,a,o,s,i,c){return this.throwIfDisposed(),(0,r.stridedSlice)(this,e,t,n,a,o,s,i,c)}},304306:(e,t,n)=>{"use strict";var r=n(702222);(0,n(659795).getGlobalTensorClass)().prototype.sub=function(e){return this.throwIfDisposed(),(0,r.sub)(this,e)}},626371:(e,t,n)=>{"use strict";var r=n(450126);(0,n(659795).getGlobalTensorClass)().prototype.sum=function(e,t){return this.throwIfDisposed(),(0,r.sum)(this,e,t)}},416417:(e,t,n)=>{"use strict";var r=n(899090);(0,n(659795).getGlobalTensorClass)().prototype.tan=function(){return this.throwIfDisposed(),(0,r.tan)(this)}},422284:(e,t,n)=>{"use strict";var r=n(899090);(0,n(659795).getGlobalTensorClass)().prototype.tanh=function(){return this.throwIfDisposed(),(0,r.tanh)(this)}},486686:(e,t,n)=>{"use strict";var r=n(134987);(0,n(659795).getGlobalTensorClass)().prototype.tile=function(e){return this.throwIfDisposed(),(0,r.tile)(this,e)}},696079:(e,t,n)=>{"use strict";var r=n(899090);(0,n(659795).getGlobalTensorClass)().prototype.toBool=function(){return this.throwIfDisposed(),(0,r.cast)(this,"bool")}},264225:(e,t,n)=>{"use strict";var r=n(899090);(0,n(659795).getGlobalTensorClass)().prototype.toFloat=function(){return this.throwIfDisposed(),(0,r.cast)(this,"float32")}},225068:(e,t,n)=>{"use strict";var r=n(899090);(0,n(659795).getGlobalTensorClass)().prototype.toInt=function(){return this.throwIfDisposed(),(0,r.cast)(this,"int32")}},967391:(e,t,n)=>{"use strict";var r=n(833426);(0,n(659795).getGlobalTensorClass)().prototype.topk=function(e,t){return this.throwIfDisposed(),(0,r.topk)(this,e,t)}}
1,405849:(e,t,n)=>{"use strict";var r=n(688129);(0,n(659795).getGlobalTensorClass)().prototype.transpose=function(e){return this.throwIfDisposed(),(0,r.transpose)(this,e)}},855972:(e,t,n)=>{"use strict";var r=n(657797);(0,n(659795).getGlobalTensorClass)().prototype.unique=function(e){return this.throwIfDisposed(),(0,r.unique)(this,e)}},927062:(e,t,n)=>{"use strict";var r=n(421418);(0,n(659795).getGlobalTensorClass)().prototype.unsortedSegmentSum=function(e,t){return this.throwIfDisposed(),(0,r.unsortedSegmentSum)(this,e,t)}},485447:(e,t,n)=>{"use strict";var r=n(922064);(0,n(659795).getGlobalTensorClass)().prototype.unstack=function(e){return this.throwIfDisposed(),(0,r.unstack)(this,e)}},174118:(e,t,n)=>{"use strict";var r=n(376131);(0,n(659795).getGlobalTensorClass)().prototype.where=function(e,t){return this.throwIfDisposed(),(0,r.where)(e,this,t)}},395631:(e,t,n)=>{"use strict";var r=n(899090);(0,n(659795).getGlobalTensorClass)().prototype.zerosLike=function(){return this.throwIfDisposed(),(0,r.zerosLike)(this)}},288462:(e,t,n)=>{"use strict";var r=n(329603),a=n(475269),o=n(751812),s=n(10939),i=n(239647),c=n(845702),l=n(152426),u=n(431980),d=n(193482),p=n(825051),h=n(526391),f=n(415553),m=n(137461),g=n(693700),y=n(671533),v=n(755898),b=n(456660),x=n(773650),w=n(3191),k=n(400735),_=n(87051),C=n(343182),P=n(895280),O=n(530415),N=n(674345),I=n(456481),T=n(751835),S=n(710410),E=n(692286),M=n(469161),A=n(305916),D=n(909222),R=n(500799),F=n(544049),j=n(302347),z=n(555780),L=n(864172),V=n(282934),G=n(629736),B=n(551393),W=n(123798),U=n(548672),q=n(666834),H=n(361043),K=n(129449),X=n(527927),Y=n(482275),Z=n(488982),J=n(890927),Q=n(434407),$=n(498125),ee=n(507833),te=n(162830),ne=n(728968),re=n(8650),ae=n(278329),oe=n(396329),se=n(189631),ie=n(318185),ce=n(250656),le=n(434104),ue=n(921968),de=n(806828),pe=n(265506),he=n(318527),fe=n(453368),me=n(814327),ge=n(47262),ye=n(747401),ve=n(4849),be=n(808556),xe=n(620590),we=n(362021),ke=n(202164),_e=n(440404),Ce=n(845099),Pe=n(439504),Oe=n(97527),Ne=n(761400),Ie=n(655358),Te=n(153813),Se=n(608890),Ee=n(956373),Me=n(664417),Ae=n(983560),De=n(579817),Re=n(472210),Fe=n(28325),je=n(496729),ze=n(639),Le=n(865669),Ve=n(710133),Ge=n(939660),Be=n(497690),We=n(273),Ue=n(116932),qe=n(980795),He=n(401850),Ke=n(932871),Xe=n(55858),Ye=n(115354);const Ze=[r.absGradConfig,a.acosGradConfig,o.acoshGradConfig,s.addGradConfig,i.addNGradConfig,c.argMaxGradConfig,l.argMinGradConfig,u.asinGradConfig,d.asinhGradConfig,p.atan2GradConfig,h.atanGradConfig,f.atanhGradConfig,m.avgPool3DGradConfig,g.avgPoolGradConfig,y.batchMatMulGradConfig,v.batchToSpaceNDGradConfig,b.broadcastToGradConfig,x.castGradConfig,w.ceilGradConfig,k.clipByValueGradConfig,_.complexAbsGradConfig,C.concatGradConfig,O.conv2DBackpropInputGradConfig,P.conv2DGradConfig,N.conv3DGradConfig,I.cosGradConfig,T.coshGradConfig,S.cumsumGradConfig,E.depthwiseConv2dNativeGradConfig,M.dilation2dGradConfig,me.divGradConfig,A.eluGradConfig,D.erfGradConfig,R.expGradConfig,F.expandDimsGradConfig,j.expm1GradConfig,L.floorDivGradConfig,z.floorGradConfig,V.fusedBatchNormGradConfig,G.gatherGradConfig,B.greaterEqualGradConfig,W.identityGradConfig,U.isFiniteGradConfig,q.isInfGradConfig,H.isNanGradConfig,K.leakyReluGradConfig,X.log1pGradConfig,Y.logGradConfig,Z.logSoftmaxGradConfig,J.lrnGradConfig,Q.maxGradConfig,Q.maxGradConfig,$.maximumGradConfig,ee.maxPool3DGradConfig,te.maxPoolGradConfig,ne.meanGradConfig,re.minGradConfig,ae.minimumGradConfig,oe.mirrorPadGradConfig,se.modGradConfig,ie.multiplyGradConfig,ce.negGradConfig,le.oneHotGradConfig,ue.onesLikeGradConfig,de.packGradConfig,pe.padV2GradConfig,pe.padV2GradConfig,he.powGradConfig,fe.preluGradConfig,ge.reciprocalGradConfig,ye.relu6GradConfig,ve.reluGradConfig,be.reshapeGradConfig,xe.resizeBilinearGradConfig,we.resizeNearestNeighborGradConfig,ke.reverseGradConfig,_e.roundGradConfig,Ce.rsqrtGradConfig,Pe.selectGradConfig,Oe.seluGradConfig,Ne.sigmoidGradConfig,Ie.signGradConfig,Te.sinGradConfig,Se.sinhGradConfig,Ee.sliceGradConfig,Me.softmaxGradConfig,Ae.softplusGradConfig,De.spaceToBatchNDGradConfig,De.spaceToBatchNDGradConfig,Re.splitVGradConfig,Re.splitVGradConfig,Fe.sqrtGradConfig,ze.squaredDifferenceGradConfig,je.squareGradConfig,Le.stepGradConfig,Ve.subGradConfig,Ge.
1sumGradConfig,Be.tanGradConfig,We.tanhGradConfig,Ue.tileGradConfig,qe.transposeGradConfig,He.unpackGradConfig,Ke.unsortedSegmentSumGradConfig,Xe.zerosLikeGradConfig];for(const e of Ze)(0,Ye.registerGradient)(e)},39037:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.SerializationMap=t.Serializable=void 0,t.registerClass=function(e){(0,r.assert)(null!=e.className,(()=>"Class being registered does not have the static className property defined.")),(0,r.assert)("string"==typeof e.className,(()=>"className is required to be a string, but got type "+typeof e.className)),(0,r.assert)(e.className.length>0,(()=>"Class being registered has an empty-string as its className, which is disallowed.")),a.register(e)};var r=n(904737);t.Serializable=class{getClassName(){return this.constructor.className}static fromConfig(e,t){return new e(t)}};class a{constructor(){this.classNameMap={}}static getMap(){return null==a.instance&&(a.instance=new a),a.instance}static register(e){a.getMap().classNameMap[e.className]=[e,e.fromConfig]}}t.SerializationMap=a},397669:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.backpropagateGradients=function(e,t,n,a){for(let o=t.length-1;o>=0;o--){const s=t[o],i=[];if(s.outputs.forEach((t=>{const n=e[t.id];null!=n?i.push(n):i.push(null)})),null==s.gradient)throw new Error("Cannot compute gradient: gradient function not found "+"for ".concat(s.kernelName,"."));const c=s.gradient(i);for(const t in s.inputs){if(!(t in c))throw new Error("Cannot backprop through input ".concat(t,". ")+"Available gradients found: ".concat(Object.keys(c),"."));const o=n((()=>c[t]()));if("float32"!==o.dtype)throw new Error("Error in gradient for op ".concat(s.kernelName,". The gradient of input ")+"".concat(t," must have 'float32' dtype, but has '").concat(o.dtype,"'"));const i=s.inputs[t];if(!r.arraysEqual(o.shape,i.shape))throw new Error("Error in gradient for op ".concat(s.kernelName,". The gradient of input ")+"'".concat(t,"' has shape '").concat(o.shape,"', which does not match ")+"the shape of the input '".concat(i.shape,"'"));if(null==e[i.id])e[i.id]=o;else{const t=e[i.id];e[i.id]=a(t,o),t.dispose()}}}},t.getFilteredNodesXToY=function(e,t,n){const r={},a={};for(let e=0;e<t.length;e++)r[t[e].id]=!0;for(let n=0;n<e.length;n++){const o=e[n],s=o.inputs;for(const e in s){const n=s[e];let i=!1;for(let e=0;e<t.length;e++)if(r[n.id]){o.outputs.forEach((e=>r[e.id]=!0)),i=!0,a[o.id]=!0;break}if(i)break}}const o={};o[n.id]=!0;const s={};for(let t=e.length-1;t>=0;t--){const n=e[t],r=n.inputs;for(let e=0;e<n.outputs.length;e++)if(o[n.outputs[e].id]){for(const e in r)o[r[e].id]=!0,s[n.id]=!0;break}}const i=[];for(let t=0;t<e.length;t++){const n=e[t];if(a[n.id]&&s[n.id]){const e={};for(const t in n.inputs){const a=n.inputs[t];r[a.id]&&(e[t]=a)}const t=Object.assign({},n);t.inputs=e,t.outputs=n.outputs,i.push(t)}}return i};var r=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=a(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var s in e)if("default"!==s&&{}.hasOwnProperty.call(e,s)){var i=o?Object.getOwnPropertyDescriptor(e,s):null;i&&(i.get||i.set)?Object.defineProperty(r,s,i):r[s]=e[s]}return r.default=e,n&&n.set(e,r),r}(n(904737));function a(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(a=function(e){return e?n:t})(e)}},659795:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Variable=t.TensorBuffer=t.Tensor=void 0,t.getGlobalTensorClass=p,t.setDeprecationWarningFn=function(e){u=e},t.setOpHandler=function(e){l=e},t.setTensorTracker=function(e){c=e};var r=n(923788),a=n(590693),o=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=i(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if("default"!==o&&{}.hasOwnProperty.call(e,o)){var s=a?Object.getOwnPropertyDescriptor(e,o):null;s&&(s.get||s.set)?Object.defineProperty(r,o,s):r[o]=e[o]}return r.default=e,n&&n.set(e,r),r}(n(904737)),s=o;function i(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(i=function(e){return e?n:t})(e)}t.TensorBuffer=class{constructor(e,t,n){if(this.dtype=t,this.shape=e.slice(),this.size=s.sizeFromShape(e),null!=n){const e=n.length;s.assert(e===this.size,(()=>"Length of values '".concat(e,"' does not match the size ")+"inferred by the shape '".concat(this.size,"'.")))}if("complex64"===t)throw new Error("complex64 dtype TensorBuffers are not supported. Please create a TensorBuffer for the real and imaginary parts separately and call tf.complex(real, imag).");this.values=n||s.getArrayFromDType(t,this.size),this.strides=(0,o.computeStrides)(e)}set(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];0===n.length&&(n=[0]),s.assert(n.length===this.rank,(()=>"The number of provided coordinates (".concat(n.length,") must ")+"match the rank (".concat(this.rank,")")));const a=this.locToIndex(n);this.values[a]=e}get(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];0===t.length&&(t=[0]);let r=0;for(const e of t){if(e<0||e>=this.shape[r]){const e="Requested out of range element at ".concat(t,". ")+" Buffer shape=".concat(this.shape);throw new Error(e)}r++}let a=t[t.length-1];for(let e=0;e<t.length-1;++e)a+=this.strides[e]*t[e];return this.values[a]}locToIndex(e){if(0===this.rank)return 0;if(1===this.rank)return e[0];let t=e[e.length-1];for(let n=0;n<e.length-1;++n)t+=this.strides[n]*e[n];return t}indexToLoc(e){if(0===this.rank)return[];if(1===this.rank)return[e];const t=new Array(this.shape.length);for(let n=0;n<t.length-1;++n)t[n]=Math.floor(e/this.strides[n]),e-=t[n]*this.strides[n];return t[t.length-1]=e,t}get rank(){return this.shape.length}toTensor(){return c().makeTensor(this.values,this.shape,this.dtype)}};let c=null,l=null,u=null;class d{constructor(e,t,n,r){this.kept=!1,this.isDisposedInternal=!1,this.shape=e.slice(),this.dtype=t||"float32",this.size=s.sizeFromShape(e),this.strides=(0,o.computeStrides)(e),this.dataId=n,this.id=r,this.rankType=this.rank<5?this.rank.toString():"higher"}get rank(){return this.shape.length}async buffer(){const e=await this.data();return l.buffer(this.shape,this.dtype,e)}bufferSync(){return l.buffer(this.shape,this.dtype,this.dataSync())}async array(){const e=await this.data();return(0,o.toNestedArray)(this.shape,e,"complex64"===this.dtype)}arraySync(){return(0,o.toNestedArray)(this.shape,this.dataSync(),"complex64"===this.dtype)}async data(){this.throwIfDisposed();const e=c().read(this.dataId);if("string"===this.dtype){const t=await e;
1try{return t.map((e=>s.decodeString(e)))}catch(e){throw new Error("Failed to decode the string bytes into utf-8. To get the original bytes, call tensor.bytes().")}}return e}dataToGPU(e){return this.throwIfDisposed(),c().readToGPU(this.dataId,e)}dataSync(){this.throwIfDisposed();const e=c().readSync(this.dataId);if("string"===this.dtype)try{return e.map((e=>s.decodeString(e)))}catch(e){throw new Error("Failed to decode the string bytes into utf-8. To get the original bytes, call tensor.bytes().")}return e}async bytes(){this.throwIfDisposed();const e=await c().read(this.dataId);return"string"===this.dtype?e:new Uint8Array(e.buffer)}dispose(){this.isDisposed||(c().disposeTensor(this),this.isDisposedInternal=!0)}get isDisposed(){return this.isDisposedInternal}throwIfDisposed(){if(this.isDisposed)throw new Error("Tensor is disposed.")}print(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return l.print(this,e)}clone(){return this.throwIfDisposed(),l.clone(this)}toString(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];const t=this.dataSync();return(0,a.tensorToString)(t,this.shape,this.dtype,e)}cast(e){return this.throwIfDisposed(),l.cast(this,e)}variable(){let e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],t=arguments.length>1?arguments[1]:void 0,n=arguments.length>2?arguments[2]:void 0;return this.throwIfDisposed(),c().makeVariable(this,e,t,n)}}function p(){return(0,r.getGlobal)("Tensor",(()=>d))}t.Tensor=d,Object.defineProperty(d,Symbol.hasInstance,{value:e=>!!e&&null!=e.data&&null!=e.dataSync&&null!=e.throwIfDisposed}),p();class h extends d{constructor(e,t,n,r){super(e.shape,e.dtype,e.dataId,r),this.trainable=t,this.name=n}assign(e){if(e.dtype!==this.dtype)throw new Error("dtype of the new value (".concat(e.dtype,") and ")+"previous value (".concat(this.dtype,") must match"));if(!s.arraysEqual(e.shape,this.shape))throw new Error("shape of the new value (".concat(e.shape,") and ")+"previous value (".concat(this.shape,") must match"));c().disposeTensor(this),this.dataId=e.dataId,c().incRef(this,null)}dispose(){c().disposeVariable(this),this.isDisposedInternal=!0}}t.Variable=h,Object.defineProperty(h,Symbol.hasInstance,{value:e=>e instanceof d&&null!=e.assign&&e.assign instanceof Function})},590693:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.tensorToString=function(e,t,n,a){const o=(0,r.computeStrides)(t),s=function(e,t,n,a){const o=(0,r.sizeFromShape)(t),s=a[a.length-1],c=new Array(s).fill(0),l=t.length,d="complex64"===n?u(e):e;if(l>1)for(let e=0;e<o/s;e++){const t=e*s;for(let e=0;e<s;e++)c[e]=Math.max(c[e],i(d[t+e],0,n).length)}return c}(e,t,n,o),c=t.length,d=l(e,t,n,o,s),p=["Tensor"];a&&(p.push(" dtype: ".concat(n)),p.push(" rank: ".concat(c)),p.push(" shape: [".concat(t,"]")),p.push(" values:"));return p.push(d.map((e=>" "+e)).join("\n")),p.join("\n")};var r=n(904737);const a=20,o=3,s=7;function i(e,t,n){let a;return a=Array.isArray(e)?"".concat(parseFloat(e[0].toFixed(s))," + ")+"".concat(parseFloat(e[1].toFixed(s)),"j"):(0,r.isString)(e)?"'".concat(e,"'"):"bool"===n?c(e):parseFloat(e.toFixed(s)).toString(),(0,r.rightPad)(a,t)}function c(e){return 0===e?"false":"true"}function l(e,t,n,r,s){let d=!(arguments.length>5&&void 0!==arguments[5])||arguments[5];const p="complex64"===n?2:1,h=t[0],f=t.length;if(0===f){if("complex64"===n){return[i(u(e)[0],0,n)]}return"bool"===n?[c(e[0])]:[e[0].toString()]}if(1===f){if(h>a){const t=o*p;let r=Array.from(e.slice(0,t)),a=Array.from(e.slice((h-o)*p,h*p));return"complex64"===n&&(r=u(r),a=u(a)),["["+r.map(((e,t)=>i(e,s[t],n))).join(", ")+", ..., "+a.map(((e,t)=>i(e,s[h-o+t],n))).join(", ")+"]"]}return["["+("complex64"===n?u(e):Array.from(e)).map(((e,t)=>i(e,s[t],n))).join(", ")+"]"]}const m=t.slice(1),g=r.slice(1),y=r[0]*p,v=[];if(h>a){for(let t=0;t<o;t++){const r=t*y,a=r+y;v.push(...l(e.slice(r,a),m,n,g,s,!1))}v.push("...");for(let t=h-o;t<h;t++){const r=t*y,a=r+y;v.push(...l(e.slice(r,a),m,n,g,s,t===h-1))}}else for(let t=0;t<h;t++){const r=t*y,a=r+y;v.push(...l(e.slice(r,a),m,n,g,s,t===h-1))}const b=2===f?",":"";v[0]="["+v[0]+b;for(let e=1;e<v.length-1;e++)v[e]=" "+v[e]+b;let x=",\n";for(let e=2;e<f;e++)x+="\n";
1return v[v.length-1]=" "+v[v.length-1]+"]"+(d?"":x),v}function u(e){const t=[];for(let n=0;n<e.length;n+=2)t.push([e[n],e[n+1]]);return t}},390771:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.assertTypesMatch=function(e,t){(0,o.assert)(e.dtype===t.dtype,(()=>"The dtypes of the first(".concat(e.dtype,") and")+" second(".concat(t.dtype,") input must match")))},t.getTensorsInContainer=function(e){const t=[],n=new Set;return s(e,t,n),t},t.isTensorInList=function(e,t){return t.some((t=>t.id===e.id))},t.makeTypesMatch=function(e,t){if(e.dtype===t.dtype)return[e,t];const n=(0,a.upcastType)(e.dtype,t.dtype);return[e.cast(n),t.cast(n)]};var r=n(659795),a=n(649781),o=n(904737);function s(e,t,n){if(null==e)return;if(e instanceof r.Tensor)return void t.push(e);if(a=e,!Array.isArray(a)&&"object"!=typeof a)return;var a;const o=e;for(const e in o){const r=o[e];n.has(r)||(n.add(r),s(r,t,n))}}},188695:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.convertToTensor=u,t.convertToTensorArray=function(e,t,n){let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"numeric";if(!Array.isArray(e))throw new Error("Argument ".concat(t," passed to ").concat(n," must be a ")+"`Tensor[]` or `TensorLike[]`");return e.map(((e,a)=>u(e,"".concat(t,"[").concat(a,"]"),n,r)))},t.inferShape=i;var r=n(90337),a=n(598257),o=n(659795),s=n(904737);function i(e,t){let n=e;if((0,s.isTypedArray)(e))return"string"===t?[]:[e.length];if(!Array.isArray(e))return[];const r=[];for(;Array.isArray(n)||(0,s.isTypedArray)(n)&&"string"!==t;)r.push(n.length),n=n[0];return Array.isArray(e)&&(0,a.env)().getBool("TENSORLIKE_CHECK_SHAPE_CONSISTENCY")&&c(e,r,[]),r}function c(e,t,n){if(n=n||[],!Array.isArray(e)&&!(0,s.isTypedArray)(e))return void(0,s.assert)(0===t.length,(()=>"Element arr[".concat(n.join("]["),"] is a primitive, ")+"but should be an array/TypedArray of ".concat(t[0]," elements")));(0,s.assert)(t.length>0,(()=>"Element arr[".concat(n.join("]["),"] should be a primitive, ")+"but is an array of ".concat(e.length," elements"))),(0,s.assert)(e.length===t[0],(()=>"Element arr[".concat(n.join("]["),"] should have ").concat(t[0]," ")+"elements, but has ".concat(e.length," elements")));const r=t.slice(1);for(let t=0;t<e.length;++t)c(e[t],r,n.concat(t))}function l(e,t,n,r){if("string_or_numeric"!==e){if(null==e)throw new Error("Expected dtype cannot be null.");if("numeric"!==e&&e!==t||"numeric"===e&&"string"===t)throw new Error("Argument '".concat(n,"' passed to '").concat(r,"' must ")+"be ".concat(e," tensor, but got ").concat(t," tensor"))}}function u(e,t,n){let a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"numeric";if(e instanceof o.Tensor)return l(a,e.dtype,t,n),e;let c=(0,s.inferDtype)(e);if("string"!==c&&["bool","int32","float32"].indexOf(a)>=0&&(c=a),l(a,c,t,n),null==e||!(0,s.isTypedArray)(e)&&!Array.isArray(e)&&"number"!=typeof e&&"boolean"!=typeof e&&"string"!=typeof e){const r=null==e?"null":e.constructor.name;throw new Error("Argument '".concat(t,"' passed to '").concat(n,"' must be a ")+"Tensor or TensorLike, but got '".concat(r,"'"))}const u=i(e,c);(0,s.isTypedArray)(e)||Array.isArray(e)||(e=[e]);const d="string"!==c?(0,s.toTypedArray)(e,c):(0,s.flatten)(e,[],!0);return r.ENGINE.makeTensor(d,u,c)}},248849:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.TEST_EPSILON_FLOAT16=void 0,t.encodeStrings=function e(t){for(let n=0;n<t.length;n++){const r=t[n];Array.isArray(r)?e(r):t[n]=(0,o.encodeString)(r)}return t},t.expectArrayBuffersEqual=function(e,t){const n=new Float32Array(e),r=new Float32Array(t);if(n.length!==r.length)throw new Error("Expected ArrayBuffer to be of length "+"".concat(r.length,", but it was ").concat(n.length));for(let e=0;e<r.length;e++)if(n[e]!==r[e])throw new Error("Expected ArrayBuffer value at ".concat(e," to be ")+"".concat(r[e]," but got ").concat(n[e]," instead"))},t.expectArraysClose=function(e,t,n){null==n&&(n=c());return l(e,t,((e,t)=>u(e,t,n)))},t.expectArraysEqual=function(e,t){const n="string"==typeof t||"number"==typeof t||"boolean"==typeof t?[t]:t;if((0,o.isString)(e)||(0,o.isString)(e[0])||(0,o.isString)(t)||(0,o.isString)(t[0]))return l(e,n,((e,t)=>e==t));return l(e,t,((e,t)=>
1u(e,t,0)))},t.expectNumbersClose=function(e,t,n){null==n&&(n=c());if(!u(e,t,n))throw new Error("Numbers differ: actual === ".concat(e,", expected === ").concat(t))},t.expectPromiseToFail=function(e,t){e().then((()=>t.fail()),(()=>t()))},t.expectValuesInRange=function(e,t,n){for(let r=0;r<e.length;r++)if(e[r]<t||e[r]>n)throw new Error("Value out of range:".concat(e[r]," low: ").concat(t,", high: ").concat(n))},t.testEpsilon=c;var r=n(90337),a=n(188695),o=n(904737);const s=.001,i=t.TEST_EPSILON_FLOAT16=.1;function c(){return 32===r.ENGINE.backend.floatPrecision()?s:i}function l(e,t,n){let r=!0;if(((0,o.isTypedArray)(e)||(0,o.isTypedArray)(t))&&(r=!1),(0,o.isTypedArray)(e)&&(0,o.isTypedArray)(t)&&(r=!0),r){const n=e.constructor.name,r=t.constructor.name;if(n!==r)throw new Error("Arrays are of different type. Actual: ".concat(n,". ")+"Expected: ".concat(r))}if(Array.isArray(e)&&Array.isArray(t)){const n=(0,a.inferShape)(e),r=(0,a.inferShape)(t);if(!(0,o.arraysEqual)(n,r))throw new Error("Arrays have different shapes. "+"Actual: [".concat(n,"]. Expected: [").concat(r,"]"))}const s=(0,o.isTypedArray)(e)?e:(0,o.flatten)(e),i=(0,o.isTypedArray)(t)?t:(0,o.flatten)(t);if(s.length!==i.length)throw new Error("Arrays have different lengths actual: ".concat(s.length," vs ")+"expected: ".concat(i.length,".\n")+"Actual: ".concat(s,".\n")+"Expected: ".concat(i,"."));for(let e=0;e<i.length;++e){const t=s[e],r=i[e];if(!n(t,r))throw new Error("Arrays differ: actual[".concat(e,"] = ").concat(t,", expected[").concat(e,"] = ").concat(r,".\n")+"Actual: ".concat(s,".\n")+"Expected: ".concat(i,"."))}}function u(e,t,n){return!isFinite(e)&&!isFinite(t)||!(isNaN(e)||isNaN(t)||Math.abs(e-t)>n)}},70343:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.train=void 0;var r=n(538885),a=n(499678),o=n(947007),s=n(119673),i=n(81424),c=n(472732),l=n(452951),u=n(475231);i.MomentumOptimizer,u.SGDOptimizer,r.AdadeltaOptimizer,a.AdagradOptimizer,l.RMSPropOptimizer,s.AdamaxOptimizer,o.AdamOptimizer;t.train={sgd:c.OptimizerConstructors.sgd,momentum:c.OptimizerConstructors.momentum,adadelta:c.OptimizerConstructors.adadelta,adagrad:c.OptimizerConstructors.adagrad,rmsprop:c.OptimizerConstructors.rmsprop,adamax:c.OptimizerConstructors.adamax,adam:c.OptimizerConstructors.adam}},649781:(e,t)=>{"use strict";var n,r,a,o,s;Object.defineProperty(t,"__esModule",{value:!0}),t.Rank=void 0,t.sumOutType=function(e){return c(e,"int32")},t.upcastType=c,function(e){e.R0="R0",e.R1="R1",e.R2="R2",e.R3="R3",e.R4="R4",e.R5="R5",e.R6="R6"}(n||(t.Rank=n={})),function(e){e.float32="float32",e.int32="int32",e.bool="int32",e.complex64="complex64"}(r||(r={})),function(e){e.float32="float32",e.int32="int32",e.bool="bool",e.complex64="complex64"}(a||(a={})),function(e){e.float32="float32",e.int32="float32",e.bool="float32",e.complex64="complex64"}(o||(o={})),function(e){e.float32="complex64",e.int32="complex64",e.bool="complex64",e.complex64="complex64"}(s||(s={}));const i={float32:o,int32:r,bool:a,complex64:s};function c(e,t){if("string"===e||"string"===t){if("string"===e&&"string"===t)return"string";throw new Error("Can not upcast ".concat(e," with ").concat(t))}return i[e][t]}},904737:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r={createScalarValue:!0,toTypedArray:!0,now:!0,fetch:!0,encodeString:!0,decodeString:!0};t.createScalarValue=function(e,t){if("string"===t)return l(e);return c([e],t)},t.decodeString=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"utf-8";return t=t||"utf-8",(0,a.env)().platform.decode(e,t)},t.encodeString=l,t.fetch=function(e,t){return(0,a.env)().platform.fetch(e,t)},t.now=function(){return(0,a.env)().platform.now()},t.toTypedArray=c;var a=n(598257),o=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=i(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if("default"!==o&&{}.hasOwnProperty.call(e,o)){var s=a?Object.getOwnPropertyDescriptor(e,o):null;s&&(s.get||s.set)?Object.defineProperty(r,o,s):r[o]=e[o]}return r.default=e,n&&n.set(e,r),r}(n(542393));
1Object.keys(o).forEach((function(e){"default"!==e&&"__esModule"!==e&&(Object.prototype.hasOwnProperty.call(r,e)||e in t&&t[e]===o[e]||Object.defineProperty(t,e,{enumerable:!0,get:function(){return o[e]}}))}));var s=n(474757);function i(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(i=function(e){return e?n:t})(e)}function c(e,t){if("string"===t)throw new Error("Cannot convert a string[] to a TypedArray");if(Array.isArray(e)&&(e=o.flatten(e)),(0,a.env)().getBool("DEBUG")&&o.checkConversionForErrors(e,t),function(e,t){return e instanceof Float32Array&&"float32"===t||e instanceof Int32Array&&"int32"===t||e instanceof Uint8Array&&"bool"===t}(e,t))return e;if(null==t||"float32"===t||"complex64"===t)return new Float32Array(e);if("int32"===t)return new Int32Array(e);if("bool"===t){const t=new Uint8Array(e.length);for(let n=0;n<t.length;++n)0!==Math.round(e[n])&&(t[n]=1);return t}throw new Error("Unknown data type ".concat(t))}function l(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"utf-8";return t=t||"utf-8",(0,a.env)().platform.encode(e,t)}Object.keys(s).forEach((function(e){"default"!==e&&"__esModule"!==e&&(Object.prototype.hasOwnProperty.call(r,e)||e in t&&t[e]===s[e]||Object.defineProperty(t,e,{enumerable:!0,get:function(){return s[e]}}))}))},542393:(e,t)=>{"use strict";function n(e){let t=e.length,n=0;for(;t>0;)n=Math.random()*t|0,t--,r(e,t,n)}function r(e,t,n){const r=e[t];e[t]=e[n],e[n]=r}function a(e,t){if(!e)throw new Error("string"==typeof t?t:t())}function o(e,t){if(e===t)return!0;if(null==e||null==t)return!1;if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function s(e){return e%1==0}function i(e,t){const n=t.length;return a((e=null==e?t.map(((e,t)=>t)):[].concat(e)).every((e=>e>=-n&&e<n)),(()=>"All values in axis param must be in range [-".concat(n,", ").concat(n,") but ")+"got axis ".concat(e))),a(e.every((e=>s(e))),(()=>"All values in axis param must be integers but "+"got axis ".concat(e))),e.map((e=>e<0?n+e:e))}function c(e){return e instanceof Float32Array||e instanceof Int32Array||e instanceof Uint8Array||e instanceof Uint8ClampedArray}function l(e){return"string"==typeof e||e instanceof String}function u(e){return"boolean"==typeof e}function d(e){return"number"==typeof e}function p(e,t,n){let r=arguments.length>3&&void 0!==arguments[3]&&arguments[3];const a=new Array;if(1===t.length){const o=t[0]*(r?2:1);for(let t=0;t<o;t++)a[t]=n[e+t]}else{const o=t[0],s=t.slice(1),i=s.reduce(((e,t)=>e*t))*(r?2:1);for(let t=0;t<o;t++)a[t]=p(e+t*i,s,n,r)}return a}function h(e,t){let n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(0===e.length)return t[0];const r=e.reduce(((e,t)=>e*t))*(n?2:1);if(0===r)return[];if(r!==t.length)throw new Error("[".concat(e,"] does not match the input size ").concat(t.length).concat(n?" for a complex tensor":"","."));return p(0,e,t,n)}function f(e,t){if(null==t||"float32"===t||"complex64"===t)return new Float32Array(e);if("int32"===t)return new Int32Array(e);if("bool"===t)return new Uint8Array(e);throw new Error("Unknown data type ".concat(t))}Object.defineProperty(t,"__esModule",{value:!0}),t.arraysEqual=o,t.assert=a,t.assertNonNegativeIntegerDimensions=function(e){e.forEach((t=>{a(Number.isInteger(t)&&t>=0,(()=>"Tensor must have a shape comprised of positive integers but got "+"shape [".concat(e,"].")))}))},t.assertNonNull=function(e){a(null!=e,(()=>"The input to the tensor constructor must be a non-null value."))},t.assertShapesMatch=function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";a(o(e,t),(()=>n+" Shapes ".concat(e," and ").concat(t," must match")))},t.bytesFromStringArray=function(e){if(null==e)return 0;let t=0;return e.forEach((e=>t+=e.length)),t},t.bytesPerElement=function(e){if("float32"===e||"int32"===e)return 4;if("complex64"===e)return 8;if("bool"===e)return 1;throw new Error("Unknown dtype ".concat(e))},t.checkConversionForErrors=function(e,t){for(let n=0;n<e.length;n++){const r=e[n];if(isNaN(r)||!isFinite(r))throw Error("A tensor of type ".concat(t," being uploaded contains ").concat(r,"."))}},t.clamp=function(e,t,n){return Math.max(e,Math.min(t,n))},t.computeStrides=function(e){const t=e.length;if(t<2)return[];const n=new Array(t-1);n[t-2]=e[t-1];for(let r=t-3;r>=0;--r)n[r]=n[r+1]*e[r+1];return n},t.createShuffledIndices=function(e){const t=new Uint32Array(e);for(let n=0;n<e;++n)t[n]=n;return n(t),t},t.distSquared=function(e,t){let n=0;for(let r=0;r<e.length;r++){const a=Number(e[r])-Number(t[r]);n+=a*a}return n},t.flatten=function e(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],r=arguments.length>2&&void 0!==arguments[2]&&arguments[2];null==n&&(n=[]);if(Array.isArray(t)||c(t)&&!r)for(let a=0;a<t.length;++a)e(t[a],n,r);else n.push(t);return n},t.getArrayFromDType=function(e,t){let n=null;if(null==e||"float32"===e)n=new Float32Array(t);else if("int32"===e)n=new Int32Array(t);else if("bool"===e)n=new Uint8Array(t);else{if("string"!==e)throw new Error("Unknown data type ".concat(e));n=new Array(t)}return n},t.getTypedArrayFromDType=function(e,t){let 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 ".concat(e));n=new Uint8Array(t)}return n},t.hasEncodingLoss=function(e,t){if("complex64"===t)return!1;if("float32"===t&&"complex64"!==e)return!1;if("int32"===t&&"float32"!==e&&"complex64"!==e)return!1;if("bool"===t&&"bool"===e)return!1;return!0},t.indexToLoc=function(e,t,n){if(0===t)return[];if(1===t)return[e];const r=new Array(t);for(let t=0;t<r.length-1;++t)r[t]=Math.floor(e/n[t]),e-=r[t]*n[t];return r[r.length-1]=e,r},t.inferDtype=function e(t){if(Array.isArray(t))return e(t[0]);if(t instanceof Float32Array)return"float32";if(t instanceof Int32Array||t instanceof Uint8Array||t instanceof Uint8ClampedArray)return"int32";if(d(t))return"float32";if(l(t))return"string";if(u(t))return"bool";return"float32"},t.inferFromImplicitShape=function(e,t){let n=1,r=-1;for(let t=0;t<e.length;++t)if(e[t]>=0)n*=e[t];else if(-1===e[t]){if(-1!==r)throw Error("Shapes can only have 1 implicit size. "+"Found -1 at dim ".concat(r," and dim ").concat(t));r=t}else if(e[t]<0)throw Error("Shapes can not be < 0. Found ".concat(e[t]," at dim ").concat(t));if(-1===r){if(t>0&&t!==n)throw Error("Size(".concat(t,") must match the product of shape ").concat(e));return e}if(0===n)throw Error("Cannot infer the missing size in [".concat(e,"] when ")+"there are 0 elements");if(t%n!=0)throw Error("The implicit shape can't be a fractional number. "+"Got ".concat(t," / ").concat(n));const a=e.slice();return a[r]=t/n,a},t.isBoolean=u,t.isFunction=function(e){return!!(e&&e.constructor&&e.call&&e.apply)},t.isInt=s,t.isNumber=d,t.isPromise=function(e){return e&&e.then&&"function"==typeof e.then},t.isScalarShape=function(e){return 0===e.length},t.isString=l,t.isTypedArray=c,t.isValidDtype=function(e){return"bool"===e||"complex64"===e||"float32"===e||"int32"===e||"string"===e},t.locToIndex=function(e,t,n){if(0===t)return 0;if(1===t)return e[0];let r=e[e.length-1];for(let t=0;t<e.length-1;++t)r+=n[t]*e[t];return r},t.makeOnesTypedArray=function(e,t){const n=f(e,t);for(let e=0;e<n.length;e++)n[e]=1;return n},t.makeZerosNestedTypedArray=function(e,t){const n=e.reduce(((e,t)=>e*t),1);if(null==t||"float32"===t)return h(e,new Float32Array(n));if("int32"===t)return h(e,new Int32Array(n));if("bool"===t)return h(e,new Uint8Array(n));throw new Error("Unknown data type ".concat(t))},t.makeZerosTypedArray=f,t.nearestDivisor=function(e,t){for(let n=t;n<e;++n)if(e%n==0)return n;return e},t.nearestLargerEven=function(e){return e%2==0?e:e+1},t.parseAxisParam=i,t.randUniform=function(e,t){const n=Math.random();return t*n+(1-n)*e},t.repeatedTry=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:e=>0,n=arguments.length>2?arguments[2]:void 0;return new Promise(((r,a)=>{let o=0;const s=()=>
1{if(e())return void r();o++;const i=t(o);null!=n&&o>=n?a():setTimeout(s,i)};s()}))},t.rightPad=function(e,t){if(t<=e.length)return e;return e+" ".repeat(t-e.length)},t.shuffle=n,t.shuffleCombo=function(e,t){if(e.length!==t.length)throw new Error("Array sizes must match to be shuffled together "+"First array length was ".concat(e.length)+"Second array length was ".concat(t.length));let n=e.length,a=0;for(;n>0;)a=Math.random()*n|0,n--,r(e,n,a),r(t,n,a)},t.sizeFromShape=function(e){if(0===e.length)return 1;let t=e[0];for(let n=1;n<e.length;n++)t*=e[n];return t},t.sizeToSquarishShape=function(e){const t=Math.ceil(Math.sqrt(e));return[t,Math.ceil(e/t)]},t.squeezeShape=function(e,t){const n=[],r=[],a=null!=t&&Array.isArray(t)&&0===t.length,o=null==t||a?null:i(t,e).sort();let s=0;for(let t=0;t<e.length;++t){if(null!=o){if(o[s]===t&&1!==e[t])throw new Error("Can't squeeze axis ".concat(t," since its dim '").concat(e[t],"' is not 1"));(null==o[s]||o[s]>t)&&1===e[t]&&(n.push(e[t]),r.push(t)),o[s]<=t&&s++}1!==e[t]&&(n.push(e[t]),r.push(t))}return{newShape:n,keptDims:r}},t.sum=function(e){let t=0;for(let n=0;n<e.length;n++)t+=e[n];return t},t.swap=r,t.tanh=function(e){if(null!=Math.tanh)return Math.tanh(e);if(e===1/0)return 1;if(e===-1/0)return-1;{const t=Math.exp(2*e);return(t-1)/(t+1)}},t.toNestedArray=h},102691:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.version=void 0;t.version="3.14.0"},457025:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Tanh=t.Swish=t.Softsign=t.Softplus=t.Softmax=t.Sigmoid=t.Selu=t.Relu6=t.Relu=t.Mish=t.LogSoftmax=t.Linear=t.HardSigmoid=t.Elu=t.Activation=void 0,t.deserializeActivation=C,t.getActivation=function(e){if(null==e){const e={className:"linear",config:{}};return C(e)}if("string"==typeof e){const t={};return t.className=e,t.config={},C(t)}return e instanceof l?e:C(e)},t.serializeActivation=function(e){return e.getClassName()};var r=c(n(735534)),a=r,o=c(n(984710)),s=n(986904);function i(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(i=function(e){return e?n:t})(e)}function c(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=i(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if("default"!==o&&{}.hasOwnProperty.call(e,o)){var s=a?Object.getOwnPropertyDescriptor(e,o):null;s&&(s.get||s.set)?Object.defineProperty(r,o,s):r[o]=e[o]}return r.default=e,n&&n.set(e,r),r}class l extends r.serialization.Serializable{getConfig(){return{}}}t.Activation=l;class u extends l{apply(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return o.elu(e,t)}}t.Elu=u,u.className="elu",r.serialization.registerClass(u);class d extends l{apply(e){return a.selu(e)}}t.Selu=d,d.className="selu",r.serialization.registerClass(d);class p extends l{apply(e){return a.relu(e)}}t.Relu=p,p.className="relu",r.serialization.registerClass(p);class h extends l{apply(e){return(0,r.tidy)((()=>a.minimum(6,a.relu(e))))}}t.Relu6=h,h.className="relu6",r.serialization.registerClass(h);class f extends l{apply(e){return e}}t.Linear=f,f.className="linear",r.serialization.registerClass(f);class m extends l{apply(e){return a.sigmoid(e)}}t.Sigmoid=m,m.className="sigmoid",r.serialization.registerClass(m);class g extends l{apply(e){return o.hardSigmoid(e)}}t.HardSigmoid=g,g.className="hardSigmoid",r.serialization.registerClass(g);class y extends l{apply(e){return a.softplus(e)}}t.Softplus=y,y.className="softplus",r.serialization.registerClass(y);class v extends l{apply(e){return o.softsign(e)}}t.Softsign=v,v.className="softsign",r.serialization.registerClass(v);class b extends l{apply(e){return a.tanh(e)}}t.Tanh=b,b.className="tanh",r.serialization.registerClass(b);class x extends l{apply(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:-1;return a.softmax(e,t)}}t.Softmax=x,x.className="softmax",r.serialization.registerClass(x);class w extends l{apply(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:-1;return a.logSoftmax(e,t)}}t.LogSoftmax=w,w.className="logSoftmax",r.serialization.registerClass(w);class k extends l{apply(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return(0,r.tidy)((()=>a.mul(a.sigmoid(a.mul(e,t)),e)))}}t.Swish=k,k.className="swish",r.serialization.registerClass(k);class _ extends l{apply(e){return(0,r.tidy)((()=>a.mul(e,a.tanh(a.softplus(e)))))}}function C(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return(0,s.deserializeKerasObject)(e,r.serialization.SerializationMap.getMap().classNameMap,t,"activation")}t.Mish=_,_.className="mish",r.serialization.registerClass(_)},485246:(e,t,n)=>{"use strict";
1Object.defineProperty(t,"__esModule",{value:!0}),t.epsilon=function(){null==a&&(a=(0,r.backend)().epsilon());return a},t.imageDataFormat=function(){return"channelsLast"},t.setEpsilon=function(e){a=e};var r=n(735534);let a},284986:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getNextUniqueTensorId=function(){return n++},t.getUid=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";e in r||(r[e]=0);return r[e]+=1,e+r[e].toString()};let n=0;const r={}},984710:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.batchFlatten=function(e){if(e.rank<=1)throw new s.ValueError("batchFlatten requires a minimum rank of 2. Got rank: ".concat(e.rank,"."));const t=[e.shape[0],i.arrayProd(e.shape,1)];return a.reshape(e,t)},t.biasAdd=function(e,t,n){return(0,r.tidy)((()=>(null==n&&(n=(0,c.imageDataFormat)()),(0,o.checkDataFormat)(n),a.add(e,g(e.rank,t,n)))))},t.cast=function(e,t){return a.cast(e,t)},t.concatAlongFirstAxis=function(e,t){switch(e.rank){case 1:return a.concat1d([e,t]);case 2:return a.concat2d([e,t],0);case 3:return a.concat3d([e,t],0);case 4:return a.concat4d([e,t],0);default:throw new s.ValueError("concatAlongFirstAxis() received an unsupported "+"tensor rank: ".concat(e.rank))}},t.concatenate=function(e){let t,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:-1;n<0&&(t=e[0].rank,n=0!==t?t:0);n===e[0].rank&&(n=-1);return a.concat(e,n)},t.countParams=function(e){const t=e.shape;return t.length>0?t.reduce(((e,t)=>e*t)):1},t.dot=function(e,t,n,r){if(e.rank<2||t.rank<2)throw new s.NotImplementedError("dot requires both inputs to be rank >= 2"+" but got x shape = ".concat(e.shape," and y shape = ").concat(t.shape));if(t.rank>=3){if(e.shape.slice(-1)[0]!==t.shape.slice(-2)[0])throw new s.NotImplementedError("If rank y >= 3, then the second last dim"+" of y must equal the last dim of x but got x shape = ".concat(e.shape," and ")+" y shape = ".concat(t.shape))}if(2===e.rank&&2===t.rank){const o=!1,s=!1;return a.fused.matMul({a:e,b:t,transposeA:o,transposeB:s,bias:r?g(e.rank,r,(0,c.imageDataFormat)()):null,activation:n})}{const o=e.shape.slice(),s=o.pop();e=a.reshape(e,[-1,s]);const i=t.shape.slice(),l=i.pop(),u=i.pop(),d=[...i,l],p=Array.from({length:t.rank},((e,n)=>0===n?t.rank-2:n<=t.rank-2?n-1:n));t=a.reshape(a.transpose(t,p),[u,-1]);const h=[...o,...d],f=!1,m=!1;return a.reshape(a.fused.matMul({a:e,b:t,transposeA:f,transposeB:m,bias:r?g(e.rank,r,(0,c.imageDataFormat)()):null,activation:n}),h)}},t.dropout=function(e,t,n,o){return(0,r.tidy)((()=>a.dropout(e,t,n,o)))},t.elu=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;if(1!==t)throw new s.NotImplementedError("Support for alpha values other than 1 (".concat(t,") is not implemented ")+"yet.");return a.elu(e)},t.expandDims=p,t.flatten=function(e){const t=[i.arrayProd(e.shape)];return a.reshape(e,t)},t.gather=function(e,t,n){return(0,r.tidy)((()=>(t=Array.isArray(t)?(0,r.tensor1d)(t,"int32"):a.cast(t,"int32"),a.gather(e,t,n))))},t.getBackend=function(){return d},t.hardSigmoid=function(e){return(0,r.tidy)((()=>{const t=a.add(.5,a.mul(.2,e));return a.clipByValue(t,0,1)}))},t.inTrainPhase=function(e,t){return arguments.length>2&&void 0!==arguments[2]&&arguments[2]?e():t()},t.isBackendSymbolic=function(){return!1},t.oneHot=function(e,t){return(0,r.tidy)((()=>{if(1!==e.rank)throw new Error("Only 1D one-hot tensors are supported in the deeplearn backend, at present.");return e=a.cast(e,"int32"),a.cast(a.oneHot(e,t),"float32")}))},t.pow=function(e,t){return(0,r.tidy)((()=>{if("number"==typeof t&&(t=(0,r.scalar)(Math.round(t),"int32")),"int32"!==t.dtype)throw new s.NotImplementedError("Non-int32 dtype (".concat(t.dtype,") is not supported by pow() yet"));return a.pow(e,t)}))},t.randomNormal=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,r=arguments.length>3?arguments[3]:void 0,o=arguments.length>4?arguments[4]:void 0;return a.randomNormal(e,t,n,r,o)},t.repeat=function(e,t){return(0,r.tidy)((()=>{if(2!==e.shape.length)throw new s.ValueError("repeat() expects a rank-2 tensor, but received a "+"rank-".concat(e.shape.length," tensor."));return m(p(e,1),[1,t,1])}))},t.setBackend=function(e){a.setBackend(e),d=e},t.sign=function(e){return(0,r.tidy)((()=>{const t=(0,r.zerosLike)(e),n=(0,r.onesLike)(e);return(0,r.where)(a.equal(e,t),t,(0,r.where)(a.greater(e,(0,r.zerosLike)(e)),n,a.mul(-1,n)))}))},t.sliceAlongAxis=function(e,t,n,o){return(0,r.tidy)((()=>{switch(e.rank){case 1:return a.slice1d(e,t,n);case 2:switch(o){case 1:return h(e,t,n);case 2:return f(e,t,n);default:throw new s.ValueError("The axis is not within the rank of the tensor "+"".concat(o))}case 3:switch(o){case 1:return h(e,t,n);case 2:return a.slice3d(e,[0,t,0],[e.shape[0],n,e.shape[2]]);case 3:return f(e,t,n);default:throw new s.ValueError("The axis is not within the rank of the tensor "+"".concat(o))}case 4:switch(o){case 1:return h(e,t,n);case 2:return a.slice4d(e,[0,t,0,0],[e.shape[0],n,e.shape[2],e.shape[3]]);case 3:return a.slice4d(e,[0,0,t,0],[e.shape[0],e.shape[1],n,e.shape[3]]);case 4:return f(e,t,n);default:throw new s.ValueError("The axis is not within the rank of the tensor "+"".concat(o))}default:throw new s.ValueError("sliceAlongLastAxis() received an unsupported tensor rank: "+"".concat(e.rank))}}))},t.sliceAlongFirstAxis=h,t.sliceAlongLastAxis=f,t.softsign=function(e){return(0,r.tidy)((()=>a.div(e,a.add(a.abs(e),1))))},t.square=function(e){return a.mul(e,e)},t.tile=m;
1var r=u(n(735534)),a=r,o=n(545188),s=n(608012),i=u(n(302774)),c=n(485246);function l(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(l=function(e){return e?n:t})(e)}function u(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=l(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if("default"!==o&&{}.hasOwnProperty.call(e,o)){var s=a?Object.getOwnPropertyDescriptor(e,o):null;s&&(s.get||s.set)?Object.defineProperty(r,o,s):r[o]=e[o]}return r.default=e,n&&n.set(e,r),r}let d="webgl";function p(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:-1;const n=e.shape.slice();return t<0&&(t=n.length+t+1),n.splice(t,0,1),a.reshape(e,n)}function h(e,t,n){return(0,r.tidy)((()=>{switch(e.rank){case 1:return a.slice1d(e,t,n);case 2:return a.slice2d(e,[t,0],[n,e.shape[1]]);case 3:return a.slice3d(e,[t,0,0],[n,e.shape[1],e.shape[2]]);case 4:return a.slice4d(e,[t,0,0,0],[n,e.shape[1],e.shape[2],e.shape[3]]);case 5:return a.slice(e,[t,0,0,0,0],[n,e.shape[1],e.shape[2],e.shape[3],e.shape[4]]);case 6:return a.slice(e,[t,0,0,0,0,0],[n,e.shape[1],e.shape[2],e.shape[3],e.shape[4],e.shape[5]]);default:throw new s.ValueError("sliceAlongFirstAxis() received an unsupported tensor rank: "+"".concat(e.rank))}}))}function f(e,t,n){return(0,r.tidy)((()=>{switch(e.rank){case 1:return a.slice1d(e,t,n);case 2:return a.slice2d(e,[0,t],[e.shape[0],n]);case 3:return a.slice3d(e,[0,0,t],[e.shape[0],e.shape[1],n]);case 4:return a.slice4d(e,[0,0,0,t],[e.shape[0],e.shape[1],e.shape[2],n]);default:throw new s.ValueError("sliceAlongLastAxis() received an unsupported tensor rank: "+"".concat(e.rank))}}))}function m(e,t){if(Array.isArray(t)||(t=[t]),e.rank!==t.length)throw new s.ValueError("The length of input n (".concat(t.length,") does not match ")+"the number of dimensions in input x (".concat(e.rank,")"));return a.tile(e,t)}function g(e,t,n){const r=t.shape;if(1!==t.rank&&t.rank!==e)throw new s.ValueError("Unexpected bias dimensions: ".concat(t.rank)+"; expected it to be 1 or ".concat(e));if(5===e){if("channelsFirst"===n)return 1===r.length?a.reshape(t,[1,r[0],1,1,1]):a.reshape(t,[1,r[3],r[0],r[1],r[2]]);if("channelsLast"===n)return 1===r.length?a.reshape(t,[1,1,1,1,r[0]]):a.reshape(t,[1].concat(r))}else if(4===e){if("channelsFirst"===n)return 1===r.length?a.reshape(t,[1,r[0],1,1]):a.reshape(t,[1,r[2],r[0],r[1]]);if("channelsLast"===n)return 1===r.length?a.reshape(t,[1,1,1,r[0]]):a.reshape(t,[1].concat(r))}else if(3===e){if("channelsFirst"===n)return 1===r.length?a.reshape(t,[1,r[0],1]):a.reshape(t,[1,r[1],r[0]]);if("channelsLast"===n)return 1===r.length?a.reshape(t,[1,1,r[0]]):a.reshape(t,[1].concat(r))}else if(e<3)return t;throw new s.ValueError("Unsupported input rank by biasAdd: ".concat(t.rank))}},733680:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ModelLoggingVerbosity=t.History=t.DEFAULT_YIELD_EVERY_MS=t.CustomCallback=t.CallbackList=t.CallbackConstructorRegistry=t.BaseLogger=t.BaseCallback=void 0,t.configureCallbacks=function(e,t,n,r,a,o,s,i,c){const l=new h,u=[new p,...m.createCallbacks(t)];null!=e&&u.push(...e);u.push(l);const f=new d(u);return f.setParams({epochs:n,initialEpoch:r,samples:a,steps:o,batchSize:s,verbose:t,doValidation:i,metrics:c}),{callbackList:f,history:l}},t.standardizeCallbacks=function(e,t){null==e&&(e={});if(e instanceof u)return[e];if(Array.isArray(e)&&e[0]instanceof u)return e;return i.toList(e).map((e=>new f(e,t)))};var r,a=n(735534),o=n(608012),s=n(782668),i=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=c(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if("default"!==o&&{}.hasOwnProperty.call(e,o)){var s=a?Object.getOwnPropertyDescriptor(e,o):null;s&&(s.get||s.set)?Object.defineProperty(r,o,s):r[o]=e[o]}return r.default=e,n&&n.set(e,r),r}(n(986904));function c(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(c=function(e){return e?n:t})(e)}!function(e){e[e.SILENT=0]="SILENT",e[e.VERBOSE=1]="VERBOSE"}(r||(t.ModelLoggingVerbosity=r={}));const l=t.DEFAULT_YIELD_EVERY_MS=125;class u{constructor(){this.validationData=null}setParams(e){this.params=e}async onEpochBegin(e,t){}async onEpochEnd(e,t){}async onBatchBegin(e,t){}async onBatchEnd(e,t){}async onTrainBegin(e){}async onTrainEnd(e){}setModel(e){}}t.BaseCallback=u;class d{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:10;null==e&&(e=[]),this.callbacks=e,this.queueLength=t}append(e){this.callbacks.push(e)}setParams(e){for(const t of this.callbacks)t.setParams(e)}setModel(e){for(const t of this.callbacks)t.setModel(e)}async onEpochBegin(e,t){null==t&&(t={});for(const n of this.callbacks)await n.onEpochBegin(e,t)}async onEpochEnd(e,t){null==t&&(t={});for(const n of this.callbacks)await n.onEpochEnd(e,t)}async onBatchBegin(e,t){null==t&&(t={});for(const n of this.callbacks)await n.onBatchBegin(e,t)}async onBatchEnd(e,t){null==t&&(t={});for(const n of this.callbacks)await n.onBatchEnd(e,t)}async onTrainBegin(e){null==e&&(e={});for(const t of this.callbacks)await t.onTrainBegin(e)}async onTrainEnd(e){null==e&&(e={});for(const t of this.callbacks)await t.onTrainEnd(e)}}t.CallbackList=d;class p extends u{constructor(){super()}async onEpochBegin(e){this.seen=0,this.totals={}}async onBatchEnd(e,t){null==t&&(t={});const n=null==t.size?0:t.size;this.seen+=n;for(const e in t){const r=t[e];if("number"==typeof r)this.totals.hasOwnProperty(e)||(this.totals[e]=0),this.totals[e]=this.totals[e]+r*n;else{let t;e in this.totals?t=this.totals[e]:this.totals[e]=0;const o=(0,a.tidy)((()=>(0,a.add)(this.totals[e],(0,a.mul)(r,n))));
1this.totals[e]=o,null!=t&&t.dispose()}}}async onEpochEnd(e,t){if(null!=t)for(const e of this.params.metrics)null!=this.totals[e]&&("number"==typeof this.totals[e]?t[e]=this.totals[e]/this.seen:(0,a.tidy)((()=>{const n=(0,a.mul)((0,a.div)(1,this.seen),this.totals[e]);t[e]=n,this.totals[e].dispose(),(0,a.keep)(t[e])})))}}t.BaseLogger=p;class h extends u{async onTrainBegin(e){this.epoch=[],this.history={}}async onEpochEnd(e,t){null==t&&(t={}),this.epoch.push(e);for(const e in t)null==this.history[e]&&(this.history[e]=[]),this.history[e].push(t[e])}async syncData(){const e=[],t=[],n=[];for(const r in this.history){const a=this.history[r];for(let o=0;o<a.length;++o)if("number"!=typeof a[o]){const s=a[o];e.push(s.data()),t.push(r),n.push(o)}}const r=await Promise.all(e);for(let e=0;e<r.length;++e){this.history[t[e]][n[e]].dispose(),this.history[t[e]][n[e]]=r[e][0]}}}t.History=h;class f extends u{constructor(e,t){if(super(),this.currentEpoch=0,this.nowFunc=e.nowFunc,this.nextFrameFunc=e.nextFrameFunc||a.nextFrame,this.yieldEvery=t||"auto","auto"===this.yieldEvery&&(this.yieldEvery=l),"never"===this.yieldEvery&&null!=e.onYield)throw new Error("yieldEvery is `never` but you provided an `onYield` callback. Either change `yieldEvery` or remove the callback");a.util.isNumber(this.yieldEvery)&&(this.maybeWait=i.debounce(this.maybeWait.bind(this),this.yieldEvery,this.nowFunc)),this.trainBegin=e.onTrainBegin,this.trainEnd=e.onTrainEnd,this.epochBegin=e.onEpochBegin,this.epochEnd=e.onEpochEnd,this.batchBegin=e.onBatchBegin,this.batchEnd=e.onBatchEnd,this.yield=e.onYield}async maybeWait(e,t,n){const r=[];null!=this.yield&&(await(0,s.resolveScalarsInLogs)(n),r.push(this.yield(e,t,n))),r.push(this.nextFrameFunc()),await Promise.all(r)}async onEpochBegin(e,t){this.currentEpoch=e,null!=this.epochBegin&&(await(0,s.resolveScalarsInLogs)(t),await this.epochBegin(e,t))}async onEpochEnd(e,t){const n=[];null!=this.epochEnd&&(await(0,s.resolveScalarsInLogs)(t),n.push(this.epochEnd(e,t))),"epoch"===this.yieldEvery&&n.push(this.nextFrameFunc()),await Promise.all(n)}async onBatchBegin(e,t){null!=this.batchBegin&&(await(0,s.resolveScalarsInLogs)(t),await this.batchBegin(e,t))}async onBatchEnd(e,t){const n=[];null!=this.batchEnd&&(await(0,s.resolveScalarsInLogs)(t),n.push(this.batchEnd(e,t))),"batch"===this.yieldEvery?n.push(this.nextFrameFunc()):a.util.isNumber(this.yieldEvery)&&n.push(this.maybeWait(this.currentEpoch,e,t)),await Promise.all(n)}async onTrainBegin(e){null!=this.trainBegin&&(await(0,s.resolveScalarsInLogs)(e),await this.trainBegin(e))}async onTrainEnd(e){null!=this.trainEnd&&(await(0,s.resolveScalarsInLogs)(e),await this.trainEnd(e))}}t.CustomCallback=f;class m{constructor(){}static registerCallbackConstructor(e,t){a.util.assert(e>=0&&Number.isInteger(e),(()=>"Verbosity level is expected to be an integer >= 0, "+"but got ".concat(e))),m.checkForDuplicate(t),null==m.constructors[e]&&(m.constructors[e]=[]),m.constructors[e].push(t)}static checkForDuplicate(e){for(const t in m.constructors){m.constructors[+t].forEach((t=>{if(t===e)throw new o.ValueError("Duplicate callback constructor.")}))}}static clear(){m.constructors={}}static createCallbacks(e){const t=[];for(const n in m.constructors){const r=+n;e>=r&&t.push(...m.constructors[r])}return t.map((e=>new e))}}t.CallbackConstructorRegistry=m,m.constructors={}},299871:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.callbacks=t.EarlyStopping=t.Callback=void 0,t.earlyStopping=d;var r=n(733680),a=n(171320),o=n(608012),s=n(782668);class i extends r.BaseCallback{constructor(){super(...arguments),this.model=null}setModel(e){if(!(e instanceof a.LayersModel))throw new Error("model must be a LayersModel, not some other Container");this.model=e}}function c(e,t){return e<t}function l(e,t){return e>t}t.Callback=i;class u extends i{constructor(e){if(super(),null==e&&(e={}),e.restoreBestWeights)throw new o.NotImplementedError("restoreBestWeights = True is not implemented in EarlyStopping yet.");this.monitor=e.monitor||"val_loss",this.minDelta=Math.abs(e.minDelta||0),this.patience=e.patience||0,this.verbose=e.verbose||0,this.mode=e.mode||"auto",this.baseline=e.baseline,-1===["auto","min","max"].indexOf(this.mode)&&(console.warn("EarlyStopping mode '".concat(this.mode,"' is invali
1d. ")+"Falling back to mode 'auto'."),this.mode="auto"),"min"===this.mode?this.monitorFunc=c:"max"===this.mode||-1!==this.monitor.indexOf("acc")?this.monitorFunc=l:this.monitorFunc=c,this.monitorFunc===c&&(this.minDelta*=-1)}async onTrainBegin(e){this.wait=0,this.stoppedEpoch=0,null!=this.baseline?this.best=this.baseline:this.best=this.monitorFunc===c?1/0:-1/0}async onEpochEnd(e,t){await(0,s.resolveScalarsInLogs)(t);const n=this.getMonitorValue(t);null!=n&&(this.monitorFunc(n-this.minDelta,this.best)?(this.best=n,this.wait=0):(this.wait++,this.wait>=this.patience&&(this.stoppedEpoch=e,this.model.stopTraining=!0)))}async onTrainEnd(e){this.stoppedEpoch>0&&this.verbose&&console.log("Epoch ".concat(this.stoppedEpoch,": early stopping."))}getMonitorValue(e){null==e&&(e={});const t=e[this.monitor];return null==t&&console.warn("Metric for EarlyStopping ".concat(this.monitor," is not available. ")+"Available metrics are: ".concat(Object.keys(e))),t}}function d(e){return new u(e)}t.EarlyStopping=u;t.callbacks={earlyStopping:d}},545188:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.checkDataFormat=function(e){(0,a.checkStringTypeUnionValue)(r.VALID_DATA_FORMAT_VALUES,"DataFormat",e)},t.checkInterpolationFormat=function(e){(0,a.checkStringTypeUnionValue)(r.VALID_INTERPOLATION_FORMAT_VALUES,"InterpolationFormat",e)},t.checkPaddingMode=function(e){(0,a.checkStringTypeUnionValue)(r.VALID_PADDING_MODE_VALUES,"PaddingMode",e)},t.checkPoolMode=function(e){(0,a.checkStringTypeUnionValue)(r.VALID_POOL_MODE_VALUES,"PoolMode",e)},t.getScopedTensorName=function(e){if(!l(e))throw new Error("Not a valid tensor name: '"+e+"'");return(0===s.length?"":s.join(i)+i)+e},t.getUniqueTensorName=function(e){if(!l(e))throw new Error("Not a valid tensor name: '"+e+"'");o.has(e)||o.set(e,0);const t=o.get(e);if(o.set(e,o.get(e)+1),t>0){const n="".concat(e,"_").concat(t);return o.set(n,1),n}return e},t.isValidTensorName=l,t.nameScope=function(e,t){s.push(e);try{const e=t();return s.pop(),e}catch(e){throw s.pop(),e}};var r=n(940826),a=n(986904);const o=new Map;const s=[],i="/";const c=new RegExp(/^[A-Za-z0-9][-A-Za-z0-9\._\/]*$/);function l(e){return!!e.match(c)}},87475:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.UnitNorm=t.NonNeg=t.MinMaxNorm=t.MaxNorm=t.Constraint=t.CONSTRAINT_IDENTIFIER_REGISTRY_SYMBOL_MAP=void 0,t.deserializeConstraint=m,t.getConstraint=function(e){if(null==e)return null;if("string"==typeof e){return m({className:e in f?f[e]:e,config:{}})}return e instanceof l?e:m(e)},t.serializeConstraint=function(e){return(0,s.serializeKerasObject)(e)};var r=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=i(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if("default"!==o&&{}.hasOwnProperty.call(e,o)){var s=a?Object.getOwnPropertyDescriptor(e,o):null;s&&(s.get||s.set)?Object.defineProperty(r,o,s):r[o]=e[o]}return r.default=e,n&&n.set(e,r),r}(n(735534)),a=r,o=n(485246),s=n(986904);function i(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(i=function(e){return e?n:t})(e)}function c(e,t){return(0,r.tidy)((()=>a.sqrt(a.sum(a.mul(e,e),t,!0))))}class l extends r.serialization.Serializable{getConfig(){return{}}}t.Constraint=l;class u extends l{constructor(e){super(),this.defaultMaxValue=2,this.defaultAxis=0,this.maxValue=null!=e.maxValue?e.maxValue:this.defaultMaxValue,this.axis=null!=e.axis?e.axis:this.defaultAxis}apply(e){return(0,r.tidy)((()=>{const t=c(e,this.axis),n=a.clipByValue(t,0,this.maxValue);return a.mul(e,a.div(n,a.add((0,o.epsilon)(),t)))}))}getConfig(){return{maxValue:this.maxValue,axis:this.axis}}}t.MaxNorm=u,u.className="MaxNorm",r.serialization.registerClass(u);class d extends l{constructor(e){super(),this.defaultAxis=0,this.axis=null!=e.axis?e.axis:this.defaultAxis}apply(e){return(0,r.tidy)((()=>a.div(e,a.add((0,o.epsilon)(),c(e,this.axis)))))}getConfig(){return{axis:this.axis}}}t.UnitNorm=d,d.className="UnitNorm",r.serialization.registerClass(d);class p extends l{apply(e){return a.relu(e)}}t.NonNeg=p,p.className="NonNeg",r.serialization.registerClass(p);class h extends l{constructor(e){super(),this.defaultMinValue=0,this.defaultMaxValue=1,this.defaultRate=1,this.defaultAxis=0,this.minValue=null!=e.minValue?e.minValue:this.defaultMinValue,this.maxValue=null!=e.maxValue?e.maxValue:this.defaultMaxValue,this.rate=null!=e.rate?e.rate:this.defaultRate,this.axis=null!=e.axis?e.axis:this.defaultAxis}apply(e){return(0,r.tidy)((()=>{const t=c(e,this.axis),n=a.add(a.mul(this.rate,a.clipByValue(t,this.minValue,this.maxValue)),a.mul(1-this.rate,t));return a.mul(e,a.div(n,a.add((0,o.epsilon)(),t)))}))}getConfig(){return{minValue:this.minValue,maxValue:this.maxValue,rate:this.rate,axis:this.axis}}}t.MinMaxNorm=h,h.className="MinMaxNorm",r.serialization.registerClass(h);const f=t.CONSTRAINT_IDENTIFIER_REGISTRY_SYMBOL_MAP={maxNorm:"MaxNorm",minMaxNorm:"MinMaxNorm",nonNeg
1:"NonNeg",unitNorm:"UnitNorm"};function m(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return(0,s.deserializeKerasObject)(e,r.serialization.SerializationMap.getMap().classNameMap,t,"constraint")}},457270:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Container=void 0;var r=n(735534),a=n(284986),o=n(608012),s=n(640153),i=g(n(986904)),c=n(290407),l=g(n(252518)),u=n(268778),d=n(480036),p=n(179842),h=n(310750),f=n(840889);function m(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(m=function(e){return e?n:t})(e)}function g(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=m(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if("default"!==o&&{}.hasOwnProperty.call(e,o)){var s=a?Object.getOwnPropertyDescriptor(e,o):null;s&&(s.get||s.set)?Object.defineProperty(r,o,s):r[o]=e[o]}return r.default=e,n&&n.set(e,r),r}class y extends f.Layer{constructor(e){if(super({}),this.containerNodes=new Set,this.name=e.name,null==this.name){const e=this.getClassName().toLowerCase();this.name=(0,a.getUid)(e)}if(this.supportsMasking=!1,this.trainable_=!0,Array.isArray(e.inputs)?this.inputs=e.inputs.slice():this.inputs=[e.inputs],Array.isArray(e.outputs)?this.outputs=e.outputs.slice():this.outputs=[e.outputs],i.unique(this.inputs).length!==this.inputs.length)throw new o.ValueError("The list of inputs passed to the model is redundant. All inputs should only appear once. Found: "+"".concat(this.inputs.map((e=>e.name))));i.unique(this.outputs).length!==this.outputs.length&&console.warn("The list of outputs passed to the model is redundant. All outputs should only appear once. Found: "+"".concat(this.outputs.map((e=>e.name)))),this.inputLayers=[],this.inputLayersNodeIndices=[],this.inputLayersTensorIndices=[],this.outputLayers=[],this.outputLayersNodeIndices=[],this.outputLayersTensorIndices=[],this.layers=[],this.internalContainerRefs=[];for(const e of this.outputs){const t=e.sourceLayer,n=e.nodeIndex,r=e.tensorIndex;this.outputLayers.push(t),this.outputLayersNodeIndices.push(n),this.outputLayersTensorIndices.push(r)}for(const e of this.inputs){const t=e.sourceLayer,n=e.nodeIndex,r=e.tensorIndex;i.assert(0===n,"input layer has >1 nodes"),i.assert(0===r,"input layer has >1 tensors"),this.inputLayers.push(t),this.inputLayersNodeIndices.push(n),this.inputLayersTensorIndices.push(r)}this.inputNames=[],this.outputNames=[],this.feedInputShapes=[],this.feedInputNames=[],this.feedOutputNames=[];for(let t=0;t<this.inputLayers.length;t++){const n=this.inputLayers[t];if(!(n instanceof h.InputLayer))throw new TypeError("Input layers to a LayersModel must be InputLayer objects. "+"Received inputs: ".concat(e.inputs,". ")+"Input ".concat(t," (0-based) originates ")+"from layer type ".concat(n.getClassName(),"."));this.inputNames.push(n.name),this.feedInputShapes.push(n.batchInputShape),this.feedInputNames.push(n.name)}for(const e of this.outputLayers)this.outputNames.push(e.name);this.internalInputShapes=this.inputs.map((e=>e.shape)),this.internalOutputShapes=this.outputs.map((e=>e.shape));const t={},n={},r={},s={},c={},l=[],u=(e,t,n,r,a,s)=>{null!=r&&null!=a&&null!=s||(r=e.sourceLayer,a=e.nodeIndex,s=e.tensorIndex);const i=r.inboundNodes[a];if(-1!==n.indexOf(i))throw new o.RuntimeError("The tensor ".concat(e.name,' at layer "').concat(r.name,'" ')+"is part of a cycle.");if(-1!==t.indexOf(i))return;this.containerNodes.add(y.nodeKey(r,a)),r.id in c||(c[r.id]=Object.keys(c).length),-1===n.indexOf(i)&&n.push(i);const d=i.inboundLayers.length;for(let e=0;e<d;e++){const r=i.inputTensors[e],a=i.inboundLayers[e],o=i.nodeIndices[e],s=i.tensorIndices[e];u(r,t,n,a,o,s)}for(t.push(i);n.indexOf(i)>=0;)n.splice(n.indexOf(i),1);l.push(i)},d=[],p=[];for(const e of this.outputs)u(e,d,p);const m=l.slice().reverse();for(const e of m){n[e.id]=e,e.id in t||(t[e.id]=0);let a=t[e.id];const o=null==r[e.outboundLayer.id]?0:r[e.outboundLayer.id];a=Math.max(a,o),r[e.outboundLayer.id]=a,s[e.outboundLayer.id]=e.outboundLayer,t[e.id]=a;for(let r=0;r<e.inboundLayers.length;r++){const o=e.inboundLayers[r],s=e.nodeIndices[r],i=o.inboundNodes[s],c=null==t[i.id]?0:t[i.id];t[i.id]=Math.max(a+1,c),n[i.id]=i}}const g={};for(const e in t){const r=t[e];r in g||(g[r]=[]),g[r].push(n[e])}const v={};for(const e in r){const t=r[e];t in v||(v[t]=[]),v[t].push(s[e])}let b=Object.keys(v).map((e=>parseInt(e,10))).sort(i.reverseNumberCompare);this.layers=[];for(const e of b){const t=v[e];t.sort(((e,t)=>{const n=c[e.id],r=c[t.id];return n<r?-1:n>r?1:0}));for(const e of t)e instanceof y&&this.internalContainerRefs.push(e),this.layers.push(e)}this.layersByDepth=v,b=Object.keys(g).map((e=>parseInt(e,10))).sort(i.reverseNumberCompare);const x=this.inputs.slice(),w=[];for(const e of b)for(const t of g[e]){const e=t.outboundLayer;if(null!=e){for(const n of t.inputTensors)if(-1===x.indexOf(n))throw new o.RuntimeError("Graph disconnected: cannot obtain value for tensor ".concat(n)+' at layer "'.concat(e.name,'". ')+"The following previous layers were accessed without "+"issue: ".concat(w));for(const e of t.outputTensors)x.push(e);w.push(e.name)}}this.nodesByDepth=g;
1const k=this.layers.map((e=>e.name));for(const e of k){const t=k.filter((t=>t===e)).length;if(1!==t)throw new o.RuntimeError('The name "'.concat(e,'" is used ').concat(t," times ")+"in the model. All layer names should be unique. Layer names: "+JSON.stringify(k))}this.outboundNodes=[],this.inboundNodes=[],new f.Node({outboundLayer:this,inboundLayers:[],nodeIndices:[],tensorIndices:[],inputTensors:this.inputs,outputTensors:this.outputs,inputMasks:this.inputs.map((e=>null)),outputMasks:this.outputs.map((e=>null)),inputShapes:this.inputs.map((e=>e.shape)),outputShapes:this.outputs.map((e=>e.shape))}),this.built=!0,this._refCount=1}assertNotDisposed(){if(0===this._refCount)throw new Error("Container '".concat(this.name,"' is already disposed."))}dispose(){this.assertNotDisposed();const e={refCountAfterDispose:null,numDisposedVariables:0};if(0==--this._refCount){for(const t of this.layers)e.numDisposedVariables+=t.dispose().numDisposedVariables;for(const t of this.internalContainerRefs)e.numDisposedVariables+=t.dispose().numDisposedVariables}return e.refCountAfterDispose=this._refCount,e}get trainable(){return this.trainable_}set trainable(e){this.layers.forEach((t=>{t._trainableWeights.forEach((t=>t.trainable=e))})),this.trainable_=e}get trainableWeights(){if(this._trainableWeights.length>0)throw new o.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[];let e=[];for(const t of this.layers)e=e.concat(t.trainableWeights);return e}get nonTrainableWeights(){const e=[];for(const t of this.layers)e.push(...t.nonTrainableWeights);if(!this.trainable){const t=[];for(const e of this.layers)t.push(...e.trainableWeights);return t.concat(e)}return e}get weights(){return this.trainableWeights.concat(this.nonTrainableWeights)}loadWeights(e){let t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];const n={};let r=0;for(const e of this.layers)for(const t of e.weights){if(null!=n[t.originalName])throw new o.ValueError("Duplicate weight name: ".concat(t.originalName));n[t.originalName]=t,r++}const a=[];for(const r in e){let s=r;if(null==n[r]){const e=r.split("/");s=e.slice(0,-2).concat([e[e.length-1]]).join("/")}if(null!=n[s])a.push([n[s],e[r]]);else if(t)throw new o.ValueError("Provided weight data has no target variable: ".concat(r));delete n[s]}if(t){const e=[];for(const t in n)e.push(t);if(e.length>0)throw new o.ValueError("".concat(e.length," of ").concat(r," weights are not set: ")+"".concat(e))}(0,u.batchSetValue)(a)}updatedConfig(){const e=this.getConfig(),t={};return t.className=this.getClassName(),t.config=e,t.kerasVersion="tfjs-layers ".concat(d.version),t.backend="TensorFlow.js",t}toJSON(e){let t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];const n=(0,c.convertTsToPythonic)(this.updatedConfig());return t?JSON.stringify(n):n}call(e,t){return(0,r.tidy)((()=>{e=i.toList(e);const n=new p.FeedDict;for(let t=0;t<this.inputs.length;++t)n.add(this.inputs[t],e[t]);return(0,p.execute)(this.outputs,n,t)}))}computeMask(e,t){return(0,r.tidy)((()=>{let n;return e=i.toList(e),n=null==t?i.pyListRepeat(null,e.length):i.toList(t),this.runInternalGraph(e,n)[1]}))}computeOutputShape(e){const t=l.normalizeShapeList(e);if(t.length!==this.inputLayers.length)throw new o.ValueError("Invalid inputShape argument ".concat(e,": ")+"model has ".concat(this.inputLayers.length," tensor inputs."));const n={};for(let e=0;e<t.length;e++){const r=this.inputLayers[e],a=t[e];n[r.name+"_0_0"]=a}const r=Object.keys(this.nodesByDepth).map((e=>parseInt(e,10))).sort(i.reverseNumberCompare);if(r.length>1)for(const e of r){const t=this.nodesByDepth[e];for(const e of t){const t=e.outboundLayer;if(-1!==this.inputLayers.map((e=>e.id)).indexOf(t.id))continue;const r=[];for(let t=0;t<e.inboundLayers.length;t++){const a=e.inboundLayers[t],o=e.nodeIndices[t],s=e.tensorIndices[t],i=n["".concat(a.name,"_").concat(o,"_").concat(s)];r.push(i)}const a=t.computeOutputShape(i.singletonOrArray(r)),o=l.normalizeShapeList(a),s=t.inboundNodes.indexOf(e);for(let e=0;e<o.length;
1e++){n["".concat(t.name,"_").concat(s,"_").concat(e)]=o[e]}}}const a=[],s=[];for(let e=0;e<this.outputLayers.length;e++){const t=this.outputLayers[e],n=this.outputLayersNodeIndices[e],r=this.outputLayersTensorIndices[e],a="".concat(t.name,"_").concat(n,"_").concat(r);s.push(a)}for(let e=0;e<s.length;e++){const t=s[e];i.assert(t in n),a.push(n[t])}return i.singletonOrArray(a)}runInternalGraph(e,t){null==t&&(t=i.pyListRepeat(null,e.length));const n={};for(let r=0;r<this.inputs.length;++r){const a=this.inputs[r],o=e[r],s=t[r];n[a.id]=[o,s]}const r=Object.keys(this.nodesByDepth).map((e=>parseInt(e,10))).sort(i.reverseNumberCompare);for(const e of r){const t=this.nodesByDepth[e];for(const e of t){const t=e.outboundLayer,r=e.inputTensors,a=e.outputTensors,s=new Array;for(const e of r)e.id in n&&s.push(n[e.id]);if(s.length===r.length){let r,c,l,u,d={};if(null!=e.callArgs&&(d=e.callArgs),1===s.length){const[e,n]=s[0];null==d.mask&&(d.mask=n),l=i.toList(t.call(e,d)),u=i.toList(t.computeMask(e,n)),r=[e],c=[n]}else r=s.map((e=>e[0])),c=s.map((e=>e[1])),null==d.mask&&(d.mask=c),l=i.toList(t.call(r,d)),u=i.toList(t.computeMask(r,c));if(t.activityRegularizer)throw new o.NotImplementedError("LayersModel invocation with concrete Tensor value(s) in the presence of activity regularizer(s) is not supported yet.");for(let e=0;e<a.length;++e){const t=a[e],r=l[e],o=u[e];n[t.id]=[r,o]}}}}const a=[],s=[],c=[];for(const e of this.outputs){i.assert(e.id in n,"Could not compute output ".concat(e.name," : ").concat(e.id));const[t,r]=n[e.id];c.push(t.shape),a.push(t),s.push(r)}return[a,s,c]}buildNodeConversionMap(e){const t={};let n;for(const e of this.layers){n=e instanceof y?1:0;for(let r=0;r<e.inboundNodes.length;r++){const a=y.nodeKey(e,r);this.containerNodes.has(a)&&(t[a]=n,n+=1)}}return t}getLayer(e,t){if(null!=t){if(this.layers.length<=t)throw new o.ValueError("Was asked to retrieve layer at index ".concat(t,", but model only ")+"has ".concat(this.layers.length," layer(s)."));return this.layers[t]}if(null==e)throw new o.ValueError("Provide either a layer name or layer index");for(const t of this.layers)if(t.name===e)return t;throw new o.ValueError("No such layer: ".concat(e))}calculateLosses(){return(0,r.tidy)((()=>{const e=[];for(const t of this.layers)for(let n=0;n<t.inboundNodes.length;++n){const r=y.nodeKey(t,n);this.containerNodes.has(r)&&e.push(...t.calculateLosses())}return e}))}getConfig(){const e={name:this.name},t=this.buildNodeConversionMap(this.layers),n=[];for(const e of this.layers){const r=e.getClassName(),a=e.getConfig(),o=[];for(let n=0;n<e.inboundNodes.length;n++){const r=e.inboundNodes[n],a=y.nodeKey(e,n);let s={};if(this.containerNodes.has(a)){if(r.callArgs)try{JSON.stringify(r.callArgs),s=r.callArgs}catch(t){console.warn("Layer ".concat(e.name," was passed ")+"non-serializable keyword arguments: "+"".concat(r.callArgs,". They will not be included ")+"in the serialized model (and thus will be missing at deserialization time)."),s={}}if(r.inboundLayers.length>0){const e=[];for(let n=0;n<r.inboundLayers.length;n++){const a=r.inboundLayers[n],o=r.nodeIndices[n],i=r.tensorIndices[n];let c=t[y.nodeKey(a,o)];null==c&&(c=0),e.push([a.name,c,i,s])}o.push(e)}}}const s={};s.name=e.name,s.className=r,s.config=a,s.inboundNodes=o,n.push(s)}e.layers=n;const r=[];for(let e=0;e<this.inputLayers.length;e++){const n=this.inputLayers[e],a=this.inputLayersNodeIndices[e],o=y.nodeKey(n,a);if(!this.containerNodes.has(o))continue;let s=t[o];null==s&&(s=0);const i=this.inputLayersTensorIndices[e];r.push([n.name,s,i])}e.inputLayers=r;const a=[];for(let e=0;e<this.outputLayers.length;e++){const n=this.outputLayers[e],r=this.outputLayersNodeIndices[e],o=y.nodeKey(n,r);if(!this.containerNodes.has(o))continue;let s=t[o];null==s&&(s=0);const i=this.outputLayersTensorIndices[e];a.push([n.name,s,i])}return e.outputLayers=a,e}static fromConfig(e,t){let n=arguments.length>3&&void 0!==arguments[3]&&arguments[3];const r={},a={};function c(e,t){e.name in a?a[e.name].push(t):a[e.name]=[t]}function l(e,t){const n=[];let a;for(const o of t){const s=o[0],i=o[1],l=o[2];if(a=null==o[3]?{}:o[3],!(s in r))return void c(e,t);const u=r[s];if(u.inboundNodes.length<=i)return void c(e,t);const d=u.inboundNodes[i];n.push(d.outputTensors[l])}n.length>
10&&e.apply(i.singletonOrArray(n),a)}function u(e){const a=e.name,i=(0,s.deserialize)(e,null!=t.customObjects?t.customObjects:{});i.setFastWeightInitDuringBuild(n),r[a]=i;e.inboundNodes.forEach((e=>{if(!(e instanceof Array))throw new o.ValueError("Corrupted configuration, expected array for nodeData: ".concat(e));c(i,e)}))}const d=t.name,p=t.layers;for(const e of p)u(e);for(;!i.isObjectEmpty(a);)for(const e of p){const t=r[e.name];if(t.name in a){const e=a[t.name];delete a[t.name];for(const n of e)l(t,n)}}const h=[],f=[],m=t.inputLayers;for(const e of m){const t=e[0],n=e[1],a=e[2];i.assert(t in r);const o=r[t].inboundNodes[n].outputTensors;h.push(o[a])}const g=t.outputLayers;for(const e of g){const t=e[0],n=e[1],a=e[2];i.assert(t in r);const o=r[t].inboundNodes[n].outputTensors;f.push(o[a])}return new e({inputs:h,outputs:f,name:d})}get stateful(){if(this._stateful)throw new o.ValueError("Container instance unexpectedly has _stateful = true. The statefulness of a Container is determined by the Layers it contains. Its _stateful property must remain the default false.");for(const e of this.layers)if(e.stateful)return!0;return!1}resetStates(){(0,r.tidy)((()=>{this.layers.forEach((e=>{e.stateful&&e.resetStates()}))}))}}t.Container=y},179842:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.FeedDict=void 0,t.execute=function(e,t,n,a){const i=null!=n&&n.training,f=Array.isArray(e),m=f?e:[e],g=m.map((e=>e.name)),y=[],v=t.names();for(const e of g)-1!==v.indexOf(e)?y.push(t.getValue(e)):y.push(null);null!=a&&(a.maxNumTensors=-1/0,a.minNumTensors=1/0);const b=g.join(",")+"|"+t.names().join(",");let x,w;if(null==l[b]){const e=function(e,t){r.util.assert(null!=e&&e.length>0,(()=>"Expected at least one fetch, got none"));let n=[],a={};if(1===e.length){const r=p(e[0],t);n=r.sorted,a=r.recipientMap}else{const r=new Set;for(const o of e){const{sorted:e,recipientMap:s}=p(o,t);for(const t of e)r.has(t.name)||(n.push(t),r.add(t.name));for(const e in s)null==a[e]&&(a[e]=new Set),s[e].forEach((t=>a[e].add(t)))}}return{sorted:n,recipientCounts:d(a)}}(m,t);x=e.sorted,w=e.recipientCounts,l[b]=x,u[b]=w}x=l[b],w={},i||Object.assign(w,u[b]);const k=new c(t);for(let e=0;e<x.length;++e){if(null!=a){const e=(0,r.memory)().numTensors;e>a.maxNumTensors&&(a.maxNumTensors=e),e<a.minNumTensors&&(a.minNumTensors=e)}const c=x[e],l=c.sourceLayer;if(l instanceof s.InputLayer)continue;const u=[],d=[],p=[];let f=!1;for(const e of c.inputs){const n=k.getValue(e),r=k.getMask(e);u.push(n),d.push(r),null!=r&&(f=!0),i||(w[e.name]--,0!==w[e.name]||t.hasKey(e)||-1!==g.indexOf(e.name)||n.isDisposed||!0===e.sourceLayer.stateful||p.push(n))}f&&((n=n||{}).mask=d[0]);const m=(0,o.toList)(l.apply(u,n));let v=null;l.supportsMasking&&(v=l.computeMask(u,d));const b=h(c),_=Array.isArray(b)?b:[b];for(let e=0;e<_.length;++e){k.hasKey(_[e])||k.add(_[e],m[e],Array.isArray(v)?v[0]:v);const t=g.indexOf(_[e].name);-1!==t&&(y[t]=m[e])}i||(0,r.dispose)(p)}return k.disposeMasks(),f?y:y[0]},t.getTopologicalSortAndRecipientCountsForOneFetch=p;var r=n(735534),a=n(608012),o=n(986904),s=n(310750),i=n(840889);class c{constructor(e){if(this.id2Value={},this.id2Mask={},this.name2Id={},e instanceof c)for(const t in e.id2Value)this.id2Value[t]=e.id2Value[t],t in e.id2Mask&&(this.id2Mask[t]=e.id2Mask[t]);else{if(null==e)return;for(const t of e)this.add(t.key,t.value)}}add(e,t,n){if(null!=this.id2Value[e.id])throw new a.ValueError("Duplicate key: name=".concat(e.name,", id=").concat(e.id));return this.id2Value[e.id]=function(e,t){if(null==e.dtype||e.dtype===t.dtype)return t;try{return(0,r.cast)(t,e.dtype)}catch(n){throw new a.ValueError("The dtype of the feed (".concat(t.dtype,") can not be cast to the dtype ")+"of the key '".concat(e.name,"' (").concat(e.dtype,")."))}}(e,t),this.name2Id[e.name]=e.id,null!=n&&(this.id2Mask[e.id]=n),this}addFeed(e){this.add(e.key,e.value)}hasKey(e){return null!=this.id2Value[e.id]}names(){return Object.keys(this.name2Id)}getValue(e){if(e instanceof i.SymbolicTensor){if(null==this.id2Value[e.id])throw new a.ValueError("Nonexistent key: ".concat(e.name));return this.id2Value[e.id]}{const t=this.name2Id[e];if(null==t)throw new a.ValueError("Feed dict has no SymbolicTensor name: ".concat(e));return this.id2Value[t]}}getMask(e){if(e instanceof i.SymbolicTensor){if(null==this.id2Value[e.id])throw new a.ValueError("Nonexistent key: ".concat(e.name));return this.id2Mask[e.id]}{const t=this.name2Id[e];if(null==t)throw new a.ValueError("Feed dict has no SymbolicTensor name: ".concat(e));return this.id2Mask[t]}}disposeMasks(){null!=this.id2Mask&&(0,r.dispose)(this.id2Mask)}}t.FeedDict=c;const l={},u={};function d(e){const t={};for(const n in e)t[n]=e[n].size;return t}function p(e,t){const n=new Set,r=[],a={};for(const e of t.names())n.add(e);const o=[],s=[];for(o.push(e);o.length>0;){const e=o[o.length-1];if(n.has(e.name)){o.pop();continue}const t=s[s.length-1]===o.length-1;if(0===e.inputs.length||t)o.pop(),r.push(e),n.add(e.name),t&&s.pop();else{s.push(o.length-1);for(const t of e.inputs)null==a[t.name]&&(a[t.name]=new Set),a[t.name].add(e.name),n.has(t.name)||o.push(t)}}return{sorted:r,recipientMap:a}}function h(e){let t;
1if(1===e.sourceLayer.inboundNodes.length)t=e.sourceLayer.output;else{let n=null;for(let t=0;t<e.sourceLayer.inboundNodes.length;++t)for(const r of e.sourceLayer.inboundNodes[t].outputTensors)if(r.id===e.id){n=t;break}t=e.sourceLayer.getOutputAt(n)}return t}},310750:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Input=function(e){if(null==e.batchShape&&null==e.shape)throw new Error("Please provide to Input either a `shape` or a `batchShape` argument. Note that `shape` does not include the batch dimension.");if(null!=e.batchShape&&null!=e.shape)throw new o.ValueError("Please provide either a `shape` or `batchShape` argument to Input, but not both.");let t=e.batchShape;null!=e.shape&&null==t&&(t=[null].concat(e.shape));let n=e.dtype;null==n&&(n="float32");const r=new i({batchInputShape:t,name:e.name,dtype:n,sparse:e.sparse});return r.inboundNodes[0].outputTensors[0]},t.InputLayer=void 0;var r=n(735534),a=n(284986),o=n(608012),s=n(840889);class i extends s.Layer{constructor(e){if(super({dtype:e.dtype,name:null!=e.name?e.name:(0,a.getUid)("input").toString()}),null==e.batchSize&&(e.batchSize=null),null==e.sparse&&(e.sparse=!1),this.trainable=!1,this.built=!0,this.sparse=e.sparse,null!=e.inputShape&&null!=e.batchInputShape)throw new o.ValueError("Only provide the inputShape OR batchInputShape argument to inputLayer, not both at the same time.");let t=e.batchInputShape;if(null==t){if(null==e.inputShape)throw new o.ValueError("An InputLayer should be passed either a `batchInputShape` or an `inputShape`.");t=[e.batchSize].concat(e.inputShape)}else if(null!=e.batchSize)throw new o.ValueError("Cannot specify batchSize if batchInputShape is specified when creating an InputLayer.");const n=e.dtype||"float32";this.batchInputShape=t,this.dtype=n,this.inputSpec=[{shape:t}];const r=new s.SymbolicTensor(this.dtype,this.batchInputShape,this,[],{},this.name);r.nodeIndex=0,r.tensorIndex=0,new s.Node({outboundLayer:this,inboundLayers:[],nodeIndices:[],tensorIndices:[],inputTensors:[r],outputTensors:[r],inputMasks:[null],outputMasks:[null],inputShapes:[t],outputShapes:[t]})}apply(e,t){throw new o.ValueError("Cannot pass any input to an "+"InputLayer's apply() method. InputLayer name: ".concat(this.name))}dispose(){return{refCountAfterDispose:this._refCount,numDisposedVariables:0}}getConfig(){return{batchInputShape:this.batchInputShape,dtype:this.dtype,sparse:this.sparse,name:this.name}}}t.InputLayer=i,i.className="InputLayer",r.serialization.registerClass(i)},840889:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.SymbolicTensor=t.Node=t.Layer=t.InputSpec=void 0,t.getSourceInputs=function e(t,n,r){(null==n||null!=r&&r>0)&&(n=t.sourceLayer,r=t.nodeIndex);if(0===n.inboundNodes.length)return[t];{const t=n.inboundNodes[r];if(0===t.inboundLayers.length)return t.inputTensors;{const n=[];for(let r=0;r<t.inboundLayers.length;r++){const a=t.inputTensors[r],o=t.inboundLayers[r],s=t.nodeIndices[r],i=e(a,o,s);for(const e of i)-1===n.indexOf(e)&&n.push(e)}return n}}};var r=n(735534),a=n(284986),o=n(545188),s=n(608012),i=n(492560),c=h(n(986904)),l=h(n(252518)),u=h(n(468769)),d=n(268778);function p(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(p=function(e){return e?n:t})(e)}function h(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=p(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if("default"!==o&&{}.hasOwnProperty.call(e,o)){var s=a?Object.getOwnPropertyDescriptor(e,o):null;s&&(s.get||s.set)?Object.defineProperty(r,o,s):r[o]=e[o]}return r.default=e,n&&n.set(e,r),r}t.InputSpec=class{constructor(e){this.dtype=e.dtype,this.shape=e.shape,null!=e.shape?this.ndim=e.shape.length:this.ndim=e.ndim,this.maxNDim=e.maxNDim,this.minNDim=e.minNDim,this.axes=e.axes||{}}};class f{constructor(e,t,n,r,s,i,c){this.dtype=e,this.shape=t,this.sourceLayer=n,this.inputs=r,this.callArgs=s,this.outputTensorIndex=c,this.id=(0,a.getNextUniqueTensorId)(),null!=i&&(this.originalName=(0,o.getScopedTensorName)(i),this.name=(0,o.getUniqueTensorName)(this.originalName)),this.rank=t.length}}t.SymbolicTensor=f;let m=0;class g{constructor(e,t){this.callArgs=t,this.id=m++,this.outboundLayer=e.outboundLayer,this.inboundLayers=e.inboundLayers,this.nodeIndices=e.nodeIndices,this.tensorIndices=e.tensorIndices,this.inputTensors=e.inputTensors,this.outputTensors=e.outputTensors,this.inputMasks=e.inputMasks,this.outputMasks=e.outputMasks,this.inputShapes=e.inputShapes,this.outputShapes=e.outputShapes;for(const t of e.inboundLayers)null!=t&&t.outboundNodes.push(this);e.outboundLayer.inboundNodes.push(this)}getConfig(){const e=[];for(const t of this.inboundLayers)null!=t?e.push(t.name):e.push(null);return{outboundLayer:this.outboundLayer?this.outboundLayer.name:null,inbou
1ndLayers:e,nodeIndices:this.nodeIndices,tensorIndices:this.tensorIndices}}}t.Node=g;let y=0;class v extends r.serialization.Serializable{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};super(),this._callHook=null,this._addedWeightNames=[],this._stateful=!1,this.id=y++,this.activityRegularizer=null,this.inputSpec=null,this.supportsMasking=!1,this._trainableWeights=[],this._nonTrainableWeights=[],this._losses=[],this._updates=[],this._built=!1,this.inboundNodes=[],this.outboundNodes=[];let t=e.name;if(!t){const e=this.getClassName();t=c.toSnakeCase(e)+"_"+(0,a.getUid)(e)}if(this.name=t,this.trainable_=null==e.trainable||e.trainable,null!=e.inputShape||null!=e.batchInputShape){let t;if(null!=e.batchInputShape)t=e.batchInputShape;else if(null!=e.inputShape){let n=null;null!=e.batchSize&&(n=e.batchSize),t=[n].concat(e.inputShape)}this.batchInputShape=t;let n=e.dtype;null==n&&(n=e.inputDType),null==n&&(n="float32"),this.dtype=n}null!=e.weights?this.initialWeights=e.weights:this.initialWeights=null,this._refCount=null,this.fastWeightInitDuringBuild=!1}static nodeKey(e,t){return e.name+"_ib-"+t.toString()}getNodeAtIndex(e,t){if(0===this.inboundNodes.length)throw new s.RuntimeError("The layer has never been called "+"and thus has no defined ".concat(t,"."));if(this.inboundNodes.length<=e)throw new s.ValueError("Asked to get ".concat(t," at node ").concat(e,", ")+"but the layer has only ".concat(this.inboundNodes.length," inbound nodes."));return this.inboundNodes[e]}getInputAt(e){return c.singletonOrArray(this.getNodeAtIndex(e,"input").inputTensors)}getOutputAt(e){return c.singletonOrArray(this.getNodeAtIndex(e,"output").outputTensors)}get input(){if(this.inboundNodes.length>1)throw new s.AttributeError("Layer ".concat(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 s.AttributeError("Layer ".concat(this.name)+" is not connected, no input to return.");return c.singletonOrArray(this.getNodeAtIndex(0,"input").inputTensors)}get output(){if(0===this.inboundNodes.length)throw new s.AttributeError("Layer ".concat(this.name)+" has no inbound nodes.");if(this.inboundNodes.length>1)throw new s.AttributeError("Layer ".concat(this.name)+' has multiple inbound nodes, hence the notion of "layer output" is ill-defined. Use `getOutputAt(nodeIndex)` instead.');return c.singletonOrArray(this.getNodeAtIndex(0,"output").outputTensors)}get losses(){return this._losses}calculateLosses(){return this.losses.map((e=>e()))}get updates(){return this._updates}get built(){return this._built}set built(e){this._built=e}get trainable(){return this.trainable_}set trainable(e){this._trainableWeights.forEach((t=>t.trainable=e)),this.trainable_=e}get trainableWeights(){return this.trainable_?this._trainableWeights.filter((e=>e.trainable)):[]}set trainableWeights(e){this._trainableWeights=e}get nonTrainableWeights(){return this.trainable?this._trainableWeights.filter((e=>!e.trainable)).concat(this._nonTrainableWeights):this._trainableWeights.concat(this._nonTrainableWeights)}set nonTrainableWeights(e){this._nonTrainableWeights=e}get weights(){return this.trainableWeights.concat(this.nonTrainableWeights)}get stateful(){return this._stateful}resetStates(){if(!this.stateful)throw new Error("Cannot call the resetStates() method of a non-stateful Layer object.")}assertInputCompatibility(e){if(e=c.toList(e),null==this.inputSpec||0===this.inputSpec.length)return;const t=c.toList(this.inputSpec);if(e.length!==t.length)throw new s.ValueError("Layer ".concat(this.name," expects ").concat(t.length," inputs, ")+"but it received ".concat(e.length," input tensors. ")+"Input received: ".concat(e));for(let n=0;n<e.length;n++){const r=e[n],a=t[n];if(null==a)continue;const o=r.rank;if(null!=a.ndim&&o!==a.ndim)throw new s.ValueError("Input ".concat(n," is incompatible with layer ").concat(this.name,": ")+"expected ndim=".concat(a.ndim,", found ndim=").concat(o));if(null!=a.maxNDim&&o>a.maxNDim)throw new s.ValueError("Input ".concat(n," is incompatible with layer ").concat(this.name)+": expected max_ndim
1=".concat(a.maxNDim,", found ndim=").concat(o));if(null!=a.minNDim&&o<a.minNDim)throw new s.ValueError("Input ".concat(n," is incompatible with layer ").concat(this.name)+": expected min_ndim=".concat(a.minNDim,", found ndim=").concat(o,"."));if(null!=a.dtype&&r.dtype!==a.dtype)throw new s.ValueError("Input ".concat(n," is incompatible with layer ").concat(this.name," ")+": expected dtype=".concat(a.dtype,", found dtype=").concat(r.dtype,"."));if(a.axes){const e=r.shape;for(const t in a.axes){const r=Number(t),o=a.axes[t],i=r>=0?e[r]:e[e.length+r];if(null!=o&&-1===[o,null].indexOf(i))throw new s.ValueError("Input ".concat(n," is incompatible with layer ")+"".concat(this.name,": expected axis ").concat(r," of input shape to ")+"have value ".concat(o," but got shape ").concat(e,"."))}}if(null!=a.shape)for(let e=0;e<a.shape.length;++e){const t=a.shape[e],o=r.shape[e];if(null!=t&&null!=o&&t!==o)throw new s.ValueError("Input ".concat(n," is incompatible with layer ")+"".concat(this.name,": expected shape=").concat(a.shape,", ")+"found shape=".concat(r.shape,"."))}}}call(e,t){return e}invokeCallHook(e,t){null!=this._callHook&&this._callHook(e,t)}setCallHook(e){this._callHook=e}clearCallHook(){this._callHook=null}apply(e,t){t=t||{},this.assertNotDisposed();const n=c.toList(e);let r=!0;for(const e of n)if(!(e instanceof f)){r=!1;break}let a=!0;for(const e of n)if(e instanceof f){a=!1;break}if(r===a)throw new s.ValueError("Arguments to apply() must be all SymbolicTensors or all Tensors");return(0,o.nameScope)(this.name,(()=>{if(!this.built){this.assertInputCompatibility(e);const t=[];for(const n of c.toList(e))t.push(n.shape);this.build(c.singletonOrArray(t)),this.built=!0,this.initialWeights&&this.setWeights(this.initialWeights),null===this._refCount&&a&&(this._refCount=1)}if(this.assertInputCompatibility(e),a){let r=this.call(e,t);const a=c.toList(r),o=[];for(let e of a)-1!==n.indexOf(e)&&(e=e.clone()),o.push(e);if(r=c.singletonOrArray(o),null!=this.activityRegularizer)throw new s.NotImplementedError("Layer invocation in the presence of activity regularizer(s) is not supported yet.");return r}{const n=function(e){e=c.toList(e);const t=[];for(const n of e)t.push(n.shape);return c.singletonOrArray(t)}(e),r=this.computeOutputShape(n);let a;const o="float32";if(this.warnOnIncompatibleInputShape(Array.isArray(e)?n[0]:n),a=null!=r&&r.length>0&&Array.isArray(r[0])?r.map(((n,r)=>new f(o,n,this,c.toList(e),t,this.name,r))):new f(o,r,this,c.toList(e),t,this.name),this.addInboundNode(e,a,null,null,n,r,t),this._refCount++,null!=this.activityRegularizer)throw new s.NotImplementedError("Layer invocation in the presence of activity regularizer(s) is not supported yet.");return a}}))}warnOnIncompatibleInputShape(e){if(null!=this.batchInputShape)if(e.length!==this.batchInputShape.length)console.warn("The rank of the input tensor provided (shape: "+"".concat(JSON.stringify(e),") does not match that of the ")+"batchInputShape (".concat(JSON.stringify(this.batchInputShape),") ")+"of the layer ".concat(this.name));else{let t=!1;this.batchInputShape.forEach(((n,r)=>{null!=n&&null!=e[r]&&e[r]!==n&&(t=!0)})),t&&console.warn("The shape of the input tensor "+"(".concat(JSON.stringify(e),") does not ")+"match the expectation of layer ".concat(this.name,": ")+"".concat(JSON.stringify(this.batchInputShape)))}}get outputShape(){if(null==this.inboundNodes||0===this.inboundNodes.length)throw new s.AttributeError("The layer ".concat(this.name," has never been called and thus has no ")+"defined output shape.");const e=[];for(const t of this.inboundNodes){const n=JSON.stringify(t.outputShapes);-1===e.indexOf(n)&&e.push(n)}if(1===e.length){const e=this.inboundNodes[0].outputShapes;return Array.isArray(e)&&Array.isArray(e[0])&&1===e.length?e[0]:e}throw new s.AttributeError("The layer ".concat(this.name," has multiple inbound nodes with different ")+'output shapes. Hence the notion of "output shape" is ill-defined for the layer.')}countParams(){if(!this.built)throw new s.RuntimeError("You tried to call countParams() on ".concat(this.name,", ")+"but the layer is not built yet. Build it first by calling build(batchInputShape).");return u.countParamsInWeights(this.weights)}build(e){this.built=!0}getWeights(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return(0,d.batchGetValue)(e?this.trainableWeights:this.weights)}
1setWeights(e){(0,r.tidy)((()=>{const t=this.weights;if(t.length!==e.length)throw new s.ValueError('You called setWeights(weights) on layer "'.concat(this.name,'" ')+"with a weight list of length ".concat(e.length,", ")+"but the layer was expecting ".concat(t.length," weights. ")+"Provided weights: ".concat(e,"..."));if(0===t.length)return;const n=[],a=(0,d.batchGetValue)(t);for(let o=0;o<a.length;++o){const i=a[o],c=t[o],l=e[o];if(!r.util.arraysEqual(i.shape,l.shape))throw new s.ValueError("Layer weight shape ".concat(i.shape," ")+"not compatible with provided weight shape ".concat(l.shape));n.push([c,l])}(0,d.batchSetValue)(n)}))}addWeight(e,t,n,r,a,o,c,l){if(-1!==this._addedWeightNames.indexOf(e))throw new s.ValueError("Duplicate weight name ".concat(e," for layer ").concat(this.name));this._addedWeightNames.push(e),null==n&&(n="float32"),this.fastWeightInitDuringBuild&&(r=null!=l?l():(0,i.getInitializer)("zeros"));const u=r.apply(t,n),p=new d.LayerVariable(u,n,e,o,c);return u.dispose(),null!=a&&this.addLoss((()=>a.apply(p.read()))),null==o&&(o=!0),o?this._trainableWeights.push(p):this._nonTrainableWeights.push(p),p}setFastWeightInitDuringBuild(e){this.fastWeightInitDuringBuild=e}addLoss(e){null==e||Array.isArray(e)&&0===e.length||(e=c.toList(e),void 0!==this._losses&&null!==this._losses&&this.losses.push(...e))}computeOutputShape(e){return e}computeMask(e,t){if(!this.supportsMasking){if(null!=t){if(!Array.isArray(t))throw new TypeError("Layer ".concat(this.name," does not support masking, ")+"but was passed an inputMask.");t.forEach((e=>{if(null!=e)throw new TypeError("Layer ".concat(this.name," does not support masking, ")+"but was passed an inputMask.")}))}return null}return t}addInboundNode(e,t,n,r,a,o){let s=arguments.length>6&&void 0!==arguments[6]?arguments[6]:null;const i=c.toList(e);t=c.toList(t),n=c.toList(n),r=c.toList(r),a=l.normalizeShapeList(a),o=l.normalizeShapeList(o);const u=[],d=[],p=[];for(const e of i)u.push(e.sourceLayer),d.push(e.nodeIndex),p.push(e.tensorIndex);new g({outboundLayer:this,inboundLayers:u,nodeIndices:d,tensorIndices:p,inputTensors:i,outputTensors:t,inputMasks:n,outputMasks:r,inputShapes:a,outputShapes:o},s);for(let e=0;e<t.length;e++)t[e].sourceLayer=this,t[e].nodeIndex=this.inboundNodes.length-1,t[e].tensorIndex=e}getConfig(){const e={name:this.name,trainable:this.trainable};return null!=this.batchInputShape&&(e.batchInputShape=this.batchInputShape),null!=this.dtype&&(e.dtype=this.dtype),e}disposeWeights(){return this.weights.forEach((e=>e.dispose())),this.weights.length}assertNotDisposed(){if(0===this._refCount)throw new Error("Layer '".concat(this.name,"' is already disposed."))}dispose(){if(!this.built)throw new Error("Cannot dispose Layer ".concat(this.name," because it has not been ")+"built yet.");if(null===this._refCount)throw new Error("Cannot dispose Layer ".concat(this.name," because it has not been used ")+"yet.");this.assertNotDisposed();let e=0;return 0==--this._refCount&&(e=this.disposeWeights()),{refCountAfterDispose:this._refCount,numDisposedVariables:e}}}t.Layer=v},171320:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.LayersModel=t.Functional=void 0,t.checkArrayLengths=T,t.collectMetrics=E,t.isDataArray=O,t.isDataDict=N,t.isDataTensor=P,t.standardizeInputData=I;var r=C(n(735534)),a=r,o=C(n(984710)),s=n(545188),i=n(608012),c=n(640153),l=C(n(242135)),u=C(n(26267)),d=C(n(736183)),p=n(947525),h=n(986904),f=n(785473),m=n(302774),g=n(290407),y=n(480036),v=n(457270),b=n(179842),x=n(162330),w=n(984039),k=n(117347);function _(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(_=function(e){return e?n:t})(e)}function C(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=_(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if("default"!==o&&{}.hasOwnProperty.call(e,o)){var s=a?Object.getOwnPropertyDescriptor(e,o):null;s&&(s.get||s.set)?Object.defineProperty(r,o,s):r[o]=e[o]}return r.default=e,n&&n.set(e,r),r}function P(e){return e instanceof r.Tensor}function O(e){return Array.isArray(e)}function N(e){return!P(e)&&!O(e)}function I(e,t,n){let r,a=!(arguments.length>3&&void 0!==arguments[3])||arguments[3],o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:"";if(null==t||0===t.length){if(null!=e){let t=!1;if(O(e)&&e.length>0)t=!0;else if(N(e)){for(const n in e)if(e.hasOwnProperty(n)){t=!0;break}}else t=!0;if(t)throw new i.ValueError("Error when checking model ".concat(o," expected no data, ")+"but got ".concat(e))}return[]}if(null==e)return t.map((e=>null));if(N(e)){r=[];for(const n of t){if(null==e[n])throw new i.ValueError('No data provided for "'.concat(n,'". Need data for each key in: ')+"".concat(t));
1r.push(e[n])}}else if(O(e)){if(e.length!==t.length)throw new i.ValueError("Error when checking model ".concat(o,": the Array of ")+"Tensors that you are passing to your model is not the size the "+"model expected. Expected to see ".concat(t.length," Tensor(s), but ")+"instead got the following list of Tensor(s): ".concat(e));r=e}else{if(t.length>1)throw new i.ValueError("The model ".concat(o," expects ").concat(t.length," Tensor(s), ")+"but only received one Tensor. Found: Tensor with shape ".concat(e.shape));r=[e]}if(r=(0,w.ensureTensorsRank2OrHigher)(r),null!=n)for(let e=0;e<t.length;++e){if(null==n[e])continue;const s=r[e];if(s.shape.length!==n[e].length)throw new i.ValueError("Error when checking ".concat(o,": expected ").concat(t[e]," ")+"to have ".concat(n[e].length," dimension(s). but got array with ")+"shape ".concat(s.shape));for(let t=0;t<n[e].length;++t){if(0===t&&!a)continue;const r=s.shape[t],c=n[e][t];if(null!=c&&c>=0&&r!==c)throw new i.ValueError("".concat(o," expected a batch of elements where each ")+"example has shape [".concat(n[e].slice(1,n[e].length),"] ")+"(i.e.,tensor shape [*,".concat(n[e].slice(1,n[e].length),"])")+" but the ".concat(o," received an input with ").concat(s.shape[0])+" examples, each with shape [".concat(s.shape.slice(1,s.shape.length),"]")+" (tensor shape [".concat(s.shape,"])"))}}return r}function T(e,t,n){const a=(0,h.unique)(e.map((e=>e.shape[0])));a.sort();const o=(0,h.unique)(t.map((e=>e.shape[0])));if(o.sort(),a.length>1)throw new i.ValueError("All input Tensors (x) should have the same number of samples. Got array shapes: "+"".concat(JSON.stringify(e.map((e=>e.shape)))));if(o.length>1)throw new i.ValueError("All target Tensors (y) should have the same number of samples. Got array shapes: "+"".concat(JSON.stringify(t.map((e=>e.shape)))));if(a.length>0&&o.length>0&&!r.util.arraysEqual(a,o))throw new i.ValueError("Input Tensors should have the same number of samples as target "+"Tensors. Found ".concat(a[0]," input sample(s) and ").concat(o[0]," target ")+"sample(s).")}function S(e,t,n){let r,a=!(arguments.length>3&&void 0!==arguments[3])||arguments[3],o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:"";if(Array.isArray(e)){if(e.length!==t.length)throw new i.ValueError("Error when checking model ".concat(o,": the Array of ")+"Tensors that you are passing to your model is not the size the "+"the model expected. Expected to see ".concat(t.length," Tensor(s),")+" but instead got ".concat(e.length," Tensors(s)."));r=e}else{if(t.length>1)throw new i.ValueError("The model expects ".concat(t.length," ").concat(o," Tensors, ")+"but only received one Tensor. Found: array with shape "+"".concat(JSON.stringify(e.shape),"."));r=[e]}if(null!=n)for(let e=0;e<t.length;++e){if(null==n[e])continue;const s=r[e];if(s.shape.length!==n[e].length)throw new i.ValueError("Error when checking ".concat(o,": expected ").concat(t[e]," ")+"to have ".concat(n[e].length," dimension(s), but got array with ")+"shape ".concat(JSON.stringify(s.shape)));for(let r=0;r<n[e].length;++r){if(0===r&&!a)continue;const c=s.shape[r],l=n[e][r];if(null!=l&&l!==c)throw new i.ValueError("Error when checking ".concat(o,": expected ")+"".concat(t[e]," to have shape ").concat(JSON.stringify(n[e])," but ")+"got array with shape ".concat(JSON.stringify(s.shape),"."))}}}function E(e,t){if(null==e||Array.isArray(e)&&0===e.length)return t.map((e=>[]));let n;if("string"==typeof e||"function"==typeof e)n=[e];else{if(!Array.isArray(e)&&"object"!=typeof e)throw new TypeError("Type of metrics argument not understood. Expected an string,"+"function, Array, or Object, found: ".concat(e));n=e}if(Array.isArray(n))return t.map((e=>n));{const e=[];for(const r of t){let t=n.hasOwnProperty(r)?n[r]:[];Array.isArray(t)||(t=[t]),e.push(t)}return e}}class M extends v.Container{constructor(e){super(e),this.isTraining=!1}summary(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:console.log;if(!this.built)throw new i.ValueError("This model has never been called, thus its weights have not been created yet. So no summary can be displayed. Build the model first (e.g., by calling it on some test data).");(0,f.printSummary)(this,e,t,n)}compile(e){if(null==e.loss&&(e.loss=[]),this.loss=e.loss,"string"==typeof e.o
1ptimizer)this.optimizer_=d.getOptimizer(e.optimizer),this.isOptimizerOwned=!0;else{if(!(e.optimizer instanceof r.Optimizer))throw new i.ValueError("User-defined optimizer must be an instance of tf.Optimizer.");this.optimizer_=e.optimizer,this.isOptimizerOwned=!1}let t=[];if(Array.isArray(e.loss)||"string"==typeof e.loss||"function"==typeof e.loss)if(Array.isArray(e.loss)){if(e.loss.length!==this.outputs.length)throw new i.ValueError("When passing an Array as loss, it should have one entry per "+"model output. The model has ".concat(this.outputs.length," output(s), ")+"but you passed loss=".concat(e.loss,"."));const n=e.loss;t=n.map((e=>l.get(e)))}else{const n=l.get(e.loss);this.outputs.forEach((e=>{t.push(n)}))}else{e.loss=e.loss;for(const t in e.loss)if(-1===this.outputNames.indexOf(t))throw new i.ValueError('Unknown entry in loss dictionary: "'.concat(t,'". ')+"Only expected the following keys: ".concat(this.outputNames));for(const n of this.outputNames)null==e.loss[n]&&console.warn('Output "'.concat(n,'" is missing from loss dictionary. We assume ')+"this was done on purpose, and we will not be expecting data "+"to be passed to ".concat(n," during training")),t.push(l.get(e.loss[n]))}this.lossFunctions=t,this.feedOutputNames=[],this.feedOutputShapes=[],this.feedLossFns=[];for(let e=0;e<this.outputs.length;++e){const t=this.internalOutputShapes[e],n=this.outputNames[e];this.feedOutputNames.push(n),this.feedOutputShapes.push(t),this.feedLossFns.push(this.lossFunctions[e])}const n=[];this.metrics=e.metrics,this.metricsNames=["loss"],this.metricsTensors=[],(0,s.nameScope)("loss",(()=>{for(let e=0;e<this.outputs.length;++e){if(-1!==n.indexOf(e))continue;const t=this.lossFunctions[e];this.outputs.length>1&&(this.metricsTensors.push([t,e]),this.metricsNames.push(this.outputNames[e]+"_loss"))}}));const a=E(e.metrics,this.outputNames),o=(e,t,n)=>{this.outputNames.length>1&&(t=this.outputNames[e]+"_"+t),this.metricsNames.push(t),this.metricsTensors.push([n,e])};(0,s.nameScope)("metric",(()=>{for(let e=0;e<this.outputs.length;++e){if(-1!==n.indexOf(e))continue;(t=>{let n,r,a;for(const i of t){if("string"==typeof i&&-1!==["accuracy","acc","crossentropy","ce"].indexOf(i)){const t=this.internalOutputShapes[e];let o;1===t[t.length-1]||this.lossFunctions[e]===l.binaryCrossentropy?-1!==["accuracy","acc"].indexOf(i)?r=u.binaryAccuracy:-1!==["crossentropy","ce"].indexOf(i)&&(r=u.binaryCrossentropy):this.lossFunctions[e]===l.sparseCategoricalCrossentropy?-1!==["accuracy","acc"].indexOf(i)?r=u.sparseCategoricalAccuracy:-1!==["crossentropy","ce"].indexOf(i)&&(r=u.sparseCategoricalCrossentropy):-1!==["accuracy","acc"].indexOf(i)?r=u.categoricalAccuracy:-1!==["crossentropy","ce"].indexOf(i)&&(r=u.categoricalCrossentropy),-1!==["accuracy","acc"].indexOf(i)?o="acc":-1!==["crossentropy","ce"].indexOf(i)&&(o="ce"),a=r,n=""+o}else{const e=u.get(i);a=e,n=""+u.getLossOrMetricName(i)}let t;(0,s.nameScope)(n,(()=>{t=a})),o(e,n,t)}})(a[e])}})),this.collectedTrainableWeights=this.trainableWeights}checkTrainableWeightsConsistency(){null!=this.collectedTrainableWeights&&this.trainableWeights.length!==this.collectedTrainableWeights.length&&console.warn("Discrepancy between trainableweights and collected trainable weights. Did you set `model.trainable` without calling `model.compile()` afterwards?")}evaluate(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const r=null==n.batchSize?32:n.batchSize;(0,w.checkBatchSize)(r);const a=this.standardizeUserDataXY(e,t,!0,r);try{const e=a[0].concat(a[1]);this.makeTestFunction();const t=this.testFunction,o=this.testLoop(t,e,r,n.verbose,n.steps);return(0,h.singletonOrArray)(o)}finally{(0,w.disposeNewTensors)(a[0],e),(0,w.disposeNewTensors)(a[1],t)}}async evaluateDataset(e,t){return this.makeTestFunction(),(0,x.evaluateDataset)(this,e,t)}checkNumSamples(e,t,n){let r,a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"steps";if(null!=n){if(r=null,null!=t)throw new i.ValueError("If ".concat(a," is set, batchSize must be null or undefined.")+"Got batchSize = ".concat(t))}else{if(null==e)throw new i.ValueError("Either the input data should have a defined shape, or "+"".concat(a," shoud be specified."));r=Array.isArray(e)?e[0].shape[0]:e.shape[0]}return r}execute(e,t){if(Array.isArray(t)&&0===t.length)throw new i.ValueError("`outputs` is an empty Array, which is not allowed.");const n=Array.isArray(t),a=n?t:[t],o=this.retrieveSymbolicTensors(a),s=new b.FeedDict;if(e instanceof r.Tensor&&(e=[e]),Array.isArray(e)){if(e.length!==this.inputs.length)throw new i.ValueError("The number of inputs provided (".concat(e.length,") ")+"does not match the number of inputs of this model "+"(".concat(this.inputs.length,")."));for(let t=0;t<this.inputs.length;++t)s.add(this.inputs[t],e[t])}else for(const t of this.inputs){const n=e[t.name];if(null==n)throw new i.ValueError("No value is provided for the model's input ".concat(t.name));s.add(t,n)}const c=(0,b.execute)(o,s);return n?c:c[0]}retrieveSymbolicTensors(e){const t=(0,h.pyListRepeat)(null,e.length);let n=e.length;for(const r of this.layers){const a=Array.isArray(r.output)?r.output:[r.output],o=a.map((e=>e.name));for(let r=0;r<e.length;++r){const s=o.indexOf(e[r]);if(-1!==s&&(t[r]=a[s],n--),0===n)break}if(0===n)break}if(n>0){const n=[];throw t.forEach(((t,r)=>{null==t&&n.push(e[r])})),new i.ValueError("Cannot find SymbolicTensors for output name(s): "+"".concat(JSON.stringify(n)))}return t}predictLoop(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:32,n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return a.tidy((()=>{const r=this.checkNumSamples(e);if(n)throw new i.NotImplementedError("Verbose predictLoop() is not implemented yet.");const o=(0,w.makeBatches)(r,t),s=this.outputs.map((e=>[]));for(let t=0;t<o.length;++t){a.tidy((()=>{const n=o[t][0],r=o[t][1],a=(0,w.sliceArrays)(e,n,r),s=[];if(Array.isArray(a))for(let e=0;e<a.length;++e)s.push({key:this.inputs[e],value:a[e]});else s.push({key:this.inputs[0],value:a});const i=new b.FeedDict(s);return(0,b.execute)(this.outputs,i)}
1)).forEach(((e,t)=>s[t].push(e)))}return(0,h.singletonOrArray)(s.map((e=>a.concat(e,0))))}))}predict(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const n=(0,w.ensureTensorsRank2OrHigher)(e);S(n,this.inputNames,this.feedInputShapes,!1);try{const e=null==t.batchSize?32:t.batchSize;return(0,w.checkBatchSize)(e),this.predictLoop(n,e)}finally{(0,w.disposeNewTensors)(n,e)}}predictOnBatch(e){S(e,this.inputNames,this.feedInputShapes,!0);const t=(Array.isArray(e)?e[0]:e).shape[0];return this.predictLoop(e,t)}standardizeUserDataXY(e,t){let n=arguments.length>3?arguments[3]:void 0;if(null==this.optimizer_)throw new i.RuntimeError("You must compile a model before training/testing. Use LayersModel.compile(modelCompileArgs).");const r=[];for(let e=0;e<this.feedOutputShapes.length;++e){const t=this.feedOutputShapes[e];this.feedLossFns[e]===l.sparseCategoricalCrossentropy?r.push(t.slice(0,t.length-1).concat([1])):r.push(t)}if(T(e=I(e,this.feedInputNames,this.feedInputShapes,!1,"input"),t=I(t,this.feedOutputNames,r,!1,"target")),function(e,t,n){const r=[l.meanSquaredError,l.binaryCrossentropy,l.categoricalCrossentropy];for(let a=0;a<e.length;++a){const o=e[a],s=t[a],c=n[a];if(null!=s){if(s===l.categoricalCrossentropy&&1===o.shape[o.shape.length-1])throw new i.ValueError("You are passing a target array of shape ".concat(o.shape," while using ")+"a loss 'categorical_crossentropy'. 'categorical_crossentropy'expects targets to be binary matrices (1s and 0s) of shape [samples, classes].");if(-1!==r.indexOf(s)){const e=o.shape.slice(1),t=c.slice(1);for(let n=0;n<e.length;++n){const r=e[n],a=t[n];if(null!=a&&r!==a)throw new i.ValueError("A target Tensor with shape ".concat(o.shape," was passed for an ")+"output of shape ".concat(c,", while using a loss function that ")+"expects targets to have the same shape as the output.")}}}}}(t,this.feedLossFns,this.feedOutputShapes),this.stateful&&null!=n&&n>0&&e[0].shape[0]%n!=0)throw new i.ValueError("In a stateful network, you should only pass inputs with a number of samples that is divisible by the batch size "+"".concat(n,". Found: ").concat(e[0].shape[0]," sample(s)."));return[e,t]}async standardizeUserData(e,t,n,r){let a=!(arguments.length>4&&void 0!==arguments[4])||arguments[4],o=arguments.length>5?arguments[5]:void 0;const[s,i]=this.standardizeUserDataXY(e,t,a,o);if(null!=n)throw new Error("sample weight is not supported yet.");let c=null;if(null!=r){const e=(0,k.standardizeClassWeights)(r,this.outputNames);c=[];for(let t=0;t<e.length;++t)c.push(await(0,k.standardizeWeights)(i[t],null,e[t]))}return[s,i,c]}testLoop(e,t,n){let s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,c=arguments.length>4?arguments[4]:void 0;return a.tidy((()=>{const l=this.checkNumSamples(t,n,c,"steps"),u=[];if(s>0)throw new i.NotImplementedError("Verbose mode is not implemented yet.");if(null!=c)throw new i.NotImplementedError("steps mode in testLoop() is not implemented yet");{const s=(0,w.makeBatches)(l,n),i=(0,r.tensor1d)((0,m.range)(0,l));for(let n=0;n<s.length;++n){const c=s[n][0],l=s[n][1],d=o.sliceAlongFirstAxis(i,c,l-c),p=(0,w.sliceArraysByIndices)(t,d),h=e(p);if(0===n)for(let e=0;e<h.length;++e)u.push((0,r.scalar)(0));for(let e=0;e<h.length;++e){const t=h[e];u[e]=a.add(u[e],a.mul(l-c,t))}}for(let e=0;e<u.length;++e)u[e]=a.div(u[e],l)}return u}))}getDedupedMetricsNames(){const e=this.metricsNames,t=[];for(let n=0;n<e.length;++n){const r=e[n];let a=r;if((0,h.count)(e,r)>1){const t=(0,h.count)(e.slice(0,n),r);a+="_".concat(t)}t.push(a)}return t}makeTrainFunction(){return e=>{const t=[],n=e.slice(0,this.inputs.length),r=e.slice(this.inputs.length,this.inputs.length+this.outputs.length),o=e.slice(this.inputs.length+this.outputs.length,this.inputs.length+2*this.outputs.length),s=[],i=this.collectedTrainableWeights.map((e=>e.read()));return[this.optimizer_.minimize((()=>{const e=[];for(let t=0;t<this.inputs.length;++t)e.push({key:this.inputs[t],value:n[t]});const i=new b.FeedDict(e),c=(0,b.execute)(this.outputs,i,{training:!0});let l;for(let e=0;e<this.lossFunctions.length;++e){let n=(0,this.lossFunctions[e])(r[e],c[e]);null!=o[e]&&(n=(0,k.computeWeightedLoss)(n,o[e]));const s=a.mean(n);t.push(s),l=0===e?n:a.add(l,n)}for(let e=0;e<this.metricsTensors.length;++e){let n;if(this.outputs.length>1&&e<this.outputs.length)n=t[e];else{const t=this.metricsTensors[e][0],o=this.metricsTensors[e][1];n=a.mean(t(r[o],c[o]))}a.keep(n),s.push(n)}
1return l=a.mean(l),this.calculateLosses().forEach((e=>{l=a.add(l,e)})),l}),!0,i)].concat(s)}}makeTestFunction(){this.testFunction=e=>a.tidy((()=>{const t=[];let n;const r=e.slice(0,this.inputs.length),o=e.slice(this.inputs.length,this.inputs.length+this.outputs.length),s=[];for(let e=0;e<this.inputs.length;++e)s.push({key:this.inputs[e],value:r[e]});const i=new b.FeedDict(s),c=(0,b.execute)(this.outputs,i);for(let e=0;e<this.lossFunctions.length;++e){const r=this.lossFunctions[e],s=a.mean(r(o[e],c[e]));n=0===e?s:a.add(n,s),t.push(n)}for(let e=0;e<this.metricsTensors.length;++e){const n=this.metricsTensors[e][0],r=this.metricsTensors[e][1],s=a.mean(n(o[r],c[r]));t.push(s)}return t}))}async fit(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return(0,w.fitTensors)(this,e,t,n)}async fitDataset(e,t){return(0,x.fitDataset)(this,e,t)}async trainOnBatch(e,t){const n=await this.standardizeUserData(e,t),r=n[0],o=n[1],s=this.makeTrainFunction()(r.concat(o)),i=[];for(const e of s){const t=await e.data();i.push(t[0])}return a.dispose(s),(0,w.disposeNewTensors)(n[0],e),(0,w.disposeNewTensors)(n[1],t),(0,h.singletonOrArray)(i)}getNamedWeights(e){const t=[],n=null!=e&&e.trainableOnly,r=n?this.trainableWeights:this.weights,a=this.getWeights(n);for(let e=0;e<r.length;++e)n&&!r[e].trainable||t.push({name:r[e].originalName,tensor:a[e]});return t}set stopTraining(e){this.stopTraining_=e}get stopTraining(){return this.stopTraining_}get optimizer(){return this.optimizer_}set optimizer(e){this.optimizer_!==e&&(this.optimizer_=e,this.isOptimizerOwned=!1)}dispose(){const e=super.dispose();if(0===e.refCountAfterDispose&&null!=this.optimizer&&this.isOptimizerOwned){const t=a.memory().numTensors;this.optimizer_.dispose(),e.numDisposedVariables+=t-a.memory().numTensors}return e}getLossIdentifiers(){let e;if("string"==typeof this.loss)e=(0,h.toSnakeCase)(this.loss);else if(Array.isArray(this.loss)){for(const e of this.loss)if("string"!=typeof e)throw new Error("Serialization of non-string loss is not supported.");e=this.loss.map((e=>(0,h.toSnakeCase)(e)))}else{const t=Object.keys(this.loss);e={};const n=this.loss;for(const r of t){if("string"!=typeof n[r])throw new Error("Serialization of non-string loss is not supported.");e[r]=(0,h.toSnakeCase)(n[r])}}return e}getMetricIdentifiers(){if("string"==typeof this.metrics||"function"==typeof this.metrics)return[(0,h.toSnakeCase)(u.getLossOrMetricName(this.metrics))];if(Array.isArray(this.metrics))return this.metrics.map((e=>(0,h.toSnakeCase)(u.getLossOrMetricName(e))));{const e={};for(const t in this.metrics)e[t]=(0,h.toSnakeCase)(u.getLossOrMetricName(this.metrics[t]));return e}}getTrainingConfig(){return{loss:this.getLossIdentifiers(),metrics:this.getMetricIdentifiers(),optimizer_config:{class_name:this.optimizer.getClassName(),config:this.optimizer.getConfig()}}}loadTrainingConfig(e){if(null!=e.weighted_metrics)throw new Error("Loading weight_metrics is not supported yet.");if(null!=e.loss_weights)throw new Error("Loading loss_weights is not supported yet.");if(null!=e.sample_weight_mode)throw new Error("Loading sample_weight_mode is not supported yet.");const t=(0,g.convertPythonicToTs)(e.optimizer_config),n=(0,c.deserialize)(t);let r,a;if("string"==typeof e.loss)r=(0,h.toCamelCase)(e.loss);else if(Array.isArray(e.loss))r=e.loss.map((e=>(0,h.toCamelCase)(e)));else if(null!=e.loss){r={};for(const t in e.loss)r[t]=(0,h.toCamelCase)(e.loss[t])}if(Array.isArray(e.metrics))a=e.metrics.map((e=>(0,h.toCamelCase)(e)));else if(null!=e.metrics){a={};for(const t in e.metrics)a[t]=(0,h.toCamelCase)(e.metrics[t])}this.compile({loss:r,metrics:a,optimizer:n})}async save(e,t){if("string"==typeof e){const t=r.io.getSaveHandlers(e);if(0===t.length)throw new i.ValueError("Cannot find any save handlers for URL '".concat(e,"'"));if(t.length>1)throw new i.ValueError("Found more than one (".concat(t.length,") save handlers for ")+"URL '".concat(e,"'"));e=t[0]}if(null==e.save)throw new i.ValueError("LayersModel.save() cannot proceed because the IOHandler provided does not have the `save` attribute defined.");const n=await r.io.encodeWeights(this.getNamedWeights(t)),a={modelTopology:this.toJSON(null,!1),format:"layers-model",generatedBy:"TensorFlow.js tfjs-layers v".concat(y.version),convertedBy:null};if(null!=t&&t.includeOptimizer&&null!=this.optimizer){a.trainingConfig=this.getTrainingConfig();const e="optimizer",{data:t,specs:o}=await r.io.encodeWeights(await this.optimizer.getWeights(),e);n.specs.push(...o),n.data=r.io.concatenateArrayBuffers([n.data,t])}if(null!=this.userDefinedMetadata){const e=!0;
1(0,p.checkUserDefinedMetadata)(this.userDefinedMetadata,this.name,e),a.userDefinedMetadata=this.userDefinedMetadata}return a.weightData=n.data,a.weightSpecs=n.specs,e.save(a)}setUserDefinedMetadata(e){(0,p.checkUserDefinedMetadata)(e,this.name),this.userDefinedMetadata=e}getUserDefinedMetadata(){return this.userDefinedMetadata}}t.LayersModel=M,M.className="Model",r.serialization.registerClass(M);class A extends M{}t.Functional=A,A.className="Functional",r.serialization.registerClass(A)},162330:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.evaluateDataset=async function(e,t,n){const o=null!=(n=n||{}).batches,i=e.testFunction;let l=[];if(n.verbose>0)throw new s.NotImplementedError("Verbose mode is not implemented yet.");a.util.assert(!o||n.batches>0&&Number.isInteger(n.batches),(()=>"Test loop expects `batches` to be a positive integer, but "+"received ".concat(JSON.stringify(n.batches))));const u=(d=t,"function"==typeof d.next?t:await t.iterator());var d;let h=0,f=0;for(;!o||f<n.batches;){const t=await u.next();if(l=a.tidy((()=>{if(t.value){const{xs:n,ys:o}=p(e,t.value),s=n.concat(o),c=a.tidy((()=>i(s)));if(a.dispose(s),0===f)for(let e=0;e<c.length;++e)l.push((0,r.scalar)(0));const u=s[0].shape[0];for(let e=0;e<c.length;++e){const t=c[e],n=l[e];l[e]=a.tidy((()=>a.add(l[e],a.mul(u,t)))),f>0&&a.dispose(n)}a.dispose(c),h+=u,++f}return l})),t.done){o&&console.warn("Your dataset iterator ran out of data during evaluateDataset(). Interrupting evalution. Make sure that your dataset can generate at least `batches` "+"batches (in this case, ".concat(n.batches," batches). ")+"You may need to use the repeat() function when building your dataset.");break}}for(let e=0;e<l.length;++e){const t=l[e];l[e]=a.div(l[e],h),a.dispose(t)}return(0,c.singletonOrArray)(l)},t.fitDataset=async function(e,t,n){const r=null!=n.batchesPerEpoch;if(a.util.assert(null!=e.optimizer,(()=>"You must compile a model before training/testing. Use LayersModel.compile(modelCompileConfig).")),a.util.assert(null!=n,(()=>"For fitDataset(), the 2nd argument (config) is required, but it is not provided in this call.")),a.util.assert(null!=n.epochs&&n.epochs>0&&Number.isInteger(n.epochs),(()=>"For fitDataset(), config.epochs is expected to be a positive "+"integer, but got ".concat(n.epochs))),a.util.assert(!r||n.batchesPerEpoch>0&&Number.isInteger(n.batchesPerEpoch),(()=>"For fitDataset(), config.batchesPerEpoch is expected to be a "+"positive integer if specified, but got ".concat(n.batchesPerEpoch))),a.util.assert(null==n.validationSplit,(()=>"`validationSplit` is not supported by `fitDataset()`. Use validationData instead.")),e.isTraining)throw new Error("Cannot start training because another fit() call is ongoing.");e.isTraining=!0;try{const u=null!=n.validationData;let h,m;if(u)if(f(n.validationData))a.util.assert(null==n.validationBatches||n.validationBatches>0&&Number.isInteger(n.validationBatches),(()=>"For fitDataset() with dataset-based validation, config.validationBatches is expected not to be provided, or to be a positive integer, "+"but got ".concat(n.validationBatches)));else{const e=function(e){if(3===e.length)throw new s.NotImplementedError("Validation with sample weights is not implemented yet.");return{xs:e[0],ys:e[1]}}(n.validationData);h=e.xs,m=e.ys}const g=e.makeTrainFunction(),y=e.getDedupedMetricsNames();let v;v=u?y.slice().concat(y.map((e=>"val_"+e))):y.slice();const b=(0,o.standardizeCallbacks)(n.callbacks,n.yieldEvery),x=null==n.verbose?1:n.verbose,{callbackList:w,history:k}=(0,o.configureCallbacks)(b,x,n.epochs,null,null,function(e,t){let n=null;null!=t.batchesPerEpoch?n=t.batchesPerEpoch:Number.isFinite(e.size)&&(n=e.size);return n}(t,n),null,u,v);w.setModel(e),e.history=k,await w.onTrainBegin(),e.stopTraining_=!1;let _=null==n.initialEpoch?0:n.initialEpoch,C=await t.iterator();for(;_<n.epochs;){const o={};await w.onEpochBegin(_);let s=0,v=0;for(r||(C=await t.iterator());!r||s<n.batchesPerEpoch;){const t=await C.next();if(r&&t.done){console.warn("You provided `batchesPerEpoch` as "+"".concat(n.batchesPerEpoch,", ")+"but your dataset iterator ran out of data after "+"".concat(s," batches; ")+"interrupting training. Make sure that your dataset can generate at least `batchesPerEpoch * epochs` batches (in this case, "+"".concat(n.batchesPerEpoch*n.epochs," batches). ")+"You may need to use the repeat() function when building your dataset.");break}if(null!=t.value){const{xs:r,ys:o}=p(e,t.value),c={};c.batch=v,c.size=r[0].shape[0],await w.onBatchBegin(v,c);const u=[];
1if(null!=n.classWeight){const t=(0,l.standardizeClassWeights)(n.classWeight,e.outputNames);for(let e=0;e<t.length;++e)u.push(await(0,l.standardizeWeights)(o[e],null,t[e]))}const d=r.concat(o).concat(u),h=g(d);a.dispose(d);for(let e=0;e<y.length;++e){const t=y[e],n=h[e];c[t]=n,a.keep(n)}await w.onBatchEnd(v,c),(0,i.disposeTensorsInLogs)(c),v++,s++}if(r?s>=n.batchesPerEpoch:t.done){if(u){let t;t=f(n.validationData)?(0,c.toList)(await e.evaluateDataset(n.validationData,{batches:n.validationBatches})):(0,c.toList)(e.evaluate(h,m,{batchSize:null==n.validationBatchSize?d:n.validationBatchSize,verbose:0}));for(let n=0;n<e.metricsNames.length;++n)o["val_".concat(e.metricsNames[n])]=t[n]}break}if(e.stopTraining_)break}if(await w.onEpochEnd(_,o),_++,e.stopTraining_)break}return await w.onTrainEnd(),await e.history.syncData(),e.history}finally{e.isTraining=!1}};var r=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=u(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if("default"!==o&&{}.hasOwnProperty.call(e,o)){var s=a?Object.getOwnPropertyDescriptor(e,o):null;s&&(s.get||s.set)?Object.defineProperty(r,o,s):r[o]=e[o]}return r.default=e,n&&n.set(e,r),r}(n(735534)),a=r,o=n(733680),s=n(608012),i=n(782668),c=n(986904),l=n(117347);function u(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(u=function(e){return e?n:t})(e)}const d=32;function p(e,t){let n,r;const o=t;n=o.xs,r=o.ys,a.util.assert(null!=n&&null!=r,(()=>"A Dataset iterator for fitDataset() is expected to generate objects of the form `{xs: xVal, ys: yVal}`, where the two values may be `tf.Tensor`, an array of Tensors, or a map of string to Tensor. The provided Dataset instead generates "+"".concat(t)));const s=h("input",e.inputNames,n),i=h("output",e.outputNames,r),c=s[0].shape[0];a.util.assert(s.length===e.inputs.length,(()=>"LayersModel has ".concat(e.inputs.length," inputs, but the dataset ")+"provides ".concat(s.length," inputs. (Expected input keys: ")+"".concat(JSON.stringify(e.inputNames),")"))),a.util.assert(i.length===e.outputs.length,(()=>"LayersModel has ".concat(e.outputs.length," outputs, but the dataset ")+"provides ".concat(i.length," outputs. (Expected output keys: ")+"".concat(JSON.stringify(e.outputNames),")")));for(let t=0;t<s.length;t++)a.util.assert(s[t].shape[0]===c,(()=>"Batch size mismatch: input "+"".concat(e.inputNames[t]," has ").concat(s[t].shape[0],"; ")+"expected ".concat(c," based on input ").concat(e.inputNames[0],".")));for(let t=0;t<i.length;t++)a.util.assert(i[t].shape[0]===c,(()=>"Batch size mismatch: output "+"".concat(e.outputNames[t]," has ").concat(i[t].shape[0],"; ")+"expected ".concat(c," based on input ").concat(e.inputNames[0],".")));return{xs:s,ys:i}}function h(e,t,n){if(n instanceof a.Tensor)return[n];if(Array.isArray(n))return a.util.assert(n.length===t.length,(()=>"Received an array of ".concat(n.length," Tensors, but expected ").concat(t.length," to match the ").concat(e," keys ").concat(t,"."))),n;{const r=[];for(const a of t){if(null==n[a])throw new s.ValueError("The feature data generated by the dataset lacks the required "+"".concat(e," key '").concat(a,"'."));r.push(n[a])}return r}}function f(e){return"function"==typeof e.iterator}},984039:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.checkBatchSize=d,t.disposeNewTensors=m,t.ensureTensorsRank2OrHigher=function(e){const t=[];e instanceof r.Tensor&&(e=[e]);for(let n=0;n<e.length;++n){const r=e[n];if(1===r.rank)t.push((0,o.expandDims)(r,1));else{if(0===r.rank)throw new Error("Expected tensor to be at least 1D, but received a 0D tensor (scalar).");t.push(r)}}return t},t.fitTensors=async function(e,t,n){let u,g,y,v,b,x,w,k,_,C=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};if(e.isTraining)throw new Error("Cannot start training because another fit() call is ongoing.");e.isTraining=!0;try{const m=null==C.batchSize?32:C.batchSize;d(m);const P=!1,O=await e.standardizeUserData(t,n,C.sampleWeight,C.classWeight,P,m);u=O[0],g=O[1],_=O[2];let N,I=!1;if(null!=C.validationData&&C.validationData.length>0){if(I=!0,2!==C.validationData.length)throw 3===C.validationData.length?new i.NotImplementedError("validationData including sample weights is not supported yet."):new i.ValueError("When passing validation data, it must contain 2 (valX, valY) or 3 (valX, valY, valSampleWeight) items;
1 "+"".concat(C.validationData," is invalid."));b=C.validationData[0],x=C.validationData[1];const t=!0,n=await e.standardizeUserData(b,x,null,null,t,m);w=n[0],k=n[1],N=w.concat(k)}else if(null!=C.validationSplit&&C.validationSplit>0&&C.validationSplit<1){I=!0;const e=Math.floor(u[0].shape[0]*(1-C.validationSplit)),t=u[0].shape[0];w=p(u,e,t),y=u,u=p(u,0,e),k=p(g,e,t),v=g,g=p(g,0,e),N=w.concat(k)}else null!=C.validationSteps&&(I=!0);const T=u.concat(g).concat(_);e.checkTrainableWeightsConsistency();const S=e.makeTrainFunction(),E=e.getDedupedMetricsNames();let M,A;I?(e.makeTestFunction(),M=e.testFunction,A=E.slice().concat(E.map((e=>"val_"+e)))):(M=null,N=[],A=E.slice());const D=(0,s.standardizeCallbacks)(C.callbacks,C.yieldEvery),R=await async function(e,t,n,u,d,p,m,g,y,v,b,x,w,k,_){null==d&&(d=32);null==p&&(p=1);null==b&&(b=!0);null==w&&(w=0);let C=!1;null!=y&&null!=v&&(C=!0);if(null!=_&&(C=!0,null==k))throw new i.ValueError("Can only use `validationSteps` when doing step-wise training, i.e., `stepsPerEpoch` must be set.");const P=e.checkNumSamples(n,d,k,"steps_per_epoch");let O;null!=P&&(O=(0,l.range)(0,P));null==m&&(m=1);const{callbackList:N,history:I}=(0,s.configureCallbacks)(g,m,p,w,P,k,d,C,x);N.setModel(e),e.history=I,await N.onTrainBegin(),e.stopTraining_=!1;for(let s=w;s<p;++s){await N.onEpochBegin(s);const l={};if(null!=k)throw new i.NotImplementedError("stepsPerEpoch mode is not implemented yet.");{if("batch"===b)throw new i.NotImplementedError("batch shuffling is not implemneted yet");b&&r.util.shuffle(O);const s=(0,r.tensor1d)(O),p=f(P,d);for(let r=0;r<p.length;++r){const i={};if(await N.onBatchBegin(r,i),a.tidy((()=>{const c=p[r][0],f=p[r][1],m=(0,o.sliceAlongFirstAxis)(s,c,f-c);i.batch=r,i.size=f-c;const g=h(n,m),b=t(g);for(let e=0;e<u.length;++e){const t=u[e],n=b[e];i[t]=n,a.keep(n)}if(r===p.length-1&&C){const t=e.testLoop(y,v,d);for(let e=0;e<u.length;++e){const n=u[e],r=t[e];a.keep(r),l["val_"+n]=r}}})),await N.onBatchEnd(r,i),(0,c.disposeTensorsInLogs)(i),e.stopTraining_)break}s.dispose()}if(await N.onEpochEnd(s,l),e.stopTraining_)break}return await N.onTrainEnd(),await e.history.syncData(),e.history}(e,S,T,E,m,C.epochs,C.verbose,D,M,N,C.shuffle,A,C.initialEpoch,null,null);return R}finally{e.isTraining=!1,m(u,t),m(g,n),m(y,t),m(v,n),m(w,b),m(k,x),null!=_&&a.dispose(_)}},t.makeBatches=f,t.sliceArrays=p,t.sliceArraysByIndices=h;var r=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=u(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if("default"!==o&&{}.hasOwnProperty.call(e,o)){var s=a?Object.getOwnPropertyDescriptor(e,o):null;s&&(s.get||s.set)?Object.defineProperty(r,o,s):r[o]=e[o]}return r.default=e,n&&n.set(e,r),r}(n(735534)),a=r,o=n(984710),s=n(733680),i=n(608012),c=n(782668),l=n(302774);function u(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(u=function(e){return e?n:t})(e)}function d(e){a.util.assert(e>0&&Number.isInteger(e),(()=>"batchSize is required to be a positive integer, but got ".concat(e)))}function p(e,t,n){return null==e?[null]:Array.isArray(e)?e.map((e=>(0,o.sliceAlongFirstAxis)(e,t,n-t))):(0,o.sliceAlongFirstAxis)(e,t,n-t)}function h(e,t){return a.tidy((()=>null==e?null:Array.isArray(e)?e.map((e=>h(e,t))):(0,o.gather)(e,"int32"===t.dtype?t:a.cast(t,"int32"))))}function f(e,t){const n=[];let r=0,a=null;for(;r<e;)a=r+t,a>=e&&(a=e),n.push([r,a]),r=a;return n}function m(e,t){if(null==e)return;const n=[];if(t instanceof r.Tensor)n.push(t.id);else if(Array.isArray(t))t.forEach((e=>n.push(e.id)));else if(null!=t)for(const e in t){const r=t[e];n.push(r.id)}const a=[];if(e instanceof r.Tensor)-1===n.indexOf(e.id)&&a.push(e);else if(Array.isArray(e))e.forEach((e=>{-1===n.indexOf(e.id)&&a.push(e)}));else if(null!=e)for(const t in e){const r=e[t];-1===n.indexOf(r.id)&&a.push(r)}a.forEach((e=>{e.isDisposed||e.dispose()}))}},117347:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.computeWeightedLoss=function(e,t){return(0,r.mul)(e,t)},t.standardizeClassWeights=function(e,t){return a(e,t,"classWeight")},t.standardizeSampleWeights=function(e,t){return a(e,t,"sampleWeight")},t.standardizeWeights=async function(e,t,n,a){if(null!=t||null!=a)throw new Error("Support sampleWeight is not implemented yet");if(null!=n){const t=(0,r.tidy)((()=>
1{if(1===e.shape.length)return(0,r.clone)(e);if(2===e.shape.length){if(e.shape[1]>1){const t=1;return(0,r.argMax)(e,t)}if(1===e.shape[1])return(0,r.reshape)(e,[e.shape[0]]);throw new Error("Encountered unexpected last-dimension size (".concat(e.shape[1],") ")+"during handling of class weights. The size is expected to be >= 1.")}throw new Error("Unexpected rank of target (y) tensor (".concat(e.rank,") during ")+"handling of class weights. The rank is expected to be 1 or 2.")})),a=Array.from(await t.data());(0,r.dispose)(t);const o=[];return a.forEach((e=>{if(null==n[e])throw new Error("classWeight must contain all classes in the training data. "+"The class ".concat(e," exists in the data but not in ")+"classWeight");o.push(n[e])})),(0,r.tensor1d)(o,"float32")}return null};var r=n(735534);function a(e,t,n){const r=t.length;if(null==e||Array.isArray(e)&&0===e.length)return t.map((e=>null));if(1===r)return Array.isArray(e)&&1===e.length?e:"object"==typeof e&&t[0]in e?[e[t[0]]]:[e];if(Array.isArray(e)){if(e.length!==r)throw new Error("Provided ".concat(n," is an array of ").concat(e.length," ")+"element(s), but the model has ".concat(r," outputs. ")+"Make sure a set of weights is provided for each model output.");return e}if("object"==typeof e&&Object.keys(e).length>0&&"object"==typeof e[Object.keys(e)[0]]){const n=[];return t.forEach((t=>{t in e?n.push(e[t]):n.push(null)})),n}throw new Error("The model has multiple (".concat(r,") outputs, ")+"so ".concat(n," must be either an array with ")+"".concat(r," elements or an object with ").concat(t," keys. ")+"Provided ".concat(n," not understood: ").concat(JSON.stringify(e)))}},608012:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ValueError=t.RuntimeError=t.NotImplementedError=t.IndexError=t.AttributeError=t.AssertionError=void 0;class n extends Error{constructor(e){super(e),Object.setPrototypeOf(this,n.prototype)}}t.AttributeError=n;class r extends Error{constructor(e){super(e),Object.setPrototypeOf(this,r.prototype)}}t.RuntimeError=r;class a extends Error{constructor(e){super(e),Object.setPrototypeOf(this,a.prototype)}}t.ValueError=a;class o extends Error{constructor(e){super(e),Object.setPrototypeOf(this,o.prototype)}}t.NotImplementedError=o;class s extends Error{constructor(e){super(e),Object.setPrototypeOf(this,s.prototype)}}t.AssertionError=s;class i extends Error{constructor(e){super(e),Object.setPrototypeOf(this,i.prototype)}}t.IndexError=i},509449:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.input=function(e){return(0,a.Input)(e)},t.loadLayersModel=function(e,t){null==t&&(t={});return(0,s.loadLayersModelInternal)(e,t)},t.model=function(e){return new o.LayersModel(e)},t.registerCallbackConstructor=function(e,t){r.CallbackConstructorRegistry.registerCallbackConstructor(e,t)},t.sequential=function(e){return new s.Sequential(e)};var r=n(733680),a=n(310750),o=n(171320),s=n(567670)},215560:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.maxNorm=function(e){return new r.MaxNorm(e)},t.minMaxNorm=function(e){return new r.MinMaxNorm(e)},t.nonNeg=function(){return new r.NonNeg},t.unitNorm=function(e){return new r.UnitNorm(e)};var r=n(87475)},962700:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.constant=function(e){return new r.Constant(e)},t.glorotNormal=function(e){return new r.GlorotNormal(e)},t.glorotUniform=function(e){return new r.GlorotUniform(e)},t.heNormal=function(e){return new r.HeNormal(e)},t.heUniform=function(e){return new r.HeUniform(e)},t.identity=function(e){return new r.Identity(e)},t.leCunNormal=function(e){return new r.LeCunNormal(e)},t.leCunUniform=function(e){return new r.LeCunUniform(e)},t.ones=function(){return new r.Ones},t.orthogonal=function(e){return new r.Orthogonal(e)},t.randomNormal=function(e){return new r.RandomNormal(e)},t.randomUniform=function(e){return new r.RandomUniform(e)},t.truncatedNormal=function(e){return new r.TruncatedNormal(e)},t.varianceScaling=function(e){return new r.VarianceScaling(e)},t.zeros=function(){return new r.Zeros};var r=n(492560)},552646:(e,t,n)=>{"use strict";
1Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"Layer",{enumerable:!0,get:function(){return a.Layer}}),Object.defineProperty(t,"RNN",{enumerable:!0,get:function(){return y.RNN}}),Object.defineProperty(t,"RNNCell",{enumerable:!0,get:function(){return y.RNNCell}}),t.activation=function(e){return new u.Activation(e)},t.add=function(e){return new p.Add(e)},t.alphaDropout=function(e){return new h.AlphaDropout(e)},t.average=function(e){return new p.Average(e)},t.averagePooling1d=b,t.averagePooling2d=x,t.averagePooling3d=w,t.avgPool1d=function(e){return b(e)},t.avgPool2d=function(e){return x(e)},t.avgPool3d=function(e){return w(e)},t.avgPooling1d=function(e){return b(e)},t.avgPooling2d=function(e){return x(e)},t.avgPooling3d=function(e){return w(e)},t.batchNormalization=function(e){return new f.BatchNormalization(e)},t.bidirectional=function(e){return new v.Bidirectional(e)},t.concatenate=function(e){return new p.Concatenate(e)},t.conv1d=function(e){return new i.Conv1D(e)},t.conv2d=function(e){return new i.Conv2D(e)},t.conv2dTranspose=function(e){return new i.Conv2DTranspose(e)},t.conv3d=function(e){return new i.Conv3D(e)},t.conv3dTranspose=function(e){return new i.Conv3DTranspose(e)},t.convLstm2d=function(e){return new l.ConvLSTM2D(e)},t.convLstm2dCell=function(e){return new l.ConvLSTM2DCell(e)},t.cropping2D=function(e){return new i.Cropping2D(e)},t.dense=function(e){return new u.Dense(e)},t.depthwiseConv2d=function(e){return new c.DepthwiseConv2D(e)},t.dot=function(e){return new p.Dot(e)},t.dropout=function(e){return new u.Dropout(e)},t.elu=function(e){return new s.ELU(e)},t.embedding=function(e){return new d.Embedding(e)},t.flatten=function(e){return new u.Flatten(e)},t.gaussianDropout=function(e){return new h.GaussianDropout(e)},t.gaussianNoise=function(e){return new h.GaussianNoise(e)},t.globalAveragePooling1d=function(e){return new g.GlobalAveragePooling1D(e)},t.globalAveragePooling2d=function(e){return new g.GlobalAveragePooling2D(e)},t.globalMaxPool2d=t.globalMaxPool1d=void 0,t.globalMaxPooling1d=k,t.globalMaxPooling2d=_,t.gru=function(e){return new y.GRU(e)},t.gruCell=function(e){return new y.GRUCell(e)},Object.defineProperty(t,"input",{enumerable:!0,get:function(){return o.input}}),t.inputLayer=function(e){return new r.InputLayer(e)},t.layerNormalization=function(e){return new f.LayerNormalization(e)},t.leakyReLU=function(e){return new s.LeakyReLU(e)},t.lstm=function(e){return new y.LSTM(e)},t.lstmCell=function(e){return new y.LSTMCell(e)},t.masking=function(e){return new u.Masking(e)},t.maxPool2d=t.maxPool1d=void 0,t.maxPooling1d=C,t.maxPooling2d=P,t.maxPooling3d=function(e){return new g.MaxPooling3D(e)},t.maximum=function(e){return new p.Maximum(e)},t.minimum=function(e){return new p.Minimum(e)},t.multiply=function(e){return new p.Multiply(e)},t.permute=function(e){return new u.Permute(e)},t.prelu=function(e){return new s.PReLU(e)},t.reLU=function(e){return new s.ReLU(e)},t.repeatVector=function(e){return new u.RepeatVector(e)},t.reshape=function(e){return new u.Reshape(e)},t.rnn=function(e){return new y.RNN(e)},t.separableConv2d=function(e){return new i.SeparableConv2D(e)},t.simpleRNN=function(e){return new y.SimpleRNN(e)},t.simpleRNNCell=function(e){return new y.SimpleRNNCell(e)},t.softmax=function(e){return new s.Softmax(e)},t.spatialDropout1d=function(e){return new u.SpatialDropout1D(e)},t.stackedRNNCells=function(e){return new y.StackedRNNCells(e)},t.thresholdedReLU=function(e){return new s.ThresholdedReLU(e)},t.timeDistributed=function(e){return new v.TimeDistributed(e)},t.upSampling2d=function(e){return new i.UpSampling2D(e)},t.zeroPadding2d=function(e){return new m.ZeroPadding2D(e)};var r=n(310750),a=n(840889),o=n(509449),s=n(767781),i=n(180743),c=n(971420),l=n(674858),u=n(787742),d=n(939386),p=n(185333),h=n(715825),f=n(92446),m=n(56197),g=n(348311),y=n(302909),v=n(447767);function b(e){return new g.AveragePooling1D(e)}function x(e){return new g.AveragePooling2D(e)}function w(e){return new g.AveragePooling3D(e)}function k(e){return new g.GlobalMaxPooling1D(e)}function _(e){return new g.GlobalMaxPooling2D(e)}function C(e){return new g.MaxPooling1D(e)}function P(e){return new g.MaxPooling2D(e)}t.globalMaxPool1d=k,t.globalMaxPool2d=_,t.maxPool1d=C,t.maxPool2d=P},585907:(e,t,n)=>{"use strict";
1Object.defineProperty(t,"__esModule",{value:!0}),t.MAPE=function(e,t){return r.meanAbsolutePercentageError(e,t)},t.MSE=function(e,t){return r.meanSquaredError(e,t)},t.binaryAccuracy=function(e,t){return a.binaryAccuracy(e,t)},t.binaryCrossentropy=function(e,t){return a.binaryCrossentropy(e,t)},t.categoricalAccuracy=function(e,t){return a.categoricalAccuracy(e,t)},t.categoricalCrossentropy=function(e,t){return a.categoricalCrossentropy(e,t)},t.cosineProximity=function(e,t){return r.cosineProximity(e,t)},t.mape=function(e,t){return r.meanAbsolutePercentageError(e,t)},t.meanAbsoluteError=function(e,t){return r.meanAbsoluteError(e,t)},t.meanAbsolutePercentageError=function(e,t){return r.meanAbsolutePercentageError(e,t)},t.meanSquaredError=function(e,t){return r.meanSquaredError(e,t)},t.mse=function(e,t){return r.meanSquaredError(e,t)},t.precision=function(e,t){return a.precision(e,t)},t.recall=function(e,t){return a.recall(e,t)},t.sparseCategoricalAccuracy=function(e,t){return a.sparseCategoricalAccuracy(e,t)};var r=s(n(242135)),a=s(n(26267));function o(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(o=function(e){return e?n:t})(e)}function s(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=o(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var s in e)if("default"!==s&&{}.hasOwnProperty.call(e,s)){var i=a?Object.getOwnPropertyDescriptor(e,s):null;i&&(i.get||i.set)?Object.defineProperty(r,s,i):r[s]=e[s]}return r.default=e,n&&n.set(e,r),r}},135139:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"modelFromJSON",{enumerable:!0,get:function(){return r.modelFromJSON}});var r=n(567670)},475680:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.l1=function(e){return a.l1(e)},t.l1l2=function(e){return new r.L1L2(e)},t.l2=function(e){return a.l2(e)};var r=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=o(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var s in e)if("default"!==s&&{}.hasOwnProperty.call(e,s)){var i=a?Object.getOwnPropertyDescriptor(e,s):null;i&&(i.get||i.set)?Object.defineProperty(r,s,i):r[s]=e[s]}return r.default=e,n&&n.set(e,r),r}(n(141115)),a=r;function o(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(o=function(e){return e?n:t})(e)}},268655:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"Callback",{enumerable:!0,get:function(){return u.Callback}}),Object.defineProperty(t,"CallbackList",{enumerable:!0,get:function(){return l.CallbackList}}),Object.defineProperty(t,"CustomCallback",{enumerable:!0,get:function(){return l.CustomCallback}}),Object.defineProperty(t,"EarlyStopping",{enumerable:!0,get:function(){return u.EarlyStopping}}),Object.defineProperty(t,"History",{enumerable:!0,get:function(){return l.History}}),Object.defineProperty(t,"InputSpec",{enumerable:!0,get:function(){return d.InputSpec}}),Object.defineProperty(t,"LayerVariable",{enumerable:!0,get:function(){return g.LayerVariable}}),Object.defineProperty(t,"LayersModel",{enumerable:!0,get:function(){return p.LayersModel}}),Object.defineProperty(t,"RNN",{enumerable:!0,get:function(){return f.RNN}}),Object.defineProperty(t,"Sequential",{enumerable:!0,get:function(){return m.Sequential}}),Object.defineProperty(t,"SymbolicTensor",{enumerable:!0,get:function(){return d.SymbolicTensor}}),Object.defineProperty(t,"callbacks",{enumerable:!0,get:function(){return u.callbacks}}),t.initializers=t.constraints=void 0,Object.defineProperty(t,"input",{enumerable:!0,get:function(){return h.input}}),t.layers=void 0,Object.defineProperty(t,"loadLayersModel",{enumerable:!0,get:function(){return h.loadLayersModel}}),t.metrics=void 0,Object.defineProperty(t,"model",{enumerable:!0,get:function(){return h.model}}),t.models=void 0,Object.defineProperty(t,"registerCallbackConstructor",{enumerable:!0,get:function(){return h.registerCallbackConstructor}}),t.regularizers=void 0,Object.defineProperty(t,"sequential",{enumerable:!0,get:function(){return h.sequential}}),Object.defineProperty(t,"version_layers",{enumerable:!0,get:function(){return y.version}}),n(735534),n(288462);var r=b(n(215560));t.constraints=r;var a=b(n(962700));
1t.initializers=a;var o=b(n(552646));t.layers=o;var s=b(n(585907));t.metrics=s;var i=b(n(135139));t.models=i;var c=b(n(475680));t.regularizers=c;var l=n(733680),u=n(299871),d=n(840889),p=n(171320),h=n(509449),f=n(302909),m=n(567670),g=n(268778),y=n(480036);function v(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(v=function(e){return e?n:t})(e)}function b(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=v(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if("default"!==o&&{}.hasOwnProperty.call(e,o)){var s=a?Object.getOwnPropertyDescriptor(e,o):null;s&&(s.get||s.set)?Object.defineProperty(r,o,s):r[o]=e[o]}return r.default=e,n&&n.set(e,r),r}},492560:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Zeros=t.VarianceScaling=t.TruncatedNormal=t.RandomUniform=t.RandomNormal=t.Orthogonal=t.Ones=t.LeCunUniform=t.LeCunNormal=t.Initializer=t.Identity=t.INITIALIZER_IDENTIFIER_REGISTRY_SYMBOL_MAP=t.HeUniform=t.HeNormal=t.GlorotUniform=t.GlorotNormal=t.Constant=void 0,t.checkDistribution=p,t.checkFanMode=d,t.getInitializer=function(e){if("string"==typeof e){const t=e in T?T[e]:e;if("GlorotNormal"===t)return new _;if("GlorotUniform"===t)return new k;if("HeNormal"===t)return new C;if("HeUniform"===t)return new P;if("LeCunNormal"===t)return new O;if("LeCunUniform"===t)return new N;{const e={};return e.className=t,e.config={},S(e)}}return e instanceof h?e:S(e)},t.serializeInitializer=function(e){return(0,c.serializeKerasObject)(e)};var r=n(735534),a=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=u(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if("default"!==o&&{}.hasOwnProperty.call(e,o)){var s=a?Object.getOwnPropertyDescriptor(e,o):null;s&&(s.get||s.set)?Object.defineProperty(r,o,s):r[o]=e[o]}return r.default=e,n&&n.set(e,r),r}(n(984710)),o=n(545188),s=n(608012),i=n(486414),c=n(986904),l=n(302774);function u(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(u=function(e){return e?n:t})(e)}function d(e){(0,c.checkStringTypeUnionValue)(i.VALID_FAN_MODE_VALUES,"FanMode",e)}function p(e){(0,c.checkStringTypeUnionValue)(i.VALID_DISTRIBUTION_VALUES,"Distribution",e)}class h extends r.serialization.Serializable{fromConfigUsesCustomObjects(){return!1}getConfig(){return{}}}t.Initializer=h;class f extends h{apply(e,t){return(0,r.zeros)(e,t)}}t.Zeros=f,f.className="Zeros",r.serialization.registerClass(f);class m extends h{apply(e,t){return(0,r.ones)(e,t)}}t.Ones=m,m.className="Ones",r.serialization.registerClass(m);class g extends h{constructor(e){if(super(),"object"!=typeof e)throw new s.ValueError("Expected argument of type ConstantConfig but got ".concat(e));if(void 0===e.value)throw new s.ValueError("config must have value set but got ".concat(e));this.value=e.value}apply(e,t){return(0,r.tidy)((()=>(0,r.mul)((0,r.scalar)(this.value),(0,r.ones)(e,t))))}getConfig(){return{value:this.value}}}t.Constant=g,g.className="Constant",r.serialization.registerClass(g);class y extends h{constructor(e){super(),this.DEFAULT_MINVAL=-.05,this.DEFAULT_MAXVAL=.05,this.minval=e.minval||this.DEFAULT_MINVAL,this.maxval=e.maxval||this.DEFAULT_MAXVAL,this.seed=e.seed}apply(e,t){return(0,r.randomUniform)(e,this.minval,this.maxval,t)}getConfig(){return{minval:this.minval,maxval:this.maxval,seed:this.seed}}}t.RandomUniform=y,y.className="RandomUniform",r.serialization.registerClass(y);class v extends h{constructor(e){super(),this.DEFAULT_MEAN=0,this.DEFAULT_STDDEV=.05,this.mean=e.mean||this.DEFAULT_MEAN,this.stddev=e.stddev||this.DEFAULT_STDDEV,this.seed=e.seed}apply(e,t){if("float32"!==(t=t||"float32")&&"int32"!==t)throw new s.NotImplementedError("randomNormal does not support dType ".concat(t,"."));return a.randomNormal(e,this.mean,this.stddev,t,this.seed)}getConfig(){return{mean:this.mean,stddev:this.stddev,seed:this.seed}}}t.RandomNormal=v,v.className="RandomNormal",r.serialization.registerClass(v);class b extends h{constructor(e){super(),this.DEFAULT_MEAN=0,this.DEFAULT_STDDEV=.05,this.mean=e.mean||this.DEFAULT_MEAN,this.stddev=e.stddev||this.DEFAULT_STDDEV,this.seed=e.seed}apply(e,t){if("float32"!==(t=t||"float32")&&"int32"!==t)throw new s.NotImplementedError("truncatedNormal does not support dType ".concat(t,"."));return(0,r.truncatedNormal)(e,this.mean,this.stddev,t,this.seed)}getConfig(){return{mean:this.mean,stddev:this.stddev,seed:this.seed}}}t.TruncatedNormal=b,b.className="TruncatedNormal",r.serialization.registerClass(b);class x extends h{constructor(e){super(),this.gain=null!=e.gain?e.gain:1}apply(e,t){return(0,r.tidy)((()=>
1{if(2!==e.length||e[0]!==e[1])throw new s.ValueError("Identity matrix initializer can only be used for 2D square matrices.");return(0,r.mul)(this.gain,(0,r.eye)(e[0]))}))}getConfig(){return{gain:this.gain}}}t.Identity=x,x.className="Identity",r.serialization.registerClass(x);class w extends h{constructor(e){if(super(),e.scale<0)throw new s.ValueError("scale must be a positive float. Got: ".concat(e.scale));this.scale=null==e.scale?1:e.scale,this.mode=null==e.mode?"fanIn":e.mode,d(this.mode),this.distribution=null==e.distribution?"normal":e.distribution,p(this.distribution),this.seed=e.seed}apply(e,t){const n=function(e){let t,n,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"channelsLast";if((0,o.checkDataFormat)(r),2===e.length)t=e[0],n=e[1];else if(-1!==[3,4,5].indexOf(e.length)){if("channelsFirst"===r){const r=(0,l.arrayProd)(e,2);t=e[1]*r,n=e[0]*r}else if("channelsLast"===r){const r=(0,l.arrayProd)(e,0,e.length-2);t=e[e.length-2]*r,n=e[e.length-1]*r}}else{const r=(0,l.arrayProd)(e);t=Math.sqrt(r),n=Math.sqrt(r)}return[t,n]}(e),a=n[0],i=n[1];let c=this.scale;if("fanIn"===this.mode?c/=Math.max(1,a):"fanOut"===this.mode?c/=Math.max(1,i):c/=Math.max(1,(a+i)/2),"normal"===this.distribution){const n=Math.sqrt(c);if("float32"!==(t=t||"float32")&&"int32"!==t)throw new s.NotImplementedError("".concat(this.getClassName()," does not support dType ").concat(t,"."));return(0,r.truncatedNormal)(e,0,n,t,this.seed)}{const n=Math.sqrt(3*c);return(0,r.randomUniform)(e,-n,n,t)}}getConfig(){return{scale:this.scale,mode:this.mode,distribution:this.distribution,seed:this.seed}}}t.VarianceScaling=w,w.className="VarianceScaling",r.serialization.registerClass(w);class k extends w{constructor(e){super({scale:1,mode:"fanAvg",distribution:"uniform",seed:null==e?null:e.seed})}getClassName(){return w.className}}t.GlorotUniform=k,k.className="GlorotUniform",r.serialization.registerClass(k);class _ extends w{constructor(e){super({scale:1,mode:"fanAvg",distribution:"normal",seed:null==e?null:e.seed})}getClassName(){return w.className}}t.GlorotNormal=_,_.className="GlorotNormal",r.serialization.registerClass(_);class C extends w{constructor(e){super({scale:2,mode:"fanIn",distribution:"normal",seed:null==e?null:e.seed})}getClassName(){return w.className}}t.HeNormal=C,C.className="HeNormal",r.serialization.registerClass(C);class P extends w{constructor(e){super({scale:2,mode:"fanIn",distribution:"uniform",seed:null==e?null:e.seed})}getClassName(){return w.className}}t.HeUniform=P,P.className="HeUniform",r.serialization.registerClass(P);class O extends w{constructor(e){super({scale:1,mode:"fanIn",distribution:"normal",seed:null==e?null:e.seed})}getClassName(){return w.className}}t.LeCunNormal=O,O.className="LeCunNormal",r.serialization.registerClass(O);class N extends w{constructor(e){super({scale:1,mode:"fanIn",distribution:"uniform",seed:null==e?null:e.seed})}getClassName(){return w.className}}t.LeCunUniform=N,N.className="LeCunNormal",r.serialization.registerClass(N);class I extends h{constructor(e){if(super(),this.DEFAULT_GAIN=1,this.gain=null==e.gain?this.DEFAULT_GAIN:e.gain,this.seed=e.seed,null!=this.seed)throw new s.NotImplementedError("Random seed is not implemented for Orthogonal Initializer yet.")}apply(e,t){return(0,r.tidy)((()=>{if(e.length<2)throw new s.NotImplementedError("Shape must be at least 2D.");e[0]*e[1]>2e3&&console.warn("Orthogonal initializer is being called on a matrix with more "+"than 2000 (".concat(e[0]*e[1],") elements: ")+"Slowness may result.");const t=e[0]>e[1]?[e[1],e[0]]:e,n=a.randomNormal(t,0,1,"float32");let o=r.linalg.gramSchmidt(n);return e[0]>e[1]&&(o=(0,r.transpose)(o)),(0,r.mul)(this.gain,o)}))}getConfig(){return{gain:this.gain,seed:this.seed}}}t.Orthogonal=I,I.className="Orthogonal",r.serialization.registerClass(I);const T=t.INITIALIZER_IDENTIFIER_REGISTRY_SYMBOL_MAP={constant:"Constant",glorotNormal:"GlorotNormal",glorotUniform:"GlorotUniform",heNormal:"HeNormal",heUniform:"HeUniform",identity:"Identity",leCunNormal:"LeCunNormal",leCunUniform:"LeCunUniform",ones:"Ones",orthogonal:"Orthogonal",randomNormal:"RandomNormal",randomUniform:"RandomUniform",truncatedNormal:"TruncatedNormal",varianceScaling:"VarianceScaling",zeros:"Zeros"};function S(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return(0,c.deserializeKerasObject)(e,r.serialization.SerializationMap.getMap().classNameMap,t,"initializer")}},940826:(e,t)=>{"use strict";
1Object.defineProperty(t,"__esModule",{value:!0}),t.VALID_SAMPLE_WEIGHT_MODES=t.VALID_POOL_MODE_VALUES=t.VALID_PADDING_MODE_VALUES=t.VALID_INTERPOLATION_FORMAT_VALUES=t.VALID_DATA_FORMAT_VALUES=t.VALID_BIDIRECTIONAL_MERGE_MODES=void 0;t.VALID_DATA_FORMAT_VALUES=["channelsFirst","channelsLast"],t.VALID_INTERPOLATION_FORMAT_VALUES=["nearest","bilinear"],t.VALID_PADDING_MODE_VALUES=["valid","same","causal"],t.VALID_POOL_MODE_VALUES=["max","avg"],t.VALID_BIDIRECTIONAL_MERGE_MODES=["sum","mul","concat","ave"],t.VALID_SAMPLE_WEIGHT_MODES=["temporal"]},486414:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.initializerClassNames=t.VALID_FAN_MODE_VALUES=t.VALID_DISTRIBUTION_VALUES=void 0;t.VALID_FAN_MODE_VALUES=["fanIn","fanOut","fanAvg"],t.VALID_DISTRIBUTION_VALUES=["normal","uniform","truncatedNormal"],t.initializerClassNames=["Zeros","Ones","Constant","RandomNormal","RandomUniform","TruncatedNormal","VarianceScaling","Orthogonal","Identity"]},767781:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ThresholdedReLU=t.Softmax=t.ReLU=t.PReLU=t.LeakyReLU=t.ELU=void 0;var r=n(735534),a=n(457025),o=n(87475),s=n(840889),i=n(608012),c=n(492560),l=n(141115),u=n(252518);class d extends s.Layer{constructor(e){super(null==e?{}:e),this.supportsMasking=!0,null!=e&&(this.maxValue=e.maxValue)}call(e,t){e=(0,u.getExactlyOneTensor)(e);let n=(0,r.relu)(e);return null!=this.maxValue&&(n=(0,r.clipByValue)(n,0,this.maxValue)),n}computeOutputShape(e){return e}getConfig(){const e={maxValue:this.maxValue},t=super.getConfig();return Object.assign(e,t),e}}t.ReLU=d,d.className="ReLU",r.serialization.registerClass(d);class p extends s.Layer{constructor(e){super(null==e?{}:e),this.DEFAULT_ALPHA=.3,null==e&&(e={}),this.alpha=null==e.alpha?this.DEFAULT_ALPHA:e.alpha}call(e,t){const n=(0,u.getExactlyOneTensor)(e);return(0,r.leakyRelu)(n,this.alpha)}computeOutputShape(e){return e}getConfig(){const e={alpha:this.alpha},t=super.getConfig();return Object.assign(e,t),e}}t.LeakyReLU=p,p.className="LeakyReLU",r.serialization.registerClass(p);class h extends s.Layer{constructor(e){if(super(null==e?{}:e),this.DEFAULT_ALPHA_INITIALIZER="zeros",null==e&&(e={}),this.supportsMasking=!0,this.alphaInitializer=(0,c.getInitializer)(e.alphaInitializer||this.DEFAULT_ALPHA_INITIALIZER),this.alphaRegularizer=(0,l.getRegularizer)(e.alphaRegularizer),this.alphaConstraint=(0,o.getConstraint)(e.alphaConstraint),null==e.sharedAxes)this.sharedAxes=null;else if(Array.isArray(e.sharedAxes))this.sharedAxes=e.sharedAxes;else{if("number"!=typeof e.sharedAxes)throw new i.ValueError("Expected sharedAxes to be a number or an array of numbers, "+"but got ".concat(e.sharedAxes));this.sharedAxes=[e.sharedAxes]}}build(e){const t=(e=(0,u.getExactlyOneShape)(e)).slice(1);if(null!=this.sharedAxes)for(const e of this.sharedAxes)t[e-1]=1;this.alpha=this.addWeight("alpha",t,"float32",this.alphaInitializer,this.alphaRegularizer,!0,this.alphaConstraint);const n={};if(null!=this.sharedAxes)for(let t=1;t<e.length;++t)n[t]=e[t];this.inputSpec=[new s.InputSpec({ndim:e.length,axes:n})],this.built=!0}call(e,t){return e=(0,u.getExactlyOneTensor)(e),(0,r.prelu)(e,this.alpha.read())}getConfig(){const e={alphaInitializer:(0,c.serializeInitializer)(this.alphaInitializer),alphaRegularizer:(0,l.serializeRegularizer)(this.alphaRegularizer),alphaConstraint:(0,o.serializeConstraint)(this.alphaConstraint),sharedAxes:this.sharedAxes},t=super.getConfig();return Object.assign(e,t),e}}t.PReLU=h,h.className="PReLU",r.serialization.registerClass(h);class f extends s.Layer{constructor(e){if(super(null==e?{}:e),this.DEFAULT_ALPHA=1,null==e&&(e={}),null!=e.alpha&&e.alpha!==this.DEFAULT_ALPHA)throw new i.NotImplementedError("Non-default alpha value (".concat(e.alpha,") is not supported by the ")+"ELU layer yet.");this.alpha=null==e.alpha?this.DEFAULT_ALPHA:e.alpha}call(e,t){const n=(0,u.getExactlyOneTensor)(e);return(0,r.elu)(n)}computeOutputShape(e){return e}getConfig(){const e={alpha:this.alpha},t=super.getConfig();return Object.assign(e,t),e}}t.ELU=f,f.className="ELU",r.serialization.registerClass(f);class m extends s.Layer{constructor(e){super(null==e?{}:e),this.DEFAULT_THETA=1,null==e&&(e={}),this.theta=null==e.theta?this.DEFAULT_THETA:e.theta}call(e,t){const n=(0,u.getExactlyOneTensor)(e);
1return(0,r.mul)(n,(0,r.cast)((0,r.greater)(n,this.theta),"float32"))}computeOutputShape(e){return e}getConfig(){const e={theta:this.theta},t=super.getConfig();return Object.assign(e,t),e}}t.ThresholdedReLU=m,m.className="ThresholdedReLU",r.serialization.registerClass(m);class g extends s.Layer{constructor(e){super(null==e?{}:e),this.DEFAULT_AXIS=1,null==e&&(e={}),this.softmax=(new a.Softmax).apply,this.axis=null==e.axis?this.DEFAULT_AXIS:e.axis}call(e,t){const n=(0,u.getExactlyOneTensor)(e);return this.softmax(n,this.axis)}computeOutputShape(e){return e}getConfig(){const e={axis:this.axis},t=super.getConfig();return Object.assign(e,t),e}}t.Softmax=g,g.className="Softmax",r.serialization.registerClass(g)},180743:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.UpSampling2D=t.SeparableConv2D=t.SeparableConv=t.Cropping2D=t.Conv3DTranspose=t.Conv3D=t.Conv2DTranspose=t.Conv2D=t.Conv1D=t.Conv=t.BaseConv=void 0,t.conv1d=function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"valid",o=arguments.length>4?arguments[4]:void 0,s=arguments.length>5&&void 0!==arguments[5]?arguments[5]:1;return(0,r.tidy)((()=>((0,c.checkDataFormat)(o),w(e,t,null,n,a,o,s))))},t.conv1dWithBias=w,t.conv2d=function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[1,1],a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"valid",o=arguments.length>4?arguments[4]:void 0,s=arguments.length>5?arguments[5]:void 0;return(0,r.tidy)((()=>((0,c.checkDataFormat)(o),k(e,t,null,n,a,o,s))))},t.conv2dWithBiasActivation=k,t.conv3d=function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[1,1,1],a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"valid",o=arguments.length>4?arguments[4]:void 0,s=arguments.length>5?arguments[5]:void 0;return(0,r.tidy)((()=>((0,c.checkDataFormat)(o),_(e,t,null,n,a,o,s))))},t.conv3dWithBias=_,t.preprocessConv2DInput=b,t.preprocessConv3DInput=x;var r=v(n(735534)),a=r,o=n(457025),s=n(485246),i=v(n(984710)),c=n(545188),l=n(87475),u=n(840889),d=n(608012),p=n(492560),h=n(141115),f=n(308079),m=v(n(986904)),g=n(252518);function y(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(y=function(e){return e?n:t})(e)}function v(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=y(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if("default"!==o&&{}.hasOwnProperty.call(e,o)){var s=a?Object.getOwnPropertyDescriptor(e,o):null;s&&(s.get||s.set)?Object.defineProperty(r,o,s):r[o]=e[o]}return r.default=e,n&&n.set(e,r),r}function b(e,t){return(0,r.tidy)((()=>((0,c.checkDataFormat)(t),"channelsFirst"===t?a.transpose(e,[0,2,3,1]):e)))}function x(e,t){return(0,r.tidy)((()=>((0,c.checkDataFormat)(t),"channelsFirst"===t?a.transpose(e,[0,2,3,4,1]):e)))}function w(e,t,n){let o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1,l=arguments.length>4&&void 0!==arguments[4]?arguments[4]:"valid",u=arguments.length>5?arguments[5]:void 0,p=arguments.length>6&&void 0!==arguments[6]?arguments[6]:1;return(0,r.tidy)((()=>{if(null==u&&(u=(0,s.imageDataFormat)()),(0,c.checkDataFormat)(u),3!==e.shape.length)throw new d.ValueError("The input of a conv1dWithBias operation should be 3, but is "+"".concat(e.shape.length," instead."));if(3!==t.shape.length)throw new d.ValueError("The kernel for a conv1dWithBias operation should be 3, but is "+"".concat(t.shape.length," instead"));if(null!=n&&1!==n.shape.length)throw new d.ValueError("The bias for a conv1dWithBias operation should be 1, but is "+"".concat(t.shape.length," instead"));if("channelsFirst"===u&&(e=a.transpose(e,[0,2,1])),"causal"===l)throw new d.NotImplementedError("The support for CAUSAL padding mode in conv1dWithBias is not implemented yet.");let r=a.conv1d(e,t,o,"same"===l?"same":"valid","NWC",p);return null!=n&&(r=i.biasAdd(r,n)),r}))}function k(e,t,n){let o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:[1,1],i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:"valid",l=arguments.length>5?arguments[5]:void 0,u=arguments.length>6?arguments[6]:void 0,p=arguments.length>7&&void 0!==arguments[7]?arguments[7]:null;return(0,r.tidy)((()=>
1{if(null==l&&(l=(0,s.imageDataFormat)()),(0,c.checkDataFormat)(l),3!==e.rank&&4!==e.rank)throw new d.ValueError("conv2dWithBiasActivation expects input to be of rank 3 or 4, "+"but received ".concat(e.rank,"."));if(3!==t.rank&&4!==t.rank)throw new d.ValueError("conv2dWithBiasActivation expects kernel to be of rank 3 or 4, "+"but received ".concat(e.rank,"."));let r=b(e,l);if("causal"===i)throw new d.NotImplementedError("The support for CAUSAL padding mode in conv1dWithBias is not implemented yet.");return r=a.fused.conv2d({x:r,filter:t,strides:o,pad:"same"===i?"same":"valid",dilations:u,dataFormat:"NHWC",bias:n,activation:p}),"channelsFirst"===l&&(r=a.transpose(r,[0,3,1,2])),r}))}function _(e,t,n){let o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:[1,1,1],l=arguments.length>4&&void 0!==arguments[4]?arguments[4]:"valid",u=arguments.length>5?arguments[5]:void 0,p=arguments.length>6?arguments[6]:void 0;return(0,r.tidy)((()=>{if(null==u&&(u=(0,s.imageDataFormat)()),(0,c.checkDataFormat)(u),4!==e.rank&&5!==e.rank)throw new d.ValueError("conv3dWithBias expects input to be of rank 4 or 5, but received "+"".concat(e.rank,"."));if(4!==t.rank&&5!==t.rank)throw new d.ValueError("conv3dWithBias expects kernel to be of rank 4 or 5, but received "+"".concat(e.rank,"."));let r=x(e,u);if("causal"===l)throw new d.NotImplementedError("The support for CAUSAL padding mode in conv3dWithBias is not implemented yet.");return r=a.conv3d(r,t,o,"same"===l?"same":"valid","NDHWC",p),null!=n&&(r=i.biasAdd(r,n)),"channelsFirst"===u&&(r=a.transpose(r,[0,4,1,2,3])),r}))}class C extends u.Layer{constructor(e,t){if(super(t),this.bias=null,this.DEFAULT_KERNEL_INITIALIZER="glorotNormal",this.DEFAULT_BIAS_INITIALIZER="zeros",C.verifyArgs(t),this.rank=e,m.assertPositiveInteger(this.rank,"rank"),1!==this.rank&&2!==this.rank&&3!==this.rank)throw new d.NotImplementedError("Convolution layer for rank other than 1, 2, or 3 (".concat(this.rank,") is ")+"not implemented yet.");if(this.kernelSize=(0,f.normalizeArray)(t.kernelSize,e,"kernelSize"),this.strides=(0,f.normalizeArray)(null==t.strides?1:t.strides,e,"strides"),this.padding=null==t.padding?"valid":t.padding,(0,c.checkPaddingMode)(this.padding),this.dataFormat=null==t.dataFormat?"channelsLast":t.dataFormat,(0,c.checkDataFormat)(this.dataFormat),this.activation=(0,o.getActivation)(t.activation),this.useBias=null==t.useBias||t.useBias,this.biasInitializer=(0,p.getInitializer)(t.biasInitializer||this.DEFAULT_BIAS_INITIALIZER),this.biasConstraint=(0,l.getConstraint)(t.biasConstraint),this.biasRegularizer=(0,h.getRegularizer)(t.biasRegularizer),this.activityRegularizer=(0,h.getRegularizer)(t.activityRegularizer),this.dilationRate=(0,f.normalizeArray)(null==t.dilationRate?1:t.dilationRate,e,"dilationRate"),1===this.rank&&Array.isArray(this.dilationRate)&&1!==this.dilationRate.length)throw new d.ValueError("dilationRate must be a number or an array of a single number for 1D convolution, but received "+"".concat(JSON.stringify(this.dilationRate)));if(2===this.rank){if("number"==typeof this.dilationRate)this.dilationRate=[this.dilationRate,this.dilationRate];else if(2!==this.dilationRate.length)throw new d.ValueError("dilationRate must be a number or array of two numbers for 2D "+"convolution, but received ".concat(JSON.stringify(this.dilationRate)))}else if(3===this.rank)if("number"==typeof this.dilationRate)this.dilationRate=[this.dilationRate,this.dilationRate,this.dilationRate];else if(3!==this.dilationRate.length)throw new d.ValueError("dilationRate must be a number or array of three numbers for 3D "+"convolution, but received ".concat(JSON.stringify(this.dilationRate)))}static verifyArgs(e){if(m.assert("kernelSize"in e,"required key 'kernelSize' not in config"),"number"!=typeof e.kernelSize&&!m.checkArrayTypeAndLength(e.kernelSize,"number",1,3))throw new d.ValueError("BaseConv expects config.kernelSize to be number or number[] with "+"length 1, 2, or 3, but received ".concat(JSON.stringify(e.kernelSize),"."))}getConfig(){const e={kernelSize:this.kernelSize,strides:this.strides,padding:this.padding,dataFormat:this.dataFormat,dilationRate:this.dilationRate,activation:(0,o.seri
1alizeActivation)(this.activation),useBias:this.useBias,biasInitializer:(0,p.serializeInitializer)(this.biasInitializer),biasRegularizer:(0,h.serializeRegularizer)(this.biasRegularizer),activityRegularizer:(0,h.serializeRegularizer)(this.activityRegularizer),biasConstraint:(0,l.serializeConstraint)(this.biasConstraint)},t=super.getConfig();return Object.assign(e,t),e}}t.BaseConv=C;class P extends C{constructor(e,t){super(e,t),this.kernel=null,P.verifyArgs(t),this.filters=t.filters,m.assertPositiveInteger(this.filters,"filters"),this.kernelInitializer=(0,p.getInitializer)(t.kernelInitializer||this.DEFAULT_KERNEL_INITIALIZER),this.kernelConstraint=(0,l.getConstraint)(t.kernelConstraint),this.kernelRegularizer=(0,h.getRegularizer)(t.kernelRegularizer)}build(e){e=(0,g.getExactlyOneShape)(e);const t="channelsFirst"===this.dataFormat?1:e.length-1;if(null==e[t])throw new d.ValueError("The channel dimension of the input should be defined. "+"Found ".concat(e[t]));const n=e[t],r=this.kernelSize.concat([n,this.filters]);this.kernel=this.addWeight("kernel",r,null,this.kernelInitializer,this.kernelRegularizer,!0,this.kernelConstraint),this.useBias&&(this.bias=this.addWeight("bias",[this.filters],null,this.biasInitializer,this.biasRegularizer,!0,this.biasConstraint)),this.inputSpec=[{ndim:this.rank+2,axes:{[t]:n}}],this.built=!0}call(e,t){return(0,r.tidy)((()=>{let t;e=(0,g.getExactlyOneTensor)(e);const n=null==this.bias?null:this.bias.read(),r=m.mapActivationToFusedKernel(this.activation.getClassName());if(null!=r&&2===this.rank)t=k(e,this.kernel.read(),n,this.strides,this.padding,this.dataFormat,this.dilationRate,r);else{if(1===this.rank)t=w(e,this.kernel.read(),n,this.strides[0],this.padding,this.dataFormat,this.dilationRate[0]);else if(2===this.rank)t=k(e,this.kernel.read(),n,this.strides,this.padding,this.dataFormat,this.dilationRate);else{if(3!==this.rank)throw new d.NotImplementedError("convolutions greater than 3D are not implemented yet.");t=_(e,this.kernel.read(),n,this.strides,this.padding,this.dataFormat,this.dilationRate)}null!=this.activation&&(t=this.activation.apply(t))}return t}))}computeOutputShape(e){e=(0,g.getExactlyOneShape)(e);const t=[],n="channelsLast"===this.dataFormat?e.slice(1,e.length-1):e.slice(2);for(let e=0;e<n.length;++e){const r=(0,f.convOutputLength)(n[e],this.kernelSize[e],this.padding,this.strides[e],"number"==typeof this.dilationRate?this.dilationRate:this.dilationRate[e]);t.push(r)}let r=[e[0]];return"channelsLast"===this.dataFormat?(r=r.concat(t),r.push(this.filters)):(r.push(this.filters),r=r.concat(t)),r}getConfig(){const e={filters:this.filters,kernelInitializer:(0,p.serializeInitializer)(this.kernelInitializer),kernelRegularizer:(0,h.serializeRegularizer)(this.kernelRegularizer),kernelConstraint:(0,l.serializeConstraint)(this.kernelConstraint)},t=super.getConfig();return Object.assign(e,t),e}static verifyArgs(e){if(!("filters"in e)||"number"!=typeof e.filters||e.filters<1)throw new d.ValueError("Convolution layer expected config.filters to be a 'number' > 0 "+"but got ".concat(JSON.stringify(e.filters)))}}t.Conv=P;class O extends P{constructor(e){super(2,e),O.verifyArgs(e)}getConfig(){const e=super.getConfig();return delete e.rank,e}static verifyArgs(e){if("number"!=typeof e.kernelSize&&!m.checkArrayTypeAndLength(e.kernelSize,"number",1,2))throw new d.ValueError("Conv2D expects config.kernelSize to be number or number[] with "+"length 1 or 2, but received ".concat(JSON.stringify(e.kernelSize),"."))}}t.Conv2D=O,O.className="Conv2D",r.serialization.registerClass(O);class N extends P{constructor(e){super(3,e),N.verifyArgs(e)}getConfig(){const e=super.getConfig();return delete e.rank,e}static verifyArgs(e){if("number"!=typeof e.kernelSize&&(!Array.isArray(e.kernelSize)||1!==e.kernelSize.length&&3!==e.kernelSize.length))throw new d.ValueError("Conv3D expects config.kernelSize to be number or"+" [number, number, number], but received ".concat(JSON.stringify(e.kernelSize),"."))}}t.Conv3D=N,N.className="Conv3D",r.serialization.registerClass(N);class I extends O{constructor(e){if(super(e),this.inputSpec=[new u.InputSpec({ndim:4})],"same"!==this.padding&&"valid"!==this.padding)throw new d.ValueError("Conv2DTranspose currently supports only padding modes '
1same' "+"and 'valid', but received padding mode ".concat(this.padding))}build(e){if(4!==(e=(0,g.getExactlyOneShape)(e)).length)throw new d.ValueError("Input should have rank 4; Received input shape: "+JSON.stringify(e));const t="channelsFirst"===this.dataFormat?1:e.length-1;if(null==e[t])throw new d.ValueError("The channel dimension of the inputs should be defined. Found `None`.");const n=e[t],r=this.kernelSize.concat([this.filters,n]);this.kernel=this.addWeight("kernel",r,"float32",this.kernelInitializer,this.kernelRegularizer,!0,this.kernelConstraint),this.useBias&&(this.bias=this.addWeight("bias",[this.filters],"float32",this.biasInitializer,this.biasRegularizer,!0,this.biasConstraint)),this.inputSpec=[new u.InputSpec({ndim:4,axes:{[t]:n}})],this.built=!0}call(e,t){return a.tidy((()=>{let t=(0,g.getExactlyOneTensor)(e);if(4!==t.shape.length)throw new d.ValueError("Conv2DTranspose.call() expects input tensor to be rank-4, but "+"received a tensor of rank-".concat(t.shape.length));const n=t.shape,r=n[0];let o,s;"channelsFirst"===this.dataFormat?(o=2,s=3):(o=1,s=2);const c=n[o],l=n[s],u=this.kernelSize[0],p=this.kernelSize[1],h=this.strides[0],m=this.strides[1],y=[r,(0,f.deconvLength)(c,h,u,this.padding),(0,f.deconvLength)(l,m,p,this.padding),this.filters];"channelsLast"!==this.dataFormat&&(t=a.transpose(t,[0,2,3,1]));let v=a.conv2dTranspose(t,this.kernel.read(),y,this.strides,this.padding);return"channelsLast"!==this.dataFormat&&(v=a.transpose(v,[0,3,1,2])),null!=this.bias&&(v=i.biasAdd(v,this.bias.read(),this.dataFormat)),null!=this.activation&&(v=this.activation.apply(v)),v}))}computeOutputShape(e){const t=(e=(0,g.getExactlyOneShape)(e)).slice();let n,r,a;"channelsFirst"===this.dataFormat?(n=1,r=2,a=3):(n=3,r=1,a=2);const o=this.kernelSize[0],s=this.kernelSize[1],i=this.strides[0],c=this.strides[1];return t[n]=this.filters,t[r]=(0,f.deconvLength)(t[r],i,o,this.padding),t[a]=(0,f.deconvLength)(t[a],c,s,this.padding),t}getConfig(){const e=super.getConfig();return delete e.dilationRate,e}}t.Conv2DTranspose=I,I.className="Conv2DTranspose",r.serialization.registerClass(I);class T extends N{constructor(e){if(super(e),this.inputSpec=[new u.InputSpec({ndim:5})],"same"!==this.padding&&"valid"!==this.padding)throw new d.ValueError("Conv3DTranspose currently supports only padding modes 'same' "+"and 'valid', but received padding mode ".concat(this.padding))}build(e){if(5!==(e=(0,g.getExactlyOneShape)(e)).length)throw new d.ValueError("Input should have rank 5; Received input shape: "+JSON.stringify(e));const t="channelsFirst"===this.dataFormat?1:e.length-1;if(null==e[t])throw new d.ValueError("The channel dimension of the inputs should be defined. Found `None`.");const n=e[t],r=this.kernelSize.concat([this.filters,n]);this.kernel=this.addWeight("kernel",r,"float32",this.kernelInitializer,this.kernelRegularizer,!0,this.kernelConstraint),this.useBias&&(this.bias=this.addWeight("bias",[this.filters],"float32",this.biasInitializer,this.biasRegularizer,!0,this.biasConstraint)),this.inputSpec=[new u.InputSpec({ndim:5,axes:{[t]:n}})],this.built=!0}call(e,t){return a.tidy((()=>{let t=(0,g.getExactlyOneTensor)(e);if(5!==t.shape.length)throw new d.ValueError("Conv3DTranspose.call() expects input tensor to be rank-4, but "+"received a tensor of rank-".concat(t.shape.length));const n=t.shape,r=n[0];let o,s,c;"channelsFirst"===this.dataFormat?(c=2,o=3,s=4):(c=1,o=2,s=3);const l=n[c],u=n[o],p=n[s],h=this.kernelSize[0],m=this.kernelSize[1],y=this.kernelSize[2],v=this.strides[0],b=this.strides[1],x=this.strides[2],w=[r,(0,f.deconvLength)(l,v,h,this.padding),(0,f.deconvLength)(u,b,m,this.padding),(0,f.deconvLength)(p,x,y,this.padding),this.filters];"channelsLast"!==this.dataFormat&&(t=a.transpose(t,[0,2,3,4,1]));let k=a.conv3dTranspose(t,this.kernel.read(),w,this.strides,this.padding);return"channelsLast"!==this.dataFormat&&(k=a.transpose(k,[0,4,1,2,3])),null!==this.bias&&(k=i.biasAdd(k,this.bias.read(),this.dataFormat)),null!==this.activation&&(k=this.activation.apply(k)),k}))}computeOutputShape(e){const t=(e=(0,g.getExactlyOneShape)(e)).slice();let n,r,a,o;"channelsFirst"===this.dataFormat?(n=1,r=2,a=3,o=4):(n=4,r=1,a=2,o=3);const s=this.kernelSize[0],i=this.kernelSize[1],c=this.kernelSize[2],l=this.strides[0],u=this.strides[1],d=this.strides[2];return t[n]=this.filters,t[r]=(0,f.deconvLength)(t[r],l,s,this.padding),t[a]=(0,f.deconvLength)(t[a],u,i,this.padding),t[o]=(0,f.deconvLength)(t[o],d,c,this.padding),t}getConfig(){const e=super.getConfig();return delete e.dilationRate,e}}t.Conv3DTranspose=T,T.className="Conv3DTranspose",r.serialization.registerClass(T);class S extends P{constructor(e,t){if(super(e,t),this.DEFAULT_DEPTHWISE_INITIALIZER="glorotUniform",this.DEFAULT_POINTWISE_INITIALIZER="glorotUniform",this.depthwiseKernel=null,this.pointwiseKernel=null,null==t.filters)throw new d.ValueError("The `filters` configuration field is required by SeparableConv, but is unspecified.");if(null!=t.kernelInitializer||null!=t.kernelRegularizer||null!=t.kernelConstraint)throw new d.ValueError("Fields kernelInitializer, kernelRegularizer and kernelConstraint are invalid for SeparableConv2D. Use depthwiseInitializer, depthwiseRegularizer, depthwiseConstraint, pointwiseInitializer, pointwiseRegularizer and pointwiseConstraint instead.");if(null!=t.padding&&"same"!==t.padding&&"valid"!==t.padding)throw new d.ValueError("SeparableConv".concat(this.rank,"D supports only padding modes: ")+"'same' and 'valid', but received ".concat(JSON.stringify(t.padding)));this.depthMultiplier=null==t.depthMultiplier?1:t.depthMultiplier,this.depthwiseInitializer=(0,p.getInitializer)(t.depthwiseInitializer||this.DEFAULT_DEPTHWISE_INITIALIZER),this.depthwiseRegularizer=(0,h.getRegularizer)(t.depthwiseRegularizer),this.depthwiseConstraint=(0,l.getConstraint)(t.depthwiseConstraint),this.pointwiseInitializer=(0,p.getInitializer)(t.depthwiseInitializer||this.DEFAULT_POINTWISE_INITIALIZER),this.pointwiseRegularizer=(0,h.getRegularizer)(t.pointwiseRegularizer),this.pointwiseConstraint=(0,l.getConstraint)(t.pointwiseConstraint)}build(e){if((e=(0,g.getExactlyOneShape)(e)).length<this.rank+2)throw new d.ValueError("Inputs to SeparableConv".concat(this.rank,"D should have rank ")+"".concat(this.rank+2,", but received input shape: ")+"".concat(JSON.stringify(e)));const t="channelsFirst"===this.dataFormat?1:e.length-1;if(null==e[t]||e[t]<0)throw new d.ValueError("The channel dimension of the inputs should be defined, "+"but found ".concat(JSON.stringify(e[t])));const n=e[t],r=this.kernelSize.concat([n,this.depthMultiplier]),a=[];for(let e=0;e<this.rank;++e)a.push(1);a.push(n*this.depthMultiplier,this.filters);const o=!0;this.depthwiseKernel=this.addWeight("depthwise_kernel",r,"float32",this.depthwiseInitializer,this.depthwiseRegularizer,o,this.depthwiseConstraint),this.pointwiseKernel=this.addWeight("pointwise_kernel",a,"float32",this.pointwiseInitializer,this.pointwiseRegularizer,o,this.pointwiseConstraint),this.useBias?this.bias=this.addWeight("bias",[this.filters],"float32",this.biasInitializer,this.biasRegularizer,o,this.biasConstraint):this.bias=null,this.inputSpec=[new u.InputSpec({ndim:this.rank+2,axes:{[t]:n}})],this.built=!0}call(e,t){return(0,r.tidy)((()=>{let t;if(e=(0,g.getExactlyOneTensor)(e),1===this.rank)throw new d.NotImplementedError("1D separable convolution is not implemented yet.");return 2===this.rank&&("channelsFirst"===this.dataFormat&&(e=a.transpose(e,[0,2,3,1])),t=a.separableConv2d(e,this.depthwiseKernel.read(),this.pointwiseKernel.read(),this.strides,this.padding,this.dilationRate,"NHWC")),this.useBias&&(t=i.biasAdd(t,this.bias.read(),this.dataFormat)),null!=this.activation&&(t=this.activation.apply(t)),"channelsFirst"===this.dataFormat&&(t=a.transpose(t,[0,3,1,2])),t}))}getConfig(){const e=super.getConfig();return delete e.rank,delete e.kernelInitializer,delete e.kernelRegularizer,delete e.kernelConstraint,e.depthwiseInitializer=(0,p.serializeInitializer)(this.depthwiseInitializer),e.pointwiseInitializer=(0,p.serializeInitializer)(this.pointwiseInitializer),e.depthwiseRegularizer=(0,h.serializeRegularizer)(this.depthwiseRegularizer),e.pointwiseRegularizer=(0,h.serializeRegularizer)(this.pointwiseRegularizer),e.depthwiseConstraint=(0,l.serializeConstraint)(this.depthwiseConstraint),e.pointwiseConstraint=(0,l.serializeConstraint)(this.pointwiseConstraint),e}}t.SeparableConv=S,S.className="SeparableConv";class E extends S{constructor(e){super(2,e)}}t.SeparableConv2D=E,E.className="SeparableConv2D",r.serialization.registerClass(E);class M extends P{constructor(e){super(1,e),M.verifyArgs(e),this.inputSpec=[{ndim:3}]}getConfig(){const e=super.getConfig();return delete e.rank,delete e.dataFormat,e}static verifyArgs(e){if("number"!=typeof e.kernelSize&&!m.checkArrayTypeAndLength(e.kernelSize,"number",1,1))throw new d.ValueError("Conv1D expects config.kernelSize to be number or number[] with "+"length 1, but received ".concat(JSON.stringify(e.kernelSize),"."))}}t.Conv1D=M,M.className="Conv1D",r.serialization.registerClass(M);class A extends u.Layer{constructor(e){super(e),"number"==typeof e.cropping?this.cropping=[[e.cropping,e.cropping],[e.cropping,e.cropping]]:"number"==typeof e.cropping[0]?this.cropping=[[e.cropping[0],e.cropping[0]],[e.cropping[1],e.cropping[1]]]:this.cropping=e.cropping,this.dataFormat=void 0===e.dataFormat?"channelsLast":e.dataFormat,this.inputSpec=[{ndim:4}]}computeOutputShape(e){return"channelsFirst"===this.dataFormat?[e[0],e[1],e[2]-this.cropping[0][0]-this.cropping[0][1],e[3]-this.cropping[1][0]-this.cropping[1][1]]:[e[0],e[1]-this.cropping[0][0]-this.cropping[0][1],e[2]-this.cropping[1][0]-this.cropping[1][1],e[3]]}call(e,t){return(0,r.tidy)((()=>
1{if(e=(0,g.getExactlyOneTensor)(e),"channelsLast"===this.dataFormat){const t=i.sliceAlongAxis(e,this.cropping[0][0],e.shape[1]-this.cropping[0][0]-this.cropping[0][1],2);return i.sliceAlongAxis(t,this.cropping[1][0],e.shape[2]-this.cropping[1][1]-this.cropping[1][0],3)}{const t=i.sliceAlongAxis(e,this.cropping[0][0],e.shape[2]-this.cropping[0][0]-this.cropping[0][1],3);return i.sliceAlongAxis(t,this.cropping[1][0],e.shape[3]-this.cropping[1][1]-this.cropping[1][0],4)}}))}getConfig(){const e={cropping:this.cropping,dataFormat:this.dataFormat},t=super.getConfig();return Object.assign(e,t),e}}t.Cropping2D=A,A.className="Cropping2D",r.serialization.registerClass(A);class D extends u.Layer{constructor(e){super(e),this.DEFAULT_SIZE=[2,2],this.inputSpec=[{ndim:4}],this.size=null==e.size?this.DEFAULT_SIZE:e.size,this.dataFormat=null==e.dataFormat?"channelsLast":e.dataFormat,(0,c.checkDataFormat)(this.dataFormat),this.interpolation=null==e.interpolation?"nearest":e.interpolation,(0,c.checkInterpolationFormat)(this.interpolation)}computeOutputShape(e){if("channelsFirst"===this.dataFormat){const t=null==e[2]?null:this.size[0]*e[2],n=null==e[3]?null:this.size[1]*e[3];return[e[0],e[1],t,n]}{const t=null==e[1]?null:this.size[0]*e[1],n=null==e[2]?null:this.size[1]*e[2];return[e[0],t,n,e[3]]}}call(e,t){return a.tidy((()=>{let t=(0,g.getExactlyOneTensor)(e);const n=t.shape;if("channelsFirst"===this.dataFormat){t=a.transpose(t,[0,2,3,1]);const e=this.size[0]*n[2],r=this.size[1]*n[3],o="nearest"===this.interpolation?a.image.resizeNearestNeighbor(t,[e,r]):a.image.resizeBilinear(t,[e,r]);return a.transpose(o,[0,3,1,2])}{const e=this.size[0]*n[1],r=this.size[1]*n[2];return"nearest"===this.interpolation?a.image.resizeNearestNeighbor(t,[e,r]):a.image.resizeBilinear(t,[e,r])}}))}getConfig(){const e={size:this.size,dataFormat:this.dataFormat},t=super.getConfig();return Object.assign(e,t),e}}t.UpSampling2D=D,D.className="UpSampling2D",r.serialization.registerClass(D)},971420:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.DepthwiseConv2D=void 0,t.depthwiseConv2d=y;var r=g(n(735534)),a=r,o=n(485246),s=g(n(984710)),i=n(545188),c=n(87475),l=n(608012),u=n(492560),d=n(141115),p=n(308079),h=n(252518),f=n(180743);function m(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(m=function(e){return e?n:t})(e)}function g(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=m(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if("default"!==o&&{}.hasOwnProperty.call(e,o)){var s=a?Object.getOwnPropertyDescriptor(e,o):null;s&&(s.get||s.set)?Object.defineProperty(r,o,s):r[o]=e[o]}return r.default=e,n&&n.set(e,r),r}function y(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[1,1],s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"valid",c=arguments.length>4?arguments[4]:void 0,u=arguments.length>5?arguments[5]:void 0;return(0,r.tidy)((()=>{null==c&&(c=(0,o.imageDataFormat)()),(0,i.checkDataFormat)(c);let r=(0,f.preprocessConv2DInput)(e,c);if(4!==e.rank)throw new l.ValueError("Input for depthwiseConv2d is required to be 4-D, but is instead "+"".concat(e.rank,"-D"));if(4!==t.rank)throw new l.ValueError("depthwiseKernel is required to be 4-D, but is instead "+"".concat(t.rank,"-D"));return r=a.depthwiseConv2d(r,t,n,"same"===s?"same":"valid","NHWC",u),"channelsFirst"===c&&(r=a.transpose(r,[0,3,1,2])),r}))}class v extends f.BaseConv{constructor(e){super(2,e),this.depthwiseKernel=null,this.depthMultiplier=null==e.depthMultiplier?1:e.depthMultiplier,this.depthwiseInitializer=(0,u.getInitializer)(e.depthwiseInitializer||this.DEFAULT_KERNEL_INITIALIZER),this.depthwiseConstraint=(0,c.getConstraint)(e.depthwiseConstraint),this.depthwiseRegularizer=(0,d.getRegularizer)(e.depthwiseRegularizer)}build(e){if((e=(0,h.getExactlyOneShape)(e)).length<4)throw new l.ValueError("Inputs to DepthwiseConv2D should have rank 4. "+"Received input shape: ".concat(JSON.stringify(e),"."));const t="channelsFirst"===this.dataFormat?1:3;if(null==e[t]||e[t]<0)throw new l.ValueError("The channel dimension of the inputs to DepthwiseConv2D should "+"be defined, but is not (".concat(e[t],")."));const n=e[t],r=[this.kernelSize[0],this.kernelSize[1],n,this.depthMultiplier];this.depthwiseKernel=this.addWeight("depthwise_kernel",r,null,this.depthwiseInitializer,this.depthwiseRegularizer,!0,this.depthwiseConstraint),this.useBias?this.bias=this.addWeight("bias",[n*this.depthMultiplier],null,this.biasInitializer,this.biasRegularizer,!0,this.biasConstraint):this.bias=null,this.built=!0}call(e,t){return(0,r.tidy)((()=>{let t=y(e=(0,h.getExactlyOneTensor)(e),this.depthwiseKernel.read(),this.strides,this.padding,this.dataFormat,null);return this.useBias&&(t=s.biasAdd(t,this.bias.read(),this.dataFormat)),null!=this.activation&&(t=this.activation.apply(t)),t}))}computeOutputShape(e){e=(0,h.getExactlyOneShape)(e);const t="channelsFirst"===this.dataFormat?e[2]:e[1],n="channelsFirst"===this.dataFormat?e[3]:e[2],r="channelsFirst"===this.dataFormat?e[1]*this.depthMultiplier:e[3]*this.depthMultiplier,a=(0,p.convOutputLength)(t,this.kernelSize[0],this.padding,this.strides[0]),o=(0,p.convOutputLength)(n,this.kernelSize[1],this.padding,this.strides[1]);return"channelsFirst"===this.dataFormat?[e[0],r,a,o]:[e[0],a,o,r]}getConfig(){const e=super.getConfig();return e.depthMultiplier=this.depthMultiplier,e.depthwiseInitializer=(0,u.serializeInitializer)(this.depthwiseInitializer),e.depthwiseRegularizer=(0,d.seri
1alizeRegularizer)(this.depthwiseRegularizer),e.depthwiseConstraint=(0,c.serializeConstraint)(this.depthwiseRegularizer),e}}t.DepthwiseConv2D=v,v.className="DepthwiseConv2D",r.serialization.registerClass(v)},674858:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ConvLSTM2DCell=t.ConvLSTM2D=void 0;var r=m(n(735534)),a=r,o=m(n(984710)),s=n(545188),i=n(840889),c=n(608012),l=n(492560),u=n(308079),d=n(986904),p=n(252518),h=n(302909);function f(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(f=function(e){return e?n:t})(e)}function m(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=f(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if("default"!==o&&{}.hasOwnProperty.call(e,o)){var s=a?Object.getOwnPropertyDescriptor(e,o):null;s&&(s.get||s.set)?Object.defineProperty(r,o,s):r[o]=e[o]}return r.default=e,n&&n.set(e,r),r}var g=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var a=0;for(r=Object.getOwnPropertySymbols(e);a<r.length;a++)t.indexOf(r[a])<0&&Object.prototype.propertyIsEnumerable.call(e,r[a])&&(n[r[a]]=e[r[a]])}return n};h.RNNCell;class y extends h.RNN{constructor(e){if(e.unroll)throw new c.NotImplementedError("Unrolling is not possible with convolutional RNNs.");if(Array.isArray(e.cell))throw new c.NotImplementedError("It is not possible at the moment to stack convolutional cells.");super(e),this.inputSpec=[new i.InputSpec({ndim:5})]}call(e,t){return a.tidy((()=>{if(null!=this.cell.dropoutMask&&(a.dispose(this.cell.dropoutMask),this.cell.dropoutMask=null),null!=this.cell.recurrentDropoutMask&&(a.dispose(this.cell.recurrentDropoutMask),this.cell.recurrentDropoutMask=null),t&&t.constants)throw new c.ValueError("ConvRNN2D cell does not support constants");const n=null==t?null:t.mask,r=null==t?null:t.training,o=null==t?null:t.initialState;return super.call(e,{mask:n,training:r,initialState:o})}))}computeOutputShape(e){let t=this.computeSingleOutputShape(e);return this.returnSequences||(t=[t[0],...t.slice(2)]),this.returnState&&(t=[t,...Array(2).fill([e[0],...t.slice(-3)])]),t}getInitialState(e){return a.tidy((()=>{const{stateSize:t}=this.cell,n=e.shape,r=this.computeSingleOutputShape(n),o=[r[0],...r.slice(2)],s=a.zeros(o);return Array.isArray(t)?Array(t.length).fill(s):[s]}))}resetStates(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];a.tidy((()=>{if(!this.stateful)throw new c.AttributeError("Cannot call resetStates() on an RNN Layer that is not stateful.");const n=this.inputSpec[0].shape,o=this.computeSingleOutputShape(n),s=[o[0],...o.slice(2)];if(null==n[0])throw new c.ValueError("If an RNN is stateful, it needs to know its batch size. Specify the batch size of your input tensors: \n- If using a Sequential model, specify the batch size by passing a `batchInputShape` option to your first layer.\n- If using the functional API, specify the batch size by passing a `batchShape` option to your Input layer.");if(null==this.getStates())Array.isArray(this.cell.stateSize)?this.states_=this.cell.stateSize.map((()=>a.zeros(s))):this.states_=[a.zeros(s)];else if(null==e)a.dispose(this.states_),null!=this.keptStates&&(a.dispose(this.keptStates),this.keptStates=[]),Array.isArray(this.cell.stateSize)?this.states_=this.cell.stateSize.map((()=>a.zeros(s))):this.states_[0]=a.zeros(s);else{if(Array.isArray(e)||(e=[e]),e.length!==this.states_.length)throw new c.ValueError("Layer ".concat(this.name," expects ").concat(this.states_.length," state(s), ")+"but it received ".concat(e.length," state value(s). Input ")+"received: ".concat(e));t?this.keptStates.push(this.states_.slice()):a.dispose(this.states_);for(let t=0;t<this.states_.length;++t){const n=e[t],a=s;if(!r.util.arraysEqual(n.shape,a))throw new c.ValueError("State ".concat(t," is incompatible with layer ").concat(this.name,": ")+"expected shape=".concat(a,", received shape=").concat(n.shape));this.states_[t]=n}}this.states_=this.states_.map((e=>a.keep(e.clone())))}
1))}computeSingleOutputShape(e){const{dataFormat:t,filters:n,kernelSize:r,padding:a,strides:o,dilationRate:s}=this.cell,i="channelsFirst"===t,c=e[i?3:2],l=e[i?4:3],d=(0,u.convOutputLength)(c,r[0],a,o[0],s[0]),p=(0,u.convOutputLength)(l,r[1],a,o[1],s[1]);return[...e.slice(0,2),...i?[n,d,p]:[d,p,n]]}}y.className="ConvRNN2D";class v extends h.LSTMCell{constructor(e){const{filters:t,kernelSize:n,strides:r,padding:a,dataFormat:o,dilationRate:i}=e;super(Object.assign({},e,{units:t})),this.filters=t,(0,d.assertPositiveInteger)(this.filters,"filters"),this.kernelSize=(0,u.normalizeArray)(n,2,"kernelSize"),this.kernelSize.forEach((e=>(0,d.assertPositiveInteger)(e,"kernelSize"))),this.strides=(0,u.normalizeArray)(r||1,2,"strides"),this.strides.forEach((e=>(0,d.assertPositiveInteger)(e,"strides"))),this.padding=a||"valid",(0,s.checkPaddingMode)(this.padding),this.dataFormat=o||"channelsLast",(0,s.checkDataFormat)(this.dataFormat),this.dilationRate=(0,u.normalizeArray)(i||1,2,"dilationRate"),this.dilationRate.forEach((e=>(0,d.assertPositiveInteger)(e,"dilationRate")))}build(e){var t;e=(0,p.getExactlyOneShape)(e);const n="channelsFirst"===this.dataFormat?1:e.length-1;if(null==e[n])throw new c.ValueError("The channel dimension of the input should be defined. "+"Found ".concat(e[n]));const r=e[n],s=this.kernelSize.concat([r,4*this.filters]);this.kernel=this.addWeight("kernel",s,null,this.kernelInitializer,this.kernelRegularizer,!0,this.kernelConstraint);const i=this.kernelSize.concat([this.filters,4*this.filters]);if(this.recurrentKernel=this.addWeight("recurrent_kernel",i,null,this.recurrentInitializer,this.recurrentRegularizer,!0,this.recurrentConstraint),this.useBias){let e;if(this.unitForgetBias){const n=this.biasInitializer,r=this.filters;e=new((t=class extends l.Initializer{apply(e,t){const s=n.apply([r]),i=a.ones([r]),c=n.apply([2*r]);return o.concatenate([s,i,c])}}).className="CustomInit",t)}else e=this.biasInitializer;this.bias=this.addWeight("bias",[4*this.filters],null,e,this.biasRegularizer,!0,this.biasConstraint)}this.built=!0}call(e,t){return a.tidy((()=>{if(3!==e.length)throw new c.ValueError("ConvLSTM2DCell expects 3 input Tensors (inputs, h, c), got "+"".concat(e.length,"."));const n=t.training||!1,r=e[0],o=e[1],s=e[2];0<this.dropout&&this.dropout<1&&null==this.dropoutMask&&(this.dropoutMask=(0,h.generateDropoutMask)({ones:()=>a.onesLike(r),rate:this.dropout,training:n,count:4,dropoutFunc:this.dropoutFunc}));const i=this.dropoutMask,l=(e,t,n)=>t&&t[n]?a.mul(t[n],e):e;let u=l(r,i,0),d=l(r,i,1),p=l(r,i,2),f=l(r,i,3);0<this.recurrentDropout&&this.recurrentDropout<1&&null==this.recurrentDropoutMask&&(this.recurrentDropoutMask=(0,h.generateDropoutMask)({ones:()=>a.onesLike(o),rate:this.recurrentDropout,training:n,count:4,dropoutFunc:this.dropoutFunc}));const m=this.recurrentDropoutMask;let g=l(o,m,0),y=l(o,m,1),v=l(o,m,2),b=l(o,m,3);const[x,w,k,_]=a.split(this.kernel.read(),4,3),[C,P,O,N]=this.useBias?a.split(this.bias.read(),4):[null,null,null,null];u=this.inputConv(u,x,C,this.padding),d=this.inputConv(d,w,P,this.padding),p=this.inputConv(p,k,O,this.padding),f=this.inputConv(f,_,N,this.padding);const[I,T,S,E]=a.split(this.recurrentKernel.read(),4,3);g=this.recurrentConv(g,I),y=this.recurrentConv(y,T),v=this.recurrentConv(v,S),b=this.recurrentConv(b,E);const M=this.recurrentActivation.apply(a.add(u,g)),A=this.recurrentActivation.apply(a.add(d,y)),D=a.add(a.mul(A,s),a.mul(M,this.activation.apply(a.add(p,v)))),R=a.mul(this.recurrentActivation.apply(a.add(f,b)),this.activation.apply(D));return[R,R,D]}))}getConfig(){const e=super.getConfig(),{units:t}=e,n=g(e,["units"]),r={filters:this.filters,kernelSize:this.kernelSize,padding:this.padding,dataFormat:this.dataFormat,dilationRate:this.dilationRate,strides:this.strides};return Object.assign({},n,r)}inputConv(e,t,n,r){const s=a.conv2d(e,t,this.strides,r||"valid","channelsFirst"===this.dataFormat?"NCHW":"NHWC",this.dilationRate);return n?o.biasAdd(s,n,this.dataFormat):s}recurrentConv(e,t){return a.conv2d(e,t,1,"same","channelsFirst"===this.dataFormat?"NCHW":"NHWC")}}t.ConvLSTM2DCell=v,v.className="ConvLSTM2DCell",a.serialization.registerClass(v);class b extends y{constructor(e){const t=new v(e);super(Object.assign({},e,{cell:t}))}static fromConfig(e,t){return new e(t)}}t.ConvLSTM2D=b,b.className="ConvLSTM2D",a.serialization.registerClass(b)},787742:(e,t,n)=>{"use strict";
1Object.defineProperty(t,"__esModule",{value:!0}),t.SpatialDropout1D=t.Reshape=t.RepeatVector=t.Permute=t.Masking=t.Flatten=t.Dropout=t.Dense=t.Activation=void 0;var r=n(735534),a=n(457025),o=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=f(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if("default"!==o&&{}.hasOwnProperty.call(e,o)){var s=a?Object.getOwnPropertyDescriptor(e,o):null;s&&(s.get||s.set)?Object.defineProperty(r,o,s):r[o]=e[o]}return r.default=e,n&&n.set(e,r),r}(n(984710)),s=n(87475),i=n(840889),c=n(608012),l=n(492560),u=n(141115),d=n(986904),p=n(302774),h=n(252518);function f(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(f=function(e){return e?n:t})(e)}class m extends i.Layer{constructor(e){super(e),this.rate=Math.max(Math.min(e.rate,1),0),this.noiseShape=e.noiseShape,this.seed=e.seed,this.supportsMasking=!0}getNoiseShape(e){if(null==this.noiseShape)return this.noiseShape;const t=e.shape,n=[];for(let e=0;e<this.noiseShape.length;++e)n.push(null==this.noiseShape[e]?t[e]:this.noiseShape[e]);return n}call(e,t){return(0,r.tidy)((()=>{this.invokeCallHook(e,t);const n=(0,h.getExactlyOneTensor)(e);if(0<this.rate&&this.rate<1){const e=null!=t.training&&t.training,r=this.getNoiseShape(n);return o.inTrainPhase((()=>o.dropout(n,this.rate,r,this.seed)),(()=>n),e)}return e}))}getConfig(){const e={rate:this.rate,noiseShape:this.noiseShape,seed:this.seed},t=super.getConfig();return Object.assign(e,t),e}dispose(){return super.dispose()}}t.Dropout=m,m.className="Dropout",r.serialization.registerClass(m);class g extends m{constructor(e){super(e),this.inputSpec=[{ndim:3}]}getNoiseShape(e){const t=e.shape;return[t[0],1,t[2]]}}t.SpatialDropout1D=g,g.className="SpatialDropout1D",r.serialization.registerClass(g);class y extends i.Layer{constructor(e){if(super(e),this.activation=null,this.useBias=!0,this.kernel=null,this.bias=null,this.DEFAULT_KERNEL_INITIALIZER="glorotNormal",this.DEFAULT_BIAS_INITIALIZER="zeros",null==e.batchInputShape&&null==e.inputShape&&null!=e.inputDim){let t=null;null!=e.batchSize&&(t=e.batchSize),this.batchInputShape=[t,e.inputDim]}this.units=e.units,(0,d.assertPositiveInteger)(this.units,"units"),this.activation=(0,a.getActivation)(e.activation),null!=e.useBias&&(this.useBias=e.useBias),this.kernelInitializer=(0,l.getInitializer)(e.kernelInitializer||this.DEFAULT_KERNEL_INITIALIZER),this.biasInitializer=(0,l.getInitializer)(e.biasInitializer||this.DEFAULT_BIAS_INITIALIZER),this.kernelConstraint=(0,s.getConstraint)(e.kernelConstraint),this.biasConstraint=(0,s.getConstraint)(e.biasConstraint),this.kernelRegularizer=(0,u.getRegularizer)(e.kernelRegularizer),this.biasRegularizer=(0,u.getRegularizer)(e.biasRegularizer),this.activityRegularizer=(0,u.getRegularizer)(e.activityRegularizer),this.supportsMasking=!0,this.inputSpec=[{minNDim:2}]}build(e){const t=(e=(0,h.getExactlyOneShape)(e))[e.length-1];null==this.kernel&&(this.kernel=this.addWeight("kernel",[t,this.units],null,this.kernelInitializer,this.kernelRegularizer,!0,this.kernelConstraint),this.useBias&&(this.bias=this.addWeight("bias",[this.units],null,this.biasInitializer,this.biasRegularizer,!0,this.biasConstraint))),this.inputSpec=[{minNDim:2,axes:{[-1]:t}}],this.built=!0}computeOutputShape(e){const t=(e=(0,h.getExactlyOneShape)(e)).slice();return t[t.length-1]=this.units,t}call(e,t){return(0,r.tidy)((()=>{this.invokeCallHook(e,t);const n=(0,h.getExactlyOneTensor)(e),r=(0,d.mapActivationToFusedKernel)(this.activation.getClassName());let a;return null!=r?a=o.dot(n,this.kernel.read(),r,this.bias?this.bias.read():null):(a=o.dot(n,this.kernel.read()),null!=this.bias&&(a=o.biasAdd(a,this.bias.read())),null!=this.activation&&(a=this.activation.apply(a))),a}))}getConfig(){const e={units:this.units,activation:(0,a.serializeActivation)(this.activation),useBias:this.useBias,kernelInitializer:(0,l.serializeInitializer)(this.kernelInitializer),biasInitializer:(0,l.serializeInitializer)(this.biasInitializer),kernelRegularizer:(0,u.serializeRegularizer)(this.kernelRegularizer),biasRegularizer:(0,u.serializeRegularizer)(this.biasRegularizer),activityRegularizer:(0,u.serializeRegularizer)(this.activityRegularizer),kernelConstraint:(0,s.serializeConstraint)(this.kernelConstraint),biasConstraint:(0,s.serializeConstraint)(this.biasConstraint)},t=super.getConfig();return Object.assign(e,t),e}}t.Dense=y,y.className="Dense",r.serialization.registerClass(y);class v extends i.Layer{constructor(e){super(e=e||{}),this.inputSpec=[{minNDim:3}],this.dataFormat=e.dataFormat}computeOutputShape(e){e=(0,h.getExactlyOneShape)(e);for(const t of e.slice(1))if(null==t)throw new c.ValueError('The shape of the input to "Flatten" is not fully defined '+"(got ".concat(e.slice(1),"). Make sure to pass a complete ")+'"input_shape" or "batch_input_shape" argument to the first layer in your model.');return[e[0],(0,p.arrayProd)(e,1)]}call(e,t){return(0,r.tidy)((()=>{this.invokeCallHook(e,t);let n=(0,h.getExactlyOneTensor)(e);if("channelsFirst"===this.dataFormat&&n.rank>1){const e=[0];for(let t=2;t<n.rank;++t)e.push(t);e.push(1),n=(0,r.transpose)(n,e)}return o.batchFlatten(n)}))}getConfig(){const e={};null!=this.dataFormat&&(e.dataFormat=this.dataFormat);const t=super.getConfig();return Object.assign(e,t),e}}t.Flatten=v,v.className="Flatten",r.serialization.registerClass(v);class b extends i.Layer{constructor(e){super(e),this.supportsMasking=!0,this.activation=(0,a.getActivation)(e.activation)}call(e,t){return(0,r.tidy)((()=>{this.invokeCallHook(e,t);const n=(0,h.getExactlyOneTensor)(e);return this.activation.apply(n)}))}
1getConfig(){const e={activation:(0,a.serializeActivation)(this.activation)},t=super.getConfig();return Object.assign(e,t),e}}t.Activation=b,b.className="Activation",r.serialization.registerClass(b);class x extends i.Layer{constructor(e){super(e),this.n=e.n,this.inputSpec=[{ndim:2}]}computeOutputShape(e){return[e[0],this.n,e[1]]}call(e,t){return(0,r.tidy)((()=>(e=(0,h.getExactlyOneTensor)(e),o.repeat(e,this.n))))}getConfig(){const e={n:this.n},t=super.getConfig();return Object.assign(e,t),e}}t.RepeatVector=x,x.className="RepeatVector",r.serialization.registerClass(x);class w extends i.Layer{constructor(e){super(e),this.targetShape=e.targetShape;for(let e=0;e<this.targetShape.length;++e)this.isUnknown(this.targetShape[e])&&(this.targetShape[e]=null)}isUnknown(e){return e<0||null==e}fixUnknownDimension(e,t){const n="Total size of new array must be unchanged.",r=t.slice();let a=1,o=null;for(let e=0;e<r.length;++e){const t=r[e];if(this.isUnknown(t)){if(null!==o)throw new c.ValueError("Can only specifiy one unknown dimension.");o=e}else a*=t}const s=(0,p.arrayProd)(e);if(null!==o){if(0===a||s%a!=0)throw new c.ValueError(n);r[o]=s/a}else if(s!==a)throw new c.ValueError(n);return r}computeOutputShape(e){let t=!1;for(let n=0;n<e.length;++n)if(this.isUnknown(e[n])){t=!0;break}return t?e.slice(0,1).concat(this.targetShape):e.slice(0,1).concat(this.fixUnknownDimension(e.slice(1),this.targetShape))}call(e,t){return(0,r.tidy)((()=>{this.invokeCallHook(e,t);const n=(0,h.getExactlyOneTensor)(e),a=n.shape,o=a.slice(0,1).concat(this.fixUnknownDimension(a.slice(1),this.targetShape));return(0,r.reshape)(n,o)}))}getConfig(){const e={targetShape:this.targetShape},t=super.getConfig();return Object.assign(e,t),e}}t.Reshape=w,w.className="Reshape",r.serialization.registerClass(w);class k extends i.Layer{constructor(e){if(super(e),null==e.dims)throw new Error("Required configuration field `dims` is missing during Permute constructor call.");if(!Array.isArray(e.dims))throw new Error("Permute constructor requires `dims` to be an Array, but received "+"".concat(e.dims," instead."));const t=(0,p.range)(1,e.dims.length+1);if(!r.util.arraysEqual(e.dims.slice().sort(),t))throw new Error("Invalid permutation `dims`: "+JSON.stringify(e.dims)+" `dims` must contain consecutive integers starting from 1.");this.dims=e.dims,this.dimsIncludingBatch=[0].concat(this.dims),this.inputSpec=[new i.InputSpec({ndim:this.dims.length+1})]}computeOutputShape(e){const t=(e=(0,h.getExactlyOneShape)(e)).slice();return this.dims.forEach(((n,r)=>{t[r+1]=e[n]})),t}call(e,t){return(0,r.transpose)((0,h.getExactlyOneTensor)(e),this.dimsIncludingBatch)}getConfig(){const e={dims:this.dims},t=super.getConfig();return Object.assign(e,t),e}}t.Permute=k,k.className="Permute",r.serialization.registerClass(k);class _ extends i.Layer{constructor(e){super(null==e?{}:e),this.supportsMasking=!0,this.maskValue=null!=e?null==e.maskValue?0:e.maskValue:0}computeOutputShape(e){return e}getConfig(){const e=super.getConfig(),t={maskValue:this.maskValue};return Object.assign(t,e),t}computeMask(e,t){const n=(0,h.getExactlyOneTensor)(e);return(0,r.any)((0,r.notEqual)(n,this.maskValue),-1)}call(e,t){return(0,r.tidy)((()=>{this.invokeCallHook(e,t);const n=(0,h.getExactlyOneTensor)(e),a=(0,r.any)((0,r.notEqual)(n,this.maskValue),-1,!0);return(0,r.mul)(n,(0,r.cast)(a,n.dtype))}))}}t.Masking=_,_.className="Masking",r.serialization.registerClass(_)},939386:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Embedding=void 0;var r=n(735534),a=h(n(984710)),o=n(87475),s=n(840889),i=n(608012),c=n(492560),l=n(141115),u=h(n(986904)),d=n(252518);function p(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(p=function(e){return e?n:t})(e)}function h(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=p(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if("default"!==o&&{}.hasOwnProperty.call(e,o)){var s=a?Object.getOwnPropertyDescriptor(e,o):null;s&&(s.get||s.set)?Object.defineProperty(r,o,s):r[o]=e[o]}return r.default=e,n&&n.set(e,r),r}class f extends s.Layer{constructor(e){if(super(e),this.embeddings=null,this.DEFAULT_EMBEDDINGS_INITIALIZER="randomUniform",null==e.batchInputShape&&null==e.inputShape){let t=null;null!=e.batchSize&&(t=e.batchSize),null==e.inputLength?this.batchInputShape=[t,null]:this.batchInputShape=[t].concat(u.toList(e.inputLength))}this.inputDim=e.inputDim,u.assertPositiveInteger(this.inputDim,"inputDim"),this.outputDim=e.outputDim,u.assertPositiveInteger(this.outputDim,"outputDim"),this.embeddingsInitializer=(0,c.getInitializer)(e.embeddingsInitializer||this.DEFAULT_EMBEDDINGS_INITIALIZER),this.embeddingsRegularizer=(0,l.getRegularizer)(e.embeddingsRegularizer),this.activityRegularizer=(0,l.getRegularizer)(e.activityRegularizer),this.embeddingsConstraint=(0,o.getConstraint)(e.embeddingsConstraint),this.maskZero=e.maskZero,this.supportsMasking=e.maskZero,this.inputLength=e.inputLength}build(e){this.embeddings=this.addWeight("embeddings",[this.inputDim,this.outputDim],this.dtype,this.embeddingsInitializer,this.embeddingsRegularizer,!0,this.embeddingsConstraint),this.built=!0}warnOnIncompatibleInputShape(e){}computeMask(e,t){return(0,r.tidy)((()=>this.maskZero?(e=(0,d.getExactlyOneTensor)(e),(0,r.notEqual)(e,(0,r.zerosLike)(e))):null))}computeOutputShape(e){if(e=(0,d.getExactlyOneShape)(e),null==this.inputLength)return[...e,this.outputDim];const t=u.toList(this.inputLength);if(t.length!==e.length-1)throw new i.ValueError('"inputLength" is '.concat(this.inputLength,", but received ")+"input shape has shape ".concat(e));{let n=0;for(let r=0;r<t.length;++r){const a=t[r],o=e[r+1];if(null!=a&&null!=o&&a!==o)throw new i.ValueError('"inputLength" is '.concat(this.inputLength,", but received ")+"input shape has shape ".concat(e));null==a&&(t[n]=o),n++}}return[e[0],...t,this.outputDim]}call(e,t){return(0,r.tidy)((()=>{this.invokeCallHook(e,t);let n=(0,d.getExactlyOneTensor)(e);"int32"!==n.dtype&&(n=a.cast(n,"int32"));const o=a.gather(this.embeddings.read(),(0,r.reshape)(n,[n.size]));return(0,r.reshape)(o,(0,d.getExactlyOneShape)(this.computeOutputShape(n.shape)))}))}getConfig(){const e={inputDim:this.inputDim,outputDim:this.outputDim,embeddingsInitializer:(0,c.serializeInitializer)(this.embeddingsInitializer),embeddingsRegularizer:(0,l.serializeRegularizer)(this.embeddingsRegularizer),activityRegularizer:(0,l.serializeRegularizer)(this.activityRegularizer),embeddingsConstraint:(0,o.seri
1alizeConstraint)(this.embeddingsConstraint),maskZero:this.maskZero,inputLength:this.inputLength},t=super.getConfig();return Object.assign(e,t),e}}t.Embedding=f,f.className="Embedding",r.serialization.registerClass(f)},185333:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Multiply=t.Minimum=t.Merge=t.Maximum=t.Dot=t.Concatenate=t.Average=t.Add=void 0,t.add=function(e){if(Array.isArray(e)){return new m({}).apply(e)}return new m(e)},t.average=function(e){if(Array.isArray(e)){return new y({}).apply(e)}return new y(e)},t.concatenate=function(e){if(Array.isArray(e)){return new x({}).apply(e)}return new x(e)},t.maximum=function(e){if(Array.isArray(e)){return new v({}).apply(e)}return new v(e)},t.minimum=function(e){if(Array.isArray(e)){return new b({}).apply(e)}return new b(e)},t.multiply=function(e){if(Array.isArray(e)){return new g({}).apply(e)}return new g(e)};var r=h(n(735534)),a=r,o=h(n(984710)),s=n(840889),i=n(608012),c=n(242135),l=h(n(986904)),u=h(n(302774)),d=n(252518);function p(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(p=function(e){return e?n:t})(e)}function h(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=p(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if("default"!==o&&{}.hasOwnProperty.call(e,o)){var s=a?Object.getOwnPropertyDescriptor(e,o):null;s&&(s.get||s.set)?Object.defineProperty(r,o,s):r[o]=e[o]}return r.default=e,n&&n.set(e,r),r}class f extends s.Layer{constructor(e){super(e||{}),this.supportsMasking=!0}mergeFunction(e){throw new i.NotImplementedError}computeElementwiseOpOutputShape(e,t){if(null==e||null==t)return null;if(e.length<t.length)return this.computeElementwiseOpOutputShape(t,e);if(0===t.length)return e;const n=e.slice(0,e.length-t.length);for(let r=0;r<t.length;++r){const a=e[e.length-t.length+r],o=t[r];if(null==a||null==o||a<0||o<0)n.push(null);else if(1===a)n.push(o);else if(1===o)n.push(a);else{if(a!==o)throw new i.ValueError("Operands could not be broadcast together with shapes "+JSON.stringify(e)+" "+JSON.stringify(t));n.push(a)}}return n}build(e){if(Array.isArray(e)&&!Array.isArray(e[0])&&(e=[(0,d.getExactlyOneShape)(e)]),e.length<2)throw new i.ValueError("A merge layer should be called on an Array of at least 2 inputs."+" Got ".concat(e.length," input(s)."));let t=[];for(const n of e)null!=n&&null!==n[0]&&t.push(n[0]);if(t=l.unique(t),t.length>1)throw new i.ValueError("Can not merge tensors with different batch sizes. "+"Got tensors with shapes: ".concat(JSON.stringify(e),"."));let n=null==e[0]?null:e[0].slice(1);for(let t=1;t<e.length;++t){const r=null==e[t]?null:e[t].slice(1);n=this.computeElementwiseOpOutputShape(n,r)}const r=e.map((e=>e.length));-1===e.indexOf(null)&&1===l.unique(r).length?this.reshapeRequired=!1:this.reshapeRequired=!0}call(e,t){return(0,r.tidy)((()=>{if(this.reshapeRequired){const t=[],n=e.map((e=>e.rank));if(-1===n.indexOf(null)){const r=u.max(n);for(let n of e){const e=n.rank;for(let t=0;t<r-e;++t)n=o.expandDims(n,1);t.push(n)}return this.mergeFunction(t)}{let n=!1;for(const r of e){const e=r.rank;if(null==e){const e=r.shape,o=e[0],s=e.slice(1).concat([o]);let i=a.reshape(r,[o].concat(u.arrayProd(e.slice(1))));i=a.transpose(i,[1,0]),i=a.reshape(i,s),t.push(i),n=!0}else if(e>1){const o=u.range(1,e).concat([0]);t.push(a.transpose(r,o)),n=!0}else t.push(r)}let r=this.mergeFunction(t);const o=r.rank;if(n)if(null==o){const e=r.shape,t=e[e.length-1],n=[t].concat(e.slice(0,e.length-1));r=a.reshape(a.transpose(a.reshape(r,[-1,t]),[1,0]),n)}else if(o>1){const e=[o-1].concat(u.range(0,o-1));r=a.transpose(r,e)}return r}}return this.mergeFunction(e)}))}computeOutputShape(e){let t;t=null==e[0]?null:e[0].slice(1);for(let n=1;n<e.length;++n){const r=null==e[n]?null:e[n].slice(1);t=this.computeElementwiseOpOutputShape(t,r)}let n=[];for(const t of e)null!=t&&null!==t[0]&&n.push(t[0]);return n=l.unique(n),t=1===n.length?n.concat(t):[null].concat(t),t}computeMask(e,t){return a.tidy((()=>
1{if(null==t)return null;if(!Array.isArray(t))throw new i.ValueError("`mask` should be an Array");if(!Array.isArray(e))throw new i.ValueError("`inputs` should be an Array");if(t.length!==e.length)throw new i.ValueError("The Array 'inputs' and 'mask' are expected to have the same length, but have different lengths "+"(".concat(e.length," vs ").concat(t.length,")"));if(t.every((e=>null==e)))return null;let n=(t=t.map((e=>null==e?e:a.expandDims(e,0))))[0];for(let e=1;e<t.length-1;++e)n=a.logicalAnd(n,t[e]);return n}))}}t.Merge=f;class m extends f{constructor(e){super(e)}mergeFunction(e){return(0,r.tidy)((()=>{let t=e[0].clone();for(let n=1;n<e.length;++n)t=a.add(t,e[n]);return t}))}}t.Add=m,m.className="Add",r.serialization.registerClass(m);class g extends f{constructor(e){super(e)}mergeFunction(e){return(0,r.tidy)((()=>{let t=e[0].clone();for(let n=1;n<e.length;++n)t=a.mul(t,e[n]);return t}))}}t.Multiply=g,g.className="Multiply",r.serialization.registerClass(g);class y extends f{constructor(e){super(e)}mergeFunction(e){return(0,r.tidy)((()=>{let t=e[0].clone();for(let n=1;n<e.length;++n)t=a.add(t,e[n]);return a.mul(1/e.length,t)}))}}t.Average=y,y.className="Average",r.serialization.registerClass(y);class v extends f{constructor(e){super(e)}mergeFunction(e){return(0,r.tidy)((()=>{let t=e[0];for(let n=1;n<e.length;++n)t=a.maximum(t,e[n]);return t}))}}t.Maximum=v,v.className="Maximum",r.serialization.registerClass(v);class b extends f{constructor(e){super(e)}mergeFunction(e){return(0,r.tidy)((()=>{let t=e[0];for(let n=1;n<e.length;++n)t=a.minimum(t,e[n]);return t}))}}t.Minimum=b,b.className="Minimum",r.serialization.registerClass(b);class x extends f{constructor(e){super(e),this.DEFAULT_AXIS=-1,null==e&&(e={}),this.axis=null==e.axis?this.DEFAULT_AXIS:e.axis,this.supportsMasking=!0,this.reshapeRequired=!1}build(e){if(!Array.isArray(e)||!Array.isArray(e[0])||1===e.length)throw new i.ValueError("A `Concatenate` layer should be called on a list of at least 2 inputs");let t=!0;for(const n of e)if(null!=n){t=!1;break}if(t)return;const n=[];for(let t=0;t<e.length;++t){const a=e[t].slice();a.splice(this.axis,1);let o=!1;for(const e of n)if(r.util.arraysEqual(e,a)){o=!0;break}o||n.push(a)}if(n.length>1)throw new i.ValueError("A `Concatenate` layer requires inputs with matching shapes except for the concat axis. Got input shapes: "+JSON.stringify(e))}mergeFunction(e){return(0,r.tidy)((()=>o.concatenate(e,this.axis)))}computeOutputShape(e){if(!Array.isArray(e)||!Array.isArray(e[0]))throw new i.ValueError("A `Concatenate` layer should be called on a list of inputs.");const t=e,n=t[0].slice(),r=this.axis<0?n.length+this.axis:this.axis;for(const e of t.slice(1)){if(null==n[r]||null==e[r]){n[r]=null;break}n[r]+=e[r]}return n}computeMask(e,t){if(null==t)return null;if(!Array.isArray(t))throw new i.ValueError("`mask` should be an array for Concatenate");if(!Array.isArray(e))throw new i.ValueError("`inputs` should be an array for Concatenate");if(t.length!==e.length)throw new i.ValueError("Mismatch in the length of mask (".concat(t.length,") ")+"and the legnth of inputs (".concat(e.length,")"));return a.tidy((()=>{let n=!0;if(t.forEach((e=>{null==e||(n=!1)})),n)return null;const r=[];for(let n=0;n<e.length;++n)null==t[n]?r.push(a.cast(a.onesLike(e[n]),"bool")):t[n].rank<e[n].rank?r.push(a.expandDims(t[n],-1)):r.push(t[n]);const o=a.concat(r,this.axis);return a.all(o,-1,!1)}))}getConfig(){const e={axis:this.axis},t=super.getConfig();return Object.assign(e,t),e}}function w(e,t){for(;e<0;)e+=t;return e}t.Concatenate=x,x.className="Concatenate",r.serialization.registerClass(x);class k extends f{constructor(e){super(e),this.axes=e.axes,this.normalize=null!=e.normalize&&e.normalize,this.supportsMasking=!0,this.reshapeRequired=!1}build(e){a.util.assert(Array.isArray(e)&&2===e.length&&Array.isArray(e[0])&&Array.isArray(e[1]),(()=>"A `Dot` layer should be called on a list of exactly 2 inputs."));const t=e[0],n=e[1];if(t.length>3||n.length>3)throw new i.NotImplementedError("Dot layer does not support tensors of 4D or higher rank yet.");const r=this.interpretAxes(t,n);if(t[r[0]]!==n[r[1]])throw new i.ValueError("Dimension incompatibility: "+"".concat(t[r[0]]," !== ").concat(n[r[1]]))}mergeFunction(e){if(2!==e.length)throw new i.ValueError("A `Dot` layer must be called on exactly 2 inputs, "+"but received ".concat(e.length," input(s)."));let t,n=e[0],r=e[1];return t=Array.isArray(this.axes)?this.axes.map(((t,n)=>w(t,e[n].shape.length))):[w(this.axes,n.shape.length),w(this.axes,r.shape.length)],this.normalize&&(n=(0,c.l2Normalize)(n,t[0]),r=(0,c.l2Normalize)(r,t[1])),function(e,t,n){if(e.shape.length>3||t.shape.length>3)throw new i.NotImplementedError("batchDot is not implemented for tensors of 4D or higher rank yet");if(a.util.assert(e.shape.length>=2,(()=>"batchDot requires the rank of x to be >= 2, "+"but got ".concat(e.shape.length))),a.util.assert(e.shape.length>=2,(()=>"batchDot requires the rank of y to be >= 2, "+"but got ".concat(t.shape.length))),"number"==typeof n&&(n=[n,n]),"complex64"===e.dtype||"complex64"===t.dtype)throw new i.NotImplementedError("batchDot is not implemented for complex64-type Tensors yet.");const r=e.shape.length,o=t.shape.length;null==n&&(n=[r-1,o-2]);const s=n;return a.tidy((()=>{let n,i;if(r>o){n=r-o;const e=[];for(let t=0;t<n;++t)e.push(1);t=a.reshape(t,t.shape.concat(e))}else if(o>r){n=o-r;const t=[];for(let e=0;e<n;++e)t.push(1);e=a.reshape(e,e.shape.concat(t))}else n=0;if(2===e.shape.length&&2===t.shape.length)i=s[0]===s[1]?a.sum(a.mul(e,t),s[0]):a.sum(a.mul(a.transpose(e,[1,0]),t),s[1]);else{const n=s[0]!==e.shape.length-1,r=s[1]===t.shape.length-1;i=a.matMul(e,t,n,r)}if(n>0){let e;e=r>o?r+o-3:r-1;const t=[];for(let r=e;r<e+n;++r)t.push(r);i=a.squeeze(i,t)}return 1===i.shape.length&&(i=a.expandDims(i,1)),i}))}(n,r,t)}interpretAxes(e,t){let n;return n=Array.isArray(this.axes)?this.axes:[w(this.axes,e.length),w(this.axes,t.length)],n}computeOutputShape(e){a.util.assert(Array.isArray(e)&&2===e.length&&Array.isArray(e[0])&&Array.isArray(e[1]),(()=>"A `Dot` layer should be called on a list of exactly 2 inputs."));const t=e[0].slice(),n=e[1].slice();if(t.length>3||n.length>3)throw new i.NotImplementedError("Dot layer does not support tensors of 4D or higher rank yet.");const r=this.interpretAxes(t,n);t.splice(r[0],1),n.splice(r[1],1),n.splice(0,1);const o=t.concat(n);return 1===o.length&&o.push(1),o}computeMask(e,t){return null}getConfig(){const e={axes:this.axes,normalize:this.normalize},t=super.getConfig();return Object.assign(e,t),e}}t.Dot=k,k.className="Dot",r.serialization.registerClass(k)},715825:(e,t,n)=>{"use strict";
1Object.defineProperty(t,"__esModule",{value:!0}),t.GaussianNoise=t.GaussianDropout=t.AlphaDropout=void 0;var r=n(735534),a=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=i(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if("default"!==o&&{}.hasOwnProperty.call(e,o)){var s=a?Object.getOwnPropertyDescriptor(e,o):null;s&&(s.get||s.set)?Object.defineProperty(r,o,s):r[o]=e[o]}return r.default=e,n&&n.set(e,r),r}(n(984710)),o=n(840889),s=n(252518);function i(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(i=function(e){return e?n:t})(e)}class c extends o.Layer{constructor(e){super(e),this.supportsMasking=!0,this.stddev=e.stddev}computeOutputShape(e){return e}getConfig(){const e=super.getConfig(),t={stddev:this.stddev};return Object.assign(t,e),t}call(e,t){return(0,r.tidy)((()=>{this.invokeCallHook(e,t);const n=(0,s.getExactlyOneTensor)(e);return a.inTrainPhase((()=>(0,r.add)(a.randomNormal(n.shape,0,this.stddev),n)),(()=>n),t.training||!1)}))}}t.GaussianNoise=c,c.className="GaussianNoise",r.serialization.registerClass(c);class l extends o.Layer{constructor(e){super(e),this.supportsMasking=!0,this.rate=e.rate}computeOutputShape(e){return e}getConfig(){const e=super.getConfig(),t={rate:this.rate};return Object.assign(t,e),t}call(e,t){return(0,r.tidy)((()=>{this.invokeCallHook(e,t);const n=(0,s.getExactlyOneTensor)(e);if(this.rate>0&&this.rate<1){const e=()=>{const e=Math.sqrt(this.rate/(1-this.rate));return(0,r.mul)(n,a.randomNormal(n.shape,1,e))};return a.inTrainPhase(e,(()=>n),t.training||!1)}return n}))}}t.GaussianDropout=l,l.className="GaussianDropout",r.serialization.registerClass(l);class u extends o.Layer{constructor(e){super(e),this.supportsMasking=!0,this.rate=e.rate,this.noiseShape=e.noiseShape}_getNoiseShape(e){return this.noiseShape||(0,s.getExactlyOneTensor)(e).shape}computeOutputShape(e){return e}getConfig(){const e=super.getConfig(),t={rate:this.rate};return Object.assign(t,e),t}call(e,t){return(0,r.tidy)((()=>{if(this.rate<1&&this.rate>0){const n=this._getNoiseShape(e),o=()=>{const t=(0,s.getExactlyOneTensor)(e),o=-1.7580993408473766;let i=(0,r.greaterEqual)((0,r.randomUniform)(n),this.rate);i=a.cast(i,"float32");const c=((1-this.rate)*(1+this.rate*o**2))**-.5,l=-c*o*this.rate,u=(0,r.add)((0,r.mul)(t,i),(0,r.mul)((0,r.add)(i,-1),o));return(0,r.add)((0,r.mul)(u,c),l)};return a.inTrainPhase(o,(()=>(0,s.getExactlyOneTensor)(e)),t.training||!1)}return e}))}}t.AlphaDropout=u,u.className="AlphaDropout",r.serialization.registerClass(u)},92446:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.LayerNormalization=t.BatchNormalization=void 0,t.batchNormalization=m,t.normalizeBatchInTraining=g;var r=f(n(735534)),a=r,o=n(87475),s=n(840889),i=n(608012),c=n(492560),l=n(141115),u=f(n(986904)),d=f(n(302774)),p=n(252518);function h(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(h=function(e){return e?n:t})(e)}function f(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=h(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if("default"!==o&&{}.hasOwnProperty.call(e,o)){var s=a?Object.getOwnPropertyDescriptor(e,o):null;s&&(s.get||s.set)?Object.defineProperty(r,o,s):r[o]=e[o]}return r.default=e,n&&n.set(e,r),r}function m(e,t,n,r,o){let s,c=arguments.length>5&&void 0!==arguments[5]?arguments[5]:.001;if(2===e.rank)s=a.batchNorm2d(e,t,n,r,o,c);else if(3===e.rank)s=a.batchNorm3d(e,t,n,r,o,c);else{if(4!==e.rank)throw new i.NotImplementedError("batchNormalization is not implemented for array of rank ".concat(e.rank," ")+"yet");s=a.batchNorm4d(e,t,n,r,o,c)}return s}function g(e,t,n,o){let s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:.001;return r.util.arraysEqual(o.slice().sort(),d.range(0,e.rank-1))?function(e,t,n,o){let s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:.001;return(0,r.tidy)((()=>{const r=a.moments(e,o),i=r.mean,c=r.variance;return[m(e,i,c,n,t,s),i,c]}))}(e,t,n,o,s):function(e,t,n,o){let s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:.001;return(0,r.tidy)((()=>{const i=a.moments(e,o),c=i.mean,l=i.variance,u=[];for(const t of d.range(0,e.rank))-1!==o.indexOf(t)?u.push(1):u.push(e.shape[t]);const p=(0,r.reshape)(c,u),h=(0,r.reshape)(l,u),f=null==t?null:(0,r.reshape)(t,u),g=null==n?null:(0,r.reshape)(n,u);return[m(e,p,h,g,f,s),c,l]}))}(e,t,n,o,s)}class y extends s.Layer{constructor(e){null==e&&(e={}),super(e),this.supportsMasking=!0,this.axis=null==e.axis?-1:e.axis,this.momentum=null==e.momentum?.99:e.momentum,this.epsilon=null==e.epsilon?.001:e.epsilon,this.center=null==e.center||e.center,this.scale=null==e.scale||e.scale,this.betaInitializer=(0,c.getInitializer)(e.betaInitializer||"zeros"),this.gammaInitializer=(0,c.getInitializer)(e.gammaInitializer||"ones"),this.movingMeanInitializer=(0,c.getInitializer)(e.movingMeanInitializer||"zeros"),this.movingVarianceInitializer=(0,c.getInitializer)(e.movingVarianceInitializer||"ones"),this.betaConstraint=(0,o.getConstraint)(e.betaConstraint),this.gammaConstraint=(0,o.getConstraint)(e.gammaConstraint),this.betaRegularizer=(0,l.getRegularizer)(e.betaRegularizer),this.gammaRegularizer=(0,l.getRegularizer)(e.gammaRegularizer)}build(e){e=(0,p.getExactlyOneShape)(e);const t=this.axis>=0?this.axis:this.axis+e.length,n=e[t];if(null==n)throw new i.ValueError("Axis ".concat(t," of input tensor should have a defined dimension but ")+"the layer received an input with shape "+"".concat(JSON.stringify(e),"."));this.inputSpec=[new s.InputSpec({ndim:e.length,axes:{[t]:n}})];const r=[n];this.scale&&(this.gamma=this.addWeight("gamma",r,null,this.gammaInitializer,this.gammaRegularizer,!0,this.gammaConstraint)),this.center&&(this.beta=this.addWeight("beta",r,null,this.betaInitializer,this.betaRegularizer,!0,this.betaConstraint)),this.movingMean=this.addWeight("moving_mean",r,null,this.movingMeanInitializer,null,!1),this.movingVariance=this.addWeight("moving_variance",r,null,this.movingVarianceInitializer,null,!1),this.built=!0}call(e,t){return(0,r.tidy)((()=>{const n=null!=t.training&&t.training,o=(0,p.getExactlyOneTensor)(e),s=o.shape,i=s.length,c=d.range(0,i),l=this.axis>=0?this.axis:this.axis+i;c.splice(l,1);const h=u.pyListRepeat(1,i);h[l]=s[l];const f=c.slice();f.sort();const y=!r.util.arraysEqual(f,d.range(0,i).slice(0,i-1));if(!n)return(()=>
1{if(y){const e=(0,r.reshape)(this.movingMean.read(),h),t=(0,r.reshape)(this.movingVariance.read(),h),n=this.center?(0,r.reshape)(this.beta.read(),h):null,a=this.scale?(0,r.reshape)(this.gamma.read(),h):null;return m(o,e,t,n,a,this.epsilon)}return m(o,this.movingMean.read(),this.movingVariance.read(),null==this.beta?null:this.beta.read(),null==this.gamma?null:this.gamma.read(),this.epsilon)})();const[v,b,x]=g(o,this.gamma.read(),this.beta.read(),c,this.epsilon),w=(e,t,n)=>{a.tidy((()=>{const r=1-n,o=e.read(),s=a.mul(a.sub(o,t),r);e.write(a.sub(o,s))}))};return(()=>{w(this.movingMean,b,this.momentum),w(this.movingVariance,x,this.momentum)})(),v}))}getConfig(){const e={axis:this.axis,momentum:this.momentum,epsilon:this.epsilon,center:this.center,scale:this.scale,betaInitializer:(0,c.serializeInitializer)(this.betaInitializer),gammaInitializer:(0,c.serializeInitializer)(this.gammaInitializer),movingMeanInitializer:(0,c.serializeInitializer)(this.movingMeanInitializer),movingVarianceInitializer:(0,c.serializeInitializer)(this.movingVarianceInitializer),betaRegularizer:(0,l.serializeRegularizer)(this.betaRegularizer),gammaRegularizer:(0,l.serializeRegularizer)(this.gammaRegularizer),betaConstraint:(0,o.serializeConstraint)(this.betaConstraint),gammaConstraint:(0,o.serializeConstraint)(this.gammaConstraint)},t=super.getConfig();return Object.assign(e,t),e}}t.BatchNormalization=y,y.className="BatchNormalization",r.serialization.registerClass(y);class v extends s.Layer{constructor(e){if(null==e&&(e={}),super(e),this.axis=null==e.axis?-1:e.axis,"number"==typeof this.axis){if(!Number.isInteger(this.axis))throw new Error("Expected axis to be an integer, but received ".concat(this.axis))}else{if(!Array.isArray(this.axis))throw new Error("Expected axis to be an integer or an array of integers, "+"but received ".concat(JSON.stringify(this.axis)));for(const e of this.axis)if(!Number.isInteger(e))throw new Error("Expected axis to be an array of integers, "+"but received ".concat(JSON.stringify(this.axis)))}this.epsilon=null==e.epsilon?.001:e.epsilon,this.center=null==e.center||e.center,this.scale=null==e.scale||e.scale,this.betaInitializer=(0,c.getInitializer)(e.betaInitializer||"zeros"),this.gammaInitializer=(0,c.getInitializer)(e.gammaInitializer||"ones"),this.betaRegularizer=(0,l.getRegularizer)(e.betaRegularizer),this.gammaRegularizer=(0,l.getRegularizer)(e.gammaRegularizer),this.supportsMasking=!0}build(e){const t=(e=(0,p.getExactlyOneShape)(e)).length;"number"==typeof this.axis&&(this.axis=[this.axis]);for(let e=0;e<this.axis.length;++e)this.axis[e]<0&&(this.axis[e]+=t);for(const e of this.axis)if(e<0||e>=t)throw new Error("Invalid axis: ".concat(e));if(this.axis.length!==u.unique(this.axis).length)throw new Error("Found duplicate axes in: ".concat(this.axis));const n=this.axis.map((t=>e[t])),r=!0;this.scale?this.gamma=this.addWeight("gamma",n,"float32",this.gammaInitializer,this.gammaRegularizer,r):this.gamma=null,this.center?this.beta=this.addWeight("beta",n,"float32",this.betaInitializer,this.betaRegularizer,r):this.beta=null,this.built=!0}call(e,t){const n=(0,p.getExactlyOneTensor)(e),o=n.shape,s=o.length;return(0,r.tidy)((()=>{let{mean:e,variance:t}=(0,r.moments)(n,this.axis,!0);const i=u.pyListRepeat(1,s);for(const e of this.axis)i[e]=o[e];const c=e=>null!=e&&e.shape.length!==s?a.reshape(e,i):e;let l=c(this.gamma.read()),d=c(this.beta.read());const p=[],h=[];for(let e=0;e<s;++e)-1!==this.axis.indexOf(e)?(p.push(o[e]),h.push(1)):(p.push(1),h.push(o[e]));return e=a.tile(e,p),t=a.tile(t,p),l=a.tile(l,h),d=a.tile(d,h),m(n,e,t,d,l,this.epsilon)}))}getConfig(){const e={axis:this.axis,epsilon:this.epsilon,center:this.center,scale:this.scale,betaInitializer:(0,c.serializeInitializer)(this.betaInitializer),gammaInitializer:(0,c.serializeInitializer)(this.gammaInitializer),betaRegularizer:(0,l.serializeRegularizer)(this.betaRegularizer),gammaRegularizer:(0,l.serializeRegularizer)(this.gammaRegularizer)},t=super.getConfig();return Object.assign(e,t),e}}t.LayerNormalization=v,v.className="LayerNormalization",r.serialization.registerClass(v)},56197:(e,t,n)=>{"use strict";
1Object.defineProperty(t,"__esModule",{value:!0}),t.ZeroPadding2D=void 0,t.spatial2dPadding=u,t.temporalPadding=function(e,t){return(0,r.tidy)((()=>{if(3!==e.rank)throw new i.ValueError("temporalPadding expects input tensor to be 3-D, but received a "+"".concat(e.rank,"-D tensor."));if(null==t&&(t=[1,1]),2!==t.length)throw new i.ValueError("temporalPadding expects input padding pattern to be a length-2 "+"array, but received a length-".concat(t.length," array."));const n=[[0,0],t,[0,0]];return a.pad(e,n)}))};var r=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=l(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if("default"!==o&&{}.hasOwnProperty.call(e,o)){var s=a?Object.getOwnPropertyDescriptor(e,o):null;s&&(s.get||s.set)?Object.defineProperty(r,o,s):r[o]=e[o]}return r.default=e,n&&n.set(e,r),r}(n(735534)),a=r,o=n(485246),s=n(840889),i=n(608012),c=n(252518);function l(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(l=function(e){return e?n:t})(e)}function u(e,t,n){return(0,r.tidy)((()=>{if(4!==e.rank)throw new i.ValueError("temporalPadding expects input tensor to be 4-D, but received a "+"".concat(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 i.ValueError("spatial2dPadding expects `padding` to be an Array of two Arrays, each of which is an Array of two integers.");if(null==n&&(n=(0,o.imageDataFormat)()),"channelsLast"!==n&&"channelsFirst"!==n)throw new i.ValueError("Unknown data format: ".concat(n,". ")+"Supported data formats are 'channelsLast' and 'channelsFirst.");let r;return r="channelsFirst"===n?[[0,0],[0,0],t[0],t[1]]:[[0,0],t[0],t[1],[0,0]],a.pad(e,r)}))}class d extends s.Layer{constructor(e){if(null==e&&(e={}),super(e),this.dataFormat=null==e.dataFormat?(0,o.imageDataFormat)():e.dataFormat,null==e.padding)this.padding=[[1,1],[1,1]];else if("number"==typeof e.padding)this.padding=[[e.padding,e.padding],[e.padding,e.padding]];else{if(e.padding=e.padding,2!==e.padding.length)throw new i.ValueError("ZeroPadding2D expects padding to be a length-2 array, but "+"received a length-".concat(e.padding.length," array."));let t,n;if("number"==typeof e.padding[0])t=[e.padding[0],e.padding[0]],n=[e.padding[1],e.padding[1]];else{if(e.padding=e.padding,2!==e.padding[0].length)throw new i.ValueError("ZeroPadding2D expects height padding to be a length-2 array, "+"but received a length-".concat(e.padding[0].length," array."));if(t=e.padding[0],2!==e.padding[1].length)throw new i.ValueError("ZeroPadding2D expects width padding to be a length-2 array, "+"but received a length-".concat(e.padding[1].length," array."));n=e.padding[1]}this.padding=[t,n]}this.inputSpec=[new s.InputSpec({ndim:4})]}computeOutputShape(e){let t,n;return e=(0,c.getExactlyOneShape)(e),"channelsFirst"===this.dataFormat?(t=null!=e[2]&&e[2]>=0?e[2]+this.padding[0][0]+this.padding[0][1]:null,n=null!=e[3]&&e[3]>=0?e[3]+this.padding[1][0]+this.padding[1][1]:null,[e[0],e[1],t,n]):(t=null!=e[1]&&e[1]>=0?e[1]+this.padding[0][0]+this.padding[0][1]:null,n=null!=e[2]&&e[2]>=0?e[2]+this.padding[1][0]+this.padding[1][1]:null,[e[0],t,n,e[3]])}call(e,t){return(0,r.tidy)((()=>u((0,c.getExactlyOneTensor)(e),this.padding,this.dataFormat)))}getConfig(){const e={padding:this.padding,dataFormat:this.dataFormat},t=super.getConfig();return Object.assign(e,t),e}}t.ZeroPadding2D=d,d.className="ZeroPadding2D",r.serialization.registerClass(d)},348311:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Pooling3D=t.Pooling2D=t.Pooling1D=t.MaxPooling3D=t.MaxPooling2D=t.MaxPooling1D=t.GlobalPooling2D=t.GlobalPooling1D=t.GlobalMaxPooling2D=t.GlobalMaxPooling1D=t.GlobalAveragePooling2D=t.GlobalAveragePooling1D=t.AveragePooling3D=t.AveragePooling2D=t.AveragePooling1D=void 0,t.pool2d=g,t.pool3d=y;var r=m(n(735534)),a=r,o=n(485246),s=m(n(984710)),i=n(545188),c=n(840889),l=n(608012),u=n(308079),d=n(986904),p=n(252518),h=n(180743);function f(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(f=function(e){return e?n:t})(e)}
1function m(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=f(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if("default"!==o&&{}.hasOwnProperty.call(e,o)){var s=a?Object.getOwnPropertyDescriptor(e,o):null;s&&(s.get||s.set)?Object.defineProperty(r,o,s):r[o]=e[o]}return r.default=e,n&&n.set(e,r),r}function g(e,t,n,s,c,l){return(0,r.tidy)((()=>{let r;(0,i.checkDataFormat)(c),(0,i.checkPoolMode)(l),(0,i.checkPaddingMode)(s),null==n&&(n=[1,1]),null==s&&(s="valid"),null==c&&(c=(0,o.imageDataFormat)()),null==l&&(l="max"),e=(0,h.preprocessConv2DInput)(e,c);const u="same"===s?"same":"valid";return r="max"===l?a.maxPool(e,t,n,u):a.avgPool(e,t,n,u),"channelsFirst"===c&&(r=a.transpose(r,[0,3,1,2])),r}))}function y(e,t,n,s,c,l){return(0,r.tidy)((()=>{let r;(0,i.checkDataFormat)(c),(0,i.checkPoolMode)(l),(0,i.checkPaddingMode)(s),null==n&&(n=[1,1,1]),null==s&&(s="valid"),null==c&&(c=(0,o.imageDataFormat)()),null==l&&(l="max"),e=(0,h.preprocessConv3DInput)(e,c);const u="same"===s?"same":"valid";return r="max"===l?a.maxPool3d(e,t,n,u):a.avgPool3d(e,t,n,u),"channelsFirst"===c&&(r=a.transpose(r,[0,4,1,2,3])),r}))}class v extends c.Layer{constructor(e){if(null==e.poolSize&&(e.poolSize=2),super(e),"number"==typeof e.poolSize)this.poolSize=[e.poolSize];else{if(!Array.isArray(e.poolSize)||1!==e.poolSize.length||"number"!=typeof e.poolSize[0])throw new l.ValueError("poolSize for 1D convolutional layer must be a number or an Array of a single number, but received "+"".concat(JSON.stringify(e.poolSize)));this.poolSize=e.poolSize}if((0,d.assertPositiveInteger)(this.poolSize,"poolSize"),null==e.strides)this.strides=this.poolSize;else if("number"==typeof e.strides)this.strides=[e.strides];else{if(!Array.isArray(e.strides)||1!==e.strides.length||"number"!=typeof e.strides[0])throw new l.ValueError("strides for 1D convolutional layer must be a number or an Array of a single number, but received "+"".concat(JSON.stringify(e.strides)));this.strides=e.strides}(0,d.assertPositiveInteger)(this.strides,"strides"),this.padding=null==e.padding?"valid":e.padding,(0,i.checkPaddingMode)(this.padding),this.inputSpec=[new c.InputSpec({ndim:3})]}computeOutputShape(e){e=(0,p.getExactlyOneShape)(e);const t=(0,u.convOutputLength)(e[1],this.poolSize[0],this.padding,this.strides[0]);return[e[0],t,e[2]]}call(e,t){return(0,r.tidy)((()=>{this.invokeCallHook(e,t),e=s.expandDims((0,p.getExactlyOneTensor)(e),2);const n=this.poolingFunction((0,p.getExactlyOneTensor)(e),[this.poolSize[0],1],[this.strides[0],1],this.padding,"channelsLast");return a.squeeze(n,[2])}))}getConfig(){const e={poolSize:this.poolSize,padding:this.padding,strides:this.strides},t=super.getConfig();return Object.assign(e,t),e}}t.Pooling1D=v;class b extends v{constructor(e){super(e)}poolingFunction(e,t,n,r,a){return(0,i.checkDataFormat)(a),(0,i.checkPaddingMode)(r),g(e,t,n,r,a,"max")}}t.MaxPooling1D=b,b.className="MaxPooling1D",r.serialization.registerClass(b);class x extends v{constructor(e){super(e)}poolingFunction(e,t,n,r,a){return(0,i.checkDataFormat)(a),(0,i.checkPaddingMode)(r),g(e,t,n,r,a,"avg")}}t.AveragePooling1D=x,x.className="AveragePooling1D",r.serialization.registerClass(x);class w extends c.Layer{constructor(e){if(null==e.poolSize&&(e.poolSize=[2,2]),super(e),this.poolSize=Array.isArray(e.poolSize)?e.poolSize:[e.poolSize,e.poolSize],null==e.strides)this.strides=this.poolSize;else if(Array.isArray(e.strides)){if(2!==e.strides.length)throw new l.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 "+"".concat(e.strides.length,"."));this.strides=e.strides}else this.strides=[e.strides,e.strides];(0,d.assertPositiveInteger)(this.poolSize,"poolSize"),(0,d.assertPositiveInteger)(this.strides,"strides"),this.padding=null==e.padding?"valid":e.padding,this.dataFormat=null==e.dataFormat?"channelsLast":e.dataFormat,(0,i.checkDataFormat)(this.dataFormat),(0,i.checkPaddingMode)(this.padding),this.inputSpec=[new c.InputSpec({ndim:4})]}computeOutputShape(e){e=(0,p.getExactlyOneShape)(e);let t="channelsFirst"===this.dataFormat?e[2]:e[1],n="channelsFirst"===this.dataFormat?e[3]:e[2];return t=(0,u.convOutputLength)(t,this.poolSize[0],this.padding,this.strides[0]),n=(0,u.convOutputLength)(n,this.poolSize[1],this.padding,this.strides[1]),"channelsFirst"===this.dataFormat?[e[0],e[1],t,n]:[e[0],t,n,e[3]]}call(e,t){return(0,r.tidy)((()=>(this.invokeCallHook(e,t),this.poolingFunction((0,p.getExactlyOneTensor)(e),this.poolSize,this.strides,this.padding,this.dataFormat))))}getConfig(){const e={poolSize:this.poolSize,padding:this.padding,strides:this.strides,dataFormat:this.dataFormat},t=super.getConfig();return Object.assign(e,t),e}}t.Pooling2D=w;class k extends w{constructor(e){super(e)}poolingFunction(e,t,n,r,a){return(0,i.checkDataFormat)(a),(0,i.checkPaddingMode)(r),g(e,t,n,r,a,"max")}}t.MaxPooling2D=k,k.className="MaxPooling2D",r.serialization.registerClass(k);class _ extends w{constructor(e){super(e)}poolingFunction(e,t,n,r,a){return(0,i.checkDataFormat)(a),(0,i.checkPaddingMode)(r),g(e,t,n,r,a,"avg")}}t.AveragePooling2D=_,_.className="AveragePooling2D",r.serialization.registerClass(_);class C extends c.Layer{constructor(e){if(null==e.poolSize&&(e.poolSize=[2,2,2]),super(e),this.poolSize=Array.isArray(e.poolSize)?e.poolSize:[e.poolSize,e.poolSize,e.poolSize],null==e.strides)this.strides=this.poolSize;else if(Array.isArray(e.strides)){if(3!==e.strides.length)throw new l.ValueError("If the strides property of a 3D pooling layer is an Array, it is expected to have a length of 3, but received length "+"".concat(e.strides.length,"."));this.strides=e.strides}else this.strides=[e.strides,e.strides,e.strides];(0,d.assertPositiveInteger)(this.poolSize,"poolSize"),(0,d.assertPositiveInteger)(this.strides,"strides"),this.padding=null==e.padding?"valid":e.padding,this.dataFormat=null==e.dataFormat?"channelsLast":e.dataFormat,(0,i.checkDataFormat)(this.dataFormat),(0,i.checkPaddingMode)(this.padding),this.inputSpec=[new c.InputSpec({ndim:5})]}computeOutputShape(e){e=(0,p.getExactlyOneShape)(e);let t="channelsFirst"===this.dataFormat?e[2]:e[1],n="channelsFirst"===this.dataFormat?e[3]:e[2],r="channelsFirst"===this.dataFormat?e[4]:e[3];return t=(0,u.convOutputLength)(t,this.poolSize[0],this.padding,this.strides[0]),n=(0,u.convOutputLength)(n,this.poolSize[1],this.padding,this.strides[1]),r
1=(0,u.convOutputLength)(r,this.poolSize[2],this.padding,this.strides[2]),"channelsFirst"===this.dataFormat?[e[0],e[1],t,n,r]:[e[0],t,n,r,e[4]]}call(e,t){return(0,r.tidy)((()=>(this.invokeCallHook(e,t),this.poolingFunction((0,p.getExactlyOneTensor)(e),this.poolSize,this.strides,this.padding,this.dataFormat))))}getConfig(){const e={poolSize:this.poolSize,padding:this.padding,strides:this.strides,dataFormat:this.dataFormat},t=super.getConfig();return Object.assign(e,t),e}}t.Pooling3D=C;class P extends C{constructor(e){super(e)}poolingFunction(e,t,n,r,a){return(0,i.checkDataFormat)(a),(0,i.checkPaddingMode)(r),y(e,t,n,r,a,"max")}}t.MaxPooling3D=P,P.className="MaxPooling3D",r.serialization.registerClass(P);class O extends C{constructor(e){super(e)}poolingFunction(e,t,n,r,a){return(0,i.checkDataFormat)(a),(0,i.checkPaddingMode)(r),y(e,t,n,r,a,"avg")}}t.AveragePooling3D=O,O.className="AveragePooling3D",r.serialization.registerClass(O);class N extends c.Layer{constructor(e){super(e),this.inputSpec=[new c.InputSpec({ndim:3})]}computeOutputShape(e){return[e[0],e[2]]}call(e,t){throw new l.NotImplementedError}}t.GlobalPooling1D=N;class I extends N{constructor(e){super(e||{})}call(e,t){return(0,r.tidy)((()=>{const t=(0,p.getExactlyOneTensor)(e);return a.mean(t,1)}))}}t.GlobalAveragePooling1D=I,I.className="GlobalAveragePooling1D",r.serialization.registerClass(I);class T extends N{constructor(e){super(e||{})}call(e,t){return(0,r.tidy)((()=>{const t=(0,p.getExactlyOneTensor)(e);return a.max(t,1)}))}}t.GlobalMaxPooling1D=T,T.className="GlobalMaxPooling1D",r.serialization.registerClass(T);class S extends c.Layer{constructor(e){super(e),this.dataFormat=null==e.dataFormat?"channelsLast":e.dataFormat,(0,i.checkDataFormat)(this.dataFormat),this.inputSpec=[new c.InputSpec({ndim:4})]}computeOutputShape(e){return"channelsLast"===this.dataFormat?[e[0],e[3]]:[e[0],e[1]]}call(e,t){throw new l.NotImplementedError}getConfig(){const e={dataFormat:this.dataFormat},t=super.getConfig();return Object.assign(e,t),e}}t.GlobalPooling2D=S;class E extends S{call(e,t){return(0,r.tidy)((()=>{const t=(0,p.getExactlyOneTensor)(e);return"channelsLast"===this.dataFormat?a.mean(t,[1,2]):a.mean(t,[2,3])}))}}t.GlobalAveragePooling2D=E,E.className="GlobalAveragePooling2D",r.serialization.registerClass(E);class M extends S{call(e,t){return(0,r.tidy)((()=>{const t=(0,p.getExactlyOneTensor)(e);return"channelsLast"===this.dataFormat?a.max(t,[1,2]):a.max(t,[2,3])}))}}t.GlobalMaxPooling2D=M,M.className="GlobalMaxPooling2D",r.serialization.registerClass(M)},302909:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.StackedRNNCells=t.SimpleRNNCell=t.SimpleRNN=t.RNNCell=t.RNN=t.LSTMCell=t.LSTM=t.GRUCell=t.GRU=void 0,t.generateDropoutMask=E,t.rnn=w,t.standardizeArgs=x;var r=b(n(735534)),a=r,o=n(457025),s=b(n(984710)),i=n(545188),c=n(87475),l=n(840889),u=n(608012),d=n(492560),p=n(141115),h=n(986904),f=b(n(302774)),m=n(252518),g=n(268778),y=n(640153);function v(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(v=function(e){return e?n:t})(e)}function b(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=v(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if("default"!==o&&{}.hasOwnProperty.call(e,o)){var s=a?Object.getOwnPropertyDescriptor(e,o):null;s&&(s.get||s.set)?Object.defineProperty(r,o,s):r[o]=e[o]}return r.default=e,n&&n.set(e,r),r}function x(e,t,n,r){if(Array.isArray(e)){if(null!=t||null!=n)throw new u.ValueError("When inputs is an array, neither initialState or constants should be provided");null!=r&&(n=e.slice(e.length-r,e.length),e=e.slice(0,e.length-r)),e.length>1&&(t=e.slice(1,e.length)),e=e[0]}function a(e){return null==e||Array.isArray(e)?e:[e]}return{inputs:e,initialState:t=a(t),constants:n=a(n)}}function w(e,t,n){let r=arguments.length>3&&void 0!==arguments[3]&&arguments[3],o=arguments.length>4?arguments[4]:void 0,s=arguments.length>5?arguments[5]:void 0,i=arguments.length>6&&void 0!==arguments[6]&&arguments[6],c=arguments.length>7&&void 0!==arguments[7]&&arguments[7];return a.tidy((()=>{const l=t.shape.length;if(l<3)throw new u.ValueError("Input should be at least 3D, but is ".concat(l,"D."));const d=[1,0].concat(f.range(2,l));if(t=a.transpose(t,d),null!=s)throw new u.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."),null!=o&&(o=a.cast(a.cast(o,"bool"),"float32"),o.rank===l-1&&(o=a.expandDims(o,-1)),o=a.transpose(o,d)),r&&(t=a.reverse(t,0),null!=o&&(o=a.reverse(o,0)));const p=[];let h,m=n;const g=t.shape[0],y=a.unstack(t);let v,b;null!=o&&(v=a.unstack(o));for(let t=0;t<g;++t){const n=y[t],r=a.tidy((()=>e(n,m)));if(null==o)h=r[0],m=r[1];else{const e=a.tidy((()=>{const e=v[t],n=a.sub(a.onesLike(e),e);
1return{output:a.add(a.mul(r[0],e),a.mul(m[0],n)),newStates:m.map(((t,o)=>a.add(a.mul(r[1][o],e),a.mul(t,n))))}}));h=e.output,m=e.newStates}c&&p.push(h)}if(c){const e=1;b=a.stack(p,e)}return[h,b,m]}))}class k extends l.Layer{constructor(e){let t;if(super(e),null==e.cell)throw new u.ValueError("cell property is missing for the constructor of RNN.");if(t=Array.isArray(e.cell)?new S({cells:e.cell}):e.cell,null==t.stateSize)throw new u.ValueError("The RNN cell should have an attribute `stateSize` (tuple of integers, one integer per RNN state).");this.cell=t,this.returnSequences=null!=e.returnSequences&&e.returnSequences,this.returnState=null!=e.returnState&&e.returnState,this.goBackwards=null!=e.goBackwards&&e.goBackwards,this._stateful=null!=e.stateful&&e.stateful,this.unroll=null!=e.unroll&&e.unroll,this.supportsMasking=!0,this.inputSpec=[new l.InputSpec({ndim:3})],this.stateSpec=null,this.states_=null,this.numConstants=null,this.keptStates=[]}getStates(){if(null==this.states_){const e=Array.isArray(this.cell.stateSize)?this.cell.stateSize.length:1;return f.range(0,e).map((e=>null))}return this.states_}setStates(e){this.states_=e}computeOutputShape(e){(0,m.isArrayOfShapes)(e)&&(e=e[0]);let t=this.cell.stateSize;Array.isArray(t)||(t=[t]);const n=t[0];let r;if(r=this.returnSequences?[e[0],e[1],n]:[e[0],n],this.returnState){const n=[];for(const r of t)n.push([e[0],r]);return[r].concat(n)}return r}computeMask(e,t){return a.tidy((()=>{Array.isArray(t)&&(t=t[0]);const e=this.returnSequences?t:null;if(this.returnState){const t=this.states.map((e=>null));return[e].concat(t)}return e}))}get states(){if(null==this.states_){const e=Array.isArray(this.cell.stateSize)?this.cell.stateSize.length:1,t=[];for(let n=0;n<e;++n)t.push(null);return t}return this.states_}set states(e){this.states_=e}build(e){if(null!=this.numConstants)throw new u.NotImplementedError("Constants support is not implemented in RNN yet.");(0,m.isArrayOfShapes)(e)&&(e=e[0]);const t=this.stateful?e[0]:null,n=e.slice(2);this.inputSpec[0]=new l.InputSpec({shape:[t,null,...n]});const a=[e[0]].concat(e.slice(2));let o;if(this.cell.build(a),o=Array.isArray(this.cell.stateSize)?this.cell.stateSize:[this.cell.stateSize],null!=this.stateSpec){if(!r.util.arraysEqual(this.stateSpec.map((e=>e.shape[e.shape.length-1])),o))throw new u.ValueError("An initialState was passed that is not compatible with "+"cell.stateSize. Received stateSpec=".concat(this.stateSpec,"; ")+"However cell.stateSize is ".concat(this.cell.stateSize))}else this.stateSpec=o.map((e=>new l.InputSpec({shape:[null,e]})));this.stateful&&this.resetStates()}resetStates(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];(0,r.tidy)((()=>{if(!this.stateful)throw new u.AttributeError("Cannot call resetStates() on an RNN Layer that is not stateful.");const n=this.inputSpec[0].shape[0];if(null==n)throw new u.ValueError("If an RNN is stateful, it needs to know its batch size. Specify the batch size of your input tensors: \n- If using a Sequential model, specify the batch size by passing a `batchInputShape` option to your first layer.\n- If using the functional API, specify the batch size by passing a `batchShape` option to your Input layer.");if(null==this.states_)Array.isArray(this.cell.stateSize)?this.states_=this.cell.stateSize.map((e=>a.zeros([n,e]))):this.states_=[a.zeros([n,this.cell.stateSize])];else if(null==e)a.dispose(this.states_),null!=this.keptStates&&(a.dispose(this.keptStates),this.keptStates=[]),Array.isArray(this.cell.stateSize)?this.states_=this.cell.stateSize.map((e=>a.zeros([n,e]))):this.states_[0]=a.zeros([n,this.cell.stateSize]);else{if(Array.isArray(e)||(e=[e]),e.length!==this.states_.length)throw new u.ValueError("Layer ".concat(this.name," expects ").concat(this.states_.length," state(s), ")+"but it received ".concat(e.length," state value(s). Input ")+"received: ".concat(e));!0===t?this.keptStates.push(this.states_.slice()):a.dispose(this.states_);for(let t=0;t<this.states_.length;++t){const a=e[t],o=Array.isArray(this.cell.stateSize)?this.cell.stateSize[t]:this.cell.stateSize,s=[n,o];if(!r.util.arraysEqual(a.shape,s))throw new u.ValueError("State ".concat(t," is incompatible with layer ").concat(this.name,": ")+"expected shape=".concat(s,", received shape=").concat(a.shape));this.states_[t]=a}}this.states_=this.states_.map((e=>a.keep(e.clone())))}
1))}apply(e,t){let n=null==t?null:t.initialState,r=null==t?null:t.constants;null==t&&(t={});const a=x(e,n,r,this.numConstants);e=a.inputs,n=a.initialState,r=a.constants;let o=[],s=[];if(null!=n){t.initialState=n,o=o.concat(n),this.stateSpec=[];for(const e of n)this.stateSpec.push(new l.InputSpec({shape:e.shape}));s=s.concat(this.stateSpec)}null!=r&&(t.constants=r,o=o.concat(r),this.numConstants=r.length);if(o[0]instanceof l.SymbolicTensor){const n=[e].concat(o),r=this.inputSpec.concat(s),a=this.inputSpec;this.inputSpec=r;const i=super.apply(n,t);return this.inputSpec=a,i}return super.apply(e,t)}call(e,t){return(0,r.tidy)((()=>{const n=null==t?null:t.mask,r=null==t?null:t.training;let a=null==t?null:t.initialState;e=(0,m.getExactlyOneTensor)(e),null==a&&(a=this.stateful?this.states_:this.getInitialState(e));const o=Array.isArray(this.cell.stateSize)?this.cell.stateSize.length:1;if(a.length!==o)throw new u.ValueError("RNN Layer has ".concat(o," state(s) but was passed ")+"".concat(a.length," initial state(s)."));this.unroll&&console.warn("Ignoring unroll = true for RNN layer, due to imperative backend.");const s={training:r},i=w(((e,t)=>{const n=this.cell.call([e].concat(t),s);return[n[0],n.slice(1)]}),e,a,this.goBackwards,n,null,this.unroll,this.returnSequences),c=i[0],l=i[1],d=i[2];this.stateful&&this.resetStates(d,r);const p=this.returnSequences?l:c;return this.returnState?[p].concat(d):p}))}getInitialState(e){return(0,r.tidy)((()=>{let t=a.zeros(e.shape);return t=a.sum(t,[1,2]),t=s.expandDims(t),Array.isArray(this.cell.stateSize)?this.cell.stateSize.map((e=>e>1?s.tile(t,[1,e]):t)):this.cell.stateSize>1?[s.tile(t,[1,this.cell.stateSize])]:[t]}))}get trainableWeights(){return this.trainable?this.cell.trainableWeights:[]}get nonTrainableWeights(){return this.trainable?this.cell.nonTrainableWeights:this.cell.weights}setFastWeightInitDuringBuild(e){super.setFastWeightInitDuringBuild(e),null!=this.cell&&this.cell.setFastWeightInitDuringBuild(e)}getConfig(){const e=super.getConfig(),t={returnSequences:this.returnSequences,returnState:this.returnState,goBackwards:this.goBackwards,stateful:this.stateful,unroll:this.unroll};null!=this.numConstants&&(t.numConstants=this.numConstants);const n=this.cell.getConfig();return this.getClassName()===k.className&&(t.cell={className:this.cell.getClassName(),config:n}),Object.assign({},n,e,t)}static fromConfig(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const r=t.cell,a=(0,y.deserialize)(r,n);return new e(Object.assign(t,{cell:a}))}}t.RNN=k,k.className="RNN",r.serialization.registerClass(k);class _ extends l.Layer{}t.RNNCell=_;class C extends _{constructor(e){super(e),this.DEFAULT_ACTIVATION="tanh",this.DEFAULT_KERNEL_INITIALIZER="glorotNormal",this.DEFAULT_RECURRENT_INITIALIZER="orthogonal",this.DEFAULT_BIAS_INITIALIZER="zeros",this.units=e.units,(0,h.assertPositiveInteger)(this.units,"units"),this.activation=(0,o.getActivation)(null==e.activation?this.DEFAULT_ACTIVATION:e.activation),this.useBias=null==e.useBias||e.useBias,this.kernelInitializer=(0,d.getInitializer)(e.kernelInitializer||this.DEFAULT_KERNEL_INITIALIZER),this.recurrentInitializer=(0,d.getInitializer)(e.recurrentInitializer||this.DEFAULT_RECURRENT_INITIALIZER),this.biasInitializer=(0,d.getInitializer)(e.biasInitializer||this.DEFAULT_BIAS_INITIALIZER),this.kernelRegularizer=(0,p.getRegularizer)(e.kernelRegularizer),this.recurrentRegularizer=(0,p.getRegularizer)(e.recurrentRegularizer),this.biasRegularizer=(0,p.getRegularizer)(e.biasRegularizer),this.kernelConstraint=(0,c.getConstraint)(e.kernelConstraint),this.recurrentConstraint=(0,c.getConstraint)(e.recurrentConstraint),this.biasConstraint=(0,c.getConstraint)(e.biasConstraint),this.dropout=f.min([1,f.max([0,null==e.dropout?0:e.dropout])]),this.recurrentDropout=f.min([1,f.max([0,null==e.recurrentDropout?0:e.recurrentDropout])]),this.dropoutFunc=e.dropoutFunc,this.stateSize=this.units,this.dropoutMask=null,this.recurrentDropoutMask=null}build(e){e=(0,m.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}call(e,t){return(0,r.tidy)((()=>
1{if(2!==e.length)throw new u.ValueError("SimpleRNNCell expects 2 input Tensors, got ".concat(e.length,"."));let n=e[1];e=e[0];const r=null!=t.training&&t.training;let o;0<this.dropout&&this.dropout<1&&null==this.dropoutMask&&(this.dropoutMask=E({ones:()=>a.onesLike(e),rate:this.dropout,training:r,dropoutFunc:this.dropoutFunc})),0<this.recurrentDropout&&this.recurrentDropout<1&&null==this.recurrentDropoutMask&&(this.recurrentDropoutMask=E({ones:()=>a.onesLike(n),rate:this.recurrentDropout,training:r,dropoutFunc:this.dropoutFunc}));const i=this.dropoutMask,c=this.recurrentDropoutMask;o=null!=i?s.dot(a.mul(e,i),this.kernel.read()):s.dot(e,this.kernel.read()),null!=this.bias&&(o=s.biasAdd(o,this.bias.read())),null!=c&&(n=a.mul(n,c));let l=a.add(o,s.dot(n,this.recurrentKernel.read()));return null!=this.activation&&(l=this.activation.apply(l)),[l,l]}))}getConfig(){const e=super.getConfig(),t={units:this.units,activation:(0,o.serializeActivation)(this.activation),useBias:this.useBias,kernelInitializer:(0,d.serializeInitializer)(this.kernelInitializer),recurrentInitializer:(0,d.serializeInitializer)(this.recurrentInitializer),biasInitializer:(0,d.serializeInitializer)(this.biasInitializer),kernelRegularizer:(0,p.serializeRegularizer)(this.kernelRegularizer),recurrentRegularizer:(0,p.serializeRegularizer)(this.recurrentRegularizer),biasRegularizer:(0,p.serializeRegularizer)(this.biasRegularizer),activityRegularizer:(0,p.serializeRegularizer)(this.activityRegularizer),kernelConstraint:(0,c.serializeConstraint)(this.kernelConstraint),recurrentConstraint:(0,c.serializeConstraint)(this.recurrentConstraint),biasConstraint:(0,c.serializeConstraint)(this.biasConstraint),dropout:this.dropout,recurrentDropout:this.recurrentDropout};return Object.assign({},e,t)}}t.SimpleRNNCell=C,C.className="SimpleRNNCell",r.serialization.registerClass(C);class P extends k{constructor(e){e.cell=new C(e),super(e)}call(e,t){return(0,r.tidy)((()=>{null!=this.cell.dropoutMask&&(a.dispose(this.cell.dropoutMask),this.cell.dropoutMask=null),null!=this.cell.recurrentDropoutMask&&(a.dispose(this.cell.recurrentDropoutMask),this.cell.recurrentDropoutMask=null);const n=null==t?null:t.mask,r=null==t?null:t.training,o=null==t?null:t.initialState;return super.call(e,{mask:n,training:r,initialState:o})}))}static fromConfig(e,t){return new e(t)}}t.SimpleRNN=P,P.className="SimpleRNN",r.serialization.registerClass(P);class O extends _{constructor(e){if(super(e),this.DEFAULT_ACTIVATION="tanh",this.DEFAULT_RECURRENT_ACTIVATION="hardSigmoid",this.DEFAULT_KERNEL_INITIALIZER="glorotNormal",this.DEFAULT_RECURRENT_INITIALIZER="orthogonal",this.DEFAULT_BIAS_INITIALIZER="zeros",e.resetAfter)throw new u.ValueError("GRUCell does not support reset_after parameter set to true.");this.units=e.units,(0,h.assertPositiveInteger)(this.units,"units"),this.activation=(0,o.getActivation)(void 0===e.activation?this.DEFAULT_ACTIVATION:e.activation),this.recurrentActivation=(0,o.getActivation)(void 0===e.recurrentActivation?this.DEFAULT_RECURRENT_ACTIVATION:e.recurrentActivation),this.useBias=null==e.useBias||e.useBias,this.kernelInitializer=(0,d.getInitializer)(e.kernelInitializer||this.DEFAULT_KERNEL_INITIALIZER),this.recurrentInitializer=(0,d.getInitializer)(e.recurrentInitializer||this.DEFAULT_RECURRENT_INITIALIZER),this.biasInitializer=(0,d.getInitializer)(e.biasInitializer||this.DEFAULT_BIAS_INITIALIZER),this.kernelRegularizer=(0,p.getRegularizer)(e.kernelRegularizer),this.recurrentRegularizer=(0,p.getRegularizer)(e.recurrentRegularizer),this.biasRegularizer=(0,p.getRegularizer)(e.biasRegularizer),this.kernelConstraint=(0,c.getConstraint)(e.kernelConstraint),this.recurrentConstraint=(0,c.getConstraint)(e.recurrentConstraint),this.biasConstraint=(0,c.getConstraint)(e.biasConstraint),this.dropout=f.min([1,f.max([0,null==e.dropout?0:e.dropout])]),this.recurrentDropout=f.min([1,f.max([0,null==e.recurrentDropout?0:e.recurrentDropout])]),this.dropoutFunc=e.dropoutFunc,this.implementation=e.implementation,this.stateSize=this.units,this.dropoutMask=null,this.recurrentDropoutMask=null}build(e){const t=(e=(0,m.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}call(e,t){return(0,r.tidy)((()=>
1{if(2!==e.length)throw new u.ValueError("GRUCell expects 2 input Tensors (inputs, h, c), got "+"".concat(e.length,"."));const n=null!=t.training&&t.training;let r=e[1];e=e[0],0<this.dropout&&this.dropout<1&&null==this.dropoutMask&&(this.dropoutMask=E({ones:()=>a.onesLike(e),rate:this.dropout,training:n,count:3,dropoutFunc:this.dropoutFunc})),0<this.recurrentDropout&&this.recurrentDropout<1&&null==this.recurrentDropoutMask&&(this.recurrentDropoutMask=E({ones:()=>a.onesLike(r),rate:this.recurrentDropout,training:n,count:3,dropoutFunc:this.dropoutFunc}));const o=this.dropoutMask,i=this.recurrentDropoutMask;let c,l,d;0<this.dropout&&this.dropout<1&&(e=a.mul(e,o[0]));let p=s.dot(e,this.kernel.read());this.useBias&&(p=s.biasAdd(p,this.bias.read())),0<this.recurrentDropout&&this.recurrentDropout<1&&(r=a.mul(r,i[0]));const h=this.recurrentKernel.read(),[f,m]=a.split(h,[2*this.units,this.units],h.rank-1),g=s.dot(r,f),[y,v,b]=a.split(p,3,p.rank-1),[x,w]=a.split(g,2,g.rank-1);c=this.recurrentActivation.apply(a.add(y,x)),l=this.recurrentActivation.apply(a.add(v,w));const k=s.dot(a.mul(l,r),m);d=this.activation.apply(a.add(b,k));const _=a.add(a.mul(c,r),a.mul(a.add(1,a.neg(c)),d));return[_,_]}))}getConfig(){const e=super.getConfig(),t={units:this.units,activation:(0,o.seri
1alizeActivation)(this.activation),recurrentActivation:(0,o.serializeActivation)(this.recurrentActivation),useBias:this.useBias,kernelInitializer:(0,d.serializeInitializer)(this.kernelInitializer),recurrentInitializer:(0,d.serializeInitializer)(this.recurrentInitializer),biasInitializer:(0,d.serializeInitializer)(this.biasInitializer),kernelRegularizer:(0,p.serializeRegularizer)(this.kernelRegularizer),recurrentRegularizer:(0,p.serializeRegularizer)(this.recurrentRegularizer),biasRegularizer:(0,p.serializeRegularizer)(this.biasRegularizer),activityRegularizer:(0,p.serializeRegularizer)(this.activityRegularizer),kernelConstraint:(0,c.serializeConstraint)(this.kernelConstraint),recurrentConstraint:(0,c.serializeConstraint)(this.recurrentConstraint),biasConstraint:(0,c.serializeConstraint)(this.biasConstraint),dropout:this.dropout,recurrentDropout:this.recurrentDropout,implementation:this.implementation,resetAfter:!1};return Object.assign({},e,t)}}t.GRUCell=O,O.className="GRUCell",r.serialization.registerClass(O);class N extends k{constructor(e){0===e.implementation&&console.warn("`implementation=0` has been deprecated, and now defaults to `implementation=1`. Please update your layer call."),e.cell=new O(e),super(e)}call(e,t){return(0,r.tidy)((()=>{null!=this.cell.dropoutMask&&(a.dispose(this.cell.dropoutMask),this.cell.dropoutMask=null),null!=this.cell.recurrentDropoutMask&&(a.dispose(this.cell.recurrentDropoutMask),this.cell.recurrentDropoutMask=null);const n=null==t?null:t.mask,r=null==t?null:t.training,o=null==t?null:t.initialState;return super.call(e,{mask:n,training:r,initialState:o})}))}static fromConfig(e,t){return 0===t.implmentation&&(t.implementation=1),new e(t)}}t.GRU=N,N.className="GRU",r.serialization.registerClass(N);class I extends _{constructor(e){super(e),this.DEFAULT_ACTIVATION="tanh",this.DEFAULT_RECURRENT_ACTIVATION="hardSigmoid",this.DEFAULT_KERNEL_INITIALIZER="glorotNormal",this.DEFAULT_RECURRENT_INITIALIZER="orthogonal",this.DEFAULT_BIAS_INITIALIZER="zeros",this.units=e.units,(0,h.assertPositiveInteger)(this.units,"units"),this.activation=(0,o.getActivation)(void 0===e.activation?this.DEFAULT_ACTIVATION:e.activation),this.recurrentActivation=(0,o.getActivation)(void 0===e.recurrentActivation?this.DEFAULT_RECURRENT_ACTIVATION:e.recurrentActivation),this.useBias=null==e.useBias||e.useBias,this.kernelInitializer=(0,d.getInitializer)(e.kernelInitializer||this.DEFAULT_KERNEL_INITIALIZER),this.recurrentInitializer=(0,d.getInitializer)(e.recurrentInitializer||this.DEFAULT_RECURRENT_INITIALIZER),this.biasInitializer=(0,d.getInitializer)(e.biasInitializer||this.DEFAULT_BIAS_INITIALIZER),this.unitForgetBias=e.unitForgetBias,this.kernelRegularizer=(0,p.getRegularizer)(e.kernelRegularizer),this.recurrentRegularizer=(0,p.getRegularizer)(e.recurrentRegularizer),this.biasRegularizer=(0,p.getRegularizer)(e.biasRegularizer),this.kernelConstraint=(0,c.getConstraint)(e.kernelConstraint),this.recurrentConstraint=(0,c.getConstraint)(e.recurrentConstraint),this.biasConstraint=(0,c.getConstraint)(e.biasConstraint),this.dropout=f.min([1,f.max([0,null==e.dropout?0:e.dropout])]),this.recurrentDropout=f.min([1,f.max([0,null==e.recurrentDropout?0:e.recurrentDropout])]),this.dropoutFunc=e.dropoutFunc,this.implementation=e.implementation,this.stateSize=[this.units,this.units],this.dropoutMask=null,this.recurrentDropoutMask=null}build(e){var t;const n=(e=(0,m.getExactlyOneShape)(e))[e.length-1];let r;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){const e=this.biasInitializer,n=this.units;r=new((t=class extends d.Initializer{apply(t,r){const a=e.apply([n]),o=(new d.Ones).apply([n]),i=e.apply([2*n]);return s.concatAlongFirstAxis(s.concatAlongFirstAxis(a,o),i)}}).className="CustomInit",t)}else r=this.biasInitializer;this.bias=this.addWeight("bias",[4*this.units],null,r,this.biasRegularizer,!0,this.biasConstraint)}else this.bias=null;this.built=!0}call(e,t){return(0,r.tidy)((()=>{const n=null!=t.training&&t.training;if(3!==e.length)throw new u.ValueError("LSTMCell expects 3 input Tensors (inputs, h, c), got "+"".concat(e.length,"."));let r=e[1];const o=e[2];e=e[0],0<this.dropout&&this.dropout<1&&null==this.dropoutMask&&(this.dropoutMask=E({ones:()=>a.onesLike(e),rate:this.dropout,training:n,count:4,dropoutFunc:this.dropoutFunc})),0<this.recurrentDropout&&this.recurrentDropout<1&&null==this.recurrentDropoutMask&&(this.recurrentDropoutMask=E({ones:()=>a.onesLike(r),rate:this.recurrentDropout,training:n,count:4,dropoutFunc:this.dropoutFunc}));const i=this.dropoutMask,c=this.recurrentDropoutMask;let l,d,p,h;0<this.dropout&&this.dropout<1&&(e=a.mul(e,i[0]));let f=s.dot(e,this.kernel.read());0<this.recurrentDropout&&this.recurrentDropout<1&&(r=a.mul(r,c[0])),f=a.add(f,s.dot(r,this.recurrentKernel.read())),this.useBias&&(f=s.biasAdd(f,this.bias.read()));const[m,g,y,v]=a.split(f,4,f.rank-1);l=this.recurrentActivation.apply(m),d=this.recurrentActivation.apply(g),p=a.add(a.mul(d,o),a.mul(l,this.activation.apply(y))),h=this.recurrentActivation.apply(v);const b=a.mul(h,this.activation.apply(p));return[b,b,p]}))}getConfig(){const e=super.getConfig(),t={units:this.units,activation:(0,o.seri
1alizeActivation)(this.activation),recurrentActivation:(0,o.serializeActivation)(this.recurrentActivation),useBias:this.useBias,kernelInitializer:(0,d.serializeInitializer)(this.kernelInitializer),recurrentInitializer:(0,d.serializeInitializer)(this.recurrentInitializer),biasInitializer:(0,d.serializeInitializer)(this.biasInitializer),unitForgetBias:this.unitForgetBias,kernelRegularizer:(0,p.serializeRegularizer)(this.kernelRegularizer),recurrentRegularizer:(0,p.serializeRegularizer)(this.recurrentRegularizer),biasRegularizer:(0,p.serializeRegularizer)(this.biasRegularizer),activityRegularizer:(0,p.serializeRegularizer)(this.activityRegularizer),kernelConstraint:(0,c.serializeConstraint)(this.kernelConstraint),recurrentConstraint:(0,c.serializeConstraint)(this.recurrentConstraint),biasConstraint:(0,c.serializeConstraint)(this.biasConstraint),dropout:this.dropout,recurrentDropout:this.recurrentDropout,implementation:this.implementation};return Object.assign({},e,t)}}t.LSTMCell=I,I.className="LSTMCell",r.serialization.registerClass(I);class T extends k{constructor(e){0===e.implementation&&console.warn("`implementation=0` has been deprecated, and now defaults to `implementation=1`. Please update your layer call."),e.cell=new I(e),super(e)}call(e,t){return(0,r.tidy)((()=>{null!=this.cell.dropoutMask&&(a.dispose(this.cell.dropoutMask),this.cell.dropoutMask=null),null!=this.cell.recurrentDropoutMask&&(a.dispose(this.cell.recurrentDropoutMask),this.cell.recurrentDropoutMask=null);const n=null==t?null:t.mask,r=null==t?null:t.training,o=null==t?null:t.initialState;return super.call(e,{mask:n,training:r,initialState:o})}))}static fromConfig(e,t){return 0===t.implmentation&&(t.implementation=1),new e(t)}}t.LSTM=T,T.className="LSTM",r.serialization.registerClass(T);class S extends _{constructor(e){super(e),this.cells=e.cells}get stateSize(){const e=[];for(const t of this.cells.slice().reverse())Array.isArray(t.stateSize)?e.push(...t.stateSize):e.push(t.stateSize);return e}call(e,t){return(0,r.tidy)((()=>{let n=e.slice(1);const r=[];for(const e of this.cells.slice().reverse())Array.isArray(e.stateSize)?r.push(n.splice(0,e.stateSize.length)):r.push(n.splice(0,1));r.reverse();const a=[];let o;for(let s=0;s<this.cells.length;++s){const i=this.cells[s];n=r[s],o=0===s?[e[0]].concat(n):[o[0]].concat(n),o=i.call(o,t),a.push(o.slice(1))}n=[];for(const e of a.slice().reverse())n.push(...e);return[o[0]].concat(n)}))}build(e){let t;(0,m.isArrayOfShapes)(e)&&(e=e[0]),this.cells.forEach(((n,r)=>{(0,i.nameScope)("RNNCell_".concat(r),(()=>{n.build(e),t=Array.isArray(n.stateSize)?n.stateSize[0]:n.stateSize,e=[e[0],t]}))})),this.built=!0}getConfig(){const e=super.getConfig(),t={cells:this.cells.map((e=>({className:e.getClassName(),config:e.getConfig()})))};return Object.assign({},e,t)}static fromConfig(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const r=[];for(const e of t.cells)r.push((0,y.deserialize)(e,n));return new e({cells:r})}get trainableWeights(){if(!this.trainable)return[];const e=[];for(const t of this.cells)e.push(...t.trainableWeights);return e}get nonTrainableWeights(){const e=[];for(const t of this.cells)e.push(...t.nonTrainableWeights);if(!this.trainable){const t=[];for(const e of this.cells)t.push(...e.trainableWeights);return t.concat(e)}return e}getWeights(){const e=[];for(const t of this.cells)e.push(...t.weights);return(0,g.batchGetValue)(e)}setWeights(e){const t=[];for(const n of this.cells){const r=n.weights.length,a=e.splice(r);for(let e=0;e<n.weights.length;++e)t.push([n.weights[e],a[e]])}(0,g.batchSetValue)(t)}}function E(e){const{ones:t,rate:n,training:r=!1,count:o=1,dropoutFunc:i}=e,c=()=>null!=i?i(t(),n):s.dropout(t(),n),l=()=>s.inTrainPhase(c,t,r);if(!o||o<=1)return a.keep(l().clone());return Array(o).fill(void 0).map(l).map((e=>a.keep(e.clone())))}t.StackedRNNCells=S,S.className="StackedRNNCells",r.serialization.registerClass(S)},640153:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.deserialize=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return(0,a.deserializeKerasObject)(e,r.serialization.SerializationMap.getMap().classNameMap,t,"layer",n)};var r=n(735534),a=n(986904)},447767:(e,t,n)=>{"use strict";
1Object.defineProperty(t,"__esModule",{value:!0}),t.Wrapper=t.TimeDistributed=t.Bidirectional=void 0,t.checkBidirectionalMergeMode=v;var r=m(n(735534)),a=r,o=m(n(984710)),s=n(545188),i=n(840889),c=n(608012),l=n(940826),u=m(n(986904)),d=n(252518),p=n(302909),h=n(640153);function f(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(f=function(e){return e?n:t})(e)}function m(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=f(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if("default"!==o&&{}.hasOwnProperty.call(e,o)){var s=a?Object.getOwnPropertyDescriptor(e,o):null;s&&(s.get||s.set)?Object.defineProperty(r,o,s):r[o]=e[o]}return r.default=e,n&&n.set(e,r),r}class g extends i.Layer{constructor(e){super(e),this.layer=e.layer}build(e){this.built=!0}get trainable(){return null!=this.layer&&this.layer.trainable}set trainable(e){null!=this.layer&&(this.layer.trainable=e)}get trainableWeights(){return this.layer.trainableWeights}get nonTrainableWeights(){return this.layer.nonTrainableWeights}get updates(){return this.layer._updates}get losses(){return this.layer.losses}getWeights(){return this.layer.getWeights()}setWeights(e){this.layer.setWeights(e)}getConfig(){const e={layer:{className:this.layer.getClassName(),config:this.layer.getConfig()}},t=super.getConfig();return Object.assign(e,t),e}setFastWeightInitDuringBuild(e){super.setFastWeightInitDuringBuild(e),null!=this.layer&&this.layer.setFastWeightInitDuringBuild(e)}static fromConfig(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const r=t.layer,a=(0,h.deserialize)(r,n);delete t.layer;const o={layer:a};return Object.assign(o,t),new e(o)}}t.Wrapper=g;class y extends g{constructor(e){super(e),this.supportsMasking=!0}build(e){if((e=(0,d.getExactlyOneShape)(e)).length<3)throw new c.ValueError("TimeDistributed layer expects an input shape >= 3D, but received "+"input shape ".concat(JSON.stringify(e)));this.inputSpec=[{shape:e}];const t=[e[0]].concat(e.slice(2));this.layer.built||(this.layer.build(t),this.layer.built=!0),super.build(e)}computeOutputShape(e){const t=[(e=(0,d.getExactlyOneShape)(e))[0]].concat(e.slice(2)),n=this.layer.computeOutputShape(t),r=e[1];return[n[0],r].concat(n.slice(1))}call(e,t){return(0,r.tidy)((()=>{e=(0,d.getExactlyOneTensor)(e);return(0,p.rnn)(((e,n)=>[(0,d.getExactlyOneTensor)(this.layer.call(e,t)),[]]),e,[],!1,null,null,!1,!0)[1]}))}}function v(e){u.checkStringTypeUnionValue(l.VALID_BIDIRECTIONAL_MERGE_MODES,"BidirectionalMergeMode",e)}t.TimeDistributed=y,y.className="TimeDistributed",r.serialization.registerClass(y);class b extends g{constructor(e){super(e);const t=e.layer.getConfig(),n={};n.className=e.layer.getClassName(),n.config=t,this.forwardLayer=(0,h.deserialize)(n),t.goBackwards=!0!==t.goBackwards;const r={};if(r.className=e.layer.getClassName(),r.config=t,this.backwardLayer=(0,h.deserialize)(r),this.forwardLayer.name="forward_"+this.forwardLayer.name,this.backwardLayer.name="backward_"+this.backwardLayer.name,this.mergeMode=void 0===e.mergeMode?"concat":e.mergeMode,v(this.mergeMode),e.weights)throw new c.NotImplementedError("weights support is not implemented for Bidirectional layer yet.");this._stateful=e.layer.stateful,this.returnSequences=e.layer.returnSequences,this.returnState=e.layer.returnState,this.supportsMasking=!0,this._trainable=!0,this.inputSpec=e.layer.inputSpec,this.numConstants=null}get trainable(){return this._trainable}set trainable(e){this._trainable=e,null!=this.forwardLayer&&(this.forwardLayer.trainable=e),null!=this.backwardLayer&&(this.backwardLayer.trainable=e)}getWeights(){return this.forwardLayer.getWeights().concat(this.backwardLayer.getWeights())}setWeights(e){const t=e.length,n=Math.floor(t/2);this.forwardLayer.setWeights(e.slice(0,n)),this.backwardLayer.setWeights(e.slice(n))}computeOutputShape(e){let t,n,r,a=this.forwardLayer.computeOutputShape(e);return Array.isArray(a)&&Array.isArray(a[0])||(a=[a]),this.returnState?(r=a.slice(1),t=a[0]):t=a[0],"concat"===this.mergeMode?(t[t.length-1]*=2,n=[t]):n=null==this.mergeMode?[t,t.slice()]:[t],this.returnState?null==this.mergeMode?n.concat(r).concat(r.slice()):[t].concat(r).concat(r.slice()):u.singletonOrArray(n)}apply(e,t){let n=null==t?null:t.initialState,r=null==t?null:t.constants;null==t&&(t={});const a=(0,p.standardizeArgs)(e,n,r,this.numConstants);
1if(e=a.inputs,n=a.initialState,r=a.constants,Array.isArray(e)&&(n=e.slice(1),e=e[0]),(null==n||0===n.length)&&null==r)return super.apply(e,t);const o=[],s=[];if(null!=n){const e=n.length;if(e%2>0)throw new c.ValueError("When passing `initialState` to a Bidrectional RNN, the state should be an Array containing the states of the underlying RNNs.");t.initialState=n,o.push(...n);const r=n.map((e=>new i.InputSpec({shape:e.shape})));this.forwardLayer.stateSpec=r.slice(0,e/2),this.backwardLayer.stateSpec=r.slice(e/2),s.push(...r)}if(null!=r)throw new c.NotImplementedError("Support for constants in Bidirectional layers is not implemented yet.");const l=o[0]instanceof i.SymbolicTensor;for(const e of o)if(e instanceof i.SymbolicTensor!==l)throw new c.ValueError("The initial state of a Bidirectional layer cannot be specified as a mix of symbolic and non-symbolic tensors");if(l){const n=[e].concat(o),r=this.inputSpec.concat(s),a=this.inputSpec;this.inputSpec=r;const i=super.apply(n,t);return this.inputSpec=a,i}return super.apply(e,t)}call(e,t){return(0,r.tidy)((()=>{const n=t.initialState;let r,s,i,c;if(null==n)r=this.forwardLayer.call(e,t),s=this.backwardLayer.call(e,t);else{const a=n.slice(0,n.length/2),o=n.slice(n.length/2);r=this.forwardLayer.call(e,Object.assign(t,{initialState:a})),s=this.backwardLayer.call(e,Object.assign(t,{initialState:o}))}return this.returnState&&(Array.isArray(r)&&(i=r.slice(1).concat(s.slice(1))),r=r[0],s=s[0]),this.returnSequences&&(s=a.reverse(s,1)),"concat"===this.mergeMode?c=o.concatenate([r,s]):"sum"===this.mergeMode?c=a.add(r,s):"ave"===this.mergeMode?c=a.mul(.5,a.add(r,s)):"mul"===this.mergeMode?c=a.mul(r,s):null==this.mergeMode&&(c=[r,s]),this.returnState?null==this.mergeMode?c.concat(i):[c].concat(i):c}))}resetStates(e){this.forwardLayer.resetStates(),this.backwardLayer.resetStates()}build(e){(0,s.nameScope)(this.forwardLayer.name,(()=>{this.forwardLayer.build(e)})),(0,s.nameScope)(this.backwardLayer.name,(()=>{this.backwardLayer.build(e)})),this.built=!0}computeMask(e,t){let n;if(Array.isArray(t)&&(t=t[0]),n=this.returnSequences?null==this.mergeMode?[t,t]:t:null==this.mergeMode?[null,null]:null,this.returnState){const e=this.forwardLayer.states.map((e=>null));return Array.isArray(n)?n.concat(e).concat(e):[n].concat(e).concat(e)}return n}get trainableWeights(){return this.forwardLayer.trainableWeights.concat(this.backwardLayer.trainableWeights)}get nonTrainableWeights(){return this.forwardLayer.nonTrainableWeights.concat(this.backwardLayer.nonTrainableWeights)}setFastWeightInitDuringBuild(e){super.setFastWeightInitDuringBuild(e),null!=this.forwardLayer&&this.forwardLayer.setFastWeightInitDuringBuild(e),null!=this.backwardLayer&&this.backwardLayer.setFastWeightInitDuringBuild(e)}getConfig(){const e={mergeMode:this.mergeMode},t=super.getConfig();return Object.assign(e,t),e}static fromConfig(e,t){const n=(0,h.deserialize)(t.layer);if(delete t.layer,null!=t.numConstants)throw new c.NotImplementedError("Deserialization of a Bidirectional layer with numConstants present is not supported yet.");const r=t;return r.layer=n,new e(r)}}t.Bidirectional=b,b.className="Bidirectional",r.serialization.registerClass(b)},782668:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.disposeTensorsInLogs=function(e){if(null==e)return;for(const t in e){const n=e[t];"number"!=typeof n&&n.dispose()}},t.resolveScalarsInLogs=async function(e){if(null==e)return;const t=[],n=[],a=[];for(const r in e){const o=e[r];if("number"!=typeof o){const e=o;t.push(e.data()),n.push(r),a.push(e)}}if(t.length>0){const o=await Promise.all(t);for(let t=0;t<o.length;++t)e[n[t]]=o[t][0];(0,r.dispose)(a)}};var r=n(735534)},242135:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.MSLE=t.MSE=t.MAPE=t.MAE=t.KLD=void 0,t.binaryCrossentropy=k,t.categoricalCrossentropy=b,t.categoricalHinge=y,t.cosine=void 0,t.cosineProximity=P,t.get=function(e){if("string"==typeof e){if(e in O)return O[e];let t="Unknown loss ".concat(e);throw e.toLowerCase().includes("softmaxcrossentropy")&&(t="Unknown loss ".concat(e,". ")+'Use "categoricalCrossentropy" as the string name for tf.losses.softmaxCrossEntropy'),new i.ValueError(t)}return e},t.hinge=g,t.kld=void 0,t.kullbackLeiblerDivergence=_,t.l2Normalize=u,t.logc
1osh=v,t.mape=t.mae=t.lossesMap=void 0,t.meanAbsoluteError=p,t.meanAbsolutePercentageError=h,t.meanSquaredError=d,t.meanSquaredLogarithmicError=f,t.msle=t.mse=void 0,t.poisson=C,t.sigmoidCrossEntropyWithLogits=w,t.sparseCategoricalCrossentropy=x,t.squaredHinge=m;var r=l(n(735534)),a=r,o=n(485246),s=l(n(984710)),i=n(608012);function c(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(c=function(e){return e?n:t})(e)}function l(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=c(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if("default"!==o&&{}.hasOwnProperty.call(e,o)){var s=a?Object.getOwnPropertyDescriptor(e,o):null;s&&(s.get||s.set)?Object.defineProperty(r,o,s):r[o]=e[o]}return r.default=e,n&&n.set(e,r),r}function u(e,t){return(0,r.tidy)((()=>{"float32"!==e.dtype&&(e=a.cast(e,"float32"));const n=a.sum(s.square(e),t,!0),r=a.fill(n.shape,(0,o.epsilon)()),i=a.sqrt(a.maximum(n,r));return a.div(e,i)}))}function d(e,t){return(0,r.tidy)((()=>a.mean(s.square(a.sub(t,e)),-1)))}function p(e,t){return(0,r.tidy)((()=>a.mean(a.abs(a.sub(t,e)),-1)))}function h(e,t){return(0,r.tidy)((()=>{const n=a.sub(e,t),r=a.clipByValue(a.abs(e),(0,o.epsilon)(),Number.MAX_VALUE),s=a.abs(a.div(n,r));return a.mul(100,a.mean(s,-1))}))}function f(e,t){return(0,r.tidy)((()=>{const n=a.clipByValue(t,(0,o.epsilon)(),Number.MAX_VALUE),r=a.log(a.add(1,n)),i=a.clipByValue(e,(0,o.epsilon)(),Number.MAX_VALUE),c=a.log(a.add(1,i));return a.mean(s.square(a.sub(r,c)),-1)}))}function m(e,t){return(0,r.tidy)((()=>{const n=a.maximum(0,a.sub(1,a.mul(e,t)));return a.mean(s.square(n),-1)}))}function g(e,t){return(0,r.tidy)((()=>{const n=a.maximum(0,a.sub(1,a.mul(e,t)));return a.mean(n,-1)}))}function y(e,t){return(0,r.tidy)((()=>{const n=a.sum(a.mul(e,t),-1),r=a.max(a.mul(a.sub(1,e),t),-1);return a.maximum(0,a.add(1,a.sub(r,n)))}))}function v(e,t){return(0,r.tidy)((()=>{const n=Math.log(2),r=a.sub(t,e),o=a.sub(a.add(r,a.softplus(a.mul(-2,r))),n);return a.mean(o,-1)}))}function b(e,t){let n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return(0,r.tidy)((()=>{if(n)t=a.softmax(t);else{const e=a.sum(t,t.shape.length-1,!0);t=a.div(t,e)}return t=a.clipByValue(t,(0,o.epsilon)(),1-(0,o.epsilon)()),a.neg(a.sum(a.mul(a.cast(e,"float32"),a.log(t)),t.shape.length-1))}))}function x(e,t){let n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return(0,r.tidy)((()=>{const r=a.cast(a.floor(s.flatten(e)),"int32"),i=(t=a.clipByValue(t,(0,o.epsilon)(),1-(0,o.epsilon)())).shape;return b(a.reshape(a.oneHot(r,i[i.length-1]),i),t,n)}))}function w(e,t){if(!r.util.arraysEqual(e.shape,t.shape))throw new i.ValueError("logits and labels must have the same shape, but got shapes "+"".concat(JSON.stringify(e.shape)," and ").concat(JSON.stringify(t.shape)));return(0,r.tidy)((()=>{const n=a.relu(t),r=a.neg(a.abs(t));return a.add(a.sub(n,a.mul(t,e)),a.log1p(a.exp(r)))}))}function k(e,t){return(0,r.tidy)((()=>{let n;return n=a.clipByValue(t,(0,o.epsilon)(),1-(0,o.epsilon)()),n=a.log(a.div(n,a.sub(1,n))),a.mean(w(e,n),-1)}))}function _(e,t){return(0,r.tidy)((()=>{const n=a.clipByValue(e,(0,o.epsilon)(),1),r=a.clipByValue(t,(0,o.epsilon)(),1);return a.sum(a.mul(e,a.log(a.div(n,r))),-1)}))}function C(e,t){return(0,r.tidy)((()=>{const n=a.log(a.add((0,o.epsilon)(),t));return a.mean(a.sub(t,a.mul(e,n)),-1)}))}function P(e,t){return(0,r.tidy)((()=>{const n=u(e,-1),r=u(t,-1),o=a.mul(n,r);return a.neg(a.sum(o,-1))}))}t.mse=d,t.MSE=d,t.mae=p,t.MAE=p,t.mape=h,t.MAPE=h,t.msle=f,t.MSLE=f,t.kld=_,t.KLD=_,t.cosine=P;const O=t.lossesMap={meanSquaredError:d,meanAbsoluteError:p,meanAbsolutePercentageError:h,meanSquaredLogarithmicError:f,squaredHinge:m,hinge:g,categoricalHinge:y,logcosh:v,categoricalCrossentropy:b,sparseCategoricalCrossentropy:x,binaryCrossentropy:k,kullbackLeiblerDivergence:_,poisson:C,cosineProximity:P}},26267:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.MSE=t.MAPE=t.MAE=void 0,t.binaryAccuracy=d,t.binaryCrossentropy=function(e,t){return(0,i.binaryCrossentropy)(e,t)},t.categoricalAccuracy=p,t.cosine=t.categoricalCrossentropy=void 0,t.get=function(e){if("string"==typeof e&&e in C)return C[e];if("string"!=typeof e&&null!=e)return e;throw new s.ValueError("Unknown metric ".concat(e))},t.getLossOrMetricName=function(e){if(c.assert(null!==e,"Unknown LossOrMetricFn ".concat(e)),"string"==typeof e)return e;{let t;for(const n of Object.keys(i.lossesMap))if(i.lossesMap[n]===e){t=n;break}if(void 0!==t)return t;for(const n of Object.keys(C))if(C[n]===e){t=n;break}return void 0!==t?t:e.name}},t.mse=t.metricsMap=t.mape=t.mae=void 0,t.precision=f,t.recall=function(e,t){return(0,r.tidy)((()=>{const n=h(e,t),o=function(e,t){return(0,r.tidy)((()=>a.cast(a.sum(a.logicalAnd(a.equal(e,1),a.equal(t,0))),"float32")))}(e,t),s=a.add(n,o);return a.cast(a.where(a.greater(s,0),a.div(n,s),0),"float32")}))},t.sparseCategoricalAccuracy=function(e,t){e.rank===t.rank&&(e=a.squeeze(e,[e.rank-1]
1));(t=a.argMax(t,-1)).dtype!==e.dtype&&(t=a.cast(t,e.dtype));return a.cast(a.equal(e,t),"float32")},t.sparseCategoricalCrossentropy=void 0,t.sparseTopKCategoricalAccuracy=function(e,t){throw new s.NotImplementedError},t.topKCategoricalAccuracy=function(e,t){throw new s.NotImplementedError};var r=u(n(735534)),a=r,o=u(n(984710)),s=n(608012),i=n(242135),c=u(n(986904));function l(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(l=function(e){return e?n:t})(e)}function u(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=l(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if("default"!==o&&{}.hasOwnProperty.call(e,o)){var s=a?Object.getOwnPropertyDescriptor(e,o):null;s&&(s.get||s.set)?Object.defineProperty(r,o,s):r[o]=e[o]}return r.default=e,n&&n.set(e,r),r}function d(e,t){return(0,r.tidy)((()=>{const n=a.mul(.5,a.onesLike(t)),r=o.cast(a.greater(t,n),e.dtype);return a.mean(a.equal(e,r),-1)}))}function p(e,t){return(0,r.tidy)((()=>o.cast(a.equal(a.argMax(e,-1),a.argMax(t,-1)),"float32")))}function h(e,t){return(0,r.tidy)((()=>a.cast(a.sum(a.logicalAnd(a.equal(e,1),a.equal(t,1))),"float32")))}function f(e,t){return(0,r.tidy)((()=>{const n=h(e,t),o=function(e,t){return(0,r.tidy)((()=>a.cast(a.sum(a.logicalAnd(a.equal(e,0),a.equal(t,1))),"float32")))}(e,t),s=a.add(n,o);return a.cast(a.where(a.greater(s,0),a.div(n,s),0),"float32")}))}const m=t.mse=i.meanSquaredError,g=t.MSE=i.meanSquaredError,y=t.mae=i.meanAbsoluteError,v=t.MAE=i.meanAbsoluteError,b=t.mape=i.meanAbsolutePercentageError,x=t.MAPE=i.meanAbsolutePercentageError,w=t.categoricalCrossentropy=i.categoricalCrossentropy,k=t.cosine=i.cosineProximity,_=t.sparseCategoricalCrossentropy=i.sparseCategoricalCrossentropy,C=t.metricsMap={binaryAccuracy:d,categoricalAccuracy:p,precision:f,categoricalCrossentropy:w,sparseCategoricalCrossentropy:_,mse:m,MSE:g,mae:y,MAE:v,mape:b,MAPE:x,cosine:k}},567670:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Sequential=void 0,t.loadLayersModelFromIOHandler=f,t.loadLayersModelInternal=async function(e,t){null==t&&(t={});if("string"==typeof e){const n=r.io.getLoadHandlers(e,t);if(0===n.length)n.push(r.io.browserHTTPRequest(e,t));else if(n.length>1)throw new c.ValueError("Found more than one (".concat(n.length,") load handlers for ")+"URL '".concat(e,"'"));e=n[0]}return f(e,void 0,t)},t.modelFromJSON=async function(e,t){"modelTopology"in e||(e={modelTopology:e});let n=e.modelTopology;null!=n.model_config&&(n=n.model_config);const a=(0,d.convertPythonicToTs)(n),o=(0,l.deserialize)(a,t);if(null!=e.weightsManifest){const t=await r.io.loadWeights(e.weightsManifest,e.pathPrefix,o.weights.map((e=>e.originalName))),n={};for(const e of o.weights)n[e.originalName]=t[e.originalName];o.loadWeights(n),(0,r.dispose)(t)}return o};var r=n(735534),a=n(284986),o=n(310750),s=n(840889),i=n(171320),c=n(608012),l=n(640153),u=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=h(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if("default"!==o&&{}.hasOwnProperty.call(e,o)){var s=a?Object.getOwnPropertyDescriptor(e,o):null;s&&(s.get||s.set)?Object.defineProperty(r,o,s):r[o]=e[o]}return r.default=e,n&&n.set(e,r),r}(n(986904)),d=n(290407),p=n(252518);function h(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(h=function(e){return e?n:t})(e)}async function f(e,t,n){if(null==n&&(n={}),null==e.load)throw new c.ValueError("Cannot proceed with model loading because the IOHandler provided does not have the `load` method implemented.");const a=await e.load();let o=a.modelTopology;null!=o.model_config&&(o=o.model_config);const s=null==n.strict||n.strict,i=null!=a.weightData&&null!=a.weightSpecs&&s,u=(0,l.deserialize)((0,d.convertPythonicToTs)(o),t,i),p=a.trainingConfig;if(null!=p&&u.loadTrainingConfig(p),null!=a.userDefinedMetadata&&u.setUserDefinedMetadata(a.userDefinedMetadata),null!=a.weightData){if(null==a.weightSpecs)throw new c.ValueError("LayersModel artifacts contains weight data, but not weight specs. Therefore loading of weights cannot proceed.");const{modelWeights:e,optimizerWeights:t}=function(e,t){const n=r.io.decodeWeights(e,t),a={},o=[];return t.forEach((e=>{"optimizer"===e.group?o.push({name:e.name,tensor:n[e.name]}):a[e.name]=n[e.name]})),{modelWeights:a,optimizerWeights:o}}(a.weightData,a.weightSpecs);u.loadWeights(e,s),null!=u.optimizer&&t.length>0&&await u.optimizer.setWeights(t),(0,r.dispose)(e),(0,r.dispose)(t.map((e=>e.tensor)))}return u}class m extends i.LayersModel{constructor(e){if(super({inputs:[],outputs:[]}),e=e||{},this.trainable=!0,this.built=!1,this.name=null!=e.name?e.name:(0,a.getUid)("sequential_"),null!=e.layers
1)for(const t of e.layers)this.add(t)}checkShape(e){if(e.inboundNodes[0].outputTensors[0].shape.some((e=>e<0)))throw new c.ValueError("Negative dimension size caused by adding layer "+"".concat(e.name," with input shape [")+"".concat(e.inboundNodes[0].inputTensors[0].shape,"]"))}add(e){const t=e instanceof m||e instanceof i.LayersModel;let n;if(t){if(n=e,1!==n.outputs.length)throw new c.ValueError("All layers in a Sequential model should have a single output tensor. For multi-output layers, use the functional API.");if(1!==n.inputs.length)throw new c.ValueError("All layers in a Sequential model should have a single input tensor. For multi-input layers, use the functional API.")}if(0===this.outputs.length){if(0===e.inboundNodes.length){if(null==e.batchInputShape)throw new c.ValueError("The first layer in a Sequential model must get an `inputShape` or `batchInputShape` argument.");const t=(0,o.Input)({batchShape:e.batchInputShape,dtype:e.dtype,name:e.name+"_input"});e.apply(t)}if(t)this.outputs=n.outputs,this.inputs=n.inputs;else{if(1!==e.inboundNodes.length)throw new c.ValueError("A layer added to a Sequential model must not already be "+"connected somewhere else. LayersModel received layer ".concat(e.name," ")+"which has ".concat(e.inboundNodes.length," pre-existing inbound ")+"connections.");if(1!==e.inboundNodes[0].outputTensors.length)throw new c.ValueError("All layers in a Sequential model should have a single output tensor. For multi-output layers, use the functional API.");this.checkShape(e),this.outputs=[e.inboundNodes[0].outputTensors[0]],this.inputs=(0,s.getSourceInputs)(this.outputs[0])}this.inboundNodes=[],new s.Node({outboundLayer:this,inboundLayers:[],nodeIndices:[],tensorIndices:[],inputTensors:this.inputs,outputTensors:this.outputs,inputMasks:u.pyListRepeat(null,this.inputs.length),outputMasks:[null],inputShapes:this.inputs.map((e=>e.shape)),outputShapes:this.outputs[0].shape})}else{const t=e.apply(this.outputs[0]);if(Array.isArray(t))throw new TypeError("All layers in a Sequential model should have a single output tensor. For multi-output layers, use the functional API.");this.checkShape(e),this.outputs=[t],this.inboundNodes[0].outputTensors=this.outputs,this.inboundNodes[0].outputShapes=[this.outputs[0].shape]}this.layers.push(e),this.built=!1}pop(){if(0===this.layers.length)throw new TypeError("There are no layers in the model.");if(this.layers.pop(),0===this.layers.length)this.outputs=[],this.inboundNodes=[],this.outboundNodes=[];else{const e=this.layers.length-1;this.layers[e].outboundNodes=[],this.outputs=[this.layers[e].output],this.inboundNodes[0].outputTensors=this.outputs,this.inboundNodes[0].outputShapes=[this.outputs[0].shape]}}call(e,t){return null==this.model&&this.build(),this.model.call(e,t)}build(e){if((0,p.getExactlyOneShape)(e),0===this.inputs.length||0===this.outputs.length)throw new TypeError("Sequential model cannot be built: model is empty. Add some layers first.");this.model=new i.LayersModel({inputs:this.inputs,outputs:this.outputs[0],name:this.name+"_model"}),this.model.trainable=this.trainable,this.supportsMasking=this.model.supp
1ortsMasking,this.inputLayers=this.model.inputLayers,this.inputLayersNodeIndices=this.model.inputLayersNodeIndices,this.inputLayersTensorIndices=this.model.inputLayersTensorIndices,this.outputLayers=this.model.outputLayers,this.outputLayersNodeIndices=this.model.outputLayersNodeIndices,this.outputLayersTensorIndices=this.model.outputLayersTensorIndices,this.nodesByDepth=this.model.nodesByDepth,this.containerNodes=this.model.containerNodes,this.outputNames=this.model.outputNames,this.inputNames=this.model.inputNames,this.built=!0}countParams(){return this.built||this.build(),super.countParams()}summary(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:console.log;this.built||this.build(),super.summary(e,t,n)}setWeights(e){null==this.model&&this.build(),this.model.setWeights(e)}evaluate(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(!this.built)throw new c.RuntimeError("The model needs to be compiled before being used.");return this.model.evaluate(e,t,n)}async evaluateDataset(e,t){if(!this.built)throw new c.RuntimeError("The model needs to be compiled before being used.");return this.model.evaluateDataset(e,t)}predict(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return null==this.model&&this.build(),this.model.predict(e,t)}predictOnBatch(e){return null==this.model&&this.build(),this.model.predictOnBatch(e)}compile(e){this.build(),this.model.compile(e),this.optimizer_=this.model.optimizer,this.isOptimizerOwned=this.model.isOptimizerOwned,this.loss=this.model.loss,this.metrics=this.model.metrics,this.metricsTensors=this.model.metricsTensors,this.metricsNames=this.model.metricsNames}get optimizer(){return null==this.model?void 0:this.model.optimizer}set optimizer(e){this.model.optimizer=e}async fit(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(!this.built)throw new c.RuntimeError("The model needs to be compiled before being used.");return this.model.fit(e,t,n)}async fitDataset(e,t){if(!this.built)throw new c.RuntimeError("The model needs to be compiled before being used.");return this.model.fitDataset(e,t)}async trainOnBatch(e,t){return this.model.trainOnBatch(e,t)}static fromConfig(e,t){let n,a=arguments.length>3&&void 0!==arguments[3]&&arguments[3],o={};if(t instanceof Array){if(null==t[0].className||"Merge"===t[0].className)throw new c.ValueError("Legacy serialization format not supported yet.");n=t}else r.util.assert(null!=t.layers,(()=>"When the config data for a Sequential model is not an Array, it must be an Object that contains the 'layers' field.")),n=t.layers,delete t.layers,o=t;const s=new e(o);if(!(s instanceof m))throw new c.NotImplementedError("Sequential.fromConfig called on non-Sequential input: ".concat(s));for(const e of n){const t=void 0,n=(0,l.deserialize)(e,t,a);a&&n.setFastWeightInitDuringBuild(!0),s.add(n)}return s}set stopTraining(e){if(null==this.model)throw new c.ValueError("Cannot set the stopTraining property of a sequential model before it is compiled.");this.model.stopTraining=e}get stopTraining(){if(null==this.model)throw new c.ValueError("Cannot get the stopTraining property of a sequential model before it is compiled.");return this.model.stopTraining}getConfig(){const e=[];for(const t of this.layers){const n={};n.className=t.getClassName(),n.config=t.getConfig(),e.push(n)}return{name:this.name,layers:e}}}t.Sequential=m,m.className="Sequential",r.serialization.registerClass(m)}
1,736183:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getOptimizer=function(e){const t={Adagrad:()=>r.train.adagrad(.01),Adadelta:()=>r.train.adadelta(1,.95,(0,a.epsilon)()),Adam:()=>r.train.adam(.001,.9,.999,(0,a.epsilon)()),Adamax:()=>r.train.adamax(.002,.9,.999,(0,a.epsilon)(),0),RMSProp:()=>r.train.rmsprop(.001,.9,0,(0,a.epsilon)()),SGD:()=>r.train.sgd(.01)};if(t.adagrad=t.Adagrad,t.adadelta=t.Adadelta,t.adam=t.Adam,t.adamax=t.Adamax,t.rmsprop=t.RMSProp,t.sgd=t.SGD,e in t)return t[e]();throw new o.ValueError("Unknown Optimizer ".concat(e))};var r=n(735534),a=n(485246),o=n(608012)},141115:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Regularizer=t.REGULARIZER_IDENTIFIER_REGISTRY_SYMBOL_MAP=t.L1L2=void 0,t.deserializeRegularizer=h,t.getRegularizer=function(e){if(null==e)return null;if("string"==typeof e){return h({className:e in p?p[e]:e,config:{}})}return e instanceof u?e:h(e)},t.l1=function(e){return l(e),new d({l1:null!=e?e.l1:null,l2:0})},t.l2=function(e){return l(e),new d({l2:null!=e?e.l2:null,l1:0})},t.serializeRegularizer=function(e){return(0,s.serializeKerasObject)(e)};var r=c(n(735534)),a=r,o=c(n(984710)),s=n(986904);function i(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(i=function(e){return e?n:t})(e)}function c(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=i(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if("default"!==o&&{}.hasOwnProperty.call(e,o)){var s=a?Object.getOwnPropertyDescriptor(e,o):null;s&&(s.get||s.set)?Object.defineProperty(r,o,s):r[o]=e[o]}return r.default=e,n&&n.set(e,r),r}function l(e){if(null!=e&&"object"!=typeof e)throw new Error("Argument to L1L2 regularizer's constructor is expected to be an "+"object, but received: ".concat(e))}class u extends r.serialization.Serializable{}t.Regularizer=u;class d extends u{constructor(e){super(),l(e),this.l1=null==e||null==e.l1?.01:e.l1,this.l2=null==e||null==e.l2?.01:e.l2,this.hasL1=0!==this.l1,this.hasL2=0!==this.l2}apply(e){return(0,r.tidy)((()=>{let t=(0,r.zeros)([1]);return this.hasL1&&(t=(0,r.add)(t,(0,r.sum)(a.mul(this.l1,(0,r.abs)(e))))),this.hasL2&&(t=(0,r.add)(t,(0,r.sum)(a.mul(this.l2,o.square(e))))),a.reshape(t,[])}))}getConfig(){return{l1:this.l1,l2:this.l2}}static fromConfig(e,t){return new e({l1:t.l1,l2:t.l2})}}t.L1L2=d,d.className="L1L2",r.serialization.registerClass(d);const p=t.REGULARIZER_IDENTIFIER_REGISTRY_SYMBOL_MAP={l1l2:"L1L2"};function h(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return(0,s.deserializeKerasObject)(e,r.serialization.SerializationMap.getMap().classNameMap,t,"regularizer")}},947525:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.MAX_USER_DEFINED_METADATA_SERIALIZED_LENGTH=void 0,t.checkUserDefinedMetadata=function(e,t){let a=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(null==e||"object"!=typeof e||Object.getPrototypeOf(e)!==Object.prototype||!r(e))throw new Error("User-defined metadata is expected to be a JSON object, but is not.");if(a){const r=JSON.stringify(e);r.length>n&&console.warn('User-defined metadata of model "'.concat(t,'" is too large in ')+"size (length=".concat(r.length," when serialized). It is not ")+"recommended to store such large objects in user-defined metadata. Please make sure its serialized length is <= "+"".concat(n,"."))}},t.plainObjectCheck=r;const n=t.MAX_USER_DEFINED_METADATA_SERIALIZED_LENGTH=1048576;function r(e){if(null===e)return!0;if("object"==typeof e){if(Object.getPrototypeOf(e)===Object.prototype){const t=Object.keys(e);for(const n of t){if("string"!=typeof n)return!1;if(!r(e[n]))return!1}return!0}if(Array.isArray(e)){for(const t of e)if(!r(t))return!1;return!0}return!1}{const t=typeof e;return"string"===t||"number"===t||"boolean"===t}}},308079:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.convOutputLength=function(e,t,n,r){let a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1;if(null==e)return e;const o=t+(t-1)*(a-1);let s;s="same"===n?e:e-o+1;return Math.floor((s+r-1)/r)},t.deconvLength=function(e,t,n,a){if(null==e)return null;if("valid"===a)e=e*t+(0,o.max)([n-t,0]);else{if("same"!==a)throw new r.ValueError("Unsupport padding mode: ".concat(a,"."));e*=t}return e},t.normalizeArray=function(e,t,n){if("number"==typeof e)return(0,a.pyListRepeat)(e,t);if(e.length!==t)throw new r.ValueError("The ".concat(n," argument must be an integer or tuple of ").concat(t," integers.")+" Received: ".concat(e.length," elements."));for(let a=0;a<t;
1++a){const s=e[a];if(!(0,o.isInteger)(s))throw new r.ValueError("The ".concat(n," argument must be an integer or tuple of ").concat(t)+" integers. Received: ".concat(JSON.stringify(e)," including a")+" non-integer number ".concat(s))}return e};var r=n(608012),a=n(986904),o=n(302774)},986904:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.assert=o,t.assertPositiveInteger=function e(t,n){Array.isArray(t)?(r.util.assert(t.length>0,(()=>"".concat(n," is unexpectedly an empty array."))),t.forEach(((t,r)=>e(t,"element ".concat(r+1," of ").concat(n))))):r.util.assert(Number.isInteger(t)&&t>0,(()=>"Expected ".concat(n," to be a positive integer, but got ")+"".concat(u(t),".")))},t.checkArrayTypeAndLength=function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1/0;return o(n>=0),o(r>=n),Array.isArray(e)&&e.length>=n&&e.length<=r&&e.every((e=>typeof e===t))},t.checkStringTypeUnionValue=function(e,t,n){if(null==n)return;if(e.indexOf(n)<0)throw new a.ValueError("".concat(n," is not a valid ").concat(t,". Valid values are ").concat(e," or null/undefined."))},t.count=function(e,t){let n=0;for(const r of e)r===t&&n++;return n},t.debounce=function(e,t,n){let a,o=null!=n?n():r.util.now();return function(){const s=null!=n?n():r.util.now();return s-o<t||(o=s,a=e(...arguments)),a}},t.deserializeKerasObject=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"object",o=arguments.length>4&&void 0!==arguments[4]&&arguments[4];if("string"==typeof e){const o=e;let s;if(o in n)s=n[o];else if(o in i)s=i[o];else if(s=t[o],null==s)throw new a.ValueError("Unknown ".concat(r,": ").concat(e,". ")+"This may be due to one of the following reasons:\n"+"1. The ".concat(r," is defined in Python, in which ")+"case it needs to be ported to TensorFlow.js or your JavaScript code.\n"+"2. The custom ".concat(r," is defined in JavaScript, ")+"but is not registered properly with tf.serialization.registerClass().");return s}{const s=e;if(null==s.className||null==s.config)throw new a.ValueError("".concat(r,": Improper config format: ")+"".concat(JSON.stringify(s),".\n")+"'className' and 'config' must set.");const l=s.className;let u,d;if(l in n?[u,d]=n[l]:l in i?[u,d]=i.className:l in t&&([u,d]=t[l]),null==u)throw new a.ValueError("Unknown ".concat(r,": ").concat(l,". ")+"This may be due to one of the following reasons:\n"+"1. The ".concat(r," is defined in Python, in which ")+"case it needs to be ported to TensorFlow.js or your JavaScript code.\n"+"2. The custom ".concat(r," is defined in JavaScript, ")+"but is not registered properly with tf.serialization.registerClass().");if(null!=d){const e={};for(const t of Object.keys(i))e[t]=i[t];for(const t of Object.keys(n))e[t]=n[t];s.config.customObjects=e;const t=Object.assign({},i);for(const e of Object.keys(n))i[e]=n[e];c(s.config);const r=d(u,s.config,n,o);return i=Object.assign({},t),r}{const e=Object.assign({},i);for(const e of Object.keys(n))i[e]=n[e];const t=new u(s.config);return i=Object.assign({},e),t}}},t.formatAsFriendlyString=u,t.getCartesianProductOfValues=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];o(t.length>0,"arrayOfValues is empty");for(const e of t)o(Array.isArray(e),"one of the values is not an array"),o(e.length>0,"one of the values is empty");return t.reduce(((e,t)=>0===e.length?t.map((e=>[e])):t.map((t=>e.map((e=>[...e,t])))).reduce(((e,t)=>e.concat(t)),[])),[])},t.isObjectEmpty=function(e){if(null==e)throw new a.ValueError("Invalid value in obj: ".concat(JSON.stringify(e)));for(const t in e)if(e.hasOwnProperty(t))return!1;return!0},t.mapActivationToFusedKernel=function(e){if("relu"===e)return"relu";if("linear"===e)return"linear";if("elu"===e)return"elu";return null},t.numberCompare=l,t.objectListUid=function(e){const t=s(e);let n="";for(const e of t){if(null==e.id)throw new a.ValueError("Object ".concat(e," passed to objectListUid without an id"));""!==n&&(n+=", "),n="".concat(n).concat(Math.abs(e.id))}return n},t.pyListRepeat=function(e,t){if(Array.isArray(e)){let n=[];for(let r=0;r<t;r++)n=n.concat(e);return n}{const n=new Array(t);return n.fill(e),n}},t.reverseNumberCompare=function(e,t){return-1*l(e,t)},t.serializeKerasObject=function(e){if(null==e)return null;const t={};return t.className=e.getClassName(),t.config=e.getConfig(),t},t.singletonOrArray=function(e){if(1===e.length)return e[0];return e},t.stringToDType=function(e){if("float32"===e)return"float32";throw new a.ValueError("Invalid dtype: ".concat(e))},t.stringsEqual=function(e,t){if(null==e||null==t)return e===t;if(e.length!==t.length)return!1;for(let n=0;n<e.length;++n)if(e[n]!==t[n])return!1;return!0},t.toCamelCase=function(e){if(e.length<=1)return e;if(-1===e.indexOf("_"))return e;return e.replace(/[_]+(\w|$)/g,((e,t)=>
1t.toUpperCase()))},t.toList=s,t.toSnakeCase=function(e){const t=e.replace(/(.)([A-Z][a-z0-9]+)/g,"$1_$2").replace(/([a-z])([A-Z])/g,"$1_$2").toLowerCase();if("_"!==t[0])return t;return"private"+t},t.unique=function(e){if(null==e)return e;const t=[];for(const n of e)-1===t.indexOf(n)&&t.push(n);return t};var r=n(735534),a=n(608012);function o(e,t){if(!e)throw new a.AssertionError(t)}function s(e){return Array.isArray(e)?e:[e]}let i={};function c(e){if(null!=e&&"object"==typeof e)if(Array.isArray(e))e.forEach((e=>c(e)));else{const t=Object.keys(e);for(const n of t){const t=e[n];null!=t&&"object"==typeof t&&(Array.isArray(t)||"ndarray"!==t.type||"number"!=typeof t.value?c(t):e[n]=t.value)}}}function l(e,t){return e<t?-1:e>t?1:0}function u(e){return null===e?"null":Array.isArray(e)?"["+e.map((e=>u(e))).join(",")+"]":"string"==typeof e?'"'.concat(e,'"'):"".concat(e)}},785473:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.printSummary=function(e,t,n){let i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:console.log;const c=function(e){let t=!0;const n=[],r=[];for(const t in e.nodesByDepth)n.push(e.nodesByDepth[t]);for(const e of n){if(e.length>1||1===e.length&&e[0].inboundLayers.length>1){t=!1;break}r.push(...e)}if(t)for(const n of e.layers){let e=!1;for(const a of n.inboundNodes)if(-1!==r.indexOf(a)){if(e){t=!1;break}e=!0}if(!t)break}return t}(e),l=["Layer (type)","Input Shape","Output shape","Param #"];c?(t=t||90,n=n||[.32,.61,.89,1]):(t=t||115,n=n||[.24,.48,.7,.8,1]);n[n.length-1]<=1&&(n=n.map((e=>Math.floor(t*e))));let u;if(!c){l.push("Receives inputs"),u=[];for(const t in e.nodesByDepth)u.push(...e.nodesByDepth[t])}i("_".repeat(t)),a(l,n,i),i("=".repeat(t));const d=e.layers;for(let e=0;e<d.length;++e)c?o(d[e],n,i):s(d[e],n,u,i),i((e===d.length-1?"=":"_").repeat(t));e.checkTrainableWeightsConsistency();const p=function(e){let t;t=null!=e.collectedTrainableWeights?(0,r.countParamsInWeights)(e.collectedTrainableWeights):(0,r.countParamsInWeights)(e.trainableWeights);return t}(e),h=(0,r.countParamsInWeights)(e.nonTrainableWeights);i("Total params: ".concat(p+h)),i("Trainable params: ".concat(p)),i("Non-trainable params: ".concat(h)),i("_".repeat(t))};var r=n(468769);function a(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:console.log,r="";for(let n=0;n<e.length;++n)n>0&&(r=r.slice(0,r.length-1)+" "),r+=e[n],r=r.slice(0,t[n]),r+=" ".repeat(t[n]-r.length);n(r)}function o(e,t,n){let r,o;try{o=e.inboundNodes.map((e=>JSON.stringify(e.inputShapes))).join(",")}catch(e){o="multiple"}try{r=JSON.stringify(e.outputShape)}catch(e){r="multiple"}const s=e.name,i=e.getClassName();a(["".concat(s," (").concat(i,")"),o,r,e.countParams().toString()],t,n)}function s(e,t,n,r){let o,s;try{s=e.inboundNodes.map((e=>JSON.stringify(e.inputShapes))).join(",")}catch(e){s="multiple"}try{o=JSON.stringify(e.outputShape)}catch(e){o="multiple"}const i=[];for(const t of e.inboundNodes)if(!(null!=n&&n.length>0&&-1===n.indexOf(t)))for(let e=0;e<t.inboundLayers.length;++e){const n=t.inboundLayers[e].name,r=t.nodeIndices[e],a=t.tensorIndices[e];i.push("".concat(n,"[").concat(r,"][").concat(a,"]"))}const c=e.name,l=e.getClassName(),u=0===i.length?"":i[0];a(["".concat(c," (").concat(l,")"),s,o,e.countParams().toString(),u],t,r);for(let e=1;e<i.length;++e)a(["","","","",i[e]],t,r)}},302774:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.arrayProd=function(e,t,n){null==t&&(t=0);null==n&&(n=e.length);let r=1;for(let a=t;a<n;++a)r*=e[a];return r},t.isInteger=function(e){return e===parseInt(e.toString(),10)},t.max=function(e){if(0===e.length)return Number.NaN;let t=Number.NEGATIVE_INFINITY;for(let n=0;n<e.length;n++){const r=e[n];r>t&&(t=r)}return t},t.mean=o,t.median=function(e){const t=e.slice().sort(((e,t)=>e-t)),n=Math.floor((t.length-1)/2),r=Math.ceil((t.length-1)/2);if(n===r)return t[n];return(t[n]+t[r])/2},t.min=function(e){if(0===e.length)return Number.NaN;let t=Number.POSITIVE_INFINITY;for(let n=0;n<e.length;n++){const r=e[n];r<t&&(t=r)}return t},t.range=function(e,t){if(t<e)throw new r.ValueError("end (".concat(t,") < begin (").concat(e,") is forbidden."));const n=[];for(let r=e;r<t;++r)n.push(r);return n},t.sum=a,t.variance=function(e){const t=o(e),n=e.map((e=>e-t));let r=0;for(let e=0;e<n.length;e++){const t=n[e];r+=t*t}return r/e.length};var r=n(608012);function a(e){let t=0;for(let n=0;n<e.length;n++){t+=e[n]}return t}function o(e){return a(e)/e.length}},290407:(e,t,n)=>{"use strict";
1Object.defineProperty(t,"__esModule",{value:!0}),t.convertPythonicToTs=function e(t,n){if(null===t)return null;if("string"==typeof t)return r.toCamelCase(t);if("number"==typeof t||"boolean"==typeof t)return t;if(t instanceof Array){const r=[],a=t.length;for(let s=0;s<a;++s){const a=t[s];o(n,s,a)?r.push(a):r.push(e(a,n))}return r}{const n={};for(const a of Object.keys(t)){const o=t[a];if("name"===a&&"string"==typeof o)n[a]=o;else{const t=r.toCamelCase(a);n[t]=e(o,t)}}return n}},t.convertTsToPythonic=function e(t,n){if(null==t)return null;if("string"==typeof t)return r.toSnakeCase(t);if("number"==typeof t||"boolean"==typeof t)return t;if(t instanceof Array){const r=[],a=t.length;for(let s=0;s<a;++s){const a=t[s];o(n,s,a)?r.push(a):r.push(e(a,n))}return r}{const n={};for(const a of Object.keys(t)){const o=t[a],s=r.toSnakeCase(a);n[s]="name"!==a&&"className"!==a||"string"!=typeof o?e(o,a):o}return n}};var r=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=a(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var s in e)if("default"!==s&&{}.hasOwnProperty.call(e,s)){var i=o?Object.getOwnPropertyDescriptor(e,s):null;i&&(i.get||i.set)?Object.defineProperty(r,s,i):r[s]=e[s]}return r.default=e,n&&n.set(e,r),r}(n(986904));function a(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(a=function(e){return e?n:t})(e)}function o(e,t,n){return("inboundNodes"===e||"outputLayers"===e||"inputLayers"===e)&&0===t&&"string"==typeof n}},252518:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getExactlyOneShape=function(e){if(Array.isArray(e)&&Array.isArray(e[0])){if(1===e.length)return e[0];throw new r.ValueError("Expected exactly 1 Shape; got ".concat(e.length))}return e},t.getExactlyOneTensor=function(e){let t;if(Array.isArray(e)){if(1!==e.length)throw new r.ValueError("Expected Tensor length to be 1; got ".concat(e.length));t=e[0]}else t=e;return t},t.isArrayOfShapes=function(e){return Array.isArray(e)&&Array.isArray(e[0])},t.normalizeShapeList=function(e){if(0===e.length)return[];if(!Array.isArray(e[0]))return[e];return e};var r=n(608012)},468769:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.countParamsInWeights=function(e){let t=0;for(const n of e)0===n.shape.length?t+=1:t+=n.shape.reduce(((e,t)=>e*t));return t}},268778:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.LayerVariable=void 0,t.batchGetValue=function(e){return e.map((e=>e.read()))},t.batchSetValue=function(e){e.forEach((e=>{e[0].write(e[1])}))},t.eyeVariable=function(e,t,n){return new u(a.eye(e),t,n)},t.gradients=function(e,t){const n=t.map((e=>e.read())),a=(0,r.variableGrads)(e,n);return t.map((e=>a.grads[e.name]))},t.onesLike=function(e,t,n){const r=a.onesLike(e);return new u(r,t,n)},t.onesVariable=function(e,t,n){const r=a.ones(e);return new u(r,t,n)},t.randomNormalVariable=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,r=arguments.length>3?arguments[3]:void 0,o=arguments.length>4?arguments[4]:void 0,s=arguments.length>5&&void 0!==arguments[5]?arguments[5]:"randomNormal";if(r=r||"float32","float32"!==r&&"int32"!==r)throw new i.NotImplementedError("randomNormalVariable does not support dType ".concat(r,"."));return new u(a.randomNormal(e,t,n,r,o),r,s)},t.randomUniformVariable=function(e,t,n,r,o){let s=arguments.length>5&&void 0!==arguments[5]?arguments[5]:"randomUniform";return new u(a.randomUniform(e,t,n,r),r,s)},t.truncatedNormalVariable=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,r=arguments.length>3?arguments[3]:void 0,o=arguments.length>4?arguments[4]:void 0,s=arguments.length>5&&void 0!==arguments[5]?arguments[5]:"truncatedNormal";if(r=r||"float32","float32"!==r&&"int32"!==r)throw new i.NotImplementedError("randomNormal does not support dType ".concat(r,"."));return new u(a.truncatedNormal(e,t,n,r,o),r,s)},t.update=function(e,t){return e.write(t)},t.updateAdd=function(e,t){return e.write(a.add(e.read(),t))},t.updateSub=function(e,t){return e.write(a.sub(e.read(),t))},t.variable=function(e,t,n,r){return new u(e,t,n,!0,r)},t.zerosLike=function(e,t,n){return new u(a.zerosLike(e),t,n)},t.zerosVariable=function(e,t,n){return new u(a.zeros(e),t,n)};
1var r=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=c(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if("default"!==o&&{}.hasOwnProperty.call(e,o)){var s=a?Object.getOwnPropertyDescriptor(e,o):null;s&&(s.get||s.set)?Object.defineProperty(r,o,s):r[o]=e[o]}return r.default=e,n&&n.set(e,r),r}(n(735534)),a=r,o=n(284986),s=n(545188),i=n(608012);function c(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(c=function(e){return e?n:t})(e)}const l="Variable";class u{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"float32",n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:l,r=!(arguments.length>3&&void 0!==arguments[3])||arguments[3],i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null;this.dtype=null==t?"float32":t,this.shape=e.shape,this.id=(0,o.getNextUniqueTensorId)(),n=null==n?l:n,this.originalName=(0,s.getScopedTensorName)(n),this.name=(0,s.getUniqueTensorName)(this.originalName),this.trainable_=r,this.constraint=i,this.val=a.variable(e,this.trainable_,this.name,this.dtype)}read(){return this.assertNotDisposed(),this.val}write(e){return this.assertNotDisposed(),function(e,t){if(e.shape.toString()!==t.shape.toString())throw new Error("Shape mismatch: "+JSON.stringify(e.shape)+" vs. "+JSON.stringify(t.shape))}(this.val,e),this.val.id!==e.id&&(this.val.assign(e),null!=this.constraint&&this.val.assign(this.constraint.apply(this.val))),this}dispose(){this.assertNotDisposed(),this.val.dispose()}assertNotDisposed(){if(this.val.isDisposed)throw new Error("LayersVariable ".concat(this.name," is already disposed."))}get trainable(){return this.trainable_}set trainable(e){this.trainable_=e,this.val.trainable=e}}t.LayerVariable=u},480036:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.version=void 0;t.version="3.14.0"},843081:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r={version:!0,data:!0};t.version=t.data=void 0;var a=n(735534);Object.keys(a).forEach((function(e){"default"!==e&&"__esModule"!==e&&(Object.prototype.hasOwnProperty.call(r,e)||e in t&&t[e]===a[e]||Object.defineProperty(t,e,{enumerable:!0,get:function(){return a[e]}}))})),n(288462),n(251251);var o=n(268655);Object.keys(o).forEach((function(e){"default"!==e&&"__esModule"!==e&&(Object.prototype.hasOwnProperty.call(r,e)||e in t&&t[e]===o[e]||Object.defineProperty(t,e,{enumerable:!0,get:function(){return o[e]}}))}));var s=n(431894);Object.keys(s).forEach((function(e){"default"!==e&&"__esModule"!==e&&(Object.prototype.hasOwnProperty.call(r,e)||e in t&&t[e]===s[e]||Object.defineProperty(t,e,{enumerable:!0,get:function(){return s[e]}}))}));var i=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=d(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if("default"!==o&&{}.hasOwnProperty.call(e,o)){var s=a?Object.getOwnPropertyDescriptor(e,o):null;s&&(s.get||s.set)?Object.defineProperty(r,o,s):r[o]=e[o]}return r.default=e,n&&n.set(e,r),r}(n(8776));t.data=i;var c=n(83381),l=n(346999),u=n(484887);function d(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(d=function(e){return e?n:t})(e)}t.version={"tfjs-core":a.version_core,"tfjs-backend-cpu":c.version_cpu,"tfjs-backend-webgl":l.version_webgl,"tfjs-data":i.version_data,"tfjs-layers":o.version_layers,"tfjs-converter":s.version_converter,tfjs:u.version}},484887:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.version=void 0;t.version="3.14.0"},931841:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Dataset=void 0,t.array=function(e){return u((async()=>(0,o.iteratorFromItems)(e)),e.length)},t.datasetFromIteratorFn=u,t.zip=function(e){if(!(0,s.isIterable)(e))throw new Error("The argument to zip() must be an object or array.");let t;if(Array.isArray(e))for(let n=0;n<e.length;n++)t=null==t?e[n].size:Math.min(t,e[n].size);else if(e instanceof Object)for(const n in e)t=null==t?e[n].size:Math.min(t,e[n].size);return u((async()=>{const t=await(0,s.deepMapAndAwaitAll)(e,(e=>{if(e instanceof l)return{value:e.iterator(),recurse:!1};if((0,s.isIterable)(e))return{value:null,recurse:!0};throw new Error("Leaves of the structure passed to zip() must be Datasets, not primitives.")}));return(0,o.iteratorFromZipped)(t,o.ZipMismatchMode.SHORTEST)}),t)};var r=c(n(735534)),a=c(n(236377)),o=n(162969),s=n(881638);function i(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(i=function(e){return e?n:t})(e)}
1function c(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=i(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if("default"!==o&&{}.hasOwnProperty.call(e,o)){var s=a?Object.getOwnPropertyDescriptor(e,o):null;s&&(s.get||s.set)?Object.defineProperty(r,o,s):r[o]=e[o]}return r.default=e,n&&n.set(e,r),r}class l{constructor(){this.size=null}batch(e){let t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];const n=this;let a;return r.util.assert(e>0,(()=>"batchSize needs to be positive, but it is\n ".concat(e))),a=this.size===1/0||null==this.size?this.size:t?Math.ceil(this.size/e):Math.floor(this.size/e),u((async()=>(await n.iterator()).columnMajorBatch(e,t,d)),a)}concatenate(e){const t=this;let n;return n=this.size===1/0||e.size===1/0?1/0:null!=this.size&&null!=e.size?this.size+e.size:null,u((async()=>(await t.iterator()).concatenate(await e.iterator())),n)}filter(e){const t=this;let n;return n=this.size===1/0?1/0:null,u((async()=>(await t.iterator()).filter((t=>r.tidy((()=>e(t)))))),n)}async forEachAsync(e){return(await this.iterator()).forEachAsync(e)}map(e){const t=this;return u((async()=>(await t.iterator()).map((t=>r.tidy((()=>e(t)))))),this.size)}mapAsync(e){const t=this;return u((async()=>(await t.iterator()).mapAsync(e)),this.size)}prefetch(e){if(null==e)throw new RangeError("`Dataset.prefetch()` requires bufferSize to be specified.");const t=this;return u((async()=>(await t.iterator()).prefetch(e)),this.size)}repeat(e){const t=this;let n;return n=null!=this.size&&e>0?this.size*e:0===e?0:null!=this.size&&(void 0===e||e<0)?1/0:null,u((async()=>{const n=(0,o.iteratorFromFunction)((async()=>({value:await t.iterator(),done:!1})));return(0,o.iteratorFromConcatenated)(n.take(e))}),n)}skip(e){const t=this;let n;return n=null!=this.size&&e>=0&&this.size>=e?this.size-e:null!=this.size&&(this.size<e||void 0===e||e<0)?0:null,u((async()=>(await t.iterator()).skip(e)),n)}shuffle(e,t){let n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];if(null==e||e<0)throw null==this.size?new RangeError("`Dataset.shuffle()` requires bufferSize to be specified."):new RangeError("`Dataset.shuffle()` requires bufferSize to be specified. If your data fits in main memory (for regular JS objects), and/or GPU memory (for `tf.Tensor`s), consider setting "+"bufferSize to the dataset size (".concat(this.size," elements)"));const o=this,s=a.alea(t||r.util.now().toString());return u((async()=>{let t=s.int32();return n&&(t+=s.int32()),(await o.iterator()).shuffle(e,t.toString())}),this.size)}take(e){const t=this;let n;return n=null!=this.size&&this.size>e?e:null!=this.size&&this.size<=e?this.size:null,u((async()=>(await t.iterator()).take(e)),n)}async toArray(){if(this.size===1/0)throw new Error("Can not convert infinite data stream to array.");return(await this.iterator()).toArray()}async toArrayForTest(){if(this.size===1/0)throw new Error("Can not convert infinite data stream to array.");return(await this.iterator()).toArrayForTest()}}function u(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return new class extends l{constructor(){super(...arguments),this.size=t}async iterator(){return e()}}}function d(e){if(null===e)return null;const t=e[0];if((0,s.canTensorify)(t)){return{value:function(e){if(0===e.length)throw new Error("Can't make a batch of zero elements.");return e[0]instanceof r.Tensor?r.stack(e):r.tensor(e)}(e),recurse:!1}}return{value:null,recurse:!0}}t.Dataset=l,l.MAX_BUFFER_SIZE=1e4},176100:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.CSVDataset=void 0;var r=n(735534),a=n(931841),o=n(13369);const s='"',i=Symbol("out"),c=Symbol("field"),l=Symbol("quote"),u=Symbol("quoteafterquote"),d=Symbol("quoteinquote");class p extends a.Dataset{constructor(e,t){super(),this.input=e,this.hasHeader=!0,this.fullColumnNames=null,this.columnNamesValidated=!1,this.columnConfigs=null,this.configuredColumnsOnly=!1,this.delimiter=",",this.delimWhitespace=!1,this.base=new o.TextLineDataset(e),t||(t={}),this.hasHeader=!1!==t.hasHeader,this.fullColumnNames=t.columnNames,this.columnConfigs=t.columnConfigs,this.configuredColumnsOnly=t.configuredColumnsOnly,t.delimWhitespace?(r.util.assert(null==t.delimiter,(()=>"Delimiter should not be provided when delimWhitespace is true.")),this.delimWhitespace=!0,this.delimiter=" "):this.delimiter=t.delimiter?t.delimiter:","}async columnNames(){return this.columnNamesValidated||await this.setColumnNames(),this.configuredColumnsOnly?Object.keys(this.columnConfigs):this.fullColumnNames}async setColumnNames(){const e=await this.maybeReadHeaderLine();if(!this.fullColumnNames&&!e)throw new Error("Column names must be provided if there is no header line.");this.fullColumnNames&&e&&r.util.assert(e.length===this.fullColumnNames.length,(()=>"The length of provided columnNames ("+this.fullColumnNames.length.toString()+") does not match the length of the header line read from file ("+e.length.toString()+").")),this.fullColumnNames||(this.fullColumnNames=e);const t=this.fullColumnNames.reduce(((e,t)=>(e[t]=e[t]+1||1,e)),{}),n=Object.keys(t).filter((e=>t[e]>1));if(r.util.assert(0===n.length,(()=>"Duplicate column names found: "+n.toString())),this.columnConfigs)for(const e of Object.keys(this.columnConfigs)){if(-1===this.fullColumnNames.indexOf(e))throw new Error('The key "'+e+'" provided in columnConfigs does not match any of the column names ('+this.fullColumnNames.toString()+").")}this.columnNamesValidated=!0}async maybeReadHeaderLine(){if(this.hasHeader){const e=await this.base.iterator(),t=await e.next();if(t.done)throw new Error("No data was found for CSV parsing.");const n=t.value;return this.parseRow(n,!1)}return null}async iterator(){this.columnNamesValidated||await this.setColumnNames();let e=await this.base.iterator();return this.hasHeader&&(e=e.skip(1)),e.map((e=>this.makeDataElement(e)))}makeDataElement(e){const t=this.parseRow(e),n={},r={};for(let a=0;a<this.fullColumnNames.length;a++){const o=this.fullColumnNames[a],s=this.columnConfigs?this.columnConfigs[o]:null;if(!this.configuredColumnsOnly||s){const i=t[a];let c=null;if(""===i)if(s&&void 0!==s.default)c=s.default;else{if(s&&(s.required||s.isLabel))throw new Error("Required column ".concat(o," is empty in this line: ").concat(e));c=void 0}else{const e=Number(i);if(isNaN(e))c=s&&"bool"===s.dtype?this.getBoolean(i):i;else if(s&&s.dtype)switch(s.dtype){case"float32":default:c=e;break;case"int32":c=Math.floor(e);break;case"bool":c=this.getBoolean(i)}else c=e}s&&s.isLabel?r[o]=c:n[o]=c}}return 0===Object.keys(r).length?n:{xs:n,ys:r}}getBoolean(e){return"1"===e||"true"===e.toLowerCase()?1:0}parseRow(e){let t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];const n=[];let r=0;const a=e.length;let o=i;for(let t=0;t<a;t++)switch(o){case i:switch(e.charAt(t)){case s:r=t+1,o=l;break;case this.delimiter:if(r=t+1," "===this.delimiter&&this.delimWhitespace)break;n.push(""),o=i;break;default:o=c,r=t}break;case c:if(e.charAt(t)===this.delimiter)n.push(e.substring(r,t)),o=i,r=t+1;break;case l:if(e.charAt(t)===s)o=u;break;case u:switch(e.charAt(t)){case this.delimiter:n.push(e.substring(r,t-1)),o=i,r=t+1;break;case s:o=l;break;default:o=d}break;case d:if(e.charAt(t)===s)o=l}if(o===u?n.push(e.substring(r,a-1)):n.push(e.substring(r)),t&&n.length!==this.fullColumnNames.length)throw new Error("Invalid row in csv file. Should have ".concat(this.fullColumnNames.length," elements in a row, but got ").concat(n));return n}}t.CSVDataset=p},13369:(e,t,n)=>{"use strict";
1Object.defineProperty(t,"__esModule",{value:!0}),t.TextLineDataset=void 0;var r=n(931841);class a extends r.Dataset{constructor(e){super(),this.input=e}async iterator(){return(await this.input.iterator()).decodeUTF8().split("\n").map((e=>(e.endsWith("\r")&&(e=e.slice(0,-1)),e)))}}t.TextLineDataset=a},147478:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.DataSource=void 0;t.DataSource=class{}},8776:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"CSVDataset",{enumerable:!0,get:function(){return a.CSVDataset}}),Object.defineProperty(t,"Dataset",{enumerable:!0,get:function(){return r.Dataset}}),Object.defineProperty(t,"FileDataSource",{enumerable:!0,get:function(){return i.FileDataSource}}),Object.defineProperty(t,"TextLineDataset",{enumerable:!0,get:function(){return o.TextLineDataset}}),Object.defineProperty(t,"URLDataSource",{enumerable:!0,get:function(){return c.URLDataSource}}),Object.defineProperty(t,"array",{enumerable:!0,get:function(){return r.array}}),Object.defineProperty(t,"csv",{enumerable:!0,get:function(){return s.csv}}),Object.defineProperty(t,"func",{enumerable:!0,get:function(){return s.func}}),Object.defineProperty(t,"generator",{enumerable:!0,get:function(){return s.generator}}),Object.defineProperty(t,"microphone",{enumerable:!0,get:function(){return s.microphone}}),Object.defineProperty(t,"version_data",{enumerable:!0,get:function(){return l.version}}),Object.defineProperty(t,"webcam",{enumerable:!0,get:function(){return s.webcam}}),Object.defineProperty(t,"zip",{enumerable:!0,get:function(){return r.zip}});var r=n(931841),a=n(176100),o=n(13369),s=n(760124),i=n(289826),c=n(478113),l=n(712209)},540167:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ByteChunkIterator=void 0;var r=n(735534),a=n(162969),o=n(221402);class s extends a.LazyIterator{decodeUTF8(){return new i(this)}}t.ByteChunkIterator=s;class i extends o.StringIterator{constructor(e){super(),this.upstream=e,this.impl=new c(e)}summary(){return this.impl.summary()}async next(){return this.impl.next()}}class c extends a.OneToManyIterator{constructor(e){if(super(),this.upstream=e,(0,r.env)().get("IS_BROWSER"))this.decoder=new TextDecoder("utf-8");else{const{StringDecoder:e}=n(186759);this.decoder=new e("utf8")}}summary(){return"".concat(this.upstream.summary()," -> Utf8")}async pump(){const e=await this.upstream.next();let t,n;return!e.done&&(t=e.value,n=(0,r.env)().get("IS_BROWSER")?this.decoder.decode(t,{stream:!0}):this.decoder.write(Buffer.from(t.buffer)),this.outputQueue.push(n),!0)}}},176290:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.FileChunkIterator=void 0;var r=n(735534),a=n(540167);class o extends a.ByteChunkIterator{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};super(),this.file=e,this.options=t,r.util.assert(e instanceof Uint8Array||!!(0,r.env)().get("IS_BROWSER")&&(e instanceof File||e instanceof Blob),(()=>"FileChunkIterator only supports File, Blob and Uint8Array right now.")),this.offset=t.offset||0,this.chunkSize=t.chunkSize||1048576}summary(){return"FileChunks ".concat(this.file)}async next(){if(this.offset>=(this.file instanceof Uint8Array?this.file.byteLength:this.file.size))return{value:null,done:!0};const e=new Promise(((e,t)=>{const n=this.offset+this.chunkSize;if(this.file instanceof Uint8Array)e(new Uint8Array(this.file.slice(this.offset,n)));else{const r=new FileReader;r.onload=n=>{let a=r.result;if(a instanceof ArrayBuffer&&(a=new Uint8Array(a)),!(a instanceof Uint8Array))return t(new TypeError("FileReader returned unknown type."));e(a)},r.onabort=e=>t(new Error("Aborted")),r.onerror=e=>t(new Error(e.type));const a=this.file.slice(this.offset,n);r.readAsArrayBuffer(a)}this.offset=n}));return{value:await e,done:!1}}}t.FileChunkIterator=o},162969:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ZipMismatchMode=t.ShuffleIterator=t.PrefetchIterator=t.OneToManyIterator=t.LazyIterator=t.ChainedIterator=void 0,t.iteratorFromConcatenated=f,t.iteratorFromConcatenatedFunction=function(e,t,n){return f(h(e).take(t),n)},t.iteratorFromFunction=h,t.iteratorFromIncrementing=function(e){let t=e;return h((()=>({value:t++,done:!1})))},t.iteratorFromItems=p,t.iteratorFromZipped=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:r.FAIL;return new T(e,t)};var r,a=d(n(735534)),o=d(n(236377)),s=n(426830),i=n(881638),c=n(614472),l=n(3013);function u(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(u=function(e){return e?n:t})(e)}
1function d(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=u(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if("default"!==o&&{}.hasOwnProperty.call(e,o)){var s=a?Object.getOwnPropertyDescriptor(e,o):null;s&&(s.get||s.set)?Object.defineProperty(r,o,s):r[o]=e[o]}return r.default=e,n&&n.set(e,r),r}function p(e){return new g(e)}function h(e){return new y(e)}function f(e,t){return new I(e,t)}class m{async toArray(){const e=[];let t=await this.next();for(;!t.done;)e.push(t.value),t=await this.next();return e}async toArrayForTest(){const e=this.prefetch(100),t=[];let n=await e.next();for(;!n.done;)t.push(n.value),n=await e.next();return t}async resolveFully(){let e=await this.next();for(;!e.done;)e=await this.next()}async resolveWhile(e){let t=await this.next(),n=e(t.value);for(;!t.done&&n;)t=await this.next(),n=e(t.value)}handleErrors(e){return new C(this,e)}filter(e){return new k(this,e)}map(e){return new _(this,e)}mapAsync(e){return new P(this,e)}serialMapAsync(e){return new P(this,e).serial()}flatmap(e){return new N(this,e)}async forEachAsync(e){return this.map(e).resolveFully()}async serialForEach(e){return this.serialMapAsync(e).resolveWhile((e=>!0===e))}rowMajorBatch(e){return new w(this,e,!(arguments.length>1&&void 0!==arguments[1])||arguments[1])}columnMajorBatch(e){let t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:i.zipToList;return this.rowMajorBatch(e,t).map((e=>(0,i.deepZip)(e,n)))}concatenate(e,t){return new I(p([this,e]),t)}take(e){return e<0||null==e?this:new x(this,e)}skip(e){return e<0||null==e?this:new b(this,e)}prefetch(e){return new S(this,e)}shuffle(e,t){return new E(this,e,t)}serial(){return new v(this)}}t.LazyIterator=m;class g extends m{constructor(e){super(),this.items=e,this.trav=0}summary(){return"Array of ".concat(this.items.length," items")}async next(){if(this.trav>=this.items.length)return{value:null,done:!0};const e=this.items[this.trav];return this.trav++,{value:(0,s.deepClone)(e),done:!1}}}class y extends m{constructor(e){super(),this.nextFn=e}summary(){return"Function call"}async next(){try{return this.nextFn()}catch(e){throw e.message="Error thrown while iterating through a dataset: ".concat(e.message),e}}}class v extends m{constructor(e){super(),this.upstream=e,this.lastRead=Promise.resolve({value:null,done:!1})}summary(){return"".concat(this.upstream.summary()," -> Serial")}async next(){return this.lastRead=this.lastRead.then((()=>this.serialNext())),this.lastRead}async serialNext(){return this.upstream.next()}}class b extends m{constructor(e,t){super(),this.upstream=e,this.maxCount=t,this.count=0,this.lastRead=Promise.resolve({value:null,done:!1})}summary(){return"".concat(this.upstream.summary()," -> Skip")}async next(){return this.lastRead=this.lastRead.then((()=>this.serialNext())),this.lastRead}async serialNext(){for(;this.count++<this.maxCount;){const e=await this.upstream.next();if(e.done)return e;a.dispose(e.value)}return this.upstream.next()}}class x extends m{constructor(e,t){super(),this.upstream=e,this.maxCount=t,this.count=0}summary(){return"".concat(this.upstream.summary()," -> Take")}async next(){return this.count++>=this.maxCount?{value:null,done:!0}:this.upstream.next()}}class w extends m{constructor(e,t){let n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];super(),this.upstream=e,this.batchSize=t,this.enableSmallLastBatch=n,this.lastRead=Promise.resolve({value:null,done:!1})}summary(){return"".concat(this.upstream.summary()," -> RowMajorBatch")}async next(){return this.lastRead=this.lastRead.then((()=>this.serialNext())),this.lastRead}async serialNext(){const e=[];for(;e.length<this.batchSize;){const t=await this.upstream.next();if(t.done)return this.enableSmallLastBatch&&e.length>0?{value:e,done:!1}:{value:null,done:!0};e.push(t.value)}return{value:e,done:!1}}}class k extends m{constructor(e,t){super(),this.upstream=e,this.predicate=t,this.lastRead=Promise.resolve({value:null,done:!1})}summary(){return"".concat(this.upstream.summary()," -> Filter")}async next(){return this.lastRead=this.lastRead.then((()=>this.serialNext())),this.lastRead}async serialNext(){for(;;){const e=await this.upstream.next();if(e.done||this.predicate(e.value))return e;a.dispose(e.value)}}}class _ extends m{constructor(e,t){super(),this.upstream=e,this.transform=t}summary(){return"".concat(this.upstream.summary()," -> Map")}async next(){const e=await this.upstream.next();if(e.done)return{value:null,done:!0};const t=a.tensor_util.getTensorsInContainer(e.value),n=this.transform(e.value),r=a.tensor_util.getTensorsInContainer(n);for(const e of t)a.tensor_util.isTensorInList(e,r)||e.dispose();return{value:n,done:!1}}}class C extends m{constructor(e,t){super(),this.upstream=e,this.handler=t,this.count=0,this.lastRead=Promise.resolve({value:null,done:!1})}summary(){return"".concat(this.upstream.summary()," -> handleErrors")}async next(){return this.lastRead=this.lastRead.then((()=>this.serialNext())),this.lastRead}async serialNext(){for(;;)try{return await this.upstream.next()}catch(e){if(!this.handler(e))return{value:null,done:!0}}}}class P extends m{constructor(e,t){super(),this.upstream=e,this.transform=t}summary(){return"".concat(this.upstream.summary()," -> AsyncMap")}async next(){const e=await this.upstream.next();if(e.done)return{value:null,done:!0};const t=a.tensor_util.getTensorsInContainer(e.value),n=await this.transform(e.value),r=a.tensor_util.getTensorsInContainer(n);for(const e of t)a.tensor_util.isTensorInList(e,r)||e.dispose();return{value:n,done:!1}}}class O extends m{constructor(){super(),this.outputQueue=new c.GrowingRingBuffer,this.lastRead=Promise.resolve({value:null,done:!1})}async next(){return this.lastRead=this.lastRead.then((()=>this.serialNext())),this.lastRead}async serialNext(){for(;0===this.outputQueue.length();)if(!await this.pump())return{value:null,done:!0};return{value:this.outputQueue.shift(),done:!1}}}t.OneToManyIterator=O;class N extends O{constructor(e,t){super(),this.upstream=e,this.transform=t}summary(){return"".concat(this.upstream.summary()," -> Flatmap")}async pump(){const e=await this.upstream.next();if(e.done)return!1;const t=a.tensor_util.getTensorsInContainer(e.value),n=this.transform(e.value),r=a.tensor_util.getTensorsInContainer(n);this.outputQueue.pushAll(n);for(const e of t)a.tensor_util.isTensorInList(e,r)||e.dispose();return!0}}class I extends m{constructor(e,t){super(),this.baseErrorHandler=t,this.lastRead=null,this.iterator=null,this.moreIterators=e}summary(){return"".concat("TODO: fill in upstream of chained summaries"," -> Chained")}async next(){return this.lastRead=this.readFromChain(this.lastRead),this.lastRead}async readFromChain(e){if(await e,null==this.iterator){const e=await this.moreIterators.next();if(e.done)return{value:null,done:!0};this.iterator=e.value,null!=this.baseErrorHandler&&(this.iterator=this.iterator.handleErrors(this.baseErrorHandler))}const t=await this.iterator.next();return t.done?(this.iterator=null,this.readFromChain(e)):t}}
1t.ChainedIterator=I,function(e){e[e.FAIL=0]="FAIL",e[e.SHORTEST=1]="SHORTEST",e[e.LONGEST=2]="LONGEST"}(r||(t.ZipMismatchMode=r={}));class T extends m{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:r.FAIL;super(),this.iterators=e,this.mismatchMode=t,this.count=0,this.currentPromise=null}summary(){return"{".concat("TODO: fill in upstream of zip summaries","} -> Zip")}async nextState(e){await e;let t=0,n=0;const a=await(0,i.deepMapAndAwaitAll)(this.iterators,(function(e){if(e instanceof m){return{value:e.next().then((e=>(t++,e.done&&n++,e.value))),recurse:!1}}return{value:null,recurse:!0}}));if(t===n)return{value:null,done:!0};if(n>0)switch(this.mismatchMode){case r.FAIL:throw new Error("Zipped streams should have the same length. "+"Mismatched at element ".concat(this.count,"."));case r.SHORTEST:return{value:null,done:!0};case r.LONGEST:}return this.count++,{value:a,done:!1}}async next(){return this.currentPromise=this.nextState(this.currentPromise),this.currentPromise}}class S extends m{constructor(e,t){super(),this.upstream=e,this.bufferSize=t,this.buffer=new l.RingBuffer(t)}summary(){return"".concat(this.upstream.summary()," -> Prefetch")}refill(){for(;!this.buffer.isFull();){const e=this.upstream.next();this.buffer.push(e)}}next(){return this.refill(),this.buffer.shift()}}t.PrefetchIterator=S;class E extends S{constructor(e,t,n){super(e,t),this.upstream=e,this.windowSize=t,this.upstreamExhausted=!1,this.random=o.alea(n||a.util.now().toString()),this.lastRead=Promise.resolve({value:null,done:!1})}async next(){return this.lastRead=this.lastRead.then((()=>this.serialNext())),this.lastRead}randomInt(e){return Math.floor(this.random()*e)}chooseIndex(){return this.randomInt(this.buffer.length())}async serialNext(){for(this.upstreamExhausted||this.refill();!this.buffer.isEmpty();){const e=this.chooseIndex(),t=await this.buffer.shuffleExcise(e);if(!t.done)return this.refill(),t;this.upstreamExhausted=!0}return{value:null,done:!0}}}t.ShuffleIterator=E},373389:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.MicrophoneIterator=void 0;var r=n(735534),a=n(162969);class o extends a.LazyIterator{constructor(e){super(),this.microphoneConfig=e,this.isClosed=!1,this.fftSize=e.fftSize||1024;const t=Math.log2(this.fftSize);if(this.fftSize<0||t<4||t>14||!Number.isInteger(t))throw new Error("Invalid fftSize: it must be a power of 2 between "+"2 to 4 and 2 to 14, but got ".concat(this.fftSize));if(this.numFrames=e.numFramesPerSpectrogram||43,this.sampleRateHz=e.sampleRateHz,this.columnTruncateLength=e.columnTruncateLength||this.fftSize,this.audioTrackConstraints=e.audioTrackConstraints,this.smoothingTimeConstant=e.smoothingTimeConstant||0,this.includeSpectrogram=!1!==e.includeSpectrogram,this.includeWaveform=!0===e.includeWaveform,!this.includeSpectrogram&&!this.includeWaveform)throw new Error("Both includeSpectrogram and includeWaveform are false. At least one type of data should be returned.")}summary(){return"microphone"}static async create(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if((0,r.env)().get("IS_NODE"))throw new Error("microphone API is only supported in browser environment.");const t=new o(e);return await t.start(),t}async start(){try{this.stream=await navigator.mediaDevices.getUserMedia({audio:null==this.audioTrackConstraints||this.audioTrackConstraints,video:!1})}catch(e){throw new Error("Error thrown while initializing video stream: ".concat(e.message))}if(!this.stream)throw new Error("Could not obtain audio from microphone.");const e=window.AudioContext||window.webkitAudioContext;if(this.audioContext=new e,this.sampleRateHz){if(this.audioContext.sampleRate!==this.sampleRateHz)throw new Error("Mismatch in sampling rate: "+"Expected: ".concat(this.sampleRateHz,"; ")+"Actual: ".concat(this.audioContext.sampleRate))}else this.sampleRateHz=this.audioContext.sampleRate;const t=this.audioContext.createMediaStreamSource(this.stream);this.analyser=this.audioContext.createAnalyser(),this.analyser.fftSize=2*this.fftSize,this.analyser.smoothingTimeConstant=this.smoothingTimeConstant,t.connect(this.analyser),this.freqData=new Float32Array(this.fftSize),this.timeData=new Float32Array(this.fftSize)}async next(){if(this.isClosed)return{value:null,done:!0};let e,t;const n=await this.getAudioData();if(this.includeSpectrogram){const t=this.flattenQueue(n.freqDataQueue);e=this.getTensorFromAudioDataArray(t,[this.numFrames,this.columnTruncateLength,1])}if(this.includeWaveform){const e=this.flattenQueue(n.timeDataQueue);t=this.getTensorFromAudioDataArray(e,[this.numFrames*this.fftSize,1])}return{value:{spectrogram:e,waveform:t},done:!1}}async capture(){return(await this.next()).value}async getAudioData(){const e=[],t=[];let n=0;return new Promise((r=>{const a=setInterval((()=>{this.includeSpectrogram&&(this.analyser.getFloatFrequencyData(this.freqData),this.freqData[0]===-1/0&&r({freqDataQueue:e,timeDataQueue:t}),e.push(this.freqData.slice(0,this.columnTruncateLength))),this.includeWaveform&&(this.analyser.getFloatTimeDomainData(this.timeData),t.push(this.timeData.slice())),++n===this.numFrames&&(clearInterval(a),r({freqDataQueue:e,timeDataQueue:t}))}),this.fftSize/this.sampleRateHz*1e3)}))}stop(){this.isClosed||(this.isClosed=!0,this.analyser.disconnect(),this.audioContext.close(),null!=this.stream&&this.stream.getTracks().length>0&&this.stream.getTracks()[0].stop())}toArray(){throw new Error("Can not convert infinite audio stream to array.")}getSampleRate(){return this.sampleRateHz}flattenQueue(e){const t=e[0].length,n=new Float32Array(e.length*t);return e.forEach(((e,r)=>n.set(e,r*t))),n}getTensorFromAudioDataArray(e,t){const n=new Float32Array(r.util.sizeFromShape(t));return n.set(e,n.length-e.length),(0,r.tensor)(n,t)}}t.MicrophoneIterator=o}
1,221402:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.StringIterator=void 0;var r=n(162969);class a extends r.LazyIterator{split(e){return new o(this,e)}}t.StringIterator=a;class o extends a{constructor(e,t){super(),this.upstream=e,this.impl=new s(e,t)}summary(){return this.impl.summary()}async next(){return this.impl.next()}}class s extends r.OneToManyIterator{constructor(e,t){super(),this.upstream=e,this.separator=t,this.carryover=""}summary(){return"".concat(this.upstream.summary()," -> Split('").concat(this.separator,"')")}async pump(){const e=await this.upstream.next();if(e.done)return""!==this.carryover&&(this.outputQueue.push(this.carryover),this.carryover="",!0);const t=e.value.split(this.separator);t[0]=this.carryover+t[0];for(const e of t.slice(0,-1))this.outputQueue.push(e);return this.carryover=t[t.length-1],!0}}},234752:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.urlChunkIterator=async function(e){let t,n,s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=arguments.length>2?arguments[2]:void 0;"string"==typeof e?t=e:(t=e.url,n=o(e));const c=await(i||r.util.fetch)(t,n);if(c.ok){const e=new Uint8Array(await c.arrayBuffer());return new a.FileChunkIterator(e,s)}throw new Error(c.statusText)};var r=n(735534),a=n(176290);const o=e=>({method:e.method,headers:e.headers,body:e.body,mode:e.mode,credentials:e.credentials,cache:e.cache,redirect:e.redirect,referrer:e.referrer,integrity:e.integrity})},459345:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.WebcamIterator=void 0;var r=n(735534),a=n(162969);class o extends a.LazyIterator{constructor(e,t){if(super(),this.webcamVideoElement=e,this.webcamConfig=t,this.isClosed=!0,this.resize=!1,this.needToResize())if(this.resize=!0,this.cropSize=[this.webcamConfig.resizeHeight,this.webcamConfig.resizeWidth],this.cropBoxInd=(0,r.tensor1d)([0],"int32"),this.webcamConfig.centerCrop){const e=1*this.webcamConfig.resizeWidth/this.webcamVideoElement.width,t=1*this.webcamConfig.resizeHeight/this.webcamVideoElement.height,n=(1-e)/2,a=(1-t)/2,o=n+e,s=t+a;this.cropBox=(0,r.tensor2d)([a,n,s,o],[1,4])}else this.cropBox=(0,r.tensor2d)([0,0,1,1],[1,4])}summary(){return"webcam"}static async create(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if((0,r.env)().get("IS_NODE"))throw new Error("tf.data.webcam is only supported in browser environment.");if(!e){if(e=document.createElement("video"),!t.resizeWidth||!t.resizeHeight)throw new Error("Please provide webcam video element, or resizeWidth and resizeHeight to create a hidden video element.");e.width=t.resizeWidth,e.height=t.resizeHeight}const n=new o(e,t);return await n.start(),n}async start(){this.webcamConfig.facingMode&&r.util.assert("user"===this.webcamConfig.facingMode||"environment"===this.webcamConfig.facingMode,(()=>"Invalid webcam facing mode: ".concat(this.webcamConfig.facingMode,". ")+"Please provide 'user' or 'environment'"));try{this.stream=await navigator.mediaDevices.getUserMedia({video:{deviceId:this.webcamConfig.deviceId,facingMode:this.webcamConfig.facingMode?this.webcamConfig.facingMode:"user",width:this.webcamVideoElement.width,height:this.webcamVideoElement.height}})}catch(e){throw e.message="Error thrown while initializing video stream: ".concat(e.message),e}if(!this.stream)throw new Error("Could not obtain video from webcam.");try{this.webcamVideoElement.srcObject=this.stream}catch(e){console.log(e),this.webcamVideoElement.src=window.URL.createObjectURL(this.stream)}return this.webcamVideoElement.play(),this.isClosed=!1,new Promise((e=>{this.webcamVideoElement.onloadedmetadata=()=>{e()}}))}async next(){if(this.isClosed)return{value:null,done:!0};let e;try{e=r.browser.fromPixels(this.webcamVideoElement)}catch(e){throw new Error("Error thrown converting video to pixels: ".concat(JSON.stringify(e)))}if(!this.resize)return{value:e,done:!1};try{return{value:this.cropAndResizeFrame(e),done:!1}}catch(e){throw new Error("Error thrown cropping the video: ".concat(e.message))}finally{e.dispose()}}needToResize(){return!(!this.webcamConfig.resizeWidth||!this.webcamConfig.resizeHeight||this.webcamVideoElement.width===this.webcamConfig.resizeWidth&&this.webcamVideoElement.height===this.webcamConfig.resizeHeight)}cropAndResizeFrame(e){return(0,r.tidy)((()=>{const t=(0,r.expandDims)((0,r.cast)(e,"float32"),0);let n;n=r.image.cropAndResize(t,this.cropBox,this.cropBoxInd,this.cropSize,"bilinear");const a=n.shape;return(0,r.reshape)(n,a.slice(1))}))}async capture(){return(await this.next()).value}
1stop(){this.stream.getTracks().forEach((e=>e.stop()));try{this.webcamVideoElement.srcObject=null}catch(e){console.log(e),this.webcamVideoElement.src=null}this.isClosed=!0}toArray(){throw new Error("Can not convert infinite video stream to array.")}}t.WebcamIterator=o},760124:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.csv=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return new a.CSVDataset(new c.URLDataSource(e),t)},t.func=function(e){const t=(0,o.iteratorFromFunction)(e);return(0,r.datasetFromIteratorFn)((async()=>t))},t.generator=function(e){return(0,r.datasetFromIteratorFn)((async()=>{const t=await e();return(0,o.iteratorFromFunction)((()=>t.next()))}))},t.microphone=async function(e){return s.MicrophoneIterator.create(e)},t.webcam=async function(e,t){return i.WebcamIterator.create(e,t)};var r=n(931841),a=n(176100),o=n(162969),s=n(373389),i=n(459345),c=n(478113)},289826:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.FileDataSource=void 0;var r=n(735534),a=n(147478),o=n(176290),s=n(943224);class i extends a.DataSource{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};super(),this.input=e,this.options=t}async iterator(){if((0,s.isLocalPath)(this.input)&&(0,r.env)().get("IS_NODE")){const e=n(140549);this.input=e.readFileSync(this.input.substr(7))}return new o.FileChunkIterator(this.input,this.options)}}t.FileDataSource=i},478113:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.URLDataSource=void 0;var r=n(147478),a=n(234752),o=n(943224),s=n(289826);class i extends r.DataSource{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};super(),this.url=e,this.fileOptions=t}async iterator(){return(0,o.isLocalPath)(this.url)?new s.FileDataSource(this.url,this.fileOptions).iterator():(0,a.urlChunkIterator)(this.url,this.fileOptions)}}t.URLDataSource=i},426830:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.deepClone=function(e){return(0,a.deepMap)(e,s)};var r=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=o(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var s in e)if("default"!==s&&{}.hasOwnProperty.call(e,s)){var i=a?Object.getOwnPropertyDescriptor(e,s):null;i&&(i.get||i.set)?Object.defineProperty(r,s,i):r[s]=e[s]}return r.default=e,n&&n.set(e,r),r}(n(735534)),a=n(881638);function o(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(o=function(e){return e?n:t})(e)}function s(e){return e instanceof r.Tensor?{value:e.clone(),recurse:!1}:(0,a.isIterable)(e)?{value:null,recurse:!0}:{value:e,recurse:!1}}},881638:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.canTensorify=function(e){return null==e||(t=e,null===t||"object"!=typeof t&&"function"!=typeof t)||Array.isArray(e)||"object"==typeof e&&e instanceof r.Tensor||r.util.isTypedArray(e);var t},t.deepMap=function(e,t){return o(e,t)},t.deepMapAndAwaitAll=async function(e,t){const n=new Map;o(e,t,n);for(const e of Array.from(n.keys())){const t=n.get(e);if(r.util.isPromise(t)){const r=await t;n.set(e,r)}}return o(e,t,n)},t.deepZip=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:i;return s(e,t)},t.isIterable=c,t.zipToList=i;var r=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=a(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var s in e)if("default"!==s&&{}.hasOwnProperty.call(e,s)){var i=o?Object.getOwnPropertyDescriptor(e,s):null;i&&(i.get||i.set)?Object.defineProperty(r,s,i):r[s]=e[s]}return r.default=e,n&&n.set(e,r),r}(n(735534));function a(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(a=function(e){return e?n:t})(e)}function o(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:new Map,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:new Set;if(null==e)return null;if("function"==typeof Blob&&e instanceof Blob)return e.slice();if(r.has(e))throw new Error("Circular references are not supported.");
1if(n.has(e))return n.get(e);const a=t(e);if(a.recurse&&null!==a.value)throw new Error("A deep map function may not return both a value and recurse=true.");if(a.recurse){if(c(e)){const a=Array.isArray(e)?[]:{};r.add(e);for(const s in e){const i=o(e[s],t,n,r);a[s]=i}return r.delete(e),e.__proto__&&(a.__proto__=e.__proto__),a}throw new Error("Can't recurse into non-iterable type: ".concat(e))}return n.set(e,a.value),a.value}function s(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:new Set;const r=e[0];if(n.has(r))throw new Error("Circular references are not supported.");const a=t(e);if(a.recurse&&null!==a.value)throw new Error("A deep zip function may not return both a value and recurse=true.");if(a.recurse){if(c(r)){const a=Array.isArray(r)?[]:{};n.add(r);for(const o in r){const r=s(e.map((e=>e[o])),t,n);a[o]=r}return n.delete(r),a}throw new Error("Can't recurse into non-iterable type: ".concat(r))}return a.value}function i(e){return null===e?null:c(e[0])?{value:null,recurse:!0}:{value:e,recurse:!1}}function c(e){let t=!1;if(r.env().get("IS_BROWSER"))t=e instanceof TextDecoder;else{const{StringDecoder:r}=n(376401);t=e instanceof r}return null!=e&&!ArrayBuffer.isView(e)&&(Array.isArray(e)||"object"==typeof e&&!(e instanceof r.Tensor)&&!(e instanceof Promise)&&!t)}},614472:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.GrowingRingBuffer=void 0;var r=n(3013);class a extends r.RingBuffer{constructor(){super(a.INITIAL_CAPACITY)}isFull(){return!1}push(e){super.isFull()&&this.expand(),super.push(e)}unshift(e){super.isFull()&&this.expand(),super.unshift(e)}expand(){const e=2*this.capacity,t=new Array(e),n=this.length();for(let e=0;e<n;e++)t[e]=this.get(this.wrap(this.begin+e));this.data=t,this.capacity=e,this.doubledCapacity=2*this.capacity,this.begin=0,this.end=n}}t.GrowingRingBuffer=a,a.INITIAL_CAPACITY=32},3013:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.RingBuffer=void 0;t.RingBuffer=class{constructor(e){if(this.capacity=e,this.begin=0,this.end=0,null==e)throw new RangeError("Can't create a ring buffer of unknown capacity.");if(e<1)throw new RangeError("Can't create ring buffer of capacity < 1.");this.data=new Array(e),this.doubledCapacity=2*e}wrap(e){for(;e<0;)e+=this.doubledCapacity;return e%this.doubledCapacity}get(e){if(e<0)throw new RangeError("Can't get item at a negative index.");return this.data[e%this.capacity]}set(e,t){if(e<0)throw new RangeError("Can't set item at a negative index.");this.data[e%this.capacity]=t}length(){let e=this.end-this.begin;return e<0&&(e=this.doubledCapacity+e),e}isFull(){return this.length()===this.capacity}isEmpty(){return 0===this.length()}push(e){if(this.isFull())throw new RangeError("Ring buffer is full.");this.set(this.end,e),this.end=this.wrap(this.end+1)}pushAll(e){for(const t of e)this.push(t)}pop(){if(this.isEmpty())throw new RangeError("Ring buffer is empty.");this.end=this.wrap(this.end-1);const e=this.get(this.end);return this.set(this.end,void 0),e}unshift(e){if(this.isFull())throw new RangeError("Ring buffer is full.");this.begin=this.wrap(this.begin-1),this.set(this.begin,e)}shift(){if(this.isEmpty())throw new RangeError("Ring buffer is empty.");const e=this.get(this.begin);return this.set(this.begin,void 0),this.begin=this.wrap(this.begin+1),e}shuffleExcise(e){if(this.isEmpty())throw new RangeError("Ring buffer is empty.");const t=this.wrap(this.begin+e),n=this.get(t);return this.set(t,this.pop()),n}}},943224:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.isLocalPath=function(e){return"string"==typeof e&&"file://"===e.substr(0,7)}},712209:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.version=void 0;t.version="3.14.0"}}]); 2//# sourceMappingURL=/cloud-sources/prod/3f72ddf3eb43f2495e3d9e7964598cff950b29b84ddd285d40157430c23c8e97.map/
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.