Redundancy and Analog Slicing for Precise In-Memory Machine Learning—Part I: Programming Techniques