Porting Principle

The principle for adapting TF Adapter to TensorFlow 1.15 is as follows:

The config extension mechanism in TensorFlow is utilized to pass NPU-related function configurations downstream through config. Then, TensorFlow's optimizer registration mechanism is employed to register an optimizer on NPUs for graph processing based on configurations. Finally, the processed graph is delivered to the CANN platform for execution.

The main point of manual porting is to add configurations on NPUs and transfer the extended NPU configurations to config of tf.Session. In TensorFlow 1.15, the common Estimator, sess.run, and Keras scripts are implemented by calling sess.run, making the porting approaches for these three scripts fundamentally identical.