Skip to content
This repository has been archived by the owner on Nov 17, 2023. It is now read-only.

[v1.9.x] Export attributes of transformer operators #20902

Merged
merged 1 commit into from
Mar 4, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions src/operator/subgraph/mkldnn/mkldnn_transformer_property.h
Original file line number Diff line number Diff line change
Expand Up @@ -90,16 +90,15 @@ class SgMKLDNNTransformerProperty : public SubgraphProperty {
new_sym.outputs.emplace_back(last_node);
std::ostringstream node_name;
std::string op_name;
MKLDNNSelfAttParam new_param;
DFSVisit(new_sym.outputs, [&](const nnvm::ObjectPtr &node) {
if (node->op() &&
(node->op()->name == SELFATT_QK ||
node->op()->name == SELFATT_VALATT)) {
op_name = node->op()->name;
auto param = nnvm::get<InterleavedMatMulParam>(node->attrs.parsed);
new_param.heads = param.heads;
new_param.quantized = false;
new_param.enable_float_output = false;
n->attrs.dict["heads"] = std::to_string(param.heads);
n->attrs.dict["quantized"] = "False";
n->attrs.dict["enable_float_output"] = "False";
}
});
node_name << NameMapping.at(op_name) << "_" << std::to_string(subgraph_id);
Expand All @@ -109,7 +108,7 @@ class SgMKLDNNTransformerProperty : public SubgraphProperty {
n->attrs.op = Op::Get(OpMapping.at(op_name));
CHECK(n->attrs.op);
n->attrs.subgraphs.emplace_back(std::make_shared<nnvm::Symbol>(new_sym));
n->attrs.parsed = new_param;
n->op()->attr_parser(&(n->attrs));
return n;
}

Expand Down