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

UpSampling1D层

[source]

UpSampling1D class

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

一维输入的上采样层.

沿时间轴将每个时间步重复 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: 整数.上采样因子.

输入形状: 形状为 (batch_size, steps, features) 的 3D 张量.

输出形状: 形状为 (batch_size, upsampled_steps, features) 的 3D 张量.