上一页 1 2 3 4 5 6 ··· 20 下一页
摘要: ## 元张量函数 (primitive tensor function) 一个模型的执行包含 tensor 和 primitive tensor function,后者是定义 tensor 之间的计算步骤的函数(通常也叫 op,不过这里的范围更广,还包括 Module 等)。 ![../_image 阅读全文
posted @ 2023-07-22 12:18 machine_gun_lin 阅读(161) 评论(0) 推荐(0)
摘要: > 机器学习编译是一个 process,把机器学习的开发转到部署。 ![../_images/dev-deploy-form.png](https://mlc.ai/zh/_images/dev-deploy-form.png) ## 机器学习编译的目标 1. Integration and Dep 阅读全文
posted @ 2023-07-22 11:39 machine_gun_lin 阅读(104) 评论(0) 推荐(0)
摘要: C++11 之前使用默认初始化 C++11 之前对非静态数据成员初始化需要用到初始化列表。 有个问题是,如果类的数据成员比较多,我们又需要定制一些数据成员的初始化操作的时候,需要写很多的构造函数。 来看一个例子: #include <iostream> #include <string> class 阅读全文
posted @ 2022-09-11 22:18 machine_gun_lin 阅读(366) 评论(0) 推荐(0)
摘要: 类型别名(C++11) C++ 可以用 typedef 为很长的类型名 type-id 起个别名 identifier: typedef type-id identifier; 其中 type-id 是已有的类型名,identifier 是我们为它起的别名。 例子: typedef std::map 阅读全文
posted @ 2022-09-09 22:59 machine_gun_lin 阅读(493) 评论(0) 推荐(0)
摘要: C++11 引入了静态断言 static_assert,可以在编译期进行断言。 从运行时断言谈起 在静态断言出现前,运行时断言已经存在很久了,我们可以使用 assert(expression) 在运行时进行断言。 运行时断言通常在 Debug 模式下使用而不在 Release 模式下使用(头文件 c 阅读全文
posted @ 2022-09-08 00:31 machine_gun_lin 阅读(583) 评论(0) 推荐(0)
摘要: decltype 说明符(C++11) C++11 引入了 decltype 说明符,decltype 可以获取一个对象或者表达式的类型。 使用起来也很简单: #include <iostream> int main() { int x1 = 0; decltype(x1) x2 = 0; // x 阅读全文
posted @ 2022-09-07 23:25 machine_gun_lin 阅读(175) 评论(0) 推荐(0)
摘要: 使用 auto 关键字自动推导变量类型(C++11) C++11 允许使用 auto 关键字对变量类型进行自动推导,通常用在变量类型较长或者很难写出变量类型的场景。 来看一个例子: #include <iostream> #include <string> #include <vector> #in 阅读全文
posted @ 2022-09-07 00:02 machine_gun_lin 阅读(78) 评论(0) 推荐(0)
摘要: 命名空间的作用 开发大型软件通常需要许多开发人员并使用很多第三方库,为了防止函数和类型命名冲突,因此引入命名空间。 在使用函数和类型时,可以指定它们的命名空间,这样就不会产生冲突。 来看一个例子: #include <iostream> namespace S1 { void foo() { std 阅读全文
posted @ 2022-09-05 23:47 machine_gun_lin 阅读(568) 评论(0) 推荐(0)
摘要: 整数类型 long long(C++11) C++11 增加了 long long 和 unsigned long long 两种整数类型。 long long int 类型和 long long 等价, unsigned long long int 类型和 unsigned long long 等 阅读全文
posted @ 2022-09-05 22:37 machine_gun_lin 阅读(199) 评论(0) 推荐(0)
摘要: #include <iostream> #include <vector> #include <string> #include <algorithm> std::string add (const std::vector<int>& a, const std::vector<int>& b) { 阅读全文
posted @ 2022-04-19 22:44 machine_gun_lin 阅读(210) 评论(0) 推荐(0)
上一页 1 2 3 4 5 6 ··· 20 下一页