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!
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.