Keras 2 API 文件 / 層 API / 重塑層 / UpSampling3D 層

UpSampling3D 層

[來源]

UpSampling3D 類別

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

用於 3D 輸入的上採樣層。

分別將資料的第一、第二和第三維度重複 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 個整數的元組。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) 的輸入。未指定時,會使用您的 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)