Skip to content

unary

torch_to_nnef.op.aten.unary

deg2rad

deg2rad(node, op_helper, **kwargs)

Map aten::deg2rad(x) to NNEF: x * (pi / 180).

float_power

float_power(node, op_helper, **kwargs)

Map aten::float_power(x, y) to NNEF as pow(x, y).

torch.float_power widens to f64 internally for accuracy; the pow we emit keeps the trace dtype (f32 in the common case) and matches torch.pow within tract's normal tolerance.

generic_unary

generic_unary(aten_op_id, node, op_helper, **kwargs)

Map PyTorch generic operators to NNEF (direct map).

List is

'aten:relu', 'aten:sigmoid', 'aten:log', 'aten:exp', 'aten:sin', 'aten:cos', 'aten:tan', 'aten:asin', 'aten:acos', 'aten:atan', 'aten:sinh', 'aten:cosh', 'aten:tanh', 'aten:asinh', 'aten:acosh', 'aten:atanh', 'aten:sign', 'aten:neg', 'aten:floor', 'aten:ceil', 'aten:sqrt', 'aten:rsqrt', 'aten:log2', 'aten:rcp', 'aten:not', 'aten:eq', 'aten:ne', 'aten:lt', 'aten:gt', 'aten:le', 'aten:ge', 'aten:and', 'aten:or', 'aten:and', 'aten:or', 'aten:_relu', 'aten:greater', 'aten:greater_equal', 'aten:less', 'aten:less_equal', 'aten:logical_not', 'aten:logical_and', 'aten:logical_or', 'aten:reciprocal', 'aten:minimum', 'aten:maximum'

positive

positive(node, op_helper, **kwargs)

Map aten::positive to NNEF.

torch.positive(x) is a no-op identity (parity counterpart of torch.negative); emit mul(x, 1.0) since NNEF's stdlib copy is not in tract's op set.

rad2deg

rad2deg(node, op_helper, **kwargs)

Map aten::rad2deg(x) to NNEF: x * (180 / pi).

ravel

ravel(node, op_helper, **kwargs)

Map aten::ravel(x) to NNEF: flatten to 1D.

Equivalent to flatten(x, 0, -1); emit a reshape to [-1].