Imported from https://github.com/Amaranth819/3dr2n2-tensorflow