code: def set_loss_func(self):
      if isinstance(self.loss_func, str):
          if self.loss_func.lower() in [
              "smoothl1",
              "smoothl1loss",
              "huber",
          ]:
              # keeping 'huber' for backwards compatiblility, though not identical
              self.loss_func = torch.nn.SmoothL1Loss(
                  reduction="none", beta=0.3
              )
          elif self.loss_func.lower() in [
              "mae",
              "maeloss",
              "l1",
              "l1loss",
          ]:
              self.loss_func = torch.nn.L1Loss(reduction="none")
          elif self.loss_func.lower() in [
              "mse",
              "mseloss",
              "l2",
              "l2loss",
          ]:
              self.loss_func = torch.nn.MSELoss(reduction="none")
          else:
              raise NotImplementedError(
                  f"Loss function {self.loss_func} name not defined"
              )
          self.loss_func_name = type(self.loss_func).__name__
      else:
          if callable(self.loss_func) and isinstance(
              self.loss_func, types.FunctionType
          ):
              self.loss_func_name = self.loss_func.__name__
          elif issubclass(
              self.loss_func().__class__, torch.nn.modules.loss._Loss
          ):
              self.loss_func = self.loss_func(reduction="none")
              self.loss_func_name = type(self.loss_func).__name__
          else:
              raise NotImplementedError(
                  f"Loss function {self.loss_func} not found"
              )
      if len(self.quantiles) > 1:
          self.loss_func = PinballLoss(
              loss_func=self.loss_func, quantiles=self.quantiles
          )
  
imports: from __future__ import annotations
  import logging
  import math
  import types
  from collections import OrderedDict
  from dataclasses import dataclass, field
  from typing import Callable, List, Optional
  from typing import OrderedDict
  from typing import Type, Union
  import numpy
  import pandas
  import torch
  from neuralprophet import df_utils, np_types, utils, utils_torch
  from neuralprophet.custom_loss_metrics import PinballLoss
label_desc: Use image node_id 2 for calling the Train obj's underlying member method code with example usage: obj.set_loss_func() without return types