Class CollectionDef

java.lang.Object
com.google.protobuf.AbstractMessageLite
com.google.protobuf.AbstractMessage
com.google.protobuf.GeneratedMessageV3
org.tensorflow.framework.CollectionDef
All Implemented Interfaces:
com.google.protobuf.Message, com.google.protobuf.MessageLite, com.google.protobuf.MessageLiteOrBuilder, com.google.protobuf.MessageOrBuilder, Serializable, CollectionDefOrBuilder

public final class CollectionDef extends com.google.protobuf.GeneratedMessageV3 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
See Also:
  • 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

      protected Object newInstance(com.google.protobuf.GeneratedMessageV3.UnusedPrivateParameter unused)
      Overrides:
      newInstance in class com.google.protobuf.GeneratedMessageV3
    • getDescriptor

      public static final com.google.protobuf.Descriptors.Descriptor getDescriptor()
    • internalGetFieldAccessorTable

      protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable()
      Specified by:
      internalGetFieldAccessorTable in class com.google.protobuf.GeneratedMessageV3
    • getKindCase

      public CollectionDef.KindCase getKindCase()
      Specified by:
      getKindCase in interface CollectionDefOrBuilder
    • hasNodeList

      public boolean hasNodeList()
      .tensorflow.CollectionDef.NodeList node_list = 1;
      Specified by:
      hasNodeList in interface CollectionDefOrBuilder
      Returns:
      Whether the nodeList field is set.
    • getNodeList

      public CollectionDef.NodeList getNodeList()
      .tensorflow.CollectionDef.NodeList node_list = 1;
      Specified by:
      getNodeList in interface CollectionDefOrBuilder
      Returns:
      The nodeList.
    • getNodeListOrBuilder

      public CollectionDef.NodeListOrBuilder getNodeListOrBuilder()
      .tensorflow.CollectionDef.NodeList node_list = 1;
      Specified by:
      getNodeListOrBuilder in interface CollectionDefOrBuilder
    • hasBytesList

      public boolean hasBytesList()
      .tensorflow.CollectionDef.BytesList bytes_list = 2;
      Specified by:
      hasBytesList in interface CollectionDefOrBuilder
      Returns:
      Whether the bytesList field is set.
    • getBytesList

      public CollectionDef.BytesList getBytesList()
      .tensorflow.CollectionDef.BytesList bytes_list = 2;
      Specified by:
      getBytesList in interface CollectionDefOrBuilder
      Returns:
      The bytesList.
    • getBytesListOrBuilder

      public CollectionDef.BytesListOrBuilder getBytesListOrBuilder()
      .tensorflow.CollectionDef.BytesList bytes_list = 2;
      Specified by:
      getBytesListOrBuilder in interface CollectionDefOrBuilder
    • hasInt64List

      public boolean hasInt64List()
      .tensorflow.CollectionDef.Int64List int64_list = 3;
      Specified by:
      hasInt64List in interface CollectionDefOrBuilder
      Returns:
      Whether the int64List field is set.
    • getInt64List

      public CollectionDef.Int64List getInt64List()
      .tensorflow.CollectionDef.Int64List int64_list = 3;
      Specified by:
      getInt64List in interface CollectionDefOrBuilder
      Returns:
      The int64List.
    • getInt64ListOrBuilder

      public CollectionDef.Int64ListOrBuilder getInt64ListOrBuilder()
      .tensorflow.CollectionDef.Int64List int64_list = 3;
      Specified by:
      getInt64ListOrBuilder in interface CollectionDefOrBuilder
    • hasFloatList

      public boolean hasFloatList()
      .tensorflow.CollectionDef.FloatList float_list = 4;
      Specified by:
      hasFloatList in interface CollectionDefOrBuilder
      Returns:
      Whether the floatList field is set.
    • getFloatList

      public CollectionDef.FloatList getFloatList()
      .tensorflow.CollectionDef.FloatList float_list = 4;
      Specified by:
      getFloatList in interface CollectionDefOrBuilder
      Returns:
      The floatList.
    • getFloatListOrBuilder

      public CollectionDef.FloatListOrBuilder getFloatListOrBuilder()
      .tensorflow.CollectionDef.FloatList float_list = 4;
      Specified by:
      getFloatListOrBuilder in interface CollectionDefOrBuilder
    • hasAnyList

      public boolean hasAnyList()
      .tensorflow.CollectionDef.AnyList any_list = 5;
      Specified by:
      hasAnyList in interface CollectionDefOrBuilder
      Returns:
      Whether the anyList field is set.
    • getAnyList

      public CollectionDef.AnyList getAnyList()
      .tensorflow.CollectionDef.AnyList any_list = 5;
      Specified by:
      getAnyList in interface CollectionDefOrBuilder
      Returns:
      The anyList.
    • getAnyListOrBuilder

      public CollectionDef.AnyListOrBuilder getAnyListOrBuilder()
      .tensorflow.CollectionDef.AnyList any_list = 5;
      Specified by:
      getAnyListOrBuilder in interface CollectionDefOrBuilder
    • isInitialized

      public final boolean isInitialized()
      Specified by:
      isInitialized in interface com.google.protobuf.MessageLiteOrBuilder
      Overrides:
      isInitialized in class com.google.protobuf.GeneratedMessageV3
    • writeTo

      public void writeTo(com.google.protobuf.CodedOutputStream output) throws IOException
      Specified by:
      writeTo in interface com.google.protobuf.MessageLite
      Overrides:
      writeTo in class com.google.protobuf.GeneratedMessageV3
      Throws:
      IOException
    • getSerializedSize

      public int getSerializedSize()
      Specified by:
      getSerializedSize in interface com.google.protobuf.MessageLite
      Overrides:
      getSerializedSize in class com.google.protobuf.GeneratedMessageV3
    • equals

      public boolean equals(Object obj)
      Specified by:
      equals in interface com.google.protobuf.Message
      Overrides:
      equals in class com.google.protobuf.AbstractMessage
    • hashCode

      public int hashCode()
      Specified by:
      hashCode in interface com.google.protobuf.Message
      Overrides:
      hashCode in class com.google.protobuf.AbstractMessage
    • parseFrom

      public static CollectionDef parseFrom(ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException
      Throws:
      com.google.protobuf.InvalidProtocolBufferException
    • parseFrom

      public static CollectionDef parseFrom(ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException
      Throws:
      com.google.protobuf.InvalidProtocolBufferException
    • parseFrom

      public static CollectionDef parseFrom(com.google.protobuf.ByteString data) throws com.google.protobuf.InvalidProtocolBufferException
      Throws:
      com.google.protobuf.InvalidProtocolBufferException
    • parseFrom

      public static CollectionDef parseFrom(com.google.protobuf.ByteString data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException
      Throws:
      com.google.protobuf.InvalidProtocolBufferException
    • parseFrom

      public static CollectionDef parseFrom(byte[] data) throws com.google.protobuf.InvalidProtocolBufferException
      Throws:
      com.google.protobuf.InvalidProtocolBufferException
    • parseFrom

      public static CollectionDef parseFrom(byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException
      Throws:
      com.google.protobuf.InvalidProtocolBufferException
    • parseFrom

      public static CollectionDef parseFrom(InputStream input) throws IOException
      Throws:
      IOException
    • parseFrom

      public static CollectionDef parseFrom(InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws IOException
      Throws:
      IOException
    • parseDelimitedFrom

      public static CollectionDef parseDelimitedFrom(InputStream input) throws IOException
      Throws:
      IOException
    • parseDelimitedFrom

      public static CollectionDef parseDelimitedFrom(InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws IOException
      Throws:
      IOException
    • parseFrom

      public static CollectionDef parseFrom(com.google.protobuf.CodedInputStream input) throws IOException
      Throws:
      IOException
    • parseFrom

      public static CollectionDef parseFrom(com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws IOException
      Throws:
      IOException
    • newBuilderForType

      public CollectionDef.Builder newBuilderForType()
      Specified by:
      newBuilderForType in interface com.google.protobuf.Message
      Specified by:
      newBuilderForType in interface com.google.protobuf.MessageLite
    • newBuilder

      public static CollectionDef.Builder newBuilder()
    • newBuilder

      public static CollectionDef.Builder newBuilder(CollectionDef prototype)
    • toBuilder

      public CollectionDef.Builder toBuilder()
      Specified by:
      toBuilder in interface com.google.protobuf.Message
      Specified by:
      toBuilder in interface com.google.protobuf.MessageLite
    • newBuilderForType

      protected CollectionDef.Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent)
      Specified by:
      newBuilderForType in class com.google.protobuf.GeneratedMessageV3
    • getDefaultInstance

      public static CollectionDef getDefaultInstance()
    • parser

      public static com.google.protobuf.Parser<CollectionDef> parser()
    • getParserForType

      public com.google.protobuf.Parser<CollectionDef> getParserForType()
      Specified by:
      getParserForType in interface com.google.protobuf.Message
      Specified by:
      getParserForType in interface com.google.protobuf.MessageLite
      Overrides:
      getParserForType in class com.google.protobuf.GeneratedMessageV3
    • getDefaultInstanceForType

      public CollectionDef getDefaultInstanceForType()
      Specified by:
      getDefaultInstanceForType in interface com.google.protobuf.MessageLiteOrBuilder
      Specified by:
      getDefaultInstanceForType in interface com.google.protobuf.MessageOrBuilder