本文整理汇总了Python中keras.utils.conv_utils.normalize_padding方法的典型用法代码示例。如果您正苦于以下问题:Python conv_utils.normalize_padding方法的具体用法?Python conv_utils.normalize_padding怎么用?Python conv_utils.normalize_padding使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类keras.utils.conv_utils
的用法示例。
在下文中一共展示了conv_utils.normalize_padding方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from keras.utils import conv_utils [as 别名]
# 或者: from keras.utils.conv_utils import normalize_padding [as 别名]
def __init__(self, rank,
filters,
kernel_size,
strides=1,
padding='valid',
data_format=None,
dilation_rate=1,
activation=None,
use_bias=True,
kernel_initializer='glorot_uniform',
bias_initializer='zeros',
kernel_regularizer=None,
bias_regularizer=None,
activity_regularizer=None,
kernel_constraint=None,
bias_constraint=None,
spectral_normalization=True,
**kwargs):
super(_ConvSN, self).__init__(**kwargs)
self.rank = rank
self.filters = filters
self.kernel_size = conv_utils.normalize_tuple(kernel_size, rank, 'kernel_size')
self.strides = conv_utils.normalize_tuple(strides, rank, 'strides')
self.padding = conv_utils.normalize_padding(padding)
self.data_format = conv_utils.normalize_data_format(data_format)
self.dilation_rate = conv_utils.normalize_tuple(dilation_rate, rank, 'dilation_rate')
self.activation = activations.get(activation)
self.use_bias = use_bias
self.kernel_initializer = initializers.get(kernel_initializer)
self.bias_initializer = initializers.get(bias_initializer)
self.kernel_regularizer = regularizers.get(kernel_regularizer)
self.bias_regularizer = regularizers.get(bias_regularizer)
self.activity_regularizer = regularizers.get(activity_regularizer)
self.kernel_constraint = constraints.get(kernel_constraint)
self.bias_constraint = constraints.get(bias_constraint)
self.input_spec = InputSpec(ndim=self.rank + 2)
self.spectral_normalization = spectral_normalization
self.u = None
示例2: test_invalid_padding
# 需要导入模块: from keras.utils import conv_utils [as 别名]
# 或者: from keras.utils.conv_utils import normalize_padding [as 别名]
def test_invalid_padding():
with pytest.raises(ValueError):
conv_utils.normalize_padding('diagonal')
示例3: __init__
# 需要导入模块: from keras.utils import conv_utils [as 别名]
# 或者: from keras.utils.conv_utils import normalize_padding [as 别名]
def __init__(self, ch_j, n_j,
kernel_size=(3, 3),
strides=(1, 1),
r_num=1,
b_alphas=[8, 8, 8],
padding='same',
data_format='channels_last',
dilation_rate=(1, 1),
kernel_initializer='glorot_uniform',
bias_initializer='zeros',
kernel_regularizer=None,
activity_regularizer=None,
kernel_constraint=None,
**kwargs):
super(Conv2DCaps, self).__init__(**kwargs)
rank = 2
self.ch_j = ch_j # Number of capsules in layer J
self.n_j = n_j # Number of neurons in a capsule in J
self.kernel_size = conv_utils.normalize_tuple(kernel_size, rank, 'kernel_size')
self.strides = conv_utils.normalize_tuple(strides, rank, 'strides')
self.r_num = r_num
self.b_alphas = b_alphas
self.padding = conv_utils.normalize_padding(padding)
#self.data_format = conv_utils.normalize_data_format(data_format)
self.data_format = K.normalize_data_format(data_format)
self.dilation_rate = (1, 1)
self.kernel_initializer = initializers.get(kernel_initializer)
self.bias_initializer = initializers.get(bias_initializer)
self.kernel_regularizer = regularizers.get(kernel_regularizer)
self.activity_regularizer = regularizers.get(activity_regularizer)
self.kernel_constraint = constraints.get(kernel_constraint)
self.input_spec = InputSpec(ndim=rank + 3)
示例4: __init__
# 需要导入模块: from keras.utils import conv_utils [as 别名]
# 或者: from keras.utils.conv_utils import normalize_padding [as 别名]
def __init__(self, rank,
filters,
kernel_size,
strides=1,
padding='valid',
data_format=None,
dilation_rate=1,
activation=None,
use_bias=True,
normalize_weight=False,
kernel_initializer='complex',
bias_initializer='zeros',
gamma_diag_initializer=sqrt_init,
gamma_off_initializer='zeros',
kernel_regularizer=None,
bias_regularizer=None,
gamma_diag_regularizer=None,
gamma_off_regularizer=None,
activity_regularizer=None,
kernel_constraint=None,
bias_constraint=None,
gamma_diag_constraint=None,
gamma_off_constraint=None,
init_criterion='he',
seed=None,
spectral_parametrization=False,
epsilon=1e-7,
**kwargs):
super(ComplexConv, self).__init__(**kwargs)
self.rank = rank
self.filters = filters
self.kernel_size = conv_utils.normalize_tuple(kernel_size, rank, 'kernel_size')
self.strides = conv_utils.normalize_tuple(strides, rank, 'strides')
self.padding = conv_utils.normalize_padding(padding)
self.data_format = 'channels_last' if rank == 1 else conv_utils.normalize_data_format(data_format)
self.dilation_rate = conv_utils.normalize_tuple(dilation_rate, rank, 'dilation_rate')
self.activation = activations.get(activation)
self.use_bias = use_bias
self.normalize_weight = normalize_weight
self.init_criterion = init_criterion
self.spectral_parametrization = spectral_parametrization
self.epsilon = epsilon
self.kernel_initializer = sanitizedInitGet(kernel_initializer)
self.bias_initializer = sanitizedInitGet(bias_initializer)
self.gamma_diag_initializer = sanitizedInitGet(gamma_diag_initializer)
self.gamma_off_initializer = sanitizedInitGet(gamma_off_initializer)
self.kernel_regularizer = regularizers.get(kernel_regularizer)
self.bias_regularizer = regularizers.get(bias_regularizer)
self.gamma_diag_regularizer = regularizers.get(gamma_diag_regularizer)
self.gamma_off_regularizer = regularizers.get(gamma_off_regularizer)
self.activity_regularizer = regularizers.get(activity_regularizer)
self.kernel_constraint = constraints.get(kernel_constraint)
self.bias_constraint = constraints.get(bias_constraint)
self.gamma_diag_constraint = constraints.get(gamma_diag_constraint)
self.gamma_off_constraint = constraints.get(gamma_off_constraint)
if seed is None:
self.seed = np.random.randint(1, 10e6)
else:
self.seed = seed
self.input_spec = InputSpec(ndim=self.rank + 2)
示例5: __init__
# 需要导入模块: from keras.utils import conv_utils [as 别名]
# 或者: from keras.utils.conv_utils import normalize_padding [as 别名]
def __init__(self, rank,
filters,
kernel_size,
strides=1,
padding='valid',
data_format='channels_last',
dilation_rate=1,
activation=None,
use_bias=True,
normalize_weight=False,
kernel_initializer='quaternion',
bias_initializer='zeros',
gamma_diag_initializer=sqrt_init,
gamma_off_initializer='zeros',
kernel_regularizer=None,
bias_regularizer=None,
gamma_diag_regularizer=None,
gamma_off_regularizer=None,
activity_regularizer=None,
kernel_constraint=None,
bias_constraint=None,
gamma_diag_constraint=None,
gamma_off_constraint=None,
init_criterion='he',
seed=None,
spectral_parametrization=False,
epsilon=1e-7,
**kwargs):
super(QuaternionConv, self).__init__(**kwargs)
self.rank = rank
self.filters = filters
self.kernel_size = conv_utils.normalize_tuple(kernel_size, rank, 'kernel_size')
self.strides = conv_utils.normalize_tuple(strides, rank, 'strides')
self.padding = conv_utils.normalize_padding(padding)
self.data_format = K.normalize_data_format(data_format)
self.dilation_rate = conv_utils.normalize_tuple(dilation_rate, rank, 'dilation_rate')
self.activation = activations.get(activation)
self.use_bias = use_bias
self.normalize_weight = normalize_weight
self.init_criterion = init_criterion
self.spectral_parametrization = spectral_parametrization
self.epsilon = epsilon
self.kernel_initializer = sanitizedInitGet(kernel_initializer)
self.bias_initializer = sanitizedInitGet(bias_initializer)
self.gamma_diag_initializer = sanitizedInitGet(gamma_diag_initializer)
self.gamma_off_initializer = sanitizedInitGet(gamma_off_initializer)
self.kernel_regularizer = regularizers.get(kernel_regularizer)
self.bias_regularizer = regularizers.get(bias_regularizer)
self.gamma_diag_regularizer = regularizers.get(gamma_diag_regularizer)
self.gamma_off_regularizer = regularizers.get(gamma_off_regularizer)
self.activity_regularizer = regularizers.get(activity_regularizer)
self.kernel_constraint = constraints.get(kernel_constraint)
self.bias_constraint = constraints.get(bias_constraint)
self.gamma_diag_constraint = constraints.get(gamma_diag_constraint)
self.gamma_off_constraint = constraints.get(gamma_off_constraint)
if seed is None:
self.seed = np.random.randint(1, 10e6)
else:
self.seed = seed
self.input_spec = InputSpec(ndim=self.rank + 2)
开发者ID:Orkis-Research,项目名称:Quaternion-Convolutional-Neural-Networks-for-End-to-End-Automatic-Speech-Recognition,代码行数:62,代码来源:conv.py