提交 bfce7e8e authored 作者: Brandon T. Willard's avatar Brandon T. Willard

Add missing FunctionGraph unit tests

上级 1cbd5f2e
差异被折叠。
import numpy as np
from theano.gof.graph import Apply, Variable
from theano.gof.op import Op
from theano.gof.type import Type
......@@ -20,10 +22,25 @@ class MyType(Type):
return hash(MyType)
class MyType2(Type):
def filter(self, data):
return data
def __eq__(self, other):
return isinstance(other, MyType)
def __hash__(self):
return hash(MyType)
def MyVariable(name):
return Variable(MyType(), None, None, name=name)
def MyVariable2(name):
return Variable(MyType2(), None, None, name=name)
class MyOp(Op):
def __init__(self, name, dmap=None, x=None):
self.name = name
......@@ -40,6 +57,9 @@ class MyOp(Op):
outputs = [MyType()()]
return Apply(self, inputs, outputs)
def perform(self, node, inputs, outputs):
outputs[0] = np.array(inputs)
def __str__(self):
return self.name
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论