Imported from https://github.com/jingli9111/GORU-tensorflow