2021-03-10 00:32:35 +01:00
/ *
Human library
homepage : < https : //github.com/vladmandic/human>
author : < https : //github.com/vladmandic>'
* /
2021-04-17 00:03:15 +02:00
var Human = ( ( ) => { var l9 = Object . defineProperty ; var Jn = ( e , t ) => { for ( var n in t ) l9 ( e , n , { get : t [ n ] , enumerable : ! 0 } ) } ; var l5 = ( e , t , n ) => { if ( ! t . has ( e ) ) throw TypeError ( "Cannot " + n ) } , ur = ( e , t , n ) => ( l5 ( e , t , "read from private field" ) , n ? n . call ( e ) : t . get ( e ) ) , us = ( e , t , n , r ) => ( l5 ( e , t , "write to private field" ) , r ? r . call ( e , n ) : t . set ( e , n ) , n ) ; var soe = { } ; Jn ( soe , { Human : ( ) => bk , default : ( ) => bk } ) ; function pt ( e , t ) { let n = e . endsWith ( "/" ) ? "" : "/" , a = t . startsWith ( "." ) || t . startsWith ( "/" ) || t . startsWith ( "http:" ) || t . startsWith ( "https:" ) || t . startsWith ( "file:" ) ? ` ${ t } ` : ` ${ e } ${ n } ${ t } ` ; if ( ! a . toLocaleLowerCase ( ) . includes ( ".json" ) ) throw new Error ( ` Human: ModelPath Error: ${ a } Expecting JSON file ` ) ; return a } function le ( ... 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 Ye = ( ) => typeof performance != "undefined" ? performance . now ( ) : parseInt ( ( Number ( process . hrtime . bigint ( ) ) / 1e3 / 1e3 ) . toString ( ) ) ; function Qn ( ... e ) { let t = n => n && typeof n == "object" ; return e . reduce ( ( n , r ) => ( Object . keys ( r || { } ) . forEach ( a => { let s = n [ a ] , i = r [ a ] ; Array . isArray ( s ) && Array . isArray ( i ) ? n [ a ] = s . concat ( ... i ) : t ( s ) && t ( i ) ? n [ a ] = Qn ( s , i ) : n [ a ] = i } ) , n ) , { } ) } function u5 ( ) { let e , t ; if ( typeof navigator != "undefined" ) { let n = navigator . userAgent . match ( /\(([^()]+)\)/g ) ; if ( n && n [ 0 ] ) { let r = n [ 0 ] . match ( /\(([^()]+)\)/g ) ; e = r ? r [ 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 gu = { } ; Jn ( gu , { Abs : ( ) => so , Acos : ( ) => io , Acosh : ( ) => oo , AdadeltaOptimizer : ( ) => ep , AdagradOptimizer : ( ) => tp , AdamOptimizer : ( ) => np , AdamaxOptimizer : ( ) => rp , Add : ( ) => Ca , AddN : ( ) => ds , All : ( ) => lo , Any : ( ) => uo , ArgMax : ( ) => ps , ArgMin : ( ) => vu , Asin : ( ) => co , Asinh : ( ) => ho , Atan : ( ) => po , Atan2 : ( ) => mo , Atanh : ( ) => fo , AvgPool : ( ) => fs , AvgPool3D : ( ) => ku , AvgPool3DGrad : ( ) => Oh , AvgPoolGrad : ( ) => Dh , BackendWasm : ( ) => Mv , BatchMatMul : ( ) => ms , BatchToSpaceND : ( ) => Iu , Bincount : ( ) => zh , BroadcastTo : ( ) => tw , Callback : ( ) => v4 , CallbackList : ( ) => b6 , Cast : ( ) => ys , Ceil : ( ) => As , ClipByValue : ( ) => Ra , Complex : ( ) => Ph , ComplexAbs : ( ) => Su , Concat : ( ) => yo , Conv2D : ( ) => gs , Conv2DBackpropFilter : ( ) => Lh , Conv2DBackpropInput : ( ) => xs , Conv3D : ( ) => Nu , Conv3DBackpropFilterV2 : ( ) => Wh , Conv3DBackpropInputV2 : ( ) => Bh , Cos : ( ) => ws , Cosh : ( ) => Ao , CropAndResize : ( ) => go , Cumsum : ( ) => bs , CustomCallback : ( ) => v6 , DataStorage : ( ) => Rh , DenseBincount : ( ) => Vh , DepthToSpace : ( ) => xo , DepthwiseConv2dNative : ( ) => _s , DepthwiseConv2dNativeBackpropFilter : ( ) => jh , DepthwiseConv2dNativeBackpropInput : ( ) => Uh , Diag : ( ) => Hh , Dilation2D : ( ) => Tu , Dilation2DBackpropFilter : ( ) => qh , Dilation2DBackpropInput : ( ) => Gh , ENV : ( ) => _r , EarlyStopping : ( ) => I4 , Einsum : ( ) => Xh , Elu : ( ) => wo , EluGrad : ( ) => Kh , Environment : ( ) => Qx , Equal : ( ) => _o , Erf : ( ) => bo , Exp : ( ) => ks , ExpandDims : ( ) => vo , Expm1 : ( ) => ko , FFT : ( ) => Zh , Fill : ( ) => Eu , FlipLeftRight : ( ) => Io , Floor : ( ) => Is , FloorDiv : ( ) => Ss , FromPixels : ( ) => hd , FusedBatchNorm : ( ) => Ns , FusedConv2D : ( ) => oi , FusedDepthwiseConv2D : ( ) => li , GPGPUContext : ( ) => wp , GatherNd : ( ) => No , GatherV2 : ( ) => So , GraphModel : ( ) => t8 , Greater : ( ) => To , GreaterEqual : ( ) => Ts , History : ( ) => _6 , IFFT : ( ) => Yh , Identity : ( ) => Es , Imag : ( ) => Jh , InputSpec : ( ) => Ft , IsFinite : ( ) => Eo , IsInf : ( ) => Co , IsNan : ( ) => Ro , KernelBackend : ( ) => wu , LRN : ( ) => Mu , LRNGrad : ( ) => ed , LayerVariable : ( ) => y6 , LayersModel : ( ) => ga , LeakyRelu : ( ) => Cs , Less : ( ) => Mo , LessEqual : ( ) => Fo , LinSpace : ( ) => Qh , Log : ( ) => Rs , Log1p : ( ) => $o , LogSoftmax : ( ) => nw , LogicalAnd : ( ) => Do , LogicalNot : ( ) => Cu , LogicalOr : ( ) => Ru , MathBackendCPU : ( ) => op , MathBackendWebGL : ( ) => Wl , Max : ( ) => Ms , MaxPool : ( ) => $s , MaxPool3D : ( ) => Fu , MaxPool3DGrad : ( ) => nd , MaxPoolGrad : ( ) => td , MaxPoolWithArgmax : ( ) => rd , Maximum : ( ) => Fs , Mean : ( ) => Ds , Min : ( ) => Os , Minimum : ( ) => zs , MirrorPad : ( ) => Ps , Mod : ( ) => Oo , MomentumOptimizer : ( ) => ap , Multinomial : ( ) => ad , Multiply : ( ) => Ls , Neg : ( ) => zo , NonMaxSuppressionV3 : ( ) => Lo , NonMaxSuppressionV4 : ( ) => Wo , NonMaxSuppressionV5 : ( ) => Bo , NotEqual : ( ) => Po , OP _SCOPE _SUFFIX : ( ) => pw , OneHot : ( ) => Ws , OnesLike : ( ) => Vo , Optimizer : ( ) => fa , Pack : ( ) => jo , PadV2 : ( ) => Bs , Pool : ( ) => uI , Pow : ( ) => Vs , Prelu : ( ) => js , Prod : ( ) => Uo , RMSPropOptimizer : ( ) => sp , RNN : ( ) => Zr , Range : (
` )),l.join( `
` )}function bI(e,t,n,r){let a=Et(t),s=r[r.length-1],i=new Array(s).fill(0),o=t.length,l=n==="complex64"?Uu(e):e;if(o>1)for(let c=0;c<a/s;c++){let u=c*s;for(let h=0;h<s;h++)i[h]=Math.max(i[h],ju(l[u+h],0,n).length)}return i}function ju(e,t,n){let r;return Array.isArray(e)?r= ` $ { parseFloat ( e [ 0 ] . toFixed ( $f ) ) } + $ { parseFloat ( e [ 1 ] . toFixed ( $f ) ) } j ` :Ta(e)?r= ` '${e}' ` :n==="bool"?r=sw(e):r=parseFloat(e.toFixed( $ f)).toString(),_u(r,t)}function sw(e){return e===0?"false":"true"}function md(e,t,n,r,a,s=!0){let i=n==="complex64"?2:1,o=t[0],l=t.length;if(l===0){if(n==="complex64"){let m=Uu(e);return[ju(m[0],0,n)]}return n==="bool"?[sw(e[0])]:[e[0].toString()]}if(l===1){if(o>aw){let y=Vu*i,A=Array.from(e.slice(0,y)),g=Array.from(e.slice((o-Vu)*i,o*i));return n==="complex64"&&(A=Uu(A),g=Uu(g)),["["+A.map((x,v)=>ju(x,a[v],n)).join(", ")+", ..., "+g.map((x,v)=>ju(x,a[o-Vu+v],n)).join(", ")+"]"]}let m=n==="complex64"?Uu(e):Array.from(e);return["["+m.map((y,A)=>ju(y,a[A],n)).join(", ")+"]"]}let c=t.slice(1),u=r.slice(1),h=r[0]*i,d=[];if(o>aw){for(let m=0;m<Vu;m++){let y=m*h,A=y+h;d.push(...md(e.slice(y,A),c,n,u,a,!1))}d.push("...");for(let m=o-Vu;m<o;m++){let y=m*h,A=y+h;d.push(...md(e.slice(y,A),c,n,u,a,m===o-1))}}else for(let m=0;m<o;m++){let y=m*h,A=y+h;d.push(...md(e.slice(y,A),c,n,u,a,m===o-1))}let p=l===2?",":"";d[0]="["+d[0]+p;for(let m=1;m<d.length-1;m++)d[m]=" "+d[m]+p;let f= ` ,
` ;for(let m=2;m<l;m++)f+= `
` ;return d[d.length-1]=" "+d[d.length-1]+"]"+(s?"":f),d}function Uu(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=Et(e),n!=null){let r=n.length;M(r===this.size,()=> ` Length of values '${r}' 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||Hx(t,this.size),this.strides=ro(e)}set(e,...t){t.length===0&&(t=[0]),M(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 r of e){if(r<0||r>=this.shape[t]){let a= ` Requested out of range element at $ { e } . Buffer shape = $ { this . shape } ` ;throw new Error(a)}t++}let n=e[e.length-1];for(let r=0;r<e.length-1;++r)n+=this.strides[r]*e[r];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 Pr().makeTensor(this.values,this.shape,this.dtype)}},Pr=null,ll=null,vI=null;function kI(e){Pr=e}function II(e){ll=e}function SI(e){vI=e}var ze=class{constructor(e,t,n,r){this.kept=!1,this.isDisposedInternal=!1,this.shape=e.slice(),this.dtype=t||"float32",this.size=Et(e),this.strides=ro(e),this.dataId=n,this.id=r,this.rankType=this.rank<5?this.rank.toString():"higher"}get rank(){return this.shape.length}async buffer(){let e=await this.data();return ll.buffer(this.shape,this.dtype,e)}bufferSync(){return ll.buffer(this.shape,this.dtype,this.dataSync())}async array(){let e=await this.data();return ao(this.shape,e,this.dtype==="complex64")}arraySync(){return ao(this.shape,this.dataSync(),this.dtype==="complex64")}async data(){this.throwIfDisposed();let e=Pr().read(this.dataId);if(this.dtype==="string"){let t=await e;try{return t.map(n=>fd(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=Pr().readSync(this.dataId);if(this.dtype==="string")try{return e.map(t=>fd(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 Pr().read(this.dataId);return this.dtype==="string"?e:new Uint8Array(e.buffer)}dispose(){this.isDisposed||(Pr().disposeTensor(this),this.isDisposedInternal=!0)}get isDisposed(){return this.isDisposedInternal}throwIfDisposed(){if(this.isDisposed)throw new Error("Tensor is disposed.")}print(e=!1){return ll.print(this,e)}clone(){return this.throwIfDisposed(),ll.clone(this)}toString(e=!1){let t=this.dataSync();return _I(t,this.shape,this.dtype,e)}cast(e){return this.throwIfDisposed(),ll.cast(this,e)}variable(e=!0,t,n){return this.throwIfDisposed(),Pr().makeVariable(this,e,t,n)}};Object.defineProperty(ze,Symbol.hasInstance,{value:e=>!!e&&e.data!=null&&e.dataSync!=null&&e.throwIfDisposed!=null});function Z(){return Rf("Tensor",()=>ze)}Z();var Hu=class extends ze{constructor(e,t,n,r){super(e.shape,e.dtype,e.dataId,r);this.trainable=t,this.name=n}assign(e){if(e.dtype!==this.dtype)throw new Error( ` dtype of the new value ( $ { e . dtype } ) and previous value ( $ { this . dtype } ) must match ` );if(!oa(e.shape,this.shape))throw new Error( ` shape of the new value ( $ { e . shape } ) and previous value ( $ { this . shape } ) must match ` );Pr().disposeTensor(this),this.dataId=e.dataId,Pr().incRef(this,null)}dispose(){Pr().disposeVariable(this),this.isDisposedInternal=!0}};Object.defineProperty(Hu,Symbol.hasInstance,{value:e=>e instanceof ze&&e.assi
Manifest JSON has weights with names : $ { o . join ( ", " ) } . ` )}let l=a.reduce((p,f,m)=>(f&&p.push(m),p),[]),c=[];l.forEach(p=>{t[p].paths.forEach(f=>{let m=n+(n.endsWith("/")?"":"/")+f;c.push(m)})});let u=await e(c),h={},d=0;return l.forEach(p=>{let f=t[p].paths.length,m=0;for(let x=0;x<f;x++)m+=u[d+x].byteLength;let y=new ArrayBuffer(m),A=new Uint8Array(y),g=0;for(let x=0;x<f;x++){let v=new Uint8Array(u[d+x]);A.set(v,g),g+=v.byteLength}s[p].forEach(x=>{let v=y.slice(x.groupOffset,x.groupOffset+x.sizeBytes),w=fw(v,[x.manifestEntry]);for(let b in w)h[b]=w[b]}),d+=f}),h}}var IS="application/octet-stream",SS="application/json",Yf=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?(M(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,M(e!=null&&e.length>0,()=>"URL path for http must not be null, undefined or empty."),Array.isArray(e)&&M(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}],r={modelTopology:e.modelTopology,format:e.format,generatedBy:e.generatedBy,convertedBy:e.convertedBy,weightsManifest:n};e.signature!=null&&(r.signature=e.signature),e.userDefinedMetadata!=null&&(r.userDefinedMetadata=e.userDefinedMetadata),e.modelInitializer!=null&&(r.modelInitializer=e.modelInitializer),t.body.append("model.json",new Blob([JSON.stringify(r)],{type:SS}),"model.json"),e.weightData!=null&&t.body.append("model.weights.bin",new Blob([e.weightData],{type:IS}),"model.weights.bin");let a=await this.fetch(this.path,t);if(a.ok)return{modelArtifactsInfo:Ku(e),responses:[a]};throw new Error( ` BrowserHTTPRequest . save ( ) failed due to HTTP response status $ { a . 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(p){let f= ` Failed to parse model JSON of response from $ { this . path } . ` ;throw this.path.endsWith(".pb")?f+=" 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.":f+=" Please make sure the server is serving valid JSON for this request.",new Error(f)}let n=t.modelTopology,r=t.weightsManifest,a=t.generatedBy,s=t.convertedBy,i=t.format,o=t.signature,l=t.userDefinedMetadata;if(n==null&&r==null)throw new Error( ` The JSON from HTTP path $ { this . path } contains neither model topology or manifest for weights . ` );let c,u;r!=null&&([c,u]=await this.loadWeights(r));let h={modelTopology:n,weightSpecs:c,weightData:u,generatedBy:a,convertedBy:s,format:i};o!=null&&(h.signature=o),l!=null&&(h.userDefinedMetadata=l);let d=t.modelInitializer;return d&&(h.modelInitializer=d),h}async loadWeights(e){let t=Array.isArray(this.path)?this.path[1]:this.path,[n,r]=NS(t),a=this.weightPathPrefix||n,s=[];for(let c of e)s.push(...c.weights);let i=[],o=[];for(let c of e)for(let u of c.paths)this.weightUrlConverter!=null?o.push(this.weightUrlConverter(u)):i.push(a+u+r);this.weightUrlConverter&&i.push(...await Promise.all(o));let l=await Nw(i,{requestInit:this
Actual : $ { a } .
Expected : $ { s } . ` );for(let i=0;i<s.length;++i){let o=a[i],l=s[i];if(!n(o,l))throw new Error( ` Arrays differ : actual [ $ { i } ] = $ { o } , expected [ $ { i } ] = $ { l } .
Actual : $ { a } .
Expected : $ { s } . ` )}}function GS(e,t){e().then(()=>t.fail(),()=>t())}function qS(e,t){let n=typeof t=="string"||typeof t=="number"||typeof t=="boolean"?[t]:t;return Ta(e)||Ta(e[0])||Ta(t)||Ta(t[0])?am(e,n,(r,a)=>r==a):am(e,t,(r,a)=>sm(r,a,0))}function XS(e,t,n){if(n==null&&(n=rm()),!sm(e,t,n))throw new Error( ` Numbers differ : actual === $ { e } , expected === $ { t } ` )}function sm(e,t,n){return!isFinite(e)&&!isFinite(t)?!0:!(isNaN(e)||isNaN(t)||Math.abs(e-t)>n)}function KS(e,t,n){for(let r=0;r<e.length;r++)if(e[r]<t||e[r]>n)throw new Error( ` Value out of range : $ { e [ r ] } low : $ { t } , high : $ { n } ` )}function ZS(e,t){expect(new Float32Array(e)).toEqual(new Float32Array(t))}function qw(e){for(let t=0;t<e.length;t++){let n=e[t];Array.isArray(n)?qw(n):e[t]=Bu(n)}return e}var JS="3.4.0";function QS(){J().set("PROD",!0)}function eN(){J().set("DEBUG",!0)}function tN(){J().set("DEPRECATION_WARNINGS_ENABLED",!1),console.warn("TensorFlow.js deprecation warnings have been disabled.")}function im(e){J().getBool("DEPRECATION_WARNINGS_ENABLED")&&console.warn(e+" You can disable deprecation warnings with tf.disableDeprecationWarnings().")}SI(im);function nN(){ $ .disposeVariables()}function ua(){return $ }function bd(){return $ .memory()}function an(e){return $ .profile(e)}function z(e,t){return $ .tidy(e,t)}function _e(e){Df(e).forEach(t=>t.dispose())}function jt(e){return $ .keep(e)}function rN(e){return $ .time(e)}function aN(e){return $ .setBackend(e)}function sN(){return $ .ready()}function iN(){return $ .backendName}function oN(e){ $ .removeBackend(e)}function om(e){return $ .findBackend(e)}function lN(e){return $ .findBackendFactory(e)}function fl(e,t,n=1){return $ .registerBackend(e,t,n)}function Xw(){return $ .backend}function uN(e,t){J().setPlatform(e,t)}function cN(e,t){let n=R(e,"a","add"),r=R(t,"b","add");[n,r]=vt(n,r);let a={a:n,b:r};return $ .runKernel(Ca,a)}var se=D({add_:cN});function hN(e,t){let n=R(e,"a","floorDiv"),r=R(t,"b","floorDiv");[n,r]=vt(n,r);let a={a:n,b:r};return $ .runKernel(Ss,a)}var _d=D({floorDiv_:hN});function dN(e,t){let n=R(e,"a","div"),r=R(t,"b","div");if([n,r]=vt(n,r),n.dtype==="int32"&&r.dtype==="int32")return _d(n,r);let a={a:n,b:r},s={};return $ .runKernel(vs,a,s)}var me=D({div_:dN});function pN(e,t){let n=R(e,"a","mul"),r=R(t,"b","mul");[n,r]=vt(n,r);let a={a:n,b:r};return $ .runKernel(Ls,a)}var P=D({mul_:pN});function fN(e){let t=R(e,"x","abs");if(t.dtype==="complex64"){let n={x:t};return $ .runKernel(Su,n)}else{let n={x:t};return $ .runKernel(so,n)}}var Ot=D({abs_:fN});function mN(e){let t={x:R(e,"x","acos")};return $ .runKernel(io,t)}var lm=D({acos_:mN});function yN(e){let t={x:R(e,"x","acosh")};return $ .runKernel(oo,t)}var um=D({acosh_:yN});function AN(e){M(Array.isArray(e),()=>"The argument passed to tf.addN() must be a list of tensors"),M(e.length>=1,()=> ` Must pass at least one tensor to tf . addN ( ) , but got $ { e . length } ` );let t=e.map((a,s)=>R(a, ` tensors$ { s } ` ,"addN")),n=t[0];t.forEach(a=>{if(a.dtype!==n.dtype)throw new Error("All tensors passed to tf.addN() must have the same dtype")}),t.forEach(a=>{if(!oa(a.shape,n.shape))throw new Error("All tensors passed to tf.addN() must have the same shape")});let r=t;return $ .runKernel(ds,r)}var Pa=D({addN_:AN});function gN(e,t=null,n=!1){let r={x:R(e,"x","all","bool")},a={axis:t,keepDims:n};return $ .runKernel(lo,r,a)}var vd=D({all_:gN});function xN(e,t=null,n=!1){let r={x:R(e,"x","any","bool")},a={axis:t,keepDims:n};return $ .runKernel(uo,r,a)}var Zu=D({any_:xN});function wN(e,t=0){let n={x:R(e,"x","argMax")},r={axis:t};return $ .runKernel(ps,n,r)}var mi=D({argMax_:wN});function bN(e,t=0){let n={x:R(e,"x","argMin")},r={axis:t};return $ .runKernel(vu,n,r)}var cm=D({argMin_:bN});function _N(e){let t={x:R(e,"x","asin")};return $ .runKernel(co,t)}var hm=D({asin_:_N});function vN(e){let t={x:R(e,"x","asinh")};return $ .runKernel(ho,t)}var dm=D({asinh_:vN});function kN(e){let t={x:R(e,"x","atan")};return $ .runKernel(po,t)}var pm=D({atan_:kN});function IN(e,t){let n=R(e,"a","atan2"),r=R(t,"b","atan2");[n,r]=vt(n,r);let a={a:n,b:r};return $ .runKernel(mo,a)}var fm=D({atan2_:IN});function SN(e){let t={x:R
with dtype $ { s . dtype } . ` )}),n.length===1)return Wr(n[0]);let r=n,a={axis:t};return $ .runKernel(yo,r,a)}var rt=D({concat_:ON});function zN(e){let t={x:R(e,"x","sigmoid")};return $ .runKernel(Ys,t)}var On=D({sigmoid_:zN});function PN(e,t,n){let r=R(e,"x","slice","string_or_numeric");if(r.rank===0)throw new Error("Slicing scalar is not possible");let a={x:r},s={begin:t,size:n};return $ .runKernel(Zo,a,s)}var Ce=D({slice_:PN});function LN(e){let t={x:R(e,"x","tanh")};return $ .runKernel(ai,t)}var yl=D({tanh_:LN});function WN(e,t,n,r,a,s){let i=R(e,"forgetBias","basicLSTMCell"),o=R(t,"lstmKernel","basicLSTMCell"),l=R(n,"lstmBias","basicLSTMCell"),c=R(r,"data","basicLSTMCell"),u=R(a,"c","basicLSTMCell"),h=R(s,"h","basicLSTMCell"),d=rt([c,h],1),p=Ve(d,o),f=se(p,l),m=f.shape[0],y=f.shape[1]/4,A=[m,y],g=Ce(f,[0,0],A),x=Ce(f,[0,y],A),v=Ce(f,[0,y*2],A),w=Ce(f,[0,y*3],A),b=se(P(On(g),yl(x)),P(u,On(se(i,v)))),k=P(yl(b),On(w));return[b,k]}var BN=D({basicLSTMCell_:WN});function VN(e,t,n){let r=R(e,"x","batchToSpaceND"),a=t.reduce((o,l)=>o*l);M(r.rank>=1+t.length,()=> ` input rank is $ { r . rank } but should be > than blockShape . length $ { t . length } ` ),M(n.length===t.length,()=> ` crops . length is $ { n . length } but should be equal to blockShape . length $ { t . length } ` ),M(r.shape[0]%a==0,()=> ` input tensor batch is $ { r . shape [ 0 ] } but is not divisible by the product of the elements of blockShape $ { t . join ( " * " ) } === $ { a } ` );let s={x:r},i={blockShape:t,crops:n};return $ .runKernel(Iu,s,i)}var Qu=D({batchToSpaceND_:VN});function jN(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 UN(e,t,n,r,a,s){s==null&&(s=.001);let i=R(e,"x","batchNorm"),o=R(t,"mean","batchNorm"),l=R(n,"variance","batchNorm"),c;a!=null&&(c=R(a,"scale","batchNorm"));let u;r!=null&&(u=R(r,"offset","batchNorm")),M(o.rank===l.rank,()=>"Batch normalization gradient requires mean and variance to have equal ranks."),M(u==null||o.rank===u.rank,()=>"Batch normalization gradient requires mean and offset to have equal ranks."),M(c==null||o.rank===c.rank,()=>"Batch normalization gradient requires mean and scale to have equal ranks.");let h={x:jN(i),scale:c,offset:u,mean:o,variance:l},d={varianceEpsilon:s},p= $ .runKernel(Ns,h,d);return H(p,i.shape)}var Ai=D({batchNorm_:UN});function HN(e,t,n,r,a,s){let i=R(e,"x","batchNorm"),o=R(t,"mean","batchNorm"),l=R(n,"variance","batchNorm"),c;a!=null&&(c=R(a,"scale","batchNorm"));let u;return r!=null&&(u=R(r,"offset","batchNorm")),M(i.rank===2,()=> ` Error in batchNorm2D : x must be rank 2 but got rank $ { i . rank } . ` ),M(o.rank===2||o.rank===1,()=> ` Error in batchNorm2D : mean must be rank 2 or rank 1 but got rank $ { o . rank } . ` ),M(l.rank===2||l.rank===1,()=> ` Error in batchNorm2D : variance must be rank 2 or rank 1 but got rank $ { l . rank } . ` ),c!=null&&M(c.rank===2||c.rank===1,()=> ` Error in batchNorm2D : scale must be rank 2 or rank 1 but got rank $ { c . rank } . ` ),u!=null&&M(u.rank===2||u.rank===1,()=> ` Error in batchNorm2D : offset must be rank 2 or rank 1 but got rank $ { u . rank } . ` ),Ai(i,o,l,u,c,s)}var Jw=D({batchNorm2d_:HN});function GN(e,t,n,r,a,s){let i=R(e,"x","batchNorm"),o=R(t,"mean","batchNorm"),l=R(n,"variance","batchNorm"),c;a!=null&&(c=R(a,"scale","batchNorm"));let u;return r!=null&&(u=R(r,"offset","batchNorm")),M(i.rank===3,()=> ` Error in batchNorm3D : x must be rank 3 but got rank $ { i . rank } . ` ),M(o.rank===3||o.rank===1,()=> ` Error in batchNorm3D : mean must be rank 3 or rank 1 but got rank $ { o . rank } . ` ),M(l.rank===3||l.rank===1,()=> ` Error in batchNorm3D : variance must be rank 3 or rank 1 but got rank $ { l . rank } . ` ),c!=null&&M(c.rank===3||c.rank===1,()=> ` Error in batchNorm3D : scale must be rank 3 or rank 1 but got rank $ { c . rank } . ` ),u!=null&&M(u.rank===3||u.rank===1,()=> ` Error in batchNorm3D : offset must be rank 3 or rank 1 but got rank $ { u . rank } . ` ),Ai(i,o,l,u,c,s)}var Qw=D({batchNorm3d_:GN});function qN(e,t,n,r,a,s){let i=R(e,"x","batchNorm"),o=R(t,"mean","batchNorm"),l=R(n,"variance","batchNorm"),c;a!=null&&(c=R(a,"scale","batchNorm"));let u;return r!=
$ { a } and $ { t } for depthToSpace with input shape
$ { r . shape } ` ),M(s*t>=0,()=> ` Negative dimension size caused by overflow when multiplying
$ { s } and $ { t } for depthToSpace with input shape
$ { r . shape } ` ),M(i%(t*t)==0,()=> ` Dimension size must be evenly divisible by $ { t * t } but is $ { i } for depthToSpace with input shape $ { r . shape } ` );let o={x:r},l={blockSize:t,dataFormat:n};return $ .runKernel(xo,o,l)}var _m=D({depthToSpace_:pT});function fT(e,t,n,r,a="NHWC",s=[1,1],i){let o=R(e,"x","depthwiseConv2d"),l=R(t,"filter","depthwiseConv2d"),c=o,u=!1;o.rank===3&&(u=!0,c=H(o,[1,o.shape[0],o.shape[1],o.shape[2]])),M(c.rank===4,()=> ` Error in depthwiseConv2d : input must be rank 4 , but got rank $ { c . rank } . ` ),M(l.rank===4,()=> ` Error in depthwiseConv2d : filter must be rank 4 , but got rank $ { l . rank } . ` ),M(c.shape[3]===l.shape[2],()=> ` Error in depthwiseConv2d : number of input channels ( $ { c . shape [ 3 ] } ) must match the inChannels dimension in filter $ { l . shape [ 2 ] } . ` ),i!=null&&M(Vt(r),()=> ` Error in depthwiseConv2d : pad must be an integer when using , dimRoundingMode $ { i } but got pad $ { r } . ` );let h={x:c,filter:l},d={strides:n,pad:r,dataFormat:a,dilations:s,dimRoundingMode:i},p= $ .runKernel(_s,h,d);return u?H(p,[p.shape[1],p.shape[2],p.shape[3]]):p}var xl=D({depthwiseConv2d_:fT});function mT(e){let t={x:R(e,"x","diag")};return $ .runKernel(Hh,t)}var yT=D({diag_:mT});function AT(e,t,n,r,a=[1,1],s="NHWC"){let i=R(e,"x","dilation2d"),o=R(t,"filter","dilation2d");M(i.rank===3||i.rank===4,()=> ` Error in dilation2d : input must be rank 3 or 4 , but got rank $ { i . rank } . ` ),M(o.rank===3,()=> ` Error in dilation2d : filter must be rank 3 , but got rank $ { o . rank } . ` ),M(s==="NHWC",()=> ` Error in dilation2d : Only NHWC is currently supported , but got dataFormat of $ { s } ` );let l=i,c=!1;i.rank===3&&(l=H(i,[1,i.shape[0],i.shape[1],i.shape[2]]),c=!0);let u={x:l,filter:o},h={strides:n,pad:r,dilations:a},d= $ .runKernel(Tu,u,h);return c?H(d,[d.shape[1],d.shape[2],d.shape[3]]):d}var vm=D({dilation2d_:AT});function gT(e,t){let n=e.length,r=[];for(let a=0;a<n;a++){let s=n-1-a,i=e[s]||1;(t[t.length-1-a]||1)>1&&i===1&&r.unshift(s)}return r}function zt(e,t){let n=[];for(let r=0;r<t.length;r++){let a=e[e.length-r-1],s=t.length-r-1,i=t[s];(a==null||a===1&&i>1)&&n.unshift(s)}return n}function ft(e,t){let n=[],r=Math.max(e.length,t.length);for(let a=0;a<r;a++){let s=e[e.length-a-1];s==null&&(s=1);let i=t[t.length-a-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 xT(e,t){let n=R(e,"a","equal"),r=R(t,"b","equal");[n,r]=vt(n,r),ft(n.shape,r.shape);let a={a:n,b:r};return $ .runKernel(_o,a)}var Wa=D({equal_:xT});function wT(e,t,n){let r=R(t,"a","where"),a=R(n,"b","where"),s=R(e,"condition","where","bool"),i=ft(ft(s.shape,r.shape),a.shape),o=Al(s,i),l=Al(r,i),c=Al(a,i),u={condition:o,t:l,e:c};return $ .runKernel(Xo,u)}var En=D({where_:wT});function bT(e){let t={x:R(e,"x","zerosLike")};return $ .runKernel(al,t)}var He=D({zerosLike_:bT});function _T(e,t){let n=R(e,"a","div"),r=R(t,"b","div");[n,r]=vt(n,r);let a=me(n,r),s=He(a),i=Wa(r,s);return En(i,s,a)}var km=D({divNoNan_:_T});function vT(e,t){let n=R(e,"t1","dot"),r=R(t,"t2","dot");M((n.rank===1||n.rank===2)&&(r.rank===1||r.rank===2),()=> ` Error in dot : inputs must all be rank 1 or 2 , but got ranks $ { n . rank } and $ { r . rank } . ` );let a=n.rank===1?n.size:n.shape[1],s=r.rank===1?r.size:r.shape[0];if(M(a===s,()=> ` Error in dot : inner dimensions of inputs must match , but got $ { a } and $ { s } . ` ),n.rank===1&&r.rank===1){let i=H(n,[1,-1]),o=H(r,[-1,1]),l=Ve(i,o);return H(l,[])}else if(n.rank===1&&r.rank===2){let i=H(n,[1,-1]),o=H(r,[r.shape[0],r.shape[1]]),l=Ve(i,o);return H(l,[l.size])}else if(n.rank===2&&r.rank===1){let i=H(r,[-1,1]),o=Ve(n,i);return H(o,[o.size])}else{let i=H(r,[r.shape[0],r.shape[1]]);return Ve(n,i)}}var lb=D({dot_:vT});function kT(e,...t){let n=t.map((a,s)=>R(a, ` tensors$ { s } ` ,"einsum")),r={equation:e};return $ .runKernel(Xh,n,r)}var ub=D({einsum_:kT});function IT(e){let t={x:R(e,"x","elu")};return $ .runKernel(wo,t)}var wl=D({elu_:IT});function ST(e){let t=R(e,"x","erf");M(t.dtype==="int32"||t.dtype==="float32",()=>"Input dtype must be ` int32 ` or ` float32 ` ."),t.dtype==="int32
rank $ { s . rank } . ` ),M(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},c={depthRadius:t,bias:n,alpha:r,beta:a},u= $ .runKernel(Mu,l,c);return o?H(u,[u.shape[1],u.shape[2],u.shape[3]]):u}var Em=D({localResponseNormalization_:jT});function UT(e){let t={x:R(e,"x","log")};return $ .runKernel(Rs,t)}var zn=D({log_:UT});function HT(e){let t={x:R(e,"x","log1p")};return $ .runKernel( $ o,t)}var Rd=D({log1p_:HT});function GT(e){return M(Ea(e),()=>"The f passed in grad(f) must be a function"),(t,n)=>{let r=R(t,"x","tf.grad","string_or_numeric"),a=n!=null?R(n,"dy","tf.grad"):null;return $ .tidy(()=>{let{value:s,grads:i}= $ .gradients(()=>e(r),[r],a);return a!=null&&ln(s.shape,a.shape,"The shape of dy passed in grad(f)(x, dy) must match the shape returned by f(x)"),Md(i),i[0]})}}function qT(e){return M(Ea(e),()=>"The f passed in grads(f) must be a function"),(t,n)=>{M(Array.isArray(t),()=>"The args passed in grads(f)(args) must be an array of ` Tensor ` s or ` TensorLike ` s");let r=Xu(t,"args","tf.grads","string_or_numeric"),a=n!=null?R(n,"dy","tf.grads"):null;return $ .tidy(()=>{let{value:s,grads:i}= $ .gradients(()=>e(...r),r,a);return a!=null&&ln(s.shape,a.shape,"The shape of dy passed in grads(f)([x1,...], dy) must match the shape returned by f([x1,...])"),Md(i),i})}}function XT(e){return M(Ea(e),()=>"The f passed in valueAndGrad(f) must be a function"),(t,n)=>{M(t instanceof ze,()=>"The x passed in valueAndGrad(f)(x) must be a tensor"),M(n==null||n instanceof ze,()=>"The dy passed in valueAndGrad(f)(x, dy) must be a tensor");let{grads:r,value:a}= $ .gradients(()=>e(t),[t],n);return Md(r),{grad:r[0],value:a}}}function KT(e){return M(Ea(e),()=>"The f passed in valueAndGrads(f) must be a function"),(t,n)=>{M(Array.isArray(t)&&t.every(a=>a instanceof ze),()=>"The args passed in valueAndGrads(f)(args) must be array of tensors"),M(n==null||n instanceof ze,()=>"The dy passed in valueAndGrads(f)(args, dy) must be a tensor");let r= $ .gradients(()=>e(...t),t,n);return n!=null&&ln(r.value.shape,n.shape,"The shape of dy passed in valueAndGrads(f)([x1,...], dy) must match the shape returned by f([x1,...])"),Md(r.grads),r}}function pb(e,t){M(Ea(e),()=>"The f passed in variableGrads(f) must be a function"),M(t==null||Array.isArray(t)&&t.every(c=>c instanceof Hu),()=>"The varList passed in variableGrads(f, varList) must be an array of variables");let n=t!=null;if(!n){t=[];for(let c in $ .registeredVariables)t.push( $ .registeredVariables[c])}let r=n?t.filter(c=>!c.trainable):null,a=t.length;t=t.filter(c=>c.trainable),M(t.length>0,()=> ` variableGrads ( ) expects at least one of the input variables to be trainable , but none of the $ { a } variables is trainable . ` );let s=!0,{value:i,grads:o}= $ .gradients(e,t,null,s);M(o.some(c=>c!=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()."),M(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((c,u)=>{o[u]!=null&&(l[c.name]=o[u])}),r!=null&&r.forEach(c=>l[c.name]=null),{value:i,grads:l}}function Vr(e){return $ .customGrad(e)}function Md(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 ZT(e){let t={x:R(e,"x","neg")};return $ .runKernel(zo,t)}var kt=D({neg_:ZT});function YT(e){let t={x:R(e,"x","softplus")};return $ .runKernel(Qo,t)}var _l=D({softplus_:YT});function JT(e){let t=R(e,"x","logSigmoid");return Vr(n=>({value:kt(_l(kt(n))),gradFunc:r=>P(r,On(kt(n)))}))(t)}var fb=D({logSigmoid_:JT});function QT(e,t=null,n=!1){let r={x:R(e,"x","max")},a={reductionIndices:t,keepDims:n};return $ .runKernel(Ms,r,a)}var Cn=D({max_:QT});function eE(e,t){let n=R(e,"a","sub"),r=R(t,"b","sub");[n,r]=vt(n,r);let a={a:n,b:r};return $ .runKernel(ni,a)}var ye=D({sub_:eE});function tE(e,t=null,n=!1){let r=R(e,"x","sum");r.dtype==="bool"&&(r=ge(r,"int32"));let a={x:r},s={axis:t,keepDims:n};return $ .runKernel(Qs,a,s)}var Te=D({sum_:tE});function nE(e,t=-1){let n=R(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 Vr((r,a)=>{let s=!0,i=Cn(r,t,!0),o=ye(r,i),l=ye(ge(o,"float32"),zn(Te(tr(o),t,s)));return a([l]),{value:l,gradFunc:(c,u)=>{let[h]=u,d=!0,p=tr(h);return ye(c,P(Te(c,t,d),p))}}})(n)}var Fd=D({logSoftmax_:nE});function Cm(e,t){for(let n=0;n<e.length;++n)if(e[e.length-n-1]!==t-1-n)return!1;return!0}function mb(e,t,n){let r=e.length+t.length,a=[],s=0,i=0;for(let o=0;o<r;o++)n.indexOf(o)===-1?a.push(e[s++]):a.push(t[i++]);return a}function yb(e,t){let n=[],r=e.length;for(let s=0;s<r;s++)t.indexOf(s)===-1&&n.push(e[s]);let a=t.map(s=>e[s]);return[n,a]}function wi(e,t){let n=t.map(r=>1);return mb(e,n,t)}function rE(e,t,n){M(Cm(t,n),()=> ` $ { e } supports only inner - most axes for now . Got axes $ { t } and rank - $ { n } input . ` )}function Ab(e,t){if(Cm(e,t))return null;let n=[];for(let r=0;r<t;++r)e.indexOf(r)===-1&&n.push(r);return e.forEach(r=>n.push(r)),n}function Rm(e){return e.map((t,n)=>[n,t]).sort((t,n)=>t[1]-n[1]).map(t=>t[0])}function aE(e,t){let n=[];for(let r=t-e;r<t;++r)n.push(r);return n}function sE(e,t=null,n=!1){let r=R(e,"x","logSumExp"),a=hr(t,r.shape),s=Cn(r,a,!0),i=ye(r,s),o=tr(i),l=Te(o,a),c=zn(l),u=se(H(s,c.shape),c);if(n){let h=wi(u.shape,a);return H(u,h)}return u}var Mm=D({logSumExp_:sE});function iE(e,t){let n=R(e,"a","logicalAnd","bool"),r=R(t,"b","logicalAnd","bool");ft(n.shape,r.shape);let a={a:n,b:r};return $ .runKernel(Do,a)}var fr=D({logicalAnd_:iE});function oE(e){let t={x:R(e,"x","logicalNot","bool")};return $ .runKernel(Cu,t)}var rc=D({logicalNot_:oE});function lE(e,t){let n=R(e,"a","logicalOr","bool"),r=R(t,"b","logicalOr","bool");ft(n.shape,r.shape);let a={a:n,b:r};return $ .runKernel(Ru,a)}var $ d=D({logicalOr_:lE});function uE(e,t){let n=R(e,"a","logicalXor","bool"),r=R(t,"b","logicalXor","bool");return ft(n.shape,r.shape),fr( $ d(e,t),rc(fr(e,t)))}var gb=D({logicalXor_:uE});function cE(e,t,n,r,a){let s=R(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]])),M(o.rank===4,()=> ` Error in maxPool : input must be rank 4 but got rank $ { o . rank } . ` ),M(Br(n,i),()=> ` Error in maxPool : Either strides or dilations must be 1. Got strides $ { n } and dilations '${i}' ` ),a!=null&&M(Vt(r),()=> ` Error in maxPool : pad must be an integer when using , dimRoundingMode $ { a } but got pad $ { r } . ` );let c={x:o},u={filterSize:t,strides:n,pad:r,dimRoundingMode:a},h= $ .runKernel( $ s,c,u);return l?H(h,[h.shape[1],h.shape[2],h.shape[3]]):h}var ac=D({maxPool_:cE});function hE(e,t=[1,1,1],n,r,a,s="NDHWC"){let i=R(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]])),M(o.rank===5,()=> ` Error in maxPool3d : x must be rank 5 but got rank $ { o . rank } . ` ),M(s==="NDHWC",()=> ` Error in maxPool3d : Only NDHWC is currently supported , but got dataFormat of $ { s } ` ),a!=null&&M(Vt(r),()=> ` Error in maxPool3d : pad must be an integer when using , dimRoundingMode $ { a } but got pad $ { r } . ` );let c={x:o},u={filterSize:t,strides:n,pad:r,dimRoundingMode:a,dataFormat:s},h= $ .runKernel(Fu,c,u);return l?H(h,[h.shape[1],h.shape[2],h.shape[3],h.shape[4]]):h}var Fm=D({maxPool3d_:hE});function dE(e
$ { s } ) . ` );if(n<r)throw new Error( ` batchDims ( $ { r } ) must be less than or equal to axis ( $ { n } ) . ` );for(let h=0;h<r;++h)if(e.shape[h]!==t.shape[h])throw new Error( ` x . shape [ $ { h } ] : $ { e . shape [ h ] } should be equal to indices . shape [ $ { h } ] : $ { t . shape [ h ] } . ` );let i=e.shape[n],o=[],l=1,c=1,u=1;for(let h=0;h<r;++h)o.push(e.shape[h]),l*=e.shape[h];for(let h=r;h<n;h++)o.push(e.shape[h]),c*=e.shape[h];for(let h=r;h<a;h++)o.push(t.shape[h]);for(let h=n+1;h<s;h++)o.push(e.shape[h]),u*=e.shape[h];return{batchSize:l,sliceSize:u,outerSize:c,dimSize:i,outputShape:o}}function eF(e){try{return e.map(t=>fd(t))}catch(t){throw new Error( ` Failed to decode encoded string bytes into utf - 8 , error : $ { t } ` )}}function tF(e){return e.map(t=>Bu(t))}var Hr={};Me(Hr,{nonMaxSuppressionV3Impl:()=>Db,nonMaxSuppressionV4Impl:()=>Ob,nonMaxSuppressionV5Impl:()=>zb,whereImpl:()=>Ib});function ve(e,t){Array.isArray(e)||(e=[e]),e.forEach(n=>{n!=null&&_.assert(n.dtype!=="complex64",()=> ` $ { t } does not support complex64 tensors in the CPU backend . ` )})}var oF=Hr.whereImpl,op=class extends wu{constructor(){super();this.blockSize=48,this.firstUse=!0,this.data=new Rh(this,ua())}nextDataId(){return op.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 r={id:this.nextDataId()};return this.data.set(r,{values:e,dtype:n,refCount:1}),r}makeTensorInfo(e,t,n){let r;if(t==="string"&&n!=null&&n.length>0&&_.isString(n[0])){let a=n.map(s=>_.encodeString(s));r=this.write(a,e,t)}else r=this.write(n,e,t);return{dataId:r,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,r,a){this.data.set(e,{values:t,dtype:r,refCount:a})}numDataIds(){return this.data.numDataIds()}async read(e){return this.readSync(e)}readSync(e){let{dtype:t,complexTensorInfos:n}=this.data.get(e);if(t==="complex64"){let r=this.readSync(n.real.dataId),a=this.readSync(n.imag.dataId);return C.mergeRealAndImagArrays(r,a)}return this.data.get(e).values}bufferSync(e){let t=this.readSync(e.dataId),n=t;if(e.dtype==="string")try{n=t.map(r=>_.decodeString(r))}catch(r){throw new Error("Failed to decode encoded string bytes into utf-8")}return Be(e.shape,e.dtype,n)}makeOutput(e,t,n){let r=this.write(e,t,n);return ua().makeTensorFromDataId(r,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=_.now();return e(),{kernelMs:_.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 oF(e.shape,t)}dispose(){}floatPrecision(){return 32}epsilon(){return super.epsilon()}};op.nextDataId=0;var ey={};Me(ey,{addImpl:()=>Kb,bincountImpl:()=>ty,bincountReduceImpl:()=>Zb,ceilImpl:()=>Yb,concatImpl:()=>ny,expImpl:()=>Jb,expm1Impl:()=>Qb,floorImpl:()=>e_,gatherV2Impl:()=>t_,greaterImpl:()=>n_,lessImpl:()=>r_,linSpaceImpl:()=>a_,logImpl:()=>s_,maxImpl:()=>i_,maximumImpl:()=>o_,minimumImpl:()=>l_,multiplyImpl:()=>ry,negImpl:()=>u_,notEqualImpl:()=>c_,prodImpl:()=>h_,rangeImpl:()=>sy,rsqrtImpl:()=>d_,simpleAbsImpl:()=>Xb,sliceImpl:()=>lp,squaredDifferenceImpl:()=>p_,stridedSliceImpl:()=>f_,subImpl:()=>m_,tileImpl:()=>y_,topKImpl:()=>A_,transposeImpl:()=>ay,uniqueImpl:()=>g_});function Xb(e){let t=new Float32Array(e.length);for(let n=0;n<e.length;++n)t[n]=Math.abs(e[n]);return t}var lF=e=>{let{x:t}=e.inputs,n=e.backend;ve(t,"abs");let r=new Float32Array(_.sizeFromShape(t.shape)),a=n.data.get(t.dataId).values;return r=Xb(a),n.makeOutput(r,t.shape,"float32")},uF={kernelName:so,backendName:"cpu",kernelFunc:lF};function Mt(e){return(t,n,r,a,s)=>{let i=C.assertAndGetBroadcastShape(t,n),o=i.length,l=_.computeStrides(i),c=_.sizeFromShape(i),u=_.getTypedArrayFromDType(s,c),h=t.length,d=n.length,p=_.computeStrides(t),f=_.computeStrides(n),m=C.getBroadcastDims(t,i),y=C.getBroadcastDims(n,i);if(m.length+y.length===0)for(let A=0;A<u.length;++A)u[A]=e(r[A%r.length],a[A%a.length]);else for(let A=0;A<u.length;++A){let g=_.indexToLoc(A,o,l),x=g.slice(-h);m.forEach(k=>x[k]=0);let v=_.locToIndex(x,h,p),w=g.slice(-d);y.forEach(k=>w[k]=0);let b=_.locToIndex(w,d,f);u[A]=e(r[v],a[b])}return[u,i]}}function Bn(e){let{inputs:t,backend:n}=e,{real:r,imag:a}=t,s=n.data.get(r.dataId).values,i=n.data.get(a.dataId).values,o=n.makeTensorInfo(r.shape,"complex64"),l=n.data.get(o.dataId);return l.complexTensorInfos={real:n.makeTensorInfo(r.shape,"float32",s),imag:n.makeTensorInfo(a.shape,"float32",i)},o}var cF={kernelName:Ph,backendName:"cpu",kernelFunc:Bn};function up(e,t,n="float32"){if(n==="complex64"){let a=up(e,t,"float32"),s=up(e,t,"float32");return Bn({inputs:{real:a,imag:s},backend:e})}let r=_.makeZerosTypedArray(_.sizeFromShape(t),n);return e.makeTensorInfo(t,n,r)}function Gr(e){let{inputs:t,backend:n}=e,{x:r}=t;return n.incRef(r.dataId),{dataId:r.dataId,shape:r.shape,dtype:r.dtype}}var hF={kernelName:Es,backendName:"cp
` ),s=a.length.toString().length+2,i=a.map((h,d)=>_.rightPad((d+1).toString(),s)+h),o=0;for(let h=0;h<i.length;h++)o=Math.max(i[h].length,o);let l=i.slice(0,r-1),c=i.slice(r-1,r),u=i.slice(r);console.log(l.join( `
` )),console.log(t.split( `
` )[0]),console.log( ` % c $ { _ . rightPad ( c [ 0 ] , o ) } ` ,"border:1px solid red; background-color:#e3d2d2; color:#a61717"),console.log(u.join( `
` ))}function G_(e){return ma(e,()=>e.createProgram(),"Unable to create WebGLProgram.")}function q_(e,t){if(we(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 pp(e,t){if(we(e,()=>e.validateProgram(t)),e.getProgramParameter(t,e.VALIDATE_STATUS)===!1)throw console.log(e.getProgramInfoLog(t)),new Error("Shader program validation failed.")}function X_(e,t){let n=ma(e,()=>e.createBuffer(),"Unable to create WebGLBuffer");return we(e,()=>e.bindBuffer(e.ARRAY_BUFFER,n)),we(e,()=>e.bufferData(e.ARRAY_BUFFER,t,e.STATIC_DRAW)),n}function K_(e,t){let n=ma(e,()=>e.createBuffer(),"Unable to create WebGLBuffer");return we(e,()=>e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,n)),we(e,()=>e.bufferData(e.ELEMENT_ARRAY_BUFFER,t,e.STATIC_DRAW)),n}function XP(){return J().getNumber("WEBGL_VERSION")===2?1:4}function Z_(e){return ma(e,()=>e.createTexture(),"Unable to create WebGLTexture.")}function Y_(e,t){let n=J().getNumber("WEBGL_MAX_TEXTURE_SIZE");if(e<=0||t<=0){let r= ` [ $ { e } x$ { t } ] ` ;throw new Error("Requested texture size "+r+" is invalid.")}if(e>n||t>n){let r= ` [ $ { e } x$ { t } ] ` ,a= ` [ $ { n } x$ { n } ] ` ;throw new Error("Requested texture size "+r+" greater than WebGL maximum on this browser / GPU "+a+".")}}function J_(e){return ma(e,()=>e.createFramebuffer(),"Unable to create WebGLFramebuffer.")}function fy(e,t,n,r,a,s,i){let o=e.getAttribLocation(t,n);return o===-1?!1:(we(e,()=>e.bindBuffer(e.ARRAY_BUFFER,r)),we(e,()=>e.vertexAttribPointer(o,a,e.FLOAT,!1,s,i)),we(e,()=>e.enableVertexAttribArray(o)),!0)}function Q_(e,t,n){h3(e,n),we(e,()=>e.activeTexture(e.TEXTURE0+n)),we(e,()=>e.bindTexture(e.TEXTURE_2D,t))}function KP(e,t){h3(e,t),we(e,()=>e.activeTexture(e.TEXTURE0+t)),we(e,()=>e.bindTexture(e.TEXTURE_2D,null))}function e3(e,t,n){return ma(e,()=>e.getUniformLocation(t,n),'uniform "'+n+'" not present in program.')}function t3(e,t,n){return e.getUniformLocation(t,n)}function n3(e,t,n,r){we(e,()=>Q_(e,t,r)),we(e,()=>e.uniform1i(n,r))}function ZP(e){we(e,()=>e.bindFramebuffer(e.FRAMEBUFFER,null)),we(e,()=>e.viewport(0,0,e.canvas.width,e.canvas.height)),we(e,()=>e.scissor(0,0,e.canvas.width,e.canvas.height))}function fp(e,t,n){we(e,()=>e.bindFramebuffer(e.FRAMEBUFFER,n)),we(e,()=>e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,t,0))}function my(e,t){we(e,()=>e.bindFramebuffer(e.FRAMEBUFFER,t)),we(e,()=>e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,null,0))}function Ac(e){let t=e.checkFramebufferStatus(e.FRAMEBUFFER);if(t!==e.FRAMEBUFFER_COMPLETE)throw new Error("Error binding framebuffer: "+r3(e,t))}function r3(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 ma(e,t,n){let r=we(e,()=>t());if(r==null)throw new Error(n);return r}function h3(e,t){let n=e.MAX_COMBINED_TEXTURE_IMAGE_UNITS-1,r=t+e.TEXTURE0;if(r<e.TEXTURE0||r>n){let a= ` [ gl . TEXTURE0 , gl . TEXTURE$ { n } ] ` ;throw new Error( ` textureUnit must be in $ { a } . ` )}}function Si(e,t=2){return _.sizeFromShape(e.slice(0,e.length-t))}function Ni(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 mp(e){let t=[1,1,1];return e.length===0||e.length===1&&e[0]===1||(t=[Si(e),...Ni(e)]),t}function a3(e,t=!1){let n=J().getNumber("WEBGL_MAX_TEXTURE_SIZE");t&&(n=n*2,e=e.map((a,s)=>s>=e.length-2?_.nearestLargerEven(e[s]):e[s]),e.length===1&&(e=[2,e[0]])),e.length!==2&&(e=_.squeezeShape(e).newShape);let r=_.sizeFromShape(e);if(e.length<=1&&r<=n)return[1,r];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-23 20:25:43 +01:00
}
2021-03-30 15:03:18 +02:00
2021-04-17 00:03:15 +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-03-27 20:43:48 +01:00
}
2021-04-17 00:03:15 +02:00
# define isnan ( value ) isnan _custom ( value )
` ,l="",c= `
# define round ( value ) newRound ( value )
int newRound ( float value ) {
return int ( floor ( value + 0.5 ) ) ;
2021-03-27 20:43:48 +01:00
}
2021-04-17 00:03:15 +02:00
ivec4 newRound ( vec4 value ) {
return ivec4 ( floor ( value + vec4 ( 0.5 ) ) ) ;
2021-03-29 21:01:16 +02:00
}
2021-04-17 00:03:15 +02:00
` ):(e="",t="attribute",n="varying",r="varying",a="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-15 21:01:27 +02:00
}
2021-04-17 00:03:15 +02:00
bvec4 isnan _custom ( vec4 val ) {
return bvec4 ( isnan ( val . x ) , isnan ( val . y ) , isnan ( val . z ) , isnan ( val . w ) ) ;
2021-03-29 21:01:16 +02:00
}
2021-04-17 00:03:15 +02:00
` ,l= `
uniform float INFINITY ;
bool isinf ( float val ) {
return abs ( val ) == INFINITY ;
2021-03-29 21:01:16 +02:00
}
2021-04-17 00:03:15 +02:00
bvec4 isinf ( vec4 val ) {
return equal ( abs ( val ) , vec4 ( INFINITY ) ) ;
2021-03-29 21:01:16 +02:00
}
2021-04-17 00:03:15 +02:00
` ,c= `
int round ( float value ) {
return int ( floor ( value + 0.5 ) ) ;
2021-03-29 21:01:16 +02:00
}
2021-04-17 00:03:15 +02:00
ivec4 round ( vec4 value ) {
return ivec4 ( floor ( value + vec4 ( 0.5 ) ) ) ;
2021-03-29 21:01:16 +02:00
}
2021-04-17 00:03:15 +02:00
` ),{version:e,attribute:t,varyingVs:n,varyingFs:r,texture2D:a,output:s,defineOutput:i,defineSpecialNaN:o,defineSpecialInf:l,defineRound:c}}function Ei(e,t,n="index"){let r=_.computeStrides(t);return r.map((a,s)=>{let i= ` int $ { e [ s ] } = $ { n } / $ { a } ` ,o=s===r.length-1? ` int $ { e [ s + 1 ] } = $ { n } - $ { e [ s ] } * $ { a } ` : ` index -= $ { e [ s ] } * $ { a } ` ;return ` $ { i } ; $ { o } ; ` }).join("")}function wy(e){let t=_.computeStrides(e).map(n=>n.toString());return `
int getFlatIndex ( ivec3 coords ) {
return coords . x * $ { t [ 0 ] } + coords . y * $ { t [ 1 ] } + coords . z ;
}
` }var d3= `
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 ;
}
` ,uL=class{constructor(e){this.variableNames=["A"],this.packedInputs=!1,this.packedOutput=!0,this.outPackingScheme=xc.DENSE;let t=bc(e),n=dn();this.outputShape=e,this.userCode= `
ivec3 outCoordsFromFlatIndex ( int index ) {
$ { Ei ( [ "r" , "c" , "d" ] , e ) }
return ivec3 ( r , c , d ) ;
2021-04-15 21:01:27 +02:00
}
2021-04-17 00:03:15 +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-15 21:01:27 +02:00
}
2021-04-17 00:03:15 +02:00
$ { n . output } = result ;
2021-04-15 21:01:27 +02:00
}
2021-04-17 00:03:15 +02:00
` }},cL=class{constructor(e){this.variableNames=["A"],this.packedInputs=!0,this.packedOutput=!0,this.outPackingScheme=xc.DENSE;let t=bc(e),n=dn();this.outputShape=e,this.userCode= `
ivec3 outCoordsFromFlatIndex ( int index ) {
$ { Ei ( [ "r" , "c" , "d" ] , e ) }
return ivec3 ( r , c , d ) ;
2021-04-15 21:01:27 +02:00
}
2021-04-17 00:03:15 +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-15 21:01:27 +02:00
}
2021-04-17 00:03:15 +02:00
$ { n . output } = result ;
2021-04-15 21:01:27 +02:00
}
2021-04-17 00:03:15 +02:00
` }},hL=class{constructor(e){this.variableNames=["A"],this.outTexUsage=ar.DOWNLOAD;let t=dn();this.outputShape=e,this.userCode= `
$ { d3 }
void main ( ) {
float x = getAAtOutCoords ( ) ;
$ { t . output } = encode _float ( x ) ;
2021-04-15 21:01:27 +02:00
}
2021-04-17 00:03:15 +02:00
` }},dL=class{constructor(e){this.variableNames=["A"],this.packedInputs=!0,this.packedOutput=!1,this.outTexUsage=ar.DOWNLOAD;let t=dn();this.outputShape=e,this.userCode= `
$ { d3 }
void main ( ) {
ivec3 coords = getOutputCoords ( ) ;
float x = getChannel ( getAAtOutCoords ( ) , vec2 ( coords . y , coords . z ) ) ;
$ { t . output } = encode _float ( x ) ;
2021-04-15 21:01:27 +02:00
}
2021-04-17 00:03:15 +02:00
` }},pL=class{constructor(e,t,n=!1){this.variableNames=["A"];let r=dn(),[a,s]=t;this.outputShape=e;let i="result";n&&(i="floor(result * 255. + 0.5)"),this.userCode= `
$ { wy ( 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 , $ { a } . 0 ) ;
vec4 values = $ { r . 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-17 00:03:15 +02:00
result = values [ 3 ] ;
2021-04-15 21:01:27 +02:00
}
2021-04-17 00:03:15 +02:00
$ { r . output } = vec4 ( $ { i } , 0. , 0. , 0. ) ;
2021-03-30 15:03:18 +02:00
}
2021-04-17 00:03:15 +02:00
` }},fL=class{constructor(e,t,n=!1){this.variableNames=["A"],this.packedInputs=!1,this.packedOutput=!0;let r=dn(),[a,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 c=0;c<=1;c++){let u=l*2+c;i+= `
localCoords = coords ;
if ( localCoords [ 2 ] + $ { c } < $ { e [ 2 ] } ) {
localCoords [ 2 ] += $ { c } ;
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 , $ { a } . 0 ) ;
values = $ { r . 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-15 21:01:27 +02:00
} else {
2021-04-17 00:03:15 +02:00
result [ $ { u } ] = values [ 3 ] ;
2021-04-15 21:01:27 +02:00
}
}
}
2021-04-17 00:03:15 +02:00
` }this.userCode= `
$ { wy ( e ) }
void main ( ) {
ivec3 coords = getOutputCoords ( ) ;
vec4 result = vec4 ( 0. ) ;
int flatIndex , r , c , offset ;
ivec3 localCoords ;
vec2 uv ;
vec4 values ;
$ { i }
$ { r . output } = $ { o } ;
}
` }},p3={};Me(p3,{bindVertexProgramAttributeStreams:()=>_3,createBufferFromOutputTexture:()=>I3,createFloat16MatrixTexture:()=>g3,createFloat16PackedMatrixTexture:()=>b3,createFloat32MatrixTexture:()=>A3,createIndexBuffer:()=>y3,createPackedMatrixTexture:()=>w3,createUnsignedBytesMatrixTexture:()=>x3,createVertexBuffer:()=>m3,createVertexShader:()=>f3,downloadByteEncodedFloatMatrixFromOutputTexture:()=>N3,downloadFloat32MatrixFromBuffer:()=>S3,downloadMatrixFromPackedOutputTexture:()=>E3,downloadPackedMatrixFromBuffer:()=>T3,getInternalFormatForFloat16MatrixTexture:()=>_y,getInternalFormatForFloat16PackedMatrixTexture:()=>Iy,getInternalFormatForFloat32MatrixTexture:()=>by,getInternalFormatForPackedMatrixTexture:()=>ky,getInternalFormatForUnsignedBytesMatrixTexture:()=>vy,uploadDenseMatrixToTexture:()=>v3,uploadPixelDataToTexture:()=>k3});function f3(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 U_(e,n)}function m3(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 X_(e,t)}function y3(e){let t=new Uint16Array([0,1,2,2,1,3]);return K_(e,t)}function _c(e,t,n,r,a,s){Y_(t,n);let i=Z_(e),o=e.TEXTURE_2D;return we(e,()=>e.bindTexture(o,i)),we(e,()=>e.texParameteri(o,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE)),we(e,()=>e.texParameteri(o,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE)),we(e,()=>e.texParameteri(o,e.TEXTURE_MIN_FILTER,e.NEAREST)),we(e,()=>e.texParameteri(o,e.TEXTURE_MAG_FILTER,e.NEAREST)),we(e,()=>e.texImage2D(o,0,r,t,n,0,a,s,null)),we(e,()=>e.bindTexture(e.TEXTURE_2D,null)),i}function by(e){return e.internalFormatFloat}function A3(e,t,n,r){let[a,s]=wc(t,n);return _c(e,a,s,by(r),r.textureFormatFloat,e.FLOAT)}function _y(e){return e.internalFormatHalfFloat}function g3(e,t,n,r){let[a,s]=wc(t,n);return _c(e,a,s,_y(r),r.textureFormatFloat,r.textureTypeHalfFloat)}function vy(e){return e.downloadTextureFormat}function x3(e,t,n,r){let[a,s]=wc(t,n);return _c(e,a,s,vy(r),e.RGBA,e.UNSIGNED_BYTE)}function ky(e){return e.internalFormatPackedFloat}function w3(e,t,n,r){let[a,s]= $ l(t,n);return _c(e,a,s,ky(r),e.RGBA,e.FLOAT)}function Iy(e){return e.internalFormatPackedHalfFloat}function b3(e,t,n,r){let[a,s]= $ l(t,n);return _c(e,a,s,Iy(r),e.RGBA,r.textureTypeHalfFloat)}function _3(e,t,n){let r=0,a=3*4,s=3*4+2*4;return we(e,()=>e.bindBuffer(e.ARRAY_BUFFER,n)),fy(e,t,"clipSpacePos",n,3,s,r)&&fy(e,t,"uv",n,2,s,a)}function v3(e,t,n,r,a,s){we(e,()=>e.bindTexture(e.TEXTURE_2D,t));let i,o,l;a instanceof Uint8Array?(i=new Uint8Array(n*r*4),o=e.UNSIGNED_BYTE,l=e.RGBA):(i=new Float32Array(n*r*4),o=e.FLOAT,l=s.internalFormatPackedFloat),i.set(a),we(e,()=>e.texImage2D(e.TEXTURE_2D,0,l,n,r,0,e.RGBA,o,i)),we(e,()=>e.bindTexture(e.TEXTURE_2D,null))}function k3(e,t,n){we(e,()=>e.bindTexture(e.TEXTURE_2D,t)),n.data instanceof Uint8Array?we(e,()=>e.texImage2D(e.TEXTURE_2D,0,e.RGBA,n.width,n.height,0,e.RGBA,e.UNSIGNED_BYTE,n.data)):we(e,()=>e.texImage2D(e.TEXTURE_2D,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,n)),we(e,()=>e.bindTexture(e.TEXTURE_2D,null))}function I3(e,t,n,r){let a=e.createBuffer();we(e,()=>e.bindBuffer(e.PIXEL_PACK_BUFFER,a));let s=4*4*t*n;return we(e,()=>e.bufferData(e.PIXEL_PACK_BUFFER,s,e.STREAM_READ)),we(e,()=>e.readPixels(0,0,n,t,e.RGBA,e.FLOAT,0)),we(e,()=>e.bindBuffer(e.PIXEL_PACK_BUFFER,null)),a}function S3(e,t,n){let r=e,a=new Float32Array(n);return r.bindBuffer(r.PIXEL_PACK_BUFFER,t),r.getBufferSubData(r.PIXEL_PACK_BUFFER,0,a),r.bindBuffer(r.PIXEL_PACK_BUFFER,null),a}function N3(e,t,n,r){let[a,s]=wc(t,n),i=4,o=new Uint8Array(tL(t*n,i));return we(e,()=>e.readPixels(0,0,a,s,r.downloadTextureFormat,e.UNSIGNED_BYTE,o)),new Float32Array(o.buffer)}function T3(e,t,n,r,a,s,i,o){let l=e,c=new Float32Array(nL(s,i));return l.bindBuffer(l.PIXEL_PACK_BUFFER,t),l.getBufferSubData(l.PIXEL_PACK_BUFFER,0,c),l.bindBuffer(l.PIXEL_PACK_BUFFER,null),c}function E3(e,t,n){let r=new Float32Array(t*n*4);return we(e,()=>e.readPixels(0,0,n,t,e.RGBA,e.FLOAT,r)),r}var wp=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,yp(t,e)):this.gl=qr(t);let n="WEBGL_color_buffer_float",r="EXT_color_buffer_half_float";if(J().getNumber("WEBGL_VERSION")===1){let a="OES_texture_float",s="OES_texture_half_float";if(this.textureFloatExtension=yc(this.gl,a),rr(this.gl,s))this.textureHalfFloatExtension=yc(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),rr(this.gl,r))this.colorBufferHalfFloatExtension=yc(this.gl,r);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",rr(this.gl,n))this.colorBufferFloatExtension=this.gl.getExtension(n);else if(rr(this.gl,r))this.
` ),i=e.map(p=>yL(p,t,r)).join( `
` ),o=t.texShape,l=dn(),c=xL(l),u,h,d=_L(l);return t.isPacked?(u=AL(t.logicalShape,o),h=bL(l)):(u=gL(t.logicalShape,o),h=wL(l)),r&&(d+=vL),[d,c,h,s,u,i,n].join( `
` )}function Dl(e){let t=e.shapeInfo.logicalShape;switch(t.length){case 0:return IL(e);case 1:return SL(e);case 2:return NL(e);case 3:return TL(e);case 4:return EL(e);case 5:return CL(e);case 6:return RL(e);default:throw new Error( ` $ { t . length } - D input sampling is not yet supported ` )}}function R3(e){switch(e.shapeInfo.logicalShape.length){case 0:return ML(e);case 1:return FL(e);case 2:return $ L(e);case 3:return DL(e);default:return OL(e)}}function yL(e,t,n=!1){let r="";n?r+=R3(e):r+=Dl(e);let a=e.shapeInfo.logicalShape,s=t.logicalShape;return a.length<=s.length&&(n?r+=zL(e,t):r+=PL(e,t)),r}function AL(e,t){switch(e.length){case 0:return M3();case 1:return LL(e,t);case 2:return VL(e,t);case 3:return WL(e,t);default:return BL(e,t)}}function gL(e,t){switch(e.length){case 0:return M3();case 1:return jL(e,t);case 2:return XL(e,t);case 3:return UL(e,t);case 4:return HL(e,t);case 5:return GL(e,t);case 6:return qL(e,t);default:throw new Error( ` $ { e . length } - D output sampling is not yet supported ` )}}function xL(e){return `
float sampleTexture ( sampler2D textureSampler , vec2 uv ) {
return $ { e . texture2D } ( textureSampler , uv ) . r ;
}
` }function wL(e){return `
void setOutput ( float val ) {
$ { e . output } = vec4 ( val , 0 , 0 , 0 ) ;
}
` }function bL(e){return `
void setOutput ( vec4 val ) {
$ { e . output } = val ;
}
` }function _L(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 ) ;
}
$ { KL }
$ { ZL }
$ { YL }
` }var KL= `
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 ) ;
}
` ,ZL= `
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 ) ;
}
` ,YL= `
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 ) ;
}
` ,vL= `
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 M3(){return `
int getOutputCoords ( ) {
return 0 ;
}
` }function LL(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 jL(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 WL(e,t){let n=[Math.ceil(t[0]/2),Math.ceil(t[1]/2)],r=Math.ceil(e[2]/2),a=r*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 / $ { a } ;
index -= b * $ { a } ;
int r = 2 * ( index / $ { r } ) ;
int c = imod ( index , $ { r } ) * 2 ;
return ivec3 ( b , r , c ) ;
}
` }function UL(e,t){let n=Ei(["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 BL(e,t){let n=[Math.ceil(t[0]/2),Math.ceil(t[1]/2)],r=Math.ceil(e[e.length-1]/2),a=r*Math.ceil(e[e.length-2]/2),s=a,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 / $ { a } ;
index -= b * $ { a } ;
int r = 2 * ( index / $ { r } ) ;
int c = imod ( index , $ { r } ) * 2 ;
return ivec$ { e . length } ( $ { o } ) ;
}
` }function HL(e,t){let n=Ei(["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 GL(e,t){let n=Ei(["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 qL(e,t){let n=Ei(["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 VL(e,t){let n=[Math.ceil(t[0]/2),Math.ceil(t[1]/2)];if(_.arraysEqual(e,t))return `
ivec2 getOutputCoords ( ) {
return 2 * ivec2 ( resultUV . yx * vec2 ( $ { n [ 0 ] } , $ { n [ 1 ] } ) ) ;
}
` ;let r=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 / $ { r } ) ;
int c = imod ( index , $ { r } ) * 2 ;
return ivec2 ( r , c ) ;
}
` }function XL(e,t){return _.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 Ci(e){return ` offset$ { e } ` }function ML(e){let t=e.name,n="get"+t.charAt(0).toUpperCase()+t.slice(1),r=dn();return `
vec4 $ { n } ( ) {
return $ { r . texture2D } ( $ { t } , halfCR ) ;
}
` }function IL(e){let t=e.name,n="get"+t.charAt(0).toUpperCase()+t.slice(1);if(e.shapeInfo.isUniform)return ` float $ { n } ( ) { return $ { t } ; } ` ;let[r,a]=e.shapeInfo.texShape;if(r===1&&a===1)return `
float $ { n } ( ) {
return sampleTexture ( $ { t } , halfCR ) ;
}
` ;let[s,i]=e.shapeInfo.texShape,o=Ci(t);return `
float $ { n } ( ) {
vec2 uv = uvFromFlat ( $ { s } , $ { i } , $ { o } ) ;
return sampleTexture ( $ { t } , uv ) ;
}
` }function FL(e){let t=e.name,n="get"+t.charAt(0).toUpperCase()+t.slice(1),r=e.shapeInfo.texShape,a=[Math.ceil(r[0]/2),Math.ceil(r[1]/2)],s=dn();return `
vec4 $ { n } ( int index ) {
vec2 uv = packedUVfrom1D (
$ { a [ 0 ] } , $ { a [ 1 ] } , index ) ;
return $ { s . texture2D } ( $ { t } , uv ) ;
}
` }function SL(e){let t=e.name,n="get"+t.charAt(0).toUpperCase()+t.slice(1);if(e.shapeInfo.isUniform)return `
float $ { n } ( int index ) {
$ { Ol ( e ) }
}
` ;let r=e.shapeInfo.texShape,a=r[0],s=r[1];if(s===1&&a===1)return `
float $ { n } ( int index ) {
return sampleTexture ( $ { t } , halfCR ) ;
}
` ;let i=Ci(t);return s===1? `
float $ { n } ( int index ) {
vec2 uv = vec2 ( 0.5 , ( float ( index + $ { i } ) + 0.5 ) / $ { a } . 0 ) ;
return sampleTexture ( $ { t } , uv ) ;
}
` :a===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 ( $ { a } , $ { s } , index + $ { i } ) ;
return sampleTexture ( $ { t } , uv ) ;
}
` }function $ L(e){let t=e.shapeInfo.logicalShape,n=e.name,r="get"+n.charAt(0).toUpperCase()+n.slice(1),a=e.shapeInfo.texShape,s=a[0],i=a[1],o=dn();if(a!=null&&_.arraysEqual(t,a))return `
vec4 $ { r } ( int row , int col ) {
vec2 uv = ( vec2 ( col , row ) + halfCR ) / vec2 ( $ { i } . 0 , $ { s } . 0 ) ;
return $ { o . texture2D } ( $ { n } , uv ) ;
}
` ;let l=[Math.ceil(a[0]/2),Math.ceil(a[1]/2)],c=Math.ceil(t[1]/2);return `
vec4 $ { r } ( int row , int col ) {
vec2 uv = packedUVfrom2D ( $ { c } , $ { l [ 0 ] } , $ { l [ 1 ] } , row , col ) ;
return $ { o . texture2D } ( $ { n } , uv ) ;
}
` }function NL(e){let t=e.shapeInfo.logicalShape,n=e.name,r="get"+n.charAt(0).toUpperCase()+n.slice(1),a=e.shapeInfo.texShape;if(a!=null&&_.arraysEqual(t,a)){let h=a[0],d=a[1];return `
float $ { r } ( int row , int col ) {
vec2 uv = ( vec2 ( col , row ) + halfCR ) / vec2 ( $ { d } . 0 , $ { h } . 0 ) ;
return sampleTexture ( $ { n } , uv ) ;
}
` }let{newShape:s,keptDims:i}=_.squeezeShape(t),o=s;if(o.length<t.length){let h=zl(e,o),d=["row","col"];return `
$ { Dl ( h ) }
float $ { r } ( int row , int col ) {
return $ { r } ( $ { Pl ( d , i ) } ) ;
}
` }if(e.shapeInfo.isUniform)return `
float $ { r } ( int row , int col ) {
int index = round ( dot ( vec2 ( row , col ) , vec2 ( $ { t [ 1 ] } , 1 ) ) ) ;
$ { Ol ( e ) }
}
` ;let l=a[0],c=a[1],u=Ci(n);return c===1? `
float $ { r } ( 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 $ { r } ( int row , int col ) {
float index = dot ( vec3 ( row , col , $ { u } ) , vec3 ( $ { t [ 1 ] } , 1 , 1 ) ) ;
vec2 uv = vec2 ( ( index + 0.5 ) / $ { c } . 0 , 0.5 ) ;
return sampleTexture ( $ { n } , uv ) ;
}
` : `
float $ { r } ( 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 } , $ { c } , index ) ;
return sampleTexture ( $ { n } , uv ) ;
}
` }function DL(e){let t=e.shapeInfo.logicalShape,n=e.name,r="get"+n.charAt(0).toUpperCase()+n.slice(1),a=e.shapeInfo.texShape,s=[Math.ceil(a[0]/2),Math.ceil(a[1]/2)];if(t[0]===1){let h=t.slice(1),d=[1,2],p=zl(e,h),f=["b","row","col"];return `
$ { R3 ( p ) }
vec4 $ { r } ( int b , int row , int col ) {
return $ { r } ( $ { Pl ( f , d ) } ) ;
2021-04-15 21:01:27 +02:00
}
2021-04-17 00:03:15 +02:00
` }let i=s[0],o=s[1],l=Math.ceil(t[2]/2),c=l*Math.ceil(t[1]/2),u=dn();return `
vec4 $ { r } ( int b , int row , int col ) {
vec2 uv = packedUVfrom3D (
$ { i } , $ { o } , $ { c } , $ { l } , b , row , col ) ;
return $ { u . texture2D } ( $ { n } , uv ) ;
}
` }function TL(e){let t=e.shapeInfo.logicalShape,n=e.name,r="get"+n.charAt(0).toUpperCase()+n.slice(1),a=t[1]*t[2],s=t[2],{newShape:i,keptDims:o}=_.squeezeShape(t),l=i;if(l.length<t.length){let f=zl(e,l),m=["row","col","depth"];return `
$ { Dl ( f ) }
float $ { r } ( int row , int col , int depth ) {
return $ { r } ( $ { Pl ( m , o ) } ) ;
2021-04-15 21:01:27 +02:00
}
2021-04-17 00:03:15 +02:00
` }if(e.shapeInfo.isUniform)return `
float $ { r } ( int row , int col , int depth ) {
int index = round ( dot ( vec3 ( row , col , depth ) ,
vec3 ( $ { a } , $ { s } , 1 ) ) ) ;
$ { Ol ( e ) }
}
` ;let c=e.shapeInfo.texShape,u=c[0],h=c[1],d=e.shapeInfo.flatOffset;if(h===a&&d==null)return `
float $ { r } ( 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 ( $ { h } . 0 , $ { u } . 0 ) ;
return sampleTexture ( $ { n } , uv ) ;
2021-03-29 21:01:16 +02:00
}
2021-04-17 00:03:15 +02:00
` ;if(h===s&&d==null)return `
float $ { r } ( 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 ( $ { h } . 0 , $ { u } . 0 ) ;
return sampleTexture ( $ { n } , uv ) ;
}
` ;let p=Ci(n);return `
float $ { r } ( int row , int col , int depth ) {
// Explicitly use integer operations as dot() only works on floats.
int index = row * $ { a } + col * $ { s } + depth + $ { p } ;
vec2 uv = uvFromFlat ( $ { u } , $ { h } , index ) ;
return sampleTexture ( $ { n } , uv ) ;
}
` }function OL(e){let t=e.shapeInfo.logicalShape,n=t.length,r=e.name,a="get"+r.charAt(0).toUpperCase()+r.slice(1),s=e.shapeInfo.texShape,i=[Math.ceil(s[0]/2),Math.ceil(s[1]/2)],o=i[0],l=i[1],c=Math.ceil(t[n-1]/2),u=c*Math.ceil(t[n-2]/2),h="int b, int row, int col",d= ` b * $ { u } + ( row / 2 ) * $ { c } + ( col / 2 ) ` ;for(let f=2;f<n-1;f++)h= ` int b$ { f } , ` +h,u*=t[n-f-1],d= ` b$ { f } * $ { u } + ` +d;let p=dn();return `
vec4 $ { a } ( $ { h } ) {
int index = $ { d } ;
int texR = index / $ { l } ;
int texC = index - texR * $ { l } ;
vec2 uv = ( vec2 ( texC , texR ) + halfCR ) / vec2 ( $ { l } , $ { o } ) ;
return $ { p . texture2D } ( $ { r } , uv ) ;
}
` }function EL(e){let t=e.shapeInfo.logicalShape,n=e.name,r="get"+n.charAt(0).toUpperCase()+n.slice(1),a=t[3],s=t[2]*a,i=t[1]*s,{newShape:o,keptDims:l}=_.squeezeShape(t);if(o.length<t.length){let f=zl(e,o),m=["row","col","depth","depth2"];return `
$ { Dl ( f ) }
float $ { r } ( int row , int col , int depth , int depth2 ) {
return $ { r } ( $ { Pl ( m , l ) } ) ;
}
` }if(e.shapeInfo.isUniform)return `
float $ { r } ( int row , int col , int depth , int depth2 ) {
int index = round ( dot ( vec4 ( row , col , depth , depth2 ) ,
vec4 ( $ { i } , $ { s } , $ { a } , 1 ) ) ) ;
$ { Ol ( e ) }
}
` ;let c=e.shapeInfo.flatOffset,u=e.shapeInfo.texShape,h=u[0],d=u[1];if(d===i&&c==null)return `
float $ { r } ( int row , int col , int depth , int depth2 ) {
float texR = float ( row ) ;
float texC =
dot ( vec3 ( col , depth , depth2 ) ,
vec3 ( $ { s } , $ { a } , 1 ) ) ;
vec2 uv = ( vec2 ( texC , texR ) + halfCR ) /
vec2 ( $ { d } . 0 , $ { h } . 0 ) ;
return sampleTexture ( $ { n } , uv ) ;
}
` ;if(d===a&&c==null)return `
float $ { r } ( 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 ( $ { d } . 0 , $ { h } . 0 ) ;
return sampleTexture ( $ { n } , uv ) ;
}
` ;let p=Ci(n);return `
float $ { r } ( 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 * $ { a } + depth2 ;
vec2 uv = uvFromFlat ( $ { h } , $ { d } , index + $ { p } ) ;
return sampleTexture ( $ { n } , uv ) ;
}
` }function CL(e){let t=e.shapeInfo.logicalShape,n=e.name,r="get"+n.charAt(0).toUpperCase()+n.slice(1),a=t[4],s=t[3]*a,i=t[2]*s,o=t[1]*i,{newShape:l,keptDims:c}=_.squeezeShape(t);if(l.length<t.length){let m=zl(e,l),y=["row","col","depth","depth2","depth3"];return `
$ { Dl ( m ) }
float $ { r } ( int row , int col , int depth , int depth2 , int depth3 ) {
return $ { r } ( $ { Pl ( y , c ) } ) ;
}
` }if(e.shapeInfo.isUniform)return `
float $ { r } ( int row , int col , int depth , int depth2 , int depth3 ) {
float index = dot (
vec4 ( row , col , depth , depth2 ) ,
vec4 ( $ { o } , $ { i } , $ { s } , $ { a } ) ) +
depth3 ;
$ { Ol ( e ) }
}
` ;let u=e.shapeInfo.flatOffset,h=e.shapeInfo.texShape,d=h[0],p=h[1];if(p===o&&u==null)return `
float $ { r } ( int row , int col , int depth , int depth2 , int depth3 ) {
int texR = row ;
float texC = dot ( vec4 ( col , depth , depth2 , depth3 ) ,
vec4 ( $ { i } , $ { s } , $ { a } , 1 ) ) ;
vec2 uv = ( vec2 ( texC , texR ) + halfCR ) /
vec2 ( $ { p } . 0 , $ { d } . 0 ) ;
return sampleTexture ( $ { n } , uv ) ;
}
` ;if(p===a&&u==null)return `
float $ { r } ( 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 ( $ { p } . 0 , $ { d } . 0 ) ;
return sampleTexture ( $ { n } , uv ) ;
}
` ;let f=Ci(n);return `
float $ { r } ( 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 * $ { a } + depth3 + $ { f } ;
vec2 uv = uvFromFlat ( $ { d } , $ { p } , index ) ;
return sampleTexture ( $ { n } , uv ) ;
}
` }function RL(e){let t=e.shapeInfo.logicalShape,n=e.name,r="get"+n.charAt(0).toUpperCase()+n.slice(1),{newShape:a,keptDims:s}=_.squeezeShape(t);if(a.length<t.length){let y=zl(e,a),A=["row","col","depth","depth2","depth3","depth4"];return `
$ { Dl ( y ) }
float $ { r } ( int row , int col , int depth ,
int depth2 , int depth3 , int depth4 ) {
return $ { r } ( $ { Pl ( A , s ) } ) ;
}
` }let i=t[5],o=t[4]*i,l=t[3]*o,c=t[2]*l,u=t[1]*c;if(e.shapeInfo.isUniform)return `
float $ { r } ( int row , int col , int depth ,
int depth2 , int depth3 , int depth4 ) {
int index = round ( dot (
vec4 ( row , col , depth , depth2 ) ,
vec4 ( $ { u } , $ { c } , $ { l } , $ { o } ) ) +
dot (
vec2 ( depth3 , depth4 ) ,
vec2 ( $ { i } , 1 ) ) ) ;
$ { Ol ( e ) }
}
` ;let h=e.shapeInfo.flatOffset,d=e.shapeInfo.texShape,p=d[0],f=d[1];if(f===u&&h==null)return `
float $ { r } ( int row , int col , int depth ,
int depth2 , int depth3 , int depth4 ) {
int texR = row ;
float texC = dot ( vec4 ( col , depth , depth2 , depth3 ) ,
vec4 ( $ { c } , $ { l } , $ { o } , $ { i } ) ) +
float ( depth4 ) ;
vec2 uv = ( vec2 ( texC , texR ) + halfCR ) /
vec2 ( $ { f } . 0 , $ { p } . 0 ) ;
return sampleTexture ( $ { n } , uv ) ;
}
` ;if(f===i&&h==null)return `
float $ { r } ( 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 ( $ { f } . 0 , $ { p } . 0 ) ;
return sampleTexture ( $ { n } , uv ) ;
}
` ;let m=Ci(n);return `
float $ { r } ( 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 * $ { c } + depth * $ { l } +
depth2 * $ { o } + depth3 * $ { i } + depth4 + $ { m } ;
vec2 uv = uvFromFlat ( $ { p } , $ { f } , index ) ;
return sampleTexture ( $ { n } , uv ) ;
}
` }function Ol(e){let t=e.name,n=_.sizeFromShape(e.shapeInfo.logicalShape);return n<2? ` return $ { t } ; ` : `
for ( int i = 0 ; i < $ { n } ; i ++ ) {
if ( i == index ) {
return $ { t } [ i ] ;
}
}
` }function zL(e,t){let n=e.name,r=n.charAt(0).toUpperCase()+n.slice(1),a="get"+r+"AtOutCoords",s=e.shapeInfo.logicalShape.length,i=t.logicalShape.length,o=C3(e.shapeInfo.logicalShape,t.logicalShape),l=lt(i),c=i-s,u,h=["x","y","z","w","u","v"];s===0?u="":i<2&&o.length>=1?u="coords = 0;":u=o.map(y=> ` coords . $ { h [ y + c ] } = 0 ; ` ).join( `
` );let d="";i<2&&s>0?d="coords":d=e.shapeInfo.logicalShape.map((y,A)=> ` coords . $ { h [ A + c ] } ` ).join(", ");let p="return outputValue;",f=_.sizeFromShape(e.shapeInfo.logicalShape)===1,m=_.sizeFromShape(t.logicalShape)===1;if(s===1&&!f&&!m)p= `
return vec4 ( outputValue . xy , outputValue . xy ) ;
` ;else if(f&&!m)i===1?p= `
return vec4 ( outputValue . x , outputValue . x , 0. , 0. ) ;
` :p= `
return vec4 ( outputValue . x ) ;
` ;else if(o.length){let y=s-2,A=s-1;o.indexOf(y)>-1&&o.indexOf(A)>-1?p="return vec4(outputValue.x);":o.indexOf(y)>-1?p="return vec4(outputValue.x, outputValue.y, outputValue.x, outputValue.y);":o.indexOf(A)>-1&&(p="return vec4(outputValue.xx, outputValue.zz);")}return `
vec4 $ { a } ( ) {
$ { l } coords = getOutputCoords ( ) ;
$ { u }
vec4 outputValue = get$ { r } ( $ { d } ) ;
$ { p }
}
` }function PL(e,t){let n=e.name,r=n.charAt(0).toUpperCase()+n.slice(1),a="get"+r+"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&&_.arraysEqual(i,s))return `
float $ { a } ( ) {
return sampleTexture ( $ { n } , resultUV ) ;
}
` ;let c=lt(l),u=C3(e.shapeInfo.logicalShape,t.logicalShape),h=l-o,d,p=["x","y","z","w","u","v"];o===0?d="":l<2&&u.length>=1?d="coords = 0;":d=u.map(m=> ` coords . $ { p [ m + h ] } = 0 ; ` ).join( `
` );let f="";return l<2&&o>0?f="coords":f=e.shapeInfo.logicalShape.map((m,y)=> ` coords . $ { p [ y + h ] } ` ).join(", "), `
float $ { a } ( ) {
$ { c } coords = getOutputCoords ( ) ;
$ { d }
return get$ { r } ( $ { f } ) ;
}
` }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 zl(e,t){let n=JSON.parse(JSON.stringify(e));return n.shapeInfo.logicalShape=t,n}function Pl(e,t){return t.map(n=>e[n]).join(", ")}function JL(e,t,n,r){let a=t.userCode,s=n.map((p,f)=>{let m={logicalShape:p.shape,texShape:p.isUniform?null:p.texData.texShape,isUniform:p.isUniform,isPacked:p.isUniform?!1:p.texData.isPacked,flatOffset:null};return p.texData!=null&&p.texData.slice!=null&&p.texData.slice.flatOffset>0&&(m.flatOffset=p.texData.slice.flatOffset),{name:t.variableNames[f],shapeInfo:m}}),i=s.map(p=>p.shapeInfo),o={logicalShape:r.shape,texShape:r.texData.texShape,isUniform:!1,isPacked:r.texData.isPacked,flatOffset:null},l=kL(s,o,a,t.packedInputs),c=e.createProgram(l),u=null,h=e.getUniformLocation(c,"NAN",!1);J().getNumber("WEBGL_VERSION")===1&&(u=e.getUniformLocation(c,"INFINITY",!1));let d={};for(let p=0;p<t.variableNames.length;p++){let f=t.variableNames[p],m=!1;d[f]=e.getUniformLocation(c,f,m),d[ ` offset$ { f } ` ]=e.getUniformLocation(c, ` offset$ { f } ` ,m)}return{program:t,source:l,webGLProgram:c,uniformLocations:d,inShapeInfos:i,outShapeInfo:o,infLoc:u,nanLoc:h}}function F3(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,r)=>{let a=n.logicalShape,s=t[r],i=s.shape;if(!_.arraysEqual(a,i))throw Error( ` Binary was compiled with different shapes than the current args . Shapes $ { a } and $ { i } must match ` );if(n.isUniform&&s.isUniform)return;let o=n.texShape,l=s.isUniform?null:s.texData.texShape;if(!_.arraysEqual(o,l))throw Error( ` Binary was compiled with different texture shapes than the current args . Shape $ { o } and $ { l } must match ` )})}function QL(e,t,n,r,a){F3(t.inShapeInfos,n),F3([t.outShapeInfo],[r]);let s=r.texData.texture,i=r.texData.texShape;r.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 c=t.program.variableNames[l],u=t.uniformLocations[c],h=t.uniformLocations[ ` offset$ { c } ` ];if(u!=null){if(o.isUniform){if(_.sizeFromShape(o.shape)<2)e.gl.uniform1f(u,o.uniformValues[0]);else{let d=o.uniformValues;d instanceof Float32Array||(d=new Float32Array(d)),e.gl.uniform1fv(u,d)}return}o.texData.slice!=null&&h!=null&&e.gl.uniform1i(h,o.texData.slice.flatOffset),e.setInputMatrixTexture(o.texData.texture,u,l)}}),a!=null&&a(e,t.webGLProgram),e.executeProgram()}function eW(e,t,n){let r="";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;r+= ` $ { i . shape } _$ { l } _$ { o } ` });let a=e.userCode,s=e.constructor.name;return s+="_"+r+"_"+a,s}var{addImpl:tW,bincountImpl: $ 3,bincountReduceImpl:nW,ceilImpl:rW,concatImpl:aW,expImpl:sW,expm1Impl:iW,floorImpl:oW,gatherV2Impl:lW,greaterImpl:uW,lessImpl:cW,linSpaceImpl:hW,logImpl:dW,maxImpl:pW,maximumImpl:fW,minimumImpl:mW,multiplyImpl:yW,negImpl:AW,prodImpl:gW,rangeImpl:xW,rsqrtImpl:wW,simpleAbsImpl:D3,sliceImpl:bW,stridedSliceImpl:_W,subImpl:vW,tileImpl:kW,topKImpl:IW,transposeImpl:Sy,uniqueImpl:SW}=ey;function O3(e,t){return["x","y","z","w","u","v"].slice(0,t).map(n=> ` $ { e } . $ { n } ` )}function pn(e,t){return t===1?[e]:O3(e,t)}function NW(e,t){if(e===1)return"rc";let n="";for(let r=0;r<e;r++)n+=t[r],r<e-1&&(n+=",");return n}var RW=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-15 21:01:27 +02:00
}
2021-04-17 00:03:15 +02:00
` ;else{let n=pn("rc",t),r=lt(t),a=TW(t,e,n),s=EW(t,e[e.length-1],e[e.length-2],n),i=CW(e,n);this.userCode= `
void main ( ) {
$ { r } rc = getOutputCoords ( ) ;
if ( $ { a } ) {
setOutput ( vec4 ( 0 ) ) ;
} else {
$ { s }
setOutput ( vec4 ( $ { i } ) ) ;
2021-03-24 16:43:28 +01:00
}
2021-03-27 20:43:48 +01:00
}
2021-04-17 00:03:15 +02:00
` }}};function MW(e,t){let n=[];for(let r=0;r<=1;r++)for(let a=0;a<=1;a++){let s= ` $ { r === 0 ? "r" : "rp1" } , $ { a === 0 ? "c" : "cp1" } ` ;for(let i=2;i<e;i++)s= ` $ { t [ t . length - 1 - i ] } , ` +s;n.push(s)}return n}function TW(e,t,n){if(e===1)return ` rc > $ { t [ 0 ] } ` ;let r="";for(let a=e-2;a<e;a++)r+= ` $ { n [ a ] } >= $ { t [ a ] } ` ,a<e-1&&(r+="||");return r}function EW(e,t,n,r){if(e===1)return"";let a=r.slice(-2);return `
int r = $ { a [ 0 ] } ;
int c = $ { a [ 1 ] } ;
int rp1 = r + 1 ;
int cp1 = c + 1 ;
bool cEdge = cp1 >= $ { t } ;
bool rEdge = rp1 >= $ { n } ;
` }function CW(e,t){let n=e.length,r=MW(n,t);return n===1? ` getA ( rc ) ,
rc + 1 >= $ { e [ 0 ] } ? 0. : getA ( rc + 1 ) ,
0 , 0 ` : ` getA ( $ { r [ 0 ] } ) ,
cEdge ? 0. : getA ( $ { r [ 1 ] } ) ,
rEdge ? 0. : getA ( $ { r [ 2 ] } ) ,
rEdge || cEdge ? 0. : getA ( $ { r [ 3 ] } ) ` }var z3=class{constructor(e,t){this.variableNames=["A"],this.packedInputs=!0,this.packedOutput=!0,this.outputShape=e;let n="";for(let r=0;r<4;r++){let a="thisRC = rc;";r%2==1&&(a+="thisRC.z += 1;"),r>1&&(a+="thisRC.y += 1;"),n+= `
$ { a }
$ { r > 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 [ $ { r } ] =
getChannel ( getA ( inputRC . x , inputRC . y , inputRC . z ) , inputRCInnerDims ) ;
$ { r > 0 ? "}" : "" }
` }this.userCode= `
$ { FW ( t ) }
$ { wy ( e ) }
void main ( ) {
ivec3 rc = getOutputCoords ( ) ;
vec4 result = vec4 ( 0. ) ;
ivec3 thisRC ;
int rows = $ { e [ 1 ] } ;
int cols = $ { e [ 2 ] } ;
$ { n }
setOutput ( result ) ;
}
` }};function FW(e){return `
ivec3 inputCoordsFromReshapedOutCoords ( int index ) {
$ { Ei ( [ "r" , "c" , "d" ] , e ) }
return ivec3 ( r , c , d ) ;
}
` }var $ W=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 r=L3(t,n),a=W3(e,r,n);a in this.freeTextures||(this.freeTextures[a]=[]),a in this.usedTextures||(this.usedTextures[a]=[]);let s=P3(e,r,this.gpgpu.gl,this.gpgpu.textureConfig,n);if(this.freeTextures[a].length>0){this.numFreeTextures--,this.numUsedTextures++,this._numBytesFree-=s,this.log();let o=this.freeTextures[a].shift();return this.usedTextures[a].push(o),o}let i;return r===en.PACKED_2X2_FLOAT32?i=this.gpgpu.createPackedMatrixTexture(e[0],e[1]):r===en.PACKED_2X2_FLOAT16?i=this.gpgpu.createFloat16PackedMatrixTexture(e[0],e[1]):r===en.UNPACKED_FLOAT32?i=this.gpgpu.createFloat32MatrixTexture(e[0],e[1]):r===en.UNPACKED_FLOAT16?i=this.gpgpu.createFloat16MatrixTexture(e[0],e[1]):r===en.PACKED_4X1_UNSIGNED_BYTE&&(i=this.gpgpu.createUnsignedBytesMatrixTexture(e[0],e[1])),this.usedTextures[a].push(i),this.numUsedTextures++,this._numBytesAllocated+=s,this.log(),i}releaseTexture(e,t,n,r){if(this.freeTextures==null)return;let a=L3(n,r),s=W3(t,a,r);s in this.freeTextures||(this.freeTextures[s]=[]);let i=P3(t,a,this.gpgpu.gl,this.gpgpu.textureConfig,r),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],c=l.indexOf(e);if(c<0)throw new Error("Cannot release a texture that was never provided by this texture manager");l.splice(c,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 DW(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 P3(e,t,n,r,a){let s=OW(t,r),i;if(a){let[l,c]= $ l(e[0],e[1]);i=l*c}else{let[l,c]=wc(e[0],e[1]);i=l*c}let o=DW(n,s);return i*o}function OW(e,t){switch(e){case en.PACKED_2X2_FLOAT32:return ky(t);case en.PACKED_2X2_FLOAT16:return Iy(t);case en.UNPACKED_FLOAT32:return by(t);case en.UNPACKED_FLOAT16:return _y(t);case en.PACKED_4X1_UNSIGNED_BYTE:return vy(t);default:throw new Error( ` Unknown physical texture type $ { e } ` )}}function zW(e){return J().getBool("WEBGL_RENDER_FLOAT32_ENABLED")?e?en.PACKED_2X2_FLOAT32:en.UNPACKED_FLOAT32:e?en.PACKED_2X2_FLOAT16:en.UNPACKED_FLOAT16}function L3(e,t){if(e===ar.UPLOAD)return en.PACKED_2X2_FLOAT32;if(e===ar.RENDER||e==null)return zW(t);if(e===ar.DOWNLOAD||e===ar.PIXELS)return en.PACKED_4X1_UNSIGNED_BYTE;throw new Error( ` Unknown logical texture type $ { e } ` )}function W3(e,t,n){return ` $ { e [ 0 ] } _$ { e [ 1 ] } _$ { t } _$ { n } ` }var Ga=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 ) ;
}
` }},Sr="if (isnan(x)) return x;",PW="return x;",B3="return abs(x);",LW="return (x >= 0.0) ? x : (exp(x) - 1.0);",WW=Sr+ `
return ( x < 0.0 ) ? 0.0 : x ;
` ,BW=Sr+ `
return ( x < 0.0 ) ? 0.0 : min ( 6.0 , x ) ;
` ,bp="return x;",VW="return x;",jW= `
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 ;
` ,UW= `
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 ;
` ,HW= `
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 ;
` ,Ll=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 ) ;
}
` }},GW=class{constructor(e){this.variableNames=["A"],this.packedInputs=!0,this.packedOutput=!1,this.outputShape=e;let t=e.length,n=pn("rc",t),r=lt(t),a=NW(t,n),s=n.slice(-2),i=t<=1?"rc": ` vec2 ( $ { s . join ( "," ) } ) ` ;this.userCode= `
void main ( ) {
$ { r } rc = getOutputCoords ( ) ;
vec4 packedInput = getA ( $ { a } ) ;
setOutput ( getChannel ( packedInput , $ { i } ) ) ;
}
` }},qW=Hr.whereImpl,XW=1e-7,KW=1e-4,Ny={};function ZW(e){return e in Ny||(Ny[e]={}),Ny[e]}var YW=128,JW=600;function QW(){return J().global.screen==null?1024:J().global.screen.height*J().global.screen.width*window.devicePixelRatio*JW/1024/1024}var Wl=class extends wu{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=qr(J().getNumber("WEBGL_VERSION"));this.binaryCache=ZW(J().getNumber("WEBGL_VERSION")),this.gpgpu=new wp(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 $ W(this.gpgpu),this.numMBBeforeWarning=QW(),this.texData=new Rh(this,ua())}nextDataId(){return Wl.nextDataId++}numDataIds(){return this.texData.numDataIds()+(this.cpuBackend?this.cpuBackend.numDataIds():0)-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 r={id:this.nextDataId()};return this.texData.set(r,{shape:t,dtype:n,values:e,usage:ar.UPLOAD,refCount:1}),r}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,r,a){if(J().getBool("DEBUG")&&this.checkNumericalProblems(t),r==="complex64")throw new Error("Cannot write to a complex64 dtype. Please use tf.complex(real, imag).");this.texData.set(e,{shape:n,dtype:r,values:t,usage:ar.UPLOAD,refCount:a})}disposeIntermediateTensorInfo(e){this.disposeData(e.dataId)}readSync(e){let t=this.texData.get(e),{values:n,dtype:r,complexTensorInfos:a,slice:s,shape:i,isPacked:o}=t;if(s!=null){let h;o?h=new Ll(i,bp):h=new Ga(i,bp);let d=this.runWebGLProgram(h,[{dataId:e,shape:i,dtype:r}],r),p=this.readSync(d.dataId);return this.disposeIntermediateTensorInfo(d),p}if(n!=null)return this.convertAndCacheOnCPU(e);if(r==="string")return n;let l=this.activeTimers!=null,c;l&&(c=_.now());let u;if(r==="complex64"){let h=this.readSync(a.real.dataId),d=this.readSync(a.imag.dataId);u=C.mergeRealAndImagArrays(h,d)}else u=this.getValuesFromTexture(e);return l&&(this.downloadWaitMs+=_.now()-c),this.convertAndCacheOnCPU(e,u)}async read(e){if(this.pendingRead.has(e)){let p=this.pendingRead.get(e);return new Promise(f=>p.push(f))}let t=this.texData.get(e),{values:n,shape:r,slice:a,dtype:s,complexTensorInfos:i,isPacked:o}=t;if(a!=null){let p;o?p=new Ll(r,bp):p=new Ga(r,bp);let f=this.runWebGLProgram(p,[{dataId:e,shape:r,dtype:s}],s),m=this.read(f.dataId);return this.disposeIntermediateTensorInfo(f),m}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,c;if(s!=="complex64"&&J().get("WEBGL_BUFFER_SUPPORTED")){c=this.decode(e);let p=this.texData.get(c.dataId);l=this.gpgpu.createBufferFromTexture(p.texture,...bc(r))}this.pendingRead.set(e,[]),s!=="complex64"&&await this.gpgpu.createAndWaitForFence();let u;if(s==="complex64"){let p=await Promise.all([this.read(i.real.dataId),this.read(i.imag.dataId)]),f=p[0],m=p[1];u=C.mergeRealAndImagArrays(f,m)}else if(l==null)u=this.getValuesFromTexture(e);else{let p=_.sizeFromShape(r);u=this.gpgpu.downloadFloat32MatrixFromBuffer(l,p)}c!=null&&this.disposeIntermediateTensorInfo(c);let h=this.convertAndCacheOnCPU(e,u),d=this.pendingRead.get(e);return this.pendingRead.delete(e),d.forEach(p=>p(h)),this.pendingDisposal.has(e)&&(this.pendingDisposal.delete(e),this.disposeData(e)&&ua().removeDataId(e,this),this.pendingDeletes--),h}bufferSyn
if ( isnan ( a ) ) return a ;
if ( isnan ( b ) ) return b ;
` ,Bl=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 ) ) ;
}
` }},_p= `
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 ;
` ,vc=class{constructor(e,t,n,r=!1){this.variableNames=["A","B"],this.supportsBroadcasting=!0,this.packedInputs=!0,this.packedOutput=!0,this.outputShape=C.assertAndGetBroadcastShape(t,n);let a=this.outputShape.length,s="";if(r)if(a===0||_.sizeFromShape(this.outputShape)===1)s= `
result . y = 0. ;
result . z = 0. ;
result . w = 0. ;
` ;else if(s= `
$ { lt ( a ) } coords = getOutputCoords ( ) ;
` ,a===1)s+= `
result . y = ( coords + 1 ) >= $ { this . outputShape [ 0 ] } ? 0. : result . y ;
result . z = 0. ;
result . w = 0. ;
` ;else{let i=pn("coords",a);s+= `
bool nextRowOutOfBounds =
( $ { i [ a - 2 ] } + 1 ) >= $ { this . outputShape [ a - 2 ] } ;
bool nextColOutOfBounds =
( $ { i [ a - 1 ] } + 1 ) >= $ { this . outputShape [ a - 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 Vn(e){let{inputs:t,backend:n}=e,{x:r}=t;return n.incRef(r.dataId),{dataId:r.dataId,shape:r.shape,dtype:r.dtype}}var nB={kernelName:Es,backendName:"webgl",kernelFunc:Vn};function qa(e){let{inputs:t,backend:n}=e,{real:r,imag:a}=t,s=n.makeTensorInfo(r.shape,"complex64"),i=n.texData.get(s.dataId),o=Vn({inputs:{x:r},backend:n}),l=Vn({inputs:{x:a},backend:n});return i.complexTensorInfos={real:o,imag:l},s}var rB={kernelName:Ph,backendName:"webgl",kernelFunc:qa},H3="return (a < 0.) ? b * a : a;",G3= `
vec4 aLessThanZero = vec4 ( lessThan ( a , vec4 ( 0. ) ) ) ;
return ( aLessThanZero * ( b * a ) ) + ( ( vec4 ( 1.0 ) - aLessThanZero ) * a ) ;
` ;function aB(e){let{inputs:t,backend:n,attrs:r}=e,{x:a}=t,{alpha:s}=r,i=n.makeTensorInfo([],"float32",_.createScalarValue(s,"float32")),o=J().getBool("WEBGL_PACK_BINARY_OPERATIONS")?new vc(G3,a.shape,i.shape):new Bl(H3,a.shape,i.shape),l=n.runWebGLProgram(o,[a,i],a.dtype);return n.disposeIntermediateTensorInfo(i),l}var sB={kernelName:Cs,backendName:"webgl",kernelFunc:aB},q3="return (a < 0.) ? b * a : a;",X3= `
vec4 aLessThanZero = vec4 ( lessThan ( a , vec4 ( 0. ) ) ) ;
return ( aLessThanZero * ( b * a ) ) + ( ( vec4 ( 1.0 ) - aLessThanZero ) * a ) ;
` ;function iB(e){let{inputs:t,backend:n}=e,{x:r,alpha:a}=t,s=J().getBool("WEBGL_PACK_BINARY_OPERATIONS")?new vc(X3,r.shape,a.shape):new Bl(q3,r.shape,a.shape);return n.runWebGLProgram(s,[r,a],r.dtype)}var oB={kernelName:js,backendName:"webgl",kernelFunc:iB},K3="if (isnan(x)) return x;",lB= `
if ( isnan ( a ) ) return a ;
if ( isnan ( b ) ) return b ;
` ,uB= `
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 Xe({opSnippet:e,packedOpSnippet:t,cpuKernelImpl:n,dtype:r}){return({inputs:a,backend:s})=>{let{x:i}=a,o=s,l=r||i.dtype;if(o.shouldExecuteOnCPU([i])&&n!=null){let h=o.texData.get(i.dataId),d=n(h.values,l);return o.makeTensorInfo(i.shape,l,d)}let c=J().getBool("WEBGL_PACK_UNARY_OPERATIONS")&&t!=null,u;return c?u=new Ll(i.shape,t):u=new Ga(i.shape,e),o.runWebGLProgram(u,[i],l)}}function tn({opSnippet:e,packedOpSnippet:t,checkOutOfBounds:n=!1,supportsComplex:r=!1,cpuKernelImpl:a,dtype:s}){return({inputs:i,backend:o})=>{let{a:l,b:c}=i,u=o;if(r&&l.dtype==="complex64"){let f=u.texData.get(l.dataId),m=u.texData.get(c.dataId),[y,A]=[[f.complexTensorInfos.real,m.complexTensorInfos.real],[f.complexTensorInfos.imag,m.complexTensorInfos.imag]].map(x=>{let[v,w]=x,b={dataId:v.dataId,dtype:v.dtype,shape:l.shape},k={dataId:w.dataId,dtype:w.dtype,shape:c.shape},N=new Bl(e,l.shape,c.shape);return u.runWebGLProgram(N,[b,k],dr(v.dtype,w.dtype))}),g=qa({inputs:{real:y,imag:A},backend:u});return u.disposeIntermediateTensorInfo(y),u.disposeIntermediateTensorInfo(A),g}let h=s||dr(l.dtype,c.dtype);if(u.shouldExecuteOnCPU([l,c])&&a!=null){let f=u.texData.get(l.dataId),m=u.texData.get(c.dataId),[y,A]=a(l.shape,c.shape,f.values,m.values,h),g=u.makeTensorInfo(A,h),x=u.texData.get(g.dataId);return x.values=y,g}let d=J().getBool("WEBGL_PACK_BINARY_OPERATIONS")&&t!=null,p;return d?p=new vc(t,l.shape,c.shape,n):p=new Bl(e,l.shape,c.shape),u.runWebGLProgram(p,[l,c],h)}}function vp(e,t=!1){if(e==="linear")return t?VW:PW;if(e==="relu")return t?UW:WW;if(e==="elu")return t?jW:LW;if(e==="relu6")return t?HW:BW;if(e==="prelu")return t?X3:q3;if(e==="leakyrelu")return t?G3:H3;throw new Error( ` Activation $ { e } has not been implemented for the WebGL backend . ` )}var Z3=class{constructor(e,t,n,r=!1,a=!1,s=!1,i=null,o=!1,l=!1){this.variableNames=["matrixA","matrixB"],this.packedInputs=!0,this.packedOutput=!0,this.outputShape=n;let c=r?e[1]:e[2],u=Math.ceil(c/2),h=r?"i * 2, rc.y":"rc.y, i * 2",d=a?"rc.z, i * 2":"i * 2, rc.z",p=r?["a.xxyy","a.zzww"]:["a.xxzz","a.yyww"],f=a?["b.xzxz","b.ywyw"]:["b.xyxy","b.zwzw"],m="",y="";i&&(o?m= ` vec4 activation ( vec4 a ) {
vec4 b = getPreluActivationWeightsAtOutCoords ( ) ;
$ { i }
} ` :l?m= ` vec4 activation ( vec4 a ) {
vec4 b = getLeakyreluAlphaAtOutCoords ( ) ;
$ { i }
} ` :m= ` vec4 activation ( vec4 x ) {
$ { i }
} ` ,y="result = activation(result);");let A=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= `
$ { m }
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 , $ { h } ) ;
vec4 b = getMatrixB ( batchB , $ { d } ) ;
// These swizzled products need to be separately added.
// See: https://github.com/tensorflow/tfjs/issues/1735
result += ( $ { p [ 0 ] } * $ { f [ 0 ] } ) ;
result += ( $ { p [ 1 ] } * $ { f [ 1 ] } ) ;
2021-03-29 21:01:16 +02:00
}
2021-04-17 00:03:15 +02:00
return result ;
}
void main ( ) {
ivec3 rc = getOutputCoords ( ) ;
vec4 result = dot2x2ARowBCol ( rc ) ;
$ { A }
$ { y }
setOutput ( result ) ;
}
` }},Y3={REAL:"return areal * breal - aimag * bimag;",IMAG:"return areal * bimag + aimag * breal;"},J3=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 ) ) ;
}
` }},Q3="return a * b;";function Ty(e){let{inputs:t,backend:n}=e,{a:r,b:a}=t,s=C.upcastType(r.dtype,a.dtype);if(r.dtype==="complex64"){let o=n.texData.get(r.dataId),l=n.texData.get(a.dataId),c=new J3(Y3.REAL,r.shape,a.shape),u=new J3(Y3.IMAG,r.shape,a.shape),h=[{dataId:o.complexTensorInfos.real.dataId,dtype:o.complexTensorInfos.real.dtype,shape:r.shape},{dataId:o.complexTensorInfos.imag.dataId,dtype:o.complexTensorInfos.imag.dtype,shape:r.shape},{dataId:l.complexTensorInfos.real.dataId,dtype:l.complexTensorInfos.real.dtype,shape:a.shape},{dataId:l.complexTensorInfos.imag.dataId,dtype:l.complexTensorInfos.imag.dtype,shape:a.shape}],d=n.runWebGLProgram(c,h,"float32"),p=n.runWebGLProgram(u,h,"float32"),f=qa({inputs:{real:d,imag:p},backend:n});return n.disposeIntermediateTensorInfo(d),n.disposeIntermediateTensorInfo(p),f}if(n.shouldExecuteOnCPU([r,a])){let o=n.texData.get(r.dataId),l=n.texData.get(a.dataId),[c,u]=yW(r.shape,a.shape,o.values,l.values,s),h=n.makeTensorInfo(u,s),d=n.texData.get(h.dataId);return d.values=c,h}let i;return J().getBool("WEBGL_PACK_BINARY_OPERATIONS")?i=new vc(Q3,r.shape,a.shape):i=new Bl(Q3,r.shape,a.shape),n.runWebGLProgram(i,[r,a],s)}var cB={kernelName:Ls,backendName:"webgl",kernelFunc:Ty};function hB(e,t,n){let r=[Si(e.shape),...Ni(e.shape)],a={dtype:e.dtype,shape:r,dataId:e.dataId},s=[Si(t),...Ni(t)],i=new z3(s,r),o=!0,l=n.runWebGLProgram(i,[a],e.dtype,null,o);return{dataId:l.dataId,shape:t,dtype:l.dtype}}function Ae(e){let{inputs:t,backend:n,attrs:r}=e,{x:a}=t,{shape:s}=r,i=n,o=_.sizeFromShape(a.shape),l=_.inferFromImplicitShape(s,o),c=_.sizeFromShape(l);_.assert(o===c,()=> ` The new shape ( $ { l } ) has $ { c } elements and the old shape ( $ { a . shape } ) has $ { o } elements . The new shape and old shape must have the same number of elements . ` );let u=i.texData.get(a.dataId);return u.isPacked&&!gc(a.shape,l)&&!(u.texture!==null&&gc(u.shape,l))?hB(a,l,i):(i.incRef(a.dataId),{dataId:a.dataId,shape:l,dtype:a.dtype})}var dB={kernelName:Go,backendName:"webgl",kernelFunc:Ae},e7=class{constructor(e,t){this.variableNames=["x"];let{windowSize:n,batchSize:r,inSize:a,outSize:s}=e;this.outputShape=[r,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 * $ { _ . isInt ( u ) ? u . toPrecision ( 2 ) : u } , ones ) ; ` }let c="";a%n>0&&(c= `
if ( inIdx < 0 || inIdx >= $ { a } ) {
return 0.0 ;
2021-03-29 21:01:16 +02:00
}
2021-04-17 00:03:15 +02:00
` ),this.userCode= `
const vec4 ones = vec4 ( 1.0 , 1.0 , 1.0 , 1.0 ) ;
float getValue ( int batch , int inIdx ) {
$ { c }
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-29 21:01:16 +02:00
}
2021-04-17 00:03:15 +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-15 21:01:27 +02:00
}
2021-04-17 00:03:15 +02:00
setOutput ( sumValue ) ;
}
` }},pB=class{constructor(e,t){this.variableNames=["x"];let{windowSize:n,batchSize:r,inSize:a,outSize:s}=e;this.outputShape=[r,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 c=Math.floor(n/4)*4,u=n%4,h= `
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 ) ;
}
` ,d="vec4";t==="all"?(i="1.0",h= `
bool reducedAllValue = all ( values ) ;
float floatedReducedAllValue = float ( reducedAllValue ) ;
allValue = float ( allValue >= 1.0 && floatedReducedAllValue >= 1.0 ) ;
` ,d="bvec4"):t==="any"&&(i="0.0",h= `
bool reducedAnyValue = any ( values ) ;
float floatedReducedAnyValue = float ( reducedAnyValue ) ;
anyValue = float ( anyValue >= 1.0 || floatedReducedAnyValue >= 1.0 ) ;
` ,d="bvec4");let p="";a%n>0&&(p= `
if ( inIdx < 0 || inIdx >= $ { a } ) {
return initializationValue ;
2021-04-15 21:01:27 +02:00
}
2021-04-17 00:03:15 +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 ) {
$ { p }
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 < $ { c } ; i += 4 ) {
int inIdx = inOffset + i ;
$ { d } values = $ { d } (
getValue ( batch , inIdx ) ,
getValue ( batch , inIdx + 1 ) ,
getValue ( batch , inIdx + 2 ) ,
getValue ( batch , inIdx + 3 )
) ;
$ { h }
2021-04-15 21:01:27 +02:00
}
2021-04-17 00:03:15 +02:00
int inIdx = inOffset + $ { c } ;
if ( $ { u === 1 } ) {
$ { d } values = $ { d } (
getValue ( batch , inIdx ) ,
initializationValue ,
initializationValue ,
initializationValue
) ;
$ { h }
} else if ( $ { u === 2 } ) {
$ { d } values = $ { d } (
getValue ( batch , inIdx ) ,
getValue ( batch , inIdx + 1 ) ,
initializationValue ,
initializationValue
) ;
$ { h }
} else if ( $ { u === 3 } ) {
$ { d } values = $ { d } (
getValue ( batch , inIdx ) ,
getValue ( batch , inIdx + 1 ) ,
getValue ( batch , inIdx + 2 ) ,
initializationValue
) ;
$ { h }
2021-04-15 21:01:27 +02:00
}
2021-04-17 00:03:15 +02:00
setOutput ( $ { l } ) ;
}
` }};function fB(e){let t=[];for(;t.length===0||t[t.length-1].outSize!==1;){let n=t.length?t[t.length-1].outSize:e[1],r=C.computeOptimalWindowSize(n);t.push({inSize:n,windowSize:r,outSize:Math.ceil(n/r)})}return t}function Ri(e,t,n,r){let a=fB(e.shape),s=e;for(let i=0;i<a.length;i++){let{inSize:o,windowSize:l,outSize:c}=a[i],u,h;n==="mean"?u=i===0?new e7({windowSize:l,inSize:o,batchSize:e.shape[0],outSize:c},o):new e7({windowSize:l,inSize:o,batchSize:e.shape[0],outSize:c}):u=new pB({windowSize:l,inSize:o,batchSize:e.shape[0],outSize:c},n),h=s,s=r.runWebGLProgram(u,[s],t),h.dataId!==e.dataId&&r.disposeIntermediateTensorInfo(h)}return s}var yB=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 r=lt(this.rank),a=mB(t);this.userCode= `
void main ( ) {
$ { r } resRC = getOutputCoords ( ) ;
setOutput ( getA ( $ { a } ) ) ;
}
` }};function mB(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"],r=new Array(t);for(let a=0;a<e.length;a++)r[e[a]]=n[a];return r.join()}var AB=class{constructor(e,t){this.variableNames=["A"],this.packedInputs=!0,this.packedOutput=!0;let n=new Array(e.length);for(let c=0;c<n.length;c++)n[c]=e[t[c]];if(this.outputShape=n,this.rank=n.length,this.rank>6)throw Error( ` Packed transpose for rank $ { this . rank } is not yet supported . ` );let r=lt(this.rank),a=O3("rc",this.rank),s=new Array(this.rank);for(let c=0;c<t.length;c++)s[t[c]]=a[c];let i= ` vec2 ( $ { s . slice ( - 2 ) . join ( ) } ) ` ,o= ` ++ $ { a [ this . rank - 1 ] } < $ { n [ this . rank - 1 ] } ` ,l= ` getChannel ( getA ( $ { s . join ( ) } ) , $ { i } ) ` ;this.userCode= `
void main ( ) {
$ { r } rc = getOutputCoords ( ) ;
vec4 result = vec4 ( 0. ) ;
result [ 0 ] = $ { l } ;
if ( $ { o } ) {
result [ 1 ] = $ { l } ;
}
-- $ { a [ this . rank - 1 ] } ;
if ( ++ $ { a [ this . rank - 2 ] } < $ { n [ this . rank - 2 ] } ) {
result [ 2 ] = $ { l } ;
if ( $ { o } ) {
result [ 3 ] = $ { l } ;
2021-04-15 21:01:27 +02:00
}
2021-04-17 00:03:15 +02:00
}
setOutput ( result ) ;
}
` }};function kp(e,t,n){let r=J().getBool("WEBGL_PACK_ARRAY_OPERATIONS")?new AB(e.shape,t):new yB(e.shape,t);return n.runWebGLProgram(r,[e],e.dtype)}function gB(e,t,n,r){let a=t,s=e.shape.length,i=_.parseAxisParam(a,e.shape),o=i,l=C.getAxesPermutation(o,s),c=l!=null,u=e;c&&(u=kp(e,l,r),o=C.getInnerMostAxes(o.length,s)),C.assertAxesAreInnerMostDims("sum",o,s);let[h,d]=C.computeOutAndReduceShapes(u.shape,o),p=h;n&&(p=C.expandShapeToKeepDim(h,i));let f=_.sizeFromShape(d),m=_.sizeFromShape(e.shape)/f,y=Ae({inputs:{x:u},attrs:{shape:[m,f]},backend:r}),A=yd(e.dtype),g=Ri(y,A,"sum",r),x=Ae({inputs:{x:g},attrs:{shape:p},backend:r});return r.disposeIntermediateTensorInfo(y),r.disposeIntermediateTensorInfo(g),c&&r.disposeIntermediateTensorInfo(u),x}function Ip(e){let{inputs:t,backend:n,attrs:r}=e,{x:a}=t,{axis:s,keepDims:i}=r;return gB(a,s,i,n)}var xB={kernelName:Qs,backendName:"webgl",kernelFunc:Ip};function fn(e){let{inputs:t,backend:n,attrs:r}=e,{x:a}=t,{perm:s}=r,i=n,o=a.shape.length,l=new Array(o);for(let u=0;u<l.length;u++)l[u]=a.shape[s[u]];let c;if(i.shouldExecuteOnCPU([a])){let u=i.texData.get(a.dataId).values,h=Sy(u,a.shape,a.dtype,s,l);c=i.makeTensorInfo(l,a.dtype);let d=i.texData.get(c.dataId);d.values=h}else c=kp(a,s,i);return c}var wB={kernelName:si,backendName:"webgl",kernelFunc:fn},t7=1e3;function Sp({a:e,b:t,transposeA:n,transposeB:r,backend:a,bias:s=null,preluActivationWeights:i=null,leakyreluAlpha:o=0,activation:l=null}){let c=e.shape.length,u=t.shape.length,h=n?e.shape[c-2]:e.shape[c-1],d=r?t.shape[u-1]:t.shape[u-2],p=n?e.shape[c-1]:e.shape[c-2],f=r?t.shape[u-2]:t.shape[u-1],m=e.shape.slice(0,-2),y=t.shape.slice(0,-2),A=_.sizeFromShape(m),g=_.sizeFromShape(y),x=A===g||A===1||g===1;_.assert(c>=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 ( $ { m } ) and ( $ { y } ) . ` );let v=(A>g?e.shape.slice(0,-2):t.shape.slice(0,-2)).concat([p,f]);_.assert(h===d,()=> ` Error in matMul : inner shapes ( $ { h } ) and ( $ { d } ) of Tensors with shapes $ { e . shape } and $ { t . shape } and transposeA = $ { n } and transposeB = $ { r } must match . ` );let w=n?[A,h,p]:[A,p,h],b=r?[g,f,d]:[g,d,f],k=Ae({inputs:{x:e},backend:a,attrs:{shape:w}}),N=Ae({inputs:{x:t},backend:a,attrs:{shape:b}}),E=[k,N],F=Math.max(A,g),O=n?k.shape[1]:k.shape[2],L=s!=null,V=i!=null,j=l==="leakyrelu",U=l!=null?vp(l,!0):null,X=L||V||j||U!=null,G;if((p===1||f===1)&&O>t7&&X===!1){let Y=k,ae=N;n&&(Y=fn({inputs:{x:k},backend:a,attrs:{perm:[0,2,1]}}),E.push(Y)),r&&(ae=fn({inputs:{x:N},backend:a,attrs:{perm:[0,2,1]}}),E.push(ae));let te=f!==1,ie=f===1,Q=Y;te&&(Q=Ae({inputs:{x:Y},backend:a,attrs:{shape:[F,O,1]}}),E.push(Q));let he=f===1?2:1,oe=ae;ie&&(oe=Ae({inputs:{x:ae},backend:a,attrs:{shape:[F,1,O]}}),E.push(oe));let fe=Ty({inputs:{a:Q,b:oe},backend:a});G=Ip({inputs:{x:fe},backend:a,attrs:{axis:he,keepDims:!0}}),E.push(fe)}else{let Y=dr(e.dtype,t.dtype),ae=new Z3(w,b,[F,p,f],n,r,L,U,V,j),te=[k,N];if(s!=null&&te.push(s),V&&te.push(i),j){let ie=a.makeTensorInfo([],"float32",_.createScalarValue(o,"float32"));te.push(ie),E.push(ie)}G=a.runWebGLProgram(ae,te,Y)}let ee=Ae({inputs:{x:G},backend:a,attrs:{shape:v}});E.push(G);for(let Y of E)a.disposeIntermediateTensorInfo(Y);return ee}function bB(e){let{inputs:t,backend:n,attrs:r}=e,{a,b:s,bias:i,preluActivationWeights:o}=t,{transposeA:l,transposeB:c,activation:u,leakyreluAlpha:h}=r;return Sp({a,b:s,transposeA:l,transposeB:c,backend:n,bias:i,preluActivationWeights:o,leakyreluAlpha:h,activation:u})}var _B={kernelName:ii,backendName:"webgl",kernelFunc:bB},n7="return abs(x);";function vB(e){let{inputs:t,backend:n}=e,{x:r}=t;if(n.shouldExecuteOnCPU([r])&&r.dtype!=="complex64"){let s=n.texData.get(r.dataId),i=D3(s.values);return n.makeTensorInfo(r.shape,r.dtype,i)}let a;return J().getBool("WEBGL_PACK_UNARY_OPERATIONS")?a=new Ll(r.shape,n7):a=new Ga(r.shape,n7),n.runWebGLProgram(a,[r],r.dtype)}var kB={kernelName:so,backendName:"webgl",kernelFunc:vB},IB=Sr+ `
if ( abs ( x ) > 1. ) {
return NAN ;
}
return acos ( x ) ;
` ,SB=Xe({opSnippet:IB}),NB={kernelName:io,backendName:"webgl",kernelFunc:SB},TB=Sr+ `
if ( x < 1.0 ) return NAN ;
return log ( x + sqrt ( x * x - 1.0 ) ) ; ` ,EB=Xe({opSnippet:TB}),CB={kernelName:oo,backendName:"webgl",kernelFunc:EB},r7="return a + b;",RB=tn({opSnippet:r7,packedOpSnippet:r7,supportsComplex:!0,cpuKernelImpl:tW}),MB={kernelName:Ca,backendName:"webgl",kernelFunc:RB},FB=class{constructor(e,t){this.outputShape=[],this.outputShape=e,this.variableNames=t.map((a,s)=> ` T$ { s } ` );let n=[];this.variableNames.forEach(a=>{n.push( ` float v$ { a } = get$ { a } AtOutCoords ( ) ; ` )});let r=this.variableNames.map(a=> ` v$ { a } ` ).join(" + ");this.userCode= `
void main ( ) {
$ { n . join ( `
` )}
float result = $ { r } ;
setOutput ( result ) ;
}
` }}, $ B=class{constructor(e,t){this.outputShape=[],this.packedInputs=!0,this.packedOutput=!0,this.outputShape=e,this.variableNames=t.map((a,s)=> ` T$ { s } ` );let n=[];this.variableNames.forEach(a=>{n.push( ` vec4 v$ { a } = get$ { a } AtOutCoords ( ) ; ` )});let r=this.variableNames.map(a=> ` v$ { a } ` ).join(" + ");this.userCode= `
void main ( ) {
$ { n . join ( `
` )}
vec4 result = $ { r } ;
setOutput ( result ) ;
}
` }};function Np(e){let{inputs:t,backend:n}=e,r=t;if(r.length===1)return Vn({inputs:{x:r[0]},backend:n});if(r.length>J().get("WEBGL_MAX_TEXTURES_IN_SHADER")){let o=Math.floor(r.length/2),l=Np({inputs:r.slice(0,o),backend:n}),c=Np({inputs:r.slice(o),backend:n});return Np({inputs:[l,c],backend:n})}let a=r.map(o=>o.dtype).reduce((o,l)=>dr(o,l)),s=r.map(o=>o.shape),i=J().getBool("WEBGL_PACK")?new $ B(r[0].shape,s):new FB(r[0].shape,s);return n.runWebGLProgram(i,r,a)}var DB={kernelName:ds,backendName:"webgl",kernelFunc:Np};function OB(e){let{inputs:t,backend:n,attrs:r}=e,{x:a}=t,{axis:s,keepDims:i}=r,o=a.shape.length,l=_.parseAxisParam(s,a.shape),c=l,u=C.getAxesPermutation(c,o),h=a;u!=null&&(h=fn({inputs:{x:a},backend:n,attrs:{perm:u}}),c=C.getInnerMostAxes(c.length,o)),C.assertAxesAreInnerMostDims("all",c,o);let[d,p]=C.computeOutAndReduceShapes(h.shape,c),f=_.sizeFromShape(p),m=Ae({inputs:{x:h},backend:n,attrs:{shape:[-1,f]}}),y=Ri(m,m.dtype,"all",n),A;if(i){let g=C.expandShapeToKeepDim(d,l);A=Ae({inputs:{x:y},backend:n,attrs:{shape:g}})}else A=Ae({inputs:{x:y},backend:n,attrs:{shape:d}});return n.disposeIntermediateTensorInfo(m),n.disposeIntermediateTensorInfo(y),u!=null&&n.disposeIntermediateTensorInfo(h),A}var zB={kernelName:lo,backendName:"webgl",kernelFunc:OB};function PB(e){let{inputs:t,backend:n,attrs:r}=e,{x:a}=t,{axis:s,keepDims:i}=r,o=a.shape.length,l=_.parseAxisParam(s,a.shape),c=l,u=C.getAxesPermutation(c,o),h=a;u!=null&&(h=fn({inputs:{x:a},backend:n,attrs:{perm:u}}),c=C.getInnerMostAxes(c.length,o)),C.assertAxesAreInnerMostDims("any",c,o);let[d,p]=C.computeOutAndReduceShapes(h.shape,c),f=_.sizeFromShape(p),m=Ae({inputs:{x:h},backend:n,attrs:{shape:[-1,f]}}),y=Ri(m,m.dtype,"any",n),A;if(i){let g=C.expandShapeToKeepDim(d,l);A=Ae({inputs:{x:y},backend:n,attrs:{shape:g}})}else A=Ae({inputs:{x:y},backend:n,attrs:{shape:d}});return n.disposeIntermediateTensorInfo(m),n.disposeIntermediateTensorInfo(y),u!=null&&n.disposeIntermediateTensorInfo(h),A}var LB={kernelName:uo,backendName:"webgl",kernelFunc:PB},WB=class{constructor(e,t,n){this.variableNames=["A"];let{windowSize:r,batchSize:a,outSize:s}=e;n||this.variableNames.push("bestIndicesA"),this.outputShape=[a,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 * $ { r } ;
int bestIndex = inOffset ;
float bestValue = getA ( batch , bestIndex ) ;
for ( int i = 0 ; i < $ { r } ; i ++ ) {
int inIdx = $ { o } ;
float candidate = getA ( batch , inIdx ) ;
if ( candidate $ { i } bestValue ) {
bestValue = candidate ;
bestIndex = inIdx ;
2021-04-15 21:01:27 +02:00
}
}
2021-04-17 00:03:15 +02:00
setOutput ( float ( bestIndex ) ) ;
}
` }},BB=class{constructor(e,t,n,r){this.variableNames=["A"],this.packedInputs=!0,this.packedOutput=!0,_.assert(e.length>2,()=> ` Packed arg$ { n . charAt ( 0 ) . toUpperCase ( ) + n . slice ( 1 ) } supports only inputs with rank above 2. ` );let a=e[e.length-1],s=Math.ceil(a/t);this.outputShape=e.slice(0,-1),s>1&&this.outputShape.push(s),r||this.variableNames.push("bestIndicesA");let i=this.outputShape,o=i.length,l=lt(o),c=pn("coords",o),u,h;if(s===1){h=o+1;let k=lt(h);u= `
$ { k } sourceLocR = $ { k } ( $ { c . join ( ) } , 0 ) ;
++ $ { c [ o - 1 ] } ;
$ { k } sourceLocG = $ { k } ( $ { c . join ( ) } , 0 ) ;
++ $ { c [ o - 2 ] } ;
$ { k } sourceLocA = $ { k } ( $ { c . join ( ) } , 0 ) ;
-- $ { c [ o - 1 ] } ;
$ { k } sourceLocB = $ { k } ( $ { c . join ( ) } , 0 ) ;
-- $ { c [ o - 2 ] } ; ` }else h=o,u= `
$ { l } sourceLocR = coords ;
++ $ { c [ o - 1 ] } ;
$ { l } sourceLocG = coords ;
++ $ { c [ o - 2 ] } ;
$ { l } sourceLocA = coords ;
-- $ { c [ o - 1 ] } ;
$ { l } sourceLocB = coords ;
-- $ { c [ o - 2 ] } ; ` ;let d=["x","y","z","w","u","v"].slice(0,h),p="."+d[h-1],f=d.map(k=>"int "+k),m=pn("sourceLocR",h-1).concat("inIdx.r"),y=pn("sourceLocG",h-1).concat("inIdx.g"),A=pn("sourceLocB",h-1).concat("inIdx.b"),g=pn("sourceLocA",h-1).concat("inIdx.a"),x=n==="max"?"greaterThan":"lessThan",v=r?"": `
inIdx = round ( vec4 ( getBestIndicesAChannel ( $ { m . join ( ) } ) ,
getBestIndicesAChannel ( $ { y . join ( ) } ) ,
getBestIndicesAChannel ( $ { A . join ( ) } ) ,
getBestIndicesAChannel ( $ { g . join ( ) } ) ) ) ; ` ,w= ` vec4 (
getAChannel ( $ { m . join ( ) } ) ,
hasNextCol ? getAChannel ( $ { y . join ( ) } ) : 0. ,
hasNextRow ? getAChannel ( $ { A . join ( ) } ) : 0. ,
hasNextRow && hasNextCol ? getAChannel ( $ { g . join ( ) } ) : 0. ) ` ,b=r?"": `
float getBestIndicesAChannel ( $ { f . join ( ) } ) {
return getChannel ( getBestIndicesA ( $ { d . join ( ) } ) ,
vec2 ( $ { d . slice ( - 2 ) . join ( ) } ) ) ;
} ` ;this.userCode= `
float getAChannel ( $ { f . join ( ) } ) {
return getChannel ( getA ( $ { d . join ( ) } ) ,
vec2 ( $ { d . slice ( - 2 ) . join ( ) } ) ) ;
}
$ { b }
void main ( ) {
$ { l } coords = getOutputCoords ( ) ;
bool hasNextCol = $ { c [ o - 1 ] } < $ { i [ o - 1 ] - 1 } ;
bool hasNextRow = $ { c [ o - 2 ] } < $ { i [ o - 2 ] - 1 } ;
$ { u }
ivec4 srcIdx = ivec4 ( sourceLocR$ { p } , sourceLocG$ { p } ,
sourceLocB$ { p } , sourceLocA$ { p } ) * $ { t } ;
ivec4 inIdx = srcIdx ;
vec4 bestIndex = vec4 ( inIdx ) ;
vec4 bestValue = $ { w } ;
for ( int i = 0 ; i < $ { t } ; i ++ ) {
inIdx = srcIdx ;
$ { v }
vec4 candidate = $ { w } ;
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-15 21:01:27 +02:00
}
2021-04-17 00:03:15 +02:00
setOutput ( bestIndex ) ;
}
` }};function a7(e,t,n,r=null){let a=t.shape[0],s=t.shape[1];r!=null&&(a=r.shape[0],s=r.shape[1]);let i=C.computeOptimalWindowSize(s),o={windowSize:i,inSize:s,batchSize:a,outSize:Math.ceil(s/i)},l=new WB(o,n,r==null),c=[t];r!=null&&c.push(r);let u=e.runWebGLProgram(l,c,"int32");if(u.shape[1]===1)return u;let h=a7(e,t,n,u);return e.disposeIntermediateTensorInfo(u),h}function s7(e,t,n,r=null){let a=r!=null?r.shape:t.shape,s=a[a.length-1],i=C.computeOptimalWindowSize(s),o=new BB(a,i,n,r==null),l=r==null?[t]:[t,r],c=e.runWebGLProgram(o,l,"int32");if(c.shape.length===t.shape.length){let u=s7(e,t,n,c);return e.disposeIntermediateTensorInfo(c),u}return c}function i7(e,t,n,r){let a=[n];if(C.assertAxesAreInnerMostDims("arg"+r.charAt(0).toUpperCase()+r.slice(1),a,t.shape.length),!J().getBool("WEBGL_PACK_REDUCE")||t.shape.length<=2){let s=[],[i,o]=C.computeOutAndReduceShapes(t.shape,a),l=_.sizeFromShape(o),c=Ae({inputs:{x:t},backend:e,attrs:{shape:[-1,l]}});s.push(c);let u=a7(e,c,r);s.push(u);let h=Ae({inputs:{x:u},backend:e,attrs:{shape:i}});return s.forEach(d=>e.disposeIntermediateTensorInfo(d)),h}return s7(e,t,r)}function VB(e){let{inputs:t,backend:n,attrs:r}=e,{x:a}=t,{axis:s}=r,i=_.parseAxisParam(s,a.shape),o=C.getAxesPermutation(i,a.shape.length),l=a,c=[];o!=null&&(l=fn({inputs:{x:a},backend:n,attrs:{perm:o}}),c.push(l),i=C.getInnerMostAxes(i.length,l.shape.length)),C.assertAxesAreInnerMostDims("argMax",[i[0]],l.shape.length);let u=i7(n,l,i[0],"max");return c.forEach(h=>n.disposeIntermediateTensorInfo(h)),u}var jB={kernelName:ps,backendName:"webgl",kernelFunc:VB};function UB(e){let{inputs:t,backend:n,attrs:r}=e,{x:a}=t,{axis:s}=r,i=_.parseAxisParam(s,a.shape),o=C.getAxesPermutation(i,a.shape.length),l=a,c=[];o!=null&&(l=fn({inputs:{x:a},backend:n,attrs:{perm:o}}),c.push(l),i=C.getInnerMostAxes(i.length,l.shape.length)),C.assertAxesAreInnerMostDims("argMin",[i[0]],l.shape.length);let u=i7(n,l,i[0],"min");return c.forEach(h=>n.disposeIntermediateTensorInfo(h)),u}var HB={kernelName:vu,backendName:"webgl",kernelFunc:UB},GB=Sr+ `
if ( abs ( x ) > 1. ) {
return NAN ;
}
return asin ( x ) ;
` ,qB=Xe({opSnippet:GB}),XB={kernelName:co,backendName:"webgl",kernelFunc:qB},KB=Sr+"return log(x + sqrt(x * x + 1.0));",ZB=Xe({opSnippet:KB}),YB={kernelName:ho,backendName:"webgl",kernelFunc:ZB},JB=Sr+ `
return atan ( x ) ;
` ,QB=Xe({opSnippet:JB}),eV={kernelName:po,backendName:"webgl",kernelFunc:QB},tV=lB+ `
return atan ( a , b ) ;
` ,nV= `
vec4 result = atan ( a , b ) ;
vec4 isNaN = min ( vec4 ( isnan ( a ) ) + vec4 ( isnan ( b ) ) , vec4 ( 1.0 ) ) ;
` +uB+ `
return result ;
` ,rV=tn({opSnippet:tV,packedOpSnippet:nV}),aV={kernelName:mo,backendName:"webgl",kernelFunc:rV},sV=Sr+ `
if ( ( x < - 1.0 ) || ( x > 1.0 ) ) return NAN ;
return ( log ( 1.0 + x ) - log ( 1.0 - x ) ) / 2.0 ; ` ,iV=Xe({opSnippet:sV}),oV={kernelName:fo,backendName:"webgl",kernelFunc:iV},kc=class{constructor(e,t,n,r=!1,a=!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,c=e.dilationWidth,u=e.effectiveFilterHeight,h=e.effectiveFilterWidth,d=e.padInfo.top,p=e.padInfo.left;this.outputShape=e.outShape;let f=t==="avg",m= ` ( ( batch * $ { e . inHeight } + xR ) * $ { e . inWidth } + xC ) * $ { e . inChannels } + d ` ,y= ` ( xR * $ { e . inWidth } + xC ) * $ { e . inChannels } + d ` ,A="0.0";if(f||(A="-1.0 / 1e-20"),n){let k=">=";this.userCode= `
const ivec2 strides = ivec2 ( $ { i } , $ { o } ) ;
const ivec2 pads = ivec2 ( $ { d } , $ { p } ) ;
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-15 21:01:27 +02:00
}
2021-04-17 00:03:15 +02:00
for ( int wC = 0 ; wC < $ { h } ;
wC += $ { c } ) {
int xC = xCCorner + wC ;
if ( xC < 0 || xC >= $ { e . inWidth } ) {
continue ;
2021-03-30 15:03:18 +02:00
}
2021-04-17 00:03:15 +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 $ { k } currMinMaxValue ) {
minMaxValue = value ;
minMaxValueFound = 1.0 ;
minMaxPosition = $ { r ? a ? m : y : ` wR * ${ h } + wC ` } ;
2021-03-30 15:03:18 +02:00
}
2021-03-27 20:45:37 +01:00
}
}
2021-04-17 00:03:15 +02:00
setOutput ( float ( minMaxPosition ) ) ;
2021-03-24 16:08:49 +01:00
}
2021-04-17 00:03:15 +02:00
` ;return}let g="max",x= ` $ { t } ( $ { t } ( $ { t } ( minMaxValue [ 0 ] , minMaxValue [ 1 ] ) , minMaxValue [ 2 ] ) , minMaxValue [ 3 ] ) ` ;t==="avg"&&(x="avgValue / count");let v=Math.floor(s/4)*4,w=s%4,b= `
if ( $ { f } ) {
avgValue += dot ( values , ones ) ;
} else {
minMaxValue = $ { g } ( values , minMaxValue ) ;
}
` ;this.userCode= `
const ivec2 strides = ivec2 ( $ { i } , $ { o } ) ;
const ivec2 pads = ivec2 ( $ { d } , $ { p } ) ;
const float initializationValue = $ { A } ;
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-15 21:01:27 +02:00
}
2021-04-17 00:03:15 +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 ( $ { A } ) ;
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-15 21:01:27 +02:00
}
2021-04-17 00:03:15 +02:00
for ( int wC = 0 ; wC < $ { v } ; wC += 4 ) {
int xC = xCCorner + wC * $ { c } ;
vec4 values = vec4 (
getValue ( batch , xR , xC , d ) ,
getValue ( batch , xR , xC + $ { c } , d ) ,
getValue ( batch , xR , xC + 2 * $ { c } , d ) ,
getValue ( batch , xR , xC + 3 * $ { c } , d )
) ;
$ { b }
2021-04-15 21:01:27 +02:00
}
2021-04-17 00:03:15 +02:00
int xC = xCCorner + $ { v } ;
if ( $ { w === 1 } ) {
vec4 values = vec4 (
getValue ( batch , xR , xC , d ) ,
initializationValue ,
initializationValue ,
initializationValue
) ;
$ { b }
} else if ( $ { w === 2 } ) {
vec4 values = vec4 (
getValue ( batch , xR , xC , d ) ,
getValue ( batch , xR , xC + $ { c } , d ) ,
initializationValue ,
initializationValue
) ;
$ { b }
} else if ( $ { w === 3 } ) {
vec4 values = vec4 (
getValue ( batch , xR , xC , d ) ,
getValue ( batch , xR , xC + $ { c } , d ) ,
getValue ( batch , xR , xC + 2 * $ { c } , d ) ,
initializationValue
) ;
$ { b }
2021-04-15 21:01:27 +02:00
}
}
2021-04-17 00:03:15 +02:00
setOutput ( $ { x } ) ;
}
` }},Ey=class{constructor(e,t,n,r=!1,a=!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,c=e.dilationDepth,u=e.dilationHeight,h=e.dilationWidth,d=e.effectiveFilterDepth,p=e.effectiveFilterHeight,f=e.effectiveFilterWidth,m=e.padInfo.front,y=e.padInfo.top,A=e.padInfo.left;this.outputShape=e.outShape;let g=t==="avg",x="0.0";if(g||(x="-1.0 / 1e-20"),n){let E=">=";this.userCode= `
const ivec3 strides =
ivec3 ( $ { i } , $ { o } , $ { l } ) ;
const ivec3 pads = ivec3 ( $ { m } , $ { y } , $ { A } ) ;
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 < $ { d } ;
wD += $ { c } ) {
int xD = xDCorner + wD ;
if ( xD < 0 || xD >= $ { e . inDepth } ) {
continue ;
2021-04-15 21:01:27 +02:00
}
2021-04-17 00:03:15 +02:00
for ( int wR = 0 ; wR < $ { p } ;
wR += $ { u } ) {
int xR = xRCorner + wR ;
if ( xR < 0 || xR >= $ { e . inHeight } ) {
continue ;
}
for ( int wC = 0 ; wC < $ { f } ;
wC += $ { h } ) {
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 $ { E } currMinMaxValue ) {
minMaxValue = value ;
minMaxValueFound = 1.0 ;
minMaxPosition = $ { r ? a ? ` (((batch * ${ e . inDepth } + xD) * ${ e . inHeight } + xR) * ${ e . inWidth } + xC) * ${ e . inChannels } + ch ` : ` ((xD * ${ e . inHeight } + xR) * ${ e . inWidth } + xC) * ${ e . inChannels } + ch ` : ` wD * ${ p } * ${ f } +
wR * $ { f } + wC ` };
}
2021-03-29 21:01:16 +02:00
}
}
2021-03-27 20:45:37 +01:00
}
2021-04-17 00:03:15 +02:00
setOutput ( float ( minMaxPosition ) ) ;
2021-04-15 21:01:27 +02:00
}
2021-04-17 00:03:15 +02:00
` ;return}let v="max",w= ` $ { t } ( $ { t } ( $ { t } ( minMaxValue [ 0 ] , minMaxValue [ 1 ] ) , minMaxValue [ 2 ] ) , minMaxValue [ 3 ] ) ` ;t==="avg"&&(w="avgValue / count");let b=Math.floor(s/4)*4,k=s%4,N= `
if ( $ { g } ) {
avgValue += dot ( values , ones ) ;
} else {
minMaxValue = $ { v } ( values , minMaxValue ) ;
}
` ;this.userCode= `
const ivec3 strides =
ivec3 ( $ { i } , $ { o } , $ { l } ) ;
const ivec3 pads = ivec3 ( $ { m } , $ { y } , $ { A } ) ;
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-15 21:01:27 +02:00
}
2021-04-17 00:03:15 +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 < $ { d } ;
wD += $ { c } ) {
int xD = xDCorner + wD ;
if ( xD < 0 || xD >= $ { e . inDepth } ) {
continue ;
2021-04-15 21:01:27 +02:00
}
2021-04-17 00:03:15 +02:00
for ( int wR = 0 ; wR < $ { p } ;
wR += $ { u } ) {
int xR = xRCorner + wR ;
if ( xR < 0 || xR >= $ { e . inHeight } ) {
continue ;
2021-03-27 20:45:37 +01:00
}
2021-04-17 00:03:15 +02:00
for ( int wC = 0 ; wC < $ { b } ; wC += 4 ) {
int xC = xCCorner + wC * $ { h } ;
vec4 values = vec4 (
getValue ( batch , xD , xR , xC , ch ) ,
getValue ( batch , xD , xR , xC + $ { h } , ch ) ,
getValue ( batch , xD , xR , xC + 2 * $ { h } , ch ) ,
getValue ( batch , xD , xR , xC + 3 * $ { h } , ch )
) ;
$ { N }
}
int xC = xCCorner + $ { b } ;
if ( $ { k === 1 } ) {
vec4 values = vec4 (
getValue ( batch , xD , xR , xC , ch ) ,
initializationValue ,
initializationValue ,
initializationValue
) ;
$ { N }
} else if ( $ { k === 2 } ) {
vec4 values = vec4 (
getValue ( batch , xD , xR , xC , ch ) ,
getValue ( batch , xD , xR , xC + $ { h } , ch ) ,
initializationValue ,
initializationValue
) ;
$ { N }
} else if ( $ { k === 3 } ) {
vec4 values = vec4 (
getValue ( batch , xD , xR , xC , ch ) ,
getValue ( batch , xD , xR , xC + $ { h } , ch ) ,
getValue ( batch , xD , xR , xC + 2 * $ { h } , ch ) ,
initializationValue
) ;
$ { N }
2021-03-27 20:45:37 +01:00
}
2021-04-15 21:01:27 +02:00
}
2021-04-17 00:03:15 +02:00
setOutput ( $ { w } ) ;
2021-03-29 21:01:16 +02:00
}
2021-04-17 00:03:15 +02:00
}
` }};function lV(e){let{inputs:t,backend:n,attrs:r}=e,{x:a}=t;Fl(a,"avgPool");let{filterSize:s,strides:i,pad:o,dimRoundingMode:l}=r,c=1;_.assert(C.eitherStridesOrDilationsAreOne(i,c),()=> ` Error in avgPool : Either strides or dilations must be 1. Got strides $ { i } and dilations '${c}' ` );let u=C.computePool2DInfo(a.shape,s,i,c,o,l);if(u.filterWidth===1&&u.filterHeight===1&&_.arraysEqual(u.inShape,u.outShape))return Vn({inputs:{x:a},backend:n});let h=new kc(u,"avg",!1);return n.runWebGLProgram(h,[a],"float32")}var uV={kernelName:fs,backendName:"webgl",kernelFunc:lV};function cV(e){let{inputs:t,backend:n,attrs:r}=e,{x:a}=t,{filterSize:s,strides:i,pad:o,dimRoundingMode:l,dataFormat:c}=r,u=[1,1,1],h=C.computePool3DInfo(a.shape,s,i,u,o,l,c),d=new Ey(h,"avg",!1);return n.runWebGLProgram(d,[a],"float32")}var hV={kernelName:ku,backendName:"webgl",kernelFunc:cV},dV=class{constructor(e){this.variableNames=["dy"],this.outputShape=e.inShape;let t=e.filterHeight,n=e.filterWidth,r=e.strideHeight,a=e.strideWidth,s=e.dilationHeight,i=e.dilationWidth,o=e.effectiveFilterHeight,l=e.effectiveFilterWidth,c=o-1-e.padInfo.top,u=l-1-e.padInfo.left,h=1/(t*n);this.userCode= `
const ivec2 pads = ivec2 ( $ { c } , $ { u } ) ;
const float avgMultiplier = float ( $ { h } ) ;
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 ) / $ { r } . 0 ;
if ( dyR < 0.0 || dyR >= $ { e . outHeight } . 0 || fract ( dyR ) > 0.0 ) {
continue ;
2021-04-15 21:01:27 +02:00
}
2021-04-17 00:03:15 +02:00
int idyR = int ( dyR ) ;
for ( int wC = 0 ; wC < $ { l } ;
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 ( b , idyR , idyC , d ) ;
dotProd += dyValue * avgMultiplier ;
2021-03-29 21:01:16 +02:00
}
2021-04-15 21:01:27 +02:00
}
2021-04-17 00:03:15 +02:00
setOutput ( dotProd ) ;
}
` }},pV=class{constructor(e){this.variableNames=["dy"],this.outputShape=e.inShape;let t=e.filterDepth,n=e.filterHeight,r=e.filterWidth,a=e.strideDepth,s=e.strideHeight,i=e.strideWidth,o=e.dilationDepth,l=e.dilationHeight,c=e.dilationWidth,u=e.effectiveFilterDepth,h=e.effectiveFilterHeight,d=e.effectiveFilterWidth,p=u-1-e.padInfo.front,f=h-1-e.padInfo.top,m=d-1-e.padInfo.left,y=1/(t*n*r);this.userCode= `
const ivec3 pads = ivec3 ( $ { p } , $ { f } , $ { m } ) ;
const float avgMultiplier = float ( $ { y } ) ;
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 ) / $ { a } . 0 ;
if ( dyD < 0.0 || dyD >= $ { e . outDepth } . 0 || fract ( dyD ) > 0.0 ) {
continue ;
2021-04-15 21:01:27 +02:00
}
2021-04-17 00:03:15 +02:00
int idyD = int ( dyD ) ;
for ( int wR = 0 ; wR < $ { h } ;
wR += $ { l } ) {
float dyR = float ( dyRCorner + wR ) / $ { s } . 0 ;
if ( dyR < 0.0 || dyR >= $ { e . outHeight } . 0 ||
fract ( dyR ) > 0.0 ) {
continue ;
2021-04-15 21:01:27 +02:00
}
2021-04-17 00:03:15 +02:00
int idyR = int ( dyR ) ;
for ( int wC = 0 ; wC < $ { d } ;
wC += $ { c } ) {
float dyC = float ( dyCCorner + wC ) / $ { i } . 0 ;
if ( dyC < 0.0 || dyC >= $ { e . outWidth } . 0 ||
fract ( dyC ) > 0.0 ) {
continue ;
2021-03-30 15:03:18 +02:00
}
2021-04-17 00:03:15 +02:00
int idyC = int ( dyC ) ;
float dyValue = getDy ( batch , idyD , idyR , idyC , ch ) ;
dotProd += dyValue * avgMultiplier ;
2021-03-30 15:03:18 +02:00
}
}
2021-03-29 21:01:16 +02:00
}
2021-04-17 00:03:15 +02:00
setOutput ( dotProd ) ;
}
` }};function fV(e){let{inputs:t,backend:n,attrs:r}=e,{dy:a,input:s}=t,i=s,{filterSize:o,strides:l,pad:c,dimRoundingMode:u}=r,h=[1,1,1],d=C.computePool3DInfo(i.shape,o,l,h,c,u),p=new pV(d);return n.runWebGLProgram(p,[a],i.dtype)}var mV={kernelName:Oh,backendName:"webgl",kernelFunc:fV};function yV(e){let{inputs:t,backend:n,attrs:r}=e,{dy:a,input:s}=t,i=s;Fl([a,s],"avgPoolGrad");let{filterSize:o,strides:l,pad:c}=r,u=C.computePool2DInfo(i.shape,o,l,1,c),h=new dV(u);return n.runWebGLProgram(h,[a],i.dtype)}var AV={kernelName:Dh,backendName:"webgl",kernelFunc:yV};function gV(e){let{inputs:t,backend:n,attrs:r}=e,{a,b:s}=t,{transposeA:i,transposeB:o}=r;return Sp({a,b:s,transposeA:i,transposeB:o,backend:n})}var xV={kernelName:ms,backendName:"webgl",kernelFunc:gV},wV=class{constructor(e,t,n,r,a,s){this.outputShape=[],this.variableNames=["x","mean","variance"],C.assertAndGetBroadcastShape(e,t),C.assertAndGetBroadcastShape(e,n);let i="0.0";r!=null&&(C.assertAndGetBroadcastShape(e,r),this.variableNames.push("offset"),i="getOffsetAtOutCoords()");let o="1.0";a!=null&&(C.assertAndGetBroadcastShape(e,a),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 ) ) ) ;
}
` }},bV=class{constructor(e,t,n,r,a,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)";r!=null&&(C.assertAndGetBroadcastShape(e,r),this.variableNames.push("offset"),i="getOffsetAtOutCoords()");let o="vec4(1.0)";a!=null&&(C.assertAndGetBroadcastShape(e,a),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 ) ;
}
` }},_V=({inputs:e,backend:t,attrs:n})=>{let{x:r,mean:a,variance:s,offset:i,scale:o}=e;_.assert(a.shape.length===s.shape.length,()=>"Batch normalization gradient requires mean and variance to have equal ranks."),_.assert(i==null||a.shape.length===i.shape.length,()=>"Batch normalization gradient requires mean and offset to have equal ranks."),_.assert(o==null||a.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 c=[r,a,s],u=null;i!=null&&(u=i.shape,c.push(i));let h=null;o!=null&&(h=o.shape,c.push(o));let d=J().getBool("WEBGL_PACK_NORMALIZATION")?new bV(r.shape,a.shape,s.shape,u,h,l):new wV(r.shape,a.shape,s.shape,u,h,l);return t.runWebGLProgram(d,c,c[0].dtype)},vV={kernelName:Ns,backendName:"webgl",kernelFunc:_V},IV=class{constructor(e){this.variableNames=["source"],this.outputShape=e,this.rank=e.length;let t=lt(this.rank),n= ` uniform int start [ $ { this . rank } ] ; ` ,r=kV(this.rank),a,s=e.map((i,o)=> ` sourceLoc . $ { Cy [ o ] } = start [ $ { o } ] + coords . $ { Cy [ o ] } ; ` );a= `
$ { t } sourceLoc ;
$ { t } coords = getOutputCoords ( ) ;
$ { s . join ( `
` )}
` ,this.userCode= `
$ { n }
void main ( ) {
$ { a }
setOutput ( getSource ( $ { r } ) ) ;
}
` }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)}}},Cy=["x","y","z","w","u","v"];function kV(e){if(e===1)return"sourceLoc";if(e<=6)return Cy.slice(0,e).map(t=>"sourceLoc."+t).join(",");throw Error( ` Slicing for rank $ { e } is not yet supported ` )}var SV=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),r=pn("sourceLoc",this.rank),a=this.rank===1?"sourceLoc": ` vec2 ( $ { r . slice ( - 2 ) . join ( ) } ) ` ,s= ` getChannel ( getSource ( $ { r . join ( ) } ) , $ { a } ) ` ,i= `
result . x = $ { s } ;
if ( ++ $ { n [ this . rank - 1 ] } < $ { e [ this . rank - 1 ] } ) {
++ $ { r [ this . rank - 1 ] } ;
result . y = $ { s } ;
-- $ { r [ this . rank - 1 ] } ;
}
` ,o=this.rank===1?"": `
-- $ { n [ this . rank - 1 ] } ;
if ( ++ $ { n [ this . rank - 2 ] } < $ { e [ this . rank - 2 ] } ) {
++ $ { r [ this . rank - 2 ] } ;
result . z = $ { s } ;
if ( ++ $ { n [ this . rank - 1 ] } < $ { e [ this . rank - 1 ] } ) {
++ $ { r [ this . rank - 1 ] } ;
result . w = $ { s } ;
}
}
` ,l=this.rank<=4? ` sourceLoc = coords +
$ { t } ( $ { e . map ( ( c , u ) => ` start[ ${ u } ] ` ) . join ( ) } ) ; ` :e.map((c,u)=> ` $ { r [ 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 NV(e,t,n,r){let a=r.texData.get(e.dataId),s=r.makeTensorInfo(n,e.dtype),i=r.texData.get(s.dataId);Object.assign(i,a),i.refCount=1,i.shape=n,i.dtype=e.dtype;let o=un.computeFlatOffset(t,_.computeStrides(e.shape));a.slice&&(o+=a.slice.flatOffset),i.slice={flatOffset:o,origDataId:a.slice&&a.slice.origDataId||e.dataId};let l=r.dataRefCount.get(i.slice.origDataId)||1;return r.dataRefCount.set(i.slice.origDataId,l+1),s}function Ic(e){let{inputs:t,backend:n,attrs:r}=e,{x:a}=t,{begin:s,size:i}=r,[o,l]=un.parseSliceParams(a,s,i);if(un.assertParamsValid(a,o,l),_.sizeFromShape(l)===0)return n.makeTensorInfo(l,a.dtype,[]);if(n.shouldExecuteOnCPU([a])||a.dtype==="string"){let h=n.texData.get(a.dataId),d=bW(h.values,o,l,a.shape,a.dtype);return n.makeTensorInfo(l,a.dtype,d)}let{isPacked:c}=n.texData.get(a.dataId),u=un.isSliceContinous(a.shape,o,l);if(c||!u){let h=J().getBool("WEBGL_PACK_ARRAY_OPERATIONS")?new SV(l):new IV(l),d=h.getCustomSetupFunc(o);return n.runWebGLProgram(h,[a],a.dtype,d)}return n.uploadToGPU(a.dataId),NV(a,o,l,n)}var TV={kernelName:Zo,backendName:"webgl",kernelFunc:Ic},EV=e=>{let{inputs:t,backend:n,attrs:r}=e,{x:a}=t,{blockShape:s,crops:i}=r;_.assert(a.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(a.shape,s,o),c=C.getPermuted(l.length,s.length),u=C.getReshapedPermuted(a.shape,s,o),h=C.getSliceBeginCoords(i,s.length),d=C.getSliceSize(u,i,s.length),p=[],f=Ae({inputs:{x:a},backend:n,attrs:{shape:l}}),m=fn({inputs:{x:f},backend:n,attrs:{perm:c}}),y=Ae({inputs:{x:m},backend:n,attrs:{shape:u}}),A=Ic({inputs:{x:y},backend:n,attrs:{begin:h,size:d}});return p.push(f),p.push(m),p.push(y),p.forEach(g=>n.disposeIntermediateTensorInfo(g)),A},CV={kernelName:Iu,backendName:"webgl",kernelFunc:EV};function RV(e){let{inputs:t,backend:n,attrs:r}=e,{x:a,weights:s}=t,{size:i}=r,o=n.readSync(a.dataId),l=n.readSync(s.dataId),c= $ 3(o,l,s.dtype,s.shape,i);return n.makeTensorInfo([i],s.dtype,c)}var MV={kernelName:zh,backendName:"webgl",kernelFunc:RV},FV="return float(a != b);",o7=tn({opSnippet:FV,dtype:"bool"}), $ V={kernelName:Po,backendName:"webgl",kernelFunc:o7};function Sc(e){let{inputs:t,backend:n}=e,{input:r}=t,a=n.texData.get(r.dataId);return Vn({inputs:{x:a.complexTensorInfos.real},backend:n})}var DV={kernelName:sd,backendName:"webgl",kernelFunc:Sc},OV="return float(int(x));";function zV(e,t){let n=new Ga(e.shape,OV),r=t.runWebGLProgram(n,[e],"int32");return{dataId:r.dataId,shape:r.shape,dtype:r.dtype}}function Ry(e){let{inputs:t,backend:n,attrs:r}=e,{x:a}=t,{dtype:s}=r;if(s==="complex64"){if(a.dtype==="complex64")return Vn({inputs:{x:a},backend:n});let i=Rt(a.shape),o=Ry({inputs:{x:a},backend:n,attrs:{dtype:"float32"}}),l=qa({inputs:{real:o,imag:i},backend:n});return i.dispose(),n.disposeIntermediateTensorInfo(o),l}if(a.dtype==="complex64"){let i=Sc({inputs:{input:a},backend:n}),o=Ry({inputs:{x:i},backend:n,attrs:{dtype:s}});return n.disposeIntermediateTensorInfo(i),o}if(!_.hasEncodingLoss(a.dtype,s)){let i=Vn({inputs:{x:a},backend:n});return{dataId:i.dataId,shape:i.shape,dtype:s}}if(s==="int32")return zV(a,n);if(s==="bool"){let i=n.makeTensorInfo([],"bool",_.getTypedArrayFromDType("bool",1)),o=o7({inputs:{a,b:i},backend:n});return n.disposeIntermediateTensorInfo(i),o}throw new Error( ` Error in Cast : failed to cast $ { a . dtype } to $ { s } ` )}var PV={kernelName:ys,backendName:"webgl",kernelFunc:Ry},l7="return ceil(x);",LV=Xe({opSnippet:l7,packedOpSnippet:l7,cpuKernelImpl:rW}),WV={kernelName:As,backendName:"webgl",kernelFunc:LV},BV=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-15 21:01:27 +02:00
}
2021-04-17 00:03:15 +02:00
setOutput ( clamp ( value , minVal , maxVal ) ) ;
}
` }getCustomSetupFunc(e,t){return(n,r)=>{this.minLoc==null&&(this.minLoc=n.getUniformLocationNoThrow(r,"minVal"),this.maxLoc=n.getUniformLocationNoThrow(r,"maxVal")),n.gl.uniform1f(this.minLoc,e),n.gl.uniform1f(this.maxLoc,t)}}},VV=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-15 21:01:27 +02:00
}
2021-04-17 00:03:15 +02:00
setOutput ( clamp ( value , vec4 ( minVal ) , vec4 ( maxVal ) ) ) ;
}
` }getCustomSetupFunc(e,t){return(n,r)=>{this.minLoc==null&&(this.minLoc=n.getUniformLocationNoThrow(r,"minVal"),this.maxLoc=n.getUniformLocationNoThrow(r,"maxVal")),n.gl.uniform1f(this.minLoc,e),n.gl.uniform1f(this.maxLoc,t)}}};function jV(e){let{inputs:t,backend:n,attrs:r}=e,{x:a}=t,{clipValueMin:s,clipValueMax:i}=r,o;J().getBool("WEBGL_PACK_CLIP")?o=new VV(a.shape):o=new BV(a.shape);let l=o.getCustomSetupFunc(s,i);return n.runWebGLProgram(o,[a],a.dtype,l)}var UV={kernelName:Ra,backendName:"webgl",kernelFunc:jV},HV=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 u7(e,t){return{dataId:t.dataId,dtype:t.dtype,shape:e.shape}}function GV(e){let{inputs:t,backend:n}=e,{x:r}=t,a=n.texData.get(r.dataId),s=new HV(r.shape),i=[u7(r,a.complexTensorInfos.real),u7(r,a.complexTensorInfos.imag)];return n.runWebGLProgram(s,i,i[0].dtype)}var qV={kernelName:Su,backendName:"webgl",kernelFunc:GV},XV=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 r=t.length,a=t[t.length-1];n.push( ` else setOutput ( getT$ { r } ( yR , yC - $ { a } ) ) ; ` ),this.userCode= `
void main ( ) {
ivec2 coords = getOutputCoords ( ) ;
int yR = coords . x ;
int yC = coords . y ;
$ { n . join ( `
` )}
}
` }},KV=class{constructor(e,t){this.packedInputs=!0,this.packedOutput=!0,this.outputShape=[],this.outputShape=C.computeOutShape(e,t);let n=this.outputShape,r=n.length,a=lt(r),s=pn("coords",r),i=["x","y","z","w","u","v"].slice(0,r);this.variableNames=e.map((f,m)=> ` T$ { m } ` );let o=new Array(e.length-1);o[0]=e[0][t];for(let f=1;f<o.length;f++)o[f]=o[f-1]+e[f][t];let l=i[t],c=i.slice(-2),u=i.join(),h= ` if ( $ { l } < $ { o [ 0 ] } ) {
return getChannel (
getT0 ( $ { u } ) , vec2 ( $ { c . join ( ) } ) ) ;
} ` ;for(let f=1;f<o.length;f++){let m=o[f-1];h+= `
if ( $ { l } < $ { o [ f ] } && $ { l } >= $ { o [ f - 1 ] } ) {
return getChannel (
getT$ { f } ( $ { Tp ( i , l , m ) } ) ,
vec2 ( $ { Tp ( c , l , m ) } ) ) ;
} ` }let d=o.length,p=o[o.length-1];h+= `
return getChannel (
getT$ { d } ( $ { Tp ( i , l , p ) } ) ,
vec2 ( $ { Tp ( c , l , p ) } ) ) ; ` ,this.userCode= `
float getValue ( $ { i . map ( f => "int " + f ) } ) {
$ { h }
}
void main ( ) {
$ { a } coords = getOutputCoords ( ) ;
vec4 result = vec4 ( getValue ( $ { s } ) , 0. , 0. , 0. ) ;
$ { s [ r - 1 ] } = $ { s [ r - 1 ] } + 1 ;
if ( $ { s [ r - 1 ] } < $ { n [ r - 1 ] } ) {
result . g = getValue ( $ { s } ) ;
2021-03-27 20:45:37 +01:00
}
2021-04-17 00:03:15 +02:00
$ { s [ r - 2 ] } = $ { s [ r - 2 ] } + 1 ;
if ( $ { s [ r - 2 ] } < $ { n [ r - 2 ] } ) {
result . a = getValue ( $ { s } ) ;
2021-03-29 21:01:16 +02:00
}
2021-04-17 00:03:15 +02:00
$ { s [ r - 1 ] } = $ { s [ r - 1 ] } - 1 ;
if ( $ { s [ r - 2 ] } < $ { n [ r - 2 ] } &&
$ { s [ r - 1 ] } < $ { n [ r - 1 ] } ) {
result . b = getValue ( $ { s } ) ;
2021-03-27 20:45:37 +01:00
}
2021-04-17 00:03:15 +02:00
setOutput ( result ) ;
}
` }};function Tp(e,t,n){let r=e.indexOf(t);return e.map((a,s)=>s===r? ` $ { a } - $ { n } ` :a).join()}function Ep(e){let{inputs:t,backend:n}=e,{input:r}=t,a=n.texData.get(r.dataId);return Vn({inputs:{x:a.complexTensorInfos.imag},backend:n})}var ZV={kernelName:Jh,backendName:"webgl",kernelFunc:Ep};function Vl(e,t,n){let r=e[0].dtype;if(r==="complex64"){let c=e.map(f=>Sc({inputs:{input:f},backend:n})),u=e.map(f=>Ep({inputs:{input:f},backend:n})),h=Vl(c,t,n),d=Vl(u,t,n),p=qa({inputs:{real:h,imag:d},backend:n});return c.forEach(f=>n.disposeIntermediateTensorInfo(f)),u.forEach(f=>n.disposeIntermediateTensorInfo(f)),n.disposeIntermediateTensorInfo(h),n.disposeIntermediateTensorInfo(d),p}if(r==="string"){let{tensors2D:c,outShape:u}=c7(e,t,n),h=c.map(y=>({vals:n.readSync(y.dataId),shape:y.shape})),d=c[0].shape[0]===1,p=aW(h,u,r,d),f=C.computeOutShape(e.map(y=>y.shape),t),m=n.makeTensorInfo(f,r,p);return c.forEach(y=>n.disposeIntermediateTensorInfo(y)),m}if(e.length>J().getNumber("WEBGL_MAX_TEXTURES_IN_SHADER")){let c=Math.floor(e.length/2),u=Vl(e.slice(0,c),t,n),h=Vl(e.slice(c),t,n),d=Vl([u,h],t,n);return n.disposeIntermediateTensorInfo(u),n.disposeIntermediateTensorInfo(h),d}if(J().getBool("WEBGL_PACK_ARRAY_OPERATIONS")&&e[0].shape.length>1){let c=new KV(e.map(u=>u.shape),t);return n.runWebGLProgram(c,e,r)}let{tensors2D:a,outShape:s}=c7(e,t,n),i=new XV(a.map(c=>c.shape)),o=n.runWebGLProgram(i,a,r);a.forEach(c=>n.disposeIntermediateTensorInfo(c));let l=Ae({inputs:{x:o},attrs:{shape:s},backend:n});return n.disposeIntermediateTensorInfo(o),l}function c7(e,t,n){let r=C.computeOutShape(e.map(a=>a.shape),t);return{tensors2D:e.map(a=>Ae({inputs:{x:a},attrs:{shape:[-1,_.sizeFromShape(a.shape.slice(t))]},backend:n})),outShape:r}}function h7(e){let{inputs:t,backend:n,attrs:r}=e,{axis:a}=r,s=_.parseAxisParam(a,t[0].shape)[0],i=C.computeOutShape(t.map(c=>c.shape),s);if(_.sizeFromShape(i)===0)return n.makeTensorInfo(i,t[0].dtype,[]);let o=t.filter(c=>_.sizeFromShape(c.shape)>0);if(o.length===1)return Vn({inputs:{x:o[0]},backend:n});let l=o.map(c=>c.shape);return C.assertParamsConsistent(l,s),Vl(o,s,n)}var YV={kernelName:yo,backendName:"webgl",kernelFunc:h7},d7=class{constructor(e,t=!1,n=null,r=!1,a=!1){this.variableNames=["x","W"],this.outputShape=e.outShape;let s=e.padInfo.top,i=e.padInfo.left,o=e.strideHeight,l=e.strideWidth,c=e.dilationHeight,u=e.dilationWidth,h=e.filterHeight,d=e.filterWidth,p=Math.floor(e.inChannels/4)*4,f=e.inChannels%4,m=e.dataFormat==="channelsLast",y=m?1:2,A=m?2:3,g=m?3:1,x="",v="";n&&(r?x= ` float activation ( float a ) {
float b = getPreluActivationWeightsAtOutCoords ( ) ;
$ { n }
} ` :a?x= ` float activation ( float a ) {
float b = getLeakyreluAlphaAtOutCoords ( ) ;
$ { n }
} ` :x= `
float activation ( float x ) {
$ { n }
2021-04-15 21:01:27 +02:00
}
2021-04-17 00:03:15 +02:00
` ,v="result = activation(result);");let w=t?"result += getBiasAtOutCoords();":"";t&&this.variableNames.push("bias"),r&&this.variableNames.push("preluActivationWeights"),a&&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 [ $ { y } ] , coords [ $ { A } ] ) * 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 < $ { h } ; wR ++ ) {
int xR = xRCorner + wR * $ { c } ;
if ( xR < 0 || xR >= $ { e . inHeight } ) {
continue ;
2021-04-15 21:01:27 +02:00
}
2021-04-17 00:03:15 +02:00
for ( int wC = 0 ; wC < $ { d } ; wC ++ ) {
int xC = xCCorner + wC * $ { u } ;
if ( xC < 0 || xC >= $ { e . inWidth } ) {
continue ;
2021-03-30 15:03:18 +02:00
}
2021-04-17 00:03:15 +02:00
for ( int d1 = 0 ; d1 < $ { p } ; 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 ( $ { m } ) {
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-15 21:01:27 +02:00
} else {
2021-04-17 00:03:15 +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-15 21:01:27 +02:00
}
2021-03-30 15:03:18 +02:00
}
2021-04-17 00:03:15 +02:00
if ( $ { f === 1 } ) {
if ( $ { m } ) {
dotProd +=
getX ( batch , xR , xC , $ { p } ) *
getW ( wR , wC , $ { p } , d2 ) ;
} else {
dotProd +=
getX ( batch , $ { p } , xR , xC ) *
getW ( wR , wC , $ { p } , d2 ) ;
2021-04-15 21:01:27 +02:00
}
2021-04-17 00:03:15 +02:00
} else if ( $ { f === 2 } ) {
vec2 wValues = vec2 (
getW ( wR , wC , $ { p } , d2 ) ,
getW ( wR , wC , $ { p } + 1 , d2 )
) ;
if ( $ { m } ) {
vec2 xValues = vec2 (
getX ( batch , xR , xC , $ { p } ) ,
getX ( batch , xR , xC , $ { p } + 1 )
) ;
dotProd += dot ( xValues , wValues ) ;
2021-04-15 21:01:27 +02:00
} else {
2021-04-17 00:03:15 +02:00
vec2 xValues = vec2 (
getX ( batch , $ { p } , xR , xC ) ,
getX ( batch , $ { p } + 1 , xR , xC )
) ;
dotProd += dot ( xValues , wValues ) ;
2021-04-15 21:01:27 +02:00
}
2021-04-17 00:03:15 +02:00
} else if ( $ { f === 3 } ) {
vec3 wValues = vec3 (
getW ( wR , wC , $ { p } , d2 ) ,
getW ( wR , wC , $ { p } + 1 , d2 ) ,
getW ( wR , wC , $ { p } + 2 , d2 )
) ;
if ( $ { m } ) {
vec3 xValues = vec3 (
getX ( batch , xR , xC , $ { p } ) ,
getX ( batch , xR , xC , $ { p } + 1 ) ,
getX ( batch , xR , xC , $ { p } + 2 )
) ;
dotProd += dot ( xValues , wValues ) ;
2021-04-15 21:01:27 +02:00
} else {
2021-04-17 00:03:15 +02:00
vec3 xValues = vec3 (
getX ( batch , $ { p } , xR , xC ) ,
getX ( batch , $ { p } + 1 , xR , xC ) ,
getX ( batch , $ { p } + 2 , xR , xC )
) ;
dotProd += dot ( xValues , wValues ) ;
2021-03-30 15:03:18 +02:00
}
2021-04-17 00:03:15 +02:00
2021-03-30 15:03:18 +02:00
}
2021-04-15 21:01:27 +02:00
}
}
2021-04-17 00:03:15 +02:00
float result = dotProd ;
$ { w }
$ { v }
setOutput ( result ) ;
}
` }},JV=class{constructor(e){this.variableNames=["x","W"],this.outputShape=e.outShape;let t=e.padInfo.front,n=e.padInfo.top,r=e.padInfo.left,a=e.strideDepth,s=e.strideHeight,i=e.strideWidth,o=e.dilationDepth,l=e.dilationHeight,c=e.dilationWidth,u=e.filterDepth,h=e.filterHeight,d=e.filterWidth,p=Math.floor(e.inChannels/4)*4,f=e.inChannels%4;this.userCode= `
const ivec3 strides = ivec3 ( $ { a } , $ { s } , $ { i } ) ;
const ivec3 pads = ivec3 ( $ { t } , $ { n } , $ { r } ) ;
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 ;
2021-03-30 15:03:18 +02:00
}
2021-04-17 00:03:15 +02:00
for ( int wR = 0 ; wR < $ { h } ; wR ++ ) {
int xR = xRCorner + wR * $ { l } ;
if ( xR < 0 || xR >= $ { e . inHeight } ) {
continue ;
}
for ( int wC = 0 ; wC < $ { d } ; wC ++ ) {
int xC = xCCorner + wC * $ { c } ;
if ( xC < 0 || xC >= $ { e . inWidth } ) {
continue ;
}
for ( int d1 = 0 ; d1 < $ { p } ; 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 ( $ { f === 1 } ) {
dotProd +=
getX ( batch , xF , xR , xC , $ { p } ) *
getW ( wF , wR , wC , $ { p } , d2 ) ;
} else if ( $ { f === 2 } ) {
vec2 xValues = vec2 (
getX ( batch , xF , xR , xC , $ { p } ) ,
getX ( batch , xF , xR , xC , $ { p } + 1 )
) ;
vec2 wValues = vec2 (
getW ( wF , wR , wC , $ { p } , d2 ) ,
getW ( wF , wR , wC , $ { p } + 1 , d2 )
) ;
dotProd += dot ( xValues , wValues ) ;
} else if ( $ { f === 3 } ) {
vec3 xValues = vec3 (
getX ( batch , xF , xR , xC , $ { p } ) ,
getX ( batch , xF , xR , xC , $ { p } + 1 ) ,
getX ( batch , xF , xR , xC , $ { p } + 2 )
) ;
vec3 wValues = vec3 (
getW ( wF , wR , wC , $ { p } , d2 ) ,
getW ( wF , wR , wC , $ { p } + 1 , d2 ) ,
getW ( wF , wR , wC , $ { p } + 2 , d2 )
) ;
dotProd += dot ( xValues , wValues ) ;
}
2021-03-30 15:03:18 +02:00
}
}
2021-04-15 21:01:27 +02:00
}
2021-04-17 00:03:15 +02:00
setOutput ( dotProd ) ;
}
` }},QV=class{constructor(e,t,n){this.variableNames=["A"],this.packedInputs=!0,this.packedOutput=!0,this.outputShape=e;let{filterWidth:r,inChannels:a,strideWidth:s,strideHeight:i,padInfo:o,outWidth:l,dilationWidth:c,dilationHeight:u,dataFormat:h}=n,{left:d,top:p}=o,f=a*r,m=dn(),y=h==="channelsLast",A=y?0:1,g=y?1:2,x="";for(let v=0;v<=1;v++)for(let w=0;w<=1;w++)x+= `
blockIndex = rc . y + $ { w } ;
pos = rc . x + $ { v } ;
if ( blockIndex < $ { e [ 1 ] } && pos < $ { e [ 0 ] } ) {
offsetY = int ( blockIndex / ( $ { l } ) ) * $ { i } - $ { p } ;
d0 = offsetY + $ { u } * ( pos / $ { f } ) ;
if ( d0 < $ { t [ A ] } && d0 >= 0 ) {
offsetX = int ( mod ( float ( blockIndex ) , $ { l } . ) * $ { s } . - $ { d } . ) ;
d1 = offsetX + $ { c } * ( int ( mod ( float ( pos ) , $ { f } . ) / $ { a } . ) ) ;
if ( d1 < $ { t [ g ] } && d1 >= 0 ) {
ch = int ( mod ( float ( pos ) , $ { a } . ) ) ;
if ( $ { y } ) {
innerDims = vec2 ( d1 , ch ) ;
result [ $ { v * 2 + w } ] = getChannel (
getA ( d0 , int ( innerDims . x ) ,
int ( innerDims . y ) ) , innerDims ) ;
} else {
innerDims = vec2 ( d0 , d1 ) ;
result [ $ { v * 2 + w } ] = getChannel (
getA ( ch , int ( innerDims . x ) ,
int ( innerDims . y ) ) , innerDims ) ;
}
}
2021-04-15 21:01:27 +02:00
}
2021-03-30 15:03:18 +02:00
}
2021-04-17 00:03:15 +02:00
` ;this.userCode= `
void main ( ) {
ivec2 rc = getOutputCoords ( ) ;
vec4 result = vec4 ( 0 ) ;
int blockIndex , pos , offsetY , d0 , offsetX , d1 , ch ;
vec2 innerDims ;
$ { x }
$ { m . output } = result ;
}
` }};function p7({x:e,filter:t,convInfo:n,backend:r,bias:a=null,preluActivationWeights:s=null,leakyreluAlpha:i=0,activation:o=null}){let l=e.shape,c=r.texData.get(e.dataId),u=n.inChannels,h=l[0]*l[1]*l[2],d=n.outChannels,p=n.dataFormat==="channelsLast",f=!1,m=!1,y,A=[],g=(h===1||d===1)&&u>t7,x=l[2]%2!=0&&!!c.isPacked;if(g||!J().getBool("WEBGL_LAZILY_UNPACK")||!J().getBool("WEBGL_PACK_BINARY_OPERATIONS")||!x){let v=p?l[0]*l[1]*l[2]:l[0]*l[2]*l[3],w=Ae({inputs:{x:e},backend:r,attrs:{shape:[1,v,n.inChannels]}}),b=Ae({inputs:{x:t},backend:r,attrs:{shape:[1,n.inChannels,n.outChannels]}}),k=Sp({a:w,b,transposeA:f,transposeB:m,backend:r,bias:a,activation:o,preluActivationWeights:s,leakyreluAlpha:i});y=Ae({inputs:{x:k},backend:r,attrs:{shape:n.outShape}}),A.push(w),A.push(b),A.push(k)}else{let v=p?l[0]*l[1]*(l[2]+1):l[0]*l[2]*(l[3]+1),w={dataId:e.dataId,shape:[1,v,n.inChannels],dtype:e.dtype},b=c.shape;c.shape=c.shape.slice(),c.shape[c.shape.length-2]++,_.assert(gc(c.shape,w.shape),()=> ` packed reshape $ { c . shape } to $ { w . shape } isn ' t free ` );let k=Ae({inputs:{x:t},backend:r,attrs:{shape:[1,n.inChannels,n.outChannels]}});A.push(k);let N=Sp({a:w,b:k,backend:r,transposeA:f,transposeB:m,bias:a,activation:o,preluActivationWeights:s,leakyreluAlpha:i}),E=r.texData.get(N.dataId);_.assert(E.isPacked,()=>"batchMatMul result is expected to be packed"),c.shape=b,E.shape=n.outShape,y=Vn({inputs:{x:N},backend:r}),y.shape=n.outShape,A.push(N)}for(let v of A)r.disposeIntermediateTensorInfo(v);return y}function f7({x:e,filter:t,convInfo:n,backend:r,bias:a=null,preluActivationWeights:s=null,leakyreluAlpha:i=0,activation:o=null}){let{filterWidth:l,filterHeight:c,inChannels:u,outWidth:h,outHeight:d,dataFormat:p}=n,f=p==="channelsLast",m=l*c*u,y=d*h,A=[m,y],g=!0,x=!1,v=[],w=Ae({inputs:{x:e},backend:r,attrs:{shape:e.shape.slice(1)}}),b=Ae({inputs:{x:t},backend:r,attrs:{shape:[1,m,_.sizeFromShape(t.shape)/m]}});v.push(w),v.push(b);let k=new QV(A,w.shape,n),N=r.runWebGLProgram(k,[w],"float32"),E=Ae({inputs:{x:N},backend:r,attrs:{shape:[1,A[0],A[1]]}});v.push(N),v.push(E);let F=a!=null,O=s!=null,L=o==="leakyrelu",V=o?vp(o,!0):null,j=new Z3(E.shape,b.shape,[1,y,n.outChannels],g,x,F,V,O,L),U=[E,b];if(a&&U.push(a),O&&U.push(s),L){let Y=r.makeTensorInfo([],"float32",_.createScalarValue(i,"float32"));U.push(Y),v.push(Y)}let X=r.runWebGLProgram(j,U,"float32"),G=f?[1,d,h,n.outChannels]:[1,n.outChannels,d,h],ee=Ae({inputs:{x:X},backend:r,attrs:{shape:G}});v.push(X);for(let Y of v)r.disposeIntermediateTensorInfo(Y);return ee}function ej(e){let{inputs:t,backend:n,attrs:r}=e,{x:a,filter:s}=t,{strides:i,pad:o,dataFormat:l,dilations:c,dimRoundingMode:u}=r,h=C.convertConv2DDataFormat(l),d=C.computeConv2DInfo(a.shape,s.shape,i,c,o,u,!1,h),p;if(d.filterHeight===1&&d.filterWidth===1&&d.dilationHeight===1&&d.dilationWidth===1&&d.strideHeight===1&&d.strideWidth===1&&(d.padInfo.type==="SAME"||d.padInfo.type==="VALID"))p=p7({x:a,filter:s,convInfo:d,backend:n});else if(J().getBool("WEBGL_CONV_IM2COL")&&a.shape[0]===1)p=f7({x:a,filter:s,convInfo:d,backend:n});else{let m=new d7(d);p=n.runWebGLProgram(m,[a,s],"float32")}let f=Ae({inputs:{x:p},backend:n,attrs:{shape:d.outShape}});return n.disposeIntermediateTensorInfo(p),f}var tj={kernelName:gs,backendName:"webgl",kernelFunc:ej},nj=class{constructor(e){this.variableNames=["x","dy"],this.outputShape=e.filterShape;let t=e.strideHeight,n=e.strideWidth,r=e.padInfo.top,a=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 } - $ { r } ;
if ( xR < 0 || xR >= $ { e . inHeight } ) {
continue ;
2021-03-30 15:03:18 +02:00
}
2021-04-17 00:03:15 +02:00
for ( int yC = 0 ; yC < $ { e . outWidth } ; yC ++ ) {
int xC = wC + yC * $ { n } - $ { a } ;
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-15 21:01:27 +02:00
}
}
}
2021-04-17 00:03:15 +02:00
setOutput ( dotProd ) ;
}
` }},rj=class{constructor(e){this.variableNames=["dy","W"],this.outputShape=e.inShape;let t=e.filterHeight,n=e.filterWidth,r=e.strideHeight,a=e.strideWidth,s=e.dataFormat==="channelsLast",i=t-1-e.padInfo.top,o=n-1-e.padInfo.left,l=s?1:2,c=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 [ $ { c } ] ) - 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 ) / $ { r } . 0 ;
if ( dyR < 0.0 || dyR >= $ { e . outHeight } . 0 || fract ( dyR ) > 0.0 ) {
continue ;
2021-04-15 21:01:27 +02:00
}
2021-04-17 00:03:15 +02:00
int idyR = int ( dyR ) ;
int wRPerm = $ { t } - 1 - wR ;
for ( int wC = 0 ; wC < $ { n } ; wC ++ ) {
float dyC = float ( dyCCorner + wC ) / $ { a } . 0 ;
if ( dyC < 0.0 || dyC >= $ { e . outWidth } . 0 ||
fract ( dyC ) > 0.0 ) {
continue ;
2021-04-15 21:01:27 +02:00
}
2021-04-17 00:03:15 +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 ;
} else {
float xValue = getDy ( batch , d2 , idyR , idyC ) ;
float wValue = getW ( wRPerm , wCPerm , d1 , d2 ) ;
dotProd += xValue * wValue ;
}
2021-04-15 21:01:27 +02:00
}
}
}
2021-04-17 00:03:15 +02:00
setOutput ( dotProd ) ;
}
` }},aj=class{constructor(e){this.variableNames=["x","dy"],this.outputShape=e.filterShape;let t=e.strideDepth,n=e.strideHeight,r=e.strideWidth,a=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 } - $ { a } ;
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 * $ { r } - $ { i } ;
if ( xC < 0 || xC >= $ { e . inWidth } ) {
continue ;
2021-04-15 21:01:27 +02:00
}
2021-04-17 00:03:15 +02:00
float dyValue = getDy ( b , yF , yR , yC , d2 ) ;
float xValue = getX ( b , xF , xR , xC , d1 ) ;
dotProd += ( xValue * dyValue ) ;
2021-03-30 15:03:18 +02:00
}
}
}
}
2021-04-17 00:03:15 +02:00
setOutput ( dotProd ) ;
}
` }},sj=class{constructor(e){this.variableNames=["dy","W"],this.outputShape=e.inShape;let t=e.filterDepth,n=e.filterHeight,r=e.filterWidth,a=e.strideDepth,s=e.strideHeight,i=e.strideWidth,o=t-1-e.padInfo.front,l=n-1-e.padInfo.top,c=r-1-e.padInfo.left;this.userCode= `
const ivec3 pads = ivec3 ( $ { o } , $ { l } , $ { c } ) ;
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 ) / $ { a } . 0 ;
if ( dyF < 0.0 || dyF >= $ { e . outDepth } . 0 || fract ( dyF ) > 0.0 ) {
continue ;
2021-04-15 21:01:27 +02:00
}
2021-04-17 00:03:15 +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 ) {
2021-04-15 21:01:27 +02:00
continue ;
}
2021-04-17 00:03:15 +02:00
int idyR = int ( dyR ) ;
int wRPerm = $ { n } - 1 - wR ;
for ( int wC = 0 ; wC < $ { r } ; 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 = $ { r } - 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-15 21:01:27 +02:00
}
}
2021-03-30 15:03:18 +02:00
}
}
2021-04-17 00:03:15 +02:00
setOutput ( dotProd ) ;
}
` }};function ij(e){let{inputs:t,backend:n,attrs:r}=e,{x:a,dy:s}=t,{strides:i,pad:o,dataFormat:l,dimRoundingMode:c,filterShape:u}=r,h=C.convertConv2DDataFormat(l),d=C.computeConv2DInfo(a.shape,u,i,1,o,c,!1,h),p=new nj(d);return n.runWebGLProgram(p,[a,s],"float32")}var oj={kernelName:Lh,backendName:"webgl",kernelFunc:ij};function lj(e){let{inputs:t,backend:n,attrs:r}=e,{dy:a,filter:s}=t,{inputShape:i,strides:o,pad:l,dataFormat:c,dimRoundingMode:u}=r,h=C.convertConv2DDataFormat(c),d=C.computeConv2DInfo(i,s.shape,o,1,l,u,!1,h),p=new rj(d);return n.runWebGLProgram(p,[a,s],"float32")}var uj={kernelName:xs,backendName:"webgl",kernelFunc:lj};function cj(e){let{inputs:t,backend:n,attrs:r}=e,{x:a,filter:s}=t,{strides:i,pad:o,dilations:l}=r,c=C.computeConv3DInfo(a.shape,s.shape,i,l,o),u=new JV(c);return n.runWebGLProgram(u,[a,s],"float32")}var hj={kernelName:Nu,backendName:"webgl",kernelFunc:cj};function dj(e){let{inputs:t,backend:n,attrs:r}=e,{x:a,dy:s}=t,{strides:i,pad:o,filterShape:l}=r,c=C.computeConv3DInfo(a.shape,l,i,1,o),u=new aj(c);return n.runWebGLProgram(u,[a,s],"float32")}var pj={kernelName:Wh,backendName:"webgl",kernelFunc:dj};function fj(e){let{inputs:t,backend:n,attrs:r}=e,{dy:a,filter:s}=t,{pad:i,strides:o,inputShape:l}=r,c=C.computeConv3DInfo(l,s.shape,o,1,i),u=new sj(c);return n.runWebGLProgram(u,[a,s],"float32")}var mj={kernelName:Bh,backendName:"webgl",kernelFunc:fj},yj=K3+ `
return cos ( x ) ;
` ,Aj=Xe({opSnippet:yj}),gj={kernelName:ws,backendName:"webgl",kernelFunc:Aj},xj= `
float e2x = exp ( - x ) ;
return ( e2x + 1.0 / e2x ) / 2.0 ;
` ,wj=Xe({opSnippet:xj}),bj={kernelName:Ao,backendName:"webgl",kernelFunc:wj},_j=class{constructor(e,t,n,r,a){this.variableNames=["Image","Boxes","BoxInd"],this.outputShape=[];let[s,i,o,l]=e,[c]=t,[u,h]=n;this.outputShape=[c,u,h,l];let d=r==="bilinear"?1:0,[p,f]=[ ` $ { i - 1 } . 0 ` , ` $ { o - 1 } . 0 ` ],[m,y,A]=u>1?[ ` $ { ( i - 1 ) / ( u - 1 ) } ` ,"(y2-y1) * height_ratio", ` y1 * $ { p } + float ( y ) * ( height _scale ) ` ]:["0.0","0.0", ` 0.5 * ( y1 + y2 ) * $ { p } ` ],[g,x,v]=h>1?[ ` $ { ( o - 1 ) / ( h - 1 ) } ` ,"(x2-x1) * width_ratio", ` x1 * $ { f } + float ( x ) * ( width _scale ) ` ]:["0.0","0.0", ` 0.5 * ( x1 + x2 ) * $ { f } ` ];this.userCode= `
const float height _ratio = float ( $ { m } ) ;
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-03-30 15:03:18 +02:00
}
2021-04-17 00:03:15 +02:00
float height _scale = $ { y } ;
float width _scale = $ { x } ;
float in _y = $ { A } ;
if ( in _y < 0.0 || in _y > $ { p } ) {
setOutput ( float ( $ { a } ) ) ;
return ;
2021-03-30 15:03:18 +02:00
}
2021-04-17 00:03:15 +02:00
float in _x = $ { v } ;
if ( in _x < 0.0 || in _x > $ { f } ) {
setOutput ( float ( $ { a } ) ) ;
return ;
2021-04-15 21:01:27 +02:00
}
2021-04-17 00:03:15 +02:00
vec2 sourceFracIndexCR = vec2 ( in _x , in _y ) ;
if ( $ { d } == 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 ) ;
} else {
// 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-03-30 15:03:18 +02:00
}
2021-04-17 00:03:15 +02:00
}
` }},vj=e=>{let{inputs:t,backend:n,attrs:r}=e,{image:a,boxes:s,boxInd:i}=t,{cropSize:o,method:l,extrapolationValue:c}=r,u=new _j(a.shape,s.shape,o,l,c);return n.runWebGLProgram(u,[a,s,i],"float32")},kj={kernelName:go,backendName:"webgl",kernelFunc:vj},A7=class{constructor(e,t,n){this.variableNames=["x"],this.outputShape=e;let r=e.length,a=t?"0.0": ` getX ( $ { m7 ( r , "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 ( r ) } coords = getOutputCoords ( ) ;
int end = $ { y7 ( r , "coords" ) } ;
float val = $ { a } ;
int pow2 = int ( pow ( 2.0 , index ) ) ;
if ( $ { i } ) {
int idx = $ { o } ;
$ { y7 ( r , "coords" ) } = idx ;
val += getX ( $ { m7 ( r , "coords" ) } ) ;
2021-03-30 15:03:18 +02:00
}
2021-04-17 00:03:15 +02:00
setOutput ( val ) ;
}
` }getCustomSetupFunc(e){return(t,n)=>{this.index==null&&(this.index=t.getUniformLocation(n,"index")),t.gl.uniform1f(this.index,e)}}};function m7(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 y7(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:r}=e,{x:a}=t,{axis:s,exclusive:i,reverse:o}=r,l=a.shape.length,c=C.getAxesPermutation([s],l),u=a;c!=null&&(u=fn({inputs:{x:a},backend:n,attrs:{perm:c}}));let h=C.getInnerMostAxes(1,l)[0];if(h!==l-1)throw new Error( ` WebGL cumsum shader expects an inner - most axis = $ { a . shape . length - 1 } but got axis = $ { s } ` );let d=u.shape[h],p=Vn({inputs:{x:u},backend:n});for(let f=0;f<=Math.ceil(Math.log2(d))-1;f++){let m=new A7(u.shape,!1,o),y=m.getCustomSetupFunc(f),A=p;p=n.runWebGLProgram(m,[p],p.dtype,y),n.disposeIntermediateTensorInfo(A)}if(i){let f=new A7(u.shape,i,o),m=p;p=n.runWebGLProgram(f,[p],p.dtype),n.disposeIntermediateTensorInfo(m)}if(c!=null){let f=C.getUndoAxesPermutation(c),m=fn({inputs:{x:p},backend:n,attrs:{perm:f}});return n.disposeIntermediateTensorInfo(p),n.disposeIntermediateTensorInfo(u),m}return p}var Sj={kernelName:bs,backendName:"webgl",kernelFunc:Ij};function Nj(e){let{inputs:t,backend:n,attrs:r}=e,{x:a,weights:s}=t,{size:i,binaryOutput:o}=r;if(a.shape.length===1){let l=n.readSync(a.dataId),c=n.readSync(s.dataId),u= $ 3(l,c,s.dtype,s.shape,i);return n.makeTensorInfo([i],s.dtype,u)}else if(a.shape.length===2){let l=n.bufferSync(a),c=n.bufferSync(s),u=nW(l,c,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$ { a . shape . length } . ` )}var Tj={kernelName:Vh,backendName:"webgl",kernelFunc:Nj},Ej=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 Cj(e){let{inputs:t,backend:n,attrs:r}=e,{x:a}=t,{blockSize:s,dataFormat:i}=r;_.assert(s>1,()=> ` blockSize should be > 1 for depthToSpace , but was : $ { s } ` );let o=a.shape[0],l=i==="NHWC"?a.shape[1]:a.shape[2],c=i==="NHWC"?a.shape[2]:a.shape[3],u=i==="NHWC"?a.shape[3]:a.shape[1],h=l*s,d=c*s,p=u/(s*s),f=i==="NHWC"?[o,h,d,p]:[o,p,h,d],m=new Ej(f,s,i);return n.runWebGLProgram(m,[a],a.dtype)}var Rj={kernelName:xo,backendName:"webgl",kernelFunc:Cj},g7=class{constructor(e,t=!1,n=null,r=!1,a=!1){this.variableNames=["x","W"],this.outputShape=e.outShape;let s=e.inHeight,i=e.inWidth,o=e.padInfo.top,l=e.padInfo.left,c=e.strideHeight,u=e.strideWidth,h=e.dilationHeight,d=e.dilationWidth,p=e.filterHeight,f=e.filterWidth,m=e.outChannels/e.inChannels,y="",A="";n&&(r?y= ` float activation ( float a ) {
float b = getPreluActivationWeightsAtOutCoords ( ) ;
$ { n }
} ` :a?y= ` float activation ( float a ) {
float b = getLeakyreluAlphaAtOutCoords ( ) ;
$ { n }
} ` :y= `
float activation ( float x ) {
$ { n }
2021-03-29 21:01:16 +02:00
}
2021-04-17 00:03:15 +02:00
` ,A="result = activation(result);");let g=t?"result += getBiasAtOutCoords();":"";t&&this.variableNames.push("bias"),r&&this.variableNames.push("preluActivationWeights"),a&&this.variableNames.push("leakyreluAlpha"),this.userCode= `
$ { y }
const ivec2 strides = ivec2 ( $ { c } , $ { 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 / $ { m } ;
int q = d2 - d1 * $ { m } ;
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 < $ { p } ; wR ++ ) {
int xR = xRCorner + wR * $ { h } ;
if ( xR < 0 || xR >= $ { s } ) {
continue ;
2021-04-15 21:01:27 +02:00
}
2021-04-17 00:03:15 +02:00
for ( int wC = 0 ; wC < $ { f } ; wC ++ ) {
int xC = xCCorner + wC * $ { d } ;
if ( xC < 0 || xC >= $ { i } ) {
continue ;
2021-04-15 21:01:27 +02:00
}
2021-04-17 00:03:15 +02:00
float xVal = getX ( batch , xR , xC , d1 ) ;
float wVal = getW ( wR , wC , d1 , q ) ;
dotProd += xVal * wVal ;
2021-04-15 21:01:27 +02:00
}
}
2021-04-17 00:03:15 +02:00
float result = dotProd ;
$ { g }
$ { A }
setOutput ( result ) ;
2021-03-29 21:01:16 +02:00
}
2021-04-17 00:03:15 +02:00
` }},x7=class{constructor(e,t=!1,n=null,r=!1,a=!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,c=e.padInfo.left,u=e.strideHeight,h=e.strideWidth,d=e.dilationHeight,p=e.dilationWidth,f=e.filterHeight,m=e.filterWidth,y=m,A= `
int xR ; int xC ; int xCOffset ;
vec4 wTexel ; vec4 previous ; vec4 final ; ` ;for(let w=0;w<m;w++)A+= `
vec4 xTexelC$ { w * 2 } ;
vec4 xC$ { w } ; ` ;for(let w=0;w<f;w++){for(let b=0;b<m;b++)A+= `
xTexelC$ { b * 2 } = vec4 ( 0.0 ) ;
xC$ { b } = vec4 ( 0.0 ) ; ` ;A+= `
xR = xRCorner + $ { w * d } ;
if ( xR >= 0 && xR < $ { i } ) {
` ;for(let b=0;b<y/2+1;b++){let k=b*2;if(A+= `
xC = xCCorner + $ { k * p } ;
` ,h===1){if(k<m&&(c%2==1?(A+= `
xCOffset = xC + 1 ;
if ( xCOffset >= 0 && xCOffset < $ { o } ) {
xTexelC$ { k } = getX ( batch , xR , xCOffset , d1 ) ;
// Need to manually clear unused channels in case
// we're reading from recycled texture.
if ( xCOffset + 1 >= $ { o } ) {
xTexelC$ { k } . zw = vec2 ( 0.0 ) ;
}
}
` ,p===1&&k>0?A+= `
xC$ { k } = vec4 ( xTexelC$ { k - 2 } . zw , xTexelC$ { k } . xy ) ;
` :A+= `
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$ { k } = vec4 ( previous . zw , xTexelC$ { k } . xy ) ;
} else {
xC$ { k } = vec4 ( 0.0 , 0.0 , xTexelC$ { k } . xy ) ;
}
` ):A+= `
if ( xC >= 0 && xC < $ { o } ) {
xTexelC$ { k } = getX ( batch , xR , xC , d1 ) ;
if ( xC + 1 >= $ { o } ) {
xTexelC$ { k } . zw = vec2 ( 0.0 ) ;
}
}
xC$ { k } = xTexelC$ { k } ;
` ,k+1<m)){let N=c%2==0?_.nearestLargerEven(p):p;p%2==0&&c%2==1||p%2!=0&&c%2!=1?(A+= `
xCOffset = xC + $ { c % 2 } + $ { N } ;
if ( xCOffset >= 0 && xCOffset < $ { o } ) {
xTexelC$ { k + 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$ { k + 2 } . zw = vec2 ( 0.0 ) ;
}
}
` ,p>1&&(A+= `
xCOffset -= 2 ;
if ( xCOffset >= 0 && xCOffset < $ { o } ) {
xTexelC$ { k } = getX ( batch , xR , xCOffset , d1 ) ;
}
` ),A+= `
xC$ { k + 1 } = vec4 ( xTexelC$ { k } . zw , xTexelC$ { k + 2 } . xy ) ;
` ):N===1?A+= `
xC$ { k + 1 } = xTexelC$ { k } ;
` :A+= `
xCOffset = xC + $ { N } ;
if ( xCOffset >= 0 && xCOffset < $ { o } ) {
xTexelC$ { k + 2 } = getX ( batch , xR , xCOffset , d1 ) ;
if ( xCOffset + 1 >= $ { o } ) {
xTexelC$ { k + 2 } . zw = vec2 ( 0.0 ) ;
}
}
xC$ { k + 1 } = xTexelC$ { k + 2 } ;
` }}else k<m&&(c%2==1?(A+= `
xCOffset = xC + 1 - $ { h } ;
if ( xCOffset >= 0 && xCOffset < $ { o } ) {
xTexelC$ { k } = getX ( batch , xR , xCOffset , d1 ) ;
// Need to manually clear unused channels in case
// we're reading from recycled texture.
if ( xCOffset + 1 >= $ { o } ) {
xTexelC$ { k } . zw = vec2 ( 0.0 ) ;
}
}
if ( xC + 1 >= 0 && xC + 1 < $ { o } ) {
xTexelC$ { k + 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$ { k + 2 } . zw = vec2 ( 0.0 ) ;
}
}
xC$ { k } = vec4 ( xTexelC$ { k } . zw , xTexelC$ { k + 2 } . zw ) ;
` ,k+1<m&&(A+= `
final = vec4 ( 0.0 ) ;
xCOffset = xC + 1 + $ { h } ;
if ( xCOffset >= 0 && xCOffset < $ { o } ) {
final = getX ( batch , xR , xCOffset , d1 ) ;
}
xC$ { k + 1 } = vec4 ( xTexelC$ { k + 2 } . xy , final . xy ) ;
` )):(A+= `
if ( xC >= 0 && xC < $ { o } ) {
xTexelC$ { k } = getX ( batch , xR , xC , d1 ) ;
if ( xC + 1 >= $ { o } ) {
xTexelC$ { k } . zw = vec2 ( 0.0 ) ;
}
}
xCOffset = xC + $ { h } ;
if ( xCOffset >= 0 && xCOffset < $ { o } ) {
xTexelC$ { k + 2 } = getX ( batch , xR , xCOffset , d1 ) ;
if ( xCOffset + 1 >= $ { o } ) {
xTexelC$ { k + 2 } . zw = vec2 ( 0. ) ;
}
}
xC$ { k } = vec4 (
xTexelC$ { k } . xy , xTexelC$ { k + 2 } . xy ) ;
` ,k+1<m&&(A+= `
xC$ { k + 1 } = vec4 ( xTexelC$ { k } . zw , xTexelC$ { k + 2 } . zw ) ;
` )));k<m&&(A+= `
wTexel = getW ( $ { w } , $ { k } , d1 , q ) ;
dotProd += xC$ { k } * vec4 ( wTexel . xz , wTexel . xz ) ;
` ,k+1<m&&(A+= `
wTexel = getW ( $ { w } , $ { k + 1 } , d1 , q ) ;
dotProd += xC$ { k + 1 } * vec4 ( wTexel . xz , wTexel . xz ) ;
` ))}A+= `
}
` }let g="",x="";n&&(r?g= ` vec4 activation ( vec4 a ) {
vec4 b = getPreluActivationWeightsAtOutCoords ( ) ;
$ { n }
} ` :a?g= ` vec4 activation ( vec4 a ) {
vec4 b = getLeakyreluAlphaAtOutCoords ( ) ;
$ { n }
} ` :g= ` vec4 activation ( vec4 x ) {
$ { n }
} ` ,x="result = activation(result);");let v=t?"result += getBiasAtOutCoords();":"";t&&this.variableNames.push("bias"),r&&this.variableNames.push("preluActivationWeights"),a&&this.variableNames.push("leakyreluAlpha"),this.userCode= `
$ { g }
const ivec2 strides = ivec2 ( $ { u } , $ { h } ) ;
const ivec2 pads = ivec2 ( $ { l } , $ { c } ) ;
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 ) ;
$ { A }
vec4 result = dotProd - vec4 ( 0.000000000000001 ) ;
$ { v }
$ { x }
setOutput ( result ) ;
2021-03-29 21:01:16 +02:00
}
2021-04-17 00:03:15 +02:00
` }};function Mj(e){let{inputs:t,backend:n,attrs:r}=e,{x:a,filter:s}=t,{strides:i,pad:o,dilations:l,dimRoundingMode:c}=r,u=l;u==null&&(u=[1,1]),_.assert(C.eitherStridesOrDilationsAreOne(i,u),()=> ` Error in depthwiseConv2d : Either strides or dilations must be 1. Got strides $ { i } and dilations '${u}' ` );let h=C.computeConv2DInfo(a.shape,s.shape,i,u,o,c,!0),d;return J().getBool("WEBGL_PACK_DEPTHWISECONV")&&h.strideWidth<=2&&h.outChannels/h.inChannels==1?d=new x7(h):d=new g7(h),n.runWebGLProgram(d,[a,s],"float32")}var Fj={kernelName:_s,backendName:"webgl",kernelFunc:Mj}, $ j=class{constructor(e){this.variableNames=["x","dy"],this.outputShape=e.filterShape;let t=e.strideHeight,n=e.strideWidth,r=e.padInfo.top,a=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 } - $ { r } ;
if ( xR < 0 || xR >= $ { e . inHeight } ) {
continue ;
}
for ( int yC = 0 ; yC < $ { e . outWidth } ; yC ++ ) {
int xC = wC + yC * $ { n } - $ { a } ;
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-15 21:01:27 +02:00
}
}
2021-04-17 00:03:15 +02:00
setOutput ( dotProd ) ;
2021-04-15 21:01:27 +02:00
}
2021-04-17 00:03:15 +02:00
` }},Dj=class{constructor(e){this.variableNames=["dy","W"],this.outputShape=e.inShape;let t=e.filterHeight,n=e.filterWidth,r=e.strideHeight,a=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 ) / $ { r } . 0 ;
if ( dyR < 0.0 || dyR >= $ { e . outHeight } . 0 || fract ( dyR ) > 0.0 ) {
continue ;
2021-03-29 21:01:16 +02:00
}
2021-04-17 00:03:15 +02:00
int idyR = int ( dyR ) ;
int wRPerm = $ { t } - 1 - wR ;
for ( int wC = 0 ; wC < $ { n } ; wC ++ ) {
float dyC = float ( dyCCorner + wC ) / $ { a } . 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-03-29 21:01:16 +02:00
}
2021-04-15 21:01:27 +02:00
}
2021-03-29 21:01:16 +02:00
}
2021-04-17 00:03:15 +02:00
setOutput ( dotProd ) ;
2021-04-15 21:01:27 +02:00
}
2021-04-17 00:03:15 +02:00
` }};function Oj(e){let{inputs:t,backend:n,attrs:r}=e,{x:a,dy:s}=t,{strides:i,dilations:o,pad:l,dimRoundingMode:c,filterShape:u}=r,h=C.computeConv2DInfo(a.shape,u,i,o,l,c,!0),d=new $ j(h);return n.runWebGLProgram(d,[a,s],"float32")}var zj={kernelName:jh,backendName:"webgl",kernelFunc:Oj};function Pj(e){let{inputs:t,backend:n,attrs:r}=e,{dy:a,filter:s}=t,{strides:i,dilations:o,pad:l,dimRoundingMode:c,inputShape:u}=r,h=C.computeConv2DInfo(u,s.shape,i,o,l,c,!0),d=new Dj(h);return n.runWebGLProgram(d,[a,s],"float32")}var Lj={kernelName:Uh,backendName:"webgl",kernelFunc:Pj},Wj=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-15 21:01:27 +02:00
}
2021-04-17 00:03:15 +02:00
` }};function Bj(e){let{inputs:t,backend:n}=e,{x:r}=t,a=[...r.shape,...r.shape],s=_.sizeFromShape(r.shape),i=Ae({inputs:{x:r},backend:n,attrs:{shape:[s]}}),o=new Wj(s),l=n.runWebGLProgram(o,[i],i.dtype),c=Ae({inputs:{x:l},backend:n,attrs:{shape:a}});return n.disposeIntermediateTensorInfo(i),n.disposeIntermediateTensorInfo(l),c}var Vj={kernelName:Hh,backendName:"webgl",kernelFunc:Bj},jj=class{constructor(e){this.variableNames=["x","W"],this.outputShape=e.outShape;let{inHeight:t,inWidth:n,padInfo:r,strideHeight:a,strideWidth:s,filterHeight:i,filterWidth:o,dilationHeight:l,dilationWidth:c}=e,{top:u,left:h}=r;this.userCode= `
const ivec2 strides = ivec2 ( $ { a } , $ { s } ) ;
const ivec2 pads = ivec2 ( $ { u } , $ { h } ) ;
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 * $ { c } ;
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-03-30 15:03:18 +02:00
}
}
}
2021-04-17 00:03:15 +02:00
float result = curVal ;
setOutput ( result ) ;
2021-03-30 15:03:18 +02:00
}
2021-04-17 00:03:15 +02:00
` }};function Uj(e){let{inputs:t,backend:n,attrs:r}=e,{x:a,filter:s}=t,{strides:i,pad:o,dilations:l}=r,c=C.computeDilation2DInfo(a.shape,s.shape,i,o,"NHWC",l),u,h=new jj(c);u=n.runWebGLProgram(h,[a,s],"float32");let d=Ae({inputs:{x:u},backend:n,attrs:{shape:c.outShape}});return n.disposeIntermediateTensorInfo(u),d}var Hj={kernelName:Tu,backendName:"webgl",kernelFunc:Uj};function Gj(e){let{inputs:t,backend:n,attrs:r}=e,{equation:a}=r,s=t,{allDims:i,summedDims:o,idDims:l}=C.decodeEinsumEquation(a,s.length);C.checkEinsumDimSizes(i.length,l,s);let{path:c,steps:u}=C.getEinsumComputePath(o,l),h=u.length,d=null,p=i.length,f=[];for(let m=0;m<h;++m){for(let y of u[m]){let{permutationIndices:A,expandDims:g}=C.getEinsumPermutation(p,l[y]),x;C.isIdentityPermutation(A)?x=s[y]:(x=fn({inputs:{x:s[y]},backend:n,attrs:{perm:A}}),f.push(x));let v=x.shape.slice();for(let w=0;w<g.length;++w)v.splice(g[w],0,1);_.arraysEqual(x.shape,v)||(x=Ae({inputs:{x},backend:n,attrs:{shape:v}}),f.push(x)),d===null?d=x:(d=Ty({inputs:{a:x,b:d},backend:n}),f.push(d))}m<h-1&&(c[m]>=0&&(d=Ip({inputs:{x:d},backend:n,attrs:{axis:c[m]-(i.length-p),keepDims:!1}}),f.push(d)),p--)}for(let m of f)m!==d&&n.disposeIntermediateTensorInfo(m);return d}var qj={kernelName:Xh,backendName:"webgl",kernelFunc:Gj},Xj="return (x >= 0.0) ? x : (exp(x) - 1.0);",Kj= `
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 ;
` ,Zj=Xe({opSnippet:Xj,packedOpSnippet:Kj}),Yj={kernelName:wo,backendName:"webgl",kernelFunc:Zj},Jj="return (b >= 1.0) ? a : a * (b + 1.0);",Qj= `
vec4 bGTEZero = vec4 ( greaterThanEqual ( b , vec4 ( 0. ) ) ) ;
return ( bGTEZero * a ) + ( ( vec4 ( 1.0 ) - bGTEZero ) * ( a * ( b + vec4 ( 1.0 ) ) ) ) ;
` ,eU=e=>{let{inputs:t,backend:n}=e,{dy:r,y:a}=t,s=J().getBool("WEBGL_PACK_BINARY_OPERATIONS")?new vc(Qj,r.shape,a.shape):new Bl(Jj,r.shape,a.shape);return n.runWebGLProgram(s,[r,a],r.dtype)},tU={kernelName:Kh,backendName:"webgl",kernelFunc:eU},nU= `
return vec4 ( equal ( a , b ) ) ;
` ,rU="return float(a == b);",aU=tn({opSnippet:rU,packedOpSnippet:nU,dtype:"bool"}),sU={kernelName:_o,backendName:"webgl",kernelFunc:aU},iU= `
// 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 ) ) ;
` ,oU=Xe({opSnippet:iU}),lU={kernelName:bo,backendName:"webgl",kernelFunc:oU},w7="return exp(x);",b7=Xe({opSnippet:w7,packedOpSnippet:w7,cpuKernelImpl:sW}),uU={kernelName:ks,backendName:"webgl",kernelFunc:b7};function My(e){let{inputs:t,attrs:n,backend:r}=e,{dim:a}=n,{input:s}=t,i=s.shape.length,o=s.shape.slice(),l=a;return a<0&&(_.assert(-(i+1)<=a,()=> ` Axis must be in the interval [ $ { - ( i + 1 ) } , $ { i } ] ` ),l=i+a+1),o.splice(l,0,1),Ae({inputs:{x:s},backend:r,attrs:{shape:o}})}var cU={kernelName:vo,backendName:"webgl",kernelFunc:My},_7="return exp(x) - 1.0;",hU=Xe({opSnippet:_7,packedOpSnippet:_7,cpuKernelImpl:iW}),dU={kernelName:ko,backendName:"webgl",kernelFunc:hU},v7=class{constructor(e,t,n){this.variableNames=["real","imag"];let r=t[1];this.outputShape=t;let a=n? ` 2.0 * $ { Math . PI } ` : ` - 2.0 * $ { Math . PI } ` ,s=n? ` $ { r } . 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 = $ { a } ;
float unaryOpComplex ( float real , float expR , float imag , float expI ) {
$ { i }
2021-04-15 21:01:27 +02:00
}
2021-04-17 00:03:15 +02:00
float mulMatDFT ( int batch , int index ) {
float indexRatio = float ( index ) / float ( $ { r } ) ;
float exponentMultiplierTimesIndexRatio =
exponentMultiplier * indexRatio ;
float result = 0.0 ;
for ( int i = 0 ; i < $ { r } ; 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 } ;
2021-04-15 21:01:27 +02:00
}
2021-04-17 00:03:15 +02:00
return result ;
2021-04-15 21:01:27 +02:00
}
2021-04-17 00:03:15 +02:00
void main ( ) {
ivec2 coords = getOutputCoords ( ) ;
setOutput ( mulMatDFT ( coords [ 0 ] , coords [ 1 ] ) ) ;
2021-04-15 21:01:27 +02:00
}
2021-04-17 00:03:15 +02:00
` }};function k7(e,t,n){let r=n.texData.get(e.dataId),a=_.sizeFromShape(e.shape),s=e.shape[e.shape.length-1],i=a/s,o=Ae({inputs:{x:e},backend:n,attrs:{shape:[i,s]}}),l=o.shape,c=new v7("real",l,t),u=new v7("imag",l,t),h=[{dataId:r.complexTensorInfos.real.dataId,dtype:r.complexTensorInfos.real.dtype,shape:l},{dataId:r.complexTensorInfos.imag.dataId,dtype:r.complexTensorInfos.imag.dtype,shape:l}],d=n.runWebGLProgram(c,h,"float32"),p=n.runWebGLProgram(u,h,"float32"),f=qa({inputs:{real:d,imag:p},backend:n});n.disposeIntermediateTensorInfo(d),n.disposeIntermediateTensorInfo(p);let m=Ae({inputs:{x:f},backend:n,attrs:{shape:e.shape}});return n.disposeIntermediateTensorInfo(o),n.disposeIntermediateTensorInfo(f),m}function pU(e){let{inputs:t,backend:n}=e,{input:r}=t;return k7(r,!1,n)}var fU={kernelName:Zh,backendName:"webgl",kernelFunc:pU},mU=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 ) ;
2021-04-15 21:01:27 +02:00
}
2021-04-17 00:03:15 +02:00
` }getCustomSetupFunc(e){return(t,n)=>{this.valueLoc==null&&(this.valueLoc=t.getUniformLocationNoThrow(n,"value")),t.gl.uniform1f(this.valueLoc,e)}}};function Fy(e){let{backend:t,attrs:n}=e,{shape:r,value:a}=n,{dtype:s}=n;if(s=s||_.inferDtype(a),s==="string"){let i=_.getArrayFromDType(s,_.sizeFromShape(r));return i.fill(a),t.makeTensorInfo(r,s,i)}else{let i=new mU(r,a),o=i.getCustomSetupFunc(a);return t.runWebGLProgram(i,[],s,o)}}var yU={kernelName:Eu,backendName:"webgl",kernelFunc:Fy},AU=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 ] ) ;
2021-04-15 21:01:27 +02:00
}
2021-04-17 00:03:15 +02:00
setOutput ( outputValue ) ;
2021-04-15 21:01:27 +02:00
}
2021-04-17 00:03:15 +02:00
` }},gU={kernelName:Io,backendName:"webgl",kernelFunc:({inputs:e,backend:t})=>{let{image:n}=e,r=t,a=new AU(n.shape);return r.runWebGLProgram(a,[n],n.dtype)}},I7="return floor(x);",xU=Xe({opSnippet:I7,packedOpSnippet:I7,cpuKernelImpl:oW}),wU={kernelName:Is,backendName:"webgl",kernelFunc:xU},bU= `
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 ;
}
` ,_U= `
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 ] ) ;
}
if ( cond [ 1 ] ) {
result [ 1 ] = idiv ( ia [ 1 ] , ib [ 1 ] , s [ 1 ] ) ;
}
if ( cond [ 2 ] ) {
result [ 2 ] = idiv ( ia [ 2 ] , ib [ 2 ] , s [ 2 ] ) ;
}
if ( cond [ 3 ] ) {
result [ 3 ] = idiv ( ia [ 3 ] , ib [ 3 ] , s [ 3 ] ) ;
}
return vec4 ( result ) ;
` ,vU=tn({opSnippet:bU,packedOpSnippet:_U,dtype:"int32"}),kU={kernelName:Ss,backendName:"webgl",kernelFunc:vU},IU=class{constructor(e){this.variableNames=["A"];let t=dn(),[n,r]=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 ( $ { r } . 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-15 21:01:27 +02:00
}
2021-04-17 00:03:15 +02:00
setOutput ( floor ( value * 255.0 + 0.5 ) ) ;
2021-04-15 21:01:27 +02:00
}
2021-04-17 00:03:15 +02:00
` }},SU=class{constructor(e){this.variableNames=["A"],this.packedInputs=!1,this.packedOutput=!0;let t=dn(),[n,r]=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 ( $ { r } . 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-03-30 15:03:18 +02:00
}
2021-04-17 00:03:15 +02:00
result [ row * 2 + col ] = floor ( value * 255.0 + 0.5 ) ;
2021-03-30 15:03:18 +02:00
}
}
2021-04-17 00:03:15 +02:00
$ { t . output } = result ;
2021-04-15 21:01:27 +02:00
}
2021-04-17 00:03:15 +02:00
` }},TU={kernelName:hd,backendName:"webgl",kernelFunc:NU},jl;function NU(e){let{inputs:t,backend:n,attrs:r}=e,{pixels:a}=t,{numChannels:s}=r,i=typeof HTMLVideoElement!="undefined"&&a instanceof HTMLVideoElement,o=typeof HTMLImageElement!="undefined"&&a instanceof HTMLImageElement,[l,c]=i?[a.videoWidth,a.videoHeight]:[a.width,a.height],u=[c,l],h=[c,l,s];(o||i)&&(jl==null&&(jl=document.createElement("canvas").getContext("2d")),jl.canvas.width=l,jl.canvas.height=c,jl.drawImage(a,0,0,l,c),a=jl.canvas);let d=n.makeTensorInfo(u,"int32");n.texData.get(d.dataId).usage=ar.PIXELS,n.gpgpu.uploadPixelDataToTexture(n.getTexture(d.dataId),a);let p=J().getBool("WEBGL_PACK")?new SU(h):new IU(h),f=n.runWebGLProgram(p,[d],"int32");return n.disposeData(d.dataId),f}function EU(e){let{inputs:t,backend:n,attrs:r}=e,{x:a,filter:s,bias:i,preluActivationWeights:o}=t,{strides:l,pad:c,dataFormat:u,dilations:h,dimRoundingMode:d,activation:p,leakyreluAlpha:f}=r,m=C.convertConv2DDataFormat(u),y=C.computeConv2DInfo(a.shape,s.shape,l,h,c,d,!1,m),A,g=[];if(y.filterHeight===1&&y.filterWidth===1&&y.dilationHeight===1&&y.dilationWidth===1&&y.strideHeight===1&&y.strideWidth===1&&(y.padInfo.type==="SAME"||y.padInfo.type==="VALID"))A=p7({x:a,filter:s,convInfo:y,backend:n,bias:i,activation:p,preluActivationWeights:o,leakyreluAlpha:f});else if(J().getBool("WEBGL_CONV_IM2COL")&&a.shape[0]===1)A=f7({x:a,filter:s,convInfo:y,backend:n,bias:i,activation:p,preluActivationWeights:o,leakyreluAlpha:f});else{let v=i!=null,w=o!=null,b=p==="leakyrelu",k=p?vp(p,!1):null,N=new d7(y,v,k,w,b),E=[a,s];if(i&&E.push(i),o&&E.push(o),b){let F=n.makeTensorInfo([],"float32",_.createScalarValue(f,"float32"));E.push(F),g.push(F)}A=n.runWebGLProgram(N,E,"float32")}let x=Ae({inputs:{x:A},backend:n,attrs:{shape:y.outShape}});return g.push(A),g.forEach(v=>n.disposeIntermediateTensorInfo(v)),x}var CU={kernelName:oi,backendName:"webgl",kernelFunc:EU};function RU(e){let{inputs:t,backend:n,attrs:r}=e,{x:a,filter:s,bias:i,preluActivationWeights:o}=t,{strides:l,pad:c,dilations:u,dimRoundingMode:h,activation:d,leakyreluAlpha:p}=r,f=[],m=u;m==null&&(m=[1,1]),_.assert(C.eitherStridesOrDilationsAreOne(l,m),()=> ` Error in depthwiseConv2d : Either strides or dilations must be 1. Got strides $ { l } and dilations '${m}' ` );let y=C.computeConv2DInfo(a.shape,s.shape,l,m,c,h,!0),A=J().getBool("WEBGL_PACK_DEPTHWISECONV")&&y.strideWidth<=2&&y.outChannels/y.inChannels==1,g=d?vp(d,A):null,x=[a,s],v=i!=null,w=o!=null,b=d==="leakyrelu";if(v&&x.push(i),w&&x.push(o),b){let E=n.makeTensorInfo([],"float32",_.createScalarValue(p,"float32"));x.push(E),f.push(E)}let k;A?k=new x7(y,v,g,w,b):k=new g7(y,v,g,w,b);let N=n.runWebGLProgram(k,x,"float32");return f.forEach(E=>n.disposeIntermediateTensorInfo(E)),N}var MU={kernelName:li,backendName:"webgl",kernelFunc:RU},FU=class{constructor(e,t,n){this.sliceDim=e,this.strides=t,this.variableNames=["x","indices"],this.outputShape=n;let r=lt(t.length),a=lt(n.length),s=this.sliceDim>1?"strides[j]":"strides";this.userCode= `
$ { r } strides = $ { r } ( $ { this . strides } ) ;
void main ( ) {
$ { a } coords = getOutputCoords ( ) ;
int flattenIndex = 0 ;
for ( int j = 0 ; j < $ { this . sliceDim } ; j ++ ) {
int index = round ( getIndices ( coords [ 0 ] , j ) ) ;
flattenIndex += index * $ { s } ;
2021-03-30 15:03:18 +02:00
}
2021-04-17 00:03:15 +02:00
setOutput ( getX ( flattenIndex , coords [ 1 ] ) ) ;
2021-03-30 15:03:18 +02:00
}
2021-04-17 00:03:15 +02:00
` }};function $ U(e){let{inputs:t,backend:n}=e,{params:r,indices:a}=t,s=a.shape,i=s[s.length-1],[o,l,c,u]=C.prepareAndValidate(r,a),h=Ae({inputs:{x:a},backend:n,attrs:{shape:[l,i]}}),d=Ae({inputs:{x:r},backend:n,attrs:{shape:[_.sizeFromShape(r.shape)/c,c]}}),p=new FU(i,u,[l,c]),f=n.runWebGLProgram(p,[d,h],d.dtype),m=Ae({inputs:{x:f},backend:n,attrs:{shape:o}});return n.disposeIntermediateTensorInfo(h),n.disposeIntermediateTensorInfo(d),n.disposeIntermediateTensorInfo(f),m}var DU={kernelName:No,backendName:"webgl",kernelFunc: $ U},zU=class{constructor(e,t){this.variableNames=["A","indices"],this.outputShape=t,this.rank=t.length;let n=lt(this.rank),r=OU(e,2);this.userCode= `
void main ( ) {
$ { n } resRC = getOutputCoords ( ) ;
setOutput ( getA ( $ { r } ) ) ;
2021-04-15 21:01:27 +02:00
}
2021-04-17 00:03:15 +02:00
` }};function OU(e,t){let n=["resRC.x","resRC.y","resRC.z","resRC.w"],r=[];for(let a=0;a<e.length;a++)a===2?r.push("int(getIndices(resRC.x, resRC.z))"):r.push( ` $ { n [ a ] } ` );return r.join()}function PU(e){let{inputs:t,backend:n,attrs:r}=e,{x:a,indices:s}=t,{axis:i,batchDims:o}=r,l=_.parseAxisParam(i,a.shape)[0],c=C.segment_util.collectGatherOpShapeInfo(a,s,l,o),u=_.sizeFromShape(s.shape),h=[],d=Ae({inputs:{x:a},backend:n,attrs:{shape:[c.batchSize,c.outerSize,c.dimSize,c.sliceSize]}}),p=Ae({inputs:{x:s},backend:n,attrs:{shape:[c.batchSize,u/c.batchSize]}});h.push(d),h.push(p);let f=[c.batchSize,c.outerSize,u/c.batchSize,c.sliceSize];if(n.shouldExecuteOnCPU([a,s])||a.dtype==="string"){let g=n.bufferSync(p),x=n.bufferSync(d),v=lW(x,g,f);return h.forEach(w=>n.disposeIntermediateTensorInfo(w)),n.makeTensorInfo(c.outputShape,v.dtype,v.values)}let m=new zU(d.shape,f),y=n.runWebGLProgram(m,[d,p],d.dtype);h.push(y);let A=Ae({inputs:{x:y},backend:n,attrs:{shape:c.outputShape}});return h.forEach(g=>n.disposeIntermediateTensorInfo(g)),A}var LU={kernelName:So,backendName:"webgl",kernelFunc:PU},WU="return float(a > b);",BU= `
return vec4 ( greaterThan ( a , b ) ) ;
` ,VU=tn({opSnippet:WU,packedOpSnippet:BU,cpuKernelImpl:uW,dtype:"bool"}),jU={kernelName:To,backendName:"webgl",kernelFunc:VU},UU="return float(a >= b);",HU= `
return vec4 ( greaterThanEqual ( a , b ) ) ;
` ,GU=tn({opSnippet:UU,packedOpSnippet:HU,dtype:"bool"}),qU={kernelName:Ts,backendName:"webgl",kernelFunc:GU};function XU(e){let{inputs:t,backend:n}=e,{input:r}=t;return k7(r,!0,n)}var KU={kernelName:Yh,backendName:"webgl",kernelFunc:XU},ZU="return float(!isnan(x) && !isinf(x));",YU=Xe({opSnippet:ZU,dtype:"bool"}),JU={kernelName:Eo,backendName:"webgl",kernelFunc:YU},QU="return float(isinf(x));",eH=Xe({opSnippet:QU,dtype:"bool"}),tH={kernelName:Co,backendName:"webgl",kernelFunc:eH},nH="return float(isnan(x));",rH=Xe({opSnippet:nH,dtype:"bool"}),aH={kernelName:Ro,backendName:"webgl",kernelFunc:rH},sH="return float(a < b);",iH= `
return vec4 ( lessThan ( a , b ) ) ;
` ,oH=tn({opSnippet:sH,packedOpSnippet:iH,cpuKernelImpl:cW,dtype:"bool"}),lH={kernelName:Mo,backendName:"webgl",kernelFunc:oH},uH="return float(a <= b);",cH= `
return vec4 ( lessThanEqual ( a , b ) ) ;
` ,hH=tn({opSnippet:uH,packedOpSnippet:cH,dtype:"bool"}),dH={kernelName:Fo,backendName:"webgl",kernelFunc:hH};function pH(e){let{backend:t,attrs:n}=e,{start:r,stop:a,num:s}=n,i=hW(r,a,s);return t.makeTensorInfo([i.length],"float32",i)}var fH={kernelName:Qh,backendName:"webgl",kernelFunc:pH},mH= ` if ( x < 0.0 ) return NAN ;
return log ( x ) ; ` ,yH= `
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 ;
` ,AH=Xe({opSnippet:mH,packedOpSnippet:yH,cpuKernelImpl:dW}),gH={kernelName:Rs,backendName:"webgl",kernelFunc:AH},xH="return log(1.0 + x);",wH=Xe({opSnippet:xH}),bH={kernelName: $ o,backendName:"webgl",kernelFunc:wH},_H="return float(a >= 1.0 && b >= 1.0);",vH= `
return vec4 (
vec4 ( greaterThanEqual ( a , vec4 ( 1.0 ) ) ) *
vec4 ( greaterThanEqual ( b , vec4 ( 1.0 ) ) ) ) ;
` ,kH=tn({opSnippet:_H,packedOpSnippet:vH,dtype:"bool"}),IH={kernelName:Do,backendName:"webgl",kernelFunc:kH},SH="return float(!(x >= 1.0));",NH=Xe({opSnippet:SH}),TH={kernelName:Cu,backendName:"webgl",kernelFunc:NH},EH="return float(a >= 1.0 || b >= 1.0);",CH= `
return min (
vec4 ( greaterThanEqual ( a , vec4 ( 1.0 ) ) ) +
vec4 ( greaterThanEqual ( b , vec4 ( 1.0 ) ) ) ,
vec4 ( 1.0 ) ) ;
` ,RH=tn({opSnippet:EH,packedOpSnippet:CH,dtype:"bool"}),MH={kernelName:Ru,backendName:"webgl",kernelFunc:RH},FH=class{constructor(e,t,n,r,a){this.variableNames=["x"],this.outputShape=[];let s=t,i=e[3]-1;this.outputShape=e;let o,l= ` float ( $ { n } ) + float ( $ { r } ) * sum ` ;a===.5?o= ` inversesqrt ( $ { l } ) ` :a===1?o= ` 1.0 / ( $ { l } ) ` :o= ` exp ( log ( $ { l } ) * float ( - $ { a } ) ) ; ` ,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 ;
}
2021-04-15 21:01:27 +02:00
}
2021-04-17 00:03:15 +02:00
float val = x * $ { o } ;
setOutput ( val ) ;
2021-04-15 21:01:27 +02:00
}
2021-04-17 00:03:15 +02:00
` }}, $ H=class{constructor(e,t,n,r,a){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 ( $ { r } ) * sum ` ;a===.5?o= ` inversesqrt ( $ { l } ) ` :a===1?o= ` 1.0 / ( $ { l } ) ` :o= ` exp ( log ( $ { l } ) * float ( - $ { a } ) ) ; ` ,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-03-30 15:03:18 +02:00
}
2021-04-17 00:03:15 +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-15 21:01:27 +02:00
}
2021-04-17 00:03:15 +02:00
vec4 result = xAtOutputCoords * $ { o } ;
setOutput ( result ) ;
2021-04-15 21:01:27 +02:00
}
2021-04-17 00:03:15 +02:00
` }},DH=e=>{let{inputs:t,backend:n,attrs:r}=e,{x:a}=t,{depthRadius:s,bias:i,alpha:o,beta:l}=r,c=J().getBool("WEBGL_PACK_NORMALIZATION")?new $ H(a.shape,s,i,o,l):new FH(a.shape,s,i,o,l);return n.runWebGLProgram(c,[a],a.dtype)},OH={kernelName:Mu,backendName:"webgl",kernelFunc:DH},zH=class{constructor(e,t,n,r,a){this.variableNames=["inputImage","outputImage","dy"],this.outputShape=[],this.outputShape=e,this.depth=e[3],this.depthRadius=t,this.bias=n,this.alpha=r,this.beta=a,this.userCode= `
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 ;
}
}
norm = float ( $ { r } ) * 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 ( $ { r } )
* float ( $ { a } )
* getInputImage ( b , r , c , k ) * getOutputImage ( b , r , c , d )
/ n o r m ;
if ( k == d ) {
dyi += pow ( norm , - 1.0 * $ { a } ) ;
}
if ( k == coords [ 3 ] ) {
dyi *= getDy ( b , r , c , d ) ;
result += dyi ;
}
}
else {
break ;
}
}
}
setOutput ( result ) ;
}
` }},PH=e=>{let{inputs:t,backend:n,attrs:r}=e,{x:a,y:s,dy:i}=t,{depthRadius:o,bias:l,alpha:c,beta:u}=r,h=new zH(a.shape,o,l,c,u);return n.runWebGLProgram(h,[a,s,i],a.dtype)},LH={kernelName:ed,backendName:"webgl",kernelFunc:PH};function WH(e,t,n,r){let a=_.sizeFromShape(t),s=_.sizeFromShape(e.shape)/a,i=Ae({inputs:{x:e},attrs:{shape:[s,a]},backend:r}),o=Ri(i,e.dtype,"max",r),l=Ae({inputs:{x:o},attrs:{shape:n},backend:r});return r.disposeIntermediateTensorInfo(i),r.disposeIntermediateTensorInfo(o),l}function S7(e){let{inputs:t,backend:n,attrs:r}=e,{x:a}=t,{reductionIndices:s,keepDims:i}=r,o=a.shape.length,l=_.parseAxisParam(s,a.shape),c=l,u=C.getAxesPermutation(c,o),h=u!=null,d=n.shouldExecuteOnCPU([a]),p=a;if(h){if(d){let g=n.texData.get(p.dataId).values,x=new Array(o);for(let b=0;b<x.length;b++)x[b]=a.shape[u[b]];let v=Sy(g,a.shape,a.dtype,u,x);p=n.makeTensorInfo(x,a.dtype);let w=n.texData.get(p.dataId);w.values=v}else p=kp(a,u,n);c=C.getInnerMostAxes(c.length,o)}C.assertAxesAreInnerMostDims("max",c,o);let[f,m]=C.computeOutAndReduceShapes(p.shape,c),y=f;i&&(y=C.expandShapeToKeepDim(f,l));let A;if(d){let g=n.texData.get(p.dataId).values,x=pW(g,_.sizeFromShape(m),y,a.dtype);A=n.makeTensorInfo(y,a.dtype);let v=n.texData.get(A.dataId);v.values=x}else A=WH(p,m,y,n);return h&&n.disposeIntermediateTensorInfo(p),A}var BH={kernelName:Ms,backendName:"webgl",kernelFunc:S7},VH=U3+ `
return max ( a , b ) ;
` ,jH= `
vec4 result = vec4 ( max ( a , b ) ) ;
vec4 isNaN = min ( vec4 ( isnan ( a ) ) + vec4 ( isnan ( b ) ) , vec4 ( 1.0 ) ) ;
` +_p+ `
return result ;
` ,UH=tn({opSnippet:VH,packedOpSnippet:jH,cpuKernelImpl:fW}),HH={kernelName:Fs,backendName:"webgl",kernelFunc:UH};function GH(e){let{inputs:t,backend:n,attrs:r}=e,{x:a}=t;Fl(a,"maxPool");let{filterSize:s,strides:i,pad:o,dimRoundingMode:l}=r,c=1;_.assert(C.eitherStridesOrDilationsAreOne(i,c),()=> ` Error in maxPool : Either strides or dilations must be 1. Got strides $ { i } and dilations '${c}' ` );let u=C.computePool2DInfo(a.shape,s,i,c,o,l);if(u.filterWidth===1&&u.filterHeight===1&&_.arraysEqual(u.inShape,u.outShape))return Vn({inputs:{x:a},backend:n});let h=new kc(u,"max",!1);return n.runWebGLProgram(h,[a],a.dtype)}var qH={kernelName: $ s,backendName:"webgl",kernelFunc:GH};function XH(e){let{inputs:t,backend:n,attrs:r}=e,{x:a}=t,{filterSize:s,strides:i,pad:o,dataFormat:l,dimRoundingMode:c}=r,u=[1,1,1],h=C.computePool3DInfo(a.shape,s,i,u,o,c,l),d=new Ey(h,"max",!1);return n.runWebGLProgram(d,[a],a.dtype)}var KH={kernelName:Fu,backendName:"webgl",kernelFunc:XH},ZH=class{constructor(e){this.variableNames=["dy","maxPos"],this.outputShape=e.inShape;let t=e.strideHeight,n=e.strideWidth,r=e.dilationHeight,a=e.effectiveFilterHeight,s=e.effectiveFilterWidth,i=a-1-e.padInfo.top,o=s-1-e.padInfo.left,l=a*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 < $ { a } ;
wR += $ { r } ) {
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 ;
}
}
setOutput ( dotProd ) ;
}
` }},YH=class{constructor(e){this.variableNames=["dy","maxPos"],this.outputShape=e.inShape;let t=e.strideDepth,n=e.strideHeight,r=e.strideWidth,a=e.dilationDepth,s=e.dilationHeight,i=e.dilationWidth,o=e.effectiveFilterDepth,l=e.effectiveFilterHeight,c=e.effectiveFilterWidth,u=o-1-e.padInfo.front,h=l-1-e.padInfo.top,d=c-1-e.padInfo.left,p=o*l*c-1;this.userCode= `
const ivec3 pads = ivec3 ( $ { u } , $ { h } , $ { d } ) ;
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 += $ { a } ) {
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 < $ { c } ;
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 ( batch , idyD , idyR , idyC , ch ) ;
int maxPosValue = $ { p } -
int ( getMaxPos ( batch , idyD , idyR , idyC , ch ) ) ;
// Get the current value, check it against the value from the
// position matrix.
int curPosValue =
wD * $ { l } * $ { c } +
wR * $ { c } + wC ;
float mask = float ( maxPosValue == curPosValue ? 1.0 : 0.0 ) ;
dotProd += dyValue * mask ;
}
}
2021-04-15 21:01:27 +02:00
}
2021-04-17 00:03:15 +02:00
setOutput ( dotProd ) ;
}
` }};function JH(e){let{inputs:t,backend:n,attrs:r}=e,{dy:a,input:s}=t,i=s,{filterSize:o,strides:l,pad:c,dimRoundingMode:u}=r,h=[1,1,1],d=C.computePool3DInfo(i.shape,o,l,h,c,u),p=new Ey(d,"max",!0),f=n.runWebGLProgram(p,[i],i.dtype),m=new YH(d),y=n.runWebGLProgram(m,[a,f],i.dtype);return n.disposeIntermediateTensorInfo(f),y}var QH={kernelName:nd,backendName:"webgl",kernelFunc:JH};function eG(e){let{inputs:t,backend:n,attrs:r}=e,{dy:a,input:s,output:i}=t,o=s;Fl([s,i],"maxPoolGrad");let{filterSize:l,strides:c,pad:u,dimRoundingMode:h}=r,d=C.computePool2DInfo(o.shape,l,c,1,u,h),p=!0,f=new kc(d,"max",p),m=n.runWebGLProgram(f,[o],o.dtype),y=new ZH(d),A=n.runWebGLProgram(y,[a,m],o.dtype);return n.disposeIntermediateTensorInfo(m),A}var tG={kernelName:td,backendName:"webgl",kernelFunc:eG};function nG(e,t,n,r){let a=new kc(n,"max",!1),s=r.runWebGLProgram(a,[e],"float32");a=new kc(n,"max",!0,!0,t);let i=r.runWebGLProgram(a,[e],"float32");return[s,i]}var rG={kernelName:rd,backendName:"webgl",kernelFunc:({inputs:e,attrs:t,backend:n})=>{let{x:r}=e,{filterSize:a,strides:s,pad:i,includeBatchInIndex:o}=t,l=n;_.assert(r.shape.length===4,()=> ` Error in maxPool : input must be rank 4 but got rank $ { r . shape . length } . ` );let c=[1,1];_.assert(C.eitherStridesOrDilationsAreOne(s,c),()=> ` Error in maxPool : Either strides or dilations must be 1. Got strides $ { s } and dilations '${c}' ` );let u=C.computePool2DInfo(r.shape,a,s,c,i),[h,d]=nG(r,o,u,l);return[h,d]}};function aG(e,t,n,r){let a=_.sizeFromShape(t),s=_.sizeFromShape(e.shape)/a,i=Ae({inputs:{x:e},attrs:{shape:[s,a]},backend:r}),o=Ri(i,"float32","mean",r),l=Ae({inputs:{x:o},attrs:{shape:n},backend:r});return r.disposeIntermediateTensorInfo(i),r.disposeIntermediateTensorInfo(o),l}var sG={kernelName:Ds,backendName:"webgl",kernelFunc:({inputs:e,attrs:t,backend:n})=>{let{x:r}=e,{keepDims:a,axis:s}=t,i=n,o=r.shape.length,l=_.parseAxisParam(s,r.shape),c=l,u=C.getAxesPermutation(c,o),h=u!=null,d=i.shouldExecuteOnCPU([r]),p=[],f=r;if(h){if(d){let x=i.texData.get(f.dataId).values,v=new Array(o);for(let k=0;k<v.length;k++)v[k]=r.shape[u[k]];let w=Sy(x,r.shape,r.dtype,u,v);f=i.makeTensorInfo(v,r.dtype);let b=i.texData.get(f.dataId);b.values=w}else f=kp(r,u,i);p.push(f),c=C.getInnerMostAxes(c.length,o)}C.assertAxesAreInnerMostDims("sum",c,o);let[m,y]=C.computeOutAndReduceShapes(f.shape,c),A=m;a&&(A=C.expandShapeToKeepDim(m,l));let g=aG(f,y,A,i);for(let x of p)i.disposeIntermediateTensorInfo(x);return g}};function iG(e){let{inputs:t,backend:n,attrs:r}=e,{x:a}=t,{axis:s,keepDims:i}=r,o=a.shape.length,l=_.parseAxisParam(s,a.shape),c=l,u=C.getAxesPermutation(c,o),h=a;u!=null&&(h=fn({inputs:{x:a},backend:n,attrs:{perm:u}}),c=C.getInnerMostAxes(c.length,a.shape.length)),C.assertAxesAreInnerMostDims("min",c,o);let[d,p]=C.computeOutAndReduceShapes(h.shape,c),f=_.sizeFromShape(p),m=Ae({inputs:{x:h},backend:n,attrs:{shape:[-1,f]}}),y=Ri(m,m.dtype,"min",n),A;if(i){let g=C.expandShapeToKeepDim(d,l);A=Ae({inputs:{x:y},backend:n,attrs:{shape:g}})}else A=Ae({inputs:{x:y},backend:n,attrs:{shape:d}});return n.disposeIntermediateTensorInfo(m),n.disposeIntermediateTensorInfo(y),u!=null&&n.disposeIntermediateTensorInfo(h),A}var oG={kernelName:Os,backendName:"webgl",kernelFunc:iG},lG=U3+ `
return min ( a , b ) ;
` ,uG= `
vec4 result = vec4 ( min ( a , b ) ) ;
vec4 isNaN = min ( vec4 ( isnan ( a ) ) + vec4 ( isnan ( b ) ) , vec4 ( 1.0 ) ) ;
` +_p+ `
return result ;
` ,cG=tn({opSnippet:lG,packedOpSnippet:uG,cpuKernelImpl:mW}),hG={kernelName:zs,backendName:"webgl",kernelFunc:cG},dG=class{constructor(e,t,n){this.variableNames=["x"],this.outputShape=t.map((c,u)=>c[0]+e[u]+c[1]);let r=e.length,a=lt(r),s=t.map(c=>c[0]).join(","),i=t.map((c,u)=>c[0]+e[u]).join(","),o=["coords[0]","coords[1]","coords[2]","coords[3]"].slice(0,r),l=n==="reflect"?0:1;if(r===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-15 21:01:27 +02:00
}
2021-04-17 00:03:15 +02:00
` ;return}this.userCode= `
$ { a } start = $ { a } ( $ { s } ) ;
$ { a } end = $ { a } ( $ { i } ) ;
void main ( ) {
$ { a } outC = getOutputCoords ( ) ;
for ( int i = 0 ; i < $ { r } ; 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-15 21:01:27 +02:00
}
2021-04-17 00:03:15 +02:00
$ { a } coords = outC - start ;
setOutput ( getX ( $ { o } ) ) ;
2021-03-30 15:03:18 +02:00
}
2021-04-17 00:03:15 +02:00
` }},pG=class{constructor(e,t,n){this.variableNames=["x"],this.packedInputs=!0,this.packedOutput=!0,this.outputShape=t.map((p,f)=>p[0]+e[f]+p[1]);let r=e.length,a=lt(r),s=t.map(p=>p[0]).join(","),i=t.map((p,f)=>p[0]+e[f]).join(","),o=pn("rc",r),l=pn("source",r),c= ` $ { o [ r - 1 ] } < $ { this . outputShape [ r - 1 ] } ` ,u=r===1?"source": ` vec2 ( $ { l . slice ( - 2 ) . join ( ) } ) ` ,h=n==="reflect"?0:1,d="";if(r===1){let p= `
$ { a } source = rc ;
if ( source < start ) {
source = start * 2 - source - $ { h } ;
} else if ( source >= end ) {
source = ( end - 1 ) * 2 - source + $ { h } ;
}
source -= start ;
` ;d= `
$ { a } rc = outputLoc ;
$ { p }
result [ 0 ] = getChannel ( getX ( $ { l . join ( ) } ) , $ { u } ) ;
$ { o [ r - 1 ] } += 1 ;
if ( $ { c } ) {
$ { p }
result [ 1 ] = getChannel ( getX ( $ { l . join ( ) } ) , $ { u } ) ;
}
` }else{let p= `
$ { a } source = rc ;
$ { a } lt = $ { a } ( lessThan ( source , start ) ) ;
$ { a } gte = $ { a } ( greaterThanEqual ( source , end ) ) ;
$ { a } orig = 1 - ( lt + gte ) ;
source = orig * source +
lt * ( start * 2 - source - $ { h } ) +
gte * ( ( end - 1 ) * 2 - source + $ { h } ) ;
source -= start ;
` ;d= `
$ { a } rc = outputLoc ;
$ { p }
result [ 0 ] = getChannel ( getX ( $ { l . join ( ) } ) , $ { u } ) ;
$ { o [ r - 1 ] } += 1 ;
if ( $ { c } ) {
$ { p }
result [ 1 ] = getChannel ( getX ( $ { l . join ( ) } ) , $ { u } ) ;
}
rc = outputLoc ;
$ { o [ r - 2 ] } += 1 ;
if ( $ { o [ r - 2 ] } < $ { this . outputShape [ r - 2 ] } ) {
$ { p }
result [ 2 ] = getChannel ( getX ( $ { l . join ( ) } ) , $ { u } ) ;
$ { o [ r - 1 ] } += 1 ;
if ( $ { c } ) {
$ { p }
result [ 3 ] = getChannel ( getX ( $ { l . join ( ) } ) , $ { u } ) ;
}
}
` }this.userCode= `
const $ { a } start = $ { a } ( $ { s } ) ;
const $ { a } end = $ { a } ( $ { i } ) ;
void main ( ) {
$ { a } outputLoc = getOutputCoords ( ) ;
vec4 result = vec4 ( 0. ) ;
$ { d }
setOutput ( result ) ;
2021-03-30 15:03:18 +02:00
}
2021-04-17 00:03:15 +02:00
` }},fG=({inputs:e,backend:t,attrs:n})=>{let{x:r}=e,{paddings:a,mode:s}=n,i=J().getBool("WEBGL_PACK_ARRAY_OPERATIONS")?new pG(r.shape,a,s):new dG(r.shape,a,s);return t.runWebGLProgram(i,[r],r.dtype)},mG={kernelName:Ps,backendName:"webgl",kernelFunc:fG},yG= ` if ( b == 0.0 ) return NAN ;
return mod ( a , b ) ; ` ,AG= `
vec4 result = mod ( a , b ) ;
vec4 isNaN = vec4 ( equal ( b , vec4 ( 0.0 ) ) ) ;
` +_p+ `
return result ;
` ,gG=tn({opSnippet:yG,packedOpSnippet:AG}),xG={kernelName:Oo,backendName:"webgl",kernelFunc:gG},wG=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-15 21:01:27 +02:00
}
2021-04-17 00:03:15 +02:00
` }getCustomSetupFunc(e){return(t,n)=>{this.seedLoc==null&&(this.seedLoc=t.getUniformLocation(n,"seed")),t.gl.uniform1f(this.seedLoc,e)}}},bG= `
if ( a == b ) {
return 1.0 ;
} ;
return a / b ; ` ,_G= `
// 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-15 21:01:27 +02:00
}
2021-04-17 00:03:15 +02:00
if ( a . y == b . y ) {
result . y = 1. ;
2021-04-15 21:01:27 +02:00
}
2021-04-17 00:03:15 +02:00
if ( a . z == b . z ) {
result . z = 1. ;
2021-04-15 21:01:27 +02:00
}
2021-04-17 00:03:15 +02:00
if ( a . w == b . w ) {
result . w = 1. ;
2021-04-15 21:01:27 +02:00
}
2021-04-17 00:03:15 +02:00
return result ;
` ,N7=tn({opSnippet:bG,packedOpSnippet:_G,checkOutOfBounds:!0}),vG={kernelName:vs,backendName:"webgl",kernelFunc:N7},T7="return a - b;",E7=tn({opSnippet:T7,packedOpSnippet:T7,supportsComplex:!0,cpuKernelImpl:vW}),kG={kernelName:ni,backendName:"webgl",kernelFunc:E7};function C7(e){let{inputs:t,backend:n,attrs:r}=e,{logits:a}=t,{dim:s}=r,i=_.parseAxisParam([s],a.shape),o=S7({inputs:{x:a},backend:n,attrs:{reductionIndices:i,keepDims:!1}}),l=C.expandShapeToKeepDim(o.shape,i),c=Ae({inputs:{x:o},backend:n,attrs:{shape:l}}),u=E7({inputs:{a,b:c},backend:n}),h=b7({inputs:{x:u},backend:n}),d=Ip({inputs:{x:h},backend:n,attrs:{axis:i,keepDims:!1}}),p=Ae({inputs:{x:d},backend:n,attrs:{shape:l}}),f=N7({inputs:{a:h,b:p},backend:n});return n.disposeIntermediateTensorInfo(o),n.disposeIntermediateTensorInfo(c),n.disposeIntermediateTensorInfo(u),n.disposeIntermediateTensorInfo(h),n.disposeIntermediateTensorInfo(d),n.disposeIntermediateTensorInfo(p),f}var IG={kernelName:ei,backendName:"webgl",kernelFunc:C7};function SG(e){let{inputs:t,backend:n,attrs:r}=e,{logits:a}=t,{numSamples:s,seed:i,normalized:o}=r,l=o?a:C7({inputs:{logits:a},backend:n,attrs:{dim:a.shape.length-1}}),c=l.shape[0],u=l.shape[1],h=new wG(c,u,s),d=h.getCustomSetupFunc(i),p=n.runWebGLProgram(h,[l],"int32",d);return o||n.disposeIntermediateTensorInfo(l),p}var NG={kernelName:ad,backendName:"webgl",kernelFunc:SG},R7="return -x;";function TG(e){let{inputs:t,backend:n}=e,{x:r}=t;if(n.shouldExecuteOnCPU([r])){let s=n.texData.get(r.dataId),[i,o]=AW(s.values,r.shape,r.dtype);return n.makeTensorInfo(o,r.dtype,i)}let a;return J().getBool("WEBGL_PACK_UNARY_OPERATIONS")?a=new Ll(r.shape,R7):a=new Ga(r.shape,R7),n.runWebGLProgram(a,[r],r.dtype)}var EG={kernelName:zo,backendName:"webgl",kernelFunc:TG},CG=Hr.nonMaxSuppressionV3Impl;function RG(e){C.warn("tf.nonMaxSuppression() in webgl locks the UI thread. Call tf.nonMaxSuppressionAsync() instead");let{inputs:t,backend:n,attrs:r}=e,{boxes:a,scores:s}=t,{maxOutputSize:i,iouThreshold:o,scoreThreshold:l}=r,c=n.readSync(a.dataId),u=n.readSync(s.dataId),{selectedIndices:h}=CG(c,u,i,o,l);return n.makeTensorInfo([h.length],"int32",new Int32Array(h))}var MG={kernelName:Lo,backendName:"webgl",kernelFunc:RG},FG=Hr.nonMaxSuppressionV4Impl;function $ G(e){C.warn("tf.nonMaxSuppression() in webgl locks the UI thread. Call tf.nonMaxSuppressionAsync() instead");let{inputs:t,backend:n,attrs:r}=e,{boxes:a,scores:s}=t,{maxOutputSize:i,iouThreshold:o,scoreThreshold:l,padToMaxOutputSize:c}=r,u=n.readSync(a.dataId),h=n.readSync(s.dataId),{selectedIndices:d,validOutputs:p}=FG(u,h,i,o,l,c);return[n.makeTensorInfo([d.length],"int32",new Int32Array(d)),n.makeTensorInfo([],"int32",new Int32Array([p]))]}var DG={kernelName:Wo,backendName:"webgl",kernelFunc: $ G},OG=Hr.nonMaxSuppressionV5Impl;function zG(e){C.warn("tf.nonMaxSuppression() in webgl locks the UI thread. Call tf.nonMaxSuppressionAsync() instead");let{inputs:t,backend:n,attrs:r}=e,{boxes:a,scores:s}=t,{maxOutputSize:i,iouThreshold:o,scoreThreshold:l,softNmsSigma:c}=r,u=n.readSync(a.dataId),h=n.readSync(s.dataId),d=i,p=o,f=l,m=c,{selectedIndices:y,selectedScores:A}=OG(u,h,d,p,f,m);return[n.makeTensorInfo([y.length],"int32",new Int32Array(y)),n.makeTensorInfo([A.length],"float32",new Float32Array(A))]}var PG={kernelName:Bo,backendName:"webgl",kernelFunc:zG},LG=class{constructor(e,t,n,r){this.variableNames=["indices"],this.outputShape=[e,t],this.userCode= `
void main ( ) {
ivec2 coords = getOutputCoords ( ) ;
int index = round ( getIndices ( coords . x ) ) ;
setOutput ( mix ( float ( $ { r } ) , float ( $ { n } ) ,
float ( index == coords . y ) ) ) ;
2021-04-15 21:01:27 +02:00
}
2021-04-17 00:03:15 +02:00
` }},WG=e=>{let{inputs:t,backend:n,attrs:r}=e,{indices:a}=t,{depth:s,onValue:i,offValue:o}=r,l=_.sizeFromShape(a.shape),c=new LG(l,s,i,o),u=Ae({inputs:{x:a},backend:n,attrs:{shape:[l]}}),h=n.runWebGLProgram(c,[u],a.dtype);n.disposeIntermediateTensorInfo(u);let d=[...a.shape,s],p=Ae({inputs:{x:h},backend:n,attrs:{shape:d}});return n.disposeIntermediateTensorInfo(h),p},BG={kernelName:Ws,backendName:"webgl",kernelFunc:WG};function Cp(e){let{inputs:t,backend:n}=e,{x:r}=t;if(r.dtype==="complex64"){let a=Sc({inputs:{input:r},backend:n}),s=Cp({inputs:{x:a},backend:n}),i=Ep({inputs:{input:r},backend:n}),o=Cp({inputs:{x:i},backend:n}),l=qa({inputs:{real:s,imag:o},backend:n});return n.disposeIntermediateTensorInfo(a),n.disposeIntermediateTensorInfo(s),n.disposeIntermediateTensorInfo(i),n.disposeIntermediateTensorInfo(o),l}else return Fy({attrs:{shape:r.shape,dtype:r.dtype,value:r.dtype==="string"?"":0},backend:n})}var VG={kernelName:al,backendName:"webgl",kernelFunc:Cp};function M7(e){let{inputs:t,backend:n}=e,{x:r}=t;if(r.dtype==="string")throw new Error("onesLike is not supported under string dtype");if(r.dtype==="complex64"){let a=Sc({inputs:{input:r},backend:n}),s=M7({inputs:{x:a},backend:n}),i=Ep({inputs:{input:r},backend:n}),o=Cp({inputs:{x:i},backend:n}),l=qa({inputs:{real:s,imag:o},backend:n});return n.disposeIntermediateTensorInfo(a),n.disposeIntermediateTensorInfo(s),n.disposeIntermediateTensorInfo(i),n.disposeIntermediateTensorInfo(o),l}else return Fy({attrs:{shape:r.shape,dtype:r.dtype,value:1},backend:n})}var jG={kernelName:Vo,backendName:"webgl",kernelFunc:M7};function UG(e){let{inputs:t,backend:n,attrs:r}=e,{axis:a}=r;if(t.length===1)return My({inputs:{input:t[0]},backend:n,attrs:{dim:a}});let s=t[0].shape,i=t[0].dtype;t.forEach(u=>{_.assertShapesMatch(s,u.shape,"All tensors passed to stack must have matching shapes"),_.assert(i===u.dtype,()=>"All tensors passed to stack must have matching dtypes")});let o=[],l=t.map(u=>{let h=My({inputs:{input:u},backend:n,attrs:{dim:a}});return o.push(h),h}),c=h7({inputs:l,backend:n,attrs:{axis:a}});return o.forEach(u=>n.disposeIntermediateTensorInfo(u)),c}var HG={kernelName:jo,backendName:"webgl",kernelFunc:UG},GG=class{constructor(e,t,n){this.variableNames=["x"],this.outputShape=t.map((l,c)=>l[0]+e[c]+l[1]);let r=e.length,a=lt(r),s=t.map(l=>l[0]).join(","),i=t.map((l,c)=>l[0]+e[c]).join(","),o=["coords[0]","coords[1]","coords[2]","coords[3]"].slice(0,r);if(r===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 ) ) ;
}
}
` ;return}this.userCode= `
$ { a } start = $ { a } ( $ { s } ) ;
$ { a } end = $ { a } ( $ { i } ) ;
uniform float value ;
void main ( ) {
$ { a } outC = getOutputCoords ( ) ;
if ( any ( lessThan ( outC , start ) ) || any ( greaterThanEqual ( outC , end ) ) ) {
setOutput ( value ) ;
} else {
$ { a } coords = outC - start ;
setOutput ( getX ( $ { o } ) ) ;
}
2021-04-15 21:01:27 +02:00
}
2021-04-17 00:03:15 +02:00
` }getCustomSetupFunc(e){return(t,n)=>{this.valueLoc==null&&(this.valueLoc=t.getUniformLocationNoThrow(n,"value")),t.gl.uniform1f(this.valueLoc,e)}}},qG=class{constructor(e,t,n){this.variableNames=["x"],this.packedInputs=!0,this.packedOutput=!0,this.outputShape=t.map((f,m)=>f[0]+e[m]+f[1]);let r=e.length,a=lt(r),s=t.map(f=>f[0]).join(","),i=t.map((f,m)=>f[0]+e[m]).join(","),o=pn("rc",r),l=pn("source",r),c= ` $ { o [ r - 1 ] } < $ { this . outputShape [ r - 1 ] } ` ,u=r===1?"source": ` vec2 ( $ { l . slice ( - 2 ) . join ( ) } ) ` ,h=[ ` $ { a } rc = outputLoc ; ` , ` $ { o [ r - 1 ] } += 1 ;
if ( $ { c } ) {
` ,r===1?"": ` }
rc = outputLoc ;
$ { o [ r - 2 ] } += 1 ;
if ( $ { o [ r - 2 ] } < $ { this . outputShape [ r - 2 ] } ) { ` ,r===1?"": ` $ { o [ r - 1 ] } += 1 ;
if ( $ { c } ) { ` ],d=r===1?"rc < start || rc >= end":"any(lessThan(rc, start)) || any(greaterThanEqual(rc, end))",p="";for(let f=0,m=r===1?2:4;f<m;f++)p+= `
$ { h [ f ] }
if ( $ { d } ) {
result [ $ { f } ] = float ( value ) ;
} else {
$ { a } source = rc - start ;
result [ $ { f } ] = getChannel ( getX ( $ { l . join ( ) } ) , $ { u } ) ;
}
` ;p+=r===1?"} ":"}}",this.userCode= `
const $ { a } start = $ { a } ( $ { s } ) ;
const $ { a } end = $ { a } ( $ { i } ) ;
uniform float value ;
void main ( ) {
$ { a } outputLoc = getOutputCoords ( ) ;
vec4 result = vec4 ( 0. ) ;
$ { p }
setOutput ( result ) ;
2021-04-15 21:01:27 +02:00
}
2021-04-17 00:03:15 +02:00
` }getCustomSetupFunc(e){return(t,n)=>{this.valueLoc==null&&(this.valueLoc=t.getUniformLocationNoThrow(n,"value")),t.gl.uniform1f(this.valueLoc,e)}}},F7=e=>{let{inputs:t,backend:n,attrs:r}=e,{x:a}=t,{paddings:s,constantValue:i}=r,o=J().getBool("WEBGL_PACK_ARRAY_OPERATIONS")?new qG(a.shape,s,i):new GG(a.shape,s,i),l=o.getCustomSetupFunc(i);return n.runWebGLProgram(o,[a],a.dtype,l)},XG={kernelName:Bs,backendName:"webgl",kernelFunc:F7},KG= `
if ( a < 0.0 && floor ( b ) < b ) {
return NAN ;
2021-04-15 21:01:27 +02:00
}
2021-04-17 00:03:15 +02:00
if ( b == 0.0 ) {
return 1.0 ;
2021-04-15 21:01:27 +02:00
}
2021-04-17 00:03:15 +02:00
return ( round ( mod ( b , 2.0 ) ) != 1 ) ?
pow ( abs ( a ) , b ) : sign ( a ) * pow ( abs ( a ) , b ) ;
` ,ZG= `
// 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 ) ) ;
` +_p+ `
return result ;
` ,YG=tn({opSnippet:KG,packedOpSnippet:ZG}),JG={kernelName:Vs,backendName:"webgl",kernelFunc:YG};function QG(e){let{inputs:t,backend:n,attrs:r}=e,{x:a}=t,{axis:s,keepDims:i}=r,o=a.shape.length,l=[],c=_.parseAxisParam(s,a.shape),u=c,h=C.getAxesPermutation(u,o),d=a;h!=null&&(d=fn({inputs:{x:a},backend:n,attrs:{perm:h}}),u=C.getInnerMostAxes(u.length,o),l.push(d)),C.assertAxesAreInnerMostDims("prod",u,o);let p;if(n.shouldExecuteOnCPU([d])){let f=n.texData.get(d.dataId).values,{outVals:m,outShape:y,outDtype:A}=gW(d.shape,d.dtype,f,u);p=n.makeTensorInfo(y,A,m)}else{let[f,m]=C.computeOutAndReduceShapes(d.shape,u),y=_.sizeFromShape(m),A=Ae({inputs:{x:d},backend:n,attrs:{shape:[-1,y]}}),g=yd(a.dtype),x=Ri(A,g,"prod",n);p=Ae({inputs:{x},backend:n,attrs:{shape:f}}),l.push(A),l.push(x)}if(i){l.push(p);let f=C.expandShapeToKeepDim(p.shape,c);p=Ae({inputs:{x:p},backend:n,attrs:{shape:f}})}return l.forEach(f=>n.disposeIntermediateTensorInfo(f)),p}var eq={kernelName:Uo,backendName:"webgl",kernelFunc:QG}, $ 7=e=>{let{backend:t,attrs:n}=e,{start:r,stop:a,step:s,dtype:i}=n,o=xW(r,a,s,i);return t.makeTensorInfo([o.length],i,o)},tq={kernelName: $ u,backendName:"webgl",kernelFunc: $ 7},nq="return 1.0 / x;",rq=Xe({opSnippet:nq}),aq={kernelName:Ho,backendName:"webgl",kernelFunc:rq},sq=Sr+ `
return ( x < 0.0 ) ? 0.0 : x ;
` ,iq= `
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 ;
` ,oq=Xe({opSnippet:sq,packedOpSnippet:iq}),lq={kernelName:Us,backendName:"webgl",kernelFunc:oq},uq=Sr+ `
return ( x < 0.0 ) ? 0.0 : min ( 6.0 , x ) ;
` ,cq= `
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 ;
` ,hq=Xe({opSnippet:uq,packedOpSnippet:cq}),dq={kernelName:Gs,backendName:"webgl",kernelFunc:hq},pq=class{constructor(e,t,n,r,a){this.variableNames=["A"],this.outputShape=[];let[s,i,o,l]=e;this.outputShape=[s,t,n,l];let c=[r&&t>1?i-1:i,r&&n>1?o-1:o],u=[r&&t>1?t-1:t,r&&n>1?n-1:n],h;a?h="(vec2(yRC) + vec2(0.5)) * effectiveInputOverOutputRatioRC - vec2(0.5)":h="vec2(yRC) * effectiveInputOverOutputRatioRC",this.userCode= `
const vec2 effectiveInputOverOutputRatioRC = vec2 (
$ { c [ 0 ] / u [ 0 ] } ,
$ { c [ 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 = $ { h } ;
// 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-15 21:01:27 +02:00
}
2021-04-17 00:03:15 +02:00
` }},fq=class{constructor(e,t,n,r,a){this.variableNames=["A"],this.packedInputs=!0,this.packedOutput=!0,this.outputShape=[];let[s,i,o,l]=e;this.outputShape=[s,t,n,l];let c=[r&&t>1?i-1:i,r&&n>1?o-1:o],u=[r&&t>1?t-1:t,r&&n>1?n-1:n],h;a?h="(vec3(yRC) + vec3(0.5)) * effectiveInputOverOutputRatioRC - vec3(0.5)":h="vec3(yRC) * effectiveInputOverOutputRatioRC",this.userCode= `
const vec3 effectiveInputOverOutputRatioRC = vec3 (
$ { c [ 0 ] / u [ 0 ] } ,
$ { c [ 1 ] / u [ 1 ] } ,
$ { c [ 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-15 21:01:27 +02:00
}
2021-04-17 00:03:15 +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 = $ { h } ;
// 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-15 21:01:27 +02:00
}
2021-04-17 00:03:15 +02:00
` }};function mq(e){let{inputs:t,backend:n,attrs:r}=e,{images:a}=t,{alignCorners:s,halfPixelCenters:i,size:o}=r,[l,c]=o,u=J().getBool("WEBGL_PACK_IMAGE_OPERATIONS")?new fq(a.shape,l,c,s,i):new pq(a.shape,l,c,s,i);return n.runWebGLProgram(u,[a],"float32")}var yq={kernelName:Hs,backendName:"webgl",kernelFunc:mq},Aq=class{constructor(e,t,n){this.variableNames=["dy"],this.outputShape=[],this.outputShape=t;let[,r,a]=t,[,s,i]=e,o=[n&&s>1?r-1:r,n&&i>1?a-1:a],l=[n&&s>1?s-1:s,n&&i>1?i-1:i],c=o[0]/l[0],u=o[1]/l[1],h=1/c,d=1/u,p=Math.ceil(h)*2+2,f=Math.ceil(d)*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 ( $ { c } ) ;
const float widthScale = float ( $ { u } ) ;
const float invHeightScale = float ( $ { h } ) ;
const float invWidthScale = float ( $ { d } ) ;
const int winHeight = int ( $ { p } ) ;
const int winWidth = int ( $ { f } ) ;
// 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-15 21:01:27 +02:00
}
2021-04-17 00:03:15 +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 ;
2021-04-15 21:01:27 +02:00
}
2021-04-17 00:03:15 +02:00
float dxR = float ( dyR ) * heightScale ;
int topDxRIndex = int ( floor ( dxR ) ) ;
int bottomDxRIndex = int ( min ( ceil ( dxR ) , $ { r - 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 ) , $ { a - 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 ;
2021-04-15 21:01:27 +02:00
}
2021-04-17 00:03:15 +02:00
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-15 21:01:27 +02:00
}
}
}
2021-04-17 00:03:15 +02:00
// End loop over dy
setOutput ( accumulator ) ;
2021-04-15 21:01:27 +02:00
}
2021-04-17 00:03:15 +02:00
` }};function gq(e){let{inputs:t,backend:n,attrs:r}=e,{images:a,dy:s}=t,{alignCorners:i}=r,o=new Aq(s.shape,a.shape,i);return n.runWebGLProgram(o,[s],s.dtype)}var xq={kernelName:od,backendName:"webgl",kernelFunc:gq},wq=class{constructor(e,t,n,r,a){this.variableNames=["A"],this.outputShape=[];let[s,i,o,l]=e;this.outputShape=[s,t,n,l];let c=[r&&t>1?i-1:i,r&&n>1?o-1:o],u=[r&&t>1?t-1:t,r&&n>1?n-1:n],h=r?"0.5":"0.0",d;a?d="max((vec2(yRC) + vec2(0.5)) * effectiveInputOverOutputRatioRC, vec2(0.0))":d="vec2(yRC) * effectiveInputOverOutputRatioRC",this.userCode= `
const vec2 effectiveInputOverOutputRatioRC = vec2 (
$ { c [ 0 ] / u [ 0 ] } ,
$ { c [ 1 ] / u [ 1 ] } ) ;
const vec2 inputShapeRC = vec2 ( $ { i } . 0 , $ { o } . 0 ) ;
2021-03-30 15:03:18 +02:00
2021-04-17 00:03:15 +02:00
void main ( ) {
ivec4 coords = getOutputCoords ( ) ;
int b = coords [ 0 ] ;
int d = coords [ 3 ] ;
ivec2 yRC = coords . yz ;
// Fractional source index.
vec2 sourceFracIndexRC = $ { d } ;
// Compute the coordinators of nearest neighbor point.
ivec2 sourceNearestRC = ivec2 (
min ( inputShapeRC - 1.0 , floor ( sourceFracIndexRC + $ { h } ) ) ) ;
float newValue = getA ( b , sourceNearestRC . x , sourceNearestRC . y , d ) ;
setOutput ( newValue ) ;
}
` }};function bq(e){let{inputs:t,backend:n,attrs:r}=e,{images:a}=t,{alignCorners:s,halfPixelCenters:i,size:o}=r,[l,c]=o,u=new wq(a.shape,l,c,s,i);return n.runWebGLProgram(u,[a],a.dtype)}var _q={kernelName:Du,backendName:"webgl",kernelFunc:bq},vq=class{constructor(e,t,n){this.variableNames=["dy"],this.outputShape=[],this.outputShape=t;let[,r,a]=t,[,s,i]=e,o=[n&&s>1?r-1:r,n&&i>1?a-1:a],l=[n&&s>1?s-1:s,n&&i>1?i-1:i],c=o[0]/l[0],u=o[1]/l[1],h=1/c,d=1/u,p=Math.ceil(h)*2+2,f=Math.ceil(d)*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 ( $ { c } ) ;
const float widthScale = float ( $ { u } ) ;
const float invHeightScale = float ( $ { h } ) ;
const float invWidthScale = float ( $ { d } ) ;
const int winHeight = int ( $ { p } ) ;
const int winWidth = int ( $ { f } ) ;
// Compute bounds for where in dy we will look
float startRLerp = floor ( float ( r ) * invHeightScale ) ;
int startDyR = int ( floor ( startRLerp - float ( winHeight / 2 ) ) ) ;
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 ( $ { r } ) - 1 ) ,
$ { n } ? float ( round ( sourceFracRow ) ) :
float ( floor ( sourceFracRow ) ) ) ) ;
int sourceNearestCol = int ( min (
float ( int ( $ { a } ) - 1 ) ,
$ { n } ? float ( round ( sourceFracCol ) ) :
float ( floor ( sourceFracCol ) ) ) ) ;
if ( r == sourceNearestRow && c == sourceNearestCol ) {
accumulator += getDy ( b , dyR , dyC , d ) ;
}
2021-04-15 21:01:27 +02:00
}
2021-03-29 21:01:16 +02:00
}
2021-04-17 00:03:15 +02:00
// End loop over dy
setOutput ( accumulator ) ;
2021-03-30 15:03:18 +02:00
}
2021-04-17 00:03:15 +02:00
` }};function kq(e){let{inputs:t,backend:n,attrs:r}=e,{images:a,dy:s}=t,{alignCorners:i}=r,o=new vq(s.shape,a.shape,i);return n.runWebGLProgram(o,[s],s.dtype)}var Iq={kernelName:id,backendName:"webgl",kernelFunc:kq},Sq=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 r=i=>t.indexOf(i)!==-1&&e[i]!==1? ` $ { e [ i ] } - coords [ $ { i } ] - 1 ` : ` coords [ $ { i } ] ` ,a=e.map((i,o)=>r(o)).join(","),s=lt(n);this.userCode= `
void main ( ) {
$ { s } coords = getOutputCoords ( ) ;
setOutput ( getX ( $ { a } ) ) ;
2021-03-24 16:43:28 +01:00
}
2021-04-17 00:03:15 +02:00
` }},Nq=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 r=pn("rc",n),a= ` $ { r [ n - 1 ] } + 1 < $ { this . outputShape [ n - 1 ] } ` ,s= ` $ { r [ 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 ( $ { a } ) {
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 ( r . slice ( ) ) } ;
if ( $ { a } ) {
result . g = $ { l ( r . slice ( ) ) } ;
}
if ( $ { s } ) {
result . b = $ { c ( r . slice ( ) ) } ;
if ( $ { a } ) {
result . a = $ { u ( r . slice ( ) ) } ;
}
}
setOutput ( result ) ;
}
` ;function o(p){return h(p)}function l(p){return p[n-1]="("+p[n-1]+" + 1)",h(p)}function c(p){return p[n-2]="("+p[n-2]+" + 1)",h(p)}function u(p){return p[n-1]="("+p[n-1]+" + 1)",p[n-2]="("+p[n-2]+" + 1)",h(p)}function h(p){let f=e.map((A,g)=>d(g,p)),m=f.join(","),y=f.slice(-2).join(",");return ` getChannel ( getX ( $ { m } ) , vec2 ( $ { y } ) ) ` }function d(p,f){return t.indexOf(p)!==-1&&e[p]!==1? ` $ { e [ p ] } - $ { f [ p ] } - 1 ` : ` $ { f [ p ] } ` }}};function Tq(e){let{inputs:t,backend:n,attrs:r}=e,{x:a}=t,{dims:s}=r,i=a.shape.length,o=_.parseAxisParam(s,a.shape);if(i===0)return Vn({inputs:{x:a},backend:n});let l=J().getBool("WEBGL_PACK_ARRAY_OPERATIONS")?new Nq(a.shape,o):new Sq(a.shape,o);return n.runWebGLProgram(l,[a],a.dtype)}var Eq={kernelName:qs,backendName:"webgl",kernelFunc:Tq},Cq=class{constructor(e,t){this.variableNames=["Image"],this.outputShape=[];let n=e[1],r=e[2];this.outputShape=e;let a="";typeof t=="number"?a= ` float outputValue = $ { t . toFixed ( 2 ) } ; ` :a= `
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 ] ) ) ;
$ { a }
if ( coordX >= 0 && coordX < $ { r } && coordY >= 0 && coordY < $ { n } ) {
outputValue = getImage ( coords [ 0 ] , coordY , coordX , coords [ 3 ] ) ;
}
setOutput ( outputValue ) ;
}
` }getCustomSetupFunc(e,t,n,r){return(a,s)=>{this.paramsLoc==null&&(this.paramsLoc=a.getUniformLocationNoThrow(s,"params")),a.gl.uniform4f(this.paramsLoc,e,t,n,r)}}},Rq={kernelName:sl,backendName:"webgl",kernelFunc:({inputs:e,attrs:t,backend:n})=>{let{image:r}=e,{radians:a,fillValue:s,center:i}=t,o=n,l=new Cq(r.shape,s),[c,u]=C.getImageCenter(i,r.shape[1],r.shape[2]),h=l.getCustomSetupFunc(c,u,Math.sin(a),Math.cos(a));return o.runWebGLProgram(l,[r],r.dtype,h)}},Mq= `
// 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 ;
2021-04-15 21:01:27 +02:00
} else {
2021-04-17 00:03:15 +02:00
return base + 1.0 ;
2021-04-15 21:01:27 +02:00
}
}
2021-04-17 00:03:15 +02:00
` ,Fq=Xe({opSnippet:Mq}), $ q={kernelName:Xs,backendName:"webgl",kernelFunc:Fq},Dq="return inversesqrt(x);",Oq=Xe({opSnippet:Dq,cpuKernelImpl:wW}),zq={kernelName:Ks,backendName:"webgl",kernelFunc:Oq},D7=class{constructor(e,t,n,r,a,s,i=!0){this.variableNames=["updates","indices","defaultValue"],this.outputShape=s;let o=lt(a.length),l=lt(s.length),c="";n===1?c="i":n===2&&(c="i, j");let u= ` getIndices ( $ { c } ) ` ,h="";r===1?h="i":r===2&&(h="i, coords[1]");let d= ` getUpdates ( $ { h } ) ` ,p=t>1?"strides[j]":"strides";this.userCode= `
$ { o } strides = $ { o } ( $ { a } ) ;
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 * $ { p } ;
}
if ( flattenedIndex == coords [ 0 ] ) {
sum += $ { d } ;
found = true ;
}
}
setOutput ( mix ( getDefaultValue ( ) , sum , float ( found ) ) ) ;
}
` }};function Pq(e){let{inputs:t,backend:n,attrs:r}=e,{indices:a,updates:s}=t,{shape:i}=r,{sliceRank:o,numUpdates:l,sliceSize:c,strides:u,outputSize:h}=C.calculateShapes(s,a,i),d=[h/c,c];if(h===0)return n.makeTensorInfo(i,a.dtype);let p=Ae({inputs:{x:a},backend:n,attrs:{shape:[l,o]}}),f=Ae({inputs:{x:s},backend:n,attrs:{shape:[l,c]}}),m=n.makeTensorInfo([],"float32",new Float32Array([0])),y=new D7(l,o,p.shape.length,f.shape.length,u,d),A=n.runWebGLProgram(y,[f,p,m],f.dtype),g=Ae({inputs:{x:A},backend:n,attrs:{shape:i}});return n.disposeIntermediateTensorInfo(p),n.disposeIntermediateTensorInfo(f),n.disposeIntermediateTensorInfo(A),n.disposeIntermediateTensorInfo(m),g}var Lq={kernelName:qo,backendName:"webgl",kernelFunc:Pq},Wq=class{constructor(e,t,n){this.variableNames=["c","a","b"],this.outputShape=t;let r,a;if(n>4)throw Error( ` Where for rank $ { n } is not yet supported ` );if(n===1)a="resRC",r="resRC";else{let i=["resRC.x","resRC.y","resRC.z","resRC.w"],o=[],l=[];for(let c=0;c<t.length;c++)l.push( ` $ { i [ c ] } ` ),c<e&&o.push( ` $ { i [ c ] } ` );r=o.join(),a=l.join()}let s=lt(n);this.userCode= `
void main ( ) {
$ { s } resRC = getOutputCoords ( ) ;
float cVal = getC ( $ { r } ) ;
if ( cVal >= 1.0 ) {
setOutput ( getA ( $ { a } ) ) ;
} else {
setOutput ( getB ( $ { a } ) ) ;
}
}
` }};function Bq(e){let{inputs:t,backend:n}=e,{condition:r,t:a,e:s}=t,i=new Wq(r.shape.length,a.shape,a.shape.length);return n.runWebGLProgram(i,[r,a,s],dr(a.dtype,s.dtype))}var Vq={kernelName:Xo,backendName:"webgl",kernelFunc:Bq},jq= `
// 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 ) ;
` ,Uq=Xe({opSnippet:jq}),Hq={kernelName:Ko,backendName:"webgl",kernelFunc:Uq},Gq="return 1.0 / (1.0 + exp(-1.0 * x));",qq=Xe({opSnippet:Gq}),Xq={kernelName:Ys,backendName:"webgl",kernelFunc:qq},Kq= `
if ( isnan ( x ) ) { return 0.0 ; }
return sign ( x ) ;
` ,Zq=Xe({opSnippet:Kq}),Yq={kernelName:Jo,backendName:"webgl",kernelFunc:Zq},Jq=K3+ `
return sin ( x ) ;
` ,Qq=Xe({opSnippet:Jq}),eX={kernelName:Zs,backendName:"webgl",kernelFunc:Qq},tX= `
float e2x = exp ( x ) ;
return ( e2x - 1.0 / e2x ) / 2.0 ;
` ,nX=Xe({opSnippet:tX}),rX={kernelName:Yo,backendName:"webgl",kernelFunc:nX},aX= `
float epsilon = 1.1920928955078125 e - 7 ;
float threshold = log ( epsilon ) + 2.0 ;
2021-03-10 00:32:35 +01:00
2021-04-17 00:03:15 +02:00
bool too _large = x > - threshold ;
bool too _small = x < threshold ;
2021-03-10 00:32:35 +01:00
2021-04-17 00:03:15 +02:00
float result ;
float exp _x = exp ( x ) ;
2021-03-10 00:32:35 +01:00
2021-04-17 00:03:15 +02:00
if ( too _large ) {
result = x ;
2021-04-15 21:01:27 +02:00
}
2021-04-17 00:03:15 +02:00
else if ( too _small ) {
result = exp _x ;
2021-04-15 21:01:27 +02:00
}
2021-04-17 00:03:15 +02:00
else {
result = log ( exp _x + 1.0 ) ;
2021-04-15 21:01:27 +02:00
}
2021-04-17 00:03:15 +02:00
return result ;
` ,sX=Xe({opSnippet:aX}),iX={kernelName:Qo,backendName:"webgl",kernelFunc:sX},oX=e=>{let{inputs:t,backend:n,attrs:r}=e,{x:a}=t,{blockShape:s,paddings:i}=r;_.assert(a.shape.length<=4,()=>"spaceToBatchND for rank > 4 with a WebGL backend not implemented yet");let o=s.reduce((A,g)=>A*g),l=[[0,0]];l.push(...i);for(let A=1+s.length;A<a.shape.length;++A)l.push([0,0]);let c=[],u=F7({inputs:{x:a},backend:n,attrs:{paddings:l,constantValue:0}}),h=C.getReshaped(u.shape,s,o,!1),d=C.getPermuted(h.length,s.length,!1),p=C.getReshapedPermuted(u.shape,s,o,!1),f=Ae({inputs:{x:u},backend:n,attrs:{shape:h}}),m=fn({inputs:{x:f},backend:n,attrs:{perm:d}}),y=Ae({inputs:{x:m},backend:n,attrs:{shape:p}});return c.push(u),c.push(f),c.push(m),c.forEach(A=>n.disposeIntermediateTensorInfo(A)),y},lX={kernelName:Ou,backendName:"webgl",kernelFunc:oX};function uX(e){let{inputs:t,backend:n,attrs:r}=e,{sparseIndices:a,sparseValues:s,defaultValue:i}=t,{outputShape:o}=r,{sliceRank:l,numUpdates:c,strides:u,outputSize:h}=C.calculateShapes(s,a,o),d=!1,p=new D7(c,l,a.shape.length,s.shape.length,u,[h,1],d),f=n.runWebGLProgram(p,[s,a,i],s.dtype),m=Ae({inputs:{x:f},backend:n,attrs:{shape:o}});return n.disposeIntermediateTensorInfo(f),m}var cX={kernelName:ld,backendName:"webgl",kernelFunc:uX};function hX(e){let{inputs:t,backend:n,attrs:r}=e,{x:a}=t,{numOrSizeSplits:s,axis:i}=r,o=_.parseAxisParam(i,a.shape)[0],l=C.prepareSplitSize(a,s,o),c=a.shape.length,u=new Array(c).fill(0),h=a.shape.slice();return l.map(d=>{let p=[...h];p[o]=d;let f=Ic({inputs:{x:a},backend:n,attrs:{begin:u,size:p}});return u[o]+=d,f})}var dX={kernelName:el,backendName:"webgl",kernelFunc:hX},pX="return sqrt(x);",fX=Xe({opSnippet:pX}),mX={kernelName:Js,backendName:"webgl",kernelFunc:fX},yX="return x * x;",AX=Xe({opSnippet:yX}),gX={kernelName:zu,backendName:"webgl",kernelFunc:AX},O7="return (a - b) * (a - b);",xX=tn({opSnippet:O7,packedOpSnippet:O7}),wX={kernelName:ti,backendName:"webgl",kernelFunc:xX};function bX({inputs:e,attrs:t,backend:n}){let{x:r}=e,a=Sr+ `
return x > 0.0 ? 1.0 : float ( $ { t . alpha } ) ;
` ,s=new Ga(r.shape,a);return n.runWebGLProgram(s,[r],r.dtype)}var _X={kernelName:Fa,backendName:"webgl",kernelFunc:bX},vX=class{constructor(e,t,n){this.variableNames=["x"],this.outputShape=n;let r=n.length,a=lt(n.length),s=lt(n.length),i="";if(r===1)i="coords * strides + begin";else{let o=0;i=n.map((l,c)=>(o++,n.length===1? ` coords * strides [ $ { c } ] + begin [ $ { c } ] ` : ` coords [ $ { o - 1 } ] * strides [ $ { c } ] + begin [ $ { c } ] ` )).join(",")}this.userCode= `
$ { a } begin = $ { a } ( $ { e } ) ;
$ { a } strides = $ { a } ( $ { t } ) ;
void main ( ) {
$ { s } coords = getOutputCoords ( ) ;
setOutput ( getX ( $ { i } ) ) ;
2021-04-15 21:01:27 +02:00
}
2021-04-17 00:03:15 +02:00
` }};function kX(e){let{inputs:t,backend:n,attrs:r}=e,{x:a}=t,{begin:s,end:i,strides:o,beginMask:l,endMask:c,ellipsisMask:u,newAxisMask:h,shrinkAxisMask:d}=r,{nonStrided:p, $ begin:f, $ strides:m,size:y,newShape:A,outShape:g}=un.sliceInfo(a.shape,s,i,o,l,c,u,h,d),x=Ae({inputs:{x:a},backend:n,attrs:{shape:A}}),v;if(p){let b=Ic({inputs:{x},backend:n,attrs:{begin:f,size:y}});v=Ae({inputs:{x:b},backend:n,attrs:{shape:g}}),n.disposeIntermediateTensorInfo(b)}else if(g.some(b=>b===0))v=n.makeTensorInfo(g,a.dtype,[]);else if(n.shouldExecuteOnCPU([x])){let b=n.texData.get(x.dataId).values,k=Be(x.shape,x.dtype,b),N=_W(g,k,m,f);v=n.makeTensorInfo(g,x.dtype,N.values)}else{let b=new vX(f,m,g);v=n.runWebGLProgram(b,[x],x.dtype)}let w=Ae({inputs:{x:v},backend:n,attrs:{shape:g}});return n.disposeIntermediateTensorInfo(x),n.disposeIntermediateTensorInfo(v),w}var IX={kernelName:tl,backendName:"webgl",kernelFunc:kX},SX="return tan(x);",NX=Xe({opSnippet:SX}),TX={kernelName:ri,backendName:"webgl",kernelFunc:NX},EX= `
float e2x = exp ( - 2.0 * abs ( x ) ) ;
return sign ( x ) * ( 1.0 - e2x ) / ( 1.0 + e2x ) ;
` ,CX=Xe({opSnippet:EX}),RX={kernelName:ai,backendName:"webgl",kernelFunc:CX},FX=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 r=lt(this.rank),a=MX(e);this.userCode= `
void main ( ) {
$ { r } resRC = getOutputCoords ( ) ;
setOutput ( getA ( $ { a } ) ) ;
2021-04-15 21:01:27 +02:00
}
2021-04-17 00:03:15 +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"],r=[];for(let a=0;a<e.length;a++)r.push( ` imod ( $ { n [ a ] } , $ { e [ a ] } ) ` );return r.join()}function z7(e){let{inputs:t,backend:n,attrs:r}=e,{x:a}=t,{reps:s}=r;if(a.dtype==="string"){let o=n.readSync(a.dataId).map(u=>_.decodeString(u)),l=Be(a.shape,a.dtype,o),c=kW(l,s);return n.makeTensorInfo(c.shape,c.dtype,c.values)}let i=new FX(a.shape,s);return n.runWebGLProgram(i,[a],a.dtype)}var $ X={kernelName:Ma,backendName:"webgl",kernelFunc:z7};function DX(e){let{inputs:t,backend:n,attrs:r}=e,{x:a}=t,{k:s,sorted:i}=r,o=n.readSync(a.dataId),[l,c]=IW(o,a.shape,a.dtype,s,i);return[n.makeTensorInfo(l.shape,l.dtype,l.values),n.makeTensorInfo(c.shape,c.dtype,c.values)]}var OX={kernelName:nl,backendName:"webgl",kernelFunc:DX},zX=class{constructor(e,t,n,r,a,s){this.variableNames=["Image","Transforms"],this.outputShape=s;let i=n==="nearest"?1:2,o;switch(r){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 ( $ { a } ) ;
}
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 ( $ { a } ) ;
} 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 } ) ) ;
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 ;
}
2021-04-15 21:01:27 +02:00
}
2021-04-17 00:03:15 +02:00
setOutput ( outputValue ) ;
}
` }};function PX(e){let{inputs:t,backend:n,attrs:r}=e,{image:a,transforms:s}=t,{interpolation:i,fillMode:o,fillValue:l,outputShape:c}=r,[u,h,d,p]=a.shape,[f,m]=c!=null?c:[h,d],y=[u,f,m,p],A=new zX(h,d,i,o,l,y);return n.runWebGLProgram(A,[a,s],"float32")}var LX={kernelName:ud,backendName:"webgl",kernelFunc:PX};function WX(e){let{inputs:t,attrs:n,backend:r}=e,{axis:a}=n,{x:s}=t;Fl(s,"unique"),console.warn("WARNING: ","UI might be locked temporarily as data is being downloaded");let i=r.readSync(s.dataId),{outputValues:o,outputShape:l,indices:c}=SW(i,a,s.shape,s.dtype);return[r.makeTensorInfo(l,s.dtype,o),r.makeTensorInfo([c.length],"int32",c)]}var BX={kernelName:cd,backendName:"webgl",kernelFunc:WX};function VX(e){let{inputs:t,backend:n,attrs:r}=e,{value:a}=t,{axis:s}=r;s<0&&(s+=a.shape.length);let i=a,o=i.shape.length,l=a.shape[s],c=new Array(o-1),u=0;for(let m=0;m<o;m++)m!==s&&(c[u++]=i.shape[m]);let h=[],d=new Array(o).fill(0),p=i.shape.slice();p[s]=1;let f=new Array(l);for(let m=0;m<f.length;m++){d[s]=m;let y=Ic({inputs:{x:i},backend:n,attrs:{begin:d,size:p}}),A=Ae({inputs:{x:y},backend:n,attrs:{shape:c}});f[m]=A,h.push(y)}return h.forEach(m=>n.disposeIntermediateTensorInfo(m)),f}var jX={kernelName:rl,backendName:"webgl",kernelFunc:VX},UX=class{constructor(e,t){this.variableNames=["x","segmentIds"];let n=e.windowSize,r=e.batchSize,a=e.inSize,s=e.numSegments,i=s*Math.ceil(a/n);this.outputShape=[r,i];let o="0.0",l="sumValue",c=Math.floor(n/4)*4,u=n%4,h= `
sumValue += dot ( values , segFilter ) ;
` ,d="";a%n>0&&(d= `
if ( inIdx < 0 || inIdx >= $ { a } ) {
return initializationValue ;
}
` );let p="";a%n>0&&(p= `
if ( inIdx < 0 || inIdx >= $ { a } ) {
return - 1.0 ;
2021-03-30 15:03:18 +02:00
}
2021-04-17 00:03:15 +02:00
` ),this.userCode= `
const float initializationValue = $ { o } ;
float getValue ( int batch , int inIdx ) {
$ { d }
return getX ( batch , inIdx ) ;
}
float getSegmentIdAtIndex ( int inIdx ) {
$ { p }
return getSegmentIds ( inIdx ) ;
2021-04-15 21:01:27 +02:00
}
2021-03-15 13:56:36 +01:00
2021-04-17 00:03:15 +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-03-15 13:52:28 +01:00
2021-04-17 00:03:15 +02:00
float sumValue = 0.0 ;
2021-03-23 20:25:43 +01:00
2021-04-17 00:03:15 +02:00
for ( int i = 0 ; i < $ { c } ; i += 4 ) {
int inIdx = inOffset + i ;
vec4 values = vec4 (
getValue ( batch , inIdx ) ,
getValue ( batch , inIdx + 1 ) ,
getValue ( batch , inIdx + 2 ) ,
getValue ( batch , inIdx + 3 )
) ;
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
) ;
$ { h }
2021-04-15 21:01:27 +02:00
}
2021-03-23 20:25:43 +01:00
2021-04-17 00:03:15 +02:00
int inIdx = inOffset + $ { c } ;
if ( $ { u === 1 } ) {
vec4 values = vec4 (
getValue ( batch , inIdx ) ,
initializationValue ,
initializationValue ,
initializationValue
) ;
2021-03-24 16:43:28 +01:00
2021-04-17 00:03:15 +02:00
int inIdxSeg = int ( getSegmentIdAtIndex ( inIdx ) ) ;
2021-03-27 20:43:48 +01:00
2021-04-17 00:03:15 +02:00
vec4 segFilter = vec4 (
int ( getSegmentIdAtIndex ( inIdx ) ) == currentSeg ? 1 : 0 ,
0 ,
0 ,
0
) ;
2021-03-29 21:01:16 +02:00
2021-04-17 00:03:15 +02:00
$ { h }
} else if ( $ { u === 2 } ) {
vec4 values = vec4 (
getValue ( batch , inIdx ) ,
getValue ( batch , inIdx + 1 ) ,
initializationValue ,
initializationValue
) ;
2021-04-15 21:01:27 +02:00
2021-04-17 00:03:15 +02:00
vec4 segFilter = vec4 (
int ( getSegmentIdAtIndex ( inIdx ) ) == currentSeg ? 1 : 0 ,
int ( getSegmentIdAtIndex ( inIdx + 1 ) ) == currentSeg ? 1 : 0 ,
0 ,
0
) ;
2021-04-15 21:01:27 +02:00
2021-04-17 00:03:15 +02:00
$ { h }
} else if ( $ { u === 3 } ) {
vec4 values = vec4 (
getValue ( batch , inIdx ) ,
getValue ( batch , inIdx + 1 ) ,
getValue ( batch , inIdx + 2 ) ,
initializationValue
) ;
2021-03-24 16:43:28 +01:00
2021-04-17 00:03:15 +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
) ;
$ { h }
2021-04-15 21:01:27 +02:00
}
2021-04-17 00:03:15 +02:00
setOutput ( $ { l } ) ;
2021-04-15 21:01:27 +02:00
}
2021-04-17 00:03:15 +02:00
` }};function HX(e){let{inputs:t,backend:n,attrs:r}=e,{x:a,segmentIds:s}=t,{numSegments:i}=r,o=a.shape.length,l=[],c=0,u=C.getAxesPermutation([c],o),h=a;u!=null&&(h=fn({inputs:{x:a},backend:n,attrs:{perm:u}}),l.push(h),c=C.getInnerMostAxes(1,o)[0]);let d=C.segment_util.computeOutShape(h.shape,c,i),p=_.sizeFromShape([h.shape[c]]),f=Ae({inputs:{x:h},backend:n,attrs:{shape:[-1,p]}});l.push(f);let m=yd(a.dtype),y=(v,w,b,k,N)=>{let E=v.shape[0],F=v.shape[1],O=C.segment_util.segOpComputeOptimalWindowSize(F,N),L={windowSize:O,inSize:F,batchSize:E,numSegments:N},V=new UX(L,w),j=n.compileAndRun(V,[v,b],k);if(l.push(j),j.shape[1]===N)return j;let U= $ 7({backend:n,attrs:{start:0,stop:N,step:1,dtype:"float32"}}),X=z7({inputs:{x:U},backend:n,attrs:{reps:[F/O]}});return l.push(U),l.push(X),y(j,w,X,k,N)},A=y(f,"unsortedSegmentSum",s,m,i),g=Ae({inputs:{x:A},backend:n,attrs:{shape:d}}),x=g;if(u!=null){l.push(g);let v=C.getUndoAxesPermutation(u);x=fn({inputs:{x},backend:n,attrs:{perm:v}})}return l.forEach(v=>n.disposeIntermediateTensorInfo(v)),x}var GX={kernelName:Pu,backendName:"webgl",kernelFunc:HX},qX=[OH,LH,_B,kB,NB,CB,MB,DB,zB,LB,jB,HB,XB,YB,aV,eV,oV,hV,uV,mV,AV,xV,vV,CV,MV,PV,WV,UV,qV,rB,YV,oj,uj,tj,pj,mj,hj,gj,bj,kj,Sj,Tj,Rj,zj,Lj,Fj,Vj,Hj,qj,Yj,tU,sU,lU,uU,cU,dU,fU,yU,gU,wU,kU,TU,CU,MU,DU,LU,jU,qU,nB,KU,ZV,JU,tH,aH,sB,lH,dH,fH,bH,gH,IH,TH,MH,BH,KH,qH,QH,tG,rG,HH,sG,oG,hG,mG,xG,NG,cB,EG,MG,DG,PG, $ V,BG,jG,HG,XG,JG,oB,eq,tq,DV,vG,aq,dq,lq,dB,yq,xq,_q,Iq,Eq,Rq, $ q,zq,Lq,Vq,Hq,Xq,Yq,eX,rX,TV,IG,iX,lX,cX,dX,mX,gX,wX,_X,IX,kG,xB,TX,RX, $ X,OX,LX,wB,BX,jX,GX,VG];for(let e of qX)ui(e);var Mn;(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"})(Mn||(Mn={}));var Nc;(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"})(Nc||(Nc={}));var P7;function XX(e){P7=e.wasm.cwrap(ii,null,["number","array","number","number","array","number","number","number","number","number","number","number","number"])}function KX(e){let{inputs:t,backend:n,attrs:r}=e,{a,b:s,bias:i,preluActivationWeights:o}=t;if(a.dtype!=="float32"||s.dtype!=="float32")throw new Error("_FusedMatMul for non non-float32 tensors not yet supported.");let{transposeA:l,transposeB:c,activation:u,leakyreluAlpha:h}=r,d=n.dataIdMap.get(a.dataId).id,p=n.dataIdMap.get(s.dataId).id,f=0;if(i!=null){let N=n.dataIdMap.get(i.dataId);if(N.shape.length!==1)throw new Error( ` _FusedMatMul only supports rank - 1 bias but got rank $ { N . shape . length } . ` );f=N.id}let m=o==null?0:n.dataIdMap.get(o.dataId).id,y=Nc[u];if(y==null)throw new Error( ` $ { u } activation not yet supported for FusedConv2D in the wasm backend . ` );let A=l?a.shape[2]:a.shape[1],g=c?s.shape[1]:s.shape[2],x=a.shape[0],v=n.makeOutput([x,A,g],a.dtype),w=n.dataIdMap.get(v.dataId).id,b=new Uint8Array(new Int32Array(a.shape).buffer),k=new Uint8Array(new Int32Array(s.shape).buffer);return P7(d,b,a.shape.length,p,k,s.shape.length,l,c,y,f,m,h||0,w),v}var ZX={kernelName:ii,backendName:"wasm",setupFunc:XX,kernelFunc:KX};function mn(e){let t;function n(a){t=a.wasm.cwrap(e,null,["number","number"])}function r(a){let{backend:s,inputs:{x:i}}=a,o=s.dataIdMap.get(i.dataId).id,l=s.makeOutput(i.shape,i.dtype),c=s.dataIdMap.get(l.dataId).id;return _.sizeFromShape(l.shape)===0||t(o,c),l}return{kernelName:e,backendName:"wasm",setupFunc:n,kernelFunc:r}}var YX=mn(so);function yn(e,t,n){let r;function a(i){r=i.wasm.cwrap(e,null,["number","array","number","number","array","number","number","number"])}function s(i){let{backend:o,inputs:l}=i,{a:c,b:u}=l,h=o.dataIdMap.get(c.dataId).id,d=o.dataIdMap.get(u.dataId).id,p=n!=null?n:c.dtype,f=C.assertAndGetBroadcastShape(c.shape,u.shape),m=o.makeOutput(f,p);if(_.sizeFromShape(f)===0)return m;let y=new Uint8Array(new Int32Array(c.shape).buffer),A=new Uint8Array(new Int32Array(u.shape).buffer),g=o.dataIdMap.get(m.dataId).id,x=()=>r(h,y,c.shape.length,d,A,u.shape.length,Mn[c.dtype],g);if(t&&c.dtype==="float32")return x(),m;let v=C.getBroadcastDims(c.shape,f),w=C.getBroadcastDims(u.shape,f)
1. The $ { r } is defined in Python , in which case it needs to be ported to TensorFlow . js or your JavaScript code .
2. The custom $ { r } 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 B( ` $ { r } : 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 yr?[o,l]=yr.className:i in t&&([o,l]=t[i]),o==null)throw new B( ` Unknown $ { r } : $ { i } . This may be due to one of the following reasons :
1. The $ { r } is defined in Python , in which case it needs to be ported to TensorFlow . js or your JavaScript code .
2. The custom $ { r } is defined in JavaScript , but is not registered properly with tf . serialization . registerClass ( ) . ` );if(l!=null){let c={};for(let p of Object.keys(yr))c[p]=yr[p];for(let p of Object.keys(n))c[p]=n[p];let u=s.config;u.customObjects=c;let h=Object.assign({},yr);for(let p of Object.keys(n))yr[p]=n[p];Vy(s.config);let d=l(o,s.config,n,a);return yr=Object.assign({},h),d}else{let c=Object.assign({},yr);for(let h of Object.keys(n))yr[h]=n[h];let u=new o(s.config);return yr=Object.assign({},c),u}}}function rte(e,t){return e<t?-1:e>t?1:0}function Op(e,t){return-1*rte(e,t)}function Ka(e){if(e==null)return e;let t=[];for(let n of e)t.indexOf(n)===-1&&t.push(n);return t}function ate(e){if(e==null)throw new B( ` Invalid value in obj : $ { JSON . stringify ( e ) } ` );for(let t in e)if(e.hasOwnProperty(t))return!1;return!0}function $ i(e,t,n){if(n!=null&&e.indexOf(n)<0)throw new B( ` $ { n } is not a valid $ { t } . Valid values are $ { e } or null / undefined . ` )}function jy(e,t,n=0,r=Infinity){return Xr(n>=0),Xr(r>=n),Array.isArray(e)&&e.length>=n&&e.length<=r&&e.every(a=>typeof a===t)}function Ht(e,t){Array.isArray(e)?(_.assert(e.length>0,()=> ` $ { t } is unexpectedly an empty array . ` ),e.forEach((n,r)=>Ht(n, ` element $ { r + 1 } of $ { t } ` ))):_.assert(Number.isInteger(e)&&e>0,()=> ` Expected $ { t } to be a positive integer , but got $ { Gv ( e ) } . ` )}function Gv(e){return e===null?"null":Array.isArray(e)?"["+e.map(t=>Gv(t)).join(",")+"]":typeof e=="string"? ` "${e}" ` : ` $ { e } ` }function ste(e,t){let n=_.now(),r;return(...a)=>{let s=_.now();return s-n<t||(n=s,r=e(...a)),r}}function qv(e){return e==="relu"?"relu":e==="linear"?"linear":e==="elu"?"elu":null}function Uy(e,t){return z(()=>Qt(Te(P(e,e),t,!0)))}var Mc=class extends re.Serializable{getConfig(){return{}}},Hy=class extends Mc{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 z(()=>{let t=Uy(e,this.axis),n=Tn(t,0,this.maxValue);return P(e,me(n,se(Lt(),t)))})}getConfig(){return{maxValue:this.maxValue,axis:this.axis}}};Hy.className="MaxNorm";re.registerClass(Hy);var Gy=class extends Mc{constructor(e){super();this.defaultAxis=0,this.axis=e.axis!=null?e.axis:this.defaultAxis}apply(e){return z(()=>me(e,se(Lt(),Uy(e,this.axis))))}getConfig(){return{axis:this.axis}}};Gy.className="UnitNorm";re.registerClass(Gy);var qy=class extends Mc{apply(e){return Ur(e)}};qy.className="NonNeg";re.registerClass(qy);var Xy=class extends Mc{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 z(()=>{let t=Uy(e,this.axis),n=se(P(this.rate,Tn(t,this.minValue,this.maxValue)),P(1-this.rate,t));return P(e,me(n,se(Lt(),t)))})}getConfig(){return{minValue:this.minValue,maxValue:this.maxValue,rate:this.rate,axis:this.axis}}};Xy.className="MinMaxNorm";re.registerClass(Xy);var Xv={maxNorm:"MaxNorm",minMaxNorm:"MinMaxNorm",nonNeg:"NonNeg",unitNorm:"UnitNorm"};function Wt(e){return By(e)}function Kv(e,t={}){return Rc(e,re.SerializationMap.getMap().classNameMap,t,"constraint")}function Bt(e){if(e==null)return null;if(typeof e=="string"){let t={className:e in Xv?Xv[e]:e,config:{}};return Kv(t)}else return e instanceof Mc?e:Kv(e)}function Qee(e){return new Hy(e)}function ete(e){return new Gy(e)}function tte(){return new qy}function nte(e){return new Xy(e)}var Zv={};Me(Zv,{constant:()=>lte,glorotNormal:()=>mte,glorotUniform:()=>fte,heNormal:()=>yte,heUniform:()=>Ate,identity:()=>dte,leCunNormal:()=>gte,leCunUniform:()=>xte,ones:()=>ote,orthogonal:()=>wte,randomNormal:()=>cte,randomUniform:()=>ute,truncatedNormal:()=>hte,varianceScaling:()=>pte,zeros:()=>ite});var bte=["channelsFirst","channelsLast"],_te=["nearest","bilinear"],vte=["valid","same","causal"],kte=["max","avg"],Ite=["sum","mul","concat","ave"],Ul=new Map;function Ct(e){ $ i
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),xr(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,r)=>this.write(n,t[r]))}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 r=0;r<this.size();r++)e.push(r)}if(e.length===0)return Ir([],[0].concat(this.elementShape));let n=this.readMany(e);return xr(this.elementShape,n[0].shape,"TensorArray shape mismatch: "),cn(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 Ir([],[0].concat(this.elementShape));let t=[];for(let r=0;r<this.size();r++)t.push(r);let n=this.readMany(t);return xr(this.elementShape,n[0].shape, ` TensorArray shape mismatch : tensor array shape ( $ { this . elementShape } ) vs first tensor shape ( $ { n [ 0 ] . shape } ) ` ),rt(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,mr(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,r=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 a=n===0?0:t.size/n,s=[];z(()=>{t=H(t,[1,n,a]);for(let o=0;o<e.length;++o){let l=o===0?0:r[o-1],c=[0,l,0],u=[1,e[o],a];s[o]=H(Ce(t,c,u),this.elementShape)}return s});let i=[];for(let o=0;o<e.length;o++)i[o]=o;this.writeMany(i,s)}},Yc=class{constructor(e,t,n,r=-1){this.tensors=e,this.elementShape=t,this.elementDtype=n,e!=null&&e.forEach(a=>{if(n!==a.dtype)throw new Error( ` Invalid data types ; op elements $ { n } , but list elements $ { a . dtype } ` );xr(t,a.shape,"TensorList shape mismatch: "),jt(a)}),this.idTensor=xe(0),this.maxNumElements=r,jt(this.idTensor)}get id(){return this.idTensor.id}copy(){return new Yc([...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 . ` );xr(e,this.elementShape,"TensorList shape mismatch: ");let r=Zc(this.elementShape,this.tensors,e);return z(()=>{let a=this.tensors.map(s=>H(s,r));return cn(a,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=Zc(this.elementShape,this.tensors,e),r=this.tensors.pop();return xr(r.shape,e,"TensorList shape mismatch: "),H(r,n)}pushBack(e){if(e.dtype!==this.elementDtype)throw new Error( ` Invalid data types ; op elements $ { e . dtype } , but list elements $ { this . elementDtype } ` );if(xr(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 . ` );xr(this.tensors[e].shape,t,"TensorList shape mismatch: ");let r=Zc(this.elementShape,this.tensors,t);return H(this.tensors[e],r)}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 . ` );xr(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 } ` );xr(this.elementShape,n,"TensorList shape mismatch: "),e=e.slice(0,this.size());let r=Zc(this.elementShape,this.tensors,n);return e.length===0?Ir([],[0].concat(r)):z(()=>{let a=e.map(s=>H(this.tensors[s],r));return cn(a,0)})}concat(e,t){if(!!e&&e!==this.elementDtype)throw new Error( ` TensorList dtype is $ { this . elementDtype } but concat requested dtype $ { e } ` );xr(this.elementShape,t,"TensorList shape mismatch: ");let n=Zc(this.elementShape,this.tensors,t);return this.size()===0?Ir([],[0].concat(n)):z(()=>{let r=this.tensors.map(a=>H(a,n));return rt(r,0)})}};function ose(e,t,n){let r=e.dtype;if(e.shape.length<1)throw new Error( ` Tensor
tensor . shape [ 0 ] , but sum of lengths is
$ { r } , and tensor ' s shape is : $ { e . shape } ` );let s=e.shape.slice(1),i=P2(s,n),o=r===0?0:e.size/r,l=z(()=>{let u=[];e=H(e,[1,r,o]);for(let h=0;h<t.length;++h){let d=h===0?0:a[h-1],p=[0,d,0],f=[1,t[h],o];u[h]=H(Ce(e,p,f),i)}return e.dispose(),u}),c=new Yc([],n,e.dtype,t.length);for(let u=0;u<l.length;u++)c.setItem(u,l[u]);return c}var hse=async(e,t,n)=>{switch(e.op){case"If":case"StatelessIf":{let r=I("thenBranch",e,t,n),a=I("elseBranch",e,t,n),s=I("cond",e,t,n),i=I("args",e,t,n);return(await s.data())[0]?n.functionMap[r].executeFunctionAsync(i,n.tensorArrayMap,n.tensorListMap):n.functionMap[a].executeFunctionAsync(i,n.tensorArrayMap,n.tensorListMap)}case"While":case"StatelessWhile":{let r=I("body",e,t,n),a=I("cond",e,t,n),s=I("args",e,t,n),i=await n.functionMap[a].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 c=s;for(;l[0];){let u=c;c=await n.functionMap[r].executeFunctionAsync(c,n.tensorArrayMap,n.tensorListMap);let h=c.map(p=>p.id);u.forEach(p=>{!p.kept&&o.indexOf(p.id)===-1&&h.indexOf(p.id)===-1&&p.dispose()});let d=await n.functionMap[a].executeFunctionAsync(c,n.tensorArrayMap,n.tensorListMap);l=await d[0].data(),d.forEach(p=>{!p.kept&&o.indexOf(p.id)===-1&&h.indexOf(p.id)===-1&&p.dispose()})}return c}case"LoopCond":{let r=I("pred",e,t,n);return[wa(r)]}case"Switch":{let r=I("pred",e,t,n),a=I("data",e,t,n);return a.kept||(a=wa(a)),(await r.data())[0]?[void 0,a]:[a,void 0]}case"Merge":{let r=e.inputNames.find(a=>An(a,t,n)!==void 0);if(r){let a=An(r,t,n);return[wa(a)]}return}case"Enter":{let r=I("frameName",e,t,n),a=I("tensor",e,t,n);return n.enterFrame(r),[wa(a)]}case"Exit":{let r=I("tensor",e,t,n);return n.exitFrame(),[wa(r)]}case"NextIteration":{let r=I("tensor",e,t,n);return n.nextIteration(),[wa(r)]}case"TensorArrayV3":{let r=I("size",e,t,n),a=I("dtype",e,t,n),s=I("elementShape",e,t,n),i=I("dynamicSize",e,t,n),o=I("clearAfterRead",e,t,n),l=I("identicalElementShapes",e,t,n),c=I("name",e,t,n),u=new ise(c,a,r,s,l,i,o);return n.addTensorArray(u),[u.idTensor,xe(1)]}case"TensorArrayWriteV3":{let r=I("tensorArrayId",e,t,n),a=I("index",e,t,n),s=I("tensor",e,t,n),i=n.getTensorArray(r.id);return i.write(a,s),[i.idTensor]}case"TensorArrayReadV3":{let r=I("tensorArrayId",e,t,n),a=I("index",e,t,n);return[n.getTensorArray(r.id).read(a)]}case"TensorArrayGatherV3":{let r=I("tensorArrayId",e,t,n),a=I("indices",e,t,n),s=I("dtype",e,t,n);return[n.getTensorArray(r.id).gather(a,s)]}case"TensorArrayScatterV3":{let r=I("tensorArrayId",e,t,n),a=I("indices",e,t,n),s=I("tensor",e,t,n),i=n.getTensorArray(r.id);return i.scatter(a,s),[i.idTensor]}case"TensorArrayConcatV3":{let r=I("tensorArrayId",e,t,n),a=n.getTensorArray(r.id),s=I("dtype",e,t,n);return[a.concat(s)]}case"TensorArraySplitV3":{let r=I("tensorArrayId",e,t,n),a=I("tensor",e,t,n),s=I("lengths",e,t,n),i=n.getTensorArray(r.id);return i.split(s,a),[i.idTensor]}case"TensorArraySizeV3":{let r=I("tensorArrayId",e,t,n),a=n.getTensorArray(r.id);return[xe(a.size(),"int32")]}case"TensorArrayCloseV3":{let r=I("tensorArrayId",e,t,n),a=n.getTensorArray(r.id);return a.clearAndClose(),[a.idTensor]}case"TensorListSetItem":{let r=I("tensorListId",e,t,n),a=I("index",e,t,n),s=I("tensor",e,t,n),i=n.getTensorList(r.id);return i.setItem(a,s),[i.idTensor]}case"TensorListGetItem":{let r=I("tensorListId",e,t,n),a=I("index",e,t,n),s=I("elementShape",e,t,n),i=I("elementDType",e,t,n);return[n.getTensorList(r.id).getItem(a,s,i)]}case"TensorListScatterV2":case"TensorListScatter":{let r=I("indices",e,t,n),a=I("tensor",e,t,n),s=I("elementShape",e,t,n),i=I("numElements",e,t,n),o=use(a,r,s,i);return n.addTensorList(o),[o.idTensor]}case"TensorListReserve":case"EmptyTensorList":{let r=I("elementShape",e,t,n),a=I("elementDType",e,t,n),s;e.op==="TensorListReserve"?s="numElements":s="maxNumElements";let i=I(s,e,t,n),o=lse(r,a,i);return n.addTensorList(o),[o.idTensor]}case"TensorListGather":{let r=I("tensorListId",e,t,n),a=I("indices",e,t,n),s=I("elementShape",e,t,n),i=I("elementDType",e,t,n);return[n.getTe
$ { e } ` );let r;return this.size===Infinity||this.size==null?r=this.size:t?r=Math.ceil(this.size/e):r=Math.floor(this.size/e),Hn(async()=>(await n.iterator()).columnMajorBatch(e,t,pie),r)}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,Hn(async()=>(await t.iterator()).concatenate(await e.iterator()),n)}filter(e){let t=this,n;return this.size===Infinity?n=Infinity:n=null,Hn(async()=>(await t.iterator()).filter(r=>z(()=>e(r))),n)}async forEachAsync(e){return(await this.iterator()).forEachAsync(e)}map(e){let t=this;return Hn(async()=>(await t.iterator()).map(n=>z(()=>e(n))),this.size)}mapAsync(e){let t=this;return Hn(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 Hn(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,Hn(async()=>{let r=V2(async()=>({value:await t.iterator(),done:!1}));return tie(r.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,Hn(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 r = this , a = Hse . alea ( t || _ . now ( ) . toString ( ) ) ; return Hn ( async ( ) => { let s = a . int32 ( ) ; return n && ( s += a . int32 ( ) ) , ( await r . 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 , Hn ( 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 ( ) } } ; Yl . MAX _BUFFER _SIZE = 1e4 ; function Hn ( e , t = null ) { return new class extends Yl { constructor ( ) { super ( ... arguments ) ; this . size = t } async iterator ( ) { return e ( ) } } } function zse ( e ) { return Hn ( async ( ) => h8 ( e ) , e . length ) } function Pse ( e ) { if ( ! Jl ( 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 Hn ( async ( ) => { let n = await u8 ( e , r => { if ( r instanceof Yl ) return { value : r . iterator ( ) , recurse : ! 1 } ; if ( Jl ( r ) ) return { value : null , recurse : ! 0 } ; throw new Error ( "Leaves of the structure passed to zip() must be Datasets, not primitives." ) } ) ; return rie ( n , ns . SHORTEST ) } , t ) } function pie ( e ) { if ( e === null ) return null ; let t = e [ 0 ] ; return Zse ( t ) ? { value : fie ( e ) , recurse : ! 1 } : { value : null , recurse : ! 0 } } function fie ( e ) { if ( e . length === 0 ) throw new Error ( "Can't make a batch of zero elements." ) ; return e [ 0 ] instanceof ze ? cn ( e ) : Ir ( e ) } var r8 = class extends Yl { 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))}},y0='"',Jc=Symbol("out"),m8=Symbol("field"),A0=Symbol("quote"),U2=Symbol("quoteafterquote"),y8=Symbol("quoteinquote"),a8=class extends Yl{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 r8(e),t||(t={}),this.hasHeader=t.hasHeader!==!1,this.fullColumnNames=t.columnNames,this.columnConfigs=t.columnConfigs,this.configuredColumnsOnly=t.configuredColumnsOnly,t.delimWhitespace?(_.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&&_.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((r,a)=>(r[a]=r[a]+1||1,r),{}),n=Object.keys(t).filter(r=>t[r]>1);if(_.assert(n.length===0,()=>"Duplicate column names found: "+n.toString()),this.columnConfigs){for(let r of Object.keys(this.columnConfigs))if(this.fullColumnNames.indexOf(r)===-1)throw new Error('The key "'+r+'" 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={},r={};for(let a=0;a<this.fullColumnNames.length;a++){let s=this.fullColumnNames[a],i=this.columnConfigs?this.columnConfigs[s]:null;if(!(this.configuredColumnsOnly&&!i)){let o=t[a],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 c=Number(o);if(isNaN(c))i&&i.dtype==="bool"?l=this.getBoolean(o):l=o;else if(!i||!i.dtype)l=c;else switch(i.dtype){case"float32":l=c;break;case"int32":l=Math.floor(c);break;case"bool":l=this.getBoolean(o);break;default:l=c}}i&&i.isLabel?r[s]=l:n[s]=l}}return Object.keys(r).length===0?n:{xs:n,ys:r}}getBoolean(e){return e==="1"||e.toLowerCase()==="true"?1:0}parseRow(e,t=!0){let n=[],r=0,a=e.length,s=Jc;for(let i=0;i<a;i++)switch(s){case Jc:switch(e.charAt(i)){case y0:r=i+1,s=A0;break;case this.delimiter:if(r=i+1,this.delimiter===" "&&this.delimWhitespace)break;n.push(""),s=Jc;break;default:s=m8,r=i;break}break;case m8:switch(e.charAt(i)){case this.delimiter:n.push(e.substring(r,i)),s=Jc,r=i+1;break;default:}break;case A0:switch(e.charAt(i)){case y0:s=U2;break;default:}break;case U2:switch(e.charAt(i)){case this.delimiter:n.push(e.substring(r,i-1)),s=Jc,r=i+1;break;case y0:s=A0;break;default:s=y8;break}break;case y8:switch(e.charAt(i)){case y0:s=A0;break;default:}break;default:}if(s===U2?n.push(e.substring(r,a-1)):n.push(e.substring(r)),t&&n.length!==this.fullColumnNames.length)throw new Error( ` Invalid row in csv file . Should have $ { this . fullColumnNames . length } elements in a row , but got $ { n } ` );return n}},A8=class extends Gt{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
` ),b.FRAGMENT_IDENTITY=["precision highp float;","varying vec2 vUv;","uniform sampler2D texture;","void main(void) {","gl_FragColor = texture2D(texture, vUv);","}"].join( `
` ),u=new toe(m,b.VERTEX_IDENTITY,w);let k=Float32Array.BYTES_PER_ELEMENT,N=4*k;return m.enableVertexAttribArray(u.attribute.pos),m.vertexAttribPointer(u.attribute.pos,2,m.FLOAT,!1,N,0*k),m.enableVertexAttribArray(u.attribute.uv),m.vertexAttribPointer(u.attribute.uv,2,m.FLOAT,!1,N,2*k),p[w]=u,u};h.colorMatrix=function(w){let b=new Float32Array(w);b[4]/=255,b[9]/=255,b[14]/=255,b[19]/=255;let k=b[18]===1&&b[3]===0&&b[8]===0&&b[13]===0&&b[15]===0&&b[16]===0&&b[17]===0&&b[19]===0?h.colorMatrix.SHADER.WITHOUT_ALPHA:h.colorMatrix.SHADER.WITH_ALPHA,N=v(k);m.uniform1fv(N.uniform.m,b),x()},h.colorMatrix.SHADER={},h.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( `
` ),h.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( `
` ),h.brightness=function(w){let b=(w||0)+1;h.colorMatrix([b,0,0,0,0,0,b,0,0,0,0,0,b,0,0,0,0,0,1,0])},h.saturation=function(w){let b=(w||0)*2/3+1,k=(b-1)*-.5;h.colorMatrix([b,k,k,0,0,k,b,k,0,0,k,k,b,0,0,0,0,0,1,0])},h.desaturate=function(){h.saturation(-1)},h.contrast=function(w){let b=(w||0)+1,k=-128*(b-1);h.colorMatrix([b,0,0,0,k,0,b,0,0,k,0,0,b,0,k,0,0,0,1,0])},h.negative=function(){h.contrast(-2)},h.hue=function(w){w=(w||0)/180*Math.PI;let b=Math.cos(w),k=Math.sin(w),N=.213,E=.715,F=.072;h.colorMatrix([N+b*(1-N)+k*-N,E+b*-E+k*-E,F+b*-F+k*(1-F),0,0,N+b*-N+k*.143,E+b*(1-E)+k*.14,F+b*-F+k*-.283,0,0,N+b*-N+k*-(1-N),E+b*-E+k*E,F+b*(1-F)+k*F,0,0,0,0,0,1,0])},h.desaturateLuminance=function(){h.colorMatrix([.2764723,.929708,.0938197,0,-37.1,.2764723,.929708,.0938197,0,-37.1,.2764723,.929708,.0938197,0,-37.1,0,0,0,1,0])},h.sepia=function(){h.colorMatrix([.393,.7689999,.18899999,0,0,.349,.6859999,.16799999,0,0,.272,.5339999,.13099999,0,0,0,0,0,1,0])},h.brownie=function(){h.colorMatrix([.5997023498159715,.34553243048391263,-.2708298674538042,0,47.43192855600873,-.037703249837783157,.8609577587992641,.15059552388459913,0,-36.96841498319127,.24113635128153335,-.07441037908422492,.44972182064877153,0,-7.562075277591283,0,0,0,1,0])},h.vintagePinhole=function(){h.colorMatrix([.6279345635605994,.3202183420819367,-.03965408211312453,0,9.651285835294123,.02578397704808868,.6441188644374771,.03259127616149294,0,7.462829176470591,.0466055556782719,-.0851232987247891,.5241648018700465,0,5.159190588235296,0,0,0,1,0])},h.kodachrome=function(){h.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])},h.technicolor=function(){h.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])},h.polaroid=function(){h.colorMatrix([1.438,-.062,-.062,0,0,-.122,1.378,-.122,0,0,-.016,-.016,1.483,0,0,0,0,0,1,0])},h.shiftToBGR=function(){h.colorMatrix([0,0,1,0,0,0,1,0,0,0,1,0,0,0,0,0,0,0,1,0])},h.convolution=function(w){let b=new Float32Array(w),k=1/o,N=1/l,E=v(h.convolution.SHADER);m.uniform1fv(E.uniform.m,b),m.uniform2f(E.uniform.px,k,N),x()},h.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( `
` ),h.detectEdges=function(){h.convolution.call(this,[0,1,0,1,-4,1,0,1,0])},h.sobelX=function(){h.convolution.call(this,[-1,0,1,-2,0,2,-1,0,1])},h.sobelY=function(){h.convolution.call(this,[-1,-2,-1,0,0,0,1,2,1])},h.sharpen=function(w){let b=w||1;h.convolution.call(this,[0,-1*b,0,-1*b,1+4*b,-1*b,0,-1*b,0])},h.emboss=function(w){let b=w||1;h.convolution.call(this,[-2*b,-1*b,0,-1*b,1,1*b,0,1*b,2*b])},h.blur=function(w){let b=w/7/o,k=w/7/l,N=v(h.blur.SHADER);m.uniform2f(N.uniform.px,0,k),x(f.INTERMEDIATE),m.uniform2f(N.uniform.px,b,0),x()},h.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( `
` ),h.pixelate=function(w){let b=w/o,k=w/l,N=v(h.pixelate.SHADER);m.uniform2f(N.uniform.size,b,k),x()},h.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 j0=2048,Re,wt, $ t;function qg(e,t){let n;if(!e)throw new Error("Human: Input is missing");if(!(e instanceof ze)&&!(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 ze)if(e.shape&&e.shape.length===4&&e.shape[0]===1&&e.shape[3]===3)n=Wr(e);else throw new Error( ` Human : Input tensor shape must be [ 1 , height , width , 3 ] and instead was $ { e . shape } ` );else{let a=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=a,o=s;if(i>j0&&(i=j0,o=i*s/a),o>j0&&(o=j0,i=o*a/s),t.filter.width>0?i=t.filter.width:t.filter.height>0&&(i=a*(t.filter.height/s)),t.filter.height>0?o=t.filter.height:t.filter.width>0&&(o=s*(t.filter.width/a)),!i||!o)throw new Error("Human: Input cannot determine dimension");(!Re||(Re==null?void 0:Re.width)!==i||(Re==null?void 0:Re.height)!==o)&&(Re=typeof OffscreenCanvas!="undefined"?new OffscreenCanvas(i,o):document.createElement("canvas"),(Re==null?void 0:Re.width)!==i&&(Re.width=i),(Re==null?void 0:Re.height)!==o&&(Re.height=o));let l=Re.getContext("2d");if(e instanceof ImageData?l.putImageData(e,0,0):l.drawImage(e,0,0,a,s,0,0,Re==null?void 0:Re.width,Re==null?void 0:Re.height),t.filter.enabled){if((! $ t||!wt||Re.width!==wt.width||(Re==null?void 0:Re.height)!==(wt==null?void 0:wt.height))&&(wt=typeof OffscreenCanvas!="undefined"?new OffscreenCanvas(Re==null?void 0:Re.width,Re==null?void 0:Re.height):document.createElement("canvas"),(wt==null?void 0:wt.width)!==(Re==null?void 0:Re.width)&&(wt.width=Re==null?void 0:Re.width),(wt==null?void 0:wt.height)!==(Re==null?void 0:Re.height)&&(wt.height=Re==null?void 0:Re.height), $ t=_r.flags.IS_BROWSER?new fk({canvas:wt}):null),! $ t)return{tensor:null,canvas:Re}; $ t.reset(), $ t.addFilter("brightness",t.filter.brightness),t.filter.contrast!==0&& $ t.addFilter("contrast",t.filter.contrast),t.filter.sharpness!==0&& $ t.addFilter("sharpen",t.filter.sharpness),t.filter.blur!==0&& $ t.addFilter("blur",t.filter.blur),t.filter.saturation!==0&& $ t.addFilter("saturation",t.filter.saturation),t.filter.hue!==0&& $ t.addFilter("hue",t.filter.hue),t.filter.negative&& $ t.addFilter("negative"),t.filter.sepia&& $ t.addFilter("sepia"),t.filter.vintage&& $ t.addFilter("brownie"),t.filter.sepia&& $ t.addFilter("sepia"),t.filter.kodachrome&& $ t.addFilter("kodachrome"),t.filter.technicolor&& $ t.addFilter("technicolor"),t.filter.polaroid&& $ t.addFilter("polaroid"),t.filter.pixelate!==0&& $ t.addFilter("pixelate",t.filter.pixelate), $ t.apply(Re)}else wt=Re, $ t&&( $ t=null);let c;if(wt.data){let h=[wt.height,wt.width,3];c=xd(wt.data,h,"int32")}else if(wt instanceof ImageData)c=pi.fromPixels(wt);else if(t.backend==="webgl"||t.backend==="humangl"){let h=typeof OffscreenCanvas!="undefined"?new OffscreenCanvas(i,o):document.createElement("canvas");h.width=i,h.height=o;let d=h.getContext("2d");d==null||d.drawImage(wt,0,0),c=pi.fromPixels(h)}else{let h=typeof OffscreenCanvas!="undefined"?new OffscreenCanvas(i,o):document.createElement("canvas");h.width=i,h.height=o;let d=h.getContext("2d");d==null||d.drawImage(wt,0,0);let p=d==null?void 0:d.getImageData(0,0,i,o);c=pi.fromPixels(p)}let u=c.toFloat();n=u.expandDims(0),c.dispose(),u.dispose()}let r=t.filter.return?wt:null;return{tensor:n,canvas:r}}var Xg={};Jn(Xg,{all:()=>roe,body:()=>Ak,canvas:()=>noe,face:()=>yk,gesture:()=>mk,hand:()=>gk,object:()=>xk,options:()=>ji});var ht={backend:"webgl",modelBasePath:"../models/",wasmPath:"../assets/",debug:!0,async:!0,profile:!1,deallocate:!1,scoped:!1,videoOptimized:!0,warmup:"face",filter:{enabled:!0,width:0,height:0,return:!0
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
KCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgo / 8 AAEQgBAAEAAwEhA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PY86 + 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
zviKFHNegeX1J41zUhXioGbuaSuM6wpCaBHG / EcA6HN / exxXjXw2jL67cv8A3Qa6H8CFR + NnoWpO
I4XI44r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3 + 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-17 00:03:15 +02:00
euPnNY + oXWZEVJNrZ9aun8SIq / CzodHuriIokhDIR1ronbKZr0o6o8ipoz //2Q==`,G0=`
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 QAGwABAAIDAQEAAAAAAAAAAAAAAAEDAgQFBgf / xABDEAEAAgECBAMECQIDBgUFAQAA
AQIDBBEFEiExE0F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JWsesywniukrG / 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 / DeBtJxx29vaAJQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA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8d4eM4to9RwjPXFa0ZIvG9bR0fQXmPbDFvTTZPOJmEWS / 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
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA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tv3699 + 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 + TP66QDRiAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA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0msxHfp3dzNoLzp4zUmZpMbT8HJyYJi20X2n0lh
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
mNohFbMhLWy0mJ3rPXvDvcO1karBG8 / WV6Wj + 7 kWrvDDBlvpdRGSnbzj1hpjX4z8mOx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Ha1 + 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
izsd2J3jeBpcNz + Lg5LT7 + Pp + Xk3W7js5eAAgAAAAAAAAAAAAAAAAAAAAAAAA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6TZyW9ABAAAAAAAAAAAAAAAAAAAAAADj8Unm1tK / 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 + ay8mex6EIneN47SNXKAA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S1Vf / 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
LJ2p4TwnVavNWaYbRTfre0bQ99pcH0bT0xb78vmtiIiNojaErMwAAAAAAAAAAAAAAAAAAAAAAAAA
AA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AAAAAAAAAAAAAAAAAAAAAAAA
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 / WVeyY6FPspc9dZPVXaOq2WEwIUTVRmjo2rNfLHRI3vZ
DJycXtX8dZh7t879nsnhcbwz23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xx0hFpY11K7R16KM32ZWz3UaidqSgrc9kcPicWyZJjfw6T + 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
AAAAAAAAAAASAAAAAAAAAAAAIASgAAAEJAQJQCNkbMgGOyOVnsAw5TlZ7GwMOVPKy2NgY7GzIBGx
skA2AAAAAAAAAAQkBAEghEskAxYzDPZGwK5hjMLJhjMAqmGEw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tt85djZdbDWnGOesRtXFtuw6T27No5Kx2OrKYQlC
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
yvDHTpPRaigHZhN4hHRlaVN59JY3zRENLUavaO + yq0iNVlitJ6vNcR1MVi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AAAAAAAASAAAAAAAAD /
2021-04-17 00:03:15 +02:00
2 Q == ` ;var wk="1.5.2";var iu,sh,ih,Ui,q0,oh,X0,K0,Z0,bk=class{constructor(t={}){iu.set(this,void 0);sh.set(this,void 0);ih.set(this,void 0);Ui.set(this,void 0);this.analyze=(...t)=>{if(!ur(this,sh))return;let n=this.tf.engine().state.numTensors,r=ur(this,iu);us(this,iu,n);let a=n-r;a!==0&&le(...t,a)};q0.set(this,t=>{if(!ur(this,ih))return null;if(!t)return"input is not defined";if(this.tf.ENV.flags.IS_NODE&&!(t instanceof ze))return"input must be a tensor";try{this.tf.getBackend()}catch(n){return"backend not loaded"}return null});oh.set(this,async(t=!1)=>{var n;if(this.config.backend&&this.config.backend.length>0&&t||this.tf.getBackend()!==this.config.backend){let r=Ye();if(this.state="backend",this.config.backend&&this.config.backend.length>0){if(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&&le("setting backend:",this.config.backend),this.config.backend==="wasm"){if(this.config.debug&&le("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 a=await this.tf.env().getAsync("WASM_HAS_SIMD_SUPPORT"),s=await this.tf.env().getAsync("WASM_HAS_MULTITHREAD_SUPPORT");this.config.debug&&le( ` wasm execution : $ { a ? "SIMD" : "no SIMD" } $ { s ? "multithreaded" : "singlethreaded" } ` ),this.config.debug&&!a&&le("warning: wasm simd support is not enabled")}this.config.backend==="humangl"&&v8();try{await this.tf.setBackend(this.config.backend)}catch(a){le("error: cannot set backend:",this.config.backend,a)}}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),this.config.deallocate&&(le("changing webgl: WEBGL_DELETE_TEXTURE_THRESHOLD:",this.config.deallocate),this.tf.ENV.set("WEBGL_DELETE_TEXTURE_THRESHOLD",this.config.deallocate?0:-1));let a=await this.tf.backend().getGPGPUContext().gl;this.config.debug&&le( ` gl version : $ { a . getParameter ( a . VERSION ) } renderer : $ { a . getParameter ( a . RENDERER ) } ` )}await this.tf.ready(),this.perf.backend=Math.trunc(Ye()-r)}});X0.set(this,async()=>{let t=(a,s="application/octet-stream")=>fetch( ` data : $ { s } ; base64 , $ { a } ` ).then(i=>i.blob()),n,r;switch(this.config.warmup){case"face":n=await t(H0);break;case"full":n=await t(G0);break;default:n=null}if(n){let a=await createImageBitmap(n);r=await this.detect(a,this.config),a.close()}return r});K0.set(this,async()=>new Promise(t=>{let n,r=0;switch(this.config.warmup){case"face":r=256,n="data:image/jpeg;base64,"+H0;break;case"full":case"body":r=1200,n="data:image/jpeg;base64,"+G0;break;default:n=null}let a=new Image;a.onload=async()=>{let s=typeof OffscreenCanvas!="undefined"?new OffscreenCanvas(r,r):document.createElement("canvas");s.width=a.naturalWidth,s.height=a.naturalHeight;let i=s.getContext("2d");i==null||i.drawImage(a,0,0);let o=await this.detect(s,this.config);t(o)},n?a.src=n:t(null)}));Z0.set(this,async()=>{let t=a=>Buffer.from(a,"base64"),n;if(this.config.warmup==="face"&&(n=t(H0)),(this.config.warmup==="body"||this.config.warmup==="full")&&(n=t(G0)),!n)return null;let r;if(typeof void 0!="undefined"){let a=(void 0).decodeJpeg(n),s=a.expandDims(0);this.tf.dispose(a),r=await this.detect(s,this.config),this.tf.dispose(s)}else this.config.debug&&le("Warmup tfjs-node not loaded");return r});this.tf=gu,this.draw=Xg,this.version=wk,this.config=Qn(ht,t),this.state="idle",us(this,iu,0),us(this,sh,!1),us(this,ih,!1),us(this,Ui,!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=>qg(n,this.config),this.classes={facemesh:fg,age:H2,gender:q2,emotion:J2,faceres:ag,body:this.config.body.modelPath.includes("posenet")?Sg:zg,hand:Fg,nanodet:Vg},this.faceTriangulation=D8,this.
/ * *
* @ 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