Log#
Domain:
ai.onnxSince version: 13
Computes the Log value of the input tensor element-wise.
Inputs
input (T): Input tensor
Outputs
output (T): The natural log of the input tensor computed element-wise
Type Constraints
T: Constrain input and output types to float tensors. Allowed types: tensor(bfloat16), tensor(double), tensor(float), tensor(float16).
Examples#
test_cc_log
Node:
Log(x) -> (y)
Inputs:
x: shape=(2, 3), dtype=float32
[[ 0.1, 0.5, 1. ],
[ 2. , 4. , 10. ]]
Outputs:
y: shape=(2, 3), dtype=float32
[[-2.3025851, -0.6931472, 0. ],
[ 0.6931472, 1.3862944, 2.3025851]]
test_cc_log_bfloat16
Node:
Log(x) -> (y)
Inputs:
x: shape=(2, 3), dtype=bfloat16
[[0.5, 1, 1.5],
[2, 3, 4]]
Outputs:
y: shape=(2, 3), dtype=bfloat16
[[-0.691406, 0, 0.40625],
[0.691406, 1.10156, 1.38281]]
test_cc_log_float16
Node:
Log(x) -> (y)
Inputs:
x: shape=(2, 3), dtype=float16
[[0.5, 1. , 1.5],
[2. , 3. , 4. ]]
Outputs:
y: shape=(2, 3), dtype=float16
[[-0.6934, 0. , 0.4055],
[ 0.6934, 1.099 , 1.387 ]]
test_log
Node:
Log(x) -> (y)
Inputs:
x: shape=(3, 4, 5), dtype=float32
[[[0.5665626 , 0.7457828 , 0.9710038 , 0.44436023, 0.44426572],
[0.7628954 , 0.8773497 , 0.5230682 , 0.2855097 , 0.79399765],
[0.40414318, 0.60542136, 0.45493892, 0.53008 , 0.4359664 ],
[0.16703598, 0.6453357 , 0.8153516 , 0.681706 , 0.88432556]],
[[0.06596119, 0.08141565, 0.49588096, 0.12310988, 0.28691238],
[0.04790218, 0.51552093, 0.7137718 , 0.04374927, 0.9977489 ],
[0.5978532 , 0.58659613, 0.39717028, 0.43898773, 0.25327417],
[0.5297584 , 0.5436718 , 0.74823636, 0.8180345 , 0.66857445]],
[[0.8618293 , 0.70818025, 0.23636153, 0.6562365 , 0.86890996],
[0.83933234, 0.32443425, 0.15918033, 0.89394003, 0.9126912 ],
[0.3018573 , 0.13158594, 0.32568467, 0.94017494, 0.39366317],
[0.08773183, 0.6070508 , 0.15547849, 0.95833313, 0.8756163 ]]]
Outputs:
y: shape=(3, 4, 5), dtype=float32
[[[-5.6816769e-01, -2.9332089e-01, -2.9424928e-02, -8.1111974e-01,
-8.1133240e-01],
[-2.7063435e-01, -1.3084964e-01, -6.4804345e-01, -1.2534792e+00,
-2.3067479e-01],
[-9.0598607e-01, -5.0183058e-01, -7.8759211e-01, -6.3472730e-01,
-8.3019012e-01],
[-1.7895460e+00, -4.3798468e-01, -2.0413584e-01, -3.8315678e-01,
-1.2293000e-01]],
[[-2.7186887e+00, -2.5081878e+00, -7.0141935e-01, -2.0946779e+00,
-1.2485784e+00],
[-3.0385942e+00, -6.6257739e-01, -3.3719194e-01, -3.1292803e+00,
-2.2536262e-03],
[-5.1441008e-01, -5.3341872e-01, -9.2339021e-01, -8.2328379e-01,
-1.3732827e+00],
[-6.3533425e-01, -6.0940957e-01, -2.9003635e-01, -2.0085073e-01,
-4.0260753e-01]],
[[-1.4869808e-01, -3.4505662e-01, -1.4423927e+00, -4.2123398e-01,
-1.4051577e-01],
[-1.7514853e-01, -1.1256723e+00, -1.8377175e+00, -1.1211658e-01,
-9.1357708e-02],
[-1.1978009e+00, -2.0280950e+00, -1.1218257e+00, -6.1689317e-02,
-9.3225962e-01],
[-2.4334705e+00, -4.9914283e-01, -1.8612479e+00, -4.2559821e-02,
-1.3282728e-01]]]
test_log_example
Node:
Log(x) -> (y)
Inputs:
x: shape=(2,), dtype=float32
[ 1., 10.]
Outputs:
y: shape=(2,), dtype=float32
[0. , 2.3025851]
Differences with previous version (6)#
SchemaDiff: Log (domain 'ai.onnx')
old version: 6
new version: 13
breaking: no
Type constraints:
changed ‘T’: added types: [‘tensor(bfloat16)’]