(dataset, num_samples)
return images
Randomly sample without replacement num_samples images.

    Args:
        dataset (Dataset): Torch Dataset object for indexing elements.
        num_samples (int): The number of images to randomly sample.

    Returns:
        Tensor: Batch of num_samples images in np array form [N, H, W, C](0-255).
Randomly sample without replacement num_samples images.
Randomly sample without replacement num_samples images .
def get_random_images(dataset, num_samples):
    """
    Randomly sample without replacement num_samples images.

    Args:
        dataset (Dataset): Torch Dataset object for indexing elements.
        num_samples (int): The number of images to randomly sample.

    Returns:
        Tensor: Batch of num_samples images in np array form [N, H, W, C](0-255).
    """
    choices = np.random.choice(range(len(dataset)),
                               size=num_samples,
                               replace=False)

    images = []
    for choice in choices:
        img = np.array(dataset[choice][0])
        img = np.expand_dims(img, axis=0)
        images.append(img)
    images = np.concatenate(images, axis=0)

    return images
def get_random_images ( dataset , num_samples ) : choices = np . random . choice ( range ( len ( dataset ) ) , size = num_samples , replace = False ) images = [ ] for choice in choices : img = np . array ( dataset [ choice ] [ 0 ] ) img = np . expand_dims ( img , axis = 0 ) images . append ( img ) images = np . concatenate ( images , axis = 0 ) return images