class_docstr: Evaluate losses on data pages
class_docstr_tok: ["Evaluate","losses","on","data","pages"]
code: def evaluate(self, tdp: MemoryNetworkInput) -> Dict[str, float]:
      self.trainer.memory_network.mdnrnn.eval()
      losses = self.trainer.get_loss(tdp, state_dim=self.state_dim)
      detached_losses = {
          "loss": losses["loss"].cpu().detach().item(),
          "gmm": losses["gmm"].cpu().detach().item(),
          "bce": losses["bce"].cpu().detach().item(),
          "mse": losses["mse"].cpu().detach().item(),
      }
      del losses
      self.trainer.memory_network.mdnrnn.train()
      return detached_losses
  
file_path: ReAgent/reagent/evaluation/world_model_evaluator.py
imports: import logging
  from typing import Dict, List
  import torch
  from reagent.core.types import FeatureData, MemoryNetworkInput
  from reagent.training.world_model.mdnrnn_trainer import MDNRNNTrainer
label_desc: Use image node_id 2 for calling the LossEvaluator obj's underlying member method code with example usage: obj.evaluate(tdp) and returns: detached_losses