본문 바로가기

DeepLearning Specialization(Andrew Ng)/Improving Deep Neural Networks

[Week 3] Programming Assignments

728x90

1. np.squeeze

 

 default로 아무것도 안쓰고 안에다가 array나 tensor를 넣으면 차원이 1인 것들을 다 날려준다.

a = np.array([[1,2,3]])
a.shape
=> (1,3)
print(np.squeeze(a))
=> [1,2,3]
print(np.squeeze(a).shape)
=> (3,)

2. Sess.run([optimizer, cost], feed_dict = ...)

여러개의 연산을 run시킬 수 있고, 이 때 뒤에부터 연산한다. cost -> optimizer

 

728x90