code: def upsampling(
      input_,
      kernel_size,
      stride,
      num_outputs,
      scope,
      activation_fn=tf.nn.relu,
  ):
      """A smooth replacement of a same-padded transposed convolution.
  
      This function first computes a nearest-neighbor upsampling of the input by a
      factor of `stride`, then applies a mirror-padded, same-padded convolution.
  
      It expects `kernel_size` to be odd.
  
      Args:
        input_: 4-D Tensor input.
        kernel_size: int (odd-valued) representing the kernel size.
        stride: int representing the strides.
        num_outputs: int. Number of output feature maps.
        scope: str. Scope under which to operate.
        activation_fn: activation function.
  
      Returns:
        4-D Tensor output.
  
      Raises:
        ValueError: if `kernel_size` is even.
      """
      if kernel_size % 2 == 0:
          raise ValueError("kernel_size is expected to be odd.")
      with tf.variable_scope(scope):
          shape = tf.shape(input_)
          height = shape[1]
          width = shape[2]
          upsampled_input = tf.image.resize_nearest_neighbor(
              input_, [stride * height, stride * width]
          )
          return conv2d(
              upsampled_input,
              kernel_size,
              1,
              num_outputs,
              "conv",
              activation_fn=activation_fn,
          )
  
imports: from magenta.models.image_stylization import ops
  import tensorflow.compat.v1
  import tf_slim
label_desc: Use image node_id 3 for calling a global function with example usage: upsampling(input_, kernel_size, stride, num_outputs, scope, activation_fn) and returns: conv2d