This file contains 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
/* | |
* Copyright (c) 2009-2017, Farooq Mela | |
* All rights reserved. | |
* | |
* Redistribution and use in source and binary forms, with or without | |
* modification, are permitted provided that the following conditions are met: | |
* | |
* 1. Redistributions of source code must retain the above copyright | |
* notice, this list of conditions and the following disclaimer. | |
* 2. Redistributions in binary form must reproduce the above copyright |
This file contains 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
" VIM Configuration File | |
" Description: Optimized for C/C++ development, but useful also for other things. | |
" Author: Gerhard Gappmeier | |
" | |
" set UTF-8 encoding | |
set enc=utf-8 | |
set fenc=utf-8 | |
set termencoding=utf-8 | |
" disable vi compatibility (emulation of old bugs) |
This file contains 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
" Cycle metasyntactic variables | |
function! s:CycleMetasyntacticVariables(num) | |
if type(a:num) != type(0) | |
return | |
endif | |
let vars = ['foo', 'bar', 'baz', 'qux', 'quux', 'corge', 'grault', 'garply', 'waldo', 'fred', 'plugh', 'xyzzy', 'thud'] | |
let cvar = expand('<cword>') | |
let i = index(vars, cvar) |
This file contains 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
docker run -rm -t -i -v $(dirname $SSH_AUTH_SOCK) -e SSH_AUTH_SOCK=$SSH_AUTH_SOCK ubuntu /bin/bash |
This file contains 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 argparse | |
import numpy as np | |
from chainer import Variable, FunctionSet, optimizers, cuda | |
import chainer.functions as F | |
import cv2 | |
import random | |
import cPickle as pickle | |
import sys | |
class ConvolutionalAutoencoder(FunctionSet): |
This file contains 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 ipdb | |
import numpy as np | |
import numpy.linalg as nl | |
import matplotlib.pyplot as plt | |
from scipy.spatial.distance import pdist, cdist, squareform | |
def makeT(cp): | |
# cp: [K x 2] control points | |
# T: [(K+3) x (K+3)] | |
K = cp.shape[0] |
This file contains 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
# Starting minikube with 8Gb of memory and 3 CPUs | |
minikube --memory 8192 --cpus 3 start | |
# Creating separate Namespace for Spark driver and executor pods | |
kubectl create namespace spark | |
# Creating ServiceAccount and ClusterRoleBinding for Spark | |
kubectl create serviceaccount spark-serviceaccount --namespace spark | |
kubectl create clusterrolebinding spark-rolebinding --clusterrole=edit --serviceaccount=spark:spark-serviceaccount --namespace=spark |
Inheritance and Virtual Table are often used to create interface in C++ polymorphic class
What if ... there were another way to do this ?
easier, cleaner, faster and more reliable
This article explains how to useCRTP
, [std::variant
](https://en.cppreference.com/w/cpp/utility/variant andstd::visit
to increase code performance.
This file contains 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 top_k_top_p_filtering(logits, top_k=0, top_p=0.0, filter_value=-float('Inf')): | |
""" Filter a distribution of logits using top-k and/or nucleus (top-p) filtering | |
Args: | |
logits: logits distribution shape (vocabulary size) | |
top_k >0: keep only top k tokens with highest probability (top-k filtering). | |
top_p >0.0: keep the top tokens with cumulative probability >= top_p (nucleus filtering). | |
Nucleus filtering is described in Holtzman et al. (http://arxiv.org/abs/1904.09751) | |
""" | |
assert logits.dim() == 1 # batch size 1 for now - could be updated for more but the code would be less clear | |
top_k = min(top_k, logits.size(-1)) # Safety check |
OlderNewer