提交 72e62e50 authored 作者: Frederic Bastien's avatar Frederic Bastien

[CRASH] fix crash. fix gh-5291.

上级 a7900bd8
......@@ -250,12 +250,7 @@ class PyDotFormatter(object):
pd_node.get_attributes()['subg_map_inputs'] = h
# Outputs mapping
ext_outputs = []
for n in topo:
for i in n.inputs:
h = i.owner if i.owner else i
if h is node:
ext_outputs.append(self.__node_id(n))
ext_outputs = [self.__node_id(x) for x in node.outputs]
int_outputs = node.op.fn.maker.fgraph.outputs
int_outputs = [gf.__node_id(x) for x in int_outputs]
assert len(ext_outputs) == len(int_outputs)
......
......@@ -56,3 +56,15 @@ class Ofg(object):
self.inputs = [x, y, z]
self.outputs = [e2]
class OfgSimple(object):
def __init__(self):
x, y, z = T.scalars('xyz')
e = T.nnet.sigmoid((x + y + z)**2)
op = th.OpFromGraph([x, y, z], [e])
e2 = op(x, y, z)
self.inputs = [x, y, z]
self.outputs = [e2]
......@@ -54,3 +54,8 @@ class TestD3Viz(unittest.TestCase):
m = models.OfgNested()
f = th.function(m.inputs, m.outputs)
self.check(f)
def test_ofg_simple(self):
m = models.OfgSimple()
f = th.function(m.inputs, m.outputs)
self.check(f)
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论