|  | 
| 17 | 17 | 2. Print the intermediate step outputs inside the LSTM for a single step LSTM invocation (Get2X2GateOutputCheckData in .cc) | 
| 18 | 18 | 3. Print the outputs for multi-step LSTM invocation (Get2X2LstmEvalCheckData in .cc) | 
| 19 | 19 | 
 | 
| 20 |  | -Every invocation gives three types information:  | 
| 21 |  | -1. Quantized output: kernel output in integer  | 
|  | 20 | +Every invocation gives three types information: | 
|  | 21 | +1. Quantized output: kernel output in integer | 
| 22 | 22 | 2. Dequantized output: Quantized output in floating point representation | 
| 23 | 23 | 3. Float output: output from the floating point computation (i.e., float kernel) | 
| 24 | 24 | 
 | 
| 25 |  | -Note:  | 
|  | 25 | +Note: | 
| 26 | 26 | 1. Change quantization settings in _KERNEL_CONFIG to see the outcomes from various quantization schema (e.g., 8x8 Vs. 16x8) | 
| 27 | 27 | 2. Only single batch inference is supporte here. Change _GATE_TEST_DATA or _MULTISTEP_TEST_DATA to see kernel outputs on different input data | 
| 28 |  | -3. The quantization computation here is not the exact as the c++ implementation. The integer calculation is mimiced here using floating point.  | 
|  | 28 | +3. The quantization computation here is not the exact as the c++ implementation. The integer calculation is emulated here using floating point. | 
| 29 | 29 | No fixed point math is implemented here. The purpose is to illustrate the computation procedure and possible quantization error accumulation, not for bit exactness. | 
| 30 | 30 | """ | 
| 31 | 31 | from absl import app | 
|  | 
| 38 | 38 | _KERNEL_CONFIG = { | 
| 39 | 39 |     'quantization_settings': { | 
| 40 | 40 |         'weight_bits': 8, | 
| 41 |  | -        'activation_bits': 8, | 
|  | 41 | +        'activation_bits': 16, | 
| 42 | 42 |         'bias_bits': 32, | 
| 43 | 43 |         'cell_bits': 16, | 
| 44 | 44 |     }, | 
|  | 
| 88 | 88 | _MULTISTEP_TEST_DATA = { | 
| 89 | 89 |     'init_hidden_state_vals': [0, 0], | 
| 90 | 90 |     'init_cell_state_vals': [0, 0], | 
| 91 |  | -    'input_data': [0.2, 0.3, 0.2, 0.3, 0.2, 0.3],  # three time steps  | 
|  | 91 | +    'input_data': [0.2, 0.3, 0.2, 0.3, 0.2, 0.3],  # three time steps | 
| 92 | 92 |     'hidden_state_range': (-0.5, 0.7), | 
| 93 | 93 |     'cell_state_range': [-8, 8], | 
| 94 | 94 |     'input_data_range': [-1, 1] | 
|  | 
0 commit comments