Skip to content

Commit

Permalink
Fix rtype reference
Browse files Browse the repository at this point in the history
  • Loading branch information
mthrok committed Dec 21, 2020
1 parent 613ee82 commit 5b8f220
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion torchtext/csrc/regex.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ std::string _serialize_regex(const c10::intrusive_ptr<Regex> &self) {
return self->re_str_;
}

c10::intrusive_ptr<Regex> _deserialize_regex(std::string state) {
c10::intrusive_ptr<Regex> _deserialize_regex(std::string &&state) {
return c10::make_intrusive<Regex>(std::move(state));
}

Expand Down
2 changes: 1 addition & 1 deletion torchtext/csrc/regex.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@ struct Regex : torch::CustomClassHolder {
};

std::string _serialize_regex(const c10::intrusive_ptr<Regex> &self);
c10::intrusive_ptr<Regex> _deserialize_regex(std::string state);
c10::intrusive_ptr<Regex> _deserialize_regex(std::string &&state);

} // namespace torchtext
2 changes: 1 addition & 1 deletion torchtext/csrc/regex_tokenizer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ RegexTokenizerStates _serialize_regex_tokenizer(const c10::intrusive_ptr<RegexTo
return std::make_tuple(self->patterns_, self->replacements_, self->to_lower_);
}

c10::intrusive_ptr<RegexTokenizer> _deserialize_regex_tokenizer(RegexTokenizerStates states) {
c10::intrusive_ptr<RegexTokenizer> _deserialize_regex_tokenizer(RegexTokenizerStates &&states) {
return c10::make_intrusive<RegexTokenizer>(
std::move(std::get<0>(states)),
std::move(std::get<1>(states)),
Expand Down
2 changes: 1 addition & 1 deletion torchtext/csrc/regex_tokenizer.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,6 @@ struct RegexTokenizer : torch::CustomClassHolder {
};

RegexTokenizerStates _serialize_regex_tokenizer(const c10::intrusive_ptr<RegexTokenizer> &self);
c10::intrusive_ptr<RegexTokenizer> _deserialize_regex_tokenizer(RegexTokenizerStates states);
c10::intrusive_ptr<RegexTokenizer> _deserialize_regex_tokenizer(RegexTokenizerStates &&states);

} // namespace torchtext
10 changes: 5 additions & 5 deletions torchtext/csrc/register_bindings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ PYBIND11_MODULE(_torchtext, m) {
},
// __setstate__
[](std::string state) -> c10::intrusive_ptr<Regex> {
return _deserialize_regex(state);
return _deserialize_regex(std::move(state));
}));

py::class_<RegexTokenizer, c10::intrusive_ptr<RegexTokenizer>>(m, "RegexTokenizer")
Expand All @@ -53,7 +53,7 @@ PYBIND11_MODULE(_torchtext, m) {
},
// __setstate__
[](RegexTokenizerStates states) -> c10::intrusive_ptr<RegexTokenizer> {
return _deserialize_regex_tokenizer(states);
return _deserialize_regex_tokenizer(std::move(states));
}));

py::class_<SentencePiece, c10::intrusive_ptr<SentencePiece>>(m, "SentencePiece")
Expand Down Expand Up @@ -119,7 +119,7 @@ PYBIND11_MODULE(_torchtext, m) {
},
// __setstate__
[](VocabStates states) -> c10::intrusive_ptr<Vocab> {
return _deserialize_vocab(states);
return _deserialize_vocab(states);
}));

// Functions
Expand All @@ -140,7 +140,7 @@ TORCH_LIBRARY_FRAGMENT(torchtext, m) {
},
// __setstate__
[](std::string state) -> c10::intrusive_ptr<Regex> {
return _deserialize_regex(state);
return _deserialize_regex(std::move(state));
});

m.class_<RegexTokenizer>("RegexTokenizer")
Expand All @@ -153,7 +153,7 @@ TORCH_LIBRARY_FRAGMENT(torchtext, m) {
},
// __setstate__
[](RegexTokenizerStates states) -> c10::intrusive_ptr<RegexTokenizer> {
return _deserialize_regex_tokenizer(states);
return _deserialize_regex_tokenizer(std::move(states));
});

m.class_<SentencePiece>("SentencePiece")
Expand Down

0 comments on commit 5b8f220

Please sign in to comment.