class_docstr: Aggregating the input by action, using the given functions. The input is
  assumed to be an `N x D` tensor, where each column is an action, and
  each row is an example. This takes a dictionary of functions so that the
  values only need to be concatenated once.
  
  Example:
  
      agg = FunctionByActionAggregator(
          "model_values", ["A", "B], {"mean": torch.mean, "std": torch.std}
      )
  
      input = torch.tensor([
          [0.9626, 0.7142],
          [0.7216, 0.5426],
          [0.4225, 0.9485],
      ])
      agg(input)
      input2 = torch.tensor([
          [0.0103, 0.0306],
          [0.9846, 0.8373],
          [0.4614, 0.0174],
      ])
      agg(input2)
      print(agg.values)
  
      {
          "mean": {
              "A": [0.7022, 0.4854],
              "B": [0.7351, 0.2951],
          },
          "std": {
              "A": [0.2706, 0.4876],
              "B": [0.2038, 0.4696],
          }
      }
class_docstr_tok: ["Aggregating","the","input","by","action",",","using","the","given","functions",".","The","input","is","assumed","to","be","an","`","N","x","D","`","tensor",",","where","each","column","is","an","action",",","and","each","row","is","an","example",".","This","takes","a","dictionary","of","functions","so","that","the","values","only","need","to","be","concatenated","once",".","Example",":","agg","=","FunctionByActionAggregator","(","``","model_values","''",",","[","``","A","''",",","``","B","]",",","{","``","mean","''",":","torch.mean",",","``","std","''",":","torch.std","}",")","input","=","torch.tensor","(","[","[","0.9626",",","0.7142","]",",","[","0.7216",",","0.5426","]",",","[","0.4225",",","0.9485","]",",","]",")","agg","(","input",")","input2","=","torch.tensor","(","[","[","0.0103",",","0.0306","]",",","[","0.9846",",","0.8373","]",",","[","0.4614",",","0.0174","]",",","]",")","agg","(","input2",")","print","(","agg.values",")","{","``","mean","''",":","{","``","A","''",":","[","0.7022",",","0.4854","]",",","``","B","''",":","[","0.7351",",","0.2951","]",",","}",",","``","std","''",":","{","``","A","''",":","[","0.2706",",","0.4876","]",",","``","B","''",":","[","0.2038",",","0.4696","]",",","}","}"]
code: def aggregate(self, values):
      for name, func in self.fns.items():
          aggregated_values = func(values, dim=0)
          for action, value in zip(self.actions, aggregated_values):
              value = value.item()
  
              self.values[name][action].append(value)
  
          latest_values = {
              action: values[-1]
              for action, values in self.values[name].items()
          }
          logger.info(f"{name} {self.key} {latest_values}")
  
imports: import logging
  from collections import deque
  from typing import Any, Callable, Deque, Dict, List, Optional
  import numpy
  import torch
  from reagent.core.tensorboardX import SummaryWriterContext
  from reagent.core.tracker import Aggregator
label_desc: Use image node_id 2 for calling the FunctionsByActionAggregator obj's underlying member method code with example usage: obj.aggregate(values) without return types