I have 2 tensors a and blike [?,200,200,48] and i want to get the dot product on axis 4 to obtain a tensor like [?,200,200,1].
I tried to use tf.tensordot(a,b,axis=[]) and the result is tensor like [?,200,200,?,200,200]
Where i'm bad?
Data Science Stack Exchange is a question and answer site for Data science professionals, Machine Learning specialists, and those interested in learning more about the field. It only takes a minute to sign up.Sign up to join this community
from tensorflow.keras.layers import * import tensorflow.keras.backend as K import tensorflow as tf BS = 100 x = K.random_normal((BS, 200, 200, 48)) y = K.random_normal((BS, 200, 200, 48)) K.sum(tf.multiply(x, y[:tf.newaxis]), axis=-1, keepdims=True).shape
Detailed explanation from here: https://stackoverflow.com/questions/51657476/keras-dot-dot-layer-behavior-on-3d-tensors