提交 e176c2c7 authored 作者: Yoshua Bengio's avatar Yoshua Bengio

Fixed constant()

上级 07b8cb31
......@@ -44,9 +44,11 @@ def as_tensor(x, name = None):
_as_tensor = as_tensor
def constant(x):
if not isinstance(x, numpy.ndarray):
x = numpy.asarray(x)
def constant(_x):
if not isinstance(_x, numpy.ndarray):
x = numpy.asarray(_x)
else:
x = _x
try:
return TensorConstant(Tensor(dtype = x.dtype,
broadcastable = [d == 1 for d in x.shape]), x)
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论