Skip to content

Instantly share code, notes, and snippets.

View wuxianliang's full-sized avatar

Xianliang Wu wuxianliang

  • Beijing No.2 Experimental Primary School
View GitHub Profile
@cburgdorf
cburgdorf / xor_keras.py
Last active November 18, 2020 11:23
Comparing XOR between tensorflow and keras
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'))
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
@VibhuJawa
VibhuJawa / gutenburg_read_tokenize_gv100_run.ipynb
Last active August 26, 2019 18:27
Gutenburg read tokenize gv100_run
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.