-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathHash.py
More file actions
22 lines (21 loc) · 733 Bytes
/
Hash.py
File metadata and controls
22 lines (21 loc) · 733 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import torch
from torch import nn
from torch.autograd import Variable
import torch.nn.functional as F
from hashes.list_hashfunctions import *
class HashFunction:
def get(params, num_hashes):
hash_func = None
if params["name"] == "l2lsh":
hash_func = L2LSH(params["l2lsh"], num_hashes)
if params["name"] == "l2lsh_torch":
hash_func = L2LSH_TORCH(params["l2lsh_torch"], num_hashes)
elif params["name"] == "srp":
hash_func = SRP(params["srp"], num_hashes)
elif params["name"] == "srp_torch":
hash_func = SRP_TORCH(params["srp_torch"], num_hashes)
elif params["name"] == "hist":
hash_func = HISTOGRAM(params["hist"])
else:
raise NotImplementedError
return hash_func