04 2021 档案

摘要:版权声明:本文为CSDN博主「模糊包」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。 原文链接:https://blog.csdn.net/xinjieyuan/article/details/105205326 阅读全文
posted @ 2021-04-30 17:13 id_ning 阅读(38) 评论(0) 推荐(0)
摘要:import numpy as np a = np.arange(9).reshape(3,3) b = np.zeros([2,2], dtype=int) - 100 print(a) print() print(b) a[1:3, :2] += b print(a) 结果: a: [[0 1 阅读全文
posted @ 2021-04-30 10:37 id_ning 阅读(1708) 评论(0) 推荐(0)
摘要:通过np.random.randn()函数可以返回一个或一组服从标准正态分布的随机样本值。 import numpy as np import matplotlib.pyplot as plt a = np.random.randn(10000000) # 生成标准正态分布随机样本值 plt.fig 阅读全文
posted @ 2021-04-28 15:37 id_ning 阅读(1133) 评论(0) 推荐(0)
摘要:通过np.random.rand()函数可以返回一个或一组服从“0~1”均匀分布的随机样本值。随机样本取值范围是**[0,1)**,不包括1。 import numpy as np a = np.random.rand(3) b = a * 10 print('a:', a) print('b:', 阅读全文
posted @ 2021-04-28 14:23 id_ning 阅读(609) 评论(0) 推荐(0)
摘要:版权声明:本文为CSDN博主「ImwaterP」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。 原文链接:https://blog.csdn.net/ImwaterP/article/details/96282230 import numpy as np a = 阅读全文
posted @ 2021-04-28 09:26 id_ning 阅读(770) 评论(0) 推荐(0)
摘要:菜鸟教程:https://www.runoob.com/python/python-func-enumerate.html 阅读全文
posted @ 2021-04-27 09:42 id_ning 阅读(65) 评论(0) 推荐(0)
摘要:import torch x = torch.randint(1,24, (2,3,4)) print(x) x = x.permute(2, 0, 1) print(x) 结果: 前: ([[[15, 23, 21, 14], [ 2, 15, 7, 14], [21, 8, 8, 22]], [ 阅读全文
posted @ 2021-04-26 10:15 id_ning 阅读(912) 评论(0) 推荐(0)
摘要:import torch a = torch.arange(2 * 3).view(2, 3) a_sum = torch.sum(a, 0) b = torch.arange(2 * 3 * 4).view(2, 3, 4) b_sum = torch.sum(b, (2, 1)) # 相当于b_ 阅读全文
posted @ 2021-04-26 09:46 id_ning 阅读(240) 评论(0) 推荐(0)
摘要:import torch x = torch.randint(2, 3) x1 = torch.cat((x, x), 0) x2 = torch.cat((x, x), 1) print(x) print(x1) print(x2) 结果: x:([[1, 4, 5], [4, 3, 1]]) x 阅读全文
posted @ 2021-04-25 14:59 id_ning 阅读(140) 评论(0) 推荐(0)
摘要:官方链接:https://pytorch.org/docs/stable/generated/torch.nn.GRU.html?highlight=gru#torch.nn.GRU 阅读全文
posted @ 2021-04-25 11:42 id_ning 阅读(1680) 评论(0) 推荐(0)
摘要:哈达玛积(Hadamard product)是矩阵的一类运算,若A=(aij)和B=(bij)是两个同阶矩阵,若cij=aij×bij,则称矩阵C=(cij)为A和B的哈达玛积,或称基本积[1]。 [1] 数学辞海编辑委员会.数学辞海第二卷:中国科学技术出版社,2002 参考:https://bai 阅读全文
posted @ 2021-04-25 11:29 id_ning 阅读(265) 评论(0) 推荐(0)
摘要:class torch.nn.Conv1d(in_channels, out_channels, kernel_size, stride=1, padding=0, dilation=1, groups=1, bias=True) in_channels(int) :输入信号的通道。在文本分类中,即 阅读全文
posted @ 2021-04-23 11:13 id_ning 阅读(2076) 评论(0) 推荐(0)
摘要:torch.randn()返回一个张量,包含了从标准正态分布(均值为0,方差为1,即高斯白噪声)中抽取的一组随机数。张量的形状由参数size定义。 import torch import numpy as np a = np.array(torch.randn(1000, 1000)) print( 阅读全文
posted @ 2021-04-22 14:57 id_ning 阅读(1705) 评论(0) 推荐(0)
摘要:import numpy as np a = [1, 0, -1] a_mean = np.mean(a) a_var = np.var(a) a_std = np.std(a) print('a_mean: ', a_mean) print('a_var:', a_var) print('a_st 阅读全文
posted @ 2021-04-22 10:06 id_ning 阅读(1432) 评论(0) 推荐(0)
摘要:版权声明:本文为CSDN博主「七月听雪」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。原文链接:https://blog.csdn.net/qq_23262411/article/details/100175943 import torch import torc 阅读全文
posted @ 2021-04-21 17:17 id_ning 阅读(3052) 评论(0) 推荐(0)
摘要:https://blog.csdn.net/weixin_43250623/article/details/89197488?utm_medium=distribute.pc_relevant.none-task-blog-2%7Edefault%7EBlogCommendFromMachineLe 阅读全文
posted @ 2021-04-21 10:36 id_ning 阅读(154) 评论(0) 推荐(0)
摘要:https://www.runoob.com/python/os-listdir.html 阅读全文
posted @ 2021-04-21 09:23 id_ning 阅读(97) 评论(0) 推荐(0)
摘要:import numpy as np a = np.zeros([4,3]) print('前a:', a) a[0:3, 1] = 1 # 数组行(0,1,2)和列(1)的值变为1 print('后a:', a) 结果: 前a: [[0. 0. 0.] [0. 0. 0.] [0. 0. 0.] 阅读全文
posted @ 2021-04-20 17:12 id_ning 阅读(180) 评论(0) 推荐(0)
摘要:版权声明:本文为CSDN博主「象在舞」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。 原文链接:https://blog.csdn.net/gdkyxy2013/article/details/80495353 阅读全文
posted @ 2021-04-20 16:46 id_ning 阅读(141) 评论(0) 推荐(0)
摘要:版权声明:本文为CSDN博主「雷格西雷狗子」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。原文链接:https://blog.csdn.net/weixin_45556441/article/details/110847939 阅读全文
posted @ 2021-04-20 16:28 id_ning 阅读(39) 评论(0) 推荐(0)
摘要:import numpy as np a = np.floor(2.3) # 向下取整 b = np.floor([1.6, -2.5]) print('a:', a) print('b:', b) a: 2.0 b: [ 1. -3.] import numpy as np c = np.ceil 阅读全文
posted @ 2021-04-19 09:39 id_ning 阅读(457) 评论(0) 推荐(0)
摘要:import numpy as np a = np.zeros((2,3), dtype=int) print(a) b = np.ones_like(a, dtype=int) print(b) 结果: a: [[0 0 0] [0 0 0]] b: [[1 1 1] [1 1 1]] 阅读全文
posted @ 2021-04-16 17:32 id_ning 阅读(152) 评论(0) 推荐(0)
摘要:import numpy as np a = np.array([i for i in range(5)]) b = np.array([i for i in range(5, 10)]) print('a:', a) print('b:', b) c = np.stack([a,b], axis= 阅读全文
posted @ 2021-04-16 10:10 id_ning 阅读(361) 评论(0) 推荐(0)
摘要:https://blog.csdn.net/weixin_44201525/article/details/109769214 阅读全文
posted @ 2021-04-15 17:29 id_ning 阅读(30) 评论(0) 推荐(0)
摘要:print(round(1.2)) # 小数点后值小于0.5时,取最近的整数 1 1 print(round(1.5)) # 小数点后值等于0.5时,取最近的偶数 2 2 print(round(2.5)) # 小数点后值等于0.5时,取最近的偶数 2 2 print(round(1.6)) # 小 阅读全文
posted @ 2021-04-15 15:17 id_ning 阅读(359) 评论(0) 推荐(0)