switch cmake cmp0169 flag to new (#762)
* switch cmake cmp0169 flag to new * the missing spm code. * more refinement on cmake build targets * Update ci.yml * Update ci.yml * update the jpg files after using libjpeg instead of libjpeg-turbo * exclude cutlass too * upgrade the protobuf library to be consistent with ORT * update the protoc generated files * use the right patch name * Update cutlass.cmake
|
@ -798,7 +798,7 @@ stages:
|
|||
- job: AndroidCpp_BuildOnly
|
||||
pool:
|
||||
vmImage: 'macOS-13'
|
||||
timeoutInMinutes: 30
|
||||
timeoutInMinutes: 45
|
||||
steps:
|
||||
- task: UsePythonVersion@0
|
||||
inputs:
|
||||
|
|
|
@ -39,7 +39,7 @@ endif()
|
|||
# Avoid warning of Calling FetchContent_Populate(GSL) is deprecated temporarily
|
||||
# TODO: find a better way to handle the header-only 3rd party deps
|
||||
if(CMAKE_VERSION VERSION_GREATER_EQUAL "3.30.0")
|
||||
cmake_policy(SET CMP0169 OLD)
|
||||
cmake_policy(SET CMP0169 NEW)
|
||||
endif()
|
||||
|
||||
# Needed for Java
|
||||
|
@ -759,6 +759,7 @@ else()
|
|||
standardize_output_folder(ortcustomops)
|
||||
set(_BUILD_SHARED_LIBRARY TRUE)
|
||||
endif()
|
||||
set_target_properties(ortcustomops PROPERTIES FOLDER "operators")
|
||||
|
||||
if(OCOS_ENABLE_AZURE)
|
||||
if (ANDROID)
|
||||
|
|
|
@ -123,7 +123,7 @@
|
|||
"component": {
|
||||
"type": "other",
|
||||
"other": {
|
||||
"name": "libjpeg",
|
||||
"name": "libpng",
|
||||
"version": "1.6.37",
|
||||
"downloadUrl": "https://github.com/opencv/opencv/tree/4.5.4/3rdparty/libpng"
|
||||
},
|
||||
|
|
|
@ -1,19 +1,10 @@
|
|||
FetchContent_Declare(
|
||||
Blingfire
|
||||
GIT_REPOSITORY https://github.com/microsoft/BlingFire.git
|
||||
GIT_TAG 0831265c1aca95ca02eca5bf1155e4251e545328
|
||||
)
|
||||
Blingfire
|
||||
GIT_REPOSITORY https://github.com/microsoft/BlingFire.git
|
||||
GIT_TAG 0831265c1aca95ca02eca5bf1155e4251e545328
|
||||
EXCLUDE_FROM_ALL)
|
||||
|
||||
|
||||
FetchContent_GetProperties(Blingfire)
|
||||
|
||||
if (NOT blingfire_POPULATED)
|
||||
FetchContent_Populate(Blingfire)
|
||||
|
||||
# enable size optimization build
|
||||
add_subdirectory(${blingfire_SOURCE_DIR} ${blingfire_BINARY_DIR} EXCLUDE_FROM_ALL)
|
||||
set_target_properties(bingfirtinydll_static PROPERTIES
|
||||
FOLDER externals/bingfire)
|
||||
set_target_properties(fsaClientTiny PROPERTIES
|
||||
FOLDER externals/bingfire)
|
||||
endif()
|
||||
FetchContent_MakeAvailable(Blingfire)
|
||||
set_target_properties(bingfirtinydll_static PROPERTIES FOLDER
|
||||
externals/bingfire)
|
||||
set_target_properties(fsaClientTiny PROPERTIES FOLDER externals/bingfire)
|
||||
|
|
|
@ -1,10 +1,7 @@
|
|||
FetchContent_Declare(
|
||||
cutlass
|
||||
GIT_REPOSITORY https://github.com/NVIDIA/cutlass.git
|
||||
GIT_TAG v3.1.0
|
||||
)
|
||||
|
||||
FetchContent_GetProperties(cutlass)
|
||||
if(NOT cutlass_POPULATED)
|
||||
FetchContent_Populate(cutlass)
|
||||
endif()
|
||||
cutlass
|
||||
GIT_REPOSITORY https://github.com/NVIDIA/cutlass.git
|
||||
GIT_TAG v3.1.0
|
||||
EXCLUDE_FROM_ALL)
|
||||
set(CUTLASS_ENABLE_HEADERS_ONLY ON CACHE BOOL "")
|
||||
FetchContent_MakeAvailable(cutlass)
|
||||
|
|
|
@ -3,10 +3,7 @@ FetchContent_Declare(dlib
|
|||
# there is non an official tag which supports STFT,
|
||||
# choose a relatively stable commit id for that.
|
||||
GIT_TAG a12824d42584e292ecb3bad05c4b32c2015a7b89
|
||||
SOURCE_SUBDIR not_set
|
||||
)
|
||||
|
||||
FetchContent_GetProperties(dlib)
|
||||
if(NOT dlib_POPULATED)
|
||||
# Fetch the content using previously declared details
|
||||
FetchContent_Populate(dlib)
|
||||
endif()
|
||||
FetchContent_MakeAvailable(dlib)
|
||||
|
|
|
@ -1,10 +1,7 @@
|
|||
FetchContent_Declare(dr_libs
|
||||
URL https://github.com/mackron/dr_libs/archive/dbbd08d81fd2b084c5ae931531871d0c5fd83b87.zip
|
||||
URL_HASH SHA1=84a2a31ef890b6204223b12f71d6e701c0edcd92
|
||||
SOURCE_SUBDIR not_set
|
||||
)
|
||||
|
||||
FetchContent_GetProperties(dr_libs)
|
||||
if(NOT dr_libs_POPULATED)
|
||||
# Fetch the content using previously declared details
|
||||
FetchContent_Populate(dr_libs)
|
||||
endif()
|
||||
FetchContent_MakeAvailable(dr_libs)
|
||||
|
|
|
@ -2,15 +2,11 @@ FetchContent_Declare(
|
|||
googlere2
|
||||
GIT_REPOSITORY https://github.com/google/re2.git
|
||||
GIT_TAG 2021-06-01
|
||||
EXCLUDE_FROM_ALL
|
||||
)
|
||||
|
||||
FetchContent_GetProperties(googlere2)
|
||||
string(TOLOWER "googlere2" lcName)
|
||||
if(NOT ${lcName}_POPULATED)
|
||||
FetchContent_Populate(googlere2)
|
||||
add_subdirectory(${googlere2_SOURCE_DIR} ${googlere2_BINARY_DIR} EXCLUDE_FROM_ALL)
|
||||
set_target_properties(re2
|
||||
PROPERTIES
|
||||
POSITION_INDEPENDENT_CODE ON
|
||||
FOLDER externals/google/re2)
|
||||
endif()
|
||||
FetchContent_MakeAvailable(googlere2)
|
||||
set_target_properties(re2
|
||||
PROPERTIES
|
||||
POSITION_INDEPENDENT_CODE ON
|
||||
FOLDER externals/google)
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
FetchContent_Declare(
|
||||
googletest
|
||||
URL https://github.com/google/googletest/archive/9406a60c7839052e4944ea4dbc8344762a89f9bd.zip
|
||||
URL_HASH SHA1=06096d3900c356e468ba060a609642c635131106
|
||||
URL https://github.com/google/googletest/archive/9406a60c7839052e4944ea4dbc8344762a89f9bd.zip
|
||||
URL_HASH SHA1=06096d3900c356e468ba060a609642c635131106
|
||||
EXCLUDE_FROM_ALL
|
||||
)
|
||||
|
||||
set(BUILD_GMOCK OFF CACHE BOOL "" FORCE)
|
||||
set(INSTALL_GTEST OFF CACHE BOOL "" FORCE)
|
||||
FetchContent_MakeAvailable(googletest)
|
||||
set_target_properties(gtest PROPERTIES FOLDER "externals/gtest")
|
||||
set_target_properties(gtest_main PROPERTIES FOLDER "externals/gtest")
|
||||
set_target_properties(gtest PROPERTIES FOLDER "externals/google")
|
||||
|
|
|
@ -5,6 +5,7 @@ if (${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.24.0")
|
|||
URL_HASH SHA1=cf368104cd22a87b4dd0c80228919bb2df3e2a14
|
||||
FIND_PACKAGE_ARGS 4.0 NAMES Microsoft.GSL
|
||||
DOWNLOAD_EXTRACT_TIMESTAMP TRUE
|
||||
SOURCE_SUBDIR not_set
|
||||
)
|
||||
else()
|
||||
FetchContent_Declare(
|
||||
|
@ -14,13 +15,5 @@ else()
|
|||
)
|
||||
endif()
|
||||
|
||||
FetchContent_GetProperties(GSL)
|
||||
string(TOLOWER "GSL" lcName)
|
||||
if(NOT ${lcName}_POPULATED)
|
||||
FetchContent_Populate(GSL)
|
||||
# add_subdirectory(${GSL_SOURCE_DIR} ${GSL_BINARY_DIR} EXCLUDE_FROM_ALL)
|
||||
endif()
|
||||
|
||||
FetchContent_MakeAvailable(GSL)
|
||||
set(GSL_INCLUDE_DIR ${gsl_SOURCE_DIR}/include)
|
||||
|
||||
#get_target_property(GSL_INCLUDE_DIR Microsoft.GSL::GSL INTERFACE_INCLUDE_DIRECTORIES)
|
||||
|
|
|
@ -1,12 +1,10 @@
|
|||
FetchContent_Declare(nlohmann_json
|
||||
GIT_REPOSITORY https://github.com/nlohmann/json.git
|
||||
GIT_TAG v3.10.5)
|
||||
GIT_TAG v3.10.5
|
||||
SOURCE_SUBDIR single_include
|
||||
)
|
||||
|
||||
set(JSON_BuildTests OFF CACHE INTERNAL "")
|
||||
|
||||
FetchContent_GetProperties(nlohmann_json)
|
||||
if(NOT nlohmann_json_POPULATED)
|
||||
FetchContent_Populate(nlohmann_json)
|
||||
endif()
|
||||
|
||||
add_compile_definitions(JSON_HAS_CPP_17=1)
|
||||
FetchContent_MakeAvailable(nlohmann_json)
|
||||
|
|
|
@ -98,6 +98,7 @@ if (OCOS_ENABLE_OPENCV_CODECS)
|
|||
|
||||
set(WITH_JPEG ON CACHE INTERNAL "")
|
||||
set(WITH_PNG ON CACHE INTERNAL "")
|
||||
set(BUILD_JPEG_TURBO_DISABLE ON CACHE INTERNAL "")
|
||||
endif()
|
||||
|
||||
set(BUILD_SHARED_LIBS OFF CACHE INTERNAL "")
|
||||
|
@ -149,6 +150,7 @@ FetchContent_Declare(
|
|||
-DBUILD_SHARED_LIBS:BOOL=FALSE
|
||||
-DCMAKE_INSTALL_PREFIX:PATH=${CMAKE_CURRENT_BINARY_DIR}/opencv
|
||||
PATCH_COMMAND git checkout . && git apply --whitespace=fix --ignore-space-change --ignore-whitespace ${CMAKE_CURRENT_SOURCE_DIR}/cmake/externals/opencv-no-rtti.patch
|
||||
EXCLUDE_FROM_ALL
|
||||
)
|
||||
|
||||
FetchContent_MakeAvailable(opencv)
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt
|
||||
index ac92442a1..e930cbd2e 100644
|
||||
--- a/cmake/CMakeLists.txt
|
||||
+++ b/cmake/CMakeLists.txt
|
||||
@@ -240,9 +240,7 @@ if (MSVC)
|
||||
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
||||
index 04cb3303a..c023001de 100644
|
||||
--- a/CMakeLists.txt
|
||||
+++ b/CMakeLists.txt
|
||||
@@ -249,9 +249,7 @@ if (MSVC)
|
||||
# MSVC warning suppressions
|
||||
add_definitions(
|
||||
/wd4065 # switch statement contains 'default' but no 'case' labels
|
||||
|
@ -12,20 +12,44 @@ index ac92442a1..e930cbd2e 100644
|
|||
/wd4305 # 'identifier' : truncation from 'type1' to 'type2'
|
||||
/wd4307 # 'operator' : integral constant overflow
|
||||
/wd4309 # 'conversion' : truncation of constant value
|
||||
@@ -250,7 +248,6 @@ if (MSVC)
|
||||
@@ -259,7 +257,7 @@ if (MSVC)
|
||||
/wd4355 # 'this' : used in base member initializer list
|
||||
/wd4506 # no definition for inline function 'function'
|
||||
/wd4800 # 'type' : forcing value to bool 'true' or 'false' (performance warning)
|
||||
- /wd4996 # The compiler encountered a deprecated declaration.
|
||||
+ ${onnxruntime_PROTOBUF_EXTRA_WARNING_DISABLEMENT}
|
||||
)
|
||||
# Allow big object
|
||||
add_definitions(/bigobj)
|
||||
@@ -272,6 +269,8 @@ if (MSVC)
|
||||
endif()
|
||||
|
||||
configure_file(version.rc.in ${CMAKE_CURRENT_BINARY_DIR}/version.rc @ONLY)
|
||||
+else (MSVC)
|
||||
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unused-parameter")
|
||||
endif (MSVC)
|
||||
@@ -289,7 +286,6 @@ if (MSVC)
|
||||
else (MSVC)
|
||||
# No version.rc file.
|
||||
set(protobuf_version_rc_file)
|
||||
-
|
||||
# When building with "make", "lib" prefix will be added automatically by
|
||||
# the build tool.
|
||||
set(LIB_PREFIX)
|
||||
diff --git a/src/google/protobuf/map.h b/src/google/protobuf/map.h
|
||||
index 008c19225..cbab108c2 100644
|
||||
--- a/src/google/protobuf/map.h
|
||||
+++ b/src/google/protobuf/map.h
|
||||
@@ -52,7 +52,8 @@
|
||||
#endif // defined(__cpp_lib_string_view)
|
||||
|
||||
#if !defined(GOOGLE_PROTOBUF_NO_RDTSC) && defined(__APPLE__)
|
||||
-#include <mach/mach_time.h>
|
||||
+// apply update from https://github.com/protocolbuffers/protobuf/pull/15662/
|
||||
+#include <time.h>
|
||||
#endif
|
||||
|
||||
#include <google/protobuf/stubs/common.h>
|
||||
@@ -1154,7 +1155,8 @@ class Map {
|
||||
#if defined(__APPLE__)
|
||||
// Use a commpage-based fast time function on Apple environments (MacOS,
|
||||
// iOS, tvOS, watchOS, etc).
|
||||
- s += mach_absolute_time();
|
||||
+ // apply update from https://github.com/protocolbuffers/protobuf/pull/15662/
|
||||
+ s += clock_gettime_nsec_np(CLOCK_UPTIME_RAW);
|
||||
#elif defined(__x86_64__) && defined(__GNUC__)
|
||||
uint32_t hi, lo;
|
||||
asm volatile("rdtsc" : "=a"(lo), "=d"(hi));
|
||||
|
|
|
@ -2,14 +2,9 @@ FetchContent_Declare(
|
|||
pybind11
|
||||
URL https://github.com/pybind/pybind11/archive/refs/tags/v2.12.0.zip
|
||||
URL_HASH SHA1=8482f57ed55c7b100672815a311d5450858723fb
|
||||
SOURCE_SUBDIR not_set
|
||||
)
|
||||
|
||||
FetchContent_GetProperties(pybind11)
|
||||
# Check if population has already been performed
|
||||
string(TOLOWER "pybind11" lcName)
|
||||
if(NOT ${lcName}_POPULATED)
|
||||
# Fetch the content using previously declared details
|
||||
FetchContent_Populate(pybind11)
|
||||
endif()
|
||||
FetchContent_MakeAvailable(pybind11)
|
||||
|
||||
set(pybind11_INCLUDE_DIRS ${pybind11_SOURCE_DIR}/include)
|
||||
|
|
|
@ -9,9 +9,11 @@ if(NOT _ONNXRUNTIME_EMBEDDED)
|
|||
FetchContent_Declare(
|
||||
protobuf
|
||||
GIT_REPOSITORY https://github.com/protocolbuffers/protobuf.git
|
||||
GIT_TAG v3.20.3
|
||||
GIT_TAG v21.12
|
||||
EXCLUDE_FROM_ALL
|
||||
PATCH_COMMAND git checkout . && git apply --ignore-space-change --ignore-whitespace ${PROJECT_SOURCE_DIR}/cmake/externals/protobuf_cmake.patch
|
||||
)
|
||||
|
||||
set(protobuf_BUILD_TESTS OFF CACHE BOOL "Build tests")
|
||||
set(protobuf_WITH_ZLIB OFF CACHE BOOL "Use zlib")
|
||||
|
||||
|
@ -25,23 +27,10 @@ if(NOT _ONNXRUNTIME_EMBEDDED)
|
|||
set(protobuf_MSVC_STATIC_RUNTIME ON CACHE BOOL "")
|
||||
endif()
|
||||
set(protobuf_DISABLE_RTTI ON CACHE BOOL "Disable RTTI")
|
||||
FetchContent_GetProperties(protobuf)
|
||||
if(NOT protobuf_POPULATED)
|
||||
FetchContent_Populate(protobuf)
|
||||
add_subdirectory(${protobuf_SOURCE_DIR}/cmake ${protobuf_BINARY_DIR} EXCLUDE_FROM_ALL)
|
||||
endif()
|
||||
|
||||
FetchContent_MakeAvailable(protobuf)
|
||||
set_target_properties(libprotobuf PROPERTIES
|
||||
FOLDER externals/google/protobuf)
|
||||
set_target_properties(libprotobuf-lite PROPERTIES
|
||||
FOLDER externals/google/protobuf)
|
||||
if(NOT CMAKE_SYSTEM_NAME STREQUAL "Android")
|
||||
set_target_properties(libprotoc PROPERTIES
|
||||
FOLDER externals/google/protobuf)
|
||||
set_target_properties(protoc PROPERTIES
|
||||
FOLDER externals/google/protobuf)
|
||||
endif()
|
||||
FOLDER externals/google)
|
||||
endif()
|
||||
|
||||
# To avoid creating complicated logic to build protoc, especially for mobile platforms, we use the pre-generated pb files
|
||||
|
@ -62,9 +51,9 @@ FetchContent_Declare(
|
|||
spm
|
||||
GIT_REPOSITORY https://github.com/google/sentencepiece.git
|
||||
GIT_TAG v0.1.96
|
||||
EXCLUDE_FROM_ALL
|
||||
PATCH_COMMAND ${spm_patch_command}
|
||||
)
|
||||
FetchContent_GetProperties(spm)
|
||||
|
||||
set(SPM_USE_EXTERNAL_ABSL OFF CACHE BOOL "Use external absl" FORCE)
|
||||
set(SPM_USE_BUILTIN_PROTOBUF OFF CACHE BOOL "Use built-in protobuf" FORCE)
|
||||
|
@ -73,13 +62,10 @@ if(NOT protobuf_SOURCE_DIR)
|
|||
message(FATAL_ERROR "Cannot find the protobuf library in ORT")
|
||||
endif()
|
||||
|
||||
if(NOT spm_POPULATED)
|
||||
FetchContent_Populate(spm)
|
||||
add_subdirectory(${spm_SOURCE_DIR} ${spm_BINARY_DIR} EXCLUDE_FROM_ALL)
|
||||
target_link_libraries(sentencepiece-static PUBLIC protobuf::libprotobuf-lite)
|
||||
set_target_properties(sentencepiece-static PROPERTIES
|
||||
FOLDER externals/google/sentencepiece)
|
||||
endif()
|
||||
FetchContent_MakeAvailable(spm)
|
||||
target_link_libraries(sentencepiece-static PUBLIC protobuf::libprotobuf-lite)
|
||||
set_target_properties(sentencepiece-static PROPERTIES
|
||||
FOLDER externals/google)
|
||||
|
||||
set(spm_INCLUDE_DIRS
|
||||
${protobuf_SOURCE_DIR}/src
|
||||
|
|
|
@ -5,5 +5,8 @@ set(OCOS_ENABLE_GPT2_TOKENIZER ON CACHE INTERNAL "" FORCE)
|
|||
set(OCOS_ENABLE_C_API ON CACHE INTERNAL "" FORCE)
|
||||
set(OCOS_ENABLE_CV2 ON CACHE INTERNAL "" FORCE)
|
||||
set(OCOS_ENABLE_OPENCV_CODECS ON CACHE INTERNAL "" FORCE)
|
||||
set(OCOS_ENABLE_DLIB ON CACHE INTERNAL "" FORCE)
|
||||
set(OCOS_ENABLE_MATH ON CACHE INTERNAL "" FORCE)
|
||||
set(OCOS_ENABLE_AUDIO ON CACHE INTERNAL "" FORCE)
|
||||
|
||||
set(OCOS_ENABLE_CTEST OFF CACHE INTERNAL "" FORCE)
|
||||
|
|
|
@ -22,6 +22,30 @@ OrtxObject* OrtxObjectFactory::CreateForward<DetokenizerCache>() {
|
|||
return Create<DetokenizerCache>();
|
||||
}
|
||||
|
||||
extError_t ORTX_API_CALL OrtxCreateTokenizer(OrtxTokenizer** tokenizer, const char* tokenizer_path) {
|
||||
// test if the tokenizer_path is a valid directory
|
||||
if (tokenizer_path == nullptr) {
|
||||
ReturnableStatus::last_error_message_ = "The tokenizer data directory is null";
|
||||
return kOrtxErrorInvalidArgument;
|
||||
}
|
||||
|
||||
if (!path(tokenizer_path).is_directory()) {
|
||||
ReturnableStatus::last_error_message_ = std::string("Cannot find the directory of ") + tokenizer_path;
|
||||
return kOrtxErrorInvalidArgument;
|
||||
}
|
||||
|
||||
ReturnableStatus status;
|
||||
// auto ptr = ort_extensions::CreateTokenizer(tokenizer_path, "", &status);
|
||||
auto ptr = std::make_unique<ort_extensions::TokenizerImpl>();
|
||||
status = ptr->Load(tokenizer_path);
|
||||
if (status.IsOk()) {
|
||||
*tokenizer = static_cast<OrtxTokenizer*>(ptr.release());
|
||||
return extError_t();
|
||||
}
|
||||
|
||||
return status.Code();
|
||||
}
|
||||
|
||||
extError_t ORTX_API_CALL OrtxTokenize(const OrtxTokenizer* tokenizer, const char* input[], size_t batch_size,
|
||||
OrtxTokenId2DArray** output) {
|
||||
if (tokenizer == nullptr || input == nullptr || output == nullptr) {
|
||||
|
|
|
@ -3,10 +3,12 @@
|
|||
#include <stdio.h>
|
||||
#include <cstdarg>
|
||||
|
||||
#include "file_sys.h"
|
||||
#include "image_processor.h"
|
||||
#include "tokenizer_impl.h"
|
||||
#include "ortx_utils.h"
|
||||
#include "file_sys.h"
|
||||
|
||||
#include "tokenizer_impl.h"
|
||||
#include "image_processor.h"
|
||||
#include "speech_extractor.h"
|
||||
|
||||
using namespace ort_extensions;
|
||||
|
||||
|
@ -48,30 +50,6 @@ extError_t ORTX_API_CALL OrtxCreate(extObjectKind_t kind, OrtxObject** object, .
|
|||
return extError_t();
|
||||
}
|
||||
|
||||
extError_t ORTX_API_CALL OrtxCreateTokenizer(OrtxTokenizer** tokenizer, const char* tokenizer_path) {
|
||||
// test if the tokenizer_path is a valid directory
|
||||
if (tokenizer_path == nullptr) {
|
||||
ReturnableStatus::last_error_message_ = "The tokenizer data directory is null";
|
||||
return kOrtxErrorInvalidArgument;
|
||||
}
|
||||
|
||||
if (!path(tokenizer_path).is_directory()) {
|
||||
ReturnableStatus::last_error_message_ = std::string("Cannot find the directory of ") + tokenizer_path;
|
||||
return kOrtxErrorInvalidArgument;
|
||||
}
|
||||
|
||||
ReturnableStatus status;
|
||||
// auto ptr = ort_extensions::CreateTokenizer(tokenizer_path, "", &status);
|
||||
auto ptr = std::make_unique<ort_extensions::TokenizerImpl>();
|
||||
status = ptr->Load(tokenizer_path);
|
||||
if (status.IsOk()) {
|
||||
*tokenizer = static_cast<OrtxTokenizer*>(ptr.release());
|
||||
return extError_t();
|
||||
}
|
||||
|
||||
return status.Code();
|
||||
}
|
||||
|
||||
extError_t ORTX_API_CALL OrtxDisposeOnly(OrtxObject* object) {
|
||||
if (object == nullptr) {
|
||||
return kOrtxErrorInvalidArgument;
|
||||
|
@ -82,21 +60,6 @@ extError_t ORTX_API_CALL OrtxDisposeOnly(OrtxObject* object) {
|
|||
return kOrtxErrorInvalidArgument;
|
||||
}
|
||||
|
||||
/* if (Ortx_object->ortx_kind() == extObjectKind_t::kOrtxKindStringArray) {
|
||||
OrtxObjectFactory::Dispose<StringArray>(object);
|
||||
} else if (Ortx_object->ortx_kind() == extObjectKind_t::kOrtxKindTokenId2DArray) {
|
||||
OrtxObjectFactory<TokenId2DArray>::Dispose(object);
|
||||
} else if (Ortx_object->ortx_kind() == extObjectKind_t::kOrtxKindDetokenizerCache) {
|
||||
OrtxObjectFactory<DetokenizerCache>::DisposeForward(object);
|
||||
} else if (Ortx_object->ortx_kind() == extObjectKind_t::kOrtxKindTokenizer) {
|
||||
OrtxObjectFactory<TokenizerImpl>::Dispose(object);
|
||||
} else if (Ortx_object->ortx_kind() == extObjectKind_t::kOrtxKindProcessorResult) {
|
||||
OrtxObjectFactory<ProcessorResult>::Dispose(object);
|
||||
} else if (Ortx_object->ortx_kind() == extObjectKind_t::kOrtxKindImageProcessorResult) {
|
||||
OrtxObjectFactory<ImageProcessorResult>::Dispose(object);
|
||||
} else if (Ortx_object->ortx_kind() == extObjectKind_t::kOrtxKindProcessor) {
|
||||
OrtxObjectFactory<ImageProcessor>::Dispose(object);
|
||||
} */
|
||||
if (Ortx_object->ortx_kind() >= kOrtxKindBegin && Ortx_object->ortx_kind() < kOrtxKindEnd) {
|
||||
OrtxObjectFactory::Dispose<OrtxObjectImpl>(object);
|
||||
} else {
|
||||
|
@ -165,7 +128,7 @@ extError_t ORTX_API_CALL OrtxGetTensorData(OrtxTensor* tensor, const void** data
|
|||
|
||||
extError_t ORTX_API_CALL OrtxGetTensorDataInt64(OrtxTensor* tensor, const int64_t** data, const int64_t** shape,
|
||||
size_t* num_dims) {
|
||||
const void* data_ptr;
|
||||
const void* data_ptr{};
|
||||
auto err = OrtxGetTensorData(tensor, &data_ptr, shape, num_dims);
|
||||
*data = reinterpret_cast<const int64_t*>(data_ptr); // NOLINT(cppcoreguidelines-pro-type-reinterpret-cast)
|
||||
return err;
|
||||
|
@ -173,7 +136,7 @@ extError_t ORTX_API_CALL OrtxGetTensorDataInt64(OrtxTensor* tensor, const int64_
|
|||
|
||||
extError_t ORTX_API_CALL OrtxGetTensorDataFloat(OrtxTensor* tensor, const float** data, const int64_t** shape,
|
||||
size_t* num_dims) {
|
||||
const void* data_ptr;
|
||||
const void* data_ptr{};
|
||||
auto err = OrtxGetTensorData(tensor, &data_ptr, shape, num_dims);
|
||||
*data = reinterpret_cast<const float*>(data_ptr); // NOLINT(cppcoreguidelines-pro-type-reinterpret-cast)
|
||||
return err;
|
||||
|
|
Двоичные данные
test/data/wolves_with_box_crop.jpg
До Ширина: | Высота: | Размер: 431 KiB После Ширина: | Высота: | Размер: 431 KiB |
Двоичные данные
test/data/wolves_with_box_more_box_than_colors.jpg
До Ширина: | Высота: | Размер: 301 KiB После Ширина: | Высота: | Размер: 301 KiB |
Двоичные данные
test/data/wolves_with_box_more_box_than_colors_score.jpg
До Ширина: | Высота: | Размер: 304 KiB После Ширина: | Высота: | Размер: 304 KiB |
Двоичные данные
test/data/wolves_with_box_off_boundary_box.jpg
До Ширина: | Высота: | Размер: 316 KiB После Ширина: | Высота: | Размер: 316 KiB |
Двоичные данные
test/data/wolves_with_box_overlapping.jpg
До Ширина: | Высота: | Размер: 307 KiB После Ширина: | Высота: | Размер: 307 KiB |
Двоичные данные
test/data/wolves_with_box_pad.jpg
До Ширина: | Высота: | Размер: 314 KiB После Ширина: | Высота: | Размер: 314 KiB |
Двоичные данные
test/data/wolves_with_box_share_borders.jpg
До Ширина: | Высота: | Размер: 312 KiB После Ширина: | Высота: | Размер: 312 KiB |
Двоичные данные
test/data/wolves_with_fastestDet.jpg
До Ширина: | Высота: | Размер: 101 KiB После Ширина: | Высота: | Размер: 101 KiB |
Двоичные данные
test/data/wolves_with_solid_box.jpg
До Ширина: | Высота: | Размер: 317 KiB После Ширина: | Высота: | Размер: 317 KiB |