```
- (4): stand
- - A Mode for statistical standardization of tensor, option=default
+ - A mode for statistical standardization or normalization of tensor
+ - An option should be provided as option=(default|dc-average)[:TYPE] where `default` for statistical standardization and `dc-average` to remove DC offset (average value). `TYPE` denotes output data type.
+ - Example: Remove DC offset, output type to float32
+
+ ```bash
+ ... ! tensor_converter ! tensor_transform mode=stand option=dc-average:float32 ! ...
+ ```
- acceleration (readable, writable): A flat indicating whether to enable ```orc``` acceleration
static const gchar *gst_tensor_transform_stand_string[] = {
[STAND_DEFAULT] = "default",
+ [STAND_DC_AVERAGE] = "dc-average",
[STAND_END] = NULL
};
"option=D1\':D2\':D3\':D4 (fixed to 3)",
"transpose"},
{GTT_STAND, "Mode for statistical standardization of tensor, "
- "option=default[:TYPE]",
+ "option=(default|dc-average)[:TYPE]",
"stand"},
{GTT_CLAMP, "Mode for clamping all elements of tensor into the range, "
"option=CLAMP_MIN:CLAMP_MAX",
if (filter->data_stand.mode == STAND_END) {
ml_loge
- ("%s: stand: \'%s\' is not valid option string: it should be \'default\', currently the only supported mode.\n",
+ ("%s: stand: \'%s\' is not valid option string: it should be in the form of (default|dc-average)[:TYPE]\n",
filter_name, filter->option);
break;
}
break;
}
+ case STAND_DC_AVERAGE:
+ {
+ for (i = 0; i < num; i++) {
+ data_idx = in_element_size * i;
+ gst_tensor_data_raw_typecast ((gpointer) (inptr + data_idx),
+ in_tensor_type, &tmp, _NNS_FLOAT64);
+
+ tmp -= average;
+
+ data_idx = out_element_size * i;
+ gst_tensor_data_raw_typecast (&tmp, _NNS_FLOAT64,
+ (gpointer) (outptr + data_idx), out_tensor_type);
+ }
+ break;
+ }
default:
GST_ERROR_OBJECT (filter, "Cannot identify mode\n");
return GST_FLOW_ERROR;