(self)
return global_step
Restores model and optimizer checkpoints and ensures global step is in sync.
Restores model and optimizer checkpoints and ensures global step is in sync.
Restores model and optimizer checkpoints and ensures global step is in sync .
def _restore_models_and_step(self):
        """
        Restores model and optimizer checkpoints and ensures global step is in sync.
        """
        global_step_D = global_step_G = 0

        if self.netD_ckpt_file and os.path.exists(self.netD_ckpt_file):
            print("INFO: Restoring checkpoint for D...")
            global_step_D = self.netD.restore_checkpoint(
                ckpt_file=self.netD_ckpt_file, optimizer=self.optD)

        if self.netG_ckpt_file and os.path.exists(self.netG_ckpt_file):
            print("INFO: Restoring checkpoint for G...")
            global_step_G = self.netG.restore_checkpoint(
                ckpt_file=self.netG_ckpt_file, optimizer=self.optG)

        if global_step_G != global_step_D:
            raise ValueError('G and D Networks are out of sync.')
        else:
            global_step = global_step_G  # Restores global step

        return global_step
def _restore_models_and_step ( self ) : global_step_D = global_step_G = 0 if self . netD_ckpt_file and os . path . exists ( self . netD_ckpt_file ) : print ( "INFO: Restoring checkpoint for D..." ) global_step_D = self . netD . restore_checkpoint ( ckpt_file = self . netD_ckpt_file , optimizer = self . optD ) if self . netG_ckpt_file and os . path . exists ( self . netG_ckpt_file ) : print ( "INFO: Restoring checkpoint for G..." ) global_step_G = self . netG . restore_checkpoint ( ckpt_file = self . netG_ckpt_file , optimizer = self . optG ) if global_step_G != global_step_D : raise ValueError ( 'G and D Networks are out of sync.' ) else : global_step = global_step_G # Restores global step return global_step