code: def test_softmax_bernoulli_equivalence(
      num: int, dimX: int, dimF: int, dimY: int
  ) -> None:
      X = tf.random.normal((num, dimX))
      dF: AnyNDArray = np.vstack(
          (
              np.random.randn(num - 3, dimF),
              np.array([[-3.0, 0.0], [3, 0.0], [0.0, 0.0]]),
          )
      )
      dY: AnyNDArray = (
          np.vstack(
              (np.random.randn(num - 3, dimY), np.ones((3, dimY)))
          )
          > 0
      )
      F = to_default_float(dF)
      Fvar = tf.exp(
          tf.stack(
              [F[:, 1], -10.0 + tf.zeros(F.shape[0], dtype=F.dtype)],
              axis=1,
          )
      )
      F = tf.stack(
          [F[:, 0], tf.zeros(F.shape[0], dtype=F.dtype)], axis=1
      )
      Y = to_default_int(dY)
      Ylabel = 1 - Y
  
      softmax_likelihood = Softmax(dimF)
      bernoulli_likelihood = Bernoulli(invlink=tf.sigmoid)
      softmax_likelihood.num_monte_carlo_points = int(
          0.3e7
      )  # Minimum number of points to pass the test on CircleCI
      bernoulli_likelihood.num_gauss_hermite_points = 40
  
      assert_allclose(
          softmax_likelihood.conditional_mean(X, F)[:, :1],
          bernoulli_likelihood.conditional_mean(X, F[:, :1]),
      )
  
      assert_allclose(
          softmax_likelihood.conditional_variance(X, F)[:, :1],
          bernoulli_likelihood.conditional_variance(X, F[:, :1]),
      )
  
      assert_allclose(
          softmax_likelihood.log_prob(X, F, Ylabel),
          bernoulli_likelihood.log_prob(X, F[:, :1], Y.numpy()),
      )
  
      mean1, var1 = softmax_likelihood.predict_mean_and_var(X, F, Fvar)
      mean2, var2 = bernoulli_likelihood.predict_mean_and_var(
          X, F[:, :1], Fvar[:, :1]
      )
  
      assert_allclose(mean1[:, 0, None], mean2, rtol=2e-3)
      assert_allclose(var1[:, 0, None], var2, rtol=2e-3)
  
      ls_ve = softmax_likelihood.variational_expectations(
          X, F, Fvar, Ylabel
      )
      lb_ve = bernoulli_likelihood.variational_expectations(
          X, F[:, :1], Fvar[:, :1], Y.numpy()
      )
      assert_allclose(ls_ve, lb_ve, rtol=5e-3)
  
file_path: GPflow/tests/gpflow/likelihoods/test_multiclass.py
imports: import numpy
  import pytest
  import tensorflow
  from check_shapes import inherit_check_shapes
  from numpy.testing import assert_allclose
  from gpflow.base import AnyNDArray, TensorType
  from gpflow.config import default_float, default_int
  from gpflow.likelihoods import Bernoulli, MultiClass, RobustMax, Softmax
  from gpflow.utilities import to_default_float, to_default_int
label_desc: Use image node_id 2 for calling a global function with example usage: test_softmax_bernoulli_equivalence(num, dimX, dimF, dimY) without return types