shamangary/FSA-Net

Questions on usage of Lambda layers

ksachdeva opened this issue · 1 comments

Hi,

Really great work; I really enjoyed reading your paper and glad to see a new approach.

I have few questions which are mostly around the clarification for the code -

Usage of Lambda layers:

S_matrix_s1 = Lambda(lambda x: tf.matmul(x[0],x[1]),name='S_matrix_s1')([SL_matrix,SR_matrix_s1])

 S_matrix_s1 = Lambda(lambda x: tf.matmul(x[0],x[1]),name='S_matrix_s1')([SL_matrix,SR_matrix_s1])
 S_matrix_s2 = Lambda(lambda x: tf.matmul(x[0],x[1]),name='S_matrix_s2')([SL_matrix,SR_matrix_s2])
 S_matrix_s3 = Lambda(lambda x: tf.matmul(x[0],x[1]),name='S_matrix_s3')([SL_matrix,SR_matrix_s3])

Normally, you should be able to write that simply as

S_matrix_s1 = tf.matmul(SL_matrix, SR_matrix_s1)
S_matrix_s2 = tf.matmul(SL_matrix, SR_matrix_s2)
S_matrix_s3= tf.matmul(SL_matrix, SR_matrix_s3)

and also at many other places where you have used Lambda.

(I know it works when using tf.keras so may be there is something specific about keras here !)

Is there any specific problem that you faced that lead you to use tf.matmul wrapped inside the Lambda layers ?

Regards
Kapil

Hello @ksachdeva, there is no specific reason for that actually. Basically Lambda layer can solve everything and make custom layer name so I just keep using that. Feel free to alter the code.