torch_quantize_per_tensor | R Documentation |
Quantize_per_tensor
torch_quantize_per_tensor(self, scale, zero_point, dtype)
self |
(Tensor) float tensor to quantize |
scale |
(float) scale to apply in quantization formula |
zero_point |
(int) offset in integer value that maps to float zero |
dtype |
( |
Converts a float tensor to quantized tensor with given scale and zero point.
if (torch_is_installed()) {
torch_quantize_per_tensor(torch_tensor(c(-1.0, 0.0, 1.0, 2.0)), 0.1, 10, torch_quint8())
torch_quantize_per_tensor(torch_tensor(c(-1.0, 0.0, 1.0, 2.0)), 0.1, 10, torch_quint8())$int_repr()
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.