ml_genn.serialisers package

Serialisers are used to serialise and deserialiser model state e.g. for saving and resuming from checkpoints. Serialisers provide a filesystem like data model where data is stored at a ‘path’ specified by a sequence of keys (which can be any object that is convertable to string)

class ml_genn.serialisers.Numpy(path='')

Bases: Serialiser

Basic numpy based serialiser. Stores arrays as individual numpy binary files with paths mapped to filesystem directory structure.

Parameters:

path (str) – File system path to serialise and deserialise relative to

deserialise(keys)

Deserialise a single array from a ‘path’

Parameters:

keys – sequence of keys describing path (keys can be any object that is convertable to string).

deserialise_all(keys)

Recursively deserialises all arrays beneath a ‘path’

Parameters:

keys – sequence of keys describing path to recurse from (keys can be any object that is convertable to string).

serialise(keys, data)

Serialise a single array to a ‘path’

Parameters:
  • keys – sequence of keys describing path (keys can be any object that is convertable to string).

  • data – numpy array of data

class ml_genn.serialisers.Serialiser

Bases: ABC

Base class for all serialisers

abstract deserialise(keys)

Deserialise a single array from a ‘path’

Parameters:

keys – sequence of keys describing path (keys can be any object that is convertable to string).

Return type:

ndarray

abstract deserialise_all(keys)

Recursively deserialises all arrays beneath a ‘path’

Parameters:

keys – sequence of keys describing path to recurse from (keys can be any object that is convertable to string).

Return type:

Dict

abstract serialise(keys, data)

Serialise a single array to a ‘path’

Parameters:
  • keys – sequence of keys describing path (keys can be any object that is convertable to string).

  • data (ndarray) – numpy array of data