上一页 1 ··· 34 35 36 37 38 39 40 41 42 ··· 56 下一页

2019年10月9日

摘要: import matplotlibmatplotlib.use("Agg")import matplotlib.pyplot as pltx=range(10)y=[i*i for i in x]plt.plot(x,y)plt.savefig("1.png")plt.show() 阅读全文
posted @ 2019-10-09 11:13 happygril3 阅读(118) 评论(0) 推荐(0)
摘要: 0 标准输入 1--标准输出 2 标准错误输出 test.py文件 print("111111111111111111") print("222222222222222222") with open("data/result/test.txt","w") as f: f.write("hello") 阅读全文
posted @ 2019-10-09 10:31 happygril3 阅读(196) 评论(0) 推荐(0)

2019年9月29日

摘要: https://blog.csdn.net/leo_95/article/details/89946318 matmul 可以进行张量乘法, 输入可以是高维. mat 矩阵对应位相乘,两个tensor输入维度相同,(m×n)和(m×n),返回(m×n) mm 只能进行矩阵乘法,也就是输入的两个ten 阅读全文
posted @ 2019-09-29 15:20 happygril3 阅读(293) 评论(0) 推荐(0)
摘要: torch.squeeze() 对数据的维度进行压缩,去掉维数为1的的维度,默认是将a中所有为1的维度删掉。 也可以通过dim指定位置,删掉指定位置的维数为1的维度。torch.unsqueeze()对数据维度进行 import torch x = torch.zeros(3, 2, 4, 1, 2, 1) # dimension of 3*2*4*1*2 print(x.size()) # to 阅读全文
posted @ 2019-09-29 15:07 happygril3 阅读(446) 评论(0) 推荐(0)

2019年9月27日

摘要: 均匀分布nn.init.uniform(tensor,a=0,b=1)tensor -n维的torch.Tensora 均匀分布的下界,默认值为0b 均匀分布的上界,默认值为1 正态分布torcn.nn.init.normal(tensor,mean=0,std=1)tensor n维的torch.Tensormean 正太分布的均值std 正太分布的标准差 import torch import 阅读全文
posted @ 2019-09-27 16:35 happygril3 阅读(497) 评论(0) 推荐(0)
摘要: torch.nn.init.calculate_gain(nonlinearity,param=None) 对于给定的非线性函数,返回推荐的增益值。这些值如下所示: 阅读全文
posted @ 2019-09-27 16:25 happygril3 阅读(1255) 评论(0) 推荐(1)
摘要: w tensor([[6.5103e-38, 0.0000e+00, 5.7453e-44, 0.0000e+00, nan],[0.0000e+00, 1.3733e-14, 6.4076e+07, 2.0706e-19, 7.3909e+22],[2.4176e-12, 1.1625e+33, 阅读全文
posted @ 2019-09-27 16:10 happygril3 阅读(1751) 评论(0) 推荐(0)

2019年9月26日

摘要: ''' torch.nn torch.nn.functional (F)CrossEntropyLoss cross_entropy LogSoftmax log_softmax NLLLoss nll_loss''' import torch import torch.nn.functional as F input=torch.randn(3,4) label=torch.tensor([0, 阅读全文
posted @ 2019-09-26 18:10 happygril3 阅读(1541) 评论(0) 推荐(0)
摘要: import torch import torch.autograd as autograd import torch.nn as nn import torch.nn.functional as F import torch.optim as optim import numpy as np data=autograd.Variable(torch.FloatTensor([1.0,2.0... 阅读全文
posted @ 2019-09-26 17:20 happygril3 阅读(203) 评论(0) 推荐(0)
摘要: 首先定义:待优化参数: ,目标函数: ,初始学习率 。 而后,开始进行迭代优化。在每个epoch : SGD SGD with Momentum AdaGrad AdaDelta / RMSProp Adam 阅读全文
posted @ 2019-09-26 13:57 happygril3 阅读(188) 评论(0) 推荐(0)
上一页 1 ··· 34 35 36 37 38 39 40 41 42 ··· 56 下一页

导航