在TensorFlow文档中是否正确描述了有效的`tf.matmul`参数? [英] Are valid `tf.matmul` arguments described correctly in the TensorFlow documentation?

查看:165
本文介绍了在TensorFlow文档中是否正确描述了有效的`tf.matmul`参数?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

也许我对内在和外部张量维数感到困惑,但 tf.matmul 的文档难以理解:

Maybe I'm confused about what "inner" and "outer" tensor dimensions are, but the documentation for tf.matmul puzzles me:


输入必须是矩阵(或秩> 2的张量,代表
批次的矩阵),具有匹配的内部维度,可能在
之后转换。

The inputs must be matrices (or tensors of rank > 2, representing batches of matrices), with matching inner dimensions, possibly after transposition.

R-rank参数是否需要匹配(或不)R-2外部尺寸,和(如在正常矩阵乘法中)Rth,第一个参数的内部维数必须与第二个参数的R-1st维度相匹配。也就是说,在

Isn't it the case that R-rank arguments need to have matching (or no) R-2 outer dimensions, and that (as in normal matrix multiplication) the Rth, inner dimension of the first argument must match the R-1st dimension of the second. That is, in

A = tf.constant(..., shape=[a, ..., z, p, x])
B = tf.constant(..., shape=[a', ..., z', x', q]) 
C = tf.matmul(A, B)

外部维度 a,...,z 必须与 a',...,z'(或不存在)和 x x'必须匹配(而 p q 可以可以是任何东西)

The outer dimensions a, ..., z must be identical to a', ..., z' (or not exist), and x and x' must match (while p and q can be anything).

或者换句话说,文档不应该说:

Or put another way, shouldn't the docs say:


在任何转换之后,输入必须是等级≥2的张量,其中内部2维度指定有效的矩阵乘数参数,并且任何其他外部维度匹配。

The inputs must, following any transpositions, be tensors of rank ≥ 2 where the inner 2 dimensions specify valid matrix multiplication arguments, and any further outer dimensions match.


推荐答案

这是 fixed在最近的合并中。文件现在将显示为:

This has been fixed in a recent merge. The documentation will now read:


输入必须在任何转换之后成为rank> = 2
的张量,其中内部2维指定有效矩阵乘数
参数,任何其他外部维度匹配。

The inputs must, following any transpositions, be tensors of rank >= 2 where the inner 2 dimensions specify valid matrix multiplication arguments, and any further outer dimensions match.

这篇关于在TensorFlow文档中是否正确描述了有效的`tf.matmul`参数?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆