Toyota has announced that it is to pull out of Formula 1 with immediate effect.