class_docstr: This class implements the RecMetricComputation for Segmented NE, i.e. Normalized Entropy - for boolean labels.
  
  Only binary labels are currently supported (0s, 1s), NE is computed for each label, NE across the whole model output
  can be done through the normal NE metric.
  
  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 segmented NE.
class_docstr_tok: ["This","class","implements","the","RecMetricComputation","for","Segmented","NE",",","i.e",".","Normalized","Entropy","-","for","boolean","labels",".","Only","binary","labels","are","currently","supported","(","0s",",","1s",")",",","NE","is","computed","for","each","label",",","NE","across","the","whole","model","output","can","be","done","through","the","normal","NE","metric",".","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","segmented","NE","."]
code: def __init__(
      self,
      *args: Any,
      include_logloss: bool = False,  # TODO - include
      num_groups: int = 1,
      **kwargs: Any,
  ) -> None:
      self._include_logloss: bool = include_logloss
      super().__init__(*args, **kwargs)
      self._num_groups = num_groups  # would there be checkpointing issues with this? maybe make this state
      self._add_state(
          "cross_entropy_sum",
          torch.zeros((self._n_tasks, num_groups), dtype=torch.double),
          add_window_state=False,
          dist_reduce_fx=_state_reduction_sum,
          persistent=True,
      )
      self._add_state(
          "weighted_num_samples",
          torch.zeros((self._n_tasks, num_groups), dtype=torch.double),
          add_window_state=False,
          dist_reduce_fx=_state_reduction_sum,
          persistent=True,
      )
      self._add_state(
          "pos_labels",
          torch.zeros((self._n_tasks, num_groups), dtype=torch.double),
          add_window_state=False,
          dist_reduce_fx=_state_reduction_sum,
          persistent=True,
      )
      self._add_state(
          "neg_labels",
          torch.zeros((self._n_tasks, num_groups), dtype=torch.double),
          add_window_state=False,
          dist_reduce_fx=_state_reduction_sum,
          persistent=True,
      )
      self.eta = 1e-12
  
imports: from typing import Any, Dict, List, Optional, Type
  import torch
  from torch import distributed
  from torchrec.metrics.metrics_config import RecComputeMode, RecTaskInfo
  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 SegmentedNEMetricComputation object from inherited base classes: RecMetricComputation with example: obj = SegmentedNEMetricComputation()