class_docstr: Linear time regression fun and some not so linear fun.
  A modular model that models classic time-series components
      * trend
      * seasonality
      * auto-regression (as AR-Net)
      * covariates (as AR-Net)
      * apriori regressors
      * events and holidays
  by using Neural Network components.
  The Auto-regression and covariate components can be configured as a deeper network (AR-Net).
class_docstr_tok: ["Linear","time","regression","fun","and","some","not","so","linear","fun",".","A","modular","model","that","models","classic","time-series","components","*","trend","*","seasonality","*","auto-regression","(","as","AR-Net",")","*","covariates","(","as","AR-Net",")","*","apriori","regressors","*","events","and","holidays","by","using","Neural","Network","components",".","The","Auto-regression","and","covariate","components","can","be","configured","as","a","deeper","network","(","AR-Net",")","."]
code: def loss_func(self, inputs, predicted, targets):
      loss = None
      # Compute loss. no reduction.
      loss = self.config_train.loss_func(predicted, targets)
      # Weigh newer samples more.
      loss = loss * self._get_time_based_sample_weight(
          t=inputs["time"][:, self.n_lags :]
      )
      loss = loss.sum(dim=2).mean()
      # Regularize.
      if self.reg_enabled:
          steps_per_epoch = math.ceil(
              self.trainer.estimated_stepping_batches
              / self.trainer.max_epochs
          )
          progress_in_epoch = 1 - (
              (
                  steps_per_epoch * (self.current_epoch + 1)
                  - self.global_step
              )
              / steps_per_epoch
          )
          loss, reg_loss = self._add_batch_regularizations(
              loss, self.current_epoch, progress_in_epoch
          )
      else:
          reg_loss = torch.tensor(0.0, device=self.device)
      return loss, reg_loss
  
imports: import logging
  import math
  from collections import OrderedDict
  from functools import reduce
  from typing import Dict, List, Optional, Union
  import numpy
  import pytorch_lightning
  import torch
  import torch.nn
  import torchmetrics
  from neuralprophet import configure, np_types
  from neuralprophet.components.router import get_future_regressors, get_seasonality, get_trend
  from neuralprophet.utils import check_for_regularization, config_events_to_model_dims, reg_func_events, reg_func_regressors, reg_func_season, reg_func_trend
  from neuralprophet.utils_torch import init_parameter, interprete_model
label_desc: Use image node_id 13 for calling the TimeNet obj's underlying member method code with example usage: obj.loss_func(inputs, predicted, targets) and returns: loss,  reg_loss