utils.py 文件源码

python
阅读 20 收藏 0 点赞 0 评论 0

项目:spyking-circus 作者: spyking-circus 项目源码 文件源码
def _assert_all_finite(X):
    """Like assert_all_finite, but only for ndarray."""
    X = np.asanyarray(X)
    # First try an O(n) time, O(1) space solution for the common case that
    # everything is finite; fall back to O(n) space np.isfinite to prevent
    # false positives from overflow in sum method.
    if (X.dtype.char in np.typecodes['AllFloat'] and not np.isfinite(X.sum())
            and not np.isfinite(X).all()):
        raise ValueError("Input contains NaN, infinity"
                         " or a value too large for %r." % X.dtype)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号