A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://docs.pytorch.org/docs/stable/generated/torch.fake_quantize_per_tensor_affine.html below:

torch.fake_quantize_per_tensor_affine — PyTorch 2.8 documentation

Returns a new tensor with the data in input fake quantized using scale, zero_point, quant_min and quant_max.

output = ( m i n ( quant_max , m a x ( quant_min , std::nearby_int ( input / scale ) + zero_point ) ) − zero_point ) × scale \text{output} = ( min( \text{quant\_max}, max( \text{quant\_min}, \text{std::nearby\_int}(\text{input} / \text{scale}) + \text{zero\_point} ) ) - \text{zero\_point} ) \times \text{scale} output=(min(quant_max,max(quant_min,std::nearby_int(input/scale)+zero_point))zero_point)×scale

Parameters
Returns

A newly fake_quantized torch.float32 tensor

Return type

Tensor

Example:

>>> x = torch.randn(4)
>>> x
tensor([ 0.0552,  0.9730,  0.3973, -1.0780])
>>> torch.fake_quantize_per_tensor_affine(x, 0.1, 0, 0, 255)
tensor([0.1000, 1.0000, 0.4000, 0.0000])
>>> torch.fake_quantize_per_tensor_affine(x, torch.tensor(0.1), torch.tensor(0), 0, 255)
tensor([0.1000, 1.0000, 0.4000, 0.0000])

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4