Skip to content

Instantly share code, notes, and snippets.

☕️

Jon Perl jperl

☕️
Block or report user

Report or block jperl

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@jperl
jperl / coordconv2d.py
Created May 14, 2019 — forked from Dref360/coordconv2d.py
Un-scaled version of CoordConv2D
View coordconv2d.py
import keras.backend as K
import tensorflow as tf
from keras.layers import Layer
"""Not tested, I'll play around with GANs soon with it."""
class CoordConv2D(Layer):
def __init__(self, channel, kernel, padding='valid', **kwargs):
self.layer = Conv2D(channel, kernel, padding=padding)
@jperl
jperl / ffmpeg.sh
Created Apr 27, 2019 — forked from kfei/ffmpeg.sh
Screen recording using a dockerized ffmpeg
View ffmpeg.sh
#!/bin/bash
docker run -it --rm --privileged --net host \
-v /tmp/.X11-unix:/tmp/.X11-unix \
-v $PWD:$HOME/workspace \
-v $HOME/.Xauthority:$HOME/.Xauthority \
-e HOME=$HOME \
-e DISPLAY=$DISPLAY \
--entrypoint /usr/sbin/ffmpeg \
kfei/ffmpeg $*
@jperl
jperl / ffmpeg.sh
Created Apr 27, 2019 — forked from kfei/ffmpeg.sh
Screen recording using a dockerized ffmpeg
View ffmpeg.sh
#!/bin/bash
docker run -it --rm --privileged --net host \
-v /tmp/.X11-unix:/tmp/.X11-unix \
-v $PWD:$HOME/workspace \
-v $HOME/.Xauthority:$HOME/.Xauthority \
-e HOME=$HOME \
-e DISPLAY=$DISPLAY \
--entrypoint /usr/sbin/ffmpeg \
kfei/ffmpeg $*
@jperl
jperl / dropout_bayesian_approximation_tensorflow.py Implementing Dropout as a Bayesian Approximation in TensorFlow
View dropout_bayesian_approximation_tensorflow.py
import numpy as np
import tensorflow as tf
import matplotlib.pyplot as plt
from tensorflow.contrib.distributions import Bernoulli
class VariationalDense:
"""Variational Dense Layer Class"""
def __init__(self, n_in, n_out, model_prob, model_lam):
self.model_prob = model_prob
View gist:6ce671ecb36cce99d41f6dc8964acf41
FLAGS = flags.FLAGS
if FLAGS.log_dir:
if not os.path.exists(FLAGS.log_dir):
os.makedirs(FLAGS.log_dir)
logging.get_absl_handler().use_absl_log_file()
@jperl
jperl / residual_network.py
Created Jan 12, 2019 — forked from mjdietzx/residual_network.py
Clean and simple Keras implementation of residual networks (ResNeXt and ResNet) accompanying accompanying Deep Residual Learning: https://blog.waya.ai/deep-residual-learning-9610bb62c355.
View residual_network.py
"""
Clean and simple Keras implementation of network architectures described in:
- (ResNet-50) [Deep Residual Learning for Image Recognition](https://arxiv.org/pdf/1512.03385.pdf).
- (ResNeXt-50 32x4d) [Aggregated Residual Transformations for Deep Neural Networks](https://arxiv.org/pdf/1611.05431.pdf).
Python 3.
"""
from keras import layers
from keras import models
@jperl
jperl / bashrc
Last active Jan 4, 2019
ubuntu ml environment notes
View bashrc
# cuda
export PATH=/usr/local/cuda-9.2/bin${PATH:+:${PATH}}
export LD_LIBRARY_PATH=/usr/local/cuda-9.2/lib64${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}
export LD_LIBRARY_PATH=/usr/local/cuda/extras/CUPTI/lib64:$LD_LIBRARY_PATH
# python
alias env='source ./env/bin/activate'
@jperl
jperl / TroubleshootCUDA.md
Last active Aug 12, 2018
Troubleshooting Ubuntu 18.04 CUDA Install
View TroubleshootCUDA.md

"nvidia-smi has failed because it couldn't communicate with the NVIDIA driver"

@jperl
jperl / ray_tune_reporter_hook.py
Created Jul 7, 2018 — forked from sseveran/ray_tune_reporter_hook.py
A Tensorflow hook for reporting state to ray-tune
View ray_tune_reporter_hook.py
import six
import tensorflow as tf
from tensorflow.python.framework import ops
from tensorflow.python.training import training_util
from tensorflow.python.training.session_run_hook import SessionRunArgs
class RayTuneReportingHook(tf.train.SessionRunHook):
def __init__(self, params, reporter):
self.reporter = reporter
@jperl
jperl / sequence_fixed_len_numeric_column.py
Last active Jul 2, 2018
Sequence Fixed Length Numeric Column
View sequence_fixed_len_numeric_column.py
def sequence_fixed_len_numeric_column(key,
shape=(1, ),
default_value=0.,
dtype=dtypes.float32,
normalizer_fn=None):
shape = fc._check_shape(shape=shape, key=key)
if not (dtype.is_integer or dtype.is_floating):
raise ValueError('dtype must be convertible to float. ' 'dtype: {}, key: {}'.format(dtype, key))
if normalizer_fn is not None and not callable(normalizer_fn):
raise TypeError('normalizer_fn must be a callable. Given: {}'.format(normalizer_fn))
You can’t perform that action at this time.