GstAnalytics.Tensor¶
Fields¶
Name |
Type |
Access |
Description |
|---|---|---|---|
data |
r/w |
|
|
data_type |
r/w |
|
|
dims |
[ |
r/w |
number of tensor dimensions |
dims_order |
r/w |
Indicate tensor elements layout in memory. |
|
id |
r/w |
semantically identify the contents of the tensor |
|
layout |
r/w |
Indicate tensor layout |
|
num_dims |
r/w |
number of tensor dimensions |
Methods¶
class |
|
class |
|
class |
|
|
|
|
|
|
|
|
|
|
Details¶
- class GstAnalytics.Tensor¶
Hold tensor data
New in version 1.26.
- classmethod alloc(num_dims)¶
- Parameters:
num_dims (
int) – Number of dimension of the tensors- Returns:
tensor allocated
- Return type:
Allocate a tensor with num_dims dimensions.
New in version 1.26.
- classmethod data_type_get_name(data_type)¶
- Parameters:
data_type (
GstAnalytics.TensorDataType) – aGstAnalytics.TensorDataType- Returns:
a constant string with the name of the data type
- Return type:
Get a string version of the data type
New in version 1.28.
- classmethod new_simple(id, data_type, data, dims_order, dims)¶
- Parameters:
id (
int) – semantically identify the contents of the tensordata_type (
GstAnalytics.TensorDataType) –GstAnalytics.TensorDataTypeof tensor datadata (
Gst.Buffer) –Gst.Bufferholding tensor datadims_order (
GstAnalytics.TensorDimOrder) – Indicate tensor dimension indexing orderdims ([
int]) – size of tensor in each dimension. A value of 0 means the dimension is dynamic.
- Returns:
A newly allocated
GstAnalytics.Tensor- Return type:
Allocates a new
GstAnalytics.Tensorof dims_order ROW_MAJOR or COLUMN_MAJOR and with an interleaved layout.For example, a two-dimensional tensor with 32 rows and 4 columns, dims would be the two element array
[32, 4].New in version 1.26.
- check_type(data_type, order, dims)¶
- Parameters:
data_type (
GstAnalytics.TensorDataType) – The data type of the tensororder (
GstAnalytics.TensorDimOrder) – The order of the tensor to read from the memorydims ([
int] orNone) – An optional array of dimensions, whereGObject.G_MAXSIZEmeans ANY.
- Returns:
Trueif theGstAnalytics.Tensorhas the reading order from the memory matching order, dimensions matching num_dims, data type matching data_type OtherwiseFalsewill be returned.- Return type:
Validate the tensor whether it mathces the reading order, dimensions and the data type. Validate whether the
Gst.Bufferhas enough size to hold the tensor data.New in version 1.28.
- copy()¶
- Returns:
a new
GstAnalytics.Tensor- Return type:
Create a copy of self.
New in version 1.26.
- free()¶
Free tensor
New in version 1.26.
- get_dims()¶
- Returns:
The dims array form the tensor
- Return type:
[
int]
Gets the dimensions of the tensor.
New in version 1.26.
- set_simple(id, data_type, data, dims_order, dims)¶
- Parameters:
id (
int) – semantically identify the contents of the tensordata_type (
GstAnalytics.TensorDataType) –GstAnalytics.TensorDataTypeof tensor datadata (
Gst.Buffer) –Gst.Bufferholding tensor datadims_order (
GstAnalytics.TensorDimOrder) – Indicate tensor dimension indexing orderdims ([
int]) – size of tensor in each dimension. A value of 0 means the dimension is dynamic.
- Returns:
Trueif it coudl be set correctly- Return type:
Sets the content of a
GstAnalytics.Tensorof dims_order ROW_MAJOR or COLUMN_MAJOR and with an interleaved layout. TheGstAnalytics.Tensormust have exactly num_dims.For example, a two-dimensional tensor with 32 rows and 4 columns, dims would be the two element array
[32, 4].New in version 1.28.