def make_node(self, *inputs):
"""
Create a "apply" nodes for the inputs in that order.
"""
if not hasattr(self, 'itypes'):
raise NotImplementedError("You can either define itypes and otypes,\
or implement make_node")
if not hasattr(self, 'otypes'):
raise NotImplementedError("You can either define itypes and otypes,\
or implement make_node")
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(self.itypes), str([inp.type for inp in inputs])))
return theano.Apply(self, inputs, [o() for o in self.otypes])
评论列表
文章目录