有没有 KerasDense层如何处理3D输入的示例。
该文档解释了以下内容:
If the input to the layer has a rank greater than 2, then Dense computes the dot product between the inputs and the kernel along the last axis of the inputs and axis 1 of the kernel (using tf.tensordot).
但我无法理解内部matrix calculation
例如:
import tensorflow as tf
from tensorflow.keras.layers import Dense
sample_3d_input = tf.constant(tf.random.normal(shape=(4,3,2)))
dense_layer = Dense(5)
op = dense_layer(sample_3d_input)
根据3Dshape 输入的文档,在这种情况下(m,d0,d1),形状Layer's weight_matrix (or) kernel将具有形状。(d1,units) which is (2,5)但我不明白如何计算 op 具有形状(m,d0,units)