Enter this in the search box along with your search terms:
Get all gists from the user santisbon.
user:santisbon
Find all gists with a .yml extension.
extension:yml
Find all gists with HTML files.
language:html
Enter this in the search box along with your search terms:
Get all gists from the user santisbon.
user:santisbon
Find all gists with a .yml extension.
extension:yml
Find all gists with HTML files.
language:html
Here's a simple implementation of bilinear interpolation on tensors using PyTorch.
I wrote this up since I ended up learning a lot about options for interpolation in both the numpy and PyTorch ecosystems. More generally than just interpolation, too, it's also a nice case study in how PyTorch magically can put very numpy-like code on the GPU (and by the way, do autodiff for you too).
For interpolation in PyTorch, this open issue calls for more interpolation features. There is now a nn.functional.grid_sample()
feature but at least at first this didn't look like what I needed (but we'll come back to this later).
In particular I wanted to take an image, W x H x C
, and sample it many times at different random locations. Note also that this is different than upsampling which exhaustively samples and also doesn't give us fle
# Refer https://fizzylogic.nl/2017/11/06/edit-jupyter-notebooks-over-ssh/ | |
# On server | |
jupyter notebook --no-browser --port=8080 | |
# On local machine | |
ssh -N -L 8080:localhost:8080 <remote_user>@<remote_host> |
tail -f logs.txt | |
watch -n1 nvidia-smi | |
htop | |
watch -n 1 free -h |
# https://stackoverflow.com/a/52076633/3776827 | |
# Run as download_drive_file.sh file_id | |
# where file_id is google drive file id | |
# https://drive.google.com/file/d/0B-u9nH58139bTy1XRFdqaVEzUGs/view | |
# Eg. file_id here is 0B-u9nH58139bTy1XRFdqaVEzUGs | |
curl gdrive.sh | bash -s $1 |
from collections import defaultdict | |
# method 1 | |
my_dict = defaultdict(int) | |
my_dict[key] += 1 | |
# method 2 | |
my_dict = {} | |
my_dict[key] = my_dict.get(key, 0) + 1 |
from wordcloud import WordCloud, STOPWORDS | |
from PIL import Image | |
import urllib | |
import requests | |
import numpy as np | |
import matplotlib.pyplot as plt | |
words = 'access guest guest apartment area area bathroom bed bed bed bed bed bedroom block coffee coffee coffee coffee entrance entry francisco free garden guest home house kettle kettle kitchen kitchen kitchen kitchen kitchen kitchenliving located microwave neighborhood new park parking place privacy private queen room san separate seperate shared space space space street suite time welcome' | |
mask = np.array(Image.open(requests.get('http://www.clker.com/cliparts/O/i/x/Y/q/P/yellow-house-hi.png', stream=True).raw)) |