G_BEGIN_DECLS
/**
- * @brief String representations for each tensor element type.
- */
-extern const gchar *tensor_element_typename[];
-
-/**
* @brief Initialize the tensor info structure
* @param info tensor info structure to be initialized
*/
gst_tensor_get_element_count (const tensor_dim dim);
/**
- * @brief Get tensor_type from string tensor_type input
+ * @brief Get tensor type from string input.
* @return Corresponding tensor_type. _NNS_END if unrecognized value is there.
* @param typestr The string type name, supposed to be one of tensor_element_typename[]
*/
gst_tensor_get_type (const gchar * typestr);
/**
+ * @brief Get type string of tensor type.
+ */
+extern const gchar *
+gst_tensor_get_type_string (tensor_type type);
+
+/**
* @brief Find the index value of the given key string array
* @return Corresponding index
* @param strv Null terminated array of gchar *
/**
* @brief String representations for each tensor element type.
*/
-const gchar *tensor_element_typename[] = {
+static const gchar *tensor_element_typename[] = {
[_NNS_INT32] = "int32",
[_NNS_UINT32] = "uint32",
[_NNS_INT16] = "int16",
GString *types = g_string_new (NULL);
for (i = 0; i < info->num_tensors; i++) {
- g_string_append (types, tensor_element_typename[info->info[i].type]);
+ g_string_append (types, gst_tensor_get_type_string (info->info[i].type));
if (i < info->num_tensors - 1) {
g_string_append (types, ",");
if (config->info.type != _NNS_END) {
gst_caps_set_simple (caps, "type", G_TYPE_STRING,
- tensor_element_typename[config->info.type], NULL);
+ gst_tensor_get_type_string (config->info.type), NULL);
}
if (config->rate_n >= 0 && config->rate_d > 0) {
}
/**
- * @brief Get tensor_type from string tensor_type input
+ * @brief Get tensor type from string input.
* @return Corresponding tensor_type. _NNS_END if unrecognized value is there.
* @param typestr The string type name, supposed to be one of tensor_element_typename[]
*/
}
/**
+ * @brief Get type string of tensor type.
+ */
+const gchar *
+gst_tensor_get_type_string (tensor_type type)
+{
+ return tensor_element_typename[type];
+}
+
+/**
* @brief Find the index value of the given key string array
* @return Corresponding index. Returns -1 if not found.
* @param strv Null terminated array of gchar *
case PROP_INPUT_TYPE:
if (self->tensor_info.type != _NNS_END) {
g_value_set_string (value,
- tensor_element_typename[self->tensor_info.type]);
+ gst_tensor_get_type_string (self->tensor_info.type));
} else {
g_value_set_string (value, "");
}
if (info1->num_tensors > i) {
dimstr = gst_tensor_get_dimension_string (info1->info[i].dimension);
left = g_strdup_printf ("%s [%s]",
- tensor_element_typename[info1->info[i].type], dimstr);
+ gst_tensor_get_type_string (info1->info[i].type), dimstr);
g_free (dimstr);
} else {
left = null;
if (info2->num_tensors > i) {
dimstr = gst_tensor_get_dimension_string (info2->info[i].dimension);
right = g_strdup_printf ("%s [%s]",
- tensor_element_typename[info2->info[i].type], dimstr);
+ gst_tensor_get_type_string (info2->info[i].type), dimstr);
g_free (dimstr);
} else {
right = null;
g_strdup_printf
("appsrc name=appsrc caps=text/x-raw,format=utf8 ! "
"tensor_converter input-dim=10 ! tensor_transform mode=typecast option=%s ! tensor_sink name=test_sink",
- tensor_element_typename[option.t_type]);
+ gst_tensor_get_type_string (option.t_type));
break;
case TEST_TYPE_ISSUE739_MUX_PARALLEL_1:
/** 4x4 tensor stream, different FPS, tensor_mux them @ slowest */