hi @Eta_C @ptrblck  thanks for this your reply, but I have other problem
    train_x=patches_diff
    train_y=labels
    patches_diff = patches_diff.reshape(patches_diff.shape[0], patches_diff.shape[1] * patches_diff.shape[2])
    train_x, val_x, train_y, val_y = train_test_split(train_x, train_y, test_size=0.4)
    train_x = train_x.reshape(train_x.shape[0], 1, train_x.shape[1], train_x.shape[2])  
    train_x = torch.from_numpy(train_x)
    print('train',train_x)
    mat_fname_diff = pjoin('./sample_data/', 'img1taille500.mat')
    #print('Mat loading ...')
    mat_diff = sio.loadmat(mat_fname_diff)
    print(mat_diff)
    abscice=[];
    cordonne=[];
    k=0;
    c=0;
    i=0;
    j=0;
    k1=0;
    abscice=[];
    ordonnee=[];
    x=train_x[k];
    k1=0
    while (k!=(4)):
      while((i!=20) and (j!=20) and (x[:5, :5] != mat_diff[i:i+5, j:j+5])):
        j=j+1;

          # for j in range (95):

      if (x[:5, :5] == mat_diff[i:i+5, j:j+5]):
          x1= i+2;
          y1=j+2;
          #print("les axes",x1,y1)
          abscice[k]= x1;
          ordonne[k]=y1;
          #print(abscice,ordonne)
          #c=c+1;
          #print("nombre:",c)
          k=k+1; 
          x=patches_diff[k];
          j=0;
          i=0;       
      elif (i==(20)):
          i=0;
          j=j+1;
      else :
          j=0;
          i=i+1;
   

TypeError: unhashable type: ‘slice’
help me plzz