Added a specialization parameter to check whether we're running the code outside of an inference engine.