void init_filter_custom (void) __attribute__ ((constructor));
void fini_filter_custom (void) __attribute__ ((destructor));
+static const gchar *custom_accl_support[] = {
+ ACCL_AUTO_STR,
+ ACCL_DEFAULT_STR,
+ NULL
+};
+
/**
* @brief internal_data
*/
return -EINVAL;
}
+/**
+ * @brief Check support of the backend
+ */
+static int
+custom_checkAvailability (accl_hw hw)
+{
+ if (g_strv_contains (custom_accl_support, get_accl_hw_str (hw)))
+ return 0;
+
+ return -ENOENT;
+}
+
static gchar filter_subplugin_custom[] = "custom";
static GstTensorFilterFramework NNS_support_custom = {
.close = custom_close,
.destroyNotify = custom_destroyNotify, /* if custom filter model supports allocate_in_invoke, this will be set from custom filter. */
.allocateInInvoke = custom_allocateInInvoke,
+ .checkAvailability = custom_checkAvailability,
};
/** @brief Initialize this object for tensor_filter subplugin runtime register */
#endif /** ENABLE_TENSORFLOW */
/**
+ * @brief Test NNStreamer Utility for checking availability of custom backend
+ */
+TEST (nnstreamer_capi_util, availability_03)
+{
+ bool result;
+ int status;
+
+ status = ml_check_nnfw_availability (ML_NNFW_TYPE_CUSTOM_FILTER, ML_NNFW_HW_ANY, &result);
+ EXPECT_EQ (status, ML_ERROR_NONE);
+ EXPECT_EQ (result, true);
+
+ status = ml_check_nnfw_availability (ML_NNFW_TYPE_CUSTOM_FILTER, ML_NNFW_HW_AUTO, &result);
+ EXPECT_EQ (status, ML_ERROR_NONE);
+ EXPECT_EQ (result, true);
+}
+
+/**
+ * @brief Test NNStreamer Utility for checking availability of custom backend
+ */
+TEST (nnstreamer_capi_util, availability_fail_03_n)
+{
+ bool result;
+ int status;
+
+ status = ml_check_nnfw_availability (ML_NNFW_TYPE_CUSTOM_FILTER, ML_NNFW_HW_CPU, &result);
+ EXPECT_EQ (status, ML_ERROR_NONE);
+ EXPECT_EQ (result, false);
+
+ status = ml_check_nnfw_availability (ML_NNFW_TYPE_CUSTOM_FILTER, ML_NNFW_HW_GPU, &result);
+ EXPECT_EQ (status, ML_ERROR_NONE);
+ EXPECT_EQ (result, false);
+}
+
+/**
* @brief Test NNStreamer Utility for checking tensors info handle
*/
TEST (nnstreamer_capi_util, tensors_info)