class_docstr: The user-facing class that provides metric storage functionalities.
  
  In the future we may add support for storing / logging other types of data if needed.
docstr: Return the number of samples logged in the past `window_size` iterations.
docstr_tok: ["Return","the","number","of","samples","logged","in","the","past","`","window_size","`","iterations","."]
code: def count_samples(self, name, window_size=20):
      """
      Return the number of samples logged in the past `window_size` iterations.
      """
      samples = 0
      data = self._history[name].values()
      for _, iter_ in reversed(data):
          if iter_ > data[-1][1] - window_size:
              samples += 1
          else:
              break
      return samples
  
imports: import datetime
  import json
  import logging
  import os
  import time
  from collections import defaultdict
  from contextlib import contextmanager
  from functools import cached_property
  from typing import Optional
  import torch
  from fvcore.common.history_buffer import HistoryBuffer
  from detectron2.utils.file_io import PathManager
label_desc: Use image node_id 10 for calling the EventStorage obj's underlying member method code with example usage: obj.count_samples(name, window_size) and returns: samples