def test_remove_thousands_random_transpose_layers_case_2(self):
        """
        Same test as the previous one, but add more layers and dimension.
        """
        import random
        from itertools import permutations

        random.seed(0)
        input_shape = (3, 10, 5, 2, 4)
        input_features = [("data", datatypes.Array(*input_shape))]
        output_features = [("out", None)]
        builder = neural_network.NeuralNetworkBuilder(
            input_features, output_features, disable_rank5_shape_mapping=True
        )

        num_layers = 5000
        dim = 5
        input_name = "data"
        for i in range(num_layers):
            axes = list(permutations(range(dim)))
            random.shuffle(axes)
            output_name = "layer_" + str(i) + "_output"
            name = "layer_" + str(i)
            builder.add_transpose(
                name=name, axes=axes[0], input_name=input_name, output_name=output_name
            )
            input_name = output_name
        builder.add_activation(
            name="relu", non_linearity="RELU", input_name=input_name, output_name="out"
        )
        self._test_builder(builder, input_shape, None)

        Same test as the previous one, but add more layers and dimension.
        
coremltools/converters/mil/backend/nn/passes/test_mlmodel_passes.py