Is there a way to generate an array of the loss printed in terminal during iterations? For the purposes of plotting the loss over the iterations?