I am looking at how to set custom weights into the layers.
Below is the code I work with
batch_size = 64
input_dim = 12
units = 64
output_size = 1 # labels are from 0 to 9
# Build the RNN model
def build_model(allow_cudnn_kernel=True):
lstm_layer = keras.layers.RNN(
keras.layers.LSTMCell(units), input_shape=(None, input_dim))
model = keras.models.Sequential(
[
lstm_layer,
keras.layers.BatchNormalization(),
keras.layers.Dense(output_size),
]
)
return model
model = build_model()
model.compile(
loss=keras.losses.MeanSquaredError(),
optimizer="Adam",
metrics=["accuracy"],
)
model.fit(
x_train, y_train, validation_data=(x_val, y_val), batch_size=batch_size, epochs=15
)
Modle Summary
Can anyone help me how to set_weights in above code? Thanks in advance.
