code: def test_log_probability(X, scales):
      p = [1.7]
      x = [[1.0], [2.0], [8.0], [3.7], [1.9]]
      y = [-1.118864, -1.707099, -5.23651, -2.707099, -1.648275]
  
      x_torch = torch.tensor(numpy.array(x))
      p_torch = torch.tensor(numpy.array(p))
  
      d1 = Exponential(p)
      d2 = Exponential(numpy.array(p, dtype=numpy.float64))
      d3 = torch.distributions.Exponential(1.0 / p_torch)
  
      _test_predictions(x, y, d1.log_probability(x), torch.float32)
      _test_predictions(x, y, d2.log_probability(x), torch.float64)
      _test_predictions(
          x,
          d3.log_prob(x_torch).sum(axis=1),
          d2.log_probability(x),
          torch.float64,
      )
  
      p = [1.7, 2.3, 0.9, 1.7, 4.1]
      x = [[1.0, 2.0, 8.0, 3.7, 1.9]]
      y = [-16.186367]
  
      p_torch = torch.tensor(numpy.array(p))
      x_torch = torch.tensor(numpy.array(x))
  
      d1 = Exponential(p)
      d2 = Exponential(numpy.array(p, dtype=numpy.float64))
      d3 = torch.distributions.Exponential(1.0 / p_torch)
  
      _test_predictions(x, y, d1.log_probability(x), torch.float32)
      _test_predictions(x, y, d2.log_probability(x), torch.float64)
      _test_predictions(
          x,
          d3.log_prob(x_torch).sum(axis=1),
          d2.log_probability(x),
          torch.float64,
      )
  
      p = [1, 2, 4]
      x = [[1, 2, 1], [2, 2, 1], [0, 1, 0], [0, 0, 2]]
      y = [-4.329442, -5.329442, -2.579442, -2.579442]
  
      p_torch = torch.tensor(numpy.array(p))
      x_torch = torch.tensor(numpy.array(x))
  
      d1 = Exponential(p)
      d2 = Exponential(numpy.array(p, dtype=numpy.float64))
      d3 = torch.distributions.Exponential(1.0 / p_torch)
  
      _test_predictions(x, y, d1.log_probability(x), torch.float32)
      _test_predictions(x, y, d2.log_probability(x), torch.float64)
      _test_predictions(
          x,
          d3.log_prob(x_torch).sum(axis=1),
          d2.log_probability(x),
          torch.float64,
      )
  
      p = [1.0, 2.0, 4.0]
      d1 = Exponential(p)
      d2 = Exponential(numpy.array(p, dtype=numpy.float64))
      d3 = torch.distributions.Exponential(1.0 / p_torch)
  
      p_torch = torch.tensor(numpy.array(p))
      x_torch = torch.tensor(numpy.array(x))
  
      _test_predictions(x, y, d1.log_probability(x), torch.float32)
      _test_predictions(x, y, d2.log_probability(x), torch.float64)
      _test_predictions(
          x,
          d3.log_prob(x_torch).sum(axis=1),
          d2.log_probability(x),
          torch.float64,
      )
  
      p_torch = torch.tensor(numpy.array(scales))
      y = [
          -3.45649,
          -1.988236,
          -3.853315,
          -5.242204,
          -4.567601,
          -8.13903,
          -3.734268,
      ]
  
      d1 = Exponential(scales)
      d2 = Exponential(numpy.array(scales, dtype=numpy.float64))
      d3 = torch.distributions.Exponential(1.0 / p_torch)
  
      _test_predictions(X, y, d1.log_probability(X), torch.float32)
      _test_predictions(X, y, d2.log_probability(X), torch.float64)
      _test_predictions(
          x,
          d3.log_prob(x_torch).sum(axis=1),
          d2.log_probability(x),
          torch.float64,
      )
  
imports: import os
  import numpy
  import torch
  import pytest
  from pomegranate.distributions import Exponential
  from ._utils import _test_initialization_raises_one_parameter
  from ._utils import _test_initialization
  from ._utils import _test_predictions
  from ._utils import _test_efd_from_summaries
  from ._utils import _test_raises
  from nose.tools import assert_raises
  from numpy.testing import assert_array_almost_equal
label_desc: Use image node_id 17 for calling a global function with example usage: test_log_probability(X, scales) without return types