如何在keras中将三维数组转换为五维数组
how to convert an array of dimension three to five in keras
我有一个形状为 (?, ?, 128)
的数组,我想将其转换为 (?, ?, 128,1,1)
。
我试图搜索它,但我没有找到任何好东西,或者我没有使用正确的词来找到我要找的东西。
有什么有效的方法可以做到这一点吗?
This 是我找到的最相关的东西,与我想要的东西不一样。
提前致谢:)
使用 Numpy,你可以做到 reshape
a = np.random.rand(2, 3, 128)
b = a.reshape(a.shape + (1, 1))
使用 Keras,您可以 keras.backend.expand_dims(x, axis=-1)
添加 1 尺寸的维度。
我有一个形状为 (?, ?, 128)
的数组,我想将其转换为 (?, ?, 128,1,1)
。
我试图搜索它,但我没有找到任何好东西,或者我没有使用正确的词来找到我要找的东西。 有什么有效的方法可以做到这一点吗?
This 是我找到的最相关的东西,与我想要的东西不一样。
提前致谢:)
使用 Numpy,你可以做到 reshape
a = np.random.rand(2, 3, 128)
b = a.reshape(a.shape + (1, 1))
使用 Keras,您可以 keras.backend.expand_dims(x, axis=-1)
添加 1 尺寸的维度。