-
Notifications
You must be signed in to change notification settings - Fork 259
[ONNX] Add MatMul for FBC/BC #3657
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
base: develop
Are you sure you want to change the base?
[ONNX] Add MatMul for FBC/BC #3657
Conversation
fbec013
to
c7c68ff
Compare
1f0d75c
to
66ef2c4
Compare
op_names = ["MatMul"] | ||
hw_config_names = [HWConfigOpName.MATMUL] | ||
weight_channel_axis = -1 # For port_id=1 | ||
bias_port_id = 2 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This does not apply to the MatMul
ONNX operation, as it does not accept a bias input. Reference: https://onnx.ai/onnx/operators/onnx__MatMul.html
if bias_value.ndim > 1: | ||
# Make index positive | ||
output_channel_axis = range(bias_value.ndim)[output_channel_axis] | ||
input_channel_axis = range(bias_value.ndim)[input_channel_axis] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It was moved into create_input_data()
because this method does not work properly with a negative channel_axis
. The output_channel_axis
is converted to positive inside mean_per_channel()
method.
Changes
Add support for the
MatMul
operation in the Fast Bias/Bias Correction algorithm.Reason for changes
The Fast Bias/Bias Correction algorithm is not applied to the
MatMul
->Add
subgraph in which one of the inputs to the Add operation is a constant. In this case, theMatMul
operation is not considered as having a bias, so the algorithm is not applied.Related tickets
Ref: 135433
Tests