提交 b2669a40 authored 作者: Frederic Bastien's avatar Frederic Bastien

use isinstance to identify a Theano function instead of name.

上级 02f5d851
...@@ -4,6 +4,7 @@ They all allow different way to print a graph or the result of an Op in a graph( ...@@ -4,6 +4,7 @@ They all allow different way to print a graph or the result of an Op in a graph(
import sys, os, StringIO import sys, os, StringIO
from copy import copy from copy import copy
import theano
import gof import gof
from theano import config from theano import config
from gof import Op, Apply from gof import Op, Apply
...@@ -428,9 +429,8 @@ def pydotprint(fct, outfile=None, ...@@ -428,9 +429,8 @@ def pydotprint(fct, outfile=None,
if outfile is None: if outfile is None:
outfile = os.path.join(config.compiledir,'theano.pydotprint.' + outfile = os.path.join(config.compiledir,'theano.pydotprint.' +
config.device + '.' + format) config.device + '.' + format)
# I did this to avoid import scan_module.scan_utils, which would lead to
# a cycle import that I did not know how to solve if isinstance(fct, (Function, theano.scan_module.scan_utils.ScanInnerFunction)):
if fct.__class__.__name__ in ['Function','ScanInnerFunction']:
mode = fct.maker.mode mode = fct.maker.mode
fct_env = fct.maker.env fct_env = fct.maker.env
if not isinstance(mode,ProfileMode) or not mode.fct_call.has_key(fct): if not isinstance(mode,ProfileMode) or not mode.fct_call.has_key(fct):
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论