analogvnn.nn.precision.StochasticReducePrecision#

Module Contents#

Classes#

StochasticReducePrecision

Implements the stochastic reduce precision function.

class analogvnn.nn.precision.StochasticReducePrecision.StochasticReducePrecision(precision: int = 8)[source]#

Bases: analogvnn.nn.precision.Precision.Precision, analogvnn.backward.BackwardIdentity.BackwardIdentity

Implements the stochastic reduce precision function.

Variables:

precision (nn.Parameter) – the precision of the output tensor.

property precision_width: torch.Tensor[source]#

The precision width.

Returns:

the precision width

Return type:

Tensor

property bit_precision: torch.Tensor[source]#

The bit precision of the ReducePrecision module.

Returns:

the bit precision of the ReducePrecision module.

Return type:

Tensor

__constants__ = ['precision'][source]#
precision: torch.nn.Parameter[source]#
static convert_to_precision(bit_precision: analogvnn.utils.common_types.TENSOR_OPERABLE) analogvnn.utils.common_types.TENSOR_OPERABLE[source]#

Convert the bit precision to the precision.

Parameters:

bit_precision (TENSOR_OPERABLE) – the bit precision.

Returns:

the precision.

Return type:

TENSOR_OPERABLE

extra_repr() str[source]#

The extra __repr__ string of the StochasticReducePrecision module.

Returns:

string

Return type:

str

forward(x: torch.Tensor) torch.Tensor[source]#

Forward function of the StochasticReducePrecision module.

Parameters:

x (Tensor) – input tensor.

Returns:

output tensor.

Return type:

Tensor