提交 39dc64fe authored 作者: Frederic's avatar Frederic

revert 187603d6 sa this break tests and cause…

revert 187603d6 sa this break tests and cause problem with the grad in conjunction with the default value or on_ununsed_input.
上级 a480810c
...@@ -2650,8 +2650,6 @@ def ones_like(model, dtype=None): ...@@ -2650,8 +2650,6 @@ def ones_like(model, dtype=None):
"""equivalent of numpy.ones_like""" """equivalent of numpy.ones_like"""
if dtype is None: if dtype is None:
dtype = model.type.dtype dtype = model.type.dtype
if model.ndim == 0 and isinstance(model.type, TensorType):
return constant(1.0, dtype=dtype)
ret = fill(model, constant(1.0, dtype=dtype)) ret = fill(model, constant(1.0, dtype=dtype))
return ret return ret
...@@ -2661,8 +2659,6 @@ def zeros_like(model, dtype=None): ...@@ -2661,8 +2659,6 @@ def zeros_like(model, dtype=None):
"""equivalent of numpy.zeros_like""" """equivalent of numpy.zeros_like"""
if dtype is None: if dtype is None:
dtype = model.type.dtype dtype = model.type.dtype
if model.ndim == 0 and isinstance(model.type, TensorType):
return constant(0.0, dtype=dtype)
return fill(model, constant(0.0, dtype=dtype)) return fill(model, constant(0.0, dtype=dtype))
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论