reroute_test.py 文件源码

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

项目:DeepLearning_VirtualReality_BigData_Project 作者: rashmitripathi 项目源码 文件源码
def test_reroute_can_modify(self):
    graph = ops.Graph()
    # create a special graph where "a" is an ambiguous tensor. That is
    # it is both an input and an output of the ops in sgv0.
    with graph.as_default():
      a = constant_op.constant(1.0, shape=[2], name="a")
      b = constant_op.constant(2.0, shape=[2], name="b")
      c = math_ops.add(a, b, name="c")
      d = math_ops.add(a, c, name="d")

      e = constant_op.constant(1.0, shape=[2], name="e")
      f = constant_op.constant(2.0, shape=[2], name="f")
      g = math_ops.add(e, f, name="g")

    sgv0 = ge.sgv(a.op, b.op, c.op)
    sgv1 = ge.sgv(e.op, f.op)

    ge.swap_outputs(sgv0, sgv1)
    self.assertTrue(
        ge.OpMatcher("g").input_ops("a", ge.OpMatcher("c").input_ops("a", "b"))(
            g.op))
    self.assertTrue(ge.OpMatcher("d").input_ops("e", "f")(d.op))
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号