elasticai.creator.nn.quantized_grads.fixed_point.quantize_to_fixed_point#

Module Contents#

Classes#

Round

Round deterministically to nearest neighbour with STE.

Functions#

round_tensor

quantize_to_fxp_hte

Round fixed point half to even. The tensor is clamped and rounded to a fixed point number.

quantize_to_fxp_stochastic

API#

class elasticai.creator.nn.quantized_grads.fixed_point.quantize_to_fixed_point.Round(*args, **kwargs)[source]#

Bases: torch.autograd.Function

Round deterministically to nearest neighbour with STE.

Initialization

static forward(ctx, x, *args, **kwargs)[source]#
static backward(ctx, *grad_output)[source]#
elasticai.creator.nn.quantized_grads.fixed_point.quantize_to_fixed_point.round_tensor(x: torch.Tensor) torch.Tensor[source]#
elasticai.creator.nn.quantized_grads.fixed_point.quantize_to_fixed_point.quantize_to_fxp_hte(number: torch.Tensor, resolution_per_int: torch.Tensor, minimum_as_rational: torch.Tensor, maximum_as_rational: torch.Tensor) torch.Tensor[source]#

Round fixed point half to even. The tensor is clamped and rounded to a fixed point number.

elasticai.creator.nn.quantized_grads.fixed_point.quantize_to_fixed_point.quantize_to_fxp_stochastic(number: torch.Tensor, resolution_per_int: torch.Tensor, minimum_as_rational: torch.Tensor, maximum_as_rational: torch.Tensor) torch.Tensor[source]#