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 คลาสที่ซ้อนกัน
| ระดับ | CollectionDef.AnyList | AnyList is used for collecting Any protos. | |
| อินเตอร์เฟซ | CollectionDef.AnyListOrBuilder | ||
| ระดับ | CollectionDef.Builder | CollectionDef should cover most collections. | |
| ระดับ | CollectionDef.BytesList | BytesList is used for collecting strings and serialized protobufs. | |
| อินเตอร์เฟซ | CollectionDef.BytesListOrBuilder | ||
| ระดับ | CollectionDef.FloatList | FloatList is used for collecting float values. | |
| อินเตอร์เฟซ | CollectionDef.FloatListOrBuilder | ||
| ระดับ | CollectionDef.Int64List | Int64List is used for collecting int, int64 and long values. | |
| อินเตอร์เฟซ | CollectionDef.Int64ListOrBuilder | ||
| แจกแจง | CollectionDef.KindCase | ||
| ระดับ | CollectionDef.NodeList | NodeList is used for collecting nodes in graph. | |
| อินเตอร์เฟซ | CollectionDef.NodeListOrBuilder | ||
ค่าคงที่
| ภายใน | ANY_LIST_FIELD_NUMBER | |
| ภายใน | BYTES_LIST_FIELD_NUMBER | |
| ภายใน | FLOAT_LIST_FIELD_NUMBER | |
| ภายใน | INT64_LIST_FIELD_NUMBER | |
| ภายใน | NODE_LIST_FIELD_NUMBER |
วิธีการสาธารณะ
| บูลีน | เท่ากับ (วัตถุ obj) |
| CollectionDef.AnyList | getAnyList () .tensorflow.CollectionDef.AnyList any_list = 5; |
| CollectionDef.AnyListOrBuilder | getAnyListOrBuilder () .tensorflow.CollectionDef.AnyList any_list = 5; |
| CollectionDef.BytesList | getBytesList () .tensorflow.CollectionDef.BytesList bytes_list = 2; |
| CollectionDef.BytesListOrBuilder | getBytesListOrBuilder () .tensorflow.CollectionDef.BytesList bytes_list = 2; |
| คอล เลกชันคงที่Def | |
| คอลเลกชันDef | |
| com.google.protobuf.Descriptors.Descriptor แบบคงที่ขั้นสุดท้าย | รับคำอธิบาย () |
| CollectionDef.FloatList | getFloatList () .tensorflow.CollectionDef.FloatList float_list = 4; |
| CollectionDef.FloatListOrBuilder | getFloatListOrBuilder () .tensorflow.CollectionDef.FloatList float_list = 4; |
| CollectionDef.Int64List | getInt64List () .tensorflow.CollectionDef.Int64List int64_list = 3; |
| CollectionDef.Int64ListOrBuilder | getInt64ListOrBuilder () .tensorflow.CollectionDef.Int64List int64_list = 3; |
| CollectionDef.KindCase | getKindCase () |
| CollectionDef.NodeList | getNodeList () .tensorflow.CollectionDef.NodeList node_list = 1; |
| CollectionDef.NodeListOrBuilder | getNodeListOrBuilder () .tensorflow.CollectionDef.NodeList node_list = 1; |
| ภายใน | |
| สุดท้าย com.google.protobuf.UnknownFieldSet | |
| บูลีน | มีรายการใด ๆ () .tensorflow.CollectionDef.AnyList any_list = 5; |
| บูลีน | hasBytesList () .tensorflow.CollectionDef.BytesList bytes_list = 2; |
| บูลีน | hasFloatList () .tensorflow.CollectionDef.FloatList float_list = 4; |
| บูลีน | hasInt64List () .tensorflow.CollectionDef.Int64List int64_list = 3; |
| บูลีน | มี NodeList () .tensorflow.CollectionDef.NodeList node_list = 1; |
| ภายใน | แฮชโค้ด () |
| บูลีนสุดท้าย | |
| CollectionDef.Builder แบบคงที่ | newBuilder (ต้นแบบ CollectionDef ) |
| CollectionDef.Builder แบบคงที่ | ตัวสร้างใหม่ () |
| CollectionDef.Builder | |
| คอล เลกชันคงที่Def | parseDelimitedFrom (อินพุต InputStream) |
| คอล เลกชันคงที่Def | parseDelimitedFrom (อินพุตสตรีม com.google.protobuf.ExtensionRegistryLite extensionRegistry) |
| คอล เลกชันคงที่Def | parseFrom (ข้อมูล ByteBuffer) |
| คอล เลกชันคงที่Def | parseFrom (อินพุต com.google.protobuf.CodedInputStream, com.google.protobuf.ExtensionRegistryLite extensionRegistry) |
| คอล เลกชันคงที่Def | parseFrom (ข้อมูล ByteBuffer, com.google.protobuf.ExtensionRegistryLite extensionRegistry) |
| คอล เลกชันคงที่Def | parseFrom (com.google.protobuf.CodedInputStream อินพุต) |
| คอล เลกชันคงที่Def | parseFrom (ข้อมูลไบต์ [], com.google.protobuf.ExtensionRegistryLite extensionRegistry) |
| คอล เลกชันคงที่Def | parseFrom (ข้อมูล com.google.protobuf.ByteString) |
| คอล เลกชันคงที่Def | parseFrom (อินพุต InputStream, com.google.protobuf.ExtensionRegistryLite extensionRegistry) |
| คอล เลกชันคงที่Def | parseFrom (ข้อมูล com.google.protobuf.ByteString, com.google.protobuf.ExtensionRegistryLite extensionRegistry) |
| คงที่ | |
| CollectionDef.Builder | toBuilder () |
| เป็นโมฆะ | writeTo (เอาต์พุต com.google.protobuf.CodedOutputStream) |
วิธีการสืบทอด
ค่าคงที่
รอบชิงชนะเลิศแบบคงที่สาธารณะ int ANY_LIST_FIELD_NUMBER
สาธารณะคงที่สุดท้าย int BYTES_LIST_FIELD_NUMBER
สาธารณะคงสุดท้าย int FLOAT_LIST_FIELD_NUMBER
สาธารณะคงสุดท้าย int INT64_LIST_FIELD_NUMBER
สาธารณะคงสุดท้าย int NODE_LIST_FIELD_NUMBER
วิธีการสาธารณะ
บูลีนสาธารณะ เท่ากับ (Object obj)
CollectionDef.AnyListOrBuilder สาธารณะ getAnyListOrBuilder ()
.tensorflow.CollectionDef.AnyList any_list = 5;
CollectionDef.BytesListOrBuilder สาธารณะ getBytesListOrBuilder ()
.tensorflow.CollectionDef.BytesList bytes_list = 2;
สาธารณะคงที่สุดท้าย com.google.protobuf.Descriptors.Descriptor getDescriptor ()
CollectionDef.FloatListOrBuilder สาธารณะ getFloatListOrBuilder ()
.tensorflow.CollectionDef.FloatList float_list = 4;
CollectionDef.Int64ListOrBuilder สาธารณะ getInt64ListOrBuilder ()
.tensorflow.CollectionDef.Int64List int64_list = 3;
CollectionDef.NodeListOrBuilder สาธารณะ getNodeListOrBuilder ()
.tensorflow.CollectionDef.NodeList node_list = 1;
สาธารณะ getParserForType ()
สาธารณะ int getSerializedSize ()
สาธารณะสุดท้าย com.google.protobuf.UnknownFieldSet getUnknownFields ()
บูลีนสาธารณะ hasAnyList ()
.tensorflow.CollectionDef.AnyList any_list = 5;
hasBytesList บูลีนสาธารณะ ()
.tensorflow.CollectionDef.BytesList bytes_list = 2;
hasFloatList บูลีนสาธารณะ ()
.tensorflow.CollectionDef.FloatList float_list = 4;
บูลีนสาธารณะ hasInt64List ()
.tensorflow.CollectionDef.Int64List int64_list = 3;
บูลีนสาธารณะ hasNodeList ()
.tensorflow.CollectionDef.NodeList node_list = 1;
สาธารณะ int hashCode ()
บูลีนสุดท้ายสาธารณะ isInitialized ()
สาธารณะ CollectionDef parseDelimitedFrom คงที่ (อินพุตสตรีม, com.google.protobuf.ExtensionRegistryLite extensionRegistry)
ขว้าง
| IOข้อยกเว้น |
|---|
สาธารณะ CollectionDef parseFrom แบบคงที่ (ข้อมูล ByteBuffer)
ขว้าง
| ProtocolBufferException ไม่ถูกต้อง |
|---|
สาธารณะ CollectionDef parseFrom แบบคงที่ (com.google.protobuf.CodedInputStream อินพุต com.google.protobuf.ExtensionRegistryLite extensionRegistry)
ขว้าง
| IOข้อยกเว้น |
|---|
สาธารณะ CollectionDef parseFrom แบบคงที่ (ข้อมูล ByteBuffer, com.google.protobuf.ExtensionRegistryLite extensionRegistry)
ขว้าง
| ProtocolBufferException ไม่ถูกต้อง |
|---|
สาธารณะ CollectionDef parseFrom แบบคงที่ (com.google.protobuf.CodedInputStream อินพุต)
ขว้าง
| IOข้อยกเว้น |
|---|
สาธารณะ CollectionDef parseFrom แบบคงที่ (ข้อมูลไบต์ [], com.google.protobuf.ExtensionRegistryLite extensionRegistry)
ขว้าง
| ProtocolBufferException ไม่ถูกต้อง |
|---|
สาธารณะ CollectionDef parseFrom แบบคงที่ (ข้อมูล com.google.protobuf.ByteString)
ขว้าง
| ProtocolBufferException ไม่ถูกต้อง |
|---|
สาธารณะ CollectionDef parseFrom แบบคงที่ (อินพุต InputStream, com.google.protobuf.ExtensionRegistryLite extensionRegistry)
ขว้าง
| IOข้อยกเว้น |
|---|
สาธารณะ CollectionDef parseFrom แบบคงที่ (ข้อมูล com.google.protobuf.ByteString, com.google.protobuf.ExtensionRegistryLite extensionRegistry)
ขว้าง
| ProtocolBufferException ไม่ถูกต้อง |
|---|
สาธารณะคงที่ ตัวแยกวิเคราะห์ ()
โมฆะสาธารณะ writeTo (com.google.protobuf.CodedOutputStream เอาต์พุต)
ขว้าง
| IOข้อยกเว้น |
|---|