code: def test_to_categorical(self, shape, expected_shape):
      label = np.random.randint(0, NUM_CLASSES, shape)
      one_hot = numerical_utils.to_categorical(label, NUM_CLASSES)
      # Check shape
      self.assertEqual(one_hot.shape, expected_shape)
      # Make sure there is only one 1 in a row
      self.assertTrue(np.all(one_hot.sum(axis=-1) == 1))
      # Get original labels back from one hots
      self.assertTrue(
          np.all(np.argmax(one_hot, -1).reshape(label.shape) == label)
      )
  
file_path: keras/keras/utils/numerical_utils_test.py
imports: import numpy
  from absl.testing import parameterized
  from keras import backend
  from keras import testing
  from keras.utils import numerical_utils
label_desc: Use image node_id 1 for calling the TestNumericalUtils obj's underlying member method code with example usage: obj.test_to_categorical(shape, expected_shape) without return types