Skip to content

Instantly share code, notes, and snippets.

@ay27
ay27 / TF-cuda_opt.py
Last active September 17, 2021 09:32
[TF CUDA Optimization Options] All the tensorflow with cuda optimization you need! Will speedup at least 1.3 times in Volta and Turing architecture! Only works with the tensorflow gpu version build from source with cuda/cudnn support, or use the docker image from nvidia gpu cloud <ngc.nvidia.com>. #tensorflow #cuda
# mainly from:
# 1. https://docs.nvidia.com/cuda/cuda-c-programming-guide/index.html#env-vars
# 2. https://github.com/NVIDIA/DeepLearningExamples/issues/57
# 3. https://docs.nvidia.com/deeplearning/frameworks/tensorflow-user-guide/index.html#variablesaddtf
def is_using_hvd():
env_vars = ["OMPI_COMM_WORLD_RANK", "OMPI_COMM_WORLD_SIZE"]
if all([var in os.environ for var in env_vars]):
return True
@peterroelants
peterroelants / mnist_estimator.py
Last active February 14, 2024 11:26
Example using TensorFlow Estimator, Experiment & Dataset on MNIST data.
"""Script to illustrate usage of tf.estimator.Estimator in TF v1.3"""
import tensorflow as tf
from tensorflow.examples.tutorials.mnist import input_data as mnist_data
from tensorflow.contrib import slim
from tensorflow.contrib.learn import ModeKeys
from tensorflow.contrib.learn import learn_runner
# Show debugging output
@AustinRochford
AustinRochford / pydata_dc_2016_vi_in_python.ipynb
Last active October 28, 2022 13:00
PyData DC 2016 Variational Inference in Python
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@AustinRochford
AustinRochford / Bayesian Survival Analysis.ipynb
Last active May 5, 2024 23:32
Bayesian Survival Analysis PyMC3 Tutorial
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.