code: def test_bool_indexing():
      t = ones((100, 200, 300))
      indexed = t[t < 2]
      assert len(indexed.shape) == 1
      assert np.isnan(indexed.shape[0])
  
      t2 = ones((100, 200))
      indexed = t[t2 < 2]
      assert len(indexed.shape) == 2
      assert np.isnan(indexed.shape[0])
      assert indexed.shape[1] == 300
  
      t2 = ones((100, 200))
      indexed = t[t2 < 2] + 1
      assert len(indexed.shape) == 2
      assert np.isnan(indexed.shape[0])
      assert indexed.shape[1] == 300
  
      t2 = ones((10, 20))
      rs = np.random.RandomState(0)
      i1 = np.zeros(10, dtype=bool)
      i1[rs.permutation(np.arange(10))[:5]] = True
      i2 = np.zeros(20, dtype=bool)
      i2[rs.permutation(np.arange(20))[:5]] = True
      indexed = t2[i1, i2]
      assert len(indexed.shape) == 1
      assert indexed.shape[0] == 5
  
      t2 = tile(indexed)
      assert t2.chunks[0].index == (0,)
  
      t3 = ones((101, 200))
      with pytest.raises(IndexError) as cm:
          _ = t[t3 < 2]  # noqa: F841
      e = cm.value.args[0]
      assert "along dimension 0" in e
      assert (
          "dimension is 100 but corresponding boolean dimension is 101"
          in e
      )
  
      t4 = ones((100, 201))
      with pytest.raises(IndexError) as cm:
          _ = t[t4 < 2]  # noqa: F841
      e = cm.value.args[0]
      assert "along dimension 1" in e
      assert (
          "dimension is 200 but corresponding boolean dimension is 201"
          in e
      )
  
imports: import numpy
  import pytest
  from ....config import option_context
  from ....core import tile
  from ...base.broadcast_to import TensorBroadcastTo
  from ...datasource import ones, tensor, array, empty
  from ...datasource.ones import TensorOnes
  from ...merge.concatenate import TensorConcatenate
  from ..None import choose, unravel_index, nonzero, compress, fill_diagonal
  from ..setitem import TensorIndexSetValue
label_desc: Use image node_id 1 for calling a global function with example usage: test_bool_indexing() without return types