code: def unit(
      x1,
      x2,
      block_num,
      depth,
      num_layers,
      dim="2d",
      bottleneck=True,
      first_batch_norm=True,
      stride=1,
      training=True,
  ):
      """Implements bottleneck RevNet unit from authors' RevNet architecture.
  
      Args:
        x1: [N, H, W, C] tensor of network activations.
        x2: [N, H, W, C] tensor of network activations.
        block_num: integer ID of block
        depth: First depth in bottleneck residual unit.
        num_layers: Number of layers in the RevNet block.
        dim: '2d' if 2-dimensional, '3d' if 3-dimensional.
        bottleneck: Should a bottleneck layer be used.
        first_batch_norm: Whether to keep the first batch norm layer or not.
          Typically used in the first RevNet block.
        stride: Stride for the residual function.
        training: True for train phase, False for eval phase.
  
      Returns:
        Two [N, H, W, C] output activation tensors.
      """
      scope_name = "unit_%d" % block_num
      if bottleneck:
          depth1 = depth
          depth2 = depth * 4
      else:
          depth1 = depth2 = depth
  
      residual = wrapped_partial(
          f,
          depth1=depth1,
          depth2=depth2,
          dim=dim,
          training=training,
          bottleneck=bottleneck,
      )
  
      with tf.variable_scope(scope_name):
          downsample = (
              downsample_bottleneck
              if bottleneck
              else downsample_residual
          )
          # Manual implementation of downsampling
          with tf.variable_scope("downsampling"):
              with tf.variable_scope("x1"):
                  hx1 = downsample(x1, depth2, dim=dim, stride=stride)
                  fx2 = residual(
                      x2,
                      stride=stride,
                      first_batch_norm=first_batch_norm,
                  )
                  x1 = hx1 + fx2
              with tf.variable_scope("x2"):
                  hx2 = downsample(x2, depth2, dim=dim, stride=stride)
                  fx1 = residual(x1)
                  x2 = hx2 + fx1
  
          # Full block using memory-efficient rev_block implementation.
          with tf.variable_scope("full_block"):
              x1, x2 = contrib.layers().rev_block(
                  x1, x2, residual, residual, num_layers=num_layers
              )
              return x1, x2
  
imports: import functools
  from tensor2tensor.layers import common_hparams
  from tensor2tensor.utils import contrib
  from tensor2tensor.utils import registry
  from tensor2tensor.utils import t2t_model
  import tensorflow.compat.v1
  from tensorflow.compat.v1 import estimator
label_desc: Use image node_id 6 for calling a global function with example usage: unit(x1, x2, block_num, depth, num_layers, dim, bottleneck, first_batch_norm, stride, training) and returns: x1,  x2