Create a new `OptimWrapper` from `self` with another `layer_groups` but the same hyper-parameters.
(self, layer_groups)
| 119 | return opt |
| 120 | |
| 121 | def new(self, layer_groups): |
| 122 | "Create a new `OptimWrapper` from `self` with another `layer_groups` but the same hyper-parameters." |
| 123 | opt_func = getattr(self, 'opt_func', self.opt.__class__) |
| 124 | split_groups = split_bn_bias(layer_groups) |
| 125 | opt = opt_func([{'params': trainable_params(l), 'lr': 0} for l in split_groups]) |
| 126 | return self.create(opt_func, self.lr, layer_groups, wd=self.wd, true_wd=self.true_wd, bn_wd=self.bn_wd) |
| 127 | |
| 128 | def __repr__(self) -> str: |
| 129 | return f'OptimWrapper over {repr(self.opt)}.\nTrue weight decay: {self.true_wd}' |
no test coverage detected