class_docstr: N-HiTS Model.
code: def create_stack(
      self,
      n_blocks,
      context_length,
      prediction_length,
      output_size,
      encoder_covariate_size,
      decoder_covariate_size,
      static_size,
      static_hidden_size,
      n_layers,
      hidden_size,
      pooling_sizes,
      downsample_frequencies,
      pooling_mode,
      interpolation_mode,
      batch_normalization,
      dropout,
      activation,
      shared_weights,
      initialization,
  ):
      block_list = []
      for i in range(len(n_blocks)):
          for block_id in range(n_blocks[i]):
              # Batch norm only on first block
              if (len(block_list) == 0) and (batch_normalization):
                  batch_normalization_block = True
              else:
                  batch_normalization_block = False
  
              # Shared weights
              if shared_weights and block_id > 0:
                  nbeats_block = block_list[-1]
              else:
                  n_theta = max(
                      prediction_length // downsample_frequencies[i], 1
                  )
                  basis = IdentityBasis(
                      backcast_size=context_length,
                      forecast_size=prediction_length,
                      interpolation_mode=interpolation_mode,
                  )
  
                  nbeats_block = NHiTSBlock(
                      context_length=context_length,
                      prediction_length=prediction_length,
                      output_size=output_size,
                      encoder_covariate_size=encoder_covariate_size,
                      decoder_covariate_size=decoder_covariate_size,
                      static_size=static_size,
                      static_hidden_size=static_hidden_size,
                      n_theta=n_theta,
                      hidden_size=hidden_size[i],
                      pooling_sizes=pooling_sizes[i],
                      pooling_mode=pooling_mode,
                      basis=basis,
                      n_layers=n_layers[i],
                      batch_normalization=batch_normalization_block,
                      dropout=dropout,
                      activation=activation,
                  )
  
              # Select type of evaluation and apply it to all layers of block
              init_function = partial(
                  init_weights, initialization=initialization
              )
              nbeats_block.layers.apply(init_function)
              block_list.append(nbeats_block)
      return block_list
  
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 NHiTS obj's underlying member method code with example usage: obj.create_stack(n_blocks, context_length, prediction_length, output_size, encoder_covariate_size, decoder_covariate_size, static_size, static_hidden_size, n_layers, hidden_size, pooling_sizes, downsample_frequencies, pooling_mode, interpolation_mode, batch_normalization, dropout, activation, shared_weights, initialization) and returns: block_list