def METHOD_NAME(dim):
    shape = np.random.randint(1, 10, [dim]).tolist()
    if self.as_tensor:
        data = to_dlpack(torch.rand(size=[self.batch_size] + shape, device=self.device))
    else:
        data = [to_dlpack(torch.rand(shape, device=self.device)) for _ in
                range(self.batch_size)]
    return data