docstr: Utility that extends it to the same length as the .groups, ensuring it is a list
docstr_tok: ["Utility","that","extends","it","to","the","same","length","as","the",".groups",",","ensuring","it","is","a","list"]
code: def _make_sure_a_list(self, var):
      r"""Utility that extends it to the same length as the .groups, ensuring it is a list"""
      n = len(self.sparsifier.groups)
      if not isinstance(var, (list, tuple)):
          return [var] * n
      else:
          if len(var) != n:
              raise ValueError(
                  f"Expected variable of length {n}, but got {len(var)}"
              )
          return list(var)
  
file_path: pytorch/torch/ao/pruning/scheduler/base_scheduler.py
imports: from torch.ao.pruning import BaseSparsifier
  from functools import wraps
  import warnings
  import weakref
label_desc: Use image node_id 9 for calling the BaseScheduler obj's underlying member method code with example usage: obj._make_sure_a_list(var) and returns: unknown, list