[EASY] Do hook sizes check with SymInt (#97362)
I don't think this matters for any uses right now, but I found
it during an audit; might as well fix it.
Signed-off-by: Edward Z. Yang <ezyang@meta.com>
Pull Request resolved: https://github.com/pytorch/pytorch/pull/97362
Approved by: https://github.com/wconstab
diff --git a/torch/csrc/autograd/custom_function.cpp b/torch/csrc/autograd/custom_function.cpp
index 527a87a..e418feb 100644
--- a/torch/csrc/autograd/custom_function.cpp
+++ b/torch/csrc/autograd/custom_function.cpp
@@ -474,7 +474,7 @@
throw std::runtime_error(ss.str());
}
- if (original.sizes().vec() != result.sizes().vec()) {
+ if (original.sym_sizes().vec() != result.sym_sizes().vec()) {
std::stringstream ss;
ss << "hook '" << hook_name << "' has changed the size of value";
throw std::runtime_error(ss.str());