docstr: Regression test for compiled functions that return an aliased buffer.
  
  XLA returns aliased buffers if outputs are identical. Tests that
  we handle that case.
docstr_tok: ["Regression","test","for","compiled","functions","that","return","an","aliased","buffer",".","XLA","returns","aliased","buffers","if","outputs","are","identical",".","Tests","that","we","handle","that","case","."]
code: def testAliasing(self):
      """Regression test for compiled functions that return an aliased buffer.
  
      XLA returns aliased buffers if outputs are identical. Tests that
      we handle that case.
      """
  
      def AddOnceReturnTwice(x):
          y = math_ops.add(x, x)
          return y, y
  
      # Exercises compiling a function (say, Foo) which calls another function
      # (say, Bar) which is not inlined. When the compiler compiles Foo, it needs
      # to symbolically execute Bar correctly regardless of whether Bar is inlined
      # or not.
  
      # Tests compiled=True and noinline=True.
      self._compare(
          AddOnceReturnTwice,
          [np.array([[[0.5, -1.0]]], dtype=np.float32)],
          name="AddOnceReturnTwice_inline",
          noinline=True,
      )
  
      # Tests compiled=True and noinline=False.
      self._compare(
          AddOnceReturnTwice,
          [np.array([[[0.5, -1.0]]], dtype=np.float32)],
          name="AddOnceReturnTwice_noinline",
          noinline=False,
      )
  
imports: import os
  import numpy
  from tensorflow.compiler.tests import test_utils
  from tensorflow.core.protobuf import config_pb2
  from tensorflow.core.protobuf import rewriter_config_pb2
  from tensorflow.python.client import session
  from tensorflow.python.compiler.xla import jit
  from tensorflow.python.framework import constant_op
  from tensorflow.python.framework import dtypes
  from tensorflow.python.framework import function
  from tensorflow.python.framework import ops
  from tensorflow.python.ops import array_ops
  from tensorflow.python.ops import cond
  from tensorflow.python.ops import control_flow_ops
  from tensorflow.python.ops import gradients_impl
  from tensorflow.python.ops import math_ops
  from tensorflow.python.ops import nn_ops
  from tensorflow.python.ops import while_loop
  from tensorflow.python.platform import test
label_desc: Use image node_id 3 for calling the JitLaunchTest obj's underlying member method code with example usage: obj.testAliasing() and returns: y,  y