Unify unchanged input arguments as const arguments (#12915)

Change-Id: Icd9f369a72b02ff35cd4a239bddf4c24b6c2af29
This commit is contained in:
River Li 2022-09-07 13:52:58 +08:00 committed by GitHub
parent 8979dc562d
commit 4df8b279c8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
13 changed files with 26 additions and 21 deletions

View File

@ -159,7 +159,7 @@ OPENVINO_C_API(void) ov_infer_request_free(ov_infer_request_t* infer_request);
* @return Status code of the operation: OK(0) for success.
*/
OPENVINO_C_API(ov_status_e)
ov_infer_request_get_profiling_info(ov_infer_request_t* infer_request, ov_profiling_info_list_t* profiling_infos);
ov_infer_request_get_profiling_info(const ov_infer_request_t* infer_request, ov_profiling_info_list_t* profiling_infos);
/**
* @brief Release the memory allocated by ov_profiling_info_list_t.

View File

@ -44,6 +44,6 @@ OPENVINO_C_API(void) ov_layout_free(ov_layout_t* layout);
* @param layout will be converted.
* @return string that describes the layout content.
*/
OPENVINO_C_API(const char*) ov_layout_to_string(ov_layout_t* layout);
OPENVINO_C_API(const char*) ov_layout_to_string(const ov_layout_t* layout);
/** @} */ // end of Layout

View File

@ -127,7 +127,7 @@ ov_model_reshape_single_input(const ov_model_t* model, const ov_partial_shape_t
*/
OPENVINO_C_API(ov_status_e)
ov_model_reshape_by_port_indexes(const ov_model_t* model,
size_t* port_indexes,
const size_t* port_indexes,
const ov_partial_shape_t* partial_shape,
size_t size);

View File

@ -54,7 +54,7 @@ typedef struct ov_partial_shape {
* @return Status code of the operation: OK(0) for success.
*/
OPENVINO_C_API(ov_status_e)
ov_partial_shape_create(int64_t rank, ov_dimension_t* dims, ov_partial_shape_t* partial_shape_obj);
ov_partial_shape_create(const int64_t rank, const ov_dimension_t* dims, ov_partial_shape_t* partial_shape_obj);
/**
* @brief Initialze a partial shape with dynamic rank and dynamic dimension.
@ -71,7 +71,9 @@ ov_partial_shape_create(int64_t rank, ov_dimension_t* dims, ov_partial_shape_t*
* @return Status code of the operation: OK(0) for success.
*/
OPENVINO_C_API(ov_status_e)
ov_partial_shape_create_dynamic(ov_rank_t rank, ov_dimension_t* dims, ov_partial_shape_t* partial_shape_obj);
ov_partial_shape_create_dynamic(const ov_rank_t rank,
const ov_dimension_t* dims,
ov_partial_shape_t* partial_shape_obj);
/**
* @brief Initialize a partial shape with static rank and static dimension.
@ -84,7 +86,7 @@ ov_partial_shape_create_dynamic(ov_rank_t rank, ov_dimension_t* dims, ov_partial
* @return Status code of the operation: OK(0) for success.
*/
OPENVINO_C_API(ov_status_e)
ov_partial_shape_create_static(int64_t rank, int64_t* dims, ov_partial_shape_t* partial_shape_obj);
ov_partial_shape_create_static(const int64_t rank, const int64_t* dims, ov_partial_shape_t* partial_shape_obj);
/**
* @brief Release internal memory allocated in partial shape.

View File

@ -293,7 +293,7 @@ OPENVINO_C_API(void) ov_preprocess_output_info_free(ov_preprocess_output_info_t*
* @return Status code of the operation: OK(0) for success.
*/
OPENVINO_C_API(ov_status_e)
ov_preprocess_output_info_get_tensor_info(ov_preprocess_output_info_t* preprocess_output_info,
ov_preprocess_output_info_get_tensor_info(const ov_preprocess_output_info_t* preprocess_output_info,
ov_preprocess_output_tensor_info_t** preprocess_output_tensor_info);
/**
@ -322,7 +322,7 @@ ov_preprocess_output_set_element_type(ov_preprocess_output_tensor_info_t* prepro
* @return Status code of the operation: OK(0) for success.
*/
OPENVINO_C_API(ov_status_e)
ov_preprocess_input_info_get_model_info(ov_preprocess_input_info_t* preprocess_input_info,
ov_preprocess_input_info_get_model_info(const ov_preprocess_input_info_t* preprocess_input_info,
ov_preprocess_input_model_info_t** preprocess_input_model_info);
/**

View File

@ -10,7 +10,6 @@
#pragma once
#include "openvino/c/ov_common.h"
#include "openvino/c/ov_dimension.h"
typedef ov_dimension_t ov_rank_t;

View File

@ -29,7 +29,7 @@ typedef struct {
* @param shape The input/output shape object pointer.
* @return ov_status_e The return status code.
*/
OPENVINO_C_API(ov_status_e) ov_shape_create(int64_t rank, int64_t* dims, ov_shape_t* shape);
OPENVINO_C_API(ov_status_e) ov_shape_create(const int64_t rank, const int64_t* dims, ov_shape_t* shape);
/**
* @brief Free a shape object's internal memory.

View File

@ -144,7 +144,7 @@ ov_status_e ov_infer_request_set_callback(ov_infer_request_t* infer_request, con
return ov_status_e::OK;
}
ov_status_e ov_infer_request_get_profiling_info(ov_infer_request_t* infer_request,
ov_status_e ov_infer_request_get_profiling_info(const ov_infer_request_t* infer_request,
ov_profiling_info_list_t* profiling_infos) {
if (!infer_request || !profiling_infos) {
return ov_status_e::INVALID_C_PARAM;

View File

@ -24,7 +24,7 @@ void ov_layout_free(ov_layout_t* layout) {
delete layout;
}
const char* ov_layout_to_string(ov_layout_t* layout) {
const char* ov_layout_to_string(const ov_layout_t* layout) {
if (!layout) {
return str_to_char_array("Error: null layout!");
}

View File

@ -153,7 +153,7 @@ ov_status_e ov_model_reshape(const ov_model_t* model,
}
ov_status_e ov_model_reshape_by_port_indexes(const ov_model_t* model,
size_t* port_indexes,
const size_t* port_indexes,
const ov_partial_shape_t* partial_shapes,
size_t size) {
if (!model || !port_indexes || !partial_shapes || size < 1) {

View File

@ -14,7 +14,9 @@ inline bool check_dimension(const ov_dimension_t* dims, int64_t size) {
return true;
}
ov_status_e ov_partial_shape_create(int64_t rank, ov_dimension_t* dims, ov_partial_shape_t* partial_shape_obj) {
ov_status_e ov_partial_shape_create(const int64_t rank,
const ov_dimension_t* dims,
ov_partial_shape_t* partial_shape_obj) {
if (!partial_shape_obj || rank <= 0 || !dims || !check_dimension(dims, rank)) {
return ov_status_e::INVALID_C_PARAM;
}
@ -30,8 +32,8 @@ ov_status_e ov_partial_shape_create(int64_t rank, ov_dimension_t* dims, ov_parti
return ov_status_e::OK;
}
ov_status_e ov_partial_shape_create_dynamic(ov_rank_t rank,
ov_dimension_t* dims,
ov_status_e ov_partial_shape_create_dynamic(const ov_rank_t rank,
const ov_dimension_t* dims,
ov_partial_shape_t* partial_shape_obj) {
if (!partial_shape_obj || rank.min < -1 || rank.max < -1 || rank.min > rank.max) {
return ov_status_e::INVALID_C_PARAM;
@ -57,7 +59,9 @@ ov_status_e ov_partial_shape_create_dynamic(ov_rank_t rank,
return ov_status_e::OK;
}
ov_status_e ov_partial_shape_create_static(int64_t rank, int64_t* dims, ov_partial_shape_t* partial_shape_obj) {
ov_status_e ov_partial_shape_create_static(const int64_t rank,
const int64_t* dims,
ov_partial_shape_t* partial_shape_obj) {
if (!partial_shape_obj || rank < 0 || !dims) {
return ov_status_e::INVALID_C_PARAM;
}

View File

@ -303,7 +303,7 @@ void ov_preprocess_output_info_free(ov_preprocess_output_info_t* preprocess_outp
}
ov_status_e ov_preprocess_output_info_get_tensor_info(
ov_preprocess_output_info_t* preprocess_output_info,
const ov_preprocess_output_info_t* preprocess_output_info,
ov_preprocess_output_tensor_info_t** preprocess_output_tensor_info) {
if (!preprocess_output_info || !preprocess_output_tensor_info) {
return ov_status_e::INVALID_C_PARAM;
@ -337,7 +337,7 @@ ov_status_e ov_preprocess_output_set_element_type(ov_preprocess_output_tensor_in
return ov_status_e::OK;
}
ov_status_e ov_preprocess_input_info_get_model_info(ov_preprocess_input_info_t* preprocess_input_info,
ov_status_e ov_preprocess_input_info_get_model_info(const ov_preprocess_input_info_t* preprocess_input_info,
ov_preprocess_input_model_info_t** preprocess_input_model_info) {
if (!preprocess_input_info || !preprocess_input_model_info) {
return ov_status_e::INVALID_C_PARAM;

View File

@ -5,7 +5,7 @@
#include "common.h"
inline bool check_shape_dimension(const int64_t* dims, int64_t size) {
inline bool check_shape_dimension(const int64_t* dims, const int64_t size) {
for (auto i = 0; i < size; i++) {
if (dims[i] < 0) {
return false;
@ -14,7 +14,7 @@ inline bool check_shape_dimension(const int64_t* dims, int64_t size) {
return true;
}
ov_status_e ov_shape_create(int64_t rank, int64_t* dims, ov_shape_t* shape) {
ov_status_e ov_shape_create(const int64_t rank, const int64_t* dims, ov_shape_t* shape) {
if (!shape || rank <= 0 || (dims && !check_shape_dimension(dims, rank))) {
return ov_status_e::INVALID_C_PARAM;
}