Skip to contents

Post-training integer quantization (Geron Ch 17, morie.fn hmint8)

Usage

morie_geron_int8_quant(x, n_bits = 8, symmetric = TRUE)

Arguments

x

Tensor.

n_bits

Bit width (2..16).

symmetric

Symmetric or asymmetric scheme.

Value

List with q, dequantized, scale, zero_point, max_error, rel_error, compression, estimate, n, method.

Examples

V <- c(1, 2, 3, 4, 5, 6, 7, 8)
morie_geron_int8_quant(V)
#> $q
#> [1]  16  32  48  64  79  95 111 127
#> 
#> $dequantized
#> [1] 1.007874 2.015748 3.023622 4.031496 4.976378 5.984252 6.992126 8.000000
#> 
#> $scale
#> [1] 0.06299213
#> 
#> $zero_point
#> [1] 0
#> 
#> $max_error
#> [1] 0.03149606
#> 
#> $rel_error
#> [1] 0.007874016
#> 
#> $compression
#> [1] 8
#> 
#> $n_levels
#> [1] 256
#> 
#> $estimate
#> [1] 0.03149606
#> 
#> $n
#> [1] 8
#> 
#> $method
#> [1] "Post-training integer quantization"
#>