How to use the nncf.quantization.layers.QuantizerConfig function in nncf

To help you get started, we’ve selected a few nncf examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github opencv / openvino_training_extensions / pytorch_toolkit / nncf / tools / benchmark_quantize_layers.py View on Github external
print("Custom Symmetric Per Activation Channel  (cuda 0 ) impl")
        print("input size: {0}".format(input_size))
        run_profile(
            SymmetricQuantizer(QuantizerConfig(QuantizationParams(bits=NBITS),
                                               input_shape=input_size,
                                               per_channel=True,
                                               is_weights=False)).cuda(),
            input_size,
            'cuda',
            gpu_runs)

        print()
        print("Custom Asymmetric (cuda 0 ) impl:")
        print("input size: {0}".format(input_size))
        run_profile(
            AsymmetricQuantizer(QuantizerConfig(QuantizationParams(bits=NBITS))).cuda(),
            input_size,
            'cuda',
            gpu_runs)

        print()
        print("Custom Asymmetric Per Weight Channel  (cuda 0 ) impl")
        print("input size: {0}".format(input_size))
        run_profile(
            AsymmetricQuantizer(QuantizerConfig(QuantizationParams(bits=NBITS),
                                                input_shape=input_size,
                                                per_channel=True,
                                                is_weights=True)).cuda(),
            input_size,
            'cuda',
            gpu_runs)
github opencv / openvino_training_extensions / pytorch_toolkit / nncf / tools / benchmark_quantize_layers.py View on Github external
print("Pytorch Symmetric Per Weight Channel (cuda 0) impl:")
        print("input size: {0}".format(input_size))
        run_profile(
            ReferenceQuantize(NBITS,
                              input_shape=input_size,
                              per_channel=True,
                              is_weights=True).cuda(),
            input_size,
            'cuda',
            gpu_runs)

        print()
        print("Custom Symmetric Per Weight Channel  (cuda 0 ) impl")
        print("input size: {0}".format(input_size))
        run_profile(
            SymmetricQuantizer(QuantizerConfig(QuantizationParams(bits=NBITS),
                                               input_shape=input_size,
                                               per_channel=True,
                                               is_weights=True)).cuda(),
            input_size,
            'cuda',
            gpu_runs)

        print()
        print("Pytorch Symmetric Per Activation Channel (cuda 0) impl:")
        print("input size: {0}".format(input_size))
        run_profile(
            ReferenceQuantize(NBITS,
                              input_shape=input_size,
                              per_channel=True,
                              is_weights=False).cuda(),
            input_size,
github opencv / openvino_training_extensions / pytorch_toolkit / nncf / tools / benchmark_quantize_layers.py View on Github external
CPU_RUNS)

    print()
    print("Custom Asymmetric (cpu) impl:")
    print("input size: {0}".format(LOW_BATCH_INPUT_SIZE))
    run_profile(
        AsymmetricQuantizer(QuantizerConfig(QuantizationParams(bits=NBITS))),
        LOW_BATCH_INPUT_SIZE,
        'cpu',
        CPU_RUNS)

    print()
    print("Custom Asymmetric Per Weight Channel  (cpu) impl")
    print("input size: {0}".format(LOW_BATCH_INPUT_SIZE))
    run_profile(
        AsymmetricQuantizer(QuantizerConfig(QuantizationParams(bits=NBITS),
                                            input_shape=LOW_BATCH_INPUT_SIZE,
                                            per_channel=True,
                                            is_weights=True)),
        LOW_BATCH_INPUT_SIZE,
        'cpu',
        CPU_RUNS)

    print()
    print("Custom Asymmetric Per Activation Channel  (cpu) impl")
    print("input size: {0}".format(LOW_BATCH_INPUT_SIZE))
    run_profile(
        AsymmetricQuantizer(QuantizerConfig(QuantizationParams(bits=NBITS),
                                            input_shape=LOW_BATCH_INPUT_SIZE,
                                            per_channel=True,
                                            is_weights=False)),
        LOW_BATCH_INPUT_SIZE,