decompose_graph

Function Usage

Decomposes the graph in the training code to fine-tune the decomposed model.

Constraints

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

Prototype

add_ops = decompose_graph(save_path, graph=None)

Parameters

Option

Input/Return

Description

Restriction

save_path

Input

Path for storing tensor decomposition result files generated by the auto_decomposition call.

A string

graph

Input

(Optional) Graph to be decomposed. If no value is entered or the value is None, the current graph is decomposed.

A tf.Graph.

Default: None

add_ops

Returns

List of names of newly added convolutional layers after tensor decomposition.

A list.

Returns

List of names of newly added convolutional layers after tensor decomposition.

Outputs

None

Examples

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')
# Construct and apply the user code of the optimizer.
# ...
# Load the code of the decomposed model weight before training. (You need to supplement the code.)