Loading

上一页 1 ··· 3 4 5 6 7 8 下一页
摘要: class Foo(): def __init__(self, x): print("this is class of Foo.") print("Foo类属性初始化") self.f = "foo" print(x) class Children(Foo): def __init__(self): 阅读全文
posted @ 2021-03-07 21:47 Guang'Jun 阅读(2434) 评论(0) 推荐(0) 编辑
摘要: np.mean(data, axis=0) 假如data为2维数组,形如(3, 4),此时axis= 0的操作其实等价为 在轴0处求平均,然后执行np.squeeze操作 图形解释: data = np.arange(12).reshape(3, 4) mean = np.mean(data, ax 阅读全文
posted @ 2021-03-06 16:26 Guang'Jun 阅读(497) 评论(0) 推荐(0) 编辑
摘要: 将一个文件夹变成了一个包 可以通过文件夹名.函数调用__init__.py里的函数 例如: -文件夹(net) -py文件(__init__.py) -py文件(main.py) 文件存储格式如上所示 __init__.py def get(): return 0 main.py from net 阅读全文
posted @ 2021-03-04 21:33 Guang'Jun 阅读(112) 评论(0) 推荐(0) 编辑
摘要: nn.Sequential用法 将多个模块进行封装 layer = nn.Sequential(nn.Conv2d(in_channels=128, out_channels=64,kernel_size) nn.Sequential内部实现了forward功能,可以直接调用 例如: x = tor 阅读全文
posted @ 2021-03-04 19:45 Guang'Jun 阅读(2352) 评论(0) 推荐(1) 编辑
摘要: 普通字典(dict) 遍历字典,返回数据,和定义字典时的字段顺序,不一致。 按顺序插入,遍历时,不顺序返回。 有序字典(collections.OrderedDict) 遍历字典,返回数据,和定义字典时数据顺序,一致。 按顺序插入,遍历时,按顺序返回。 注:python3.6以后版本无区别!!!!! 阅读全文
posted @ 2021-03-04 19:01 Guang'Jun 阅读(108) 评论(0) 推荐(0) 编辑
摘要: conda create --name python2 python=2.7 ##创建一个新的python环境,python版本为2.7,环境名称为python2 conda info -e ##显示已创建的环境,会列出所有的环境名和对应路径 conda activate python2 ##切换到 阅读全文
posted @ 2021-01-22 21:14 Guang'Jun 阅读(194) 评论(0) 推荐(0) 编辑
摘要: 停止进程:ctrl+z 查看停止的进程:jobs 关闭停止的进程: kill % <job ID> 阅读全文
posted @ 2021-01-21 12:21 Guang'Jun 阅读(285) 评论(0) 推荐(0) 编辑
摘要: 启动新会话:tmux [new -s 会话名] 列出所有会话:tmux ls 恢复会话:tmux at [-t 会话名] 关闭会话:tmux kill-session -t 会话名 更多参考: http://louiszhai.github.io/2017/09/30/tmux/ https://g 阅读全文
posted @ 2021-01-19 19:30 Guang'Jun 阅读(136) 评论(0) 推荐(0) 编辑
摘要: size计算矩阵中所有元素的个数; .shape返回维度值,返回一个元组 len()可以想象成数据长度/条数,即数据的行数 输入: a = np.array([[1, 2, 3, 4], [1, 2, 3, 4]]) print(len(a)) print(a.size) print(a.shape 阅读全文
posted @ 2021-01-19 15:54 Guang'Jun 阅读(1606) 评论(0) 推荐(0) 编辑
摘要: ** OSError: [WinError 126] 找不到指定的模块 ** 原因:This is most probably because you are using a CUDA variant of PyTorch on a system that doesn’t have GPU driv 阅读全文
posted @ 2021-01-14 16:19 Guang'Jun 阅读(83) 评论(0) 推荐(0) 编辑
上一页 1 ··· 3 4 5 6 7 8 下一页