gelfista.py 文件源码

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

项目:torch-gel 作者: jayanthkoushik 项目源码 文件源码
def make_A(As, ns, use_gpu=False):
    """Create the 3D tensor A as needed by gel_solve, given a list of feature
        matrices.

    Arguments:
        As: list of feature matrices, one per group (size mxn_j).
        ns: LongTensor of group sizes.
        use_gpu: move the final tensor to GPU.
    """
    A = torch.zeros(len(ns), ns.max(), As[0].size()[0])
    for j, n_j in enumerate(ns):
        # Fill A[j] with A_j.T
        A_j = As[j]
        A[j, :n_j, :] = A_j.t()
    if use_gpu:
        A = A.cuda()
    return A
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号