code: def _populate_ground_truth(sample_transformations, module):
      """Populates the ground truth values from a module.
  
      Args:
        sample_transformations: A dictionary of Python strings to
          `SampleTransformation`s.
        module: Python module from which to load the ground truth.
  
      Returns:
        sample_transformations: Same as the input `sample_transformations`, but with
          the ground truth values populated.
      """
      sample_transformations = sample_transformations.copy()
      for name, sample_transformation in sample_transformations.items():
          flat_mean = []
          flat_sem = []
          flat_std = []
          flat_sestd = []
          for tuple_path, _ in nest.flatten_with_tuple_paths(
              sample_transformation.dtype
          ):
              (
                  mean,
                  sem,
                  std,
                  sestd,
              ) = ground_truth_encoding.load_ground_truth_part(
                  module, name, tuple_path
              )
              flat_mean.append(mean)
              flat_sem.append(sem)
              flat_std.append(std)
              flat_sestd.append(sestd)
  
          def _pack_or_none(flat_parts):
              if any(part is None for part in flat_parts):
                  return None
              else:
                  return tf.nest.pack_sequence_as(
                      sample_transformation.dtype, flat_parts
                  )  # pylint: disable=cell-var-from-loop
  
          new_transformation = sample_transformation._replace(
              ground_truth_mean=_pack_or_none(flat_mean),
              ground_truth_mean_standard_error=_pack_or_none(flat_sem),
              ground_truth_standard_deviation=_pack_or_none(flat_std),
              ground_truth_standard_deviation_standard_error=_pack_or_none(
                  flat_sestd
              ),
          )
          sample_transformations[name] = new_transformation
      return sample_transformations
  
file_path: probability/spinoffs/inference_gym/inference_gym/targets/model.py
imports: import collections
  import tensorflow.compat.v2
  from inference_gym.internal import ground_truth_encoding
  from tensorflow.python.util import nest
label_desc: Use image node_id 1 for calling a global function with example usage: _populate_ground_truth(sample_transformations, module) and returns: sample_transformations, None, tf