Analog In-memory Training on General Non-ideal Resistive Elements: The Impact of Response Functions