Keras 3 API 文档 / 层 API / 重塑层 / 三维上采样层

三维上采样层

[source]

UpSampling3D class

keras.layers.UpSampling3D(size=(2, 2, 2), data_format=None, **kwargs)

三维输入的上采样层.

将数据的第1、2和3维度分别重复size[0]size[1]size[2]次.

示例:

>>> input_shape = (2, 1, 2, 1, 3)
>>> x = np.ones(input_shape)
>>> y = keras.layers.UpSampling3D(size=(2, 2, 2))(x)
>>> y.shape
(2, 2, 4, 2, 3)

参数: size: 整数,或3个整数的元组. 用于dim1、dim2和dim3的上采样因子. 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配置文件中找到的 image_data_format值,路径为 ~/.keras/keras.json(如果存在),否则为"channels_last". 默认为"channels_last".

输入形状: 形状为以下之一的5D张量: - 如果data_format"channels_last": (batch_size, dim1, dim2, dim3, channels) - 如果data_format"channels_first": (batch_size, channels, dim1, dim2, dim3)

输出形状: 形状为以下之一的5D张量: - 如果data_format"channels_last": (batch_size, upsampled_dim1, upsampled_dim2, upsampled_dim3, channels) - 如果data_format"channels_first": (batch_size, channels, upsampled_dim1, upsampled_dim2, upsampled_dim3)