training classifier - based on pytorch www.programmerall.com