Unverified 提交 149976c2 authored 作者: Brandon T. Willard's avatar Brandon T. Willard 提交者: GitHub

Remove restrictive type assertion (#3)

上级 34c503b3
......@@ -165,8 +165,7 @@ class NumpyAutocaster(object):
def __call__(self, x):
# Make sure we only deal with scalars.
assert (isinstance(x, six.integer_types) or
isinstance(x, builtin_float) or
assert (isinstance(x, (six.integer_types, builtin_float)) or
(isinstance(x, np.ndarray) and x.ndim == 0))
if config.cast_policy == 'numpy':
......@@ -280,7 +279,7 @@ def convert(x, dtype=None):
x_ = np.asarray(x)
if x_.size == 0 and not hasattr(x, 'dtype'):
x_ = np.asarray(x, dtype=config.floatX)
assert type(x_) in [np.ndarray, np.memmap]
assert issubclass(type(x_), (np.ndarray, np.memmap))
return x_
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论