mindspore.ops.ctc_greedy_decoder
================================

.. image:: https://mindspore-website.obs.cn-north-4.myhuaweicloud.com/website-images/r2.2/resource/_static/logo_source.svg
    :target: https://gitee.com/mindspore/mindspore/blob/r2.2/docs/api/api_python/ops/mindspore.ops.func_ctc_greedy_decoder.rst
    :alt: 查看源文件


.. py:function:: mindspore.ops.ctc_greedy_decoder(inputs, sequence_length, merge_repeated=True)

    对输入中给定的logits执行贪婪解码。

    .. note::
        在Ascend平台上,目前不支持配置 :math:`merge_repeated=False` 。

    参数:
        - **inputs** (Tensor) - shape: :math:`(max\_time, batch\_size, num\_classes)`,数据类型必须是float32或者float64。`num_classes` 为 `num_labels + 1` classes,其中 `num_labels` 表示实际标签的个数,空标签默认使用 `num_classes - 1`。
        - **sequence_length** (Tensor) - shape: :math:`(batch\_size, )`,数据类型必须是int32,并且Tensor中的数值必须小于等于 `max_time`。
        - **merge_repeated** (bool) - ``True`` 表示返回的结果中会合并重复的类。默认值为 ``True`` 。

    返回:
        - **decoded_indices** (Tensor) - shape: :math:`(total\_decoded\_outputs, 2)`,数据类型为int64。
        - **decoded_values** (Tensor) - shape: :math:`(total\_decoded\_outputs, )`,数据类型为int64。
        - **decoded_shape** (Tensor) - shape: :math:`(batch\_size, max\_decoded\_length)`,数据类型为int64。
        - **log_probability** (Tensor) - shape: :math:`(batch\_size, 1)`,包含序列的对数概率,其数据类型与 `inputs` 保持一致。

    异常:
        - **TypeError** - `merge_repeated` 不是一个布尔值。
        - **ValueError** - `inputs` 的shape长度不等于3。
        - **ValueError** - `sequence_length` 的shape长度不等于1。
        - **ValueError** - `sequence_length` 中的数值大于 `max_time`。