-
Notifications
You must be signed in to change notification settings - Fork 2
Move the graph fusion before AddInitial() for constant operands #238
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: ort_backend
Are you sure you want to change the base?
Conversation
graph_fusion_info.fusible_operations_set.insert(operation.get()); | ||
graph_fusion_info.matmul_input_b_to_fusible_dequantize_map | ||
[transpose->get_transpose()->output_operand_id] = operation.get(); | ||
|
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.
Worth adding a comment explaining why it needs to change the data type.
dequantize_linear->label); | ||
auto new_input_constant = std::make_unique<WebNNConstantOperand>( | ||
std::move(new_input_desc), input_constant->TakeData()); | ||
constant_operands[dequantize_linear->input_operand_id] = |
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.
You may want to check this constant is only used by dequantizeLinear before replacing it.
uint32_t blob_bytes = input_shape[2] / 2; | ||
auto input_constant = std::move( | ||
constant_operands.at(dequantize_linear->input_operand_id)); | ||
std::vector<uint32_t> new_input_buffer_shape = {input_feature_size, |
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.
Move this line right after declaring blob_bytes
uint32_t input_feature_size = input_shape[0]; | ||
uint32_t quant_num = input_shape[1]; | ||
uint32_t blob_bytes = input_shape[2] / 2; | ||
auto input_constant = std::move( |
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.
std::move
is unnecessary? I guess std::move
a reference would result in a copying.
constant_operands[dequantize_linear->input_operand_id] = | ||
std::move(new_input_constant); | ||
|
||
auto zero_point_constant = std::move( |
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.
Same here, std::move
seems to be unnecessary.
|
||
auto zero_point_constant = std::move( | ||
constant_operands.at(dequantize_linear->zero_point_operand_id)); | ||
std::vector<uint32_t> new_zero_point_buffer_shape = { |
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.
std::vector<uint32_t> new_zero_point_buffer_shape = { | |
std::vector<uint32_t> new_zero_point_shape = { |
/cc @wangw-1991 |
@huningxin PTAL.
Fix #237