machine-learning - 张量点: deep learning with python

标签 machine-learning deep-learning linear-algebra matrix-multiplication tensor

我目前正在阅读使用 Python 进行深度学习,我不确定作者在第 42 页上想说什么。链接是 here

More generally, you can take the dot product between higher-dimensional tensors, following the same rules for shape compatibility as outlined earlier for the 2D case:

(a, b, c, d) . (d,) -> (a, b, c)
(a, b, c, d) . (d, e) -> (a, b, c, e)

不确定他在这里想说什么。我确实了解矩阵乘法的工作原理,但上面两行代码不清楚。

最佳答案

按照这个符号,矩阵乘法是

(a, b) * (b, c) -> (a, c)

当第二个矩阵是向量时,它简化为

(a, b) * (b, ) -> (a, )

现在,书中的公式简单地解释了当第一个或第二个矩阵具有额外维度时如何扩展此操作。重要的是,两者都有一个匹配的维度(最后一个暗淡==第一个暗淡,无需 reshape ),张量可以沿着该维度相乘,从而消除这个维度。因此,结果形状的公式为:

(a, b, c, d) * (d, e) -> (a, b, c, e)

关于machine-learning - 张量点: deep learning with python,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48082735/

相关文章:

c++ - 如何使用 AdaBoost 进行特征选择?

tensorflow - tf.argmax 返回一个超出有效维度范围的随机高值

computer-vision - 如何实现4维卷积核

lisp 高效的线性代数库

machine-learning - 加权词嵌入是什么意思?

r - 机器学习中的评估指标

python - 对来自不同用户的多个响应进行评分

machine-learning - 层归一化层中的 beta 和 gamma 参数的形状是什么?

python - 使用numpy使用6个线性方程求解5个变量

python numpy linalg 求解器 : Wrong answer