In contrast to the often-heard doomsday commentaries that robots will replace human workers, research firm Gartner predicts that artificial intelligence may actually create more jobs than it's expected to eliminate.

By 2020, artificial intelligence (AI) will generate 2.3 million jobs, exceeding the 1.8 million that it will wipe out, the company said in a recent report. In the following five years to 2025, net new jobs created in relation to AI will reach 2 million, according to the report.

The number of jobs affected will vary from industry to industry. The public sector, healthcare and education are expected to gain the most jobs, while manufacturing and transportation may be the hit the hardest, said Gartner's research director, Manjunath Bhat.

"Robots are not here to take away our jobs, they're here to give us a promotion – I think that's the way we should start looking at AI," Bhat told CNBC on Tuesday.