当前位置: 首页>>代码示例>>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;未经允许,请勿转载。