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 training_step(self, batch, batch_idx):
      inputs, targets, meta = batch
      # Global-local
      if self.meta_used_in_model:
          meta_name_tensor = torch.tensor(
              [self.id_dict[i] for i in meta["df_name"]],
              device=self.device,
          )
      else:
          meta_name_tensor = None
      # Run forward calculation
      predicted, _ = self.forward(inputs, meta_name_tensor)
      # Store predictions in self for later network visualization
      self.train_epoch_prediction = predicted
      # Calculate loss
      loss, reg_loss = self.loss_func(inputs, predicted, targets)
  
      # Optimization
      optimizer = self.optimizers()
      optimizer.zero_grad()
      self.manual_backward(loss)
      optimizer.step()
  
      scheduler = self.lr_schedulers()
      scheduler.step()
  
      # Manually track the loss for the lr finder
      self.trainer.fit_loop.running_loss.append(loss)
  
      # Metrics
      if self.metrics_enabled:
          predicted_denorm = self.denormalize(predicted[:, :, 0])
          target_denorm = self.denormalize(targets.squeeze(dim=2))
          self.log_dict(
              self.metrics_train(predicted_denorm, target_denorm),
              **self.log_args,
          )
          self.log("Loss", loss, **self.log_args)
          self.log("RegLoss", reg_loss, **self.log_args)
      return 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 14 for calling the TimeNet obj's underlying member method code with example usage: obj.training_step(batch, batch_idx) and returns: loss