UNPKG

aframe-vartiste-toolkit

Version:

Toolkit to create GUI similar to VARTISTE

2 lines 926 kB
/*! For license information please see 714.vartiste-toolkit.js.LICENSE.txt */ "use strict";(self.webpackChunkvartiste=self.webpackChunkvartiste||[]).push([[714],{9714:(t,e,n)=>{n.r(e),n.d(e,{AdadeltaOptimizer:()=>bf,AdagradOptimizer:()=>xf,AdamOptimizer:()=>wf,AdamaxOptimizer:()=>Cf,Add:()=>vr,AddN:()=>yr,BroadcastTo:()=>kr,Callback:()=>Tb,CallbackList:()=>Ym,CustomCallback:()=>Zm,DataStorage:()=>ii,Div:()=>br,ENV:()=>p,EarlyStopping:()=>Ob,Environment:()=>u,FromPixels:()=>Rr,FusedBatchNorm:()=>xr,GraphModel:()=>Mx,History:()=>$m,Identity:()=>Er,InputSpec:()=>zm,KernelBackend:()=>oi,LayerVariable:()=>Fm,LayersModel:()=>lv,MaxPoolWithArgmax:()=>Dr,MomentumOptimizer:()=>Sf,NonMaxSuppressionV5:()=>Sr,OneHot:()=>Ir,Optimizer:()=>yf,PadV2:()=>Tr,RMSPropOptimizer:()=>kf,RNN:()=>eb,Rank:()=>Ct,Reduction:()=>rp,SGDOptimizer:()=>Nf,Sequential:()=>pv,Square:()=>Cr,SquaredDifference:()=>wr,SymbolicTensor:()=>Lm,Tensor:()=>wt,TensorBuffer:()=>vt,Tile:()=>Ar,Transpose:()=>Nr,Variable:()=>Et,abs:()=>zr,acos:()=>Lr,acosh:()=>Br,add:()=>Or,addN:()=>Tu,addStrict:()=>ga,all:()=>Cc,any:()=>Nc,argMax:()=>Sc,argMin:()=>kc,asin:()=>Pr,asinh:()=>Wr,atan:()=>Vr,atan2:()=>va,atanh:()=>Ur,avgPool:()=>pc,avgPool3d:()=>dc,backend:()=>ln,backend_util:()=>Ni,basicLSTMCell:()=>Vc,batchNorm:()=>Mu,batchNorm2d:()=>Bu,batchNorm3d:()=>Vu,batchNorm4d:()=>Gu,batchNormalization:()=>_u,batchNormalization2d:()=>Lu,batchNormalization3d:()=>Wu,batchNormalization4d:()=>ju,batchToSpaceND:()=>er,booleanMaskAsync:()=>Pl,broadcastTo:()=>qu,browser:()=>pf,buffer:()=>Qn,callbacks:()=>Mb,cast:()=>nr,ceil:()=>jr,clipByValue:()=>Gr,clone:()=>Hu,complex:()=>En,concat:()=>Kn,concat1d:()=>Xn,concat2d:()=>Yn,concat3d:()=>Jn,concat4d:()=>$n,constraints:()=>vd,conv1d:()=>jl,conv2d:()=>Gl,conv2dTranspose:()=>Zl,conv3d:()=>ql,conv3dTranspose:()=>Ql,cos:()=>qr,cosh:()=>Hr,cumsum:()=>rr,customGrad:()=>ti,data:()=>r,deprecationWarn:()=>He,depthToSpace:()=>ar,depthwiseConv2d:()=>Xl,deregisterOp:()=>Ub,diag:()=>tp,disableDeprecationWarnings:()=>qe,dispose:()=>Ze,disposeVariables:()=>Ke,div:()=>Fa,divNoNan:()=>Qu,divStrict:()=>ya,dot:()=>ec,dropout:()=>ep,elu:()=>Fc,enableDebugMode:()=>Ge,enableProdMode:()=>je,engine:()=>Xe,env:()=>c,equal:()=>Nl,equalStrict:()=>Sl,erf:()=>Kr,exp:()=>Xr,expandDims:()=>ir,expm1:()=>Yr,eye:()=>el,fft:()=>Kc,fill:()=>Un,findBackend:()=>on,findBackendFactory:()=>sn,floor:()=>Jr,floorDiv:()=>ba,frame:()=>op,fused:()=>Pp,gather:()=>Ll,gatherND:()=>Qc,gather_util:()=>Ma,getBackend:()=>rn,getGradient:()=>m,getKernel:()=>d,getKernelsForBackend:()=>g,grad:()=>Ya,grads:()=>Ja,greater:()=>kl,greaterEqual:()=>Il,greaterEqualStrict:()=>El,greaterStrict:()=>Al,hammingWindow:()=>ip,hannWindow:()=>ap,ifft:()=>Xc,imag:()=>Tn,image:()=>Dp,inTopKAsync:()=>lp,initializers:()=>Cm,input:()=>mv,io:()=>sf,irfft:()=>Jc,isFinite:()=>ua,isInf:()=>sa,isNaN:()=>oa,keep:()=>Qe,layers:()=>kb,leakyRelu:()=>_c,less:()=>Tl,lessEqual:()=>Rl,lessEqualStrict:()=>Dl,lessStrict:()=>Ol,linalg:()=>Sp,linspace:()=>jn,loadGraphModel:()=>zx,loadLayersModel:()=>dv,localResponseNormalization:()=>Pc,log:()=>$r,log1p:()=>Zr,logSigmoid:()=>Qr,logSoftmax:()=>ri,logSumExp:()=>Ic,logicalAnd:()=>Ku,logicalNot:()=>Xu,logicalOr:()=>Yu,logicalXor:()=>Ju,losses:()=>bp,matMul:()=>tc,math:()=>lf,max:()=>Ec,maxPool:()=>cc,maxPool3d:()=>fc,maxPoolWithArgmax:()=>mc,maximum:()=>xa,maximumStrict:()=>wa,mean:()=>Ac,memory:()=>Ye,metrics:()=>Ib,min:()=>Tc,minimum:()=>Ca,minimumStrict:()=>Na,mod:()=>Sa,modStrict:()=>ka,model:()=>hv,models:()=>Eb,moments:()=>Rc,movingAverage:()=>jc,mul:()=>Ia,mulStrict:()=>Ea,multiRNNCell:()=>Uc,multinomial:()=>nl,neg:()=>ta,nextFrame:()=>Tf,norm:()=>Wc,notEqual:()=>Fl,notEqualStrict:()=>_l,oneHot:()=>rl,ones:()=>Wn,onesLike:()=>qn,op:()=>In,outerProduct:()=>nc,pad:()=>al,pad1d:()=>il,pad2d:()=>ol,pad3d:()=>sl,pad4d:()=>ul,pool:()=>hc,pow:()=>Aa,powStrict:()=>Ta,prelu:()=>Mc,print:()=>tr,prod:()=>Oc,profile:()=>Je,rand:()=>ll,randomGamma:()=>vl,randomNormal:()=>yl,randomUniform:()=>bl,range:()=>Gn,ready:()=>nn,real:()=>An,reciprocal:()=>ea,registerBackend:()=>un,registerCallbackConstructor:()=>gv,registerGradient:()=>y,registerKernel:()=>v,registerOp:()=>Wb,regularizers:()=>Ab,relu:()=>zc,relu6:()=>Lc,removeBackend:()=>an,reshape:()=>or,reverse:()=>rc,reverse1d:()=>ac,reverse2d:()=>ic,reverse3d:()=>oc,reverse4d:()=>sc,rfft:()=>Yc,round:()=>na,rsqrt:()=>ra,scalar:()=>On,scatterND:()=>Hc,scatter_util:()=>Wa,selu:()=>Bc,separableConv2d:()=>$l,sequential:()=>fv,serialization:()=>mf,setBackend:()=>en,setPlatform:()=>cn,setdiff1dAsync:()=>pr,sigmoid:()=>aa,sign:()=>ia,signal:()=>up,sin:()=>la,sinh:()=>ca,slice:()=>gc,slice1d:()=>vc,slice2d:()=>yc,slice3d:()=>bc,slice4d:()=>xc,slice_util:()=>Xa,softmax:()=>ni,softplus:()=>pa,spaceToBatchND:()=>sr,sparseToDense:()=>Zc,spectral:()=>$c,split:()=>Zn,sqrt:()=>ha,square:()=>xl,squaredDifference:()=>wl,squaredDifferenceStrict:()=>Ra,squeeze:()=>ur,stack:()=>lr,step:()=>fa,stft:()=>sp,stridedSlice:()=>Gc,sub:()=>Da,subStrict:()=>Oa,sum:()=>Dc,sumOutType:()=>Rt,tan:()=>da,tanh:()=>ma,tensor:()=>Rn,tensor1d:()=>Fn,tensor2d:()=>_n,tensor3d:()=>Mn,tensor4d:()=>zn,tensor5d:()=>Ln,tensor6d:()=>Bn,tensor_util:()=>Mt,test_util:()=>fl,tidy:()=>$e,tile:()=>tl,time:()=>tn,topk:()=>qc,train:()=>Ef,transpose:()=>ai,truncatedNormal:()=>Cl,unregisterGradient:()=>x,unregisterKernel:()=>b,unsortedSegmentSum:()=>Bl,unstack:()=>cr,util:()=>pt,valueAndGrad:()=>$a,valueAndGrads:()=>Za,variable:()=>Pn,variableGrads:()=>Qa,version:()=>cC,version_converter:()=>Lx,version_core:()=>gf,version_layers:()=>_g,webgl:()=>vf,where:()=>$u,whereAsync:()=>Zu,zeros:()=>Vn,zerosLike:()=>Hn});var r={};n.r(r),n.d(r,{CSVDataset:()=>Uw,Dataset:()=>Tw,FileDataSource:()=>nC,TextLineDataset:()=>Mw,URLDataSource:()=>rC,array:()=>Dw,csv:()=>aC,func:()=>iC,generator:()=>oC,microphone:()=>uC,version_data:()=>lC,webcam:()=>sC,zip:()=>Ow});var a=function(t,e){return(a=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)};function i(t,e){function n(){this.constructor=t}a(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}function o(t,e,n,r){return new(n||(n=Promise))((function(a,i){function o(t){try{u(r.next(t))}catch(t){i(t)}}function s(t){try{u(r.throw(t))}catch(t){i(t)}}function u(t){t.done?a(t.value):new n((function(e){e(t.value)})).then(o,s)}u((r=r.apply(t,e||[])).next())}))}function s(t,e){var n,r,a,i,o={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;o;)try{if(n=1,r&&(a=2&i[0]?r.return:i[0]?r.throw||((a=r.return)&&a.call(r),0):r.next)&&!(a=a.call(r,i[1])).done)return a;switch(r=0,a&&(i=[2&i[0],a.value]),i[0]){case 0:case 1:a=i;break;case 4:return o.label++,{value:i[1],done:!1};case 5:o.label++,r=i[1],i=[0];continue;case 7:i=o.ops.pop(),o.trys.pop();continue;default:if(!(a=(a=o.trys).length>0&&a[a.length-1])&&(6===i[0]||2===i[0])){o=0;continue}if(3===i[0]&&(!a||i[1]>a[0]&&i[1]<a[3])){o.label=i[1];break}if(6===i[0]&&o.label<a[1]){o.label=a[1],a=i;break}if(a&&o.label<a[2]){o.label=a[2],o.ops.push(i);break}a[2]&&o.ops.pop(),o.trys.pop();continue}i=e.call(t,o)}catch(t){i=[6,t],r=0}finally{n=a=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,s])}}}var u=function(){function t(t){this.global=t,this.flags={},this.flagRegistry={},this.urlFlags={},this.populateURLFlags()}return t.prototype.setPlatform=function(t,e){null!=this.platform&&console.warn("Platform "+this.platformName+" has already been set. Overwriting the platform with "+e+"."),this.platformName=t,this.platform=e},t.prototype.registerFlag=function(t,e,n){if(this.flagRegistry[t]={evaluationFn:e,setHook:n},null!=this.urlFlags[t]){var r=this.urlFlags[t];console.warn("Setting feature override from URL "+t+": "+r+"."),this.set(t,r)}},t.prototype.get=function(t){return t in this.flags||(this.flags[t]=this.evaluateFlag(t)),this.flags[t]},t.prototype.getNumber=function(t){return this.get(t)},t.prototype.getBool=function(t){return this.get(t)},t.prototype.getFlags=function(){return this.flags},Object.defineProperty(t.prototype,"features",{get:function(){return this.flags},enumerable:!0,configurable:!0}),t.prototype.set=function(t,e){if(null==this.flagRegistry[t])throw new Error("Cannot set flag "+t+" as it has not been registered.");this.flags[t]=e,null!=this.flagRegistry[t].setHook&&this.flagRegistry[t].setHook(e)},t.prototype.evaluateFlag=function(t){if(null==this.flagRegistry[t])throw new Error("Cannot evaluate flag '"+t+"': no evaluation function found.");return this.flagRegistry[t].evaluationFn()},t.prototype.setFlags=function(t){this.flags=Object.assign({},t)},t.prototype.reset=function(){this.flags={},this.urlFlags={},this.populateURLFlags()},t.prototype.populateURLFlags=function(){var t=this;if(void 0!==this.global&&void 0!==this.global.location&&void 0!==this.global.location.search){var e,n,r=(e=this.global.location.search,n={},e.replace(/[?&]([^=?&]+)(?:=([^&]*))?/g,(function(t){for(var e=[],r=1;r<arguments.length;r++)e[r-1]=arguments[r];return l(n,e[0],e[1]),e.join("=")})),n);"tfjsflags"in r&&r.tfjsflags.split(",").forEach((function(e){var n=e.split(":"),r=n[0],a=n[1];t.urlFlags[r]=function(t,e){if("true"===(e=e.toLowerCase())||"false"===e)return"true"===e;if(""+ +e===e)return+e;throw new Error("Could not parse value flag value "+e+" for flag "+t+".")}(r,a)}))}},t}();function l(t,e,n){t[decodeURIComponent(e)]=decodeURIComponent(n||"")}function c(){return p}var p=null,h=new Map,f=new Map;function d(t,e){var n=w(t,e);return h.get(n)}function m(t){return f.get(t)}function g(t){for(var e=h.entries(),n=[];;){var r=e.next(),a=r.done,i=r.value;if(a)break;var o=i[0],s=i[1];o.split("_")[0]===t&&n.push(s)}return n}function v(t){var e=t.kernelName,n=t.backendName,r=w(e,n);if(h.has(r))throw new Error("The kernel '"+e+"' for backend '"+n+"' is already registered");h.set(r,t)}function y(t){var e=t.kernelName;f.has(e)&&console.warn("Overriding the gradient for '"+e+"'"),f.set(e,t)}function b(t,e){var n=w(t,e);if(!h.has(n))throw new Error("The kernel '"+t+"' for backend '"+e+"' is not registered");h.delete(n)}function x(t){if(!f.has(t))throw new Error("The gradient '"+t+"' for backend is not registered");f.delete(t)}function w(t,e){return e+"_"+t}function C(t){for(var e=t.length,n=0,r=0;e>0;)r=Math.random()*e|0,n=t[--e],t[e]=t[r],t[r]=n}function N(t,e,n){return Math.max(t,Math.min(e,n))}function S(t){return t%2==0?t:t+1}function k(t){for(var e=0,n=0;n<t.length;n++)e+=t[n];return e}function I(t,e){if(!t)throw new Error("string"==typeof e?e:e())}function E(t,e,n){void 0===n&&(n=""),I(D(t,e),(function(){return n+" Shapes "+t+" and "+e+" must match"}))}function A(t){I(null!=t,(function(){return"The input to the tensor constructor must be a non-null value."}))}function T(t,e,n){if(void 0===e&&(e=[]),void 0===n&&(n=!1),null==e&&(e=[]),Array.isArray(t)||q(t)&&!n)for(var r=0;r<t.length;++r)T(t[r],e,n);else e.push(t);return e}function R(t){if(0===t.length)return 1;for(var e=t[0],n=1;n<t.length;n++)e*=t[n];return e}function D(t,e){if(t===e)return!0;if(null==t||null==e)return!1;if(t.length!==e.length)return!1;for(var n=0;n<t.length;n++)if(t[n]!==e[n])return!1;return!0}function O(t){return t%1==0}function F(t){if(null!=Math.tanh)return Math.tanh(t);if(t===1/0)return 1;if(t===-1/0)return-1;var e=Math.exp(2*t);return(e-1)/(e+1)}function _(t){var e=Math.ceil(Math.sqrt(t));return[e,Math.ceil(t/e)]}function M(t,e){return e<=t.length?t:t+" ".repeat(e-t.length)}function z(t,e,n){return void 0===e&&(e=function(t){return 0}),new Promise((function(r,a){var i=0,o=function(){if(t())r();else{i++;var s=e(i);null!=n&&i>=n?a():setTimeout(o,s)}};o()}))}function L(t,e){for(var n=1,r=-1,a=0;a<t.length;++a)if(t[a]>=0)n*=t[a];else if(-1===t[a]){if(-1!==r)throw Error("Shapes can only have 1 implicit size. Found -1 at dim "+r+" and dim "+a);r=a}else if(t[a]<0)throw Error("Shapes can not be < 0. Found "+t[a]+" at dim "+a);if(-1===r){if(e>0&&e!==n)throw Error("Size("+e+") must match the product of shape "+t);return t}if(0===n)throw Error("Cannot infer the missing size in ["+t+"] when there are 0 elements");if(e%n!=0)throw Error("The implicit shape can't be a fractional number. Got "+e+" / "+n);var i=t.slice();return i[r]=e/n,i}function B(t,e){var n=e.length;return I((t=null==t?e.map((function(t,e){return e})):[].concat(t)).every((function(t){return t>=-n&&t<n})),(function(){return"All values in axis param must be in range [-"+n+", "+n+") but got axis "+t})),I(t.every((function(t){return O(t)})),(function(){return"All values in axis param must be integers but got axis "+t})),t.map((function(t){return t<0?n+t:t}))}function P(t,e){for(var n=[],r=[],a=null!=e&&Array.isArray(e)&&0===e.length,i=null==e||a?null:B(e,t).sort(),o=0,s=0;s<t.length;++s){if(null!=i){if(i[o]===s&&1!==t[s])throw new Error("Can't squeeze axis "+s+" since its dim '"+t[s]+"' is not 1");(null==i[o]||i[o]>s)&&1===t[s]&&(n.push(t[s]),r.push(s)),i[o]<=s&&o++}1!==t[s]&&(n.push(t[s]),r.push(s))}return{newShape:n,keptDims:r}}function W(t,e){var n=null;if(null==t||"float32"===t)n=new Float32Array(e);else if("int32"===t)n=new Int32Array(e);else{if("bool"!==t)throw new Error("Unknown data type "+t);n=new Uint8Array(e)}return n}function V(t,e){var n=null;if(null==t||"float32"===t)n=new Float32Array(e);else if("int32"===t)n=new Int32Array(e);else if("bool"===t)n=new Uint8Array(e);else{if("string"!==t)throw new Error("Unknown data type "+t);n=new Array(e)}return n}function U(t,e){for(var n=0;n<t.length;n++){var r=t[n];if(isNaN(r)||!isFinite(r))throw Error("A tensor of type "+e+" being uploaded contains "+r+".")}}function j(t){return"bool"===t||"complex64"===t||"float32"===t||"int32"===t||"string"===t}function G(t,e){return!("complex64"===e||"float32"===e&&"complex64"!==t||"int32"===e&&"float32"!==t&&"complex64"!==t||"bool"===e&&"bool"===t)}function q(t){return t instanceof Float32Array||t instanceof Int32Array||t instanceof Uint8Array}function H(t){if("float32"===t||"int32"===t)return 4;if("complex64"===t)return 8;if("bool"===t)return 1;throw new Error("Unknown dtype "+t)}function K(t){if(null==t)return 0;var e=0;return t.forEach((function(t){return e+=t.length})),e}function X(t){return"string"==typeof t||t instanceof String}function Y(t){return"boolean"==typeof t}function J(t){return"number"==typeof t}function $(t){return Array.isArray(t)?$(t[0]):t instanceof Float32Array?"float32":t instanceof Int32Array||t instanceof Uint8Array?"int32":J(t)?"float32":X(t)?"string":Y(t)?"bool":"float32"}function Z(t){return!!(t&&t.constructor&&t.call&&t.apply)}function Q(t,e){for(var n=e;n<t;++n)if(t%n==0)return n;return t}function tt(t){var e=t.length;if(e<2)return[];var n=new Array(e-1);n[e-2]=t[e-1];for(var r=e-3;r>=0;--r)n[r]=n[r+1]*t[r+1];return n}function et(t,e,n){if("string"===e)throw new Error("Cannot convert a string[] to a TypedArray");if(Array.isArray(t)&&(t=T(t)),n&&U(t,e),function(t,e){return t instanceof Float32Array&&"float32"===e||t instanceof Int32Array&&"int32"===e||t instanceof Uint8Array&&"bool"===e}(t,e))return t;if(null==e||"float32"===e||"complex64"===e)return new Float32Array(t);if("int32"===e)return new Int32Array(t);if("bool"===e){for(var r=new Uint8Array(t.length),a=0;a<r.length;++a)0!==Math.round(t[a])&&(r[a]=1);return r}throw new Error("Unknown data type "+e)}function nt(t,e){if(0===t.length)return e[0];var n=t.reduce((function(t,e){return t*e}));if(0===n)return[];if(n!==e.length)throw new Error("["+t+"] does not match the input size.");return function t(e,n,r){var a=new Array;if(1===n.length)for(var i=n[0],o=0;o<i;o++)a[o]=r[e+o];else{i=n[0];var s=n.slice(1),u=s.reduce((function(t,e){return t*e}));for(o=0;o<i;o++)a[o]=t(e+o*u,s,r)}return a}(0,t,e)}function rt(t,e){for(var n=at(t,e),r=0;r<n.length;r++)n[r]=1;return n}function at(t,e){if(null==e||"float32"===e||"complex64"===e)return new Float32Array(t);if("int32"===e)return new Int32Array(t);if("bool"===e)return new Uint8Array(t);throw new Error("Unknown data type "+e)}function it(){return c().platform.now()}function ot(t){t.forEach((function(e){I(Number.isInteger(e)&&e>=0,(function(){return"Tensor must have a shape comprised of positive integers but got shape ["+t+"]."}))}))}function st(t,e){return void 0===e&&(e="utf-8"),e=e||"utf-8",c().platform.encode(t,e)}function ut(t,e){return void 0===e&&(e="utf-8"),e=e||"utf-8",c().platform.decode(t,e)}function lt(t,e,n){if(0===e)return 0;if(1===e)return t[0];for(var r=t[t.length-1],a=0;a<t.length-1;++a)r+=n[a]*t[a];return r}function ct(t,e,n){if(0===e)return[];if(1===e)return[t];for(var r=new Array(e),a=0;a<r.length-1;++a)r[a]=Math.floor(t/n[a]),t-=r[a]*n[a];return r[r.length-1]=t,r}var pt=Object.freeze({shuffle:C,clamp:N,nearestLargerEven:S,sum:k,randUniform:function(t,e){var n=Math.random();return e*n+(1-n)*t},distSquared:function(t,e){for(var n=0,r=0;r<t.length;r++){var a=Number(t[r])-Number(e[r]);n+=a*a}return n},assert:I,assertShapesMatch:E,assertNonNull:A,flatten:T,sizeFromShape:R,isScalarShape:function(t){return 0===t.length},arraysEqual:D,isInt:O,tanh:F,sizeToSquarishShape:_,createShuffledIndices:function(t){for(var e=new Uint32Array(t),n=0;n<t;++n)e[n]=n;return C(e),e},rightPad:M,repeatedTry:z,inferFromImplicitShape:L,parseAxisParam:B,squeezeShape:P,getTypedArrayFromDType:W,getArrayFromDType:V,checkConversionForErrors:U,isValidDtype:j,hasEncodingLoss:G,isTypedArray:q,bytesPerElement:H,bytesFromStringArray:K,isString:X,isBoolean:Y,isNumber:J,inferDtype:$,isFunction:Z,nearestDivisor:Q,computeStrides:tt,toTypedArray:et,toNestedArray:nt,makeOnesTypedArray:rt,makeZerosTypedArray:at,now:it,assertNonNegativeIntegerDimensions:ot,fetch:function(t,e){return c().platform.fetch(t,e)},encodeString:st,decodeString:ut,locToIndex:lt,indexToLoc:ct}),ht=function(){function t(t,e){this.backendTimer=t,this.logger=e,null==e&&(this.logger=new ft)}return t.prototype.profileKernel=function(t,e,n){var r,a=this,i=this.backendTimer.time((function(){r=n()}));return r.forEach((function(n){n.data().then((function(r){!function(t,e,n){if("float32"!==e)return!1;for(var r=0;r<t.length;r++){var a=t[r];if(isNaN(a)||!isFinite(a))return console.warn("Found "+a+" in the result of '"+n+"'"),!0}}(r,n.dtype,t),i.then((function(i){var o="";null!=i.getExtraProfileInfo&&(o=i.getExtraProfileInfo()),a.logger.logKernelProfile(t,n,r,i.kernelMs,e,o)}))}))})),r},t}(),ft=function(){function t(){}return t.prototype.logKernelProfile=function(t,e,n,r,a,i){var o="number"==typeof r?M(r+"ms",9):r.error,s=M(t,25),u=e.rank,l=e.size,c=M(e.shape.toString(),14),p="";for(var h in a){var f=a[h].shape||e.shape,d=f.length;p+=h+": "+d+"D "+(d>0?f:"")+" "}console.log("%c"+s+"\t%c"+o+"\t%c"+u+"D "+c+"\t%c"+l+"\t%c"+p+"\t%c"+i,"font-weight:bold","color:red","color:blue","color: orange","color: green","color: steelblue")},t}();function dt(t,e,n){return M(Array.isArray(t)?parseFloat(t[0].toFixed(7))+" + "+parseFloat(t[1].toFixed(7))+"j":X(t)?"'"+t+"'":"bool"===n?mt(t):parseFloat(t.toFixed(7)).toString(),e)}function mt(t){return 0===t?"false":"true"}function gt(t){for(var e=[],n=0;n<t.length;n+=2)e.push([t[n],t[n+1]]);return e}var vt=function(){function t(t,e,n){var r=this;if(this.dtype=e,this.shape=t.slice(),this.size=R(t),null!=n){var a=n.length;I(a===this.size,(function(){return"Length of values '"+a+"' does not match the size inferred by the shape '"+r.size+"'."}))}if("complex64"===e)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||V(e,this.size),this.strides=tt(t)}return t.prototype.set=function(t){for(var e=this,n=[],r=1;r<arguments.length;r++)n[r-1]=arguments[r];0===n.length&&(n=[0]),I(n.length===this.rank,(function(){return"The number of provided coordinates ("+n.length+") must match the rank ("+e.rank+")"}));var a=this.locToIndex(n);this.values[a]=t},t.prototype.get=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];0===t.length&&(t=[0]);for(var n=0,r=0,a=t;r<a.length;r++){var i=a[r];if(i<0||i>=this.shape[n]){var o="Requested out of range element at "+t+". Buffer shape="+this.shape;throw new Error(o)}n++}for(var s=t[t.length-1],u=0;u<t.length-1;++u)s+=this.strides[u]*t[u];return this.values[s]},t.prototype.locToIndex=function(t){if(0===this.rank)return 0;if(1===this.rank)return t[0];for(var e=t[t.length-1],n=0;n<t.length-1;++n)e+=this.strides[n]*t[n];return e},t.prototype.indexToLoc=function(t){if(0===this.rank)return[];if(1===this.rank)return[t];for(var e=new Array(this.shape.length),n=0;n<e.length-1;++n)e[n]=Math.floor(t/this.strides[n]),t-=e[n]*this.strides[n];return e[e.length-1]=t,e},Object.defineProperty(t.prototype,"rank",{get:function(){return this.shape.length},enumerable:!0,configurable:!0}),t.prototype.toTensor=function(){return yt().makeTensor(this.values,this.shape,this.dtype)},t}(),yt=null,bt=null,xt=null,wt=function(){function t(t,e,n,r){this.kept=!1,this.isDisposedInternal=!1,this.shape=t.slice(),this.dtype=e||"float32",this.size=R(t),this.strides=tt(t),this.dataId=n,this.id=r,this.rankType=this.rank<5?this.rank.toString():"higher"}return t.prototype.flatten=function(){return this.throwIfDisposed(),this.as1D()},t.prototype.asScalar=function(){return this.throwIfDisposed(),I(1===this.size,(function(){return"The array must have only 1 element."})),this.reshape([])},t.prototype.as1D=function(){return this.throwIfDisposed(),this.reshape([this.size])},t.prototype.as2D=function(t,e){return this.throwIfDisposed(),this.reshape([t,e])},t.prototype.as3D=function(t,e,n){return this.throwIfDisposed(),this.reshape([t,e,n])},t.prototype.as4D=function(t,e,n,r){return this.throwIfDisposed(),this.reshape([t,e,n,r])},t.prototype.as5D=function(t,e,n,r,a){return this.throwIfDisposed(),this.reshape([t,e,n,r,a])},t.prototype.asType=function(t){return this.throwIfDisposed(),bt.cast(this,t)},Object.defineProperty(t.prototype,"rank",{get:function(){return this.shape.length},enumerable:!0,configurable:!0}),t.prototype.buffer=function(){return o(this,void 0,void 0,(function(){var t;return s(this,(function(e){switch(e.label){case 0:return[4,this.data()];case 1:return t=e.sent(),[2,bt.buffer(this.shape,this.dtype,t)]}}))}))},t.prototype.bufferSync=function(){return bt.buffer(this.shape,this.dtype,this.dataSync())},t.prototype.array=function(){return o(this,void 0,void 0,(function(){var t;return s(this,(function(e){switch(e.label){case 0:return[4,this.data()];case 1:return t=e.sent(),[2,nt(this.shape,t)]}}))}))},t.prototype.arraySync=function(){return nt(this.shape,this.dataSync())},t.prototype.data=function(){return o(this,void 0,void 0,(function(){var t,e;return s(this,(function(n){switch(n.label){case 0:return this.throwIfDisposed(),t=yt().read(this.dataId),"string"!==this.dtype?[3,2]:[4,t];case 1:e=n.sent();try{return[2,e.map((function(t){return ut(t)}))]}catch(t){throw new Error("Failed to decode the string bytes into utf-8. To get the original bytes, call tensor.bytes().")}n.label=2;case 2:return[2,t]}}))}))},t.prototype.dataSync=function(){this.throwIfDisposed();var t=yt().readSync(this.dataId);if("string"===this.dtype)try{return t.map((function(t){return ut(t)}))}catch(t){throw new Error("Failed to decode the string bytes into utf-8. To get the original bytes, call tensor.bytes().")}return t},t.prototype.bytes=function(){return o(this,void 0,void 0,(function(){var t;return s(this,(function(e){switch(e.label){case 0:return this.throwIfDisposed(),[4,yt().read(this.dataId)];case 1:return t=e.sent(),"string"===this.dtype?[2,t]:[2,new Uint8Array(t.buffer)]}}))}))},t.prototype.dispose=function(){this.isDisposed||(yt().disposeTensor(this),this.isDisposedInternal=!0)},Object.defineProperty(t.prototype,"isDisposed",{get:function(){return this.isDisposedInternal},enumerable:!0,configurable:!0}),t.prototype.throwIfDisposed=function(){if(this.isDisposed)throw new Error("Tensor is disposed.")},t.prototype.toFloat=function(){return this.asType("float32")},t.prototype.toInt=function(){return this.asType("int32")},t.prototype.toBool=function(){return this.asType("bool")},t.prototype.print=function(t){return void 0===t&&(t=!1),bt.print(this,t)},t.prototype.reshape=function(t){return this.throwIfDisposed(),bt.reshape(this,t)},t.prototype.reshapeAs=function(t){return this.throwIfDisposed(),this.reshape(t.shape)},t.prototype.expandDims=function(t){return void 0===t&&(t=0),bt.expandDims(this,t)},t.prototype.cumsum=function(t,e,n){return void 0===t&&(t=0),void 0===e&&(e=!1),void 0===n&&(n=!1),bt.cumsum(this,t,e,n)},t.prototype.squeeze=function(t){return this.throwIfDisposed(),bt.squeeze(this,t)},t.prototype.clone=function(){return this.throwIfDisposed(),bt.clone(this)},t.prototype.toString=function(t){return void 0===t&&(t=!1),function(t,e,n,r){var a=tt(e),i=function(t,e,n,r){var a=R(e),i=r[r.length-1],o=new Array(i).fill(0),s=e.length,u="complex64"===n?gt(t):t;if(s>1)for(var l=0;l<a/i;l++)for(var c=l*i,p=0;p<i;p++)o[p]=Math.max(o[p],dt(u[c+p],0,n).length);return o}(t,e,n,a),o=e.length,s=function t(e,n,r,a,i,o){void 0===o&&(o=!0);var s="complex64"===r?2:1,u=n[0],l=n.length;if(0===l)return"complex64"===r?[dt(gt(e)[0],0,r)]:"bool"===r?[mt(e[0])]:[e[0].toString()];if(1===l){if(u>20){var c=3*s,p=Array.from(e.slice(0,c)),h=Array.from(e.slice((u-3)*s,u*s));return"complex64"===r&&(p=gt(p),h=gt(h)),["["+p.map((function(t,e){return dt(t,i[e],r)})).join(", ")+", ..., "+h.map((function(t,e){return dt(t,i[u-3+e],r)})).join(", ")+"]"]}return["["+("complex64"===r?gt(e):Array.from(e)).map((function(t,e){return dt(t,i[e],r)})).join(", ")+"]"]}var f=n.slice(1),d=a.slice(1),m=a[0]*s,g=[];if(u>20){for(var v=0;v<3;v++){var y=(b=v*m)+m;g.push.apply(g,t(e.slice(b,y),f,r,d,i,!1))}for(g.push("..."),v=u-3;v<u;v++)y=(b=v*m)+m,g.push.apply(g,t(e.slice(b,y),f,r,d,i,v===u-1))}else for(v=0;v<u;v++){var b;y=(b=v*m)+m,g.push.apply(g,t(e.slice(b,y),f,r,d,i,v===u-1))}var x=2===l?",":"";for(g[0]="["+g[0]+x,v=1;v<g.length-1;v++)g[v]=" "+g[v]+x;var w=",\n";for(v=2;v<l;v++)w+="\n";return g[g.length-1]=" "+g[g.length-1]+"]"+(o?"":w),g}(t,e,n,a,i),u=["Tensor"];return r&&(u.push(" dtype: "+n),u.push(" rank: "+o),u.push(" shape: ["+e+"]"),u.push(" values:")),u.push(s.map((function(t){return" "+t})).join("\n")),u.join("\n")}(this.dataSync(),this.shape,this.dtype,t)},t.prototype.gather=function(t,e){return void 0===e&&(e=0),this.throwIfDisposed(),bt.gather(this,t,e)},t.prototype.matMul=function(t,e,n){return void 0===e&&(e=!1),void 0===n&&(n=!1),this.throwIfDisposed(),bt.matMul(this,t,e,n)},t.prototype.dot=function(t){return this.throwIfDisposed(),bt.dot(this,t)},t.prototype.norm=function(t,e,n){return void 0===t&&(t="euclidean"),void 0===e&&(e=null),void 0===n&&(n=!1),this.throwIfDisposed(),bt.norm(this,t,e,n)},t.prototype.slice=function(t,e){return this.throwIfDisposed(),bt.slice(this,t,e)},t.prototype.reverse=function(t){return this.throwIfDisposed(),bt.reverse(this,t)},t.prototype.concat=function(e,n){return void 0===n&&(n=0),this.throwIfDisposed(),e instanceof t&&(e=[e]),bt.concat([this].concat(e),n)},t.prototype.split=function(t,e){return void 0===e&&(e=0),this.throwIfDisposed(),bt.split(this,t,e)},t.prototype.stack=function(t,e){return void 0===e&&(e=0),bt.stack([this,t],e)},t.prototype.unstack=function(t){return void 0===t&&(t=0),bt.unstack(this,t)},t.prototype.batchNormalization=function(t,e,n,r,a){return void 0===n&&(n=.001),xt("tf.batchNormalization() is going away. Use tf.batchNorm() instead, and note the positional argument change of scale, offset, and varianceEpsilon"),this.batchNorm(t,e,a,r,n)},t.prototype.all=function(t,e){return void 0===t&&(t=null),void 0===e&&(e=!1),this.throwIfDisposed(),bt.all(this,t,e)},t.prototype.any=function(t,e){return void 0===t&&(t=null),void 0===e&&(e=!1),this.throwIfDisposed(),bt.any(this,t,e)},t.prototype.logSumExp=function(t,e){return void 0===t&&(t=null),void 0===e&&(e=!1),this.throwIfDisposed(),bt.logSumExp(this,t,e)},t.prototype.sum=function(t,e){return void 0===t&&(t=null),void 0===e&&(e=!1),this.throwIfDisposed(),bt.sum(this,t,e)},t.prototype.prod=function(t,e){return void 0===t&&(t=null),void 0===e&&(e=!1),this.throwIfDisposed(),bt.prod(this,t,e)},t.prototype.mean=function(t,e){return void 0===t&&(t=null),void 0===e&&(e=!1),this.throwIfDisposed(),bt.mean(this,t,e)},t.prototype.min=function(t,e){return void 0===t&&(t=null),void 0===e&&(e=!1),this.throwIfDisposed(),bt.min(this,t,e)},t.prototype.max=function(t,e){return void 0===t&&(t=null),void 0===e&&(e=!1),this.throwIfDisposed(),bt.max(this,t,e)},t.prototype.argMin=function(t){return void 0===t&&(t=null),this.throwIfDisposed(),bt.argMin(this,t)},t.prototype.argMax=function(t){return void 0===t&&(t=null),this.throwIfDisposed(),bt.argMax(this,t)},t.prototype.cast=function(t){return this.throwIfDisposed(),bt.cast(this,t)},t.prototype.addStrict=function(t){return this.throwIfDisposed(),bt.addStrict(this,t)},t.prototype.atan2=function(t){return this.throwIfDisposed(),bt.atan2(this,t)},t.prototype.sub=function(t){return this.throwIfDisposed(),bt.sub(this,t)},t.prototype.subStrict=function(t){return this.throwIfDisposed(),bt.subStrict(this,t)},t.prototype.pow=function(t){return this.throwIfDisposed(),bt.pow(this,t)},t.prototype.powStrict=function(t){return this.throwIfDisposed(),bt.powStrict(this,t)},t.prototype.mul=function(t){return this.throwIfDisposed(),bt.mul(this,t)},t.prototype.mulStrict=function(t){return this.throwIfDisposed(),bt.mulStrict(this,t)},t.prototype.floorDiv=function(t){return this.throwIfDisposed(),bt.floorDiv(this,t)},t.prototype.divStrict=function(t){return this.throwIfDisposed(),bt.divStrict(this,t)},t.prototype.minimum=function(t){return this.throwIfDisposed(),bt.minimum(this,t)},t.prototype.minimumStrict=function(t){return this.throwIfDisposed(),bt.minimumStrict(this,t)},t.prototype.maximum=function(t){return this.throwIfDisposed(),bt.maximum(this,t)},t.prototype.maximumStrict=function(t){return this.throwIfDisposed(),bt.maximumStrict(this,t)},t.prototype.mod=function(t){return this.throwIfDisposed(),bt.mod(this,t)},t.prototype.modStrict=function(t){return this.throwIfDisposed(),bt.modStrict(this,t)},t.prototype.squaredDifferenceStrict=function(t){return this.throwIfDisposed(),bt.squaredDifferenceStrict(this,t)},t.prototype.notEqual=function(t){return this.throwIfDisposed(),bt.notEqual(this,t)},t.prototype.notEqualStrict=function(t){return this.throwIfDisposed(),bt.notEqualStrict(this,t)},t.prototype.less=function(t){return this.throwIfDisposed(),bt.less(this,t)},t.prototype.lessStrict=function(t){return this.throwIfDisposed(),bt.lessStrict(this,t)},t.prototype.equal=function(t){return this.throwIfDisposed(),bt.equal(this,t)},t.prototype.equalStrict=function(t){return this.throwIfDisposed(),bt.equalStrict(this,t)},t.prototype.lessEqual=function(t){return this.throwIfDisposed(),bt.lessEqual(this,t)},t.prototype.lessEqualStrict=function(t){return this.throwIfDisposed(),bt.lessEqualStrict(this,t)},t.prototype.greater=function(t){return this.throwIfDisposed(),bt.greater(this,t)},t.prototype.greaterStrict=function(t){return this.throwIfDisposed(),bt.greaterStrict(this,t)},t.prototype.greaterEqual=function(t){return this.throwIfDisposed(),bt.greaterEqual(this,t)},t.prototype.greaterEqualStrict=function(t){return this.throwIfDisposed(),bt.greaterEqualStrict(this,t)},t.prototype.logicalAnd=function(t){return this.throwIfDisposed(),bt.logicalAnd(this,t)},t.prototype.logicalOr=function(t){return this.throwIfDisposed(),bt.logicalOr(this,t)},t.prototype.logicalNot=function(){return this.throwIfDisposed(),bt.logicalNot(this)},t.prototype.logicalXor=function(t){return this.throwIfDisposed(),bt.logicalXor(this,t)},t.prototype.where=function(t,e){return this.throwIfDisposed(),bt.where(t,this,e)},t.prototype.neg=function(){return this.throwIfDisposed(),bt.neg(this)},t.prototype.ceil=function(){return this.throwIfDisposed(),bt.ceil(this)},t.prototype.floor=function(){return this.throwIfDisposed(),bt.floor(this)},t.prototype.sign=function(){return this.throwIfDisposed(),bt.sign(this)},t.prototype.isNaN=function(){return this.throwIfDisposed(),bt.isNaN(this)},t.prototype.isInf=function(){return this.throwIfDisposed(),bt.isInf(this)},t.prototype.isFinite=function(){return this.throwIfDisposed(),bt.isFinite(this)},t.prototype.exp=function(){return this.throwIfDisposed(),bt.exp(this)},t.prototype.expm1=function(){return this.throwIfDisposed(),bt.expm1(this)},t.prototype.log=function(){return this.throwIfDisposed(),bt.log(this)},t.prototype.log1p=function(){return this.throwIfDisposed(),bt.log1p(this)},t.prototype.sqrt=function(){return this.throwIfDisposed(),bt.sqrt(this)},t.prototype.rsqrt=function(){return this.throwIfDisposed(),bt.rsqrt(this)},t.prototype.square=function(){return this.throwIfDisposed(),bt.square(this)},t.prototype.reciprocal=function(){return this.throwIfDisposed(),bt.reciprocal(this)},t.prototype.abs=function(){return this.throwIfDisposed(),bt.abs(this)},t.prototype.clipByValue=function(t,e){return this.throwIfDisposed(),bt.clipByValue(this,t,e)},t.prototype.relu=function(){return this.throwIfDisposed(),bt.relu(this)},t.prototype.relu6=function(){return this.throwIfDisposed(),bt.relu6(this)},t.prototype.elu=function(){return this.throwIfDisposed(),bt.elu(this)},t.prototype.selu=function(){return this.throwIfDisposed(),bt.selu(this)},t.prototype.leakyRelu=function(t){return void 0===t&&(t=.2),this.throwIfDisposed(),bt.leakyRelu(this,t)},t.prototype.prelu=function(t){return this.throwIfDisposed(),bt.prelu(this,t)},t.prototype.sigmoid=function(){return this.throwIfDisposed(),bt.sigmoid(this)},t.prototype.logSigmoid=function(){return this.throwIfDisposed(),bt.logSigmoid(this)},t.prototype.softplus=function(){return this.throwIfDisposed(),bt.softplus(this)},t.prototype.zerosLike=function(){return this.throwIfDisposed(),bt.zerosLike(this)},t.prototype.onesLike=function(){return this.throwIfDisposed(),bt.onesLike(this)},t.prototype.sin=function(){return this.throwIfDisposed(),bt.sin(this)},t.prototype.cos=function(){return this.throwIfDisposed(),bt.cos(this)},t.prototype.tan=function(){return this.throwIfDisposed(),bt.tan(this)},t.prototype.asin=function(){return this.throwIfDisposed(),bt.asin(this)},t.prototype.acos=function(){return this.throwIfDisposed(),bt.acos(this)},t.prototype.atan=function(){return this.throwIfDisposed(),bt.atan(this)},t.prototype.sinh=function(){return this.throwIfDisposed(),bt.sinh(this)},t.prototype.cosh=function(){return this.throwIfDisposed(),bt.cosh(this)},t.prototype.tanh=function(){return this.throwIfDisposed(),bt.tanh(this)},t.prototype.asinh=function(){return this.throwIfDisposed(),bt.asinh(this)},t.prototype.acosh=function(){return this.throwIfDisposed(),bt.acosh(this)},t.prototype.atanh=function(){return this.throwIfDisposed(),bt.atanh(this)},t.prototype.erf=function(){return this.throwIfDisposed(),bt.erf(this)},t.prototype.round=function(){return this.throwIfDisposed(),bt.round(this)},t.prototype.step=function(t){return void 0===t&&(t=0),this.throwIfDisposed(),bt.step(this,t)},t.prototype.softmax=function(t){return void 0===t&&(t=-1),this.throwIfDisposed(),bt.softmax(this,t)},t.prototype.logSoftmax=function(t){return void 0===t&&(t=-1),this.throwIfDisposed(),bt.logSoftmax(this,t)},t.prototype.resizeBilinear=function(t,e){return void 0===e&&(e=!1),this.throwIfDisposed(),bt.image.resizeBilinear(this,t,e)},t.prototype.resizeNearestNeighbor=function(t,e){return void 0===e&&(e=!1),this.throwIfDisposed(),bt.image.resizeNearestNeighbor(this,t,e)},t.prototype.conv1d=function(t,e,n,r,a,i){return void 0===r&&(r="NWC"),void 0===a&&(a=1),this.throwIfDisposed(),bt.conv1d(this,t,e,n,r,a,i)},t.prototype.conv2d=function(t,e,n,r,a,i){return void 0===r&&(r="NHWC"),void 0===a&&(a=[1,1]),this.throwIfDisposed(),bt.conv2d(this,t,e,n,r,a,i)},t.prototype.conv2dTranspose=function(t,e,n,r,a){return this.throwIfDisposed(),bt.conv2dTranspose(this,t,e,n,r,a)},t.prototype.depthwiseConv2D=function(t,e,n,r,a,i){return void 0===r&&(r="NHWC"),void 0===a&&(a=[1,1]),this.throwIfDisposed(),bt.depthwiseConv2d(this,t,e,n,r,a,i)},t.prototype.separableConv2d=function(t,e,n,r,a,i){return void 0===a&&(a=[1,1]),void 0===i&&(i="NHWC"),this.throwIfDisposed(),bt.separableConv2d(this,t,e,n,r,a,i)},t.prototype.avgPool=function(t,e,n,r){return this.throwIfDisposed(),bt.avgPool(this,t,e,n,r)},t.prototype.maxPool=function(t,e,n,r){return this.throwIfDisposed(),bt.maxPool(this,t,e,n,r)},t.prototype.localResponseNormalization=function(t,e,n,r){return void 0===t&&(t=5),void 0===e&&(e=1),void 0===n&&(n=1),void 0===r&&(r=.5),bt.localResponseNormalization(this,t,e,n,r)},t.prototype.pool=function(t,e,n,r,a){return this.throwIfDisposed(),bt.pool(this,t,e,n,r,a)},t.prototype.variable=function(t,e,n){return void 0===t&&(t=!0),this.throwIfDisposed(),yt().makeVariable(this,t,e,n)},t.prototype.unsortedSegmentSum=function(t,e){return this.throwIfDisposed(),bt.unsortedSegmentSum(this,t,e)},t.prototype.batchToSpaceND=function(t,e){return this.throwIfDisposed(),bt.batchToSpaceND(this,t,e)},t.prototype.spaceToBatchND=function(t,e){return this.throwIfDisposed(),bt.spaceToBatchND(this,t,e)},t.prototype.topk=function(t,e){return void 0===t&&(t=1),void 0===e&&(e=!0),this.throwIfDisposed(),bt.topk(this,t,e)},t.prototype.stridedSlice=function(t,e,n,r,a,i,o,s){return void 0===r&&(r=0),void 0===a&&(a=0),void 0===i&&(i=0),void 0===o&&(o=0),void 0===s&&(s=0),this.throwIfDisposed(),bt.stridedSlice(this,t,e,n,r,a,i,o,s)},t.prototype.depthToSpace=function(t,e){return this.throwIfDisposed(),bt.depthToSpace(this,t,e)},t.prototype.fft=function(){return this.throwIfDisposed(),bt.spectral.fft(this)},t.prototype.ifft=function(){return this.throwIfDisposed(),bt.spectral.ifft(this)},t.prototype.rfft=function(){return this.throwIfDisposed(),bt.spectral.rfft(this)},t.prototype.irfft=function(){return this.throwIfDisposed(),bt.spectral.irfft(this)},t}();Object.defineProperty(wt,Symbol.hasInstance,{value:function(t){return!!t&&null!=t.dataId&&null!=t.shape&&null!=t.dtype}});var Ct,Nt,St,kt,It,Et=function(t){function e(e,n,r,a){var i=t.call(this,e.shape,e.dtype,e.dataId,a)||this;return i.trainable=n,i.name=r,i}return i(e,t),e.prototype.assign=function(t){if(t.dtype!==this.dtype)throw new Error("dtype of the new value ("+t.dtype+") and previous value ("+this.dtype+") must match");if(!D(t.shape,this.shape))throw new Error("shape of the new value ("+t.shape+") and previous value ("+this.shape+") must match");yt().disposeTensor(this),this.dataId=t.dataId,yt().incRef(this,null)},e.prototype.dispose=function(){yt().disposeVariable(this),this.isDisposedInternal=!0},e}(wt);Object.defineProperty(Et,Symbol.hasInstance,{value:function(t){return t instanceof wt&&null!=t.assign&&t.assign instanceof Function}}),function(t){t.R0="R0",t.R1="R1",t.R2="R2",t.R3="R3",t.R4="R4",t.R5="R5",t.R6="R6"}(Ct||(Ct={})),function(t){t.float32="float32",t.int32="int32",t.bool="int32",t.complex64="complex64"}(Nt||(Nt={})),function(t){t.float32="float32",t.int32="int32",t.bool="bool",t.complex64="complex64"}(St||(St={})),function(t){t.float32="float32",t.int32="float32",t.bool="float32",t.complex64="complex64"}(kt||(kt={})),function(t){t.float32="complex64",t.int32="complex64",t.bool="complex64",t.complex64="complex64"}(It||(It={}));var At={float32:kt,int32:Nt,bool:St,complex64:It};function Tt(t,e){if("string"===t||"string"===e){if("string"===t&&"string"===e)return"string";throw new Error("Can not upcast "+t+" with "+e)}return At[t][e]}function Rt(t){return Tt(t,"int32")}function Dt(t,e){if(t.dtype===e.dtype)return[t,e];var n=Tt(t.dtype,e.dtype);return[t.cast(n),e.cast(n)]}function Ot(t,e){I(t.dtype===e.dtype,(function(){return"The dtypes of the first("+t.dtype+") and second("+e.dtype+") input must match"}))}function Ft(t){var e=[];return function t(e,n,r){if(null!=e)if(e instanceof wt)n.push(e);else if(a=e,Array.isArray(a)||"object"==typeof a){var a,i=e;for(var o in i){var s=i[o];r.has(s)||(r.add(s),t(s,n,r))}}}(t,e,new Set),e}var _t,Mt=Object.freeze({makeTypesMatch:Dt,assertTypesMatch:Ot,isTensorInList:function(t,e){return e.some((function(e){return e.id===t.id}))},getTensorsInContainer:Ft}),zt=function(){function t(){this.registeredVariables={},this.nextTapeNodeId=0,this.numBytes=0,this.numTensors=0,this.numStringTensors=0,this.numDataBuffers=0,this.gradientDepth=0,this.kernelDepth=0,this.scopeStack=[],this.numDataMovesStack=[],this.nextScopeId=0,this.tensorInfo=new WeakMap,this.profiling=!1,this.activeProfile={newBytes:0,newTensors:0,peakBytes:0,kernels:[],result:null}}return t.prototype.dispose=function(){for(var t in this.registeredVariables)this.registeredVariables[t].dispose()},t}(),Lt=function(){function t(t){this.ENV=t,this.registry={},this.registryFactory={},this.pendingBackendInitId=0,this.state=new zt}return t.prototype.ready=function(){return o(this,void 0,void 0,(function(){var t,e,n;return s(this,(function(r){switch(r.label){case 0:if(null!=this.pendingBackendInit)return[2,this.pendingBackendInit.then((function(){}))];if(null!=this.backendInstance)return[2];t=this.getSortedBackends(),e=0,r.label=1;case 1:return e<t.length?(n=t[e],[4,this.initializeBackend(n).success]):[3,5];case 2:return r.sent()?[4,this.setBackend(n)]:[3,4];case 3:return r.sent(),[2];case 4:return e++,[3,1];case 5:throw new Error("Could not initialize any backends, all backend initializations failed.")}}))}))},Object.defineProperty(t.prototype,"backend",{get:function(){if(null!=this.pendingBackendInit)throw new Error("Backend '"+this.backendName+"' has not yet been initialized. Make sure to await tf.ready() or await tf.setBackend() before calling other methods");if(null==this.backendInstance){var t=this.initializeBackendsAndReturnBest(),e=t.name;if(t.asyncInit)throw new Error("The highest priority backend '"+e+"' has not yet been initialized. Make sure to await tf.ready() or await tf.setBackend() before calling other methods");this.setBackend(e)}return this.backendInstance},enumerable:!0,configurable:!0}),t.prototype.backendNames=function(){return Object.keys(this.registryFactory)},t.prototype.findBackend=function(t){if(!(t in this.registry)){if(!(t in this.registryFactory))return null;if(this.initializeBackend(t).asyncInit)return null}return this.registry[t]},t.prototype.findBackendFactory=function(t){return t in this.registryFactory?this.registryFactory[t].factory:null},t.prototype.registerBackend=function(t,e,n){return void 0===n&&(n=1),t in this.registryFactory?(console.warn(t+" backend was already registered. Reusing existing backend factory."),!1):(this.registryFactory[t]={factory:e,priority:n},!0)},t.prototype.setBackend=function(t){return o(this,void 0,void 0,(function(){var e,n,r;return s(this,(function(a){switch(a.label){case 0:if(null==this.registryFactory[t])throw new Error("Backend name '"+t+"' not found in registry");return this.backendName=t,null!=this.registry[t]?[3,4]:(this.backendInstance=null,e=this.initializeBackend(t),n=e.success,e.asyncInit?[4,n]:[3,2]);case 1:return r=a.sent(),[3,3];case 2:r=n,a.label=3;case 3:if(!r)return[2,!1];a.label=4;case 4:return this.backendInstance=this.registry[t],this.setupRegisteredKernels(),this.profiler=new ht(this.backendInstance),[2,!0]}}))}))},t.prototype.setupRegisteredKernels=function(){var t=this;g(this.backendName).forEach((function(e){null!=e.setupFunc&&e.setupFunc(t.backendInstance)}))},t.prototype.disposeRegisteredKernels=function(t){var e=this;g(t).forEach((function(n){null!=n.disposeFunc&&n.disposeFunc(e.registry[t])}))},t.prototype.initializeBackend=function(t){var e=this,n=this.registryFactory[t];if(null==n)throw new Error("Cannot initialize backend "+t+", no registration found.");try{var r=n.factory();if(Promise.resolve(r)===r){var a=++this.pendingBackendInitId,i=r.then((function(n){return!(a<e.pendingBackendInitId||(e.registry[t]=n,e.pendingBackendInit=null,0))})).catch((function(n){return!(a<e.pendingBackendInitId||(e.pendingBackendInit=null,console.warn("Initialization of backend "+t+" failed"),console.warn(n.stack||n.message),1))}));return this.pendingBackendInit=i,{success:i,asyncInit:!0}}return this.registry[t]=r,{success:!0,asyncInit:!1}}catch(e){return console.warn("Initialization of backend "+t+" failed"),console.warn(e.stack||e.message),{success:!1,asyncInit:!1}}},t.prototype.removeBackend=function(t){if(!(t in this.registryFactory))throw new Error(t+" backend not found in registry");this.backendName===t&&null!=this.pendingBackendInit&&this.pendingBackendInitId++,t in this.registry&&(this.disposeRegisteredKernels(t),this.registry[t].dispose(),delete this.registry[t]),delete this.registryFactory[t],this.backendName===t&&(this.pendingBackendInit=null,this.backendName=null,this.backendInstance=null)},t.prototype.getSortedBackends=function(){var t=this;if(0===Object.keys(this.registryFactory).length)throw new Error("No backend found in registry.");return Object.keys(this.registryFactory).sort((function(e,n){return t.registryFactory[n].priority-t.registryFactory[e].priority}))},t.prototype.initializeBackendsAndReturnBest=function(){for(var t=this.getSortedBackends(),e=0;e<t.length;e++){var n=t[e],r=this.initializeBackend(n),a=r.success,i=r.asyncInit;if(i||a)return{name:n,asyncInit:i}}throw new Error("Could not initialize any backends, all backend initializations failed.")},t.prototype.moveData=function(t,e){var n=this.state.tensorInfo.get(e),r=n.backend,a=this.readSync(e);r.disposeData(e),n.backend=t,t.move(e,a,n.shape,n.dtype),this.shouldCheckForMemLeaks()&&this.state.numDataMovesStack[this.state.numDataMovesStack.length-1]++},t.prototype.tidy=function(t,e){var n,r=this,a=null;if(null==e){if("function"!=typeof t)throw new Error("Please provide a function to tidy()");e=t}else{if("string"!=typeof t&&!(t instanceof String))throw new Error("When calling with two arguments, the first argument to tidy() must be a string");if("function"!=typeof e)throw new Error("When calling with two arguments, the 2nd argument to tidy() must be a function");a=t}return this.scopedRun((function(){return r.startScope(a)}),(function(){return r.endScope(n)}),(function(){return(n=e())instanceof Promise&&console.error("Cannot return a Promise inside of tidy."),n}))},t.prototype.scopedRun=function(t,e,n){t();try{var r=n();return e(),r}catch(t){throw e(),t}},t.prototype.nextTensorId=function(){return t.nextTensorId++},t.prototype.nextVariableId=function(){return t.nextVariableId++},t.prototype.clone=function(t){var e=this.makeTensorFromDataId(t.dataId,t.shape,t.dtype),n={x:t};return this.addTapeNode(this.state.activeScope.name,n,[e],(function(t){return{x:function(){return t.toFloat()}}}),[],{}),e},t.prototype.runKernel=function(t,e,n,r,a){return this.runKernelFunc(null,e,null,t,n,r,a)},t.prototype.shouldCheckForMemLeaks=function(){return this.ENV.getBool("IS_TEST")},t.prototype.checkKernelForMemLeak=function(t,e,n){var r=this.backend.numDataIds(),a=0;n.forEach((function(t){a+="complex64"===t.dtype?3:1}));var i=this.state.numDataMovesStack[this.state.numDataMovesStack.length-1],o=r-e-a-i;if(o>0)throw new Error("Backend '"+this.backendName+"' has an internal memory leak ("+o+" data ids) after running '"+t+"'")},t.prototype.runKernelFunc=function(t,e,n,r,a,i,o){var s,u=this,l=[],c=this.isTapeOn();null==r&&(r=null!=this.state.activeScope?this.state.activeScope.name:"");var p,h=this.state.numBytes,f=this.state.numTensors;this.shouldCheckForMemLeaks()&&this.state.numDataMovesStack.push(0);var m,g=d(r,this.backendName);if(null!=g)p=function(){var t=u.backend.numDataIds();m=g.kernelFunc({inputs:e,attrs:a,backend:u.backend});var n=Array.isArray(m)?m:[m];u.shouldCheckForMemLeaks()&&u.checkKernelForMemLeak(r,t,n);var s=n.map((function(t){var e=t.dataId,n=t.shape,r=t.dtype;return u.makeTensorFromDataId(e,n,r)}));if(c){var p=u.getTensorsForGradient(r,e,s);if(null==p){null==o&&(o=[]);var h=s.filter((function(t,e){return o[e]}));p=(i||[]).slice().concat(h)}l=u.saveTensorsForBackwardMode(p)}return s};else{var v=function(t){c&&(l=t.map((function(t){return u.keep(u.clone(t))})))};p=function(){var e=u.backend.numDataIds();m=u.tidy((function(){return t(u.backend,v)}));var n=Array.isArray(m)?m:[m];return u.shouldCheckForMemLeaks()&&u.checkKernelForMemLeak(r,e,n),n}}return this.scopedRun((function(){return u.state.kernelDepth++}),(function(){return u.state.kernelDepth--}),(function(){s=u.ENV.getBool("DEBUG")?u.profiler.profileKernel(r,e,(function(){return p()})):p()})),c&&this.addTapeNode(r,e,s,n,l,a),this.state.profiling&&this.state.activeProfile.kernels.push({name:r,bytesAdded:this.state.numBytes-h,totalBytesSnapshot:this.state.numBytes,tensorsAdded:this.state.numTensors-f,totalTensorsSnapshot:this.state.numTensors,inputShapes:Object.keys(e).map((function(t){return e[t].shape})),outputShapes:s.map((function(t){return t.shape}))}),Array.isArray(m)?s:s[0]},t.prototype.saveTensorsForBackwardMode=function(t){var e=this;return t.map((function(t){return e.keep(e.clone(t))}))},t.prototype.getTensorsForGradient=function(t,e,n){var r=m(t);if(null!=r){var a=r.inputsToSave||[],i=r.outputsToSave||[],o=void 0;r.saveAllInputs?(I(Array.isArray(e),(function(){return"saveAllInputs is true, expected inputs to be an array."})),o=Object.keys(e).map((function(t){return e[t]}))):o=a.map((function(t){return e[t]}));var s=n.filter((function(t,e){return i[e]}));return o.concat(s)}return null},t.prototype.makeTensor=function(t,e,n,r){if(null==t)throw new Error("Values passed to engine.makeTensor() are null");n=n||"float32",r=r||this.backend;var a=t;"string"===n&&X(t[0])&&(a=t.map((function(t){return st(t)})));var i=r.write(a,e,n),o=new wt(e,n,i,this.nextTensorId());if(this.incRef(o,r),"string"===n){var s=this.state.tensorInfo.get(i),u=K(a);this.state.numBytes+=u-s.bytes,s.bytes=u}return o},t.prototype.makeTensorFromDataId=function(t,e,n,r){var a=new wt(e,n=n||"float32",t,this.nextTensorId());return