coreNode.py 文件源码

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

项目:graphAttack 作者: jgolebiowski 项目源码 文件源码
def broadcast_shape(shp1, shp2):
    """Broadcast the shape of those arrays

    Parameters
    ----------
    shp1 : tuple
        shape of array 1
    shp2 : tuple
        shape of array 2

    Returns
    -------
    tuple
        shape resulting from broadcasting two arrays using numpy rules

    Raises
    ------
    ValueError
        Arrays cannot be broadcasted
    """
    try:
        return np.broadcast(np.empty(shp1), np.empty(shp2)).shape
    except ValueError:
        raise ValueError("Arrays cannot be broadcasted - %s and %s " % (str(shp1), str(shp2)))
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号