CollectionDef should cover most collections. To add a user-defined collection, do one of the following: 1. For simple data types, such as string, int, float: tf.add_to_collection("your_collection_name", your_simple_value) strings will be stored as bytes_list. 2. For Protobuf types, there are three ways to add them: 1) tf.add_to_collection("your_collection_name", your_proto.SerializeToString()) collection_def { key: "user_defined_bytes_collection" value { bytes_list { value: "queue_name: \"test_queue\"\n" } } } or 2) tf.add_to_collection("your_collection_name", str(your_proto)) collection_def { key: "user_defined_string_collection" value { bytes_list { value: "\n\ntest_queue" } } } or 3) any_buf = any_pb2.Any() tf.add_to_collection("your_collection_name", any_buf.Pack(your_proto)) collection_def { key: "user_defined_any_collection" value { any_list { value { type_url: "type.googleapis.com/tensorflow.QueueRunnerDef" value: "\n\ntest_queue" } } } } 3. For Python objects, implement to_proto() and from_proto(), and register them in the following manner: ops.register_proto_function("your_collection_name", proto_type, to_proto=YourPythonObject.to_proto, from_proto=YourPythonObject.from_proto) These functions will be invoked to serialize and de-serialize the collection. For example, ops.register_proto_function(ops.GraphKeys.GLOBAL_VARIABLES, proto_type=variable_pb2.VariableDef, to_proto=Variable.to_proto, from_proto=Variable.from_proto)
tensorflow.CollectionDef
Kelas Bersarang
kelas | CollectionDef.AnyList | AnyList is used for collecting Any protos. | |
antarmuka | CollectionDef.AnyListOrBuilder | ||
kelas | CollectionDef.Builder | CollectionDef should cover most collections. | |
kelas | CollectionDef.BytesList | BytesList is used for collecting strings and serialized protobufs. | |
antarmuka | CollectionDef.BytesListOrBuilder | ||
kelas | CollectionDef.FloatList | FloatList is used for collecting float values. | |
antarmuka | CollectionDef.FloatListOrBuilder | ||
kelas | CollectionDef.Int64List | Int64List is used for collecting int, int64 and long values. | |
antarmuka | CollectionDef.Int64ListOrBuilder | ||
enum | KoleksiDef.KindCase | ||
kelas | CollectionDef.NodeList | NodeList is used for collecting nodes in graph. | |
antarmuka | CollectionDef.NodeListOrBuilder |
Konstanta
ke dalam | ANY_LIST_FIELD_NUMBER | |
ke dalam | BYTES_LIST_FIELD_NUMBER | |
ke dalam | FLOAT_LIST_FIELD_NUMBER | |
ke dalam | INT64_LIST_FIELD_NUMBER | |
ke dalam | NODE_LIST_FIELD_NUMBER |
Metode Publik
boolean | sama dengan (Objek objek) |
CollectionDef.AnyList | dapatkan Daftar Apa Saja () .tensorflow.CollectionDef.AnyList any_list = 5; |
CollectionDef.AnyListOrBuilder | dapatkanAnyListOrBuilder () .tensorflow.CollectionDef.AnyList any_list = 5; |
CollectionDef.BytesList | dapatkanBytesList () .tensorflow.CollectionDef.BytesList bytes_list = 2; |
CollectionDef.BytesListOrBuilder | getBytesListOrBuilder () .tensorflow.CollectionDef.BytesList bytes_list = 2; |
CollectionDef statis | |
KoleksiDef | |
com.google.protobuf.Descriptors.Descriptor statis terakhir | |
CollectionDef.FloatList | dapatkanDaftarFloat () .tensorflow.CollectionDef.FloatList float_list = 4; |
CollectionDef.FloatListOrBuilder | dapatkanFloatListOrBuilder () .tensorflow.CollectionDef.FloatList float_list = 4; |
CollectionDef.Int64List | dapatkanInt64List () .tensorflow.CollectionDef.Int64List int64_list = 3; |
CollectionDef.Int64ListOrBuilder | getInt64ListOrBuilder () .tensorflow.CollectionDef.Int64List int64_list = 3; |
KoleksiDef.KindCase | |
CollectionDef.NodeList | dapatkanNodeList () .tensorflow.CollectionDef.NodeList node_list = 1; |
CollectionDef.NodeListOrBuilder | getNodeListOrBuilder () .tensorflow.CollectionDef.NodeList node_list = 1; |
ke dalam | |
final com.google.protobuf.UnknownFieldSet | |
boolean | memiliki Daftar Apa Pun () .tensorflow.CollectionDef.AnyList any_list = 5; |
boolean | hasBytesList () .tensorflow.CollectionDef.BytesList bytes_list = 2; |
boolean | hasFloatList () .tensorflow.CollectionDef.FloatList float_list = 4; |
boolean | hasInt64List () .tensorflow.CollectionDef.Int64List int64_list = 3; |
boolean | hasNodeList () .tensorflow.CollectionDef.NodeList node_list = 1; |
ke dalam | Kode hash () |
boolean terakhir | |
CollectionDef.Builder statis | newBuilder (prototipe CollectionDef ) |
CollectionDef.Builder statis | |
CollectionDef.Builder | |
CollectionDef statis | parseDelimitedFrom (masukan Aliran Masukan) |
CollectionDef statis | parseDelimitedFrom (masukan InputStream, com.google.protobuf.ExtensionRegistryLite extensionRegistry) |
CollectionDef statis | parseFrom (data ByteBuffer) |
CollectionDef statis | parseFrom (com.google.protobuf.CodedInputStream masukan, com.google.protobuf.ExtensionRegistryLite extensionRegistry) |
CollectionDef statis | parseFrom (data ByteBuffer, com.google.protobuf.ExtensionRegistryLite extensionRegistry) |
CollectionDef statis | parseFrom (com.google.protobuf.CodedInputStream masukan) |
CollectionDef statis | parseFrom (byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) |
CollectionDef statis | parseFrom (com.google.protobuf.ByteString data) |
CollectionDef statis | parseFrom (masukan InputStream, com.google.protobuf.ExtensionRegistryLite extensionRegistry) |
CollectionDef statis | parseFrom (com.google.protobuf.ByteString data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) |
statis | pengurai () |
CollectionDef.Builder | |
ruang kosong | writeTo (com.google.protobuf.CodedOutputStream keluaran) |
Metode Warisan
Konstanta
int final statis publik ANY_LIST_FIELD_NUMBER
int akhir statis publik BYTES_LIST_FIELD_NUMBER
int akhir statis publik FLOAT_LIST_FIELD_NUMBER
int final statis publik INT64_LIST_FIELD_NUMBER
int final statis publik NODE_LIST_FIELD_NUMBER
Metode Publik
boolean publik sama (Obj objek)
publik CollectionDef.AnyListOrBuilder getAnyListOrBuilder ()
.tensorflow.CollectionDef.AnyList any_list = 5;
publik CollectionDef.BytesListOrBuilder getBytesListOrBuilder ()
.tensorflow.CollectionDef.BytesList bytes_list = 2;
public static final com.google.protobuf.Descriptors.Descriptor getDescriptor ()
publik CollectionDef.FloatListOrBuilder getFloatListOrBuilder ()
.tensorflow.CollectionDef.FloatList float_list = 4;
publik CollectionDef.Int64ListOrBuilder getInt64ListOrBuilder ()
.tensorflow.CollectionDef.Int64List int64_list = 3;
publik CollectionDef.NodeListOrBuilder getNodeListOrBuilder ()
.tensorflow.CollectionDef.NodeList node_list = 1;
publik dapatkanParserForType ()
publik int getSerializedSize ()
public final com.google.protobuf.UnknownFieldSet getUnknownFields ()
boolean publik hasAnyList ()
.tensorflow.CollectionDef.AnyList any_list = 5;
hasBytesList boolean publik ()
.tensorflow.CollectionDef.BytesList bytes_list = 2;
boolean publik hasFloatList ()
.tensorflow.CollectionDef.FloatList float_list = 4;
boolean publik hasInt64List ()
.tensorflow.CollectionDef.Int64List int64_list = 3;
boolean publik hasNodeList ()
.tensorflow.CollectionDef.NodeList node_list = 1;
kode hash int publik ()
boolean akhir publik diinisialisasi ()
public static CollectionDef parseDelimitedFrom (input InputStream, com.google.protobuf.ExtensionRegistryLite extensionRegistry)
Melempar
Pengecualian IO |
---|
parseFrom CollectionDef statis publik (data ByteBuffer)
Melempar
ProtokolBufferException Tidak Valid |
---|
parseFrom CollectionDef statis publik (com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry)
Melempar
Pengecualian IO |
---|
parseFrom CollectionDef statis publik (data ByteBuffer, com.google.protobuf.ExtensionRegistryLite extensionRegistry)
Melempar
ProtokolBufferException Tidak Valid |
---|
parseFrom CollectionDef statis publik (com.google.protobuf.CodedInputStream input)
Melempar
Pengecualian IO |
---|
parseFrom CollectionDef statis publik (byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry)
Melempar
ProtokolBufferException Tidak Valid |
---|
parseFrom CollectionDef statis publik (com.google.protobuf.ByteString data)
Melempar
ProtokolBufferException Tidak Valid |
---|
parseFrom CollectionDef statis publik (input InputStream, com.google.protobuf.ExtensionRegistryLite extensionRegistry)
Melempar
Pengecualian IO |
---|
parseFrom CollectionDef statis publik (com.google.protobuf.ByteString data, com.google.protobuf.ExtensionRegistryLite extensionRegistry)
Melempar
ProtokolBufferException Tidak Valid |
---|
statis publik pengurai ()
public void writeTo (keluaran com.google.protobuf.CodedOutputStream)
Melempar
Pengecualian IO |
---|