parameters: (cls, qat_module: QAT._ConvBnActivation2d)
return_statement: return qconv
docstring: r"""
          Return a :class:`~.QuantizedModule` instance converted from a
          :class:`~.QATModule` instance.
docstring_summary: r"""
          Return a :class:`~.QuantizedModule` instance converted from a
          :class:`~.QATModule` instance.
docstring_tokens: r Return a : class : ~ . QuantizedModule instance converted from a : class : ~ . QATModule instance .
function: def from_qat_module(cls, qat_module: QAT._ConvBnActivation2d):
          r"""
          Return a :class:`~.QuantizedModule` instance converted from a
          :class:`~.QATModule` instance.
          """
          output_dtype = qat_module.get_activation_dtype()
          qconv = cls(
              qat_module.conv.in_channels,
              qat_module.conv.out_channels,
              qat_module.conv.kernel_size,
              qat_module.conv.stride,
              qat_module.conv.padding,
              qat_module.conv.dilation,
              qat_module.conv.groups,
              dtype=output_dtype,
              name=qat_module.name,
          )
          w_fold, b_fold = qat_module.fold_weight_bias(
              qat_module.bn.running_mean, qat_module.bn.running_var
          )
          weight = w_fold.astype(qat_module.get_weight_dtype())
          qconv.weight = Parameter(weight.numpy(), name=qat_module.conv.weight.name)
          qconv.bias = Parameter(b_fold.numpy())
          if qat_module.conv.bias is not None:
              qconv.bias.name = qat_module.conv.bias.name
          return qconv
function_tokens: def from_qat_module ( cls , qat_module : QAT . _ConvBnActivation2d ) : output_dtype = qat_module . get_activation_dtype ( ) qconv = cls ( qat_module . conv . in_channels , qat_module . conv . out_channels , qat_module . conv . kernel_size , qat_module . conv . stride , qat_module . conv . padding , qat_module . conv . dilation , qat_module . conv . groups , dtype = output_dtype , name = qat_module . name , ) w_fold , b_fold = qat_module . fold_weight_bias ( qat_module . bn . running_mean , qat_module . bn . running_var ) weight = w_fold . astype ( qat_module . get_weight_dtype ( ) ) qconv . weight = Parameter ( weight . numpy ( ) , name = qat_module . conv . weight . name ) qconv . bias = Parameter ( b_fold . numpy ( ) ) if qat_module . conv . bias is not None : qconv . bias . name = qat_module . conv . bias . name return qconv