def load_MNIST_labels(filename):
 with open(filename, 'r') as f:
  magic = np.fromfile(f, dtype=np.dtype('>i4'), count=1)
  num_labels = np.fromfile(f, dtype=np.dtype('>i4'), count=1)
  labels = np.fromfile(f, dtype=np.ubyte)
  f.close()
  return labels

def load_MNIST_labels ( filename ) : with open ( filename , 'r' ) as f : magic = np . fromfile ( f , dtype = np . dtype ( '>i4' ) , count = 1 ) num_labels = np . fromfile ( f , dtype = np . dtype ( '>i4' ) , count = 1 ) labels = np . fromfile ( f , dtype = np . ubyte ) f . close ( ) return labels
returns a [number of mnist images]x1 matrix containing the labels for the mnist images .