Skip to content

Instantly share code, notes, and snippets.

View riga's full-sized avatar

Marcel Rieger riga

View GitHub Profile
@adityaiitb
adityaiitb / Saved_model_aot.md
Last active April 6, 2022 14:15
Tensorflow XLA Ahead-of-Time (AOT) compilation with Saved Model (TF2)

Frozen graph is deprecated in TF2. Using Saved model is the new approach. Instead of creating a configuration file and using bazel in steps 1 and 2 described here, simply use the saved_model_cli. The final compilation step of creating a binary can be performed using a makefile instead of bazel.

  1. Create a TF saved_model using tf.saved_model.save.
  2. Use the saved_model_cli to perform XLA AOT compilation.
saved_model_cli aot_compile_cpu \
    --dir resnet/1 \
    --tag_set serve \
 --signature_def_key serving_default \
@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.
@kmhofmann
kmhofmann / building_tensorflow.md
Last active August 11, 2024 14:14
Building TensorFlow from source

Building TensorFlow from source (TF 2.3.0, Ubuntu 20.04)

Why build from source?

The official instructions on installing TensorFlow are here: https://www.tensorflow.org/install. If you want to install TensorFlow just using pip, you are running a supported Ubuntu LTS distribution, and you're happy to install the respective tested CUDA versions (which often are outdated), by all means go ahead. A good alternative may be to run a Docker image.

I am usually unhappy with installing what in effect are pre-built binaries. These binaries are often not compatible with the Ubuntu version I am running, the CUDA version that I have installed, and so on. Furthermore, they may be slower than binaries optimized for the target architecture, since certain instructions are not being used (e.g. AVX2, FMA).

So installing TensorFlow from source becomes a necessity. The official instructions on building TensorFlow from source are here: ht

@iambibhas
iambibhas / scopes.txt
Last active June 16, 2024 20:45
Sublime Text 2: Snippet scopes
Here is a list of scopes to use in Sublime Text 2 snippets -
ActionScript: source.actionscript.2
AppleScript: source.applescript
ASP: source.asp
Batch FIle: source.dosbatch
C#: source.cs
C++: source.c++
Clojure: source.clojure
CoffeeScript: source.coffee