diff --git a/python/paddle/__init__.py b/python/paddle/__init__.py index 374be895ff83d3b9a6653273ddb62ea5c53542e2..bc5a72bf8e74e6f654f5116c137607bbde71dd11 100644 --- a/python/paddle/__init__.py +++ b/python/paddle/__init__.py @@ -38,7 +38,7 @@ import paddle.tensor import paddle.nn import paddle.framework import paddle.imperative -import paddle.complex +import paddle.incubate.complex as complex # TODO: define alias in tensor and framework directory from .tensor.random import randperm diff --git a/python/paddle/fluid/tests/unittests/test_complex_elementwise_layers.py b/python/paddle/fluid/tests/unittests/test_complex_elementwise_layers.py index 45fa40b228ae5efaff5816af26c61ec83f86afd2..0ced775689e7ff948b69bf97d8c0b77debb07e81 100644 --- a/python/paddle/fluid/tests/unittests/test_complex_elementwise_layers.py +++ b/python/paddle/fluid/tests/unittests/test_complex_elementwise_layers.py @@ -15,7 +15,7 @@ import unittest import numpy as np from numpy.random import random as rand -import paddle.complex as cpx +from paddle import complex as cpx import paddle.fluid as fluid import paddle.fluid.dygraph as dg diff --git a/python/paddle/fluid/tests/unittests/test_complex_kron.py b/python/paddle/fluid/tests/unittests/test_complex_kron.py index 50817a8734bd63a2800d37a243093303fd0573a0..863d61e6027ea2cfec27a7dff86d8da735becada 100644 --- a/python/paddle/fluid/tests/unittests/test_complex_kron.py +++ b/python/paddle/fluid/tests/unittests/test_complex_kron.py @@ -13,7 +13,7 @@ # limitations under the License. from paddle import fluid, tensor -import paddle.complex as cpx +import paddle import paddle.fluid.dygraph as dg import numpy as np import unittest @@ -40,7 +40,7 @@ class ComplexKronTestCase(unittest.TestCase): with dg.guard(place): x_var = dg.to_variable(self.x) y_var = dg.to_variable(self.y) - out_var = cpx.kron(x_var, y_var) + out_var = paddle.complex.kron(x_var, y_var) np.testing.assert_allclose(out_var.numpy(), self.ref_result) diff --git a/python/paddle/fluid/tests/unittests/test_complex_reshape.py b/python/paddle/fluid/tests/unittests/test_complex_reshape.py index 4b1370a56e3d92872bd82986c70c427be9b91b2c..6d124d8da2b2bed129f918a4be1c51a5d8f28bb6 100644 --- a/python/paddle/fluid/tests/unittests/test_complex_reshape.py +++ b/python/paddle/fluid/tests/unittests/test_complex_reshape.py @@ -13,7 +13,7 @@ # limitations under the License. import paddle.fluid as fluid -import paddle.complex as cpx +from paddle import complex as cpx import paddle.fluid.dygraph as dg import numpy as np import unittest diff --git a/python/paddle/fluid/tests/unittests/test_complex_sum_layer.py b/python/paddle/fluid/tests/unittests/test_complex_sum_layer.py index e8110fd3a96058a2209742e75e6ed810df46029f..f8637b448880a451da4a6323f70feae4eab9ef7f 100644 --- a/python/paddle/fluid/tests/unittests/test_complex_sum_layer.py +++ b/python/paddle/fluid/tests/unittests/test_complex_sum_layer.py @@ -15,7 +15,7 @@ import unittest import numpy as np from numpy.random import random as rand -import paddle.complex as cpx +from paddle import complex as cpx import paddle.fluid as fluid import paddle.fluid.dygraph as dg diff --git a/python/paddle/fluid/tests/unittests/test_complex_trace_layer.py b/python/paddle/fluid/tests/unittests/test_complex_trace_layer.py index 97123597b6f68154266b2ef7a574dfe0a47a6689..5293d594be993a85a54508af99cf08b4a40a380b 100644 --- a/python/paddle/fluid/tests/unittests/test_complex_trace_layer.py +++ b/python/paddle/fluid/tests/unittests/test_complex_trace_layer.py @@ -15,7 +15,7 @@ import unittest import numpy as np from numpy.random import random as rand -import paddle.complex as cpx +from paddle import complex as cpx import paddle.fluid as fluid import paddle.fluid.dygraph as dg diff --git a/python/paddle/incubate/__init__.py b/python/paddle/incubate/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..76e0e91197f15f94d14ae3c20094f6813f725c38 --- /dev/null +++ b/python/paddle/incubate/__init__.py @@ -0,0 +1,13 @@ +# Copyright (c) 2020 PaddlePaddle Authors. All Rights Reserved +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. diff --git a/python/paddle/complex/__init__.py b/python/paddle/incubate/complex/__init__.py similarity index 100% rename from python/paddle/complex/__init__.py rename to python/paddle/incubate/complex/__init__.py diff --git a/python/paddle/complex/helper.py b/python/paddle/incubate/complex/helper.py similarity index 97% rename from python/paddle/complex/helper.py rename to python/paddle/incubate/complex/helper.py index 9d96e4d49ad8268208b493b8ae9b0c3b07f266a4..504cf51cec50f09752106c891555a9d8fcf0577d 100644 --- a/python/paddle/complex/helper.py +++ b/python/paddle/incubate/complex/helper.py @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -from ..fluid import framework +from ...fluid import framework def is_complex(x): diff --git a/python/paddle/complex/tensor/__init__.py b/python/paddle/incubate/complex/tensor/__init__.py similarity index 100% rename from python/paddle/complex/tensor/__init__.py rename to python/paddle/incubate/complex/tensor/__init__.py diff --git a/python/paddle/complex/tensor/linalg.py b/python/paddle/incubate/complex/tensor/linalg.py similarity index 92% rename from python/paddle/complex/tensor/linalg.py rename to python/paddle/incubate/complex/tensor/linalg.py index 99c0ca5fbfab32c1581878f02db10d3338a507c8..3badf36280e27c9d7962a2b7b3fff596fd0e8cb3 100644 --- a/python/paddle/complex/tensor/linalg.py +++ b/python/paddle/incubate/complex/tensor/linalg.py @@ -13,8 +13,8 @@ # limitations under the License. from ..helper import is_complex, is_real, complex_variable_exists -from ...fluid.framework import ComplexVariable -from ...fluid import layers +from ....fluid.framework import ComplexVariable +from ....fluid import layers __all__ = ['matmul', ] @@ -26,10 +26,10 @@ def matmul(x, y, transpose_x=False, transpose_y=False, alpha=1.0, name=None): Args: x (ComplexVariable|Variable): The first input, can be a ComplexVariable - with data type complex32 or complex64, or a Variable with data type + with data type complex64 or complex128, or a Variable with data type float32 or float64. y (ComplexVariable|Variable): The second input, can be a ComplexVariable - with data type complex32 or complex64, or a Variable with data type + with data type complex64 or complex128, or a Variable with data type float32 or float64. transpose_x (bool): Whether to transpose :math:`x` before multiplication. transpose_y (bool): Whether to transpose :math:`y` before multiplication. diff --git a/python/paddle/complex/tensor/manipulation.py b/python/paddle/incubate/complex/tensor/manipulation.py similarity index 98% rename from python/paddle/complex/tensor/manipulation.py rename to python/paddle/incubate/complex/tensor/manipulation.py index ed04f2ff3a4478e731369fc617b885f12ce3dbae..7852260a31e3c1b530cc43aa30372eac6ed71597 100644 --- a/python/paddle/complex/tensor/manipulation.py +++ b/python/paddle/incubate/complex/tensor/manipulation.py @@ -14,8 +14,8 @@ from paddle.common_ops_import import * from ..helper import is_complex, is_real, complex_variable_exists -from ...fluid.framework import ComplexVariable -from ...fluid import layers +from ....fluid.framework import ComplexVariable +from ....fluid import layers __all__ = [ 'reshape', diff --git a/python/paddle/complex/tensor/math.py b/python/paddle/incubate/complex/tensor/math.py similarity index 99% rename from python/paddle/complex/tensor/math.py rename to python/paddle/incubate/complex/tensor/math.py index da53c98541e8f9f88b03967cfa25893dc5b6d326..51477abd5dcb7ccb742291296db08d11f3614a32 100644 --- a/python/paddle/complex/tensor/math.py +++ b/python/paddle/incubate/complex/tensor/math.py @@ -14,9 +14,9 @@ from paddle.common_ops_import import * from ..helper import is_complex, is_real, complex_variable_exists -from ...fluid.framework import ComplexVariable -from ...fluid import layers -from ...tensor import math +from ....fluid.framework import ComplexVariable +from ....fluid import layers +from ....tensor import math __all__ = [ 'elementwise_add', @@ -368,6 +368,7 @@ def kron(x, y, name=None): import numpy as np import paddle + from paddle import fluid import paddle.fluid.dygraph as dg a = np.array([[1.0+1.0j, 2.0+1.0j], [3.0+1.0j, 4.0+1.0j]]) diff --git a/python/setup.py.in b/python/setup.py.in index 5e5f964e1686ba3188d057ff26374f798e70df23..8432361403b63e5d1c14ecee16363ee8329604a6 100644 --- a/python/setup.py.in +++ b/python/setup.py.in @@ -139,8 +139,9 @@ packages=['paddle', 'paddle.dataset', 'paddle.reader', 'paddle.distributed', - 'paddle.complex', - 'paddle.complex.tensor', + 'paddle.incubate', + 'paddle.incubate.complex', + 'paddle.incubate.complex.tensor', 'paddle.framework', 'paddle.fluid', 'paddle.fluid.dygraph',