def batch_indices(batch_nb, data_length, batch_size):
 start = int((batch_nb * batch_size))
 end = int(((batch_nb + 1) * batch_size))
 if (end > data_length):
  shift = (end - data_length)
  start -= shift
  end -= shift
 return (start, end)

def batch_indices ( batch_nb , data_length , batch_size ) : start = int ( ( batch_nb * batch_size ) ) end = int ( ( ( batch_nb + 1 ) * batch_size ) ) if ( end > data_length ) : shift = ( end - data_length ) start -= shift end -= shift return ( start , end )
this helper function computes a batch start and end index .