# ---
# jupyter:
#   jupytext:
#     text_representation:
#       extension: .py
#       format_name: light
#       format_version: '1.5'
#       jupytext_version: 1.14.4
#   kernelspec:
#     display_name: Python 3
#     language: python
#     name: python3
# ---

# # Lab 02 : Training with epochs -- demo

import sys, os

import torch

# ### Let's make an artificial training set of 10 images (28x28 pixels)

train_data = torch.rand(10,28,28)
print(train_data.size())

# ### Let's define a random order in which we are going to visit these images

shuffled_indices = torch.randperm(10)
print(shuffled_indices)

# ### Visit the training set in this random order and do minibatch of size 2

# +
bs = 2

for count in range(0, 10, bs):
    
    batch_of_indices = shuffled_indices[count:count+bs]
    
    print(batch_of_indices)
    
    batch_of_images = train_data[batch_of_indices]

StarcoderdataJupyterScriptsDedupFiltered