Skip to content

Instantly share code, notes, and snippets.

View xd009642's full-sized avatar
🦀
Crab People! Crab People! Crab People!

xd009642

🦀
Crab People! Crab People! Crab People!
View GitHub Profile
@danijar
danijar / blog_tensorflow_scope_decorator.py
Last active January 17, 2023 01:58
TensorFlow Scope Decorator
# Working example for my blog post at:
# https://danijar.github.io/structuring-your-tensorflow-models
import functools
import tensorflow as tf
from tensorflow.examples.tutorials.mnist import input_data
def doublewrap(function):
"""
A decorator decorator, allowing to use the decorator to be used without
@preshing
preshing / capped_spsc_queue.cpp
Created October 23, 2014 00:13
Generate benchmarks for three implementations of a wait-free queue using C++11 atomics
//
// Generate benchmarks for the three queue implementations shown in
// Jeff Preshing's CppCon 2014 talk, "How Ubisoft Montreal Develops Games for
// Multicore - Before and After C++11".
//
// Slides: https://github.com/CppCon/CppCon2014/blob/master/Presentations/How%20Ubisoft%20Montreal%20Develops%20Games%20for%20Multicore/How%20Ubisoft%20Montreal%20Develops%20Games%20for%20Multicore%20-%20Before%20and%20After%20C++11%20-%20Jeff%20Preshing%20-%20CppCon%202014.pdf?raw=true
//
#include <iostream>
#include <atomic>