Correct way to calculate FLOPS in model

The error said it very well:

ValueError: In training mode, targets should be passed

Set model.eval() in order to make predictions with the model.