*/
int ml_single_invoke (ml_single_h single, const ml_tensors_data_h input, ml_tensors_data_h *output);
+/**
+ * @brief Invokes the model with the given input data with the given info.
+ * @details This function changes the input data dimensions for the model.
+ * Note that this has a default timeout of 3 seconds. If an application wants to change the time to wait for an output, set the timeout using ml_single_set_timeout().
+ * @since_tizen 6.0
+ * @param[in] single The model handle to be inferred.
+ * @param[in] input The input data to be inferred.
+ * @param[in] in_info The handle of input tensors information.
+ * @param[out] output The allocated output buffer. The caller is responsible for freeing the output buffer with ml_tensors_data_destroy().
+ * @param[out] out_info The handle of output tensors information. The caller is responsible for freeing the information with ml_tensors_info_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 Fail. The parameter is invalid.
+ * @retval #ML_ERROR_STREAMS_PIPE Cannot push a buffer into source element.
+ * @retval #ML_ERROR_TIMED_OUT Failed to get the result from sink element.
+ *
+ */
+static inline int ml_single_invoke_dynamic (ml_single_h single, const ml_tensors_data_h input, const ml_tensors_info_h in_info,
+ ml_tensors_data_h *output, ml_tensors_info_h *out_info);
+
/*************
* UTILITIES *
*************/
/**
* @brief Sets the information (tensor dimension, type, name and so on) of required input data for the given model.
* @details Note that a model/framework may not support setting such information.
+ * @since_tizen 6.0
* @param[in] single The model handle.
* @param[in] info The handle of input tensors information.
* @return @c 0 on success. Otherwise a negative error value.
int ml_single_set_input_info (ml_single_h single, const ml_tensors_info_h info);
/**
+ * @brief Sets the information (tensor dimension, type, name and so on) of required input data for the given model, and get updated output data information.
+ * @details Note that a model/framework may not support setting such information.
+ * @since_tizen 6.0
+ * @param[in] single The model handle.
+ * @param[in] info The handle of input tensors information.
+ * @param[out] info The handle of output tensors information. The caller is responsible for freeing the information with ml_tensors_info_destroy().
+ * @return @c 0 on success. Otherwise a negative error value.
+ * @retval #ML_ERROR_NONE Successful
+ * @retval #ML_ERROR_NOT_SUPPORTED This implies that the given framework does not support dynamic dimensions.
+ * Use ml_single_set_input_info/ml_single_get_output_info APIs instead for this framework.
+ * @retval #ML_ERROR_INVALID_PARAMETER Fail. The parameter is invalid.
+ */
+static inline int ml_single_update_info (ml_single_h single, const ml_tensors_info_h in_info, ml_tensors_info_h *out_info);
+
+/**
* @brief Sets the maximum amount of time to wait for an output, in milliseconds.
* @since_tizen 5.5
* @param[in] single The model handle.
*/
int ml_single_set_timeout (ml_single_h single, unsigned int timeout);
+/*****************************
+ * STATIC INLINE DEFINITIONS *
+ ****************************/
+
+/**
+ * @brief Invokes the model with the given input data with the given info.
+ */
+static inline int ml_single_invoke_dynamic (ml_single_h single,
+ const ml_tensors_data_h input, const ml_tensors_info_h in_info,
+ ml_tensors_data_h *output, ml_tensors_info_h *out_info)
+{
+ int status;
+ ml_tensors_info_h cur_in_info;
+
+ status = ml_single_get_input_info (single, &cur_in_info);
+ if (status != ML_ERROR_NONE)
+ return status;
+
+ status = ml_single_update_info (single, in_info, out_info);
+ if (status != ML_ERROR_NONE)
+ return status;
+
+ status = ml_single_invoke (single, input, output);
+ if (status != ML_ERROR_NONE) {
+ ml_single_set_input_info (single, cur_in_info);
+ ml_tensors_info_destroy (*out_info);
+ }
+
+ return status;
+}
+
+/**
+ * @brief Sets the information (tensor dimension, type, name and so on) of required input data for the given model.
+ */
+static inline int ml_single_update_info (ml_single_h single,
+ const ml_tensors_info_h in_info, ml_tensors_info_h *out_info)
+{
+ int status;
+
+ status = ml_single_set_input_info (single, in_info);
+ if (status != ML_ERROR_NONE)
+ return status;
+
+ return ml_single_get_output_info (single, out_info);
+}
+
/**
* @}
*/