【专家谈】生态文明写入宪法将推动绿色金融进入全面发展新阶段

paddle. real ( x: Tensor, name: str | None = None ) Tensor [source]
百度 远在波特兰上六年级的纳塔莉·史密斯告诉记者,她之前还参与了14日的学生停课集会吁控枪活动,“佛州枪击案是一个警告,提醒我们每个人,这是一件亟需解决的事情。

Returns a new Tensor containing real values of the input Tensor.

Parameters
  • x (Tensor) – the input Tensor, its data type could be complex64 or complex128.

  • name (str|None, optional) – The default value is None. Normally there is no need for user to set this property. For more information, please refer to Name .

Returns

a Tensor containing real values of the input Tensor.

Return type

Tensor

Examples

>>> import paddle

>>> x = paddle.to_tensor(
...     [[1 + 6j, 2 + 5j, 3 + 4j], [4 + 3j, 5 + 2j, 6 + 1j]])
>>> print(x)
Tensor(shape=[2, 3], dtype=complex64, place=Place(cpu), stop_gradient=True,
[[(1+6j), (2+5j), (3+4j)],
 [(4+3j), (5+2j), (6+1j)]])

>>> real_res = paddle.real(x)
>>> print(real_res)
Tensor(shape=[2, 3], dtype=float32, place=Place(cpu), stop_gradient=True,
[[1., 2., 3.],
 [4., 5., 6.]])

>>> real_t = x.real()
>>> print(real_t)
Tensor(shape=[2, 3], dtype=float32, place=Place(cpu), stop_gradient=True,
[[1., 2., 3.],
 [4., 5., 6.]])