#Subclassing API
#Class 에서 기본적인 __init__, call method 정의 후 model 객체 생성
import tensorflow as tf
Class MyModel(tf.keras.Model) :
super(MyModel, self).__init__()
self.flatten = Flatten(input_shape=(28,28))
self.d1 = Dense(128, activation = 'relu')
self.d2 = Dense(10, activation = 'softmax')
def call(self, x) :
x= self.flatten(x)
x=self.d1(x)
return self.d2(x)
model = MyModel()a
'Tensorflow' 카테고리의 다른 글
[Tensorflow] 사이트 모음 (0) | 2024.02.15 |
---|---|
[Tensorflow] [Backpropagation] (0) | 2024.01.13 |
[Tensorflow] Function API (0) | 2024.01.11 |
[Tensorflow] keras model 구성, 훈련 및 평가 (0) | 2024.01.11 |
[Tensorflow] 변수 variable 설명 (0) | 2024.01.11 |