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 tensorflow.StructuredValue| Modifier and Type | Class and Description |
|---|---|
static class |
Struct.StructuredValue.Builder
`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.
|
static class |
Struct.StructuredValue.KindCase |
com.google.protobuf.GeneratedMessageV3.BuilderParent, com.google.protobuf.GeneratedMessageV3.ExtendableBuilder<MessageType extends com.google.protobuf.GeneratedMessageV3.ExtendableMessage,BuilderType extends com.google.protobuf.GeneratedMessageV3.ExtendableBuilder<MessageType,BuilderType>>, com.google.protobuf.GeneratedMessageV3.ExtendableMessage<MessageType extends com.google.protobuf.GeneratedMessageV3.ExtendableMessage>, com.google.protobuf.GeneratedMessageV3.ExtendableMessageOrBuilder<MessageType extends com.google.protobuf.GeneratedMessageV3.ExtendableMessage>, com.google.protobuf.GeneratedMessageV3.FieldAccessorTable, com.google.protobuf.GeneratedMessageV3.UnusedPrivateParameter| Modifier and Type | Field and Description |
|---|---|
static int |
BOOL_VALUE_FIELD_NUMBER |
static int |
DICT_VALUE_FIELD_NUMBER |
static int |
FLOAT64_VALUE_FIELD_NUMBER |
static int |
INT64_VALUE_FIELD_NUMBER |
static int |
LIST_VALUE_FIELD_NUMBER |
static int |
NAMED_TUPLE_VALUE_FIELD_NUMBER |
static int |
NONE_VALUE_FIELD_NUMBER |
static int |
STRING_VALUE_FIELD_NUMBER |
static int |
TENSOR_DTYPE_VALUE_FIELD_NUMBER |
static int |
TENSOR_SHAPE_VALUE_FIELD_NUMBER |
static int |
TENSOR_SPEC_VALUE_FIELD_NUMBER |
static int |
TUPLE_VALUE_FIELD_NUMBER |
static int |
TYPE_SPEC_VALUE_FIELD_NUMBER |
| Modifier and Type | Method and Description |
|---|---|
boolean |
equals(java.lang.Object obj) |
boolean |
getBoolValue()
Represents a boolean value.
|
static Struct.StructuredValue |
getDefaultInstance() |
Struct.StructuredValue |
getDefaultInstanceForType() |
static com.google.protobuf.Descriptors.Descriptor |
getDescriptor() |
Struct.DictValue |
getDictValue()
Represents a dict `Value`.
|
Struct.DictValueOrBuilder |
getDictValueOrBuilder()
Represents a dict `Value`.
|
double |
getFloat64Value()
Represents a double-precision floating-point value (a Python `float`).
|
long |
getInt64Value()
Represents a signed integer value, limited to 64 bits.
|
Struct.StructuredValue.KindCase |
getKindCase() |
Struct.ListValue |
getListValue()
Represents a list of `Value`.
|
Struct.ListValueOrBuilder |
getListValueOrBuilder()
Represents a list of `Value`.
|
Struct.NamedTupleValue |
getNamedTupleValue()
Represents Python's namedtuple.
|
Struct.NamedTupleValueOrBuilder |
getNamedTupleValueOrBuilder()
Represents Python's namedtuple.
|
Struct.NoneValue |
getNoneValue()
Represents None.
|
Struct.NoneValueOrBuilder |
getNoneValueOrBuilder()
Represents None.
|
com.google.protobuf.Parser<Struct.StructuredValue> |
getParserForType() |
int |
getSerializedSize() |
java.lang.String |
getStringValue()
Represents a string of Unicode characters stored in a Python `str`.
|
com.google.protobuf.ByteString |
getStringValueBytes()
Represents a string of Unicode characters stored in a Python `str`.
|
DataType |
getTensorDtypeValue()
Represents an enum value for dtype.
|
int |
getTensorDtypeValueValue()
Represents an enum value for dtype.
|
TensorShapeProto |
getTensorShapeValue()
Represents a TensorShape.
|
TensorShapeProtoOrBuilder |
getTensorShapeValueOrBuilder()
Represents a TensorShape.
|
Struct.TensorSpecProto |
getTensorSpecValue()
Represents a value for tf.TensorSpec.
|
Struct.TensorSpecProtoOrBuilder |
getTensorSpecValueOrBuilder()
Represents a value for tf.TensorSpec.
|
Struct.TupleValue |
getTupleValue()
Represents a tuple of `Value`.
|
Struct.TupleValueOrBuilder |
getTupleValueOrBuilder()
Represents a tuple of `Value`.
|
Struct.TypeSpecProto |
getTypeSpecValue()
Represents a value for tf.TypeSpec.
|
Struct.TypeSpecProtoOrBuilder |
getTypeSpecValueOrBuilder()
Represents a value for tf.TypeSpec.
|
com.google.protobuf.UnknownFieldSet |
getUnknownFields() |
boolean |
hasDictValue()
Represents a dict `Value`.
|
int |
hashCode() |
boolean |
hasListValue()
Represents a list of `Value`.
|
boolean |
hasNamedTupleValue()
Represents Python's namedtuple.
|
boolean |
hasNoneValue()
Represents None.
|
boolean |
hasTensorShapeValue()
Represents a TensorShape.
|
boolean |
hasTensorSpecValue()
Represents a value for tf.TensorSpec.
|
boolean |
hasTupleValue()
Represents a tuple of `Value`.
|
boolean |
hasTypeSpecValue()
Represents a value for tf.TypeSpec.
|
protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable |
internalGetFieldAccessorTable() |
boolean |
isInitialized() |
static Struct.StructuredValue.Builder |
newBuilder() |
static Struct.StructuredValue.Builder |
newBuilder(Struct.StructuredValue prototype) |
Struct.StructuredValue.Builder |
newBuilderForType() |
protected Struct.StructuredValue.Builder |
newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) |
protected java.lang.Object |
newInstance(com.google.protobuf.GeneratedMessageV3.UnusedPrivateParameter unused) |
static Struct.StructuredValue |
parseDelimitedFrom(java.io.InputStream input) |
static Struct.StructuredValue |
parseDelimitedFrom(java.io.InputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry) |
static Struct.StructuredValue |
parseFrom(byte[] data) |
static Struct.StructuredValue |
parseFrom(byte[] data,
com.google.protobuf.ExtensionRegistryLite extensionRegistry) |
static Struct.StructuredValue |
parseFrom(java.nio.ByteBuffer data) |
static Struct.StructuredValue |
parseFrom(java.nio.ByteBuffer data,
com.google.protobuf.ExtensionRegistryLite extensionRegistry) |
static Struct.StructuredValue |
parseFrom(com.google.protobuf.ByteString data) |
static Struct.StructuredValue |
parseFrom(com.google.protobuf.ByteString data,
com.google.protobuf.ExtensionRegistryLite extensionRegistry) |
static Struct.StructuredValue |
parseFrom(com.google.protobuf.CodedInputStream input) |
static Struct.StructuredValue |
parseFrom(com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry) |
static Struct.StructuredValue |
parseFrom(java.io.InputStream input) |
static Struct.StructuredValue |
parseFrom(java.io.InputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry) |
static com.google.protobuf.Parser<Struct.StructuredValue> |
parser() |
Struct.StructuredValue.Builder |
toBuilder() |
void |
writeTo(com.google.protobuf.CodedOutputStream output) |
canUseUnsafe, computeStringSize, computeStringSizeNoTag, emptyBooleanList, emptyDoubleList, emptyFloatList, emptyIntList, emptyLongList, getAllFields, getDescriptorForType, getField, getOneofFieldDescriptor, getRepeatedField, getRepeatedFieldCount, hasField, hasOneof, internalGetMapField, 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, writeStringNoTagfindInitializationErrors, getInitializationErrorString, hashBoolean, hashEnum, hashEnumList, hashFields, hashLong, toStringaddAll, addAll, checkByteStringIsUtf8, toByteArray, toByteString, writeDelimitedTo, writeToclone, finalize, getClass, notify, notifyAll, wait, wait, waitpublic static final int NONE_VALUE_FIELD_NUMBER
public static final int FLOAT64_VALUE_FIELD_NUMBER
public static final int INT64_VALUE_FIELD_NUMBER
public static final int STRING_VALUE_FIELD_NUMBER
public static final int BOOL_VALUE_FIELD_NUMBER
public static final int TENSOR_SHAPE_VALUE_FIELD_NUMBER
public static final int TENSOR_DTYPE_VALUE_FIELD_NUMBER
public static final int TENSOR_SPEC_VALUE_FIELD_NUMBER
public static final int TYPE_SPEC_VALUE_FIELD_NUMBER
public static final int LIST_VALUE_FIELD_NUMBER
public static final int TUPLE_VALUE_FIELD_NUMBER
public static final int DICT_VALUE_FIELD_NUMBER
public static final int NAMED_TUPLE_VALUE_FIELD_NUMBER
protected java.lang.Object newInstance(com.google.protobuf.GeneratedMessageV3.UnusedPrivateParameter unused)
newInstance in class com.google.protobuf.GeneratedMessageV3public final com.google.protobuf.UnknownFieldSet getUnknownFields()
getUnknownFields in interface com.google.protobuf.MessageOrBuildergetUnknownFields in class com.google.protobuf.GeneratedMessageV3public static final com.google.protobuf.Descriptors.Descriptor getDescriptor()
protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable()
internalGetFieldAccessorTable in class com.google.protobuf.GeneratedMessageV3public Struct.StructuredValue.KindCase getKindCase()
getKindCase in interface Struct.StructuredValueOrBuilderpublic boolean hasNoneValue()
Represents None.
.tensorflow.NoneValue none_value = 1;hasNoneValue in interface Struct.StructuredValueOrBuilderpublic Struct.NoneValue getNoneValue()
Represents None.
.tensorflow.NoneValue none_value = 1;getNoneValue in interface Struct.StructuredValueOrBuilderpublic Struct.NoneValueOrBuilder getNoneValueOrBuilder()
Represents None.
.tensorflow.NoneValue none_value = 1;getNoneValueOrBuilder in interface Struct.StructuredValueOrBuilderpublic double getFloat64Value()
Represents a double-precision floating-point value (a Python `float`).
double float64_value = 11;getFloat64Value in interface Struct.StructuredValueOrBuilderpublic 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;getInt64Value in interface Struct.StructuredValueOrBuilderpublic 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;getStringValue in interface Struct.StructuredValueOrBuilderpublic 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;getStringValueBytes in interface Struct.StructuredValueOrBuilderpublic boolean getBoolValue()
Represents a boolean value.
bool bool_value = 14;getBoolValue in interface Struct.StructuredValueOrBuilderpublic boolean hasTensorShapeValue()
Represents a TensorShape.
.tensorflow.TensorShapeProto tensor_shape_value = 31;hasTensorShapeValue in interface Struct.StructuredValueOrBuilderpublic TensorShapeProto getTensorShapeValue()
Represents a TensorShape.
.tensorflow.TensorShapeProto tensor_shape_value = 31;getTensorShapeValue in interface Struct.StructuredValueOrBuilderpublic TensorShapeProtoOrBuilder getTensorShapeValueOrBuilder()
Represents a TensorShape.
.tensorflow.TensorShapeProto tensor_shape_value = 31;getTensorShapeValueOrBuilder in interface Struct.StructuredValueOrBuilderpublic int getTensorDtypeValueValue()
Represents an enum value for dtype.
.tensorflow.DataType tensor_dtype_value = 32;getTensorDtypeValueValue in interface Struct.StructuredValueOrBuilderpublic DataType getTensorDtypeValue()
Represents an enum value for dtype.
.tensorflow.DataType tensor_dtype_value = 32;getTensorDtypeValue in interface Struct.StructuredValueOrBuilderpublic boolean hasTensorSpecValue()
Represents a value for tf.TensorSpec.
.tensorflow.TensorSpecProto tensor_spec_value = 33;hasTensorSpecValue in interface Struct.StructuredValueOrBuilderpublic Struct.TensorSpecProto getTensorSpecValue()
Represents a value for tf.TensorSpec.
.tensorflow.TensorSpecProto tensor_spec_value = 33;getTensorSpecValue in interface Struct.StructuredValueOrBuilderpublic Struct.TensorSpecProtoOrBuilder getTensorSpecValueOrBuilder()
Represents a value for tf.TensorSpec.
.tensorflow.TensorSpecProto tensor_spec_value = 33;getTensorSpecValueOrBuilder in interface Struct.StructuredValueOrBuilderpublic boolean hasTypeSpecValue()
Represents a value for tf.TypeSpec.
.tensorflow.TypeSpecProto type_spec_value = 34;hasTypeSpecValue in interface Struct.StructuredValueOrBuilderpublic Struct.TypeSpecProto getTypeSpecValue()
Represents a value for tf.TypeSpec.
.tensorflow.TypeSpecProto type_spec_value = 34;getTypeSpecValue in interface Struct.StructuredValueOrBuilderpublic Struct.TypeSpecProtoOrBuilder getTypeSpecValueOrBuilder()
Represents a value for tf.TypeSpec.
.tensorflow.TypeSpecProto type_spec_value = 34;getTypeSpecValueOrBuilder in interface Struct.StructuredValueOrBuilderpublic boolean hasListValue()
Represents a list of `Value`.
.tensorflow.ListValue list_value = 51;hasListValue in interface Struct.StructuredValueOrBuilderpublic Struct.ListValue getListValue()
Represents a list of `Value`.
.tensorflow.ListValue list_value = 51;getListValue in interface Struct.StructuredValueOrBuilderpublic Struct.ListValueOrBuilder getListValueOrBuilder()
Represents a list of `Value`.
.tensorflow.ListValue list_value = 51;getListValueOrBuilder in interface Struct.StructuredValueOrBuilderpublic boolean hasTupleValue()
Represents a tuple of `Value`.
.tensorflow.TupleValue tuple_value = 52;hasTupleValue in interface Struct.StructuredValueOrBuilderpublic Struct.TupleValue getTupleValue()
Represents a tuple of `Value`.
.tensorflow.TupleValue tuple_value = 52;getTupleValue in interface Struct.StructuredValueOrBuilderpublic Struct.TupleValueOrBuilder getTupleValueOrBuilder()
Represents a tuple of `Value`.
.tensorflow.TupleValue tuple_value = 52;getTupleValueOrBuilder in interface Struct.StructuredValueOrBuilderpublic boolean hasDictValue()
Represents a dict `Value`.
.tensorflow.DictValue dict_value = 53;hasDictValue in interface Struct.StructuredValueOrBuilderpublic Struct.DictValue getDictValue()
Represents a dict `Value`.
.tensorflow.DictValue dict_value = 53;getDictValue in interface Struct.StructuredValueOrBuilderpublic Struct.DictValueOrBuilder getDictValueOrBuilder()
Represents a dict `Value`.
.tensorflow.DictValue dict_value = 53;getDictValueOrBuilder in interface Struct.StructuredValueOrBuilderpublic boolean hasNamedTupleValue()
Represents Python's namedtuple.
.tensorflow.NamedTupleValue named_tuple_value = 54;hasNamedTupleValue in interface Struct.StructuredValueOrBuilderpublic Struct.NamedTupleValue getNamedTupleValue()
Represents Python's namedtuple.
.tensorflow.NamedTupleValue named_tuple_value = 54;getNamedTupleValue in interface Struct.StructuredValueOrBuilderpublic Struct.NamedTupleValueOrBuilder getNamedTupleValueOrBuilder()
Represents Python's namedtuple.
.tensorflow.NamedTupleValue named_tuple_value = 54;getNamedTupleValueOrBuilder in interface Struct.StructuredValueOrBuilderpublic final boolean isInitialized()
isInitialized in interface com.google.protobuf.MessageLiteOrBuilderisInitialized in class com.google.protobuf.GeneratedMessageV3public void writeTo(com.google.protobuf.CodedOutputStream output)
throws java.io.IOException
writeTo in interface com.google.protobuf.MessageLitewriteTo in class com.google.protobuf.GeneratedMessageV3java.io.IOExceptionpublic int getSerializedSize()
getSerializedSize in interface com.google.protobuf.MessageLitegetSerializedSize in class com.google.protobuf.GeneratedMessageV3public boolean equals(java.lang.Object obj)
equals in interface com.google.protobuf.Messageequals in class com.google.protobuf.AbstractMessagepublic int hashCode()
hashCode in interface com.google.protobuf.MessagehashCode in class com.google.protobuf.AbstractMessagepublic static Struct.StructuredValue parseFrom(java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException
com.google.protobuf.InvalidProtocolBufferExceptionpublic static Struct.StructuredValue parseFrom(java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException
com.google.protobuf.InvalidProtocolBufferExceptionpublic static Struct.StructuredValue parseFrom(com.google.protobuf.ByteString data) throws com.google.protobuf.InvalidProtocolBufferException
com.google.protobuf.InvalidProtocolBufferExceptionpublic static Struct.StructuredValue parseFrom(com.google.protobuf.ByteString data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException
com.google.protobuf.InvalidProtocolBufferExceptionpublic static Struct.StructuredValue parseFrom(byte[] data) throws com.google.protobuf.InvalidProtocolBufferException
com.google.protobuf.InvalidProtocolBufferExceptionpublic static Struct.StructuredValue parseFrom(byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException
com.google.protobuf.InvalidProtocolBufferExceptionpublic static Struct.StructuredValue parseFrom(java.io.InputStream input) throws java.io.IOException
java.io.IOExceptionpublic static Struct.StructuredValue parseFrom(java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException
java.io.IOExceptionpublic static Struct.StructuredValue parseDelimitedFrom(java.io.InputStream input) throws java.io.IOException
java.io.IOExceptionpublic static Struct.StructuredValue parseDelimitedFrom(java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException
java.io.IOExceptionpublic static Struct.StructuredValue parseFrom(com.google.protobuf.CodedInputStream input) throws java.io.IOException
java.io.IOExceptionpublic static Struct.StructuredValue parseFrom(com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException
java.io.IOExceptionpublic Struct.StructuredValue.Builder newBuilderForType()
newBuilderForType in interface com.google.protobuf.MessagenewBuilderForType in interface com.google.protobuf.MessageLitepublic static Struct.StructuredValue.Builder newBuilder()
public static Struct.StructuredValue.Builder newBuilder(Struct.StructuredValue prototype)
public Struct.StructuredValue.Builder toBuilder()
toBuilder in interface com.google.protobuf.MessagetoBuilder in interface com.google.protobuf.MessageLiteprotected Struct.StructuredValue.Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent)
newBuilderForType in class com.google.protobuf.GeneratedMessageV3public static Struct.StructuredValue getDefaultInstance()
public static com.google.protobuf.Parser<Struct.StructuredValue> parser()
public com.google.protobuf.Parser<Struct.StructuredValue> getParserForType()
getParserForType in interface com.google.protobuf.MessagegetParserForType in interface com.google.protobuf.MessageLitegetParserForType in class com.google.protobuf.GeneratedMessageV3public Struct.StructuredValue getDefaultInstanceForType()
getDefaultInstanceForType in interface com.google.protobuf.MessageLiteOrBuildergetDefaultInstanceForType in interface com.google.protobuf.MessageOrBuilder