Expose the softmax layer in the tagger model, to allow setting tensors

This commit is contained in:
Matthew Honnibal 2017-11-03 11:19:51 +01:00
parent b30dd36179
commit b3264aa5f0

View File

@ -409,12 +409,14 @@ def build_tagger_model(nr_class, **cfg):
else: else:
tok2vec = Tok2Vec(token_vector_width, embed_size, tok2vec = Tok2Vec(token_vector_width, embed_size,
pretrained_dims=pretrained_dims) pretrained_dims=pretrained_dims)
softmax = with_flatten(Softmax(nr_class, token_vector_width))
model = ( model = (
tok2vec tok2vec
>> with_flatten(Softmax(nr_class, token_vector_width)) >> softmax
) )
model.nI = None model.nI = None
model.tok2vec = tok2vec model.tok2vec = tok2vec
model.softmax
return model return model