Spaces:
Sleeping
Sleeping
File size: 1,306 Bytes
b79b2d0 d2513bf d047d46 16d1fbe d047d46 055dcd6 d047d46 d2513bf b79b2d0 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# import tensorflow as tf
# def create_model():
# LAYERS = [tf.keras.layers.Flatten(input_shape=[28,28], name="inputlayer"),
# tf.keras.layers.Dense(300, activation='relu', name="hiddenlayer1"),
# tf.keras.layers.Dense(100, activation='relu', name="hiddenlayer2"),
# tf.keras.layers.Dense(10, activation='softmax', name="outputlayer")]
# model = tf.keras.models.Sequential(LAYERS)
# model.load_weights('./checkpoint')
# # LOSS_FUNCTION = tf.keras.losses.SparseCategoricalCrossentropy() # HERE
# # OPTIMIZER = tf.keras.optimizers.legacy.Adam()
# # METRICS = ["accuracy"]
# # model.compile(loss=LOSS_FUNCTION,
# # optimizer=OPTIMIZER,
# # metrics=METRICS)
# return model
import tensorflow as tf
def create_model():
LAYERS = [tf.keras.layers.Flatten(input_shape=[28,28], name="inputlayer"),
tf.keras.layers.Dense(300, activation='relu', name="hiddenlayer1"),
tf.keras.layers.Dense(100, activation='relu', name="hiddenlayer2"),
tf.keras.layers.Dense(10, activation='softmax', name="outputlayer")]
model = tf.keras.models.Sequential(LAYERS)
return model
def load_model_weights(model, checkpoint_path):
model.load_weights(checkpoint_path)
|