LayerSynchronizer
An abstract class that users need to inherit from and implement the related APIs. Currently, this class contains only the synchronize_layer API.
Applicability
Product |
Supported (√/x) |
|---|---|
Atlas 350 Accelerator Card |
x |
√ |
|
√ |
|
x |
|
x |
|
x |
Note: For
Function Description
Waits until the execution of the specified layer of the model is complete. You need to inherit LayerSynchronizer and implement this API.
This API is called during the execution of transfer_cache_async. When the API returns a success status, the cache transmission for the current layer begins.
Prototype
1 | synchronize_layer(layer_index: int, timeout_in_millis: Optional[int]) -> bool |
Parameters
Parameter |
Data Type |
Description |
|---|---|---|
layer_index |
int |
Index of a layer. |
timeout_in_millis |
Optional[int] |
Timeout interval, which is not supported currently. |
Example
This API is not directly called by users. Instead, it is called by CacheManager as a callback function.
Returns
In normal cases, a message is returned, indicating whether the synchronization is successful.
If a parameter is incorrect, a TypeError or ValueError may be thrown.
Restrictions
None