code: def _make_output_layer_from_tensor(
      output_layer_tensor, vocab_size, output_layer_bias, variable_scope
  ):
      """Creates a dense layer from a Tensor. Used to tie word embedding
      with the output layer weight.
      """
      affine_bias = None
      if output_layer_bias:
          with tf.variable_scope(variable_scope):
              affine_bias = tf.get_variable("affine_bias", [vocab_size])
  
      def _outputs_to_logits(outputs):
          shape = shape_list(outputs)
          dim = shape[-1]
          outputs = tf.reshape(outputs, [-1, dim])
          logits = tf.matmul(outputs, output_layer_tensor)
          if affine_bias is not None:
              logits += affine_bias
          logits = tf.reshape(logits, shape[:-1] + [vocab_size])
          return logits
  
      return _outputs_to_logits
  
imports: import copy
  import tensorflow
  from tensorflow.contrib.seq2seq import Decoder
  from tensorflow.python.framework import tensor_shape
  from tensorflow.python.util import nest
  from texar.tf.core import layers
  from texar.tf.utils import utils
  from texar.tf.utils.mode import is_train_mode, is_train_mode_py
  from texar.tf.modules.decoders.dynamic_decode import dynamic_decode
  from texar.tf.module_base import ModuleBase
  from texar.tf.modules.decoders import rnn_decoder_helpers
  from texar.tf.utils.dtypes import is_callable
  from texar.tf.utils.shapes import shape_list
  from texar.tf.modules.decoders import tf_helpers
label_desc: Use image node_id 1 for calling a global function with example usage: _make_output_layer_from_tensor(output_layer_tensor, vocab_size, output_layer_bias, variable_scope) and returns: _outputs_to_logits, logits