提交 1b4e0a49 authored 作者: Frederic Bastien's avatar Frederic Bastien

add __str__ fct and add compiled version of ops.

上级 55f53e8e
......@@ -14,6 +14,8 @@ class Multinomial(Op):
return type(self) == type(other)
def __hash__(self):
return hash(type(self))
def __str__(self):
return self.__class__.__name__
def make_node(self, pvals, unis):
pvals = T.as_tensor_variable(pvals)
unis = T.as_tensor_variable(unis)
......
......@@ -15,6 +15,8 @@ class Images2Neibs(Op):
return type(self) == type(other)
def __hash__(self):
return hash(type(self))
def __str__(self):
return self.__class__.__name__
def make_node(self, ten4, neib_shape):
ten4 = T.as_tensor_variable(ten4)
neib_shape = T.as_tensor_variable(neib_shape)
......@@ -24,8 +26,7 @@ class Images2Neibs(Op):
return [None, None]
def c_code_cache_version(self):
return ()
#return (1,)
return (2,)
def c_code(self, node, name, (ten4, neib_shape), (z,), sub):
......@@ -168,8 +169,7 @@ class GpuImages2Neibs(Images2Neibs):
dtype=ten4.type.dtype)()])
def c_code_cache_version(self):
return ()
#return (1,)
return (2,)
def c_support_code_apply(self, node, nodename):
return """
......
......@@ -142,6 +142,9 @@ class mrg_uniform_base(Op):
def __hash__(self):
return hash(type(self)) ^ hash(self.output_type) ^ hash(self.inplace)
def __str__(self):
return self.__class__.__name__+"{%s,%s}"%(self.output_type,
"inplace" if self.inplace else "no_inplace")
def make_node(self, rstate, size):
# error checking slightly redundant here, since
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论