This API has the following methods:
torch.nn.Moduleobject to prune.
- A single or a list of torch. Tensor used as inputs for model inference. It does not need to be real data. It can be a randomly generated tensor of the same shape and data type as real data.
sparse_model(w_sparsity=0.5, a_sparsity=0, block_size=16,excludes=None)
- One of ['0', '0.5', '0.75']. A float of weight sparsity of Convolution and Fully Connected layers. By default, the w_sparsity is set to 0.5.
- One of ['0', '0.5']. A float of sparsity of activations. Here, the activations represent the input feature map of the sparse layer. By default, a_sparsity is set to 0. If a_sparsity is 0.5, w_sparsity must be 0.75.
- The int number of consecutive elements of the input channel/channel unfolded according to the weights/activations.
- A list of modules to be excluded from sparsity pruning.
Returns a network converted from sparse networks with sparse weights for inference on hardware for specified sparse computations.
- The sparse model.