When defining a model, instead of directly calling the constructors of individual modules, we should use factory methods (e.g., through Scala companion object’s apply methods). This allows one to define the same model that can run using different underlying engine (e.g., MKL-DNN).