Blog

A Broad Spectrum of TensorFlow APIs Inside and Outside the Project

Sophie Turol

tensorflow-data-pipeline-v12

Since its launch in 2015, TensorFlow has grown into a major player on machine learning scene. Being actively developed, the tool now offers a bunch of stable low-level APIs with some high-level ones being implemented at a rapid pace.

From this blog post, learn about APIs cultivated both inside the core TensorFlow project—including the ones for different languages—and outside it, still worth checking out.

 

TensorFlow APIs for different languages

Aaron Schumacher

Aaron Schumacher

In his webinar, Aaron Schumacher of Deep Learning Analytics toured through the diversity of APIs available in TensorFlow.

So, there are quite a few APIs for various programming languages.

  • The C API is mainly utilized in case one needs to build an API for some other language.
  • The C++ API is still somewhat experimental and can be employed in a number of deployment scenarios one chooses. It is exposed via header files in tensorflow/cc. (Note that TensorFlow runtime is written in C++.)
  • The Python API is probably the most developed API at the moment with handful of features to enjoy.
  • The R API—developed by RStudio—wraps the Python API, thus granting access to all its features, which would be more laboursome experience if enabling replication via the C API.

Furthermore, there are APIs for Java, Go, Rust, Haskell, and unofficial ones—designed outside the core TensorFlow project—for C# and Julia.

 

APIs inside TensorFlow

Still Python-based, there are such low-level options as tf.matmul and tf.nn.relu, which can be of help when building a neural network architecture and needing to have a tight control over the process.

The layers API will aid one in designing deep neural networks, providing “a first higher level of abstraction over writing things by individual ops.” Aaron exemplifies tf.layers.conv2d that implements a convolutional layer with multiple individual ops.

With the Estimators API, one can define an interface, deliver models to fit into the Estimator system, or tune those models. Then, there are canned estimators—pre-defined models following the estimator conventions (e.g., LinearRegressor or DNNClassifier). The functionality available through this collection:

  • automatic checkpoints
  • automatic logging
  • separate training/evaluation/prediction
  • simplified training distribution

tensorflow-apis-canned-estimators-v113Source

Well aware of the sophisticated multi-thread, multi-queue, and queue-runner design that TensorFlow offers for loading data, its developers delivered the Dataset API to address this issue and provide a candy interface as a bonus.

tensorflow-data-pipelineTensorFlow data pipeline (Source)

Other well-know options to check out include TF-Slim, Keras, and scikit-learn.

 

APIs outside TensorFlow

Then, there are options cultivated outside the core project by fellow machine learning enthusiasts.

  • TFLearn (shouldn’t be confused with TF Learn, which is TensorFlow’s tf.contrib.learn) is a separate Python package.
  • TensorLayer comes as a separate package as well and is quite different from what TensorFlow’s layers API has in stall.
  • Pretty Tensor is actually a Google’s project, offering fluent interfaces with spoonful of chaining.
  • Sonnet, a project of Google’s DeepMind, features a modular approach to that of Torch/NN.

The Jupyter notebook with the supporting files for code demos can be found on Aaron’s GitHub page. For more details, check out his blog post, read Q&As from the webcast on the topic, or view the full webinar recording.

 

Related reading

 

About the speaker

Aaron Schumacher is a data scientist and software engineer for Deep Learning Analytics. He has taught with Python and R for General Assembly and the Metis data science bootcamp. Aaron has also worked with data at Booz Allen Hamilton, New York University, and the New York City Department of Education. You can check out his GitHub repo.


To stay tuned with the latest updates, subscribe to our blog or follow @altoros.

Get new posts right in your inbox!

No Comments

Benchmarks and Research

Subscribe to new posts

Get new posts right in your inbox!