def conv_layer(x,
               hidden_size,
               kernel_size,
               stride,
               pooling_window,
               dropout_rate,
               dilation_rate,
               name="conv"):
    """Single conv layer with relu, optional pooling, and dropout."""
    with tf.variable_scope(name):
        out = x
        out = common_layers.conv1d_block(out,
                                         hidden_size,
                                         [(dilation_rate, kernel_size)],
                                         strides=stride,
                                         first_relu=False,
                                         padding="same")
        out = tf.nn.relu(out)
        if pooling_window:
            out = tf.layers.max_pooling1d(out,
                                          pooling_window,
                                          pooling_window,
                                          padding="same")
        out = tf.layers.dropout(out, dropout_rate)
        return out
def conv_layer(x,
               hidden_size,
               kernel_size,
               stride,
               pooling_window,
               dropout_rate,
               dilation_rate,
               name="conv"):
  with tf.variable_scope(name):
    out = x
    out = common_layers.conv1d_block(
        out,
        hidden_size, [(dilation_rate, kernel_size)],
        strides=stride,
        first_relu=False,
        padding="same")
    out = tf.nn.relu(out)
    if pooling_window:
      out = tf.layers.max_pooling1d(
          out, pooling_window, pooling_window, padding="same")
    out = tf.layers.dropout(out, dropout_rate)
    return out