Spaces:
Sleeping
Sleeping
changing float to int32
Browse files- triplet_margin_loss.py +5 -5
triplet_margin_loss.py
CHANGED
@@ -19,7 +19,7 @@ import numpy as np
|
|
19 |
|
20 |
|
21 |
_DESCRIPTION = """
|
22 |
-
Triplet margin loss is a loss function that measures a relative similarity between the samples
|
23 |
A triplet is comprised of reference input 'anchor (a)', matching input 'positive examples (p)' and non-matching input 'negative examples (n)'.
|
24 |
The loss function for each triplet is given by:\n
|
25 |
L(a, p, n) = max{d(a,p) - d(a,n) + margin, 0}\n
|
@@ -88,10 +88,10 @@ class TripletMarginLoss(evaluate.EvaluationModule):
|
|
88 |
inputs_description=_KWARGS_DESCRIPTION,
|
89 |
features=datasets.Features(
|
90 |
{
|
91 |
-
"anchor": datasets.Sequence(datasets.Value("
|
92 |
-
"positive": datasets.Sequence(datasets.Value("
|
93 |
-
"negative": datasets.Sequence(datasets.Value("
|
94 |
-
"margin": datasets.Value("
|
95 |
}
|
96 |
),
|
97 |
reference_urls=["https://proceedings.neurips.cc/paper/2003/hash/d3b1fb02964aa64e257f9f26a31f72cf-Abstract.html"],
|
|
|
19 |
|
20 |
|
21 |
_DESCRIPTION = """
|
22 |
+
Triplet margin loss is a loss function that measures a relative similarity between the samples.
|
23 |
A triplet is comprised of reference input 'anchor (a)', matching input 'positive examples (p)' and non-matching input 'negative examples (n)'.
|
24 |
The loss function for each triplet is given by:\n
|
25 |
L(a, p, n) = max{d(a,p) - d(a,n) + margin, 0}\n
|
|
|
88 |
inputs_description=_KWARGS_DESCRIPTION,
|
89 |
features=datasets.Features(
|
90 |
{
|
91 |
+
"anchor": datasets.Sequence(datasets.Value("int32", id="references")),
|
92 |
+
"positive": datasets.Sequence(datasets.Value("int32"), id="sequence"),
|
93 |
+
"negative": datasets.Sequence(datasets.Value("int32"), id="sequence"),
|
94 |
+
"margin": datasets.Value("int32")
|
95 |
}
|
96 |
),
|
97 |
reference_urls=["https://proceedings.neurips.cc/paper/2003/hash/d3b1fb02964aa64e257f9f26a31f72cf-Abstract.html"],
|