Cropping1D
類別tf_keras.layers.Cropping1D(cropping=(1, 1), **kwargs)
用於 1D 輸入(例如時間序列)的裁切層。
它沿著時間維度(軸 1)進行裁切。
範例
>>> input_shape = (2, 3, 2)
>>> x = np.arange(np.prod(input_shape)).reshape(input_shape)
>>> print(x)
[[[ 0 1]
[ 2 3]
[ 4 5]]
[[ 6 7]
[ 8 9]
[10 11]]]
>>> y = tf.keras.layers.Cropping1D(cropping=1)(x)
>>> print(y)
tf.Tensor(
[[[2 3]]
[[8 9]]], shape=(2, 1, 2), dtype=int64)
參數
輸入形狀
形狀為 (batch_size, axis_to_crop, features)
的 3D 張量
輸出形狀
形狀為 (batch_size, cropped_axis, features)
的 3D 張量