Loading

Tensorflow Error[2]—TypeError: Value passed to parameter 'shape' has DataType float32 not in list of allowed values: int32, int64

Tensorflow 中的格式报错

TypeError: Value passed to parameter 'shape' has DataType float32 not in list of allowed values: int32, int64

错误代码

 

n = x/4
temp = Dense(n, activation='relu')(input)

 

更正代码

n = x/4
temp = Dense(int(n), activation='relu')(input)

使用 int()  进行类型强制转换,即可解决数据类型问题(Tensorflow 版本问题)

 

posted @ 2021-03-31 11:09  _yhwu  阅读(866)  评论(0编辑  收藏  举报