Example #1
0
def nll_prior(net, cont_logistic, net_interval, step, x):
    if step % net_interval == 0:
        global logit
        logit = net(x)

    # Continous or discretized logistic
    if cont_logistic: logistic = nl_logistic_mixture_continous_test(x, logit)
    else: logistic = discretized_mix_logistic_loss_1d(x, logit)

    del logit

    return logistic
def nll_prior(net, net_interval, step, x):
    if step%net_interval == 0:
        global logit
        logit = net(x) #.detach() TEST
#    else:
#        with torch.no_grad():   
#        #x_nograd = x.detach()
#            logit = net(x)
            
    logistic = nl_logistic_mixture_continous_test(x, logit)
    
    return logistic
def nll_prior(net, cont_logistic, net_interval, step, x):
    if step % net_interval == 0:
        global logit
        logit = net(x)  #.detach() TEST
#    else:
#        with torch.no_grad():
#        #x_nograd = x.detach()
#            logit = net(x)

# Continous or discretized logistic
    if cont_logistic: logistic = nl_logistic_mixture_continous_test(x, logit)
    else: logistic = discretized_mix_logistic_loss_1d(x, logit)

    return logistic
def nll_prior(net, net_interval, step, x):
    #    if step%net_interval == 0:
    #        global logit

    xs = [int(y) for y in x.size()]

    x_rot = img_rot90(x)
    x_rotavg = x_rot

    x_rotavg = x_rotavg + torch.zeros([4] + xs[1:]).to(device)

    for i in range(1, 4):
        x_rot = img_rot90(x_rot)
        x_rotavg[i] = x_rot

    #print(x_rotavg.size())
    logit = net(x_rotavg)

    logistic = nl_logistic_mixture_continous_test(x_rotavg, logit) / 4

    return logistic