code: def test_from_4d_image_with_invalid_shape(rank):
      errors = (ValueError, tf.errors.InvalidArgumentError)
      with pytest.raises(errors, match="`image` must be 4D tensor"):
          img_utils.from_4D_image(tf.ones(shape=(2, 4)), rank)
  
      with pytest.raises(errors, match="`image` must be 4D tensor"):
          img_utils.from_4D_image(tf.ones(shape=(2, 4, 1)), rank)
  
      with pytest.raises(errors, match="`image` must be 4D tensor"):
          img_utils.from_4D_image(tf.ones(shape=(1, 2, 4, 1, 1)), rank)
  
file_path: addons/tensorflow_addons/image/tests/utils_test.py
imports: import pytest
  import numpy
  import tensorflow
  from tensorflow_addons.image import utils
label_desc: Use image node_id 7 for calling a global function with example usage: test_from_4d_image_with_invalid_shape(rank) without return types