作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我有以下代码
from tensorflow import keras
from keras import backend as K
pool_size = (2,2,2)
strides = (2,2,2)
yt = K.zeros(shape=(10,10,10))
result = keras.backend.pool3d(yt, pool_size, strides, pool_mode="avg")
当我尝试运行代码时,它显示
.. InvalidArgumentError: tensor_in must be 5-dimensional [Op:AvgPool3D] name: AvgPool3D/
我似乎不喜欢 yt 的尺寸。但我想在尺寸为 3x3x3 的 3d 图像中最大池化。另一个维度应该是多少?
最佳答案
正如 Keras 中的每个类似卷积的操作一样,这些维度都是必需的。
(batch、size1、size2、size3、channels)
(批处理、 channel 、size1、size2、size3)
所以:
yt = K.zeros(shape=(1,10,10,10,1))
关于python-3.x - 为什么keras.backend.pool3d要求tensor_in是5维的?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59218360/
我是一名优秀的程序员,十分优秀!