Class Struct.StructuredValue

  • All Implemented Interfaces:
    com.google.protobuf.Message, com.google.protobuf.MessageLite, com.google.protobuf.MessageLiteOrBuilder, com.google.protobuf.MessageOrBuilder, java.io.Serializable, Struct.StructuredValueOrBuilder
    Enclosing class:
    Struct

    public static final class Struct.StructuredValue
    extends com.google.protobuf.GeneratedMessageV3
    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
    See Also:
    Serialized Form
    • Field Detail

      • NONE_VALUE_FIELD_NUMBER

        public static final int NONE_VALUE_FIELD_NUMBER
        See Also:
        Constant Field Values
      • FLOAT64_VALUE_FIELD_NUMBER

        public static final int FLOAT64_VALUE_FIELD_NUMBER
        See Also:
        Constant Field Values
      • INT64_VALUE_FIELD_NUMBER

        public static final int INT64_VALUE_FIELD_NUMBER
        See Also:
        Constant Field Values
      • STRING_VALUE_FIELD_NUMBER

        public static final int STRING_VALUE_FIELD_NUMBER
        See Also:
        Constant Field Values
      • BOOL_VALUE_FIELD_NUMBER

        public static final int BOOL_VALUE_FIELD_NUMBER
        See Also:
        Constant Field Values
      • TENSOR_SHAPE_VALUE_FIELD_NUMBER

        public static final int TENSOR_SHAPE_VALUE_FIELD_NUMBER
        See Also:
        Constant Field Values
      • TENSOR_DTYPE_VALUE_FIELD_NUMBER

        public static final int TENSOR_DTYPE_VALUE_FIELD_NUMBER
        See Also:
        Constant Field Values
      • TENSOR_SPEC_VALUE_FIELD_NUMBER

        public static final int TENSOR_SPEC_VALUE_FIELD_NUMBER
        See Also:
        Constant Field Values
      • TYPE_SPEC_VALUE_FIELD_NUMBER

        public static final int TYPE_SPEC_VALUE_FIELD_NUMBER
        See Also:
        Constant Field Values
      • BOUNDED_TENSOR_SPEC_VALUE_FIELD_NUMBER

        public static final int BOUNDED_TENSOR_SPEC_VALUE_FIELD_NUMBER
        See Also:
        Constant Field Values
      • LIST_VALUE_FIELD_NUMBER

        public static final int LIST_VALUE_FIELD_NUMBER
        See Also:
        Constant Field Values
      • TUPLE_VALUE_FIELD_NUMBER

        public static final int TUPLE_VALUE_FIELD_NUMBER
        See Also:
        Constant Field Values
      • DICT_VALUE_FIELD_NUMBER

        public static final int DICT_VALUE_FIELD_NUMBER
        See Also:
        Constant Field Values
      • NAMED_TUPLE_VALUE_FIELD_NUMBER

        public static final int NAMED_TUPLE_VALUE_FIELD_NUMBER
        See Also:
        Constant Field Values
    • Method Detail

      • newInstance

        protected java.lang.Object newInstance​(com.google.protobuf.GeneratedMessageV3.UnusedPrivateParameter unused)
        Overrides:
        newInstance in class com.google.protobuf.GeneratedMessageV3
      • getUnknownFields

        public final com.google.protobuf.UnknownFieldSet getUnknownFields()
        Specified by:
        getUnknownFields in interface com.google.protobuf.MessageOrBuilder
        Overrides:
        getUnknownFields 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
      • 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.
      • 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.
      • 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.
      • 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.
      • 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.
      • 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.
      • 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.
      • 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.
      • 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.
      • 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.
      • 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.
      • 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.
      • 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.
      • 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 java.io.IOException
        Specified by:
        writeTo in interface com.google.protobuf.MessageLite
        Overrides:
        writeTo in class com.google.protobuf.GeneratedMessageV3
        Throws:
        java.io.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​(java.lang.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 Struct.StructuredValue parseFrom​(java.nio.ByteBuffer data)
                                                throws com.google.protobuf.InvalidProtocolBufferException
        Throws:
        com.google.protobuf.InvalidProtocolBufferException
      • parseFrom

        public static Struct.StructuredValue parseFrom​(java.nio.ByteBuffer data,
                                                       com.google.protobuf.ExtensionRegistryLite extensionRegistry)
                                                throws com.google.protobuf.InvalidProtocolBufferException
        Throws:
        com.google.protobuf.InvalidProtocolBufferException
      • parseFrom

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

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

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

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

        public static Struct.StructuredValue parseFrom​(java.io.InputStream input)
                                                throws java.io.IOException
        Throws:
        java.io.IOException
      • parseFrom

        public static Struct.StructuredValue parseFrom​(java.io.InputStream input,
                                                       com.google.protobuf.ExtensionRegistryLite extensionRegistry)
                                                throws java.io.IOException
        Throws:
        java.io.IOException
      • parseDelimitedFrom

        public static Struct.StructuredValue parseDelimitedFrom​(java.io.InputStream input)
                                                         throws java.io.IOException
        Throws:
        java.io.IOException
      • parseDelimitedFrom

        public static Struct.StructuredValue parseDelimitedFrom​(java.io.InputStream input,
                                                                com.google.protobuf.ExtensionRegistryLite extensionRegistry)
                                                         throws java.io.IOException
        Throws:
        java.io.IOException
      • parseFrom

        public static Struct.StructuredValue parseFrom​(com.google.protobuf.CodedInputStream input)
                                                throws java.io.IOException
        Throws:
        java.io.IOException
      • parseFrom

        public static Struct.StructuredValue parseFrom​(com.google.protobuf.CodedInputStream input,
                                                       com.google.protobuf.ExtensionRegistryLite extensionRegistry)
                                                throws java.io.IOException
        Throws:
        java.io.IOException
      • newBuilderForType

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

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

        protected Struct.StructuredValue.Builder newBuilderForType​(com.google.protobuf.GeneratedMessageV3.BuilderParent parent)
        Specified by:
        newBuilderForType in class com.google.protobuf.GeneratedMessageV3
      • getParserForType

        public com.google.protobuf.Parser<Struct.StructuredValue> 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 Struct.StructuredValue getDefaultInstanceForType()
        Specified by:
        getDefaultInstanceForType in interface com.google.protobuf.MessageLiteOrBuilder
        Specified by:
        getDefaultInstanceForType in interface com.google.protobuf.MessageOrBuilder