ComplexVariable¶
-
class
paddle.fluid.
ComplexVariable
(real, imag)[source] The Variable defined on the complex number domain. It contains two common real number Variables as its members,
real
andimag
holding the real part and imaginary part of complex numbers respectively.- Notes:
The constructor of ComplexVariable should not be invoked directly.
Only support dygraph mode at present. Please use to_variable to create a dygraph ComplexVariable with complex number data.
- Parameters
real (Variable) – The Variable holding real-part data.
imag (Variable) – The Variable holding imaginery-part data.
Examples
import paddle.fluid as fluid import numpy as np a = np.array([1.0+2.0j, 0.2]) with fluid.dygraph.guard(): var = fluid.dygraph.to_variable(a, name="new_var") print(var.name, var.dtype, var.shape) # ({'real': u'new_var.real', 'imag': u'new_var.imag'}, 'complex128', [2L]) print(var.numpy()) # [1. +2.j 0.2+0.j]