mirror of
https://github.com/explosion/spaCy.git
synced 2025-08-02 11:20:19 +03:00
Add dropout layer
This commit is contained in:
parent
87bceb5639
commit
505f286515
|
@ -1,4 +1,3 @@
|
||||||
from encodings import search_function
|
|
||||||
from typing import Optional, List, Union, cast
|
from typing import Optional, List, Union, cast
|
||||||
import warnings
|
import warnings
|
||||||
from spacy.ml.richfeatureextractor import RichFeatureExtractor
|
from spacy.ml.richfeatureextractor import RichFeatureExtractor
|
||||||
|
@ -6,6 +5,7 @@ from thinc.types import Floats2d, Ints2d, Ragged
|
||||||
from thinc.api import chain, clone, concatenate, with_array, with_padded
|
from thinc.api import chain, clone, concatenate, with_array, with_padded
|
||||||
from thinc.api import Model, noop, list2ragged, ragged2list, HashEmbed
|
from thinc.api import Model, noop, list2ragged, ragged2list, HashEmbed
|
||||||
from thinc.api import expand_window, residual, Maxout, Mish, PyTorchLSTM
|
from thinc.api import expand_window, residual, Maxout, Mish, PyTorchLSTM
|
||||||
|
from thinc.api import Dropout
|
||||||
|
|
||||||
from ...tokens import Doc
|
from ...tokens import Doc
|
||||||
from ...util import registry
|
from ...util import registry
|
||||||
|
@ -296,6 +296,7 @@ def RichMultiHashEmbed(
|
||||||
),
|
),
|
||||||
max_out,
|
max_out,
|
||||||
ragged2list(),
|
ragged2list(),
|
||||||
|
Dropout(0.0)
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
model = chain(
|
model = chain(
|
||||||
|
@ -304,6 +305,7 @@ def RichMultiHashEmbed(
|
||||||
with_array(concatenate(*embeddings)),
|
with_array(concatenate(*embeddings)),
|
||||||
max_out,
|
max_out,
|
||||||
ragged2list(),
|
ragged2list(),
|
||||||
|
Dropout(0.0)
|
||||||
)
|
)
|
||||||
return model
|
return model
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user