首页 > 解决方案 > 具有扩展批量形状的 Keras Conv2D

问题描述

您好,我正在尝试使用 keras Conv2D的最后一个示例

# With extended batch shape [4, 7]:  
import tensorflow as tf
input_shape = (4, 7, 127, 127, 3)
x = tf.random.normal(input_shape)
y = tf.keras.layers.Conv2D(2, 3, activation='relu', input_shape=input_shape[2:])(x)
print(y.shape)

但是我收到了一个形状错误:

ValueError: Input 0 of layer conv2d_11 is incompatible with the layer: expected ndim=4, found ndim=5. Full shape received: [4, 7, 127, 127, 3]

标签: tensorflowkerastensorflow2.0convolution

解决方案


推荐阅读