Loading

摘要: 举例说明: 1. 对于列表,字典的解包 # *取列表,元组元素 ls = [1, 2, 3, 4] print(*ls) # **取字典值 dic = {"key1": 1, "key2": 2} print('{key1}, {key2}'.format(**dic)) [注意]:使用**解包时必 阅读全文
posted @ 2021-05-26 10:37 Guang'Jun 阅读(128) 评论(0) 推荐(0) 编辑
摘要: 1. 随机选择 使用random包 从列表里随机选出一个元素 from random import choice ls = [1, 2, 3, 4] print(choice(ls)) 2. 随机抽样 从列表里随机抽出出一组元素,不放回抽样 import random ls = [1, 2, 3, 阅读全文
posted @ 2021-05-25 12:41 Guang'Jun 阅读(134) 评论(0) 推荐(0) 编辑
摘要: 原文链接:https://www.runoob.com/python/att-string-format.html 阅读全文
posted @ 2021-05-15 13:30 Guang'Jun 阅读(35) 评论(0) 推荐(0) 编辑
摘要: 1..data() 将变量(Variable)变为tensor,将requires_grad设置为Flase a = torch.tensor([1.0], requires_grad=True) b = a.data print(b, b.requires_grad) ## 输出为: tensor 阅读全文
posted @ 2021-05-15 11:39 Guang'Jun 阅读(1005) 评论(0) 推荐(0) 编辑
摘要: ![image](https://img2020.cnblogs.com/blog/2199011/202105/2199011-20210515111855809-369266290.png) 阅读全文
posted @ 2021-05-15 11:19 Guang'Jun 阅读(19) 评论(0) 推荐(0) 编辑
摘要: 解决方法 angle = torch.where(torch.isnan(angle), torch.full_like(angle, 0), angle) print(torch.any(torch.isnan(angle))) torch.where(condition, x, y) 参数1;判 阅读全文
posted @ 2021-05-14 23:07 Guang'Jun 阅读(1580) 评论(0) 推荐(0) 编辑
摘要: ####1. BN层 torch.nn.BatchNorm1d(num_features, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True) 输入:\((N,C) \ or \ (N, C, L)\), $\ C$对应nu 阅读全文
posted @ 2021-05-13 19:51 Guang'Jun 阅读(340) 评论(0) 推荐(0) 编辑
摘要: 一、 函数解释 clone() 返回一个新的tensor,这个tensor与原始tensor的数据不共享一个内存(也就是说, 两者不是同一个数据,修改一个另一个不会变)。 requires_grad属性与原始tensor相同,若requires_grad=True,计算梯度,但不会保留梯度,梯度会与 阅读全文
posted @ 2021-05-01 00:20 Guang'Jun 阅读(1381) 评论(0) 推荐(0) 编辑
摘要: 解决方法: find 源文件路径 -type f -name '*.jpg' -exec mv {} 目标路径 \; 例子: find /data/jun/test2/st-gcn/data/ntu_data/skeleton+D0-30000/ -type f -name '*.skeleton' 阅读全文
posted @ 2021-04-30 23:05 Guang'Jun 阅读(204) 评论(0) 推荐(0) 编辑
摘要: 当子类与父类存在相同的函数名时,子类的函数就会重写父类的函数。 如果还是想用父类的函数,可以通过super函数强制调用父类函数。但是当子类与父类存在相同的函数名时,子类的函数仍会重写父类的函数。 验证结论1: class A(): def __init__(self): pass def print 阅读全文
posted @ 2021-04-29 01:35 Guang'Jun 阅读(115) 评论(0) 推荐(1) 编辑