megvii-model / SinglePathOneShot

MIT License
259 stars 53 forks source link

One called function in EA search has no effect and should be removed #16

Closed AlbertiPot closed 3 years ago

AlbertiPot commented 3 years ago

Hi, thanks for your excellent work while I have one confusion below

In src/Search/search.py, line230, below called function has no effect in every search loop

self.get_random(self.population_num)

After the mutation and crossover, the total counts of the self.candidates is 50. When calling the above function, the while loop will not be executed because the bool expression in line 139 is False.

Besides, line 131, variable info pointed to self.vis_dict[cand] is never used which should be removed too maybe😉

Regards,

larenzhang commented 3 years ago

Actually, in some cases, for example in some FLOPs constrain, the total number of mutation and crossover candidates is less than 50. Therefore, it is necessary to add this code 'self.get_random(self.population_num)' to keep the number of self.candidates always 50. As for the code in line 131, it is actually redundant and we will remove it soon.

Thanks for your interest and kind reminders!

AlbertiPot commented 3 years ago

Got it! Thank you for your replying and bravo work!