निम्नलिखित आदेशों को क्रियान्वित करने पर, numpy में प्रसारण का उत्पादन होगा
On executing the following commands, Broadcasting in numpy will produce
a = np.array((0,10,20,30))
b = np.array((0,1,2))
y = a[:, None] + b A
Error, operands could not be broadcast together with these shapes
B
[[ 0 10 20, 30] [10 21, 32] [20 31 22] [30 31 32]]
C
[[ 0 0 0] [0 0 0] [0 0 0] [0 0 0]]
D
[[ 0 1 2] [10 11 12] [20 21 22] [30 31 32]]
Explanation
The operation a[:, None] + b adds b (shape (3,)) to each element of a (shape (4,)) by broadcasting. This creates a (4, 3) array:
[[ 0 1 2]
[10 11 12]
[20 21 22]
[30 31 32]]
So, the correct answer is (D).
Correct Answer: D) [[ 0 1 2] [10 11 12] [20 21 22] [30 31 32]]