Join us at TensorFlow World, Oct 28-31. Use code TF20 for 20% off select passes. Register now

tff.framework.type_to_tf_tensor_specs

View source

Returns nested structure of tf.TensorSpecs for a given TFF type.

tff.framework.type_to_tf_tensor_specs(type_spec)

The dtypes and shapes of the returned tf.TensorSpecs match those used by tf.data.Datasets to indicate the type and shape of their elements. They can be used, e.g., as arguments in constructing an iterator over a string handle.

Args:

  • type_spec: Type specification, either an instance of computation_types.Type, or something convertible to it. Ther type specification must be composed of only named tuples and tensors. In all named tuples that appear in the type spec, all the elements must be named.

Returns:

A nested structure of tf.TensorSpecs with the dtypes and shapes of tensors defined in type_spec. The layout of the structure returned is the same as the layout of the nested type defined by type_spec. Named tuples are represented as dictionaries.