File: program.py

package info (click to toggle)
python-thinc 9.1.1-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 5,896 kB
  • sloc: python: 17,122; javascript: 1,559; ansic: 342; makefile: 15; sh: 13
file content (16 lines) | stat: -rw-r--r-- 480 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
from thinc.api import Relu, Softmax, chain, concatenate
from thinc.model import Model
from thinc.types import Floats2d

n_hidden = 32
dropout = 0.2

model1: Model[Floats2d, Floats2d] = chain(
    Relu(nO=n_hidden, dropout=dropout), Relu(nO=n_hidden, dropout=dropout), Softmax()
)

model2: Model[Floats2d, Floats2d] = chain(
    Relu(nO=n_hidden, dropout=dropout), Relu(nO=n_hidden, dropout=dropout), Softmax()
)

model3: Model[Floats2d, Floats2d] = concatenate(*[model1, model2])