class_docstr: Hierarchical Attention Network (RNN baseline model)
docstr: Training Iteration
code: def training_step(self, batch, batch_idx):
      """Training Iteration"""
      ## 1. ENCODER-DECODER
      predicted = self(batch)
      ## 2. LOSS
      targets = self.transform_targets(batch["target"])
      loss = self.loss(predicted, target=targets)
      ## 3. METRICS
      self.train_step_predictions.append(predicted.detach())
      self.train_step_targets.append(targets.detach())
  
      if (
          (self.global_step + 1) % (self.trainer.log_every_n_steps) == 0
      ) and (self.last_update != self.global_step):
          self.last_update = self.global_step
          self.log_metrics(
              predictions=torch.cat(self.train_step_predictions),
              targets=torch.cat(self.train_step_targets),
              loss=loss.detach(),
              stage="train",
              on_step=True,
              on_epoch=True,
          )
          del self.train_step_predictions
          del self.train_step_targets
          self.train_step_targets = []
          self.train_step_predictions = []
  
      return loss
  
imports: from turtle import hideturtle
  import pytorch_lightning
  import torch
  import torch.nn.functional
  import torch.nn
  from pytorch_lightning import seed_everything
  from pathlib import Path
  from src.transformer.transformer_utils import *
  from src.transformer.metrics import CorrectedBAcc, CorrectedF1, CorrectedMCC, AUL
  import torchmetrics
label_desc: Use image node_id 8 for calling the FFN obj's underlying member method code with example usage: obj.training_step(batch, batch_idx) and returns: loss