class_docstr: Apply a function to other metrics to obtain a new metric.
  The result of the new metric is defined to be the result
  of applying the function to the result of argument metrics.
  
  When update, this metric recursively updates the metrics
  it depends on. When reset, all its dependency metrics would be
  resetted as well. When attach, all its dependency metrics would be attached
  automatically (but partially, e.g :meth:`~ignite.metrics.metric.Metric.is_attached()` will return False).
  
  Args:
      f: the function that defines the computation
      args: Sequence of other metrics or something
          else that will be fed to ``f`` as arguments.
      kwargs: Sequence of other metrics or something
          else that will be fed to ``f`` as keyword arguments.
  
  Examples:
  
      For more information on how metric works with :class:`~ignite.engine.engine.Engine`, visit :ref:`attach-engine`.
  
      .. include:: defaults.rst
          :start-after: :orphan:
  
      .. testcode::
  
          precision = Precision(average=False)
          recall = Recall(average=False)
  
          def Fbeta(r, p, beta):
              return torch.mean((1 + beta ** 2) * p * r / (beta ** 2 * p + r + 1e-20)).item()
  
          F1 = MetricsLambda(Fbeta, recall, precision, 1)
          F2 = MetricsLambda(Fbeta, recall, precision, 2)
          F3 = MetricsLambda(Fbeta, recall, precision, 3)
          F4 = MetricsLambda(Fbeta, recall, precision, 4)
  
          F1.attach(default_evaluator, "F1")
          F2.attach(default_evaluator, "F2")
          F3.attach(default_evaluator, "F3")
          F4.attach(default_evaluator, "F4")
  
          y_true = torch.tensor([1, 0, 1, 0, 0, 1])
          y_pred = torch.tensor([1, 0, 1, 0, 1, 1])
          state = default_evaluator.run([[y_pred, y_true]])
          print(state.metrics["F1"])
          print(state.metrics["F2"])
          print(state.metrics["F3"])
          print(state.metrics["F4"])
  
      .. testoutput::
  
          0.8571...
          0.9375...
          0.9677...
          0.9807...
  
      When check if the metric is attached, if one of its dependency
      metrics is detached, the metric is considered detached too.
  
      .. code-block:: python
  
          engine = ...
          precision = Precision(average=False)
  
          aP = precision.mean()
  
          aP.attach(engine, "aP")
  
          assert aP.is_attached(engine)
          # partially attached
          assert not precision.is_attached(engine)
  
          precision.detach(engine)
  
          assert not aP.is_attached(engine)
          # fully attached
          assert not precision.is_attached(engine)
class_docstr_tok: ["Apply","a","function","to","other","metrics","to","obtain","a","new","metric",".","The","result","of","the","new","metric","is","defined","to","be","the","result","of","applying","the","function","to","the","result","of","argument","metrics",".","When","update",",","this","metric","recursively","updates","the","metrics","it","depends","on",".","When","reset",",","all","its","dependency","metrics","would","be","resetted","as","well",".","When","attach",",","all","its","dependency","metrics","would","be","attached","automatically","(","but","partially",",","e.g",":","meth",":","`","~ignite.metrics.metric.Metric.is_attached","(",")","`","will","return","False",")",".","Args",":","f",":","the","function","that","defines","the","computation","args",":","Sequence","of","other","metrics","or","something","else","that","will","be","fed","to","``","f","``","as","arguments",".","kwargs",":","Sequence","of","other","metrics","or","something","else","that","will","be","fed","to","``","f","``","as","keyword","arguments",".","Examples",":","For","more","information","on","how","metric","works","with",":","class",":","`","~ignite.engine.engine.Engine","`",",","visit",":","ref",":","`","attach-engine","`",".","..","include",":",":","defaults.rst",":","start-after",":",":","orphan",":","..","testcode",":",":","precision","=","Precision","(","average=False",")","recall","=","Recall","(","average=False",")","def","Fbeta","(","r",",","p",",","beta",")",":","return","torch.mean","(","(","1","+","beta","*","*","2",")","*","p","*","r","\/","(","beta","*","*","2","*","p","+","r","+","1e-20",")",")",".item","(",")","F1","=","MetricsLambda","(","Fbeta",",","recall",",","precision",",","1",")","F2","=","MetricsLambda","(","Fbeta",",","recall",",","precision",",","2",")","F3","=","MetricsLambda","(","Fbeta",",","recall",",","precision",",","3",")","F4","=","MetricsLambda","(","Fbeta",",","recall",",","precision",",","4",")","F1.attach","(","default_evaluator",",","``","F1","''",")","F2.attach","(","default_evaluator",",","``","F2","''",")","F3.attach","(","default_evaluator",",","``","F3","''",")","F4.attach","(","default_evaluator",",","``","F4","''",")","y_true","=","torch.tensor","(","[","1",",","0",",","1",",","0",",","0",",","1","]",")","y_pred","=","torch.tensor","(","[","1",",","0",",","1",",","0",",","1",",","1","]",")","state","=","default_evaluator.run","(","[","[","y_pred",",","y_true","]","]",")","print","(","state.metrics","[","``","F1","''","]",")","print","(","state.metrics","[","``","F2","''","]",")","print","(","state.metrics","[","``","F3","''","]",")","print","(","state.metrics","[","``","F4","''","]",")","..","testoutput",":",":","0.8571","...","0.9375","...","0.9677","...","0.9807","...","When","check","if","the","metric","is","attached",",","if","one","of","its","dependency","metrics","is","detached",",","the","metric","is","considered","detached","too",".","..","code-block",":",":","python","engine","=","...","precision","=","Precision","(","average=False",")","aP","=","precision.mean","(",")","aP.attach","(","engine",",","``","aP","''",")","assert","aP.is_attached","(","engine",")","#","partially","attached","assert","not","precision.is_attached","(","engine",")","precision.detach","(","engine",")","assert","not","aP.is_attached","(","engine",")","#","fully","attached","assert","not","precision.is_attached","(","engine",")"]
code: def is_attached(
      self, engine: Engine, usage: Union[str, MetricUsage] = EpochWise()
  ) -> bool:
      usage = self._check_usage(usage)
      # check recursively the dependencies
      return super(MetricsLambda, self).is_attached(
          engine, usage
      ) and self._internal_is_attached(engine, usage)
  
file_path: ignite/ignite/metrics/metrics_lambda.py
imports: import itertools
  from typing import Any, Callable, Optional, Union
  import torch
  from ignite.engine import Engine
  from ignite.metrics.metric import EpochWise, Metric, MetricUsage, reinit__is_reduced
label_desc: Use image node_id 8 for calling the MetricsLambda obj's underlying member method code with example usage: obj.is_attached(engine, usage) and returns: unknown