학습일 : 2020.01.24

학습목표

브로드캐스팅의 이해

**import** numpy **as** np

브로드캐스팅

브로드캐스팅 Rule

x = np.arange(15).reshape(3, 5)
y = np.random.rand(15).reshape(3, 5)
print(x)
print(y)
[[ 0  1  2  3  4]
 [ 5  6  7  8  9]
 [10 11 12 13 14]]
[[0.69150783 0.47357302 0.54536327 0.3896698  0.57665621]
 [0.50424885 0.00609487 0.09678069 0.96678293 0.30056346]
 [0.7999504  0.15673124 0.13520242 0.56365613 0.8974811 ]]
x + y
array([[ 0.69150783,  1.47357302,  2.54536327,  3.3896698 ,  4.57665621],
       [ 5.50424885,  6.00609487,  7.09678069,  8.96678293,  9.30056346],
       [10.7999504 , 11.15673124, 12.13520242, 13.56365613, 14.8974811 ]])
x ** 2