class_docstr: N-HiTS Model.
code: def forward(
      self,
      encoder_y,
      encoder_mask,
      encoder_x_t,
      decoder_x_t,
      x_s,
  ):
      residuals = encoder_y  # .flip(dims=(1,))  # todo: check if flip is required or should be rather replaced by scatter
      # encoder_x_t = encoder_x_t.flip(dims=(-1,))
      # encoder_mask = encoder_mask.flip(dims=(-1,))
      encoder_mask = encoder_mask.unsqueeze(-1)
  
      level = encoder_y[:, -1:].repeat(
          1, self.prediction_length, 1
      )  # Level with Naive1
      forecast_level = level.repeat_interleave(
          torch.tensor(self.output_size, device=level.device), dim=2
      )
  
      # level with last available observation
      if self.naive_level:
          block_forecasts = [forecast_level]
          block_backcasts = [
              encoder_y[:, -1:].repeat(1, self.context_length, 1)
          ]
  
          forecast = block_forecasts[0]
      else:
          block_forecasts = []
          block_backcasts = []
          forecast = torch.zeros_like(
              forecast_level, device=forecast_level.device
          )
  
      # forecast by block
      for block in self.blocks:
          block_backcast, block_forecast = block(
              encoder_y=residuals,
              encoder_x_t=encoder_x_t,
              decoder_x_t=decoder_x_t,
              x_s=x_s,
          )
          residuals = (residuals - block_backcast) * encoder_mask
  
          forecast = forecast + block_forecast
          block_forecasts.append(block_forecast)
          block_backcasts.append(block_backcast)
  
      # (n_batch, n_t, n_outputs, n_blocks)
      block_forecasts = torch.stack(block_forecasts, dim=-1)
      block_backcasts = torch.stack(block_backcasts, dim=-1)
      backcast = residuals
  
      return forecast, backcast, block_forecasts, block_backcasts
  
imports: from functools import partial
  from typing import List, Tuple
  import numpy
  import torch
  import torch.nn
  import torch.nn.functional
label_desc: Use image node_id 3 for calling the NHiTS obj's underlying member method code with example usage: obj.forward(encoder_y, encoder_mask, encoder_x_t, decoder_x_t, x_s) and returns: forecast,  backcast,  block_forecasts,  block_backcasts