code: def __init__(
      self,
      *lists_of_modules: List[nn.Module],
      horizon: Union[int, float],
      loss_func: LossFunction = MAELoss(),
      normalize_input: bool = True,
      rescale_output: bool = True,
      layerwise_loss: bool = True,
  ) -> None:
      super(AttentionEstimator, self).__init__()
      self._create_modules(*lists_of_modules)
  
      if isinstance(horizon, int):
          assert horizon >= 0, "Positive horizon is required."
      else:
          assert 0 <= horizon <= 1, "horizon must be from [0,1]."
      self._softplus = PositiveSoftplus(margin=MIN_TRADEOFF)
      self._tradeoff = Parameter(
          pt.tensor(
              math.log(math.exp(1 - MIN_TRADEOFF) - 1) + MIN_TRADEOFF
          ),
          requires_grad=False,
      )
      self.horizon = horizon
      self.normalize_input = normalize_input
      self.rescale_output = rescale_output
      self.layerwise_loss = layerwise_loss
  
      if self.normalize_input:
          self._normalizer = ZScoreNormalizer(
              rescale_loss=self.rescale_output
          )
          self.register_forward_pre_hook(
              self._normalizer.forward_pre_hook
          )
          self.register_forward_hook(self._normalizer.forward_hook)
      else:
          self._normalizer = None
      self.register_loss_func(loss_func)
  
      self.register_buffer("bc_loss", None, persistent=False)
      self.register_buffer("fc_loss", None, persistent=False)
      self.register_buffer("residue", None, persistent=False)
      self.register_buffer("forecast", None, persistent=False)
      self.register_buffer("denominator", None, persistent=False)
  
imports: from typing import Optional, List, Tuple, Union, Iterator, Callable
  from itertools import product, chain
  from copy import deepcopy
  import warnings
  import math
  import torch
  from torch import Tensor, LongTensor, BoolTensor
  from torch import nn
  from torch.nn import Parameter, functional
  from tslib.nn.activations import PositiveSoftplus
  from ..network import AttentionKernel, ExpKernel, RBFKernel, EncoderModule, DecoderModule, AttentionBlock, AdversarialBlock, SimpleDiscriminator
  from .hooks import ZScoreNormalizer, LossFunction, MSELoss, MAELoss
label_desc: Use image node_id 1 to create a new AttentionEstimator object from inherited base classes: nn with example: obj = AttentionEstimator()