Class Struct.StructuredValue.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, Struct.StructuredValueOrBuilder
    Enclosing class:
    Struct.StructuredValue

    public static final class Struct.StructuredValue.Builder
    extends com.google.protobuf.GeneratedMessageV3.Builder<Struct.StructuredValue.Builder>
    implements Struct.StructuredValueOrBuilder
     `StructuredValue` represents a dynamically typed value representing various
     data structures that are inspired by Python data structures typically used in
     TensorFlow functions as inputs and outputs.
     For example when saving a Layer there may be a `training` argument. If the
     user passes a boolean True/False, that switches between two concrete
     TensorFlow functions. In order to switch between them in the same way after
     loading the SavedModel, we need to represent "True" and "False".
     A more advanced example might be a function which takes a list of
     dictionaries mapping from strings to Tensors. In order to map from
     user-specified arguments `[{"a": tf.constant(1.)}, {"q": tf.constant(3.)}]`
     after load to the right saved TensorFlow function, we need to represent the
     nested structure and the strings, recording that we have a trace for anything
     matching `[{"a": tf.TensorSpec(None, tf.float32)}, {"q": tf.TensorSpec([],
     tf.float64)}]` as an example.
     Likewise functions may return nested structures of Tensors, for example
     returning a dictionary mapping from strings to Tensors. In order for the
     loaded function to return the same structure we need to serialize it.
     This is an ergonomic aid for working with loaded SavedModels, not a promise
     to serialize all possible function signatures. For example we do not expect
     to pickle generic Python objects, and ideally we'd stay language-agnostic.
     
    Protobuf type org.platanios.tensorflow.proto.StructuredValue
    • 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<Struct.StructuredValue.Builder>
      • clear

        public Struct.StructuredValue.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<Struct.StructuredValue.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<Struct.StructuredValue.Builder>
      • getDefaultInstanceForType

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

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

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

        public Struct.StructuredValue.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<Struct.StructuredValue.Builder>
      • setField

        public Struct.StructuredValue.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<Struct.StructuredValue.Builder>
      • clearField

        public Struct.StructuredValue.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<Struct.StructuredValue.Builder>
      • clearOneof

        public Struct.StructuredValue.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<Struct.StructuredValue.Builder>
      • setRepeatedField

        public Struct.StructuredValue.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<Struct.StructuredValue.Builder>
      • addRepeatedField

        public Struct.StructuredValue.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<Struct.StructuredValue.Builder>
      • isInitialized

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

        public Struct.StructuredValue.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<Struct.StructuredValue.Builder>
        Throws:
        java.io.IOException
      • hasNoneValue

        public boolean hasNoneValue()
         Represents None.
         
        .org.platanios.tensorflow.proto.NoneValue none_value = 1;
        Specified by:
        hasNoneValue in interface Struct.StructuredValueOrBuilder
        Returns:
        Whether the noneValue field is set.
      • getNoneValueBuilder

        public Struct.NoneValue.Builder getNoneValueBuilder()
         Represents None.
         
        .org.platanios.tensorflow.proto.NoneValue none_value = 1;
      • getFloat64Value

        public double getFloat64Value()
         Represents a double-precision floating-point value (a Python `float`).
         
        double float64_value = 11;
        Specified by:
        getFloat64Value in interface Struct.StructuredValueOrBuilder
        Returns:
        The float64Value.
      • setFloat64Value

        public Struct.StructuredValue.Builder setFloat64Value​(double value)
         Represents a double-precision floating-point value (a Python `float`).
         
        double float64_value = 11;
        Parameters:
        value - The float64Value to set.
        Returns:
        This builder for chaining.
      • clearFloat64Value

        public Struct.StructuredValue.Builder clearFloat64Value()
         Represents a double-precision floating-point value (a Python `float`).
         
        double float64_value = 11;
        Returns:
        This builder for chaining.
      • getInt64Value

        public long getInt64Value()
         Represents a signed integer value, limited to 64 bits.
         Larger values from Python's arbitrary-precision integers are unsupported.
         
        sint64 int64_value = 12;
        Specified by:
        getInt64Value in interface Struct.StructuredValueOrBuilder
        Returns:
        The int64Value.
      • setInt64Value

        public Struct.StructuredValue.Builder setInt64Value​(long value)
         Represents a signed integer value, limited to 64 bits.
         Larger values from Python's arbitrary-precision integers are unsupported.
         
        sint64 int64_value = 12;
        Parameters:
        value - The int64Value to set.
        Returns:
        This builder for chaining.
      • clearInt64Value

        public Struct.StructuredValue.Builder clearInt64Value()
         Represents a signed integer value, limited to 64 bits.
         Larger values from Python's arbitrary-precision integers are unsupported.
         
        sint64 int64_value = 12;
        Returns:
        This builder for chaining.
      • getStringValue

        public java.lang.String getStringValue()
         Represents a string of Unicode characters stored in a Python `str`.
         In Python 3, this is exactly what type `str` is.
         In Python 2, this is the UTF-8 encoding of the characters.
         For strings with ASCII characters only (as often used in TensorFlow code)
         there is effectively no difference between the language versions.
         The obsolescent `unicode` type of Python 2 is not supported here.
         
        string string_value = 13;
        Specified by:
        getStringValue in interface Struct.StructuredValueOrBuilder
        Returns:
        The stringValue.
      • getStringValueBytes

        public com.google.protobuf.ByteString getStringValueBytes()
         Represents a string of Unicode characters stored in a Python `str`.
         In Python 3, this is exactly what type `str` is.
         In Python 2, this is the UTF-8 encoding of the characters.
         For strings with ASCII characters only (as often used in TensorFlow code)
         there is effectively no difference between the language versions.
         The obsolescent `unicode` type of Python 2 is not supported here.
         
        string string_value = 13;
        Specified by:
        getStringValueBytes in interface Struct.StructuredValueOrBuilder
        Returns:
        The bytes for stringValue.
      • setStringValue

        public Struct.StructuredValue.Builder setStringValue​(java.lang.String value)
         Represents a string of Unicode characters stored in a Python `str`.
         In Python 3, this is exactly what type `str` is.
         In Python 2, this is the UTF-8 encoding of the characters.
         For strings with ASCII characters only (as often used in TensorFlow code)
         there is effectively no difference between the language versions.
         The obsolescent `unicode` type of Python 2 is not supported here.
         
        string string_value = 13;
        Parameters:
        value - The stringValue to set.
        Returns:
        This builder for chaining.
      • clearStringValue

        public Struct.StructuredValue.Builder clearStringValue()
         Represents a string of Unicode characters stored in a Python `str`.
         In Python 3, this is exactly what type `str` is.
         In Python 2, this is the UTF-8 encoding of the characters.
         For strings with ASCII characters only (as often used in TensorFlow code)
         there is effectively no difference between the language versions.
         The obsolescent `unicode` type of Python 2 is not supported here.
         
        string string_value = 13;
        Returns:
        This builder for chaining.
      • setStringValueBytes

        public Struct.StructuredValue.Builder setStringValueBytes​(com.google.protobuf.ByteString value)
         Represents a string of Unicode characters stored in a Python `str`.
         In Python 3, this is exactly what type `str` is.
         In Python 2, this is the UTF-8 encoding of the characters.
         For strings with ASCII characters only (as often used in TensorFlow code)
         there is effectively no difference between the language versions.
         The obsolescent `unicode` type of Python 2 is not supported here.
         
        string string_value = 13;
        Parameters:
        value - The bytes for stringValue to set.
        Returns:
        This builder for chaining.
      • setBoolValue

        public Struct.StructuredValue.Builder setBoolValue​(boolean value)
         Represents a boolean value.
         
        bool bool_value = 14;
        Parameters:
        value - The boolValue to set.
        Returns:
        This builder for chaining.
      • clearBoolValue

        public Struct.StructuredValue.Builder clearBoolValue()
         Represents a boolean value.
         
        bool bool_value = 14;
        Returns:
        This builder for chaining.
      • hasTensorShapeValue

        public boolean hasTensorShapeValue()
         Represents a TensorShape.
         
        .org.platanios.tensorflow.proto.TensorShapeProto tensor_shape_value = 31;
        Specified by:
        hasTensorShapeValue in interface Struct.StructuredValueOrBuilder
        Returns:
        Whether the tensorShapeValue field is set.
      • clearTensorShapeValue

        public Struct.StructuredValue.Builder clearTensorShapeValue()
         Represents a TensorShape.
         
        .org.platanios.tensorflow.proto.TensorShapeProto tensor_shape_value = 31;
      • getTensorShapeValueBuilder

        public TensorShapeProto.Builder getTensorShapeValueBuilder()
         Represents a TensorShape.
         
        .org.platanios.tensorflow.proto.TensorShapeProto tensor_shape_value = 31;
      • getTensorDtypeValueValue

        public int getTensorDtypeValueValue()
         Represents an enum value for dtype.
         
        .org.platanios.tensorflow.proto.DataType tensor_dtype_value = 32;
        Specified by:
        getTensorDtypeValueValue in interface Struct.StructuredValueOrBuilder
        Returns:
        The enum numeric value on the wire for tensorDtypeValue.
      • setTensorDtypeValueValue

        public Struct.StructuredValue.Builder setTensorDtypeValueValue​(int value)
         Represents an enum value for dtype.
         
        .org.platanios.tensorflow.proto.DataType tensor_dtype_value = 32;
        Parameters:
        value - The enum numeric value on the wire for tensorDtypeValue to set.
        Returns:
        This builder for chaining.
      • setTensorDtypeValue

        public Struct.StructuredValue.Builder setTensorDtypeValue​(DataType value)
         Represents an enum value for dtype.
         
        .org.platanios.tensorflow.proto.DataType tensor_dtype_value = 32;
        Parameters:
        value - The tensorDtypeValue to set.
        Returns:
        This builder for chaining.
      • clearTensorDtypeValue

        public Struct.StructuredValue.Builder clearTensorDtypeValue()
         Represents an enum value for dtype.
         
        .org.platanios.tensorflow.proto.DataType tensor_dtype_value = 32;
        Returns:
        This builder for chaining.
      • hasTensorSpecValue

        public boolean hasTensorSpecValue()
         Represents a value for tf.TensorSpec.
         
        .org.platanios.tensorflow.proto.TensorSpecProto tensor_spec_value = 33;
        Specified by:
        hasTensorSpecValue in interface Struct.StructuredValueOrBuilder
        Returns:
        Whether the tensorSpecValue field is set.
      • clearTensorSpecValue

        public Struct.StructuredValue.Builder clearTensorSpecValue()
         Represents a value for tf.TensorSpec.
         
        .org.platanios.tensorflow.proto.TensorSpecProto tensor_spec_value = 33;
      • getTensorSpecValueBuilder

        public Struct.TensorSpecProto.Builder getTensorSpecValueBuilder()
         Represents a value for tf.TensorSpec.
         
        .org.platanios.tensorflow.proto.TensorSpecProto tensor_spec_value = 33;
      • hasTypeSpecValue

        public boolean hasTypeSpecValue()
         Represents a value for tf.TypeSpec.
         
        .org.platanios.tensorflow.proto.TypeSpecProto type_spec_value = 34;
        Specified by:
        hasTypeSpecValue in interface Struct.StructuredValueOrBuilder
        Returns:
        Whether the typeSpecValue field is set.
      • clearTypeSpecValue

        public Struct.StructuredValue.Builder clearTypeSpecValue()
         Represents a value for tf.TypeSpec.
         
        .org.platanios.tensorflow.proto.TypeSpecProto type_spec_value = 34;
      • getTypeSpecValueBuilder

        public Struct.TypeSpecProto.Builder getTypeSpecValueBuilder()
         Represents a value for tf.TypeSpec.
         
        .org.platanios.tensorflow.proto.TypeSpecProto type_spec_value = 34;
      • hasBoundedTensorSpecValue

        public boolean hasBoundedTensorSpecValue()
         Represents a value for tf.BoundedTensorSpec.
         
        .org.platanios.tensorflow.proto.BoundedTensorSpecProto bounded_tensor_spec_value = 35;
        Specified by:
        hasBoundedTensorSpecValue in interface Struct.StructuredValueOrBuilder
        Returns:
        Whether the boundedTensorSpecValue field is set.
      • clearBoundedTensorSpecValue

        public Struct.StructuredValue.Builder clearBoundedTensorSpecValue()
         Represents a value for tf.BoundedTensorSpec.
         
        .org.platanios.tensorflow.proto.BoundedTensorSpecProto bounded_tensor_spec_value = 35;
      • getBoundedTensorSpecValueBuilder

        public Struct.BoundedTensorSpecProto.Builder getBoundedTensorSpecValueBuilder()
         Represents a value for tf.BoundedTensorSpec.
         
        .org.platanios.tensorflow.proto.BoundedTensorSpecProto bounded_tensor_spec_value = 35;
      • hasListValue

        public boolean hasListValue()
         Represents a list of `Value`.
         
        .org.platanios.tensorflow.proto.ListValue list_value = 51;
        Specified by:
        hasListValue in interface Struct.StructuredValueOrBuilder
        Returns:
        Whether the listValue field is set.
      • clearListValue

        public Struct.StructuredValue.Builder clearListValue()
         Represents a list of `Value`.
         
        .org.platanios.tensorflow.proto.ListValue list_value = 51;
      • getListValueBuilder

        public Struct.ListValue.Builder getListValueBuilder()
         Represents a list of `Value`.
         
        .org.platanios.tensorflow.proto.ListValue list_value = 51;
      • hasTupleValue

        public boolean hasTupleValue()
         Represents a tuple of `Value`.
         
        .org.platanios.tensorflow.proto.TupleValue tuple_value = 52;
        Specified by:
        hasTupleValue in interface Struct.StructuredValueOrBuilder
        Returns:
        Whether the tupleValue field is set.
      • clearTupleValue

        public Struct.StructuredValue.Builder clearTupleValue()
         Represents a tuple of `Value`.
         
        .org.platanios.tensorflow.proto.TupleValue tuple_value = 52;
      • getTupleValueBuilder

        public Struct.TupleValue.Builder getTupleValueBuilder()
         Represents a tuple of `Value`.
         
        .org.platanios.tensorflow.proto.TupleValue tuple_value = 52;
      • hasDictValue

        public boolean hasDictValue()
         Represents a dict `Value`.
         
        .org.platanios.tensorflow.proto.DictValue dict_value = 53;
        Specified by:
        hasDictValue in interface Struct.StructuredValueOrBuilder
        Returns:
        Whether the dictValue field is set.
      • clearDictValue

        public Struct.StructuredValue.Builder clearDictValue()
         Represents a dict `Value`.
         
        .org.platanios.tensorflow.proto.DictValue dict_value = 53;
      • getDictValueBuilder

        public Struct.DictValue.Builder getDictValueBuilder()
         Represents a dict `Value`.
         
        .org.platanios.tensorflow.proto.DictValue dict_value = 53;
      • hasNamedTupleValue

        public boolean hasNamedTupleValue()
         Represents Python's namedtuple.
         
        .org.platanios.tensorflow.proto.NamedTupleValue named_tuple_value = 54;
        Specified by:
        hasNamedTupleValue in interface Struct.StructuredValueOrBuilder
        Returns:
        Whether the namedTupleValue field is set.
      • clearNamedTupleValue

        public Struct.StructuredValue.Builder clearNamedTupleValue()
         Represents Python's namedtuple.
         
        .org.platanios.tensorflow.proto.NamedTupleValue named_tuple_value = 54;
      • getNamedTupleValueBuilder

        public Struct.NamedTupleValue.Builder getNamedTupleValueBuilder()
         Represents Python's namedtuple.
         
        .org.platanios.tensorflow.proto.NamedTupleValue named_tuple_value = 54;
      • setUnknownFields

        public final Struct.StructuredValue.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<Struct.StructuredValue.Builder>
      • mergeUnknownFields

        public final Struct.StructuredValue.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<Struct.StructuredValue.Builder>