code: def test_construct_vol_covar_and_scalar_vol(self):
      dtype = np.float64
      vol = tf.constant(0.94, dtype=dtype)
      # Note that the total covariance function we supply is deliberately not
      # the one that is implied by the volatility function.
      np.random.seed(1235)
      dim = 5
      vol_matrix = np.random.randn(dim, dim)
      covar_matrix = np.matmul(vol_matrix, vol_matrix.transpose())
  
      def tc_fn(t1, t2):
          return bm_utils.outer_multiply(t2 - t1, covar_matrix)
  
      times = np.array([[0.12, 0.44], [0.48, 1.698]]).astype(dtype)
      actual_vol_fn, actual_tc_fn = bm_utils.construct_vol_data(
          vol, tc_fn, dim, dtype
      )
      actual_vols = self.evaluate(actual_vol_fn(times))
      np.testing.assert_array_equal(actual_vols.shape, [2, 2, dim, dim])
      for i in range(2):
          for j in range(2):
              np.testing.assert_allclose(
                  actual_vols[i, j], np.eye(dim).astype(dtype) * 0.94
              )
  
      actual_tc = self.evaluate(actual_tc_fn(times, times + 1.0))
      np.testing.assert_array_equal(actual_tc.shape, [2, 2, dim, dim])
      for i in range(2):
          for j in range(2):
              np.testing.assert_allclose(actual_tc[i, j], covar_matrix)
  
imports: import numpy
  import tensorflow.compat.v2
  from tensorflow.python.framework import test_util
  from tf_quant_finance.models.legacy import brownian_motion_utils
label_desc: Use image node_id 9 for calling the BrownianMotionUtilsTest obj's underlying member method code with example usage: obj.test_construct_vol_covar_and_scalar_vol() and returns: bm_utils