parameters: (self, emitter, registers, input_address, elements,
                  output_address)
docstring: Emit quantization inner loop code.
docstring_summary: Emit quantization inner loop code.
docstring_tokens: Emit quantization inner loop code .
function: def Transform(self, emitter, registers, input_address, elements,
                  output_address):
      """Emit quantization inner loop code."""
      emitter.EmitNewline()
      emitter.EmitComment('Quantize::Transform')
      register_count = (elements + 3) / 4
      load = [registers.QuadRegister() for unused_i in range(register_count)]
      emitter.EmitVLoadAE(32, elements, load, input_address, None)
      emitter.EmitPldOffset(input_address, emitter.ImmediateConstant(64))
  
      for register in load:
        emitter.EmitVSub('f32', register, register, self.range_min)
  
      for register in load:
        emitter.EmitVMul('f32', register, register, self.range_scale)
  
      for register in load:
        emitter.EmitVAdd('f32', register, register, self.range_offset)
  
      for register in load:
        emitter.EmitVCvt('s32', 'f32', register, register)
  
      if len(load) is 1:
        emitter.EmitVQmovn('s32', load[0], load[0])
        emitter.EmitVQmovun('s16', load[0], load[0])
      elif len(load) is 2:
        emitter.EmitVQmovn2('s32', load[0], load[0], load[1])
        emitter.EmitVQmovun('s16', load[0], load[0])
      elif len(load) is 3:
        emitter.EmitVQmovn2('s32', load[0], load[0], load[1])
        emitter.EmitVQmovn('s32', load[2], load[2])
        emitter.EmitVQmovun2('s16', load[0], load[0], load[2])
      elif len(load) is 4:
        emitter.EmitVQmovn2('s32', load[0], load[0], load[1])
        emitter.EmitVQmovn2('s32', load[2], load[2], load[3])
        emitter.EmitVQmovun2('s16', load[0], load[0], load[2])
      else:
        assert False
  
      emitter.EmitNewline()
      emitter.EmitVStoreAE(8, elements, load, output_address, None)
      emitter.EmitPld(output_address)
      registers.FreeRegisters(load)
function_tokens: def Transform ( self , emitter , registers , input_address , elements , output_address ) : emitter . EmitNewline ( ) emitter . EmitComment ( 'Quantize::Transform' ) register_count = ( elements + 3 ) / 4 load = [ registers . QuadRegister ( ) for unused_i in range ( register_count ) ] emitter . EmitVLoadAE ( 32 , elements , load , input_address , None ) emitter . EmitPldOffset ( input_address , emitter . ImmediateConstant ( 64 ) ) for register in load : emitter . EmitVSub ( 'f32' , register , register , self . range_min ) for register in load : emitter . EmitVMul ( 'f32' , register , register , self . range_scale ) for register in load : emitter . EmitVAdd ( 'f32' , register , register , self . range_offset ) for register in load : emitter . EmitVCvt ( 's32' , 'f32' , register , register ) if len ( load ) is 1 : emitter . EmitVQmovn ( 's32' , load [ 0 ] , load [ 0 ] ) emitter . EmitVQmovun ( 's16' , load [ 0 ] , load [ 0 ] ) elif len ( load ) is 2 : emitter . EmitVQmovn2 ( 's32' , load [ 0 ] , load [ 0 ] , load [ 1 ] ) emitter . EmitVQmovun ( 's16' , load [ 0 ] , load [ 0 ] ) elif len ( load ) is 3 : emitter . EmitVQmovn2 ( 's32' , load [ 0 ] , load [ 0 ] , load [ 1 ] ) emitter . EmitVQmovn ( 's32' , load [ 2 ] , load [ 2 ] ) emitter . EmitVQmovun2 ( 's16' , load [ 0 ] , load [ 0 ] , load [ 2 ] ) elif len ( load ) is 4 : emitter . EmitVQmovn2 ( 's32' , load [ 0 ] , load [ 0 ] , load [ 1 ] ) emitter . EmitVQmovn2 ( 's32' , load [ 2 ] , load [ 2 ] , load [ 3 ] ) emitter . EmitVQmovun2 ( 's16' , load [ 0 ] , load [ 0 ] , load [ 2 ] ) else : assert False emitter . EmitNewline ( ) emitter . EmitVStoreAE ( 8 , elements , load , output_address , None ) emitter . EmitPld ( output_address ) registers . FreeRegisters ( load )