utils.py 文件源码

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

项目:sound_field_analysis-py 作者: QULab 项目源码 文件源码
def scalar_broadcast_match(a, b):
    """ Returns arguments as np.array, if one is a scalar it will broadcast the other one's shape.
    """
    a, b = np.atleast_1d(a, b)
    if a.size == 1 and b.size != 1:
        a = np.broadcast_to(a, b.shape)
    elif b.size == 1 and a.size != 1:
        b = np.broadcast_to(b, a.shape)
    return a, b
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号