Create deephashloss.py

pull/1166/head
Bin Lu 2021-08-25 13:59:54 +08:00 committed by GitHub
parent 52663edf60
commit 9323b1478a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 0 deletions

View File

@ -0,0 +1,6 @@
# do binarize
if self.config["Global"].get("feature_binarize") == "round":
batch_feas = paddle.round(batch_feas).astype("float32") * 2.0 - 1.0
if self.config["Global"].get("feature_binarize") == "sign":
batch_feas = paddle.sign(batch_feas).astype("float32")