Fix DEBUG=1 asserts with NJT ops (#129014)

Pull Request resolved: https://github.com/pytorch/pytorch/pull/129014
Approved by: https://github.com/YuqingJ, https://github.com/soulitzer
diff --git a/torch/csrc/autograd/autograd_not_implemented_fallback.cpp b/torch/csrc/autograd/autograd_not_implemented_fallback.cpp
index eff2a27..d4bcf48 100644
--- a/torch/csrc/autograd/autograd_not_implemented_fallback.cpp
+++ b/torch/csrc/autograd/autograd_not_implemented_fallback.cpp
@@ -379,8 +379,8 @@
       [&](size_t idx_tensor, size_t idx_ret, const at::Tensor& t) {
         if (at::impl::tensor_has_dispatch(t) ||
             at::impl::dispatch_mode_enabled() ||
-            // NJT offsets are expected to be reused; skip use_count() check
-            op_name == "aten::_nested_get_offsets")
+            // NJT components are expected to be reused; skip use_count() check
+            op_name.rfind("aten::_nested_get", 0) == 0)
           return;
         if (!is_inplace_output[idx_ret])
           TORCH_INTERNAL_ASSERT(