BC-IRL: Learning Generalizable Reward Functions from Demonstrations