STT-tensorflow/tensorflow/c/experimental/saved_model
Brian Zhao ebf57bdfc7 Moving RAII helpers for TensorHandle, Tensor, and Operation to their respective classes.
PiperOrigin-RevId: 317578771
Change-Id: Iaf674696ea7d7dfdf94924f4c60d555a613c5f57
2020-06-21 19:12:38 -07:00
..
core Moving RAII helpers for TensorHandle, Tensor, and Operation to their respective classes. 2020-06-21 19:12:38 -07:00
internal Split Abstract interfaces into Abstract and ImmediateExecution interfaces. 2020-06-17 12:39:13 -07:00
public Removing TensorHandleList Delete APIs, since TensorHandleList pointer is owned by ConcreteFunction. 2020-05-14 08:58:40 -07:00
README.md

README.md

Tensorflow C SavedModel API

Overview

These are the new experimental C SavedModel APIs for loading and running SavedModels in a TF2-idiomatic fashion. See RFC 207 for additional context.

The directory structure is as follows:

saved_model/

  public/

  internal/

  core/

saved_model/public

saved_model/public is intended to house only the public headers of the SavedModel C API.

These headers:

  1. declare opaque C types (like TF_SavedModel),

  2. declare the functions that operate on these types (like TF_LoadSavedModel).

Once they leave experimental, these APIs should be considered stable for use by external clients.

These headers are in a separate directory to make it obvious to clients which headers they should depend on, and which headers are implementation details. Separating these public headers by directory also allow future programmatic checks to ensure that TF public headers only #include other public TF headers.

saved_model/internal

saved_model/internal is the "glue" between the C API and the internal C++ implementation.

Its role is to:

  1. implement the C API functions declared in saved_model/public

  2. define the C API types declared in saved_model/public

The files fulfilling 1. are named *.cc (eg: concrete_function.cc), while the files fulfilling 2. are *type.h (eg: concrete_function_type.h).

The headers exposing the internal implementation of the opaque C types are only visible to other implementors of the C API. This is similar to how other TF C API implementations use tf_status_internal.h (to extract the underlying tensorflow::Status). All other targets in this directory are private.

saved_model/core

saved_model/core contains pure C++ "Classes" underlying the C API types in saved_model/public/. These are implementation details subject to change, and have limited visibility to implementors only. This is the bottom-most layer of the C++ -> C -> C++ sandwich.