0

I try to load my data for training in a machine learning model. This is te function that I have:

  def load_train_data(nb_data, validation_split):

        x_train=np.empty([nb_data,nb_samples], dtype='float32')
        y_train=np.empty([nb_data], dtype='uint8')

        py_train_all=np.loadtxt('Labels_File.txt', dtype='uint8')

        cmpt=0
        if nb_traces_train > nb_traces_train_all:
            print('Errors');
            sys.exit(1)
        for lines in open('/Files.list','r'):
            bin_file='directory/'+lines.rstrip()+'.bin'
            if cmpt < nb_traces_train:
                x_train[cmpt]=np.fromfile(bin_file, dtype='float32')
                y_train[cmpt]=y_train_all[cmpt]
                if cmpt%10000==0:
                    print ("Load %s in <TRAIN>" % cmpt)
                    cmpt=cmpt+1
                else:
                    print('ERROR')
            else:
                print('ERROR')
        return (x_train,y_train) #,(x_val, y_val)

This the problem that I have:

    if cmpt < nb_traces_train:
                             ^
TabError: inconsistent use of tabs and spaces in indentation

I use the notepad++ as an editor, it is not the first time that I use python3, but try to revise my tabulation but I don't find where is the problem, I woul be very grateful if you could help me please.

  • @Martijn Pieters I have checked what you put as a solution but it does not resolve my problem. I have already checked all possibilities before asking my question –  Oct 25 '17 at 16:10
  • I don't think you have read the answer thoroughly there. And a trivial search for 'notepad++ tabs to spaces' turns up [Convert tabs to spaces in Notepad++](//stackoverflow.com/q/455037) – Martijn Pieters Oct 25 '17 at 16:17

0 Answers0