def test_gather_nd_invalid_indices(self, compute_unit, backend):
        """
        This test is to verify that TensorFlow GatherNd op doesn't allow negative nor out-of-range
        indices, so don't need mb.select for IOS17 mb.gather when lowering TensorFlow GatherNd op.
        Use TensorFlowBaseTest.run_compare_tf to make this test compatible with both TF1 and TF2.
        """

        @make_tf_graph([[2, 2, tf.int32]])
        def build_model(indices):
            params = tf.constant([[0.0, 1.0], [2.0, 3.0]])
            return tf.gather_nd(params, indices)

        model, inputs, outputs = build_model

        with pytest.raises(
            tf.errors.InvalidArgumentError,
            match="\[1, -1\] does not index into param shape \[2,2\]",
        ):
            # Negative indices will error out.
            input_dict = dict(zip(inputs, [np.array([[0, 0], [1, -1]], dtype=np.int32)]))
            TensorFlowBaseTest.run_compare_tf(
                model,
                input_dict,
                outputs,
                compute_unit=compute_unit,
                backend=backend,
            )
        with pytest.raises(
            tf.errors.InvalidArgumentError, match="\[2, 0\] does not index into param shape \[2,2\]"
        ):
            # Out-of-range indices will error out.
            input_dict = dict(zip(inputs, [np.array([[2, 0], [1, 1]], dtype=np.int32)]))
            TensorFlowBaseTest.run_compare_tf(
                model,
                input_dict,
                outputs,
                compute_unit=compute_unit,
                backend=backend,
            )

        This test is to verify that TensorFlow GatherNd op doesn't allow negative nor out-of-range
        indices, so don't need mb.select for IOS17 mb.gather when lowering TensorFlow GatherNd op.
        Use TensorFlowBaseTest.run_compare_tf to make this test compatible with both TF1 and TF2.
        
coremltools/converters/mil/frontend/tensorflow/test/test_ops.py