View source: R/gen-namespace.R
torch_quantize_per_channel | R Documentation |
Quantize_per_channel
torch_quantize_per_channel(self, scales, zero_points, axis, dtype)
self |
(Tensor) float tensor to quantize |
scales |
(Tensor) float 1D tensor of scales to use, size should match |
zero_points |
(int) integer 1D tensor of offset to use, size should match |
axis |
(int) dimension on which apply per-channel quantization |
dtype |
( |
Converts a float tensor to per-channel quantized tensor with given scales and zero points.
if (torch_is_installed()) {
x = torch_tensor(matrix(c(-1.0, 0.0, 1.0, 2.0), ncol = 2, byrow = TRUE))
torch_quantize_per_channel(x, torch_tensor(c(0.1, 0.01)),
torch_tensor(c(10L, 0L)), 0, torch_quint8())
torch_quantize_per_channel(x, torch_tensor(c(0.1, 0.01)),
torch_tensor(c(10L, 0L)), 0, torch_quint8())$int_repr()
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.