bgawrych commented on a change in pull request #20712:
URL: https://github.com/apache/incubator-mxnet/pull/20712#discussion_r754033460
##########
File path: tests/python/dnnl/subgraphs/test_fc_subgraph.py
##########
@@ -200,3 +200,26 @@ def forward(self, x):
attrs = {'fc': {}}
net = MultiOutputFC()
check_fusion(net, data_shape, attrs, check_quantization=flatten)
+
+
[email protected]_np
[email protected]('identity_node', ['dropout', 'copy'])#DATA_SHAPE)
+def test_fc_identity_eltwise(identity_node):
+ class FCIdentityEltwise(nn.HybridBlock):
+ def __init__(self, identity_node, **kwargs):
+ super(FCIdentityEltwise, self).__init__(**kwargs)
+ self.fc = nn.Dense(units=64, use_bias=False, weight_initializer=None,
flatten=True)
+ self.identity_node = identity_node
+ def forward(self, x):
+ fc_out = self.fc(x)
+ if self.identity_node == 'copy':
+ fc_out = mx.np.copy(fc_out)
+ else:
+ fc_out = mx.npx.dropout(fc_out)
+ out = mx.npx.activation(fc_out, act_type='relu')
+ return out
+
+ data_shape = (64, 4, 10, 10)
+ attrs = {'fc': {'with_eltwise': 'true'}}
+ net = FCIdentityEltwise(identity_node)
+ check_fusion(net, data_shape, attrs, check_quantization=False)
Review comment:
This checks if relu is fused into FC - checks whether attribute
'with_eltwise' in symbol is set to true. This tests checks also results before
and after fuse. If identity node won't be fused into FC this test will blow up
because eltwise won't be fused either ('with_eltwise' attribute)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]