How Are AI Works Patented?

Patent law gives you the exclusive right to your invention’s commercial benefits, but who gets the rights for work created by a computer?