code: def mlp(x, scope, n_state, act_fn, resid_pdrop, train=False):
      with tf.compat.v1.variable_scope(scope):
          nx = shape_list(x)[-1]
          act = act_fns[act_fn]
          h = act(conv1d(x, "c_fc", n_state, 1, train=train))
          h2 = conv1d(h, "c_proj", nx, 1, train=train)
          h2 = dropout(h2, resid_pdrop, train)
          return h2
  
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 12 for calling a global function with example usage: mlp(x, scope, n_state, act_fn, resid_pdrop, train) and returns: h2