concept GraphModel in category deep learning

appears as: GraphModel
Deep Learning with JavaScript: Neural networks in TensorFlow.js

This is an excerpt from Manning's book Deep Learning with JavaScript: Neural networks in TensorFlow.js.

This section is organized as follows. We will first present the steps involved in optimizing the inference speed of a TensorFlow.js model using the GraphModel conversion. We will then list detailed performance measurements that quantify the speed gain provided by this approach. Finally, we will explain how the GraphModel conversion approach works under the hood.

Based on simple arithmetic rules, it can be seen that equation 12.3 can be simplified significantly, as long as the values of mean, var, epsilon, gamma, and beta are constant (do not change with the input or with how many times the layer has been invoked). After a model comprising a BatchNormalization layer is trained, all these variables indeed become constant. This is exactly what GraphModel conversion does: it “folds” the constants and simplifies the arithmetic, which leads to the following mathematically equivalent equation:

equation 12.4.

The values of k and b are calculated during GraphModel conversion, not during inference: