analogvnn.fn.reduce_precision#

Module Contents#

Functions#

reduce_precision(...)

Takes x and reduces its precision to precision by rounding to the nearest multiple of precision.

stochastic_reduce_precision(...)

Takes x and reduces its precision by rounding to the nearest multiple of precision with stochastic scheme.

analogvnn.fn.reduce_precision.reduce_precision(x: analogvnn.utils.common_types.TENSOR_OPERABLE, precision: analogvnn.utils.common_types.TENSOR_OPERABLE, divide: analogvnn.utils.common_types.TENSOR_OPERABLE) analogvnn.utils.common_types.TENSOR_OPERABLE[source]#

Takes x and reduces its precision to precision by rounding to the nearest multiple of precision.

Parameters:
  • x (TENSOR_OPERABLE) – Tensor

  • precision (TENSOR_OPERABLE) – the precision of the quantization.

  • divide (TENSOR_OPERABLE) – the number of bits to be reduced

Returns:

TENSOR_OPERABLE with the same shape as x, but with values rounded to the nearest multiple of precision.

Return type:

TENSOR_OPERABLE

analogvnn.fn.reduce_precision.stochastic_reduce_precision(x: analogvnn.utils.common_types.TENSOR_OPERABLE, precision: analogvnn.utils.common_types.TENSOR_OPERABLE) analogvnn.utils.common_types.TENSOR_OPERABLE[source]#

Takes x and reduces its precision by rounding to the nearest multiple of precision with stochastic scheme.

Parameters:
  • x (TENSOR_OPERABLE) – Tensor

  • precision (TENSOR_OPERABLE) – the precision of the quantization.

Returns:

TENSOR_OPERABLE with the same shape as x, but with values rounded to the nearest multiple of precision.

Return type:

TENSOR_OPERABLE