This is my song.
This file contains 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
def insertion_sort(array) | |
i = 0 | |
while i < array.length | |
j = 0 | |
while array[j] < array[i] | |
j += 1 | |
end | |
# array[j] is the first element >= array[i] | |
# delete array[i] and move it to just before position j |
This file contains 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
#!/usr/bin/env bash | |
gcc -std=c11 -mavx -mavx2 convolution_test.c -o convolution_test |
This file contains 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 tensorflow as tf | |
# Notice that x and y have the same initial value, but y_var has | |
# totally different scale from x_var. Therefore y_var has much farther | |
# to change than x_var. | |
x_var = tf.Variable(1.0) | |
y_var = tf.Variable(100.0) | |
y_var_scaled = y_var / 100.0 | |
# This is just a silly linear equation. It will have a derivative of 2 |
This file contains 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 keras.backend as K | |
from keras.datasets import mnist | |
from keras.layers import Dense, Flatten, Input, Reshape | |
from keras.models import Model | |
from keras.optimizers import Adam | |
import numpy as np | |
# == This code trains a denoising autoencoder. == | |
input_tensor = Input(shape = (28, 28)) | |
flattened_input = Flatten()(input_tensor) |
This file contains 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
# Resource: https://keras.io/getting-started/functional-api-guide/ | |
import keras.backend as K | |
from keras.datasets import mnist | |
from keras.layers import Dense, Input, Lambda | |
from keras.models import Model | |
from keras.optimizers import Adam | |
from keras.utils import to_categorical | |
import numpy as np |
This file contains 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
promise.then((result) => { | |
// promise resolved successfully. | |
console.log(`Result is ${result}`); | |
}, (error) => { | |
// promise was failed | |
console.log(`Error is ${error}`); | |
}); | |
// Also: promise.then(null, (error) => { ... }) is the same as promise.catch((error) => { ... }). | |
// The Promise#catch method is just a convenience. You can always just pass a null success handler to then. |
This file contains 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
from keras.datasets import imdb | |
import numpy as np | |
TOP_N_WORDS = 1_000 | |
(x_train, y_train), (x_test, y_test) = imdb.load_data( | |
num_words = TOP_N_WORDS | |
) | |
# Transform dataset from variable-length word sequences to a | |
# binary valued dense matrix. |
OlderNewer