Converts a PMF into a quantized CDF for range coding.
tfc.ops.pmf_to_quantized_cdf(
pmf, precision, name=None
)
This op uses floating-point operations internally. Therefore the quantized output may not be consistent across multiple platforms. For entropy encoders and decoders to have the same quantized CDF on different platforms, the quantized CDF should be produced once and saved, then the saved quantized CDF should be used everywhere.
After quantization, if PMF does not sum to 2^precision, then some values of PMF are increased or decreased to adjust the sum to equal to 2^precision.
Note that the input PMF is pre-quantization. The input PMF is not normalized by this op prior to quantization. Therefore the user is responsible for normalizing PMF if necessary.
Args | |
---|---|
pmf
|
A Tensor of type float32 .
|
precision
|
An int that is >= 1 .
|
name
|
A name for the operation (optional). |
Returns | |
---|---|
A Tensor of type int32 .
|