code: def get_last_right_output(
      full_output, max_length, actual_length, rnn_units
  ):
      batch_size = tf.shape(full_output)[0]
      # Start indices for each sample
      index = tf.range(0, batch_size) * max_length + (actual_length - 1)
      # Indexing
      return tf.gather(tf.reshape(full_output, [-1, rnn_units]), index)
  
file_path: cornac/cornac/models/beacon/beacon_tf.py
imports: import numpy
  import warnings
  import tensorflow.compat.v1
label_desc: Use image node_id 4 for calling a global function with example usage: get_last_right_output(full_output, max_length, actual_length, rnn_units) and returns: tf