与numpy之间相互转换
torch.from_numpy
xxx.numpy()
矩阵相乘
要不要把variable涉及到反相传播的过程当中去 require_grad
variable中的tensor是存放再data中
激励函数
解决我们日常生活中 不能用线性方程所概括的问题
import torch.nn.functional as F # 激励函数都在这
# 做一些假数据来观看图像
x = torch.linspace(-5, 5, 200) # x data (tensor), shape=(100, 1)
x = Variable(x)
# 几种常用的 激励函数
y_relu = F.relu(x).data.numpy()
y_sigmoid = F.sigmoid(x).data.numpy()
y_tanh = F.tanh(x).data.numpy()
y_softplus = F.softplus(x).data.numpy()