zhangqianhui
zhangqianhui

Reputation: 124

How to understand two tensors's dot multiplication in tensorflow?

the code :

y*tf.ones([x_shapes[0], x_shapes[1], x_shapes[2] , y_shapes[3]])

y is a tensor which dimension is [64 , 1 , 1 , 10] x is a tensor which dimension is [64 , 28 ,28 , 1]

tf.ones([x_shapes[0], x_shapes[1], x_shapes[2] , y_shapes[3]])

will generate a tensor which dimension is [64 , 28 , 28 , 10]

so ,how to understand the dot product of two tensors which have different dimensions?

Upvotes: 0

Views: 132

Answers (1)

Yaroslav Bulatov
Yaroslav Bulatov

Reputation: 57883

This is element-wise multiplication where two tensors are first made the same size using numpy's broadcasting rules

Upvotes: 1

Related Questions