code: def _sk_log_cosh_error(preds, target):
      preds, target = preds.numpy(), target.numpy()
      diff = preds - target
      if diff.ndim == 1:
          return np.mean(np.log((np.exp(diff) + np.exp(-diff)) / 2))
      return np.mean(np.log((np.exp(diff) + np.exp(-diff)) / 2), axis=0)
  
file_path: torchmetrics/tests/unittests/regression/test_log_cosh_error.py
imports: from functools import partial
  import numpy
  import pytest
  import torch
  from torchmetrics.functional.regression.log_cosh import log_cosh_error
  from torchmetrics.regression.log_cosh import LogCoshError
  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: _sk_log_cosh_error(preds, target) and returns: np, np