MlirPassthroughOp

public final class MlirPassthroughOp

Wraps an arbitrary MLIR computation expressed as a module with a main() function.

This operation does not have an associated kernel and is not intended to be executed in a regular TensorFlow session. Instead it is intended to be used for testing or for special case where a user intends to pass custom MLIR computation through a TensorFlow graph with the intent of having custom tooling processing it downstream (when targeting a different environment, like TensorFlow lite for example). The MLIR module is expected to have a main() function that will be used as an entry point. The inputs to the operations will be passed as argument to the main() function and the returned values of the main function mapped to the outputs. Example usage:

import tensorflow as tf
 from tensorflow.compiler.mlir.tensorflow.gen_mlir_passthrough_op import mlir_passthrough_op
 
 mlir_module = '''python
 func @main(%arg0 : tensor<10xf32>, %arg1 : tensor<10xf32>) -> tensor<10x10xf32> {
    %add = "magic.op"(%arg0, %arg1) : (tensor<10xf32>, tensor<10xf32>) -> tensor<10x10xf32>
    return %ret : tensor<10x10xf32>
 
 '''

Constants

String OP_NAME The name of this op, as known by TensorFlow core engine

Public Methods

static MlirPassthroughOp
create ( Scope scope, Iterable< Operand <?>> inputs, String mlirModule, List<Class<? extends TType >> Toutputs)
Factory method to create a class wrapping a new MlirPassthroughOp operation.
Iterator< Operand < TType >>
List< Output <?>>

Inherited Methods

Constants

public static final String OP_NAME

The name of this op, as known by TensorFlow core engine

Constant Value: "MlirPassthroughOp"

Public Methods

public static MlirPassthroughOp create ( Scope scope, Iterable< Operand <?>> inputs, String mlirModule, List<Class<? extends TType >> Toutputs)

Factory method to create a class wrapping a new MlirPassthroughOp operation.

Parameters
scope current scope
Returns
  • a new instance of MlirPassthroughOp

public Iterator< Operand < TType >> iterator ()

public List< Output <?>> outputs ()