修正办法: 修改python的tensorflow包初始化文件: site-packages\tensorflow\_init_.py 将其中的代码: 1 2 3 4 5 6 _keras_module="keras.api._v2.keras" keras=_LazyLoader("keras",globals(), _keras_module) _module_dir=_module_util.get_parent_dir_for_name(_keras_module) if_module_dir: _curr...
38from tensorflow.python.util.lazy_loader import LazyLoaderas_LazyLoader 40# Make sure code inside the TensorFlow codebase canusetf2.enabled() at import. File ~/miniforge3/lib/python3.9/site-packages/tensorflow/python/__init__.py:42,in<module> ...
keras = _LazyLoader("keras", globals(), _keras_module) _module_dir = _module_util.get_parent_dir_for_name(_keras_module) if _module_dir: _current_module.__path__ = [_module_dir] + _current_module.__path__ setattr(_current_module, "keras", keras) ...
0: _API_MODULE 1: __internal__ 2: __operators__ 3: _api 4: _compat 5: _current_module 6: _distutils 7: _fi 8: _initializers 9: _inspect 10: _ll 11: _logging 12: _losses 13: _metrics 14: _module_util 15: _optimizers 16: _os 17: _site 18: _sys 19: _tf2 20: _...
42 from tensorflow.python.util.lazy_loader import LazyLoader as _LazyLoader 43 D:\soft\anaconda3\lib\site-packages\tensorflow\python\__init__.py in <module> 48 import numpy as np 49 ---> 50 from tensorflow.python import pywrap_tensorflow 51 52 # Protocol buffers D:\soft\anaconda3\lib\...
"//tensorflow/contrib/util:util_py", "//tensorflow/python:util", "//tensorflow/python/estimator:estimator_py", ] + if_mpi(["//tensorflow/contrib/mpi_collectives:mpi_collectives_py"]) + select({ "//tensorflow:android": [], "//tensorflow:ios": [], "//tensorflow:linux_s390x": [],...
39 from tensorflow.python.tools import module_util as _module_util 40 from tensorflow.python.util.lazy_loader import KerasLazyLoader as _KerasLazyLoader File ~\AppData\Roaming\Python\Python312\site-packages\tensorflow\python\pywrap_tensorflow.py:85 83 sys.setdlopenflags(_default_dlopen_flags) 84 ...
42 from tensorflow.python.util.lazy_loader import KerasLazyLoader as _KerasLazyLoader File~\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\tensorflow\python\pywrap_tensorflow.py:88 86 sys.setdlopenflags(_default_dlopen_flags)...
```python import tensorflow as tf import sys from tensorflow.python.platform import gfile from tensorflow.core.protobuf import saved_model_pb2 from tensorflow.python.util import compat with tf.Session() as sess: model_filename =sys.argv[1] with gfile.FastGFile(model_filename, 'rb') as f:...
init__(name)def_load(self):"""导入module, 并且放到 parent_module里面"""print("LazyLoader->_load")module=importlib.import_module(self.__name__)self._parent_module_globals[self._local_name]=module# 将module的属性更新到LazyLoaderself.__dict__.update(module.__dict__)returnmodule# 返回import...