#include "tensor_filter.h"
#include "tensor_filter_tensorflow_lite_core.h"
#include <glib.h>
+#include <string.h>
/**
* @brief internal data of tensorflow lite
};
typedef struct _Tflite_data tflite_data;
+
+/**
+ * @brief Free privateData and move on.
+ */
+static void
+tflite_close (const GstTensorFilter * filter, void **private_data)
+{
+ tflite_data *tf;
+ tf = *private_data;
+ tflite_core_delete (tf->tflite_private_data);
+ g_free (tf);
+ *private_data = NULL;
+ g_assert (filter->privateData == NULL);
+}
+
/**
* @brief Load tensorflow lite modelfile
* @param filter : tensor_filter instance
tflite_data *tf;
if (filter->privateData != NULL) {
/** @todo : Check the integrity of filter->data and filter->model_file, nnfw */
- return 1;
+ tf = *private_data;
+ if (strcmp (filter->prop.model_file,
+ tflite_core_getModelPath (tf->tflite_private_data))) {
+ tflite_close (filter, private_data);
+ } else {
+ return 1;
+ }
}
tf = g_new0 (tflite_data, 1); /** initialize tf Fill Zero! */
*private_data = tf;
return ret;
}
-/**
- * @brief Free privateData and move on.
- */
-static void
-tflite_close (const GstTensorFilter * filter, void **private_data)
-{
- tflite_data *tf;
- tf = *private_data;
- tflite_core_delete (tf->tflite_private_data);
- g_free (tf);
- *private_data = NULL;
- g_assert (filter->privateData == NULL);
-}
-
GstTensorFilterFramework NNS_support_tensorflow_lite = {
.name = "tensorflow-lite",
.allow_in_place = FALSE, /** @todo: support this to optimize performance later. */
}
/**
+ * @brief get the model path
+ * @return the model path.
+ */
+const char*
+TFLiteCore::getModelPath()
+{
+ return model_path;
+}
+
+/**
* @brief get millisecond for time profiling.
* @note it returns the millisecond.
* @param t : the time struct.
/**
* @brief initialize the object with tflite model
+ * @param tflite : the class object
* @return 0 if OK. non-zero if error.
*/
int
}
/**
+ * @brief get the model path
+ * @param tflite : the class object
+ * @return the model path.
+ */
+const char *
+tflite_core_getModelPath (void *tflite)
+{
+ TFLiteCore *c = (TFLiteCore *) tflite;
+ return c->getModelPath();
+}
+
+/**
* @brief get the Dimension of Input Tensor of model
* @param tflite : the class object
* @param[out] info Structure for tensor info.