Set `val` inside the optimizer dictionary at `key`.
(self, key: str, val, bn_groups: bool = True)
| 218 | if 'weight_decay' in self.opt_keys: self._wd = self.read_val('weight_decay') |
| 219 | |
| 220 | def set_val(self, key: str, val, bn_groups: bool = True): |
| 221 | "Set `val` inside the optimizer dictionary at `key`." |
| 222 | if is_tuple(val): val = [(v1, v2) for v1, v2 in zip(*val)] |
| 223 | for v, pg1, pg2 in zip(val, self.opt.param_groups[::2], self.opt.param_groups[1::2]): |
| 224 | pg1[key] = v |
| 225 | if bn_groups: pg2[key] = v |
| 226 | return val |
| 227 | |
| 228 | def read_val(self, key: str): |
| 229 | "Read a hyperparameter `key` in the optimizer dictionary." |