Tensorflow中的tf.matmul和tf.batch_matmul有什么区别?

dbu*_*ner 5 tensorflow

例如,如果我有以下数据:

x = tf.placeholder("float", [None, n, n])
y = tf.placeholder("float", [None, n, n])
Run Code Online (Sandbox Code Playgroud)

两种操作有什么区别吗?

res = tf.matmul(x,y)
res = tf.batch_matmul(x,y)
Run Code Online (Sandbox Code Playgroud)

Yar*_*tov 3

tf.batch_matmul在 0.12 及更高版本中已弃用tf.matmul,因此在更高版本中没有区别。早期版本需要 2 级输入,matmul但允许更大的等级batch_matmul