Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix a test bug #4

Open
wants to merge 1 commit into
base: fix_prune_shape
Choose a base branch
from

Conversation

yzheng124
Copy link

@yzheng124 yzheng124 commented Apr 4, 2023

Changes

I double checked the test and found that there is a bug in the original filter pruning test. Maybe this case can let Nikolay want to merge our PR. Thanks!

Reason for changes

The old function cannot deal with the following test case MobilenetV3BlockSEReshape:
Here is part of the original graph of MobilenetV3BlockSEReshape:
image

For test case MobilenetV3BlockSEReshape, here is the result of tmp_out_channels and tmp_in_channels using the function in public NNCF: (tmp_out_channels and tmp_in_channels are generated here):


tmp_out_channels = 
{
'MobilenetV3BlockSEReshape/NNCFConv2d[first_conv]/conv2d_0': 1,
'MobilenetV3BlockSEReshape/InvertedResidual[inverted_residual]/Sequential[conv]/NNCFConv2d[0]/conv2d_0': 1,
'MobilenetV3BlockSEReshape/InvertedResidual[inverted_residual]/Sequential[conv]/SELayerWithReshapeAndLinear[3]/Sequential[fc]/NNCFLinear[0]/linear_0': 1,
'MobilenetV3BlockSEReshape/InvertedResidual[inverted_residual]/Sequential[conv]/SELayerWithReshapeAndLinear[3]/Sequential[fc]/NNCFLinear[3]/linear_0': 1,
'MobilenetV3BlockSEReshape/InvertedResidual[inverted_residual]/Sequential[conv]/NNCFConv2d[4]/conv2d_0': 1,
'MobilenetV3BlockSEReshape/NNCFConv2d[last_conv]/conv2d_0': 1
}


tmp_in_channels = 
{
'MobilenetV3BlockSEReshape/NNCFConv2d[first_conv]/conv2d_0': 1,
'MobilenetV3BlockSEReshape/InvertedResidual[inverted_residual]/Sequential[conv]/NNCFConv2d[0]/conv2d_0': 1,
'MobilenetV3BlockSEReshape/InvertedResidual[inverted_residual]/Sequential[conv]/SELayerWithReshapeAndLinear[3]/Sequential[fc]/NNCFLinear[0]/linear_0': 1,
'MobilenetV3BlockSEReshape/InvertedResidual[inverted_residual]/Sequential[conv]/SELayerWithReshapeAndLinear[3]/Sequential[fc]/NNCFLinear[3]/linear_0': 1,
'MobilenetV3BlockSEReshape/InvertedResidual[inverted_residual]/Sequential[conv]/NNCFConv2d[4]/conv2d_0': 6,
'MobilenetV3BlockSEReshape/NNCFConv2d[last_conv]/conv2d_0': 1
}

We can see node MobilenetV3BlockSEReshape/InvertedResidual[inverted_residual]/Sequential[conv]/NNCFConv2d[4]/conv2d_0: 6 in tmp_in_channels, which is incorrect.

This is because node MobilenetV3BlockSEReshape/InvertedResidual[inverted_residual]/Sequential[conv]/NNCFConv2d[4]/conv2d_0 is in clusters(not in next_nodes) and it is not a depthwise conv, so its input channel doesn't minus pruned elements.

Our PR can deal with this test case. If use our PR,
MobilenetV3BlockSEReshape/InvertedResidual[inverted_residual]/Sequential[conv]/NNCFConv2d[4]/conv2d_0: 1 in tmp_in_channels

Related tickets

N/A

Tests

N/A

@yzheng124 yzheng124 marked this pull request as ready for review April 4, 2023 07:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant