code: def test_median_absolute_error():
      # See https://github.com/torch/torch7/pull/182
      # For even number of elements, PyTorch returns middle element
      # NumPy returns average of middle elements
      # Size of dataset will be odd for these tests
  
      size = 51
      np_y_pred = np.random.rand(size)
      np_y = np.random.rand(size)
      np_median_absolute_error = np.median(np.abs(np_y - np_y_pred))
  
      m = MedianAbsoluteError()
      y_pred = torch.from_numpy(np_y_pred)
      y = torch.from_numpy(np_y)
  
      m.reset()
      m.update((y_pred, y))
  
      assert np_median_absolute_error == pytest.approx(m.compute())
  
imports: import os
  import numpy
  import pytest
  import torch
  import ignite.distributed
  from ignite.contrib.metrics.regression import MedianAbsoluteError
  from ignite.engine import Engine
  from ignite.exceptions import NotComputableError
label_desc: Use image node_id 3 for calling a global function with example usage: test_median_absolute_error() without return types