Efficient Multi-task Adaption for Crossbar-based In-Memory Computing