Tensorflow - matmul of input matrix with batch data

后端 未结 5 463
独厮守ぢ
独厮守ぢ 2020-11-30 22:55

I have some data represented by input_x. It is a tensor of unknown size (should be inputted by batch) and each item there is of size n. input

5条回答
  •  执念已碎
    2020-11-30 23:27

    It seems that in TensorFlow 1.11.0 the docs for tf.matmul incorrectly say that it works for rank >= 2.

    Instead, the best clean alternative I've found is to use tf.tensordot(a, b, (-1, 0)) (docs).

    This function gets the dot product of any axis of array a and any axis of array b in its general form tf.tensordot(a, b, axis). Providing axis as (-1, 0) gets the standard dot product of two arrays.

提交回复
热议问题