Skip to content

complex

torch_to_nnef.op.aten.complex

angle

angle(node, op_helper, inference_target, **kwargs)

Map PyTorch: 'aten:angle' to NNEF.

Calls the angle fragment (atan2(imag, real) on a (..., 2) complex layout). The atan2 fragment is quadrant-aware, so the result matches torch.angle across the full plane (signed-zero edge cases excepted).

complex

complex(node, op_helper, inference_target, **kwargs)

Map PyTorch: 'aten:complex(real, imag)' to NNEF.

Stacks real / imag on a new trailing axis via the complex fragment so the result matches t2n's (..., 2) layout (mirror of polar without the cos / sin).

conj

conj(node, op_helper, inference_target, torch_graph, **kwargs)

Map PyTorch: 'aten:conj' / 'aten::_conj' to NNEF.

The trace usually pairs conj with resolve_conj (which stays in identity_remap as a no-op); we put the actual sign flip here.

conj_physical

conj_physical(node, op_helper, inference_target, torch_graph, **kwargs)

Map PyTorch: 'aten:conj_physical' to NNEF.

Standalone version of conj; same code path. Previously routed to identity_remap, which silently produced the wrong answer for complex inputs (returned the input unchanged instead of conjugating it).

polar

polar(node, op_helper, inference_target, **kwargs)

Map PyTorch: 'aten:polar(abs, angle)' to NNEF.

Calls the polar fragment which builds (abs*cos, abs*sin) on a new trailing axis (matching t2n's (..., 2) complex layout).

sgn

sgn(node, op_helper, inference_target, **kwargs)

Map PyTorch: 'aten:sgn' to NNEF.

Real input: alias of sign (-1 / 0 / +1). Complex input (stored as (..., 2) real): z / |z| with 0 -> 0, routed through the sgn_complex fragment.

view_as_complex

view_as_complex(node, inference_target, torch_graph, **kwargs)

Map PyTorch: 'aten:view_as_complex' to NNEF.

view_as_real

view_as_real(node, torch_graph, inference_target, **kwargs)

Map PyTorch: 'aten:view_as_real' to NNEF.