    def test_view_of_view(self, test_name="view_of_view"):
        """
        Case: There's two intermediate views, where one is a view of the other.
        Graph: ( input ) <--view-- ( intermediate0 ) <--view-- ( intermediate1 ) <--view-- ( output_0 )
        """
        x = gen_input_tensor(shape=self.SHAPE, name="input_x")
        intermediate0 = ops.unsqueeze(dim=0)(x)  # has an output alias
        intermediate1 = ops.unsqueeze(dim=0)(intermediate0)  # has an output alias
        output0 = ops.flatten()(intermediate1)
        output0._attrs["is_output"] = True
        output0._attrs["name"] = "output_0"

        compile_model(
            output0,
            detect_target(),
            self.WORKDIR,
            test_name,
            do_optimize_graph=False,
        )

        intermediate0_name = intermediate0._attrs["name"]
        intermediate1_name = intermediate1._attrs["name"]
        expected_codegen = (
            set_value(intermediate0_name, "input_x"),
            set_value(intermediate1_name, intermediate0_name),
        )
        self._assert_codegen_exists(
            test_name, expected_codegen, self.MODEL_GENERATED_FILE
        )
Case: There's two intermediate views, where one is a view of the other.
Graph: ( input ) <--view-- ( intermediate0 ) <--view-- ( intermediate1 ) <--view-- ( output_0 )
tests/unittest/backend/test_codegen_output_aliases.py