Move complex into dir incubate (#24254)

* Move complex into dir incubate, test=develop

* Fix imports, test=develop

* Fix docs, test=develop

* Forbid import functions from paddle.incubate directly, test=develop
revert-24314-dev/fix_err_msg
Yibing Liu 6 years ago committed by GitHub
parent f800403fff
commit fb82d72c61
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -38,7 +38,7 @@ import paddle.tensor
import paddle.nn import paddle.nn
import paddle.framework import paddle.framework
import paddle.imperative import paddle.imperative
import paddle.complex import paddle.incubate.complex as complex
# TODO: define alias in tensor and framework directory # TODO: define alias in tensor and framework directory
from .tensor.random import randperm from .tensor.random import randperm

@ -15,7 +15,7 @@
import unittest import unittest
import numpy as np import numpy as np
from numpy.random import random as rand 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 as fluid
import paddle.fluid.dygraph as dg import paddle.fluid.dygraph as dg

@ -13,7 +13,7 @@
# limitations under the License. # limitations under the License.
from paddle import fluid, tensor from paddle import fluid, tensor
import paddle.complex as cpx import paddle
import paddle.fluid.dygraph as dg import paddle.fluid.dygraph as dg
import numpy as np import numpy as np
import unittest import unittest
@ -40,7 +40,7 @@ class ComplexKronTestCase(unittest.TestCase):
with dg.guard(place): with dg.guard(place):
x_var = dg.to_variable(self.x) x_var = dg.to_variable(self.x)
y_var = dg.to_variable(self.y) 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) np.testing.assert_allclose(out_var.numpy(), self.ref_result)

@ -13,7 +13,7 @@
# limitations under the License. # limitations under the License.
import paddle.fluid as fluid import paddle.fluid as fluid
import paddle.complex as cpx from paddle import complex as cpx
import paddle.fluid.dygraph as dg import paddle.fluid.dygraph as dg
import numpy as np import numpy as np
import unittest import unittest

@ -15,7 +15,7 @@
import unittest import unittest
import numpy as np import numpy as np
from numpy.random import random as rand 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 as fluid
import paddle.fluid.dygraph as dg import paddle.fluid.dygraph as dg

@ -15,7 +15,7 @@
import unittest import unittest
import numpy as np import numpy as np
from numpy.random import random as rand 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 as fluid
import paddle.fluid.dygraph as dg import paddle.fluid.dygraph as dg

@ -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.

@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
from ..fluid import framework from ...fluid import framework
def is_complex(x): def is_complex(x):

@ -13,8 +13,8 @@
# limitations under the License. # limitations under the License.
from ..helper import is_complex, is_real, complex_variable_exists from ..helper import is_complex, is_real, complex_variable_exists
from ...fluid.framework import ComplexVariable from ....fluid.framework import ComplexVariable
from ...fluid import layers from ....fluid import layers
__all__ = ['matmul', ] __all__ = ['matmul', ]
@ -26,10 +26,10 @@ def matmul(x, y, transpose_x=False, transpose_y=False, alpha=1.0, name=None):
Args: Args:
x (ComplexVariable|Variable): The first input, can be a ComplexVariable 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. float32 or float64.
y (ComplexVariable|Variable): The second input, can be a ComplexVariable 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. float32 or float64.
transpose_x (bool): Whether to transpose :math:`x` before multiplication. transpose_x (bool): Whether to transpose :math:`x` before multiplication.
transpose_y (bool): Whether to transpose :math:`y` before multiplication. transpose_y (bool): Whether to transpose :math:`y` before multiplication.

@ -14,8 +14,8 @@
from paddle.common_ops_import import * from paddle.common_ops_import import *
from ..helper import is_complex, is_real, complex_variable_exists from ..helper import is_complex, is_real, complex_variable_exists
from ...fluid.framework import ComplexVariable from ....fluid.framework import ComplexVariable
from ...fluid import layers from ....fluid import layers
__all__ = [ __all__ = [
'reshape', 'reshape',

@ -14,9 +14,9 @@
from paddle.common_ops_import import * from paddle.common_ops_import import *
from ..helper import is_complex, is_real, complex_variable_exists from ..helper import is_complex, is_real, complex_variable_exists
from ...fluid.framework import ComplexVariable from ....fluid.framework import ComplexVariable
from ...fluid import layers from ....fluid import layers
from ...tensor import math from ....tensor import math
__all__ = [ __all__ = [
'elementwise_add', 'elementwise_add',
@ -368,6 +368,7 @@ def kron(x, y, name=None):
import numpy as np import numpy as np
import paddle import paddle
from paddle import fluid
import paddle.fluid.dygraph as dg 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]]) a = np.array([[1.0+1.0j, 2.0+1.0j], [3.0+1.0j, 4.0+1.0j]])

@ -139,8 +139,9 @@ packages=['paddle',
'paddle.dataset', 'paddle.dataset',
'paddle.reader', 'paddle.reader',
'paddle.distributed', 'paddle.distributed',
'paddle.complex', 'paddle.incubate',
'paddle.complex.tensor', 'paddle.incubate.complex',
'paddle.incubate.complex.tensor',
'paddle.framework', 'paddle.framework',
'paddle.fluid', 'paddle.fluid',
'paddle.fluid.dygraph', 'paddle.fluid.dygraph',

Loading…
Cancel
Save