tensor.py 文件源码

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

项目:Python-iBeacon-Scan 作者: NikNitro 项目源码 文件源码
def __pow__(self, other):
        if self.data is None:
            raise ValueError("No power without ndarray data.")
        numpy = import_module('numpy')
        free = self.free

        marray = self.data
        for metric in free:
            marray = numpy.tensordot(
                marray,
                numpy.tensordot(
                    metric[0]._tensortype.data,
                    marray,
                    (1, 0)
                ),
                (0, 0)
            )
        pow2 = marray[()]
        return pow2 ** (Rational(1, 2) * other)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号