code: def _baseline_symmetric_mape(
      y_true: np.ndarray,
      y_pred: np.ndarray,
      sample_weight: Optional[np.ndarray] = None,
      multioutput: str = "uniform_average",
  ):
      r"""Symmetric mean absolute percentage error regression loss (SMAPE_).
  
      .. math:: \text{SMAPE} = \frac{2}{n}\sum_1^n\frac{max(|   y_i - \hat{y_i} |}{| y_i | + | \hat{y_i} |, \epsilon)}
  
      Where :math:`y` is a tensor of target values, and :math:`\hat{y}` is a tensor of predictions.
  
      Args:
          y_true: array-like of shape (n_samples,) or (n_samples, n_outputs)
              Ground truth (correct) target values.
          y_pred: array-like of shape (n_samples,) or (n_samples, n_outputs)
              Estimated target values.
          sample_weight: array-like of shape (n_samples,), default=None
              Sample weights.
          multioutput: {'raw_values', 'uniform_average'} or array-like
              Defines aggregating of multiple output values.
              Array-like value defines weights used to average errors.
              If input is list then the shape must be (n_outputs,).
  
                  - 'raw_values': Returns a full set of errors in case of multioutput input.
                  - 'uniform_average': Errors of all outputs are averaged with uniform weight.
  
      Returns:
          loss: float or ndarray of floats in the range [0, 1]
              If multi-output is 'raw_values', then symmetric mean absolute percentage error
              is returned for each output separately.
              If multi-output is 'uniform_average' or a ndarray of weights, then the
              weighted average of all output errors is returned.
              MAPE output is non-negative floating point. The best value is 0.0.
              But note the fact that bad predictions can lead to arbitrarily large
              MAPE values, especially if some y_true values are very close to zero.
              Note that we return a large value instead of `inf` when y_true is zero.
  
      """
      _, y_true, y_pred, multioutput = _check_reg_targets(
          y_true, y_pred, multioutput
      )
      check_consistent_length(y_true, y_pred, sample_weight)
      epsilon = np.finfo(np.float64).eps
      smape = (
          2
          * np.abs(y_pred - y_true)
          / np.maximum(np.abs(y_true) + np.abs(y_pred), epsilon)
      )
      output_errors = np.average(smape, weights=sample_weight, axis=0)
      if isinstance(multioutput, str):
          if multioutput == "raw_values":
              return output_errors
          # pass None as weights to np.average: uniform mean
          multioutput = None
  
      return np.average(output_errors, weights=multioutput)
  
imports: import math
  from functools import partial
  from typing import Optional
  import numpy
  import pytest
  import torch
  from sklearn.metrics import mean_absolute_error
  from sklearn.metrics import mean_absolute_percentage_error
  from sklearn.metrics import mean_squared_error
  from sklearn.metrics import mean_squared_log_error
  from sklearn.metrics._regression import _check_reg_targets
  from sklearn.utils import check_consistent_length
  from torchmetrics.functional import mean_absolute_error, mean_absolute_percentage_error, mean_squared_error, mean_squared_log_error, weighted_mean_absolute_percentage_error
  from torchmetrics.functional.regression.symmetric_mape import symmetric_mean_absolute_percentage_error
  from torchmetrics.regression import MeanAbsoluteError, MeanAbsolutePercentageError, MeanSquaredError, MeanSquaredLogError, WeightedMeanAbsolutePercentageError
  from torchmetrics.regression.symmetric_mape import SymmetricMeanAbsolutePercentageError
  from unittests import BATCH_SIZE, NUM_BATCHES, _Input
  from unittests.helpers import seed_all
  from unittests.helpers.testers import MetricTester
label_desc: Use image node_id 1 for calling a global function with example usage: _baseline_symmetric_mape(y_true, y_pred, sample_weight, multioutput) and returns: np, output_errors