torch_geometric.data.RocksDatabase
- class RocksDatabase(path: str, schema: ~typing.Union[~typing.Any, ~typing.Dict[str, ~typing.Any], ~typing.Tuple[~typing.Any], ~typing.List[~typing.Any]] = <class 'object'>)[source]
Bases:
Database一个基于
RocksDB的索引键/值数据库。注意
此数据库实现需要
rocksdict包。警告
RocksDatabase目前没有SQLiteDatabase优化得好。- Parameters:
path (str) – The path to where the database should be saved.
schema (Any or Tuple[Any] or Dict[str, Any], optional) – The schema of the input data. Can take
int,float,str,object, or a dictionary withdtypeandsizekeys (for specifying tensor data) as input, and can be nested as a tuple or dictionary. Specifying the schema will improve efficiency, since by default the database will use python pickling for serializing and deserializing. (default:object)
- multi_get(indices: Union[Sequence[int], Tensor, slice, range], batch_size: Optional[int] = None) List[Any]
从指定的索引获取一块数据。
- multi_insert(indices: Union[Sequence[int], Tensor, slice, range], data_list: Sequence[Any], batch_size: Optional[int] = None, log: bool = False) None
在指定的索引处插入一块数据。
- Parameters:
indices (List[int] or torch.Tensor or range) – The indices at which to insert.
data_list (List[Any]) – The objects to insert.
batch_size (int, optional) – If specified, will insert the data to the database in batches of size
batch_size. (default:None)log (bool, optional) – If set to
True, will log progress to the console. (default:False)
- Return type: