code: def test_masked_distances(model, X, X_masked):
      X = torch.tensor(numpy.array(X))
      mask = torch.ones_like(X).type(torch.bool)
      X_ = torch.masked.MaskedTensor(X, mask=mask)
  
      y_hat = model._distances(X_)
      assert_array_almost_equal(
          y_hat,
          [
              [1.2910, 1.0000],
              [0.5774, 1.7321],
              [0.8165, 1.8257],
              [1.4142, 1.8257],
              [1.4142, 0.8165],
              [2.9439, 3.3665],
              [1.0000, 0.5774],
              [0.5774, 1.9149],
              [0.8165, 0.8165],
              [1.2910, 1.7321],
              [0.8165, 1.4142],
          ],
          4,
      )
  
      y_hat = model._distances(X_masked)
      assert_array_almost_equal(
          y_hat,
          [
              [1.7321, 1.7321],
              [1.0000, 1.7321],
              [inf, inf],
              [1.4142, 1.8257],
              [1.7321, 2.2361],
              [2.9439, 3.3665],
              [inf, inf],
              [0.7071, 2.3452],
              [0.8165, 0.8165],
              [1.2910, 1.7321],
              [1.0000, 1.7321],
          ],
          4,
      )
  
imports: import os
  import numpy
  import torch
  import pytest
  from pomegranate.kmeans import KMeans
  from .distributions._utils import _test_initialization_raises_one_parameter
  from .distributions._utils import _test_initialization
  from .distributions._utils import _test_predictions
  from .distributions._utils import _test_efd_from_summaries
  from .distributions._utils import _test_raises
  from nose.tools import assert_raises
  from numpy.testing import assert_array_almost_equal
label_desc: Use image node_id 30 for calling a global function with example usage: test_masked_distances(model, X, X_masked) without return types