-
Notifications
You must be signed in to change notification settings - Fork 0
/
search.xml
44 lines (44 loc) · 9.38 KB
/
search.xml
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
<?xml version="1.0" encoding="utf-8"?>
<search>
<entry>
<title><![CDATA[60分钟闪电战之一_tensor]]></title>
<url>%2F2019%2F05%2F15%2F60%E5%88%86%E9%92%9F%E9%97%AA%E7%94%B5%E6%88%98%E4%B9%8B%E4%B8%80-tensor%2F</url>
<content type="text"><![CDATA[0.官方发言pytorch官网给了一个60分钟教程,这个一定一定要看看,它讲了很多pytorch的特性。 1. TensorTensor与Numpy中ndarrays类似,但是在Pytorch中,tensor可以在GPU上面运算。pytorch的import12from __future__ import print_functionimport torch 1.1 创建矩阵12345678910#APIx = torch.empty(5,3)#没有初始化的5x3矩阵x = torch.rand(5,3)#随机初始化的矩阵x = torch.zeros(5,3, dtype=torch.long)#初始化为类型为long值为0的矩阵#数据x = torch.tensor([5.5, 4])x = torch.from_numpy(np.array([5.5,4]))#已经存在的tensorx = x.new_ones(2,2,dtype=torch.double)#new_*x = torch.randn_like(x, dtype=torch.float)#*_like 1.2 矩阵操作add的三种方式 A+B:123x = torch.ones(5,3)y = torch.rand(5, 3)print("x+y:\n", x+y) torch.add(A,B): 可以指定输出变量1234print("torch.add(x,y):\n", torch.add(x,y))result = torch.empty(5,3)torch.add(x,y, out=result)print("通过形参指定输出变量:\n", result) A.add_(B): 本地操作API后缀_1234y.add_(x)print("本地操作y.add_(x):\n", y)print("所有在原地操作的变量均用_表示,比如x.copy_(y),x.t_()") 类似NumPy的索引方式123print("可以使用Numpy-like的所有bells和whistles,like:")print("x[:,1]:\n", x[:,1])print("x[2:4, 0:2]:\n", x[2:4, 0:2]) 使用torch.view()做Resizing1234567x = torch.randn(4,4)y = x.view(16)z = x.view(-1,8)print("使用view改变tensor的shape:\n", x.size(), y.size(), z.size()) torch.item()方法12x = torch.randn(1)print("对于只有一个元素的tensor,可以使用.item()得到其值并且转换为python数字:\n",x, x.item()) 还有更多关于tensor的操作here TODO:使用树状图进行总结,一些操作和方法需要解释理论 1.3 NumPy Bridge基于这个可以和numpy无缝结合 torch tensor => numpy ndarray123456789print("Converting a Torch Tensor to a NumPy Array:\n")a = torch.ones(5)b = a.numpy()print("使用torch.numpy(), 把tensor转换为numpy类型的数据:\n",a, b)print("来看看numpy数组的值怎么变换的")a.add_(1)print("a.add_(1):\n", a, b)np.add(b, 1, out=b)print("np.add(b, 1, out=b):\n", a, b) numpy ndarray => torch tensor12345678print("Converting NumPy array to Torch Tensor:\n")a = np.ones(4)b = torch.from_numpy(a)print("使用torch.from_numpy()将numpy数组转换为tensor:\n",a,b)np.add(a, 1, out=a)print("np.add(a,1,out=a):\n",a,b)b.add_(1)print("b.add_(1):\n", a,b) 通过运行可以看出:123print("\n 可以看出, torch.numpy()和torch.from_numpy()是把原来的数据," "重新用torch或numpy重新解释了一遍," "修改他们中的一个另外一个也会接着改变") 1.4 CUDA tensor创建时指定device 12x = torch.randn(5,5,device=torch.device("cpu"))y = torch.ones_like(x, device=torch.device("cuda")) 划重点,就是cuda和cpu直接的切换 torch.to()12345device = torch.device("cuda")x = x.to(device)z = x+yprint("z在GPU上:\n",z)print("z在CPU上:\n",z.to("cpu", torch.double)) .to can also change dtype together! torch.cuda() or torch.cpu()123x = torch.randn(5,5)print("x.cuda():\n", x.cuda())print("x.cpu():\n", x.cpu()) 这种切换方法,让你尽情切换]]></content>
<categories>
<category>Pytorch</category>
</categories>
<tags>
<tag>pytorch</tag>
<tag>DL</tag>
</tags>
</entry>
<entry>
<title><![CDATA[ETS_one]]></title>
<url>%2F2019%2F04%2F19%2FETS-one%2F</url>
<content type="text"><![CDATA[NINETEENTH-CENTURY POLITICS IN THE UNITED STATESThe development of the modern presidency in the United States began with Andrew Jackson who swept to power in 1829 at the head of the Democratic Party and served until 1837. During his administration, he immeasurably enlarged the power of the presidency. “The President is the direct representative of the American people,” he lectured the Senate when it opposed him. “He was elected by the people, and is responsible to them.” With this declaration, Jackson redefined the character of the presidential office and its relationship to the people. Quiz questionAccording to this paragraph, the presidency of Andrew Jackson was especially significant for which of the following reasons?A. The President granted a portion of his power to the Senate.B. The President began to address the Senate on a regular basis.C. It was the beginning of the modern presidency in the United States.D. It was the first time that the Senate had been known to oppose the President. Key words & phrases1). development n. 发展,进化e.g. The problem of pollution arises along with the rapid development of industry. 随着工业的迅速发展,产生了污染问题。2). presidency n. 总统;总统的任期;管辖,;支配3). sweep v. 打扫,清理;彻底搜索;掠过4). the Democratic Party n. 民主党5). administration n. 管理;实行;行政机关6). immeasurable adj.无法计量的,无限的7). enlarge v. 扩大,放大;扩展,扩充8). representative n.代表;有代表性的;典型的9). lecture n.演讲;训斥,教训;做演讲;教训10). oppose v.抵制;反对,抗争11). elect v. 选举;跳出12). be responsible to 对…负责e.g. The government will be responsible to the President alone.政府只对总统一人负责13). declaration n. 宣言,布告,公告,声明14). redefine v. 重新定义;在定义 ps hexo 语法参考link]]></content>
<categories>
<category>ETS</category>
</categories>
<tags>
<tag>ETS</tag>
<tag>perusal</tag>
</tags>
</entry>
<entry>
<title><![CDATA[ubuntu+subl]]></title>
<url>%2F2019%2F03%2F07%2Fubuntu-subl%2F</url>
<content type="text"><![CDATA[写在文章首页,sublime 被屏蔽的好狠啊啊啊啊 install sublime献上我的sh脚本文件1234sudo add-apt-repository ppa:webupd8team/sublime-text-3;sudo apt-get update;sudo apt-get install sublime-text-installer;sudo ln -s /usr/lib/sublime-text-3/sublime_text /usr/local/bin/sublime; 配置license网上搜索一个license, 然后放在help->license 最后点use license12345678910111213—– BEGIN LICENSE —–Michael BarnesSingle User LicenseEA7E-8213858A353C41 872A0D5C DF9B2950 AFF6F667C458EA6D 8EA3C286 98D1D650 131A97ABAA919AEC EF20E143 B361B1E7 4C8B7F04B085E65E 2F5F5360 8489D422 FB8FC1AA93F6323C FD7F7544 3F39C318 D95E6480FCCC7561 8A4A1741 68FA4223 ADCEDE07200C25BE DBBC4855 C4CFB774 C5EC138C0FEC1CEF D9DCECEC D3A5DAD1 01316C36—— END LICENSE —— 附上licenselink. ##请支持正版## 安装Package Control官网传送门 简单方法: View->Show console 最下放输入:1import urllib.request,os,hashlib; h = '6f4c264a24d933ce70df5dedcf1dcaee' + 'ebe013ee18cced0ef93d5f746d80ef60'; pf = 'Package Control.sublime-package'; ipp = sublime.installed_packages_path(); urllib.request.install_opener( urllib.request.build_opener( urllib.request.ProxyHandler()) ); by = urllib.request.urlopen( 'http://packagecontrol.io/' + pf.replace(' ', '%20')).read(); dh = hashlib.sha256(by).hexdigest(); print('Error validating download (got %s instead of %s), please try manual install' % (dh, h)) if dh != h else open(os.path.join( ipp, pf), 'wb' ).write(by) 但是由于被墙,已输入就死机,所以使用另外一种方法 手动 点击Preferences -> Browse Packages 调到上层文件夹 Installed Packages下面 下载Package Control.sublime-package,并复制到Installed Packages下面 重启sublime 如果不行删除多试几次 禁止检查更新 点击Preferences -> Package Settings -> Package Control -> Settings user 大括号内添加 "update_check": false 注意要在上调语句后加, 如果这样还不好使的话,打开/etc/hosts文件, 添加一句127.0.0.1 www.sublimetext.com 重启生效 install Package无效由于被墙的原因,在Preferences -> Package Settings -> Package Control -> Settings user盖原来链接,参考here1234"channels": [ "/home/kipp/.config/sublime-text-3/Packages/json/channel_v3.json" ], 先写到这里,快一点了改睡觉了。。。GFW。。。。ps:虽然可以搜索,但是仍然不能使用。。。。 答应姐姐的hexo部署文档还没写。。。。]]></content>
<categories>
<category>Ubuntu soft</category>
</categories>
<tags>
<tag>Ubuntu</tag>
<tag>Sublime Text3</tag>
</tags>
</entry>
<entry>
<title><![CDATA[Hello World]]></title>
<url>%2F2019%2F03%2F04%2Fhello-world%2F</url>
<content type="text"><![CDATA[Welcome to Hexo! This is your very first post. Check documentation for more info. If you get any problems when using Hexo, you can find the answer in troubleshooting or you can ask me on GitHub. Quick StartCreate a new post1$ hexo new "My New Post" More info: Writing Run server1$ hexo server More info: Server Generate static files1$ hexo generate More info: Generating Deploy to remote sites1$ hexo deploy More info: Deployment]]></content>
</entry>
</search>