code: def __init__(self, target_length):
      super().__init__()
      half_minus_one = int(target_length / 2 - 1)
      cos_vectors = [
          torch.cos(
              torch.arange(target_length)
              / target_length
              * 2
              * np.pi
              * i
          )
          for i in range(1, half_minus_one + 1)
      ]
      sin_vectors = [
          torch.sin(
              torch.arange(target_length)
              / target_length
              * 2
              * np.pi
              * i
          )
          for i in range(1, half_minus_one + 1)
      ]
  
      # basis is of size (2 * int(target_length / 2 - 1) + 1, target_length)
      basis = torch.stack(
          [torch.ones(target_length)] + cos_vectors + sin_vectors, dim=1
      ).T
  
      self.basis = nn.Parameter(basis, requires_grad=False)
  
imports: from enum import Enum
  from typing import List, NewType, Tuple, Union
  import numpy
  import torch
  import torch.nn
  from darts.logging import get_logger, raise_if_not, raise_log
  from darts.models.forecasting.pl_forecasting_module import PLPastCovariatesModule, io_processor
  from darts.models.forecasting.torch_forecasting_model import PastCovariatesTorchModel
  from darts.utils.torch import MonteCarloDropout
label_desc: Use image node_id 1 to create a new _SeasonalityGenerator object from inherited base classes: nn with example: obj = _SeasonalityGenerator(target_length)