def run_check_net():
    batch_size = 32
    C, H, W = 3, 128, 128
    num_class = 2

    input = np.random.uniform(0, 1, (batch_size, C, H, W)).astype(np.float32)
    truth = np.random.choice(num_class, batch_size).astype(np.float32)

    #------------
    input = torch.from_numpy(input).float().cuda()
    truth = torch.from_numpy(truth).long().cuda()

    input = to_var(input)
    truth = to_var(truth)

    #---
    criterion = softmax_cross_entropy_criterion
    net = Net(num_class).cuda()
    net.set_mode('backup')
    print(net)

    logit = net.forward(input)
    loss = criterion(logit, truth)
def run_check_net():    
    num_class = 2
    x = torch.rand(36, 9, 48, 48)
    net = Net(num_class)
    output = net.forward(x)