作者:empty 出版社:empty |
super(My Model, self) .__in it__(name='my_model')self.dense_1=layers.Dense(32,activation='re lu'self.dense_2=layers.Dense(num_classes, activation='soft max')def call(self, inputs) :#Define your forward passherex=self.dense_1(inputs)return self.dense_2(x)
class My Model(tf.ker as.Model) :def-_in it__(self,num_classes=10) :super(My Model, self) .__in it__(name='my_model')self.dense_1=layers.Dense(32)self.dense_2=layers.Dense(num_classes, activation='soft max')def call(self,inputs) :#Define your forward pass herex=self.dense_1(inputs)x=tf.nn.re lu(x)return self.dense_2(x)Guidestensorflow.org/guide/keras/overviewtensorflow.org/quide/keras/functionatensor flow.oral quide/ker as/train and evaluatetensorflow.org/guide/keras/customlayers_andmodelsExamplestensorflow.org/tutorials/images/segmentationtensorflow.ora/tutorials/generative/pix2pixtensorflow.org/tutorials/generative/adversarialfasmau a in Wang:The document was cra led wtSp.PDF for.NET.Helpful references