提交 2288924e authored 作者: Olivier Delalleau's avatar Olivier Delalleau

Fixed crash introduced in fdc11984cb9d when using e.g. a list as input to a…

Fixed crash introduced in fdc11984cb9d when using e.g. a list as input to a theano function instead of an ndarray
上级 ca4ad1ee
......@@ -584,7 +584,8 @@ class TensorType(Type):
# We use the `values_eq` static function from TensorType
# to handle NaN values.
if TensorType.values_eq(data, converted_data,
force_same_dtype=False):
force_same_dtype=False,
convert_as_array=True):
data = converted_data
else:
# Do not print a too long description of data
......@@ -664,7 +665,10 @@ class TensorType(Type):
return False
@staticmethod
def values_eq(a, b, force_same_dtype=True):
def values_eq(a, b, force_same_dtype=True, convert_as_array=False):
if convert_as_array:
a = numpy.asarray(a)
b = numpy.asarray(b)
#TODO: check to see if the dtype and shapes must match
# for now, we err on safe side...
if a.shape != b.shape:
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论