From d197f5c72b84cefe55cba154e6aa1621d08f230a Mon Sep 17 00:00:00 2001 From: Jeffrey Dunn Date: Wed, 29 Nov 2023 19:33:52 +0000 Subject: [PATCH] Remove unused call to `inspect.stack()` in torch/_custom_op/impl.py (#114698) Summary: Fetching the stack isn't free and this variable isn't used. Let's not do the work. Test Plan: Wait for tests Differential Revision: D51629732 Pull Request resolved: https://github.com/pytorch/pytorch/pull/114698 Approved by: https://github.com/zou3519, https://github.com/Skylion007 --- torch/_custom_op/impl.py | 1 - 1 file changed, 1 deletion(-) diff --git a/torch/_custom_op/impl.py b/torch/_custom_op/impl.py index 0751c041aeee1..a826b0246a4de 100644 --- a/torch/_custom_op/impl.py +++ b/torch/_custom_op/impl.py @@ -409,7 +409,6 @@ def impl_abstract(self, _stacklevel=2) -> typing.Callable: """ def inner(f): - frame = inspect.stack()[1] self._check_doesnt_have_library_meta_impl() self._register_impl("abstract", f, stacklevel=_stacklevel) location = self._get_impl("abstract").location