    def test_double_alias(self, test_name="double_alias"):
        """
        Case: Two outputs are a view of the same tensor.
        Graph: ( gelu ) <--view-- ( output_0 )
                        <--view-- ( output_1 )
        Expected: gelu will be initialized with params_[2]
        """
        # AIT, two outputs.
        x = gen_input_tensor(shape=self.SHAPE, name="input_x")
        gelu = ops.elementwise(FuncEnum.GELU)(x)  # has an output alias
        output0 = ops.unsqueeze(dim=0)(gelu)
        output0._attrs["is_output"] = True
        output0._attrs["name"] = "output_0"

        output1 = ops.flatten()(gelu)
        output1._attrs["is_output"] = True
        output1._attrs["name"] = "output_1"

        compile_model(
            [output0, output1],
            detect_target(),
            self.WORKDIR,
            test_name,
            do_optimize_graph=True,
        )

        view_name = output0._attrs["is_view_of"]._attrs["name"]
        expected_codegen = (
            # input_x assigned to params_[0].ptr
            set_value(
                view_name,
                f"static_cast<decltype({view_name})>(params_[2].ptr)",
                # see _construct_output_name_to_index_map for params indexing
            ),
        )
        self._assert_codegen_exists(
            test_name, expected_codegen, self.MODEL_GENERATED_FILE
        )
Case: Two outputs are a view of the same tensor.
Graph: ( gelu ) <--view-- ( output_0 )
<--view-- ( output_1 )
Expected: gelu will be initialized with params_[2]
tests/unittest/backend/test_codegen_output_aliases.py