class_docstr: Aggregate a stream of value into their mean value.
  
  As input to ``forward`` and ``update`` the metric accepts the following input
  
  - ``value`` (:class:`~float` or :class:`~torch.Tensor`): a single float or an tensor of float values with
    arbitrary shape ``(...,)``.
  - ``weight`` (:class:`~float` or :class:`~torch.Tensor`): a single float or an tensor of float value with
    arbitrary shape ``(...,)``. Needs to be broadcastable with the shape of ``value`` tensor.
  
  As output of `forward` and `compute` the metric returns the following output
  
  - ``agg`` (:class:`~torch.Tensor`): scalar float tensor with aggregated (weighted) mean over all inputs received
  
  Args:
     nan_strategy: options:
          - ``'error'``: if any `nan` values are encountered will give a RuntimeError
          - ``'warn'``: if any `nan` values are encountered will give a warning and continue
          - ``'ignore'``: all `nan` values are silently removed
          - a float: if a float is provided will impute any `nan` values with this value
  
      kwargs: Additional keyword arguments, see :ref:`Metric kwargs` for more info.
  
  Raises:
      ValueError:
          If ``nan_strategy`` is not one of ``error``, ``warn``, ``ignore`` or a float
  
  Example:
      >>> from torchmetrics.aggregation import MeanMetric
      >>> metric = MeanMetric()
      >>> metric.update(1)
      >>> metric.update(torch.tensor([2, 3]))
      >>> metric.compute()
      tensor(2.)
class_docstr_tok: ["Aggregate","a","stream","of","value","into","their","mean","value",".","As","input","to","``","forward","``","and","``","update","``","the","metric","accepts","the","following","input","-","``","value","``","(",":","class",":","`","~float","`","or",":","class",":","`","~torch.Tensor","`",")",":","a","single","float","or","an","tensor","of","float","values","with","arbitrary","shape","``","(","...",",",")","``",".","-","``","weight","``","(",":","class",":","`","~float","`","or",":","class",":","`","~torch.Tensor","`",")",":","a","single","float","or","an","tensor","of","float","value","with","arbitrary","shape","``","(","...",",",")","``",".","Needs","to","be","broadcastable","with","the","shape","of","``","value","``","tensor",".","As","output","of","`","forward","`","and","`","compute","`","the","metric","returns","the","following","output","-","``","agg","``","(",":","class",":","`","~torch.Tensor","`",")",":","scalar","float","tensor","with","aggregated","(","weighted",")","mean","over","all","inputs","received","Args",":","nan_strategy",":","options",":","-","``","'error","'","``",":","if","any","`","nan","`","values","are","encountered","will","give","a","RuntimeError","-","``","'warn","'","``",":","if","any","`","nan","`","values","are","encountered","will","give","a","warning","and","continue","-","``","'ignore","'","``",":","all","`","nan","`","values","are","silently","removed","-","a","float",":","if","a","float","is","provided","will","impute","any","`","nan","`","values","with","this","value","kwargs",":","Additional","keyword","arguments",",","see",":","ref",":","`","Metric","kwargs","`","for","more","info",".","Raises",":","ValueError",":","If","``","nan_strategy","``","is","not","one","of","``","error","``",",","``","warn","``",",","``","ignore","``","or","a","float","Example",":",">",">",">","from","torchmetrics.aggregation","import","MeanMetric",">",">",">","metric","=","MeanMetric","(",")",">",">",">","metric.update","(","1",")",">",">",">","metric.update","(","torch.tensor","(","[","2",",","3","]",")",")",">",">",">","metric.compute","(",")","tensor","(","2",".",")"]
docstr: Update state with data.
  
  Args:
      value: Either a float or tensor containing data. Additional tensor
          dimensions will be flattened
      weight: Either a float or tensor containing weights for calculating
          the average. Shape of weight should be able to broadcast with
          the shape of `value`. Default to `1.0` corresponding to simple
          harmonic average.
docstr_tok: ["Update","state","with","data",".","Args",":","value",":","Either","a","float","or","tensor","containing","data",".","Additional","tensor","dimensions","will","be","flattened","weight",":","Either","a","float","or","tensor","containing","weights","for","calculating","the","average",".","Shape","of","weight","should","be","able","to","broadcast","with","the","shape","of","`","value","`",".","Default","to","`","1.0","`","corresponding","to","simple","harmonic","average","."]
code: def update(
      self,
      value: Union[float, Tensor],
      weight: Union[float, Tensor] = 1.0,
  ) -> None:
      """Update state with data.
  
      Args:
          value: Either a float or tensor containing data. Additional tensor
              dimensions will be flattened
          weight: Either a float or tensor containing weights for calculating
              the average. Shape of weight should be able to broadcast with
              the shape of `value`. Default to `1.0` corresponding to simple
              harmonic average.
  
      """
      # broadcast weight to value shape
      if not isinstance(value, Tensor):
          value = torch.as_tensor(
              value, dtype=torch.float32, device=self.device
          )
      if weight is not None and not isinstance(weight, Tensor):
          weight = torch.as_tensor(
              weight, dtype=torch.float32, device=self.device
          )
      weight = torch.broadcast_to(weight, value.shape)
      value, weight = self._cast_and_nan_check_input(value, weight)
  
      if value.numel() == 0:
          return
      self.mean_value += (value * weight).sum()
      self.weight += weight.sum()
  
imports: from typing import Any, Callable, List, Optional, Sequence, Tuple, Union
  import torch
  from torch import Tensor
  from torchmetrics.metric import Metric
  from torchmetrics.utilities import rank_zero_warn
  from torchmetrics.utilities.data import dim_zero_cat
  from torchmetrics.utilities.imports import _MATPLOTLIB_AVAILABLE
  from torchmetrics.utilities.plot import _AX_TYPE, _PLOT_OUT_TYPE
  from torchmetrics.wrappers.running import Running
label_desc: Use image node_id 2 for calling the MeanMetric obj's underlying member method code with example usage: obj.update(value, weight) without return types