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 tensorflow as tf | |
| from src.utils.dtypes import tf_float_type | |
| def conj_gradient(A, b, iters): | |
| # todo can be optimized | |
| x = tf.zeros_like(b) | |
| r = b - tf.matmul(A, x) | |
| p = r |
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 matplotlib.pyplot as plt | |
| from matplotlib import animation | |
| import numpy as np | |
| fig = plt.figure() | |
| ax = plt.axes(xlim=(-2,5), ylim=(0,10)) | |
| line, = ax.plot([], []) | |
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
| """ | |
| Example showing that backward pass of conv layer can be done using transposed convolution | |
| """ | |
| import numpy as np | |
| a_prev = np.array([ | |
| [1,1,1,1], | |
| [2,2,2,2], | |
| [3,3,3,3], | |
| [4,4,4,4] |
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 pyaudio | |
| import numpy as np | |
| import matplotlib.pyplot as plt | |
| from scipy.fftpack import fft | |
| import matplotlib.animation as animation | |
| CHUNK = 1024 # signal is split into CHUNK number of frames | |
| FORMAT = pyaudio.paInt16 |
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
| 1. Create virtualenv | |
| 2. source created_env/bin/activate | |
| 3. (created_env) pip install ipykernel | |
| 4. (created_env) ipython kernel install --user --name=created_env | |
| 5. jupyter kernelspec list | |
| 6. go in the folder of your newly created kernel and verify it correctly points to the python executable of the newly created | |
| environment(this can be seen in kernel.json file) |
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
| def little_endian(hex_str): | |
| hex_str = fix_hex(hex_str) | |
| chars = [hex_str[i:i+2] for i in range(0, len(hex_str), 2)][::-1] | |
| return bytes.fromhex("".join(chars)) | |
| def remove0x(hex_str): | |
| return hex_str[2:] | |
| def half(hex_str): | |
| hex_str = fix_hex(hex_str) |
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 turtle | |
| import sys | |
| def update_maps(graph, turtle, color): | |
| graph[turtle_pos(turtle)] = color | |
| def turtle_pos(turtle): | |
| return (round(turtle.xcor()), round(turtle.ycor())) |
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
| #include <stdio.h> | |
| #define ORDER 3 | |
| #define DIM ORDER*ORDER | |
| int checkLine(int m[DIM][DIM], int line) | |
| { | |
| int i, j; | |
| for (i = 0; i < DIM-1; i++) | |
| for (j = i+1; j < DIM; j++) | |
| if (m[line][i] == m[line][j] && |