提交 dbeedc15 authored 作者: Arnaud Bergeron's avatar Arnaud Bergeron

Have different instances of the inputs to support inplace ops.

上级 eb2f4398
...@@ -122,12 +122,15 @@ def makeTester(name, op, gpu_op, cases, checks=None, mode_gpu=mode_with_gpu, ...@@ -122,12 +122,15 @@ def makeTester(name, op, gpu_op, cases, checks=None, mode_gpu=mode_with_gpu,
raise SkipTest(skip) raise SkipTest(skip)
for testname, inputs in cases.items(): for testname, inputs in cases.items():
self.run_case(testname, self.run_case(testname, inputs)
[theano.shared(input) for input in inputs])
def run_case(self, testname, inputs): def run_case(self, testname, inputs):
inputs_ref = [theano.shared(inp) for inp in inputs]
inputs_tst = [theano.shared(inp) for inp in inputs]
try: try:
node = safe_make_node(self.op, *inputs) node_ref = safe_make_node(self.op, *inputs_ref)
node_tst = safe_make_node(self.op, *inputs_tst)
except Exception, exc: except Exception, exc:
err_msg = ("Test %s::%s: Error occured while making " err_msg = ("Test %s::%s: Error occured while making "
"a node with inputs %s") % (self.gpu_op, testname, "a node with inputs %s") % (self.gpu_op, testname,
...@@ -136,8 +139,8 @@ def makeTester(name, op, gpu_op, cases, checks=None, mode_gpu=mode_with_gpu, ...@@ -136,8 +139,8 @@ def makeTester(name, op, gpu_op, cases, checks=None, mode_gpu=mode_with_gpu,
raise raise
try: try:
f_ref = inplace_func([], node.outputs, mode=mode_nogpu) f_ref = inplace_func([], node_ref.outputs, mode=mode_nogpu)
f_tst = inplace_func([], node.outputs, mode=mode_gpu) f_tst = inplace_func([], node_tst.outputs, mode=mode_gpu)
except Exception, exc: except Exception, exc:
err_msg = ("Test %s::%s: Error occured while trying to " err_msg = ("Test %s::%s: Error occured while trying to "
"make a Function") % (self.gpu_op, testname) "make a Function") % (self.gpu_op, testname)
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论