小行星

热爱平淡,向往未知


  • 首页

  • 分类

  • 归档

  • 关于

  • 阅读排行

  • 搜索

ll | wc -l 会多计算一行

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

sublime快捷键冲突

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

修改配置

1
2
3
4
[
{ "keys": ["super+shift+u"], "command": "split_selection_into_lines" },

]

pytorch黑科技

发表于 2018-07-Sat | 阅读次数:
1
2
3
import torch
# after import torch, add this
torch.backends.cudnn.benchmark=True

保存模型

1
2
3
4
5
6
torch.save(the_model.state_dict(), PATH)
the_model = TheModelClass(*args, **kwargs)
the_model.load_state_dict(torch.load(PATH))

torch.save(the_model, PATH)
the_model = torch.load(PATH)

Variable to tensor

1
2
3
4
# for gpu
t.data.cpu().numpy()
# for cpu
t.data.numpy()

类型转换

1
2
a = a.type('torch.DoubleTensor') # for converting to double tensor (cpu)
a.double()

pytorch版本

1
2
import torch
print(torch.__version__)

python format使用

发表于 2018-07-Sat | 阅读次数:
1
2
3
4
5
6
7
8
>>>"{} {}".format("hello", "world")    # 不设置指定位置,按默认顺序
'hello world'

>>> "{0} {1}".format("hello", "world") # 设置指定位置
'hello world'

>>> "{1} {0} {1}".format("hello", "world") # 设置指定位置
'world hello world'

pycharm bug

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

无法同步服务器代码, 下载安装最新版pycharm

python import理解

发表于 2018-07-Thu | 阅读次数:
  1. 只能通过 包名.模块名来import具体函数
  2. from .bbb import a当你导入一个包的时候,实际上是导入了这个包的init.py的文件,所以,如果你在init里面写入了其他的import功能,就等于是在初始化的时候帮忙导入了其他东西

https://blog.csdn.net/GeekLeee/article/details/52505233

h5py文件字符串

发表于 2018-07-Thu | 阅读次数:
1
2
img0 = img0.astype(np.uint8)
img0.tostring()

jupyter argparse

发表于 2018-07-Thu | 阅读次数:
1
2
3
self.opt = self.parser.parse_args("-demo "
"./images/h36m_1214.png -loadModel "
"./models/hgreg-3d.pth".split())

输出py位置

发表于 2018-07-Thu | 阅读次数:
1
2
3
import sys

print(sys.executable)

python2.7安装jupyter

发表于 2018-07-Thu | 阅读次数:
1
2
pip install IPython==5.0 --user
pip install jupyter --user
1…282930…59
fangyh

fangyh

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

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