提交 1c8c114c authored 作者: James Bergstra's avatar James Bergstra

better error msg from resolve_variable

上级 dd6d2b15
...@@ -11,7 +11,6 @@ from theano.printing import pprint ...@@ -11,7 +11,6 @@ from theano.printing import pprint
from collections import defaultdict from collections import defaultdict
from itertools import chain from itertools import chain
from functools import partial from functools import partial
from copy import copy
import io, sys import io, sys
import function_module as F import function_module as F
from mode import default_mode from mode import default_mode
...@@ -291,13 +290,14 @@ class Method(Component): ...@@ -291,13 +290,14 @@ class Method(Component):
This works by searching the attribute list of the Module to which this Method is bound. This works by searching the attribute list of the Module to which this Method is bound.
""" """
def resolve_variable(x, passthrough=(gof.Variable)): def resolve_variable(x, passthrough=(gof.Variable,)):
if isinstance(x, passthrough): if isinstance(x, passthrough):
return x return x
elif isinstance(x, _RComponent): elif isinstance(x, _RComponent):
return x.r return x.r
else: else:
raise Exception('Cannot resolve symbol', x) raise Exception('The following thing is not of the following types', x,
passthrough + (_RComponent,))
# return self.resolve(x).r # return self.resolve(x).r
def resolve_inputs(): def resolve_inputs():
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论