Apr-23-2022, 03:33 PM
Hello,
I am new to NumPy.
Lets say I have an array:
I want to quantize these values into 8bit integers from the range -127 to 128. So that the largest value in the array becomes a 128 and the smallest value becomes a -127. I know there might be resolution loss but I am okay with it.
How can I achieve this using NumPy (or some other technique)?
I am new to NumPy.
Lets say I have an array:
nparray = np.array(output2) print(output2.shape)Output:
(1, 26, 26, 128)All the values are floating point numbers. Most of them are 0.xxxxxxx, few are between 1.xxxxxxx to 4.xxxxxxx and extreme rare ones are above 5.xxxxxxx. They can be negative or positive.
I want to quantize these values into 8bit integers from the range -127 to 128. So that the largest value in the array becomes a 128 and the smallest value becomes a -127. I know there might be resolution loss but I am okay with it.
How can I achieve this using NumPy (or some other technique)?