@@ -58,46 +58,39 @@ const createElementwiseProgramInfoLoader =
5858 } ;
5959 } ;
6060
61- export const abs = ( context : ComputeContext ) : number => {
61+ export const abs = ( context : ComputeContext ) : void => {
6262 context . compute ( createElementwiseProgramInfoLoader ( context . inputs [ 0 ] , 'Abs' , 'abs' ) ) ;
63- return 0 ;
6463} ;
6564
66- export const acos = ( context : ComputeContext ) : number => {
65+ export const acos = ( context : ComputeContext ) : void => {
6766 context . compute ( createElementwiseProgramInfoLoader ( context . inputs [ 0 ] , 'Acos' , 'acos' ) ) ;
68- return 0 ;
6967} ;
7068
71- export const acosh = ( context : ComputeContext ) : number => {
69+ export const acosh = ( context : ComputeContext ) : void => {
7270 context . compute ( createElementwiseProgramInfoLoader ( context . inputs [ 0 ] , 'Acosh' , 'acosh' ) ) ;
73- return 0 ;
7471} ;
7572
76- export const asin = ( context : ComputeContext ) : number => {
73+ export const asin = ( context : ComputeContext ) : void => {
7774 context . compute ( createElementwiseProgramInfoLoader ( context . inputs [ 0 ] , 'Asin' , 'asin' ) ) ;
78- return 0 ;
7975} ;
8076
81- export const asinh = ( context : ComputeContext ) : number => {
77+ export const asinh = ( context : ComputeContext ) : void => {
8278 context . compute ( createElementwiseProgramInfoLoader ( context . inputs [ 0 ] , 'Asinh' , 'asinh' ) ) ;
83- return 0 ;
8479} ;
8580
86- export const atan = ( context : ComputeContext ) : number => {
81+ export const atan = ( context : ComputeContext ) : void => {
8782 context . compute ( createElementwiseProgramInfoLoader ( context . inputs [ 0 ] , 'Atan' , 'atan' ) ) ;
88- return 0 ;
8983} ;
90- export const atanh = ( context : ComputeContext ) : number => {
84+ export const atanh = ( context : ComputeContext ) : void => {
9185 context . compute ( createElementwiseProgramInfoLoader ( context . inputs [ 0 ] , 'Atanh' , 'atanh' ) ) ;
92- return 0 ;
9386} ;
9487
9588export interface ClipAttributes extends AttributeWithCacheKey {
9689 readonly min : number ;
9790 readonly max : number ;
9891}
9992
100- export const clipV10 = ( context : ComputeContext , attributes : ClipAttributes ) : number => {
93+ export const clipV10 = ( context : ComputeContext , attributes : ClipAttributes ) : void => {
10194 context . compute (
10295 createElementwiseProgramInfoLoader (
10396 context . inputs [ 0 ] , 'Clip' , a => `clamp(${ a } , clip_min_, clip_max_)` , `
@@ -106,39 +99,35 @@ export const clipV10 = (context: ComputeContext, attributes: ClipAttributes): nu
10699` ,
107100 attributes . cacheKey ) ,
108101 { inputs : [ 0 ] } ) ;
109- return 0 ;
110102} ;
111103const generateClipAttributesFromInputs = ( inputs : readonly TensorView [ ] ) : ClipAttributes => {
112104 const min = ( inputs . length >= 2 ) ? inputs [ 1 ] . getFloat32Array ( ) [ 0 ] : MIN_CLIP ;
113105 const max = ( inputs . length >= 3 ) ? inputs [ 2 ] . getFloat32Array ( ) [ 0 ] : MAX_CLIP ;
114106 return createAttributeWithCacheKey ( { min, max} ) ;
115107} ;
116108
117- export const clip = ( context : ComputeContext ) : number => {
109+ export const clip = ( context : ComputeContext ) : void => {
118110 const attributes = generateClipAttributesFromInputs ( context . inputs ) ;
119- return clipV10 ( context , attributes ) ;
111+ clipV10 ( context , attributes ) ;
120112} ;
121113
122- export const ceil = ( context : ComputeContext ) : number => {
114+ export const ceil = ( context : ComputeContext ) : void => {
123115 context . compute ( createElementwiseProgramInfoLoader ( context . inputs [ 0 ] , 'Ceil' , 'ceil' ) ) ;
124- return 0 ;
125116} ;
126117
127- export const cos = ( context : ComputeContext ) : number => {
118+ export const cos = ( context : ComputeContext ) : void => {
128119 context . compute ( createElementwiseProgramInfoLoader ( context . inputs [ 0 ] , 'Cos' , 'cos' ) ) ;
129- return 0 ;
130120} ;
131121
132- export const cosh = ( context : ComputeContext ) : number => {
122+ export const cosh = ( context : ComputeContext ) : void => {
133123 context . compute ( createElementwiseProgramInfoLoader ( context . inputs [ 0 ] , 'Cosh' , 'cosh' ) ) ;
134- return 0 ;
135124} ;
136125
137126export interface EluAttributes extends AttributeWithCacheKey {
138127 readonly alpha : number ;
139128}
140129
141- export const elu = ( context : ComputeContext , attributes : EluAttributes ) : number => {
130+ export const elu = ( context : ComputeContext , attributes : EluAttributes ) : void => {
142131 context . compute ( createElementwiseProgramInfoLoader (
143132 context . inputs [ 0 ] , 'Elu' , a => `elu_vf32(${ a } )` , `
144133 const elu_alpha_: f32 = f32(${ attributes . alpha } );
@@ -151,13 +140,12 @@ export const elu = (context: ComputeContext, attributes: EluAttributes): number
151140 return vec4(elu_f32(v.x), elu_f32(v.y), elu_f32(v.z), elu_f32(v.w));
152141 }` ,
153142 attributes . cacheKey ) ) ;
154- return 0 ;
155143} ;
156144
157145export const parseEluAttributes = ( attributes : Record < string , unknown > ) : EluAttributes =>
158146 createAttributeWithCacheKey ( attributes as { alpha : number } ) ;
159147
160- export const erf = ( context : ComputeContext ) : number => {
148+ export const erf = ( context : ComputeContext ) : void => {
161149 context . compute ( createElementwiseProgramInfoLoader ( context . inputs [ 0 ] , 'Erf' , a => `erf_vf32(${ a } )` , `
162150 const r0: f32 = 0.3275911;
163151 const r1: f32 = 0.254829592;
@@ -171,50 +159,40 @@ export const erf = (context: ComputeContext): number => {
171159 let x = 1.0 / (1.0 + r0 * absv);
172160 return sign(v) * (1.0 - ((((r5 * x + r4) * x + r3) * x + r2) * x + r1) * x * exp(-absv * absv));
173161 }` ) ) ;
174- return 0 ;
175162} ;
176163
177- export const floor = ( context : ComputeContext ) : number => {
164+ export const floor = ( context : ComputeContext ) : void => {
178165 context . compute ( createElementwiseProgramInfoLoader ( context . inputs [ 0 ] , 'Floor' , 'floor' ) ) ;
179- return 0 ;
180166} ;
181167
182- export const neg = ( context : ComputeContext ) : number => {
168+ export const neg = ( context : ComputeContext ) : void => {
183169 context . compute ( createElementwiseProgramInfoLoader ( context . inputs [ 0 ] , 'Neg' , a => `-${ a } ` ) ) ;
184- return 0 ;
185170} ;
186171
187- export const reciprocal = ( context : ComputeContext ) : number => {
172+ export const reciprocal = ( context : ComputeContext ) : void => {
188173 context . compute ( createElementwiseProgramInfoLoader ( context . inputs [ 0 ] , 'Reciprocal' , a => `1.0/${ a } ` ) ) ;
189- return 0 ;
190174} ;
191175
192- export const sigmoid = ( context : ComputeContext ) : number => {
176+ export const sigmoid = ( context : ComputeContext ) : void => {
193177 context . compute ( createElementwiseProgramInfoLoader ( context . inputs [ 0 ] , 'Sigmoid' , a => `(1.0 / (1.0 + exp(-${ a } )))` ) ) ;
194- return 0 ;
195178} ;
196179
197- export const sin = ( context : ComputeContext ) : number => {
180+ export const sin = ( context : ComputeContext ) : void => {
198181 context . compute ( createElementwiseProgramInfoLoader ( context . inputs [ 0 ] , 'Sin' , 'sin' ) ) ;
199- return 0 ;
200182} ;
201183
202- export const sinh = ( context : ComputeContext ) : number => {
184+ export const sinh = ( context : ComputeContext ) : void => {
203185 context . compute ( createElementwiseProgramInfoLoader ( context . inputs [ 0 ] , 'Sinh' , 'sinh' ) ) ;
204- return 0 ;
205186} ;
206187
207- export const sqrt = ( context : ComputeContext ) : number => {
188+ export const sqrt = ( context : ComputeContext ) : void => {
208189 context . compute ( createElementwiseProgramInfoLoader ( context . inputs [ 0 ] , 'Sqrt' , 'sqrt' ) ) ;
209- return 0 ;
210190} ;
211191
212- export const tan = ( context : ComputeContext ) : number => {
192+ export const tan = ( context : ComputeContext ) : void => {
213193 context . compute ( createElementwiseProgramInfoLoader ( context . inputs [ 0 ] , 'Tan' , 'tan' ) ) ;
214- return 0 ;
215194} ;
216195
217- export const tanh = ( context : ComputeContext ) : number => {
196+ export const tanh = ( context : ComputeContext ) : void => {
218197 context . compute ( createElementwiseProgramInfoLoader ( context . inputs [ 0 ] , 'Tanh' , 'tanh' ) ) ;
219- return 0 ;
220198} ;
0 commit comments