code: def test_pairwise_distances_execution(setup):
      raw_x = np.random.rand(20, 5)
      raw_y = np.random.rand(21, 5)
  
      x = mt.tensor(raw_x, chunk_size=11)
      y = mt.tensor(raw_y, chunk_size=12)
  
      d = pairwise_distances(x, y)
      result = d.execute().fetch()
      expected = sk_pairwise_distances(raw_x, raw_y)
      np.testing.assert_almost_equal(result, expected)
  
      # test precomputed
      d2 = d.copy()
      d2[0, 0] = -1
      d2 = pairwise_distances(d2, y, metric="precomputed")
      with pytest.raises(ValueError):
          _ = d2.execute().fetch()
  
      # test cdist
      weight = np.random.rand(5)
      d = pairwise_distances(x, y, metric="wminkowski", p=3, w=weight)
      result = d.execute().fetch()
      expected = sk_pairwise_distances(
          raw_x, raw_y, metric="minkowski", p=3, w=weight
      )
      np.testing.assert_almost_equal(result, expected)
  
      # test pdist
      d = pairwise_distances(x, metric="hamming")
      result = d.execute().fetch()
      expected = sk_pairwise_distances(raw_x, metric="hamming")
      np.testing.assert_almost_equal(result, expected)
  
      # test function metric
      m = lambda u, v: np.sqrt(((u - v) ** 2).sum())
      d = pairwise_distances(x, y, metric=m)
      result = d.execute().fetch()
      expected = sk_pairwise_distances(raw_x, raw_y, metric=m)
      np.testing.assert_almost_equal(result, expected)
  
      with pytest.warns(DataConversionWarning):
          pairwise_distances(x, y, metric="jaccard")
  
      with pytest.raises(ValueError):
          _ = pairwise_distances(x, y, metric="unknown")
  
file_path: mars/mars/learn/metrics/pairwise/tests/test_pariwise_distances.py
imports: import numpy
  import pytest
  from sklearn.metrics import pairwise_distances
  from sklearn.neighbors import NearestNeighbors
  from sklearn.exceptions import DataConversionWarning
  from .....None import tensor
  from .....session import execute, fetch
  from ...None import pairwise_distances, pairwise_distances_topk
label_desc: Use image node_id 1 for calling a global function with example usage: test_pairwise_distances_execution(setup) without return types