Keras 3 API 文档 / 层 API / 重塑层 / ZeroPadding3D 层

ZeroPadding3D 层

[source]

ZeroPadding3D class

keras.layers.ZeroPadding3D(
    padding=((1, 1), (1, 1), (1, 1)), data_format=None, **kwargs
)

零填充层,用于三维数据(空间或时空).

示例:

>>> input_shape = (1, 1, 2, 2, 3)
>>> x = np.arange(np.prod(input_shape)).reshape(input_shape)
>>> y = keras.layers.ZeroPadding3D(padding=2)(x)
>>> y.shape
(1, 5, 6, 6, 3)

参数: padding: 整数,或3个整数的元组,或3个2个整数的元组的元组. - 如果为整数:相同的对称填充将应用于深度、高度和宽度. - 如果为3个整数的元组:解释为深度、高度和宽度的三个不同的对称填充值: (symmetric_dim1_pad, symmetric_dim2_pad, symmetric_dim3_pad). - 如果为3个2个整数的元组的元组:解释为 ((left_dim1_pad, right_dim1_pad), (left_dim2_pad, right_dim2_pad), (left_dim3_pad, right_dim3_pad)). data_format: 字符串,取值为"channels_last"(默认)或"channels_first".输入中维度的顺序. "channels_last"对应于形状为 (batch_size, spatial_dim1, spatial_dim2, spatial_dim3, channels)的输入 而"channels_first"对应于形状为 (batch_size, channels, spatial_dim1, spatial_dim2, spatial_dim3)的输入. 如果未指定,使用在~/.keras/keras.json中找到的image_data_format值(如果存在).默认为 "channels_last".

输入形状: 形状为5D张量: - 如果data_format"channels_last": (batch_size, first_axis_to_pad, second_axis_to_pad, third_axis_to_pad, depth) - 如果data_format"channels_first": (batch_size, depth, first_axis_to_pad, second_axis_to_pad, third_axis_to_pad)

输出形状: 形状为5D张量: - 如果data_format"channels_last": (batch_size, first_padded_axis, second_padded_axis, third_axis_to_pad, depth) - 如果data_format"channels_first": (batch_size, depth, first_padded_axis, second_padded_axis, third_axis_to_pad)