當前位置: 首頁>>代碼示例>>Python>>正文


Python utility.make_scheduler方法代碼示例

本文整理匯總了Python中utility.make_scheduler方法的典型用法代碼示例。如果您正苦於以下問題:Python utility.make_scheduler方法的具體用法?Python utility.make_scheduler怎麽用?Python utility.make_scheduler使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在utility的用法示例。


在下文中一共展示了utility.make_scheduler方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: __init__

# 需要導入模塊: import utility [as 別名]
# 或者: from utility import make_scheduler [as 別名]
def __init__(self, args, loader, my_model, my_loss, ckp):
        self.args = args
        self.scale = args.scale

        self.ckp = ckp
        self.loader_train = loader.loader_train
        self.loader_test = loader.loader_test
        self.model = my_model
        self.loss = my_loss
        self.optimizer = utility.make_optimizer(args, self.model)
        self.scheduler = utility.make_scheduler(args, self.optimizer)

        if self.args.load != '':
            self.optimizer.load_state_dict(
                torch.load(os.path.join(ckp.dir, 'optimizer.pt'))
            )
            for _ in range(len(ckp.log)): self.scheduler.step()

        self.error_last = 1e8 
開發者ID:HolmesShuan,項目名稱:OISR-PyTorch,代碼行數:21,代碼來源:trainer.py

示例2: __init__

# 需要導入模塊: import utility [as 別名]
# 或者: from utility import make_scheduler [as 別名]
def __init__(self, args, loader, my_model, my_loss, ckp):
        super(TrainerFT, self).__init__(args, loader, my_model, my_loss, ckp)
        # self.args = args
        # self.scale = args.scale
        #
        # self.ckp = ckp
        # self.loader_train = loader.loader_train
        # self.loader_test = loader.loader_test
        # self.model = my_model
        # self.loss = my_loss
        if self.args.model.lower() == 'finetune':
            self.optimizer = self.make_optimizer(args, self.model)
        # self.scheduler = utility.make_scheduler(args, self.optimizer)
        #
        # if self.args.load != '.':
        #     self.optimizer.load_state_dict(
        #         torch.load(os.path.join(ckp.dir, 'optimizer.pt'))
        #     )
        #     for _ in range(len(ckp.log)): self.scheduler.step()
        #
        # self.error_last = 1e8 
開發者ID:ofsoundof,項目名稱:3D_Appearance_SR,代碼行數:23,代碼來源:trainer_finetune.py

示例3: __init__

# 需要導入模塊: import utility [as 別名]
# 或者: from utility import make_scheduler [as 別名]
def __init__(self, args, loader, my_model, my_loss, ckp):
        self.args = args
        self.scale = args.scale

        self.ckp = ckp
        self.loader_train = loader.loader_train
        self.loader_test = loader.loader_test
        self.model = my_model
        self.loss = my_loss
        self.optimizer = utility.make_optimizer(args, self.model)
        self.scheduler = utility.make_scheduler(args, self.optimizer)

        if self.args.load != '.':
            self.optimizer.load_state_dict(
                torch.load(os.path.join(ckp.dir, 'optimizer.pt'))
            )
            for _ in range(len(ckp.log)): self.scheduler.step()

        self.error_last = 1e8 
開發者ID:ofsoundof,項目名稱:3D_Appearance_SR,代碼行數:21,代碼來源:trainer.py

示例4: __init__

# 需要導入模塊: import utility [as 別名]
# 或者: from utility import make_scheduler [as 別名]
def __init__(self, args, loader, my_model, my_loss, ckp):
        self.args = args
        self.scale = args.scale

        self.ckp = ckp
        self.loader_train = loader.loader_train
        self.loader_test = loader.loader_test
        self.model = my_model
        self.loss = my_loss
        self.optimizer = utility.make_optimizer(args, self.model)
        self.scheduler = utility.make_scheduler(args, self.optimizer)

        if self.args.load != '.':
            self.optimizer.load_state_dict(
                torch.load(os.path.join(ckp.dir, 'optimizer.pt'))
            )
            for _ in range(len(ckp.log)): self.scheduler.step()

        self.error_last = 1e8
        del args,ckp,my_model,my_loss 
開發者ID:yyknight,項目名稱:NTIRE2019_EDRN,代碼行數:22,代碼來源:trainer.py

示例5: __init__

# 需要導入模塊: import utility [as 別名]
# 或者: from utility import make_scheduler [as 別名]
def __init__(self, args, gan_type):
        super(Adversarial, self).__init__()
        self.gan_type = gan_type
        self.gan_k = args.gan_k
        self.discriminator = discriminator.Discriminator(args, gan_type)
        if gan_type != 'WGAN_GP':
            self.optimizer = utility.make_optimizer(args, self.discriminator)
        else:
            self.optimizer = optim.Adam(
                self.discriminator.parameters(),
                betas=(0, 0.9), eps=1e-8, lr=1e-5
            )
        self.scheduler = utility.make_scheduler(args, self.optimizer) 
開發者ID:HolmesShuan,項目名稱:OISR-PyTorch,代碼行數:15,代碼來源:adversarial.py


注:本文中的utility.make_scheduler方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。