def train(epoch):
    model.train()
    tr_loss = 0
    x_train, y_train = Variable(train_x), Variable(train_y)
    x_val, y_val = Variable(val_x), Variable(val_y)
    if torch.cuda.is_available():
        x_train = x_train.cuda()
        y_train = y_train.cuda()
        x_val = x_val.cuda()
        y_val = y_val.cuda()

    
    optimizer.zero_grad()
    output_train = model(x_train.float())
    output_val = model(x_val.float())
    output_train  = torch.randn(2604, 1)
    y_train = torch.randint(2, (2604, 1)).float() 
    loss_train = criterion(output_train, y_train)
    output_val  = torch.randn(2604, 1)
    y_val = torch.randint(2, (2604, 1)).float() 
    loss_val = criterion(output_val, y_val)
    train_losses.append(loss_train)
    val_losses.append(loss_val)

with torch.no_grad():
        output1 = model((train_x.float()))     
        softmax1 = torch.exp(output1).cpu()    
        prob1 = list(softmax1.numpy())
        predictions1 = np.argmax(prob1, axis=1)
        predictions1 = predictions1.argmax()
        train_y = train_y.numpy()
        print('Validation accuracy train: {:.4f}%'.format(float(accuracy_score(train_y, predictions1) * 100)))

@the-dharma-bum  error