Coal fired steam locomotives do produce a lot of CO2 emissions but also aerosols which has a cooling effect (global dimming), which cancels out some of the warming produced by CO2. Diesel locos probably produce less CO2 but also less aerosols that would cancel out the CO2.