class_docstr: Creates a piecewise constant function.
docstr: Computes value of the piecewise constant function.
  
  Returns a value of the piecewise function with jump locations and values
  given by the initializer.
  
  Args:
    x: A real `Tensor` of shape `batch_shape + [num_points]`. Points at which
      the function has to be evaluated.
    left_continuous: Python `bool`. Whether the function is left- or right-
      continuous, i.e., at the `jump_locations[..., i]` left-continuity means
      that the function has the same value
      `values[batch_rank * slice(None), i]`, whereas for
      right-continuity, the value is
      `values[batch_rank * slice(None), i + 1]`.
      Default value: `True` which means that the function is left-continuous.
    name: Python `str` name prefixed to ops created by this method.
      Default value: `None` which is mapped to the default name
      `self.name() + _call`.
  
  Returns:
    A `Tensor` of the same `dtype` as `x` and shape
    `batch_shape + [num_points] + event_shape` containing values of the
    piecewise constant function.
docstr_tok: ["Computes","value","of","the","piecewise","constant","function",".","Returns","a","value","of","the","piecewise","function","with","jump","locations","and","values","given","by","the","initializer",".","Args",":","x",":","A","real","`","Tensor","`","of","shape","`","batch_shape","+","[","num_points","]","`",".","Points","at","which","the","function","has","to","be","evaluated",".","left_continuous",":","Python","`","bool","`",".","Whether","the","function","is","left-","or","right-","continuous",",","i.e.",",","at","the","`","jump_locations","[","...",",","i","]","`","left-continuity","means","that","the","function","has","the","same","value","`","values","[","batch_rank","*","slice","(","None",")",",","i","]","`",",","whereas","for","right-continuity",",","the","value","is","`","values","[","batch_rank","*","slice","(","None",")",",","i","+","1","]","`",".","Default","value",":","`","True","`","which","means","that","the","function","is","left-continuous",".","name",":","Python","`","str","`","name","prefixed","to","ops","created","by","this","method",".","Default","value",":","`","None","`","which","is","mapped","to","the","default","name","`","self.name","(",")","+","_call","`",".","Returns",":","A","`","Tensor","`","of","the","same","`","dtype","`","as","`","x","`","and","shape","`","batch_shape","+","[","num_points","]","+","event_shape","`","containing","values","of","the","piecewise","constant","function","."]
code: def __call__(self, x, left_continuous=True, name=None):
      """Computes value of the piecewise constant function.
  
      Returns a value of the piecewise function with jump locations and values
      given by the initializer.
  
      Args:
        x: A real `Tensor` of shape `batch_shape + [num_points]`. Points at which
          the function has to be evaluated.
        left_continuous: Python `bool`. Whether the function is left- or right-
          continuous, i.e., at the `jump_locations[..., i]` left-continuity means
          that the function has the same value
          `values[batch_rank * slice(None), i]`, whereas for
          right-continuity, the value is
          `values[batch_rank * slice(None), i + 1]`.
          Default value: `True` which means that the function is left-continuous.
        name: Python `str` name prefixed to ops created by this method.
          Default value: `None` which is mapped to the default name
          `self.name() + _call`.
  
      Returns:
        A `Tensor` of the same `dtype` as `x` and shape
        `batch_shape + [num_points] + event_shape` containing values of the
        piecewise constant function.
      """
      name = name or self._name + "_call"
      with tf.name_scope(name):
          x = tf.convert_to_tensor(x, dtype=self.dtype(), name="x")
          batch_shape = tf.shape(self._jump_locations)[:-1]
          x = _try_broadcast_to(x, batch_shape)
          side = "left" if left_continuous else "right"
          return _piecewise_constant_function(
              x,
              self._jump_locations,
              self._values,
              self._batch_rank,
              side=side,
          )
  
file_path: tf-quant-finance/tf_quant_finance/math/piecewise.py
imports: import tensorflow.compat.v2
label_desc: Use image node_id 6 for calling the PiecewiseConstantFunc obj's underlying member method code with example usage: obj.__call__(x, left_continuous, name) and returns: _piecewise_constant_function