I’m unsure what virtual_step() does and assume it’s coming from a 3rd party library?
Do you know, if this method expects all .grad attributes to be set and if so, could you filter the frozen parameters out while passing them to the optimizer?