Keras 3 API 文件 / 層 API / 形狀重塑層 / UpSampling1D 層

UpSampling1D 層

[原始碼]

UpSampling1D 類別

keras.layers.UpSampling1D(size=2, **kwargs)

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

沿時間軸將每個時間步重複 size 次。

範例

>>> input_shape = (2, 2, 3)
>>> x = np.arange(np.prod(input_shape)).reshape(input_shape)
>>> x
[[[ 0  1  2]
  [ 3  4  5]]
 [[ 6  7  8]
  [ 9 10 11]]]
>>> y = keras.layers.UpSampling1D(size=2)(x)
>>> y
[[[ 0.  1.  2.]
  [ 0.  1.  2.]
  [ 3.  4.  5.]
  [ 3.  4.  5.]]
 [[ 6.  7.  8.]
  [ 6.  7.  8.]
  [ 9. 10. 11.]
  [ 9. 10. 11.]]]

參數

  • size:整數。上採樣因子。

輸入形狀

具有形狀的 3D 張量:(batch_size, steps, features)

輸出形狀

具有形狀的 3D 張量:(batch_size, upsampled_steps, features)