Imperative Deep Learning programming is a promising paradigm for creating reliable and efficient Deep Learning programs. However, it is challenging to write correct and efficient imperative Deep Learning programs in TensorFlow (v2), a popular Deep Learning framework. TensorFlow provides a high-level API (@tf.function
) that allows users to execute computational graphs using nature, imperative programming. However, writing efficient imperative TensorFlow programs requires careful consideration.
This tool consists of automated refactoring research prototype plug-ins for Eclipse PyDev that assists developers in writing optimal imperative Deep Learning code in a semantics-preserving fashion. Refactoring preconditions and transformations for automatically determining when it is safe and potentially advantageous to migrate an eager function to hybrid and improve upon already hybrid Python functions are included. The approach utilizes the WALA Ariadne static analysis framework that has been modernized to TensorFlow 2 and extended to work with modern Python constructs and whole projects. The tool also features a side-effect analysis that is used to determine if a Python function is safe to hybridize.
The tool is designed to be used in the Eclipse IDE with the PyDev plug-in. Thus, the tool is designed to operate on Python files contained within PyDev projects, as that is where it obtains metadata from the projects such as PYTHONPATH
. However, currently, the tool is only compatible only with our PyDev 9.3 development branch. That means that you will have to have our version of PyDev installed in your Eclipse instance before using this plug-in. Thus, if you have a version of PyDev previously installed, you will need to uninstall it before installing our tool. Integration with the standard PyDev version is being tracked by #152. Installation via our update site should install the necessary PyDev version automatically.
Once the plug-in and dependencies are installed, the refactoring can be run in two different ways:
- As a command.
- Select a Python code entity.
- Select "Hybridize function..." from the "Quick Access" dialog (CTRL-3).
- As a menu item.
- Right-click on a Python code entity.
- Under "Refactor," choose "Hybridize function..."
Currently, the refactoring works only via the package explorer and the outline views. You can either select a code entity to optimize or select multiple entities. In each case, the tool will find functions in the enclosing entity to refactor.
Due to #370, only the "command" is working.
The tool has been tested on Eclipse IDE for RCP and RAP Developers Version: 2023-03 (4.27.0), Build id: 20230309-1520 under Java 17.
An alpha version of our tool is available via an Eclipse update site at:
Please choose the latest version.
Coming soon!
The refactoring has several dependencies as listed below. If you experience any trouble installing the plug-in using the above update site, you can manually install the dependencies. The latest version of the plug-ins should be installed:
For information on contributing, see CONTRIBUTING.md.
See the wiki for further information.