내 Keras 모델은 Keras 저장소에 babi_rnn example입니다.Keras 모델/레이어의 출력을 얻으려면
데이터 세트의 모델 출력 (단어)을 가져오고 싶습니다.
내가 시도 :
layer = model.layers[-1] # For the last layer
f = K.function([model.get_input(train=False)], [layer.get_output(train=False)])
print(f([x])[0]) # your activation tensor
하지만 오류 얻을 :
AttributeError: 'Sequential' object has no attribute 'get_input'
어떻게 단순히 입력에 의해 공급되는시 모델 또는 레이어의 출력을 얻을 수 있습니까? 실제로을하는 모델이 무엇인지 을보고하기위한 for x, y in zip(X,Y): print(x,y)
:입니다
, 나는
# I supply the X list and want to get the Y list.
Y = Model(X) # X and Y are both lists. Model.Layer[Index] can also be a use case.
# The responses are the set of label probabilities for each word in the vocabulary.
내가 할 수 있도록
이 필요합니다.이것은 가장 단순한 사용 사례 여야한다고 생각하지만 구현하기 까다로운 것으로 보입니다.
도움을 주시면 감사하겠습니다. 감사.
도움을 주셔서 감사합니다. 일반적으로 어떤 레이어의 출력을 얻는 방법을 설명 할 수 있습니까? 나는 시도했지만 질문에 오류가 발생했습니다. 감사. – Rafael
어떤 레이어 든 'model.layers [index] .input''model.layers [index] .output'을 사용하여 레이어의 입출력을 얻을 수 있습니다. 또한 순차적 인 모델의 경우 전체 모델의 입력과 출력에'model.input'','model.output'을 사용할 수 있습니다. – indraforyou