First of all, we have tf.device thing that tensorflow has to offer for us to choose which gpu we want. Like:
with tf.device('/gpu:0'):
a = tf.constant(3.0)
This allocates for gpu 0.
from ctypes import * | |
import math | |
import random | |
def sample(probs): | |
s = sum(probs) | |
probs = [a/s for a in probs] | |
r = random.uniform(0, 1) | |
for i in range(len(probs)): | |
r = r - probs[i] |
Section "InputClass" | |
Identifier "system-keyboard" | |
MatchIsKeyboard "on" | |
Option "XkbLayout" "us,np" | |
Option "XkbModel" "pc104" | |
Option "XkbVariant" ",dvorak" | |
Option "XkbOptions" "grp:lwin_toggle" | |
EndSection | |
# put this file in /etc/X11/xorg.conf.d/ |
#wget --load-cookies /tmp/cookies.txt "https://drive.google.com/uc?export=download&confirm=$(wget --quiet --save-cookies /tmp/cookies.txt --keep-session-cookies --no-check-certificate 'https://drive.google.com/uc?export=download&id=<FILEID>' -O- | sed -rn 's/.*confirm=([0-9A-Za-z_]+).*/\1\n/p')&id=<FILEID>" -O <FILENAME> && rm -rf /tmp/cookies.txt | |
#/usr/bin/env bash | |
echo "i am paradox" | |
FILEID="1hJKCb4eF1AJih_dhZOJSF5VR-ZtRNaap" | |
FILENAME="model.zip" | |
link="https://drive.google.com/uc?export=download&id=$FILEID" |
# POST simple text | |
curl -XPOST localhost:8000/test --data "i am paradox" -H "Content-Type: text/plain" | |
# POST JSON | |
# GET | |
curl -XGET localhost:8000/test |
def euclidean_distance(vects): | |
x, y = vects | |
sum_square = K.sum(K.square(x - y), axis=1, keepdims=True) | |
return K.sqrt(K.maximum(sum_square, K.epsilon())) | |
def eucl_dist_output_shape(shapes): | |
shape1, shape2 = shapes | |
return (shape1[0], 1) | |
def cosine_distance(vests): |
""" Python implementation of the OASIS algorithm. | |
Graham Taylor | |
Based on Matlab implementation of: | |
Chechik, Gal, et al. | |
"Large scale online learning of image similarity through ranking." | |
The Journal of Machine Learning Research 11 (2010): 1109-1135. | |
""" | |
from __future__ import division |
Convert sequence of image files into video.
The image filepaths are inside "files.txt" with each line representing.
mencoder -nosound -noskip -oac copy -ovc copy -o output.avi -mf fps=6 'mf://@files.txt'