Imported from https://github.com/sebastianGehrmann/tensorflow-statereader