Found during #1299. When `maximize` is true and `grad` is false, this (in some optimizers' `step` method) will definitely throw an exception:  For instance:  I will try to fix this after #1299 has been merged.