pub struct StructuredValue {
pub kind: Option<Kind>,
}Expand description
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.
Fields§
§kind: Option<Kind>The kind of value.
Trait Implementations§
Source§impl Clone for StructuredValue
impl Clone for StructuredValue
Source§fn clone(&self) -> StructuredValue
fn clone(&self) -> StructuredValue
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for StructuredValue
impl Debug for StructuredValue
Source§impl Default for StructuredValue
impl Default for StructuredValue
Source§impl Message for StructuredValue
impl Message for StructuredValue
Source§fn encoded_len(&self) -> usize
fn encoded_len(&self) -> usize
Source§fn encode<B>(&self, buf: &mut B) -> Result<(), EncodeError>
fn encode<B>(&self, buf: &mut B) -> Result<(), EncodeError>
Source§fn encode_length_delimited<B>(&self, buf: &mut B) -> Result<(), EncodeError>
fn encode_length_delimited<B>(&self, buf: &mut B) -> Result<(), EncodeError>
Source§fn decode<B>(buf: B) -> Result<Self, DecodeError>
fn decode<B>(buf: B) -> Result<Self, DecodeError>
Source§fn decode_length_delimited<B>(buf: B) -> Result<Self, DecodeError>
fn decode_length_delimited<B>(buf: B) -> Result<Self, DecodeError>
Source§fn merge<B>(&mut self, buf: B) -> Result<(), DecodeError>
fn merge<B>(&mut self, buf: B) -> Result<(), DecodeError>
self. Read moreSource§fn merge_length_delimited<B>(&mut self, buf: B) -> Result<(), DecodeError>
fn merge_length_delimited<B>(&mut self, buf: B) -> Result<(), DecodeError>
self.