code: def test_masked_fit(X):
      X = torch.tensor(numpy.array(X))
      mask = torch.ones_like(X).type(torch.bool)
      X_ = torch.masked.MaskedTensor(X, mask=mask)
  
      d = [Exponential([2.1, 0.3, 1.1]), Exponential([1.5, 3.1, 2.2])]
      model = GeneralMixtureModel(d, max_iter=5)
      model.fit(X_)
  
      assert_array_almost_equal(model._w_sum, [0.0, 0.0])
      assert_array_almost_equal(model.priors, [0.378347, 0.621653])
      assert_array_almost_equal(
          model._log_priors, numpy.log([0.378347, 0.621653])
      )
  
      X = torch.tensor(
          numpy.array(
              [
                  [1, 2, 1],
                  [1, 3, 1],
                  [1, 1, 2],
                  [2, 2, 2],
                  [3, 1, 3],
                  [5, 1, 4],
                  [2, 1, 5],
                  [1, 3, 2],
                  [1, 1, 1],
                  [2, 2, 1],
                  [3, 1, 2],
              ]
          )
      )
  
      mask = torch.tensor(
          numpy.array(
              [
                  [False, True, True],
                  [True, True, False],
                  [False, False, False],
                  [True, True, True],
                  [False, True, False],
                  [True, True, True],
                  [False, False, False],
                  [True, False, True],
                  [True, True, True],
                  [True, True, True],
                  [True, False, True],
              ]
          )
      )
  
      X_masked = torch.masked.MaskedTensor(X, mask=mask)
  
      d = [Exponential([2.1, 0.3, 0.1]), Exponential([1.5, 3.1, 2.2])]
      model = GeneralMixtureModel(d, max_iter=5)
      model.fit(X_masked)
  
      assert_array_almost_equal(model._w_sum, [0.0, 0.0])
      assert_array_almost_equal(model.priors, [0.028038, 0.971962])
      assert_array_almost_equal(
          model._log_priors, [-3.574186, -0.028439]
      )
  
imports: import os
  import numpy
  import torch
  import pytest
  from pomegranate.gmm import GeneralMixtureModel
  from pomegranate.distributions import Exponential
  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 42 for calling a global function with example usage: test_masked_fit(X) without return types