Overview

Applicability

Product

Supported (√/x)

Atlas 350 Accelerator Card

Atlas A3 training product/Atlas A3 inference product

Atlas A2 training product/Atlas A2 inference product

Atlas 200I/500 A2 inference product

X

Atlas inference product

X

Atlas training product

Function Description

TF Adapter provides a series of session configurations for function debugging, performance improvement, and precision improvement. Developers can use these session configurations when performing model training or online inference on the AI processor.

You can view related configuration definitions in the python/site-packages/npu_bridge/estimator/npu/npu_estimator.py file in the TensorFlow Adapter installation directory. The parameters that are not listed in this section are reserved or applicable to other AI processor versions.

Examples

The usage of session configurations is as follows:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
import tensorflow as tf
from npu_bridge.npu_init import *
...
config = tf.ConfigProto()
custom_op = config.graph_options.rewrite_options.custom_optimizers.add()
custom_op.name = "NpuOptimizer"
custom_op.parameter_map["use_off_line"].b = True
config.graph_options.rewrite_options.remapping = RewriterConfig.OFF
config.graph_options.rewrite_options.memory_optimization = RewriterConfig.OFF
...
with tf.Session(config=config) as sess:
    sess.run(cost)

After scripts are automatically ported by using the porting tool, if you need to enable related functions through session configurations, see (Optional) Follow-up Procedure.