MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / testAliasing

Method testAliasing

tensorflow/compiler/tests/jit_test.py:150–176  ·  view source on GitHub ↗

Regression test for compiled functions that return an aliased buffer. XLA returns aliased buffers if outputs are identical. Tests that we handle that case.

(self)

Source from the content-addressed store, hash-verified

148 test_utils.RunWithWarmup(sess, call, {})
149
150 def testAliasing(self):
151 """Regression test for compiled functions that return an aliased buffer.
152
153 XLA returns aliased buffers if outputs are identical. Tests that
154 we handle that case.
155 """
156
157 def AddOnceReturnTwice(x):
158 y = math_ops.add(x, x)
159 return y, y
160
161 # Exercises compiling a function (say, Foo) which calls another function
162 # (say, Bar) which is not inlined. When the compiler compiles Foo, it needs
163 # to symbolically execute Bar correctly regardless of whether Bar is inlined
164 # or not.
165
166 # Tests compiled=True and noinline=True.
167 self._compare(
168 AddOnceReturnTwice, [np.array([[[0.5, -1.0]]], dtype=np.float32)],
169 name="AddOnceReturnTwice_inline",
170 noinline=True)
171
172 # Tests compiled=True and noinline=False.
173 self._compare(
174 AddOnceReturnTwice, [np.array([[[0.5, -1.0]]], dtype=np.float32)],
175 name="AddOnceReturnTwice_noinline",
176 noinline=False)
177
178 def testOneConstOutput(self):
179 """Test consisting of a single constant return value."""

Callers

nothing calls this directly

Calls 1

_compareMethod · 0.95

Tested by

no test coverage detected