code: def _testNestSampleOuterDims(self, dtype, use_tensor):
      nested_spec = example_nested_tensor_spec(dtype)
      if use_tensor:
          outer_dims = tf.constant([2, 3], dtype=tf.int32)
      else:
          outer_dims = (2, 3)
      sample = tensor_spec.sample_spec_nest(
          nested_spec, outer_dims=outer_dims
      )
      bounded = tensor_spec.BoundedTensorSpec.from_spec(
          nested_spec["spec_1"]
      )
      sample_ = self.evaluate(sample)
      self.assertEqual(
          (2, 3) + tuple(nested_spec["spec_1"].shape.as_list()),
          sample_["spec_1"].shape,
      )
      self.assertTrue(np.all(sample_["spec_1"] >= bounded.minimum))
      self.assertTrue(np.all(sample_["spec_1"] <= bounded.maximum))
  
      bounded_spec_1 = nested_spec["bounded_spec_1"]
      self.assertEqual(
          (2, 3) + tuple(bounded_spec_1.shape.as_list()),
          sample_["bounded_spec_1"].shape,
      )
      self.assertTrue(
          np.all(sample_["bounded_spec_1"] >= bounded_spec_1.minimum)
      )
      self.assertTrue(
          np.all(sample_["bounded_spec_1"] <= bounded_spec_1.maximum)
      )
  
      self.assertIn("spec_2", sample_["dict_spec"])
      tensor_spec_2 = sample_["dict_spec"]["spec_2"]
      self.assertEqual(
          (2, 3)
          + tuple(nested_spec["dict_spec"]["spec_2"].shape.as_list()),
          tensor_spec_2.shape,
      )
      self.assertTrue(np.all(tensor_spec_2 >= bounded.minimum))
      self.assertTrue(np.all(tensor_spec_2 <= bounded.maximum))
      self.assertIn("bounded_spec_2", sample_["dict_spec"])
      sampled_bounded_spec_2 = sample_["dict_spec"]["bounded_spec_2"]
      self.assertEqual(
          (2, 3)
          + tuple(
              nested_spec["dict_spec"]["bounded_spec_2"].shape.as_list()
          ),
          sampled_bounded_spec_2.shape,
      )
      self.assertTrue(np.all(sampled_bounded_spec_2 >= bounded.minimum))
      self.assertTrue(np.all(sampled_bounded_spec_2 <= bounded.maximum))
  
      self.assertIn("tuple_spec", sample_)
      self.assertEqual(
          (2, 3) + tuple(nested_spec["tuple_spec"][0].shape.as_list()),
          sample_["tuple_spec"][0].shape,
      )
      self.assertTrue(
          np.all(sample_["tuple_spec"][0] >= bounded.minimum)
      )
      self.assertTrue(
          np.all(sample_["tuple_spec"][0] <= bounded.maximum)
      )
      tuple_bounded_spec = nested_spec["tuple_spec"][1]
      self.assertEqual(
          (2, 3) + tuple(tuple_bounded_spec.shape.as_list()),
          sample_["tuple_spec"][1].shape,
      )
      self.assertTrue(
          np.all(sample_["tuple_spec"][1] >= tuple_bounded_spec.minimum)
      )
      self.assertTrue(
          np.all(sample_["tuple_spec"][1] <= tuple_bounded_spec.maximum)
      )
  
      self.assertIn("list_spec", sample_)
      self.assertEqual(
          (2, 3) + tuple(nested_spec["list_spec"][0].shape.as_list()),
          sample_["list_spec"][0].shape,
      )
      self.assertTrue(
          np.all(sample_["list_spec"][0] >= bounded.minimum)
      )
      self.assertTrue(
          np.all(sample_["list_spec"][0] <= bounded.maximum)
      )
      self.assertEqual(
          (2, 3)
          + tuple(nested_spec["list_spec"][1][0].shape.as_list()),
          sample_["list_spec"][1][0].shape,
      )
      self.assertTrue(
          np.all(sample_["list_spec"][1][0] >= bounded.minimum)
      )
      self.assertTrue(
          np.all(sample_["list_spec"][1][0] <= bounded.maximum)
      )
      list_bounded_spec = nested_spec["list_spec"][1][1]
      self.assertTrue(
          np.all(
              sample_["list_spec"][1][1] >= list_bounded_spec.minimum
          )
      )
      self.assertTrue(
          np.all(
              sample_["list_spec"][1][1] <= list_bounded_spec.maximum
          )
      )
  
      def _test_batched_shape(sample_, spec_):
          self.assertSequenceEqual(
              sample_.shape, outer_dims + tuple(spec_.shape)
          )
          tf.nest.map_structure(
              _test_batched_shape, sample, nested_spec
          )
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  from absl.testing import parameterized
  import numpy
  import tensorflow
  from tf_agents.specs import array_spec
  from tf_agents.specs import tensor_spec
  from tf_agents.trajectories import time_step
label_desc: Use image node_id 14 for calling the BoundedTensorSpecSampleTest obj's underlying member method code with example usage: obj._testNestSampleOuterDims(dtype, use_tensor) without return types