docstr: Error is raised if `dim` is mismatched with the one from normal_draws.
docstr_tok: ["Error","is","raised","if","`","dim","`","is","mismatched","with","the","one","from","normal_draws","."]
code: def test_sample_shape_mismatch(self):
      """Error is raised if `dim` is mismatched with the one from normal_draws."""
      dtype = tf.float64
  
      def drift_fn(_, x):
          return tf.zeros_like(x)
  
      def vol_fn(_, x):
          return tf.expand_dims(tf.ones_like(x), -1)
  
      with self.subTest("WrongTimes"):
          with self.assertRaises(tf.errors.InvalidArgumentError):
              self.evaluate(
                  euler_sampling.sample(
                      dim=1,
                      drift_fn=drift_fn,
                      volatility_fn=vol_fn,
                      times=[0.1, 0.5, 2.0, 1.0],
                      time_step=0.01,
                      seed=42,
                      validate_args=True,
                      dtype=dtype,
                  )
              )
  
      with self.subTest("WrongTimesGrid"):
          with self.assertRaises(tf.errors.InvalidArgumentError):
              times_grid = [0.1, 0.5, 1.0, 1.0]
              self.evaluate(
                  euler_sampling.sample(
                      dim=1,
                      drift_fn=drift_fn,
                      volatility_fn=vol_fn,
                      times=[0.1, 0.5, 1.0],
                      times_grid=times_grid,
                      seed=42,
                      validate_args=True,
                      dtype=dtype,
                  )
              )
  
file_path: tf-quant-finance/tf_quant_finance/models/euler_sampling_test.py
imports: from absl.testing import parameterized
  import numpy
  import tensorflow.compat.v2
  import tf_quant_finance
  from tensorflow.python.framework import test_util
label_desc: Use image node_id 9 for calling the EulerSamplingTest obj's underlying member method code with example usage: obj.test_sample_shape_mismatch() and returns: tf, tf