hard_quantize
- torchhd.hard_quantize(input: Tensor)[source]
Applies binary quantization to all elements of the input tensor.
Warning
This function does not take the VSA model class into account.
- Parameters:
input (Tensor) – input tensor
- Shapes:
Input: \((*)\)
Output: \((*)\)
Examples:
>>> x = torchhd.random(2, 6) >>> x tensor([[ 1., 1., -1., 1., 1., 1.], [ 1., -1., -1., -1., 1., -1.]]) >>> y = torchhd.bundle(x[0], x[1]) >>> y tensor([ 2., 0., -2., 0., 2., 0.]) >>> torchhd.hard_quantize(y) tensor([ 1., -1., -1., -1., 1., -1.])