Functions | |
def | quantize_by_range (x, num_bits) |
def | quantize_by_range_fused (x_tuple, num_bits) |
def | copy_state_and_quantize (dst, src, num_bits) |
def | copy_state_and_quantize_fused (dst, src, num_bits) |
def | compare (a, b, rtol=1e-7, atol=1e-6, ctol=1e-6) |
def | assert_min_mse (a, b, tol=1e-20) |
def | quant_np (x, amax, num_bits=8, fake=False, narrow_range=True) |
def tests.utils.quantize_by_range | ( | x, | |
num_bits | |||
) |
Quantize torch tensor by range to num_bits with symmetric zero-mean quantizer.
def tests.utils.quantize_by_range_fused | ( | x_tuple, | |
num_bits | |||
) |
Quantize multiple torch tensors by combined range to num_bits with symmetric zero-mean quantizer.
def tests.utils.copy_state_and_quantize | ( | dst, | |
src, | |||
num_bits | |||
) |
Copy src to dst, quantize all 'weight' entries to num_bits.
def tests.utils.copy_state_and_quantize_fused | ( | dst, | |
src, | |||
num_bits | |||
) |
Copy src to dst, quantize all 'weight' entries to num_bits using the aggregate amax.
def tests.utils.compare | ( | a, | |
b, | |||
rtol = 1e-7 , |
|||
atol = 1e-6 , |
|||
ctol = 1e-6 |
|||
) |
Compare two tensors and raise AssertionError if their difference is outside of tolerance.
def tests.utils.assert_min_mse | ( | a, | |
b, | |||
tol = 1e-20 |
|||
) |
Assert that the mean squared error between a and b is at least tol.
def tests.utils.quant_np | ( | x, | |
amax, | |||
num_bits = 8 , |
|||
fake = False , |
|||
narrow_range = True |
|||
) |
Quantize x using numpy.