当前位置: 首页>>代码示例>>Python>>正文


Python extension.Extension方法代码示例

本文整理汇总了Python中chainer.training.extension.Extension方法的典型用法代码示例。如果您正苦于以下问题:Python extension.Extension方法的具体用法?Python extension.Extension怎么用?Python extension.Extension使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在chainer.training.extension的用法示例。


在下文中一共展示了extension.Extension方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: adadelta_eps_decay

# 需要导入模块: from chainer.training import extension [as 别名]
# 或者: from chainer.training.extension import Extension [as 别名]
def adadelta_eps_decay(eps_decay):
    """Extension to perform adadelta eps decay.

    Args:
        eps_decay (float): Decay rate of eps.

    Returns:
        An extension function.

    """

    @training.make_extension(trigger=(1, "epoch"))
    def adadelta_eps_decay(trainer):
        _adadelta_eps_decay(trainer, eps_decay)

    return adadelta_eps_decay 
开发者ID:espnet,项目名称:espnet,代码行数:18,代码来源:asr_utils.py

示例2: adam_lr_decay

# 需要导入模块: from chainer.training import extension [as 别名]
# 或者: from chainer.training.extension import Extension [as 别名]
def adam_lr_decay(eps_decay):
    """Extension to perform adam lr decay.

    Args:
        eps_decay (float): Decay rate of lr.

    Returns:
        An extension function.

    """

    @training.make_extension(trigger=(1, "epoch"))
    def adam_lr_decay(trainer):
        _adam_lr_decay(trainer, eps_decay)

    return adam_lr_decay 
开发者ID:espnet,项目名称:espnet,代码行数:18,代码来源:asr_utils.py

示例3: restore_snapshot

# 需要导入模块: from chainer.training import extension [as 别名]
# 或者: from chainer.training.extension import Extension [as 别名]
def restore_snapshot(model, snapshot, load_fn=chainer.serializers.load_npz):
    """Extension to restore snapshot.

    Returns:
        An extension function.

    """

    @training.make_extension(trigger=(1, "epoch"))
    def restore_snapshot(trainer):
        _restore_snapshot(model, snapshot, load_fn)

    return restore_snapshot 
开发者ID:espnet,项目名称:espnet,代码行数:15,代码来源:asr_utils.py

示例4: torch_snapshot

# 需要导入模块: from chainer.training import extension [as 别名]
# 或者: from chainer.training.extension import Extension [as 别名]
def torch_snapshot(savefun=torch.save, filename="snapshot.ep.{.updater.epoch}"):
    """Extension to take snapshot of the trainer for pytorch.

    Returns:
        An extension function.

    """

    @extension.make_extension(trigger=(1, "epoch"), priority=-100)
    def torch_snapshot(trainer):
        _torch_snapshot_object(trainer, trainer, filename.format(trainer), savefun)

    return torch_snapshot 
开发者ID:espnet,项目名称:espnet,代码行数:15,代码来源:asr_utils.py


注:本文中的chainer.training.extension.Extension方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。