code: def _grid_from_num_times(*, times, time_step, num_time_steps):
      """Creates a time grid for the requeste number of time steps."""
      # Build a uniform grid for the timestep of size
      # max(0, num_time_steps - tf.shape(times)[0])
      uniform_grid = tf.linspace(
          time_step,
          times[-1] - time_step,
          tf.math.maximum(num_time_steps - tf.shape(times)[0], 0),
      )
      grid = tf.sort(tf.concat([uniform_grid, times], 0))
      # Add zero to the time grid
      all_times = tf.concat([[0], grid], 0)
      time_indices = tf.searchsorted(
          all_times, times, out_type=tf.int32
      )
      return all_times, time_indices
  
file_path: tf-quant-finance/tf_quant_finance/models/utils.py
imports: import tensorflow.compat.v2
  from tf_quant_finance.math import random_ops
label_desc: Use image node_id 5 for calling a global function with example usage: _grid_from_num_times() and returns: all_times,  time_indices