Ich trainiere ein einfaches Kerasmodell mit einer dichten Ebene, aber wenn ich Modell nenne.import tensorflow as tf
import numpy as np
# Generate dummy data
X_train = np.random.rand(40) # Shape (40,)
y_train = np.random.rand(40)
# Define a simple model
model = tf.keras.Sequential([
tf.keras.layers.Dense(1)
])
# Compile the model
model.compile(loss=tf.keras.losses.mae,
optimizer=tf.keras.optimizers.SGD(),
metrics=["mae"])
# Train the model
model.fit(tf.expand_dims(X_train, axis=-1), y_train, epochs=100)
# Check model summary
model.summary()
< /code>
Da dicht (1) 1 Gewicht + 1 -Bias haben sollte, erwartete ich 2 Parameter, nicht 4. Ergebnis:
Warum zeigt mein Keras -Modell 4 Parameter anstelle von 2? ⇐ Python
-
- Similar Topics
- Replies
- Views
- Last post