Compilation of Keras Models

Following the tutorials on compilation. I tried hands-on for keras and tensorflow model compilation.

Then, I have realized that there are certain differences in keras and tensorflow models tutorial documentation at “Compile the Model with Relay” and “Execute on TVM”.

  1. [Keras] “Compiling the Model with Relay” and “Execute on TVM” is at

  2. [Tensorflow] “Compiling the Model with Relay” and “Execute on TVM” is at

Why do I witness changes like the following in the codes from above links while compiling and running keras and tensorflow models?

  1. executor = relay.build_module.create_executor(“graph”, mod, ctx, target) in Keras and lib =, target=target, target_host=target_host, params=params) in Tensorflow while building relay.

  2. tvm_out = executor.evaluate()(tvm.nd.array(data.astype(dtype)), params) in Keras and m = graph_runtime.GraphModule(lib[“default”](ctx)) in Tensorflow while running the graph.

Thank you!

cc @tqchen .Please help me with this regard.