In an appearance before the House Financial Services Committee, Yellen said if the U.S. looks at the flight of jobs and wages from middle-class families, it must take into account how automation has eliminated several lower-skilled jobs.

"Wages and jobs of middle-class families that have seen diminishing opportunities and downward pressure on middle-class wages, we have to take into account factors of the technological change that have eliminated middle-income jobs and globalization that has reinforced the impact of tech," said Yellen.

That "has to be an important piece to understand what has happened," she said.

Yellen acknowledged that it's possible that certain sectors, like retail, have eliminated jobs in order to bring greater returns to their investors.

"For many years, many American companies have been sitting on a lot of cash and have been unwilling to undertake investment in the scale we would ideally like to see," Yellen said.

"Over time I think we will probably see a closer merger of biological intelligence and digital intelligence," Musk told an audience in mid-February.

The U.S. job market surged in June, with a better-than-expected 222,000 new positions created while the unemployment rate held at 4.4 percent. Wage growth remained muted with few signs of accelerating. And the labor force participation rate edged higher to 62.8 percent.