auto_decomposition

Applicability

Product

Supported

Atlas 350 Accelerator Card

x

Atlas A3 training product/Atlas A3 inference product

x

Atlas A2 training product/Atlas A2 inference product

x

Atlas 200I/500 A2 inference product

Atlas inference product

Atlas training product

Description

Generates a decomposed model file and its weight file from a given Caffe model file (.prototxt) and its weight file (.caffemodel).

Prototype

1
auto_decomposition(model_file,weights_file,new_model_file,new_weights_file)

Parameters

Parameter

Input/Output

Description

model_file

Input

Definition file (.prototxt) of the Caffe model.

A string.

weights_file

Input

Weight file (.caffemodel) of the trained Caffe model.

A string.

new_model_file

Input

Caffe model definition file (.prototxt) after tensor decomposition, for example, xx_tensor_decomposition.prototxt.

A string.

new_weights_file

Input

Caffe model weight file (.caffemodel) after tensor decomposition, for example, xx_tensor_decomposition.caffemodel.

A string.

Returns

None

Restrictions

  • Ensure that the input Caffe .prototxt file matches the input .caffemodel file.
  • 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_caffe.tensor_decompose import auto_decomposition
auto_decomposition(model_file='ResNet-50-deploy.prototxt',
                  weights_file='ResNet-50-weights.caffemodel',
                  new_model_file='ResNet-50-deploy_tensor_decomposition.prototxt',
                  new_weights_file='ResNet-50-deploy_tensor_decomposition.caffemodel')

Flush files:

  • Model definition file (.prototxt) after tensor decompression.
  • Model weight file (.caffemodel) after tensor decompression.