python填坑记录

对于一个可迭代的(iterable)/可遍历的对象(如列表、字符串),enumerate将其组成一个索引序列,利用它可以同时获得索引和值
list1 = [“这”, “是”, “一个”, “测试”]
for index, item in enumerate(list1):
print index, item
0 这
1 是
2 一个
3 测试
str.strip的作用是去掉字符串首尾的空格
5e-4相当于5乘以10的-4次
@rishabhiitbhu so fold=0 means fold number 0? Could you please explain how does it work? I am new to this. So fold=0 means we training on first 20% of data? Thanks again, sorry for silly questions.
fold=0是什么意思?
Yup, fold=0, total_folds=5, is passed to provider which uses sklearn’s StratifiedKFold class to divide the data in 5 folds, takes four folds in training data and 1 fold for validation i.e., training: 80% validation: 20%. When you have such doubts just run the code, use some print functions, see what’s going in what’s coming out, matrix shapes etc, that’s how I learn too 😃
在这里插入图片描述
为什么Dataset指向data,因为Dataset实现了getitem方法
对于DataLoader来说,既没有指定batch_sampler也没有指定sampler,则使用使用Pytorch已经实现好的BatchSampler,而sampler根据shuffle分为两种情况
optimizer.zero_grad()每一个epoch清零一次梯度
自己实现的Dataset类需要覆盖两个方法,一个是getitem另一个是len,这里的len将被sampler使用,用来产生indices,保证gettiem方法不越界
np.nanmean() 忽略nan项取平均
python csv操作教程 https://www.youtube.com/watch?v=s1XiCh-mGCA
如果pros的shape是[4, 512, 512]
for pro in pros:
那么 pro的shape是[512, 512]

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值