From a17e51dde2c7b94891449a3519181bc8c3b7989a Mon Sep 17 00:00:00 2001 From: Zhanlue Yang Date: Tue, 18 Jan 2022 11:20:42 +0800 Subject: [PATCH] Fixed python-level LoDTensor patch (#38996) --- python/paddle/fluid/__init__.py | 4 ---- python/paddle/fluid/core.py | 6 ++++++ 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/python/paddle/fluid/__init__.py b/python/paddle/fluid/__init__.py index 0339abe0960..db6faa1a1b1 100644 --- a/python/paddle/fluid/__init__.py +++ b/python/paddle/fluid/__init__.py @@ -32,10 +32,6 @@ if os.path.exists(legacy_core): except Exception as e: raise e -# Patch LoDTensor -from . import core -core.LoDTensor = core.Tensor - # import all class inside framework into fluid module from . import framework from .framework import * diff --git a/python/paddle/fluid/core.py b/python/paddle/fluid/core.py index 9b99e17e9e5..03b9ad7fc2d 100644 --- a/python/paddle/fluid/core.py +++ b/python/paddle/fluid/core.py @@ -253,6 +253,9 @@ load_noavx = False if avx_supported(): try: + from . import core_avx + core_avx.LoDTensor = core_avx.Tensor + from .core_avx import * from .core_avx import __doc__, __file__, __name__, __package__ from .core_avx import __unittest_throw_exception__ @@ -310,6 +313,9 @@ else: if load_noavx: try: + from . import core_noavx + core_noavx.LoDTensor = core_noavx.Tensor + from .core_noavx import * from .core_noavx import __doc__, __file__, __name__, __package__ from .core_noavx import __unittest_throw_exception__ -- GitLab