Compiling image processing and machine learning applications to reconfigurable accelerators