class_docstr: Simple agent that counts the number of unique things it has seen.
  
  Could be simpler, but we make it a TorchAgent so it's happy with dynamic batching.
class_docstr_tok: ["Simple","agent","that","counts","the","number","of","unique","things","it","has","seen",".","Could","be","simpler",",","but","we","make","it","a","TorchAgent","so","it","'s","happy","with","dynamic","batching","."]
docstr: Pull out a singleton value if provided a list.
docstr_tok: ["Pull","out","a","singleton","value","if","provided","a","list","."]
code: def _val(self, val):
      """
      Pull out a singleton value if provided a list.
      """
      # necessary for labels
      if isinstance(val, (tuple, list)):
          return val[0]
      else:
          return val
  
imports: from __future__ import annotations
  from typing import Tuple
  from collections import Counter
  from parlai.core.torch_agent import TorchAgent
  from parlai.core.metrics import Metric, SumMetric
  from parlai.core.message import Message
label_desc: Use image node_id 5 for calling the CounterAgent obj's underlying member method code with example usage: obj._val(val) and returns: val, val