jit_test.py 文件源码

python
阅读 22 收藏 0 点赞 0 评论 0

项目:DeepLearning_VirtualReality_BigData_Project 作者: rashmitripathi 项目源码 文件源码
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 compling a function (say, Foo) which calls another
    # function (say, Bar) which is not inlined. When the compiler compiles
    # Foo, it needs to symbolic execute Bar correctly regardless whether
    # Bar is inlined or not.
    #
    # Tests compiled=True and noinline=True.
    self._compare(
        AddOnceReturnTwice, [np.array(
            [[[0.5, -1.0]]], dtype=np.float32)],
        noinline=True)
    # Tests compiled=True and noinline=False.
    self._compare(
        AddOnceReturnTwice, [np.array(
            [[[0.5, -1.0]]], dtype=np.float32)],
        noinline=False)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号