Thanks! That sounds like a good idea, however now after I corrected according to this suggestion, I have an error:
TypeError: optimizer can only optimize Variables, but one of the params is parameters