torch_complex: Complex

Description Usage Arguments complex(real, imag, *, out=None) -> Tensor Examples

View source: R/gen-namespace.R

Description

Complex

Usage

1

Arguments

real

(Tensor) The real part of the complex tensor. Must be float or double.

imag

(Tensor) The imaginary part of the complex tensor. Must be same dtype as real.

complex(real, imag, *, out=None) -> Tensor

Constructs a complex tensor with its real part equal to real and its imaginary part equal to imag.

Examples

1
2
3
4
5
6
7
8
if (torch_is_installed()) {

real <- torch_tensor(c(1, 2), dtype=torch_float32())
imag <- torch_tensor(c(3, 4), dtype=torch_float32())
z <- torch_complex(real, imag)
z
z$dtype
}

torch documentation built on Oct. 7, 2021, 9:22 a.m.