Bio-inspired learning and hardware acceleration with emerging memories