museaikit
Version:
A powerful music-focused AI toolkit
2 lines • 573 kB
JavaScript
/*! For license information please see ddsp.js.LICENSE.txt */
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("@tensorflow/tfjs"),require("tone")):"function"==typeof define&&define.amd?define(["tf","Tone"],t):"object"==typeof exports?exports.ddsp=t(require("@tensorflow/tfjs"),require("tone")):e.ddsp=t(e.tf,e.Tone)}(self,((e,t)=>(()=>{var n={41:(e,t,n)=>{"use strict";n.d(t,{GJ:()=>r,uI:()=>o});class r{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}}class o{time(e){return s("time")}read(e){return s("read")}readSync(e){return s("readSync")}numDataIds(){return s("numDataIds")}disposeData(e){return s("disposeData")}write(e,t,n){return s("write")}move(e,t,n,r){return s("move")}memory(){return s("memory")}floatPrecision(){return s("floatPrecision")}epsilon(){return 32===this.floatPrecision()?1e-7:1e-4}batchMatMul(e,t,n,r){return s("batchMatMul")}fusedBatchMatMul({a:e,b:t,transposeA:n,transposeB:r,bias:o,activation:a,preluActivationWeights:i}){return s("fusedBatchMatMul")}slice(e,t,n){return s("slice")}stridedSlice(e,t,n,r){return s("stridedSlice")}unstack(e,t){return s("unstack")}reverse(e,t){return s("reverse")}concat(e,t){return s("concat")}neg(e){return s("neg")}add(e,t){return s("add")}addN(e){return s("addN")}subtract(e,t){return s("subtract")}multiply(e,t){return s("multiply")}realDivide(e,t){return s("realDivide")}floorDiv(e,t){return s("floorDiv")}sum(e,t){return s("sum")}prod(e,t){return s("prod")}unsortedSegmentSum(e,t,n){return s("unsortedSegmentSum")}argMin(e,t){return s("argMin")}argMax(e,t){return s("argMax")}equal(e,t){return s("equal")}notEqual(e,t){return s("notEqual")}less(e,t){return s("less")}lessEqual(e,t){return s("lessEqual")}greater(e,t){return s("greater")}greaterEqual(e,t){return s("greaterEqual")}logicalNot(e){return s("logicalNot")}logicalAnd(e,t){return s("logicalAnd")}logicalOr(e,t){return s("logicalOr")}where(e){return s("where")}select(e,t,n){return s("select")}topk(e,t,n){return s("topk")}min(e,t){return s("min")}minimum(e,t){return s("minimum")}mod(e,t){return s("mod")}max(e,t){return s("max")}maximum(e,t){return s("maximum")}all(e,t){return s("all")}any(e,t){return s("any")}squaredDifference(e,t){return s("squaredDifference")}ceil(e){return s("ceil")}floor(e){return s("floor")}round(e){return s("round")}sign(e){return s("sign")}isNaN(e){return s("isNaN")}isInf(e){return s("isInf")}isFinite(e){return s("isFinite")}pow(e,t){return s("pow")}exp(e){return s("exp")}expm1(e){return s("expm1")}softmax(e,t){return s("softmax")}log(e){return s("log")}log1p(e){return s("log1p")}sqrt(e){return s("sqrt")}rsqrt(e){return s("rsqrt")}square(e){return s("square")}reciprocal(e){return s("reciprocal")}relu(e){return s("relu")}relu6(e){return s("relu6")}prelu(e,t){return s("prelu")}elu(e){return s("elu")}eluDer(e,t){return s("eluDer")}selu(e){return s("selu")}int(e){return s("int")}clip(e,t,n){return s("clip")}abs(e){return s("abs")}complexAbs(e){return s("complexAbs")}sigmoid(e){return s("sigmoid")}softplus(e){return s("softplus")}sin(e){return s("sin")}cos(e){return s("cos")}tan(e){return s("tan")}asin(e){return s("asin")}acos(e){return s("acos")}atan(e){return s("atan")}atan2(e,t){return s("atan2")}sinh(e){return s("sinh")}cosh(e){return s("cosh")}tanh(e){return s("tanh")}asinh(e){return s("asinh")}acosh(e){return s("acosh")}atanh(e){return s("atanh")}erf(e){return s("erf")}step(e,t){return s("step")}fusedConv2d({input:e,filter:t,convInfo:n,bias:r,activation:o,preluActivationWeights:a}){return s("fusedConv2d")}conv2d(e,t,n){return s("conv2d")}conv2dDerInput(e,t,n){return s("conv2dDerInput")}conv2dDerFilter(e,t,n){return s("conv2dDerFilter")}fusedDepthwiseConv2D({input:e,filter:t,convInfo:n,bias:r,activation:o,preluActivationWeights:a}){return s("fusedDepthwiseConv2D")}depthwiseConv2D(e,t,n){return s("depthwiseConv2D")}depthwiseConv2DDerInput(e,t,n){return s("depthwiseConv2DDerInput")}depthwiseConv2DDerFilter(e,t,n){return s("depthwiseConv2DDerFilter")}conv3d(e,t,n){return s("conv3d")}conv3dDerInput(e,t,n){return s("conv3dDerInput")}conv3dDerFilter(e,t,n){return s("conv3dDerFilter")}maxPool(e,t){return s("maxPool")}maxPoolBackprop(e,t,n,r){return s("maxPoolBackprop")}avgPool(e,t){return s("avgPool")}avgPoolBackprop(e,t,n){return s("avgPoolBackprop")}avgPool3d(e,t){return s("avgPool3d")}avgPool3dBackprop(e,t,n){return s("avgPool3dBackprop")}maxPool3d(e,t){return s("maxPool3d")}maxPool3dBackprop(e,t,n,r){return s("maxPool3dBackprop")}reshape(e,t){return s("reshape")}cast(e,t){return s("cast")}tile(e,t){return s("tile")}pad(e,t,n){return s("pad")}transpose(e,t){return s("transpose")}gather(e,t,n){return s("gather")}gatherND(e,t){return s("gatherND")}scatterND(e,t,n){return s("scatterND")}batchToSpaceND(e,t,n){return s("batchToSpaceND")}spaceToBatchND(e,t,n){return s("spaceToBatchND")}resizeBilinear(e,t,n,r){return s("resizeBilinear")}resizeBilinearBackprop(e,t,n){return s("resizeBilinearBackprop")}resizeNearestNeighbor(e,t,n,r){return s("resizeNearestNeighbor")}resizeNearestNeighborBackprop(e,t,n){return s("resizeNearestNeighborBackprop")}batchNorm(e,t,n,r,o,a){return s("batchNorm")}localResponseNormalization4D(e,t,n,r,o){return s("localResponseNormalization4D")}LRNGrad(e,t,n,r,o,a,i){return s("LRNGrad")}multinomial(e,t,n,r){return s("multinomial")}oneHot(e,t,n,r){return s("oneHot")}cumsum(e,t,n,r){return s("cumsum")}nonMaxSuppression(e,t,n,r,o){return s("nonMaxSuppression")}fft(e){return s("fft")}ifft(e){return s("ifft")}complex(e,t){return s("complex")}real(e){return s("real")}imag(e){return s("imag")}cropAndResize(e,t,n,r,o,a){return s("cropAndResize")}depthToSpace(e,t,n){return s("depthToSpace")}split(e,t,n){return s("split")}sparseToDense(e,t,n,r){return s("sparseToDense")}diag(e){return s("diag")}fill(e,t,n){return s("fill")}onesLike(e){return s("onesLike")}zerosLike(e){return s("zerosLike")}linspace(e,t,n){return s("linspace")}dispose(){return s("dispose")}}function s(e){throw new Error(`'${e}' not yet implemented or not found in the registry. This kernel may not be supported by the tfjs backend you have chosen`)}},73:(e,t,n)=>{"use strict";n.d(t,{o:()=>a});var r=n(6197),o=n(693),s=n(6777);const a=(0,n(3397).op)({clone_:function(e){const t=(0,s.YT)(e,"x","clone",null),n={x:t};return r.T2.runKernelFunc((()=>r.T2.makeTensorFromDataId(t.dataId,t.shape,t.dtype)),n,null,o.lz)}})},239:(e,t,n)=>{"use strict";n.d(t,{qY:()=>x,yl:()=>c,rT:()=>v,B4:()=>m,Q5:()=>g,qP:()=>f});var r=n(7315);function o(e,t,n,o){const a=(0,r.Ur)(t),l=function(e,t,n,o){const a=(0,r.Ze)(t),i=o[o.length-1],l=new Array(i).fill(0),c=t.length,h="complex64"===n?u(e):e;if(c>1)for(let e=0;e<a/i;e++){const t=e*i;for(let e=0;e<i;e++)l[e]=Math.max(l[e],s(h[t+e],0,n).length)}return l}(e,t,n,a),c=t.length,h=i(e,t,n,a,l),d=["Tensor"];return o&&(d.push(` dtype: ${n}`),d.push(` rank: ${c}`),d.push(` shape: [${t}]`),d.push(" values:")),d.push(h.map((e=>" "+e)).join("\n")),d.join("\n")}function s(e,t,n){let o;return o=Array.isArray(e)?`${parseFloat(e[0].toFixed(7))} + ${parseFloat(e[1].toFixed(7))}j`:(0,r.Kg)(e)?`'${e}'`:"bool"===n?a(e):parseFloat(e.toFixed(7)).toString(),(0,r.av)(o,t)}function a(e){return 0===e?"false":"true"}function i(e,t,n,r,o,l=!0){const c="complex64"===n?2:1,h=t[0],d=t.length;if(0===d){if("complex64"===n){return[s(u(e)[0],0,n)]}return"bool"===n?[a(e[0])]:[e[0].toString()]}if(1===d){if(h>20){const t=3*c;let r=Array.from(e.slice(0,t)),a=Array.from(e.slice((h-3)*c,h*c));return"complex64"===n&&(r=u(r),a=u(a)),["["+r.map(((e,t)=>s(e,o[t],n))).join(", ")+", ..., "+a.map(((e,t)=>s(e,o[h-3+t],n))).join(", ")+"]"]}return["["+("complex64"===n?u(e):Array.from(e)).map(((e,t)=>s(e,o[t],n))).join(", ")+"]"]}const p=t.slice(1),f=r.slice(1),g=r[0]*c,m=[];if(h>20){for(let t=0;t<3;t++){const r=t*g,s=r+g;m.push(...i(e.slice(r,s),p,n,f,o,!1))}m.push("...");for(let t=h-3;t<h;t++){const r=t*g,s=r+g;m.push(...i(e.slice(r,s),p,n,f,o,t===h-1))}}else for(let t=0;t<h;t++){const r=t*g,s=r+g;m.push(...i(e.slice(r,s),p,n,f,o,t===h-1))}const x=2===d?",":"";m[0]="["+m[0]+x;for(let e=1;e<m.length-1;e++)m[e]=" "+m[e]+x;let v=",\n";for(let e=2;e<d;e++)v+="\n";return m[m.length-1]=" "+m[m.length-1]+"]"+(l?"":v),m}function u(e){const t=[];for(let n=0;n<e.length;n+=2)t.push([e[n],e[n+1]]);return t}var l=n(6131);class c{constructor(e,t,n){if(this.dtype=t,this.shape=e.slice(),this.size=r.Ze(e),null!=n){const e=n.length;r.vA(e===this.size,(()=>`Length of values '${e}' does not match the size inferred by the shape '${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||r.Ab(t,this.size),this.strides=(0,r.Ur)(e)}set(e,...t){0===t.length&&(t=[0]),r.vA(t.length===this.rank,(()=>`The number of provided coordinates (${t.length}) must match the rank (${this.rank})`));const n=this.locToIndex(t);this.values[n]=e}get(...e){0===e.length&&(e=[0]);let t=0;for(const n of e){if(n<0||n>=this.shape[t]){const t=`Requested out of range element at ${e}. Buffer shape=${this.shape}`;throw new Error(t)}t++}let n=e[e.length-1];for(let t=0;t<e.length-1;++t)n+=this.strides[t]*e[t];return this.values[n]}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 h().makeTensor(this.values,this.shape,this.dtype)}}let h=null,d=null,p=null;function f(e){h=e}function g(e){d=e}function m(e){p=e}class x{constructor(e,t,n,o){this.kept=!1,this.isDisposedInternal=!1,this.shape=e.slice(),this.dtype=t||"float32",this.size=r.Ze(e),this.strides=(0,r.Ur)(e),this.dataId=n,this.id=o,this.rankType=this.rank<5?this.rank.toString():"higher"}get rank(){return this.shape.length}async buffer(){const e=await this.data();return d.buffer(this.shape,this.dtype,e)}bufferSync(){return d.buffer(this.shape,this.dtype,this.dataSync())}async array(){const e=await this.data();return(0,r.yw)(this.shape,e)}arraySync(){return(0,r.yw)(this.shape,this.dataSync())}async data(){this.throwIfDisposed();const e=h().read(this.dataId);if("string"===this.dtype){const t=await e;try{return t.map((e=>l.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}dataSync(){this.throwIfDisposed();const e=h().readSync(this.dataId);if("string"===this.dtype)try{return e.map((e=>l.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 h().read(this.dataId);return"string"===this.dtype?e:new Uint8Array(e.buffer)}dispose(){this.isDisposed||(h().disposeTensor(this),this.isDisposedInternal=!0)}get isDisposed(){return this.isDisposedInternal}throwIfDisposed(){if(this.isDisposed)throw new Error("Tensor is disposed.")}print(e=!1){return d.print(this,e)}clone(){return this.throwIfDisposed(),d.clone(this)}toString(e=!1){return o(this.dataSync(),this.shape,this.dtype,e)}cast(e){return this.throwIfDisposed(),d.cast(this,e)}variable(e=!0,t,n){return this.throwIfDisposed(),h().makeVariable(this,e,t,n)}}Object.defineProperty(x,Symbol.hasInstance,{value:e=>!!e&&null!=e.data&&null!=e.dataSync&&null!=e.throwIfDisposed});class v extends x{constructor(e,t,n,r){super(e.shape,e.dtype,e.dataId,r),this.trainable=t,this.name=n}assign(e){if(e.dtype!==this.dtype)throw new Error(`dtype of the new value (${e.dtype}) and previous value (${this.dtype}) must match`);if(!r.r1(e.shape,this.shape))throw new Error(`shape of the new value (${e.shape}) and previous value (${this.shape}) must match`);h().disposeTensor(this),this.dataId=e.dataId,h().incRef(this,null)}dispose(){h().disposeVariable(this),this.isDisposedInternal=!0}}Object.defineProperty(v,Symbol.hasInstance,{value:e=>e instanceof x&&null!=e.assign&&e.assign instanceof Function})},283:(e,t,n)=>{"use strict";var r=n(9008);function o(){this.argTypes=[],this.shimArgs=[],this.arrayArgs=[],this.arrayBlockIndices=[],this.scalarArgs=[],this.offsetArgs=[],this.offsetArgIndex=[],this.indexArgs=[],this.shapeArgs=[],this.funcName="",this.pre=null,this.body=null,this.post=null,this.debug=!1}e.exports=function(e){var t=new o;t.pre=e.pre,t.body=e.body,t.post=e.post;var n=e.args.slice(0);t.argTypes=n;for(var s=0;s<n.length;++s){var a=n[s];if("array"===a||"object"==typeof a&&a.blockIndices){if(t.argTypes[s]="array",t.arrayArgs.push(s),t.arrayBlockIndices.push(a.blockIndices?a.blockIndices:0),t.shimArgs.push("array"+s),s<t.pre.args.length&&t.pre.args[s].count>0)throw new Error("cwise: pre() block may not reference array args");if(s<t.post.args.length&&t.post.args[s].count>0)throw new Error("cwise: post() block may not reference array args")}else if("scalar"===a)t.scalarArgs.push(s),t.shimArgs.push("scalar"+s);else if("index"===a){if(t.indexArgs.push(s),s<t.pre.args.length&&t.pre.args[s].count>0)throw new Error("cwise: pre() block may not reference array index");if(s<t.body.args.length&&t.body.args[s].lvalue)throw new Error("cwise: body() block may not write to array index");if(s<t.post.args.length&&t.post.args[s].count>0)throw new Error("cwise: post() block may not reference array index")}else if("shape"===a){if(t.shapeArgs.push(s),s<t.pre.args.length&&t.pre.args[s].lvalue)throw new Error("cwise: pre() block may not write to array shape");if(s<t.body.args.length&&t.body.args[s].lvalue)throw new Error("cwise: body() block may not write to array shape");if(s<t.post.args.length&&t.post.args[s].lvalue)throw new Error("cwise: post() block may not write to array shape")}else{if("object"!=typeof a||!a.offset)throw new Error("cwise: Unknown argument type "+n[s]);t.argTypes[s]="offset",t.offsetArgs.push({array:a.array,offset:a.offset}),t.offsetArgIndex.push(s)}}if(t.arrayArgs.length<=0)throw new Error("cwise: No array arguments specified");if(t.pre.args.length>n.length)throw new Error("cwise: Too many arguments in pre() block");if(t.body.args.length>n.length)throw new Error("cwise: Too many arguments in body() block");if(t.post.args.length>n.length)throw new Error("cwise: Too many arguments in post() block");return t.debug=!!e.printCode||!!e.debug,t.funcName=e.funcName||"cwise",t.blockSize=e.blockSize||64,r(t)}},523:(e,t,n)=>{"use strict";let r;function o(){if(null==r){let e;if("undefined"!=typeof window)e=window;else if("undefined"!=typeof global)e=global;else if("undefined"!=typeof process)e=process;else{if("undefined"==typeof self)throw new Error("Could not find a global object");e=self}r=e}return r}function s(e,t){const n=function(){const e=o();return null==e._tfGlobals&&(e._tfGlobals=new Map),e._tfGlobals}();if(n.has(e))return n.get(e);{const r=t();return n.set(e,r),n.get(e)}}n.d(t,{L:()=>o,m:()=>s})},576:(e,t,n)=>{"use strict";n.d(t,{j:()=>i});var r=n(6197),o=n(693),s=n(6777),a=n(3709);const i=(0,n(3397).op)({relu6_:function(e){const t=(0,s.YT)(e,"x","relu6"),n={x:t};return r.T2.runKernelFunc(((e,n)=>(n([t]),"bool"===t.dtype?(0,a.w)(t,"int32"):e.relu6(t))),n,null,o.P_)}})},586:(e,t,n)=>{"use strict";n.d(t,{t:()=>i});var r=n(6197),o=n(693),s=n(6777),a=n(7315);const i=(0,n(3397).op)({reshape_:function(e,t){const n=(0,s.YT)(e,"x","reshape",null),i={x:n},u={shape:t};return r.T2.runKernelFunc(((e,r)=>(t=a.XT(t,n.size),a.vA(n.size===a.Ze(t),(()=>"new shape and old shape must have the same number of elements.")),r([n]),e.reshape(n,t))),i,null,o.R2,u)}})},639:(e,t,n)=>{"use strict";n.d(t,{O:()=>s});var r=n(6777),o=n(7647);function s(e,t,n){const s=(0,r.MZ)(e,n);return(0,o.Q)(e,t,s,n)}},693:(e,t,n)=>{"use strict";n.d(t,{$d:()=>k,A1:()=>N,A8:()=>xt,BK:()=>Ot,BL:()=>Oe,BR:()=>X,Bl:()=>vt,Bx:()=>te,CE:()=>b,Cg:()=>xe,Cw:()=>ge,D7:()=>ot,Dd:()=>bt,E3:()=>de,Ek:()=>i,El:()=>re,Ew:()=>At,FA:()=>It,FC:()=>nt,FS:()=>l,Fi:()=>ft,Hx:()=>it,Ik:()=>C,J3:()=>ht,Ji:()=>lt,Jp:()=>c,K2:()=>yt,KX:()=>E,LB:()=>$,LD:()=>Te,LG:()=>Fe,LR:()=>He,LW:()=>We,LX:()=>be,M3:()=>me,M6:()=>wt,MR:()=>P,Mn:()=>L,NV:()=>Be,Nc:()=>Ke,OA:()=>le,OD:()=>Ye,OM:()=>a,P:()=>q,PH:()=>s,P_:()=>rt,Pb:()=>Ct,Q6:()=>je,QD:()=>T,QK:()=>d,R2:()=>Qe,RU:()=>ve,SD:()=>Me,SQ:()=>ee,TB:()=>St,TL:()=>Re,TM:()=>M,TO:()=>at,Ty:()=>f,Uc:()=>$t,VA:()=>Ee,Vv:()=>o,Wu:()=>mt,X$:()=>V,XQ:()=>et,Xh:()=>ae,YV:()=>dt,Zg:()=>ne,Zl:()=>Ue,_s:()=>H,aw:()=>Dt,bP:()=>Y,cS:()=>y,dF:()=>gt,dX:()=>Rt,dv:()=>ce,e0:()=>Ve,eD:()=>Ae,ep:()=>p,fP:()=>Se,fU:()=>Ze,g5:()=>_e,gC:()=>D,gI:()=>he,hV:()=>st,hg:()=>tt,ho:()=>x,hq:()=>ct,hu:()=>Xe,i:()=>K,i5:()=>oe,iG:()=>F,iP:()=>pe,iu:()=>Tt,jA:()=>w,jM:()=>Ce,jO:()=>Je,jZ:()=>$e,jf:()=>_,jx:()=>z,kd:()=>qe,lL:()=>ie,lN:()=>Ne,lj:()=>r,lx:()=>m,lz:()=>ue,mI:()=>fe,mx:()=>se,nV:()=>W,nY:()=>B,nZ:()=>ye,oF:()=>Et,ox:()=>Z,p2:()=>A,pP:()=>_t,p_:()=>h,pk:()=>G,pn:()=>Ft,pr:()=>S,py:()=>Ge,rF:()=>R,rG:()=>J,rs:()=>j,t2:()=>O,t3:()=>Ie,tG:()=>U,u$:()=>ut,u8:()=>u,ur:()=>ze,v:()=>I,vI:()=>pt,vq:()=>v,wx:()=>kt,x7:()=>De,xJ:()=>Nt,xu:()=>Le,yS:()=>ke,yb:()=>Q,yl:()=>Pe,zP:()=>g,zf:()=>we});const r="Abs",o="Acos",s="Acosh",a="Add",i="AddN",u="All",l="Any",c="ArgMax",h="ArgMin",d="Asin",p="Asinh",f="Atan",g="Atanh",m="Atan2",x="AvgPool",v="AvgPoolBackprop",y="AvgPool3D",b="AvgPool3DBackprop",w="BatchMatMul",C="BatchToSpaceND",$="BroadcastTo",E="Cast",T="Ceil",I="ClipByValue",S="Complex",k="Concat",A="Conv2D",R="Conv2DBackpropFilter",_="Conv2DBackpropInput",N="Conv3D",F="Conv3DBackpropFilterV2",D="Conv3DBackpropInputV2",O="Cos",L="Cosh",B="Cumsum",P="CropAndResize",M="DepthToSpace",U="DepthwiseConv2dNative",V="DepthwiseConv2dNativeBackpropFilter",W="DepthwiseConv2dNativeBackpropInput",z="Dilation2D",Y="Dilation2DBackpropInput",G="Dilation2DBackpropFilter",K="Div",q="Elu",j="EluGrad",H="Erf",X="Equal",Z="Exp",Q="Expm1",J="FFT",ee="Fill",te="FlipLeftRight",ne="Floor",re="FloorDiv",oe="FusedBatchNorm",se="GatherV2",ae="Greater",ie="GreaterEqual",ue="Identity",le="IFFT",ce="Imag",he="IsFinite",de="IsInf",pe="IsNan",fe="Less",ge="LessEqual",me="Log",xe="Log1p",ve="LogicalAnd",ye="LogicalNot",be="LogicalOr",we="LogSoftmax",Ce="LRN",$e="LRNBackprop",Ee="Max",Te="Maximum",Ie="MaxPool",Se="MaxPoolBackprop",ke="MaxPool3D",Ae="MaxPool3DBackprop",Re="MaxPoolWithArgmax",_e="Mean",Ne="Min",Fe="Minimum",De="MirrorPad",Oe="Mod",Le="Multiply",Be="Negate",Pe="NotEqual",Me="NonMaxSuppressionV3",Ue="NonMaxSuppressionV4",Ve="NonMaxSuppressionV5",We="OnesLike",ze="OneHot",Ye="PadV2",Ge="Pow",Ke="Prelu",qe="Prod",je="Range",He="Real",Xe="Reciprocal",Ze="Relu",Qe="Reshape",Je="ResizeNearestNeighbor",et="ResizeNearestNeighborGrad",tt="ResizeBilinear",nt="ResizeBilinearGrad",rt="Relu6",ot="Reverse",st="Round",at="Rsqrt",it="SelectV2",ut="Selu",lt="Slice",ct="Sin",ht="Sinh",dt="Sign",pt="Sigmoid",ft="Softplus",gt="Sqrt",mt="Sum",xt="SpaceToBatchND",vt="SplitV",yt="Softmax",bt="SquaredDifference",wt="Square",Ct="Sub",$t="StridedSlice",Et="Tan",Tt="Tanh",It="Tile",St="TopK",kt="Transpose",At="Unique",Rt="Unpack",_t="UnsortedSegmentSum",Nt="ZerosLike",Ft="Step",Dt="FromPixels",Ot="RotateWithOffset"},734:(e,t,n)=>{"use strict";n.d(t,{N:()=>a});var r=n(6197),o=n(693),s=n(6777);const a=(0,n(3397).op)({prelu_:function(e,t){const n=(0,s.YT)(e,"x","prelu"),a=(0,s.YT)(t,"alpha","prelu"),i={x:n,alpha:a};return r.T2.runKernelFunc(((e,t)=>{const r=e.prelu(n,a);return t([n,a]),r}),i,null,o.Nc)}})},738:(e,t,n)=>{"use strict";n.d(t,{Cz:()=>c,VL:()=>h,zq:()=>d});var r=n(6364),o=(n(9220),n(1515)),s=n(1209),a=n(5862),i=n(8171);const u=16e3;(0,a.RD)(u);function l(e){if(1===e.numberOfChannels)return e.getChannelData(0);if(2!==e.numberOfChannels)throw Error(`${e.numberOfChannels} channel audio is not supported.`);const t=e.getChannelData(0),n=e.getChannelData(1),r=new Float32Array(e.length);for(let o=0;o<e.length;++o)r[o]=(t[o]+n[o])/2;return r}async function c(e,t=u){if(e.sampleRate===t)return l(e);const n=e.sampleRate,r=e.length*t/n;if(a.nr){i.log("Safari does not support WebAudio resampling, so this may be slow.","O&F",5);const t=l(e),n=new Float32Array(r);return s(o(n,[r]),o(t,[t.length])),n}{const n=new OfflineAudioContext(e.numberOfChannels,e.duration*t,t),r=n.createBufferSource();return r.buffer=e,r.connect(n.destination),r.start(),n.startRendering().then((e=>e.getChannelData(0)))}}function h(e){let t=r.sub(e,69);return t=r.div(t,12),t=r.pow(2,t),t=r.mul(440,t),t}async function d(e){let t=r.sub(r.div(r.log(e),r.log(2)),r.div(r.log(440),r.log(2)));t=r.mul(12,t),t=r.add(t,69);return await t.array()}},953:(e,t,n)=>{"use strict";var r=n(7723),o=n(1515),s=n(6807),a=n(5687);e.exports=function(e,t,n){var i,u,l=t.shape,c=l.length,h=1,d=new Array(c),p=0;for(i=c-1;i>=0;--i)if(d[i]=h,h*=l[i],p=Math.max(p,a.scratchMemory(l[i])),t.shape[i]!==n.shape[i])throw new Error("Shape mismatch, real and imaginary arrays must have same size");var f,g=4*h+p;f="array"===t.dtype||"float64"===t.dtype||"custom"===t.dtype?s.mallocDouble(g):s.mallocFloat(g);var m,x,v,y,b=o(f,l.slice(0),d,0),w=o(f,l.slice(0),d.slice(0),h),C=o(f,l.slice(0),d.slice(0),2*h),$=o(f,l.slice(0),d.slice(0),3*h),E=4*h;for(r.assign(b,t),r.assign(w,n),i=c-1;i>=0&&(a(e,h/l[i],l[i],f,b.offset,w.offset,E),0!==i);--i){for(x=1,v=C.stride,y=$.stride,u=i-1;u<c;++u)y[u]=v[u]=x,x*=l[u];for(u=i-2;u>=0;--u)y[u]=v[u]=x,x*=l[u];r.assign(C,b),r.assign($,w),m=b,b=C,C=m,m=w,w=$,$=m}r.assign(t,b),r.assign(n,w),s.free(f)}},955:(e,t,n)=>{"use strict";n.r(t),n.d(t,{userAgent:()=>r});const r=""},1049:(e,t,n)=>{"use strict";n.d(t,{L:()=>o,P:()=>s});var r=n(7315);function o(e,t){const n=e[0].length;e.forEach(((e,t)=>{r.vA(e.length===n,(()=>`Error in concat${n}D: rank of tensors[${t}] must be the same as the rank of the rest (${n})`))})),r.vA(t>=0&&t<n,(()=>`Error in concat${n}D: axis must be between 0 and ${n-1}.`));const o=e[0];e.forEach(((e,s)=>{for(let a=0;a<n;a++)r.vA(a===t||e[a]===o[a],(()=>`Error in concat${n}D: Shape of tensors[${s}] (${e}) does not match the shape of the rest (${o}) along the non-concatenated axis ${s}.`))}))}function s(e,t){const n=e[0].slice();for(let r=1;r<e.length;r++)n[t]+=e[r][t];return n}},1068:(e,t,n)=>{"use strict";n.d(t,{$:()=>l});var r=n(6197),o=n(693),s=n(6777),a=n(7315),i=n(586);function u(e){return null==e?null:0===e.rank?(0,i.t)(e,[e.size]):1===e.rank?e:2===e.rank?(0,i.t)(e,[1,1,e.shape[0],e.shape[1]]):3===e.rank?(0,i.t)(e,[1,e.shape[0],e.shape[1],e.shape[2]]):e}const l=(0,n(3397).op)({batchNorm_:function(e,t,n,l,c,h){null==h&&(h=.001);const d=(0,s.YT)(e,"x","batchNorm"),p=(0,s.YT)(t,"mean","batchNorm"),f=(0,s.YT)(n,"variance","batchNorm");let g,m;null!=c&&(g=(0,s.YT)(c,"scale","batchNorm")),null!=l&&(m=(0,s.YT)(l,"offset","batchNorm")),a.vA(p.rank===f.rank,(()=>"Batch normalization gradient requires mean and variance to have equal ranks.")),a.vA(null==m||p.rank===m.rank,(()=>"Batch normalization gradient requires mean and offset to have equal ranks.")),a.vA(null==g||p.rank===g.rank,(()=>"Batch normalization gradient requires mean and scale to have equal ranks."));const x=function(e){let t;return t=0===e.rank||1===e.rank?(0,i.t)(e,[1,1,1,e.size]):2===e.rank?(0,i.t)(e,[1,1,e.shape[0],e.shape[1]]):3===e.rank?(0,i.t)(e,[1,e.shape[0],e.shape[1],e.shape[2]]):e,t}(d),v={x,scale:g,offset:m,mean:p,variance:f},y={varianceEpsilon:h},b=r.T2.runKernelFunc(((e,t)=>(t([x,p,f,g]),e.batchNorm(x,u(p),u(f),u(m),u(g),h))),v,null,o.i5,y);return(0,i.t)(b,d.shape)}})},1115:e=>{"use strict";e.exports=function(e,t,n){return 0===e.length?e:t?(n||e.sort(t),function(e,t){for(var n=1,r=e.length,o=e[0],s=e[0],a=1;a<r;++a)if(s=o,t(o=e[a],s)){if(a===n){n++;continue}e[n++]=o}return e.length=n,e}(e,t)):(n||e.sort(),function(e){for(var t=1,n=e.length,r=e[0],o=e[0],s=1;s<n;++s,o=r)if(o=r,(r=e[s])!==o){if(s===t){t++;continue}e[t++]=r}return e.length=t,e}(e))}},1124:(e,t,n)=>{"use strict";n.d(t,{X:()=>o,j:()=>r});const r=1.7580993408473768,o=1.0507009873554805},1209:(e,t,n)=>{"use strict";var r=n(953),o=n(2433),s=n(7723),a=n(8277)({args:["array","array","scalar","scalar","scalar"],body:function(e,t,n,r,o){var s=t*n;s<r&&(s=r),s>o&&(s=o)}});e.exports=function(e,t,n,i){void 0===n&&(n=-1/0),void 0===i&&(i=1/0);var u=t.shape,l=e.shape;if(t.shape.length!==e.shape.length)throw new Error("ndarray-resample: input and output arrays should have the same dimensions");var c,h=u.map((function(){return 0}));if(1===e.size)return(c=s.sum(t)/t.size)<n&&(c=n),c>i&&(c=i),void e.set.apply(e,h.concat(c));if(1===t.size)return(c=t.get.apply(t,h))<n&&(c=n),c>i&&(c=i),void s.assigns(e,c);for(var d=u.length,p=new Array(d),f=!1,g=0;g<d;g++)p[g]=Math.min(l[g],u[g]),l[g]>u[g]&&(f=!0);var m=o.malloc(u),x=o.malloc(u);s.assign(m,t),s.assigns(x,0),r(1,m,x);var v=m.lo,y=m.hi,b=o.malloc(l),w=o.malloc(l);f&&(s.assigns(b,0),s.assigns(w,0));var C=new Array(d),$=new Array(d),E=new Array(d),T=new Array(d);for(g=0;g<1<<d;++g){for(var I=0;I<d;++I)if(g&1<<I){if(C[I]=p[I]-(p[I]+1>>>1),0===C[I])continue;$[I]=l[I]-C[I],E[I]=u[I]-C[I],T[I]=1&p[I]?0:1}else C[I]=p[I]+1>>>1,$[I]=0,E[I]=0,T[I]=0;s.assign(y.apply(v.apply(b,$),C),y.apply(v.apply(m,E),C)),s.assign(v.apply(y.apply(v.apply(w,$),C),T),v.apply(y.apply(v.apply(x,E),C),T)),s.assigns(y.apply(y.apply(v.apply(w,$),C),T),0)}r(-1,b,w),a(e,b,e.size/t.size,n,i),o.free(m),o.free(x),o.free(b),o.free(w)}},1343:(e,t,n)=>{"use strict";n.d(t,{m:()=>o,x:()=>s});var r=n(7315);const o=30;function s(e){return e<=o?e:(0,r.lK)(e,Math.floor(Math.sqrt(e)))}},1475:(e,t,n)=>{"use strict";n.d(t,{j:()=>c});var r=n(6197),o=n(693),s=n(6777),a=n(7315),i=n(2527),u=n(3397),l=n(586);const c=(0,u.op)({maxPool_:function(e,t,n,u,c){const h=(0,s.YT)(e,"x","maxPool");let d=h,p=!1;3===h.rank&&(p=!0,d=(0,l.t)(h,[1,h.shape[0],h.shape[1],h.shape[2]])),a.vA(4===d.rank,(()=>`Error in maxPool: input must be rank 4 but got rank ${d.rank}.`)),a.vA(i.G0(n,1),(()=>`Error in maxPool: Either strides or dilations must be 1. Got strides ${n} and dilations '1'`)),null!=c&&a.vA(a.E6(u),(()=>`Error in maxPool: pad must be an integer when using, dimRoundingMode ${c} but got pad ${u}.`));const f={x:d},g={filterSize:t,strides:n,pad:u,dimRoundingMode:c},m=r.T2.runKernelFunc(((e,r)=>{const o=i.E6(d.shape,t,n,1,u,c);let s;return s=1===o.filterWidth&&1===o.filterHeight&&a.r1(o.inShape,o.outShape)?d.clone():e.maxPool(d,o),r([d,s]),s}),f,null,o.t3,g);return p?(0,l.t)(m,[m.shape[1],m.shape[2],m.shape[3]]):m}})},1515:(e,t,n)=>{var r=n(2639),o=n(7634),s="undefined"!=typeof Float64Array;function a(e,t){return e[0]-t[0]}function i(){var e,t=this.stride,n=new Array(t.length);for(e=0;e<n.length;++e)n[e]=[Math.abs(t[e]),e];n.sort(a);var r=new Array(n.length);for(e=0;e<r.length;++e)r[e]=n[e][1];return r}function u(e,t){var n=["View",t,"d",e].join("");t<0&&(n="View_Nil"+e);var o="generic"===e;if(-1===t){var s="function "+n+"(a){this.data=a;};var proto="+n+".prototype;proto.dtype='"+e+"';proto.index=function(){return -1};proto.size=0;proto.dimension=-1;proto.shape=proto.stride=proto.order=[];proto.lo=proto.hi=proto.transpose=proto.step=function(){return new "+n+"(this.data);};proto.get=proto.set=function(){};proto.pick=function(){return null};return function construct_"+n+"(a){return new "+n+"(a);}";return new Function(s)()}if(0===t){s="function "+n+"(a,d) {this.data = a;this.offset = d};var proto="+n+".prototype;proto.dtype='"+e+"';proto.index=function(){return this.offset};proto.dimension=0;proto.size=1;proto.shape=proto.stride=proto.order=[];proto.lo=proto.hi=proto.transpose=proto.step=function "+n+"_copy() {return new "+n+"(this.data,this.offset)};proto.pick=function "+n+"_pick(){return TrivialArray(this.data);};proto.valueOf=proto.get=function "+n+"_get(){return "+(o?"this.data.get(this.offset)":"this.data[this.offset]")+"};proto.set=function "+n+"_set(v){return "+(o?"this.data.set(this.offset,v)":"this.data[this.offset]=v")+"};return function construct_"+n+"(a,b,c,d){return new "+n+"(a,d)}";return new Function("TrivialArray",s)(l[e][0])}s=["'use strict'"];var a=r(t),u=a.map((function(e){return"i"+e})),c="this.offset+"+a.map((function(e){return"this.stride["+e+"]*i"+e})).join("+"),h=a.map((function(e){return"b"+e})).join(","),d=a.map((function(e){return"c"+e})).join(",");s.push("function "+n+"(a,"+h+","+d+",d){this.data=a","this.shape=["+h+"]","this.stride=["+d+"]","this.offset=d|0}","var proto="+n+".prototype","proto.dtype='"+e+"'","proto.dimension="+t),s.push("Object.defineProperty(proto,'size',{get:function "+n+"_size(){return "+a.map((function(e){return"this.shape["+e+"]"})).join("*"),"}})"),1===t?s.push("proto.order=[0]"):(s.push("Object.defineProperty(proto,'order',{get:"),t<4?(s.push("function "+n+"_order(){"),2===t?s.push("return (Math.abs(this.stride[0])>Math.abs(this.stride[1]))?[1,0]:[0,1]}})"):3===t&&s.push("var s0=Math.abs(this.stride[0]),s1=Math.abs(this.stride[1]),s2=Math.abs(this.stride[2]);if(s0>s1){if(s1>s2){return [2,1,0];}else if(s0>s2){return [1,2,0];}else{return [1,0,2];}}else if(s0>s2){return [2,0,1];}else if(s2>s1){return [0,1,2];}else{return [0,2,1];}}})")):s.push("ORDER})")),s.push("proto.set=function "+n+"_set("+u.join(",")+",v){"),o?s.push("return this.data.set("+c+",v)}"):s.push("return this.data["+c+"]=v}"),s.push("proto.get=function "+n+"_get("+u.join(",")+"){"),o?s.push("return this.data.get("+c+")}"):s.push("return this.data["+c+"]}"),s.push("proto.index=function "+n+"_index(",u.join(),"){return "+c+"}"),s.push("proto.hi=function "+n+"_hi("+u.join(",")+"){return new "+n+"(this.data,"+a.map((function(e){return["(typeof i",e,"!=='number'||i",e,"<0)?this.shape[",e,"]:i",e,"|0"].join("")})).join(",")+","+a.map((function(e){return"this.stride["+e+"]"})).join(",")+",this.offset)}");var p=a.map((function(e){return"a"+e+"=this.shape["+e+"]"})),f=a.map((function(e){return"c"+e+"=this.stride["+e+"]"}));s.push("proto.lo=function "+n+"_lo("+u.join(",")+"){var b=this.offset,d=0,"+p.join(",")+","+f.join(","));for(var g=0;g<t;++g)s.push("if(typeof i"+g+"==='number'&&i"+g+">=0){d=i"+g+"|0;b+=c"+g+"*d;a"+g+"-=d}");s.push("return new "+n+"(this.data,"+a.map((function(e){return"a"+e})).join(",")+","+a.map((function(e){return"c"+e})).join(",")+",b)}"),s.push("proto.step=function "+n+"_step("+u.join(",")+"){var "+a.map((function(e){return"a"+e+"=this.shape["+e+"]"})).join(",")+","+a.map((function(e){return"b"+e+"=this.stride["+e+"]"})).join(",")+",c=this.offset,d=0,ceil=Math.ceil");for(g=0;g<t;++g)s.push("if(typeof i"+g+"==='number'){d=i"+g+"|0;if(d<0){c+=b"+g+"*(a"+g+"-1);a"+g+"=ceil(-a"+g+"/d)}else{a"+g+"=ceil(a"+g+"/d)}b"+g+"*=d}");s.push("return new "+n+"(this.data,"+a.map((function(e){return"a"+e})).join(",")+","+a.map((function(e){return"b"+e})).join(",")+",c)}");var m=new Array(t),x=new Array(t);for(g=0;g<t;++g)m[g]="a[i"+g+"]",x[g]="b[i"+g+"]";s.push("proto.transpose=function "+n+"_transpose("+u+"){"+u.map((function(e,t){return e+"=("+e+"===undefined?"+t+":"+e+"|0)"})).join(";"),"var a=this.shape,b=this.stride;return new "+n+"(this.data,"+m.join(",")+","+x.join(",")+",this.offset)}"),s.push("proto.pick=function "+n+"_pick("+u+"){var a=[],b=[],c=this.offset");for(g=0;g<t;++g)s.push("if(typeof i"+g+"==='number'&&i"+g+">=0){c=(c+this.stride["+g+"]*i"+g+")|0}else{a.push(this.shape["+g+"]);b.push(this.stride["+g+"])}");return s.push("var ctor=CTOR_LIST[a.length+1];return ctor(this.data,a,b,c)}"),s.push("return function construct_"+n+"(data,shape,stride,offset){return new "+n+"(data,"+a.map((function(e){return"shape["+e+"]"})).join(",")+","+a.map((function(e){return"stride["+e+"]"})).join(",")+",offset)}"),new Function("CTOR_LIST","ORDER",s.join("\n"))(l[e],i)}var l={float32:[],float64:[],int8:[],int16:[],int32:[],uint8:[],uint16:[],uint32:[],array:[],uint8_clamped:[],bigint64:[],biguint64:[],buffer:[],generic:[]};e.exports=function(e,t,n,r){if(void 0===e)return(0,l.array[0])([]);"number"==typeof e&&(e=[e]),void 0===t&&(t=[e.length]);var a=t.length;if(void 0===n){n=new Array(a);for(var i=a-1,c=1;i>=0;--i)n[i]=c,c*=t[i]}if(void 0===r){r=0;for(i=0;i<a;++i)n[i]<0&&(r-=(t[i]-1)*n[i])}for(var h=function(e){if(o(e))return"buffer";if(s)switch(Object.prototype.toString.call(e)){case"[object Float64Array]":return"float64";case"[object Float32Array]":return"float32";case"[object Int8Array]":return"int8";case"[object Int16Array]":return"int16";case"[object Int32Array]":return"int32";case"[object Uint8Array]":return"uint8";case"[object Uint16Array]":return"uint16";case"[object Uint32Array]":return"uint32";case"[object Uint8ClampedArray]":return"uint8_clamped";case"[object BigInt64Array]":return"bigint64";case"[object BigUint64Array]":return"biguint64"}return Array.isArray(e)?"array":"generic"}(e),d=l[h];d.length<=a+1;)d.push(u(h,d.length-1));return(0,d[a+1])(e,t,n,r)}},1580:(e,t,n)=>{"use strict";n.d(t,{V:()=>u});var r=n(6197),o=n(693),s=n(6777),a=n(3397),i=n(3709);const u=(0,a.op)({relu_:function(e){const t=(0,s.YT)(e,"x","relu"),n={x:t};return r.T2.runKernelFunc(((e,n)=>(n([t]),"bool"===t.dtype?(0,i.w)(t,"int32"):e.relu(t))),n,null,o.fU)}})},1630:(e,t,n)=>{"use strict";n.d(t,{l:()=>i});var r=n(6197),o=n(693),s=n(7025),a=n(6777);const i=(0,n(3397).op)({mul_:function(e,t){let n=(0,a.YT)(e,"a","mul"),i=(0,a.YT)(t,"b","mul");[n,i]=(0,s.h0)(n,i);const u={a:n,b:i};return r.T2.runKernelFunc(((e,t)=>{const r=e.multiply(n,i);return t([n,i]),r}),u,null,o.xu)}})},1996:(e,t,n)=>{"use strict";n.d(t,{M:()=>u});var r=n(6197),o=n(693),s=n(6777),a=n(3397),i=n(586);const u=(0,a.op)({oneHot_:function(e,t,n=1,a=0){if(t<2)throw new Error(`Error in oneHot: depth must be >=2, but it is ${t}`);const u=(0,s.YT)(e,"indices","oneHot","int32"),l=[...u.shape,t],c={indices:u},h={depth:t,onValue:n,offValue:a};return r.T2.runKernelFunc(((e,r)=>(r([u]),(0,i.t)(e.oneHot((0,i.t)(u,[u.size]),t,n,a),l))),c,null,o.ur,h)}})},2380:(e,t,n)=>{"use strict";n.r(t),n.d(t,{ERF_A1:()=>U,ERF_A2:()=>V,ERF_A3:()=>W,ERF_A4:()=>z,ERF_A5:()=>Y,ERF_P:()=>M,PARALLELIZE_THRESHOLD:()=>T.m,SELU_SCALE:()=>P.X,SELU_SCALEALPHA:()=>P.j,applyActivation:()=>$,assertAndGetBroadcastShape:()=>c.Ky,assertAxesAreInnerMostDims:()=>l.WC,assertParamsConsistent:()=>h.L,assignToTypedArray:()=>J,axesAreInnerMostDims:()=>l.WH,calculateShapes:()=>B,castTensor:()=>oe,combineLocations:()=>l.aF,complexWithEvenIndex:()=>X,complexWithOddIndex:()=>Z,computeConv2DInfo:()=>d.uf,computeConv3DInfo:()=>d.p$,computeDefaultPad:()=>d.G8,computeDilation2DInfo:()=>d.YQ,computeOptimalWindowSize:()=>T.x,computeOutAndReduceShapes:()=>l.lb,computeOutShape:()=>h.P,computePool2DInfo:()=>d.E6,computePool3DInfo:()=>d.l5,convertConv2DDataFormat:()=>d.$Q,eitherStridesOrDilationsAreOne:()=>d.G0,expandShapeToKeepDim:()=>l.SM,exponent:()=>te,exponents:()=>ee,getAxesPermutation:()=>l.Em,getBroadcastDims:()=>c.NE,getComplexWithIndex:()=>Q,getFusedBiasGradient:()=>C,getFusedDyActivation:()=>w,getImageCenter:()=>k,getInnerMostAxes:()=>l.fK,getPermuted:()=>R,getReductionAxes:()=>c.Lx,getReshaped:()=>A,getReshapedPermuted:()=>_,getSliceBeginCoords:()=>N,getSliceSize:()=>F,getUndoAxesPermutation:()=>l.gx,linspaceImpl:()=>ae,log:()=>q,mergeRealAndImagArrays:()=>j,prepareAndValidate:()=>D,prepareSplitSize:()=>ne.z,reshapeTensor:()=>se,segment_util:()=>re,shouldFuse:()=>E,slice_util:()=>I,splitRealAndImagArrays:()=>H,tupleValuesAreOne:()=>d.Dh,upcastType:()=>S.Tu,validateInput:()=>L,validateUpdateShape:()=>O,warn:()=>K});var r=n(6197),o=n(3709),s=n(6610),a=n(4686),i=n(3347),u=n(7315),l=n(5298),c=n(5330),h=n(1049),d=n(2527),p=n(9292),f=n(1630),g=n(734),m=n(1580),x=n(576),v=n(586),y=n(3408),b=n(3547);function w(e,t,n){if(null==n||"linear"===n)return e;if("relu"===n)return(0,f.l)(e,(0,y.P)(t));throw new Error(`Cannot compute gradient for fused activation ${n}.`)}function C(e,t){let n=t;const r=c.Lx(e.shape,t.shape);return r.length>0&&(n=(0,b.c)(n,r)),(0,v.t)(n,e.shape)}function $(e,t,n){if("linear"===t)return e;if("relu"===t)return(0,m.V)(e);if("elu"===t)return(0,p.P)(e);if("relu6"===t)return(0,x.j)(e);if("prelu"===t)return(0,g.N)(e,n);throw new Error(`Unknown fused activation ${t}.`)}const E=(e,t)=>!(e>0)||"linear"===t;var T=n(1343),I=n(5213),S=n(2762);function k(e,t,n){return[n*("number"==typeof e?e:e[0]),t*("number"==typeof e?e:e[1])]}function A(e,t,n,r=!0){let o=[];if(r)o=o.concat(t.slice(0)),o.push(e[0]/n),o=o.concat(e.slice(1));else{o=o.concat(e[0]);const n=t.length;for(let r=0;r<n;++r)o=o.concat([e[r+1]/t[r],t[r]]);o=o.concat(e.slice(n+1))}return o}function R(e,t,n=!0){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=[],o=[];for(let r=1;r<e;++r)r>=2*t+1||r%2==1?o.push(r):n.push(r);r.push(...n),r.push(0),r.push(...o)}return r}function _(e,t,n,r=!0){const o=[];r?o.push(e[0]/n):o.push(e[0]*n);for(let n=1;n<e.length;++n)n<=t.length?r?o.push(t[n-1]*e[n]):o.push(e[n]/t[n-1]):o.push(e[n]);return o}function N(e,t){const n=[0];for(let r=0;r<t;++r)n.push(e[r][0]);return n}function F(e,t,n){const r=e.slice(0,1);for(let o=0;o<n;++o)r.push(e[o+1]-t[o][0]-t[o][1]);return r}function D(e,t){if(e.rank<1)throw new Error(`tf.gatherND() expects the input to be rank 1 or higher, but the rank was ${e.rank}.`);if(t.rank<1)throw new Error(`tf.gatherND() expects the indices to be rank 1 or higher, but the rank was ${t.rank}.`);if("int32"!==t.dtype)throw new Error(`tf.gatherND() expects the indices to be int32 type, but the dtype was ${t.dtype}.`);if(t.shape[t.rank-1]>e.rank)throw new Error(`index innermost dimension length must be <= tensor rank; saw: ${t.shape[t.rank-1]} vs. ${e.rank}`);if(0===e.size)throw new Error(`Requested more than 0 entries, but input is empty. Input shape: ${e.shape}.`);const n=t.shape,r=n[n.length-1];let o=1;for(let e=0;e<n.length-1;++e)o*=n[e];const s=e.shape,a=n.slice();a.pop();let i=1;for(let t=r;t<e.rank;++t)i*=s[t],a.push(s[t]);const l=[...(0,u.Ur)(e.shape).map((e=>e/i)),1].slice(0,r);return[a,o,i,l]}function O(e,t,n){const r=t.rank>1?t.shape[t.rank-1]:1,o=t.rank>1?t.rank-1:1,s=`Must have updates.shape = indices.shape[:batchDim] + shape[sliceDim:], got updates.shape: ${n.shape}, indices.shape: ${t.shape}, shape: ${e}, sliceDim: ${r}, and batchDim: ${o}.`;if(n.rank<o)throw new Error(s+` update.rank < ${o}. `);if(e.length<r+(n.rank-o))throw new Error(s+` Output shape length < ${r+(n.rank-o)}`);if(n.rank!==o+e.length-r)throw new Error(s+" update.rank != "+(o+e.length-r));for(let e=0;e<o;++e)if(n.shape[e]!==t.shape[e])throw new Error(s+` updates.shape[${e}] (${n.shape[e]}) != indices.shape[${e}] (${t.shape[e]}).`);for(let t=0;t<n.rank-o;++t)if(n.shape[t+o]!==e[t+r])throw new Error(s+` updates.shape[${t+o}] (${n.shape[t+o]}) != shape[${t+o}] (${e[t+o]})`)}function L(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 ${t.rank}.`);if(e.rank<1)throw new Error(`tf.scatterND() expects the updates to be rank 1 or higher, but the rank was ${e.rank}.`);if("int32"!==t.dtype)throw new Error(`The dtype of 'indices' should be int32, but got dtype: ${t.dtype}`);if(n.length<1)throw new Error(`Output rank must be greater or equal to 1, but got shape: ${n}`);if(0===n.length){if(0===t.size)throw new Error(`Indices specified for empty output. indices shape: ${t.shape}`);if(0===e.size)throw new Error(`Updates specified for empty output. updates shape: ${e.shape}`)}O(n,t,e)}function B(e,t,n){const r=t.shape.length,o=r>1?t.shape[r-1]:1,s=n.length;let a=1;for(let e=o;e<s;++e)a*=n[e];const i=o<1?1:o;return{sliceRank:o,numUpdates:(0,u.Ze)(t.shape)/i,sliceSize:a,strides:[...(0,u.Ur)(n.slice(0,o)),1],outputSize:(0,u.Ze)(n)}}var P=n(1124);const M=.3275911,U=.254829592,V=-.284496736,W=1.421413741,z=-1.453152027,Y=1.061405429;var G=n(6626);function K(...e){(0,G._K)().getBool("IS_TEST")||console.warn(...e)}function q(...e){(0,G._K)().getBool("IS_TEST")||console.log(...e)}function j(e,t){if(e.length!==t.length)throw new Error(`Cannot merge real and imag arrays of different lengths. real:${e.length}, imag: ${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}function H(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}}function X(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}}function Z(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}}function Q(e,t){return{real:e[2*t],imag:e[2*t+1]}}function J(e,t,n,r){e[2*r]=t,e[2*r+1]=n}function ee(e,t){const n=new Float32Array(e/2),r=new Float32Array(e/2);for(let o=0;o<Math.ceil(e/2);o++){const s=(t?2:-2)*Math.PI*(o/e);n[o]=Math.cos(s),r[o]=Math.sin(s)}return{real:n,imag:r}}function te(e,t,n){const r=(n?2:-2)*Math.PI*(e/t);return{real:Math.cos(r),imag:Math.sin(r)}}var ne=n(7419),re=n(2656);function oe(e,t,n){if("complex64"===t){if("complex64"===e.dtype)return e.clone();const t=(0,i.U)(e.shape),r=(0,o.w)(e,"float32"),s=n.complex(r,t);return t.dispose(),r.dispose(),s}if(!(0,u.BE)(e.dtype,t))return r.T2.makeTensorFromDataId(e.dataId,e.shape,t);if("complex64"===e.dtype){const r=n.real(e),s=(0,o.w)(r,t);return r.dispose(),s}if("int32"===t)return n.int(e);if("bool"===t){const t=(0,s.d)(0,e.dtype),r=n.notEqual(e,t);return t.dispose(),r}throw new Error(`Error in Cast: failed to cast ${e.dtype} to ${t}`)}function se(e,t){return r.T2.makeTensorFromDataId(e.dataId,t,e.dtype)}function ae(e,t,n){const r=(t-e)/(n-1),o=(0,u.Ty)(n,"float32");o[0]=e;for(let e=1;e<o.length;e++)o[e]=o[e-1]+r;return(0,a.t)(o,"float32")}},2433:(e,t,n)=>{"use strict";var r=n(1515),o=n(7723),s=n(6807);t.clone=function(e){var t=e.dtype;"generic"!==t&&"array"!==t||(t="double");var n=s.malloc(e.size,t),a=r(n,e.shape);return o.assign(a,e),a},t.malloc=function(e,t){t||(t="double");for(var n=1,o=new Array(e.length),a=e.length-1;a>=0;--a)o[a]=n,n*=e[a];return r(s.malloc(n,t),e,o,0)},t.free=function(e){"generic"!==e.dtype&&"array"!==e.dtype&&s.free(e.data)},t.zeros=function(e,t){t||(t="double");for(var n=1,o=new Array(e.length),a=e.length-1;a>=0;--a)o[a]=n,n*=e[a];var i=s.malloc(n,t);for(a=0;a<n;++a)i[a]=0;return r(i,e,o,0)},t.ones=function(e,t){t||(t="double");for(var n=1,o=new Array(e.length),a=e.length-1;a>=0;--a)o[a]=n,n*=e[a];var i=s.malloc(n,t);for(a=0;a<n;++a)i[a]=1;return r(i,e,o,0)},t.eye=function(e,t){var n,o;t||(t="double");var a=1,i=new Array(e.length);for(n=e.length-1;n>=0;--n)i[n]=a,a*=e[n];var u=s.malloc(a,t);for(n=0;n<a;++n)u[n]=0;var l=1/0,c=0;for(n=e.length-1;n>=0;n--)c+=i[n],l=Math.min(l,e[n]);for(n=0,o=0;n<l;n++,o+=c)u[o]=1;return r(u,e,i,0)}},2527:(e,t,n)=>{"use strict";n.d(t,{$Q:()=>m,Dh:()=>f,E6:()=>s,G0:()=>g,G8:()=>l,YQ:()=>o,l5:()=>a,p$:()=>u,uf:()=>i});var r=n(7315);function o(e,t,n,r,o="NHWC",s){return i(e,[...t,e[3]],n,s,r,null,null,m(o))}function s(e,t,n,r,o,s,a="channelsLast"){const[u,l]=c(t);let h;if("channelsLast"===a)h=[u,l,e[3],e[3]];else{if("channelsFirst"!==a)throw new Error(`Unknown dataFormat ${a}`);h=[u,l,e[1],e[1]]}return i(e,h,n,r,o,s,!1,a)}function a(e,t,n,r,o,s,a="NDHWC"){const[i,l,c]=h(t);let d,p;if("NDHWC"===a)p="channelsLast",d=[i,l,c,e[4],e[4]];else{if("NCDHW"!==a)throw new Error(`Unknown dataFormat ${a}`);p="channelsFirst",d=[i,l,c,e[1],e[1]]}return u(e,d,n,r,o,!1,p,s)}function i(e,t,n,o,s,a,i=!1,u="channelsLast"){let[h,f,g,m]=[-1,-1,-1,-1];if("channelsLast"===u)[h,f,g,m]=e;else{if("channelsFirst"!==u)throw new Error(`Unknown dataFormat ${u}`);[h,m,f,g]=e}const[x,v,,y]=t,[b,w]=c(n),[C,$]=c(o),E=d(x,C),T=d(v,$),{padInfo:I,outHeight:S,outWidth:k}=function(e,t,n,o,s,a,i,u,c){let h,d,f;if("number"==typeof e){h={top:e,bottom:e,left:e,right:e,type:0===e?"VALID":"NUMBER"};const s=function(e,t,n,o,s){null==o&&(o=l(e,t,n));const a=e[0],i=e[1],u=p((a-t+2*o)/n+1,s);r.vA(r.E6(u),(()=>`The output # of rows (${u}) must be an integer. Change the stride and/or zero pad parameters`));const c=p((i-t+2*o)/n+1,s);return r.vA(r.E6(c),(()=>`The output # of columns (${c}) must be an integer. Change the stride and/or zero pad parameters`)),[u,c]}([t,n],a,o,e,u);d=s[0],f=s[1]}else if("same"===e){d=Math.ceil(t/o),f=Math.ceil(n/s);const e=Math.max(0,(d-1)*o+a-t),r=Math.max(0,(f-1)*s+i-n),u=Math.floor(e/2),l=e-u,c=Math.floor(r/2);h={top:u,bottom:l,left:c,right:r-c,type:"SAME"}}else if("valid"===e)h={top:0,bottom:0,left:0,right:0,type:"VALID"},d=Math.ceil((t-a+1)/o),f=Math.ceil((n-i+1)/s);else{if("object"!=typeof e)throw Error(`Unknown padding parameter: ${e}`);{const r="channelsLast"===c?e[1][0]:e[2][0],l="channelsLast"===c?e[1][1]:e[2][1],g="channelsLast"===c?e[2][0]:e[3][0],m="channelsLast"===c?e[2][1]:e[3][1];h={top:r,bottom:l,left:g,right:m,type:0===r&&0===l&&0===g&&0===m?"VALID":"EXPLICIT"},d=p((t-a+r+l)/o+1,u),f=p((n-i+g+m)/s+1,u)}}return{padInfo:h,outHeight:d,outWidth:f}}(s,f,g,b,w,E,T,a,u),A=i?y*m:y;let R;return"channelsFirst"===u?R=[h,A,S,k]:"channelsLast"===u&&(R=[h,S,k,A]),{batchSize:h,dataFormat:u,inHeight:f,inWidth:g,inChannels:m,outHeight:S,outWidth:k,outChannels:A,padInfo:I,strideHeight:b,strideWidth:w,filterHeight:x,filterWidth:v,effectiveFilterHeight:E,effectiveFilterWidth:T,dilationHeight:C,dilationWidth:$,inShape:e,outShape:R,filterShape:t}}function u(e,t,n,o,s,a=!1,i="channelsLast",u){let[c,f,g,m,x]=[-1,-1,-1,-1,-1];if("channelsLast"===i)[c,f,g,m,x]=e;else{if("channelsFirst"!==i)throw new Error(`Unknown dataFormat ${i}`);[c,x,f,g,m]=e}const[v,y,b,,w]=t,[C,$,E]=h(n),[T,I,S]=h(o),k=d(v,T),A=d(y,I),R=d(b,S),{padInfo:_,outDepth:N,outHeight:F,outWidth:D}=function(e,t,n,o,s,a,i,u,c,h,d){let f,g,m,x;if("number"==typeof e){f={top:e,bottom:e,left:e,right:e,front:e,back:e,type:0===e?"VALID":"NUMBER"};const a=function(e,t,n,o,s,a){null==s&&(s=l(e,t,o));const i=e[0],u=e[1],c=e[2],h=p((i-t+2*s)/o+1,a);r.vA(r.E6(h),(()=>`The output # of depths (${h}) must be an integer. Change the stride and/or zero pad parameters`));const d=p((u-t+2*s)/o+1,a);r.vA(r.E6(d),(()=>`The output # of rows (${d}) must be an integer. Change the stride and/or zero pad parameters`));const f=p((c-t+2*s)/o+1,a);return r.vA(r.E6(f),(()=>`The output # of columns (${f}) must be an integer. Change the stride and/or zero pad parameters`)),[h,d,f,n]}([t,n,o,1],u,1,s,e,d);g=a[0],m=a[1],x=a[2]}else if("same"===e){g=Math.ceil(t/s),m=Math.ceil(n/a),x=Math.ceil(o/i);const e=(g-1)*s+u-t,r=(m-1)*a+c-n,l=(x-1)*i+h-o,d=Math.floor(e/2),p=e-d,v=Math.floor(r/2),y=r-v,b=Math.floor(l/2);f={top:v,bottom:y,left:b,right:l-b,front:d,back:p,type:"SAME"}}else{if("valid"!==e)throw Error(`Unknown padding parameter: ${e}`);f={top:0,bottom:0,left:0,right:0,front:0,back:0,type:"VALID"},g=Math.ceil((t-u+1)/s),m=Math.ceil((n-c+1)/a),x=Math.ceil((o-h+1)/i)}return{padInfo:f,outDepth:g,outHeight:m,outWidth:x}}(s,f,g,m,C,$,E,k,A,R,u),O=a?w*x:w;let L;return"channelsFirst"===i?L=[c,O,N,F,D]:"channelsLast"===i&&(L=[c,N,F,D,O]),{batchSize:c,dataFormat:i,inDepth:f,inHeight:g,inWidth:m,inChannels:x,outDepth:N,outHeight:F,outWidth:D,outChannels:O,padInfo:_,strideDepth:C,strideHeight:$,strideWidth:E,filterDepth:v,filterHeight:y,filterWidth:b,effectiveFilterDepth:k,effectiveFilterHeight:A,effectiveFilterWidth:R,dilationDepth:T,dilationHeight:I,dilationWidth:S,inShape:e,outShape:L,filterShape:t}}function l(e,t,n,r=1){const o=d(t,r);return Math.floor((e[0]*(n-1)-n+o)/2)}function c(e){return"number"==typeof e?[e,e,e]:2===e.length?[e[0],e[1],1]:e}function h(e){return"number"==typeof e?[e,e,e]:e}function d(e,t){return t<=1?e:e+(e-1)*(t-1)}function p(e,t){if(!t)return e;switch(t){case"round":return Math.round(e);case"ceil":return Math.ceil(e);case"floor":return Math.floor(e);default:throw new Error(`Unknown roundingMode ${t}`)}}function f(e){const[t,n,r]=c(e);return 1===t&&1===n&&1===r}function g(e,t){return f(e)||f(t)}function m(e){if("NHWC"===e)return"channelsLast";if("NCHW"===e)return"channelsFirst";throw new Error(`Unknown dataFormat ${e}`)}},2611:(e,t,n)=>{"use strict";n.d(t,{h:()=>l});var r=n(6197),o=n(693),s=n(6777),a=n(73),i=n(3397),u=n(586);const l=(0,i.op)({broadcastTo_:function(e,t){let n=(0,s.YT)(e,"broadcastTo","x");const i=n.shape;if(t.some((e=>!(e>0)||e%1!=0)))throw new Error(`broadcastTo(): Invalid broadcast shape [${t}].`);if(t.length<n.rank)throw new Error(`broadcastTo(): shape.length=${t.length} < input.rank=${n.rank}.`);if(t.length>n.rank){const e=n.shape.slice();for(;e.length<t.length;)e.unshift(1);n=(0,u.t)(n,e)}const l=n.shape,c=Array.from(t);for(let e=t.length-1;e>=0;e--)if(l[e]===t[e])c[e]=1;else if(1!==n.shape[e])throw new Error(`broadcastTo(): [${i}] cannot be broadcast to [${t}].`);if(0===c.map(((e,t)=>e>1?t:-1)).filter((e=>e>=0)).length)return(0,a.o)(n);const h={x:n},d={shape:t,inputShape:l};return r.T2.runKernelFunc((e=>e.tile(n,c)),h,null,o.LB,d)}})},2639:e=>{"use strict";e.exports=function(e){for(var t=new Array(e),n=0;n<e;++n)t[n]=n;return t}},2656:(e,t,n)=>{"use strict";n.r(t),n.d(t,{collectGatherOpShapeInfo:()=>i,computeOutShape:()=>a,segOpComputeOptimalWindowSize:()=>s});var r=n(7315),o=n(1343);function s(e,t){let n,s=!1;for(e<=o.m?(n=e,s=!0):n=(0,r.lK)(e,Math.floor(Math.sqrt(e)));!s;)n>t||n===e?s=!0:n=(0,r.lK)(e,n+1);return n}function a(e,t,n){const r=[],o=e.length;for(let s=0;s<o;s++)s!==t?r.push(e[s]):r.push(n);return r}function i(e,t,n){const r=e.shape[n],o=[];let s=1,a=1;for(let t=0;t<n;t++)o.push(e.shape[t]),s*=e.shape[t];for(let e=0;e<t.rank;e++)o.push(t.shape[e]);for(let t=n+1;t<e.rank;t++)o.push(e.shape[t]),a*=e.shape[t];return{batchSize:s,sliceSize:a,dimSize:r,outputShape:o}}},2762:(e,t,n)=>{"use strict";var r,o,s,a,i;n.d(t,{Tu:()=>l,ch:()=>c}),function(e){e.R0="R0",e.R1="R1",e.R2="R2",e.R3="R3",e.R4="R4",e.