Set the input data and run deterministic transforms to generate cache content. Note: should call `shutdown()` before calling this func.
(self, data: Sequence)
| 1097 | self._compute_data_idx() |
| 1098 | |
| 1099 | def set_data(self, data: Sequence): |
| 1100 | """ |
| 1101 | Set the input data and run deterministic transforms to generate cache content. |
| 1102 | |
| 1103 | Note: should call `shutdown()` before calling this func. |
| 1104 | |
| 1105 | """ |
| 1106 | if self.is_started(): |
| 1107 | warnings.warn("SmartCacheDataset is not shutdown yet, shutdown it directly.") |
| 1108 | self.shutdown() |
| 1109 | |
| 1110 | if self.shuffle: |
| 1111 | data = copy(data) |
| 1112 | self.randomize(data) |
| 1113 | super().set_data(data) |
| 1114 | |
| 1115 | def randomize(self, data: Sequence) -> None: |
| 1116 | try: |