def evaluate(model, test_dl, criterion):
model.eval()
epoch_loss = 0
epoch_score =0
with torch.no_grad():

     for inputs, labels in test_dl:
        src = inputs.to(device)
        trg = inputs.to(device)
        labels=labels.to(device)
        rec_inputs,trg_inputs,pred,attn_weights = model(src,0) #turn off teacher forcing
        #denormalize predictions 
        pred=pred*denormalization
        rul_loss = criterion(pred.squeeze(), labels)
        score = scoring_func(pred.squeeze()-labels)
    
        epoch_loss += rul_loss.item()
        epoch_score += score
return epoch_loss / len(test_dl),epoch_score