In ONNX importer, attribute dtype of ONNX EyeLike is ignored, and the output dtype is determined by nnabla context.
This implementation does not generate information loss due to the type conversion because EyeLike outputs only 0 or 1.
Mod2
Convert ONNX C = Mod(A, B, fmod) to the following nnabla representation:
The type of the output is determined by the dtype of the first input.
The types of the input/output variables are not statically determined, so BitShift::in_types() and BitShift::out_types() raise an error.
Unique
Convert ONNX Y, indices, inverse_indices, counts = Unique(X, axis, sorted) to the following nnabla representation:
flatten = False
if axis is None:
flatten = True
axis = 0
# Set True or False to with_(indices|inverse|counts) according to the existence of optional outputs
with_indices = # True or False
with_inverse = # True or False
with_counts = # True or False
# Unique
Y, indices, inverse_indices, counts = F.unique(x, flatten, axis, sorted, with_index, with_inverse, with_counts)
nnabla Unique has flatten as additional parameter because nnabla layer function cannot have optional parameters.
The difference between ONNX Unique and nnabla Unique is as follows:
ONNX
If attribute axis is specified, unique is computed along the axis.
If attribute axis is not specified, unique is computed along all the axis (the input is flattened).
nnabla
If flatten is False, unique is computed along the axis specified with attribute axis.
If flatten is True, unique is computed along all the axis (attribute axis is ignored).
This PR adds onnx importer functions.
ScatterND
Convert ONNX
output = ScatterND(data, indices, updates, reduction)
to the following nnabla representation:[M, Y_0, ..., Y_K-1]
, but the shape of ONNX indices is[Y_0, ..., Y_K-1, M]
Limitation
reduction == 'mul'
is not supported in the current implementation.EyeLike
Convert ONNX
output = EyeLike(input, dtype, k)
to the following nnabla representation:The interface of nnabla EyeLike function is compatible with ONNX EyeLike except
dtype
attribute. For details, see ONNX Operators documentation: https://github.com/onnx/onnx/blob/main/docs/Operators.md#eyelikeIn ONNX importer, attribute
dtype
of ONNX EyeLike is ignored, and the output dtype is determined by nnabla context. This implementation does not generate information loss due to the type conversion because EyeLike outputs only 0 or 1.Mod2
Convert ONNX
C = Mod(A, B, fmod)
to the following nnabla representation:The interface of nnabla Mod2 function is compatible with ONNX Mod. For details, see ONNX Operators documentation: https://github.com/onnx/onnx/blob/main/docs/Operators.md#mod
NOTICE:
Mod2::in_types()
andMod2::out_types()
raise an error.BitShift
Convert ONNX
Z = BitShift(X, Y, direction)
to the following nnabla representation:The interface of nnabla BitShift function is compatible with ONNX BitShift. For details, see ONNX Operators documentation: https://github.com/onnx/onnx/blob/main/docs/Operators.md#bitshift
NOTICE:
BitShift::in_types()
andBitShift::out_types()
raise an error.Unique
Convert ONNX
Y, indices, inverse_indices, counts = Unique(X, axis, sorted)
to the following nnabla representation:The interface of Unique function is basically compatible with ONNX Unique. For details, see ONNX Operators documentation: https://github.com/onnx/onnx/blob/main/docs/Operators.md#unique
nnabla Unique has
flatten
as additional parameter because nnabla layer function cannot have optional parameters. The difference between ONNX Unique and nnabla Unique is as follows:axis
is specified, unique is computed along the axis.axis
is not specified, unique is computed along all the axis (the input is flattened).flatten
is False, unique is computed along the axis specified with attributeaxis
.flatten
is True, unique is computed along all the axis (attributeaxis
is ignored).