Class CollectionDef.Builder

  • All Implemented Interfaces:
    com.google.protobuf.Message.Builder, com.google.protobuf.MessageLite.Builder, com.google.protobuf.MessageLiteOrBuilder, com.google.protobuf.MessageOrBuilder, java.lang.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 org.platanios.tensorflow.proto.CollectionDef
    • Method Detail

      • 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.Builder<CollectionDef.Builder>
      • clear

        public CollectionDef.Builder clear()
        Specified by:
        clear in interface com.google.protobuf.Message.Builder
        Specified by:
        clear in interface com.google.protobuf.MessageLite.Builder
        Overrides:
        clear in class com.google.protobuf.GeneratedMessageV3.Builder<CollectionDef.Builder>
      • getDescriptorForType

        public com.google.protobuf.Descriptors.Descriptor getDescriptorForType()
        Specified by:
        getDescriptorForType in interface com.google.protobuf.Message.Builder
        Specified by:
        getDescriptorForType in interface com.google.protobuf.MessageOrBuilder
        Overrides:
        getDescriptorForType in class com.google.protobuf.GeneratedMessageV3.Builder<CollectionDef.Builder>
      • getDefaultInstanceForType

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

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

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

        public CollectionDef.Builder clone()
        Specified by:
        clone in interface com.google.protobuf.Message.Builder
        Specified by:
        clone in interface com.google.protobuf.MessageLite.Builder
        Overrides:
        clone in class com.google.protobuf.GeneratedMessageV3.Builder<CollectionDef.Builder>
      • setField

        public CollectionDef.Builder setField​(com.google.protobuf.Descriptors.FieldDescriptor field,
                                              java.lang.Object value)
        Specified by:
        setField in interface com.google.protobuf.Message.Builder
        Overrides:
        setField in class com.google.protobuf.GeneratedMessageV3.Builder<CollectionDef.Builder>
      • clearField

        public CollectionDef.Builder clearField​(com.google.protobuf.Descriptors.FieldDescriptor field)
        Specified by:
        clearField in interface com.google.protobuf.Message.Builder
        Overrides:
        clearField in class com.google.protobuf.GeneratedMessageV3.Builder<CollectionDef.Builder>
      • clearOneof

        public CollectionDef.Builder clearOneof​(com.google.protobuf.Descriptors.OneofDescriptor oneof)
        Specified by:
        clearOneof in interface com.google.protobuf.Message.Builder
        Overrides:
        clearOneof in class com.google.protobuf.GeneratedMessageV3.Builder<CollectionDef.Builder>
      • setRepeatedField

        public CollectionDef.Builder setRepeatedField​(com.google.protobuf.Descriptors.FieldDescriptor field,
                                                      int index,
                                                      java.lang.Object value)
        Specified by:
        setRepeatedField in interface com.google.protobuf.Message.Builder
        Overrides:
        setRepeatedField in class com.google.protobuf.GeneratedMessageV3.Builder<CollectionDef.Builder>
      • addRepeatedField

        public CollectionDef.Builder addRepeatedField​(com.google.protobuf.Descriptors.FieldDescriptor field,
                                                      java.lang.Object value)
        Specified by:
        addRepeatedField in interface com.google.protobuf.Message.Builder
        Overrides:
        addRepeatedField in class com.google.protobuf.GeneratedMessageV3.Builder<CollectionDef.Builder>
      • mergeFrom

        public CollectionDef.Builder mergeFrom​(com.google.protobuf.Message other)
        Specified by:
        mergeFrom in interface com.google.protobuf.Message.Builder
        Overrides:
        mergeFrom in class com.google.protobuf.AbstractMessage.Builder<CollectionDef.Builder>
      • isInitialized

        public final boolean isInitialized()
        Specified by:
        isInitialized in interface com.google.protobuf.MessageLiteOrBuilder
        Overrides:
        isInitialized in class com.google.protobuf.GeneratedMessageV3.Builder<CollectionDef.Builder>
      • mergeFrom

        public CollectionDef.Builder mergeFrom​(com.google.protobuf.CodedInputStream input,
                                               com.google.protobuf.ExtensionRegistryLite extensionRegistry)
                                        throws java.io.IOException
        Specified by:
        mergeFrom in interface com.google.protobuf.Message.Builder
        Specified by:
        mergeFrom in interface com.google.protobuf.MessageLite.Builder
        Overrides:
        mergeFrom in class com.google.protobuf.AbstractMessage.Builder<CollectionDef.Builder>
        Throws:
        java.io.IOException
      • hasNodeList

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

        public CollectionDef.Builder clearNodeList()
        .org.platanios.tensorflow.proto.CollectionDef.NodeList node_list = 1;
      • getNodeListBuilder

        public CollectionDef.NodeList.Builder getNodeListBuilder()
        .org.platanios.tensorflow.proto.CollectionDef.NodeList node_list = 1;
      • hasBytesList

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

        public CollectionDef.Builder clearBytesList()
        .org.platanios.tensorflow.proto.CollectionDef.BytesList bytes_list = 2;
      • getBytesListBuilder

        public CollectionDef.BytesList.Builder getBytesListBuilder()
        .org.platanios.tensorflow.proto.CollectionDef.BytesList bytes_list = 2;
      • hasInt64List

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

        public CollectionDef.Builder clearInt64List()
        .org.platanios.tensorflow.proto.CollectionDef.Int64List int64_list = 3;
      • getInt64ListBuilder

        public CollectionDef.Int64List.Builder getInt64ListBuilder()
        .org.platanios.tensorflow.proto.CollectionDef.Int64List int64_list = 3;
      • hasFloatList

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

        public CollectionDef.Builder clearFloatList()
        .org.platanios.tensorflow.proto.CollectionDef.FloatList float_list = 4;
      • getFloatListBuilder

        public CollectionDef.FloatList.Builder getFloatListBuilder()
        .org.platanios.tensorflow.proto.CollectionDef.FloatList float_list = 4;
      • hasAnyList

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

        public CollectionDef.Builder clearAnyList()
        .org.platanios.tensorflow.proto.CollectionDef.AnyList any_list = 5;
      • getAnyListBuilder

        public CollectionDef.AnyList.Builder getAnyListBuilder()
        .org.platanios.tensorflow.proto.CollectionDef.AnyList any_list = 5;
      • setUnknownFields

        public final CollectionDef.Builder setUnknownFields​(com.google.protobuf.UnknownFieldSet unknownFields)
        Specified by:
        setUnknownFields in interface com.google.protobuf.Message.Builder
        Overrides:
        setUnknownFields in class com.google.protobuf.GeneratedMessageV3.Builder<CollectionDef.Builder>
      • mergeUnknownFields

        public final CollectionDef.Builder mergeUnknownFields​(com.google.protobuf.UnknownFieldSet unknownFields)
        Specified by:
        mergeUnknownFields in interface com.google.protobuf.Message.Builder
        Overrides:
        mergeUnknownFields in class com.google.protobuf.GeneratedMessageV3.Builder<CollectionDef.Builder>