GstAnalytics.Tensor

Fields

Name

Type

Access

Description

data

Gst.Buffer

r/w

Gst.Buffer holding tensor data

data_type

GstAnalytics.TensorDataType

r/w

GstAnalytics.TensorDataType of tensor data

dims

[int]

r/w

number of tensor dimensions

dims_order

GstAnalytics.TensorDimOrder

r/w

Indicate tensor elements layout in memory.

id

int

r/w

semantically identify the contents of the tensor

layout

GstAnalytics.TensorLayout

r/w

Indicate tensor layout

num_dims

int

r/w

number of tensor dimensions

Methods

class

alloc (num_dims)

class

data_type_get_name (data_type)

class

new_simple (id, data_type, data, dims_order, dims)

check_type (data_type, order, dims)

copy ()

free ()

get_dims ()

set_simple (id, data_type, data, dims_order, dims)

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:

GstAnalytics.Tensor

Allocate a tensor with num_dims dimensions.

New in version 1.26.

classmethod data_type_get_name(data_type)
Parameters:

data_type (GstAnalytics.TensorDataType) – a GstAnalytics.TensorDataType

Returns:

a constant string with the name of the data type

Return type:

str

Get a string version of the data type

New in version 1.28.

classmethod new_simple(id, data_type, data, dims_order, dims)
Parameters:
Returns:

A newly allocated GstAnalytics.Tensor

Return type:

GstAnalytics.Tensor

Allocates a new GstAnalytics.Tensor of 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:
Returns:

True if the GstAnalytics.Tensor has the reading order from the memory matching order, dimensions matching num_dims, data type matching data_type Otherwise False will be returned.

Return type:

bool

Validate the tensor whether it mathces the reading order, dimensions and the data type. Validate whether the Gst.Buffer has enough size to hold the tensor data.

New in version 1.28.

copy()
Returns:

a new GstAnalytics.Tensor

Return type:

GstAnalytics.Tensor or None

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:
Returns:

True if it coudl be set correctly

Return type:

bool

Sets the content of a GstAnalytics.Tensor of dims_order ROW_MAJOR or COLUMN_MAJOR and with an interleaved layout. The GstAnalytics.Tensor must 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.