class DNNModel(tf.keras.Model):
def __init__(self, num_classes):
super(DNNModel, self).__init__()
## 코드 시작 ##
self.dense1 = tf.keras.layers.Dense(512,input_shape=(28,28))
self.bn1 = tf.keras.layers.BatchNormalization()
self.relu1 = tf.keras.layers.Activation(tf.keras.activations.relu)
self.dense2 = tf.keras.layers.Dense(num_classes)
## 코드 종료 ##
def call(self, inputs, training=False):
"""Run the model."""
## 코드 시작 ##
dense1_out = self.dense1(inputs)
bn1_out = self.bn1(dense1_out)
relu1_out = self.relu1(bn1_out)
dense2_out = self.dense2(relu1_out)
## 코드 종료 ##
return dense2_out
모델 테스트 하니, 아래와 같이 나오는데 오류가 뭔지 모르겠네요ㅠ
[지문의 지시보다 더 많거나 적은 Relu 함수가 설계되었습니다. 지문을 다시 확인하시기 바랍니다]
predictions: tf.Tensor( [[ 5.3379560e-01 -2.3761180e-01 1.3999850e+00 -3.1324694e-01 -8.1787622e-01 1.1721934e+00 -2.9624808e-01 -4.2776041e-02 1.4625961e-01 3.6068922e-01] [ 2.8527328e-01 -1.4177586e-01 5.9206277e-01 -2.7118844e-01 -8.1278700e-01 8.6498630e-01 -1.0841914e-01 -9.7464770e-05 -3.0442119e-01 7.3610984e-02] [ 1.9408071e-01 8.3620876e-02 6.0621786e-01 -2.8606656e-01 -1.3437253e-01 4.6336082e-01 -5.0032622e-01 3.5316363e-01 3.4358054e-02 -7.6938719e-02]], shape=(3, 10), dtype=float32) Model: "dnn_model_17" _________________________________________________________________ Layer (type) Output Shape Param # ================================================================= dense_43 (Dense) multiple 401920 _________________________________________________________________ batch_normalization_22 (Batc multiple 2048 _________________________________________________________________ activation_18 (Activation) multiple 0 _________________________________________________________________ dense_44 (Dense) multiple 5130 ================================================================= Total params: 409,098 Trainable params: 408,074 Non-trainable params: 1,024
comment