摘要: """ 这是一个 PyTorch 自动求导(autograd) 的最小例子:先对张量 x 做几步普通运算得到标量 out,再调用 out.backward(),自动算出 out 对 x 每个分量的梯度,并写入 x.grad。 """ import torch # requires_grad=True 阅读全文
posted @ 2026-08-11 09:17 Marksion 阅读(2) 评论(0) 推荐(0)
摘要: PyTorch基础知识点 import torch # 深度学习框架 import torch.nn as nn import torch.nn.functional as F import torch.optim as optim # ### 1. 创建 Tensor 张量 多维矩阵 # 直接从数 阅读全文
posted @ 2026-08-11 09:15 Marksion 阅读(3) 评论(0) 推荐(0)