# tensorplay.functional.quantized_batch_norm Source: https://www.tensorplay.cn/docs/generated/tensorplay.functional.quantized_batch_norm.html ```python tensorplay.functional.quantized_batch_norm(input, weight=None, bias=None, mean, var, eps, output_scale, output_zero_point) → Tensor ``` Applies batch normalization on a 4D (NCHW) quantized tensor. $$y = \frac{x - \mathrm{E}[x]}{\sqrt{\mathrm{Var}[x] + \epsilon}} * \gamma + \beta$$ Parameters: - input ([Tensor](/docs/generated/tensorplay.Tensor.html#tensorplay.Tensor)) – quantized tensor - weight ([Tensor](/docs/generated/tensorplay.Tensor.html#tensorplay.Tensor)) – float tensor that corresponds to the gamma, size C - bias ([Tensor](/docs/generated/tensorplay.Tensor.html#tensorplay.Tensor)) – float tensor that corresponds to the beta, size C - mean ([Tensor](/docs/generated/tensorplay.Tensor.html#tensorplay.Tensor)) – float mean value in batch normalization, size C - var ([Tensor](/docs/generated/tensorplay.Tensor.html#tensorplay.Tensor)) – float tensor for variance, size C - eps ([float](https://docs.python.org/3/builtins/functions.html#float)) – a value added to the denominator for numerical stability. - output_scale ([float](https://docs.python.org/3/builtins/functions.html#float)) – output quantized tensor scale - output_zero_point ([int](https://docs.python.org/3/builtins/functions.html#int)) – output quantized tensor zero_point Returns: A quantized tensor with batch normalization applied. Return type: [Tensor](/docs/generated/tensorplay.Tensor.html#tensorplay.Tensor) Example: ``` >>> qx = tensorplay.quantize_per_tensor(tensorplay.rand(2, 2, 2, 2), 1.5, 3, tensorplay.quint8) >>> tensorplay.quantized_batch_norm(qx, tensorplay.ones(2), tensorplay.zeros(2), tensorplay.rand(2), tensorplay.rand(2), 0.00001, 0.2, 2) tensor([[[[-0.2000, -0.2000], [ 1.6000, -0.2000]], [[-0.4000, -0.4000], [-0.4000, 0.6000]]], [[[-0.2000, -0.2000], [-0.2000, -0.2000]], [[ 0.6000, -0.4000], [ 0.6000, -0.4000]]]], size=(2, 2, 2, 2), dtype=tensorplay.quint8, quantization_scheme=tensorplay.per_tensor_affine, scale=0.2, zero_point=2) ```