File: test_mem.py

package info (click to toggle)
python-thinc 9.1.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 5,896 kB
  • sloc: python: 17,122; javascript: 1,559; ansic: 342; makefile: 15; sh: 13
file content (12 lines) | stat: -rw-r--r-- 359 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
import numpy

from thinc.backends._param_server import ParamServer


def test_param_server_init():
    array = numpy.zeros((5,), dtype="f")
    params = {("a", 1): array, ("b", 2): array}
    grads = {("a", 1): array, ("c", 3): array}
    ps = ParamServer(params, grads)
    assert ps.param_keys == (("a", 1), ("b", 2))
    assert ps.grad_keys == (("a", 1),)