Stumped by code snippet in C2_W1_Lab01_Neurons_and_Layers

C2_W1_Lab01: Neurons and Layer, How does the following newly-created Neuron output a weight?

We have created a Sequential model in Keras

model = Sequential(
    [
        tf.keras.layers.Dense(1, input_dim=1,  activation = 'sigmoid', name='L1')
    ]
)

Then, we ask it to output weight!
logistic_layer = model.get_layer(‘L1’)
w,b = logistic_layer.get_weights()
print(w,b)

It returns w=1.07 and b=0
But I did not feed it any test data yet! Where did these non-null weight and bias come from?

When you create a layer, TensorFlow automatically gives it some random initial weight values.

1 Like

Oh cool, thanks!