Conditions for the broadcast mechanism to be error-free:
To operate on two matrices of different dimensions, first list the dimensions of the two matrices, such as:
Matrix A: 2, 3, 4
Matrix B: 1, 1, 4
Start from the last dimension of the two matrices: only the current dimension is equal, or not equal but one of the dimensions is 0 or 1 ; if this condition is met, continue to compare the previous dimension until all dimensions meet the condition. At this point the two matrices meet the broadcast conditions.
For example: the above matrices A and B satisfy the broadcasting condition.
If the broadcasting conditions are not met, please take the following measures: