Improve SymInt print and move to correct file (#85413)

Signed-off-by: Edward Z. Yang <ezyang@fb.com>
Pull Request resolved: https://github.com/pytorch/pytorch/pull/85413
Approved by: https://github.com/wconstab
This commit is contained in:
Edward Z. Yang
2022-09-21 11:24:23 -04:00
committed by PyTorch MergeBot
parent 3a09a1e8f0
commit a2cbbbd46f
2 changed files with 9 additions and 10 deletions

View File

@ -26,14 +26,4 @@ at::IntArrayRef asIntArrayRefUnchecked(c10::SymIntArrayRef ar) {
return IntArrayRef(reinterpret_cast<const int64_t*>(ar.data()), ar.size());
}
// TODO: this print is bad
std::ostream& operator<<(std::ostream& os, SymInt s) {
if (s.is_symbolic()) {
os << "SymInt(" << s.toSymIntNodeImpl()->str() << ")";
} else {
os << "SymInt(" << s.as_int_unchecked() << ")";
}
return os;
}
} // namespace c10