TODO(mdfaijul): Is there any other elegent way to check for quantized ops having attributes other than "T"? Current implementation reflects only QuantizedConv2D and its fused Ops.
| 3767 | // having attributes other than "T"? |
| 3768 | // Current implementation reflects only QuantizedConv2D and its fused Ops. |
| 3769 | const MklLayoutRewritePass::RewriteInfo* |
| 3770 | MklLayoutRewritePass::CheckForQuantizedNodeRewrite(const Node* n) const { |
| 3771 | DataType T1, T2; |
| 3772 | DataType Tinput, Tfilter; |
| 3773 | bool type_attrs_present = false; |
| 3774 | |
| 3775 | if (TryGetNodeAttr(n->def(), "Tinput", &Tinput) && |
| 3776 | TryGetNodeAttr(n->def(), "Tfilter", &Tfilter) && |
| 3777 | mkl_op_registry::IsMklLayoutDependentOp( |
| 3778 | mkl_op_registry::GetMklOpName(n->type_string()), Tinput, Tfilter)) { |
| 3779 | type_attrs_present = true; |
| 3780 | } else if (TryGetNodeAttr(n->def(), "T1", &T1) && |
| 3781 | TryGetNodeAttr(n->def(), "T2", &T2) && |
| 3782 | mkl_op_registry::IsMklLayoutDependentOp( |
| 3783 | mkl_op_registry::GetMklOpName(n->type_string()), T1, T2)) { |
| 3784 | type_attrs_present = true; |
| 3785 | } |
| 3786 | |
| 3787 | if (type_attrs_present) { |
| 3788 | for (auto ri = rinfo_.cbegin(); ri != rinfo_.cend(); ++ri) { |
| 3789 | if (n->type_string().compare(ri->name) == 0 && ri->rewrite_rule(n)) { |
| 3790 | return &*ri; |
| 3791 | } |
| 3792 | } |
| 3793 | } |
| 3794 | |
| 3795 | return nullptr; |
| 3796 | } |
| 3797 | |
| 3798 | bool MklLayoutRewritePass::CheckForRecoOpsListNodeRewrite(const Node* n) const { |
| 3799 | return MklLayoutPassLists::FinalList().count(n->type_string()); |
nothing calls this directly
no test coverage detected