可能是TensorFlow的版本问题,但是实在不会改了
optimizer=tf.train.AdamOptimizer(len-4)
train=optimizer.minimize(loss)
这段代码提示错误module'tensorflow._api.v2.train'has no attribute 'AdamOptimizer',改为
optimizer=tf.optimizers.Adam(len-4)
train=optimizer.minimize(loss)后提示错误minimize()missing 1required positional argument:'var_list'
改为optimizer=tf.compat.v1.train.AdamOptimizer(len-4)
train=optimizer.minimize(loss)提示错误'loss' passed to Optimizer.compute_gradients should be 啊function when eager execution is enable.
请问应该怎么改才能不出现错误呢(不想换版本)