From 603b95eb8abb4ad4f97bd9a830aef95a99b53219 Mon Sep 17 00:00:00 2001 From: chenfeiyu Date: Thu, 8 Apr 2021 18:47:08 +0800 Subject: [PATCH] import paddle.fluid.core_avx.VarDesc.VarType as paddle.dtype --- python/paddle/__init__.py | 14 +++++++++++++- python/paddle/framework/dtype.py | 6 +++++- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/python/paddle/__init__.py b/python/paddle/__init__.py index ae7f1a7216ad5..bb64413067628 100755 --- a/python/paddle/__init__.py +++ b/python/paddle/__init__.py @@ -31,7 +31,19 @@ monkey_patch_variable() monkey_patch_math_varbase() import paddle.framework -from paddle.framework.dtype import * +from .framework.dtype import dtype as dtype +from paddle.framework.dtype import uint8 +from paddle.framework.dtype import int8 +from paddle.framework.dtype import int16 +from paddle.framework.dtype import int32 +from paddle.framework.dtype import int64 +from paddle.framework.dtype import float16 +from paddle.framework.dtype import float32 +from paddle.framework.dtype import float64 +from paddle.framework.dtype import bfloat16 +from paddle.framework.dtype import bool +from paddle.framework.dtype import complex64 +from paddle.framework.dtype import complex128 from .framework import VarBase as Tensor import paddle.compat import paddle.distributed diff --git a/python/paddle/framework/dtype.py b/python/paddle/framework/dtype.py index 1aa3fb9097c55..3eeaa6e74eceb 100644 --- a/python/paddle/framework/dtype.py +++ b/python/paddle/framework/dtype.py @@ -13,12 +13,16 @@ # limitations under the License. __all__ = [ - "uint8", "int8", "int16", "int32", "int64", "bfloat16", "float16", + "dtype", "uint8", "int8", "int16", "int32", "int64", "bfloat16", "float16", "float32", "float64", "complex64", "complex128", "bool" ] from ..fluid.core import VarDesc +dtype = VarDesc.VarType +dtype.__qualname__ = "dtype" +dtype.__module__ = "paddle" + uint8 = VarDesc.VarType.UINT8 int8 = VarDesc.VarType.INT8 int16 = VarDesc.VarType.INT16