code: def test_subset_matrix():
      mat = tf.range(5)[None, :] * tf.range(5)[:, None]
      inds_0 = [2, 3]
      inds_1 = [2, 1, 4]
  
      sub_mat = subset_matrix(
          mat, tf.constant(inds_0), tf.constant(inds_1)
      )
      assert sub_mat.shape == (2, 3)
      for i, ind_0 in enumerate(inds_0):
          for j, ind_1 in enumerate(inds_1):
              assert sub_mat[i, j] == ind_0 * ind_1
  
      with pytest.raises(ValueError):
          subset_matrix(tf.ones((10, 10, 10)), inds_0, inds_1)
      with pytest.raises(ValueError):
          subset_matrix(tf.ones((10,)), inds_0, inds_1)
  
file_path: alibi-detect/alibi_detect/utils/tensorflow/tests/test_misc_tf.py
imports: from itertools import product
  import pytest
  import tensorflow
  from tensorflow.keras.layers import Dense, Input, InputLayer
  import numpy
  from alibi_detect.utils.tensorflow import zero_diag, quantile, subset_matrix
  from alibi_detect.utils.tensorflow.misc import clone_model
label_desc: Use image node_id 4 for calling a global function with example usage: test_subset_matrix() without return types