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 Phương pháp công khai
| Bộ sưu tậpDef.Builder | addRepeatedField (trường com.google.protobuf.Descriptors.FieldDescriptor, Giá trị đối tượng) |
| Bộ sưu tậpDef | xây dựng () |
| Bộ sưu tậpDef | |
| Bộ sưu tậpDef.Builder | thông thoáng () |
| Bộ sưu tậpDef.Builder | ClearAnyList () .tensorflow.CollectionDef.AnyList any_list = 5; |
| Bộ sưu tậpDef.Builder | ClearBytesList () .tensorflow.CollectionDef.BytesList bytes_list = 2; |
| Bộ sưu tậpDef.Builder | ClearField (trường com.google.protobuf.Descriptors.FieldDescriptor) |
| Bộ sưu tậpDef.Builder | ClearFloatList () .tensorflow.CollectionDef.FloatList float_list = 4; |
| Bộ sưu tậpDef.Builder | ClearInt64List () .tensorflow.CollectionDef.Int64List int64_list = 3; |
| Bộ sưu tậpDef.Builder | ClearKind () |
| Bộ sưu tậpDef.Builder | ClearNodeList () .tensorflow.CollectionDef.NodeList node_list = 1; |
| Bộ sưu tậpDef.Builder | ClearOneof (com.google.protobuf.Descriptors.OneofDescriptor oneof) |
| Bộ sưu tậpDef.Builder | dòng vô tính () |
| CollectionDef.AnyList | getAnyList () .tensorflow.CollectionDef.AnyList any_list = 5; |
| CollectionDef.AnyList.Builder | getAnyListBuilder () .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.BytesList.Builder | getBytesListBuilder () .tensorflow.CollectionDef.BytesList bytes_list = 2; |
| CollectionDef.BytesListOrBuilder | getBytesListOrBuilder () .tensorflow.CollectionDef.BytesList bytes_list = 2; |
| Bộ sưu tậpDef | |
| com.google.protobuf.Descriptors.Descriptor tĩnh cuối cùng | |
| com.google.protobuf.Descriptors.Descriptor | |
| CollectionDef.FloatList | getFloatList () .tensorflow.CollectionDef.FloatList float_list = 4; |
| CollectionDef.FloatList.Builder | getFloatListBuilder () .tensorflow.CollectionDef.FloatList float_list = 4; |
| CollectionDef.FloatListOrBuilder | getFloatListOrBuilder () .tensorflow.CollectionDef.FloatList float_list = 4; |
| Bộ sưu tậpDef.Int64List | getInt64List () .tensorflow.CollectionDef.Int64List int64_list = 3; |
| CollectionDef.Int64List.Builder | getInt64ListBuilder () .tensorflow.CollectionDef.Int64List int64_list = 3; |
| CollectionDef.Int64ListOrBuilder | getInt64ListOrBuilder () .tensorflow.CollectionDef.Int64List int64_list = 3; |
| Bộ sưu tậpDef.KindCase | getKindCase () |
| Bộ sưu tậpDef.NodeList | getNodeList () .tensorflow.CollectionDef.NodeList node_list = 1; |
| CollectionDef.NodeList.Builder | getNodeListBuilder () .tensorflow.CollectionDef.NodeList node_list = 1; |
| CollectionDef.NodeListOrBuilder | getNodeListOrBuilder () .tensorflow.CollectionDef.NodeList node_list = 1; |
| boolean | hasAnyList () .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; |
| boolean cuối cùng | |
| Bộ sưu tậpDef.Builder | |
| Bộ sưu tậpDef.Builder | mergeBytesList (giá trị CollectionDef.BytesList ) .tensorflow.CollectionDef.BytesList bytes_list = 2; |
| Bộ sưu tậpDef.Builder | mergeFloatList (giá trị CollectionDef.FloatList ) .tensorflow.CollectionDef.FloatList float_list = 4; |
| Bộ sưu tậpDef.Builder | mergeFrom (com.google.protobuf.Message other) |
| Bộ sưu tậpDef.Builder | mergeFrom (đầu vào com.google.protobuf.CodedInputStream, com.google.protobuf.ExtensionRegistryLite ExtensionRegistry) |
| Bộ sưu tậpDef.Builder | mergeInt64List (giá trị CollectionDef.Int64List ) .tensorflow.CollectionDef.Int64List int64_list = 3; |
| Bộ sưu tậpDef.Builder | |
| Bộ sưu tập cuối cùngDef.Builder | hợp nhấtUnknownFields (com.google.protobuf.UnknownFieldSet knownFields) |
| Bộ sưu tậpDef.Builder | |
| Bộ sưu tậpDef.Builder | setAnyList ( CollectionDef.AnyList.Builder builderForValue) .tensorflow.CollectionDef.AnyList any_list = 5; |
| Bộ sưu tậpDef.Builder | setBytesList ( CollectionDef.BytesList.Builder builderForValue) .tensorflow.CollectionDef.BytesList bytes_list = 2; |
| Bộ sưu tậpDef.Builder | |
| Bộ sưu tậpDef.Builder | setField (trường com.google.protobuf.Descriptors.FieldDescriptor, Giá trị đối tượng) |
| Bộ sưu tậpDef.Builder | |
| Bộ sưu tậpDef.Builder | setFloatList ( CollectionDef.FloatList.Builder builderForValue) .tensorflow.CollectionDef.FloatList float_list = 4; |
| Bộ sưu tậpDef.Builder | |
| Bộ sưu tậpDef.Builder | setInt64List ( CollectionDef.Int64List.Builder builderForValue) .tensorflow.CollectionDef.Int64List int64_list = 3; |
| Bộ sưu tậpDef.Builder | setNodeList ( CollectionDef.NodeList.Builder builderForValue) .tensorflow.CollectionDef.NodeList node_list = 1; |
| Bộ sưu tậpDef.Builder | |
| Bộ sưu tậpDef.Builder | setRepeatedField (trường com.google.protobuf.Descriptors.FieldDescriptor, chỉ mục int, giá trị đối tượng) |
| Bộ sưu tập cuối cùngDef.Builder | setUnknownFields (com.google.protobuf.UnknownFieldSet knownFields) |
Phương pháp kế thừa
Phương pháp công khai
public CollectionDef.Builder addRepeatedField (trường com.google.protobuf.Descriptors.FieldDescriptor, Giá trị đối tượng)
public CollectionDef.AnyList.Builder getAnyListBuilder ()
.tensorflow.CollectionDef.AnyList any_list = 5;
public CollectionDef.AnyListOrBuilder getAnyListOrBuilder ()
.tensorflow.CollectionDef.AnyList any_list = 5;
CollectionDef.BytesList getBytesList công khai ()
.tensorflow.CollectionDef.BytesList bytes_list = 2;
public CollectionDef.BytesList.Builder getBytesListBuilder ()
.tensorflow.CollectionDef.BytesList bytes_list = 2;
public CollectionDef.BytesListOrBuilder getBytesListOrBuilder ()
.tensorflow.CollectionDef.BytesList bytes_list = 2;
công khai tĩnh cuối cùng com.google.protobuf.Descriptors.Descriptor getDescriptor ()
com.google.protobuf.Descriptors.Descriptor công khai getDescriptorForType ()
CollectionDef.FloatList.Builder công khai getFloatListBuilder ()
.tensorflow.CollectionDef.FloatList float_list = 4;
public CollectionDef.FloatListOrBuilder getFloatListOrBuilder ()
.tensorflow.CollectionDef.FloatList float_list = 4;
CollectionDef.Int64List getInt64List công khai ()
.tensorflow.CollectionDef.Int64List int64_list = 3;
public CollectionDef.Int64List.Builder getInt64ListBuilder ()
.tensorflow.CollectionDef.Int64List int64_list = 3;
public CollectionDef.Int64ListOrBuilder getInt64ListOrBuilder ()
.tensorflow.CollectionDef.Int64List int64_list = 3;
public CollectionDef.NodeList.Builder getNodeListBuilder ()
.tensorflow.CollectionDef.NodeList node_list = 1;
public CollectionDef.NodeListOrBuilder getNodeListOrBuilder ()
.tensorflow.CollectionDef.NodeList node_list = 1;
boolean công khai hasAnyList ()
.tensorflow.CollectionDef.AnyList any_list = 5;
boolean công khai hasBytesList ()
.tensorflow.CollectionDef.BytesList bytes_list = 2;
boolean công khai hasFloatList ()
.tensorflow.CollectionDef.FloatList float_list = 4;
boolean công khai hasInt64List ()
.tensorflow.CollectionDef.Int64List int64_list = 3;
boolean công khai hasNodeList ()
.tensorflow.CollectionDef.NodeList node_list = 1;
boolean cuối cùng công khai được khởi tạo ()
public CollectionDef.Builder mergeAnyList (giá trị CollectionDef.AnyList )
.tensorflow.CollectionDef.AnyList any_list = 5;
public CollectionDef.Builder mergeBytesList (giá trị CollectionDef.BytesList )
.tensorflow.CollectionDef.BytesList bytes_list = 2;
public CollectionDef.Builder mergeFloatList (giá trị CollectionDef.FloatList )
.tensorflow.CollectionDef.FloatList float_list = 4;
public CollectionDef.Builder mergeFrom (đầu vào com.google.protobuf.CodedInputStream, com.google.protobuf.ExtensionRegistryLite ExtensionRegistry)
Ném
| IOException |
|---|
public CollectionDef.Builder mergeInt64List (giá trị CollectionDef.Int64List )
.tensorflow.CollectionDef.Int64List int64_list = 3;
public CollectionDef.Builder mergeNodeList (giá trị CollectionDef.NodeList )
.tensorflow.CollectionDef.NodeList node_list = 1;
trận chung kết công khai CollectionDef.Builder mergeUnknownFields (com.google.protobuf.UnknownFieldSet knownFields)
public CollectionDef.Builder setAnyList (giá trị CollectionDef.AnyList )
.tensorflow.CollectionDef.AnyList any_list = 5;
công khai CollectionDef.Builder setAnyList ( CollectionDef.AnyList.Builder builderForValue)
.tensorflow.CollectionDef.AnyList any_list = 5;
công khai CollectionDef.Builder setBytesList ( CollectionDef.BytesList.Builder builderForValue)
.tensorflow.CollectionDef.BytesList bytes_list = 2;
public CollectionDef.Builder setBytesList (giá trị CollectionDef.BytesList )
.tensorflow.CollectionDef.BytesList bytes_list = 2;
public CollectionDef.Builder setField (trường com.google.protobuf.Descriptors.FieldDescriptor, giá trị đối tượng)
public CollectionDef.Builder setFloatList (giá trị CollectionDef.FloatList )
.tensorflow.CollectionDef.FloatList float_list = 4;
CollectionDef.Builder setFloatList công khai ( CollectionDef.FloatList.Builder builderForValue)
.tensorflow.CollectionDef.FloatList float_list = 4;
public CollectionDef.Builder setInt64List (giá trị CollectionDef.Int64List )
.tensorflow.CollectionDef.Int64List int64_list = 3;
công khai CollectionDef.Builder setInt64List ( CollectionDef.Int64List.Builder builderForValue)
.tensorflow.CollectionDef.Int64List int64_list = 3;
công khai CollectionDef.Builder setNodeList ( CollectionDef.NodeList.Builder builderForValue)
.tensorflow.CollectionDef.NodeList node_list = 1;
public CollectionDef.Builder setNodeList (giá trị CollectionDef.NodeList )
.tensorflow.CollectionDef.NodeList node_list = 1;