<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def conv_stack(name, x, mid_channels, output_channels, dilations=None, activation="relu", dropout=0.0):
 """3-layer convolutional stack. Args: name: variable scope. x: 5-D Tensor. mid_channels: Number of output channels of the first layer. output_channels: Number of output channels. dilations: Dilations to apply in the first 3x3 layer and the last 3x3 layer. By default, apply no dilations. activation: relu or gatu. If relu, the second layer is relu(W*x) If gatu, the second layer is tanh(W1*x) * sigmoid(W2*x) dropout: float, 0.0 Returns: output: output of 3 layer conv network. """

  with tf.variable_scope(name, reuse=tf.AUTO_REUSE):

    x = conv_block("conv_block", x, mid_channels=mid_channels,
                   dilations=dilations, activation=activation,
                   dropout=dropout)

    # Final layer.
    x = conv("zeros", x, apply_actnorm=False, conv_init="zeros",
             output_channels=output_channels, dilations=dilations)
  return x