@@ -307,11 +307,9 @@ export class NeuralNetworkGPU<
307307 }
308308 const result = this . _divideMSESum ( data . length , sum ) ;
309309 release ( sum ) ;
310- return (
311- result instanceof Texture
312- ? ( result . toArray ( ) as number [ ] )
313- : ( result as number [ ] )
314- ) [ 0 ] ;
310+ return ( result instanceof Texture
311+ ? ( result . toArray ( ) as number [ ] )
312+ : ( result as number [ ] ) ) [ 0 ] ;
315313 }
316314
317315 adjustWeights ( ) : void {
@@ -621,11 +619,11 @@ export class NeuralNetworkGPU<
621619 if ( this . inputLookup ) {
622620 formattedInput = lookup . toArray (
623621 this . inputLookup ,
624- input as unknown as INumberHash ,
622+ ( input as unknown ) as INumberHash ,
625623 this . inputLookupLength
626624 ) ;
627625 } else {
628- formattedInput = input as unknown as Float32Array ;
626+ formattedInput = ( input as unknown ) as Float32Array ;
629627 }
630628 this . validateInput ( formattedInput ) ;
631629 const outputTextures = this . runInput ( formattedInput ) ;
@@ -635,13 +633,13 @@ export class NeuralNetworkGPU<
635633 : outputTextures ;
636634
637635 if ( this . outputLookup ) {
638- return lookup . toObject (
636+ return ( lookup . toObject (
639637 this . outputLookup ,
640638 output as Float32Array
641- ) as unknown as OutputType ;
639+ ) as unknown ) as OutputType ;
642640 }
643641
644- return output as unknown as OutputType ;
642+ return ( output as unknown ) as OutputType ;
645643 }
646644
647645 // @ts -expect-error the underlying network works as normal, but we are working on the GPU
@@ -694,10 +692,9 @@ export class NeuralNetworkGPU<
694692 }
695693 // use Array.from, keeping json small
696694 const jsonLayerWeights = this . weights . map ( ( layerWeights ) => {
697- return (
698- layerWeights instanceof Texture
699- ? ( layerWeights . toArray ( ) as Float32Array [ ] )
700- : ( layerWeights as Float32Array [ ] )
695+ return ( layerWeights instanceof Texture
696+ ? ( layerWeights . toArray ( ) as Float32Array [ ] )
697+ : ( layerWeights as Float32Array [ ] )
701698 ) . map ( ( layerWeights ) => Array . from ( layerWeights ) ) ;
702699 } ) ;
703700 const jsonLayerBiases = this . biases . map ( ( layerBiases ) =>
0 commit comments