liveBook · Manning

XLA

As explained in Deep Learning with R, Third Edition

XLA is a compiler for accelerating linear algebra and machine-learning computations across supported hardware.

XLA is a high-performance compiler for machine-learning computations. Enable it after debugging in the R runtime: compilation can improve execution speed, but the first call takes longer while the function is compiled; later calls reuse it. section 3.3.1

Compile a dense operation

dense <- tf_function(jit_compile = TRUE, \\(inputs, W, b) {\n tf$nn$relu(tf$matmul(inputs, W) + b)\n}) section 3.3.1

dense <- tf_function(jit_compile = TRUE, \(inputs, W, b) {
  tf$nn$relu(tf$matmul(inputs, W) + b)
})

This listing shows the R syntax for enabling XLA compilation on a TensorFlow function. section 3.3.1

How Deep Learning with R, Third Edition covers it

How deep it goes
Explains the compilation switch and startup cost, but stops short of compiler internals.
Examples
Uses a ReLU dense function containing matrix multiplication and bias addition.
What it assumes
Assumes a TensorFlow function and debugging familiarity, while showing the R configuration from the function level.
What you can do after
Apply it via TensorFlow’s tf_function() by setting jit_compile = TRUE after debugging.
How it connects
Connects XLA with TensorFlow, tf_function(), and graph mode.

Also explained in

Compare how 3 books explain XLA →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Deep Learning with R, Third Edition. The section links point to the parts of the book it draws on.