Task1
写心得,总结问题和难点,代码等(内容不限)
主要学习到了pytorch的操作,已经动手实现线性回归与简单的神经网络
pytorch实现模型步骤
1、创建数据(https://pytorch.org/docs/stable/tensors.html)
There are a few main ways to create a tensor, depending on your use case.
To create a tensor with pre-existing data, use torch.tensor().
To create a tensor with specific size, use torch.* tensor creation ops (see Creation Ops).
To create a tensor with the same size (and similar types) as another tensor, use torch.*_like tensor creation ops (see Creation Ops).
To create a tensor with similar type but different size as another tensor, use tensor.new_* creation ops.
2、初始化模型参数
3、模型构建
torch.nn.Sequential
class TwoLayerNet(torch.nn.Module)
4、定义损失函数
5、定义优化器
6、模型训练
7、模型评估
网友评论