npmat.py 文件源码

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

项目:DeepNeuralNet-QSAR 作者: Merck 项目源码 文件源码
def add_row_vec(self, vec, target = None):
        """
        Add vector vec to every row of the matrix. If a target is provided,
        it is used to store the result instead of self.
        """

        a, b = self.shape
        a_, b_ = vec.shape

        if not (a_ == 1 and b_ == b):
            raise IncompatibleDimensionsException


        if target is None:
            target = self

        target.resize(self.shape)

        target.numpy_array[:] = vec.numpy_array + self.numpy_array

        return target
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号