Imported from https://github.com/OpenNMT/OpenNMT-tf