Nonlinear Invariant Risk Minimization: A Causal Approach