How to convert the value of AverageMeter to int or float?

I stored the average of my losses over each epoch:

losses = AverageMeter()

and now I wish to plot them, so I did something like:

plt.plot((float(losses))

but I get this error:

TypeError: float() argument must be a string or a number, not 'AverageMeter'

If so, how do we convert AverageMeter to a number?

Thank you in advance

I don’t know which implementation of AverageMeter you are using but I would assume you could access its internal attributes such as .val etc.

1 Like