做了一个向量相乘的APP,避免embedding_mobile递归循环.

This commit is contained in:
2025-10-09 17:58:06 +08:00
parent 065192fff8
commit 7faf3f6480
4 changed files with 1554 additions and 20 deletions
+3 -3
View File
@@ -127,11 +127,11 @@ class TwoLayerSimilarityNet(nn.Module):
raise ValueError("输入张量形状必须为 [batch, 512]")
# 输入归一化
# x_norm = F.normalize(x, p=2, dim=1) # [B, 512]
x_norm = F.normalize(x, p=2, dim=1) # [B, 512]
# 单层线性变换
# sims = self.layer2(x_norm) # [B, N]
sims = self.layer2(x) # [B, N]
sims = self.layer2(x_norm) # [B, N]
# sims = self.layer2(x) # [B, N]
return sims