跳转到主要内容

允许下游兼容Numpy兼容数组的包

项目描述

Numpy兼容数组向下兼容的库。

用法

对于替代数组实现

import numpy as np
import arrayish as ai


class CustomArray(object):
    """Your custom ``ndarray`` compatible implementation."""
    pass


def dot(a, b, out=None)
    """ Your custom implementation of ``np.dot``. """
    pass


# Between your own arrays
ai.dot.add((CustomArray, CustomArray), dot)

# With Numpy Arrays, if you'd like. Can also pass another function
ai.dot.add((np.ndarray, CustomArray), dot)
ai.dot.add((CustomArray, np.ndarray), dot)

对于愿意支持替代数组的下游库

import arrayish as ai
import numpy as np

# Instead of this:
np.dot(a, b)

# Do this:
ai.dot(a, b)

项目详情


下载文件

为您的平台下载文件。如果您不确定要选择哪个,请了解更多关于 安装包 的信息。

源分布

arrayish-0.0.1.tar.gz (19.3 kB 查看哈希值)

上传时间:

构建分布

arrayish-0.0.1-py2.py3-none-any.whl (2.7 kB 查看哈希值)

上传于 Python 2 Python 3

由以下支持

AWS AWS 云计算和安全赞助商 Datadog Datadog 监控 Fastly Fastly CDN Google Google 下载分析 Microsoft Microsoft PSF 赞助商 Pingdom Pingdom 监控 Sentry Sentry 错误日志 StatusPage StatusPage 状态页面