提交 645531b9 authored 作者: Pascal Lamblin's avatar Pascal Lamblin

Remove parameter return_ndarray from get_constant_value.

上级 b2e9ea5d
...@@ -405,12 +405,9 @@ def _allclose(a, b): ...@@ -405,12 +405,9 @@ def _allclose(a, b):
return numpy.allclose(a,b, atol=atol, rtol=rtol) return numpy.allclose(a,b, atol=atol, rtol=rtol)
def get_constant_value(v, return_ndarray = False): def get_constant_value(v):
"""return the constant scalar(0-D) value underlying variable `v` """return the constant scalar(0-D) value underlying variable `v`
If ``return_ndarray`` is True, it also returns numpy ndarrays if this is
the content of the constant.
If v is the output of dimshuffles, fills, allocs, rebroadcasts, cast If v is the output of dimshuffles, fills, allocs, rebroadcasts, cast
this function digs through them. this function digs through them.
...@@ -425,8 +422,6 @@ def get_constant_value(v, return_ndarray = False): ...@@ -425,8 +422,6 @@ def get_constant_value(v, return_ndarray = False):
# it is not a constant, but in some cases it *could* be replaced with one. # it is not a constant, but in some cases it *could* be replaced with one.
# Note that this would have an effect on the broadcasting of inputs and so on # Note that this would have an effect on the broadcasting of inputs and so on
try: try:
if return_ndarray and isinstance(v.data, numpy.ndarray):
return v.data
numpy.complex(v.data) #works for all numeric scalars numpy.complex(v.data) #works for all numeric scalars
return v.data return v.data
except: except:
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论