Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
vision
Commits
b590f8c6
"tests/python/vscode:/vscode.git/clone" did not exist on "b1ec112eeb0e0633e57d89a60f6f80322cff0028"
Commit
b590f8c6
authored
Nov 25, 2019
by
Will Brennan
Committed by
Francisco Massa
Nov 25, 2019
Browse files
Fix broken bitwise operation in Similarity Reference loss (#1604)
parent
b8e3e969
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
2 deletions
+2
-2
references/similarity/loss.py
references/similarity/loss.py
+2
-2
No files found.
references/similarity/loss.py
View file @
b590f8c6
...
@@ -77,7 +77,7 @@ def batch_all_triplet_loss(labels, embeddings, margin, p):
...
@@ -77,7 +77,7 @@ def batch_all_triplet_loss(labels, embeddings, margin, p):
def
_get_triplet_mask
(
labels
):
def
_get_triplet_mask
(
labels
):
# Check that i, j and k are distinct
# Check that i, j and k are distinct
indices_equal
=
torch
.
eye
(
labels
.
size
(
0
),
dtype
=
torch
.
uint8
,
device
=
labels
.
device
)
indices_equal
=
torch
.
eye
(
labels
.
size
(
0
),
dtype
=
torch
.
bool
,
device
=
labels
.
device
)
indices_not_equal
=
~
indices_equal
indices_not_equal
=
~
indices_equal
i_not_equal_j
=
indices_not_equal
.
unsqueeze
(
2
)
i_not_equal_j
=
indices_not_equal
.
unsqueeze
(
2
)
i_not_equal_k
=
indices_not_equal
.
unsqueeze
(
1
)
i_not_equal_k
=
indices_not_equal
.
unsqueeze
(
1
)
...
@@ -96,7 +96,7 @@ def _get_triplet_mask(labels):
...
@@ -96,7 +96,7 @@ def _get_triplet_mask(labels):
def
_get_anchor_positive_triplet_mask
(
labels
):
def
_get_anchor_positive_triplet_mask
(
labels
):
# Check that i and j are distinct
# Check that i and j are distinct
indices_equal
=
torch
.
eye
(
labels
.
size
(
0
),
dtype
=
torch
.
uint8
,
device
=
labels
.
device
)
indices_equal
=
torch
.
eye
(
labels
.
size
(
0
),
dtype
=
torch
.
bool
,
device
=
labels
.
device
)
indices_not_equal
=
~
indices_equal
indices_not_equal
=
~
indices_equal
# Check if labels[i] == labels[j]
# Check if labels[i] == labels[j]
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment