(pos, change, f, dist_f, feat1, feat2, feat1_, feat2_, eff_shape, psize=2)
return best_pos_f, best_dist
Batch Propagation in patch match.
    Params:
        pos(torch.Tensor:2): batch of position
        change(torch.Tensor:2): direction for propagation
        f(torch.Tensor:H*W*2): a \phi_a->b function represented by a tensor relative position
        dist_f(torch.Tensor:H*W): a \phi_a->b function represented by a tensor min dist
        feat*(torch.Tensor:C*H*W): batch features
    Return best_f(torch.Tensor:H*W*2) best_dist_f(torch.Tensor:H*W)
Batch Propagation in patch match.
    Params:
        pos(torch.Tensor:2): batch of position
        change(torch.Tensor:2): direction for propagation
        f(torch.Tensor:H*W*2): a \phi_a->b function represented by a tensor relative position
        dist_f(torch.Tensor:H*W): a \phi_a->b function represented by a tensor min dist
        feat*(torch.Tensor:C*H*W): batch features
    Return best_f(torch.Tensor:H*W*2) best_dist_f(torch.Tensor:H*W)
Batch Propagation in patch match . Params : pos ( torch . Tensor : 2 ) : batch of position change ( torch . Tensor : 2 ) : direction for propagation f ( torch . Tensor : H * W * 2 ) : a \ phi_a - > b function represented by a tensor relative position dist_f ( torch . Tensor : H * W ) : a \ phi_a - > b function represented by a tensor min dist feat * ( torch . Tensor : C * H * W ) : batch features Return best_f ( torch . Tensor : H * W * 2 ) best_dist_f ( torch . Tensor : H * W )
def propagation(pos, change, f, dist_f, feat1, feat2, feat1_, feat2_, eff_shape, psize=2):
    """
    Batch Propagation in patch match.
    Params:
        pos(torch.Tensor:2): batch of position
        change(torch.Tensor:2): direction for propagation
        f(torch.Tensor:H*W*2): a \phi_a->b function represented by a tensor relative position
        dist_f(torch.Tensor:H*W): a \phi_a->b function represented by a tensor min dist
        feat*(torch.Tensor:C*H*W): batch features
    Return best_f(torch.Tensor:H*W*2) best_dist_f(torch.Tensor:H*W)
    """
    y,x = pos
    ew, eh = eff_shape
    best_pos_f = f[y, x]
    best_dist = dist_f[y, x]

    # make the change variable
    ychange, xchange = change
    # Batch pos adding up_change new 2
    if  abs(x - xchange) < ew and x - xchange >= 0:
        yp, xp = f[y, x-xchange]
        xp = xp + xchange
        if xp < ew and xp >= 0:
            best_pos_f, best_dist = improve_guess(pos, (yp, xp), best_pos_f, best_dist, feat1, feat2, feat1_, feat2_, psize)

    if abs(y - ychange) < eh and y-ychange >= 0:
        yp, xp = f[y-ychange, x]
        yp = yp + ychange
        if yp < eh and yp >=0:
            best_pos_f, best_dist = improve_guess(pos, (yp, xp), best_pos_f, best_dist, feat1, feat2, feat1_, feat2_, psize)

    #f, dist_f = update_f_dist_f(pos, f, dist_f, best_pos_f, best_dist)

    return best_pos_f, best_dist
def propagation ( pos , change , f , dist_f , feat1 , feat2 , feat1_ , feat2_ , eff_shape , psize = 2 ) : y , x = pos ew , eh = eff_shape best_pos_f = f [ y , x ] best_dist = dist_f [ y , x ] # make the change variable ychange , xchange = change # Batch pos adding up_change new 2 if abs ( x - xchange ) < ew and x - xchange >= 0 : yp , xp = f [ y , x - xchange ] xp = xp + xchange if xp < ew and xp >= 0 : best_pos_f , best_dist = improve_guess ( pos , ( yp , xp ) , best_pos_f , best_dist , feat1 , feat2 , feat1_ , feat2_ , psize ) if abs ( y - ychange ) < eh and y - ychange >= 0 : yp , xp = f [ y - ychange , x ] yp = yp + ychange if yp < eh and yp >= 0 : best_pos_f , best_dist = improve_guess ( pos , ( yp , xp ) , best_pos_f , best_dist , feat1 , feat2 , feat1_ , feat2_ , psize ) #f, dist_f = update_f_dist_f(pos, f, dist_f, best_pos_f, best_dist) return best_pos_f , best_dist