U.S. President Donald Trump has signed a voluntary pact with artificial intelligence companies to "self-police" the technology's development.