Keras 2 API 文档 / 层 API / 重塑层 / UpSampling3D 层

UpSampling3D 层

[源代码]

UpSampling3D

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

3D 输入的升采样层。

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

示例

>>> input_shape = (2, 1, 2, 1, 3)
>>> x = tf.constant(1, shape=input_shape)
>>> y = tf.keras.layers.UpSampling3D(size=2)(x)
>>> print(y.shape)
(2, 2, 4, 2, 3)

参数

  • size:整数,或由 3 个整数组成的元组。第 1、2、3 维的升采样因子。
  • 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)的输入。当未指定时,使用您TF-Keras配置文件中~/.keras/keras.json找到的image_data_format值(如果存在),否则为'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)