Use version for the TensorFlow 2.x: tf.optimizers.SGD (learning_rate=0.001, name='SGD')
import tensorflow.compat.v1 as tf tf.disable_v2_behavior()