operands could not be broadcast together with shapes (2,4) (4,4)
时间: 2024-05-19 14:13:31 浏览: 108
This error message typically occurs when attempting to perform an operation that involves two arrays of different shapes and sizes, and the arrays cannot be broadcasted to have compatible shapes.
In this particular case, the first array has a shape of (2,4) and the second array has a shape of (4,4). The number of columns in the first array (4) does not match the number of rows in the second array (4), which prevents the arrays from being broadcasted and the operation from being performed.
To fix this error, you may need to reshape or transpose one or both arrays to make them compatible for the intended operation. Alternatively, you may need to reconsider the logic of your code and adjust the shapes of the arrays accordingly.
阅读全文