diff --git a/torch/csrc/dynamo/guards.cpp b/torch/csrc/dynamo/guards.cpp index b080ffe75c4..36b7c8a2de6 100644 --- a/torch/csrc/dynamo/guards.cpp +++ b/torch/csrc/dynamo/guards.cpp @@ -2277,8 +2277,6 @@ class GuardManager { return _root; } - bool has_relational_guards(); - std::string get_source() { return _source; } @@ -2411,7 +2409,7 @@ class GuardManager { // to avoid early exits when dict_tag matches and the object is // immutable. new_tag = get_dict_version_unchecked(value); - matches_dict_tag = (new_tag == _dict_tag) && !has_relational_guards(); + matches_dict_tag = (new_tag == _dict_tag); } } @@ -2634,10 +2632,6 @@ class RootGuardManager : public GuardManager { _relational_guard_resetters.emplace_back(std::move(relational_guard)); } - bool has_relational_guards() { - return !_relational_guard_resetters.empty(); - } - // Python visible API to check guard function. bool check(py::handle value) { return check_nopybind(value.ptr()); @@ -2854,9 +2848,6 @@ class RootGuardManager : public GuardManager { bool _init_local_state = false; }; -bool GuardManager::has_relational_guards() { - return _root->has_relational_guards(); -} /* * Dicts are common in python code. Therefore, we handle guards for dicts * differently and use PyDict_* APIs which are faster than PyObject_* APIs