Here is my code.
Can you check this code?
if mlp:
    mlp_train_inputs = torch.cuda.FloatTensor(50000, 48)
    mlp_test_inputs = torch.cuda.FloatTensor(10000, 48)
    mlp_train_targets = torch.cuda.LongTensor(50000)
    mlp_test_targets = torch.cuda.LongTensor(10000)

    for batch_idx, (inputs, targets) in enumerate(train_loader2):
        mlp_train_inputs = F.max_pool2d(inputs, kernel_size=8, stride=8).view(F.max_pool2d(inputs, kernel_size=8, stride=8).size(0),-1).cuda()

    for batch_idx, (inputs, targets) in enumerate(test_loader2):
        mlp_test_inputs = F.max_pool2d(inputs, kernel_size=8, stride=8).view(F.max_pool2d(inputs, kernel_size=8, stride=8).size(0),-1).cuda()

    # print(mlp_train_inputs)

    f_small_train = open("20171130_small_MLP_train_targets.txt", "r")
    f_small_test = open("20171130_small_MLP_test_targets.txt", "r")

    for i in range(0,50000):
        mlp_train_targets[i] = int(f_small_train.readline())
    f_small_train.close()

    print(mlp_train_inputs)
    print(mlp_train_targets)

    for i in range(0,10000):
        mlp_test_targets[i] = int(f_small_test.readline())
    f_small_test.close()

    # print(mlp_test_targets)

    mlp_train_dataset = torch.utils.data.TensorDataset(mlp_train_inputs, mlp_train_targets)
    # mlp_test_dataset = torch.utils.data.TensorDataset(mlp_test_inputs, mlp_test_targets)

    #print(mlp_train_dataset)

    mlp_train_loader = torch.utils.data.DataLoader(mlp_train_dataset, batch_size=10000, drop_last=False)
    # mlp_test_loader = torch.utils.data.DataLoader(mlp_test_dataset, batch_size=10000, drop_last=False)

    # print(mlp_train_loader)
    # print(enumerate(mlp_train_loader))

# Small MLP Training
def mlp_train(epoch):
    print('\nEpoch: %d' % epoch)
    net2.train()
    train_loss = 0
    correct = 0
    total = 0

    for batch_idx, (inputs, targets) in enumerate(mlp_train_loader):
        if use_cuda:
            inputs, targets = inputs.cuda(), targets.cuda()
        optimizer2.zero_grad()
        inputs, targets = Variable(inputs), Variable(targets)
        outputs = net2(inputs)
        loss = criterion(outputs, targets)
        loss.backward()
        optimizer2.step()

        train_loss += loss.data[0]
        _, predicted = torch.max(outputs.data, 1)
        total += targets.size(0)
        correct += predicted.eq(targets.data).cpu().sum()

        progress_bar(batch_idx, len(mlp_train_loader), 'Loss: %.3f | Acc: %.3f%% (%d/%d)'
            % (train_loss/(batch_idx+1), 100.*correct/total, correct, total))

if mlp:
    if mlptr:
        for epoch in range(start_epoch, start_epoch + num_epoch):
            mlp_train(epoch)