小行星

热爱平淡,向往未知


  • 首页

  • 分类

  • 归档

  • 关于

  • 阅读排行

  • 搜索

git常用快捷键

发表于 2018-08-Wed | 阅读次数:

ga = git add
gcmsg = git commit -m
ggpush = git push origin master

load save

发表于 2018-08-Wed | 分类于 长文 | 阅读次数:

在环境迁移的时候, load和save 经常会出现问题,
这个时候使用latin编码就行

1
2
with open(mshelffile, 'rb') as f:
d = pickle.load(f, encoding='latin1')

py2 到 py3

发表于 2018-08-Wed | 阅读次数:
1
find . -name \*.pyc -delete

sys executable

发表于 2018-08-Wed | 阅读次数:
1
2
import sys
sys.executable

jupyter python位置

发表于 2018-08-Wed | 阅读次数:
1
Installed kernelspec env3.6 in /home/yinghong/.local/share/jupyter/kernels/env3.6

未命名

发表于 2018-07-Mon | 阅读次数:

title: conv1d使用
date: 2018-07-30 21:21:34

tags:

1
2
3
4
>>> filters = torch.randn(33, 16, 3)
>>> inputs = torch.randn(20, 16, 50)
# 16是通道数
>>> F.conv1d(inputs, filters)

未命名

发表于 2018-07-Mon | 阅读次数:

title: pytorch 随机数设置初始值
date: 2018-07-30 13:00:27

tags:

1
2
3
4
5
use_cuda = torch.cuda.is_available() and not args.no_cuda
device = torch.device('cuda' if use_cuda else 'cpu')
torch.manual_seed(args.seed)
if use_cuda:
torch.cuda.manual_seed(args.seed)

未命名

发表于 2018-07-Sun | 阅读次数:

title: pytorch 0.4迁移
date: 2018-07-29 15:11:09

tags:

type()

1
2
3
本来是 type()
现在是 isinstance(x, torch.DoubleTensor),
x.type()

Tensor(1, requires_grad=True)

1
2
3
4
5
w = torch.ones(1, requires_grad=True) 
或者是
w = w.requires_grad_()
total = w + z
total.backward()

.data 和 .detach()使用

推荐使用.detach()

0.3.0里面sum区别

tensor.sum()would return a Python number, butvariable.sum()would return a vector of size(1,).

弃用volatile, 使用torch.no_grad()

1
2
3
4
5
with torch.no_grad():
y = x * 2

with torch.set_grad_enable(is_train):
y = x * 2

![](https://ws1.sinaimg.cn/large/006tKfTcly1ftrmk9u4xdj31au14awlt.jpg)

mac打开excel乱码

发表于 2018-07-Sat | 阅读次数:

python format reverse

发表于 2018-07-Fri | 阅读次数:
1
2
3
4
5
6
7
8
9
10
11
>>> import parse
>>> format_string = 'PN-{:0>9}'
>>> id = 123
>>> pn = format_string.format(id)
>>> pn
'PN-000000123'
>>> parsed = parse.parse(format_string, pn)
>>> parsed
<Result ('123',) {}>
>>> parsed[0]
'123'
1…232425…59
fangyh

fangyh

最爱的是那苍穹之外的浩渺宇宙

588 日志
4 分类
66 标签
© 2020 fangyh
由 Hexo 强力驱动
|
主题 — NexT.Mist v5.1.3
|本站总访问量次