Learning to Weight Samples for Dynamic Early-exiting Networks