Memory-Consistent Neural Networks for Imitation Learning