提交 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(
import sys, os, StringIO
from copy import copy
import theano
import gof
from theano import config
from gof import Op, Apply
......@@ -428,9 +429,8 @@ def pydotprint(fct, outfile=None,
if outfile is None:
outfile = os.path.join(config.compiledir,'theano.pydotprint.' +
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 fct.__class__.__name__ in ['Function','ScanInnerFunction']:
if isinstance(fct, (Function, theano.scan_module.scan_utils.ScanInnerFunction)):
mode = fct.maker.mode
fct_env = fct.maker.env
if not isinstance(mode,ProfileMode) or not mode.fct_call.has_key(fct):
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论