Grant on Slavery

It's interesting that by the time Grant wrote his memoir he was anti-slavery. From what I can tell, when he went off to fight in the Civil War, he held no such positions. He also owned a slave for a short period. Does anyone here know anything about how Grant's views evolved? Did the war change how he saw slavery? It's clear that by the time he was president, he was in league with the Republicans. But does anyone have any insights on how the changeĀ happened?