PulseAugur
实时 13:46:06
English(EN) Why @ Doesn't Throw a Shape Error for 1 D matrix (and What NumPy Is Quietly Doing Behind Your Back)

NumPy 的 @ 运算符:理解一维数组的行为

本文解释了 NumPy 中关于矩阵乘法的 `@` 运算符的一个常见混淆点。它澄清说,像 `np.array([1, 2, 3])` 这样的 1D 数组的形状是 `(3,)`,它是一个向量,而不是一个 1x3 矩阵。`@` 运算符是 `np.matmul` 的简写,它通过临时将其提升为行向量或列向量来执行点积,从而避免形状错误。 AI

影响 为使用 NumPy 进行数值运算的 AI 从业者澄清了一个常见的编程细节。

排序理由 这是一篇关于广泛使用的库中特定技术行为的解释性文章,而不是发布或重大开发。

在 Towards AI 阅读 →

AI 生成摘要 · Google Gemini · 来自 1 个来源。 我们如何撰写摘要 →

NumPy 的 @ 运算符:理解一维数组的行为

报道来源 [1]

  1. Towards AI TIER_1 English(EN) · pAli ·

    为什么 @ 对一维矩阵不报错(以及 NumPy 在你背后悄悄做了什么)

    <h4><em>A small confusion that taught me more about matmul than any tutorial did.</em></h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*exop4VcylsG_aGpO-kqkOg.png" /></figure><h3>I was poking at NumPy the other day and typed something like this into a noteb…