【发布时间】:2021-12-19 23:45:27
【问题描述】:
在计算两个特征图之间的距离矩阵时。
A:(M,1)
B:(N,1)
我想重复 B 列以等于 A 行。
在 NumPy 中很简单:
A = np.random,rand(100, 1)
B = np.random.rand(88, 1)
np.repeat(B, A.shape[0], axis=1)
但在 c++ Eigen 中,不适用于动态分配重复形状。
MatrixXi A = MatrixXi::Random(100,1);
MatrixXi B = MatrixXi::Random(88,1);
B.replicate<1, A.rows()>(); // This will cause failure
【问题讨论】: