code: def compute_ne(
      ce_sum: torch.Tensor,
      weighted_num_samples: torch.Tensor,
      pos_labels: torch.Tensor,
      neg_labels: torch.Tensor,
      num_groups: int,
      eta: float,
  ) -> torch.Tensor:
      # size should be (num_groups)
      result_ne = torch.zeros(num_groups)
      for group in range(num_groups):
          mean_label = pos_labels[group] / weighted_num_samples[group]
          ce_norm = _compute_cross_entropy_norm(
              mean_label, pos_labels[group], neg_labels[group], eta
          )
          ne = ce_sum[group] / ce_norm
          result_ne[group] = ne
  
      # ne indexed by group - tensor size (num_groups)
      return result_ne
  
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 5 for calling a global function with example usage: compute_ne(ce_sum, weighted_num_samples, pos_labels, neg_labels, num_groups, eta) and returns: result_ne