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
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 |
Modifier and Type | Method and Description |
---|---|
boolean |
equals(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() |
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`.
|
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`.
|
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) |
static Struct.StructuredValue |
parseDelimitedFrom(InputStream input) |
static Struct.StructuredValue |
parseDelimitedFrom(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(ByteBuffer data) |
static Struct.StructuredValue |
parseFrom(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(InputStream input) |
static Struct.StructuredValue |
parseFrom(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, getAllFields, getDescriptorForType, getField, getOneofFieldDescriptor, getRepeatedField, getRepeatedFieldCount, hasField, hasOneof, internalGetMapField, makeExtensionsImmutable, newBuilderForType, parseDelimitedWithIOException, parseDelimitedWithIOException, parseUnknownField, parseUnknownFieldProto3, parseWithIOException, parseWithIOException, parseWithIOException, parseWithIOException, serializeBooleanMapTo, serializeIntegerMapTo, serializeLongMapTo, serializeStringMapTo, writeReplace, writeString, writeStringNoTag
findInitializationErrors, getInitializationErrorString, hashBoolean, hashEnum, hashEnumList, hashFields, hashLong, toString
addAll, addAll, checkByteStringIsUtf8, toByteArray, toByteString, writeDelimitedTo, writeTo
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
public 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 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
public final com.google.protobuf.UnknownFieldSet getUnknownFields()
getUnknownFields
in interface com.google.protobuf.MessageOrBuilder
getUnknownFields
in class com.google.protobuf.GeneratedMessageV3
public static final com.google.protobuf.Descriptors.Descriptor getDescriptor()
protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable()
internalGetFieldAccessorTable
in class com.google.protobuf.GeneratedMessageV3
public Struct.StructuredValue.KindCase getKindCase()
getKindCase
in interface Struct.StructuredValueOrBuilder
public boolean hasNoneValue()
Represents None.
.tensorflow.NoneValue none_value = 1;
hasNoneValue
in interface Struct.StructuredValueOrBuilder
public Struct.NoneValue getNoneValue()
Represents None.
.tensorflow.NoneValue none_value = 1;
getNoneValue
in interface Struct.StructuredValueOrBuilder
public Struct.NoneValueOrBuilder getNoneValueOrBuilder()
Represents None.
.tensorflow.NoneValue none_value = 1;
getNoneValueOrBuilder
in interface Struct.StructuredValueOrBuilder
public double getFloat64Value()
Represents a double-precision floating-point value (a Python `float`).
double float64_value = 11;
getFloat64Value
in interface Struct.StructuredValueOrBuilder
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;
getInt64Value
in interface Struct.StructuredValueOrBuilder
public 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.StructuredValueOrBuilder
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;
getStringValueBytes
in interface Struct.StructuredValueOrBuilder
public boolean getBoolValue()
Represents a boolean value.
bool bool_value = 14;
getBoolValue
in interface Struct.StructuredValueOrBuilder
public boolean hasTensorShapeValue()
Represents a TensorShape.
.tensorflow.TensorShapeProto tensor_shape_value = 31;
hasTensorShapeValue
in interface Struct.StructuredValueOrBuilder
public TensorShapeProto getTensorShapeValue()
Represents a TensorShape.
.tensorflow.TensorShapeProto tensor_shape_value = 31;
getTensorShapeValue
in interface Struct.StructuredValueOrBuilder
public TensorShapeProtoOrBuilder getTensorShapeValueOrBuilder()
Represents a TensorShape.
.tensorflow.TensorShapeProto tensor_shape_value = 31;
getTensorShapeValueOrBuilder
in interface Struct.StructuredValueOrBuilder
public int getTensorDtypeValueValue()
Represents an enum value for dtype.
.tensorflow.DataType tensor_dtype_value = 32;
getTensorDtypeValueValue
in interface Struct.StructuredValueOrBuilder
public DataType getTensorDtypeValue()
Represents an enum value for dtype.
.tensorflow.DataType tensor_dtype_value = 32;
getTensorDtypeValue
in interface Struct.StructuredValueOrBuilder
public boolean hasTensorSpecValue()
Represents a value for tf.TensorSpec.
.tensorflow.TensorSpecProto tensor_spec_value = 33;
hasTensorSpecValue
in interface Struct.StructuredValueOrBuilder
public Struct.TensorSpecProto getTensorSpecValue()
Represents a value for tf.TensorSpec.
.tensorflow.TensorSpecProto tensor_spec_value = 33;
getTensorSpecValue
in interface Struct.StructuredValueOrBuilder
public Struct.TensorSpecProtoOrBuilder getTensorSpecValueOrBuilder()
Represents a value for tf.TensorSpec.
.tensorflow.TensorSpecProto tensor_spec_value = 33;
getTensorSpecValueOrBuilder
in interface Struct.StructuredValueOrBuilder
public boolean hasListValue()
Represents a list of `Value`.
.tensorflow.ListValue list_value = 51;
hasListValue
in interface Struct.StructuredValueOrBuilder
public Struct.ListValue getListValue()
Represents a list of `Value`.
.tensorflow.ListValue list_value = 51;
getListValue
in interface Struct.StructuredValueOrBuilder
public Struct.ListValueOrBuilder getListValueOrBuilder()
Represents a list of `Value`.
.tensorflow.ListValue list_value = 51;
getListValueOrBuilder
in interface Struct.StructuredValueOrBuilder
public boolean hasTupleValue()
Represents a tuple of `Value`.
.tensorflow.TupleValue tuple_value = 52;
hasTupleValue
in interface Struct.StructuredValueOrBuilder
public Struct.TupleValue getTupleValue()
Represents a tuple of `Value`.
.tensorflow.TupleValue tuple_value = 52;
getTupleValue
in interface Struct.StructuredValueOrBuilder
public Struct.TupleValueOrBuilder getTupleValueOrBuilder()
Represents a tuple of `Value`.
.tensorflow.TupleValue tuple_value = 52;
getTupleValueOrBuilder
in interface Struct.StructuredValueOrBuilder
public boolean hasDictValue()
Represents a dict `Value`.
.tensorflow.DictValue dict_value = 53;
hasDictValue
in interface Struct.StructuredValueOrBuilder
public Struct.DictValue getDictValue()
Represents a dict `Value`.
.tensorflow.DictValue dict_value = 53;
getDictValue
in interface Struct.StructuredValueOrBuilder
public Struct.DictValueOrBuilder getDictValueOrBuilder()
Represents a dict `Value`.
.tensorflow.DictValue dict_value = 53;
getDictValueOrBuilder
in interface Struct.StructuredValueOrBuilder
public boolean hasNamedTupleValue()
Represents Python's namedtuple.
.tensorflow.NamedTupleValue named_tuple_value = 54;
hasNamedTupleValue
in interface Struct.StructuredValueOrBuilder
public Struct.NamedTupleValue getNamedTupleValue()
Represents Python's namedtuple.
.tensorflow.NamedTupleValue named_tuple_value = 54;
getNamedTupleValue
in interface Struct.StructuredValueOrBuilder
public Struct.NamedTupleValueOrBuilder getNamedTupleValueOrBuilder()
Represents Python's namedtuple.
.tensorflow.NamedTupleValue named_tuple_value = 54;
getNamedTupleValueOrBuilder
in interface Struct.StructuredValueOrBuilder
public final boolean isInitialized()
isInitialized
in interface com.google.protobuf.MessageLiteOrBuilder
isInitialized
in class com.google.protobuf.GeneratedMessageV3
public void writeTo(com.google.protobuf.CodedOutputStream output) throws IOException
writeTo
in interface com.google.protobuf.MessageLite
writeTo
in class com.google.protobuf.GeneratedMessageV3
IOException
public int getSerializedSize()
getSerializedSize
in interface com.google.protobuf.MessageLite
getSerializedSize
in class com.google.protobuf.GeneratedMessageV3
public boolean equals(Object obj)
equals
in interface com.google.protobuf.Message
equals
in class com.google.protobuf.AbstractMessage
public int hashCode()
hashCode
in interface com.google.protobuf.Message
hashCode
in class com.google.protobuf.AbstractMessage
public static Struct.StructuredValue parseFrom(ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException
com.google.protobuf.InvalidProtocolBufferException
public static Struct.StructuredValue parseFrom(ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException
com.google.protobuf.InvalidProtocolBufferException
public static Struct.StructuredValue parseFrom(com.google.protobuf.ByteString data) throws com.google.protobuf.InvalidProtocolBufferException
com.google.protobuf.InvalidProtocolBufferException
public static Struct.StructuredValue parseFrom(com.google.protobuf.ByteString data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException
com.google.protobuf.InvalidProtocolBufferException
public static Struct.StructuredValue parseFrom(byte[] data) throws com.google.protobuf.InvalidProtocolBufferException
com.google.protobuf.InvalidProtocolBufferException
public static Struct.StructuredValue parseFrom(byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException
com.google.protobuf.InvalidProtocolBufferException
public static Struct.StructuredValue parseFrom(InputStream input) throws IOException
IOException
public static Struct.StructuredValue parseFrom(InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws IOException
IOException
public static Struct.StructuredValue parseDelimitedFrom(InputStream input) throws IOException
IOException
public static Struct.StructuredValue parseDelimitedFrom(InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws IOException
IOException
public static Struct.StructuredValue parseFrom(com.google.protobuf.CodedInputStream input) throws IOException
IOException
public static Struct.StructuredValue parseFrom(com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws IOException
IOException
public Struct.StructuredValue.Builder newBuilderForType()
newBuilderForType
in interface com.google.protobuf.Message
newBuilderForType
in interface com.google.protobuf.MessageLite
public 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.Message
toBuilder
in interface com.google.protobuf.MessageLite
protected Struct.StructuredValue.Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent)
newBuilderForType
in class com.google.protobuf.GeneratedMessageV3
public 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.Message
getParserForType
in interface com.google.protobuf.MessageLite
getParserForType
in class com.google.protobuf.GeneratedMessageV3
public Struct.StructuredValue getDefaultInstanceForType()
getDefaultInstanceForType
in interface com.google.protobuf.MessageLiteOrBuilder
getDefaultInstanceForType
in interface com.google.protobuf.MessageOrBuilder
Copyright © 2015–2019. All rights reserved.