def update(self, trainer: optimizers.XnmtOptimizer) -> None: self.num_updates_skipped += 1 if self.num_updates_skipped == self.update_every: trainer.update() self.num_updates_skipped = 0 else: assert 0 < self.num_updates_skipped < self.update_every
def update(self, trainer: optimizers.XnmtOptimizer) -> None: """ Update DyNet weights using the given optimizer. Args: trainer: DyNet trainer """ trainer.update()