#import 可让是tuner先是遇到module不存在,我自己pip下载了一个 然后又遇见这问题
环境是tensorflow2
代码:from keras_tuner.tuners import Hyperband
错误:
AttributeError: module 'tensorflow' has no attribute 'make_tensor_proto'
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
~\AppData\Local\Temp/ipykernel_39692/631392076.py in <module>
----> 1 from keras_tuner.tuners import Hyperband
E:\anaconda\envs\tensorflow2.0\lib\site-packages\keras_tuner\__init__.py in <module>
15
16 from keras_tuner import applications
---> 17 from keras_tuner import oracles
18 from keras_tuner import tuners
19 from keras_tuner.engine.hypermodel import HyperModel
E:\anaconda\envs\tensorflow2.0\lib\site-packages\keras_tuner\oracles\__init__.py in <module>
15 # Keep the name of `BayesianOptimization`, `Hyperband` and `RandomSearch`
16 # for backward compatibility for 1.0.2 or earlier.
---> 17 from keras_tuner.tuners.bayesian import BayesianOptimizationOracle
18 from keras_tuner.tuners.hyperband import HyperbandOracle
19 from keras_tuner.tuners.hyperband import HyperbandOracle as Hyperband
E:\anaconda\envs\tensorflow2.0\lib\site-packages\keras_tuner\tuners\__init__.py in <module>
14
15
---> 16 from keras_tuner.tuners.bayesian import BayesianOptimization
17 from keras_tuner.tuners.hyperband import Hyperband
18 from keras_tuner.tuners.randomsearch import RandomSearch
E:\anaconda\envs\tensorflow2.0\lib\site-packages\keras_tuner\tuners\bayesian.py in <module>
9 from keras_tuner.engine import oracle as oracle_module
10 from keras_tuner.engine import trial as trial_module
---> 11 from keras_tuner.engine import tuner as tuner_module
12
13
E:\anaconda\envs\tensorflow2.0\lib\site-packages\keras_tuner\engine\tuner.py in <module>
23 import numpy as np
24 import tensorflow as tf
---> 25 from tensorboard.plugins.hparams import api as hparams_api
26 from tensorflow import keras
27
E:\anaconda\envs\tensorflow2.0\lib\site-packages\tensorboard\plugins\hparams\api.py in <module>
111
112
--> 113 from tensorboard.plugins.hparams import _keras
114 from tensorboard.plugins.hparams import summary_v2
115
E:\anaconda\envs\tensorflow2.0\lib\site-packages\tensorboard\plugins\hparams\_keras.py in <module>
22
23 from tensorboard.plugins.hparams import api_pb2
---> 24 from tensorboard.plugins.hparams import summary
25 from tensorboard.plugins.hparams import summary_v2
26
E:\anaconda\envs\tensorflow2.0\lib\site-packages\tensorboard\plugins\hparams\summary.py in <module>
200 # Like `metadata.NULL_TENSOR`, but with the TensorFlow version of the
201 # proto. Slight kludge needed to expose the `TensorProto` type.
--> 202 _TF_NULL_TENSOR = type(tf.make_tensor_proto(0)).FromString(
203 metadata.NULL_TENSOR.SerializeToString()
204 )