class_docstr: Creates a piecewise constant function.
docstr: Integrates the piecewise constant function between end points.
  
  Returns a value of the integral on the interval `[x1, x2]` of a piecewise
  constant function with jump locations and values given by the initializer.
  
  Args:
    x1: A real `Tensor` of shape `batch_shape + [num_points]`. Left end points
      at which the function has to be integrated.
    x2: A `Tensor` of the same shape and `dtype` as `x1`. Right end points at
      which the function has to be integrated.
    name: Python `str` name prefixed to ops created by this method.
      Default value: `None` which is mapped to the default name
      `self.name() + `_integrate``.
  
  Returns:
    A `Tensor` of the same `dtype` as `x` and shape
    `batch_shape + [num_points] + event_shape` containing values of the
    integral of the piecewise constant function between `[x1, x2]`.
docstr_tok: ["Integrates","the","piecewise","constant","function","between","end","points",".","Returns","a","value","of","the","integral","on","the","interval","`","[","x1",",","x2","]","`","of","a","piecewise","constant","function","with","jump","locations","and","values","given","by","the","initializer",".","Args",":","x1",":","A","real","`","Tensor","`","of","shape","`","batch_shape","+","[","num_points","]","`",".","Left","end","points","at","which","the","function","has","to","be","integrated",".","x2",":","A","`","Tensor","`","of","the","same","shape","and","`","dtype","`","as","`","x1","`",".","Right","end","points","at","which","the","function","has","to","be","integrated",".","name",":","Python","`","str","`","name","prefixed","to","ops","created","by","this","method",".","Default","value",":","`","None","`","which","is","mapped","to","the","default","name","`","self.name","(",")","+","`","_integrate","``",".","Returns",":","A","`","Tensor","`","of","the","same","`","dtype","`","as","`","x","`","and","shape","`","batch_shape","+","[","num_points","]","+","event_shape","`","containing","values","of","the","integral","of","the","piecewise","constant","function","between","`","[","x1",",","x2","]","`","."]
code: def integrate(self, x1, x2, name=None):
      """Integrates the piecewise constant function between end points.
  
      Returns a value of the integral on the interval `[x1, x2]` of a piecewise
      constant function with jump locations and values given by the initializer.
  
      Args:
        x1: A real `Tensor` of shape `batch_shape + [num_points]`. Left end points
          at which the function has to be integrated.
        x2: A `Tensor` of the same shape and `dtype` as `x1`. Right end points at
          which the function has to be integrated.
        name: Python `str` name prefixed to ops created by this method.
          Default value: `None` which is mapped to the default name
          `self.name() + `_integrate``.
  
      Returns:
        A `Tensor` of the same `dtype` as `x` and shape
        `batch_shape + [num_points] + event_shape` containing values of the
        integral of the piecewise constant function between `[x1, x2]`.
      """
      name = name or self._name + "_integrate"
      with tf.name_scope(name):
          x1 = tf.convert_to_tensor(x1, dtype=self.dtype(), name="x1")
          x2 = tf.convert_to_tensor(x2, dtype=self.dtype(), name="x2")
          batch_shape = tf.shape(self._jump_locations)[:-1]
          x1 = _try_broadcast_to(x1, batch_shape)
          x2 = _try_broadcast_to(x2, batch_shape)
          return _piecewise_constant_integrate(
              x1,
              x2,
              self._jump_locations,
              self._values,
              self._batch_rank,
          )
  
file_path: tf-quant-finance/tf_quant_finance/math/piecewise.py
imports: import tensorflow.compat.v2
label_desc: Use image node_id 7 for calling the PiecewiseConstantFunc obj's underlying member method code with example usage: obj.integrate(x1, x2, name) and returns: _piecewise_constant_integrate