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

Code clean up

上级 ec99e722
...@@ -246,15 +246,11 @@ def constant_or_value(x, rtype, name=None, ndim=None, dtype=None): ...@@ -246,15 +246,11 @@ def constant_or_value(x, rtype, name=None, ndim=None, dtype=None):
try: try:
if rtype is TensorConstant: if rtype is TensorConstant:
x_ = x_.copy()
rval = rtype( rval = rtype(
TensorType(dtype=x_.dtype, broadcastable=bcastable), TensorType(dtype=x_.dtype, broadcastable=bcastable),
x_.copy(),
name=name)
return rval
else:
# leave the shape out of the type
return rtype(TensorType(dtype=x_.dtype, broadcastable=bcastable),
x_, name=name) x_, name=name)
return rval
except Exception: except Exception:
raise TypeError("Could not convert %s to TensorType" % x, type(x)) raise TypeError("Could not convert %s to TensorType" % x, type(x))
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论