ZhennanQin commented on a change in pull request #13697: [MKLDNN] Enable signed 
int8 support for convolution.
URL: https://github.com/apache/incubator-mxnet/pull/13697#discussion_r244627428
 
 

 ##########
 File path: src/operator/quantization/quantize_v2-inl.h
 ##########
 @@ -0,0 +1,226 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+/*!
+ *  Copyright (c) 2017 by Contributors
+ * \file quantize_v2-inl.h
+ * \brief implementation of quantize operation
 
 Review comment:
   Description is added in quantize_v2.cc:
   ```
   NNVM_REGISTER_OP(_contrib_quantize_v2)
     .describe(R"code(Quantize a input tensor from float to `out_type`,
     with user-specified `min_calib_range` and `max_calib_range` or the input 
range collected at runtime.
     
     Output `min_range` and `max_range` are scalar floats that specify the 
range for the input data.
     
     When out_type is `uint8`, the output is calculated using the following 
equation:
     
     `out[i] = (in[i] - min_range) * range(OUTPUT_TYPE) / (max_range - 
min_range) + 0.5`,
     
     where `range(T) = numeric_limits<T>::max() - numeric_limits<T>::min()`.
     
     When out_type is `int8`, the output is calculate using the following 
equation
     by keep zero centered for the quantized value:
     
     `out[i] = sign(in[i]) * min(abs(in[i] * scale + 0.5f, quantized_range)`,
     
     where
     `quantized_range = MinAbs(max(int8), min(int8))` and
     `scale = quantized_range / MaxAbs(min_range, max_range).`
     
     When out_type is `auto`, the output type is automatically determined by 
min_calib_range if presented.
     If min_calib_range < 0.0f, the output type will be int8, otherwise will be 
uint8.
     If min_calib_range isn't presented, the output type will be int8.
     
     .. Note::
         This operator only supports forward propogation. DO NOT use it in 
training.)code" ADD_FILELINE)
   ```

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to