03 2021 档案
摘要:>>> ones=torch.ones((2,3,2)) >>> zeros=torch.zeros((2,3,2)) >>> torch.cat((ones,zeros),1) tensor([[[1., 1.], [1., 1.], [1., 1.], [0., 0.], [0., 0.], [
阅读全文
摘要:CommandNotFoundError: Your shell has not been properly configured to use 'conda activate'. To initialize your shell, run $ conda init <SHELL_NAME> Cur
阅读全文
摘要:Windows 在 git bash下使用 conda 命令 安装git 安装连接:http://git-scm.com/download/linux (LINUX) https://git-scm.com/downloads (Windows) 安装后配置环境变量 我的电脑右键 → 属性 → 左边
阅读全文
摘要:解决windows10中ssh(OpenSSH_for_Windows)远程登录时报Permissions for "xxx" are too open错误 解决windows10中ssh(OpenSSH_for_Windows)远程登录主机时,报 Permissions for "xxx" are
阅读全文
摘要:print(node_fp) (p:FP{dj: '3202.7586206896553', dw:'把',gfhy_id:'0F515150515400',gfnsrsbh:'100136633',hwmc:'*医疗仪器器械*DE\'BAKEY 无损伤血管钳 90度 ,45/93MM,225MM'
阅读全文
摘要:neo4j简单查询 https://neo4j.com/docs/cypher-refcard/current/ 参考卡片 neo4j存储格式 where子句 match (p:FP{kprq:'王佳慧'}) return p limit 10 match(p:Person{name:"王涛"})-
阅读全文
摘要:model.py注释 import random import numpy as np import torch import torch.nn as nn import torch.nn.functional as F import pdb class HomoAttLayer(nn.Module
阅读全文
摘要:使用netstat命令 netstat -apn 用grep匹配程序名,查看改程序是否运行 ps -aux | grep 程序名 用grep匹配端口号,查看该端口号是否被占用 netstat -anp | grep portno
阅读全文
摘要:ps ps -aux 查看所有进程,用grep进行筛选。 ps -aux | grep 程序名
阅读全文
摘要:新建会话tmux new -s my_session。 在 Tmux 窗口运行所需的程序。 按下快捷键Ctrl+b d将会话分离。 下次使用时,重新连接到会话tmux attach -t my_session。 重命名会话 $ tmux rename -t <old-name> <new-name>
阅读全文
摘要:jupyter notebook远程访问 在服务器上配置jupyter, 方便我们远程登录. 第一步:安装jupyter, pip3 install jupyter (此处使用的是python3) 第二步:生成配置文件jupyter notebook --generate-config 第三步:生成
阅读全文
摘要:pdb调试 jupyter notebook中使用 link pdb的使用方式一样,在需要的地方插入import pdb; pdb.set_trace()即可: ipdb在import引入后,添加set_trace()即可: from IPython.core.debugger import set
阅读全文
摘要:使用numpy保存 # 保存 import numpy as np a=np.array(a) np.save('a.npy',a) # 保存为.npy格式 # 读取 a=np.load('a.npy') a=a.tolist() 使用txt保存 filename = open('a.txt', '
阅读全文
摘要:numpy保存 if os.path.exists('map_mcdict.npy'): map_dict=np.load('map_mcdict.npy',allow_pickle=True).item() else: map_dict=dict() operation start operati
阅读全文
摘要:读写数据 pd.read_pickle(filepath) >>> fp5k=pd.read_pickle('Data/fp_5000.pickle') [1492433 rows x 16 columns] >>> fp5k.index Int64Index([ 0, 1, 2, 3, 4, 5,
阅读全文
摘要:安装nodejs https://nodejs.org/en/ 下载安装好,程序自动配置了环境变量。(配置环境变量其实就是把可执行文件所在的目录添加到系统可查到的变量中) 使用vscode的terminal 安装live-server 配置好vscode,使其具备python环境。(terminal
阅读全文
摘要:zip函数 >>>a = [1,2,3] >>> b = [4,5,6] >>> c = [4,5,6,7,8] >>> zipped = zip(a,b) # 打包为元组的列表 [(1, 4), (2, 5), (3, 6)] >>> zip(a,c) # 元素个数与最短的列表一致 [(1, 4)
阅读全文
摘要:>>> p tensor([[0., 0., 0., 0., 0.], [0., 0., 0., 0., 0.], [0., 0., 0., 0., 0.], [0., 0., 0., 0., 0.]]) >>> torch.stack([p,p],dim=0) tensor([[[0., 0.,
阅读全文
摘要:csdn 解决办法 在报错哪一行前面加上下面两行:释放无关的内存 if hasattr(torch.cuda, 'empty_cache'): torch.cuda.empty_cache()
阅读全文
摘要:考察异或运算。 python版本: 按位或:^ 关键点: 字符只要成对出现,则这两个数两两配对,每一位上的1、0就能消去,1^1=0。 因此这两对一样的数的异或结果为0,因此记录num清零。 最终num即为唯一一个数字与0的异或,不变。即为原来的数。 任何数与0的异或为原来的数。
阅读全文
摘要:数据创建 randint 创建随机整数array。 np.random.randint(10,size=(2,3)) randint(low, high=None, size=None, dtype='l') low为必选参数: 若有low与high,则返回两者之间的数据。[low, high)。
阅读全文
摘要:认识defaultdict: 当我使用普通的字典时,用法一般是dict=,添加元素的只需要dict[element] =value即,调用的时候也是如此,dict[element] = xxx,但前提是element字典里,如果不在字典里就会报错. 这时defaultdict就能排上用场了,defa
阅读全文
摘要:写脚本并添加权限 cat tim.sh: #! /bin/bash echo $(date +%s) >> /home/zhangzai/Exp/result.txt 添加权限: chmod 777 test.sh crontab -e添加 * * * * * bash /home/zhangzai
阅读全文
摘要:4.1 模型构造 让我们回顾一下在3.10节(多层感知机的简洁实现)中含单隐藏层的多层感知机的实现方法。我们首先构造Sequential实例,然后依次添加两个全连接层。其中第一层的输出大小为256,即隐藏层单元个数是256;第二层的输出大小为10,即输出层单元个数是10。我们在上一章的其他节中也使用
阅读全文
摘要:NN conv1d batchnorm1d CLASStorch.nn.``BatchNorm1d(num_features, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)[SOURCE] Applies Batch
阅读全文
摘要:数据创建 torch.arange(1, 16) torch.eyes(n) 对角线为1的矩阵,若n==m。 torch.eye(n, m=None, *, out=None, dtype=None, layout=torch.strided, device=None, requires_grad=
阅读全文
摘要:由于最近要使用Python操作MySQL数据库,所以要安装MySQLdb包。 手动安装 先去下载mysql-Python。(搜索Mysqlclient下面的,对应版本下载即可) 下载完成之后进入打开cmd,进入到下载包放入的Anaconda目录 cd C:\Users\MiMi Tian\Anaco
阅读全文
摘要:Data We provide 4 HIN benchmark datasets: DBLP, Yelp, Freebase, and PubMed. Users can retrieve them here and unzip the downloaded file to the current
阅读全文
摘要:爬虫解析库:XPath dateTime = inner_html.xpath('//span[@class="laiyuan laiyuan1"]/span[@id="data"]/text()') 属性选择@,class、id等等。 子孙结点用//,子节点用/。 /text()转换文本。//te
阅读全文
摘要:读文件 with open('raw.txt','r') as file: for line in file.readlines(): city=line.strip().split()[1] 写文件 with open(args.output, 'w') as file: file.write(f
阅读全文