-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
675 lines (457 loc) · 42.2 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>ChongYang</title>
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<meta property="og:type" content="website">
<meta property="og:title" content="ChongYang">
<meta property="og:url" content="http://yoursite.com/index.html">
<meta property="og:site_name" content="ChongYang">
<meta property="og:locale" content="en">
<meta name="twitter:card" content="summary">
<link rel="alternate" href="/atom.xml" title="ChongYang" type="application/atom+xml">
<link rel="icon" href="/favicon.png">
<link href="//fonts.googleapis.com/css?family=Source+Code+Pro" rel="stylesheet" type="text/css">
<link rel="stylesheet" href="/css/style.css">
</head>
<body>
<div id="container">
<div id="wrap">
<header id="header">
<div id="banner"></div>
<div id="header-outer" class="outer">
<div id="header-title" class="inner">
<h1 id="logo-wrap">
<a href="/" id="logo">ChongYang</a>
</h1>
</div>
<div id="header-inner" class="inner">
<nav id="main-nav">
<a id="main-nav-toggle" class="nav-icon"></a>
<a class="main-nav-link" href="/">Home</a>
<a class="main-nav-link" href="/archives">Archives</a>
</nav>
<nav id="sub-nav">
<a id="nav-rss-link" class="nav-icon" href="/atom.xml" title="RSS Feed"></a>
<a id="nav-search-btn" class="nav-icon" title="Search"></a>
</nav>
<div id="search-form-wrap">
<form action="//google.com/search" method="get" accept-charset="UTF-8" class="search-form"><input type="search" name="q" class="search-form-input" placeholder="Search"><button type="submit" class="search-form-submit"></button><input type="hidden" name="sitesearch" value="http://yoursite.com"></form>
</div>
</div>
</div>
</header>
<div class="outer">
<section id="main">
<article id="post-2020.5.6 一些感想和疑惑" class="article article-type-post" itemscope itemprop="blogPost">
<div class="article-meta">
<a href="/2020/05/06/2020.5.6%20%E4%B8%80%E4%BA%9B%E6%84%9F%E6%83%B3%E5%92%8C%E7%96%91%E6%83%91/" class="article-date">
<time datetime="2020-05-05T16:16:30.000Z" itemprop="datePublished">2020-05-06</time>
</a>
</div>
<div class="article-inner">
<header class="article-header">
<h1 itemprop="name">
<a class="article-title" href="/2020/05/06/2020.5.6%20%E4%B8%80%E4%BA%9B%E6%84%9F%E6%83%B3%E5%92%8C%E7%96%91%E6%83%91/">困惑</a>
</h1>
</header>
<div class="article-entry" itemprop="articleBody">
<h2 id="记录近日心中所想和困惑"><a href="#记录近日心中所想和困惑" class="headerlink" title="记录近日心中所想和困惑"></a>记录近日心中所想和困惑</h2><p>最近我经常感到迷茫和烦躁,烦躁是因为我觉得迷茫,我不知道将来会去从事什么工作<br>我不知道我真正喜欢的工作是什么.</p>
<ul>
<li>我可以从工作中得到快乐吗?</li>
<li>我可以实现自己的人生价值吗?</li>
<li>我工作的目的是什么?<br>这些问题沉在我的脑中,就像淤泥一样,只要一搅动,整个脑子都乱了。</li>
</ul>
<hr>
<p>疫情期间,起初还会坚持每日的学习量,可是一旦这些深层次的问题在拷问我时,我就会<br>陷入质疑的漩涡。学习语音识别,我以后会从事这个行业吗?学习ROS,我以后会去从事智能机器人吗?<br>我已经考入了武汉华为班,今年应该可以去实习。这种稳定的感觉让我不断地产生幻觉,<br>反正现在学的以后也用不到,我可以不用去学习啊,不用那么上心。</p>
<p>于是乎,我越来越懒惰,沉迷于游戏,只要有人拉我,我就会忍不住去玩游戏。就在刚刚我再次把<br>它们卸载了,并且很严肃地告诉自己(不可以再沉迷游戏,玩物丧志了)。当然,不玩游戏也不现实<br>等我再次有了自控能力,知道自己该为什么而奋斗时,也就是说游戏只是附加娱乐项时,我才有<br>资格再次下载。</p>
<p><strong>立帖为证</strong></p>
<hr>
<p>今天连续看了三个B站上很火的视频,分别是后浪,前浪,非浪,看完后,感触颇多,作为一个23岁的老<br>青年了,感触颇多。鸡汤总是告诉我们,我们没有办法决定自己的出身,但我们有能力决定自己的命运。<br>随着时间的增长,我越发对自己能够掌握自己的命运感到质疑,我的世界观成长的很慢,直到大三那年,我<br>才真正思考自己的未来,思考将来该干什么,我如何获得快乐。我本科在三峡大学就读,读大学之前我一直<br>认为大学只要是一本就行了,这个思想观念想来,主要来源于父母和身边的环境。我读大学之前从来不知道,<br>原来一本!=好学校 学习好!=聪明 一本!=好工作。 我从来不知道自己需要的是什么。我很悔恨,悔恨自己<br>浪费了自己的能力,悔恨自己高中为什么吊儿郎当,明明可以考个更好的大学,却经常通宵打游戏,经常上课<br>睡觉,始终没有真正意识到(父母和老师说过无数遍的话)读书是给自己读的。</p>
<p>于是乎,我开始思考如何改变,想来想去 只有考研这条路适合我。我一没有关系,二专业能力也不出众,只有<br>靠考学历来“出人头地”。那么第一个问题就是,考哪个学校呢? 我害怕失败,因为我没有资格失败,我的家庭<br>经济能力承担不了我考研失败,而且我精神上也顶不住失败时来自各方各面的压力,我纠结了许久,只能退而<br>选211学校。好笑的是,很多人来劝我不要考,他们说“那个学校很黑呀”“就算能考上,我也不选”“…” 我没有<br>搭理,因为我已经清楚,路只有自己一个人走。</p>
<p>考研的那一段时间真的很美好,充实而且快乐,因为我只有一个目标,我奋斗有了方向,我知道自己每天醒来<br>第一件事该干什么,我知道我该学什么。我也有着前所未有的自信,我相信我一定能行。</p>
<p>考研结束后,我初试考了第一名,而且一直是强项的数学也总算发挥好了,一血当年高考失败的耻辱。这时候,<br>我依旧充满了自信,我觉得未来可期。很多同学过来跟我说,为什么当初不选择985呢,就这个成绩,稳稳的啊。</p>
<p>我心里苦笑:很多选择不是靠能力来决定的,如果我可以承担更高的风险,我当然会选择985.而且我也有相当的自信,<br>但是我害怕啊,失败是我承受不起的。我的经济条件不够好,我一旦失败,错过秋招,只能被普通的公司选择,得过且过。<br>也可以说,我还是不够100%自信。其实,经历过考研才知道,里面也是有很多操作空间的,相比较高考而言,它相对<br>不是那么公平,也有人初试靠关系,或者靠官网的”xx计划“名额来低分录取。复试也会有水分,本校当然会更加照顾,<br>题目也会相应泄露一点,这都是很正常的,我早就明白,所以把这些风险也考虑在内,综合做出选择。</p>
<p>到了今天,研一下学期了,上学期过的很满,没有时间瞎想,下学期因为疫情和课少了很多,越来越玩物丧志,越来越<br>胡思乱想</p>
<hr>
<p>再回到看完视频后的感触,后浪传达一种思想,在这个让前辈”羡慕”的时代,我们没有办法决定出生,但我们有办法<br>决定自己的命运,我们有更多的选择权,我们可以去奋斗,有无限的可能性。</p>
<p>我只想哈哈一笑,对,你说这话错了吗?看起来没毛病啊,但是,只要奋斗,真的有无限的可能性吗?我不这么认为<br>一个富裕的家庭,受过良好教育的父母,他的孩子的生活就像开了挂一样,他们比我们更早的清楚读书的重要性,他们比<br>我们更有承担失败风险的能力,他们可以输了再来,而我没有。他们不必工作后像条狗一样,拼死拼活只为还房贷车贷,<br>他们更有选择喜欢的工作的权力,而我没有,只能选择更高薪水的工作。 </p>
<p>我们的确可以掌握自己的未来,但我们必须承认一个问题,我们所处的时代已经在不断抹杀这种可能性。富人可以接收更好<br>的教育资源,有更好的教育理念,他们有更多的资源,可以让孩子走近道,可以绕过”公平“的规则,甚至逾越”法律“。穷人们<br>不断地被挤压,还要被驱动着产生更多的韭菜。我们的上限,已经比他们的下限更差,这才是最悲哀,最真实的现实。</p>
<p>随着社会阶层不断撕裂,社会矛盾只会越来越突出,那么我这种穷人,又有一定的思想,感到痛苦绝望,该怎么办呢?</p>
<hr>
<p>反思:我的确,可以找一个相对于很多普通人来说不错的工作。但是我依然摆脱不了,被房子车子教育压垮多年的命运。那么我如何去<br>摆正心态,让我以更好的心态去接收这种剥削呢? 如何以一种更好的心态来学习工作呢?</p>
<p><strong>看哲学/文学/史学</strong><br>看完某法律老师讲解为什么读书的视频,我心里的疑问总算消解了不少<br>书,是真的可以为自己排忧解惑的,读书的目的分为俩种:1.功利性读书,提升工作技能,(总之为了赚钱而读的书)<br>2.非功利性读书,读文学/史学/哲学 这些书籍可以慰藉心灵,让我更加清楚自己在这个世界是多么的渺小和无知,避免狂妄自大<br>我的世界观,目前还远远不够成熟,心理承受能力还远远不够强大,为了战胜更多未来的挫折,我真的很需要这些知识。</p>
<p>最近很想看大唐西域记,看完玄奘之路纪录片,我已经成为玄奘的一枚粉丝,他因为佛学理论的混乱而产生疑惑,<br>便凭着信仰克服重重困难,阅读无数佛学典故,传播佛学知识,实现自己的人生价值,成为一个传奇人物。我很想学习他的精神,<br>希望能够帮助我实现精神自由(我暂时没有任何信仰)</p>
<p><strong>穷人,真的很可怜,生活就像通关游戏里设置的地狱难度,经不起任何失败和挫折,还不断地被富人灌鸡汤,只要认真锻炼技术,<br>总有一天可以通关。 富人,真的很幸福,生活就像选择一款游戏一样,通不了关就换一款游戏,或者开一个外挂,选择新手难度,<br>他们过了关,还会被贴上努力、奋斗、榜样的标签,供穷人学习。 所以,拜托富人停止对穷人的嘲讽吧,很冷血</strong></p>
<p>读书真的很有意思,因为无知而读书,而读书让我们更加认识到自己的无知。</p>
</div>
<footer class="article-footer">
<a data-url="http://yoursite.com/2020/05/06/2020.5.6%20%E4%B8%80%E4%BA%9B%E6%84%9F%E6%83%B3%E5%92%8C%E7%96%91%E6%83%91/" data-id="ck9u6krp70002eguzf9gfedyd" class="article-share-link">Share</a>
</footer>
</div>
</article>
<article id="post-2020.2.13 配置XSHELL和WSL连接" class="article article-type-post" itemscope itemprop="blogPost">
<div class="article-meta">
<a href="/2020/02/13/2020.2.13%20%E9%85%8D%E7%BD%AEXSHELL%E5%92%8CWSL%E8%BF%9E%E6%8E%A5/" class="article-date">
<time datetime="2020-02-13T14:19:00.000Z" itemprop="datePublished">2020-02-13</time>
</a>
</div>
<div class="article-inner">
<header class="article-header">
<h1 itemprop="name">
<a class="article-title" href="/2020/02/13/2020.2.13%20%E9%85%8D%E7%BD%AEXSHELL%E5%92%8CWSL%E8%BF%9E%E6%8E%A5/">使用XSHELL连接WSL</a>
</h1>
</header>
<div class="article-entry" itemprop="articleBody">
<h1 id="问题描述"><a href="#问题描述" class="headerlink" title="问题描述"></a>问题描述</h1><font size=4>
如何使用xshell登陆win10上的子系统(ubuntu16.04)
<p>好处: xshell界面更友好,还可搭配xming软件,可以使用gedit等等..</p>
<ul>
<li><p>配置ubuntu16.04上的ssh服务</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line">sudo apt-get remove openssh-server # 自带的oepnssh-server不好用</span><br><span class="line">sudo apt-get install oepnssh-server # 重新安装</span><br><span class="line"></span><br><span class="line">sudo vim /etc/ssh/sshd_config(或者ssh_config)</span><br></pre></td></tr></table></figure>
<p><em>修改以下内容</em><br><em>ListenAddress 0.0.0.0</em> 监听所有端口</p>
<p><em>UsePrivilegeSeparation no</em> 这个我不清楚为什么,但是我参照一些博客修改成yes 出错了</p>
<p><em>PasswordAuthentication yes</em> 允许使用密码远程登陆,当然也可以用另一种方法使用公钥密钥对登陆</p>
<p><em>Port</em> 20002 注意,修改的端口不能和windows上的端口冲突了,我这里踩坑,找了一大半天问题出在哪</p>
<p><strong><em>例如查询windows上20002是否已经被占用了,windows上打开cmd,输入 netstat -ano | findstr “20002”</em></strong><br><strong><em>如果占用了,修改Port为另一个不冲突的值即可,记住这个值和使用XShell登陆的端口要对应</em></strong></p>
</li>
</ul>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">sudo service ssh --full-restart # 重新启动ssh服务</span><br></pre></td></tr></table></figure>
<ul>
<li>打开WSL和XSHELL,XSHELL新建连接</li>
</ul>
<p>主机输入 127.0.0.1 这个地址,是在WSL下使用ifconfig查询的,应该都是这个地址<br>端口输入 20002 对应sshd_config的Port值<br>用户名输入 WSL的用户名即可<br>此时 我的已经连接成功</p>
<p>主要踩坑,端口冲突,sshd_config内容不正确,还有问题建议参考下面的连接</p>
<p>问题解决链接:<a href="https://github.com/microsoft/WSL/issues/698" target="_blank" rel="noopener">使用XSHELL连接不上WSL</a></p>
<p>另一篇,如何在linux终端上使用图形化软件:<a href="https://blog.csdn.net/jxxiaohou/article/details/51586934" target="_blank" rel="noopener">Windows+XSHELL+XMING访问非桌面版linux</a></p>
<p>俩者结合下,终于可以愉快的使用ubuntu学习了,告别卡的要死的虚拟机!!</p>
</div>
<footer class="article-footer">
<a data-url="http://yoursite.com/2020/02/13/2020.2.13%20%E9%85%8D%E7%BD%AEXSHELL%E5%92%8CWSL%E8%BF%9E%E6%8E%A5/" data-id="ck9u6krpr0006eguz6h339f46" class="article-share-link">Share</a>
</footer>
</div>
</article>
<article id="post-2020.2.13 学习使用显卡训练" class="article article-type-post" itemscope itemprop="blogPost">
<div class="article-meta">
<a href="/2020/02/13/2020.2.13%20%E5%AD%A6%E4%B9%A0%E4%BD%BF%E7%94%A8%E6%98%BE%E5%8D%A1%E8%AE%AD%E7%BB%83/" class="article-date">
<time datetime="2020-02-13T08:17:00.000Z" itemprop="datePublished">2020-02-13</time>
</a>
</div>
<div class="article-inner">
<header class="article-header">
<h1 itemprop="name">
<a class="article-title" href="/2020/02/13/2020.2.13%20%E5%AD%A6%E4%B9%A0%E4%BD%BF%E7%94%A8%E6%98%BE%E5%8D%A1%E8%AE%AD%E7%BB%83/">使用nvidia显卡训练模型常用命令</a>
</h1>
</header>
<div class="article-entry" itemprop="articleBody">
<font size=4 >
<h2 id="关闭python程序,仍然占用显存"><a href="#关闭python程序,仍然占用显存" class="headerlink" title="关闭python程序,仍然占用显存"></a>关闭python程序,仍然占用显存</h2><ul>
<li>使用如下命令,查询当前运行的所有进程,当程序中途被强制停止的时候,<br>由于子进程的GPU显存并没有被释放掉,所以需要一个个kill掉<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">fuser -v /dev/nvidia*</span><br></pre></td></tr></table></figure></li>
<li>可以查看这个进程调用GPU的情况<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">pmap -d pid</span><br></pre></td></tr></table></figure></li>
<li>使用如下命令,强制关闭掉运行的进程。注意,不要误杀<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">kill -9 pid</span><br></pre></td></tr></table></figure>
</li>
</ul>
<h2 id="查询服务器下所有显卡运行的情况"><a href="#查询服务器下所有显卡运行的情况" class="headerlink" title="查询服务器下所有显卡运行的情况"></a>查询服务器下所有显卡运行的情况</h2><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">nvidia-smi</span><br></pre></td></tr></table></figure>
<p>里面包含有GPU显存运行情况,和GPU计算占用情况,类似于内存和CPU</p>
<h2 id="指定某张显卡-显卡1-来运行-x-py文件"><a href="#指定某张显卡-显卡1-来运行-x-py文件" class="headerlink" title="指定某张显卡(显卡1) 来运行 x.py文件"></a>指定某张显卡(显卡1) 来运行 x.py文件</h2><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">CUDA_VISIBLE_DEVICES=1 python x.py</span><br></pre></td></tr></table></figure>
<p>使用前 需要查看是否这张卡的显存充足,不足的话,是否能清除?</p>
</div>
<footer class="article-footer">
<a data-url="http://yoursite.com/2020/02/13/2020.2.13%20%E5%AD%A6%E4%B9%A0%E4%BD%BF%E7%94%A8%E6%98%BE%E5%8D%A1%E8%AE%AD%E7%BB%83/" data-id="ck9u6krpa0004eguz4jkc4xsx" class="article-share-link">Share</a>
</footer>
</div>
</article>
<article id="post-2020.2.13 linux文件命令" class="article article-type-post" itemscope itemprop="blogPost">
<div class="article-meta">
<a href="/2020/02/13/2020.2.13%20linux%E6%96%87%E4%BB%B6%E5%91%BD%E4%BB%A4/" class="article-date">
<time datetime="2020-02-12T16:00:00.000Z" itemprop="datePublished">2020-02-13</time>
</a>
</div>
<div class="article-inner">
<header class="article-header">
<h1 itemprop="name">
<a class="article-title" href="/2020/02/13/2020.2.13%20linux%E6%96%87%E4%BB%B6%E5%91%BD%E4%BB%A4/">linux命令-查看文件夹信息</a>
</h1>
</header>
<div class="article-entry" itemprop="articleBody">
<h1 id="查询文件夹信息"><a href="#查询文件夹信息" class="headerlink" title="查询文件夹信息"></a>查询文件夹信息</h1><ul>
<li><p>查看当前目录下所有文件的详细信息</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">ls -a</span><br></pre></td></tr></table></figure>
</li>
<li><p>查看当前目录下文件的个数(不包含目录)</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">ls -l | grep "^-" | wc -l</span><br></pre></td></tr></table></figure></li>
<li><p>查看当前目录下文件的个数(包含子目录)</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">ls - lR | grep "^-" | wc -l</span><br></pre></td></tr></table></figure></li>
<li><p>查看目录下文件夹(目录)的个数(包含子目录)</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">ls - lR | grep "^d" | wc -l</span><br></pre></td></tr></table></figure>
</li>
</ul>
<blockquote>
<p>命令解析</p>
</blockquote>
<ul>
<li><p>ls -l<br>长列表输出该目录下文件信息,这里的文件包含目录、链接、设备文件<br>,每一行对应一个文件或目录,ls -lR 列出所有文件 包含目录</p>
</li>
<li><p>grep “^-“<br>过滤,只保留一般文件,只保留目录,使用”^d”</p>
</li>
<li><p>wc -l<br>统计输出信息的行数,一行对应一个文件,所以就是文件的个数</p>
</li>
</ul>
<p><a href="http://noahsnail.com/2017/02/07/2017-02-07-Linux%E7%BB%9F%E8%AE%A1%E6%96%87%E4%BB%B6%E5%A4%B9%E4%B8%8B%E7%9A%84%E6%96%87%E4%BB%B6%E6%95%B0%E7%9B%AE/" target="_blank" rel="noopener">参考</a></p>
</div>
<footer class="article-footer">
<a data-url="http://yoursite.com/2020/02/13/2020.2.13%20linux%E6%96%87%E4%BB%B6%E5%91%BD%E4%BB%A4/" data-id="ck9u6krpb0005eguz4l441zw8" class="article-share-link">Share</a>
</footer>
</div>
</article>
<article id="post-2019.11.29 Global关键字" class="article article-type-post" itemscope itemprop="blogPost">
<div class="article-meta">
<a href="/2019/11/29/2019.11.29%20Global%E5%85%B3%E9%94%AE%E5%AD%97/" class="article-date">
<time datetime="2019-11-29T07:39:57.064Z" itemprop="datePublished">2019-11-29</time>
</a>
</div>
<div class="article-inner">
<header class="article-header">
<h1 itemprop="name">
<a class="article-title" href="/2019/11/29/2019.11.29%20Global%E5%85%B3%E9%94%AE%E5%AD%97/">Global关键字</a>
</h1>
</header>
<div class="article-entry" itemprop="articleBody">
<font size=2>
<p>enjoy learning , enjoy life.</p>
<font size=4>
python不同于c语言,c语言根据变量声明时所在的作用域,可以判断变量的属性是局部变量
<p>例如:</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br></pre></td><td class="code"><pre><span class="line">int a = 3;</span><br><span class="line">void test()</span><br><span class="line">{</span><br><span class="line"> int a = 4;</span><br><span class="line"> a = 5;// 修改的是局部变量</span><br><span class="line">}</span><br><span class="line">void test2()</span><br><span class="line">{</span><br><span class="line"> a = 6;//修改的是全局变量</span><br><span class="line">}</span><br></pre></td></tr></table></figure>
<p>在python中变量无需定义,可以直接使用,因此就得需要global关键字来指出是修改全局变量 还是局部变量</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br></pre></td><td class="code"><pre><span class="line">a = 3</span><br><span class="line">def change():</span><br><span class="line"> a = 4</span><br><span class="line"> print(a) # 4</span><br><span class="line">change()</span><br><span class="line">print(a) # 3 可以看到结果并没有被change()改变</span><br></pre></td></tr></table></figure>
<p>加上global关键字</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br></pre></td><td class="code"><pre><span class="line">a = 3</span><br><span class="line">def change():</span><br><span class="line"> global a</span><br><span class="line"> a = 4</span><br><span class="line">change()</span><br><span class="line">print(a) # 4 可以看到结果被修改了</span><br></pre></td></tr></table></figure>
<p>原理,加上global引用的就是外面的全局变量a,没有加global就是里面的局部变量a,即使名字看起来一样,实际在运行的时候加了变量作用域,名称是不一样的。</p>
<p>这俩周事是真的多呀,还要抽点时间去召唤师峡谷,我太难了。</p>
</div>
<footer class="article-footer">
<a data-url="http://yoursite.com/2019/11/29/2019.11.29%20Global%E5%85%B3%E9%94%AE%E5%AD%97/" data-id="ck9u6krp80003eguzgnyjet9u" class="article-share-link">Share</a>
</footer>
</div>
</article>
<article id="post-2019.11.22 学习lambda语法" class="article article-type-post" itemscope itemprop="blogPost">
<div class="article-meta">
<a href="/2019/11/22/2019.11.22%20%E5%AD%A6%E4%B9%A0lambda%E8%AF%AD%E6%B3%95/" class="article-date">
<time datetime="2019-11-22T09:08:00.000Z" itemprop="datePublished">2019-11-22</time>
</a>
</div>
<div class="article-inner">
<header class="article-header">
<h1 itemprop="name">
<a class="article-title" href="/2019/11/22/2019.11.22%20%E5%AD%A6%E4%B9%A0lambda%E8%AF%AD%E6%B3%95/">如何使用lambda(python)</a>
</h1>
</header>
<div class="article-entry" itemprop="articleBody">
<font size=2 >
<p>enjoy learning , enjoy life. </p>
<font size=4>
lambda匿名函数并不是python所独有的特点,很多其他语言也有这个特性,匿名函数有之所以被设计出来,我想最重要的原因就是编写简单的函数时不必再花时间取名字。
<p>lambda函数最常应用的地方就是作为一个函数对象,被其他函数调用,对列表中的大量元素集中处理。</p>
<p>lambda函数语法 []代表可有可无</p>
<blockquote>
<p>lambda [param1 [,param2,param3]]: expression</p>
</blockquote>
<font color="red">
<p>lambda函数有以下几个特性</p>
<ul>
<li>如果lambda表达式返回的函数对象没有对象接收,会被立即丢弃</li>
<li>lambda 在:后面 只能有一个表达式,可以使用if else,需要符合特定语法</li>
<li>lambda 不能被别的程序调用</li>
</ul>
<font color="black">
<h2 id="普通用法"><a href="#普通用法" class="headerlink" title="普通用法"></a>普通用法</h2><p><strong>demo1 单个参数</strong></p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">>>> func = lambda x : x ** 2</span><br><span class="line">>>> print(func(2))</span><br><span class="line">4</span><br></pre></td></tr></table></figure>
<p><strong>demo2 多个参数</strong></p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">>>> fuc = lambda x, y:x * y</span><br><span class="line">>>> print(fun(1,2))</span><br><span class="line">2</span><br></pre></td></tr></table></figure>
<p><strong>demo3 类似于函数,也可以使用默认参数</strong></p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line">>>> add2 = lambda x, y=2: x + y</span><br><span class="line">>>> print(add2(1))</span><br><span class="line">3</span><br><span class="line">>>> print(add2(1,3))</span><br><span class="line">4</span><br></pre></td></tr></table></figure>
<h2 id="进一步使用"><a href="#进一步使用" class="headerlink" title="进一步使用"></a>进一步使用</h2><p><strong>demo4 lambda表达式可以作为函数对象被存放在列表中</strong></p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br></pre></td><td class="code"><pre><span class="line">>>>func_list = [lamda x : x ** 2, lambda x : x ** 3]</span><br><span class="line">>>>print(func_list[0](2)) </span><br><span class="line">4</span><br><span class="line">>>>print(func_list[1](3))</span><br><span class="line">27</span><br><span class="line">>>>print(func_list)</span><br><span class="line">[<function <lambda> at 0x00000202524FDC18>, <function <lambda> at 0x000002025264B288>]</span><br></pre></td></tr></table></figure>
<p><strong>demo5 带if else条件的lambda表达式</strong></p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">convert = lambda text : int(text) if text.isdigit() else text.lower()</span><br><span class="line">textList = ["heLLO","LOl","23"]</span><br><span class="line">print([convert(c) for c in textList]) # 输出结果["hello","lol",23]</span><br></pre></td></tr></table></figure>
<p>lambda text: int(text) if text.isdigit() else text.lower()<br>这段代码,将传入的text进行判断,如果是数字转化为数字,这里可以看上面的结果是23,而不是”23”,如果不是数字,则全部转化为小写。</p>
<p>这里的lambad使用if else 条件时必须满足以下语法<br>lambda x : 语句1 if 条件1 [else 语句2 if 条件2][else 语句x if条件x] else 最后的语句</p>
<p>实际上是这样的语法表示<br>lambda x : 语句1 if 条件1 else (语句2 if 条件2 else 语句3)</p>
<p>总之 if 和 else 的数量必须相等</p>
<p><strong>demo6 带多个if 和 else的lambda表达式</strong></p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">func = lambda x : 1 if x=="first" else 2 if x=="second" else 3 if x=="third" else 4</span><br><span class="line">print(func("first")) # 1</span><br></pre></td></tr></table></figure>
<h2 id="lambda进阶使用"><a href="#lambda进阶使用" class="headerlink" title="lambda进阶使用"></a>lambda进阶使用</h2><p>写这篇博客的原因就是在学习百度那篇resCNN论文github项目时,发现Lambda层被广泛使用在神经网络结构中.特来学习lambda的语法,以及如何使用。</p>
<p><em>问题驱动学习</em></p>
<h2 id="参考的博客,以及提到的项目链接"><a href="#参考的博客,以及提到的项目链接" class="headerlink" title="参考的博客,以及提到的项目链接"></a>参考的博客,以及提到的项目链接</h2><p><a href="https://github.com/Walleclipse/Deep_Speaker-speaker_recognition_system" target="_blank" rel="noopener" title="Github:DeepSpeaker">百度resCNN项目</a></p>
<p><a href="https://www.cnblogs.com/cymwill/p/8758970.html" target="_blank" rel="noopener" title="Lambda Learning">lambda参考博客 作者:chen狗蛋儿</a></p>
</div>
<footer class="article-footer">
<a data-url="http://yoursite.com/2019/11/22/2019.11.22%20%E5%AD%A6%E4%B9%A0lambda%E8%AF%AD%E6%B3%95/" data-id="ck9u6krp60001eguzgrx32hba" class="article-share-link">Share</a>
</footer>
</div>
</article>
<article id="post-2019.11.9 初学markdown语法" class="article article-type-post" itemscope itemprop="blogPost">
<div class="article-meta">
<a href="/2019/11/09/2019.11.9%20%E5%88%9D%E5%AD%A6markdown%E8%AF%AD%E6%B3%95/" class="article-date">
<time datetime="2019-11-09T13:23:38.000Z" itemprop="datePublished">2019-11-09</time>
</a>
</div>
<div class="article-inner">
<header class="article-header">
<h1 itemprop="name">
<a class="article-title" href="/2019/11/09/2019.11.9%20%E5%88%9D%E5%AD%A6markdown%E8%AF%AD%E6%B3%95/">learn_markdown1</a>
</h1>
</header>
<div class="article-entry" itemprop="articleBody">
<h1 id="Markdown-语法学习"><a href="#Markdown-语法学习" class="headerlink" title="Markdown 语法学习"></a>Markdown 语法学习</h1><font size=4>
<p>enjoy learning,enjoy life</p>
<h2 id="字体"><a href="#字体" class="headerlink" title="字体"></a>字体</h2><p>加粗左右用俩个*包起来</p>
<p><strong>加粗文字</strong></p>
<p>倾斜文字用一个*包起来</p>
<p><em>倾斜文字</em></p>
<p>删除线对文字左右加俩个~~</p>
<p><del>删除文字</del></p>
<p>使用>可以表示引用文字</p>
<h2 id="引用"><a href="#引用" class="headerlink" title="引用"></a>引用</h2><blockquote>
<p>引用文字</p>
</blockquote>
<h2 id="分割线"><a href="#分割线" class="headerlink" title="分割线"></a>分割线</h2><p>使用三个或者以上的-或者*可以表示分割线</p>
<hr>
<hr>
<h2 id="图片"><a href="#图片" class="headerlink" title="图片"></a>图片</h2><p><img src="%E5%9B%BE%E7%89%87%E5%9C%B0%E5%9D%80" alt="图片x" title="图片title"> </p>
<p>alt对应显示在图片下面的文字<br>title是图片的标题 title可省略</p>
<p><img src="https://tuchong.com/3132333/57279247/" alt="白玫瑰" title="玫瑰"></p>
<h2 id="超链接"><a href="#超链接" class="headerlink" title="超链接"></a>超链接</h2><p><a href="超链接地址" title="超链接title">超链接名</a></p>
<p><a href="http://baidu.com" target="_blank" rel="noopener">baidu</a></p>
<h2 id="列表"><a href="#列表" class="headerlink" title="列表"></a>列表</h2><p>无序列表使用 - + * 任何一种都行 例子如下</p>
<ul>
<li>星期一</li>
<li>星期二</li>
</ul>
<ul>
<li>星期三</li>
<li>星期四</li>
</ul>
<p>有序列表使用数字加点表示,数字加点,然后加上空格,后面接内容</p>
<ol>
<li>你好</li>
<li>今天你想干嘛</li>
</ol>
<ul>
<li>列表嵌套,上一级和下一级之前敲三个空格</li>
</ul>
<p>如下</p>
<ul>
<li>一级列表<ol>
<li>二级列表</li>
<li>二级列表x</li>
</ol>
</li>
</ul>
<h2 id="表格"><a href="#表格" class="headerlink" title="表格"></a>表格</h2><p>表头|表头|表头</p>
<p>(—|:–:|—:) 这里加括号防止转译,使用的时候不需要</p>
<p>内容|内容|内容</p>
<ul>
<li>:–:表示居中对齐</li>
<li>:—表示左对齐</li>
<li>—:表示右对齐</li>
<li>默认左对齐 最左侧和左右侧的|可以省略</li>
</ul>
<p>姓名 | 班级<br>|:—:|:—:|<br>重阳比 | 一班<br>熊比 | 一班<br>猴哥 | 一班<br>晟比 | 一班</p>
<h2 id="代码"><a href="#代码" class="headerlink" title="代码"></a>代码</h2><p>单行代码使用一对`括起来即可</p>
<p><code>print hello;</code></p>
<p>多行代码使用一对 三个`括起来即可</p>
<p>(```) 使用的时候去掉圆括号,防止转译,下面的也是</p>
<p>func…..</p>
<p>(```) 去掉括号</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">def func():</span><br><span class="line"> print("hello,everyone~")</span><br></pre></td></tr></table></figure>
<h2 id="流程图"><a href="#流程图" class="headerlink" title="流程图"></a>流程图</h2><p>这个相对比较高级的功能,需要经常使用才能熟练</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br></pre></td><td class="code"><pre><span class="line">st=>start: Start</span><br><span class="line">op=>operation: Your Operation</span><br><span class="line">cond=>condition: Yes or No?</span><br><span class="line">e=>end</span><br><span class="line">st->op->cond</span><br><span class="line">cond(yes)->e</span><br><span class="line">cond(no)->op</span><br></pre></td></tr></table></figure>
</div>
<footer class="article-footer">
<a data-url="http://yoursite.com/2019/11/09/2019.11.9%20%E5%88%9D%E5%AD%A6markdown%E8%AF%AD%E6%B3%95/" data-id="ck9u6krnr0000eguz3bsr27b2" class="article-share-link">Share</a>
</footer>
</div>
</article>
<article id="post-hello-world" class="article article-type-post" itemscope itemprop="blogPost">
<div class="article-meta">
<a href="/2019/11/06/hello-world/" class="article-date">
<time datetime="2019-11-06T02:50:49.824Z" itemprop="datePublished">2019-11-06</time>
</a>
</div>
<div class="article-inner">
<header class="article-header">
<h1 itemprop="name">
<a class="article-title" href="/2019/11/06/hello-world/">Hello World</a>
</h1>
</header>
<div class="article-entry" itemprop="articleBody">
<p>Welcome to <a href="https://hexo.io/" target="_blank" rel="noopener">Hexo</a>! This is your very first post. Check <a href="https://hexo.io/docs/" target="_blank" rel="noopener">documentation</a> for more info. If you get any problems when using Hexo, you can find the answer in <a href="https://hexo.io/docs/troubleshooting.html" target="_blank" rel="noopener">troubleshooting</a> or you can ask me on <a href="https://github.com/hexojs/hexo/issues" target="_blank" rel="noopener">GitHub</a>.</p>
<h2 id="Quick-Start"><a href="#Quick-Start" class="headerlink" title="Quick Start"></a>Quick Start</h2><h3 id="Create-a-new-post"><a href="#Create-a-new-post" class="headerlink" title="Create a new post"></a>Create a new post</h3><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">$ hexo new <span class="string">"My New Post"</span></span><br></pre></td></tr></table></figure>
<p>More info: <a href="https://hexo.io/docs/writing.html" target="_blank" rel="noopener">Writing</a></p>
<h3 id="Run-server"><a href="#Run-server" class="headerlink" title="Run server"></a>Run server</h3><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">$ hexo server</span><br></pre></td></tr></table></figure>
<p>More info: <a href="https://hexo.io/docs/server.html" target="_blank" rel="noopener">Server</a></p>
<h3 id="Generate-static-files"><a href="#Generate-static-files" class="headerlink" title="Generate static files"></a>Generate static files</h3><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">$ hexo generate</span><br></pre></td></tr></table></figure>
<p>More info: <a href="https://hexo.io/docs/generating.html" target="_blank" rel="noopener">Generating</a></p>
<h3 id="Deploy-to-remote-sites"><a href="#Deploy-to-remote-sites" class="headerlink" title="Deploy to remote sites"></a>Deploy to remote sites</h3><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">$ hexo deploy</span><br></pre></td></tr></table></figure>
<p>More info: <a href="https://hexo.io/docs/one-command-deployment.html" target="_blank" rel="noopener">Deployment</a></p>
</div>
<footer class="article-footer">
<a data-url="http://yoursite.com/2019/11/06/hello-world/" data-id="ck9u6krpt0007eguzdawc30d9" class="article-share-link">Share</a>
</footer>
</div>
</article>
</section>
<aside id="sidebar">
<div class="widget-wrap">
<h3 class="widget-title">Archives</h3>
<div class="widget">
<ul class="archive-list"><li class="archive-list-item"><a class="archive-list-link" href="/archives/2020/05/">May 2020</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2020/02/">February 2020</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2019/11/">November 2019</a></li></ul>
</div>
</div>
<div class="widget-wrap">
<h3 class="widget-title">Recent Posts</h3>
<div class="widget">
<ul>
<li>
<a href="/2020/05/06/2020.5.6%20%E4%B8%80%E4%BA%9B%E6%84%9F%E6%83%B3%E5%92%8C%E7%96%91%E6%83%91/">困惑</a>
</li>
<li>
<a href="/2020/02/13/2020.2.13%20%E9%85%8D%E7%BD%AEXSHELL%E5%92%8CWSL%E8%BF%9E%E6%8E%A5/">使用XSHELL连接WSL</a>
</li>
<li>
<a href="/2020/02/13/2020.2.13%20%E5%AD%A6%E4%B9%A0%E4%BD%BF%E7%94%A8%E6%98%BE%E5%8D%A1%E8%AE%AD%E7%BB%83/">使用nvidia显卡训练模型常用命令</a>
</li>
<li>
<a href="/2020/02/13/2020.2.13%20linux%E6%96%87%E4%BB%B6%E5%91%BD%E4%BB%A4/">linux命令-查看文件夹信息</a>
</li>
<li>
<a href="/2019/11/29/2019.11.29%20Global%E5%85%B3%E9%94%AE%E5%AD%97/">Global关键字</a>
</li>
</ul>
</div>
</div>
</aside>
</div>
<footer id="footer">
<div class="outer">
<div id="footer-info" class="inner">
© 2020 John Doe<br>
Powered by <a href="http://hexo.io/" target="_blank">Hexo</a>
</div>
</div>
</footer>
</div>
<nav id="mobile-nav">
<a href="/" class="mobile-nav-link">Home</a>
<a href="/archives" class="mobile-nav-link">Archives</a>
</nav>
<script src="//ajax.googleapis.com/ajax/libs/jquery/2.0.3/jquery.min.js"></script>
<link rel="stylesheet" href="/fancybox/jquery.fancybox.css">
<script src="/fancybox/jquery.fancybox.pack.js"></script>
<script src="/js/script.js"></script>
</div>
</body>
</html>