Simple Inference
45 字
1 分钟
Simple Inference
题面

答案
import torchimport torch.nn as nn
# input, model, and output are on the GPUdef solve(input: torch.Tensor, model: nn.Module, output: torch.Tensor): weights = model.weight.T res = input @ weights if model.bias is not None: res = res + model.bias output.copy_(res)Simple Inference
https://dongyanzhang.com/posts/leetgpu/simple-inference/


