AttributeError: module 'tensorflow' has no attribute 'make_tensor_proto'
时间: 2023-12-21 09:31:20 浏览: 33
针对您提到的两个问题,我将分别给出解决方案。
针对引用中的问题,即"AttributeError: module 'tensorflow.compat.v1' has no attribute 'contrib'",这个错误通常是由于使用了不兼容的TensorFlow版本导致的。在TensorFlow 2.0版本中,许多旧的功能被移动或删除,其中包括'tensorflow.contrib'模块。解决这个问题的方法是使用TensorFlow 1.x版本或者更新代码以适应TensorFlow 2.0版本。
针对引用中的问题,即"AttributeError: module 'tensorflow' has no attribute 'placeholder'",这个错误通常是由于使用了TensorFlow 2.0版本的代码,而在TensorFlow 2.0中,'tf.placeholder'已被弃用。取而代之的是使用'tf.TensorSpec'或'tf.data.Dataset.from_tensor_slices'等函数来创建输入张量。您可以根据具体的代码和需求选择适当的替代方法。
至于您提到的"AttributeError: module 'tensorflow' has no attribute 'make_tensor_proto'",这个错误通常是由于使用了不兼容的TensorFlow版本导致的。在TensorFlow 2.0版本中,'make_tensor_proto'函数已被移除。解决这个问题的方法是使用TensorFlow 1.x版本或者更新代码以适应TensorFlow 2.0版本。