Skip to content

Instantly share code, notes, and snippets.

@rhee-airilab
rhee-airilab / gitconfig
Created June 8, 2018 12:31
simple gitconfig
[color]
ui = auto
[diff]
external = sh -c 'vimdiff $2 $5' git_diff_wrapper
[pager]
diff =
[push]
default = simple
[core]
autocrlf = input
@rhee-airilab
rhee-airilab / simplify_svg.py
Created June 7, 2018 11:08
python simplify svg for webgl demo problem
from traceback import print_exc
import sys
def simplify_svg(svg_str,to_integer=True):
def to_number(s):
try:
if to_integer:
return int(float(str(s).strip()))
else:
@rhee-airilab
rhee-airilab / webcam-example.html
Created June 6, 2018 03:53
webcam-example.html
<html>
<head>
<!-- Load TensorFlow.js -->
</script>
<style>
#no-webcam {
display: none;
}
</style>
# coding: utf-8
import numpy as np
from numpy.lib.stride_tricks import as_strided
def make_sequence(y, frame_length, hop_length=1):
'''Slice a time series into overlapping frames.
code derived from:
https://librosa.github.io/librosa/_modules/librosa/util/utils.html
#!/usr/bin/env python
# code: utf-8
from __future__ import print_function, division, absolute_import
import numpy as np
class CumStats():
"""
Cumulative stats
CumStats(self, ddof=0)
@rhee-airilab
rhee-airilab / tensorboard_logging.py
Created September 15, 2017 00:32 — forked from gyglim/tensorboard_logging.py
Logging to tensorboard with manually generated summaries (not relying on summary ops)
"""Simple example on how to log scalars and images to tensorboard without tensor ops."""
__author__ = "Michael Gygli"
import tensorflow as tf
from StringIO import StringIO
import matplotlib.pyplot as plt
import numpy as np
class Logger(object):
"""Logging in tensorboard without tensorflow ops."""
--- tensorflow/contrib/rnn/python/ops/core_rnn_cell_impl.py.orig 2017-05-08 17:02:53.971000000 +0900
+++ tensorflow/contrib/rnn/python/ops/core_rnn_cell_impl.py 2017-05-08 17:39:43.810067656 +0900
@@ -558,9 +558,13 @@
return nest.map_structure(enumerated_fn, *args, **kwargs)
+VRDV_MIN, VRDV_MAX = 1.0e-30, 1.0e30 # XXX clip boundary for variational_rnn_dropout
+
+
class DropoutWrapper(RNNCell):