Reputation: 277
Given a tensor A
of shape [?, n, l]
and a tensor D
of shape [?, n]
, I want to divide each row of tensor a
of shape [n,l]
of A
by the corresponding scalar of D
.
I thought I could somehow do this by using the broadcasting behavior of tf.div
. Unfortunatley I am stuck.
Upvotes: 0
Views: 434
Reputation: 24631
Here you need to extend D
to match the dimension of A
:
res = A / D[...,tf.newaxis])
Upvotes: 1