code: def _apply_boundary_conditions_after_step(
      inner_grid_out,
      boundary_conditions,
      has_default_lower_boundary,
      has_default_upper_boundary,
      coord_grid,
      coord_grid_deltas,
      time_after_step,
  ):
      """Calculates and appends boundary values after making a step."""
      # After we've updated the values in the inner part of the grid according to
      # the PDE, we append the boundary values calculated using the boundary
      # conditions.
      # This is done using the discretized form of the boundary conditions,
      # v0 = xi1 v1 + xi2 v2 + eta.
      # We do not change the rows of the spatial discretization matrix where the
      # boundary condition is default
  
      if has_default_lower_boundary:
          # No update for the default BC
          first_value = None
      else:
          # Robin BC case
          alpha, beta, gamma = boundary_conditions[0][0](
              time_after_step, coord_grid
          )
          alpha, beta, gamma = (
              _prepare_boundary_conditions(b, inner_grid_out)
              for b in (alpha, beta, gamma)
          )
          xi1, xi2, eta = _discretize_boundary_conditions(
              coord_grid_deltas[..., 0],
              coord_grid_deltas[..., 1],
              alpha,
              beta,
              gamma,
          )
          first_value = (
              xi1 * inner_grid_out[..., 0]
              + xi2 * inner_grid_out[..., 1]
              + eta
          )
  
      if has_default_upper_boundary:
          # No update for the default BC
          last_value = None
      else:
          # Robin BC case
          alpha, beta, gamma = boundary_conditions[0][1](
              time_after_step, coord_grid
          )
          alpha, beta, gamma = (
              _prepare_boundary_conditions(b, inner_grid_out)
              for b in (alpha, beta, gamma)
          )
          xi1, xi2, eta = _discretize_boundary_conditions(
              coord_grid_deltas[..., -1],
              coord_grid_deltas[..., -2],
              alpha,
              beta,
              gamma,
          )
          last_value = (
              xi1 * inner_grid_out[..., -1]
              + xi2 * inner_grid_out[..., -2]
              + eta
          )
  
      return _append_first_and_last(
          first_value, inner_grid_out, last_value
      )
  
file_path: tf-quant-finance/tf_quant_finance/math/pde/steppers/parabolic_equation_stepper.py
imports: import tensorflow.compat.v2
  from tf_quant_finance import utils
label_desc: Use image node_id 7 for calling a global function with example usage: _apply_boundary_conditions_after_step(inner_grid_out, boundary_conditions, has_default_lower_boundary, has_default_upper_boundary, coord_grid, coord_grid_deltas, time_after_step) and returns: _append_first_and_last