code: def _transform_conv_weight(
      kernel_rdft: tf.Tensor,
      kernel_shape: tf.Tensor,
      log_step: tf.Tensor,
      quantized: bool = True,
  ) -> tf.Tensor:
      """Transforms from latent to convolution kernel."""
      step = tf.exp(log_step)
      if not quantized:
          kernel_rdft = tfc.round_st(kernel_rdft / step)
      kernel_rdft *= step * tf.sqrt(
          tf.cast(tf.reduce_prod(kernel_shape[:-2]), kernel_rdft.dtype)
      )
      kernel_rdft = _to_complex_with_gradient(kernel_rdft)
      if kernel_rdft.shape.rank == 3:
          # 1D convolution.
          kernel = tf.signal.irfft(
              kernel_rdft, fft_length=kernel_shape[:-2]
          )
          return tf.transpose(kernel, (2, 0, 1))
      else:
          # 2D convolution.
          kernel = tf.signal.irfft2d(
              kernel_rdft, fft_length=kernel_shape[:-2]
          )
          return tf.transpose(kernel, (2, 3, 0, 1))
  
imports: import functools
  from typing import Callable, List, Tuple
  import tensorflow
  import tensorflow_compression
  from tensorflow_model_optimization.python.core.common.keras.compression import algorithm
label_desc: Use image node_id 3 for calling a global function with example usage: _transform_conv_weight(kernel_rdft, kernel_shape, log_step, quantized) and returns: tf, tf