Learning to Importance Sample in Primary Sample Space