class_docstr: Mean absolute scaled error
  
  Defined as ``(y_pred - target).abs() / all_targets[:, :-1] - all_targets[:, 1:]).mean(1)``.
  ``all_targets`` are here the concatenated encoder and decoder targets
class_docstr_tok: ["Mean","absolute","scaled","error","Defined","as","``","(","y_pred","-","target",")",".abs","(",")","\/","all_targets","[",":",",",":","-1","]","-","all_targets","[",":",",","1",":","]",")",".mean","(","1",")","``",".","``","all_targets","``","are","here","the","concatenated","encoder","and","decoder","targets"]
docstr: Update metric that handles masking of values.
  
  Args:
      y_pred (Dict[str, torch.Tensor]): network output
      target (Tuple[Union[torch.Tensor, rnn.PackedSequence], torch.Tensor]): tuple of actual values and weights
      encoder_target (Union[torch.Tensor, rnn.PackedSequence]): historic actual values
      encoder_lengths (torch.Tensor): optional encoder lengths, not necessary if encoder_target
          is rnn.PackedSequence. Assumed encoder_target is torch.Tensor
  
  Returns:
      torch.Tensor: loss as a single number for backpropagation
docstr_tok: ["Update","metric","that","handles","masking","of","values",".","Args",":","y_pred","(","Dict","[","str",",","torch.Tensor","]",")",":","network","output","target","(","Tuple","[","Union","[","torch.Tensor",",","rnn.PackedSequence","]",",","torch.Tensor","]",")",":","tuple","of","actual","values","and","weights","encoder_target","(","Union","[","torch.Tensor",",","rnn.PackedSequence","]",")",":","historic","actual","values","encoder_lengths","(","torch.Tensor",")",":","optional","encoder","lengths",",","not","necessary","if","encoder_target","is","rnn.PackedSequence",".","Assumed","encoder_target","is","torch.Tensor","Returns",":","torch.Tensor",":","loss","as","a","single","number","for","backpropagation"]
code: def update(
      self,
      y_pred,
      target,
      encoder_target,
      encoder_lengths=None,
  ) -> torch.Tensor:
      """
      Update metric that handles masking of values.
  
      Args:
          y_pred (Dict[str, torch.Tensor]): network output
          target (Tuple[Union[torch.Tensor, rnn.PackedSequence], torch.Tensor]): tuple of actual values and weights
          encoder_target (Union[torch.Tensor, rnn.PackedSequence]): historic actual values
          encoder_lengths (torch.Tensor): optional encoder lengths, not necessary if encoder_target
              is rnn.PackedSequence. Assumed encoder_target is torch.Tensor
  
      Returns:
          torch.Tensor: loss as a single number for backpropagation
      """
      # unpack weight
      if isinstance(target, (list, tuple)):
          weight = target[1]
          target = target[0]
      else:
          weight = None
  
      # unpack target
      if isinstance(target, rnn.PackedSequence):
          target, lengths = unpack_sequence(target)
      else:
          lengths = torch.full(
              (target.size(0),),
              fill_value=target.size(1),
              dtype=torch.long,
              device=target.device,
          )
  
      # determine lengths for encoder
      if encoder_lengths is None:
          encoder_target, encoder_lengths = unpack_sequence(
              encoder_target
          )
      else:
          assert isinstance(encoder_target, torch.Tensor)
      assert not target.requires_grad
  
      # calculate loss with "none" reduction
      scaling = self.calculate_scaling(
          target, lengths, encoder_target, encoder_lengths
      )
      losses = self.loss(y_pred, target, scaling)
  
      # weight samples
      if weight is not None:
          losses = losses * weight.unsqueeze(-1)
  
      self._update_losses_and_lengths(losses, lengths)
  
imports: from typing import Any, Callable, Dict, List, Optional, Tuple, Union
  import scipy.stats
  import torch
  import torch.nn.functional
  from torch.nn.utils import rnn
  from pytorch_forecasting.metrics.base_metrics import MultiHorizonMetric
  from pytorch_forecasting.utils import create_mask, unpack_sequence, unsqueeze_like
label_desc: Use image node_id 1 for calling the MASE obj's underlying member method code with example usage: obj.update(y_pred, target, encoder_target, encoder_lengths) without return types