NPUStrategy Constructor

Description

Constructs an object of class NPUStrategy NPUStrategy inherits the tf.distribute.Strategy class and can call the native APIs of the base class to implement distributed training in the NPU environment.

Prototype

def __init__(self)

Options

None

Returns

An object of the NPUStrategy class

Example

Compile an instance of NPUStrategy to implement distributed training with NPU environments.

1
2
3
4
5
from npu_bridge.npu_init import *
...
strategy = npu_strategy.NPUStrategy()
# Use strategy to implement distributed training. The usage is the same as that of tf.distribute.Strategy.
...