code: def test_hard_distribution(Y_shape, num_classes):
      """Test transforming a soft labels or label encodings to one-hot encoding."""
      if Y_shape > 1:
          Y = np.random.randn(10, Y_shape)
          Y_ohe = get_hard_distribution(Y)
      else:
          Y = np.random.randint(low=0, high=num_classes, size=10)
          Y_ohe = get_hard_distribution(Y, num_classes=num_classes)
  
      assert np.all(np.sum(Y_ohe, axis=1) == 1)
  
imports: from typing import Union, List
  import pytest
  from pytest_lazyfixture import lazy_fixture
  import numpy
  from numpy.testing import assert_allclose
  import tensorflow
  import tensorflow.keras
  from alibi.explainers import CounterfactualRLTabular
  from alibi.explainers.backends.cfrl_base import get_hard_distribution
  from alibi.explainers.backends.cfrl_tabular import get_he_preprocessor, split_ohe, get_numerical_conditional_vector, get_categorical_conditional_vector, get_statistics, get_conditional_vector, sample
label_desc: Use image node_id 6 for calling a global function with example usage: test_hard_distribution(Y_shape, num_classes) without return types