tf.keras与lambda函数的模棱两可

时间:2019-04-26 15:08:25

标签: python tensorflow keras

我有一个tf.keras.layers.Lambda层,它使用tf函数。为什么有时我必须为output_shape=()呼叫指定Lambda,而有时却不指定呢?

示例

freqDomain = tf.keras.layers.Lambda(tf.fft2d,
                                    output_shape=(None, tileSize, tileSize, 1))(cpxInput) # Won't work unless output_shape is specified.

1 个答案:

答案 0 :(得分:0)

这是Keras中的一个错误,目前专门针对tf.ff2td

Keras目前无法基于输入自动计算fft2d函数的输出形状,因此需要指定output_shape。开发人员将致力于此工作:

https://github.com/keras-team/keras/issues/12121#issuecomment-457217337