class_docstr: N-HiTS block which takes a basis function as an argument.
class_docstr_tok: ["N-HiTS","block","which","takes","a","basis","function","as","an","argument","."]
code: def forward(
      self,
      encoder_y: torch.Tensor,
      encoder_x_t: torch.Tensor,
      decoder_x_t: torch.Tensor,
      x_s: torch.Tensor,
  ) -> Tuple[torch.Tensor, torch.Tensor]:
      batch_size = len(encoder_y)
  
      encoder_y = encoder_y.transpose(1, 2)
      # Pooling layer to downsample input
      encoder_y = self.pooling_layer(encoder_y)
      encoder_y = encoder_y.transpose(1, 2).reshape(batch_size, -1)
  
      if self.encoder_covariate_size > 0:
          encoder_y = torch.cat(
              (
                  encoder_y,
                  encoder_x_t.reshape(batch_size, -1),
              ),
              1,
          )
  
      if self.decoder_covariate_size > 0:
          encoder_y = torch.cat(
              (
                  encoder_y,
                  decoder_x_t.reshape(batch_size, -1),
              ),
              1,
          )
  
      # Static exogenous
      if (self.static_size > 0) and (self.static_hidden_size > 0):
          x_s = self.static_encoder(x_s)
          encoder_y = torch.cat((encoder_y, x_s), 1)
  
      # Compute local projection weights and projection
      theta = self.layers(encoder_y)
      backcast_theta = theta[
          :, : self.context_length * len(self.output_size)
      ].reshape(-1, self.context_length)
      forecast_theta = theta[
          :, self.context_length * len(self.output_size) :
      ].reshape(-1, self.n_theta)
      backcast, forecast = self.basis(
          backcast_theta, forecast_theta, encoder_x_t, decoder_x_t
      )
      backcast = backcast.reshape(
          -1, len(self.output_size), self.context_length
      ).transpose(1, 2)
      forecast = forecast.reshape(
          -1, sum(self.output_size), self.prediction_length
      ).transpose(1, 2)
  
      return backcast, forecast
  
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 2 for calling the NHiTSBlock obj's underlying member method code with example usage: obj.forward(encoder_y, encoder_x_t, decoder_x_t, x_s) and returns: backcast,  forecast