- 博客(44)
- 收藏
- 关注
原创 每日新知识
写在函数外类外的文件中:静态全局变量,作用域仅限于定义它的文件,其他文件无法访问。如果写在了头文件中,相当于包含这个头文件的文件中自定义了一个静态全局变量作用于本文件,即每个文件各得到了变量的副本,各文件中对这个变量的操作不影响原始头文件中的这个变量。静态成员函数:静态成员函数是属于类而不是属于某个特定对象的函数。静态成员函数只能访问静态成员变量和静态成员函数。写在函数外类内,静态成员变量。所有类的实例共享一个静态成员变量。它在类的所有对象之间是共享的。写在函数中:静态局部变量。示例 1:计算整数的总和。
2025-04-02 11:31:58
124
原创 clangd的使用,实现跳转提示
若没有找到compile_commands.json文件可以通过如下方式之后再便于即可生成。在项目最顶层的.cmake文件中或者CMakeList文件中加入如下命令。一、插件卸载c插件下载clangd。二、设置搜索clangd。
2023-09-02 18:51:20
1848
1
原创 vector的使用
https://blog.youkuaiyun.com/u011555996/article/details/96958965如果已经知道vector的大小那么给其赋值除了push_back还可以for(int i=0;i <vec->size();i++){ (*vec)[i]= static_cast<float>(generator(*(Eengine.getEngine()))); }
2022-04-24 11:14:42
100
原创 C++中存 取 传递数据
vector结构体struct addOperandsSpec { explicit addOperandsSpec(int64 add_operands_num = 0, int64 samples_num = 0, double add_operands_mean = 0.0, double add_operands_stddev = 0.0,
2022-03-31 00:13:17
516
原创 linux环境变量 export
https://www.cnblogs.com/hnrainll/archive/2011/06/29/2092860.html
2022-03-25 14:51:29
116
原创 C++指针的使用
字符串后面加.c_str()``string str1 = “kkkffff”;const char *ptr = str1.c_str();
2022-03-23 11:33:50
815
原创 python 文件 文件获取
if os.path.isdir(args.input): files_names = os.listdir(args.input)//从文件夹路径获取文件名 放入list files_names.sort() data_htmls = '' for i in files_names: file_path = os.path.join(args.input, i)//文件夹路径和文件名 拼成文件路径
2022-03-16 23:48:26
1047
原创 python 占位符 连接符
‘{}字符串’.format()print(’{0:2d} {1:3d}’.format(0,1)){0:02d} 第一个0对应format的0位置的数据 第二个0表示两位十进制数字的字符串,不够两位用0填充print(’{0:2d} {1:3d}’.format(0,1)) 可写成print(’{:2d} {:3d}’.format(0,1))ord() 转字母为对应的ASCII码各种进制之间相互转化int('0x17', 16) # 16进制转化为10进制 23int('101010
2022-03-15 20:41:39
1009
原创 python 命令行传参
def parse_args(): import argparse parser = argparse.ArgumentParser(description='tensor analysis') parser.add_argument('-i', '--input', default='.', help='path of your data
2022-03-15 20:36:56
651
原创 reduce_sum
ruduce 减少sum和通过减少维度的方式来求和–即在某个维度上进行求和 进而减少了维度https://blog.youkuaiyun.com/qq_16137569/article/details/72568793
2022-03-09 10:43:58
214
原创 markdown书写
自动生成目录(可跳转)npm i doctoc -gdoctoc 文件路径 //生成文件路径doctoc 文件路径 -u //更新文件目录
2022-03-05 14:13:01
347
原创 C++构造函数
#include <iostream>#include <stdio.h>using namespace std; class Student{public: //默认构造函数 Student() { num = 1001; age = 18; } //初始化构造函数 Student(int n, int a) :num(n), age(a) {}private: int num; int age;};int main(){ //用默认构
2022-03-02 17:32:10
263
原创 python画图 做表
print(’{0:2d} {1:3d}’.format(0,1)){0:02d} 第一个0对应format的0位置的数据 第二个0表示两位十进制数字的字符串,不够两位用0填充print(’{0:2d} {1:3d}’.format(0,1)) 可写成print(’{:2d} {:3d}’.format(0,1))ord() 转字母为对应的ASCII码各种进制之间相互转化int('0x17', 16) # 16进制转化为10进制 23int('101010',2) # 二进制转化为10进制
2022-02-25 16:51:03
680
原创 C++ 自定义数据类型
struct Date{ int day, month, year;};Date birthday = {23, 8, 1983};
2022-02-20 10:02:40
520
转载 template<typename T>
比如我们要计算两个数的加法,针对不同类型可能需要设计不同类型的函数,那么template 就可以很好的解决这个问题。原始解决方法:int sum(int a,int b);double sum(double a,double b);float sum(float a,float b);但是当用template 后为:template T sum(T a, T b){ return a+b;}...
2022-02-16 09:51:42
411
原创 docker
更新docker先退出docker exitmake update-dev-docker进入docker执行 make start-dev-docker ssh_port_mapping=10234
2022-01-28 16:18:09
2552
原创 linux命令
Ctrl+a 将光标移至输入行头,相当于Home键Ctrl+e 将光标移至输入行末,相当于End键Ctrl+k 删除从光标所在位置到行末Alt+Backspace 向前删除一个单词修改权限chown -R rui.xue:rui.xue ./*chmod 777 test.sh //777对应文件所有者 同ID的组 其他用户 7为读+写+执行( r=4,w=2,x=1);修改成功之后 ll一下可以看到文件后面有个*代表可运行了把文件的所有者改为shiyanlousudo chown shiy
2022-01-28 16:16:41
924
原创 C++读文件夹 文件
读文件夹地址 返回文件路径std::vector<std::string> FilterPath::getFilesList(std::string path) { std::vector<std::string> filenames; DIR *pDir; struct dirent *ptr; if (!(pDir = opendir(path.c_str()))) { std::cout << "Folder doesn't Exist!"
2022-01-28 15:03:42
1811
原创 C++ 字符串
字符串截取string str = "012345";//从第0位开始截取3位string str1 = str.substr(0,3) //012//获取字符串的最后一位string str2 = str.substr(str.length()-1,1) //5
2022-01-28 14:48:33
733
原创 C++文件读取
#include <unistd.h>#include <cassert>#include <fstream>#include <iostream>#include <memory>ReadContent(std::string file) { std::ifstream infile; infile.open(file.data()); assert(infile.is_open()); std::string pre
2022-01-27 15:58:23
569
转载 C++执行linux命令
fgets–获取键盘输入值#include <stdio.h>#include <string.h>#define N 10int main(){ //数组空间10. char s1[N]; fgets(s1, N, stdin); //stdin表示我们从键盘输入数据,或者说从控制台读取输入数据 cout << "s1所占空间大小为:"; cout << sizeof(s1) << endl;
2022-01-23 17:30:47
4373
原创 C++常见报错
error: expected '{' before 'type_'//type_前面少了个,error: invalid use of non-static member function//把function当变量使用了error: 'OpValidation' is not a member of 'dtu_idc'//最上面没有写include 对应文件error: 'OpValidation' is not a member of 'dtu_idc'//op_validation.h
2022-01-21 16:40:53
1521
原创 格式化文档
安装$ sudo apt install clang-format设置//可选项为 LLVM、Google、Chromium、Mozilla、WebKit 和 file$ clang-format -style=Google -dump-config > .clang-format使用$ clang-format -style=file -i main.cc$ clang-format -i main.cc
2022-01-21 11:22:36
250
1
原创 shell脚本
传入外部参数info.sh写法为name = $1age = $2echo " ${name}的年龄是${age}"对应执行情况为bash info.sh xiaoming 20
2022-01-21 10:16:19
593
原创 / ./
./表示运行目录前的/ 表示此目录为绝对目录 如:OP_VALIDATE_FILE=’/pathtohlofile/hlo.txt’表示是在绝对路径下的hlo.txt文件
2022-01-20 17:22:54
87
原创 C++ json格式的书写
书写格式①最外层用 { }扩起来②里面的键 值对 用 { }扩起来③键对应的值超过一个 值也要用{ }扩起来json json_config = {{"action", "run"}, {"func", "print"}, {"layer", ""}, {"parameters", {{"baseline_path",
2022-01-13 11:52:07
1067
原创 HLO--XLA
HLO:high level optimizer 高级优化器XLA:是TensorFlow XLA 是TensorFlow的编译型推理引擎叫XLA 这种编译型推理引擎会用到HLO通常来说,整个编译流程先将TensorFlow的图转化为XLA HLO,即一种类似高级语言的图的中间表达形式,可以基于此进行一些 High-Level 的优化。接着将XLA HLO翻译为LLVM IR,使用LLVM编译到各种硬件的汇编语言,从而运行在硬件上进行数值计算。...
2021-12-20 16:57:29
2429
2
原创 bazel的使用方法
name:名字可以自己起 自己起 下一个依赖的srcs写此名字deps :depends的意思 相当于include 即文件中包含的其他文件 xxx.h文件又称依赖文件deps = [ ":hello-time", //在同一个目录下的格式 "//lib:hello-greet", //在其他目录下的格式 "@com_github_jbeder_yaml_cpp//:yaml-cpp",//网络上 "@dtu_sdk//lib/idc:i
2021-12-15 10:34:23
1851
原创 GIT的使用步骤
GIT的使用在~目录下输入:ssh-keygen 不断回车 会生成公私钥存放在.ssh文件中在~目录下输入:ls -a 找到.ssh文件 复制其公钥 然后在github上粘贴其公钥(使用ssh的好处:执行git push时不用重复输入用户名和密码 传输速度快)在~目录下输入:git clone 仓库地址算法(链接的结尾git是不需要的)cd 进入拉下来的项目文件git status 查看文件状态git add – 文件名 把有修改或.........
2021-10-06 16:54:51
334
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人