#Create bitbucket branch
##Create local branch
$ git checkout -b sync
Switched to a new branch 'sync'
$ git branch
master
* sync
| # null.py | |
| import numpy as np | |
| from scipy.linalg import qr | |
| def qr_null(A, tol=None): | |
| Q, R, P = qr(A.T, mode='full', pivoting=True) | |
| tol = np.max(A) * np.finfo(R.dtype).eps if tol is None else tol | |
| rnk = min(A.shape) - np.abs(np.diag(R))[::-1].searchsorted(tol) | |
| return Q[:, rnk:].conj() |
| import numpy as np | |
| import bottleneck as bn | |
| def top_n_indexes(arr, n): | |
| idx = bn.argpartsort(arr, arr.size-n, axis=None)[-n:] | |
| width = arr.shape[1] | |
| return [divmod(i, width) for i in idx] | |
| np.random.seed(47) |
| # conda-env-autodetect.plugin.zsh | |
| # Copy this file to ~/.oh-my-zsh/plugins/conda-env-autodetect/ | |
| # And make sure you have a .venv file with your env's name in your | |
| # preject's root folder. | |
| _conda_env_auto_activate() { | |
| if [ -f ".venv" ]; then | |
| # check conda is active |
#Create bitbucket branch
##Create local branch
$ git checkout -b sync
Switched to a new branch 'sync'
$ git branch
master
* sync
| import time | |
| import numpy as np | |
| from skimage.transform import resize | |
| from PIL import Image | |
| def pil_resize(x, target, method=Image.NEAREST): | |
| img = Image.fromarray(x) | |
| return np.array(img.resize(target, resample=method)) |
| running install | |
| running build_deps | |
| -- The C compiler identification is AppleClang 8.0.0.8000042 | |
| -- The CXX compiler identification is AppleClang 8.0.0.8000042 | |
| -- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc | |
| -- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc -- works | |
| -- Detecting C compiler ABI info | |
| -- Checking if C linker supports --verbose | |
| -- Checking if C linker supports --verbose - no | |
| -- Detecting C compiler ABI info - done |
| -- credit to Jesse Paroz (@jparoz) | |
| local FG = { | |
| black = 30, | |
| red = 31, | |
| green = 32, | |
| yellow = 33, | |
| blue = 34, | |
| magenta = 35, | |
| cyan = 36, | |
| white = 37, |
| # This should work with xitari (the c++ Arcade Learning Environment fork) too. | |
| # Define a type for the c struct pointer | |
| type DoomGame end | |
| # Load the shared object. This needs to expose c functions (see "extern C") | |
| newGame = ccall( (:vizdoom_new, "libvizdoom"), Ptr{DoomGame}, ()) | |
| # Load a configuration file. | |
| hasLoaded = ccall( (:vizdoom_loadConfig, "libvizdoom"), Bool, (Ptr{DoomGame},Cstring), newGame, "../../examples/config/basic.cfg") |
| require 'torch' | |
| require 'cutorch' | |
| require 'nn' | |
| require 'cunn' | |
| require 'cudnn' | |
| local N = 32 | |
| local cin = 64 | |
| local cout = 64 | |
| local height = 256 |
| require 'nn' | |
| require 'cutorch' | |
| require 'cunn' | |
| --[[ | |
| -- A simple benchmark comparing fully-connected net times on CPU and GPU. | |
| -- | |
| -- Note that we don't count time it takes to transfer data to the GPU. | |
| --]] |