显存优化实战:模型推理性能全解析
import torch# 定义一个简单的模型
class SimpleModel(torch.nn.Module):def __init__(self):super(SimpleModel, self).__init__()self.linear torch.nn.Linear(1000, 1000)def forward(self, x):return self.linear(x)# 初始化模型和输入数据
model SimpleModel()
input_da…
2026/10/12 2:23:16 阅读全文 →