2021-03-10 00:32:35 +01:00
/ *
Human library
homepage : < https : //github.com/vladmandic/human>
author : < https : //github.com/vladmandic>'
* /
2021-04-28 14:58:21 +02:00
var Human = ( ( ) => { var O9 = Object . defineProperty ; var fa = ( e , t ) => { for ( var n in t ) O9 ( e , n , { get : t [ n ] , enumerable : ! 0 } ) } ; var Dg = ( e , t , n ) => { if ( ! t . has ( e ) ) throw TypeError ( "Cannot " + n ) } ; var na = ( e , t , n ) => ( Dg ( e , t , "read from private field" ) , n ? n . call ( e ) : t . get ( e ) ) , as = ( e , t , n , a ) => ( Dg ( e , t , "write to private field" ) , a ? a . call ( e , n ) : t . set ( e , n ) , n ) ; var $ie = { } ; fa ( $ie , { Human : ( ) => Gk , default : ( ) => Gk } ) ; function Yt ( e , t ) { let n = e . endsWith ( "/" ) ? "" : "/" , r = t . startsWith ( "." ) || t . startsWith ( "/" ) || t . startsWith ( "http:" ) || t . startsWith ( "https:" ) || t . startsWith ( "file:" ) ? ` ${ t } ` : ` ${ e } ${ n } ${ t } ` ; if ( ! r . toLocaleLowerCase ( ) . includes ( ".json" ) ) throw new Error ( ` Human: ModelPath Error: ${ r } Expecting JSON file ` ) ; return r } function he ( ... e ) { let t = new Date , n = ` ${ t . getHours ( ) . toString ( ) . padStart ( 2 , "0" ) } : ${ t . getMinutes ( ) . toString ( ) . padStart ( 2 , "0" ) } : ${ t . getSeconds ( ) . toString ( ) . padStart ( 2 , "0" ) } . ${ t . getMilliseconds ( ) . toString ( ) . padStart ( 3 , "0" ) } ` ; e && console . log ( n , "Human:" , ... e ) } var it = ( ) => typeof performance != "undefined" ? performance . now ( ) : parseInt ( ( Number ( process . hrtime . bigint ( ) ) / 1e3 / 1e3 ) . toString ( ) ) ; function Hn ( ... e ) { let t = n => n && typeof n == "object" ; return e . reduce ( ( n , a ) => ( Object . keys ( a || { } ) . forEach ( r => { let s = n [ r ] , i = a [ r ] ; Array . isArray ( s ) && Array . isArray ( i ) ? n [ r ] = s . concat ( ... i ) : t ( s ) && t ( i ) ? n [ r ] = Hn ( s , i ) : n [ r ] = i } ) , n ) , { } ) } function Og ( ) { let e , t ; if ( typeof navigator != "undefined" ) { let n = navigator . userAgent . match ( /\(([^()]+)\)/g ) ; if ( n && n [ 0 ] ) { let a = n [ 0 ] . match ( /\(([^()]+)\)/g ) ; e = a ? a [ 0 ] . replace ( /\(|\)/g , "" ) : "" , t = navigator . userAgent . replace ( n [ 0 ] , "" ) , e [ 1 ] && ( t = t . replace ( n [ 1 ] , "" ) ) , t = t . replace ( / /g , " " ) } } else typeof process != "undefined" && ( e = ` ${ process . platform } ${ process . arch } ` , t = ` NodeJS ${ process . version } ` ) ; return { platform : e , agent : t } } var lu = { } ; fa ( lu , { Abs : ( ) => eo , Acos : ( ) => to , Acosh : ( ) => no , AdadeltaOptimizer : ( ) => qc , AdagradOptimizer : ( ) => Xc , AdamOptimizer : ( ) => Kc , AdamaxOptimizer : ( ) => Zc , Add : ( ) => kr , AddN : ( ) => is , All : ( ) => ao , Any : ( ) => ro , ArgMax : ( ) => os , ArgMin : ( ) => hu , Asin : ( ) => so , Asinh : ( ) => io , Atan : ( ) => oo , Atan2 : ( ) => uo , Atanh : ( ) => lo , AvgPool : ( ) => ls , AvgPool3D : ( ) => fu , AvgPool3DGrad : ( ) => Tp , AvgPoolGrad : ( ) => Np , BackendWasm : ( ) => iw , BatchMatMul : ( ) => us , BatchToSpaceND : ( ) => mu , Bincount : ( ) => Ep , BroadcastTo : ( ) => Tx , Callback : ( ) => J4 , CallbackList : ( ) => Kw , Cast : ( ) => ds , Ceil : ( ) => ps , ClipByValue : ( ) => Ir , Complex : ( ) => Cp , ComplexAbs : ( ) => Au , Concat : ( ) => po , Conv2D : ( ) => cs , Conv2DBackpropFilter : ( ) => Rp , Conv2DBackpropInput : ( ) => hs , Conv3D : ( ) => yu , Conv3DBackpropFilterV2 : ( ) => Mp , Conv3DBackpropInputV2 : ( ) => Fp , Cos : ( ) => fs , Cosh : ( ) => co , CropAndResize : ( ) => ho , Cumsum : ( ) => ms , CustomCallback : ( ) => Yw , DataStorage : ( ) => wp , DenseBincount : ( ) => $p , DepthToSpace : ( ) => fo , DepthwiseConv2dNative : ( ) => As , DepthwiseConv2dNativeBackpropFilter : ( ) => Dp , DepthwiseConv2dNativeBackpropInput : ( ) => Op , Diag : ( ) => zp , Dilation2D : ( ) => gu , Dilation2DBackpropFilter : ( ) => Pp , Dilation2DBackpropInput : ( ) => _p , ENV : ( ) => ma , EarlyStopping : ( ) => e8 , Einsum : ( ) => Lp , Elu : ( ) => mo , EluGrad : ( ) => Wp , Environment : ( ) => Sx , Equal : ( ) => yo , Erf : ( ) => Ao , Exp : ( ) => gs , ExpandDims : ( ) => go , Expm1 : ( ) => xo , FFT : ( ) => Bp , Fill : ( ) => xu , FlipLeftRight : ( ) => bo , Floor : ( ) => xs , FloorDiv : ( ) => bs , FromPixels : ( ) => ac , FusedBatchNorm : ( ) => vs , FusedConv2D : ( ) => ti , FusedDepthwiseConv2D : ( ) => ni , GPGPUContext : ( ) => hh , GatherNd : ( ) => wo , GatherV2 : ( ) => vo , GraphModel : ( ) => R8 , Greater : ( ) => ko , GreaterEqual : ( ) => ws , History : ( ) => Zw , IFFT : ( ) => Vp , Identity : ( ) => ks , Imag : ( ) => jp , InputSpec : ( ) => Mt , IsFinite : ( ) => Io , IsInf : ( ) => So , IsNan : ( ) => No , KernelBackend : ( ) => du , LRN : ( ) => wu , LRNGrad : ( ) => Hp , LayerVariable : ( ) => Uw , LayersModel : ( ) => pr , LeakyRelu : ( ) => Is , Less : ( ) => To , LessEqual : ( ) => Eo , LinSpace : ( ) => Up , Log : ( ) => Ss , Log1p : ( ) => Co , LogSoftmax : ( ) => Ex , LogicalAnd : ( ) => Ro , LogicalNot : ( ) => bu , LogicalOr : ( ) => vu , MathBackendCPU : ( ) => eh , MathBackendWebGL : ( ) => $l , Max : ( ) => Ns , MaxPool : ( ) => Es , MaxPool3D : ( ) => ku , MaxPool3DGrad : ( ) => qp , MaxPoolGrad : ( ) => Gp , MaxPoolWithArgmax : ( ) => Xp , Maximum : ( ) => Ts , Mean : ( ) => Cs , Min : ( ) => Rs , Minimum : ( ) => Ms , MirrorPad : ( ) => Fs , Mod : ( ) => Mo , MomentumOptimizer : ( ) => Yc , Multinomial : ( ) => Kp , Multiply : ( ) => $s , Neg : ( ) => Fo , NonMaxSuppressionV3 : ( ) => Do , NonMaxSuppressionV4 : ( ) => Oo , NonMaxSuppressionV5 : ( ) => zo , NotEqual : ( ) => $o , OP _SCOPE _SUFFIX : ( ) => Lx , OneHot : ( ) => Ds , OnesLike : ( ) => _o , Optimizer : ( ) => or , Pack : ( ) => Po , PadV2 : ( ) => Os , Pool : ( ) => zI , Pow : ( ) => zs , Prelu : ( ) => _s , Prod : ( ) => Lo , RMSPropOptimizer : ( ) => Jc , RNN : ( ) => Ha , Ran
` )),l.join( `
` )}function XI(e,t,n,a){let r=Tt(t),s=a[a.length-1],i=new Array(s).fill(0),o=t.length,l=n==="complex64"?Du(e):e;if(o>1)for(let d=0;d<r/s;d++){let u=d*s;for(let p=0;p<s;p++)i[p]=Math.max(i[p], $ u(l[u+p],0,n).length)}return i}function $ u(e,t,n){let a;return Array.isArray(e)?a= ` $ { parseFloat ( e [ 0 ] . toFixed ( bm ) ) } + $ { parseFloat ( e [ 1 ] . toFixed ( bm ) ) } j ` :vr(e)?a= ` '${e}' ` :n==="bool"?a=Mx(e):a=parseFloat(e.toFixed(bm)).toString(),cu(a,t)}function Mx(e){return e===0?"false":"true"}function oc(e,t,n,a,r,s=!0){let i=n==="complex64"?2:1,o=t[0],l=t.length;if(l===0){if(n==="complex64"){let f=Du(e);return[ $ u(f[0],0,n)]}return n==="bool"?[Mx(e[0])]:[e[0].toString()]}if(l===1){if(o>Rx){let A=Fu*i,y=Array.from(e.slice(0,A)),g=Array.from(e.slice((o-Fu)*i,o*i));return n==="complex64"&&(y=Du(y),g=Du(g)),["["+y.map((x,w)=> $ u(x,r[w],n)).join(", ")+", ..., "+g.map((x,w)=> $ u(x,r[o-Fu+w],n)).join(", ")+"]"]}let f=n==="complex64"?Du(e):Array.from(e);return["["+f.map((A,y)=> $ u(A,r[y],n)).join(", ")+"]"]}let d=t.slice(1),u=a.slice(1),p=a[0]*i,c=[];if(o>Rx){for(let f=0;f<Fu;f++){let A=f*p,y=A+p;c.push(...oc(e.slice(A,y),d,n,u,r,!1))}c.push("...");for(let f=o-Fu;f<o;f++){let A=f*p,y=A+p;c.push(...oc(e.slice(A,y),d,n,u,r,f===o-1))}}else for(let f=0;f<o;f++){let A=f*p,y=A+p;c.push(...oc(e.slice(A,y),d,n,u,r,f===o-1))}let h=l===2?",":"";c[0]="["+c[0]+h;for(let f=1;f<c.length-1;f++)c[f]=" "+c[f]+h;let m= ` ,
` ;for(let f=2;f<l;f++)m+= `
` ;return c[c.length-1]=" "+c[c.length-1]+"]"+(s?"":m),c}function Du(e){let t=[];for(let n=0;n<e.length;n+=2)t.push([e[n],e[n+1]]);return t}var Dt=class{constructor(e,t,n){if(this.dtype=t,this.shape=e.slice(),this.size=Tt(e),n!=null){let a=n.length;F(a===this.size,()=> ` Length of values '${a}' does not match the size inferred by the shape '${this.size}' . ` )}if(t==="complex64")throw new Error("complex64 dtype TensorBuffers are not supported. Please create a TensorBuffer for the real and imaginary parts separately and call tf.complex(real, imag).");this.values=n||yx(t,this.size),this.strides=Ji(e)}set(e,...t){t.length===0&&(t=[0]),F(t.length===this.rank,()=> ` The number of provided coordinates ( $ { t . length } ) must match the rank ( $ { this . rank } ) ` );let n=this.locToIndex(t);this.values[n]=e}get(...e){e.length===0&&(e=[0]);let t=0;for(let a of e){if(a<0||a>=this.shape[t]){let r= ` Requested out of range element at $ { e } . Buffer shape = $ { this . shape } ` ;throw new Error(r)}t++}let n=e[e.length-1];for(let a=0;a<e.length-1;++a)n+=this.strides[a]*e[a];return this.values[n]}locToIndex(e){if(this.rank===0)return 0;if(this.rank===1)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(this.rank===0)return[];if(this.rank===1)return[e];let 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 $ a().makeTensor(this.values,this.shape,this.dtype)}}, $ a=null,al=null,ZI=null;function YI(e){ $ a=e}function JI(e){al=e}function QI(e){ZI=e}var Le=class{constructor(e,t,n,a){this.kept=!1,this.isDisposedInternal=!1,this.shape=e.slice(),this.dtype=t||"float32",this.size=Tt(e),this.strides=Ji(e),this.dataId=n,this.id=a,this.rankType=this.rank<5?this.rank.toString():"higher"}get rank(){return this.shape.length}async buffer(){let e=await this.data();return al.buffer(this.shape,this.dtype,e)}bufferSync(){return al.buffer(this.shape,this.dtype,this.dataSync())}async array(){let e=await this.data();return Qi(this.shape,e,this.dtype==="complex64")}arraySync(){return Qi(this.shape,this.dataSync(),this.dtype==="complex64")}async data(){this.throwIfDisposed();let e= $ a().read(this.dataId);if(this.dtype==="string"){let t=await e;try{return t.map(n=>ic(n))}catch(n){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();let e= $ a().readSync(this.dataId);if(this.dtype==="string")try{return e.map(t=>ic(t))}catch(t){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();let e=await $ a().read(this.dataId);return this.dtype==="string"?e:new Uint8Array(e.buffer)}dispose(){this.isDisposed||( $ a().disposeTensor(this),this.isDisposedInternal=!0)}get isDisposed(){return this.isDisposedInternal}throwIfDisposed(){if(this.isDisposed)throw new Error("Tensor is disposed.")}print(e=!1){return al.print(this,e)}clone(){return this.throwIfDisposed(),al.clone(this)}toString(e=!1){let t=this.dataSync();return KI(t,this.shape,this.dtype,e)}cast(e){return this.throwIfDisposed(),al.cast(this,e)}variable(e=!0,t,n){return this.throwIfDisposed(), $ a().makeVariable(this,e,t,n)}};Object.defineProperty(Le,Symbol.hasInstance,{value:e=>!!e&&e.data!=null&&e.dataSync!=null&&e.throwIfDisposed!=null});function Z(){return ym("Tensor",()=>Le)}Z();var Ou=class extends Le{constructor(e,t,n,a){super(e.shape,e.dtype,e.dataId,a);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(!er(e.shape,this.shape))throw new Error( ` shape of the new value ( $ { e . shape } ) and previous value ( $ { this . shape } ) must match ` ); $ a().disposeTensor(this),this.dataId=e.dataId, $ a().incRef(this,null)}dispose(){ $ a().disposeVariable(this),this.isDisposedInternal=!0}};Object.defineProperty(Ou,Symbol.hasInstance,{value:e=>e instanceof Le&&e.assi
Manifest JSON has weights with names : $ { o . join ( ", " ) } . ` )}let l=r.reduce((h,m,f)=>(m&&h.push(f),h),[]),d=[];l.forEach(h=>{t[h].paths.forEach(m=>{let f=n+(n.endsWith("/")?"":"/")+m;d.push(f)})});let u=await e(d),p={},c=0;return l.forEach(h=>{let m=t[h].paths.length,f=0;for(let x=0;x<m;x++)f+=u[c+x].byteLength;let A=new ArrayBuffer(f),y=new Uint8Array(A),g=0;for(let x=0;x<m;x++){let w=new Uint8Array(u[c+x]);y.set(w,g),g+=w.byteLength}s[h].forEach(x=>{let w=A.slice(x.groupOffset,x.groupOffset+x.sizeBytes),b=Wx(w,[x.manifestEntry]);for(let v in b)p[v]=b[v]}),c+=m}),p}}var JS="application/octet-stream",QS="application/json",_m=class{constructor(e,t){if(this.DEFAULT_METHOD="POST",t==null&&(t={}),this.weightPathPrefix=t.weightPathPrefix,this.onProgress=t.onProgress,this.weightUrlConverter=t.weightUrlConverter,t.fetchFunc!=null?(F(typeof t.fetchFunc=="function",()=>"Must pass a function that matches the signature of ` fetch ` (see https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API)"),this.fetch=t.fetchFunc):this.fetch=J().platform.fetch,F(e!=null&&e.length>0,()=>"URL path for http must not be null, undefined or empty."),Array.isArray(e)&&F(e.length===2,()=> ` URL paths for http must have a length of 2 , ( actual length is $ { e . length } ) . ` ),this.path=e,t.requestInit!=null&&t.requestInit.body!=null)throw new Error("requestInit is expected to have no pre-existing body, but has one.");this.requestInit=t.requestInit||{}}async save(e){if(e.modelTopology instanceof ArrayBuffer)throw new Error("BrowserHTTPRequest.save() does not support saving model topology in binary formats yet.");let t=Object.assign({method:this.DEFAULT_METHOD},this.requestInit);t.body=new FormData;let n=[{paths:["./model.weights.bin"],weights:e.weightSpecs}],a={modelTopology:e.modelTopology,format:e.format,generatedBy:e.generatedBy,convertedBy:e.convertedBy,weightsManifest:n};e.signature!=null&&(a.signature=e.signature),e.userDefinedMetadata!=null&&(a.userDefinedMetadata=e.userDefinedMetadata),e.modelInitializer!=null&&(a.modelInitializer=e.modelInitializer),t.body.append("model.json",new Blob([JSON.stringify(a)],{type:QS}),"model.json"),e.weightData!=null&&t.body.append("model.weights.bin",new Blob([e.weightData],{type:JS}),"model.weights.bin");let r=await this.fetch(this.path,t);if(r.ok)return{modelArtifactsInfo:Lu(e),responses:[r]};throw new Error( ` BrowserHTTPRequest . save ( ) failed due to HTTP response status $ { r . status } . ` )}async load(){let e=await this.fetch(this.path,this.requestInit);if(!e.ok)throw new Error( ` Request to $ { this . path } failed with status code $ { e . status } . Please verify this URL points to the model JSON of the model to load . ` );let t;try{t=await e.json()}catch(h){let m= ` Failed to parse model JSON of response from $ { this . path } . ` ;throw this.path.endsWith(".pb")?m+=" Your path contains a .pb file extension. Support for .pb models have been removed in TensorFlow.js 1.0 in favor of .json models. You can re-convert your Python TensorFlow model using the TensorFlow.js 1.0 conversion scripts or you can convert your.pb models with the 'pb2json'NPM script in the tensorflow/tfjs-converter repository.":m+=" Please make sure the server is serving valid JSON for this request.",new Error(m)}let n=t.modelTopology,a=t.weightsManifest,r=t.generatedBy,s=t.convertedBy,i=t.format,o=t.signature,l=t.userDefinedMetadata;if(n==null&&a==null)throw new Error( ` The JSON from HTTP path $ { this . path } contains neither model topology or manifest for weights . ` );let d,u;a!=null&&([d,u]=await this.loadWeights(a));let p={modelTopology:n,weightSpecs:d,weightData:u,generatedBy:r,convertedBy:s,format:i};o!=null&&(p.signature=o),l!=null&&(p.userDefinedMetadata=l);let c=t.modelInitializer;return c&&(p.modelInitializer=c),p}async loadWeights(e){let t=Array.isArray(this.path)?this.path[1]:this.path,[n,a]=eN(t),r=this.weightPathPrefix||n,s=[];for(let d of e)s.push(...d.weights);let i=[],o=[];for(let d of e)for(let u of d.paths)this.weightUrlConverter!=null?o.push(this.weightUrlConverter(u)):i.push(r+u+a);this.weightUrlConverter&&i.push(...await Promise.all(o));let l=await Qx(i,{requestInit:this
Actual : $ { r } .
Expected : $ { s } . ` );for(let i=0;i<s.length;++i){let o=r[i],l=s[i];if(!n(o,l))throw new Error( ` Arrays differ : actual [ $ { i } ] = $ { o } , expected [ $ { i } ] = $ { l } .
Actual : $ { r } .
Expected : $ { s } . ` )}}function xN(e,t){e().then(()=>t.fail(),()=>t())}function bN(e,t){let n=typeof t=="string"||typeof t=="number"||typeof t=="boolean"?[t]:t;return vr(e)||vr(e[0])||vr(t)||vr(t[0])?Um(e,n,(a,r)=>a==r):Um(e,t,(a,r)=>Hm(a,r,0))}function vN(e,t,n){if(n==null&&(n=jm()),!Hm(e,t,n))throw new Error( ` Numbers differ : actual === $ { e } , expected === $ { t } ` )}function Hm(e,t,n){return!isFinite(e)&&!isFinite(t)?!0:!(isNaN(e)||isNaN(t)||Math.abs(e-t)>n)}function wN(e,t,n){for(let a=0;a<e.length;a++)if(e[a]<t||e[a]>n)throw new Error( ` Value out of range : $ { e [ a ] } low : $ { t } , high : $ { n } ` )}function kN(e,t){expect(new Float32Array(e)).toEqual(new Float32Array(t))}function xb(e){for(let t=0;t<e.length;t++){let n=e[t];Array.isArray(n)?xb(n):e[t]=Mu(n)}return e}var SN="3.5.0";function NN(){J().set("PROD",!0)}function TN(){J().set("DEBUG",!0)}function EN(){J().set("DEPRECATION_WARNINGS_ENABLED",!1),console.warn("TensorFlow.js deprecation warnings have been disabled.")}function Gm(e){J().getBool("DEPRECATION_WARNINGS_ENABLED")&&console.warn(e+" You can disable deprecation warnings with tf.disableDeprecationWarnings().")}QI(Gm);function CN(){D.disposeVariables()}function nr(){return D}function hc(){return D.memory()}function RN(e){return D.profile(e)}function L(e,t){return D.tidy(e,t)}function Ee(e){vm(e).forEach(t=>t.dispose())}function jt(e){return D.keep(e)}function MN(e){return D.time(e)}function FN(e){return D.setBackend(e)}function $ N(){return D.ready()}function DN(){return D.backendName}function ON(e){D.removeBackend(e)}function qm(e){return D.findBackend(e)}function zN(e){return D.findBackendFactory(e)}function ul(e,t,n=1){return D.registerBackend(e,t,n)}function bb(){return D.backend}function _N(e,t){J().setPlatform(e,t)}function PN(e,t){let n=M(e,"a","add"),a=M(t,"b","add");[n,a]=vt(n,a);let r={a:n,b:a};return D.runKernel(kr,r)}var se=z({add_:PN});function LN(e,t){let n=M(e,"a","floorDiv"),a=M(t,"b","floorDiv");[n,a]=vt(n,a);let r={a:n,b:a};return D.runKernel(bs,r)}var fc=z({floorDiv_:LN});function WN(e,t){let n=M(e,"a","div"),a=M(t,"b","div");if([n,a]=vt(n,a),n.dtype==="int32"&&a.dtype==="int32")return fc(n,a);let r={a:n,b:a},s={};return D.runKernel(ys,r,s)}var ge=z({div_:WN});function BN(e,t){let n=M(e,"a","mul"),a=M(t,"b","mul");[n,a]=vt(n,a);let r={a:n,b:a};return D.runKernel( $ s,r)}var B=z({mul_:BN});function VN(e){let t=M(e,"x","abs");if(t.dtype==="complex64"){let n={x:t};return D.runKernel(Au,n)}else{let n={x:t};return D.runKernel(eo,n)}}var Ot=z({abs_:VN});function jN(e){let t={x:M(e,"x","acos")};return D.runKernel(to,t)}var Xm=z({acos_:jN});function UN(e){let t={x:M(e,"x","acosh")};return D.runKernel(no,t)}var Km=z({acosh_:UN});function HN(e){F(Array.isArray(e),()=>"The argument passed to tf.addN() must be a list of tensors"),F(e.length>=1,()=> ` Must pass at least one tensor to tf . addN ( ) , but got $ { e . length } ` );let t=e.map((r,s)=>M(r, ` tensors$ { s } ` ,"addN")),n=t[0];t.forEach(r=>{if(r.dtype!==n.dtype)throw new Error("All tensors passed to tf.addN() must have the same dtype")}),t.forEach(r=>{if(!er(r.shape,n.shape))throw new Error("All tensors passed to tf.addN() must have the same shape")});let a=t;return D.runKernel(is,a)}var mc=z({addN_:HN});function GN(e,t=null,n=!1){let a={x:M(e,"x","all","bool")},r={axis:t,keepDims:n};return D.runKernel(ao,a,r)}var Ac=z({all_:GN});function qN(e,t=null,n=!1){let a={x:M(e,"x","any","bool")},r={axis:t,keepDims:n};return D.runKernel(ro,a,r)}var Wu=z({any_:qN});function XN(e,t=0){let n={x:M(e,"x","argMax")},a={axis:t};return D.runKernel(os,n,a)}var Bu=z({argMax_:XN});function KN(e,t=0){let n={x:M(e,"x","argMin")},a={axis:t};return D.runKernel(hu,n,a)}var Zm=z({argMin_:KN});function ZN(e){let t={x:M(e,"x","asin")};return D.runKernel(so,t)}var Ym=z({asin_:ZN});function YN(e){let t={x:M(e,"x","asinh")};return D.runKernel(io,t)}var Jm=z({asinh_:YN});function JN(e){let t={x:M(e,"x","atan")};return D.runKernel(oo,t)}var Qm=z({atan_:JN});function QN(e,t){let n=M(e,"a","atan2"),a=M(t,"b","atan2");[n,a]=vt(n,a);let r={a:n,b:a};return D.runKernel(uo,r)}var eA=z({atan2_:QN});function eT(e){let t={x:M
with dtype $ { s . dtype } . ` )}),n.length===1)return Oa(n[0]);let a=n,r={axis:t};return D.runKernel(po,a,r)}var ot=z({concat_:dT});function pT(e){let t={x:M(e,"x","sigmoid")};return D.runKernel(Hs,t)}var wn=z({sigmoid_:pT});function cT(e,t,n){let a=M(e,"x","slice","string_or_numeric");if(a.rank===0)throw new Error("Slicing scalar is not possible");let r={x:a},s={begin:t,size:n};return D.runKernel(Ho,r,s)}var Me=z({slice_:cT});function hT(e){let t={x:M(e,"x","tanh")};return D.runKernel(Js,t)}var di=z({tanh_:hT});function fT(e,t,n,a,r,s){let i=M(e,"forgetBias","basicLSTMCell"),o=M(t,"lstmKernel","basicLSTMCell"),l=M(n,"lstmBias","basicLSTMCell"),d=M(a,"data","basicLSTMCell"),u=M(r,"c","basicLSTMCell"),p=M(s,"h","basicLSTMCell"),c=ot([d,p],1),h=Be(c,o),m=se(h,l),f=m.shape[0],A=m.shape[1]/4,y=[f,A],g=Me(m,[0,0],y),x=Me(m,[0,A],y),w=Me(m,[0,A*2],y),b=Me(m,[0,A*3],y),v=se(B(wn(g),di(x)),B(u,wn(se(i,w)))),I=B(di(v),wn(b));return[v,I]}var mT=z({basicLSTMCell_:fT});function AT(e,t,n){let a=M(e,"x","batchToSpaceND"),r=t.reduce((o,l)=>o*l);F(a.rank>=1+t.length,()=> ` input rank is $ { a . rank } but should be > than blockShape . length $ { t . length } ` ),F(n.length===t.length,()=> ` crops . length is $ { n . length } but should be equal to blockShape . length $ { t . length } ` ),F(a.shape[0]%r==0,()=> ` input tensor batch is $ { a . shape [ 0 ] } but is not divisible by the product of the elements of blockShape $ { t . join ( " * " ) } === $ { r } ` );let s={x:a},i={blockShape:t,crops:n};return D.runKernel(mu,s,i)}var Uu=z({batchToSpaceND_:AT});function yT(e){let t;return e.rank===0||e.rank===1?t=H(e,[1,1,1,e.size]):e.rank===2?t=H(e,[1,1,e.shape[0],e.shape[1]]):e.rank===3?t=H(e,[1,e.shape[0],e.shape[1],e.shape[2]]):t=e,t}function gT(e,t,n,a,r,s){s==null&&(s=.001);let i=M(e,"x","batchNorm"),o=M(t,"mean","batchNorm"),l=M(n,"variance","batchNorm"),d;r!=null&&(d=M(r,"scale","batchNorm"));let u;a!=null&&(u=M(a,"offset","batchNorm")),F(o.rank===l.rank,()=>"Batch normalization gradient requires mean and variance to have equal ranks."),F(u==null||o.rank===u.rank,()=>"Batch normalization gradient requires mean and offset to have equal ranks."),F(d==null||o.rank===d.rank,()=>"Batch normalization gradient requires mean and scale to have equal ranks.");let p={x:yT(i),scale:d,offset:u,mean:o,variance:l},c={varianceEpsilon:s},h=D.runKernel(vs,p,c);return H(h,i.shape)}var pi=z({batchNorm_:gT});function xT(e,t,n,a,r,s){let i=M(e,"x","batchNorm"),o=M(t,"mean","batchNorm"),l=M(n,"variance","batchNorm"),d;r!=null&&(d=M(r,"scale","batchNorm"));let u;return a!=null&&(u=M(a,"offset","batchNorm")),F(i.rank===2,()=> ` Error in batchNorm2D : x must be rank 2 but got rank $ { i . rank } . ` ),F(o.rank===2||o.rank===1,()=> ` Error in batchNorm2D : mean must be rank 2 or rank 1 but got rank $ { o . rank } . ` ),F(l.rank===2||l.rank===1,()=> ` Error in batchNorm2D : variance must be rank 2 or rank 1 but got rank $ { l . rank } . ` ),d!=null&&F(d.rank===2||d.rank===1,()=> ` Error in batchNorm2D : scale must be rank 2 or rank 1 but got rank $ { d . rank } . ` ),u!=null&&F(u.rank===2||u.rank===1,()=> ` Error in batchNorm2D : offset must be rank 2 or rank 1 but got rank $ { u . rank } . ` ),pi(i,o,l,u,d,s)}var Ib=z({batchNorm2d_:xT});function bT(e,t,n,a,r,s){let i=M(e,"x","batchNorm"),o=M(t,"mean","batchNorm"),l=M(n,"variance","batchNorm"),d;r!=null&&(d=M(r,"scale","batchNorm"));let u;return a!=null&&(u=M(a,"offset","batchNorm")),F(i.rank===3,()=> ` Error in batchNorm3D : x must be rank 3 but got rank $ { i . rank } . ` ),F(o.rank===3||o.rank===1,()=> ` Error in batchNorm3D : mean must be rank 3 or rank 1 but got rank $ { o . rank } . ` ),F(l.rank===3||l.rank===1,()=> ` Error in batchNorm3D : variance must be rank 3 or rank 1 but got rank $ { l . rank } . ` ),d!=null&&F(d.rank===3||d.rank===1,()=> ` Error in batchNorm3D : scale must be rank 3 or rank 1 but got rank $ { d . rank } . ` ),u!=null&&F(u.rank===3||u.rank===1,()=> ` Error in batchNorm3D : offset must be rank 3 or rank 1 but got rank $ { u . rank } . ` ),pi(i,o,l,u,d,s)}var Sb=z({batchNorm3d_:bT});function vT(e,t,n,a,r,s){let i=M(e,"x","batchNorm"),o=M(t,"mean","batchNorm"),l=M(n,"variance","batchNorm"),d;r!=null&&(d=M(r,"scale","batchNorm"));let u;return a!=
$ { r } and $ { t } for depthToSpace with input shape
$ { a . shape } ` ),F(s*t>=0,()=> ` Negative dimension size caused by overflow when multiplying
$ { s } and $ { t } for depthToSpace with input shape
$ { a . shape } ` ),F(i%(t*t)==0,()=> ` Dimension size must be evenly divisible by $ { t * t } but is $ { i } for depthToSpace with input shape $ { a . shape } ` );let o={x:a},l={blockSize:t,dataFormat:n};return D.runKernel(fo,o,l)}var lA=z({depthToSpace_:BT});function VT(e,t,n,a,r="NHWC",s=[1,1],i){let o=M(e,"x","depthwiseConv2d"),l=M(t,"filter","depthwiseConv2d"),d=o,u=!1;o.rank===3&&(u=!0,d=H(o,[1,o.shape[0],o.shape[1],o.shape[2]])),F(d.rank===4,()=> ` Error in depthwiseConv2d : input must be rank 4 , but got rank $ { d . rank } . ` ),F(l.rank===4,()=> ` Error in depthwiseConv2d : filter must be rank 4 , but got rank $ { l . rank } . ` ),F(d.shape[3]===l.shape[2],()=> ` Error in depthwiseConv2d : number of input channels ( $ { d . shape [ 3 ] } ) must match the inChannels dimension in filter $ { l . shape [ 2 ] } . ` ),i!=null&&F(Vt(a),()=> ` Error in depthwiseConv2d : pad must be an integer when using , dimRoundingMode $ { i } but got pad $ { a } . ` );let p={x:d,filter:l},c={strides:n,pad:a,dataFormat:r,dilations:s,dimRoundingMode:i},h=D.runKernel(As,p,c);return u?H(h,[h.shape[1],h.shape[2],h.shape[3]]):h}var hl=z({depthwiseConv2d_:VT});function jT(e){let t={x:M(e,"x","diag")};return D.runKernel(zp,t)}var UT=z({diag_:jT});function HT(e,t,n,a,r=[1,1],s="NHWC"){let i=M(e,"x","dilation2d"),o=M(t,"filter","dilation2d");F(i.rank===3||i.rank===4,()=> ` Error in dilation2d : input must be rank 3 or 4 , but got rank $ { i . rank } . ` ),F(o.rank===3,()=> ` Error in dilation2d : filter must be rank 3 , but got rank $ { o . rank } . ` ),F(s==="NHWC",()=> ` Error in dilation2d : Only NHWC is currently supported , but got dataFormat of $ { s } ` );let l=i,d=!1;i.rank===3&&(l=H(i,[1,i.shape[0],i.shape[1],i.shape[2]]),d=!0);let u={x:l,filter:o},p={strides:n,pad:a,dilations:r},c=D.runKernel(gu,u,p);return d?H(c,[c.shape[1],c.shape[2],c.shape[3]]):c}var uA=z({dilation2d_:HT});function GT(e,t){let n=e.length,a=[];for(let r=0;r<n;r++){let s=n-1-r,i=e[s]||1;(t[t.length-1-r]||1)>1&&i===1&&a.unshift(s)}return a}function zt(e,t){let n=[];for(let a=0;a<t.length;a++){let r=e[e.length-a-1],s=t.length-a-1,i=t[s];(r==null||r===1&&i>1)&&n.unshift(s)}return n}function ct(e,t){let n=[],a=Math.max(e.length,t.length);for(let r=0;r<a;r++){let s=e[e.length-r-1];s==null&&(s=1);let i=t[t.length-r-1];if(i==null&&(i=1),s===1)n.unshift(i);else if(i===1)n.unshift(s);else if(s!==i){let o= ` Operands could not be broadcast together with shapes $ { e } and $ { t } . ` ;throw Error(o)}else n.unshift(s)}return n}function qT(e,t){let n=M(e,"a","equal"),a=M(t,"b","equal");[n,a]=vt(n,a),ct(n.shape,a.shape);let r={a:n,b:a};return D.runKernel(yo,r)}var Fr=z({equal_:qT});function XT(e,t,n){let a=M(t,"a","where"),r=M(n,"b","where"),s=M(e,"condition","where","bool"),i=ct(ct(s.shape,a.shape),r.shape),o=pl(s,i),l=pl(a,i),d=pl(r,i),u={condition:o,t:l,e:d};return D.runKernel(jo,u)}var In=z({where_:XT});function KT(e){let t={x:M(e,"x","zerosLike")};return D.runKernel(Qo,t)}var Ue=z({zerosLike_:KT});function ZT(e,t){let n=M(e,"a","div"),a=M(t,"b","div");[n,a]=vt(n,a);let r=ge(n,a),s=Ue(r),i=Fr(a,s);return In(i,s,r)}var dA=z({divNoNan_:ZT});function YT(e,t){let n=M(e,"t1","dot"),a=M(t,"t2","dot");F((n.rank===1||n.rank===2)&&(a.rank===1||a.rank===2),()=> ` Error in dot : inputs must all be rank 1 or 2 , but got ranks $ { n . rank } and $ { a . rank } . ` );let r=n.rank===1?n.size:n.shape[1],s=a.rank===1?a.size:a.shape[0];if(F(r===s,()=> ` Error in dot : inner dimensions of inputs must match , but got $ { r } and $ { s } . ` ),n.rank===1&&a.rank===1){let i=H(n,[1,-1]),o=H(a,[-1,1]),l=Be(i,o);return H(l,[])}else if(n.rank===1&&a.rank===2){let i=H(n,[1,-1]),o=H(a,[a.shape[0],a.shape[1]]),l=Be(i,o);return H(l,[l.size])}else if(n.rank===2&&a.rank===1){let i=H(a,[-1,1]),o=Be(n,i);return H(o,[o.size])}else{let i=H(a,[a.shape[0],a.shape[1]]);return Be(n,i)}}var Db=z({dot_:YT});function JT(e,...t){let n=t.map((r,s)=>M(r, ` tensors$ { s } ` ,"einsum")),a={equation:e};return D.runKernel(Lp,n,a)}var Ob=z({einsum_:JT});function QT(e){let t={x:M(e,"x","elu")};return D.runKernel(mo,t)}var fl=z({elu_:QT});function eE(e){let t=M(e,"x","erf");F(t.dtype==="int32"||t.dtype==="float32",()=>"Input dtype must be ` int32 ` or ` float32 ` ."),t.dtype==="int32
rank $ { s . rank } . ` ),F(Vt(t),()=> ` Error in localResponseNormalization : depthRadius must be an integer but got depthRadius $ { t } . ` );let i=s,o=!1;s.rank===3&&(o=!0,i=H(s,[1,s.shape[0],s.shape[1],s.shape[2]]));let l={x:i},d={depthRadius:t,bias:n,alpha:a,beta:r},u=D.runKernel(wu,l,d);return o?H(u,[u.shape[1],u.shape[2],u.shape[3]]):u}var mA=z({localResponseNormalization_:yE});function gE(e){let t={x:M(e,"x","log")};return D.runKernel(Ss,t)}var Fn=z({log_:gE});function xE(e){let t={x:M(e,"x","log1p")};return D.runKernel(Co,t)}var Ic=z({log1p_:xE});function bE(e){return F(wr(e),()=>"The f passed in grad(f) must be a function"),(t,n)=>{let a=M(t,"x","tf.grad","string_or_numeric"),r=n!=null?M(n,"dy","tf.grad"):null;return D.tidy(()=>{let{value:s,grads:i}=D.gradients(()=>e(a),[a],r);return r!=null&&rn(s.shape,r.shape,"The shape of dy passed in grad(f)(x, dy) must match the shape returned by f(x)"),Sc(i),i[0]})}}function vE(e){return F(wr(e),()=>"The f passed in grads(f) must be a function"),(t,n)=>{F(Array.isArray(t),()=>"The args passed in grads(f)(args) must be an array of ` Tensor ` s or ` TensorLike ` s");let a=Pu(t,"args","tf.grads","string_or_numeric"),r=n!=null?M(n,"dy","tf.grads"):null;return D.tidy(()=>{let{value:s,grads:i}=D.gradients(()=>e(...a),a,r);return r!=null&&rn(s.shape,r.shape,"The shape of dy passed in grads(f)([x1,...], dy) must match the shape returned by f([x1,...])"),Sc(i),i})}}function wE(e){return F(wr(e),()=>"The f passed in valueAndGrad(f) must be a function"),(t,n)=>{F(t instanceof Le,()=>"The x passed in valueAndGrad(f)(x) must be a tensor"),F(n==null||n instanceof Le,()=>"The dy passed in valueAndGrad(f)(x, dy) must be a tensor");let{grads:a,value:r}=D.gradients(()=>e(t),[t],n);return Sc(a),{grad:a[0],value:r}}}function kE(e){return F(wr(e),()=>"The f passed in valueAndGrads(f) must be a function"),(t,n)=>{F(Array.isArray(t)&&t.every(r=>r instanceof Le),()=>"The args passed in valueAndGrads(f)(args) must be array of tensors"),F(n==null||n instanceof Le,()=>"The dy passed in valueAndGrads(f)(args, dy) must be a tensor");let a=D.gradients(()=>e(...t),t,n);return n!=null&&rn(a.value.shape,n.shape,"The shape of dy passed in valueAndGrads(f)([x1,...], dy) must match the shape returned by f([x1,...])"),Sc(a.grads),a}}function Lb(e,t){F(wr(e),()=>"The f passed in variableGrads(f) must be a function"),F(t==null||Array.isArray(t)&&t.every(d=>d instanceof Ou),()=>"The varList passed in variableGrads(f, varList) must be an array of variables");let n=t!=null;if(!n){t=[];for(let d in D.registeredVariables)t.push(D.registeredVariables[d])}let a=n?t.filter(d=>!d.trainable):null,r=t.length;t=t.filter(d=>d.trainable),F(t.length>0,()=> ` variableGrads ( ) expects at least one of the input variables to be trainable , but none of the $ { r } variables is trainable . ` );let s=!0,{value:i,grads:o}=D.gradients(e,t,null,s);F(o.some(d=>d!=null),()=>"Cannot find a connection between any variable and the result of the loss function y=f(x). Please make sure the operations that use variables are inside the function f passed to minimize()."),F(i.rank===0,()=> ` The f passed in variableGrads ( f ) must return a scalar , but it returned a rank - $ { i . rank } tensor ` );let l={};return t.forEach((d,u)=>{o[u]!=null&&(l[d.name]=o[u])}),a!=null&&a.forEach(d=>l[d.name]=null),{value:i,grads:l}}function _a(e){return D.customGrad(e)}function Sc(e){if(e.filter(t=>t==null).length>0)throw new Error( ` Cannot compute gradient of y = f ( x ) with respect to x . Make sure that
the f you passed encloses all operations that lead from x to y . ` )}function IE(e){let t={x:M(e,"x","neg")};return D.runKernel(Fo,t)}var wt=z({neg_:IE});function SE(e){let t={x:M(e,"x","softplus")};return D.runKernel(Xo,t)}var fi=z({softplus_:SE});function NE(e){let t=M(e,"x","logSigmoid");return _a(n=>({value:wt(fi(wt(n))),gradFunc:a=>B(a,wn(wt(n)))}))(t)}var Wb=z({logSigmoid_:NE});function TE(e,t=null,n=!1){let a={x:M(e,"x","max")},r={reductionIndices:t,keepDims:n};return D.runKernel(Ns,a,r)}var Xn=z({max_:TE});function EE(e,t){let n=M(e,"a","sub"),a=M(t,"b","sub");[n,a]=vt(n,a);let r={a:n,b:a};return D.runKernel(Zs,r)}var ye=z({sub_:EE});function CE(e,t=null,n=!1){let a=M(e,"x","sum");a.dtype==="bool"&&(a=Ae(a,"int32"));let r={x:a},s={axis:t,keepDims:n};return D.runKernel(qs,r,s)}var Te=z({sum_:CE});function RE(e,t=-1){let n=M(e,"logits","logSoftmax");if(t===-1&&(t=n.rank-1),t!==n.rank-1)throw Error( ` Log Softmax along a non - last dimension is not yet supported . Logits was rank $ { n . rank } and axis was $ { t } ` );return _a((a,r)=>{let s=!0,i=Xn(a,t,!0),o=ye(a,i),l=ye(Ae(o,"float32"),Fn(Te(qn(o),t,s)));return r([l]),{value:l,gradFunc:(d,u)=>{let[p]=u,c=!0,h=qn(p);return ye(d,B(Te(d,t,c),h))}}})(n)}var Nc=z({logSoftmax_:RE});function AA(e,t){for(let n=0;n<e.length;++n)if(e[e.length-n-1]!==t-1-n)return!1;return!0}function Bb(e,t,n){let a=e.length+t.length,r=[],s=0,i=0;for(let o=0;o<a;o++)n.indexOf(o)===-1?r.push(e[s++]):r.push(t[i++]);return r}function Vb(e,t){let n=[],a=e.length;for(let s=0;s<a;s++)t.indexOf(s)===-1&&n.push(e[s]);let r=t.map(s=>e[s]);return[n,r]}function mi(e,t){let n=t.map(a=>1);return Bb(e,n,t)}function ME(e,t,n){F(AA(t,n),()=> ` $ { e } supports only inner - most axes for now . Got axes $ { t } and rank - $ { n } input . ` )}function jb(e,t){if(AA(e,t))return null;let n=[];for(let a=0;a<t;++a)e.indexOf(a)===-1&&n.push(a);return e.forEach(a=>n.push(a)),n}function yA(e){return e.map((t,n)=>[n,t]).sort((t,n)=>t[1]-n[1]).map(t=>t[0])}function FE(e,t){let n=[];for(let a=t-e;a<t;++a)n.push(a);return n}function $ E(e,t=null,n=!1){let a=M(e,"x","logSumExp"),r=ra(t,a.shape),s=Xn(a,r,!0),i=ye(a,s),o=qn(i),l=Te(o,r),d=Fn(l),u=se(H(s,d.shape),d);if(n){let p=mi(u.shape,r);return H(u,p)}return u}var gA=z({logSumExp_: $ E});function DE(e,t){let n=M(e,"a","logicalAnd","bool"),a=M(t,"b","logicalAnd","bool");ct(n.shape,a.shape);let r={a:n,b:a};return D.runKernel(Ro,r)}var oa=z({logicalAnd_:DE});function OE(e){let t={x:M(e,"x","logicalNot","bool")};return D.runKernel(bu,t)}var Xu=z({logicalNot_:OE});function zE(e,t){let n=M(e,"a","logicalOr","bool"),a=M(t,"b","logicalOr","bool");ct(n.shape,a.shape);let r={a:n,b:a};return D.runKernel(vu,r)}var Tc=z({logicalOr_:zE});function _E(e,t){let n=M(e,"a","logicalXor","bool"),a=M(t,"b","logicalXor","bool");return ct(n.shape,a.shape),oa(Tc(e,t),Xu(oa(e,t)))}var Ub=z({logicalXor_:_E});function PE(e,t,n,a,r){let s=M(e,"x","maxPool"),i=1,o=s,l=!1;s.rank===3&&(l=!0,o=H(s,[1,s.shape[0],s.shape[1],s.shape[2]])),F(o.rank===4,()=> ` Error in maxPool : input must be rank 4 but got rank $ { o . rank } . ` ),F(za(n,i),()=> ` Error in maxPool : Either strides or dilations must be 1. Got strides $ { n } and dilations '${i}' ` ),r!=null&&F(Vt(a),()=> ` Error in maxPool : pad must be an integer when using , dimRoundingMode $ { r } but got pad $ { a } . ` );let d={x:o},u={filterSize:t,strides:n,pad:a,dimRoundingMode:r},p=D.runKernel(Es,d,u);return l?H(p,[p.shape[1],p.shape[2],p.shape[3]]):p}var Ku=z({maxPool_:PE});function LE(e,t=[1,1,1],n,a,r,s="NDHWC"){let i=M(e,"x","maxPool3d"),o=i,l=!1;i.rank===4&&(l=!0,o=H(i,[1,i.shape[0],i.shape[1],i.shape[2],i.shape[3]])),F(o.rank===5,()=> ` Error in maxPool3d : x must be rank 5 but got rank $ { o . rank } . ` ),F(s==="NDHWC",()=> ` Error in maxPool3d : Only NDHWC is currently supported , but got dataFormat of $ { s } ` ),r!=null&&F(Vt(a),()=> ` Error in maxPool3d : pad must be an integer when using , dimRoundingMode $ { r } but got pad $ { a } . ` );let d={x:o},u={filterSize:t,strides:n,pad:a,dimRoundingMode:r,dataFormat:s},p=D.runKernel(ku,d,u);return l?H(p,[p.shape[1],p.shape[2],p.shape[3],p.shape[4]]):p}var xA=z({maxPool3d_:LE});function WE(e
$ { a . shape } ` );if(r.rank!==1)throw new Error( ` Input shape should be Tensor1D but received shape $ { r . shape } ` );if(s.rank!==1)throw new Error( ` New shape should be Tensor1D but received shape $ { s . shape } ` );let i={inputIndices:a,inputShape:r,newShape:s},o=D.runKernel(Qp,i);return{outputIndices:o[0],outputShape:o[1]}}var XM=z({sparseReshape_:qM}),KM={fft:td,ifft:xl,rfft:nd,irfft:Pc},ZM={hammingWindow:jR,hannWindow:s3,frame:i3,stft:qR},Ye={flipLeftRight:YR,resizeNearestNeighbor:c3,resizeBilinear:p3,rotateWithOffset:QR,cropAndResize:KR,nonMaxSuppression:tM,nonMaxSuppressionAsync:uM,nonMaxSuppressionWithScore:pM,nonMaxSuppressionWithScoreAsync:hM,nonMaxSuppressionPadded:mM,nonMaxSuppressionPaddedAsync:yM,transform:vM},f3={bandPart:kM,gramSchmidt:SM,qr:TM},YM={absoluteDifference:RM,computeWeightedLoss:ir,cosineDistance:FM,hingeLoss:DM,huberLoss:zM,logLoss:PM,meanSquaredError:WM,sigmoidCrossEntropy:jM,softmaxCrossEntropy:GM},m3={sparseReshape:XM},or=class extends Ab{minimize(e,t=!1,n){let{value:a,grads:r}=this.computeGradients(e,n);if(n!=null){let s=n.map(i=>({name:i.name,tensor:r[i.name]}));this.applyGradients(s)}else this.applyGradients(r);return Ee(r),t?a:(a.dispose(),null)}get iterations(){return this.iterations_==null&&(this.iterations_=0),this.iterations_}incrementIterations(){this.iterations_=this.iterations+1}computeGradients(e,t){return Lb(e,t)}dispose(){this.iterations_!=null&&Ee(this.iterations_)}async saveIterations(){return this.iterations_==null&&(this.iterations_=0),{name:"iter",tensor:Ie(this.iterations_,"int32")}}async getWeights(){throw new Error("getWeights() is not implemented for this optimizer yet.")}async setWeights(e){throw new Error( ` setWeights ( ) is not implemented for this optimizer class $ { this . getClassName ( ) } ` )}async extractIterations(e){return this.iterations_=(await e[0].tensor.data())[0],e.slice(1)}};Object.defineProperty(or,Symbol.hasInstance,{value:e=>e.minimize!=null&&e.computeGradients!=null&&e.applyGradients!=null});var qc=class extends or{constructor(e,t,n=null){super();this.learningRate=e,this.rho=t,this.epsilon=n,this.accumulatedGrads=[],this.accumulatedUpdates=[],n==null&&(this.epsilon=D.backend.epsilon())}applyGradients(e){(Array.isArray(e)?e.map(t=>t.name):Object.keys(e)).forEach((t,n)=>{let a=D.registeredVariables[t],r=!1;this.accumulatedGrads[n]==null&&(this.accumulatedGrads[n]={originalName: ` $ { t } / accum _grad ` ,variable:L(()=>Ue(a).variable(r))}),this.accumulatedUpdates[n]==null&&(this.accumulatedUpdates[n]={originalName: ` $ { t } / accum _var ` ,variable:L(()=>Ue(a).variable(r))});let s=Array.isArray(e)?e[n].tensor:e[t];if(s==null)return;let i=this.accumulatedGrads[n].variable,o=this.accumulatedUpdates[n].variable;L(()=>{let l=se(B(i,this.rho),B(st(s),1-this.rho)),d=B(ge(Jt(se(o,this.epsilon)),Jt(se(i,this.epsilon))),s),u=se(B(o,this.rho),B(st(d),1-this.rho));i.assign(l),o.assign(u);let p=se(B(d,-this.learningRate),a);a.assign(p)})}),this.incrementIterations()}dispose(){this.accumulatedUpdates!=null&&(Ee(this.accumulatedGrads.map(e=>e.variable)),Ee(this.accumulatedUpdates.map(e=>e.variable)))}async getWeights(){let e=[...this.accumulatedGrads,...this.accumulatedUpdates];return[await this.saveIterations()].concat(e.map(t=>({name:t.originalName,tensor:t.variable})))}async setWeights(e){e=await this.extractIterations(e);let t=e.length/2,n=!1;this.accumulatedGrads=e.slice(0,t).map(a=>({originalName:a.name,variable:a.tensor.variable(n)})),this.accumulatedUpdates=e.slice(t,t*2).map(a=>({originalName:a.name,variable:a.tensor.variable(n)}))}getConfig(){return{learningRate:this.learningRate,rho:this.rho,epsilon:this.epsilon}}static fromConfig(e,t){return new e(t.learningRate,t.rho,t.epsilon)}};qc.className="Adadelta";Rr(qc);var Xc=class extends or{constructor(e,t=.1){super();this.learningRate=e,this.initialAccumulatorValue=t,this.accumulatedGrads=[]}applyGradients(e){(Array.isArray(e)?e.map(t=>t.name):Object.keys(e)).forEach((t,n)=>{let a=D.registeredVariables[t];if(this.accumulatedGrads[n]==null){let i=!1;this.accumulatedGrads[n]={originalName: ` $ { t } / accumulator ` ,variable:L(()=>Gu(a.shape,this.initial
$ { s } ) . ` );if(n<a)throw new Error( ` batchDims ( $ { a } ) must be less than or equal to axis ( $ { n } ) . ` );for(let p=0;p<a;++p)if(e.shape[p]!==t.shape[p])throw new Error( ` x . shape [ $ { p } ] : $ { e . shape [ p ] } should be equal to indices . shape [ $ { p } ] : $ { t . shape [ p ] } . ` );let i=e.shape[n],o=[],l=1,d=1,u=1;for(let p=0;p<a;++p)o.push(e.shape[p]),l*=e.shape[p];for(let p=a;p<n;p++)o.push(e.shape[p]),d*=e.shape[p];for(let p=a;p<r;p++)o.push(t.shape[p]);for(let p=n+1;p<s;p++)o.push(e.shape[p]),u*=e.shape[p];return{batchSize:l,sliceSize:u,outerSize:d,dimSize:i,outputShape:o}}function RF(e){try{return e.map(t=>ic(t))}catch(t){throw new Error( ` Failed to decode encoded string bytes into utf - 8 , error : $ { t } ` )}}function MF(e){return e.map(t=>Mu(t))}var Wa={};Fe(Wa,{nonMaxSuppressionV3Impl:()=>o3,nonMaxSuppressionV4Impl:()=>l3,nonMaxSuppressionV5Impl:()=>u3,whereImpl:()=>Yb});function ve(e,t){Array.isArray(e)||(e=[e]),e.forEach(n=>{n!=null&&k.assert(n.dtype!=="complex64",()=> ` $ { t } does not support complex64 tensors in the CPU backend . ` )})}var _F=Wa.whereImpl,eh=class extends du{constructor(){super();this.blockSize=48,this.firstUse=!0,this.data=new wp(this,nr())}nextDataId(){return eh.nextDataId++}write(e,t,n){this.firstUse&&(this.firstUse=!1,J().get("IS_NODE")&&C.warn( `
=== === === === === === === === === =
Hi there \ u { 1 F44B } . Looks like you are running TensorFlow . js in Node . js . To speed things up dramatically , install our node backend , which binds to TensorFlow C ++ , by running npm i @ tensorflow / tfjs - node , or npm i @ tensorflow / tfjs - node - gpu if you have CUDA . Then call require ( '@tensorflow/tfjs-node' ) ; ( - gpu suffix for CUDA ) at the start of your program . Visit https : //github.com/tensorflow/tfjs-node for more details.
=== === === === === === === === === = ` ));let a={id:this.nextDataId()};return this.data.set(a,{values:e,dtype:n,refCount:1}),a}makeTensorInfo(e,t,n){let a;if(t==="string"&&n!=null&&n.length>0&&k.isString(n[0])){let r=n.map(s=>k.encodeString(s));a=this.write(r,e,t)}else a=this.write(n,e,t);return{dataId:a,shape:e,dtype:t}}refCount(e){return this.data.has(e)?this.data.get(e).refCount:0}incRef(e){let t=this.data.get(e);t.refCount++}decRef(e){if(this.data.has(e)){let t=this.data.get(e);t.refCount--}}move(e,t,n,a,r){this.data.set(e,{values:t,dtype:a,refCount:r})}numDataIds(){return this.data.numDataIds()}async read(e){return this.readSync(e)}readSync(e){let{dtype:t,complexTensorInfos:n}=this.data.get(e);if(t==="complex64"){let a=this.readSync(n.real.dataId),r=this.readSync(n.imag.dataId);return C.mergeRealAndImagArrays(a,r)}return this.data.get(e).values}bufferSync(e){let t=this.readSync(e.dataId),n=t;if(e.dtype==="string")try{n=t.map(a=>k.decodeString(a))}catch(a){throw new Error("Failed to decode encoded string bytes into utf-8")}return We(e.shape,e.dtype,n)}makeOutput(e,t,n){let a=this.write(e,t,n);return nr().makeTensorFromDataId(a,t,n,this)}disposeData(e,t=!1){if(this.data.has(e)){if(this.data.get(e).refCount--,!t&&this.data.get(e).refCount>0)return!1;let{complexTensorInfos:n}=this.data.get(e);n!=null&&(this.disposeData(n.real.dataId,!0),this.disposeData(n.imag.dataId,!0)),this.data.delete(e)}return!0}disposeIntermediateTensorInfo(e){this.disposeData(e.dataId)}async time(e){let t=k.now();return e(),{kernelMs:k.now()-t}}memory(){return{unreliable:!0,reasons:["The reported memory is an upper bound. Due to automatic garbage collection, the true allocated memory may be less."]}}where(e){ve([e],"where");let t=this.readSync(e.dataId);return _F(e.shape,t)}dispose(){}floatPrecision(){return 32}epsilon(){return super.epsilon()}};eh.nextDataId=0;var WA={};Fe(WA,{addImpl:()=>w3,bincountImpl:()=>BA,bincountReduceImpl:()=>k3,ceilImpl:()=>I3,concatImpl:()=>VA,expImpl:()=>S3,expm1Impl:()=>N3,floorImpl:()=>T3,gatherV2Impl:()=>E3,greaterImpl:()=>C3,lessImpl:()=>R3,linSpaceImpl:()=>M3,logImpl:()=>F3,maxImpl:()=> $ 3,maximumImpl:()=>D3,minimumImpl:()=>O3,multiplyImpl:()=>jA,negImpl:()=>z3,notEqualImpl:()=>_3,prodImpl:()=>P3,rangeImpl:()=>HA,rsqrtImpl:()=>L3,simpleAbsImpl:()=>v3,sliceImpl:()=>th,sparseReshapeImpl:()=>W3,squaredDifferenceImpl:()=>B3,stridedSliceImpl:()=>V3,subImpl:()=>j3,tileImpl:()=>U3,topKImpl:()=>H3,transposeImpl:()=>UA,uniqueImpl:()=>G3});function v3(e){let t=new Float32Array(e.length);for(let n=0;n<e.length;++n)t[n]=Math.abs(e[n]);return t}var PF=e=>{let{x:t}=e.inputs,n=e.backend;ve(t,"abs");let a=new Float32Array(k.sizeFromShape(t.shape)),r=n.data.get(t.dataId).values;return a=v3(r),n.makeOutput(a,t.shape,"float32")},LF={kernelName:eo,backendName:"cpu",kernelFunc:PF};function Rt(e){return(t,n,a,r,s)=>{let i=C.assertAndGetBroadcastShape(t,n),o=i.length,l=k.computeStrides(i),d=k.sizeFromShape(i),u=k.getTypedArrayFromDType(s,d),p=t.length,c=n.length,h=k.computeStrides(t),m=k.computeStrides(n),f=C.getBroadcastDims(t,i),A=C.getBroadcastDims(n,i);if(f.length+A.length===0)for(let y=0;y<u.length;++y)u[y]=e(a[y%a.length],r[y%r.length]);else for(let y=0;y<u.length;++y){let g=k.indexToLoc(y,o,l),x=g.slice(-p);f.forEach(I=>x[I]=0);let w=k.locToIndex(x,p,h),b=g.slice(-c);A.forEach(I=>b[I]=0);let v=k.locToIndex(b,c,m);u[y]=e(a[w],r[v])}return[u,i]}}function _n(e){let{inputs:t,backend:n}=e,{real:a,imag:r}=t,s=n.data.get(a.dataId).values,i=n.data.get(r.dataId).values,o=n.makeTensorInfo(a.shape,"complex64"),l=n.data.get(o.dataId);return l.complexTensorInfos={real:n.makeTensorInfo(a.shape,"float32",s),imag:n.makeTensorInfo(r.shape,"float32",i)},o}var WF={kernelName:Cp,backendName:"cpu",kernelFunc:_n};function nh(e,t,n="float32"){if(n==="complex64"){let r=nh(e,t,"float32"),s=nh(e,t,"float32");return _n({inputs:{real:r,imag:s},backend:e})}let a=k.makeZerosTypedArray(k.sizeFromShape(t),n);return e.makeTensorInfo(t,n,a)}function Ba(e){let{inputs:t,backend:n}=e,{x:a}=t;return n.incRef(a.dataId),{dataId:a.dataId,shape:a.shape,dtype:a.dtype}}var BF={kern
dense values , but the requested shape requires a multiple of $ { d } . inputShape = $ { a } outputShape = $ { l } ` );l[u]=A}let p=k.sizeFromShape(l);if(p!==s)throw new Error( ` Input to reshape is a tensor with $ { s } dense values , but the requested shape has $ { p } . inputShape = $ { a } outputShape = $ { l } ` );let c=a.length,h=[];if(c>0){h[c-1]=1;for(let A=c-2;A>=0;--A)h[A]=h[A+1]*a[A+1]}let m=[];if(o>0){m[o-1]=1;for(let A=o-2;A>=0;--A)m[A]=m[A+1]*l[A+1]}let f=k.getArrayFromDType(n,i*o);for(let A=0;A<i;++A){let y=0;for(let g=0;g<c;++g)y+=e[A*c+g]*h[g];for(let g=0;g<o;++g)f[A*o+g]=Math.trunc(y/m[g]),y%=m[g]}return[f,[i,o],l]}var B3=Rt((e,t)=>{let n=e-t;return n*n}),v $ =Ut(Ks,B3),w $ ={kernelName:Ks,backendName:"cpu",kernelFunc:v $ };function V3(e,t,n,a){let r=We(e,t.dtype);for(let s=0;s<r.size;s++){let i=r.indexToLoc(s),o=new Array(i.length);for(let l=0;l<o.length;l++)o[l]=i[l]*n[l]+a[l];r.set(t.get(...o),...i)}return r}var j3=Rt((e,t)=>e-t),k $ =GA((e,t,n,a)=>({real:e-n,imag:t-a})),qA=Ut(Zs,j3,k $ ),I $ ={kernelName:Zs,backendName:"cpu",kernelFunc:qA};function U3(e,t){let n=new Array(e.rank);for(let r=0;r<n.length;r++)n[r]=e.shape[r]*t[r];let a=We(n,e.dtype);for(let r=0;r<a.values.length;++r){let s=a.indexToLoc(r),i=new Array(e.rank);for(let l=0;l<i.length;l++)i[l]=s[l]%e.shape[l];let o=e.locToIndex(i);a.values[r]=e.values[o]}return a}function H3(e,t,n,a,r){let s=t[t.length-1],[i,o]=[e.length/s,s],l=k.getTypedArrayFromDType(n,i*a),d=k.getTypedArrayFromDType("int32",i*a);for(let p=0;p<i;p++){let c=p*o,h=e.subarray(c,c+o),m=[];for(let g=0;g<h.length;g++)m.push({value:h[g],index:g});m.sort((g,x)=>x.value-g.value);let f=p*a,A=l.subarray(f,f+a),y=d.subarray(f,f+a);for(let g=0;g<a;g++)A[g]=m[g].value,y[g]=m[g].index}let u=t.slice();return u[u.length-1]=a,[We(u,n,l),We(u,"int32",d)]}function G3(e,t,n,a){let r=k.parseAxisParam(t,n)[0],s=[1,n[0],1];for(let m=0;m<r;m++)s[0]*=n[m];s[1]=n[r];for(let m=r+1;m<n.length;m++)s[2]*=n[m];let i={},o=new Int32Array(n[r]),l=new Dt(s,a,e),d=[],u=s[0]===1&&s[2]===1;for(let m=0;m<n[r];m++){let f;if(u)f=e[m].toString();else{let A=[];for(let y=0;y<s[0];y++)for(let g=0;g<s[2];g++)A.push(l.get(y,m,g));f=A.join(",")}if(i[f]!==void 0)o[m]=i[f];else{let A=Object.keys(i).length;i[f]=A,o[m]=A,d.push(m)}}let p=s.slice();p[1]=Object.keys(i).length;let c=new Dt(p,a);d.forEach((m,f)=>{for(let A=0;A<s[0];A++)for(let y=0;y<s[2];y++)c.set(l.get(A,m,y),A,f,y)});let h=n.slice();return h[r]=p[1],{outputValues:c.values,outputShape:h,indices:o}}var X3="3.5.0";ul("cpu",()=>new eh,1);var K3=nt(mo,e=>e>=0?e:Math.exp(e)-1),S $ ={kernelName:mo,backendName:"cpu",kernelFunc:K3};function Z3(e){let{inputs:t,backend:n,attrs:a}=e,{x:r}=t,{alpha:s}=a;ve([r],"leakyRelu");let i=k.sizeFromShape(r.shape),o=n.data.get(r.dataId).values,l=k.getTypedArrayFromDType("float32",i);for(let d=0;d<o.length;d++)l[d]=o[d]<0?s*o[d]:o[d];return n.makeTensorInfo(r.shape,"float32",l)}var N $ ={kernelName:Is,backendName:"cpu",kernelFunc:Z3},T $ =Rt((e,t)=>e<0?t*e:e);function Y3(e){let{inputs:t,backend:n}=e,{x:a,alpha:r}=t;ve([a,r],"prelu");let s=n.data.get(a.dataId).values,i=n.data.get(r.dataId).values,[o,l]=T $ (a.shape,r.shape,s,i,a.dtype);return n.makeTensorInfo(l,a.dtype,o)}var E $ ={kernelName:_s,backendName:"cpu",kernelFunc:Y3},J3=nt(Ps,e=>Math.max(0,e)),C $ ={kernelName:Ps,backendName:"cpu",kernelFunc:J3},Q3=nt(Ws,e=>Math.min(Math.max(0,e),6)),R $ ={kernelName:Ws,backendName:"cpu",kernelFunc:Q3},e7=nt(Hs,e=>1/(1+Math.exp(-e))),M $ ={kernelName:Hs,backendName:"cpu",kernelFunc:e7};function XA(e,t,n,a,r){if(n==="linear")return Ba({inputs:{x:t},backend:e});if(n==="relu")return J3({inputs:{x:t},backend:e});if(n==="elu")return K3({inputs:{x:t},backend:e});if(n==="relu6")return Q3({inputs:{x:t},backend:e});if(n==="prelu")return Y3({inputs:{x:t,alpha:a},backend:e});if(n==="leakyrelu")return Z3({inputs:{x:t},backend:e,attrs:{alpha:r}});if(n==="sigmoid")return e7({inputs:{x:t},backend:e});throw new Error( ` Activation $ { n } has not been implemented for the CPU backend . ` )}function ht(e){let{inputs:t,backend:n,attrs:a}=e,{x:r}=t,{shape:s}=a,i=k.sizeFromShape(r.shape),o=k.inferFromImplicitShape(s,i),l=
$ { a . shape } ` );if(r.shape.length!==1)throw new Error( ` Input shape should be a vector but received shape
$ { r . shape } ` );if(s.shape.length!==1)throw new Error( ` Target shape should be a vector but received shape $ { s . shape } ` );let i=Array.from(n.data.get(r.dataId).values),o=n.data.get(a.dataId).values,l=Array.from(n.data.get(s.dataId).values),[d,u,p]=W3(o,a.shape,a.dtype,i,l);return[n.makeTensorInfo(u,a.dtype,d),n.makeTensorInfo([p.length],s.dtype,new Int32Array(p))]}var U_={kernelName:Qp,backendName:"cpu",kernelFunc:j_};function H_(e){let{inputs:t,backend:n,attrs:a}=e,{sparseIndices:r,sparseValues:s,defaultValue:i}=t,{outputShape:o}=a,{sliceRank:l,numUpdates:d,sliceSize:u,strides:p,outputSize:c}=C.calculateShapes(s,r,o),h=!1,m=n.bufferSync(r),f=n.bufferSync(s),A=n.data.get(i.dataId).values[0],y=h7(m,f,o,c,u,d,l,p,A,h);return n.makeTensorInfo(o,y.dtype,y.values)}var G_={kernelName:ec,backendName:"cpu",kernelFunc:H_};function q_(e){let{inputs:t,backend:n,attrs:a}=e,{x:r}=t,{numOrSizeSplits:s,axis:i}=a,o=k.parseAxisParam(i,r.shape)[0],l=C.prepareSplitSize(r,s,o),d=new Array(r.shape.length).fill(0),u=r.shape.slice();return l.map(p=>{let c=[...u];c[o]=p;let h=bi({inputs:{x:r},backend:n,attrs:{begin:d,size:c}});return d[o]+=p,h})}var X_={kernelName:Ko,backendName:"cpu",kernelFunc:q_},K_=nt(Gs,e=>Math.sqrt(e)),Z_={kernelName:Gs,backendName:"cpu",kernelFunc:K_},Y_={kernelName:Tu,backendName:"cpu",kernelFunc:({inputs:e,backend:t})=>{let{x:n}=e,a=t;ve(n,"square");let r=a.data.get(n.dataId).values,s=new Float32Array(r.length);for(let i=0;i<r.length;++i){let o=r[i];s[i]=o*o}return{dataId:a.write(s,n.shape,n.dtype),shape:n.shape,dtype:n.dtype}}},J_=nt(Nr,(e,t)=>{let n=t;return isNaN(e)?NaN:e>0?1:n.alpha}),Q_={kernelName:Nr,backendName:"cpu",kernelFunc:J_};function eP(e){let{inputs:t,backend:n,attrs:a}=e,{x:r}=t,{begin:s,end:i,strides:o,beginMask:l,endMask:d,ellipsisMask:u,newAxisMask:p,shrinkAxisMask:c}=a;ve(r,"stridedSlice");let{nonStrided:h, $ begin:m, $ strides:f,size:A,newShape:y,outShape:g}=sn.sliceInfo(r.shape,s,i,o,l,d,u,p,c),x=ht({inputs:{x:r},backend:n,attrs:{shape:y}}),w;if(h){let v=bi({inputs:{x},backend:n,attrs:{begin:m,size:A}});w=ht({inputs:{x:v},backend:n,attrs:{shape:g}}),n.disposeIntermediateTensorInfo(v)}else if(g.some(v=>v===0))w=n.makeTensorInfo(g,r.dtype,[]);else{let v=n.bufferSync(x),I=V3(g,v,f,m);w=n.makeTensorInfo(I.shape,I.dtype,I.values)}let b=ht({inputs:{x:w},backend:n,attrs:{shape:g}});return n.disposeIntermediateTensorInfo(x),n.disposeIntermediateTensorInfo(w),b}var tP={kernelName:Zo,backendName:"cpu",kernelFunc:eP},nP=nt(Ys,e=>Math.tan(e)),aP={kernelName:Ys,backendName:"cpu",kernelFunc:nP},rP=nt(Js,e=>Math.tanh(e)),sP={kernelName:Js,backendName:"cpu",kernelFunc:rP};function iP(e){let{inputs:t,backend:n,attrs:a}=e,{x:r}=t,{reps:s}=a;ve(r,"tile");let i=U3(n.bufferSync(r),s);return n.makeTensorInfo(i.shape,i.dtype,i.values)}var oP={kernelName:Sr,backendName:"cpu",kernelFunc:iP};function lP(e){let{inputs:t,backend:n,attrs:a}=e,{x:r}=t,{k:s,sorted:i}=a;ve(r,"topk");let o=n.data.get(r.dataId).values,[l,d]=H3(o,r.shape,r.dtype,s,i);return[n.makeTensorInfo(l.shape,l.dtype,l.values),n.makeTensorInfo(d.shape,d.dtype,d.values)]}var uP={kernelName:Yo,backendName:"cpu",kernelFunc:lP};function cP(e){let{inputs:t,attrs:n,backend:a}=e,{image:r,transforms:s}=t,{interpolation:i,fillMode:o,fillValue:l,outputShape:d}=n,[u,p,c,h]=r.shape,[m,f]=d!=null?d:[p,c],A=[u,m,f,h],y=k.computeStrides(r.shape),g=y[0],x=y[1],w=y[2],b=k.getTypedArrayFromDType(r.dtype,k.sizeFromShape(A));b.fill(l);let v=a.data.get(r.dataId).values,I=a.data.get(s.dataId).values;for(let T=0;T<u;++T){let R=s.shape[0]===1?I:I.subarray(T*8,T*8+8);for(let $ =0; $ <m;++ $ )for(let O=0;O<f;++O)for(let _=0;_<h;++_){let V,j=R[6]*O+R[7]* $ +1;if(j===0)continue;let U=(R[0]*O+R[1]* $ +R[2])/j,X=(R[3]*O+R[4]* $ +R[5])/j,G=m7(U,c,o),ee=m7(X,p,o);switch(i){case"nearest":V=dP(v,p,c,g,x,w,T,ee,G,_,l);break;case"bilinear":V=pP(v,p,c,g,x,w,T,ee,G,_,l);break;default:throw new Error( ` Error in Transform : Expect 'nearest' or 'bilinear' , but got $ { i } ` )}let Y=T*g+ $ *x+O*w+_;b[Y]=V}return a.makeTensorInfo(A,r.dtype,b)}return{dataId:a.write(b,A,r.dtype),shape:r.shape,dtype:r.dtype}}var hP={kernelNa
` ),s=r.length.toString().length+2,i=r.map((p,c)=>k.rightPad((c+1).toString(),s)+p),o=0;for(let p=0;p<i.length;p++)o=Math.max(i[p].length,o);let l=i.slice(0,a-1),d=i.slice(a-1,a),u=i.slice(a);console.log(l.join( `
` )),console.log(t.split( `
` )[0]),console.log( ` % c $ { k . rightPad ( d [ 0 ] , o ) } ` ,"border:1px solid red; background-color:#e3d2d2; color:#a61717"),console.log(u.join( `
` ))}function v7(e){return lr(e,()=>e.createProgram(),"Unable to create WebGLProgram.")}function w7(e,t){if(xe(e,()=>e.linkProgram(t)),e.getProgramParameter(t,e.LINK_STATUS)===!1)throw console.log(e.getProgramInfoLog(t)),new Error("Failed to link vertex and fragment shaders.")}function ih(e,t){if(xe(e,()=>e.validateProgram(t)),e.getProgramParameter(t,e.VALIDATE_STATUS)===!1)throw console.log(e.getProgramInfoLog(t)),new Error("Shader program validation failed.")}function k7(e,t){let n=lr(e,()=>e.createBuffer(),"Unable to create WebGLBuffer");return xe(e,()=>e.bindBuffer(e.ARRAY_BUFFER,n)),xe(e,()=>e.bufferData(e.ARRAY_BUFFER,t,e.STATIC_DRAW)),n}function I7(e,t){let n=lr(e,()=>e.createBuffer(),"Unable to create WebGLBuffer");return xe(e,()=>e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,n)),xe(e,()=>e.bufferData(e.ELEMENT_ARRAY_BUFFER,t,e.STATIC_DRAW)),n}function SP(){return J().getNumber("WEBGL_VERSION")===2?1:4}function S7(e){return lr(e,()=>e.createTexture(),"Unable to create WebGLTexture.")}function N7(e,t){let n=J().getNumber("WEBGL_MAX_TEXTURE_SIZE");if(e<=0||t<=0){let a= ` [ $ { e } x$ { t } ] ` ;throw new Error("Requested texture size "+a+" is invalid.")}if(e>n||t>n){let a= ` [ $ { e } x$ { t } ] ` ,r= ` [ $ { n } x$ { n } ] ` ;throw new Error("Requested texture size "+a+" greater than WebGL maximum on this browser / GPU "+r+".")}}function T7(e){return lr(e,()=>e.createFramebuffer(),"Unable to create WebGLFramebuffer.")}function e1(e,t,n,a,r,s,i){let o=e.getAttribLocation(t,n);return o===-1?!1:(xe(e,()=>e.bindBuffer(e.ARRAY_BUFFER,a)),xe(e,()=>e.vertexAttribPointer(o,r,e.FLOAT,!1,s,i)),xe(e,()=>e.enableVertexAttribArray(o)),!0)}function E7(e,t,n){W7(e,n),xe(e,()=>e.activeTexture(e.TEXTURE0+n)),xe(e,()=>e.bindTexture(e.TEXTURE_2D,t))}function NP(e,t){W7(e,t),xe(e,()=>e.activeTexture(e.TEXTURE0+t)),xe(e,()=>e.bindTexture(e.TEXTURE_2D,null))}function C7(e,t,n){return lr(e,()=>e.getUniformLocation(t,n),'uniform "'+n+'" not present in program.')}function R7(e,t,n){return e.getUniformLocation(t,n)}function M7(e,t,n,a){xe(e,()=>E7(e,t,a)),xe(e,()=>e.uniform1i(n,a))}function TP(e){xe(e,()=>e.bindFramebuffer(e.FRAMEBUFFER,null)),xe(e,()=>e.viewport(0,0,e.canvas.width,e.canvas.height)),xe(e,()=>e.scissor(0,0,e.canvas.width,e.canvas.height))}function oh(e,t,n){xe(e,()=>e.bindFramebuffer(e.FRAMEBUFFER,n)),xe(e,()=>e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,t,0))}function t1(e,t){xe(e,()=>e.bindFramebuffer(e.FRAMEBUFFER,t)),xe(e,()=>e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,null,0))}function ld(e){let t=e.checkFramebufferStatus(e.FRAMEBUFFER);if(t!==e.FRAMEBUFFER_COMPLETE)throw new Error("Error binding framebuffer: "+F7(e,t))}function F7(e,t){switch(t){case e.FRAMEBUFFER_INCOMPLETE_ATTACHMENT:return"FRAMEBUFFER_INCOMPLETE_ATTACHMENT";case e.FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT:return"FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT";case e.FRAMEBUFFER_INCOMPLETE_DIMENSIONS:return"FRAMEBUFFER_INCOMPLETE_DIMENSIONS";case e.FRAMEBUFFER_UNSUPPORTED:return"FRAMEBUFFER_UNSUPPORTED";default:return ` unknown error $ { t } ` }}function lr(e,t,n){let a=xe(e,()=>t());if(a==null)throw new Error(n);return a}function W7(e,t){let n=e.MAX_COMBINED_TEXTURE_IMAGE_UNITS-1,a=t+e.TEXTURE0;if(a<e.TEXTURE0||a>n){let r= ` [ gl . TEXTURE0 , gl . TEXTURE$ { n } ] ` ;throw new Error( ` textureUnit must be in $ { r } . ` )}}function vi(e,t=2){return k.sizeFromShape(e.slice(0,e.length-t))}function wi(e){if(e.length===0)throw Error("Cannot get rows and columns of an empty shape array.");return[e.length>1?e[e.length-2]:1,e[e.length-1]]}function lh(e){let t=[1,1,1];return e.length===0||e.length===1&&e[0]===1||(t=[vi(e),...wi(e)]),t}function $ 7(e,t=!1){let n=J().getNumber("WEBGL_MAX_TEXTURE_SIZE");t&&(n=n*2,e=e.map((r,s)=>s>=e.length-2?k.nearestLargerEven(e[s]):e[s]),e.length===1&&(e=[2,e[0]])),e.length!==2&&(e=k.squeezeShape(e).newShape);let a=k.sizeFromShape(e);if(e.length<=1&&a<=n)return[1,a];if(e.length===2&&e[0]<=n&&e[1]<=n)return e;if(e.length===3&&e[0]*e[1]<=n&&e[2]<=n)return[e[0]*e[1],e[2]];if(e.length===3&&e[0]<=n&&e[1]*e[2]<=n)return[e[0],e[1]*e[2]];if(e.length===4&&e[0]*e[1]
bool isnan _custom ( float val ) {
return ( val > 0.0 || val < 0.0 ) ? false : val != 0.0 ;
2021-03-29 21:01:16 +02:00
}
2021-04-19 22:19:03 +02:00
2021-04-28 14:58:21 +02:00
bvec4 isnan _custom ( vec4 val ) {
return bvec4 ( isnan _custom ( val . x ) ,
isnan _custom ( val . y ) , isnan _custom ( val . z ) , isnan _custom ( val . w ) ) ;
2021-04-15 21:01:27 +02:00
}
2021-04-28 14:58:21 +02:00
# define isnan ( value ) isnan _custom ( value )
` ,l="",d= `
# define round ( value ) newRound ( value )
int newRound ( float value ) {
return int ( floor ( value + 0.5 ) ) ;
2021-04-15 21:01:27 +02:00
}
2021-04-28 14:58:21 +02:00
ivec4 newRound ( vec4 value ) {
return ivec4 ( floor ( value + vec4 ( 0.5 ) ) ) ;
2021-04-19 22:02:47 +02:00
}
2021-04-28 14:58:21 +02:00
` ):(e="",t="attribute",n="varying",a="varying",r="texture2D",s="gl_FragColor",i="",o= `
# define isnan ( value ) isnan _custom ( value )
bool isnan _custom ( float val ) {
return ( val > 0. || val < 1. || val == 0. ) ? false : true ;
2021-04-28 14:55:26 +02:00
}
2021-04-28 14:58:21 +02:00
bvec4 isnan _custom ( vec4 val ) {
return bvec4 ( isnan ( val . x ) , isnan ( val . y ) , isnan ( val . z ) , isnan ( val . w ) ) ;
2021-04-19 22:02:47 +02:00
}
2021-04-28 14:58:21 +02:00
` ,l= `
uniform float INFINITY ;
bool isinf ( float val ) {
return abs ( val ) == INFINITY ;
2021-04-19 22:02:47 +02:00
}
2021-04-28 14:58:21 +02:00
bvec4 isinf ( vec4 val ) {
return equal ( abs ( val ) , vec4 ( INFINITY ) ) ;
2021-04-19 22:02:47 +02:00
}
2021-04-28 14:58:21 +02:00
` ,d= `
int round ( float value ) {
return int ( floor ( value + 0.5 ) ) ;
2021-04-19 22:02:47 +02:00
}
2021-04-28 14:58:21 +02:00
ivec4 round ( vec4 value ) {
return ivec4 ( floor ( value + vec4 ( 0.5 ) ) ) ;
2021-04-19 22:02:47 +02:00
}
2021-04-28 14:58:21 +02:00
` ),{version:e,attribute:t,varyingVs:n,varyingFs:a,texture2D:r,output:s,defineOutput:i,defineSpecialNaN:o,defineSpecialInf:l,defineRound:d}}function Ii(e,t,n="index"){let a=k.computeStrides(t);return a.map((r,s)=>{let i= ` int $ { e [ s ] } = $ { n } / $ { r } ` ,o=s===a.length-1? ` int $ { e [ s + 1 ] } = $ { n } - $ { e [ s ] } * $ { r } ` : ` index -= $ { e [ s ] } * $ { r } ` ;return ` $ { i } ; $ { o } ; ` }).join("")}function i1(e){let t=k.computeStrides(e).map(n=>n.toString());return `
int getFlatIndex ( ivec3 coords ) {
return coords . x * $ { t [ 0 ] } + coords . y * $ { t [ 1 ] } + coords . z ;
}
` }var B7= `
const float FLOAT _MAX = 1.70141184 e38 ;
const float FLOAT _MIN = 1.17549435 e - 38 ;
lowp vec4 encode _float ( highp float v ) {
if ( isnan ( v ) ) {
return vec4 ( 255 , 255 , 255 , 255 ) ;
}
highp float av = abs ( v ) ;
if ( av < FLOAT _MIN ) {
return vec4 ( 0.0 , 0.0 , 0.0 , 0.0 ) ;
} else if ( v > FLOAT _MAX ) {
return vec4 ( 0.0 , 0.0 , 128.0 , 127.0 ) / 255.0 ;
} else if ( v < - FLOAT _MAX ) {
return vec4 ( 0.0 , 0.0 , 128.0 , 255.0 ) / 255.0 ;
}
highp vec4 c = vec4 ( 0 , 0 , 0 , 0 ) ;
highp float e = floor ( log2 ( av ) ) ;
highp float m = exp2 ( fract ( log2 ( av ) ) ) - 1.0 ;
c [ 2 ] = floor ( 128.0 * m ) ;
m -= c [ 2 ] / 128.0 ;
c [ 1 ] = floor ( 32768.0 * m ) ;
m -= c [ 1 ] / 32768.0 ;
c [ 0 ] = floor ( 8388608.0 * m ) ;
highp float ebias = e + 127.0 ;
c [ 3 ] = floor ( ebias / 2.0 ) ;
ebias -= c [ 3 ] * 2.0 ;
c [ 2 ] += floor ( ebias ) * 128.0 ;
c [ 3 ] += 128.0 * step ( 0.0 , - v ) ;
return c / 255.0 ;
}
` ,WP=class{constructor(e){this.variableNames=["A"],this.packedInputs=!1,this.packedOutput=!0,this.outPackingScheme=dd.DENSE;let t=cd(e),n=dn();this.outputShape=e,this.userCode= `
ivec3 outCoordsFromFlatIndex ( int index ) {
$ { Ii ( [ "r" , "c" , "d" ] , e ) }
return ivec3 ( r , c , d ) ;
2021-04-28 14:55:26 +02:00
}
2021-04-28 14:58:21 +02:00
void main ( ) {
ivec2 resTexRC = ivec2 ( resultUV . yx *
vec2 ( $ { t [ 0 ] } , $ { t [ 1 ] } ) ) ;
int index = 4 * ( resTexRC . x * $ { t [ 1 ] } + resTexRC . y ) ;
vec4 result = vec4 ( 0. ) ;
for ( int i = 0 ; i < 4 ; i ++ ) {
int flatIndex = index + i ;
ivec3 rc = outCoordsFromFlatIndex ( flatIndex ) ;
result [ i ] = getA ( rc . x , rc . y , rc . z ) ;
2021-04-28 14:55:26 +02:00
}
2021-04-28 14:58:21 +02:00
$ { n . output } = result ;
2021-04-28 14:55:26 +02:00
}
2021-04-28 14:58:21 +02:00
` }},BP=class{constructor(e){this.variableNames=["A"],this.packedInputs=!0,this.packedOutput=!0,this.outPackingScheme=dd.DENSE;let t=cd(e),n=dn();this.outputShape=e,this.userCode= `
ivec3 outCoordsFromFlatIndex ( int index ) {
$ { Ii ( [ "r" , "c" , "d" ] , e ) }
return ivec3 ( r , c , d ) ;
2021-04-28 14:55:26 +02:00
}
2021-04-28 14:58:21 +02:00
void main ( ) {
ivec2 resTexRC = ivec2 ( resultUV . yx *
vec2 ( $ { t [ 0 ] } , $ { t [ 1 ] } ) ) ;
int index = 4 * ( resTexRC . x * $ { t [ 1 ] } + resTexRC . y ) ;
vec4 result = vec4 ( 0. ) ;
for ( int i = 0 ; i < 4 ; i ++ ) {
int flatIndex = index + i ;
ivec3 rc = outCoordsFromFlatIndex ( flatIndex ) ;
result [ i ] = getChannel ( getA ( rc . x , rc . y , rc . z ) , vec2 ( rc . y , rc . z ) ) ;
2021-04-28 14:55:26 +02:00
}
2021-04-28 14:58:21 +02:00
$ { n . output } = result ;
2021-04-28 14:55:26 +02:00
}
2021-04-28 14:58:21 +02:00
` }},VP=class{constructor(e){this.variableNames=["A"],this.outTexUsage=Yn.DOWNLOAD;let t=dn();this.outputShape=e,this.userCode= `
$ { B7 }
void main ( ) {
float x = getAAtOutCoords ( ) ;
$ { t . output } = encode _float ( x ) ;
2021-04-28 14:55:26 +02:00
}
2021-04-28 14:58:21 +02:00
` }},jP=class{constructor(e){this.variableNames=["A"],this.packedInputs=!0,this.packedOutput=!1,this.outTexUsage=Yn.DOWNLOAD;let t=dn();this.outputShape=e,this.userCode= `
$ { B7 }
void main ( ) {
ivec3 coords = getOutputCoords ( ) ;
float x = getChannel ( getAAtOutCoords ( ) , vec2 ( coords . y , coords . z ) ) ;
$ { t . output } = encode _float ( x ) ;
2021-04-28 14:55:26 +02:00
}
2021-04-28 14:58:21 +02:00
` }},UP=class{constructor(e,t,n=!1){this.variableNames=["A"];let a=dn(),[r,s]=t;this.outputShape=e;let i="result";n&&(i="floor(result * 255. + 0.5)"),this.userCode= `
$ { i1 ( e ) }
void main ( ) {
ivec3 coords = getOutputCoords ( ) ;
int flatIndex = getFlatIndex ( coords ) ;
int offset = imod ( flatIndex , 4 ) ;
flatIndex = idiv ( flatIndex , 4 , 1. ) ;
int r = flatIndex / $ { s } ;
int c = imod ( flatIndex , $ { s } ) ;
vec2 uv = ( vec2 ( c , r ) + halfCR ) / vec2 ( $ { s } . 0 , $ { r } . 0 ) ;
vec4 values = $ { a . texture2D } ( A , uv ) ;
float result ;
if ( offset == 0 ) {
result = values [ 0 ] ;
} else if ( offset == 1 ) {
result = values [ 1 ] ;
} else if ( offset == 2 ) {
result = values [ 2 ] ;
2021-03-24 16:08:49 +01:00
} else {
2021-04-28 14:58:21 +02:00
result = values [ 3 ] ;
2021-04-28 14:55:26 +02:00
}
2021-04-28 14:58:21 +02:00
$ { a . output } = vec4 ( $ { i } , 0. , 0. , 0. ) ;
2021-04-19 22:19:03 +02:00
}
2021-04-28 14:58:21 +02:00
` }},HP=class{constructor(e,t,n=!1){this.variableNames=["A"],this.packedInputs=!1,this.packedOutput=!0;let a=dn(),[r,s]=t;this.outputShape=e;let i="",o="result";n&&(o="floor(result * 255. + 0.5)");for(let l=0;l<=1;l++)for(let d=0;d<=1;d++){let u=l*2+d;i+= `
localCoords = coords ;
if ( localCoords [ 2 ] + $ { d } < $ { e [ 2 ] } ) {
localCoords [ 2 ] += $ { d } ;
if ( localCoords [ 1 ] + $ { l } < $ { e [ 1 ] } ) {
localCoords [ 1 ] += $ { l } ;
flatIndex = getFlatIndex ( localCoords ) ;
offset = imod ( flatIndex , 4 ) ;
flatIndex = idiv ( flatIndex , 4 , 1. ) ;
r = flatIndex / $ { s } ;
c = imod ( flatIndex , $ { s } ) ;
uv = ( vec2 ( c , r ) + halfCR ) / vec2 ( $ { s } . 0 , $ { r } . 0 ) ;
values = $ { a . texture2D } ( A , uv ) ;
if ( offset == 0 ) {
result [ $ { u } ] = values [ 0 ] ;
} else if ( offset == 1 ) {
result [ $ { u } ] = values [ 1 ] ;
} else if ( offset == 2 ) {
result [ $ { u } ] = values [ 2 ] ;
2021-04-28 14:55:26 +02:00
} else {
2021-04-28 14:58:21 +02:00
result [ $ { u } ] = values [ 3 ] ;
2021-04-28 14:55:26 +02:00
}
}
}
2021-04-28 14:58:21 +02:00
` }this.userCode= `
$ { i1 ( e ) }
void main ( ) {
ivec3 coords = getOutputCoords ( ) ;
vec4 result = vec4 ( 0. ) ;
int flatIndex , r , c , offset ;
ivec3 localCoords ;
vec2 uv ;
vec4 values ;
$ { i }
$ { a . output } = $ { o } ;
}
` }},V7={};Fe(V7,{bindVertexProgramAttributeStreams:()=>Y7,createBufferFromOutputTexture:()=>ev,createFloat16MatrixTexture:()=>q7,createFloat16PackedMatrixTexture:()=>Z7,createFloat32MatrixTexture:()=>G7,createIndexBuffer:()=>H7,createPackedMatrixTexture:()=>K7,createUnsignedBytesMatrixTexture:()=>X7,createVertexBuffer:()=>U7,createVertexShader:()=>j7,downloadByteEncodedFloatMatrixFromOutputTexture:()=>nv,downloadFloat32MatrixFromBuffer:()=>tv,downloadMatrixFromPackedOutputTexture:()=>rv,downloadPackedMatrixFromBuffer:()=>av,getInternalFormatForFloat16MatrixTexture:()=>l1,getInternalFormatForFloat16PackedMatrixTexture:()=>p1,getInternalFormatForFloat32MatrixTexture:()=>o1,getInternalFormatForPackedMatrixTexture:()=>d1,getInternalFormatForUnsignedBytesMatrixTexture:()=>u1,uploadDenseMatrixToTexture:()=>J7,uploadPixelDataToTexture:()=>Q7});function j7(e){let t=dn(),n= ` $ { t . version }
precision highp float ;
$ { t . attribute } vec3 clipSpacePos ;
$ { t . attribute } vec2 uv ;
$ { t . varyingVs } vec2 resultUV ;
void main ( ) {
gl _Position = vec4 ( clipSpacePos , 1 ) ;
resultUV = uv ;
} ` ;return x7(e,n)}function U7(e){let t=new Float32Array([-1,1,0,0,1,-1,-1,0,0,0,1,1,0,1,1,1,-1,0,1,0]);return k7(e,t)}function H7(e){let t=new Uint16Array([0,1,2,2,1,3]);return I7(e,t)}function hd(e,t,n,a,r,s){N7(t,n);let i=S7(e),o=e.TEXTURE_2D;return xe(e,()=>e.bindTexture(o,i)),xe(e,()=>e.texParameteri(o,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE)),xe(e,()=>e.texParameteri(o,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE)),xe(e,()=>e.texParameteri(o,e.TEXTURE_MIN_FILTER,e.NEAREST)),xe(e,()=>e.texParameteri(o,e.TEXTURE_MAG_FILTER,e.NEAREST)),xe(e,()=>e.texImage2D(o,0,a,t,n,0,r,s,null)),xe(e,()=>e.bindTexture(e.TEXTURE_2D,null)),i}function o1(e){return e.internalFormatFloat}function G7(e,t,n,a){let[r,s]=pd(t,n);return hd(e,r,s,o1(a),a.textureFormatFloat,e.FLOAT)}function l1(e){return e.internalFormatHalfFloat}function q7(e,t,n,a){let[r,s]=pd(t,n);return hd(e,r,s,l1(a),a.textureFormatFloat,a.textureTypeHalfFloat)}function u1(e){return e.downloadTextureFormat}function X7(e,t,n,a){let[r,s]=pd(t,n);return hd(e,r,s,u1(a),e.RGBA,e.UNSIGNED_BYTE)}function d1(e){return e.internalFormatPackedFloat}function K7(e,t,n,a){let[r,s]=Tl(t,n);return hd(e,r,s,d1(a),e.RGBA,e.FLOAT)}function p1(e){return e.internalFormatPackedHalfFloat}function Z7(e,t,n,a){let[r,s]=Tl(t,n);return hd(e,r,s,p1(a),e.RGBA,a.textureTypeHalfFloat)}function Y7(e,t,n){let a=0,r=3*4,s=3*4+2*4;return xe(e,()=>e.bindBuffer(e.ARRAY_BUFFER,n)),e1(e,t,"clipSpacePos",n,3,s,a)&&e1(e,t,"uv",n,2,s,r)}function J7(e,t,n,a,r,s){xe(e,()=>e.bindTexture(e.TEXTURE_2D,t));let i,o,l;r instanceof Uint8Array?(i=new Uint8Array(n*a*4),o=e.UNSIGNED_BYTE,l=e.RGBA):(i=new Float32Array(n*a*4),o=e.FLOAT,l=s.internalFormatPackedFloat),i.set(r),xe(e,()=>e.texImage2D(e.TEXTURE_2D,0,l,n,a,0,e.RGBA,o,i)),xe(e,()=>e.bindTexture(e.TEXTURE_2D,null))}function Q7(e,t,n){xe(e,()=>e.bindTexture(e.TEXTURE_2D,t)),n.data instanceof Uint8Array?xe(e,()=>e.texImage2D(e.TEXTURE_2D,0,e.RGBA,n.width,n.height,0,e.RGBA,e.UNSIGNED_BYTE,n.data)):xe(e,()=>e.texImage2D(e.TEXTURE_2D,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,n)),xe(e,()=>e.bindTexture(e.TEXTURE_2D,null))}function ev(e,t,n,a){let r=e.createBuffer();xe(e,()=>e.bindBuffer(e.PIXEL_PACK_BUFFER,r));let s=4*4*t*n;return xe(e,()=>e.bufferData(e.PIXEL_PACK_BUFFER,s,e.STREAM_READ)),xe(e,()=>e.readPixels(0,0,n,t,e.RGBA,e.FLOAT,0)),xe(e,()=>e.bindBuffer(e.PIXEL_PACK_BUFFER,null)),r}function tv(e,t,n){let a=e,r=new Float32Array(n);return a.bindBuffer(a.PIXEL_PACK_BUFFER,t),a.getBufferSubData(a.PIXEL_PACK_BUFFER,0,r),a.bindBuffer(a.PIXEL_PACK_BUFFER,null),r}function nv(e,t,n,a){let[r,s]=pd(t,n),i=4,o=new Uint8Array(FP(t*n,i));return xe(e,()=>e.readPixels(0,0,r,s,a.downloadTextureFormat,e.UNSIGNED_BYTE,o)),new Float32Array(o.buffer)}function av(e,t,n,a,r,s,i,o){let l=e,d=new Float32Array( $ P(s,i));return l.bindBuffer(l.PIXEL_PACK_BUFFER,t),l.getBufferSubData(l.PIXEL_PACK_BUFFER,0,d),l.bindBuffer(l.PIXEL_PACK_BUFFER,null),d}function rv(e,t,n){let a=new Float32Array(t*n*4);return xe(e,()=>e.readPixels(0,0,n,t,e.RGBA,e.FLOAT,a)),a}var hh=class{constructor(e){this.outputTexture=null,this.program=null,this.disposed=!1,this.vertexAttrsAreBound=!1,this.itemsToPoll=[];let t=J().getNumber("WEBGL_VERSION");e!=null?(this.gl=e,uh(t,e)):this.gl=Va(t);let n="WEBGL_color_buffer_float",a="EXT_color_buffer_half_float";if(J().getNumber("WEBGL_VERSION")===1){let r="OES_texture_float",s="OES_texture_half_float";if(this.textureFloatExtension=od(this.gl,r),Zn(this.gl,s))this.textureHalfFloatExtension=od(this.gl,s);else if(J().get("WEBGL_FORCE_F16_TEXTURES"))throw new Error("GL context does not support half float textures, yet the environment flag WEBGL_FORCE_F16_TEXTURES is set to true.");if(this.colorBufferFloatExtension=this.gl.getExtension(n),Zn(this.gl,a))this.colorBufferHalfFloatExtension=od(this.gl,a);else if(J().get("WEBGL_FORCE_F16_TEXTURES"))throw new Error("GL context does not support color renderable half floats, yet the environment flag WEBGL_FORCE_F16_TEXTURES is set to true.")}else if(n="EXT_color_buffer_float",Zn(this.gl,n))this.colorBufferFloatExtension=this.gl.getExtension(n);else if(Zn(this.gl,a))this.
` ),i=e.map(h=>qP(h,t,a)).join( `
` ),o=t.texShape,l=dn(),d=ZP(l),u,p,c=QP(l);return t.isPacked?(u=XP(t.logicalShape,o),p=JP(l)):(u=KP(t.logicalShape,o),p=YP(l)),a&&(c+=eL),[c,d,p,s,u,i,n].join( `
` )}function El(e){let t=e.shapeInfo.logicalShape;switch(t.length){case 0:return nL(e);case 1:return aL(e);case 2:return rL(e);case 3:return sL(e);case 4:return iL(e);case 5:return oL(e);case 6:return lL(e);default:throw new Error( ` $ { t . length } - D input sampling is not yet supported ` )}}function iv(e){switch(e.shapeInfo.logicalShape.length){case 0:return uL(e);case 1:return dL(e);case 2:return pL(e);case 3:return cL(e);default:return hL(e)}}function qP(e,t,n=!1){let a="";n?a+=iv(e):a+=El(e);let r=e.shapeInfo.logicalShape,s=t.logicalShape;return r.length<=s.length&&(n?a+=fL(e,t):a+=mL(e,t)),a}function XP(e,t){switch(e.length){case 0:return ov();case 1:return AL(e,t);case 2:return xL(e,t);case 3:return yL(e,t);default:return gL(e,t)}}function KP(e,t){switch(e.length){case 0:return ov();case 1:return bL(e,t);case 2:return SL(e,t);case 3:return vL(e,t);case 4:return wL(e,t);case 5:return kL(e,t);case 6:return IL(e,t);default:throw new Error( ` $ { e . length } - D output sampling is not yet supported ` )}}function ZP(e){return `
float sampleTexture ( sampler2D textureSampler , vec2 uv ) {
return $ { e . texture2D } ( textureSampler , uv ) . r ;
}
` }function YP(e){return `
void setOutput ( float val ) {
$ { e . output } = vec4 ( val , 0 , 0 , 0 ) ;
}
` }function JP(e){return `
void setOutput ( vec4 val ) {
$ { e . output } = val ;
}
` }function QP(e){return ` $ { e . version }
precision highp float ;
precision highp int ;
precision highp sampler2D ;
$ { e . varyingFs } vec2 resultUV ;
$ { e . defineOutput }
const vec2 halfCR = vec2 ( 0.5 , 0.5 ) ;
struct ivec5
{
int x ;
int y ;
int z ;
int w ;
int u ;
} ;
struct ivec6
{
int x ;
int y ;
int z ;
int w ;
int u ;
int v ;
} ;
uniform float NAN ;
$ { e . defineSpecialNaN }
$ { e . defineSpecialInf }
$ { e . defineRound }
int imod ( int x , int y ) {
return x - y * ( x / y ) ;
}
int idiv ( int a , int b , float sign ) {
int res = a / b ;
int mod = imod ( a , b ) ;
if ( sign < 0. && mod != 0 ) {
res -= 1 ;
}
return res ;
}
//Based on the work of Dave Hoskins
//https://www.shadertoy.com/view/4djSRW
# define HASHSCALE1 443.8975
float random ( float seed ) {
vec2 p = resultUV * seed ;
vec3 p3 = fract ( vec3 ( p . xyx ) * HASHSCALE1 ) ;
p3 += dot ( p3 , p3 . yzx + 19.19 ) ;
return fract ( ( p3 . x + p3 . y ) * p3 . z ) ;
}
$ { NL }
$ { TL }
$ { EL }
` }var NL= `
vec2 uvFromFlat ( int texNumR , int texNumC , int index ) {
int texR = index / texNumC ;
int texC = index - texR * texNumC ;
return ( vec2 ( texC , texR ) + halfCR ) / vec2 ( texNumC , texNumR ) ;
}
vec2 packedUVfrom1D ( int texNumR , int texNumC , int index ) {
int texelIndex = index / 2 ;
int texR = texelIndex / texNumC ;
int texC = texelIndex - texR * texNumC ;
return ( vec2 ( texC , texR ) + halfCR ) / vec2 ( texNumC , texNumR ) ;
}
` ,TL= `
vec2 packedUVfrom2D ( int texelsInLogicalRow , int texNumR ,
int texNumC , int row , int col ) {
int texelIndex = ( row / 2 ) * texelsInLogicalRow + ( col / 2 ) ;
int texR = texelIndex / texNumC ;
int texC = texelIndex - texR * texNumC ;
return ( vec2 ( texC , texR ) + halfCR ) / vec2 ( texNumC , texNumR ) ;
}
` ,EL= `
vec2 packedUVfrom3D ( int texNumR , int texNumC ,
int texelsInBatch , int texelsInLogicalRow , int b ,
int row , int col ) {
int index = b * texelsInBatch + ( row / 2 ) * texelsInLogicalRow + ( col / 2 ) ;
int texR = index / texNumC ;
int texC = index - texR * texNumC ;
return ( vec2 ( texC , texR ) + halfCR ) / vec2 ( texNumC , texNumR ) ;
}
` ,eL= `
float getChannel ( vec4 frag , vec2 innerDims ) {
vec2 modCoord = mod ( innerDims , 2. ) ;
return modCoord . x == 0. ?
( modCoord . y == 0. ? frag . r : frag . g ) :
( modCoord . y == 0. ? frag . b : frag . a ) ;
}
float getChannel ( vec4 frag , int dim ) {
float modCoord = mod ( float ( dim ) , 2. ) ;
return modCoord == 0. ? frag . r : frag . g ;
}
` ;function ov(){return `
int getOutputCoords ( ) {
return 0 ;
}
` }function AL(e,t){let n=[Math.ceil(t[0]/2),Math.ceil(t[1]/2)];return n[0]===1? `
int getOutputCoords ( ) {
return 2 * int ( resultUV . x * $ { n [ 1 ] } . 0 ) ;
}
` :n[1]===1? `
int getOutputCoords ( ) {
return 2 * int ( resultUV . y * $ { n [ 0 ] } . 0 ) ;
}
` : `
int getOutputCoords ( ) {
ivec2 resTexRC = ivec2 ( resultUV . yx *
vec2 ( $ { n [ 0 ] } , $ { n [ 1 ] } ) ) ;
return 2 * ( resTexRC . x * $ { n [ 1 ] } + resTexRC . y ) ;
}
` }function bL(e,t){return t[0]===1? `
int getOutputCoords ( ) {
return int ( resultUV . x * $ { t [ 1 ] } . 0 ) ;
}
` :t[1]===1? `
int getOutputCoords ( ) {
return int ( resultUV . y * $ { t [ 0 ] } . 0 ) ;
}
` : `
int getOutputCoords ( ) {
ivec2 resTexRC = ivec2 ( resultUV . yx *
vec2 ( $ { t [ 0 ] } , $ { t [ 1 ] } ) ) ;
return resTexRC . x * $ { t [ 1 ] } + resTexRC . y ;
}
` }function yL(e,t){let n=[Math.ceil(t[0]/2),Math.ceil(t[1]/2)],a=Math.ceil(e[2]/2),r=a*Math.ceil(e[1]/2);return `
ivec3 getOutputCoords ( ) {
ivec2 resTexRC = ivec2 ( resultUV . yx *
vec2 ( $ { n [ 0 ] } , $ { n [ 1 ] } ) ) ;
int index = resTexRC . x * $ { n [ 1 ] } + resTexRC . y ;
int b = index / $ { r } ;
index -= b * $ { r } ;
int r = 2 * ( index / $ { a } ) ;
int c = imod ( index , $ { a } ) * 2 ;
return ivec3 ( b , r , c ) ;
}
` }function vL(e,t){let n=Ii(["r","c","d"],e);return `
ivec3 getOutputCoords ( ) {
ivec2 resTexRC = ivec2 ( resultUV . yx *
vec2 ( $ { t [ 0 ] } , $ { t [ 1 ] } ) ) ;
int index = resTexRC . x * $ { t [ 1 ] } + resTexRC . y ;
$ { n }
return ivec3 ( r , c , d ) ;
}
` }function gL(e,t){let n=[Math.ceil(t[0]/2),Math.ceil(t[1]/2)],a=Math.ceil(e[e.length-1]/2),r=a*Math.ceil(e[e.length-2]/2),s=r,i="",o="b, r, c";for(let l=2;l<e.length-1;l++)s*=e[e.length-l-1],i= `
int b$ { l } = index / $ { s } ;
index -= b$ { l } * $ { s } ;
` +i,o= ` b$ { l } , ` +o;return `
ivec$ { e . length } getOutputCoords ( ) {
ivec2 resTexRC = ivec2 ( resultUV . yx *
vec2 ( $ { n [ 0 ] } , $ { n [ 1 ] } ) ) ;
int index = resTexRC . x * $ { n [ 1 ] } + resTexRC . y ;
$ { i }
int b = index / $ { r } ;
index -= b * $ { r } ;
int r = 2 * ( index / $ { a } ) ;
int c = imod ( index , $ { a } ) * 2 ;
return ivec$ { e . length } ( $ { o } ) ;
}
` }function wL(e,t){let n=Ii(["r","c","d","d2"],e);return `
ivec4 getOutputCoords ( ) {
ivec2 resTexRC = ivec2 ( resultUV . yx *
vec2 ( $ { t [ 0 ] } , $ { t [ 1 ] } ) ) ;
int index = resTexRC . x * $ { t [ 1 ] } + resTexRC . y ;
$ { n }
return ivec4 ( r , c , d , d2 ) ;
}
` }function kL(e,t){let n=Ii(["r","c","d","d2","d3"],e);return `
ivec5 getOutputCoords ( ) {
ivec2 resTexRC = ivec2 ( resultUV . yx * vec2 ( $ { t [ 0 ] } ,
$ { t [ 1 ] } ) ) ;
int index = resTexRC . x * $ { t [ 1 ] } + resTexRC . y ;
$ { n }
ivec5 outShape = ivec5 ( r , c , d , d2 , d3 ) ;
return outShape ;
}
` }function IL(e,t){let n=Ii(["r","c","d","d2","d3","d4"],e);return `
ivec6 getOutputCoords ( ) {
ivec2 resTexRC = ivec2 ( resultUV . yx *
vec2 ( $ { t [ 0 ] } , $ { t [ 1 ] } ) ) ;
int index = resTexRC . x * $ { t [ 1 ] } + resTexRC . y ;
$ { n }
ivec6 result = ivec6 ( r , c , d , d2 , d3 , d4 ) ;
return result ;
}
` }function xL(e,t){let n=[Math.ceil(t[0]/2),Math.ceil(t[1]/2)];if(k.arraysEqual(e,t))return `
ivec2 getOutputCoords ( ) {
return 2 * ivec2 ( resultUV . yx * vec2 ( $ { n [ 0 ] } , $ { n [ 1 ] } ) ) ;
}
` ;let a=Math.ceil(e[1]/2);return `
ivec2 getOutputCoords ( ) {
ivec2 resTexRC = ivec2 ( resultUV . yx *
vec2 ( $ { n [ 0 ] } , $ { n [ 1 ] } ) ) ;
int index = resTexRC . x * $ { n [ 1 ] } + resTexRC . y ;
int r = 2 * ( index / $ { a } ) ;
int c = imod ( index , $ { a } ) * 2 ;
return ivec2 ( r , c ) ;
}
` }function SL(e,t){return k.arraysEqual(e,t)? `
ivec2 getOutputCoords ( ) {
return ivec2 ( resultUV . yx * vec2 ( $ { t [ 0 ] } , $ { t [ 1 ] } ) ) ;
}
` :e[1]===1? `
ivec2 getOutputCoords ( ) {
ivec2 resTexRC = ivec2 ( resultUV . yx *
vec2 ( $ { t [ 0 ] } , $ { t [ 1 ] } ) ) ;
int index = resTexRC . x * $ { t [ 1 ] } + resTexRC . y ;
return ivec2 ( index , 0 ) ;
}
` :e[0]===1? `
ivec2 getOutputCoords ( ) {
ivec2 resTexRC = ivec2 ( resultUV . yx *
vec2 ( $ { t [ 0 ] } , $ { t [ 1 ] } ) ) ;
int index = resTexRC . x * $ { t [ 1 ] } + resTexRC . y ;
return ivec2 ( 0 , index ) ;
}
` : `
ivec2 getOutputCoords ( ) {
ivec2 resTexRC = ivec2 ( resultUV . yx *
vec2 ( $ { t [ 0 ] } , $ { t [ 1 ] } ) ) ;
int index = resTexRC . x * $ { t [ 1 ] } + resTexRC . y ;
int r = index / $ { e [ 1 ] } ;
int c = index - r * $ { e [ 1 ] } ;
return ivec2 ( r , c ) ;
}
` }function Si(e){return ` offset$ { e } ` }function uL(e){let t=e.name,n="get"+t.charAt(0).toUpperCase()+t.slice(1),a=dn();return `
vec4 $ { n } ( ) {
return $ { a . texture2D } ( $ { t } , halfCR ) ;
}
` }function nL(e){let t=e.name,n="get"+t.charAt(0).toUpperCase()+t.slice(1);if(e.shapeInfo.isUniform)return ` float $ { n } ( ) { return $ { t } ; } ` ;let[a,r]=e.shapeInfo.texShape;if(a===1&&r===1)return `
float $ { n } ( ) {
return sampleTexture ( $ { t } , halfCR ) ;
}
` ;let[s,i]=e.shapeInfo.texShape,o=Si(t);return `
float $ { n } ( ) {
vec2 uv = uvFromFlat ( $ { s } , $ { i } , $ { o } ) ;
return sampleTexture ( $ { t } , uv ) ;
}
` }function dL(e){let t=e.name,n="get"+t.charAt(0).toUpperCase()+t.slice(1),a=e.shapeInfo.texShape,r=[Math.ceil(a[0]/2),Math.ceil(a[1]/2)],s=dn();return `
vec4 $ { n } ( int index ) {
vec2 uv = packedUVfrom1D (
$ { r [ 0 ] } , $ { r [ 1 ] } , index ) ;
return $ { s . texture2D } ( $ { t } , uv ) ;
}
` }function aL(e){let t=e.name,n="get"+t.charAt(0).toUpperCase()+t.slice(1);if(e.shapeInfo.isUniform)return `
float $ { n } ( int index ) {
$ { Cl ( e ) }
}
` ;let a=e.shapeInfo.texShape,r=a[0],s=a[1];if(s===1&&r===1)return `
float $ { n } ( int index ) {
return sampleTexture ( $ { t } , halfCR ) ;
}
` ;let i=Si(t);return s===1? `
float $ { n } ( int index ) {
vec2 uv = vec2 ( 0.5 , ( float ( index + $ { i } ) + 0.5 ) / $ { r } . 0 ) ;
return sampleTexture ( $ { t } , uv ) ;
}
` :r===1? `
float $ { n } ( int index ) {
vec2 uv = vec2 ( ( float ( index + $ { i } ) + 0.5 ) / $ { s } . 0 , 0.5 ) ;
return sampleTexture ( $ { t } , uv ) ;
}
` : `
float $ { n } ( int index ) {
vec2 uv = uvFromFlat ( $ { r } , $ { s } , index + $ { i } ) ;
return sampleTexture ( $ { t } , uv ) ;
}
` }function pL(e){let t=e.shapeInfo.logicalShape,n=e.name,a="get"+n.charAt(0).toUpperCase()+n.slice(1),r=e.shapeInfo.texShape,s=r[0],i=r[1],o=dn();if(r!=null&&k.arraysEqual(t,r))return `
vec4 $ { a } ( int row , int col ) {
vec2 uv = ( vec2 ( col , row ) + halfCR ) / vec2 ( $ { i } . 0 , $ { s } . 0 ) ;
return $ { o . texture2D } ( $ { n } , uv ) ;
}
` ;let l=[Math.ceil(r[0]/2),Math.ceil(r[1]/2)],d=Math.ceil(t[1]/2);return `
vec4 $ { a } ( int row , int col ) {
vec2 uv = packedUVfrom2D ( $ { d } , $ { l [ 0 ] } , $ { l [ 1 ] } , row , col ) ;
return $ { o . texture2D } ( $ { n } , uv ) ;
}
` }function rL(e){let t=e.shapeInfo.logicalShape,n=e.name,a="get"+n.charAt(0).toUpperCase()+n.slice(1),r=e.shapeInfo.texShape;if(r!=null&&k.arraysEqual(t,r)){let p=r[0],c=r[1];return `
float $ { a } ( int row , int col ) {
vec2 uv = ( vec2 ( col , row ) + halfCR ) / vec2 ( $ { c } . 0 , $ { p } . 0 ) ;
return sampleTexture ( $ { n } , uv ) ;
}
` }let{newShape:s,keptDims:i}=k.squeezeShape(t),o=s;if(o.length<t.length){let p=Rl(e,o),c=["row","col"];return `
$ { El ( p ) }
float $ { a } ( int row , int col ) {
return $ { a } ( $ { Ml ( c , i ) } ) ;
}
` }if(e.shapeInfo.isUniform)return `
float $ { a } ( int row , int col ) {
int index = round ( dot ( vec2 ( row , col ) , vec2 ( $ { t [ 1 ] } , 1 ) ) ) ;
$ { Cl ( e ) }
}
` ;let l=r[0],d=r[1],u=Si(n);return d===1? `
float $ { a } ( int row , int col ) {
float index = dot ( vec3 ( row , col , $ { u } ) , vec3 ( $ { t [ 1 ] } , 1 , 1 ) ) ;
vec2 uv = vec2 ( 0.5 , ( index + 0.5 ) / $ { l } . 0 ) ;
return sampleTexture ( $ { n } , uv ) ;
}
` :l===1? `
float $ { a } ( int row , int col ) {
float index = dot ( vec3 ( row , col , $ { u } ) , vec3 ( $ { t [ 1 ] } , 1 , 1 ) ) ;
vec2 uv = vec2 ( ( index + 0.5 ) / $ { d } . 0 , 0.5 ) ;
return sampleTexture ( $ { n } , uv ) ;
}
` : `
float $ { a } ( int row , int col ) {
// Explicitly use integer operations as dot() only works on floats.
int index = row * $ { t [ 1 ] } + col + $ { u } ;
vec2 uv = uvFromFlat ( $ { l } , $ { d } , index ) ;
return sampleTexture ( $ { n } , uv ) ;
}
` }function cL(e){let t=e.shapeInfo.logicalShape,n=e.name,a="get"+n.charAt(0).toUpperCase()+n.slice(1),r=e.shapeInfo.texShape,s=[Math.ceil(r[0]/2),Math.ceil(r[1]/2)];if(t[0]===1){let p=t.slice(1),c=[1,2],h=Rl(e,p),m=["b","row","col"];return `
$ { iv ( h ) }
vec4 $ { a } ( int b , int row , int col ) {
return $ { a } ( $ { Ml ( m , c ) } ) ;
2021-04-28 14:55:26 +02:00
}
2021-04-28 14:58:21 +02:00
` }let i=s[0],o=s[1],l=Math.ceil(t[2]/2),d=l*Math.ceil(t[1]/2),u=dn();return `
vec4 $ { a } ( int b , int row , int col ) {
vec2 uv = packedUVfrom3D (
$ { i } , $ { o } , $ { d } , $ { l } , b , row , col ) ;
return $ { u . texture2D } ( $ { n } , uv ) ;
}
` }function sL(e){let t=e.shapeInfo.logicalShape,n=e.name,a="get"+n.charAt(0).toUpperCase()+n.slice(1),r=t[1]*t[2],s=t[2],{newShape:i,keptDims:o}=k.squeezeShape(t),l=i;if(l.length<t.length){let m=Rl(e,l),f=["row","col","depth"];return `
$ { El ( m ) }
float $ { a } ( int row , int col , int depth ) {
return $ { a } ( $ { Ml ( f , o ) } ) ;
2021-04-28 14:55:26 +02:00
}
2021-04-28 14:58:21 +02:00
` }if(e.shapeInfo.isUniform)return `
float $ { a } ( int row , int col , int depth ) {
int index = round ( dot ( vec3 ( row , col , depth ) ,
vec3 ( $ { r } , $ { s } , 1 ) ) ) ;
$ { Cl ( e ) }
}
` ;let d=e.shapeInfo.texShape,u=d[0],p=d[1],c=e.shapeInfo.flatOffset;if(p===r&&c==null)return `
float $ { a } ( int row , int col , int depth ) {
float texR = float ( row ) ;
float texC = dot ( vec2 ( col , depth ) , vec2 ( $ { s } , 1 ) ) ;
vec2 uv = ( vec2 ( texC , texR ) + halfCR ) /
vec2 ( $ { p } . 0 , $ { u } . 0 ) ;
return sampleTexture ( $ { n } , uv ) ;
2021-04-19 22:02:47 +02:00
}
2021-04-28 14:58:21 +02:00
` ;if(p===s&&c==null)return `
float $ { a } ( int row , int col , int depth ) {
float texR = dot ( vec2 ( row , col ) , vec2 ( $ { t [ 1 ] } , 1 ) ) ;
float texC = float ( depth ) ;
vec2 uv = ( vec2 ( texC , texR ) + halfCR ) / vec2 ( $ { p } . 0 , $ { u } . 0 ) ;
return sampleTexture ( $ { n } , uv ) ;
}
` ;let h=Si(n);return `
float $ { a } ( int row , int col , int depth ) {
// Explicitly use integer operations as dot() only works on floats.
int index = row * $ { r } + col * $ { s } + depth + $ { h } ;
vec2 uv = uvFromFlat ( $ { u } , $ { p } , index ) ;
return sampleTexture ( $ { n } , uv ) ;
}
` }function hL(e){let t=e.shapeInfo.logicalShape,n=t.length,a=e.name,r="get"+a.charAt(0).toUpperCase()+a.slice(1),s=e.shapeInfo.texShape,i=[Math.ceil(s[0]/2),Math.ceil(s[1]/2)],o=i[0],l=i[1],d=Math.ceil(t[n-1]/2),u=d*Math.ceil(t[n-2]/2),p="int b, int row, int col",c= ` b * $ { u } + ( row / 2 ) * $ { d } + ( col / 2 ) ` ;for(let m=2;m<n-1;m++)p= ` int b$ { m } , ` +p,u*=t[n-m-1],c= ` b$ { m } * $ { u } + ` +c;let h=dn();return `
vec4 $ { r } ( $ { p } ) {
int index = $ { c } ;
int texR = index / $ { l } ;
int texC = index - texR * $ { l } ;
vec2 uv = ( vec2 ( texC , texR ) + halfCR ) / vec2 ( $ { l } , $ { o } ) ;
return $ { h . texture2D } ( $ { a } , uv ) ;
}
` }function iL(e){let t=e.shapeInfo.logicalShape,n=e.name,a="get"+n.charAt(0).toUpperCase()+n.slice(1),r=t[3],s=t[2]*r,i=t[1]*s,{newShape:o,keptDims:l}=k.squeezeShape(t);if(o.length<t.length){let m=Rl(e,o),f=["row","col","depth","depth2"];return `
$ { El ( m ) }
float $ { a } ( int row , int col , int depth , int depth2 ) {
return $ { a } ( $ { Ml ( f , l ) } ) ;
}
` }if(e.shapeInfo.isUniform)return `
float $ { a } ( int row , int col , int depth , int depth2 ) {
int index = round ( dot ( vec4 ( row , col , depth , depth2 ) ,
vec4 ( $ { i } , $ { s } , $ { r } , 1 ) ) ) ;
$ { Cl ( e ) }
}
` ;let d=e.shapeInfo.flatOffset,u=e.shapeInfo.texShape,p=u[0],c=u[1];if(c===i&&d==null)return `
float $ { a } ( int row , int col , int depth , int depth2 ) {
float texR = float ( row ) ;
float texC =
dot ( vec3 ( col , depth , depth2 ) ,
vec3 ( $ { s } , $ { r } , 1 ) ) ;
vec2 uv = ( vec2 ( texC , texR ) + halfCR ) /
vec2 ( $ { c } . 0 , $ { p } . 0 ) ;
return sampleTexture ( $ { n } , uv ) ;
}
` ;if(c===r&&d==null)return `
float $ { a } ( int row , int col , int depth , int depth2 ) {
float texR = dot ( vec3 ( row , col , depth ) ,
vec3 ( $ { t [ 1 ] * t [ 2 ] } , $ { t [ 2 ] } , 1 ) ) ;
float texC = float ( depth2 ) ;
vec2 uv = ( vec2 ( texC , texR ) + halfCR ) /
vec2 ( $ { c } . 0 , $ { p } . 0 ) ;
return sampleTexture ( $ { n } , uv ) ;
}
` ;let h=Si(n);return `
float $ { a } ( int row , int col , int depth , int depth2 ) {
// Explicitly use integer operations as dot() only works on floats.
int index = row * $ { i } + col * $ { s } +
depth * $ { r } + depth2 ;
vec2 uv = uvFromFlat ( $ { p } , $ { c } , index + $ { h } ) ;
return sampleTexture ( $ { n } , uv ) ;
}
` }function oL(e){let t=e.shapeInfo.logicalShape,n=e.name,a="get"+n.charAt(0).toUpperCase()+n.slice(1),r=t[4],s=t[3]*r,i=t[2]*s,o=t[1]*i,{newShape:l,keptDims:d}=k.squeezeShape(t);if(l.length<t.length){let f=Rl(e,l),A=["row","col","depth","depth2","depth3"];return `
$ { El ( f ) }
float $ { a } ( int row , int col , int depth , int depth2 , int depth3 ) {
return $ { a } ( $ { Ml ( A , d ) } ) ;
}
` }if(e.shapeInfo.isUniform)return `
float $ { a } ( int row , int col , int depth , int depth2 , int depth3 ) {
float index = dot (
vec4 ( row , col , depth , depth2 ) ,
vec4 ( $ { o } , $ { i } , $ { s } , $ { r } ) ) +
depth3 ;
$ { Cl ( e ) }
}
` ;let u=e.shapeInfo.flatOffset,p=e.shapeInfo.texShape,c=p[0],h=p[1];if(h===o&&u==null)return `
float $ { a } ( int row , int col , int depth , int depth2 , int depth3 ) {
int texR = row ;
float texC = dot ( vec4 ( col , depth , depth2 , depth3 ) ,
vec4 ( $ { i } , $ { s } , $ { r } , 1 ) ) ;
vec2 uv = ( vec2 ( texC , texR ) + halfCR ) /
vec2 ( $ { h } . 0 , $ { c } . 0 ) ;
return sampleTexture ( $ { n } , uv ) ;
}
` ;if(h===r&&u==null)return `
float $ { a } ( int row , int col , int depth , int depth2 , int depth3 ) {
float texR = dot (
vec4 ( row , col , depth , depth2 ) ,
vec4 ( $ { t [ 1 ] * t [ 2 ] * t [ 3 ] } ,
$ { t [ 2 ] * t [ 3 ] } , $ { t [ 3 ] } , 1 ) ) ;
int texC = depth3 ;
vec2 uv = ( vec2 ( texC , texR ) + halfCR ) /
vec2 ( $ { h } . 0 , $ { c } . 0 ) ;
return sampleTexture ( $ { n } , uv ) ;
}
` ;let m=Si(n);return `
float $ { a } ( int row , int col , int depth , int depth2 , int depth3 ) {
// Explicitly use integer operations as dot() only works on floats.
int index = row * $ { o } + col * $ { i } + depth * $ { s } +
depth2 * $ { r } + depth3 + $ { m } ;
vec2 uv = uvFromFlat ( $ { c } , $ { h } , index ) ;
return sampleTexture ( $ { n } , uv ) ;
}
` }function lL(e){let t=e.shapeInfo.logicalShape,n=e.name,a="get"+n.charAt(0).toUpperCase()+n.slice(1),{newShape:r,keptDims:s}=k.squeezeShape(t);if(r.length<t.length){let A=Rl(e,r),y=["row","col","depth","depth2","depth3","depth4"];return `
$ { El ( A ) }
float $ { a } ( int row , int col , int depth ,
int depth2 , int depth3 , int depth4 ) {
return $ { a } ( $ { Ml ( y , s ) } ) ;
}
` }let i=t[5],o=t[4]*i,l=t[3]*o,d=t[2]*l,u=t[1]*d;if(e.shapeInfo.isUniform)return `
float $ { a } ( int row , int col , int depth ,
int depth2 , int depth3 , int depth4 ) {
int index = round ( dot (
vec4 ( row , col , depth , depth2 ) ,
vec4 ( $ { u } , $ { d } , $ { l } , $ { o } ) ) +
dot (
vec2 ( depth3 , depth4 ) ,
vec2 ( $ { i } , 1 ) ) ) ;
$ { Cl ( e ) }
}
` ;let p=e.shapeInfo.flatOffset,c=e.shapeInfo.texShape,h=c[0],m=c[1];if(m===u&&p==null)return `
float $ { a } ( int row , int col , int depth ,
int depth2 , int depth3 , int depth4 ) {
int texR = row ;
float texC = dot ( vec4 ( col , depth , depth2 , depth3 ) ,
vec4 ( $ { d } , $ { l } , $ { o } , $ { i } ) ) +
float ( depth4 ) ;
vec2 uv = ( vec2 ( texC , texR ) + halfCR ) /
vec2 ( $ { m } . 0 , $ { h } . 0 ) ;
return sampleTexture ( $ { n } , uv ) ;
}
` ;if(m===i&&p==null)return `
float $ { a } ( int row , int col , int depth ,
int depth2 , int depth3 , int depth4 ) {
float texR = dot ( vec4 ( row , col , depth , depth2 ) ,
vec4 ( $ { t [ 1 ] * t [ 2 ] * t [ 3 ] * t [ 4 ] } ,
$ { t [ 2 ] * t [ 3 ] * t [ 4 ] } ,
$ { t [ 3 ] * t [ 4 ] } ,
$ { t [ 4 ] } ) ) + float ( depth3 ) ;
int texC = depth4 ;
vec2 uv = ( vec2 ( texC , texR ) + halfCR ) /
vec2 ( $ { m } . 0 , $ { h } . 0 ) ;
return sampleTexture ( $ { n } , uv ) ;
}
` ;let f=Si(n);return `
float $ { a } ( int row , int col , int depth ,
int depth2 , int depth3 , int depth4 ) {
// Explicitly use integer operations as dot() only works on floats.
int index = row * $ { u } + col * $ { d } + depth * $ { l } +
depth2 * $ { o } + depth3 * $ { i } + depth4 + $ { f } ;
vec2 uv = uvFromFlat ( $ { h } , $ { m } , index ) ;
return sampleTexture ( $ { n } , uv ) ;
}
` }function Cl(e){let t=e.name,n=k.sizeFromShape(e.shapeInfo.logicalShape);return n<2? ` return $ { t } ; ` : `
for ( int i = 0 ; i < $ { n } ; i ++ ) {
if ( i == index ) {
return $ { t } [ i ] ;
}
}
` }function fL(e,t){let n=e.name,a=n.charAt(0).toUpperCase()+n.slice(1),r="get"+a+"AtOutCoords",s=e.shapeInfo.logicalShape.length,i=t.logicalShape.length,o=sv(e.shapeInfo.logicalShape,t.logicalShape),l=lt(i),d=i-s,u,p=["x","y","z","w","u","v"];s===0?u="":i<2&&o.length>=1?u="coords = 0;":u=o.map(A=> ` coords . $ { p [ A + d ] } = 0 ; ` ).join( `
` );let c="";i<2&&s>0?c="coords":c=e.shapeInfo.logicalShape.map((A,y)=> ` coords . $ { p [ y + d ] } ` ).join(", ");let h="return outputValue;",m=k.sizeFromShape(e.shapeInfo.logicalShape)===1,f=k.sizeFromShape(t.logicalShape)===1;if(s===1&&!m&&!f)h= `
return vec4 ( outputValue . xy , outputValue . xy ) ;
` ;else if(m&&!f)i===1?h= `
return vec4 ( outputValue . x , outputValue . x , 0. , 0. ) ;
` :h= `
return vec4 ( outputValue . x ) ;
` ;else if(o.length){let A=s-2,y=s-1;o.indexOf(A)>-1&&o.indexOf(y)>-1?h="return vec4(outputValue.x);":o.indexOf(A)>-1?h="return vec4(outputValue.x, outputValue.y, outputValue.x, outputValue.y);":o.indexOf(y)>-1&&(h="return vec4(outputValue.xx, outputValue.zz);")}return `
vec4 $ { r } ( ) {
$ { l } coords = getOutputCoords ( ) ;
$ { u }
vec4 outputValue = get$ { a } ( $ { c } ) ;
$ { h }
}
` }function mL(e,t){let n=e.name,a=n.charAt(0).toUpperCase()+n.slice(1),r="get"+a+"AtOutCoords",s=t.texShape,i=e.shapeInfo.texShape,o=e.shapeInfo.logicalShape.length,l=t.logicalShape.length;if(!e.shapeInfo.isUniform&&o===l&&e.shapeInfo.flatOffset==null&&k.arraysEqual(i,s))return `
float $ { r } ( ) {
return sampleTexture ( $ { n } , resultUV ) ;
}
` ;let d=lt(l),u=sv(e.shapeInfo.logicalShape,t.logicalShape),p=l-o,c,h=["x","y","z","w","u","v"];o===0?c="":l<2&&u.length>=1?c="coords = 0;":c=u.map(f=> ` coords . $ { h [ f + p ] } = 0 ; ` ).join( `
` );let m="";return l<2&&o>0?m="coords":m=e.shapeInfo.logicalShape.map((f,A)=> ` coords . $ { h [ A + p ] } ` ).join(", "), `
float $ { r } ( ) {
$ { d } coords = getOutputCoords ( ) ;
$ { c }
return get$ { a } ( $ { m } ) ;
}
` }function lt(e){if(e<=1)return"int";if(e===2)return"ivec2";if(e===3)return"ivec3";if(e===4)return"ivec4";if(e===5)return"ivec5";if(e===6)return"ivec6";throw Error( ` GPU for rank $ { e } is not yet supported ` )}function Rl(e,t){let n=JSON.parse(JSON.stringify(e));return n.shapeInfo.logicalShape=t,n}function Ml(e,t){return t.map(n=>e[n]).join(", ")}function CL(e,t,n,a){let r=t.userCode,s=n.map((h,m)=>{let f={logicalShape:h.shape,texShape:h.isUniform?null:h.texData.texShape,isUniform:h.isUniform,isPacked:h.isUniform?!1:h.texData.isPacked,flatOffset:null};return h.texData!=null&&h.texData.slice!=null&&h.texData.slice.flatOffset>0&&(f.flatOffset=h.texData.slice.flatOffset),{name:t.variableNames[m],shapeInfo:f}}),i=s.map(h=>h.shapeInfo),o={logicalShape:a.shape,texShape:a.texData.texShape,isUniform:!1,isPacked:a.texData.isPacked,flatOffset:null},l=tL(s,o,r,t.packedInputs),d=e.createProgram(l),u=null,p=e.getUniformLocation(d,"NAN",!1);J().getNumber("WEBGL_VERSION")===1&&(u=e.getUniformLocation(d,"INFINITY",!1));let c={};for(let h=0;h<t.variableNames.length;h++){let m=t.variableNames[h],f=!1;c[m]=e.getUniformLocation(d,m,f),c[ ` offset$ { m } ` ]=e.getUniformLocation(d, ` offset$ { m } ` ,f)}return{program:t,source:l,webGLProgram:d,uniformLocations:c,inShapeInfos:i,outShapeInfo:o,infLoc:u,nanLoc:p}}function lv(e,t){if(e.length!==t.length)throw Error( ` Binary was compiled with $ { e . length } inputs , but was executed with $ { t . length } inputs ` );e.forEach((n,a)=>{let r=n.logicalShape,s=t[a],i=s.shape;if(!k.arraysEqual(r,i))throw Error( ` Binary was compiled with different shapes than the current args . Shapes $ { r } and $ { i } must match ` );if(n.isUniform&&s.isUniform)return;let o=n.texShape,l=s.isUniform?null:s.texData.texShape;if(!k.arraysEqual(o,l))throw Error( ` Binary was compiled with different texture shapes than the current args . Shape $ { o } and $ { l } must match ` )})}function RL(e,t,n,a,r){lv(t.inShapeInfos,n),lv([t.outShapeInfo],[a]);let s=a.texData.texture,i=a.texData.texShape;a.texData.isPacked?e.setOutputPackedMatrixTexture(s,i[0],i[1]):e.setOutputMatrixTexture(s,i[0],i[1]),e.setProgram(t.webGLProgram),J().getNumber("WEBGL_VERSION")===1&&t.infLoc!==null&&e.gl.uniform1f(t.infLoc,Infinity),t.nanLoc!==null&&e.gl.uniform1f(t.nanLoc,NaN),n.forEach((o,l)=>{let d=t.program.variableNames[l],u=t.uniformLocations[d],p=t.uniformLocations[ ` offset$ { d } ` ];if(u!=null){if(o.isUniform){if(k.sizeFromShape(o.shape)<2)e.gl.uniform1f(u,o.uniformValues[0]);else{let c=o.uniformValues;c instanceof Float32Array||(c=new Float32Array(c)),e.gl.uniform1fv(u,c)}return}o.texData.slice!=null&&p!=null&&e.gl.uniform1i(p,o.texData.slice.flatOffset),e.setInputMatrixTexture(o.texData.texture,u,l)}}),r!=null&&r(e,t.webGLProgram),e.executeProgram()}function ML(e,t,n){let a="";t.concat(n).forEach(i=>{let o=i.texData!=null&&i.texData.slice!=null&&i.texData.slice.flatOffset>0,l=i.isUniform?"uniform":i.texData.texShape;a+= ` $ { i . shape } _$ { l } _$ { o } ` });let r=e.userCode,s=e.constructor.name;return s+="_"+a+"_"+r,s}var{addImpl:FL,bincountImpl:uv,bincountReduceImpl: $ L,ceilImpl:DL,concatImpl:OL,expImpl:zL,expm1Impl:_L,floorImpl:PL,gatherV2Impl:LL,greaterImpl:WL,lessImpl:BL,linSpaceImpl:VL,logImpl:jL,maxImpl:UL,maximumImpl:HL,minimumImpl:GL,multiplyImpl:qL,negImpl:XL,prodImpl:KL,rangeImpl:ZL,rsqrtImpl:YL,simpleAbsImpl:dv,sliceImpl:JL,sparseReshapeImpl:QL,stridedSliceImpl:eW,subImpl:tW,tileImpl:nW,topKImpl:aW,transposeImpl:c1,uniqueImpl:rW}=WA;function pv(e,t){return["x","y","z","w","u","v"].slice(0,t).map(n=> ` $ { e } . $ { n } ` )}function pn(e,t){return t===1?[e]:pv(e,t)}function sW(e,t){if(e===1)return"rc";let n="";for(let a=0;a<e;a++)n+=t[a],a<e-1&&(n+=",");return n}var uW=class{constructor(e){this.variableNames=["A"],this.packedInputs=!1,this.packedOutput=!0,this.outputShape=e;let t=e.length;if(t===0)this.userCode= `
void main ( ) {
setOutput ( vec4 ( getA ( ) , 0. , 0. , 0. ) ) ;
2021-04-28 14:55:26 +02:00
}
2021-04-28 14:58:21 +02:00
` ;else{let n=pn("rc",t),a=lt(t),r=iW(t,e,n),s=oW(t,e[e.length-1],e[e.length-2],n),i=lW(e,n);this.userCode= `
void main ( ) {
$ { a } rc = getOutputCoords ( ) ;
if ( $ { r } ) {
setOutput ( vec4 ( 0 ) ) ;
} else {
$ { s }
setOutput ( vec4 ( $ { i } ) ) ;
2021-04-15 21:01:27 +02:00
}
2021-03-29 21:01:16 +02:00
}
2021-04-28 14:58:21 +02:00
` }}};function dW(e,t){let n=[];for(let a=0;a<=1;a++)for(let r=0;r<=1;r++){let s= ` $ { a === 0 ? "r" : "rp1" } , $ { r === 0 ? "c" : "cp1" } ` ;for(let i=2;i<e;i++)s= ` $ { t [ t . length - 1 - i ] } , ` +s;n.push(s)}return n}function iW(e,t,n){if(e===1)return ` rc > $ { t [ 0 ] } ` ;let a="";for(let r=e-2;r<e;r++)a+= ` $ { n [ r ] } >= $ { t [ r ] } ` ,r<e-1&&(a+="||");return a}function oW(e,t,n,a){if(e===1)return"";let r=a.slice(-2);return `
int r = $ { r [ 0 ] } ;
int c = $ { r [ 1 ] } ;
int rp1 = r + 1 ;
int cp1 = c + 1 ;
bool cEdge = cp1 >= $ { t } ;
bool rEdge = rp1 >= $ { n } ;
` }function lW(e,t){let n=e.length,a=dW(n,t);return n===1? ` getA ( rc ) ,
rc + 1 >= $ { e [ 0 ] } ? 0. : getA ( rc + 1 ) ,
0 , 0 ` : ` getA ( $ { a [ 0 ] } ) ,
cEdge ? 0. : getA ( $ { a [ 1 ] } ) ,
rEdge ? 0. : getA ( $ { a [ 2 ] } ) ,
rEdge || cEdge ? 0. : getA ( $ { a [ 3 ] } ) ` }var cv=class{constructor(e,t){this.variableNames=["A"],this.packedInputs=!0,this.packedOutput=!0,this.outputShape=e;let n="";for(let a=0;a<4;a++){let r="thisRC = rc;";a%2==1&&(r+="thisRC.z += 1;"),a>1&&(r+="thisRC.y += 1;"),n+= `
$ { r }
$ { a > 0 ? "if(thisRC.y < rows && thisRC.z < cols){" : "" }
int flatIndex = getFlatIndex ( thisRC ) ;
ivec3 inputRC = inputCoordsFromReshapedOutCoords ( flatIndex ) ;
vec2 inputRCInnerDims = vec2 ( float ( inputRC . y ) , float ( inputRC . z ) ) ;
result [ $ { a } ] =
getChannel ( getA ( inputRC . x , inputRC . y , inputRC . z ) , inputRCInnerDims ) ;
$ { a > 0 ? "}" : "" }
` }this.userCode= `
$ { pW ( t ) }
$ { i1 ( e ) }
void main ( ) {
ivec3 rc = getOutputCoords ( ) ;
vec4 result = vec4 ( 0. ) ;
ivec3 thisRC ;
int rows = $ { e [ 1 ] } ;
int cols = $ { e [ 2 ] } ;
$ { n }
setOutput ( result ) ;
}
` }};function pW(e){return `
ivec3 inputCoordsFromReshapedOutCoords ( int index ) {
$ { Ii ( [ "r" , "c" , "d" ] , e ) }
return ivec3 ( r , c , d ) ;
}
` }var cW=class{constructor(e){this.gpgpu=e,this.numUsedTextures=0,this.numFreeTextures=0,this._numBytesAllocated=0,this._numBytesFree=0,this.freeTextures={},this.logEnabled=!1,this.usedTextures={}}acquireTexture(e,t,n){let a=fv(t,n),r=mv(e,a,n);r in this.freeTextures||(this.freeTextures[r]=[]),r in this.usedTextures||(this.usedTextures[r]=[]);let s=hv(e,a,this.gpgpu.gl,this.gpgpu.textureConfig,n);if(this.freeTextures[r].length>0){this.numFreeTextures--,this.numUsedTextures++,this._numBytesFree-=s,this.log();let o=this.freeTextures[r].shift();return this.usedTextures[r].push(o),o}let i;return a===Qt.PACKED_2X2_FLOAT32?i=this.gpgpu.createPackedMatrixTexture(e[0],e[1]):a===Qt.PACKED_2X2_FLOAT16?i=this.gpgpu.createFloat16PackedMatrixTexture(e[0],e[1]):a===Qt.UNPACKED_FLOAT32?i=this.gpgpu.createFloat32MatrixTexture(e[0],e[1]):a===Qt.UNPACKED_FLOAT16?i=this.gpgpu.createFloat16MatrixTexture(e[0],e[1]):a===Qt.PACKED_4X1_UNSIGNED_BYTE&&(i=this.gpgpu.createUnsignedBytesMatrixTexture(e[0],e[1])),this.usedTextures[r].push(i),this.numUsedTextures++,this._numBytesAllocated+=s,this.log(),i}releaseTexture(e,t,n,a){if(this.freeTextures==null)return;let r=fv(n,a),s=mv(t,r,a);s in this.freeTextures||(this.freeTextures[s]=[]);let i=hv(t,r,this.gpgpu.gl,this.gpgpu.textureConfig,a),o=J().get("WEBGL_DELETE_TEXTURE_THRESHOLD");o!==-1&&this._numBytesAllocated>o?(this.gpgpu.deleteMatrixTexture(e),this._numBytesAllocated-=i):(this.freeTextures[s].push(e),this.numFreeTextures++,this._numBytesFree+=i),this.numUsedTextures--;let l=this.usedTextures[s],d=l.indexOf(e);if(d<0)throw new Error("Cannot release a texture that was never provided by this texture manager");l.splice(d,1),this.log()}log(){if(!this.logEnabled)return;let e=this.numFreeTextures+this.numUsedTextures;console.log("Free/Used", ` $ { this . numFreeTextures } / $ { this . numUsedTextures } ` , ` ( $ { e } ) ` );let t=this._numBytesFree/this._numBytesAllocated;console.log( ` Bytes allocated : $ { this . _numBytesAllocated } ` ),console.log( ` Bytes unused : $ { this . _numBytesFree } ( $ { Math . round ( 100 * t ) } % ) ` )}get numBytesAllocated(){return this._numBytesAllocated}get numBytesFree(){return this._numBytesFree}getNumUsedTextures(){return this.numUsedTextures}getNumFreeTextures(){return this.numFreeTextures}dispose(){if(this.freeTextures!=null){for(let e in this.freeTextures)this.freeTextures[e].forEach(t=>{this.gpgpu.deleteMatrixTexture(t)});for(let e in this.usedTextures)this.usedTextures[e].forEach(t=>{this.gpgpu.deleteMatrixTexture(t)});this.freeTextures=null,this.usedTextures=null,this.numUsedTextures=0,this.numFreeTextures=0,this._numBytesAllocated=0,this._numBytesFree=0}}};function hW(e,t){let n=e;if(t===n.R32F)return 4;if(t===n.R16F)return 2;if(t===n.RGBA32F||t===e.RGBA)return 16;if(t===n.RGBA16F)return 8;throw new Error( ` Unknown internal format $ { t } ` )}function hv(e,t,n,a,r){let s=fW(t,a),i;if(r){let[l,d]=Tl(e[0],e[1]);i=l*d}else{let[l,d]=pd(e[0],e[1]);i=l*d}let o=hW(n,s);return i*o}function fW(e,t){switch(e){case Qt.PACKED_2X2_FLOAT32:return d1(t);case Qt.PACKED_2X2_FLOAT16:return p1(t);case Qt.UNPACKED_FLOAT32:return o1(t);case Qt.UNPACKED_FLOAT16:return l1(t);case Qt.PACKED_4X1_UNSIGNED_BYTE:return u1(t);default:throw new Error( ` Unknown physical texture type $ { e } ` )}}function mW(e){return J().getBool("WEBGL_RENDER_FLOAT32_ENABLED")?e?Qt.PACKED_2X2_FLOAT32:Qt.UNPACKED_FLOAT32:e?Qt.PACKED_2X2_FLOAT16:Qt.UNPACKED_FLOAT16}function fv(e,t){if(e===Yn.UPLOAD)return Qt.PACKED_2X2_FLOAT32;if(e===Yn.RENDER||e==null)return mW(t);if(e===Yn.DOWNLOAD||e===Yn.PIXELS)return Qt.PACKED_4X1_UNSIGNED_BYTE;throw new Error( ` Unknown logical texture type $ { e } ` )}function mv(e,t,n){return ` $ { e [ 0 ] } _$ { e [ 1 ] } _$ { t } _$ { n } ` }var Pr=class{constructor(e,t){this.variableNames=["A"],this.outputShape=e,this.userCode= `
float unaryOperation ( float x ) {
$ { t }
}
void main ( ) {
float x = getAAtOutCoords ( ) ;
float y = unaryOperation ( x ) ;
setOutput ( y ) ;
}
` }},ba="if (isnan(x)) return x;",AW="return x;",Av="return abs(x);",yW="return (x >= 0.0) ? x : (exp(x) - 1.0);",gW=ba+ `
return ( x < 0.0 ) ? 0.0 : x ;
` ,xW=ba+ `
return ( x < 0.0 ) ? 0.0 : min ( 6.0 , x ) ;
` ,fh="return x;",bW="return 1.0 / (1.0 + exp(-1.0 * x));",vW="return x;",wW= `
vec4 result ;
result . r = ( x . r >= 0.0 ) ? x . r : ( exp ( x . r ) - 1.0 ) ;
result . g = ( x . g >= 0.0 ) ? x . g : ( exp ( x . g ) - 1.0 ) ;
result . b = ( x . b >= 0.0 ) ? x . b : ( exp ( x . b ) - 1.0 ) ;
result . a = ( x . a >= 0.0 ) ? x . a : ( exp ( x . a ) - 1.0 ) ;
return result ;
` ,kW= `
vec4 result = x * vec4 ( greaterThanEqual ( x , vec4 ( 0.0 ) ) ) ;
bvec4 isNaN = isnan ( x ) ;
result . r = isNaN . r ? x . r : result . r ;
result . g = isNaN . g ? x . g : result . g ;
result . b = isNaN . b ? x . b : result . b ;
result . a = isNaN . a ? x . a : result . a ;
return result ;
` ,IW= `
vec4 result = min ( x , vec4 ( 6. ) ) * vec4 ( greaterThanEqual ( x , vec4 ( 0.0 ) ) ) ;
bvec4 isNaN = isnan ( x ) ;
result . r = isNaN . r ? x . r : result . r ;
result . g = isNaN . g ? x . g : result . g ;
result . b = isNaN . b ? x . b : result . b ;
result . a = isNaN . a ? x . a : result . a ;
return result ;
` ,SW="return 1.0 / (1.0 + exp(-1.0 * x));",Fl=class{constructor(e,t){this.variableNames=["A"],this.packedInputs=!0,this.packedOutput=!0,this.outputShape=e,this.userCode= `
vec4 unaryOperation ( vec4 x ) {
$ { t }
}
void main ( ) {
vec4 x = getAAtOutCoords ( ) ;
vec4 y = unaryOperation ( x ) ;
setOutput ( y ) ;
}
` }},NW=class{constructor(e){this.variableNames=["A"],this.packedInputs=!0,this.packedOutput=!1,this.outputShape=e;let t=e.length,n=pn("rc",t),a=lt(t),r=sW(t,n),s=n.slice(-2),i=t<=1?"rc": ` vec2 ( $ { s . join ( "," ) } ) ` ;this.userCode= `
void main ( ) {
$ { a } rc = getOutputCoords ( ) ;
vec4 packedInput = getA ( $ { r } ) ;
setOutput ( getChannel ( packedInput , $ { i } ) ) ;
}
` }},TW=Wa.whereImpl,EW=1e-7,CW=1e-4,h1={};function RW(e){return e in h1||(h1[e]={}),h1[e]}var MW=128,FW=600;function $ W(){return J().global.screen==null?1024:J().global.screen.height*J().global.screen.width*window.devicePixelRatio*FW/1024/1024}var $ l=class extends du{constructor(e){super();if(this.pendingRead=new WeakMap,this.pendingDisposal=new WeakSet,this.dataRefCount=new WeakMap,this.numBytesInGPU=0,this.uploadWaitMs=0,this.downloadWaitMs=0,this.lastGlFlushTime=0,this.warnedAboutMemory=!1,this.pendingDeletes=0,this.disposed=!1,!J().getBool("HAS_WEBGL"))throw new Error("WebGL is not supported on this device");if(e==null){let t=Va(J().getNumber("WEBGL_VERSION"));this.binaryCache=RW(J().getNumber("WEBGL_VERSION")),this.gpgpu=new hh(t),this.canvas=t.canvas,this.gpgpuCreatedLocally=!0}else this.gpgpu=e,this.binaryCache={},this.gpgpuCreatedLocally=!1,this.canvas=e.gl.canvas;this.textureManager=new cW(this.gpgpu),this.numMBBeforeWarning= $ W(),this.texData=new wp(this,nr())}nextDataId(){return $ l.nextDataId++}numDataIds(){return this.texData.numDataIds()-this.pendingDeletes}write(e,t,n){if((J().getBool("WEBGL_CHECK_NUMERICAL_PROBLEMS")||J().getBool("DEBUG"))&&this.checkNumericalProblems(e),n==="complex64"&&e!=null)throw new Error("Cannot write to a complex64 dtype. Please use tf.complex(real, imag).");let a={id:this.nextDataId()};return this.texData.set(a,{shape:t,dtype:n,values:e,usage:Yn.UPLOAD,refCount:1}),a}refCount(e){return this.texData.has(e)?this.texData.get(e).refCount:0}incRef(e){let t=this.texData.get(e);t.refCount++}decRef(e){if(this.texData.has(e)){let t=this.texData.get(e);t.refCount--}}move(e,t,n,a,r){if(J().getBool("DEBUG")&&this.checkNumericalProblems(t),a==="complex64")throw new Error("Cannot write to a complex64 dtype. Please use tf.complex(real, imag).");this.texData.set(e,{shape:n,dtype:a,values:t,usage:Yn.UPLOAD,refCount:r})}disposeIntermediateTensorInfo(e){this.disposeData(e.dataId)}readSync(e){let t=this.texData.get(e),{values:n,dtype:a,complexTensorInfos:r,slice:s,shape:i,isPacked:o}=t;if(s!=null){let p;o?p=new Fl(i,fh):p=new Pr(i,fh);let c=this.runWebGLProgram(p,[{dataId:e,shape:i,dtype:a}],a),h=this.readSync(c.dataId);return this.disposeIntermediateTensorInfo(c),h}if(n!=null)return this.convertAndCacheOnCPU(e);if(a==="string")return n;let l=this.activeTimers!=null,d;l&&(d=k.now());let u;if(a==="complex64"){let p=this.readSync(r.real.dataId),c=this.readSync(r.imag.dataId);u=C.mergeRealAndImagArrays(p,c)}else u=this.getValuesFromTexture(e);return l&&(this.downloadWaitMs+=k.now()-d),this.convertAndCacheOnCPU(e,u)}async read(e){if(this.pendingRead.has(e)){let h=this.pendingRead.get(e);return new Promise(m=>h.push(m))}let t=this.texData.get(e),{values:n,shape:a,slice:r,dtype:s,complexTensorInfos:i,isPacked:o}=t;if(r!=null){let h;o?h=new Fl(a,fh):h=new Pr(a,fh);let m=this.runWebGLProgram(h,[{dataId:e,shape:a,dtype:s}],s),f=this.read(m.dataId);return this.disposeIntermediateTensorInfo(m),f}if(n!=null)return this.convertAndCacheOnCPU(e);if(!J().getBool("WEBGL_DOWNLOAD_FLOAT_ENABLED")&&J().getNumber("WEBGL_VERSION")===2)throw new Error("tensor.data() with WEBGL_DOWNLOAD_FLOAT_ENABLED=false and WEBGL_VERSION=2 not yet supported.");let l=null,d;if(s!=="complex64"&&J().get("WEBGL_BUFFER_SUPPORTED")){d=this.decode(e);let h=this.texData.get(d.dataId);l=this.gpgpu.createBufferFromTexture(h.texture,...cd(a))}this.pendingRead.set(e,[]),s!=="complex64"&&await this.gpgpu.createAndWaitForFence();let u;if(s==="complex64"){let h=await Promise.all([this.read(i.real.dataId),this.read(i.imag.dataId)]),m=h[0],f=h[1];u=C.mergeRealAndImagArrays(m,f)}else if(l==null)u=this.getValuesFromTexture(e);else{let h=k.sizeFromShape(a);u=this.gpgpu.downloadFloat32MatrixFromBuffer(l,h)}d!=null&&this.disposeIntermediateTensorInfo(d);let p=this.convertAndCacheOnCPU(e,u),c=this.pendingRead.get(e);return this.pendingRead.delete(e),c.forEach(h=>h(p)),this.pendingDisposal.has(e)&&(this.pendingDisposal.delete(e),this.disposeData(e)&&nr().removeDataId(e,this),this.pendingDeletes--),p}bufferSync(e){let t=this.readSync(e.dataId),n=t;if(e.dtype
if ( isnan ( a ) ) return a ;
if ( isnan ( b ) ) return b ;
` ,Dl=class{constructor(e,t,n){this.variableNames=["A","B"],this.outputShape=C.assertAndGetBroadcastShape(t,n),this.userCode= `
float binaryOperation ( float a , float b ) {
$ { e }
}
void main ( ) {
float a = getAAtOutCoords ( ) ;
float b = getBAtOutCoords ( ) ;
setOutput ( binaryOperation ( a , b ) ) ;
}
` }},mh= `
result . r = isNaN . r > 0. ? NAN : result . r ;
result . g = isNaN . g > 0. ? NAN : result . g ;
result . b = isNaN . b > 0. ? NAN : result . b ;
result . a = isNaN . a > 0. ? NAN : result . a ;
` ,fd=class{constructor(e,t,n,a=!1){this.variableNames=["A","B"],this.supportsBroadcasting=!0,this.packedInputs=!0,this.packedOutput=!0,this.outputShape=C.assertAndGetBroadcastShape(t,n);let r=this.outputShape.length,s="";if(a)if(r===0||k.sizeFromShape(this.outputShape)===1)s= `
result . y = 0. ;
result . z = 0. ;
result . w = 0. ;
` ;else if(s= `
$ { lt ( r ) } coords = getOutputCoords ( ) ;
` ,r===1)s+= `
result . y = ( coords + 1 ) >= $ { this . outputShape [ 0 ] } ? 0. : result . y ;
result . z = 0. ;
result . w = 0. ;
` ;else{let i=pn("coords",r);s+= `
bool nextRowOutOfBounds =
( $ { i [ r - 2 ] } + 1 ) >= $ { this . outputShape [ r - 2 ] } ;
bool nextColOutOfBounds =
( $ { i [ r - 1 ] } + 1 ) >= $ { this . outputShape [ r - 1 ] } ;
result . y = nextColOutOfBounds ? 0. : result . y ;
result . z = nextRowOutOfBounds ? 0. : result . z ;
result . w = nextColOutOfBounds || nextRowOutOfBounds ? 0. : result . w ;
` }this.userCode= `
vec4 binaryOperation ( vec4 a , vec4 b ) {
$ { e }
}
void main ( ) {
vec4 a = getAAtOutCoords ( ) ;
vec4 b = getBAtOutCoords ( ) ;
vec4 result = binaryOperation ( a , b ) ;
$ { s }
setOutput ( result ) ;
}
` }};function Pn(e){let{inputs:t,backend:n}=e,{x:a}=t;return n.incRef(a.dataId),{dataId:a.dataId,shape:a.shape,dtype:a.dtype}}var zW={kernelName:ks,backendName:"webgl",kernelFunc:Pn};function Lr(e){let{inputs:t,backend:n}=e,{real:a,imag:r}=t,s=n.makeTensorInfo(a.shape,"complex64"),i=n.texData.get(s.dataId),o=Pn({inputs:{x:a},backend:n}),l=Pn({inputs:{x:r},backend:n});return i.complexTensorInfos={real:o,imag:l},s}var _W={kernelName:Cp,backendName:"webgl",kernelFunc:Lr},bv="return (a < 0.) ? b * a : a;",vv= `
vec4 aLessThanZero = vec4 ( lessThan ( a , vec4 ( 0. ) ) ) ;
return ( aLessThanZero * ( b * a ) ) + ( ( vec4 ( 1.0 ) - aLessThanZero ) * a ) ;
` ;function PW(e){let{inputs:t,backend:n,attrs:a}=e,{x:r}=t,{alpha:s}=a,i=n.makeTensorInfo([],"float32",k.createScalarValue(s,"float32")),o=J().getBool("WEBGL_PACK_BINARY_OPERATIONS")?new fd(vv,r.shape,i.shape):new Dl(bv,r.shape,i.shape),l=n.runWebGLProgram(o,[r,i],r.dtype);return n.disposeIntermediateTensorInfo(i),l}var LW={kernelName:Is,backendName:"webgl",kernelFunc:PW},wv="return (a < 0.) ? b * a : a;",kv= `
vec4 aLessThanZero = vec4 ( lessThan ( a , vec4 ( 0. ) ) ) ;
return ( aLessThanZero * ( b * a ) ) + ( ( vec4 ( 1.0 ) - aLessThanZero ) * a ) ;
` ;function WW(e){let{inputs:t,backend:n}=e,{x:a,alpha:r}=t,s=J().getBool("WEBGL_PACK_BINARY_OPERATIONS")?new fd(kv,a.shape,r.shape):new Dl(wv,a.shape,r.shape);return n.runWebGLProgram(s,[a,r],a.dtype)}var BW={kernelName:_s,backendName:"webgl",kernelFunc:WW},Iv="if (isnan(x)) return x;",VW= `
if ( isnan ( a ) ) return a ;
if ( isnan ( b ) ) return b ;
` ,jW= `
result . r = isNaN . r > 0. ? NAN : result . r ;
result . g = isNaN . g > 0. ? NAN : result . g ;
result . b = isNaN . b > 0. ? NAN : result . b ;
result . a = isNaN . a > 0. ? NAN : result . a ;
` ;function qe({opSnippet:e,packedOpSnippet:t,cpuKernelImpl:n,dtype:a}){return({inputs:r,backend:s})=>{let{x:i}=r,o=s,l=a||i.dtype;if(o.shouldExecuteOnCPU([i])&&n!=null){let p=o.texData.get(i.dataId),c=n(p.values,l);return o.makeTensorInfo(i.shape,l,c)}let d=J().getBool("WEBGL_PACK_UNARY_OPERATIONS")&&t!=null,u;return d?u=new Fl(i.shape,t):u=new Pr(i.shape,e),o.runWebGLProgram(u,[i],l)}}function en({opSnippet:e,packedOpSnippet:t,checkOutOfBounds:n=!1,supportsComplex:a=!1,cpuKernelImpl:r,dtype:s}){return({inputs:i,backend:o})=>{let{a:l,b:d}=i,u=o;if(a&&l.dtype==="complex64"){let m=u.texData.get(l.dataId),f=u.texData.get(d.dataId),[A,y]=[[m.complexTensorInfos.real,f.complexTensorInfos.real],[m.complexTensorInfos.imag,f.complexTensorInfos.imag]].map(x=>{let[w,b]=x,v={dataId:w.dataId,dtype:w.dtype,shape:l.shape},I={dataId:b.dataId,dtype:b.dtype,shape:d.shape},T=new Dl(e,l.shape,d.shape);return u.runWebGLProgram(T,[v,I],sa(w.dtype,b.dtype))}),g=Lr({inputs:{real:A,imag:y},backend:u});return u.disposeIntermediateTensorInfo(A),u.disposeIntermediateTensorInfo(y),g}let p=s||sa(l.dtype,d.dtype);if(u.shouldExecuteOnCPU([l,d])&&r!=null){let m=u.texData.get(l.dataId),f=u.texData.get(d.dataId),[A,y]=r(l.shape,d.shape,m.values,f.values,p),g=u.makeTensorInfo(y,p),x=u.texData.get(g.dataId);return x.values=A,g}let c=J().getBool("WEBGL_PACK_BINARY_OPERATIONS")&&t!=null,h;return c?h=new fd(t,l.shape,d.shape,n):h=new Dl(e,l.shape,d.shape),u.runWebGLProgram(h,[l,d],p)}}function Ah(e,t=!1){if(e==="linear")return t?vW:AW;if(e==="relu")return t?kW:gW;if(e==="elu")return t?wW:yW;if(e==="relu6")return t?IW:xW;if(e==="prelu")return t?kv:wv;if(e==="leakyrelu")return t?vv:bv;if(e==="sigmoid")return t?SW:bW;throw new Error( ` Activation $ { e } has not been implemented for the WebGL backend . ` )}var Sv=class{constructor(e,t,n,a=!1,r=!1,s=!1,i=null,o=!1,l=!1){this.variableNames=["matrixA","matrixB"],this.packedInputs=!0,this.packedOutput=!0,this.outputShape=n;let d=a?e[1]:e[2],u=Math.ceil(d/2),p=a?"i * 2, rc.y":"rc.y, i * 2",c=r?"rc.z, i * 2":"i * 2, rc.z",h=a?["a.xxyy","a.zzww"]:["a.xxzz","a.yyww"],m=r?["b.xzxz","b.ywyw"]:["b.xyxy","b.zwzw"],f="",A="";i&&(o?f= ` vec4 activation ( vec4 a ) {
vec4 b = getPreluActivationWeightsAtOutCoords ( ) ;
$ { i }
} ` :l?f= ` vec4 activation ( vec4 a ) {
vec4 b = getLeakyreluAlphaAtOutCoords ( ) ;
$ { i }
} ` :f= ` vec4 activation ( vec4 x ) {
$ { i }
} ` ,A="result = activation(result);");let y=s?"result += getBiasAtOutCoords();":"";s&&this.variableNames.push("bias"),o&&this.variableNames.push("preluActivationWeights"),l&&this.variableNames.push("leakyreluAlpha");let g="rc.x",x="rc.x";e[0]<t[0]?g= ` int ( min ( float ( rc . x ) , $ { e [ 0 ] - 1 } . ) ) ` :t[0]<e[0]&&(x= ` int ( min ( float ( rc . x ) , $ { t [ 0 ] - 1 } . ) ) ` ),this.userCode= `
$ { f }
const float sharedDimension = $ { u } . 0 ;
vec4 dot2x2ARowBCol ( ivec3 rc ) {
vec4 result = vec4 ( 0 ) ;
for ( int i = 0 ; i < $ { u } ; i ++ ) {
int batchA = $ { g } ;
int batchB = $ { x } ;
vec4 a = getMatrixA ( batchA , $ { p } ) ;
vec4 b = getMatrixB ( batchB , $ { c } ) ;
// These swizzled products need to be separately added.
// See: https://github.com/tensorflow/tfjs/issues/1735
result += ( $ { h [ 0 ] } * $ { m [ 0 ] } ) ;
result += ( $ { h [ 1 ] } * $ { m [ 1 ] } ) ;
2021-04-19 22:02:47 +02:00
}
2021-04-28 14:58:21 +02:00
return result ;
}
void main ( ) {
ivec3 rc = getOutputCoords ( ) ;
vec4 result = dot2x2ARowBCol ( rc ) ;
$ { y }
$ { A }
setOutput ( result ) ;
}
` }},Nv={REAL:"return areal * breal - aimag * bimag;",IMAG:"return areal * bimag + aimag * breal;"},Tv=class{constructor(e,t,n){this.variableNames=["AReal","AImag","BReal","BImag"],this.outputShape=C.assertAndGetBroadcastShape(t,n),this.userCode= `
float binaryOpComplex (
float areal , float aimag , float breal , float bimag ) {
$ { e }
}
void main ( ) {
float areal = getARealAtOutCoords ( ) ;
float aimag = getAImagAtOutCoords ( ) ;
float breal = getBRealAtOutCoords ( ) ;
float bimag = getBImagAtOutCoords ( ) ;
setOutput ( binaryOpComplex ( areal , aimag , breal , bimag ) ) ;
}
` }},Ev="return a * b;";function f1(e){let{inputs:t,backend:n}=e,{a,b:r}=t,s=C.upcastType(a.dtype,r.dtype);if(a.dtype==="complex64"){let o=n.texData.get(a.dataId),l=n.texData.get(r.dataId),d=new Tv(Nv.REAL,a.shape,r.shape),u=new Tv(Nv.IMAG,a.shape,r.shape),p=[{dataId:o.complexTensorInfos.real.dataId,dtype:o.complexTensorInfos.real.dtype,shape:a.shape},{dataId:o.complexTensorInfos.imag.dataId,dtype:o.complexTensorInfos.imag.dtype,shape:a.shape},{dataId:l.complexTensorInfos.real.dataId,dtype:l.complexTensorInfos.real.dtype,shape:r.shape},{dataId:l.complexTensorInfos.imag.dataId,dtype:l.complexTensorInfos.imag.dtype,shape:r.shape}],c=n.runWebGLProgram(d,p,"float32"),h=n.runWebGLProgram(u,p,"float32"),m=Lr({inputs:{real:c,imag:h},backend:n});return n.disposeIntermediateTensorInfo(c),n.disposeIntermediateTensorInfo(h),m}if(n.shouldExecuteOnCPU([a,r])){let o=n.texData.get(a.dataId),l=n.texData.get(r.dataId),[d,u]=qL(a.shape,r.shape,o.values,l.values,s),p=n.makeTensorInfo(u,s),c=n.texData.get(p.dataId);return c.values=d,p}let i;return J().getBool("WEBGL_PACK_BINARY_OPERATIONS")?i=new fd(Ev,a.shape,r.shape):i=new Dl(Ev,a.shape,r.shape),n.runWebGLProgram(i,[a,r],s)}var UW={kernelName: $ s,backendName:"webgl",kernelFunc:f1};function HW(e,t,n){let a=[vi(e.shape),...wi(e.shape)],r={dtype:e.dtype,shape:a,dataId:e.dataId},s=[vi(t),...wi(t)],i=new cv(s,a),o=!0,l=n.runWebGLProgram(i,[r],e.dtype,null,o);return{dataId:l.dataId,shape:t,dtype:l.dtype}}function fe(e){let{inputs:t,backend:n,attrs:a}=e,{x:r}=t,{shape:s}=a,i=n,o=k.sizeFromShape(r.shape),l=k.inferFromImplicitShape(s,o),d=k.sizeFromShape(l);k.assert(o===d,()=> ` The new shape ( $ { l } ) has $ { d } elements and the old shape ( $ { r . shape } ) has $ { o } elements . The new shape and old shape must have the same number of elements . ` );let u=i.texData.get(r.dataId);return u.isPacked&&!ud(r.shape,l)&&!(u.texture!==null&&ud(u.shape,l))?HW(r,l,i):(i.incRef(r.dataId),{dataId:r.dataId,shape:l,dtype:r.dtype})}var GW={kernelName:Bo,backendName:"webgl",kernelFunc:fe},Cv=class{constructor(e,t){this.variableNames=["x"];let{windowSize:n,batchSize:a,inSize:r,outSize:s}=e;this.outputShape=[a,s];let i=Math.floor(n/4)*4,o=n%4,l="sumValue += dot(values, ones);";if(t!=null){let u=1/t;l= ` sumValue += dot ( values * $ { k . isInt ( u ) ? u . toPrecision ( 2 ) : u } , ones ) ; ` }let d="";r%n>0&&(d= `
if ( inIdx < 0 || inIdx >= $ { r } ) {
return 0.0 ;
2021-04-15 21:01:27 +02:00
}
2021-04-28 14:58:21 +02:00
` ),this.userCode= `
const vec4 ones = vec4 ( 1.0 , 1.0 , 1.0 , 1.0 ) ;
float getValue ( int batch , int inIdx ) {
$ { d }
return getX ( batch , inIdx ) ;
}
void main ( ) {
ivec2 coords = getOutputCoords ( ) ;
int batch = coords [ 0 ] ;
int outIdx = coords [ 1 ] ;
int inOffset = outIdx * $ { n } ;
float sumValue = 0.0 ;
for ( int i = 0 ; i < $ { i } ; i += 4 ) {
int inIdx = inOffset + i ;
vec4 values = vec4 (
getValue ( batch , inIdx ) ,
getValue ( batch , inIdx + 1 ) ,
getValue ( batch , inIdx + 2 ) ,
getValue ( batch , inIdx + 3 )
) ;
$ { l }
2021-03-30 15:03:18 +02:00
}
2021-04-28 14:58:21 +02:00
int inIdx = inOffset + $ { i } ;
if ( $ { o === 1 } ) {
vec4 values = vec4 ( getValue ( batch , inIdx ) , 0.0 , 0.0 , 0.0 ) ;
$ { l }
} else if ( $ { o === 2 } ) {
vec4 values = vec4 (
getValue ( batch , inIdx ) ,
getValue ( batch , inIdx + 1 ) , 0.0 , 0.0 ) ;
$ { l }
} else if ( $ { o === 3 } ) {
vec4 values = vec4 (
getValue ( batch , inIdx ) ,
getValue ( batch , inIdx + 1 ) ,
getValue ( batch , inIdx + 2 ) , 0.0 ) ;
$ { l }
2021-04-28 14:55:26 +02:00
}
2021-04-28 14:58:21 +02:00
setOutput ( sumValue ) ;
}
` }},qW=class{constructor(e,t){this.variableNames=["x"];let{windowSize:n,batchSize:a,inSize:r,outSize:s}=e;this.outputShape=[a,s];let i="0.0",o="";t==="prod"?i="1.0":t==="min"?(i="1.0 / 1e-20",o="min"):t==="max"&&(i="-1.0 / 1e-20",o="max");let l= ` $ { t } ( $ { t } ( $ { t } ( minMaxValue [ 0 ] , minMaxValue [ 1 ] ) , minMaxValue [ 2 ] ) , minMaxValue [ 3 ] ) ` ;t==="sum"?l="sumValue":t==="prod"?l="prodValue":t==="all"?l="allValue":t==="any"&&(l="anyValue");let d=Math.floor(n/4)*4,u=n%4,p= `
if ( $ { t === "sum" } ) {
sumValue += dot ( values , ones ) ;
} else if ( $ { t === "prod" } ) {
vec2 tmp = vec2 ( values [ 0 ] , values [ 1 ] ) * vec2 ( values [ 2 ] , values [ 3 ] ) ;
prodValue *= tmp [ 0 ] * tmp [ 1 ] ;
} else {
minMaxValue = $ { o } ( values , minMaxValue ) ;
}
` ,c="vec4";t==="all"?(i="1.0",p= `
bool reducedAllValue = all ( values ) ;
float floatedReducedAllValue = float ( reducedAllValue ) ;
allValue = float ( allValue >= 1.0 && floatedReducedAllValue >= 1.0 ) ;
` ,c="bvec4"):t==="any"&&(i="0.0",p= `
bool reducedAnyValue = any ( values ) ;
float floatedReducedAnyValue = float ( reducedAnyValue ) ;
anyValue = float ( anyValue >= 1.0 || floatedReducedAnyValue >= 1.0 ) ;
` ,c="bvec4");let h="";r%n>0&&(h= `
if ( inIdx < 0 || inIdx >= $ { r } ) {
return initializationValue ;
2021-04-28 14:55:26 +02:00
}
2021-04-28 14:58:21 +02:00
` ),this.userCode= `
const float initializationValue = $ { i } ;
const vec4 ones = vec4 ( 1.0 , 1.0 , 1.0 , 1.0 ) ;
float getValue ( int batch , int inIdx ) {
$ { h }
return getX ( batch , inIdx ) ;
}
void main ( ) {
ivec2 coords = getOutputCoords ( ) ;
int batch = coords [ 0 ] ;
int outIdx = coords [ 1 ] ;
int inOffset = outIdx * $ { n } ;
vec4 minMaxValue = vec4 ( $ { i } ) ;
float prodValue = 1.0 ;
float sumValue = 0.0 ;
float allValue = 1.0 ;
float anyValue = 0.0 ;
for ( int i = 0 ; i < $ { d } ; i += 4 ) {
int inIdx = inOffset + i ;
$ { c } values = $ { c } (
getValue ( batch , inIdx ) ,
getValue ( batch , inIdx + 1 ) ,
getValue ( batch , inIdx + 2 ) ,
getValue ( batch , inIdx + 3 )
) ;
$ { p }
2021-04-28 14:55:26 +02:00
}
2021-04-28 14:58:21 +02:00
int inIdx = inOffset + $ { d } ;
if ( $ { u === 1 } ) {
$ { c } values = $ { c } (
getValue ( batch , inIdx ) ,
initializationValue ,
initializationValue ,
initializationValue
) ;
$ { p }
} else if ( $ { u === 2 } ) {
$ { c } values = $ { c } (
getValue ( batch , inIdx ) ,
getValue ( batch , inIdx + 1 ) ,
initializationValue ,
initializationValue
) ;
$ { p }
} else if ( $ { u === 3 } ) {
$ { c } values = $ { c } (
getValue ( batch , inIdx ) ,
getValue ( batch , inIdx + 1 ) ,
getValue ( batch , inIdx + 2 ) ,
initializationValue
) ;
$ { p }
2021-04-28 14:55:26 +02:00
}
2021-04-28 14:58:21 +02:00
setOutput ( $ { l } ) ;
}
` }};function XW(e){let t=[];for(;t.length===0||t[t.length-1].outSize!==1;){let n=t.length?t[t.length-1].outSize:e[1],a=C.computeOptimalWindowSize(n);t.push({inSize:n,windowSize:a,outSize:Math.ceil(n/a)})}return t}function Ni(e,t,n,a){let r=XW(e.shape),s=e;for(let i=0;i<r.length;i++){let{inSize:o,windowSize:l,outSize:d}=r[i],u,p;n==="mean"?u=i===0?new Cv({windowSize:l,inSize:o,batchSize:e.shape[0],outSize:d},o):new Cv({windowSize:l,inSize:o,batchSize:e.shape[0],outSize:d}):u=new qW({windowSize:l,inSize:o,batchSize:e.shape[0],outSize:d},n),p=s,s=a.runWebGLProgram(u,[s],t),p.dataId!==e.dataId&&a.disposeIntermediateTensorInfo(p)}return s}var ZW=class{constructor(e,t){this.variableNames=["A"];let n=new Array(e.length);for(let s=0;s<n.length;s++)n[s]=e[t[s]];this.outputShape=n,this.rank=n.length;let a=lt(this.rank),r=KW(t);this.userCode= `
void main ( ) {
$ { a } resRC = getOutputCoords ( ) ;
setOutput ( getA ( $ { r } ) ) ;
}
` }};function KW(e){let t=e.length;if(t>6)throw Error( ` Transpose for rank $ { t } is not yet supported ` );let n=["resRC.x","resRC.y","resRC.z","resRC.w","resRC.u","resRC.v"],a=new Array(t);for(let r=0;r<e.length;r++)a[e[r]]=n[r];return a.join()}var YW=class{constructor(e,t){this.variableNames=["A"],this.packedInputs=!0,this.packedOutput=!0;let n=new Array(e.length);for(let d=0;d<n.length;d++)n[d]=e[t[d]];if(this.outputShape=n,this.rank=n.length,this.rank>6)throw Error( ` Packed transpose for rank $ { this . rank } is not yet supported . ` );let a=lt(this.rank),r=pv("rc",this.rank),s=new Array(this.rank);for(let d=0;d<t.length;d++)s[t[d]]=r[d];let i= ` vec2 ( $ { s . slice ( - 2 ) . join ( ) } ) ` ,o= ` ++ $ { r [ this . rank - 1 ] } < $ { n [ this . rank - 1 ] } ` ,l= ` getChannel ( getA ( $ { s . join ( ) } ) , $ { i } ) ` ;this.userCode= `
void main ( ) {
$ { a } rc = getOutputCoords ( ) ;
vec4 result = vec4 ( 0. ) ;
result [ 0 ] = $ { l } ;
if ( $ { o } ) {
result [ 1 ] = $ { l } ;
}
-- $ { r [ this . rank - 1 ] } ;
if ( ++ $ { r [ this . rank - 2 ] } < $ { n [ this . rank - 2 ] } ) {
result [ 2 ] = $ { l } ;
if ( $ { o } ) {
result [ 3 ] = $ { l } ;
2021-04-28 14:55:26 +02:00
}
2021-04-28 14:58:21 +02:00
}
setOutput ( result ) ;
}
` }};function yh(e,t,n){let a=J().getBool("WEBGL_PACK_ARRAY_OPERATIONS")?new YW(e.shape,t):new ZW(e.shape,t);return n.runWebGLProgram(a,[e],e.dtype)}function JW(e,t,n,a){let r=t,s=e.shape.length,i=k.parseAxisParam(r,e.shape),o=i,l=C.getAxesPermutation(o,s),d=l!=null,u=e;d&&(u=yh(e,l,a),o=C.getInnerMostAxes(o.length,s)),C.assertAxesAreInnerMostDims("sum",o,s);let[p,c]=C.computeOutAndReduceShapes(u.shape,o),h=p;n&&(h=C.expandShapeToKeepDim(p,i));let m=k.sizeFromShape(c),f=k.sizeFromShape(e.shape)/m,A=fe({inputs:{x:u},attrs:{shape:[f,m]},backend:a}),y=lc(e.dtype),g=Ni(A,y,"sum",a),x=fe({inputs:{x:g},attrs:{shape:h},backend:a});return a.disposeIntermediateTensorInfo(A),a.disposeIntermediateTensorInfo(g),d&&a.disposeIntermediateTensorInfo(u),x}function gh(e){let{inputs:t,backend:n,attrs:a}=e,{x:r}=t,{axis:s,keepDims:i}=a;return JW(r,s,i,n)}var QW={kernelName:qs,backendName:"webgl",kernelFunc:gh};function cn(e){let{inputs:t,backend:n,attrs:a}=e,{x:r}=t,{perm:s}=a,i=n,o=r.shape.length,l=new Array(o);for(let u=0;u<l.length;u++)l[u]=r.shape[s[u]];let d;if(i.shouldExecuteOnCPU([r])){let u=i.texData.get(r.dataId).values,p=c1(u,r.shape,r.dtype,s,l);d=i.makeTensorInfo(l,r.dtype);let c=i.texData.get(d.dataId);c.values=p}else d=yh(r,s,i);return d}var eB={kernelName:Qs,backendName:"webgl",kernelFunc:cn},Rv=1e3;function xh({a:e,b:t,transposeA:n,transposeB:a,backend:r,bias:s=null,preluActivationWeights:i=null,leakyreluAlpha:o=0,activation:l=null}){let d=e.shape.length,u=t.shape.length,p=n?e.shape[d-2]:e.shape[d-1],c=a?t.shape[u-1]:t.shape[u-2],h=n?e.shape[d-1]:e.shape[d-2],m=a?t.shape[u-2]:t.shape[u-1],f=e.shape.slice(0,-2),A=t.shape.slice(0,-2),y=k.sizeFromShape(f),g=k.sizeFromShape(A),x=y===g||y===1||g===1;k.assert(d>=2&&u>=2&&x,()=> ` Error in matMul : the input batch dimensions must either be the same or at least one input batch dimension must be 1. Got input batch dimensions of ( $ { f } ) and ( $ { A } ) . ` );let w=(y>g?e.shape.slice(0,-2):t.shape.slice(0,-2)).concat([h,m]);k.assert(p===c,()=> ` Error in matMul : inner shapes ( $ { p } ) and ( $ { c } ) of Tensors with shapes $ { e . shape } and $ { t . shape } and transposeA = $ { n } and transposeB = $ { a } must match . ` );let b=n?[y,p,h]:[y,h,p],v=a?[g,m,c]:[g,c,m],I=fe({inputs:{x:e},backend:r,attrs:{shape:b}}),T=fe({inputs:{x:t},backend:r,attrs:{shape:v}}),R=[I,T], $ =Math.max(y,g),O=n?I.shape[1]:I.shape[2],_=s!=null,V=i!=null,j=l==="leakyrelu",U=l!=null?Ah(l,!0):null,X=_||V||j||U!=null,G;if((h===1||m===1)&&O>Rv&&X===!1){let Y=I,re=T;n&&(Y=cn({inputs:{x:I},backend:r,attrs:{perm:[0,2,1]}}),R.push(Y)),a&&(re=cn({inputs:{x:T},backend:r,attrs:{perm:[0,2,1]}}),R.push(re));let ne=m!==1,ie=m===1,Q=Y;ne&&(Q=fe({inputs:{x:Y},backend:r,attrs:{shape:[ $ ,O,1]}}),R.push(Q));let de=m===1?2:1,oe=re;ie&&(oe=fe({inputs:{x:re},backend:r,attrs:{shape:[ $ ,1,O]}}),R.push(oe));let me=f1({inputs:{a:Q,b:oe},backend:r});G=gh({inputs:{x:me},backend:r,attrs:{axis:de,keepDims:!0}}),R.push(me)}else{let Y=sa(e.dtype,t.dtype),re=new Sv(b,v,[ $ ,h,m],n,a,_,U,V,j),ne=[I,T];if(s!=null&&ne.push(s),V&&ne.push(i),j){let ie=r.makeTensorInfo([],"float32",k.createScalarValue(o,"float32"));ne.push(ie),R.push(ie)}G=r.runWebGLProgram(re,ne,Y)}let ee=fe({inputs:{x:G},backend:r,attrs:{shape:w}});R.push(G);for(let Y of R)r.disposeIntermediateTensorInfo(Y);return ee}function tB(e){let{inputs:t,backend:n,attrs:a}=e,{a:r,b:s,bias:i,preluActivationWeights:o}=t,{transposeA:l,transposeB:d,activation:u,leakyreluAlpha:p}=a;return xh({a:r,b:s,transposeA:l,transposeB:d,backend:n,bias:i,preluActivationWeights:o,leakyreluAlpha:p,activation:u})}var nB={kernelName:ei,backendName:"webgl",kernelFunc:tB},Mv="return abs(x);";function aB(e){let{inputs:t,backend:n}=e,{x:a}=t;if(n.shouldExecuteOnCPU([a])&&a.dtype!=="complex64"){let s=n.texData.get(a.dataId),i=dv(s.values);return n.makeTensorInfo(a.shape,a.dtype,i)}let r;return J().getBool("WEBGL_PACK_UNARY_OPERATIONS")?r=new Fl(a.shape,Mv):r=new Pr(a.shape,Mv),n.runWebGLProgram(r,[a],a.dtype)}var rB={kernelName:eo,backendName:"webgl",kernelFunc:aB},sB=ba+ `
if ( abs ( x ) > 1. ) {
return NAN ;
}
return acos ( x ) ;
` ,iB=qe({opSnippet:sB}),oB={kernelName:to,backendName:"webgl",kernelFunc:iB},lB=ba+ `
if ( x < 1.0 ) return NAN ;
return log ( x + sqrt ( x * x - 1.0 ) ) ; ` ,uB=qe({opSnippet:lB}),dB={kernelName:no,backendName:"webgl",kernelFunc:uB},Fv="return a + b;",pB=en({opSnippet:Fv,packedOpSnippet:Fv,supportsComplex:!0,cpuKernelImpl:FL}),cB={kernelName:kr,backendName:"webgl",kernelFunc:pB},hB=class{constructor(e,t){this.outputShape=[],this.outputShape=e,this.variableNames=t.map((r,s)=> ` T$ { s } ` );let n=[];this.variableNames.forEach(r=>{n.push( ` float v$ { r } = get$ { r } AtOutCoords ( ) ; ` )});let a=this.variableNames.map(r=> ` v$ { r } ` ).join(" + ");this.userCode= `
void main ( ) {
$ { n . join ( `
` )}
float result = $ { a } ;
setOutput ( result ) ;
}
` }},fB=class{constructor(e,t){this.outputShape=[],this.packedInputs=!0,this.packedOutput=!0,this.outputShape=e,this.variableNames=t.map((r,s)=> ` T$ { s } ` );let n=[];this.variableNames.forEach(r=>{n.push( ` vec4 v$ { r } = get$ { r } AtOutCoords ( ) ; ` )});let a=this.variableNames.map(r=> ` v$ { r } ` ).join(" + ");this.userCode= `
void main ( ) {
$ { n . join ( `
` )}
vec4 result = $ { a } ;
setOutput ( result ) ;
}
` }};function bh(e){let{inputs:t,backend:n}=e,a=t;if(a.length===1)return Pn({inputs:{x:a[0]},backend:n});if(a.length>J().get("WEBGL_MAX_TEXTURES_IN_SHADER")){let o=Math.floor(a.length/2),l=bh({inputs:a.slice(0,o),backend:n}),d=bh({inputs:a.slice(o),backend:n});return bh({inputs:[l,d],backend:n})}let r=a.map(o=>o.dtype).reduce((o,l)=>sa(o,l)),s=a.map(o=>o.shape),i=J().getBool("WEBGL_PACK")?new fB(a[0].shape,s):new hB(a[0].shape,s);return n.runWebGLProgram(i,a,r)}var mB={kernelName:is,backendName:"webgl",kernelFunc:bh};function AB(e){let{inputs:t,backend:n,attrs:a}=e,{x:r}=t,{axis:s,keepDims:i}=a,o=r.shape.length,l=k.parseAxisParam(s,r.shape),d=l,u=C.getAxesPermutation(d,o),p=r;u!=null&&(p=cn({inputs:{x:r},backend:n,attrs:{perm:u}}),d=C.getInnerMostAxes(d.length,o)),C.assertAxesAreInnerMostDims("all",d,o);let[c,h]=C.computeOutAndReduceShapes(p.shape,d),m=k.sizeFromShape(h),f=fe({inputs:{x:p},backend:n,attrs:{shape:[-1,m]}}),A=Ni(f,f.dtype,"all",n),y;if(i){let g=C.expandShapeToKeepDim(c,l);y=fe({inputs:{x:A},backend:n,attrs:{shape:g}})}else y=fe({inputs:{x:A},backend:n,attrs:{shape:c}});return n.disposeIntermediateTensorInfo(f),n.disposeIntermediateTensorInfo(A),u!=null&&n.disposeIntermediateTensorInfo(p),y}var yB={kernelName:ao,backendName:"webgl",kernelFunc:AB};function gB(e){let{inputs:t,backend:n,attrs:a}=e,{x:r}=t,{axis:s,keepDims:i}=a,o=r.shape.length,l=k.parseAxisParam(s,r.shape),d=l,u=C.getAxesPermutation(d,o),p=r;u!=null&&(p=cn({inputs:{x:r},backend:n,attrs:{perm:u}}),d=C.getInnerMostAxes(d.length,o)),C.assertAxesAreInnerMostDims("any",d,o);let[c,h]=C.computeOutAndReduceShapes(p.shape,d),m=k.sizeFromShape(h),f=fe({inputs:{x:p},backend:n,attrs:{shape:[-1,m]}}),A=Ni(f,f.dtype,"any",n),y;if(i){let g=C.expandShapeToKeepDim(c,l);y=fe({inputs:{x:A},backend:n,attrs:{shape:g}})}else y=fe({inputs:{x:A},backend:n,attrs:{shape:c}});return n.disposeIntermediateTensorInfo(f),n.disposeIntermediateTensorInfo(A),u!=null&&n.disposeIntermediateTensorInfo(p),y}var xB={kernelName:ro,backendName:"webgl",kernelFunc:gB},bB=class{constructor(e,t,n){this.variableNames=["A"];let{windowSize:a,batchSize:r,outSize:s}=e;n||this.variableNames.push("bestIndicesA"),this.outputShape=[r,s];let i=t==="max"?">":"<",o=n?"inOffset + i;":"round(getBestIndicesA(batch, inOffset + i));";this.userCode= `
void main ( ) {
ivec2 coords = getOutputCoords ( ) ;
int batch = coords [ 0 ] ;
int outIdx = coords [ 1 ] ;
int inOffset = outIdx * $ { a } ;
int bestIndex = inOffset ;
float bestValue = getA ( batch , bestIndex ) ;
for ( int i = 0 ; i < $ { a } ; i ++ ) {
int inIdx = $ { o } ;
float candidate = getA ( batch , inIdx ) ;
if ( candidate $ { i } bestValue ) {
bestValue = candidate ;
bestIndex = inIdx ;
2021-04-28 14:55:26 +02:00
}
}
2021-04-28 14:58:21 +02:00
setOutput ( float ( bestIndex ) ) ;
}
` }},vB=class{constructor(e,t,n,a){this.variableNames=["A"],this.packedInputs=!0,this.packedOutput=!0,k.assert(e.length>2,()=> ` Packed arg$ { n . charAt ( 0 ) . toUpperCase ( ) + n . slice ( 1 ) } supports only inputs with rank above 2. ` );let r=e[e.length-1],s=Math.ceil(r/t);this.outputShape=e.slice(0,-1),s>1&&this.outputShape.push(s),a||this.variableNames.push("bestIndicesA");let i=this.outputShape,o=i.length,l=lt(o),d=pn("coords",o),u,p;if(s===1){p=o+1;let I=lt(p);u= `
$ { I } sourceLocR = $ { I } ( $ { d . join ( ) } , 0 ) ;
++ $ { d [ o - 1 ] } ;
$ { I } sourceLocG = $ { I } ( $ { d . join ( ) } , 0 ) ;
++ $ { d [ o - 2 ] } ;
$ { I } sourceLocA = $ { I } ( $ { d . join ( ) } , 0 ) ;
-- $ { d [ o - 1 ] } ;
$ { I } sourceLocB = $ { I } ( $ { d . join ( ) } , 0 ) ;
-- $ { d [ o - 2 ] } ; ` }else p=o,u= `
$ { l } sourceLocR = coords ;
++ $ { d [ o - 1 ] } ;
$ { l } sourceLocG = coords ;
++ $ { d [ o - 2 ] } ;
$ { l } sourceLocA = coords ;
-- $ { d [ o - 1 ] } ;
$ { l } sourceLocB = coords ;
-- $ { d [ o - 2 ] } ; ` ;let c=["x","y","z","w","u","v"].slice(0,p),h="."+c[p-1],m=c.map(I=>"int "+I),f=pn("sourceLocR",p-1).concat("inIdx.r"),A=pn("sourceLocG",p-1).concat("inIdx.g"),y=pn("sourceLocB",p-1).concat("inIdx.b"),g=pn("sourceLocA",p-1).concat("inIdx.a"),x=n==="max"?"greaterThan":"lessThan",w=a?"": `
inIdx = round ( vec4 ( getBestIndicesAChannel ( $ { f . join ( ) } ) ,
getBestIndicesAChannel ( $ { A . join ( ) } ) ,
getBestIndicesAChannel ( $ { y . join ( ) } ) ,
getBestIndicesAChannel ( $ { g . join ( ) } ) ) ) ; ` ,b= ` vec4 (
getAChannel ( $ { f . join ( ) } ) ,
hasNextCol ? getAChannel ( $ { A . join ( ) } ) : 0. ,
hasNextRow ? getAChannel ( $ { y . join ( ) } ) : 0. ,
hasNextRow && hasNextCol ? getAChannel ( $ { g . join ( ) } ) : 0. ) ` ,v=a?"": `
float getBestIndicesAChannel ( $ { m . join ( ) } ) {
return getChannel ( getBestIndicesA ( $ { c . join ( ) } ) ,
vec2 ( $ { c . slice ( - 2 ) . join ( ) } ) ) ;
} ` ;this.userCode= `
float getAChannel ( $ { m . join ( ) } ) {
return getChannel ( getA ( $ { c . join ( ) } ) ,
vec2 ( $ { c . slice ( - 2 ) . join ( ) } ) ) ;
}
$ { v }
void main ( ) {
$ { l } coords = getOutputCoords ( ) ;
bool hasNextCol = $ { d [ o - 1 ] } < $ { i [ o - 1 ] - 1 } ;
bool hasNextRow = $ { d [ o - 2 ] } < $ { i [ o - 2 ] - 1 } ;
$ { u }
ivec4 srcIdx = ivec4 ( sourceLocR$ { h } , sourceLocG$ { h } ,
sourceLocB$ { h } , sourceLocA$ { h } ) * $ { t } ;
ivec4 inIdx = srcIdx ;
vec4 bestIndex = vec4 ( inIdx ) ;
vec4 bestValue = $ { b } ;
for ( int i = 0 ; i < $ { t } ; i ++ ) {
inIdx = srcIdx ;
$ { w }
vec4 candidate = $ { b } ;
bvec4 nan = isnan ( candidate ) ;
bvec4 replace = bvec4 (
vec4 ( $ { x } ( candidate , bestValue ) ) * ( vec4 ( 1.0 ) - vec4 ( nan ) ) ) ;
bestValue = vec4 ( replace . x ? candidate . x : bestValue . x ,
replace . y ? candidate . y : bestValue . y ,
replace . z ? candidate . z : bestValue . z ,
replace . w ? candidate . w : bestValue . w ) ;
bestIndex = mix ( bestIndex , vec4 ( inIdx ) , vec4 ( replace ) ) ;
srcIdx ++ ;
2021-04-28 14:55:26 +02:00
}
2021-04-28 14:58:21 +02:00
setOutput ( bestIndex ) ;
}
` }};function $ v(e,t,n,a=null){let r=t.shape[0],s=t.shape[1];a!=null&&(r=a.shape[0],s=a.shape[1]);let i=C.computeOptimalWindowSize(s),o={windowSize:i,inSize:s,batchSize:r,outSize:Math.ceil(s/i)},l=new bB(o,n,a==null),d=[t];a!=null&&d.push(a);let u=e.runWebGLProgram(l,d,"int32");if(u.shape[1]===1)return u;let p= $ v(e,t,n,u);return e.disposeIntermediateTensorInfo(u),p}function Dv(e,t,n,a=null){let r=a!=null?a.shape:t.shape,s=r[r.length-1],i=C.computeOptimalWindowSize(s),o=new vB(r,i,n,a==null),l=a==null?[t]:[t,a],d=e.runWebGLProgram(o,l,"int32");if(d.shape.length===t.shape.length){let u=Dv(e,t,n,d);return e.disposeIntermediateTensorInfo(d),u}return d}function Ov(e,t,n,a){let r=[n];if(C.assertAxesAreInnerMostDims("arg"+a.charAt(0).toUpperCase()+a.slice(1),r,t.shape.length),!J().getBool("WEBGL_PACK_REDUCE")||t.shape.length<=2){let s=[],[i,o]=C.computeOutAndReduceShapes(t.shape,r),l=k.sizeFromShape(o),d=fe({inputs:{x:t},backend:e,attrs:{shape:[-1,l]}});s.push(d);let u= $ v(e,d,a);s.push(u);let p=fe({inputs:{x:u},backend:e,attrs:{shape:i}});return s.forEach(c=>e.disposeIntermediateTensorInfo(c)),p}return Dv(e,t,a)}function wB(e){let{inputs:t,backend:n,attrs:a}=e,{x:r}=t,{axis:s}=a,i=k.parseAxisParam(s,r.shape),o=C.getAxesPermutation(i,r.shape.length),l=r,d=[];o!=null&&(l=cn({inputs:{x:r},backend:n,attrs:{perm:o}}),d.push(l),i=C.getInnerMostAxes(i.length,l.shape.length)),C.assertAxesAreInnerMostDims("argMax",[i[0]],l.shape.length);let u=Ov(n,l,i[0],"max");return d.forEach(p=>n.disposeIntermediateTensorInfo(p)),u}var kB={kernelName:os,backendName:"webgl",kernelFunc:wB};function IB(e){let{inputs:t,backend:n,attrs:a}=e,{x:r}=t,{axis:s}=a,i=k.parseAxisParam(s,r.shape),o=C.getAxesPermutation(i,r.shape.length),l=r,d=[];o!=null&&(l=cn({inputs:{x:r},backend:n,attrs:{perm:o}}),d.push(l),i=C.getInnerMostAxes(i.length,l.shape.length)),C.assertAxesAreInnerMostDims("argMin",[i[0]],l.shape.length);let u=Ov(n,l,i[0],"min");return d.forEach(p=>n.disposeIntermediateTensorInfo(p)),u}var SB={kernelName:hu,backendName:"webgl",kernelFunc:IB},NB=ba+ `
if ( abs ( x ) > 1. ) {
return NAN ;
}
return asin ( x ) ;
` ,TB=qe({opSnippet:NB}),EB={kernelName:so,backendName:"webgl",kernelFunc:TB},CB=ba+"return log(x + sqrt(x * x + 1.0));",RB=qe({opSnippet:CB}),MB={kernelName:io,backendName:"webgl",kernelFunc:RB},FB=ba+ `
return atan ( x ) ;
` , $ B=qe({opSnippet:FB}),DB={kernelName:oo,backendName:"webgl",kernelFunc: $ B},OB=VW+ `
return atan ( a , b ) ;
` ,zB= `
vec4 result = atan ( a , b ) ;
vec4 isNaN = min ( vec4 ( isnan ( a ) ) + vec4 ( isnan ( b ) ) , vec4 ( 1.0 ) ) ;
` +jW+ `
return result ;
` ,_B=en({opSnippet:OB,packedOpSnippet:zB}),PB={kernelName:uo,backendName:"webgl",kernelFunc:_B},LB=ba+ `
if ( ( x < - 1.0 ) || ( x > 1.0 ) ) return NAN ;
return ( log ( 1.0 + x ) - log ( 1.0 - x ) ) / 2.0 ; ` ,WB=qe({opSnippet:LB}),BB={kernelName:lo,backendName:"webgl",kernelFunc:WB},md=class{constructor(e,t,n,a=!1,r=!1){if(this.variableNames=["x"],t==="avg"&&n)throw new Error("Cannot compute positions for average pool.");let s=e.filterWidth,i=e.strideHeight,o=e.strideWidth,l=e.dilationHeight,d=e.dilationWidth,u=e.effectiveFilterHeight,p=e.effectiveFilterWidth,c=e.padInfo.top,h=e.padInfo.left;this.outputShape=e.outShape;let m=t==="avg",f= ` ( ( batch * $ { e . inHeight } + xR ) * $ { e . inWidth } + xC ) * $ { e . inChannels } + d ` ,A= ` ( xR * $ { e . inWidth } + xC ) * $ { e . inChannels } + d ` ,y="0.0";if(m||(y="-1.0 / 1e-20"),n){let I=">=";this.userCode= `
const ivec2 strides = ivec2 ( $ { i } , $ { o } ) ;
const ivec2 pads = ivec2 ( $ { c } , $ { h } ) ;
void main ( ) {
ivec4 coords = getOutputCoords ( ) ;
int batch = coords [ 0 ] ;
int d = coords [ 3 ] ;
ivec2 xRCCorner = coords . yz * strides - pads ;
int xRCorner = xRCCorner . x ;
int xCCorner = xRCCorner . y ;
// max/min x(?, ?, d) to get y(yR, yC, d).
// ? = to be determined
float minMaxValue = 0.0 ;
float minMaxValueFound = 0.0 ;
int minMaxPosition = 0 ;
float avgValue = 0.0 ;
for ( int wR = 0 ; wR < $ { u } ;
wR += $ { l } ) {
int xR = xRCorner + wR ;
if ( xR < 0 || xR >= $ { e . inHeight } ) {
continue ;
2021-04-28 14:55:26 +02:00
}
2021-04-28 14:58:21 +02:00
for ( int wC = 0 ; wC < $ { p } ;
wC += $ { d } ) {
int xC = xCCorner + wC ;
if ( xC < 0 || xC >= $ { e . inWidth } ) {
continue ;
2021-04-19 22:19:03 +02:00
}
2021-04-28 14:58:21 +02:00
float value = getX ( batch , xR , xC , d ) ;
// If a min / max value has already been found, use it. If not,
// use the current value.
float currMinMaxValue = mix (
value , minMaxValue , minMaxValueFound ) ;
if ( value $ { I } currMinMaxValue ) {
minMaxValue = value ;
minMaxValueFound = 1.0 ;
minMaxPosition = $ { a ? r ? f : A : ` wR * ${ p } + wC ` } ;
2021-04-19 22:19:03 +02:00
}
2021-04-17 00:03:15 +02:00
}
}
2021-04-28 14:58:21 +02:00
setOutput ( float ( minMaxPosition ) ) ;
2021-04-19 22:02:47 +02:00
}
2021-04-28 14:58:21 +02:00
` ;return}let g="max",x= ` $ { t } ( $ { t } ( $ { t } ( minMaxValue [ 0 ] , minMaxValue [ 1 ] ) , minMaxValue [ 2 ] ) , minMaxValue [ 3 ] ) ` ;t==="avg"&&(x="avgValue / count");let w=Math.floor(s/4)*4,b=s%4,v= `
if ( $ { m } ) {
avgValue += dot ( values , ones ) ;
} else {
minMaxValue = $ { g } ( values , minMaxValue ) ;
}
` ;this.userCode= `
const ivec2 strides = ivec2 ( $ { i } , $ { o } ) ;
const ivec2 pads = ivec2 ( $ { c } , $ { h } ) ;
const float initializationValue = $ { y } ;
const vec4 ones = vec4 ( 1.0 , 1.0 , 1.0 , 1.0 ) ;
float count = 0.0 ;
float getValue ( int batch , int xR , int xC , int d ) {
if ( xC < 0 || xC >= $ { e . inWidth } ) {
return initializationValue ;
2021-04-28 14:55:26 +02:00
}
2021-04-28 14:58:21 +02:00
count += 1.0 ;
return getX ( batch , xR , xC , d ) ;
}
void main ( ) {
ivec4 coords = getOutputCoords ( ) ;
int batch = coords [ 0 ] ;
int d = coords [ 3 ] ;
ivec2 xRCCorner = coords . yz * strides - pads ;
int xRCorner = xRCCorner . x ;
int xCCorner = xRCCorner . y ;
// max/min x(?, ?, d) to get y(yR, yC, d).
// ? = to be determined
vec4 minMaxValue = vec4 ( $ { y } ) ;
float avgValue = 0.0 ;
count = 0.0 ;
for ( int wR = 0 ; wR < $ { u } ;
wR += $ { l } ) {
int xR = xRCorner + wR ;
if ( xR < 0 || xR >= $ { e . inHeight } ) {
continue ;
2021-04-28 14:55:26 +02:00
}
2021-04-28 14:58:21 +02:00
for ( int wC = 0 ; wC < $ { w } ; wC += 4 ) {
int xC = xCCorner + wC * $ { d } ;
vec4 values = vec4 (
getValue ( batch , xR , xC , d ) ,
getValue ( batch , xR , xC + $ { d } , d ) ,
getValue ( batch , xR , xC + 2 * $ { d } , d ) ,
getValue ( batch , xR , xC + 3 * $ { d } , d )
) ;
$ { v }
2021-04-28 14:55:26 +02:00
}
2021-04-28 14:58:21 +02:00
int xC = xCCorner + $ { w } ;
if ( $ { b === 1 } ) {
vec4 values = vec4 (
getValue ( batch , xR , xC , d ) ,
initializationValue ,
initializationValue ,
initializationValue
) ;
$ { v }
} else if ( $ { b === 2 } ) {
vec4 values = vec4 (
getValue ( batch , xR , xC , d ) ,
getValue ( batch , xR , xC + $ { d } , d ) ,
initializationValue ,
initializationValue
) ;
$ { v }
} else if ( $ { b === 3 } ) {
vec4 values = vec4 (
getValue ( batch , xR , xC , d ) ,
getValue ( batch , xR , xC + $ { d } , d ) ,
getValue ( batch , xR , xC + 2 * $ { d } , d ) ,
initializationValue
) ;
$ { v }
2021-04-28 14:55:26 +02:00
}
}
2021-04-28 14:58:21 +02:00
setOutput ( $ { x } ) ;
}
` }},m1=class{constructor(e,t,n,a=!1,r=!1){if(this.variableNames=["x"],t==="avg"&&n)throw new Error("Cannot compute positions for average pool.");let s=e.filterWidth,i=e.strideDepth,o=e.strideHeight,l=e.strideWidth,d=e.dilationDepth,u=e.dilationHeight,p=e.dilationWidth,c=e.effectiveFilterDepth,h=e.effectiveFilterHeight,m=e.effectiveFilterWidth,f=e.padInfo.front,A=e.padInfo.top,y=e.padInfo.left;this.outputShape=e.outShape;let g=t==="avg",x="0.0";if(g||(x="-1.0 / 1e-20"),n){let R=">=";this.userCode= `
const ivec3 strides =
ivec3 ( $ { i } , $ { o } , $ { l } ) ;
const ivec3 pads = ivec3 ( $ { f } , $ { A } , $ { y } ) ;
void main ( ) {
ivec5 coords = getOutputCoords ( ) ;
int batch = coords . x ;
int ch = coords . u ;
ivec3 xCorner = ivec3 ( coords . y , coords . z , coords . w ) * strides - pads ;
int xDCorner = xCorner . x ;
int xRCorner = xCorner . y ;
int xCCorner = xCorner . z ;
// max/min x(?, ?, ?, ch) to get y(yD, yR, yC, ch).
// ? = to be determined
float minMaxValue = 0.0 ;
float minMaxValueFound = 0.0 ;
int minMaxPosition = 0 ;
for ( int wD = 0 ; wD < $ { c } ;
wD += $ { d } ) {
int xD = xDCorner + wD ;
if ( xD < 0 || xD >= $ { e . inDepth } ) {
continue ;
2021-04-19 22:02:47 +02:00
}
2021-04-28 14:58:21 +02:00
for ( int wR = 0 ; wR < $ { h } ;
wR += $ { u } ) {
int xR = xRCorner + wR ;
if ( xR < 0 || xR >= $ { e . inHeight } ) {
continue ;
}
for ( int wC = 0 ; wC < $ { m } ;
wC += $ { p } ) {
int xC = xCCorner + wC ;
if ( xC < 0 || xC >= $ { e . inWidth } ) {
continue ;
}
float value = getX ( batch , xD , xR , xC , ch ) ;
// If a min / max value has already been found, use it. If not,
// use the current value.
float currMinMaxValue = mix (
value , minMaxValue , minMaxValueFound ) ;
if ( value $ { R } currMinMaxValue ) {
minMaxValue = value ;
minMaxValueFound = 1.0 ;
minMaxPosition = $ { a ? r ? ` (((batch * ${ e . inDepth } + xD) * ${ e . inHeight } + xR) * ${ e . inWidth } + xC) * ${ e . inChannels } + ch ` : ` ((xD * ${ e . inHeight } + xR) * ${ e . inWidth } + xC) * ${ e . inChannels } + ch ` : ` wD * ${ h } * ${ m } +
wR * $ { m } + wC ` };
}
2021-04-19 22:19:03 +02:00
}
2021-04-19 22:02:47 +02:00
}
}
2021-04-28 14:58:21 +02:00
setOutput ( float ( minMaxPosition ) ) ;
2021-04-28 14:55:26 +02:00
}
2021-04-28 14:58:21 +02:00
` ;return}let w="max",b= ` $ { t } ( $ { t } ( $ { t } ( minMaxValue [ 0 ] , minMaxValue [ 1 ] ) , minMaxValue [ 2 ] ) , minMaxValue [ 3 ] ) ` ;t==="avg"&&(b="avgValue / count");let v=Math.floor(s/4)*4,I=s%4,T= `
if ( $ { g } ) {
avgValue += dot ( values , ones ) ;
} else {
minMaxValue = $ { w } ( values , minMaxValue ) ;
}
` ;this.userCode= `
const ivec3 strides =
ivec3 ( $ { i } , $ { o } , $ { l } ) ;
const ivec3 pads = ivec3 ( $ { f } , $ { A } , $ { y } ) ;
const float initializationValue = $ { x } ;
const vec4 ones = vec4 ( 1.0 , 1.0 , 1.0 , 1.0 ) ;
float count = 0.0 ;
float getValue ( int batch , int xD , int xR , int xC , int ch ) {
if ( xC < 0 || xC >= $ { e . inWidth } ) {
return initializationValue ;
2021-04-28 14:55:26 +02:00
}
2021-04-28 14:58:21 +02:00
count += 1.0 ;
return getX ( batch , xD , xR , xC , ch ) ;
}
void main ( ) {
ivec5 coords = getOutputCoords ( ) ;
int batch = coords . x ;
int ch = coords . u ;
ivec3 xCorner = ivec3 ( coords . y , coords . z , coords . w ) * strides - pads ;
int xDCorner = xCorner . x ;
int xRCorner = xCorner . y ;
int xCCorner = xCorner . z ;
// max/min x(?, ?, ?, d) to get y(yD, yR, yC, ch).
// ? = to be determined
vec4 minMaxValue = vec4 ( $ { x } ) ;
float avgValue = 0.0 ;
count = 0.0 ;
for ( int wD = 0 ; wD < $ { c } ;
wD += $ { d } ) {
int xD = xDCorner + wD ;
if ( xD < 0 || xD >= $ { e . inDepth } ) {
continue ;
2021-04-28 14:55:26 +02:00
}
2021-04-28 14:58:21 +02:00
for ( int wR = 0 ; wR < $ { h } ;
wR += $ { u } ) {
int xR = xRCorner + wR ;
if ( xR < 0 || xR >= $ { e . inHeight } ) {
continue ;
2021-04-19 22:19:03 +02:00
}
2021-04-28 14:58:21 +02:00
for ( int wC = 0 ; wC < $ { v } ; wC += 4 ) {
int xC = xCCorner + wC * $ { p } ;
vec4 values = vec4 (
getValue ( batch , xD , xR , xC , ch ) ,
getValue ( batch , xD , xR , xC + $ { p } , ch ) ,
getValue ( batch , xD , xR , xC + 2 * $ { p } , ch ) ,
getValue ( batch , xD , xR , xC + 3 * $ { p } , ch )
) ;
$ { T }
}
int xC = xCCorner + $ { v } ;
if ( $ { I === 1 } ) {
vec4 values = vec4 (
getValue ( batch , xD , xR , xC , ch ) ,
initializationValue ,
initializationValue ,
initializationValue
) ;
$ { T }
} else if ( $ { I === 2 } ) {
vec4 values = vec4 (
getValue ( batch , xD , xR , xC , ch ) ,
getValue ( batch , xD , xR , xC + $ { p } , ch ) ,
initializationValue ,
initializationValue
) ;
$ { T }
} else if ( $ { I === 3 } ) {
vec4 values = vec4 (
getValue ( batch , xD , xR , xC , ch ) ,
getValue ( batch , xD , xR , xC + $ { p } , ch ) ,
getValue ( batch , xD , xR , xC + 2 * $ { p } , ch ) ,
initializationValue
) ;
$ { T }
2021-04-17 00:03:15 +02:00
}
2021-04-28 14:55:26 +02:00
}
2021-04-28 14:58:21 +02:00
setOutput ( $ { b } ) ;
2021-04-28 14:55:26 +02:00
}
2021-04-28 14:58:21 +02:00
}
` }};function VB(e){let{inputs:t,backend:n,attrs:a}=e,{x:r}=t;Nl(r,"avgPool");let{filterSize:s,strides:i,pad:o,dimRoundingMode:l}=a,d=1;k.assert(C.eitherStridesOrDilationsAreOne(i,d),()=> ` Error in avgPool : Either strides or dilations must be 1. Got strides $ { i } and dilations '${d}' ` );let u=C.computePool2DInfo(r.shape,s,i,d,o,l);if(u.filterWidth===1&&u.filterHeight===1&&k.arraysEqual(u.inShape,u.outShape))return Pn({inputs:{x:r},backend:n});let p=new md(u,"avg",!1);return n.runWebGLProgram(p,[r],"float32")}var jB={kernelName:ls,backendName:"webgl",kernelFunc:VB};function UB(e){let{inputs:t,backend:n,attrs:a}=e,{x:r}=t,{filterSize:s,strides:i,pad:o,dimRoundingMode:l,dataFormat:d}=a,u=[1,1,1],p=C.computePool3DInfo(r.shape,s,i,u,o,l,d),c=new m1(p,"avg",!1);return n.runWebGLProgram(c,[r],"float32")}var HB={kernelName:fu,backendName:"webgl",kernelFunc:UB},GB=class{constructor(e){this.variableNames=["dy"],this.outputShape=e.inShape;let t=e.filterHeight,n=e.filterWidth,a=e.strideHeight,r=e.strideWidth,s=e.dilationHeight,i=e.dilationWidth,o=e.effectiveFilterHeight,l=e.effectiveFilterWidth,d=o-1-e.padInfo.top,u=l-1-e.padInfo.left,p=1/(t*n);this.userCode= `
const ivec2 pads = ivec2 ( $ { d } , $ { u } ) ;
const float avgMultiplier = float ( $ { p } ) ;
void main ( ) {
ivec4 coords = getOutputCoords ( ) ;
int b = coords [ 0 ] ;
int d = coords [ 3 ] ;
ivec2 dyRCCorner = coords . yz - pads ;
int dyRCorner = dyRCCorner . x ;
int dyCCorner = dyRCCorner . y ;
// Convolve dy(?, ?, d) with pos mask(:, :, d) to get dx(xR, xC, d).
// ? = to be determined. : = across all values in that axis.
float dotProd = 0.0 ;
for ( int wR = 0 ; wR < $ { o } ;
wR += $ { s } ) {
float dyR = float ( dyRCorner + wR ) / $ { a } . 0 ;
if ( dyR < 0.0 || dyR >= $ { e . outHeight } . 0 || fract ( dyR ) > 0.0 ) {
continue ;
2021-04-28 14:55:26 +02:00
}
2021-04-28 14:58:21 +02:00
int idyR = int ( dyR ) ;
for ( int wC = 0 ; wC < $ { l } ;
wC += $ { i } ) {
float dyC = float ( dyCCorner + wC ) / $ { r } . 0 ;
if ( dyC < 0.0 || dyC >= $ { e . outWidth } . 0 ||
fract ( dyC ) > 0.0 ) {
continue ;
}
int idyC = int ( dyC ) ;
float dyValue = getDy ( b , idyR , idyC , d ) ;
dotProd += dyValue * avgMultiplier ;
2021-04-28 14:55:26 +02:00
}
}
2021-04-28 14:58:21 +02:00
setOutput ( dotProd ) ;
}
` }},qB=class{constructor(e){this.variableNames=["dy"],this.outputShape=e.inShape;let t=e.filterDepth,n=e.filterHeight,a=e.filterWidth,r=e.strideDepth,s=e.strideHeight,i=e.strideWidth,o=e.dilationDepth,l=e.dilationHeight,d=e.dilationWidth,u=e.effectiveFilterDepth,p=e.effectiveFilterHeight,c=e.effectiveFilterWidth,h=u-1-e.padInfo.front,m=p-1-e.padInfo.top,f=c-1-e.padInfo.left,A=1/(t*n*a);this.userCode= `
const ivec3 pads = ivec3 ( $ { h } , $ { m } , $ { f } ) ;
const float avgMultiplier = float ( $ { A } ) ;
void main ( ) {
ivec5 coords = getOutputCoords ( ) ;
int batch = coords . x ;
int ch = coords . u ;
ivec3 dyCorner = ivec3 ( coords . y , coords . z , coords . w ) - pads ;
int dyDCorner = dyCorner . x ;
int dyRCorner = dyCorner . y ;
int dyCCorner = dyCorner . z ;
// Convolve dy(?, ?, ?, d) with pos mask(:, :, :, ch) to get
// dx(xD, xR, xC, ch).
// ? = to be determined. : = across all values in that axis.
float dotProd = 0.0 ;
for ( int wD = 0 ; wD < $ { u } ;
wD += $ { o } ) {
float dyD = float ( dyDCorner + wD ) / $ { r } . 0 ;
if ( dyD < 0.0 || dyD >= $ { e . outDepth } . 0 || fract ( dyD ) > 0.0 ) {
continue ;
2021-04-28 14:55:26 +02:00
}
2021-04-28 14:58:21 +02:00
int idyD = int ( dyD ) ;
for ( int wR = 0 ; wR < $ { p } ;
wR += $ { l } ) {
float dyR = float ( dyRCorner + wR ) / $ { s } . 0 ;
if ( dyR < 0.0 || dyR >= $ { e . outHeight } . 0 ||
fract ( dyR ) > 0.0 ) {
continue ;
2021-04-28 14:55:26 +02:00
}
2021-04-28 14:58:21 +02:00
int idyR = int ( dyR ) ;
for ( int wC = 0 ; wC < $ { c } ;
wC += $ { d } ) {
float dyC = float ( dyCCorner + wC ) / $ { i } . 0 ;
if ( dyC < 0.0 || dyC >= $ { e . outWidth } . 0 ||
fract ( dyC ) > 0.0 ) {
continue ;
2021-04-19 22:02:47 +02:00
}
2021-04-28 14:58:21 +02:00
int idyC = int ( dyC ) ;
float dyValue = getDy ( batch , idyD , idyR , idyC , ch ) ;
dotProd += dyValue * avgMultiplier ;
2021-04-19 22:02:47 +02:00
}
2021-04-17 00:03:15 +02:00
}
}
2021-04-28 14:58:21 +02:00
setOutput ( dotProd ) ;
}
` }};function XB(e){let{inputs:t,backend:n,attrs:a}=e,{dy:r,input:s}=t,i=s,{filterSize:o,strides:l,pad:d,dimRoundingMode:u}=a,p=[1,1,1],c=C.computePool3DInfo(i.shape,o,l,p,d,u),h=new qB(c);return n.runWebGLProgram(h,[r],i.dtype)}var KB={kernelName:Tp,backendName:"webgl",kernelFunc:XB};function ZB(e){let{inputs:t,backend:n,attrs:a}=e,{dy:r,input:s}=t,i=s;Nl([r,s],"avgPoolGrad");let{filterSize:o,strides:l,pad:d}=a,u=C.computePool2DInfo(i.shape,o,l,1,d),p=new GB(u);return n.runWebGLProgram(p,[r],i.dtype)}var YB={kernelName:Np,backendName:"webgl",kernelFunc:ZB};function JB(e){let{inputs:t,backend:n,attrs:a}=e,{a:r,b:s}=t,{transposeA:i,transposeB:o}=a;return xh({a:r,b:s,transposeA:i,transposeB:o,backend:n})}var QB={kernelName:us,backendName:"webgl",kernelFunc:JB},eV=class{constructor(e,t,n,a,r,s){this.outputShape=[],this.variableNames=["x","mean","variance"],C.assertAndGetBroadcastShape(e,t),C.assertAndGetBroadcastShape(e,n);let i="0.0";a!=null&&(C.assertAndGetBroadcastShape(e,a),this.variableNames.push("offset"),i="getOffsetAtOutCoords()");let o="1.0";r!=null&&(C.assertAndGetBroadcastShape(e,r),this.variableNames.push("scale"),o="getScaleAtOutCoords()"),this.outputShape=e,this.userCode= `
void main ( ) {
float x = getXAtOutCoords ( ) ;
float mean = getMeanAtOutCoords ( ) ;
float variance = getVarianceAtOutCoords ( ) ;
float offset = $ { i } ;
float scale = $ { o } ;
float inv = scale * inversesqrt ( variance + float ( $ { s } ) ) ;
setOutput ( dot ( vec3 ( x , - mean , offset ) , vec3 ( inv , inv , 1 ) ) ) ;
}
` }},tV=class{constructor(e,t,n,a,r,s){this.packedInputs=!0,this.packedOutput=!0,this.variableNames=["x","mean","variance"],C.assertAndGetBroadcastShape(e,t),C.assertAndGetBroadcastShape(e,n);let i="vec4(0.0)";a!=null&&(C.assertAndGetBroadcastShape(e,a),this.variableNames.push("offset"),i="getOffsetAtOutCoords()");let o="vec4(1.0)";r!=null&&(C.assertAndGetBroadcastShape(e,r),this.variableNames.push("scale"),o="getScaleAtOutCoords()"),this.outputShape=e,this.userCode= `
void main ( ) {
vec4 offset = $ { i } ;
vec4 scale = $ { o } ;
vec4 x = getXAtOutCoords ( ) ;
vec4 mean = getMeanAtOutCoords ( ) ;
vec4 variance = getVarianceAtOutCoords ( ) ;
vec4 inv = scale * inversesqrt ( variance + vec4 ( $ { s } ) ) ;
setOutput ( ( x - mean ) * inv + offset ) ;
}
` }},nV=({inputs:e,backend:t,attrs:n})=>{let{x:a,mean:r,variance:s,offset:i,scale:o}=e;k.assert(r.shape.length===s.shape.length,()=>"Batch normalization gradient requires mean and variance to have equal ranks."),k.assert(i==null||r.shape.length===i.shape.length,()=>"Batch normalization gradient requires mean and offset to have equal ranks."),k.assert(o==null||r.shape.length===o.shape.length,()=>"Batch normalization gradient requires mean and scale to have equal ranks.");let{varianceEpsilon:l}=n;l==null&&(l=.001);let d=[a,r,s],u=null;i!=null&&(u=i.shape,d.push(i));let p=null;o!=null&&(p=o.shape,d.push(o));let c=J().getBool("WEBGL_PACK_NORMALIZATION")?new tV(a.shape,r.shape,s.shape,u,p,l):new eV(a.shape,r.shape,s.shape,u,p,l);return t.runWebGLProgram(c,d,d[0].dtype)},aV={kernelName:vs,backendName:"webgl",kernelFunc:nV},sV=class{constructor(e){this.variableNames=["source"],this.outputShape=e,this.rank=e.length;let t=lt(this.rank),n= ` uniform int start [ $ { this . rank } ] ; ` ,a=rV(this.rank),r,s=e.map((i,o)=> ` sourceLoc . $ { A1 [ o ] } = start [ $ { o } ] + coords . $ { A1 [ o ] } ; ` );r= `
$ { t } sourceLoc ;
$ { t } coords = getOutputCoords ( ) ;
$ { s . join ( `
` )}
` ,this.userCode= `
$ { n }
void main ( ) {
$ { r }
setOutput ( getSource ( $ { a } ) ) ;
}
` }getCustomSetupFunc(e){if(e.length!==this.rank)throw Error( ` The rank ( $ { this . rank } ) of the program must match the length of start ( $ { e . length } ) ` );return(t,n)=>{this.startLoc==null&&(this.startLoc=t.getUniformLocationNoThrow(n,"start"),this.startLoc==null)||t.gl.uniform1iv(this.startLoc,e)}}},A1=["x","y","z","w","u","v"];function rV(e){if(e===1)return"sourceLoc";if(e<=6)return A1.slice(0,e).map(t=>"sourceLoc."+t).join(",");throw Error( ` Slicing for rank $ { e } is not yet supported ` )}var iV=class{constructor(e){this.variableNames=["source"],this.packedInputs=!0,this.packedOutput=!0,this.outputShape=e,this.rank=e.length;let t=lt(this.rank),n=pn("coords",this.rank),a=pn("sourceLoc",this.rank),r=this.rank===1?"sourceLoc": ` vec2 ( $ { a . slice ( - 2 ) . join ( ) } ) ` ,s= ` getChannel ( getSource ( $ { a . join ( ) } ) , $ { r } ) ` ,i= `
result . x = $ { s } ;
if ( ++ $ { n [ this . rank - 1 ] } < $ { e [ this . rank - 1 ] } ) {
++ $ { a [ this . rank - 1 ] } ;
result . y = $ { s } ;
-- $ { a [ this . rank - 1 ] } ;
}
` ,o=this.rank===1?"": `
-- $ { n [ this . rank - 1 ] } ;
if ( ++ $ { n [ this . rank - 2 ] } < $ { e [ this . rank - 2 ] } ) {
++ $ { a [ this . rank - 2 ] } ;
result . z = $ { s } ;
if ( ++ $ { n [ this . rank - 1 ] } < $ { e [ this . rank - 1 ] } ) {
++ $ { a [ this . rank - 1 ] } ;
result . w = $ { s } ;
}
}
` ,l=this.rank<=4? ` sourceLoc = coords +
$ { t } ( $ { e . map ( ( d , u ) => ` start[ ${ u } ] ` ) . join ( ) } ) ; ` :e.map((d,u)=> ` $ { a [ u ] } = $ { n [ u ] } + start [ $ { u } ] ; ` ).join( `
` );this.userCode= `
uniform int start [ $ { this . rank } ] ;
void main ( ) {
$ { t } coords = getOutputCoords ( ) ;
$ { t } sourceLoc ;
$ { l }
vec4 result = vec4 ( 0. ) ;
$ { i }
$ { o }
setOutput ( result ) ;
}
` }getCustomSetupFunc(e){if(e.length!==this.rank)throw Error( ` The rank ( $ { this . rank } ) of the program must match the length of start ( $ { e . length } ) ` );return(t,n)=>{this.startLoc==null&&(this.startLoc=t.getUniformLocationNoThrow(n,"start"),this.startLoc==null)||t.gl.uniform1iv(this.startLoc,e)}}};function oV(e,t,n,a){let r=a.texData.get(e.dataId),s=a.makeTensorInfo(n,e.dtype),i=a.texData.get(s.dataId);Object.assign(i,r),i.refCount=1,i.shape=n,i.dtype=e.dtype;let o=sn.computeFlatOffset(t,k.computeStrides(e.shape));r.slice&&(o+=r.slice.flatOffset),i.slice={flatOffset:o,origDataId:r.slice&&r.slice.origDataId||e.dataId};let l=a.dataRefCount.get(i.slice.origDataId)||1;return a.dataRefCount.set(i.slice.origDataId,l+1),s}function Ad(e){let{inputs:t,backend:n,attrs:a}=e,{x:r}=t,{begin:s,size:i}=a,[o,l]=sn.parseSliceParams(r,s,i);if(sn.assertParamsValid(r,o,l),k.sizeFromShape(l)===0)return n.makeTensorInfo(l,r.dtype,[]);if(n.shouldExecuteOnCPU([r])||r.dtype==="string"){let p=n.texData.get(r.dataId),c=JL(p.values,o,l,r.shape,r.dtype);return n.makeTensorInfo(l,r.dtype,c)}let{isPacked:d}=n.texData.get(r.dataId),u=sn.isSliceContinous(r.shape,o,l);if(d||!u){let p=J().getBool("WEBGL_PACK_ARRAY_OPERATIONS")?new iV(l):new sV(l),c=p.getCustomSetupFunc(o);return n.runWebGLProgram(p,[r],r.dtype,c)}return n.uploadToGPU(r.dataId),oV(r,o,l,n)}var lV={kernelName:Ho,backendName:"webgl",kernelFunc:Ad},uV=e=>{let{inputs:t,backend:n,attrs:a}=e,{x:r}=t,{blockShape:s,crops:i}=a;k.assert(r.shape.length<=4,()=>"batchToSpaceND for rank > 4 with a WebGL backend not implemented yet");let o=s.reduce((g,x)=>g*x),l=C.getReshaped(r.shape,s,o),d=C.getPermuted(l.length,s.length),u=C.getReshapedPermuted(r.shape,s,o),p=C.getSliceBeginCoords(i,s.length),c=C.getSliceSize(u,i,s.length),h=[],m=fe({inputs:{x:r},backend:n,attrs:{shape:l}}),f=cn({inputs:{x:m},backend:n,attrs:{perm:d}}),A=fe({inputs:{x:f},backend:n,attrs:{shape:u}}),y=Ad({inputs:{x:A},backend:n,attrs:{begin:p,size:c}});return h.push(m),h.push(f),h.push(A),h.forEach(g=>n.disposeIntermediateTensorInfo(g)),y},dV={kernelName:mu,backendName:"webgl",kernelFunc:uV};function pV(e){let{inputs:t,backend:n,attrs:a}=e,{x:r,weights:s}=t,{size:i}=a,o=n.readSync(r.dataId),l=n.readSync(s.dataId),d=uv(o,l,s.dtype,s.shape,i);return n.makeTensorInfo([i],s.dtype,d)}var cV={kernelName:Ep,backendName:"webgl",kernelFunc:pV},hV="return float(a != b);",zv=en({opSnippet:hV,dtype:"bool"}),fV={kernelName: $ o,backendName:"webgl",kernelFunc:zv};function yd(e){let{inputs:t,backend:n}=e,{input:a}=t,r=n.texData.get(a.dataId);return Pn({inputs:{x:r.complexTensorInfos.real},backend:n})}var mV={kernelName:Zp,backendName:"webgl",kernelFunc:yd},AV="return float(int(x));";function yV(e,t){let n=new Pr(e.shape,AV),a=t.runWebGLProgram(n,[e],"int32");return{dataId:a.dataId,shape:a.shape,dtype:a.dtype}}function y1(e){let{inputs:t,backend:n,attrs:a}=e,{x:r}=t,{dtype:s}=a;if(s==="complex64"){if(r.dtype==="complex64")return Pn({inputs:{x:r},backend:n});let i=Ct(r.shape),o=y1({inputs:{x:r},backend:n,attrs:{dtype:"float32"}}),l=Lr({inputs:{real:o,imag:i},backend:n});return i.dispose(),n.disposeIntermediateTensorInfo(o),l}if(r.dtype==="complex64"){let i=yd({inputs:{input:r},backend:n}),o=y1({inputs:{x:i},backend:n,attrs:{dtype:s}});return n.disposeIntermediateTensorInfo(i),o}if(!k.hasEncodingLoss(r.dtype,s)){let i=Pn({inputs:{x:r},backend:n});return{dataId:i.dataId,shape:i.shape,dtype:s}}if(s==="int32")return yV(r,n);if(s==="bool"){let i=n.makeTensorInfo([],"bool",k.getTypedArrayFromDType("bool",1)),o=zv({inputs:{a:r,b:i},backend:n});return n.disposeIntermediateTensorInfo(i),o}throw new Error( ` Error in Cast : failed to cast $ { r . dtype } to $ { s } ` )}var gV={kernelName:ds,backendName:"webgl",kernelFunc:y1},_v="return ceil(x);",xV=qe({opSnippet:_v,packedOpSnippet:_v,cpuKernelImpl:DL}),bV={kernelName:ps,backendName:"webgl",kernelFunc:xV},vV=class{constructor(e){this.variableNames=["A"],this.outputShape=e,this.userCode= `
uniform float minVal ;
uniform float maxVal ;
void main ( ) {
float value = getAAtOutCoords ( ) ;
if ( isnan ( value ) ) {
setOutput ( value ) ;
return ;
2021-04-19 22:02:47 +02:00
}
2021-04-28 14:58:21 +02:00
setOutput ( clamp ( value , minVal , maxVal ) ) ;
}
` }getCustomSetupFunc(e,t){return(n,a)=>{this.minLoc==null&&(this.minLoc=n.getUniformLocationNoThrow(a,"minVal"),this.maxLoc=n.getUniformLocationNoThrow(a,"maxVal")),n.gl.uniform1f(this.minLoc,e),n.gl.uniform1f(this.maxLoc,t)}}},wV=class{constructor(e){this.variableNames=["A"],this.packedInputs=!0,this.packedOutput=!0,this.outputShape=e,this.userCode= `
uniform float minVal ;
uniform float maxVal ;
void main ( ) {
vec4 value = getAAtOutCoords ( ) ;
if ( any ( isnan ( value ) ) ) {
setOutput ( value ) ;
return ;
2021-04-17 00:03:15 +02:00
}
2021-04-28 14:58:21 +02:00
setOutput ( clamp ( value , vec4 ( minVal ) , vec4 ( maxVal ) ) ) ;
}
` }getCustomSetupFunc(e,t){return(n,a)=>{this.minLoc==null&&(this.minLoc=n.getUniformLocationNoThrow(a,"minVal"),this.maxLoc=n.getUniformLocationNoThrow(a,"maxVal")),n.gl.uniform1f(this.minLoc,e),n.gl.uniform1f(this.maxLoc,t)}}};function kV(e){let{inputs:t,backend:n,attrs:a}=e,{x:r}=t,{clipValueMin:s,clipValueMax:i}=a,o;J().getBool("WEBGL_PACK_CLIP")?o=new wV(r.shape):o=new vV(r.shape);let l=o.getCustomSetupFunc(s,i);return n.runWebGLProgram(o,[r],r.dtype,l)}var IV={kernelName:Ir,backendName:"webgl",kernelFunc:kV},SV=class{constructor(e){this.variableNames=["real","imag"],this.outputShape=e,this.userCode= `
void main ( ) {
float re = abs ( getRealAtOutCoords ( ) ) ;
float im = abs ( getImagAtOutCoords ( ) ) ;
float mx = max ( re , im ) ;
// sadly the length function in glsl is not underflow-safe
// (at least not on Intel GPUs). So the safe solution is
// to ensure underflow-safety in all cases.
setOutput (
mx == 0.0 ? 0.0 : mx * length ( vec2 ( 1 , min ( re , im ) / mx ) )
) ;
}
` }};function Pv(e,t){return{dataId:t.dataId,dtype:t.dtype,shape:e.shape}}function NV(e){let{inputs:t,backend:n}=e,{x:a}=t,r=n.texData.get(a.dataId),s=new SV(a.shape),i=[Pv(a,r.complexTensorInfos.real),Pv(a,r.complexTensorInfos.imag)];return n.runWebGLProgram(s,i,i[0].dtype)}var TV={kernelName:Au,backendName:"webgl",kernelFunc:NV},EV=class{constructor(e){this.outputShape=[],this.outputShape=C.computeOutShape(e,1),this.variableNames=e.map((s,i)=> ` T$ { i } ` );let t=new Array(e.length-1);t[0]=e[0][1];for(let s=1;s<t.length;s++)t[s]=t[s-1]+e[s][1];let n=[ ` if ( yC < $ { t [ 0 ] } ) setOutput ( getT0 ( yR , yC ) ) ; ` ];for(let s=1;s<t.length;s++){let i=t[s-1];n.push( ` else if ( yC < $ { t [ s ] } ) setOutput ( getT$ { s } ( yR , yC - $ { i } ) ) ; ` )}let a=t.length,r=t[t.length-1];n.push( ` else setOutput ( getT$ { a } ( yR , yC - $ { r } ) ) ; ` ),this.userCode= `
void main ( ) {
ivec2 coords = getOutputCoords ( ) ;
int yR = coords . x ;
int yC = coords . y ;
$ { n . join ( `
` )}
}
` }},CV=class{constructor(e,t){this.packedInputs=!0,this.packedOutput=!0,this.outputShape=[],this.outputShape=C.computeOutShape(e,t);let n=this.outputShape,a=n.length,r=lt(a),s=pn("coords",a),i=["x","y","z","w","u","v"].slice(0,a);this.variableNames=e.map((m,f)=> ` T$ { f } ` );let o=new Array(e.length-1);o[0]=e[0][t];for(let m=1;m<o.length;m++)o[m]=o[m-1]+e[m][t];let l=i[t],d=i.slice(-2),u=i.join(),p= ` if ( $ { l } < $ { o [ 0 ] } ) {
return getChannel (
getT0 ( $ { u } ) , vec2 ( $ { d . join ( ) } ) ) ;
} ` ;for(let m=1;m<o.length;m++){let f=o[m-1];p+= `
if ( $ { l } < $ { o [ m ] } && $ { l } >= $ { o [ m - 1 ] } ) {
return getChannel (
getT$ { m } ( $ { vh ( i , l , f ) } ) ,
vec2 ( $ { vh ( d , l , f ) } ) ) ;
} ` }let c=o.length,h=o[o.length-1];p+= `
return getChannel (
getT$ { c } ( $ { vh ( i , l , h ) } ) ,
vec2 ( $ { vh ( d , l , h ) } ) ) ; ` ,this.userCode= `
float getValue ( $ { i . map ( m => "int " + m ) } ) {
$ { p }
}
void main ( ) {
$ { r } coords = getOutputCoords ( ) ;
vec4 result = vec4 ( getValue ( $ { s } ) , 0. , 0. , 0. ) ;
$ { s [ a - 1 ] } = $ { s [ a - 1 ] } + 1 ;
if ( $ { s [ a - 1 ] } < $ { n [ a - 1 ] } ) {
result . g = getValue ( $ { s } ) ;
2021-04-28 14:55:26 +02:00
}
2021-04-28 14:58:21 +02:00
$ { s [ a - 2 ] } = $ { s [ a - 2 ] } + 1 ;
if ( $ { s [ a - 2 ] } < $ { n [ a - 2 ] } ) {
result . a = getValue ( $ { s } ) ;
2021-04-28 14:55:26 +02:00
}
2021-04-28 14:58:21 +02:00
$ { s [ a - 1 ] } = $ { s [ a - 1 ] } - 1 ;
if ( $ { s [ a - 2 ] } < $ { n [ a - 2 ] } &&
$ { s [ a - 1 ] } < $ { n [ a - 1 ] } ) {
result . b = getValue ( $ { s } ) ;
2021-04-28 14:55:26 +02:00
}
2021-04-28 14:58:21 +02:00
setOutput ( result ) ;
}
` }};function vh(e,t,n){let a=e.indexOf(t);return e.map((r,s)=>s===a? ` $ { r } - $ { n } ` :r).join()}function wh(e){let{inputs:t,backend:n}=e,{input:a}=t,r=n.texData.get(a.dataId);return Pn({inputs:{x:r.complexTensorInfos.imag},backend:n})}var RV={kernelName:jp,backendName:"webgl",kernelFunc:wh};function Ol(e,t,n){let a=e[0].dtype;if(a==="complex64"){let u=e.map(f=>yd({inputs:{input:f},backend:n})),p=e.map(f=>wh({inputs:{input:f},backend:n})),c=Ol(u,t,n),h=Ol(p,t,n),m=Lr({inputs:{real:c,imag:h},backend:n});return u.forEach(f=>n.disposeIntermediateTensorInfo(f)),p.forEach(f=>n.disposeIntermediateTensorInfo(f)),n.disposeIntermediateTensorInfo(c),n.disposeIntermediateTensorInfo(h),m}let r=n.shouldExecuteOnCPU(e);if(a==="string"&&(r=!0),r){let u=e.map(y=>{let g=k.sizeFromShape(y.shape.slice(t));return fe({inputs:{x:y},backend:n,attrs:{shape:[-1,g]}})}),p=u.map(y=>({vals:n.readSync(y.dataId),shape:y.shape})),c=C.computeOutShape(u.map(y=>y.shape),1),h=u[0].shape[0]===1,m=OL(p,c,a,h),f=C.computeOutShape(e.map(y=>y.shape),t),A=n.makeTensorInfo(f,a,m);return u.forEach(y=>n.disposeIntermediateTensorInfo(y)),A}if(e.length>J().getNumber("WEBGL_MAX_TEXTURES_IN_SHADER")){let u=Math.floor(e.length/2),p=Ol(e.slice(0,u),t,n),c=Ol(e.slice(u),t,n),h=Ol([p,c],t,n);return n.disposeIntermediateTensorInfo(p),n.disposeIntermediateTensorInfo(c),h}if(J().getBool("WEBGL_PACK_ARRAY_OPERATIONS")&&e[0].shape.length>1){let u=new CV(e.map(p=>p.shape),t);return n.runWebGLProgram(u,e,a)}let{tensors2D:s,outShape:i}=MV(e,t,n),o=new EV(s.map(u=>u.shape)),l=n.runWebGLProgram(o,s,a);s.forEach(u=>n.disposeIntermediateTensorInfo(u));let d=fe({inputs:{x:l},attrs:{shape:i},backend:n});return n.disposeIntermediateTensorInfo(l),d}function MV(e,t,n){let a=C.computeOutShape(e.map(r=>r.shape),t);return{tensors2D:e.map(r=>fe({inputs:{x:r},attrs:{shape:[-1,k.sizeFromShape(r.shape.slice(t))]},backend:n})),outShape:a}}function Lv(e){let{inputs:t,backend:n,attrs:a}=e,{axis:r}=a,s=k.parseAxisParam(r,t[0].shape)[0],i=C.computeOutShape(t.map(d=>d.shape),s);if(k.sizeFromShape(i)===0)return n.makeTensorInfo(i,t[0].dtype,[]);let o=t.filter(d=>k.sizeFromShape(d.shape)>0);if(o.length===1)return Pn({inputs:{x:o[0]},backend:n});let l=o.map(d=>d.shape);return C.assertParamsConsistent(l,s),Ol(o,s,n)}var FV={kernelName:po,backendName:"webgl",kernelFunc:Lv},Wv=class{constructor(e,t=!1,n=null,a=!1,r=!1){this.variableNames=["x","W"],this.outputShape=e.outShape;let s=e.padInfo.top,i=e.padInfo.left,o=e.strideHeight,l=e.strideWidth,d=e.dilationHeight,u=e.dilationWidth,p=e.filterHeight,c=e.filterWidth,h=Math.floor(e.inChannels/4)*4,m=e.inChannels%4,f=e.dataFormat==="channelsLast",A=f?1:2,y=f?2:3,g=f?3:1,x="",w="";n&&(a?x= ` float activation ( float a ) {
float b = getPreluActivationWeightsAtOutCoords ( ) ;
$ { n }
} ` :r?x= ` float activation ( float a ) {
float b = getLeakyreluAlphaAtOutCoords ( ) ;
$ { n }
} ` :x= `
float activation ( float x ) {
$ { n }
2021-04-28 14:55:26 +02:00
}
2021-04-28 14:58:21 +02:00
` ,w="result = activation(result);");let b=t?"result += getBiasAtOutCoords();":"";t&&this.variableNames.push("bias"),a&&this.variableNames.push("preluActivationWeights"),r&&this.variableNames.push("leakyreluAlpha"),this.userCode= `
$ { x }
const ivec2 strides = ivec2 ( $ { o } , $ { l } ) ;
const ivec2 pads = ivec2 ( $ { s } , $ { i } ) ;
void main ( ) {
ivec4 coords = getOutputCoords ( ) ;
int batch = coords [ 0 ] ;
int d2 = coords [ $ { g } ] ;
ivec2 xRCCorner =
ivec2 ( coords [ $ { A } ] , coords [ $ { y } ] ) * strides - pads ;
int xRCorner = xRCCorner . x ;
int xCCorner = xRCCorner . y ;
// Convolve x(?, ?, d1) with w(:, :, d1, d2) to get y(yR, yC, d2).
// ? = to be determined. : = across all values in that axis.
float dotProd = 0.0 ;
for ( int wR = 0 ; wR < $ { p } ; wR ++ ) {
int xR = xRCorner + wR * $ { d } ;
if ( xR < 0 || xR >= $ { e . inHeight } ) {
continue ;
2021-04-28 14:55:26 +02:00
}
2021-04-28 14:58:21 +02:00
for ( int wC = 0 ; wC < $ { c } ; wC ++ ) {
int xC = xCCorner + wC * $ { u } ;
if ( xC < 0 || xC >= $ { e . inWidth } ) {
continue ;
2021-04-28 14:55:26 +02:00
}
2021-04-28 14:58:21 +02:00
for ( int d1 = 0 ; d1 < $ { h } ; d1 += 4 ) {
vec4 wValues = vec4 (
getW ( wR , wC , d1 , d2 ) ,
getW ( wR , wC , d1 + 1 , d2 ) ,
getW ( wR , wC , d1 + 2 , d2 ) ,
getW ( wR , wC , d1 + 3 , d2 )
) ;
if ( $ { f } ) {
vec4 xValues = vec4 (
getX ( batch , xR , xC , d1 ) ,
getX ( batch , xR , xC , d1 + 1 ) ,
getX ( batch , xR , xC , d1 + 2 ) ,
getX ( batch , xR , xC , d1 + 3 )
) ;
dotProd += dot ( xValues , wValues ) ;
2021-04-28 14:55:26 +02:00
} else {
2021-04-28 14:58:21 +02:00
vec4 xValues = vec4 (
getX ( batch , d1 , xR , xC ) ,
getX ( batch , d1 + 1 , xR , xC ) ,
getX ( batch , d1 + 2 , xR , xC ) ,
getX ( batch , d1 + 3 , xR , xC )
) ;
dotProd += dot ( xValues , wValues ) ;
2021-04-19 22:19:03 +02:00
}
2021-04-17 00:03:15 +02:00
}
2021-04-28 14:58:21 +02:00
if ( $ { m === 1 } ) {
if ( $ { f } ) {
dotProd +=
getX ( batch , xR , xC , $ { h } ) *
getW ( wR , wC , $ { h } , d2 ) ;
} else {
dotProd +=
getX ( batch , $ { h } , xR , xC ) *
getW ( wR , wC , $ { h } , d2 ) ;
2021-04-28 14:55:26 +02:00
}
2021-04-28 14:58:21 +02:00
} else if ( $ { m === 2 } ) {
vec2 wValues = vec2 (
getW ( wR , wC , $ { h } , d2 ) ,
getW ( wR , wC , $ { h } + 1 , d2 )
) ;
if ( $ { f } ) {
vec2 xValues = vec2 (
getX ( batch , xR , xC , $ { h } ) ,
getX ( batch , xR , xC , $ { h } + 1 )
) ;
dotProd += dot ( xValues , wValues ) ;
2021-04-28 14:55:26 +02:00
} else {
2021-04-28 14:58:21 +02:00
vec2 xValues = vec2 (
getX ( batch , $ { h } , xR , xC ) ,
getX ( batch , $ { h } + 1 , xR , xC )
) ;
dotProd += dot ( xValues , wValues ) ;
2021-04-28 14:55:26 +02:00
}
2021-04-28 14:58:21 +02:00
} else if ( $ { m === 3 } ) {
vec3 wValues = vec3 (
getW ( wR , wC , $ { h } , d2 ) ,
getW ( wR , wC , $ { h } + 1 , d2 ) ,
getW ( wR , wC , $ { h } + 2 , d2 )
) ;
if ( $ { f } ) {
vec3 xValues = vec3 (
getX ( batch , xR , xC , $ { h } ) ,
getX ( batch , xR , xC , $ { h } + 1 ) ,
getX ( batch , xR , xC , $ { h } + 2 )
) ;
dotProd += dot ( xValues , wValues ) ;
2021-04-28 14:55:26 +02:00
} else {
2021-04-28 14:58:21 +02:00
vec3 xValues = vec3 (
getX ( batch , $ { h } , xR , xC ) ,
getX ( batch , $ { h } + 1 , xR , xC ) ,
getX ( batch , $ { h } + 2 , xR , xC )
) ;
dotProd += dot ( xValues , wValues ) ;
2021-04-28 14:55:26 +02:00
}
2021-04-28 14:58:21 +02:00
2021-04-28 14:55:26 +02:00
}
2021-04-19 22:02:47 +02:00
}
}
2021-04-28 14:58:21 +02:00
float result = dotProd ;
$ { b }
$ { w }
setOutput ( result ) ;
}
` }}, $ V=class{constructor(e){this.variableNames=["x","W"],this.outputShape=e.outShape;let t=e.padInfo.front,n=e.padInfo.top,a=e.padInfo.left,r=e.strideDepth,s=e.strideHeight,i=e.strideWidth,o=e.dilationDepth,l=e.dilationHeight,d=e.dilationWidth,u=e.filterDepth,p=e.filterHeight,c=e.filterWidth,h=Math.floor(e.inChannels/4)*4,m=e.inChannels%4;this.userCode= `
const ivec3 strides = ivec3 ( $ { r } , $ { s } , $ { i } ) ;
const ivec3 pads = ivec3 ( $ { t } , $ { n } , $ { a } ) ;
void main ( ) {
ivec5 coords = getOutputCoords ( ) ;
int batch = coords . x ;
int d2 = coords . u ;
ivec3 xFRCCorner = ivec3 ( coords . y , coords . z , coords . w ) * strides - pads ;
int xFCorner = xFRCCorner . x ;
int xRCorner = xFRCCorner . y ;
int xCCorner = xFRCCorner . z ;
// Convolve x(?, ?, ?, d1) with w(:, :, :, d1, d2) to get
// y(yF, yR, yC, d2). ? = to be determined. : = across all
// values in that axis.
float dotProd = 0.0 ;
for ( int wF = 0 ; wF < $ { u } ; wF ++ ) {
int xF = xFCorner + wF * $ { o } ;
if ( xF < 0 || xF >= $ { e . inDepth } ) {
continue ;
}
for ( int wR = 0 ; wR < $ { p } ; wR ++ ) {
int xR = xRCorner + wR * $ { l } ;
if ( xR < 0 || xR >= $ { e . inHeight } ) {
continue ;
2021-04-28 14:55:26 +02:00
}
2021-04-28 14:58:21 +02:00
for ( int wC = 0 ; wC < $ { c } ; wC ++ ) {
int xC = xCCorner + wC * $ { d } ;
if ( xC < 0 || xC >= $ { e . inWidth } ) {
continue ;
}
for ( int d1 = 0 ; d1 < $ { h } ; d1 += 4 ) {
vec4 xValues = vec4 (
getX ( batch , xF , xR , xC , d1 ) ,
getX ( batch , xF , xR , xC , d1 + 1 ) ,
getX ( batch , xF , xR , xC , d1 + 2 ) ,
getX ( batch , xF , xR , xC , d1 + 3 )
) ;
vec4 wValues = vec4 (
getW ( wF , wR , wC , d1 , d2 ) ,
getW ( wF , wR , wC , d1 + 1 , d2 ) ,
getW ( wF , wR , wC , d1 + 2 , d2 ) ,
getW ( wF , wR , wC , d1 + 3 , d2 )
) ;
dotProd += dot ( xValues , wValues ) ;
}
if ( $ { m === 1 } ) {
dotProd +=
getX ( batch , xF , xR , xC , $ { h } ) *
getW ( wF , wR , wC , $ { h } , d2 ) ;
} else if ( $ { m === 2 } ) {
vec2 xValues = vec2 (
getX ( batch , xF , xR , xC , $ { h } ) ,
getX ( batch , xF , xR , xC , $ { h } + 1 )
) ;
vec2 wValues = vec2 (
getW ( wF , wR , wC , $ { h } , d2 ) ,
getW ( wF , wR , wC , $ { h } + 1 , d2 )
) ;
dotProd += dot ( xValues , wValues ) ;
} else if ( $ { m === 3 } ) {
vec3 xValues = vec3 (
getX ( batch , xF , xR , xC , $ { h } ) ,
getX ( batch , xF , xR , xC , $ { h } + 1 ) ,
getX ( batch , xF , xR , xC , $ { h } + 2 )
) ;
vec3 wValues = vec3 (
getW ( wF , wR , wC , $ { h } , d2 ) ,
getW ( wF , wR , wC , $ { h } + 1 , d2 ) ,
getW ( wF , wR , wC , $ { h } + 2 , d2 )
) ;
dotProd += dot ( xValues , wValues ) ;
}
2021-04-19 22:02:47 +02:00
}
}
}
2021-04-28 14:58:21 +02:00
setOutput ( dotProd ) ;
}
` }},DV=class{constructor(e,t,n){this.variableNames=["A"],this.packedInputs=!0,this.packedOutput=!0,this.outputShape=e;let{filterWidth:a,inChannels:r,strideWidth:s,strideHeight:i,padInfo:o,outWidth:l,dilationWidth:d,dilationHeight:u,dataFormat:p}=n,{left:c,top:h}=o,m=r*a,f=dn(),A=p==="channelsLast",y=A?0:1,g=A?1:2,x="";for(let w=0;w<=1;w++)for(let b=0;b<=1;b++)x+= `
blockIndex = rc . y + $ { b } ;
pos = rc . x + $ { w } ;
if ( blockIndex < $ { e [ 1 ] } && pos < $ { e [ 0 ] } ) {
offsetY = int ( blockIndex / ( $ { l } ) ) * $ { i } - $ { h } ;
d0 = offsetY + $ { u } * ( pos / $ { m } ) ;
if ( d0 < $ { t [ y ] } && d0 >= 0 ) {
offsetX = int ( mod ( float ( blockIndex ) , $ { l } . ) * $ { s } . - $ { c } . ) ;
d1 = offsetX + $ { d } * ( int ( mod ( float ( pos ) , $ { m } . ) / $ { r } . ) ) ;
if ( d1 < $ { t [ g ] } && d1 >= 0 ) {
ch = int ( mod ( float ( pos ) , $ { r } . ) ) ;
if ( $ { A } ) {
innerDims = vec2 ( d1 , ch ) ;
result [ $ { w * 2 + b } ] = getChannel (
getA ( d0 , int ( innerDims . x ) ,
int ( innerDims . y ) ) , innerDims ) ;
} else {
innerDims = vec2 ( d0 , d1 ) ;
result [ $ { w * 2 + b } ] = getChannel (
getA ( ch , int ( innerDims . x ) ,
int ( innerDims . y ) ) , innerDims ) ;
}
}
2021-04-28 14:55:26 +02:00
}
2021-04-19 22:19:03 +02:00
}
2021-04-28 14:58:21 +02:00
` ;this.userCode= `
void main ( ) {
ivec2 rc = getOutputCoords ( ) ;
vec4 result = vec4 ( 0 ) ;
int blockIndex , pos , offsetY , d0 , offsetX , d1 , ch ;
vec2 innerDims ;
$ { x }
$ { f . output } = result ;
}
` }};function Bv({x:e,filter:t,convInfo:n,backend:a,bias:r=null,preluActivationWeights:s=null,leakyreluAlpha:i=0,activation:o=null}){let l=e.shape,d=a.texData.get(e.dataId),u=n.inChannels,p=l[0]*l[1]*l[2],c=n.outChannels,h=n.dataFormat==="channelsLast",m=!1,f=!1,A,y=[],g=(p===1||c===1)&&u>Rv,x=l[2]%2!=0&&!!d.isPacked;if(g||!J().getBool("WEBGL_LAZILY_UNPACK")||!J().getBool("WEBGL_PACK_BINARY_OPERATIONS")||!x){let w=h?l[0]*l[1]*l[2]:l[0]*l[2]*l[3],b=fe({inputs:{x:e},backend:a,attrs:{shape:[1,w,n.inChannels]}}),v=fe({inputs:{x:t},backend:a,attrs:{shape:[1,n.inChannels,n.outChannels]}}),I=xh({a:b,b:v,transposeA:m,transposeB:f,backend:a,bias:r,activation:o,preluActivationWeights:s,leakyreluAlpha:i});A=fe({inputs:{x:I},backend:a,attrs:{shape:n.outShape}}),y.push(b),y.push(v),y.push(I)}else{let w=h?l[0]*l[1]*(l[2]+1):l[0]*l[2]*(l[3]+1),b={dataId:e.dataId,shape:[1,w,n.inChannels],dtype:e.dtype},v=d.shape;d.shape=d.shape.slice(),d.shape[d.shape.length-2]++,k.assert(ud(d.shape,b.shape),()=> ` packed reshape $ { d . shape } to $ { b . shape } isn ' t free ` );let I=fe({inputs:{x:t},backend:a,attrs:{shape:[1,n.inChannels,n.outChannels]}});y.push(I);let T=xh({a:b,b:I,backend:a,transposeA:m,transposeB:f,bias:r,activation:o,preluActivationWeights:s,leakyreluAlpha:i}),R=a.texData.get(T.dataId);k.assert(R.isPacked,()=>"batchMatMul result is expected to be packed"),d.shape=v,R.shape=n.outShape,A=Pn({inputs:{x:T},backend:a}),A.shape=n.outShape,y.push(T)}for(let w of y)a.disposeIntermediateTensorInfo(w);return A}function Vv({x:e,filter:t,convInfo:n,backend:a,bias:r=null,preluActivationWeights:s=null,leakyreluAlpha:i=0,activation:o=null}){let{filterWidth:l,filterHeight:d,inChannels:u,outWidth:p,outHeight:c,dataFormat:h}=n,m=h==="channelsLast",f=l*d*u,A=c*p,y=[f,A],g=!0,x=!1,w=[],b=fe({inputs:{x:e},backend:a,attrs:{shape:e.shape.slice(1)}}),v=fe({inputs:{x:t},backend:a,attrs:{shape:[1,f,k.sizeFromShape(t.shape)/f]}});w.push(b),w.push(v);let I=new DV(y,b.shape,n),T=a.runWebGLProgram(I,[b],"float32"),R=fe({inputs:{x:T},backend:a,attrs:{shape:[1,y[0],y[1]]}});w.push(T),w.push(R);let $ =r!=null,O=s!=null,_=o==="leakyrelu",V=o?Ah(o,!0):null,j=new Sv(R.shape,v.shape,[1,A,n.outChannels],g,x, $ ,V,O,_),U=[R,v];if(r&&U.push(r),O&&U.push(s),_){let Y=a.makeTensorInfo([],"float32",k.createScalarValue(i,"float32"));U.push(Y),w.push(Y)}let X=a.runWebGLProgram(j,U,"float32"),G=m?[1,c,p,n.outChannels]:[1,n.outChannels,c,p],ee=fe({inputs:{x:X},backend:a,attrs:{shape:G}});w.push(X);for(let Y of w)a.disposeIntermediateTensorInfo(Y);return ee}function OV(e){let{inputs:t,backend:n,attrs:a}=e,{x:r,filter:s}=t,{strides:i,pad:o,dataFormat:l,dilations:d,dimRoundingMode:u}=a,p=C.convertConv2DDataFormat(l),c=C.computeConv2DInfo(r.shape,s.shape,i,d,o,u,!1,p),h;if(c.filterHeight===1&&c.filterWidth===1&&c.dilationHeight===1&&c.dilationWidth===1&&c.strideHeight===1&&c.strideWidth===1&&(c.padInfo.type==="SAME"||c.padInfo.type==="VALID"))h=Bv({x:r,filter:s,convInfo:c,backend:n});else if(J().getBool("WEBGL_CONV_IM2COL")&&r.shape[0]===1)h=Vv({x:r,filter:s,convInfo:c,backend:n});else{let f=new Wv(c);h=n.runWebGLProgram(f,[r,s],"float32")}let m=fe({inputs:{x:h},backend:n,attrs:{shape:c.outShape}});return n.disposeIntermediateTensorInfo(h),m}var zV={kernelName:cs,backendName:"webgl",kernelFunc:OV},_V=class{constructor(e){this.variableNames=["x","dy"],this.outputShape=e.filterShape;let t=e.strideHeight,n=e.strideWidth,a=e.padInfo.top,r=e.padInfo.left,s=e.dataFormat==="channelsLast";this.userCode= `
void main ( ) {
ivec4 coords = getOutputCoords ( ) ;
int wR = coords . x ;
int wC = coords . y ;
int d1 = coords . z ;
int d2 = coords . w ;
// Convolve x(?, ?, d1) with dy(:, :, d2) to get dw(wR, wC, d1, d2).
// ? = to be determined. : = across all values in that axis.
float dotProd = 0.0 ;
for ( int b = 0 ; b < $ { e . batchSize } ; b ++ ) {
for ( int yR = 0 ; yR < $ { e . outHeight } ; yR ++ ) {
int xR = wR + yR * $ { t } - $ { a } ;
if ( xR < 0 || xR >= $ { e . inHeight } ) {
continue ;
2021-04-19 22:19:03 +02:00
}
2021-04-28 14:58:21 +02:00
for ( int yC = 0 ; yC < $ { e . outWidth } ; yC ++ ) {
int xC = wC + yC * $ { n } - $ { r } ;
if ( xC < 0 || xC >= $ { e . inWidth } ) {
continue ;
}
if ( $ { s } ) {
float dyValue = getDy ( b , yR , yC , d2 ) ;
float xValue = getX ( b , xR , xC , d1 ) ;
dotProd += ( xValue * dyValue ) ;
} else {
float dyValue = getDy ( b , d2 , yR , yC ) ;
float xValue = getX ( b , d1 , xR , xC ) ;
dotProd += ( xValue * dyValue ) ;
2021-04-28 14:55:26 +02:00
}
2021-04-28 14:58:21 +02:00
2021-04-19 22:19:03 +02:00
}
}
2021-04-28 14:55:26 +02:00
}
2021-04-28 14:58:21 +02:00
setOutput ( dotProd ) ;
}
` }},PV=class{constructor(e){this.variableNames=["dy","W"],this.outputShape=e.inShape;let t=e.filterHeight,n=e.filterWidth,a=e.strideHeight,r=e.strideWidth,s=e.dataFormat==="channelsLast",i=t-1-e.padInfo.top,o=n-1-e.padInfo.left,l=s?1:2,d=s?2:3,u=s?3:1;this.userCode= `
const ivec2 pads = ivec2 ( $ { i } , $ { o } ) ;
void main ( ) {
ivec4 coords = getOutputCoords ( ) ;
int batch = coords [ 0 ] ;
int d1 = coords [ $ { u } ] ;
ivec2 dyCorner = ivec2 ( coords [ $ { l } ] , coords [ $ { d } ] ) - pads ;
int dyRCorner = dyCorner . x ;
int dyCCorner = dyCorner . y ;
// Convolve dy(?, ?, d2) with w(:, :, d1, d2) to compute dx(xR, xC, d1).
// ? = to be determined. : = across all values in that axis.
float dotProd = 0.0 ;
for ( int wR = 0 ; wR < $ { t } ; wR ++ ) {
float dyR = float ( dyRCorner + wR ) / $ { a } . 0 ;
if ( dyR < 0.0 || dyR >= $ { e . outHeight } . 0 || fract ( dyR ) > 0.0 ) {
continue ;
2021-04-28 14:55:26 +02:00
}
2021-04-28 14:58:21 +02:00
int idyR = int ( dyR ) ;
int wRPerm = $ { t } - 1 - wR ;
for ( int wC = 0 ; wC < $ { n } ; wC ++ ) {
float dyC = float ( dyCCorner + wC ) / $ { r } . 0 ;
if ( dyC < 0.0 || dyC >= $ { e . outWidth } . 0 ||
fract ( dyC ) > 0.0 ) {
2021-04-19 22:19:03 +02:00
continue ;
}
2021-04-28 14:58:21 +02:00
int idyC = int ( dyC ) ;
int wCPerm = $ { n } - 1 - wC ;
for ( int d2 = 0 ; d2 < $ { e . outChannels } ; d2 ++ ) {
if ( $ { s } ) {
float xValue = getDy ( batch , idyR , idyC , d2 ) ;
float wValue = getW ( wRPerm , wCPerm , d1 , d2 ) ;
dotProd += xValue * wValue ;
2021-04-28 14:55:26 +02:00
} else {
2021-04-28 14:58:21 +02:00
float xValue = getDy ( batch , d2 , idyR , idyC ) ;
float wValue = getW ( wRPerm , wCPerm , d1 , d2 ) ;
dotProd += xValue * wValue ;
2021-04-19 22:19:03 +02:00
}
2021-04-28 14:58:21 +02:00
2021-04-19 22:19:03 +02:00
}
}
2021-04-28 14:55:26 +02:00
}
2021-04-28 14:58:21 +02:00
setOutput ( dotProd ) ;
}
` }},LV=class{constructor(e){this.variableNames=["x","dy"],this.outputShape=e.filterShape;let t=e.strideDepth,n=e.strideHeight,a=e.strideWidth,r=e.padInfo.front,s=e.padInfo.top,i=e.padInfo.left;this.userCode= `
void main ( ) {
ivec5 coords = getOutputCoords ( ) ;
int wF = coords . x ;
int wR = coords . y ;
int wC = coords . z ;
int d1 = coords . w ;
int d2 = coords . u ;
float dotProd = 0.0 ;
for ( int b = 0 ; b < $ { e . batchSize } ; b ++ ) {
for ( int yF = 0 ; yF < $ { e . outDepth } ; yF ++ ) {
int xF = wF + yF * $ { t } - $ { r } ;
if ( xF < 0 || xF >= $ { e . inDepth } ) {
continue ;
}
for ( int yR = 0 ; yR < $ { e . outHeight } ; yR ++ ) {
int xR = wR + yR * $ { n } - $ { s } ;
if ( xR < 0 || xR >= $ { e . inHeight } ) {
continue ;
}
for ( int yC = 0 ; yC < $ { e . outWidth } ; yC ++ ) {
int xC = wC + yC * $ { a } - $ { i } ;
if ( xC < 0 || xC >= $ { e . inWidth } ) {
continue ;
}
float dyValue = getDy ( b , yF , yR , yC , d2 ) ;
float xValue = getX ( b , xF , xR , xC , d1 ) ;
dotProd += ( xValue * dyValue ) ;
}
2021-04-19 22:19:03 +02:00
}
}
}
2021-04-28 14:58:21 +02:00
setOutput ( dotProd ) ;
}
` }},WV=class{constructor(e){this.variableNames=["dy","W"],this.outputShape=e.inShape;let t=e.filterDepth,n=e.filterHeight,a=e.filterWidth,r=e.strideDepth,s=e.strideHeight,i=e.strideWidth,o=t-1-e.padInfo.front,l=n-1-e.padInfo.top,d=a-1-e.padInfo.left;this.userCode= `
const ivec3 pads = ivec3 ( $ { o } , $ { l } , $ { d } ) ;
void main ( ) {
ivec5 coords = getOutputCoords ( ) ;
int batch = coords . x ;
int d1 = coords . u ;
ivec3 dyCorner = ivec3 ( coords . y , coords . z , coords . w ) - pads ;
int dyFCorner = dyCorner . x ;
int dyRCorner = dyCorner . y ;
int dyCCorner = dyCorner . z ;
float dotProd = 0.0 ;
for ( int wF = 0 ; wF < $ { t } ; wF ++ ) {
float dyF = float ( dyFCorner + wF ) / $ { r } . 0 ;
if ( dyF < 0.0 || dyF >= $ { e . outDepth } . 0 || fract ( dyF ) > 0.0 ) {
continue ;
2021-04-19 22:19:03 +02:00
}
2021-04-28 14:58:21 +02:00
int idyF = int ( dyF ) ;
int wFPerm = $ { t } - 1 - wF ;
for ( int wR = 0 ; wR < $ { n } ; wR ++ ) {
float dyR = float ( dyRCorner + wR ) / $ { s } . 0 ;
if ( dyR < 0.0 || dyR >= $ { e . outHeight } . 0 ||
fract ( dyR ) > 0.0 ) {
continue ;
2021-04-19 22:19:03 +02:00
}
2021-04-28 14:58:21 +02:00
int idyR = int ( dyR ) ;
int wRPerm = $ { n } - 1 - wR ;
for ( int wC = 0 ; wC < $ { a } ; wC ++ ) {
float dyC = float ( dyCCorner + wC ) / $ { i } . 0 ;
if ( dyC < 0.0 || dyC >= $ { e . outWidth } . 0 ||
fract ( dyC ) > 0.0 ) {
continue ;
}
int idyC = int ( dyC ) ;
int wCPerm = $ { a } - 1 - wC ;
for ( int d2 = 0 ; d2 < $ { e . outChannels } ; d2 ++ ) {
float xValue = getDy ( batch , idyF , idyR , idyC , d2 ) ;
float wValue = getW ( wFPerm , wRPerm , wCPerm , d1 , d2 ) ;
dotProd += xValue * wValue ;
}
2021-04-19 22:19:03 +02:00
}
}
2021-04-28 14:55:26 +02:00
}
2021-04-28 14:58:21 +02:00
setOutput ( dotProd ) ;
2021-04-28 14:55:26 +02:00
}
2021-04-28 14:58:21 +02:00
` }};function BV(e){let{inputs:t,backend:n,attrs:a}=e,{x:r,dy:s}=t,{strides:i,pad:o,dataFormat:l,dimRoundingMode:d,filterShape:u}=a,p=C.convertConv2DDataFormat(l),c=C.computeConv2DInfo(r.shape,u,i,1,o,d,!1,p),h=new _V(c);return n.runWebGLProgram(h,[r,s],"float32")}var VV={kernelName:Rp,backendName:"webgl",kernelFunc:BV};function jV(e){let{inputs:t,backend:n,attrs:a}=e,{dy:r,filter:s}=t,{inputShape:i,strides:o,pad:l,dataFormat:d,dimRoundingMode:u}=a,p=C.convertConv2DDataFormat(d),c=C.computeConv2DInfo(i,s.shape,o,1,l,u,!1,p),h=new PV(c);return n.runWebGLProgram(h,[r,s],"float32")}var UV={kernelName:hs,backendName:"webgl",kernelFunc:jV};function HV(e){let{inputs:t,backend:n,attrs:a}=e,{x:r,filter:s}=t,{strides:i,pad:o,dilations:l}=a,d=C.computeConv3DInfo(r.shape,s.shape,i,l,o),u=new $ V(d);return n.runWebGLProgram(u,[r,s],"float32")}var GV={kernelName:yu,backendName:"webgl",kernelFunc:HV};function qV(e){let{inputs:t,backend:n,attrs:a}=e,{x:r,dy:s}=t,{strides:i,pad:o,filterShape:l}=a,d=C.computeConv3DInfo(r.shape,l,i,1,o),u=new LV(d);return n.runWebGLProgram(u,[r,s],"float32")}var XV={kernelName:Mp,backendName:"webgl",kernelFunc:qV};function KV(e){let{inputs:t,backend:n,attrs:a}=e,{dy:r,filter:s}=t,{pad:i,strides:o,inputShape:l}=a,d=C.computeConv3DInfo(l,s.shape,o,1,i),u=new WV(d);return n.runWebGLProgram(u,[r,s],"float32")}var ZV={kernelName:Fp,backendName:"webgl",kernelFunc:KV},YV=Iv+ `
return cos ( x ) ;
` ,JV=qe({opSnippet:YV}),QV={kernelName:fs,backendName:"webgl",kernelFunc:JV},ej= `
float e2x = exp ( - x ) ;
return ( e2x + 1.0 / e2x ) / 2.0 ;
` ,tj=qe({opSnippet:ej}),nj={kernelName:co,backendName:"webgl",kernelFunc:tj},aj=class{constructor(e,t,n,a,r){this.variableNames=["Image","Boxes","BoxInd"],this.outputShape=[];let[s,i,o,l]=e,[d]=t,[u,p]=n;this.outputShape=[d,u,p,l];let c=a==="bilinear"?1:0,[h,m]=[ ` $ { i - 1 } . 0 ` , ` $ { o - 1 } . 0 ` ],[f,A,y]=u>1?[ ` $ { ( i - 1 ) / ( u - 1 ) } ` ,"(y2-y1) * height_ratio", ` y1 * $ { h } + float ( y ) * ( height _scale ) ` ]:["0.0","0.0", ` 0.5 * ( y1 + y2 ) * $ { h } ` ],[g,x,w]=p>1?[ ` $ { ( o - 1 ) / ( p - 1 ) } ` ,"(x2-x1) * width_ratio", ` x1 * $ { m } + float ( x ) * ( width _scale ) ` ]:["0.0","0.0", ` 0.5 * ( x1 + x2 ) * $ { m } ` ];this.userCode= `
const float height _ratio = float ( $ { f } ) ;
const float width _ratio = float ( $ { g } ) ;
void main ( ) {
ivec4 coords = getOutputCoords ( ) ;
int b = coords [ 0 ] ;
int y = coords [ 1 ] ;
int x = coords [ 2 ] ;
int d = coords [ 3 ] ;
// get box vals
float y1 = getBoxes ( b , 0 ) ;
float x1 = getBoxes ( b , 1 ) ;
float y2 = getBoxes ( b , 2 ) ;
float x2 = getBoxes ( b , 3 ) ;
// get image in batch index
int bInd = round ( getBoxInd ( b ) ) ;
if ( bInd < 0 || bInd >= $ { s } ) {
return ;
2021-04-28 14:55:26 +02:00
}
2021-04-28 14:58:21 +02:00
float height _scale = $ { A } ;
float width _scale = $ { x } ;
float in _y = $ { y } ;
if ( in _y < 0.0 || in _y > $ { h } ) {
setOutput ( float ( $ { r } ) ) ;
return ;
2021-04-19 22:19:03 +02:00
}
2021-04-28 14:58:21 +02:00
float in _x = $ { w } ;
if ( in _x < 0.0 || in _x > $ { m } ) {
setOutput ( float ( $ { r } ) ) ;
return ;
2021-04-19 22:19:03 +02:00
}
2021-04-28 14:58:21 +02:00
vec2 sourceFracIndexCR = vec2 ( in _x , in _y ) ;
if ( $ { c } == 1 ) {
// Compute the four integer indices.
ivec2 sourceFloorCR = ivec2 ( sourceFracIndexCR ) ;
ivec2 sourceCeilCR = ivec2 ( ceil ( sourceFracIndexCR ) ) ;
float topLeft = getImage ( b , sourceFloorCR . y , sourceFloorCR . x , d ) ;
float bottomLeft = getImage ( b , sourceCeilCR . y , sourceFloorCR . x , d ) ;
float topRight = getImage ( b , sourceFloorCR . y , sourceCeilCR . x , d ) ;
float bottomRight = getImage ( b , sourceCeilCR . y , sourceCeilCR . x , d ) ;
vec2 fracCR = sourceFracIndexCR - vec2 ( sourceFloorCR ) ;
float top = topLeft + ( topRight - topLeft ) * fracCR . x ;
float bottom = bottomLeft + ( bottomRight - bottomLeft ) * fracCR . x ;
float newValue = top + ( bottom - top ) * fracCR . y ;
setOutput ( newValue ) ;
2021-04-19 22:19:03 +02:00
} else {
2021-04-28 14:58:21 +02:00
// Compute the coordinators of nearest neighbor point.
ivec2 sourceNearestCR = ivec2 ( floor (
sourceFracIndexCR + vec2 ( 0.5 , 0.5 ) ) ) ;
float newValue = getImage ( b , sourceNearestCR . y , sourceNearestCR . x , d ) ;
setOutput ( newValue ) ;
2021-04-19 22:19:03 +02:00
}
2021-04-19 22:02:47 +02:00
}
2021-04-28 14:58:21 +02:00
` }},rj=e=>{let{inputs:t,backend:n,attrs:a}=e,{image:r,boxes:s,boxInd:i}=t,{cropSize:o,method:l,extrapolationValue:d}=a,u=new aj(r.shape,s.shape,o,l,d);return n.runWebGLProgram(u,[r,s,i],"float32")},sj={kernelName:ho,backendName:"webgl",kernelFunc:rj},Hv=class{constructor(e,t,n){this.variableNames=["x"],this.outputShape=e;let a=e.length,r=t?"0.0": ` getX ( $ { jv ( a , "coords" ) } ) ` ,s=e[e.length-1],i="",o="";t?(i=n? ` end != $ { s - 1 } ` :"end != 0",o=n?"end + 1":"end - 1"):(i=n? ` end + pow2 < $ { s } ` :"end >= pow2",o=n?"end + pow2":"end - pow2"),this.userCode= `
uniform float index ;
void main ( ) {
$ { lt ( a ) } coords = getOutputCoords ( ) ;
int end = $ { Uv ( a , "coords" ) } ;
float val = $ { r } ;
int pow2 = int ( pow ( 2.0 , index ) ) ;
if ( $ { i } ) {
int idx = $ { o } ;
$ { Uv ( a , "coords" ) } = idx ;
val += getX ( $ { jv ( a , "coords" ) } ) ;
2021-04-28 14:55:26 +02:00
}
2021-04-28 14:58:21 +02:00
setOutput ( val ) ;
2021-04-19 22:02:47 +02:00
}
2021-04-28 14:58:21 +02:00
` }getCustomSetupFunc(e){return(t,n)=>{this.index==null&&(this.index=t.getUniformLocation(n,"index")),t.gl.uniform1f(this.index,e)}}};function jv(e,t){if(e===1)return ` $ { t } ` ;if(e===2)return ` $ { t } . x , $ { t } . y ` ;if(e===3)return ` $ { t } . x , $ { t } . y , $ { t } . z ` ;if(e===4)return ` $ { t } . x , $ { t } . y , $ { t } . z , $ { t } . w ` ;throw Error( ` Cumulative sum for rank $ { e } is not yet supported ` )}function Uv(e,t){if(e===1)return ` $ { t } ` ;if(e===2)return ` $ { t } . y ` ;if(e===3)return ` $ { t } . z ` ;if(e===4)return ` $ { t } . w ` ;throw Error( ` Cumulative sum for rank $ { e } is not yet supported ` )}function ij(e){let{inputs:t,backend:n,attrs:a}=e,{x:r}=t,{axis:s,exclusive:i,reverse:o}=a,l=r.shape.length,d=C.getAxesPermutation([s],l),u=r;d!=null&&(u=cn({inputs:{x:r},backend:n,attrs:{perm:d}}));let p=C.getInnerMostAxes(1,l)[0];if(p!==l-1)throw new Error( ` WebGL cumsum shader expects an inner - most axis = $ { r . shape . length - 1 } but got axis = $ { s } ` );let c=u.shape[p],h=Pn({inputs:{x:u},backend:n});for(let m=0;m<=Math.ceil(Math.log2(c))-1;m++){let f=new Hv(u.shape,!1,o),A=f.getCustomSetupFunc(m),y=h;h=n.runWebGLProgram(f,[h],h.dtype,A),n.disposeIntermediateTensorInfo(y)}if(i){let m=new Hv(u.shape,i,o),f=h;h=n.runWebGLProgram(m,[h],h.dtype),n.disposeIntermediateTensorInfo(f)}if(d!=null){let m=C.getUndoAxesPermutation(d),f=cn({inputs:{x:h},backend:n,attrs:{perm:m}});return n.disposeIntermediateTensorInfo(h),n.disposeIntermediateTensorInfo(u),f}return h}var oj={kernelName:ms,backendName:"webgl",kernelFunc:ij};function lj(e){let{inputs:t,backend:n,attrs:a}=e,{x:r,weights:s}=t,{size:i,binaryOutput:o}=a;if(r.shape.length===1){let l=n.readSync(r.dataId),d=n.readSync(s.dataId),u=uv(l,d,s.dtype,s.shape,i);return n.makeTensorInfo([i],s.dtype,u)}else if(r.shape.length===2){let l=n.bufferSync(r),d=n.bufferSync(s),u= $ L(l,d,i,o);return n.makeTensorInfo(u.shape,s.dtype,u.values)}throw new Error( ` Error in denseBincount : input must be at most rank 2 , but got rank$ { r . shape . length } . ` )}var uj={kernelName: $ p,backendName:"webgl",kernelFunc:lj},dj=class{constructor(e,t,n){this.variableNames=["x"],this.outputShape=[],this.outputShape=e,this.blockSize=t,this.dataFormat=n,this.userCode= `
void main ( ) {
ivec4 coords = getOutputCoords ( ) ;
int b = coords [ 0 ] ;
int h = $ { this . getHeightCoordString ( ) } ;
int w = $ { this . getWidthCoordString ( ) } ;
int d = $ { this . getDepthCoordString ( ) } ;
int in _h = h / $ { t } ;
int offset _h = imod ( h , $ { t } ) ;
int in _w = w / $ { t } ;
int offset _w = imod ( w , $ { t } ) ;
int offset _d = ( offset _h * $ { t } + offset _w ) *
$ { this . getOutputDepthSize ( ) } ;
int in _d = d + offset _d ;
float result = $ { this . getInputSamplingString ( ) } ;
setOutput ( result ) ;
}
` }getHeightCoordString(){return this.dataFormat==="NHWC"?"coords[1]":"coords[2]"}getWidthCoordString(){return this.dataFormat==="NHWC"?"coords[2]":"coords[3]"}getDepthCoordString(){return this.dataFormat==="NHWC"?"coords[3]":"coords[1]"}getOutputDepthSize(){return this.dataFormat==="NHWC"?this.outputShape[3]:this.outputShape[1]}getInputSamplingString(){return this.dataFormat==="NHWC"?"getX(b, in_h, in_w, in_d)":"getX(b, in_d, in_h, in_w)"}};function pj(e){let{inputs:t,backend:n,attrs:a}=e,{x:r}=t,{blockSize:s,dataFormat:i}=a;k.assert(s>1,()=> ` blockSize should be > 1 for depthToSpace , but was : $ { s } ` );let o=r.shape[0],l=i==="NHWC"?r.shape[1]:r.shape[2],d=i==="NHWC"?r.shape[2]:r.shape[3],u=i==="NHWC"?r.shape[3]:r.shape[1],p=l*s,c=d*s,h=u/(s*s),m=i==="NHWC"?[o,p,c,h]:[o,h,p,c],f=new dj(m,s,i);return n.runWebGLProgram(f,[r],r.dtype)}var cj={kernelName:fo,backendName:"webgl",kernelFunc:pj},Gv=class{constructor(e,t=!1,n=null,a=!1,r=!1){this.variableNames=["x","W"],this.outputShape=e.outShape;let s=e.inHeight,i=e.inWidth,o=e.padInfo.top,l=e.padInfo.left,d=e.strideHeight,u=e.strideWidth,p=e.dilationHeight,c=e.dilationWidth,h=e.filterHeight,m=e.filterWidth,f=e.outChannels/e.inChannels,A="",y="";n&&(a?A= ` float activation ( float a ) {
float b = getPreluActivationWeightsAtOutCoords ( ) ;
$ { n }
} ` :r?A= ` float activation ( float a ) {
float b = getLeakyreluAlphaAtOutCoords ( ) ;
$ { n }
} ` :A= `
float activation ( float x ) {
$ { n }
2021-04-28 14:55:26 +02:00
}
2021-04-28 14:58:21 +02:00
` ,y="result = activation(result);");let g=t?"result += getBiasAtOutCoords();":"";t&&this.variableNames.push("bias"),a&&this.variableNames.push("preluActivationWeights"),r&&this.variableNames.push("leakyreluAlpha"),this.userCode= `
$ { A }
const ivec2 strides = ivec2 ( $ { d } , $ { u } ) ;
const ivec2 pads = ivec2 ( $ { o } , $ { l } ) ;
void main ( ) {
ivec4 coords = getOutputCoords ( ) ;
int batch = coords . x ;
ivec2 xRCCorner = coords . yz * strides - pads ;
int d2 = coords . w ;
int d1 = d2 / $ { f } ;
int q = d2 - d1 * $ { f } ;
int xRCorner = xRCCorner . x ;
int xCCorner = xRCCorner . y ;
// Convolve x(?, ?, d1) with w(:, :, d1, q) to get y(yR, yC, d2).
// ? = to be determined. : = across all values in that axis.
float dotProd = 0.0 ;
// TO DO(dsmilkov): Flatten the two for loops and vec4 the operations.
for ( int wR = 0 ; wR < $ { h } ; wR ++ ) {
int xR = xRCorner + wR * $ { p } ;
if ( xR < 0 || xR >= $ { s } ) {
continue ;
2021-04-19 22:02:47 +02:00
}
2021-04-28 14:58:21 +02:00
for ( int wC = 0 ; wC < $ { m } ; wC ++ ) {
int xC = xCCorner + wC * $ { c } ;
if ( xC < 0 || xC >= $ { i } ) {
continue ;
2021-04-19 22:02:47 +02:00
}
2021-04-28 14:58:21 +02:00
float xVal = getX ( batch , xR , xC , d1 ) ;
float wVal = getW ( wR , wC , d1 , q ) ;
dotProd += xVal * wVal ;
2021-04-19 22:02:47 +02:00
}
2021-04-28 14:55:26 +02:00
}
2021-04-28 14:58:21 +02:00
float result = dotProd ;
$ { g }
$ { y }
setOutput ( result ) ;
2021-04-28 14:55:26 +02:00
}
2021-04-28 14:58:21 +02:00
` }},qv=class{constructor(e,t=!1,n=null,a=!1,r=!1){this.variableNames=["x","W"],this.packedInputs=!0,this.packedOutput=!0,this.outputShape=e.outShape;let s=e.outChannels/e.inChannels,i=e.inHeight,o=e.inWidth,l=e.padInfo.top,d=e.padInfo.left,u=e.strideHeight,p=e.strideWidth,c=e.dilationHeight,h=e.dilationWidth,m=e.filterHeight,f=e.filterWidth,A=f,y= `
int xR ; int xC ; int xCOffset ;
vec4 wTexel ; vec4 previous ; vec4 final ; ` ;for(let b=0;b<f;b++)y+= `
vec4 xTexelC$ { b * 2 } ;
vec4 xC$ { b } ; ` ;for(let b=0;b<m;b++){for(let v=0;v<f;v++)y+= `
xTexelC$ { v * 2 } = vec4 ( 0.0 ) ;
xC$ { v } = vec4 ( 0.0 ) ; ` ;y+= `
xR = xRCorner + $ { b * c } ;
if ( xR >= 0 && xR < $ { i } ) {
` ;for(let v=0;v<A/2+1;v++){let I=v*2;if(y+= `
xC = xCCorner + $ { I * h } ;
` ,p===1){if(I<f&&(d%2==1?(y+= `
xCOffset = xC + 1 ;
if ( xCOffset >= 0 && xCOffset < $ { o } ) {
xTexelC$ { I } = getX ( batch , xR , xCOffset , d1 ) ;
// Need to manually clear unused channels in case
// we're reading from recycled texture.
if ( xCOffset + 1 >= $ { o } ) {
xTexelC$ { I } . zw = vec2 ( 0.0 ) ;
}
}
` ,h===1&&I>0?y+= `
xC$ { I } = vec4 ( xTexelC$ { I - 2 } . zw , xTexelC$ { I } . xy ) ;
` :y+= `
xCOffset = xC + 1 - 2 ;
if ( xCOffset >= 0 && xCOffset < $ { o } ) {
previous = getX ( batch , xR , xCOffset , d1 ) ;
// Need to manually clear unused channels in case
// we're reading from recycled texture.
if ( xCOffset + 1 >= $ { o } ) {
previous . zw = vec2 ( 0.0 ) ;
}
xC$ { I } = vec4 ( previous . zw , xTexelC$ { I } . xy ) ;
} else {
xC$ { I } = vec4 ( 0.0 , 0.0 , xTexelC$ { I } . xy ) ;
}
` ):y+= `
if ( xC >= 0 && xC < $ { o } ) {
xTexelC$ { I } = getX ( batch , xR , xC , d1 ) ;
if ( xC + 1 >= $ { o } ) {
xTexelC$ { I } . zw = vec2 ( 0.0 ) ;
}
}
xC$ { I } = xTexelC$ { I } ;
` ,I+1<f)){let T=d%2==0?k.nearestLargerEven(h):h;h%2==0&&d%2==1||h%2!=0&&d%2!=1?(y+= `
xCOffset = xC + $ { d % 2 } + $ { T } ;
if ( xCOffset >= 0 && xCOffset < $ { o } ) {
xTexelC$ { I + 2 } = getX ( batch , xR , xCOffset , d1 ) ;
// Need to manually clear unused channels in case
// we're reading from recycled texture.
if ( xCOffset + 1 >= $ { o } ) {
xTexelC$ { I + 2 } . zw = vec2 ( 0.0 ) ;
}
}
` ,h>1&&(y+= `
xCOffset -= 2 ;
if ( xCOffset >= 0 && xCOffset < $ { o } ) {
xTexelC$ { I } = getX ( batch , xR , xCOffset , d1 ) ;
}
` ),y+= `
xC$ { I + 1 } = vec4 ( xTexelC$ { I } . zw , xTexelC$ { I + 2 } . xy ) ;
` ):T===1?y+= `
xC$ { I + 1 } = xTexelC$ { I } ;
` :y+= `
xCOffset = xC + $ { T } ;
if ( xCOffset >= 0 && xCOffset < $ { o } ) {
xTexelC$ { I + 2 } = getX ( batch , xR , xCOffset , d1 ) ;
if ( xCOffset + 1 >= $ { o } ) {
xTexelC$ { I + 2 } . zw = vec2 ( 0.0 ) ;
}
}
xC$ { I + 1 } = xTexelC$ { I + 2 } ;
` }}else I<f&&(d%2==1?(y+= `
xCOffset = xC + 1 - $ { p } ;
if ( xCOffset >= 0 && xCOffset < $ { o } ) {
xTexelC$ { I } = getX ( batch , xR , xCOffset , d1 ) ;
// Need to manually clear unused channels in case
// we're reading from recycled texture.
if ( xCOffset + 1 >= $ { o } ) {
xTexelC$ { I } . zw = vec2 ( 0.0 ) ;
}
}
if ( xC + 1 >= 0 && xC + 1 < $ { o } ) {
xTexelC$ { I + 2 } = getX ( batch , xR , xC + 1 , d1 ) ;
// Need to manually clear unused channels in case
// we're reading from recycled texture.
if ( xC + 2 >= $ { o } ) {
xTexelC$ { I + 2 } . zw = vec2 ( 0.0 ) ;
}
}
xC$ { I } = vec4 ( xTexelC$ { I } . zw , xTexelC$ { I + 2 } . zw ) ;
` ,I+1<f&&(y+= `
final = vec4 ( 0.0 ) ;
xCOffset = xC + 1 + $ { p } ;
if ( xCOffset >= 0 && xCOffset < $ { o } ) {
final = getX ( batch , xR , xCOffset , d1 ) ;
}
xC$ { I + 1 } = vec4 ( xTexelC$ { I + 2 } . xy , final . xy ) ;
` )):(y+= `
if ( xC >= 0 && xC < $ { o } ) {
xTexelC$ { I } = getX ( batch , xR , xC , d1 ) ;
if ( xC + 1 >= $ { o } ) {
xTexelC$ { I } . zw = vec2 ( 0.0 ) ;
}
}
xCOffset = xC + $ { p } ;
if ( xCOffset >= 0 && xCOffset < $ { o } ) {
xTexelC$ { I + 2 } = getX ( batch , xR , xCOffset , d1 ) ;
if ( xCOffset + 1 >= $ { o } ) {
xTexelC$ { I + 2 } . zw = vec2 ( 0. ) ;
}
}
xC$ { I } = vec4 (
xTexelC$ { I } . xy , xTexelC$ { I + 2 } . xy ) ;
` ,I+1<f&&(y+= `
xC$ { I + 1 } = vec4 ( xTexelC$ { I } . zw , xTexelC$ { I + 2 } . zw ) ;
` )));I<f&&(y+= `
wTexel = getW ( $ { b } , $ { I } , d1 , q ) ;
dotProd += xC$ { I } * vec4 ( wTexel . xz , wTexel . xz ) ;
` ,I+1<f&&(y+= `
wTexel = getW ( $ { b } , $ { I + 1 } , d1 , q ) ;
dotProd += xC$ { I + 1 } * vec4 ( wTexel . xz , wTexel . xz ) ;
` ))}y+= `
}
` }let g="",x="";n&&(a?g= ` vec4 activation ( vec4 a ) {
vec4 b = getPreluActivationWeightsAtOutCoords ( ) ;
$ { n }
} ` :r?g= ` vec4 activation ( vec4 a ) {
vec4 b = getLeakyreluAlphaAtOutCoords ( ) ;
$ { n }
} ` :g= ` vec4 activation ( vec4 x ) {
$ { n }
} ` ,x="result = activation(result);");let w=t?"result += getBiasAtOutCoords();":"";t&&this.variableNames.push("bias"),a&&this.variableNames.push("preluActivationWeights"),r&&this.variableNames.push("leakyreluAlpha"),this.userCode= `
$ { g }
const ivec2 strides = ivec2 ( $ { u } , $ { p } ) ;
const ivec2 pads = ivec2 ( $ { l } , $ { d } ) ;
void main ( ) {
ivec4 coords = getOutputCoords ( ) ;
int batch = coords . x ;
ivec2 xRCCorner = coords . yz * strides - pads ;
int d2 = coords . w ;
int d1 = d2 / $ { s } ;
int q = d2 - d1 * $ { s } ;
int xRCorner = xRCCorner . x ;
int xCCorner = xRCCorner . y ;
//intialize dotProd with a small epsilon seems to reduce GPU accuracy loss.
vec4 dotProd = vec4 ( 0.000000000000001 ) ;
$ { y }
vec4 result = dotProd - vec4 ( 0.000000000000001 ) ;
$ { w }
$ { x }
setOutput ( result ) ;
2021-04-28 14:55:26 +02:00
}
2021-04-28 14:58:21 +02:00
` }};function hj(e){let{inputs:t,backend:n,attrs:a}=e,{x:r,filter:s}=t,{strides:i,pad:o,dilations:l,dimRoundingMode:d}=a,u=l;u==null&&(u=[1,1]),k.assert(C.eitherStridesOrDilationsAreOne(i,u),()=> ` Error in depthwiseConv2d : Either strides or dilations must be 1. Got strides $ { i } and dilations '${u}' ` );let p=C.computeConv2DInfo(r.shape,s.shape,i,u,o,d,!0),c;return J().getBool("WEBGL_PACK_DEPTHWISECONV")&&p.strideWidth<=2&&p.outChannels/p.inChannels==1?c=new qv(p):c=new Gv(p),n.runWebGLProgram(c,[r,s],"float32")}var fj={kernelName:As,backendName:"webgl",kernelFunc:hj},mj=class{constructor(e){this.variableNames=["x","dy"],this.outputShape=e.filterShape;let t=e.strideHeight,n=e.strideWidth,a=e.padInfo.top,r=e.padInfo.left,s=e.outChannels/e.inChannels;this.userCode= `
void main ( ) {
ivec4 coords = getOutputCoords ( ) ;
int wR = coords . x ;
int wC = coords . y ;
int d1 = coords . z ;
int dm = coords . w ;
int d2 = d1 * $ { s } + dm ;
float dotProd = 0.0 ;
// TO DO: Vec4 over the batch size
for ( int b = 0 ; b < $ { e . batchSize } ; b ++ ) {
for ( int yR = 0 ; yR < $ { e . outHeight } ; yR ++ ) {
int xR = wR + yR * $ { t } - $ { a } ;
if ( xR < 0 || xR >= $ { e . inHeight } ) {
continue ;
}
for ( int yC = 0 ; yC < $ { e . outWidth } ; yC ++ ) {
int xC = wC + yC * $ { n } - $ { r } ;
if ( xC < 0 || xC >= $ { e . inWidth } ) {
continue ;
}
float dyValue = getDy ( b , yR , yC , d2 ) ;
float xValue = getX ( b , xR , xC , d1 ) ;
dotProd += ( xValue * dyValue ) ;
2021-04-19 22:19:03 +02:00
}
2021-04-28 14:55:26 +02:00
}
}
2021-04-28 14:58:21 +02:00
setOutput ( dotProd ) ;
2021-04-28 14:55:26 +02:00
}
2021-04-28 14:58:21 +02:00
` }},Aj=class{constructor(e){this.variableNames=["dy","W"],this.outputShape=e.inShape;let t=e.filterHeight,n=e.filterWidth,a=e.strideHeight,r=e.strideWidth,s=t-1-e.padInfo.top,i=n-1-e.padInfo.left,o=e.outChannels/e.inChannels;this.userCode= `
const ivec2 pads = ivec2 ( $ { s } , $ { i } ) ;
void main ( ) {
ivec4 coords = getOutputCoords ( ) ;
int batch = coords [ 0 ] ;
int d1 = coords [ 3 ] ;
ivec2 dyCorner = coords . yz - pads ;
int dyRCorner = dyCorner . x ;
int dyCCorner = dyCorner . y ;
float dotProd = 0.0 ;
for ( int wR = 0 ; wR < $ { t } ; wR ++ ) {
float dyR = float ( dyRCorner + wR ) / $ { a } . 0 ;
if ( dyR < 0.0 || dyR >= $ { e . outHeight } . 0 || fract ( dyR ) > 0.0 ) {
continue ;
}
int idyR = int ( dyR ) ;
int wRPerm = $ { t } - 1 - wR ;
for ( int wC = 0 ; wC < $ { n } ; wC ++ ) {
float dyC = float ( dyCCorner + wC ) / $ { r } . 0 ;
if ( dyC < 0.0 || dyC >= $ { e . outWidth } . 0 ||
fract ( dyC ) > 0.0 ) {
continue ;
}
int idyC = int ( dyC ) ;
int wCPerm = $ { n } - 1 - wC ;
// TO DO: Vec4 over the channelMul
for ( int dm = 0 ; dm < $ { o } ; dm ++ ) {
int d2 = d1 * $ { o } + dm ;
float xValue = getDy ( batch , idyR , idyC , d2 ) ;
float wValue = getW ( wRPerm , wCPerm , d1 , dm ) ;
dotProd += xValue * wValue ;
2021-04-28 14:55:26 +02:00
}
}
}
2021-04-28 14:58:21 +02:00
setOutput ( dotProd ) ;
2021-04-28 14:55:26 +02:00
}
2021-04-28 14:58:21 +02:00
` }};function yj(e){let{inputs:t,backend:n,attrs:a}=e,{x:r,dy:s}=t,{strides:i,dilations:o,pad:l,dimRoundingMode:d,filterShape:u}=a,p=C.computeConv2DInfo(r.shape,u,i,o,l,d,!0),c=new mj(p);return n.runWebGLProgram(c,[r,s],"float32")}var gj={kernelName:Dp,backendName:"webgl",kernelFunc:yj};function xj(e){let{inputs:t,backend:n,attrs:a}=e,{dy:r,filter:s}=t,{strides:i,dilations:o,pad:l,dimRoundingMode:d,inputShape:u}=a,p=C.computeConv2DInfo(u,s.shape,i,o,l,d,!0),c=new Aj(p);return n.runWebGLProgram(c,[r,s],"float32")}var bj={kernelName:Op,backendName:"webgl",kernelFunc:xj},vj=class{constructor(e){this.variableNames=["X"],this.outputShape=[e,e],this.userCode= `
void main ( ) {
ivec2 coords = getOutputCoords ( ) ;
float val = coords [ 0 ] == coords [ 1 ] ? getX ( coords [ 0 ] ) : 0.0 ;
setOutput ( val ) ;
2021-04-28 14:55:26 +02:00
}
2021-04-28 14:58:21 +02:00
` }};function wj(e){let{inputs:t,backend:n}=e,{x:a}=t,r=[...a.shape,...a.shape],s=k.sizeFromShape(a.shape),i=fe({inputs:{x:a},backend:n,attrs:{shape:[s]}}),o=new vj(s),l=n.runWebGLProgram(o,[i],i.dtype),d=fe({inputs:{x:l},backend:n,attrs:{shape:r}});return n.disposeIntermediateTensorInfo(i),n.disposeIntermediateTensorInfo(l),d}var kj={kernelName:zp,backendName:"webgl",kernelFunc:wj},Ij=class{constructor(e){this.variableNames=["x","W"],this.outputShape=e.outShape;let{inHeight:t,inWidth:n,padInfo:a,strideHeight:r,strideWidth:s,filterHeight:i,filterWidth:o,dilationHeight:l,dilationWidth:d}=e,{top:u,left:p}=a;this.userCode= `
const ivec2 strides = ivec2 ( $ { r } , $ { s } ) ;
const ivec2 pads = ivec2 ( $ { u } , $ { p } ) ;
const float neg _infinity = - 3.4 e38 ;
void main ( ) {
ivec4 coords = getOutputCoords ( ) ;
int batch = coords . x ;
int d1 = coords . w ;
ivec2 outTopLeftCorner =
coords . yz * strides - pads ;
int hBeg = outTopLeftCorner . x ;
int wBeg = outTopLeftCorner . y ;
float curVal = neg _infinity ;
for ( int h = 0 ; h < $ { i } ; h ++ ) {
int hIn = hBeg + h * $ { l } ;
if ( hIn >= 0 && hIn < $ { t } ) {
for ( int w = 0 ; w < $ { o } ; w ++ ) {
int wIn = wBeg + w * $ { d } ;
if ( wIn >= 0 && wIn < $ { n } ) {
float xVal = getX ( batch , hIn , wIn , d1 ) ;
float wVal = getW ( h , w , d1 ) ;
float val = xVal + wVal ;
if ( val > curVal ) {
curVal = val ;
}
}
}
2021-04-28 14:55:26 +02:00
}
}
2021-04-28 14:58:21 +02:00
float result = curVal ;
setOutput ( result ) ;
2021-04-28 14:55:26 +02:00
}
2021-04-28 14:58:21 +02:00
` }};function Sj(e){let{inputs:t,backend:n,attrs:a}=e,{x:r,filter:s}=t,{strides:i,pad:o,dilations:l}=a,d=C.computeDilation2DInfo(r.shape,s.shape,i,o,"NHWC",l),u,p=new Ij(d);u=n.runWebGLProgram(p,[r,s],"float32");let c=fe({inputs:{x:u},backend:n,attrs:{shape:d.outShape}});return n.disposeIntermediateTensorInfo(u),c}var Nj={kernelName:gu,backendName:"webgl",kernelFunc:Sj};function Tj(e){let{inputs:t,backend:n,attrs:a}=e,{equation:r}=a,s=t,{allDims:i,summedDims:o,idDims:l}=C.decodeEinsumEquation(r,s.length);C.checkEinsumDimSizes(i.length,l,s);let{path:d,steps:u}=C.getEinsumComputePath(o,l),p=u.length,c=null,h=i.length,m=[];for(let f=0;f<p;++f){for(let A of u[f]){let{permutationIndices:y,expandDims:g}=C.getEinsumPermutation(h,l[A]),x;C.isIdentityPermutation(y)?x=s[A]:(x=cn({inputs:{x:s[A]},backend:n,attrs:{perm:y}}),m.push(x));let w=x.shape.slice();for(let b=0;b<g.length;++b)w.splice(g[b],0,1);k.arraysEqual(x.shape,w)||(x=fe({inputs:{x},backend:n,attrs:{shape:w}}),m.push(x)),c===null?c=x:(c=f1({inputs:{a:x,b:c},backend:n}),m.push(c))}f<p-1&&(d[f]>=0&&(c=gh({inputs:{x:c},backend:n,attrs:{axis:d[f]-(i.length-h),keepDims:!1}}),m.push(c)),h--)}for(let f of m)f!==c&&n.disposeIntermediateTensorInfo(f);return c}var Ej={kernelName:Lp,backendName:"webgl",kernelFunc:Tj},Cj="return (x >= 0.0) ? x : (exp(x) - 1.0);",Rj= `
vec4 result ;
result . r = ( x . r >= 0.0 ) ? x . r : ( exp ( x . r ) - 1.0 ) ;
result . g = ( x . g >= 0.0 ) ? x . g : ( exp ( x . g ) - 1.0 ) ;
result . b = ( x . b >= 0.0 ) ? x . b : ( exp ( x . b ) - 1.0 ) ;
result . a = ( x . a >= 0.0 ) ? x . a : ( exp ( x . a ) - 1.0 ) ;
return result ;
` ,Mj=qe({opSnippet:Cj,packedOpSnippet:Rj}),Fj={kernelName:mo,backendName:"webgl",kernelFunc:Mj}, $ j="return (b >= 1.0) ? a : a * (b + 1.0);",Dj= `
vec4 bGTEZero = vec4 ( greaterThanEqual ( b , vec4 ( 0. ) ) ) ;
return ( bGTEZero * a ) + ( ( vec4 ( 1.0 ) - bGTEZero ) * ( a * ( b + vec4 ( 1.0 ) ) ) ) ;
` ,Oj=e=>{let{inputs:t,backend:n}=e,{dy:a,y:r}=t,s=J().getBool("WEBGL_PACK_BINARY_OPERATIONS")?new fd(Dj,a.shape,r.shape):new Dl( $ j,a.shape,r.shape);return n.runWebGLProgram(s,[a,r],a.dtype)},zj={kernelName:Wp,backendName:"webgl",kernelFunc:Oj},_j= `
return vec4 ( equal ( a , b ) ) ;
` ,Pj="return float(a == b);",Lj=en({opSnippet:Pj,packedOpSnippet:_j,dtype:"bool"}),Wj={kernelName:yo,backendName:"webgl",kernelFunc:Lj},Bj= `
// Error function is calculated approximately with elementary function.
// See "Handbook of Mathematical Functions with Formulas,
// Graphs, and Mathematical Tables", Abramowitz and Stegun.
float p = $ { C . ERF _P } ;
float a1 = $ { C . ERF _A1 } ;
float a2 = $ { C . ERF _A2 } ;
float a3 = $ { C . ERF _A3 } ;
float a4 = $ { C . ERF _A4 } ;
float a5 = $ { C . ERF _A5 } ;
float sign = sign ( x ) ;
x = abs ( x ) ;
float t = 1.0 / ( 1.0 + p * x ) ;
return sign * ( 1.0 - ( ( ( ( ( a5 * t + a4 ) * t ) + a3 ) * t + a2 ) * t + a1 ) * t * exp ( - x * x ) ) ;
` ,Vj=qe({opSnippet:Bj}),jj={kernelName:Ao,backendName:"webgl",kernelFunc:Vj},Xv="return exp(x);",Kv=qe({opSnippet:Xv,packedOpSnippet:Xv,cpuKernelImpl:zL}),Uj={kernelName:gs,backendName:"webgl",kernelFunc:Kv};function g1(e){let{inputs:t,attrs:n,backend:a}=e,{dim:r}=n,{input:s}=t,i=s.shape.length,o=s.shape.slice(),l=r;return r<0&&(k.assert(-(i+1)<=r,()=> ` Axis must be in the interval [ $ { - ( i + 1 ) } , $ { i } ] ` ),l=i+r+1),o.splice(l,0,1),fe({inputs:{x:s},backend:a,attrs:{shape:o}})}var Hj={kernelName:go,backendName:"webgl",kernelFunc:g1},Zv="return exp(x) - 1.0;",Gj=qe({opSnippet:Zv,packedOpSnippet:Zv,cpuKernelImpl:_L}),qj={kernelName:xo,backendName:"webgl",kernelFunc:Gj},Yv=class{constructor(e,t,n){this.variableNames=["real","imag"];let a=t[1];this.outputShape=t;let r=n? ` 2.0 * $ { Math . PI } ` : ` - 2.0 * $ { Math . PI } ` ,s=n? ` $ { a } . 0 ` :"1.0",i;if(e==="real")i="return real * expR - imag * expI;";else if(e==="imag")i="return real * expI + imag * expR;";else throw new Error( ` FFT component must be either "real" or "imag" , got $ { e } . ` );this.userCode= `
const float exponentMultiplier = $ { r } ;
float unaryOpComplex ( float real , float expR , float imag , float expI ) {
$ { i }
2021-04-28 14:55:26 +02:00
}
2021-04-28 14:58:21 +02:00
float mulMatDFT ( int batch , int index ) {
float indexRatio = float ( index ) / float ( $ { a } ) ;
float exponentMultiplierTimesIndexRatio =
exponentMultiplier * indexRatio ;
float result = 0.0 ;
for ( int i = 0 ; i < $ { a } ; i ++ ) {
// x = (-2|2 * PI / N) * index * i;
float x = exponentMultiplierTimesIndexRatio * float ( i ) ;
float expR = cos ( x ) ;
float expI = sin ( x ) ;
float real = getReal ( batch , i ) ;
float imag = getImag ( batch , i ) ;
result +=
unaryOpComplex ( real , expR , imag , expI ) / $ { s } ;
}
return result ;
2021-04-28 14:55:26 +02:00
}
2021-04-28 14:58:21 +02:00
void main ( ) {
ivec2 coords = getOutputCoords ( ) ;
setOutput ( mulMatDFT ( coords [ 0 ] , coords [ 1 ] ) ) ;
2021-04-28 14:55:26 +02:00
}
2021-04-28 14:58:21 +02:00
` }};function Jv(e,t,n){let a=n.texData.get(e.dataId),r=k.sizeFromShape(e.shape),s=e.shape[e.shape.length-1],i=r/s,o=fe({inputs:{x:e},backend:n,attrs:{shape:[i,s]}}),l=o.shape,d=new Yv("real",l,t),u=new Yv("imag",l,t),p=[{dataId:a.complexTensorInfos.real.dataId,dtype:a.complexTensorInfos.real.dtype,shape:l},{dataId:a.complexTensorInfos.imag.dataId,dtype:a.complexTensorInfos.imag.dtype,shape:l}],c=n.runWebGLProgram(d,p,"float32"),h=n.runWebGLProgram(u,p,"float32"),m=Lr({inputs:{real:c,imag:h},backend:n});n.disposeIntermediateTensorInfo(c),n.disposeIntermediateTensorInfo(h);let f=fe({inputs:{x:m},backend:n,attrs:{shape:e.shape}});return n.disposeIntermediateTensorInfo(o),n.disposeIntermediateTensorInfo(m),f}function Xj(e){let{inputs:t,backend:n}=e,{input:a}=t;return Jv(a,!1,n)}var Kj={kernelName:Bp,backendName:"webgl",kernelFunc:Xj},Zj=class{constructor(e,t){this.outputShape=[],this.variableNames=["x"],this.outputShape=e,this.userCode= `
uniform float value ;
void main ( ) {
// Input can be obtained from uniform value.
setOutput ( value ) ;
}
` }getCustomSetupFunc(e){return(t,n)=>{this.valueLoc==null&&(this.valueLoc=t.getUniformLocationNoThrow(n,"value")),t.gl.uniform1f(this.valueLoc,e)}}};function x1(e){let{backend:t,attrs:n}=e,{shape:a,value:r}=n,{dtype:s}=n;if(s=s||k.inferDtype(r),s==="string"){let i=k.getArrayFromDType(s,k.sizeFromShape(a));return i.fill(r),t.makeTensorInfo(a,s,i)}else{let i=new Zj(a,r),o=i.getCustomSetupFunc(r);return t.runWebGLProgram(i,[],s,o)}}var Yj={kernelName:xu,backendName:"webgl",kernelFunc:x1},Jj=class{constructor(e){this.variableNames=["Image"],this.outputShape=[];let t=e[2];this.outputShape=e,this.userCode= `
void main ( ) {
ivec4 coords = getOutputCoords ( ) ;
int x = coords [ 2 ] ;
int coordX = $ { t } - x ;
float outputValue ;
if ( coordX >= 0 && coordX < $ { t } ) {
outputValue = getImage ( coords [ 0 ] , coords [ 1 ] , coordX , coords [ 3 ] ) ;
} else {
outputValue = getImage ( coords [ 0 ] , coords [ 1 ] , coords [ 2 ] , coords [ 3 ] ) ;
}
setOutput ( outputValue ) ;
}
` }},Qj={kernelName:bo,backendName:"webgl",kernelFunc:({inputs:e,backend:t})=>{let{image:n}=e,a=t,r=new Jj(n.shape);return a.runWebGLProgram(r,[n],n.dtype)}},Qv="return floor(x);",eU=qe({opSnippet:Qv,packedOpSnippet:Qv,cpuKernelImpl:PL}),tU={kernelName:xs,backendName:"webgl",kernelFunc:eU},nU= `
float s = sign ( a ) * sign ( b ) ;
int ia = round ( a ) ;
int ib = round ( b ) ;
if ( ib != 0 ) {
// Windows (D3D) wants guaranteed non-zero int division at compile-time.
return float ( idiv ( ia , ib , s ) ) ;
} else {
return NAN ;
2021-04-28 14:55:26 +02:00
}
2021-04-28 14:58:21 +02:00
` ,aU= `
ivec4 ia = round ( a ) ;
ivec4 ib = round ( b ) ;
bvec4 cond = notEqual ( ib , ivec4 ( 0 ) ) ;
ivec4 result = ivec4 ( 0 ) ;
vec4 s = sign ( a ) * sign ( b ) ;
// Windows (D3D) wants guaranteed non-zero int division at compile-time.
if ( cond [ 0 ] ) {
result [ 0 ] = idiv ( ia [ 0 ] , ib [ 0 ] , s [ 0 ] ) ;
2021-04-28 14:55:26 +02:00
}
2021-04-28 14:58:21 +02:00
if ( cond [ 1 ] ) {
result [ 1 ] = idiv ( ia [ 1 ] , ib [ 1 ] , s [ 1 ] ) ;
2021-04-28 14:55:26 +02:00
}
2021-04-28 14:58:21 +02:00
if ( cond [ 2 ] ) {
result [ 2 ] = idiv ( ia [ 2 ] , ib [ 2 ] , s [ 2 ] ) ;
2021-04-28 14:55:26 +02:00
}
2021-04-28 14:58:21 +02:00
if ( cond [ 3 ] ) {
result [ 3 ] = idiv ( ia [ 3 ] , ib [ 3 ] , s [ 3 ] ) ;
2021-04-28 14:55:26 +02:00
}
2021-04-28 14:58:21 +02:00
return vec4 ( result ) ;
` ,rU=en({opSnippet:nU,packedOpSnippet:aU,dtype:"int32"}),sU={kernelName:bs,backendName:"webgl",kernelFunc:rU},iU=class{constructor(e){this.variableNames=["A"];let t=dn(),[n,a]=e;this.outputShape=e,this.userCode= `
void main ( ) {
ivec3 coords = getOutputCoords ( ) ;
int texR = coords [ 0 ] ;
int texC = coords [ 1 ] ;
int depth = coords [ 2 ] ;
vec2 uv = ( vec2 ( texC , texR ) + halfCR ) / vec2 ( $ { a } . 0 , $ { n } . 0 ) ;
vec4 values = $ { t . texture2D } ( A , uv ) ;
float value ;
if ( depth == 0 ) {
value = values . r ;
} else if ( depth == 1 ) {
value = values . g ;
} else if ( depth == 2 ) {
value = values . b ;
} else if ( depth == 3 ) {
value = values . a ;
2021-04-28 14:55:26 +02:00
}
2021-04-28 14:58:21 +02:00
setOutput ( floor ( value * 255.0 + 0.5 ) ) ;
2021-04-28 14:55:26 +02:00
}
2021-04-28 14:58:21 +02:00
` }},oU=class{constructor(e){this.variableNames=["A"],this.packedInputs=!1,this.packedOutput=!0;let t=dn(),[n,a]=e;this.outputShape=e,this.userCode= `
void main ( ) {
ivec3 coords = getOutputCoords ( ) ;
int texR = coords [ 0 ] ;
int texC = coords [ 1 ] ;
int depth = coords [ 2 ] ;
vec4 result = vec4 ( 0. ) ;
for ( int row = 0 ; row <= 1 ; row ++ ) {
for ( int col = 0 ; col <= 1 ; col ++ ) {
texC = coords [ 1 ] + row ;
depth = coords [ 2 ] + col ;
vec2 uv = ( vec2 ( texC , texR ) + halfCR ) /
vec2 ( $ { a } . 0 , $ { n } . 0 ) ;
vec4 values = $ { t . texture2D } ( A , uv ) ;
float value ;
if ( depth == 0 ) {
value = values . r ;
} else if ( depth == 1 ) {
value = values . g ;
} else if ( depth == 2 ) {
value = values . b ;
} else if ( depth == 3 ) {
value = values . a ;
}
result [ row * 2 + col ] = floor ( value * 255.0 + 0.5 ) ;
}
2021-04-28 14:55:26 +02:00
}
2021-04-28 14:58:21 +02:00
$ { t . output } = result ;
2021-04-28 14:55:26 +02:00
}
2021-04-28 14:58:21 +02:00
` }},uU={kernelName:ac,backendName:"webgl",kernelFunc:lU},zl;function lU(e){let{inputs:t,backend:n,attrs:a}=e,{pixels:r}=t,{numChannels:s}=a,i=typeof HTMLVideoElement!="undefined"&&r instanceof HTMLVideoElement,o=typeof HTMLImageElement!="undefined"&&r instanceof HTMLImageElement,[l,d]=i?[r.videoWidth,r.videoHeight]:[r.width,r.height],u=[d,l],p=[d,l,s];(o||i)&&(zl==null&&(zl=document.createElement("canvas").getContext("2d")),zl.canvas.width=l,zl.canvas.height=d,zl.drawImage(r,0,0,l,d),r=zl.canvas);let c=n.makeTensorInfo(u,"int32");n.texData.get(c.dataId).usage=Yn.PIXELS,n.gpgpu.uploadPixelDataToTexture(n.getTexture(c.dataId),r);let h=J().getBool("WEBGL_PACK")?new oU(p):new iU(p),m=n.runWebGLProgram(h,[c],"int32");return n.disposeData(c.dataId),m}function dU(e){let{inputs:t,backend:n,attrs:a}=e,{x:r,filter:s,bias:i,preluActivationWeights:o}=t,{strides:l,pad:d,dataFormat:u,dilations:p,dimRoundingMode:c,activation:h,leakyreluAlpha:m}=a,f=C.convertConv2DDataFormat(u),A=C.computeConv2DInfo(r.shape,s.shape,l,p,d,c,!1,f),y,g=[];if(A.filterHeight===1&&A.filterWidth===1&&A.dilationHeight===1&&A.dilationWidth===1&&A.strideHeight===1&&A.strideWidth===1&&(A.padInfo.type==="SAME"||A.padInfo.type==="VALID"))y=Bv({x:r,filter:s,convInfo:A,backend:n,bias:i,activation:h,preluActivationWeights:o,leakyreluAlpha:m});else if(J().getBool("WEBGL_CONV_IM2COL")&&r.shape[0]===1)y=Vv({x:r,filter:s,convInfo:A,backend:n,bias:i,activation:h,preluActivationWeights:o,leakyreluAlpha:m});else{let w=i!=null,b=o!=null,v=h==="leakyrelu",I=h?Ah(h,!1):null,T=new Wv(A,w,I,b,v),R=[r,s];if(i&&R.push(i),o&&R.push(o),v){let $ =n.makeTensorInfo([],"float32",k.createScalarValue(m,"float32"));R.push( $ ),g.push( $ )}y=n.runWebGLProgram(T,R,"float32")}let x=fe({inputs:{x:y},backend:n,attrs:{shape:A.outShape}});return g.push(y),g.forEach(w=>n.disposeIntermediateTensorInfo(w)),x}var pU={kernelName:ti,backendName:"webgl",kernelFunc:dU};function cU(e){let{inputs:t,backend:n,attrs:a}=e,{x:r,filter:s,bias:i,preluActivationWeights:o}=t,{strides:l,pad:d,dilations:u,dimRoundingMode:p,activation:c,leakyreluAlpha:h}=a,m=[],f=u;f==null&&(f=[1,1]),k.assert(C.eitherStridesOrDilationsAreOne(l,f),()=> ` Error in depthwiseConv2d : Either strides or dilations must be 1. Got strides $ { l } and dilations '${f}' ` );let A=C.computeConv2DInfo(r.shape,s.shape,l,f,d,p,!0),y=J().getBool("WEBGL_PACK_DEPTHWISECONV")&&A.strideWidth<=2&&A.outChannels/A.inChannels==1,g=c?Ah(c,y):null,x=[r,s],w=i!=null,b=o!=null,v=c==="leakyrelu";if(w&&x.push(i),b&&x.push(o),v){let R=n.makeTensorInfo([],"float32",k.createScalarValue(h,"float32"));x.push(R),m.push(R)}let I;y?I=new qv(A,w,g,b,v):I=new Gv(A,w,g,b,v);let T=n.runWebGLProgram(I,x,"float32");return m.forEach(R=>n.disposeIntermediateTensorInfo(R)),T}var hU={kernelName:ni,backendName:"webgl",kernelFunc:cU},fU=class{constructor(e,t,n){this.sliceDim=e,this.strides=t,this.variableNames=["x","indices"],this.outputShape=n;let a=lt(t.length),r=lt(n.length),s=this.sliceDim>1?"strides[j]":"strides";this.userCode= `
$ { a } strides = $ { a } ( $ { this . strides } ) ;
void main ( ) {
$ { r } coords = getOutputCoords ( ) ;
int flattenIndex = 0 ;
for ( int j = 0 ; j < $ { this . sliceDim } ; j ++ ) {
int index = round ( getIndices ( coords [ 0 ] , j ) ) ;
flattenIndex += index * $ { s } ;
}
setOutput ( getX ( flattenIndex , coords [ 1 ] ) ) ;
}
` }};function mU(e){let{inputs:t,backend:n}=e,{params:a,indices:r}=t,s=r.shape,i=s[s.length-1],[o,l,d,u]=C.prepareAndValidate(a,r),p=fe({inputs:{x:r},backend:n,attrs:{shape:[l,i]}}),c=fe({inputs:{x:a},backend:n,attrs:{shape:[k.sizeFromShape(a.shape)/d,d]}}),h=new fU(i,u,[l,d]),m=n.runWebGLProgram(h,[c,p],c.dtype),f=fe({inputs:{x:m},backend:n,attrs:{shape:o}});return n.disposeIntermediateTensorInfo(p),n.disposeIntermediateTensorInfo(c),n.disposeIntermediateTensorInfo(m),f}var AU={kernelName:wo,backendName:"webgl",kernelFunc:mU},gU=class{constructor(e,t){this.variableNames=["A","indices"],this.outputShape=t,this.rank=t.length;let n=lt(this.rank),a=yU(e,2);this.userCode= `
void main ( ) {
$ { n } resRC = getOutputCoords ( ) ;
setOutput ( getA ( $ { a } ) ) ;
2021-04-28 14:55:26 +02:00
}
2021-04-28 14:58:21 +02:00
` }};function yU(e,t){let n=["resRC.x","resRC.y","resRC.z","resRC.w"],a=[];for(let r=0;r<e.length;r++)r===2?a.push("int(getIndices(resRC.x, resRC.z))"):a.push( ` $ { n [ r ] } ` );return a.join()}function xU(e){let{inputs:t,backend:n,attrs:a}=e,{x:r,indices:s}=t,{axis:i,batchDims:o}=a,l=k.parseAxisParam(i,r.shape)[0],d=C.segment_util.collectGatherOpShapeInfo(r,s,l,o),u=k.sizeFromShape(s.shape),p=[],c=fe({inputs:{x:r},backend:n,attrs:{shape:[d.batchSize,d.outerSize,d.dimSize,d.sliceSize]}}),h=fe({inputs:{x:s},backend:n,attrs:{shape:[d.batchSize,u/d.batchSize]}});p.push(c),p.push(h);let m=[d.batchSize,d.outerSize,u/d.batchSize,d.sliceSize];if(n.shouldExecuteOnCPU([r,s])||r.dtype==="string"){let g=n.bufferSync(h),x=n.bufferSync(c),w=LL(x,g,m);return p.forEach(b=>n.disposeIntermediateTensorInfo(b)),n.makeTensorInfo(d.outputShape,w.dtype,w.values)}let f=new gU(c.shape,m),A=n.runWebGLProgram(f,[c,h],c.dtype);p.push(A);let y=fe({inputs:{x:A},backend:n,attrs:{shape:d.outputShape}});return p.forEach(g=>n.disposeIntermediateTensorInfo(g)),y}var bU={kernelName:vo,backendName:"webgl",kernelFunc:xU},vU="return float(a > b);",wU= `
return vec4 ( greaterThan ( a , b ) ) ;
` ,kU=en({opSnippet:vU,packedOpSnippet:wU,cpuKernelImpl:WL,dtype:"bool"}),IU={kernelName:ko,backendName:"webgl",kernelFunc:kU},SU="return float(a >= b);",NU= `
return vec4 ( greaterThanEqual ( a , b ) ) ;
` ,TU=en({opSnippet:SU,packedOpSnippet:NU,dtype:"bool"}),EU={kernelName:ws,backendName:"webgl",kernelFunc:TU};function CU(e){let{inputs:t,backend:n}=e,{input:a}=t;return Jv(a,!0,n)}var RU={kernelName:Vp,backendName:"webgl",kernelFunc:CU},MU="return float(!isnan(x) && !isinf(x));",FU=qe({opSnippet:MU,dtype:"bool"}), $ U={kernelName:Io,backendName:"webgl",kernelFunc:FU},DU="return float(isinf(x));",OU=qe({opSnippet:DU,dtype:"bool"}),zU={kernelName:So,backendName:"webgl",kernelFunc:OU},_U="return float(isnan(x));",PU=qe({opSnippet:_U,dtype:"bool"}),LU={kernelName:No,backendName:"webgl",kernelFunc:PU},WU="return float(a < b);",BU= `
return vec4 ( lessThan ( a , b ) ) ;
` ,VU=en({opSnippet:WU,packedOpSnippet:BU,cpuKernelImpl:BL,dtype:"bool"}),jU={kernelName:To,backendName:"webgl",kernelFunc:VU},UU="return float(a <= b);",HU= `
return vec4 ( lessThanEqual ( a , b ) ) ;
` ,GU=en({opSnippet:UU,packedOpSnippet:HU,dtype:"bool"}),qU={kernelName:Eo,backendName:"webgl",kernelFunc:GU};function XU(e){let{backend:t,attrs:n}=e,{start:a,stop:r,num:s}=n,i=VL(a,r,s);return t.makeTensorInfo([i.length],"float32",i)}var KU={kernelName:Up,backendName:"webgl",kernelFunc:XU},ZU= ` if ( x < 0.0 ) return NAN ;
return log ( x ) ; ` ,YU= `
vec4 result = log ( x ) ;
vec4 isNaN = vec4 ( lessThan ( x , vec4 ( 0.0 ) ) ) ;
result . r = isNaN . r == 1.0 ? NAN : result . r ;
result . g = isNaN . g == 1.0 ? NAN : result . g ;
result . b = isNaN . b == 1.0 ? NAN : result . b ;
result . a = isNaN . a == 1.0 ? NAN : result . a ;
return result ;
` ,JU=qe({opSnippet:ZU,packedOpSnippet:YU,cpuKernelImpl:jL}),QU={kernelName:Ss,backendName:"webgl",kernelFunc:JU},eH="return log(1.0 + x);",tH=qe({opSnippet:eH}),nH={kernelName:Co,backendName:"webgl",kernelFunc:tH},aH="return float(a >= 1.0 && b >= 1.0);",rH= `
return vec4 (
vec4 ( greaterThanEqual ( a , vec4 ( 1.0 ) ) ) *
vec4 ( greaterThanEqual ( b , vec4 ( 1.0 ) ) ) ) ;
` ,sH=en({opSnippet:aH,packedOpSnippet:rH,dtype:"bool"}),iH={kernelName:Ro,backendName:"webgl",kernelFunc:sH},oH="return float(!(x >= 1.0));",lH=qe({opSnippet:oH}),uH={kernelName:bu,backendName:"webgl",kernelFunc:lH},dH="return float(a >= 1.0 || b >= 1.0);",pH= `
return min (
vec4 ( greaterThanEqual ( a , vec4 ( 1.0 ) ) ) +
vec4 ( greaterThanEqual ( b , vec4 ( 1.0 ) ) ) ,
vec4 ( 1.0 ) ) ;
` ,cH=en({opSnippet:dH,packedOpSnippet:pH,dtype:"bool"}),hH={kernelName:vu,backendName:"webgl",kernelFunc:cH},fH=class{constructor(e,t,n,a,r){this.variableNames=["x"],this.outputShape=[];let s=t,i=e[3]-1;this.outputShape=e;let o,l= ` float ( $ { n } ) + float ( $ { a } ) * sum ` ;r===.5?o= ` inversesqrt ( $ { l } ) ` :r===1?o= ` 1.0 / ( $ { l } ) ` :o= ` exp ( log ( $ { l } ) * float ( - $ { r } ) ) ; ` ,this.userCode= `
void main ( ) {
ivec4 coords = getOutputCoords ( ) ;
int b = coords [ 0 ] ;
int r = coords [ 1 ] ;
int c = coords [ 2 ] ;
int d = coords [ 3 ] ;
float x = getX ( b , r , c , d ) ;
float sum = 0.0 ;
for ( int j = - $ { s } ; j <= $ { s } ; j ++ ) {
int idx = d + j ;
if ( idx >= 0 && idx <= $ { i } ) {
float z = getX ( b , r , c , idx ) ;
sum += z * z ;
}
}
float val = x * $ { o } ;
setOutput ( val ) ;
2021-04-28 14:55:26 +02:00
}
2021-04-28 14:58:21 +02:00
` }},mH=class{constructor(e,t,n,a,r){this.variableNames=["x"],this.outputShape=[],this.packedInputs=!0,this.packedOutput=!0;let s=t,i=e[3]-1;this.outputShape=e;let o,l= ` float ( $ { n } ) + float ( $ { a } ) * sum ` ;r===.5?o= ` inversesqrt ( $ { l } ) ` :r===1?o= ` 1.0 / ( $ { l } ) ` :o= ` exp ( log ( $ { l } ) * float ( - $ { r } ) ) ; ` ,this.userCode= `
void main ( ) {
ivec4 coords = getOutputCoords ( ) ;
int b = coords . x ;
int r = coords . y ;
int c = coords . z ;
int d = coords . w ;
bool hasNextCol = d < $ { this . outputShape [ 3 ] } ;
bool hasNextRow = c < $ { this . outputShape [ 2 ] } ;
vec4 sum = vec4 ( 0. ) ;
vec4 xFragAtOutputCoords = getX ( b , r , c , d ) ;
vec4 xAtOutputCoords = vec4 (
getChannel ( xFragAtOutputCoords , vec2 ( c , d ) ) ,
hasNextCol ?
getChannel ( xFragAtOutputCoords , vec2 ( c , d + 1 ) ) : 0.0 ,
hasNextRow ?
getChannel ( xFragAtOutputCoords , vec2 ( c + 1 , d ) ) : 0.0 ,
( hasNextRow && hasNextCol ) ?
getChannel ( xFragAtOutputCoords , vec2 ( c + 1 , d + 1 ) ) : 0.0
) ;
int firstChannel = d - $ { s } ;
vec2 cache = vec2 ( 0. ) ;
if ( firstChannel >= 0 ) {
vec4 firstChannelFrag = getX ( b , r , c , firstChannel ) ;
cache . x = getChannel ( firstChannelFrag , vec2 ( c , firstChannel ) ) ;
if ( hasNextRow ) {
cache . y = getChannel ( firstChannelFrag , vec2 ( c + 1 , firstChannel ) ) ;
}
2021-04-28 14:55:26 +02:00
}
2021-04-28 14:58:21 +02:00
ivec2 depth = ivec2 ( d , d + 1 ) ;
for ( int j = - $ { s } ; j <= $ { s } ; j ++ ) {
ivec2 idx = depth + j ;
bvec2 aboveLowerBound = greaterThanEqual ( idx , ivec2 ( 0 ) ) ;
bvec2 belowUpperBound = lessThanEqual ( idx , ivec2 ( $ { i } ) ) ;
bool depthInRange = aboveLowerBound . x && belowUpperBound . x ;
bool depthPlusOneInRange = aboveLowerBound . y && belowUpperBound . y ;
if ( depthInRange || depthPlusOneInRange ) {
vec4 z = vec4 ( 0. ) ;
vec4 xFragAtCurrentDepth ;
z . xz = cache . xy ;
if ( depthPlusOneInRange && hasNextCol ) {
xFragAtCurrentDepth = idx . y != d ?
getX ( b , r , c , idx . y ) : xFragAtOutputCoords ;
z . y = getChannel ( xFragAtCurrentDepth , vec2 ( c , idx . y ) ) ;
if ( hasNextRow ) {
z . w = getChannel ( xFragAtCurrentDepth , vec2 ( c + 1 , idx . y ) ) ;
}
}
cache . xy = z . yw ;
sum += z * z ;
2021-04-28 14:55:26 +02:00
}
}
2021-04-28 14:58:21 +02:00
vec4 result = xAtOutputCoords * $ { o } ;
setOutput ( result ) ;
2021-04-28 14:55:26 +02:00
}
2021-04-28 14:58:21 +02:00
` }},AH=e=>{let{inputs:t,backend:n,attrs:a}=e,{x:r}=t,{depthRadius:s,bias:i,alpha:o,beta:l}=a,d=J().getBool("WEBGL_PACK_NORMALIZATION")?new mH(r.shape,s,i,o,l):new fH(r.shape,s,i,o,l);return n.runWebGLProgram(d,[r],r.dtype)},yH={kernelName:wu,backendName:"webgl",kernelFunc:AH},gH=class{constructor(e,t,n,a,r){this.variableNames=["inputImage","outputImage","dy"],this.outputShape=[],this.outputShape=e,this.depth=e[3],this.depthRadius=t,this.bias=n,this.alpha=a,this.beta=r,this.userCode= `
void main ( ) {
ivec4 coords = getOutputCoords ( ) ;
int b = coords [ 0 ] ;
int r = coords [ 1 ] ;
int c = coords [ 2 ] ;
float result = 0.0 ;
for ( int d = 0 ; d < $ { this . depth } ; ++ d ) {
int depthBegin = int ( max ( 0.0 , float ( d - $ { t } ) ) ) ;
int depthEnd = int ( min ( float ( $ { this . depth } ) ,
float ( d + $ { t } + 1 ) ) ) ;
const int MIN _DEPTH _BEGIN = 0 ;
const int MAX _DEPTH _END = $ { this . depth } ;
float norm = 0.0 ;
for ( int k = MIN _DEPTH _BEGIN ; k < MAX _DEPTH _END ; ++ k ) {
if ( k < depthBegin ) {
continue ;
}
else if ( k >= depthBegin && k < depthEnd ) {
norm += getInputImage ( b , r , c , k ) * getInputImage ( b , r , c , k ) ;
}
else {
break ;
}
2021-04-28 14:55:26 +02:00
}
2021-04-28 14:58:21 +02:00
norm = float ( $ { a } ) * norm + float ( $ { n } ) ;
for ( int k = MIN _DEPTH _BEGIN ; k < MAX _DEPTH _END ; ++ k ) {
if ( k < depthBegin ) {
continue ;
}
else if ( k >= depthBegin && k < depthEnd ) {
float dyi = - 2.0 * float ( $ { a } )
* float ( $ { r } )
* getInputImage ( b , r , c , k ) * getOutputImage ( b , r , c , d )
/ n o r m ;
if ( k == d ) {
dyi += pow ( norm , - 1.0 * $ { r } ) ;
}
if ( k == coords [ 3 ] ) {
dyi *= getDy ( b , r , c , d ) ;
result += dyi ;
}
}
else {
break ;
}
2021-04-28 14:55:26 +02:00
}
}
2021-04-28 14:58:21 +02:00
setOutput ( result ) ;
2021-04-28 14:55:26 +02:00
}
2021-04-28 14:58:21 +02:00
` }},xH=e=>{let{inputs:t,backend:n,attrs:a}=e,{x:r,y:s,dy:i}=t,{depthRadius:o,bias:l,alpha:d,beta:u}=a,p=new gH(r.shape,o,l,d,u);return n.runWebGLProgram(p,[r,s,i],r.dtype)},bH={kernelName:Hp,backendName:"webgl",kernelFunc:xH};function vH(e,t,n,a){let r=k.sizeFromShape(t),s=k.sizeFromShape(e.shape)/r,i=fe({inputs:{x:e},attrs:{shape:[s,r]},backend:a}),o=Ni(i,e.dtype,"max",a),l=fe({inputs:{x:o},attrs:{shape:n},backend:a});return a.disposeIntermediateTensorInfo(i),a.disposeIntermediateTensorInfo(o),l}function e6(e){let{inputs:t,backend:n,attrs:a}=e,{x:r}=t,{reductionIndices:s,keepDims:i}=a,o=r.shape.length,l=k.parseAxisParam(s,r.shape),d=l,u=C.getAxesPermutation(d,o),p=u!=null,c=n.shouldExecuteOnCPU([r]),h=r;if(p){if(c){let g=n.texData.get(h.dataId).values,x=new Array(o);for(let v=0;v<x.length;v++)x[v]=r.shape[u[v]];let w=c1(g,r.shape,r.dtype,u,x);h=n.makeTensorInfo(x,r.dtype);let b=n.texData.get(h.dataId);b.values=w}else h=yh(r,u,n);d=C.getInnerMostAxes(d.length,o)}C.assertAxesAreInnerMostDims("max",d,o);let[m,f]=C.computeOutAndReduceShapes(h.shape,d),A=m;i&&(A=C.expandShapeToKeepDim(m,l));let y;if(c){let g=n.texData.get(h.dataId).values,x=UL(g,k.sizeFromShape(f),A,r.dtype);y=n.makeTensorInfo(A,r.dtype);let w=n.texData.get(y.dataId);w.values=x}else y=vH(h,f,A,n);return p&&n.disposeIntermediateTensorInfo(h),y}var wH={kernelName:Ns,backendName:"webgl",kernelFunc:e6},kH=xv+ `
return max ( a , b ) ;
` ,IH= `
vec4 result = vec4 ( max ( a , b ) ) ;
vec4 isNaN = min ( vec4 ( isnan ( a ) ) + vec4 ( isnan ( b ) ) , vec4 ( 1.0 ) ) ;
` +mh+ `
return result ;
` ,SH=en({opSnippet:kH,packedOpSnippet:IH,cpuKernelImpl:HL}),NH={kernelName:Ts,backendName:"webgl",kernelFunc:SH};function TH(e){let{inputs:t,backend:n,attrs:a}=e,{x:r}=t;Nl(r,"maxPool");let{filterSize:s,strides:i,pad:o,dimRoundingMode:l}=a,d=1;k.assert(C.eitherStridesOrDilationsAreOne(i,d),()=> ` Error in maxPool : Either strides or dilations must be 1. Got strides $ { i } and dilations '${d}' ` );let u=C.computePool2DInfo(r.shape,s,i,d,o,l);if(u.filterWidth===1&&u.filterHeight===1&&k.arraysEqual(u.inShape,u.outShape))return Pn({inputs:{x:r},backend:n});let p=new md(u,"max",!1);return n.runWebGLProgram(p,[r],r.dtype)}var EH={kernelName:Es,backendName:"webgl",kernelFunc:TH};function CH(e){let{inputs:t,backend:n,attrs:a}=e,{x:r}=t,{filterSize:s,strides:i,pad:o,dataFormat:l,dimRoundingMode:d}=a,u=[1,1,1],p=C.computePool3DInfo(r.shape,s,i,u,o,d,l),c=new m1(p,"max",!1);return n.runWebGLProgram(c,[r],r.dtype)}var RH={kernelName:ku,backendName:"webgl",kernelFunc:CH},MH=class{constructor(e){this.variableNames=["dy","maxPos"],this.outputShape=e.inShape;let t=e.strideHeight,n=e.strideWidth,a=e.dilationHeight,r=e.effectiveFilterHeight,s=e.effectiveFilterWidth,i=r-1-e.padInfo.top,o=s-1-e.padInfo.left,l=r*s-1;this.userCode= `
const ivec2 pads = ivec2 ( $ { i } , $ { o } ) ;
void main ( ) {
ivec4 coords = getOutputCoords ( ) ;
int b = coords [ 0 ] ;
int d = coords [ 3 ] ;
ivec2 dyRCCorner = coords . yz - pads ;
int dyRCorner = dyRCCorner . x ;
int dyCCorner = dyRCCorner . y ;
// Convolve dy(?, ?, d) with pos mask(:, :, d) to get dx(xR, xC, d).
// ? = to be determined. : = across all values in that axis.
float dotProd = 0.0 ;
for ( int wR = 0 ; wR < $ { r } ;
wR += $ { a } ) {
float dyR = float ( dyRCorner + wR ) / $ { t } . 0 ;
if ( dyR < 0.0 || dyR >= $ { e . outHeight } . 0 || fract ( dyR ) > 0.0 ) {
continue ;
}
int idyR = int ( dyR ) ;
for ( int wC = 0 ; wC < $ { s } ; wC ++ ) {
float dyC = float ( dyCCorner + wC ) / $ { n } . 0 ;
if ( dyC < 0.0 || dyC >= $ { e . outWidth } . 0 ||
fract ( dyC ) > 0.0 ) {
continue ;
}
int idyC = int ( dyC ) ;
float dyValue = getDy ( b , idyR , idyC , d ) ;
int maxPosValue = $ { l } - int ( getMaxPos ( b , idyR , idyC , d ) ) ;
// Get the current value, check it against the value from the
// position matrix.
int curPosValue = wR * $ { s } + wC ;
float mask = float ( maxPosValue == curPosValue ? 1.0 : 0.0 ) ;
dotProd += dyValue * mask ;
}
2021-04-28 14:55:26 +02:00
}
2021-04-28 14:58:21 +02:00
setOutput ( dotProd ) ;
2021-04-28 14:55:26 +02:00
}
2021-04-28 14:58:21 +02:00
` }},FH=class{constructor(e){this.variableNames=["dy","maxPos"],this.outputShape=e.inShape;let t=e.strideDepth,n=e.strideHeight,a=e.strideWidth,r=e.dilationDepth,s=e.dilationHeight,i=e.dilationWidth,o=e.effectiveFilterDepth,l=e.effectiveFilterHeight,d=e.effectiveFilterWidth,u=o-1-e.padInfo.front,p=l-1-e.padInfo.top,c=d-1-e.padInfo.left,h=o*l*d-1;this.userCode= `
const ivec3 pads = ivec3 ( $ { u } , $ { p } , $ { c } ) ;
void main ( ) {
ivec5 coords = getOutputCoords ( ) ;
int batch = coords . x ;
int ch = coords . u ;
ivec3 dyCorner = ivec3 ( coords . y , coords . z , coords . w ) - pads ;
int dyDCorner = dyCorner . x ;
int dyRCorner = dyCorner . y ;
int dyCCorner = dyCorner . z ;
// Convolve dy(?, ?, ?, ch) with pos mask(:, :, :, d) to get
// dx(xD, xR, xC, ch).
// ? = to be determined. : = across all values in that axis.
float dotProd = 0.0 ;
for ( int wD = 0 ; wD < $ { o } ;
wD += $ { r } ) {
float dyD = float ( dyDCorner + wD ) / $ { t } . 0 ;
if ( dyD < 0.0 || dyD >= $ { e . outDepth } . 0 || fract ( dyD ) > 0.0 ) {
continue ;
}
int idyD = int ( dyD ) ;
for ( int wR = 0 ; wR < $ { l } ;
wR += $ { s } ) {
float dyR = float ( dyRCorner + wR ) / $ { n } . 0 ;
if ( dyR < 0.0 || dyR >= $ { e . outHeight } . 0 ||
fract ( dyR ) > 0.0 ) {
continue ;
}
int idyR = int ( dyR ) ;
for ( int wC = 0 ; wC < $ { d } ;
wC += $ { i } ) {
float dyC = float ( dyCCorner + wC ) / $ { a } . 0 ;
if ( dyC < 0.0 || dyC >= $ { e . outWidth } . 0 ||
fract ( dyC ) > 0.0 ) {
continue ;
}
int idyC = int ( dyC ) ;
float dyValue = getDy ( batch , idyD , idyR , idyC , ch ) ;
int maxPosValue = $ { h } -
int ( getMaxPos ( batch , idyD , idyR , idyC , ch ) ) ;
// Get the current value, check it against the value from the
// position matrix.
int curPosValue =
wD * $ { l } * $ { d } +
wR * $ { d } + wC ;
float mask = float ( maxPosValue == curPosValue ? 1.0 : 0.0 ) ;
dotProd += dyValue * mask ;
}
}
2021-04-28 14:55:26 +02:00
}
2021-04-28 14:58:21 +02:00
setOutput ( dotProd ) ;
2021-04-28 14:55:26 +02:00
}
2021-04-28 14:58:21 +02:00
` }};function $ H(e){let{inputs:t,backend:n,attrs:a}=e,{dy:r,input:s}=t,i=s,{filterSize:o,strides:l,pad:d,dimRoundingMode:u}=a,p=[1,1,1],c=C.computePool3DInfo(i.shape,o,l,p,d,u),h=new m1(c,"max",!0),m=n.runWebGLProgram(h,[i],i.dtype),f=new FH(c),A=n.runWebGLProgram(f,[r,m],i.dtype);return n.disposeIntermediateTensorInfo(m),A}var DH={kernelName:qp,backendName:"webgl",kernelFunc: $ H};function OH(e){let{inputs:t,backend:n,attrs:a}=e,{dy:r,input:s,output:i}=t,o=s;Nl([s,i],"maxPoolGrad");let{filterSize:l,strides:d,pad:u,dimRoundingMode:p}=a,c=C.computePool2DInfo(o.shape,l,d,1,u,p),h=!0,m=new md(c,"max",h),f=n.runWebGLProgram(m,[o],o.dtype),A=new MH(c),y=n.runWebGLProgram(A,[r,f],o.dtype);return n.disposeIntermediateTensorInfo(f),y}var zH={kernelName:Gp,backendName:"webgl",kernelFunc:OH};function _H(e,t,n,a){let r=new md(n,"max",!1),s=a.runWebGLProgram(r,[e],"float32");r=new md(n,"max",!0,!0,t);let i=a.runWebGLProgram(r,[e],"float32");return[s,i]}var PH={kernelName:Xp,backendName:"webgl",kernelFunc:({inputs:e,attrs:t,backend:n})=>{let{x:a}=e,{filterSize:r,strides:s,pad:i,includeBatchInIndex:o}=t,l=n;k.assert(a.shape.length===4,()=> ` Error in maxPool : input must be rank 4 but got rank $ { a . shape . length } . ` );let d=[1,1];k.assert(C.eitherStridesOrDilationsAreOne(s,d),()=> ` Error in maxPool : Either strides or dilations must be 1. Got strides $ { s } and dilations '${d}' ` );let u=C.computePool2DInfo(a.shape,r,s,d,i),[p,c]=_H(a,o,u,l);return[p,c]}};function LH(e,t,n,a){let r=k.sizeFromShape(t),s=k.sizeFromShape(e.shape)/r,i=fe({inputs:{x:e},attrs:{shape:[s,r]},backend:a}),o=Ni(i,"float32","mean",a),l=fe({inputs:{x:o},attrs:{shape:n},backend:a});return a.disposeIntermediateTensorInfo(i),a.disposeIntermediateTensorInfo(o),l}var WH={kernelName:Cs,backendName:"webgl",kernelFunc:({inputs:e,attrs:t,backend:n})=>{let{x:a}=e,{keepDims:r,axis:s}=t,i=n,o=a.shape.length,l=k.parseAxisParam(s,a.shape),d=l,u=C.getAxesPermutation(d,o),p=u!=null,c=i.shouldExecuteOnCPU([a]),h=[],m=a;if(p){if(c){let x=i.texData.get(m.dataId).values,w=new Array(o);for(let I=0;I<w.length;I++)w[I]=a.shape[u[I]];let b=c1(x,a.shape,a.dtype,u,w);m=i.makeTensorInfo(w,a.dtype);let v=i.texData.get(m.dataId);v.values=b}else m=yh(a,u,i);h.push(m),d=C.getInnerMostAxes(d.length,o)}C.assertAxesAreInnerMostDims("sum",d,o);let[f,A]=C.computeOutAndReduceShapes(m.shape,d),y=f;r&&(y=C.expandShapeToKeepDim(f,l));let g=LH(m,A,y,i);for(let x of h)i.disposeIntermediateTensorInfo(x);return g}};function BH(e){let{inputs:t,backend:n,attrs:a}=e,{x:r}=t,{axis:s,keepDims:i}=a,o=r.shape.length,l=k.parseAxisParam(s,r.shape),d=l,u=C.getAxesPermutation(d,o),p=r;u!=null&&(p=cn({inputs:{x:r},backend:n,attrs:{perm:u}}),d=C.getInnerMostAxes(d.length,r.shape.length)),C.assertAxesAreInnerMostDims("min",d,o);let[c,h]=C.computeOutAndReduceShapes(p.shape,d),m=k.sizeFromShape(h),f=fe({inputs:{x:p},backend:n,attrs:{shape:[-1,m]}}),A=Ni(f,f.dtype,"min",n),y;if(i){let g=C.expandShapeToKeepDim(c,l);y=fe({inputs:{x:A},backend:n,attrs:{shape:g}})}else y=fe({inputs:{x:A},backend:n,attrs:{shape:c}});return n.disposeIntermediateTensorInfo(f),n.disposeIntermediateTensorInfo(A),u!=null&&n.disposeIntermediateTensorInfo(p),y}var VH={kernelName:Rs,backendName:"webgl",kernelFunc:BH},jH=xv+ `
return min ( a , b ) ;
` ,UH= `
vec4 result = vec4 ( min ( a , b ) ) ;
vec4 isNaN = min ( vec4 ( isnan ( a ) ) + vec4 ( isnan ( b ) ) , vec4 ( 1.0 ) ) ;
` +mh+ `
return result ;
` ,HH=en({opSnippet:jH,packedOpSnippet:UH,cpuKernelImpl:GL}),GH={kernelName:Ms,backendName:"webgl",kernelFunc:HH},qH=class{constructor(e,t,n){this.variableNames=["x"],this.outputShape=t.map((d,u)=>d[0]+e[u]+d[1]);let a=e.length,r=lt(a),s=t.map(d=>d[0]).join(","),i=t.map((d,u)=>d[0]+e[u]).join(","),o=["coords[0]","coords[1]","coords[2]","coords[3]"].slice(0,a),l=n==="reflect"?0:1;if(a===1){this.userCode= `
int start = $ { s } ;
int end = $ { i } ;
void main ( ) {
int outC = getOutputCoords ( ) ;
if ( outC < start ) {
outC = start * 2 - outC - $ { l } ;
} else if ( outC >= end ) {
outC = ( end - 1 ) * 2 - outC + $ { l } ;
}
setOutput ( getX ( outC - start ) ) ;
2021-04-28 14:55:26 +02:00
}
2021-04-28 14:58:21 +02:00
` ;return}this.userCode= `
$ { r } start = $ { r } ( $ { s } ) ;
$ { r } end = $ { r } ( $ { i } ) ;
void main ( ) {
$ { r } outC = getOutputCoords ( ) ;
for ( int i = 0 ; i < $ { a } ; i ++ ) {
if ( outC [ i ] < start [ i ] ) {
outC [ i ] = start [ i ] * 2 - outC [ i ] - $ { l } ;
} else if ( outC [ i ] >= end [ i ] ) {
outC [ i ] = ( end [ i ] - 1 ) * 2 - outC [ i ] + $ { l } ;
}
2021-04-28 14:55:26 +02:00
}
2021-04-28 14:58:21 +02:00
$ { r } coords = outC - start ;
setOutput ( getX ( $ { o } ) ) ;
2021-04-28 14:55:26 +02:00
}
2021-04-28 14:58:21 +02:00
` }},XH=class{constructor(e,t,n){this.variableNames=["x"],this.packedInputs=!0,this.packedOutput=!0,this.outputShape=t.map((h,m)=>h[0]+e[m]+h[1]);let a=e.length,r=lt(a),s=t.map(h=>h[0]).join(","),i=t.map((h,m)=>h[0]+e[m]).join(","),o=pn("rc",a),l=pn("source",a),d= ` $ { o [ a - 1 ] } < $ { this . outputShape [ a - 1 ] } ` ,u=a===1?"source": ` vec2 ( $ { l . slice ( - 2 ) . join ( ) } ) ` ,p=n==="reflect"?0:1,c="";if(a===1){let h= `
$ { r } source = rc ;
if ( source < start ) {
source = start * 2 - source - $ { p } ;
} else if ( source >= end ) {
source = ( end - 1 ) * 2 - source + $ { p } ;
2021-04-28 14:55:26 +02:00
}
2021-04-28 14:58:21 +02:00
source -= start ;
` ;c= `
$ { r } rc = outputLoc ;
$ { h }
result [ 0 ] = getChannel ( getX ( $ { l . join ( ) } ) , $ { u } ) ;
$ { o [ a - 1 ] } += 1 ;
if ( $ { d } ) {
$ { h }
result [ 1 ] = getChannel ( getX ( $ { l . join ( ) } ) , $ { u } ) ;
}
` }else{let h= `
$ { r } source = rc ;
$ { r } lt = $ { r } ( lessThan ( source , start ) ) ;
$ { r } gte = $ { r } ( greaterThanEqual ( source , end ) ) ;
$ { r } orig = 1 - ( lt + gte ) ;
source = orig * source +
lt * ( start * 2 - source - $ { p } ) +
gte * ( ( end - 1 ) * 2 - source + $ { p } ) ;
source -= start ;
` ;c= `
$ { r } rc = outputLoc ;
$ { h }
result [ 0 ] = getChannel ( getX ( $ { l . join ( ) } ) , $ { u } ) ;
$ { o [ a - 1 ] } += 1 ;
if ( $ { d } ) {
$ { h }
result [ 1 ] = getChannel ( getX ( $ { l . join ( ) } ) , $ { u } ) ;
2021-04-28 14:55:26 +02:00
}
2021-04-28 14:58:21 +02:00
rc = outputLoc ;
$ { o [ a - 2 ] } += 1 ;
if ( $ { o [ a - 2 ] } < $ { this . outputShape [ a - 2 ] } ) {
$ { h }
result [ 2 ] = getChannel ( getX ( $ { l . join ( ) } ) , $ { u } ) ;
$ { o [ a - 1 ] } += 1 ;
if ( $ { d } ) {
$ { h }
result [ 3 ] = getChannel ( getX ( $ { l . join ( ) } ) , $ { u } ) ;
}
}
` }this.userCode= `
const $ { r } start = $ { r } ( $ { s } ) ;
const $ { r } end = $ { r } ( $ { i } ) ;
void main ( ) {
$ { r } outputLoc = getOutputCoords ( ) ;
vec4 result = vec4 ( 0. ) ;
$ { c }
setOutput ( result ) ;
2021-04-28 14:55:26 +02:00
}
2021-04-28 14:58:21 +02:00
` }},KH=({inputs:e,backend:t,attrs:n})=>{let{x:a}=e,{paddings:r,mode:s}=n,i=J().getBool("WEBGL_PACK_ARRAY_OPERATIONS")?new XH(a.shape,r,s):new qH(a.shape,r,s);return t.runWebGLProgram(i,[a],a.dtype)},ZH={kernelName:Fs,backendName:"webgl",kernelFunc:KH},YH= ` if ( b == 0.0 ) return NAN ;
return mod ( a , b ) ; ` ,JH= `
vec4 result = mod ( a , b ) ;
vec4 isNaN = vec4 ( equal ( b , vec4 ( 0.0 ) ) ) ;
` +mh+ `
return result ;
` ,QH=en({opSnippet:YH,packedOpSnippet:JH}),eG={kernelName:Mo,backendName:"webgl",kernelFunc:QH},tG=class{constructor(e,t,n){this.variableNames=["probs"],this.outputShape=[e,n],this.userCode= `
uniform float seed ;
void main ( ) {
ivec2 coords = getOutputCoords ( ) ;
int batch = coords [ 0 ] ;
float r = random ( seed ) ;
float cdf = 0.0 ;
for ( int i = 0 ; i < $ { t - 1 } ; i ++ ) {
cdf += getProbs ( batch , i ) ;
if ( r < cdf ) {
setOutput ( float ( i ) ) ;
return ;
}
}
// If no other event happened, last event happened.
setOutput ( float ( $ { t - 1 } ) ) ;
2021-04-28 14:55:26 +02:00
}
2021-04-28 14:58:21 +02:00
` }getCustomSetupFunc(e){return(t,n)=>{this.seedLoc==null&&(this.seedLoc=t.getUniformLocation(n,"seed")),t.gl.uniform1f(this.seedLoc,e)}}},nG= `
if ( a == b ) {
return 1.0 ;
} ;
return a / b ; ` ,aG= `
// vec4 one = vec4(equal(a, b));
// return one + (vec4(1.0) - one) * a / b;
vec4 result = a / b ;
if ( a . x == b . x ) {
result . x = 1. ;
2021-04-28 14:55:26 +02:00
}
2021-04-28 14:58:21 +02:00
if ( a . y == b . y ) {
result . y = 1. ;
2021-04-28 14:55:26 +02:00
}
2021-04-28 14:58:21 +02:00
if ( a . z == b . z ) {
result . z = 1. ;
2021-04-28 14:55:26 +02:00
}
2021-04-28 14:58:21 +02:00
if ( a . w == b . w ) {
result . w = 1. ;
2021-04-28 14:55:26 +02:00
}
2021-04-28 14:58:21 +02:00
return result ;
` ,t6=en({opSnippet:nG,packedOpSnippet:aG,checkOutOfBounds:!0}),rG={kernelName:ys,backendName:"webgl",kernelFunc:t6},n6="return a - b;",a6=en({opSnippet:n6,packedOpSnippet:n6,supportsComplex:!0,cpuKernelImpl:tW}),sG={kernelName:Zs,backendName:"webgl",kernelFunc:a6};function r6(e){let{inputs:t,backend:n,attrs:a}=e,{logits:r}=t,{dim:s}=a,i=k.parseAxisParam([s],r.shape),o=e6({inputs:{x:r},backend:n,attrs:{reductionIndices:i,keepDims:!1}}),l=C.expandShapeToKeepDim(o.shape,i),d=fe({inputs:{x:o},backend:n,attrs:{shape:l}}),u=a6({inputs:{a:r,b:d},backend:n}),p=Kv({inputs:{x:u},backend:n}),c=gh({inputs:{x:p},backend:n,attrs:{axis:i,keepDims:!1}}),h=fe({inputs:{x:c},backend:n,attrs:{shape:l}}),m=t6({inputs:{a:p,b:h},backend:n});return n.disposeIntermediateTensorInfo(o),n.disposeIntermediateTensorInfo(d),n.disposeIntermediateTensorInfo(u),n.disposeIntermediateTensorInfo(p),n.disposeIntermediateTensorInfo(c),n.disposeIntermediateTensorInfo(h),m}var iG={kernelName:Xs,backendName:"webgl",kernelFunc:r6};function oG(e){let{inputs:t,backend:n,attrs:a}=e,{logits:r}=t,{numSamples:s,seed:i,normalized:o}=a,l=o?r:r6({inputs:{logits:r},backend:n,attrs:{dim:r.shape.length-1}}),d=l.shape[0],u=l.shape[1],p=new tG(d,u,s),c=p.getCustomSetupFunc(i),h=n.runWebGLProgram(p,[l],"int32",c);return o||n.disposeIntermediateTensorInfo(l),h}var lG={kernelName:Kp,backendName:"webgl",kernelFunc:oG},s6="return -x;";function uG(e){let{inputs:t,backend:n}=e,{x:a}=t;if(n.shouldExecuteOnCPU([a])){let s=n.texData.get(a.dataId),[i,o]=XL(s.values,a.shape,a.dtype);return n.makeTensorInfo(o,a.dtype,i)}let r;return J().getBool("WEBGL_PACK_UNARY_OPERATIONS")?r=new Fl(a.shape,s6):r=new Pr(a.shape,s6),n.runWebGLProgram(r,[a],a.dtype)}var dG={kernelName:Fo,backendName:"webgl",kernelFunc:uG},pG=Wa.nonMaxSuppressionV3Impl;function cG(e){C.warn("tf.nonMaxSuppression() in webgl locks the UI thread. Call tf.nonMaxSuppressionAsync() instead");let{inputs:t,backend:n,attrs:a}=e,{boxes:r,scores:s}=t,{maxOutputSize:i,iouThreshold:o,scoreThreshold:l}=a,d=n.readSync(r.dataId),u=n.readSync(s.dataId),{selectedIndices:p}=pG(d,u,i,o,l);return n.makeTensorInfo([p.length],"int32",new Int32Array(p))}var hG={kernelName:Do,backendName:"webgl",kernelFunc:cG},fG=Wa.nonMaxSuppressionV4Impl;function mG(e){C.warn("tf.nonMaxSuppression() in webgl locks the UI thread. Call tf.nonMaxSuppressionAsync() instead");let{inputs:t,backend:n,attrs:a}=e,{boxes:r,scores:s}=t,{maxOutputSize:i,iouThreshold:o,scoreThreshold:l,padToMaxOutputSize:d}=a,u=n.readSync(r.dataId),p=n.readSync(s.dataId),{selectedIndices:c,validOutputs:h}=fG(u,p,i,o,l,d);return[n.makeTensorInfo([c.length],"int32",new Int32Array(c)),n.makeTensorInfo([],"int32",new Int32Array([h]))]}var AG={kernelName:Oo,backendName:"webgl",kernelFunc:mG},yG=Wa.nonMaxSuppressionV5Impl;function gG(e){C.warn("tf.nonMaxSuppression() in webgl locks the UI thread. Call tf.nonMaxSuppressionAsync() instead");let{inputs:t,backend:n,attrs:a}=e,{boxes:r,scores:s}=t,{maxOutputSize:i,iouThreshold:o,scoreThreshold:l,softNmsSigma:d}=a,u=n.readSync(r.dataId),p=n.readSync(s.dataId),c=i,h=o,m=l,f=d,{selectedIndices:A,selectedScores:y}=yG(u,p,c,h,m,f);return[n.makeTensorInfo([A.length],"int32",new Int32Array(A)),n.makeTensorInfo([y.length],"float32",new Float32Array(y))]}var xG={kernelName:zo,backendName:"webgl",kernelFunc:gG},bG=class{constructor(e,t,n,a){this.variableNames=["indices"],this.outputShape=[e,t],this.userCode= `
void main ( ) {
ivec2 coords = getOutputCoords ( ) ;
int index = round ( getIndices ( coords . x ) ) ;
setOutput ( mix ( float ( $ { a } ) , float ( $ { n } ) ,
float ( index == coords . y ) ) ) ;
2021-04-28 14:55:26 +02:00
}
2021-04-28 14:58:21 +02:00
` }},vG=e=>{let{inputs:t,backend:n,attrs:a}=e,{indices:r}=t,{depth:s,onValue:i,offValue:o}=a,l=k.sizeFromShape(r.shape),d=new bG(l,s,i,o),u=fe({inputs:{x:r},backend:n,attrs:{shape:[l]}}),p=n.runWebGLProgram(d,[u],r.dtype);n.disposeIntermediateTensorInfo(u);let c=[...r.shape,s],h=fe({inputs:{x:p},backend:n,attrs:{shape:c}});return n.disposeIntermediateTensorInfo(p),h},wG={kernelName:Ds,backendName:"webgl",kernelFunc:vG};function kh(e){let{inputs:t,backend:n}=e,{x:a}=t;if(a.dtype==="complex64"){let r=yd({inputs:{input:a},backend:n}),s=kh({inputs:{x:r},backend:n}),i=wh({inputs:{input:a},backend:n}),o=kh({inputs:{x:i},backend:n}),l=Lr({inputs:{real:s,imag:o},backend:n});return n.disposeIntermediateTensorInfo(r),n.disposeIntermediateTensorInfo(s),n.disposeIntermediateTensorInfo(i),n.disposeIntermediateTensorInfo(o),l}else return x1({attrs:{shape:a.shape,dtype:a.dtype,value:a.dtype==="string"?"":0},backend:n})}var kG={kernelName:Qo,backendName:"webgl",kernelFunc:kh};function i6(e){let{inputs:t,backend:n}=e,{x:a}=t;if(a.dtype==="string")throw new Error("onesLike is not supported under string dtype");if(a.dtype==="complex64"){let r=yd({inputs:{input:a},backend:n}),s=i6({inputs:{x:r},backend:n}),i=wh({inputs:{input:a},backend:n}),o=kh({inputs:{x:i},backend:n}),l=Lr({inputs:{real:s,imag:o},backend:n});return n.disposeIntermediateTensorInfo(r),n.disposeIntermediateTensorInfo(s),n.disposeIntermediateTensorInfo(i),n.disposeIntermediateTensorInfo(o),l}else return x1({attrs:{shape:a.shape,dtype:a.dtype,value:1},backend:n})}var IG={kernelName:_o,backendName:"webgl",kernelFunc:i6};function SG(e){let{inputs:t,backend:n,attrs:a}=e,{axis:r}=a;if(t.length===1)return g1({inputs:{input:t[0]},backend:n,attrs:{dim:r}});let s=t[0].shape,i=t[0].dtype;t.forEach(u=>{k.assertShapesMatch(s,u.shape,"All tensors passed to stack must have matching shapes"),k.assert(i===u.dtype,()=>"All tensors passed to stack must have matching dtypes")});let o=[],l=t.map(u=>{let p=g1({inputs:{input:u},backend:n,attrs:{dim:r}});return o.push(p),p}),d=Lv({inputs:l,backend:n,attrs:{axis:r}});return o.forEach(u=>n.disposeIntermediateTensorInfo(u)),d}var NG={kernelName:Po,backendName:"webgl",kernelFunc:SG},TG=class{constructor(e,t,n){this.variableNames=["x"],this.outputShape=t.map((l,d)=>l[0]+e[d]+l[1]);let a=e.length,r=lt(a),s=t.map(l=>l[0]).join(","),i=t.map((l,d)=>l[0]+e[d]).join(","),o=["coords[0]","coords[1]","coords[2]","coords[3]"].slice(0,a);if(a===1){this.userCode= `
int start = $ { s } ;
int end = $ { i } ;
uniform float value ;
void main ( ) {
int outC = getOutputCoords ( ) ;
if ( outC < start || outC >= end ) {
setOutput ( value ) ;
} else {
setOutput ( getX ( outC - start ) ) ;
2021-04-28 14:55:26 +02:00
}
}
2021-04-28 14:58:21 +02:00
` ;return}this.userCode= `
$ { r } start = $ { r } ( $ { s } ) ;
$ { r } end = $ { r } ( $ { i } ) ;
uniform float value ;
void main ( ) {
$ { r } outC = getOutputCoords ( ) ;
if ( any ( lessThan ( outC , start ) ) || any ( greaterThanEqual ( outC , end ) ) ) {
setOutput ( value ) ;
2021-04-28 14:55:26 +02:00
} else {
2021-04-28 14:58:21 +02:00
$ { r } coords = outC - start ;
setOutput ( getX ( $ { o } ) ) ;
2021-04-28 14:55:26 +02:00
}
}
2021-04-28 14:58:21 +02:00
` }getCustomSetupFunc(e){return(t,n)=>{this.valueLoc==null&&(this.valueLoc=t.getUniformLocationNoThrow(n,"value")),t.gl.uniform1f(this.valueLoc,e)}}},EG=class{constructor(e,t,n){this.variableNames=["x"],this.packedInputs=!0,this.packedOutput=!0,this.outputShape=t.map((m,f)=>m[0]+e[f]+m[1]);let a=e.length,r=lt(a),s=t.map(m=>m[0]).join(","),i=t.map((m,f)=>m[0]+e[f]).join(","),o=pn("rc",a),l=pn("source",a),d= ` $ { o [ a - 1 ] } < $ { this . outputShape [ a - 1 ] } ` ,u=a===1?"source": ` vec2 ( $ { l . slice ( - 2 ) . join ( ) } ) ` ,p=[ ` $ { r } rc = outputLoc ; ` , ` $ { o [ a - 1 ] } += 1 ;
if ( $ { d } ) {
` ,a===1?"": ` }
rc = outputLoc ;
$ { o [ a - 2 ] } += 1 ;
if ( $ { o [ a - 2 ] } < $ { this . outputShape [ a - 2 ] } ) { ` ,a===1?"": ` $ { o [ a - 1 ] } += 1 ;
if ( $ { d } ) { ` ],c=a===1?"rc < start || rc >= end":"any(lessThan(rc, start)) || any(greaterThanEqual(rc, end))",h="";for(let m=0,f=a===1?2:4;m<f;m++)h+= `
$ { p [ m ] }
if ( $ { c } ) {
result [ $ { m } ] = float ( value ) ;
} else {
$ { r } source = rc - start ;
result [ $ { m } ] = getChannel ( getX ( $ { l . join ( ) } ) , $ { u } ) ;
}
` ;h+=a===1?"} ":"}}",this.userCode= `
const $ { r } start = $ { r } ( $ { s } ) ;
const $ { r } end = $ { r } ( $ { i } ) ;
uniform float value ;
void main ( ) {
$ { r } outputLoc = getOutputCoords ( ) ;
vec4 result = vec4 ( 0. ) ;
$ { h }
setOutput ( result ) ;
2021-04-28 14:55:26 +02:00
}
2021-04-28 14:58:21 +02:00
` }getCustomSetupFunc(e){return(t,n)=>{this.valueLoc==null&&(this.valueLoc=t.getUniformLocationNoThrow(n,"value")),t.gl.uniform1f(this.valueLoc,e)}}},o6=e=>{let{inputs:t,backend:n,attrs:a}=e,{x:r}=t,{paddings:s,constantValue:i}=a,o=J().getBool("WEBGL_PACK_ARRAY_OPERATIONS")?new EG(r.shape,s,i):new TG(r.shape,s,i),l=o.getCustomSetupFunc(i);return n.runWebGLProgram(o,[r],r.dtype,l)},CG={kernelName:Os,backendName:"webgl",kernelFunc:o6},RG= `
if ( a < 0.0 && floor ( b ) < b ) {
return NAN ;
}
if ( b == 0.0 ) {
return 1.0 ;
}
return ( round ( mod ( b , 2.0 ) ) != 1 ) ?
pow ( abs ( a ) , b ) : sign ( a ) * pow ( abs ( a ) , b ) ;
` ,MG= `
// isModRound1 has 1 for components with round(mod(b, 2.0)) == 1, 0 otherwise.
vec4 isModRound1 = vec4 ( equal ( round ( mod ( b , 2.0 ) ) , ivec4 ( 1 ) ) ) ;
vec4 multiplier = sign ( a ) * isModRound1 + ( vec4 ( 1.0 ) - isModRound1 ) ;
vec4 result = multiplier * pow ( abs ( a ) , b ) ;
// Ensure that a^0 = 1, including 0^0 = 1 as this correspond to TF and JS
bvec4 isExpZero = equal ( b , vec4 ( 0.0 ) ) ;
result . r = isExpZero . r ? 1.0 : result . r ;
result . g = isExpZero . g ? 1.0 : result . g ;
result . b = isExpZero . b ? 1.0 : result . b ;
result . a = isExpZero . a ? 1.0 : result . a ;
vec4 isNaN = vec4 ( lessThan ( a , vec4 ( 0.0 ) ) ) * vec4 ( lessThan ( floor ( b ) , b ) ) ;
` +mh+ `
return result ;
` ,FG=en({opSnippet:RG,packedOpSnippet:MG}), $ G={kernelName:zs,backendName:"webgl",kernelFunc:FG};function DG(e){let{inputs:t,backend:n,attrs:a}=e,{x:r}=t,{axis:s,keepDims:i}=a,o=r.shape.length,l=[],d=k.parseAxisParam(s,r.shape),u=d,p=C.getAxesPermutation(u,o),c=r;p!=null&&(c=cn({inputs:{x:r},backend:n,attrs:{perm:p}}),u=C.getInnerMostAxes(u.length,o),l.push(c)),C.assertAxesAreInnerMostDims("prod",u,o);let h;if(n.shouldExecuteOnCPU([c])){let m=n.texData.get(c.dataId).values,{outVals:f,outShape:A,outDtype:y}=KL(c.shape,c.dtype,m,u);h=n.makeTensorInfo(A,y,f)}else{let[m,f]=C.computeOutAndReduceShapes(c.shape,u),A=k.sizeFromShape(f),y=fe({inputs:{x:c},backend:n,attrs:{shape:[-1,A]}}),g=lc(r.dtype),x=Ni(y,g,"prod",n);h=fe({inputs:{x},backend:n,attrs:{shape:m}}),l.push(y),l.push(x)}if(i){l.push(h);let m=C.expandShapeToKeepDim(h.shape,d);h=fe({inputs:{x:h},backend:n,attrs:{shape:m}})}return l.forEach(m=>n.disposeIntermediateTensorInfo(m)),h}var OG={kernelName:Lo,backendName:"webgl",kernelFunc:DG},l6=e=>{let{backend:t,attrs:n}=e,{start:a,stop:r,step:s,dtype:i}=n,o=ZL(a,r,s,i);return t.makeTensorInfo([o.length],i,o)},zG={kernelName:Iu,backendName:"webgl",kernelFunc:l6},_G="return 1.0 / x;",PG=qe({opSnippet:_G}),LG={kernelName:Wo,backendName:"webgl",kernelFunc:PG},WG=ba+ `
return ( x < 0.0 ) ? 0.0 : x ;
` ,BG= `
vec4 result = x * vec4 ( greaterThanEqual ( x , vec4 ( 0.0 ) ) ) ;
bvec4 isNaN = isnan ( x ) ;
result . r = isNaN . r ? x . r : result . r ;
result . g = isNaN . g ? x . g : result . g ;
result . b = isNaN . b ? x . b : result . b ;
result . a = isNaN . a ? x . a : result . a ;
return result ;
` ,VG=qe({opSnippet:WG,packedOpSnippet:BG}),jG={kernelName:Ps,backendName:"webgl",kernelFunc:VG},UG=ba+ `
return ( x < 0.0 ) ? 0.0 : min ( 6.0 , x ) ;
` ,HG= `
vec4 result = min ( x , vec4 ( 6. ) ) * vec4 ( greaterThanEqual ( x , vec4 ( 0.0 ) ) ) ;
bvec4 isNaN = isnan ( x ) ;
result . r = isNaN . r ? x . r : result . r ;
result . g = isNaN . g ? x . g : result . g ;
result . b = isNaN . b ? x . b : result . b ;
result . a = isNaN . a ? x . a : result . a ;
return result ;
` ,GG=qe({opSnippet:UG,packedOpSnippet:HG}),qG={kernelName:Ws,backendName:"webgl",kernelFunc:GG},XG=class{constructor(e,t,n,a,r){this.variableNames=["A"],this.outputShape=[];let[s,i,o,l]=e;this.outputShape=[s,t,n,l];let d=[a&&t>1?i-1:i,a&&n>1?o-1:o],u=[a&&t>1?t-1:t,a&&n>1?n-1:n],p;r?p="(vec2(yRC) + vec2(0.5)) * effectiveInputOverOutputRatioRC - vec2(0.5)":p="vec2(yRC) * effectiveInputOverOutputRatioRC",this.userCode= `
const vec2 effectiveInputOverOutputRatioRC = vec2 (
$ { d [ 0 ] / u [ 0 ] } ,
$ { d [ 1 ] / u [ 1 ] } ) ;
const vec2 inputShapeRC = vec2 ( $ { i } . 0 , $ { o } . 0 ) ;
void main ( ) {
ivec4 coords = getOutputCoords ( ) ;
int b = coords [ 0 ] ;
int d = coords [ 3 ] ;
ivec2 yRC = coords . yz ;
// Fractional source index.
vec2 sourceFracIndexRC = $ { p } ;
// Compute the four integer indices.
ivec2 sourceFloorRC = ivec2 ( max ( sourceFracIndexRC , vec2 ( 0.0 ) ) ) ;
ivec2 sourceCeilRC = ivec2 (
min ( inputShapeRC - 1.0 , ceil ( sourceFracIndexRC ) ) ) ;
float topLeft = getA ( b , sourceFloorRC . x , sourceFloorRC . y , d ) ;
float bottomLeft = getA ( b , sourceCeilRC . x , sourceFloorRC . y , d ) ;
float topRight = getA ( b , sourceFloorRC . x , sourceCeilRC . y , d ) ;
float bottomRight = getA ( b , sourceCeilRC . x , sourceCeilRC . y , d ) ;
vec2 fracRC = sourceFracIndexRC - vec2 ( sourceFloorRC ) ;
float top = topLeft + ( topRight - topLeft ) * fracRC . y ;
float bottom = bottomLeft + ( bottomRight - bottomLeft ) * fracRC . y ;
float newValue = top + ( bottom - top ) * fracRC . x ;
setOutput ( newValue ) ;
2021-04-28 14:55:26 +02:00
}
2021-04-28 14:58:21 +02:00
` }},KG=class{constructor(e,t,n,a,r){this.variableNames=["A"],this.packedInputs=!0,this.packedOutput=!0,this.outputShape=[];let[s,i,o,l]=e;this.outputShape=[s,t,n,l];let d=[a&&t>1?i-1:i,a&&n>1?o-1:o],u=[a&&t>1?t-1:t,a&&n>1?n-1:n],p;r?p="(vec3(yRC) + vec3(0.5)) * effectiveInputOverOutputRatioRC - vec3(0.5)":p="vec3(yRC) * effectiveInputOverOutputRatioRC",this.userCode= `
const vec3 effectiveInputOverOutputRatioRC = vec3 (
$ { d [ 0 ] / u [ 0 ] } ,
$ { d [ 1 ] / u [ 1 ] } ,
$ { d [ 1 ] / u [ 1 ] } ) ;
const vec3 inputShapeRC = vec3 ( $ { i } . 0 , $ { o } . 0 ,
$ { o } . 0 ) ;
float getAValue ( int b , int r , int c , int d ) {
return getChannel ( getA ( b , r , c , d ) , vec2 ( c , d ) ) ;
2021-04-28 14:55:26 +02:00
}
2021-04-28 14:58:21 +02:00
void main ( ) {
ivec4 coords = getOutputCoords ( ) ;
int b = coords [ 0 ] ;
int d = coords [ 3 ] ;
// Calculate values for next column in yRC.z.
ivec3 yRC = coords . yzz + ivec3 ( 0 , 0 , 1 ) ;
// Fractional source index.
vec3 sourceFracIndexRC = $ { p } ;
// Compute the four integer indices.
ivec3 sourceFloorRC = ivec3 ( max ( sourceFracIndexRC , vec3 ( 0.0 ) ) ) ;
ivec3 sourceCeilRC = ivec3 (
min ( inputShapeRC - 1.0 , ceil ( sourceFracIndexRC ) ) ) ;
// Should we calculate next column and row elements in 2x2 packed cell.
bool hasNextCol = d < $ { l - 1 } ;
bool hasNextRow = coords . z < $ { n - 1 } ;
// In parallel, construct four corners for all four components in
// packed 2x2 cell.
vec4 topLeft = vec4 (
getAValue ( b , sourceFloorRC . x , sourceFloorRC . y , d ) ,
hasNextCol ? getAValue ( b , sourceFloorRC . x , sourceFloorRC . y , d + 1 )
: 0.0 ,
hasNextRow ? getAValue ( b , sourceFloorRC . x , sourceFloorRC . z , d )
: 0.0 ,
( hasNextRow && hasNextCol ) ?
getAValue ( b , sourceFloorRC . x , sourceFloorRC . z , d + 1 ) : 0.0 ) ;
vec4 bottomLeft = vec4 (
getAValue ( b , sourceCeilRC . x , sourceFloorRC . y , d ) ,
hasNextCol ? getAValue ( b , sourceCeilRC . x , sourceFloorRC . y , d + 1 )
: 0.0 ,
hasNextRow ? getAValue ( b , sourceCeilRC . x , sourceFloorRC . z , d )
: 0.0 ,
( hasNextRow && hasNextCol ) ?
getAValue ( b , sourceCeilRC . x , sourceFloorRC . z , d + 1 ) : 0.0 ) ;
vec4 topRight = vec4 (
getAValue ( b , sourceFloorRC . x , sourceCeilRC . y , d ) ,
hasNextCol ? getAValue ( b , sourceFloorRC . x , sourceCeilRC . y , d + 1 )
: 0.0 ,
hasNextRow ? getAValue ( b , sourceFloorRC . x , sourceCeilRC . z , d )
: 0.0 ,
( hasNextRow && hasNextCol ) ?
getAValue ( b , sourceFloorRC . x , sourceCeilRC . z , d + 1 ) : 0.0 ) ;
vec4 bottomRight = vec4 (
getAValue ( b , sourceCeilRC . x , sourceCeilRC . y , d ) ,
hasNextCol ? getAValue ( b , sourceCeilRC . x , sourceCeilRC . y , d + 1 )
: 0.0 ,
hasNextRow ? getAValue ( b , sourceCeilRC . x , sourceCeilRC . z , d )
: 0.0 ,
( hasNextRow && hasNextCol ) ?
getAValue ( b , sourceCeilRC . x , sourceCeilRC . z , d + 1 ) : 0.0 ) ;
vec3 fracRC = sourceFracIndexRC - vec3 ( sourceFloorRC ) ;
vec4 top = mix ( topLeft , topRight , fracRC . yyzz ) ;
vec4 bottom = mix ( bottomLeft , bottomRight , fracRC . yyzz ) ;
vec4 newValue = mix ( top , bottom , fracRC . x ) ;
setOutput ( newValue ) ;
2021-04-28 14:55:26 +02:00
}
2021-04-28 14:58:21 +02:00
` }};function ZG(e){let{inputs:t,backend:n,attrs:a}=e,{images:r}=t,{alignCorners:s,halfPixelCenters:i,size:o}=a,[l,d]=o,u=J().getBool("WEBGL_PACK_IMAGE_OPERATIONS")?new KG(r.shape,l,d,s,i):new XG(r.shape,l,d,s,i);return n.runWebGLProgram(u,[r],"float32")}var YG={kernelName:Ls,backendName:"webgl",kernelFunc:ZG},JG=class{constructor(e,t,n){this.variableNames=["dy"],this.outputShape=[],this.outputShape=t;let[,a,r]=t,[,s,i]=e,o=[n&&s>1?a-1:a,n&&i>1?r-1:r],l=[n&&s>1?s-1:s,n&&i>1?i-1:i],d=o[0]/l[0],u=o[1]/l[1],p=1/d,c=1/u,h=Math.ceil(p)*2+2,m=Math.ceil(c)*2+2;this.userCode= `
void main ( ) {
ivec4 coords = getOutputCoords ( ) ;
int b = coords [ 0 ] ;
int d = coords [ 3 ] ;
int r = coords [ 1 ] ;
int c = coords [ 2 ] ;
float accumulator = 0.0 ;
const float heightScale = float ( $ { d } ) ;
const float widthScale = float ( $ { u } ) ;
const float invHeightScale = float ( $ { p } ) ;
const float invWidthScale = float ( $ { c } ) ;
const int winHeight = int ( $ { h } ) ;
const int winWidth = int ( $ { m } ) ;
// Compute bounds for where in dy we will look
float startRLerp = floor ( float ( r ) * invHeightScale ) ;
int startDyR = int ( startRLerp - float ( winHeight / 2 ) ) ;
float startCLerp = floor ( float ( c ) * invWidthScale ) ;
int startDyC = int ( startCLerp - float ( winWidth / 2 ) ) ;
// Loop over dy
for ( int dyROffset = 0 ; dyROffset < winHeight ; dyROffset ++ ) {
int dyR = dyROffset + startDyR ;
// Guard against the window exceeding the bounds of dy
if ( dyR < 0 || dyR >= $ { s } ) {
continue ;
2021-04-28 14:55:26 +02:00
}
2021-04-28 14:58:21 +02:00
for ( int dyCOffset = 0 ; dyCOffset < winWidth ; dyCOffset ++ ) {
int dyC = dyCOffset + startDyC ;
// Guard against the window exceeding the bounds of dy
if ( dyC < 0 || dyC >= $ { i } ) {
continue ;
}
float dxR = float ( dyR ) * heightScale ;
int topDxRIndex = int ( floor ( dxR ) ) ;
int bottomDxRIndex = int ( min ( ceil ( dxR ) , $ { a - 1 } . 0 ) ) ;
float dxRLerp = dxR - float ( topDxRIndex ) ;
float inverseDxRLerp = 1.0 - dxRLerp ;
float dxC = float ( dyC ) * widthScale ;
int leftDxCIndex = int ( floor ( dxC ) ) ;
int rightDxCIndex = int ( min ( ceil ( dxC ) , $ { r - 1 } . 0 ) ) ;
float dxCLerp = dxC - float ( leftDxCIndex ) ;
float inverseDxCLerp = 1.0 - dxCLerp ;
if ( r == topDxRIndex && c == leftDxCIndex ) {
// topLeft
accumulator +=
getDy ( b , dyR , dyC , d ) * inverseDxRLerp * inverseDxCLerp ;
}
if ( r == topDxRIndex && c == rightDxCIndex ) {
// topRight
accumulator += getDy ( b , dyR , dyC , d ) * inverseDxRLerp * dxCLerp ;
}
if ( r == bottomDxRIndex && c == leftDxCIndex ) {
// bottomLeft
accumulator += getDy ( b , dyR , dyC , d ) * dxRLerp * inverseDxCLerp ;
}
if ( r == bottomDxRIndex && c == rightDxCIndex ) {
// bottomRight
accumulator += getDy ( b , dyR , dyC , d ) * dxRLerp * dxCLerp ;
2021-04-28 14:55:26 +02:00
}
}
}
2021-04-28 14:58:21 +02:00
// End loop over dy
setOutput ( accumulator ) ;
2021-04-28 14:55:26 +02:00
}
2021-04-28 14:58:21 +02:00
` }};function QG(e){let{inputs:t,backend:n,attrs:a}=e,{images:r,dy:s}=t,{alignCorners:i}=a,o=new JG(s.shape,r.shape,i);return n.runWebGLProgram(o,[s],s.dtype)}var eq={kernelName:Jp,backendName:"webgl",kernelFunc:QG},tq=class{constructor(e,t,n,a,r){this.variableNames=["A"],this.outputShape=[];let[s,i,o,l]=e;this.outputShape=[s,t,n,l];let d=[a&&t>1?i-1:i,a&&n>1?o-1:o],u=[a&&t>1?t-1:t,a&&n>1?n-1:n],p=a?"0.5":"0.0",c;r?c="max((vec2(yRC) + vec2(0.5)) * effectiveInputOverOutputRatioRC, vec2(0.0))":c="vec2(yRC) * effectiveInputOverOutputRatioRC",this.userCode= `
const vec2 effectiveInputOverOutputRatioRC = vec2 (
$ { d [ 0 ] / u [ 0 ] } ,
$ { d [ 1 ] / u [ 1 ] } ) ;
const vec2 inputShapeRC = vec2 ( $ { i } . 0 , $ { o } . 0 ) ;
void main ( ) {
ivec4 coords = getOutputCoords ( ) ;
int b = coords [ 0 ] ;
int d = coords [ 3 ] ;
ivec2 yRC = coords . yz ;
// Fractional source index.
vec2 sourceFracIndexRC = $ { c } ;
// Compute the coordinators of nearest neighbor point.
ivec2 sourceNearestRC = ivec2 (
min ( inputShapeRC - 1.0 , floor ( sourceFracIndexRC + $ { p } ) ) ) ;
float newValue = getA ( b , sourceNearestRC . x , sourceNearestRC . y , d ) ;
setOutput ( newValue ) ;
2021-04-28 14:55:26 +02:00
}
2021-04-28 14:58:21 +02:00
` }};function nq(e){let{inputs:t,backend:n,attrs:a}=e,{images:r}=t,{alignCorners:s,halfPixelCenters:i,size:o}=a,[l,d]=o,u=new tq(r.shape,l,d,s,i);return n.runWebGLProgram(u,[r],r.dtype)}var aq={kernelName:Su,backendName:"webgl",kernelFunc:nq},rq=class{constructor(e,t,n){this.variableNames=["dy"],this.outputShape=[],this.outputShape=t;let[,a,r]=t,[,s,i]=e,o=[n&&s>1?a-1:a,n&&i>1?r-1:r],l=[n&&s>1?s-1:s,n&&i>1?i-1:i],d=o[0]/l[0],u=o[1]/l[1],p=1/d,c=1/u,h=Math.ceil(p)*2+2,m=Math.ceil(c)*2+2;this.userCode= `
void main ( ) {
ivec4 coords = getOutputCoords ( ) ;
int b = coords [ 0 ] ;
int d = coords [ 3 ] ;
int r = coords [ 1 ] ;
int c = coords [ 2 ] ;
float accumulator = 0.0 ;
const float heightScale = float ( $ { d } ) ;
const float widthScale = float ( $ { u } ) ;
const float invHeightScale = float ( $ { p } ) ;
const float invWidthScale = float ( $ { c } ) ;
const int winHeight = int ( $ { h } ) ;
const int winWidth = int ( $ { m } ) ;
// Compute bounds for where in dy we will look
float startRLerp = floor ( float ( r ) * invHeightScale ) ;
int startDyR = int ( floor ( startRLerp - float ( winHeight / 2 ) ) ) ;
2021-04-19 22:19:03 +02:00
2021-04-28 14:58:21 +02:00
float startCLerp = floor ( float ( c ) * invWidthScale ) ;
int startDyC = int ( floor ( startCLerp - float ( winWidth / 2 ) ) ) ;
// Loop over dy
for ( int dyROffset = 0 ; dyROffset < winHeight ; dyROffset ++ ) {
int dyR = dyROffset + startDyR ;
// Guard against the window exceeding the bounds of dy
if ( dyR < 0 || dyR >= $ { s } ) {
continue ;
}
for ( int dyCOffset = 0 ; dyCOffset < winWidth ; dyCOffset ++ ) {
int dyC = dyCOffset + startDyC ;
// Guard against the window exceeding the bounds of dy
if ( dyC < 0 || dyC >= $ { i } ) {
continue ;
}
float sourceFracRow =
float ( $ { o [ 0 ] } ) *
( float ( dyR ) / float ( $ { l [ 0 ] } ) ) ;
float sourceFracCol =
float ( $ { o [ 1 ] } ) *
( float ( dyC ) / float ( $ { l [ 1 ] } ) ) ;
int sourceNearestRow = int ( min (
float ( int ( $ { a } ) - 1 ) ,
$ { n } ? float ( round ( sourceFracRow ) ) :
float ( floor ( sourceFracRow ) ) ) ) ;
int sourceNearestCol = int ( min (
float ( int ( $ { r } ) - 1 ) ,
$ { n } ? float ( round ( sourceFracCol ) ) :
float ( floor ( sourceFracCol ) ) ) ) ;
if ( r == sourceNearestRow && c == sourceNearestCol ) {
accumulator += getDy ( b , dyR , dyC , d ) ;
}
}
2021-03-29 21:01:16 +02:00
}
2021-04-28 14:58:21 +02:00
// End loop over dy
setOutput ( accumulator ) ;
2021-03-30 15:03:18 +02:00
}
2021-04-28 14:58:21 +02:00
` }};function sq(e){let{inputs:t,backend:n,attrs:a}=e,{images:r,dy:s}=t,{alignCorners:i}=a,o=new rq(s.shape,r.shape,i);return n.runWebGLProgram(o,[s],s.dtype)}var iq={kernelName:Yp,backendName:"webgl",kernelFunc:sq},oq=class{constructor(e,t){this.variableNames=["x"];let n=e.length;if(n>4)throw new Error( ` WebGL backend : Reverse of rank - $ { n } tensor is not yet supported ` );if(this.outputShape=e,n===1){this.userCode= `
void main ( ) {
int coord = getOutputCoords ( ) ;
setOutput ( getX ( $ { e [ 0 ] } - coord - 1 ) ) ;
}
` ;return}let a=i=>t.indexOf(i)!==-1&&e[i]!==1? ` $ { e [ i ] } - coords [ $ { i } ] - 1 ` : ` coords [ $ { i } ] ` ,r=e.map((i,o)=>a(o)).join(","),s=lt(n);this.userCode= `
void main ( ) {
$ { s } coords = getOutputCoords ( ) ;
setOutput ( getX ( $ { r } ) ) ;
2021-03-24 16:43:28 +01:00
}
2021-04-28 14:58:21 +02:00
` }},lq=class{constructor(e,t){this.variableNames=["x"],this.packedInputs=!0,this.packedOutput=!0;let n=e.length;if(n>4)throw new Error( ` WebGL backend : Reverse of rank - $ { n } tensor is not yet supported ` );this.outputShape=e;let a=pn("rc",n),r= ` $ { a [ n - 1 ] } + 1 < $ { this . outputShape [ n - 1 ] } ` ,s= ` $ { a [ n - 2 ] } + 1 < $ { this . outputShape [ n - 2 ] } ` ,i=lt(n);n===1?this.userCode= `
void main ( ) {
int rc = getOutputCoords ( ) ;
vec4 result = vec4 ( 0. ) ;
result . r = getChannel ( getX ( $ { e [ 0 ] } - rc - 1 ) ,
$ { e [ 0 ] } - rc - 1 ) ;
if ( $ { r } ) {
result . g = getChannel ( getX ( $ { e [ 0 ] } - ( rc + 1 ) - 1 ) ,
$ { e [ 0 ] } - ( rc + 1 ) - 1 ) ;
}
setOutput ( result ) ;
}
` :this.userCode= `
void main ( ) {
$ { i } rc = getOutputCoords ( ) ;
vec4 result = vec4 ( 0. ) ;
result . r = $ { o ( a . slice ( ) ) } ;
if ( $ { r } ) {
result . g = $ { l ( a . slice ( ) ) } ;
}
if ( $ { s } ) {
result . b = $ { d ( a . slice ( ) ) } ;
if ( $ { r } ) {
result . a = $ { u ( a . slice ( ) ) } ;
}
}
setOutput ( result ) ;
}
` ;function o(h){return p(h)}function l(h){return h[n-1]="("+h[n-1]+" + 1)",p(h)}function d(h){return h[n-2]="("+h[n-2]+" + 1)",p(h)}function u(h){return h[n-1]="("+h[n-1]+" + 1)",h[n-2]="("+h[n-2]+" + 1)",p(h)}function p(h){let m=e.map((y,g)=>c(g,h)),f=m.join(","),A=m.slice(-2).join(",");return ` getChannel ( getX ( $ { f } ) , vec2 ( $ { A } ) ) ` }function c(h,m){return t.indexOf(h)!==-1&&e[h]!==1? ` $ { e [ h ] } - $ { m [ h ] } - 1 ` : ` $ { m [ h ] } ` }}};function uq(e){let{inputs:t,backend:n,attrs:a}=e,{x:r}=t,{dims:s}=a,i=r.shape.length,o=k.parseAxisParam(s,r.shape);if(i===0)return Pn({inputs:{x:r},backend:n});let l=J().getBool("WEBGL_PACK_ARRAY_OPERATIONS")?new lq(r.shape,o):new oq(r.shape,o);return n.runWebGLProgram(l,[r],r.dtype)}var dq={kernelName:Bs,backendName:"webgl",kernelFunc:uq},pq=class{constructor(e,t){this.variableNames=["Image"],this.outputShape=[];let n=e[1],a=e[2];this.outputShape=e;let r="";typeof t=="number"?r= ` float outputValue = $ { t . toFixed ( 2 ) } ; ` :r= `
vec3 fill = vec3 ( $ { t . join ( "," ) } ) ;
float outputValue = fill [ coords [ 3 ] ] ; ` ,this.userCode= `
uniform vec4 params ;
void main ( ) {
ivec4 coords = getOutputCoords ( ) ;
int x = coords [ 2 ] ;
int y = coords [ 1 ] ;
float coordXFloat = ( float ( x ) - params [ 0 ] ) * params [ 3 ] -
( float ( y ) - params [ 1 ] ) * params [ 2 ] ;
float coordYFloat = ( float ( x ) - params [ 0 ] ) * params [ 2 ] +
( float ( y ) - params [ 1 ] ) * params [ 3 ] ;
int coordX = int ( round ( coordXFloat + params [ 0 ] ) ) ;
int coordY = int ( round ( coordYFloat + params [ 1 ] ) ) ;
$ { r }
if ( coordX >= 0 && coordX < $ { a } && coordY >= 0 && coordY < $ { n } ) {
outputValue = getImage ( coords [ 0 ] , coordY , coordX , coords [ 3 ] ) ;
}
setOutput ( outputValue ) ;
}
` }getCustomSetupFunc(e,t,n,a){return(r,s)=>{this.paramsLoc==null&&(this.paramsLoc=r.getUniformLocationNoThrow(s,"params")),r.gl.uniform4f(this.paramsLoc,e,t,n,a)}}},cq={kernelName:el,backendName:"webgl",kernelFunc:({inputs:e,attrs:t,backend:n})=>{let{image:a}=e,{radians:r,fillValue:s,center:i}=t,o=n,l=new pq(a.shape,s),[d,u]=C.getImageCenter(i,a.shape[1],a.shape[2]),p=l.getCustomSetupFunc(d,u,Math.sin(r),Math.cos(r));return o.runWebGLProgram(l,[a],a.dtype,p)}},hq= `
// OpenGL ES does not support round function.
// The algorithm is based on banker's rounding.
float base = floor ( x ) ;
if ( ( x - base ) < 0.5 ) {
return floor ( x ) ;
} else if ( ( x - base ) > 0.5 ) {
return ceil ( x ) ;
} else {
if ( mod ( base , 2.0 ) == 0.0 ) {
return base ;
} else {
return base + 1.0 ;
2021-04-28 14:55:26 +02:00
}
}
2021-04-28 14:58:21 +02:00
` ,fq=qe({opSnippet:hq}),mq={kernelName:Vs,backendName:"webgl",kernelFunc:fq},Aq="return inversesqrt(x);",yq=qe({opSnippet:Aq,cpuKernelImpl:YL}),gq={kernelName:js,backendName:"webgl",kernelFunc:yq},u6=class{constructor(e,t,n,a,r,s,i=!0){this.variableNames=["updates","indices","defaultValue"],this.outputShape=s;let o=lt(r.length),l=lt(s.length),d="";n===1?d="i":n===2&&(d="i, j");let u= ` getIndices ( $ { d } ) ` ,p="";a===1?p="i":a===2&&(p="i, coords[1]");let c= ` getUpdates ( $ { p } ) ` ,h=t>1?"strides[j]":"strides";this.userCode= `
$ { o } strides = $ { o } ( $ { r } ) ;
void main ( ) {
$ { l } coords = getOutputCoords ( ) ;
float sum = 0.0 ;
bool found = false ;
for ( int i = 0 ; i < $ { e } ; i ++ ) {
int flattenedIndex = 0 ;
for ( int j = 0 ; j < $ { t } ; j ++ ) {
int index = round ( $ { u } ) ;
flattenedIndex += index * $ { h } ;
}
if ( flattenedIndex == coords [ 0 ] ) {
sum += $ { c } ;
found = true ;
}
}
setOutput ( mix ( getDefaultValue ( ) , sum , float ( found ) ) ) ;
}
` }};function xq(e){let{inputs:t,backend:n,attrs:a}=e,{indices:r,updates:s}=t,{shape:i}=a,{sliceRank:o,numUpdates:l,sliceSize:d,strides:u,outputSize:p}=C.calculateShapes(s,r,i),c=[p/d,d];if(p===0)return n.makeTensorInfo(i,r.dtype);let h=fe({inputs:{x:r},backend:n,attrs:{shape:[l,o]}}),m=fe({inputs:{x:s},backend:n,attrs:{shape:[l,d]}}),f=n.makeTensorInfo([],"float32",new Float32Array([0])),A=new u6(l,o,h.shape.length,m.shape.length,u,c),y=n.runWebGLProgram(A,[m,h,f],m.dtype),g=fe({inputs:{x:y},backend:n,attrs:{shape:i}});return n.disposeIntermediateTensorInfo(h),n.disposeIntermediateTensorInfo(m),n.disposeIntermediateTensorInfo(y),n.disposeIntermediateTensorInfo(f),g}var bq={kernelName:Vo,backendName:"webgl",kernelFunc:xq},vq=class{constructor(e,t,n){this.variableNames=["c","a","b"],this.outputShape=t;let a,r;if(n>4)throw Error( ` Where for rank $ { n } is not yet supported ` );if(n===1)r="resRC",a="resRC";else{let i=["resRC.x","resRC.y","resRC.z","resRC.w"],o=[],l=[];for(let d=0;d<t.length;d++)l.push( ` $ { i [ d ] } ` ),d<e&&o.push( ` $ { i [ d ] } ` );a=o.join(),r=l.join()}let s=lt(n);this.userCode= `
void main ( ) {
$ { s } resRC = getOutputCoords ( ) ;
float cVal = getC ( $ { a } ) ;
if ( cVal >= 1.0 ) {
setOutput ( getA ( $ { r } ) ) ;
} else {
setOutput ( getB ( $ { r } ) ) ;
}
2021-04-19 22:19:03 +02:00
}
2021-04-28 14:58:21 +02:00
` }};function wq(e){let{inputs:t,backend:n}=e,{condition:a,t:r,e:s}=t,i=new vq(a.shape.length,r.shape,r.shape.length);return n.runWebGLProgram(i,[a,r,s],sa(r.dtype,s.dtype))}var kq={kernelName:jo,backendName:"webgl",kernelFunc:wq},Iq= `
// Stable and Attracting Fixed Point (0, 1) for Normalized Weights.
// see: https://arxiv.org/abs/1706.02515
float scaleAlpha = $ { C . SELU _SCALEALPHA } ;
float scale = $ { C . SELU _SCALE } ;
return ( x >= 0.0 ) ? scale * x : scaleAlpha * ( exp ( x ) - 1.0 ) ;
` ,Sq=qe({opSnippet:Iq}),Nq={kernelName:Uo,backendName:"webgl",kernelFunc:Sq},Tq="return 1.0 / (1.0 + exp(-1.0 * x));",Eq=qe({opSnippet:Tq}),Cq={kernelName:Hs,backendName:"webgl",kernelFunc:Eq},Rq= `
if ( isnan ( x ) ) { return 0.0 ; }
return sign ( x ) ;
` ,Mq=qe({opSnippet:Rq}),Fq={kernelName:qo,backendName:"webgl",kernelFunc:Mq}, $ q=Iv+ `
return sin ( x ) ;
` ,Dq=qe({opSnippet: $ q}),Oq={kernelName:Us,backendName:"webgl",kernelFunc:Dq},zq= `
float e2x = exp ( x ) ;
return ( e2x - 1.0 / e2x ) / 2.0 ;
` ,_q=qe({opSnippet:zq}),Pq={kernelName:Go,backendName:"webgl",kernelFunc:_q},Lq= `
float epsilon = 1.1920928955078125 e - 7 ;
float threshold = log ( epsilon ) + 2.0 ;
bool too _large = x > - threshold ;
bool too _small = x < threshold ;
float result ;
float exp _x = exp ( x ) ;
if ( too _large ) {
result = x ;
2021-04-19 22:02:47 +02:00
}
2021-04-28 14:58:21 +02:00
else if ( too _small ) {
result = exp _x ;
2021-04-28 14:55:26 +02:00
}
2021-04-28 14:58:21 +02:00
else {
result = log ( exp _x + 1.0 ) ;
2021-04-19 22:02:47 +02:00
}
2021-04-28 14:58:21 +02:00
return result ;
` ,Wq=qe({opSnippet:Lq}),Bq={kernelName:Xo,backendName:"webgl",kernelFunc:Wq},Vq=e=>{let{inputs:t,backend:n,attrs:a}=e,{x:r}=t,{blockShape:s,paddings:i}=a;k.assert(r.shape.length<=4,()=>"spaceToBatchND for rank > 4 with a WebGL backend not implemented yet");let o=s.reduce((y,g)=>y*g),l=[[0,0]];l.push(...i);for(let y=1+s.length;y<r.shape.length;++y)l.push([0,0]);let d=[],u=o6({inputs:{x:r},backend:n,attrs:{paddings:l,constantValue:0}}),p=C.getReshaped(u.shape,s,o,!1),c=C.getPermuted(p.length,s.length,!1),h=C.getReshapedPermuted(u.shape,s,o,!1),m=fe({inputs:{x:u},backend:n,attrs:{shape:p}}),f=cn({inputs:{x:m},backend:n,attrs:{perm:c}}),A=fe({inputs:{x:f},backend:n,attrs:{shape:h}});return d.push(u),d.push(m),d.push(f),d.forEach(y=>n.disposeIntermediateTensorInfo(y)),A},jq={kernelName:Nu,backendName:"webgl",kernelFunc:Vq};function Uq(e){let{inputs:t,backend:n}=e,{inputIndices:a,inputShape:r,newShape:s}=t;if(a.shape.length!==2)throw new Error( ` Input indices should be a matrix but received shape $ { a . shape } ` );if(r.shape.length!==1)throw new Error( ` Input shape should be a vector but received shape $ { r . shape } ` );if(s.shape.length!==1)throw new Error( ` Target shape should be a vector but received shape $ { s . shape } ` );let i=Array.from(n.readSync(r.dataId)),o=n.readSync(a.dataId),l=Array.from(n.readSync(s.dataId)),[d,u,p]=QL(o,a.shape,a.dtype,i,l);return[n.makeTensorInfo(u,a.dtype,d),n.makeTensorInfo([p.length],s.dtype,new Int32Array(p))]}var Hq={kernelName:Qp,backendName:"webgl",kernelFunc:Uq};function Gq(e){let{inputs:t,backend:n,attrs:a}=e,{sparseIndices:r,sparseValues:s,defaultValue:i}=t,{outputShape:o}=a,{sliceRank:l,numUpdates:d,strides:u,outputSize:p}=C.calculateShapes(s,r,o),c=!1,h=new u6(d,l,r.shape.length,s.shape.length,u,[p,1],c),m=n.runWebGLProgram(h,[s,r,i],s.dtype),f=fe({inputs:{x:m},backend:n,attrs:{shape:o}});return n.disposeIntermediateTensorInfo(m),f}var qq={kernelName:ec,backendName:"webgl",kernelFunc:Gq};function Xq(e){let{inputs:t,backend:n,attrs:a}=e,{x:r}=t,{numOrSizeSplits:s,axis:i}=a,o=k.parseAxisParam(i,r.shape)[0],l=C.prepareSplitSize(r,s,o),d=r.shape.length,u=new Array(d).fill(0),p=r.shape.slice();return l.map(c=>{let h=[...p];h[o]=c;let m=Ad({inputs:{x:r},backend:n,attrs:{begin:u,size:h}});return u[o]+=c,m})}var Kq={kernelName:Ko,backendName:"webgl",kernelFunc:Xq},Zq="return sqrt(x);",Yq=qe({opSnippet:Zq}),Jq={kernelName:Gs,backendName:"webgl",kernelFunc:Yq},Qq="return x * x;",eX=qe({opSnippet:Qq}),tX={kernelName:Tu,backendName:"webgl",kernelFunc:eX},d6="return (a - b) * (a - b);",nX=en({opSnippet:d6,packedOpSnippet:d6}),aX={kernelName:Ks,backendName:"webgl",kernelFunc:nX};function rX({inputs:e,attrs:t,backend:n}){let{x:a}=e,r=ba+ `
return x > 0.0 ? 1.0 : float ( $ { t . alpha } ) ;
` ,s=new Pr(a.shape,r);return n.runWebGLProgram(s,[a],a.dtype)}var sX={kernelName:Nr,backendName:"webgl",kernelFunc:rX},iX=class{constructor(e,t,n){this.variableNames=["x"],this.outputShape=n;let a=n.length,r=lt(n.length),s=lt(n.length),i="";if(a===1)i="coords * strides + begin";else{let o=0;i=n.map((l,d)=>(o++,n.length===1? ` coords * strides [ $ { d } ] + begin [ $ { d } ] ` : ` coords [ $ { o - 1 } ] * strides [ $ { d } ] + begin [ $ { d } ] ` )).join(",")}this.userCode= `
$ { r } begin = $ { r } ( $ { e } ) ;
$ { r } strides = $ { r } ( $ { t } ) ;
2021-04-19 22:19:03 +02:00
2021-04-28 14:58:21 +02:00
void main ( ) {
$ { s } coords = getOutputCoords ( ) ;
setOutput ( getX ( $ { i } ) ) ;
2021-04-28 14:55:26 +02:00
}
2021-04-28 14:58:21 +02:00
` }};function oX(e){let{inputs:t,backend:n,attrs:a}=e,{x:r}=t,{begin:s,end:i,strides:o,beginMask:l,endMask:d,ellipsisMask:u,newAxisMask:p,shrinkAxisMask:c}=a,{nonStrided:h, $ begin:m, $ strides:f,size:A,newShape:y,outShape:g}=sn.sliceInfo(r.shape,s,i,o,l,d,u,p,c),x=fe({inputs:{x:r},backend:n,attrs:{shape:y}}),w;if(h){let v=Ad({inputs:{x},backend:n,attrs:{begin:m,size:A}});w=fe({inputs:{x:v},backend:n,attrs:{shape:g}}),n.disposeIntermediateTensorInfo(v)}else if(g.some(v=>v===0))w=n.makeTensorInfo(g,r.dtype,[]);else if(n.shouldExecuteOnCPU([x])){let v=n.texData.get(x.dataId).values,I=We(x.shape,x.dtype,v),T=eW(g,I,f,m);w=n.makeTensorInfo(g,x.dtype,T.values)}else{let v=new iX(m,f,g);w=n.runWebGLProgram(v,[x],x.dtype)}let b=fe({inputs:{x:w},backend:n,attrs:{shape:g}});return n.disposeIntermediateTensorInfo(x),n.disposeIntermediateTensorInfo(w),b}var lX={kernelName:Zo,backendName:"webgl",kernelFunc:oX},uX="return tan(x);",dX=qe({opSnippet:uX}),pX={kernelName:Ys,backendName:"webgl",kernelFunc:dX},cX= `
float e2x = exp ( - 2.0 * abs ( x ) ) ;
return sign ( x ) * ( 1.0 - e2x ) / ( 1.0 + e2x ) ;
` ,hX=qe({opSnippet:cX}),fX={kernelName:Js,backendName:"webgl",kernelFunc:hX},AX=class{constructor(e,t){this.variableNames=["A"];let n=new Array(e.length);for(let s=0;s<n.length;s++)n[s]=e[s]*t[s];this.outputShape=n,this.rank=n.length;let a=lt(this.rank),r=mX(e);this.userCode= `
void main ( ) {
$ { a } resRC = getOutputCoords ( ) ;
setOutput ( getA ( $ { r } ) ) ;
2021-04-28 14:55:26 +02:00
}
2021-04-28 14:58:21 +02:00
` }};function mX(e){let t=e.length;if(t>5)throw Error( ` Tile for rank $ { t } is not yet supported ` );if(t===1)return ` imod ( resRC , $ { e [ 0 ] } ) ` ;let n=["resRC.x","resRC.y","resRC.z","resRC.w","resRC.u"],a=[];for(let r=0;r<e.length;r++)a.push( ` imod ( $ { n [ r ] } , $ { e [ r ] } ) ` );return a.join()}function p6(e){let{inputs:t,backend:n,attrs:a}=e,{x:r}=t,{reps:s}=a;if(r.dtype==="string"||r.shape.length>5){let o=n.readSync(r.dataId).map(u=>k.decodeString(u)),l=We(r.shape,r.dtype,o),d=nW(l,s);return n.makeTensorInfo(d.shape,d.dtype,d.values)}let i=new AX(r.shape,s);return n.runWebGLProgram(i,[r],r.dtype)}var yX={kernelName:Sr,backendName:"webgl",kernelFunc:p6};function gX(e){let{inputs:t,backend:n,attrs:a}=e,{x:r}=t,{k:s,sorted:i}=a,o=n.readSync(r.dataId),[l,d]=aW(o,r.shape,r.dtype,s,i);return[n.makeTensorInfo(l.shape,l.dtype,l.values),n.makeTensorInfo(d.shape,d.dtype,d.values)]}var xX={kernelName:Yo,backendName:"webgl",kernelFunc:gX},bX=class{constructor(e,t,n,a,r,s){this.variableNames=["Image","Transforms"],this.outputShape=s;let i=n==="nearest"?1:2,o;switch(a){case"constant":o=1;break;case"reflect":o=2;break;case"wrap":o=3;break;case"nearest":o=4;break;default:o=1;break}this.userCode= `
float mapCoord ( float outCoord , float len ) {
float inCoord = outCoord ;
if ( $ { o } == 2 ) {
if ( inCoord < 0.0 ) {
if ( len <= 1.0 ) {
inCoord = 0.0 ;
} else {
float sz2 = 2.0 * len ;
if ( inCoord < sz2 ) {
inCoord = sz2 * float ( int ( float ( - inCoord / sz2 ) ) ) +
inCoord ;
}
inCoord = inCoord < - len ? inCoord + sz2 : - inCoord - 1.0 ;
}
} else if ( inCoord > len - 1.0 ) {
if ( len <= 1.0 ) {
inCoord = 0.0 ;
} else {
float sz2 = 2.0 * len ;
inCoord -= sz2 * float ( int ( float ( inCoord / sz2 ) ) ) ;
if ( inCoord >= len ) {
inCoord = sz2 - inCoord - 1.0 ;
}
}
}
return clamp ( inCoord , 0.0 , len - 1.0 ) ;
} else if ( $ { o } == 3 ) {
if ( inCoord < 0.0 ) {
if ( len <= 1.0 ) {
inCoord = 0.0 ;
} else {
float sz = len - 1.0 ;
inCoord += len * ( float ( int ( float ( - inCoord / sz ) ) ) + 1.0 ) ;
}
} else if ( inCoord > len - 1.0 ) {
if ( len <= 1.0 ) {
inCoord = 0.0 ;
} else {
float sz = len - 1.0 ;
inCoord -= len * float ( int ( float ( inCoord / sz ) ) ) ;
}
}
return clamp ( inCoord , 0.0 , len - 1.0 ) ;
} else if ( $ { o } == 4 ) {
return clamp ( outCoord , 0.0 , len - 1.0 ) ;
} else {
return outCoord ;
}
}
float readWithFillValue ( int batch , int coordY , int coordX ,
int channel ) {
float outputValue ;
if ( 0 <= coordY && coordY < $ { e } && 0 <= coordX && coordX < $ { t } ) {
outputValue = getImage ( batch , coordY , coordX , channel ) ;
} else {
outputValue = float ( $ { r } ) ;
}
return outputValue ;
}
void main ( ) {
ivec4 coords = getOutputCoords ( ) ;
float outputValue ;
int batch = coords [ 0 ] ;
int x = coords [ 2 ] ;
int y = coords [ 1 ] ;
int channel = coords [ 3 ] ;
float xf = float ( x ) ;
float yf = float ( y ) ;
float a1 = getTransforms ( batch , 0 ) ;
float a2 = getTransforms ( batch , 1 ) ;
float a3 = getTransforms ( batch , 2 ) ;
float b1 = getTransforms ( batch , 3 ) ;
float b2 = getTransforms ( batch , 4 ) ;
float b3 = getTransforms ( batch , 5 ) ;
float c1 = getTransforms ( batch , 6 ) ;
float c2 = getTransforms ( batch , 7 ) ;
float projection = c1 * xf + c2 * yf + 1.0 ;
if ( projection == 0.0 ) {
outputValue = float ( $ { r } ) ;
} else {
float inX = ( a1 * xf + a2 * yf + a3 ) / projection ;
float inY = ( b1 * xf + b2 * yf + b3 ) / projection ;
float mapX = mapCoord ( inX , float ( $ { t } ) ) ;
float mapY = mapCoord ( inY , float ( $ { e } ) ) ;
2021-04-19 22:19:03 +02:00
2021-04-28 14:58:21 +02:00
if ( $ { i } == 1 ) {
int coordY = int ( round ( mapY ) ) ;
int coordX = int ( round ( mapX ) ) ;
outputValue = readWithFillValue ( batch , coordY , coordX ,
channel ) ;
} else {
float yFloor = floor ( mapY ) ;
float xFloor = floor ( mapX ) ;
float yCeil = yFloor + 1.0 ;
float xCeil = xFloor + 1.0 ;
float valueYFloor = ( xCeil - mapX ) *
readWithFillValue ( batch , int ( yFloor ) , int ( xFloor ) , channel ) +
( mapX - xFloor ) *
readWithFillValue ( batch , int ( yFloor ) , int ( xCeil ) , channel ) ;
float valueYCeil = ( xCeil - mapX ) *
readWithFillValue ( batch , int ( yCeil ) , int ( xFloor ) , channel ) +
( mapX - xFloor ) *
readWithFillValue ( batch , int ( yCeil ) , int ( xCeil ) , channel ) ;
outputValue = ( yCeil - mapY ) * valueYFloor +
( mapY - yFloor ) * valueYCeil ;
}
}
setOutput ( outputValue ) ;
}
` }};function vX(e){let{inputs:t,backend:n,attrs:a}=e,{image:r,transforms:s}=t,{interpolation:i,fillMode:o,fillValue:l,outputShape:d}=a,[u,p,c,h]=r.shape,[m,f]=d!=null?d:[p,c],A=[u,m,f,h],y=new bX(p,c,i,o,l,A);return n.runWebGLProgram(y,[r,s],"float32")}var wX={kernelName:tc,backendName:"webgl",kernelFunc:vX};function kX(e){let{inputs:t,attrs:n,backend:a}=e,{axis:r}=n,{x:s}=t;Nl(s,"unique"),console.warn("WARNING: ","UI might be locked temporarily as data is being downloaded");let i=a.readSync(s.dataId),{outputValues:o,outputShape:l,indices:d}=rW(i,r,s.shape,s.dtype);return[a.makeTensorInfo(l,s.dtype,o),a.makeTensorInfo([d.length],"int32",d)]}var IX={kernelName:nc,backendName:"webgl",kernelFunc:kX};function SX(e){let{inputs:t,backend:n,attrs:a}=e,{value:r}=t,{axis:s}=a;s<0&&(s+=r.shape.length);let i=r,o=i.shape.length,l=r.shape[s],d=new Array(o-1),u=0;for(let f=0;f<o;f++)f!==s&&(d[u++]=i.shape[f]);let p=[],c=new Array(o).fill(0),h=i.shape.slice();h[s]=1;let m=new Array(l);for(let f=0;f<m.length;f++){c[s]=f;let A=Ad({inputs:{x:i},backend:n,attrs:{begin:c,size:h}}),y=fe({inputs:{x:A},backend:n,attrs:{shape:d}});m[f]=y,p.push(A)}return p.forEach(f=>n.disposeIntermediateTensorInfo(f)),m}var NX={kernelName:Jo,backendName:"webgl",kernelFunc:SX},TX=class{constructor(e,t){this.variableNames=["x","segmentIds"];let n=e.windowSize,a=e.batchSize,r=e.inSize,s=e.numSegments,i=s*Math.ceil(r/n);this.outputShape=[a,i];let o="0.0",l="sumValue",d=Math.floor(n/4)*4,u=n%4,p= `
sumValue += dot ( values , segFilter ) ;
` ,c="";r%n>0&&(c= `
if ( inIdx < 0 || inIdx >= $ { r } ) {
return initializationValue ;
2021-04-28 14:55:26 +02:00
}
2021-04-28 14:58:21 +02:00
` );let h="";r%n>0&&(h= `
if ( inIdx < 0 || inIdx >= $ { r } ) {
return - 1.0 ;
}
` ),this.userCode= `
const float initializationValue = $ { o } ;
float getValue ( int batch , int inIdx ) {
$ { c }
return getX ( batch , inIdx ) ;
2021-04-19 22:02:47 +02:00
}
2021-03-24 16:43:28 +01:00
2021-04-28 14:58:21 +02:00
float getSegmentIdAtIndex ( int inIdx ) {
$ { h }
return getSegmentIds ( inIdx ) ;
}
2021-03-27 20:43:48 +01:00
2021-04-28 14:58:21 +02:00
void main ( ) {
ivec2 coords = getOutputCoords ( ) ;
int batch = coords [ 0 ] ;
int outIdx = coords [ 1 ] ;
int inOffset = int ( floor ( float ( outIdx ) / float (
$ { s } ) ) * float ( $ { n } ) ) ;
int currentSeg = int ( mod ( float ( outIdx ) , float ( $ { s } ) ) ) ;
2021-04-19 22:19:03 +02:00
2021-04-28 14:58:21 +02:00
float sumValue = 0.0 ;
2021-04-19 22:19:03 +02:00
2021-04-28 14:58:21 +02:00
for ( int i = 0 ; i < $ { d } ; i += 4 ) {
int inIdx = inOffset + i ;
vec4 values = vec4 (
getValue ( batch , inIdx ) ,
getValue ( batch , inIdx + 1 ) ,
getValue ( batch , inIdx + 2 ) ,
getValue ( batch , inIdx + 3 )
) ;
2021-04-19 22:19:03 +02:00
2021-04-28 14:58:21 +02:00
vec4 segFilter = vec4 (
int ( getSegmentIdAtIndex ( inIdx ) ) == currentSeg ? 1 : 0 ,
int ( getSegmentIdAtIndex ( inIdx + 1 ) ) == currentSeg ? 1 : 0 ,
int ( getSegmentIdAtIndex ( inIdx + 2 ) ) == currentSeg ? 1 : 0 ,
int ( getSegmentIdAtIndex ( inIdx + 3 ) ) == currentSeg ? 1 : 0
) ;
2021-03-29 21:01:16 +02:00
2021-04-28 14:58:21 +02:00
$ { p }
2021-04-28 14:55:26 +02:00
}
2021-04-15 21:01:27 +02:00
2021-04-28 14:58:21 +02:00
int inIdx = inOffset + $ { d } ;
if ( $ { u === 1 } ) {
vec4 values = vec4 (
getValue ( batch , inIdx ) ,
initializationValue ,
initializationValue ,
initializationValue
) ;
2021-04-15 21:01:27 +02:00
2021-04-28 14:58:21 +02:00
int inIdxSeg = int ( getSegmentIdAtIndex ( inIdx ) ) ;
2021-03-24 16:43:28 +01:00
2021-04-28 14:58:21 +02:00
vec4 segFilter = vec4 (
int ( getSegmentIdAtIndex ( inIdx ) ) == currentSeg ? 1 : 0 ,
0 ,
0 ,
0
) ;
2021-04-19 22:02:47 +02:00
2021-04-28 14:58:21 +02:00
$ { p }
} else if ( $ { u === 2 } ) {
vec4 values = vec4 (
getValue ( batch , inIdx ) ,
getValue ( batch , inIdx + 1 ) ,
initializationValue ,
initializationValue
) ;
vec4 segFilter = vec4 (
int ( getSegmentIdAtIndex ( inIdx ) ) == currentSeg ? 1 : 0 ,
int ( getSegmentIdAtIndex ( inIdx + 1 ) ) == currentSeg ? 1 : 0 ,
0 ,
0
) ;
2021-04-19 22:02:47 +02:00
2021-04-28 14:58:21 +02:00
$ { p }
} else if ( $ { u === 3 } ) {
vec4 values = vec4 (
getValue ( batch , inIdx ) ,
getValue ( batch , inIdx + 1 ) ,
getValue ( batch , inIdx + 2 ) ,
initializationValue
) ;
2021-04-17 00:03:15 +02:00
2021-04-28 14:58:21 +02:00
vec4 segFilter = vec4 (
int ( getSegmentIdAtIndex ( inIdx ) ) == currentSeg ? 1 : 0 ,
int ( getSegmentIdAtIndex ( inIdx + 1 ) ) == currentSeg ? 1 : 0 ,
int ( getSegmentIdAtIndex ( inIdx + 2 ) ) == currentSeg ? 1 : 0 ,
0
) ;
2021-04-19 22:19:03 +02:00
2021-04-28 14:58:21 +02:00
$ { p }
2021-04-28 14:55:26 +02:00
}
2021-04-28 14:58:21 +02:00
setOutput ( $ { l } ) ;
2021-04-28 14:55:26 +02:00
}
2021-04-28 14:58:21 +02:00
` }};function EX(e){let{inputs:t,backend:n,attrs:a}=e,{x:r,segmentIds:s}=t,{numSegments:i}=a,o=r.shape.length,l=[],d=0,u=C.getAxesPermutation([d],o),p=r;u!=null&&(p=cn({inputs:{x:r},backend:n,attrs:{perm:u}}),l.push(p),d=C.getInnerMostAxes(1,o)[0]);let c=C.segment_util.computeOutShape(p.shape,d,i),h=k.sizeFromShape([p.shape[d]]),m=fe({inputs:{x:p},backend:n,attrs:{shape:[-1,h]}});l.push(m);let f=lc(r.dtype),A=(w,b,v,I,T)=>{let R=w.shape[0], $ =w.shape[1],O=C.segment_util.segOpComputeOptimalWindowSize( $ ,T),_={windowSize:O,inSize: $ ,batchSize:R,numSegments:T},V=new TX(_,b),j=n.compileAndRun(V,[w,v],I);if(l.push(j),j.shape[1]===T)return j;let U=l6({backend:n,attrs:{start:0,stop:T,step:1,dtype:"float32"}}),X=p6({inputs:{x:U},backend:n,attrs:{reps:[ $ /O]}});return l.push(U),l.push(X),A(j,b,X,I,T)},y=A(m,"unsortedSegmentSum",s,f,i),g=fe({inputs:{x:y},backend:n,attrs:{shape:c}}),x=g;if(u!=null){l.push(g);let w=C.getUndoAxesPermutation(u);x=cn({inputs:{x},backend:n,attrs:{perm:w}})}return l.forEach(w=>n.disposeIntermediateTensorInfo(w)),x}var CX={kernelName:Eu,backendName:"webgl",kernelFunc:EX},RX=[yH,bH,nB,rB,oB,dB,cB,mB,yB,xB,kB,SB,EB,MB,PB,DB,BB,HB,jB,KB,YB,QB,aV,dV,cV,gV,bV,IV,TV,_W,FV,VV,UV,zV,XV,ZV,GV,QV,nj,sj,oj,uj,cj,gj,bj,fj,kj,Nj,Ej,Fj,zj,Wj,jj,Uj,Hj,qj,Kj,Yj,Qj,tU,sU,uU,pU,hU,AU,bU,IU,EU,zW,RU,RV, $ U,zU,LU,LW,jU,qU,KU,nH,QU,iH,uH,hH,wH,RH,EH,DH,zH,PH,NH,WH,VH,GH,ZH,eG,lG,UW,dG,hG,AG,xG,fV,wG,IG,NG,CG, $ G,BW,OG,zG,mV,rG,LG,qG,jG,GW,YG,eq,aq,iq,dq,cq,mq,gq,bq,kq,Nq,Cq,Fq,Oq,Pq,lV,iG,Bq,jq,Hq,qq,Kq,Jq,tX,aX,sX,lX,sG,QW,pX,fX,yX,xX,wX,eB,IX,NX,CX,kG];for(let e of RX)ai(e);var Sn;(function(e){e[e.float32=0]="float32",e[e.int32=1]="int32",e[e.bool=2]="bool",e[e.string=3]="string",e[e.complex64=4]="complex64"})(Sn||(Sn={}));var gd;(function(e){e[e.linear=0]="linear",e[e.relu=1]="relu",e[e.relu6=2]="relu6",e[e.prelu=3]="prelu",e[e.leakyrelu=4]="leakyrelu",e[e.sigmoid=5]="sigmoid"})(gd||(gd={}));var c6;function MX(e){c6=e.wasm.cwrap(ei,null,["number","array","number","number","array","number","number","number","number","number","number","number","number"])}function FX(e){let{inputs:t,backend:n,attrs:a}=e,{a:r,b:s,bias:i,preluActivationWeights:o}=t;if(r.dtype!=="float32"||s.dtype!=="float32")throw new Error("_FusedMatMul for non non-float32 tensors not yet supported.");let{transposeA:l,transposeB:d,activation:u,leakyreluAlpha:p}=a,c=n.dataIdMap.get(r.dataId).id,h=n.dataIdMap.get(s.dataId).id,m=0;if(i!=null){let T=n.dataIdMap.get(i.dataId);if(T.shape.length!==1)throw new Error( ` _FusedMatMul only supports rank - 1 bias but got rank $ { T . shape . length } . ` );m=T.id}let f=o==null?0:n.dataIdMap.get(o.dataId).id,A=gd[u];if(A==null)throw new Error( ` $ { u } activation not yet supported for FusedConv2D in the wasm backend . ` );let y=l?r.shape[2]:r.shape[1],g=d?s.shape[1]:s.shape[2],x=r.shape[0],w=n.makeOutput([x,y,g],r.dtype),b=n.dataIdMap.get(w.dataId).id,v=new Uint8Array(new Int32Array(r.shape).buffer),I=new Uint8Array(new Int32Array(s.shape).buffer);return c6(c,v,r.shape.length,h,I,s.shape.length,l,d,A,m,f,p||0,b),w}var $ X={kernelName:ei,backendName:"wasm",setupFunc:MX,kernelFunc:FX};function hn(e){let t;function n(r){t=r.wasm.cwrap(e,null,["number","number"])}function a(r){let{backend:s,inputs:{x:i}}=r,o=s.dataIdMap.get(i.dataId).id,l=s.makeOutput(i.shape,i.dtype),d=s.dataIdMap.get(l.dataId).id;return k.sizeFromShape(l.shape)===0||t(o,d),l}return{kernelName:e,backendName:"wasm",setupFunc:n,kernelFunc:a}}var DX=hn(eo);function fn(e,t,n){let a;function r(i){a=i.wasm.cwrap(e,null,["number","array","number","number","array","number","number","number"])}function s(i){let{backend:o,inputs:l}=i,{a:d,b:u}=l,p=o.dataIdMap.get(d.dataId).id,c=o.dataIdMap.get(u.dataId).id,h=n!=null?n:d.dtype,m=C.assertAndGetBroadcastShape(d.shape,u.shape),f=o.makeOutput(m,h);if(k.sizeFromShape(m)===0)return f;let A=new Uint8Array(new Int32Array(d.shape).buffer),y=new Uint8Array(new Int32Array(u.shape).buffer),g=o.dataIdMap.get(f.dataId).id,x=()=>a(p,A,d.shape.length,c,y,u.shape.length,Sn[d.dtype],g);if(t&&d.dtype==="float32")return x(),f;let w=C.getBroadcastDims(d.shape,m),b
1. The $ { a } is defined in Python , in which case it needs to be ported to TensorFlow . js or your JavaScript code .
2. The custom $ { a } is defined in JavaScript , but is not registered properly with tf . serialization . registerClass ( ) . ` );return i}else{let s=e;if(s.className==null||s.config==null)throw new W( ` $ { a } : Improper config format : $ { JSON . stringify ( s ) } .
'className' and 'config' must set . ` );let i=s.className,o,l;if(i in n?[o,l]=n[i]:i in ua?[o,l]=ua.className:i in t&&([o,l]=t[i]),o==null)throw new W( ` Unknown $ { a } : $ { i } . This may be due to one of the following reasons :
1. The $ { a } is defined in Python , in which case it needs to be ported to TensorFlow . js or your JavaScript code .
2. The custom $ { a } is defined in JavaScript , but is not registered properly with tf . serialization . registerClass ( ) . ` );if(l!=null){let d={};for(let h of Object.keys(ua))d[h]=ua[h];for(let h of Object.keys(n))d[h]=n[h];let u=s.config;u.customObjects=d;let p=Object.assign({},ua);for(let h of Object.keys(n))ua[h]=n[h];E1(s.config);let c=l(o,s.config,n,r);return ua=Object.assign({},p),c}else{let d=Object.assign({},ua);for(let p of Object.keys(n))ua[p]=n[p];let u=new o(s.config);return ua=Object.assign({},d),u}}}function Wee(e,t){return e<t?-1:e>t?1:0}function Ch(e,t){return-1*Wee(e,t)}function Br(e){if(e==null)return e;let t=[];for(let n of e)t.indexOf(n)===-1&&t.push(n);return t}function Bee(e){if(e==null)throw new W( ` Invalid value in obj : $ { JSON . stringify ( e ) } ` );for(let t in e)if(e.hasOwnProperty(t))return!1;return!0}function Ci(e,t,n){if(n!=null&&e.indexOf(n)<0)throw new W( ` $ { n } is not a valid $ { t } . Valid values are $ { e } or null / undefined . ` )}function C1(e,t,n=0,a=Infinity){return ja(n>=0),ja(a>=n),Array.isArray(e)&&e.length>=n&&e.length<=a&&e.every(r=>typeof r===t)}function Ht(e,t){Array.isArray(e)?(k.assert(e.length>0,()=> ` $ { t } is unexpectedly an empty array . ` ),e.forEach((n,a)=>Ht(n, ` element $ { a + 1 } of $ { t } ` ))):k.assert(Number.isInteger(e)&&e>0,()=> ` Expected $ { t } to be a positive integer , but got $ { bw ( e ) } . ` )}function bw(e){return e===null?"null":Array.isArray(e)?"["+e.map(t=>bw(t)).join(",")+"]":typeof e=="string"? ` "${e}" ` : ` $ { e } ` }function Vee(e,t){let n=k.now(),a;return(...r)=>{let s=k.now();return s-n<t||(n=s,a=e(...r)),a}}function vw(e){return e==="relu"?"relu":e==="linear"?"linear":e==="elu"?"elu":null}function R1(e,t){return L(()=>Jt(Te(B(e,e),t,!0)))}var kd=class extends ae.Serializable{getConfig(){return{}}},M1=class extends kd{constructor(e){super();this.defaultMaxValue=2,this.defaultAxis=0,this.maxValue=e.maxValue!=null?e.maxValue:this.defaultMaxValue,this.axis=e.axis!=null?e.axis:this.defaultAxis}apply(e){return L(()=>{let t=R1(e,this.axis),n=kn(t,0,this.maxValue);return B(e,ge(n,se(_t(),t)))})}getConfig(){return{maxValue:this.maxValue,axis:this.axis}}};M1.className="MaxNorm";ae.registerClass(M1);var F1=class extends kd{constructor(e){super();this.defaultAxis=0,this.axis=e.axis!=null?e.axis:this.defaultAxis}apply(e){return L(()=>ge(e,se(_t(),R1(e,this.axis))))}getConfig(){return{axis:this.axis}}};F1.className="UnitNorm";ae.registerClass(F1);var $ 1=class extends kd{apply(e){return La(e)}}; $ 1.className="NonNeg";ae.registerClass( $ 1);var D1=class extends kd{constructor(e){super();this.defaultMinValue=0,this.defaultMaxValue=1,this.defaultRate=1,this.defaultAxis=0,this.minValue=e.minValue!=null?e.minValue:this.defaultMinValue,this.maxValue=e.maxValue!=null?e.maxValue:this.defaultMaxValue,this.rate=e.rate!=null?e.rate:this.defaultRate,this.axis=e.axis!=null?e.axis:this.defaultAxis}apply(e){return L(()=>{let t=R1(e,this.axis),n=se(B(this.rate,kn(t,this.minValue,this.maxValue)),B(1-this.rate,t));return B(e,ge(n,se(_t(),t)))})}getConfig(){return{minValue:this.minValue,maxValue:this.maxValue,rate:this.rate,axis:this.axis}}};D1.className="MinMaxNorm";ae.registerClass(D1);var ww={maxNorm:"MaxNorm",minMaxNorm:"MinMaxNorm",nonNeg:"NonNeg",unitNorm:"UnitNorm"};function Pt(e){return T1(e)}function kw(e,t={}){return wd(e,ae.SerializationMap.getMap().classNameMap,t,"constraint")}function Lt(e){if(e==null)return null;if(typeof e=="string"){let t={className:e in ww?ww[e]:e,config:{}};return kw(t)}else return e instanceof kd?e:kw(e)}function zee(e){return new M1(e)}function _ee(e){return new F1(e)}function Pee(){return new $ 1}function Lee(e){return new D1(e)}var Iw={};Fe(Iw,{constant:()=>Hee,glorotNormal:()=>Jee,glorotUniform:()=>Yee,heNormal:()=>Qee,heUniform:()=>ete,identity:()=>Kee,leCunNormal:()=>tte,leCunUniform:()=>nte,ones:()=>Uee,orthogonal:()=>ate,randomNormal:()=>qee,randomUniform:()=>Gee,truncatedNormal:()=>Xee,varianceScaling:()=>Zee,zeros:()=>jee});var rte=["channelsFirst","channelsLast"],ste=["nearest","bilinear"],ite=["valid","same","causal"],ote=["max","avg"],lte=["sum","mul","concat","ave"],_l=new Map;function Et(e){Ci
because the value dtype is $ { t . dtype } , but TensorArray dtype is $ { this . dtype } . ` );if(this.size()===0&&(this.elementShape==null||this.elementShape.length===0)&&(this.elementShape=t.shape),ca(this.elementShape,t.shape, ` TensorArray $ { this . name } : Could not write to TensorArray index $ { e } . ` ),n.read)throw new Error( ` TensorArray $ { this . name } : Could not write to TensorArray index $ { e } , because it has already been read . ` );if(n.written)throw new Error( ` TensorArray $ { this . name } : Could not write to TensorArray index $ { e } , because it has already been written . ` );n.tensor=t,jt(t),n.written=!0,this.tensors[e]=n}writeMany(e,t){if(e.length!==t.length)throw new Error( ` TensorArray $ { this . name } : could not write multiple tensors , because the index size : $ { e . length } is not the same as tensors size : $ { t . length } . ` );e.forEach((n,a)=>this.write(n,t[a]))}gather(e,t){if(!!t&&t!==this.dtype)throw new Error( ` TensorArray dtype is $ { this . dtype } but gather requested dtype $ { t } ` );if(e)e=e.slice(0,this.size());else{e=[];for(let a=0;a<this.size();a++)e.push(a)}if(e.length===0)return ga([],[0].concat(this.elementShape));let n=this.readMany(e);return ca(this.elementShape,n[0].shape,"TensorArray shape mismatch: "),zn(n,0)}concat(e){if(!!e&&e!==this.dtype)throw new Error( ` TensorArray dtype is $ { this . dtype } but concat requested dtype $ { e } ` );if(this.size()===0)return ga([],[0].concat(this.elementShape));let t=[];for(let a=0;a<this.size();a++)t.push(a);let n=this.readMany(t);return ca(this.elementShape,n[0].shape, ` TensorArray shape mismatch : tensor array shape ( $ { this . elementShape } ) vs first tensor shape ( $ { n [ 0 ] . shape } ) ` ),ot(n,0)}scatter(e,t){if(t.dtype!==this.dtype)throw new Error( ` TensorArray dtype is $ { this . dtype } but tensor has dtype $ { t . dtype } ` );if(e.length!==t.shape[0])throw new Error( ` Expected len ( indices ) == tensor . shape [ 0 ] , but saw : $ { e . length } vs . $ { t . shape [ 0 ] } ` );let n=Math.max(...e);if(!this.dynamicSize&&n>=this.maxSize)throw new Error( ` Max index must be < array size ( $ { n } vs . $ { this . maxSize } ) ` );this.writeMany(e,la(t,0))}split(e,t){if(t.dtype!==this.dtype)throw new Error( ` TensorArray dtype is $ { this . dtype } but tensor has dtype $ { t . dtype } ` );let n=0,a=e.map(o=>(n+=o,n));if(n!==t.shape[0])throw new Error( ` Expected sum of lengths to be equal to
tensor . shape [ 0 ] , but sum of lengths is
$ { n } , and tensor 's shape is: ${t.shape}`);if(!this.dynamicSize&&e.length!==this.maxSize)throw new Error(`TensorArray' s size is not equal to the size of lengths ( $ { this . maxSize } vs . $ { e . length } ) , and the TensorArray is not marked as dynamically resizeable ` );let r=n===0?0:t.size/n,s=[];L(()=>{t=H(t,[1,n,r]);for(let o=0;o<e.length;++o){let l=o===0?0:a[o-1],d=[0,l,0],u=[1,e[o],r];s[o]=H(Me(t,d,u),this.elementShape)}return s});let i=[];for(let o=0;o<e.length;o++)i[o]=o;this.writeMany(i,s)}},Vd=class{constructor(e,t,n,a=-1){this.tensors=e,this.elementShape=t,this.elementDtype=n,e!=null&&e.forEach(r=>{if(n!==r.dtype)throw new Error( ` Invalid data types ; op elements $ { n } , but list elements $ { r . dtype } ` );ca(t,r.shape,"TensorList shape mismatch: "),jt(r)}),this.idTensor=Ie(0),this.maxNumElements=a,jt(this.idTensor)}get id(){return this.idTensor.id}copy(){return new Vd([...this.tensors],this.elementShape,this.elementDtype)}clearAndClose(e){this.tensors.forEach(t=>{(e==null||!e.has(t.id))&&t.dispose()}),this.tensors.length=0,this.idTensor.dispose()}size(){return this.tensors.length}stack(e,t,n=-1){if(t!==this.elementDtype)throw new Error( ` Invalid data types ; op elements $ { t } , but list elements $ { this . elementDtype } ` );if(n!==-1&&this.tensors.length!==n)throw new Error( ` Operation expected a list with $ { n } elements but got a list with $ { this . tensors . length } elements . ` );ca(e,this.elementShape,"TensorList shape mismatch: ");let a=Bd(this.elementShape,this.tensors,e);return L(()=>{let r=this.tensors.map(s=>H(s,a));return zn(r,0)})}popBack(e,t){if(t!==this.elementDtype)throw new Error( ` Invalid data types ; op elements $ { t } , but list elements $ { this . elementDtype } ` );if(this.size()===0)throw new Error("Trying to pop from an empty list.");let n=Bd(this.elementShape,this.tensors,e),a=this.tensors.pop();return ca(a.shape,e,"TensorList shape mismatch: "),H(a,n)}pushBack(e){if(e.dtype!==this.elementDtype)throw new Error( ` Invalid data types ; op elements $ { e . dtype } , but list elements $ { this . elementDtype } ` );if(ca(e.shape,this.elementShape,"TensorList shape mismatch: "),this.maxNumElements===this.size())throw new Error("Trying to push element into a full list.");jt(e),this.tensors.push(e)}resize(e){if(e<0)throw new Error( ` TensorListResize expects size to be non - negative . Got : $ { e } ` );if(this.maxNumElements!==-1&&e>this.maxNumElements)throw new Error( ` TensorListResize input size $ { e } is greater maxNumElement $ { this . maxNumElements } . ` );this.tensors.length=e}getItem(e,t,n){if(n!==this.elementDtype)throw new Error( ` Invalid data types ; op elements $ { n } , but list elements $ { this . elementDtype } ` );if(e<0||e>this.tensors.length)throw new Error( ` Trying to access element $ { e } in a list with $ { this . tensors . length } elements . ` );if(this.tensors[e]==null)throw new Error( ` element at index $ { e } is null . ` );ca(this.tensors[e].shape,t,"TensorList shape mismatch: ");let a=Bd(this.elementShape,this.tensors,t);return H(this.tensors[e],a)}setItem(e,t){if(t.dtype!==this.elementDtype)throw new Error( ` Invalid data types ; op elements $ { t . dtype } , but list elements $ { this . elementDtype } ` );if(e<0||this.maxNumElements!==-1&&e>=this.maxNumElements)throw new Error( ` Trying to set element $ { e } in a list with max $ { this . maxNumElements } elements . ` );ca(this.elementShape,t.shape,"TensorList shape mismatch: "),jt(t),this.tensors[e]=t}gather(e,t,n){if(t!==this.elementDtype)throw new Error( ` Invalid data types ; op elements $ { t } , but list elements $ { this . elementDtype } ` );ca(this.elementShape,n,"TensorList shape mismatch: "),e=e.slice(0,this.size());let a=Bd(this.elementShape,this.tensors,n);return e.length===0?ga([],[0].concat(a)):L(()=>{let r=e.map(s=>H(this.tensors[s],a));return zn(r,0)})}concat(e,t){if(!!e&&e!==this.elementDtype)throw new Error( ` TensorList dtype is $ { this . elementDtype } but concat requested dtype $ { e } ` );ca(this.elementShape,t,"TensorList shape mismatch: ");let n=Bd(this.elementShape,this.tensors,t);return this.size()===0?ga([],[0].concat(n)):L(()=>{let a=this.tensors.map(r=>H(r,n));return ot(a,0)})}};function Ure(e,t,n){let a=e.dtype;if(e.shape.length<1)throw new Error( ` Tensor
tensor . shape [ 0 ] , but sum of lengths is
$ { a } , and tensor ' s shape is : $ { e . shape } ` );let s=e.shape.slice(1),i=I2(s,n),o=a===0?0:e.size/a,l=L(()=>{let u=[];e=H(e,[1,a,o]);for(let p=0;p<t.length;++p){let c=p===0?0:r[p-1],h=[0,c,0],m=[1,t[p],o];u[p]=H(Me(e,h,m),i)}return e.dispose(),u}),d=new Vd([],n,e.dtype,t.length);for(let u=0;u<l.length;u++)d.setItem(u,l[u]);return d}var Xre=async(e,t,n)=>{switch(e.op){case"If":case"StatelessIf":{let a=S("thenBranch",e,t,n),r=S("elseBranch",e,t,n),s=S("cond",e,t,n),i=S("args",e,t,n);return(await s.data())[0]?n.functionMap[a].executeFunctionAsync(i,n.tensorArrayMap,n.tensorListMap):n.functionMap[r].executeFunctionAsync(i,n.tensorArrayMap,n.tensorListMap)}case"While":case"StatelessWhile":{let a=S("body",e,t,n),r=S("cond",e,t,n),s=S("args",e,t,n),i=await n.functionMap[r].executeFunctionAsync(s,n.tensorArrayMap,n.tensorListMap),o=s.map(u=>u.id),l=await i[0].data();i.forEach(u=>{!u.kept&&o.indexOf(u.id)===-1&&u.dispose()});let d=s;for(;l[0];){let u=d;d=await n.functionMap[a].executeFunctionAsync(d,n.tensorArrayMap,n.tensorListMap);let p=d.map(h=>h.id);u.forEach(h=>{!h.kept&&o.indexOf(h.id)===-1&&p.indexOf(h.id)===-1&&h.dispose()});let c=await n.functionMap[r].executeFunctionAsync(d,n.tensorArrayMap,n.tensorListMap);l=await c[0].data(),c.forEach(h=>{!h.kept&&o.indexOf(h.id)===-1&&p.indexOf(h.id)===-1&&h.dispose()})}return d}case"LoopCond":{let a=S("pred",e,t,n);return[hr(a)]}case"Switch":{let a=S("pred",e,t,n),r=S("data",e,t,n);return r.kept||(r=hr(r)),(await a.data())[0]?[void 0,r]:[r,void 0]}case"Merge":{let a=e.inputNames.find(r=>mn(r,t,n)!==void 0);if(a){let r=mn(a,t,n);return[hr(r)]}return}case"Enter":{let a=S("frameName",e,t,n),r=S("tensor",e,t,n);return n.enterFrame(a),[hr(r)]}case"Exit":{let a=S("tensor",e,t,n);return n.exitFrame(),[hr(a)]}case"NextIteration":{let a=S("tensor",e,t,n);return n.nextIteration(),[hr(a)]}case"TensorArrayV3":{let a=S("size",e,t,n),r=S("dtype",e,t,n),s=S("elementShape",e,t,n),i=S("dynamicSize",e,t,n),o=S("clearAfterRead",e,t,n),l=S("identicalElementShapes",e,t,n),d=S("name",e,t,n),u=new jre(d,r,a,s,l,i,o);return n.addTensorArray(u),[u.idTensor,Ie(1)]}case"TensorArrayWriteV3":{let a=S("tensorArrayId",e,t,n),r=S("index",e,t,n),s=S("tensor",e,t,n),i=n.getTensorArray(a.id);return i.write(r,s),[i.idTensor]}case"TensorArrayReadV3":{let a=S("tensorArrayId",e,t,n),r=S("index",e,t,n);return[n.getTensorArray(a.id).read(r)]}case"TensorArrayGatherV3":{let a=S("tensorArrayId",e,t,n),r=S("indices",e,t,n),s=S("dtype",e,t,n);return[n.getTensorArray(a.id).gather(r,s)]}case"TensorArrayScatterV3":{let a=S("tensorArrayId",e,t,n),r=S("indices",e,t,n),s=S("tensor",e,t,n),i=n.getTensorArray(a.id);return i.scatter(r,s),[i.idTensor]}case"TensorArrayConcatV3":{let a=S("tensorArrayId",e,t,n),r=n.getTensorArray(a.id),s=S("dtype",e,t,n);return[r.concat(s)]}case"TensorArraySplitV3":{let a=S("tensorArrayId",e,t,n),r=S("tensor",e,t,n),s=S("lengths",e,t,n),i=n.getTensorArray(a.id);return i.split(s,r),[i.idTensor]}case"TensorArraySizeV3":{let a=S("tensorArrayId",e,t,n),r=n.getTensorArray(a.id);return[Ie(r.size(),"int32")]}case"TensorArrayCloseV3":{let a=S("tensorArrayId",e,t,n),r=n.getTensorArray(a.id);return r.clearAndClose(),[r.idTensor]}case"TensorListSetItem":{let a=S("tensorListId",e,t,n),r=S("index",e,t,n),s=S("tensor",e,t,n),i=n.getTensorList(a.id);return i.setItem(r,s),[i.idTensor]}case"TensorListGetItem":{let a=S("tensorListId",e,t,n),r=S("index",e,t,n),s=S("elementShape",e,t,n),i=S("elementDType",e,t,n);return[n.getTensorList(a.id).getItem(r,s,i)]}case"TensorListScatterV2":case"TensorListScatter":{let a=S("indices",e,t,n),r=S("tensor",e,t,n),s=S("elementShape",e,t,n),i=S("numElements",e,t,n),o=Gre(r,a,s,i);return n.addTensorList(o),[o.idTensor]}case"TensorListReserve":case"EmptyTensorList":{let a=S("elementShape",e,t,n),r=S("elementDType",e,t,n),s;e.op==="TensorListReserve"?s="numElements":s="maxNumElements";let i=S(s,e,t,n),o=Hre(a,r,i);return n.addTensorList(o),[o.idTensor]}case"TensorListGather":{let a=S("tensorListId",e,t,n),r=S("indices",e,t,n),s=S("elementShape",e,t,n),i=S("elementDType",e,t,n);return[n.getTe
$ { e } ` );let a;return this.size===Infinity||this.size==null?a=this.size:t?a=Math.ceil(this.size/e):a=Math.floor(this.size/e),Wn(async()=>(await n.iterator()).columnMajorBatch(e,t,Yse),a)}concatenate(e){let t=this,n;return this.size===Infinity||e.size===Infinity?n=Infinity:this.size!=null&&e.size!=null?n=this.size+e.size:n=null,Wn(async()=>(await t.iterator()).concatenate(await e.iterator()),n)}filter(e){let t=this,n;return this.size===Infinity?n=Infinity:n=null,Wn(async()=>(await t.iterator()).filter(a=>L(()=>e(a))),n)}async forEachAsync(e){return(await this.iterator()).forEachAsync(e)}map(e){let t=this;return Wn(async()=>(await t.iterator()).map(n=>L(()=>e(n))),this.size)}mapAsync(e){let t=this;return Wn(async()=>(await t.iterator()).mapAsync(e),this.size)}prefetch(e){if(e==null)throw new RangeError(" ` Dataset . prefetch ( ) ` requires bufferSize to be specified.");let t=this;return Wn(async()=>(await t.iterator()).prefetch(e),this.size)}repeat(e){let t=this,n;return this.size!=null&&e>0?n=this.size*e:e===0?n=0:this.size!=null&&(e===void 0||e<0)?n=Infinity:n=null,Wn(async()=>{let a=E2(async()=>({value:await t.iterator(),done:!1}));return Lse(a.take(e))},n)}skip(e){let t=this,n;return this.size!=null&&e>=0&&this.size>=e?n=this.size-e:this.size!=null&&(this.size<e||e===void 0||e<0)?n=0:n=null,Wn(async()=>(await t.iterator()).skip(e),n)}shuffle(e,t,n=!0){if(e==null||e<0)throw this.size==null?new RangeError(" ` Dataset . shuffle ( ) ` requires bufferSize to be specified."):new RangeError( ` \ ` Dataset.shuffle() \` requires bufferSize to be specified. If your data fits in main memory (for regular JS objects), and/or GPU memory (for \` tf.Tensor \` s), consider setting bufferSize to the dataset size ( ${ this . size } elements) ` ) ; let a = this , r = Cse . alea ( t || k . now ( ) . toString ( ) ) ; return Wn ( async ( ) => { let s = r . int32 ( ) ; return n && ( s += r . int32 ( ) ) , ( await a . iterator ( ) ) . shuffle ( e , s . toString ( ) ) } , this . size ) } take ( e ) { let t = this , n ; return this . size != null && this . size > e ? n = e : this . size != null && this . size <= e ? n = this . size : n = null , Wn ( async ( ) => ( await t . iterator ( ) ) . take ( e ) , n ) } async toArray ( ) { if ( this . size === Infinity ) throw new Error ( "Can not convert infinite data stream to array." ) ; return ( await this . iterator ( ) ) . toArray ( ) } async toArrayForTest ( ) { if ( this . size === Infinity ) throw new Error ( "Can not convert infinite data stream to array." ) ; return ( await this . iterator ( ) ) . toArrayForTest ( ) } } ; Ul . MAX _BUFFER _SIZE = 1e4 ; function Wn ( e , t = null ) { return new class extends Ul { constructor ( ) { super ( ... arguments ) ; this . size = t } async iterator ( ) { return e ( ) } } } function vse ( e ) { return Wn ( async ( ) => W8 ( e ) , e . length ) } function wse ( e ) { if ( ! Hl ( e ) ) throw new Error ( "The argument to zip() must be an object or array." ) ; let t ; if ( Array . isArray ( e ) ) for ( let n = 0 ; n < e . length ; n ++ ) t = t == null ? e [ n ] . size : Math . min ( t , e [ n ] . size ) ; else if ( e instanceof Object ) for ( let n in e ) t = t == null ? e [ n ] . size : Math . min ( t , e [ n ] . size ) ; return Wn ( async ( ) => { let n = await P8 ( e , a => { if ( a instanceof Ul ) return { value : a . iterator ( ) , recurse : ! 1 } ; if ( Hl ( a ) ) return { value : null , recurse : ! 0 } ; throw new Error ( "Leaves of the structure passed to zip() must be Datasets, not primitives." ) } ) ; return Bse ( n , Xr . SHORTEST ) } , t ) } function Yse ( e ) { if ( e === null ) return null ; let t = e [ 0 ] ; return Dse ( t ) ? { value : Jse ( e ) , recurse : ! 1 } : { value : null , recurse : ! 0 } } function Jse ( e ) { if ( e . length === 0 ) throw new Error ( "Can't make a batch of zero elements." ) ; return e [ 0 ] instanceof Le ? zn ( e ) : ga ( e ) } var F8 = class extends Ul { constructor ( e ) { super ( ) ; this . input = e } async iterator ( ) { return ( await this . input . iterator ( ) ) . decodeUTF8 ( ) . split ( `
` ).map(e=>(e.endsWith(" \r ")&&(e=e.slice(0,-1)),e))}},u0='"',jd=Symbol("out"),U8=Symbol("field"),d0=Symbol("quote"),R2=Symbol("quoteafterquote"),H8=Symbol("quoteinquote"), $ 8=class extends Ul{constructor(e,t){super();this.input=e,this.hasHeader=!0,this.fullColumnNames=null,this.columnNamesValidated=!1,this.columnConfigs=null,this.configuredColumnsOnly=!1,this.delimiter=",",this.delimWhitespace=!1,this.base=new F8(e),t||(t={}),this.hasHeader=t.hasHeader!==!1,this.fullColumnNames=t.columnNames,this.columnConfigs=t.columnConfigs,this.configuredColumnsOnly=t.configuredColumnsOnly,t.delimWhitespace?(k.assert(t.delimiter==null,()=>"Delimiter should not be provided when delimWhitespace is true."),this.delimWhitespace=!0,this.delimiter=" "):this.delimiter=t.delimiter?t.delimiter:","}async columnNames(){return this.columnNamesValidated||await this.setColumnNames(),this.configuredColumnsOnly?Object.keys(this.columnConfigs):this.fullColumnNames}async setColumnNames(){let e=await this.maybeReadHeaderLine();if(!this.fullColumnNames&&!e)throw new Error("Column names must be provided if there is no header line.");this.fullColumnNames&&e&&k.assert(e.length===this.fullColumnNames.length,()=>"The length of provided columnNames ("+this.fullColumnNames.length.toString()+") does not match the length of the header line read from file ("+e.length.toString()+")."),this.fullColumnNames||(this.fullColumnNames=e);let t=this.fullColumnNames.reduce((a,r)=>(a[r]=a[r]+1||1,a),{}),n=Object.keys(t).filter(a=>t[a]>1);if(k.assert(n.length===0,()=>"Duplicate column names found: "+n.toString()),this.columnConfigs){for(let a of Object.keys(this.columnConfigs))if(this.fullColumnNames.indexOf(a)===-1)throw new Error('The key "'+a+'" provided in columnConfigs does not match any of the column names ('+this.fullColumnNames.toString()+").")}this.columnNamesValidated=!0}async maybeReadHeaderLine(){if(this.hasHeader){let e=await(await this.base.iterator()).next();if(e.done)throw new Error("No data was found for CSV parsing.");let t=e.value;return this.parseRow(t,!1)}else return null}async iterator(){this.columnNamesValidated||await this.setColumnNames();let e=await this.base.iterator();return this.hasHeader&&(e=e.skip(1)),e.map(t=>this.makeDataElement(t))}makeDataElement(e){let t=this.parseRow(e),n={},a={};for(let r=0;r<this.fullColumnNames.length;r++){let s=this.fullColumnNames[r],i=this.columnConfigs?this.columnConfigs[s]:null;if(!(this.configuredColumnsOnly&&!i)){let o=t[r],l=null;if(o==="")if(i&&i.default!==void 0)l=i.default;else{if(i&&(i.required||i.isLabel))throw new Error( ` Required column $ { s } is empty in this line : $ { e } ` );l=void 0}else{let d=Number(o);if(isNaN(d))i&&i.dtype==="bool"?l=this.getBoolean(o):l=o;else if(!i||!i.dtype)l=d;else switch(i.dtype){case"float32":l=d;break;case"int32":l=Math.floor(d);break;case"bool":l=this.getBoolean(o);break;default:l=d}}i&&i.isLabel?a[s]=l:n[s]=l}}return Object.keys(a).length===0?n:{xs:n,ys:a}}getBoolean(e){return e==="1"||e.toLowerCase()==="true"?1:0}parseRow(e,t=!0){let n=[],a=0,r=e.length,s=jd;for(let i=0;i<r;i++)switch(s){case jd:switch(e.charAt(i)){case u0:a=i+1,s=d0;break;case this.delimiter:if(a=i+1,this.delimiter===" "&&this.delimWhitespace)break;n.push(""),s=jd;break;default:s=U8,a=i;break}break;case U8:switch(e.charAt(i)){case this.delimiter:n.push(e.substring(a,i)),s=jd,a=i+1;break;default:}break;case d0:switch(e.charAt(i)){case u0:s=R2;break;default:}break;case R2:switch(e.charAt(i)){case this.delimiter:n.push(e.substring(a,i-1)),s=jd,a=i+1;break;case u0:s=d0;break;default:s=H8;break}break;case H8:switch(e.charAt(i)){case u0:s=d0;break;default:}break;default:}if(s===R2?n.push(e.substring(a,r-1)):n.push(e.substring(a)),t&&n.length!==this.fullColumnNames.length)throw new Error( ` Invalid row in csv file . Should have $ { this . fullColumnNames . length } elements in a row , but got $ { n } ` );return n}},G8=class extends qt{constructor(e){super();this.microphoneConfig=e,this.isClosed=!1,this.fftSize=e.fftSize||1024;let t=Math.log2(this.fftSize);if(this.fftSize<0||t<4||t>14||!Number.isInteger(t))throw new Error( ` Invalid fftSi
` ),v.FRAGMENT_IDENTITY=["precision highp float;","varying vec2 vUv;","uniform sampler2D texture;","void main(void) {","gl_FragColor = texture2D(texture, vUv);","}"].join( `
` ),u=new Cie(f,v.VERTEX_IDENTITY,b);let I=Float32Array.BYTES_PER_ELEMENT,T=4*I;return f.enableVertexAttribArray(u.attribute.pos),f.vertexAttribPointer(u.attribute.pos,2,f.FLOAT,!1,T,0*I),f.enableVertexAttribArray(u.attribute.uv),f.vertexAttribPointer(u.attribute.uv,2,f.FLOAT,!1,T,2*I),h[b]=u,u};p.colorMatrix=function(b){let v=new Float32Array(b);v[4]/=255,v[9]/=255,v[14]/=255,v[19]/=255;let I=v[18]===1&&v[3]===0&&v[8]===0&&v[13]===0&&v[15]===0&&v[16]===0&&v[17]===0&&v[19]===0?p.colorMatrix.SHADER.WITHOUT_ALPHA:p.colorMatrix.SHADER.WITH_ALPHA,T=w(I);f.uniform1fv(T.uniform.m,v),x()},p.colorMatrix.SHADER={},p.colorMatrix.SHADER.WITH_ALPHA=["precision highp float;","varying vec2 vUv;","uniform sampler2D texture;","uniform float m[20];","void main(void) {","vec4 c = texture2D(texture, vUv);","gl_FragColor.r = m[0] * c.r + m[1] * c.g + m[2] * c.b + m[3] * c.a + m[4];","gl_FragColor.g = m[5] * c.r + m[6] * c.g + m[7] * c.b + m[8] * c.a + m[9];","gl_FragColor.b = m[10] * c.r + m[11] * c.g + m[12] * c.b + m[13] * c.a + m[14];","gl_FragColor.a = m[15] * c.r + m[16] * c.g + m[17] * c.b + m[18] * c.a + m[19];","}"].join( `
` ),p.colorMatrix.SHADER.WITHOUT_ALPHA=["precision highp float;","varying vec2 vUv;","uniform sampler2D texture;","uniform float m[20];","void main(void) {","vec4 c = texture2D(texture, vUv);","gl_FragColor.r = m[0] * c.r + m[1] * c.g + m[2] * c.b + m[4];","gl_FragColor.g = m[5] * c.r + m[6] * c.g + m[7] * c.b + m[9];","gl_FragColor.b = m[10] * c.r + m[11] * c.g + m[12] * c.b + m[14];","gl_FragColor.a = c.a;","}"].join( `
` ),p.brightness=function(b){let v=(b||0)+1;p.colorMatrix([v,0,0,0,0,0,v,0,0,0,0,0,v,0,0,0,0,0,1,0])},p.saturation=function(b){let v=(b||0)*2/3+1,I=(v-1)*-.5;p.colorMatrix([v,I,I,0,0,I,v,I,0,0,I,I,v,0,0,0,0,0,1,0])},p.desaturate=function(){p.saturation(-1)},p.contrast=function(b){let v=(b||0)+1,I=-128*(v-1);p.colorMatrix([v,0,0,0,I,0,v,0,0,I,0,0,v,0,I,0,0,0,1,0])},p.negative=function(){p.contrast(-2)},p.hue=function(b){b=(b||0)/180*Math.PI;let v=Math.cos(b),I=Math.sin(b),T=.213,R=.715, $ =.072;p.colorMatrix([T+v*(1-T)+I*-T,R+v*-R+I*-R, $ +v*- $ +I*(1- $ ),0,0,T+v*-T+I*.143,R+v*(1-R)+I*.14, $ +v*- $ +I*-.283,0,0,T+v*-T+I*-(1-T),R+v*-R+I*R, $ +v*(1- $ )+I* $ ,0,0,0,0,0,1,0])},p.desaturateLuminance=function(){p.colorMatrix([.2764723,.929708,.0938197,0,-37.1,.2764723,.929708,.0938197,0,-37.1,.2764723,.929708,.0938197,0,-37.1,0,0,0,1,0])},p.sepia=function(){p.colorMatrix([.393,.7689999,.18899999,0,0,.349,.6859999,.16799999,0,0,.272,.5339999,.13099999,0,0,0,0,0,1,0])},p.brownie=function(){p.colorMatrix([.5997023498159715,.34553243048391263,-.2708298674538042,0,47.43192855600873,-.037703249837783157,.8609577587992641,.15059552388459913,0,-36.96841498319127,.24113635128153335,-.07441037908422492,.44972182064877153,0,-7.562075277591283,0,0,0,1,0])},p.vintagePinhole=function(){p.colorMatrix([.6279345635605994,.3202183420819367,-.03965408211312453,0,9.651285835294123,.02578397704808868,.6441188644374771,.03259127616149294,0,7.462829176470591,.0466055556782719,-.0851232987247891,.5241648018700465,0,5.159190588235296,0,0,0,1,0])},p.kodachrome=function(){p.colorMatrix([1.1285582396593525,-.3967382283601348,-.03992559172921793,0,63.72958762196502,-.16404339962244616,1.0835251566291304,-.05498805115633132,0,24.732407896706203,-.16786010706155763,-.5603416277695248,1.6014850761964943,0,35.62982807460946,0,0,0,1,0])},p.technicolor=function(){p.colorMatrix([1.9125277891456083,-.8545344976951645,-.09155508482755585,0,11.793603434377337,-.3087833385928097,1.7658908555458428,-.10601743074722245,0,-70.35205161461398,-.231103377548616,-.7501899197440212,1.847597816108189,0,30.950940869491138,0,0,0,1,0])},p.polaroid=function(){p.colorMatrix([1.438,-.062,-.062,0,0,-.122,1.378,-.122,0,0,-.016,-.016,1.483,0,0,0,0,0,1,0])},p.shiftToBGR=function(){p.colorMatrix([0,0,1,0,0,0,1,0,0,0,1,0,0,0,0,0,0,0,1,0])},p.convolution=function(b){let v=new Float32Array(b),I=1/o,T=1/l,R=w(p.convolution.SHADER);f.uniform1fv(R.uniform.m,v),f.uniform2f(R.uniform.px,I,T),x()},p.convolution.SHADER=["precision highp float;","varying vec2 vUv;","uniform sampler2D texture;","uniform vec2 px;","uniform float m[9];","void main(void) {","vec4 c11 = texture2D(texture, vUv - px);","vec4 c12 = texture2D(texture, vec2(vUv.x, vUv.y - px.y));","vec4 c13 = texture2D(texture, vec2(vUv.x + px.x, vUv.y - px.y));","vec4 c21 = texture2D(texture, vec2(vUv.x - px.x, vUv.y) );","vec4 c22 = texture2D(texture, vUv);","vec4 c23 = texture2D(texture, vec2(vUv.x + px.x, vUv.y) );","vec4 c31 = texture2D(texture, vec2(vUv.x - px.x, vUv.y + px.y) );","vec4 c32 = texture2D(texture, vec2(vUv.x, vUv.y + px.y) );","vec4 c33 = texture2D(texture, vUv + px );","gl_FragColor = ","c11 * m[0] + c12 * m[1] + c22 * m[2] +","c21 * m[3] + c22 * m[4] + c23 * m[5] +","c31 * m[6] + c32 * m[7] + c33 * m[8];","gl_FragColor.a = c22.a;","}"].join( `
` ),p.detectEdges=function(){p.convolution.call(this,[0,1,0,1,-4,1,0,1,0])},p.sobelX=function(){p.convolution.call(this,[-1,0,1,-2,0,2,-1,0,1])},p.sobelY=function(){p.convolution.call(this,[-1,-2,-1,0,0,0,1,2,1])},p.sharpen=function(b){let v=b||1;p.convolution.call(this,[0,-1*v,0,-1*v,1+4*v,-1*v,0,-1*v,0])},p.emboss=function(b){let v=b||1;p.convolution.call(this,[-2*v,-1*v,0,-1*v,1,1*v,0,1*v,2*v])},p.blur=function(b){let v=b/7/o,I=b/7/l,T=w(p.blur.SHADER);f.uniform2f(T.uniform.px,0,I),x(m.INTERMEDIATE),f.uniform2f(T.uniform.px,v,0),x()},p.blur.SHADER=["precision highp float;","varying vec2 vUv;","uniform sampler2D texture;","uniform vec2 px;","void main(void) {","gl_FragColor = vec4(0.0);","gl_FragColor += texture2D(texture, vUv + vec2(-7.0*px.x, -7.0*px.y))*0.0044299121055113265;","gl_FragColor += texture2D(texture, vUv + vec2(-6.0*px.x, -6.0*px.y))*0.00895781211794;","gl_FragColor += texture2D(texture, vUv + vec2(-5.0*px.x, -5.0*px.y))*0.0215963866053;","gl_FragColor += texture2D(texture, vUv + vec2(-4.0*px.x, -4.0*px.y))*0.0443683338718;","gl_FragColor += texture2D(texture, vUv + vec2(-3.0*px.x, -3.0*px.y))*0.0776744219933;","gl_FragColor += texture2D(texture, vUv + vec2(-2.0*px.x, -2.0*px.y))*0.115876621105;","gl_FragColor += texture2D(texture, vUv + vec2(-1.0*px.x, -1.0*px.y))*0.147308056121;","gl_FragColor += texture2D(texture, vUv )*0.159576912161;","gl_FragColor += texture2D(texture, vUv + vec2( 1.0*px.x, 1.0*px.y))*0.147308056121;","gl_FragColor += texture2D(texture, vUv + vec2( 2.0*px.x, 2.0*px.y))*0.115876621105;","gl_FragColor += texture2D(texture, vUv + vec2( 3.0*px.x, 3.0*px.y))*0.0776744219933;","gl_FragColor += texture2D(texture, vUv + vec2( 4.0*px.x, 4.0*px.y))*0.0443683338718;","gl_FragColor += texture2D(texture, vUv + vec2( 5.0*px.x, 5.0*px.y))*0.0215963866053;","gl_FragColor += texture2D(texture, vUv + vec2( 6.0*px.x, 6.0*px.y))*0.00895781211794;","gl_FragColor += texture2D(texture, vUv + vec2( 7.0*px.x, 7.0*px.y))*0.0044299121055113265;","}"].join( `
` ),p.pixelate=function(b){let v=b/o,I=b/l,T=w(p.pixelate.SHADER);f.uniform2f(T.uniform.size,v,I),x()},p.pixelate.SHADER=["precision highp float;","varying vec2 vUv;","uniform vec2 size;","uniform sampler2D texture;","vec2 pixelate(vec2 coord, vec2 size) {","return floor( coord / size ) * size;","}","void main(void) {","gl_FragColor = vec4(0.0);","vec2 coord = pixelate(vUv, size);","gl_FragColor += texture2D(texture, coord);","}"].join( `
` )}var C0=2048,Ce,gt,Ft;function xg(e,t){let n;if(!e)throw new Error("Human: Input is missing");if(!(e instanceof Le)&&!(typeof Image!="undefined"&&e instanceof Image)&&!(typeof ImageData!="undefined"&&e instanceof ImageData)&&!(typeof ImageBitmap!="undefined"&&e instanceof ImageBitmap)&&!(typeof HTMLImageElement!="undefined"&&e instanceof HTMLImageElement)&&!(typeof HTMLMediaElement!="undefined"&&e instanceof HTMLMediaElement)&&!(typeof HTMLVideoElement!="undefined"&&e instanceof HTMLVideoElement)&&!(typeof HTMLCanvasElement!="undefined"&&e instanceof HTMLCanvasElement)&&!(typeof OffscreenCanvas!="undefined"&&e instanceof OffscreenCanvas))throw new Error("Human: Input type is not recognized");if(e instanceof Le)if(e.shape&&e.shape.length===4&&e.shape[0]===1&&e.shape[3]===3)n=Oa(e);else throw new Error( ` Human : Input tensor shape must be [ 1 , height , width , 3 ] and instead was $ { e . shape } ` );else{let r=e.naturalWidth||e.videoWidth||e.width||e.shape&&e.shape[1]>0,s=e.naturalHeight||e.videoHeight||e.height||e.shape&&e.shape[2]>0,i=r,o=s;if(i>C0&&(i=C0,o=i*s/r),o>C0&&(o=C0,i=o*r/s),t.filter.width>0?i=t.filter.width:t.filter.height>0&&(i=r*(t.filter.height/s)),t.filter.height>0?o=t.filter.height:t.filter.width>0&&(o=s*(t.filter.width/r)),!i||!o)throw new Error("Human: Input cannot determine dimension");(!Ce||(Ce==null?void 0:Ce.width)!==i||(Ce==null?void 0:Ce.height)!==o)&&(Ce=typeof OffscreenCanvas!="undefined"?new OffscreenCanvas(i,o):document.createElement("canvas"),(Ce==null?void 0:Ce.width)!==i&&(Ce.width=i),(Ce==null?void 0:Ce.height)!==o&&(Ce.height=o));let l=Ce.getContext("2d");if(e instanceof ImageData?l.putImageData(e,0,0):t.filter.flip&&typeof l.translate!="undefined"?(l.translate(r,0),l.scale(-1,1),l.drawImage(e,0,0,r,s,0,0,Ce==null?void 0:Ce.width,Ce==null?void 0:Ce.height),l.setTransform(1,0,0,1,0,0)):l.drawImage(e,0,0,r,s,0,0,Ce==null?void 0:Ce.width,Ce==null?void 0:Ce.height),t.filter.enabled){if((!Ft||!gt||Ce.width!==gt.width||(Ce==null?void 0:Ce.height)!==(gt==null?void 0:gt.height))&&(gt=typeof OffscreenCanvas!="undefined"?new OffscreenCanvas(Ce==null?void 0:Ce.width,Ce==null?void 0:Ce.height):document.createElement("canvas"),(gt==null?void 0:gt.width)!==(Ce==null?void 0:Ce.width)&&(gt.width=Ce==null?void 0:Ce.width),(gt==null?void 0:gt.height)!==(Ce==null?void 0:Ce.height)&&(gt.height=Ce==null?void 0:Ce.height),Ft=ma.flags.IS_BROWSER?new Lk({canvas:gt}):null),!Ft)return{tensor:null,canvas:Ce};Ft.reset(),Ft.addFilter("brightness",t.filter.brightness),t.filter.contrast!==0&&Ft.addFilter("contrast",t.filter.contrast),t.filter.sharpness!==0&&Ft.addFilter("sharpen",t.filter.sharpness),t.filter.blur!==0&&Ft.addFilter("blur",t.filter.blur),t.filter.saturation!==0&&Ft.addFilter("saturation",t.filter.saturation),t.filter.hue!==0&&Ft.addFilter("hue",t.filter.hue),t.filter.negative&&Ft.addFilter("negative"),t.filter.sepia&&Ft.addFilter("sepia"),t.filter.vintage&&Ft.addFilter("brownie"),t.filter.sepia&&Ft.addFilter("sepia"),t.filter.kodachrome&&Ft.addFilter("kodachrome"),t.filter.technicolor&&Ft.addFilter("technicolor"),t.filter.polaroid&&Ft.addFilter("polaroid"),t.filter.pixelate!==0&&Ft.addFilter("pixelate",t.filter.pixelate),Ft.apply(Ce)}else gt=Ce,Ft&&(Ft=null);let d;if(gt.data){let p=[gt.height,gt.width,3];d=pc(gt.data,p,"int32")}else if(gt instanceof ImageData)d=oi.fromPixels(gt);else if(t.backend==="webgl"||t.backend==="humangl"){let p=typeof OffscreenCanvas!="undefined"?new OffscreenCanvas(i,o):document.createElement("canvas");p.width=i,p.height=o;let c=p.getContext("2d");c==null||c.drawImage(gt,0,0),d=oi.fromPixels(p)}else{let p=typeof OffscreenCanvas!="undefined"?new OffscreenCanvas(i,o):document.createElement("canvas");p.width=i,p.height=o;let c=p.getContext("2d");c==null||c.drawImage(gt,0,0);let h=c==null?void 0:c.getImageData(0,0,i,o);d=oi.fromPixels(h)}let u=d.toFloat();n=u.expandDims(0),d.dispose(),u.dispose()}let a=t.filter.return?gt:null;return{tensor:n,canvas:a}}var bg={};fa(bg,{all:()=>Mie,body:()=>Vk,canvas:()=>Rie,face:()=>Bk,gesture:()=>Wk,hand:()=>jk,object:()=>Uk,options:()=>_i});var dt={backend:"
2021-03-10 00:32:35 +01:00
/ 9 j / 4 A A Q S k Z J R g A B A Q E A Y A B g A A D / 4 Q B o R X h p Z g A A T U 0 A K g A A A A g A B A E a A A U A A A A B A A A A P g E b A A U A
AAABAAAARgEoAAMAAAABAAIAAAExAAIAAAARAAAATgAAAAAAAABgAAAAAQAAAGAAAAABcGFpbnQu
bmV0IDQuMi4xMwAA / 9 sAQwAGBAUGBQQGBgUGBwcGCAoQCgoJCQoUDg8MEBcUGBgXFBYWGh0lHxob
IxwWFiAsICMmJykqKRkfLTAtKDAlKCko / 9 sAQwEHBwcKCAoTCgoTKBoWGigoKCgoKCgoKCgoKCgo
KCgoKCgoKCgo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0jO
tHmi0WDTlr0TyxRVhT8tJjIX + 9 SUxHXUV553BRQAVBcPhSBTSuxPY86 + IGti0s5I7dsORy9fM3i6
8e8 mfDO5P90ZrWWiJicNPpZZtxV / xrW0jQt4DOv6Vk2dEEdTY6BHuB25rpbPSo0QARjP0qTRI17W
wA / hFaMWmoQMgflQXYsDS142rU9tpqqenfNA7GgtihxkdKuRW6qMY / GkDZY8sY4Ap4hXbyB + VArk
EtuH4wPyrk / EGkOm + a3jw3suRQLc5i38SX9hJ9nnY + XnBUdPyNdFY6pa3KkkAE9l6f8AfJ / pSJT6
GhDmI + Zb4ZRycdv6ium0nUhKFydrelTsNnS2829RnrVgV6NKXNG55lWPLIM81Op + WrZkRMfmNNzT
A7GivPO4KKAEY4XNYWt3vkwPg4OK0giJdjw / xrqhm87Zs8tc7pX5A + leSajf6aHYJ50kn4AZpTep
rBWRm2Vobm4BXfyehPFdnpmnBFUY5rI2SN63tlToK0YI + KZpFF + 3 QdavwoKTLtoW0Toaswpk5pCb
LCxipAhoIuP2dKevHXoaYDylRyxhlwRQI4nxVoCXWZI1GfpXGtbSWjYPGP73 + NIGupt6TqMsLruZ
ih4xnP5V09mQ + JLd8gn0xSYJnVaVdkook69K34zuUGunDS3Rx4qOzHVIp4rrOMY3NJQI7GivPO8K
KAILt9kZrz3xlebYiu8KCCWb0XvW0NFch6ysfO3jLVjfXLIn + pQkKorl7WxNxIPl71g2dUUdpo + l
pBGvHPet23iC8ihFosrxirkHQUFo0IF4FXI1O726CpKLacCrMJoJLYHAPpTwucHpSRJJ5e4AZI9x
UqpxzVpCuOC8cUpQUMRnXttuB4rjNdsYyeVwfXpmpGmcvcQyafMCFJjPY10eg34BUg4DcZP8jUO4
HaRq3lLNF + IHet7R7jz7c56rwa2wz9 + xhiVeFy / T1PFegeaNPWigDsc0ZrzzvDNIaAM7VpNqdegr
xL4l6kywyRhseZ19lrdfAZL4jxYg3Fw20d63tJsdrDI5rm3Z3R0R0Mce1eKnQYAplIkWrMJ45oZS
NO3PHbNXIyfpSGWowSOasxLUiZdjFSqtNEMkUemKlAGKsRJjAppFAiORMjmsTVrNZEO4cfSoZSOD
1 eJ7WXBUzQZ + 7 nkfSo7e2Ei + ZaMzxntjBX2NSU1Y6 / wxqojiEFzkA8KTXYaUoWRyv3W5rSjpNHPX
+ BmpSg8V6J5gUUAdhRXnneFFAGHrTfu5PpXzj8S70 / aZtxzztXFbv4DKHxHI + H4GZiz9zxXXW8G3
GBXMjvLRXAx0oPGPSmMVeOnWrMTYpFI0bcg1fh54xmgovRcD3qxETSIZcRvzp + / B p E k q s B U q s M 9 K
q4Em4Gkxk0yRGXrVW6i8yFhkg + tJjRxGsWrxllkUMh9eK5uMz6bcebbnfG33kPcVkay2OntPKuo0
nhXI67c8qa7Lw3c + adjcEDGK1paSRhVV4s6A0or0jyRRQ1AHX0V553hRQBz + vNtt5z3xXzX8Qbdm
uic5YnOMdK3l8JnTXvlbwpYl + WySOgrp5YfLOOB9O1c62O7qQkc + 9 RsKChFPWp4DluOlSykaNruH
ArUgHShFNF2NT1qxGO3NBmyxGcE1N2560CFzjrUysO9JAPDDjFOVuKoQuSRTWouBkazbCa3cd8cV
wF7IISQccHBzUSWpV9C3o1x5b5GAjdQD1rs9DjC3kckbEhqKfxIzn8LOupRXqnkPccBSkUAzraK8
87 wooA5rxMSI3HqK8B8bQl9Q8sffY5b / AAraXwkUviNrw9pH2W1ViMMRTdRjw4HpWNtDti9TPc4P
FQs2M5qdyyMHLcfjV63HTAoBGtap0wK0YxigpsuRDtVhVYd6GQydVwwIqdRnqKCR23I5pCMUW6gD
YNKuetAEise9KTxQBWuFyhrznxNZkXjFeN3I + tTIZg2OqmzmxNF0PO3vXp / g2 + hukVl4zyPanTXv
JmVR + 60 dpThXpnlPceopWFAbnV0V553hSGgRynjC5FujOey14Ssp1HxNmTnc + a3kvcIpv37HoEYQ
QmMdVHSsnVbYJF5jVk0dsNzlruVIsl2wKxbjWrVHILjg1CRbZJb + ILHPzyhfStODWLQgFJFYd + el
UJM27HUIXxhga1Y5lLVLKLkMnoauxnPPrSEx7ShF + Y / n2qrc6xBbhizDAqkK1zJuvG9nbg8ZA681
ly / Ei052RO3uKAsZlx8QGd8xxvt9Aa1NH8dK7AXMcip64zigdkdrZX8F7EJLdwwNXMkrz1qRMRly
CK4TxmpidWI49felPYSOMmi80NIoOV6qRzXYeA5SskYPfirpfEjGr8LPWVHyD6U4CvQPL3ZItOYc
UDOoNFeed4Uhpks4H4iE / Z5MeleMeGULeLgjds10S + BGdL + Jc9OSBU2Huc5Nc74yvUtrcDBrJnZF
63 PJdXvLy / lKWw46bvQVz82jXhkLO5Y + 9 ZlsYthcRnbIjY9R3q3awTRkEM3WmJI6C0ea3dGRsr1x
XY6TqW9FLHnjrUs0izpLK5DDjofSta3ckH09KRUkZuuTvFGdvPauE1Y3U6Mqbssf / rUxHPTaJPK2
ZmJPbBqzY6DCZh5xJC9s9aBJHU6dpemJjfEmfetJtI0 + VPkUr / unFOxdiextHs33W07YHQHk11mk
Xb3KbZ1xIvcd6LEyWho4Nct41sTPYb16ipexCPPZN + wYGCvH1rrPAEJmvkPoc1VL4kZVvgZ6yFwK
cBXoHkkqinFaVyzo80GuE7WJRQSziPiGdthK5HQV4x4J / wBI8WPIewNdEvgRNL42emO / yj1UHNef
eNpRczbC + I17DvWT2OqJxc0sMK4TCisy41q0hfEkqj8aixdwTXNOlwvmqD9anS9tXH7uVG + hosO4
/ w C 0 o O h r R 0 + 6 G 4 Y N I E z s N E u C x A P N d j Z r u A 4 x x U m j I N S j U R k s O l c b q F y k b n j F A 1 s Y G o a s s a k n C q O 5
rl7rxhGm7yBnBxuJq0rkSlYpw + NLlsfd5P8AerVsvHEqSBHwPVgcgVpyMyVXU3rXxcHYETAk + hru
/ D W t i 6 Z S T y O K z Z q n d H a x v v U G q 2 r Q + d Y y q R 2 4 q W I 8 d v b r 7 L q D x y D A z X p v w 6 F v I x e P G S M 0 6 X x o y r / A
zviKFHNegeX1J41zUhXioGbuaSu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oqVijzXn
3 iC8EmsOuaCGb / heR / s0ijkVv6fbxy3QMg5xmsnuX0Ldzut3 + UYTPWk + 2 GJSe + M1pFtamcldalmx
1 eO4XaThhWnC + TXqR2PHqL3maUJ4qRjxSEjj42qXdxVmaGs1MJoATfSbqBAG5p6mgAzTJTmNvpQU
tzzHXY83D / U1zF5FhjgV5r3Pa6FMsV5HWnLe7RhqBRdmTwagN2d2K2rPU1C5LAnPrUs6Iysbdrq6
f3gK0BrUKj / WClY05iM6xLOcQAj3NT29uznfKSzHuadzNu7NSBFjHNSm5VO9IRnajqoWMhTzXFtA
bvUfMduSeg702Qz0rS7FbTToQFwzjJqaGTFyfK5PQViyzUuFmuIdgGABya5u / vTaN5cnUHFUmLoZ
zyskwlgJweSK6zQdUEwVJeGr0aUrxPLxEfe0OrhPAqVjxWhznGRtUwatDK4jNxURbmkAm6jNABup
6 tQAFqhupNtu59qUnZFwV5JHnWsHdIx96w5lz15rzT2uhRmt85xWbcxMnUGmZlB0bdxmrNvFIcfM
350 mWjbs7YkDJY / jW5ZWW4jikWkdNp9mqYJFaJdEHHakUULu / VB1rLn1Ld / FgetMGYd / qWSQmSa0
/ A e m S 3 2 p f a 7 p i L e L k g 9 z 6 U m Q t z 0 W 7 u Q 2 c Z x 0 A 9 B V z R 7 c A e a 6 j 2 r P q X 0 L 9 9 K R a t 5 A 6 D k 1 w O o K Z 5 2 a
YfMORTYRLujiGWEq6 / NWza2yKQVHNdOHerRy4laJo6TTnbbtb8KuM3Fdh5z3OJjbmpt3FaMxAtUZ
agBN1GaQBzTwaAAms3VbjERUGsa07RsdeFpuUuY4jUjljWTKK4j02RE4IpJYFk6imQkVl0xWarsO
mAEcUi0bNnZBR0rWtoguMCkUi21wI161mXuocEKaYXMS4u + pY / hVCSWSY4HT0pEmlouiSahdpEBl
mOceleiwWcNjClvHgJH97Hc1EmVFFi3Czy7mwIl / WtJbjP7uLgd / apQ2VNVvtsBhiPzdK5S4nAuR
nqOCaTGi9pcytPlU + XpmumtWII44rah8ZjiNIXRuWeNvvViQ / LXpJWPJbu7nCRvVkNxVsxBmqJmo
EPiXca0YLMuOlJsuKuPlsSi5IrNuG8s4HWs5VEkbwoOTKsk + FJY4rC1K53k1xTk5O7PSpwVNWRzt
4 cms + WpKICtSLTETQj5q0YeBSGiys23pUguGxQMq3E59ayrm4x3yaAKiRtO2WPHcmhruKFxFajzZ
ScA44qRHoXhuMaLpxaUg6hcDLMf4F9KlhuDeXGASIl + 8 azZslYma68y48m1 + 7 nFW5rtbRNhb5z1p
iMKbUg0zuW4A4rPgb7VdKXOMmpA7HRbMS7nUYiUda0lkQOBngVrS + JGdbWLRt2bAx5BqeQ / LXpnj
PQ4GJ + ashuK0MhWaoWcA0AaOmASMK7jRNPWYBmHyiuepO2x10qfcv6vYxCzYqoGK4HVYVTJrmb5l
c6oaM5TUJ8EgGsG4kLNUHT0M64OaqMMikSRsuKbnFMRLG3zVehOaGNE445NNlnVFpDMu6uie9Vo1
8 z5mOAOST2pDK91cNN + 5 tsrH3PrW54a06KxT7fdrlh / q1Pc + tJ6IUdZGvHPLezMcnBOWbsPap5r3
ylFtbdT1xUWNWzU0 / Zbwlgfmx8zGsHWtRHmMqE59aAMyNifvHPc1f0gtPdqkY5JosJHeNci2tktY
2021-04-28 14:58:21 +02:00
euPnNY + oXWZEVJNrZ9aun8SIq / CzodHuriIokhDIR1ronbKZr0o6o8ipoz //2Q==`,F0=`
2021-03-10 00:32:35 +01:00
/ 9 j / 4 A A Q S k Z J R g A B A Q A A A Q A B A A D / 2 w B D A A s I C A o I B w s K C Q o N D A s N E R w S E Q 8 P E S I Z G h Q c K S Q r K i g k
JyctMkA3LTA9MCcnOEw5PUNFSElIKzZPVU5GVEBHSEX / 2 wBDAQwNDREPESESEiFFLicuRUVFRUVF
RUVFRUVFRUVFRUVFRUVFRUVFRUVFRUVFRUVFRUVFRUVFRUVFRUVFRUVFRUX / wAARCASwBLADASIA
AhEBAxEB / 8 QAGwABAAIDAQEAAAAAAAAAA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Ou8s
tfXXn49rGWInuy8SO / k5Gl1E3rG / fzbOe94wTy99mbRvTrMOOvNfJWsesywniukrG / jU6fF43WYN
TmtEeJtEQ06aSmK2 + bNtEd + qfSO17unF9Hmvy1y13XWyVmN4tExLxVK8PmNq5NrT58zawam + m / yc
0 Xj8NpRYSvQZ7xEOdqI3rPozxayNRXe0ct / ON03jmrKB5nV4q1yTO20Obmv4c + cx8HoeI6WZpNoj
q83niYmYscU0r8aJ6T1n49zeJ + Meqm1drb9J + Kd5p136StGVem9l9TbHxLDFp7W7 + sS + q1nesT6w
+ PcAzVjiGHftzQ + v4f8AJpv6On8jH9ZgIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAABp8VrW / C9TW0ztOO3b5Nxp8VmI4bn37TWYB8f1HFtTfUfR9FWJmsdZ9I7MtJxDX5s
d8ta1y0xzteaR2277rcuhycP12SceLxMeWNpjttHwlu8I0mfQ1y + D7k5YmJmY36T36Ka43z / AF1t
cI1ds + qxVj7 / AEej19PCw9HJ4NoK4OIU5Y35YmZdzVTGebVZabx5jJS + Tmns81rNLm1Wrzc9rVw4
Yibbem72mXTTS0w0M3BvEta1bWrM95ie5EanY87wXgNOL6XPfxraXLhra / W28bR / dzYzarBqJxRe
bzE7Rt5vWU9n8mPHOGmS0Ypnea1naJb + k9ncNLR7u2y / WcxXO4TOoyUrN6zD0FaW5Y3hu49FiwUi
KxCvLMR0hlW0jn6ukWw3iXjOJzbDlneOj3GaN6zDzfFOH + LE7SRGo83XNSZ2lbG2 / WfdlvaT2cy6
rNFInlrv1mfJ37cK4PwTTxOoidRm2 + / 2 / K F u y M p 4 7 X B 4 L i v X i u n r H 2 b 2 i H 2 q n 2 K / J 8 x 4 f G D N x T S Z
9 Nh8OviRvTyfT6xtWI + DeXs9MNZubypASqAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAOZx6 / LoOWPvWiHTcf2hiZ0e8fc2mf1E5 + vP / AEeuSd7RC2uKtI6QjHfeINTfwtPf
Jvty9WPfbt / lucP03gxfJf7d / wBoReYpm97zaNeLb4Ims9Nt94auDjem1Wo5PFi1onylS + 1 o7l8V
bxvtupjDMdNkYtXS1 + Stt + m63xImEJ4xjHER2ZxMUjeUTO3VRmydBbjLJqPi08mbeVOXJPq1sl5Q
Vbkz9 + rRy35rxHqzmZlVEe / Ez5LRlW5iyfR6zffaIjq1OSNZps2a21rZInafSPJhxGMl9LStLRWM
lorM / A4dkrWbYfLZC2W / 7 K6eubX6b4RzT + W76K8b7G6X62cu3Sten59nsm3j + OXz3 / 0 ANGIAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA0OIYfpOHPijvNNo + fdvtXJO18k /
/ O w P F Y b z 2 l s 3 j x 8 V q W 6 x M d W P E d P 9 D 4 l k x / d t 7 9 f l L L H b k x T P w Y 6 n t 2 5 1 2 O R T R z E 2 x 4 / d p E 7 c v k m e
E4IrW3hRMxO8THRtU1FKWtvtvK2upx22rzRCtXkqzh2jtF7ZbT122b01ndnpuWuP3Z3 + Ky20qDVv
fauzVy3mejZzNK8dVjqi87KLRLYtXruqvXzkQp7Qoid88R6rcl + WGlW0 / Sa22mfhCZOq2x082ix6
jkm822pO8VrPdr4dNObVeDo8XW3uzMbzK + mvxT7szE27cvnu9j7PcNjSaXx8mOIzZevbrEeic5tN
+ SZnpt8J4fHD9HXHO3PPW0x / DeBtJxx29vaAJQAAAAAAAAAAAAAAAAAAAAA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AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AGjxLhODieOIye7kr9m8d4eM4to9RwjPXFa0ZIvG9bR0fQXmPbDFvTTZPOJmEWS / V8bs9R43NxLL
G8eFbePg1bajU5 / s0l1ceKLx1hbjwRE9mOpx0y2uRTSZsm3PMw2aaKtIjo6kYo9EXpET0hVLXxYK
xC6MZvyx1lFs0RHfaPiCnU12pLyHGNDbUajBekWma2npWN3p8 + opa20e9LSyZLxExTlpM + vdOdcZ
a9tPS8MyUvFrzWlI6727u1pYxYrbVmb7x + TQx6au3Nqcl7 / 0 rcmW9axGnwZJj1novmxnZXV0fFp4
ZxLBPgTGK8xzXr5fOH0bFlpmxVyY7Rato3iYfNuG2x56Wrqa8s2jz + 7 Lu8O12bS6jkwzN6THNNI6
tvrN68Y4rxlx1vHa0bskAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAA4XtTTm0OKfTJ / aXdcL2pyRGjwU362yb7fkJz9eTxxyZJjyltRXzUZK7TFtl9Lbwy06YzrHwa +
fJFd / wCVt8m0bQ0eS2qzcm + 1 K / an + zNZFL5M1pjFXeI72ky48eGnPkvNp27 + TPU6nHpMfLXaIjpE
erk5dRMxOfN1mPeisfshW1ne1a1577Y6x5R3U0zze31FOWI6ze0byU098kRlzbxM9qrMlPDpyRMR
Md5Vt / Ihp5898mWZm1pjftE91uCt7fCI7dWeHDEW3t723l6rslqxWZnasR + SYhFbzhnfxJ2jyeq9
lcGXWZcmW0zWKxHLaI7794eJx5fpfEKabT8t8l5isddo3l9S4VjrwrRUwzSJt3tav3pdOL6Y6dXD
j8HFWm + / K s U 4 N R X P v t W a z H q u W V A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A
AAAAAAAAAAAAAAAAA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+ njHgmZmPc67bq6ivVWhxxgxZLztNrT1mZ / SP4VZs0zaOvfp84WUtNsXLvtv3699 + rU
z7 + Jtt5qURqMnPpctaR1rMSw4ZoK57eNk6xHaJRh97Ltt7lo5Z + L1HAPZvVauZ2nFTSzMTzeJEz8
to6xPfvsZntPZ9rXxabmxzefdrv0j1dXh / BcmstW1qxTHHasR3 + b0GPhGl + kWmd64dNEVjf73T7X
y8vy + Ddx6O3iRakxTH5RXrMw1 / lX + 3 Itw2MFIraN48qRHdZi0cUjmmPen9noox1iO0fNzdXEYrTt
stcmd9aX0bJ + HePmiKTitO8TMLZ1cVjrMfqpz6ys4pjfrPRWZ9rXXptUit6zO + 23 VyaRHEc05L1 /
w9J9ys / en1ljqdVbwYw452tlnl3jyjzbmmiMeKtYjpEbLeTXPUU8ee / + qjJpsV5rbkrFqzE1tEbT
DpYNbW21Mnu29fKWna0KbqTdjXXjld0cvQ63ltGHNPSfs2n + HUbS9c2s2UASqAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAOVxPWe99HpP8ArmP4b + r1EabT3yT3iOkesvMVtN7za07zad5l
XV5GmM9vVfEstvDx0jtaVVMlq + UJ18b5cMRvPeSuK87bUt + i2Z3PtG7zXpjkzXt6R + TXyTMzvM7t
ydHqZ + zhv1 + Cv / ZuqvPTHMfOYaTMil1a1K2vHSLTELq2v + KWzThGo84rH5rq8JzedqR + ZeI7WnOS
34 pYTafWXR / 2 Pln / AMyrKOCWnvmiPyR6O1y9585lhWJvl557Q6eo4T4dYiMvW3b3UanhldHpJtGX
e09unmjsT7eb1l4trI2t0hsZfrdNO0bzy + nzU20 / + NmkzO9esz + TZxWis9dttvPv + Tn21jjaW8zn
26 bTG3mp1M / Wzv3t0jyWXiKZJmsTERaZhXXDbNl8WaztWenxZLstPp5pau8frDtVrNMM5cfTfpMf
3 aunxxbes9d / R09Dp8ebJi09ptFr3jtt2WyrW9wy1Jx132mK + Xq9PotT0iIU19ntLtExa3T47T + q
6 nBaYvsZstZ + cT / LeMnUi0TXffo1s2m8Ws2 / OIMWk5Jib5L328rS2t94Sh5TV4ppklpW6PT6rh + P
NbebTHyas8E081mZy5P2W6OFhjxNTE / hr / LoRO0Kvo9dPqctKzMxEx1la5t3tdnjnMs4noievcrO
yZjeFF1OSnNV0OG62cn1GWffj7Mz5w05joovzY7xes7TE7w0xrjPeex6Ua + j1UarBFu1o6Wj0lsN
3 JfQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACrU5o0 + nvlt92P3BxuM6nxNRGCs + 7 Tv8
2 hToxm1r3m9utrTvMsonqyt7XTmcja0u3O6FMfi5t / u0 / lzdJM81p9O3zdvHTwsUR5 + bfPqOfX1h
dqV + 3 O7bs1 + T31oqmI3TEM4rvCdkDGIIhlFd2daboS0NXG2bD6bufxXU1vlmu / u4us / N0 + L1tTSx
kr9qk7w89j1FNZMV3jxLzvaJ8mer + LSOZqK2xZotbvljfr / 89 U453rXt9lse081xZtNjx7TGKu0t
DHlrevSevaN5Y6 + tJ8c7VRNMt63n3ub + 6 / R54rERMztDYy4a5omclYmfxKcenrjtHLvtPrCnVmdb
eFe3JXmjy6eS / DrMuLVYsta9Mdt ++ 6 qLxO + 0 dEc8UmInr18iUfReHcXrqccb9Z27Q61Lb13eJ9nc
1 Z35rTvE9avY4bTkpG8xEfB05vYxqybc07R281naGMREdoT5JQqy9mply7Q3bV3iXG1eXw7TWSka
c258t7 + tpT5 / BjT7MfHqndz12Z + M4lMMKyziUJJiN1WSu9fku23RaOgKNJqbaTU1t9yelo + D0cTE
xEx1iXmM1Nt3W4PqvFweDaffx9vjDbGvxz + TP66QDRiAAAAAAAAAAAAAAAAAAAAA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2xx76vhWOInvt / C7ike7N
vwzE9kcapGfhlevTaFbFo8RqJ5vy8 / RoW09ek0msxHfp3dzNoLzp4zUmZpMbT8HJyYJi20X2n0lh
ZY1li / RaidBF4w2mK3jrHaFGp1lN + tptPp5IjBkid5mIp16TKu0abBPv33vPlM7z + iPdFNcWXU5I
tkrNce / b1W5db1nTaf3ax9q0fxDW1ebNk2phty1mOu09VOm8W19orEz23j1TwfSeERFuEYMddptW
d43dvBn21eKJ75KbW + cf / JcTgMxXTb3nbljz + TpcPmc2uyZO1KRtVtGVdi0bx07qJnllsRO6rNTe
N4XVamsy8mnvPwc3R2jPwe8TPbdlxXNOPSZfhWWpwO85OFzv57qrODkzeHntSe8Sn6Rv0a3EZ218
8 nXekfr1a0ZLVnqx19dWb6demXybOO7lYMvNMdW9S / VVLo0us7tPHdtUtEwJiZU3jq2Jhham8CVG
PNODNTJXvWd3qcWSubFXJWd4tG8PK3pPd1OB6veLaa89Y61 / u2xfxh5c / rsgNHOAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAANLimq + i6O0xPv392rdeZ4rq / pOqnlnelOkIt5F8Z7Wj27I2I6sb25YY
V1ImY3dbQ08LRc23vZp2j5OJG + XJWle9p2h6HHtbJXFT7OOIpX + 7 TxT31j5rycdTh + Dpz + XaG / sw
w18PHWseULN2trBE9UcrJKBhFU7JAQi0dEomegNDUYovM7x3jb5tO1ZvpbaTLtzRExWfWPJ08kbT
Ex5NXWYYyV5omYtHWJieyeDzuizfRs19Jn6TM7Ru1uMcJxZqTkw + 5 f4ebqa7SV1MR4tdrx2vEfy1
axqsNOTLjnLXytVXi3Xj8 + nmsxTLM16d5npPyUzpekTtSK + U7vS6vQ / SYmK1vWPS1HOn2dvvvvE /
tDO5XlcO + LbfHSd / W3o6 / BdDOXPTnj3Kz38rS6Wm4FNrRyRzTH3p6RH / AKvR8L4dXSzE3jmtHn5I
mbfqLV + m4dbLSsZInHjr3iI6zLpYaxS01rHuxHRHiT9mv6s67Vj1aqL6326MrWiYa + / Q 5 4 B x P a G e
XRZpj8MquB4 + Xg8zPnB7SX30to379GxpK1xcHiKz5IS8xr8PLPixH2bftLTy05o6dHYyVjLhy0t1
izjZa3pMVv3iO / qz1G2L + NbSajbNyW7xLsY8kTDz + fJXFqKZN4iZnafi6WHL0iYlStI7OO + 7 axW2
crFl7dW9jvE9ULN + J3ZbdFGOy + AYWpEqN7afNXLj + 1 Wd23KrJVMvCzseh0 + auow1yU7WhY4fCdV4
OadPefcvPuz6S7jol649Tl4AJVAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAV581NPhtkvO0R + 4 NPi2
r8DB4dJ9 + / 7 Q 8 3 P o 2 N T q L a n N b L f v P a P S F D H V 6 6 s Z 5 E T 0 h R k n y W 2 l T t M y o u z 0 c 8 u s x 2 n 7 s 7 v S c K w x
zc1vu / y85p + maJh6Th + SOWeveXR4 / wDLm8v + nX5mUWa9bbrInolmu5jdTNkxYFk2Isr3TuCzeGMz
+ THdEyDDJO9Ja823rt2XWnya946pGvktDXta0ztWu / ybvLE9dkcoOf4GbJPWK1j49VmLh9JtE33v
Mevb9G7WsW8l1ccREISophiJ2jpDYpijbaOjOuOJ8ujOdqxsgVcsUjaETYvbaFFrgu5lVsm0yUtu
ryg43H5m + GIj1XcJzePoL4pnrWGtxmfchr8JvfHS1622if3QljzTTLes + qrNjrkiYtCzPMxnm095
YZJ6boS5teB49Tqscza97VtvWvlv8V / FOF34RrIxTM2xXjelp / eHoeA6XnzReY3ivX / 0 dfivDcfE
9 HbDbaLx1pb0lOs + jO7K8Lis3cN + 0 NKcd9PmthzV5clJ2mF9J9GHHVL108dm1SznYr / Ft0tuhLb8
mNohFbMhLWy0mJ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x5d047X02SMmO
esd49YRE9WcdSXhZ2O1p89NRji9J + cei1xMc3wXi + KZj1j1dTTaqmor06WjvWW + ddcu8XK8BZmAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAMMmWmKu952UZ9XFZmuP3revlDTtzWnmvO8q3XGmfHb9ZanV3yxtWeWn7y4es
vPNtDqZJ6Ts5mppvdl / XXRMyfGvSNlu / RVvtOzLfoipLT1VTKbSpvfogRkvtDVyZOhkyvQcA4Dzz
XV6yvTvTHMfvK + c9U3rkW + zvA / D21urr789cdZ8vi9KDb45rejl8Rry6iJ / FV1HP4vXbBTJEfYt1
+ UpiHM295bXsqrO9l8QkZ0lZEqqLeyBZHZLGvZkhIndADKJ3TMoqWQMZ6pjsxll2jsCLSrmU2lFY
36 gieyu0LJk3jbsga0wdqzK20QpyztQGprL / AFMrOE05NLkt6qdVWZxNrSe5o9vWBLiUjnzXn0vL
q555dHt8HOwV928 / 1 z / LpzXxbYccRvzTB + jucOwxh0dI22mY3ltIrHLWIjyjZKyoAAAAACJiJjaY
3 iXleM8InR5J1GniZw2n3oj7s / 8 Ao9Wi9a3rNbRE1mNpifNFnVs65XhcWTdt47bnFuF24dm8TFEz
p7T0 / pn0a + HJux1OOrOux08d1ndqY7tillVkzExLOk7yd4YxGwluViJhE45raL0na0dtlWO0 + bZr
1 TKi + 2 zptZGTamT3b / tLacvJjiY3XaTWdYxZZ6 / dtPm1zrv1z78fPcbwC7EAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABhkyV
xUm152iAZWtFazNp2iGhm1Vss8uP3aevnKrNntqLdelI7VRHRnrX / HRjx / tZREVjZXeybW6KbWZt
pCZ6S08tN7Nmbb7zCrJtyoS5145bSx5mWafelr3tsKmS / o08uXyhlly7RPV2 +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LcublnzbEz1aOptyZqTuDHLfxN6R0 + t5X
qdJhjBp6UiPLeXl9NSMnEKxHa1 + bb8nrlvxUAAAAAAAAAAABTqtNj1eC2LLXeto / R43VabJw / VTh
ydY + 7 b1h7ho8V4dXiGlmvbJXrS3xRZ1fGv5rzeHN02bEW3cys3xZJx5ImtqztMS3MeTeGFjqlb2O
8 btql3NpbZtYsnSBLeiWfdTjtutid + ghherHS5p0 + f3vsX6T8Fkw181d4lMvEWdnHaGnw / UeNh5L
T7 + PpPxbjdyWcvAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAo1Oprgr63ntAmTqdRqK4K9etp7Q5d7Wy2m953lNrWyWm953mVd77R0
Za1104xxlN9lV8qnJl2a9s3xUXX2ybsJyRDWtl3YWydEC + 2 VRkzeW6q + T4tbJm + KRdfK1cmWZnlr
vNp7RC / R6HU8SycmCk7ed57Q9ZwvgOn4fEXtHi5 / O9o7fJaZ6z1uRyOEezVstq6jiEbV71xevzer
rWtKxWsRFY6REeSRrJxz22gCUAAAAAANbX6aNVpL0npMRvWfSXlKamsRMVvXm + EvZXjmpaPWHzfL
oNRjzXicfWJ8phfPxFejx72x7xMzK + sXiNoiXlq + Pi6fWV / VfTNqfLJl / WTg9Pji8R70LqvMV1Gq
j / zcv6yz + lanzzZP1lWpelTET6S81Gp1P / Gyf90s412rjtnyfqql6asREdWM9 + jz9eJ6yP8Az7uh
odZqMt458tpB1JvEViI3 / RhzRt13 / R1MNaziiZiJn5K9ZNceKZiIiQcu / WekT + iYrWI3lzdTrs + 8
8 uW0fJzcur1Np / zsn6g79phVaIeetqNR / wAXJ / 3 SwnUaj / i5P + 6 UD0ldonum161h5mNRqP8Ai5P1
lNtRqJjacuT9Qd22WN5aGeZyZd / KHJy59RHbLf8AVq31Gp / 4 uT9ZEvS8Lr / vSs2npzRtL1z53wK +
oza / HW2XJNd99pmX0Rb8VAAAAAAAAAAAAAAcHj / C5yV + l4I9 + v24jzj1cLFk8nu5jeNpeW41wmdL
knU6ev1Vp96sfdn / ANFdTrXG + eq1q5F2LLtbZoY8m8d11bbSydErsYsm + zZrO / zcnBm226uhiyRK
EtrvCrJDOJTeu8A1MWX6Lqq5N / dnpb5O5ExMbx2cPNTeJb / DM / iYPDtPvY + nzhri / jDy5 / W6AuwA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAa2p1UYo5adbz + xbxMlvqJ1OqjDHLXree0ejmzNrWm953tPmTPWbWneZ7yoy5YhjrXXTjH8s75N
mtkyxt0VZM2 / m175N1V03yTKubMLXVXybeYLLX2VXy7eam + b0bOg4VquJW + rry4 / O9uyZOq3UjVm
9 r25axMzPaIdvhns1kzbZddM0p5Y47z8 / R2 + HcF03Doi1a8 + Xzvbv + TotJnjDXkt + K8ODHp8cY8N
IpSO0RCwF2YAAAAAAAAACvUZYw6fJkntWN3k8dfHz2vLucdz8mkjFE9bz1 + UOZosX1UzPm0nqI / W
MYo9FlcPNklfFGeH / NshLGun + Cz6PtHZtVZWlRLS + jxPkRpIn7rdoupHTdA5s6SI + 7 H6Mfo + 32 Y2
+ To3neSIiZ7A0IjPXpXLePlMotGW3272t85datKzHZjbTVnsDj + FG / 2 Y / RlGP4R + jo20u7H6N1Ql
o + H8I / REY957R + jpfReiK6eOYHLtj2tttH6KrY / 6 Y / R2c + kjeJiFVtLG24hxpw7 / AHY / RRkw9O37
O99Hrt1YX0tfOBLjcGp4XF8c + u8fs9c4dcVcGemSI61nd3IneN1orQAAAAAAAAAAAAABFqxes1tE
TE9JiUgPKcX4RbRXnNgiZwWnrH4XPi28PdXpW9JraImsxtMS8pxXhF9DecuGJtgmf + 1 TWW2N / la1
L7N7T5e3Vy6W3hsYcvLbqzbO9jvvCzvDR0 + XeO7crO6FmGSvRThy / RtVXJ92elvk2rRvDUzU7pl4
izsd2J3je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eRucN4ffi2p5esRM72n0h7rS6XFo8FcO
CkVpX082nwXh3 + z9FWLxHi36328vg6TZyW9ABAAAAAAAAAAAAAAAAAAAAAADj8Unm1tK / hqppHvw
y1k8 / EMk + m0GOPeafiFpCZYwolnXspvHvLa9mF46gmnZmwozRUiUCBKYYsoBLOFbKAX0llEqqyzi
QXRLOJVRLOOwLIljZMEgrlhKyYYTAK5nZPN0RZjugUanHzVlz6xtLq361c + 9 eXItPpXX0dubTU + E
bL2lw2 ++ O1fSW6m / VYAISAAAAAAAAAAAAAAAAAp1GbwcfTreelYEydcuMcRrM / L9nnlsV6wqpi2r
tv133mfWVkRyRtEdGFva7MzkYZNoamWN4bV4mYa9qztKIujhVppxGI8r1mJegeZpknBqKZY + 7 L0t
LRekWrO8TG8Ns / HJ5ZypAWZAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAADS12fp4VJ6z9qVuq1HgUiI + 3 bpDl589cOKZmevqprXPTbx477rDJlrhr1nq4 + s182tMRP
RqaziXiZJrWekNG17ZbxWJ336M5LXRbI3dLTJrs07RMY6fan1dHLrowY + X7MVjt6N3R6Kul0EbWm
s7bz8Z + LnabQX43r7Y53php / mXj + Dnv0f1JO1x / 8 ZxbUzj02O15mfLtD13AvZqnDds + pmMmo26el
XX0Wh0 / D8EYtNjilY7 + s / NstpOOTW7QBKgAAAAAAAAAAAAAAAAAAAAAADG88tLW9I3BwJtz6nNf1
vK / DHVqYJ3pzT5y3MPZeojOWMQylEKpTVjZnDCwkqzYQyRRICATCITAJZQxhMAshnEq4ZQC2srKq
qrIBZCWNZZgwswmFloVyCu0dFcx1WyrtCBhv5NTPHXds2U5o3hIz4ffbPt + KHUcTSW5c9Jme0u2v
VYAKpAAAAAAAAAAAAAAAAYZctcVOa35R6tLrltN795 / YvknNqrfhpPLH92V5isd9mWq6fHjk6rn0
ZxG8KK5Jm / wbVZiYZtqrmkqL023bkxvCiY3lJHNyRG81mHS4Rn5sNsNp64 + 3 yaWaNrzOzHBl + i6q
mT7s9J + S + ay8mex6EIneN47SNXKAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAImYiJme0JafEs3h6fkidrZOn5eaLeJk7eOdm1Hi2vmtPTry / CHmOJcUvmvOPF1n09Pm
6 HF9ZGm01qxO3R5vSY7XwzmzTy47zzTEd7en5Mfvt2 / PURWdo3tvPrPlKymbktFqTtMTvHzbOLDG
f63JXbFX7FdnoODcDprZpq9TjiMMTvSn4vj8l5fxnrk91saPSa7i2hpOfbTVt5x1m0fLydzR6PDo
dPGHBXasd585n1lsRERG0dIF5OOe6tAEqgAAAAAAAAAAAAAAAAAAAAAAADX11 + TRZrf0y2Gjxe22
gtH4piP3TPpXKwxtjhuYo9xq442iIblI2pC1RET2ILd9kxCqRjZmwlCSEohIJAQAAJZISDKGUd2M
MoBnVbVVCyAWVWeSuqyOwIlXZZKue4MJV2WWYT2QKbKL9YlfdRdIo35b7 / Hd3KTzUrPrDh27uxpb
c2mpPwX / ABX9XAKpAAAAAAAAAAAAAACekTIp1eTwtJmv + GkyJn1oafeazbfpMzLR4jq / o8b823zX
6 XNF8ERCvTcNpxLV5LauvPhx9Irv3lhztdtv8TtaWLicXrt03jzjzb2k1nid56ty3s / w + a7Uwzjn
1 raejlarhmbhl / FpbxMO / fzj5p / ixSeXOvTtRfeI280ZI26tfDm3pWe63LaZx7qtGvniJ6tPLvOK
fOa9WzbJvTbza02jl3n5SSljscK1MajSxWZ96nSW88xw / VfQ9XMT9nfa3yemid43jtLeXsce88qQ
EqAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADia3UTm1l4j7OP3Y / u
7 Vp2rM + kPJW1PhYcmS0 + 9 MzKm / jbwz31weMzbV8UppazPL9q0 / BF4rk1GLDSNqxPWPhCnHmnNrtT
qPKteWPm6U6OdHaZvO + SaRNvhv12Ub / q3FhtrNVj0uKOt56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vPbeP1aZ9xF + v
T471tHu2iflK2HkqWmvaZj5Surqc9Ps5bx + alTHqYHm68S1Vf / NmfnC2vGNTXvyT84Ql6A3cSvHM
sfaxVn5Ssrxyv3sM / lKB1xza8bwT3pePyWV4tpZ + / M f O E j f G r X i G l t 2 z V / P o t r q c N / s 5 a T / + w L R j
FontMSlAlKEgndO6IAZQljDIEgeQljLCzOVdkCu / SGrkbF56NPNeKxMzMRHxENe0 + 89 DwuNtHHzl
5 PJr8NcnLW3Pbf7r1nCZm2gpae8zMrz4i / W6AgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAETETG0xukB4HVaeMHEtRi26RedvkyjBSfX9W77QYvC4xz7dMlYlrU7M929dWJLFc6aPK0q
7 YLxPS0S22FlP6q38Zac0yR92s / KVc3tHfFf8tpbcsLRvB / dR / 8 ALLVnU0r9uL1 + dZI1mnmdvGpv
6 TOy6ym + Oto2tWJ + cJ / tW + KLK5KW + zes / KU7tG + h01p64qx8Y6NXNo6Y + uPJlp8rLf0rfG7MXtHa
0x8 pZxqs9e2a8f8A7Oj7HaTHn0 + f6RWM23LETfr6vRW4PoL99NT8ui7F4 + vEdXXtnt + fVbXjGsr /
AOZE / OsPS29nuH27YrV + VpeV9pdPXhOtw49NG9Mld55 + vXcTPd42I47qo7xSfyWV9oM8d8VJ / VxM
d8l46xWF9cV7en6o / qLfxp2I9ob + eCv / AHMo9op89P8A / wBORGmyT5R + qfo2X8P7n9Q / jTsx7RR5
6 ef + 4 / 8 AuHftg / 8 A6cWcOSO9J / WEbWr3pY7Efzp2Lcfv5YK / 9 zWy8d1E / ZpSv5Oba1 / + Hb9lc + LP
bFt87I7E / wAabWbiurvEx4nL / pjZzc2bJkn372t85ZXx55 / BX85lucC0vPxnTxlnnjm32mOiZqUu
LJ2p4TwnVavNWaYbRTfre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uuG
f / jdN / 06 / wAPE546S9rwud + Gaaf + XH8NMMPK2wGjAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAABrcRp4nDtRWPPHP8PCYusPoWSvNjtX1iYfPuWaXtX8MzCuvjfw32siu8ptXoxi
0 wy5t4YulReqmazu2skbquURWFInddM7VYRGyL291KFnCcfj8e0le / Lbmn8n0N4b2Ur4nHLWmPsY
5e5 a5 + OXyXugBZmiY3iY9Xz7NjnTa3Ph / BeYj5PoTxftFg8Hjk2iOmWkW / Psrr418V5WrWd2faFc
V2jdnEMXWxntupmN7NiYU27iWML6dVMVnddjgVqMsdHr + CW5uE6f4Rt + 7 yuSsTDv + zWXn0WTHP3L
/ t K + G H l + O 0 A 1 c 4 A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA8Dn93W56 / wDM
t / L3z59qp24jn + OS38lnpr4r7ZxHQ2TEstt3PXUrt27K57rr1VT0BjKnJPRbMqMs7QlV2fYvHvrd
VknyrEfu9m8f7FZI8fVU85iJewbT45NfQBKo817W4eulzxHaZrL0rje09ItwqbfhtBVs3leai8RD
KLw1sduesL606dWFdsZT1jdhNeq6K9DlhCVUU6s4jZnt1YzAhnM71dH2bycmszY / K1d / 0 c6OzY4R
fwuK4p8rTstn6z8k7HrwGzkAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHz3
Vxvr80 / 8 y38voTwGpj / F5 / 8 AqT / JfjTx / WVeyY6FPspc9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SIAS8b7RV5eOb / AIqRL2TyXtNX / e2KfXH / AHlF
+ NPH / pr4 + 2 xcxx0hFpY11K7R16KM32ZWz3UaidqSgrc9kcPicWyZJjfw6T + 727 y3sXh2xarN + K0V
h6lvPjj3e0ASqAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAJQAAAAAkQAkQAkAAAAAAAAAAAAAAA
EgAAAAAAAAAAAAAAAAAAAAAgAAABKDcAN0bgkY8xzAyRux5kcwM9zdXNkTcFm6OZXzMeYFvMibKu
ZHMC2bo51U2RuC2bom6rc3BZzom6sBZzI52ADPnOdggFnMc6skFnMc6rc3BbznOp3RzAv50c6nml
HMC / nOf4qOY5wX85zqOc5wbHOc7X5znBsc6edr85zg2ec52vzpi4NjmY5bROG + / b l l V z s N T k 5 d L l
n0pP8BHmMHWNmzt0aum8obm08vVjfrtnxztR0mXHzTvaZdjVRMTLkZo6yiFen9iZ2pqY / wBP93rN
3 kPY + / L f P X 1 r E / u 9 X z N 3 H f q z d O 6 v m T u I Z 7 m 7 H c 3 B n u 8 t 7 T R / v H B P 9 E / y 9 P u 8 3 7 S V 3 1 u m n + i f 5 R f i
/ j / 0 1 M M b 1 h j k r t K z B G 0 b M s m O Z Y 1 1 t O Y a m r 6 U n d 0 L U c 7 X T 7 u 3 r J P q L 8 e r 9 l c P h c F p b z y W m 3 9 v 7 O 0 0
+ FYvA4Zpsc94xxu227jv1IAgAAAAAAAAABKAAAASgASgBIgBIgBIgBIhIAAAAAAAAAAAAAAAAAAC
UACUJAAAAAAAAAAAABIAAAAAAAAAAAAAAAAAAAAg3AEbomQZbo3YzLGbAz3RNlc3YzcFs2YzdVN2
M2Bdzom6nmNwW86JurTAMuY3REJ2BB1ZRVMVBhsbSsiqeUFXLucq3lTygp5TlXcpygp5TlXcpygp
5 TlXcqOUFXKjlXcrGYBXysdlswiYBVMdUTCyY6sZBWxlnMMZgGLGZZSwkDdHMiWO4MuY5mEyjcFn
N1OdVzHMC3nTzqeY5gX85zqOZPMC + Lqdbk20eb / RKOZr8QybaK / XvtH7iZ9aGlp2luzT3fg19NHS
OjbmPcYX67XH1XSZ9XIzRvMuzrK7zLkZYmYnciunb9lZ5dTk + OP + 71 cXeP8AZnJ / ip2nf3J / l6iL
/ F u 5 L 9 b M W Z c z X i 6 Y u I b E W T z K I u y i w L t 3 n u O 2 5 u I 4 a / h x 7 / r L u c z g 8 T i c v F L b f d p E K 6 + N P H / p h h j o
stLGkctUWnoxrrU3j1cnWTzZq1jzl1clo5Zcu8c + txR63iP3Tn6pv4 + g4o5cVI9IiGe7CJ2iE7t3
GyN2O6dwSINwSISAlAAlACRAAlAAlACRACRCQAAAAAAAAAASgASISAAAAAAAAAAAAACQAAAAAAAA
AAAAAASAAAAAAAAAAAAAAAAIAAAQCAJljuljsCJlhMs9mOwMJYys5TkBVsjZdyHICrZPKt5E8oK4
qmKrOVOwMIqyirPY2Bjyp2ZbAI2NmSARsbMgEbI2ZAMdjZICNkbMkSCNmOzJEgx2YyzljMAwlhKy
WEwCuWErJhhMArlhLOWEgxljMpljIImWMyTKJA3N0IBO5vux3NwZbnMx3NwZczT4jf3MdPW27a3a
fJOq1XNP2KdIRfi + J2trSYfcjeF + Wm1OicVeWIiN9kai8xjY12ORqultnI1Ecsujq79XP1FovWYI
rTgeq + j8QrWZ + 3 Mx + r2UXeC0WG2Ti2kiN5mL807eUREvbzbaejefHJv62Iv8WUXa0WTFhVtRdlF2
rz9WUXBtc7jR9dqc2T1ttHyhvZMvJitb0jdq6XHNcNenWVN3028U99WRj6Kb02be3Tq18 / SN2Lpc
3 UdN9nOmZrqKX / DaJ / d0svvTLRzV3jomK6 + Pd1vvWJj0ZczT0mXxNJht60hfFnQ4qu3N1cWTEgs3
Tur5k7gz3N2O5uDM3Y7m4MtxBuCQASIASIASAAAAAAACRCQAAAAAAAAEoSAAAAAAAAAAAlAAlCQA
AAAAAAAAAAASAAAAAAAAAAAAIASgAAAEJAQJQCNkbMgGOyOVnsAw5TlZ7GwMOVPKy2Ng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88k7z2U5axeItDa1OPessuC8P
ya7XRWYnwqdbT / ZMilvIu4dpslNdixXja8Y5tt85djZdbDWnGOesRtXFtuw6T27No5Kx2OrKYQlC
ExKJgBnEpiyvdlEgsizKLKollFgWxLKJVRLKJBbEp3VxLKJBnuMWQJEbpBIAAAJAAAABIAAAAAAA
lAJAAAAAAAAAAAAAASAAAAAAAAAAAAAJAAAABAJABAlAAAAAAAAAAAAAAAAAAAAAAAAIAAAAAAAA
AAABAJQAAAAgAABAAI2EoBGyJhkgGPKxmqxAKpownHC + YRMdN5BrTj67R3bOn01o7p01Iv71u89o
b9a7LfBTfS1vWI2jf12VfQPSW8KX2mas + NC2iv6xMNfJpMnLtEbuuxtMRCtzF55NR5rPps1N / ctP
y6uHreE6nXZ4pak48X3rT06fB7fNeI33cbX6mI32R / MWu7XF116aDSRhxbRERs8f499bkyZeeKae
kzE2mdon81 / tfxDLGOunwbzlzbx08oaHBvZHJlx48mrvaa94pu04y617576rNGLRRM0397JEd / lu
9 Dw / S3x4qxffo6mm4NjwUiKY4iI9Ib1dHFY6QIaNabbrYrLfrpJtaK1rMzPZb / s + 05 IpP59OyLeJ
k7eNfRaOc1ue32I7fGXYpi5Y77M8OGMeOKxHSFsU3Y29deZMzirl6dlVvhLatCjJHeYQv1rXnps1
8 k9 / VsW6qLVmZIi1rzitlvFKRvaZ2h6TSaenC9FFY + 3 brM + sqeG8Prp4 + kZ + lvuxPkr1mqm95nfp
DXM459676a2q1dsV7XietvNno78 + CJn1cjX6mOeIm0bR33dfRU5NJjidt9t5afjG / V6JZ7I2QMNh
nyo2BhsMuVG3wAhMSbbQRAMolnE + iuGUSCyJZRKuGUSCyJZK4llEgyZMYTuCUsYSCQASISAAAlCQ
AAAAAAEoASCASAAAAAAAAAAAAlACRACQAAAAAAAAAEgCEoASCAAAAAAAAAAAAAAAAAAAAAAABAAA
AAAAAAAISAIAAAAAAQAAACASgAAAQJAQAAhIDHZhln3do7z0WS18mWsajHjmes7pg3dNi5aRMNqO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5T
lBhEMohlFerLlBjEMohMVTEARDKCITsAk2AEgAAAkAAAAAAAAAAAAAAAAAAAAAAAASAAAAAAAAD /
2021-04-28 14:58:21 +02:00
2 Q == ` ;var Hk="1.8.0";var Zl,Zd,Yd,Li, $ 0,Jd,D0,O0,z0,Gk=class{constructor(t={}){Zl.set(this,void 0);Zd.set(this,void 0);Yd.set(this,void 0);Li.set(this,void 0);this.analyze=(...t)=>{if(!na(this,Zd))return;let n=this.tf.engine().state.numTensors,a=na(this,Zl);as(this,Zl,n);let r=n-a;r!==0&&he(...t,r)}; $ 0.set(this,t=>{if(!na(this,Yd))return null;if(!t)return"input is not defined";if(this.tf.ENV.flags.IS_NODE&&!(t instanceof Le))return"input must be a tensor";try{this.tf.getBackend()}catch(n){return"backend not loaded"}return null});Jd.set(this,async(t=!1)=>{var n;if(this.config.backend&&this.config.backend.length>0&&t||this.tf.getBackend()!==this.config.backend){let a=it();if(this.state="backend",this.config.backend&&this.config.backend.length>0){if(typeof window=="undefined"&&typeof WorkerGlobalScope!="undefined"&&this.config.debug&&he("running inside web worker"),this.tf.ENV.flags.IS_BROWSER&&this.config.backend==="tensorflow"&&(this.config.backend="webgl"),this.tf.ENV.flags.IS_NODE&&(this.config.backend==="webgl"||this.config.backend==="humangl")&&(this.config.backend="tensorflow"),this.config.debug&&he("setting backend:",this.config.backend),this.config.backend==="wasm"){if(this.config.debug&&he("wasm path:",this.config.wasmPath),typeof((n=this.tf)==null?void 0:n.setWasmPaths)!="undefined")this.tf.setWasmPaths(this.config.wasmPath);else throw new Error("Human: WASM backend is not loaded");let r=await this.tf.env().getAsync("WASM_HAS_SIMD_SUPPORT"),s=await this.tf.env().getAsync("WASM_HAS_MULTITHREAD_SUPPORT");this.config.debug&&he( ` wasm execution : $ { r ? "SIMD" : "no SIMD" } $ { s ? "multithreaded" : "singlethreaded" } ` ),this.config.debug&&!r&&he("warning: wasm simd support is not enabled")}this.config.backend==="humangl"&&J8();try{await this.tf.setBackend(this.config.backend)}catch(r){he("error: cannot set backend:",this.config.backend,r)}}if(this.tf.enableProdMode(),this.tf.getBackend()==="webgl"||this.tf.getBackend()==="humangl"){this.tf.ENV.set("CHECK_COMPUTATION_FOR_ERRORS",!1),this.tf.ENV.set("WEBGL_PACK_DEPTHWISECONV",!0),typeof this.config.deallocate!="undefined"&&(he("changing webgl: WEBGL_DELETE_TEXTURE_THRESHOLD:",!0),this.tf.ENV.set("WEBGL_DELETE_TEXTURE_THRESHOLD",0));let r=await this.tf.backend().getGPGPUContext().gl;this.config.debug&&he( ` gl version : $ { r . getParameter ( r . VERSION ) } renderer : $ { r . getParameter ( r . RENDERER ) } ` )}await this.tf.ready(),this.perf.backend=Math.trunc(it()-a)}});D0.set(this,async()=>{let t=(r,s="application/octet-stream")=>fetch( ` data : $ { s } ; base64 , $ { r } ` ).then(i=>i.blob()),n,a;switch(this.config.warmup){case"face":n=await t(M0);break;case"full":n=await t(F0);break;default:n=null}if(n){let r=await createImageBitmap(n);a=await this.detect(r,this.config),r.close()}return a});O0.set(this,async()=>new Promise(t=>{let n,a=0;switch(this.config.warmup){case"face":a=256,n="data:image/jpeg;base64,"+M0;break;case"full":case"body":a=1200,n="data:image/jpeg;base64,"+F0;break;default:n=null}let r=new Image;r.onload=async()=>{let s=typeof OffscreenCanvas!="undefined"?new OffscreenCanvas(a,a):document.createElement("canvas");s.width=r.naturalWidth,s.height=r.naturalHeight;let i=s.getContext("2d");i==null||i.drawImage(r,0,0);let o=await this.detect(s,this.config);t(o)},n?r.src=n:t(null)}));z0.set(this,async()=>{let t=r=>Buffer.from(r,"base64"),n;if(this.config.warmup==="face"&&(n=t(M0)),(this.config.warmup==="body"||this.config.warmup==="full")&&(n=t(F0)),!n)return null;let a;if(typeof void 0!="undefined"){let r=(void 0).decodeJpeg(n),s=r.expandDims(0);this.tf.dispose(r),a=await this.detect(s,this.config),this.tf.dispose(s)}else this.config.debug&&he("Warmup tfjs-node not loaded");return a});this.tf=lu,this.draw=bg,this.version=Hk,this.config=Hn(dt,t),this.state="idle",as(this,Zl,0),as(this,Zd,!1),as(this,Yd,!1),as(this,Li,!0),this.perf={},this.models={face:null,posenet:null,blazepose:null,efficientpose:null,handpose:null,iris:null,age:null,gender:null,emotion:null,embedding:null,nanodet:null,faceres:null},this.image=n=>xg(n,this.config),this.classes={facemesh:_2,emotion:B2,faceres:H2,body:this.config.body.modelPath.in
/ * *
* @ license
* Copyright 2017 Google LLC . All Rights Reserved .
* Licensed under the Apache License , Version 2.0 ( the "License" ) ;
* you may not use this file except in compliance with the License .
* You may obtain a copy of the License at
*
* http : //www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing , software
* distributed under the License is distributed on an "AS IS" BASIS ,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND , either express or implied .
* See the License for the specific language governing permissions and
* limitations under the License .
* === === === === === === === === === === === === === === === === === === === === === === === === === ==
* /
/ * *
* @ license
* Copyright 2018 Google LLC
*
* Use of this source code is governed by an MIT - style
* license that can be found in the LICENSE file or at
* https : //opensource.org/licenses/MIT.
* === === === === === === === === === === === === === === === === === === === === === === === === === ==
* /
/ * *
* @ license
* Copyright 2018 Google LLC . All Rights Reserved .
* Licensed under the Apache License , Version 2.0 ( the "License" ) ;
* you may not use this file except in compliance with the License .
* You may obtain a copy of the License at
*
* http : //www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing , software
* distributed under the License is distributed on an "AS IS" BASIS ,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND , either express or implied .
* See the License for the specific language governing permissions and
* limitations under the License .
*
* === === === === === === === === === === === === === === === === === === === === === === === === === ==
* /
/ * *
* @ license
* Copyright 2018 Google LLC . All Rights Reserved .
* Licensed under the Apache License , Version 2.0 ( the "License" ) ;
* you may not use this file except in compliance with the License .
* You may obtain a copy of the License at
*
* http : //www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing , software
* distributed under the License is distributed on an "AS IS" BASIS ,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND , either express or implied .
* See the License for the specific language governing permissions and
* limitations under the License .
* === === === === === === === === === === === === === === === === === === === === === === === === === ==
* /
/ * *
* @ license
* Copyright 2019 Google LLC
*
* Use of this source code is governed by an MIT - style
* license that can be found in the LICENSE file or at
* https : //opensource.org/licenses/MIT.
* === === === === === === === === === === === === === === === === === === === === === === === === === ==
* /
/ * *
* @ license
* Copyright 2019 Google LLC . All Rights Reserved .
* Licensed under the Apache License , Version 2.0 ( the "License" ) ;
* you may not use this file except in compliance with the License .
* You may obtain a copy of the License at
*
* http : //www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing , software
* distributed under the License is distributed on an "AS IS" BASIS ,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND , either express or implied .
* See the License for the specific language governing permissions and
* limitations under the License .
*
* === === === === === === === === === === === === === === === === === === === === === === === === === ==
* /
/ * *
* @ license
* Copyright 2019 Google LLC . All Rights Reserved .
* Licensed under the Apache License , Version 2.0 ( the "License" ) ;
* you may not use this file except in compliance with the License .
* You may obtain a copy of the License at
*
* http : //www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing , software
* distributed under the License is distributed on an "AS IS" BASIS ,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND , either express or implied .
* See the License for the specific language governing permissions and
* limitations under the License .
* === === === === === === === === === === === === === === === === === === === === === === === === === ==
* /
/ * *
* @ license
* Copyright 2020 Google Inc . All Rights Reserved .
* Licensed under the Apache License , Version 2.0 ( the "License" ) ;
* you may not use this file except in compliance with the License .
* You may obtain a copy of the License at
*
* http : //www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing , software
* distributed under the License is distributed on an "AS IS" BASIS ,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND , either express or implied .
* See the License for the specific language governing permissions and
* limitations under the License .
* === === === === === === === === === === === === === === === === === === === === === === === === === ==
* /
/ * *
* @ license
* Copyright 2020 Google LLC
*
* Use of this source code is governed by an MIT - style
* license that can be found in the LICENSE file or at
* https : //opensource.org/licenses/MIT.
* === === === === === === === === === === === === === === === === === === === === === === === === === ==
* /
/ * *
* @ license
* Copyright 2020 Google LLC . All Rights Reserved .
* Licensed under the Apache License , Version 2.0 ( the "License" ) ;
* you may not use this file except in compliance with the License .
* You may obtain a copy of the License at
*
* http : //www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing , software
* distributed under the License is distributed on an "AS IS" BASIS ,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND , either express or implied .
* See the License for the specific language governing permissions and
* limitations under the License .
* === === === === === === === === === === === === === === === === === === === === === === === === === ==
* /
/ * *
* @ license
* Copyright 2020 Google LLC . All Rights Reserved .
* Licensed under the Apache License , Version 2.0 ( the License ) ;
* you may not use this file except in compliance with the License .
* You may obtain a copy of the License at
*
* http : //www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing , software
* distributed under the License is distributed on an AS IS BASIS ,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND , either express or implied .
* See the License for the specific language governing permissions and
* limitations under the License .
* === === === === === === === === === === === === === === === === === === === === === === === === === ==
* /
/ * *
* @ license
* Copyright 2021 Google LLC . All Rights Reserved .
* Licensed under the Apache License , Version 2.0 ( the "License" ) ;
* you may not use this file except in compliance with the License .
* You may obtain a copy of the License at
*
* http : //www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing , software
* distributed under the License is distributed on an "AS IS" BASIS ,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND , either express or implied .
* See the License for the specific language governing permissions and
* limitations under the License .
* === === === === === === === === === === === === === === === === === === === === === === === === === ==
* /
/** @license See the LICENSE file. */
2021-03-10 00:32:35 +01:00
//# sourceMappingURL=human.js.map