def test_efficient_type_inference():
        """
        A bug was found in type inference, a large tensor gets produced from np.arange when the end index is large. This made the conversion extremely slow.
        """
        start_time = time.time()

        @mb.program(
            input_specs=[
                mb.TensorSpec(
                    shape=[
                        20,
                    ]
                )
            ]
        )
        def prog(x):
            # end is max int32
            res = mb.slice_by_index(
                x=x,
                begin=[0],
                end=[2147483647],
                stride=[1],
            )
            assert res.shape == (20,)

            # end > max int32
            res = mb.slice_by_index(
                x=x,
                begin=[0],
                end=[214748364700],
                stride=[1],
            )
            assert res.shape == (20,)
            return x

        assert time.time() - start_time < 0.01

        A bug was found in type inference, a large tensor gets produced from np.arange when the end index is large. This made the conversion extremely slow.
        
coremltools/converters/mil/mil/ops/tests/iOS14/test_tensor_transformation.py