* Converts two real numbers to a complex number. * * Given a tensor `real` representing the real part of a complex number, and a * tensor `imag` representing the imaginary part of a complex number, this * operation returns complex numbers elementwise of the form [r0, i0, r1, i1], * where r repr
(real: T|TensorLike, imag: T|TensorLike)
| 45 | * @doc {heading: 'Tensors', subheading: 'Creation'} |
| 46 | */ |
| 47 | function complex_<T extends Tensor>(real: T|TensorLike, imag: T|TensorLike): T { |
| 48 | const $real = convertToTensor(real, 'real', 'complex'); |
| 49 | const $imag = convertToTensor(imag, 'imag', 'complex'); |
| 50 | util.assertShapesMatch( |
| 51 | $real.shape, $imag.shape, |
| 52 | `real and imag shapes, ${$real.shape} and ${$imag.shape}, ` + |
| 53 | `must match in call to tf.complex().`); |
| 54 | |
| 55 | const inputs: ComplexInputs = {real: $real, imag: $imag}; |
| 56 | return ENGINE.runKernel(Complex, inputs as unknown as NamedTensorMap); |
| 57 | } |
| 58 | |
| 59 | export const complex = /* @__PURE__ */ op({complex_}); |
nothing calls this directly
no test coverage detected
searching dependent graphs…