class_docstr: Single variable accumulator helper to compute (arithmetic, geometric, harmonic) average of a single variable.
  
  - ``update`` must receive output of the form `x`.
  - `x` can be a number or `torch.Tensor`.
  
  Note:
  
      The class stores input into two public variables: `accumulator` and `num_examples`.
      Number of samples is updated following the rule:
  
      - `+1` if input is a number
      - `+1` if input is a 1D `torch.Tensor`
      - `+batch_size` if input is a ND `torch.Tensor`. Batch size is the first dimension (`shape[0]`).
  
  Args:
      op: a callable to update accumulator. Method's signature is `(accumulator, output)`.
          For example, to compute arithmetic mean value, `op = lambda a, x: a + x`.
      output_transform: a callable that is used to transform the
          :class:`~ignite.engine.engine.Engine`'s ``process_function``'s output into the
          form expected by the metric. This can be useful if, for example, you have a multi-output model and
          you want to compute the metric with respect to one of the outputs.
      device: specifies which device updates are accumulated on. Setting the metric's
          device to be the same as your ``update`` arguments ensures the ``update`` method is non-blocking. By
          default, CPU.
class_docstr_tok: ["Single","variable","accumulator","helper","to","compute","(","arithmetic",",","geometric",",","harmonic",")","average","of","a","single","variable",".","-","``","update","``","must","receive","output","of","the","form","`","x","`",".","-","`","x","`","can","be","a","number","or","`","torch.Tensor","`",".","Note",":","The","class","stores","input","into","two","public","variables",":","`","accumulator","`","and","`","num_examples","`",".","Number","of","samples","is","updated","following","the","rule",":","-","`","+1","`","if","input","is","a","number","-","`","+1","`","if","input","is","a","1D","`","torch.Tensor","`","-","`","+batch_size","`","if","input","is","a","ND","`","torch.Tensor","`",".","Batch","size","is","the","first","dimension","(","`","shape","[","0","]","`",")",".","Args",":","op",":","a","callable","to","update","accumulator",".","Method","'s","signature","is","`","(","accumulator",",","output",")","`",".","For","example",",","to","compute","arithmetic","mean","value",",","`","op","=","lambda","a",",","x",":","a","+","x","`",".","output_transform",":","a","callable","that","is","used","to","transform","the",":","class",":","`","~ignite.engine.engine.Engine","`","'s","``","process_function","``","'s","output","into","the","form","expected","by","the","metric",".","This","can","be","useful","if",",","for","example",",","you","have","a","multi-output","model","and","you","want","to","compute","the","metric","with","respect","to","one","of","the","outputs",".","device",":","specifies","which","device","updates","are","accumulated","on",".","Setting","the","metric's","device","to","be","the","same","as","your","``","update","``","arguments","ensures","the","``","update","``","method","is","non-blocking",".","By","default",",","CPU","."]
code: def compute(self) -> Tuple[torch.Tensor, int]:
      return self.accumulator, self.num_examples
  
file_path: ignite/ignite/metrics/accumulation.py
imports: import numbers
  from typing import Callable, Tuple, Union
  import torch
  from ignite.exceptions import NotComputableError
  from ignite.metrics.metric import Metric, reinit__is_reduced, sync_all_reduce
label_desc: Use image node_id 5 for calling the VariableAccumulation obj's underlying member method code with example usage: obj.compute() and returns: self,  self