原生定义:
tensorflow::tensorflow/core/framework/graph.proto
message GraphDef {
repeated NodeDef node = 1;
VersionDef versions = 4;
int32 version = 3 [deprecated = true];
FunctionDefLibrary library = 2;
};
编译处理后类GraphDef 定义
class GraphDef : public ::google::protobuf::Message /* @@protoc_insertion_point(class_definition:tensorflow.GraphDef) */ {
public:
GraphDef();注意此构造函数
virtual ~GraphDef();
GraphDef(const GraphDef& from);
inline GraphDef& operator=(const GraphDef& from) {
CopyFrom(from);
return *this;
}
inline ::google::protobuf::Arena* GetArena() const PROTOBUF_FINAL {
return GetArenaNoVirtual();
}
inline void* GetMaybeArenaPointer() const PROTOBUF_FINAL {
return MaybeArenaPtr();
}
static const ::google::protobuf::Descriptor* descriptor();
static const GraphDef& default_instance();
static inline const GraphDef* internal_default_instance() {
return reinterpret_cast<const GraphDef*>(
&_GraphDef_default_instance_);
}
static PROTOBUF_CONSTEXPR int const kIndexInFileMessages =
0;
void UnsafeArenaSwap(GraphDef* other);
void Swap(GraphDef* other);
// implements Message ----------------------------------------------
inline GraphDef* New() const PROTOBUF_FINAL { return New(NULL); }
GraphDef* New(::google::protobuf::Arena* arena) const PROTOBUF_FINAL;
void CopyFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL;
void MergeFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL;
void CopyFrom(const GraphDef& from);
void MergeFrom(const GraphDef& from);
void Clear() PROTOBUF_FINAL;
bool IsInitialized() const PROTOBUF_FINAL;
size_t ByteSizeLong() const PROTOBUF_FINAL;
bool MergePartialFromCodedStream(
::google::protobuf::io::CodedInputStream* input) PROTOBUF_FINAL;
void SerializeWithCachedSizes(
::google::protobuf::io::CodedOutputStream* output) const PROTOBUF_FINAL;
::google::protobuf::uint8* InternalSerializeWithCachedSizesToArray(
bool deterministic, ::google::protobuf::uint8* target) const PROTOBUF_FINAL;
int GetCachedSize() const PROTOBUF_FINAL { return _cached_size_; }
private:
void SharedCtor();
void SharedDtor();
void SetCachedSize(int size) const PROTOBUF_FINAL;
void InternalSwap(GraphDef* other);
protected:
explicit GraphDef(::google::protobuf::Arena* arena);
private:
static void ArenaDtor(void* object);
inline void RegisterArenaDtor(::google::protobuf::Arena* arena);
private:
inline ::google::protobuf::Arena* GetArenaNoVirtual() const {
return _internal_metadata_.arena();
}
inline void* MaybeArenaPtr() const {
return _internal_metadata_.raw_arena_ptr();
}
public:
::google::protobuf::Metadata GetMetadata() const PROTOBUF_FINAL;
// nested types ----------------------------------------------------
// accessors -------------------------------------------------------
// repeated .tensorflow.NodeDef node = 1;
int node_size() const;
void clear_node();
static const int kNodeFieldNumber = 1;
const ::tensorflow::NodeDef& node(int index) const;
::tensorflow::NodeDef* mutable_node(int index);
::tensorflow::NodeDef* add_node();
::google::protobuf::RepeatedPtrField< ::tensorflow::NodeDef >*
mutable_node();
const ::google::protobuf::RepeatedPtrField< ::tensorflow::NodeDef >&
node() const;
// .tensorflow.FunctionDefLibrary library = 2;
bool has_library() const;
void clear_library();
static const int kLibraryFieldNumber = 2;
private:
void _slow_mutable_library();
void _slow_set_allocated_library(
::google::protobuf::Arena* message_arena, ::tensorflow::FunctionDefLibrary** library);
::tensorflow::FunctionDefLibrary* _slow_release_library();
public:
const ::tensorflow::FunctionDefLibrary& library() const;
::tensorflow::FunctionDefLibrary* mutable_library();
::tensorflow::FunctionDefLibrary* release_library();
void set_allocated_library(::tensorflow::FunctionDefLibrary* library);
::tensorflow::FunctionDefLibrary* unsafe_arena_release_library();
void unsafe_arena_set_allocated_library(
::tensorflow::FunctionDefLibrary* library);
// .tensorflow.VersionDef versions = 4;
bool has_versions() const;
void clear_versions();
static const int kVersionsFieldNumber = 4;
private:
void _slow_mutable_versions();
void _slow_set_allocated_versions(
::google::protobuf::Arena* message_arena, ::tensorflow::VersionDef** versions);
::tensorflow::VersionDef* _slow_release_versions();
public:
const ::tensorflow::VersionDef& versions() const;
::tensorflow::VersionDef* mutable_versions();
::tensorflow::VersionDef* release_versions();
void set_allocated_versions(::tensorflow::VersionDef* versions);
::tensorflow::VersionDef* unsafe_arena_release_versions();
void unsafe_arena_set_allocated_versions(
::tensorflow::VersionDef* versions);
// int32 version = 3 [deprecated = true];
GOOGLE_PROTOBUF_DEPRECATED_ATTR void clear_version();
GOOGLE_PROTOBUF_DEPRECATED_ATTR static const int kVersionFieldNumber = 3;
GOOGLE_PROTOBUF_DEPRECATED_ATTR ::google::protobuf::int32 version() const;
GOOGLE_PROTOBUF_DEPRECATED_ATTR void set_version(::google::protobuf::int32 value);
// @@protoc_insertion_point(class_scope:tensorflow.GraphDef)
private:
::google::protobuf::internal::InternalMetadataWithArena _internal_metadata_;
friend class ::google::protobuf::Arena;
typedef void InternalArenaConstructable_;
typedef void DestructorSkippable_;
::google::protobuf::RepeatedPtrField< ::tensorflow::NodeDef > node_;
::tensorflow::FunctionDefLibrary* library_;
::tensorflow::VersionDef* versions_;
::google::protobuf::int32 version_;
mutable int _cached_size_;
friend struct protobuf_tensorflow_2fcore_2fframework_2fgraph_2eproto::TableStruct;
};
// ===================================================================
tf中graph定义
原创sunlei0625 ©著作权
文章标签 tensorflow 构造函数 ci 文章分类 Python 后端开发

-
Tensorflow1.13.1 -- tf.io.write_graph 保存模型与读取
1. 按需保存计算图到模型文件。 2. 加载模型文件,并运行计算图
tensorflow write_graph