- Plain Strings (207):
foo
- Anchors (208):
k$
- Ranges (202):
^[a-f]*$
- Backrefs (201):
(...).*\1
- Abba (169):
^(.(?!(ll|ss|mm|rr|tt|ff|cc|bb)))*$|^n|ef
- A man, a plan (177):
^(.)[^p].*\1$
- Prime (286):
^(?!(..+)\1+$)
- Four (199):
(.)(.\1){3}
- Order (198):
^[^o].....?$
- Triples (507):
(^39|^44)|(^([0369]|([147][0369]*[258])|(([258]|[147][0369]*[147])([0369]*|[258][0369]*[147])([147]|[258][0369]*[258])))*$)
#!/usr/bin/env python | |
# Ported to Python from http://www.vim.org/scripts/script.php?script_id=1349 | |
print "Color indexes should be drawn in bold text of the same color." | |
colored = [0] + [0x5f + 40 * n for n in range(0, 5)] | |
colored_palette = [ | |
"%02x/%02x/%02x" % (r, g, b) | |
for r in colored |
""" | |
Implementation of pairwise ranking using scikit-learn LinearSVC | |
Reference: "Large Margin Rank Boundaries for Ordinal Regression", R. Herbrich, | |
T. Graepel, K. Obermayer. | |
Authors: Fabian Pedregosa <fabian@fseoane.net> | |
Alexandre Gramfort <alexandre.gramfort@inria.fr> | |
""" |
#!/bin/sh | |
# Fresh install for CUDA 6.5 on Jetson TK1 for Linux for Tegra (L4T) 21.1 | |
# CUDA 6.5 REQUIRES L4T 21.1 !!! | |
sudo apt-add-repository universe | |
sudo apt-get update | |
# This is for L4T r21.1 ; Update for your L4T i.e. r21.3 | |
wget http://developer.download.nvidia.com/compute/cuda/6_5/rel/installers/cuda-repo-l4t-r21.1-6-5-prod_6.5-14_armhf.deb | |
# Install the CUDA repo metadata that you downloaded | |
# This is for L4T 21.1 ; Update for your L4T i.e. 21.3 |
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
# vispy: gallery 2 | |
# Copyright (c) 2014, Vispy Development Team. | |
# Distributed under the (new) BSD License. See LICENSE.txt for more info. | |
# | |
# Modified for animation with MoviePy by Zulko | |
# See result here: http://i.imgur.com/sSCBkFd.gif | |
# |
Beyond Compare 4 | |
Licensed to: ASIO Allsoftinone | |
Quantity: 1 user | |
Serial number: 1822-9597 | |
License type: Pro Edition for Windows | |
--- BEGIN LICENSE KEY --- | |
H1bJTd2SauPv5Garuaq0Ig43uqq5NJOEw94wxdZTpU-pFB9GmyPk677gJ | |
vC1Ro6sbAvKR4pVwtxdCfuoZDb6hJ5bVQKqlfihJfSYZt-xVrVU27+0Ja | |
hFbqTmYskatMTgPyjvv99CF2Te8ec+Ys2SPxyZAF0YwOCNOWmsyqN5y9t |
import torch | |
import torch.nn as nn | |
import torch.nn.parallel | |
class DCGAN_D(nn.Container): | |
def __init__(self, isize, nz, nc, ndf, ngpu, n_extra_layers=0): | |
super(DCGAN_D, self).__init__() | |
self.ngpu = ngpu | |
assert isize % 16 == 0, "isize has to be a multiple of 16" |
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
import json | |
import argparse | |
import numpy as np | |
import matplotlib | |
import matplotlib.pyplot as plt | |
matplotlib.rcParams['text.usetex'] = True | |
# Inspiration came from https://stackoverflow.com/q/3609852/8931942 |