(feat_bp, pmab, layer, shape)
return re_feat_bp.detach()
Return the (i-1)th layer recovered feature from ith layer feature and \phi and ith CNN layer
    Params:
        feat_bp(torch.Tensor): F_BP^L
        pmab(PatchMatch): \phi_[a->b]^L
        layer(torch.Tensor): CNN_[L-1]^L
    Return:
        R_BP^[L-1]
Return the (i-1)th layer recovered feature from ith layer feature and \phi and ith CNN layer
    Params:
        feat_bp(torch.Tensor): F_BP^L
        pmab(PatchMatch): \phi_[a->b]^L
        layer(torch.Tensor): CNN_[L-1]^L
    Return:
        R_BP^[L-1]
Return the ( i - 1 ) th layer recovered feature from ith layer feature and \ phi and ith CNN layer Params : feat_bp ( torch . Tensor ) : F_BP^L pmab ( PatchMatch ) : \ phi_ [ a - > b ] ^L layer ( torch . Tensor ) : CNN_ [ L - 1 ] ^L Return : R_BP^ [ L - 1 ]
def deconvolve(feat_bp, pmab, layer, shape):
    """
    Return the (i-1)th layer recovered feature from ith layer feature and \phi and ith CNN layer
    Params:
        feat_bp(torch.Tensor): F_BP^L
        pmab(PatchMatch): \phi_[a->b]^L
        layer(torch.Tensor): CNN_[L-1]^L
    Return:
        R_BP^[L-1]
    """
    feat_bp = torch2numpy(feat_bp)[0]
    print(feat_bp.shape)
    feat_bp_a = numpy2torch(pmab.reconstruct_avg(feat_bp))[0]
    re_feat_bp = torch.nn.Parameter(torch.zeros(*shape))

    opt = torch.optim.Adam([re_feat_bp], lr=1e-3, weight_decay=0)
    iters = 1000
    for i in range(iters):
        opt.zero_grad()
        out_re_feat_bp = layer(re_feat_bp)
        loss = torch.sum(torch.pow(out_re_feat_bp-feat_bp_a, 2))
        loss.backward()
        opt.step()
    print("loss term:",loss.item())
    #print(re_feat_bp)
    return re_feat_bp.detach()
def deconvolve ( feat_bp , pmab , layer , shape ) : feat_bp = torch2numpy ( feat_bp ) [ 0 ] print ( feat_bp . shape ) feat_bp_a = numpy2torch ( pmab . reconstruct_avg ( feat_bp ) ) [ 0 ] re_feat_bp = torch . nn . Parameter ( torch . zeros ( * shape ) ) opt = torch . optim . Adam ( [ re_feat_bp ] , lr = 1e-3 , weight_decay = 0 ) iters = 1000 for i in range ( iters ) : opt . zero_grad ( ) out_re_feat_bp = layer ( re_feat_bp ) loss = torch . sum ( torch . pow ( out_re_feat_bp - feat_bp_a , 2 ) ) loss . backward ( ) opt . step ( ) print ( "loss term:" , loss . item ( ) ) #print(re_feat_bp) return re_feat_bp . detach ( )