Skip to content

Instantly share code, notes, and snippets.

@carlthome
carlthome / tfcompile.ipynb
Last active October 11, 2022 16:14
Example of how to use XLA AOT via tfcompile to build a Keras model into a shared library.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@ictlyh
ictlyh / producer-consumer
Created November 30, 2016 10:55
Producer and consumer demo in concurrent queue. c++ multi-threading.
// concurrent-queue.h
#ifndef CONCURRENT_QUEUE_H_
#define CONCURRENT_QUEUE_H_
#include <queue>
#include <thread>
#include <mutex>
#include <condition_variable>
template <typename T>
@Ludophonic
Ludophonic / Half.natvis
Last active July 18, 2025 21:27
Visual studio type visualizer for half precision (16 bit) floating point values.
<?xml version="1.0" encoding="utf-8"?>
<AutoVisualizer xmlns="http://schemas.microsoft.com/vstudio/debugger/natvis/2010">
<Type Name="half">
<DisplayString Condition = "fp16.Exponent == 0">{(0.00006103515625f * fp16.Mantissa/1024.0f)}</DisplayString>
<DisplayString Condition = "fp16.Exponent == 31 &amp;&amp; fp16.Mantissa == 0">{fp16.Sign*-2+1}.#INFINITY</DisplayString>
<DisplayString Condition = "fp16.Exponent == 31">#NaN</DisplayString>
<DisplayString Condition = "fp16.Exponent &lt; 15">{1.0f / (1 &lt;&lt; (15 - fp16.Exponent)) * (fp16.Sign*-2+1.0f) * (1.0f + fp16.Mantissa/1024.0f)}</DisplayString>
<DisplayString Condition = "fp16.Exponent &gt; 15">{(1 &lt;&lt; (fp16.Exponent-15)) * (fp16.Sign*-2+1.0f) * (1.0f + fp16.Mantissa/1024.0f)}</DisplayString>
<DisplayString>{(fp16.Sign*-2+1) * (1.0f + fp16.Mantissa/1024.0f)}</DisplayString>