From c397b6511bfa93162202d848108e1d1b4939fff1 Mon Sep 17 00:00:00 2001 From: dayschan Date: Mon, 16 Jun 2025 10:21:21 +0800 Subject: [PATCH] fix the docs of c++ api repeat_interleave --- .../operation/cpp_api_for_custom_ops.md | 12 ++++++------ .../operation/cpp_api_for_custom_ops.md | 12 ++++++------ 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/tutorials/source_en/custom_program/operation/cpp_api_for_custom_ops.md b/tutorials/source_en/custom_program/operation/cpp_api_for_custom_ops.md index 69f5758d79..a98fc9a36c 100644 --- a/tutorials/source_en/custom_program/operation/cpp_api_for_custom_ops.md +++ b/tutorials/source_en/custom_program/operation/cpp_api_for_custom_ops.md @@ -247,17 +247,17 @@ The `Tensor` class is defined in the [tensor.h](https://gitee.com/mindspore/mind - **repeat_interleave** ```cpp - Tensor repeat_interleave(const Tensor &repeats, std::optional dim = std::nullopt, - std::optional output_size = std::nullopt) const; - Tensor repeat_interleave(int64_t repeats, std::optional dim = std::nullopt, - std::optional output_size = std::nullopt) const; + Tensor repeat_interleave(const Tensor &repeats, const std::optional &dim = std::nullopt, + const std::optional &output_size = std::nullopt) const; + Tensor repeat_interleave(int64_t repeats, const std::optional &dim = std::nullopt, + const std::optional &output_size = std::nullopt) const; ``` - **Description**: 【API】 Repeats the elements of the tensor along a specified dimension. - **Parameters**: - `repeats`: A scalar or tensor specifying the number of times each element is repeated. If a tensor is provided, its size must match the size of the specified dimension. - - `dim`: The dimension along which to repeat elements, default is `std::nullopt`. - - `output_size`: (Optional) The size of the output tensor along the specified dimension. + - `dim`: (Optional) The dimension along which to repeat elements, default is `std::nullopt`. + - `output_size`: (Optional) The size of the output tensor along the specified dimension, default is `std::nullopt`. - **Return Value**: A new tensor with repeated elements. #### Public Methods (Internal Processes) diff --git a/tutorials/source_zh_cn/custom_program/operation/cpp_api_for_custom_ops.md b/tutorials/source_zh_cn/custom_program/operation/cpp_api_for_custom_ops.md index 79c66c4f86..abca0f6710 100644 --- a/tutorials/source_zh_cn/custom_program/operation/cpp_api_for_custom_ops.md +++ b/tutorials/source_zh_cn/custom_program/operation/cpp_api_for_custom_ops.md @@ -247,17 +247,17 @@ kNumberTypeEnd, // Number 类型结束值 - **repeat_interleave** ```cpp - Tensor repeat_interleave(const Tensor &repeats, std::optional dim = std::nullopt, - std::optional output_size = std::nullopt) const; - Tensor repeat_interleave(int64_t repeats, std::optional dim = std::nullopt, - std::optional output_size = std::nullopt) const; + Tensor repeat_interleave(const Tensor &repeats, const std::optional &dim = std::nullopt, + const std::optional &output_size = std::nullopt) const; + Tensor repeat_interleave(int64_t repeats, const std::optional &dim = std::nullopt, + const std::optional &output_size = std::nullopt) const; ``` - **描述**:【API】沿指定维度重复张量的元素。 - **参数**: - `repeats`:一个标量或张量,指定每个元素的重复次数。如果是张量,其大小必须与该维度的张量大小一致。 - - `dim`:指定的维度,默认为 `std::nullopt`。 - - `output_size`:(可选)输出张量在该维度的大小。 + - `dim`:(可选)指定的维度,默认为 `std::nullopt`。 + - `output_size`:(可选)输出张量在该维度的大小,默认为 `std::nullopt`。 - **返回值**:一个重复元素的新张量。 #### 公共方法(内部流程) -- Gitee