rllm.data.BaseStorage

class rllm.data.BaseStorage(initialdata: Dict[str, Any] | None = None, **kwargs)[source]

Bases: MutableMapping

A base class for storing nodes or edges in a graph. This class wraps a Python dictionary and extends it as follows:

  1. It allows attribute assignments, e.g.: storage.x = … in addition to storage[‘x’] = …

  2. It allows private attributes that are not exposed to the user, e.g.: storage._{key} = … and accessible via storage._{key}

  3. It holds an (optional) weak reference to its parent object, e.g.: storage._parent = weakref.ref(parent)

  4. It adds additional PyTorch Tensor functionality, e.g.: storage.cpu(), storage.cuda().

get(k[, d]) D[k] if k in D, else d.  d defaults to None.[source]
items() a set-like object providing a view on D's items[source]
keys() a set-like object providing a view on D's keys[source]
values() an object providing a view on D's values[source]