Skip to content

Commit

Permalink
[Util] public function to clone tensor-data
Browse files Browse the repository at this point in the history
Add new util function to clone tensor-data handle.
This requires ACR for public release.

Signed-off-by: Jaeyun Jung <jy1210.jung@samsung.com>
  • Loading branch information
jaeyun-jung committed Mar 4, 2024
1 parent 68db794 commit 75ab336
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 14 deletions.
14 changes: 14 additions & 0 deletions c/include/ml-api-common.h
Original file line number Diff line number Diff line change
Expand Up @@ -409,6 +409,20 @@ int ml_tensors_data_get_tensor_data (ml_tensors_data_h data, unsigned int index,
*/
int ml_tensors_data_set_tensor_data (ml_tensors_data_h data, unsigned int index, const void *raw_data, const size_t data_size);

/**
* @brief Copies the tensor data frame.
* @since_tizen 9.0
* @remarks The @a out should be released using ml_tensors_data_destroy().
* @param[in] in The handle of tensors data to be cloned.
* @param[out] out The handle of tensors data.
* @return @c 0 on success. Otherwise a negative error value.
* @retval #ML_ERROR_NONE Successful.
* @retval #ML_ERROR_NOT_SUPPORTED Not supported.
* @retval #ML_ERROR_INVALID_PARAMETER Given parameter is invalid.
* @retval #ML_ERROR_OUT_OF_MEMORY Failed to allocate required memory.
*/
int ml_tensors_data_clone (const ml_tensors_data_h in, ml_tensors_data_h *out);

/**
* @brief Returns a human-readable string describing the last error.
* @details This returns a human-readable, null-terminated string describing
Expand Down
14 changes: 0 additions & 14 deletions c/src/ml-api-internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -249,20 +249,6 @@ void _ml_tensors_info_free (ml_tensors_info_s *info);
*/
int _ml_tensors_data_clone_no_alloc (const ml_tensors_data_s * data_src, ml_tensors_data_h * data);

/**
* @brief Copies the tensor data frame.
* @since_tizen 8.0
* @param[in] in The handle of tensors data to be cloned.
* @param[out] out The handle of tensors data. The caller is responsible for freeing the allocated data with ml_tensors_data_destroy().
* @return @c 0 on success. Otherwise a negative error value.
* @retval #ML_ERROR_NONE Successful.
* @retval #ML_ERROR_NOT_SUPPORTED Not supported.
* @retval #ML_ERROR_INVALID_PARAMETER Given parameter is invalid.
* @retval #ML_ERROR_OUT_OF_MEMORY Failed to allocate required memory.
* @todo Consider adding new API from tizen 8.0.
*/
int ml_tensors_data_clone (const ml_tensors_data_h in, ml_tensors_data_h *out);

/**
* @brief Replaces string.
* This function deallocates the input source string.
Expand Down

0 comments on commit 75ab336

Please sign in to comment.