class_docstr: Few-shot learning is an important scenario for prompt-learning, this is a sampler that samples few examples over each class.
  
  Args:
      num_examples_total(:obj:`int`, optional): Sampling strategy ``I``: Use total number of examples for few-shot sampling.
      num_examples_per_label(:obj:`int`, optional): Sampling strategy ``II``: Use the number of examples for each label for few-shot sampling.
      also_sample_dev(:obj:`bool`, optional): Whether to apply the sampler to the dev data.
      num_examples_total_dev(:obj:`int`, optional): Sampling strategy ``I``: Use total number of examples for few-shot sampling.
      num_examples_per_label_dev(:obj:`int`, optional): Sampling strategy ``II``: Use the number of examples for each label for few-shot sampling.
class_docstr_tok: ["Few-shot","learning","is","an","important","scenario","for","prompt-learning",",","this","is","a","sampler","that","samples","few","examples","over","each","class",".","Args",":","num_examples_total","(",":","obj",":","`","int","`",",","optional",")",":","Sampling","strategy","``","I","``",":","Use","total","number","of","examples","for","few-shot","sampling",".","num_examples_per_label","(",":","obj",":","`","int","`",",","optional",")",":","Sampling","strategy","``","II","``",":","Use","the","number","of","examples","for","each","label","for","few-shot","sampling",".","also_sample_dev","(",":","obj",":","`","bool","`",",","optional",")",":","Whether","to","apply","the","sampler","to","the","dev","data",".","num_examples_total_dev","(",":","obj",":","`","int","`",",","optional",")",":","Sampling","strategy","``","I","``",":","Use","total","number","of","examples","for","few-shot","sampling",".","num_examples_per_label_dev","(",":","obj",":","`","int","`",",","optional",")",":","Sampling","strategy","``","II","``",":","Use","the","number","of","examples","for","each","label","for","few-shot","sampling","."]
docstr: Use the total number of examples for few-shot sampling (Strategy ``I``).
  
  Args:
      indices(:obj:`List`): The random indices of the whole datasets.
      num_examples_total(:obj:`int`): The total number of examples.
  
  Returns:
      :obj:`List`: The selected indices with the size of ``num_examples_total``.
docstr_tok: ["Use","the","total","number","of","examples","for","few-shot","sampling","(","Strategy","``","I","``",")",".","Args",":","indices","(",":","obj",":","`","List","`",")",":","The","random","indices","of","the","whole","datasets",".","num_examples_total","(",":","obj",":","`","int","`",")",":","The","total","number","of","examples",".","Returns",":",":","obj",":","`","List","`",":","The","selected","indices","with","the","size","of","``","num_examples_total","``","."]
code: def sample_total(self, indices: List, num_examples_total):
      """
      Use the total number of examples for few-shot sampling (Strategy ``I``).
  
      Args:
          indices(:obj:`List`): The random indices of the whole datasets.
          num_examples_total(:obj:`int`): The total number of examples.
  
      Returns:
          :obj:`List`: The selected indices with the size of ``num_examples_total``.
  
      """
      self.rng.shuffle(indices)
      selected_ids = indices[:num_examples_total]
      logger.info("Selected examples (mixed) {}".format(selected_ids))
      return selected_ids
  
file_path: OpenPrompt/openprompt/data_utils/data_sampler.py
imports: from collections import defaultdict, namedtuple
  from typing import *
  import numpy
  from torch.utils.data import Dataset
  from torch.utils.data.dataset import Subset
  from openprompt.utils.logging import logger
  from typing import Union
label_desc: Use image node_id 4 for calling the FewShotSampler obj's underlying member method code with example usage: obj.sample_total(indices, num_examples_total) and returns: selected_ids