randsel
- torchhd.randsel(input: VSATensor, other: VSATensor, *, p: float = 0.5, generator: Generator | None = None) VSATensor[source]
Bundles two hypervectors by selecting random elements.
A bundling operation is used to aggregate information into a single hypervector. The resulting hypervector has elements selected at random from input or other.
\[\oplus: \mathcal{H} \times \mathcal{H} \to \mathcal{H}\]- Parameters:
- Shapes:
Input: \((*)\)
Other: \((*)\)
Output: \((*)\)
Examples:
>>> a, b = torchhd.random(2, 6, "FHRR") >>> a tensor([-0.7404-0.6721j, 0.8280-0.5608j, -0.5059+0.8626j, -0.9965-0.0841j, -0.7337+0.6795j, -0.9925-0.1223j]) >>> b tensor([-0.5593+0.8290j, 0.8097-0.5869j, 0.8306+0.5569j, -0.4970+0.8678j, 0.9962+0.0875j, -0.6631+0.7485j]) >>> torchhd.randsel(a, b) tensor([-0.7404-0.6721j, 0.8280-0.5608j, -0.5059+0.8626j, -0.9965-0.0841j, -0.7337+0.6795j, -0.9925-0.1223j])