提交 d321401b authored 作者: Frederic Bastien's avatar Frederic Bastien

Add x.ones_like() as x.zeros_like()

上级 f9234897
......@@ -1339,7 +1339,7 @@ def _float_ones_like(x):
if dtype not in tensor.float_dtypes:
dtype = theano.config.floatX
return tensor.ones_like(x, dtype=dtype)
return x.ones_like(dtype=dtype)
class numeric_grad(object):
......
......@@ -731,6 +731,9 @@ class _tensor_py_operators(object):
def zeros_like(model, dtype=None):
return theano.tensor.basic.zeros_like(model, dtype=dtype)
def ones_like(model, dtype=None):
return theano.tensor.basic.ones_like(model, dtype=dtype)
def cumsum(self, axis=None):
return theano.tensor.extra_ops.cumsum(self, axis)
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论