This repository was archived by the owner on Nov 17, 2023. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +23
-1
lines changed
src/operator/quantization
tests/python/mkl/subgraphs Expand file tree Collapse file tree 2 files changed +23
-1
lines changed Original file line number Diff line number Diff line change 2424*/
2525
2626#include " ../nn/concat-inl.h"
27+ #include " ../numpy/np_matrix_op-inl.h"
2728
2829namespace mxnet {
2930namespace op {
@@ -157,5 +158,27 @@ NNVM_REGISTER_OP(Concat)
157158 return node;
158159});
159160
161+ NNVM_REGISTER_OP (_npi_concatenate)
162+ .set_attr<FQuantizedOp>(" FQuantizedOp" , [](const NodeAttrs& attrs) {
163+ const NumpyConcatenateParam& param = nnvm::get<NumpyConcatenateParam>(attrs.parsed );
164+ nnvm::ObjectPtr node = nnvm::Node::Create ();
165+ if (param.axis .has_value () && param.axis .value () > 0 ) {
166+ node->attrs .op = Op::Get (" _contrib_quantized_concat" );
167+ node->attrs .name = " quantized_" + attrs.name ;
168+ } else {
169+ LOG (INFO) << " Currently, quantized numpy concatenate only supports axis>0, exclude "
170+ << attrs.name << " which axis is " << param.axis ;
171+ node->attrs .op = nullptr ;
172+ node->attrs .name = attrs.name ;
173+ }
174+ node->attrs .dict = attrs.dict ;
175+ node->attrs .dict [" dim" ] = node->attrs .dict [" axis" ];
176+ node->attrs .dict .erase (" axis" );
177+ if (node->op () != nullptr && node->op ()->attr_parser != nullptr ) {
178+ node->op ()->attr_parser (&(node->attrs ));
179+ }
180+ return node;
181+ });
182+
160183} // namespace op
161184} // namespace mxnet
Original file line number Diff line number Diff line change @@ -289,7 +289,6 @@ def forward(self, x):
289289@mx .util .use_np
290290@pytest .mark .parametrize ('data_shape' , DATA_SHAPE )
291291@pytest .mark .parametrize ('out_type' , ['int8' , 'auto' ])
292- @pytest .mark .skip ("Scale doesn't align in numpy for numpy operators" )
293292def test_pos_concat_scale_align (data_shape , out_type ):
294293 # concat scale alignment case
295294 class ConcatScaleAlign (nn .HybridBlock ):
You can’t perform that action at this time.
0 commit comments