    def test_identity_reshape_out_out_conflict(self):
        """
        If y0 and y1 are both output tensors, then we can only eliminate one
        view op in the following example:

          y1 = reshape(reshape(y0, some_shape), y0_original_shape)
        """
        dtype = "float"
        x0_shape = [2, 4, 8]
        y_shape = [2, 8]

        x0 = Tensor(
            shape=x0_shape,
            dtype=dtype,
            name="x0",
            is_input=True,
        )
        y0 = ops.reduce_sum(dim=1)(x0)
        y0._attrs["name"] = "y0"
        y0._attrs["is_output"] = True

        x1 = ops.reshape()(y0, [4, 4])

        y1 = ops.reshape()(x1, y_shape)
        y1._attrs["name"] = "y1"
        y1._attrs["is_output"] = True

        x0_pt = get_random_torch_tensor(x0_shape, dtype)
        y0_pt = get_torch_empty_tensor(y_shape, dtype)
        y1_pt = get_torch_empty_tensor(y_shape, dtype)

        target = detect_target()
        module = compile_model(
            [y0, y1],
            target,
            "./tmp",
            "test_identity_reshape_out_out_conflict",
        )
        result_graph = module.debug_sorted_graph
        module.run_with_tensors({"x0": x0_pt}, {"y0": y0_pt, "y1": y1_pt})

        y_expected = torch.sum(x0_pt, 1)

        self.assertEqual(len(result_graph), 3)
        sorted_ops = graph_utils.get_sorted_ops(result_graph)
        self.assertEqual(count_ops(sorted_ops, "reshape"), 1)
        torch.testing.assert_close(y_expected, y0_pt, atol=5e-2, rtol=5e-2)
        torch.testing.assert_close(y_expected, y1_pt, atol=5e-2, rtol=5e-2)
If y0 and y1 are both output tensors, then we can only eliminate one
view op in the following example:

y1 = reshape(reshape(y0, some_shape), y0_original_shape)
tests/unittest/compiler/test_merge_view_ops.py