decompose_graph

Applicability

Product

Supported

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

Atlas inference product

Atlas training product

Description

Fine-tunes a decomposed model by decomposing the graph in the training code.

Prototype

1
add_ops = decompose_graph(save_path, graph=None)

Parameters

Parameter

Input/Output

Description

save_path

Input

Path for storing the file after tensor decomposition using the auto_decomposition API.

A string.

graph

Input

(Optional) Graph to be decomposed. If it is not specified or it is set to None, decomposes the current graph.

A tf.Graph.

Default: None

add_ops

Returns

List of names of new convolutional layers after tensor decomposition.

A list.

Returns

Returns a list of names of new convolutional layers after tensor decomposition.

Restrictions

  • The auto_decomposition API has been called to decompose the model.
  • This API is used based on the training code. The model file passed to the auto_decomposition API must be obtained based on the same training code.
  • This API modifies only the graph, but does not modify a variable whose convolution kernel has been referenced. If a convolution kernel has been referenced by a variable before being decomposed, the variable should not be used.

Example

In the user training code:

1
2
3
4
5
6
from amct_tensorflow.tensor_decompose import decompose_graph
# User code for constructing the network graph...
decompose_graph(save_path='decomposed_path/model')
# User code for building an optimizer and applying the optimizer...
# ...
# Code for loading the model weights generated after decomposition before training. (Update the sample code based on your situation.)