KidsWithTokens / MedSegDiff

Medical Image Segmentation with Diffusion Model
MIT License
976 stars 145 forks source link

how to deal with StopIteration #167

Closed Sillyyk closed 2 months ago

Sillyyk commented 2 months ago
def _next_data(self):
    index = self._next_index()  # may raise StopIteration
    data = self._dataset_fetcher.fetch(index)  # may raise StopIteration
    if self._pin_memory:
        data = _utils.pin_memory.pin_memory(data, self._pin_memory_device)
    return data

plz

Issues-translate-bot commented 2 months ago

Bot detected the issue body's language is not English, translate it automatically. πŸ‘―πŸ‘­πŸ»πŸ§‘β€πŸ€β€πŸ§‘πŸ‘«πŸ§‘πŸΏβ€πŸ€β€πŸ§‘πŸ»πŸ‘©πŸΎβ€πŸ€β€πŸ‘¨πŸΏπŸ‘¬πŸΏ


def _next_data(self): index = self._next_index() # may raise StopIteration data = self._dataset_fetcher.fetch(index) # may raise StopIteration if self._pin_memory: data = _utils.pin_memory.pin_memory(data, self._pin_memory_device) return data

plz