Skip to main content

PyTorchData

PyTorchData​

PyTorchData(dataset: Dataset)

Bases: Subscriptable

Class to wrap around a Dataset retrieved from PyTorch datasets

The dataset in this case can be iterated over. So the only thing that needs to be implemented is generate_query, which takes an index and returns a query.

Note

This class should be subclassed with a specific (custom) implementation of generate_query().

Example subclass: CocoDataPyTorch

generate_query​

generate_query(idx: int) -> Tuple[List[dict], List[bytes]]

Takes information from one atomic record from the Data and converts it to Query for ApertureDB

Parameters:

NameTypeDescriptionDefault
idxint

index of the record in collection.

required

Raises:

TypeDescription
Exception

description

Returns:

TypeDescription
Tuple[List[dict], List[bytes]]

Tuple[List[dict], List[bytes]]: A pair of list of commands and optional list of blobs to go with them.