当前位置: 首页 > wzjs >正文

wordpress播客播放器源码温州seo教程

wordpress播客播放器源码,温州seo教程,用二级域名做的网站算新站吗,天津建站管理系统价格文章大纲 引言一、模型加载概述二、核心数据结构三、模型加载核心流程 引言 Mindspore 是一款华为开发开源的AI推理框架,而Mindspore Lite则是华为为了适配在移动终端设备上运行专门定制的版本,使得我们可以在OpenHarmony快速实现模型加载和推理等功能&…

文章大纲

  • 引言
  • 一、模型加载概述
  • 二、核心数据结构
  • 三、模型加载核心流程

引言

Mindspore 是一款华为开发开源的AI推理框架,而Mindspore Lite则是华为为了适配在移动终端设备上运行专门定制的版本,使得我们可以在OpenHarmony快速实现模型加载和推理等功能,模型加载则是利用 Mindspore Lite 进行推理任务的首要步骤,它犹如打开智能应用大门的钥匙,精准且高效地将预训练模型导入到运行环境中,为后续的推理计算奠定坚实基础。无论是在移动端的智能应用开发,还是边缘计算设备的智能任务处理,Mindspore Lite 加载模型的能力都直接影响着整个系统的运行效率与智能化表现,值得我们深入探究其原理、流程与优化策略,接下来就重点解读核心API 及其流程。

本文非Mindspore入门科普文,需要具备一定的Mindspore 知识。

一、模型加载概述

加载的本质就是把模型从文件Buffer 转为Mindspore 后续推理时所需要的模型的相关对象
CPU 方式直接加载的话就是直接通过本地设备的CPU完成这些工作,这些作为推理的输入直接使用;而通过NNRT 的话就是在CPU完成这第一步加载后,再把转换完成后的输出作为输入通过Delegate 模式再次进行转换,转为NNRT 所需要的模型的相关对象,再把这些NNRT的对象通过NNRT传递到NNRT HOST 进而传递到NPU中进行运算。

二、核心数据结构

Model 由LiteGraph 呈现,LiteGraph 保存着所有的Tensor列表、Node列表、SubGrapha列表和输出、输入的索引,LiteGraph 包含着Node、和SubGrapha,相当于所有的子结构信息都保存到LiteGraph中,每个子结构只保存各自的索引数据,计算后再通过索引从LiteGraph中获取得到对应的数据。图由多个Node构成,每一个Node 承担一个运算操作。比如一个计算图有两个节点NodeA(执行加法操作)和NodeB(执行乘法操作,输入来自NodeA的输出),NodeA 输出张量生成的索引将被记录在output_indices_ 表示这个节点的输出Tensor,NodeB 就使用NodeA 的输出索引作为输入以便获取计算所需的数据。

struct MS_API LiteGraph {struct Node {std::string name_;std::string op_type_;int node_type_;const void *primitive_ = nullptr;std::shared_ptr<void> base_operator_ = nullptr;std::vector<uint32_t> input_indices_;std::vector<uint32_t> output_indices_;int quant_type_;int device_type_ = -1;};struct SubGraph {std::string name_;std::vector<uint32_t> input_indices_;std::vector<uint32_t> output_indices_;std::vector<uint32_t> node_indices_;std::vector<uint32_t> tensor_indices_;};std::string name_;std::string version_;std::vector<uint32_t> input_indices_;std::vector<uint32_t> output_indices_;std::vector<mindspore::schema::Tensor *> all_tensors_;std::vector<Node *> all_nodes_;std::vector<SubGraph *> sub_graphs_;std::string ToString() const;
};struct MS_API Model {LiteGraph graph_;char *buf = nullptr;size_t buf_size_ = 0;LiteModelType model_type_ = mindspore::lite::ModelType_MSLite;void *deobf = nullptr;/// \brief Static method to create a Model pointer.static Model *Import(const char *model_buf, size_t size);/// \brief Static method to create a Model pointer.static Model *Import(const char *filename);/// \brief  method to export model to file.static int Export(Model *model, const char *filename);/// \brief  method to export model to buffer.static int Export(Model *model, char *buf, size_t *size);/// \brief Free meta graph temporary buffervirtual void Free() = 0;/// \brief Free all temporary buffer.EG: nodes in the model.virtual void Destroy() = 0;/// \brief Model destruct, free all memoryvirtual ~Model() = default;
};
Struct LiteGraph{struct Node {std::string name_;std::string op_type_;int node_type_;const void *primitive_ = nullptr;std::shared_ptr<void> base_operator_ = nullptr;std::vector<uint32_t> input_indices_;std::vector<uint32_t> output_indices_;int quant_type_;int device_type_ = -1;};struct SubGraph {std::string name_;std::vector<uint32_t> input_indices_;std::vector<uint32_t> output_indices_;std::vector<uint32_t> node_indices_;std::vector<uint32_t> tensor_indices_;};std::string name_;std::string version_;std::vector<uint32_t> input_indices_;std::vector<uint32_t> output_indices_;std::vector<mindspore::schema::Tensor *> all_tensors_;std::vector<Node *> all_nodes_;std::vector<SubGraph *> sub_graphs_;std::string ToString() const;
}
class MS_API LiteModel : public Model {...
}

三、模型加载核心流程

在这里插入图片描述未完待续…

http://www.dtcms.com/wzjs/49227.html

相关文章:

  • wordpress首页home苏州seo关键词优化外包
  • 门户网站整改情况报告今日热点新闻一览
  • 做视频教学网站百度seo手机
  • 单页网站的域名百度云网盘网页版登录
  • 怎么给网站做懒加载seo入门教程网盘
  • 平台网站如何做推广方案设计鹤壁seo
  • 网站建设提供排名怎么优化自己公司的网站
  • 烟台智能建站模板浏览器广告投放
  • 深圳市防今天防疫情况seo优化一般包括哪些
  • 网站备案代码如何加到站长网站查询工具
  • 设计工作室名字大全防疫管控优化措施
  • 网站防盗链设置爱站网能不能挖掘关键词
  • 做电影网站 资源怎么存放长沙关键词优化新行情报价
  • 丰台青岛网站建设百度收录网站要多久
  • 网站用图片做背景图片电商平台的推广及运营思路
  • 为什么公司要做网站成功的网络营销案例及分析
  • 自己建设个小网站要什么手续费网站推广排名哪家公司好
  • 单页网站设计制作seo自动优化软件安卓
  • 网站分析表必应搜索引擎网站
  • 搭建本地wordpress优化网哪个牌子好
  • dede汽车资讯网站源码怎么注册域名
  • 金华做网站照片查询百度图片搜索
  • 网站建设与规划心得谷歌seo公司
  • 虎门商城网站建设怎么注册百度账号
  • 90设计网图片seo优化分析
  • 网站ui设计报价单广州优化公司哪家好
  • 销售一个产品的网站怎么做信息流推广主要具有哪两大优势
  • 上海高端网站建设公司公司网站怎么申请怎么注册
  • 佛山网站搜索优化推广网址
  • 循化网站建设公司欧美网站建设公司