normalize
- torchhd.normalize(input: VSATensor) VSATensor[source]
Normalize the input hypervectors.
- Parameters:
input (Tensor) – input tensor
- Shapes:
Input: \((*)\)
Output: \((*)\)
Examples:
>>> x = torchhd.random(4, 10, "MAP").multibundle() >>> x MAPTensor([ 0., 0., -2., -2., 2., -2., 2., 2., 2., 0.]) >>> torchhd.normalize(x) MAPTensor([-1., -1., -1., -1., 1., -1., 1., 1., 1., -1.]) >>> x = torchhd.random(4, 10, "HRR").multibundle() >>> x HRRTensor([-0.2999, 0.4686, 0.1797, -0.4830, 0.2718, -0.3663, 0.3079, 0.2558, -1.5157, -0.5196]) >>> torchhd.normalize(x) HRRTensor([-0.1601, 0.2501, 0.0959, -0.2578, 0.1451, -0.1955, 0.1643, 0.1365, -0.8089, -0.2773])