keras_to_tensorflow icon indicating copy to clipboard operation
keras_to_tensorflow copied to clipboard

TypeError('Expected Operation, Variable, or Tensor, got ' + str(x))

Open Syxxxxx opened this issue 6 years ago • 3 comments

Traceback (most recent call last): File "totensor.py", line 173, in app.run(main) File "C:\Users\Lenovo\Anaconda3\lib\site-packages\absl\app.py", line 299, in run _run_main(main, args) File "C:\Users\Lenovo\Anaconda3\lib\site-packages\absl\app.py", line 250, in _run_main sys.exit(main(argv)) File "totensor.py", line 116, in main model = load_model(FLAGS.input_model, FLAGS.input_model_json) File "totensor.py", line 62, in load_model model = keras.models.load_model(input_model_path) File "C:\Users\Lenovo\Anaconda3\lib\site-packages\keras\engine\saving.py", line 492, in load_wrapper return load_function(*args, **kwargs) File "C:\Users\Lenovo\Anaconda3\lib\site-packages\keras\engine\saving.py", line 584, in load_model model = _deserialize_model(h5dict, custom_objects, compile) File "C:\Users\Lenovo\Anaconda3\lib\site-packages\keras\engine\saving.py", line 274, in deserialize_model model = model_from_config(model_config, custom_objects=custom_objects) File "C:\Users\Lenovo\Anaconda3\lib\site-packages\keras\engine\saving.py", line 627, in model_from_config return deserialize(config, custom_objects=custom_objects) File "C:\Users\Lenovo\Anaconda3\lib\site-packages\keras\layers_init.py", line 168, in deserialize printable_module_name='layer') File "C:\Users\Lenovo\Anaconda3\lib\site-packages\keras\utils\generic_utils.py", line 147, in deserialize_keras_object list(custom_objects.items()))) File "C:\Users\Lenovo\Anaconda3\lib\site-packages\keras\engine\sequential.py", line 302, in from_config model.add(layer) File "C:\Users\Lenovo\Anaconda3\lib\site-packages\keras\engine\sequential.py", line 166, in add layer(x) File "C:\Users\Lenovo\Anaconda3\lib\site-packages\keras\layers\recurrent.py", line 541, in call return super(RNN, self).call(inputs, **kwargs) File "C:\Users\Lenovo\Anaconda3\lib\site-packages\keras\backend\tensorflow_backend.py", line 75, in symbolic_fn_wrapper return func(*args, **kwargs) File "C:\Users\Lenovo\Anaconda3\lib\site-packages\keras\engine\base_layer.py", line 489, in call output = self.call(inputs, **kwargs) File "C:\Users\Lenovo\Anaconda3\lib\site-packages\keras\layers\recurrent.py", line 1105, in call initial_state=initial_state) File "C:\Users\Lenovo\Anaconda3\lib\site-packages\keras\layers\recurrent.py", line 682, in call input_length=timesteps) File "C:\Users\Lenovo\Anaconda3\lib\site-packages\keras\backend\tensorflow_backend.py", line 3105, in rnn targets=[last_output]) File "C:\Users\Lenovo\Anaconda3\lib\site-packages\tensorflow_core\python\keras\utils\tf_utils.py", line 134, in get_reachable_from_inputs raise TypeError('Expected Operation, Variable, or Tensor, got ' + str(x))

How to fix that?

Syxxxxx avatar Oct 21 '19 01:10 Syxxxxx

thanks. but now it has that problem. Traceback (most recent call last): File "keras_to_tensorflow.py", line 182, in app.run(main) File "C:\Users\Lenovo\Anaconda3\lib\site-packages\absl\app.py", line 299, in run _run_main(main, args) File "C:\Users\Lenovo\Anaconda3\lib\site-packages\absl\app.py", line 250, in _run_main sys.exit(main(argv)) File "keras_to_tensorflow.py", line 148, in main sess = K.get_session() File "C:\Users\Lenovo\Anaconda3\lib\site-packages\keras\backend\tensorflow_backend.py", line 379, in get_session 'get_session is not available ' RuntimeError: get_session is not available when using TensorFlow 2.0.

Syxxxxx avatar Oct 21 '19 07:10 Syxxxxx

这是我的微信号Syxxxxx_5991,可以向你请教交流下嘛

Syxxxxx avatar Oct 22 '19 02:10 Syxxxxx

How did you fix the above mentioned problem @Syxxxxx @amir-abdi ?

SamsLogic avatar Apr 19 '20 13:04 SamsLogic