    def test_simple_output_alias(self, test_name="simple_output_alias"):
        """
        Case: Simple case where an output aliases an internal tensor.
        Graph: ( gelu ) <--view-- ( output )
        """
        x = gen_input_tensor(shape=self.SHAPE, name="input_x")
        gelu = ops.elementwise(FuncEnum.GELU)(x)  # has an output alias
        output0 = ops.flatten()(gelu)
        output0._attrs["is_output"] = True
        output0._attrs["name"] = "output_0"

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

        view_name = output0._attrs["is_view_of"]._attrs["name"]
        expected_codegen = (
            set_value(
                view_name,
                f"static_cast<decltype({view_name})>(params_[1].ptr)",
            ),
        )
        self._assert_codegen_exists(
            test_name, expected_codegen, self.MODEL_GENERATED_FILE
        )
Case: Simple case where an output aliases an internal tensor.
Graph: ( gelu ) <--view-- ( output )
tests/unittest/backend/test_codegen_output_aliases.py