1

私の Keras モデルは、Keras リポジトリの babi_rnn の例です。

データセットでモデルの出力 (言葉で) を取得したい。

私は試した:

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'

入力によって供給されたモデルまたはレイヤーの出力を簡単に取得するにはどうすればよいですか?

つまり、必要です

    # 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.

私ができるように:モデルが実際に何for x, y in zip(X,Y): print(x,y)をしているのかを見るために。

これは最も単純なユースケースであるべきだと思いますが、実装するのは面倒です。

どんな助けでも大歓迎です。ありがとう。

4

1 に答える 1