This script includes io::snapshot class and its methods.

Example usages:

from singa import snapshot

sn1 = snapshot.Snapshot('param', False)
params =  # read all params as a dictionary

sn2 = snapshot.Snapshot('param_new', False)
for k, v in params.iteritems():
    sn2.write(k, v)
class singa.snapshot.Snapshot(f, mode, buffer_size=10)

Class and member functions for singa::Snapshot.


Call read method to load all (param_name, param_val)

Returns:a dict of (parameter name, parameter Tensor)
write(param_name, param_val)

Call Write method to write a parameter

  • param_name (string) – name of the parameter
  • param_val (Tensor) – value tensor of the parameter