```
for epoch in range(n_epochs):
for i in range(1):
sp_idx = np.random.randint(0, Xtrain.shape[0], batch_size)
images = Xtrain[sp_idx, :,:]
labels = ytrain[sp_idx]
images = images.reshape(-1, time_step, input_size)
# forward pass
outputs, _= model(images)
loss = criterion(outputs, labels)
# backward and optimize
optimizer.zero_grad()
loss.backward()
torch.nn.utils.clip_grad_norm_(model.parameters(), 5)
optimizer.step()
train_losses.append(loss.item())
print("Train Loss", train_losses)
outputs, outputs_prob = model(Xtest) #TLNN
test_loss = criterion(outputs, ytest)
valid_losses.append(test_loss.item())
print("Validation Losses", valid_losses)
_, predicted = torch.max(outputs_prob.data, 1)
predicted_prob = outputs_prob[:,1]
accu = accuracy_score(ytest, predicted)
cof_mat = confusion_matrix(predicted, ytest)
try:
accu_all.append(accu)
auc_all.append(roc_auc_score(ytest.detach().numpy(), predicted_prob.detach().numpy()))
f1_all.append(f1_score(ytest.detach().numpy(), predicted))
recall_all.append(recall_score(ytest, predicted))
precise_all.append(precision_score(ytest, predicted))
except Exception as e:
print(e, 'excepted')
continue
train_loss = np.average(train_losses)
valid_loss = np.average(valid_losses)
avg_train_losses.append(train_loss)
avg_valid_losses.append(valid_loss)
epoch_len = len(str(n_epochs))
```

How to find Training accuracy in this neural network? I am trying to plot Training accuracy , training loss ad valid loss for this network. @ptrblck