code: def loss_coteaching(
      y_1,
      y_2,
      t,
      forget_rate,
      class_weights=None,
  ):
      """Co-Teaching Loss function.
  
      Parameters
      ----------
      y_1 : Tensor array
        Output logits from model 1
  
      y_2 : Tensor array
        Output logits from model 2
  
      t : np.ndarray
        List of Noisy Labels (t means targets)
  
      forget_rate : float
        Decimal between 0 and 1 for how quickly the models forget what they learn.
        Just use rate_schedule[epoch] for this value
  
      class_weights : Tensor array, shape (Number of classes x 1), Default: None
        A np.torch.tensor list of length number of classes with weights
      """
  
      loss_1 = F.cross_entropy(
          y_1, t, reduce=False, weight=class_weights
      )
      ind_1_sorted = np.argsort(loss_1.data.cpu())
      loss_1_sorted = loss_1[ind_1_sorted]
  
      loss_2 = F.cross_entropy(
          y_2, t, reduce=False, weight=class_weights
      )
      ind_2_sorted = np.argsort(loss_2.data.cpu())
  
      remember_rate = 1 - forget_rate
      num_remember = int(remember_rate * len(loss_1_sorted))
  
      ind_1_update = ind_1_sorted[:num_remember]
      ind_2_update = ind_2_sorted[:num_remember]
      # Share updates between the two models.
      # TODO: these class weights should take into account the ind_mask filters.
      loss_1_update = F.cross_entropy(
          y_1[ind_2_update], t[ind_2_update], weight=class_weights
      )
      loss_2_update = F.cross_entropy(
          y_2[ind_1_update], t[ind_1_update], weight=class_weights
      )
  
      return (
          torch.sum(loss_1_update) / num_remember,
          torch.sum(loss_2_update) / num_remember,
      )
  
file_path: cleanlab/cleanlab/experimental/coteaching.py
imports: import torch
  import torch.nn.functional
  from torch.autograd import Variable
  import numpy
label_desc: Use image node_id 1 for calling a global function with example usage: loss_coteaching(y_1, y_2, t, forget_rate, class_weights) and returns: unknown,  unknown