提交 b75fc56a authored 作者: Ramana.S's avatar Ramana.S

Removed make_node method and corrected the test

上级 07b2896e
...@@ -517,17 +517,7 @@ class FromFunctionOp(gof.Op): ...@@ -517,17 +517,7 @@ class FromFunctionOp(gof.Op):
def __str__(self): def __str__(self):
return 'FromFunctionOp{%s}' % self.__fn.__name__ return 'FromFunctionOp{%s}' % self.__fn.__name__
def make_node(self, *inputs):
if len(inputs) != len(self.itypes):
raise ValueError("We expected %d inputs but got %d." %
(len(self.itypes), len(inputs)))
if not all(inp.type == it for inp, it in zip(inputs, self.itypes)):
raise TypeError(
"We expected inputs of types '%s' but got types '%s' " %
(str([inp.type for inp in inputs]), str(self.itypes)))
return theano.Apply(self, inputs, [o() for o in self.otypes])
def perform(self, node, inputs, outputs): def perform(self, node, inputs, outputs):
outs = self.__fn(*inputs) outs = self.__fn(*inputs)
if not isinstance(outs, (list, tuple)): if not isinstance(outs, (list, tuple)):
......
...@@ -248,7 +248,7 @@ class TestMakeThunk(unittest.TestCase): ...@@ -248,7 +248,7 @@ class TestMakeThunk(unittest.TestCase):
output = outputs[0] output = outputs[0]
output[0] = inp * 2 output[0] = inp * 2
x_input = T.matrix('x_input') x_input = T.dmatrix('x_input')
f = theano.function([x_input], DoubleOp()(x_input)) f = theano.function([x_input], DoubleOp()(x_input))
inp = numpy.random.rand(5, 4) inp = numpy.random.rand(5, 4)
out = f(inp) out = f(inp)
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论