ParametersRecord#

class ParametersRecord(array_dict: OrderedDict[str, Array] | None = None, keep_input: bool = False)[源代码]#

基类:TypedDict[str, Array]

Parameters record.

A dataclass storing named Arrays in order. This means that it holds entries as an OrderedDict[str, Array]. ParametersRecord objects can be viewed as an equivalent to PyTorch's state_dict, but holding serialised tensors instead.

Methods

clear()

Remove all items from R.

count_bytes()

Return number of Bytes stored in this object.

get(k[,d])

d defaults to None.

items()

keys()

pop(k[,d])

If key is not found, d is returned if given, otherwise KeyError is raised.

update([E, ]**F)

Update R from dict/iterable E and F.

values()

clear() None.#

Remove all items from R.

count_bytes() int[源代码]#

Return number of Bytes stored in this object.

Note that a small amount of Bytes might also be included in this counting that correspond to metadata of the serialized object (e.g. of NumPy array) needed for deseralization.

get(k[, d]) R[k] if k in R, else d.#

d defaults to None.

items() a set-like object providing a view on R's items.#
keys() a set-like object providing a view on R's keys.#
pop(k[, d]) v, remove specified key and return the corresponding value.#

If key is not found, d is returned if given, otherwise KeyError is raised.

update([E, ]**F) None.#

Update R from dict/iterable E and F.

values() an object providing a view on R's values.#