cornell-zhang/heterocl

Help Running Custom Python Functions in "Eager-like" Mode

Opened this issue · 0 comments

Hi,

I am new HeteroCL, but I am familiar with TensorFlow, PyTorch, and the graph execution paradigm (from earlier versions of TensorFlow).

One of the tools I use for analysing ML algorithms uses heterocl to optimize a partial differential equation (HJI). In a nutshell, the library builds a heterocl graph with inputs state, inputs and returns a new state new_state = f(state, inputs). Expressing the new_state in terms of state and inptuts is quite straight forward if the relations can be broken down into addition, multiplication operations.

However, I would like to run a model prediction to generate the new state, i.e. new_state = my_ml_model.predict(state, inputs), which requires access to the values (numpy array) during the graph execution (analogous to eager execution in TensorFlow).

Is it possible to fetch the numpy array during the graph execution so that I run a ML prediction and return back a hcl.Tensor?

I would really appreciate your help~

Thanks,
Arshad