code: def _upscale2d(x, factor=2, gain=1):
      assert x.shape.ndims == 4 and all(
          dim.value is not None for dim in x.shape[1:]
      )
      assert isinstance(factor, int) and factor >= 1
  
      # Apply gain.
      if gain != 1:
          x *= gain
  
      # No-op => early exit.
      if factor == 1:
          return x
  
      # Upscale using tf.tile().
      s = x.shape
      x = tf.reshape(x, [-1, s[1], s[2], 1, s[3], 1])
      x = tf.tile(x, [1, 1, 1, factor, 1, factor])
      x = tf.reshape(x, [-1, s[1], s[2] * factor, s[3] * factor])
      return x
  
imports: import numpy
  import tensorflow
  import dnnlib
  import dnnlib.tflib
label_desc: Use image node_id 2 for calling a global function with example usage: _upscale2d(x, factor, gain) and returns: x, x