cornell-zhang / heterocl

HeteroCL: A Multi-Paradigm Programming Infrastructure for Software-Defined Heterogeneous Computing
https://cornell-zhang.github.io/heterocl/
Apache License 2.0
326 stars 92 forks source link

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

Open arshad171 opened 1 year ago

arshad171 commented 1 year ago

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