import caffe2.python.hypothesis_test_util as hu
import hypothesis.strategies as st
import numpy as np
-from caffe2.python import core, dyndep
+from caffe2.python import core, dyndep, workspace
from caffe2.quantization.server import utils as dnnlowp_utils
from dnnlowp_test_utils import (
avoid_vpmaddubsw_overflow_fc,
dyndep.InitOpsLibrary("//caffe2/caffe2/quantization/server:dnnlowp_ops")
+workspace.GlobalInit(["caffe2", "--caffe2_omp_num_threads=11"])
class DNNLowPBatchMatMulOpTest(hu.HypothesisTestCase):
dyndep.InitOpsLibrary("//caffe2/caffe2/quantization/server:dnnlowp_ops")
+workspace.GlobalInit(["caffe2", "--caffe2_omp_num_threads=11"])
class DNNLowPBatchPermutationOpTest(hu.HypothesisTestCase):
Workspace* ws)
: BaseType(operator_def, ws),
order_(StringToStorageOrder(
- OperatorBase::GetSingleArgument<std::string>("order", "NCHW"))),
+ this->template GetSingleArgument<std::string>("order", "NCHW"))),
OP_SINGLE_ARG(int, "group", group_, 1) {
CAFFE_ENFORCE_NE(order_, StorageOrder::UNKNOWN);
}
#pragma omp parallel for
#endif
for (int i = 0; i < N; ++i) {
- ConstEigenMatrixMap<T> X_mat(X_data, K * HxW, G);
+ ConstEigenMatrixMap<T> X_mat(X_data + i * stride, K * HxW, G);
for (int j = 0; j < K; ++j) {
- EigenMatrixMap<T>(Y_data + j * G * HxW, HxW, G) =
+ EigenMatrixMap<T>(Y_data + i * stride + j * G * HxW, HxW, G) =
X_mat.block(j * HxW, 0, HxW, G);
}
- X_data += stride;
- Y_data += stride;
}
// Even if there is a pre-chosen quantization parameters for the output,
for (auto i = 0; i < X.numel(); i += C) {
// Transpose each C = GxK matrix
fbgemm::transpose_4rows(
- K, (const std::uint8_t*)(X_data + i), (std::uint8_t*)(Y_data + i));
+ K,
+ reinterpret_cast<const std::uint8_t*>(X_data + i),
+ reinterpret_cast<std::uint8_t*>(Y_data + i));
}
} else {
#ifdef _OPENMP
dyndep.InitOpsLibrary("//caffe2/caffe2/quantization/server:dnnlowp_ops")
+workspace.GlobalInit(["caffe2", "--caffe2_omp_num_threads=11"])
class DNNLowPChannelShuffleOpsTest(hu.HypothesisTestCase):
import caffe2.python.hypothesis_test_util as hu
import hypothesis.strategies as st
import numpy as np
-from caffe2.python import core, dyndep
+from caffe2.python import core, dyndep, workspace
from dnnlowp_test_utils import check_quantized_results_close
from hypothesis import given
dyndep.InitOpsLibrary("//caffe2/caffe2/quantization/server:dnnlowp_ops")
+workspace.GlobalInit(["caffe2", "--caffe2_omp_num_threads=11"])
class DNNLowPConcatOpTest(hu.HypothesisTestCase):
import caffe2.python.hypothesis_test_util as hu
import hypothesis.strategies as st
-from caffe2.python import core, dyndep
+from caffe2.python import core, dyndep, workspace
from caffe2.quantization.server import utils as dnnlowp_utils
from dnnlowp_test_utils import (
check_quantized_results_close,
dyndep.InitOpsLibrary("//caffe2/caffe2/quantization/server:dnnlowp_ops")
+workspace.GlobalInit(["caffe2", "--caffe2_omp_num_threads=11"])
class DNNLowPOpConvDepthWiseTest(hu.HypothesisTestCase):
import caffe2.python.hypothesis_test_util as hu
import hypothesis.strategies as st
import numpy as np
-from caffe2.python import core, dyndep
+from caffe2.python import core, dyndep, workspace
from caffe2.quantization.server import utils as dnnlowp_utils
from dnnlowp_test_utils import (
check_quantized_results_close,
dyndep.InitOpsLibrary("//caffe2/caffe2/quantization/server:dnnlowp_ops")
+workspace.GlobalInit(["caffe2", "--caffe2_omp_num_threads=11"])
class DNNLowPOpConvAcc16OpTest(hu.HypothesisTestCase):
import caffe2.python.hypothesis_test_util as hu
import hypothesis.strategies as st
-from caffe2.python import core, dyndep
+from caffe2.python import core, dyndep, workspace
from caffe2.quantization.server import utils as dnnlowp_utils
from dnnlowp_test_utils import (
check_quantized_results_close,
dyndep.InitOpsLibrary("//caffe2/caffe2/quantization/server:dnnlowp_ops")
+workspace.GlobalInit(["caffe2", "--caffe2_omp_num_threads=11"])
class DNNLowPOpConvTest(hu.HypothesisTestCase):
import caffe2.python.hypothesis_test_util as hu
import hypothesis.strategies as st
import numpy as np
-from caffe2.python import core, dyndep
+from caffe2.python import core, dyndep, workspace
from caffe2.quantization.server import utils as dnnlowp_utils
from dnnlowp_test_utils import (
check_quantized_results_close,
dyndep.InitOpsLibrary("//caffe2/caffe2/quantization/server:dnnlowp_ops")
+workspace.GlobalInit(["caffe2", "--caffe2_omp_num_threads=11"])
class GroupWiseDNNLowPOpConvAcc16OpTest(hu.HypothesisTestCase):
import caffe2.python.hypothesis_test_util as hu
import hypothesis.strategies as st
-from caffe2.python import core, dyndep
+from caffe2.python import core, dyndep, workspace
from caffe2.python.fb import hardcode_scale_zp
from caffe2.quantization.server import utils as dnnlowp_utils
from dnnlowp_test_utils import check_quantized_results_close, generate_conv_inputs
dyndep.InitOpsLibrary("//caffe2/caffe2/quantization/server:dnnlowp_ops")
+workspace.GlobalInit(["caffe2", "--caffe2_omp_num_threads=11"])
class GroupWiseDNNLowPOpConvTest(hu.HypothesisTestCase):
import caffe2.python.hypothesis_test_util as hu
import hypothesis.strategies as st
import numpy as np
-from caffe2.python import core, dyndep
+from caffe2.python import core, dyndep, workspace
from dnnlowp_test_utils import check_quantized_results_close
from hypothesis import given
dyndep.InitOpsLibrary("//caffe2/caffe2/quantization/server:dnnlowp_ops")
+workspace.GlobalInit(["caffe2", "--caffe2_omp_num_threads=11"])
class DNNLowPDequantizeOpTest(hu.HypothesisTestCase):
import caffe2.python.hypothesis_test_util as hu
import hypothesis.strategies as st
import numpy as np
-from caffe2.python import core, dyndep
+from caffe2.python import core, dyndep, workspace
from dnnlowp_test_utils import check_quantized_results_close
from hypothesis import given
dyndep.InitOpsLibrary("//caffe2/caffe2/quantization/server:dnnlowp_ops")
+workspace.GlobalInit(["caffe2", "--caffe2_omp_num_threads=11"])
class DNNLowPAddOpTest(hu.HypothesisTestCase):
import caffe2.python.hypothesis_test_util as hu
import hypothesis.strategies as st
import numpy as np
-from caffe2.python import core, dyndep
+from caffe2.python import core, dyndep, workspace
from dnnlowp_test_utils import check_quantized_results_close
from hypothesis import given
dyndep.InitOpsLibrary("//caffe2/caffe2/quantization/server:dnnlowp_ops")
+workspace.GlobalInit(["caffe2", "--caffe2_omp_num_threads=11"])
class DNNLowPElementwiseLinearOpTest(hu.HypothesisTestCase):
import caffe2.python.hypothesis_test_util as hu
import hypothesis.strategies as st
import numpy as np
-from caffe2.python import core, dyndep
+from caffe2.python import core, dyndep, workspace
from dnnlowp_test_utils import check_quantized_results_close
from hypothesis import given
dyndep.InitOpsLibrary("//caffe2/caffe2/quantization/server:dnnlowp_ops")
+workspace.GlobalInit(["caffe2", "--caffe2_omp_num_threads=11"])
class DNNLowPMulOpTest(hu.HypothesisTestCase):
import caffe2.python.hypothesis_test_util as hu
import hypothesis.strategies as st
import numpy as np
-from caffe2.python import core, dyndep
+from caffe2.python import core, dyndep, workspace
from dnnlowp_test_utils import check_quantized_results_close
from hypothesis import given
dyndep.InitOpsLibrary("//caffe2/caffe2/quantization/server:dnnlowp_ops")
+workspace.GlobalInit(["caffe2", "--caffe2_omp_num_threads=11"])
class DNNLowPOpSumOpTest(hu.HypothesisTestCase):
import caffe2.python.hypothesis_test_util as hu
import hypothesis.strategies as st
import numpy as np
-from caffe2.python import core, dyndep
+from caffe2.python import core, dyndep, workspace
from caffe2.quantization.server import utils as dnnlowp_utils
from dnnlowp_test_utils import check_quantized_results_close
from hypothesis import given
dyndep.InitOpsLibrary("//caffe2/caffe2/quantization/server:dnnlowp_ops")
+workspace.GlobalInit(["caffe2", "--caffe2_omp_num_threads=11"])
class DNNLowPFullyConnectedAcc16OpTest(hu.HypothesisTestCase):
import caffe2.python.hypothesis_test_util as hu
import hypothesis.strategies as st
import numpy as np
-from caffe2.python import core, dyndep
+from caffe2.python import core, dyndep, workspace
from caffe2.quantization.server import utils as dnnlowp_utils
from dnnlowp_test_utils import (
avoid_vpmaddubsw_overflow_fc,
dyndep.InitOpsLibrary("//caffe2/caffe2/quantization/server:dnnlowp_ops")
+workspace.GlobalInit(["caffe2", "--caffe2_omp_num_threads=11"])
class DNNLowPFullyConnectedOpTest(hu.HypothesisTestCase):
import caffe2.python.hypothesis_test_util as hu
import hypothesis.strategies as st
import numpy as np
-from caffe2.python import core, dyndep
+from caffe2.python import core, dyndep, workspace
from hypothesis import given
dyndep.InitOpsLibrary("//caffe2/caffe2/quantization/server:dnnlowp_ops")
+workspace.GlobalInit(["caffe2", "--caffe2_omp_num_threads=11"])
def mse(x, xh):
import caffe2.python.hypothesis_test_util as hu
import hypothesis.strategies as st
import numpy as np
-from caffe2.python import core, dyndep
+from caffe2.python import core, dyndep, workspace
from caffe2.quantization.server import utils as dnnlowp_utils
from dnnlowp_test_utils import (
avoid_vpmaddubsw_overflow_fc,
dyndep.InitOpsLibrary("//caffe2/caffe2/quantization/server:dnnlowp_ops")
+workspace.GlobalInit(["caffe2", "--caffe2_omp_num_threads=11"])
class RowWiseDNNLowPFullyConnectedOpTest(hu.HypothesisTestCase):
import caffe2.python.hypothesis_test_util as hu
import hypothesis.strategies as st
import numpy as np
-from caffe2.python import core, dyndep
+from caffe2.python import core, dyndep, workspace
from dnnlowp_test_utils import check_quantized_results_close
from hypothesis import given
dyndep.InitOpsLibrary("//caffe2/caffe2/quantization/server:dnnlowp_ops")
+workspace.GlobalInit(["caffe2", "--caffe2_omp_num_threads=11"])
class DNNLowPGatherOpTest(hu.HypothesisTestCase):
import caffe2.python.hypothesis_test_util as hu
import hypothesis.strategies as st
import numpy as np
-from caffe2.python import core, dyndep
+from caffe2.python import core, dyndep, workspace
from caffe2.quantization.server import utils as dnnlowp_utils
from dnnlowp_test_utils import check_quantized_results_close
from hypothesis import given
dyndep.InitOpsLibrary("//caffe2/caffe2/quantization/server:dnnlowp_ops")
+workspace.GlobalInit(["caffe2", "--caffe2_omp_num_threads=11"])
class DNNLowPOpGroupNormTest(hu.HypothesisTestCase):
import caffe2.python.hypothesis_test_util as hu
import hypothesis.strategies as st
import numpy as np
-from caffe2.python import core, dyndep
+from caffe2.python import core, dyndep, workspace
from hypothesis import given
dyndep.InitOpsLibrary("//caffe2/caffe2/quantization/server:dnnlowp_ops")
+workspace.GlobalInit(["caffe2", "--caffe2_omp_num_threads=11"])
class DNNLowPLSTMUnitOpTest(hu.HypothesisTestCase):
import caffe2.python.hypothesis_test_util as hu
import hypothesis.strategies as st
import numpy as np
-from caffe2.python import core, dyndep
+from caffe2.python import core, dyndep, workspace
from dnnlowp_test_utils import check_quantized_results_close
from hypothesis import assume, given
dyndep.InitOpsLibrary("//caffe2/caffe2/quantization/server:dnnlowp_ops")
+workspace.GlobalInit(["caffe2", "--caffe2_omp_num_threads=11"])
class DNNLowPOpPoolTest(hu.HypothesisTestCase):
import caffe2.python.hypothesis_test_util as hu
import hypothesis.strategies as st
import numpy as np
-from caffe2.python import core, dyndep
+from caffe2.python import core, dyndep, workspace
from hypothesis import given
dyndep.InitOpsLibrary("//caffe2/caffe2/quantization/server:dnnlowp_ops")
+workspace.GlobalInit(["caffe2", "--caffe2_omp_num_threads=11"])
class DNNLowPQuantizeOpTest(hu.HypothesisTestCase):
import numpy as np
import caffe2.python.hypothesis_test_util as hu
-from caffe2.python import core, dyndep
+from caffe2.python import core, dyndep, workspace
from hypothesis import given
import hypothesis.strategies as st
import collections
from dnnlowp_test_utils import check_quantized_results_close
dyndep.InitOpsLibrary("//caffe2/caffe2/quantization/server:dnnlowp_ops")
+workspace.GlobalInit(["caffe2", "--caffe2_omp_num_threads=11"])
class DNNLowPReluOpTest(hu.HypothesisTestCase):
dyndep.InitOpsLibrary("//caffe2/caffe2/quantization/server:dnnlowp_ops")
+workspace.GlobalInit(["caffe2", "--caffe2_omp_num_threads=11"])
class DNNLowPResizeNearestOpTest(hu.HypothesisTestCase):
import caffe2.python.hypothesis_test_util as hu
import hypothesis.strategies as st
import numpy as np
-from caffe2.python import core, dyndep
+from caffe2.python import core, dyndep, workspace
from hypothesis import given
dyndep.InitOpsLibrary("//caffe2/caffe2/quantization/server:dnnlowp_ops")
+workspace.GlobalInit(["caffe2", "--caffe2_omp_num_threads=11"])
class DNNLowPSigmoidOpTest(hu.HypothesisTestCase):
import caffe2.python.hypothesis_test_util as hu
import hypothesis.strategies as st
import numpy as np
-from caffe2.python import core, dyndep
+from caffe2.python import core, dyndep, workspace
from hypothesis import given
dyndep.InitOpsLibrary("//caffe2/caffe2/quantization/server:dnnlowp_ops")
+workspace.GlobalInit(["caffe2", "--caffe2_omp_num_threads=11"])
class DNNLowPTanhOpTest(hu.HypothesisTestCase):