When using Keras, I get an error and cannot run. If i am familiar with Keras, please teach me. Thank you.

Error message

I use a jupyter notebook and the following is the input code.


from keras.models import Sequential
  from keras.layers import Dense


model = Sequential ()
  model.add (Dense (64, activation ='relu&apos ;, input_dim = 784))

When the above code is executed, the following error message appears.


AttributeError: module'tensorflow.python.framework.ops'has no attribute'_TensorLike'

It looks like you can import Keras and tensorflow, but I get an error and can't proceed. It seems that this error appears when "input_dim = 784" is entered.


After checking the error in English, there was no answer to the same question yet, and no answer answered directly that it was in Japanese.

Supplemental information (FW/tool version etc.)

・ Macbook Pro 10.12.6 (Good quality second-hand goods)
・ Echo $PATH
/ anaconda3/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin

・ .bash_profile

export PYENV_ROOT ="$HOME/.pyenv" export PATH ="$PYENV_ROOT/bin: $PATH" eval"$(pyenv init-)" export PATH ="/anaconda3/bin: $PATH"

・ Python 3.6.1
・ Tensorflow 0.10.0
・ Keras 2.2.2

  • Answer # 1


    It is necessary to download the latest tensorflow because it cannot be used without upgrading tensorflow. But
    pip3 install -U tensorflow
    And type the following error:
    Could not install packages due to an EnvironmentError: [Errno 13] Permission denied: u'/private/var/folders/4y/z038tqx15jvfqptw0s_tmz8w0000gp/T/pip-unpack-Sk9pwB/tensorflow-1.8.0-cp27-cp27m-macosx_10_11_86_86 ;
    Consider using the --user option or check the permissions.

    This is probably an error because/private/var/folders/4y/z038tqx15jvfqptw0s_tmz8w0000gp/T/pip-unpack-Sk9pwB/This directory did not exist It seems to have been.

    First, create this directory yourself and access restrictions are applied.
    Search for the file, download it and place it there. In that place
    pip3 install -U tensorflow-1.8.0-cp27-cp27m-macosx_10_11_x86_64.whl
    I was able to download it.

    You can now use Keras and others that you can't use without a tensorflow upgrade.

Related articles