提交 46c420be authored 作者: Ian Goodfellow's avatar Ian Goodfellow

added a zeros_like method for scalars

上级 dd801b30
...@@ -488,6 +488,9 @@ class _scalar_py_operators: ...@@ -488,6 +488,9 @@ class _scalar_py_operators:
def __rmod__(self,other): return mod(other,self) def __rmod__(self,other): return mod(other,self)
def __rpow__(self,other): return pow(other,self) def __rpow__(self,other): return pow(other,self)
def zeros_like(self):
return ScalarConstant(Scalar(str(self.type.dtype)), 0)
class ScalarVariable(_scalar_py_operators, Variable): class ScalarVariable(_scalar_py_operators, Variable):
pass pass
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论