This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
from keras.models import Sequential | |
from keras.layers.core import Activation, Dense | |
training_data = np.array([[0,0],[0,1],[1,0],[1,1]], "float32") | |
target_data = np.array([[0],[1],[1],[0]], "float32") | |
model = Sequential() | |
model.add(Dense(32, input_dim=2, activation='relu')) | |
model.add(Dense(1, activation='sigmoid')) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
import faiss | |
def search_knn(xq, xb, k, distance_type=faiss.METRIC_L2): | |
""" wrapper around the faiss knn functions without index """ | |
nq, d = xq.shape | |
nb, d2 = xb.shape | |
assert d == d2 |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
OlderNewer