From 392607a947b0a5d7909531509df11c86a8476815 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AE=A6=E6=99=93=E7=8E=B2?= <3174348550@qq.com> Date: Mon, 29 Sep 2025 14:48:13 +0800 Subject: [PATCH] modify code contents --- docs/lite/docs/source_en/train/runtime_train_cpp.md | 10 +++++----- docs/lite/docs/source_zh_cn/train/runtime_train_cpp.md | 10 +++++----- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/docs/lite/docs/source_en/train/runtime_train_cpp.md b/docs/lite/docs/source_en/train/runtime_train_cpp.md index d10fc75f5b..95a7a8d21e 100644 --- a/docs/lite/docs/source_en/train/runtime_train_cpp.md +++ b/docs/lite/docs/source_en/train/runtime_train_cpp.md @@ -259,7 +259,7 @@ MindSpore Lite provides the following methods to obtain model input tensors: /// \brief Obtains the number of elements of the MSTensor. /// /// \return The number of elements of the MSTensor. - int64_t ElementNum() const; + int64_t ElementsNum() const; /// \brief Obtains the data type of the MSTensor. /// @@ -291,7 +291,7 @@ MindSpore Lite provides the following methods to obtain model input tensors: // Assuming batch_size and data_size variables hold the Batch size and the size of a single data tensor, respectively: // And assuming sparse labels are used if ((inputs.at(data_index)->Size() != batch_size*data_size) || - (inputs.at(label_index)->ElementNum() != batch_size)) { + (inputs.at(label_index)->ElementsNum() != batch_size)) { std::cerr << "Input data size does not match model input" << std::endl; return -1; } @@ -381,7 +381,7 @@ MindSpore Lite provides the following methods to obtain the model's output `MSTe /// \brief Obtains the number of elements of the MSTensor. /// /// \return The number of elements of the MSTensor. - int64_t ElementNum() const; + int64_t ElementsNum() const; /// \brief Obtains the data type of the MSTensor. /// @@ -401,7 +401,7 @@ MindSpore Lite provides the following methods to obtain the model's output `MSTe auto out_tensors = model->GetOutputs(); for (auto out_tensor : out_tensors) { std::cout << "tensor name is:" << out_tensor.Name() << " tensor size is:" << out_tensor.DataSize() - << " tensor elements num is:" << out_tensor.ElementNum() << std::endl; + << " tensor elements num is:" << out_tensor.ElementsNum() << std::endl; // The model output data is float 32. if (out_tensor.DataType() != mindspore::DataType::kNumberTypeFloat32) { std::cerr << "Output should in float32" << std::endl; @@ -413,7 +413,7 @@ MindSpore Lite provides the following methods to obtain the model's output `MSTe return -1; } std::cout << "output data is:"; - for (int i = 0; i < out_tensor.ElementNum() && i < 10; i++) { + for (int i = 0; i < out_tensor.ElementsNum() && i < 10; i++) { std::cout << out_data[i] << " "; } std::cout << std::endl; diff --git a/docs/lite/docs/source_zh_cn/train/runtime_train_cpp.md b/docs/lite/docs/source_zh_cn/train/runtime_train_cpp.md index 62928fd10d..c2424bb6f5 100644 --- a/docs/lite/docs/source_zh_cn/train/runtime_train_cpp.md +++ b/docs/lite/docs/source_zh_cn/train/runtime_train_cpp.md @@ -257,7 +257,7 @@ return model->Resize(inputs, new_shapes); /// \brief Obtains the number of elements of the MSTensor. /// /// \return The number of elements of the MSTensor. - int64_t ElementNum() const; + int64_t ElementsNum() const; /// \brief Obtains the data type of the MSTensor. /// @@ -289,7 +289,7 @@ return model->Resize(inputs, new_shapes); // Assuming batch_size and data_size variables hold the Batch size and the size of a single data tensor, respectively: // And assuming sparse labels are used if ((inputs.at(data_index)->Size() != batch_size*data_size) || - (inputs.at(label_index)->ElementNum() != batch_size)) { + (inputs.at(label_index)->ElementsNum() != batch_size)) { std::cerr << "Input data size does not match model input" << std::endl; return -1; } @@ -379,7 +379,7 @@ MindSpore Lite提供下列方法来获取模型的输出张量: /// \brief Obtains the number of elements of the MSTensor. /// /// \return The number of elements of the MSTensor. - int64_t ElementNum() const; + int64_t ElementsNum() const; /// \brief Obtains the data type of the MSTensor. /// @@ -399,7 +399,7 @@ MindSpore Lite提供下列方法来获取模型的输出张量: auto out_tensors = model->GetOutputs(); for (auto out_tensor : out_tensors) { std::cout << "tensor name is:" << out_tensor.Name() << " tensor size is:" << out_tensor.DataSize() - << " tensor elements num is:" << out_tensor.ElementNum() << std::endl; + << " tensor elements num is:" << out_tensor.ElementsNum() << std::endl; // The model output data is float 32. if (out_tensor.DataType() != mindspore::DataType::kNumberTypeFloat32) { std::cerr << "Output should in float32" << std::endl; @@ -411,7 +411,7 @@ MindSpore Lite提供下列方法来获取模型的输出张量: return -1; } std::cout << "output data is:"; - for (int i = 0; i < out_tensor.ElementNum() && i < 10; i++) { + for (int i = 0; i < out_tensor.ElementsNum() && i < 10; i++) { std::cout << out_data[i] << " "; } std::cout << std::endl; -- Gitee