tf.compat.v1.lite.OpHint

View source on GitHub

A class that helps build tflite function invocations.

tf.compat.v1.lite.OpHint(
    function_name, level=1, children_inputs_mappings=None, **kwargs
)

It allows you to take a bunch of TensorFlow ops and annotate the construction such that toco knows how to convert it to tflite. This embeds a pseudo function in a TensorFlow graph. This allows embedding high-level API usage information in a lower level TensorFlow implementation so that an alternative implementation can be substituted later.

Essentially, any "input" into this pseudo op is fed into an identity, and attributes are added to that input before being used by the constituent ops that make up the pseudo op. A similar process is done to any output that is to be exported from the current op.

Args:

Child Classes

class OpHintArgumentTracker

Methods

add_input

View source

add_input(
    *args, **kwargs
)

Add a wrapped input argument to the hint.

Args:

Returns:

The wrapped input tensor.

add_inputs

View source

add_inputs(
    *args, **kwargs
)

Add a sequence of inputs to the function invocation.

Args:

Returns:

Wrapped inputs (identity standins that have additional metadata). These are also are also tf.Tensor's.

add_output

View source

add_output(
    *args, **kwargs
)

Add a wrapped output argument to the hint.

Args:

Returns:

The wrapped output tensor.

add_outputs

View source

add_outputs(
    *args, **kwargs
)

Add a sequence of outputs to the function invocation.

Args:

Returns:

Wrapped outputs (identity standins that have additional metadata). These are also tf.Tensor's.

Class Variables