onnx: fix, update tensor producer and consumers

- Propagate GstTensor.type becoming to GstTensor.data_type to tensor producer
  (onnx) and consumer (TensorDecoder)

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6061>
This commit is contained in:
Daniel Morin 2024-02-05 22:27:59 -05:00
parent 7271410391
commit 8afc305fe2
2 changed files with 3 additions and 3 deletions

View file

@ -357,7 +357,7 @@ gst_ssd_object_detector_transform_ip (GstBaseTransform * trans, GstBuffer * buf)
get_ ## TYPE ## _at_index (GstTensor *tensor, GstMapInfo *map, \
guint index, TYPE * out) \
{ \
switch (tensor->type) { \
switch (tensor->data_type) { \
case GST_TENSOR_TYPE_FLOAT32: { \
float *f = (float *) map->data; \
if (sizeof(*f) * (index + 1) > map->size) \

View file

@ -362,7 +362,7 @@ GstOnnxClient::GstOnnxClient (GstElement *debug_parent):debug_parent(debug_paren
tensor->data = gst_buffer_new_allocate (NULL, buffer_size, NULL);
gst_buffer_fill (tensor->data, 0, outputTensor.GetTensorData < float >(),
buffer_size);
tensor->type = GST_TENSOR_TYPE_FLOAT32;
tensor->data_type = GST_TENSOR_TYPE_FLOAT32;
} else if (tensorType == ONNX_TENSOR_ELEMENT_DATA_TYPE_INT32) {
size_t buffer_size = 0;
@ -370,7 +370,7 @@ GstOnnxClient::GstOnnxClient (GstElement *debug_parent):debug_parent(debug_paren
tensor->data = gst_buffer_new_allocate (NULL, buffer_size, NULL);
gst_buffer_fill (tensor->data, 0, outputTensor.GetTensorData < float >(),
buffer_size);
tensor->type = GST_TENSOR_TYPE_INT32;
tensor->data_type = GST_TENSOR_TYPE_INT32;
} else {
GST_ERROR_OBJECT (debug_parent, "Output tensor is not FLOAT32 or INT32, not supported");
gst_buffer_remove_meta (buffer, (GstMeta*) tmeta);