soft_quantize
- torchhd.soft_quantize(input: Tensor)[source]
Applies the hyperbolic tanh function 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.soft_quantize(y) tensor([ 0.9640, 0.0000, -0.9640, 0.0000, 0.9640, 0.0000])