def test_multiple_sequential_views(self):
        """
        Check that we convert a sequence of reshape(unsqueeze(reshape(...)))
        into a single reshape() call.
        """
        dtype = "float"
        x0_shape = [2, 4, 8]
        y_shape = [8, 2, 4]

        x0 = Tensor(
            shape=x0_shape,
            dtype=dtype,
            name="x0",
            is_input=True,
        )
        x1 = ops.reshape()(x0, [8, 8])
        x2 = ops.unsqueeze(dim=1)(x1)
        x3 = ops.reshape()(x2, [8, 1, 2, 4])
        y = ops.reduce_sum(dim=1)(x3)
        y._attrs["name"] = "y"
        y._attrs["is_output"] = True

        x0_pt = get_random_torch_tensor(x0_shape, dtype)
        y_pt = get_torch_empty_tensor(y_shape, dtype)

        target = detect_target()
        module = compile_model(
            y,
            target,
            "./tmp",
            "test_multiple_sequential_views",
        )
        result_graph = module.debug_sorted_graph
        module.run_with_tensors({"x0": x0_pt}, {"y": y_pt})

        self.assertEqual(len(result_graph), 3)
        self.assertFalse(graph_has_op(result_graph, "unsqueeze"))

        expected = torch.reshape(x0_pt, y_shape)
        torch.testing.assert_close(expected, y_pt, atol=5e-2, rtol=5e-2)

        Check that we convert a sequence of reshape(unsqueeze(reshape(...)))
        into a single reshape() call.
        
tests/unittest/compiler/test_merge_view_ops.py