pip install tensorflow python import tensorflow as tf x_train = [1, 2, 3, 4] y_train = [2, 4, 6, 8] model = tf.keras.Sequential([ tf.keras.layers.Dense(units=1, input_shape=[1]) ]) model.compile(optimizer='sgd', loss='mean_squared_error') model.fit(x_train, y_train, epochs=100) x_test = [5, 6, 7] y_pred = model.predict(x_test) print(y_pred)


上一篇:
下一篇:
切换中文