Creating complex tensor from two real part and imaginary part


I want to do something in C++ that would look like this in Python:

c = a + 1j*b

where a and b are real-valued tensors. In C++, I have two torch::Tensor’s of type torch::kFloat32 for a and b.

Oops, seems like this is it: Function at::complex — PyTorch master documentation