Package org.tensorflow.framework
Class CollectionDef.Builder
java.lang.Object
com.google.protobuf.AbstractMessageLite.Builder
com.google.protobuf.AbstractMessage.Builder<CollectionDef.Builder>
com.google.protobuf.GeneratedMessageV3.Builder<CollectionDef.Builder>
org.tensorflow.framework.CollectionDef.Builder
- All Implemented Interfaces:
com.google.protobuf.Message.Builder,com.google.protobuf.MessageLite.Builder,com.google.protobuf.MessageLiteOrBuilder,com.google.protobuf.MessageOrBuilder,Cloneable,CollectionDefOrBuilder
- Enclosing class:
CollectionDef
public static final class CollectionDef.Builder
extends com.google.protobuf.GeneratedMessageV3.Builder<CollectionDef.Builder>
implements CollectionDefOrBuilder
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)
Protobuf type tensorflow.CollectionDef-
Method Summary
Modifier and TypeMethodDescriptionaddRepeatedField(com.google.protobuf.Descriptors.FieldDescriptor field, Object value) build()clear().tensorflow.CollectionDef.AnyList any_list = 5;.tensorflow.CollectionDef.BytesList bytes_list = 2;clearField(com.google.protobuf.Descriptors.FieldDescriptor field) .tensorflow.CollectionDef.FloatList float_list = 4;.tensorflow.CollectionDef.Int64List int64_list = 3;.tensorflow.CollectionDef.NodeList node_list = 1;clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) clone().tensorflow.CollectionDef.AnyList any_list = 5;.tensorflow.CollectionDef.AnyList any_list = 5;.tensorflow.CollectionDef.AnyList any_list = 5;.tensorflow.CollectionDef.BytesList bytes_list = 2;.tensorflow.CollectionDef.BytesList bytes_list = 2;.tensorflow.CollectionDef.BytesList bytes_list = 2;static final com.google.protobuf.Descriptors.Descriptorcom.google.protobuf.Descriptors.Descriptor.tensorflow.CollectionDef.FloatList float_list = 4;.tensorflow.CollectionDef.FloatList float_list = 4;.tensorflow.CollectionDef.FloatList float_list = 4;.tensorflow.CollectionDef.Int64List int64_list = 3;.tensorflow.CollectionDef.Int64List int64_list = 3;.tensorflow.CollectionDef.Int64List int64_list = 3;.tensorflow.CollectionDef.NodeList node_list = 1;.tensorflow.CollectionDef.NodeList node_list = 1;.tensorflow.CollectionDef.NodeList node_list = 1;boolean.tensorflow.CollectionDef.AnyList any_list = 5;boolean.tensorflow.CollectionDef.BytesList bytes_list = 2;boolean.tensorflow.CollectionDef.FloatList float_list = 4;boolean.tensorflow.CollectionDef.Int64List int64_list = 3;boolean.tensorflow.CollectionDef.NodeList node_list = 1;protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTablefinal boolean.tensorflow.CollectionDef.AnyList any_list = 5;.tensorflow.CollectionDef.BytesList bytes_list = 2;.tensorflow.CollectionDef.FloatList float_list = 4;mergeFrom(com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) mergeFrom(com.google.protobuf.Message other) mergeFrom(CollectionDef other) .tensorflow.CollectionDef.Int64List int64_list = 3;.tensorflow.CollectionDef.NodeList node_list = 1;final CollectionDef.BuildermergeUnknownFields(com.google.protobuf.UnknownFieldSet unknownFields) setAnyList(CollectionDef.AnyList value) .tensorflow.CollectionDef.AnyList any_list = 5;setAnyList(CollectionDef.AnyList.Builder builderForValue) .tensorflow.CollectionDef.AnyList any_list = 5;.tensorflow.CollectionDef.BytesList bytes_list = 2;setBytesList(CollectionDef.BytesList.Builder builderForValue) .tensorflow.CollectionDef.BytesList bytes_list = 2;.tensorflow.CollectionDef.FloatList float_list = 4;setFloatList(CollectionDef.FloatList.Builder builderForValue) .tensorflow.CollectionDef.FloatList float_list = 4;.tensorflow.CollectionDef.Int64List int64_list = 3;setInt64List(CollectionDef.Int64List.Builder builderForValue) .tensorflow.CollectionDef.Int64List int64_list = 3;.tensorflow.CollectionDef.NodeList node_list = 1;setNodeList(CollectionDef.NodeList.Builder builderForValue) .tensorflow.CollectionDef.NodeList node_list = 1;setRepeatedField(com.google.protobuf.Descriptors.FieldDescriptor field, int index, Object value) final CollectionDef.BuildersetUnknownFields(com.google.protobuf.UnknownFieldSet unknownFields) Methods inherited from class com.google.protobuf.GeneratedMessageV3.Builder
getAllFields, getField, getFieldBuilder, getOneofFieldDescriptor, getParentForChildren, getRepeatedField, getRepeatedFieldBuilder, getRepeatedFieldCount, getUnknownFields, getUnknownFieldSetBuilder, hasField, hasOneof, internalGetMapField, internalGetMapFieldReflection, internalGetMutableMapField, internalGetMutableMapFieldReflection, isClean, markClean, mergeUnknownLengthDelimitedField, mergeUnknownVarintField, newBuilderForField, onBuilt, onChanged, parseUnknownField, setUnknownFieldSetBuilder, setUnknownFieldsProto3Methods inherited from class com.google.protobuf.AbstractMessage.Builder
findInitializationErrors, getInitializationErrorString, internalMergeFrom, mergeFrom, mergeFrom, mergeFrom, mergeFrom, mergeFrom, mergeFrom, mergeFrom, mergeFrom, mergeFrom, newUninitializedMessageException, toStringMethods inherited from class com.google.protobuf.AbstractMessageLite.Builder
addAll, addAll, mergeDelimitedFrom, mergeDelimitedFrom, mergeFrom, newUninitializedMessageExceptionMethods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface com.google.protobuf.Message.Builder
mergeDelimitedFrom, mergeDelimitedFromMethods inherited from interface com.google.protobuf.MessageLite.Builder
mergeFromMethods inherited from interface com.google.protobuf.MessageOrBuilder
findInitializationErrors, getAllFields, getField, getInitializationErrorString, getOneofFieldDescriptor, getRepeatedField, getRepeatedFieldCount, getUnknownFields, hasField, hasOneof
-
Method Details
-
getDescriptor
public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() -
internalGetFieldAccessorTable
protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable()- Specified by:
internalGetFieldAccessorTablein classcom.google.protobuf.GeneratedMessageV3.Builder<CollectionDef.Builder>
-
clear
- Specified by:
clearin interfacecom.google.protobuf.Message.Builder- Specified by:
clearin interfacecom.google.protobuf.MessageLite.Builder- Overrides:
clearin classcom.google.protobuf.GeneratedMessageV3.Builder<CollectionDef.Builder>
-
getDescriptorForType
public com.google.protobuf.Descriptors.Descriptor getDescriptorForType()- Specified by:
getDescriptorForTypein interfacecom.google.protobuf.Message.Builder- Specified by:
getDescriptorForTypein interfacecom.google.protobuf.MessageOrBuilder- Overrides:
getDescriptorForTypein classcom.google.protobuf.GeneratedMessageV3.Builder<CollectionDef.Builder>
-
getDefaultInstanceForType
- Specified by:
getDefaultInstanceForTypein interfacecom.google.protobuf.MessageLiteOrBuilder- Specified by:
getDefaultInstanceForTypein interfacecom.google.protobuf.MessageOrBuilder
-
build
- Specified by:
buildin interfacecom.google.protobuf.Message.Builder- Specified by:
buildin interfacecom.google.protobuf.MessageLite.Builder
-
buildPartial
- Specified by:
buildPartialin interfacecom.google.protobuf.Message.Builder- Specified by:
buildPartialin interfacecom.google.protobuf.MessageLite.Builder
-
clone
- Specified by:
clonein interfacecom.google.protobuf.Message.Builder- Specified by:
clonein interfacecom.google.protobuf.MessageLite.Builder- Overrides:
clonein classcom.google.protobuf.GeneratedMessageV3.Builder<CollectionDef.Builder>
-
setField
public CollectionDef.Builder setField(com.google.protobuf.Descriptors.FieldDescriptor field, Object value) - Specified by:
setFieldin interfacecom.google.protobuf.Message.Builder- Overrides:
setFieldin classcom.google.protobuf.GeneratedMessageV3.Builder<CollectionDef.Builder>
-
clearField
- Specified by:
clearFieldin interfacecom.google.protobuf.Message.Builder- Overrides:
clearFieldin classcom.google.protobuf.GeneratedMessageV3.Builder<CollectionDef.Builder>
-
clearOneof
- Specified by:
clearOneofin interfacecom.google.protobuf.Message.Builder- Overrides:
clearOneofin classcom.google.protobuf.GeneratedMessageV3.Builder<CollectionDef.Builder>
-
setRepeatedField
public CollectionDef.Builder setRepeatedField(com.google.protobuf.Descriptors.FieldDescriptor field, int index, Object value) - Specified by:
setRepeatedFieldin interfacecom.google.protobuf.Message.Builder- Overrides:
setRepeatedFieldin classcom.google.protobuf.GeneratedMessageV3.Builder<CollectionDef.Builder>
-
addRepeatedField
public CollectionDef.Builder addRepeatedField(com.google.protobuf.Descriptors.FieldDescriptor field, Object value) - Specified by:
addRepeatedFieldin interfacecom.google.protobuf.Message.Builder- Overrides:
addRepeatedFieldin classcom.google.protobuf.GeneratedMessageV3.Builder<CollectionDef.Builder>
-
mergeFrom
- Specified by:
mergeFromin interfacecom.google.protobuf.Message.Builder- Overrides:
mergeFromin classcom.google.protobuf.AbstractMessage.Builder<CollectionDef.Builder>
-
mergeFrom
-
isInitialized
public final boolean isInitialized()- Specified by:
isInitializedin interfacecom.google.protobuf.MessageLiteOrBuilder- Overrides:
isInitializedin classcom.google.protobuf.GeneratedMessageV3.Builder<CollectionDef.Builder>
-
mergeFrom
public CollectionDef.Builder mergeFrom(com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws IOException - Specified by:
mergeFromin interfacecom.google.protobuf.Message.Builder- Specified by:
mergeFromin interfacecom.google.protobuf.MessageLite.Builder- Overrides:
mergeFromin classcom.google.protobuf.AbstractMessage.Builder<CollectionDef.Builder>- Throws:
IOException
-
getKindCase
- Specified by:
getKindCasein interfaceCollectionDefOrBuilder
-
clearKind
-
hasNodeList
public boolean hasNodeList().tensorflow.CollectionDef.NodeList node_list = 1;- Specified by:
hasNodeListin interfaceCollectionDefOrBuilder- Returns:
- Whether the nodeList field is set.
-
getNodeList
.tensorflow.CollectionDef.NodeList node_list = 1;- Specified by:
getNodeListin interfaceCollectionDefOrBuilder- Returns:
- The nodeList.
-
setNodeList
.tensorflow.CollectionDef.NodeList node_list = 1; -
setNodeList
.tensorflow.CollectionDef.NodeList node_list = 1; -
mergeNodeList
.tensorflow.CollectionDef.NodeList node_list = 1; -
clearNodeList
.tensorflow.CollectionDef.NodeList node_list = 1; -
getNodeListBuilder
.tensorflow.CollectionDef.NodeList node_list = 1; -
getNodeListOrBuilder
.tensorflow.CollectionDef.NodeList node_list = 1;- Specified by:
getNodeListOrBuilderin interfaceCollectionDefOrBuilder
-
hasBytesList
public boolean hasBytesList().tensorflow.CollectionDef.BytesList bytes_list = 2;- Specified by:
hasBytesListin interfaceCollectionDefOrBuilder- Returns:
- Whether the bytesList field is set.
-
getBytesList
.tensorflow.CollectionDef.BytesList bytes_list = 2;- Specified by:
getBytesListin interfaceCollectionDefOrBuilder- Returns:
- The bytesList.
-
setBytesList
.tensorflow.CollectionDef.BytesList bytes_list = 2; -
setBytesList
.tensorflow.CollectionDef.BytesList bytes_list = 2; -
mergeBytesList
.tensorflow.CollectionDef.BytesList bytes_list = 2; -
clearBytesList
.tensorflow.CollectionDef.BytesList bytes_list = 2; -
getBytesListBuilder
.tensorflow.CollectionDef.BytesList bytes_list = 2; -
getBytesListOrBuilder
.tensorflow.CollectionDef.BytesList bytes_list = 2;- Specified by:
getBytesListOrBuilderin interfaceCollectionDefOrBuilder
-
hasInt64List
public boolean hasInt64List().tensorflow.CollectionDef.Int64List int64_list = 3;- Specified by:
hasInt64Listin interfaceCollectionDefOrBuilder- Returns:
- Whether the int64List field is set.
-
getInt64List
.tensorflow.CollectionDef.Int64List int64_list = 3;- Specified by:
getInt64Listin interfaceCollectionDefOrBuilder- Returns:
- The int64List.
-
setInt64List
.tensorflow.CollectionDef.Int64List int64_list = 3; -
setInt64List
.tensorflow.CollectionDef.Int64List int64_list = 3; -
mergeInt64List
.tensorflow.CollectionDef.Int64List int64_list = 3; -
clearInt64List
.tensorflow.CollectionDef.Int64List int64_list = 3; -
getInt64ListBuilder
.tensorflow.CollectionDef.Int64List int64_list = 3; -
getInt64ListOrBuilder
.tensorflow.CollectionDef.Int64List int64_list = 3;- Specified by:
getInt64ListOrBuilderin interfaceCollectionDefOrBuilder
-
hasFloatList
public boolean hasFloatList().tensorflow.CollectionDef.FloatList float_list = 4;- Specified by:
hasFloatListin interfaceCollectionDefOrBuilder- Returns:
- Whether the floatList field is set.
-
getFloatList
.tensorflow.CollectionDef.FloatList float_list = 4;- Specified by:
getFloatListin interfaceCollectionDefOrBuilder- Returns:
- The floatList.
-
setFloatList
.tensorflow.CollectionDef.FloatList float_list = 4; -
setFloatList
.tensorflow.CollectionDef.FloatList float_list = 4; -
mergeFloatList
.tensorflow.CollectionDef.FloatList float_list = 4; -
clearFloatList
.tensorflow.CollectionDef.FloatList float_list = 4; -
getFloatListBuilder
.tensorflow.CollectionDef.FloatList float_list = 4; -
getFloatListOrBuilder
.tensorflow.CollectionDef.FloatList float_list = 4;- Specified by:
getFloatListOrBuilderin interfaceCollectionDefOrBuilder
-
hasAnyList
public boolean hasAnyList().tensorflow.CollectionDef.AnyList any_list = 5;- Specified by:
hasAnyListin interfaceCollectionDefOrBuilder- Returns:
- Whether the anyList field is set.
-
getAnyList
.tensorflow.CollectionDef.AnyList any_list = 5;- Specified by:
getAnyListin interfaceCollectionDefOrBuilder- Returns:
- The anyList.
-
setAnyList
.tensorflow.CollectionDef.AnyList any_list = 5; -
setAnyList
.tensorflow.CollectionDef.AnyList any_list = 5; -
mergeAnyList
.tensorflow.CollectionDef.AnyList any_list = 5; -
clearAnyList
.tensorflow.CollectionDef.AnyList any_list = 5; -
getAnyListBuilder
.tensorflow.CollectionDef.AnyList any_list = 5; -
getAnyListOrBuilder
.tensorflow.CollectionDef.AnyList any_list = 5;- Specified by:
getAnyListOrBuilderin interfaceCollectionDefOrBuilder
-
setUnknownFields
public final CollectionDef.Builder setUnknownFields(com.google.protobuf.UnknownFieldSet unknownFields) - Specified by:
setUnknownFieldsin interfacecom.google.protobuf.Message.Builder- Overrides:
setUnknownFieldsin classcom.google.protobuf.GeneratedMessageV3.Builder<CollectionDef.Builder>
-
mergeUnknownFields
public final CollectionDef.Builder mergeUnknownFields(com.google.protobuf.UnknownFieldSet unknownFields) - Specified by:
mergeUnknownFieldsin interfacecom.google.protobuf.Message.Builder- Overrides:
mergeUnknownFieldsin classcom.google.protobuf.GeneratedMessageV3.Builder<CollectionDef.Builder>
-