Spaces:
Runtime error
Runtime error
File size: 894 Bytes
128757a |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
import math
from typing import TypeVar, Optional, Iterator
import torch
from torch.utils.data import Sampler, Dataset
import torch.distributed as dist
import random
import numpy as np
def create_duplicate_dataset(DatasetBaseClass):
class DupDataset(DatasetBaseClass):
def __init__(self, copy, **kwargs):
super(DupDataset, self).__init__(**kwargs)
self.copy = copy
self.length = super(DupDataset, self).__len__()
def __len__(self):
return self.copy * self.length
def __getitem__(self, index):
true_index = index % self.length
return super(DupDataset, self).__getitem__(true_index)
def get_img_info(self, index):
true_index = index % self.length
return super(DupDataset, self).get_img_info(true_index)
return DupDataset
|