'Плотный' объект не имеет атрибута 'op' - PullRequest
0 голосов
/ 07 апреля 2020

Я пытаюсь создать полностью подключенную модель с помощью tenorflow.keras, вот мой код

from tensorflow.keras.models import Model
from tensorflow.keras.layers import Input, Dense, Flatten

def load_model(input_shape):
  input = Input(shape = input_shape)
  dense_shape = input_shape[0]
  x = Flatten()(input)
  x = Dense(dense_shape, activation='relu')(x)
  x = Dense(dense_shape, activation='relu')(x)
  x = Dense(dense_shape, activation='relu')(x)
  x = Dense(dense_shape, activation='relu')(x)
  x = Dense(dense_shape, activation='relu')(x)

  output = Dense(10 , activation = 'softmax')
  model  = Model(input , output)
  model.summary()
  return model

, но когда я вызываю модель

model = load_model((120,))

, у меня появляется эта ошибка

'Dense' object has no attribute 'op'

Как это исправить?

1 Ответ

4 голосов
/ 07 апреля 2020

Попробуйте

output = Dense(10 , activation = 'softmax')(x)
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...