code: def conv1d(
      x,
      scope,
      nf,
      rf,
      w_init=tf.compat.v1.random_normal_initializer(stddev=0.02),
      b_init=tf.compat.v1.constant_initializer(0),
      pad="VALID",
      train=False,
  ):
      with tf.compat.v1.variable_scope(scope):
          nx = shape_list(x)[-1]
          w = tf.compat.v1.get_variable(
              "w", [rf, nx, nf], initializer=w_init
          )
          b = tf.compat.v1.get_variable("b", [nf], initializer=b_init)
          if rf == 1:  # faster 1x1 conv
              c = tf.reshape(
                  tf.matmul(
                      tf.reshape(x, [-1, nx]), tf.reshape(w, [-1, nf])
                  )
                  + b,
                  shape_list(x)[:-1] + [nf],
              )
          else:  # was used to train LM
              c = (
                  tf.nn.conv1d(
                      input=x, filters=w, stride=1, padding=pad
                  )
                  + b
              )
          return c
  
imports: import functools
  import numpy
  import tensorflow
  from finetune.optimizers.recompute_grads import recompute_grad
  from finetune.util.shapes import shape_list, lengths_from_eos_idx
  from finetune.nn.activations import act_fns
  from finetune.nn.nn_utils import dropout, norm
label_desc: Use image node_id 9 for calling a global function with example usage: conv1d(x, scope, nf, rf, w_init, b_init, pad, train) and returns: c