2.6K Star 8.5K Fork 4.8K

GVPMindSpore/mindspore

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
mindspore.ops.func_combinations.rst 990 Bytes
一键复制 编辑 原始数据 按行查看 历史
changzherui 提交于 2023-06-19 19:50 . add ckpt map_param inc

mindspore.ops.combinations

.. py:function:: mindspore.ops.combinations(input, r=2, with_replacement=False)

    返回输入Tensor中元素的所有长度为 `r` 的子序列。

    当 `with_replacement` 设为 ``False`` ,功能与Python里的 `itertools.combinations` 类似,若设为 ``True`` ,功能与 `itertools.combinations_with_replacement` 一致。

    参数:
        - **input** (Tensor) - 一维Tensor。
        - **r** (int,可选) - 进行组合的元素个数。默认值: ``2`` 。
        - **with_replacement** (bool,可选) - 是否允许组合存在重复值。默认值: ``False`` 。

    返回:
        Tensor,包含输入Tensor元素的左右组合值。

    异常:
        - **TypeError** - 如果 `input` 不是Tensor。
        - **TypeError** - 如果 `r` 不是int类型。
        - **TypeError** - 如果 `with_replacement` 不是bool类型。
        - **ValueError** - 如果 `input` 不是一维。
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Python
1
https://gitee.com/mindspore/mindspore.git
git@gitee.com:mindspore/mindspore.git
mindspore
mindspore
mindspore
r2.2

搜索帮助

23e8dbc6 1850385 7e0993f3 1850385