class_docstr: y_range: Used specifically for regression. = None for classification.
class_docstr_tok: ["y_range",":","Used","specifically","for","regression",".","=","None","for","classification","."]
code: def compute_loss(self, data_batch, loss_function=None, gamma=None):
      # train mode
      self.train()
      predict_data = self(data_batch)
      target_data = data_batch[-1].to(self.device)
      if self.problem_type in [BINARY, MULTICLASS]:
          target_data = target_data.type(
              torch.long
          )  # Windows default int type is int32. Need to explicit convert to Long.
      if self.problem_type == QUANTILE:
          return self.quantile_loss(
              predict_data, target_data, margin=gamma
          )
      if self.problem_type == SOFTCLASS:
          return loss_function(predict_data, target_data)
      else:
          target_data = target_data.flatten()
          if self.problem_type == REGRESSION:
              predict_data = predict_data.flatten()
          return loss_function(predict_data, target_data)
  
file_path: autogluon/tabular/src/autogluon/tabular/models/tabular_nn/torch/torch_network_modules.py
imports: import logging
  import numpy
  import torch
  import torch.nn
  from autogluon.core.constants import BINARY, MULTICLASS, QUANTILE, REGRESSION, SOFTCLASS
  from ..utils.nn_architecture_utils import get_embed_sizes
label_desc: Use image node_id 8 for calling the EmbedNet obj's underlying member method code with example usage: obj.compute_loss(data_batch, loss_function, gamma) and returns: self, loss_function, loss_function