tensorflow_cpp 1.0.6
|
Namespace for tensorflow_cpp library. More...
Classes | |
class | Model |
Wrapper class for running TensorFlow SavedModels or FrozenGraphs. More... | |
Functions | |
tf::GraphDef | loadFrozenGraph (const std::string &file) |
Loads a TensorFlow graph from a frozen graph file. | |
bool | loadGraphIntoSession (tf::Session *session, const tf::GraphDef &graph_def) |
Loads a TensorFlow graph into an existing session. | |
tf::Session * | loadFrozenGraphIntoNewSession (const std::string &file, const bool allow_growth=true, const double per_process_gpu_memory_fraction=0, const std::string &visible_device_list="") |
Loads a TensorFlow graph from a frozen graph file into a new session. | |
std::vector< std::string > | getGraphInputNames (const tf::GraphDef &graph_def) |
Determines the names of all graph input nodes. | |
std::vector< std::string > | getGraphOutputNames (const tf::GraphDef &graph_def) |
Determines the names of all graph output nodes. | |
std::vector< int > | getGraphNodeShape (const tf::GraphDef &graph_def, const std::string &node_name) |
Determines the shape of a given graph node. | |
tf::DataType | getGraphNodeType (const tf::GraphDef &graph_def, const std::string &node_name) |
Determines the datatype of a given graph node. | |
std::string | getGraphInfoString (const tf::GraphDef &graph_def) |
tf::SavedModelBundleLite | loadSavedModel (const std::string &dir, const bool allow_growth=true, const double per_process_gpu_memory_fraction=0, const std::string &visible_device_list="") |
Loads a TensorFlow SavedModel from a directory into a new session. | |
tf::Session * | loadSavedModelIntoNewSession (const std::string &dir, const bool allow_growth=true, const double per_process_gpu_memory_fraction=0, const std::string &visible_device_list="") |
Loads a TensorFlow SavedModel from a directory into a new session. | |
tf::Session * | getSessionFromSavedModel (const tf::SavedModelBundleLite &saved_model) |
Returns the session that a SavedModel is loaded in. | |
std::string | getSavedModelNodeByLayerName (const tf::SavedModelBundleLite &saved_model, const std::string &layer_name, const std::string &signature="serving_default") |
Determines the node name from a SavedModel layer name. | |
std::string | getSavedModelLayerByNodeName (const tf::SavedModelBundleLite &saved_model, const std::string &node_name, const std::string &signature="serving_default") |
Determines the layer name from a SavedModel node name. | |
std::vector< std::string > | getSavedModelInputNames (const tf::SavedModelBundleLite &saved_model, const bool layer_names=false, const std::string &signature="serving_default") |
Determines the names of the SavedModel input nodes. | |
std::vector< std::string > | getSavedModelOutputNames (const tf::SavedModelBundleLite &saved_model, const bool layer_names=false, const std::string &signature="serving_default") |
Determines the names of the SavedModel output nodes. | |
std::vector< int > | getSavedModelNodeShape (const tf::SavedModelBundleLite &saved_model, const std::string &node_name, const std::string &signature="serving_default") |
Determines the shape of a given SavedModel node. | |
tf::DataType | getSavedModelNodeType (const tf::SavedModelBundleLite &saved_model, const std::string &node_name, const std::string &signature="serving_default") |
Determines the datatype of a given SavedModel node. | |
std::string | getSavedModelInfoString (const tf::SavedModelBundleLite &saved_model) |
tf::SessionOptions | makeSessionOptions (const bool allow_growth=true, const double per_process_gpu_memory_fraction=0, const std::string &visible_device_list="") |
Helps to quickly create SessionOptions. | |
tf::Session * | createSession (const bool allow_growth=true, const double per_process_gpu_memory_fraction=0, const std::string &visible_device_list="") |
Creates a new TensorFlow session. | |
Namespace for tensorflow_cpp library.
|
inline |
Creates a new TensorFlow session.
[in] | allow_growth | dynamically grow GPU usage |
[in] | per_process_gpu_memory_fraction | maximum GPU memory fraction |
[in] | visible_device_list | list of GPUs to use, e.g. "0,1" |
Definition at line 78 of file utils.h.
|
inline |
Returns information about a FrozenGraph model.
Returns a formatted message containing information about the shape and type of all inputs/outputs of a FrozenGraph.
Currently limited to single-output graphs.
[in] | graph_def | graph |
Definition at line 221 of file graph_utils.h.
|
inline |
Determines the names of all graph input nodes.
[in] | graph_def | graph |
Definition at line 118 of file graph_utils.h.
|
inline |
Determines the shape of a given graph node.
[in] | graph_def | graph |
[in] | node_name | node name |
Definition at line 168 of file graph_utils.h.
|
inline |
Determines the datatype of a given graph node.
[in] | graph_def | graph |
[in] | node_name | node name |
Definition at line 194 of file graph_utils.h.
|
inline |
Determines the names of all graph output nodes.
[in] | graph_def | graph |
Definition at line 137 of file graph_utils.h.
|
inline |
Returns information about a SavedModel model.
Returns a formatted message containing information about the shape and type of all inputs/outputs of all SavedModel signatures.
[in] | saved_model | SavedModel |
Definition at line 340 of file saved_model_utils.h.
|
inline |
Determines the names of the SavedModel input nodes.
These are the names that need to be passed to session->Run
. Alternatively, using layer_names
, the layer names can be returned.
Returned names are sorted alphabetically, since their order is not deterministic in general. The sorting is always based on the actual node names, even when returning layer names.
[in] | saved_model | SavedModel |
[in] | layer_names | whether to return layer names |
[in] | signature | SavedModel signature to query |
Definition at line 198 of file saved_model_utils.h.
|
inline |
Determines the layer name from a SavedModel node name.
Layer names are specified during model construction, node names must be passed to session->Run
.
[in] | saved_model | SavedModel |
[in] | node_name | node name |
[in] | signature | SavedModel signature to query |
Definition at line 159 of file saved_model_utils.h.
|
inline |
Determines the node name from a SavedModel layer name.
Layer names are specified during model construction, node names must be passed to session->Run
.
[in] | saved_model | SavedModel |
[in] | layer_name | layer name |
[in] | signature | SavedModel signature to query |
Definition at line 124 of file saved_model_utils.h.
|
inline |
Determines the shape of a given SavedModel node.
[in] | saved_model | SavedModel |
[in] | node_name | node name |
[in] | signature | SavedModel signature to query |
Definition at line 273 of file saved_model_utils.h.
|
inline |
Determines the datatype of a given SavedModel node.
[in] | saved_model | SavedModel |
[in] | node_name | node name |
[in] | signature | SavedModel signature to query |
Definition at line 307 of file saved_model_utils.h.
|
inline |
Determines the names of the SavedModel output nodes.
These are the names that need to be passed to session->Run
. Alternatively, using layer_names
, the layer names can be returned.
Returned names are sorted alphabetically, since their order is not deterministic in general. The sorting is always based on the actual node names, even when returning layer names.
[in] | saved_model | SavedModel |
[in] | layer_names | whether to return layer names |
[in] | signature | SavedModel signature to query |
Definition at line 239 of file saved_model_utils.h.
|
inline |
Returns the session that a SavedModel is loaded in.
[in] | saved_model | SavedModel |
Definition at line 105 of file saved_model_utils.h.
|
inline |
Loads a TensorFlow graph from a frozen graph file.
[in] | file | frozen graph file |
Definition at line 53 of file graph_utils.h.
|
inline |
Loads a TensorFlow graph from a frozen graph file into a new session.
[in] | file | frozen graph file |
[in] | allow_growth | dynamically grow GPU usage |
[in] | per_process_gpu_memory_fraction | maximum GPU memory fraction |
[in] | visible_device_list | list of GPUs to use, e.g. "0,1" |
Definition at line 97 of file graph_utils.h.
|
inline |
Loads a TensorFlow graph into an existing session.
[in] | session | session |
[in] | graph_def | graph |
Definition at line 74 of file graph_utils.h.
|
inline |
Loads a TensorFlow SavedModel from a directory into a new session.
[in] | dir | SavedModel directory |
[in] | allow_growth | dynamically grow GPU usage |
[in] | per_process_gpu_memory_fraction | maximum GPU memory fraction |
[in] | visible_device_list | list of GPUs to use, e.g. "0,1" |
Definition at line 57 of file saved_model_utils.h.
|
inline |
Loads a TensorFlow SavedModel from a directory into a new session.
[in] | dir | SavedModel directory |
[in] | allow_growth | dynamically grow GPU usage |
[in] | per_process_gpu_memory_fraction | maximum GPU memory fraction |
[in] | visible_device_list | list of GPUs to use, e.g. "0,1" |
Definition at line 85 of file saved_model_utils.h.
|
inline |
Helps to quickly create SessionOptions.
[in] | allow_growth | dynamically grow GPU usage |
[in] | per_process_gpu_memory_fraction | maximum GPU memory fraction |
[in] | visible_device_list | list of GPUs to use, e.g. "0,1" |
Definition at line 52 of file utils.h.