class_docstr: This class implements the RecMetricComputation for NE, i.e. Normalized Entropy.
  
  The constructor arguments are defined in RecMetricComputation.
  See the docstring of RecMetricComputation for more detail.
  
  Args:
      include_logloss (bool): return vanilla logloss as one of metrics results, on top of NE.
code: def __init__(
      self,
      *args: Any,
      include_logloss: bool = False,
      allow_missing_label_with_zero_weight: bool = False,
      **kwargs: Any,
  ) -> None:
      self._include_logloss: bool = include_logloss
      self._allow_missing_label_with_zero_weight: bool = (
          allow_missing_label_with_zero_weight
      )
      super().__init__(*args, **kwargs)
      self._add_state(
          "cross_entropy_sum",
          torch.zeros(self._n_tasks, dtype=torch.double),
          add_window_state=True,
          dist_reduce_fx="sum",
          persistent=True,
      )
      self._add_state(
          "weighted_num_samples",
          torch.zeros(self._n_tasks, dtype=torch.double),
          add_window_state=True,
          dist_reduce_fx="sum",
          persistent=True,
      )
      self._add_state(
          "pos_labels",
          torch.zeros(self._n_tasks, dtype=torch.double),
          add_window_state=True,
          dist_reduce_fx="sum",
          persistent=True,
      )
      self._add_state(
          "neg_labels",
          torch.zeros(self._n_tasks, dtype=torch.double),
          add_window_state=True,
          dist_reduce_fx="sum",
          persistent=True,
      )
      self.eta = 1e-12
  
file_path: torchrec/torchrec/metrics/ne.py
imports: from typing import Any, cast, Dict, List, Optional, Type
  import torch
  from torchrec.metrics.metrics_namespace import MetricName, MetricNamespace, MetricPrefix
  from torchrec.metrics.rec_metric import MetricComputationReport, RecMetric, RecMetricComputation, RecMetricException
label_desc: Use image node_id 1 to create a new NEMetricComputation object from inherited base classes: RecMetricComputation with example: obj = NEMetricComputation()