本文整理匯總了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,
)