Watch talks from the 2019 TensorFlow Dev Summit Watch now

tff.to_type

tff.to_type(spec)

Defined in core/api/computation_types.py.

Converts the argument into an instance of tff.Type.

Examples of arguments convertible to tensor types:

tf.int32
(tf.int32, [10])
(tf.int32, [None])

Examples of arguments convertible to flat named tuple types:

[tf.int32, tf.bool](tf.int32, tf.bool)
[('a', tf.int32), ('b', tf.bool)]('a', tf.int32)
collections.OrderedDict([('a', tf.int32), ('b', tf.bool)])

Examples of arguments convertible to nested named tuple types:

(tf.int32, (tf.float32, tf.bool))
(tf.int32, (('x', tf.float32), tf.bool))
((tf.int32, [1]), (('x', (tf.float32, [2])), (tf.bool, [3])))

Args:

Returns:

An instance of tff.Type corresponding to the given spec.