update onnx and add removed experimental ops to contrib ops (#723)

This commit is contained in:
Ashwini Khade 2019-04-02 22:30:00 -07:00 committed by Changming Sun
parent 6e9ed17adc
commit 8bc532bfb9
8 changed files with 91 additions and 5 deletions

View file

@ -49,7 +49,7 @@
"component":{
"type":"git",
"git":{
"commitHash":"3a9a87871021a02d6b970c1e26ffa4c0dd720677",
"commitHash":"fdb978a580bcb461ea077b9772c973928b8dbf5f",
"repositoryUrl":"https://github.com/onnx/onnx.git"
}
}

2
cmake/external/onnx vendored

@ -1 +1 @@
Subproject commit 3a9a87871021a02d6b970c1e26ffa4c0dd720677
Subproject commit fdb978a580bcb461ea077b9772c973928b8dbf5f

View file

@ -286,6 +286,65 @@ If scale is not provided, crop the borders as provided.)DOC";
.Output(0, "output", "Result, has same type as input, with H and W dimensions reduced.", "T")
.TypeConstraint("T", {"tensor(float16)", "tensor(float)", "tensor(double)"}, "Constrain input and output types to float tensors.");
static const char* ThresholdedRelu_ver1_doc = R"DOC(
ThresholdedRelu takes one input data (Tensor<T>) and produces one output data
(Tensor<T>) where the rectified linear function, y = x for x > alpha, y = 0 otherwise,
is applied to the tensor elementwise. )DOC";
ONNX_CONTRIB_OPERATOR_SCHEMA(ThresholdedRelu)
.SinceVersion(1)
.SetDoc(ThresholdedRelu_ver1_doc)
.Attr("alpha", "Threshold value", AttributeProto::FLOAT, 1.0f)
.Input(0, "X", "Input tensor", "T")
.Output(0, "Y", "Output tensor", "T")
.TypeConstraint("T", {"tensor(float16)", "tensor(float)", "tensor(double)"}, "Constrain input and output types to float tensors.")
.TypeAndShapeInferenceFunction(ONNX_NAMESPACE::propagateShapeAndTypeFromFirstInput);
static const char* DynamicSlice_ver1_doc = R"DOC(
Produces a slice of the input tensor along multiple axes. Similar to numpy:
https://docs.scipy.org/doc/numpy/reference/arrays.indexing.html
Slices uses `axes`, `starts` and `ends` inputs to specify the start and end
dimension for each axis in the list of axes, it uses this information to
slice the input `data` tensor. If a negative value is passed for any of the
start or end indices, it represent number of elements before the end of that
dimension. If the value passed to start or end is larger than the `n` (the
number of elements in this dimension), it represents `n`. For slicing to the
end of a dimension with unknown size, it is recommended to pass in `INT_MAX`.
If `axes` are omitted, they are set to `[0, ..., ndim-1]`.
Example 1:
data = [
[1, 2, 3, 4],
[5, 6, 7, 8],
]
axes = [0, 1]
starts = [1, 0]
ends = [2, 3]
result = [
[5, 6, 7],
]
Example 2:
data = [
[1, 2, 3, 4],
[5, 6, 7, 8],
]
starts = [0, 1]
ends = [-1, 1000]
result = [
[2, 3, 4],
]
)DOC";
ONNX_CONTRIB_OPERATOR_SCHEMA(DynamicSlice)
.SinceVersion(1)
.SetDoc(DynamicSlice_ver1_doc)
.Input(0, "data", "Tensor of data to extract slices from.", "T")
.Input(1, "starts", "1-D tensor of starting indices of corresponding axis in `axes`", "Tind")
.Input(2, "ends", "1-D tensor of ending indices (exclusive) of corresponding axis in axes", "Tind")
.Input(3, "axes", "1-D tensor of axes that `starts` and `ends` apply to.", "Tind", OpSchema::Optional)
.Output(0, "output", "Sliced data tensor.", "T")
.TypeConstraint("T", OpSchema::all_tensor_types(), "Constrain input and output types to all tensor types.")
.TypeConstraint("Tind", {"tensor(int32)", "tensor(int64)"}, "Constrain indices to integer types");
ONNX_CONTRIB_OPERATOR_SCHEMA(Affine)
.SinceVersion(10)
.Deprecate()
@ -332,6 +391,18 @@ If scale is not provided, crop the borders as provided.)DOC";
.Output(0, "output", "Result, has same type as input, with H and W dimensions reduced.", "T")
.TypeConstraint("T", {"tensor(float16)", "tensor(float)", "tensor(double)"}, "Constrain input and output types to float tensors.");
ONNX_CONTRIB_OPERATOR_SCHEMA(DynamicSlice)
.SinceVersion(10)
.Deprecate()
.SetDoc(DynamicSlice_ver1_doc)
.Input(0, "data", "Tensor of data to extract slices from.", "T")
.Input(1, "starts", "1-D tensor of starting indices of corresponding axis in `axes`", "Tind")
.Input(2, "ends", "1-D tensor of ending indices (exclusive) of corresponding axis in axes", "Tind")
.Input(3, "axes", "1-D tensor of axes that `starts` and `ends` apply to.", "Tind", OpSchema::Optional)
.Output(0, "output", "Sliced data tensor.", "T")
.TypeConstraint("T", OpSchema::all_tensor_types(), "Constrain input and output types to all tensor types.")
.TypeConstraint("Tind", {"tensor(int32)", "tensor(int64)"}, "Constrain indices to integer types");
// End of ONNX exp ops(Affine, Crop, ParametricSoftplus, ImageScaler) old version history maintainance
ONNX_CONTRIB_OPERATOR_SCHEMA(SampleOp)

View file

@ -29,6 +29,7 @@ REGISTER_UNARY_ELEMENTWISE_KERNEL_ALIAS(Softplus, ParametricSoftplus, 1);
REGISTER_UNARY_ELEMENTWISE_KERNEL(Softsign, 1);
REGISTER_UNARY_ELEMENTWISE_KERNEL(Tanh, 6);
REGISTER_UNARY_ELEMENTWISE_KERNEL(ThresholdedRelu, 1);
REGISTER_UNARY_ELEMENTWISE_KERNEL(ThresholdedRelu, 10);
template <>
Status Sigmoid<float>::Compute(OpKernelContext* context) const {

View file

@ -262,6 +262,7 @@ class ONNX_OPERATOR_TYPED_KERNEL_CLASS_NAME(kCpuExecutionProvider, kOnnxDomain,
// Opset 10
class ONNX_OPERATOR_KERNEL_CLASS_NAME(kCpuExecutionProvider, kOnnxDomain, 10, StringNormalizer);
class ONNX_OPERATOR_KERNEL_CLASS_NAME(kCpuExecutionProvider, kOnnxDomain, 10, TopK);
class ONNX_OPERATOR_KERNEL_CLASS_NAME(kCpuExecutionProvider, kOnnxDomain, 10, ThresholdedRelu);
void RegisterOnnxOperatorKernels(KernelRegistry& kernel_registry) {
kernel_registry.Register(BuildKernelCreateInfo<ONNX_OPERATOR_KERNEL_CLASS_NAME(kCpuExecutionProvider, kOnnxDomain, 6, Clip)>());
@ -513,6 +514,7 @@ void RegisterOnnxOperatorKernels(KernelRegistry& kernel_registry) {
// Opset 10
kernel_registry.Register(BuildKernelCreateInfo<ONNX_OPERATOR_KERNEL_CLASS_NAME(kCpuExecutionProvider, kOnnxDomain, 10, StringNormalizer)>());
kernel_registry.Register(BuildKernelCreateInfo<ONNX_OPERATOR_KERNEL_CLASS_NAME(kCpuExecutionProvider, kOnnxDomain, 10, TopK)>());
kernel_registry.Register(BuildKernelCreateInfo<ONNX_OPERATOR_KERNEL_CLASS_NAME(kCpuExecutionProvider, kOnnxDomain, 10, ThresholdedRelu)>());
}
// Forward declarations of ml op kernels

View file

@ -318,7 +318,12 @@ int real_main(int argc, char* argv[], OrtEnv** p_env) {
{"tf_inception_v4", "Cast opset 9 not supported yet"},
{"tf_nasnet_large", "disable temporarily"},
{"tf_nasnet_mobile", "disable temporarily"},
{"tf_pnasnet_large", "disable temporarily"}};
{"tf_pnasnet_large", "disable temporarily"},
{"slice", "Slice opset 10 not supported yet"},
{"slice_neg", "Slice opset 10 not supported yet"},
{"slice_start_out_of_bounds", "Slice opset 10 not supported yet"},
{"slice_end_out_of_bounds", "Slice opset 10 not supported yet"},
{"slice_default_axes", "Slice opset 10 not supported yet"}};
#ifdef USE_CUDA
broken_tests["maxpool_2d_default"] = "cudnn pooling only support input dimension >= 3";

View file

@ -83,6 +83,13 @@ backend_test.exclude(r'('
'|^test_vgg19_cpu.*'
'|^test_zfnet512_cpu.*'
'|^test_gru_seq_length_cpu.*'
'|^test_slice_cpu.*'
'|^test_slice_default_axes_cpu.*'
'|^test_slice_default_steps_cpu.*'
'|^test_slice_end_out_of_bounds_cpu.*'
'|^test_slice_neg_cpu.*'
'|^test_slice_neg_steps_cpu.*'
'|^test_slice_start_out_of_bounds_cpu.*'
')')
# import all test cases at global scope to make

View file

@ -38,8 +38,8 @@ else
#5af210ca8a1c73aa6bae8754c9346ec54d0a756e is v1.2.3
#bae6333e149a59a3faa9c4d9c44974373dcf5256 is v1.3.0
#9e55ace55aad1ada27516038dfbdc66a8a0763db is v1.4.1
#3a9a87871021a02d6b970c1e26ffa4c0dd720677 is v1.4.1 latest
for onnx_version in "5af210ca8a1c73aa6bae8754c9346ec54d0a756e" "bae6333e149a59a3faa9c4d9c44974373dcf5256" "9e55ace55aad1ada27516038dfbdc66a8a0763db" "3a9a87871021a02d6b970c1e26ffa4c0dd720677"; do
#fdb978a580bcb461ea077b9772c973928b8dbf5f" is v1.4.1 latest
for onnx_version in "5af210ca8a1c73aa6bae8754c9346ec54d0a756e" "bae6333e149a59a3faa9c4d9c44974373dcf5256" "9e55ace55aad1ada27516038dfbdc66a8a0763db" "fdb978a580bcb461ea077b9772c973928b8dbf5f" ; do
if [ -z ${lastest_onnx_version+x} ]; then
echo "first pass";
else