obstacles in tensorflow's tensordot using batch multiplication

Viewed 1539

I'm implementing RBM in tensorflow.

and there is an obstacle in implementing parameters update using mini-batch

there are 2 tensors

1st tensor's shape is [100,3,1] 2nd tensor's shape is [100,1,4]

number 100 is size of batch.

so i want to multiply these tensor which results in [100,3,4] tensor.

but when i implement code like

tf.tensordot(1st_tensor,2nd_tensor,[[2],[1]])

resulting tensor' shape is [100,3,100,4]

how do i solve this problem?

2 Answers

You can use tf.keras.backend.batch_dot instead; it expects the first dimension to be batch_size, and should do what you want it to do.

Related