本文介绍了张量流中的添加方法问题:AttributeError:模块'tensorflow.python.framework.ops'没有属性'_TensorLike'的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

import keras as K
from keras.models import Sequential
from keras.layers import Dense
from tensorflow import set_random_seed

for hidden_neuron in hidden_neurons:
  model = Sequential()

model.add(Dense(hidden_neuron, input_dim=61, activation='relu'))

->我在这行出现错误.我不太确定我在这里想念什么.

-> i am getting error at this line. I am not really sure what am i missing here.

回溯(最近通话最近一次):

Traceback (most recent call last):

推荐答案

对我来说,此修复程序正在导入

For me, the fix was importing

from tensorflow.keras import Sequential
from tensorflow.keras.layers import Conv2D, Flatten, Dense

代替

from keras import Sequential
from keras.layers import Conv2D, Flatten, Dense

keras和tensorflow.keras之间似乎存在一些奇怪的兼容性问题

There seems to be some weird compatibility issues between keras and tensorflow.keras

这篇关于张量流中的添加方法问题:AttributeError:模块'tensorflow.python.framework.ops'没有属性'_TensorLike'的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-29 05:09