docstr: Tests that the sample is correctly generated for dynamic shape.
docstr_tok: ["Tests","that","the","sample","is","correctly","generated","for","dynamic","shape","."]
code: def test_dynamic_shapes(self, random_type, seed):
      """Tests that the sample is correctly generated for dynamic shape."""
      mean = np.array([[1.0, 0.1], [0.1, 1.0]])
      covar = np.array(
          [
              [[0.9, -0.1], [-0.1, 1.0]],
              [[1.1, -0.3], [-0.3, 0.6]],
          ]
      )
      size = 30000
  
      @tf.function(
          input_signature=[
              tf.TensorSpec([None], dtype=tf.int32),
              tf.TensorSpec([None, None]),
              tf.TensorSpec([None, None, None]),
          ]
      )
      def sampler(sample_shape, mean, covar):
          return tff_rnd.mv_normal_sample(
              sample_shape,
              mean=mean,
              covariance_matrix=covar,
              random_type=random_type,
              seed=seed,
          )
  
      sample = self.evaluate(sampler([size], mean, covar))
      np.testing.assert_array_equal(sample.shape, [size, 2, 2])
      np.testing.assert_array_almost_equal(
          np.mean(sample, axis=0), mean, decimal=1
      )
      np.testing.assert_array_almost_equal(
          np.cov(sample[:, 0, :], rowvar=False), covar[0], decimal=1
      )
      np.testing.assert_array_almost_equal(
          np.cov(sample[:, 1, :], rowvar=False), covar[1], decimal=1
      )
  
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 5 for calling the RandomTest obj's underlying member method code with example usage: obj.test_dynamic_shapes(random_type, seed) and returns: tff_rnd