auto_decomposition
Applicability
Product |
Supported |
|---|---|
Atlas 350 Accelerator Card |
√ |
√ |
|
√ |
|
√ |
|
√ |
|
√ |
Description
Performs tensor decomposition on the original TensorFlow model, generating a new model file.
Prototype
1 | add_ops = auto_decomposition(meta_path, ckpt_path, save_path) |
Parameters
Parameter |
Input/Output |
Description |
|---|---|---|
meta_path |
Input |
Path of the TensorFlow model definition file (.meta) to be decomposed. A string. |
ckpt_path |
Input |
Path of the original TensorFlow model weight file. Set this parameter to the common path prefix (including the file name without file name extensions) of the .data-XXXXX-of-XXXXX file and .index file. For example, the two files are path/model-200.data-00000-of-00001 and path/model-200.index. Then ckpt_path should be set to path/model-200. A string. |
save_path |
Input |
Save path, for storing the tensor decomposition resultant files such as .data-XXXXX-of-XXXXX. The resultant files are named after this value. For example, if this parameter is set to path/model, the generated .data-XXXXX-of-XXXXX and .index files are named as follows: path/model.data-XXXXX-of-XXXXX and path/model.index. A string. |
Returns
Returns a list of names of new convolutional layers after tensor decomposition. The data type is list.
Restrictions
- Ensure the input TensorFlow model files match each other: model definition file (.meta), model weight file (.data-XXXXX-of-XXXXX), and weight index file (.index).
- Pass the path of the original model and the output path to the tensor decomposition API. This API automatically decomposes the convolutional layers that meet the decomposition conditions. For details about the decomposition conditions, see Restrictions.
Example
1 2 3 4 5 | from amct_tensorflow.tensor_decompose import auto_decomposition auto_decomposition(meta_path='src_path/model.meta', ckpt_path='src_path/model', save_path='decomposed_path/model' ) |
Flush files:
- A checkpoint list file
- A model definition file (.meta)
- A model weight file (.data-00000-of-00001)
- A weight index file (.index)
- A graph change history file (.pkl), which is used by the decompose_graph API to modify the graph defined by the source training code.