Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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)
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,
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,