chore: import upstream snapshot with attribution

This commit is contained in:
wehub-resource-sync
2026-07-13 12:36:30 +08:00
commit 55ab4e4a73
473 changed files with 72932 additions and 0 deletions
+16
View File
@@ -0,0 +1,16 @@
import easygraph as eg
import pytest
import torch
from easygraph.nn.regularization import EmbeddingRegularization
def test_embedding_reg():
print("EmbeddingRegularization" in eg.__dir__())
emb_reg = EmbeddingRegularization(p=2, weight_decay=1e-4)
embs = [torch.randn(10, 3), torch.randn(10, 3)]
loss = emb_reg(*embs)
true_loss = 0
for emb in embs:
true_loss += 1 / 2 * emb.norm(2).pow(2) / 10
assert loss.item() == pytest.approx(1e-4 * true_loss.item())