def load(self, sess, checkpoint_dir, step=None):
    print(' [*] Reading checkpoints...')
    model_name = 'deblur.model'
    ckpt = tf.train.get_checkpoint_state(checkpoint_dir)
    if (step is not None):
        ckpt_name = ((model_name + '-') + str(step))
        self.saver.restore(sess, os.path.join(checkpoint_dir, ckpt_name))
        print(' [*] Reading intermediate checkpoints... Success')
        return str(step)
    elif (ckpt and ckpt.model_checkpoint_path):
        ckpt_name = os.path.basename(ckpt.model_checkpoint_path)
        ckpt_iter = ckpt_name.split('-')[1]
        self.saver.restore(sess, os.path.join(checkpoint_dir, ckpt_name))
        print(' [*] Reading updated checkpoints... Success')
        return ckpt_iter
    else:
        print(' [*] Reading checkpoints... ERROR')
        return False
def load(self, sess, checkpoint_dir, step=None):
    print(' [*] Reading checkpoints...')
    model_name = 'deblur.model'
    ckpt = tf.train.get_checkpoint_state(checkpoint_dir)
    if (step is not None):
        ckpt_name = ((model_name + '-') + str(step))
        self.saver.restore(sess, os.path.join(checkpoint_dir, ckpt_name))
        print(' [*] Reading intermediate checkpoints... Success')
        return str(step)
    elif (ckpt and ckpt.model_checkpoint_path):
        ckpt_name = os.path.basename(ckpt.model_checkpoint_path)
        ckpt_iter = ckpt_name.split('-')[1]
        self.saver.restore(sess, os.path.join(checkpoint_dir, ckpt_name))
        print(' [*] Reading updated checkpoints... Success')
        return ckpt_iter
    else:
        print(' [*] Reading checkpoints... ERROR')
        return False