MCPcopy Create free account
hub / github.com/tensorflow/tfjs / complex_

Function complex_

tfjs-core/src/ops/complex.ts:47–57  ·  view source on GitHub ↗

* 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)

Source from the content-addressed store, hash-verified

45 * @doc {heading: 'Tensors', subheading: 'Creation'}
46 */
47function 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
59export const complex = /* @__PURE__ */ op({complex_});

Callers

nothing calls this directly

Calls 2

convertToTensorFunction · 0.90
runKernelMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…