いつもお世話になっております。
kerasとtensorflowをインストールした環境下で以下のようなコードを打ってみたのですが…
model = Sequential() model.add(Conv2D(32, (3, 3), input_shape=input_shape)) model.add(Activation('relu')) model.add(MaxPooling2D(pool_size=(2, 2))) model.add(Conv2D(32, (3, 3))) model.add(Activation('relu')) model.add(MaxPooling2D(pool_size=(2, 2))) model.add(Conv2D(64, (3, 3))) model.add(Activation('relu')) model.add(MaxPooling2D(pool_size=(2, 2))) model.add(Flatten()) model.add(Dense(64)) model.add(Activation('relu')) model.add(Dropout(0.5)) model.add(Dense(1)) model.add(Activation('sigmoid'))
このようなエラーが出てきて困っています。
--------------------------------------------------------------------------- AttributeError Traceback (most recent call last) <ipython-input-34-13e5b2e4f024> in <module>() 1 model = Sequential() ----> 2 model.add(Conv2D(32, (3, 3), input_shape=input_shape)) 3 model.add(Activation('relu')) 4 model.add(MaxPooling2D(pool_size=(2, 2))) 5 ~/.pyenv/versions/anaconda3-5.0.0/lib/python3.6/site-packages/keras/engine/sequential.py in add(self, layer) 163 # and create the node connecting the current layer 164 # to the input layer we just created. --> 165 layer(x) 166 set_inputs = True 167 else: ~/.pyenv/versions/anaconda3-5.0.0/lib/python3.6/site-packages/keras/engine/base_layer.py in __call__(self, inputs, **kwargs) 412 # Raise exceptions in case the input is not compatible 413 # with the input_spec specified in the layer constructor. --> 414 self.assert_input_compatibility(inputs) 415 416 # Collect input shapes to build layer. ~/.pyenv/versions/anaconda3-5.0.0/lib/python3.6/site-packages/keras/engine/base_layer.py in assert_input_compatibility(self, inputs) 277 for x in inputs: 278 try: --> 279 K.is_keras_tensor(x) 280 except ValueError: 281 raise ValueError('Layer ' + self.name + ' was called with ' ~/.pyenv/versions/anaconda3-5.0.0/lib/python3.6/site-packages/keras/backend/tensorflow_backend.py in is_keras_tensor(x) 470 ``` 471 """ --> 472 if not is_tensor(x): 473 raise ValueError('Unexpectedly found an instance of type `' + 474 str(type(x)) + '`. ' ~/.pyenv/versions/anaconda3-5.0.0/lib/python3.6/site-packages/keras/backend/tensorflow_backend.py in is_tensor(x) 478 479 def is_tensor(x): --> 480 return isinstance(x, tf_ops._TensorLike) or tf_ops.is_dense_tensor_like(x) 481 482 AttributeError: module 'tensorflow.python.framework.ops' has no attribute '_TensorLike'
調べてみたところ、tensorflowの最新版をダウンロードする必要があると分かり、アップグレードしてみたのですが、状況が変わりません。
素人の質問で申し訳ありませんが、ご指導よろしくお願いします。
あなたの回答
tips
プレビュー