class_docstr: Base class for Ito processes.
  
    Represents a general Ito process:
  
    ```None
      dX_i = a_i(t, X) dt + Sum(S_{ij}(t, X) dW_j for 1 <= j <= n), 1 <= i <= n
    ```
  
  The vector coefficient `a_i` is referred to as the drift of the process and
  the matrix `S_{ij}` as the volatility of the process. For the process to be
  well defined, these coefficients need to satisfy certain technical conditions
  which may be found in Ref. [1]. The vector `dW_j` represents independent
  Brownian increments.
  
  #### Example. 2-dimensional Ito process of the form
  
  ```none
  dX_1 = mu_1 * sqrt(t) dt + s11 * dW_1 + s12 * dW_2
  dX_2 = mu_2 * sqrt(t) dt + s21 * dW_1 + s22 * dW_2
  ```
  
  class SimpleItoProcess(ito_process.ItoProcess):
    def __init__(self, dim, drift_fn, vol_fn, dtype=tf.float64):
      self._dim = dim
      self._drift_fn = drift_fn
      self._vol_fn = vol_fn
      self._dtype = dtype
  
    def dim(self):
      return self._dim
  
    def drift_fn(self):
      return self._drift_fn
  
    def volatility_fn(self):
      return self._vol_fn
  
    def dtype(self):
      return self._dtype
  
    def name(self):
      return 'simple_ito_process'
  
  mu = np.array([0.2, 0.7])
  s = np.array([[0.3, 0.1], [0.1, 0.3]])
  num_samples = 10000
  dim = 2
  dtype=tf.float64
  
  # Define drift and volatility functions
  def drift_fn(t, x):
    return mu * tf.sqrt(t) * tf.ones([num_samples, dim], dtype=dtype)
  
  def vol_fn(t, x):
    return s * tf.ones([num_samples, dim, dim], dtype=dtype)
  
  # Initialize `SimpleItoProcess`
  process = SimpleItoProcess(dim=2, drift_fn=drift_fn, vol_fn=vol_fn,
                             dtype=dtype)
  # Set starting location
  x0 = np.array([0.1, -1.1])
  # Sample `num_samples` paths at specified `times` locations using built-in
  # Euler scheme.
  times = [0.1, 1.0, 2.0]
  paths = process.sample_paths(
            times,
            num_samples=num_samples,
            initial_state=x0,
            grid_step=0.01,
            seed=42)
  
  #### References
  [1]: Brent Oksendal. Stochastic Differential Equations: An Introduction with
    Applications. Springer. 2010.
docstr: Python callable calculating instantaneous drift.
  
  The callable should accept two real `Tensor` arguments of the same dtype.
  The first argument is the scalar time t, the second argument is the value of
  Ito process X - tensor of shape `batch_shape + [dim]`. The result is value
  of drift a(t, X). The return value of the callable is a real `Tensor` of the
  same dtype as the input arguments and of shape `batch_shape + [dim]`.
docstr_tok: ["Python","callable","calculating","instantaneous","drift",".","The","callable","should","accept","two","real","`","Tensor","`","arguments","of","the","same","dtype",".","The","first","argument","is","the","scalar","time","t",",","the","second","argument","is","the","value","of","Ito","process","X","-","tensor","of","shape","`","batch_shape","+","[","dim","]","`",".","The","result","is","value","of","drift","a","(","t",",","X",")",".","The","return","value","of","the","callable","is","a","real","`","Tensor","`","of","the","same","dtype","as","the","input","arguments","and","of","shape","`","batch_shape","+","[","dim","]","`","."]
code: def drift_fn(self):
      """Python callable calculating instantaneous drift.
  
      The callable should accept two real `Tensor` arguments of the same dtype.
      The first argument is the scalar time t, the second argument is the value of
      Ito process X - tensor of shape `batch_shape + [dim]`. The result is value
      of drift a(t, X). The return value of the callable is a real `Tensor` of the
      same dtype as the input arguments and of shape `batch_shape + [dim]`.
      """
      pass
  
file_path: tf-quant-finance/tf_quant_finance/models/legacy/ito_process.py
imports: import abc
  import six
  import tensorflow.compat.v2
  from tf_quant_finance.math import random_ops
label_desc: Use image node_id 4 for calling the ItoProcess obj's underlying member method code with example usage: obj.drift_fn() without return types