本文整理汇总了Python中keras.initializers.Initializer方法的典型用法代码示例。如果您正苦于以下问题:Python initializers.Initializer方法的具体用法?Python initializers.Initializer怎么用?Python initializers.Initializer使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类keras.initializers
的用法示例。
在下文中一共展示了initializers.Initializer方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get_config
# 需要导入模块: from keras import initializers [as 别名]
# 或者: from keras.initializers import Initializer [as 别名]
def get_config(self):
""" Return the ICNR Initializer configuration.
Returns
-------
dict
The configuration for ICNR Initialization
"""
config = {"scale": self.scale,
"initializer": self.initializer
}
base_config = super(ICNR, self).get_config()
return dict(list(base_config.items()) + list(config.items()))
示例2: set_dimensions
# 需要导入模块: from keras import initializers [as 别名]
# 或者: from keras.initializers import Initializer [as 别名]
def set_dimensions(self):
"""Locate given hyperparameters that are `space` choice declarations and add them to
:attr:`dimensions`"""
all_dimension_choices = []
#################### Remap Extra Objects ####################
if self.module_name == "keras":
from keras.initializers import Initializer as KerasInitializer
from keras.callbacks import Callback as KerasCB
self.init_iter_attrs.append(lambda _p, _k, _v: isinstance(_v, KerasInitializer))
self.extra_iter_attrs.append(lambda _p, _k, _v: isinstance(_v, KerasCB))
#################### Collect Choice Dimensions ####################
init_dim_choices = get_choice_dimensions(self.model_init_params, self.init_iter_attrs)
extra_dim_choices = get_choice_dimensions(self.model_extra_params, self.extra_iter_attrs)
fe_dim_choices = get_choice_dimensions(self.feature_engineer, self.fe_iter_attrs)
for (path, choice) in init_dim_choices:
choice._name = ("model_init_params",) + path
all_dimension_choices.append(choice)
for (path, choice) in extra_dim_choices:
choice._name = ("model_extra_params",) + path
all_dimension_choices.append(choice)
for (path, choice) in fe_dim_choices:
choice._name = ("feature_engineer",) + path
all_dimension_choices.append(choice)
self.dimensions = all_dimension_choices
if self.module_name == "keras":
self.model_extra_params = link_choice_ids(
self.dummy_layers,
self.dummy_compile_params,
self.model_extra_params,
self.dimensions,
)