Artificial Intelligence/Deep Learning
[DL] RNN 파라미터 개수 카운팅
inee0727
2022. 7. 13. 13:23
import numpy as np
from tensorflow.python.keras.models import Sequential
from tensorflow.python.keras.layers import Dense, SimpleRNN, Dropout
#1. 데이터
datasets = np.array([1,2,3,4,5,6,7,8,9,10])
x = np.array([[1,2,3],[2,3,4],[3,4,5],[4,5,6],[5,6,7],[6,7,8],[7,8,9]])
y = np.array([4,5,6,7,8,9,10])
print(x.shape, y.shape) #(7, 3) (7,)
x = x.reshape(7,3,1)
print(x.shape) #(7, 3, 1)
#2. 모델구성
model= Sequential()
model.add(SimpleRNN(10,input_shape=(3,1)))
model.add(Dense(5, activation = 'relu'))
model.add(Dense(1))
model.summary()
units * (feature + bias + units) = parms
10 * ( 1 + 1 + 10) = 120