message: Added env. variable NGRAPH_ENABLE_SERIALIZE to enable serialization of the nGraph.
diff: * See the License for the specific language governing permissions and
  * limitations under the License.
  *******************************************************************************/
  +#include <fstream>
  #include "tensorflow/core/common_runtime/dma_helper.h"
  #include "tensorflow/core/common_runtime/optimization_registry.h"
  #include "tensorflow/core/graph/graph.h"
  #include "tensorflow/core/graph/graph_constructor.h"
  +#include "ngraph/serializer.hpp"
  +
  #include "ngraph_builder.h"
  #include "ngraph_cluster_manager.h"
  #include "ngraph_utils.h"
  @@ -78,6 +81,17 @@ class NGraphEncapsulateOp : public tf::OpKernel {
  ctx, Builder::TranslateGraph(input_shapes, &m_graph, ng_function));
  }
  + // Serialize to nGraph if needed
  + if (std::getenv("NGRAPH_ENABLE_SERIALIZE") != nullptr) {
  + std::string file_name = "tf_function_" + ctx->op_kernel().name() + ".js";
  + VLOG(0) << "Serializing graph to: " << file_name;
  + std::string js = ngraph::serialize(ng_function, 4);
  + {
  + std::ofstream f(file_name);
  + f << js;
  + }
  + }
  +
  // Create the nGraph backend (TODO(amprocte): should probably put this
  // into the resource manager rather than re-create each time, though I
  // don't know how expensive this actually is.)
  