Imported from https://github.com/unsuthee/VariationalDeepSemanticHashing