class_docstr: Local volatility model for smile modeling.
  
  Local volatility (LV) model specifies that the dynamics of an asset is
  governed by the following stochastic differential equation:
  
  ```None
    dS(t) / S(t) =  mu(t, S(t)) dt + sigma(t, S(t)) * dW(t)
  ```
  where `mu(t, S(t))` is the drift and `sigma(t, S(t))` is the instantaneous
  volatility. The local volatility function `sigma(t, S(t))` is state dependent
  and is computed by calibrating against a given implied volatility surface
  `sigma_iv(T, K)` using the Dupire's formula [1]:
  
  ```
  sigma(T,K)^2 = 2 * (dC(T,K)/dT + (r - q)K dC(T,K)/dK + qC(T,K)) /
                     (K^2 d2C(T,K)/dK2)
  ```
  where the derivatives above are the partial derivatives. The LV model provides
  a flexible framework to model any (arbitrage free) volatility surface.
  
  #### Example: Simulation of local volatility process.
  
  ```python
  import numpy as np
  import tensorflow.compat.v2 as tf
  import tf_quant_finance as tff
  
  dtype = tf.float64
  dim = 2
  year = dim * [[2021, 2022]]
  month = dim * [[1, 1]]
  day = dim * [[1, 1]]
  expiries = tff.datetime.dates_from_year_month_day(year, month, day)
  valuation_date = [(2020, 1, 1)]
  expiry_times = tff.datetime.daycount_actual_365_fixed(
      start_date=valuation_date, end_date=expiries, dtype=dtype)
  strikes = dim * [[[0.1, 0.9, 1.0, 1.1, 3], [0.1, 0.9, 1.0, 1.1, 3]]]
  iv = dim * [[[0.135, 0.13, 0.1, 0.11, 0.13],
               [0.135, 0.13, 0.1, 0.11, 0.13]]]
  spot = dim * [1.0]
  risk_free_rate = [0.02]
  r = tf.convert_to_tensor(risk_free_rate, dtype=dtype)
  df = lambda t: tf.math.exp(-r * t)
  
  lv = tff.models.LocalVolatilityModel.from_market_data(
      dim, val_date, expiries, strikes, iv, spot, df, [0.0], dtype=dtype)
  num_samples = 10000
  paths = lv.sample_paths(
      [1.0, 1.5, 2.0],
      num_samples=num_samples,
      initial_state=spot,
      time_step=0.1,
      random_type=tff.math.random.RandomType.STATELESS_ANTITHETIC,
      seed=[1, 2])
  # paths.shape = (10000, 3, 2)
  
  #### References:
    [1]: Iain J. Clark. Foreign exchange option pricing - A Practitioner's
    guide. Chapter 5, Section 5.3.2. 2011.
docstr: Returns samples from the LV process.
  
  See GenericItoProcess.sample_paths. If `times_grid` is supplied to
  `__init__`, then `times_grid` cannot be supplied here.
  
  Raises:
    ValueError: If `precompute_iv` is True, but `time_step`, `num_time_steps`
      or `times_grid` are given.
docstr_tok: ["Returns","samples","from","the","LV","process",".","See","GenericItoProcess.sample_paths",".","If","`","times_grid","`","is","supplied","to","`","__init__","`",",","then","`","times_grid","`","can","not","be","supplied","here",".","Raises",":","ValueError",":","If","`","precompute_iv","`","is","True",",","but","`","time_step","`",",","`","num_time_steps","`","or","`","times_grid","`","are","given","."]
code: def sample_paths(
      self,
      times: types.RealTensor,
      num_samples: Optional[int] = 1,
      initial_state: Optional[types.RealTensor] = None,
      random_type: Optional[random.RandomType] = None,
      seed: Optional[types.IntTensor] = None,
      swap_memory: Optional[bool] = True,
      time_step: Optional[types.RealTensor] = None,
      num_time_steps: Optional[types.IntTensor] = None,
      skip: Optional[types.IntTensor] = 0,
      precompute_normal_draws: Optional[bool] = True,
      times_grid: Optional[types.RealTensor] = None,
      normal_draws: Optional[types.RealTensor] = None,
      watch_params: Optional[List[types.RealTensor]] = None,
      validate_args: Optional[bool] = False,
      name: Optional[str] = None,
  ) -> types.RealTensor:  # pylint: disable=g-doc-args
      """Returns samples from the LV process.
  
      See GenericItoProcess.sample_paths. If `times_grid` is supplied to
      `__init__`, then `times_grid` cannot be supplied here.
  
      Raises:
        ValueError: If `precompute_iv` is True, but `time_step`, `num_time_steps`
          or `times_grid` are given.
      """
      name = name or (self._name + "_log_sample_path")
      with tf.name_scope(name):
          if initial_state is not None:
              initial_state = tf.math.log(
                  tf.convert_to_tensor(
                      initial_state, dtype_hint=tf.float64
                  )
              )
          if self.precompute_iv():
              if (
                  time_step is not None
                  or num_time_steps is not None
                  or times_grid is not None
              ):
                  raise ValueError(
                      "`time_step`, `num_time_steps`, or `times_grid` cannot be used"
                      "with the interpolated LVM"
                  )
              times_grid = self._times_grid
          return tf.math.exp(
              super(LocalVolatilityModel, self).sample_paths(
                  times=times,
                  num_samples=num_samples,
                  initial_state=initial_state,
                  random_type=random_type,
                  seed=seed,
                  swap_memory=swap_memory,
                  name=name,
                  time_step=time_step,
                  num_time_steps=num_time_steps,
                  skip=skip,
                  precompute_normal_draws=precompute_normal_draws,
                  times_grid=times_grid,
                  normal_draws=normal_draws,
                  watch_params=watch_params,
                  validate_args=validate_args,
              )
          )
  
imports: import functools
  from typing import Any, Callable, List, Optional, Union
  import tensorflow.compat.v2
  from tf_quant_finance import black_scholes
  from tf_quant_finance import datetime
  from tf_quant_finance import math
  from tf_quant_finance import types
  from tf_quant_finance.experimental.pricing_platform.framework.market_data import volatility_surface
  from tf_quant_finance.math import interpolation
  from tf_quant_finance.math import piecewise
  from tf_quant_finance.math import random
  from tf_quant_finance.models import generic_ito_process
label_desc: Use image node_id 4 for calling the LocalVolatilityModel obj's underlying member method code with example usage: obj.sample_paths(times, num_samples, initial_state, random_type, seed, swap_memory, time_step, num_time_steps, skip, precompute_normal_draws, times_grid, normal_draws, watch_params, validate_args, name) and returns: tf