How does one feature batch feed several linear outputs?

matmul sums products across the left column and right row dimensions, leaving sample and output axes.

numpy.matmul in practice

For input [2,3], one weight column sums to five and another takes a difference of minus one. Align weight rows with input feature order.

import numpy as np
np.matmul([[2,3]],[[1,1],[1,-1]])

Result [[5, -1]]

中文

一批特征怎样同时乘上多组输出权重?

matmul 将左矩阵的列与右矩阵的行配对求和,输出保留样本轴与输出通道轴。

numpy.matmul 算例

输入 [2,3] 与两列权重相乘,一列求和得到 5,另一列求差得到 -1。权重行顺序必须与输入特征一致。

import numpy as np
np.matmul([[2,3]],[[1,1],[1,-1]])

结果 [[5, -1]]

References / 参考来源

Keep reading / 继续阅读