parameters: (self)
return_statement: return [dic["train_images"], dic["train_fine_labels"], dic["train_coarse_labels"],
                  dic["test_images"], dic["test_fine_labels"], dic["test_coarse_labels"]]
docstring: Returns a list which contain train data & two labels, test data & two labels.
  
          Returns:
              list, train and test images, fine labels, coarse labels.
docstring_summary: Returns a list which contain train data & two labels, test data & two labels.
docstring_tokens: Returns a list which contain train data & two labels test data & two labels .
function: def load_data(self):
          """
          Returns a list which contain train data & two labels, test data & two labels.
  
          Returns:
              list, train and test images, fine labels, coarse labels.
          """
          dic = {}
          fine_labels = []
          coarse_labels = []
          files = os.listdir(self.path)
          for file in files:
              if file == "train":
                  real_file_path = os.path.realpath(self.path)
                  with open(os.path.join(real_file_path, file), 'rb') as f: # load train data
                      dic = restricted_loads(f.read())
                      images = np.array(dic[b"data"].reshape([-1, 3, 32, 32]))
                      fine_labels.append(dic[b"fine_labels"])
                      coarse_labels.append(dic[b"coarse_labels"])
              elif file == "test":                                     # load test data
                  real_file_path = os.path.realpath(self.path)
                  with open(os.path.join(real_file_path, file), 'rb') as f:
                      dic = restricted_loads(f.read())
                      test_images = np.array(dic[b"data"].reshape([-1, 3, 32, 32]))
                      test_fine_labels = np.array(dic[b"fine_labels"])
                      test_coarse_labels = np.array(dic[b"coarse_labels"])
          dic["train_images"] = images.transpose(0, 2, 3, 1)
          dic["train_fine_labels"] = np.array(fine_labels).reshape([-1, 1])
          dic["train_coarse_labels"] = np.array(coarse_labels).reshape([-1, 1])
          dic["test_images"] = test_images.transpose(0, 2, 3, 1)
          dic["test_fine_labels"] = test_fine_labels.reshape([-1, 1])
          dic["test_coarse_labels"] = test_coarse_labels.reshape([-1, 1])
          if self.one_hot:
              dic["train_fine_labels"] = self._one_hot(dic["train_fine_labels"], 100)
              dic["train_coarse_labels"] = self._one_hot(dic["train_coarse_labels"], 20)
              dic["test_fine_labels"] = self._one_hot(dic["test_fine_labels"], 100)
              dic["test_coarse_labels"] = self._one_hot(dic["test_coarse_labels"], 20)
  
          self.images, self.fine_labels, self.coarse_labels = \
              dic["train_images"], dic["train_fine_labels"], dic["train_coarse_labels"]
          self.Test.images, self.Test.fine_labels, self.Test.coarse_labels = \
              dic["test_images"], dic["test_fine_labels"], dic["test_coarse_labels"]
          return [dic["train_images"], dic["train_fine_labels"], dic["train_coarse_labels"],
                  dic["test_images"], dic["test_fine_labels"], dic["test_coarse_labels"]]
function_tokens: def load_data ( self ) : dic = { } fine_labels = [ ] coarse_labels = [ ] files = os . listdir ( self . path ) for file in files : if file == "train" : real_file_path = os . path . realpath ( self . path ) with open ( os . path . join ( real_file_path , file ) , 'rb' ) as f : # load train data dic = restricted_loads ( f . read ( ) ) images = np . array ( dic [ b"data" ] . reshape ( [ - 1 , 3 , 32 , 32 ] ) ) fine_labels . append ( dic [ b"fine_labels" ] ) coarse_labels . append ( dic [ b"coarse_labels" ] ) elif file == "test" : # load test data real_file_path = os . path . realpath ( self . path ) with open ( os . path . join ( real_file_path , file ) , 'rb' ) as f : dic = restricted_loads ( f . read ( ) ) test_images = np . array ( dic [ b"data" ] . reshape ( [ - 1 , 3 , 32 , 32 ] ) ) test_fine_labels = np . array ( dic [ b"fine_labels" ] ) test_coarse_labels = np . array ( dic [ b"coarse_labels" ] ) dic [ "train_images" ] = images . transpose ( 0 , 2 , 3 , 1 ) dic [ "train_fine_labels" ] = np . array ( fine_labels ) . reshape ( [ - 1 , 1 ] ) dic [ "train_coarse_labels" ] = np . array ( coarse_labels ) . reshape ( [ - 1 , 1 ] ) dic [ "test_images" ] = test_images . transpose ( 0 , 2 , 3 , 1 ) dic [ "test_fine_labels" ] = test_fine_labels . reshape ( [ - 1 , 1 ] ) dic [ "test_coarse_labels" ] = test_coarse_labels . reshape ( [ - 1 , 1 ] ) if self . one_hot : dic [ "train_fine_labels" ] = self . _one_hot ( dic [ "train_fine_labels" ] , 100 ) dic [ "train_coarse_labels" ] = self . _one_hot ( dic [ "train_coarse_labels" ] , 20 ) dic [ "test_fine_labels" ] = self . _one_hot ( dic [ "test_fine_labels" ] , 100 ) dic [ "test_coarse_labels" ] = self . _one_hot ( dic [ "test_coarse_labels" ] , 20 ) self . images , self . fine_labels , self . coarse_labels = dic [ "train_images" ] , dic [ "train_fine_labels" ] , dic [ "train_coarse_labels" ] self . Test . images , self . Test . fine_labels , self . Test . coarse_labels = dic [ "test_images" ] , dic [ "test_fine_labels" ] , dic [ "test_coarse_labels" ] return [ dic [ "train_images" ] , dic [ "train_fine_labels" ] , dic [ "train_coarse_labels" ] , dic [ "test_images" ] , dic [ "test_fine_labels" ] , dic [ "test_coarse_labels" ] ]