class_docstr: Symmetric mean absolute percentage. Assumes ``y >= 0``.
  
  Defined as ``2*(y - y_pred).abs() / (y.abs() + y_pred.abs())``
class_docstr_tok: ["Symmetric","mean","absolute","percentage",".","Assumes","``","y",">","=","0","``",".","Defined","as","``","2","*","(","y","-","y_pred",")",".abs","(",")","\/","(","y.abs","(",")","+","y_pred.abs","(",")",")","``"]
code: def loss(self, y_pred, target):
      y_pred = self.to_prediction(y_pred)
      loss = (
          2
          * (y_pred - target).abs()
          / (y_pred.abs() + target.abs() + 1e-8)
      )
      return loss
  
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 SMAPE obj's underlying member method code with example usage: obj.loss(y_pred, target) and returns: loss