TensorFlow: Hadamard Product :: How to get it?

Tensorflow has a function:

tf.matmul

which multiplies two vectors and produces a scalar.

However, I need to do the following:

# dense dim:  (?,227)
dense_part = tf.nn.relu(some stuff here)

# softmax matrix dim: (?,227,19) or (?,19,227) or (?,227,227), where I 
# ....can slice the last dim down to (?,227,19)
softmax_matrix = tf.matmul(dense_part,softmax_weight_variable)

However, I cannot set softmax_weight_variable to accomplish this with matrix multiplication. I need to use the "Tensor Product" (also called the "Outer Product" ...), but this function does not seem to be implemented.

How do I implement Hadamard (by element) and Outer Product multiplication in TensorFlow?

+4
source share
1 answer

x y - tf.mul(x, y). NumPy, , , .

+6

All Articles