This object helps us keep track of the data associated with a batch used throughout the deep learning pipelines of CVCUDA. In addition of tracking the data tensors associated with the batch, it allows tracking the index of the batch and any filename information one wants to atta
| 20 | |
| 21 | |
| 22 | class Batch: |
| 23 | """ |
| 24 | This object helps us keep track of the data associated with a batch used |
| 25 | throughout the deep learning pipelines of CVCUDA. |
| 26 | In addition of tracking the data tensors associated with the batch, it |
| 27 | allows tracking the index of the batch and any filename information one |
| 28 | wants to attach (i.e. which files did the data come from). |
| 29 | """ |
| 30 | |
| 31 | def __init__( |
| 32 | self, |
| 33 | batch_idx: int, |
| 34 | data: Union[cvcuda.Tensor, np.ndarray, torch.Tensor], |
| 35 | fileinfo: Union[str, List[str]], |
| 36 | ): |
| 37 | """ |
| 38 | Initializes a new instance of the `Batch` class. |
| 39 | :param batch_idx: A zero based int specifying the index of this batch. |
| 40 | :param data: The data associated with this batch. Either a torch/CVCUDA tensor or a numpy array. |
| 41 | :param fileinfo: Either a string or list or strings specifying any filename information of this batch. |
| 42 | """ |
| 43 | self.batch_idx = batch_idx |
| 44 | self.data = data |
| 45 | self.fileinfo = fileinfo |