docstr: Returns causal mask to apply for self-attention layer that acts on future input only.
  The model will attend to all `False` values.
docstr_tok: ["Returns","causal","mask","to","apply","for","self-attention","layer","that","acts","on","future","input","only",".","The","model","will","attend","to","all","`","False","`","values","."]
code: def get_attention_mask_future(
      encoder_length: int,
      decoder_length: int,
      batch_size: int,
      device: str,
      full_attention: bool,
  ) -> torch.Tensor:
      """
      Returns causal mask to apply for self-attention layer that acts on future input only.
      The model will attend to all `False` values.
      """
      if full_attention:
          # attend to entire past and future input
          decoder_mask = torch.zeros(
              (decoder_length, decoder_length),
              dtype=torch.bool,
              device=device,
          )
      else:
          # attend only to past steps relative to forecasting step in the future
          # indices to which is attended
          attend_step = torch.arange(decoder_length, device=device)
          # indices for which is predicted
          predict_step = torch.arange(0, decoder_length, device=device)[
              :, None
          ]
          # do not attend to steps to self or after prediction
          decoder_mask = attend_step >= predict_step
      # attend to all past input
      encoder_mask = torch.zeros(
          batch_size, encoder_length, dtype=torch.bool, device=device
      )
      # combine masks along attended time - first encoder and then decoder
  
      mask = torch.cat(
          (
              encoder_mask.unsqueeze(1).expand(-1, decoder_length, -1),
              decoder_mask.unsqueeze(0).expand(batch_size, -1, -1),
          ),
          dim=2,
      )
      return mask
  
imports: from typing import Dict, List, Optional, Sequence, Tuple, Union
  import numpy
  import pandas
  import torch
  from torch import nn
  from torch.nn import LSTM
  from darts import TimeSeries
  from darts.logging import get_logger, raise_if, raise_if_not, raise_log
  from darts.models.components import glu_variants, layer_norm_variants
  from darts.models.components.glu_variants import GLU_FFN
  from darts.models.forecasting.pl_forecasting_module import PLMixedCovariatesModule, io_processor
  from darts.models.forecasting.tft_submodels import _GateAddNorm, _GatedResidualNetwork, _InterpretableMultiHeadAttention, _MultiEmbedding, _VariableSelectionNetwork, get_embedding_size
  from darts.models.forecasting.torch_forecasting_model import MixedCovariatesTorchModel
  from darts.utils.data import MixedCovariatesSequentialDataset, MixedCovariatesTrainingDataset, TrainingDataset
  from darts.utils.likelihood_models import Likelihood, QuantileRegression
label_desc: Use image node_id 11 for calling the _TFTModule obj's underlying member method code with example usage: obj.get_attention_mask_future(encoder_length, decoder_length, batch_size, device, full_attention) and returns: mask