Как получить массивы скалярных произведений внутри двух двумерных массивов? ⇐ Python
Как получить массивы скалярных произведений внутри двух двумерных массивов?
How do I perform this without using for loops and just numpy functions?
arr_x = np.array([[1,2,3], [4,5,6]]) arr_y = np.array([[1,2,3], [4,5,6]]) res = [] for x, y in zip(arr_x, arr_y): res.append(np.dot(x, y)) res = np.array(res) I tried tensordot with axes=1, but that throws a shape mismatch error
Источник: https://stackoverflow.com/questions/781 ... -2d-arrays
How do I perform this without using for loops and just numpy functions?
arr_x = np.array([[1,2,3], [4,5,6]]) arr_y = np.array([[1,2,3], [4,5,6]]) res = [] for x, y in zip(arr_x, arr_y): res.append(np.dot(x, y)) res = np.array(res) I tried tensordot with axes=1, but that throws a shape mismatch error
Источник: https://stackoverflow.com/questions/781 ... -2d-arrays
-
- Похожие темы
- Ответы
- Просмотры
- Последнее сообщение