_NNS_LAYOUT_NONE, /**< NONE: none of the above defined layouts */
} tensor_layout;
-typedef tensor_layout tensors_layout[NNS_TENSOR_SIZE_LIMIT];
+typedef tensor_layout tensors_layout[NNS_TENSOR_SIZE_LIMIT + NNS_TENSOR_SIZE_EXTRA_LIMIT];
/**
* @brief GstTensorFilter's properties for NN framework (internal data structure)
int input_configured; /**< TRUE if input tensor is configured. Use int instead of gboolean because this is refered by custom plugins. */
GstTensorsInfo input_meta; /**< configured input tensor info */
tensors_layout input_layout; /**< data layout info provided as a property to tensor_filter for the input, defaults to _NNS_LAYOUT_ANY for all the tensors */
- unsigned int input_ranks[NNS_TENSOR_SIZE_LIMIT]; /**< the rank list of input tensors, it is calculated based on the dimension string. */
+ unsigned int input_ranks[NNS_TENSOR_SIZE_LIMIT + NNS_TENSOR_SIZE_EXTRA_LIMIT]; /**< the rank list of input tensors, it is calculated based on the dimension string. */
int output_configured; /**< TRUE if output tensor is configured. Use int instead of gboolean because this is refered by custom plugins. */
GstTensorsInfo output_meta; /**< configured output tensor info */
tensors_layout output_layout; /**< data layout info provided as a property to tensor_filter for the output, defaults to _NNS_LAYOUT_ANY for all the tensors */
- unsigned int output_ranks[NNS_TENSOR_SIZE_LIMIT]; /**< the rank list of output tensors, it is calculated based on the dimension string. */
+ unsigned int output_ranks[NNS_TENSOR_SIZE_LIMIT + NNS_TENSOR_SIZE_EXTRA_LIMIT]; /**< the rank list of output tensors, it is calculated based on the dimension string. */
const char *custom_properties; /**< sub-plugin specific custom property values in string */
accl_hw *hw_list; /**< accelerators supported by framework intersected with user provided accelerator preference, use in GstTensorFilterFramework V1 only */
{
int i;
- for (i = 0; i < NNS_TENSOR_SIZE_LIMIT; i++) {
+ for (i = 0; i < NNS_TENSOR_SIZE_LIMIT + NNS_TENSOR_SIZE_EXTRA_LIMIT; i++) {
layout[i] = _NNS_LAYOUT_ANY;
}
}
gst_tensors_rank_init (unsigned int ranks[])
{
int i;
- for (i = 0; i < NNS_TENSOR_SIZE_LIMIT; ++i) {
+ for (i = 0; i < NNS_TENSOR_SIZE_LIMIT + NNS_TENSOR_SIZE_EXTRA_LIMIT; ++i) {
ranks[i] = 0;
}
}
str_layouts = g_strsplit_set (layout_string, ",.", -1);
num_layouts = g_strv_length (str_layouts);
- if (num_layouts > NNS_TENSOR_SIZE_LIMIT) {
+ if (num_layouts > NNS_TENSOR_SIZE_LIMIT + NNS_TENSOR_SIZE_EXTRA_LIMIT) {
nns_logw ("Invalid param, layouts (%d) max (%d)\n",
- num_layouts, NNS_TENSOR_SIZE_LIMIT);
+ num_layouts, NNS_TENSOR_SIZE_LIMIT + NNS_TENSOR_SIZE_EXTRA_LIMIT);
- num_layouts = NNS_TENSOR_SIZE_LIMIT;
+ num_layouts = NNS_TENSOR_SIZE_LIMIT + NNS_TENSOR_SIZE_EXTRA_LIMIT;
}
for (i = 0; i < num_layouts; i++) {
g_string_append_printf (rank, "%u", _ranks[i]);
else
g_string_append_printf (rank, "%u",
- gst_tensor_info_get_rank (&_meta->info[i]));
+ gst_tensor_info_get_rank (gst_tensors_info_get_nth_info (
+ (GstTensorsInfo *) _meta, i)));
if (i < _meta->num_tensors - 1)
g_string_append_printf (rank, ",");
for (i = 0; i < tinfo->num_tensors; ++i) {
dim_str =
- gst_tensor_get_rank_dimension_string (tinfo->info[i].dimension,
- *(_rank + i));
+ gst_tensor_get_rank_dimension_string (gst_tensors_info_get_nth_info (
+ (GstTensorsInfo *) tinfo, i)->dimension, *(_rank + i));
g_string_append (dimensions, dim_str);
if (i < tinfo->num_tensors - 1) {
g_return_val_if_fail (info1 != NULL && info2 != NULL, NULL);
- for (i = 0; i < NNS_TENSOR_SIZE_LIMIT; i++) {
+ for (i = 0; i < NNS_TENSOR_SIZE_LIMIT + NNS_TENSOR_SIZE_EXTRA_LIMIT; i++) {
if (info1->num_tensors <= i && info2->num_tensors <= i)
break;
if (info1->num_tensors > i) {
- tmp = gst_tensor_get_dimension_string (info1->info[i].dimension);
- left = g_strdup_printf ("%s [%s]",
- gst_tensor_get_type_string (info1->info[i].type), tmp);
+ GstTensorInfo *info1_i =
+ gst_tensors_info_get_nth_info ((GstTensorsInfo *) info1, i);
+ tmp = gst_tensor_get_dimension_string (info1_i->dimension);
+ left =
+ g_strdup_printf ("%s [%s]",
+ gst_tensor_get_type_string (info1_i->type), tmp);
g_free (tmp);
} else {
left = g_strdup ("None");
}
if (info2->num_tensors > i) {
- tmp = gst_tensor_get_dimension_string (info2->info[i].dimension);
- right = g_strdup_printf ("%s [%s]",
- gst_tensor_get_type_string (info2->info[i].type), tmp);
+ GstTensorInfo *info2_i =
+ gst_tensors_info_get_nth_info ((GstTensorsInfo *) info2, i);
+ tmp = gst_tensor_get_dimension_string (info2_i->dimension);
+ right =
+ g_strdup_printf ("%s [%s]",
+ gst_tensor_get_type_string (info2_i->type), tmp);
g_free (tmp);
} else {
right = g_strdup ("None");
str_dims = g_strsplit_set (g_value_get_string (value), ",.", -1);
num_dims = g_strv_length (str_dims);
- if (num_dims > NNS_TENSOR_SIZE_LIMIT) {
+ if (num_dims > NNS_TENSOR_SIZE_LIMIT + NNS_TENSOR_SIZE_EXTRA_LIMIT) {
nns_logw ("Invalid param, dimensions (%d) max (%d)\n",
- num_dims, NNS_TENSOR_SIZE_LIMIT);
+ num_dims, NNS_TENSOR_SIZE_LIMIT + NNS_TENSOR_SIZE_EXTRA_LIMIT);
- num_dims = NNS_TENSOR_SIZE_LIMIT;
+ num_dims = NNS_TENSOR_SIZE_LIMIT + NNS_TENSOR_SIZE_EXTRA_LIMIT;
}
for (i = 0; i < num_dims; ++i) {
rank[i] = gst_tensor_parse_dimension (str_dims[i],
- info->info[i].dimension);
+ gst_tensors_info_get_nth_info (info, i)->dimension);
}
g_strfreev (str_dims);
if (priv->fw->eventHandler
(priv->fw, prop, priv->privateData, evt, &data) == 0) {
memcpy (*layout, data.layout,
- sizeof (tensor_layout) * NNS_TENSOR_SIZE_LIMIT);
+ sizeof (tensor_layout) * (NNS_TENSOR_SIZE_LIMIT +
+ NNS_TENSOR_SIZE_EXTRA_LIMIT));
} else {
ml_logw ("Unable to update layout.");
}
for (i = 0; i < num; i++) {
val = g_ascii_strtoull (strv[i], NULL, 10);
- if (errno == ERANGE || val >= NNS_TENSOR_SIZE_LIMIT) {
+ if (errno == ERANGE
+ || val >= NNS_TENSOR_SIZE_LIMIT + NNS_TENSOR_SIZE_EXTRA_LIMIT) {
ml_loge ("Invalid value %s, cannot set combination option.", strv[i]);
ret = ERANGE;
break;
break;
}
- if (errno == ERANGE || val >= NNS_TENSOR_SIZE_LIMIT) {
+ if (errno == ERANGE
+ || val >= NNS_TENSOR_SIZE_LIMIT + NNS_TENSOR_SIZE_EXTRA_LIMIT) {
ml_loge ("Invalid value %s, cannot set combination option.", strv[i]);
ret = ERANGE;
break;
goto error;
}
- gst_tensor_info_copy (&combined->info[idx++], &in->info[i]);
+ gst_tensor_info_copy (gst_tensors_info_get_nth_info (combined, idx++),
+ gst_tensors_info_get_nth_info ((GstTensorsInfo *) in, i));
- if (idx >= NNS_TENSOR_SIZE_LIMIT) {
- nns_loge ("The max number of tensors is %d.", NNS_TENSOR_SIZE_LIMIT);
+ if (idx >= NNS_TENSOR_SIZE_LIMIT + NNS_TENSOR_SIZE_EXTRA_LIMIT) {
+ nns_loge ("The max number of tensors is %d.",
+ NNS_TENSOR_SIZE_LIMIT + NNS_TENSOR_SIZE_EXTRA_LIMIT);
goto error;
}
}
goto error;
}
- gst_tensor_info_copy (&combined->info[idx++], &in->info[i]);
+ gst_tensor_info_copy (gst_tensors_info_get_nth_info (combined, idx++),
+ gst_tensors_info_get_nth_info ((GstTensorsInfo *) in, i));
}
}
goto error;
}
- gst_tensor_info_copy (&combined->info[idx++], &out->info[i]);
+ gst_tensor_info_copy (gst_tensors_info_get_nth_info (combined, idx++),
+ gst_tensors_info_get_nth_info ((GstTensorsInfo *) out, i));
}
}