code: def test_sample_features(self) -> None:
      with in_temporary_directory() as temp_dir:
          # Save the data we need to sample from
          indices, features, targets = self.prepare_data(
              split="train",
              layer="heads",
              num_shards=4,
              feat_shape=(10, 16),
          )
  
          # Load the data and verify that it is identical
          output = ExtractedFeaturesLoader.sample_features(
              input_dir=temp_dir,
              split="train",
              layer="heads",
              num_samples=10,
              seed=0,
          )
  
          # Check that the number of samples is valid
          self.assertEqual(10, len(output["inds"]))
  
          # Check that the samples are a subset of the original dataset
          self.assertTrue(
              np.array_equal(
                  output["features"], features[output["inds"]]
              )
          )
          self.assertTrue(
              np.array_equal(output["targets"], targets[output["inds"]])
          )
  
file_path: vissl/tests/test_extract_features_utils.py
imports: import os
  import unittest
  from typing import Tuple
  import numpy
  from vissl.utils.extract_features_utils import ExtractedFeaturesLoader
  from vissl.utils.io import save_file
  from vissl.utils.test_utils import in_temporary_directory
label_desc: Use image node_id 4 for calling the TestExtractFeatureUtils obj's underlying member method code with example usage: obj.test_sample_features() without return types