In the context of CPUs, yes, the heat produced is equal to the input power. However this is not at all true for light bulbs, for motors, for battery chargers, etc. A light bulb in particular transforms some of the electrical energy into heat, but some of it into emitted light.
Even in incandescent bulbs, some the electricity gets turned into heat, raising the temperature of the filament, but past some point, the temperature no longer increases and all the extra energy gets converted into light. That is, if you were to submerge an incandescent light bulb in a large quantity of water and leave it on for 10 minutes, you'd get cooler water than if you submerged just the filament (ignoring the possible shortcircuits): if the temperature of the filament is kept below the point where it emits light, than all the electrocity goes into heat; but if it starts emitting light, then some of the energy escapes and doesn't heat the water.