Class CollectionDef
java.lang.Object
com.google.protobuf.AbstractMessageLite
com.google.protobuf.AbstractMessage
com.google.protobuf.GeneratedMessageV3
org.tensorflow.proto.CollectionDef
- All Implemented Interfaces:
Message, MessageLite, MessageLiteOrBuilder, MessageOrBuilder, Serializable, 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- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classAnyList is used for collecting Any protos.static interfacestatic final classCollectionDef should cover most collections.static final classBytesList is used for collecting strings and serialized protobufs.static interfacestatic final classFloatList is used for collecting float values.static interfacestatic final classInt64List is used for collecting int, int64 and long values.static interfacestatic enumstatic final classNodeList is used for collecting nodes in graph.static interfaceNested classes/interfaces inherited from class GeneratedMessageV3
GeneratedMessageV3.BuilderParent, GeneratedMessageV3.ExtendableBuilder<MessageType, BuilderType>, GeneratedMessageV3.ExtendableMessage<MessageType>, GeneratedMessageV3.ExtendableMessageOrBuilder<MessageType>, GeneratedMessageV3.FieldAccessorTable, GeneratedMessageV3.UnusedPrivateParameterNested classes/interfaces inherited from class AbstractMessageLite
AbstractMessageLite.InternalOneOfEnum -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intstatic final intstatic final intstatic final intstatic final intFields inherited from class GeneratedMessageV3
alwaysUseFieldBuilders, unknownFieldsFields inherited from class AbstractMessage
memoizedSizeFields inherited from class AbstractMessageLite
memoizedHashCode -
Method Summary
Modifier and TypeMethodDescriptionboolean.tensorflow.CollectionDef.AnyList any_list = 5;.tensorflow.CollectionDef.AnyList any_list = 5;.tensorflow.CollectionDef.BytesList bytes_list = 2;.tensorflow.CollectionDef.BytesList bytes_list = 2;static CollectionDefstatic final Descriptors.Descriptor.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.NodeList node_list = 1;.tensorflow.CollectionDef.NodeList node_list = 1;intfinal UnknownFieldSetboolean.tensorflow.CollectionDef.AnyList any_list = 5;boolean.tensorflow.CollectionDef.BytesList bytes_list = 2;boolean.tensorflow.CollectionDef.FloatList float_list = 4;inthashCode()boolean.tensorflow.CollectionDef.Int64List int64_list = 3;boolean.tensorflow.CollectionDef.NodeList node_list = 1;protected GeneratedMessageV3.FieldAccessorTablefinal booleanstatic CollectionDef.Builderstatic CollectionDef.BuildernewBuilder(CollectionDef prototype) protected CollectionDef.Builderprotected Objectstatic CollectionDefparseDelimitedFrom(InputStream input) static CollectionDefparseDelimitedFrom(InputStream input, ExtensionRegistryLite extensionRegistry) static CollectionDefparseFrom(byte[] data) static CollectionDefparseFrom(byte[] data, ExtensionRegistryLite extensionRegistry) static CollectionDefparseFrom(ByteString data) static CollectionDefparseFrom(ByteString data, ExtensionRegistryLite extensionRegistry) static CollectionDefparseFrom(CodedInputStream input) static CollectionDefparseFrom(CodedInputStream input, ExtensionRegistryLite extensionRegistry) static CollectionDefparseFrom(InputStream input) static CollectionDefparseFrom(InputStream input, ExtensionRegistryLite extensionRegistry) static CollectionDefparseFrom(ByteBuffer data) static CollectionDefparseFrom(ByteBuffer data, ExtensionRegistryLite extensionRegistry) static Parser<CollectionDef> parser()voidwriteTo(CodedOutputStream output) Methods inherited from class GeneratedMessageV3
canUseUnsafe, computeStringSize, computeStringSizeNoTag, emptyBooleanList, emptyDoubleList, emptyFloatList, emptyIntList, emptyLongList, getAllFields, getDescriptorForType, getField, getOneofFieldDescriptor, getRepeatedField, getRepeatedFieldCount, hasField, hasOneof, internalGetMapField, isStringEmpty, makeExtensionsImmutable, mergeFromAndMakeImmutableInternal, mutableCopy, mutableCopy, mutableCopy, mutableCopy, mutableCopy, newBooleanList, newBuilderForType, newDoubleList, newFloatList, newIntList, newLongList, parseDelimitedWithIOException, parseDelimitedWithIOException, parseUnknownField, parseUnknownFieldProto3, parseWithIOException, parseWithIOException, parseWithIOException, parseWithIOException, serializeBooleanMapTo, serializeIntegerMapTo, serializeLongMapTo, serializeStringMapTo, writeReplace, writeString, writeStringNoTagMethods inherited from class AbstractMessage
findInitializationErrors, getInitializationErrorString, hashBoolean, hashEnum, hashEnumList, hashFields, hashLong, toStringMethods inherited from class AbstractMessageLite
addAll, addAll, checkByteStringIsUtf8, toByteArray, toByteString, writeDelimitedTo, writeToMethods inherited from interface MessageLite
toByteArray, toByteString, writeDelimitedTo, writeToMethods inherited from interface MessageOrBuilder
findInitializationErrors, getAllFields, getDescriptorForType, getField, getInitializationErrorString, getOneofFieldDescriptor, getRepeatedField, getRepeatedFieldCount, hasField, hasOneof
-
Field Details
-
NODE_LIST_FIELD_NUMBER
public static final int NODE_LIST_FIELD_NUMBER- See Also:
-
BYTES_LIST_FIELD_NUMBER
public static final int BYTES_LIST_FIELD_NUMBER- See Also:
-
INT64_LIST_FIELD_NUMBER
public static final int INT64_LIST_FIELD_NUMBER- See Also:
-
FLOAT_LIST_FIELD_NUMBER
public static final int FLOAT_LIST_FIELD_NUMBER- See Also:
-
ANY_LIST_FIELD_NUMBER
public static final int ANY_LIST_FIELD_NUMBER- See Also:
-
-
Method Details
-
newInstance
- Overrides:
newInstancein classGeneratedMessageV3
-
getUnknownFields
- Specified by:
getUnknownFieldsin interfaceMessageOrBuilder- Overrides:
getUnknownFieldsin classGeneratedMessageV3
-
getDescriptor
-
internalGetFieldAccessorTable
- Specified by:
internalGetFieldAccessorTablein classGeneratedMessageV3
-
getKindCase
- Specified by:
getKindCasein interfaceCollectionDefOrBuilder
-
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.
-
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.
-
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.
-
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.
-
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.
-
getAnyListOrBuilder
.tensorflow.CollectionDef.AnyList any_list = 5;- Specified by:
getAnyListOrBuilderin interfaceCollectionDefOrBuilder
-
isInitialized
public final boolean isInitialized()- Specified by:
isInitializedin interfaceMessageLiteOrBuilder- Overrides:
isInitializedin classGeneratedMessageV3
-
writeTo
- Specified by:
writeToin interfaceMessageLite- Overrides:
writeToin classGeneratedMessageV3- Throws:
IOException
-
getSerializedSize
public int getSerializedSize()- Specified by:
getSerializedSizein interfaceMessageLite- Overrides:
getSerializedSizein classGeneratedMessageV3
-
equals
- Specified by:
equalsin interfaceMessage- Overrides:
equalsin classAbstractMessage
-
hashCode
public int hashCode()- Specified by:
hashCodein interfaceMessage- Overrides:
hashCodein classAbstractMessage
-
parseFrom
- Throws:
InvalidProtocolBufferException
-
parseFrom
public static CollectionDef parseFrom(ByteBuffer data, ExtensionRegistryLite extensionRegistry) throws InvalidProtocolBufferException - Throws:
InvalidProtocolBufferException
-
parseFrom
- Throws:
InvalidProtocolBufferException
-
parseFrom
public static CollectionDef parseFrom(ByteString data, ExtensionRegistryLite extensionRegistry) throws InvalidProtocolBufferException - Throws:
InvalidProtocolBufferException
-
parseFrom
- Throws:
InvalidProtocolBufferException
-
parseFrom
public static CollectionDef parseFrom(byte[] data, ExtensionRegistryLite extensionRegistry) throws InvalidProtocolBufferException - Throws:
InvalidProtocolBufferException
-
parseFrom
- Throws:
IOException
-
parseFrom
public static CollectionDef parseFrom(InputStream input, ExtensionRegistryLite extensionRegistry) throws IOException - Throws:
IOException
-
parseDelimitedFrom
- Throws:
IOException
-
parseDelimitedFrom
public static CollectionDef parseDelimitedFrom(InputStream input, ExtensionRegistryLite extensionRegistry) throws IOException - Throws:
IOException
-
parseFrom
- Throws:
IOException
-
parseFrom
public static CollectionDef parseFrom(CodedInputStream input, ExtensionRegistryLite extensionRegistry) throws IOException - Throws:
IOException
-
newBuilderForType
- Specified by:
newBuilderForTypein interfaceMessage- Specified by:
newBuilderForTypein interfaceMessageLite
-
newBuilder
-
newBuilder
-
toBuilder
- Specified by:
toBuilderin interfaceMessage- Specified by:
toBuilderin interfaceMessageLite
-
newBuilderForType
- Specified by:
newBuilderForTypein classGeneratedMessageV3
-
getDefaultInstance
-
parser
-
getParserForType
- Specified by:
getParserForTypein interfaceMessage- Specified by:
getParserForTypein interfaceMessageLite- Overrides:
getParserForTypein classGeneratedMessageV3
-
getDefaultInstanceForType
- Specified by:
getDefaultInstanceForTypein interfaceMessageLiteOrBuilder- Specified by:
getDefaultInstanceForTypein interfaceMessageOrBuilder
-