class_docstr: Class that contains the common layers for language modeling -
          word embeddings and projection layer
docstr: Define the output word embedding layer
  Args:
      prediction: tf.tensor, the prediction from the model
      tied_weights: boolean, whether or not to tie weights from the input embedding layer
  
  Returns:
      Probability distribution over vocabulary
docstr_tok: ["Define","the","output","word","embedding","layer","Args",":","prediction",":","tf.tensor",",","the","prediction","from","the","model","tied_weights",":","boolean",",","whether","or","not","to","tie","weights","from","the","input","embedding","layer","Returns",":","Probability","distribution","over","vocabulary"]
code: def define_projection_layer(self, prediction, tied_weights=True):
      """
      Define the output word embedding layer
      Args:
          prediction: tf.tensor, the prediction from the model
          tied_weights: boolean, whether or not to tie weights from the input embedding layer
  
      Returns:
          Probability distribution over vocabulary
      """
      with tf.device("/cpu:0"):
          if tied_weights:
              # tie projection layer and embedding layer
              with tf.variable_scope(
                  "embedding_layer", reuse=tf.AUTO_REUSE
              ):
                  softmax_w = tf.matrix_transpose(
                      self.word_embeddings_tf
                  )
                  softmax_b = tf.get_variable(
                      "softmax_b", [self.num_words]
                  )
                  _, l, k = prediction.shape.as_list()
                  prediction_reshaped = tf.reshape(prediction, [-1, k])
                  mult_out = tf.nn.bias_add(
                      tf.matmul(prediction_reshaped, softmax_w),
                      softmax_b,
                  )
                  projection_out = tf.reshape(
                      mult_out, [-1, l, self.num_words]
                  )
          else:
              with tf.variable_scope("projection_layer", reuse=False):
                  projection_out = tf.layers.Dense(self.num_words)(
                      prediction
                  )
      return projection_out
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import tensorflow
  from tensorflow.python.framework import tensor_shape
  from tensorflow.python.keras.layers import Wrapper
  from tensorflow.python.layers.convolutional import Conv1D
  from tensorflow.python.ops import variable_scope
  from tensorflow.python.keras.engine.base_layer import Layer
  from tensorflow.python.eager import context
  from tensorflow.python.ops import nn_impl
  from tensorflow.python.keras import initializers
  from tensorflow.python.keras.engine.base_layer import InputSpec
  from tensorflow.python.ops import array_ops
  from tensorflow.python.framework import ops
label_desc: Use image node_id 3 for calling the CommonLayers obj's underlying member method code with example usage: obj.define_projection_layer(prediction, tied_weights) and returns: projection_out