Grappler for plugin writers


Currently working on writing a plugin, I am taking a look at grappler and what I can do with it/what it can provides for my plugin.

My entry point for understanding grappler is the community tutorial on plugins, which i can’t thank enough for existing, but is also far from complete and also contains a few code errors.
Then there is all the info from the sources, as in grappler.h.

When implementing TF_InitGraph, the plugin author sets a TP_OptimizerConfigs field and also functions for creating an optimiser, optimising and destroying an optimiser.

So I have a few questions:

  1. Does activating options in TP_OptimizerConfigs enable some existing graph optimisation techniques from tensorflow?
  2. If 1. is true, is it compatible with providing a custom optimisation function?
  3. If 2. is true, when does the custom optimisation function is executed in comparison with the tensorflow ones (before, after, or some different logic)?
  4. The tutorial mentions the C API as well as using the graph proto, are they interchangeable? The part about the C API isn’t very clear to me unfortunately.

Please let me know if any of these needs clarification.
Thank you