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 Métodos públicos
| ColecciónDef.Builder | addRepeatedField (campo com.google.protobuf.Descriptors.FieldDescriptor, valor del objeto) |
| ColecciónDef | construir () |
| ColecciónDef | |
| ColecciónDef.Builder | claro () |
| ColecciónDef.Builder | borrarCualquierLista () .tensorflow.CollectionDef.AnyList any_list = 5; |
| ColecciónDef.Builder | borrarBytesList () .tensorflow.CollectionDef.BytesList bytes_list = 2; |
| ColecciónDef.Builder | clearField (campo com.google.protobuf.Descriptors.FieldDescriptor) |
| ColecciónDef.Builder | borrar lista flotante () .tensorflow.CollectionDef.FloatList float_list = 4; |
| ColecciónDef.Builder | clearInt64List () .tensorflow.CollectionDef.Int64List int64_list = 3; |
| ColecciónDef.Builder | tipo claro () |
| ColecciónDef.Builder | borrar lista de nodos () .tensorflow.CollectionDef.NodeList node_list = 1; |
| ColecciónDef.Builder | clearOneof (com.google.protobuf.Descriptors.OneofDescriptor uno de) |
| ColecciónDef.Builder | clonar () |
| ColecciónDef.AnyList | obtenerCualquierLista () .tensorflow.CollectionDef.AnyList any_list = 5; |
| ColecciónDef.AnyList.Builder | obtenerAnyListBuilder () .tensorflow.CollectionDef.AnyList any_list = 5; |
| ColecciónDef.AnyListOrBuilder | getAnyListOrBuilder () .tensorflow.CollectionDef.AnyList any_list = 5; |
| ColecciónDef.BytesList | obtener lista de bytes () .tensorflow.CollectionDef.BytesList bytes_list = 2; |
| ColecciónDef.BytesList.Builder | getBytesListBuilder () .tensorflow.CollectionDef.BytesList bytes_list = 2; |
| ColecciónDef.BytesListOrBuilder | getBytesListOrBuilder () .tensorflow.CollectionDef.BytesList bytes_list = 2; |
| ColecciónDef | |
| com.google.protobuf.Descriptors.Descriptor estático final | |
| com.google.protobuf.Descriptors.Descriptor | |
| ColecciónDef.FloatList | obtener lista flotante () .tensorflow.CollectionDef.FloatList float_list = 4; |
| ColecciónDef.FloatList.Builder | obtenerFloatListBuilder () .tensorflow.CollectionDef.FloatList float_list = 4; |
| ColecciónDef.FloatListOrBuilder | getFloatListOrBuilder () .tensorflow.CollectionDef.FloatList float_list = 4; |
| ColecciónDef.Int64List | obtenerInt64List () .tensorflow.CollectionDef.Int64List int64_list = 3; |
| ColecciónDef.Int64List.Builder | getInt64ListBuilder () .tensorflow.CollectionDef.Int64List int64_list = 3; |
| ColecciónDef.Int64ListOrBuilder | getInt64ListOrBuilder () .tensorflow.CollectionDef.Int64List int64_list = 3; |
| ColecciónDef.KindCase | |
| ColecciónDef.NodeList | obtener lista de nodos () .tensorflow.CollectionDef.NodeList node_list = 1; |
| ColecciónDef.NodeList.Builder | getNodeListBuilder () .tensorflow.CollectionDef.NodeList node_list = 1; |
| ColecciónDef.NodeListOrBuilder | getNodeListOrBuilder () .tensorflow.CollectionDef.NodeList node_list = 1; |
| booleano | tieneAnyList () .tensorflow.CollectionDef.AnyList any_list = 5; |
| booleano | tieneBytesList () .tensorflow.CollectionDef.BytesList bytes_list = 2; |
| booleano | tieneFloatList () .tensorflow.CollectionDef.FloatList float_list = 4; |
| booleano | hasInt64List () .tensorflow.CollectionDef.Int64List int64_list = 3; |
| booleano | tiene lista de nodos () .tensorflow.CollectionDef.NodeList node_list = 1; |
| booleano final | |
| ColecciónDef.Builder | |
| ColecciónDef.Builder | |
| ColecciónDef.Builder | |
| ColecciónDef.Builder | mergeFrom (com.google.protobuf.Message otro) |
| ColecciónDef.Builder | mergeFrom (entrada com.google.protobuf.CodedInputStream, com.google.protobuf.ExtensionRegistryLite extensiónRegistry) |
| ColecciónDef.Builder | |
| ColecciónDef.Builder | |
| Colección finalDef.Builder | mergeUnknownFields (com.google.protobuf.UnknownFieldSet desconocidoFields) |
| ColecciónDef.Builder | |
| ColecciónDef.Builder | setAnyList ( CollectionDef.AnyList.Builder constructorForValue) .tensorflow.CollectionDef.AnyList any_list = 5; |
| ColecciónDef.Builder | setBytesList ( CollectionDef.BytesList.Builder constructorForValue) .tensorflow.CollectionDef.BytesList bytes_list = 2; |
| ColecciónDef.Builder | |
| ColecciónDef.Builder | setField (campo com.google.protobuf.Descriptors.FieldDescriptor, valor del objeto) |
| ColecciónDef.Builder | |
| ColecciónDef.Builder | setFloatList ( CollectionDef.FloatList.Builder constructorForValue) .tensorflow.CollectionDef.FloatList float_list = 4; |
| ColecciónDef.Builder | |
| ColecciónDef.Builder | setInt64List ( CollectionDef.Int64List.Builder constructorForValue) .tensorflow.CollectionDef.Int64List int64_list = 3; |
| ColecciónDef.Builder | setNodeList ( CollectionDef.NodeList.Builder constructorForValue) .tensorflow.CollectionDef.NodeList node_list = 1; |
| ColecciónDef.Builder | |
| ColecciónDef.Builder | setRepeatedField (campo com.google.protobuf.Descriptors.FieldDescriptor, índice int, valor del objeto) |
| Colección finalDef.Builder | setUnknownFields (com.google.protobuf.UnknownFieldSet desconocidoFields) |
Métodos heredados
Métodos públicos
public CollectionDef.Builder addRepeatedField (campo com.google.protobuf.Descriptors.FieldDescriptor, valor del objeto)
Colección públicaDef.AnyList.Builder getAnyListBuilder ()
.tensorflow.CollectionDef.AnyList any_list = 5;
Colección públicaDef.AnyListOrBuilder getAnyListOrBuilder ()
.tensorflow.CollectionDef.AnyList any_list = 5;
Colección públicaDef.BytesList.Builder getBytesListBuilder ()
.tensorflow.CollectionDef.BytesList bytes_list = 2;
Colección públicaDef.BytesListOrBuilder getBytesListOrBuilder ()
.tensorflow.CollectionDef.BytesList bytes_list = 2;
público estático final com.google.protobuf.Descriptors.Descriptor getDescriptor ()
público com.google.protobuf.Descriptors.Descriptor getDescriptorForType ()
Colección públicaDef.FloatList.Builder getFloatListBuilder ()
.tensorflow.CollectionDef.FloatList float_list = 4;
Colección públicaDef.FloatListOrBuilder getFloatListOrBuilder ()
.tensorflow.CollectionDef.FloatList float_list = 4;
Colección públicaDef.Int64List.Builder getInt64ListBuilder ()
.tensorflow.CollectionDef.Int64List int64_list = 3;
Colección públicaDef.Int64ListOrBuilder getInt64ListOrBuilder ()
.tensorflow.CollectionDef.Int64List int64_list = 3;
Colección públicaDef.NodeList.Builder getNodeListBuilder ()
.tensorflow.CollectionDef.NodeList node_list = 1;
Colección públicaDef.NodeListOrBuilder getNodeListOrBuilder ()
.tensorflow.CollectionDef.NodeList node_list = 1;
hasAnyList público booleano ()
.tensorflow.CollectionDef.AnyList any_list = 5;
hasBytesList público booleano ()
.tensorflow.CollectionDef.BytesList bytes_list = 2;
hasFloatList público booleano ()
.tensorflow.CollectionDef.FloatList float_list = 4;
hasInt64List booleano público ()
.tensorflow.CollectionDef.Int64List int64_list = 3;
hasNodeList público booleano ()
.tensorflow.CollectionDef.NodeList node_list = 1;
público final booleano isInitialized ()
public CollectionDef.Builder mergeAnyList (valor CollectionDef.AnyList )
.tensorflow.CollectionDef.AnyList any_list = 5;
public CollectionDef.Builder mergeBytesList (valor CollectionDef.BytesList )
.tensorflow.CollectionDef.BytesList bytes_list = 2;
public CollectionDef.Builder mergeFloatList (valor CollectionDef.FloatList )
.tensorflow.CollectionDef.FloatList float_list = 4;
public CollectionDef.Builder mergeFrom (entrada com.google.protobuf.CodedInputStream, com.google.protobuf.ExtensionRegistryLite extensionRegistry)
Lanza
| IOExcepción |
|---|
CollectionDef.Builder público mergeInt64List (valor CollectionDef.Int64List )
.tensorflow.CollectionDef.Int64List int64_list = 3;
public CollectionDef.Builder mergeNodeList (valor CollectionDef.NodeList )
.tensorflow.CollectionDef.NodeList node_list = 1;
CollectionDef.Builder final público mergeUnknownFields (com.google.protobuf.UnknownFieldSet desconocidoFields)
public CollectionDef.Builder setAnyList (valor CollectionDef.AnyList )
.tensorflow.CollectionDef.AnyList any_list = 5;
public CollectionDef.Builder setAnyList ( CollectionDef.AnyList.Builder builderForValue)
.tensorflow.CollectionDef.AnyList any_list = 5;
public CollectionDef.Builder setBytesList ( CollectionDef.BytesList.Builder builderForValue)
.tensorflow.CollectionDef.BytesList bytes_list = 2;
public CollectionDef.Builder setBytesList (valor CollectionDef.BytesList )
.tensorflow.CollectionDef.BytesList bytes_list = 2;
public CollectionDef.Builder setField (campo com.google.protobuf.Descriptors.FieldDescriptor, valor del objeto)
public CollectionDef.Builder setFloatList (valor CollectionDef.FloatList )
.tensorflow.CollectionDef.FloatList float_list = 4;
public CollectionDef.Builder setFloatList ( CollectionDef.FloatList.Builder builderForValue)
.tensorflow.CollectionDef.FloatList float_list = 4;
public CollectionDef.Builder setInt64List (valor CollectionDef.Int64List )
.tensorflow.CollectionDef.Int64List int64_list = 3;
public CollectionDef.Builder setInt64List ( CollectionDef.Int64List.Builder builderForValue)
.tensorflow.CollectionDef.Int64List int64_list = 3;
public CollectionDef.Builder setNodeList ( CollectionDef.NodeList.Builder builderForValue)
.tensorflow.CollectionDef.NodeList node_list = 1;
public CollectionDef.Builder setNodeList (valor CollectionDef.NodeList )
.tensorflow.CollectionDef.NodeList node_list = 1;