ICode9

精准搜索请尝试: 精确搜索
首页 > 编程语言> 文章详细

MindSpore解读评注(5)对ccsrc\pipeline\jit\parse\python_adapter.cc的部分注释

2021-08-03 13:29:37  阅读:169  来源: 互联网

标签:std pipeline const key python parse vector file CharToString


对ccsrc/minddata/dataset/include/dataset的注释 DataHelper,一个通用的数据帮助类,这里是mind数据集包含的数据集数据助手 知识浅薄,还有许多未理解之处,欢迎各位纠正、讨论 路径:mindsspore/ccsrc/minddata/dataset/include/dataset

#include "minddata/dataset/include/dataset/data_helper.h"
//mind数据集包含的数据集数据助手
//DataHelper,一个通用的数据帮助类
#include <algorithm>
//算法(Algorithm)为一个计算的具体步骤,常用于计算、数据处理和自动推理。C++ 算法库(Algorithms library)为 C++ 程序提供了大量可以用来对容器及其它序列进行算法操作的函数。
//这些组件可以为函数或函数模板,大部份由头文件 <algorithm> 提供,一小部份位于 <numeric>、<cstdlib> 中。
#include <iostream>//输入输出流
#include <map>
//map 是一种关联容器, 提供一对一的关联, 关联的形式为: KEY----VALUE(键值对),另外关键字不能重复。
//map 也可看做是 关键字映射的集合, 即,map中不可出现重复的关键字,每条映射的关键字都是不同的。
#include "minddata/dataset/util/json_helper.h"//在当前文件下导入头文件
#include "include/api/status.h"
namespace mindspore {//命名空间mindspore
namespace dataset {//命名空间数据集
// Create a numbered json file from image folder
//从图像文件夹创建编号的json文件
Status DataHelper::CreateAlbumIF(const std::vector<char> &in_dir, const std::vector<char> &out_dir){
  //建立矢量字符文件 在目录中和输出方向的常量
  auto jh = JsonHelper();
  return jh.CreateAlbum(CharToString(in_dir), CharToString(out_dir));
  //字符到字符串 图表输入目录,图表输出目录
  //创建文件     返回文件
}
// A print method typically used for debugging
//通常用于调试的打印方法
void DataHelper::Print(std::ostream &out) const {//输出流
  out << "  Data Helper"
      << "\n";
}
///状态数据助手 更新数组如果数据类型是后面的就将数据进行相应处理并返回数据再更新数组
//输入文件char类型存入容器char键值char     输出文件char
//vector 本质上是一个动态数组,它的元素是连续存储的,这意味着不仅可以通过迭代器访问元素,还可以使用指向元素的常规指针来对其进行访问。还可以将指向 vector 元素的指针传递给任何需要指向数组元素的指针的函数。
Status DataHelper::UpdateArrayIF(const std::vector<char> &in_file, const std::vector<char> &key,
                                 const std::vector<std::vector<char>> &value, const std::vector<char> &out_file) {
  auto jh = JsonHelper();//Json帮助程序 auto有两种用途:自动类型推断和返回值占位。 
  //auto自动类型推断,用于从初始化表达式中推断出变量的数据类型。
  return jh.UpdateArray(CharToString(in_file), CharToString(key), VectorCharToString(value), CharToString(out_file));
  //制图返回更新后的数组
}
//输入数据类型为char 建立char容器及key bool类型转化 输出char
Status DataHelper::UpdateArrayIF(const std::vector<char> &in_file, const std::vector<char> &key,
                                 const std::vector<bool> &value, const std::vector<char> &out_file) {
  auto jh = JsonHelper();
  return jh.UpdateArray(CharToString(in_file), CharToString(key), value, CharToString(out_file));
  //返回更新后的数组
}
//输入数据类型为char 建立容器keyint8_t类型(8进制整型数)与值 输出char
Status DataHelper::UpdateArrayIF(const std::vector<char> &in_file, const std::vector<char> &key,
                                 const std::vector<int8_t> &value, const std::vector<char> &out_file) {
  auto jh = JsonHelper();
  return jh.UpdateArray(CharToString(in_file), CharToString(key), value, CharToString(out_file));
  //返回更新后的数组
}
//输入数据类型为char 建立容器keyuint8_t类型(无符号8进制整型数)与值 输出char
Status DataHelper::UpdateArrayIF(const std::vector<char> &in_file, const std::vector<char> &key,
                                 const std::vector<uint8_t> &value, const std::vector<char> &out_file) {
  auto jh = JsonHelper();
  return jh.UpdateArray(CharToString(in_file), CharToString(key), value, CharToString(out_file));
  //返回更新后的数组
}
//输入数据类型为char 建立容器keyint16_t类型(16进制整型数)与值 输出char
Status DataHelper::UpdateArrayIF(const std::vector<char> &in_file, const std::vector<char> &key,
                                 const std::vector<int16_t> &value, const std::vector<char> &out_file) {
  auto jh = JsonHelper();
  return jh.UpdateArray(CharToString(in_file), CharToString(key), value, CharToString(out_file));
  //返回更新后的数组
}
//输入数据类型为char 建立容器keyuint16_t类型(无符号16进制整型数)与值 输出char
Status DataHelper::UpdateArrayIF(const std::vector<char> &in_file, const std::vector<char> &key,
                                 const std::vector<uint16_t> &value, const std::vector<char> &out_file) {
  auto jh = JsonHelper();
  return jh.UpdateArray(CharToString(in_file), CharToString(key), value, CharToString(out_file));
  //返回更新后的数组
}
//输入数据类型为char 建立容器keyint32_t类型(32进制整型数)与值 输出char
Status DataHelper::UpdateArrayIF(const std::vector<char> &in_file, const std::vector<char> &key,
                                 const std::vector<int32_t> &value, const std::vector<char> &out_file) {
  auto jh = JsonHelper();
  return jh.UpdateArray(CharToString(in_file), CharToString(key), value, CharToString(out_file));
  //返回更新后的数组
}
//输入数据类型为char 建立容器key输出uint32_t类型(无符号32进制整型数)与值 输出char
Status DataHelper::UpdateArrayIF(const std::vector<char> &in_file, const std::vector<char> &key,
                                 const std::vector<uint32_t> &value, const std::vector<char> &out_file) {
  auto jh = JsonHelper();
  return jh.UpdateArray(CharToString(in_file), CharToString(key), value, CharToString(out_file));
  //返回更新后的数组
}
//输入数据类型为char 建立容器key int64_t类型(64进制整型数)与值 输出char
Status DataHelper::UpdateArrayIF(const std::vector<char> &in_file, const std::vector<char> &key,
                                 const std::vector<int64_t> &value, const std::vector<char> &out_file) {
  auto jh = JsonHelper();
  return jh.UpdateArray(CharToString(in_file), CharToString(key), value, CharToString(out_file));
  //返回更新后的数组
}
//输入数据类型为char 建立容器key uint64_t类型(无符号64进制整型数)与值 输出char
Status DataHelper::UpdateArrayIF(const std::vector<char> &in_file, const std::vector<char> &key,
                                 const std::vector<uint64_t> &value, const std::vector<char> &out_file) {
  auto jh = JsonHelper();
  return jh.UpdateArray(CharToString(in_file), CharToString(key), value, CharToString(out_file));
  //返回更新后的数组
}
//输入数据类型为char 建立容器key float类型(单精度浮点数)与值来转化 输出char
Status DataHelper::UpdateArrayIF(const std::vector<char> &in_file, const std::vector<char> &key,
                                 const std::vector<float> &value, const std::vector<char> &out_file) {
  auto jh = JsonHelper();
  return jh.UpdateArray(CharToString(in_file), CharToString(key), value, CharToString(out_file));
  //返回更新后的数组
}
//输入数据类型为char 建立容器key double类型(双精度浮点数)与值 输出char
Status DataHelper::UpdateArrayIF(const std::vector<char> &in_file, const std::vector<char> &key,
                                 const std::vector<double> &value, const std::vector<char> &out_file) {
  auto jh = JsonHelper();
  return jh.UpdateArray(CharToString(in_file), CharToString(key), value, CharToString(out_file));
  //返回更新后的数组
}
//输入数据类型为char 建立容器key char类型(字符)与值 输出char
Status DataHelper::UpdateValueIF(const std::vector<char> &in_file, const std::vector<char> &key,
                                 const std::vector<char> &value, const std::vector<char> &out_file) {
  auto jh = JsonHelper();
  return jh.UpdateValue(CharToString(in_file), CharToString(key), CharToString(value), CharToString(out_file));
  //返回更新值
}
//输入数据类型为char 建立容器key bool类型(布尔类型) 常量布尔值 输出char
Status DataHelper::UpdateValueIF(const std::vector<char> &in_file, const std::vector<char> &key, 
                                const bool &value, const std::vector<char> &out_file) {
  auto jh = JsonHelper();
  return jh.UpdateValue(CharToString(in_file), CharToString(key), value, CharToString(out_file));
  //返回更新值
}
//输入数据类型为char 建立容器char和key 常量int8_t类型与值 输出char
Status DataHelper::UpdateValueIF(const std::vector<char> &in_file, const std::vector<char> &key, 
                                const int8_t &value,const std::vector<char> &out_file) {
  auto jh = JsonHelper();
  return jh.UpdateValue(CharToString(in_file), CharToString(key), value, CharToString(out_file));
  //返回更新值
}
//输入数据类型为char 建立容器char和key 常量uint8_t类型与值 输出char
Status DataHelper::UpdateValueIF(const std::vector<char> &in_file, const std::vector<char> &key, const uint8_t &value,
                                 const std::vector<char> &out_file) {
  auto jh = JsonHelper();
  return jh.UpdateValue(CharToString(in_file), CharToString(key), value, CharToString(out_file));
  //返回更新值
}
//输入数据类型为char 建立容器char和key 常量int16_t类型与值 输出char
Status DataHelper::UpdateValueIF(const std::vector<char> &in_file, const std::vector<char> &key, const int16_t &value,
                                 const std::vector<char> &out_file) {
  auto jh = JsonHelper();
  return jh.UpdateValue(CharToString(in_file), CharToString(key), value, CharToString(out_file));
  //返回更新值
}
//输入数据类型为char 建立容器char和key 常量uint16_t类型与值 输出char
Status DataHelper::UpdateValueIF(const std::vector<char> &in_file, const std::vector<char> &key, const uint16_t &value,
                                 const std::vector<char> &out_file) {
  auto jh = JsonHelper();
  return jh.UpdateValue(CharToString(in_file), CharToString(key), value, CharToString(out_file));
  //返回更新值
}
//输入数据类型为char 建立容器char和key 常量int32_t类型与值 输出char
Status DataHelper::UpdateValueIF(const std::vector<char> &in_file, const std::vector<char> &key, const int32_t &value,
                                 const std::vector<char> &out_file) {
  auto jh = JsonHelper();
  return jh.UpdateValue(CharToString(in_file), CharToString(key), value, CharToString(out_file));
  //返回更新值
}
//输入数据类型为char 建立容器char和key 常量uint32_t类型与值 输出char
Status DataHelper::UpdateValueIF(const std::vector<char> &in_file, const std::vector<char> &key, const uint32_t &value,
                                 const std::vector<char> &out_file) {
  auto jh = JsonHelper();
  return jh.UpdateValue(CharToString(in_file), CharToString(key), value, CharToString(out_file));
  //返回更新值
}
//输入数据类型为char 建立容器char和key 常量int64_t类型与值 输出char
Status DataHelper::UpdateValueIF(const std::vector<char> &in_file, const std::vector<char> &key, const int64_t &value,
                                 const std::vector<char> &out_file) {
  auto jh = JsonHelper();
  return jh.UpdateValue(CharToString(in_file), CharToString(key), value, CharToString(out_file));
  //返回更新值
}
//输入数据类型为char 建立容器char和key 常量uint64_t类型与值 输出char
Status DataHelper::UpdateValueIF(const std::vector<char> &in_file, const std::vector<char> &key, const uint64_t &value,
                                 const std::vector<char> &out_file) {
  auto jh = JsonHelper();
  return jh.UpdateValue(CharToString(in_file), CharToString(key), value, CharToString(out_file));
  //返回更新值
}
//输入数据类型为char 建立容器char和key 常量float类型与值 输出char
Status DataHelper::UpdateValueIF(const std::vector<char> &in_file, const std::vector<char> &key, const float &value,
                                 const std::vector<char> &out_file) {
  auto jh = JsonHelper();
  return jh.UpdateValue(CharToString(in_file), CharToString(key), value, CharToString(out_file));
  //返回更新值
}
//输入数据类型为char 建立容器char和key 常量double类型与值 输出char
Status DataHelper::UpdateValueIF(const std::vector<char> &in_file, const std::vector<char> &key, const double &value,
                                 const std::vector<char> &out_file) {
  auto jh = JsonHelper();
  return jh.UpdateValue(CharToString(in_file), CharToString(key), value, CharToString(out_file));
  //返回更新值
}
//输入数据类型为char 建立容器char和key 常量char类型与值 输出char
Status DataHelper::RemoveKeyIF(const std::vector<char> &in_file, const std::vector<char> &key,
                               const std::vector<char> &out_file) {
  auto jh = JsonHelper();
  return jh.RemoveKey(CharToString(in_file), CharToString(key), CharToString(out_file));
  //删除密钥
}
//输入常量无符号字符张量地址 常量张量大小 地址 常量缓冲区大小
size_t DataHelper::DumpData(const unsigned char *tensor_addr, const size_t &tensor_size, void *addr,
                            const size_t &buffer_size) {
  auto jh = JsonHelper();
  return jh.DumpData(tensor_addr, tensor_size, addr, buffer_size);
  //返回转储数据包括张量地址 张量大小 地址 缓冲区大小
}
}  // namespace dataset
}  // namespace mindspore

以上即为本篇的所有内容,因学识与能力有限,如有不足之处,请多多包涵与指教

标签:std,pipeline,const,key,python,parse,vector,file,CharToString
来源: https://blog.csdn.net/qq_53904578/article/details/119347996

本站声明: 1. iCode9 技术分享网(下文简称本站)提供的所有内容,仅供技术学习、探讨和分享;
2. 关于本站的所有留言、评论、转载及引用,纯属内容发起人的个人观点,与本站观点和立场无关;
3. 关于本站的所有言论和文字,纯属内容发起人的个人观点,与本站观点和立场无关;
4. 本站文章均是网友提供,不完全保证技术分享内容的完整性、准确性、时效性、风险性和版权归属;如您发现该文章侵犯了您的权益,可联系我们第一时间进行删除;
5. 本站为非盈利性的个人网站,所有内容不会用来进行牟利,也不会利用任何形式的广告来间接获益,纯粹是为了广大技术爱好者提供技术内容和技术思想的分享性交流网站。

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有