How to use K.get_session in Tensorflow 2.0 or how to migrate it?
问题 def __init__(self, **kwargs): self.__dict__.update(self._defaults) # set up default values self.__dict__.update(kwargs) # and update with user overrides self.class_names = self._get_class() self.anchors = self._get_anchors() self.sess = K.get_session() RuntimeError: get_session is not available when using TensorFlow 2.0. 回答1: Tensorflow 2.0 does not expose the backend.get_session directly any more but the code still there and expose for tf1. https://github.com/tensorflow/tensorflow/blob/r2.0