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

Don't shadow type that is reused in error handling.

上级 71b85fd6
...@@ -255,15 +255,15 @@ def constant(x, name=None, ndim=None, dtype=None): ...@@ -255,15 +255,15 @@ def constant(x, name=None, ndim=None, dtype=None):
assert len(bcastable) == ndim assert len(bcastable) == ndim
try: try:
type = TensorType(dtype=x_.dtype, broadcastable=bcastable) ttype = TensorType(dtype=x_.dtype, broadcastable=bcastable)
if not constant.enable: if not constant.enable:
return TensorConstant(type, x_, name=name) return TensorConstant(ttype, x_, name=name)
sig = TensorConstantSignature((type, x_)) sig = TensorConstantSignature((ttype, x_))
if sig in constant_cache: if sig in constant_cache:
return constant_cache[sig] return constant_cache[sig]
ret = TensorConstant(type, x_, name=name) ret = TensorConstant(ttype, x_, name=name)
if (x_.size == 1 and if (x_.size == 1 and
(-10) <= x_ <= 10 and (-10) <= x_ <= 10 and
(x_.dtype in int_dtypes or x_.dtype in uint_dtypes or (x_.dtype in int_dtypes or x_.dtype in uint_dtypes or
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论