提交 6751357d authored 作者: Frederic Bastien's avatar Frederic Bastien

better print of some ops.

上级 bbf39b2b
...@@ -1168,6 +1168,8 @@ class ScalarFromTensor(Op): ...@@ -1168,6 +1168,8 @@ class ScalarFromTensor(Op):
out[0] = s.flatten()[0] out[0] = s.flatten()[0]
def grad(self, (s,), (dt,)): def grad(self, (s,), (dt,)):
return [TensorFromScalar(dt)] return [TensorFromScalar(dt)]
def __str__(self):
return self.__class__.__name__
scalar_from_tensor = ScalarFromTensor() scalar_from_tensor = ScalarFromTensor()
......
...@@ -71,6 +71,8 @@ class GemmRelated(Op): ...@@ -71,6 +71,8 @@ class GemmRelated(Op):
return (type(self) == type(other)) return (type(self) == type(other))
def __hash__(self): def __hash__(self):
return hash(type(self)) return hash(type(self))
def __str__(self):
return self.__class__.__name__
def c_support_code(self): def c_support_code(self):
#return cblas_header_text() #return cblas_header_text()
mod_str = """ mod_str = """
......
...@@ -495,7 +495,8 @@ class CrossentropySoftmaxArgmax1HotWithBias(gof.Op): ...@@ -495,7 +495,8 @@ class CrossentropySoftmaxArgmax1HotWithBias(gof.Op):
return type(self) == type(other) return type(self) == type(other)
def __hash__(self): def __hash__(self):
return tensor.hashtype(self) return tensor.hashtype(self)
def __str__(self):
return self.__class__.__name__
def make_node(self, x, b, y_idx): def make_node(self, x, b, y_idx):
x = tensor.as_tensor_variable(x) x = tensor.as_tensor_variable(x)
b = tensor.as_tensor_variable(b) b = tensor.as_tensor_variable(b)
...@@ -673,6 +674,8 @@ class CrossentropySoftmax1HotWithBiasDx (gof.Op): ...@@ -673,6 +674,8 @@ class CrossentropySoftmax1HotWithBiasDx (gof.Op):
return type(self) == type(other) return type(self) == type(other)
def __hash__(self): def __hash__(self):
return tensor.hashtype(self) return tensor.hashtype(self)
def __str__(self):
return self.__class__.__name__
def make_node(self, dy, sm, y_idx,**kwargs): def make_node(self, dy, sm, y_idx,**kwargs):
dy = tensor.as_tensor_variable(dy) dy = tensor.as_tensor_variable(dy)
sm = tensor.as_tensor_variable(sm) sm = tensor.as_tensor_variable(sm)
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论