class_docstr: Multivariate Geometric Brownian Motion.
  
  Represents a d-dimensional Ito process:
  
  ```None
    dX_i(t) = means_i * X_i(t) * dt + volatilities_i * X_i(t) * dW_i(t),
    1 <= i <= d
  ```
  
  where `W(t) = (W_1(t), .., W_d(t))` is a d-dimensional Brownian motion with
  a correlation matrix `corr_matrix`, `means` and `volatilities` are `Tensor`s
  that correspond to mean and volatility of a Geometric Brownian Motion `X_i`
  
  ## Example
  
  ```python
  import tensorflow as tf
  import tf_quant_finance as tff
  corr_matrix = [[1, 0.1], [0.1, 1]]
  process = tff.models.MultivariateGeometricBrownianMotion(
      dim=2,
      means=1, volatilities=[0.1, 0.2],
      corr_matrix=corr_matrix,
      dtype=tf.float64)
  times = [0.1, 0.2, 1.0]
  initial_state=[1.0, 2.0]
  # Use SOBOL sequence to draw trajectories
  samples_sobol = process.sample_paths(
      times=times,
      initial_state=initial_state,
      random_type=tff.math.random.RandomType.SOBOL,
      num_samples=100000)
  
  # You can also supply the random normal draws directly to the sampler
  normal_draws = tf.random.stateless_normal(
      [100000, 3, 2], seed=[4, 2], dtype=tf.float64)
  samples_custom = process.sample_paths(
      times=times,
      initial_state=initial_state,
      normal_draws=normal_draws)
  ```
class_docstr_tok: ["Multivariate","Geometric","Brownian","Motion",".","Represents","a","d-dimensional","Ito","process",":","``","`","None","dX_i","(","t",")","=","means_i","*","X_i","(","t",")","*","dt","+","volatilities_i","*","X_i","(","t",")","*","dW_i","(","t",")",",","1","<","=","i","<","=","d","``","`","where","`","W","(","t",")","=","(","W_1","(","t",")",",","..",",","W_d","(","t",")",")","`","is","a","d-dimensional","Brownian","motion","with","a","correlation","matrix","`","corr_matrix","`",",","`","means","`","and","`","volatilities","`","are","`","Tensor","`","s","that","correspond","to","mean","and","volatility","of","a","Geometric","Brownian","Motion","`","X_i","`","#","#","Example","``","`","python","import","tensorflow","as","tf","import","tf_quant_finance","as","tff","corr_matrix","=","[","[","1",",","0.1","]",",","[","0.1",",","1","]","]","process","=","tff.models.MultivariateGeometricBrownianMotion","(","dim=2",",","means=1",",","volatilities=","[","0.1",",","0.2","]",",","corr_matrix=corr_matrix",",","dtype=tf.float64",")","times","=","[","0.1",",","0.2",",","1.0","]","initial_state=","[","1.0",",","2.0","]","#","Use","SOBOL","sequence","to","draw","trajectories","samples_sobol","=","process.sample_paths","(","times=times",",","initial_state=initial_state",",","random_type=tff.math.random.RandomType.SOBOL",",","num_samples=100000",")","#","You","can","also","supply","the","random","normal","draws","directly","to","the","sampler","normal_draws","=","tf.random.stateless_normal","(","[","100000",",","3",",","2","]",",","seed=","[","4",",","2","]",",","dtype=tf.float64",")","samples_custom","=","process.sample_paths","(","times=times",",","initial_state=initial_state",",","normal_draws=normal_draws",")","``","`"]
docstr: Returns a sample of paths from the process.
  
  Args:
    times: Rank 1 `Tensor` of positive real values. The times at which the
      path points are to be evaluated.
    initial_state: A `Tensor` of the same `dtype` as `times` and of shape
      broadcastable with `[num_samples, dim]`. Represents the initial state of
      the Ito process.
    Default value: `None` which maps to a initial state of ones.
    num_samples: Positive scalar `int`. The number of paths to draw.
    random_type: Enum value of `RandomType`. The type of (quasi)-random
      number generator to use to generate the paths.
      Default value: None which maps to the standard pseudo-random numbers.
    seed: Seed for the random number generator. The seed is
      only relevant if `random_type` is one of
      `[STATELESS, PSEUDO, HALTON_RANDOMIZED, PSEUDO_ANTITHETIC,
        STATELESS_ANTITHETIC]`. For `PSEUDO`, `PSEUDO_ANTITHETIC` and
      `HALTON_RANDOMIZED` the seed should be an Python integer. For
      `STATELESS` and  `STATELESS_ANTITHETIC `must be supplied as an integer
      `Tensor` of shape `[2]`.
      Default value: `None` which means no seed is set.
    skip: `int32` 0-d `Tensor`. The number of initial points of the Sobol or
      Halton sequence to skip. Used only when `random_type` is 'SOBOL',
      'HALTON', or 'HALTON_RANDOMIZED', otherwise ignored.
      Default value: 0.
    normal_draws: A `Tensor` of shape `[num_samples, num_time_points, dim]`
      and the same `dtype` as `times`. Represents random normal draws to
      compute increments `N(0, t_{n+1}) - N(0, t_n)`. When supplied,
      `num_samples` argument is ignored and the first dimensions of
      `normal_draws` is used instead. `num_time_points` should be equal to
      `tf.shape(times)[0]`.
      Default value: `None` which means that the draws are generated by the
      algorithm.
    name: Str. The name to give this op.
      Default value: `sample_paths`.
  
  Returns:
    A `Tensor`s of shape [num_samples, k, dim] where `k` is the size
    of the `times`.
  
  Raises:
    ValueError: If `normal_draws` is supplied and `dim` is mismatched.
docstr_tok: ["Returns","a","sample","of","paths","from","the","process",".","Args",":","times",":","Rank","1","`","Tensor","`","of","positive","real","values",".","The","times","at","which","the","path","points","are","to","be","evaluated",".","initial_state",":","A","`","Tensor","`","of","the","same","`","dtype","`","as","`","times","`","and","of","shape","broadcastable","with","`","[","num_samples",",","dim","]","`",".","Represents","the","initial","state","of","the","Ito","process",".","Default","value",":","`","None","`","which","maps","to","a","initial","state","of","ones",".","num_samples",":","Positive","scalar","`","int","`",".","The","number","of","paths","to","draw",".","random_type",":","Enum","value","of","`","RandomType","`",".","The","type","of","(","quasi",")","-random","number","generator","to","use","to","generate","the","paths",".","Default","value",":","None","which","maps","to","the","standard","pseudo-random","numbers",".","seed",":","Seed","for","the","random","number","generator",".","The","seed","is","only","relevant","if","`","random_type","`","is","one","of","`","[","STATELESS",",","PSEUDO",",","HALTON_RANDOMIZED",",","PSEUDO_ANTITHETIC",",","STATELESS_ANTITHETIC","]","`",".","For","`","PSEUDO","`",",","`","PSEUDO_ANTITHETIC","`","and","`","HALTON_RANDOMIZED","`","the","seed","should","be","an","Python","integer",".","For","`","STATELESS","`","and","`","STATELESS_ANTITHETIC","`","must","be","supplied","as","an","integer","`","Tensor","`","of","shape","`","[","2","]","`",".","Default","value",":","`","None","`","which","means","no","seed","is","set",".","skip",":","`","int32","`","0-d","`","Tensor","`",".","The","number","of","initial","points","of","the","Sobol","or","Halton","sequence","to","skip",".","Used","only","when","`","random_type","`","is","'SOBOL","'",",","'HALTON","'",",","or","'HALTON_RANDOMIZED","'",",","otherwise","ignored",".","Default","value",":","0.","normal_draws",":","A","`","Tensor","`","of","shape","`","[","num_samples",",","num_time_points",",","dim","]","`","and","the","same","`","dtype","`","as","`","times","`",".","Represents","random","normal","draws","to","compute","increments","`","N","(","0",",","t_","{","n+1","}",")","-","N","(","0",",","t_n",")","`",".","When","supplied",",","`","num_samples","`","argument","is","ignored","and","the","first","dimensions","of","`","normal_draws","`","is","used","instead",".","`","num_time_points","`","should","be","equal","to","`","tf.shape","(","times",")","[","0","]","`",".","Default","value",":","`","None","`","which","means","that","the","draws","are","generated","by","the","algorithm",".","name",":","Str",".","The","name","to","give","this","op",".","Default","value",":","`","sample_paths","`",".","Returns",":","A","`","Tensor","`","s","of","shape","[","num_samples",",","k",",","dim","]","where","`","k","`","is","the","size","of","the","`","times","`",".","Raises",":","ValueError",":","If","`","normal_draws","`","is","supplied","and","`","dim","`","is","mismatched","."]
code: def sample_paths(
      self,
      times,
      initial_state=None,
      num_samples=1,
      random_type=None,
      seed=None,
      skip=0,
      normal_draws=None,
      name=None,
  ):
      """Returns a sample of paths from the process.
  
      Args:
        times: Rank 1 `Tensor` of positive real values. The times at which the
          path points are to be evaluated.
        initial_state: A `Tensor` of the same `dtype` as `times` and of shape
          broadcastable with `[num_samples, dim]`. Represents the initial state of
          the Ito process.
        Default value: `None` which maps to a initial state of ones.
        num_samples: Positive scalar `int`. The number of paths to draw.
        random_type: Enum value of `RandomType`. The type of (quasi)-random
          number generator to use to generate the paths.
          Default value: None which maps to the standard pseudo-random numbers.
        seed: Seed for the random number generator. The seed is
          only relevant if `random_type` is one of
          `[STATELESS, PSEUDO, HALTON_RANDOMIZED, PSEUDO_ANTITHETIC,
            STATELESS_ANTITHETIC]`. For `PSEUDO`, `PSEUDO_ANTITHETIC` and
          `HALTON_RANDOMIZED` the seed should be an Python integer. For
          `STATELESS` and  `STATELESS_ANTITHETIC `must be supplied as an integer
          `Tensor` of shape `[2]`.
          Default value: `None` which means no seed is set.
        skip: `int32` 0-d `Tensor`. The number of initial points of the Sobol or
          Halton sequence to skip. Used only when `random_type` is 'SOBOL',
          'HALTON', or 'HALTON_RANDOMIZED', otherwise ignored.
          Default value: 0.
        normal_draws: A `Tensor` of shape `[num_samples, num_time_points, dim]`
          and the same `dtype` as `times`. Represents random normal draws to
          compute increments `N(0, t_{n+1}) - N(0, t_n)`. When supplied,
          `num_samples` argument is ignored and the first dimensions of
          `normal_draws` is used instead. `num_time_points` should be equal to
          `tf.shape(times)[0]`.
          Default value: `None` which means that the draws are generated by the
          algorithm.
        name: Str. The name to give this op.
          Default value: `sample_paths`.
  
      Returns:
        A `Tensor`s of shape [num_samples, k, dim] where `k` is the size
        of the `times`.
  
      Raises:
        ValueError: If `normal_draws` is supplied and `dim` is mismatched.
      """
      name = name or (self._name + "_sample_path")
      with tf.name_scope(name):
          times = tf.convert_to_tensor(times, self._dtype, name="times")
          if normal_draws is not None:
              normal_draws = tf.convert_to_tensor(
                  normal_draws, dtype=self._dtype, name="normal_draws"
              )
          if initial_state is None:
              initial_state = tf.ones(
                  [num_samples, self._dim],
                  dtype=self._dtype,
                  name="initial_state",
              )
          else:
              initial_state = tf.convert_to_tensor(
                  initial_state, dtype=self._dtype, name="initial_state"
              ) + tf.zeros([num_samples, 1], dtype=self._dtype)
          # Shape [num_samples, 1, dim]
          initial_state = tf.expand_dims(initial_state, axis=1)
          num_requested_times = tff_utils.get_shape(times)[0]
          return self._sample_paths(
              times=times,
              num_requested_times=num_requested_times,
              initial_state=initial_state,
              num_samples=num_samples,
              random_type=random_type,
              seed=seed,
              skip=skip,
              normal_draws=normal_draws,
          )
  
file_path: tf-quant-finance/tf_quant_finance/models/geometric_brownian_motion/multivariate_geometric_brownian_motion.py
imports: import tensorflow.compat.v2
  from tf_quant_finance import utils
  from tf_quant_finance.math.pde import fd_solvers
  from tf_quant_finance.models import ito_process
  from tf_quant_finance.models import utils
label_desc: Use image node_id 7 for calling the MultivariateGeometricBrownianMotion obj's underlying member method code with example usage: obj.sample_paths(times, initial_state, num_samples, random_type, seed, skip, normal_draws, name) and returns: self