<jupyter_start><jupyter_text>Visualizing Rotated MINST samples<jupyter_code>#Common imports
import os
import random
import copy
import numpy as np

#Pillow
from PIL import Image  
import PIL  

#Matplotlib
from matplotlib.pyplot import imshow

#Pytorch
import torch
import torch.utils.data as data_utils
from torchvision import datasets, transforms
data_obj= datasets.MNIST('../../data/rot_mnist',
                        train=True,
                        download=False,
                        transform=transforms.ToTensor()
                    )
train_loader = torch.utils.data.DataLoader(data_obj,
                                                   batch_size=60000,
                                                   shuffle=False)


for i, (x, y) in enumerate(train_loader):
    mnist_imgs = x
    mnist_labels = y
to_pil=  transforms.Compose([
                transforms.ToPILImage(),
            ])
angles=[0, 15, 30, 45, 60, 75, 90]
indice= random.randint(0, mnist_imgs.shape[0])
mnist_img= mnist_imgs[indice]
rotated_imgs=[]
for angle in angles:
    rotated_imgs.append( transforms.functional.rotate( to_pil(mnist_img), angle) )
counter=0
for img in rotated_imgs:
    img.save('../../results/rot_mnist/images/' + str(angles[counter]) + '.jpg')
    counter+=1<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.09992313604919292, 'fraction_numerical': 0.016910069177555727, 'mean_word_length': 2.390625, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 6, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '514433', 'license': 'MIT', 'n_tokens_mistral': 431, 'n_tokens_neox': 400, 'n_words': 91, 'path': 'docs/notebooks/helper_plots.ipynb', 'repo_name': 'nijinjose/robustdg', 'size': '1301'}