hfdp:

FILE.write("\nEpoch “+str(epoch)+”: Training Loss = " +str(np.sum(trg_loss).max()/len(trg_loss)))


Then would you suggest it wuthout the numpy? aka:
FILE.write("\nEpoch “+str(epoch)+”: Training Loss = " +str(sum(trg_loss).max()/len(trg_loss)))
The NaN also needs to be fixed, but no clue where this comes from yet. Any way to check it quickly?