From 09a63094a68529eae0b597bb98f695557f5a24a6 Mon Sep 17 00:00:00 2001 From: Randy Shuai Date: Tue, 19 Sep 2023 15:49:59 -0700 Subject: [PATCH] fix bulid --- .../onnxruntime/core/session/onnxruntime_lite_custom_op.h | 2 -- onnxruntime/core/session/custom_ops.cc | 2 +- .../test/testdata/custom_op_library/cpu/cpu_ops.cc | 8 ++++---- 3 files changed, 5 insertions(+), 7 deletions(-) diff --git a/include/onnxruntime/core/session/onnxruntime_lite_custom_op.h b/include/onnxruntime/core/session/onnxruntime_lite_custom_op.h index 16dd9c9b9df42..f25f3dfca2470 100644 --- a/include/onnxruntime/core/session/onnxruntime_lite_custom_op.h +++ b/include/onnxruntime/core/session/onnxruntime_lite_custom_op.h @@ -373,11 +373,9 @@ struct Variadic : public TensorBase { return output; } const void* DataRaw() const override { - ORT_CXX_API_THROW("DataRaw() cannot be applied to Variadic", ORT_RUNTIME_EXCEPTION); return nullptr; } size_t SizeInBytes() const override { - ORT_CXX_API_THROW("SizeInBytes() cannot be applied to Variadic", ORT_RUNTIME_EXCEPTION); return 0; } size_t Size() const { diff --git a/onnxruntime/core/session/custom_ops.cc b/onnxruntime/core/session/custom_ops.cc index 4108d4fbccb40..f979c85751321 100644 --- a/onnxruntime/core/session/custom_ops.cc +++ b/onnxruntime/core/session/custom_ops.cc @@ -25,8 +25,8 @@ #if !defined(ORT_MINIMAL_BUILD) static constexpr uint32_t min_ort_version_with_optional_io_support = 8; static constexpr uint32_t min_ort_version_with_variadic_io_support = 14; -static constexpr uint32_t min_ort_version_with_compute_v2_support = 17; #endif +static constexpr uint32_t min_ort_version_with_compute_v2_support = 17; #if !defined(DISABLE_FLOAT8_TYPES) #define SUPPORTED_TENSOR_TYPES DataTypeImpl::AllTensorTypesIRv9() diff --git a/onnxruntime/test/testdata/custom_op_library/cpu/cpu_ops.cc b/onnxruntime/test/testdata/custom_op_library/cpu/cpu_ops.cc index 37fc17800fe8c..e1b9bc1154d68 100644 --- a/onnxruntime/test/testdata/custom_op_library/cpu/cpu_ops.cc +++ b/onnxruntime/test/testdata/custom_op_library/cpu/cpu_ops.cc @@ -12,9 +12,9 @@ using namespace Ort::Custom; namespace Cpu { Ort::Status KernelOne(const Ort::Custom::Tensor& X, - const Ort::Custom::Tensor& Y, - Ort::Custom::Tensor& Z) { - if (X.NumberOfElement()!=Y.NumberOfElement()) { + const Ort::Custom::Tensor& Y, + Ort::Custom::Tensor& Z) { + if (X.NumberOfElement() != Y.NumberOfElement()) { return Ort::Status("x and y has different number of elements", OrtErrorCode::ORT_INVALID_ARGUMENT); } auto x_shape = X.Shape(); @@ -167,7 +167,7 @@ void FilterFloat8(const Ort::Custom::Tensor& floats_in, #endif // a sample custom op accepting variadic inputs, and generate variadic outputs by simply 1:1 copying. -template +template Ort::Status CopyVariadic(const Ort::Custom::Variadic& inputs, Ort::Custom::Variadic& outputs) { for (size_t ith_input = 0; ith_input < inputs.Size(); ++ith_input) { const auto& input = inputs[ith_input];