提交 a042720c authored 作者: James Bergstra's avatar James Bergstra

TensorType.filter uses theano._asarray to fix dtype.num

上级 2b6f019a
...@@ -547,7 +547,9 @@ class TensorType(Type): ...@@ -547,7 +547,9 @@ class TensorType(Type):
if ((type(data) is numpy.ndarray) if ((type(data) is numpy.ndarray)
and dtype_eq(data.dtype, self.numpy_dtype)): and dtype_eq(data.dtype, self.numpy_dtype)):
pass # fall through to ndim check if data.dtype.num != self.numpy_dtype.num:
data = theano._asarray(data, dtype=self.dtype)
# -- now fall through to ndim check
elif strict: elif strict:
# If any of the two conditions above was not met, # If any of the two conditions above was not met,
# we raise a meaningful TypeError. # we raise a meaningful TypeError.
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论