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:

{@code
 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>
 }
 '''

Public Methods

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

Inherited Methods

org.tensorflow.op.PrimitiveOp
final boolean
equals(Object obj)
final int
Operation
op()
Returns the underlying Operation
final String
boolean
equals(Object arg0)
final Class<?>
getClass()
int
hashCode()
final void
notify()
final void
notifyAll()
String
toString()
final void
wait(long arg0, int arg1)
final void
wait(long arg0)
final void
wait()
void
forEach(Consumer<? super T> arg0)
abstract Iterator<Operand<Object>>
iterator()
Spliterator<Operand<Object>>
spliterator()

Public Methods

public static MlirPassthroughOp create (Scope scope, Iterable<Operand<?>> inputs, String mlirModule, List<Class<?>> 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<Object>> iterator ()

public List<Output<?>> outputs ()