# ---
# 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
# ---

import tensorflow as tf
import numpy as np

from tensorflow.examples.tutorials.mnist import input_data
mnist = input_data.read_data_sets("MNIST_data/")#, one_hot=True

# +
X_full = mnist.train.images
Y_full = mnist.train.labels

num_classes = len(set(Y_full))
input_size=10 #Somany samples from each class

X=np.zeros([100, 784])
xx=[]
a=0
for j in range(0,num_classes):
    yy = [i for i in range(len(Y_full)) if Y_full[i]==j]
    yy1 = np.random.choice(yy, input_size)
    for i in yy1:
        xx=X_full[i,:]
        X[a,:]=xx
        a=a+1
    #X.append(xx)
np.random.shuffle(X)
X.shape

# +
#Sofm 10x10 
# -



StarcoderdataJupyterScriptsDedupFiltered