tf.xla.experimental.jit_scope

Enable or disable JIT compilation of operators within the scope.

@contextlib.contextmanager
tf.xla.experimental.jit_scope(
    *args, **kwds
)

NOTE: This is an experimental feature.

The compilation is a hint and only supported on a best-effort basis.

Example usage:

with tf.xla.experimental.jit_scope(): c = tf.matmul(a, b) # compiled with tf.xla.experimental.jit_scope(compile_ops=False): d = tf.matmul(a, c) # not compiled with tf.xla.experimental.jit_scope( compile_ops=lambda node_def: 'matmul' in node_def.op.lower()): e = tf.matmul(a, b) + d # matmul is compiled, the addition is not.

Example of separate_compiled_gradients: # In the example below, the computations for f, g and h will all be compiled # in separate scopes. with tf.xla.experimental.jit_scope( separate_compiled_gradients=True): f = tf.matmul(a, b) g = tf.gradients([f], [a, b], name='mygrads1') h = tf.gradients([f], [a, b], name='mygrads2')

Args:

Raises:

Yields:

The current scope, enabling or disabling compilation.