Skip to content

Commit 6c888df

Browse files
authored
Update metrics.py
Changed from lambda expression which pylint doesn't like.
1 parent fdc956b commit 6c888df

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

algoperf/workloads/ogbg/metrics.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,9 @@ class MeanAveragePrecision(
3131
metrics.CollectingMetric.from_outputs(('logits', 'labels', 'mask'))):
3232
"""Computes the mean average precision (mAP) over different tasks."""
3333

34+
def sigmoid_np(x):
35+
return 1 / (1 + np.exp(-x))
36+
3437
def compute(self):
3538
# Matches the official OGB evaluation scheme for mean average precision.
3639
values = super().compute()
@@ -49,7 +52,7 @@ def compute(self):
4952
dist.all_gather(all_tensors, tensor)
5053
all_values[idx] = torch.cat(all_tensors).cpu().numpy()
5154
labels, logits, mask = all_values
52-
sigmoid = lambda x: 1 / (1 + np.exp(-x))
55+
sigmoid = sigmoid_np
5356

5457
mask = mask.astype(bool)
5558

0 commit comments

Comments
 (0)