I have created quantized values as: {0.0, 0.5, 1.0}
and would like to do quantization for a vector based on the set. For instance, given vector [0.1, 0.1, 0.9, 0.8, 0.6, 0.6]
would be transferred into [0.0, 0.0, 1.0, 1.0, 0.5, 0.5]
.
Please guide me fastest way using python/numpy/pytorch. Thank you very much!