question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Wrong tensorflow version

See original GitHub issue

The detailed descriptions are

Using TensorFlow backend.

Traceback (most recent call last):
  File "/Users/Pranav/Downloads/DL-hybrid-precoder-master/main_train_beamforming.py", line 7, in <module>
    from keras import back
ImportError: cannot import name 'back' from 'keras' (/Users/Pranav/opt/anaconda3/envs/Research_DL/lib/python3.7/site-packages/keras/__init__.py)

Process finished with exit code 1

absl-py | 0.9.0 |   – | – | – arviz | 0.7.0 |   astor | 0.8.1 |   backend | 0.2.4.1 |   ca-certificates | 2020.1.1 |   cachetools | 4.0.0 |   certifi | 2019.11.28 |   cftime | 1.1.1.1 |   chardet | 3.0.4 |   click | 7.1.1 |   cycler | 0.10.0 |   dash | 1.9.1 |   dash-core-components | 1.8.1 |   dash-html-components | 1.0.2 |   dash-renderer | 1.2.4 |   dash-table | 4.6.1 |   decorator | 4.4.2 |   flask | 1.1.1 |   flask-compress | 1.4.0 |   future | 0.18.2 |   gast | 0.2.2 |   google-auth | 1.11.3 |   google-auth-oauthlib | 0.4.1 |   google-pasta | 0.2.0 |   grpcio | 1.27.2 |   h5py | 2.10.0 |   idna | 2.9 |   imageio | 2.5.0 |   imgaug | 0.2.9 |   itsdangerous | 1.1.0 |   jinja2 | 2.11.1 |   joblib | 0.14.1 |   keras | 2.3.1 |   keras-applications | 1.0.8 |   keras-preprocessing | 1.1.0 |   keras-segmentation | 0.3.0 |   kiwisolver | 1.1.0 |   libcxx | 4.0.1 |   libcxxabi | 4.0.1 |   libedit | 3.1.20181209 |   libffi | 3.2.1 |   markdown | 3.2.1 |   markupsafe | 1.1.1 |   matplotlib | 3.2.1 |   ncurses | 6.2 |   netcdf4 | 1.5.3 |   networkx | 2.4 |   numpy | 1.18.2 |   oauthlib | 3.1.0 |   opencv-python | 4.2.0.32 |   openssl | 1.1.1e |   opt-einsum | 3.2.0 |   packaging | 20.3 |   pandas | 1.0.3 |   patsy | 0.5.1 |   pillow | 7.0.0 |   pip | 20.0.2 |   plotly | 4.5.4 |   protobuf | 3.11.3 |   pyasn1 | 0.4.8 |   pyasn1-modules | 0.2.8 |   pymc3 | 3.8 |   pyparsing | 2.4.6 |   python | 3.7.6 |   python-dateutil | 2.8.1 |   pytz | 2019.3 |   pywavelets | 1.1.1 |   pyyaml | 5.3.1 |   readline | 7.0 |   requests | 2.23.0 |   requests-oauthlib | 1.3.0 |   retrying | 1.3.3 |   rsa | 4.0 |   scikit-image | 0.16.2 |   scikit-learn | 0.22.2.post1 |   scipy | 1.4.1 |   setuptools | 46.0.0 |   shapely | 1.7.0 |   six | 1.14.0 |   sqlite | 3.31.1 |   tensorboard | 2.1.1 |   tensorflow | 2.1.0 |   tensorflow-estimator | 2.1.0 |   termcolor | 1.1.0 |   tf | 1.0.0 |   theano | 1.0.4 |   tk | 8.6.8 |   tqdm | 4.43.0 |   urllib3 | 1.25.8 |   werkzeug | 1.0.0 |   wheel | 0.34.2 |   wrapt | 1.12.1 |   xarray | 0.15.0 |   xz | 5.2.4 |   zlib | 1.2.11 |

When I ran a second file:

2020-03-20 17:20:54.258405: W tensorflow/python/util/util.cc:319] Sets are not currently considered sequences, but this may change in the future, so consider avoiding using them.
WARNING:tensorflow:From /Users/Pranav/opt/anaconda3/envs/Research_DL/lib/python3.7/site-packages/tensorflow_core/python/ops/resource_variable_ops.py:1786: calling BaseResourceVariable.__init__ (from tensorflow.python.ops.resource_variable_ops) with constraint is deprecated and will be removed in a future version.
Instructions for updating:
If using Keras pass *_constraint arguments to layers.
Traceback (most recent call last):
  File "/Users/Pranav/Downloads/mnist.py", line 32, in <module>
    predictions = new_model.predict([x_test])
  File "/Users/Pranav/opt/anaconda3/envs/Research_DL/lib/python3.7/site-packages/tensorflow_core/python/keras/engine/training.py", line 1013, in predict
    use_multiprocessing=use_multiprocessing)
  File "/Users/Pranav/opt/anaconda3/envs/Research_DL/lib/python3.7/site-packages/tensorflow_core/python/keras/engine/training_v2.py", line 498, in predict
    workers=workers, use_multiprocessing=use_multiprocessing, **kwargs)
  File "/Users/Pranav/opt/anaconda3/envs/Research_DL/lib/python3.7/site-packages/tensorflow_core/python/keras/engine/training_v2.py", line 426, in _model_iteration
    use_multiprocessing=use_multiprocessing)
  File "/Users/Pranav/opt/anaconda3/envs/Research_DL/lib/python3.7/site-packages/tensorflow_core/python/keras/engine/training_v2.py", line 646, in _process_inputs
    x, y, sample_weight=sample_weights)
  File "/Users/Pranav/opt/anaconda3/envs/Research_DL/lib/python3.7/site-packages/tensorflow_core/python/keras/engine/training.py", line 2346, in _standardize_user_data
    all_inputs, y_input, dict_inputs = self._build_model_with_inputs(x, y)
  File "/Users/Pranav/opt/anaconda3/envs/Research_DL/lib/python3.7/site-packages/tensorflow_core/python/keras/engine/training.py", line 2572, in _build_model_with_inputs
    self._set_inputs(cast_inputs)
  File "/Users/Pranav/opt/anaconda3/envs/Research_DL/lib/python3.7/site-packages/tensorflow_core/python/keras/engine/training.py", line 2647, in _set_inputs
    inputs = self._set_input_attrs(inputs)
  File "/Users/Pranav/opt/anaconda3/envs/Research_DL/lib/python3.7/site-packages/tensorflow_core/python/training/tracking/base.py", line 457, in _method_wrapper
    result = method(self, *args, **kwargs)
  File "/Users/Pranav/opt/anaconda3/envs/Research_DL/lib/python3.7/site-packages/tensorflow_core/python/keras/engine/training.py", line 2686, in _set_input_attrs
    input_shape = (None,) + tuple(inputs.shape[1:])
AttributeError: 'list' object has no attribute 'shape'

Third file:

/Users/Pranav/opt/anaconda3/envs/Research_DL/bin/python /Users/Pranav/Downloads/Test/train.py
loading data...
loading complete
The shape of CSI is:  (10, 1, 64)
2020-03-20 17:22:33.388225: I tensorflow/compiler/xla/service/service.cc:168] XLA service 0x7fc0ab981a00 initialized for platform Host (this does not guarantee that XLA will be used). Devices:
2020-03-20 17:22:33.388250: I tensorflow/compiler/xla/service/service.cc:176]   StreamExecutor device (0): Host, Default Version
Model: "model"
__________________________________________________________________________________________________
Layer (type)                    Output Shape         Param #     Connected to                     
==================================================================================================
imperfect_CSI (InputLayer)      [(None, 1, 2, 64)]   0                                            
__________________________________________________________________________________________________
batch_normalization (BatchNorma (None, 1, 2, 64)     256         imperfect_CSI[0][0]              
__________________________________________________________________________________________________
flatten (Flatten)               (None, 128)          0           batch_normalization[0][0]        
__________________________________________________________________________________________________
batch_normalization_1 (BatchNor (None, 128)          512         flatten[0][0]                    
__________________________________________________________________________________________________
dense (Dense)                   (None, 256)          33024       batch_normalization_1[0][0]      
__________________________________________________________________________________________________
batch_normalization_2 (BatchNor (None, 256)          1024        dense[0][0]                      
__________________________________________________________________________________________________
dense_1 (Dense)                 (None, 128)          32896       batch_normalization_2[0][0]      
__________________________________________________________________________________________________
dense_2 (Dense)                 (None, 64)           8256        dense_1[0][0]                    
__________________________________________________________________________________________________
perfect_CSI (InputLayer)        [(None, 64)]         0                                            
__________________________________________________________________________________________________
lambda (Lambda)                 (None, 64)           0           dense_2[0][0]                    
__________________________________________________________________________________________________
SNR_input (InputLayer)          [(None, 1)]          0                                            
__________________________________________________________________________________________________
lambda_1 (Lambda)               (64, 1)              0           perfect_CSI[0][0]                
                                                                 lambda[0][0]                     
                                                                 SNR_input[0][0]                  
==================================================================================================
Total params: 75,968
Trainable params: 75,072
Non-trainable params: 896
__________________________________________________________________________________________________
Train on 9 samples, validate on 1 samples
Epoch 1/50000
2020-03-20 17:22:35.197791: W tensorflow/core/common_runtime/base_collective_executor.cc:217] BaseCollectiveExecutor::StartAbort Invalid argument: Incompatible shapes: [9] vs. [64]
	 [[{{node BroadcastGradientArgs_4}}]]
WARNING:tensorflow:Reduce LR on plateau conditioned on metric `val_loss` which is not available. Available metrics are: lr
WARNING:tensorflow:Can save best model only with val_loss available, skipping.
Traceback (most recent call last):
  File "/Users/Pranav/Downloads/Test/train.py", line 51, in <module>
    epochs=50000, verbose=2, validation_split=0.1, callbacks=[reduce_lr, checkpoint])
  File "/Users/Pranav/opt/anaconda3/envs/Research_DL/lib/python3.7/site-packages/tensorflow_core/python/keras/engine/training.py", line 819, in fit
    use_multiprocessing=use_multiprocessing)
  File "/Users/Pranav/opt/anaconda3/envs/Research_DL/lib/python3.7/site-packages/tensorflow_core/python/keras/engine/training_v2.py", line 342, in fit
    total_epochs=epochs)
  File "/Users/Pranav/opt/anaconda3/envs/Research_DL/lib/python3.7/site-packages/tensorflow_core/python/keras/engine/training_v2.py", line 128, in run_one_epoch
    batch_outs = execution_function(iterator)
  File "/Users/Pranav/opt/anaconda3/envs/Research_DL/lib/python3.7/site-packages/tensorflow_core/python/keras/engine/training_v2_utils.py", line 98, in execution_function
    distributed_function(input_fn))
  File "/Users/Pranav/opt/anaconda3/envs/Research_DL/lib/python3.7/site-packages/tensorflow_core/python/eager/def_function.py", line 568, in __call__
    result = self._call(*args, **kwds)
  File "/Users/Pranav/opt/anaconda3/envs/Research_DL/lib/python3.7/site-packages/tensorflow_core/python/eager/def_function.py", line 632, in _call
    return self._stateless_fn(*args, **kwds)
  File "/Users/Pranav/opt/anaconda3/envs/Research_DL/lib/python3.7/site-packages/tensorflow_core/python/eager/function.py", line 2363, in __call__
    return graph_function._filtered_call(args, kwargs)  # pylint: disable=protected-access
  File "/Users/Pranav/opt/anaconda3/envs/Research_DL/lib/python3.7/site-packages/tensorflow_core/python/eager/function.py", line 1611, in _filtered_call
    self.captured_inputs)
  File "/Users/Pranav/opt/anaconda3/envs/Research_DL/lib/python3.7/site-packages/tensorflow_core/python/eager/function.py", line 1692, in _call_flat
    ctx, args, cancellation_manager=cancellation_manager))
  File "/Users/Pranav/opt/anaconda3/envs/Research_DL/lib/python3.7/site-packages/tensorflow_core/python/eager/function.py", line 545, in call
    ctx=ctx)
  File "/Users/Pranav/opt/anaconda3/envs/Research_DL/lib/python3.7/site-packages/tensorflow_core/python/eager/execute.py", line 67, in quick_execute
    six.raise_from(core._status_to_exception(e.code, message), None)
  File "<string>", line 3, in raise_from
tensorflow.python.framework.errors_impl.InvalidArgumentError:  Incompatible shapes: [9] vs. [64]
	 [[node BroadcastGradientArgs_4 (defined at /Downloads/Test/train.py:51) ]] [Op:__inference_distributed_function_1717]

Function call stack:
distributed_function

9/9 - 2s

Process finished with exit code 1

Please help. Thanks.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:10 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
pranavjha24commented, Mar 21, 2020

Also, was looking at this repo which seems the one you are referring to: https://github.com/pranavjha24/DL-hybrid-precoder/blob/master/main_train_beamforming.py It doesn’t look to me it is using Ludwig at all, so I’m not really sure of what you are asking here and why are you asking it here. You should probably ask to the authors of the repo you forked. So I’m closing, if you can provide an explanation of how Ludwig is relevant to this I may reopen.

Hello w4N,

I followed your instruction and finally my both projects are running. I got few other issues but I think first I will contact the authors. Anyway, Thank you so much for your answers and in future I will write codes and questions in a precise manner. Regards, Pranav

0reactions
w4nderlustcommented, Mar 21, 2020

Also, was looking at this repo which seems the one you are referring to: https://github.com/pranavjha24/DL-hybrid-precoder/blob/master/main_train_beamforming.py It doesn’t look to me it is using Ludwig at all, so I’m not really sure of what you are asking here and why are you asking it here. You should probably ask to the authors of the repo you forked. So I’m closing, if you can provide an explanation of how Ludwig is relevant to this I may reopen.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Wrong version of TensorFlow imported in Jupyter notebook
I am trying to load TensorFlow 1.12 (I'm working with some legacy code) in a Jupyter notebook using a conda environment.
Read more >
Build and install error messages - TensorFlow
The following list links error messages to a solution or discussion. If you find an installation or ... Check the system requirements and...
Read more >
Unable to install Tensorflow through Pip due to no versions to ...
Large logs and files should be attached. When running pip install tensorflow , this is what it returns. ERROR: Could not find a...
Read more >
Install tensorflow-macos version e… | Apple Developer Forums
Based on issue 683757, I used a python 3.8 environment, but I still got the same error: (tensorflow-metal_env) (base) f@As-MBP Environments % pip...
Read more >
Getting different TensorFlow version - Deepnote Community
Sorry, my bad. My workaround not working, because at the time of installation of the new TensorFlow, pip still can see the original...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found