Suppose I have two images with dimensions of 32x32x3 (number of channels=3). I want to multiply them (like "matmul" function) on the first and the second dimensions for each of these 3 channels in Tensorflow to get a new 32x32x3 image. Can someone help me with this? Something like this loop:
#x.shape=(32,32,3)
#y.shape=(32,32,3)
a = np.zeros((x.shape[-3], x.shape[-2], x.shape[-1],), dtype='float32')
for i in range(a.shape[-1]):
a[:, :, i] = tf.matmul(x[:, :, i], y[:, :, i])
a = tf.convert_to_tensor(a, dtype=tf.float32)
but I was wondering there is a more efficient way to do this?