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


Python optimizers.AdaDelta方法代码示例

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


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

示例1: setUp

# 需要导入模块: from chainer import optimizers [as 别名]
# 或者: from chainer.optimizers import AdaDelta [as 别名]
def setUp(self):
        fd, path = tempfile.mkstemp()
        os.close(fd)
        self.temp_file_path = path

        child = link.Chain()
        with child.init_scope():
            child.linear = links.Linear(2, 3)
            child.Wc = chainer.Parameter(shape=(2, 3))

        self.parent = link.Chain()
        with self.parent.init_scope():
            self.parent.child = child
            self.parent.Wp = chainer.Parameter(shape=(2, 3))

        self.optimizer = optimizers.AdaDelta()
        self.optimizer.setup(self.parent)

        self.parent.cleargrads()
        self.optimizer.update()  # init states 
开发者ID:chainer,项目名称:chainer,代码行数:22,代码来源:test_hdf5.py

示例2: create

# 需要导入模块: from chainer import optimizers [as 别名]
# 或者: from chainer.optimizers import AdaDelta [as 别名]
def create(self):
        return optimizers.AdaDelta(eps=1e-5) 
开发者ID:chainer,项目名称:chainer,代码行数:4,代码来源:test_optimizers_by_linear_model.py

示例3: setUp

# 需要导入模块: from chainer import optimizers [as 别名]
# 或者: from chainer.optimizers import AdaDelta [as 别名]
def setUp(self):
        if self.file_type == 'filename':
            fd, path = tempfile.mkstemp()
            os.close(fd)
            self.file = path
        elif self.file_type == 'bytesio':
            self.file = six.BytesIO()
        else:
            assert False

        child = link.Chain()
        with child.init_scope():
            child.linear = links.Linear(2, 3)
            child.Wc = chainer.Parameter(shape=(2, 3))

        self.parent = link.Chain()
        with self.parent.init_scope():
            self.parent.child = child
            self.parent.Wp = chainer.Parameter(shape=(2, 3))

        self.optimizer = optimizers.AdaDelta()
        self.optimizer.setup(self.parent)

        self.parent.cleargrads()
        self.optimizer.update()  # init all states

        self.savez = numpy.savez_compressed if self.compress else numpy.savez 
开发者ID:chainer,项目名称:chainer,代码行数:29,代码来源:test_npz.py

示例4: set_params

# 需要导入模块: from chainer import optimizers [as 别名]
# 或者: from chainer.optimizers import AdaDelta [as 别名]
def set_params(self, params):

        self.gpu = params.get('gpu',False)
        self.learning_rate = params.get('learning_rate',0.00025)
        self.decay_rate = params.get('decay_rate',0.95)
        self.discount = params.get('discount',0.95)
        self.clip_err = params.get('clip_err',False)
        self.target_net_update = params.get('target_net_update',10000)
        self.double_DQN = params.get('double_DQN',False)

        # setting up various possible gradient update algorithms
        opt = params.get('optim_name', 'ADAM')
        if opt == 'RMSprop':
            self.optimizer = optimizers.RMSprop(lr=self.learning_rate, alpha=self.decay_rate)

        elif opt == 'ADADELTA':
            print("Supplied learning rate not used with ADADELTA gradient update method")
            self.optimizer = optimizers.AdaDelta()

        elif opt == 'ADAM':
            self.optimizer = optimizers.Adam(alpha=self.learning_rate)

        elif opt == 'SGD':
            self.optimizer = optimizers.SGD(lr=self.learning_rate)

        else:
            print('The requested optimizer is not supported!!!')
            exit()

        if self.clip_err is not False:
            self.optimizer.add_hook(chainer.optimizer.GradientClipping(self.clip_err))

        self.optim_name = params['optim_name'] 
开发者ID:sisl,项目名称:Chimp,代码行数:35,代码来源:chainer_backend.py


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