code: def _eval(
      train_pipeline: TrainPipelineSparseDist, it: Iterator[Batch]
  ) -> Tuple[float, float, float]:
      train_pipeline._model.eval()
  
      device = train_pipeline._device
      auroc = metrics.AUROC(compute_on_step=False).to(device)
      accuracy = metrics.Accuracy(compute_on_step=False).to(device)
      val_losses = []
      step = 0
      with torch.no_grad():
          while True:
              try:
                  loss, logits, labels = train_pipeline.progress(it)
                  val_losses.append(loss)
                  preds = torch.sigmoid(logits)
  
                  labels = labels.to(torch.int32)
                  auroc(preds, labels)
                  accuracy(preds, labels)
                  step += 1
              except StopIteration:
                  break
      auroc_result = auroc.compute().item()
      accuracy_result = accuracy.compute().item()
      bce_loss = torch.mean(torch.stack(val_losses))
      return (auroc_result, accuracy_result, bce_loss)
  
imports: import argparse
  import os
  import sys
  import time
  from typing import cast, Iterator, List, Tuple
  import torch
  import torch.distributed
  import torch.nn
  import torchmetrics
  import torchrec
  import torchrec.distributed
  import torchrec.optim
  from nvt_binary_dataloader import NvtBinaryDataloader
  from pyre_extensions import none_throws
  from torchrec import EmbeddingBagCollection
  from torchrec.datasets.criteo import DEFAULT_CAT_NAMES, DEFAULT_INT_NAMES, TOTAL_TRAINING_SAMPLES
  from torchrec.datasets.utils import Batch
  from torchrec.distributed import TrainPipelineSparseDist
  from torchrec.distributed.fused_embeddingbag import FusedEmbeddingBagCollectionSharder
  from torchrec.distributed.model_parallel import DistributedModelParallel
  from torchrec.distributed.types import ModuleSharder
  from torchrec.metrics.throughput import ThroughputMetric
  from torchrec.models.dlrm import DLRM, DLRMTrain
  from torchrec.modules.embedding_configs import EmbeddingBagConfig
  from torchrec.modules.fused_embedding_modules import fuse_embedding_optimizer
  from torchrec.optim.keyed import KeyedOptimizerWrapper
  from torchrec.optim.optimizers import in_backward_optimizer_filter
label_desc: Use image node_id 2 for calling a global function with example usage: _eval(train_pipeline, it) and returns: auroc_result,  accuracy_result,  bce_loss