pub fn quantize<T: Float + ConstZero + ConstOne + Serialize, Q: Unsigned, S: Data<Elem = T>, D: Dimension>(
data: &ArrayBase<S, D>,
quantize: impl Fn(T) -> Q,
) -> Result<Vec<Q>, LinearQuantizeCodecError>
Expand description
Linear-quantize the elements in the data
array using the quantize
closure.
ยงErrors
Errors with
LinearQuantizeCodecError::NonFiniteData
if any data element is non- finite (infinite or NaN)LinearQuantizeCodecError::HeaderEncodeFailed
if encoding the header failed