code: def _mlp_transform(inputs, output_size, activation_fn=tf.identity):
      """Transforms inputs through a fully-connected layer that creates the output
      with specified size.
  
      Args:
          inputs: A Tensor of shape `[batch_size, d1, ..., dn]`, or a (nested)
              tuple of such elements. The dimensions `d1, ..., dn` will be flatten
              and transformed by a dense layer.
          output_size: Can be an Integer, a TensorShape, or a (nested) tuple of
              Integers or TensorShape.
          activation_fn: Activation function applied to the output.
  
      Returns:
          If :attr:`output_size` is an Integer or a TensorShape, returns a Tensor
          of shape `[batch_size x output_size]`. If :attr:`output_size` is a tuple
          of Integers or TensorShape, returns a tuple having the same structure as
          :attr:`output_size`, where each element Tensor has the same size as
          defined in :attr:`output_size`.
      """
      # Flatten inputs
      flat_input = nest.flatten(inputs)
      dims = [_get_tensor_depth(x) for x in flat_input]
      flat_input = [
          tf.reshape(x, ([-1, d])) for x, d in zip(flat_input, dims)
      ]
      concat_input = tf.concat(flat_input, 1)
  
      # Get output dimension
      flat_output_size = nest.flatten(output_size)
      if isinstance(flat_output_size[0], tf.TensorShape):
          size_list = [0] * len(flat_output_size)
          for i, shape in enumerate(flat_output_size):
              size_list[i] = np.prod([dim.value for dim in shape])
      else:
          size_list = flat_output_size
      sum_output_size = sum(size_list)
  
      # fc_output = tf.contrib.layers.fully_connected(
      #    concat_input, sum_output_size, activation_fn=activation_fn)
      fc_output = tf.layers.dense(
          concat_input, sum_output_size, activation=activation_fn
      )
  
      flat_output = tf.split(fc_output, size_list, axis=1)
  
      if isinstance(flat_output_size[0], tf.TensorShape):
          for i, shape in enumerate(flat_output_size):
              flat_output[i] = tf.reshape(
                  flat_output[i], [-1] + shape.as_list()
              )
      output = nest.pack_sequence_as(
          structure=output_size, flat_sequence=flat_output
      )
  
      return output
  
imports: import numpy
  import tensorflow
  from tensorflow import distributions
  from tensorflow.python.util import nest
  from texar.tf.modules.connectors.connector_base import ConnectorBase
  from texar.tf.core import layers
  from texar.tf.utils.utils import get_function, check_or_get_instance
label_desc: Use image node_id 3 for calling a global function with example usage: _mlp_transform(inputs, output_size, activation_fn) and returns: output