docstr: Tests realized volatility works with non default axis.
docstr_tok: ["Tests","realized","volatility","works","with","non","default","axis","."]
code: def test_non_default_axis(self, returns_type):
      """Tests realized volatility works with non default axis."""
      dtype = tf.float64
      num_series = 200
      num_times = 100
      seed = (1, 2)
      draws = tf.random.stateless_normal(
          (num_series, num_times), seed=seed, dtype=dtype
      )
      sample_paths = tf.math.exp(tf.math.cumsum(draws, axis=-1))
  
      volatilities = tff.models.realized_volatility(
          tf.transpose(sample_paths), returns_type=returns_type, axis=0
      )
  
      if returns_type == tff.models.ReturnsType.ABS:
          diffs = tf.math.abs(
              tff.math.diff(sample_paths, exclusive=True)
          )
          expected_volatilities = tf.reduce_sum(
              diffs / sample_paths[:, :-1], axis=1
          )
      elif returns_type == tff.models.ReturnsType.LOG:
          expected_volatilities = tf.math.sqrt(
              tf.math.reduce_sum(draws[:, 1:] ** 2, axis=1)
          )
  
      self.assertAllClose(volatilities, expected_volatilities, 1e-6)
  
file_path: tf-quant-finance/tf_quant_finance/models/realized_volatility_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 RealizedVolatilityTest obj's underlying member method code with example usage: obj.test_non_default_axis(returns_type) without return types