(batch_size, beam_size)
return batch_pos
Computes the i'th coordinate that contains the batch index for gathers.
Computes the i'th coordinate that contains the batch index for gathers.
Computes the i th coordinate that contains the batch index for gathers .
def compute_batch_indices(batch_size, beam_size):
  """Computes the i'th coordinate that contains the batch index for gathers."""
  batch_pos = tf.range(batch_size * beam_size) // beam_size
  batch_pos = tf.reshape(batch_pos, [batch_size, beam_size])
  return batch_pos
def compute_batch_indices ( batch_size , beam_size ) : batch_pos = tf . range ( batch_size * beam_size ) // beam_size batch_pos = tf . reshape ( batch_pos , [ batch_size , beam_size ] ) return batch_pos