class_docstr: Abstract class for model with NCR losses.
  
  Supports both softmax-classification and multi-label classification models.
class_docstr_tok: ["Abstract","class","for","model","with","NCR","losses",".","Supports","both","softmax-classification","and","multi-label","classification","models","."]
code: def loss_function(  # pytype: disable=signature-mismatch  # overriding-return-type-checks
      self,
      logits: Array,
      batch: base_model.Batch,
      use_ncr: bool = False,
      use_bootstrap: bool = False,
      features: Optional[Array] = None,
      memory_logits: Optional[Array] = None,
      memory_features: Optional[Array] = None,
      loss_weight: Optional[float] = 0.0,
      model_params: Optional[Array] = None,
  ) -> Tuple[float, Dict[str, Array]]:
      if use_ncr:
          return self.ncr_loss(
              logits,
              batch,
              features,
              memory_logits,
              memory_features,
              loss_weight,
              model_params,
          )
      else:
          return self.ce_loss(
              logits, batch, model_params, use_bootstrap, loss_weight
          )
  
file_path: scenic/scenic/projects/ncr/base_model.py
imports: import functools
  from typing import Dict, Optional, Tuple, Union
  from flax.training import common_utils
  from immutabledict import immutabledict
  import jax
  import jax.numpy
  import numpy
  from scenic.model_lib.base_models import base_model
  from scenic.model_lib.base_models import classification_model
  from scenic.model_lib.base_models import model_utils
  from scenic.projects.ncr import loss
label_desc: Use image node_id 1 for calling the NCRModel obj's underlying member method code with example usage: obj.loss_function(logits, batch, use_ncr, use_bootstrap, features, memory_logits, memory_features, loss_weight, model_params) and returns: self, self