# GstMLInfo

Source: [https://docs.qualcomm.com/doc/80-70014-50Y/topic/ml-api-gstmlinfo.html](https://docs.qualcomm.com/doc/80-70014-50Y/topic/ml-api-gstmlinfo.html)

GstMLInfo 表示描述机器学习属性的信息结构。此信息可以从 GstCaps 中用 gst\_ml\_info\_from\_caps（）填写。

Table : 描述 ML 属性的信息结构

| 字段 | 说明 |
| --- | --- |
| `type (GstMLType)` | 张量的类型 |
| `n_tensors (guint)` | 张量数 |
| `n_dimensions (guint)` | 每个张量的维数 |
| `tensors (guint)` | 具有张量维度的数组 |

## gst\_ml\_info\_init

初始化 GstMLInfo 字段。

**原型**

    void
             gst_ml_info_init (GstMLInfo * info)
    Copy to clipboard

**参数**

| [in] | `info` | 一个 GstMLInfo |
| :--- | :--- | :--- |

**返回结果**

无

## gst\_ml\_info\_new

复制 GstMLInfo 结构。

**原型**

    GstMLInfo *
             gst_ml_info_new (void)Copy to clipboard

**返回结果**

新的 GstMLInfo。使用  gst\_ml\_info\_free（）释放。

## gst\_ml\_info\_copy

复制 GstMLInfo 结构。

**原型**

    GstMLInfo *
    gst_ml_info_copy (const GstMLInfo * info)
    Copy to clipboard

| [in] | `info` | 一个 GstMLInfo |
| :--- | :--- | :--- |

**返回结果**

新的 GstMLInfo。使用  gst\_ml\_info\_free（）释放。

## gst\_ml\_info\_free

释放以前使用 gst\_ml\_info\_new（）或 gst\_ml\_info\_copy（）分配的 GstMLInfo 结构。

**原型**

    void
    gst_ml_info_free (const GstMLInfo * info)
    Copy to clipboard

**参数**

| [in] | `info` | 一个 GstMLInfo |
| :--- | :--- | :--- |

**返回结果**

无

## gst\_ml\_info\_from\_caps

解析功能（caps）并更新 caps 信息。

**原型**

    gboolean 
    gst_ml_info_from_caps (GstMLInfo * info, const GstCaps  * caps)
    Copy to clipboard

**参数**

| [in] | `info` | 一个 GstMLInfo |
| :--- | :--- | :--- |
| [in] | `caps` | 一个 GstCaps |

**返回结果**

如果操作成功，则为 TRUE

## gst\_ml\_info\_to\_caps

将 info 的值转换为 GstCaps。

**原型**

    GstCaps *  
    gst_ml_info_to_caps (const GstMLInfo * info)
    Copy to clipboard

**参数**

| [in] | `info` | 一个 GstMLInfo |
| :--- | :--- | :--- |

**返回结果**

包含信息的新 [GstCaps](https://gstreamer.freedesktop.org/documentation/gstreamer/gstcaps.html)。

## gst\_ml\_info\_is\_equal

比较两个 GstMLInfo 并返回它们是否相等。

**原型**

    gboolean
    gst_ml_info_is_equal (const GstMLInfo * l_info, const GstMLInfo * r_info)
    Copy to clipboard

**参数**

| [in] | `l_info` | 一个 GstMLInfo |
| :--- | :--- | :--- |
| [in] | `r_info` | 一个 GstMLInfo |

**返回结果**

如果操作成功，则为 TRUE。

## gst\_ml\_info\_tensor\_size

从 GstMLInfo 计算其索引指定的张量的大小。

**原型**

    gsize
    gst_ml_info_tensor_size (const GstMLInfo * info, guint index)
    Copy to clipboard

**参数**

| [in] | `info` | 一个 GstMLInfo |
| :--- | :--- | :--- |
| [in] | `index` | 张量索引 |

**返回结果**

大小（以字节为单位）。

## gst\_ml\_info\_size

计算 GstMLInfo 中所有张量的总大小。

**原型**

    gsize
    gst_ml_info_size (const GstMLInfo * info)
    Copy to clipboard

**参数**

| [in] | `info` | 一个 GstMLInfo |
| --- | --- | --- |

**返回结果**

大小（以字节为单位）。

**Parent Topic:** [机器学习 API](https://docs.qualcomm.com/doc/80-70014-50Y/topic/machine-learning-apis.html)

Last Published: Nov 11, 2025

[Previous Topic
GstMLType](https://docs.qualcomm.com/bundle/publicresource/80-70014-50Y/topics/ml-api-gstmltype.md) [Next Topic
GstMLTensorMeta](https://docs.qualcomm.com/bundle/publicresource/80-70014-50Y/topics/ml-api-gstmltensormeta.md)