Internal functions to handle various tensor type and value. More...
#include <math.h>
#include "tensor_data.h"
#include "nnstreamer_log.h"
#include "nnstreamer_plugin_api.h"
Go to the source code of this file.
Macros | |
#define | td_set_data(td, v, dtype) |
Macro to set data in struct. More... | |
#define | td_get_data(td, v, dtype) |
#define | td_typecast_to(td, itype, otype) |
#define | td_typecast_to_fromf16(td, itype) |
#define | td_typecast(td, otype) |
Functions | |
while (0) | |
dtype = *((dtype *) v); \ More... | |
gboolean | gst_tensor_data_get (tensor_data_s *td, gpointer value) |
Get tensor element value. More... | |
gboolean | gst_tensor_data_typecast (tensor_data_s *td, tensor_type type) |
Typecast tensor element data. More... | |
gboolean | gst_tensor_data_raw_typecast (gpointer input, tensor_type in_type, gpointer output, tensor_type out_type) |
Typecast tensor element value. More... | |
gboolean | gst_tensor_data_raw_average (gpointer raw, gsize length, tensor_type type, gdouble **result) |
Calculate average value of the tensor. More... | |
gboolean | gst_tensor_data_raw_average_per_channel (gpointer raw, gsize length, tensor_type type, tensor_dim dim, gdouble **results) |
Calculate average value of the tensor per channel (the first dim). More... | |
gboolean | gst_tensor_data_raw_std (gpointer raw, gsize length, tensor_type type, gdouble *average, gdouble **result) |
Calculate standard deviation of the tensor. More... | |
gboolean | gst_tensor_data_raw_std_per_channel (gpointer raw, gsize length, tensor_type type, tensor_dim dim, gdouble *averages, gdouble **results) |
Calculate standard deviation of the tensor per channel (the first dim). More... | |
Internal functions to handle various tensor type and value.
Copyright (c) 2021 Samsung Electronics Co., Ltd. All Rights Reserved.
Definition in file tensor_data.c.
#define td_get_data | ( | td, | |
v, | |||
dtype | |||
) |
#define td_set_data | ( | td, | |
v, | |||
dtype | |||
) |
Macro to set data in struct.
Definition at line 21 of file tensor_data.c.
#define td_typecast | ( | td, | |
otype | |||
) |
#define td_typecast_to | ( | td, | |
itype, | |||
otype | |||
) |
#define td_typecast_to_fromf16 | ( | td, | |
itype | |||
) |
gboolean gst_tensor_data_get | ( | tensor_data_s * | td, |
gpointer | value | ||
) |
Get tensor element value.
td | struct for tensor data |
value | pointer of tensor element value |
Definition at line 143 of file tensor_data.c.
gboolean gst_tensor_data_raw_average | ( | gpointer | raw, |
gsize | length, | ||
tensor_type | type, | ||
gdouble ** | result | ||
) |
Calculate average value of the tensor.
raw | pointer of raw tensor data |
length | byte size of raw tensor data |
type | tensor type |
result | double pointer for average value of given tensor. Caller should release allocated memory. |
Definition at line 315 of file tensor_data.c.
gboolean gst_tensor_data_raw_average_per_channel | ( | gpointer | raw, |
gsize | length, | ||
tensor_type | type, | ||
tensor_dim | dim, | ||
gdouble ** | results | ||
) |
Calculate average value of the tensor per channel (the first dim).
raw | pointer of raw tensor data |
length | byte size of raw tensor data |
type | tensor type |
tensor_dim | tensor dimension |
results | double array contains average values of each channel. Caller should release allocated array. |
Definition at line 360 of file tensor_data.c.
gboolean gst_tensor_data_raw_std | ( | gpointer | raw, |
gsize | length, | ||
tensor_type | type, | ||
gdouble * | average, | ||
gdouble ** | result | ||
) |
Calculate standard deviation of the tensor.
raw | pointer of raw tensor data |
length | byte size of raw tensor data |
type | tensor type |
average | average value of given tensor |
result | double pointer for standard deviation of given tensor. Caller should release allocated memory. |
Definition at line 409 of file tensor_data.c.
gboolean gst_tensor_data_raw_std_per_channel | ( | gpointer | raw, |
gsize | length, | ||
tensor_type | type, | ||
tensor_dim | dim, | ||
gdouble * | averages, | ||
gdouble ** | results | ||
) |
Calculate standard deviation of the tensor per channel (the first dim).
raw | pointer of raw tensor data |
length | byte size of raw tensor data |
type | tensor type |
tensor_dim | tensor dimension |
averages | average values of given tensor per-channel |
results | double array contains standard deviation of each channel. Caller should release allocated array. |
Definition at line 455 of file tensor_data.c.
gboolean gst_tensor_data_raw_typecast | ( | gpointer | input, |
tensor_type | in_type, | ||
gpointer | output, | ||
tensor_type | out_type | ||
) |
Typecast tensor element value.
input | pointer of input tensor data |
in_type | input tensor type |
output | pointer of output tensor data |
out_type | output tensor type |
Definition at line 290 of file tensor_data.c.
gboolean gst_tensor_data_typecast | ( | tensor_data_s * | td, |
tensor_type | type | ||
) |
Typecast tensor element data.
td | struct for tensor data |
type | tensor type to be transformed |
Definition at line 203 of file tensor_data.c.
while | ( | 0 | ) |
dtype = *((dtype *) v); \
Definition at line 23 of file tensor_data.c.