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
@profile | |
def func1(i: float): | |
import time | |
time.sleep(i) | |
@profile | |
def func_mother(): | |
func1(1.2) | |
a = 2 + 3 |
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
from fast_flask import Flask | |
app = Flask(__name__) | |
@app.get("/users/") # equivalent to `@app.route("/users/")` from flask.Flask | |
def get_user_details(user_id: int = 123): | |
return {"123": "bob"} | |
if __name__ == "__main__": |
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 gradio as gr | |
import numpy as np | |
import tensorflow as tf | |
import requests | |
# Load a classification model | |
model = tf.keras.applications.MobileNetV3Large( | |
input_shape=None, | |
alpha=1.0, | |
minimalistic=False, |
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
-- Learn Lua in 15 Minutes | |
-- Two dashes start a one-line comment. | |
--[[ | |
Adding two ['s and ]'s makes it a | |
multi-line comment. | |
--]] | |
---------------------------------------------------- |
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 | |
ReduceMean = lambda axis=1: tf.keras.layers.Lambda(lambda x: tf.reduce_mean(x, axis=axis)) | |
i = tf.keras.layers.Input(shape=(5,15)) # shape: [BATCHSIZE, 5, 15] | |
m = ReduceMean(i) # shape: [BATCHSIZE, 15] | |
# TODO would be nice to have a wrapping function for any TF op with arbitrary |
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
# ln -s /path/to/this/.autoenv.sh /path/to/workdir/ | |
if test -f .autoenv_conda_env_name ; then | |
TARGET_CONDA_ENV="$(cat .autoenv_conda_env_name)" | |
if [[ $TARGET_CONDA_ENV != $CONDA_DEFAULT_ENV ]]; then | |
conda activate "$TARGET_CONDA_ENV" 2&>1 2> /dev/null | |
fi | |
else | |
CUR_DIR=$(basename $(pwd)) | |
conda activate "$CUR_DIR-dev" 2> /dev/null \ |
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 perfboxplot( | |
setup, | |
kernels, | |
labels, | |
n=3, | |
xlabel="Performances", | |
equality_check=None, | |
save_path=None, | |
log_scale=True, | |
): |
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 pandas as pd | |
import seaborn as sbn | |
from matplotlib import pyplot as plt | |
from scipy.stats import anderson | |
from sklearn import datasets | |
from sklearn.cluster import MiniBatchKMeans | |
from sklearn.preprocessing import scale, LabelEncoder | |
# TODO doc, memoization |
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
[user] | |
name = Keuv Grvl | |
email = k***@***m | |
[core] | |
quotepath = false | |
editor = vim | |
pager = less -F -x2 | |
[init] | |
defaultBranch = main | |
[push] |
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
class FItSNE_wrapper: | |
""" | |
Wrapper class for FItSNE `fast_tsne.fast_tsne` v1.1.0. | |
It is currently designed to work in a Conda environment with Python 3.7 and FFTW 3. | |
Install and compile as follow: | |
$ conda create -n YOUR-ENV python=3.7 fftw=3 | |
$ source activate YOUR-ENV |