From ba4f780fdec2e9d418e069a81e110378878a8366 Mon Sep 17 00:00:00 2001 From: "Edward Wang (EcoF)" Date: Wed, 22 Jun 2022 08:01:23 +0000 Subject: [PATCH] fix submodule imports by importing functions directly (#79368) Summary: fixes two sporadic issues from missing attributes: - breaking circular imports - submodule not being imported explicitly Test Plan: sandcastle Reviewed By: ehhuang Differential Revision: D37071652 Pull Request resolved: https://github.com/pytorch/pytorch/pull/79368 Approved by: https://github.com/ananthsub --- torch/_ops.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/torch/_ops.py b/torch/_ops.py index a325d93e517..e9e804bab20 100644 --- a/torch/_ops.py +++ b/torch/_ops.py @@ -6,7 +6,7 @@ import sys import types import torch.jit -import torch._utils_internal as torch_utils_internal +from torch import _utils_internal # Query `hasattr` only once. _SET_GLOBAL_FLAGS = hasattr(sys, 'getdlopenflags') and hasattr(sys, 'setdlopenflags') @@ -252,7 +252,7 @@ class _Ops(types.ModuleType): if sys.executable == "torch_deploy": return - path = torch_utils_internal.resolve_library_path(path) + path = _utils_internal.resolve_library_path(path) with dl_open_guard(): # Import the shared library into the process, thus running its # static (global) initialization code in order to register custom