varEs=Object.defineProperty,c2=Object.prototype.hasOwnProperty;varLe=(n,t)=>()=>(t||(t={exports:{}},n(t.exports,t)),t.exports),rf=n=>Es(n,"__esModule",{value:!0}),Ll=(n,t)=>{rf(n);for(vareint)Es(n,e,{get:t[e],enumerable:!0})},h2=(n,t)=>{if(rf(n),typeoft=="object"||typeoft=="function")for(leteint)!c2.call(n,e)&&e!=="default"&&Es(n,e,{get:()=>t[e],enumerable:!0});returnn},Na=n=>n&&n.__esModule?n:h2(Es({},"default",{value:n,enumerable:!0}),n);varff=Le(d2=>{Ll(d2,{FetchError:()=>Ut,Headers:()=>gn,Request:()=>Gi,Response:()=>Dn,default:()=>A2});constcn=Na(require("stream")),Il=Na(require("http")),Ds=Na(require("url")),af=Na(require("https")),ci=Na(require("zlib")),p2=cn.default.Readable,$n=Symbol("buffer"),Al=Symbol("type");classxa{constructor(){this[Al]="";constn=arguments[0],t=arguments[1],e=[];leti=0;if(n){consta=n,s=Number(a.length);for(leto=0;o<s;o++){constl=a[o];letu;linstanceofBuffer?u=l:ArrayBuffer.isView(l)?u=Buffer.from(l.buffer,l.byteOffset,l.byteLength):linstanceofArrayBuffer?u=Buffer.from(l):linstanceofxa?u=l[$n]:u=Buffer.from(typeofl=="string"?l:String(l)),i+=u.length,e.push(u)}}this[$n]=Buffer.concat(e);letr=t&&t.type!==void0&&String(t.type).toLowerCase();r&&!/[^\u0020-\u007E]/.test(r)&&(this[Al]=r)}getsize(){returnthis[$n].length}gettype(){returnthis[Al]}text(){returnPromise.resolve(this[$n].toString())}arrayBuffer(){constn=this[$n],t=n.buffer.slice(n.byteOffset,n.byteOffset+n.byteLength);returnPromise.resolve(t)}stream(){constn=newp2;returnn._read=function(){},n.push(this[$n]),n.push(null),n}toString(){return"[object Blob]"}slice(){constn=this.size,t=arguments[0],e=arguments[1];leti,r;t===void0?i=0:t<0?i=Math.max(n+t,0):i=Math.min(t,n),e===void0?r=n:e<0?r=Math.max(n+e,0):r=Math.min(e,n);consta=Math.max(r-i,0),s=this[$n],o=s.slice(i,i+a),l=newxa([],{type:arguments[2]});returnl[$n]=o,l}}Object.defineProperties(xa.prototype,{size:{enumerable:!0},type:{enumerable:!0},slice:{enumerable:!0}});Object.defineProperty(xa.prototype,Symbol.toStringTag,{value:"Blob",writable:!1,enumerable:!1,configurable:!0});functionUt(n,t,e){Error.call(this,n),this.message=n,this.type=t,e&&(this.code=this.errno=e.code),Error.captureStackTrace(this,this.constructor)}Ut.prototype=Object.create(Error.prototype);Ut.prototype.constructor=Ut;Ut.prototype.name="FetchError";letTl;try{Tl=require("encoding").convert}catch(n){}constXn=Symbol("Body internals"),sf=cn.default.PassThrough;functionCt(n){vart=this,e=arguments.length>1&&arguments[1]!==void0?arguments[1]:{},i=e.size;letr=i===void0?0:i;vara=e.timeout;lets=a===void0?0:a;n==null?n=null:of(n)?n=Buffer.from(n.toString()):Ca(n)||(Buffer.isBuffer(n)||(Object.prototype.toString.call(n)==="[object ArrayBuffer]"?n=Buffer.from(n):ArrayBuffer.isView(n)?n=Buffer.from(n.buffer,n.byteOffset,n.byteLength):ninstanceofcn.default||(n=Buffer.from(String(n))))),this[Xn]={body:n,disturbed:!1,error:null},this.size=r,this.timeout=s,ninstanceofcn.default&&n.on("error",function(o){constl=o.name==="AbortError"?o:newUt(`Invalid response body while trying to fetch ${t.url}: ${o.message}`,"system",o);t[Xn].error=l})}Ct.prototype={getbody(){returnthis[Xn].body},getbodyUsed(){returnthis[Xn].disturbed},arrayBuffer(){returnEr.call(this).then(function(n){returnn.buffer.slice(n.byteOffset,n.byteOffset+n.byteLength)})},blob(){letn=this.headers&&this.headers.get("content-type")||"";returnEr.call(this).then(function(t){returnObject.assign(newxa([],{type:n.toLowerCase()}),{[$n]:t})})},json(){varn=this;returnEr.call(this).then(function(t){try{returnJSON.parse(t.toString())}catch(e){returnCt.Promise.reject(newUt(`invalid json response body at ${n.url} reason: ${e.message}`,"invalid-json"))}})},text(){returnEr.call(this).then(function(n){returnn.toString()})},buffer(){returnEr.call(this)},textConverted(){varn=this;returnEr.call(this).then(function(t){returnf2(t,n.headers)})}};Object.defineProperties(Ct.prototype,{body:{enumerable:!0},bodyUsed:{enumerable:!0},arrayBuffer:{enumerable:!0},blob:{enumerable:!0},json:{enumerable:!0},text:{enumerable:!0}
`;return v[v.length-1]=" "+v[v.length-1]+"]"+(a?"":N),v}function Ua(n){for(var t=[],e=0;e<n.length;e+=2)t.push([n[e],n[e+1]]);return t}var Hs=function(){function n(t,e,i){var r=this;if(this.dtype=e,this.shape=t.slice(),this.size=ot(t),i!=null){var a=i.length;E(a===this.size,function(){return"Length of values '"+a+"' does not match the size "+("inferred by the shape '"+r.size+"'.")})}if(e==="complex64")throw new Error("complex64 dtype TensorBuffers are not supported. Please create a TensorBuffer for the real and imaginary parts separately and call tf.complex(real, imag).");this.values=i||Sm(e,this.size),this.strides=Fr(t)}return n.prototype.set=function(t){for(var e=this,i=[],r=1;r<arguments.length;r++)i[r-1]=arguments[r];i.length===0&&(i=[0]),E(i.length===this.rank,function(){return"The number of provided coordinates ("+i.length+") must "+("match the rank ("+e.rank+")")});var a=this.locToIndex(i);this.values[a]=t},n.prototype.get=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];t.length===0&&(t=[0]);for(var i=0,r=0,a=t;r<a.length;r++){var s=a[r];if(s<0||s>=this.shape[i]){var o="Requested out of range element at "+t+". "+(" Buffer shape="+this.shape);throw new Error(o)}i++}for(var l=t[t.length-1],u=0;u<t.length-1;++u)l+=this.strides[u]*t[u];return this.values[l]},n.prototype.locToIndex=function(t){if(this.rank===0)return 0;if(this.rank===1)return t[0];for(var e=t[t.length-1],i=0;i<t.length-1;++i)e+=this.strides[i]*t[i];return e},n.prototype.indexToLoc=function(t){if(this.rank===0)return[];if(this.rank===1)return[t];for(var e=new Array(this.shape.length),i=0;i<e.length-1;++i)e[i]=Math.floor(t/this.strides[i]),t-=e[i]*this.strides[i];return e[e.length-1]=t,e},Object.defineProperty(n.prototype,"rank",{get:function(){return this.shape.length},enumerable:!0,configurable:!0}),n.prototype.toTensor=function(){return kn().makeTensor(this.values,this.shape,this.dtype)},n}(),kn=null,Br=null;function oA(n){kn=n}function lA(n){Br=n}var Y=function(){function n(t,e,i,r){this.kept=!1,this.isDisposedInternal=!1,this.shape=t.slice(),this.dtype=e||"float32",this.size=ot(t),this.strides=Fr(t),this.dataId=i,this.id=r,this.rankType=this.rank<5?this.rank.toString():"higher"}return Object.defineProperty(n.prototype,"rank",{get:function(){return this.shape.length},enumerable:!0,configurable:!0}),n.prototype.buffer=function(){return de(this,void 0,void 0,function(){var t;return pe(this,function(e){switch(e.label){case 0:return[4,this.data()];case 1:return t=e.sent(),[2,Br.buffer(this.shape,this.dtype,t)]}})})},n.prototype.bufferSync=function(){return Br.buffer(this.shape,this.dtype,this.dataSync())},n.prototype.array=function(){return de(this,void 0,void 0,function(){var t;return pe(this,function(e){switch(e.label){case 0:return[4,this.data()];case 1:return t=e.sent(),[2,Wr(this.shape,t)]}})})},n.prototype.arraySync=function(){return Wr(this.shape,this.dataSync())},n.prototype.data=function(){return de(this,void 0,void 0,function(){var t,e;return pe(this,function(i){switch(i.label){case 0:return this.throwIfDisposed(),t=kn().read(this.dataId),this.dtype==="string"?[4,t]:[3,2];case 1:e=i.sent();try{return[2,e.map(function(r){return Cc(r)})]}catch(r){throw new Error("Failed to decode the string bytes into utf-8. To get the original bytes, call tensor.bytes().")}i.label=2;case 2:return[2,t]}})})},n.prototype.dataSync=function(){this.throwIfDisposed();var t=kn().readSync(this.dataId);if(this.dtype==="string")try{return t.map(function(e){return Cc(e)})}catch(e){throw new Error("Failed to decode the string bytes into utf-8. To get the original bytes, call tensor.bytes().")}return t},n.prototype.bytes=function(){return de(this,void 0,void 0,function(){var t;return pe(this,function(e){switch(e.label){case 0:return this.throwIfDisposed(),[4,kn().read(this.dataId)];case 1:return t=e.sent(),this.dtype==="string"?[2,t]:[2,new Uint8Array(t.buffer)]}})})},n.prototype.dispose=function(){if(this.isDisposed)return;kn().disposeTensor(this),this.isDisposedInternal=!0},Object.defineProperty(n.prototype,"isDisposed",{get:function(){return this.is
`)+"Manifest JSON has weights with names: "+(l.join(", ")+"."));return c=a.reduce(function(g,v,b){return v&&g.push(b),g},[]),h=[],c.forEach(function(g){e[g].paths.forEach(function(v){var b=i+(i.endsWith("/")?"":"/")+v;h.push(b)})}),[4,n(h)];case 1:return d=m.sent(),p={},f=0,c.forEach(function(g){for(var v=e[g].paths.length,b=0,w=0;w<v;w++)b+=d[f+w].byteLength;for(var S=new ArrayBuffer(b),L=new Uint8Array(S),N=0,C=0;C<v;C++){var R=new Uint8Array(d[f+C]);L.set(R,N),N+=R.byteLength}var D=s[g];D.forEach(function(k){var W=S.slice(k.groupOffset,k.groupOffset+k.sizeBytes),F=_m(W,[k.manifestEntry]);for(var P in F)p[P]=F[P]}),f+=v}),[2,p]}})})}}var lT="application/octet-stream",uT="application/json",eg=function(){function n(t,e){if(this.DEFAULT_METHOD="POST",e==null&&(e={}),this.weightPathPrefix=e.weightPathPrefix,this.onProgress=e.onProgress,this.weightUrlConverter=e.weightUrlConverter,e.fetchFunc!=null?(E(typeof e.fetchFunc=="function",function(){return"Must pass a function that matches the signature of `fetch` (see https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API)"}),this.fetch=e.fetchFunc):this.fetch=He().platform.fetch,E(t!=null&&t.length>0,function(){return"URL path for http must not be null, undefined or empty."}),Array.isArray(t)&&E(t.length===2,function(){return"URL paths for http must have a length of 2, "+("(actual length is "+t.length+").")}),this.path=t,e.requestInit!=null&&e.requestInit.body!=null)throw new Error("requestInit is expected to have no pre-existing body, but has one.");this.requestInit=e.requestInit||{}}return n.prototype.save=function(t){return de(this,void 0,void 0,function(){var e,i,r,a;return pe(this,function(s){switch(s.label){case 0:if(t.modelTopology instanceof ArrayBuffer)throw new Error("BrowserHTTPRequest.save() does not support saving model topology in binary formats yet.");return e=Object.assign({method:this.DEFAULT_METHOD},this.requestInit),e.body=new FormData,i=[{paths:["./model.weights.bin"],weights:t.weightSpecs}],r={modelTopology:t.modelTopology,format:t.format,generatedBy:t.generatedBy,convertedBy:t.convertedBy,userDefinedMetadata:t.userDefinedMetadata,weightsManifest:i},e.body.append("model.json",new Blob([JSON.stringify(r)],{type:uT}),"model.json"),t.weightData!=null&&e.body.append("model.weights.bin",new Blob([t.weightData],{type:lT}),"model.weights.bin"),[4,this.fetch(this.path,e)];case 1:if(a=s.sent(),a.ok)return[2,{modelArtifactsInfo:Pa(t),responses:[a]}];throw new Error("BrowserHTTPRequest.save() failed due to HTTP response status "+(a.status+"."))}})})},n.prototype.load=function(){return de(this,void 0,void 0,function(){var t,e,i,r,a,s,o,l,u,c,h,d,p,f,m;return pe(this,function(g){switch(g.label){case 0:return[4,this.fetch(this.path,this.requestInit)];case 1:if(t=g.sent(),!t.ok)throw new Error("Request to "+this.path+" failed with status code "+(t.status+". Please verify this URL points to ")+"the model JSON of the model to load.");g.label=2;case 2:return g.trys.push([2,4,,5]),[4,t.json()];case 3:return e=g.sent(),[3,5];case 4:throw i=g.sent(),r="Failed to parse model JSON of response from "+this.path+".",this.path.endsWith(".pb")?r+=" 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.":r+=" Please make sure the server is serving valid JSON for this request.",new Error(r);case 5:if(a=e.modelTopology,s=e.weightsManifest,o=e.generatedBy,l=e.convertedBy,u=e.format,c=e.userDefinedMetadata,a==null&&s==null)throw new Error("The JSON from HTTP path "+this.path+" contains neither model topology or manifest for weights.");return s!=null?[4,this.loadWeights(s)]:[3,7];case 6:p=g.sent(),h=p[0],d=p[1],g.label=7;case 7:return f={modelTopology:a,weightSpecs:h,weightData:d,userDefinedMetadata:c,generatedBy:o,convertedBy:l,format:u},m=e.modelInitializer,m&&(f.modelInitializer=m),[2,f]}})})},n.prototype.loadWe
`)+("Expected: "+u+"."))}}function FT(n,t){n().then(function(){return t.fail()},function(){return t()})}function WT(n,t){var e=typeof t=="string"||typeof t=="number"||typeof t=="boolean"?[t]:t;return pi(n)||pi(n[0])||pi(t)||pi(t[0])?Xc(n,e,function(i,r){return i==r}):Xc(n,t,function(i,r){return Jc(i,r,0)})}function UT(n,t,e){if(e==null&&(e=$c()),!Jc(n,t,e))throw new Error("Numbers differ: actual === "+n+", expected === "+t)}function Jc(n,t,e){return!isFinite(n)&&!isFinite(t)?!0:!(isNaN(n)||isNaN(t)||Math.abs(n-t)>e)}function BT(n,t,e){for(var i=0;i<n.length;i++)if(n[i]<t||n[i]>e)throw new Error("Value out of range:"+n[i]+" low: "+t+", high: "+e)}function zT(n,t){expect(new Float32Array(n)).toEqual(new Float32Array(t))}var PT={__proto__:null,TEST_EPSILON_FLOAT16:bg,expectArraysClose:kT,testEpsilon:$c,expectPromiseToFail:FT,expectArraysEqual:WT,expectNumbersClose:UT,expectValuesInRange:BT,expectArrayBuffersEqual:zT};var _T="2.6.0";function MT(){He().set("PROD",!0)}function HT(){He().set("DEBUG",!0)}function VT(){He().set("DEPRECATION_WARNINGS_ENABLED",!1),console.warn("TensorFlow.js deprecation warnings have been disabled.")}function At(n){He().getBool("DEPRECATION_WARNINGS_ENABLED")&&console.warn(n+" You can disable deprecation warnings with tf.disableDeprecationWarnings().")}function qT(){z.disposeVariables()}function GT(){return z}function YT(){return z.memory()}function jT(n){return z.profile(n)}function mt(n,t){return z.tidy(n,t)}function Mt(n){var t=Fc(n);t.forEach(function(e){return e.dispose()})}function wg(n){return z.keep(n)}function KT(n){return z.time(n)}function $T(n){return z.setBackend(n)}function XT(){return z.ready()}function JT(){return z.backendName}function ZT(n){z.removeBackend(n)}function QT(n){return z.findBackend(n)}function e1(n){return z.findBackendFactory(n)}function t1(n,t,e){return e===void 0&&(e=1),z.registerBackend(n,t,e)}function n1(){return z.backend}function i1(n,t){He().setPlatform(n,t)}function r1(n,t){var e,i=O(n,"a","add"),r=O(t,"b","add");e=at(i,r),i=e[0],r=e[1];var a=function(o,l){var u=o.add(i,r);return l([i,r]),u},s={a:i,b:r};return z.runKernelFunc(a,s,null,Fs)}var fe=U({add_:r1});function a1(n,t){var e,i=O(n,"a","floorDiv"),r=O(t,"b","floorDiv");e=at(i,r),i=e[0],r=e[1];var a=function(o,l){var u=o.floorDiv(i,r);return l([i,r]),u},s={a:i,b:r};return z.runKernelFunc(a,s,null,pu)}var Zc=U({floorDiv_:a1});function s1(n,t){var e,i=O(n,"a","div"),r=O(t,"b","div");if(e=at(i,r),i=e[0],r=e[1],i.dtype==="int32"&&r.dtype==="int32")return Zc(i,r);var a=function(l,u){var c=l.realDivide(i,r);return u([i,r]),c},s={a:i,b:r},o={};return z.runKernelFunc(a,s,null,ou,o)}var Ie=U({div_:s1});function o1(n,t){var e,i=O(n,"a","mul"),r=O(t,"b","mul");e=at(i,r),i=e[0],r=e[1];var a=function(o,l){var u=o.multiply(i,r);return l([i,r]),u},s={a:i,b:r};return z.runKernelFunc(a,s,null,Du)}var J=U({mul_:o1});function l1(n){var t=O(n,"x","abs"),e={x:t};return z.runKernelFunc(function(i,r){return r([t]),t.dtype==="complex64"?i.complexAbs(t):i.abs(t)},e,null,Fl)}var jt=U({abs_:l1});function u1(n){var t=O(n,"x","acos"),e={x:t};return z.runKernelFunc(function(i,r){var a=i.acos(t);return r([t]),a},e,null,Wl)}var Sg=U({acos_:u1});function c1(n){var t=O(n,"x","acosh"),e={x:t};return z.runKernelFunc(function(i,r){var a=i.acosh(t);return r([t]),a},e,null,Ul)}var Lg=U({acosh_:c1});function h1(n){E(Array.isArray(n),function(){return"The argument passed to tf.addN() must be a list of tensors"}),E(n.length>=1,function(){return"Must pass at least one tensor to tf.addN(), but got "+(""+n.length)});var t=n.map(function(a,s){return O(a,"tensors"+s,"addN")}),e=t[0];t.forEach(function(a){if(a.dtype!==e.dtype)throw new Error("All tensors passed to tf.addN() must have the same dtype")}),t.forEach(function(a){if(!hn(a.shape,e.shape))throw new Error("All tensors passed to tf.addN() must have the same shape")});var i=function(a,s){var o=a.addN(t);return s(t),o},r=t;return z.runKernelFunc(i,r,null,Bl)}var d1=U({addN_:h1});function Qc(n,t){for(var e=0;e<n.length;++e)if(n[n.length-e-1]!==t-1-e)return!1;return!0}function Ig(n,t,e){for(var i=n
withdtype`+s.dtype+". ")});var i=function(s,o){var l=Qe(t,e[0].shape)[0],u=Wg(e.map(function(d){return d.shape}),l);if(ot(u)===0)return vi([],u);if(e=e.filter(function(d){return d.size>0}),e.length===1)return e[0];var c=e.map(function(d){return d.shape});Fg(c,l);var h=s.concat(e,l);return o(e),h},r=e,a={axis:t};return z.runKernelFunc(i,r,null,Zl,a)}var Rt=U({concat_:E1});function D1(n){var t=O(n,"x","sigmoid"),e={x:t};return z.runKernelFunc(function(i,r){var a=i.sigmoid(t);return r([a]),a},e,null,ec)}var Ji=U({sigmoid_:D1});function k1(n,t,e){var i=O(n,"x","slice");if(i.rank===0)throw new Error("Slicing scalar is not possible");var r=function(o,l){var u=Kc(i,t,e),c=u[0],h=u[1];return ag(i,c,h),l([i]),o.slice(i,c,h)},a={x:i},s={begin:t,size:e};return z.runKernelFunc(r,a,null,Xu,s)}var ze=U({slice_:k1});function F1(n){var t=O(n,"x","tanh"),e={x:t};return z.runKernelFunc(function(i,r){var a=i.tanh(t);return r([a]),a},e,null,cc)}var Xs=U({tanh_:F1});function W1(n,t,e,i,r,a){var s=O(n,"forgetBias","basicLSTMCell"),o=O(t,"lstmKernel","basicLSTMCell"),l=O(e,"lstmBias","basicLSTMCell"),u=O(i,"data","basicLSTMCell"),c=O(r,"c","basicLSTMCell"),h=O(a,"h","basicLSTMCell"),d=Rt([u,h],1),p=We(d,o),f=fe(p,l),m=f.shape[0],g=f.shape[1]/4,v=[m,g],b=ze(f,[0,0],v),w=ze(f,[0,g],v),S=ze(f,[0,g*2],v),L=ze(f,[0,g*3],v),N=fe(J(Ji(b),Xs(w)),J(c,Ji(fe(s,S)))),C=J(Xs(N),Ji(L));return[N,C]}var U1=U({basicLSTMCell_:W1});function B1(n,t,e){var i=O(n,"x","batchToSpaceND"),r=t.reduce(function(l,u){return l*u});E(i.rank>=1+t.length,function(){return"input rank is "+i.rank+" but should be > than blockShape.length "+t.length}),E(e.length===t.length,function(){return"crops.length is "+e.length+" but should be equal to blockShape.length "+t.length}),E(i.shape[0]%r===0,function(){return"input tensor batch is "+i.shape[0]+" but is not divisible by the product of "+("the elements of blockShape "+t.join(" * ")+" === "+r)});var a=function(l){return l.batchToSpaceND(i,t,e)},s={x:i},o={blockShape:t,crops:e};return z.runKernelFunc(a,s,null,Kl,o)}var Js=U({batchToSpaceND_:B1});function z1(n){var t;return n.rank===0||n.rank===1?t=V(n,[1,1,1,n.size]):n.rank===2?t=V(n,[1,1,n.shape[0],n.shape[1]]):n.rank===3?t=V(n,[1,n.shape[0],n.shape[1],n.shape[2]]):t=n,t}function P1(n,t,e,i,r,a){a==null&&(a=.001);var s=O(n,"x","batchNorm"),o=O(t,"mean","batchNorm"),l=O(e,"variance","batchNorm"),u;r!=null&&(u=O(r,"scale","batchNorm"));var c;i!=null&&(c=O(i,"offset","batchNorm")),E(o.rank===l.rank,function(){return"Batch normalization gradient requires mean and variance to have equal ranks."}),E(c==null||o.rank===c.rank,function(){return"Batch normalization gradient requires mean and offset to have equal ranks."}),E(u==null||o.rank===u.rank,function(){return"Batch normalization gradient requires mean and scale to have equal ranks."});var h=z1(s),d=function(g,v){return v([h,o,l,u]),g.batchNorm(h,Zs(o),Zs(l),Zs(c),Zs(u),a)},p={x:h,scale:u,offset:c,mean:o,variance:l},f={varianceEpsilon:a},m=z.runKernelFunc(d,p,null,fu,f);return V(m,s.shape)}function Zs(n){return n==null?null:n.rank===0?V(n,[n.size]):n.rank===1?n:n.rank===2?V(n,[1,1,n.shape[0],n.shape[1]]):n.rank===3?V(n,[1,n.shape[0],n.shape[1],n.shape[2]]):n}var Va=U({batchNorm_:P1});function _1(n,t,e,i,r,a){var s=O(n,"x","batchNorm"),o=O(t,"mean","batchNorm"),l=O(e,"variance","batchNorm"),u;r!=null&&(u=O(r,"scale","batchNorm"));var c;return i!=null&&(c=O(i,"offset","batchNorm")),E(s.rank===2,function(){return"Error in batchNorm2D: x must be rank 2 but got rank "+(s.rank+".")}),E(o.rank===2||o.rank===1,function(){return"Error in batchNorm2D: mean must be rank 2 or rank 1 but "+("got rank "+o.rank+".")}),E(l.rank===2||l.rank===1,function(){return"Error in batchNorm2D: variance must be rank 2 or rank 1 "+("but got rank "+l.rank+".")}),u!=null&&E(u.rank===2||u.rank===1,function(){return"Error in batchNorm2D: scale must be rank 2 or rank 1 "+("but got rank "+u.rank+".")}),c!=null&&E(c.rank===2||c.rank===1,function(){return"Error in batchNorm2D: offset must be rank 2 or rank 1 "+("but got rank "+c.rank+".")}),Va(s,o,l,c,u,a)}var
`+i.shape}),E(s%(t*t)===0,function(){return"Dimension size must be evenly divisible by "+t*t+" but is "+s+" for depthToSpace with input shape "+i.shape});var o=function(c){return c.depthToSpace(i,t,e)},l={x:i},u={blockSize:t,dataFormat:e};return z.runKernelFunc(o,l,null,Rf,u)}var Mg=U({depthToSpace_:mN});function gN(n,t,e,i,r,a,s){r===void 0&&(r="NHWC"),a===void 0&&(a=[1,1]);var o=O(n,"x","depthwiseConv2d"),l=O(t,"filter","depthwiseConv2d"),u=o,c=!1;o.rank===3&&(c=!0,u=V(o,[1,o.shape[0],o.shape[1],o.shape[2]])),E(u.rank===4,function(){return"Error in depthwiseConv2d: input must be rank 4, but got "+("rank "+u.rank+".")}),E(l.rank===4,function(){return"Error in depthwiseConv2d: filter must be rank 4, but got rank "+(l.rank+".")}),E(u.shape[3]===l.shape[2],function(){return"Error in depthwiseConv2d: number of input channels "+("("+u.shape[3]+") must match the inChannels dimension in ")+("filter "+l.shape[2]+".")}),s!=null&&E(rt(i),function(){return"Error in depthwiseConv2d: pad must be an integer when using, "+("dimRoundingMode "+s+" but got pad "+i+".")});var h=function(m,g){a==null&&(a=[1,1]),E(Ht(e,a),function(){return"Error in depthwiseConv2d: Either strides or dilations must be "+("1. Got strides "+e+" and dilations '"+a+"'")});var v=Bn(u.shape,l.shape,e,a,i,s,!0),b=m.depthwiseConv2D(u,l,v);return g([u,l]),b},d={x:u,filter:l},p={strides:e,pad:i,dataFormat:r,dilations:a,dimRoundingMode:s},f=z.runKernelFunc(h,d,null,au,p);return c?V(f,[f.shape[1],f.shape[2],f.shape[3]]):f}var qa=U({depthwiseConv2d_:gN});function vN(n){var t=O(n,"x","diag"),e=function(r){var a=V(t,[t.size]),s=r.diag(a),o=n.shape.concat(n.shape);return V(s,o)},i={x:t};return z.runKernelFunc(e,i,null,Df)}var yN=U({diag_:vN});function bN(n,t,e,i,r,a){r===void 0&&(r=[1,1]),a===void 0&&(a="NHWC");var s=O(n,"x","dilation2d"),o=O(t,"filter","dilation2d");E(s.rank===3||s.rank===4,function(){return"Error in dilation2d: input must be rank 3 or 4, but got rank "+(s.rank+".")}),E(o.rank===3,function(){return"Error in dilation2d: filter must be rank 3, but got rank "+(o.rank+".")}),E(a==="NHWC",function(){return"Error in dilation2d: Only NHWC is currently supported, "+("but got dataFormat of "+a)});var l=s,u=!1;s.rank===3&&(l=V(s,[1,s.shape[0],s.shape[1],s.shape[2]]),u=!0);var c={x:l,filter:o},h={strides:e,pad:i,dilations:r},d=z.runKernel(su,c,h);return u?V(d,[d.shape[1],d.shape[2],d.shape[3]]):d}var Hg=U({dilation2d_:bN});function wN(n,t){for(var e=n.length,i=[],r=0;r<e;r++){var a=e-1-r,s=n[a]||1,o=t[t.length-1-r]||1;o>1&&s===1&&i.unshift(a)}return i}function gt(n,t){for(var e=[],i=0;i<t.length;i++){var r=n[n.length-i-1],a=t.length-i-1,s=t[a];(r==null||r===1&&s>1)&&e.unshift(a)}return e}function et(n,t){for(var e=[],i=Math.max(n.length,t.length),r=0;r<i;r++){var a=n[n.length-r-1];a==null&&(a=1);var s=t[t.length-r-1];if(s==null&&(s=1),a===1)e.unshift(s);else if(s===1)e.unshift(a);else if(a!==s){var o="Operands could not be broadcast together with shapes "+(n+" and "+t+".");throw Error(o)}else e.unshift(a)}return e}function SN(n,t){var e,i=O(n,"a","equal"),r=O(t,"b","equal");e=at(i,r),i=e[0],r=e[1],et(i.shape,r.shape);var a=function(o){return o.equal(i,r)},s={a:i,b:r};return z.runKernelFunc(a,s,null,Uf)}var Ga=U({equal_:SN});function LN(n,t,e){var i=O(t,"a","where"),r=O(e,"b","where"),a=O(n,"condition","where","bool"),s=et(i.shape,r.shape),o=Qs(i,s),l=Qs(r,s);a.rank===1&&E(a.shape[0]===i.shape[0],function(){return"The first dimension of `a` must match the size of `condition`."}),a.rank!==1&&Be(a.shape,l.shape,"Error in where: ");var u=function(h,d){var p=h.select(a,o,l);return d([a]),p},c={condition:a,t:o,e:l};return z.runKernelFunc(u,c,null,Ku)}var vn=U({where_:LN});function IN(n){var t=O(n,"x","zerosLike"),e={x:t};return z.runKernelFunc(function(i){return i.zerosLike(t)},e,null,mc)}var Ee=U({zerosLike_:IN});function AN(n,t){var e,i=O(n,"a","div"),r=O(t,"b","div");e=at(i,r),i=e[0],r=e[1];var a=Ie(i,r),s=Ee(a),o=Ga(r,s);return vn(o,s,a)}var Vg=U({divNoNan_:AN});function TN(n,t){var e=O(n,"t1","dot"),i=O(t,"t2","dot");E((e.rank===1||e.rank===2)&&(i.rank===1||i
rank`+a.rank+"."}),E(rt(t),function(){return"Error in localResponseNormalization: depthRadius must be an "+("integer but got depthRadius "+t+".")});var s=a,o=!1;a.rank===3&&(o=!0,s=V(a,[1,a.shape[0],a.shape[1],a.shape[2]]));var l=function(d,p){var f=d.localResponseNormalization4D(s,t,e,i,r);return p([s,f]),f},u={x:s},c={depthRadius:t,bias:e,alpha:i,beta:r},h=z.runKernelFunc(l,u,null,Au,c);return o?V(h,[h.shape[1],h.shape[2],h.shape[3]]):h}var Qg=U({localResponseNormalization_:XN});function JN(n){var t=O(n,"x","log"),e={x:t};return z.runKernelFunc(function(i,r){var a=i.log(t);return r([t]),a},e,null,Su)}var er=U({log_:JN});function ZN(n){var t=O(n,"x","log1p"),e={x:t};return z.runKernelFunc(function(i,r){var a=i.log1p(t);return r([t]),a},e,null,Lu)}var uh=U({log1p_:ZN});function QN(n){return E(fi(n),function(){return"The f passed in grad(f) must be a function"}),function(t,e){var i=O(t,"x","tf.grad",null),r=e!=null?O(e,"dy","tf.grad"):null;return z.tidy(function(){var a=z.gradients(function(){return n(i)},[i],r),s=a.value,o=a.grads;return r!=null&&Be(s.shape,r.shape,"The shape of dy passed in grad(f)(x, dy) must match the shape returned by f(x)"),ao(o),o[0]})}}function ex(n){return E(fi(n),function(){return"The f passed in grads(f) must be a function"}),function(t,e){E(Array.isArray(t),function(){return"The args passed in grads(f)(args) must be an array of `Tensor`s or `TensorLike`s"});var i=za(t,"args","tf.grads",null),r=e!=null?O(e,"dy","tf.grads"):null;return z.tidy(function(){var a=z.gradients(function(){return n.apply(void 0,i)},i,r),s=a.value,o=a.grads;return r!=null&&Be(s.shape,r.shape,"The shape of dy passed in grads(f)([x1,...], dy) must match the shape returned by f([x1,...])"),ao(o),o})}}function tx(n){return E(fi(n),function(){return"The f passed in valueAndGrad(f) must be a function"}),function(t,e){E(t instanceof Y,function(){return"The x passed in valueAndGrad(f)(x) must be a tensor"}),E(e==null||e instanceof Y,function(){return"The dy passed in valueAndGrad(f)(x, dy) must be a tensor"});var i=z.gradients(function(){return n(t)},[t],e),r=i.grads,a=i.value;return ao(r),{grad:r[0],value:a}}}function nx(n){return E(fi(n),function(){return"The f passed in valueAndGrads(f) must be a function"}),function(t,e){E(Array.isArray(t)&&t.every(function(r){return r instanceof Y}),function(){return"The args passed in valueAndGrads(f)(args) must be array of tensors"}),E(e==null||e instanceof Y,function(){return"The dy passed in valueAndGrads(f)(args, dy) must be a tensor"});var i=z.gradients(function(){return n.apply(void 0,t)},t,e);return e!=null&&Be(i.value.shape,e.shape,"The shape of dy passed in valueAndGrads(f)([x1,...], dy) must match the shape returned by f([x1,...])"),ao(i.grads),i}}function ev(n,t){E(fi(n),function(){return"The f passed in variableGrads(f) must be a function"}),E(t==null||Array.isArray(t)&&t.every(function(h){return h instanceof Ba}),function(){return"The varList passed in variableGrads(f, varList) must be an array of variables"});var e=t!=null;if(!e){t=[];for(var i in z.registeredVariables)t.push(z.registeredVariables[i])}var r=e?t.filter(function(h){return!h.trainable}):null,a=t.length;t=t.filter(function(h){return h.trainable}),E(t.length>0,function(){return"variableGrads() expects at least one of the input variables to "+("be trainable, but none of the "+a+" variables is ")+"trainable."});var s=!0,o=z.gradients(n,t,null,s),l=o.value,u=o.grads;E(u.some(function(h){return h!=null}),function(){return"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()."}),E(l.rank===0,function(){return"The f passed in variableGrads(f) must return a scalar, but it "+("returned a rank-"+l.rank+" tensor")});var c={};return t.forEach(function(h,d){u[d]!=null&&(c[h.name]=u[d])}),r!=null&&r.forEach(function(h){return c[h.name]=null}),{value:l,grads:c}}function zn(n){return z.customGrad(n)}function ao(n){var t=n.filter(function(e){return e==null}).length;if(t>0)throw ne
thefyoupassedenclosesalloperationsthatleadfromxtoy.`)}function ix(n){var t=O(n,"x","neg"),e={x:t};return z.runKernelFunc(function(i){return i.neg(t)},e,null,ku)}var vt=U({neg_:ix});function rx(n){var t=O(n,"x","softplus"),e={x:t};return z.runKernelFunc(function(i,r){var a=i.softplus(t);return r([t]),a},e,null,tc)}var ch=U({softplus_:rx});function ax(n){var t=O(n,"x","logSigmoid"),e=zn(function(i){var r=vt(ch(vt(i))),a=function(s){var o=J(s,Ji(vt(i)));return o};return{value:r,gradFunc:a}});return e(t)}var tv=U({logSigmoid_:ax});function sx(n,t,e){t===void 0&&(t=null),e===void 0&&(e=!1);var i=O(n,"x","max"),r=function(o,l){var u=Qe(t,i.shape),c=u,h=rn(c,i.rank),d=i;h!=null&&(d=ut(i,h),c=Un(c.length,d.rank));var p=o.max(d,c);h!=null&&d.dispose();var f=p;if(e){var m=nn(f.shape,Qe(t,i.shape));f=V(f,m),p.dispose()}return l([i,f]),f},a={x:i},s={reductionIndices:t,keepDims:e};return z.runKernelFunc(r,a,null,Tu,s)}var tr=U({max_:sx});function ox(n,t){var e,i=O(n,"a","sub"),r=O(t,"b","sub");e=at(i,r),i=e[0],r=e[1];var a=function(o,l){var u=o.subtract(i,r);return l([i,r]),u},s={a:i,b:r};return z.runKernelFunc(a,s,null,lc)}var ge=U({sub_:ox});function lx(n,t,e){t===void 0&&(t=null),e===void 0&&(e=!1);var i=O(n,"x","sum");i.dtype==="bool"&&(i=ue(i,"int32"));var r=function(o,l){l([i]);var u=Qe(t,i.shape),c=rn(u,i.rank),h=u,d=i;c!=null&&(d=ut(i,c),h=Un(h.length,i.rank));var p=o.sum(d,h);if(e){var f=nn(p.shape,u);p=V(p,f)}return p},a={x:i},s={axis:t,keepDims:e};return z.runKernelFunc(r,a,null,ic,s)}var Ae=U({sum_:lx});function ux(n,t){t===void 0&&(t=-1);var e=O(n,"logits","logSoftmax");if(t===-1&&(t=e.rank-1),t!==e.rank-1)throw Error("Log Softmax along a non-last dimension is not yet supported. "+("Logits was rank "+e.rank+" and axis was "+t));var i=function(s,o){var l=!0,u=tr(n,t,!0),c=ge(n,u),h=ge(ue(c,"float32"),er(Ae(yn(c),t,l)));return o([h]),h},r={logits:e},a={axis:t};return z.runKernelFunc(i,r,null,Iu,a)}var nv=U({logSoftmax_:ux});function cx(n,t,e){t===void 0&&(t=null),e===void 0&&(e=!1);var i=O(n,"x","logSumExp"),r=Qe(t,i.shape),a=tr(i,r,!0),s=ge(i,a),o=yn(s),l=Ae(o,r),u=er(l),c=fe(V(a,u.shape),u);if(e){var h=nn(c.shape,r);return V(c,h)}return c}var hh=U({logSumExp_:cx});function hx(n,t){var e=O(n,"a","logicalAnd","bool"),i=O(t,"b","logicalAnd","bool");et(e.shape,i.shape);var r={a:e,b:i};return z.runKernelFunc(function(a){return a.logicalAnd(e,i)},r,null,jf)}var nr=U({logicalAnd_:hx});function dx(n){var t=O(n,"x","logicalNot","bool"),e={x:t};return z.runKernelFunc(function(i){return i.logicalNot(t)},e,null,Kf)}var so=U({logicalNot_:dx});function px(n,t){var e=O(n,"a","logicalOr","bool"),i=O(t,"b","logicalOr","bool");et(e.shape,i.shape);var r={a:e,b:i};return z.runKernelFunc(function(a){return a.logicalOr(e,i)},r,null,$f)}var dh=U({logicalOr_:px});function fx(n,t){var e=O(n,"a","logicalXor","bool"),i=O(t,"b","logicalXor","bool");return et(e.shape,i.shape),nr(dh(n,t),so(nr(n,t)))}var iv=U({logicalXor_:fx});function mx(n,t,e,i,r){var a=O(n,"x","maxPool"),s=1,o=a,l=!1;a.rank===3&&(l=!0,o=V(a,[1,a.shape[0],a.shape[1],a.shape[2]])),E(o.rank===4,function(){return"Error in maxPool: input must be rank 4 but got rank "+o.rank+"."}),E(Ht(e,s),function(){return"Error in maxPool: Either strides or dilations must be 1. "+("Got strides "+e+" and dilations '"+s+"'")}),r!=null&&E(rt(i),function(){return"Error in maxPool: pad must be an integer when using, "+("dimRoundingMode "+r+" but got pad "+i+".")});var u=function(p,f){var m=Vr(o.shape,t,e,1,i,r),g;return m.filterWidth===1&&m.filterHeight===1&&hn(m.inShape,m.outShape)?g=o.clone():g=p.maxPool(o,m),f([o,g]),g},c={x:o},h={filterSize:t,strides:e,pad:i,dimRoundingMode:r},d=z.runKernelFunc(u,c,null,xu,h);return l?V(d,[d.shape[1],d.shape[2],d.shape[3]]):d}var ph=U({maxPool_:mx});function gx(n,t,e,i,r,a,s){t===void 0&&(t=[1,1,1]),a===void 0&&(a="NDHWC"),s==null?s=[1,1,1]:At("dilations is deprecated, this field will be gone in v3.0.0.");var o=O(n,"x","maxPool3d"),l=o,u=!1;o.rank===4&&(u=!0,l=V(o,[1,o.shape[0],o.shape[1],o.shape[2],o.shape[3]])),E(l.rank===5,function(){return"Error i
`+("1. The "+i+" is defined in Python, in which ")+`caseitneedstobeportedtoTensorFlow.jsoryourJavaScriptcode.
`+("2. The custom "+i+" is defined in JavaScript, ")+"but is not registered properly with tf.serialization.registerClass().");return u}else{var c=n;if(c.className==null||c.config==null)throw new M(i+": Improper config format: "+(JSON.stringify(c)+`.
`)+"'className' and 'config' must set.");var h=c.className,d=void 0,p=void 0;if(h in e?(a=e[h],d=a[0],p=a[1]):h in dn?(s=dn.className,d=s[0],p=s[1]):h in t&&(o=t[h],d=o[0],p=o[1]),d==null)throw new M("Unknown "+i+": "+h+`.Thismaybeduetooneofthefollowingreasons:
`+("2. The custom "+i+" is defined in JavaScript, ")+"but is not registered properly with tf.serialization.registerClass().");if(p!=null){for(var f={},m=0,g=Object.keys(dn);m<g.length;m++){var v=g[m];f[v]=dn[v]}for(var b=0,w=Object.keys(e);b<w.length;b++){var v=w[b];f[v]=e[v]}var S=c.config;S.customObjects=f;for(var L=Kt({},dn),N=0,C=Object.keys(e);N<C.length;N++){var v=C[N];dn[v]=e[v]}Ph(c.config);var R=p(d,c.config,e,r);return dn=Kt({},L),R}else{for(var L=Kt({},dn),D=0,k=Object.keys(e);D<k.length;D++){var v=k[D];dn[v]=e[v]}var R=new d(c.config);return dn=Kt({},L),R}}}function Mk(n,t){return n<t?-1:n>t?1:0}function Io(n,t){return-1*Mk(n,t)}function Ti(n){if(n==null)return n;for(var t=[],e=0,i=n;e<i.length;e++){var r=i[e];t.indexOf(r)===-1&&t.push(r)}return t}function Hk(n){if(n==null)throw new M("Invalid value in obj: "+JSON.stringify(n));for(var t in n)if(n.hasOwnProperty(t))return!1;return!0}function ea(n,t,e){if(e==null)return;if(n.indexOf(e)<0)throw new M(e+" is not a valid "+t+". Valid values are "+n+" or null/undefined.")}function _h(n,t,e,i){return e===void 0&&(e=0),i===void 0&&(i=Infinity),_n(e>=0),_n(i>=e),Array.isArray(n)&&n.length>=e&&n.length<=i&&n.every(function(r){return typeof r===t})}function Tt(n,t){Array.isArray(n)?(y.util.assert(n.length>0,function(){return t+" is unexpectedly an empty array."}),n.forEach(function(e,i){return Tt(e,"element "+(i+1)+" of "+t)})):y.util.assert(Number.isInteger(n)&&n>0,function(){return"Expected "+t+" to be a positive integer, but got "+(ay(n)+".")})}function ay(n){return n===null?"null":Array.isArray(n)?"["+n.map(function(t){return ay(t)}).join(",")+"]":typeof n=="string"?'"'+n+'"':""+n}function Vk(n,t){var e=y.util.now(),i,r=function(){for(var a=[],s=0;s<arguments.length;s++)a[s]=arguments[s];var o=y.util.now();return o-e<t||(e=o,i=n.apply(void 0,a)),i};return r}function sy(n){return n==="relu"?"relu":n==="linear"?"linear":n==="elu"?"elu":null}function Mh(n,t){return y.tidy(function(){return y.sqrt(y.sum(y.mul(n,n),t,!0))})}var Za=function(n){Q(t,n);function t(){return n!==null&&n.apply(this,arguments)||this}return t.prototype.getConfig=function(){return{}},t}(y.serialization.Serializable),oy=function(n){Q(t,n);function t(e){var i=n.call(this)||this;return i.defaultMaxValue=2,i.defaultAxis=0,i.maxValue=e.maxValue!=null?e.maxValue:i.defaultMaxValue,i.axis=e.axis!=null?e.axis:i.defaultAxis,i}return t.prototype.apply=function(e){var i=this;return y.tidy(function(){var r=Mh(e,i.axis),a=y.clipByValue(r,0,i.maxValue);return y.mul(e,y.div(a,y.add(yt(),r)))})},t.prototype.getConfig=function(){return{maxValue:this.maxValue,axis:this.axis}},t.className="MaxNorm",t}(Za);y.serialization.registerClass(oy);var ly=function(n){Q(t,n);function t(e){var i=n.call(this)||this;return i.defaultAxis=0,i.axis=e.axis!=null?e.axis:i.defaultAxis,i}return t.prototype.apply=function(e){var i=this;return y.tidy(function(){return y.div(e,y.add(yt(),Mh(e,i.axis)))})},t.prototype.getConfig=function(){return{axis:this.axis}},t.className="UnitNorm",t}(Za);y.serialization.registerClass(ly);var uy=function(n){Q(t,n);function t(){return n!==null&&n.apply(this,arguments)||this}return t.prototype.apply=function(e){return y.relu(e)},t.className="NonNeg",t}(Za);y.serialization.registerClass(uy);var cy=function(n){Q(t,n);function t(e){var i=n.call(this)||this;return i.defaultMinValue=0,i.defaultMaxValue=1,i.defaultRate=1,i.defaultAxis=0,i.minValue=e.minValue!=null?e.minValue:i.defaultMinValue,i.maxValue=e.maxValue!=null?e.maxValue:i.defaultMaxValue,i.rate=e.rate!=null?e.rate:i.defaultRate,i.axis=e.axis!=null?e.axis:i.defaultAxis,i}return t.prototype.apply=function(e){var i=this;return y.tidy(function(){var r=Mh(e,i.axis),a=y.add(y.mul(i.rate,y.clipByValue(r,i.minValue,i.maxValue)),y.mul(1-i.rate,r));return y.mul(e,y.div(a,y.add(yt(),r)))})},t.prototype.getConfig=function(){return{minValue:this.minValue,maxValue:this.maxValue,rate:this.rate,axis:this.axis}},t.className="MinMaxNorm",t}(Za);y.serialization.registerClass(cy);var hy={maxNorm:"MaxNorm",minMaxNorm:"MinMaxNorm",nonNeg:"NonNeg",unitNorm:"UnitNorm"};fun
becausethevaluedtypeis`+e.dtype+", but TensorArray dtype is "+this.dtype+".");if(this.size()===0&&(this.elementShape==null||this.elementShape.length===0)&&(this.elementShape=e.shape),fn(this.elementShape,e.shape,"TensorArray "+this.name+": Could not write to TensorArray index "+t+"."),i.read)throw new Error("TensorArray "+this.name+": Could not write to TensorArray index "+t+", because it has already been read.");if(i.written)throw new Error("TensorArray "+this.name+": Could not write to TensorArray index "+t+", because it has already been written.");i.tensor=e,B.keep(e),i.written=!0,this.tensors[t]=i},n.prototype.writeMany=function(t,e){var i=this;if(t.length!==e.length)throw new Error("TensorArray "+this.name+": could not write multiple tensors,"+("because the index size: "+t.length+" is not the same as tensors size: "+e.length+"."));t.forEach(function(r,a){return i.write(r,e[a])})},n.prototype.gather=function(t,e){if(!!e&&e!==this.dtype)throw new Error("TensorArray dtype is "+this.dtype+" but gather requested dtype "+e);if(t)t=t.slice(0,this.size());else{t=[];for(var i=0;i<this.size();i++)t.push(i)}if(t.length===0)return B.tensor([],[0].concat(this.elementShape));var r=this.readMany(t);return fn(this.elementShape,r[0].shape,"TensorArray shape mismatch: "),B.stack(r,0)},n.prototype.concat=function(t){if(!!t&&t!==this.dtype)throw new Error("TensorArray dtype is "+this.dtype+" but concat requested dtype "+t);if(this.size()===0)return B.tensor([],[0].concat(this.elementShape));for(var e=[],i=0;i<this.size();i++)e.push(i);var r=this.readMany(e);return fn(this.elementShape,r[0].shape,"TensorArray shape mismatch: tensor array shape ("+this.elementShape+") vs first tensor shape ("+r[0].shape+")"),B.concat(r,0)},n.prototype.scatter=function(t,e){if(e.dtype!==this.dtype)throw new Error("TensorArray dtype is "+this.dtype+" but tensor has dtype "+e.dtype);if(t.length!==e.shape[0])throw new Error("Expected len(indices) == tensor.shape[0], but saw: "+t.length+" vs. "+e.shape[0]);var i=Math.max.apply(Math,t);if(!this.dynamicSize&&i>=this.maxSize)throw new Error("Max index must be < array size ("+i+" vs. "+this.maxSize+")");this.writeMany(t,B.unstack(e,0))},n.prototype.split=function(t,e){var i=this;if(e.dtype!==this.dtype)throw new Error("TensorArray dtype is "+this.dtype+" but tensor has dtype "+e.dtype);var r=0,a=t.map(function(c){return r+=c,r});if(r!==e.shape[0])throw new Error(`Expectedsumoflengthstobeequalto
`+r+", and tensor's shape is: "+e.shape);if(!this.dynamicSize&&t.length!==this.maxSize)throw new Error("TensorArray's size is not equal to the size of lengths ("+this.maxSize+" vs. "+t.length+"), and the TensorArray is not marked as dynamically resizeable");var s=r===0?0:e.size/r,o=[];B.tidy(function(){e=B.reshape(e,[1,r,s]);for(var c=0;c<t.length;++c){var h=c===0?0:a[c-1],d=[0,h,0],p=[1,t[c],s];o[c]=B.reshape(B.slice(e,d,p),i.elementShape)}return o});for(var l=[],u=0;u<t.length;u++)l[u]=u;this.writeMany(l,o)},n}();var jo=function(){function n(t,e,i,r){r===void 0&&(r=-1),this.tensors=t,this.elementShape=e,this.elementDtype=i,t!=null&&t.forEach(function(a){if(i!==a.dtype)throw new Error("Invalid data types; op elements "+i+", but list elements "+a.dtype);fn(e,a.shape,"TensorList shape mismatch: "),B.keep(a)}),this.idTensor=B.scalar(0),this.maxNumElements=r,B.keep(this.idTensor)}return Object.defineProperty(n.prototype,"id",{get:function(){return this.idTensor.id},enumerable:!0,configurable:!0}),n.prototype.copy=function(){return new n(this.tensors.slice(),this.elementShape,this.elementDtype)},n.prototype.clearAndClose=function(t){this.tensors.forEach(function(e){(t==null||!t.has(e.id))&&e.dispose()}),this.tensors.length=0,this.idTensor.dispose()},n.prototype.size=function(){return this.tensors.length},n.prototype.stack=function(t,e,i){var r=this;if(i===void 0&&(i=-1),e!==this.elementDtype)throw new Error("Invalid data types; op elements "+e+", but list elements "+this.elementDtype);if(i!==-1&&this.tensors.length!==i)throw new Error("Operation expected a list with "+i+" elements but got a list with "+this.tensors.length+" elements.");return fn(t,this.elementShape,"TensorList shape mismatch: "),B.tidy(function(){var a=r.tensors.map(function(s){return B.reshape(s,t)});return B.stack(a,0)})},n.prototype.popBack=function(t,e){if(e!==this.elementDtype)throw new Error("Invalid data types; op elements "+e+", but list elements "+this.elementDtype);if(this.size()===0)throw new Error("Trying to pop from an empty list.");var i=this.tensors.pop();return fn(i.shape,t,"TensorList shape mismatch: "),B.reshape(i,t)},n.prototype.pushBack=function(t){if(t.dtype!==this.elementDtype)throw new Error("Invalid data types; op elements "+t.dtype+", but list elements "+this.elementDtype);if(fn(t.shape,this.elementShape,"TensorList shape mismatch: "),this.maxNumElements===this.size())throw new Error("Trying to push element into a full list.");B.keep(t),this.tensors.push(t)},n.prototype.resize=function(t){if(t<0)throw new Error("TensorListResize expects size to be non-negative. Got: "+t);if(this.maxNumElements!==-1&&t>this.maxNumElements)throw new Error("TensorListResize input size "+t+" is greater maxNumElement "+this.maxNumElements+".");this.tensors.length=t},n.prototype.getItem=function(t,e,i){if(i!==this.elementDtype)throw new Error("Invalid data types; op elements "+i+", but list elements "+this.elementDtype);if(t<0||t>this.tensors.length)throw new Error("Trying to access element "+t+" in a list with "+this.tensors.length+" elements.");if(this.tensors[t]==null)throw new Error("element at index "+t+" is null.");return fn(this.tensors[t].shape,e,"TensorList shape mismatch: "),this.tensors[t]},n.prototype.setItem=function(t,e){if(e.dtype!==this.elementDtype)throw new Error("Invalid data types; op elements "+e.dtype+", but list elements "+this.elementDtype);if(t<0||this.maxNumElements!==-1&&t>=this.maxNumElements)throw new Error("Trying to set element "+t+" in a list with max "+this.maxNumElements+" elements.");fn(this.elementShape,e.shape,"TensorList shape mismatch: "),B.keep(e),this.tensors[t]=e},n.prototype.gather=function(t,e,i){var r=this;if(e!==this.elementDtype)throw new Error("Invalid data types; op elements "+e+", but list elements "+this.elementDtype);return fn(this.elementShape,i,"TensorList shape mismatch: "),t=t.slice(0,this.size()),t.length===0?B.tensor([],[0].concat(this.elementShape)):B.tidy(function(){var a=t.map(function(s){return B.reshape(r.tensors[s],i)});return B.stack(a,0)})},n.prototype.concat=function(t,e){var i=thi
`).map(function(s){return s.endsWith("\r")&&(s=s.slice(0,-1)),s}),[2,r]}})})},t}(hs);var $o='"',ds=Symbol("out"),n0=Symbol("field"),Xo=Symbol("quote"),qd=Symbol("quoteafterquote"),i0=Symbol("quoteinquote"),r0=function(n){Ve(t,n);function t(e,i){var r=n.call(this)||this;return r.input=e,r.hasHeader=!0,r.fullColumnNames=null,r.columnNamesValidated=!1,r.columnConfigs=null,r.configuredColumnsOnly=!1,r.delimiter=",",r.delimWhitespace=!1,r.base=new t0(e),i||(i={}),r.hasHeader=!(i.hasHeader===!1),r.fullColumnNames=i.columnNames,r.columnConfigs=i.columnConfigs,r.configuredColumnsOnly=i.configuredColumnsOnly,i.delimWhitespace?(Ne.util.assert(i.delimiter==null,function(){return"Delimiter should not be provided when delimWhitespace is true."}),r.delimWhitespace=!0,r.delimiter=" "):r.delimiter=i.delimiter?i.delimiter:",",r}return t.prototype.columnNames=function(){return se(this,void 0,void 0,function(){return oe(this,function(e){switch(e.label){case 0:return this.columnNamesValidated?[3,2]:[4,this.setColumnNames()];case 1:e.sent(),e.label=2;case 2:return[2,this.configuredColumnsOnly?Object.keys(this.columnConfigs):this.fullColumnNames]}})})},t.prototype.setColumnNames=function(){return se(this,void 0,void 0,function(){var e,i,r,a,s,o,l,u=this;return oe(this,function(c){switch(c.label){case 0:return[4,this.maybeReadHeaderLine()];case 1:if(e=c.sent(),!this.fullColumnNames&&!e)throw new Error("Column names must be provided if there is no header line.");if(this.fullColumnNames&&e&&Ne.util.assert(e.length===this.fullColumnNames.length,function(){return"The length of provided columnNames ("+u.fullColumnNames.length.toString()+") does not match the length of the header line read from file ("+e.length.toString()+")."}),this.fullColumnNames||(this.fullColumnNames=e),i=this.fullColumnNames.reduce(function(h,d){return h[d]=h[d]+1||1,h},{}),r=Object.keys(i).filter(function(h){return i[h]>1}),Ne.util.assert(r.length===0,function(){return"Duplicate column names found: "+r.toString()}),this.columnConfigs){for(a=0,s=Object.keys(this.columnConfigs);a<s.length;a++)if(o=s[a],l=this.fullColumnNames.indexOf(o),l===-1)throw new Error('The key "'+o+'" provided in columnConfigs does not match any of the column names ('+this.fullColumnNames.toString()+").")}return this.columnNamesValidated=!0,[2]}})})},t.prototype.maybeReadHeaderLine=function(){return se(this,void 0,void 0,function(){var e,i,r,a;return oe(this,function(s){switch(s.label){case 0:return this.hasHeader?[4,this.base.iterator()]:[3,3];case 1:return e=s.sent(),[4,e.next()];case 2:if(i=s.sent(),i.done)throw new Error("No data was found for CSV parsing.");return r=i.value,a=this.parseRow(r,!1),[2,a];case 3:return[2,null]}})})},t.prototype.iterator=function(){return se(this,void 0,void 0,function(){var e,i=this;return oe(this,function(r){switch(r.label){case 0:return this.columnNamesValidated?[3,2]:[4,this.setColumnNames()];case 1:r.sent(),r.label=2;case 2:return[4,this.base.iterator()];case 3:return e=r.sent(),this.hasHeader&&(e=e.skip(1)),[2,e.map(function(a){return i.makeDataElement(a)})]}})})},t.prototype.makeDataElement=function(e){for(var i=this.parseRow(e),r={},a={},s=0;s<this.fullColumnNames.length;s++){var o=this.fullColumnNames[s],l=this.columnConfigs?this.columnConfigs[o]:null;if(this.configuredColumnsOnly&&!l)continue;var u=i[s],c=null;if(u==="")if(l&&l.default!==void 0)c=l.default;else{if(l&&(l.required||l.isLabel))throw new Error("Required column "+o+" is empty in this line: "+e);c=void 0}else{var h=Number(u);if(isNaN(h))l&&l.dtype==="bool"?c=this.getBoolean(u):c=u;else if(!l||!l.dtype)c=h;else switch(l.dtype){case"float32":c=h;break;case"int32":c=Math.floor(h);break;case"bool":c=this.getBoolean(u);break;default:c=h}}l&&l.isLabel?a[o]=c:r[o]=c}return Object.keys(a).length===0?r:{xs:r,ys:a}},t.prototype.getBoolean=function(e){return e==="1"||e.toLowerCase()==="true"?1:0},t.prototype.parseRow=function(e,i){i===void 0&&(i=!0);for(var r=[],a=0,s=e.length,o=ds,l=0;l<s;l++)switch(o){case ds:switch(e.charAt(l)){case $o:a=l+1,o=Xo;break;case this.delimiter:if(a=l+1,this.delimiter===" "&&this
Hithere👋.LookslikeyouarerunningTensorFlow.jsinNode.js.Tospeedthingsupdramatically,installournodebackend,whichbindstoTensorFlowC++,byrunningnpmi@tensorflow/tfjs-node,ornpmi@tensorflow/tfjs-node-gpuifyouhaveCUDA.Thencallrequire('@tensorflow/tfjs-node');(-gpusuffixforCUDA)atthestartofyourprogram.Visithttps://github.com/tensorflow/tfjs-node for more details.
returnmod(a,b);`,F5="return (b >= 1.0) ? a : a * (b + 1.0);",FS="return (a < 0.) ? b * a : a;",St=function(){function n(t,e,i){this.variableNames=["A","B"],this.outputShape=x.backend_util.assertAndGetBroadcastShape(e,i),this.userCode=`
`}return n.prototype.getCustomSetupFunc=function(t){var e=this;return function(i,r){e.index==null&&(e.index=i.getUniformLocation(r,"index")),i.gl.uniform1f(e.index,t)}},n}();function PS(n,t){if(n===1)return""+t;if(n===2)return t+".x, "+t+".y";if(n===3)return t+".x, "+t+".y, "+t+".z";if(n===4)return t+".x, "+t+".y, "+t+".z, "+t+".w";throw Error("Cumulative sum for rank "+n+" is not yet supported")}function _S(n,t){if(n===1)return""+t;if(n===2)return t+".y";if(n===3)return t+".z";if(n===4)return t+".w";throw Error("Cumulative sum for rank "+n+" is not yet supported")}var l9=function(){function n(t){this.variableNames=["A"],this.packedInputs=!1,this.packedOutput=!0,this.outPackingScheme=vs.DENSE;var e=bs(t),i=Bt();this.outputShape=t,this.userCode=`
`}return n}();var Y9=function(){function n(t,e){this.variableNames=["x"];var i=t.length;if(i>4)throw new Error("WebGL backend: Reverse of rank-"+i+" tensor is not yet supported");if(this.outputShape=t,i===1){this.userCode=`
`}return n}();var $9=function(){function n(t,e,i){this.variableNames=["c","a","b"],this.outputShape=e;var r,a;if(i>4)throw Error("Where for rank "+i+" is not yet supported");if(i===1)a="resRC",r="resRC";else{for(var s=["resRC.x","resRC.y","resRC.z","resRC.w"],o=[],l=[],u=0;u<e.length;u++)l.push(""+s[u]),u<t&&o.push(""+s[u]);r=o.join(),a=l.join()}var c=Ze(i);this.userCode=`
`}return n.prototype.getCustomSetupFunc=function(t){var e=this;if(t.length!==this.rank)throw Error("The rank ("+this.rank+") of the program must match the "+("length of start ("+t.length+")"));return function(i,r){if(e.startLoc==null&&(e.startLoc=i.getUniformLocationNoThrow(r,"start"),e.startLoc==null))return;i.gl.uniform1iv(e.startLoc,t)}},n}(),Ap=["x","y","z","w","u","v"];function X9(n){if(n===1)return"sourceLoc";if(n<=6)return Ap.slice(0,n).map(function(t){return"sourceLoc."+t}).join(",");throw Error("Slicing for rank "+n+" is not yet supported")}var Z9=function(){function n(t){this.variableNames=["source"],this.packedInputs=!0,this.packedOutput=!0,this.outputShape=t,this.rank=t.length;var e=Ze(this.rank),i=Qt("coords",this.rank),r=Qt("sourceLoc",this.rank),a=this.rank===1?"sourceLoc":"vec2("+r.slice(-2).join()+")",s="getChannel(getSource("+r.join()+"), "+a+")",o=`
`}return n.prototype.getCustomSetupFunc=function(t){var e=this;if(t.length!==this.rank)throw Error("The rank ("+this.rank+") of the program must match the "+("length of start ("+t.length+")"));return function(i,r){if(e.startLoc==null&&(e.startLoc=i.getUniformLocationNoThrow(r,"start"),e.startLoc==null))return;i.gl.uniform1iv(e.startLoc,t)}},n}();var Q9=function(){function n(t,e,i){this.variableNames=["x"],this.outputShape=i;var r=i.length,a=Ze(i.length),s=Ze(i.length),o="";if(r===1)o="coords * strides + begin";else{var l=0;o=i.map(function(u,c){return l++,i.length===1?"coords * strides["+c+"] + begin["+c+"]":"coords["+(l-1)+"] * strides["+c+"] + begin["+c+"]"}).join(",")}this.userCode=`
`}return n}();var NL=x.backend_util.segment_util,U6=x.kernel_impls.split,B6=x.kernel_impls.tile,z6=x.kernel_impls.topkImpl,P6=x.kernel_impls.whereImpl,_6=1e-7,M6=1e-4,cl={};function H6(n){return n in cl||(cl[n]={}),cl[n]}function hl(n,t){if(t===void 0&&(t=!1),n==="linear")return t?k6:s6;if(n==="relu")return t?IL:mL;if(n==="elu")return t?TL:vL;if(n==="relu6")return t?AL:gL;if(n==="prelu")return t?WS:FS;throw new Error("Activation "+n+" has not been implemented for the WebGL backend.")}var V6=128,q6=600;function G6(){return x.env().global.screen==null?1024:x.env().global.screen.height*x.env().global.screen.width*window.devicePixelRatio*q6/1024/1024}var xL=1e3,CL=function(n){H_(t,n);function t(e){var i=n.call(this)||this;if(i.pendingRead=new WeakMap,i.pendingDisposal=new WeakSet,i.dataRefCount=new WeakMap,i.numBytesInGPU=0,i.uploadWaitMs=0,i.downloadWaitMs=0,i.warnedAboutMemory=!1,i.warnedAboutCPUBackend=!1,i.pendingDeletes=0,i.disposed=!1,!x.env().getBool("HAS_WEBGL"))throw new Error("WebGL is not supported on this device");if(e==null){var r=Gn(x.env().getNumber("WEBGL_VERSION"));i.binaryCache=H6(x.env().getNumber("WEBGL_VERSION")),i.gpgpu=new sL(r),i.canvas=r.canvas,i.gpgpuCreatedLocally=!0}else i.gpgpu=e,i.binaryCache={},i.gpgpuCreatedLocally=!1,i.canvas=e.gl.canvas;return i.textureManager=new e6(i.gpgpu),i.numMBBeforeWarning=G6(),i.texData=new x.DataStorage(i,x.engine()),i}return t.prototype.numDataIds=function(){return this.texData.numDataIds()+(this.cpuBackend?this.cpuBackend.numDataIds():0)-this.pendingDeletes},t.prototype.write=function(e,i,r){if((x.env().getBool("WEBGL_CHECK_NUMERICAL_PROBLEMS")||x.env().getBool("DEBUG"))&&this.checkNumericalProblems(e),r==="complex64"&&e!=null)throw new Error("Cannot write to a complex64 dtype. Please use tf.complex(real, imag).");var a={};return this.texData.set(a,{shape:i,dtype:r,values:e,usage:sn.UPLOAD,refCount:1}),a},t.prototype.incRef=function(e){var i=this.texData.get(e);i.refCount++},t.prototype.decRef=function(e){if(this.texData.has(e)){var i=this.texData.get(e);i.refCount--}},t.prototype.move=function(e,i,r,a){if(x.env().getBool("DEBUG")&&this.checkNumericalProblems(i),a==="complex64")throw new Error("Cannot write to a complex64 dtype. Please use tf.complex(real, imag).");this.texData.set(e,{shape:r,dtype:a,values:i,usage:sn.UPLOAD,refCount:1})},t.prototype.disposeIntermediateTensorInfo=function(e){var i=e.dataId;if(this.texData.has(i)){var r=this.texData.get(i);r.refCount--,r.refCount<1&&this.disposeData(i)}},t.prototype.readSync=function(e){var i=this.texData.get(e),r=i.values,a=i.dtype,s=i.complexTensors,o=i.slice,l=i.shape,u=i.isPacked;if(o!=null){var c=void 0;u?c=new Ts(l,ul):c=new Re(l,ul);var h=this.runWebGLProgram(c,[{dataId:e,shape:l,dtype:a}],a),d=this.readSync(h.dataId);return this.disposeIntermediateTensorInfo(h),d}if(r!=null)return this.convertAndCacheOnCPU(e);if(a==="string")return r;var p=this.activeTimers!=null,f;p&&(f=x.util.now());var m;if(a==="complex64"){var g=s.real.dataSync(),v=s.imag.dataSync();m=x.backend_util.mergeRealAndImagArrays(g,v)}else m=this.getValuesFromTexture(e);return p&&(this.downloadWaitMs+=x.util.now()-f),this.convertAndCacheOnCPU(e,m)},t.prototype.read=function(e){return Qo(this,void 0,void 0,function(){var i,r,a,s,o,l,u,c,h,d,p,f,m,g,v,b,w,S,L,N,C,R;return el(this,function(D){switch(D.label){case 0:if(this.pendingRead.has(e))return i=this.pendingRead.get(e),[2,new Promise(function(k){return i.push(k)})];if(r=this.texData.get(e),a=r.values,s=r.shape,o=r.slice,l=r.dtype,u=r.complexTensors,c=r.isPacked,o!=null)return h=void 0,c?h=new Ts(s,ul):h=new Re(s,ul),d=this.runWebGLProgram(h,[{dataId:e,shape:s,dtype:l}],l),p=this.read(d.dataId),this.disposeIntermediateTensorInfo(d),[2,p];if(a!=null)return[2,this.convertAndCacheOnCPU(e)];if(!x.env().getBool("WEBGL_DOWNLOAD_FLOAT_ENABLED")&&x.env().getNumber("WEBGL_VERSION")===2)throw new Error("tensor.data() with WEBGL_DOWNLOAD_FLOAT_ENABLED=false and WEBGL_VERSION=2 not yet supported.");return f=null,l!=="complex64"&&x.env().get("WEBGL_BUFFER_SUPPORTED")&&(m=this.decode(e),g=this.texData.
`}return n}();var l8=function(n){var t=n.inputs,e=n.backend,i=n.attrs,r=t.x,a=t.mean,s=t.variance,o=t.offset,l=t.scale;x.util.assert(a.shape.length===s.shape.length,function(){return"Batch normalization gradient requires mean and variance to have equal ranks."}),x.util.assert(o==null||a.shape.length===o.shape.length,function(){return"Batch normalization gradient requires mean and offset to have equal ranks."}),x.util.assert(l==null||a.shape.length===l.shape.length,function(){return"Batch normalization gradient requires mean and scale to have equal ranks."});var u=i.varianceEpsilon;u==null&&(u=.001);var c=[r,a,s],h=null;o!=null&&(h=o.shape,c.push(o));var d=null;l!=null&&(d=l.shape,c.push(l));var p=x.env().getBool("WEBGL_PACK_NORMALIZATION")?new o8(r.shape,a.shape,s.shape,h,d,u):new s8(r.shape,a.shape,s.shape,h,d,u),f=e.runWebGLProgram(p,c,c[0].dtype);return f},u8={kernelName:x.FusedBatchNorm,backendName:"webgl",kernelFunc:l8};var c8=OL+`
`}return n}();var L8={kernelName:x.FromPixels,backendName:"webgl",kernelFunc:S8},Sa;function S8(n){var t=n.inputs,e=n.backend,i=n.attrs,r=t.pixels,a=i.numChannels,s=typeof HTMLVideoElement!="undefined"&&r instanceof HTMLVideoElement,o=typeof HTMLImageElement!="undefined"&&r instanceof HTMLImageElement,l=s?[r.videoWidth,r.videoHeight]:[r.width,r.height],u=l[0],c=l[1],h=[c,u],d=[c,u,a];(o||s)&&(Sa==null&&(Sa=document.createElement("canvas").getContext("2d")),Sa.canvas.width=u,Sa.canvas.height=c,Sa.drawImage(r,0,0,u,c),r=Sa.canvas);var p=e.makeTensorInfo(h,"int32");e.texData.get(p.dataId).usage=sn.PIXELS,e.gpgpu.uploadPixelDataToTexture(e.getTexture(p.dataId),r);var f=x.env().getBool("WEBGL_PACK")?new w8(d):new b8(d),m=e.runWebGLProgram(f,[p],"int32");return e.disposeData(p.dataId),m}function I8(n){for(var t=[];t.length===0||t[t.length-1].outSize!==1;){var e=t.length?t[t.length-1].outSize:n[1],i=x.backend_util.computeOptimalWindowSize(e);t.push({inSize:e,windowSize:i,outSize:Math.ceil(e/i)})}return t}function A8(n,t,e,i){for(var r=I8(n.shape),a=n,s=0;s<r.length;s++){var o=r[s],l=o.inSize,u=o.windowSize,c=o.outSize,h=new lL({windowSize:u,inSize:l,batchSize:n.shape[0],outSize:c},e),d=a;a=i.runWebGLProgram(h,[a],t),d.dataId!==n.dataId&&i.disposeData(d.dataId)}return a}function T8(n,t,e){var i=[Lr(n.shape)].concat(Ir(n.shape)),r={dtype:n.dtype,shape:i,dataId:n.dataId},a=[Lr(t)].concat(Ir(t)),s=new uL(a,i),o=!0,l=e.runWebGLProgram(s,[r],n.dtype,null,o);return{dataId:l.dataId,shape:t,dtype:l.dtype}}function xp(n){var t=n.inputs,e=n.backend,i=n.attrs,r=t.x,a=i.shape,s=e,o=x.util.sizeFromShape(r.shape),l=x.util.inferFromImplicitShape(a,o),u=x.util.sizeFromShape(l);x.util.assert(o===u,function(){return"The new shape ("+l+") has "+u+" elements and the old "+("shape ("+r.shape+") has "+o+" elements. The new shape and old ")+"shape must have the same number of elements."});var c=s.texData.get(r.dataId);return c.isPacked&&!Ls(r.shape,l)&&!(c.texture!==null&&Ls(c.shape,l))?T8(r,l,s):(s.incRef(r.dataId),{dataId:r.dataId,shape:l,dtype:r.dtype})}var N8={kernelName:x.Reshape,backendName:"webgl",kernelFunc:xp};function x8(n,t,e,i){var r=x.util.sizeFromShape(t),a=x.util.sizeFromShape(n.shape),s=a/r,o=xp({inputs:{x:n},attrs:{shape:[s,r]},backend:i}),l=A8(o,n.dtype,"max",i),u=xp({inputs:{x:l},attrs:{shape:e},backend:i});return i.disposeIntermediateTensorInfo(o),i.disposeIntermediateTensorInfo(l),u}var R8=function(){function n(t,e){this.variableNames=["A"];for(var i=new Array(t.length),r=0;r<i.length;r++)i[r]=t[e[r]];this.outputShape=i,this.rank=i.length;var a=Ze(this.rank),s=C8(e);this.userCode=`