Yes and no. I know nothing about Norway's rail system, but it was the case in the UK that a lot of electrified rail was only partially used because services that ran on both electrified and non-electrified tracks needed to be powered by diesel for the entire journey.
This has got a lot better more recently as we now have hybrid trains that can run on electricity whenever there are overhead lines, and diesel where there aren't. There is talk of replacing diesel engines with batteries so that they can run on electric (and use regenerative braking) even where there are no overhead lines, charging the batteries from the overhead line when available. https://anonw.com/2023/06/27/what-will-be-the-range-of-a-hit...
There are usually multiple diesel generators on each train, so it's likely that the batteries will only replace some of them - there would still be some diesel power available for emergencies.