code: def _get_loader_loss(
      self, loader, optimizer=None, scheduler=None, mode="train"
  ):
      epoch_loss = 0.0
      last_loss = 0.0
      if mode == "train":
          for data in loader:
              optimizer.zero_grad()
              if None in self.views_fn:
                  # For view fn that returns multiple views
                  views = []
                  for v_fn in self.views_fn:
                      if v_fn is not None:
                          views += [*v_fn(data)]
              else:
                  views = [v_fn(data) for v_fn in self.views_fn]
              zs = []
              for view in views:
                  z = self._get_embed(view.to(self.device))
                  zs.append(
                      self.decoder.decoder(z, view.to(self.device))
                  )
              loss = self.loss(zs, tau=self.tau)
              loss.backward()
              optimizer.step()
              if self.p_lr_scheduler_type:
                  scheduler.step()
              epoch_loss += loss.item()
              last_loss = loss.item()
      else:
          for data in loader:
              if None in self.views_fn:
                  # For view fn that returns multiple views
                  views = []
                  for v_fn in self.views_fn:
                      if v_fn is not None:
                          views += [*v_fn(data)]
              else:
                  views = [v_fn(data) for v_fn in self.views_fn]
              zs = []
              for view in views:
                  z = self._get_embed(view.to(self.device))
                  zs.append(
                      self.decoder.decoder(z, view.to(self.device))
                  )
              loss = self.loss(zs, tau=self.tau)
              epoch_loss += loss.item()
              last_loss = loss.item()
      return epoch_loss, last_loss
  
imports: import os
  import torch
  import torch_geometric
  import logging
  import numpy
  import typing
  from tqdm import trange
  from typing import Union, Tuple, Sequence, Type, Callable
  import torch.nn.functional
  import torch.utils.data
  from torch.optim.lr_scheduler import StepLR, MultiStepLR, ExponentialLR, ReduceLROnPlateau
  from .losses import NTXent_loss
  from .utils import get_view_by_name
  from autogl.module.model.encoders.base_encoder import AutoHomogeneousEncoderMaintainer
  from ..base import BaseTrainer, EarlyStopping, _DummyModel
  from ..evaluation import Evaluation, get_feval, Acc
  from ...model import BaseAutoModel, BaseEncoderMaintainer, BaseDecoderMaintainer, EncoderUniversalRegistry, DecoderUniversalRegistry
  from ....utils import get_logger
  from ....datasets import utils
label_desc: Use image node_id 23 for calling the BaseContrastiveTrainer obj's underlying member method code with example usage: obj._get_loader_loss(loader, optimizer, scheduler, mode) and returns: epoch_loss,  last_loss