diff --git a/S1/35/prompt.txt b/S1/35/prompt.txt index d0bcc70..07029a6 100644 --- a/S1/35/prompt.txt +++ b/S1/35/prompt.txt @@ -27,6 +27,7 @@ The goal is to create a single, highly-efficient CUDA kernel pass that addresses This strategy transforms a multi-stage, memory-bound operation into a single-pass, compute-efficient, and numerically stable kernel, yielding substantial performance improvements. You are given the following architecture: + import torch import torch.nn as nn diff --git a/S1/35/run_code.py b/S1/35/run_code.py index aff0428..03af26f 100644 --- a/S1/35/run_code.py +++ b/S1/35/run_code.py @@ -21,6 +21,7 @@ def run_benchmark(): torch_model.eval() cuda_model.eval() + print("-------------------- 精度对齐验证 --------------------") with torch.no_grad(): # 预热GPU diff --git a/S1/35/softmarginloss_cuda.py b/S1/35/softmarginloss_cuda.py index 9c3605b..c59980c 100644 --- a/S1/35/softmarginloss_cuda.py +++ b/S1/35/softmarginloss_cuda.py @@ -85,7 +85,6 @@ __global__ void soft_margin_loss_reduce_kernel_stage1( } } - torch::Tensor soft_margin_loss_cuda_forward( const torch::Tensor& input, const torch::Tensor& target, diff --git a/S1/35/softmarginloss_torch.py b/S1/35/softmarginloss_torch.py index 160c5f9..598c263 100644 --- a/S1/35/softmarginloss_torch.py +++ b/S1/35/softmarginloss_torch.py @@ -18,6 +18,7 @@ class Model(nn.Module): return self.loss_fn(input_tensor, target_tensor) def get_inputs(): + """ 生成用于测试的输入张量。 """