tf.contrib.lite.OpHint.OpHintArgumentTracker

Class OpHintArgumentTracker

Defined in tensorflow/contrib/lite/python/op_hint.py.

Conceptually tracks indices of arguments of "OpHint functions".

The inputs and arguments of these functions both use an instance of the class so they can have independent numbering.

__init__

__init__(
    function_name,
    unique_function_id,
    node_name_prefix,
    attr_name
)

Initialize ophint argument.

Args:

  • function_name: Name of the function that this tracks arguments for.
  • unique_function_id: UUID of function that this tracks arguments for.
  • node_name_prefix: How identities that are created are named.
  • attr_name: Name of attribute to use to store the index for this hint. i.e. FUNCTION_INPUT_INDEX or FUNCTION_OUTPUT_INDEX

Methods

add

add(
    arg,
    tag=None,
    name=None,
    aggregate=None,
    index_override=None
)

Return a wrapped tensor of an input tensor as an argument.

Args:

  • arg: A TensorFlow tensor that should be considered an argument.
  • tag: String tag to identify arguments that should be packed.
  • name: Name of argument. This is included in the Identity hint op names.
  • aggregate: Strategy to aggregate. Acceptable values are OpHint.AGGREGATE_FIRST, OpHint.AGGREGATE_LAST, and OpHint.AGGREGATE_STACK. Note, aggregate is only valid if tag is specified.
  • index_override: Specify what input/output index should this be in the final stub. i.e. add(arg0, index=1); add(arg1, index=0) wil make the final stub be as stub_func(inputs[arg1, arg0], outputs=[]) rather than the default call order based ordering.

Returns:

A tensor representing the wrapped argument.

Raises:

  • ValueError: When indices are not consistent.